stratal 0.0.21 → 0.0.23

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 (296) hide show
  1. package/README.md +2 -2
  2. package/dist/bin/cloudflare-workers-loader.mjs +80 -7
  3. package/dist/bin/cloudflare-workers-loader.mjs.map +1 -1
  4. package/dist/bin/quarry.mjs +84 -160
  5. package/dist/bin/quarry.mjs.map +1 -1
  6. package/dist/cache/index.d.mts +8 -46
  7. package/dist/cache/index.d.mts.map +1 -1
  8. package/dist/cache/index.mjs +134 -97
  9. package/dist/cache/index.mjs.map +1 -1
  10. package/dist/{cache.service-DsnKuNyO.d.mts → cache.service-uElmBtdS.d.mts} +29 -39
  11. package/dist/cache.service-uElmBtdS.d.mts.map +1 -0
  12. package/dist/{command-BgSlsS4M.mjs → command-BvmUAPPQ.mjs} +15 -4
  13. package/dist/command-BvmUAPPQ.mjs.map +1 -0
  14. package/dist/{command-Cmmf0oHX.d.mts → command-CPhFHjG3.d.mts} +3 -2
  15. package/dist/command-CPhFHjG3.d.mts.map +1 -0
  16. package/dist/command-not-found.error-ONAZ2Bpk.mjs +14 -0
  17. package/dist/command-not-found.error-ONAZ2Bpk.mjs.map +1 -0
  18. package/dist/config/index.d.mts +24 -11
  19. package/dist/config/index.d.mts.map +1 -1
  20. package/dist/config/index.mjs +32 -57
  21. package/dist/config/index.mjs.map +1 -1
  22. package/dist/{consumer-registry-B7yUNh0q.d.mts → consumer-registry-D3iMTSdy.d.mts} +54 -22
  23. package/dist/consumer-registry-D3iMTSdy.d.mts.map +1 -0
  24. package/dist/container-storage-BmOJ4_Na.mjs +52 -0
  25. package/dist/container-storage-BmOJ4_Na.mjs.map +1 -0
  26. package/dist/{controller.decorator-B9vwn0zK.mjs → controller.decorator-C5UVeJS3.mjs} +8 -8
  27. package/dist/controller.decorator-C5UVeJS3.mjs.map +1 -0
  28. package/dist/cron/index.d.mts +103 -7
  29. package/dist/cron/index.d.mts.map +1 -1
  30. package/dist/cron/index.mjs +2 -2
  31. package/dist/cron-job-NesZRk8F.d.mts +58 -0
  32. package/dist/cron-job-NesZRk8F.d.mts.map +1 -0
  33. package/dist/{cron-manager-DQSK8uoV.mjs → cron.module-Bgzq5hiT.mjs} +47 -17
  34. package/dist/cron.module-Bgzq5hiT.mjs.map +1 -0
  35. package/dist/decorate-CuAoSZvs.mjs +16 -0
  36. package/dist/deep-merge-ByiAOZ3r.mjs +18 -0
  37. package/dist/deep-merge-ByiAOZ3r.mjs.map +1 -0
  38. package/dist/di/index.d.mts +2 -2
  39. package/dist/di/index.mjs +4 -3
  40. package/dist/di-DseMn-z9.mjs +524 -0
  41. package/dist/di-DseMn-z9.mjs.map +1 -0
  42. package/dist/email/index.d.mts +40 -122
  43. package/dist/email/index.d.mts.map +1 -1
  44. package/dist/email/index.mjs +446 -131
  45. package/dist/email/index.mjs.map +1 -1
  46. package/dist/en-CDZBMcc1.mjs +202 -0
  47. package/dist/en-CDZBMcc1.mjs.map +1 -0
  48. package/dist/{env-D1rcZ8_r.d.mts → env-ug22bJj7.d.mts} +1 -1
  49. package/dist/env-ug22bJj7.d.mts.map +1 -0
  50. package/dist/errors/index.d.mts +2 -2
  51. package/dist/errors/index.mjs +4 -2
  52. package/dist/errors-mXYxG0XB.mjs +333 -0
  53. package/dist/errors-mXYxG0XB.mjs.map +1 -0
  54. package/dist/events/index.d.mts +14 -3
  55. package/dist/events/index.d.mts.map +1 -1
  56. package/dist/events/index.mjs +2 -2
  57. package/dist/{events-CzCV8jI8.mjs → events-BXJGZjpG.mjs} +23 -13
  58. package/dist/events-BXJGZjpG.mjs.map +1 -0
  59. package/dist/exception-context-kEoMFwze.mjs +429 -0
  60. package/dist/exception-context-kEoMFwze.mjs.map +1 -0
  61. package/dist/{gateway-context-CXmXtaUP.mjs → gateway-context-TMu_AlJt.mjs} +38 -31
  62. package/dist/gateway-context-TMu_AlJt.mjs.map +1 -0
  63. package/dist/guards/index.d.mts +3 -3
  64. package/dist/guards/index.d.mts.map +1 -1
  65. package/dist/guards/index.mjs +1 -1
  66. package/dist/{guards-DU1_J9YA.mjs → guards-DALPXy3_.mjs} +6 -5
  67. package/dist/guards-DALPXy3_.mjs.map +1 -0
  68. package/dist/hono-app-CvV3hOfT.mjs +161 -0
  69. package/dist/hono-app-CvV3hOfT.mjs.map +1 -0
  70. package/dist/{http-method.decorator-BrgHMdLQ.mjs → http-method.decorator-ByWZb9DO.mjs} +7 -6
  71. package/dist/http-method.decorator-ByWZb9DO.mjs.map +1 -0
  72. package/dist/i18n/index.d.mts +238 -3
  73. package/dist/i18n/index.d.mts.map +1 -0
  74. package/dist/i18n/index.mjs +39 -3
  75. package/dist/i18n/index.mjs.map +1 -0
  76. package/dist/i18n/messages/en/index.d.mts +2 -2
  77. package/dist/i18n/messages/en/index.mjs +2 -2
  78. package/dist/i18n/utils/index.d.mts +4 -26
  79. package/dist/i18n/utils/index.d.mts.map +1 -1
  80. package/dist/i18n/utils/index.mjs +2 -2
  81. package/dist/i18n/validation/index.d.mts +3 -2
  82. package/dist/i18n/validation/index.mjs +4 -2
  83. package/dist/i18n.module-DRQAZoSZ.mjs +222 -0
  84. package/dist/i18n.module-DRQAZoSZ.mjs.map +1 -0
  85. package/dist/i18n.tokens-CZ_v8oyS.mjs +19 -0
  86. package/dist/i18n.tokens-CZ_v8oyS.mjs.map +1 -0
  87. package/dist/{index-7-hU3GTV.d.mts → index-0ItCjaqw.d.mts} +1 -1
  88. package/dist/index-0ItCjaqw.d.mts.map +1 -0
  89. package/dist/index-B5JBRcWD.d.mts +544 -0
  90. package/dist/index-B5JBRcWD.d.mts.map +1 -0
  91. package/dist/index-BUt92sAE.d.mts +124 -0
  92. package/dist/index-BUt92sAE.d.mts.map +1 -0
  93. package/dist/{index-ByOyTmqf.d.mts → index-B_JoEl3V.d.mts} +751 -2229
  94. package/dist/index-B_JoEl3V.d.mts.map +1 -0
  95. package/dist/index-DtBNIFuP.d.mts +42 -0
  96. package/dist/index-DtBNIFuP.d.mts.map +1 -0
  97. package/dist/{index-C1KvMncZ.d.mts → index-HgOLNruQ.d.mts} +3 -108
  98. package/dist/index-HgOLNruQ.d.mts.map +1 -0
  99. package/dist/index.d.mts +6 -43
  100. package/dist/index.mjs +3 -2
  101. package/dist/{is-command-C6a7WTPw.mjs → is-command-CEPO9n8c.mjs} +2 -2
  102. package/dist/{is-command-C6a7WTPw.mjs.map → is-command-CEPO9n8c.mjs.map} +1 -1
  103. package/dist/{is-seeder-CebjZCDn.mjs → is-seeder-Gvh_AM71.mjs} +1 -1
  104. package/dist/{is-seeder-CebjZCDn.mjs.map → is-seeder-Gvh_AM71.mjs.map} +1 -1
  105. package/dist/lazy-module-loader-Ib383jH_.d.mts +60 -0
  106. package/dist/lazy-module-loader-Ib383jH_.d.mts.map +1 -0
  107. package/dist/locale-path.service-D-dHiIPc.mjs +165 -0
  108. package/dist/locale-path.service-D-dHiIPc.mjs.map +1 -0
  109. package/dist/locale-url-nZrZxqJP.mjs +44 -0
  110. package/dist/locale-url-nZrZxqJP.mjs.map +1 -0
  111. package/dist/locale-url.service-C2EWmGdq.mjs +41 -0
  112. package/dist/locale-url.service-C2EWmGdq.mjs.map +1 -0
  113. package/dist/logger/index.d.mts +2 -2
  114. package/dist/logger/index.mjs +170 -2
  115. package/dist/logger/index.mjs.map +1 -0
  116. package/dist/macroable/index.d.mts +2 -2
  117. package/dist/macroable/index.mjs +1 -1
  118. package/dist/{macroable-BmufBshB.mjs → macroable-cvDTFZ_A.mjs} +1 -1
  119. package/dist/{macroable-BmufBshB.mjs.map → macroable-cvDTFZ_A.mjs.map} +1 -1
  120. package/dist/metadata-DzzprcID.mjs +39 -0
  121. package/dist/metadata-DzzprcID.mjs.map +1 -0
  122. package/dist/module/index.d.mts +7 -24
  123. package/dist/module/index.d.mts.map +1 -1
  124. package/dist/module/index.mjs +10 -2
  125. package/dist/module/index.mjs.map +1 -0
  126. package/dist/module-registry-Dm-pqHd3.mjs +554 -0
  127. package/dist/module-registry-Dm-pqHd3.mjs.map +1 -0
  128. package/dist/module.decorator-CYHY6pG5.mjs +19 -0
  129. package/dist/module.decorator-CYHY6pG5.mjs.map +1 -0
  130. package/dist/openapi/index.d.mts +44 -8
  131. package/dist/openapi/index.d.mts.map +1 -1
  132. package/dist/openapi/index.mjs +3 -3
  133. package/dist/openapi-CstuTM8S.mjs +309 -0
  134. package/dist/openapi-CstuTM8S.mjs.map +1 -0
  135. package/dist/{openapi-tools.service-Zs-Ewv7F.mjs → openapi-tools.service-BC5EC3R3.mjs} +8 -2
  136. package/dist/openapi-tools.service-BC5EC3R3.mjs.map +1 -0
  137. package/dist/{openapi.service-Bt9bCIrd.d.mts → openapi.service-YhTiJ1bO.d.mts} +3 -3
  138. package/dist/openapi.service-YhTiJ1bO.d.mts.map +1 -0
  139. package/dist/quarry/index.d.mts +14 -163
  140. package/dist/quarry/index.d.mts.map +1 -1
  141. package/dist/quarry/index.mjs +6 -5
  142. package/dist/quarry/runner.d.mts +184 -0
  143. package/dist/quarry/runner.d.mts.map +1 -0
  144. package/dist/quarry/runner.mjs +945 -0
  145. package/dist/quarry/runner.mjs.map +1 -0
  146. package/dist/quarry-registry-CXg0RFXq.d.mts +69 -0
  147. package/dist/quarry-registry-CXg0RFXq.d.mts.map +1 -0
  148. package/dist/quarry.module-BuRPGMDm.mjs +312 -0
  149. package/dist/quarry.module-BuRPGMDm.mjs.map +1 -0
  150. package/dist/queue/index.d.mts +3 -3
  151. package/dist/queue/index.mjs +57 -48
  152. package/dist/queue/index.mjs.map +1 -1
  153. package/dist/queue.module-nddvxzCB.mjs +613 -0
  154. package/dist/queue.module-nddvxzCB.mjs.map +1 -0
  155. package/dist/queue.tokens-DjHnFmre.mjs +11 -0
  156. package/dist/queue.tokens-DjHnFmre.mjs.map +1 -0
  157. package/dist/{r2-storage.provider-DuonKeYm.mjs → r2-storage.provider-DCxQt9dD.mjs} +6 -6
  158. package/dist/r2-storage.provider-DCxQt9dD.mjs.map +1 -0
  159. package/dist/{rate-limit.decorator-6qzNcSOt.mjs → rate-limit.decorator-BPAie_p3.mjs} +6 -11
  160. package/dist/rate-limit.decorator-BPAie_p3.mjs.map +1 -0
  161. package/dist/rate-limiter/index.d.mts +11 -50
  162. package/dist/rate-limiter/index.d.mts.map +1 -1
  163. package/dist/rate-limiter/index.mjs +33 -42
  164. package/dist/rate-limiter/index.mjs.map +1 -1
  165. package/dist/route-name-DGoBOfPg.mjs +171 -0
  166. package/dist/route-name-DGoBOfPg.mjs.map +1 -0
  167. package/dist/route-registration.service-D6vSwiKP.mjs +918 -0
  168. package/dist/route-registration.service-D6vSwiKP.mjs.map +1 -0
  169. package/dist/route-registry-CYqLp2Nj.mjs +123 -0
  170. package/dist/route-registry-CYqLp2Nj.mjs.map +1 -0
  171. package/dist/router/index.d.mts +2 -2
  172. package/dist/router/index.mjs +18 -7
  173. package/dist/router-CWGBD-Bg.mjs +78 -0
  174. package/dist/router-CWGBD-Bg.mjs.map +1 -0
  175. package/dist/router-resolver-D4YlPNlm.mjs +88 -0
  176. package/dist/router-resolver-D4YlPNlm.mjs.map +1 -0
  177. package/dist/seeder/index.d.mts +16 -11
  178. package/dist/seeder/index.d.mts.map +1 -1
  179. package/dist/seeder/index.mjs +5 -3
  180. package/dist/seeder-7ubkms-Y.mjs +81 -0
  181. package/dist/seeder-7ubkms-Y.mjs.map +1 -0
  182. package/dist/seeder-registry-CyUmKsJq.mjs +57 -0
  183. package/dist/seeder-registry-CyUmKsJq.mjs.map +1 -0
  184. package/dist/seeder.module-CYYwk3Qk.mjs +15 -0
  185. package/dist/seeder.module-CYYwk3Qk.mjs.map +1 -0
  186. package/dist/{signed-url-BQPbv2In.mjs → signed-url-DIU0sK_6.mjs} +1 -1
  187. package/dist/{signed-url-BQPbv2In.mjs.map → signed-url-DIU0sK_6.mjs.map} +1 -1
  188. package/dist/storage/index.d.mts +15 -39
  189. package/dist/storage/index.d.mts.map +1 -1
  190. package/dist/storage/index.mjs +3 -3
  191. package/dist/storage/providers/index.d.mts +2 -2
  192. package/dist/storage/providers/index.d.mts.map +1 -1
  193. package/dist/storage/providers/index.mjs +1 -1
  194. package/dist/{storage-D8CBP72Z.mjs → storage-MDZypIE9.mjs} +66 -59
  195. package/dist/storage-MDZypIE9.mjs.map +1 -0
  196. package/dist/{storage-provider.interface-Bd6vA4ak.d.mts → storage-provider.interface-ClUwxz4S.d.mts} +2 -3
  197. package/dist/storage-provider.interface-ClUwxz4S.d.mts.map +1 -0
  198. package/dist/storage.error-Dnib4VHc.mjs +8 -0
  199. package/dist/storage.error-Dnib4VHc.mjs.map +1 -0
  200. package/dist/stratal-DL9M38_s.mjs +383 -0
  201. package/dist/stratal-DL9M38_s.mjs.map +1 -0
  202. package/dist/stratal-DwDJPY9N.d.mts +43 -0
  203. package/dist/stratal-DwDJPY9N.d.mts.map +1 -0
  204. package/dist/tiered-cache.service-Dv3BhxxE.d.mts +79 -0
  205. package/dist/tiered-cache.service-Dv3BhxxE.d.mts.map +1 -0
  206. package/dist/trailing-slash-CFyw8nYu.mjs +34 -0
  207. package/dist/trailing-slash-CFyw8nYu.mjs.map +1 -0
  208. package/dist/{types-cySNS_lp.d.mts → types-CmV_9xBD.d.mts} +1 -1
  209. package/dist/types-CmV_9xBD.d.mts.map +1 -0
  210. package/dist/uri-h7Q8Jug9.mjs +251 -0
  211. package/dist/uri-h7Q8Jug9.mjs.map +1 -0
  212. package/dist/{usage-generator-BUdlhnCK.mjs → usage-generator-DAWYasuP.mjs} +7 -4
  213. package/dist/usage-generator-DAWYasuP.mjs.map +1 -0
  214. package/dist/validation-CpOjviyT.mjs +49 -0
  215. package/dist/validation-CpOjviyT.mjs.map +1 -0
  216. package/dist/validation.context-CRvmrhq7.mjs +117 -0
  217. package/dist/validation.context-CRvmrhq7.mjs.map +1 -0
  218. package/dist/versioning.service-C6aHky8-.mjs +36 -0
  219. package/dist/versioning.service-C6aHky8-.mjs.map +1 -0
  220. package/dist/websocket/index.d.mts +16 -14
  221. package/dist/websocket/index.d.mts.map +1 -1
  222. package/dist/websocket/index.mjs +2 -2
  223. package/dist/workers/index.d.mts +2 -2
  224. package/dist/workers/index.d.mts.map +1 -1
  225. package/dist/workers/index.mjs +3 -2
  226. package/dist/workers/index.mjs.map +1 -1
  227. package/dist/zod-eKqqhZ5_.mjs +72 -0
  228. package/dist/zod-eKqqhZ5_.mjs.map +1 -0
  229. package/dist/{index-Bnpfq6uk.d.mts → zod-wecrEVAs.d.mts} +63 -133
  230. package/dist/zod-wecrEVAs.d.mts.map +1 -0
  231. package/package.json +28 -39
  232. package/dist/base-email.provider-CfQCA08m.mjs +0 -42
  233. package/dist/base-email.provider-CfQCA08m.mjs.map +0 -1
  234. package/dist/cache.service-DsnKuNyO.d.mts.map +0 -1
  235. package/dist/cache.tokens-B7Rw1C9Q.mjs +0 -6
  236. package/dist/cache.tokens-B7Rw1C9Q.mjs.map +0 -1
  237. package/dist/colors-DJaRDXoS.mjs +0 -16
  238. package/dist/colors-DJaRDXoS.mjs.map +0 -1
  239. package/dist/command-BgSlsS4M.mjs.map +0 -1
  240. package/dist/command-Cmmf0oHX.d.mts.map +0 -1
  241. package/dist/consumer-registry-B7yUNh0q.d.mts.map +0 -1
  242. package/dist/controller.decorator-B9vwn0zK.mjs.map +0 -1
  243. package/dist/cron-manager-CmTimEjf.d.mts +0 -131
  244. package/dist/cron-manager-CmTimEjf.d.mts.map +0 -1
  245. package/dist/cron-manager-DQSK8uoV.mjs.map +0 -1
  246. package/dist/en-DSH_bhh6.mjs +0 -308
  247. package/dist/en-DSH_bhh6.mjs.map +0 -1
  248. package/dist/env-D1rcZ8_r.d.mts.map +0 -1
  249. package/dist/errors-COW9-Mar.mjs +0 -1739
  250. package/dist/errors-COW9-Mar.mjs.map +0 -1
  251. package/dist/errors-ORxu1-Bb.mjs +0 -74
  252. package/dist/errors-ORxu1-Bb.mjs.map +0 -1
  253. package/dist/events-CzCV8jI8.mjs.map +0 -1
  254. package/dist/gateway-context-CXmXtaUP.mjs.map +0 -1
  255. package/dist/guards-DU1_J9YA.mjs.map +0 -1
  256. package/dist/http-method.decorator-BrgHMdLQ.mjs.map +0 -1
  257. package/dist/i18n.module-CzXLW9Hy.mjs +0 -2532
  258. package/dist/i18n.module-CzXLW9Hy.mjs.map +0 -1
  259. package/dist/index-7-hU3GTV.d.mts.map +0 -1
  260. package/dist/index-Bnpfq6uk.d.mts.map +0 -1
  261. package/dist/index-ByOyTmqf.d.mts.map +0 -1
  262. package/dist/index-C1KvMncZ.d.mts.map +0 -1
  263. package/dist/index-DBd_2wv8.d.mts +0 -263
  264. package/dist/index-DBd_2wv8.d.mts.map +0 -1
  265. package/dist/index-DUzWs0z7.d.mts +0 -494
  266. package/dist/index-DUzWs0z7.d.mts.map +0 -1
  267. package/dist/index.d.mts.map +0 -1
  268. package/dist/logger-DlV7NtvD.mjs +0 -440
  269. package/dist/logger-DlV7NtvD.mjs.map +0 -1
  270. package/dist/module-BzLg57FK.mjs +0 -866
  271. package/dist/module-BzLg57FK.mjs.map +0 -1
  272. package/dist/openapi-tools.service-Zs-Ewv7F.mjs.map +0 -1
  273. package/dist/openapi.service-Bt9bCIrd.d.mts.map +0 -1
  274. package/dist/quarry-registry-BwY2hOxm.mjs +0 -699
  275. package/dist/quarry-registry-BwY2hOxm.mjs.map +0 -1
  276. package/dist/queue.module-BhCjZp6H.mjs +0 -409
  277. package/dist/queue.module-BhCjZp6H.mjs.map +0 -1
  278. package/dist/r2-storage.provider-DuonKeYm.mjs.map +0 -1
  279. package/dist/rate-limit.decorator-6qzNcSOt.mjs.map +0 -1
  280. package/dist/resend.provider-DB4IlFjG.mjs +0 -68
  281. package/dist/resend.provider-DB4IlFjG.mjs.map +0 -1
  282. package/dist/seeder-zoEfEw9i.mjs +0 -138
  283. package/dist/seeder-zoEfEw9i.mjs.map +0 -1
  284. package/dist/setup-CefZKV_e.mjs +0 -37
  285. package/dist/setup-CefZKV_e.mjs.map +0 -1
  286. package/dist/smtp.provider-B6D7zuWX.mjs +0 -76
  287. package/dist/smtp.provider-B6D7zuWX.mjs.map +0 -1
  288. package/dist/storage-D8CBP72Z.mjs.map +0 -1
  289. package/dist/storage-provider.interface-Bd6vA4ak.d.mts.map +0 -1
  290. package/dist/stratal-CNwpbSZl.mjs +0 -535
  291. package/dist/stratal-CNwpbSZl.mjs.map +0 -1
  292. package/dist/types-cySNS_lp.d.mts.map +0 -1
  293. package/dist/usage-generator-BUdlhnCK.mjs.map +0 -1
  294. package/dist/validation-DtJwAv7O.mjs +0 -248
  295. package/dist/validation-DtJwAv7O.mjs.map +0 -1
  296. /package/dist/{chunk-D1SwGrFN.mjs → chunk-BBjsoOtd.mjs} +0 -0
@@ -1,494 +0,0 @@
1
- import { d as ApplicationError, gn as AsyncModuleOptions, vn as DynamicModule } from "./index-ByOyTmqf.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";
5
-
6
- //#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
- declare class QueueManager {
28
- 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>;
40
- }
41
- //#endregion
42
- //#region src/queue/queue-name.d.ts
43
- /**
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
- * ```
78
- */
79
- interface QueueNames {}
80
- /**
81
- * Queue name type - extracts keys from QueueNames or falls back to string.
82
- *
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.
89
- */
90
- type QueueName = keyof QueueNames extends never ? string : keyof QueueNames;
91
- //#endregion
92
- //#region src/queue/queue-sender.interface.d.ts
93
- /**
94
- * Message input for queue dispatch (without auto-generated fields)
95
- *
96
- * When dispatching a message, the id and timestamp are auto-generated.
97
- * You only need to provide the type, payload, and optional metadata.
98
- */
99
- type DispatchMessage<T = unknown> = Omit<QueueMessage<T>, 'id' | 'timestamp'>;
100
- /**
101
- * Queue sender interface for dispatching messages to a queue.
102
- *
103
- * Each IQueueSender instance is bound to a specific queue name.
104
- * Messages are dispatched with auto-generated id, timestamp, and locale metadata.
105
- *
106
- * @example
107
- * ```typescript
108
- * // Injected via @InjectQueue or token binding
109
- * constructor(
110
- * @InjectQueue('notifications-queue') private queue: IQueueSender
111
- * ) {}
112
- *
113
- * // Dispatch a message
114
- * await this.queue.dispatch({
115
- * type: 'email.send',
116
- * payload: {
117
- * to: 'user@example.com',
118
- * subject: 'Welcome',
119
- * html: '<h1>Hello!</h1>'
120
- * }
121
- * })
122
- * ```
123
- */
124
- interface IQueueSender {
125
- /**
126
- * Dispatch a message to this queue.
127
- *
128
- * Auto-adds:
129
- * - `id`: Unique message identifier (UUID)
130
- * - `timestamp`: Current timestamp in milliseconds
131
- * - `metadata.locale`: Current locale from i18n context
132
- *
133
- * @param message - Message to dispatch (without id/timestamp)
134
- */
135
- dispatch<T>(message: DispatchMessage<T>): Promise<void>;
136
- }
137
- //#endregion
138
- //#region src/queue/providers/queue-provider.interface.d.ts
139
- /**
140
- * Queue Provider Interface
141
- *
142
- * Defines the contract for queue providers. Each provider handles
143
- * the actual message delivery mechanism.
144
- *
145
- * **Available Providers:**
146
- * - `cloudflare`: Uses Cloudflare Queue bindings (production)
147
- * - `sync`: Processes messages immediately (testing/development)
148
- *
149
- * @example Implementing a custom provider
150
- * ```typescript
151
- * export class CustomQueueProvider implements IQueueProvider {
152
- * async send<T>(queueName: string, message: QueueMessage<T>): Promise<void> {
153
- * // Custom implementation
154
- * }
155
- * }
156
- * ```
157
- */
158
- interface IQueueProvider {
159
- /**
160
- * Send a message to a queue
161
- *
162
- * Provider handles the actual delivery mechanism:
163
- * - CloudflareQueueProvider: Resolves CF binding and calls queue.send()
164
- * - SyncQueueProvider: Finds matching consumers and calls handle() directly
165
- *
166
- * @param queueName - Queue name
167
- * @param message - Complete message with id, timestamp, and metadata
168
- */
169
- send<T>(queueName: string, message: QueueMessage<T>): Promise<void>;
170
- }
171
- //#endregion
172
- //#region src/queue/providers/cloudflare-queue.provider.d.ts
173
- /**
174
- * Cloudflare Queue Provider
175
- *
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`
182
- *
183
- * @example
184
- * ```typescript
185
- * const provider = new CloudflareQueueProvider(env)
186
- * await provider.send('notifications-queue', message)
187
- * ```
188
- */
189
- declare class CloudflareQueueProvider implements IQueueProvider {
190
- private readonly env;
191
- constructor(env: StratalEnv);
192
- /**
193
- * Send a message to a Cloudflare Queue
194
- *
195
- * @param queueName - Queue name (e.g., 'notifications-queue')
196
- * @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
208
- */
209
- private getQueue;
210
- }
211
- //#endregion
212
- //#region src/queue/providers/sync-queue.provider.d.ts
213
- /**
214
- * Sync Queue Provider
215
- *
216
- * Processes messages immediately by finding matching consumers and calling
217
- * their handle() method directly. Used for testing and development where
218
- * real queue infrastructure is not available.
219
- *
220
- * **Behavior:**
221
- * - Messages are processed synchronously when send() is called
222
- * - Matching consumers are found via ConsumerRegistry by message type
223
- * - All matching consumers are called sequentially
224
- * - Errors are re-thrown after onError() is called (fail-fast for testing)
225
- *
226
- * **Consumer Matching:**
227
- * - Consumers are matched by message type, not queue name
228
- * - Wildcard ('*') matches all message types
229
- *
230
- * @example Testing with sync provider
231
- * ```typescript
232
- * const provider = new SyncQueueProvider(registry)
233
- * await provider.send('notifications-queue', {
234
- * id: '123',
235
- * timestamp: Date.now(),
236
- * type: 'email.send',
237
- * payload: { to: 'test@example.com' }
238
- * })
239
- * // Consumer's handle() is called immediately!
240
- * ```
241
- */
242
- declare class SyncQueueProvider implements IQueueProvider {
243
- private readonly registry;
244
- constructor(registry: ConsumerRegistry);
245
- /**
246
- * Process a message synchronously
247
- *
248
- * Finds all matching consumers by message type and calls their handle() method.
249
- * If any consumer throws, onError() is called and the error is re-thrown.
250
- *
251
- * @param _queueName - Queue name (not used for routing, consumers match by message type)
252
- * @param message - Complete message with id, timestamp, and payload
253
- * @throws Re-throws any error from consumer.handle() after calling onError()
254
- */
255
- send<T>(_queueName: string, message: QueueMessage<T>): Promise<void>;
256
- }
257
- //#endregion
258
- //#region src/queue/queue-sender.d.ts
259
- /**
260
- * Queue Sender
261
- *
262
- * Implementation of IQueueSender bound to a specific queue name.
263
- * Created by QueueRegistry for each registered queue.
264
- *
265
- * Automatically enriches messages with:
266
- * - `id`: UUID generated via crypto.randomUUID()
267
- * - `timestamp`: Current time in milliseconds
268
- * - `metadata.locale`: Current locale from I18n context
269
- *
270
- * @example
271
- * ```typescript
272
- * // Created by QueueRegistry, not directly instantiated
273
- * const sender = registry.getQueue('notifications-queue')
274
- *
275
- * await sender.dispatch({
276
- * type: 'email.send',
277
- * payload: { to: 'user@example.com', subject: 'Hello' }
278
- * })
279
- * ```
280
- */
281
- declare class QueueSender implements IQueueSender {
282
- private readonly queueName;
283
- private readonly provider;
284
- private readonly i18n;
285
- constructor(queueName: string, provider: IQueueProvider, i18n: II18nService);
286
- /**
287
- * Dispatch a message to this queue.
288
- *
289
- * @param message - Message to dispatch (without id/timestamp)
290
- */
291
- dispatch<T>(message: DispatchMessage<T>): Promise<void>;
292
- }
293
- //#endregion
294
- //#region src/queue/queue.module.d.ts
295
- /**
296
- * Queue module configuration options
297
- */
298
- interface QueueModuleOptions {
299
- /**
300
- * Queue provider type
301
- * - 'cloudflare': Production provider using Cloudflare Queue bindings
302
- * - 'sync': Testing provider that processes messages immediately
303
- */
304
- provider: 'cloudflare' | 'sync';
305
- }
306
- declare class QueueModule {
307
- /**
308
- * Configure queue infrastructure with async factory.
309
- *
310
- * Use when provider configuration depends on other services like ConfigService.
311
- *
312
- * @param options - Async configuration with factory and inject tokens
313
- * @returns Dynamic module with queue infrastructure
314
- *
315
- * @example
316
- * ```typescript
317
- * QueueModule.forRootAsync({
318
- * inject: [CONFIG_TOKENS.ConfigService],
319
- * useFactory: (config: IConfigService) => ({
320
- * provider: config.get('queue').provider
321
- * })
322
- * })
323
- * ```
324
- */
325
- static forRootAsync(options: AsyncModuleOptions<QueueModuleOptions>): DynamicModule;
326
- /**
327
- * Register a queue for injection.
328
- *
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.
331
- *
332
- * @param name - Queue name (typed with autocomplete if QueueNames is augmented)
333
- * @returns Dynamic module that provides the queue sender
334
- *
335
- * @example
336
- * ```typescript
337
- * // In AppModule imports
338
- * QueueModule.registerQueue('notifications-queue')
339
- *
340
- * // Then inject using the queue name
341
- * constructor(@InjectQueue('notifications-queue') private queue: IQueueSender) {}
342
- * ```
343
- */
344
- static registerQueue(name: QueueName): DynamicModule;
345
- }
346
- //#endregion
347
- //#region src/queue/services/queue-provider-factory.d.ts
348
- /**
349
- * Queue Provider Factory
350
- *
351
- * Creates the appropriate queue provider based on configuration provided
352
- * via QueueModule.forRootAsync().
353
- *
354
- * **Provider Selection:**
355
- * - `cloudflare`: Production provider using Cloudflare Queue bindings
356
- * - `sync`: Testing provider that processes messages immediately
357
- *
358
- * @example
359
- * ```typescript
360
- * // Configuration via QueueModule.forRootAsync()
361
- * QueueModule.forRootAsync({
362
- * inject: [CONFIG_TOKENS.ConfigService],
363
- * useFactory: (config) => ({ provider: config.get('queue').provider })
364
- * })
365
- *
366
- * // Factory usage (internal)
367
- * const factory = container.resolve(QueueProviderFactory)
368
- * const provider = factory.create()
369
- * ```
370
- */
371
- declare class QueueProviderFactory {
372
- private readonly env;
373
- private readonly registry;
374
- private readonly options?;
375
- constructor(env: StratalEnv, registry: ConsumerRegistry, options?: QueueModuleOptions | undefined);
376
- /**
377
- * Create a queue provider based on module configuration
378
- *
379
- * @returns Queue provider instance
380
- * @throws {QueueProviderNotSupportedError} If provider type is not supported
381
- */
382
- create(): IQueueProvider;
383
- }
384
- //#endregion
385
- //#region src/queue/queue-registry.d.ts
386
- /**
387
- * Queue Registry
388
- *
389
- * Request-scoped factory service for creating QueueSender instances.
390
- * Caches senders per queue name within the request scope.
391
- *
392
- * This service is used internally by QueueModule.registerQueue() to provide
393
- * IQueueSender instances for each registered queue.
394
- *
395
- * **Why request-scoped?**
396
- * - Needs access to I18nService for locale-aware message metadata
397
- * - Provider is created once per request for consistency
398
- * - Queue senders are cached per request to avoid recreating them
399
- *
400
- * @example
401
- * ```typescript
402
- * // Used internally by QueueModule.registerQueue()
403
- * QueueModule.registerQueue('notifications-queue')
404
- *
405
- * // The module creates a factory provider:
406
- * {
407
- * provide: 'notifications-queue',
408
- * useFactory: (registry: QueueRegistry) => registry.getQueue('notifications-queue'),
409
- * inject: [QUEUE_TOKENS.QueueRegistry],
410
- * }
411
- * ```
412
- */
413
- declare class QueueRegistry {
414
- private readonly i18n;
415
- private readonly provider;
416
- private readonly senders;
417
- constructor(providerFactory: QueueProviderFactory, i18n: II18nService);
418
- /**
419
- * Get or create a QueueSender for the specified queue name.
420
- *
421
- * Senders are cached per queue name within the request scope.
422
- *
423
- * @param queueName - The queue name to get a sender for
424
- * @returns QueueSender bound to the specified queue
425
- */
426
- getQueue(queueName: string): IQueueSender;
427
- }
428
- //#endregion
429
- //#region src/queue/decorators/inject-queue.decorator.d.ts
430
- /**
431
- * Inject a queue sender by name.
432
- *
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.
435
- *
436
- * @param name - Queue name (typed with autocomplete if QueueNames is augmented)
437
- * @returns Parameter decorator for constructor injection
438
- *
439
- * @example
440
- * ```typescript
441
- * // Direct injection by queue name
442
- * constructor(
443
- * @InjectQueue('notifications-queue') private queue: IQueueSender
444
- * ) {}
445
- *
446
- * // Usage
447
- * await this.queue.dispatch({
448
- * type: 'email.send',
449
- * payload: { to: 'user@example.com', subject: 'Hello' }
450
- * })
451
- * ```
452
- *
453
- * @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.
457
- */
458
- declare function InjectQueue(name: QueueName): ParameterDecorator;
459
- //#endregion
460
- //#region src/queue/queue.tokens.d.ts
461
- declare const QUEUE_TOKENS: {
462
- readonly QueueProviderFactory: symbol;
463
- readonly QueueRegistry: symbol;
464
- readonly QueueModuleOptions: symbol;
465
- };
466
- type QueueToken = (typeof QUEUE_TOKENS)[keyof typeof QUEUE_TOKENS];
467
- //#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
- }
492
- //#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-DUzWs0z7.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-DUzWs0z7.d.mts","names":[],"sources":["../src/queue/queue-manager.ts","../src/queue/queue-name.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/errors/queue-binding-not-found.error.ts","../src/queue/errors/queue-provider-not-supported.error.ts"],"mappings":"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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/stratal.ts"],"mappings":";;;;;;AAqBA;;;;;;;;;;;;cAAa,OAAA,aAAoB,UAAA,GAAa,UAAA;EAAA,QACpC,GAAA;EAAA,QACA,WAAA;EAAA,eAEO,YAAA;EAAA,eACA,WAAA;EAAA,eACA,iBAAA;cAEH,MAAA,EAAQ,iBAAA;EAiBd,KAAA,CAAM,OAAA,EAAS,OAAA,EAAS,GAAA,EAAK,GAAA,EAAK,GAAA,EAAK,gBAAA,GAAmB,OAAA,CAAQ,QAAA;EAMlE,KAAA,CAAM,KAAA,EAAO,YAAA,GAAe,OAAA;EAK5B,SAAA,CAAU,UAAA,EAAY,mBAAA,GAAsB,OAAA;EAAA,IAK9C,IAAA,CAAA,GAAQ,OAAA,CAAQ,OAAA;EAId,QAAA,CAAA,GAAY,OAAA;EA7C0B;;;;;;EAAA,OA2DrC,kBAAA,CAAA,GAAsB,OAAA,CAAQ,WAAA;EAAA,QAOvB,WAAA;EAAA,QAKA,UAAA;AAAA"}