mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 05:21:15 +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,15 @@
|
||||
/**
|
||||
* The two error classes the plugin RPC boundary maps onto wire error codes.
|
||||
*
|
||||
* handle() in rpc-host.ts translates them: BadParams -> BAD_PARAMS,
|
||||
* ForbiddenResource -> RESOURCE_FORBIDDEN, anything else -> HOST_ERROR. Lifted out
|
||||
* of rpc-host.ts so decorated *.rpc.ts handlers can throw them without importing
|
||||
* the router itself; rpc-host.ts re-exports both, so existing importers are
|
||||
* unaffected.
|
||||
*/
|
||||
|
||||
/** Thrown by a handler when the acting user may not touch the requested resource. */
|
||||
export class ForbiddenResource extends Error {}
|
||||
|
||||
/** Thrown when a param is missing or has the wrong shape. */
|
||||
export class BadParams extends Error {}
|
||||
Reference in New Issue
Block a user