@nestjs/core 11.1.16 → 12.0.0-alpha.1

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 (343) hide show
  1. package/adapters/http-adapter.d.ts +5 -3
  2. package/adapters/http-adapter.js +8 -5
  3. package/adapters/index.d.ts +1 -1
  4. package/adapters/index.js +1 -4
  5. package/application-config.d.ts +7 -4
  6. package/application-config.js +20 -15
  7. package/constants.d.ts +1 -1
  8. package/constants.js +10 -13
  9. package/discovery/discoverable-meta-host-collection.d.ts +3 -3
  10. package/discovery/discoverable-meta-host-collection.js +15 -19
  11. package/discovery/discovery-module.js +9 -12
  12. package/discovery/discovery-service.d.ts +4 -4
  13. package/discovery/discovery-service.js +17 -19
  14. package/discovery/index.d.ts +2 -2
  15. package/discovery/index.js +2 -5
  16. package/errors/exception-handler.js +3 -7
  17. package/errors/exceptions/circular-dependency.exception.d.ts +1 -1
  18. package/errors/exceptions/circular-dependency.exception.js +2 -6
  19. package/errors/exceptions/index.d.ts +8 -8
  20. package/errors/exceptions/index.js +8 -11
  21. package/errors/exceptions/invalid-class-module.exception.d.ts +1 -1
  22. package/errors/exceptions/invalid-class-module.exception.js +4 -8
  23. package/errors/exceptions/invalid-class-scope.exception.d.ts +2 -2
  24. package/errors/exceptions/invalid-class-scope.exception.js +6 -10
  25. package/errors/exceptions/invalid-class.exception.d.ts +1 -1
  26. package/errors/exceptions/invalid-class.exception.js +4 -8
  27. package/errors/exceptions/invalid-exception-filter.exception.d.ts +1 -1
  28. package/errors/exceptions/invalid-exception-filter.exception.js +4 -8
  29. package/errors/exceptions/invalid-middleware-configuration.exception.d.ts +1 -1
  30. package/errors/exceptions/invalid-middleware-configuration.exception.js +4 -8
  31. package/errors/exceptions/invalid-middleware.exception.d.ts +1 -1
  32. package/errors/exceptions/invalid-middleware.exception.js +4 -8
  33. package/errors/exceptions/invalid-module.exception.d.ts +1 -1
  34. package/errors/exceptions/invalid-module.exception.js +4 -8
  35. package/errors/exceptions/runtime.exception.js +1 -5
  36. package/errors/exceptions/undefined-dependency.exception.d.ts +3 -3
  37. package/errors/exceptions/undefined-dependency.exception.js +4 -8
  38. package/errors/exceptions/undefined-forwardref.exception.d.ts +2 -2
  39. package/errors/exceptions/undefined-forwardref.exception.js +4 -8
  40. package/errors/exceptions/undefined-module.exception.d.ts +1 -1
  41. package/errors/exceptions/undefined-module.exception.js +4 -8
  42. package/errors/exceptions/unknown-dependencies.exception.d.ts +3 -3
  43. package/errors/exceptions/unknown-dependencies.exception.js +8 -8
  44. package/errors/exceptions/unknown-element.exception.d.ts +1 -1
  45. package/errors/exceptions/unknown-element.exception.js +2 -6
  46. package/errors/exceptions/unknown-export.exception.d.ts +1 -1
  47. package/errors/exceptions/unknown-export.exception.js +4 -8
  48. package/errors/exceptions/unknown-module.exception.d.ts +1 -1
  49. package/errors/exceptions/unknown-module.exception.js +2 -6
  50. package/errors/exceptions/unknown-request-mapping.exception.d.ts +1 -1
  51. package/errors/exceptions/unknown-request-mapping.exception.js +4 -8
  52. package/errors/exceptions-zone.js +6 -10
  53. package/errors/messages.d.ts +2 -2
  54. package/errors/messages.js +20 -36
  55. package/exceptions/base-exception-filter-context.d.ts +6 -7
  56. package/exceptions/base-exception-filter-context.js +13 -16
  57. package/exceptions/base-exception-filter.d.ts +4 -4
  58. package/exceptions/base-exception-filter.js +33 -23
  59. package/exceptions/exceptions-handler.d.ts +4 -4
  60. package/exceptions/exceptions-handler.js +8 -16
  61. package/exceptions/external-exception-filter-context.d.ts +8 -8
  62. package/exceptions/external-exception-filter-context.js +14 -18
  63. package/exceptions/external-exception-filter.d.ts +1 -1
  64. package/exceptions/external-exception-filter.js +4 -8
  65. package/exceptions/external-exceptions-handler.d.ts +3 -3
  66. package/exceptions/external-exceptions-handler.js +8 -16
  67. package/exceptions/index.d.ts +1 -1
  68. package/exceptions/index.js +1 -4
  69. package/guards/constants.js +1 -4
  70. package/guards/guards-consumer.d.ts +4 -3
  71. package/guards/guards-consumer.js +8 -12
  72. package/guards/guards-context-creator.d.ts +11 -10
  73. package/guards/guards-context-creator.js +18 -20
  74. package/guards/index.d.ts +3 -3
  75. package/guards/index.js +3 -6
  76. package/helpers/barrier.js +5 -5
  77. package/helpers/context-creator.d.ts +2 -2
  78. package/helpers/context-creator.js +3 -7
  79. package/helpers/context-id-factory.d.ts +1 -1
  80. package/helpers/context-id-factory.js +10 -14
  81. package/helpers/context-utils.d.ts +6 -3
  82. package/helpers/context-utils.js +7 -12
  83. package/helpers/execution-context-host.d.ts +3 -3
  84. package/helpers/execution-context-host.js +5 -6
  85. package/helpers/external-context-creator.d.ts +15 -18
  86. package/helpers/external-context-creator.js +54 -43
  87. package/helpers/external-proxy.d.ts +2 -2
  88. package/helpers/external-proxy.js +3 -7
  89. package/helpers/get-class-scope.d.ts +2 -2
  90. package/helpers/get-class-scope.js +3 -6
  91. package/helpers/handler-metadata-storage.d.ts +4 -4
  92. package/helpers/handler-metadata-storage.js +7 -15
  93. package/helpers/http-adapter-host.d.ts +1 -1
  94. package/helpers/http-adapter-host.js +6 -11
  95. package/helpers/index.d.ts +3 -3
  96. package/helpers/index.js +3 -6
  97. package/helpers/interfaces/external-handler-metadata.interface.d.ts +2 -2
  98. package/helpers/interfaces/external-handler-metadata.interface.js +1 -2
  99. package/helpers/interfaces/index.d.ts +2 -2
  100. package/helpers/interfaces/index.js +2 -5
  101. package/helpers/interfaces/params-metadata.interface.d.ts +1 -1
  102. package/helpers/interfaces/params-metadata.interface.js +1 -2
  103. package/helpers/is-durable.d.ts +1 -1
  104. package/helpers/is-durable.js +3 -6
  105. package/helpers/load-adapter.d.ts +1 -1
  106. package/helpers/load-adapter.js +5 -8
  107. package/helpers/messages.d.ts +1 -1
  108. package/helpers/messages.js +10 -20
  109. package/helpers/optional-require.d.ts +1 -1
  110. package/helpers/optional-require.js +2 -5
  111. package/helpers/rethrow.js +1 -5
  112. package/helpers/router-method-factory.d.ts +2 -2
  113. package/helpers/router-method-factory.js +20 -24
  114. package/hooks/before-app-shutdown.hook.d.ts +3 -3
  115. package/hooks/before-app-shutdown.hook.js +15 -22
  116. package/hooks/index.d.ts +5 -5
  117. package/hooks/index.js +5 -8
  118. package/hooks/on-app-bootstrap.hook.d.ts +3 -3
  119. package/hooks/on-app-bootstrap.hook.js +15 -22
  120. package/hooks/on-app-shutdown.hook.d.ts +3 -3
  121. package/hooks/on-app-shutdown.hook.js +15 -22
  122. package/hooks/on-module-destroy.hook.d.ts +3 -3
  123. package/hooks/on-module-destroy.hook.js +15 -22
  124. package/hooks/on-module-init.hook.d.ts +3 -3
  125. package/hooks/on-module-init.hook.js +15 -22
  126. package/hooks/utils/get-instances-grouped-by-hierarchy-level.d.ts +3 -0
  127. package/hooks/utils/get-instances-grouped-by-hierarchy-level.js +27 -0
  128. package/hooks/utils/get-sorted-hierarchy-levels.d.ts +1 -0
  129. package/hooks/utils/get-sorted-hierarchy-levels.js +7 -0
  130. package/index.d.ts +16 -16
  131. package/index.js +17 -26
  132. package/injector/abstract-instance-resolver.d.ts +6 -6
  133. package/injector/abstract-instance-resolver.js +7 -11
  134. package/injector/compiler.d.ts +2 -2
  135. package/injector/compiler.js +2 -5
  136. package/injector/constants.d.ts +1 -1
  137. package/injector/constants.js +2 -5
  138. package/injector/container.d.ts +13 -14
  139. package/injector/container.js +40 -40
  140. package/injector/helpers/provider-classifier.d.ts +1 -1
  141. package/injector/helpers/provider-classifier.js +5 -10
  142. package/injector/helpers/silent-logger.js +9 -16
  143. package/injector/index.d.ts +6 -6
  144. package/injector/index.js +5 -8
  145. package/injector/injector.d.ts +7 -6
  146. package/injector/injector.js +78 -78
  147. package/injector/inquirer/index.d.ts +1 -1
  148. package/injector/inquirer/index.js +1 -4
  149. package/injector/inquirer/inquirer-constants.js +1 -4
  150. package/injector/inquirer/inquirer-providers.d.ts +1 -1
  151. package/injector/inquirer/inquirer-providers.js +5 -8
  152. package/injector/instance-links-host.d.ts +3 -3
  153. package/injector/instance-links-host.js +8 -11
  154. package/injector/instance-loader.d.ts +5 -5
  155. package/injector/instance-loader.js +11 -11
  156. package/injector/instance-wrapper.d.ts +8 -5
  157. package/injector/instance-wrapper.js +93 -74
  158. package/injector/internal-core-module/index.d.ts +1 -1
  159. package/injector/internal-core-module/index.js +1 -4
  160. package/injector/internal-core-module/internal-core-module-factory.d.ts +6 -6
  161. package/injector/internal-core-module/internal-core-module-factory.js +23 -27
  162. package/injector/internal-core-module/internal-core-module.d.ts +2 -2
  163. package/injector/internal-core-module/internal-core-module.js +17 -20
  164. package/injector/internal-providers-storage.d.ts +2 -2
  165. package/injector/internal-providers-storage.js +4 -9
  166. package/injector/lazy-module-loader/lazy-module-loader-options.interface.js +1 -2
  167. package/injector/lazy-module-loader/lazy-module-loader.d.ts +8 -8
  168. package/injector/lazy-module-loader/lazy-module-loader.js +10 -9
  169. package/injector/module-ref.d.ts +7 -7
  170. package/injector/module-ref.js +19 -20
  171. package/injector/module.d.ts +5 -5
  172. package/injector/module.js +93 -79
  173. package/injector/modules-container.d.ts +1 -1
  174. package/injector/modules-container.js +5 -12
  175. package/injector/opaque-key-factory/by-reference-module-opaque-key-factory.d.ts +2 -4
  176. package/injector/opaque-key-factory/by-reference-module-opaque-key-factory.js +6 -9
  177. package/injector/opaque-key-factory/deep-hashed-module-opaque-key-factory.d.ts +2 -3
  178. package/injector/opaque-key-factory/deep-hashed-module-opaque-key-factory.js +17 -22
  179. package/injector/opaque-key-factory/interfaces/module-opaque-key-factory.interface.d.ts +1 -3
  180. package/injector/opaque-key-factory/interfaces/module-opaque-key-factory.interface.js +1 -2
  181. package/injector/settlement-signal.js +5 -7
  182. package/injector/topology-tree/topology-tree.d.ts +1 -1
  183. package/injector/topology-tree/topology-tree.js +6 -9
  184. package/injector/topology-tree/tree-node.js +4 -6
  185. package/inspector/deterministic-uuid-registry.js +2 -6
  186. package/inspector/graph-inspector.d.ts +7 -7
  187. package/inspector/graph-inspector.js +10 -12
  188. package/inspector/index.d.ts +4 -4
  189. package/inspector/index.js +4 -7
  190. package/inspector/initialize-on-preview.allowlist.d.ts +1 -1
  191. package/inspector/initialize-on-preview.allowlist.js +2 -6
  192. package/inspector/interfaces/edge.interface.d.ts +1 -1
  193. package/inspector/interfaces/edge.interface.js +1 -2
  194. package/inspector/interfaces/enhancer-metadata-cache-entry.interface.d.ts +3 -3
  195. package/inspector/interfaces/enhancer-metadata-cache-entry.interface.js +1 -2
  196. package/inspector/interfaces/entrypoint.interface.d.ts +2 -2
  197. package/inspector/interfaces/entrypoint.interface.js +1 -2
  198. package/inspector/interfaces/extras.interface.d.ts +1 -1
  199. package/inspector/interfaces/extras.interface.js +1 -2
  200. package/inspector/interfaces/node.interface.d.ts +2 -2
  201. package/inspector/interfaces/node.interface.js +1 -2
  202. package/inspector/interfaces/serialized-graph-json.interface.d.ts +6 -6
  203. package/inspector/interfaces/serialized-graph-json.interface.js +1 -2
  204. package/inspector/interfaces/serialized-graph-metadata.interface.d.ts +1 -1
  205. package/inspector/interfaces/serialized-graph-metadata.interface.js +1 -2
  206. package/inspector/noop-graph-inspector.d.ts +1 -1
  207. package/inspector/noop-graph-inspector.js +2 -5
  208. package/inspector/partial-graph.host.d.ts +2 -2
  209. package/inspector/partial-graph.host.js +2 -5
  210. package/inspector/serialized-graph.d.ts +7 -7
  211. package/inspector/serialized-graph.js +35 -40
  212. package/inspector/uuid-factory.js +8 -12
  213. package/interceptors/index.d.ts +2 -2
  214. package/interceptors/index.js +2 -5
  215. package/interceptors/interceptors-consumer.d.ts +4 -3
  216. package/interceptors/interceptors-consumer.js +13 -17
  217. package/interceptors/interceptors-context-creator.d.ts +10 -9
  218. package/interceptors/interceptors-context-creator.js +18 -20
  219. package/interfaces/index.d.ts +2 -0
  220. package/interfaces/index.js +2 -0
  221. package/interfaces/module-definition.interface.d.ts +2 -2
  222. package/interfaces/module-definition.interface.js +1 -2
  223. package/interfaces/module-override.interface.d.ts +1 -1
  224. package/interfaces/module-override.interface.js +1 -2
  225. package/internal.d.ts +38 -0
  226. package/internal.js +46 -0
  227. package/metadata-scanner.d.ts +1 -1
  228. package/metadata-scanner.js +8 -14
  229. package/middleware/builder.d.ts +4 -4
  230. package/middleware/builder.js +78 -76
  231. package/middleware/container.d.ts +4 -4
  232. package/middleware/container.js +10 -13
  233. package/middleware/index.d.ts +1 -1
  234. package/middleware/index.js +1 -4
  235. package/middleware/middleware-module.d.ts +8 -9
  236. package/middleware/middleware-module.js +47 -44
  237. package/middleware/resolver.d.ts +3 -3
  238. package/middleware/resolver.js +3 -5
  239. package/middleware/route-info-path-extractor.d.ts +2 -2
  240. package/middleware/route-info-path-extractor.js +26 -25
  241. package/middleware/routes-mapper.d.ts +4 -3
  242. package/middleware/routes-mapper.js +22 -24
  243. package/middleware/utils.d.ts +3 -2
  244. package/middleware/utils.js +34 -45
  245. package/nest-application-context.d.ts +10 -9
  246. package/nest-application-context.js +50 -47
  247. package/nest-application.d.ts +18 -10
  248. package/nest-application.js +87 -55
  249. package/nest-factory.d.ts +4 -5
  250. package/nest-factory.js +61 -68
  251. package/package.json +32 -3
  252. package/pipes/index.d.ts +3 -3
  253. package/pipes/index.js +3 -6
  254. package/pipes/params-token-factory.d.ts +2 -2
  255. package/pipes/params-token-factory.js +5 -9
  256. package/pipes/pipes-consumer.d.ts +3 -7
  257. package/pipes/pipes-consumer.js +17 -18
  258. package/pipes/pipes-context-creator.d.ts +10 -9
  259. package/pipes/pipes-context-creator.js +18 -20
  260. package/repl/assign-to-object.util.js +1 -4
  261. package/repl/constants.js +1 -4
  262. package/repl/index.d.ts +1 -1
  263. package/repl/index.js +1 -4
  264. package/repl/native-functions/debug-repl-fn.d.ts +2 -2
  265. package/repl/native-functions/debug-repl-fn.js +14 -21
  266. package/repl/native-functions/get-repl-fn.d.ts +2 -2
  267. package/repl/native-functions/get-repl-fn.js +8 -15
  268. package/repl/native-functions/help-repl-fn.d.ts +2 -2
  269. package/repl/native-functions/help-repl-fn.js +13 -20
  270. package/repl/native-functions/index.d.ts +6 -6
  271. package/repl/native-functions/index.js +6 -9
  272. package/repl/native-functions/methods-repl-fn.d.ts +2 -2
  273. package/repl/native-functions/methods-repl-fn.js +12 -19
  274. package/repl/native-functions/resolve-repl-fn.d.ts +2 -2
  275. package/repl/native-functions/resolve-repl-fn.js +7 -14
  276. package/repl/native-functions/select-relp-fn.d.ts +2 -2
  277. package/repl/native-functions/select-relp-fn.js +7 -14
  278. package/repl/repl-context.d.ts +3 -3
  279. package/repl/repl-context.js +21 -23
  280. package/repl/repl-function.d.ts +3 -3
  281. package/repl/repl-function.js +5 -7
  282. package/repl/repl-logger.js +10 -14
  283. package/repl/repl-native-commands.js +1 -4
  284. package/repl/repl.d.ts +1 -1
  285. package/repl/repl.interfaces.d.ts +2 -2
  286. package/repl/repl.interfaces.js +1 -2
  287. package/repl/repl.js +17 -20
  288. package/router/index.d.ts +3 -3
  289. package/router/index.js +3 -8
  290. package/router/interfaces/exceptions-filter.interface.d.ts +3 -3
  291. package/router/interfaces/exceptions-filter.interface.js +1 -2
  292. package/router/interfaces/exclude-route-metadata.interface.d.ts +1 -1
  293. package/router/interfaces/exclude-route-metadata.interface.js +1 -2
  294. package/router/interfaces/index.d.ts +1 -1
  295. package/router/interfaces/index.js +1 -4
  296. package/router/interfaces/resolver.interface.js +1 -2
  297. package/router/interfaces/route-params-factory.interface.d.ts +1 -1
  298. package/router/interfaces/route-params-factory.interface.js +1 -2
  299. package/router/interfaces/route-path-metadata.interface.d.ts +2 -2
  300. package/router/interfaces/route-path-metadata.interface.js +1 -2
  301. package/router/interfaces/routes.interface.d.ts +1 -1
  302. package/router/interfaces/routes.interface.js +1 -2
  303. package/router/legacy-route-converter.js +3 -7
  304. package/router/paths-explorer.d.ts +4 -5
  305. package/router/paths-explorer.js +11 -15
  306. package/router/request/index.d.ts +1 -1
  307. package/router/request/index.js +1 -5
  308. package/router/request/request-constants.js +2 -5
  309. package/router/request/request-providers.d.ts +1 -1
  310. package/router/request/request-providers.js +5 -8
  311. package/router/route-params-factory.d.ts +2 -2
  312. package/router/route-params-factory.js +15 -19
  313. package/router/route-path-factory.d.ts +4 -4
  314. package/router/route-path-factory.js +19 -22
  315. package/router/router-exception-filters.d.ts +9 -9
  316. package/router/router-exception-filters.js +15 -18
  317. package/router/router-execution-context.d.ts +17 -20
  318. package/router/router-execution-context.js +57 -49
  319. package/router/router-explorer.d.ts +14 -16
  320. package/router/router-explorer.js +55 -54
  321. package/router/router-module.d.ts +4 -4
  322. package/router/router-module.js +21 -23
  323. package/router/router-proxy.d.ts +1 -1
  324. package/router/router-proxy.js +4 -8
  325. package/router/router-response-controller.d.ts +2 -2
  326. package/router/router-response-controller.js +20 -23
  327. package/router/routes-resolver.d.ts +8 -9
  328. package/router/routes-resolver.js +36 -51
  329. package/router/sse-stream.d.ts +1 -1
  330. package/router/sse-stream.js +5 -9
  331. package/router/utils/exclude-route.util.d.ts +1 -1
  332. package/router/utils/exclude-route.util.js +7 -12
  333. package/router/utils/flatten-route-paths.util.d.ts +2 -2
  334. package/router/utils/flatten-route-paths.util.js +4 -7
  335. package/router/utils/index.d.ts +2 -2
  336. package/router/utils/index.js +2 -5
  337. package/scanner.d.ts +11 -11
  338. package/scanner.js +64 -65
  339. package/services/index.d.ts +1 -1
  340. package/services/index.js +1 -4
  341. package/services/reflector.service.d.ts +1 -1
  342. package/services/reflector.service.js +9 -13
  343. package/tsconfig.build.json +1 -9
@@ -1,15 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExceptionsHandler = void 0;
4
- const select_exception_filter_metadata_util_1 = require("@nestjs/common/utils/select-exception-filter-metadata.util");
5
- const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
6
- const invalid_exception_filter_exception_1 = require("../errors/exceptions/invalid-exception-filter.exception");
7
- const base_exception_filter_1 = require("./base-exception-filter");
8
- class ExceptionsHandler extends base_exception_filter_1.BaseExceptionFilter {
9
- constructor() {
10
- super(...arguments);
11
- this.filters = [];
12
- }
1
+ import { InvalidExceptionFilterException } from '../errors/exceptions/invalid-exception-filter.exception.js';
2
+ import { BaseExceptionFilter } from './base-exception-filter.js';
3
+ import { selectExceptionFilterMetadata, isEmptyArray, } from '@nestjs/common/internal';
4
+ export class ExceptionsHandler extends BaseExceptionFilter {
5
+ filters = [];
13
6
  next(exception, ctx) {
14
7
  if (this.invokeCustomFilters(exception, ctx)) {
15
8
  return;
@@ -18,17 +11,16 @@ class ExceptionsHandler extends base_exception_filter_1.BaseExceptionFilter {
18
11
  }
19
12
  setCustomFilters(filters) {
20
13
  if (!Array.isArray(filters)) {
21
- throw new invalid_exception_filter_exception_1.InvalidExceptionFilterException();
14
+ throw new InvalidExceptionFilterException();
22
15
  }
23
16
  this.filters = filters;
24
17
  }
25
18
  invokeCustomFilters(exception, ctx) {
26
- if ((0, shared_utils_1.isEmpty)(this.filters)) {
19
+ if (isEmptyArray(this.filters)) {
27
20
  return false;
28
21
  }
29
- const filter = (0, select_exception_filter_metadata_util_1.selectExceptionFilterMetadata)(this.filters, exception);
22
+ const filter = selectExceptionFilterMetadata(this.filters, exception);
30
23
  filter && filter.func(exception, ctx);
31
24
  return !!filter;
32
25
  }
33
26
  }
34
- exports.ExceptionsHandler = ExceptionsHandler;
@@ -1,12 +1,12 @@
1
- import { Controller } from '@nestjs/common/interfaces';
2
- import { ApplicationConfig } from '../application-config';
3
- import { NestContainer } from '../injector/container';
4
- import { RouterProxyCallback } from '../router/router-proxy';
5
- import { BaseExceptionFilterContext } from './base-exception-filter-context';
6
- import { ExternalExceptionsHandler } from './external-exceptions-handler';
1
+ import { ApplicationConfig } from '../application-config.js';
2
+ import { NestContainer } from '../injector/container.js';
3
+ import { RouterProxyCallback } from '../router/router-proxy.js';
4
+ import { BaseExceptionFilterContext } from './base-exception-filter-context.js';
5
+ import { ExternalExceptionsHandler } from './external-exceptions-handler.js';
6
+ import { type Controller } from '@nestjs/common/internal';
7
7
  export declare class ExternalExceptionFilterContext extends BaseExceptionFilterContext {
8
8
  private readonly config?;
9
9
  constructor(container: NestContainer, config?: ApplicationConfig | undefined);
10
- create(instance: Controller, callback: RouterProxyCallback, module: string, contextId?: import("../injector/instance-wrapper").ContextId, inquirerId?: string): ExternalExceptionsHandler;
11
- getGlobalMetadata<T extends any[]>(contextId?: import("../injector/instance-wrapper").ContextId, inquirerId?: string): T;
10
+ create(instance: Controller, callback: RouterProxyCallback, module: string, contextId?: import("../injector/instance-wrapper.js").ContextId, inquirerId?: string): ExternalExceptionsHandler;
11
+ getGlobalMetadata<T extends any[]>(contextId?: import("../injector/instance-wrapper.js").ContextId, inquirerId?: string): T;
12
12
  }
@@ -1,37 +1,34 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExternalExceptionFilterContext = void 0;
4
- const constants_1 = require("@nestjs/common/constants");
5
- const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
6
- const iterare_1 = require("iterare");
7
- const constants_2 = require("../injector/constants");
8
- const base_exception_filter_context_1 = require("./base-exception-filter-context");
9
- const external_exceptions_handler_1 = require("./external-exceptions-handler");
10
- class ExternalExceptionFilterContext extends base_exception_filter_context_1.BaseExceptionFilterContext {
1
+ import { iterate } from 'iterare';
2
+ import { STATIC_CONTEXT } from '../injector/constants.js';
3
+ import { BaseExceptionFilterContext } from './base-exception-filter-context.js';
4
+ import { ExternalExceptionsHandler } from './external-exceptions-handler.js';
5
+ import { EXCEPTION_FILTERS_METADATA, isEmptyArray, } from '@nestjs/common/internal';
6
+ export class ExternalExceptionFilterContext extends BaseExceptionFilterContext {
7
+ config;
11
8
  constructor(container, config) {
12
9
  super(container);
13
10
  this.config = config;
14
11
  }
15
- create(instance, callback, module, contextId = constants_2.STATIC_CONTEXT, inquirerId) {
12
+ create(instance, callback, module, contextId = STATIC_CONTEXT, inquirerId) {
16
13
  this.moduleContext = module;
17
- const exceptionHandler = new external_exceptions_handler_1.ExternalExceptionsHandler();
18
- const filters = this.createContext(instance, callback, constants_1.EXCEPTION_FILTERS_METADATA, contextId, inquirerId);
19
- if ((0, shared_utils_1.isEmpty)(filters)) {
14
+ const exceptionHandler = new ExternalExceptionsHandler();
15
+ const filters = this.createContext(instance, callback, EXCEPTION_FILTERS_METADATA, contextId, inquirerId);
16
+ if (isEmptyArray(filters)) {
20
17
  return exceptionHandler;
21
18
  }
22
19
  exceptionHandler.setCustomFilters(filters.reverse());
23
20
  return exceptionHandler;
24
21
  }
25
- getGlobalMetadata(contextId = constants_2.STATIC_CONTEXT, inquirerId) {
22
+ getGlobalMetadata(contextId = STATIC_CONTEXT, inquirerId) {
26
23
  if (!this.config) {
27
24
  return [];
28
25
  }
29
26
  const globalFilters = this.config.getGlobalFilters();
30
- if (contextId === constants_2.STATIC_CONTEXT && !inquirerId) {
27
+ if (contextId === STATIC_CONTEXT && !inquirerId) {
31
28
  return globalFilters;
32
29
  }
33
30
  const scopedFilterWrappers = this.config.getGlobalRequestFilters();
34
- const scopedFilters = (0, iterare_1.iterate)(scopedFilterWrappers)
31
+ const scopedFilters = iterate(scopedFilterWrappers)
35
32
  .map(wrapper => wrapper.getInstanceByContextId(contextId, inquirerId))
36
33
  .filter(host => !!host)
37
34
  .map(host => host.instance)
@@ -39,4 +36,3 @@ class ExternalExceptionFilterContext extends base_exception_filter_context_1.Bas
39
36
  return globalFilters.concat(scopedFilters);
40
37
  }
41
38
  }
42
- exports.ExternalExceptionFilterContext = ExternalExceptionFilterContext;
@@ -1,4 +1,4 @@
1
- import { ArgumentsHost } from '@nestjs/common';
1
+ import { type ArgumentsHost } from '@nestjs/common';
2
2
  export declare class ExternalExceptionFilter<T = any, R = any> {
3
3
  private static readonly logger;
4
4
  catch(exception: T, host: ArgumentsHost): R | Promise<R>;
@@ -1,15 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExternalExceptionFilter = void 0;
4
- const common_1 = require("@nestjs/common");
5
- class ExternalExceptionFilter {
1
+ import { IntrinsicException, Logger } from '@nestjs/common';
2
+ export class ExternalExceptionFilter {
3
+ static logger = new Logger('ExceptionsHandler');
6
4
  catch(exception, host) {
7
5
  if (exception instanceof Error &&
8
- !(exception instanceof common_1.IntrinsicException)) {
6
+ !(exception instanceof IntrinsicException)) {
9
7
  ExternalExceptionFilter.logger.error(exception);
10
8
  }
11
9
  throw exception;
12
10
  }
13
11
  }
14
- exports.ExternalExceptionFilter = ExternalExceptionFilter;
15
- ExternalExceptionFilter.logger = new common_1.Logger('ExceptionsHandler');
@@ -1,6 +1,6 @@
1
- import { ExceptionFilterMetadata } from '@nestjs/common/interfaces/exceptions';
2
- import { ArgumentsHost } from '@nestjs/common/interfaces/features/arguments-host.interface';
3
- import { ExternalExceptionFilter } from './external-exception-filter';
1
+ import { ExternalExceptionFilter } from './external-exception-filter.js';
2
+ import { type ExceptionFilterMetadata } from '@nestjs/common/internal';
3
+ import type { ArgumentsHost } from '@nestjs/common';
4
4
  export declare class ExternalExceptionsHandler extends ExternalExceptionFilter {
5
5
  private filters;
6
6
  next(exception: Error, host: ArgumentsHost): Promise<any>;
@@ -1,15 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExternalExceptionsHandler = void 0;
4
- const select_exception_filter_metadata_util_1 = require("@nestjs/common/utils/select-exception-filter-metadata.util");
5
- const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
6
- const invalid_exception_filter_exception_1 = require("../errors/exceptions/invalid-exception-filter.exception");
7
- const external_exception_filter_1 = require("./external-exception-filter");
8
- class ExternalExceptionsHandler extends external_exception_filter_1.ExternalExceptionFilter {
9
- constructor() {
10
- super(...arguments);
11
- this.filters = [];
12
- }
1
+ import { InvalidExceptionFilterException } from '../errors/exceptions/invalid-exception-filter.exception.js';
2
+ import { ExternalExceptionFilter } from './external-exception-filter.js';
3
+ import { selectExceptionFilterMetadata, isEmptyArray, } from '@nestjs/common/internal';
4
+ export class ExternalExceptionsHandler extends ExternalExceptionFilter {
5
+ filters = [];
13
6
  next(exception, host) {
14
7
  const result = this.invokeCustomFilters(exception, host);
15
8
  if (result) {
@@ -19,16 +12,15 @@ class ExternalExceptionsHandler extends external_exception_filter_1.ExternalExce
19
12
  }
20
13
  setCustomFilters(filters) {
21
14
  if (!Array.isArray(filters)) {
22
- throw new invalid_exception_filter_exception_1.InvalidExceptionFilterException();
15
+ throw new InvalidExceptionFilterException();
23
16
  }
24
17
  this.filters = filters;
25
18
  }
26
19
  invokeCustomFilters(exception, host) {
27
- if ((0, shared_utils_1.isEmpty)(this.filters)) {
20
+ if (isEmptyArray(this.filters)) {
28
21
  return null;
29
22
  }
30
- const filter = (0, select_exception_filter_metadata_util_1.selectExceptionFilterMetadata)(this.filters, exception);
23
+ const filter = selectExceptionFilterMetadata(this.filters, exception);
31
24
  return filter ? filter.func(exception, host) : null;
32
25
  }
33
26
  }
34
- exports.ExternalExceptionsHandler = ExternalExceptionsHandler;
@@ -1 +1 @@
1
- export * from './base-exception-filter';
1
+ export * from './base-exception-filter.js';
@@ -1,4 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./base-exception-filter"), exports);
1
+ export * from './base-exception-filter.js';
@@ -1,4 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FORBIDDEN_MESSAGE = void 0;
4
- exports.FORBIDDEN_MESSAGE = 'Forbidden resource';
1
+ export const FORBIDDEN_MESSAGE = 'Forbidden resource';
@@ -1,7 +1,8 @@
1
- import { CanActivate } from '@nestjs/common';
2
- import { ContextType, Controller } from '@nestjs/common/interfaces';
1
+ import type { CanActivate } from '@nestjs/common';
3
2
  import { Observable } from 'rxjs';
4
- import { ExecutionContextHost } from '../helpers/execution-context-host';
3
+ import { ExecutionContextHost } from '../helpers/execution-context-host.js';
4
+ import type { ContextType } from '@nestjs/common';
5
+ import { type Controller } from '@nestjs/common/internal';
5
6
  export declare class GuardsConsumer {
6
7
  tryActivate<TContext extends string = ContextType>(guards: CanActivate[], args: unknown[], instance: Controller, callback: (...args: unknown[]) => unknown, type?: TContext): Promise<boolean>;
7
8
  createContext(args: unknown[], instance: Controller, callback: (...args: unknown[]) => unknown): ExecutionContextHost;
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GuardsConsumer = void 0;
4
- const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
5
- const rxjs_1 = require("rxjs");
6
- const execution_context_host_1 = require("../helpers/execution-context-host");
7
- class GuardsConsumer {
1
+ import { lastValueFrom, Observable } from 'rxjs';
2
+ import { ExecutionContextHost } from '../helpers/execution-context-host.js';
3
+ import { isEmptyArray } from '@nestjs/common/internal';
4
+ export class GuardsConsumer {
8
5
  async tryActivate(guards, args, instance, callback, type) {
9
- if (!guards || (0, shared_utils_1.isEmpty)(guards)) {
6
+ if (!guards || isEmptyArray(guards)) {
10
7
  return true;
11
8
  }
12
9
  const context = this.createContext(args, instance, callback);
@@ -27,13 +24,12 @@ class GuardsConsumer {
27
24
  return true;
28
25
  }
29
26
  createContext(args, instance, callback) {
30
- return new execution_context_host_1.ExecutionContextHost(args, instance.constructor, callback);
27
+ return new ExecutionContextHost(args, instance.constructor, callback);
31
28
  }
32
29
  async pickResult(result) {
33
- if (result instanceof rxjs_1.Observable) {
34
- return (0, rxjs_1.lastValueFrom)(result);
30
+ if (result instanceof Observable) {
31
+ return lastValueFrom(result);
35
32
  }
36
33
  return result;
37
34
  }
38
35
  }
39
- exports.GuardsConsumer = GuardsConsumer;
@@ -1,17 +1,18 @@
1
- import { CanActivate } from '@nestjs/common';
2
- import { Controller, Type } from '@nestjs/common/interfaces';
3
- import { ApplicationConfig } from '../application-config';
4
- import { ContextCreator } from '../helpers/context-creator';
5
- import { NestContainer } from '../injector/container';
6
- import { InstanceWrapper } from '../injector/instance-wrapper';
1
+ import type { CanActivate } from '@nestjs/common';
2
+ import { ApplicationConfig } from '../application-config.js';
3
+ import { ContextCreator } from '../helpers/context-creator.js';
4
+ import { NestContainer } from '../injector/container.js';
5
+ import { InstanceWrapper } from '../injector/instance-wrapper.js';
6
+ import { type Controller } from '@nestjs/common/internal';
7
+ import type { Type } from '@nestjs/common';
7
8
  export declare class GuardsContextCreator extends ContextCreator {
8
9
  private readonly container;
9
10
  private readonly config?;
10
11
  private moduleContext;
11
12
  constructor(container: NestContainer, config?: ApplicationConfig | undefined);
12
- create(instance: Controller, callback: (...args: unknown[]) => unknown, module: string, contextId?: import("../injector/instance-wrapper").ContextId, inquirerId?: string): CanActivate[];
13
- createConcreteContext<T extends unknown[], R extends unknown[]>(metadata: T, contextId?: import("../injector/instance-wrapper").ContextId, inquirerId?: string): R;
14
- getGuardInstance(metatype: Function | CanActivate, contextId?: import("../injector/instance-wrapper").ContextId, inquirerId?: string): CanActivate | null;
13
+ create(instance: Controller, callback: (...args: unknown[]) => unknown, module: string, contextId?: import("../injector/instance-wrapper.js").ContextId, inquirerId?: string): CanActivate[];
14
+ createConcreteContext<T extends unknown[], R extends unknown[]>(metadata: T, contextId?: import("../injector/instance-wrapper.js").ContextId, inquirerId?: string): R;
15
+ getGuardInstance(metatype: Function | CanActivate, contextId?: import("../injector/instance-wrapper.js").ContextId, inquirerId?: string): CanActivate | null;
15
16
  getInstanceByMetatype(metatype: Type<unknown>): InstanceWrapper | undefined;
16
- getGlobalMetadata<T extends unknown[]>(contextId?: import("../injector/instance-wrapper").ContextId, inquirerId?: string): T;
17
+ getGlobalMetadata<T extends unknown[]>(contextId?: import("../injector/instance-wrapper.js").ContextId, inquirerId?: string): T;
17
18
  }
@@ -1,32 +1,31 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GuardsContextCreator = void 0;
4
- const constants_1 = require("@nestjs/common/constants");
5
- const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
6
- const iterare_1 = require("iterare");
7
- const context_creator_1 = require("../helpers/context-creator");
8
- const constants_2 = require("../injector/constants");
9
- class GuardsContextCreator extends context_creator_1.ContextCreator {
1
+ import { iterate } from 'iterare';
2
+ import { ContextCreator } from '../helpers/context-creator.js';
3
+ import { STATIC_CONTEXT } from '../injector/constants.js';
4
+ import { GUARDS_METADATA, isEmpty, isFunction, } from '@nestjs/common/internal';
5
+ export class GuardsContextCreator extends ContextCreator {
6
+ container;
7
+ config;
8
+ moduleContext;
10
9
  constructor(container, config) {
11
10
  super();
12
11
  this.container = container;
13
12
  this.config = config;
14
13
  }
15
- create(instance, callback, module, contextId = constants_2.STATIC_CONTEXT, inquirerId) {
14
+ create(instance, callback, module, contextId = STATIC_CONTEXT, inquirerId) {
16
15
  this.moduleContext = module;
17
- return this.createContext(instance, callback, constants_1.GUARDS_METADATA, contextId, inquirerId);
16
+ return this.createContext(instance, callback, GUARDS_METADATA, contextId, inquirerId);
18
17
  }
19
- createConcreteContext(metadata, contextId = constants_2.STATIC_CONTEXT, inquirerId) {
20
- if ((0, shared_utils_1.isEmpty)(metadata)) {
18
+ createConcreteContext(metadata, contextId = STATIC_CONTEXT, inquirerId) {
19
+ if (isEmpty(metadata)) {
21
20
  return [];
22
21
  }
23
- return (0, iterare_1.iterate)(metadata)
22
+ return iterate(metadata)
24
23
  .filter((guard) => guard && (guard.name || guard.canActivate))
25
24
  .map(guard => this.getGuardInstance(guard, contextId, inquirerId))
26
- .filter((guard) => !!guard && (0, shared_utils_1.isFunction)(guard.canActivate))
25
+ .filter((guard) => !!guard && isFunction(guard.canActivate))
27
26
  .toArray();
28
27
  }
29
- getGuardInstance(metatype, contextId = constants_2.STATIC_CONTEXT, inquirerId) {
28
+ getGuardInstance(metatype, contextId = STATIC_CONTEXT, inquirerId) {
30
29
  const isObject = !!metatype.canActivate;
31
30
  if (isObject) {
32
31
  return metatype;
@@ -50,16 +49,16 @@ class GuardsContextCreator extends context_creator_1.ContextCreator {
50
49
  const injectables = moduleRef.injectables;
51
50
  return injectables.get(metatype);
52
51
  }
53
- getGlobalMetadata(contextId = constants_2.STATIC_CONTEXT, inquirerId) {
52
+ getGlobalMetadata(contextId = STATIC_CONTEXT, inquirerId) {
54
53
  if (!this.config) {
55
54
  return [];
56
55
  }
57
56
  const globalGuards = this.config.getGlobalGuards();
58
- if (contextId === constants_2.STATIC_CONTEXT && !inquirerId) {
57
+ if (contextId === STATIC_CONTEXT && !inquirerId) {
59
58
  return globalGuards;
60
59
  }
61
60
  const scopedGuardWrappers = this.config.getGlobalRequestGuards();
62
- const scopedGuards = (0, iterare_1.iterate)(scopedGuardWrappers)
61
+ const scopedGuards = iterate(scopedGuardWrappers)
63
62
  .map(wrapper => wrapper.getInstanceByContextId(this.getContextId(contextId, wrapper), inquirerId))
64
63
  .filter(host => !!host)
65
64
  .map(host => host.instance)
@@ -67,4 +66,3 @@ class GuardsContextCreator extends context_creator_1.ContextCreator {
67
66
  return globalGuards.concat(scopedGuards);
68
67
  }
69
68
  }
70
- exports.GuardsContextCreator = GuardsContextCreator;
package/guards/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './constants';
2
- export * from './guards-consumer';
3
- export * from './guards-context-creator';
1
+ export * from './constants.js';
2
+ export * from './guards-consumer.js';
3
+ export * from './guards-context-creator.js';
package/guards/index.js CHANGED
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./constants"), exports);
5
- tslib_1.__exportStar(require("./guards-consumer"), exports);
6
- tslib_1.__exportStar(require("./guards-context-creator"), exports);
1
+ export * from './constants.js';
2
+ export * from './guards-consumer.js';
3
+ export * from './guards-context-creator.js';
@@ -1,10 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Barrier = void 0;
4
1
  /**
5
2
  * A simple barrier to synchronize flow of multiple async operations.
6
3
  */
7
- class Barrier {
4
+ export class Barrier {
5
+ currentCount;
6
+ targetCount;
7
+ promise;
8
+ resolve;
8
9
  constructor(targetCount) {
9
10
  this.currentCount = 0;
10
11
  this.targetCount = targetCount;
@@ -43,4 +44,3 @@ class Barrier {
43
44
  return this.wait();
44
45
  }
45
46
  }
46
- exports.Barrier = Barrier;
@@ -1,5 +1,5 @@
1
- import { Controller } from '@nestjs/common/interfaces';
2
- import { ContextId, InstanceWrapper } from '../injector/instance-wrapper';
1
+ import { ContextId, InstanceWrapper } from '../injector/instance-wrapper.js';
2
+ import type { Controller } from '@nestjs/common/internal';
3
3
  export declare abstract class ContextCreator {
4
4
  abstract createConcreteContext<T extends any[], R extends any[]>(metadata: T, contextId?: ContextId, inquirerId?: string): R;
5
5
  getGlobalMetadata?<T extends any[]>(contextId?: ContextId, inquirerId?: string): T;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ContextCreator = void 0;
4
- const constants_1 = require("../injector/constants");
5
- class ContextCreator {
6
- createContext(instance, callback, metadataKey, contextId = constants_1.STATIC_CONTEXT, inquirerId) {
1
+ import { STATIC_CONTEXT } from '../injector/constants.js';
2
+ export class ContextCreator {
3
+ createContext(instance, callback, metadataKey, contextId = STATIC_CONTEXT, inquirerId) {
7
4
  const globalMetadata = this.getGlobalMetadata &&
8
5
  this.getGlobalMetadata(contextId, inquirerId);
9
6
  const classMetadata = this.reflectClassMetadata(instance, metadataKey);
@@ -30,4 +27,3 @@ class ContextCreator {
30
27
  : contextId;
31
28
  }
32
29
  }
33
- exports.ContextCreator = ContextCreator;
@@ -1,4 +1,4 @@
1
- import { ContextId, HostComponentInfo } from '../injector/instance-wrapper';
1
+ import { ContextId, HostComponentInfo } from '../injector/instance-wrapper.js';
2
2
  export declare function createContextId(): ContextId;
3
3
  export type ContextIdResolverFn = (info: HostComponentInfo) => ContextId;
4
4
  export interface ContextIdResolver {
@@ -1,10 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ContextIdFactory = void 0;
4
- exports.createContextId = createContextId;
5
- const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
6
- const request_constants_1 = require("../router/request/request-constants");
7
- function createContextId() {
1
+ import { REQUEST_CONTEXT_ID } from '../router/request/request-constants.js';
2
+ import { isObject } from '@nestjs/common/internal';
3
+ export function createContextId() {
8
4
  /**
9
5
  * We are generating random identifier to track asynchronous
10
6
  * execution context. An identifier does not have to be neither unique
@@ -15,7 +11,8 @@ function createContextId() {
15
11
  */
16
12
  return { id: Math.random() };
17
13
  }
18
- class ContextIdFactory {
14
+ export class ContextIdFactory {
15
+ static strategy;
19
16
  /**
20
17
  * Generates a context identifier based on the request object.
21
18
  */
@@ -30,12 +27,12 @@ class ContextIdFactory {
30
27
  if (!request) {
31
28
  return ContextIdFactory.create();
32
29
  }
33
- if (request[request_constants_1.REQUEST_CONTEXT_ID]) {
34
- return request[request_constants_1.REQUEST_CONTEXT_ID];
30
+ if (request[REQUEST_CONTEXT_ID]) {
31
+ return request[REQUEST_CONTEXT_ID];
35
32
  }
36
33
  for (const key of propsToInspect) {
37
- if (request[key]?.[request_constants_1.REQUEST_CONTEXT_ID]) {
38
- return request[key][request_constants_1.REQUEST_CONTEXT_ID];
34
+ if (request[key]?.[REQUEST_CONTEXT_ID]) {
35
+ return request[key][REQUEST_CONTEXT_ID];
39
36
  }
40
37
  }
41
38
  if (!this.strategy) {
@@ -61,7 +58,6 @@ class ContextIdFactory {
61
58
  this.strategy = strategy;
62
59
  }
63
60
  static isContextIdResolverWithPayload(resolverOrResolverFn) {
64
- return (0, shared_utils_1.isObject)(resolverOrResolverFn);
61
+ return isObject(resolverOrResolverFn);
65
62
  }
66
63
  }
67
- exports.ContextIdFactory = ContextIdFactory;
@@ -1,12 +1,15 @@
1
- import { ParamData } from '@nestjs/common';
2
- import { ContextType, Controller, PipeTransform } from '@nestjs/common/interfaces';
3
- import { ExecutionContextHost } from './execution-context-host';
1
+ import type { ParamData } from '@nestjs/common';
2
+ import { ExecutionContextHost } from './execution-context-host.js';
3
+ import { type Controller } from '@nestjs/common/internal';
4
+ import type { ContextType, PipeTransform } from '@nestjs/common';
5
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
4
6
  export interface ParamProperties<T = any, IExtractor extends Function = any> {
5
7
  index: number;
6
8
  type: T | string;
7
9
  data: ParamData;
8
10
  pipes: PipeTransform[];
9
11
  extractValue: IExtractor;
12
+ schema?: StandardSchemaV1;
10
13
  }
11
14
  export declare class ContextUtils {
12
15
  mapParamType(key: string): string;
@@ -1,22 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ContextUtils = void 0;
4
- const constants_1 = require("@nestjs/common/constants");
5
- const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
6
- const execution_context_host_1 = require("./execution-context-host");
7
- class ContextUtils {
1
+ import { ExecutionContextHost } from './execution-context-host.js';
2
+ import { PARAMTYPES_METADATA, RESPONSE_PASSTHROUGH_METADATA, isFunction, } from '@nestjs/common/internal';
3
+ export class ContextUtils {
8
4
  mapParamType(key) {
9
5
  const keyPair = key.split(':');
10
6
  return keyPair[0];
11
7
  }
12
8
  reflectCallbackParamtypes(instance, methodName) {
13
- return Reflect.getMetadata(constants_1.PARAMTYPES_METADATA, instance, methodName);
9
+ return Reflect.getMetadata(PARAMTYPES_METADATA, instance, methodName);
14
10
  }
15
11
  reflectCallbackMetadata(instance, methodName, metadataKey) {
16
12
  return Reflect.getMetadata(metadataKey, instance.constructor, methodName);
17
13
  }
18
14
  reflectPassthrough(instance, methodName) {
19
- return Reflect.getMetadata(constants_1.RESPONSE_PASSTHROUGH_METADATA, instance.constructor, methodName);
15
+ return Reflect.getMetadata(RESPONSE_PASSTHROUGH_METADATA, instance.constructor, methodName);
20
16
  }
21
17
  getArgumentsLength(keys, metadata) {
22
18
  return keys.length
@@ -39,17 +35,16 @@ class ContextUtils {
39
35
  }));
40
36
  }
41
37
  getCustomFactory(factory, data, contextFactory) {
42
- return (0, shared_utils_1.isFunction)(factory)
38
+ return isFunction(factory)
43
39
  ? (...args) => factory(data, contextFactory(args))
44
40
  : () => null;
45
41
  }
46
42
  getContextFactory(contextType, instance, callback) {
47
43
  const type = instance && instance.constructor;
48
44
  return (args) => {
49
- const ctx = new execution_context_host_1.ExecutionContextHost(args, type, callback);
45
+ const ctx = new ExecutionContextHost(args, type, callback);
50
46
  ctx.setType(contextType);
51
47
  return ctx;
52
48
  };
53
49
  }
54
50
  }
55
- exports.ContextUtils = ContextUtils;
@@ -1,6 +1,6 @@
1
- import { ExecutionContext } from '@nestjs/common';
2
- import { Type } from '@nestjs/common/interfaces';
3
- import { ContextType, HttpArgumentsHost, RpcArgumentsHost, WsArgumentsHost } from '@nestjs/common/interfaces/features/arguments-host.interface';
1
+ import type { ExecutionContext } from '@nestjs/common';
2
+ import type { Type, ContextType } from '@nestjs/common';
3
+ import type { HttpArgumentsHost, RpcArgumentsHost, WsArgumentsHost } from '@nestjs/common/internal';
4
4
  export declare class ExecutionContextHost implements ExecutionContext {
5
5
  private readonly args;
6
6
  private readonly constructorRef;
@@ -1,12 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExecutionContextHost = void 0;
4
- class ExecutionContextHost {
1
+ export class ExecutionContextHost {
2
+ args;
3
+ constructorRef;
4
+ handler;
5
+ contextType = 'http';
5
6
  constructor(args, constructorRef = null, handler = null) {
6
7
  this.args = args;
7
8
  this.constructorRef = constructorRef;
8
9
  this.handler = handler;
9
- this.contextType = 'http';
10
10
  }
11
11
  setType(type) {
12
12
  type && (this.contextType = type);
@@ -47,4 +47,3 @@ class ExecutionContextHost {
47
47
  });
48
48
  }
49
49
  }
50
- exports.ExecutionContextHost = ExecutionContextHost;