stratal 0.0.20 → 0.0.22

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 (247) hide show
  1. package/README.md +1 -1
  2. package/dist/{base-email.provider-CfQCA08m.mjs → base-email.provider-BWZHIjt8.mjs} +1 -1
  3. package/dist/{base-email.provider-CfQCA08m.mjs.map → base-email.provider-BWZHIjt8.mjs.map} +1 -1
  4. package/dist/bin/cloudflare-workers-loader.mjs.map +1 -1
  5. package/dist/bin/quarry.mjs +46 -109
  6. package/dist/bin/quarry.mjs.map +1 -1
  7. package/dist/cache/index.d.mts +6 -46
  8. package/dist/cache/index.d.mts.map +1 -1
  9. package/dist/cache/index.mjs +22 -67
  10. package/dist/cache/index.mjs.map +1 -1
  11. package/dist/{cache.service-DsnKuNyO.d.mts → cache.service-e34gV6tz.d.mts} +8 -8
  12. package/dist/{cache.service-DsnKuNyO.d.mts.map → cache.service-e34gV6tz.d.mts.map} +1 -1
  13. package/dist/{cache.tokens-B7Rw1C9Q.mjs → cache.tokens-ovi_c52J.mjs} +1 -1
  14. package/dist/{cache.tokens-B7Rw1C9Q.mjs.map → cache.tokens-ovi_c52J.mjs.map} +1 -1
  15. package/dist/{colors-DJaRDXoS.mjs → colors-axmupKdp.mjs} +1 -1
  16. package/dist/{colors-DJaRDXoS.mjs.map → colors-axmupKdp.mjs.map} +1 -1
  17. package/dist/{command-BgSlsS4M.mjs → command-BU4ApTo5.mjs} +2 -3
  18. package/dist/command-BU4ApTo5.mjs.map +1 -0
  19. package/dist/{command-Bu-PjJrX.d.mts → command-wXfvHbBZ.d.mts} +3 -2
  20. package/dist/command-wXfvHbBZ.d.mts.map +1 -0
  21. package/dist/config/index.d.mts +24 -11
  22. package/dist/config/index.d.mts.map +1 -1
  23. package/dist/config/index.mjs +33 -57
  24. package/dist/config/index.mjs.map +1 -1
  25. package/dist/{consumer-registry-B7yUNh0q.d.mts → consumer-registry-DHQtypr1.d.mts} +1 -1
  26. package/dist/{consumer-registry-B7yUNh0q.d.mts.map → consumer-registry-DHQtypr1.d.mts.map} +1 -1
  27. package/dist/container-storage-GpNNz79X.mjs +52 -0
  28. package/dist/container-storage-GpNNz79X.mjs.map +1 -0
  29. package/dist/{controller.decorator-DQzenvSN.mjs → controller.decorator-DIUazNU7.mjs} +8 -8
  30. package/dist/controller.decorator-DIUazNU7.mjs.map +1 -0
  31. package/dist/cron/index.d.mts +26 -5
  32. package/dist/cron/index.d.mts.map +1 -1
  33. package/dist/cron/index.mjs +1 -1
  34. package/dist/{cron-manager-7Symz_TE.mjs → cron-manager-9bpN9bu4.mjs} +42 -16
  35. package/dist/cron-manager-9bpN9bu4.mjs.map +1 -0
  36. package/dist/{cron-manager-BEsH1mjW.d.mts → cron-manager-CSTIBPcM.d.mts} +6 -13
  37. package/dist/cron-manager-CSTIBPcM.d.mts.map +1 -0
  38. package/dist/decorate-HgTKAYK8.mjs +16 -0
  39. package/dist/deep-merge-C8NgcXw4.mjs +18 -0
  40. package/dist/deep-merge-C8NgcXw4.mjs.map +1 -0
  41. package/dist/di/index.d.mts +2 -2
  42. package/dist/di/index.mjs +4 -3
  43. package/dist/di-BO1QIb5H.mjs +415 -0
  44. package/dist/di-BO1QIb5H.mjs.map +1 -0
  45. package/dist/email/index.d.mts +14 -89
  46. package/dist/email/index.d.mts.map +1 -1
  47. package/dist/email/index.mjs +30 -125
  48. package/dist/email/index.mjs.map +1 -1
  49. package/dist/en-BPP6h6y5.mjs +202 -0
  50. package/dist/en-BPP6h6y5.mjs.map +1 -0
  51. package/dist/{env-D1rcZ8_r.d.mts → env-DKSbuBi5.d.mts} +1 -1
  52. package/dist/env-DKSbuBi5.d.mts.map +1 -0
  53. package/dist/errors/index.d.mts +2 -2
  54. package/dist/errors/index.mjs +4 -2
  55. package/dist/errors-BBZTnjdq.mjs +333 -0
  56. package/dist/errors-BBZTnjdq.mjs.map +1 -0
  57. package/dist/events/index.d.mts +2 -2
  58. package/dist/events/index.d.mts.map +1 -1
  59. package/dist/events/index.mjs +1 -1
  60. package/dist/{events-COKixqnG.mjs → events-D1KdDaiP.mjs} +13 -11
  61. package/dist/events-D1KdDaiP.mjs.map +1 -0
  62. package/dist/exception-context-B4kM-M53.mjs +429 -0
  63. package/dist/exception-context-B4kM-M53.mjs.map +1 -0
  64. package/dist/{gateway-context-CdJjpUCW.mjs → gateway-context-CFe6a9gz.mjs} +20 -31
  65. package/dist/gateway-context-CFe6a9gz.mjs.map +1 -0
  66. package/dist/guards/index.d.mts +3 -3
  67. package/dist/guards/index.d.mts.map +1 -1
  68. package/dist/guards/index.mjs +1 -1
  69. package/dist/{guards-DUk_Kzst.mjs → guards-Ced-uNIF.mjs} +7 -5
  70. package/dist/guards-Ced-uNIF.mjs.map +1 -0
  71. package/dist/{http-method.decorator-DXwxAfb_.mjs → http-method.decorator-CdjKFJZZ.mjs} +7 -6
  72. package/dist/http-method.decorator-CdjKFJZZ.mjs.map +1 -0
  73. package/dist/i18n/index.d.mts +238 -3
  74. package/dist/i18n/index.d.mts.map +1 -0
  75. package/dist/i18n/index.mjs +39 -3
  76. package/dist/i18n/index.mjs.map +1 -0
  77. package/dist/i18n/messages/en/index.d.mts +2 -2
  78. package/dist/i18n/messages/en/index.mjs +2 -2
  79. package/dist/i18n/utils/index.d.mts +4 -26
  80. package/dist/i18n/utils/index.d.mts.map +1 -1
  81. package/dist/i18n/utils/index.mjs +2 -2
  82. package/dist/i18n/validation/index.d.mts +3 -2
  83. package/dist/i18n/validation/index.mjs +4 -2
  84. package/dist/i18n.module-BlXrtAlV.mjs +219 -0
  85. package/dist/i18n.module-BlXrtAlV.mjs.map +1 -0
  86. package/dist/i18n.tokens-hwRpmjRq.mjs +19 -0
  87. package/dist/i18n.tokens-hwRpmjRq.mjs.map +1 -0
  88. package/dist/{index-7-hU3GTV.d.mts → index-B4UBK-2T.d.mts} +1 -1
  89. package/dist/{index-7-hU3GTV.d.mts.map → index-B4UBK-2T.d.mts.map} +1 -1
  90. package/dist/index-BtlE9RuO.d.mts +124 -0
  91. package/dist/index-BtlE9RuO.d.mts.map +1 -0
  92. package/dist/{index-CjaQ6_tZ.d.mts → index-CW1YHSft.d.mts} +71 -167
  93. package/dist/index-CW1YHSft.d.mts.map +1 -0
  94. package/dist/{index-D0US0X14.d.mts → index-DEncMcC6.d.mts} +559 -2239
  95. package/dist/index-DEncMcC6.d.mts.map +1 -0
  96. package/dist/index-Dj5IMwtr.d.mts +44 -0
  97. package/dist/index-Dj5IMwtr.d.mts.map +1 -0
  98. package/dist/{index-C1KvMncZ.d.mts → index-KMgSCSM7.d.mts} +3 -108
  99. package/dist/index-KMgSCSM7.d.mts.map +1 -0
  100. package/dist/index.d.mts +5 -43
  101. package/dist/index.mjs +1 -1
  102. package/dist/{is-command-C6a7WTPw.mjs → is-command-CX5rAfZW.mjs} +2 -2
  103. package/dist/{is-command-C6a7WTPw.mjs.map → is-command-CX5rAfZW.mjs.map} +1 -1
  104. package/dist/{is-seeder-CebjZCDn.mjs → is-seeder-CYCtELlm.mjs} +1 -1
  105. package/dist/{is-seeder-CebjZCDn.mjs.map → is-seeder-CYCtELlm.mjs.map} +1 -1
  106. package/dist/logger/index.d.mts +2 -2
  107. package/dist/logger/index.mjs +170 -2
  108. package/dist/logger/index.mjs.map +1 -0
  109. package/dist/macroable/index.d.mts +1 -1
  110. package/dist/macroable/index.mjs +1 -1
  111. package/dist/{macroable-BmufBshB.mjs → macroable-DzlfzT50.mjs} +1 -1
  112. package/dist/{macroable-BmufBshB.mjs.map → macroable-DzlfzT50.mjs.map} +1 -1
  113. package/dist/metadata-BVkc4aUu.mjs +39 -0
  114. package/dist/metadata-BVkc4aUu.mjs.map +1 -0
  115. package/dist/module/index.d.mts +6 -24
  116. package/dist/module/index.d.mts.map +1 -1
  117. package/dist/module/index.mjs +2 -2
  118. package/dist/module-xYoHba6B.mjs +422 -0
  119. package/dist/module-xYoHba6B.mjs.map +1 -0
  120. package/dist/openapi/index.d.mts +3 -3
  121. package/dist/openapi/index.d.mts.map +1 -1
  122. package/dist/openapi/index.mjs +1 -2
  123. package/dist/openapi-C6lm0RmV.mjs +483 -0
  124. package/dist/openapi-C6lm0RmV.mjs.map +1 -0
  125. package/dist/{openapi.service-BLgvn3hJ.d.mts → openapi.service-CrLlsXAd.d.mts} +3 -3
  126. package/dist/openapi.service-CrLlsXAd.d.mts.map +1 -0
  127. package/dist/quarry/index.d.mts +5 -163
  128. package/dist/quarry/index.d.mts.map +1 -1
  129. package/dist/quarry/index.mjs +5 -5
  130. package/dist/quarry/runner.d.mts +184 -0
  131. package/dist/quarry/runner.d.mts.map +1 -0
  132. package/dist/quarry/runner.mjs +775 -0
  133. package/dist/quarry/runner.mjs.map +1 -0
  134. package/dist/quarry-registry-D4hIGScf.d.mts +69 -0
  135. package/dist/quarry-registry-D4hIGScf.d.mts.map +1 -0
  136. package/dist/quarry-registry-DkraZNwn.mjs +311 -0
  137. package/dist/quarry-registry-DkraZNwn.mjs.map +1 -0
  138. package/dist/queue/index.d.mts +3 -3
  139. package/dist/queue/index.mjs +27 -28
  140. package/dist/queue/index.mjs.map +1 -1
  141. package/dist/{queue.module-BCdCiySt.mjs → queue.module-DeWJ0tQM.mjs} +67 -112
  142. package/dist/queue.module-DeWJ0tQM.mjs.map +1 -0
  143. package/dist/{r2-storage.provider-Co6F0ZYV.mjs → r2-storage.provider-Hfm6LdZQ.mjs} +8 -5
  144. package/dist/r2-storage.provider-Hfm6LdZQ.mjs.map +1 -0
  145. package/dist/{rate-limit.decorator--o6Q6p9w.mjs → rate-limit.decorator-D69zdZbp.mjs} +6 -11
  146. package/dist/rate-limit.decorator-D69zdZbp.mjs.map +1 -0
  147. package/dist/rate-limiter/index.d.mts +11 -50
  148. package/dist/rate-limiter/index.d.mts.map +1 -1
  149. package/dist/rate-limiter/index.mjs +25 -30
  150. package/dist/rate-limiter/index.mjs.map +1 -1
  151. package/dist/{resend.provider-M6qRLrcy.mjs → resend.provider-Ur6tU7fK.mjs} +8 -7
  152. package/dist/resend.provider-Ur6tU7fK.mjs.map +1 -0
  153. package/dist/router/index.d.mts +2 -2
  154. package/dist/router/index.mjs +8 -7
  155. package/dist/{i18n.module-BBlNNlcG.mjs → router-Cy6DjkvP.mjs} +215 -855
  156. package/dist/router-Cy6DjkvP.mjs.map +1 -0
  157. package/dist/seeder/index.d.mts +6 -11
  158. package/dist/seeder/index.d.mts.map +1 -1
  159. package/dist/seeder/index.mjs +3 -3
  160. package/dist/{seeder-CJAOHEIo.mjs → seeder-BADTig4n.mjs} +17 -22
  161. package/dist/seeder-BADTig4n.mjs.map +1 -0
  162. package/dist/{signed-url-BQPbv2In.mjs → signed-url-BqUqt5dF.mjs} +1 -1
  163. package/dist/{signed-url-BQPbv2In.mjs.map → signed-url-BqUqt5dF.mjs.map} +1 -1
  164. package/dist/{smtp.provider-w0Ve52Xg.mjs → smtp.provider-C129sNBT.mjs} +7 -6
  165. package/dist/smtp.provider-C129sNBT.mjs.map +1 -0
  166. package/dist/storage/index.d.mts +15 -39
  167. package/dist/storage/index.d.mts.map +1 -1
  168. package/dist/storage/index.mjs +3 -3
  169. package/dist/storage/providers/index.d.mts +2 -2
  170. package/dist/storage/providers/index.mjs +1 -1
  171. package/dist/{storage-1zw-6Yiz.mjs → storage-BA3ppVYM.mjs} +70 -59
  172. package/dist/storage-BA3ppVYM.mjs.map +1 -0
  173. package/dist/{storage-provider.interface-Bd6vA4ak.d.mts → storage-provider.interface-DQMtT42e.d.mts} +2 -3
  174. package/dist/storage-provider.interface-DQMtT42e.d.mts.map +1 -0
  175. package/dist/storage.error-C6FY037a.mjs +8 -0
  176. package/dist/storage.error-C6FY037a.mjs.map +1 -0
  177. package/dist/{stratal-DeEcGgdq.mjs → stratal-Bdq4IdB3.mjs} +31 -183
  178. package/dist/stratal-Bdq4IdB3.mjs.map +1 -0
  179. package/dist/stratal-BsKmvP6J.d.mts +43 -0
  180. package/dist/stratal-BsKmvP6J.d.mts.map +1 -0
  181. package/dist/{types-cySNS_lp.d.mts → types-BaeHi67f.d.mts} +1 -1
  182. package/dist/types-BaeHi67f.d.mts.map +1 -0
  183. package/dist/{usage-generator-BUdlhnCK.mjs → usage-generator-DTqaUMR9.mjs} +6 -3
  184. package/dist/usage-generator-DTqaUMR9.mjs.map +1 -0
  185. package/dist/validation-DUzcjb8Q.mjs +49 -0
  186. package/dist/validation-DUzcjb8Q.mjs.map +1 -0
  187. package/dist/validation.context-XTysWJ3b.mjs +117 -0
  188. package/dist/validation.context-XTysWJ3b.mjs.map +1 -0
  189. package/dist/websocket/index.d.mts +7 -14
  190. package/dist/websocket/index.d.mts.map +1 -1
  191. package/dist/websocket/index.mjs +2 -2
  192. package/dist/workers/index.d.mts +2 -2
  193. package/dist/workers/index.mjs +3 -2
  194. package/dist/workers/index.mjs.map +1 -1
  195. package/dist/{index-Bnpfq6uk.d.mts → zod-DvWTfRpI.d.mts} +58 -133
  196. package/dist/zod-DvWTfRpI.d.mts.map +1 -0
  197. package/dist/zod-hMa3rSHV.mjs +72 -0
  198. package/dist/zod-hMa3rSHV.mjs.map +1 -0
  199. package/package.json +20 -20
  200. package/dist/command-BgSlsS4M.mjs.map +0 -1
  201. package/dist/command-Bu-PjJrX.d.mts.map +0 -1
  202. package/dist/controller.decorator-DQzenvSN.mjs.map +0 -1
  203. package/dist/cron-manager-7Symz_TE.mjs.map +0 -1
  204. package/dist/cron-manager-BEsH1mjW.d.mts.map +0 -1
  205. package/dist/en-DSH_bhh6.mjs +0 -308
  206. package/dist/en-DSH_bhh6.mjs.map +0 -1
  207. package/dist/env-D1rcZ8_r.d.mts.map +0 -1
  208. package/dist/errors-BdyV5PnY.mjs +0 -1725
  209. package/dist/errors-BdyV5PnY.mjs.map +0 -1
  210. package/dist/errors-Da3Pz2X7.mjs +0 -74
  211. package/dist/errors-Da3Pz2X7.mjs.map +0 -1
  212. package/dist/events-COKixqnG.mjs.map +0 -1
  213. package/dist/gateway-context-CdJjpUCW.mjs.map +0 -1
  214. package/dist/guards-DUk_Kzst.mjs.map +0 -1
  215. package/dist/http-method.decorator-DXwxAfb_.mjs.map +0 -1
  216. package/dist/i18n.module-BBlNNlcG.mjs.map +0 -1
  217. package/dist/index-Bnpfq6uk.d.mts.map +0 -1
  218. package/dist/index-C1KvMncZ.d.mts.map +0 -1
  219. package/dist/index-CjaQ6_tZ.d.mts.map +0 -1
  220. package/dist/index-D0US0X14.d.mts.map +0 -1
  221. package/dist/index-DBd_2wv8.d.mts +0 -263
  222. package/dist/index-DBd_2wv8.d.mts.map +0 -1
  223. package/dist/index.d.mts.map +0 -1
  224. package/dist/logger-V6Ms3QnQ.mjs +0 -436
  225. package/dist/logger-V6Ms3QnQ.mjs.map +0 -1
  226. package/dist/module-Dk2qTa77.mjs +0 -860
  227. package/dist/module-Dk2qTa77.mjs.map +0 -1
  228. package/dist/openapi-tools.service-Zs-Ewv7F.mjs +0 -200
  229. package/dist/openapi-tools.service-Zs-Ewv7F.mjs.map +0 -1
  230. package/dist/openapi.service-BLgvn3hJ.d.mts.map +0 -1
  231. package/dist/quarry-registry-DNEej-Db.mjs +0 -688
  232. package/dist/quarry-registry-DNEej-Db.mjs.map +0 -1
  233. package/dist/queue.module-BCdCiySt.mjs.map +0 -1
  234. package/dist/r2-storage.provider-Co6F0ZYV.mjs.map +0 -1
  235. package/dist/rate-limit.decorator--o6Q6p9w.mjs.map +0 -1
  236. package/dist/resend.provider-M6qRLrcy.mjs.map +0 -1
  237. package/dist/seeder-CJAOHEIo.mjs.map +0 -1
  238. package/dist/setup-CefZKV_e.mjs +0 -37
  239. package/dist/setup-CefZKV_e.mjs.map +0 -1
  240. package/dist/smtp.provider-w0Ve52Xg.mjs.map +0 -1
  241. package/dist/storage-1zw-6Yiz.mjs.map +0 -1
  242. package/dist/storage-provider.interface-Bd6vA4ak.d.mts.map +0 -1
  243. package/dist/stratal-DeEcGgdq.mjs.map +0 -1
  244. package/dist/types-cySNS_lp.d.mts.map +0 -1
  245. package/dist/usage-generator-BUdlhnCK.mjs.map +0 -1
  246. package/dist/validation-DtJwAv7O.mjs +0 -248
  247. package/dist/validation-DtJwAv7O.mjs.map +0 -1
@@ -1,93 +1,30 @@
1
- import { d as ApplicationError, gn as AsyncModuleOptions, vn as DynamicModule } from "./index-D0US0X14.mjs";
2
- import { t as StratalEnv } from "./env-D1rcZ8_r.mjs";
3
- import { b as II18nService } from "./index-Bnpfq6uk.mjs";
4
- import { r as QueueMessage, t as ConsumerRegistry } from "./consumer-registry-B7yUNh0q.mjs";
1
+ import { Sn as AsyncModuleOptions, wn as DynamicModule, xr as ApplicationError } from "./index-DEncMcC6.mjs";
2
+ import { t as StratalEnv } from "./env-DKSbuBi5.mjs";
3
+ import { p as II18nService } from "./zod-DvWTfRpI.mjs";
4
+ import { r as LoggerService } from "./index-BtlE9RuO.mjs";
5
+ import { r as QueueMessage, t as ConsumerRegistry } from "./consumer-registry-DHQtypr1.mjs";
5
6
 
6
7
  //#region src/queue/queue-manager.d.ts
7
- /**
8
- * Queue Manager
9
- *
10
- * Singleton service for processing queue message batches.
11
- * Routes messages to consumers based on message type.
12
- *
13
- * **Message Routing:**
14
- * - Consumers declare message types they handle (e.g., ['email.send'])
15
- * - When a message arrives, consumers matching the message type are invoked
16
- * - A consumer can handle messages from ANY queue (routing is by type, not queue)
17
- *
18
- * **Note:** For sending messages to queues, use IQueueSender instances
19
- * obtained via @InjectQueue('queue-name') or module bindings.
20
- *
21
- * @example Processing a queue batch
22
- * ```typescript
23
- * // In Cloudflare Worker queue handler
24
- * await queueManager.processBatch('notifications-queue', batch)
25
- * ```
26
- */
27
8
  declare class QueueManager {
28
9
  private readonly registry;
29
- constructor(registry: ConsumerRegistry);
30
- /**
31
- * Process a batch of queue messages
32
- *
33
- * Routes messages to registered consumers based on message type.
34
- * Uses ConsumerRegistry to find matching consumers.
35
- *
36
- * @param _queueName - Name of the queue (for logging, not used for routing)
37
- * @param batch - Batch of messages from Cloudflare Queue
38
- */
39
- processBatch(_queueName: string, batch: MessageBatch): Promise<void>;
10
+ private readonly logger;
11
+ constructor(registry: ConsumerRegistry, logger: LoggerService);
12
+ processBatch(queueName: string, batch: MessageBatch): Promise<void>;
40
13
  }
41
14
  //#endregion
42
- //#region src/queue/queue-name.d.ts
15
+ //#region src/queue/queue-binding.d.ts
43
16
  /**
44
- * Queue Name Type System with Module Augmentation
45
- *
46
- * This file provides a type-safe queue naming system using module augmentation.
47
- * Applications augment the QueueNames interface to get autocomplete for queue names.
48
- *
49
- * @example In apps/backend/src/types/queues.ts:
50
- * ```typescript
51
- * declare module 'stratal' {
52
- * interface QueueNames {
53
- * 'notifications-queue': true
54
- * 'batch-notifications-queue': true
55
- * }
56
- * }
57
- * ```
58
- *
59
- * When QueueNames is augmented, QueueName provides autocomplete.
60
- * When not augmented, QueueName falls back to string for flexibility.
61
- */
62
- /**
63
- * Augmentable interface for queue names.
64
- *
65
- * Applications extend this interface via module augmentation to define
66
- * their queue names. The keys become the valid queue name union type.
67
- *
68
- * @example
69
- * ```typescript
70
- * // In your application's type declarations
71
- * declare module 'stratal' {
72
- * interface QueueNames {
73
- * 'notifications-queue': true
74
- * 'batch-notifications-queue': true
75
- * }
76
- * }
77
- * ```
17
+ * String keys of `StratalEnv` whose value type is `Queue`.
78
18
  */
79
- interface QueueNames {}
19
+ type QueueBindingFromEnv = Extract<{ [K in keyof StratalEnv]: StratalEnv[K] extends Queue ? K : never }[keyof StratalEnv], string>;
80
20
  /**
81
- * Queue name type - extracts keys from QueueNames or falls back to string.
21
+ * Type-safe queue binding identifier.
82
22
  *
83
- * When QueueNames is augmented with queue name keys, this type provides:
84
- * - Type safety: Only declared queue names are valid
85
- * - Autocomplete: IDE suggestions for available queue names
86
- *
87
- * When QueueNames is empty (not augmented), falls back to string
88
- * for flexibility during development or in non-typed contexts.
23
+ * Resolves to the union of `Queue`-typed binding keys on the augmented
24
+ * `StratalEnv`. Falls back to `string` when no `Queue` bindings are visible
25
+ * (e.g. library code compiled outside an app's env context).
89
26
  */
90
- type QueueName = keyof QueueNames extends never ? string : keyof QueueNames;
27
+ type QueueBinding = [QueueBindingFromEnv] extends [never] ? string : QueueBindingFromEnv;
91
28
  //#endregion
92
29
  //#region src/queue/queue-sender.interface.d.ts
93
30
  /**
@@ -149,7 +86,7 @@ interface IQueueSender {
149
86
  * @example Implementing a custom provider
150
87
  * ```typescript
151
88
  * export class CustomQueueProvider implements IQueueProvider {
152
- * async send<T>(queueName: string, message: QueueMessage<T>): Promise<void> {
89
+ * async send<T>(binding: string, message: QueueMessage<T>): Promise<void> {
153
90
  * // Custom implementation
154
91
  * }
155
92
  * }
@@ -160,30 +97,27 @@ interface IQueueProvider {
160
97
  * Send a message to a queue
161
98
  *
162
99
  * Provider handles the actual delivery mechanism:
163
- * - CloudflareQueueProvider: Resolves CF binding and calls queue.send()
100
+ * - CloudflareQueueProvider: Looks up the binding on env and calls queue.send()
164
101
  * - SyncQueueProvider: Finds matching consumers and calls handle() directly
165
102
  *
166
- * @param queueName - Queue name
103
+ * @param binding - Queue binding identifier
167
104
  * @param message - Complete message with id, timestamp, and metadata
168
105
  */
169
- send<T>(queueName: string, message: QueueMessage<T>): Promise<void>;
106
+ send<T>(binding: string, message: QueueMessage<T>): Promise<void>;
170
107
  }
171
108
  //#endregion
172
109
  //#region src/queue/providers/cloudflare-queue.provider.d.ts
173
110
  /**
174
111
  * Cloudflare Queue Provider
175
112
  *
176
- * Sends messages to Cloudflare Queues by resolving bindings from the environment.
177
- * Used in production environments where Cloudflare Workers handle queue processing.
178
- *
179
- * **Binding Resolution:**
180
- * Queue names are converted to binding names:
181
- * - `notifications-queue` → `NOTIFICATIONS_QUEUE`
113
+ * Sends messages to Cloudflare Queues by resolving the binding directly on
114
+ * the worker's `env`. Used in production environments where Cloudflare Workers
115
+ * handle queue processing.
182
116
  *
183
117
  * @example
184
118
  * ```typescript
185
119
  * const provider = new CloudflareQueueProvider(env)
186
- * await provider.send('notifications-queue', message)
120
+ * await provider.send('NOTIFICATIONS_QUEUE', message)
187
121
  * ```
188
122
  */
189
123
  declare class CloudflareQueueProvider implements IQueueProvider {
@@ -192,21 +126,11 @@ declare class CloudflareQueueProvider implements IQueueProvider {
192
126
  /**
193
127
  * Send a message to a Cloudflare Queue
194
128
  *
195
- * @param queueName - Queue name (e.g., 'notifications-queue')
129
+ * @param binding - Queue binding identifier (e.g., 'NOTIFICATIONS_QUEUE')
196
130
  * @param message - Complete message with id, timestamp, and payload
197
- * @throws {QueueBindingNotFoundError} If queue binding is not configured
198
- */
199
- send<T>(queueName: string, message: QueueMessage<T>): Promise<void>;
200
- /**
201
- * Resolve queue binding from Cloudflare environment
202
- *
203
- * Converts kebab-case queue name to UPPER_SNAKE_CASE binding name.
204
- *
205
- * @param queueName - Queue name (e.g., 'notifications-queue')
206
- * @returns Cloudflare Queue binding
207
- * @throws {QueueBindingNotFoundError} If binding not found in env
131
+ * @throws {QueueError} If the binding is not configured on env
208
132
  */
209
- private getQueue;
133
+ send<T>(binding: string, message: QueueMessage<T>): Promise<void>;
210
134
  }
211
135
  //#endregion
212
136
  //#region src/queue/providers/sync-queue.provider.d.ts
@@ -230,7 +154,7 @@ declare class CloudflareQueueProvider implements IQueueProvider {
230
154
  * @example Testing with sync provider
231
155
  * ```typescript
232
156
  * const provider = new SyncQueueProvider(registry)
233
- * await provider.send('notifications-queue', {
157
+ * await provider.send('NOTIFICATIONS_QUEUE', {
234
158
  * id: '123',
235
159
  * timestamp: Date.now(),
236
160
  * type: 'email.send',
@@ -248,19 +172,19 @@ declare class SyncQueueProvider implements IQueueProvider {
248
172
  * Finds all matching consumers by message type and calls their handle() method.
249
173
  * If any consumer throws, onError() is called and the error is re-thrown.
250
174
  *
251
- * @param _queueName - Queue name (not used for routing, consumers match by message type)
175
+ * @param _binding - Queue binding (not used for routing, consumers match by message type)
252
176
  * @param message - Complete message with id, timestamp, and payload
253
177
  * @throws Re-throws any error from consumer.handle() after calling onError()
254
178
  */
255
- send<T>(_queueName: string, message: QueueMessage<T>): Promise<void>;
179
+ send<T>(_binding: string, message: QueueMessage<T>): Promise<void>;
256
180
  }
257
181
  //#endregion
258
182
  //#region src/queue/queue-sender.d.ts
259
183
  /**
260
184
  * Queue Sender
261
185
  *
262
- * Implementation of IQueueSender bound to a specific queue name.
263
- * Created by QueueRegistry for each registered queue.
186
+ * Implementation of IQueueSender bound to a specific queue binding.
187
+ * Created by QueueRegistry for each registered binding.
264
188
  *
265
189
  * Automatically enriches messages with:
266
190
  * - `id`: UUID generated via crypto.randomUUID()
@@ -270,7 +194,7 @@ declare class SyncQueueProvider implements IQueueProvider {
270
194
  * @example
271
195
  * ```typescript
272
196
  * // Created by QueueRegistry, not directly instantiated
273
- * const sender = registry.getQueue('notifications-queue')
197
+ * const sender = registry.getQueue('NOTIFICATIONS_QUEUE')
274
198
  *
275
199
  * await sender.dispatch({
276
200
  * type: 'email.send',
@@ -279,10 +203,10 @@ declare class SyncQueueProvider implements IQueueProvider {
279
203
  * ```
280
204
  */
281
205
  declare class QueueSender implements IQueueSender {
282
- private readonly queueName;
206
+ private readonly binding;
283
207
  private readonly provider;
284
208
  private readonly i18n;
285
- constructor(queueName: string, provider: IQueueProvider, i18n: II18nService);
209
+ constructor(binding: string, provider: IQueueProvider, i18n: II18nService);
286
210
  /**
287
211
  * Dispatch a message to this queue.
288
212
  *
@@ -324,24 +248,26 @@ declare class QueueModule {
324
248
  */
325
249
  static forRootAsync(options: AsyncModuleOptions<QueueModuleOptions>): DynamicModule;
326
250
  /**
327
- * Register a queue for injection.
251
+ * Register a queue binding for injection.
328
252
  *
329
- * The queue name serves as both the identifier and the DI injection token.
330
- * Queue names are typed via module augmentation of QueueNames interface.
253
+ * The binding name doubles as the DI injection token and the
254
+ * `env`-lookup key. Binding names are typed against `StratalEnv`
255
+ * (autocomplete works once an app augments `StratalEnv` with its
256
+ * Cloudflare bindings).
331
257
  *
332
- * @param name - Queue name (typed with autocomplete if QueueNames is augmented)
258
+ * @param binding - Queue binding identifier (e.g. `NOTIFICATIONS_QUEUE`).
333
259
  * @returns Dynamic module that provides the queue sender
334
260
  *
335
261
  * @example
336
262
  * ```typescript
337
263
  * // In AppModule imports
338
- * QueueModule.registerQueue('notifications-queue')
264
+ * QueueModule.registerQueue('NOTIFICATIONS_QUEUE')
339
265
  *
340
- * // Then inject using the queue name
341
- * constructor(@InjectQueue('notifications-queue') private queue: IQueueSender) {}
266
+ * // Then inject using the binding name
267
+ * constructor(@InjectQueue('NOTIFICATIONS_QUEUE') private queue: IQueueSender) {}
342
268
  * ```
343
269
  */
344
- static registerQueue(name: QueueName): DynamicModule;
270
+ static registerQueue(binding: QueueBinding): DynamicModule;
345
271
  }
346
272
  //#endregion
347
273
  //#region src/queue/services/queue-provider-factory.d.ts
@@ -377,7 +303,7 @@ declare class QueueProviderFactory {
377
303
  * Create a queue provider based on module configuration
378
304
  *
379
305
  * @returns Queue provider instance
380
- * @throws {QueueProviderNotSupportedError} If provider type is not supported
306
+ * @throws {QueueError} If provider type is not supported
381
307
  */
382
308
  create(): IQueueProvider;
383
309
  }
@@ -387,10 +313,10 @@ declare class QueueProviderFactory {
387
313
  * Queue Registry
388
314
  *
389
315
  * Request-scoped factory service for creating QueueSender instances.
390
- * Caches senders per queue name within the request scope.
316
+ * Caches senders per binding within the request scope.
391
317
  *
392
318
  * This service is used internally by QueueModule.registerQueue() to provide
393
- * IQueueSender instances for each registered queue.
319
+ * IQueueSender instances for each registered binding.
394
320
  *
395
321
  * **Why request-scoped?**
396
322
  * - Needs access to I18nService for locale-aware message metadata
@@ -400,12 +326,12 @@ declare class QueueProviderFactory {
400
326
  * @example
401
327
  * ```typescript
402
328
  * // Used internally by QueueModule.registerQueue()
403
- * QueueModule.registerQueue('notifications-queue')
329
+ * QueueModule.registerQueue('NOTIFICATIONS_QUEUE')
404
330
  *
405
331
  * // The module creates a factory provider:
406
332
  * {
407
- * provide: 'notifications-queue',
408
- * useFactory: (registry: QueueRegistry) => registry.getQueue('notifications-queue'),
333
+ * provide: 'NOTIFICATIONS_QUEUE',
334
+ * useFactory: (registry: QueueRegistry) => registry.getQueue('NOTIFICATIONS_QUEUE'),
409
335
  * inject: [QUEUE_TOKENS.QueueRegistry],
410
336
  * }
411
337
  * ```
@@ -416,34 +342,34 @@ declare class QueueRegistry {
416
342
  private readonly senders;
417
343
  constructor(providerFactory: QueueProviderFactory, i18n: II18nService);
418
344
  /**
419
- * Get or create a QueueSender for the specified queue name.
345
+ * Get or create a QueueSender for the specified binding.
420
346
  *
421
- * Senders are cached per queue name within the request scope.
347
+ * Senders are cached per binding within the request scope.
422
348
  *
423
- * @param queueName - The queue name to get a sender for
424
- * @returns QueueSender bound to the specified queue
349
+ * @param binding - The queue binding to get a sender for
350
+ * @returns QueueSender bound to the specified binding
425
351
  */
426
- getQueue(queueName: string): IQueueSender;
352
+ getQueue(binding: string): IQueueSender;
427
353
  }
428
354
  //#endregion
429
355
  //#region src/queue/decorators/inject-queue.decorator.d.ts
430
356
  /**
431
- * Inject a queue sender by name.
357
+ * Inject a queue sender by binding name.
432
358
  *
433
- * Queue names are typed via module augmentation of QueueNames interface.
434
- * The queue name serves as both the identifier and the DI injection token.
359
+ * The binding name matches the `binding` field declared under `queues.producers`
360
+ * in `wrangler.jsonc` (e.g. `BACKGROUND_QUEUE`). Stratal looks the binding up
361
+ * directly on the worker's `env`; the underlying Cloudflare queue can be any
362
+ * env-specific name (e.g. `background-queue-dev`) without affecting code.
435
363
  *
436
- * @param name - Queue name (typed with autocomplete if QueueNames is augmented)
364
+ * @param binding - Queue binding identifier (typed against `StratalEnv`).
437
365
  * @returns Parameter decorator for constructor injection
438
366
  *
439
367
  * @example
440
368
  * ```typescript
441
- * // Direct injection by queue name
442
369
  * constructor(
443
- * @InjectQueue('notifications-queue') private queue: IQueueSender
370
+ * @InjectQueue('NOTIFICATIONS_QUEUE') private queue: IQueueSender
444
371
  * ) {}
445
372
  *
446
- * // Usage
447
373
  * await this.queue.dispatch({
448
374
  * type: 'email.send',
449
375
  * payload: { to: 'user@example.com', subject: 'Hello' }
@@ -451,11 +377,11 @@ declare class QueueRegistry {
451
377
  * ```
452
378
  *
453
379
  * @remarks
454
- * The queue must be registered via `QueueModule.registerQueue(name)` before injection.
455
- * For module-internal queue bindings (e.g., EmailModule), use `@inject(TOKEN)` with
456
- * `useExisting` provider binding instead.
380
+ * The binding must be registered via `QueueModule.registerQueue(binding)`
381
+ * before injection. For module-internal bindings (e.g. EmailModule),
382
+ * use `@inject(TOKEN)` with `useExisting` provider binding instead.
457
383
  */
458
- declare function InjectQueue(name: QueueName): ParameterDecorator;
384
+ declare function InjectQueue(binding: QueueBinding): ParameterDecorator;
459
385
  //#endregion
460
386
  //#region src/queue/queue.tokens.d.ts
461
387
  declare const QUEUE_TOKENS: {
@@ -465,30 +391,8 @@ declare const QUEUE_TOKENS: {
465
391
  };
466
392
  type QueueToken = (typeof QUEUE_TOKENS)[keyof typeof QUEUE_TOKENS];
467
393
  //#endregion
468
- //#region src/queue/errors/queue-binding-not-found.error.d.ts
469
- /**
470
- * QueueBindingNotFoundError
471
- *
472
- * Thrown when attempting to access a Cloudflare Queue binding that hasn't been configured.
473
- * This typically indicates that the queue binding is missing from wrangler.jsonc
474
- * or the environment variables are not properly set.
475
- */
476
- declare class QueueBindingNotFoundError extends ApplicationError {
477
- constructor(queueName: string, bindingName: string);
478
- }
479
- //#endregion
480
- //#region src/queue/errors/queue-provider-not-supported.error.d.ts
481
- /**
482
- * QueueProviderNotSupportedError
483
- *
484
- * Thrown when attempting to use a queue provider that is not supported.
485
- * Valid providers are: 'cloudflare', 'sync'
486
- *
487
- * This typically indicates an invalid QUEUE_PROVIDER environment variable.
488
- */
489
- declare class QueueProviderNotSupportedError extends ApplicationError {
490
- constructor(provider: string);
491
- }
394
+ //#region src/queue/queue.error.d.ts
395
+ declare class QueueError extends ApplicationError {}
492
396
  //#endregion
493
- export { QueueNames as _, InjectQueue as a, QueueModule as c, SyncQueueProvider as d, CloudflareQueueProvider as f, QueueName as g, IQueueSender as h, QueueToken as i, QueueModuleOptions as l, DispatchMessage as m, QueueBindingNotFoundError as n, QueueRegistry as o, IQueueProvider as p, QUEUE_TOKENS as r, QueueProviderFactory as s, QueueProviderNotSupportedError as t, QueueSender as u, QueueManager as v };
494
- //# sourceMappingURL=index-CjaQ6_tZ.d.mts.map
397
+ export { QueueRegistry as a, QueueModuleOptions as c, CloudflareQueueProvider as d, IQueueProvider as f, QueueManager as g, QueueBinding as h, InjectQueue as i, QueueSender as l, IQueueSender as m, QUEUE_TOKENS as n, QueueProviderFactory as o, DispatchMessage as p, QueueToken as r, QueueModule as s, QueueError as t, SyncQueueProvider as u };
398
+ //# sourceMappingURL=index-CW1YHSft.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CW1YHSft.d.mts","names":[],"sources":["../src/queue/queue-manager.ts","../src/queue/queue-binding.ts","../src/queue/queue-sender.interface.ts","../src/queue/providers/queue-provider.interface.ts","../src/queue/providers/cloudflare-queue.provider.ts","../src/queue/providers/sync-queue.provider.ts","../src/queue/queue-sender.ts","../src/queue/queue.module.ts","../src/queue/services/queue-provider-factory.ts","../src/queue/queue-registry.ts","../src/queue/decorators/inject-queue.decorator.ts","../src/queue/queue.tokens.ts","../src/queue/queue.error.ts"],"mappings":";;;;;;;cAQa,YAAA;EAAA,iBAE4C,QAAA;EAAA,iBACC,MAAA;cADD,QAAA,EAAU,gBAAA,EACT,MAAA,EAAQ,aAAA;EAG1D,YAAA,CAAa,SAAA,UAAmB,KAAA,EAAO,YAAA,GAAe,OAAA;AAAA;;;;;;KCUzD,mBAAA,GAAsB,OAAA,eACX,UAAA,GAAa,UAAA,CAAW,CAAA,UAAW,KAAA,GAAQ,CAAA,iBAAkB,UAAA;;;;;;;;KAWjE,YAAA,IAAgB,mBAAA,6BAExB,mBAAA;;;;;;;;;KC9BQ,eAAA,gBAA+B,IAAA,CAAK,YAAA,CAAa,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;UA0B5C,YAAA;EDVZ;;;;;;;;;;ECqBH,QAAA,IAAY,OAAA,EAAS,eAAA,CAAgB,CAAA,IAAK,OAAA;AAAA;;;;;;;;;AFtC5C;;;;;;;;;;;;;UGciB,cAAA;EHViD;;;;;;;;;;EGqBhE,IAAA,IAAQ,OAAA,UAAiB,OAAA,EAAS,YAAA,CAAa,CAAA,IAAK,OAAA;AAAA;;;;;;;AHzBtD;;;;;;;;;cIea,uBAAA,YAAmC,cAAA;EAAA,iBAEM,GAAA;cAAA,GAAA,EAAK,UAAA;EJdQ;;;;;;;EIwB3D,IAAA,GAAA,CAAQ,OAAA,UAAiB,OAAA,EAAS,YAAA,CAAa,CAAA,IAAK,OAAA;AAAA;;;;;;;AJ3B5D;;;;;;;;;;;;;;;;;;;;;;;;;cK8Ba,iBAAA,YAA6B,cAAA;EAAA,iBAEe,QAAA;cAAA,QAAA,EAAU,gBAAA;;;;;;;;;;;EAa3D,IAAA,GAAA,CAAQ,QAAA,UAAkB,OAAA,EAAS,YAAA,CAAa,CAAA,IAAK,OAAA;AAAA;;;;;;;AL7C7D;;;;;;;;;;;;;;;;;;cMoBa,WAAA,YAAuB,YAAA;EAAA,iBAEf,OAAA;EAAA,iBACA,QAAA;EAAA,iBACA,IAAA;cAFA,OAAA,UACA,QAAA,EAAU,cAAA,EACV,IAAA,EAAM,YAAA;;;;ALZa;;EKoBhC,QAAA,GAAA,CAAY,OAAA,EAAS,eAAA,CAAgB,CAAA,IAAK,OAAA;AAAA;;;;;;UCCjC,kBAAA;;ANrBuB;;;;EM2BtC,QAAA;AAAA;AAAA,cAUW,WAAA;EN/B8C;;;;;;;;;;;;;;;AAW3D;;;EAX2D,OMkDlD,YAAA,CAAa,OAAA,EAAS,kBAAA,CAAmB,kBAAA,IAAsB,aAAA;ENrCjD;;;;AC9BvB;;;;;;;;;;;;;;AA0BA;;EDIuB,OMsEd,aAAA,CAAc,OAAA,EAAS,YAAA,GAAe,aAAA;AAAA;;;;;;APrG/C;;;;;;;;;;;;;;;;;;;;cQ2Ba,oBAAA;EAAA,iBAEyC,GAAA;EAAA,iBACG,QAAA;EAAA,iBAC2B,OAAA;cAF9B,GAAA,EAAK,UAAA,EACF,QAAA,EAAU,gBAAA,EACiB,OAAA,GAAU,kBAAA;;APnBtD;;;;;EO4BtC,MAAA,CAAA,GAAU,cAAA;AAAA;;;;;;;ARxCZ;;;;;;;;;;;;;;;;;;;;;;;cS+Ba,aAAA;EAAA,iBAMyC,IAAA;EAAA,iBALnC,QAAA;EAAA,iBACA,OAAA;cAG4B,eAAA,EAAiB,oBAAA,EACV,IAAA,EAAM,YAAA;;;;;;;;;EAa1D,QAAA,CAAS,OAAA,WAAkB,YAAA;AAAA;;;;;;;;;ATlD7B;;;;;;;;;;;;;;;;;;;;;;iBUwBgB,WAAA,CAAY,OAAA,EAAS,YAAA,GAAe,kBAAA;;;cC/BvC,YAAA;EAAA;;;;KAMD,UAAA,WAAqB,YAAA,eAA2B,YAAA;;;cCJ/C,UAAA,SAAmB,gBAAA"}