mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 16:03:02 +00:00
e40bc71e9f
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.
16 lines
653 B
TypeScript
16 lines
653 B
TypeScript
/**
|
|
* 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 {}
|