@nestjs/common 11.1.16 → 12.0.0-alpha.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 (329) hide show
  1. package/constants.js +35 -38
  2. package/decorators/core/apply-decorators.js +1 -4
  3. package/decorators/core/bind.decorator.js +1 -4
  4. package/decorators/core/catch.decorator.d.ts +1 -1
  5. package/decorators/core/catch.decorator.js +4 -7
  6. package/decorators/core/controller.decorator.d.ts +1 -1
  7. package/decorators/core/controller.decorator.js +10 -13
  8. package/decorators/core/dependencies.decorator.js +4 -9
  9. package/decorators/core/exception-filters.decorator.d.ts +1 -1
  10. package/decorators/core/exception-filters.decorator.js +10 -14
  11. package/decorators/core/index.d.ts +14 -14
  12. package/decorators/core/index.js +14 -17
  13. package/decorators/core/inject.decorator.d.ts +1 -1
  14. package/decorators/core/inject.decorator.js +9 -12
  15. package/decorators/core/injectable.decorator.d.ts +2 -2
  16. package/decorators/core/injectable.decorator.js +7 -11
  17. package/decorators/core/optional.decorator.js +8 -11
  18. package/decorators/core/set-metadata.decorator.js +1 -5
  19. package/decorators/core/use-guards.decorator.d.ts +1 -1
  20. package/decorators/core/use-guards.decorator.js +10 -13
  21. package/decorators/core/use-interceptors.decorator.d.ts +1 -1
  22. package/decorators/core/use-interceptors.decorator.js +10 -13
  23. package/decorators/core/use-pipes.decorator.d.ts +1 -1
  24. package/decorators/core/use-pipes.decorator.js +9 -12
  25. package/decorators/core/version.decorator.d.ts +1 -1
  26. package/decorators/core/version.decorator.js +3 -6
  27. package/decorators/http/create-route-param-metadata.decorator.d.ts +6 -5
  28. package/decorators/http/create-route-param-metadata.decorator.js +48 -16
  29. package/decorators/http/header.decorator.js +4 -7
  30. package/decorators/http/http-code.decorator.js +3 -6
  31. package/decorators/http/index.d.ts +8 -8
  32. package/decorators/http/index.js +8 -11
  33. package/decorators/http/redirect.decorator.js +3 -6
  34. package/decorators/http/render.decorator.js +3 -6
  35. package/decorators/http/request-mapping.decorator.d.ts +1 -1
  36. package/decorators/http/request-mapping.decorator.js +28 -32
  37. package/decorators/http/route-params.decorator.d.ts +153 -3
  38. package/decorators/http/route-params.decorator.js +124 -49
  39. package/decorators/http/sse.decorator.d.ts +2 -2
  40. package/decorators/http/sse.decorator.js +7 -10
  41. package/decorators/index.d.ts +3 -3
  42. package/decorators/index.js +3 -6
  43. package/decorators/modules/global.decorator.js +3 -6
  44. package/decorators/modules/index.d.ts +2 -2
  45. package/decorators/modules/index.js +2 -5
  46. package/decorators/modules/module.decorator.d.ts +1 -1
  47. package/decorators/modules/module.decorator.js +3 -6
  48. package/enums/http-status.enum.js +2 -5
  49. package/enums/index.d.ts +4 -4
  50. package/enums/index.js +4 -7
  51. package/enums/request-method.enum.js +2 -5
  52. package/enums/route-paramtypes.enum.js +2 -5
  53. package/enums/shutdown-signal.enum.js +2 -5
  54. package/enums/version-type.enum.js +2 -5
  55. package/exceptions/bad-gateway.exception.d.ts +1 -1
  56. package/exceptions/bad-gateway.exception.js +5 -9
  57. package/exceptions/bad-request.exception.d.ts +1 -1
  58. package/exceptions/bad-request.exception.js +5 -9
  59. package/exceptions/conflict.exception.d.ts +1 -1
  60. package/exceptions/conflict.exception.js +5 -9
  61. package/exceptions/forbidden.exception.d.ts +1 -1
  62. package/exceptions/forbidden.exception.js +5 -9
  63. package/exceptions/gateway-timeout.exception.d.ts +1 -1
  64. package/exceptions/gateway-timeout.exception.js +5 -9
  65. package/exceptions/gone.exception.d.ts +1 -1
  66. package/exceptions/gone.exception.js +5 -9
  67. package/exceptions/http-version-not-supported.exception.d.ts +1 -1
  68. package/exceptions/http-version-not-supported.exception.js +5 -9
  69. package/exceptions/http.exception.d.ts +6 -2
  70. package/exceptions/http.exception.js +36 -17
  71. package/exceptions/im-a-teapot.exception.d.ts +1 -1
  72. package/exceptions/im-a-teapot.exception.js +5 -9
  73. package/exceptions/index.d.ts +23 -23
  74. package/exceptions/index.js +23 -26
  75. package/exceptions/internal-server-error.exception.d.ts +1 -1
  76. package/exceptions/internal-server-error.exception.js +5 -9
  77. package/exceptions/intrinsic.exception.js +1 -5
  78. package/exceptions/method-not-allowed.exception.d.ts +1 -1
  79. package/exceptions/method-not-allowed.exception.js +5 -9
  80. package/exceptions/misdirected.exception.d.ts +1 -1
  81. package/exceptions/misdirected.exception.js +5 -9
  82. package/exceptions/not-acceptable.exception.d.ts +1 -1
  83. package/exceptions/not-acceptable.exception.js +5 -9
  84. package/exceptions/not-found.exception.d.ts +1 -1
  85. package/exceptions/not-found.exception.js +5 -9
  86. package/exceptions/not-implemented.exception.d.ts +1 -1
  87. package/exceptions/not-implemented.exception.js +5 -9
  88. package/exceptions/payload-too-large.exception.d.ts +1 -1
  89. package/exceptions/payload-too-large.exception.js +5 -9
  90. package/exceptions/precondition-failed.exception.d.ts +1 -1
  91. package/exceptions/precondition-failed.exception.js +5 -9
  92. package/exceptions/request-timeout.exception.d.ts +1 -1
  93. package/exceptions/request-timeout.exception.js +5 -9
  94. package/exceptions/service-unavailable.exception.d.ts +1 -1
  95. package/exceptions/service-unavailable.exception.js +5 -9
  96. package/exceptions/unauthorized.exception.d.ts +1 -1
  97. package/exceptions/unauthorized.exception.js +5 -9
  98. package/exceptions/unprocessable-entity.exception.d.ts +1 -1
  99. package/exceptions/unprocessable-entity.exception.js +5 -9
  100. package/exceptions/unsupported-media-type.exception.d.ts +1 -1
  101. package/exceptions/unsupported-media-type.exception.js +5 -9
  102. package/file-stream/index.d.ts +1 -1
  103. package/file-stream/index.js +1 -4
  104. package/file-stream/interfaces/index.d.ts +2 -2
  105. package/file-stream/interfaces/index.js +2 -5
  106. package/file-stream/interfaces/streamable-handler-response.interface.js +1 -2
  107. package/file-stream/interfaces/streamable-options.interface.js +1 -2
  108. package/file-stream/streamable-file.d.ts +2 -2
  109. package/file-stream/streamable-file.js +26 -28
  110. package/index.d.ts +10 -10
  111. package/index.js +11 -17
  112. package/interfaces/abstract.interface.js +1 -2
  113. package/interfaces/controllers/controller-metadata.interface.js +1 -2
  114. package/interfaces/controllers/controller.interface.js +1 -2
  115. package/interfaces/controllers/index.d.ts +2 -2
  116. package/interfaces/controllers/index.js +2 -5
  117. package/interfaces/exceptions/exception-filter-metadata.interface.d.ts +2 -2
  118. package/interfaces/exceptions/exception-filter-metadata.interface.js +1 -2
  119. package/interfaces/exceptions/exception-filter.interface.d.ts +1 -1
  120. package/interfaces/exceptions/exception-filter.interface.js +1 -2
  121. package/interfaces/exceptions/index.d.ts +5 -5
  122. package/interfaces/exceptions/index.js +5 -8
  123. package/interfaces/exceptions/rpc-exception-filter-metadata.interface.d.ts +2 -2
  124. package/interfaces/exceptions/rpc-exception-filter-metadata.interface.js +1 -2
  125. package/interfaces/exceptions/rpc-exception-filter.interface.d.ts +1 -1
  126. package/interfaces/exceptions/rpc-exception-filter.interface.js +1 -2
  127. package/interfaces/exceptions/ws-exception-filter.interface.d.ts +1 -1
  128. package/interfaces/exceptions/ws-exception-filter.interface.js +1 -2
  129. package/interfaces/external/class-transform-options.interface.js +1 -2
  130. package/interfaces/external/cors-options.interface.js +1 -2
  131. package/interfaces/external/https-options.interface.js +1 -2
  132. package/interfaces/external/transformer-package.interface.d.ts +2 -2
  133. package/interfaces/external/transformer-package.interface.js +1 -2
  134. package/interfaces/external/validation-error.interface.js +1 -2
  135. package/interfaces/external/validator-options.interface.js +1 -2
  136. package/interfaces/external/validator-package.interface.d.ts +2 -2
  137. package/interfaces/external/validator-package.interface.js +1 -2
  138. package/interfaces/features/arguments-host.interface.js +1 -2
  139. package/interfaces/features/can-activate.interface.d.ts +1 -1
  140. package/interfaces/features/can-activate.interface.js +1 -2
  141. package/interfaces/features/custom-route-param-factory.interface.d.ts +1 -1
  142. package/interfaces/features/custom-route-param-factory.interface.js +1 -2
  143. package/interfaces/features/execution-context.interface.d.ts +2 -2
  144. package/interfaces/features/execution-context.interface.js +1 -2
  145. package/interfaces/features/nest-interceptor.interface.d.ts +1 -1
  146. package/interfaces/features/nest-interceptor.interface.js +1 -2
  147. package/interfaces/features/paramtype.interface.js +1 -2
  148. package/interfaces/features/pipe-transform.interface.d.ts +10 -4
  149. package/interfaces/features/pipe-transform.interface.js +1 -2
  150. package/interfaces/global-prefix-options.interface.d.ts +1 -1
  151. package/interfaces/global-prefix-options.interface.js +1 -2
  152. package/interfaces/hooks/before-application-shutdown.interface.js +1 -2
  153. package/interfaces/hooks/index.d.ts +5 -5
  154. package/interfaces/hooks/index.js +5 -8
  155. package/interfaces/hooks/on-application-bootstrap.interface.js +1 -2
  156. package/interfaces/hooks/on-application-shutdown.interface.js +1 -2
  157. package/interfaces/hooks/on-destroy.interface.js +1 -2
  158. package/interfaces/hooks/on-init.interface.js +1 -2
  159. package/interfaces/http/http-exception-body.interface.d.ts +2 -1
  160. package/interfaces/http/http-exception-body.interface.js +1 -2
  161. package/interfaces/http/http-redirect-response.interface.d.ts +1 -1
  162. package/interfaces/http/http-redirect-response.interface.js +1 -2
  163. package/interfaces/http/http-server.interface.d.ts +4 -3
  164. package/interfaces/http/http-server.interface.js +1 -2
  165. package/interfaces/http/index.d.ts +5 -5
  166. package/interfaces/http/index.js +5 -8
  167. package/interfaces/http/message-event.interface.js +1 -2
  168. package/interfaces/http/raw-body-request.interface.js +1 -2
  169. package/interfaces/index.d.ts +31 -30
  170. package/interfaces/index.js +31 -33
  171. package/interfaces/injectable.interface.js +1 -2
  172. package/interfaces/microservices/nest-hybrid-application-options.interface.js +1 -2
  173. package/interfaces/microservices/nest-microservice-options.interface.d.ts +1 -1
  174. package/interfaces/microservices/nest-microservice-options.interface.js +1 -2
  175. package/interfaces/microservices/pre-request-hook.interface.d.ts +22 -0
  176. package/interfaces/microservices/pre-request-hook.interface.js +1 -0
  177. package/interfaces/middleware/index.d.ts +4 -4
  178. package/interfaces/middleware/index.js +4 -7
  179. package/interfaces/middleware/middleware-config-proxy.interface.d.ts +3 -3
  180. package/interfaces/middleware/middleware-config-proxy.interface.js +1 -2
  181. package/interfaces/middleware/middleware-configuration.interface.d.ts +3 -3
  182. package/interfaces/middleware/middleware-configuration.interface.js +1 -2
  183. package/interfaces/middleware/middleware-consumer.interface.d.ts +2 -2
  184. package/interfaces/middleware/middleware-consumer.interface.js +1 -2
  185. package/interfaces/middleware/nest-middleware.interface.js +1 -2
  186. package/interfaces/modules/dynamic-module.interface.d.ts +2 -2
  187. package/interfaces/modules/dynamic-module.interface.js +1 -2
  188. package/interfaces/modules/forward-reference.interface.js +1 -2
  189. package/interfaces/modules/index.d.ts +8 -8
  190. package/interfaces/modules/index.js +8 -11
  191. package/interfaces/modules/injection-token.interface.d.ts +2 -2
  192. package/interfaces/modules/injection-token.interface.js +1 -2
  193. package/interfaces/modules/introspection-result.interface.d.ts +1 -1
  194. package/interfaces/modules/introspection-result.interface.js +1 -2
  195. package/interfaces/modules/module-metadata.interface.d.ts +5 -5
  196. package/interfaces/modules/module-metadata.interface.js +1 -2
  197. package/interfaces/modules/nest-module.interface.d.ts +1 -1
  198. package/interfaces/modules/nest-module.interface.js +1 -2
  199. package/interfaces/modules/optional-factory-dependency.interface.d.ts +1 -1
  200. package/interfaces/modules/optional-factory-dependency.interface.js +1 -2
  201. package/interfaces/modules/provider.interface.d.ts +4 -4
  202. package/interfaces/modules/provider.interface.js +1 -2
  203. package/interfaces/nest-application-context-options.interface.d.ts +1 -1
  204. package/interfaces/nest-application-context-options.interface.js +55 -5
  205. package/interfaces/nest-application-context.interface.d.ts +6 -6
  206. package/interfaces/nest-application-context.interface.js +1 -2
  207. package/interfaces/nest-application-options.interface.d.ts +9 -3
  208. package/interfaces/nest-application-options.interface.js +1 -2
  209. package/interfaces/nest-application.interface.d.ts +8 -8
  210. package/interfaces/nest-application.interface.js +1 -2
  211. package/interfaces/nest-microservice.interface.d.ts +15 -6
  212. package/interfaces/nest-microservice.interface.js +1 -2
  213. package/interfaces/scope-options.interface.js +2 -5
  214. package/interfaces/shutdown-hooks-options.interface.js +1 -2
  215. package/interfaces/type.interface.js +1 -2
  216. package/interfaces/version-options.interface.d.ts +1 -1
  217. package/interfaces/version-options.interface.js +1 -4
  218. package/interfaces/websockets/web-socket-adapter.interface.js +1 -2
  219. package/internal.d.ts +30 -0
  220. package/internal.js +19 -0
  221. package/module-utils/configurable-module.builder.d.ts +4 -4
  222. package/module-utils/configurable-module.builder.js +21 -20
  223. package/module-utils/constants.js +5 -8
  224. package/module-utils/index.d.ts +2 -2
  225. package/module-utils/index.js +2 -5
  226. package/module-utils/interfaces/configurable-module-async-options.interface.d.ts +2 -2
  227. package/module-utils/interfaces/configurable-module-async-options.interface.js +1 -2
  228. package/module-utils/interfaces/configurable-module-cls.interface.d.ts +3 -3
  229. package/module-utils/interfaces/configurable-module-cls.interface.js +1 -2
  230. package/module-utils/interfaces/configurable-module-host.interface.d.ts +2 -2
  231. package/module-utils/interfaces/configurable-module-host.interface.js +1 -2
  232. package/module-utils/interfaces/index.d.ts +3 -3
  233. package/module-utils/interfaces/index.js +3 -6
  234. package/module-utils/utils/generate-options-injection-token.util.js +3 -6
  235. package/module-utils/utils/get-injection-providers.util.d.ts +1 -1
  236. package/module-utils/utils/get-injection-providers.util.js +4 -7
  237. package/module-utils/utils/index.d.ts +2 -2
  238. package/module-utils/utils/index.js +2 -5
  239. package/package.json +35 -2
  240. package/pipes/default-value.pipe.d.ts +1 -1
  241. package/pipes/default-value.pipe.js +10 -12
  242. package/pipes/file/file-type.validator.d.ts +3 -3
  243. package/pipes/file/file-type.validator.js +5 -19
  244. package/pipes/file/file-validator-context.interface.d.ts +1 -1
  245. package/pipes/file/file-validator-context.interface.js +1 -2
  246. package/pipes/file/file-validator.interface.d.ts +1 -1
  247. package/pipes/file/file-validator.interface.js +2 -5
  248. package/pipes/file/index.d.ts +6 -6
  249. package/pipes/file/index.js +6 -9
  250. package/pipes/file/interfaces/file.interface.js +1 -2
  251. package/pipes/file/interfaces/index.d.ts +1 -1
  252. package/pipes/file/interfaces/index.js +1 -4
  253. package/pipes/file/max-file-size.validator.d.ts +3 -3
  254. package/pipes/file/max-file-size.validator.js +2 -6
  255. package/pipes/file/parse-file-options.interface.d.ts +2 -2
  256. package/pipes/file/parse-file-options.interface.js +1 -2
  257. package/pipes/file/parse-file-pipe.builder.d.ts +5 -5
  258. package/pipes/file/parse-file-pipe.builder.js +8 -14
  259. package/pipes/file/parse-file.pipe.d.ts +7 -7
  260. package/pipes/file/parse-file.pipe.js +17 -18
  261. package/pipes/index.d.ts +11 -10
  262. package/pipes/index.js +11 -13
  263. package/pipes/parse-array.pipe.d.ts +4 -4
  264. package/pipes/parse-array.pipe.js +23 -23
  265. package/pipes/parse-bool.pipe.d.ts +6 -6
  266. package/pipes/parse-bool.pipe.js +16 -17
  267. package/pipes/parse-date.pipe.d.ts +4 -4
  268. package/pipes/parse-date.pipe.js +17 -16
  269. package/pipes/parse-enum.pipe.d.ts +5 -5
  270. package/pipes/parse-enum.pipe.js +16 -16
  271. package/pipes/parse-float.pipe.d.ts +6 -6
  272. package/pipes/parse-float.pipe.js +17 -18
  273. package/pipes/parse-int.pipe.d.ts +5 -5
  274. package/pipes/parse-int.pipe.js +18 -19
  275. package/pipes/parse-uuid.pipe.d.ts +4 -4
  276. package/pipes/parse-uuid.pipe.js +27 -26
  277. package/pipes/standard-schema-validation.pipe.d.ts +86 -0
  278. package/pipes/standard-schema-validation.pipe.js +120 -0
  279. package/pipes/validation.pipe.d.ts +32 -14
  280. package/pipes/validation.pipe.js +60 -30
  281. package/serializer/class-serializer.constants.js +1 -4
  282. package/serializer/class-serializer.interceptor.d.ts +5 -5
  283. package/serializer/class-serializer.interceptor.js +21 -24
  284. package/serializer/class-serializer.interfaces.d.ts +2 -2
  285. package/serializer/class-serializer.interfaces.js +1 -2
  286. package/serializer/decorators/index.d.ts +1 -1
  287. package/serializer/decorators/index.js +1 -4
  288. package/serializer/decorators/serialize-options.decorator.d.ts +3 -2
  289. package/serializer/decorators/serialize-options.decorator.js +3 -7
  290. package/serializer/index.d.ts +5 -3
  291. package/serializer/index.js +5 -6
  292. package/serializer/standard-schema-serializer.interceptor.d.ts +50 -0
  293. package/serializer/standard-schema-serializer.interceptor.js +75 -0
  294. package/serializer/standard-schema-serializer.interfaces.d.ts +18 -0
  295. package/serializer/standard-schema-serializer.interfaces.js +1 -0
  296. package/services/console-logger.service.d.ts +22 -3
  297. package/services/console-logger.service.js +132 -66
  298. package/services/index.d.ts +3 -3
  299. package/services/index.js +3 -6
  300. package/services/logger.service.js +86 -83
  301. package/services/utils/filter-log-levels.util.d.ts +1 -1
  302. package/services/utils/filter-log-levels.util.js +7 -10
  303. package/services/utils/index.d.ts +3 -3
  304. package/services/utils/index.js +3 -6
  305. package/services/utils/is-log-level-enabled.util.d.ts +1 -1
  306. package/services/utils/is-log-level-enabled.util.js +1 -4
  307. package/services/utils/is-log-level.util.d.ts +1 -1
  308. package/services/utils/is-log-level.util.js +3 -6
  309. package/tsconfig.build.json +1 -2
  310. package/utils/assign-custom-metadata.util.d.ts +5 -4
  311. package/utils/assign-custom-metadata.util.js +4 -6
  312. package/utils/cli-colors.util.js +4 -8
  313. package/utils/extend-metadata.util.js +1 -4
  314. package/utils/forward-ref.util.d.ts +1 -1
  315. package/utils/forward-ref.util.js +1 -5
  316. package/utils/http-error-by-code.util.d.ts +2 -2
  317. package/utils/http-error-by-code.util.js +22 -25
  318. package/utils/index.d.ts +1 -1
  319. package/utils/index.js +1 -4
  320. package/utils/load-package.util.d.ts +21 -1
  321. package/utils/load-package.util.js +62 -8
  322. package/utils/merge-with-values.util.js +1 -5
  323. package/utils/random-string-generator.util.js +2 -6
  324. package/utils/select-exception-filter-metadata.util.d.ts +1 -1
  325. package/utils/select-exception-filter-metadata.util.js +1 -5
  326. package/utils/shared.utils.d.ts +11 -10
  327. package/utils/shared.utils.js +28 -30
  328. package/utils/validate-each.util.js +3 -7
  329. package/utils/validate-module-keys.util.js +8 -13
@@ -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,64 @@
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';
8
5
  /**
9
- * Defines HTTP route param decorator
6
+ * Defines route param decorator
10
7
  *
11
8
  * @param factory
12
9
  * @param enhancers
13
10
  *
14
11
  * @publicApi
15
12
  */
16
- function createParamDecorator(factory, enhancers = []) {
17
- const paramtype = (0, uid_1.uid)(21);
13
+ export function createParamDecorator(factory, enhancers = []) {
14
+ const paramtype = uid(21);
18
15
  return (data, ...pipes) => (target, key, index) => {
19
- const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) ||
16
+ const args = Reflect.getMetadata(ROUTE_ARGS_METADATA, target.constructor, key) ||
20
17
  {};
21
18
  const isPipe = (pipe) => pipe &&
22
- (((0, shared_utils_1.isFunction)(pipe) &&
19
+ ((isFunction(pipe) &&
23
20
  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);
21
+ isFunction(pipe.prototype.transform)) ||
22
+ isFunction(pipe.transform));
23
+ const isParameterDecoratorOptions = (value) => value &&
24
+ typeof value === 'object' &&
25
+ !isPipe(value) &&
26
+ ('schema' in value || 'pipes' in value);
27
+ const hasParamData = isNil(data) || !isPipe(data);
27
28
  const paramData = hasParamData ? data : undefined;
28
29
  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);
30
+ // Check if data itself is an options object (when used as the first and only argument)
31
+ const isDataOptions = hasParamData &&
32
+ !isNil(data) &&
33
+ paramPipes.length === 0 &&
34
+ isParameterDecoratorOptions(data);
35
+ // Check if the last pipe argument is actually an options object
36
+ const lastPipeArg = paramPipes.length > 0 ? paramPipes[paramPipes.length - 1] : undefined;
37
+ const isLastPipeOptions = !isDataOptions && isParameterDecoratorOptions(lastPipeArg);
38
+ let finalData;
39
+ let finalSchema;
40
+ let finalPipes;
41
+ if (isDataOptions) {
42
+ const opts = data;
43
+ finalData = undefined;
44
+ finalSchema = opts.schema;
45
+ finalPipes = (opts.pipes ?? []);
46
+ }
47
+ else if (isLastPipeOptions) {
48
+ const opts = lastPipeArg;
49
+ finalData = paramData;
50
+ finalSchema = opts.schema;
51
+ finalPipes = [
52
+ ...paramPipes.slice(0, -1),
53
+ ...(opts.pipes ?? []),
54
+ ];
55
+ }
56
+ else {
57
+ finalData = paramData;
58
+ finalSchema = undefined;
59
+ finalPipes = paramPipes;
60
+ }
61
+ Reflect.defineMetadata(ROUTE_ARGS_METADATA, assignCustomParameterMetadata(args, paramtype, index, factory, finalData, finalSchema, ...finalPipes), target.constructor, key);
30
62
  enhancers.forEach(fn => fn(target, key, index));
31
63
  };
32
64
  }
@@ -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,8 +1,8 @@
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';
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';
@@ -1,11 +1,8 @@
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);
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';
@@ -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.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 Webdav PROPFIND requests to the specified path.
101
97
  *
@@ -103,7 +99,7 @@ exports.Search = createMappingDecorator(request_method_enum_1.RequestMethod.SEAR
103
99
  *
104
100
  * @publicApi
105
101
  */
106
- exports.Propfind = createMappingDecorator(request_method_enum_1.RequestMethod.PROPFIND);
102
+ export const Propfind = createMappingDecorator(RequestMethod.PROPFIND);
107
103
  /**
108
104
  * Route handler (method) Decorator. Routes Webdav PROPPATCH requests to the specified path.
109
105
  *
@@ -111,7 +107,7 @@ exports.Propfind = createMappingDecorator(request_method_enum_1.RequestMethod.PR
111
107
  *
112
108
  * @publicApi
113
109
  */
114
- exports.Proppatch = createMappingDecorator(request_method_enum_1.RequestMethod.PROPPATCH);
110
+ export const Proppatch = createMappingDecorator(RequestMethod.PROPPATCH);
115
111
  /**
116
112
  * Route handler (method) Decorator. Routes Webdav MKCOL requests to the specified path.
117
113
  *
@@ -119,7 +115,7 @@ exports.Proppatch = createMappingDecorator(request_method_enum_1.RequestMethod.P
119
115
  *
120
116
  * @publicApi
121
117
  */
122
- exports.Mkcol = createMappingDecorator(request_method_enum_1.RequestMethod.MKCOL);
118
+ export const Mkcol = createMappingDecorator(RequestMethod.MKCOL);
123
119
  /**
124
120
  * Route handler (method) Decorator. Routes Webdav COPY requests to the specified path.
125
121
  *
@@ -127,7 +123,7 @@ exports.Mkcol = createMappingDecorator(request_method_enum_1.RequestMethod.MKCOL
127
123
  *
128
124
  * @publicApi
129
125
  */
130
- exports.Copy = createMappingDecorator(request_method_enum_1.RequestMethod.COPY);
126
+ export const Copy = createMappingDecorator(RequestMethod.COPY);
131
127
  /**
132
128
  * Route handler (method) Decorator. Routes Webdav MOVE requests to the specified path.
133
129
  *
@@ -135,7 +131,7 @@ exports.Copy = createMappingDecorator(request_method_enum_1.RequestMethod.COPY);
135
131
  *
136
132
  * @publicApi
137
133
  */
138
- exports.Move = createMappingDecorator(request_method_enum_1.RequestMethod.MOVE);
134
+ export const Move = createMappingDecorator(RequestMethod.MOVE);
139
135
  /**
140
136
  * Route handler (method) Decorator. Routes Webdav LOCK requests to the specified path.
141
137
  *
@@ -143,7 +139,7 @@ exports.Move = createMappingDecorator(request_method_enum_1.RequestMethod.MOVE);
143
139
  *
144
140
  * @publicApi
145
141
  */
146
- exports.Lock = createMappingDecorator(request_method_enum_1.RequestMethod.LOCK);
142
+ export const Lock = createMappingDecorator(RequestMethod.LOCK);
147
143
  /**
148
144
  * Route handler (method) Decorator. Routes Webdav UNLOCK requests to the specified path.
149
145
  *
@@ -151,4 +147,4 @@ exports.Lock = createMappingDecorator(request_method_enum_1.RequestMethod.LOCK);
151
147
  *
152
148
  * @publicApi
153
149
  */
154
- exports.Unlock = createMappingDecorator(request_method_enum_1.RequestMethod.UNLOCK);
150
+ export const Unlock = createMappingDecorator(RequestMethod.UNLOCK);
@@ -1,5 +1,21 @@
1
- import { PipeTransform } from '../../index';
2
- import { Type } from '../../interfaces';
1
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
2
+ import { PipeTransform } from '../../index.js';
3
+ import { Type } from '../../interfaces/index.js';
4
+ /**
5
+ * The options that can be passed to a handler's parameter decorator, such as `@Query()`, `@Body()`, and others.
6
+ * These options allow you to specify a schema for validation and transformation, as well as any pipes to apply to the parameter.
7
+ */
8
+ export interface ParameterDecoratorOptions {
9
+ /**
10
+ * The schema to use to retrieve within the pipes,
11
+ * to, for example, validate the parameter against the schema or to apply transformations based on the schema.
12
+ */
13
+ schema?: StandardSchemaV1;
14
+ /**
15
+ * The list of pipes to apply to the parameter.
16
+ */
17
+ pipes?: (Type<PipeTransform> | PipeTransform)[];
18
+ }
3
19
  /**
4
20
  * The `@Response()`/`@Res` parameter decorator options.
5
21
  */
@@ -18,8 +34,11 @@ export interface RouteParamMetadata {
18
34
  index: number;
19
35
  data?: ParamData;
20
36
  }
21
- export declare function assignMetadata<TParamtype = any, TArgs = any>(args: TArgs, paramtype: TParamtype, index: number, data?: ParamData, ...pipes: (Type<PipeTransform> | PipeTransform)[]): TArgs & {
37
+ export declare function assignMetadata<TParamtype = any, TArgs = any>(args: TArgs, paramtype: TParamtype, index: number, options: {
38
+ data?: ParamData;
39
+ } & ParameterDecoratorOptions): TArgs & {
22
40
  [x: string]: {
41
+ schema?: StandardSchemaV1<unknown, unknown> | undefined;
23
42
  index: number;
24
43
  data: ParamData | undefined;
25
44
  pipes: (PipeTransform<any, any> | Type<PipeTransform<any, any>>)[];
@@ -231,6 +250,43 @@ export declare function Query(...pipes: (Type<PipeTransform> | PipeTransform)[])
231
250
  * @publicApi
232
251
  */
233
252
  export declare function Query(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
253
+ /**
254
+ * Route handler parameter decorator. Extracts the `query`
255
+ * property from the `req` object and populates the decorated
256
+ * parameter with the value of `query`. May also apply pipes to the bound
257
+ * query parameter.
258
+ *
259
+ * For example:
260
+ * ```typescript
261
+ * async find(@Query('user') user: string)
262
+ * ```
263
+ *
264
+ * @param property name of single property to extract from the `query` object
265
+ * @param options options object containing additional configuration for the decorator, such as pipes and schema
266
+ *
267
+ * @see [Request object](https://docs.nestjs.com/controllers#request-object)
268
+ *
269
+ * @publicApi
270
+ */
271
+ export declare function Query(property: string, options: ParameterDecoratorOptions): ParameterDecorator;
272
+ /**
273
+ * Route handler parameter decorator. Extracts the `query`
274
+ * property from the `req` object and populates the decorated
275
+ * parameter with the value of `query`. May also apply pipes to the bound
276
+ * query parameter.
277
+ *
278
+ * For example:
279
+ * ```typescript
280
+ * async find(@Query({ schema: z.object({ user: z.string() }) }) query)
281
+ * ```
282
+ *
283
+ * @param options options object containing additional configuration for the decorator, such as pipes and schema
284
+ *
285
+ * @see [Request object](https://docs.nestjs.com/controllers#request-object)
286
+ *
287
+ * @publicApi
288
+ */
289
+ export declare function Query(options: ParameterDecoratorOptions): ParameterDecorator;
234
290
  /**
235
291
  * Route handler parameter decorator. Extracts the entire `body`
236
292
  * object from the `req` object and populates the decorated
@@ -266,6 +322,23 @@ export declare function Body(): ParameterDecorator;
266
322
  * @publicApi
267
323
  */
268
324
  export declare function Body(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
325
+ /**
326
+ * Route handler parameter decorator. Extracts the entire `body` object
327
+ * property, or optionally a named property of the `body` object, from
328
+ * the `req` object and populates the decorated parameter with that value.
329
+ *
330
+ * For example:
331
+ * ```typescript
332
+ * async create(@Body('role') role: string)
333
+ * ```
334
+ *
335
+ * @param options options to apply to the bound body parameter.
336
+ *
337
+ * @see [Request object](https://docs.nestjs.com/controllers#request-object)
338
+ *
339
+ * @publicApi
340
+ */
341
+ export declare function Body(options: ParameterDecoratorOptions): ParameterDecorator;
269
342
  /**
270
343
  * Route handler parameter decorator. Extracts a single property from
271
344
  * the `body` object property of the `req` object and populates the decorated
@@ -287,6 +360,26 @@ export declare function Body(...pipes: (Type<PipeTransform> | PipeTransform)[]):
287
360
  * @publicApi
288
361
  */
289
362
  export declare function Body(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
363
+ /**
364
+ * Route handler parameter decorator. Extracts the entire `body` object
365
+ * property, or optionally a named property of the `body` object, from
366
+ * the `req` object and populates the decorated parameter with that value.
367
+ * Also applies pipes to the bound body parameter.
368
+ *
369
+ * For example:
370
+ * ```typescript
371
+ * async create(@Body('role', new ValidationPipe()) role: string)
372
+ * ```
373
+ *
374
+ * @param property name of single property to extract from the `body` object
375
+ * @param options options to apply to the bound body parameter.
376
+ *
377
+ * @see [Request object](https://docs.nestjs.com/controllers#request-object)
378
+ * @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
379
+ *
380
+ * @publicApi
381
+ */
382
+ export declare function Body(property: string, options: ParameterDecoratorOptions): ParameterDecorator;
290
383
  /**
291
384
  * Route handler parameter decorator. Extracts the `rawBody` Buffer
292
385
  * property from the `req` object and populates the decorated parameter with that value.
@@ -322,6 +415,25 @@ export declare function RawBody(): ParameterDecorator;
322
415
  * @publicApi
323
416
  */
324
417
  export declare function RawBody(...pipes: (Type<PipeTransform<Buffer | undefined>> | PipeTransform<Buffer | undefined>)[]): ParameterDecorator;
418
+ /**
419
+ * Route handler parameter decorator. Extracts the `rawBody` Buffer
420
+ * property from the `req` object and populates the decorated parameter with that value.
421
+ * Also applies pipes to the bound rawBody parameter.
422
+ *
423
+ * For example:
424
+ * ```typescript
425
+ * async create(@RawBody({ schema: z.instanceof(Buffer) }) rawBody: Buffer)
426
+ * ```
427
+ *
428
+ * @param options options object containing additional configuration for the decorator, such as pipes and schema
429
+ *
430
+ * @see [Request object](https://docs.nestjs.com/controllers#request-object)
431
+ * @see [Raw body](https://docs.nestjs.com/faq/raw-body)
432
+ * @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
433
+ *
434
+ * @publicApi
435
+ */
436
+ export declare function RawBody(options: ParameterDecoratorOptions): ParameterDecorator;
325
437
  /**
326
438
  * Route handler parameter decorator. Extracts the `params`
327
439
  * property from the `req` object and populates the decorated
@@ -397,6 +509,44 @@ export declare function Param(...pipes: (Type<PipeTransform> | PipeTransform)[])
397
509
  * @publicApi
398
510
  */
399
511
  export declare function Param(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
512
+ /**
513
+ * Route handler parameter decorator. Extracts the `params`
514
+ * property from the `req` object and populates the decorated
515
+ * parameter with the value of `params`. May also apply pipes to the bound
516
+ * parameter.
517
+ *
518
+ * For example, extracting a single param:
519
+ * ```typescript
520
+ * findOne(@Param('id', { schema: z.string().uuid() }) id: string)
521
+ * ```
522
+ * @param property name of single property to extract from the `req` object
523
+ * @param options options object containing additional configuration for the decorator, such as pipes and schema
524
+ *
525
+ * @see [Request object](https://docs.nestjs.com/controllers#request-object)
526
+ * @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
527
+ *
528
+ * @publicApi
529
+ */
530
+ export declare function Param(property: string, options: ParameterDecoratorOptions): ParameterDecorator;
531
+ /**
532
+ * Route handler parameter decorator. Extracts the `params`
533
+ * property from the `req` object and populates the decorated
534
+ * parameter with the value of `params`. May also apply pipes to the bound
535
+ * parameter.
536
+ *
537
+ * For example:
538
+ * ```typescript
539
+ * findOne(@Param({ schema: z.object({ id: z.string().uuid() }) }) params)
540
+ * ```
541
+ *
542
+ * @param options options object containing additional configuration for the decorator, such as pipes and schema
543
+ *
544
+ * @see [Request object](https://docs.nestjs.com/controllers#request-object)
545
+ * @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
546
+ *
547
+ * @publicApi
548
+ */
549
+ export declare function Param(options: ParameterDecoratorOptions): ParameterDecorator;
400
550
  /**
401
551
  * Route handler parameter decorator. Extracts the `hosts`
402
552
  * property from the `req` object and populates the decorated