@velajs/vela 1.18.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 (441) hide show
  1. package/CHANGELOG.md +78 -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 -66
  23. package/dist/index.js +14 -71
  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 +67 -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 -91
  67. package/dist/application.js +0 -308
  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 -62
  143. package/dist/errors/http-exception.js +0 -134
  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/factory/adapter.d.ts +0 -36
  161. package/dist/factory/adapter.js +0 -18
  162. package/dist/factory/bootstrap.d.ts +0 -23
  163. package/dist/factory/bootstrap.js +0 -108
  164. package/dist/factory.d.ts +0 -16
  165. package/dist/factory.js +0 -36
  166. package/dist/fetch/fetch.module.d.ts +0 -7
  167. package/dist/fetch/fetch.module.js +0 -31
  168. package/dist/fetch/fetch.service.d.ts +0 -24
  169. package/dist/fetch/fetch.service.js +0 -145
  170. package/dist/fetch/fetch.types.d.ts +0 -24
  171. package/dist/fetch/fetch.types.js +0 -1
  172. package/dist/fetch/index.d.ts +0 -3
  173. package/dist/fetch/index.js +0 -2
  174. package/dist/health/health.http.d.ts +0 -14
  175. package/dist/health/health.http.js +0 -75
  176. package/dist/health/health.indicator.d.ts +0 -9
  177. package/dist/health/health.indicator.js +0 -32
  178. package/dist/health/health.module.d.ts +0 -2
  179. package/dist/health/health.module.js +0 -26
  180. package/dist/health/health.service.d.ts +0 -7
  181. package/dist/health/health.service.js +0 -69
  182. package/dist/health/health.types.d.ts +0 -15
  183. package/dist/health/health.types.js +0 -1
  184. package/dist/health/index.d.ts +0 -6
  185. package/dist/health/index.js +0 -4
  186. package/dist/http/ambient.d.ts +0 -17
  187. package/dist/http/ambient.js +0 -44
  188. package/dist/http/argument-resolver.d.ts +0 -10
  189. package/dist/http/argument-resolver.js +0 -89
  190. package/dist/http/decorators.d.ts +0 -198
  191. package/dist/http/decorators.js +0 -321
  192. package/dist/http/execution-context.d.ts +0 -8
  193. package/dist/http/execution-context.js +0 -35
  194. package/dist/http/handler-executor.d.ts +0 -20
  195. package/dist/http/handler-executor.js +0 -111
  196. package/dist/http/index.d.ts +0 -12
  197. package/dist/http/index.js +0 -7
  198. package/dist/http/instantiate.d.ts +0 -4
  199. package/dist/http/instantiate.js +0 -45
  200. package/dist/http/lazy-param.decorator.d.ts +0 -37
  201. package/dist/http/lazy-param.decorator.js +0 -117
  202. package/dist/http/request-container.d.ts +0 -16
  203. package/dist/http/request-container.js +0 -19
  204. package/dist/http/request-context.d.ts +0 -13
  205. package/dist/http/request-context.js +0 -22
  206. package/dist/http/response-mapper.d.ts +0 -8
  207. package/dist/http/response-mapper.js +0 -42
  208. package/dist/http/route-contributor.d.ts +0 -68
  209. package/dist/http/route-contributor.js +0 -22
  210. package/dist/http/route-map.d.ts +0 -30
  211. package/dist/http/route-map.js +0 -27
  212. package/dist/http/route.manager.d.ts +0 -92
  213. package/dist/http/route.manager.js +0 -481
  214. package/dist/http/types.d.ts +0 -37
  215. package/dist/http/types.js +0 -1
  216. package/dist/http/url/index.d.ts +0 -4
  217. package/dist/http/url/index.js +0 -3
  218. package/dist/http/url/signed-url.guard.d.ts +0 -27
  219. package/dist/http/url/signed-url.guard.js +0 -62
  220. package/dist/http/url/signing-secret.d.ts +0 -20
  221. package/dist/http/url/signing-secret.js +0 -24
  222. package/dist/http/url/url-generator.service.d.ts +0 -52
  223. package/dist/http/url/url-generator.service.js +0 -104
  224. package/dist/i18n/deep-merge.d.ts +0 -2
  225. package/dist/i18n/deep-merge.js +0 -15
  226. package/dist/i18n/i18n.middleware.d.ts +0 -15
  227. package/dist/i18n/i18n.middleware.js +0 -94
  228. package/dist/i18n/i18n.module.d.ts +0 -13
  229. package/dist/i18n/i18n.module.js +0 -69
  230. package/dist/i18n/i18n.options.d.ts +0 -30
  231. package/dist/i18n/i18n.options.js +0 -16
  232. package/dist/i18n/i18n.service.d.ts +0 -20
  233. package/dist/i18n/i18n.service.js +0 -49
  234. package/dist/i18n/i18n.tokens.d.ts +0 -6
  235. package/dist/i18n/i18n.tokens.js +0 -3
  236. package/dist/i18n/i18n.types.d.ts +0 -6
  237. package/dist/i18n/i18n.types.js +0 -1
  238. package/dist/i18n/message-loader.service.d.ts +0 -21
  239. package/dist/i18n/message-loader.service.js +0 -90
  240. package/dist/i18n/message-registry.d.ts +0 -16
  241. package/dist/i18n/message-registry.js +0 -49
  242. package/dist/lifecycle/index.d.ts +0 -20
  243. package/dist/lifecycle/index.js +0 -15
  244. package/dist/live/live.cursor.d.ts +0 -22
  245. package/dist/live/live.cursor.js +0 -56
  246. package/dist/live/live.decorators.d.ts +0 -32
  247. package/dist/live/live.decorators.js +0 -46
  248. package/dist/live/live.delta.d.ts +0 -15
  249. package/dist/live/live.delta.js +0 -51
  250. package/dist/live/live.engine.d.ts +0 -81
  251. package/dist/live/live.engine.js +0 -448
  252. package/dist/live/live.invalidation.d.ts +0 -45
  253. package/dist/live/live.invalidation.js +0 -99
  254. package/dist/live/live.module.d.ts +0 -28
  255. package/dist/live/live.module.js +0 -87
  256. package/dist/live/live.tokens.d.ts +0 -9
  257. package/dist/live/live.tokens.js +0 -8
  258. package/dist/live/live.types.d.ts +0 -138
  259. package/dist/live/live.types.js +0 -1
  260. package/dist/live/presence.d.ts +0 -44
  261. package/dist/live/presence.js +0 -130
  262. package/dist/metadata.d.ts +0 -10
  263. package/dist/metadata.js +0 -20
  264. package/dist/module/configurable-module.builder.d.ts +0 -56
  265. package/dist/module/configurable-module.builder.js +0 -84
  266. package/dist/module/configurable-module.types.d.ts +0 -93
  267. package/dist/module/configurable-module.types.js +0 -5
  268. package/dist/module/decorators.d.ts +0 -10
  269. package/dist/module/decorators.js +0 -47
  270. package/dist/module/define-module.d.ts +0 -112
  271. package/dist/module/define-module.js +0 -232
  272. package/dist/module/graph.d.ts +0 -10
  273. package/dist/module/graph.js +0 -35
  274. package/dist/module/index.d.ts +0 -10
  275. package/dist/module/index.js +0 -7
  276. package/dist/module/lazy-modules.d.ts +0 -82
  277. package/dist/module/lazy-modules.js +0 -231
  278. package/dist/module/lazy-provider.d.ts +0 -65
  279. package/dist/module/lazy-provider.js +0 -111
  280. package/dist/module/middleware.d.ts +0 -30
  281. package/dist/module/middleware.js +0 -67
  282. package/dist/module/module-loader.d.ts +0 -58
  283. package/dist/module/module-loader.js +0 -484
  284. package/dist/module/stable-hash.d.ts +0 -15
  285. package/dist/module/stable-hash.js +0 -52
  286. package/dist/module/types.d.ts +0 -1
  287. package/dist/module/types.js +0 -1
  288. package/dist/openapi/decorators.d.ts +0 -34
  289. package/dist/openapi/decorators.js +0 -66
  290. package/dist/openapi/document.d.ts +0 -3
  291. package/dist/openapi/document.js +0 -316
  292. package/dist/openapi/index.d.ts +0 -7
  293. package/dist/openapi/index.js +0 -6
  294. package/dist/openapi/redoc-ui.d.ts +0 -1
  295. package/dist/openapi/redoc-ui.js +0 -19
  296. package/dist/openapi/scalar-ui.d.ts +0 -1
  297. package/dist/openapi/scalar-ui.js +0 -19
  298. package/dist/openapi/swagger-ui.d.ts +0 -1
  299. package/dist/openapi/swagger-ui.js +0 -23
  300. package/dist/openapi/types.d.ts +0 -182
  301. package/dist/openapi/types.js +0 -4
  302. package/dist/openapi/zod-to-json-schema.d.ts +0 -4
  303. package/dist/openapi/zod-to-json-schema.js +0 -57
  304. package/dist/pipeline/app-providers.d.ts +0 -10
  305. package/dist/pipeline/app-providers.js +0 -43
  306. package/dist/pipeline/component.manager.d.ts +0 -25
  307. package/dist/pipeline/component.manager.js +0 -66
  308. package/dist/pipeline/decorators.d.ts +0 -10
  309. package/dist/pipeline/decorators.js +0 -42
  310. package/dist/pipeline/index.d.ts +0 -12
  311. package/dist/pipeline/index.js +0 -7
  312. package/dist/pipeline/pipeline-runner.d.ts +0 -31
  313. package/dist/pipeline/pipeline-runner.js +0 -40
  314. package/dist/pipeline/pipes.d.ts +0 -48
  315. package/dist/pipeline/pipes.js +0 -104
  316. package/dist/pipeline/reflector.d.ts +0 -86
  317. package/dist/pipeline/reflector.js +0 -121
  318. package/dist/pipeline/scoped-components.d.ts +0 -26
  319. package/dist/pipeline/scoped-components.js +0 -27
  320. package/dist/pipeline/tokens.d.ts +0 -33
  321. package/dist/pipeline/tokens.js +0 -27
  322. package/dist/pipeline/types.d.ts +0 -64
  323. package/dist/pipeline/types.js +0 -1
  324. package/dist/plugin/plugin.d.ts +0 -31
  325. package/dist/plugin/plugin.js +0 -111
  326. package/dist/queue/inline.driver.d.ts +0 -30
  327. package/dist/queue/inline.driver.js +0 -58
  328. package/dist/queue/queue.binding.d.ts +0 -23
  329. package/dist/queue/queue.binding.js +0 -53
  330. package/dist/queue/queue.client.d.ts +0 -20
  331. package/dist/queue/queue.client.js +0 -33
  332. package/dist/queue/queue.decorators.d.ts +0 -23
  333. package/dist/queue/queue.decorators.js +0 -46
  334. package/dist/queue/queue.dispatch.d.ts +0 -36
  335. package/dist/queue/queue.dispatch.js +0 -102
  336. package/dist/queue/queue.module.d.ts +0 -32
  337. package/dist/queue/queue.module.js +0 -80
  338. package/dist/queue/queue.tokens.d.ts +0 -21
  339. package/dist/queue/queue.tokens.js +0 -34
  340. package/dist/queue/queue.types.d.ts +0 -61
  341. package/dist/queue/queue.types.js +0 -4
  342. package/dist/registry/index.d.ts +0 -2
  343. package/dist/registry/index.js +0 -1
  344. package/dist/registry/metadata.registry.d.ts +0 -73
  345. package/dist/registry/metadata.registry.js +0 -357
  346. package/dist/registry/paths.d.ts +0 -3
  347. package/dist/registry/paths.js +0 -15
  348. package/dist/registry/types.d.ts +0 -116
  349. package/dist/registry/types.js +0 -1
  350. package/dist/registry/util.d.ts +0 -3
  351. package/dist/registry/util.js +0 -8
  352. package/dist/schedule/cron-matcher.d.ts +0 -2
  353. package/dist/schedule/cron-matcher.js +0 -62
  354. package/dist/schedule/index.d.ts +0 -8
  355. package/dist/schedule/index.js +0 -5
  356. package/dist/schedule/schedule.decorators.d.ts +0 -2
  357. package/dist/schedule/schedule.decorators.js +0 -18
  358. package/dist/schedule/schedule.module.d.ts +0 -9
  359. package/dist/schedule/schedule.module.js +0 -28
  360. package/dist/schedule/schedule.registry.d.ts +0 -23
  361. package/dist/schedule/schedule.registry.js +0 -63
  362. package/dist/schedule/schedule.tokens.d.ts +0 -2
  363. package/dist/schedule/schedule.tokens.js +0 -2
  364. package/dist/schedule/schedule.types.d.ts +0 -8
  365. package/dist/schedule/schedule.types.js +0 -1
  366. package/dist/schedule-node/schedule-node.module.d.ts +0 -9
  367. package/dist/schedule-node/schedule-node.module.js +0 -28
  368. package/dist/schedule-node/schedule.executor.d.ts +0 -19
  369. package/dist/schedule-node/schedule.executor.js +0 -107
  370. package/dist/seeder/seeder.decorator.d.ts +0 -7
  371. package/dist/seeder/seeder.decorator.js +0 -15
  372. package/dist/seeder/seeder.module.d.ts +0 -16
  373. package/dist/seeder/seeder.module.js +0 -44
  374. package/dist/seeder/seeder.registry.d.ts +0 -23
  375. package/dist/seeder/seeder.registry.js +0 -83
  376. package/dist/seeder/seeder.tokens.d.ts +0 -2
  377. package/dist/seeder/seeder.tokens.js +0 -1
  378. package/dist/seeder/seeder.types.d.ts +0 -20
  379. package/dist/seeder/seeder.types.js +0 -1
  380. package/dist/serialization/index.d.ts +0 -2
  381. package/dist/serialization/index.js +0 -2
  382. package/dist/serialization/serialize.decorator.d.ts +0 -6
  383. package/dist/serialization/serialize.decorator.js +0 -7
  384. package/dist/serialization/serializer.interceptor.d.ts +0 -4
  385. package/dist/serialization/serializer.interceptor.js +0 -16
  386. package/dist/services/index.d.ts +0 -2
  387. package/dist/services/index.js +0 -1
  388. package/dist/services/logger.d.ts +0 -59
  389. package/dist/services/logger.js +0 -159
  390. package/dist/storage/path-template.d.ts +0 -9
  391. package/dist/storage/path-template.js +0 -20
  392. package/dist/storage/storage.types.d.ts +0 -41
  393. package/dist/storage/storage.types.js +0 -5
  394. package/dist/throttler/index.d.ts +0 -6
  395. package/dist/throttler/index.js +0 -5
  396. package/dist/throttler/throttler.decorators.d.ts +0 -3
  397. package/dist/throttler/throttler.decorators.js +0 -4
  398. package/dist/throttler/throttler.guard.d.ts +0 -9
  399. package/dist/throttler/throttler.guard.js +0 -72
  400. package/dist/throttler/throttler.module.d.ts +0 -7
  401. package/dist/throttler/throttler.module.js +0 -41
  402. package/dist/throttler/throttler.storage.d.ts +0 -10
  403. package/dist/throttler/throttler.storage.js +0 -44
  404. package/dist/throttler/throttler.tokens.d.ts +0 -6
  405. package/dist/throttler/throttler.tokens.js +0 -5
  406. package/dist/throttler/throttler.types.d.ts +0 -25
  407. package/dist/throttler/throttler.types.js +0 -1
  408. package/dist/validation/create-zod-dto.d.ts +0 -13
  409. package/dist/validation/create-zod-dto.js +0 -18
  410. package/dist/validation/index.d.ts +0 -3
  411. package/dist/validation/index.js +0 -2
  412. package/dist/validation/validation.pipe.d.ts +0 -4
  413. package/dist/validation/validation.pipe.js +0 -19
  414. package/dist/websocket/websocket.decorators.d.ts +0 -47
  415. package/dist/websocket/websocket.decorators.js +0 -80
  416. package/dist/websocket/websocket.module.d.ts +0 -35
  417. package/dist/websocket/websocket.module.js +0 -63
  418. package/dist/websocket/websocket.tokens.d.ts +0 -30
  419. package/dist/websocket/websocket.tokens.js +0 -27
  420. package/dist/websocket/websocket.types.d.ts +0 -102
  421. package/dist/websocket/websocket.types.js +0 -4
  422. package/dist/websocket/ws-argument-resolver.d.ts +0 -13
  423. package/dist/websocket/ws-argument-resolver.js +0 -40
  424. package/dist/websocket/ws-dispatcher.d.ts +0 -54
  425. package/dist/websocket/ws-dispatcher.js +0 -322
  426. package/dist/websocket/ws-exception.d.ts +0 -16
  427. package/dist/websocket/ws-exception.js +0 -32
  428. package/dist/websocket/ws-execution-context.d.ts +0 -9
  429. package/dist/websocket/ws-execution-context.js +0 -24
  430. package/dist/websocket/ws-server.d.ts +0 -31
  431. package/dist/websocket/ws-server.js +0 -74
  432. package/dist/websocket/ws-sync.d.ts +0 -47
  433. package/dist/websocket/ws-sync.js +0 -74
  434. package/dist/websocket-node/node-ws-client.d.ts +0 -24
  435. package/dist/websocket-node/node-ws-client.js +0 -49
  436. package/dist/websocket-node/redis-live.d.ts +0 -24
  437. package/dist/websocket-node/redis-live.js +0 -57
  438. package/dist/websocket-node/redis-sync.d.ts +0 -33
  439. package/dist/websocket-node/redis-sync.js +0 -56
  440. package/dist/websocket-node/register-gateways.d.ts +0 -20
  441. package/dist/websocket-node/register-gateways.js +0 -61
@@ -0,0 +1,697 @@
1
+ import { C as InjectionToken, a as Injectable, i as Inject, k as MetadataRegistry, m as Scope, n as __decorateParam, o as Optional, r as __decorateMetadata, t as __decorate } from "./decorate-GcSMAbKn.js";
2
+ import { F as shouldFilterCatch, I as ComponentManager, L as PipelineRunner, V as instantiateMany, t as RouteManager } from "./route.manager-DRAZ5X04.js";
3
+ import { n as resolveErrorReporter, t as DiscoveryService } from "./discovery.service-BYm95SSD.js";
4
+ import { t as Container } from "./container-BqUHID4l.js";
5
+ import { n as defineModule } from "./define-module-NOyOZNXD.js";
6
+ import { toErrorBody } from "@velajs/errors";
7
+ //#region src/discovery/discoverable.decorator.ts
8
+ /**
9
+ * Mint a discoverable decorator for a module's extension surface:
10
+ *
11
+ * ```ts
12
+ * export interface QueueConsumerMeta { queue: string }
13
+ * export const QueueConsumer = createDiscoverableDecorator<QueueConsumerMeta>('vela:queue:consumer');
14
+ *
15
+ * @QueueConsumer({ queue: 'emails' })
16
+ * @Injectable()
17
+ * class EmailConsumer { ... }
18
+ *
19
+ * // At bootstrap, anywhere:
20
+ * discovery.providersWithMeta(QueueConsumer) // typed { meta: QueueConsumerMeta }
21
+ * ```
22
+ *
23
+ * Unlike `Reflector.createDecorator`, the key is required and caller-chosen:
24
+ * a random key would mint a fresh identity on every HMR re-eval and orphan
25
+ * previously-decorated classes. Namespace it (`'<pkg>:<area>:<thing>'`).
26
+ */
27
+ function createDiscoverableDecorator(key, options = {}) {
28
+ const decorator = (value) => {
29
+ return (target, propertyKey) => {
30
+ const ctor = propertyKey !== void 0 ? target.constructor : target;
31
+ if (options.append) if (propertyKey !== void 0) MetadataRegistry.appendCustomClassMeta(ctor, key, {
32
+ methodName: propertyKey,
33
+ ...value
34
+ });
35
+ else MetadataRegistry.appendCustomClassMeta(ctor, key, value);
36
+ else if (propertyKey !== void 0) MetadataRegistry.setCustomHandlerMeta(ctor, propertyKey, key, value);
37
+ else MetadataRegistry.setCustomClassMeta(ctor, key, value);
38
+ };
39
+ };
40
+ decorator.KEY = key;
41
+ return decorator;
42
+ }
43
+ //#endregion
44
+ //#region src/websocket/websocket.tokens.ts
45
+ const WS_GATEWAY_METADATA = "vela:ws-gateway";
46
+ const WS_SUBSCRIBE_METADATA = "vela:ws-subscribe";
47
+ const WS_RESERVED_METADATA = "vela:ws-reserved";
48
+ /**
49
+ * Event names starting with this prefix are RESERVED for framework modules
50
+ * (`$live`, …): app gateways may not subscribe to them, and inbound frames
51
+ * carrying them route to `@ReservedWsEvent` handlers instead of gateways.
52
+ */
53
+ const RESERVED_WS_EVENT_PREFIX = "$";
54
+ const WsParamType = {
55
+ SOCKET: "ws_socket",
56
+ BODY: "ws_body",
57
+ SERVER: "ws_server"
58
+ };
59
+ /**
60
+ * The connected gateway server handle. Injected into gateways/controllers via
61
+ * `@WebSocketServer()` (constructor injection only — the container has no
62
+ * property-injection pass) or `@Inject(WS_SERVER)`.
63
+ */
64
+ const WS_SERVER = new InjectionToken("WS_SERVER");
65
+ /** The active cross-instance sync driver (`local()` by default). */
66
+ const WS_SYNC_DRIVER = new InjectionToken("WS_SYNC_DRIVER");
67
+ /** The local room-membership registry a transport reads/writes. */
68
+ const WS_ROOM_REGISTRY = new InjectionToken("WS_ROOM_REGISTRY");
69
+ const WS_MODULE_OPTIONS = new InjectionToken("WS_MODULE_OPTIONS");
70
+ //#endregion
71
+ //#region src/websocket/websocket.decorators.ts
72
+ /**
73
+ * Marks a class as a WebSocket gateway. Mirrors `@Controller` for the socket
74
+ * transport: registers the class as an injectable singleton and stores its
75
+ * routing options (`path`, Cloudflare `binding`).
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * @WebSocketGateway({ path: '/rooms/:id/ws', binding: 'CHAT_ROOM' })
80
+ * class ChatGateway {}
81
+ * ```
82
+ */
83
+ function WebSocketGateway(options = {}) {
84
+ return (target) => {
85
+ const ctor = target;
86
+ MetadataRegistry.setCustomClassMeta(ctor, WS_GATEWAY_METADATA, options);
87
+ MetadataRegistry.markInjectable(ctor);
88
+ MetadataRegistry.setScope(ctor, Scope.SINGLETON);
89
+ };
90
+ }
91
+ /**
92
+ * Binds a gateway method to an inbound event. Stackable — one class-level list,
93
+ * exactly like `@OnEvent` (`event-emitter.decorators.ts`).
94
+ */
95
+ function SubscribeMessage(event) {
96
+ return (target, propertyKey) => {
97
+ MetadataRegistry.appendCustomClassMeta(target.constructor, WS_SUBSCRIBE_METADATA, {
98
+ event,
99
+ methodName: String(propertyKey)
100
+ });
101
+ };
102
+ }
103
+ const ReservedWsEventMeta = createDiscoverableDecorator(WS_RESERVED_METADATA);
104
+ /**
105
+ * Claims a reserved (`$`-prefixed) envelope event for a framework-module
106
+ * provider (see `ReservedWsEventHandler`). Reserved frames route to the
107
+ * decorated provider across every gateway path — gateways themselves may not
108
+ * subscribe to `$…` events. Stack with `@Injectable()` like `@Processor`.
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * @ReservedWsEvent('$live')
113
+ * @Injectable()
114
+ * class LiveEngine implements ReservedWsEventHandler { … }
115
+ * ```
116
+ */
117
+ function ReservedWsEvent(event) {
118
+ if (!event.startsWith("$")) throw new Error(`@ReservedWsEvent('${event}') must claim a '\$'-prefixed event — unprefixed events belong to app gateways (@SubscribeMessage).`);
119
+ return ReservedWsEventMeta({ event });
120
+ }
121
+ function wsParamDecorator(type) {
122
+ return () => (target, propertyKey, parameterIndex) => {
123
+ if (propertyKey === void 0) throw new Error("WebSocket parameter decorators can only be used on method parameters");
124
+ MetadataRegistry.addParameter(target.constructor, propertyKey, {
125
+ index: parameterIndex,
126
+ type
127
+ });
128
+ };
129
+ }
130
+ /** Injects the inbound message payload (the envelope's `data`) into a handler parameter. */
131
+ const MessageBody = wsParamDecorator(WsParamType.BODY);
132
+ /** Injects the connected socket (`WsClient`) into a handler parameter. */
133
+ const ConnectedSocket = wsParamDecorator(WsParamType.SOCKET);
134
+ /**
135
+ * Injects the gateway server handle (`WsServer`). Constructor injection only —
136
+ * the container has no property-injection pass, so this is sugar for
137
+ * `@Inject(WS_SERVER)` on a constructor parameter.
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * constructor(@WebSocketServer() private server: WsServer) {}
142
+ * ```
143
+ */
144
+ function WebSocketServer() {
145
+ return Inject(WS_SERVER);
146
+ }
147
+ //#endregion
148
+ //#region src/websocket/ws-argument-resolver.ts
149
+ /**
150
+ * Builds handler arguments for a gateway message. WS sibling of the HTTP
151
+ * `ArgumentResolver`, but sourced from the envelope (`data`) and the socket
152
+ * (`client`) instead of the Hono `Context`.
153
+ *
154
+ * With no parameter decorators the handler receives `(client, data)` — the
155
+ * NestJS gateway convention. Pipes run only over `@MessageBody()` values, where
156
+ * validation/transformation is meaningful.
157
+ */
158
+ async function resolveWsArgs(paramMeta, client, data, pipes, paramTypes) {
159
+ if (paramMeta.length === 0) return [client, data];
160
+ const maxIndex = paramMeta[paramMeta.length - 1].index;
161
+ const args = new Array(maxIndex + 1).fill(void 0);
162
+ for (const param of paramMeta) {
163
+ if (param.type === WsParamType.SOCKET) {
164
+ args[param.index] = client;
165
+ continue;
166
+ }
167
+ if (param.type === WsParamType.BODY) {
168
+ let value = data;
169
+ const metadata = {
170
+ type: param.type,
171
+ data: param.name,
172
+ metatype: paramTypes?.[param.index]
173
+ };
174
+ for (const pipe of pipes) value = await pipe.transform(value, metadata);
175
+ args[param.index] = value;
176
+ continue;
177
+ }
178
+ args[param.index] = void 0;
179
+ }
180
+ return args;
181
+ }
182
+ //#endregion
183
+ //#region src/websocket/ws-execution-context.ts
184
+ const HTTP_ON_WS = (accessor) => () => {
185
+ throw new Error(`${accessor} called on a WebSocket ExecutionContext. This handler runs over a gateway message, not HTTP — use switchToWs().`);
186
+ };
187
+ /**
188
+ * WebSocket sibling of `buildExecutionContext` (`http/execution-context.ts`).
189
+ * Guards/pipes/interceptors/filters that read `getClass()`/`getHandler()` or
190
+ * call `switchToWs()` reuse unchanged; the HTTP-only accessors throw rather
191
+ * than fabricate a fake `Request`.
192
+ */
193
+ function buildWsExecutionContext(client, data, controller, handlerName, pattern) {
194
+ const host = {
195
+ getClient: () => client,
196
+ getData: () => data,
197
+ getPattern: () => pattern
198
+ };
199
+ return {
200
+ getType: () => "ws",
201
+ getClass: () => controller,
202
+ getHandler: () => handlerName,
203
+ getContext: HTTP_ON_WS("getContext()"),
204
+ getRequest: HTTP_ON_WS("getRequest()"),
205
+ switchToHttp: HTTP_ON_WS("switchToHttp()"),
206
+ switchToWs: () => host
207
+ };
208
+ }
209
+ //#endregion
210
+ //#region src/websocket/ws-exception.ts
211
+ /**
212
+ * WebSocket analogue of `HttpException`. Thrown from guards/pipes/handlers to
213
+ * signal a client-facing error; the dispatcher serializes it to an
214
+ * `{ event: 'exception', data }` frame unless a matching exception filter
215
+ * handles it first.
216
+ */
217
+ var WsException = class extends Error {
218
+ err;
219
+ constructor(err) {
220
+ super(typeof err === "string" ? err : String(err.message ?? "WsException"));
221
+ this.err = err;
222
+ this.name = "WsException";
223
+ }
224
+ getError() {
225
+ return this.err;
226
+ }
227
+ };
228
+ /**
229
+ * Default serialization of an uncaught error into the outbound exception frame.
230
+ *
231
+ * A `WsException` ships its own payload verbatim (string → `{ message }`,
232
+ * object → as-is). Every other error routes through `toErrorBody` — the single
233
+ * wire-redaction seam shared with the HTTP edge — so unbranded/internal errors
234
+ * are redacted to their catalog title and only branded `VelaError`s echo a
235
+ * client-safe `{ code, message, ... }`.
236
+ */
237
+ function toErrorFrame(error, catalog) {
238
+ if (error instanceof WsException) {
239
+ const e = error.getError();
240
+ return {
241
+ event: "exception",
242
+ data: typeof e === "string" ? { message: e } : e
243
+ };
244
+ }
245
+ const { body } = toErrorBody(error, { catalog });
246
+ return {
247
+ event: "exception",
248
+ data: body.error
249
+ };
250
+ }
251
+ //#endregion
252
+ //#region src/websocket/ws-dispatcher.ts
253
+ function hasAfterInit(x) {
254
+ return typeof x?.afterInit === "function";
255
+ }
256
+ function hasHandleConnection(x) {
257
+ return typeof x?.handleConnection === "function";
258
+ }
259
+ function hasHandleDisconnect(x) {
260
+ return typeof x?.handleDisconnect === "function";
261
+ }
262
+ function isWsResponse(x) {
263
+ return typeof x === "object" && x !== null && typeof x.event === "string";
264
+ }
265
+ let WsDispatcher = class WsDispatcher {
266
+ container;
267
+ discovery;
268
+ server;
269
+ routeManager;
270
+ gateways = /* @__PURE__ */ new Map();
271
+ reserved = /* @__PURE__ */ new Map();
272
+ constructor(container, discovery, server, routeManager) {
273
+ this.container = container;
274
+ this.discovery = discovery;
275
+ this.server = server;
276
+ this.routeManager = routeManager;
277
+ }
278
+ /** Paths of every discovered `@WebSocketGateway` — used by transports to register routes. */
279
+ get gatewayPaths() {
280
+ return [...this.gateways.keys()];
281
+ }
282
+ async onApplicationBootstrap() {
283
+ for (const found of this.discovery.providersWithMeta(WS_RESERVED_METADATA)) {
284
+ if (!found.instance) continue;
285
+ const event = found.meta.event;
286
+ if (this.reserved.has(event)) {
287
+ const msg = `[vela] duplicate @ReservedWsEvent('${event}') (${found.metatype.name}); keeping the first.`;
288
+ if (this.container.getDiagnostics() === "throw") throw new Error(msg);
289
+ console.warn(msg);
290
+ continue;
291
+ }
292
+ this.reserved.set(event, found.instance);
293
+ }
294
+ for (const found of this.discovery.providersWithMeta(WS_GATEWAY_METADATA)) {
295
+ if (!found.instance) continue;
296
+ const gatewayClass = found.metatype;
297
+ const instance = found.instance;
298
+ const entry = this.buildGatewayEntry(gatewayClass, found.meta, instance);
299
+ if (this.gateways.has(entry.path)) {
300
+ const msg = `[vela] duplicate @WebSocketGateway path '${entry.path}' (${gatewayClass.name}); keeping the first. Give each gateway a distinct path.`;
301
+ if (this.container.getDiagnostics() === "throw") throw new Error(msg);
302
+ console.warn(msg);
303
+ continue;
304
+ }
305
+ this.gateways.set(entry.path, entry);
306
+ if (this.server && hasAfterInit(instance)) try {
307
+ await instance.afterInit(this.server);
308
+ } catch (err) {
309
+ this.reportBootstrapError(gatewayClass.name, err);
310
+ }
311
+ }
312
+ }
313
+ /** One `'websocket'` entrypoint per discovered gateway (authoritative). */
314
+ collectEntrypoints() {
315
+ return [...this.gateways.values()].map((entry) => ({
316
+ kind: "websocket",
317
+ token: entry.gatewayClass,
318
+ instance: entry.instance,
319
+ meta: {
320
+ path: entry.path,
321
+ dispatcher: this
322
+ }
323
+ }));
324
+ }
325
+ async handleOpen(path, client) {
326
+ const entry = this.gateways.get(path);
327
+ if (entry && hasHandleConnection(entry.instance)) await entry.instance.handleConnection(client);
328
+ }
329
+ async handleClose(path, client, _code, _reason) {
330
+ for (const handler of this.reserved.values()) try {
331
+ await handler.handleSocketClose?.(path, client);
332
+ } catch (err) {
333
+ await this.handleError(path, client, err);
334
+ }
335
+ const entry = this.gateways.get(path);
336
+ if (entry && hasHandleDisconnect(entry.instance)) await entry.instance.handleDisconnect(client);
337
+ }
338
+ async handleError(path, _client, err) {
339
+ resolveErrorReporter(this.container).report(err, {
340
+ edge: "ws",
341
+ source: path ? `reserved-frame ${path}` : "reserved-frame"
342
+ });
343
+ }
344
+ async dispatchMessage(path, client, raw) {
345
+ const entry = this.gateways.get(path);
346
+ if (!entry) return;
347
+ let message;
348
+ try {
349
+ message = this.parse(raw);
350
+ } catch {
351
+ this.trySend(client, "exception", { message: "Invalid message" });
352
+ return;
353
+ }
354
+ if (message.event.startsWith("$")) {
355
+ await this.dispatchReserved(path, client, message);
356
+ return;
357
+ }
358
+ const handler = entry.handlers.get(message.event);
359
+ if (!handler) return;
360
+ const ctx = buildWsExecutionContext(client, message.data, entry.gatewayClass, handler.methodName, message.event);
361
+ const globals = this.routeManager?.getGlobalComponents();
362
+ const guards = [...instantiateMany(globals?.guards ?? [], this.container), ...instantiateMany(handler.guards, this.container)];
363
+ const pipes = [...instantiateMany(globals?.pipes ?? [], this.container), ...instantiateMany(handler.pipes, this.container)];
364
+ const interceptors = [...instantiateMany(globals?.interceptors ?? [], this.container), ...instantiateMany(handler.interceptors, this.container)];
365
+ const filters = [...instantiateMany(handler.filters, this.container), ...instantiateMany(globals?.filters ?? [], this.container)];
366
+ try {
367
+ const method = entry.instance[handler.methodName];
368
+ const result = await PipelineRunner.run({
369
+ context: ctx,
370
+ guards,
371
+ interceptors,
372
+ resolveArgs: () => resolveWsArgs(handler.paramMeta, client, message.data, pipes, handler.paramTypes),
373
+ invoke: async (args) => method.apply(entry.instance, args),
374
+ onGuardReject: () => new WsException("Forbidden")
375
+ });
376
+ this.reply(client, message, result);
377
+ } catch (error) {
378
+ const reporter = resolveErrorReporter(this.container);
379
+ const source = `${entry.gatewayClass.name}.${handler.methodName}`;
380
+ reporter.report(error, {
381
+ edge: "ws",
382
+ source
383
+ });
384
+ await this.runFilters(client, message, error, filters, ctx, reporter, source);
385
+ }
386
+ }
387
+ /**
388
+ * Route a reserved (`$…`) frame to its claiming handler. App-wide (`APP_*` /
389
+ * `useGlobalGuards`) guards protect reserved frames exactly like gateway
390
+ * messages — guards-first, WS convention; handler/class-tier components are
391
+ * the claiming module's own concern (e.g. live resolvers run their scoped
392
+ * guards at subscribe).
393
+ */
394
+ async dispatchReserved(path, client, message) {
395
+ const handler = this.reserved.get(message.event);
396
+ if (!handler) return;
397
+ const ctx = buildWsExecutionContext(client, message.data, handler.constructor, "handleReservedEvent", message.event);
398
+ const globals = this.routeManager?.getGlobalComponents();
399
+ const guards = instantiateMany(globals?.guards ?? [], this.container);
400
+ try {
401
+ for (const guard of guards) if (!await guard.canActivate(ctx)) {
402
+ const frame = toErrorFrame(new WsException("Forbidden"), resolveErrorReporter(this.container).catalog);
403
+ this.trySend(client, frame.event, frame.data, message.id);
404
+ return;
405
+ }
406
+ await handler.handleReservedEvent(path, client, message);
407
+ } catch (err) {
408
+ await this.handleError(path, client, err);
409
+ }
410
+ }
411
+ reply(client, message, result) {
412
+ if (result === void 0 || result === null) return;
413
+ if (isWsResponse(result)) this.trySend(client, result.event, result.data, message.id);
414
+ else this.trySend(client, message.event, result, message.id);
415
+ }
416
+ async runFilters(client, message, error, filters, ctx, reporter, source) {
417
+ for (const filter of filters) if (shouldFilterCatch(filter, error)) {
418
+ try {
419
+ const handled = await filter.catch(error, ctx);
420
+ if (isWsResponse(handled)) this.trySend(client, handled.event, handled.data, message.id);
421
+ } catch (filterError) {
422
+ reporter.report(filterError, {
423
+ edge: "ws",
424
+ source,
425
+ note: "exception filter threw"
426
+ });
427
+ const frame = toErrorFrame(error, reporter.catalog);
428
+ this.trySend(client, frame.event, frame.data, message.id);
429
+ }
430
+ return;
431
+ }
432
+ const errorFrame = toErrorFrame(error, reporter.catalog);
433
+ this.trySend(client, errorFrame.event, errorFrame.data, message.id);
434
+ }
435
+ trySend(client, event, data, id) {
436
+ try {
437
+ client.send(event, data, id);
438
+ } catch {}
439
+ }
440
+ reportBootstrapError(name, err) {
441
+ const mode = this.container.getDiagnostics();
442
+ if (mode === "throw") throw err;
443
+ if (mode === "log") console.warn(`[vela] websocket gateway ${name} afterInit failed:`, err);
444
+ }
445
+ parse(raw) {
446
+ const text = typeof raw === "string" ? raw : new TextDecoder().decode(raw);
447
+ const parsed = JSON.parse(text);
448
+ if (!parsed || typeof parsed !== "object" || typeof parsed.event !== "string") throw new Error("Invalid WebSocket message envelope");
449
+ return parsed;
450
+ }
451
+ buildGatewayEntry(gatewayClass, options, instance) {
452
+ const ctor = gatewayClass;
453
+ const subs = MetadataRegistry.getCustomClassMeta(ctor, "vela:ws-subscribe") ?? [];
454
+ const allParams = MetadataRegistry.getParameters(ctor);
455
+ const handlers = /* @__PURE__ */ new Map();
456
+ for (const { event, methodName } of subs) {
457
+ if (event.startsWith("$")) {
458
+ const msg = `[vela] @SubscribeMessage('${event}') on ${gatewayClass.name}: the '\$' event prefix is reserved for framework modules — skipped.`;
459
+ if (this.container.getDiagnostics() === "throw") throw new Error(msg);
460
+ console.warn(msg);
461
+ continue;
462
+ }
463
+ const paramMeta = [...allParams.get(methodName) ?? []].sort((a, b) => a.index - b.index);
464
+ const paramTypes = Reflect.getMetadata("design:paramtypes", gatewayClass.prototype, methodName);
465
+ handlers.set(event, {
466
+ methodName,
467
+ paramMeta,
468
+ paramTypes,
469
+ guards: ComponentManager.getScopedComponents("guard", ctor, methodName),
470
+ pipes: ComponentManager.getScopedComponents("pipe", ctor, methodName),
471
+ interceptors: ComponentManager.getScopedComponents("interceptor", ctor, methodName),
472
+ filters: [...ComponentManager.getScopedComponents("filter", ctor, methodName)].reverse()
473
+ });
474
+ }
475
+ return {
476
+ path: options.path ?? "",
477
+ instance,
478
+ gatewayClass,
479
+ handlers
480
+ };
481
+ }
482
+ };
483
+ WsDispatcher = __decorate([
484
+ Injectable(),
485
+ __decorateParam(0, Inject(Container)),
486
+ __decorateParam(1, Inject(DiscoveryService)),
487
+ __decorateParam(2, Optional()),
488
+ __decorateParam(2, Inject(WS_SERVER)),
489
+ __decorateParam(3, Optional()),
490
+ __decorateParam(3, Inject(RouteManager)),
491
+ __decorateMetadata("design:paramtypes", [
492
+ typeof Container === "undefined" ? Object : Container,
493
+ typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
494
+ Object,
495
+ typeof RouteManager === "undefined" ? Object : RouteManager
496
+ ])
497
+ ], WsDispatcher);
498
+ //#endregion
499
+ //#region src/websocket/ws-server.ts
500
+ /**
501
+ * Accumulates `{ rooms, exceptRooms, exceptIds }` across a fluent chain and, on
502
+ * `.emit()`, produces a serializable `BroadcastCommand` handed to the active
503
+ * `SyncDriver`. The driver decides local-vs-remote delivery.
504
+ */
505
+ var BroadcastOperatorImpl = class {
506
+ driver;
507
+ rooms;
508
+ exceptRooms;
509
+ exceptIds;
510
+ constructor(driver, rooms = /* @__PURE__ */ new Set(), exceptRooms = /* @__PURE__ */ new Set(), exceptIds = /* @__PURE__ */ new Set()) {
511
+ this.driver = driver;
512
+ this.rooms = rooms;
513
+ this.exceptRooms = exceptRooms;
514
+ this.exceptIds = exceptIds;
515
+ }
516
+ to(room) {
517
+ this.rooms.add(room);
518
+ return this;
519
+ }
520
+ in(room) {
521
+ return this.to(room);
522
+ }
523
+ except(room) {
524
+ this.exceptRooms.add(room);
525
+ return this;
526
+ }
527
+ emit(event, data) {
528
+ const cmd = {
529
+ rooms: [...this.rooms],
530
+ exceptRooms: this.exceptRooms.size ? [...this.exceptRooms] : void 0,
531
+ exceptIds: this.exceptIds.size ? [...this.exceptIds] : void 0,
532
+ frame: JSON.stringify({
533
+ event,
534
+ data
535
+ })
536
+ };
537
+ return this.driver.dispatch(cmd);
538
+ }
539
+ };
540
+ /**
541
+ * The `@WebSocketServer()`-injected handle. Server-origin broadcasts never
542
+ * pre-exclude anyone (a client-origin `client.to()` seeds `exceptIds` with the
543
+ * sender — that lives in the transport's client, not here).
544
+ */
545
+ var WsServerImpl = class {
546
+ driver;
547
+ constructor(driver) {
548
+ this.driver = driver;
549
+ }
550
+ emit(event, data) {
551
+ return this.driver.dispatch({
552
+ rooms: [],
553
+ frame: JSON.stringify({
554
+ event,
555
+ data
556
+ })
557
+ });
558
+ }
559
+ to(room) {
560
+ return new BroadcastOperatorImpl(this.driver).to(room);
561
+ }
562
+ in(room) {
563
+ return this.to(room);
564
+ }
565
+ except(room) {
566
+ return new BroadcastOperatorImpl(this.driver).except(room);
567
+ }
568
+ };
569
+ //#endregion
570
+ //#region src/websocket/ws-sync.ts
571
+ /** Single-instance default: deliver straight to the local registry, no cross-node hop. */
572
+ function local() {
573
+ let registry;
574
+ return {
575
+ kind: "local",
576
+ bind(r) {
577
+ registry = r;
578
+ },
579
+ dispatch(cmd) {
580
+ return registry?.deliverLocal(cmd);
581
+ }
582
+ };
583
+ }
584
+ /** In-memory `RoomRegistry` for node/bun/deno and tests. Edge-safe (plain Maps). */
585
+ var InMemoryRoomRegistry = class {
586
+ rooms = /* @__PURE__ */ new Map();
587
+ clientRooms = /* @__PURE__ */ new Map();
588
+ clients = /* @__PURE__ */ new Map();
589
+ register(client) {
590
+ this.clients.set(client.id, client);
591
+ }
592
+ join(client, room) {
593
+ this.register(client);
594
+ let members = this.rooms.get(room);
595
+ if (!members) {
596
+ members = /* @__PURE__ */ new Set();
597
+ this.rooms.set(room, members);
598
+ }
599
+ members.add(client);
600
+ let joined = this.clientRooms.get(client.id);
601
+ if (!joined) {
602
+ joined = /* @__PURE__ */ new Set();
603
+ this.clientRooms.set(client.id, joined);
604
+ }
605
+ joined.add(room);
606
+ }
607
+ leave(client, room) {
608
+ const members = this.rooms.get(room);
609
+ members?.delete(client);
610
+ if (members && members.size === 0) this.rooms.delete(room);
611
+ this.clientRooms.get(client.id)?.delete(room);
612
+ }
613
+ leaveAll(client) {
614
+ for (const room of this.clientRooms.get(client.id) ?? []) {
615
+ const members = this.rooms.get(room);
616
+ members?.delete(client);
617
+ if (members && members.size === 0) this.rooms.delete(room);
618
+ }
619
+ this.clientRooms.delete(client.id);
620
+ this.clients.delete(client.id);
621
+ }
622
+ localIdsInRoom(room) {
623
+ return [...this.rooms.get(room) ?? []].map((c) => c.id);
624
+ }
625
+ deliverLocal(cmd) {
626
+ const excludeIds = new Set(cmd.exceptIds ?? []);
627
+ const excludeRooms = cmd.exceptRooms ?? [];
628
+ const candidates = cmd.rooms.length === 0 ? new Set(this.clients.values()) : (() => {
629
+ const set = /* @__PURE__ */ new Set();
630
+ for (const room of cmd.rooms) for (const client of this.rooms.get(room) ?? []) set.add(client);
631
+ return set;
632
+ })();
633
+ for (const client of candidates) {
634
+ if (excludeIds.has(client.id)) continue;
635
+ const joined = this.clientRooms.get(client.id);
636
+ if (excludeRooms.some((room) => joined?.has(room))) continue;
637
+ client.sendRaw(cmd.frame);
638
+ }
639
+ }
640
+ };
641
+ //#endregion
642
+ //#region src/websocket/websocket.module.ts
643
+ /**
644
+ * Registers the WebSocket gateway machinery: the message dispatcher (discovers
645
+ * `@WebSocketGateway` classes via DiscoveryService at bootstrap), the room
646
+ * registry, the sync driver, and the `@WebSocketServer()`-injected server
647
+ * handle.
648
+ *
649
+ * Construction lives in chained provider factories — registry → driver
650
+ * (bound to THAT registry) → server — so the single shared registry instance
651
+ * is preserved and everything materializes at bootstrap's eager
652
+ * instantiation, before any lifecycle hook or message dispatch.
653
+ *
654
+ * The instance key derives from the sync driver kind: two `forRoot()` calls
655
+ * with the same driver kind dedup (HMR-idempotent); pass an explicit `key`
656
+ * to run multiple same-kind instances side by side.
657
+ */
658
+ const { ConfigurableModuleClass } = defineModule({
659
+ name: "WebSocket",
660
+ optionsToken: WS_MODULE_OPTIONS,
661
+ key: (options) => `ws#${options.sync?.kind ?? "local"}`,
662
+ setup: ({ OPTIONS }) => ({
663
+ providers: [
664
+ {
665
+ provide: WS_ROOM_REGISTRY,
666
+ useFactory: (o) => o.registry ?? new InMemoryRoomRegistry(),
667
+ inject: [OPTIONS]
668
+ },
669
+ {
670
+ provide: WS_SYNC_DRIVER,
671
+ useFactory: (o, registry) => {
672
+ const driver = o.sync ?? local();
673
+ driver.bind(registry);
674
+ return driver;
675
+ },
676
+ inject: [OPTIONS, WS_ROOM_REGISTRY]
677
+ },
678
+ {
679
+ provide: WS_SERVER,
680
+ useFactory: (driver) => new WsServerImpl(driver),
681
+ inject: [WS_SYNC_DRIVER]
682
+ },
683
+ WsDispatcher
684
+ ],
685
+ exports: [
686
+ WS_SERVER,
687
+ WS_SYNC_DRIVER,
688
+ WS_ROOM_REGISTRY,
689
+ WsDispatcher
690
+ ]
691
+ })
692
+ });
693
+ var WebSocketModule = class extends ConfigurableModuleClass {};
694
+ //#endregion
695
+ export { WS_SUBSCRIBE_METADATA as C, createDiscoverableDecorator as E, WS_SERVER as S, WsParamType as T, RESERVED_WS_EVENT_PREFIX as _, WsServerImpl as a, WS_RESERVED_METADATA as b, toErrorFrame as c, ConnectedSocket as d, MessageBody as f, WebSocketServer as g, WebSocketGateway as h, BroadcastOperatorImpl as i, buildWsExecutionContext as l, SubscribeMessage as m, InMemoryRoomRegistry as n, WsDispatcher as o, ReservedWsEvent as p, local as r, WsException as s, WebSocketModule as t, resolveWsArgs as u, WS_GATEWAY_METADATA as v, WS_SYNC_DRIVER as w, WS_ROOM_REGISTRY as x, WS_MODULE_OPTIONS as y };
696
+
697
+ //# sourceMappingURL=websocket-DXmB-MWJ.js.map