@velajs/vela 1.19.0 → 1.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (449) hide show
  1. package/CHANGELOG.md +22 -14
  2. package/dist/configurable-module.builder-5FGMaXG6.js +91 -0
  3. package/dist/configurable-module.builder-5FGMaXG6.js.map +1 -0
  4. package/dist/container-BqUHID4l.js +645 -0
  5. package/dist/container-BqUHID4l.js.map +1 -0
  6. package/dist/cron-matcher-C9qv5OUA.js +113 -0
  7. package/dist/cron-matcher-C9qv5OUA.js.map +1 -0
  8. package/dist/decorate-GcSMAbKn.js +528 -0
  9. package/dist/decorate-GcSMAbKn.js.map +1 -0
  10. package/dist/decorators-C8YBFCIk.js +53 -0
  11. package/dist/decorators-C8YBFCIk.js.map +1 -0
  12. package/dist/define-module-NOyOZNXD.js +235 -0
  13. package/dist/define-module-NOyOZNXD.js.map +1 -0
  14. package/dist/discovery.service-BYm95SSD.js +368 -0
  15. package/dist/discovery.service-BYm95SSD.js.map +1 -0
  16. package/dist/discovery.service-Cpf1QcZ5.d.ts +648 -0
  17. package/dist/i18n/index.d.ts +138 -10
  18. package/dist/i18n/index.js +270 -8
  19. package/dist/i18n/index.js.map +1 -0
  20. package/dist/index-D72EQfcC.d.ts +430 -0
  21. package/dist/index-DhShDLCM.d.ts +2310 -0
  22. package/dist/index.d.ts +6 -70
  23. package/dist/index.js +14 -76
  24. package/dist/internal.d.ts +13 -17
  25. package/dist/internal.js +6 -19
  26. package/dist/live/index.d.ts +2 -12
  27. package/dist/live/index.js +826 -16
  28. package/dist/live/index.js.map +1 -0
  29. package/dist/metadata.registry-D1od8ZBt.d.ts +842 -0
  30. package/dist/plugin-ByBlVOve.js +1387 -0
  31. package/dist/plugin-ByBlVOve.js.map +1 -0
  32. package/dist/queue/index.d.ts +247 -10
  33. package/dist/queue/index.js +384 -12
  34. package/dist/queue/index.js.map +1 -0
  35. package/dist/request-context-C3nCGJNd.js +26 -0
  36. package/dist/request-context-C3nCGJNd.js.map +1 -0
  37. package/dist/route.manager-DRAZ5X04.js +991 -0
  38. package/dist/route.manager-DRAZ5X04.js.map +1 -0
  39. package/dist/schedule-node/index.d.ts +32 -3
  40. package/dist/schedule-node/index.js +97 -3
  41. package/dist/schedule-node/index.js.map +1 -0
  42. package/dist/schedule.registry-DVm7Jp5w.d.ts +55 -0
  43. package/dist/seeder/index.d.ts +75 -5
  44. package/dist/seeder/index.js +105 -4
  45. package/dist/seeder/index.js.map +1 -0
  46. package/dist/signed-url-CMmi0SIb.js +56 -0
  47. package/dist/signed-url-CMmi0SIb.js.map +1 -0
  48. package/dist/signed-url-DKhgja4U.d.ts +16 -0
  49. package/dist/src-eb5CI6Xn.js +2151 -0
  50. package/dist/src-eb5CI6Xn.js.map +1 -0
  51. package/dist/storage/index.d.ts +57 -4
  52. package/dist/storage/index.js +22 -5
  53. package/dist/storage/index.js.map +1 -0
  54. package/dist/streaming/index.d.ts +2 -2
  55. package/dist/streaming/index.js +2 -1
  56. package/dist/websocket/index.d.ts +3 -12
  57. package/dist/websocket/index.js +2 -16
  58. package/dist/websocket-DXmB-MWJ.js +697 -0
  59. package/dist/websocket-DXmB-MWJ.js.map +1 -0
  60. package/dist/websocket-node/index.d.ts +108 -6
  61. package/dist/websocket-node/index.js +228 -6
  62. package/dist/websocket-node/index.js.map +1 -0
  63. package/package.json +66 -53
  64. package/dist/__tests__/workers/entry.d.ts +0 -9
  65. package/dist/__tests__/workers-als/entry-als.d.ts +0 -9
  66. package/dist/application.d.ts +0 -104
  67. package/dist/application.js +0 -364
  68. package/dist/cache/cache.decorators.d.ts +0 -2
  69. package/dist/cache/cache.decorators.js +0 -4
  70. package/dist/cache/cache.interceptor.d.ts +0 -9
  71. package/dist/cache/cache.interceptor.js +0 -60
  72. package/dist/cache/cache.module.d.ts +0 -7
  73. package/dist/cache/cache.module.js +0 -58
  74. package/dist/cache/cache.service.d.ts +0 -9
  75. package/dist/cache/cache.service.js +0 -42
  76. package/dist/cache/cache.store.d.ts +0 -12
  77. package/dist/cache/cache.store.js +0 -51
  78. package/dist/cache/cache.tokens.d.ts +0 -6
  79. package/dist/cache/cache.tokens.js +0 -5
  80. package/dist/cache/cache.types.d.ts +0 -41
  81. package/dist/cache/cache.types.js +0 -1
  82. package/dist/cache/index.d.ts +0 -8
  83. package/dist/cache/index.js +0 -7
  84. package/dist/cache/tiered-cache.store.d.ts +0 -19
  85. package/dist/cache/tiered-cache.store.js +0 -40
  86. package/dist/config/config.module.d.ts +0 -19
  87. package/dist/config/config.module.js +0 -98
  88. package/dist/config/config.service.d.ts +0 -20
  89. package/dist/config/config.service.js +0 -43
  90. package/dist/config/config.store.d.ts +0 -46
  91. package/dist/config/config.store.js +0 -119
  92. package/dist/config/config.tokens.d.ts +0 -13
  93. package/dist/config/config.tokens.js +0 -14
  94. package/dist/config/config.types.d.ts +0 -41
  95. package/dist/config/config.types.js +0 -4
  96. package/dist/config/index.d.ts +0 -7
  97. package/dist/config/index.js +0 -5
  98. package/dist/config/register-as.d.ts +0 -52
  99. package/dist/config/register-as.js +0 -39
  100. package/dist/constants.d.ts +0 -44
  101. package/dist/constants.js +0 -46
  102. package/dist/container/container.d.ts +0 -154
  103. package/dist/container/container.js +0 -849
  104. package/dist/container/decorators.d.ts +0 -17
  105. package/dist/container/decorators.js +0 -57
  106. package/dist/container/disposable.d.ts +0 -5
  107. package/dist/container/disposable.js +0 -33
  108. package/dist/container/index.d.ts +0 -6
  109. package/dist/container/index.js +0 -5
  110. package/dist/container/mixin.d.ts +0 -24
  111. package/dist/container/mixin.js +0 -26
  112. package/dist/container/module-ref.d.ts +0 -21
  113. package/dist/container/module-ref.js +0 -48
  114. package/dist/container/types.d.ts +0 -154
  115. package/dist/container/types.js +0 -49
  116. package/dist/cors/cors.module.d.ts +0 -7
  117. package/dist/cors/cors.module.js +0 -37
  118. package/dist/cors/cors.tokens.d.ts +0 -3
  119. package/dist/cors/cors.tokens.js +0 -2
  120. package/dist/cors/cors.types.d.ts +0 -8
  121. package/dist/cors/cors.types.js +0 -1
  122. package/dist/cors/index.d.ts +0 -3
  123. package/dist/cors/index.js +0 -2
  124. package/dist/crypto/signed-url.d.ts +0 -12
  125. package/dist/crypto/signed-url.js +0 -60
  126. package/dist/discovery/discoverable.decorator.d.ts +0 -38
  127. package/dist/discovery/discoverable.decorator.js +0 -42
  128. package/dist/discovery/discovery.service.d.ts +0 -102
  129. package/dist/discovery/discovery.service.js +0 -177
  130. package/dist/discovery/index.d.ts +0 -2
  131. package/dist/discovery/index.js +0 -2
  132. package/dist/entrypoint/entrypoint.registry.d.ts +0 -42
  133. package/dist/entrypoint/entrypoint.registry.js +0 -112
  134. package/dist/entrypoint/entrypoint.types.d.ts +0 -41
  135. package/dist/entrypoint/entrypoint.types.js +0 -3
  136. package/dist/entrypoint/execution-context.d.ts +0 -15
  137. package/dist/entrypoint/execution-context.js +0 -21
  138. package/dist/entrypoint/execution-scope.d.ts +0 -21
  139. package/dist/entrypoint/execution-scope.js +0 -28
  140. package/dist/entrypoint/index.d.ts +0 -4
  141. package/dist/entrypoint/index.js +0 -4
  142. package/dist/errors/http-exception.d.ts +0 -63
  143. package/dist/errors/http-exception.js +0 -142
  144. package/dist/errors/index.d.ts +0 -1
  145. package/dist/errors/index.js +0 -1
  146. package/dist/event-emitter/event-emitter.decorators.d.ts +0 -1
  147. package/dist/event-emitter/event-emitter.decorators.js +0 -10
  148. package/dist/event-emitter/event-emitter.module.d.ts +0 -2
  149. package/dist/event-emitter/event-emitter.module.js +0 -23
  150. package/dist/event-emitter/event-emitter.service.d.ts +0 -13
  151. package/dist/event-emitter/event-emitter.service.js +0 -127
  152. package/dist/event-emitter/event-emitter.subscriber.d.ts +0 -9
  153. package/dist/event-emitter/event-emitter.subscriber.js +0 -45
  154. package/dist/event-emitter/event-emitter.tokens.d.ts +0 -1
  155. package/dist/event-emitter/event-emitter.tokens.js +0 -1
  156. package/dist/event-emitter/event-emitter.types.d.ts +0 -5
  157. package/dist/event-emitter/event-emitter.types.js +0 -1
  158. package/dist/event-emitter/index.d.ts +0 -6
  159. package/dist/event-emitter/index.js +0 -5
  160. package/dist/exceptions/errors.module.d.ts +0 -40
  161. package/dist/exceptions/errors.module.js +0 -46
  162. package/dist/exceptions/exception-handler.d.ts +0 -56
  163. package/dist/exceptions/exception-handler.js +0 -17
  164. package/dist/exceptions/index.d.ts +0 -6
  165. package/dist/exceptions/index.js +0 -3
  166. package/dist/exceptions/reporter.d.ts +0 -21
  167. package/dist/exceptions/reporter.js +0 -70
  168. package/dist/factory/adapter.d.ts +0 -36
  169. package/dist/factory/adapter.js +0 -18
  170. package/dist/factory/bootstrap.d.ts +0 -23
  171. package/dist/factory/bootstrap.js +0 -110
  172. package/dist/factory.d.ts +0 -16
  173. package/dist/factory.js +0 -36
  174. package/dist/fetch/fetch.module.d.ts +0 -7
  175. package/dist/fetch/fetch.module.js +0 -31
  176. package/dist/fetch/fetch.service.d.ts +0 -24
  177. package/dist/fetch/fetch.service.js +0 -145
  178. package/dist/fetch/fetch.types.d.ts +0 -24
  179. package/dist/fetch/fetch.types.js +0 -1
  180. package/dist/fetch/index.d.ts +0 -3
  181. package/dist/fetch/index.js +0 -2
  182. package/dist/health/health.http.d.ts +0 -14
  183. package/dist/health/health.http.js +0 -75
  184. package/dist/health/health.indicator.d.ts +0 -9
  185. package/dist/health/health.indicator.js +0 -32
  186. package/dist/health/health.module.d.ts +0 -2
  187. package/dist/health/health.module.js +0 -26
  188. package/dist/health/health.service.d.ts +0 -7
  189. package/dist/health/health.service.js +0 -69
  190. package/dist/health/health.types.d.ts +0 -15
  191. package/dist/health/health.types.js +0 -1
  192. package/dist/health/index.d.ts +0 -6
  193. package/dist/health/index.js +0 -4
  194. package/dist/http/ambient.d.ts +0 -17
  195. package/dist/http/ambient.js +0 -44
  196. package/dist/http/argument-resolver.d.ts +0 -10
  197. package/dist/http/argument-resolver.js +0 -89
  198. package/dist/http/decorators.d.ts +0 -198
  199. package/dist/http/decorators.js +0 -321
  200. package/dist/http/execution-context.d.ts +0 -8
  201. package/dist/http/execution-context.js +0 -35
  202. package/dist/http/handler-executor.d.ts +0 -20
  203. package/dist/http/handler-executor.js +0 -133
  204. package/dist/http/index.d.ts +0 -12
  205. package/dist/http/index.js +0 -7
  206. package/dist/http/instantiate.d.ts +0 -4
  207. package/dist/http/instantiate.js +0 -45
  208. package/dist/http/lazy-param.decorator.d.ts +0 -37
  209. package/dist/http/lazy-param.decorator.js +0 -117
  210. package/dist/http/request-container.d.ts +0 -16
  211. package/dist/http/request-container.js +0 -19
  212. package/dist/http/request-context.d.ts +0 -13
  213. package/dist/http/request-context.js +0 -22
  214. package/dist/http/response-mapper.d.ts +0 -8
  215. package/dist/http/response-mapper.js +0 -42
  216. package/dist/http/route-contributor.d.ts +0 -68
  217. package/dist/http/route-contributor.js +0 -22
  218. package/dist/http/route-map.d.ts +0 -30
  219. package/dist/http/route-map.js +0 -27
  220. package/dist/http/route.manager.d.ts +0 -92
  221. package/dist/http/route.manager.js +0 -481
  222. package/dist/http/types.d.ts +0 -37
  223. package/dist/http/types.js +0 -1
  224. package/dist/http/url/index.d.ts +0 -4
  225. package/dist/http/url/index.js +0 -3
  226. package/dist/http/url/signed-url.guard.d.ts +0 -27
  227. package/dist/http/url/signed-url.guard.js +0 -62
  228. package/dist/http/url/signing-secret.d.ts +0 -20
  229. package/dist/http/url/signing-secret.js +0 -24
  230. package/dist/http/url/url-generator.service.d.ts +0 -52
  231. package/dist/http/url/url-generator.service.js +0 -104
  232. package/dist/i18n/deep-merge.d.ts +0 -2
  233. package/dist/i18n/deep-merge.js +0 -15
  234. package/dist/i18n/i18n.middleware.d.ts +0 -15
  235. package/dist/i18n/i18n.middleware.js +0 -94
  236. package/dist/i18n/i18n.module.d.ts +0 -13
  237. package/dist/i18n/i18n.module.js +0 -69
  238. package/dist/i18n/i18n.options.d.ts +0 -30
  239. package/dist/i18n/i18n.options.js +0 -16
  240. package/dist/i18n/i18n.service.d.ts +0 -20
  241. package/dist/i18n/i18n.service.js +0 -49
  242. package/dist/i18n/i18n.tokens.d.ts +0 -6
  243. package/dist/i18n/i18n.tokens.js +0 -3
  244. package/dist/i18n/i18n.types.d.ts +0 -6
  245. package/dist/i18n/i18n.types.js +0 -1
  246. package/dist/i18n/message-loader.service.d.ts +0 -21
  247. package/dist/i18n/message-loader.service.js +0 -90
  248. package/dist/i18n/message-registry.d.ts +0 -16
  249. package/dist/i18n/message-registry.js +0 -49
  250. package/dist/lifecycle/index.d.ts +0 -20
  251. package/dist/lifecycle/index.js +0 -15
  252. package/dist/live/live.cursor.d.ts +0 -22
  253. package/dist/live/live.cursor.js +0 -56
  254. package/dist/live/live.decorators.d.ts +0 -32
  255. package/dist/live/live.decorators.js +0 -46
  256. package/dist/live/live.delta.d.ts +0 -15
  257. package/dist/live/live.delta.js +0 -51
  258. package/dist/live/live.engine.d.ts +0 -88
  259. package/dist/live/live.engine.js +0 -471
  260. package/dist/live/live.invalidation.d.ts +0 -45
  261. package/dist/live/live.invalidation.js +0 -99
  262. package/dist/live/live.module.d.ts +0 -28
  263. package/dist/live/live.module.js +0 -87
  264. package/dist/live/live.tokens.d.ts +0 -9
  265. package/dist/live/live.tokens.js +0 -8
  266. package/dist/live/live.types.d.ts +0 -138
  267. package/dist/live/live.types.js +0 -1
  268. package/dist/live/presence.d.ts +0 -44
  269. package/dist/live/presence.js +0 -130
  270. package/dist/metadata.d.ts +0 -10
  271. package/dist/metadata.js +0 -20
  272. package/dist/module/configurable-module.builder.d.ts +0 -56
  273. package/dist/module/configurable-module.builder.js +0 -84
  274. package/dist/module/configurable-module.types.d.ts +0 -93
  275. package/dist/module/configurable-module.types.js +0 -5
  276. package/dist/module/decorators.d.ts +0 -10
  277. package/dist/module/decorators.js +0 -47
  278. package/dist/module/define-module.d.ts +0 -112
  279. package/dist/module/define-module.js +0 -232
  280. package/dist/module/graph.d.ts +0 -10
  281. package/dist/module/graph.js +0 -35
  282. package/dist/module/index.d.ts +0 -10
  283. package/dist/module/index.js +0 -7
  284. package/dist/module/lazy-modules.d.ts +0 -82
  285. package/dist/module/lazy-modules.js +0 -231
  286. package/dist/module/lazy-provider.d.ts +0 -65
  287. package/dist/module/lazy-provider.js +0 -111
  288. package/dist/module/middleware.d.ts +0 -30
  289. package/dist/module/middleware.js +0 -67
  290. package/dist/module/module-loader.d.ts +0 -58
  291. package/dist/module/module-loader.js +0 -484
  292. package/dist/module/stable-hash.d.ts +0 -15
  293. package/dist/module/stable-hash.js +0 -52
  294. package/dist/module/types.d.ts +0 -1
  295. package/dist/module/types.js +0 -1
  296. package/dist/openapi/decorators.d.ts +0 -34
  297. package/dist/openapi/decorators.js +0 -66
  298. package/dist/openapi/document.d.ts +0 -3
  299. package/dist/openapi/document.js +0 -316
  300. package/dist/openapi/index.d.ts +0 -7
  301. package/dist/openapi/index.js +0 -6
  302. package/dist/openapi/redoc-ui.d.ts +0 -1
  303. package/dist/openapi/redoc-ui.js +0 -19
  304. package/dist/openapi/scalar-ui.d.ts +0 -1
  305. package/dist/openapi/scalar-ui.js +0 -19
  306. package/dist/openapi/swagger-ui.d.ts +0 -1
  307. package/dist/openapi/swagger-ui.js +0 -23
  308. package/dist/openapi/types.d.ts +0 -182
  309. package/dist/openapi/types.js +0 -4
  310. package/dist/openapi/zod-to-json-schema.d.ts +0 -4
  311. package/dist/openapi/zod-to-json-schema.js +0 -57
  312. package/dist/pipeline/app-providers.d.ts +0 -10
  313. package/dist/pipeline/app-providers.js +0 -43
  314. package/dist/pipeline/component.manager.d.ts +0 -25
  315. package/dist/pipeline/component.manager.js +0 -66
  316. package/dist/pipeline/decorators.d.ts +0 -10
  317. package/dist/pipeline/decorators.js +0 -42
  318. package/dist/pipeline/index.d.ts +0 -12
  319. package/dist/pipeline/index.js +0 -7
  320. package/dist/pipeline/pipeline-runner.d.ts +0 -31
  321. package/dist/pipeline/pipeline-runner.js +0 -40
  322. package/dist/pipeline/pipes.d.ts +0 -48
  323. package/dist/pipeline/pipes.js +0 -104
  324. package/dist/pipeline/reflector.d.ts +0 -86
  325. package/dist/pipeline/reflector.js +0 -121
  326. package/dist/pipeline/scoped-components.d.ts +0 -26
  327. package/dist/pipeline/scoped-components.js +0 -27
  328. package/dist/pipeline/tokens.d.ts +0 -57
  329. package/dist/pipeline/tokens.js +0 -47
  330. package/dist/pipeline/types.d.ts +0 -64
  331. package/dist/pipeline/types.js +0 -1
  332. package/dist/plugin/plugin.d.ts +0 -31
  333. package/dist/plugin/plugin.js +0 -111
  334. package/dist/queue/inline.driver.d.ts +0 -30
  335. package/dist/queue/inline.driver.js +0 -58
  336. package/dist/queue/queue.binding.d.ts +0 -23
  337. package/dist/queue/queue.binding.js +0 -60
  338. package/dist/queue/queue.client.d.ts +0 -20
  339. package/dist/queue/queue.client.js +0 -33
  340. package/dist/queue/queue.decorators.d.ts +0 -23
  341. package/dist/queue/queue.decorators.js +0 -46
  342. package/dist/queue/queue.dispatch.d.ts +0 -36
  343. package/dist/queue/queue.dispatch.js +0 -109
  344. package/dist/queue/queue.module.d.ts +0 -32
  345. package/dist/queue/queue.module.js +0 -80
  346. package/dist/queue/queue.tokens.d.ts +0 -21
  347. package/dist/queue/queue.tokens.js +0 -34
  348. package/dist/queue/queue.types.d.ts +0 -61
  349. package/dist/queue/queue.types.js +0 -4
  350. package/dist/registry/index.d.ts +0 -2
  351. package/dist/registry/index.js +0 -1
  352. package/dist/registry/metadata.registry.d.ts +0 -73
  353. package/dist/registry/metadata.registry.js +0 -357
  354. package/dist/registry/paths.d.ts +0 -3
  355. package/dist/registry/paths.js +0 -15
  356. package/dist/registry/types.d.ts +0 -116
  357. package/dist/registry/types.js +0 -1
  358. package/dist/registry/util.d.ts +0 -3
  359. package/dist/registry/util.js +0 -8
  360. package/dist/schedule/cron-matcher.d.ts +0 -2
  361. package/dist/schedule/cron-matcher.js +0 -62
  362. package/dist/schedule/index.d.ts +0 -8
  363. package/dist/schedule/index.js +0 -5
  364. package/dist/schedule/schedule.decorators.d.ts +0 -2
  365. package/dist/schedule/schedule.decorators.js +0 -18
  366. package/dist/schedule/schedule.module.d.ts +0 -9
  367. package/dist/schedule/schedule.module.js +0 -28
  368. package/dist/schedule/schedule.registry.d.ts +0 -23
  369. package/dist/schedule/schedule.registry.js +0 -63
  370. package/dist/schedule/schedule.tokens.d.ts +0 -2
  371. package/dist/schedule/schedule.tokens.js +0 -2
  372. package/dist/schedule/schedule.types.d.ts +0 -8
  373. package/dist/schedule/schedule.types.js +0 -1
  374. package/dist/schedule-node/schedule-node.module.d.ts +0 -9
  375. package/dist/schedule-node/schedule-node.module.js +0 -28
  376. package/dist/schedule-node/schedule.executor.d.ts +0 -19
  377. package/dist/schedule-node/schedule.executor.js +0 -112
  378. package/dist/seeder/seeder.decorator.d.ts +0 -7
  379. package/dist/seeder/seeder.decorator.js +0 -15
  380. package/dist/seeder/seeder.module.d.ts +0 -16
  381. package/dist/seeder/seeder.module.js +0 -44
  382. package/dist/seeder/seeder.registry.d.ts +0 -23
  383. package/dist/seeder/seeder.registry.js +0 -83
  384. package/dist/seeder/seeder.tokens.d.ts +0 -2
  385. package/dist/seeder/seeder.tokens.js +0 -1
  386. package/dist/seeder/seeder.types.d.ts +0 -20
  387. package/dist/seeder/seeder.types.js +0 -1
  388. package/dist/serialization/index.d.ts +0 -2
  389. package/dist/serialization/index.js +0 -2
  390. package/dist/serialization/serialize.decorator.d.ts +0 -6
  391. package/dist/serialization/serialize.decorator.js +0 -7
  392. package/dist/serialization/serializer.interceptor.d.ts +0 -4
  393. package/dist/serialization/serializer.interceptor.js +0 -16
  394. package/dist/services/index.d.ts +0 -2
  395. package/dist/services/index.js +0 -1
  396. package/dist/services/logger.d.ts +0 -59
  397. package/dist/services/logger.js +0 -159
  398. package/dist/storage/path-template.d.ts +0 -9
  399. package/dist/storage/path-template.js +0 -20
  400. package/dist/storage/storage.types.d.ts +0 -41
  401. package/dist/storage/storage.types.js +0 -5
  402. package/dist/throttler/index.d.ts +0 -6
  403. package/dist/throttler/index.js +0 -5
  404. package/dist/throttler/throttler.decorators.d.ts +0 -3
  405. package/dist/throttler/throttler.decorators.js +0 -4
  406. package/dist/throttler/throttler.guard.d.ts +0 -9
  407. package/dist/throttler/throttler.guard.js +0 -72
  408. package/dist/throttler/throttler.module.d.ts +0 -7
  409. package/dist/throttler/throttler.module.js +0 -41
  410. package/dist/throttler/throttler.storage.d.ts +0 -10
  411. package/dist/throttler/throttler.storage.js +0 -44
  412. package/dist/throttler/throttler.tokens.d.ts +0 -6
  413. package/dist/throttler/throttler.tokens.js +0 -5
  414. package/dist/throttler/throttler.types.d.ts +0 -25
  415. package/dist/throttler/throttler.types.js +0 -1
  416. package/dist/validation/create-zod-dto.d.ts +0 -13
  417. package/dist/validation/create-zod-dto.js +0 -18
  418. package/dist/validation/index.d.ts +0 -3
  419. package/dist/validation/index.js +0 -2
  420. package/dist/validation/validation.pipe.d.ts +0 -4
  421. package/dist/validation/validation.pipe.js +0 -19
  422. package/dist/websocket/websocket.decorators.d.ts +0 -47
  423. package/dist/websocket/websocket.decorators.js +0 -80
  424. package/dist/websocket/websocket.module.d.ts +0 -35
  425. package/dist/websocket/websocket.module.js +0 -63
  426. package/dist/websocket/websocket.tokens.d.ts +0 -30
  427. package/dist/websocket/websocket.tokens.js +0 -27
  428. package/dist/websocket/websocket.types.d.ts +0 -102
  429. package/dist/websocket/websocket.types.js +0 -4
  430. package/dist/websocket/ws-argument-resolver.d.ts +0 -13
  431. package/dist/websocket/ws-argument-resolver.js +0 -40
  432. package/dist/websocket/ws-dispatcher.d.ts +0 -54
  433. package/dist/websocket/ws-dispatcher.js +0 -343
  434. package/dist/websocket/ws-exception.d.ts +0 -25
  435. package/dist/websocket/ws-exception.js +0 -42
  436. package/dist/websocket/ws-execution-context.d.ts +0 -9
  437. package/dist/websocket/ws-execution-context.js +0 -24
  438. package/dist/websocket/ws-server.d.ts +0 -31
  439. package/dist/websocket/ws-server.js +0 -74
  440. package/dist/websocket/ws-sync.d.ts +0 -47
  441. package/dist/websocket/ws-sync.js +0 -74
  442. package/dist/websocket-node/node-ws-client.d.ts +0 -24
  443. package/dist/websocket-node/node-ws-client.js +0 -49
  444. package/dist/websocket-node/redis-live.d.ts +0 -24
  445. package/dist/websocket-node/redis-live.js +0 -57
  446. package/dist/websocket-node/redis-sync.d.ts +0 -33
  447. package/dist/websocket-node/redis-sync.js +0 -56
  448. package/dist/websocket-node/register-gateways.d.ts +0 -20
  449. package/dist/websocket-node/register-gateways.js +0 -61
@@ -1,63 +0,0 @@
1
- export type ExceptionResponse = string | Record<string, unknown>;
2
- export declare class HttpException extends Error {
3
- readonly statusCode: number;
4
- private readonly _response;
5
- constructor(response: ExceptionResponse, statusCode: number);
6
- getStatus(): number;
7
- getResponse(): Record<string, unknown>;
8
- getRawResponse(): ExceptionResponse;
9
- }
10
- export declare class BadRequestException extends HttpException {
11
- constructor(message?: ExceptionResponse);
12
- }
13
- export declare class UnauthorizedException extends HttpException {
14
- constructor(message?: ExceptionResponse);
15
- }
16
- export declare class ForbiddenException extends HttpException {
17
- constructor(message?: ExceptionResponse);
18
- }
19
- export declare class NotFoundException extends HttpException {
20
- constructor(message?: ExceptionResponse);
21
- }
22
- export declare class MethodNotAllowedException extends HttpException {
23
- constructor(message?: ExceptionResponse);
24
- }
25
- export declare class NotAcceptableException extends HttpException {
26
- constructor(message?: ExceptionResponse);
27
- }
28
- export declare class RequestTimeoutException extends HttpException {
29
- constructor(message?: ExceptionResponse);
30
- }
31
- export declare class ConflictException extends HttpException {
32
- constructor(message?: ExceptionResponse);
33
- }
34
- export declare class GoneException extends HttpException {
35
- constructor(message?: ExceptionResponse);
36
- }
37
- export declare class PayloadTooLargeException extends HttpException {
38
- constructor(message?: ExceptionResponse);
39
- }
40
- export declare class UnsupportedMediaTypeException extends HttpException {
41
- constructor(message?: ExceptionResponse);
42
- }
43
- export declare class UnprocessableEntityException extends HttpException {
44
- constructor(message?: ExceptionResponse);
45
- }
46
- export declare class TooManyRequestsException extends HttpException {
47
- constructor(message?: ExceptionResponse);
48
- }
49
- export declare class InternalServerErrorException extends HttpException {
50
- constructor(message?: ExceptionResponse);
51
- }
52
- export declare class NotImplementedException extends HttpException {
53
- constructor(message?: ExceptionResponse);
54
- }
55
- export declare class BadGatewayException extends HttpException {
56
- constructor(message?: ExceptionResponse);
57
- }
58
- export declare class ServiceUnavailableException extends HttpException {
59
- constructor(message?: ExceptionResponse);
60
- }
61
- export declare class GatewayTimeoutException extends HttpException {
62
- constructor(message?: ExceptionResponse);
63
- }
@@ -1,142 +0,0 @@
1
- export class HttpException extends Error {
2
- statusCode;
3
- _response;
4
- constructor(response, statusCode){
5
- const message = typeof response === 'string' ? response : JSON.stringify(response);
6
- super(message);
7
- this.name = 'HttpException';
8
- this.statusCode = statusCode;
9
- this._response = response;
10
- Object.setPrototypeOf(this, new.target.prototype);
11
- }
12
- getStatus() {
13
- return this.statusCode;
14
- }
15
- getResponse() {
16
- if (typeof this._response === 'string') {
17
- return {
18
- statusCode: this.statusCode,
19
- message: this._response
20
- };
21
- }
22
- return this._response;
23
- }
24
- // The constructor's original argument, untransformed — a string message or a
25
- // caller-supplied object. The canonical HTTP edge branches on this: string
26
- // responses become `{ error: { code, message } }`, object responses ship
27
- // verbatim (crud envelope compat). Distinct from `getResponse()`, which wraps
28
- // strings in the legacy `{ statusCode, message }` shape.
29
- getRawResponse() {
30
- return this._response;
31
- }
32
- }
33
- // 4xx
34
- export class BadRequestException extends HttpException {
35
- constructor(message = 'Bad Request'){
36
- super(message, 400);
37
- this.name = 'BadRequestException';
38
- }
39
- }
40
- export class UnauthorizedException extends HttpException {
41
- constructor(message = 'Unauthorized'){
42
- super(message, 401);
43
- this.name = 'UnauthorizedException';
44
- }
45
- }
46
- export class ForbiddenException extends HttpException {
47
- constructor(message = 'Forbidden'){
48
- super(message, 403);
49
- this.name = 'ForbiddenException';
50
- }
51
- }
52
- export class NotFoundException extends HttpException {
53
- constructor(message = 'Not Found'){
54
- super(message, 404);
55
- this.name = 'NotFoundException';
56
- }
57
- }
58
- export class MethodNotAllowedException extends HttpException {
59
- constructor(message = 'Method Not Allowed'){
60
- super(message, 405);
61
- this.name = 'MethodNotAllowedException';
62
- }
63
- }
64
- export class NotAcceptableException extends HttpException {
65
- constructor(message = 'Not Acceptable'){
66
- super(message, 406);
67
- this.name = 'NotAcceptableException';
68
- }
69
- }
70
- export class RequestTimeoutException extends HttpException {
71
- constructor(message = 'Request Timeout'){
72
- super(message, 408);
73
- this.name = 'RequestTimeoutException';
74
- }
75
- }
76
- export class ConflictException extends HttpException {
77
- constructor(message = 'Conflict'){
78
- super(message, 409);
79
- this.name = 'ConflictException';
80
- }
81
- }
82
- export class GoneException extends HttpException {
83
- constructor(message = 'Gone'){
84
- super(message, 410);
85
- this.name = 'GoneException';
86
- }
87
- }
88
- export class PayloadTooLargeException extends HttpException {
89
- constructor(message = 'Payload Too Large'){
90
- super(message, 413);
91
- this.name = 'PayloadTooLargeException';
92
- }
93
- }
94
- export class UnsupportedMediaTypeException extends HttpException {
95
- constructor(message = 'Unsupported Media Type'){
96
- super(message, 415);
97
- this.name = 'UnsupportedMediaTypeException';
98
- }
99
- }
100
- export class UnprocessableEntityException extends HttpException {
101
- constructor(message = 'Unprocessable Entity'){
102
- super(message, 422);
103
- this.name = 'UnprocessableEntityException';
104
- }
105
- }
106
- export class TooManyRequestsException extends HttpException {
107
- constructor(message = 'Too Many Requests'){
108
- super(message, 429);
109
- this.name = 'TooManyRequestsException';
110
- }
111
- }
112
- // 5xx
113
- export class InternalServerErrorException extends HttpException {
114
- constructor(message = 'Internal Server Error'){
115
- super(message, 500);
116
- this.name = 'InternalServerErrorException';
117
- }
118
- }
119
- export class NotImplementedException extends HttpException {
120
- constructor(message = 'Not Implemented'){
121
- super(message, 501);
122
- this.name = 'NotImplementedException';
123
- }
124
- }
125
- export class BadGatewayException extends HttpException {
126
- constructor(message = 'Bad Gateway'){
127
- super(message, 502);
128
- this.name = 'BadGatewayException';
129
- }
130
- }
131
- export class ServiceUnavailableException extends HttpException {
132
- constructor(message = 'Service Unavailable'){
133
- super(message, 503);
134
- this.name = 'ServiceUnavailableException';
135
- }
136
- }
137
- export class GatewayTimeoutException extends HttpException {
138
- constructor(message = 'Gateway Timeout'){
139
- super(message, 504);
140
- this.name = 'GatewayTimeoutException';
141
- }
142
- }
@@ -1 +0,0 @@
1
- export { HttpException, BadRequestException, UnauthorizedException, ForbiddenException, NotFoundException, MethodNotAllowedException, NotAcceptableException, RequestTimeoutException, ConflictException, GoneException, PayloadTooLargeException, UnsupportedMediaTypeException, UnprocessableEntityException, TooManyRequestsException, InternalServerErrorException, NotImplementedException, BadGatewayException, ServiceUnavailableException, GatewayTimeoutException, } from './http-exception';
@@ -1 +0,0 @@
1
- export { HttpException, BadRequestException, UnauthorizedException, ForbiddenException, NotFoundException, MethodNotAllowedException, NotAcceptableException, RequestTimeoutException, ConflictException, GoneException, PayloadTooLargeException, UnsupportedMediaTypeException, UnprocessableEntityException, TooManyRequestsException, InternalServerErrorException, NotImplementedException, BadGatewayException, ServiceUnavailableException, GatewayTimeoutException } from "./http-exception.js";
@@ -1 +0,0 @@
1
- export declare function OnEvent(event: string): MethodDecorator;
@@ -1,10 +0,0 @@
1
- import { MetadataRegistry } from "../registry/metadata.registry.js";
2
- import { ON_EVENT_METADATA } from "./event-emitter.tokens.js";
3
- export function OnEvent(event) {
4
- return (target, propertyKey)=>{
5
- MetadataRegistry.appendCustomClassMeta(target.constructor, ON_EVENT_METADATA, {
6
- event,
7
- methodName: String(propertyKey)
8
- });
9
- };
10
- }
@@ -1,2 +0,0 @@
1
- export declare class EventEmitterModule {
2
- }
@@ -1,23 +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
- import { Module } from "../module/index.js";
8
- import { EventEmitter } from "./event-emitter.service.js";
9
- import { EventEmitterSubscriber } from "./event-emitter.subscriber.js";
10
- export class EventEmitterModule {
11
- }
12
- EventEmitterModule = _ts_decorate([
13
- Module({
14
- lazy: true,
15
- providers: [
16
- EventEmitter,
17
- EventEmitterSubscriber
18
- ],
19
- exports: [
20
- EventEmitter
21
- ]
22
- })
23
- ], EventEmitterModule);
@@ -1,13 +0,0 @@
1
- import type { EventHandler } from './event-emitter.types';
2
- export declare class EventEmitter {
3
- private exactListeners;
4
- private exactOnceListeners;
5
- private wildcardListeners;
6
- on(event: string, handler: EventHandler): this;
7
- once(event: string, handler: EventHandler): this;
8
- off(event: string, handler: EventHandler): this;
9
- emit(event: string, ...args: unknown[]): Promise<void>;
10
- removeAllListeners(event?: string): this;
11
- listenerCount(event: string): number;
12
- private getOrCreateWildcard;
13
- }
@@ -1,127 +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
- import { Injectable } from "../container/index.js";
8
- function isWildcard(pattern) {
9
- return pattern.includes('*');
10
- }
11
- function compilePattern(pattern) {
12
- const regexStr = pattern.split('.').map((segment)=>{
13
- if (segment === '**') return '.*';
14
- if (segment === '*') return '[^.]+';
15
- return segment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
16
- }).join('\\.');
17
- return new RegExp(`^${regexStr}$`);
18
- }
19
- export class EventEmitter {
20
- exactListeners = new Map();
21
- exactOnceListeners = new Map();
22
- wildcardListeners = new Map();
23
- on(event, handler) {
24
- if (isWildcard(event)) {
25
- this.getOrCreateWildcard(event).handlers.add(handler);
26
- } else {
27
- const handlers = this.exactListeners.get(event) ?? new Set();
28
- handlers.add(handler);
29
- this.exactListeners.set(event, handlers);
30
- }
31
- return this;
32
- }
33
- once(event, handler) {
34
- this.on(event, handler);
35
- if (isWildcard(event)) {
36
- this.getOrCreateWildcard(event).onceHandlers.add(handler);
37
- } else {
38
- const onceSet = this.exactOnceListeners.get(event) ?? new Set();
39
- onceSet.add(handler);
40
- this.exactOnceListeners.set(event, onceSet);
41
- }
42
- return this;
43
- }
44
- off(event, handler) {
45
- if (isWildcard(event)) {
46
- const entry = this.wildcardListeners.get(event);
47
- if (entry) {
48
- entry.handlers.delete(handler);
49
- entry.onceHandlers.delete(handler);
50
- if (entry.handlers.size === 0) this.wildcardListeners.delete(event);
51
- }
52
- } else {
53
- const handlers = this.exactListeners.get(event);
54
- if (handlers) {
55
- handlers.delete(handler);
56
- this.exactOnceListeners.get(event)?.delete(handler);
57
- if (handlers.size === 0) this.exactListeners.delete(event);
58
- }
59
- }
60
- return this;
61
- }
62
- async emit(event, ...args) {
63
- const toRemove = [];
64
- // Exact match
65
- const exactHandlers = this.exactListeners.get(event);
66
- if (exactHandlers) {
67
- const onceSet = this.exactOnceListeners.get(event);
68
- await Promise.all([
69
- ...exactHandlers
70
- ].map(async (handler)=>{
71
- await handler(...args);
72
- if (onceSet?.has(handler)) {
73
- toRemove.push(()=>this.off(event, handler));
74
- }
75
- }));
76
- }
77
- // Wildcard match (regex pre-compiled at registration)
78
- for (const [pattern, entry] of this.wildcardListeners){
79
- if (!entry.regex.test(event)) continue;
80
- await Promise.all([
81
- ...entry.handlers
82
- ].map(async (handler)=>{
83
- await handler(...args);
84
- if (entry.onceHandlers.has(handler)) {
85
- toRemove.push(()=>this.off(pattern, handler));
86
- }
87
- }));
88
- }
89
- for (const remove of toRemove)remove();
90
- }
91
- removeAllListeners(event) {
92
- if (event) {
93
- if (isWildcard(event)) {
94
- this.wildcardListeners.delete(event);
95
- } else {
96
- this.exactListeners.delete(event);
97
- this.exactOnceListeners.delete(event);
98
- }
99
- } else {
100
- this.exactListeners.clear();
101
- this.exactOnceListeners.clear();
102
- this.wildcardListeners.clear();
103
- }
104
- return this;
105
- }
106
- listenerCount(event) {
107
- let count = this.exactListeners.get(event)?.size ?? 0;
108
- for (const entry of this.wildcardListeners.values()){
109
- if (entry.regex.test(event)) count += entry.handlers.size;
110
- }
111
- return count;
112
- }
113
- getOrCreateWildcard(pattern) {
114
- const existing = this.wildcardListeners.get(pattern);
115
- if (existing) return existing;
116
- const entry = {
117
- regex: compilePattern(pattern),
118
- handlers: new Set(),
119
- onceHandlers: new Set()
120
- };
121
- this.wildcardListeners.set(pattern, entry);
122
- return entry;
123
- }
124
- }
125
- EventEmitter = _ts_decorate([
126
- Injectable()
127
- ], EventEmitter);
@@ -1,9 +0,0 @@
1
- import { DiscoveryService } from '../discovery/discovery.service';
2
- import type { OnApplicationBootstrap } from '../lifecycle/index';
3
- import { EventEmitter } from './event-emitter.service';
4
- export declare class EventEmitterSubscriber implements OnApplicationBootstrap {
5
- private readonly discovery;
6
- private emitter;
7
- constructor(discovery: DiscoveryService, emitter: EventEmitter);
8
- onApplicationBootstrap(): void;
9
- }
@@ -1,45 +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 { Injectable, Inject } from "../container/index.js";
16
- import { DiscoveryService } from "../discovery/discovery.service.js";
17
- import { EventEmitter } from "./event-emitter.service.js";
18
- import { ON_EVENT_METADATA } from "./event-emitter.tokens.js";
19
- export class EventEmitterSubscriber {
20
- discovery;
21
- emitter;
22
- constructor(discovery, emitter){
23
- this.discovery = discovery;
24
- this.emitter = emitter;
25
- }
26
- onApplicationBootstrap() {
27
- for (const found of this.discovery.methodsWithMeta(ON_EVENT_METADATA)){
28
- const instance = found.class.instance;
29
- if (!instance) continue;
30
- const method = instance[found.methodName];
31
- if (typeof method === 'function') {
32
- this.emitter.on(found.meta.event, (...args)=>method.apply(instance, args));
33
- }
34
- }
35
- }
36
- }
37
- EventEmitterSubscriber = _ts_decorate([
38
- Injectable(),
39
- _ts_param(0, Inject(DiscoveryService)),
40
- _ts_metadata("design:type", Function),
41
- _ts_metadata("design:paramtypes", [
42
- typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
43
- typeof EventEmitter === "undefined" ? Object : EventEmitter
44
- ])
45
- ], EventEmitterSubscriber);
@@ -1 +0,0 @@
1
- export declare const ON_EVENT_METADATA = "vela:on-event";
@@ -1 +0,0 @@
1
- export const ON_EVENT_METADATA = 'vela:on-event';
@@ -1,5 +0,0 @@
1
- export type EventHandler = (...args: unknown[]) => void | Promise<void>;
2
- export interface OnEventMetadata {
3
- event: string;
4
- methodName: string;
5
- }
@@ -1 +0,0 @@
1
- export { };
@@ -1,6 +0,0 @@
1
- export { EventEmitterModule } from './event-emitter.module';
2
- export { EventEmitter } from './event-emitter.service';
3
- export { EventEmitterSubscriber } from './event-emitter.subscriber';
4
- export { OnEvent } from './event-emitter.decorators';
5
- export { ON_EVENT_METADATA } from './event-emitter.tokens';
6
- export type { EventHandler, OnEventMetadata } from './event-emitter.types';
@@ -1,5 +0,0 @@
1
- export { EventEmitterModule } from "./event-emitter.module.js";
2
- export { EventEmitter } from "./event-emitter.service.js";
3
- export { EventEmitterSubscriber } from "./event-emitter.subscriber.js";
4
- export { OnEvent } from "./event-emitter.decorators.js";
5
- export { ON_EVENT_METADATA } from "./event-emitter.tokens.js";
@@ -1,40 +0,0 @@
1
- import { type Catalog } from '@velajs/errors';
2
- import type { Type } from '../container/types';
3
- import type { ExceptionHandler } from './exception-handler';
4
- /**
5
- * Options for {@link ErrorsModule.forRoot}. Both fields are optional — an empty
6
- * `forRoot()` provides just the core catalog (`CORE_CATALOG`) and no custom
7
- * handler, which is the framework default anyway.
8
- */
9
- export interface ErrorsModuleOptions {
10
- /**
11
- * App-specific catalogs composed **onto** `CORE_CATALOG` via
12
- * {@link composeCatalogs}. Composition is eager (at `forRoot` call time), so a
13
- * duplicate code across two catalogs fails fast with `duplicate error code`.
14
- */
15
- catalogs?: Catalog<string>[];
16
- /**
17
- * The application-wide {@link ExceptionHandler}. A class is wired with
18
- * `useClass` (constructed through DI); a plain handler object with `useValue`.
19
- */
20
- handler?: Type<ExceptionHandler> | ExceptionHandler;
21
- }
22
- declare const ConfigurableModuleClass: import("..").ConfigurableModuleClassType<ErrorsModuleOptions, "forRoot", "create", {
23
- isGlobal?: boolean;
24
- }>;
25
- /**
26
- * Registers the application-wide error surface: the composed
27
- * {@link ERROR_CATALOG} that every transport edge redacts against, and an
28
- * optional {@link APP_EXCEPTION_HANDLER}. The imperative sibling is
29
- * `app.useGlobalExceptionHandler(handler)`.
30
- *
31
- * ```ts
32
- * @Module({
33
- * imports: [ErrorsModule.forRoot({ catalogs: [ordersCatalog], handler: SentryHandler })],
34
- * })
35
- * class AppModule {}
36
- * ```
37
- */
38
- export declare class ErrorsModule extends ConfigurableModuleClass {
39
- }
40
- export {};
@@ -1,46 +0,0 @@
1
- import { CORE_CATALOG, composeCatalogs } from "@velajs/errors";
2
- import { defineModule } from "../module/define-module.js";
3
- import { APP_EXCEPTION_HANDLER, ERROR_CATALOG } from "../pipeline/tokens.js";
4
- /** Lower a `handler` option to an {@link APP_EXCEPTION_HANDLER} provider. */ const handlerProvider = (handler)=>typeof handler === 'function' ? {
5
- provide: APP_EXCEPTION_HANDLER,
6
- useClass: handler
7
- } : {
8
- provide: APP_EXCEPTION_HANDLER,
9
- useValue: handler
10
- };
11
- const { ConfigurableModuleClass } = defineModule({
12
- name: 'Errors',
13
- setup: ({ options })=>{
14
- const providers = [
15
- {
16
- provide: ERROR_CATALOG,
17
- useValue: composeCatalogs(CORE_CATALOG, ...options.catalogs ?? [])
18
- }
19
- ];
20
- const exports = [
21
- ERROR_CATALOG
22
- ];
23
- if (options.handler) {
24
- providers.push(handlerProvider(options.handler));
25
- exports.push(APP_EXCEPTION_HANDLER);
26
- }
27
- return {
28
- providers,
29
- exports
30
- };
31
- }
32
- });
33
- /**
34
- * Registers the application-wide error surface: the composed
35
- * {@link ERROR_CATALOG} that every transport edge redacts against, and an
36
- * optional {@link APP_EXCEPTION_HANDLER}. The imperative sibling is
37
- * `app.useGlobalExceptionHandler(handler)`.
38
- *
39
- * ```ts
40
- * @Module({
41
- * imports: [ErrorsModule.forRoot({ catalogs: [ordersCatalog], handler: SentryHandler })],
42
- * })
43
- * class AppModule {}
44
- * ```
45
- */ export class ErrorsModule extends ConfigurableModuleClass {
46
- }
@@ -1,56 +0,0 @@
1
- import { type ErrorBodyResult } from '@velajs/errors';
2
- /**
3
- * A predicate for classifying an error, used by {@link ExceptionHandler.dontReport}.
4
- *
5
- * Three shapes are accepted:
6
- * - `string` — a Vela error code; matches when the error is a branded
7
- * `VelaError` whose `code` equals the string.
8
- * - a predicate `(error: unknown) => boolean` — **must be an arrow function**.
9
- * A class and a predicate are both `typeof 'function'`; {@link matchesAny}
10
- * discriminates on `prototype`, which arrow functions do not have.
11
- * - an error class constructor — matches via `instanceof`.
12
- *
13
- * Bound functions (e.g. `SomeClass.bind(null)`) also lack `.prototype`, so they
14
- * are treated as predicates and invoked — never as class matchers. Since a bound
15
- * constructor cannot be called without `new`, using one here throws; pass the
16
- * unbound class instead.
17
- */
18
- export type ErrorMatcher = string | ((error: unknown) => boolean) | (new (...args: never[]) => Error);
19
- /**
20
- * Ambient context handed to every reporting/rendering hook. `edge` names the
21
- * transport that caught the error; open-ended extra keys (via the index
22
- * signature) let a handler's `context()` enrich the payload.
23
- */
24
- export interface ErrorReportContext {
25
- edge: 'http' | 'ws' | 'live' | 'queue' | 'schedule' | 'hono';
26
- /** e.g. `'CatsController.findAll'` or a query name. */
27
- source?: string;
28
- /** e.g. `'exception filter threw'`. */
29
- note?: string;
30
- [key: string]: unknown;
31
- }
32
- /**
33
- * The application-wide exception handler contract. Provide an implementation
34
- * under {@link APP_EXCEPTION_HANDLER} to customize how errors are reported and
35
- * rendered. Every member is optional — an empty object is a valid handler.
36
- */
37
- export interface ExceptionHandler {
38
- /** Fire-and-forget reporting (logging, Sentry, …). May be async. */
39
- report?(error: unknown, ctx: ErrorReportContext): void | Promise<void>;
40
- /** Errors matching any of these are never reported. */
41
- dontReport?: ErrorMatcher[];
42
- /** Extra fields merged into the report context. Must be side-effect free. */
43
- context?(error: unknown, ctx: ErrorReportContext): Record<string, unknown>;
44
- /** Override the client-bound response for an error. */
45
- render?(error: unknown, ctx: unknown): Response | ErrorBodyResult | undefined;
46
- }
47
- /**
48
- * True when `error` matches any of `matchers`. A string matches a branded
49
- * {@link VelaError} by `code`; an arrow-function predicate is called; anything
50
- * else with a `prototype` is treated as an error class and matched via
51
- * `instanceof`. Predicates therefore MUST be arrow functions — a regular
52
- * `function` expression has a `prototype` and would be mistaken for a class.
53
- * Bound functions (e.g. `SomeClass.bind(null)`) lack `.prototype` too, so they
54
- * are invoked as predicates — don't pass a bound class as a class matcher.
55
- */
56
- export declare const matchesAny: (matchers: ErrorMatcher[] | undefined, error: unknown) => boolean;
@@ -1,17 +0,0 @@
1
- import { isVelaError } from "@velajs/errors";
2
- /**
3
- * True when `error` matches any of `matchers`. A string matches a branded
4
- * {@link VelaError} by `code`; an arrow-function predicate is called; anything
5
- * else with a `prototype` is treated as an error class and matched via
6
- * `instanceof`. Predicates therefore MUST be arrow functions — a regular
7
- * `function` expression has a `prototype` and would be mistaken for a class.
8
- * Bound functions (e.g. `SomeClass.bind(null)`) lack `.prototype` too, so they
9
- * are invoked as predicates — don't pass a bound class as a class matcher.
10
- */ export const matchesAny = (matchers, error)=>{
11
- if (!matchers?.length) return false;
12
- return matchers.some((m)=>{
13
- if (typeof m === 'string') return isVelaError(error) && error.code === m;
14
- if (typeof m === 'function' && !m.prototype) return m(error);
15
- return error instanceof m;
16
- });
17
- };
@@ -1,6 +0,0 @@
1
- export { matchesAny } from './exception-handler';
2
- export type { ErrorMatcher, ErrorReportContext, ExceptionHandler } from './exception-handler';
3
- export { ErrorsModule } from './errors.module';
4
- export type { ErrorsModuleOptions } from './errors.module';
5
- export { resolveErrorReporter } from './reporter';
6
- export type { ErrorReporter } from './reporter';
@@ -1,3 +0,0 @@
1
- export { matchesAny } from "./exception-handler.js";
2
- export { ErrorsModule } from "./errors.module.js";
3
- export { resolveErrorReporter } from "./reporter.js";