@decaf-ts/for-nest 0.11.2 → 0.12.1
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.md +274 -2
- package/dist/for-nest.cjs +1 -1
- package/dist/for-nest.cjs.map +1 -1
- package/dist/for-nest.js +1 -1
- package/dist/for-nest.js.map +1 -1
- package/lib/cjs/auth/AuthInterceptor.cjs +93 -0
- package/lib/cjs/auth/AuthInterceptor.cjs.map +1 -0
- package/lib/cjs/auth/DecafAuthHandler.cjs +37 -0
- package/lib/cjs/auth/DecafAuthHandler.cjs.map +1 -0
- package/lib/cjs/auth/DecafAuthModule.cjs +50 -0
- package/lib/cjs/auth/DecafAuthModule.cjs.map +1 -0
- package/lib/cjs/auth/constants.cjs +10 -0
- package/lib/cjs/auth/constants.cjs.map +1 -0
- package/lib/cjs/auth/decorators.cjs +28 -0
- package/lib/cjs/auth/decorators.cjs.map +1 -0
- package/lib/cjs/{ram → auth}/index.cjs +6 -2
- package/lib/cjs/auth/index.cjs.map +1 -0
- package/lib/cjs/bin/cli.cjs +1 -1
- package/lib/cjs/bin/cli.cjs.map +1 -1
- package/lib/cjs/cli-module.cjs +63 -6
- package/lib/cjs/cli-module.cjs.map +1 -1
- package/lib/cjs/constants.cjs +4 -5
- package/lib/cjs/constants.cjs.map +1 -1
- package/lib/cjs/controllers.cjs +15 -112
- package/lib/cjs/controllers.cjs.map +1 -1
- package/lib/cjs/core-module.cjs +7 -7
- package/lib/cjs/core-module.cjs.map +1 -1
- package/lib/cjs/decaf-model/DecafModelModule.cjs +27 -3
- package/lib/cjs/decaf-model/DecafModelModule.cjs.map +1 -1
- package/lib/cjs/decaf-model/FromModelController.cjs +618 -792
- package/lib/cjs/decaf-model/FromModelController.cjs.map +1 -1
- package/lib/cjs/decaf-model/decorators/ApiOperationFromModel.cjs +52 -15
- package/lib/cjs/decaf-model/decorators/ApiOperationFromModel.cjs.map +1 -1
- package/lib/cjs/decaf-model/decorators/ApiParamsFromModel.cjs +1 -1
- package/lib/cjs/decaf-model/decorators/ApiParamsFromModel.cjs.map +1 -1
- package/lib/cjs/decaf-model/decorators/DecafBody.cjs +1 -1
- package/lib/cjs/decaf-model/decorators/DecafBody.cjs.map +1 -1
- package/lib/cjs/decaf-model/decorators/DecafParams.cjs +1 -1
- package/lib/cjs/decaf-model/decorators/DecafParams.cjs.map +1 -1
- package/lib/cjs/decaf-model/decorators/controller-config.cjs +29 -0
- package/lib/cjs/decaf-model/decorators/controller-config.cjs.map +1 -0
- package/lib/cjs/decaf-model/decorators/decorators.cjs +4 -44
- package/lib/cjs/decaf-model/decorators/decorators.cjs.map +1 -1
- package/lib/cjs/decaf-model/decorators/expose.cjs +13 -0
- package/lib/cjs/decaf-model/decorators/expose.cjs.map +1 -0
- package/lib/cjs/decaf-model/decorators/index.cjs +2 -1
- package/lib/cjs/decaf-model/decorators/index.cjs.map +1 -1
- package/lib/cjs/decaf-model/decorators/types.cjs +1 -1
- package/lib/cjs/decaf-model/decorators/types.cjs.map +1 -1
- package/lib/cjs/decaf-model/decorators/utils.cjs +3 -2
- package/lib/cjs/decaf-model/decorators/utils.cjs.map +1 -1
- package/lib/cjs/decaf-model/index.cjs +27 -18
- package/lib/cjs/decaf-model/index.cjs.map +1 -1
- package/lib/cjs/decaf-model/types.cjs +1 -1
- package/lib/cjs/decaf-model/types.cjs.map +1 -1
- package/lib/cjs/decaf-model/utils.cjs +10 -4
- package/lib/cjs/decaf-model/utils.cjs.map +1 -1
- package/lib/cjs/decoration.cjs +1 -1
- package/lib/cjs/decoration.cjs.map +1 -1
- package/lib/cjs/decorators.cjs +93 -0
- package/lib/cjs/decorators.cjs.map +1 -0
- package/lib/cjs/events-module/DecafStreamModule.cjs +1 -1
- package/lib/cjs/events-module/DecafStreamModule.cjs.map +1 -1
- package/lib/cjs/events-module/EventsController.cjs +1 -1
- package/lib/cjs/events-module/EventsController.cjs.map +1 -1
- package/lib/cjs/events-module/constant.cjs +1 -1
- package/lib/cjs/events-module/constant.cjs.map +1 -1
- package/lib/cjs/events-module/index.cjs +1 -1
- package/lib/cjs/events-module/index.cjs.map +1 -1
- package/lib/cjs/events-module/utils.cjs +1 -1
- package/lib/cjs/events-module/utils.cjs.map +1 -1
- package/lib/cjs/factory/NestBootstraper.cjs +11 -4
- package/lib/cjs/factory/NestBootstraper.cjs.map +1 -1
- package/lib/cjs/factory/errors/cors.cjs +1 -1
- package/lib/cjs/factory/errors/cors.cjs.map +1 -1
- package/lib/cjs/factory/errors/index.cjs +1 -1
- package/lib/cjs/factory/errors/index.cjs.map +1 -1
- package/lib/cjs/factory/errors/throttling.cjs +1 -1
- package/lib/cjs/factory/errors/throttling.cjs.map +1 -1
- package/lib/cjs/factory/exceptions/DecafErrorFilter.cjs +105 -6
- package/lib/cjs/factory/exceptions/DecafErrorFilter.cjs.map +1 -1
- package/lib/cjs/factory/exceptions/decorators.cjs +4 -1
- package/lib/cjs/factory/exceptions/decorators.cjs.map +1 -1
- package/lib/cjs/factory/exceptions/index.cjs +1 -1
- package/lib/cjs/factory/exceptions/index.cjs.map +1 -1
- package/lib/cjs/factory/index.cjs +1 -1
- package/lib/cjs/factory/index.cjs.map +1 -1
- package/lib/cjs/factory/openapi/DtoBuilder.cjs +36 -5
- package/lib/cjs/factory/openapi/DtoBuilder.cjs.map +1 -1
- package/lib/cjs/factory/openapi/SwaggerBuilder.cjs +1 -1
- package/lib/cjs/factory/openapi/SwaggerBuilder.cjs.map +1 -1
- package/lib/cjs/factory/openapi/SwaggerCustomUI.cjs +1 -1
- package/lib/cjs/factory/openapi/SwaggerCustomUI.cjs.map +1 -1
- package/lib/cjs/factory/openapi/constants.cjs +1 -1
- package/lib/cjs/factory/openapi/constants.cjs.map +1 -1
- package/lib/cjs/factory/openapi/index.cjs +1 -1
- package/lib/cjs/factory/openapi/index.cjs.map +1 -1
- package/lib/cjs/index.cjs +6 -5
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/interceptors/DecafRequestHandlerInterceptor.cjs +24 -20
- package/lib/cjs/interceptors/DecafRequestHandlerInterceptor.cjs.map +1 -1
- package/lib/cjs/interceptors/index.cjs +2 -3
- package/lib/cjs/interceptors/index.cjs.map +1 -1
- package/lib/cjs/module.cjs +4 -1
- package/lib/cjs/module.cjs.map +1 -1
- package/lib/cjs/overrides/Adapter.cjs +1 -1
- package/lib/cjs/overrides/Adapter.cjs.map +1 -1
- package/lib/cjs/overrides/ModelBuilderExtensions.cjs +1 -1
- package/lib/cjs/overrides/ModelBuilderExtensions.cjs.map +1 -1
- package/lib/cjs/overrides/constants.cjs +1 -1
- package/lib/cjs/overrides/constants.cjs.map +1 -1
- package/lib/cjs/overrides/decoration.cjs +1 -1
- package/lib/cjs/overrides/decoration.cjs.map +1 -1
- package/lib/cjs/overrides/helpers.cjs +1 -1
- package/lib/cjs/overrides/helpers.cjs.map +1 -1
- package/lib/cjs/overrides/index.cjs +2 -1
- package/lib/cjs/overrides/index.cjs.map +1 -1
- package/lib/cjs/overrides/logging.cjs +5 -0
- package/lib/cjs/overrides/logging.cjs.map +1 -0
- package/lib/cjs/overrides/overrides.cjs +1 -1
- package/lib/cjs/overrides/overrides.cjs.map +1 -1
- package/lib/cjs/request/DecafAuthHandler.cjs +4 -38
- package/lib/cjs/request/DecafAuthHandler.cjs.map +1 -1
- package/lib/cjs/request/DecafHandlerExecutor.cjs +1 -1
- package/lib/cjs/request/DecafHandlerExecutor.cjs.map +1 -1
- package/lib/cjs/request/DecafRequestContext.cjs +12 -19
- package/lib/cjs/request/DecafRequestContext.cjs.map +1 -1
- package/lib/cjs/request/DecafResponseInterceptor.cjs +5 -3
- package/lib/cjs/request/DecafResponseInterceptor.cjs.map +1 -1
- package/lib/cjs/request/index.cjs +1 -1
- package/lib/cjs/request/index.cjs.map +1 -1
- package/lib/cjs/swagger-types.cjs +1 -1
- package/lib/cjs/swagger-types.cjs.map +1 -1
- package/lib/cjs/types.cjs +1 -1
- package/lib/cjs/types.cjs.map +1 -1
- package/lib/cjs/utils.cjs +1 -1
- package/lib/cjs/utils.cjs.map +1 -1
- package/lib/cjs/webhooks/DecafWebhookModule.cjs +4 -3
- package/lib/cjs/webhooks/DecafWebhookModule.cjs.map +1 -1
- package/lib/cjs/webhooks/controllers.cjs +49 -54
- package/lib/cjs/webhooks/controllers.cjs.map +1 -1
- package/lib/cjs/webhooks/index.cjs +1 -1
- package/lib/cjs/webhooks/index.cjs.map +1 -1
- package/lib/cjs/webhooks/types.cjs +1 -1
- package/lib/cjs/webhooks/types.cjs.map +1 -1
- package/lib/esm/auth/AuthInterceptor.js +84 -0
- package/lib/esm/auth/AuthInterceptor.js.map +1 -0
- package/lib/esm/auth/DecafAuthHandler.js +31 -0
- package/lib/esm/auth/DecafAuthHandler.js.map +1 -0
- package/lib/esm/auth/DecafAuthModule.js +42 -0
- package/lib/esm/auth/DecafAuthModule.js.map +1 -0
- package/lib/esm/auth/constants.js +6 -0
- package/lib/esm/auth/constants.js.map +1 -0
- package/lib/esm/auth/decorators.js +22 -0
- package/lib/esm/auth/decorators.js.map +1 -0
- package/lib/esm/auth/index.js +6 -0
- package/lib/esm/auth/index.js.map +1 -0
- package/lib/esm/cli-module.js +62 -5
- package/lib/esm/cli-module.js.map +1 -1
- package/lib/esm/constants.js +2 -3
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/controllers.js +15 -112
- package/lib/esm/controllers.js.map +1 -1
- package/lib/esm/core-module.js +6 -6
- package/lib/esm/core-module.js.map +1 -1
- package/lib/esm/decaf-model/DecafModelModule.js +26 -2
- package/lib/esm/decaf-model/DecafModelModule.js.map +1 -1
- package/lib/esm/decaf-model/FromModelController.js +622 -796
- package/lib/esm/decaf-model/FromModelController.js.map +1 -1
- package/lib/esm/decaf-model/decorators/ApiOperationFromModel.js +52 -14
- package/lib/esm/decaf-model/decorators/ApiOperationFromModel.js.map +1 -1
- package/lib/esm/decaf-model/decorators/controller-config.js +25 -0
- package/lib/esm/decaf-model/decorators/controller-config.js.map +1 -0
- package/lib/esm/decaf-model/decorators/decorators.js +1 -42
- package/lib/esm/decaf-model/decorators/decorators.js.map +1 -1
- package/lib/esm/decaf-model/decorators/expose.js +9 -0
- package/lib/esm/decaf-model/decorators/expose.js.map +1 -0
- package/lib/esm/decaf-model/decorators/index.js +1 -0
- package/lib/esm/decaf-model/decorators/index.js.map +1 -1
- package/lib/esm/decaf-model/decorators/utils.js +2 -1
- package/lib/esm/decaf-model/decorators/utils.js.map +1 -1
- package/lib/esm/decaf-model/index.js +10 -3
- package/lib/esm/decaf-model/index.js.map +1 -1
- package/lib/esm/decaf-model/utils.js +9 -3
- package/lib/esm/decaf-model/utils.js.map +1 -1
- package/lib/esm/decorators.js +87 -0
- package/lib/esm/decorators.js.map +1 -0
- package/lib/esm/events-module/utils.js.map +1 -1
- package/lib/esm/factory/NestBootstraper.js +10 -3
- package/lib/esm/factory/NestBootstraper.js.map +1 -1
- package/lib/esm/factory/exceptions/DecafErrorFilter.js +105 -7
- package/lib/esm/factory/exceptions/DecafErrorFilter.js.map +1 -1
- package/lib/esm/factory/exceptions/decorators.js +3 -0
- package/lib/esm/factory/exceptions/decorators.js.map +1 -1
- package/lib/esm/factory/openapi/DtoBuilder.js +35 -4
- package/lib/esm/factory/openapi/DtoBuilder.js.map +1 -1
- package/lib/esm/index.js +5 -4
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interceptors/DecafRequestHandlerInterceptor.js +24 -20
- package/lib/esm/interceptors/DecafRequestHandlerInterceptor.js.map +1 -1
- package/lib/esm/interceptors/index.js +1 -2
- package/lib/esm/interceptors/index.js.map +1 -1
- package/lib/esm/module.js +3 -0
- package/lib/esm/module.js.map +1 -1
- package/lib/esm/overrides/index.js +1 -0
- package/lib/esm/overrides/index.js.map +1 -1
- package/lib/esm/overrides/logging.js +2 -0
- package/lib/esm/overrides/logging.js.map +1 -0
- package/lib/esm/request/DecafAuthHandler.js +1 -35
- package/lib/esm/request/DecafAuthHandler.js.map +1 -1
- package/lib/esm/request/DecafRequestContext.js +11 -18
- package/lib/esm/request/DecafRequestContext.js.map +1 -1
- package/lib/esm/request/DecafResponseInterceptor.js +4 -2
- package/lib/esm/request/DecafResponseInterceptor.js.map +1 -1
- package/lib/esm/webhooks/DecafWebhookModule.js +2 -1
- package/lib/esm/webhooks/DecafWebhookModule.js.map +1 -1
- package/lib/esm/webhooks/controllers.js +48 -53
- package/lib/esm/webhooks/controllers.js.map +1 -1
- package/lib/types/{interceptors → auth}/AuthInterceptor.d.cts +4 -1
- package/lib/types/{interceptors → auth}/AuthInterceptor.d.mts +4 -1
- package/lib/types/auth/DecafAuthHandler.d.cts +22 -0
- package/lib/types/auth/DecafAuthHandler.d.mts +22 -0
- package/lib/types/auth/DecafAuthModule.d.cts +9 -0
- package/lib/types/auth/DecafAuthModule.d.mts +9 -0
- package/lib/types/auth/constants.d.cts +5 -0
- package/lib/types/auth/constants.d.mts +5 -0
- package/lib/types/auth/decorators.d.cts +4 -0
- package/lib/types/auth/decorators.d.mts +4 -0
- package/lib/types/auth/index.d.cts +6 -0
- package/lib/types/auth/index.d.mts +6 -0
- package/lib/types/cli-module.d.cts +1 -4
- package/lib/types/cli-module.d.mts +1 -4
- package/lib/types/constants.d.cts +2 -3
- package/lib/types/constants.d.mts +2 -3
- package/lib/types/controllers.d.cts +7 -12
- package/lib/types/controllers.d.mts +7 -12
- package/lib/types/decaf-model/DecafModelModule.d.cts +1 -0
- package/lib/types/decaf-model/DecafModelModule.d.mts +1 -0
- package/lib/types/decaf-model/FromModelController.d.cts +32 -52
- package/lib/types/decaf-model/FromModelController.d.mts +32 -52
- package/lib/types/decaf-model/decorators/ApiOperationFromModel.d.cts +0 -2
- package/lib/types/decaf-model/decorators/ApiOperationFromModel.d.mts +0 -2
- package/lib/types/decaf-model/decorators/controller-config.d.cts +18 -0
- package/lib/types/decaf-model/decorators/controller-config.d.mts +18 -0
- package/lib/types/decaf-model/decorators/decorators.d.cts +1 -29
- package/lib/types/decaf-model/decorators/decorators.d.mts +1 -29
- package/lib/types/decaf-model/decorators/expose.d.cts +1 -0
- package/lib/types/decaf-model/decorators/expose.d.mts +1 -0
- package/lib/types/decaf-model/decorators/index.d.cts +1 -0
- package/lib/types/decaf-model/decorators/index.d.mts +1 -0
- package/lib/types/decaf-model/decorators/types.d.cts +8 -21
- package/lib/types/decaf-model/decorators/types.d.mts +8 -21
- package/lib/types/decaf-model/index.d.cts +11 -3
- package/lib/types/decaf-model/index.d.mts +11 -3
- package/lib/types/decaf-model/utils.d.cts +2 -1
- package/lib/types/decaf-model/utils.d.mts +2 -1
- package/lib/types/decorators.d.cts +35 -0
- package/lib/types/decorators.d.mts +35 -0
- package/lib/types/factory/NestBootstraper.d.cts +5 -0
- package/lib/types/factory/NestBootstraper.d.mts +5 -0
- package/lib/types/factory/exceptions/DecafErrorFilter.d.cts +33 -1
- package/lib/types/factory/exceptions/DecafErrorFilter.d.mts +33 -1
- package/lib/types/factory/openapi/DtoBuilder.d.cts +7 -3
- package/lib/types/factory/openapi/DtoBuilder.d.mts +7 -3
- package/lib/types/index.d.cts +5 -4
- package/lib/types/index.d.mts +5 -4
- package/lib/types/interceptors/DecafRequestHandlerInterceptor.d.cts +1 -2
- package/lib/types/interceptors/DecafRequestHandlerInterceptor.d.mts +1 -2
- package/lib/types/interceptors/index.d.cts +1 -2
- package/lib/types/interceptors/index.d.mts +1 -2
- package/lib/types/overrides/Adapter.d.cts +1 -1
- package/lib/types/overrides/Adapter.d.mts +1 -1
- package/lib/types/overrides/index.d.cts +1 -0
- package/lib/types/overrides/index.d.mts +1 -0
- package/lib/types/overrides/logging.d.cts +1 -0
- package/lib/types/overrides/logging.d.mts +1 -0
- package/lib/types/request/DecafAuthHandler.d.cts +1 -10
- package/lib/types/request/DecafAuthHandler.d.mts +1 -10
- package/lib/types/request/DecafRequestContext.d.cts +5 -5
- package/lib/types/request/DecafRequestContext.d.mts +5 -5
- package/lib/types/types.d.cts +12 -24
- package/lib/types/types.d.mts +12 -24
- package/package.json +12 -13
- package/lib/cjs/interceptors/AuthInterceptor.cjs +0 -52
- package/lib/cjs/interceptors/AuthInterceptor.cjs.map +0 -1
- package/lib/cjs/interceptors/context.cjs +0 -18
- package/lib/cjs/interceptors/context.cjs.map +0 -1
- package/lib/cjs/migrations/index.cjs +0 -35
- package/lib/cjs/migrations/index.cjs.map +0 -1
- package/lib/cjs/migrations/migration-module.cjs +0 -60
- package/lib/cjs/migrations/migration-module.cjs.map +0 -1
- package/lib/cjs/migrations/migration-options.cjs +0 -4
- package/lib/cjs/migrations/migration-options.cjs.map +0 -1
- package/lib/cjs/ram/RamRequestTransformer.cjs +0 -26
- package/lib/cjs/ram/RamRequestTransformer.cjs.map +0 -1
- package/lib/cjs/ram/index.cjs.map +0 -1
- package/lib/esm/interceptors/AuthInterceptor.js +0 -43
- package/lib/esm/interceptors/AuthInterceptor.js.map +0 -1
- package/lib/esm/interceptors/context.js +0 -12
- package/lib/esm/interceptors/context.js.map +0 -1
- package/lib/esm/migrations/index.js +0 -18
- package/lib/esm/migrations/index.js.map +0 -1
- package/lib/esm/migrations/migration-module.js +0 -52
- package/lib/esm/migrations/migration-module.js.map +0 -1
- package/lib/esm/migrations/migration-options.js +0 -7
- package/lib/esm/migrations/migration-options.js.map +0 -1
- package/lib/esm/ram/RamRequestTransformer.js +0 -21
- package/lib/esm/ram/RamRequestTransformer.js.map +0 -1
- package/lib/esm/ram/index.js +0 -2
- package/lib/esm/ram/index.js.map +0 -1
- package/lib/types/interceptors/context.d.cts +0 -6
- package/lib/types/interceptors/context.d.mts +0 -6
- package/lib/types/migrations/index.d.cts +0 -17
- package/lib/types/migrations/index.d.mts +0 -17
- package/lib/types/migrations/migration-module.d.cts +0 -15
- package/lib/types/migrations/migration-module.d.mts +0 -15
- package/lib/types/migrations/migration-options.d.cts +0 -11
- package/lib/types/migrations/migration-options.d.mts +0 -11
- package/lib/types/ram/RamRequestTransformer.d.cts +0 -5
- package/lib/types/ram/RamRequestTransformer.d.mts +0 -5
- package/lib/types/ram/index.d.cts +0 -1
- package/lib/types/ram/index.d.mts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecafResponseInterceptor.js","sourceRoot":"","sources":["../../../src/request/DecafResponseInterceptor.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,UAAU,GAIX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAc,GAAG,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,iCAA8B;AAGrD,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACnC,YAAsB,GAAwB;QAAxB,QAAG,GAAH,GAAG,CAAqB;IAAG,CAAC;IAElD,SAAS,CAAC,OAAyB,EAAE,IAAiB;QACpD,IAAI,QAAQ,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,WAAW,EAAE,CAAC;QAEpD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"DecafResponseInterceptor.js","sourceRoot":"","sources":["../../../src/request/DecafResponseInterceptor.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,UAAU,GAIX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAc,GAAG,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,iCAA8B;AAGrD,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACnC,YAAsB,GAAwB;QAAxB,QAAG,GAAH,GAAG,CAAqB;IAAG,CAAC;IAElD,SAAS,CAAC,OAAyB,EAAE,IAAiB;QACpD,IAAI,QAAQ,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,WAAW,EAAE,CAAC;QAEpD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI;QACvB,6DAA6D;QAC7D,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACX,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC3C,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF,CAAA;AAbY,wBAAwB;IADpC,UAAU,EAAE;qCAEgB,mBAAmB;GADnC,wBAAwB,CAapC"}
|
|
@@ -17,7 +17,7 @@ import { DecafRequestHandlerInterceptor } from "./../interceptors/DecafRequestHa
|
|
|
17
17
|
import { DECAF_HANDLERS } from "./../constants.js";
|
|
18
18
|
import { APP_INTERCEPTOR } from "@nestjs/core";
|
|
19
19
|
import { FromModelController } from "./../decaf-model/index.js";
|
|
20
|
-
import { requestToContextTransformer } from "
|
|
20
|
+
import { requestToContextTransformer } from "@decaf-ts/for-http/server";
|
|
21
21
|
import { WebhookDelivery, WebhookEventRecord, WebhookSubscription, } from "@decaf-ts/for-http/hooks";
|
|
22
22
|
import { WebhookEventActionsController, WebhookSubscriptionActionsController, } from "./controllers.js";
|
|
23
23
|
let DecafWebhookModule = class DecafWebhookModule {
|
|
@@ -87,6 +87,7 @@ let DecafWebhookModule = class DecafWebhookModule {
|
|
|
87
87
|
return this.forRootAsync(options);
|
|
88
88
|
}
|
|
89
89
|
static async forRootAsync(options) {
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
90
91
|
const adapters = await this.bootPersistence(options);
|
|
91
92
|
const controllers = [
|
|
92
93
|
FromModelController.create(WebhookSubscription),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecafWebhookModule.js","sourceRoot":"","sources":["../../../src/webhooks/DecafWebhookModule.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAiB,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAe,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAA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;gBACnB,oBAAoB;gBACpB;oBACE,OAAO,EAAE,cAAc;oBACvB,UAAU,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE;iBAC9D;gBACD;oBACE,OAAO,EAAE,eAAe;oBACxB,QAAQ,EAAE,8BAA8B;iBACzC;aACF;YACD,OAAO,EAAE,CAAC,mBAAmB,EAAE,oBAAoB,CAAC;SACrD,CAAC;IACJ,CAAC;;AAtHU,kBAAkB;IAD9B,MAAM,CAAC,EAAE,CAAC;GACE,kBAAkB,CAuH9B;;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,qBAAqB,KAAmB,CAAC"}
|
|
@@ -62,69 +62,64 @@ let WebhookEventActionsController = WebhookEventActionsController_1 = class Webh
|
|
|
62
62
|
const { ctx } = (await this.logCtx([], "replay", true)).for(this.replay);
|
|
63
63
|
const eventRepo = Repository.forModel(WebhookEventRecord);
|
|
64
64
|
const deliveryRepo = Repository.forModel(WebhookDelivery);
|
|
65
|
+
let event;
|
|
65
66
|
try {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
67
|
+
event = await eventRepo.read(id, ctx);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
const events = await eventRepo
|
|
71
|
+
.select()
|
|
72
|
+
.where(eventRepo.attr("id").eq(id))
|
|
73
|
+
.limit(1)
|
|
74
|
+
.execute(ctx);
|
|
75
|
+
if (!events.length)
|
|
76
|
+
throw error;
|
|
77
|
+
event = events[0];
|
|
78
|
+
}
|
|
79
|
+
let deliveries = [];
|
|
80
|
+
try {
|
|
81
|
+
deliveries = await collectPagedResults(() => deliveryRepo
|
|
82
|
+
.select()
|
|
83
|
+
.where(deliveryRepo.attr("eventId").eq(event.id))
|
|
84
|
+
.orderBy("createdAt", OrderDirection.ASC)
|
|
85
|
+
.thenBy("id", OrderDirection.ASC)
|
|
86
|
+
.paginate(250, ctx), 250, ctx);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
81
89
|
try {
|
|
82
|
-
deliveries = await
|
|
90
|
+
deliveries = await deliveryRepo
|
|
83
91
|
.select()
|
|
84
92
|
.where(deliveryRepo.attr("eventId").eq(event.id))
|
|
85
|
-
.
|
|
86
|
-
.thenBy("id", OrderDirection.ASC)
|
|
87
|
-
.paginate(250, ctx), 250, ctx);
|
|
93
|
+
.execute(ctx);
|
|
88
94
|
}
|
|
89
95
|
catch {
|
|
90
|
-
|
|
91
|
-
deliveries = await deliveryRepo
|
|
92
|
-
.select()
|
|
93
|
-
.where(deliveryRepo.attr("eventId").eq(event.id))
|
|
94
|
-
.execute(ctx);
|
|
95
|
-
}
|
|
96
|
-
catch {
|
|
97
|
-
deliveries = [];
|
|
98
|
-
}
|
|
96
|
+
deliveries = [];
|
|
99
97
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
}
|
|
99
|
+
const now = new Date();
|
|
100
|
+
for (const delivery of deliveries) {
|
|
101
|
+
delivery.status = WebhookStatus.PENDING;
|
|
102
|
+
delivery.attempts = 0;
|
|
103
|
+
delivery.nextAttemptAt = now;
|
|
104
|
+
delivery.lastAttemptAt = null;
|
|
105
|
+
delivery.errorMessage = undefined;
|
|
106
|
+
delivery.responseStatus = undefined;
|
|
107
|
+
delivery.responseBody = undefined;
|
|
108
|
+
}
|
|
109
|
+
event.status = WebhookStatus.PENDING;
|
|
110
|
+
event.deliveriesSucceeded = 0;
|
|
111
|
+
event.deliveriesFailed = 0;
|
|
112
|
+
event.nextAttemptAt = now;
|
|
113
|
+
event.updatedAt = now;
|
|
114
|
+
if (deliveries.length) {
|
|
115
|
+
try {
|
|
116
|
+
await deliveryRepo.updateAll(deliveries, ctx.override({ applyUpdateValidation: false }));
|
|
109
117
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
event.deliveriesFailed = 0;
|
|
113
|
-
event.nextAttemptAt = now;
|
|
114
|
-
event.updatedAt = now;
|
|
115
|
-
if (deliveries.length) {
|
|
116
|
-
try {
|
|
117
|
-
await deliveryRepo.updateAll(deliveries, ctx.override({ applyUpdateValidation: false }));
|
|
118
|
-
}
|
|
119
|
-
catch {
|
|
120
|
-
// Replay still resets the event state even if bulk delivery updates are not queryable here.
|
|
121
|
-
}
|
|
118
|
+
catch {
|
|
119
|
+
// Replay still resets the event state even if bulk delivery updates are not queryable here.
|
|
122
120
|
}
|
|
123
|
-
return eventRepo.update(event, ctx);
|
|
124
|
-
}
|
|
125
|
-
catch (error) {
|
|
126
|
-
throw error;
|
|
127
121
|
}
|
|
122
|
+
return eventRepo.update(event, ctx);
|
|
128
123
|
}
|
|
129
124
|
};
|
|
130
125
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controllers.js","sourceRoot":"","sources":["../../../src/webhooks/controllers.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,4BAAuB;AACjD,OAAO,EAAE,mBAAmB,EAAE,8BAAmB;AAEjD,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAG3B,IAAM,oCAAoC,4CAA1C,MAAM,oCAAqC,SAAQ,eAA+B;I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GAAG,CAAC,QAAQ,CAAC,EAAE,qBAAqB,EAAE,KAAK,EAAS,CAAC,CACtD,CAAC;YACJ,CAAC;YAAC,MAAM,CAAC;gBACP,4FAA4F;YAC9F,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;CACF,CAAA;AA3EO;IADL,IAAI,CAAC,YAAY,CAAC;IACL,WAAA,KAAK,CAAC,IAAI,CAAC,CAAA;;;;2DA0ExB;AAhFU,6BAA6B;IADzC,UAAU,CAAC,gBAAgB,CAAC;qCAEA,mBAAmB;GADnC,6BAA6B,CAiFzC"}
|
|
@@ -2,9 +2,12 @@ import { NestInterceptor, ExecutionContext, CallHandler } from "@nestjs/common";
|
|
|
2
2
|
import { Reflector } from "@nestjs/core";
|
|
3
3
|
import { Observable } from "rxjs";
|
|
4
4
|
import type { AuthHandler } from "../types.d.cts";
|
|
5
|
+
import { DecafRequestContext } from "../request/DecafRequestContext.d.cts";
|
|
5
6
|
export declare class AuthInterceptor implements NestInterceptor {
|
|
6
7
|
private readonly reflector;
|
|
8
|
+
protected readonly requestContext: DecafRequestContext;
|
|
7
9
|
private readonly authHandler?;
|
|
8
|
-
constructor(reflector: Reflector, authHandler?: AuthHandler | undefined);
|
|
10
|
+
constructor(reflector: Reflector, requestContext: DecafRequestContext, authHandler?: AuthHandler | undefined);
|
|
9
11
|
intercept(ctx: ExecutionContext, next: CallHandler): Promise<Observable<any>>;
|
|
12
|
+
protected applyTransformers(): Promise<void>;
|
|
10
13
|
}
|
|
@@ -2,9 +2,12 @@ import { NestInterceptor, ExecutionContext, CallHandler } from "@nestjs/common";
|
|
|
2
2
|
import { Reflector } from "@nestjs/core";
|
|
3
3
|
import { Observable } from "rxjs";
|
|
4
4
|
import type { AuthHandler } from "../types.d.mts";
|
|
5
|
+
import { DecafRequestContext } from "../request/DecafRequestContext.d.mts";
|
|
5
6
|
export declare class AuthInterceptor implements NestInterceptor {
|
|
6
7
|
private readonly reflector;
|
|
8
|
+
protected readonly requestContext: DecafRequestContext;
|
|
7
9
|
private readonly authHandler?;
|
|
8
|
-
constructor(reflector: Reflector, authHandler?: AuthHandler | undefined);
|
|
10
|
+
constructor(reflector: Reflector, requestContext: DecafRequestContext, authHandler?: AuthHandler | undefined);
|
|
9
11
|
intercept(ctx: ExecutionContext, next: CallHandler): Promise<Observable<any>>;
|
|
12
|
+
protected applyTransformers(): Promise<void>;
|
|
10
13
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ExecutionContext } from "@nestjs/common";
|
|
2
|
+
import { AuthHandler, AuthData } from "@decaf-ts/for-http/server";
|
|
3
|
+
import { DecafRequestContext } from "../request/DecafRequestContext.d.cts";
|
|
4
|
+
/**
|
|
5
|
+
* Simple auth handler that reads a role string from the `Authorization: Bearer <role>` header.
|
|
6
|
+
*
|
|
7
|
+
* Only overrides {@link AuthHandler.extractFromAuth} to return the bearer token as
|
|
8
|
+
* both the user identifier and the single role. The base class `bindToContext`
|
|
9
|
+
* (`ctx.accumulate(data)`) is sufficient — the transformer/adapter is responsible
|
|
10
|
+
* for mapping context fields to adapter-specific keys like `UUID`.
|
|
11
|
+
*/
|
|
12
|
+
export declare class DecafAuthHandler extends AuthHandler<ExecutionContext, DecafRequestContext, AuthData> {
|
|
13
|
+
protected parseRequest(req: any): string;
|
|
14
|
+
protected extractFromAuth(ctx: ExecutionContext): AuthData;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Alias for {@link DecafAuthHandler} kept for backward compatibility.
|
|
18
|
+
* The "role" variant previously returned roles from `authorize`; with the base
|
|
19
|
+
* class now orchestrating role checks internally, the two classes are equivalent.
|
|
20
|
+
*/
|
|
21
|
+
export declare class DecafRoleAuthHandler extends DecafAuthHandler {
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ExecutionContext } from "@nestjs/common";
|
|
2
|
+
import { AuthHandler, AuthData } from "@decaf-ts/for-http/server";
|
|
3
|
+
import { DecafRequestContext } from "../request/DecafRequestContext.d.mts";
|
|
4
|
+
/**
|
|
5
|
+
* Simple auth handler that reads a role string from the `Authorization: Bearer <role>` header.
|
|
6
|
+
*
|
|
7
|
+
* Only overrides {@link AuthHandler.extractFromAuth} to return the bearer token as
|
|
8
|
+
* both the user identifier and the single role. The base class `bindToContext`
|
|
9
|
+
* (`ctx.accumulate(data)`) is sufficient — the transformer/adapter is responsible
|
|
10
|
+
* for mapping context fields to adapter-specific keys like `UUID`.
|
|
11
|
+
*/
|
|
12
|
+
export declare class DecafAuthHandler extends AuthHandler<ExecutionContext, DecafRequestContext, AuthData> {
|
|
13
|
+
protected parseRequest(req: any): string;
|
|
14
|
+
protected extractFromAuth(ctx: ExecutionContext): AuthData;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Alias for {@link DecafAuthHandler} kept for backward compatibility.
|
|
18
|
+
* The "role" variant previously returned roles from `authorize`; with the base
|
|
19
|
+
* class now orchestrating role checks internally, the two classes are equivalent.
|
|
20
|
+
*/
|
|
21
|
+
export declare class DecafRoleAuthHandler extends DecafAuthHandler {
|
|
22
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DynamicModule, Type } from "@nestjs/common";
|
|
2
|
+
import { AuthHandler } from "../types.d.cts";
|
|
3
|
+
export type DecafAuthModuleOptions = {
|
|
4
|
+
global?: boolean;
|
|
5
|
+
handler?: Type<AuthHandler>;
|
|
6
|
+
};
|
|
7
|
+
export declare class DecafAuthModule {
|
|
8
|
+
static forRoot(options?: DecafAuthModuleOptions): DynamicModule;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DynamicModule, Type } from "@nestjs/common";
|
|
2
|
+
import { AuthHandler } from "../types.d.mts";
|
|
3
|
+
export type DecafAuthModuleOptions = {
|
|
4
|
+
global?: boolean;
|
|
5
|
+
handler?: Type<AuthHandler>;
|
|
6
|
+
};
|
|
7
|
+
export declare class DecafAuthModule {
|
|
8
|
+
static forRoot(options?: DecafAuthModuleOptions): DynamicModule;
|
|
9
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const AUTH_HANDLER: unique symbol;
|
|
2
|
+
export declare const AUTH_META_KEY = "auth:meta";
|
|
3
|
+
export declare const IS_PUBLIC_KEY = "isPublic";
|
|
4
|
+
export declare const REQUIRED_ROLES_KEY = "requiredRoles";
|
|
5
|
+
export declare const SKIP_MODEL_ROLES_KEY = "skipModelRoles";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const AUTH_HANDLER: unique symbol;
|
|
2
|
+
export declare const AUTH_META_KEY = "auth:meta";
|
|
3
|
+
export declare const IS_PUBLIC_KEY = "isPublic";
|
|
4
|
+
export declare const REQUIRED_ROLES_KEY = "requiredRoles";
|
|
5
|
+
export declare const SKIP_MODEL_ROLES_KEY = "skipModelRoles";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Constructor } from "@decaf-ts/decoration";
|
|
2
|
+
export declare function Auth(model?: string | Constructor): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
3
|
+
export declare function Public(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
4
|
+
export declare function RequireRoles(...roles: string[]): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Constructor } from "@decaf-ts/decoration";
|
|
2
|
+
export declare function Auth(model?: string | Constructor): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
3
|
+
export declare function Public(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
4
|
+
export declare function RequireRoles(...roles: string[]): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./constants.d.cts";
|
|
2
|
+
export * from "./AuthInterceptor.d.cts";
|
|
3
|
+
export * from "./DecafAuthHandler.d.cts";
|
|
4
|
+
export * from "./decorators.d.cts";
|
|
5
|
+
export * from "./DecafAuthModule.d.cts";
|
|
6
|
+
export type { AuthHandler as AuthHandlerBase, AuthData, UserData, AuthRequestLike, } from "@decaf-ts/for-http/server";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./constants.d.mts";
|
|
2
|
+
export * from "./AuthInterceptor.d.mts";
|
|
3
|
+
export * from "./DecafAuthHandler.d.mts";
|
|
4
|
+
export * from "./decorators.d.mts";
|
|
5
|
+
export * from "./DecafAuthModule.d.mts";
|
|
6
|
+
export type { AuthHandler as AuthHandlerBase, AuthData, UserData, AuthRequestLike, } from "@decaf-ts/for-http/server";
|
|
@@ -20,10 +20,7 @@ export declare function resolveMigrateCommandConfig(options?: Record<string, unk
|
|
|
20
20
|
references: string[];
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
-
export declare function buildFileVersionHandlers(versionDir: string, adapters: Adapter<any, any, any, any>[]): Record<string,
|
|
24
|
-
retrieveLastVersion: () => Promise<string | undefined>;
|
|
25
|
-
setCurrentVersion: (v: string) => Promise<void>;
|
|
26
|
-
}>;
|
|
23
|
+
export declare function buildFileVersionHandlers(versionDir: string, adapters: Adapter<any, any, any, any>[]): Partial<Record<string, any>>;
|
|
27
24
|
declare const migrateCommand: Command;
|
|
28
25
|
export { migrateCommand };
|
|
29
26
|
export default function nest(): Command;
|
|
@@ -20,10 +20,7 @@ export declare function resolveMigrateCommandConfig(options?: Record<string, unk
|
|
|
20
20
|
references: string[];
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
-
export declare function buildFileVersionHandlers(versionDir: string, adapters: Adapter<any, any, any, any>[]): Record<string,
|
|
24
|
-
retrieveLastVersion: () => Promise<string | undefined>;
|
|
25
|
-
setCurrentVersion: (v: string) => Promise<void>;
|
|
26
|
-
}>;
|
|
23
|
+
export declare function buildFileVersionHandlers(versionDir: string, adapters: Adapter<any, any, any, any>[]): Partial<Record<string, any>>;
|
|
27
24
|
declare const migrateCommand: Command;
|
|
28
25
|
export { migrateCommand };
|
|
29
26
|
export default function nest(): Command;
|
|
@@ -5,9 +5,8 @@ export declare const DECAF_ADAPTER_ID = "DecafAdapter";
|
|
|
5
5
|
export declare const DECAF_TASK_SERVICE_ID = "DecafTaskService";
|
|
6
6
|
export declare const DECAF_ROUTE = "DecafRoute";
|
|
7
7
|
export declare const DECAF_HANDLERS: unique symbol;
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const AUTH_META_KEY = "auth:meta";
|
|
8
|
+
export declare const DECAF_EXPOSE = "DecafExpose";
|
|
9
|
+
export declare const DECAF_CONTROLLER_CONFIG = "DecafControllerConfig";
|
|
11
10
|
export declare const DECAF_CONTEXT_KEY: unique symbol;
|
|
12
11
|
export type DecafServerFlags<LOG extends Logger = Logger> = AdapterFlags<LOG> & {
|
|
13
12
|
headers: Record<string, any>;
|
|
@@ -5,9 +5,8 @@ export declare const DECAF_ADAPTER_ID = "DecafAdapter";
|
|
|
5
5
|
export declare const DECAF_TASK_SERVICE_ID = "DecafTaskService";
|
|
6
6
|
export declare const DECAF_ROUTE = "DecafRoute";
|
|
7
7
|
export declare const DECAF_HANDLERS: unique symbol;
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const AUTH_META_KEY = "auth:meta";
|
|
8
|
+
export declare const DECAF_EXPOSE = "DecafExpose";
|
|
9
|
+
export declare const DECAF_CONTROLLER_CONFIG = "DecafControllerConfig";
|
|
11
10
|
export declare const DECAF_CONTEXT_KEY: unique symbol;
|
|
12
11
|
export type DecafServerFlags<LOG extends Logger = Logger> = AdapterFlags<LOG> & {
|
|
13
12
|
headers: Record<string, any>;
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import { Context, ContextOf, ContextualizedArgs, FlagsOf, MaybeContextualArg, MethodOrOperation, ModelService, Repo, Service } from "@decaf-ts/core";
|
|
2
1
|
import { type Request } from "express";
|
|
2
|
+
import { DecafController as HttpDecafController } from "@decaf-ts/for-http/server";
|
|
3
|
+
import { Context, ModelService, Repo } from "@decaf-ts/core";
|
|
4
|
+
import { Model, type ModelConstructor } from "@decaf-ts/decorator-validation";
|
|
3
5
|
import { DecafServerCtx } from "./constants.d.cts";
|
|
4
|
-
import { Model, ModelConstructor } from "@decaf-ts/decorator-validation";
|
|
5
6
|
import { DecafRequestContext } from "./request/DecafRequestContext.d.cts";
|
|
6
|
-
export declare abstract class DecafController<CONTEXT extends DecafServerCtx> extends
|
|
7
|
+
export declare abstract class DecafController<CONTEXT extends DecafServerCtx = DecafServerCtx> extends HttpDecafController<Request, any, DecafRequestContext> {
|
|
7
8
|
protected readonly clientContext: DecafRequestContext;
|
|
8
|
-
protected constructor(clientContext: DecafRequestContext,
|
|
9
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD): ContextualizedArgs<CONTEXT, ARGS, METHOD extends string ? true : false>;
|
|
10
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<CONTEXT>>): ContextualizedArgs<CONTEXT, ARGS, METHOD extends string ? true : false>;
|
|
11
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<CONTEXT>>): Promise<ContextualizedArgs<CONTEXT, ARGS, METHOD extends string ? true : false>>;
|
|
12
|
-
protected bindLoggerToRequest<RESULT extends ContextualizedArgs<any, any>>(value: RESULT | Promise<RESULT>, request?: Request): RESULT | Promise<RESULT>;
|
|
9
|
+
protected constructor(clientContext: DecafRequestContext, _name: string);
|
|
13
10
|
}
|
|
14
11
|
export declare abstract class DecafModelController<M extends Model<boolean>, C extends DecafServerCtx = DecafServerCtx> extends DecafController<C> {
|
|
12
|
+
protected readonly clientContext: DecafRequestContext;
|
|
15
13
|
private _persistence?;
|
|
14
|
+
protected constructor(clientContext: DecafRequestContext, _name: string);
|
|
16
15
|
abstract get class(): ModelConstructor<M>;
|
|
17
16
|
persistence(ctx?: Context<any>): Repo<M> | ModelService<M>;
|
|
18
|
-
protected constructor(clientContext: DecafRequestContext, name: string);
|
|
19
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<any, ARGS>, operation: METHOD): ContextualizedArgs<ContextOf<ReturnType<this["persistence"]>>, ARGS, METHOD extends string ? true : false>;
|
|
20
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<ReturnType<this["persistence"]>>, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<ContextOf<ReturnType<this["persistence"]>>>>): ContextualizedArgs<ContextOf<ReturnType<this["persistence"]>>, ARGS, METHOD extends string ? true : false>;
|
|
21
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<ReturnType<this["persistence"]>>, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<ContextOf<ReturnType<this["persistence"]>>>>): Promise<ContextualizedArgs<ContextOf<ReturnType<this["persistence"]>>, ARGS, METHOD extends string ? true : false>>;
|
|
22
17
|
}
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import { Context, ContextOf, ContextualizedArgs, FlagsOf, MaybeContextualArg, MethodOrOperation, ModelService, Repo, Service } from "@decaf-ts/core";
|
|
2
1
|
import { type Request } from "express";
|
|
2
|
+
import { DecafController as HttpDecafController } from "@decaf-ts/for-http/server";
|
|
3
|
+
import { Context, ModelService, Repo } from "@decaf-ts/core";
|
|
4
|
+
import { Model, type ModelConstructor } from "@decaf-ts/decorator-validation";
|
|
3
5
|
import { DecafServerCtx } from "./constants.d.mts";
|
|
4
|
-
import { Model, ModelConstructor } from "@decaf-ts/decorator-validation";
|
|
5
6
|
import { DecafRequestContext } from "./request/DecafRequestContext.d.mts";
|
|
6
|
-
export declare abstract class DecafController<CONTEXT extends DecafServerCtx> extends
|
|
7
|
+
export declare abstract class DecafController<CONTEXT extends DecafServerCtx = DecafServerCtx> extends HttpDecafController<Request, any, DecafRequestContext> {
|
|
7
8
|
protected readonly clientContext: DecafRequestContext;
|
|
8
|
-
protected constructor(clientContext: DecafRequestContext,
|
|
9
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD): ContextualizedArgs<CONTEXT, ARGS, METHOD extends string ? true : false>;
|
|
10
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<CONTEXT>>): ContextualizedArgs<CONTEXT, ARGS, METHOD extends string ? true : false>;
|
|
11
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<CONTEXT>>): Promise<ContextualizedArgs<CONTEXT, ARGS, METHOD extends string ? true : false>>;
|
|
12
|
-
protected bindLoggerToRequest<RESULT extends ContextualizedArgs<any, any>>(value: RESULT | Promise<RESULT>, request?: Request): RESULT | Promise<RESULT>;
|
|
9
|
+
protected constructor(clientContext: DecafRequestContext, _name: string);
|
|
13
10
|
}
|
|
14
11
|
export declare abstract class DecafModelController<M extends Model<boolean>, C extends DecafServerCtx = DecafServerCtx> extends DecafController<C> {
|
|
12
|
+
protected readonly clientContext: DecafRequestContext;
|
|
15
13
|
private _persistence?;
|
|
14
|
+
protected constructor(clientContext: DecafRequestContext, _name: string);
|
|
16
15
|
abstract get class(): ModelConstructor<M>;
|
|
17
16
|
persistence(ctx?: Context<any>): Repo<M> | ModelService<M>;
|
|
18
|
-
protected constructor(clientContext: DecafRequestContext, name: string);
|
|
19
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<any, ARGS>, operation: METHOD): ContextualizedArgs<ContextOf<ReturnType<this["persistence"]>>, ARGS, METHOD extends string ? true : false>;
|
|
20
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<ReturnType<this["persistence"]>>, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<ContextOf<ReturnType<this["persistence"]>>>>): ContextualizedArgs<ContextOf<ReturnType<this["persistence"]>>, ARGS, METHOD extends string ? true : false>;
|
|
21
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<ReturnType<this["persistence"]>>, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<ContextOf<ReturnType<this["persistence"]>>>>): Promise<ContextualizedArgs<ContextOf<ReturnType<this["persistence"]>>, ARGS, METHOD extends string ? true : false>>;
|
|
22
17
|
}
|
|
@@ -5,5 +5,6 @@ export declare function getModuleFor(flavour: string): {
|
|
|
5
5
|
new (): {};
|
|
6
6
|
readonly log: import("@decaf-ts/logging").Logger;
|
|
7
7
|
createModelServices<T extends Model<boolean>>(models: ModelConstructor<T>[]): Provider[];
|
|
8
|
+
isExposed(model: ModelConstructor<any>, exposure?: Record<string, boolean | string[]>): boolean;
|
|
8
9
|
forRoot(flavour: string, options?: Partial<DecafModuleOptions>): DynamicModule;
|
|
9
10
|
};
|
|
@@ -5,5 +5,6 @@ export declare function getModuleFor(flavour: string): {
|
|
|
5
5
|
new (): {};
|
|
6
6
|
readonly log: import("@decaf-ts/logging").Logger;
|
|
7
7
|
createModelServices<T extends Model<boolean>>(models: ModelConstructor<T>[]): Provider[];
|
|
8
|
+
isExposed(model: ModelConstructor<any>, exposure?: Record<string, boolean | string[]>): boolean;
|
|
8
9
|
forRoot(flavour: string, options?: Partial<DecafModuleOptions>): DynamicModule;
|
|
9
10
|
};
|
|
@@ -1,61 +1,41 @@
|
|
|
1
1
|
import { ModelService, type Repo } from "@decaf-ts/core";
|
|
2
2
|
import { Model, ModelConstructor } from "@decaf-ts/decorator-validation";
|
|
3
|
-
import { type
|
|
3
|
+
import { type DecafApiProperty } from "./decorators/index.d.cts";
|
|
4
4
|
import { ControllerConstructor } from "./types.d.cts";
|
|
5
5
|
import "../overrides";
|
|
6
|
-
|
|
7
|
-
* @description
|
|
8
|
-
* Factory and utilities for generating dynamic NestJS controllers from Decaf {@link Model} definitions.
|
|
9
|
-
*
|
|
10
|
-
* @summary
|
|
11
|
-
* The `FromModelController` class provides the infrastructure necessary to automatically generate
|
|
12
|
-
* strongly-typed CRUD controllers based on a given {@link ModelConstructor}. It inspects metadata from
|
|
13
|
-
* the model, derives route paths, parameters, and generates a dynamic controller class at runtime with
|
|
14
|
-
* full support for querying, creation, update, and deletion of model entities through a {@link Repo}.
|
|
15
|
-
*
|
|
16
|
-
* @template T The {@link Model} type associated with the generated controller.
|
|
17
|
-
*
|
|
18
|
-
* @param ModelClazz The model class to generate the controller from.
|
|
19
|
-
*
|
|
20
|
-
* @class FromModelController
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* // Given a Decaf Model:
|
|
25
|
-
* class User extends Model<User> {
|
|
26
|
-
* id!: string;
|
|
27
|
-
* name!: string;
|
|
28
|
-
* }
|
|
29
|
-
*
|
|
30
|
-
* // Register controller:
|
|
31
|
-
* const UserController = FromModelController.create(User);
|
|
32
|
-
*
|
|
33
|
-
* // NestJS will expose:
|
|
34
|
-
* // POST /user
|
|
35
|
-
* // GET /user/:id
|
|
36
|
-
* // GET /user/query/:method
|
|
37
|
-
* // PUT /user/:id
|
|
38
|
-
* // DELETE /user/:id
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @mermaid
|
|
42
|
-
* sequenceDiagram
|
|
43
|
-
* participant Client
|
|
44
|
-
* participant Controller
|
|
45
|
-
* participant Repo
|
|
46
|
-
* participant DB
|
|
47
|
-
*
|
|
48
|
-
* Client->>Controller: HTTP Request
|
|
49
|
-
* Controller->>Repo: Resolve repository for Model
|
|
50
|
-
* Repo->>DB: Execute DB operation
|
|
51
|
-
* DB-->>Repo: DB Result
|
|
52
|
-
* Repo-->>Controller: Model Instance(s)
|
|
53
|
-
* Controller-->>Client: JSON Response
|
|
54
|
-
*/
|
|
6
|
+
import { type ModelControllerFactoryConfig } from "@decaf-ts/for-http/server";
|
|
55
7
|
export declare class FromModelController {
|
|
56
8
|
private static readonly log;
|
|
9
|
+
private static toDecafError;
|
|
57
10
|
static getPersistence<T extends Model<boolean>>(ModelClazz: ModelConstructor<T>): Repo<T> | ModelService<T>;
|
|
58
11
|
static createQueryRoutesFromRepository<T extends Model<boolean>>(persistence: Repo<T> | ModelService<T>, prefix?: string): ControllerConstructor<T>;
|
|
59
|
-
static create<T extends Model<any>>(ModelConstr: ModelConstructor<T>):
|
|
60
|
-
static getRouteParametersFromModel<T extends Model<any>>(ModelClazz: ModelConstructor<T>):
|
|
12
|
+
static create<T extends Model<any>>(ModelConstr: ModelConstructor<T>, moduleConfigOverrides?: Record<string, ModelControllerFactoryConfig>, globalDefaults?: Partial<ModelControllerFactoryConfig>): ControllerConstructor<T>;
|
|
13
|
+
static getRouteParametersFromModel<T extends Model<any>>(ModelClazz: ModelConstructor<T>): {
|
|
14
|
+
path: string;
|
|
15
|
+
description: string;
|
|
16
|
+
apiProperties: DecafApiProperty[];
|
|
17
|
+
getPK: (...params: Array<string | number>) => string;
|
|
18
|
+
};
|
|
19
|
+
private static routeParamDecorators;
|
|
20
|
+
private static defineMethod;
|
|
21
|
+
private static applyDecorators;
|
|
22
|
+
private static matchRoute;
|
|
23
|
+
private static createRegistration;
|
|
24
|
+
private static statementMethodName;
|
|
25
|
+
private static statementShortcutParams;
|
|
26
|
+
private static complexQueryParams;
|
|
27
|
+
private static createComplexQueryHandler;
|
|
28
|
+
private static extractQueryArgs;
|
|
29
|
+
private static normalizeQueryArgs;
|
|
30
|
+
private static createCreateDecorators;
|
|
31
|
+
private static bulkCreateDecorators;
|
|
32
|
+
private static bulkReadDecorators;
|
|
33
|
+
private static bulkUpdateDecorators;
|
|
34
|
+
private static bulkDeleteDecorators;
|
|
35
|
+
private static readDecorators;
|
|
36
|
+
private static updateDecorators;
|
|
37
|
+
private static deleteDecorators;
|
|
38
|
+
private static statementDecorators;
|
|
39
|
+
private static statementShortcutDecorators;
|
|
40
|
+
private static getQueryDecorators;
|
|
61
41
|
}
|