@decaf-ts/for-nest 0.1.7 → 0.1.9

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 (140) hide show
  1. package/README.md +1 -1
  2. package/dist/for-nest.cjs +1 -1
  3. package/dist/for-nest.cjs.map +1 -1
  4. package/dist/for-nest.js +1 -1
  5. package/dist/for-nest.js.map +1 -1
  6. package/lib/decaf-model/DecafModelModule.cjs +9 -4
  7. package/lib/decaf-model/DecafModelModule.d.ts +3 -3
  8. package/lib/decaf-model/DecafModelModule.js.map +1 -1
  9. package/lib/decaf-model/FromModelController.cjs +355 -53
  10. package/lib/decaf-model/FromModelController.d.ts +6 -2
  11. package/lib/decaf-model/FromModelController.js.map +1 -1
  12. package/lib/decaf-model/decorators/ApiOperationFromModel.cjs +22 -0
  13. package/lib/decaf-model/decorators/ApiOperationFromModel.d.ts +9 -0
  14. package/lib/decaf-model/decorators/ApiOperationFromModel.js.map +1 -1
  15. package/lib/decaf-model/decorators/ApiParamsFromModel.d.ts +2 -2
  16. package/lib/decaf-model/decorators/ApiParamsFromModel.js.map +1 -1
  17. package/lib/decaf-model/decorators/DecafParams.cjs +9 -1
  18. package/lib/decaf-model/decorators/DecafParams.d.ts +2 -2
  19. package/lib/decaf-model/decorators/DecafParams.js.map +1 -1
  20. package/lib/decaf-model/decorators/index.cjs +1 -0
  21. package/lib/decaf-model/decorators/index.d.ts +1 -0
  22. package/lib/decaf-model/decorators/index.js.map +1 -1
  23. package/lib/decaf-model/decorators/types.d.ts +5 -5
  24. package/lib/decaf-model/types.cjs +15 -0
  25. package/lib/decaf-model/types.d.ts +18 -0
  26. package/lib/decaf-model/types.js.map +1 -0
  27. package/lib/decaf-model/utils.cjs +67 -0
  28. package/lib/decaf-model/utils.d.ts +7 -0
  29. package/lib/decaf-model/utils.js.map +1 -0
  30. package/lib/esm/decaf-model/DecafModelModule.d.ts +3 -3
  31. package/lib/esm/decaf-model/DecafModelModule.js +9 -4
  32. package/lib/esm/decaf-model/DecafModelModule.js.map +1 -1
  33. package/lib/esm/decaf-model/FromModelController.d.ts +6 -2
  34. package/lib/esm/decaf-model/FromModelController.js +359 -57
  35. package/lib/esm/decaf-model/FromModelController.js.map +1 -1
  36. package/lib/esm/decaf-model/decorators/ApiOperationFromModel.d.ts +9 -0
  37. package/lib/esm/decaf-model/decorators/ApiOperationFromModel.js +22 -1
  38. package/lib/esm/decaf-model/decorators/ApiOperationFromModel.js.map +1 -1
  39. package/lib/esm/decaf-model/decorators/ApiParamsFromModel.d.ts +2 -2
  40. package/lib/esm/decaf-model/decorators/ApiParamsFromModel.js.map +1 -1
  41. package/lib/esm/decaf-model/decorators/DecafParams.d.ts +2 -2
  42. package/lib/esm/decaf-model/decorators/DecafParams.js +9 -1
  43. package/lib/esm/decaf-model/decorators/DecafParams.js.map +1 -1
  44. package/lib/esm/decaf-model/decorators/index.d.ts +1 -0
  45. package/lib/esm/decaf-model/decorators/index.js +1 -0
  46. package/lib/esm/decaf-model/decorators/index.js.map +1 -1
  47. package/lib/esm/decaf-model/decorators/types.d.ts +5 -5
  48. package/lib/esm/decaf-model/types.d.ts +18 -0
  49. package/lib/esm/decaf-model/types.js +11 -0
  50. package/lib/esm/decaf-model/types.js.map +1 -0
  51. package/lib/esm/decaf-model/utils.d.ts +7 -0
  52. package/lib/esm/decaf-model/utils.js +61 -0
  53. package/lib/esm/decaf-model/utils.js.map +1 -0
  54. package/lib/esm/factory/NestBootstraper.js +2 -10
  55. package/lib/esm/factory/NestBootstraper.js.map +1 -1
  56. package/lib/esm/factory/context.d.ts +0 -0
  57. package/lib/esm/factory/context.js +2 -0
  58. package/lib/esm/factory/context.js.map +1 -0
  59. package/lib/esm/factory/exceptions/DecafErrorFilter.d.ts +4 -0
  60. package/lib/esm/factory/exceptions/DecafErrorFilter.js +32 -0
  61. package/lib/esm/factory/exceptions/DecafErrorFilter.js.map +1 -0
  62. package/lib/esm/factory/exceptions/decorators.d.ts +1 -0
  63. package/lib/esm/factory/exceptions/decorators.js +6 -0
  64. package/lib/esm/factory/exceptions/decorators.js.map +1 -0
  65. package/lib/esm/factory/exceptions/index.d.ts +2 -7
  66. package/lib/esm/factory/exceptions/index.js +2 -7
  67. package/lib/esm/factory/exceptions/index.js.map +1 -1
  68. package/lib/esm/index.d.ts +1 -1
  69. package/lib/esm/index.js +1 -1
  70. package/lib/esm/interceptors/index.d.ts +1 -0
  71. package/lib/esm/interceptors/index.js +1 -0
  72. package/lib/esm/interceptors/index.js.map +1 -1
  73. package/lib/esm/module.js +5 -2
  74. package/lib/esm/module.js.map +1 -1
  75. package/lib/esm/types.d.ts +1 -0
  76. package/lib/factory/NestBootstraper.cjs +1 -9
  77. package/lib/factory/NestBootstraper.js.map +1 -1
  78. package/lib/factory/context.cjs +2 -0
  79. package/lib/factory/context.d.ts +0 -0
  80. package/lib/factory/context.js.map +1 -0
  81. package/lib/factory/exceptions/DecafErrorFilter.cjs +35 -0
  82. package/lib/factory/exceptions/DecafErrorFilter.d.ts +4 -0
  83. package/lib/factory/exceptions/DecafErrorFilter.js.map +1 -0
  84. package/lib/factory/exceptions/decorators.cjs +9 -0
  85. package/lib/factory/exceptions/decorators.d.ts +1 -0
  86. package/lib/factory/exceptions/decorators.js.map +1 -0
  87. package/lib/factory/exceptions/index.cjs +2 -7
  88. package/lib/factory/exceptions/index.d.ts +2 -7
  89. package/lib/factory/exceptions/index.js.map +1 -1
  90. package/lib/index.cjs +1 -1
  91. package/lib/index.d.ts +1 -1
  92. package/lib/interceptors/index.cjs +1 -0
  93. package/lib/interceptors/index.d.ts +1 -0
  94. package/lib/interceptors/index.js.map +1 -1
  95. package/lib/module.cjs +5 -2
  96. package/lib/module.js.map +1 -1
  97. package/lib/types.d.ts +1 -0
  98. package/package.json +3 -3
  99. package/lib/esm/factory/exceptions/AuthorizationExceptionFilter.d.ts +0 -9
  100. package/lib/esm/factory/exceptions/AuthorizationExceptionFilter.js +0 -35
  101. package/lib/esm/factory/exceptions/AuthorizationExceptionFilter.js.map +0 -1
  102. package/lib/esm/factory/exceptions/ConflictExceptionFilter.d.ts +0 -9
  103. package/lib/esm/factory/exceptions/ConflictExceptionFilter.js +0 -35
  104. package/lib/esm/factory/exceptions/ConflictExceptionFilter.js.map +0 -1
  105. package/lib/esm/factory/exceptions/GlobalExceptionFilter.d.ts +0 -4
  106. package/lib/esm/factory/exceptions/GlobalExceptionFilter.js +0 -39
  107. package/lib/esm/factory/exceptions/GlobalExceptionFilter.js.map +0 -1
  108. package/lib/esm/factory/exceptions/HttpExceptionFilter.d.ts +0 -4
  109. package/lib/esm/factory/exceptions/HttpExceptionFilter.js +0 -27
  110. package/lib/esm/factory/exceptions/HttpExceptionFilter.js.map +0 -1
  111. package/lib/esm/factory/exceptions/HttpResponseError.d.ts +0 -13
  112. package/lib/esm/factory/exceptions/HttpResponseError.js +0 -21
  113. package/lib/esm/factory/exceptions/HttpResponseError.js.map +0 -1
  114. package/lib/esm/factory/exceptions/NotFoundExceptionFilter.d.ts +0 -9
  115. package/lib/esm/factory/exceptions/NotFoundExceptionFilter.js +0 -35
  116. package/lib/esm/factory/exceptions/NotFoundExceptionFilter.js.map +0 -1
  117. package/lib/esm/factory/exceptions/ValidationExceptionFilter.d.ts +0 -9
  118. package/lib/esm/factory/exceptions/ValidationExceptionFilter.js +0 -35
  119. package/lib/esm/factory/exceptions/ValidationExceptionFilter.js.map +0 -1
  120. package/lib/factory/exceptions/AuthorizationExceptionFilter.cjs +0 -39
  121. package/lib/factory/exceptions/AuthorizationExceptionFilter.d.ts +0 -9
  122. package/lib/factory/exceptions/AuthorizationExceptionFilter.js.map +0 -1
  123. package/lib/factory/exceptions/ConflictExceptionFilter.cjs +0 -39
  124. package/lib/factory/exceptions/ConflictExceptionFilter.d.ts +0 -9
  125. package/lib/factory/exceptions/ConflictExceptionFilter.js.map +0 -1
  126. package/lib/factory/exceptions/GlobalExceptionFilter.cjs +0 -42
  127. package/lib/factory/exceptions/GlobalExceptionFilter.d.ts +0 -4
  128. package/lib/factory/exceptions/GlobalExceptionFilter.js.map +0 -1
  129. package/lib/factory/exceptions/HttpExceptionFilter.cjs +0 -30
  130. package/lib/factory/exceptions/HttpExceptionFilter.d.ts +0 -4
  131. package/lib/factory/exceptions/HttpExceptionFilter.js.map +0 -1
  132. package/lib/factory/exceptions/HttpResponseError.cjs +0 -25
  133. package/lib/factory/exceptions/HttpResponseError.d.ts +0 -13
  134. package/lib/factory/exceptions/HttpResponseError.js.map +0 -1
  135. package/lib/factory/exceptions/NotFoundExceptionFilter.cjs +0 -39
  136. package/lib/factory/exceptions/NotFoundExceptionFilter.d.ts +0 -9
  137. package/lib/factory/exceptions/NotFoundExceptionFilter.js.map +0 -1
  138. package/lib/factory/exceptions/ValidationExceptionFilter.cjs +0 -39
  139. package/lib/factory/exceptions/ValidationExceptionFilter.d.ts +0 -9
  140. package/lib/factory/exceptions/ValidationExceptionFilter.js.map +0 -1
@@ -19,3 +19,12 @@ export declare function isOperationBlocked(ModelConstructor: ModelConstructor<an
19
19
  * @return {MethodDecorator} A method decorator that either excludes the endpoint from Swagger (and route registration) or applies the correct HTTP decorator.
20
20
  */
21
21
  export declare function ApiOperationFromModel(ModelConstructor: ModelConstructor<any>, verb: HttpVerbs, path?: string): MethodDecorator;
22
+ /**
23
+ * @description Conditionally applies an HTTP method decorator for a given model and verb, hiding the endpoint in Swagger (and not registering the route) when the model blocks that CRUD operation.
24
+ * @summary Maps an HTTP verb to its corresponding `CrudOperations` key and Nest HTTP decorator (`@Get`, `@Post`, etc.). It checks `isOperationBlocked(ModelConstructor, crudOp)` and, if blocked, applies only `@ApiExcludeEndpoint()` (Swagger-hidden, no Nest route). If permitted, it applies the appropriate HTTP decorator with the optional `path`.
25
+ * @param {ModelConstructor<any>} ModelConstructor - The model constructor used to resolve operation-blocking rules.
26
+ * @param {HttpVerbs} verb - The HTTP verb to map (e.g., `"GET" | "POST" | "PUT" | "PATCH" | "DELETE"`).
27
+ * @param {string} [path] - Optional route path passed through to the corresponding Nest HTTP method decorator.
28
+ * @return {MethodDecorator} A method decorator that either excludes the endpoint from Swagger (and route registration) or applies the correct HTTP decorator.
29
+ */
30
+ export declare function BulkApiOperationFromModel(ModelConstructor: ModelConstructor<any>, verb: HttpVerbs, path?: string): MethodDecorator;
@@ -1 +1 @@
1
- {"version":3,"file":"ApiOperationFromModel.js","sourceRoot":"","sources":["../../../src/decaf-model/decorators/ApiOperationFromModel.ts"],"names":[],"mappings":";;AAgBA,gDAiBC;AAUD,sDAoBC;AA/DD,qDAAgD;AAChD,2CAA+D;AAC/D,6CAAqD;AACrD,qDAA6C;AAC7C,2DAAwE;AAIxE;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAChC,gBAAuC,EACvC,EAAkB;IAElB,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,qBAAQ,CAAC,GAAG,CACrC,gBAAuB,EACvB,6BAAa,CAAC,OAAO,GAAG,6BAAa,CAAC,KAAK,CAC5C,IAAI,EAAE,CAMN,CAAC;IAEF,+BAA+B;IAC/B,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,gBAAuC,EACvC,IAAe,EACf,IAAa;IAEb,MAAM,UAAU,GAGZ;QACF,GAAG,EAAE,CAAC,6BAAa,CAAC,IAAI,EAAE,YAAG,CAAC;QAC9B,IAAI,EAAE,CAAC,6BAAa,CAAC,MAAM,EAAE,aAAI,CAAC;QAClC,GAAG,EAAE,CAAC,6BAAa,CAAC,MAAM,EAAE,YAAG,CAAC;QAChC,KAAK,EAAE,CAAC,6BAAa,CAAC,MAAM,EAAE,cAAK,CAAC;QACpC,MAAM,EAAE,CAAC,6BAAa,CAAC,MAAM,EAAE,eAAM,CAAC;KACvC,CAAC;IAEF,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IACvD,OAAO,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,CAAC;QACjD,CAAC,CAAC,IAAA,kBAAK,EAAC,IAAA,4BAAkB,GAAE,CAAC;QAC7B,CAAC,CAAC,IAAA,kBAAK,EAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC"}
1
+ {"version":3,"file":"ApiOperationFromModel.js","sourceRoot":"","sources":["../../../src/decaf-model/decorators/ApiOperationFromModel.ts"],"names":[],"mappings":";;AAoBA,gDAiBC;AAUD,sDAoBC;AASD,8DAoBC;AAhGD,qDAAgD;AAChD,2CAA+D;AAC/D,6CAAqD;AACrD,qDAA6C;AAC7C,2DAIiC;AAIjC;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAChC,gBAAuC,EACvC,EAAkB;IAElB,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,qBAAQ,CAAC,GAAG,CACrC,gBAAuB,EACvB,6BAAa,CAAC,OAAO,GAAG,6BAAa,CAAC,KAAK,CAC5C,IAAI,EAAE,CAMN,CAAC;IAEF,+BAA+B;IAC/B,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,gBAAuC,EACvC,IAAe,EACf,IAAa;IAEb,MAAM,UAAU,GAGZ;QACF,GAAG,EAAE,CAAC,6BAAa,CAAC,IAAI,EAAE,YAAG,CAAC;QAC9B,IAAI,EAAE,CAAC,6BAAa,CAAC,MAAM,EAAE,aAAI,CAAC;QAClC,GAAG,EAAE,CAAC,6BAAa,CAAC,MAAM,EAAE,YAAG,CAAC;QAChC,KAAK,EAAE,CAAC,6BAAa,CAAC,MAAM,EAAE,cAAK,CAAC;QACpC,MAAM,EAAE,CAAC,6BAAa,CAAC,MAAM,EAAE,eAAM,CAAC;KACvC,CAAC;IAEF,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IACvD,OAAO,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,CAAC;QACjD,CAAC,CAAC,IAAA,kBAAK,EAAC,IAAA,4BAAkB,GAAE,CAAC;QAC7B,CAAC,CAAC,IAAA,kBAAK,EAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC;AACD;;;;;;;GAOG;AACH,SAAgB,yBAAyB,CACvC,gBAAuC,EACvC,IAAe,EACf,IAAa;IAEb,MAAM,UAAU,GAGZ;QACF,GAAG,EAAE,CAAC,qCAAqB,CAAC,QAAQ,EAAE,YAAG,CAAC;QAC1C,IAAI,EAAE,CAAC,qCAAqB,CAAC,UAAU,EAAE,aAAI,CAAC;QAC9C,GAAG,EAAE,CAAC,qCAAqB,CAAC,UAAU,EAAE,YAAG,CAAC;QAC5C,KAAK,EAAE,CAAC,qCAAqB,CAAC,UAAU,EAAE,cAAK,CAAC;QAChD,MAAM,EAAE,CAAC,qCAAqB,CAAC,UAAU,EAAE,eAAM,CAAC;KACnD,CAAC;IAEF,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IACvD,OAAO,kBAAkB,CAAC,gBAAgB,EAAE,MAAa,CAAC;QACxD,CAAC,CAAC,IAAA,kBAAK,EAAC,IAAA,4BAAkB,GAAE,CAAC;QAC7B,CAAC,CAAC,IAAA,kBAAK,EAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { DecafApiProperties } from "./types";
1
+ import type { DecafApiProperty } from "./types";
2
2
  /**
3
3
  * @description Applies a set of Swagger `@ApiParam` decorators generated from a typed specification array.
4
4
  * @summary Transforms each entry of the provided `ApiParam[]` into a corresponding `@ApiParam()` decorator (defaulting `description`, `required`, and `type` when omitted) and composes them into a single decorator via Nest's `applyDecorators`. Useful for synchronizing runtime route params with OpenAPI documentation in a concise, declarative way.
@@ -10,4 +10,4 @@ import type { DecafApiProperties } from "./types";
10
10
  * @return {any} A composed decorator applying all generated `@ApiParam` decorators to the target method or controller.
11
11
  * @function ApiParamsFromModel
12
12
  */
13
- export declare function ApiParamsFromModel(props?: DecafApiProperties[]): MethodDecorator & ClassDecorator;
13
+ export declare function ApiParamsFromModel(props?: DecafApiProperty[]): MethodDecorator & ClassDecorator;
@@ -1 +1 @@
1
- {"version":3,"file":"ApiParamsFromModel.js","sourceRoot":"","sources":["../../../src/decaf-model/decorators/ApiParamsFromModel.ts"],"names":[],"mappings":";;AAeA,gDAaC;AA5BD,2CAAiD;AACjD,6CAA0D;AAG1D;;;;;;;;;;GAUG;AACH,SAAgB,kBAAkB,CAChC,QAA8B,EAAE;IAEhC,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACjC,IAAA,kBAAW,EAAC;QACV,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,WAAW,EAAE,CAAC,CAAC,WAAW,IAAI,mBAAmB,CAAC,CAAC,IAAI,EAAE;QACzD,QAAQ,EAAE,CAAC,CAAC,QAAQ,IAAI,IAAI;QAC5B,8BAA8B;QAC9B,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,MAAM;KACvB,CAAC,CACH,CAAC;IACF,OAAO,IAAA,wBAAe,EAAC,GAAG,UAAU,CAAC,CAAC;AACxC,CAAC"}
1
+ {"version":3,"file":"ApiParamsFromModel.js","sourceRoot":"","sources":["../../../src/decaf-model/decorators/ApiParamsFromModel.ts"],"names":[],"mappings":";;AAeA,gDAaC;AA5BD,2CAAiD;AACjD,6CAA0D;AAG1D;;;;;;;;;;GAUG;AACH,SAAgB,kBAAkB,CAChC,QAA4B,EAAE;IAE9B,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACjC,IAAA,kBAAW,EAAC;QACV,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,WAAW,EAAE,CAAC,CAAC,WAAW,IAAI,mBAAmB,CAAC,CAAC,IAAI,EAAE;QACzD,QAAQ,EAAE,CAAC,CAAC,QAAQ,IAAI,IAAI;QAC5B,8BAA8B;QAC9B,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,MAAM;KACvB,CAAC,CACH,CAAC;IACF,OAAO,IAAA,wBAAe,EAAC,GAAG,UAAU,CAAC,CAAC;AACxC,CAAC"}
@@ -19,7 +19,7 @@ const OrderedParams = (0, common_1.createParamDecorator)((order, ctx) => {
19
19
  const original = (req?.params ?? {});
20
20
  const orderList = order ?? Object.keys(original);
21
21
  const ordered = orderList.map((k) => original[k]);
22
- return { original, ordered, order: orderList };
22
+ return { raw: original, valuesInOrder: ordered, keysInOrder: orderList };
23
23
  });
24
24
  /**
25
25
  * @description A higher-level decorator factory that leverages `OrderedParams` to extract route parameters in a specific order derived from a list of `ApiParam` definitions.
@@ -31,4 +31,12 @@ function DecafParams(props = []) {
31
31
  const order = props.map((p) => p.name);
32
32
  return OrderedParams(order);
33
33
  }
34
+ //
35
+ // export function Ctx(){
36
+ // return createParamDecorator((data: unknown, ctx: ExecutionContext) => {
37
+ // const req = ctx.switchToHttp().getRequest();
38
+ //
39
+ // const Context.args
40
+ // })
41
+ // }
34
42
  //# sourceMappingURL=DecafParams.js.map
@@ -1,8 +1,8 @@
1
- import { DecafApiProperties } from "./types";
1
+ import { DecafApiProperty } from "./types";
2
2
  /**
3
3
  * @description A higher-level decorator factory that leverages `OrderedParams` to extract route parameters in a specific order derived from a list of `ApiParam` definitions.
4
4
  * @summary `DecafParams` computes the order of route parameters based on the provided `ApiParam[]` specification (using each element’s `name`), then applies `OrderedParams(order)` as a parameter decorator. This enables parameter-level binding that remains consistent with the documented API parameter metadata.
5
5
  * @param {ApiParam[]} [props=[]] Array of `ApiParam` definitions whose `name` fields determine the parameter extraction order.
6
6
  * @return {ParameterDecorator} A NestJS parameter decorator that injects an ordered list of parameters and metadata into the controller method argument.
7
7
  */
8
- export declare function DecafParams(props?: DecafApiProperties[]): ParameterDecorator;
8
+ export declare function DecafParams(props?: DecafApiProperty[]): ParameterDecorator;
@@ -1 +1 @@
1
- {"version":3,"file":"DecafParams.js","sourceRoot":"","sources":["../../../src/decaf-model/decorators/DecafParams.ts"],"names":[],"mappings":";;AA8BA,kCAKC;AAnCD,2CAAwE;AAExE;;;;;;;;;;;GAWG;AACH,MAAM,aAAa,GAAG,IAAA,6BAAoB,EACxC,CAAC,KAA2B,EAAE,GAAqB,EAAmB,EAAE;IACtE,MAAM,GAAG,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAC5C,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,MAAM,IAAI,EAAE,CAAwB,CAAC;IAC5D,MAAM,SAAS,GAAG,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AACjD,CAAC,CACF,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,WAAW,CACzB,QAA8B,EAAE;IAEhC,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC"}
1
+ {"version":3,"file":"DecafParams.js","sourceRoot":"","sources":["../../../src/decaf-model/decorators/DecafParams.ts"],"names":[],"mappings":";;AA8BA,kCAKC;AAnCD,2CAAwE;AAExE;;;;;;;;;;;GAWG;AACH,MAAM,aAAa,GAAG,IAAA,6BAAoB,EACxC,CAAC,KAA2B,EAAE,GAAqB,EAAmB,EAAE;IACtE,MAAM,GAAG,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAC5C,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,MAAM,IAAI,EAAE,CAAwB,CAAC;IAC5D,MAAM,SAAS,GAAG,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;AAC3E,CAAC,CACF,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,WAAW,CACzB,QAA4B,EAAE;IAE9B,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AACD,EAAE;AACF,yBAAyB;AACzB,4EAA4E;AAC5E,mDAAmD;AACnD,EAAE;AACF,yBAAyB;AACzB,OAAO;AACP,IAAI"}
@@ -18,4 +18,5 @@ __exportStar(require("./types.cjs"), exports);
18
18
  __exportStar(require("./ApiOperationFromModel.cjs"), exports);
19
19
  __exportStar(require("./ApiParamsFromModel.cjs"), exports);
20
20
  __exportStar(require("./DecafParams.cjs"), exports);
21
+ __exportStar(require("./decorators.cjs"), exports);
21
22
  //# sourceMappingURL=index.js.map
@@ -2,3 +2,4 @@ export * from "./types";
2
2
  export * from "./ApiOperationFromModel";
3
3
  export * from "./ApiParamsFromModel";
4
4
  export * from "./DecafParams";
5
+ export * from "./decorators";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decaf-model/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAAwB;AACxB,8DAAwC;AACxC,2DAAqC;AACrC,oDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decaf-model/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAAwB;AACxB,8DAAwC;AACxC,2DAAqC;AACrC,oDAA8B;AAC9B,mDAA6B"}
@@ -1,5 +1,5 @@
1
1
  export type HttpVerbs = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
2
- export type DecafApiProperties = {
2
+ export type DecafApiProperty = {
3
3
  name: string;
4
4
  description?: string;
5
5
  required?: boolean;
@@ -8,11 +8,11 @@ export type DecafApiProperties = {
8
8
  export type DecafModelRoute = {
9
9
  path: string;
10
10
  description?: string;
11
- apiProperties: DecafApiProperties[];
11
+ apiProperties: DecafApiProperty[];
12
12
  getPK: (...args: Array<string | number>) => string;
13
13
  };
14
14
  export type DecafParamProps = {
15
- original: Record<string, any>;
16
- ordered: any[];
17
- order: string[];
15
+ raw: Record<string, string | number>;
16
+ keysInOrder: Array<string>;
17
+ valuesInOrder: Array<string | number>;
18
18
  };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbstractQueryController = void 0;
4
+ const logging_1 = require("@decaf-ts/logging");
5
+ class AbstractQueryController extends logging_1.LoggedClass {
6
+ constructor(clientContext) {
7
+ super();
8
+ this.clientContext = clientContext;
9
+ }
10
+ get persistence() {
11
+ throw new Error("Not implemented");
12
+ }
13
+ }
14
+ exports.AbstractQueryController = AbstractQueryController;
15
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,18 @@
1
+ import { ModelService, Repo } from "@decaf-ts/core";
2
+ import { LoggedClass, Logger } from "@decaf-ts/logging";
3
+ import { DecafRequestContext } from "../request/index";
4
+ export interface Controller {
5
+ log: Logger;
6
+ persistence: Repo<any> | ModelService<any>;
7
+ }
8
+ export declare abstract class AbstractQueryController extends LoggedClass {
9
+ protected readonly clientContext: DecafRequestContext;
10
+ protected _persistence: Repo<any> | ModelService<any>;
11
+ protected constructor(clientContext: DecafRequestContext);
12
+ get persistence(): Repo<any> | ModelService<any>;
13
+ }
14
+ export type ControllerConstructor<T> = new (...args: any[]) => T;
15
+ export type DecoratorBundle = {
16
+ method: MethodDecorator[];
17
+ params?: ParameterDecorator[];
18
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/decaf-model/types.ts"],"names":[],"mappings":";;;AACA,+CAAwD;AAQxD,MAAsB,uBAAwB,SAAQ,qBAAW;IAI/D,YAAsB,aAAkC;QACtD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED,IAAI,WAAW;QACb,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;CACF;AAZD,0DAYC"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getApiDecorators = getApiDecorators;
4
+ exports.applyApiDecorators = applyApiDecorators;
5
+ exports.createRouteHandler = createRouteHandler;
6
+ exports.defineRouteMethod = defineRouteMethod;
7
+ const common_1 = require("@nestjs/common");
8
+ const swagger_1 = require("@nestjs/swagger");
9
+ const decorators_1 = require("./decorators/index.cjs");
10
+ const extractPathParams = (routePath) => {
11
+ return routePath
12
+ .split("/")
13
+ .filter((p) => p.startsWith(":"))
14
+ .map((p) => p.slice(1));
15
+ };
16
+ const apiParamSpec = (name) => ({
17
+ name,
18
+ description: `${name} parameter for the query`,
19
+ required: true,
20
+ type: String,
21
+ });
22
+ function getApiDecorators(methodName, routePath) {
23
+ const apiPathParams = extractPathParams(routePath).map(apiParamSpec);
24
+ return {
25
+ method: [
26
+ (0, common_1.Get)(routePath),
27
+ ...apiPathParams.map(swagger_1.ApiParam),
28
+ (0, swagger_1.ApiOperation)({
29
+ summary: `Retrieve records using custom query "${methodName}".`,
30
+ }),
31
+ (0, swagger_1.ApiOkResponse)({
32
+ description: `Results successfully retrieved.`,
33
+ }),
34
+ (0, swagger_1.ApiNoContentResponse)({
35
+ description: `No content returned by the query.`,
36
+ }),
37
+ ],
38
+ params: [(0, decorators_1.DecafParams)(apiPathParams), (0, common_1.Query)()],
39
+ };
40
+ }
41
+ function applyApiDecorators(target, methodName, descriptor, decorators) {
42
+ const proto = target?.prototype ?? target;
43
+ decorators.method.forEach((d) => d(proto, methodName, descriptor));
44
+ decorators.params?.forEach((d, index) => d(proto, methodName, index));
45
+ }
46
+ function createRouteHandler(methodName) {
47
+ return async function (pathParams, queryParams) {
48
+ const log = this.log.for(methodName);
49
+ try {
50
+ log.debug(`Invoking persistence method "${methodName}" given parameters: ${JSON.stringify(pathParams.valuesInOrder)}`);
51
+ const { direction, limit, offset } = queryParams;
52
+ return (await this.persistence[methodName](...pathParams.valuesInOrder, direction, limit, offset));
53
+ }
54
+ catch (e) {
55
+ log.error(`Custom query "${methodName}" failed`, e);
56
+ throw e;
57
+ }
58
+ };
59
+ }
60
+ function defineRouteMethod(ControllerClass, methodName, handler) {
61
+ Object.defineProperty(ControllerClass.prototype || ControllerClass, methodName, {
62
+ value: handler,
63
+ writable: false,
64
+ });
65
+ return Object.getOwnPropertyDescriptor(ControllerClass.prototype || ControllerClass, methodName);
66
+ }
67
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,7 @@
1
+ import { Controller, type DecoratorBundle } from "./types";
2
+ import { type DecafParamProps } from "./decorators";
3
+ import { DirectionLimitOffset } from "@decaf-ts/core";
4
+ export declare function getApiDecorators(methodName: string, routePath: string): DecoratorBundle;
5
+ export declare function applyApiDecorators(target: any, methodName: string, descriptor: PropertyDescriptor, decorators: DecoratorBundle): void;
6
+ export declare function createRouteHandler<T>(methodName: string): (this: Controller, pathParams: DecafParamProps, queryParams: DirectionLimitOffset) => Promise<T>;
7
+ export declare function defineRouteMethod(ControllerClass: new (...args: any[]) => any, methodName: string, handler: (...args: any[]) => any): PropertyDescriptor | undefined;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/decaf-model/utils.ts"],"names":[],"mappings":";;AA8BA,4CAqBC;AAED,gDASC;AAED,gDAwBC;AAED,8CAkBC;AA5GD,2CAA4C;AAG5C,6CAKyB;AACzB,uDAIsB;AAGtB,MAAM,iBAAiB,GAAG,CAAC,SAAiB,EAAY,EAAE;IACxD,OAAO,SAAS;SACb,KAAK,CAAC,GAAG,CAAC;SACV,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;SAChC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,IAAY,EAAoB,EAAE,CAAC,CAAC;IACxD,IAAI;IACJ,WAAW,EAAE,GAAG,IAAI,0BAA0B;IAC9C,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,MAAM;CACb,CAAC,CAAC;AAEH,SAAgB,gBAAgB,CAC9B,UAAkB,EAClB,SAAiB;IAEjB,MAAM,aAAa,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACrE,OAAO;QACL,MAAM,EAAE;YACN,IAAA,YAAG,EAAC,SAAS,CAAC;YACd,GAAG,aAAa,CAAC,GAAG,CAAC,kBAAQ,CAAC;YAC9B,IAAA,sBAAY,EAAC;gBACX,OAAO,EAAE,wCAAwC,UAAU,IAAI;aAChE,CAAC;YACF,IAAA,uBAAa,EAAC;gBACZ,WAAW,EAAE,iCAAiC;aAC/C,CAAC;YACF,IAAA,8BAAoB,EAAC;gBACnB,WAAW,EA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,CAAC;AACJ,CAAC;AAED,SAAgB,iBAAiB,CAC/B,eAA4C,EAC5C,UAAkB,EAClB,OAAgC;IAEhC,MAAM,CAAC,cAAc,CACnB,eAAe,CAAC,SAAS,IAAI,eAAe,EAC5C,UAAU,EACV;QACE,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,KAAK;KAChB,CACF,CAAC;IAEF,OAAO,MAAM,CAAC,wBAAwB,CACpC,eAAe,CAAC,SAAS,IAAI,eAAe,EAC5C,UAAU,CACX,CAAC;AACJ,CAAC"}
@@ -1,7 +1,7 @@
1
- import { DynamicModule, Type } from "@nestjs/common";
2
- import { type DecafRequestHandler } from "../types";
1
+ import { DynamicModule } from "@nestjs/common";
2
+ import { DecafModuleOptions } from "../types";
3
3
  export declare class DecafModelModule {
4
4
  private static readonly log;
5
5
  private static createModelServices;
6
- static forRoot(flavour: string, handlers?: Type<DecafRequestHandler>[]): DynamicModule;
6
+ static forRoot(flavour: string, options?: Partial<DecafModuleOptions>): DynamicModule;
7
7
  }
@@ -22,11 +22,16 @@ let DecafModelModule = class DecafModelModule {
22
22
  useFactory: () => ModelService.forModel(model),
23
23
  }));
24
24
  }
25
- static forRoot(flavour, handlers = []) {
25
+ static forRoot(flavour, options = {}) {
26
26
  const log = this.log.for(this.forRoot);
27
27
  log.info(`Generating controllers for flavour...`);
28
28
  const trackedModels = Adapter.models(flavour);
29
- const modelServices = this.createModelServices(trackedModels);
29
+ let modelServices = [];
30
+ if (options.autoServices) {
31
+ log.info("Auto-services enabled. Initializing service generation.");
32
+ modelServices = this.createModelServices(trackedModels);
33
+ log.info(`Auto-services completed. ${modelServices.length} services initialized.`);
34
+ }
30
35
  const controllers = trackedModels.map(FromModelController.create);
31
36
  log.info(`Generated ${controllers.length} controllers`);
32
37
  return {
@@ -36,10 +41,10 @@ let DecafModelModule = class DecafModelModule {
36
41
  {
37
42
  provide: DECAF_HANDLERS,
38
43
  useFactory: () => {
39
- return handlers.map((H) => {
44
+ return (options.handlers?.map((H) => {
40
45
  log.info(`Registered request handler: ${H.name}`);
41
46
  return new H();
42
- });
47
+ }) ?? []);
43
48
  },
44
49
  },
45
50
  DecafRequestContext,
@@ -1 +1 @@
1
- {"version":3,"file":"DecafModelModule.js","sourceRoot":"","sources":["../../../src/decaf-model/DecafModelModule.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAiB,MAAM,EAAkB,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAW,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,iCAA8B;AAC5D,OAAO,EAAE,8BAA8B,EAAE,mCAAwB;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,8BAAmB;AACvE,OAAO,EAAE,cAAc,EAAE,0BAAqB;AAGvC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;;aACH,QAAG,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAgB,CAAC,IAAI,CAAC,AAArC,CAAsC;IAEzD,MAAM,CAAC,mBAAmB,CAAC,MAAa;QAC9C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC5B,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,SAAS;YAC/B,UAAU,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC;SAC/C,CAAC,CAAC,CAAC;IACN,CAAC;IAED,MAAM,CAAC,OAAO,CACZ,OAAe,EACf,WAAwC,EAAE;QAE1C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvC,GAAG,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;QAElD,MAAM,aAAa,GAAG,OAAO,CAAC,M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oBACE,OAAO,EAAE,cAAc;oBACvB,UAAU,EAAE,GAAG,EAAE;wBACf,OAAO,CACL,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;4BAC1B,GAAG,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;4BAClD,OAAO,IAAI,CAAC,EAAE,CAAC;wBACjB,CAAC,CAAC,IAAI,EAAE,CACT,CAAC;oBACJ,CAAC;iBACF;gBACD,mBAAmB;gBACnB,oBAAoB;gBACpB;oBACE,OAAO,EAAE,eAAe;oBACxB,QAAQ,EAAE,8BAA8B;iBACzC;gBACD,GAAG,aAAa;aACjB;SACF,CAAC;IACJ,CAAC;;AAzDU,gBAAgB;IAD5B,MAAM,CAAC,EAAE,CAAC;GACE,gBAAgB,CA0D5B"}
@@ -1,5 +1,7 @@
1
+ import { ModelService, type Repo } from "@decaf-ts/core";
1
2
  import { Model, ModelConstructor } from "@decaf-ts/decorator-validation";
2
- import type { DecafModelRoute } from "./decorators";
3
+ import { type DecafModelRoute } from "./decorators";
4
+ import { AbstractQueryController, ControllerConstructor } from "./types";
3
5
  /**
4
6
  * @description
5
7
  * Factory and utilities for generating dynamic NestJS controllers from Decaf {@link Model} definitions.
@@ -51,6 +53,8 @@ import type { DecafModelRoute } from "./decorators";
51
53
  */
52
54
  export declare class FromModelController {
53
55
  private static readonly log;
54
- static create<T extends Model<any>>(ModelClazz: ModelConstructor<T>): any;
56
+ static getPersistence<T extends Model<boolean>>(ModelClazz: ModelConstructor<T>): Repo<T> | ModelService<T>;
57
+ static createQueryRoutesFromRepository<T extends Model<boolean>>(persistence: Repo<T> | ModelService<T>, prefix?: string): ControllerConstructor<AbstractQueryController>;
58
+ static create<T extends Model<any>>(ModelConstr: ModelConstructor<T>): any;
55
59
  static getRouteParametersFromModel<T extends Model<any>>(ModelClazz: ModelConstructor<T>): DecafModelRoute;
56
60
  }