@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
@@ -1,87 +0,0 @@
1
- import { defineModule } from "../index.js";
2
- import { InMemoryCursorLog } from "./live.cursor.js";
3
- import { LiveEngine } from "./live.engine.js";
4
- import { LiveInvalidation, localLive, perAppLiveDriver } from "./live.invalidation.js";
5
- import { LIVE_CURSOR_LOG, LIVE_DRIVER, LIVE_MODULE_OPTIONS } from "./live.tokens.js";
6
- import { PresenceResolver, PresenceService } from "./presence.js";
7
- /**
8
- * First-party live-query module (tag-based realtime reactivity) — authored,
9
- * like the queue module, entirely on vela's public API (`live-openness.test.ts`
10
- * machine-verifies it; the only extra dependency is the shared wire package
11
- * `@velajs/live-protocol`).
12
- *
13
- * ```ts
14
- * imports: [WebSocketModule.forRoot({}), LiveModule.forRoot({})]
15
- * ```
16
- *
17
- * App code declares `@LiveResolver` classes with `@LiveQuery(name, { tags })`
18
- * methods; clients subscribe over the `$live` reserved WebSocket event; writes
19
- * invalidate tags via `LiveInvalidation` (the `@velajs/crud` bridge does it
20
- * automatically per table). See `LIVE.md` for the wire protocol, delivery
21
- * guarantees, and the resume story.
22
- *
23
- * Deliberately EAGER (like WebSocketModule): the engine self-drives — it
24
- * claims the `$live` event at bootstrap and receives invalidations from
25
- * writes that never touch a live token — so the lazy-module contract
26
- * ("nothing self-drives") rules laziness out.
27
- */ const { ConfigurableModuleClass } = defineModule({
28
- name: 'Live',
29
- optionsToken: LIVE_MODULE_OPTIONS,
30
- key: (options)=>`live#${options?.driver?.kind ?? 'local'}`,
31
- setup: ({ OPTIONS, options })=>({
32
- providers: [
33
- {
34
- provide: LIVE_CURSOR_LOG,
35
- useFactory: (o)=>o.log ?? new InMemoryCursorLog(),
36
- inject: [
37
- OPTIONS
38
- ]
39
- },
40
- {
41
- provide: LIVE_DRIVER,
42
- // Wrapped per app: user-supplied drivers are shared config objects
43
- // (the same module bootstraps in the Worker AND in each Durable
44
- // Object), so per-app sink/mode state lives in the wrapper — see
45
- // perAppLiveDriver.
46
- useFactory: (o)=>perAppLiveDriver(o.driver ?? localLive()),
47
- inject: [
48
- OPTIONS
49
- ]
50
- },
51
- {
52
- provide: PresenceService,
53
- useFactory: (o)=>{
54
- const presence = o.presence;
55
- if (presence === false) return new PresenceService(undefined, false);
56
- return new PresenceService(presence?.ttlMs, true);
57
- },
58
- inject: [
59
- OPTIONS
60
- ]
61
- },
62
- {
63
- provide: LiveInvalidation,
64
- useFactory: (driver)=>new LiveInvalidation(driver),
65
- inject: [
66
- LIVE_DRIVER
67
- ]
68
- },
69
- LiveEngine,
70
- // The built-in `$presence.roster` resolver. Skipping it is STRUCTURAL
71
- // (`presence: false` must be visible at forRoot/forRootAsync call time,
72
- // like queue's `queues`); a disabled-at-runtime service still no-ops.
73
- ...options?.presence === false ? [] : [
74
- PresenceResolver
75
- ]
76
- ],
77
- exports: [
78
- LiveEngine,
79
- LiveInvalidation,
80
- LIVE_DRIVER,
81
- LIVE_CURSOR_LOG,
82
- PresenceService
83
- ]
84
- })
85
- });
86
- export class LiveModule extends ConfigurableModuleClass {
87
- }
@@ -1,9 +0,0 @@
1
- import { InjectionToken } from '../index';
2
- import type { CursorLog, LiveDriver, LiveModuleOptions } from './live.types';
3
- export declare const LIVE_RESOLVER_METADATA = "vela:live:resolver";
4
- export declare const LIVE_QUERY_METADATA = "vela:live:query";
5
- /** The invalidation driver in effect for a `LiveModule` instance (`localLive()` by default). */
6
- export declare const LIVE_DRIVER: InjectionToken<LiveDriver>;
7
- /** The ordered tag-invalidation log backing cursors/epochs for this log scope. */
8
- export declare const LIVE_CURSOR_LOG: InjectionToken<CursorLog>;
9
- export declare const LIVE_MODULE_OPTIONS: InjectionToken<LiveModuleOptions>;
@@ -1,8 +0,0 @@
1
- import { InjectionToken } from "../index.js";
2
- // Free-form metadata keys — same string-token convention as the queue module.
3
- export const LIVE_RESOLVER_METADATA = 'vela:live:resolver';
4
- export const LIVE_QUERY_METADATA = 'vela:live:query';
5
- /** The invalidation driver in effect for a `LiveModule` instance (`localLive()` by default). */ export const LIVE_DRIVER = new InjectionToken('vela:live:driver');
6
- /** The ordered tag-invalidation log backing cursors/epochs for this log scope. */ export const LIVE_CURSOR_LOG = new InjectionToken('vela:live:cursor-log');
7
- // forRoot() options carrier.
8
- export const LIVE_MODULE_OPTIONS = new InjectionToken('LIVE_MODULE_OPTIONS');
@@ -1,138 +0,0 @@
1
- import type { WsClient } from '../index';
2
- /**
3
- * Identity captured at subscribe time and replayed into every re-run of the
4
- * subscription's query — never re-read from the client afterwards. Free-form;
5
- * `expiresAt` (epoch ms) is the one recognized field: a lapsed identity drops
6
- * the socket before it receives another scoped push (outbound enforcement —
7
- * a passive subscriber never trips inbound checks).
8
- */
9
- export interface LiveIdentity {
10
- [key: string]: unknown;
11
- expiresAt?: number;
12
- }
13
- /** Second positional argument every `@LiveQuery` handler receives. */
14
- export interface LiveQueryContext {
15
- identity?: LiveIdentity;
16
- /** The subscribed connection's id. */
17
- clientId: string;
18
- /** Rooms the connection was in when it subscribed. */
19
- rooms: string[];
20
- }
21
- export interface LiveQueryOptions<A = unknown> {
22
- /**
23
- * Dependency tags this query's result is built from — the invalidation
24
- * contract. Static for the common case; the function form derives
25
- * per-entity tags from the (parsed) subscribe args. Writes invalidate tags
26
- * via `LiveInvalidation.invalidate()` (the CRUD bridge does it
27
- * automatically with `crud:<table>` tags).
28
- */
29
- tags: string[] | ((args: A) => string[]);
30
- /** Key field for incremental list deltas (default `'id'`). */
31
- key?: string;
32
- /**
33
- * Args validator, run ONCE at subscribe (a zod schema's `.parse` slots in
34
- * directly). A throw rejects the subscription with a `bad_args` error frame.
35
- */
36
- parse?: (args: unknown) => A;
37
- }
38
- /** One `@LiveQuery` declaration on a `@LiveResolver` class. */
39
- export interface LiveQueryMetadata {
40
- name: string;
41
- methodName: string | symbol;
42
- options: LiveQueryOptions;
43
- }
44
- /** Class-level marker meta written by `@LiveResolver()`. */
45
- export interface LiveResolverMetadata {
46
- }
47
- /** A position in this log scope's ordered invalidation log. */
48
- export interface CommitStamp {
49
- cursor: number;
50
- epoch: string;
51
- }
52
- /**
53
- * Resume verdict for a reconnecting subscription:
54
- * - `'resume'` — nothing the subscription depends on changed while away; keep
55
- * the client's cached value and just advance its cursor.
56
- * - `'rerun'` — a relevant tag was invalidated in the gap; re-run and snapshot.
57
- * - `'snapshot'` — the gap cannot be reasoned about (epoch fork, trimmed log,
58
- * rollback); re-run and snapshot.
59
- */
60
- export type ResumeVerdict = 'resume' | 'rerun' | 'snapshot';
61
- /**
62
- * The ordered tag-invalidation log for ONE log scope (this process on
63
- * node/bun/deno; one Durable Object on Cloudflare). Cursor = monotonic
64
- * sequence; epoch = timeline token rolled whenever monotonicity can no longer
65
- * be guaranteed (process restart, DO reset).
66
- */
67
- export interface CursorLog {
68
- append(tags: string[]): CommitStamp | Promise<CommitStamp>;
69
- current(): CommitStamp | Promise<CommitStamp>;
70
- evaluateResume(sinceCursor: number, sinceEpoch: string, subscriptionTags: string[]): ResumeVerdict | Promise<ResumeVerdict>;
71
- }
72
- /** A tag invalidation crossing the driver seam. `room` addresses the log scope holding the subscribers (advisory for local delivery). */
73
- export interface InvalidationCommand {
74
- room?: string;
75
- tags: string[];
76
- /** Origin instance id — lets pub/sub drivers drop their own echo. */
77
- origin?: string;
78
- }
79
- /** What a driver delivers invalidations INTO — the live engine of one log scope. */
80
- export interface LiveInvalidationSink {
81
- applyInvalidation(cmd: InvalidationCommand): CommitStamp | Promise<CommitStamp>;
82
- }
83
- /**
84
- * Cross-boundary invalidation transport — the live sibling of the WebSocket
85
- * `SyncDriver`, carrying TAGS (re-run instructions) instead of pre-serialized
86
- * frames. `localLive()` is the in-core single-scope default; platform packages
87
- * (`durableObjectLive()` in @velajs/cloudflare, `redisLive()` in
88
- * websocket-node) implement it out-of-core. `dispatch` returns the commit
89
- * stamp of the targeted log scope when the driver can observe it.
90
- */
91
- export interface LiveDriver {
92
- readonly kind: string;
93
- bind(sink: LiveInvalidationSink): void;
94
- dispatch(cmd: InvalidationCommand): CommitStamp | undefined | Promise<CommitStamp | undefined>;
95
- start?(): void | Promise<void>;
96
- stop?(): void | Promise<void>;
97
- }
98
- /** One live subscription as tracked by the engine (and persisted by transports that survive eviction). */
99
- export interface SubscriptionRecord {
100
- sub: string;
101
- query: string;
102
- args: unknown;
103
- /** Frozen at subscribe from the (parsed) args. */
104
- tags: string[];
105
- /** Delta key field (subscribe-frame override wins over the handler option). */
106
- key?: string;
107
- identity?: LiveIdentity;
108
- /**
109
- * The last result this subscription confirmed on the wire (the delta diff
110
- * baseline). `undefined` after a cursor-resume: the server never re-ran the
111
- * query, so the next relevant change sends a full snapshot.
112
- */
113
- lastJson?: string;
114
- lastCursor?: number;
115
- }
116
- export interface LivePresenceOptions {
117
- /** Roster entries older than this are filtered at read time (default 30_000 ms). */
118
- ttlMs?: number;
119
- }
120
- export interface LiveModuleOptions {
121
- /** Cross-boundary invalidation driver. Defaults to `localLive()`. */
122
- driver?: LiveDriver;
123
- /** Ordered invalidation log. Defaults to the in-memory per-process log. */
124
- log?: CursorLog;
125
- /**
126
- * Identity capture at subscribe. Default: a shallow copy of `client.data`
127
- * (whatever the app's upgrade/`handleConnection` auth stamped there), or
128
- * `undefined` when empty.
129
- */
130
- identity?: (client: WsClient) => LiveIdentity | undefined;
131
- /** Presence preset configuration; `false` disables the built-in resolver. */
132
- presence?: LivePresenceOptions | false;
133
- }
134
- /** Meta carried by the `'live'` entrypoint (transports reach the engine through it). */
135
- export interface LiveEntrypointMeta {
136
- /** The engine — typed loosely to avoid a circular type edge; cast to `LiveEngine`. */
137
- engine: unknown;
138
- }
@@ -1 +0,0 @@
1
- /** Meta carried by the `'live'` entrypoint (transports reach the engine through it). */ export { };
@@ -1,44 +0,0 @@
1
- /** The invalidation tag for one room's roster. `$`-prefixed: never collides with app tags. */
2
- export declare const presenceTag: (room: string) => string;
3
- /** The built-in roster query name (`useLiveQuery`-able like any app query). */
4
- export declare const PRESENCE_ROSTER_QUERY = "$presence.roster";
5
- /** One present connection as returned by the roster query. Keyed by `id` so list deltas apply. */
6
- export interface PresenceMember {
7
- /** The connection id that heartbeats this membership. */
8
- id: string;
9
- meta?: unknown;
10
- lastSeen: number;
11
- }
12
- /**
13
- * The presence preset's server half. Heartbeats arrive as `{ t: 'presence' }`
14
- * frames on the live socket (routed here by the engine); the roster is a
15
- * built-in live query invalidated per room. Departure is immediate: the WS
16
- * close hook reaps the member without waiting out the TTL. Staleness (an
17
- * ungraceful drop the transport never noticed) is filtered AT READ TIME —
18
- * no timers, per the edge rules (`setInterval` is forbidden).
19
- *
20
- * Scope note: the roster lives in this log scope (one process on node, one
21
- * room-DO on Cloudflare — where it is exactly the room's roster).
22
- */
23
- export declare class PresenceService {
24
- private readonly ttlMs;
25
- readonly enabled: boolean;
26
- private readonly rooms;
27
- private readonly roomsByClient;
28
- private invalidator?;
29
- constructor(ttlMs?: number, enabled?: boolean);
30
- /** Wired by the engine so beats/reaps invalidate through the live driver. */
31
- bindInvalidator(invalidator: (tags: string[]) => void): void;
32
- beat(room: string, clientId: string, meta?: unknown): void;
33
- /** Immediate departure on socket close — peers see it without a TTL wait. */
34
- reap(clientId: string): void;
35
- roster(room: string): PresenceMember[];
36
- }
37
- /** The built-in resolver backing `$presence.roster`. Registered by `LiveModule` unless presence is disabled. */
38
- export declare class PresenceResolver {
39
- private readonly presence;
40
- constructor(presence: PresenceService);
41
- roster(args: {
42
- room: string;
43
- }): PresenceMember[];
44
- }
@@ -1,130 +0,0 @@
1
- function _ts_decorate(decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- }
7
- function _ts_metadata(k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- }
10
- function _ts_param(paramIndex, decorator) {
11
- return function(target, key) {
12
- decorator(target, key, paramIndex);
13
- };
14
- }
15
- import { Inject, Injectable } from "../index.js";
16
- import { LiveQuery, LiveResolver } from "./live.decorators.js";
17
- /** The invalidation tag for one room's roster. `$`-prefixed: never collides with app tags. */ export const presenceTag = (room)=>`$presence:${room}`;
18
- /** The built-in roster query name (`useLiveQuery`-able like any app query). */ export const PRESENCE_ROSTER_QUERY = '$presence.roster';
19
- /**
20
- * The presence preset's server half. Heartbeats arrive as `{ t: 'presence' }`
21
- * frames on the live socket (routed here by the engine); the roster is a
22
- * built-in live query invalidated per room. Departure is immediate: the WS
23
- * close hook reaps the member without waiting out the TTL. Staleness (an
24
- * ungraceful drop the transport never noticed) is filtered AT READ TIME —
25
- * no timers, per the edge rules (`setInterval` is forbidden).
26
- *
27
- * Scope note: the roster lives in this log scope (one process on node, one
28
- * room-DO on Cloudflare — where it is exactly the room's roster).
29
- */ export class PresenceService {
30
- ttlMs;
31
- enabled;
32
- rooms = new Map();
33
- roomsByClient = new Map();
34
- invalidator;
35
- constructor(ttlMs = 30_000, enabled = true){
36
- this.ttlMs = ttlMs;
37
- this.enabled = enabled;
38
- }
39
- /** Wired by the engine so beats/reaps invalidate through the live driver. */ bindInvalidator(invalidator) {
40
- this.invalidator = invalidator;
41
- }
42
- beat(room, clientId, meta) {
43
- if (!this.enabled) return;
44
- let state = this.rooms.get(room);
45
- if (!state) {
46
- state = {
47
- members: new Map()
48
- };
49
- this.rooms.set(room, state);
50
- }
51
- state.members.set(clientId, {
52
- meta,
53
- lastSeen: Date.now()
54
- });
55
- let joined = this.roomsByClient.get(clientId);
56
- if (!joined) {
57
- joined = new Set();
58
- this.roomsByClient.set(clientId, joined);
59
- }
60
- joined.add(room);
61
- this.invalidator?.([
62
- presenceTag(room)
63
- ]);
64
- }
65
- /** Immediate departure on socket close — peers see it without a TTL wait. */ reap(clientId) {
66
- const joined = this.roomsByClient.get(clientId);
67
- if (!joined) return;
68
- this.roomsByClient.delete(clientId);
69
- for (const room of joined){
70
- const state = this.rooms.get(room);
71
- if (!state) continue;
72
- state.members.delete(clientId);
73
- if (state.members.size === 0) this.rooms.delete(room);
74
- this.invalidator?.([
75
- presenceTag(room)
76
- ]);
77
- }
78
- }
79
- roster(room) {
80
- const state = this.rooms.get(room);
81
- if (!state) return [];
82
- const oldestAlive = Date.now() - this.ttlMs;
83
- return [
84
- ...state.members.entries()
85
- ].filter(([, member])=>member.lastSeen >= oldestAlive).map(([id, member])=>({
86
- id,
87
- meta: member.meta,
88
- lastSeen: member.lastSeen
89
- }));
90
- }
91
- }
92
- export class PresenceResolver {
93
- presence;
94
- constructor(presence){
95
- this.presence = presence;
96
- }
97
- roster(args) {
98
- return this.presence.roster(args.room);
99
- }
100
- }
101
- _ts_decorate([
102
- LiveQuery(PRESENCE_ROSTER_QUERY, {
103
- tags: (args)=>[
104
- presenceTag(args.room)
105
- ],
106
- parse: (args)=>{
107
- const room = args?.room;
108
- if (typeof room !== 'string' || room.length === 0) {
109
- throw new Error("presence roster args require a non-empty 'room' string");
110
- }
111
- return {
112
- room
113
- };
114
- }
115
- }),
116
- _ts_metadata("design:type", Function),
117
- _ts_metadata("design:paramtypes", [
118
- Object
119
- ]),
120
- _ts_metadata("design:returntype", Array)
121
- ], PresenceResolver.prototype, "roster", null);
122
- PresenceResolver = _ts_decorate([
123
- LiveResolver(),
124
- Injectable(),
125
- _ts_param(0, Inject(PresenceService)),
126
- _ts_metadata("design:type", Function),
127
- _ts_metadata("design:paramtypes", [
128
- typeof PresenceService === "undefined" ? Object : PresenceService
129
- ])
130
- ], PresenceResolver);
@@ -1,10 +0,0 @@
1
- declare global {
2
- namespace Reflect {
3
- function defineMetadata(key: string, value: unknown, target: object, propertyKey?: string | symbol): void;
4
- function getMetadata(key: string, target: object, propertyKey?: string | symbol): unknown;
5
- function getOwnMetadata(key: string, target: object, propertyKey?: string | symbol): unknown;
6
- function metadata(key: string, value: unknown): (target: object, propertyKey?: string | symbol) => void;
7
- }
8
- }
9
- export declare function defineMetadata(key: string, value: unknown, target: object, propertyKey?: string | symbol): void;
10
- export declare function getMetadata<T = unknown>(key: string, target: object, propertyKey?: string | symbol): T | undefined;
package/dist/metadata.js DELETED
@@ -1,20 +0,0 @@
1
- // Single funnel: every Reflect.* metadata write/read routes into MetadataRegistry.
2
- // SWC emits Reflect.metadata('design:paramtypes', ...) calls in compiled code;
3
- // the polyfill catches those and parks them in the registry alongside vela's typed slots.
4
- import { MetadataRegistry } from "./registry/metadata.registry.js";
5
- export function defineMetadata(key, value, target, propertyKey) {
6
- MetadataRegistry.setReflectMetadata(target, key, value, propertyKey);
7
- }
8
- export function getMetadata(key, target, propertyKey) {
9
- return MetadataRegistry.getReflectMetadata(target, key, propertyKey);
10
- }
11
- if (typeof Reflect.defineMetadata !== 'function') {
12
- Reflect.defineMetadata = defineMetadata;
13
- Reflect.getMetadata = getMetadata;
14
- Reflect.getOwnMetadata = getMetadata;
15
- Reflect.metadata = (key, value)=>{
16
- return (target, propertyKey)=>{
17
- defineMetadata(key, value, target, propertyKey);
18
- };
19
- };
20
- }
@@ -1,56 +0,0 @@
1
- import type { DynamicModule } from '../registry/types';
2
- import type { ConfigurableModuleBuilderOptions, ConfigurableModuleExtras, ConfigurableModuleExtrasTransform, ConfigurableModuleHost, DefineConfigurableModuleSpec } from './configurable-module.types';
3
- /**
4
- * Blessed key-derivation helper for hand-written `forRoot` statics: the one
5
- * documented way to derive a `DynamicModule.key` from an options bag so
6
- * identical configurations dedup (HMR-idempotent) and distinct ones coexist.
7
- * Alias of {@link stableHash} with a module-authoring name.
8
- */
9
- export declare const moduleKey: (options: unknown) => string;
10
- /**
11
- * NestJS-parity builder that generates `forRoot`/`forRootAsync` (and `key`,
12
- * `global`, factory-param inference) from a tiny spec — so a module is just its
13
- * tokens + options type + service + a `@Module({...})` bag, while vela keeps its
14
- * encapsulation (`exports`/visibility) and multi-instance `key` dedup.
15
- *
16
- * Since 1.11 this is a thin adapter over {@link defineModule} — the single
17
- * authoring engine. Prefer `defineModule` for new modules: it additionally
18
- * supports contributions (providers/controllers/imports/exports/global
19
- * components) computed as functions of the options.
20
- *
21
- * @example
22
- * ```ts
23
- * const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN } =
24
- * new ConfigurableModuleBuilder<FooOptions>({ moduleName: 'Foo' }).build();
25
- *
26
- * @Module({
27
- * providers: [FooService], // derived providers inject MODULE_OPTIONS_TOKEN
28
- * exports: [FooService],
29
- * })
30
- * export class FooModule extends ConfigurableModuleClass {}
31
- * ```
32
- */
33
- export declare class ConfigurableModuleBuilder<Opts, MethodKey extends string = 'forRoot', FactoryMethodKey extends string = 'create', Extras extends ConfigurableModuleExtras = {
34
- isGlobal?: boolean;
35
- }> {
36
- private readonly options;
37
- private classMethodName;
38
- private factoryMethodName;
39
- private extrasDefaults;
40
- private extrasTransform;
41
- constructor(options?: ConfigurableModuleBuilderOptions);
42
- /** Declare extra call-site keys (e.g. `isGlobal`) + how they reshape the definition. */
43
- setExtras<NewExtras extends ConfigurableModuleExtras>(defaults: NewExtras, transform: ConfigurableModuleExtrasTransform<NewExtras>): ConfigurableModuleBuilder<Opts, MethodKey, FactoryMethodKey, NewExtras>;
44
- /** Rename the sync static (default `forRoot`); the async static becomes `<name>Async`. */
45
- setClassMethodName<NewMethodKey extends string>(name: NewMethodKey): ConfigurableModuleBuilder<Opts, NewMethodKey, FactoryMethodKey, Extras>;
46
- /** Rename the method a `useClass`/`useExisting` options factory must implement (default `create`). */
47
- setFactoryMethodName<NewFactoryMethodKey extends string>(name: NewFactoryMethodKey): ConfigurableModuleBuilder<Opts, MethodKey, NewFactoryMethodKey, Extras>;
48
- build(): ConfigurableModuleHost<Opts, MethodKey, FactoryMethodKey, Extras>;
49
- }
50
- /**
51
- * Lower-level engine for cases a class-mixin can't express — chiefly a
52
- * runtime-generated module class whose providers depend on a call-time arg
53
- * (Cloudflare binding modules). Returns an object with a single static named by
54
- * `spec.methodName` (default `forRoot`).
55
- */
56
- export declare function defineConfigurableModule<Args>(spec: DefineConfigurableModuleSpec<Args>): Record<string, (args: Args) => DynamicModule>;
@@ -1,84 +0,0 @@
1
- import { defineModule } from "./define-module.js";
2
- import { stableHash } from "./stable-hash.js";
3
- /**
4
- * Blessed key-derivation helper for hand-written `forRoot` statics: the one
5
- * documented way to derive a `DynamicModule.key` from an options bag so
6
- * identical configurations dedup (HMR-idempotent) and distinct ones coexist.
7
- * Alias of {@link stableHash} with a module-authoring name.
8
- */ export const moduleKey = stableHash;
9
- /**
10
- * NestJS-parity builder that generates `forRoot`/`forRootAsync` (and `key`,
11
- * `global`, factory-param inference) from a tiny spec — so a module is just its
12
- * tokens + options type + service + a `@Module({...})` bag, while vela keeps its
13
- * encapsulation (`exports`/visibility) and multi-instance `key` dedup.
14
- *
15
- * Since 1.11 this is a thin adapter over {@link defineModule} — the single
16
- * authoring engine. Prefer `defineModule` for new modules: it additionally
17
- * supports contributions (providers/controllers/imports/exports/global
18
- * components) computed as functions of the options.
19
- *
20
- * @example
21
- * ```ts
22
- * const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN } =
23
- * new ConfigurableModuleBuilder<FooOptions>({ moduleName: 'Foo' }).build();
24
- *
25
- * @Module({
26
- * providers: [FooService], // derived providers inject MODULE_OPTIONS_TOKEN
27
- * exports: [FooService],
28
- * })
29
- * export class FooModule extends ConfigurableModuleClass {}
30
- * ```
31
- */ export class ConfigurableModuleBuilder {
32
- options;
33
- classMethodName = 'forRoot';
34
- factoryMethodName = 'create';
35
- extrasDefaults;
36
- extrasTransform;
37
- constructor(options = {}){
38
- this.options = options;
39
- }
40
- /** Declare extra call-site keys (e.g. `isGlobal`) + how they reshape the definition. */ setExtras(defaults, transform) {
41
- this.extrasDefaults = defaults;
42
- this.extrasTransform = transform;
43
- return this;
44
- }
45
- /** Rename the sync static (default `forRoot`); the async static becomes `<name>Async`. */ setClassMethodName(name) {
46
- this.classMethodName = name;
47
- return this;
48
- }
49
- /** Rename the method a `useClass`/`useExisting` options factory must implement (default `create`). */ setFactoryMethodName(name) {
50
- this.factoryMethodName = name;
51
- return this;
52
- }
53
- build() {
54
- return defineModule({
55
- name: this.options.moduleName ?? 'ConfigurableModule',
56
- optionsToken: this.options.optionsInjectionToken,
57
- extras: this.extrasDefaults,
58
- transform: this.extrasTransform,
59
- methodName: this.classMethodName,
60
- factoryMethodName: this.factoryMethodName
61
- });
62
- }
63
- }
64
- /**
65
- * Lower-level engine for cases a class-mixin can't express — chiefly a
66
- * runtime-generated module class whose providers depend on a call-time arg
67
- * (Cloudflare binding modules). Returns an object with a single static named by
68
- * `spec.methodName` (default `forRoot`).
69
- */ export function defineConfigurableModule(spec) {
70
- const methodName = spec.methodName ?? 'forRoot';
71
- return {
72
- [methodName] (args) {
73
- const definition = {
74
- module: spec.module,
75
- key: spec.keyFrom(args),
76
- providers: spec.providers(args)
77
- };
78
- if (spec.imports) definition.imports = spec.imports(args);
79
- if (spec.exports) definition.exports = spec.exports;
80
- if (spec.global) definition.global = true;
81
- return definition;
82
- }
83
- };
84
- }