@depup/nestjs__common 11.2.2-depup.0 → 12.0.1-depup.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 (338) hide show
  1. package/README.md +3 -9
  2. package/changes.json +3 -8
  3. package/constants.js +35 -38
  4. package/decorators/core/apply-decorators.js +1 -4
  5. package/decorators/core/bind.decorator.js +1 -4
  6. package/decorators/core/catch.decorator.d.ts +1 -1
  7. package/decorators/core/catch.decorator.js +4 -7
  8. package/decorators/core/controller.decorator.d.ts +1 -1
  9. package/decorators/core/controller.decorator.js +10 -13
  10. package/decorators/core/dependencies.decorator.js +4 -9
  11. package/decorators/core/exception-filters.decorator.d.ts +1 -1
  12. package/decorators/core/exception-filters.decorator.js +10 -14
  13. package/decorators/core/index.d.ts +14 -14
  14. package/decorators/core/index.js +14 -17
  15. package/decorators/core/inject.decorator.d.ts +1 -1
  16. package/decorators/core/inject.decorator.js +9 -12
  17. package/decorators/core/injectable.decorator.d.ts +2 -2
  18. package/decorators/core/injectable.decorator.js +7 -11
  19. package/decorators/core/optional.decorator.js +8 -11
  20. package/decorators/core/set-metadata.decorator.js +1 -5
  21. package/decorators/core/use-guards.decorator.d.ts +1 -1
  22. package/decorators/core/use-guards.decorator.js +10 -13
  23. package/decorators/core/use-interceptors.decorator.d.ts +1 -1
  24. package/decorators/core/use-interceptors.decorator.js +10 -13
  25. package/decorators/core/use-pipes.decorator.d.ts +1 -1
  26. package/decorators/core/use-pipes.decorator.js +10 -13
  27. package/decorators/core/version.decorator.d.ts +1 -1
  28. package/decorators/core/version.decorator.js +3 -6
  29. package/decorators/http/create-route-param-metadata.decorator.d.ts +6 -5
  30. package/decorators/http/create-route-param-metadata.decorator.js +43 -16
  31. package/decorators/http/header.decorator.js +4 -7
  32. package/decorators/http/http-code.decorator.js +3 -6
  33. package/decorators/http/index.d.ts +9 -9
  34. package/decorators/http/index.js +9 -12
  35. package/decorators/http/redirect.decorator.js +3 -6
  36. package/decorators/http/render.decorator.js +3 -6
  37. package/decorators/http/request-mapping.decorator.d.ts +1 -1
  38. package/decorators/http/request-mapping.decorator.js +29 -33
  39. package/decorators/http/route-params.decorator.d.ts +153 -3
  40. package/decorators/http/route-params.decorator.js +122 -49
  41. package/decorators/http/sse-signal.decorator.js +4 -7
  42. package/decorators/http/sse.decorator.d.ts +2 -2
  43. package/decorators/http/sse.decorator.js +7 -10
  44. package/decorators/index.d.ts +3 -3
  45. package/decorators/index.js +3 -6
  46. package/decorators/modules/global.decorator.js +3 -6
  47. package/decorators/modules/index.d.ts +2 -2
  48. package/decorators/modules/index.js +2 -5
  49. package/decorators/modules/module.decorator.d.ts +1 -1
  50. package/decorators/modules/module.decorator.js +3 -6
  51. package/enums/http-status.enum.js +2 -5
  52. package/enums/index.d.ts +4 -4
  53. package/enums/index.js +4 -7
  54. package/enums/request-method.enum.js +2 -5
  55. package/enums/route-paramtypes.enum.js +2 -5
  56. package/enums/shutdown-signal.enum.js +2 -5
  57. package/enums/version-type.enum.js +2 -5
  58. package/exceptions/bad-gateway.exception.d.ts +1 -1
  59. package/exceptions/bad-gateway.exception.js +5 -9
  60. package/exceptions/bad-request.exception.d.ts +1 -1
  61. package/exceptions/bad-request.exception.js +5 -9
  62. package/exceptions/conflict.exception.d.ts +1 -1
  63. package/exceptions/conflict.exception.js +5 -9
  64. package/exceptions/forbidden.exception.d.ts +1 -1
  65. package/exceptions/forbidden.exception.js +5 -9
  66. package/exceptions/gateway-timeout.exception.d.ts +1 -1
  67. package/exceptions/gateway-timeout.exception.js +5 -9
  68. package/exceptions/gone.exception.d.ts +1 -1
  69. package/exceptions/gone.exception.js +5 -9
  70. package/exceptions/http-version-not-supported.exception.d.ts +1 -1
  71. package/exceptions/http-version-not-supported.exception.js +5 -9
  72. package/exceptions/http.exception.d.ts +6 -2
  73. package/exceptions/http.exception.js +36 -17
  74. package/exceptions/im-a-teapot.exception.d.ts +1 -1
  75. package/exceptions/im-a-teapot.exception.js +5 -9
  76. package/exceptions/index.d.ts +23 -23
  77. package/exceptions/index.js +23 -26
  78. package/exceptions/internal-server-error.exception.d.ts +1 -1
  79. package/exceptions/internal-server-error.exception.js +5 -9
  80. package/exceptions/intrinsic.exception.js +1 -5
  81. package/exceptions/method-not-allowed.exception.d.ts +1 -1
  82. package/exceptions/method-not-allowed.exception.js +5 -9
  83. package/exceptions/misdirected.exception.d.ts +1 -1
  84. package/exceptions/misdirected.exception.js +5 -9
  85. package/exceptions/not-acceptable.exception.d.ts +1 -1
  86. package/exceptions/not-acceptable.exception.js +5 -9
  87. package/exceptions/not-found.exception.d.ts +1 -1
  88. package/exceptions/not-found.exception.js +5 -9
  89. package/exceptions/not-implemented.exception.d.ts +1 -1
  90. package/exceptions/not-implemented.exception.js +5 -9
  91. package/exceptions/payload-too-large.exception.d.ts +1 -1
  92. package/exceptions/payload-too-large.exception.js +5 -9
  93. package/exceptions/precondition-failed.exception.d.ts +1 -1
  94. package/exceptions/precondition-failed.exception.js +5 -9
  95. package/exceptions/request-timeout.exception.d.ts +1 -1
  96. package/exceptions/request-timeout.exception.js +5 -9
  97. package/exceptions/service-unavailable.exception.d.ts +1 -1
  98. package/exceptions/service-unavailable.exception.js +5 -9
  99. package/exceptions/unauthorized.exception.d.ts +1 -1
  100. package/exceptions/unauthorized.exception.js +5 -9
  101. package/exceptions/unprocessable-entity.exception.d.ts +1 -1
  102. package/exceptions/unprocessable-entity.exception.js +5 -9
  103. package/exceptions/unsupported-media-type.exception.d.ts +1 -1
  104. package/exceptions/unsupported-media-type.exception.js +5 -9
  105. package/file-stream/index.d.ts +1 -1
  106. package/file-stream/index.js +1 -4
  107. package/file-stream/interfaces/index.d.ts +2 -2
  108. package/file-stream/interfaces/index.js +2 -5
  109. package/file-stream/interfaces/streamable-handler-response.interface.js +1 -2
  110. package/file-stream/interfaces/streamable-options.interface.js +1 -2
  111. package/file-stream/streamable-file.d.ts +2 -2
  112. package/file-stream/streamable-file.js +26 -28
  113. package/index.d.ts +10 -10
  114. package/index.js +11 -17
  115. package/interfaces/abstract.interface.js +1 -2
  116. package/interfaces/controllers/controller-metadata.interface.js +1 -2
  117. package/interfaces/controllers/controller.interface.js +1 -2
  118. package/interfaces/controllers/index.d.ts +2 -2
  119. package/interfaces/controllers/index.js +2 -5
  120. package/interfaces/exceptions/exception-filter-metadata.interface.d.ts +2 -2
  121. package/interfaces/exceptions/exception-filter-metadata.interface.js +1 -2
  122. package/interfaces/exceptions/exception-filter.interface.d.ts +1 -1
  123. package/interfaces/exceptions/exception-filter.interface.js +1 -2
  124. package/interfaces/exceptions/index.d.ts +5 -5
  125. package/interfaces/exceptions/index.js +5 -8
  126. package/interfaces/exceptions/rpc-exception-filter-metadata.interface.d.ts +2 -2
  127. package/interfaces/exceptions/rpc-exception-filter-metadata.interface.js +1 -2
  128. package/interfaces/exceptions/rpc-exception-filter.interface.d.ts +1 -1
  129. package/interfaces/exceptions/rpc-exception-filter.interface.js +1 -2
  130. package/interfaces/exceptions/ws-exception-filter.interface.d.ts +1 -1
  131. package/interfaces/exceptions/ws-exception-filter.interface.js +1 -2
  132. package/interfaces/external/class-transform-options.interface.js +1 -2
  133. package/interfaces/external/cors-options.interface.js +1 -2
  134. package/interfaces/external/https-options.interface.js +1 -2
  135. package/interfaces/external/transformer-package.interface.d.ts +2 -2
  136. package/interfaces/external/transformer-package.interface.js +1 -2
  137. package/interfaces/external/validation-error.interface.js +1 -2
  138. package/interfaces/external/validator-options.interface.js +1 -2
  139. package/interfaces/external/validator-package.interface.d.ts +2 -2
  140. package/interfaces/external/validator-package.interface.js +1 -2
  141. package/interfaces/features/arguments-host.interface.js +1 -2
  142. package/interfaces/features/can-activate.interface.d.ts +1 -1
  143. package/interfaces/features/can-activate.interface.js +1 -2
  144. package/interfaces/features/custom-route-param-factory.interface.d.ts +1 -1
  145. package/interfaces/features/custom-route-param-factory.interface.js +1 -2
  146. package/interfaces/features/execution-context.interface.d.ts +2 -2
  147. package/interfaces/features/execution-context.interface.js +1 -2
  148. package/interfaces/features/nest-interceptor.interface.d.ts +1 -1
  149. package/interfaces/features/nest-interceptor.interface.js +1 -2
  150. package/interfaces/features/paramtype.interface.js +1 -2
  151. package/interfaces/features/pipe-transform.interface.d.ts +10 -4
  152. package/interfaces/features/pipe-transform.interface.js +1 -2
  153. package/interfaces/global-prefix-options.interface.d.ts +1 -1
  154. package/interfaces/global-prefix-options.interface.js +1 -2
  155. package/interfaces/hooks/before-application-shutdown.interface.js +1 -2
  156. package/interfaces/hooks/index.d.ts +5 -5
  157. package/interfaces/hooks/index.js +5 -8
  158. package/interfaces/hooks/on-application-bootstrap.interface.js +1 -2
  159. package/interfaces/hooks/on-application-shutdown.interface.js +1 -2
  160. package/interfaces/hooks/on-destroy.interface.js +1 -2
  161. package/interfaces/hooks/on-init.interface.js +1 -2
  162. package/interfaces/http/http-exception-body.interface.d.ts +2 -1
  163. package/interfaces/http/http-exception-body.interface.js +1 -2
  164. package/interfaces/http/http-redirect-response.interface.d.ts +1 -1
  165. package/interfaces/http/http-redirect-response.interface.js +1 -2
  166. package/interfaces/http/http-server.interface.d.ts +5 -3
  167. package/interfaces/http/http-server.interface.js +1 -2
  168. package/interfaces/http/index.d.ts +5 -5
  169. package/interfaces/http/index.js +5 -8
  170. package/interfaces/http/message-event.interface.js +1 -2
  171. package/interfaces/http/raw-body-request.interface.js +1 -2
  172. package/interfaces/index.d.ts +33 -30
  173. package/interfaces/index.js +33 -33
  174. package/interfaces/injectable.interface.js +1 -2
  175. package/interfaces/microservices/nest-hybrid-application-options.interface.js +1 -2
  176. package/interfaces/microservices/nest-microservice-options.interface.d.ts +1 -1
  177. package/interfaces/microservices/nest-microservice-options.interface.js +1 -2
  178. package/interfaces/microservices/pre-request-hook.interface.d.ts +22 -0
  179. package/interfaces/microservices/pre-request-hook.interface.js +1 -0
  180. package/interfaces/microservices/transport-server.interface.d.ts +18 -0
  181. package/interfaces/microservices/transport-server.interface.js +1 -0
  182. package/interfaces/middleware/index.d.ts +4 -4
  183. package/interfaces/middleware/index.js +4 -7
  184. package/interfaces/middleware/middleware-config-proxy.interface.d.ts +3 -3
  185. package/interfaces/middleware/middleware-config-proxy.interface.js +1 -2
  186. package/interfaces/middleware/middleware-configuration.interface.d.ts +3 -3
  187. package/interfaces/middleware/middleware-configuration.interface.js +1 -2
  188. package/interfaces/middleware/middleware-consumer.interface.d.ts +2 -2
  189. package/interfaces/middleware/middleware-consumer.interface.js +1 -2
  190. package/interfaces/middleware/nest-middleware.interface.js +1 -2
  191. package/interfaces/modules/dynamic-module.interface.d.ts +2 -2
  192. package/interfaces/modules/dynamic-module.interface.js +1 -2
  193. package/interfaces/modules/forward-reference.interface.js +1 -2
  194. package/interfaces/modules/index.d.ts +8 -8
  195. package/interfaces/modules/index.js +8 -11
  196. package/interfaces/modules/injection-token.interface.d.ts +2 -2
  197. package/interfaces/modules/injection-token.interface.js +1 -2
  198. package/interfaces/modules/introspection-result.interface.d.ts +1 -1
  199. package/interfaces/modules/introspection-result.interface.js +1 -2
  200. package/interfaces/modules/module-metadata.interface.d.ts +5 -5
  201. package/interfaces/modules/module-metadata.interface.js +1 -2
  202. package/interfaces/modules/nest-module.interface.d.ts +1 -1
  203. package/interfaces/modules/nest-module.interface.js +1 -2
  204. package/interfaces/modules/optional-factory-dependency.interface.d.ts +1 -1
  205. package/interfaces/modules/optional-factory-dependency.interface.js +1 -2
  206. package/interfaces/modules/provider.interface.d.ts +4 -4
  207. package/interfaces/modules/provider.interface.js +1 -2
  208. package/interfaces/nest-application-context-options.interface.d.ts +1 -1
  209. package/interfaces/nest-application-context-options.interface.js +55 -5
  210. package/interfaces/nest-application-context.interface.d.ts +6 -6
  211. package/interfaces/nest-application-context.interface.js +1 -2
  212. package/interfaces/nest-application-options.interface.d.ts +24 -3
  213. package/interfaces/nest-application-options.interface.js +1 -2
  214. package/interfaces/nest-application.interface.d.ts +8 -8
  215. package/interfaces/nest-application.interface.js +1 -2
  216. package/interfaces/nest-microservice.interface.d.ts +22 -6
  217. package/interfaces/nest-microservice.interface.js +1 -2
  218. package/interfaces/router-options.interface.d.ts +28 -0
  219. package/interfaces/router-options.interface.js +1 -0
  220. package/interfaces/scope-options.interface.js +2 -5
  221. package/interfaces/shutdown-hooks-options.interface.js +1 -2
  222. package/interfaces/type.interface.js +1 -2
  223. package/interfaces/version-options.interface.d.ts +1 -1
  224. package/interfaces/version-options.interface.js +1 -4
  225. package/interfaces/websockets/web-socket-adapter.interface.js +1 -2
  226. package/internal.d.ts +31 -0
  227. package/internal.js +20 -0
  228. package/module-utils/configurable-module.builder.d.ts +4 -4
  229. package/module-utils/configurable-module.builder.js +21 -20
  230. package/module-utils/constants.js +5 -8
  231. package/module-utils/index.d.ts +2 -2
  232. package/module-utils/index.js +2 -5
  233. package/module-utils/interfaces/configurable-module-async-options.interface.d.ts +2 -2
  234. package/module-utils/interfaces/configurable-module-async-options.interface.js +1 -2
  235. package/module-utils/interfaces/configurable-module-cls.interface.d.ts +3 -3
  236. package/module-utils/interfaces/configurable-module-cls.interface.js +1 -2
  237. package/module-utils/interfaces/configurable-module-host.interface.d.ts +2 -2
  238. package/module-utils/interfaces/configurable-module-host.interface.js +1 -2
  239. package/module-utils/interfaces/index.d.ts +3 -3
  240. package/module-utils/interfaces/index.js +3 -6
  241. package/module-utils/utils/generate-options-injection-token.util.js +3 -6
  242. package/module-utils/utils/get-injection-providers.util.d.ts +1 -1
  243. package/module-utils/utils/get-injection-providers.util.js +4 -7
  244. package/module-utils/utils/index.d.ts +2 -2
  245. package/module-utils/utils/index.js +2 -5
  246. package/package.json +16 -12
  247. package/pipes/default-value.pipe.d.ts +1 -1
  248. package/pipes/default-value.pipe.js +10 -12
  249. package/pipes/file/file-type.validator.d.ts +3 -3
  250. package/pipes/file/file-type.validator.js +5 -19
  251. package/pipes/file/file-validator-context.interface.d.ts +1 -1
  252. package/pipes/file/file-validator-context.interface.js +1 -2
  253. package/pipes/file/file-validator.interface.d.ts +1 -1
  254. package/pipes/file/file-validator.interface.js +2 -5
  255. package/pipes/file/index.d.ts +6 -6
  256. package/pipes/file/index.js +6 -9
  257. package/pipes/file/interfaces/file.interface.js +1 -2
  258. package/pipes/file/interfaces/index.d.ts +1 -1
  259. package/pipes/file/interfaces/index.js +1 -4
  260. package/pipes/file/max-file-size.validator.d.ts +3 -3
  261. package/pipes/file/max-file-size.validator.js +2 -6
  262. package/pipes/file/parse-file-options.interface.d.ts +2 -2
  263. package/pipes/file/parse-file-options.interface.js +1 -2
  264. package/pipes/file/parse-file-pipe.builder.d.ts +5 -5
  265. package/pipes/file/parse-file-pipe.builder.js +8 -14
  266. package/pipes/file/parse-file.pipe.d.ts +7 -7
  267. package/pipes/file/parse-file.pipe.js +17 -18
  268. package/pipes/index.d.ts +11 -10
  269. package/pipes/index.js +11 -13
  270. package/pipes/parse-array.pipe.d.ts +4 -4
  271. package/pipes/parse-array.pipe.js +23 -23
  272. package/pipes/parse-bool.pipe.d.ts +6 -6
  273. package/pipes/parse-bool.pipe.js +16 -17
  274. package/pipes/parse-date.pipe.d.ts +4 -4
  275. package/pipes/parse-date.pipe.js +18 -17
  276. package/pipes/parse-enum.pipe.d.ts +5 -5
  277. package/pipes/parse-enum.pipe.js +16 -16
  278. package/pipes/parse-float.pipe.d.ts +6 -6
  279. package/pipes/parse-float.pipe.js +30 -20
  280. package/pipes/parse-int.pipe.d.ts +5 -5
  281. package/pipes/parse-int.pipe.js +18 -19
  282. package/pipes/parse-uuid.pipe.d.ts +4 -4
  283. package/pipes/parse-uuid.pipe.js +27 -26
  284. package/pipes/standard-schema-validation.pipe.d.ts +91 -0
  285. package/pipes/standard-schema-validation.pipe.js +132 -0
  286. package/pipes/validation.pipe.d.ts +32 -14
  287. package/pipes/validation.pipe.js +66 -30
  288. package/serializer/class-serializer.constants.js +1 -4
  289. package/serializer/class-serializer.interceptor.d.ts +5 -5
  290. package/serializer/class-serializer.interceptor.js +21 -24
  291. package/serializer/class-serializer.interfaces.d.ts +2 -2
  292. package/serializer/class-serializer.interfaces.js +1 -2
  293. package/serializer/decorators/index.d.ts +1 -1
  294. package/serializer/decorators/index.js +1 -4
  295. package/serializer/decorators/serialize-options.decorator.d.ts +3 -2
  296. package/serializer/decorators/serialize-options.decorator.js +3 -7
  297. package/serializer/index.d.ts +5 -3
  298. package/serializer/index.js +5 -6
  299. package/serializer/standard-schema-serializer.interceptor.d.ts +50 -0
  300. package/serializer/standard-schema-serializer.interceptor.js +75 -0
  301. package/serializer/standard-schema-serializer.interfaces.d.ts +18 -0
  302. package/serializer/standard-schema-serializer.interfaces.js +1 -0
  303. package/services/console-logger.service.d.ts +39 -3
  304. package/services/console-logger.service.js +138 -66
  305. package/services/index.d.ts +3 -3
  306. package/services/index.js +3 -6
  307. package/services/logger.service.js +86 -83
  308. package/services/utils/filter-log-levels.util.d.ts +1 -1
  309. package/services/utils/filter-log-levels.util.js +7 -10
  310. package/services/utils/index.d.ts +3 -3
  311. package/services/utils/index.js +3 -6
  312. package/services/utils/is-log-level-enabled.util.d.ts +1 -1
  313. package/services/utils/is-log-level-enabled.util.js +1 -4
  314. package/services/utils/is-log-level.util.d.ts +1 -1
  315. package/services/utils/is-log-level.util.js +3 -6
  316. package/tsconfig.build.json +1 -2
  317. package/utils/assign-custom-metadata.util.d.ts +5 -4
  318. package/utils/assign-custom-metadata.util.js +4 -6
  319. package/utils/cli-colors.util.js +4 -8
  320. package/utils/extend-metadata.util.js +1 -4
  321. package/utils/forward-ref.util.d.ts +1 -1
  322. package/utils/forward-ref.util.js +1 -5
  323. package/utils/http-error-by-code.util.d.ts +2 -2
  324. package/utils/http-error-by-code.util.js +24 -27
  325. package/utils/index.d.ts +1 -1
  326. package/utils/index.js +1 -4
  327. package/utils/load-package.util.d.ts +29 -1
  328. package/utils/load-package.util.js +90 -9
  329. package/utils/merge-with-values.util.js +1 -5
  330. package/utils/parameter-decorator-options.util.d.ts +13 -0
  331. package/utils/parameter-decorator-options.util.js +22 -0
  332. package/utils/random-string-generator.util.js +2 -6
  333. package/utils/select-exception-filter-metadata.util.d.ts +1 -1
  334. package/utils/select-exception-filter-metadata.util.js +1 -5
  335. package/utils/shared.utils.d.ts +11 -10
  336. package/utils/shared.utils.js +28 -30
  337. package/utils/validate-each.util.js +3 -7
  338. package/utils/validate-module-keys.util.js +8 -13
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UsePipes = UsePipes;
4
- const constants_1 = require("../../constants");
5
- const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
6
- const shared_utils_1 = require("../../utils/shared.utils");
7
- const validate_each_util_1 = require("../../utils/validate-each.util");
1
+ import { PIPES_METADATA } from '../../constants.js';
2
+ import { extendArrayMetadata } from '../../utils/extend-metadata.util.js';
3
+ import { isFunction } from '../../utils/shared.utils.js';
4
+ import { validateEach } from '../../utils/validate-each.util.js';
8
5
  /**
9
6
  * Decorator that binds pipes to the scope of the controller or method,
10
7
  * depending on its context.
@@ -26,16 +23,16 @@ const validate_each_util_1 = require("../../utils/validate-each.util");
26
23
  *
27
24
  * @publicApi
28
25
  */
29
- function UsePipes(...pipes) {
26
+ export function UsePipes(...pipes) {
30
27
  return (target, key, descriptor) => {
31
- const isPipeValid = (pipe) => pipe && ((0, shared_utils_1.isFunction)(pipe) || (0, shared_utils_1.isFunction)(pipe.transform));
28
+ const isPipeValid = (pipe) => pipe && (isFunction(pipe) || isFunction(pipe.transform));
32
29
  if (descriptor) {
33
- (0, validate_each_util_1.validateEach)(target.constructor, pipes, isPipeValid, '@UsePipes', 'pipe');
34
- (0, extend_metadata_util_1.extendArrayMetadata)(constants_1.PIPES_METADATA, pipes, descriptor.value);
30
+ validateEach(target.constructor, pipes, isPipeValid, '@UsePipes', 'pipe');
31
+ extendArrayMetadata(PIPES_METADATA, pipes, descriptor.value);
35
32
  return descriptor;
36
33
  }
37
- (0, validate_each_util_1.validateEach)(target, pipes, isPipeValid, '@UsePipes', 'pipe');
38
- (0, extend_metadata_util_1.extendArrayMetadata)(constants_1.PIPES_METADATA, pipes, target);
34
+ validateEach(target, pipes, isPipeValid, '@UsePipes', 'pipe');
35
+ extendArrayMetadata(PIPES_METADATA, pipes, target);
39
36
  return target;
40
37
  };
41
38
  }
@@ -1,4 +1,4 @@
1
- import { VersionValue } from '../../interfaces/version-options.interface';
1
+ import { VersionValue } from '../../interfaces/version-options.interface.js';
2
2
  /**
3
3
  * Sets the version of the endpoint to the passed version
4
4
  *
@@ -1,19 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Version = Version;
4
- const constants_1 = require("../../constants");
1
+ import { VERSION_METADATA } from '../../constants.js';
5
2
  /**
6
3
  * Sets the version of the endpoint to the passed version
7
4
  *
8
5
  * @publicApi
9
6
  */
10
- function Version(version) {
7
+ export function Version(version) {
11
8
  if (Array.isArray(version)) {
12
9
  // Drop duplicated versions
13
10
  version = Array.from(new Set(version));
14
11
  }
15
12
  return (target, key, descriptor) => {
16
- Reflect.defineMetadata(constants_1.VERSION_METADATA, version, descriptor.value);
13
+ Reflect.defineMetadata(VERSION_METADATA, version, descriptor.value);
17
14
  return descriptor;
18
15
  };
19
16
  }
@@ -1,13 +1,14 @@
1
- import { PipeTransform } from '../../index';
2
- import { Type } from '../../interfaces';
3
- import { CustomParamFactory } from '../../interfaces/features/custom-route-param-factory.interface';
1
+ import { PipeTransform } from '../../index.js';
2
+ import { CustomParamFactory } from '../../interfaces/features/custom-route-param-factory.interface.js';
3
+ import { Type } from '../../interfaces/index.js';
4
+ import { ParameterDecoratorOptions } from './route-params.decorator.js';
4
5
  export type ParamDecoratorEnhancer = ParameterDecorator;
5
6
  /**
6
- * Defines HTTP route param decorator
7
+ * Defines route param decorator
7
8
  *
8
9
  * @param factory
9
10
  * @param enhancers
10
11
  *
11
12
  * @publicApi
12
13
  */
13
- export declare function createParamDecorator<FactoryData = any, FactoryOutput = any>(factory: CustomParamFactory<FactoryData, FactoryOutput>, enhancers?: ParamDecoratorEnhancer[]): (...dataOrPipes: (Type<PipeTransform> | PipeTransform | FactoryData)[]) => ParameterDecorator;
14
+ export declare function createParamDecorator<FactoryData = any, FactoryOutput = any>(factory: CustomParamFactory<FactoryData, FactoryOutput>, enhancers?: ParamDecoratorEnhancer[]): (...dataOrPipes: (Type<PipeTransform> | PipeTransform | FactoryData | ParameterDecoratorOptions)[]) => ParameterDecorator;
@@ -1,32 +1,59 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createParamDecorator = createParamDecorator;
4
- const uid_1 = require("uid");
5
- const constants_1 = require("../../constants");
6
- const assign_custom_metadata_util_1 = require("../../utils/assign-custom-metadata.util");
7
- const shared_utils_1 = require("../../utils/shared.utils");
1
+ import { uid } from 'uid';
2
+ import { ROUTE_ARGS_METADATA } from '../../constants.js';
3
+ import { assignCustomParameterMetadata } from '../../utils/assign-custom-metadata.util.js';
4
+ import { isFunction, isNil } from '../../utils/shared.utils.js';
5
+ import { isParameterDecoratorOptions } from '../../utils/parameter-decorator-options.util.js';
8
6
  /**
9
- * Defines HTTP route param decorator
7
+ * Defines route param decorator
10
8
  *
11
9
  * @param factory
12
10
  * @param enhancers
13
11
  *
14
12
  * @publicApi
15
13
  */
16
- function createParamDecorator(factory, enhancers = []) {
17
- const paramtype = (0, uid_1.uid)(21);
14
+ export function createParamDecorator(factory, enhancers = []) {
15
+ const paramtype = uid(21);
18
16
  return (data, ...pipes) => (target, key, index) => {
19
- const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) ||
17
+ const args = Reflect.getMetadata(ROUTE_ARGS_METADATA, target.constructor, key) ||
20
18
  {};
21
19
  const isPipe = (pipe) => pipe &&
22
- (((0, shared_utils_1.isFunction)(pipe) &&
20
+ ((isFunction(pipe) &&
23
21
  pipe.prototype &&
24
- (0, shared_utils_1.isFunction)(pipe.prototype.transform)) ||
25
- (0, shared_utils_1.isFunction)(pipe.transform));
26
- const hasParamData = (0, shared_utils_1.isNil)(data) || !isPipe(data);
22
+ isFunction(pipe.prototype.transform)) ||
23
+ isFunction(pipe.transform));
24
+ const hasParamData = isNil(data) || !isPipe(data);
27
25
  const paramData = hasParamData ? data : undefined;
28
26
  const paramPipes = hasParamData ? pipes : [data, ...pipes];
29
- Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, (0, assign_custom_metadata_util_1.assignCustomParameterMetadata)(args, paramtype, index, factory, paramData, ...paramPipes), target.constructor, key);
27
+ // Check if data itself is an options object (when used as the first argument)
28
+ const isDataOptions = hasParamData && !isNil(data) && isParameterDecoratorOptions(data);
29
+ // Check if the last pipe argument is actually an options object
30
+ const lastPipeArg = paramPipes.length > 0 ? paramPipes[paramPipes.length - 1] : undefined;
31
+ const isLastPipeOptions = !isDataOptions && isParameterDecoratorOptions(lastPipeArg);
32
+ let finalData;
33
+ let finalSchema;
34
+ let finalPipes;
35
+ if (isDataOptions) {
36
+ const opts = data;
37
+ finalData = undefined;
38
+ finalSchema = opts.schema;
39
+ // Merge positional pipes passed after the options object
40
+ finalPipes = [...(opts.pipes ?? []), ...paramPipes];
41
+ }
42
+ else if (isLastPipeOptions) {
43
+ const opts = lastPipeArg;
44
+ finalData = paramData;
45
+ finalSchema = opts.schema;
46
+ finalPipes = [
47
+ ...paramPipes.slice(0, -1),
48
+ ...(opts.pipes ?? []),
49
+ ];
50
+ }
51
+ else {
52
+ finalData = paramData;
53
+ finalSchema = undefined;
54
+ finalPipes = paramPipes;
55
+ }
56
+ Reflect.defineMetadata(ROUTE_ARGS_METADATA, assignCustomParameterMetadata(args, paramtype, index, factory, finalData, finalSchema, ...finalPipes), target.constructor, key);
30
57
  enhancers.forEach(fn => fn(target, key, index));
31
58
  };
32
59
  }
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Header = Header;
4
- const constants_1 = require("../../constants");
5
- const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
1
+ import { HEADERS_METADATA } from '../../constants.js';
2
+ import { extendArrayMetadata } from '../../utils/extend-metadata.util.js';
6
3
  /**
7
4
  * Request method Decorator. Sets a response header.
8
5
  *
@@ -17,9 +14,9 @@ const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
17
14
  *
18
15
  * @publicApi
19
16
  */
20
- function Header(name, value) {
17
+ export function Header(name, value) {
21
18
  return (target, key, descriptor) => {
22
- (0, extend_metadata_util_1.extendArrayMetadata)(constants_1.HEADERS_METADATA, [{ name, value }], descriptor.value);
19
+ extendArrayMetadata(HEADERS_METADATA, [{ name, value }], descriptor.value);
23
20
  return descriptor;
24
21
  };
25
22
  }
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpCode = HttpCode;
4
- const constants_1 = require("../../constants");
1
+ import { HTTP_CODE_METADATA } from '../../constants.js';
5
2
  /**
6
3
  * Request method Decorator. Defines the HTTP response status code. Overrides
7
4
  * default status code for the decorated request method.
@@ -12,9 +9,9 @@ const constants_1 = require("../../constants");
12
9
  *
13
10
  * @publicApi
14
11
  */
15
- function HttpCode(statusCode) {
12
+ export function HttpCode(statusCode) {
16
13
  return (target, key, descriptor) => {
17
- Reflect.defineMetadata(constants_1.HTTP_CODE_METADATA, statusCode, descriptor.value);
14
+ Reflect.defineMetadata(HTTP_CODE_METADATA, statusCode, descriptor.value);
18
15
  return descriptor;
19
16
  };
20
17
  }
@@ -1,9 +1,9 @@
1
- export * from './request-mapping.decorator';
2
- export * from './route-params.decorator';
3
- export * from './http-code.decorator';
4
- export * from './create-route-param-metadata.decorator';
5
- export * from './render.decorator';
6
- export * from './header.decorator';
7
- export * from './redirect.decorator';
8
- export * from './sse.decorator';
9
- export * from './sse-signal.decorator';
1
+ export * from './request-mapping.decorator.js';
2
+ export * from './route-params.decorator.js';
3
+ export * from './http-code.decorator.js';
4
+ export * from './create-route-param-metadata.decorator.js';
5
+ export * from './render.decorator.js';
6
+ export * from './header.decorator.js';
7
+ export * from './redirect.decorator.js';
8
+ export * from './sse.decorator.js';
9
+ export * from './sse-signal.decorator.js';
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./request-mapping.decorator"), exports);
5
- tslib_1.__exportStar(require("./route-params.decorator"), exports);
6
- tslib_1.__exportStar(require("./http-code.decorator"), exports);
7
- tslib_1.__exportStar(require("./create-route-param-metadata.decorator"), exports);
8
- tslib_1.__exportStar(require("./render.decorator"), exports);
9
- tslib_1.__exportStar(require("./header.decorator"), exports);
10
- tslib_1.__exportStar(require("./redirect.decorator"), exports);
11
- tslib_1.__exportStar(require("./sse.decorator"), exports);
12
- tslib_1.__exportStar(require("./sse-signal.decorator"), exports);
1
+ export * from './request-mapping.decorator.js';
2
+ export * from './route-params.decorator.js';
3
+ export * from './http-code.decorator.js';
4
+ export * from './create-route-param-metadata.decorator.js';
5
+ export * from './render.decorator.js';
6
+ export * from './header.decorator.js';
7
+ export * from './redirect.decorator.js';
8
+ export * from './sse.decorator.js';
9
+ export * from './sse-signal.decorator.js';
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Redirect = Redirect;
4
- const constants_1 = require("../../constants");
1
+ import { REDIRECT_METADATA } from '../../constants.js';
5
2
  /**
6
3
  * Redirects request to the specified URL.
7
4
  *
8
5
  * @publicApi
9
6
  */
10
- function Redirect(url = '', statusCode) {
7
+ export function Redirect(url = '', statusCode) {
11
8
  return (target, key, descriptor) => {
12
- Reflect.defineMetadata(constants_1.REDIRECT_METADATA, { statusCode, url }, descriptor.value);
9
+ Reflect.defineMetadata(REDIRECT_METADATA, { statusCode, url }, descriptor.value);
13
10
  return descriptor;
14
11
  };
15
12
  }
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Render = Render;
4
- const constants_1 = require("../../constants");
1
+ import { RENDER_METADATA } from '../../constants.js';
5
2
  /**
6
3
  * Route handler method Decorator. Defines a template to be rendered by the controller.
7
4
  *
@@ -13,9 +10,9 @@ const constants_1 = require("../../constants");
13
10
  *
14
11
  * @publicApi
15
12
  */
16
- function Render(template) {
13
+ export function Render(template) {
17
14
  return (target, key, descriptor) => {
18
- Reflect.defineMetadata(constants_1.RENDER_METADATA, template, descriptor.value);
15
+ Reflect.defineMetadata(RENDER_METADATA, template, descriptor.value);
19
16
  return descriptor;
20
17
  };
21
18
  }
@@ -1,4 +1,4 @@
1
- import { RequestMethod } from '../../enums/request-method.enum';
1
+ import { RequestMethod } from '../../enums/request-method.enum.js';
2
2
  export interface RequestMappingMetadata {
3
3
  path?: string | string[];
4
4
  method?: RequestMethod;
@@ -1,27 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Unlock = exports.Lock = exports.Move = exports.Copy = exports.Mkcol = exports.Proppatch = exports.Propfind = exports.QueryMethod = exports.Search = exports.All = exports.Head = exports.Options = exports.Patch = exports.Put = exports.Delete = exports.Get = exports.Post = exports.RequestMapping = void 0;
4
- const constants_1 = require("../../constants");
5
- const request_method_enum_1 = require("../../enums/request-method.enum");
1
+ import { METHOD_METADATA, PATH_METADATA } from '../../constants.js';
2
+ import { RequestMethod } from '../../enums/request-method.enum.js';
6
3
  const defaultMetadata = {
7
- [constants_1.PATH_METADATA]: '/',
8
- [constants_1.METHOD_METADATA]: request_method_enum_1.RequestMethod.GET,
4
+ [PATH_METADATA]: '/',
5
+ [METHOD_METADATA]: RequestMethod.GET,
9
6
  };
10
- const RequestMapping = (metadata = defaultMetadata) => {
11
- const pathMetadata = metadata[constants_1.PATH_METADATA];
7
+ export const RequestMapping = (metadata = defaultMetadata) => {
8
+ const pathMetadata = metadata[PATH_METADATA];
12
9
  const path = pathMetadata && pathMetadata.length ? pathMetadata : '/';
13
- const requestMethod = metadata[constants_1.METHOD_METADATA] || request_method_enum_1.RequestMethod.GET;
10
+ const requestMethod = metadata[METHOD_METADATA] || RequestMethod.GET;
14
11
  return (target, key, descriptor) => {
15
- Reflect.defineMetadata(constants_1.PATH_METADATA, path, descriptor.value);
16
- Reflect.defineMetadata(constants_1.METHOD_METADATA, requestMethod, descriptor.value);
12
+ Reflect.defineMetadata(PATH_METADATA, path, descriptor.value);
13
+ Reflect.defineMetadata(METHOD_METADATA, requestMethod, descriptor.value);
17
14
  return descriptor;
18
15
  };
19
16
  };
20
- exports.RequestMapping = RequestMapping;
21
17
  const createMappingDecorator = (method) => (path) => {
22
- return (0, exports.RequestMapping)({
23
- [constants_1.PATH_METADATA]: path,
24
- [constants_1.METHOD_METADATA]: method,
18
+ return RequestMapping({
19
+ [PATH_METADATA]: path,
20
+ [METHOD_METADATA]: method,
25
21
  });
26
22
  };
27
23
  /**
@@ -31,7 +27,7 @@ const createMappingDecorator = (method) => (path) => {
31
27
  *
32
28
  * @publicApi
33
29
  */
34
- exports.Post = createMappingDecorator(request_method_enum_1.RequestMethod.POST);
30
+ export const Post = createMappingDecorator(RequestMethod.POST);
35
31
  /**
36
32
  * Route handler (method) Decorator. Routes HTTP GET requests to the specified path.
37
33
  *
@@ -39,7 +35,7 @@ exports.Post = createMappingDecorator(request_method_enum_1.RequestMethod.POST);
39
35
  *
40
36
  * @publicApi
41
37
  */
42
- exports.Get = createMappingDecorator(request_method_enum_1.RequestMethod.GET);
38
+ export const Get = createMappingDecorator(RequestMethod.GET);
43
39
  /**
44
40
  * Route handler (method) Decorator. Routes HTTP DELETE requests to the specified path.
45
41
  *
@@ -47,7 +43,7 @@ exports.Get = createMappingDecorator(request_method_enum_1.RequestMethod.GET);
47
43
  *
48
44
  * @publicApi
49
45
  */
50
- exports.Delete = createMappingDecorator(request_method_enum_1.RequestMethod.DELETE);
46
+ export const Delete = createMappingDecorator(RequestMethod.DELETE);
51
47
  /**
52
48
  * Route handler (method) Decorator. Routes HTTP PUT requests to the specified path.
53
49
  *
@@ -55,7 +51,7 @@ exports.Delete = createMappingDecorator(request_method_enum_1.RequestMethod.DELE
55
51
  *
56
52
  * @publicApi
57
53
  */
58
- exports.Put = createMappingDecorator(request_method_enum_1.RequestMethod.PUT);
54
+ export const Put = createMappingDecorator(RequestMethod.PUT);
59
55
  /**
60
56
  * Route handler (method) Decorator. Routes HTTP PATCH requests to the specified path.
61
57
  *
@@ -63,7 +59,7 @@ exports.Put = createMappingDecorator(request_method_enum_1.RequestMethod.PUT);
63
59
  *
64
60
  * @publicApi
65
61
  */
66
- exports.Patch = createMappingDecorator(request_method_enum_1.RequestMethod.PATCH);
62
+ export const Patch = createMappingDecorator(RequestMethod.PATCH);
67
63
  /**
68
64
  * Route handler (method) Decorator. Routes HTTP OPTIONS requests to the specified path.
69
65
  *
@@ -71,7 +67,7 @@ exports.Patch = createMappingDecorator(request_method_enum_1.RequestMethod.PATCH
71
67
  *
72
68
  * @publicApi
73
69
  */
74
- exports.Options = createMappingDecorator(request_method_enum_1.RequestMethod.OPTIONS);
70
+ export const Options = createMappingDecorator(RequestMethod.OPTIONS);
75
71
  /**
76
72
  * Route handler (method) Decorator. Routes HTTP HEAD requests to the specified path.
77
73
  *
@@ -79,7 +75,7 @@ exports.Options = createMappingDecorator(request_method_enum_1.RequestMethod.OPT
79
75
  *
80
76
  * @publicApi
81
77
  */
82
- exports.Head = createMappingDecorator(request_method_enum_1.RequestMethod.HEAD);
78
+ export const Head = createMappingDecorator(RequestMethod.HEAD);
83
79
  /**
84
80
  * Route handler (method) Decorator. Routes all HTTP requests to the specified path.
85
81
  *
@@ -87,7 +83,7 @@ exports.Head = createMappingDecorator(request_method_enum_1.RequestMethod.HEAD);
87
83
  *
88
84
  * @publicApi
89
85
  */
90
- exports.All = createMappingDecorator(request_method_enum_1.RequestMethod.ALL);
86
+ export const All = createMappingDecorator(RequestMethod.ALL);
91
87
  /**
92
88
  * Route handler (method) Decorator. Routes HTTP SEARCH requests to the specified path.
93
89
  *
@@ -95,7 +91,7 @@ exports.All = createMappingDecorator(request_method_enum_1.RequestMethod.ALL);
95
91
  *
96
92
  * @publicApi
97
93
  */
98
- exports.Search = createMappingDecorator(request_method_enum_1.RequestMethod.SEARCH);
94
+ export const Search = createMappingDecorator(RequestMethod.SEARCH);
99
95
  /**
100
96
  * Route handler (method) Decorator. Routes HTTP QUERY requests to the specified path.
101
97
  *
@@ -106,7 +102,7 @@ exports.Search = createMappingDecorator(request_method_enum_1.RequestMethod.SEAR
106
102
  *
107
103
  * @publicApi
108
104
  */
109
- exports.QueryMethod = createMappingDecorator(request_method_enum_1.RequestMethod.QUERY);
105
+ export const QueryMethod = createMappingDecorator(RequestMethod.QUERY);
110
106
  /**
111
107
  * Route handler (method) Decorator. Routes Webdav PROPFIND requests to the specified path.
112
108
  *
@@ -114,7 +110,7 @@ exports.QueryMethod = createMappingDecorator(request_method_enum_1.RequestMethod
114
110
  *
115
111
  * @publicApi
116
112
  */
117
- exports.Propfind = createMappingDecorator(request_method_enum_1.RequestMethod.PROPFIND);
113
+ export const Propfind = createMappingDecorator(RequestMethod.PROPFIND);
118
114
  /**
119
115
  * Route handler (method) Decorator. Routes Webdav PROPPATCH requests to the specified path.
120
116
  *
@@ -122,7 +118,7 @@ exports.Propfind = createMappingDecorator(request_method_enum_1.RequestMethod.PR
122
118
  *
123
119
  * @publicApi
124
120
  */
125
- exports.Proppatch = createMappingDecorator(request_method_enum_1.RequestMethod.PROPPATCH);
121
+ export const Proppatch = createMappingDecorator(RequestMethod.PROPPATCH);
126
122
  /**
127
123
  * Route handler (method) Decorator. Routes Webdav MKCOL requests to the specified path.
128
124
  *
@@ -130,7 +126,7 @@ exports.Proppatch = createMappingDecorator(request_method_enum_1.RequestMethod.P
130
126
  *
131
127
  * @publicApi
132
128
  */
133
- exports.Mkcol = createMappingDecorator(request_method_enum_1.RequestMethod.MKCOL);
129
+ export const Mkcol = createMappingDecorator(RequestMethod.MKCOL);
134
130
  /**
135
131
  * Route handler (method) Decorator. Routes Webdav COPY requests to the specified path.
136
132
  *
@@ -138,7 +134,7 @@ exports.Mkcol = createMappingDecorator(request_method_enum_1.RequestMethod.MKCOL
138
134
  *
139
135
  * @publicApi
140
136
  */
141
- exports.Copy = createMappingDecorator(request_method_enum_1.RequestMethod.COPY);
137
+ export const Copy = createMappingDecorator(RequestMethod.COPY);
142
138
  /**
143
139
  * Route handler (method) Decorator. Routes Webdav MOVE requests to the specified path.
144
140
  *
@@ -146,7 +142,7 @@ exports.Copy = createMappingDecorator(request_method_enum_1.RequestMethod.COPY);
146
142
  *
147
143
  * @publicApi
148
144
  */
149
- exports.Move = createMappingDecorator(request_method_enum_1.RequestMethod.MOVE);
145
+ export const Move = createMappingDecorator(RequestMethod.MOVE);
150
146
  /**
151
147
  * Route handler (method) Decorator. Routes Webdav LOCK requests to the specified path.
152
148
  *
@@ -154,7 +150,7 @@ exports.Move = createMappingDecorator(request_method_enum_1.RequestMethod.MOVE);
154
150
  *
155
151
  * @publicApi
156
152
  */
157
- exports.Lock = createMappingDecorator(request_method_enum_1.RequestMethod.LOCK);
153
+ export const Lock = createMappingDecorator(RequestMethod.LOCK);
158
154
  /**
159
155
  * Route handler (method) Decorator. Routes Webdav UNLOCK requests to the specified path.
160
156
  *
@@ -162,4 +158,4 @@ exports.Lock = createMappingDecorator(request_method_enum_1.RequestMethod.LOCK);
162
158
  *
163
159
  * @publicApi
164
160
  */
165
- exports.Unlock = createMappingDecorator(request_method_enum_1.RequestMethod.UNLOCK);
161
+ export const Unlock = createMappingDecorator(RequestMethod.UNLOCK);