@nestjs/core 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 (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 +4 -7
  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,35 +1,39 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MiddlewareModule = void 0;
4
- const common_1 = require("@nestjs/common");
5
- const request_method_enum_1 = require("@nestjs/common/enums/request-method.enum");
6
- const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
7
- const invalid_middleware_exception_1 = require("../errors/exceptions/invalid-middleware.exception");
8
- const runtime_exception_1 = require("../errors/exceptions/runtime.exception");
9
- const context_id_factory_1 = require("../helpers/context-id-factory");
10
- const execution_context_host_1 = require("../helpers/execution-context-host");
11
- const constants_1 = require("../injector/constants");
12
- const request_constants_1 = require("../router/request/request-constants");
13
- const router_exception_filters_1 = require("../router/router-exception-filters");
14
- const router_proxy_1 = require("../router/router-proxy");
15
- const utils_1 = require("../router/utils");
16
- const builder_1 = require("./builder");
17
- const resolver_1 = require("./resolver");
18
- const route_info_path_extractor_1 = require("./route-info-path-extractor");
19
- const routes_mapper_1 = require("./routes-mapper");
20
- class MiddlewareModule {
21
- constructor() {
22
- this.routerProxy = new router_proxy_1.RouterProxy();
23
- this.exceptionFiltersCache = new WeakMap();
24
- this.logger = new common_1.Logger(MiddlewareModule.name);
25
- }
1
+ import { Logger } from '@nestjs/common';
2
+ import { InvalidMiddlewareException } from '../errors/exceptions/invalid-middleware.exception.js';
3
+ import { RuntimeException } from '../errors/exceptions/runtime.exception.js';
4
+ import { ContextIdFactory } from '../helpers/context-id-factory.js';
5
+ import { ExecutionContextHost } from '../helpers/execution-context-host.js';
6
+ import { STATIC_CONTEXT } from '../injector/constants.js';
7
+ import { REQUEST_CONTEXT_ID } from '../router/request/request-constants.js';
8
+ import { RouterExceptionFilters } from '../router/router-exception-filters.js';
9
+ import { RouterProxy } from '../router/router-proxy.js';
10
+ import { isRequestMethodAll } from '../router/utils/index.js';
11
+ import { MiddlewareBuilder } from './builder.js';
12
+ import { MiddlewareResolver } from './resolver.js';
13
+ import { RouteInfoPathExtractor } from './route-info-path-extractor.js';
14
+ import { RoutesMapper } from './routes-mapper.js';
15
+ import { RequestMethod } from '@nestjs/common';
16
+ import { isUndefined, } from '@nestjs/common/internal';
17
+ export class MiddlewareModule {
18
+ routerProxy = new RouterProxy();
19
+ exceptionFiltersCache = new WeakMap();
20
+ logger = new Logger(MiddlewareModule.name);
21
+ injector;
22
+ routerExceptionFilter;
23
+ routesMapper;
24
+ resolver;
25
+ container;
26
+ httpAdapter;
27
+ graphInspector;
28
+ appOptions;
29
+ routeInfoPathExtractor;
26
30
  async register(middlewareContainer, container, config, injector, httpAdapter, graphInspector, options) {
27
31
  this.appOptions = options;
28
32
  const appRef = container.getHttpAdapterRef();
29
- this.routerExceptionFilter = new router_exception_filters_1.RouterExceptionFilters(container, config, appRef);
30
- this.routesMapper = new routes_mapper_1.RoutesMapper(container, config);
31
- this.resolver = new resolver_1.MiddlewareResolver(middlewareContainer, injector);
32
- this.routeInfoPathExtractor = new route_info_path_extractor_1.RouteInfoPathExtractor(config);
33
+ this.routerExceptionFilter = new RouterExceptionFilters(container, config, appRef);
34
+ this.routesMapper = new RoutesMapper(container, config);
35
+ this.resolver = new MiddlewareResolver(middlewareContainer, injector);
36
+ this.routeInfoPathExtractor = new RouteInfoPathExtractor(config);
33
37
  this.injector = injector;
34
38
  this.container = container;
35
39
  this.httpAdapter = httpAdapter;
@@ -50,7 +54,7 @@ class MiddlewareModule {
50
54
  if (!instance.configure) {
51
55
  return;
52
56
  }
53
- const middlewareBuilder = new builder_1.MiddlewareBuilder(this.routesMapper, this.httpAdapter, this.routeInfoPathExtractor);
57
+ const middlewareBuilder = new MiddlewareBuilder(this.routesMapper, this.httpAdapter, this.routeInfoPathExtractor);
54
58
  try {
55
59
  await instance.configure(middlewareBuilder);
56
60
  }
@@ -62,7 +66,7 @@ class MiddlewareModule {
62
66
  ` (possibly due to missing dependencies). Note: you can ignore this message, just be aware that some of those conditional middlewares will not be reflected in your graph.`;
63
67
  this.logger.warn(warningMessage);
64
68
  }
65
- if (!(middlewareBuilder instanceof builder_1.MiddlewareBuilder)) {
69
+ if (!(middlewareBuilder instanceof MiddlewareBuilder)) {
66
70
  return;
67
71
  }
68
72
  const config = middlewareBuilder.build();
@@ -107,8 +111,8 @@ class MiddlewareModule {
107
111
  for (const metatype of middlewareCollection) {
108
112
  const collection = middlewareContainer.getMiddlewareCollection(moduleKey);
109
113
  const instanceWrapper = collection.get(metatype);
110
- if ((0, shared_utils_1.isUndefined)(instanceWrapper)) {
111
- throw new runtime_exception_1.RuntimeException();
114
+ if (isUndefined(instanceWrapper)) {
115
+ throw new RuntimeException();
112
116
  }
113
117
  if (instanceWrapper.isTransient) {
114
118
  return;
@@ -122,7 +126,7 @@ class MiddlewareModule {
122
126
  metadata: {
123
127
  key: routeInfo.path,
124
128
  path: routeInfo.path,
125
- requestMethod: request_method_enum_1.RequestMethod[routeInfo.method] ??
129
+ requestMethod: RequestMethod[routeInfo.method] ??
126
130
  'ALL',
127
131
  version: routeInfo.version,
128
132
  },
@@ -133,8 +137,8 @@ class MiddlewareModule {
133
137
  }
134
138
  async bindHandler(wrapper, applicationRef, routeInfo, moduleRef, collection) {
135
139
  const { instance, metatype } = wrapper;
136
- if ((0, shared_utils_1.isUndefined)(instance?.use)) {
137
- throw new invalid_middleware_exception_1.InvalidMiddlewareException(metatype.name);
140
+ if (isUndefined(instance?.use)) {
141
+ throw new InvalidMiddlewareException(metatype.name);
138
142
  }
139
143
  const isStatic = wrapper.isDependencyTreeStatic();
140
144
  if (isStatic) {
@@ -155,12 +159,12 @@ class MiddlewareModule {
155
159
  exceptionsHandler = this.routerExceptionFilter.create(instance, instance.use, undefined);
156
160
  this.exceptionFiltersCache.set(instance.use, exceptionsHandler);
157
161
  }
158
- const host = new execution_context_host_1.ExecutionContextHost([req, res, next]);
162
+ const host = new ExecutionContextHost([req, res, next]);
159
163
  exceptionsHandler.next(err, host);
160
164
  }
161
165
  });
162
166
  }
163
- async createProxy(instance, contextId = constants_1.STATIC_CONTEXT) {
167
+ async createProxy(instance, contextId = STATIC_CONTEXT) {
164
168
  const exceptionsHandler = this.routerExceptionFilter.create(instance, instance.use, undefined, contextId);
165
169
  const middleware = instance.use.bind(instance);
166
170
  return this.routerProxy.createProxy(middleware, exceptionsHandler);
@@ -168,8 +172,8 @@ class MiddlewareModule {
168
172
  async registerHandler(applicationRef, routeInfo, proxy) {
169
173
  const { method } = routeInfo;
170
174
  const paths = this.routeInfoPathExtractor.extractPathsFrom(routeInfo);
171
- const isMethodAll = (0, utils_1.isRequestMethodAll)(method);
172
- const requestMethod = request_method_enum_1.RequestMethod[method];
175
+ const isMethodAll = isRequestMethodAll(method);
176
+ const requestMethod = RequestMethod[method];
173
177
  const router = await applicationRef.createMiddlewareFactory(method);
174
178
  const middlewareFunction = isMethodAll
175
179
  ? proxy
@@ -186,9 +190,9 @@ class MiddlewareModule {
186
190
  pathsToApplyMiddleware.forEach(path => router(path, middlewareFunction));
187
191
  }
188
192
  getContextId(request, isTreeDurable) {
189
- const contextId = context_id_factory_1.ContextIdFactory.getByRequest(request);
190
- if (!request[request_constants_1.REQUEST_CONTEXT_ID]) {
191
- Object.defineProperty(request, request_constants_1.REQUEST_CONTEXT_ID, {
193
+ const contextId = ContextIdFactory.getByRequest(request);
194
+ if (!request[REQUEST_CONTEXT_ID]) {
195
+ Object.defineProperty(request, REQUEST_CONTEXT_ID, {
192
196
  value: contextId,
193
197
  enumerable: false,
194
198
  writable: false,
@@ -202,4 +206,3 @@ class MiddlewareModule {
202
206
  return contextId;
203
207
  }
204
208
  }
205
- exports.MiddlewareModule = MiddlewareModule;
@@ -1,6 +1,6 @@
1
- import { Injector } from '../injector/injector';
2
- import { Module } from '../injector/module';
3
- import { MiddlewareContainer } from './container';
1
+ import { Injector } from '../injector/injector.js';
2
+ import { Module } from '../injector/module.js';
3
+ import { MiddlewareContainer } from './container.js';
4
4
  export declare class MiddlewareResolver {
5
5
  private readonly middlewareContainer;
6
6
  private readonly injector;
@@ -1,7 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MiddlewareResolver = void 0;
4
- class MiddlewareResolver {
1
+ export class MiddlewareResolver {
2
+ middlewareContainer;
3
+ injector;
5
4
  constructor(middlewareContainer, injector) {
6
5
  this.middlewareContainer = middlewareContainer;
7
6
  this.injector = injector;
@@ -15,4 +14,3 @@ class MiddlewareResolver {
15
14
  await this.injector.loadMiddleware(wrapper, middlewareMap, moduleRef);
16
15
  }
17
16
  }
18
- exports.MiddlewareResolver = MiddlewareResolver;
@@ -1,5 +1,5 @@
1
- import { RouteInfo } from '@nestjs/common/interfaces';
2
- import { ApplicationConfig } from '../application-config';
1
+ import { ApplicationConfig } from '../application-config.js';
2
+ import { type RouteInfo } from '@nestjs/common/internal';
3
3
  export declare class RouteInfoPathExtractor {
4
4
  private readonly applicationConfig;
5
5
  private readonly routePathFactory;
@@ -1,15 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RouteInfoPathExtractor = void 0;
4
- const common_1 = require("@nestjs/common");
5
- const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
6
- const utils_1 = require("../router/utils");
7
- const route_path_factory_1 = require("./../router/route-path-factory");
8
- class RouteInfoPathExtractor {
1
+ import { VersioningType } from '@nestjs/common';
2
+ import { isRouteExcluded } from '../router/utils/index.js';
3
+ import { RoutePathFactory } from './../router/route-path-factory.js';
4
+ import { addLeadingSlash, stripEndSlash, } from '@nestjs/common/internal';
5
+ export class RouteInfoPathExtractor {
6
+ applicationConfig;
7
+ routePathFactory;
8
+ prefixPath;
9
+ excludedGlobalPrefixRoutes;
10
+ versioningConfig;
9
11
  constructor(applicationConfig) {
10
12
  this.applicationConfig = applicationConfig;
11
- this.routePathFactory = new route_path_factory_1.RoutePathFactory(applicationConfig);
12
- this.prefixPath = (0, shared_utils_1.stripEndSlash)((0, shared_utils_1.addLeadingSlash)(this.applicationConfig.getGlobalPrefix()));
13
+ this.routePathFactory = new RoutePathFactory(applicationConfig);
14
+ this.prefixPath = stripEndSlash(addLeadingSlash(this.applicationConfig.getGlobalPrefix()));
13
15
  this.excludedGlobalPrefixRoutes =
14
16
  this.applicationConfig.getGlobalPrefixOptions().exclude;
15
17
  this.versioningConfig = this.applicationConfig.getVersioning();
@@ -21,19 +23,19 @@ class RouteInfoPathExtractor {
21
23
  ? versionPaths
22
24
  .map(versionPath => [
23
25
  this.prefixPath + versionPath + '$',
24
- this.prefixPath + versionPath + (0, shared_utils_1.addLeadingSlash)(path),
26
+ this.prefixPath + versionPath + addLeadingSlash(path),
25
27
  ])
26
28
  .flat()
27
29
  : this.prefixPath
28
- ? [this.prefixPath + '$', this.prefixPath + (0, shared_utils_1.addLeadingSlash)(path)]
29
- : [(0, shared_utils_1.addLeadingSlash)(path)];
30
+ ? [this.prefixPath + '$', this.prefixPath + addLeadingSlash(path)]
31
+ : [addLeadingSlash(path)];
30
32
  return Array.isArray(this.excludedGlobalPrefixRoutes)
31
33
  ? [
32
34
  ...entries,
33
35
  ...this.excludedGlobalPrefixRoutes
34
36
  .map(route => Array.isArray(versionPaths) && versionPaths.length > 0
35
- ? versionPaths.map(v => v + (0, shared_utils_1.addLeadingSlash)(route.path))
36
- : (0, shared_utils_1.addLeadingSlash)(route.path))
37
+ ? versionPaths.map(v => v + addLeadingSlash(route.path))
38
+ : addLeadingSlash(route.path))
37
39
  .flat(),
38
40
  ]
39
41
  : entries;
@@ -42,7 +44,7 @@ class RouteInfoPathExtractor {
42
44
  }
43
45
  extractPathFrom(route) {
44
46
  if (this.isAWildcard(route.path) && !route.version) {
45
- return [(0, shared_utils_1.addLeadingSlash)(route.path)];
47
+ return [addLeadingSlash(route.path)];
46
48
  }
47
49
  return this.extractNonWildcardPathsFrom(route);
48
50
  }
@@ -57,25 +59,24 @@ class RouteInfoPathExtractor {
57
59
  extractNonWildcardPathsFrom({ path, method, version, }) {
58
60
  const versionPaths = this.extractVersionPathFrom(version);
59
61
  if (Array.isArray(this.excludedGlobalPrefixRoutes) &&
60
- (0, utils_1.isRouteExcluded)(this.excludedGlobalPrefixRoutes, path, method)) {
62
+ isRouteExcluded(this.excludedGlobalPrefixRoutes, path, method)) {
61
63
  if (!versionPaths.length) {
62
- return [(0, shared_utils_1.addLeadingSlash)(path)];
64
+ return [addLeadingSlash(path)];
63
65
  }
64
- return versionPaths.map(versionPath => versionPath + (0, shared_utils_1.addLeadingSlash)(path));
66
+ return versionPaths.map(versionPath => versionPath + addLeadingSlash(path));
65
67
  }
66
68
  if (!versionPaths.length) {
67
- return [this.prefixPath + (0, shared_utils_1.addLeadingSlash)(path)];
69
+ return [this.prefixPath + addLeadingSlash(path)];
68
70
  }
69
- return versionPaths.map(versionPath => this.prefixPath + versionPath + (0, shared_utils_1.addLeadingSlash)(path));
71
+ return versionPaths.map(versionPath => this.prefixPath + versionPath + addLeadingSlash(path));
70
72
  }
71
73
  extractVersionPathFrom(versionValue) {
72
- if (!versionValue || this.versioningConfig?.type !== common_1.VersioningType.URI)
74
+ if (!versionValue || this.versioningConfig?.type !== VersioningType.URI)
73
75
  return [];
74
76
  const versionPrefix = this.routePathFactory.getVersionPrefix(this.versioningConfig);
75
77
  if (Array.isArray(versionValue)) {
76
- return versionValue.map(version => (0, shared_utils_1.addLeadingSlash)(versionPrefix + version.toString()));
78
+ return versionValue.map(version => addLeadingSlash(versionPrefix + version.toString()));
77
79
  }
78
- return [(0, shared_utils_1.addLeadingSlash)(versionPrefix + versionValue.toString())];
80
+ return [addLeadingSlash(versionPrefix + versionValue.toString())];
79
81
  }
80
82
  }
81
- exports.RouteInfoPathExtractor = RouteInfoPathExtractor;
@@ -1,6 +1,7 @@
1
- import { RouteInfo, Type } from '@nestjs/common/interfaces';
2
- import { ApplicationConfig } from '../application-config';
3
- import { NestContainer } from '../injector/container';
1
+ import { ApplicationConfig } from '../application-config.js';
2
+ import { NestContainer } from '../injector/container.js';
3
+ import { type RouteInfo } from '@nestjs/common/internal';
4
+ import { type Type } from '@nestjs/common';
4
5
  export declare class RoutesMapper {
5
6
  private readonly container;
6
7
  private readonly applicationConfig;
@@ -1,20 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RoutesMapper = void 0;
4
- const constants_1 = require("@nestjs/common/constants");
5
- const interfaces_1 = require("@nestjs/common/interfaces");
6
- const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
7
- const metadata_scanner_1 = require("../metadata-scanner");
8
- const paths_explorer_1 = require("../router/paths-explorer");
9
- const router_module_1 = require("../router/router-module");
10
- class RoutesMapper {
1
+ import { MetadataScanner } from '../metadata-scanner.js';
2
+ import { PathsExplorer } from '../router/paths-explorer.js';
3
+ import { targetModulesByContainer } from '../router/router-module.js';
4
+ import { MODULE_PATH, PATH_METADATA, VERSION_METADATA, addLeadingSlash, isString, isUndefined, } from '@nestjs/common/internal';
5
+ import { VERSION_NEUTRAL } from '@nestjs/common';
6
+ export class RoutesMapper {
7
+ container;
8
+ applicationConfig;
9
+ pathsExplorer;
11
10
  constructor(container, applicationConfig) {
12
11
  this.container = container;
13
12
  this.applicationConfig = applicationConfig;
14
- this.pathsExplorer = new paths_explorer_1.PathsExplorer(new metadata_scanner_1.MetadataScanner());
13
+ this.pathsExplorer = new PathsExplorer(new MetadataScanner());
15
14
  }
16
15
  mapRouteToRouteInfo(controllerOrRoute) {
17
- if ((0, shared_utils_1.isString)(controllerOrRoute)) {
16
+ if (isString(controllerOrRoute)) {
18
17
  return this.getRouteInfoFromPath(controllerOrRoute);
19
18
  }
20
19
  const routePathOrPaths = this.getRoutePath(controllerOrRoute);
@@ -27,14 +26,14 @@ class RoutesMapper {
27
26
  const defaultRequestMethod = -1;
28
27
  return [
29
28
  {
30
- path: (0, shared_utils_1.addLeadingSlash)(routePath),
29
+ path: addLeadingSlash(routePath),
31
30
  method: defaultRequestMethod,
32
31
  },
33
32
  ];
34
33
  }
35
34
  getRouteInfoFromObject(routeInfoObject) {
36
35
  const routeInfo = {
37
- path: (0, shared_utils_1.addLeadingSlash)(routeInfoObject.path),
36
+ path: addLeadingSlash(routeInfoObject.path),
38
37
  method: routeInfoObject.method,
39
38
  };
40
39
  if (routeInfoObject.version) {
@@ -49,10 +48,10 @@ class RoutesMapper {
49
48
  const moduleRef = this.getHostModuleOfController(controller);
50
49
  const modulePath = this.getModulePath(moduleRef?.metatype);
51
50
  const concatPaths = (acc, currentValue) => acc.concat(currentValue);
52
- const toUndefinedIfNeural = (version) => version === interfaces_1.VERSION_NEUTRAL ? undefined : version;
51
+ const toUndefinedIfNeural = (version) => version === VERSION_NEUTRAL ? undefined : version;
53
52
  const toRouteInfo = (item, prefix) => item.path?.flatMap(p => {
54
53
  let endpointPath = modulePath ?? '';
55
- endpointPath += this.normalizeGlobalPath(prefix) + (0, shared_utils_1.addLeadingSlash)(p);
54
+ endpointPath += this.normalizeGlobalPath(prefix) + addLeadingSlash(p);
56
55
  const routeInfo = {
57
56
  path: endpointPath,
58
57
  method: item.requestMethod,
@@ -77,21 +76,21 @@ class RoutesMapper {
77
76
  .reduce(concatPaths, []);
78
77
  }
79
78
  isRouteInfo(path, objectOrClass) {
80
- return (0, shared_utils_1.isUndefined)(path);
79
+ return isUndefined(path);
81
80
  }
82
81
  normalizeGlobalPath(path) {
83
- const prefix = (0, shared_utils_1.addLeadingSlash)(path);
82
+ const prefix = addLeadingSlash(path);
84
83
  return prefix === '/' ? '' : prefix;
85
84
  }
86
85
  getRoutePath(route) {
87
- return Reflect.getMetadata(constants_1.PATH_METADATA, route);
86
+ return Reflect.getMetadata(PATH_METADATA, route);
88
87
  }
89
88
  getHostModuleOfController(metatype) {
90
89
  if (!metatype) {
91
90
  return;
92
91
  }
93
92
  const modulesContainer = this.container.getModules();
94
- const moduleRefsSet = router_module_1.targetModulesByContainer.get(modulesContainer);
93
+ const moduleRefsSet = targetModulesByContainer.get(modulesContainer);
95
94
  if (!moduleRefsSet) {
96
95
  return;
97
96
  }
@@ -103,15 +102,14 @@ class RoutesMapper {
103
102
  return;
104
103
  }
105
104
  const modulesContainer = this.container.getModules();
106
- const modulePath = Reflect.getMetadata(constants_1.MODULE_PATH + modulesContainer.applicationId, metatype);
107
- return modulePath ?? Reflect.getMetadata(constants_1.MODULE_PATH, metatype);
105
+ const modulePath = Reflect.getMetadata(MODULE_PATH + modulesContainer.applicationId, metatype);
106
+ return modulePath ?? Reflect.getMetadata(MODULE_PATH, metatype);
108
107
  }
109
108
  getVersionMetadata(metatype) {
110
109
  const versioningConfig = this.applicationConfig.getVersioning();
111
110
  if (versioningConfig) {
112
- return (Reflect.getMetadata(constants_1.VERSION_METADATA, metatype) ??
111
+ return (Reflect.getMetadata(VERSION_METADATA, metatype) ??
113
112
  versioningConfig.defaultVersion);
114
113
  }
115
114
  }
116
115
  }
117
- exports.RoutesMapper = RoutesMapper;
@@ -1,5 +1,6 @@
1
- import { HttpServer, RouteInfo, Type } from '@nestjs/common/interfaces';
2
- import { ExcludeRouteMetadata } from '../router/interfaces/exclude-route-metadata.interface';
1
+ import { ExcludeRouteMetadata } from '../router/interfaces/exclude-route-metadata.interface.js';
2
+ import type { HttpServer, Type } from '@nestjs/common';
3
+ import { type RouteInfo } from '@nestjs/common/internal';
3
4
  export declare const mapToExcludeRoute: (routes: (string | RouteInfo)[]) => ExcludeRouteMetadata[];
4
5
  export declare const filterMiddleware: <T extends Function | Type<any> = any>(middleware: T[], routes: RouteInfo[], httpAdapter: HttpServer) => Type<any>[];
5
6
  export declare const mapToClass: <T extends Function | Type<any>>(middleware: T, excludedRoutes: ExcludeRouteMetadata[], httpAdapter: HttpServer) => Type<any>;
@@ -1,53 +1,45 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapToClass = exports.filterMiddleware = exports.mapToExcludeRoute = void 0;
4
- exports.isMiddlewareClass = isMiddlewareClass;
5
- exports.assignToken = assignToken;
6
- exports.isMiddlewareRouteExcluded = isMiddlewareRouteExcluded;
7
- const common_1 = require("@nestjs/common");
8
- const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
9
- const iterare_1 = require("iterare");
10
- const path_to_regexp_1 = require("path-to-regexp");
11
- const uid_1 = require("uid");
12
- const legacy_route_converter_1 = require("../router/legacy-route-converter");
13
- const utils_1 = require("../router/utils");
14
- const mapToExcludeRoute = (routes) => {
1
+ import { RequestMethod } from '@nestjs/common';
2
+ import { iterate } from 'iterare';
3
+ import { pathToRegexp } from 'path-to-regexp';
4
+ import { uid } from 'uid';
5
+ import { LegacyRouteConverter } from '../router/legacy-route-converter.js';
6
+ import { isRouteExcluded } from '../router/utils/index.js';
7
+ import { addLeadingSlash, isFunction, isString, } from '@nestjs/common/internal';
8
+ export const mapToExcludeRoute = (routes) => {
15
9
  return routes.map(route => {
16
- const originalPath = (0, shared_utils_1.isString)(route) ? route : route.path;
17
- const path = legacy_route_converter_1.LegacyRouteConverter.tryConvert(originalPath);
10
+ const originalPath = isString(route) ? route : route.path;
11
+ const path = LegacyRouteConverter.tryConvert(originalPath);
18
12
  try {
19
- if ((0, shared_utils_1.isString)(route)) {
13
+ if (isString(route)) {
20
14
  return {
21
15
  path,
22
- requestMethod: common_1.RequestMethod.ALL,
23
- pathRegex: (0, path_to_regexp_1.pathToRegexp)((0, shared_utils_1.addLeadingSlash)(path)).regexp,
16
+ requestMethod: RequestMethod.ALL,
17
+ pathRegex: pathToRegexp(addLeadingSlash(path)).regexp,
24
18
  };
25
19
  }
26
20
  return {
27
21
  path,
28
22
  requestMethod: route.method,
29
- pathRegex: (0, path_to_regexp_1.pathToRegexp)((0, shared_utils_1.addLeadingSlash)(path)).regexp,
23
+ pathRegex: pathToRegexp(addLeadingSlash(path)).regexp,
30
24
  };
31
25
  }
32
26
  catch (e) {
33
27
  if (e instanceof TypeError) {
34
- legacy_route_converter_1.LegacyRouteConverter.printError(originalPath);
28
+ LegacyRouteConverter.printError(originalPath);
35
29
  }
36
30
  throw e;
37
31
  }
38
32
  });
39
33
  };
40
- exports.mapToExcludeRoute = mapToExcludeRoute;
41
- const filterMiddleware = (middleware, routes, httpAdapter) => {
42
- const excludedRoutes = (0, exports.mapToExcludeRoute)(routes);
43
- return (0, iterare_1.iterate)([])
34
+ export const filterMiddleware = (middleware, routes, httpAdapter) => {
35
+ const excludedRoutes = mapToExcludeRoute(routes);
36
+ return iterate([])
44
37
  .concat(middleware)
45
- .filter(shared_utils_1.isFunction)
46
- .map((item) => (0, exports.mapToClass)(item, excludedRoutes, httpAdapter))
38
+ .filter(isFunction)
39
+ .map((item) => mapToClass(item, excludedRoutes, httpAdapter))
47
40
  .toArray();
48
41
  };
49
- exports.filterMiddleware = filterMiddleware;
50
- const mapToClass = (middleware, excludedRoutes, httpAdapter) => {
42
+ export const mapToClass = (middleware, excludedRoutes, httpAdapter) => {
51
43
  if (isMiddlewareClass(middleware)) {
52
44
  if (excludedRoutes.length <= 0) {
53
45
  return middleware;
@@ -65,20 +57,17 @@ const mapToClass = (middleware, excludedRoutes, httpAdapter) => {
65
57
  return assignToken(MiddlewareHost, middleware.name);
66
58
  }
67
59
  return assignToken(class {
68
- constructor() {
69
- this.use = (...params) => {
70
- const [req, _, next] = params;
71
- const isExcluded = isMiddlewareRouteExcluded(req, excludedRoutes, httpAdapter);
72
- if (isExcluded) {
73
- return next();
74
- }
75
- return middleware(...params);
76
- };
77
- }
60
+ use = (...params) => {
61
+ const [req, _, next] = params;
62
+ const isExcluded = isMiddlewareRouteExcluded(req, excludedRoutes, httpAdapter);
63
+ if (isExcluded) {
64
+ return next();
65
+ }
66
+ return middleware(...params);
67
+ };
78
68
  });
79
69
  };
80
- exports.mapToClass = mapToClass;
81
- function isMiddlewareClass(middleware) {
70
+ export function isMiddlewareClass(middleware) {
82
71
  const middlewareStr = middleware.toString();
83
72
  if (middlewareStr.substring(0, 5) === 'class') {
84
73
  return true;
@@ -86,13 +75,13 @@ function isMiddlewareClass(middleware) {
86
75
  const middlewareArr = middlewareStr.split(' ');
87
76
  return (middlewareArr[0] === 'function' &&
88
77
  /[A-Z]/.test(middlewareArr[1]?.[0]) &&
89
- (0, shared_utils_1.isFunction)(middleware.prototype?.use));
78
+ isFunction(middleware.prototype?.use));
90
79
  }
91
- function assignToken(metatype, token = (0, uid_1.uid)(21)) {
80
+ export function assignToken(metatype, token = uid(21)) {
92
81
  Object.defineProperty(metatype, 'name', { value: token });
93
82
  return metatype;
94
83
  }
95
- function isMiddlewareRouteExcluded(req, excludedRoutes, httpAdapter) {
84
+ export function isMiddlewareRouteExcluded(req, excludedRoutes, httpAdapter) {
96
85
  if (excludedRoutes.length <= 0) {
97
86
  return false;
98
87
  }
@@ -102,5 +91,5 @@ function isMiddlewareRouteExcluded(req, excludedRoutes, httpAdapter) {
102
91
  const pathname = queryParamsIndex >= 0
103
92
  ? originalUrl.slice(0, queryParamsIndex)
104
93
  : originalUrl;
105
- return (0, utils_1.isRouteExcluded)(excludedRoutes, pathname, common_1.RequestMethod[reqMethod]);
94
+ return isRouteExcluded(excludedRoutes, pathname, RequestMethod[reqMethod]);
106
95
  }
@@ -1,12 +1,12 @@
1
- import { INestApplicationContext, Logger, LoggerService, LogLevel, ShutdownSignal } from '@nestjs/common';
2
- import { DynamicModule, SelectOptions, ShutdownHooksOptions, Type } from '@nestjs/common/interfaces';
3
- import { NestApplicationContextOptions } from '@nestjs/common/interfaces/nest-application-context-options.interface';
4
- import { AbstractInstanceResolver } from './injector/abstract-instance-resolver';
5
- import { NestContainer } from './injector/container';
6
- import { Injector } from './injector/injector';
7
- import { InstanceLinksHost } from './injector/instance-links-host';
8
- import { ContextId } from './injector/instance-wrapper';
9
- import { Module } from './injector/module';
1
+ import { type INestApplicationContext, Logger, type LoggerService, type LogLevel, ShutdownSignal } from '@nestjs/common';
2
+ import { AbstractInstanceResolver } from './injector/abstract-instance-resolver.js';
3
+ import { NestContainer } from './injector/container.js';
4
+ import { Injector } from './injector/injector.js';
5
+ import { InstanceLinksHost } from './injector/instance-links-host.js';
6
+ import { ContextId } from './injector/instance-wrapper.js';
7
+ import { Module } from './injector/module.js';
8
+ import type { DynamicModule, Type } from '@nestjs/common';
9
+ import { type SelectOptions, type ShutdownHooksOptions, type NestApplicationContextOptions } from '@nestjs/common/internal';
10
10
  /**
11
11
  * @publicApi
12
12
  */
@@ -129,6 +129,7 @@ export declare class NestApplicationContext<TOptions extends NestApplicationCont
129
129
  * @returns {this} The Nest application context instance
130
130
  */
131
131
  enableShutdownHooks(signals?: (ShutdownSignal | string)[], options?: ShutdownHooksOptions): this;
132
+ protected prepareClose(): Promise<void>;
132
133
  protected dispose(): Promise<void>;
133
134
  /**
134
135
  * Listens to shutdown signals by listening to