@ddd-ts-kit/http 0.90.0 → 0.91.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.fr.md +222 -2
- package/README.md +217 -1
- package/dist/error/refusal-codes-by-status.d.ts +11 -0
- package/dist/error/refusal-codes-by-status.d.ts.map +1 -0
- package/dist/error/refusal-codes-by-status.js +48 -0
- package/dist/error/refusal-codes-by-status.js.map +1 -0
- package/dist/nest/controllers/arguments-of.d.ts +7 -0
- package/dist/nest/controllers/arguments-of.d.ts.map +1 -0
- package/dist/nest/controllers/arguments-of.js +21 -0
- package/dist/nest/controllers/arguments-of.js.map +1 -0
- package/dist/nest/controllers/assert-not-routed-by-nest.d.ts +8 -0
- package/dist/nest/controllers/assert-not-routed-by-nest.d.ts.map +1 -0
- package/dist/nest/controllers/assert-not-routed-by-nest.js +19 -0
- package/dist/nest/controllers/assert-not-routed-by-nest.js.map +1 -0
- package/dist/nest/controllers/controllers-binder.d.ts +6 -0
- package/dist/nest/controllers/controllers-binder.d.ts.map +1 -0
- package/dist/nest/controllers/controllers-binder.js +5 -0
- package/dist/nest/controllers/controllers-binder.js.map +1 -0
- package/dist/nest/controllers/controllers-module-options.d.ts +8 -0
- package/dist/nest/controllers/controllers-module-options.d.ts.map +1 -0
- package/dist/nest/controllers/controllers-module-options.js +2 -0
- package/dist/nest/controllers/controllers-module-options.js.map +1 -0
- package/dist/nest/controllers/create-controllers-module.d.ts +10 -0
- package/dist/nest/controllers/create-controllers-module.d.ts.map +1 -0
- package/dist/nest/controllers/create-controllers-module.js +28 -0
- package/dist/nest/controllers/create-controllers-module.js.map +1 -0
- package/dist/nest/controllers/current-actor.d.ts +6 -0
- package/dist/nest/controllers/current-actor.d.ts.map +1 -0
- package/dist/nest/controllers/current-actor.js +9 -0
- package/dist/nest/controllers/current-actor.js.map +1 -0
- package/dist/nest/controllers/dto-type.d.ts +3 -0
- package/dist/nest/controllers/dto-type.d.ts.map +1 -0
- package/dist/nest/controllers/dto-type.js +2 -0
- package/dist/nest/controllers/dto-type.js.map +1 -0
- package/dist/nest/controllers/injected-parameter.d.ts +4 -0
- package/dist/nest/controllers/injected-parameter.d.ts.map +1 -0
- package/dist/nest/controllers/injected-parameter.js +17 -0
- package/dist/nest/controllers/injected-parameter.js.map +1 -0
- package/dist/nest/controllers/is-nest-controller.d.ts +4 -0
- package/dist/nest/controllers/is-nest-controller.d.ts.map +1 -0
- package/dist/nest/controllers/is-nest-controller.js +7 -0
- package/dist/nest/controllers/is-nest-controller.js.map +1 -0
- package/dist/nest/controllers/keyed-schema.d.ts +8 -0
- package/dist/nest/controllers/keyed-schema.d.ts.map +1 -0
- package/dist/nest/controllers/keyed-schema.js +33 -0
- package/dist/nest/controllers/keyed-schema.js.map +1 -0
- package/dist/nest/controllers/kit-route-spec.d.ts +47 -0
- package/dist/nest/controllers/kit-route-spec.d.ts.map +1 -0
- package/dist/nest/controllers/kit-route-spec.js +2 -0
- package/dist/nest/controllers/kit-route-spec.js.map +1 -0
- package/dist/nest/controllers/kit-route.d.ts +18 -0
- package/dist/nest/controllers/kit-route.d.ts.map +1 -0
- package/dist/nest/controllers/kit-route.js +29 -0
- package/dist/nest/controllers/kit-route.js.map +1 -0
- package/dist/nest/controllers/kit-routes-options.d.ts +15 -0
- package/dist/nest/controllers/kit-routes-options.d.ts.map +1 -0
- package/dist/nest/controllers/kit-routes-options.js +2 -0
- package/dist/nest/controllers/kit-routes-options.js.map +1 -0
- package/dist/nest/controllers/kit-routes.d.ts +5 -0
- package/dist/nest/controllers/kit-routes.d.ts.map +1 -0
- package/dist/nest/controllers/kit-routes.js +8 -0
- package/dist/nest/controllers/kit-routes.js.map +1 -0
- package/dist/nest/controllers/nest-controller-class.d.ts +3 -0
- package/dist/nest/controllers/nest-controller-class.d.ts.map +1 -0
- package/dist/nest/controllers/nest-controller-class.js +2 -0
- package/dist/nest/controllers/nest-controller-class.js.map +1 -0
- package/dist/nest/controllers/nest-controller-route.d.ts +6 -0
- package/dist/nest/controllers/nest-controller-route.d.ts.map +1 -0
- package/dist/nest/controllers/nest-controller-route.js +12 -0
- package/dist/nest/controllers/nest-controller-route.js.map +1 -0
- package/dist/nest/controllers/nest-controller-routes-options.d.ts +14 -0
- package/dist/nest/controllers/nest-controller-routes-options.d.ts.map +1 -0
- package/dist/nest/controllers/nest-controller-routes-options.js +2 -0
- package/dist/nest/controllers/nest-controller-routes-options.js.map +1 -0
- package/dist/nest/controllers/nest-controller-routes.d.ts +12 -0
- package/dist/nest/controllers/nest-controller-routes.d.ts.map +1 -0
- package/dist/nest/controllers/nest-controller-routes.js +142 -0
- package/dist/nest/controllers/nest-controller-routes.js.map +1 -0
- package/dist/nest/controllers/nest-controllers-options.d.ts +7 -0
- package/dist/nest/controllers/nest-controllers-options.d.ts.map +1 -0
- package/dist/nest/controllers/nest-controllers-options.js +2 -0
- package/dist/nest/controllers/nest-controllers-options.js.map +1 -0
- package/dist/nest/controllers/nest-controllers.d.ts +21 -0
- package/dist/nest/controllers/nest-controllers.d.ts.map +1 -0
- package/dist/nest/controllers/nest-controllers.js +31 -0
- package/dist/nest/controllers/nest-controllers.js.map +1 -0
- package/dist/nest/controllers/nest-method.d.ts +17 -0
- package/dist/nest/controllers/nest-method.d.ts.map +1 -0
- package/dist/nest/controllers/nest-method.js +2 -0
- package/dist/nest/controllers/nest-method.js.map +1 -0
- package/dist/nest/controllers/nest-parameter.d.ts +10 -0
- package/dist/nest/controllers/nest-parameter.d.ts.map +1 -0
- package/dist/nest/controllers/nest-parameter.js +2 -0
- package/dist/nest/controllers/nest-parameter.js.map +1 -0
- package/dist/nest/controllers/nest-route-metadata.d.ts +22 -0
- package/dist/nest/controllers/nest-route-metadata.d.ts.map +1 -0
- package/dist/nest/controllers/nest-route-metadata.js +121 -0
- package/dist/nest/controllers/nest-route-metadata.js.map +1 -0
- package/dist/nest/controllers/nest-route-methods.d.ts +4 -0
- package/dist/nest/controllers/nest-route-methods.d.ts.map +1 -0
- package/dist/nest/controllers/nest-route-methods.js +12 -0
- package/dist/nest/controllers/nest-route-methods.js.map +1 -0
- package/dist/nest/controllers/nest-routes-registry.d.ts +18 -0
- package/dist/nest/controllers/nest-routes-registry.d.ts.map +1 -0
- package/dist/nest/controllers/nest-routes-registry.js +23 -0
- package/dist/nest/controllers/nest-routes-registry.js.map +1 -0
- package/dist/nest/controllers/prototype-of.d.ts +4 -0
- package/dist/nest/controllers/prototype-of.d.ts.map +1 -0
- package/dist/nest/controllers/prototype-of.js +10 -0
- package/dist/nest/controllers/prototype-of.js.map +1 -0
- package/dist/nest/controllers/provide-controllers.d.ts +12 -0
- package/dist/nest/controllers/provide-controllers.d.ts.map +1 -0
- package/dist/nest/controllers/provide-controllers.js +33 -0
- package/dist/nest/controllers/provide-controllers.js.map +1 -0
- package/dist/nest/controllers/reflected-metadata.d.ts +3 -0
- package/dist/nest/controllers/reflected-metadata.d.ts.map +1 -0
- package/dist/nest/controllers/reflected-metadata.js +11 -0
- package/dist/nest/controllers/reflected-metadata.js.map +1 -0
- package/dist/nest/controllers/request-schemas-of.d.ts +13 -0
- package/dist/nest/controllers/request-schemas-of.d.ts.map +1 -0
- package/dist/nest/controllers/request-schemas-of.js +49 -0
- package/dist/nest/controllers/request-schemas-of.js.map +1 -0
- package/dist/nest/controllers/route-context.d.ts +3 -0
- package/dist/nest/controllers/route-context.d.ts.map +1 -0
- package/dist/nest/controllers/route-context.js +6 -0
- package/dist/nest/controllers/route-context.js.map +1 -0
- package/dist/nest/controllers/schema-of.d.ts +6 -0
- package/dist/nest/controllers/schema-of.d.ts.map +1 -0
- package/dist/nest/controllers/schema-of.js +12 -0
- package/dist/nest/controllers/schema-of.js.map +1 -0
- package/dist/nest/controllers/summary-of.d.ts +3 -0
- package/dist/nest/controllers/summary-of.d.ts.map +1 -0
- package/dist/nest/controllers/summary-of.js +6 -0
- package/dist/nest/controllers/summary-of.js.map +1 -0
- package/dist/nest/controllers/with-answers.d.ts +10 -0
- package/dist/nest/controllers/with-answers.d.ts.map +1 -0
- package/dist/nest/controllers/with-answers.js +11 -0
- package/dist/nest/controllers/with-answers.js.map +1 -0
- package/dist/nest.d.ts +18 -0
- package/dist/nest.d.ts.map +1 -1
- package/dist/nest.js +11 -0
- package/dist/nest.js.map +1 -1
- package/dist/openapi/responses.d.ts.map +1 -1
- package/dist/openapi/responses.js +2 -41
- package/dist/openapi/responses.js.map +1 -1
- package/dist/orpc/orpc-protocol.d.ts +7 -0
- package/dist/orpc/orpc-protocol.d.ts.map +1 -0
- package/dist/orpc/orpc-protocol.js +13 -0
- package/dist/orpc/orpc-protocol.js.map +1 -0
- package/dist/orpc/orpc-router.d.ts +22 -0
- package/dist/orpc/orpc-router.d.ts.map +1 -0
- package/dist/orpc/orpc-router.js +43 -0
- package/dist/orpc/orpc-router.js.map +1 -0
- package/dist/orpc.d.ts +4 -0
- package/dist/orpc.d.ts.map +1 -0
- package/dist/orpc.js +2 -0
- package/dist/orpc.js.map +1 -0
- package/dist/pipeline/primed.d.ts +2 -1
- package/dist/pipeline/primed.d.ts.map +1 -1
- package/dist/pipeline/primed.js +14 -11
- package/dist/pipeline/primed.js.map +1 -1
- package/dist/rpc/rpc-answer.d.ts +18 -0
- package/dist/rpc/rpc-answer.d.ts.map +1 -0
- package/dist/rpc/rpc-answer.js +61 -0
- package/dist/rpc/rpc-answer.js.map +1 -0
- package/dist/rpc/rpc-context.d.ts +15 -0
- package/dist/rpc/rpc-context.d.ts.map +1 -0
- package/dist/rpc/rpc-context.js +2 -0
- package/dist/rpc/rpc-context.js.map +1 -0
- package/dist/rpc/rpc-input.d.ts +11 -0
- package/dist/rpc/rpc-input.d.ts.map +1 -0
- package/dist/rpc/rpc-input.js +2 -0
- package/dist/rpc/rpc-input.js.map +1 -0
- package/dist/rpc/rpc-refusal.d.ts +14 -0
- package/dist/rpc/rpc-refusal.d.ts.map +1 -0
- package/dist/rpc/rpc-refusal.js +2 -0
- package/dist/rpc/rpc-refusal.js.map +1 -0
- package/dist/rpc/rpc-request.d.ts +9 -0
- package/dist/rpc/rpc-request.d.ts.map +1 -0
- package/dist/rpc/rpc-request.js +28 -0
- package/dist/rpc/rpc-request.js.map +1 -0
- package/dist/trpc/route-refusal.d.ts +8 -0
- package/dist/trpc/route-refusal.d.ts.map +1 -0
- package/dist/trpc/route-refusal.js +10 -0
- package/dist/trpc/route-refusal.js.map +1 -0
- package/dist/trpc/trpc-error-shape.d.ts +17 -0
- package/dist/trpc/trpc-error-shape.d.ts.map +1 -0
- package/dist/trpc/trpc-error-shape.js +2 -0
- package/dist/trpc/trpc-error-shape.js.map +1 -0
- package/dist/trpc/trpc-protocol.d.ts +8 -0
- package/dist/trpc/trpc-protocol.d.ts.map +1 -0
- package/dist/trpc/trpc-protocol.js +43 -0
- package/dist/trpc/trpc-protocol.js.map +1 -0
- package/dist/trpc/trpc-router.d.ts +38 -0
- package/dist/trpc/trpc-router.d.ts.map +1 -0
- package/dist/trpc/trpc-router.js +44 -0
- package/dist/trpc/trpc-router.js.map +1 -0
- package/dist/trpc.d.ts +5 -0
- package/dist/trpc.d.ts.map +1 -0
- package/dist/trpc.js +2 -0
- package/dist/trpc.js.map +1 -0
- package/package.json +30 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controllers-binder.d.ts","sourceRoot":"","sources":["../../../src/nest/controllers/controllers-binder.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,8BAAsB,iBAAiB;IACrC,MAAM,CAAC,QAAQ,CAAC,QAAQ,4BAA4B;IAEpD,QAAQ,CAAC,YAAY,IAAI,IAAI,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controllers-binder.js","sourceRoot":"","sources":["../../../src/nest/controllers/controllers-binder.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,MAAM,OAAgB,iBAAiB;IACrC,MAAM,CAAU,QAAQ,GAAG,wBAAwB,CAAC;CAGrD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Provider } from '@nestjs/common';
|
|
2
|
+
import type { RoutesModuleOptions } from '../create-routes-module.js';
|
|
3
|
+
import type { NestControllerRoutesOptions } from './nest-controller-routes-options.js';
|
|
4
|
+
export interface ControllersModuleOptions extends RoutesModuleOptions, Pick<NestControllerRoutesOptions, 'schemaOfClass' | 'security'> {
|
|
5
|
+
/** What the controllers and the guards they name are built with, besides what `imports` exports. */
|
|
6
|
+
readonly providers?: readonly Provider[];
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=controllers-module-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controllers-module-options.d.ts","sourceRoot":"","sources":["../../../src/nest/controllers/controllers-module-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAEpF,MAAM,WAAW,wBACf,SAAQ,mBAAmB,EACzB,IAAI,CAAC,2BAA2B,EAAE,eAAe,GAAG,UAAU,CAAC;IACjE,oGAAoG;IACpG,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controllers-module-options.js","sourceRoot":"","sources":["../../../src/nest/controllers/controllers-module-options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DynamicModule, Type } from '@nestjs/common';
|
|
2
|
+
import type { ControllersModuleOptions } from './controllers-module-options.js';
|
|
3
|
+
/**
|
|
4
|
+
* A Nest module whose controllers the kit serves: Nest's container builds them, with what they
|
|
5
|
+
* inject, and the kit mounts each method carrying `@KitRoute` as a route of its own pipeline on the
|
|
6
|
+
* HTTP server underneath Nest, Express or Fastify. A controller listed here is never listed in the
|
|
7
|
+
* `controllers` of a Nest module too: the start is refused.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createControllersModule(controllers: readonly Type<unknown>[], options?: ControllersModuleOptions): DynamicModule;
|
|
10
|
+
//# sourceMappingURL=create-controllers-module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-controllers-module.d.ts","sourceRoot":"","sources":["../../../src/nest/controllers/create-controllers-module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAI1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAG7E;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,IAAI,CAAC,OAAO,CAAC,EAAE,EACrC,OAAO,GAAE,wBAA6B,GACrC,aAAa,CAuBf"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ModuleRef, ModulesContainer } from '@nestjs/core';
|
|
2
|
+
import { createRoutesModule } from '../create-routes-module.js';
|
|
3
|
+
import { assertNotRoutedByNest } from './assert-not-routed-by-nest.js';
|
|
4
|
+
import { nestControllerRoutes } from './nest-controller-routes.js';
|
|
5
|
+
/**
|
|
6
|
+
* A Nest module whose controllers the kit serves: Nest's container builds them, with what they
|
|
7
|
+
* inject, and the kit mounts each method carrying `@KitRoute` as a route of its own pipeline on the
|
|
8
|
+
* HTTP server underneath Nest, Express or Fastify. A controller listed here is never listed in the
|
|
9
|
+
* `controllers` of a Nest module too: the start is refused.
|
|
10
|
+
*/
|
|
11
|
+
export function createControllersModule(controllers, options = {}) {
|
|
12
|
+
const { providers = [], schemaOfClass, security, ...routesOptions } = options;
|
|
13
|
+
const module = createRoutesModule({
|
|
14
|
+
inject: [ModuleRef, ModulesContainer],
|
|
15
|
+
useFactory: (references, modules) => {
|
|
16
|
+
assertNotRoutedByNest(modules);
|
|
17
|
+
const built = (target) => references.get(target, { strict: false });
|
|
18
|
+
return nestControllerRoutes(controllers, {
|
|
19
|
+
instanceOf: built,
|
|
20
|
+
resolve: built,
|
|
21
|
+
...(schemaOfClass === undefined ? {} : { schemaOfClass }),
|
|
22
|
+
...(security === undefined ? {} : { security }),
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
}, routesOptions);
|
|
26
|
+
return { ...module, providers: [...(module.providers ?? []), ...controllers, ...providers] };
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=create-controllers-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-controllers-module.js","sourceRoot":"","sources":["../../../src/nest/controllers/create-controllers-module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,WAAqC,EACrC,OAAO,GAA6B,EAAE;IAEtC,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAE,GAAG,OAAO,CAAC;IAE9E,MAAM,MAAM,GAAG,kBAAkB,CAC/B;QACE,MAAM,EAAE,CAAC,SAAS,EAAE,gBAAgB,CAAC;QACrC,UAAU,EAAE,CAAC,UAAqB,EAAE,OAAyB,EAAE,EAAE;YAC/D,qBAAqB,CAAC,OAAO,CAAC,CAAC;YAE/B,MAAM,KAAK,GAAG,CAAI,MAA0C,EAAK,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;YAE9G,OAAO,oBAAoB,CAAC,WAAW,EAAE;gBACvC,UAAU,EAAE,KAAK;gBACjB,OAAO,EAAE,KAAK;gBACd,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC;gBACzD,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;aAChD,CAAC,CAAC;QACL,CAAC;KACF,EACD,aAAa,CACd,CAAC;IAEF,OAAO,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,GAAG,WAAW,EAAE,GAAG,SAAS,CAAC,EAAE,CAAC;AAC/F,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The caller of the route, as the authentication of the platform resolved it, for the command or
|
|
3
|
+
* the query the method sends: never an actor built by the controller.
|
|
4
|
+
*/
|
|
5
|
+
export declare function CurrentActor(): (target: object, method: string | symbol | undefined, index: number) => void;
|
|
6
|
+
//# sourceMappingURL=current-actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current-actor.d.ts","sourceRoot":"","sources":["../../../src/nest/controllers/current-actor.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,YAAY,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAE3G"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { injectedParameter } from './injected-parameter.js';
|
|
2
|
+
/**
|
|
3
|
+
* The caller of the route, as the authentication of the platform resolved it, for the command or
|
|
4
|
+
* the query the method sends: never an actor built by the controller.
|
|
5
|
+
*/
|
|
6
|
+
export function CurrentActor() {
|
|
7
|
+
return injectedParameter('actor');
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=current-actor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current-actor.js","sourceRoot":"","sources":["../../../src/nest/controllers/current-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dto-type.d.ts","sourceRoot":"","sources":["../../../src/nest/controllers/dto-type.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,MAAM,MAAM,OAAO,GAAG,UAAU,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dto-type.js","sourceRoot":"","sources":["../../../src/nest/controllers/dto-type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Injected } from './nest-routes-registry.js';
|
|
2
|
+
/** A parameter decorator of the kit: what it hands the parameter at that index of the method. */
|
|
3
|
+
export declare function injectedParameter(what: Injected): (target: object, method: string | symbol | undefined, index: number) => void;
|
|
4
|
+
//# sourceMappingURL=injected-parameter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injected-parameter.d.ts","sourceRoot":"","sources":["../../../src/nest/controllers/injected-parameter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAsB,MAAM,wBAAwB,CAAC;AAE3E,iGAAiG;AACjG,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,QAAQ,GACb,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAc9E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DeclarationError } from '@ddd-ts-kit/kernel/declarations';
|
|
2
|
+
import { nestRoutesRegistry } from './nest-routes-registry.js';
|
|
3
|
+
/** A parameter decorator of the kit: what it hands the parameter at that index of the method. */
|
|
4
|
+
export function injectedParameter(what) {
|
|
5
|
+
return (target, method, index) => {
|
|
6
|
+
if (typeof method !== 'string') {
|
|
7
|
+
throw new DeclarationError('A parameter decorator of the kit goes on a parameter of a method of a controller.');
|
|
8
|
+
}
|
|
9
|
+
const { injected } = nestRoutesRegistry();
|
|
10
|
+
const methods = injected.get(target) ?? new Map();
|
|
11
|
+
const parameters = methods.get(method) ?? new Map();
|
|
12
|
+
parameters.set(index, what);
|
|
13
|
+
methods.set(method, parameters);
|
|
14
|
+
injected.set(target, methods);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=injected-parameter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injected-parameter.js","sourceRoot":"","sources":["../../../src/nest/controllers/injected-parameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAiB,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE3E,iGAAiG;AACjG,MAAM,UAAU,iBAAiB,CAC/B,IAAc;IAEd,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;QAC/B,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,MAAM,IAAI,gBAAgB,CAAC,mFAAmF,CAAC,CAAC;QAClH,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,GAAG,kBAAkB,EAAE,CAAC;QAC1C,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,EAAiC,CAAC;QACjF,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,EAAoB,CAAC;QAEtE,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAChC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-nest-controller.d.ts","sourceRoot":"","sources":["../../../src/nest/controllers/is-nest-controller.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAGnE,6DAA6D;AAC7D,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,mBAAmB,GAAG,OAAO,CAEzE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PATH_METADATA } from '@nestjs/common/constants';
|
|
2
|
+
import { reflectedMetadata } from './reflected-metadata.js';
|
|
3
|
+
/** Whether Nest's `@Controller` was written on the class. */
|
|
4
|
+
export function isNestController(controller) {
|
|
5
|
+
return reflectedMetadata(PATH_METADATA, controller) !== undefined;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=is-nest-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-nest-controller.js","sourceRoot":"","sources":["../../../src/nest/controllers/is-nest-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,6DAA6D;AAC7D,MAAM,UAAU,gBAAgB,CAAC,UAA+B;IAC9D,OAAO,iBAAiB,CAAC,aAAa,EAAE,UAAU,CAAC,KAAK,SAAS,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Schema } from '@ddd-ts-kit/validation';
|
|
2
|
+
/**
|
|
3
|
+
* The schema of the parts a method names one by one (`@Param('invoiceId')`): each is a text, the
|
|
4
|
+
* parameters of the path required, the query and the headers optional. Headers are read in lower
|
|
5
|
+
* case, as Node gives them.
|
|
6
|
+
*/
|
|
7
|
+
export declare function keyedSchema(keys: readonly string[], required: boolean): Schema<Record<string, string>>;
|
|
8
|
+
//# sourceMappingURL=keyed-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyed-schema.d.ts","sourceRoot":"","sources":["../../../src/nest/controllers/keyed-schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAmB,MAAM,wBAAwB,CAAC;AAGtE;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA2BtG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { err, ok } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { isRecord } from '../../support/is-record.js';
|
|
3
|
+
/**
|
|
4
|
+
* The schema of the parts a method names one by one (`@Param('invoiceId')`): each is a text, the
|
|
5
|
+
* parameters of the path required, the query and the headers optional. Headers are read in lower
|
|
6
|
+
* case, as Node gives them.
|
|
7
|
+
*/
|
|
8
|
+
export function keyedSchema(keys, required) {
|
|
9
|
+
const names = [...new Set(keys)];
|
|
10
|
+
return {
|
|
11
|
+
parse(input) {
|
|
12
|
+
const parts = isRecord(input) ? input : {};
|
|
13
|
+
const issues = [];
|
|
14
|
+
const read = {};
|
|
15
|
+
for (const name of names) {
|
|
16
|
+
const value = parts[name];
|
|
17
|
+
if (typeof value === 'string' && value !== '') {
|
|
18
|
+
read[name] = value;
|
|
19
|
+
}
|
|
20
|
+
else if (value !== undefined || required) {
|
|
21
|
+
issues.push({ path: name, code: 'isString', message: `${name} is a required text.` });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return issues.length === 0 ? ok(read) : err(issues);
|
|
25
|
+
},
|
|
26
|
+
toJsonSchema: () => ({
|
|
27
|
+
type: 'object',
|
|
28
|
+
properties: Object.fromEntries(names.map((name) => [name, { type: 'string' }])),
|
|
29
|
+
...(required ? { required: names } : {}),
|
|
30
|
+
}),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=keyed-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyed-schema.js","sourceRoot":"","sources":["../../../src/nest/controllers/keyed-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,IAAuB,EAAE,QAAiB;IACpE,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAEjC,OAAO;QACL,KAAK,CAAC,KAAK;YACT,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3C,MAAM,MAAM,GAAsB,EAAE,CAAC;YACrC,MAAM,IAAI,GAA2B,EAAE,CAAC;YAExC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACzB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;gBAE1B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;oBAC9C,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;gBACrB,CAAC;qBAAM,IAAI,KAAK,KAAK,SAAS,IAAI,QAAQ,EAAE,CAAC;oBAC3C,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,IAAI,sBAAsB,EAAE,CAAC,CAAC;gBACxF,CAAC;YACH,CAAC;YAED,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtD,CAAC;QACD,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC;YACnB,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;YAC/E,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACzC,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Schema } from '@ddd-ts-kit/validation';
|
|
2
|
+
import type { CachePolicy } from '../../cache/cache-policy.js';
|
|
3
|
+
import type { IfMatch } from '../../cache/if-match.js';
|
|
4
|
+
import type { GuardReference } from '../../controller/guard-reference.js';
|
|
5
|
+
import type { DtoType } from './dto-type.js';
|
|
6
|
+
/**
|
|
7
|
+
* What a route says besides what Nest's decorators say (its method, its path, its parameters, its
|
|
8
|
+
* status): who may call it, the refusals it answers, its answer, its name in the contract. Every
|
|
9
|
+
* member is optional, and so is `@KitRoute` itself: a method that carries a route decorator of Nest
|
|
10
|
+
* is a route of the kit, named after the method.
|
|
11
|
+
*/
|
|
12
|
+
export interface KitRouteSpec {
|
|
13
|
+
/**
|
|
14
|
+
* Names the route in the contract, the function of the generated client and the procedure over
|
|
15
|
+
* /rpc and /trpc. Left out, the name of the method: `issueInvoice`.
|
|
16
|
+
*/
|
|
17
|
+
readonly operationId?: string;
|
|
18
|
+
/** Left out, the name of the method as a sentence: `Issue invoice`. */
|
|
19
|
+
readonly summary?: string;
|
|
20
|
+
readonly description?: string;
|
|
21
|
+
/** Added to those of @KitRoutes. */
|
|
22
|
+
readonly tags?: readonly string[];
|
|
23
|
+
/** Run after those of @KitRoutes. With none on either, the route is refused: `[Public]` says it is open. */
|
|
24
|
+
readonly guards?: readonly GuardReference[];
|
|
25
|
+
/** Domain error codes the route may answer, added to those of @KitRoutes and of its guards. */
|
|
26
|
+
readonly errors?: readonly string[];
|
|
27
|
+
/** Left out: the status of @HttpCode, else Nest's (201 for POST, 200 otherwise), and no body. */
|
|
28
|
+
readonly response?: {
|
|
29
|
+
readonly status?: number;
|
|
30
|
+
readonly description?: string;
|
|
31
|
+
/** A schema, or a DTO class read through the `schemaOfClass` of the module. */
|
|
32
|
+
readonly body?: Schema<unknown> | DtoType;
|
|
33
|
+
};
|
|
34
|
+
/** Schemas that replace what the types of the parameters give: for a project that does not write DTO classes. */
|
|
35
|
+
readonly request?: {
|
|
36
|
+
readonly params?: Schema<unknown>;
|
|
37
|
+
readonly query?: Schema<unknown>;
|
|
38
|
+
readonly headers?: Schema<unknown>;
|
|
39
|
+
readonly body?: Schema<unknown>;
|
|
40
|
+
};
|
|
41
|
+
readonly deprecated?: boolean;
|
|
42
|
+
readonly produces?: readonly string[];
|
|
43
|
+
readonly consumes?: readonly string[];
|
|
44
|
+
readonly cache?: CachePolicy;
|
|
45
|
+
readonly ifMatch?: IfMatch;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=kit-route-spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit-route-spec.d.ts","sourceRoot":"","sources":["../../../src/nest/controllers/kit-route-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,uEAAuE;IACvE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,oCAAoC;IACpC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,4GAA4G;IAC5G,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IAC5C,+FAA+F;IAC/F,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,iGAAiG;IACjG,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAClB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAC9B,+EAA+E;QAC/E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;KAC3C,CAAC;IACF,iHAAiH;IACjH,QAAQ,CAAC,OAAO,CAAC,EAAE;QACjB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAClC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QACnC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;KACjC,CAAC;IACF,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit-route-spec.js","sourceRoot":"","sources":["../../../src/nest/controllers/kit-route-spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { KitRouteSpec } from './kit-route-spec.js';
|
|
2
|
+
/**
|
|
3
|
+
* Makes a method of a Nest controller a route of the kit, next to Nest's own decorators:
|
|
4
|
+
*
|
|
5
|
+
* @Controller('invoices')
|
|
6
|
+
* export class InvoicesController {
|
|
7
|
+
* constructor(private readonly commands: CommandBus) {}
|
|
8
|
+
*
|
|
9
|
+
* @Post(':invoiceId/issue')
|
|
10
|
+
* @KitRoute({ operationId: 'issueInvoice', summary: 'Issue an invoice', guards: [Authenticated], errors: ['INVOICE_ALREADY_ISSUED'] })
|
|
11
|
+
* issue(@Param('invoiceId') invoiceId: string, @Body() body: IssueInvoiceBody, @CurrentActor() actor: Actor) { ... }
|
|
12
|
+
* }
|
|
13
|
+
*
|
|
14
|
+
* The kit serves the route, not Nest's router: its guards, validation, error mapping, tracing and
|
|
15
|
+
* contract are those of every route of the kit (`createControllersModule`, `nestControllerRoutes`).
|
|
16
|
+
*/
|
|
17
|
+
export declare function KitRoute(spec: KitRouteSpec): (target: object, method: string | symbol) => void;
|
|
18
|
+
//# sourceMappingURL=kit-route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit-route.d.ts","sourceRoot":"","sources":["../../../src/nest/controllers/kit-route.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAY9F"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DeclarationError } from '@ddd-ts-kit/kernel/declarations';
|
|
2
|
+
import { nestRoutesRegistry } from './nest-routes-registry.js';
|
|
3
|
+
/**
|
|
4
|
+
* Makes a method of a Nest controller a route of the kit, next to Nest's own decorators:
|
|
5
|
+
*
|
|
6
|
+
* @Controller('invoices')
|
|
7
|
+
* export class InvoicesController {
|
|
8
|
+
* constructor(private readonly commands: CommandBus) {}
|
|
9
|
+
*
|
|
10
|
+
* @Post(':invoiceId/issue')
|
|
11
|
+
* @KitRoute({ operationId: 'issueInvoice', summary: 'Issue an invoice', guards: [Authenticated], errors: ['INVOICE_ALREADY_ISSUED'] })
|
|
12
|
+
* issue(@Param('invoiceId') invoiceId: string, @Body() body: IssueInvoiceBody, @CurrentActor() actor: Actor) { ... }
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* The kit serves the route, not Nest's router: its guards, validation, error mapping, tracing and
|
|
16
|
+
* contract are those of every route of the kit (`createControllersModule`, `nestControllerRoutes`).
|
|
17
|
+
*/
|
|
18
|
+
export function KitRoute(spec) {
|
|
19
|
+
return (target, method) => {
|
|
20
|
+
if (typeof method !== 'string') {
|
|
21
|
+
throw new DeclarationError('@KitRoute goes on a method named by a string.');
|
|
22
|
+
}
|
|
23
|
+
const { routes } = nestRoutesRegistry();
|
|
24
|
+
const declared = routes.get(target) ?? new Map();
|
|
25
|
+
declared.set(method, spec);
|
|
26
|
+
routes.set(target, declared);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=kit-route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit-route.js","sourceRoot":"","sources":["../../../src/nest/controllers/kit-route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAkB;IACzC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;QACxB,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,MAAM,IAAI,gBAAgB,CAAC,+CAA+C,CAAC,CAAC;QAC9E,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,GAAG,kBAAkB,EAAE,CAAC;QACxC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,EAAwB,CAAC;QAEvE,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC3B,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC/B,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { GuardReference } from '../../controller/guard-reference.js';
|
|
2
|
+
import type { RouteGroupClass } from '../../controller/route-group-class.js';
|
|
3
|
+
/** What every route of a Nest controller shares, as a route group of the kit gives it. */
|
|
4
|
+
export interface KitRoutesOptions {
|
|
5
|
+
/**
|
|
6
|
+
* A route group of the kit (`@RouteGroup`): its prefix comes before the paths Nest declares, and
|
|
7
|
+
* its tags, guards and error codes before those written here.
|
|
8
|
+
*/
|
|
9
|
+
readonly group?: RouteGroupClass;
|
|
10
|
+
/** Run before the guards of each route. */
|
|
11
|
+
readonly guards?: readonly GuardReference[];
|
|
12
|
+
readonly tags?: readonly string[];
|
|
13
|
+
readonly errors?: readonly string[];
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=kit-routes-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit-routes-options.d.ts","sourceRoot":"","sources":["../../../src/nest/controllers/kit-routes-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAE1E,0FAA0F;AAC1F,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;IACjC,2CAA2C;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IAC5C,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit-routes-options.js","sourceRoot":"","sources":["../../../src/nest/controllers/kit-routes-options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { KitRoutesOptions } from './kit-routes-options.js';
|
|
2
|
+
import type { NestControllerClass } from './nest-controller-class.js';
|
|
3
|
+
/** What every route of a Nest controller shares: its guards first, its tags and its error codes. */
|
|
4
|
+
export declare function KitRoutes(options: KitRoutesOptions): (target: NestControllerClass) => void;
|
|
5
|
+
//# sourceMappingURL=kit-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit-routes.d.ts","sourceRoot":"","sources":["../../../src/nest/controllers/kit-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAGnE,oGAAoG;AACpG,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAI1F"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { nestRoutesRegistry } from './nest-routes-registry.js';
|
|
2
|
+
/** What every route of a Nest controller shares: its guards first, its tags and its error codes. */
|
|
3
|
+
export function KitRoutes(options) {
|
|
4
|
+
return (target) => {
|
|
5
|
+
nestRoutesRegistry().controllers.set(target, options);
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=kit-routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit-routes.js","sourceRoot":"","sources":["../../../src/nest/controllers/kit-routes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,oGAAoG;AACpG,MAAM,UAAU,SAAS,CAAC,OAAyB;IACjD,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,kBAAkB,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest-controller-class.d.ts","sourceRoot":"","sources":["../../../src/nest/controllers/nest-controller-class.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,MAAM,mBAAmB,GAAG,QAAQ,MAAM,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest-controller-class.js","sourceRoot":"","sources":["../../../src/nest/controllers/nest-controller-class.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Route } from '../../route/route.js';
|
|
2
|
+
import type { NestControllerClass } from './nest-controller-class.js';
|
|
3
|
+
import type { NestControllerRoutesOptions } from './nest-controller-routes-options.js';
|
|
4
|
+
/** The one route of a Nest controller with a single method carrying `@KitRoute`: what its spec calls. */
|
|
5
|
+
export declare function nestControllerRoute(controller: NestControllerClass, options?: NestControllerRoutesOptions): Route;
|
|
6
|
+
//# sourceMappingURL=nest-controller-route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest-controller-route.d.ts","sourceRoot":"","sources":["../../../src/nest/controllers/nest-controller-route.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAEpF,yGAAyG;AACzG,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,mBAAmB,EAAE,OAAO,GAAE,2BAAgC,GAAG,KAAK,CAWrH"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DeclarationError } from '@ddd-ts-kit/kernel/declarations';
|
|
2
|
+
import { nestControllerRoutes } from './nest-controller-routes.js';
|
|
3
|
+
/** The one route of a Nest controller with a single method carrying `@KitRoute`: what its spec calls. */
|
|
4
|
+
export function nestControllerRoute(controller, options = {}) {
|
|
5
|
+
const routes = nestControllerRoutes([controller], options);
|
|
6
|
+
const [route] = routes;
|
|
7
|
+
if (route === undefined || routes.length > 1) {
|
|
8
|
+
throw new DeclarationError(`${controller.name} serves ${String(routes.length)} routes: nestControllerRoute takes a controller with one, nestControllerRoutes any number.`);
|
|
9
|
+
}
|
|
10
|
+
return route;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=nest-controller-route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest-controller-route.js","sourceRoot":"","sources":["../../../src/nest/controllers/nest-controller-route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,yGAAyG;AACzG,MAAM,UAAU,mBAAmB,CAAC,UAA+B,EAAE,OAAO,GAAgC,EAAE;IAC5G,MAAM,MAAM,GAAG,oBAAoB,CAAC,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC;IAC3D,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;IAEvB,IAAI,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,gBAAgB,CACxB,GAAG,UAAU,CAAC,IAAI,WAAW,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,4FAA4F,CAC/I,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Schema } from '@ddd-ts-kit/validation';
|
|
2
|
+
import type { ControllerRoutesOptions } from '../../controller/controller-routes-options.js';
|
|
3
|
+
import type { DtoType } from './dto-type.js';
|
|
4
|
+
import type { NestControllerClass } from './nest-controller-class.js';
|
|
5
|
+
export interface NestControllerRoutesOptions extends Pick<ControllerRoutesOptions, 'resolve' | 'security'> {
|
|
6
|
+
/**
|
|
7
|
+
* The instance that answers the routes of a controller, built by Nest's container: asked at the
|
|
8
|
+
* first call, so that the contract is generated without one.
|
|
9
|
+
*/
|
|
10
|
+
readonly instanceOf?: (controller: NestControllerClass) => unknown;
|
|
11
|
+
/** The schema of a DTO class, a parameter typed by one or a response body: `classSchema` of `@ddd-ts-kit/validation/class-validator`. */
|
|
12
|
+
readonly schemaOfClass?: (dto: DtoType) => Schema<unknown>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=nest-controller-routes-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest-controller-routes-options.d.ts","sourceRoot":"","sources":["../../../src/nest/controllers/nest-controller-routes-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CAAC,uBAAuB,EAAE,SAAS,GAAG,UAAU,CAAC;IACxG;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,mBAAmB,KAAK,OAAO,CAAC;IACnE,yIAAyI;IACzI,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,CAAC,OAAO,CAAC,CAAC;CAC5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest-controller-routes-options.js","sourceRoot":"","sources":["../../../src/nest/controllers/nest-controller-routes-options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Route } from '../../route/route.js';
|
|
2
|
+
import type { NestControllerClass } from './nest-controller-class.js';
|
|
3
|
+
import type { NestControllerRoutesOptions } from './nest-controller-routes-options.js';
|
|
4
|
+
/**
|
|
5
|
+
* The routes of Nest controllers whose methods carry `@KitRoute`, for any adapter of the kit and
|
|
6
|
+
* for the contract generator: each method becomes one route of the kit, its method, path,
|
|
7
|
+
* parameters and status read from Nest's decorators, the rest from `@KitRoute` and `@KitRoutes`.
|
|
8
|
+
* It is served as every controller of the kit is, guards, validation and problem documents
|
|
9
|
+
* included; the instance that answers is the one Nest's container builds (`instanceOf`).
|
|
10
|
+
*/
|
|
11
|
+
export declare function nestControllerRoutes(controllers: readonly NestControllerClass[], options?: NestControllerRoutesOptions): readonly Route[];
|
|
12
|
+
//# sourceMappingURL=nest-controller-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest-controller-routes.d.ts","sourceRoot":"","sources":["../../../src/nest/controllers/nest-controller-routes.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAK/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAUpF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,SAAS,mBAAmB,EAAE,EAC3C,OAAO,GAAE,2BAAgC,GACxC,SAAS,KAAK,EAAE,CAOlB"}
|