mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-25 22:27:32 +00:00
refactor(plugins): the plugin RPC kit moves out of the plugins domain into src/nest-rpc
Every domain's *.rpc.ts was written against rpc-kit, rpc-params, rpc-errors and PluginGuards, and every domain module imported PluginGuardsModule, all of it inside src/nest/plugins, while PluginsRuntimeModule imports those same domains so their handlers exist at boot. That made the plugins domain part of every cycle. The kit imports no domain but the protocol tables and permissions/addons for the guards, so it moves to src/nest-rpc beside src/nest-mcp, with its tests, its README and its extraction rule; the runtime module keeps its domain imports, which the boot-time coverage check of the wire surface needs in any subset app.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { MikroOrmModule } from '@mikro-orm/nestjs';
|
||||
import { PermissionsModule } from '../nest/permissions/permissions.module';
|
||||
import { AddonsModule } from '../nest/addons/addons.module';
|
||||
import { Users } from '../db/entities/Users.entity';
|
||||
import { Trips } from '../db/entities/Trips.entity';
|
||||
import { PluginGuards } from './plugin-guards.service';
|
||||
|
||||
/**
|
||||
* A leaf module whose only job is to hand PluginGuards to the domain modules.
|
||||
*
|
||||
* It cannot live in PluginsModule: that module imports 22 domain modules, so a
|
||||
* domain importing it back to reach the guards would close a hard cycle
|
||||
* (PluginsModule -> TodoModule -> PluginsModule) and the only way out would be
|
||||
* forwardRef. PermissionsModule and AddonsModule are themselves leaves and
|
||||
* DatabaseModule is @Global, so this module imports nothing that leads back here.
|
||||
* `MikroOrmModule.forFeature([Users])` (Plan 3j Task 1 — PluginGuards' own
|
||||
* role lookup, PG3/PG4, now goes through UsersRepository) is the same kind of
|
||||
* leaf: it hands out a repository token, not a domain module, so it doesn't
|
||||
* reopen the cycle either — this module is the one that CONSTRUCTS
|
||||
* PluginGuards, so it (not each importer) owns the forFeature list.
|
||||
*
|
||||
* Same shape and same reason as MailerModule, which broke
|
||||
* AuthModule <-> NotificationsModule.
|
||||
*/
|
||||
@Module({
|
||||
imports: [PermissionsModule, AddonsModule, MikroOrmModule.forFeature([Users, Trips])],
|
||||
providers: [PluginGuards],
|
||||
exports: [PluginGuards],
|
||||
})
|
||||
export class PluginGuardsModule {}
|
||||
Reference in New Issue
Block a user