@decaf-ts/for-nest 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/lib/cjs/index.cjs +1 -1
  2. package/lib/esm/index.js +1 -1
  3. package/lib/types/controllers.d.cts +2 -2
  4. package/lib/types/controllers.d.mts +2 -2
  5. package/lib/types/core-module.d.cts +1 -1
  6. package/lib/types/core-module.d.mts +1 -1
  7. package/lib/types/decaf-model/DecafModelModule.d.cts +1 -1
  8. package/lib/types/decaf-model/DecafModelModule.d.mts +1 -1
  9. package/lib/types/decaf-model/FromModelController.d.cts +2 -2
  10. package/lib/types/decaf-model/FromModelController.d.mts +2 -2
  11. package/lib/types/decaf-model/decorators/ApiOperationFromModel.d.cts +1 -1
  12. package/lib/types/decaf-model/decorators/ApiOperationFromModel.d.mts +1 -1
  13. package/lib/types/decaf-model/decorators/ApiParamsFromModel.d.cts +1 -1
  14. package/lib/types/decaf-model/decorators/ApiParamsFromModel.d.mts +1 -1
  15. package/lib/types/decaf-model/decorators/DecafParams.d.cts +1 -1
  16. package/lib/types/decaf-model/decorators/DecafParams.d.mts +1 -1
  17. package/lib/types/decaf-model/decorators/index.d.cts +7 -7
  18. package/lib/types/decaf-model/decorators/index.d.mts +7 -7
  19. package/lib/types/decaf-model/decorators/utils.d.cts +1 -1
  20. package/lib/types/decaf-model/decorators/utils.d.mts +1 -1
  21. package/lib/types/decaf-model/index.d.cts +3 -3
  22. package/lib/types/decaf-model/index.d.mts +3 -3
  23. package/lib/types/decaf-model/types.d.cts +1 -1
  24. package/lib/types/decaf-model/types.d.mts +1 -1
  25. package/lib/types/decaf-model/utils.d.cts +3 -3
  26. package/lib/types/decaf-model/utils.d.mts +3 -3
  27. package/lib/types/events-module/EventsController.d.cts +3 -3
  28. package/lib/types/events-module/EventsController.d.mts +3 -3
  29. package/lib/types/events-module/index.d.cts +2 -2
  30. package/lib/types/events-module/index.d.mts +2 -2
  31. package/lib/types/factory/NestBootstraper.d.cts +2 -2
  32. package/lib/types/factory/NestBootstraper.d.mts +2 -2
  33. package/lib/types/factory/errors/index.d.cts +1 -1
  34. package/lib/types/factory/errors/index.d.mts +1 -1
  35. package/lib/types/factory/exceptions/index.d.cts +2 -2
  36. package/lib/types/factory/exceptions/index.d.mts +2 -2
  37. package/lib/types/factory/index.d.cts +4 -4
  38. package/lib/types/factory/index.d.mts +4 -4
  39. package/lib/types/factory/openapi/SwaggerBuilder.d.cts +1 -1
  40. package/lib/types/factory/openapi/SwaggerBuilder.d.mts +1 -1
  41. package/lib/types/factory/openapi/index.d.cts +2 -2
  42. package/lib/types/factory/openapi/index.d.mts +2 -2
  43. package/lib/types/index.d.cts +14 -14
  44. package/lib/types/index.d.mts +14 -14
  45. package/lib/types/interceptors/AuthInterceptor.d.cts +1 -1
  46. package/lib/types/interceptors/AuthInterceptor.d.mts +1 -1
  47. package/lib/types/interceptors/DecafRequestHandlerInterceptor.d.cts +2 -2
  48. package/lib/types/interceptors/DecafRequestHandlerInterceptor.d.mts +2 -2
  49. package/lib/types/interceptors/context.d.cts +1 -1
  50. package/lib/types/interceptors/context.d.mts +1 -1
  51. package/lib/types/interceptors/index.d.cts +3 -3
  52. package/lib/types/interceptors/index.d.mts +3 -3
  53. package/lib/types/module.d.cts +1 -1
  54. package/lib/types/module.d.mts +1 -1
  55. package/lib/types/overrides/Adapter.d.cts +1 -1
  56. package/lib/types/overrides/Adapter.d.mts +1 -1
  57. package/lib/types/overrides/index.d.cts +5 -5
  58. package/lib/types/overrides/index.d.mts +5 -5
  59. package/lib/types/ram/RamRequestTransformer.d.cts +1 -1
  60. package/lib/types/ram/RamRequestTransformer.d.mts +1 -1
  61. package/lib/types/ram/index.d.cts +1 -1
  62. package/lib/types/ram/index.d.mts +1 -1
  63. package/lib/types/request/DecafAuthHandler.d.cts +1 -1
  64. package/lib/types/request/DecafAuthHandler.d.mts +1 -1
  65. package/lib/types/request/DecafHandlerExecutor.d.cts +2 -2
  66. package/lib/types/request/DecafHandlerExecutor.d.mts +2 -2
  67. package/lib/types/request/DecafRequestContext.d.cts +1 -1
  68. package/lib/types/request/DecafRequestContext.d.mts +1 -1
  69. package/lib/types/request/DecafResponseInterceptor.d.cts +1 -1
  70. package/lib/types/request/DecafResponseInterceptor.d.mts +1 -1
  71. package/lib/types/request/index.d.cts +4 -4
  72. package/lib/types/request/index.d.mts +4 -4
  73. package/lib/types/types.d.cts +2 -2
  74. package/lib/types/types.d.mts +2 -2
  75. package/package.json +1 -1
  76. package/lib/types/bin/cli.d.ts +0 -1
  77. package/lib/types/cli-module.d.ts +0 -11
  78. package/lib/types/constants.d.ts +0 -15
  79. package/lib/types/controllers.d.ts +0 -22
  80. package/lib/types/core-module.d.ts +0 -17
  81. package/lib/types/decaf-model/DecafModelModule.d.ts +0 -9
  82. package/lib/types/decaf-model/FromModelController.d.ts +0 -61
  83. package/lib/types/decaf-model/decorators/ApiOperationFromModel.d.ts +0 -30
  84. package/lib/types/decaf-model/decorators/ApiParamsFromModel.d.ts +0 -13
  85. package/lib/types/decaf-model/decorators/DecafBody.d.ts +0 -5
  86. package/lib/types/decaf-model/decorators/DecafParams.d.ts +0 -9
  87. package/lib/types/decaf-model/decorators/decorators.d.ts +0 -29
  88. package/lib/types/decaf-model/decorators/index.d.ts +0 -7
  89. package/lib/types/decaf-model/decorators/types.d.ts +0 -23
  90. package/lib/types/decaf-model/decorators/utils.d.ts +0 -11
  91. package/lib/types/decaf-model/index.d.ts +0 -3
  92. package/lib/types/decaf-model/types.d.ts +0 -7
  93. package/lib/types/decaf-model/utils.d.ts +0 -10
  94. package/lib/types/decoration.d.ts +0 -1
  95. package/lib/types/events-module/DecafStreamModule.d.ts +0 -4
  96. package/lib/types/events-module/EventsController.d.ts +0 -11
  97. package/lib/types/events-module/constant.d.ts +0 -1
  98. package/lib/types/events-module/index.d.ts +0 -2
  99. package/lib/types/events-module/utils.d.ts +0 -1
  100. package/lib/types/factory/NestBootstraper.d.ts +0 -224
  101. package/lib/types/factory/errors/cors.d.ts +0 -4
  102. package/lib/types/factory/errors/index.d.ts +0 -1
  103. package/lib/types/factory/errors/throttling.d.ts +0 -4
  104. package/lib/types/factory/exceptions/DecafErrorFilter.d.ts +0 -4
  105. package/lib/types/factory/exceptions/decorators.d.ts +0 -2
  106. package/lib/types/factory/exceptions/index.d.ts +0 -2
  107. package/lib/types/factory/index.d.ts +0 -4
  108. package/lib/types/factory/openapi/DtoBuilder.d.ts +0 -25
  109. package/lib/types/factory/openapi/SwaggerBuilder.d.ts +0 -10
  110. package/lib/types/factory/openapi/SwaggerCustomUI.d.ts +0 -22
  111. package/lib/types/factory/openapi/constants.d.ts +0 -27
  112. package/lib/types/factory/openapi/index.d.ts +0 -2
  113. package/lib/types/index.d.ts +0 -43
  114. package/lib/types/interceptors/AuthInterceptor.d.ts +0 -10
  115. package/lib/types/interceptors/DecafRequestHandlerInterceptor.d.ts +0 -57
  116. package/lib/types/interceptors/context.d.ts +0 -6
  117. package/lib/types/interceptors/index.d.ts +0 -3
  118. package/lib/types/module.d.ts +0 -8
  119. package/lib/types/overrides/Adapter.d.ts +0 -13
  120. package/lib/types/overrides/ModelBuilderExtensions.d.ts +0 -8
  121. package/lib/types/overrides/constants.d.ts +0 -21
  122. package/lib/types/overrides/decoration.d.ts +0 -30
  123. package/lib/types/overrides/helpers.d.ts +0 -11
  124. package/lib/types/overrides/index.d.ts +0 -6
  125. package/lib/types/overrides/overrides.d.ts +0 -1
  126. package/lib/types/ram/RamRequestTransformer.d.ts +0 -5
  127. package/lib/types/ram/index.d.ts +0 -1
  128. package/lib/types/request/DecafAuthHandler.d.ts +0 -10
  129. package/lib/types/request/DecafHandlerExecutor.d.ts +0 -52
  130. package/lib/types/request/DecafRequestContext.d.ts +0 -11
  131. package/lib/types/request/DecafResponseInterceptor.d.ts +0 -8
  132. package/lib/types/request/index.d.ts +0 -4
  133. package/lib/types/types.d.ts +0 -88
  134. package/lib/types/utils.d.ts +0 -2
@@ -1,224 +0,0 @@
1
- import { INestApplication, Logger, NestInterceptor, PipeTransform } from "@nestjs/common";
2
- /**
3
- * @description
4
- * Defines all customizable parameters for Swagger setup.
5
- *
6
- * @summary
7
- * This interface allows developers to customize how Swagger UI is configured
8
- * within the NestJS application. It includes parameters for titles, paths,
9
- * color schemes, and asset paths to tailor the API documentation experience.
10
- *
11
- * @param {string} title - Title displayed in Swagger UI.
12
- * @param {string} description - Description shown below the title.
13
- * @param {string} version - API version displayed in the documentation.
14
- * @param {string} [path] - Optional path where Swagger will be available.
15
- * @param {boolean} [persistAuthorization] - Whether authorization tokens persist across reloads.
16
- * @param {string} [assetsPath] - Path to custom assets for Swagger UI.
17
- * @param {string} [topbarBgColor] - Custom background color for the Swagger top bar.
18
- * @param {string} [topbarIconPath] - Path to a custom icon displayed in the top bar.
19
- * @param {string} [faviconPath] - Path to a custom favicon.
20
- */
21
- export interface SwaggerSetupOptions {
22
- title: string;
23
- description: string;
24
- version: string;
25
- path?: string;
26
- persistAuthorization?: boolean;
27
- assetsPath?: string;
28
- topbarBgColor?: string;
29
- topbarIconPath?: string;
30
- faviconPath?: string;
31
- /**
32
- * Path to expose the OpenAPI specification in JSON format.
33
- * Example: /api/openapi.json
34
- */
35
- openApiJsonPath?: string;
36
- /**
37
- * Path to expose the OpenAPI specification in YAML format.
38
- * Requires 'yaml' package as peer dependency.
39
- * Example: /api/openapi.yaml
40
- */
41
- openApiYamlPath?: string;
42
- }
43
- /**
44
- * @description
45
- * A fluent, static bootstrap class for initializing and configuring a NestJS application.
46
- *
47
- * @summary
48
- * The `NestBootstraper` class provides a chainable API for configuring
49
- * a NestJS application instance. It includes built-in methods for enabling
50
- * CORS, Helmet security, Swagger documentation, global pipes, filters,
51
- * interceptors, and starting the server.
52
- *
53
- * This class promotes consistency and reduces repetitive setup code
54
- * across multiple NestJS projects.
55
- *
56
- * @example
57
- * ```ts
58
- * import { NestFactory } from "@nestjs/core";
59
- * import { AppModule } from "./app.module";
60
- * import { MyLogger } from "./MyLogger";
61
- * import { NestBootstraper } from "@decaf-ts/for-nest";
62
- *
63
- * async function bootstrap() {
64
- * const app = await NestFactory.create(AppModule);
65
- *
66
- * await NestBootstraper
67
- * .initialize(app)
68
- * .enableLogger(new MyLogger())
69
- * .enableCors(["http://localhost:4200"])
70
- * .useHelmet()
71
- * .setupSwagger({
72
- * title: "OpenAPI by TradeMark™",
73
- * description: "TradeMark™ API documentation",
74
- * version: "1.0.0",
75
- * path: "api",
76
- * persistAuthorization: true,
77
- * topbarBgColor: "#2C3E50",
78
- * topbarIconPath: "/assets/logo.svg",
79
- * faviconPath: "/assets/favicon.ico"
80
- * })
81
- * .useGlobalFilters()
82
- * .useGlobalPipes(...)
83
- * .useGlobalInterceptors(...)
84
- * .start(3000);
85
- * }
86
- *
87
- * bootstrap();
88
- * ```
89
- * @class
90
- */
91
- export declare class NestBootstraper {
92
- private static app;
93
- private static _logger;
94
- /**
95
- * @description
96
- * Returns the current logger instance, creating a default one if not set.
97
- *
98
- * @summary
99
- * Ensures that a valid `Logger` instance is always available
100
- * for logging bootstrap-related messages.
101
- *
102
- * @return {Logger} The active logger instance.
103
- */
104
- private static get logger();
105
- /**
106
- * @description
107
- * Initializes the bootstrapper with a given NestJS application.
108
- *
109
- * @summary
110
- * Binds the provided NestJS app instance to the bootstrapper, enabling
111
- * chained configuration methods.
112
- *
113
- * @param {INestApplication} app - The NestJS application instance to initialize.
114
- * @return {NestBootstraper} Returns the class for chaining configuration methods.
115
- */
116
- static initialize(app: INestApplication): typeof NestBootstraper;
117
- /**
118
- * @description
119
- * Enables or replaces the global logger for the NestJS application.
120
- *
121
- * @summary
122
- * If a custom logger is provided, it replaces the default logger. Otherwise,
123
- * a new logger named `"NestBootstrap"` is used. This logger is also registered
124
- * with the NestJS application.
125
- *
126
- * @param {Logger} [customLogger] - Optional custom logger instance.
127
- * @return {NestBootstraper} Returns the class for chaining.
128
- */
129
- static enableLogger(customLogger?: Logger): typeof NestBootstraper;
130
- /**
131
- * @description
132
- * Enables Cross-Origin Resource Sharing (CORS) for the application.
133
- *
134
- * @summary
135
- * Allows defining either a wildcard origin (`"*"`) or a list of allowed origins.
136
- * Automatically accepts local development requests and those without origin headers.
137
- * Throws a `CorsError` for unauthorized origins.
138
- *
139
- * @param {'*' | string[]} [origins=[]] - List of allowed origins or `"*"` to allow all.
140
- * @param {string[]} [allowMethods=['GET', 'POST', 'PUT', 'DELETE']] - Allowed HTTP methods.
141
- * @return {NestBootstraper} Returns the class for chaining configuration.
142
- *
143
- */
144
- static enableCors(origins?: "*" | string[], allowMethods?: string[]): typeof NestBootstraper;
145
- /**
146
- * @description
147
- * Applies the Helmet middleware for enhanced security.
148
- *
149
- * @summary
150
- * Dynamically loads the `helmet` package if available and registers it
151
- * as middleware to improve HTTP header security. If not installed, logs a warning
152
- * and continues execution without throwing errors.
153
- *
154
- * @param {Record<string, any>} [options] - Optional configuration passed to Helmet.
155
- * @return {NestBootstraper} Returns the class for chaining configuration.
156
- */
157
- static useHelmet(options?: Record<string, any>): typeof NestBootstraper;
158
- /**
159
- * @description
160
- * Configures and initializes Swagger UI for API documentation.
161
- *
162
- * @summary
163
- * Uses the `SwaggerBuilder` utility to configure API documentation
164
- * with detailed customization for title, version, paths, and colors.
165
- * Swagger is automatically exposed at the configured path.
166
- *
167
- * @param {SwaggerSetupOptions} options - Swagger configuration options.
168
- * @return {NestBootstraper} Returns the class for chaining configuration.
169
- */
170
- static setupSwagger(options: SwaggerSetupOptions): typeof NestBootstraper;
171
- /**
172
- * @description
173
- * Registers one or more global validation pipes.
174
- *
175
- * @summary
176
- * Enables request payload validation and transformation globally across
177
- * the entire NestJS application. Multiple pipes can be chained together
178
- * for modular input validation.
179
- *
180
- * @param {...PipeTransform[]} pipes - Pipe instances to register globally.
181
- * @return {NestBootstraper} Returns the class for chaining.
182
- */
183
- static useGlobalPipes(...pipes: PipeTransform[]): typeof NestBootstraper;
184
- /**
185
- * @description
186
- * Registers one or more global exception filters.
187
- *
188
- * @summary
189
- * If no filters are provided, it automatically registers a default
190
- * set of standard exception filters for common error types like
191
- * `HttpException`, `ValidationException`, `ConflictException`, and others.
192
- *
193
- * @param {...ExceptionFilter[]} filters - Optional filters to apply globally.
194
- */
195
- static useGlobalFilters(...filters: any[]): typeof NestBootstraper;
196
- /**
197
- * @description
198
- * Registers global interceptors for request and response transformation.
199
- *
200
- * @summary
201
- * Interceptors allow advanced request/response manipulation such as
202
- * serialization, logging, or transformation. Multiple interceptors
203
- * can be added for modular configuration.
204
- *
205
- * @param {...NestInterceptor[]} interceptors - Interceptor instances to register.
206
- * @return {NestBootstraper} Returns the class for chaining configuration.
207
- */
208
- static useGlobalInterceptors(...interceptors: NestInterceptor[]): typeof NestBootstraper;
209
- /**
210
- * @description
211
- * Starts the NestJS application and binds it to the given port and host.
212
- *
213
- * @summary
214
- * Listens on the specified port and optionally a host. Once started,
215
- * logs the application URL for easy access. The startup process resolves
216
- * once the application is successfully running.
217
- *
218
- * @param {number} [port=3000] - Port number to listen on.
219
- * @param {string} [host] - Optional host or IP address to bind to.
220
- * @param {boolean} [log=true] - Whether to log the application URL upon startup.
221
- * @return {Promise<void>} Resolves once the application starts successfully.
222
- */
223
- static start(port?: number, host?: string | undefined, log?: boolean): Promise<void>;
224
- }
@@ -1,4 +0,0 @@
1
- import { ForbiddenError } from "@decaf-ts/core";
2
- export declare class CorsError extends ForbiddenError {
3
- constructor(msg: string | Error);
4
- }
@@ -1 +0,0 @@
1
- export * from "./cors";
@@ -1,4 +0,0 @@
1
- import { BaseError } from "@decaf-ts/db-decorators";
2
- export declare class ToManyRequestsError extends BaseError {
3
- constructor(msg: string | Error);
4
- }
@@ -1,4 +0,0 @@
1
- import { ArgumentsHost, ExceptionFilter } from "@nestjs/common";
2
- export declare class DecafExceptionFilter implements ExceptionFilter {
3
- catch(exception: Error, host: ArgumentsHost): void;
4
- }
@@ -1,2 +0,0 @@
1
- export declare function UseDecafFilter(): MethodDecorator & ClassDecorator;
2
- export declare function UseDecafHeaders(): MethodDecorator & ClassDecorator;
@@ -1,2 +0,0 @@
1
- export * from "./DecafErrorFilter";
2
- export * from "./decorators";
@@ -1,4 +0,0 @@
1
- export * from "./errors";
2
- export * from "./exceptions";
3
- export * from "./openapi";
4
- export * from "./NestBootstraper";
@@ -1,25 +0,0 @@
1
- import { OperationKeys } from "@decaf-ts/db-decorators";
2
- import { Constructor } from "@decaf-ts/decoration";
3
- import { Model } from "@decaf-ts/decorator-validation";
4
- /**
5
- * Builds a Nest/Swagger DTO class for the given model and CRUD operation.
6
- *
7
- * Rules:
8
- * - Only CREATE and UPDATE (and their bulk variants) produce a DTO;
9
- * all other operations return the original model class unchanged.
10
- * - @generated() properties (createdAt, updatedAt, createdBy, updatedBy,
11
- * uuid, version, @composed pks, …) are **never** exposed in any DTO.
12
- * - The @pk() property:
13
- * • UPDATE – always included.
14
- * • CREATE – included only when the pk is NOT auto-generated
15
- * (checked via Model.pkProps().generated AND Model.generated()).
16
- * - Relation properties (@oneToOne, @oneToMany, …):
17
- * • CREATE – nested as DtoFor(CREATE, RelatedModel).
18
- * • UPDATE – union of DtoFor(UPDATE, RelatedModel) **or** the
19
- * related model's primary-key type (string / integer),
20
- * expressed as a Swagger oneOf.
21
- *
22
- * Metadata.properties() now returns ALL properties across the prototype chain,
23
- * so DTO inheritance is no longer needed; every DTO is a flat class.
24
- */
25
- export declare function DtoFor<M extends Model>(op: OperationKeys, model: Constructor<M>): Constructor<any>;
@@ -1,10 +0,0 @@
1
- import { INestApplication } from "@nestjs/common";
2
- import { SwaggerOptions } from "./constants";
3
- export declare class SwaggerBuilder {
4
- private readonly app;
5
- private readonly options;
6
- constructor(app: INestApplication, options: SwaggerOptions);
7
- private createDocument;
8
- private registerOpenApiRoute;
9
- setupSwagger(): void;
10
- }
@@ -1,22 +0,0 @@
1
- export interface SwaggerUIOptions {
2
- title?: string;
3
- path?: string;
4
- persistAuthorization: boolean;
5
- assetsPath?: string;
6
- faviconPath?: string;
7
- topbarIconPath?: string;
8
- topbarBgColor?: string;
9
- }
10
- export declare class SwaggerCustomUI {
11
- readonly options: SwaggerUIOptions;
12
- constructor(options: SwaggerUIOptions);
13
- private customCSS;
14
- getCustomOptions(): {
15
- customCss: string;
16
- swaggerOptions: {
17
- persistAuthorization: boolean;
18
- };
19
- customSiteTitle: string | undefined;
20
- };
21
- b64(file: string, img?: boolean): string;
22
- }
@@ -1,27 +0,0 @@
1
- import { SecuritySchemeObject } from "@nestjs/swagger/dist/interfaces/open-api-spec.interface";
2
- import { Constructor } from "@decaf-ts/decoration";
3
- export interface SwaggerOptions {
4
- title: string;
5
- description: string;
6
- version?: string;
7
- assetsPath?: string;
8
- faviconFilePath?: string;
9
- topbarIconFilePath?: string;
10
- persistAuthorization?: boolean;
11
- path: string;
12
- auth?: SecuritySchemeObject;
13
- topbarBgColor?: string;
14
- extraModels?: Constructor[];
15
- /**
16
- * Path to expose the OpenAPI specification in JSON format.
17
- * Example: /api/openapi.json
18
- */
19
- openApiJsonPath?: string;
20
- /**
21
- * Path to expose the OpenAPI specification in YAML format.
22
- * Requires 'yaml' package as peer dependency.
23
- * Example: /api/openapi.yaml
24
- */
25
- openApiYamlPath?: string;
26
- }
27
- export declare const SWAGGER_UI_CONSTANTS: SwaggerOptions;
@@ -1,2 +0,0 @@
1
- export * from "./SwaggerBuilder";
2
- export * from "./DtoBuilder";
@@ -1,43 +0,0 @@
1
- /**
2
- * @module for-nest
3
- * @description This module serves as the main entry point for the ts-workspace library. It aggregates and exports
4
- * functionality from various submodules and utilities within the project.
5
- *
6
- * The module includes:
7
- * 1. Utility functions and types from the "./utils" directory:
8
- * - These likely contain helper functions, common types, and shared functionality used throughout the project.
9
- * - May include operations for data manipulation, type checking, or other general-purpose utilities.
10
- *
11
- * 2. A namespace and related types from the "./namespace" directory:
12
- * - This could contain domain-specific code or a collection of related functionality.
13
- * - Might include interfaces, types, or classes that represent core concepts in the library.
14
- *
15
- * 3. A VERSION constant:
16
- * - Represents the current version of the module.
17
- * - Useful for version checking and compatibility purposes.
18
- *
19
- * This structure provides a clean and organized export of the module's functionality, allowing consumers
20
- * to easily import and use specific parts of the library as needed.
21
- */
22
- import "./decoration";
23
- export * from "./decoration";
24
- export * from "./decaf-model";
25
- export * from "./factory";
26
- export * from "./interceptors";
27
- export * from "./overrides";
28
- export * from "./request";
29
- export * from "./constants";
30
- export * from "./controllers";
31
- export * from "./module";
32
- export * from "./core-module";
33
- export * from "./types";
34
- export * from "./utils";
35
- export * from "./events-module";
36
- /**
37
- * Represents the current version of the ts-workspace module.
38
- * The actual version number is replaced during the build process.
39
- * @constant
40
- * @type {string}
41
- */
42
- export declare const VERSION = "0.7.0";
43
- export declare const PACKAGE_NAME = "@decaf-ts/for-nest";
@@ -1,10 +0,0 @@
1
- import { NestInterceptor, ExecutionContext, CallHandler } from "@nestjs/common";
2
- import { Reflector } from "@nestjs/core";
3
- import { Observable } from "rxjs";
4
- import type { AuthHandler } from "../types";
5
- export declare class AuthInterceptor implements NestInterceptor {
6
- private readonly reflector;
7
- private readonly authHandler?;
8
- constructor(reflector: Reflector, authHandler?: AuthHandler | undefined);
9
- intercept(ctx: ExecutionContext, next: CallHandler): Promise<Observable<any>>;
10
- }
@@ -1,57 +0,0 @@
1
- import { CallHandler, ExecutionContext, NestInterceptor } from "@nestjs/common";
2
- import { DecafHandlerExecutor, DecafRequestContext } from "../request";
3
- import { DecafServerCtx } from "../constants";
4
- import "../overrides";
5
- /**
6
- * @description
7
- * Interceptor responsible for executing all registered Decaf request handlers
8
- * before the controller method is invoked.
9
- *
10
- * @summary
11
- * The {@link DecafRequestHandlerInterceptor} integrates the Decaf request-handling pipeline
12
- * into NestJS' interceptor mechanism. Before passing execution to the next handler in the
13
- * NestJS chain, it delegates request processing to the {@link DecafHandlerExecutor}, which
14
- * sequentially runs all registered {@link DecafRequestHandler} instances. This allows
15
- * behaviors such as authentication, logging, tenant resolution, or metadata enrichment
16
- * to occur prior to controller execution.
17
- *
18
- * @class DecafRequestHandlerInterceptor
19
- *
20
- * @example
21
- * ```ts
22
- * // Apply globally:
23
- * app.useGlobalInterceptors(new DecafRequestHandlerInterceptor(executor));
24
- *
25
- * // Or in a module:
26
- * @Module({
27
- * providers: [
28
- * DecafHandlerExecutor,
29
- * {
30
- * provide: APP_INTERCEPTOR,
31
- * useClass: DecafRequestHandlerInterceptor,
32
- * },
33
- * ],
34
- * })
35
- * export class AppModule {}
36
- * ```
37
- *
38
- * @mermaid
39
- * sequenceDiagram
40
- * participant Client
41
- * participant Interceptor
42
- * participant Executor
43
- * participant Controller
44
- *
45
- * Client->>Interceptor: HTTP Request
46
- * Interceptor->>Executor: exec(request)
47
- * Executor-->>Interceptor: handlers completed
48
- * Interceptor->>Controller: next.handle()
49
- * Controller-->>Client: Response
50
- */
51
- export declare class DecafRequestHandlerInterceptor implements NestInterceptor {
52
- protected readonly requestContext: DecafRequestContext;
53
- protected readonly executor: DecafHandlerExecutor;
54
- constructor(requestContext: DecafRequestContext, executor: DecafHandlerExecutor);
55
- protected contextualize(req: any): Promise<DecafServerCtx>;
56
- intercept(context: ExecutionContext, next: CallHandler): Promise<import("rxjs").Observable<any>>;
57
- }
@@ -1,6 +0,0 @@
1
- import { DecafServerCtx } from "../constants";
2
- import { FlagsOf } from "@decaf-ts/core";
3
- export declare abstract class RequestToContextTransformer<C extends DecafServerCtx> {
4
- abstract from(req: any, ...args: any[]): Promise<FlagsOf<C>>;
5
- }
6
- export declare function requestToContextTransformer(flavour: string): (original: any) => any;
@@ -1,3 +0,0 @@
1
- export * from "./DecafRequestHandlerInterceptor";
2
- export * from "./AuthInterceptor";
3
- export * from "./context";
@@ -1,8 +0,0 @@
1
- import { DynamicModule } from "@nestjs/common";
2
- import { DecafModuleOptions } from "./types";
3
- /**
4
- * @publicApi
5
- */
6
- export declare class DecafModule {
7
- static forRootAsync(options: DecafModuleOptions): Promise<DynamicModule>;
8
- }
@@ -1,13 +0,0 @@
1
- import "@decaf-ts/core";
2
- import type { Constructor } from "@decaf-ts/decoration";
3
- import { RequestToContextTransformer } from "../interceptors/context";
4
- import { ContextOf } from "@decaf-ts/core";
5
- declare module "@decaf-ts/core" {
6
- namespace Adapter {
7
- function transformerFor<A extends Adapter<any, any, any, any>>(adapter: A | string): Constructor<RequestToContextTransformer<ContextOf<A>>> | RequestToContextTransformer<ContextOf<A>>;
8
- function flavoursToTransform(): string[] | undefined;
9
- }
10
- interface Context {
11
- toResponse<RES = any>(res: RES): RES;
12
- }
13
- }
@@ -1,8 +0,0 @@
1
- import "@decaf-ts/decorator-validation";
2
- import { Constructor } from "@decaf-ts/decoration";
3
- declare module "@decaf-ts/decorator-validation" {
4
- interface ModelBuilder<M> {
5
- Auth(model: string | Constructor): ModelBuilder<M>;
6
- decorateClass(decorator: ClassDecorator): ModelBuilder<M>;
7
- }
8
- }
@@ -1,21 +0,0 @@
1
- export declare const DECORATORS_PREFIX = "swagger";
2
- export declare const DECORATORS: {
3
- API_OPERATION: string;
4
- API_RESPONSE: string;
5
- API_PRODUCES: string;
6
- API_CONSUMES: string;
7
- API_TAGS: string;
8
- API_CALLBACKS: string;
9
- API_PARAMETERS: string;
10
- API_HEADERS: string;
11
- API_MODEL_PROPERTIES: string;
12
- API_MODEL_PROPERTIES_ARRAY: string;
13
- API_SECURITY: string;
14
- API_EXCLUDE_ENDPOINT: string;
15
- API_EXCLUDE_CONTROLLER: string;
16
- API_EXTRA_MODELS: string;
17
- API_EXTENSION: string;
18
- API_SCHEMA: string;
19
- API_DEFAULT_GETTER: string;
20
- API_LINK: string;
21
- };
@@ -1,30 +0,0 @@
1
- import { Type } from "@nestjs/common";
2
- import type { EnumSchemaAttributes } from "@nestjs/swagger/dist/interfaces/enum-schema-attributes.interface";
3
- import type { SchemaObjectMetadata } from "@nestjs/swagger/dist/interfaces/schema-object-metadata.interface";
4
- import { type SwaggerEnumType } from "@nestjs/swagger/dist/types/swagger-enum.type";
5
- export declare const isUndefined: (obj: any) => obj is undefined;
6
- export declare function getEnumValues(enumType: SwaggerEnumType | (() => SwaggerEnumType)): string[] | number[];
7
- export declare function getEnumType(values: (string | number)[]): "string" | "number";
8
- export declare function createPropertyDecorator<T extends Record<string, any> = any>(metakey: string, metadata: T, overrideExisting?: boolean): PropertyDecorator;
9
- export type ApiPropertyCommonOptions = SchemaObjectMetadata & {
10
- "x-enumNames"?: string[];
11
- /**
12
- * Lazy function returning the type for which the decorated property
13
- * can be used as an id
14
- *
15
- * Use together with @ApiDefaultGetter on the getter route of the type
16
- * to generate OpenAPI link objects
17
- *
18
- * @see [Swagger link objects](https://swagger.io/docs/specification/links/)
19
- */
20
- link?: () => Type<unknown> | Function;
21
- };
22
- export type ApiPropertyOptions = ApiPropertyCommonOptions | (ApiPropertyCommonOptions & {
23
- enumName: string;
24
- enumSchema?: EnumSchemaAttributes;
25
- });
26
- /**
27
- * @publicApi
28
- */
29
- export declare function ApiProperty(options?: ApiPropertyOptions): PropertyDecorator;
30
- export declare function createApiPropertyDecorator(options?: ApiPropertyOptions, overrideExisting?: boolean): PropertyDecorator;
@@ -1,11 +0,0 @@
1
- export declare const isConstructor: (val: any) => boolean;
2
- export declare const METADATA_FACTORY_NAME = "_OPENAPI_METADATA_FACTORY";
3
- export declare const METHOD_METADATA = "method";
4
- export declare function createMethodDecorator<T = any>(metakey: string, metadata: T, { overrideExisting }?: {
5
- overrideExisting: boolean;
6
- }): MethodDecorator;
7
- export declare function createClassDecorator<T extends Array<any> = any>(metakey: string, metadata?: T): ClassDecorator;
8
- export declare function createPropertyDecorator<T extends Record<string, any> = any>(metakey: string, metadata: T, overrideExisting?: boolean): PropertyDecorator;
9
- export declare function createMixedDecorator<T = any>(metakey: string, metadata: T): MethodDecorator & ClassDecorator;
10
- export declare function createParamDecorator<T extends Record<string, any> = any>(metadata: T, initial: Partial<T>): MethodDecorator & ClassDecorator;
11
- export declare function getTypeIsArrayTuple(input: Function | [Function] | undefined | string | Record<string, any>, isArrayFlag: boolean): [Function | undefined, boolean];
@@ -1,6 +0,0 @@
1
- import "./overrides";
2
- export * from "./Adapter";
3
- export * from "./constants";
4
- export * from "./decoration";
5
- export * from "./overrides";
6
- export * from "./ModelBuilderExtensions";
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- import { RequestToContextTransformer } from "../interceptors/context";
2
- export declare class RamTransformer implements RequestToContextTransformer<any> {
3
- constructor();
4
- from(req: any, ..._args: any[]): Promise<any>;
5
- }
@@ -1 +0,0 @@
1
- export * from "./RamRequestTransformer";
@@ -1,10 +0,0 @@
1
- import { ExecutionContext } from "@nestjs/common";
2
- import { AuthHandler } from "../types";
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
- }