@velajs/vela 1.19.0 → 1.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (449) hide show
  1. package/CHANGELOG.md +22 -14
  2. package/dist/configurable-module.builder-5FGMaXG6.js +91 -0
  3. package/dist/configurable-module.builder-5FGMaXG6.js.map +1 -0
  4. package/dist/container-BqUHID4l.js +645 -0
  5. package/dist/container-BqUHID4l.js.map +1 -0
  6. package/dist/cron-matcher-C9qv5OUA.js +113 -0
  7. package/dist/cron-matcher-C9qv5OUA.js.map +1 -0
  8. package/dist/decorate-GcSMAbKn.js +528 -0
  9. package/dist/decorate-GcSMAbKn.js.map +1 -0
  10. package/dist/decorators-C8YBFCIk.js +53 -0
  11. package/dist/decorators-C8YBFCIk.js.map +1 -0
  12. package/dist/define-module-NOyOZNXD.js +235 -0
  13. package/dist/define-module-NOyOZNXD.js.map +1 -0
  14. package/dist/discovery.service-BYm95SSD.js +368 -0
  15. package/dist/discovery.service-BYm95SSD.js.map +1 -0
  16. package/dist/discovery.service-Cpf1QcZ5.d.ts +648 -0
  17. package/dist/i18n/index.d.ts +138 -10
  18. package/dist/i18n/index.js +270 -8
  19. package/dist/i18n/index.js.map +1 -0
  20. package/dist/index-D72EQfcC.d.ts +430 -0
  21. package/dist/index-DhShDLCM.d.ts +2310 -0
  22. package/dist/index.d.ts +6 -70
  23. package/dist/index.js +14 -76
  24. package/dist/internal.d.ts +13 -17
  25. package/dist/internal.js +6 -19
  26. package/dist/live/index.d.ts +2 -12
  27. package/dist/live/index.js +826 -16
  28. package/dist/live/index.js.map +1 -0
  29. package/dist/metadata.registry-D1od8ZBt.d.ts +842 -0
  30. package/dist/plugin-ByBlVOve.js +1387 -0
  31. package/dist/plugin-ByBlVOve.js.map +1 -0
  32. package/dist/queue/index.d.ts +247 -10
  33. package/dist/queue/index.js +384 -12
  34. package/dist/queue/index.js.map +1 -0
  35. package/dist/request-context-C3nCGJNd.js +26 -0
  36. package/dist/request-context-C3nCGJNd.js.map +1 -0
  37. package/dist/route.manager-DRAZ5X04.js +991 -0
  38. package/dist/route.manager-DRAZ5X04.js.map +1 -0
  39. package/dist/schedule-node/index.d.ts +32 -3
  40. package/dist/schedule-node/index.js +97 -3
  41. package/dist/schedule-node/index.js.map +1 -0
  42. package/dist/schedule.registry-DVm7Jp5w.d.ts +55 -0
  43. package/dist/seeder/index.d.ts +75 -5
  44. package/dist/seeder/index.js +105 -4
  45. package/dist/seeder/index.js.map +1 -0
  46. package/dist/signed-url-CMmi0SIb.js +56 -0
  47. package/dist/signed-url-CMmi0SIb.js.map +1 -0
  48. package/dist/signed-url-DKhgja4U.d.ts +16 -0
  49. package/dist/src-eb5CI6Xn.js +2151 -0
  50. package/dist/src-eb5CI6Xn.js.map +1 -0
  51. package/dist/storage/index.d.ts +57 -4
  52. package/dist/storage/index.js +22 -5
  53. package/dist/storage/index.js.map +1 -0
  54. package/dist/streaming/index.d.ts +2 -2
  55. package/dist/streaming/index.js +2 -1
  56. package/dist/websocket/index.d.ts +3 -12
  57. package/dist/websocket/index.js +2 -16
  58. package/dist/websocket-DXmB-MWJ.js +697 -0
  59. package/dist/websocket-DXmB-MWJ.js.map +1 -0
  60. package/dist/websocket-node/index.d.ts +108 -6
  61. package/dist/websocket-node/index.js +228 -6
  62. package/dist/websocket-node/index.js.map +1 -0
  63. package/package.json +66 -53
  64. package/dist/__tests__/workers/entry.d.ts +0 -9
  65. package/dist/__tests__/workers-als/entry-als.d.ts +0 -9
  66. package/dist/application.d.ts +0 -104
  67. package/dist/application.js +0 -364
  68. package/dist/cache/cache.decorators.d.ts +0 -2
  69. package/dist/cache/cache.decorators.js +0 -4
  70. package/dist/cache/cache.interceptor.d.ts +0 -9
  71. package/dist/cache/cache.interceptor.js +0 -60
  72. package/dist/cache/cache.module.d.ts +0 -7
  73. package/dist/cache/cache.module.js +0 -58
  74. package/dist/cache/cache.service.d.ts +0 -9
  75. package/dist/cache/cache.service.js +0 -42
  76. package/dist/cache/cache.store.d.ts +0 -12
  77. package/dist/cache/cache.store.js +0 -51
  78. package/dist/cache/cache.tokens.d.ts +0 -6
  79. package/dist/cache/cache.tokens.js +0 -5
  80. package/dist/cache/cache.types.d.ts +0 -41
  81. package/dist/cache/cache.types.js +0 -1
  82. package/dist/cache/index.d.ts +0 -8
  83. package/dist/cache/index.js +0 -7
  84. package/dist/cache/tiered-cache.store.d.ts +0 -19
  85. package/dist/cache/tiered-cache.store.js +0 -40
  86. package/dist/config/config.module.d.ts +0 -19
  87. package/dist/config/config.module.js +0 -98
  88. package/dist/config/config.service.d.ts +0 -20
  89. package/dist/config/config.service.js +0 -43
  90. package/dist/config/config.store.d.ts +0 -46
  91. package/dist/config/config.store.js +0 -119
  92. package/dist/config/config.tokens.d.ts +0 -13
  93. package/dist/config/config.tokens.js +0 -14
  94. package/dist/config/config.types.d.ts +0 -41
  95. package/dist/config/config.types.js +0 -4
  96. package/dist/config/index.d.ts +0 -7
  97. package/dist/config/index.js +0 -5
  98. package/dist/config/register-as.d.ts +0 -52
  99. package/dist/config/register-as.js +0 -39
  100. package/dist/constants.d.ts +0 -44
  101. package/dist/constants.js +0 -46
  102. package/dist/container/container.d.ts +0 -154
  103. package/dist/container/container.js +0 -849
  104. package/dist/container/decorators.d.ts +0 -17
  105. package/dist/container/decorators.js +0 -57
  106. package/dist/container/disposable.d.ts +0 -5
  107. package/dist/container/disposable.js +0 -33
  108. package/dist/container/index.d.ts +0 -6
  109. package/dist/container/index.js +0 -5
  110. package/dist/container/mixin.d.ts +0 -24
  111. package/dist/container/mixin.js +0 -26
  112. package/dist/container/module-ref.d.ts +0 -21
  113. package/dist/container/module-ref.js +0 -48
  114. package/dist/container/types.d.ts +0 -154
  115. package/dist/container/types.js +0 -49
  116. package/dist/cors/cors.module.d.ts +0 -7
  117. package/dist/cors/cors.module.js +0 -37
  118. package/dist/cors/cors.tokens.d.ts +0 -3
  119. package/dist/cors/cors.tokens.js +0 -2
  120. package/dist/cors/cors.types.d.ts +0 -8
  121. package/dist/cors/cors.types.js +0 -1
  122. package/dist/cors/index.d.ts +0 -3
  123. package/dist/cors/index.js +0 -2
  124. package/dist/crypto/signed-url.d.ts +0 -12
  125. package/dist/crypto/signed-url.js +0 -60
  126. package/dist/discovery/discoverable.decorator.d.ts +0 -38
  127. package/dist/discovery/discoverable.decorator.js +0 -42
  128. package/dist/discovery/discovery.service.d.ts +0 -102
  129. package/dist/discovery/discovery.service.js +0 -177
  130. package/dist/discovery/index.d.ts +0 -2
  131. package/dist/discovery/index.js +0 -2
  132. package/dist/entrypoint/entrypoint.registry.d.ts +0 -42
  133. package/dist/entrypoint/entrypoint.registry.js +0 -112
  134. package/dist/entrypoint/entrypoint.types.d.ts +0 -41
  135. package/dist/entrypoint/entrypoint.types.js +0 -3
  136. package/dist/entrypoint/execution-context.d.ts +0 -15
  137. package/dist/entrypoint/execution-context.js +0 -21
  138. package/dist/entrypoint/execution-scope.d.ts +0 -21
  139. package/dist/entrypoint/execution-scope.js +0 -28
  140. package/dist/entrypoint/index.d.ts +0 -4
  141. package/dist/entrypoint/index.js +0 -4
  142. package/dist/errors/http-exception.d.ts +0 -63
  143. package/dist/errors/http-exception.js +0 -142
  144. package/dist/errors/index.d.ts +0 -1
  145. package/dist/errors/index.js +0 -1
  146. package/dist/event-emitter/event-emitter.decorators.d.ts +0 -1
  147. package/dist/event-emitter/event-emitter.decorators.js +0 -10
  148. package/dist/event-emitter/event-emitter.module.d.ts +0 -2
  149. package/dist/event-emitter/event-emitter.module.js +0 -23
  150. package/dist/event-emitter/event-emitter.service.d.ts +0 -13
  151. package/dist/event-emitter/event-emitter.service.js +0 -127
  152. package/dist/event-emitter/event-emitter.subscriber.d.ts +0 -9
  153. package/dist/event-emitter/event-emitter.subscriber.js +0 -45
  154. package/dist/event-emitter/event-emitter.tokens.d.ts +0 -1
  155. package/dist/event-emitter/event-emitter.tokens.js +0 -1
  156. package/dist/event-emitter/event-emitter.types.d.ts +0 -5
  157. package/dist/event-emitter/event-emitter.types.js +0 -1
  158. package/dist/event-emitter/index.d.ts +0 -6
  159. package/dist/event-emitter/index.js +0 -5
  160. package/dist/exceptions/errors.module.d.ts +0 -40
  161. package/dist/exceptions/errors.module.js +0 -46
  162. package/dist/exceptions/exception-handler.d.ts +0 -56
  163. package/dist/exceptions/exception-handler.js +0 -17
  164. package/dist/exceptions/index.d.ts +0 -6
  165. package/dist/exceptions/index.js +0 -3
  166. package/dist/exceptions/reporter.d.ts +0 -21
  167. package/dist/exceptions/reporter.js +0 -70
  168. package/dist/factory/adapter.d.ts +0 -36
  169. package/dist/factory/adapter.js +0 -18
  170. package/dist/factory/bootstrap.d.ts +0 -23
  171. package/dist/factory/bootstrap.js +0 -110
  172. package/dist/factory.d.ts +0 -16
  173. package/dist/factory.js +0 -36
  174. package/dist/fetch/fetch.module.d.ts +0 -7
  175. package/dist/fetch/fetch.module.js +0 -31
  176. package/dist/fetch/fetch.service.d.ts +0 -24
  177. package/dist/fetch/fetch.service.js +0 -145
  178. package/dist/fetch/fetch.types.d.ts +0 -24
  179. package/dist/fetch/fetch.types.js +0 -1
  180. package/dist/fetch/index.d.ts +0 -3
  181. package/dist/fetch/index.js +0 -2
  182. package/dist/health/health.http.d.ts +0 -14
  183. package/dist/health/health.http.js +0 -75
  184. package/dist/health/health.indicator.d.ts +0 -9
  185. package/dist/health/health.indicator.js +0 -32
  186. package/dist/health/health.module.d.ts +0 -2
  187. package/dist/health/health.module.js +0 -26
  188. package/dist/health/health.service.d.ts +0 -7
  189. package/dist/health/health.service.js +0 -69
  190. package/dist/health/health.types.d.ts +0 -15
  191. package/dist/health/health.types.js +0 -1
  192. package/dist/health/index.d.ts +0 -6
  193. package/dist/health/index.js +0 -4
  194. package/dist/http/ambient.d.ts +0 -17
  195. package/dist/http/ambient.js +0 -44
  196. package/dist/http/argument-resolver.d.ts +0 -10
  197. package/dist/http/argument-resolver.js +0 -89
  198. package/dist/http/decorators.d.ts +0 -198
  199. package/dist/http/decorators.js +0 -321
  200. package/dist/http/execution-context.d.ts +0 -8
  201. package/dist/http/execution-context.js +0 -35
  202. package/dist/http/handler-executor.d.ts +0 -20
  203. package/dist/http/handler-executor.js +0 -133
  204. package/dist/http/index.d.ts +0 -12
  205. package/dist/http/index.js +0 -7
  206. package/dist/http/instantiate.d.ts +0 -4
  207. package/dist/http/instantiate.js +0 -45
  208. package/dist/http/lazy-param.decorator.d.ts +0 -37
  209. package/dist/http/lazy-param.decorator.js +0 -117
  210. package/dist/http/request-container.d.ts +0 -16
  211. package/dist/http/request-container.js +0 -19
  212. package/dist/http/request-context.d.ts +0 -13
  213. package/dist/http/request-context.js +0 -22
  214. package/dist/http/response-mapper.d.ts +0 -8
  215. package/dist/http/response-mapper.js +0 -42
  216. package/dist/http/route-contributor.d.ts +0 -68
  217. package/dist/http/route-contributor.js +0 -22
  218. package/dist/http/route-map.d.ts +0 -30
  219. package/dist/http/route-map.js +0 -27
  220. package/dist/http/route.manager.d.ts +0 -92
  221. package/dist/http/route.manager.js +0 -481
  222. package/dist/http/types.d.ts +0 -37
  223. package/dist/http/types.js +0 -1
  224. package/dist/http/url/index.d.ts +0 -4
  225. package/dist/http/url/index.js +0 -3
  226. package/dist/http/url/signed-url.guard.d.ts +0 -27
  227. package/dist/http/url/signed-url.guard.js +0 -62
  228. package/dist/http/url/signing-secret.d.ts +0 -20
  229. package/dist/http/url/signing-secret.js +0 -24
  230. package/dist/http/url/url-generator.service.d.ts +0 -52
  231. package/dist/http/url/url-generator.service.js +0 -104
  232. package/dist/i18n/deep-merge.d.ts +0 -2
  233. package/dist/i18n/deep-merge.js +0 -15
  234. package/dist/i18n/i18n.middleware.d.ts +0 -15
  235. package/dist/i18n/i18n.middleware.js +0 -94
  236. package/dist/i18n/i18n.module.d.ts +0 -13
  237. package/dist/i18n/i18n.module.js +0 -69
  238. package/dist/i18n/i18n.options.d.ts +0 -30
  239. package/dist/i18n/i18n.options.js +0 -16
  240. package/dist/i18n/i18n.service.d.ts +0 -20
  241. package/dist/i18n/i18n.service.js +0 -49
  242. package/dist/i18n/i18n.tokens.d.ts +0 -6
  243. package/dist/i18n/i18n.tokens.js +0 -3
  244. package/dist/i18n/i18n.types.d.ts +0 -6
  245. package/dist/i18n/i18n.types.js +0 -1
  246. package/dist/i18n/message-loader.service.d.ts +0 -21
  247. package/dist/i18n/message-loader.service.js +0 -90
  248. package/dist/i18n/message-registry.d.ts +0 -16
  249. package/dist/i18n/message-registry.js +0 -49
  250. package/dist/lifecycle/index.d.ts +0 -20
  251. package/dist/lifecycle/index.js +0 -15
  252. package/dist/live/live.cursor.d.ts +0 -22
  253. package/dist/live/live.cursor.js +0 -56
  254. package/dist/live/live.decorators.d.ts +0 -32
  255. package/dist/live/live.decorators.js +0 -46
  256. package/dist/live/live.delta.d.ts +0 -15
  257. package/dist/live/live.delta.js +0 -51
  258. package/dist/live/live.engine.d.ts +0 -88
  259. package/dist/live/live.engine.js +0 -471
  260. package/dist/live/live.invalidation.d.ts +0 -45
  261. package/dist/live/live.invalidation.js +0 -99
  262. package/dist/live/live.module.d.ts +0 -28
  263. package/dist/live/live.module.js +0 -87
  264. package/dist/live/live.tokens.d.ts +0 -9
  265. package/dist/live/live.tokens.js +0 -8
  266. package/dist/live/live.types.d.ts +0 -138
  267. package/dist/live/live.types.js +0 -1
  268. package/dist/live/presence.d.ts +0 -44
  269. package/dist/live/presence.js +0 -130
  270. package/dist/metadata.d.ts +0 -10
  271. package/dist/metadata.js +0 -20
  272. package/dist/module/configurable-module.builder.d.ts +0 -56
  273. package/dist/module/configurable-module.builder.js +0 -84
  274. package/dist/module/configurable-module.types.d.ts +0 -93
  275. package/dist/module/configurable-module.types.js +0 -5
  276. package/dist/module/decorators.d.ts +0 -10
  277. package/dist/module/decorators.js +0 -47
  278. package/dist/module/define-module.d.ts +0 -112
  279. package/dist/module/define-module.js +0 -232
  280. package/dist/module/graph.d.ts +0 -10
  281. package/dist/module/graph.js +0 -35
  282. package/dist/module/index.d.ts +0 -10
  283. package/dist/module/index.js +0 -7
  284. package/dist/module/lazy-modules.d.ts +0 -82
  285. package/dist/module/lazy-modules.js +0 -231
  286. package/dist/module/lazy-provider.d.ts +0 -65
  287. package/dist/module/lazy-provider.js +0 -111
  288. package/dist/module/middleware.d.ts +0 -30
  289. package/dist/module/middleware.js +0 -67
  290. package/dist/module/module-loader.d.ts +0 -58
  291. package/dist/module/module-loader.js +0 -484
  292. package/dist/module/stable-hash.d.ts +0 -15
  293. package/dist/module/stable-hash.js +0 -52
  294. package/dist/module/types.d.ts +0 -1
  295. package/dist/module/types.js +0 -1
  296. package/dist/openapi/decorators.d.ts +0 -34
  297. package/dist/openapi/decorators.js +0 -66
  298. package/dist/openapi/document.d.ts +0 -3
  299. package/dist/openapi/document.js +0 -316
  300. package/dist/openapi/index.d.ts +0 -7
  301. package/dist/openapi/index.js +0 -6
  302. package/dist/openapi/redoc-ui.d.ts +0 -1
  303. package/dist/openapi/redoc-ui.js +0 -19
  304. package/dist/openapi/scalar-ui.d.ts +0 -1
  305. package/dist/openapi/scalar-ui.js +0 -19
  306. package/dist/openapi/swagger-ui.d.ts +0 -1
  307. package/dist/openapi/swagger-ui.js +0 -23
  308. package/dist/openapi/types.d.ts +0 -182
  309. package/dist/openapi/types.js +0 -4
  310. package/dist/openapi/zod-to-json-schema.d.ts +0 -4
  311. package/dist/openapi/zod-to-json-schema.js +0 -57
  312. package/dist/pipeline/app-providers.d.ts +0 -10
  313. package/dist/pipeline/app-providers.js +0 -43
  314. package/dist/pipeline/component.manager.d.ts +0 -25
  315. package/dist/pipeline/component.manager.js +0 -66
  316. package/dist/pipeline/decorators.d.ts +0 -10
  317. package/dist/pipeline/decorators.js +0 -42
  318. package/dist/pipeline/index.d.ts +0 -12
  319. package/dist/pipeline/index.js +0 -7
  320. package/dist/pipeline/pipeline-runner.d.ts +0 -31
  321. package/dist/pipeline/pipeline-runner.js +0 -40
  322. package/dist/pipeline/pipes.d.ts +0 -48
  323. package/dist/pipeline/pipes.js +0 -104
  324. package/dist/pipeline/reflector.d.ts +0 -86
  325. package/dist/pipeline/reflector.js +0 -121
  326. package/dist/pipeline/scoped-components.d.ts +0 -26
  327. package/dist/pipeline/scoped-components.js +0 -27
  328. package/dist/pipeline/tokens.d.ts +0 -57
  329. package/dist/pipeline/tokens.js +0 -47
  330. package/dist/pipeline/types.d.ts +0 -64
  331. package/dist/pipeline/types.js +0 -1
  332. package/dist/plugin/plugin.d.ts +0 -31
  333. package/dist/plugin/plugin.js +0 -111
  334. package/dist/queue/inline.driver.d.ts +0 -30
  335. package/dist/queue/inline.driver.js +0 -58
  336. package/dist/queue/queue.binding.d.ts +0 -23
  337. package/dist/queue/queue.binding.js +0 -60
  338. package/dist/queue/queue.client.d.ts +0 -20
  339. package/dist/queue/queue.client.js +0 -33
  340. package/dist/queue/queue.decorators.d.ts +0 -23
  341. package/dist/queue/queue.decorators.js +0 -46
  342. package/dist/queue/queue.dispatch.d.ts +0 -36
  343. package/dist/queue/queue.dispatch.js +0 -109
  344. package/dist/queue/queue.module.d.ts +0 -32
  345. package/dist/queue/queue.module.js +0 -80
  346. package/dist/queue/queue.tokens.d.ts +0 -21
  347. package/dist/queue/queue.tokens.js +0 -34
  348. package/dist/queue/queue.types.d.ts +0 -61
  349. package/dist/queue/queue.types.js +0 -4
  350. package/dist/registry/index.d.ts +0 -2
  351. package/dist/registry/index.js +0 -1
  352. package/dist/registry/metadata.registry.d.ts +0 -73
  353. package/dist/registry/metadata.registry.js +0 -357
  354. package/dist/registry/paths.d.ts +0 -3
  355. package/dist/registry/paths.js +0 -15
  356. package/dist/registry/types.d.ts +0 -116
  357. package/dist/registry/types.js +0 -1
  358. package/dist/registry/util.d.ts +0 -3
  359. package/dist/registry/util.js +0 -8
  360. package/dist/schedule/cron-matcher.d.ts +0 -2
  361. package/dist/schedule/cron-matcher.js +0 -62
  362. package/dist/schedule/index.d.ts +0 -8
  363. package/dist/schedule/index.js +0 -5
  364. package/dist/schedule/schedule.decorators.d.ts +0 -2
  365. package/dist/schedule/schedule.decorators.js +0 -18
  366. package/dist/schedule/schedule.module.d.ts +0 -9
  367. package/dist/schedule/schedule.module.js +0 -28
  368. package/dist/schedule/schedule.registry.d.ts +0 -23
  369. package/dist/schedule/schedule.registry.js +0 -63
  370. package/dist/schedule/schedule.tokens.d.ts +0 -2
  371. package/dist/schedule/schedule.tokens.js +0 -2
  372. package/dist/schedule/schedule.types.d.ts +0 -8
  373. package/dist/schedule/schedule.types.js +0 -1
  374. package/dist/schedule-node/schedule-node.module.d.ts +0 -9
  375. package/dist/schedule-node/schedule-node.module.js +0 -28
  376. package/dist/schedule-node/schedule.executor.d.ts +0 -19
  377. package/dist/schedule-node/schedule.executor.js +0 -112
  378. package/dist/seeder/seeder.decorator.d.ts +0 -7
  379. package/dist/seeder/seeder.decorator.js +0 -15
  380. package/dist/seeder/seeder.module.d.ts +0 -16
  381. package/dist/seeder/seeder.module.js +0 -44
  382. package/dist/seeder/seeder.registry.d.ts +0 -23
  383. package/dist/seeder/seeder.registry.js +0 -83
  384. package/dist/seeder/seeder.tokens.d.ts +0 -2
  385. package/dist/seeder/seeder.tokens.js +0 -1
  386. package/dist/seeder/seeder.types.d.ts +0 -20
  387. package/dist/seeder/seeder.types.js +0 -1
  388. package/dist/serialization/index.d.ts +0 -2
  389. package/dist/serialization/index.js +0 -2
  390. package/dist/serialization/serialize.decorator.d.ts +0 -6
  391. package/dist/serialization/serialize.decorator.js +0 -7
  392. package/dist/serialization/serializer.interceptor.d.ts +0 -4
  393. package/dist/serialization/serializer.interceptor.js +0 -16
  394. package/dist/services/index.d.ts +0 -2
  395. package/dist/services/index.js +0 -1
  396. package/dist/services/logger.d.ts +0 -59
  397. package/dist/services/logger.js +0 -159
  398. package/dist/storage/path-template.d.ts +0 -9
  399. package/dist/storage/path-template.js +0 -20
  400. package/dist/storage/storage.types.d.ts +0 -41
  401. package/dist/storage/storage.types.js +0 -5
  402. package/dist/throttler/index.d.ts +0 -6
  403. package/dist/throttler/index.js +0 -5
  404. package/dist/throttler/throttler.decorators.d.ts +0 -3
  405. package/dist/throttler/throttler.decorators.js +0 -4
  406. package/dist/throttler/throttler.guard.d.ts +0 -9
  407. package/dist/throttler/throttler.guard.js +0 -72
  408. package/dist/throttler/throttler.module.d.ts +0 -7
  409. package/dist/throttler/throttler.module.js +0 -41
  410. package/dist/throttler/throttler.storage.d.ts +0 -10
  411. package/dist/throttler/throttler.storage.js +0 -44
  412. package/dist/throttler/throttler.tokens.d.ts +0 -6
  413. package/dist/throttler/throttler.tokens.js +0 -5
  414. package/dist/throttler/throttler.types.d.ts +0 -25
  415. package/dist/throttler/throttler.types.js +0 -1
  416. package/dist/validation/create-zod-dto.d.ts +0 -13
  417. package/dist/validation/create-zod-dto.js +0 -18
  418. package/dist/validation/index.d.ts +0 -3
  419. package/dist/validation/index.js +0 -2
  420. package/dist/validation/validation.pipe.d.ts +0 -4
  421. package/dist/validation/validation.pipe.js +0 -19
  422. package/dist/websocket/websocket.decorators.d.ts +0 -47
  423. package/dist/websocket/websocket.decorators.js +0 -80
  424. package/dist/websocket/websocket.module.d.ts +0 -35
  425. package/dist/websocket/websocket.module.js +0 -63
  426. package/dist/websocket/websocket.tokens.d.ts +0 -30
  427. package/dist/websocket/websocket.tokens.js +0 -27
  428. package/dist/websocket/websocket.types.d.ts +0 -102
  429. package/dist/websocket/websocket.types.js +0 -4
  430. package/dist/websocket/ws-argument-resolver.d.ts +0 -13
  431. package/dist/websocket/ws-argument-resolver.js +0 -40
  432. package/dist/websocket/ws-dispatcher.d.ts +0 -54
  433. package/dist/websocket/ws-dispatcher.js +0 -343
  434. package/dist/websocket/ws-exception.d.ts +0 -25
  435. package/dist/websocket/ws-exception.js +0 -42
  436. package/dist/websocket/ws-execution-context.d.ts +0 -9
  437. package/dist/websocket/ws-execution-context.js +0 -24
  438. package/dist/websocket/ws-server.d.ts +0 -31
  439. package/dist/websocket/ws-server.js +0 -74
  440. package/dist/websocket/ws-sync.d.ts +0 -47
  441. package/dist/websocket/ws-sync.js +0 -74
  442. package/dist/websocket-node/node-ws-client.d.ts +0 -24
  443. package/dist/websocket-node/node-ws-client.js +0 -49
  444. package/dist/websocket-node/redis-live.d.ts +0 -24
  445. package/dist/websocket-node/redis-live.js +0 -57
  446. package/dist/websocket-node/redis-sync.d.ts +0 -33
  447. package/dist/websocket-node/redis-sync.js +0 -56
  448. package/dist/websocket-node/register-gateways.d.ts +0 -20
  449. package/dist/websocket-node/register-gateways.js +0 -61
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-ByBlVOve.js","names":[],"sources":["../src/entrypoint/entrypoint.types.ts","../src/entrypoint/entrypoint.registry.ts","../src/lifecycle/index.ts","../src/module/lazy-modules.ts","../src/openapi/scalar-ui.ts","../src/openapi/swagger-ui.ts","../src/openapi/redoc-ui.ts","../src/application.ts","../src/container/module-ref.ts","../src/config/config.tokens.ts","../src/http/url/signing-secret.ts","../src/http/url/url-generator.service.ts","../src/http/url/signed-url.guard.ts","../src/module/middleware.ts","../src/module/module-loader.ts","../src/pipeline/app-providers.ts","../src/factory/bootstrap.ts","../src/plugin/plugin.ts"],"sourcesContent":["import type { Token } from '../container/types';\nimport type { DiscoveryService } from '../discovery/discovery.service';\n\n/**\n * A declared entrypoint kind: a named category of non-HTTP (or non-standard)\n * entry surface that some module knows how to dispatch — WebSocket gateways,\n * queue consumers, scheduled jobs, CLI commands. Core ships NO fixed set;\n * any module registers its own kind and any runtime adapter can query it.\n *\n * `metaKey` binds the kind to a decorator's metadata key: every provider\n * carrying that metadata becomes an entrypoint of this kind at bootstrap.\n */\nexport interface EntrypointKind {\n kind: string;\n metaKey: string;\n /**\n * 'class': one entrypoint per decorated provider (`@WebSocketGateway`).\n * 'method': one entrypoint per decorated method (`@Cron`, `@QueueConsumer`\n * handler methods) — flattened from the class-level list convention.\n */\n level: 'class' | 'method';\n}\n\n/** One concrete entrypoint discovered at bootstrap. */\nexport interface Entrypoint<M = unknown> {\n kind: string;\n token: Token;\n /** The resolved provider backing the entrypoint (undefined if request-scoped). */\n instance: unknown;\n /** Present for method-level kinds. */\n methodName?: string | symbol;\n meta: M;\n}\n\n/**\n * Escape hatch for providers whose entrypoints are computed rather than purely\n * decorator-declared (e.g. `WsDispatcher` aggregates per-gateway routing state\n * before contributing). Implementers are detected among the app's eagerly\n * instantiated providers after `onApplicationBootstrap` hooks have run.\n */\nexport interface ContributesEntrypoints {\n collectEntrypoints(discovery: DiscoveryService): Entrypoint[] | Promise<Entrypoint[]>;\n}\n\nexport function contributesEntrypoints(x: unknown): x is ContributesEntrypoints {\n return (\n typeof x === 'object' &&\n x !== null &&\n typeof (x as ContributesEntrypoints).collectEntrypoints === 'function'\n );\n}\n","import type { DiscoveryService } from '../discovery/discovery.service';\nimport { contributesEntrypoints, type Entrypoint, type EntrypointKind } from './entrypoint.types';\n\n// Kind declarations are process-global and import-time (a module declares its\n// kind next to its decorator, before any app exists), so they are anchored on\n// `globalThis` exactly like MetadataRegistry state: a Vite HMR re-eval must\n// reuse the same store, not mint an empty one.\nconst KIND_STORE_KEY = Symbol.for('vela:entrypoints:v1');\n\nfunction kindStore(): Map<string, EntrypointKind> {\n const g = globalThis as unknown as Record<symbol, Map<string, EntrypointKind> | undefined>;\n return (g[KIND_STORE_KEY] ??= new Map());\n}\n\n/**\n * Declare an entrypoint kind. Idempotent per `kind` (last declaration wins so\n * an HMR-re-evaluated module can re-declare); typically called at module\n * import time next to the decorator definition:\n *\n * ```ts\n * export const WS_GATEWAY_METADATA = 'vela:ws:gateway';\n * registerEntrypointKind({ kind: 'websocket', metaKey: WS_GATEWAY_METADATA, level: 'class' });\n * ```\n */\nexport function registerEntrypointKind(k: EntrypointKind): void {\n kindStore().set(k.kind, k);\n}\n\n/** All declared kinds (registration order). */\nexport function getEntrypointKinds(): EntrypointKind[] {\n return [...kindStore().values()];\n}\n\n/**\n * Reset all kind declarations. Test-only.\n * @internal\n */\nexport function _resetEntrypointKinds(): void {\n kindStore().clear();\n}\n\n/**\n * The per-application view of every entrypoint: built once after\n * `onApplicationBootstrap` hooks have run (so `ContributesEntrypoints`\n * providers have finished their own discovery), queried by runtime adapters:\n *\n * ```ts\n * for (const ep of app.entrypoints.ofKind('websocket')) { ... }\n * ```\n *\n * Per-app (never global): two applications in one process each build their\n * own registry from their own container.\n */\nexport class EntrypointRegistry {\n private readonly byKind = new Map<string, Entrypoint[]>();\n\n static async build(\n discovery: DiscoveryService,\n eagerInstances: readonly unknown[],\n options: { deferLazy?: boolean } = {},\n ): Promise<EntrypointRegistry> {\n const registry = new EntrypointRegistry();\n // With deferLazy, providers of unmaterialized lazy modules yield\n // metadata-only entries (instance: undefined). Dispatchers re-resolve by\n // token per event, so the owning module materializes at dispatch time.\n const filter = options.deferLazy ? { deferLazy: true } : undefined;\n\n for (const kind of getEntrypointKinds()) {\n if (kind.level === 'class') {\n for (const found of discovery.providersWithMeta(kind.metaKey, filter)) {\n registry.add({\n kind: kind.kind,\n token: found.token,\n instance: found.instance,\n meta: found.meta,\n });\n }\n } else {\n for (const found of discovery.methodsWithMeta(kind.metaKey, filter)) {\n registry.add({\n kind: kind.kind,\n token: found.class.token,\n instance: found.class.instance,\n methodName: found.methodName,\n meta: found.meta,\n });\n }\n }\n }\n\n // Computed contributions. A contributor is AUTHORITATIVE for every kind it\n // reports: its entries replace any metaKey-derived ones of the same kind,\n // so a dispatcher that both carries decorator metadata and computes richer\n // entries (path routing, aggregated handlers) never double-reports.\n const contributed: Entrypoint[] = [];\n for (const instance of new Set(eagerInstances)) {\n if (!contributesEntrypoints(instance)) continue;\n contributed.push(...(await instance.collectEntrypoints(discovery)));\n }\n for (const kind of new Set(contributed.map((ep) => ep.kind))) {\n registry.byKind.delete(kind);\n }\n for (const ep of contributed) registry.add(ep);\n\n return registry;\n }\n\n private add(ep: Entrypoint): void {\n const list = this.byKind.get(ep.kind);\n if (list) list.push(ep);\n else this.byKind.set(ep.kind, [ep]);\n }\n\n ofKind<M = unknown>(kind: string): Entrypoint<M>[] {\n return (this.byKind.get(kind) ?? []) as Entrypoint<M>[];\n }\n\n kinds(): string[] {\n return [...this.byKind.keys()];\n }\n\n all(): Entrypoint[] {\n return [...this.byKind.values()].flat();\n }\n}\n","export interface OnModuleInit {\n onModuleInit(): void | Promise<void>;\n}\n\nexport interface OnApplicationBootstrap {\n onApplicationBootstrap(): void | Promise<void>;\n}\n\nexport interface OnModuleDestroy {\n onModuleDestroy(): void | Promise<void>;\n}\n\nexport interface OnApplicationShutdown {\n onApplicationShutdown(signal?: string): void | Promise<void>;\n}\n\nexport interface BeforeApplicationShutdown {\n beforeApplicationShutdown(signal?: string): void | Promise<void>;\n}\n\nexport function hasOnModuleInit(instance: unknown): instance is OnModuleInit {\n return (\n instance !== null &&\n typeof instance === 'object' &&\n typeof (instance as OnModuleInit).onModuleInit === 'function'\n );\n}\n\nexport function hasOnApplicationBootstrap(instance: unknown): instance is OnApplicationBootstrap {\n return (\n instance !== null &&\n typeof instance === 'object' &&\n typeof (instance as OnApplicationBootstrap).onApplicationBootstrap === 'function'\n );\n}\n\nexport function hasOnModuleDestroy(instance: unknown): instance is OnModuleDestroy {\n return (\n instance !== null &&\n typeof instance === 'object' &&\n typeof (instance as OnModuleDestroy).onModuleDestroy === 'function'\n );\n}\n\nexport function hasBeforeApplicationShutdown(\n instance: unknown,\n): instance is BeforeApplicationShutdown {\n return (\n instance !== null &&\n typeof instance === 'object' &&\n typeof (instance as BeforeApplicationShutdown).beforeApplicationShutdown === 'function'\n );\n}\n\nexport function hasOnApplicationShutdown(instance: unknown): instance is OnApplicationShutdown {\n return (\n instance !== null &&\n typeof instance === 'object' &&\n typeof (instance as OnApplicationShutdown).onApplicationShutdown === 'function'\n );\n}\n","import { Scope } from '../constants';\nimport type { Container } from '../container/container';\nimport type { LazyResolutionHook, Token } from '../container/types';\nimport { hasOnApplicationBootstrap, hasOnModuleInit } from '../lifecycle/index';\n\n/** One lazy module instance's deferral unit: its own tokens, in registration order. */\nexport interface LazyModuleGroup {\n moduleId: string;\n tokens: Token[];\n /**\n * A class provider's prototype declares `collectEntrypoints` — the module\n * must be materialized before the entrypoint registry snapshot or its\n * computed contributions would be silently absent.\n */\n hasEntrypointContributor: boolean;\n}\n\nfunction isThenable(x: unknown): x is PromiseLike<unknown> {\n return (\n x !== null &&\n (typeof x === 'object' || typeof x === 'function') &&\n typeof (x as PromiseLike<unknown>).then === 'function'\n );\n}\n\n/**\n * Owns deferred-module state for one application: which module instances are\n * still pending, which have been claimed by a container trigger, and how\n * claimed groups get completed (construction + lifecycle-hook replay).\n *\n * Phases:\n * - `'bootstrap'` (until the end of `callOnApplicationBootstrap`): completed\n * groups are *absorbed* — their instances queue up for the application's\n * normal hook phases, so a lazy module dragged in by an eager consumer gets\n * today-identical semantics.\n * - `'live'`: hooks replay at drain time (memoized, exactly once), then the\n * instances are handed to the application for shutdown-hook symmetry.\n *\n * Sync/async duality: sync drains throw a descriptive error when a member\n * factory or hook yields a thenable — lazy modules with async providers or\n * hooks must be reached through an async seam (`materializeLazyModules()`,\n * `resolveAsync`) or stay eager.\n */\nexport class LazyModuleManager implements LazyResolutionHook {\n private readonly pending = new Map<string, LazyModuleGroup>();\n private readonly claimed: LazyModuleGroup[] = [];\n private readonly absorbed: unknown[] = [];\n private phase: 'bootstrap' | 'live' = 'bootstrap';\n private draining = false;\n // In-flight async drain: concurrent drainAsync callers must await the SAME\n // completion (the running loop picks their claims up), never resolve early\n // with a group's hooks still pending.\n private drainPromise?: Promise<void>;\n private onMaterialized?: (instances: unknown[]) => void;\n\n constructor(private readonly container: Container) {}\n\n registerGroup(group: LazyModuleGroup): void {\n this.pending.set(group.moduleId, group);\n }\n\n /** Application sink for live-phase materializations (shutdown symmetry). */\n setOnMaterialized(sink: (instances: unknown[]) => void): void {\n this.onMaterialized = sink;\n }\n\n setPhaseLive(): void {\n this.phase = 'live';\n }\n\n isPending(moduleId: string): boolean {\n return this.pending.has(moduleId);\n }\n\n /** Tokens whose owning modules are ALL still pending are deferred. */\n hasPendingModules(): boolean {\n return this.pending.size > 0;\n }\n\n claim(moduleId: string): void {\n const group = this.pending.get(moduleId);\n if (!group) return;\n this.pending.delete(moduleId);\n this.claimed.push(group);\n }\n\n hasClaimed(): boolean {\n return this.claimed.length > 0;\n }\n\n /**\n * A drain loop is running. The container consults this before its\n * post-resolution drain: `constructGroupAsync` resolves members through\n * `resolveAsync`, whose end-of-cascade check would otherwise re-enter and\n * AWAIT the very drain promise it is executing inside — a self-referential\n * await that never settles (with ≥2 claimed groups). Claims made while\n * draining are picked up by the running loop instead.\n */\n isDraining(): boolean {\n return this.draining;\n }\n\n /** Instances constructed during the bootstrap phase, owed their hooks. */\n takeAbsorbed(): unknown[] {\n if (this.absorbed.length === 0) return [];\n return this.absorbed.splice(0, this.absorbed.length);\n }\n\n drainSync(): void {\n if (this.draining) return;\n this.draining = true;\n try {\n // Construct-all-then-hook, batch by batch: a cascade's groups arrive in\n // consumer-before-dependency claim order (the consumer's token resolves\n // first; constructing it claims its deps), so hook phases run over the\n // REVERSED batch — dependency-before-consumer, matching what the eager\n // bootstrap would have produced. Hooks can claim further groups\n // (discovery cascades) → outer loop.\n while (this.claimed.length > 0) {\n const batch: Array<{ group: LazyModuleGroup; instances: unknown[] }> = [];\n while (this.claimed.length > 0) {\n const group = this.claimed.shift()!;\n batch.push({ group, instances: this.constructGroupSync(group) });\n }\n this.finishBatchSync(batch);\n }\n } finally {\n this.draining = false;\n }\n }\n\n drainAsync(): Promise<void> {\n if (this.draining) {\n // External concurrent callers await the in-flight completion (its loop\n // picks their claims up). Callers INSIDE the drain's own await chain\n // never reach here — the container skips its post-resolution drain\n // while isDraining() (self-await would deadlock).\n return this.drainPromise ?? Promise.resolve();\n }\n this.draining = true;\n const run = (async () => {\n try {\n while (this.claimed.length > 0) {\n const batch: Array<{ group: LazyModuleGroup; instances: unknown[] }> = [];\n while (this.claimed.length > 0) {\n const group = this.claimed.shift()!;\n batch.push({ group, instances: await this.constructGroupAsync(group) });\n }\n await this.finishBatchAsync(batch);\n }\n } finally {\n this.draining = false;\n this.drainPromise = undefined;\n }\n })();\n this.drainPromise = run;\n return run;\n }\n\n /**\n * Materialize every still-pending group whose providers compute entrypoints\n * (`collectEntrypoints` on a class prototype). Called by the application\n * right before the entrypoint-registry snapshot so computed contributions\n * are never silently absent. The cost — those modules are effectively\n * eager — is the documented price of contributing computed entrypoints.\n */\n async materializeContributors(): Promise<void> {\n for (const group of [...this.pending.values()]) {\n if (group.hasEntrypointContributor) this.claim(group.moduleId);\n }\n await this.drainAsync();\n }\n\n /** Materialize everything still pending (warmup / tests / node runtimes). */\n async materializeAll(): Promise<void> {\n for (const moduleId of [...this.pending.keys()]) this.claim(moduleId);\n await this.drainAsync();\n }\n\n private groupTokensToConstruct(group: LazyModuleGroup): Token[] {\n return group.tokens.filter((token) => this.container.getProviderScope(token) !== Scope.REQUEST);\n }\n\n private constructGroupSync(group: LazyModuleGroup): unknown[] {\n const out = new Set<unknown>();\n for (const token of this.groupTokensToConstruct(group)) {\n try {\n out.add(this.container.resolve(token, group.moduleId));\n } catch (error) {\n // Only the sync-resolution-of-async-factory error is a seam problem;\n // genuine provider failures must surface untouched.\n if (error instanceof Error && error.message.includes('returned a Promise')) {\n throw this.describeSyncFailure(group.moduleId, error);\n }\n throw error;\n }\n }\n return [...out];\n }\n\n private async constructGroupAsync(group: LazyModuleGroup): Promise<unknown[]> {\n const out = new Set<unknown>();\n for (const token of this.groupTokensToConstruct(group)) {\n out.add(await this.container.resolveAsync(token, group.moduleId));\n }\n return [...out];\n }\n\n /** Reversed batch = dependency-before-consumer (see drainSync comment). */\n private orderBatch(\n batch: Array<{ group: LazyModuleGroup; instances: unknown[] }>,\n ): Array<{ group: LazyModuleGroup; instances: unknown[] }> {\n return [...batch].reverse();\n }\n\n private finishBatchSync(batch: Array<{ group: LazyModuleGroup; instances: unknown[] }>): void {\n const ordered = this.orderBatch(batch);\n if (this.phase === 'bootstrap') {\n for (const { instances } of ordered) this.absorbed.push(...instances);\n return;\n }\n for (const { group, instances } of ordered) {\n for (const instance of instances) {\n if (hasOnModuleInit(instance) && isThenable(instance.onModuleInit())) {\n throw this.describeSyncFailure(group.moduleId);\n }\n }\n }\n for (const { group, instances } of ordered) {\n for (const instance of instances) {\n if (hasOnApplicationBootstrap(instance) && isThenable(instance.onApplicationBootstrap())) {\n throw this.describeSyncFailure(group.moduleId);\n }\n }\n }\n this.onMaterialized?.(ordered.flatMap((b) => b.instances));\n }\n\n private async finishBatchAsync(\n batch: Array<{ group: LazyModuleGroup; instances: unknown[] }>,\n ): Promise<void> {\n const ordered = this.orderBatch(batch);\n if (this.phase === 'bootstrap') {\n for (const { instances } of ordered) this.absorbed.push(...instances);\n return;\n }\n for (const { instances } of ordered) {\n for (const instance of instances) {\n if (hasOnModuleInit(instance)) await instance.onModuleInit();\n }\n }\n for (const { instances } of ordered) {\n for (const instance of instances) {\n if (hasOnApplicationBootstrap(instance)) await instance.onApplicationBootstrap();\n }\n }\n this.onMaterialized?.(ordered.flatMap((b) => b.instances));\n }\n\n private describeSyncFailure(moduleId: string, cause?: unknown): Error {\n return new Error(\n `[vela] lazy module '${moduleId}' has async providers or lifecycle hooks and was ` +\n `triggered through a synchronous resolution path. Reach it through an async seam ` +\n `first (app.materializeLazyModules(), an async provider) or remove lazy: true.`,\n cause !== undefined ? { cause } : undefined,\n );\n }\n}\n","// Minimal HTML shell that bootstraps Scalar's hosted API-reference UI.\n// Served as a static string so it works on every edge runtime with no\n// Node or bundler deps. Scalar itself is loaded from a CDN at runtime.\nexport function renderScalarUi(jsonUrl: string, title?: string): string {\n const safeUrl = jsonUrl.replace(/\"/g, '&quot;');\n const safeTitle = (title ?? 'API Reference')\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;');\n return `<!doctype html>\n<html>\n <head>\n <title>${safeTitle}</title>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n </head>\n <body>\n <script id=\"api-reference\" data-url=\"${safeUrl}\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/@scalar/api-reference\"></script>\n </body>\n</html>`;\n}\n","// Minimal HTML shell that bootstraps Swagger UI from a CDN. Served as a\n// static string so it works on every edge runtime with no Node or bundler\n// deps — Swagger UI itself is loaded from a CDN at runtime.\nexport function renderSwaggerUi(specUrl: string, title?: string): string {\n const safeUrl = specUrl.replace(/\"/g, '&quot;');\n const safeTitle = (title ?? 'API Reference')\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;');\n return `<!doctype html>\n<html>\n <head>\n <title>${safeTitle}</title>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/swagger-ui-dist/swagger-ui.css\" />\n </head>\n <body>\n <div id=\"swagger-ui\"></div>\n <script src=\"https://cdn.jsdelivr.net/npm/swagger-ui-dist/swagger-ui-bundle.js\"></script>\n <script>\n window.ui = SwaggerUIBundle({ url: \"${safeUrl}\", dom_id: '#swagger-ui' });\n </script>\n </body>\n</html>`;\n}\n","// Minimal HTML shell that bootstraps ReDoc from a CDN. Served as a static\n// string so it works on every edge runtime with no Node or bundler deps —\n// ReDoc itself is loaded from a CDN at runtime.\nexport function renderRedocUi(specUrl: string, title?: string): string {\n const safeUrl = specUrl.replace(/\"/g, '&quot;');\n const safeTitle = (title ?? 'API Reference')\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;');\n return `<!doctype html>\n<html>\n <head>\n <title>${safeTitle}</title>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n </head>\n <body>\n <redoc spec-url=\"${safeUrl}\"></redoc>\n <script src=\"https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js\"></script>\n </body>\n</html>`;\n}\n","import type { Hono } from 'hono';\nimport { HTTPException } from 'hono/http-exception';\nimport type { ContentfulStatusCode } from 'hono/utils/http-status';\nimport { toErrorBody } from '@velajs/errors';\nimport type { Container } from './container/container';\nimport type { Token, Type } from './container/types';\nimport { APP_EXCEPTION_HANDLER } from './pipeline/tokens';\nimport type { ExceptionHandler } from './exceptions/exception-handler';\nimport { resolveErrorReporter } from './exceptions/reporter';\nimport { DiscoveryService } from './discovery/discovery.service';\nimport { EntrypointRegistry } from './entrypoint/entrypoint.registry';\nimport { LazyModuleManager } from './module/lazy-modules';\nimport type { RouteDescription, RouteManager } from './http/route.manager';\nimport {\n hasBeforeApplicationShutdown,\n hasOnApplicationBootstrap,\n hasOnApplicationShutdown,\n hasOnModuleDestroy,\n hasOnModuleInit,\n} from './lifecycle/index';\nimport type { MountOpenApiOptions, OpenApiUi } from './openapi/types';\nimport { renderScalarUi } from './openapi/scalar-ui';\nimport { renderSwaggerUi } from './openapi/swagger-ui';\nimport { renderRedocUi } from './openapi/redoc-ui';\nimport type { FilterType, GuardType, InterceptorType, PipeType } from './registry/types';\n\nexport class VelaApplication {\n private instances: unknown[] = [];\n private honoApp: Hono | null = null;\n private entrypointRegistry: EntrypointRegistry | null = null;\n private disposed = false;\n private readonly lazyManager: LazyModuleManager | undefined;\n // Identity guard for the instance flow: a token registered by BOTH a lazy\n // and an eager module reaches us through the eager pass AND the absorbed\n // batch — without dedup its hooks would run twice.\n private readonly knownInstances = new Set<unknown>();\n\n constructor(\n private readonly container: Container,\n private readonly routeManager: RouteManager,\n ) {\n // bootstrap() registers the manager; a hand-built container may not have\n // one (container unit tests) — lazy semantics simply don't engage then.\n this.lazyManager = container.has(LazyModuleManager)\n ? container.resolve(LazyModuleManager)\n : undefined;\n // Live-phase materializations join the instance flow so close()/dispose()\n // run shutdown hooks over them (LIFO — appended last, destroyed first).\n this.lazyManager?.setOnMaterialized((instances) => {\n this.instances.push(...this.trackNew(instances));\n });\n }\n\n private trackNew(batch: unknown[]): unknown[] {\n const fresh = batch.filter((i) => !this.knownInstances.has(i));\n for (const i of fresh) this.knownInstances.add(i);\n return fresh;\n }\n\n /** Pre-build routes (handles async CRUD imports). Called by VelaFactory. */\n async initRoutes(): Promise<void> {\n this.honoApp = await this.routeManager.build();\n\n // Last line of defense for the HTTP edge. HandlerExecutor's catch tail\n // only sees controller-handler errors; a raw Hono middleware (or any\n // hono-level throw that bypasses route.manager's wrapMiddlewareWithFilters)\n // would otherwise reach Hono's default error handler unreported and\n // unredacted. `onError` funnels it through the same report-first + canonical\n // redacted body path every other edge uses.\n this.honoApp.onError((err, c) => {\n const reporter = resolveErrorReporter(this.container);\n // Hono's own HTTPException (e.g. `bodyLimit`'s 413) carries a deliberate,\n // author-intended client response — honor it exactly as Hono's default\n // error handler would, without treating it as a server fault to redact.\n // But a 5xx HTTPException is still a server fault: every other edge reports\n // before returning, so report status>=500 here too (leaving the verbatim\n // response — and its redaction/status — untouched).\n if (err instanceof HTTPException) {\n if (err.status >= 500) {\n reporter.report(err, { edge: 'hono', source: `${c.req.method} ${c.req.path}` });\n }\n return err.getResponse();\n }\n reporter.report(err, { edge: 'hono', source: `${c.req.method} ${c.req.path}` });\n const { body, status } = toErrorBody(err, { catalog: reporter.catalog });\n return c.json(body, status as ContentfulStatusCode);\n });\n }\n\n private getApp(): Hono {\n if (!this.honoApp) {\n throw new Error(\n 'Routes not built. This should not happen — VelaFactory.create() builds routes automatically.',\n );\n }\n return this.honoApp;\n }\n\n get fetch(): Hono['fetch'] {\n return this.getApp().fetch;\n }\n\n getInstances(): unknown[] {\n return this.instances;\n }\n\n getContainer(): Container {\n return this.container;\n }\n\n setInstances(instances: unknown[]): void {\n this.instances = instances;\n this.knownInstances.clear();\n for (const i of instances) this.knownInstances.add(i);\n }\n\n get<T>(token: Token<T>): T {\n return this.container.resolve(token);\n }\n\n getHonoApp(): Hono {\n return this.getApp();\n }\n\n /**\n * Every explicit controller route as the framework registered it (fully\n * composed paths — the `vela route list` seam). Requires built routes;\n * contributed routes (`@velajs/crud`) mount directly on Hono and are\n * observable via `getHonoApp().routes` instead.\n */\n describeRoutes(): RouteDescription[] {\n this.getApp(); // same routes-not-built guard as every HTTP accessor\n return this.routeManager.getRouteDescriptions();\n }\n\n /** The global route prefix in effect ('' when none). */\n getGlobalPrefix(): string {\n return this.routeManager.getGlobalPrefix();\n }\n\n // Pipeline components — applied at request time, no rebuild needed\n\n useGlobalPipes(...pipes: PipeType[]): this {\n this.routeManager.useGlobalPipes(...pipes);\n return this;\n }\n\n useGlobalGuards(...guards: GuardType[]): this {\n this.routeManager.useGlobalGuards(...guards);\n return this;\n }\n\n useGlobalInterceptors(...interceptors: InterceptorType[]): this {\n this.routeManager.useGlobalInterceptors(...interceptors);\n return this;\n }\n\n useGlobalFilters(...filters: FilterType[]): this {\n this.routeManager.useGlobalFilters(...filters);\n return this;\n }\n\n /**\n * Register the application-wide {@link ExceptionHandler} imperatively — the\n * sibling of `ErrorsModule.forRoot({ handler })`. A class is constructed\n * through DI (`useClass`); a plain handler object is registered verbatim\n * (`useValue`). Consumed by `resolveErrorReporter` at every transport edge,\n * so it takes effect on the next request without a rebuild.\n *\n * ```ts\n * app.useGlobalExceptionHandler({ report: (e) => sentry.capture(e) });\n * ```\n */\n useGlobalExceptionHandler(handler: Type<ExceptionHandler> | ExceptionHandler): this {\n this.container.register(\n typeof handler === 'function'\n ? { provide: APP_EXCEPTION_HANDLER, useClass: handler }\n : { provide: APP_EXCEPTION_HANDLER, useValue: handler },\n );\n return this;\n }\n\n /**\n * Serve a pre-built OpenAPI document and one or more interactive doc UIs\n * (Swagger UI, Scalar, ReDoc) on the underlying Hono app, mirroring the\n * hono-crud docs convention. Edge-safe: each UI is a tiny self-contained\n * HTML shell that loads its renderer from a CDN at runtime so nothing is\n * bundled server-side and no extra dependency is required.\n *\n * Defaults: spec at `/openapi.json`, Scalar at `/scalar`, Swagger UI at\n * `/docs`, ReDoc at `/redoc`. The deprecated `path` / `uiPath` aliases are\n * retained for migration from the previous single-UI shape.\n *\n * ```ts\n * const doc = createOpenApiDocument(AppModule);\n * app.mountOpenApi({ document: doc }); // Scalar @ /scalar\n * app.mountOpenApi({ document: doc, ui: 'all' }); // swagger + scalar + redoc\n * ```\n */\n mountOpenApi(options: MountOpenApiOptions): this {\n const app = this.getApp();\n const doc = options.document;\n const title = options.title;\n\n // Spec JSON: new default `/openapi.json`. The deprecated `path` alias is\n // honored as an override only (does not change the default).\n const specPath = options.specPath ?? options.path ?? '/openapi.json';\n app.get(specPath, (c) => c.json(doc));\n\n // Normalize the requested UI set. Default is Scalar only.\n const uiOption = options.ui;\n let uis: OpenApiUi[];\n let singleStringUi = false;\n if (uiOption === undefined) {\n uis = ['scalar'];\n } else if (uiOption === 'all') {\n uis = ['swagger', 'scalar', 'redoc'];\n } else if (Array.isArray(uiOption)) {\n uis = uiOption;\n } else {\n uis = [uiOption];\n singleStringUi = true;\n }\n\n for (const ui of uis) {\n // Back-compat: the old `{ ui: 'scalar', uiPath }` form mapped a single\n // string UI to `uiPath`. Honor that only when exactly one UI was\n // requested as a string.\n const legacyPath = singleStringUi && uis.length === 1 ? options.uiPath : undefined;\n\n if (ui === 'swagger') {\n const path = legacyPath ?? options.swaggerPath ?? '/docs';\n const html = renderSwaggerUi(specPath, title);\n app.get(path, (c) => c.html(html));\n } else if (ui === 'redoc') {\n const path = legacyPath ?? options.redocPath ?? '/redoc';\n const html = renderRedocUi(specPath, title);\n app.get(path, (c) => c.html(html));\n } else {\n const path = legacyPath ?? options.scalarPath ?? '/scalar';\n const html = renderScalarUi(specPath, title);\n app.get(path, (c) => c.html(html));\n }\n }\n\n return this;\n }\n\n // Lifecycle hooks\n\n /**\n * Pull instances materialized during the bootstrap phase (lazy modules\n * dragged in by eager consumers) into the front of the instance list —\n * dependency-before-consumer: a group absorbed because an eager provider\n * injected it must be initialized before that consumer's hooks read it.\n */\n private absorbLazyInstances(prepend: boolean): unknown[] {\n const batch = this.trackNew(this.lazyManager?.takeAbsorbed() ?? []);\n if (batch.length === 0) return batch;\n if (prepend) {\n this.instances = [...batch, ...this.instances];\n } else {\n this.instances.push(...batch);\n }\n return batch;\n }\n\n async callOnModuleInit(): Promise<void> {\n this.absorbLazyInstances(true);\n // Index loop: hooks can trigger further absorptions, which append —\n // the loop naturally covers them.\n for (let i = 0; i < this.instances.length; i++) {\n const instance = this.instances[i];\n if (hasOnModuleInit(instance)) {\n await instance.onModuleInit();\n }\n this.absorbLazyInstances(false);\n }\n }\n\n async callOnApplicationBootstrap(): Promise<void> {\n for (let i = 0; i < this.instances.length; i++) {\n const instance = this.instances[i];\n if (hasOnApplicationBootstrap(instance)) {\n await instance.onApplicationBootstrap();\n }\n // Instances absorbed mid-phase already missed the init pass — run\n // onModuleInit now; the loop then reaches them for the bootstrap hook.\n for (const late of this.absorbLazyInstances(false)) {\n if (hasOnModuleInit(late)) await late.onModuleInit();\n }\n }\n\n // Computed-entrypoint contributors (ContributesEntrypoints) in lazy\n // modules must exist before the snapshot below — materialize them now\n // (the documented cost of contributing computed entrypoints), then run\n // their hooks through the same absorb loop.\n if (this.lazyManager) {\n await this.lazyManager.materializeContributors();\n let batch: unknown[];\n while ((batch = this.absorbLazyInstances(false)).length > 0) {\n for (const late of batch) {\n if (hasOnModuleInit(late)) await late.onModuleInit();\n }\n for (const late of batch) {\n if (hasOnApplicationBootstrap(late)) await late.onApplicationBootstrap();\n }\n }\n // From here on, materializations replay their hooks at the trigger.\n this.lazyManager.setPhaseLive();\n }\n\n // Build the per-app entrypoint registry AFTER the hooks: dispatchers that\n // implement ContributesEntrypoints (WsDispatcher) finish their own\n // discovery inside onApplicationBootstrap. Built here — not in\n // VelaFactory/initRoutes — so slim bootstrap paths that never build HTTP\n // routes (the Cloudflare Durable Object) still get `app.entrypoints`.\n // Lazy-pending providers of declared kinds yield metadata-only entries\n // (instance: undefined) — dispatchers re-resolve by token per event,\n // which materializes the owning module at dispatch time.\n const discovery = this.container.has(DiscoveryService)\n ? this.container.resolve(DiscoveryService)\n : new DiscoveryService(this.container);\n this.entrypointRegistry = await EntrypointRegistry.build(discovery, this.instances, {\n deferLazy: true,\n });\n\n // Make the per-app registry injectable (global token): providers that\n // dispatch entrypoints themselves (the queue module's in-process driver\n // binding) resolve it instead of needing a back-reference to the app.\n // Registered AFTER build so anything resolving it sees the final registry;\n // pre-bootstrap resolution attempts fail the `has()` probe and defer.\n this.container.register({ provide: EntrypointRegistry, useValue: this.entrypointRegistry });\n this.container.markGlobalToken(EntrypointRegistry);\n }\n\n /**\n * Materialize every still-pending lazy module (async-safe): construct the\n * groups, replay their lifecycle hooks, and add their instances to the\n * shutdown flow. Warmup escape hatch for tests and node runtimes that want\n * eager-everything semantics back after bootstrap.\n */\n async materializeLazyModules(): Promise<void> {\n await this.lazyManager?.materializeAll();\n }\n\n /**\n * Every entrypoint contributed by the module graph, grouped by kind —\n * what runtime adapters/transports query instead of re-scanning providers:\n * `app.entrypoints.ofKind('websocket')`.\n */\n get entrypoints(): EntrypointRegistry {\n if (!this.entrypointRegistry) {\n throw new Error(\n 'Entrypoints are not built yet — they are assembled at the end of ' +\n 'callOnApplicationBootstrap(). Finish bootstrapping before querying them.',\n );\n }\n return this.entrypointRegistry;\n }\n\n async close(signal?: string): Promise<void> {\n const reversed = [...this.instances].reverse();\n\n for (const instance of reversed) {\n if (hasBeforeApplicationShutdown(instance)) {\n await instance.beforeApplicationShutdown(signal);\n }\n }\n\n for (const instance of reversed) {\n if (hasOnModuleDestroy(instance)) {\n await instance.onModuleDestroy();\n }\n }\n\n for (const instance of reversed) {\n if (hasOnApplicationShutdown(instance)) {\n await instance.onApplicationShutdown(signal);\n }\n }\n }\n\n /**\n * Full teardown: run shutdown lifecycle hooks ({@link close}) then dispose\n * container-held instances (LIFO) and clear cached singletons. Use for\n * graceful shutdown and dev HMR so old and new DI graphs never coexist.\n *\n * On runtimes/TS supporting explicit resource management this is also exposed\n * as `Symbol.asyncDispose`, enabling `await using app = await VelaFactory.create(...)`.\n */\n async dispose(signal?: string): Promise<void> {\n // Idempotent: `await using` + an explicit dispose(), or repeated shutdown\n // signals, must not re-run shutdown lifecycle hooks.\n if (this.disposed) return;\n this.disposed = true;\n await this.close(signal);\n await this.container.dispose();\n }\n}\n\n// Attach the well-known async-dispose symbol at runtime (it is not in the\n// ES2022 lib the project compiles against) so `await using` works where\n// supported, without a type dependency on esnext.disposable.\nconst ASYNC_DISPOSE: symbol | undefined = (Symbol as { asyncDispose?: symbol }).asyncDispose;\nif (ASYNC_DISPOSE) {\n (VelaApplication.prototype as unknown as Record<PropertyKey, unknown>)[ASYNC_DISPOSE] = function (\n this: VelaApplication,\n ): Promise<void> {\n return this.dispose();\n };\n}\n","import { Scope } from '../constants';\nimport { Injectable } from './decorators';\nimport type { Token, Type } from './types';\nimport type { Container } from './container';\n\n@Injectable()\nexport class ModuleRef {\n constructor(private readonly container: Container) {}\n\n /**\n * Retrieve a provider instance from the DI container.\n * Returns the existing singleton (or cached value) for the token.\n */\n get<T>(token: Token<T>): T {\n return this.container.resolve(token);\n }\n\n /**\n * Resolve a provider, creating a new instance for TRANSIENT-scoped providers.\n * For SINGLETON-scoped providers this is equivalent to get().\n */\n resolve<T>(token: Token<T>): T {\n return this.container.resolve(token);\n }\n\n /**\n * Instantiate a class outside of the DI container's singleton cache.\n * Dependencies are resolved from the container. Each call returns a new instance.\n */\n create<T>(type: Type<T>): T {\n const sandbox = this.container.createDetached();\n sandbox.register({ provide: type, useClass: type, scope: Scope.TRANSIENT });\n return sandbox.resolve(type);\n }\n}\n","import { InjectionToken } from '../container/types';\n\nexport const CONFIG_OPTIONS = new InjectionToken<Record<string, unknown>>('CONFIG_OPTIONS');\n\n/**\n * Ambient environment record consumed by config-namespace factories\n * (`registerAs`). It is the multi-runtime substitute for stratal's\n * Cloudflare-specific `env` token: core never touches `process.env`.\n *\n * The token self-provides `{}` by default (so factories resolve even with no\n * platform binding), and stays OVERRIDABLE — a platform adapter\n * (`@velajs/cloudflare`) or a future `./config-node` subpath provides a global\n * `CONFIG_ENV` and that registration wins over the default.\n */\nexport const CONFIG_ENV = new InjectionToken<Record<string, unknown>>('CONFIG_ENV', {\n factory: () => ({}),\n});\n","import { InjectionToken } from '../../container/types';\n\n/**\n * Optional DI token holding the HMAC secret used to sign / verify URLs. Provide\n * it globally (e.g. from a platform adapter or a `@Global` module) so both\n * {@link UrlGeneratorService} and the signed-URL guard can read it:\n *\n * ```ts\n * { provide: URL_SIGNING_SECRET, useValue: env.URL_SIGNING_SECRET }\n * ```\n */\nexport const URL_SIGNING_SECRET = new InjectionToken<string>('URL_SIGNING_SECRET');\n\n/** Key read from `CONFIG_ENV` when no explicit secret / token is available. */\nexport const URL_SIGNING_SECRET_ENV_KEY = 'URL_SIGNING_SECRET';\n\n/**\n * Resolve the signing secret from, in order: an explicit argument, the\n * {@link URL_SIGNING_SECRET} token, then `CONFIG_ENV[URL_SIGNING_SECRET]`.\n * Throws a descriptive error when none is available — signing must never fall\n * back to an empty/implicit key.\n */\nexport function resolveSigningSecret(\n explicit: string | undefined,\n token: string | undefined,\n env: Record<string, unknown> | undefined,\n): string {\n const fromEnv = env?.[URL_SIGNING_SECRET_ENV_KEY];\n const secret = explicit ?? token ?? (typeof fromEnv === 'string' ? fromEnv : undefined);\n if (!secret) {\n throw new Error(\n 'No URL signing secret is available. Pass one explicitly, register a ' +\n '`URL_SIGNING_SECRET` provider, or set `URL_SIGNING_SECRET` in `CONFIG_ENV`.',\n );\n }\n return secret;\n}\n","import { Injectable, Inject, Optional } from '../../container/decorators';\nimport { CONFIG_ENV } from '../../config/config.tokens';\nimport { signUrl } from '../../crypto/signed-url';\nimport { RouteManager } from '../route.manager';\nimport type { RouteDescription } from '../route.manager';\nimport type { RouteName, RouteParams } from '../route-map';\nimport { URL_SIGNING_SECRET, resolveSigningSecret } from './signing-secret';\n\n/** Value accepted for a path param or query entry. */\ntype UrlParamValue = string | number | boolean;\n\n/** Extra options for {@link UrlGeneratorService.urlFor}. */\nexport interface UrlForOptions {\n /** Additional query-string entries merged after any leftover params. */\n query?: Record<string, UrlParamValue>;\n}\n\n/** Options for {@link UrlGeneratorService.signedUrl}. */\nexport interface SignedUrlGenerateOptions {\n /** Time-to-live in seconds; enforced on verification via the `expires` param. */\n expiresIn?: number;\n /** Override the signing secret (else the `URL_SIGNING_SECRET` token / `CONFIG_ENV`). */\n secret?: string;\n}\n\n/**\n * Builds URLs for named routes (Laravel-flavoured `route()` ergonomics).\n *\n * Route descriptions are read LAZILY from the {@link RouteManager} on first use\n * — post-build, so composition (global prefix + version + controller prefix) is\n * already baked into each path — and it never instantiates controllers, so it\n * plays nicely with lazy modules. Registered as an app-level singleton by\n * `bootstrap`, so it is injectable anywhere.\n */\n@Injectable()\nexport class UrlGeneratorService {\n private routeMap: Map<string, RouteDescription> | null = null;\n\n constructor(\n @Inject(RouteManager) private readonly routeManager: RouteManager,\n @Optional() @Inject(URL_SIGNING_SECRET) private readonly secretToken?: string,\n @Optional() @Inject(CONFIG_ENV) private readonly env: Record<string, unknown> = {},\n ) {}\n\n /**\n * Build the path for a named route, filling `:param` placeholders from\n * `params`. Params that don't match a placeholder become query-string\n * entries; `opts.query` is merged after them.\n *\n * @throws if no route carries `name`, or a required `:param` is missing.\n */\n urlFor<N extends RouteName>(name: N, params?: RouteParams<N>, opts?: UrlForOptions): string {\n const description = this.routes().get(name as string);\n if (!description) {\n throw new Error(\n `No route named \"${String(name)}\" was found. Give the route a name ` +\n `via \\`@Get(path, { name: '${String(name)}' })\\`.`,\n );\n }\n\n const provided = { ...(params ?? {}) } as Record<string, UrlParamValue | null | undefined>;\n const consumed = new Set<string>();\n\n const path = description.path.replace(/:([A-Za-z0-9_]+)/g, (_match, key: string) => {\n const value = provided[key];\n if (value === undefined || value === null) {\n throw new Error(`Missing route param \"${key}\" for route \"${String(name)}\".`);\n }\n consumed.add(key);\n return encodeURIComponent(String(value));\n });\n\n const query = new URLSearchParams();\n for (const [key, value] of Object.entries(provided)) {\n if (consumed.has(key) || value === undefined || value === null) continue;\n query.set(key, String(value));\n }\n for (const [key, value] of Object.entries(opts?.query ?? {})) {\n if (value === undefined || value === null) continue;\n query.set(key, String(value));\n }\n\n const qs = query.toString();\n return qs ? `${path}?${qs}` : path;\n }\n\n /**\n * Build a named-route URL and HMAC-sign it (path + query). The secret comes\n * from `options.secret`, else the {@link URL_SIGNING_SECRET} token, else\n * `CONFIG_ENV`; a descriptive error is thrown when none is available.\n */\n async signedUrl<N extends RouteName>(\n name: N,\n params?: RouteParams<N>,\n options: SignedUrlGenerateOptions = {},\n ): Promise<string> {\n const url = this.urlFor(name, params);\n const secret = resolveSigningSecret(options.secret, this.secretToken, this.env);\n return signUrl(\n url,\n secret,\n options.expiresIn !== undefined ? { expiresIn: options.expiresIn } : undefined,\n );\n }\n\n /**\n * Lazily index named route descriptions. Rebuilt while empty (routes may not\n * be built yet), cached once populated.\n */\n private routes(): Map<string, RouteDescription> {\n if (this.routeMap && this.routeMap.size > 0) return this.routeMap;\n const map = new Map<string, RouteDescription>();\n for (const description of this.routeManager.getRouteDescriptions()) {\n if (description.name && !map.has(description.name)) {\n map.set(description.name, description);\n }\n }\n this.routeMap = map;\n return map;\n }\n}\n","import { Injectable, Inject, Optional } from '../../container/decorators';\nimport { CONFIG_ENV } from '../../config/config.tokens';\nimport { verifySignedUrl } from '../../crypto/signed-url';\nimport { ForbiddenException } from '../../errors/http-exception';\nimport { applyDecorators } from '../decorators';\nimport { UseGuards } from '../../pipeline/decorators';\nimport type { CanActivate, ExecutionContext } from '../../pipeline/types';\nimport { URL_SIGNING_SECRET, resolveSigningSecret } from './signing-secret';\n\n/**\n * Verifies the HMAC signature (and `expires`) of the incoming request URL,\n * using the same secret source as {@link UrlGeneratorService.signedUrl}: the\n * {@link URL_SIGNING_SECRET} token, else `CONFIG_ENV`. Throws\n * `ForbiddenException` (403) when the signature is missing, tampered, or\n * expired. Registered app-wide by `bootstrap`; apply it per-route with\n * {@link SignedUrl}.\n */\n@Injectable()\nexport class SignedUrlGuard implements CanActivate {\n constructor(\n @Optional() @Inject(URL_SIGNING_SECRET) private readonly secretToken?: string,\n @Optional() @Inject(CONFIG_ENV) private readonly env: Record<string, unknown> = {},\n ) {}\n\n async canActivate(context: ExecutionContext): Promise<boolean> {\n const request = context.switchToHttp().getRequest<Request>();\n const secret = resolveSigningSecret(undefined, this.secretToken, this.env);\n const valid = await verifySignedUrl(request.url, secret);\n if (!valid) {\n throw new ForbiddenException('Invalid or expired signed URL');\n }\n return true;\n }\n}\n\n/**\n * Guards a route with {@link SignedUrlGuard} — the request must carry a valid,\n * unexpired HMAC signature (produced by `UrlGeneratorService.signedUrl`).\n *\n * ```ts\n * @Get('download', { name: 'file.download' })\n * @SignedUrl()\n * download() { ... }\n * ```\n */\nexport function SignedUrl(): ReturnType<typeof applyDecorators> {\n return applyDecorators(UseGuards(SignedUrlGuard));\n}\n","import { HttpMethod } from '../constants';\nimport type { NestMiddleware } from '../pipeline/types';\nimport { MetadataRegistry } from '../registry/metadata.registry';\nimport type { Constructor, Type } from '../registry/types';\n\nexport interface RouteInfo {\n path: string;\n method?: HttpMethod;\n}\n\nexport interface MiddlewareRouteDefinition {\n middleware: Array<Type<NestMiddleware> | NestMiddleware>;\n routes: RouteInfo[];\n excludes: RouteInfo[];\n /** Stable-sort key; lower runs first. Default 0. */\n priority?: number;\n}\n\nexport interface MiddlewareConfigProxy {\n exclude(...routes: Array<string | RouteInfo>): MiddlewareConfigProxy;\n withPriority(priority: number): MiddlewareConfigProxy;\n forRoutes(...routes: Array<string | Constructor | RouteInfo>): MiddlewareConsumer;\n}\n\nexport interface MiddlewareConsumer {\n apply(...middleware: Array<Type<NestMiddleware> | NestMiddleware>): MiddlewareConfigProxy;\n}\n\nexport interface NestModule {\n configure(consumer: MiddlewareConsumer): void;\n}\n\nexport class MiddlewareBuilder implements MiddlewareConsumer {\n private definitions: MiddlewareRouteDefinition[] = [];\n\n apply(...middleware: Array<Type<NestMiddleware> | NestMiddleware>): MiddlewareConfigProxy {\n const currentMiddleware = [...middleware];\n let currentExcludes: RouteInfo[] = [];\n let currentPriority: number | undefined;\n\n const proxy: MiddlewareConfigProxy = {\n exclude: (...routes: Array<string | RouteInfo>) => {\n currentExcludes = routes.map(normalizeRouteArg);\n return proxy;\n },\n withPriority: (priority: number) => {\n currentPriority = priority;\n return proxy;\n },\n forRoutes: (...routes: Array<string | Constructor | RouteInfo>) => {\n this.definitions.push({\n middleware: currentMiddleware,\n routes: routes.flatMap(resolveRouteArg),\n excludes: [...currentExcludes],\n ...(currentPriority !== undefined ? { priority: currentPriority } : {}),\n });\n currentExcludes = [];\n currentPriority = undefined;\n return this;\n },\n };\n\n return proxy;\n }\n\n getDefinitions(): MiddlewareRouteDefinition[] {\n return [...this.definitions];\n }\n}\n\nfunction normalizeRouteArg(route: string | RouteInfo): RouteInfo {\n return typeof route === 'string' ? { path: route } : route;\n}\n\nfunction resolveRouteArg(route: string | Constructor | RouteInfo): RouteInfo[] {\n if (typeof route === 'string') {\n return [{ path: route }];\n }\n if (typeof route === 'function') {\n const prefix = MetadataRegistry.getControllerPath(route as Constructor);\n return [{ path: prefix || '/' }];\n }\n return [route];\n}\n","import { Scope } from '../constants';\nimport type { Container } from '../container/container';\nimport {\n ForwardRef,\n InjectionToken,\n ModuleVisibilityError,\n MultipleProvidersFoundError,\n} from '../container/types';\nimport type { ProviderOptions, Token, Type } from '../container/types';\nimport type { RouteManager } from '../http/route.manager';\nimport {\n APP_FILTER,\n APP_GUARD,\n APP_INTERCEPTOR,\n APP_MIDDLEWARE,\n APP_PIPE,\n} from '../pipeline/tokens';\nimport { MetadataRegistry } from '../registry/metadata.registry';\nimport { getOrCreateArray } from '../registry/util';\nimport type { DynamicModule, ModuleImport } from '../registry/types';\nimport { getModuleMetadata, isModule } from './decorators';\nimport { LazyModuleManager } from './lazy-modules';\nimport { MiddlewareBuilder } from './middleware';\nimport type { MiddlewareRouteDefinition, NestModule } from './middleware';\n\nconst APP_TOKENS = new Set<Token>([\n APP_GUARD,\n APP_PIPE,\n APP_INTERCEPTOR,\n APP_FILTER,\n APP_MIDDLEWARE,\n]);\n\nconst DEFAULT_KEY = 'default';\n\n/** What the loader records per lazy module instance (see LazyModuleManager). */\nexport interface LazyModuleGroupSpec {\n moduleId: string;\n tokens: Token[];\n hasEntrypointContributor: boolean;\n}\n\n/**\n * Structural check for `ContributesEntrypoints` on a provider's class —\n * deliberately string-coupled to the interface's method name so the loader\n * does not import from `entrypoint/` (layering).\n */\nfunction declaresEntrypointContributor(provider: Type | ProviderOptions): boolean {\n const cls = typeof provider === 'function' ? provider : provider.useClass;\n if (typeof cls !== 'function') return false;\n const proto = (cls as Type).prototype as Record<string, unknown> | undefined;\n return typeof proto?.collectEntrypoints === 'function';\n}\n\nfunction isDynamicModule(value: unknown): value is DynamicModule {\n // TS 4.9+ narrows `'module' in value` so `value.module` is typed `unknown`\n // — no cast required for the typeof check below.\n return (\n typeof value === 'object' &&\n value !== null &&\n 'module' in value &&\n typeof value.module === 'function'\n );\n}\n\nfunction implementsNestModule(cls: Type): cls is Type<NestModule> {\n // `Type.prototype` is `any` — direct property access is type-safe enough.\n return typeof cls.prototype?.configure === 'function';\n}\n\nfunction tokenOfProvider(provider: Type | ProviderOptions): Token | undefined {\n return typeof provider === 'function' ? provider : provider.provide;\n}\n\nfunction keyOfImport(entry: Type | DynamicModule): string {\n return isDynamicModule(entry) ? (entry.key ?? DEFAULT_KEY) : DEFAULT_KEY;\n}\n\n/**\n * `ForwardRef.factory` is typed to return the broader `Token<T>` because the\n * primitive is shared with provider injection. In module-imports position the\n * runtime contract narrows: the factory must yield a module class or a\n * `DynamicModule`. This helper validates the contract AND narrows the type\n * without a structural cast.\n */\nfunction unwrapModuleForwardRef(ref: ForwardRef): Type | DynamicModule {\n const result = ref.factory();\n if (typeof result === 'function') return result;\n if (isDynamicModule(result)) return result;\n throw new Error(\n `forwardRef in module imports must resolve to a module class or DynamicModule; ` +\n `got ${typeof result === 'object' ? 'a non-module object' : typeof result}.`,\n );\n}\n\nexport class ModuleLoader {\n // class → set of keys already processed (multi-instance dedup is by both)\n private processedModules = new Map<Type, Set<string>>();\n private processingStack = new Set<string>();\n private collectedControllers = new Set<Type>();\n private registeredProviders: Token[] = [];\n // (class, key) → exported tokens\n private moduleExportsCache = new Map<Type, Map<string, Set<Token>>>();\n private globalExports = new Set<Token>();\n private consumerMiddlewareDefinitions: MiddlewareRouteDefinition[] = [];\n private appProviderCounter = 0;\n private appProviderTokens = new Map<Token, Token[]>([\n [APP_GUARD, []],\n [APP_PIPE, []],\n [APP_INTERCEPTOR, []],\n [APP_FILTER, []],\n [APP_MIDDLEWARE, []],\n ]);\n // (class, key) → composed moduleId (cached for stable identity within a load)\n private moduleIdByClassKey = new Map<Type, Map<string, string>>();\n private seenModuleIds = new Set<string>();\n // Lazy (deferred-init) module instances: moduleId → its own tokens in\n // registration order. Consumed by LazyModuleManager via getLazyGroups().\n private lazyModuleIds = new Set<string>();\n private lazyGroups = new Map<string, LazyModuleGroupSpec>();\n\n constructor(\n private container: Container,\n private router: RouteManager,\n ) {}\n\n load(rootModule: Type): void {\n this.processModule(rootModule);\n\n for (const controller of this.collectedControllers) {\n this.router.registerController(controller);\n }\n\n // Arm the deferred-init seam HERE — at the end of load(), not in\n // bootstrap() — so every consumer of the loader gets identical lazy\n // semantics, including hand-rolled bootstrap paths that never call\n // bootstrap() (@velajs/testing's TestingModuleBuilder.compile builds its\n // own container). Still after all module-load-time resolutions\n // (NestModule.configure), so load-time resolution never claims a group.\n // Registered as a provider so VelaApplication can drive the phase\n // transitions from any of those paths.\n const lazyManager = new LazyModuleManager(this.container);\n for (const group of this.getLazyGroups()) {\n lazyManager.registerGroup(group);\n }\n this.container.setLazyHook(lazyManager);\n this.container.register({ provide: LazyModuleManager, useValue: lazyManager });\n }\n\n private getModuleId(moduleClass: Type, key: string): string {\n let perClass = this.moduleIdByClassKey.get(moduleClass);\n if (perClass) {\n const cached = perClass.get(key);\n if (cached) return cached;\n } else {\n perClass = new Map();\n this.moduleIdByClassKey.set(moduleClass, perClass);\n }\n\n const baseName = moduleClass.name || 'AnonModule';\n let id = `${baseName}#${key}`;\n let counter = 0;\n // Cross-class name collision (rare): two different classes named identically.\n // The (class, key) pair identifies us; bump suffix to keep `id` strings unique\n // in `seenModuleIds` so debug output stays unambiguous.\n while (this.seenModuleIds.has(id)) {\n id = `${baseName}#${key}~${++counter}`;\n }\n this.seenModuleIds.add(id);\n perClass.set(key, id);\n return id;\n }\n\n private isProcessed(moduleClass: Type, key: string): boolean {\n return this.processedModules.get(moduleClass)?.has(key) ?? false;\n }\n\n private markProcessed(moduleClass: Type, key: string): void {\n let keys = this.processedModules.get(moduleClass);\n if (!keys) {\n keys = new Set();\n this.processedModules.set(moduleClass, keys);\n }\n keys.add(key);\n }\n\n private getCachedExports(moduleClass: Type, key: string): Set<Token> | undefined {\n return this.moduleExportsCache.get(moduleClass)?.get(key);\n }\n\n private cacheExports(moduleClass: Type, key: string, exports: Set<Token>): void {\n let perClass = this.moduleExportsCache.get(moduleClass);\n if (!perClass) {\n perClass = new Map();\n this.moduleExportsCache.set(moduleClass, perClass);\n }\n perClass.set(key, exports);\n }\n\n private processModule(moduleClassOrDynamic: Type | DynamicModule): Set<Token> {\n let moduleClass: Type;\n let extraImports: ModuleImport[] = [];\n let extraControllers: Type[] = [];\n let extraProviders: Array<Type | ProviderOptions> = [];\n let extraExports: Array<Type | InjectionToken> = [];\n let key: string = DEFAULT_KEY;\n\n if (isDynamicModule(moduleClassOrDynamic)) {\n moduleClass = moduleClassOrDynamic.module;\n extraImports = moduleClassOrDynamic.imports ?? [];\n extraControllers = moduleClassOrDynamic.controllers ?? [];\n extraProviders = moduleClassOrDynamic.providers ?? [];\n extraExports = moduleClassOrDynamic.exports ?? [];\n key = moduleClassOrDynamic.key ?? DEFAULT_KEY;\n } else {\n moduleClass = moduleClassOrDynamic;\n }\n\n if (this.isProcessed(moduleClass, key)) {\n // Even if already processed, still collect extra controllers from dynamic module\n for (const controller of extraControllers) {\n this.collectedControllers.add(controller);\n }\n return this.getCachedExports(moduleClass, key) ?? new Set();\n }\n\n const stackKey = `${moduleClass.name}#${key}`;\n if (this.processingStack.has(stackKey)) {\n const chain = [...this.processingStack, stackKey].join(' -> ');\n throw new Error(`Circular module dependency detected: ${chain}`);\n }\n\n if (!isModule(moduleClass)) {\n if (isDynamicModule(moduleClassOrDynamic)) {\n MetadataRegistry.setModuleOptions(moduleClass, {});\n } else {\n throw new Error(\n `${moduleClass.name} is not a module. Add @Module() decorator to the class.`,\n );\n }\n }\n\n const metadata = getModuleMetadata(moduleClass);\n if (!metadata) {\n throw new Error(`Failed to get module metadata for ${moduleClass.name}`);\n }\n\n this.processingStack.add(stackKey);\n\n const moduleId = this.getModuleId(moduleClass, key);\n\n try {\n const importedProviders = new Set<Token>(this.globalExports);\n\n // Determine importedModuleIds eagerly (before recursing) so child\n // modules can be referenced in our scope's importedModules set.\n const importedModuleIds = new Set<string>();\n\n // Track per-class keys seen in this imports array — emit a loader-time\n // diagnostic when the same module class appears under both `\"default\"`\n // and at least one explicit key (almost always user error).\n const keysByClassInImports = new Map<Type, Set<string>>();\n\n const allImports = [...metadata.imports, ...extraImports];\n\n for (const entry of allImports) {\n const importedModule = entry instanceof ForwardRef ? unwrapModuleForwardRef(entry) : entry;\n\n const importedModuleClass = isDynamicModule(importedModule)\n ? importedModule.module\n : importedModule;\n const importedKey = keyOfImport(importedModule);\n\n let keys = keysByClassInImports.get(importedModuleClass);\n if (!keys) {\n keys = new Set();\n keysByClassInImports.set(importedModuleClass, keys);\n }\n keys.add(importedKey);\n\n const importedId = this.getModuleId(importedModuleClass, importedKey);\n importedModuleIds.add(importedId);\n\n const importedStackKey = `${importedModuleClass.name}#${importedKey}`;\n if (entry instanceof ForwardRef && this.processingStack.has(importedStackKey)) {\n continue;\n }\n\n const exportedTokens = this.processModule(importedModule);\n for (const token of exportedTokens) {\n importedProviders.add(token);\n }\n }\n\n this.warnOnMixedDefaultAndKeyed(moduleClass.name, keysByClassInImports);\n\n const allProviders = [...metadata.providers, ...extraProviders];\n const allControllers = [...metadata.controllers, ...extraControllers];\n const allExports = [...metadata.exports, ...extraExports];\n\n // Build the ModuleScope BEFORE registering providers so the visibility\n // check sees the local-provider set as we register.\n const localProviders = new Set<Token>();\n for (const provider of allProviders) {\n const tk = tokenOfProvider(provider);\n if (tk !== undefined) localProviders.add(tk);\n }\n for (const controller of allControllers) {\n localProviders.add(controller);\n }\n // The module class itself can be DI-resolved (NestModule.configure path);\n // include it in its own scope.\n localProviders.add(moduleClass);\n\n const isGlobal =\n metadata.isGlobal ||\n (isDynamicModule(moduleClassOrDynamic) && moduleClassOrDynamic.global === true);\n\n const isLazy =\n metadata.lazy ||\n (isDynamicModule(moduleClassOrDynamic) && moduleClassOrDynamic.lazy === true);\n\n this.container.registerScope({\n moduleId,\n localProviders,\n importedModules: importedModuleIds,\n exportedTokens: new Set<Token>(allExports),\n isGlobal,\n lazy: isLazy,\n });\n\n const lazyTokens: Token[] = [];\n let hasEntrypointContributor = false;\n\n for (const provider of allProviders) {\n const registered = this.registerProvider(provider, moduleId);\n if (isLazy && registered !== undefined) {\n lazyTokens.push(registered);\n hasEntrypointContributor ||= declaresEntrypointContributor(provider);\n }\n }\n\n for (const controller of allControllers) {\n // Register the controller in its owning module's bucket so its\n // dependencies resolve from the module's POV (vs `__root__`'s).\n this.container.register(controller, moduleId);\n this.collectedControllers.add(controller);\n if (isLazy) lazyTokens.push(controller);\n }\n\n if (isLazy) {\n this.lazyModuleIds.add(moduleId);\n this.lazyGroups.set(moduleId, {\n moduleId,\n tokens: lazyTokens,\n hasEntrypointContributor,\n });\n }\n\n // Propagate module-level Use* decorators (@UseGuards, @UseInterceptors, etc.) to each controller\n for (const controller of allControllers) {\n MetadataRegistry.propagateControllerComponents(moduleClass, controller);\n }\n\n this.markProcessed(moduleClass, key);\n\n const exports = this.buildExportSet(allExports, allProviders, importedProviders);\n this.cacheExports(moduleClass, key, exports);\n\n if (isGlobal) {\n for (const token of exports) {\n this.globalExports.add(token);\n }\n }\n\n // Call configure() if the module implements NestModule. The module is\n // resolved through the container so it can have its own DI dependencies.\n if (implementsNestModule(moduleClass)) {\n if (!this.container.hasInScope(moduleClass, moduleId)) {\n this.container.register(moduleClass, moduleId);\n }\n const instance = this.container.resolve(moduleClass, moduleId);\n const builder = new MiddlewareBuilder();\n instance.configure(builder);\n this.consumerMiddlewareDefinitions.push(...builder.getDefinitions());\n }\n\n return exports;\n } finally {\n this.processingStack.delete(stackKey);\n }\n }\n\n private warnOnMixedDefaultAndKeyed(\n parentName: string,\n keysByClass: Map<Type, Set<string>>,\n ): void {\n const mode = this.container.getDiagnostics();\n if (mode === 'silent') return;\n for (const [cls, keys] of keysByClass) {\n if (keys.size < 2) continue;\n if (!keys.has(DEFAULT_KEY)) continue;\n const message =\n `[vela] ${cls.name} imported in both bare and keyed form in '${parentName}'. ` +\n `These resolve to distinct module instances; consumers asking for an exported ` +\n `token will hit MultipleProvidersFoundError. Use one form consistently.`;\n if (mode === 'throw') throw new Error(message);\n console.warn(message);\n }\n }\n\n /** Registers the provider and returns the token it was registered under. */\n private registerProvider(provider: Type | ProviderOptions, moduleId: string): Token | undefined {\n if (typeof provider === 'function') {\n // Per-module bucket: the same class can be registered in multiple\n // modules' buckets simultaneously without collision.\n this.container.register(provider, moduleId);\n this.registeredProviders.push(provider);\n return provider;\n }\n\n const token = provider.provide;\n if (!token) {\n this.container.register(provider, moduleId);\n return undefined;\n }\n\n if (this.isAppToken(token)) {\n // Multiple APP_* providers within the same module bucket need\n // distinct tokens so they don't overwrite each other in the bucket\n // Map. Across buckets, `container.resolveAll(APP_GUARD)` walks\n // every bucket — no need to mark synthetic tokens global.\n const syntheticToken = new InjectionToken(`${token.toString()}:${this.appProviderCounter++}`);\n this.container.register({ ...provider, provide: syntheticToken }, moduleId);\n this.registeredProviders.push(syntheticToken);\n getOrCreateArray(this.appProviderTokens, token).push(syntheticToken);\n return syntheticToken;\n }\n\n this.container.register(provider, moduleId);\n this.registeredProviders.push(token);\n return token;\n }\n\n private isAppToken(token: Token): boolean {\n return APP_TOKENS.has(token);\n }\n\n private buildExportSet(\n exports: Array<Type | InjectionToken>,\n providers: Array<Type | ProviderOptions>,\n importedProviders: Set<Token>,\n ): Set<Token> {\n const exportSet = new Set<Token>();\n const providerTokens = new Set<Token>();\n for (const p of providers) {\n const token = tokenOfProvider(p);\n if (token !== undefined) providerTokens.add(token);\n }\n\n for (const exported of exports) {\n const isLocalProvider = providerTokens.has(exported);\n const isImportedProvider = importedProviders.has(exported);\n\n if (!isLocalProvider && !isImportedProvider) {\n const name = typeof exported === 'function' ? exported.name : String(exported);\n console.warn(\n `Warning: Exporting '${name}' which is neither a local provider nor imported from another module.`,\n );\n }\n\n exportSet.add(exported);\n }\n\n return exportSet;\n }\n\n getControllers(): Type[] {\n return [...this.collectedControllers];\n }\n\n getRegisteredProviders(): Token[] {\n return [...this.registeredProviders];\n }\n\n getAppProviderTokens(token: Token): Token[] {\n return [...(this.appProviderTokens.get(token) ?? [])];\n }\n\n getConsumerMiddlewareDefinitions(): MiddlewareRouteDefinition[] {\n return [...this.consumerMiddlewareDefinitions];\n }\n\n /**\n * Every lazy module instance recorded during load. Handed to the\n * LazyModuleManager at bootstrap; empty when no module opted in.\n */\n getLazyGroups(): LazyModuleGroupSpec[] {\n return [...this.lazyGroups.values()];\n }\n\n /**\n * A token is deferred iff EVERY module bucket holding it belongs to a lazy\n * module instance — a token also registered by a non-lazy module stays on\n * the eager pass (and resolving it there claims the lazy sibling, which is\n * the \"any use = init\" semantic, not a bug).\n */\n private isLazyOnlyToken(token: Token): boolean {\n if (this.lazyModuleIds.size === 0) return false;\n const owners = this.container.getOwnerModuleIds(token);\n if (owners.length === 0) return false;\n return owners.every((id) => this.lazyModuleIds.has(id));\n }\n\n async resolveAllInstances(): Promise<unknown[]> {\n const instanceSet = new Set<unknown>();\n\n for (const token of this.registeredProviders) {\n try {\n if (this.container.getProviderScope(token) === Scope.REQUEST) {\n continue;\n }\n if (this.isLazyOnlyToken(token)) {\n continue;\n }\n const instance = await this.container.resolveAsync(token);\n instanceSet.add(instance);\n } catch (err) {\n if (err instanceof ModuleVisibilityError || err instanceof MultipleProvidersFoundError) {\n throw err;\n }\n this.routeError(err, `resolve provider`);\n }\n }\n\n for (const controller of this.collectedControllers) {\n try {\n if (this.container.getProviderScope(controller) === Scope.REQUEST) {\n continue;\n }\n if (this.isLazyOnlyToken(controller)) {\n continue;\n }\n const instance = await this.container.resolveAsync(controller);\n instanceSet.add(instance);\n } catch (err) {\n if (err instanceof ModuleVisibilityError || err instanceof MultipleProvidersFoundError) {\n throw err;\n }\n this.routeError(err, `resolve controller ${controller.name}`);\n }\n }\n\n return [...instanceSet];\n }\n\n private routeError(err: unknown, context: string): void {\n const mode = this.container.getDiagnostics();\n if (mode === 'silent') return;\n if (mode === 'throw') {\n throw err instanceof Error ? err : new Error(String(err));\n }\n console.warn(`[vela] ${context} failed:`, err);\n }\n}\n","import type { Container } from '../container/container';\nimport type { Token } from '../container/types';\nimport type { RouteManager } from '../http/route.manager';\nimport type { ModuleLoader } from '../module/module-loader';\nimport { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_MIDDLEWARE, APP_PIPE } from './tokens';\n\ntype Bind = (...tokens: Token[]) => RouteManager;\n\ninterface AppProviderSlot {\n token: Token;\n bind: (rm: RouteManager) => Bind;\n}\n\n// NestJS-style \"APP_*\" provider convention: each slot maps a well-known DI\n// token to the RouteManager method that installs providers under it as a\n// global component. Module-level @Provide(APP_*) entries expand into\n// synthetic tokens (collected by ModuleLoader); a single @Inject(APP_*)\n// provider falls back to the bare token.\nconst SLOTS: AppProviderSlot[] = [\n { token: APP_GUARD, bind: (rm) => rm.useGlobalGuardTokens.bind(rm) },\n { token: APP_PIPE, bind: (rm) => rm.useGlobalPipeTokens.bind(rm) },\n { token: APP_INTERCEPTOR, bind: (rm) => rm.useGlobalInterceptorTokens.bind(rm) },\n { token: APP_FILTER, bind: (rm) => rm.useGlobalFilterTokens.bind(rm) },\n { token: APP_MIDDLEWARE, bind: (rm) => rm.useGlobalMiddlewareTokens.bind(rm) },\n];\n\n/**\n * Bind every APP_* provider registered in the container as a global\n * component on the RouteManager. The single source of truth for app-level\n * pipeline configuration — used by both VelaFactory.create and\n * @velajs/testing's TestingModuleBuilder.compile.\n */\nexport function bindAppProviders(\n routeManager: RouteManager,\n container: Container,\n loader: ModuleLoader,\n): void {\n for (const { token, bind } of SLOTS) {\n const collected = loader.getAppProviderTokens(token);\n if (collected.length > 0) {\n bind(routeManager)(...collected);\n } else if (container.has(token)) {\n bind(routeManager)(token);\n }\n }\n}\n","import { Scope } from '../constants';\nimport { Container } from '../container/container';\nimport { ModuleRef } from '../container/module-ref';\nimport { DiscoveryService } from '../discovery/discovery.service';\nimport type { Diagnostics, Type } from '../container/types';\nimport { REQUEST_CONTEXT } from '../http/request-context';\nimport { RouteManager } from '../http/route.manager';\nimport type { RouteManagerOptions } from '../http/route.manager';\nimport { UrlGeneratorService } from '../http/url/url-generator.service';\nimport { SignedUrlGuard } from '../http/url/signed-url.guard';\nimport { ModuleLoader } from '../module/module-loader';\nimport { bindAppProviders } from '../pipeline/app-providers';\nimport { ComponentManager } from '../pipeline/component.manager';\nimport {\n APP_EXCEPTION_HANDLER,\n APP_FILTER,\n APP_GUARD,\n APP_INTERCEPTOR,\n APP_MIDDLEWARE,\n APP_PIPE,\n ERROR_CATALOG,\n} from '../pipeline/tokens';\nimport type { NestMiddleware } from '../pipeline/types';\n\nexport interface BootstrapOptions extends RouteManagerOptions {\n diagnostics?: Diagnostics;\n}\n\nexport interface BootstrapResult {\n container: Container;\n routeManager: RouteManager;\n loader: ModuleLoader;\n}\n\n/**\n * Wire the DI graph for `rootModule` and prepare the route manager — without\n * running lifecycle hooks or building the Hono app. The single primitive\n * shared by `VelaFactory.create` (HTTP), `@velajs/testing` (test), and any\n * non-HTTP consumer (CLI tools, custom runtimes).\n *\n * Framework-internal tokens (`Container`, `ModuleRef`, `APP_*`) are marked\n * global so they are resolvable from any module.\n */\nexport async function bootstrap(\n rootModule: Type,\n options: BootstrapOptions = {},\n): Promise<BootstrapResult> {\n const container = new Container({\n diagnostics: options.diagnostics,\n });\n\n container.register({ provide: Container, useValue: container });\n container.markGlobalToken(Container);\n\n container.register({\n provide: ModuleRef,\n useFactory: (c: Container) => new ModuleRef(c),\n inject: [Container],\n });\n container.markGlobalToken(ModuleRef);\n\n // Decorator-driven discovery — global so any provider can inject it.\n container.register({\n provide: DiscoveryService,\n useFactory: (c: Container) => new DiscoveryService(c),\n inject: [Container],\n });\n container.markGlobalToken(DiscoveryService);\n\n for (const t of [\n APP_GUARD,\n APP_PIPE,\n APP_INTERCEPTOR,\n APP_FILTER,\n APP_MIDDLEWARE,\n APP_EXCEPTION_HANDLER,\n ERROR_CATALOG,\n ]) {\n container.markGlobalToken(t);\n }\n\n // REQUEST_CONTEXT is seeded into each request-scoped child by RouteManager\n // before any handler resolves it (see route.manager.ts:getRequestContainer).\n // The factory throws so misuse outside the request path surfaces immediately\n // instead of materializing a phantom context.\n container.register({\n provide: REQUEST_CONTEXT,\n scope: Scope.REQUEST,\n useFactory: () => {\n throw new Error(\n 'REQUEST_CONTEXT can only be resolved inside a request — ' +\n 'it is seeded by RouteManager when the request enters the pipeline.',\n );\n },\n });\n container.markGlobalToken(REQUEST_CONTEXT);\n\n const routeManager = new RouteManager(container, options);\n // Resolvable so non-HTTP transports (the WebSocket dispatcher) can read the\n // same global-tier components (APP_* + app.useGlobalX()).\n container.register({ provide: RouteManager, useValue: routeManager });\n container.markGlobalToken(RouteManager);\n\n // Named-route URL generation + signed-URL verification are app-level\n // singletons: injectable from any module, and (for the guard) instantiable by\n // the pipeline when a route opts in via `@SignedUrl()`. Both read their secret\n // lazily and never force controllers/lazy modules to materialize.\n container.register(UrlGeneratorService);\n container.markGlobalToken(UrlGeneratorService);\n container.register(SignedUrlGuard);\n container.markGlobalToken(SignedUrlGuard);\n\n const loader = new ModuleLoader(container, routeManager);\n // loader.load() also arms the deferred-init seam (LazyModuleManager) — kept\n // inside the loader so hand-rolled bootstrap paths that never call this\n // function (@velajs/testing's TestingModuleBuilder.compile) get identical\n // lazy semantics.\n loader.load(rootModule);\n\n bindAppProviders(routeManager, container, loader);\n routeManager.registerConsumerMiddleware(loader.getConsumerMiddlewareDefinitions());\n\n if (options.globalPrefix) {\n routeManager.setGlobalPrefix(options.globalPrefix);\n }\n\n for (const handler of options.middleware ?? []) {\n const mw: NestMiddleware = { use: handler };\n routeManager.useGlobalMiddleware(mw);\n }\n\n // All providers are registered — compute request-scope bubbling so effective\n // scopes are known before eager instantiation and request resolution.\n container.computeEffectiveScopes();\n\n return { container, routeManager, loader };\n}\n","import { InjectionToken } from '../container/types';\nimport type { Type } from '../container/types';\nimport { Module } from '../module/decorators';\nimport type { DynamicModule } from '../registry/types';\n\nexport interface Plugin {\n id: string;\n version: string;\n module: Type | DynamicModule;\n dependsOn?: string[];\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Freeze and validate a plugin manifest. Returns the same object so it can\n * be used in `composePlugins([definePlugin(...), ...])`.\n */\nexport function definePlugin(plugin: Plugin): Plugin {\n if (!plugin.id) throw new Error('Plugin requires an id');\n if (!plugin.version) throw new Error('Plugin requires a version');\n if (!plugin.module) throw new Error('Plugin requires a module');\n return Object.freeze({ ...plugin });\n}\n\nexport class PluginRegistry {\n private byId: Map<string, Plugin>;\n\n constructor(plugins: readonly Plugin[]) {\n this.byId = new Map();\n for (const p of plugins) {\n if (this.byId.has(p.id)) {\n throw new Error(`Duplicate plugin id: '${p.id}'`);\n }\n this.byId.set(p.id, p);\n }\n }\n\n list(): Plugin[] {\n return [...this.byId.values()];\n }\n\n get(id: string): Plugin | undefined {\n return this.byId.get(id);\n }\n\n dependents(id: string): Plugin[] {\n return this.list().filter((p) => p.dependsOn?.includes(id) ?? false);\n }\n}\n\nexport const PLUGIN_REGISTRY_TOKEN = new InjectionToken<PluginRegistry>('PLUGIN_REGISTRY');\n\n@Module({})\nexport class PluginRootModule {}\n\n/**\n * Topologically sort plugins so each plugin's dependencies appear first.\n * Throws on missing dependencies and cycles.\n */\nfunction topologicalSort(plugins: readonly Plugin[]): Plugin[] {\n const byId = new Map<string, Plugin>();\n for (const p of plugins) {\n if (byId.has(p.id)) {\n throw new Error(`Duplicate plugin id: '${p.id}'`);\n }\n byId.set(p.id, p);\n }\n\n const result: Plugin[] = [];\n const visiting = new Set<string>();\n const visited = new Set<string>();\n\n const visit = (p: Plugin, path: string[]): void => {\n if (visited.has(p.id)) return;\n if (visiting.has(p.id)) {\n const cycle = [...path, p.id].join(' -> ');\n throw new Error(`Plugin cycle detected: ${cycle}`);\n }\n visiting.add(p.id);\n for (const depId of p.dependsOn ?? []) {\n const dep = byId.get(depId);\n if (!dep) {\n throw new Error(`Plugin '${p.id}' depends on missing plugin '${depId}'`);\n }\n visit(dep, [...path, p.id]);\n }\n visiting.delete(p.id);\n visited.add(p.id);\n result.push(p);\n };\n\n for (const p of plugins) visit(p, []);\n return result;\n}\n\n/**\n * Compose a list of plugins into a single dynamic module that imports each\n * plugin's module in dependency order, registers a `PluginRegistry`, and\n * exposes it globally so any plugin can introspect peers.\n */\nexport function composePlugins(plugins: readonly Plugin[]): DynamicModule {\n const sorted = topologicalSort(plugins);\n const registry = new PluginRegistry(sorted);\n\n return {\n module: PluginRootModule,\n imports: sorted.map((p) => p.module),\n providers: [{ provide: PLUGIN_REGISTRY_TOKEN, useValue: registry }],\n exports: [PLUGIN_REGISTRY_TOKEN],\n global: true,\n };\n}\n"],"mappings":";;;;;;;;;;AA4CA,SAAgB,uBAAuB,GAAyC;CAC9E,OACE,OAAO,MAAM,YACb,MAAM,QACN,OAAQ,EAA6B,uBAAuB;AAEhE;;;AC3CA,MAAM,iBAAiB,OAAO,IAAI,qBAAqB;AAEvD,SAAS,YAAyC;CAChD,MAAM,IAAI;CACV,OAAQ,EAAE,oCAAoB,IAAI,IAAI;AACxC;;;;;;;;;;;AAYA,SAAgB,uBAAuB,GAAyB;CAC9D,UAAU,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC;AAC3B;;AAGA,SAAgB,qBAAuC;CACrD,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC,OAAO,CAAC;AACjC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;CACpC,OAAO;AACT;;;;;;AAOA,SAAgB,eAAe,SAA2C;CACxE,MAAM,SAAS,gBAAgB,OAAO;CACtC,MAAM,WAAW,IAAI,eAAe,MAAM;CAE1C,OAAO;EACL,QAAQ;EACR,SAAS,OAAO,KAAK,MAAM,EAAE,MAAM;EACnC,WAAW,CAAC;GAAE,SAAS;GAAuB,UAAU;EAAS,CAAC;EAClE,SAAS,CAAC,qBAAqB;EAC/B,QAAQ;CACV;AACF"}
@@ -1,10 +1,247 @@
1
- export { QueueModule, QUEUE_MODULE_OPTIONS } from './queue.module';
2
- export { Processor, Process, getProcessHandlers } from './queue.decorators';
3
- export { queueToken, QUEUE_DRIVER, PROCESSOR_METADATA, PROCESS_METADATA } from './queue.tokens';
4
- export { QueueClient } from './queue.client';
5
- export { QueueDispatchBinding } from './queue.binding';
6
- export { dispatchQueueJob } from './queue.dispatch';
7
- export type { QueueDispatchResult, QueueEntry } from './queue.dispatch';
8
- export { inline } from './inline.driver';
9
- export type { InlineQueueDriver, InlineQueueOptions } from './inline.driver';
10
- export type { AddJobOptions, ProcessMetadata, ProcessorMetadata, QueueDispatchFn, QueueDriver, QueueDriverBindHooks, QueueJob, QueueModuleOptions, } from './queue.types';
1
+ import { P as Container, U as InjectionToken, X as Token, i as DiscoveryService } from "../discovery.service-Cpf1QcZ5.js";
2
+ import { q as EntrypointRegistry } from "../metadata.registry-D1od8ZBt.js";
3
+ import { zt as ConfigurableModuleClassType } from "../index-DhShDLCM.js";
4
+ //#region src/queue/queue.types.d.ts
5
+ /**
6
+ * One job as handed to `@Process` handlers and drivers. Ids are minted by the
7
+ * client via `crypto.randomUUID()` (Web Crypto — edge-safe).
8
+ */
9
+ interface QueueJob<T = unknown> {
10
+ id: string;
11
+ /** Queue the job was added to (`QueueModule.forRoot({ queues })` name). */
12
+ queue: string;
13
+ /** Job name — matched against `@Process(name)`; unnamed handlers catch the rest. */
14
+ name: string;
15
+ data: T;
16
+ /** Delivery attempt, 1-based. Platform drivers increment on retry. */
17
+ attempt: number;
18
+ }
19
+ interface AddJobOptions {
20
+ /**
21
+ * Requested delivery delay. Honored only by drivers that support it — the
22
+ * in-core `inline()` driver does not and warns once (log diagnostics).
23
+ */
24
+ delayMs?: number;
25
+ }
26
+ /** The function a driver calls to deliver one job into the app's processors. */
27
+ type QueueDispatchFn = (job: QueueJob) => Promise<void>;
28
+ interface QueueDriverBindHooks {
29
+ /**
30
+ * Where fire-and-forget delivery errors go (the inline driver's
31
+ * `immediate` mode has no awaiter to rethrow into). Wired to the
32
+ * container's diagnostics by `QueueDispatchBinding`.
33
+ */
34
+ onError?: (error: unknown, job: QueueJob) => void;
35
+ }
36
+ /**
37
+ * Producer/transport seam. `enqueue` accepts a job for later (or immediate)
38
+ * delivery; drivers that deliver in-process implement `bind` to receive the
39
+ * app's dispatch function. Platform packages (Cloudflare Queues, Redis, …)
40
+ * implement this interface out-of-core.
41
+ */
42
+ interface QueueDriver {
43
+ readonly kind: string;
44
+ enqueue(job: QueueJob, options?: AddJobOptions): Promise<void>;
45
+ bind?(dispatch: QueueDispatchFn, hooks?: QueueDriverBindHooks): void;
46
+ }
47
+ interface QueueModuleOptions {
48
+ /**
49
+ * Queue names this instance provides clients for. STRUCTURAL — must be
50
+ * known at `forRoot`/`forRootAsync` call time (clients are options-derived
51
+ * providers); `forRootAsync` callers pass it alongside the factory.
52
+ */
53
+ queues?: string[];
54
+ /** Defaults to the in-core `inline()` driver. */
55
+ driver?: QueueDriver;
56
+ }
57
+ /** Class-level meta written by `@Processor(queueName)` (the 'queue' entrypoint kind). */
58
+ interface ProcessorMetadata {
59
+ queueName: string;
60
+ }
61
+ /** Per-handler meta written by `@Process(jobName?)`. */
62
+ interface ProcessMetadata {
63
+ jobName?: string;
64
+ methodName: string | symbol;
65
+ }
66
+ //#endregion
67
+ //#region src/queue/queue.module.d.ts
68
+ /**
69
+ * First-party queue module — authored 100% on vela's public API (the
70
+ * roadmap's "openness proof"). Producers inject a per-queue `QueueClient`
71
+ * via `queueToken(name)`; consumers are `@Processor`/`@Process` classes in
72
+ * ordinary user modules; platforms deliver through `dispatchQueueJob` or the
73
+ * in-core `inline()` driver.
74
+ *
75
+ * ```ts
76
+ * imports: [QueueModule.forRoot({ queues: ['email'] })]
77
+ * ```
78
+ *
79
+ * `lazy: true` (dogfoods 1.13): the module materializes when an eager
80
+ * producer injects a client (bootstrap — same structural reality that keeps
81
+ * WebSocketModule eager) or, in consumer-only workers, at the first
82
+ * delivered job.
83
+ *
84
+ * `queues` is STRUCTURAL: clients are options-derived providers, so
85
+ * `forRootAsync` callers pass it alongside the factory —
86
+ * `forRootAsync({ queues: ['email'], useFactory: () => ({ driver }) })`.
87
+ * Note that async options inherit the 1.13 lazy-module contract: the module
88
+ * must first materialize through an async seam (an eager producer's injection
89
+ * during the bootstrap sweep — the common case — or
90
+ * `app.materializeLazyModules()`); a synchronous first touch throws the
91
+ * descriptive sync-seam error.
92
+ */
93
+ declare const ConfigurableModuleClass: ConfigurableModuleClassType<QueueModuleOptions, "forRoot", "create", {
94
+ isGlobal?: boolean;
95
+ }>, MODULE_OPTIONS_TOKEN: InjectionToken<QueueModuleOptions>;
96
+ declare class QueueModule extends ConfigurableModuleClass {}
97
+ //#endregion
98
+ //#region src/queue/queue.decorators.d.ts
99
+ /**
100
+ * Marks a provider class as a processor for one queue:
101
+ *
102
+ * ```ts
103
+ * @Processor('email')
104
+ * @Injectable()
105
+ * class EmailProcessor {
106
+ * @Process('welcome')
107
+ * async sendWelcome(job: QueueJob<{ userId: string }>) { ... }
108
+ * }
109
+ * ```
110
+ */
111
+ declare function Processor(queueName: string): ClassDecorator;
112
+ /**
113
+ * Marks a processor method as the handler for a job name. Omit the name for
114
+ * the wildcard handler (receives every job on the queue that has no named
115
+ * handler). Named handlers win over the wildcard; a duplicate registration
116
+ * for the same name is first-wins with a diagnostics warning at dispatch.
117
+ */
118
+ declare function Process(jobName?: string): MethodDecorator;
119
+ /** `@Process` entries declared on a processor class (declaration order). */
120
+ declare function getProcessHandlers(processorClass: object): ProcessMetadata[];
121
+ //#endregion
122
+ //#region src/queue/queue.client.d.ts
123
+ /**
124
+ * Producer handle for one named queue — inject via `queueToken(name)`:
125
+ *
126
+ * ```ts
127
+ * constructor(@Inject(queueToken('email')) private readonly email: QueueClient) {}
128
+ * await this.email.add('welcome', { userId });
129
+ * ```
130
+ *
131
+ * `add()` resolves when the DRIVER accepted the job, not when a processor
132
+ * handled it (the inline driver's `immediate` mode delivers on a following
133
+ * microtask; platform drivers deliver in another isolate entirely).
134
+ */
135
+ declare class QueueClient {
136
+ private readonly queue;
137
+ private readonly driver;
138
+ constructor(queue: string, driver: QueueDriver);
139
+ get name(): string;
140
+ add<T>(jobName: string, data: T, options?: AddJobOptions): Promise<QueueJob<T>>;
141
+ }
142
+ //#endregion
143
+ //#region src/queue/queue.tokens.d.ts
144
+ declare const PROCESSOR_METADATA = "vela:queue:processor";
145
+ declare const PROCESS_METADATA = "vela:queue:process";
146
+ /** The driver in effect for a `QueueModule` instance. */
147
+ declare const QUEUE_DRIVER: InjectionToken<QueueDriver>;
148
+ /**
149
+ * The injection token for a named queue's `QueueClient`:
150
+ *
151
+ * ```ts
152
+ * constructor(@Inject(queueToken('email')) private readonly email: QueueClient) {}
153
+ * ```
154
+ *
155
+ * Memoized per name (HMR-stable). Deliberately NO `InjectionToken` default
156
+ * factory: the container resolves default-factory tokens from the root bucket
157
+ * BEFORE walking module imports, which would break the exported-provider
158
+ * path — the token description (`vela:queue:client:<name>`) keeps the
159
+ * no-provider error readable instead.
160
+ */
161
+ declare function queueToken(name: string): InjectionToken<QueueClient>;
162
+ //#endregion
163
+ //#region src/queue/queue.binding.d.ts
164
+ /**
165
+ * Wires a `QueueModule` instance's driver to the app: binds in-process
166
+ * delivery to the dispatch core and validates that no other module instance
167
+ * provides the same queue names.
168
+ *
169
+ * Delivery resolves processors from the per-app `EntrypointRegistry` once it
170
+ * exists (registered into the container at the end of
171
+ * `callOnApplicationBootstrap`); deliveries that arrive earlier (a producer's
172
+ * `onModuleInit` calling `add()`) fall back to `DiscoveryService` with
173
+ * `deferLazy` — identical entries, no buffering, no lost jobs.
174
+ *
175
+ * Every `QueueClient` injects this binding, so the driver is always bound
176
+ * before the first `add()` — including when the module materializes lazily.
177
+ */
178
+ declare class QueueDispatchBinding {
179
+ private readonly container;
180
+ private readonly discovery;
181
+ constructor(container: Container, discovery: DiscoveryService, driver: QueueDriver, queues: string[]);
182
+ private deliver;
183
+ private routeError;
184
+ }
185
+ //#endregion
186
+ //#region src/queue/queue.dispatch.d.ts
187
+ interface QueueDispatchResult {
188
+ /** Processors that ran a handler for this job. */
189
+ handled: number;
190
+ }
191
+ /** One dispatchable processor: its class token + `@Processor` meta. */
192
+ interface QueueEntry {
193
+ token: Token;
194
+ meta: ProcessorMetadata;
195
+ }
196
+ /**
197
+ * Deliver one job to every `@Processor` of its queue — the primitive both the
198
+ * in-core `inline()` driver and platform adapters call.
199
+ *
200
+ * Each matching processor runs inside `runInEntrypointScope` (request-scoped
201
+ * dependencies rebuild per job) and is re-resolved BY TOKEN through the async
202
+ * seam, so processors living in `lazy: true` modules materialize cleanly on
203
+ * first dispatch — async providers and lifecycle hooks included. Scoped
204
+ * guards/interceptors/filters run through `PipelineRunner`
205
+ * (`getType() === 'queue'`, `getPayload()` is the job); app-wide `APP_*`
206
+ * components deliberately do NOT apply (cloudflare queue/scheduled parity —
207
+ * documented divergence from the WebSocket dispatcher).
208
+ *
209
+ * Errors no scoped filter claims RETHROW so awaiting platforms keep their
210
+ * retry semantics; fire-and-forget callers (inline `immediate` mode) must
211
+ * catch — `QueueDispatchBinding` routes those to diagnostics.
212
+ */
213
+ declare function dispatchQueueJob(container: Container, entrypoints: EntrypointRegistry, job: QueueJob): Promise<QueueDispatchResult>;
214
+ //#endregion
215
+ //#region src/queue/inline.driver.d.ts
216
+ interface InlineQueueOptions {
217
+ /**
218
+ * `immediate` (default): deliver on a microtask after `enqueue` resolves —
219
+ * `add()` resolving does NOT mean the job was handled. Handler errors are
220
+ * routed to the binding's error hook (container diagnostics), never thrown
221
+ * into the detached microtask.
222
+ *
223
+ * `manual`: buffer until `flush()` — deterministic delivery for tests.
224
+ */
225
+ mode?: 'immediate' | 'manual';
226
+ }
227
+ interface InlineQueueDriver extends QueueDriver {
228
+ /**
229
+ * Deliver everything buffered (manual mode; also drains jobs enqueued
230
+ * before the driver was bound). Resolves with the delivered count; rejects
231
+ * with an `AggregateError` after attempting ALL buffered jobs if any
232
+ * handler error went unclaimed — the awaiter exists here, so the
233
+ * platform-retry rethrow contract is meaningful.
234
+ */
235
+ flush(): Promise<number>;
236
+ /** Jobs currently buffered (unbound immediate + all manual). */
237
+ readonly size: number;
238
+ }
239
+ /**
240
+ * In-process driver for dev, tests, and single-isolate apps. Edge-pure: no
241
+ * timers — `immediate` mode uses `queueMicrotask`. `delayMs` is not
242
+ * supported (warns once through the bound error hook's diagnostics side).
243
+ */
244
+ declare function inline(options?: InlineQueueOptions): InlineQueueDriver;
245
+ //#endregion
246
+ export { type AddJobOptions, type InlineQueueDriver, type InlineQueueOptions, PROCESSOR_METADATA, PROCESS_METADATA, Process, type ProcessMetadata, Processor, type ProcessorMetadata, QUEUE_DRIVER, MODULE_OPTIONS_TOKEN as QUEUE_MODULE_OPTIONS, QueueClient, QueueDispatchBinding, type QueueDispatchFn, type QueueDispatchResult, type QueueDriver, type QueueDriverBindHooks, type QueueEntry, type QueueJob, QueueModule, type QueueModuleOptions, dispatchQueueJob, getProcessHandlers, inline, queueToken };
247
+ //# sourceMappingURL=index.d.ts.map