@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
package/lib/types/index.d.mts
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
import "./decoration";
|
|
23
23
|
export * from "./decoration.d.mts";
|
|
24
24
|
export * from "./decaf-model/index.d.mts";
|
|
25
|
+
export * from "./auth/index.d.mts";
|
|
25
26
|
export * from "./factory/index.d.mts";
|
|
26
27
|
export * from "./interceptors/index.d.mts";
|
|
27
28
|
export * from "./overrides/index.d.mts";
|
|
@@ -30,8 +31,8 @@ export * from "./constants.d.mts";
|
|
|
30
31
|
export * from "./controllers.d.mts";
|
|
31
32
|
export * from "./module.d.mts";
|
|
32
33
|
export * from "./core-module.d.mts";
|
|
33
|
-
export * from "./migrations/index.d.mts";
|
|
34
34
|
export * from "./types.d.mts";
|
|
35
|
+
export * from "./decorators.d.mts";
|
|
35
36
|
export * from "./utils.d.mts";
|
|
36
37
|
export * from "./events-module/index.d.mts";
|
|
37
38
|
/**
|
|
@@ -40,19 +41,19 @@ export * from "./events-module/index.d.mts";
|
|
|
40
41
|
* @constant
|
|
41
42
|
* @type {string}
|
|
42
43
|
*/
|
|
43
|
-
export declare const VERSION = "0.
|
|
44
|
+
export declare const VERSION = "0.12.0";
|
|
44
45
|
/**
|
|
45
46
|
* @description Represents the current commit hash of the module build.
|
|
46
47
|
* @summary Stores the current git commit hash for the package. The build replaces
|
|
47
48
|
* the placeholder with the actual commit hash at publish time.
|
|
48
49
|
* @const COMMIT
|
|
49
50
|
*/
|
|
50
|
-
export declare const COMMIT = "
|
|
51
|
+
export declare const COMMIT = "3ac17fe";
|
|
51
52
|
/**
|
|
52
53
|
* @description Represents the full version string of the module.
|
|
53
54
|
* @summary Stores the semver version and commit hash for the package.
|
|
54
55
|
* The build replaces the placeholder with the actual `<version>-<commit>` value at publish time.
|
|
55
56
|
* @const FULL_VERSION
|
|
56
57
|
*/
|
|
57
|
-
export declare const FULL_VERSION = "0.
|
|
58
|
+
export declare const FULL_VERSION = "0.12.0-3ac17fe";
|
|
58
59
|
export declare const PACKAGE_NAME = "@decaf-ts/for-nest";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CallHandler, ExecutionContext, NestInterceptor } from "@nestjs/common";
|
|
2
2
|
import { DecafHandlerExecutor, DecafRequestContext } from "../request/index.d.cts";
|
|
3
|
-
import { DecafServerCtx } from "../constants.d.cts";
|
|
4
3
|
import "../overrides";
|
|
5
4
|
/**
|
|
6
5
|
* @description
|
|
@@ -52,6 +51,6 @@ export declare class DecafRequestHandlerInterceptor implements NestInterceptor {
|
|
|
52
51
|
protected readonly requestContext: DecafRequestContext;
|
|
53
52
|
protected readonly executor: DecafHandlerExecutor;
|
|
54
53
|
constructor(requestContext: DecafRequestContext, executor: DecafHandlerExecutor);
|
|
55
|
-
protected contextualize(req: any): Promise<
|
|
54
|
+
protected contextualize(req: any): Promise<void>;
|
|
56
55
|
intercept(context: ExecutionContext, next: CallHandler): Promise<import("rxjs").Observable<any>>;
|
|
57
56
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CallHandler, ExecutionContext, NestInterceptor } from "@nestjs/common";
|
|
2
2
|
import { DecafHandlerExecutor, DecafRequestContext } from "../request/index.d.mts";
|
|
3
|
-
import { DecafServerCtx } from "../constants.d.mts";
|
|
4
3
|
import "../overrides";
|
|
5
4
|
/**
|
|
6
5
|
* @description
|
|
@@ -52,6 +51,6 @@ export declare class DecafRequestHandlerInterceptor implements NestInterceptor {
|
|
|
52
51
|
protected readonly requestContext: DecafRequestContext;
|
|
53
52
|
protected readonly executor: DecafHandlerExecutor;
|
|
54
53
|
constructor(requestContext: DecafRequestContext, executor: DecafHandlerExecutor);
|
|
55
|
-
protected contextualize(req: any): Promise<
|
|
54
|
+
protected contextualize(req: any): Promise<void>;
|
|
56
55
|
intercept(context: ExecutionContext, next: CallHandler): Promise<import("rxjs").Observable<any>>;
|
|
57
56
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "@decaf-ts/core";
|
|
2
2
|
import type { Constructor } from "@decaf-ts/decoration";
|
|
3
|
-
import { RequestToContextTransformer } from "
|
|
3
|
+
import { RequestToContextTransformer } from "@decaf-ts/for-http/server";
|
|
4
4
|
import { ContextOf } from "@decaf-ts/core";
|
|
5
5
|
declare module "@decaf-ts/core" {
|
|
6
6
|
namespace Adapter {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "@decaf-ts/core";
|
|
2
2
|
import type { Constructor } from "@decaf-ts/decoration";
|
|
3
|
-
import { RequestToContextTransformer } from "
|
|
3
|
+
import { RequestToContextTransformer } from "@decaf-ts/for-http/server";
|
|
4
4
|
import { ContextOf } from "@decaf-ts/core";
|
|
5
5
|
declare module "@decaf-ts/core" {
|
|
6
6
|
namespace Adapter {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@decaf-ts/for-http/server";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@decaf-ts/for-http/server";
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { AuthHandler } from "../types.d.cts";
|
|
3
|
-
export declare class DecafAuthHandler implements AuthHandler {
|
|
4
|
-
protected parseRequest(req: any): string;
|
|
5
|
-
authorize(ctx: ExecutionContext, resource: string): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
export declare class DecafRoleAuthHandler extends DecafAuthHandler {
|
|
8
|
-
constructor();
|
|
9
|
-
authorize(ctx: ExecutionContext, resource: string): Promise<any>;
|
|
10
|
-
}
|
|
1
|
+
export { DecafAuthHandler, DecafRoleAuthHandler } from "../auth/index.d.cts";
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { AuthHandler } from "../types.d.mts";
|
|
3
|
-
export declare class DecafAuthHandler implements AuthHandler {
|
|
4
|
-
protected parseRequest(req: any): string;
|
|
5
|
-
authorize(ctx: ExecutionContext, resource: string): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
export declare class DecafRoleAuthHandler extends DecafAuthHandler {
|
|
8
|
-
constructor();
|
|
9
|
-
authorize(ctx: ExecutionContext, resource: string): Promise<any>;
|
|
10
|
-
}
|
|
1
|
+
export { DecafAuthHandler, DecafRoleAuthHandler } from "../auth/index.d.mts";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { RequestContext } from "@decaf-ts/for-http/server";
|
|
2
|
+
import { type Request } from "express";
|
|
1
3
|
import { DecafServerCtx } from "../constants.d.cts";
|
|
2
|
-
export declare class DecafRequestContext<C extends DecafServerCtx = DecafServerCtx> {
|
|
4
|
+
export declare class DecafRequestContext<C extends DecafServerCtx = DecafServerCtx> extends RequestContext<Request> {
|
|
3
5
|
private readonly req;
|
|
4
|
-
private _ctx?;
|
|
5
6
|
uuid: string | Promise<string>;
|
|
7
|
+
readonly request: Request;
|
|
6
8
|
constructor(req: Request);
|
|
7
|
-
get
|
|
9
|
+
get headers(): Record<string, string | string[] | undefined> | undefined;
|
|
8
10
|
put(record: Record<any, any>): void;
|
|
9
|
-
applyCtx(ctx: C): void;
|
|
10
|
-
get ctx(): C;
|
|
11
11
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { RequestContext } from "@decaf-ts/for-http/server";
|
|
2
|
+
import { type Request } from "express";
|
|
1
3
|
import { DecafServerCtx } from "../constants.d.mts";
|
|
2
|
-
export declare class DecafRequestContext<C extends DecafServerCtx = DecafServerCtx> {
|
|
4
|
+
export declare class DecafRequestContext<C extends DecafServerCtx = DecafServerCtx> extends RequestContext<Request> {
|
|
3
5
|
private readonly req;
|
|
4
|
-
private _ctx?;
|
|
5
6
|
uuid: string | Promise<string>;
|
|
7
|
+
readonly request: Request;
|
|
6
8
|
constructor(req: Request);
|
|
7
|
-
get
|
|
9
|
+
get headers(): Record<string, string | string[] | undefined> | undefined;
|
|
8
10
|
put(record: Record<any, any>): void;
|
|
9
|
-
applyCtx(ctx: C): void;
|
|
10
|
-
get ctx(): C;
|
|
11
11
|
}
|
package/lib/types/types.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Adapter, ConfigOf, ContextOf } from "@decaf-ts/core";
|
|
2
2
|
import { Constructor } from "@decaf-ts/decoration";
|
|
3
3
|
import { ExecutionContext, Type } from "@nestjs/common";
|
|
4
|
-
import { RequestToContextTransformer } from "
|
|
4
|
+
import { RequestToContextTransformer, type ModelControllerFactoryConfig, type AuthHandler as AuthHandlerBase } from "@decaf-ts/for-http/server";
|
|
5
5
|
import { DecafRequestContext } from "./request/index.d.cts";
|
|
6
6
|
export interface DecafRequestHandler<C extends DecafRequestContext = DecafRequestContext> {
|
|
7
7
|
handle(context: C, req: Request, res: Response): Promise<void>;
|
|
@@ -37,52 +37,40 @@ export type DecafModuleOptions<CONF = any, A extends Adapter<CONF, any, any, any
|
|
|
37
37
|
alias?: string;
|
|
38
38
|
autoControllers: boolean;
|
|
39
39
|
autoServices?: boolean;
|
|
40
|
+
controllerExposure?: Record<string, boolean | string[]>;
|
|
41
|
+
controllerConfig?: Record<string, ModelControllerFactoryConfig>;
|
|
40
42
|
observerOptions?: ObserverEventsOptions;
|
|
41
43
|
aggregations?: boolean;
|
|
42
44
|
handlers?: Type<DecafRequestHandler>[];
|
|
43
45
|
initialization?: () => Promise<void>;
|
|
44
46
|
};
|
|
45
47
|
/**
|
|
46
|
-
*
|
|
48
|
+
* NestJS-narrowed alias for the base {@link AuthHandlerBase} class from
|
|
49
|
+
* `@decaf-ts/for-http/server`, specializing the execution context to
|
|
50
|
+
* `ExecutionContext` and the request context to {@link DecafRequestContext}.
|
|
47
51
|
*
|
|
48
|
-
*
|
|
52
|
+
* Concrete handlers extend this class and override `extractFromAuth`.
|
|
49
53
|
*
|
|
50
54
|
* @example
|
|
51
|
-
* export class CustomAuthHandler
|
|
52
|
-
*
|
|
55
|
+
* export class CustomAuthHandler extends AuthHandler {
|
|
56
|
+
* protected extractFromAuth(ctx: ExecutionContext) {
|
|
53
57
|
* const req = ctx.switchToHttp().getRequest();
|
|
54
58
|
* const userRole = req.headers.authorization?.split(" ")[1] as string;
|
|
55
59
|
* if (!userRole) throw new AuthorizationError("Unauthenticated");
|
|
56
|
-
*
|
|
57
|
-
* if (!roles.includes(userRole)) {
|
|
58
|
-
* throw new AuthorizationError("Unauthorized");
|
|
59
|
-
* }
|
|
60
|
+
* return { user: userRole, roles: [userRole] };
|
|
60
61
|
* }
|
|
61
62
|
* }
|
|
62
63
|
*
|
|
63
64
|
* // auth.module.ts
|
|
64
|
-
*
|
|
65
65
|
* @Global()
|
|
66
66
|
* @Module({
|
|
67
67
|
* providers: [
|
|
68
68
|
* AuthInterceptor,
|
|
69
69
|
* CustomAuthHandler,
|
|
70
|
-
* {
|
|
71
|
-
* provide: AUTH_HANDLER,
|
|
72
|
-
* useClass: CustomAuthHandler, //swap this to use another provider
|
|
73
|
-
* },
|
|
70
|
+
* { provide: AUTH_HANDLER, useClass: CustomAuthHandler },
|
|
74
71
|
* ],
|
|
75
72
|
* exports: [AUTH_HANDLER, AuthInterceptor],
|
|
76
73
|
* })
|
|
77
74
|
* export class AuthModule {}
|
|
78
75
|
*/
|
|
79
|
-
export
|
|
80
|
-
/**
|
|
81
|
-
* Inspect the request context and ensure the caller can access the model.
|
|
82
|
-
* Implementations should throw an {@link AuthorizationError} on denial.
|
|
83
|
-
*
|
|
84
|
-
* @param ctx - Nest execution context that exposes the request/response.
|
|
85
|
-
* @param model - Model name or constructor being accessed.
|
|
86
|
-
*/
|
|
87
|
-
authorize(ctx: ExecutionContext, model: string | Constructor): Promise<void> | void;
|
|
88
|
-
}
|
|
76
|
+
export type AuthHandler<EC = ExecutionContext, C extends DecafRequestContext = DecafRequestContext> = AuthHandlerBase<EC, C>;
|
package/lib/types/types.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Adapter, ConfigOf, ContextOf } from "@decaf-ts/core";
|
|
2
2
|
import { Constructor } from "@decaf-ts/decoration";
|
|
3
3
|
import { ExecutionContext, Type } from "@nestjs/common";
|
|
4
|
-
import { RequestToContextTransformer } from "
|
|
4
|
+
import { RequestToContextTransformer, type ModelControllerFactoryConfig, type AuthHandler as AuthHandlerBase } from "@decaf-ts/for-http/server";
|
|
5
5
|
import { DecafRequestContext } from "./request/index.d.mts";
|
|
6
6
|
export interface DecafRequestHandler<C extends DecafRequestContext = DecafRequestContext> {
|
|
7
7
|
handle(context: C, req: Request, res: Response): Promise<void>;
|
|
@@ -37,52 +37,40 @@ export type DecafModuleOptions<CONF = any, A extends Adapter<CONF, any, any, any
|
|
|
37
37
|
alias?: string;
|
|
38
38
|
autoControllers: boolean;
|
|
39
39
|
autoServices?: boolean;
|
|
40
|
+
controllerExposure?: Record<string, boolean | string[]>;
|
|
41
|
+
controllerConfig?: Record<string, ModelControllerFactoryConfig>;
|
|
40
42
|
observerOptions?: ObserverEventsOptions;
|
|
41
43
|
aggregations?: boolean;
|
|
42
44
|
handlers?: Type<DecafRequestHandler>[];
|
|
43
45
|
initialization?: () => Promise<void>;
|
|
44
46
|
};
|
|
45
47
|
/**
|
|
46
|
-
*
|
|
48
|
+
* NestJS-narrowed alias for the base {@link AuthHandlerBase} class from
|
|
49
|
+
* `@decaf-ts/for-http/server`, specializing the execution context to
|
|
50
|
+
* `ExecutionContext` and the request context to {@link DecafRequestContext}.
|
|
47
51
|
*
|
|
48
|
-
*
|
|
52
|
+
* Concrete handlers extend this class and override `extractFromAuth`.
|
|
49
53
|
*
|
|
50
54
|
* @example
|
|
51
|
-
* export class CustomAuthHandler
|
|
52
|
-
*
|
|
55
|
+
* export class CustomAuthHandler extends AuthHandler {
|
|
56
|
+
* protected extractFromAuth(ctx: ExecutionContext) {
|
|
53
57
|
* const req = ctx.switchToHttp().getRequest();
|
|
54
58
|
* const userRole = req.headers.authorization?.split(" ")[1] as string;
|
|
55
59
|
* if (!userRole) throw new AuthorizationError("Unauthenticated");
|
|
56
|
-
*
|
|
57
|
-
* if (!roles.includes(userRole)) {
|
|
58
|
-
* throw new AuthorizationError("Unauthorized");
|
|
59
|
-
* }
|
|
60
|
+
* return { user: userRole, roles: [userRole] };
|
|
60
61
|
* }
|
|
61
62
|
* }
|
|
62
63
|
*
|
|
63
64
|
* // auth.module.ts
|
|
64
|
-
*
|
|
65
65
|
* @Global()
|
|
66
66
|
* @Module({
|
|
67
67
|
* providers: [
|
|
68
68
|
* AuthInterceptor,
|
|
69
69
|
* CustomAuthHandler,
|
|
70
|
-
* {
|
|
71
|
-
* provide: AUTH_HANDLER,
|
|
72
|
-
* useClass: CustomAuthHandler, //swap this to use another provider
|
|
73
|
-
* },
|
|
70
|
+
* { provide: AUTH_HANDLER, useClass: CustomAuthHandler },
|
|
74
71
|
* ],
|
|
75
72
|
* exports: [AUTH_HANDLER, AuthInterceptor],
|
|
76
73
|
* })
|
|
77
74
|
* export class AuthModule {}
|
|
78
75
|
*/
|
|
79
|
-
export
|
|
80
|
-
/**
|
|
81
|
-
* Inspect the request context and ensure the caller can access the model.
|
|
82
|
-
* Implementations should throw an {@link AuthorizationError} on denial.
|
|
83
|
-
*
|
|
84
|
-
* @param ctx - Nest execution context that exposes the request/response.
|
|
85
|
-
* @param model - Model name or constructor being accessed.
|
|
86
|
-
*/
|
|
87
|
-
authorize(ctx: ExecutionContext, model: string | Constructor): Promise<void> | void;
|
|
88
|
-
}
|
|
76
|
+
export type AuthHandler<EC = ExecutionContext, C extends DecafRequestContext = DecafRequestContext> = AuthHandlerBase<EC, C>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decaf-ts/for-nest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "NestJS decaf integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -15,17 +15,6 @@
|
|
|
15
15
|
},
|
|
16
16
|
"default": "./lib/esm/index.js"
|
|
17
17
|
},
|
|
18
|
-
"./ram": {
|
|
19
|
-
"import": {
|
|
20
|
-
"types": "./lib/types/ram/index.d.mts",
|
|
21
|
-
"default": "./lib/esm/ram/index.js"
|
|
22
|
-
},
|
|
23
|
-
"require": {
|
|
24
|
-
"types": "./lib/types/ram/index.d.cts",
|
|
25
|
-
"default": "./lib/cjs/ram/index.cjs"
|
|
26
|
-
},
|
|
27
|
-
"default": "./lib/esm/ram/index.js"
|
|
28
|
-
},
|
|
29
18
|
"./cli": {
|
|
30
19
|
"import": {
|
|
31
20
|
"types": "./lib/types/cli-module.d.mts",
|
|
@@ -77,6 +66,7 @@
|
|
|
77
66
|
"test": "jest --runInBand --coverage --detectOpenHandles",
|
|
78
67
|
"test:unit": "jest --testPathPatterns=\"/tests/unit\" --passWithNoTests --detectOpenHandles",
|
|
79
68
|
"test:integration": "jest --testPathPatterns=\"/tests/(integration)\" --passWithNoTests --detectOpenHandles",
|
|
69
|
+
"test:manual": "MANUAL_INSPECT=true MANUAL_INSPECT_TIMEOUT=600000 jest --testPathPatterns=\"/tests/e2e/decaf-model-controller-builder.e2e.test.ts\" --detectOpenHandles",
|
|
80
70
|
"test:all": "jest --testPathPatterns=\"/tests\" --passWithNoTests --detectOpenHandles",
|
|
81
71
|
"test:circular": "dpdm -T --no-warning --no-tree ./src/index.ts",
|
|
82
72
|
"coverage": "rimraf ./workdocs/reports/data/*.json && npm run test:all -- --coverage --config=./workdocs/reports/jest.coverage.config.cjs",
|
|
@@ -152,6 +142,7 @@
|
|
|
152
142
|
"commander": "^13.1.0",
|
|
153
143
|
"eventsource": "^4.1.0",
|
|
154
144
|
"supertest": "^7.1.4",
|
|
145
|
+
"typed-array-buffer": "^1.0.3",
|
|
155
146
|
"typescript": "^5.9.3"
|
|
156
147
|
},
|
|
157
148
|
"dependencies": {
|
|
@@ -173,6 +164,14 @@
|
|
|
173
164
|
"fabric-ca-client": {
|
|
174
165
|
"jsrsasign": "^11.1.0"
|
|
175
166
|
},
|
|
176
|
-
"ajv": "^8.17.2"
|
|
167
|
+
"ajv": "^8.17.2",
|
|
168
|
+
"@eslint/eslintrc": {
|
|
169
|
+
"ajv": "^6.14.0"
|
|
170
|
+
},
|
|
171
|
+
"eslint": {
|
|
172
|
+
"ajv": "^6.14.0"
|
|
173
|
+
},
|
|
174
|
+
"multer": "^2.1.2",
|
|
175
|
+
"js-yaml": "^4.2.0"
|
|
177
176
|
}
|
|
178
177
|
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthInterceptor = void 0;
|
|
4
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
5
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
7
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
-
else
|
|
9
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
10
|
-
if (d = decorators[i])
|
|
11
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13
|
-
};
|
|
14
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
15
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
16
|
-
return Reflect.metadata(k, v);
|
|
17
|
-
};
|
|
18
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
19
|
-
return function (target, key) { decorator(target, key, paramIndex); };
|
|
20
|
-
};
|
|
21
|
-
const common_1 = require("@nestjs/common");
|
|
22
|
-
const core_1 = require("@nestjs/core");
|
|
23
|
-
const constants_js_1 = require("./../constants.cjs");
|
|
24
|
-
const logging_1 = require("@decaf-ts/logging");
|
|
25
|
-
let AuthInterceptor = class AuthInterceptor {
|
|
26
|
-
constructor(reflector, authHandler) {
|
|
27
|
-
this.reflector = reflector;
|
|
28
|
-
this.authHandler = authHandler;
|
|
29
|
-
}
|
|
30
|
-
async intercept(ctx, next) {
|
|
31
|
-
const log = logging_1.Logging.for(this).for(this.intercept);
|
|
32
|
-
const modelName = this.reflector.get(constants_js_1.AUTH_META_KEY, ctx.getHandler()) ??
|
|
33
|
-
this.reflector.get(constants_js_1.AUTH_META_KEY, ctx.getClass());
|
|
34
|
-
log.verbose(`Intercepted request${modelName ? ` for ${modelName}` : ""}`);
|
|
35
|
-
if (this.authHandler) {
|
|
36
|
-
await this.authHandler.authorize(ctx, modelName);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
log.debug(`No auth handler/model`);
|
|
40
|
-
}
|
|
41
|
-
return next.handle();
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
exports.AuthInterceptor = AuthInterceptor;
|
|
45
|
-
exports.AuthInterceptor = AuthInterceptor = __decorate([
|
|
46
|
-
(0, common_1.Injectable)(),
|
|
47
|
-
__param(1, (0, common_1.Optional)()),
|
|
48
|
-
__param(1, (0, common_1.Inject)(constants_js_1.AUTH_HANDLER)),
|
|
49
|
-
__metadata("design:paramtypes", [core_1.Reflector, Object])
|
|
50
|
-
], AuthInterceptor);
|
|
51
|
-
//# sourceMappingURL=AuthInterceptor.js.map
|
|
52
|
-
//# sourceMappingURL=AuthInterceptor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthInterceptor.js","sourceRoot":"","sources":["AuthInterceptor.js"],"names":[],"mappings":";;;AAAA,IAAI,UAAU,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,UAAU,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI;IACjF,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,C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,CAAC,gBAAS,EAAE,MAAM,CAAC,CAAC;CACvD,EAAE,eAAe,CAAC,CAAC;AAEpB,2CAA2C"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RequestToContextTransformer = void 0;
|
|
4
|
-
exports.requestToContextTransformer = requestToContextTransformer;
|
|
5
|
-
const decoration_1 = require("@decaf-ts/decoration");
|
|
6
|
-
class RequestToContextTransformer {
|
|
7
|
-
}
|
|
8
|
-
exports.RequestToContextTransformer = RequestToContextTransformer;
|
|
9
|
-
function requestToContextTransformer(flavour) {
|
|
10
|
-
return function requestToContextTransformer(original) {
|
|
11
|
-
decoration_1.Metadata.set("transformers", flavour, original);
|
|
12
|
-
if (typeof original === "function")
|
|
13
|
-
return (0, decoration_1.metadata)("transformers", flavour)(original);
|
|
14
|
-
return original;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=context.js.map
|
|
18
|
-
//# sourceMappingURL=context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["context.js"],"names":[],"mappings":";;;AAGA,kEAOC;AAVD,qDAA0D;AAC1D,MAAa,2BAA2B;CACvC;AADD,kEACC;AACD,SAAgB,2BAA2B,CAAC,OAAO;IAC/C,OAAO,SAAS,2BAA2B,CAAC,QAAQ;QAChD,qBAAQ,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAChD,IAAI,OAAO,QAAQ,KAAK,UAAU;YAC9B,OAAO,IAAA,qBAAQ,EAAC,cAAc,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;QACvD,OAAO,QAAQ,CAAC;IACpB,CAAC,CAAC;AACN,CAAC;AACD,mCAAmC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
/**
|
|
18
|
-
* @module for-nest/migrations
|
|
19
|
-
* @description Migration utilities for NestJS integration
|
|
20
|
-
* @summary Provides task-based migration orchestration as a separate module
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* import { DecafMigrationModule } from '@decaf-ts/for-nest/migrations';
|
|
24
|
-
*
|
|
25
|
-
* @Module({
|
|
26
|
-
* imports: [
|
|
27
|
-
* DecafMigrationModule
|
|
28
|
-
* ]
|
|
29
|
-
* })
|
|
30
|
-
* export class AppModule {}
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
__exportStar(require("./migration-module.cjs"), exports);
|
|
34
|
-
//# sourceMappingURL=index.js.map
|
|
35
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,wDAAsC;AACtC,iCAAiC"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DecafMigrationModule = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module for-nest/migrations
|
|
6
|
-
* @description Migration orchestration module for NestJS
|
|
7
|
-
*/
|
|
8
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
9
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
11
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
12
|
-
else
|
|
13
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
14
|
-
if (d = decorators[i])
|
|
15
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
16
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17
|
-
};
|
|
18
|
-
var DecafMigrationModule_1;
|
|
19
|
-
const common_1 = require("@nestjs/common");
|
|
20
|
-
const db_decorators_1 = require("@decaf-ts/db-decorators");
|
|
21
|
-
const logging_1 = require("@decaf-ts/logging");
|
|
22
|
-
const constants_js_1 = require("./../constants.cjs");
|
|
23
|
-
const migrations_1 = require("@decaf-ts/core/migrations");
|
|
24
|
-
const logger = logging_1.Logging.for("DecafMigrationModule");
|
|
25
|
-
/**
|
|
26
|
-
* @description Migration module for NestJS
|
|
27
|
-
* @summary Provides migration orchestration capabilities
|
|
28
|
-
* @module for-nest/migrations
|
|
29
|
-
*/
|
|
30
|
-
let DecafMigrationModule = DecafMigrationModule_1 = class DecafMigrationModule {
|
|
31
|
-
static forRoot() {
|
|
32
|
-
return {
|
|
33
|
-
module: DecafMigrationModule_1,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
static async migrate(config, adapters) {
|
|
37
|
-
const log = logger.for(this.migrate);
|
|
38
|
-
if (!adapters || adapters.length === 0) {
|
|
39
|
-
throw new db_decorators_1.InternalError("No adapters provided. Make sure DecafCoreModule is configured and adapters are available.");
|
|
40
|
-
}
|
|
41
|
-
log.info(`Running migrations with config: ${JSON.stringify(config)}`);
|
|
42
|
-
return migrations_1.MigrationService.migrateAdapters(adapters, config || {});
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
exports.DecafMigrationModule = DecafMigrationModule;
|
|
46
|
-
exports.DecafMigrationModule = DecafMigrationModule = DecafMigrationModule_1 = __decorate([
|
|
47
|
-
(0, common_1.Global)(),
|
|
48
|
-
(0, common_1.Module)({
|
|
49
|
-
providers: [
|
|
50
|
-
{
|
|
51
|
-
provide: "MIGRATION_ADAPTERS",
|
|
52
|
-
useFactory: (adapters) => adapters,
|
|
53
|
-
inject: [constants_js_1.DECAF_ADAPTER_ID],
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
exports: ["MIGRATION_ADAPTERS"],
|
|
57
|
-
})
|
|
58
|
-
], DecafMigrationModule);
|
|
59
|
-
//# sourceMappingURL=migration-module.js.map
|
|
60
|
-
//# sourceMappingURL=migration-module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migration-module.js","sourceRoot":"","sources":["migration-module.js"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,IAAI,UAAU,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,UAAU,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI;IACjF,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7H,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,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AAC,2FAA2F,CAAC,CAAC;QACzH,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,mCAAmC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACtE,OAAO,6BAAgB,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC;IACpE,CAAC;CACJ,CAAC;AAcO,oDAAoB;AAb7B,+BAAA,oBAAoB,GAAG,sBAAsB,GAAG,UAAU,CAAC;IACvD,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACH,SAAS,EAAE;YACP;gBACI,OAAO,EAAE,oBAAoB;gBAC7B,UAAU,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ;gBAClC,MAAM,EAAE,CAAC,+BAAgB,CAAC;aAC7B;SACJ;QACD,OAAO,EAAE,CAAC,oBAAoB,CAAC;KAClC,CAAC;CACL,EAAE,oBAAoB,CAAC,CAAC;AAEzB,4CAA4C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migration-options.js","sourceRoot":"","sources":["migration-options.js"],"names":[],"mappings":";;AAMA,6CAA6C"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RamTransformer = void 0;
|
|
4
|
-
// @requestToContextTransformer("ram")
|
|
5
|
-
class RamTransformer {
|
|
6
|
-
constructor() { }
|
|
7
|
-
async from(req, ..._args) {
|
|
8
|
-
const user = req.headers.authorization
|
|
9
|
-
? req.headers.authorization.split(" ")[1]
|
|
10
|
-
: undefined;
|
|
11
|
-
if (!user) {
|
|
12
|
-
return {
|
|
13
|
-
headers: req?.headers || {},
|
|
14
|
-
overrides: {},
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
UUID: user,
|
|
19
|
-
headers: req?.headers || {},
|
|
20
|
-
overrides: {},
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.RamTransformer = RamTransformer;
|
|
25
|
-
//# sourceMappingURL=RamRequestTransformer.js.map
|
|
26
|
-
//# sourceMappingURL=RamRequestTransformer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RamRequestTransformer.js","sourceRoot":"","sources":["RamRequestTransformer.js"],"names":[],"mappings":";;;AAAA,sCAAsC;AACtC,MAAa,cAAc;IACvB,gBAAgB,CAAC;IACjB,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;QACpB,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa;YAClC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACzC,CAAC,CAAC,SAAS,CAAC;QAChB,IAAI,CAAC,IAAI,EAAE,CAAC;YACR,OAAO;gBACH,OAAO,EAAE,GAAG,EAAE,OAAO,IAAI,EAAE;gBAC3B,SAAS,EAAE,EAAE;aAChB,CAAC;QACN,CAAC;QACD,OAAO;YACH,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,GAAG,EAAE,OAAO,IAAI,EAAE;YAC3B,SAAS,EAAE,EAAE;SAChB,CAAC;IACN,CAAC;CACJ;AAlBD,wCAkBC;AACD,iDAAiD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,iCAAiC"}
|