@depup/nestjs__core 11.2.3-depup.0 → 12.0.2-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (361) hide show
  1. package/README.md +2 -2
  2. package/adapters/http-adapter.d.ts +372 -3
  3. package/adapters/http-adapter.js +135 -5
  4. package/adapters/index.d.ts +1 -1
  5. package/adapters/index.js +1 -4
  6. package/application-config.d.ts +13 -4
  7. package/application-config.js +34 -15
  8. package/changes.json +1 -1
  9. package/constants.d.ts +1 -1
  10. package/constants.js +10 -13
  11. package/discovery/discoverable-meta-host-collection.d.ts +3 -3
  12. package/discovery/discoverable-meta-host-collection.js +25 -20
  13. package/discovery/discovery-module.js +9 -12
  14. package/discovery/discovery-service.d.ts +4 -4
  15. package/discovery/discovery-service.js +17 -19
  16. package/discovery/index.d.ts +2 -2
  17. package/discovery/index.js +2 -5
  18. package/errors/exception-handler.js +3 -7
  19. package/errors/exceptions/circular-dependency.exception.d.ts +1 -1
  20. package/errors/exceptions/circular-dependency.exception.js +2 -6
  21. package/errors/exceptions/index.d.ts +9 -8
  22. package/errors/exceptions/index.js +9 -11
  23. package/errors/exceptions/invalid-class-module.exception.d.ts +1 -1
  24. package/errors/exceptions/invalid-class-module.exception.js +4 -8
  25. package/errors/exceptions/invalid-class-scope.exception.d.ts +2 -2
  26. package/errors/exceptions/invalid-class-scope.exception.js +6 -10
  27. package/errors/exceptions/invalid-class.exception.d.ts +1 -1
  28. package/errors/exceptions/invalid-class.exception.js +4 -8
  29. package/errors/exceptions/invalid-exception-filter.exception.d.ts +1 -1
  30. package/errors/exceptions/invalid-exception-filter.exception.js +4 -8
  31. package/errors/exceptions/invalid-middleware-configuration.exception.d.ts +1 -1
  32. package/errors/exceptions/invalid-middleware-configuration.exception.js +4 -8
  33. package/errors/exceptions/invalid-middleware.exception.d.ts +1 -1
  34. package/errors/exceptions/invalid-middleware.exception.js +4 -8
  35. package/errors/exceptions/invalid-module.exception.d.ts +1 -1
  36. package/errors/exceptions/invalid-module.exception.js +4 -8
  37. package/errors/exceptions/route-conflict.exception.d.ts +4 -0
  38. package/errors/exceptions/route-conflict.exception.js +7 -0
  39. package/errors/exceptions/runtime.exception.js +1 -5
  40. package/errors/exceptions/undefined-dependency.exception.d.ts +3 -3
  41. package/errors/exceptions/undefined-dependency.exception.js +4 -8
  42. package/errors/exceptions/undefined-forwardref.exception.d.ts +2 -2
  43. package/errors/exceptions/undefined-forwardref.exception.js +4 -8
  44. package/errors/exceptions/undefined-module.exception.d.ts +1 -1
  45. package/errors/exceptions/undefined-module.exception.js +4 -8
  46. package/errors/exceptions/unknown-dependencies.exception.d.ts +3 -3
  47. package/errors/exceptions/unknown-dependencies.exception.js +8 -8
  48. package/errors/exceptions/unknown-element.exception.d.ts +1 -1
  49. package/errors/exceptions/unknown-element.exception.js +2 -6
  50. package/errors/exceptions/unknown-export.exception.d.ts +1 -1
  51. package/errors/exceptions/unknown-export.exception.js +4 -8
  52. package/errors/exceptions/unknown-module.exception.d.ts +1 -1
  53. package/errors/exceptions/unknown-module.exception.js +2 -6
  54. package/errors/exceptions/unknown-request-mapping.exception.d.ts +1 -1
  55. package/errors/exceptions/unknown-request-mapping.exception.js +4 -8
  56. package/errors/exceptions-zone.js +6 -10
  57. package/errors/messages.d.ts +5 -2
  58. package/errors/messages.js +26 -32
  59. package/exceptions/base-exception-filter-context.d.ts +6 -7
  60. package/exceptions/base-exception-filter-context.js +13 -16
  61. package/exceptions/base-exception-filter.d.ts +4 -4
  62. package/exceptions/base-exception-filter.js +46 -23
  63. package/exceptions/exceptions-handler.d.ts +4 -4
  64. package/exceptions/exceptions-handler.js +8 -16
  65. package/exceptions/external-exception-filter-context.d.ts +8 -8
  66. package/exceptions/external-exception-filter-context.js +14 -18
  67. package/exceptions/external-exception-filter.d.ts +1 -1
  68. package/exceptions/external-exception-filter.js +4 -8
  69. package/exceptions/external-exceptions-handler.d.ts +3 -3
  70. package/exceptions/external-exceptions-handler.js +8 -16
  71. package/exceptions/index.d.ts +1 -1
  72. package/exceptions/index.js +1 -4
  73. package/guards/constants.js +1 -4
  74. package/guards/guards-consumer.d.ts +4 -3
  75. package/guards/guards-consumer.js +8 -12
  76. package/guards/guards-context-creator.d.ts +11 -10
  77. package/guards/guards-context-creator.js +18 -20
  78. package/guards/index.d.ts +3 -3
  79. package/guards/index.js +3 -6
  80. package/helpers/barrier.js +5 -5
  81. package/helpers/context-creator.d.ts +2 -2
  82. package/helpers/context-creator.js +3 -7
  83. package/helpers/context-id-factory.d.ts +1 -1
  84. package/helpers/context-id-factory.js +10 -14
  85. package/helpers/context-utils.d.ts +6 -3
  86. package/helpers/context-utils.js +7 -12
  87. package/helpers/execution-context-host.d.ts +3 -3
  88. package/helpers/execution-context-host.js +5 -6
  89. package/helpers/external-context-creator.d.ts +15 -18
  90. package/helpers/external-context-creator.js +54 -43
  91. package/helpers/external-proxy.d.ts +2 -2
  92. package/helpers/external-proxy.js +3 -7
  93. package/helpers/get-class-scope.d.ts +2 -2
  94. package/helpers/get-class-scope.js +3 -6
  95. package/helpers/handler-metadata-storage.d.ts +4 -4
  96. package/helpers/handler-metadata-storage.js +7 -15
  97. package/helpers/http-adapter-host.d.ts +1 -1
  98. package/helpers/http-adapter-host.js +6 -11
  99. package/helpers/index.d.ts +3 -3
  100. package/helpers/index.js +3 -6
  101. package/helpers/interfaces/external-handler-metadata.interface.d.ts +2 -2
  102. package/helpers/interfaces/external-handler-metadata.interface.js +1 -2
  103. package/helpers/interfaces/index.d.ts +2 -2
  104. package/helpers/interfaces/index.js +2 -5
  105. package/helpers/interfaces/params-metadata.interface.d.ts +1 -1
  106. package/helpers/interfaces/params-metadata.interface.js +1 -2
  107. package/helpers/is-durable.d.ts +1 -1
  108. package/helpers/is-durable.js +3 -6
  109. package/helpers/load-adapter.d.ts +1 -1
  110. package/helpers/load-adapter.js +5 -8
  111. package/helpers/messages.d.ts +1 -1
  112. package/helpers/messages.js +10 -20
  113. package/helpers/optional-require.d.ts +1 -1
  114. package/helpers/optional-require.js +2 -5
  115. package/helpers/rethrow.js +1 -5
  116. package/helpers/router-method-factory.d.ts +2 -2
  117. package/helpers/router-method-factory.js +21 -25
  118. package/helpers/safe-instance-decorator.js +3 -6
  119. package/hooks/before-app-shutdown.hook.d.ts +3 -3
  120. package/hooks/before-app-shutdown.hook.js +25 -23
  121. package/hooks/index.d.ts +5 -5
  122. package/hooks/index.js +5 -8
  123. package/hooks/on-app-bootstrap.hook.d.ts +3 -3
  124. package/hooks/on-app-bootstrap.hook.js +15 -22
  125. package/hooks/on-app-shutdown.hook.d.ts +3 -3
  126. package/hooks/on-app-shutdown.hook.js +25 -23
  127. package/hooks/on-module-destroy.hook.d.ts +3 -3
  128. package/hooks/on-module-destroy.hook.js +25 -23
  129. package/hooks/on-module-init.hook.d.ts +3 -3
  130. package/hooks/on-module-init.hook.js +15 -22
  131. package/hooks/utils/get-instances-grouped-by-hierarchy-level.d.ts +3 -0
  132. package/hooks/utils/get-instances-grouped-by-hierarchy-level.js +27 -0
  133. package/hooks/utils/get-sorted-hierarchy-levels.d.ts +1 -0
  134. package/hooks/utils/get-sorted-hierarchy-levels.js +7 -0
  135. package/index.d.ts +16 -16
  136. package/index.js +17 -26
  137. package/injector/abstract-instance-resolver.d.ts +6 -6
  138. package/injector/abstract-instance-resolver.js +7 -11
  139. package/injector/compiler.d.ts +2 -2
  140. package/injector/compiler.js +2 -5
  141. package/injector/constants.d.ts +1 -1
  142. package/injector/constants.js +2 -5
  143. package/injector/container.d.ts +13 -14
  144. package/injector/container.js +40 -40
  145. package/injector/helpers/is-debug-mode.util.d.ts +1 -0
  146. package/injector/helpers/is-debug-mode.util.js +3 -0
  147. package/injector/helpers/provider-classifier.d.ts +1 -1
  148. package/injector/helpers/provider-classifier.js +5 -10
  149. package/injector/helpers/silent-logger.js +9 -16
  150. package/injector/index.d.ts +6 -6
  151. package/injector/index.js +5 -8
  152. package/injector/injector.d.ts +7 -7
  153. package/injector/injector.js +104 -93
  154. package/injector/inquirer/index.d.ts +1 -1
  155. package/injector/inquirer/index.js +1 -4
  156. package/injector/inquirer/inquirer-constants.js +1 -4
  157. package/injector/inquirer/inquirer-providers.d.ts +1 -1
  158. package/injector/inquirer/inquirer-providers.js +5 -8
  159. package/injector/instance-links-host.d.ts +3 -3
  160. package/injector/instance-links-host.js +8 -11
  161. package/injector/instance-loader.d.ts +5 -5
  162. package/injector/instance-loader.js +17 -11
  163. package/injector/instance-wrapper.d.ts +8 -6
  164. package/injector/instance-wrapper.js +98 -81
  165. package/injector/internal-core-module/index.d.ts +1 -1
  166. package/injector/internal-core-module/index.js +1 -4
  167. package/injector/internal-core-module/internal-core-module-factory.d.ts +6 -6
  168. package/injector/internal-core-module/internal-core-module-factory.js +23 -27
  169. package/injector/internal-core-module/internal-core-module.d.ts +2 -2
  170. package/injector/internal-core-module/internal-core-module.js +17 -20
  171. package/injector/internal-providers-storage.d.ts +2 -2
  172. package/injector/internal-providers-storage.js +4 -9
  173. package/injector/lazy-module-loader/lazy-module-loader-options.interface.js +1 -2
  174. package/injector/lazy-module-loader/lazy-module-loader.d.ts +8 -8
  175. package/injector/lazy-module-loader/lazy-module-loader.js +36 -27
  176. package/injector/module-ref.d.ts +7 -7
  177. package/injector/module-ref.js +30 -35
  178. package/injector/module.d.ts +5 -5
  179. package/injector/module.js +97 -83
  180. package/injector/modules-container.d.ts +1 -1
  181. package/injector/modules-container.js +5 -12
  182. package/injector/opaque-key-factory/by-reference-module-opaque-key-factory.d.ts +2 -4
  183. package/injector/opaque-key-factory/by-reference-module-opaque-key-factory.js +6 -9
  184. package/injector/opaque-key-factory/deep-hashed-module-opaque-key-factory.d.ts +2 -3
  185. package/injector/opaque-key-factory/deep-hashed-module-opaque-key-factory.js +17 -22
  186. package/injector/opaque-key-factory/interfaces/module-opaque-key-factory.interface.d.ts +1 -3
  187. package/injector/opaque-key-factory/interfaces/module-opaque-key-factory.interface.js +1 -2
  188. package/injector/settlement-signal.js +5 -7
  189. package/injector/topology-tree/topology-tree.d.ts +1 -1
  190. package/injector/topology-tree/topology-tree.js +6 -9
  191. package/injector/topology-tree/tree-node.js +4 -6
  192. package/inspector/deterministic-uuid-registry.js +2 -6
  193. package/inspector/graph-inspector.d.ts +7 -7
  194. package/inspector/graph-inspector.js +10 -12
  195. package/inspector/index.d.ts +4 -4
  196. package/inspector/index.js +4 -7
  197. package/inspector/initialize-on-preview.allowlist.d.ts +1 -1
  198. package/inspector/initialize-on-preview.allowlist.js +2 -6
  199. package/inspector/interfaces/edge.interface.d.ts +1 -1
  200. package/inspector/interfaces/edge.interface.js +1 -2
  201. package/inspector/interfaces/enhancer-metadata-cache-entry.interface.d.ts +3 -3
  202. package/inspector/interfaces/enhancer-metadata-cache-entry.interface.js +1 -2
  203. package/inspector/interfaces/entrypoint.interface.d.ts +2 -2
  204. package/inspector/interfaces/entrypoint.interface.js +1 -2
  205. package/inspector/interfaces/extras.interface.d.ts +1 -1
  206. package/inspector/interfaces/extras.interface.js +1 -2
  207. package/inspector/interfaces/node.interface.d.ts +2 -2
  208. package/inspector/interfaces/node.interface.js +1 -2
  209. package/inspector/interfaces/serialized-graph-json.interface.d.ts +6 -6
  210. package/inspector/interfaces/serialized-graph-json.interface.js +1 -2
  211. package/inspector/interfaces/serialized-graph-metadata.interface.d.ts +1 -1
  212. package/inspector/interfaces/serialized-graph-metadata.interface.js +1 -2
  213. package/inspector/noop-graph-inspector.d.ts +1 -1
  214. package/inspector/noop-graph-inspector.js +2 -5
  215. package/inspector/partial-graph.host.d.ts +2 -2
  216. package/inspector/partial-graph.host.js +2 -5
  217. package/inspector/serialized-graph.d.ts +7 -7
  218. package/inspector/serialized-graph.js +35 -40
  219. package/inspector/uuid-factory.js +8 -12
  220. package/interceptors/index.d.ts +2 -2
  221. package/interceptors/index.js +2 -5
  222. package/interceptors/interceptors-consumer.d.ts +4 -3
  223. package/interceptors/interceptors-consumer.js +14 -18
  224. package/interceptors/interceptors-context-creator.d.ts +10 -9
  225. package/interceptors/interceptors-context-creator.js +18 -20
  226. package/interfaces/index.d.ts +2 -0
  227. package/interfaces/index.js +2 -0
  228. package/interfaces/module-definition.interface.d.ts +2 -2
  229. package/interfaces/module-definition.interface.js +1 -2
  230. package/interfaces/module-override.interface.d.ts +1 -1
  231. package/interfaces/module-override.interface.js +1 -2
  232. package/internal.d.ts +42 -0
  233. package/internal.js +50 -0
  234. package/metadata-scanner.d.ts +1 -1
  235. package/metadata-scanner.js +8 -14
  236. package/middleware/builder.d.ts +4 -4
  237. package/middleware/builder.js +82 -80
  238. package/middleware/container.d.ts +4 -4
  239. package/middleware/container.js +10 -13
  240. package/middleware/index.d.ts +1 -1
  241. package/middleware/index.js +1 -4
  242. package/middleware/middleware-module.d.ts +8 -9
  243. package/middleware/middleware-module.js +49 -46
  244. package/middleware/resolver.d.ts +3 -3
  245. package/middleware/resolver.js +3 -5
  246. package/middleware/route-info-path-extractor.d.ts +2 -2
  247. package/middleware/route-info-path-extractor.js +26 -25
  248. package/middleware/routes-mapper.d.ts +4 -3
  249. package/middleware/routes-mapper.js +22 -24
  250. package/middleware/utils.d.ts +3 -2
  251. package/middleware/utils.js +34 -45
  252. package/nest-application-context.d.ts +26 -11
  253. package/nest-application-context.js +79 -67
  254. package/nest-application.d.ts +19 -11
  255. package/nest-application.js +168 -65
  256. package/nest-factory.d.ts +4 -5
  257. package/nest-factory.js +61 -68
  258. package/package.json +17 -9
  259. package/pipes/index.d.ts +3 -3
  260. package/pipes/index.js +3 -6
  261. package/pipes/params-token-factory.d.ts +2 -2
  262. package/pipes/params-token-factory.js +5 -9
  263. package/pipes/pipes-consumer.d.ts +3 -7
  264. package/pipes/pipes-consumer.js +17 -18
  265. package/pipes/pipes-context-creator.d.ts +10 -9
  266. package/pipes/pipes-context-creator.js +18 -20
  267. package/repl/assign-to-object.util.js +1 -4
  268. package/repl/constants.js +1 -4
  269. package/repl/index.d.ts +1 -1
  270. package/repl/index.js +1 -4
  271. package/repl/native-functions/debug-repl-fn.d.ts +2 -2
  272. package/repl/native-functions/debug-repl-fn.js +14 -21
  273. package/repl/native-functions/get-repl-fn.d.ts +2 -2
  274. package/repl/native-functions/get-repl-fn.js +8 -15
  275. package/repl/native-functions/help-repl-fn.d.ts +2 -2
  276. package/repl/native-functions/help-repl-fn.js +13 -20
  277. package/repl/native-functions/index.d.ts +6 -6
  278. package/repl/native-functions/index.js +6 -9
  279. package/repl/native-functions/methods-repl-fn.d.ts +2 -2
  280. package/repl/native-functions/methods-repl-fn.js +12 -19
  281. package/repl/native-functions/resolve-repl-fn.d.ts +2 -2
  282. package/repl/native-functions/resolve-repl-fn.js +7 -14
  283. package/repl/native-functions/select-relp-fn.d.ts +2 -2
  284. package/repl/native-functions/select-relp-fn.js +7 -14
  285. package/repl/repl-context.d.ts +3 -3
  286. package/repl/repl-context.js +21 -23
  287. package/repl/repl-function.d.ts +3 -3
  288. package/repl/repl-function.js +5 -7
  289. package/repl/repl-logger.js +10 -14
  290. package/repl/repl-native-commands.js +1 -4
  291. package/repl/repl.d.ts +1 -1
  292. package/repl/repl.interfaces.d.ts +2 -2
  293. package/repl/repl.interfaces.js +1 -2
  294. package/repl/repl.js +17 -20
  295. package/router/index.d.ts +3 -3
  296. package/router/index.js +3 -8
  297. package/router/interfaces/exceptions-filter.interface.d.ts +3 -3
  298. package/router/interfaces/exceptions-filter.interface.js +1 -2
  299. package/router/interfaces/exclude-route-metadata.interface.d.ts +1 -1
  300. package/router/interfaces/exclude-route-metadata.interface.js +1 -2
  301. package/router/interfaces/index.d.ts +4 -1
  302. package/router/interfaces/index.js +4 -4
  303. package/router/interfaces/resolved-route.interface.d.ts +32 -0
  304. package/router/interfaces/resolved-route.interface.js +1 -0
  305. package/router/interfaces/resolver.interface.d.ts +5 -1
  306. package/router/interfaces/resolver.interface.js +1 -2
  307. package/router/interfaces/route-conflict.interface.d.ts +14 -0
  308. package/router/interfaces/route-conflict.interface.js +1 -0
  309. package/router/interfaces/route-params-factory.interface.d.ts +1 -1
  310. package/router/interfaces/route-params-factory.interface.js +1 -2
  311. package/router/interfaces/route-path-metadata.interface.d.ts +2 -2
  312. package/router/interfaces/route-path-metadata.interface.js +1 -2
  313. package/router/interfaces/route-resolution-options.interface.d.ts +24 -0
  314. package/router/interfaces/route-resolution-options.interface.js +1 -0
  315. package/router/interfaces/routes.interface.d.ts +1 -1
  316. package/router/interfaces/routes.interface.js +1 -2
  317. package/router/legacy-route-converter.js +3 -7
  318. package/router/paths-explorer.d.ts +4 -5
  319. package/router/paths-explorer.js +11 -15
  320. package/router/request/index.d.ts +1 -1
  321. package/router/request/index.js +1 -5
  322. package/router/request/request-constants.js +2 -5
  323. package/router/request/request-providers.d.ts +1 -1
  324. package/router/request/request-providers.js +5 -8
  325. package/router/route-conflict-detector.d.ts +71 -0
  326. package/router/route-conflict-detector.js +276 -0
  327. package/router/route-params-factory.d.ts +2 -2
  328. package/router/route-params-factory.js +15 -19
  329. package/router/route-path-factory.d.ts +4 -4
  330. package/router/route-path-factory.js +19 -22
  331. package/router/route-specificity-sorter.d.ts +23 -0
  332. package/router/route-specificity-sorter.js +59 -0
  333. package/router/router-exception-filters.d.ts +9 -9
  334. package/router/router-exception-filters.js +15 -18
  335. package/router/router-execution-context.d.ts +17 -20
  336. package/router/router-execution-context.js +62 -55
  337. package/router/router-explorer.d.ts +25 -18
  338. package/router/router-explorer.js +116 -73
  339. package/router/router-module.d.ts +4 -4
  340. package/router/router-module.js +21 -23
  341. package/router/router-proxy.d.ts +1 -1
  342. package/router/router-proxy.js +4 -8
  343. package/router/router-response-controller.d.ts +2 -2
  344. package/router/router-response-controller.js +23 -27
  345. package/router/routes-resolver.d.ts +13 -11
  346. package/router/routes-resolver.js +42 -55
  347. package/router/sse-stream.d.ts +2 -1
  348. package/router/sse-stream.js +29 -24
  349. package/router/utils/exclude-route.util.d.ts +1 -1
  350. package/router/utils/exclude-route.util.js +7 -12
  351. package/router/utils/flatten-route-paths.util.d.ts +2 -2
  352. package/router/utils/flatten-route-paths.util.js +4 -7
  353. package/router/utils/index.d.ts +2 -2
  354. package/router/utils/index.js +2 -5
  355. package/scanner.d.ts +11 -11
  356. package/scanner.js +66 -67
  357. package/services/index.d.ts +1 -1
  358. package/services/index.js +1 -4
  359. package/services/reflector.service.d.ts +1 -1
  360. package/services/reflector.service.js +9 -13
  361. package/tsconfig.build.json +1 -9
package/README.md CHANGED
@@ -13,8 +13,8 @@ npm install @depup/nestjs__core
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [@nestjs/core](https://www.npmjs.com/package/@nestjs/core) @ 11.2.3 |
17
- | Processed | 2026-08-25 |
16
+ | Original | [@nestjs/core](https://www.npmjs.com/package/@nestjs/core) @ 12.0.2 |
17
+ | Processed | 2026-09-14 |
18
18
  | Smoke test | failed |
19
19
  | Deps updated | 0 |
20
20
 
@@ -1,82 +1,451 @@
1
- import { HttpServer, RequestMethod, VersioningOptions } from '@nestjs/common';
2
- import { RequestHandler, VersionValue } from '@nestjs/common/interfaces';
3
- import { NestApplicationOptions } from '@nestjs/common/interfaces/nest-application-options.interface';
1
+ import type { HttpServer, RequestMethod, VersioningOptions } from '@nestjs/common';
2
+ import type { RequestHandler, VersionValue } from '@nestjs/common/internal';
3
+ import type { NestApplicationOptions } from '@nestjs/common';
4
4
  /**
5
+ * Base class for HTTP platform adapters (see `ExpressAdapter` and
6
+ * `FastifyAdapter` for reference implementations).
7
+ *
8
+ * It implements the {@link HttpServer} contract that the Nest core relies on,
9
+ * and that interface is where each method's calling conventions are
10
+ * documented: when the core invokes it, with which arguments, and what it
11
+ * expects back. This class only adds:
12
+ *
13
+ * - default implementations that delegate to the wrapped framework
14
+ * `instance` (`use()`, the HTTP-verb methods, `listen()`) or are inert
15
+ * (`init()`, `normalizePath()`, `mapException()`, `beforeClose()`, the
16
+ * `setOn*Hook()` setters);
17
+ * - storage for the native server (`httpServer`) and the framework instance
18
+ * (`instance`), with their accessors;
19
+ * - the introspection hooks used by instrumentation tooling.
20
+ *
21
+ * Every remaining {@link HttpServer} member is declared abstract here, even
22
+ * the ones the interface marks optional, so subclasses cannot forget them.
23
+ * `setBaseViewsDir()`, `useBodyParser()` and `isRouteOrderSensitive()` are
24
+ * not declared on this class; implement them when the platform supports
25
+ * them (see {@link HttpServer} for what the core does when they are absent).
26
+ *
27
+ * Keep in mind that the core also reads and writes properties of the request
28
+ * object (`body`, `params`, `query`, `headers`, ...), that Server-Sent Events
29
+ * write directly to the Node.js response, and that `app.listen()` and the
30
+ * WebSocket adapters use the value returned by
31
+ * {@link AbstractHttpAdapter.getHttpServer} as a Node.js `net.Server`; see the
32
+ * {@link HttpServer} documentation for details.
33
+ *
34
+ * @typeParam TServer - Type of the native HTTP server stored in `httpServer`
35
+ * (e.g. `http.Server | https.Server`).
36
+ * @typeParam TRequest - Type of the framework request object.
37
+ * @typeParam TResponse - Type of the framework response object.
38
+ *
39
+ * @see [HTTP adapter](https://docs.nestjs.com/faq/http-adapter)
40
+ *
5
41
  * @publicApi
6
42
  */
7
43
  export declare abstract class AbstractHttpAdapter<TServer = any, TRequest = any, TResponse = any> implements HttpServer<TRequest, TResponse> {
8
44
  protected instance?: any | undefined;
45
+ /**
46
+ * Native HTTP server created by {@link AbstractHttpAdapter.initHttpServer}
47
+ * and returned by {@link AbstractHttpAdapter.getHttpServer}.
48
+ */
9
49
  protected httpServer: TServer;
50
+ /**
51
+ * Callback registered through
52
+ * {@link AbstractHttpAdapter.setOnRouteTriggered}, if any.
53
+ */
10
54
  protected onRouteTriggered: ((requestMethod: RequestMethod, path: string) => void) | undefined;
55
+ /**
56
+ * @param instance The framework application instance to delegate to (e.g.
57
+ * an Express `Application`). Subclasses typically create a default one
58
+ * when none is given.
59
+ */
11
60
  constructor(instance?: any | undefined);
61
+ /**
62
+ * Asynchronous setup hook, awaited by `NestFactory.create()` and again by
63
+ * `app.init()`, so overrides must be idempotent. No-op by default.
64
+ *
65
+ * @see {@link HttpServer.init}
66
+ */
12
67
  init(): Promise<void>;
68
+ /**
69
+ * Registers a global middleware by delegating to `instance.use(...args)`.
70
+ *
71
+ * @see {@link HttpServer.use}
72
+ */
13
73
  use(...args: any[]): any;
74
+ /**
75
+ * Registers a `GET` route by delegating to `instance.get(...args)`.
76
+ *
77
+ * @see {@link HttpServer.get}
78
+ */
14
79
  get(handler: RequestHandler): any;
15
80
  get(path: any, handler: RequestHandler): any;
81
+ /**
82
+ * Registers a `POST` route by delegating to `instance.post(...args)`.
83
+ *
84
+ * @see {@link HttpServer.post}
85
+ */
16
86
  post(handler: RequestHandler): any;
17
87
  post(path: any, handler: RequestHandler): any;
88
+ /**
89
+ * Registers a `HEAD` route by delegating to `instance.head(...args)`.
90
+ *
91
+ * @see {@link HttpServer.head}
92
+ */
18
93
  head(handler: RequestHandler): any;
19
94
  head(path: any, handler: RequestHandler): any;
95
+ /**
96
+ * Registers a `DELETE` route by delegating to `instance.delete(...args)`.
97
+ *
98
+ * @see {@link HttpServer.delete}
99
+ */
20
100
  delete(handler: RequestHandler): any;
21
101
  delete(path: any, handler: RequestHandler): any;
102
+ /**
103
+ * Registers a `PUT` route by delegating to `instance.put(...args)`.
104
+ *
105
+ * @see {@link HttpServer.put}
106
+ */
22
107
  put(handler: RequestHandler): any;
23
108
  put(path: any, handler: RequestHandler): any;
109
+ /**
110
+ * Registers a `PATCH` route by delegating to `instance.patch(...args)`.
111
+ *
112
+ * @see {@link HttpServer.patch}
113
+ */
24
114
  patch(handler: RequestHandler): any;
25
115
  patch(path: any, handler: RequestHandler): any;
116
+ /**
117
+ * Registers a WebDAV `PROPFIND` route by delegating to
118
+ * `instance.propfind(...args)`. Override when the framework exposes the
119
+ * verb under a different API.
120
+ *
121
+ * @see {@link HttpServer.propfind}
122
+ */
26
123
  propfind(handler: RequestHandler): any;
27
124
  propfind(path: any, handler: RequestHandler): any;
125
+ /**
126
+ * Registers a WebDAV `PROPPATCH` route by delegating to
127
+ * `instance.proppatch(...args)`. Override when the framework exposes the
128
+ * verb under a different API.
129
+ *
130
+ * @see {@link HttpServer.proppatch}
131
+ */
28
132
  proppatch(handler: RequestHandler): any;
29
133
  proppatch(path: any, handler: RequestHandler): any;
134
+ /**
135
+ * Registers a WebDAV `MKCOL` route by delegating to
136
+ * `instance.mkcol(...args)`. Override when the framework exposes the verb
137
+ * under a different API.
138
+ *
139
+ * @see {@link HttpServer.mkcol}
140
+ */
30
141
  mkcol(handler: RequestHandler): any;
31
142
  mkcol(path: any, handler: RequestHandler): any;
143
+ /**
144
+ * Registers a WebDAV `COPY` route by delegating to
145
+ * `instance.copy(...args)`. Override when the framework exposes the verb
146
+ * under a different API.
147
+ *
148
+ * @see {@link HttpServer.copy}
149
+ */
32
150
  copy(handler: RequestHandler): any;
33
151
  copy(path: any, handler: RequestHandler): any;
152
+ /**
153
+ * Registers a WebDAV `MOVE` route by delegating to
154
+ * `instance.move(...args)`. Override when the framework exposes the verb
155
+ * under a different API.
156
+ *
157
+ * @see {@link HttpServer.move}
158
+ */
34
159
  move(handler: RequestHandler): any;
35
160
  move(path: any, handler: RequestHandler): any;
161
+ /**
162
+ * Registers a WebDAV `LOCK` route by delegating to
163
+ * `instance.lock(...args)`. Override when the framework exposes the verb
164
+ * under a different API.
165
+ *
166
+ * @see {@link HttpServer.lock}
167
+ */
36
168
  lock(handler: RequestHandler): any;
37
169
  lock(path: any, handler: RequestHandler): any;
170
+ /**
171
+ * Registers a WebDAV `UNLOCK` route by delegating to
172
+ * `instance.unlock(...args)`. Override when the framework exposes the verb
173
+ * under a different API.
174
+ *
175
+ * @see {@link HttpServer.unlock}
176
+ */
38
177
  unlock(handler: RequestHandler): any;
39
178
  unlock(path: any, handler: RequestHandler): any;
179
+ /**
180
+ * Registers a route for every HTTP method by delegating to
181
+ * `instance.all(...args)`.
182
+ *
183
+ * @see {@link HttpServer.all}
184
+ */
40
185
  all(handler: RequestHandler): any;
41
186
  all(path: any, handler: RequestHandler): any;
187
+ /**
188
+ * Registers a `SEARCH` route by delegating to `instance.search(...args)`.
189
+ * Override when the framework exposes the verb under a different API.
190
+ *
191
+ * @see {@link HttpServer.search}
192
+ */
42
193
  search(handler: RequestHandler): any;
43
194
  search(path: any, handler: RequestHandler): any;
195
+ /**
196
+ * Registers a `QUERY` route by delegating to `instance.query(...args)`.
197
+ * Override when the framework exposes the verb under a different API.
198
+ *
199
+ * @see {@link HttpServer.query}
200
+ */
44
201
  query(handler: RequestHandler): any;
45
202
  query(path: any, handler: RequestHandler): any;
203
+ /**
204
+ * Registers an `OPTIONS` route by delegating to
205
+ * `instance.options(...args)`.
206
+ *
207
+ * @see {@link HttpServer.options}
208
+ */
46
209
  options(handler: RequestHandler): any;
47
210
  options(path: any, handler: RequestHandler): any;
211
+ /**
212
+ * Starts listening by delegating to
213
+ * `instance.listen(port, hostname, callback)`. The core always passes its
214
+ * own callback as the last argument and expects it to be invoked once the
215
+ * server is bound, or with an `Error` on failure. Override when the
216
+ * framework instance does not expose a Node-style `listen()`, e.g. to call
217
+ * `httpServer.listen()` instead.
218
+ *
219
+ * @see {@link HttpServer.listen}
220
+ */
48
221
  listen(port: string | number, callback?: () => void): any;
49
222
  listen(port: string | number, hostname: string, callback?: () => void): any;
223
+ /**
224
+ * Returns the native HTTP server stored by
225
+ * {@link AbstractHttpAdapter.initHttpServer} (or
226
+ * {@link AbstractHttpAdapter.setHttpServer}).
227
+ *
228
+ * @see {@link HttpServer.getHttpServer}
229
+ */
50
230
  getHttpServer(): TServer;
231
+ /**
232
+ * Replaces the native HTTP server returned by
233
+ * {@link AbstractHttpAdapter.getHttpServer}. Mostly useful for tests and
234
+ * for adapters that obtain the server from elsewhere.
235
+ */
51
236
  setHttpServer(httpServer: TServer): void;
237
+ /**
238
+ * Replaces the framework application instance that the default method
239
+ * implementations delegate to.
240
+ */
52
241
  setInstance<T = any>(instance: T): void;
242
+ /**
243
+ * Returns the framework application instance passed to the constructor
244
+ * (or set through {@link AbstractHttpAdapter.setInstance}).
245
+ *
246
+ * @see {@link HttpServer.getInstance}
247
+ */
53
248
  getInstance<T = any>(): T;
249
+ /**
250
+ * Converts and validates a route path before registration. Returns the
251
+ * path unchanged by default; override to translate Nest's path syntax to
252
+ * the router's and to throw on invalid paths.
253
+ *
254
+ * @see {@link HttpServer.normalizePath}
255
+ */
54
256
  normalizePath(path: string): string;
257
+ /**
258
+ * Registers a callback that the router invokes right before each route
259
+ * handler runs, with the resolved `RequestMethod` and the route path as
260
+ * declared (before {@link AbstractHttpAdapter.normalizePath}). The router
261
+ * wraps every handler at registration time, so the callback must be set
262
+ * before `app.init()` to take effect. Intended for instrumentation and
263
+ * devtools; there is no need to override it.
264
+ */
55
265
  setOnRouteTriggered(onRouteTriggered: (requestMethod: RequestMethod, path: string) => void): void;
266
+ /**
267
+ * Returns the callback registered through
268
+ * {@link AbstractHttpAdapter.setOnRouteTriggered}, if any. Read by the
269
+ * router when registering routes.
270
+ */
56
271
  getOnRouteTriggered(): ((requestMethod: RequestMethod, path: string) => void) | undefined;
272
+ /**
273
+ * Registers a hook to run at the start of every request. No-op by default;
274
+ * the built-in adapters accept a `(req, res, done) => void | Promise<void>`
275
+ * function and call `done()` to continue processing. Intended for
276
+ * instrumentation and devtools.
277
+ */
57
278
  setOnRequestHook(onRequestHook: Function): void;
279
+ /**
280
+ * Registers a hook to run once a response has been sent. No-op by default;
281
+ * the built-in adapters accept a `(req, res) => void | Promise<void>`
282
+ * function. Intended for instrumentation and devtools.
283
+ */
58
284
  setOnResponseHook(onResponseHook: Function): void;
285
+ /**
286
+ * Called by `app.close()` before the shutdown hooks run. No-op by default;
287
+ * override to enter a "shutting down" state.
288
+ *
289
+ * @see {@link HttpServer.beforeClose}
290
+ */
291
+ beforeClose(): void;
292
+ /**
293
+ * Translates a framework-native error into something the exception filters
294
+ * understand. Invoked by the global exception layer with every error it
295
+ * receives, before it reaches the filters; the returned value is what the
296
+ * filters see. Returns the error unchanged by default. The built-in
297
+ * adapters map, for instance, body-parser `SyntaxError`s to
298
+ * `BadRequestException`.
299
+ */
300
+ mapException(error: unknown): unknown;
301
+ /**
302
+ * Stops the server; called by `app.close()`. May return a promise.
303
+ *
304
+ * @see {@link HttpServer.close}
305
+ */
59
306
  abstract close(): any;
307
+ /**
308
+ * Creates the native server and stores it in `httpServer`, honoring the
309
+ * `httpsOptions`, `forceCloseConnections` and `return503OnClosing`
310
+ * application options. Called once when the application is constructed.
311
+ *
312
+ * @see {@link HttpServer.initHttpServer}
313
+ */
60
314
  abstract initHttpServer(options: NestApplicationOptions): any;
315
+ /**
316
+ * Serves static files; pass-through for `app.useStaticAssets()`.
317
+ *
318
+ * @see {@link HttpServer.useStaticAssets}
319
+ */
61
320
  abstract useStaticAssets(...args: any[]): any;
321
+ /**
322
+ * Configures the template engine used by
323
+ * {@link AbstractHttpAdapter.render}; pass-through for
324
+ * `app.setViewEngine()`.
325
+ *
326
+ * @see {@link HttpServer.setViewEngine}
327
+ */
62
328
  abstract setViewEngine(engine: string): any;
329
+ /**
330
+ * Returns the request host name, used for `@Controller({ host })`.
331
+ *
332
+ * @see {@link HttpServer.getRequestHostname}
333
+ */
63
334
  abstract getRequestHostname(request: any): any;
335
+ /**
336
+ * Returns the upper-case request method (`'GET'`, `'POST'`, ...).
337
+ *
338
+ * @see {@link HttpServer.getRequestMethod}
339
+ */
64
340
  abstract getRequestMethod(request: any): any;
341
+ /**
342
+ * Returns the original request URL, including the query string.
343
+ *
344
+ * @see {@link HttpServer.getRequestUrl}
345
+ */
65
346
  abstract getRequestUrl(request: any): any;
347
+ /**
348
+ * Sets the status code without sending the response.
349
+ *
350
+ * @see {@link HttpServer.status}
351
+ */
66
352
  abstract status(response: any, statusCode: number): any;
353
+ /**
354
+ * Sends the response body, handling empty bodies, `StreamableFile`,
355
+ * objects (as JSON) and primitives.
356
+ *
357
+ * @see {@link HttpServer.reply}
358
+ */
67
359
  abstract reply(response: any, body: any, statusCode?: number): any;
360
+ /**
361
+ * Terminates the response, optionally writing `message` first.
362
+ *
363
+ * @see {@link HttpServer.end}
364
+ */
68
365
  abstract end(response: any, message?: string): any;
366
+ /**
367
+ * Renders a view template (`@Render()`).
368
+ *
369
+ * @see {@link HttpServer.render}
370
+ */
69
371
  abstract render(response: any, view: string, options: any): any;
372
+ /**
373
+ * Issues a redirect (`@Redirect()`).
374
+ *
375
+ * @see {@link HttpServer.redirect}
376
+ */
70
377
  abstract redirect(response: any, statusCode: number, url: string): any;
378
+ /**
379
+ * Installs the global exception layer.
380
+ *
381
+ * @see {@link HttpServer.setErrorHandler}
382
+ */
71
383
  abstract setErrorHandler(handler: Function, prefix?: string): any;
384
+ /**
385
+ * Installs the catch-all handler for unmatched requests.
386
+ *
387
+ * @see {@link HttpServer.setNotFoundHandler}
388
+ */
72
389
  abstract setNotFoundHandler(handler: Function, prefix?: string): any;
390
+ /**
391
+ * Reports whether response headers have already been flushed. Must return
392
+ * synchronously.
393
+ *
394
+ * @see {@link HttpServer.isHeadersSent}
395
+ */
73
396
  abstract isHeadersSent(response: any): any;
397
+ /**
398
+ * Reads a response header that was set earlier. Not used by the core
399
+ * router; part of the base class so ecosystem packages can read headers
400
+ * through the adapter regardless of the platform.
401
+ */
74
402
  abstract getHeader(response: any, name: string): any;
403
+ /**
404
+ * Sets (replaces) a response header (`@Header()`).
405
+ *
406
+ * @see {@link HttpServer.setHeader}
407
+ */
75
408
  abstract setHeader(response: any, name: string, value: string): any;
409
+ /**
410
+ * Appends a value to a response header, turning it into a multi-value
411
+ * header (e.g. several `Set-Cookie` entries) instead of replacing it. Not
412
+ * used by the core router; part of the base class so ecosystem packages
413
+ * can append headers through the adapter regardless of the platform.
414
+ */
76
415
  abstract appendHeader(response: any, name: string, value: string): any;
416
+ /**
417
+ * Registers the default JSON and URL-encoded body parsers, exposing
418
+ * `req.rawBody` when `rawBody` is `true`.
419
+ *
420
+ * @see {@link HttpServer.registerParserMiddleware}
421
+ */
77
422
  abstract registerParserMiddleware(prefix?: string, rawBody?: boolean): any;
423
+ /**
424
+ * Enables CORS. The core currently calls this with `options` only; the
425
+ * `prefix` parameter is reserved.
426
+ *
427
+ * @see {@link HttpServer.enableCors}
428
+ */
78
429
  abstract enableCors(options?: any, prefix?: string): any;
430
+ /**
431
+ * Returns the function used to mount Nest middleware for one HTTP method.
432
+ * May be asynchronous.
433
+ *
434
+ * @see {@link HttpServer.createMiddlewareFactory}
435
+ */
79
436
  abstract createMiddlewareFactory(requestMethod: RequestMethod): ((path: string, callback: Function) => any) | Promise<(path: string, callback: Function) => any>;
437
+ /**
438
+ * Returns the platform identifier (`'express'`, `'fastify'`) that
439
+ * ecosystem packages branch on.
440
+ *
441
+ * @see {@link HttpServer.getType}
442
+ */
80
443
  abstract getType(): string;
444
+ /**
445
+ * Guards a route handler by request version for header, media-type and
446
+ * custom versioning.
447
+ *
448
+ * @see {@link HttpServer.applyVersionFilter}
449
+ */
81
450
  abstract applyVersionFilter(handler: Function, version: VersionValue, versioningOptions: VersioningOptions): (req: TRequest, res: TResponse, next: () => void) => Function;
82
451
  }
@@ -1,14 +1,74 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AbstractHttpAdapter = void 0;
4
1
  /**
2
+ * Base class for HTTP platform adapters (see `ExpressAdapter` and
3
+ * `FastifyAdapter` for reference implementations).
4
+ *
5
+ * It implements the {@link HttpServer} contract that the Nest core relies on,
6
+ * and that interface is where each method's calling conventions are
7
+ * documented: when the core invokes it, with which arguments, and what it
8
+ * expects back. This class only adds:
9
+ *
10
+ * - default implementations that delegate to the wrapped framework
11
+ * `instance` (`use()`, the HTTP-verb methods, `listen()`) or are inert
12
+ * (`init()`, `normalizePath()`, `mapException()`, `beforeClose()`, the
13
+ * `setOn*Hook()` setters);
14
+ * - storage for the native server (`httpServer`) and the framework instance
15
+ * (`instance`), with their accessors;
16
+ * - the introspection hooks used by instrumentation tooling.
17
+ *
18
+ * Every remaining {@link HttpServer} member is declared abstract here, even
19
+ * the ones the interface marks optional, so subclasses cannot forget them.
20
+ * `setBaseViewsDir()`, `useBodyParser()` and `isRouteOrderSensitive()` are
21
+ * not declared on this class; implement them when the platform supports
22
+ * them (see {@link HttpServer} for what the core does when they are absent).
23
+ *
24
+ * Keep in mind that the core also reads and writes properties of the request
25
+ * object (`body`, `params`, `query`, `headers`, ...), that Server-Sent Events
26
+ * write directly to the Node.js response, and that `app.listen()` and the
27
+ * WebSocket adapters use the value returned by
28
+ * {@link AbstractHttpAdapter.getHttpServer} as a Node.js `net.Server`; see the
29
+ * {@link HttpServer} documentation for details.
30
+ *
31
+ * @typeParam TServer - Type of the native HTTP server stored in `httpServer`
32
+ * (e.g. `http.Server | https.Server`).
33
+ * @typeParam TRequest - Type of the framework request object.
34
+ * @typeParam TResponse - Type of the framework response object.
35
+ *
36
+ * @see [HTTP adapter](https://docs.nestjs.com/faq/http-adapter)
37
+ *
5
38
  * @publicApi
6
39
  */
7
- class AbstractHttpAdapter {
40
+ export class AbstractHttpAdapter {
41
+ instance;
42
+ /**
43
+ * Native HTTP server created by {@link AbstractHttpAdapter.initHttpServer}
44
+ * and returned by {@link AbstractHttpAdapter.getHttpServer}.
45
+ */
46
+ httpServer;
47
+ /**
48
+ * Callback registered through
49
+ * {@link AbstractHttpAdapter.setOnRouteTriggered}, if any.
50
+ */
51
+ onRouteTriggered;
52
+ /**
53
+ * @param instance The framework application instance to delegate to (e.g.
54
+ * an Express `Application`). Subclasses typically create a default one
55
+ * when none is given.
56
+ */
8
57
  constructor(instance) {
9
58
  this.instance = instance;
10
59
  }
60
+ /**
61
+ * Asynchronous setup hook, awaited by `NestFactory.create()` and again by
62
+ * `app.init()`, so overrides must be idempotent. No-op by default.
63
+ *
64
+ * @see {@link HttpServer.init}
65
+ */
11
66
  async init() { }
67
+ /**
68
+ * Registers a global middleware by delegating to `instance.use(...args)`.
69
+ *
70
+ * @see {@link HttpServer.use}
71
+ */
12
72
  use(...args) {
13
73
  return this.instance.use(...args);
14
74
  }
@@ -66,28 +126,98 @@ class AbstractHttpAdapter {
66
126
  listen(port, hostname, callback) {
67
127
  return this.instance.listen(port, hostname, callback);
68
128
  }
129
+ /**
130
+ * Returns the native HTTP server stored by
131
+ * {@link AbstractHttpAdapter.initHttpServer} (or
132
+ * {@link AbstractHttpAdapter.setHttpServer}).
133
+ *
134
+ * @see {@link HttpServer.getHttpServer}
135
+ */
69
136
  getHttpServer() {
70
137
  return this.httpServer;
71
138
  }
139
+ /**
140
+ * Replaces the native HTTP server returned by
141
+ * {@link AbstractHttpAdapter.getHttpServer}. Mostly useful for tests and
142
+ * for adapters that obtain the server from elsewhere.
143
+ */
72
144
  setHttpServer(httpServer) {
73
145
  this.httpServer = httpServer;
74
146
  }
147
+ /**
148
+ * Replaces the framework application instance that the default method
149
+ * implementations delegate to.
150
+ */
75
151
  setInstance(instance) {
76
152
  this.instance = instance;
77
153
  }
154
+ /**
155
+ * Returns the framework application instance passed to the constructor
156
+ * (or set through {@link AbstractHttpAdapter.setInstance}).
157
+ *
158
+ * @see {@link HttpServer.getInstance}
159
+ */
78
160
  getInstance() {
79
161
  return this.instance;
80
162
  }
163
+ /**
164
+ * Converts and validates a route path before registration. Returns the
165
+ * path unchanged by default; override to translate Nest's path syntax to
166
+ * the router's and to throw on invalid paths.
167
+ *
168
+ * @see {@link HttpServer.normalizePath}
169
+ */
81
170
  normalizePath(path) {
82
171
  return path;
83
172
  }
173
+ /**
174
+ * Registers a callback that the router invokes right before each route
175
+ * handler runs, with the resolved `RequestMethod` and the route path as
176
+ * declared (before {@link AbstractHttpAdapter.normalizePath}). The router
177
+ * wraps every handler at registration time, so the callback must be set
178
+ * before `app.init()` to take effect. Intended for instrumentation and
179
+ * devtools; there is no need to override it.
180
+ */
84
181
  setOnRouteTriggered(onRouteTriggered) {
85
182
  this.onRouteTriggered = onRouteTriggered;
86
183
  }
184
+ /**
185
+ * Returns the callback registered through
186
+ * {@link AbstractHttpAdapter.setOnRouteTriggered}, if any. Read by the
187
+ * router when registering routes.
188
+ */
87
189
  getOnRouteTriggered() {
88
190
  return this.onRouteTriggered;
89
191
  }
192
+ /**
193
+ * Registers a hook to run at the start of every request. No-op by default;
194
+ * the built-in adapters accept a `(req, res, done) => void | Promise<void>`
195
+ * function and call `done()` to continue processing. Intended for
196
+ * instrumentation and devtools.
197
+ */
90
198
  setOnRequestHook(onRequestHook) { }
199
+ /**
200
+ * Registers a hook to run once a response has been sent. No-op by default;
201
+ * the built-in adapters accept a `(req, res) => void | Promise<void>`
202
+ * function. Intended for instrumentation and devtools.
203
+ */
91
204
  setOnResponseHook(onResponseHook) { }
205
+ /**
206
+ * Called by `app.close()` before the shutdown hooks run. No-op by default;
207
+ * override to enter a "shutting down" state.
208
+ *
209
+ * @see {@link HttpServer.beforeClose}
210
+ */
211
+ beforeClose() { }
212
+ /**
213
+ * Translates a framework-native error into something the exception filters
214
+ * understand. Invoked by the global exception layer with every error it
215
+ * receives, before it reaches the filters; the returned value is what the
216
+ * filters see. Returns the error unchanged by default. The built-in
217
+ * adapters map, for instance, body-parser `SyntaxError`s to
218
+ * `BadRequestException`.
219
+ */
220
+ mapException(error) {
221
+ return error;
222
+ }
92
223
  }
93
- exports.AbstractHttpAdapter = AbstractHttpAdapter;
@@ -1 +1 @@
1
- export * from './http-adapter';
1
+ export * from './http-adapter.js';
package/adapters/index.js CHANGED
@@ -1,4 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./http-adapter"), exports);
1
+ export * from './http-adapter.js';
@@ -1,7 +1,7 @@
1
- import { CanActivate, ExceptionFilter, NestInterceptor, PipeTransform, VersioningOptions, WebSocketAdapter } from '@nestjs/common';
2
- import { GlobalPrefixOptions } from '@nestjs/common/interfaces';
3
- import { InstanceWrapper } from './injector/instance-wrapper';
4
- import { ExcludeRouteMetadata } from './router/interfaces/exclude-route-metadata.interface';
1
+ import type { CanActivate, ExceptionFilter, NestInterceptor, PipeTransform, PreRequestHook, RouteConflictPolicy, RouteResolutionStrategy, VersioningOptions, WebSocketAdapter } from '@nestjs/common';
2
+ import type { GlobalPrefixOptions } from '@nestjs/common/internal';
3
+ import { InstanceWrapper } from './injector/instance-wrapper.js';
4
+ import { ExcludeRouteMetadata } from './router/interfaces/exclude-route-metadata.interface.js';
5
5
  export declare class ApplicationConfig {
6
6
  private ioAdapter;
7
7
  private globalPrefix;
@@ -10,7 +10,10 @@ export declare class ApplicationConfig {
10
10
  private globalFilters;
11
11
  private globalInterceptors;
12
12
  private globalGuards;
13
+ private globalPreRequestHooks;
13
14
  private versioningOptions;
15
+ private routeConflictPolicy;
16
+ private routeResolutionStrategy;
14
17
  private readonly globalRequestPipes;
15
18
  private readonly globalRequestFilters;
16
19
  private readonly globalRequestInterceptors;
@@ -42,6 +45,12 @@ export declare class ApplicationConfig {
42
45
  getGlobalRequestFilters(): InstanceWrapper<ExceptionFilter>[];
43
46
  addGlobalRequestGuard(wrapper: InstanceWrapper<CanActivate>): void;
44
47
  getGlobalRequestGuards(): InstanceWrapper<CanActivate>[];
48
+ registerPreRequestHook(...hooks: PreRequestHook[]): void;
49
+ getGlobalPreRequestHooks(): PreRequestHook[];
45
50
  enableVersioning(options: VersioningOptions): void;
46
51
  getVersioning(): VersioningOptions | undefined;
52
+ setRouteConflictPolicy(policy: RouteConflictPolicy | undefined): void;
53
+ getRouteConflictPolicy(): RouteConflictPolicy | undefined;
54
+ setRouteResolutionStrategy(strategy: RouteResolutionStrategy | undefined): void;
55
+ getRouteResolutionStrategy(): RouteResolutionStrategy | undefined;
47
56
  }