@decaf-ts/for-nest 0.6.0 → 0.7.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 (298) hide show
  1. package/lib/cjs/bin/cli.cjs +3 -2
  2. package/lib/cjs/bin/cli.cjs.map +1 -0
  3. package/lib/cjs/cli-module.cjs +2 -1
  4. package/lib/cjs/cli-module.cjs.map +1 -0
  5. package/lib/cjs/constants.cjs +1 -0
  6. package/lib/cjs/constants.cjs.map +1 -0
  7. package/lib/cjs/controllers.cjs +3 -2
  8. package/lib/cjs/controllers.cjs.map +1 -0
  9. package/lib/cjs/core-module.cjs +31 -25
  10. package/lib/cjs/core-module.cjs.map +1 -0
  11. package/lib/cjs/decaf-model/DecafModelModule.cjs +11 -6
  12. package/lib/cjs/decaf-model/DecafModelModule.cjs.map +1 -0
  13. package/lib/cjs/decaf-model/FromModelController.cjs +69 -63
  14. package/lib/cjs/decaf-model/FromModelController.cjs.map +1 -0
  15. package/lib/cjs/decaf-model/decorators/ApiOperationFromModel.cjs +1 -0
  16. package/lib/cjs/decaf-model/decorators/ApiOperationFromModel.cjs.map +1 -0
  17. package/lib/cjs/decaf-model/decorators/ApiParamsFromModel.cjs +1 -0
  18. package/lib/cjs/decaf-model/decorators/ApiParamsFromModel.cjs.map +1 -0
  19. package/lib/cjs/decaf-model/decorators/DecafBody.cjs +1 -0
  20. package/lib/cjs/decaf-model/decorators/DecafBody.cjs.map +1 -0
  21. package/lib/cjs/decaf-model/decorators/DecafParams.cjs +1 -0
  22. package/lib/cjs/decaf-model/decorators/DecafParams.cjs.map +1 -0
  23. package/lib/cjs/decaf-model/decorators/decorators.cjs +5 -4
  24. package/lib/cjs/decaf-model/decorators/decorators.cjs.map +1 -0
  25. package/lib/cjs/decaf-model/decorators/index.cjs +1 -0
  26. package/lib/cjs/decaf-model/decorators/index.cjs.map +1 -0
  27. package/lib/cjs/decaf-model/decorators/types.cjs +1 -0
  28. package/lib/cjs/decaf-model/decorators/types.cjs.map +1 -0
  29. package/lib/cjs/decaf-model/decorators/utils.cjs +1 -0
  30. package/lib/cjs/decaf-model/decorators/utils.cjs.map +1 -0
  31. package/lib/cjs/decaf-model/index.cjs +1 -0
  32. package/lib/cjs/decaf-model/index.cjs.map +1 -0
  33. package/lib/cjs/decaf-model/types.cjs +1 -0
  34. package/lib/cjs/decaf-model/types.cjs.map +1 -0
  35. package/lib/cjs/decaf-model/utils.cjs +5 -4
  36. package/lib/cjs/decaf-model/utils.cjs.map +1 -0
  37. package/lib/cjs/decoration.cjs +15 -14
  38. package/lib/cjs/decoration.cjs.map +1 -0
  39. package/lib/cjs/events-module/DecafStreamModule.cjs +15 -10
  40. package/lib/cjs/events-module/DecafStreamModule.cjs.map +1 -0
  41. package/lib/cjs/events-module/EventsController.cjs +20 -14
  42. package/lib/cjs/events-module/EventsController.cjs.map +1 -0
  43. package/lib/cjs/events-module/constant.cjs +1 -0
  44. package/lib/cjs/events-module/constant.cjs.map +1 -0
  45. package/lib/cjs/events-module/index.cjs +1 -0
  46. package/lib/cjs/events-module/index.cjs.map +1 -0
  47. package/lib/cjs/events-module/utils.cjs +1 -0
  48. package/lib/cjs/events-module/utils.cjs.map +1 -0
  49. package/lib/cjs/factory/NestBootstraper.cjs +7 -6
  50. package/lib/cjs/factory/NestBootstraper.cjs.map +1 -0
  51. package/lib/cjs/factory/errors/cors.cjs +1 -0
  52. package/lib/cjs/factory/errors/cors.cjs.map +1 -0
  53. package/lib/cjs/factory/errors/index.cjs +1 -0
  54. package/lib/cjs/factory/errors/index.cjs.map +1 -0
  55. package/lib/cjs/factory/errors/throttling.cjs +1 -0
  56. package/lib/cjs/factory/errors/throttling.cjs.map +1 -0
  57. package/lib/cjs/factory/exceptions/DecafErrorFilter.cjs +11 -6
  58. package/lib/cjs/factory/exceptions/DecafErrorFilter.cjs.map +1 -0
  59. package/lib/cjs/factory/exceptions/decorators.cjs +5 -4
  60. package/lib/cjs/factory/exceptions/decorators.cjs.map +1 -0
  61. package/lib/cjs/factory/exceptions/index.cjs +1 -0
  62. package/lib/cjs/factory/exceptions/index.cjs.map +1 -0
  63. package/lib/cjs/factory/index.cjs +1 -0
  64. package/lib/cjs/factory/index.cjs.map +1 -0
  65. package/lib/cjs/factory/openapi/DtoBuilder.cjs +8 -7
  66. package/lib/cjs/factory/openapi/DtoBuilder.cjs.map +1 -0
  67. package/lib/cjs/factory/openapi/SwaggerBuilder.cjs +7 -6
  68. package/lib/cjs/factory/openapi/SwaggerBuilder.cjs.map +1 -0
  69. package/lib/cjs/factory/openapi/SwaggerCustomUI.cjs +3 -2
  70. package/lib/cjs/factory/openapi/SwaggerCustomUI.cjs.map +1 -0
  71. package/lib/cjs/factory/openapi/constants.cjs +1 -0
  72. package/lib/cjs/factory/openapi/constants.cjs.map +1 -0
  73. package/lib/cjs/factory/openapi/index.cjs +1 -0
  74. package/lib/cjs/factory/openapi/index.cjs.map +1 -0
  75. package/lib/cjs/index.cjs +18 -17
  76. package/lib/cjs/index.cjs.map +1 -0
  77. package/lib/cjs/interceptors/AuthInterceptor.cjs +16 -10
  78. package/lib/cjs/interceptors/AuthInterceptor.cjs.map +1 -0
  79. package/lib/cjs/interceptors/DecafRequestHandlerInterceptor.cjs +14 -8
  80. package/lib/cjs/interceptors/DecafRequestHandlerInterceptor.cjs.map +1 -0
  81. package/lib/cjs/interceptors/context.cjs +1 -0
  82. package/lib/cjs/interceptors/context.cjs.map +1 -0
  83. package/lib/cjs/interceptors/index.cjs +1 -0
  84. package/lib/cjs/interceptors/index.cjs.map +1 -0
  85. package/lib/cjs/module.cjs +16 -11
  86. package/lib/cjs/module.cjs.map +1 -0
  87. package/lib/cjs/overrides/Adapter.cjs +1 -0
  88. package/lib/cjs/overrides/Adapter.cjs.map +1 -0
  89. package/lib/cjs/overrides/ModelBuilderExtensions.cjs +3 -2
  90. package/lib/cjs/overrides/ModelBuilderExtensions.cjs.map +1 -0
  91. package/lib/cjs/overrides/constants.cjs +1 -0
  92. package/lib/cjs/overrides/constants.cjs.map +1 -0
  93. package/lib/cjs/overrides/decoration.cjs +8 -7
  94. package/lib/cjs/overrides/decoration.cjs.map +1 -0
  95. package/lib/cjs/overrides/helpers.cjs +8 -7
  96. package/lib/cjs/overrides/helpers.cjs.map +1 -0
  97. package/lib/cjs/overrides/index.cjs +1 -0
  98. package/lib/cjs/overrides/index.cjs.map +1 -0
  99. package/lib/cjs/overrides/overrides.cjs +1 -0
  100. package/lib/cjs/overrides/overrides.cjs.map +1 -0
  101. package/lib/cjs/ram/RamRequestTransformer.cjs +1 -0
  102. package/lib/cjs/ram/RamRequestTransformer.cjs.map +1 -0
  103. package/lib/cjs/ram/index.cjs +1 -0
  104. package/lib/cjs/ram/index.cjs.map +1 -0
  105. package/lib/cjs/request/DecafAuthHandler.cjs +1 -0
  106. package/lib/cjs/request/DecafAuthHandler.cjs.map +1 -0
  107. package/lib/cjs/request/DecafHandlerExecutor.cjs +16 -10
  108. package/lib/cjs/request/DecafHandlerExecutor.cjs.map +1 -0
  109. package/lib/cjs/request/DecafRequestContext.cjs +12 -6
  110. package/lib/cjs/request/DecafRequestContext.cjs.map +1 -0
  111. package/lib/cjs/request/DecafResponseInterceptor.cjs +13 -7
  112. package/lib/cjs/request/DecafResponseInterceptor.cjs.map +1 -0
  113. package/lib/cjs/request/index.cjs +1 -0
  114. package/lib/cjs/request/index.cjs.map +1 -0
  115. package/lib/cjs/types.cjs +1 -0
  116. package/lib/cjs/types.cjs.map +1 -0
  117. package/lib/cjs/utils.cjs +1 -0
  118. package/lib/cjs/utils.cjs.map +1 -0
  119. package/lib/esm/index.js +1 -1
  120. package/lib/types/bin/cli.d.cts +1 -0
  121. package/lib/types/bin/cli.d.mts +1 -0
  122. package/lib/types/cli-module.d.cts +11 -0
  123. package/lib/types/cli-module.d.mts +11 -0
  124. package/lib/types/constants.d.cts +15 -0
  125. package/lib/types/constants.d.mts +15 -0
  126. package/lib/types/controllers.d.cts +22 -0
  127. package/lib/types/controllers.d.mts +22 -0
  128. package/lib/types/core-module.d.cts +17 -0
  129. package/lib/types/core-module.d.mts +17 -0
  130. package/lib/types/decaf-model/DecafModelModule.d.cts +9 -0
  131. package/lib/types/decaf-model/DecafModelModule.d.mts +9 -0
  132. package/lib/types/decaf-model/FromModelController.d.cts +61 -0
  133. package/lib/types/decaf-model/FromModelController.d.mts +61 -0
  134. package/lib/types/decaf-model/decorators/ApiOperationFromModel.d.cts +30 -0
  135. package/lib/types/decaf-model/decorators/ApiOperationFromModel.d.mts +30 -0
  136. package/lib/types/decaf-model/decorators/ApiParamsFromModel.d.cts +13 -0
  137. package/lib/types/decaf-model/decorators/ApiParamsFromModel.d.mts +13 -0
  138. package/lib/types/decaf-model/decorators/DecafBody.d.cts +5 -0
  139. package/lib/types/decaf-model/decorators/DecafBody.d.mts +5 -0
  140. package/lib/types/decaf-model/decorators/DecafParams.d.cts +9 -0
  141. package/lib/types/decaf-model/decorators/DecafParams.d.mts +9 -0
  142. package/lib/types/decaf-model/decorators/decorators.d.cts +29 -0
  143. package/lib/types/decaf-model/decorators/decorators.d.mts +29 -0
  144. package/lib/types/decaf-model/decorators/index.d.cts +7 -0
  145. package/lib/types/decaf-model/decorators/index.d.mts +7 -0
  146. package/lib/types/decaf-model/decorators/types.d.cts +23 -0
  147. package/lib/types/decaf-model/decorators/types.d.mts +23 -0
  148. package/lib/types/decaf-model/decorators/utils.d.cts +11 -0
  149. package/lib/types/decaf-model/decorators/utils.d.mts +11 -0
  150. package/lib/types/decaf-model/index.d.cts +3 -0
  151. package/lib/types/decaf-model/index.d.mts +3 -0
  152. package/lib/types/decaf-model/types.d.cts +7 -0
  153. package/lib/types/decaf-model/types.d.mts +7 -0
  154. package/lib/types/decaf-model/utils.d.cts +10 -0
  155. package/lib/types/decaf-model/utils.d.mts +10 -0
  156. package/lib/types/decoration.d.cts +1 -0
  157. package/lib/types/decoration.d.mts +1 -0
  158. package/lib/types/events-module/DecafStreamModule.d.cts +4 -0
  159. package/lib/types/events-module/DecafStreamModule.d.mts +4 -0
  160. package/lib/types/events-module/EventsController.d.cts +11 -0
  161. package/lib/types/events-module/EventsController.d.mts +11 -0
  162. package/lib/types/events-module/constant.d.cts +1 -0
  163. package/lib/types/events-module/constant.d.mts +1 -0
  164. package/lib/types/events-module/index.d.cts +2 -0
  165. package/lib/types/events-module/index.d.mts +2 -0
  166. package/lib/types/events-module/utils.d.cts +1 -0
  167. package/lib/types/events-module/utils.d.mts +1 -0
  168. package/lib/types/factory/NestBootstraper.d.cts +224 -0
  169. package/lib/types/factory/NestBootstraper.d.mts +224 -0
  170. package/lib/types/factory/errors/cors.d.cts +4 -0
  171. package/lib/types/factory/errors/cors.d.mts +4 -0
  172. package/lib/types/factory/errors/index.d.cts +1 -0
  173. package/lib/types/factory/errors/index.d.mts +1 -0
  174. package/lib/types/factory/errors/throttling.d.cts +4 -0
  175. package/lib/types/factory/errors/throttling.d.mts +4 -0
  176. package/lib/types/factory/exceptions/DecafErrorFilter.d.cts +4 -0
  177. package/lib/types/factory/exceptions/DecafErrorFilter.d.mts +4 -0
  178. package/lib/types/factory/exceptions/decorators.d.cts +2 -0
  179. package/lib/types/factory/exceptions/decorators.d.mts +2 -0
  180. package/lib/types/factory/exceptions/index.d.cts +2 -0
  181. package/lib/types/factory/exceptions/index.d.mts +2 -0
  182. package/lib/types/factory/index.d.cts +4 -0
  183. package/lib/types/factory/index.d.mts +4 -0
  184. package/lib/types/factory/openapi/DtoBuilder.d.cts +25 -0
  185. package/lib/types/factory/openapi/DtoBuilder.d.mts +25 -0
  186. package/lib/types/factory/openapi/SwaggerBuilder.d.cts +10 -0
  187. package/lib/types/factory/openapi/SwaggerBuilder.d.mts +10 -0
  188. package/lib/types/factory/openapi/SwaggerCustomUI.d.cts +22 -0
  189. package/lib/types/factory/openapi/SwaggerCustomUI.d.mts +22 -0
  190. package/lib/types/factory/openapi/constants.d.cts +27 -0
  191. package/lib/types/factory/openapi/constants.d.mts +27 -0
  192. package/lib/types/factory/openapi/index.d.cts +2 -0
  193. package/lib/types/factory/openapi/index.d.mts +2 -0
  194. package/lib/types/index.d.cts +43 -0
  195. package/lib/types/index.d.mts +43 -0
  196. package/lib/types/index.d.ts +1 -1
  197. package/lib/types/interceptors/AuthInterceptor.d.cts +10 -0
  198. package/lib/types/interceptors/AuthInterceptor.d.mts +10 -0
  199. package/lib/types/interceptors/DecafRequestHandlerInterceptor.d.cts +57 -0
  200. package/lib/types/interceptors/DecafRequestHandlerInterceptor.d.mts +57 -0
  201. package/lib/types/interceptors/context.d.cts +6 -0
  202. package/lib/types/interceptors/context.d.mts +6 -0
  203. package/lib/types/interceptors/index.d.cts +3 -0
  204. package/lib/types/interceptors/index.d.mts +3 -0
  205. package/lib/types/module.d.cts +8 -0
  206. package/lib/types/module.d.mts +8 -0
  207. package/lib/types/overrides/Adapter.d.cts +13 -0
  208. package/lib/types/overrides/Adapter.d.mts +13 -0
  209. package/lib/types/overrides/ModelBuilderExtensions.d.cts +8 -0
  210. package/lib/types/overrides/ModelBuilderExtensions.d.mts +8 -0
  211. package/lib/types/overrides/constants.d.cts +21 -0
  212. package/lib/types/overrides/constants.d.mts +21 -0
  213. package/lib/types/overrides/decoration.d.cts +30 -0
  214. package/lib/types/overrides/decoration.d.mts +30 -0
  215. package/lib/types/overrides/helpers.d.cts +11 -0
  216. package/lib/types/overrides/helpers.d.mts +11 -0
  217. package/lib/types/overrides/index.d.cts +6 -0
  218. package/lib/types/overrides/index.d.mts +6 -0
  219. package/lib/types/overrides/overrides.d.cts +1 -0
  220. package/lib/types/overrides/overrides.d.mts +1 -0
  221. package/lib/types/ram/RamRequestTransformer.d.cts +5 -0
  222. package/lib/types/ram/RamRequestTransformer.d.mts +5 -0
  223. package/lib/types/ram/index.d.cts +1 -0
  224. package/lib/types/ram/index.d.mts +1 -0
  225. package/lib/types/request/DecafAuthHandler.d.cts +10 -0
  226. package/lib/types/request/DecafAuthHandler.d.mts +10 -0
  227. package/lib/types/request/DecafHandlerExecutor.d.cts +52 -0
  228. package/lib/types/request/DecafHandlerExecutor.d.mts +52 -0
  229. package/lib/types/request/DecafRequestContext.d.cts +11 -0
  230. package/lib/types/request/DecafRequestContext.d.mts +11 -0
  231. package/lib/types/request/DecafResponseInterceptor.d.cts +8 -0
  232. package/lib/types/request/DecafResponseInterceptor.d.mts +8 -0
  233. package/lib/types/request/index.d.cts +4 -0
  234. package/lib/types/request/index.d.mts +4 -0
  235. package/lib/types/types.d.cts +88 -0
  236. package/lib/types/types.d.mts +88 -0
  237. package/lib/types/utils.d.cts +2 -0
  238. package/lib/types/utils.d.mts +2 -0
  239. package/package.json +4 -4
  240. package/lib/cjs/bin/cli.js.map +0 -1
  241. package/lib/cjs/cli-module.js.map +0 -1
  242. package/lib/cjs/constants.js.map +0 -1
  243. package/lib/cjs/controllers.js.map +0 -1
  244. package/lib/cjs/core-module.js.map +0 -1
  245. package/lib/cjs/decaf-model/DecafModelModule.js.map +0 -1
  246. package/lib/cjs/decaf-model/FromModelController.js.map +0 -1
  247. package/lib/cjs/decaf-model/decorators/ApiOperationFromModel.js.map +0 -1
  248. package/lib/cjs/decaf-model/decorators/ApiParamsFromModel.js.map +0 -1
  249. package/lib/cjs/decaf-model/decorators/DecafBody.js.map +0 -1
  250. package/lib/cjs/decaf-model/decorators/DecafParams.js.map +0 -1
  251. package/lib/cjs/decaf-model/decorators/decorators.js.map +0 -1
  252. package/lib/cjs/decaf-model/decorators/index.js.map +0 -1
  253. package/lib/cjs/decaf-model/decorators/types.js.map +0 -1
  254. package/lib/cjs/decaf-model/decorators/utils.js.map +0 -1
  255. package/lib/cjs/decaf-model/index.js.map +0 -1
  256. package/lib/cjs/decaf-model/types.js.map +0 -1
  257. package/lib/cjs/decaf-model/utils.js.map +0 -1
  258. package/lib/cjs/decoration.js.map +0 -1
  259. package/lib/cjs/events-module/DecafStreamModule.js.map +0 -1
  260. package/lib/cjs/events-module/EventsController.js.map +0 -1
  261. package/lib/cjs/events-module/constant.js.map +0 -1
  262. package/lib/cjs/events-module/index.js.map +0 -1
  263. package/lib/cjs/events-module/utils.js.map +0 -1
  264. package/lib/cjs/factory/NestBootstraper.js.map +0 -1
  265. package/lib/cjs/factory/errors/cors.js.map +0 -1
  266. package/lib/cjs/factory/errors/index.js.map +0 -1
  267. package/lib/cjs/factory/errors/throttling.js.map +0 -1
  268. package/lib/cjs/factory/exceptions/DecafErrorFilter.js.map +0 -1
  269. package/lib/cjs/factory/exceptions/decorators.js.map +0 -1
  270. package/lib/cjs/factory/exceptions/index.js.map +0 -1
  271. package/lib/cjs/factory/index.js.map +0 -1
  272. package/lib/cjs/factory/openapi/DtoBuilder.js.map +0 -1
  273. package/lib/cjs/factory/openapi/SwaggerBuilder.js.map +0 -1
  274. package/lib/cjs/factory/openapi/SwaggerCustomUI.js.map +0 -1
  275. package/lib/cjs/factory/openapi/constants.js.map +0 -1
  276. package/lib/cjs/factory/openapi/index.js.map +0 -1
  277. package/lib/cjs/index.js.map +0 -1
  278. package/lib/cjs/interceptors/AuthInterceptor.js.map +0 -1
  279. package/lib/cjs/interceptors/DecafRequestHandlerInterceptor.js.map +0 -1
  280. package/lib/cjs/interceptors/context.js.map +0 -1
  281. package/lib/cjs/interceptors/index.js.map +0 -1
  282. package/lib/cjs/module.js.map +0 -1
  283. package/lib/cjs/overrides/Adapter.js.map +0 -1
  284. package/lib/cjs/overrides/ModelBuilderExtensions.js.map +0 -1
  285. package/lib/cjs/overrides/constants.js.map +0 -1
  286. package/lib/cjs/overrides/decoration.js.map +0 -1
  287. package/lib/cjs/overrides/helpers.js.map +0 -1
  288. package/lib/cjs/overrides/index.js.map +0 -1
  289. package/lib/cjs/overrides/overrides.js.map +0 -1
  290. package/lib/cjs/ram/RamRequestTransformer.js.map +0 -1
  291. package/lib/cjs/ram/index.js.map +0 -1
  292. package/lib/cjs/request/DecafAuthHandler.js.map +0 -1
  293. package/lib/cjs/request/DecafHandlerExecutor.js.map +0 -1
  294. package/lib/cjs/request/DecafRequestContext.js.map +0 -1
  295. package/lib/cjs/request/DecafResponseInterceptor.js.map +0 -1
  296. package/lib/cjs/request/index.js.map +0 -1
  297. package/lib/cjs/types.js.map +0 -1
  298. package/lib/cjs/utils.js.map +0 -1
@@ -0,0 +1,9 @@
1
+ import { DecafApiProperty } from "./types.js";
2
+ /**
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
+ * @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
+ * @param {ApiParam[]} [props=[]] Array of `ApiParam` definitions whose `name` fields determine the parameter extraction order.
6
+ * @return {ParameterDecorator} A NestJS parameter decorator that injects an ordered list of parameters and metadata into the controller method argument.
7
+ */
8
+ export declare function DecafParams(props?: DecafApiProperty[]): ParameterDecorator;
9
+ export declare const DecafQuery: (...dataOrPipes: unknown[]) => ParameterDecorator;
@@ -0,0 +1,29 @@
1
+ import { Constructor } from "@decaf-ts/decoration";
2
+ /**
3
+ * A decorator function that applies authentication and authorization metadata to a NestJS controller or method.
4
+ *
5
+ * @param model - The model name or constructor function for the resource being accessed.
6
+ * If a string is provided, it is used as the resource name.
7
+ * If a constructor function is provided, its name is used as the resource name.
8
+ *
9
+ * @returns - A function that applies the authentication and authorization decorators to the target.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * @Controller('users')
14
+ * @Auth('User')
15
+ * export class UsersController {
16
+ * // ...
17
+ * }
18
+ * ```
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * @Controller('users')
23
+ * @Auth(User)
24
+ * export class UsersController {
25
+ * // ...
26
+ * }
27
+ * ```
28
+ */
29
+ export declare function Auth(model?: string | Constructor): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,29 @@
1
+ import { Constructor } from "@decaf-ts/decoration";
2
+ /**
3
+ * A decorator function that applies authentication and authorization metadata to a NestJS controller or method.
4
+ *
5
+ * @param model - The model name or constructor function for the resource being accessed.
6
+ * If a string is provided, it is used as the resource name.
7
+ * If a constructor function is provided, its name is used as the resource name.
8
+ *
9
+ * @returns - A function that applies the authentication and authorization decorators to the target.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * @Controller('users')
14
+ * @Auth('User')
15
+ * export class UsersController {
16
+ * // ...
17
+ * }
18
+ * ```
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * @Controller('users')
23
+ * @Auth(User)
24
+ * export class UsersController {
25
+ * // ...
26
+ * }
27
+ * ```
28
+ */
29
+ export declare function Auth(model?: string | Constructor): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,7 @@
1
+ export * from "./types.cjs";
2
+ export * from "./ApiOperationFromModel.cjs";
3
+ export * from "./ApiParamsFromModel.cjs";
4
+ export * from "./DecafBody.cjs";
5
+ export * from "./DecafParams.cjs";
6
+ export * from "./utils.cjs";
7
+ export * from "./decorators.cjs";
@@ -0,0 +1,7 @@
1
+ export * from "./types.js";
2
+ export * from "./ApiOperationFromModel.js";
3
+ export * from "./ApiParamsFromModel.js";
4
+ export * from "./DecafBody.js";
5
+ export * from "./DecafParams.js";
6
+ export * from "./utils.js";
7
+ export * from "./decorators.js";
@@ -0,0 +1,23 @@
1
+ export type HttpVerbs = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
2
+ export type DecafApiProperty = {
3
+ name: string;
4
+ description?: string;
5
+ required?: boolean;
6
+ type?: any;
7
+ };
8
+ export type DecafModelRoute = {
9
+ path: string;
10
+ description?: string;
11
+ apiProperties: DecafApiProperty[];
12
+ getPK: (...args: Array<string | number>) => string;
13
+ };
14
+ export type DecafParamProps = {
15
+ raw: Record<string, string | number>;
16
+ keysInOrder: Array<string>;
17
+ valuesInOrder: Array<string | number>;
18
+ };
19
+ export interface DecafRouteDecOptions {
20
+ path: string;
21
+ httpMethod: HttpVerbs;
22
+ handler: PropertyDescriptor;
23
+ }
@@ -0,0 +1,23 @@
1
+ export type HttpVerbs = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
2
+ export type DecafApiProperty = {
3
+ name: string;
4
+ description?: string;
5
+ required?: boolean;
6
+ type?: any;
7
+ };
8
+ export type DecafModelRoute = {
9
+ path: string;
10
+ description?: string;
11
+ apiProperties: DecafApiProperty[];
12
+ getPK: (...args: Array<string | number>) => string;
13
+ };
14
+ export type DecafParamProps = {
15
+ raw: Record<string, string | number>;
16
+ keysInOrder: Array<string>;
17
+ valuesInOrder: Array<string | number>;
18
+ };
19
+ export interface DecafRouteDecOptions {
20
+ path: string;
21
+ httpMethod: HttpVerbs;
22
+ handler: PropertyDescriptor;
23
+ }
@@ -0,0 +1,11 @@
1
+ import { HttpVerbs } from "./types.cjs";
2
+ /**
3
+ * Maps an HTTP verb to its corresponding NestJS method decorator.
4
+ *
5
+ * @param verb - HTTP verb to be converted (e.g. GET, POST, PUT, PATCH, DELETE).
6
+ * @returns A NestJS method decorator matching the provided HTTP verb.
7
+ *
8
+ * @throws {Error} If the provided HTTP verb is not supported or not mapped
9
+ * to a NestJS decorator.
10
+ */
11
+ export declare function HttpVerbToDecorator(verb: HttpVerbs): (path?: string) => MethodDecorator;
@@ -0,0 +1,11 @@
1
+ import { HttpVerbs } from "./types.js";
2
+ /**
3
+ * Maps an HTTP verb to its corresponding NestJS method decorator.
4
+ *
5
+ * @param verb - HTTP verb to be converted (e.g. GET, POST, PUT, PATCH, DELETE).
6
+ * @returns A NestJS method decorator matching the provided HTTP verb.
7
+ *
8
+ * @throws {Error} If the provided HTTP verb is not supported or not mapped
9
+ * to a NestJS decorator.
10
+ */
11
+ export declare function HttpVerbToDecorator(verb: HttpVerbs): (path?: string) => MethodDecorator;
@@ -0,0 +1,3 @@
1
+ export * from "./decorators/index.cjs";
2
+ export * from "./DecafModelModule.cjs";
3
+ export * from "./FromModelController.cjs";
@@ -0,0 +1,3 @@
1
+ export * from "./decorators/index.js";
2
+ export * from "./DecafModelModule.js";
3
+ export * from "./FromModelController.js";
@@ -0,0 +1,7 @@
1
+ import { DecafModelController } from "../controllers.cjs";
2
+ import { Model } from "@decaf-ts/decorator-validation";
3
+ export type ControllerConstructor<T extends Model<boolean>> = new (...args: any[]) => DecafModelController<T>;
4
+ export type DecoratorBundle = {
5
+ method: MethodDecorator[];
6
+ params?: ParameterDecorator[];
7
+ };
@@ -0,0 +1,7 @@
1
+ import { DecafModelController } from "../controllers.js";
2
+ import { Model } from "@decaf-ts/decorator-validation";
3
+ export type ControllerConstructor<T extends Model<boolean>> = new (...args: any[]) => DecafModelController<T>;
4
+ export type DecoratorBundle = {
5
+ method: MethodDecorator[];
6
+ params?: ParameterDecorator[];
7
+ };
@@ -0,0 +1,10 @@
1
+ import { type DecoratorBundle } from "./types.cjs";
2
+ import { type DecafParamProps, HttpVerbs } from "./decorators/index.cjs";
3
+ import { DirectionLimitOffset, ModelService, Repo } from "@decaf-ts/core";
4
+ import { Model } from "@decaf-ts/decorator-validation";
5
+ import { DecafModelController } from "../controllers.cjs";
6
+ export declare function getApiDecorators(methodName: string, routePath: string, httpVerb: HttpVerbs, includeQueryParams?: boolean): DecoratorBundle;
7
+ export declare function applyApiDecorators(target: any, methodName: string, descriptor: PropertyDescriptor, decorators: DecoratorBundle): void;
8
+ export declare function resolvePersistenceMethod<T extends Model<boolean>>(persistence: Repo<T> | ModelService<T>, methodName: string, ...args: any[]): any;
9
+ export declare function createRouteHandler<T>(methodName: string): (this: DecafModelController<any>, pathParams: DecafParamProps, queryParams: DirectionLimitOffset) => Promise<T>;
10
+ export declare function defineRouteMethod(ControllerClass: new (...args: any[]) => any, methodName: string, handler: (...args: any[]) => any): PropertyDescriptor | undefined;
@@ -0,0 +1,10 @@
1
+ import { type DecoratorBundle } from "./types.js";
2
+ import { type DecafParamProps, HttpVerbs } from "./decorators/index.js";
3
+ import { DirectionLimitOffset, ModelService, Repo } from "@decaf-ts/core";
4
+ import { Model } from "@decaf-ts/decorator-validation";
5
+ import { DecafModelController } from "../controllers.js";
6
+ export declare function getApiDecorators(methodName: string, routePath: string, httpVerb: HttpVerbs, includeQueryParams?: boolean): DecoratorBundle;
7
+ export declare function applyApiDecorators(target: any, methodName: string, descriptor: PropertyDescriptor, decorators: DecoratorBundle): void;
8
+ export declare function resolvePersistenceMethod<T extends Model<boolean>>(persistence: Repo<T> | ModelService<T>, methodName: string, ...args: any[]): any;
9
+ export declare function createRouteHandler<T>(methodName: string): (this: DecafModelController<any>, pathParams: DecafParamProps, queryParams: DirectionLimitOffset) => Promise<T>;
10
+ export declare function defineRouteMethod(ControllerClass: new (...args: any[]) => any, methodName: string, handler: (...args: any[]) => any): PropertyDescriptor | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { DynamicModule } from "@nestjs/common";
2
+ export declare class DecafStreamModule {
3
+ static forFlavours(flavours: string[], path?: string): DynamicModule;
4
+ }
@@ -0,0 +1,4 @@
1
+ import { DynamicModule } from "@nestjs/common";
2
+ export declare class DecafStreamModule {
3
+ static forFlavours(flavours: string[], path?: string): DynamicModule;
4
+ }
@@ -0,0 +1,11 @@
1
+ import { DecafController } from "../controllers.cjs";
2
+ import { DecafRequestContext } from "../request/index.cjs";
3
+ import { MessageEvent } from "@nestjs/common";
4
+ import { Observable } from "rxjs";
5
+ import { DecafServerCtx } from "../constants.cjs";
6
+ export declare class EventsController extends DecafController<DecafServerCtx> {
7
+ private readonly adapters;
8
+ constructor(clientContext: DecafRequestContext, flavours: string[]);
9
+ listen(): Observable<MessageEvent>;
10
+ listenForModel(model: string): Observable<MessageEvent>;
11
+ }
@@ -0,0 +1,11 @@
1
+ import { DecafController } from "../controllers.js";
2
+ import { DecafRequestContext } from "../request/index.js";
3
+ import { MessageEvent } from "@nestjs/common";
4
+ import { Observable } from "rxjs";
5
+ import { DecafServerCtx } from "../constants.js";
6
+ export declare class EventsController extends DecafController<DecafServerCtx> {
7
+ private readonly adapters;
8
+ constructor(clientContext: DecafRequestContext, flavours: string[]);
9
+ listen(): Observable<MessageEvent>;
10
+ listenForModel(model: string): Observable<MessageEvent>;
11
+ }
@@ -0,0 +1 @@
1
+ export declare const LISTENING_ADAPTERS_FLAVOURS: unique symbol;
@@ -0,0 +1 @@
1
+ export declare const LISTENING_ADAPTERS_FLAVOURS: unique symbol;
@@ -0,0 +1,2 @@
1
+ export * from "./EventsController.cjs";
2
+ export * from "./DecafStreamModule.cjs";
@@ -0,0 +1,2 @@
1
+ export * from "./EventsController.js";
2
+ export * from "./DecafStreamModule.js";
@@ -0,0 +1 @@
1
+ export declare function normalizeEventResponse(args: any[]): unknown[];
@@ -0,0 +1 @@
1
+ export declare function normalizeEventResponse(args: any[]): unknown[];
@@ -0,0 +1,224 @@
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.cjs";
60
+ * import { MyLogger } from "./MyLogger.cjs";
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
+ }