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
@@ -0,0 +1,544 @@
1
+ import { Dn as AsyncModuleOptions, Dr as ApplicationError, In as OnInitialize, Nn as ModuleContext, Y as Container, kn as DynamicModule } from "./index-B_JoEl3V.mjs";
2
+ import { t as StratalEnv } from "./env-ug22bJj7.mjs";
3
+ import { m as II18nService } from "./zod-wecrEVAs.mjs";
4
+ import { r as LoggerService } from "./index-BUt92sAE.mjs";
5
+ import { t as Constructor } from "./types-CmV_9xBD.mjs";
6
+ import { t as TieredCacheService } from "./tiered-cache.service-Dv3BhxxE.mjs";
7
+ import { t as CronJob } from "./cron-job-NesZRk8F.mjs";
8
+ import { a as QueueBinding, i as QueueMessage, n as ConsumerRegistry } from "./consumer-registry-D3iMTSdy.mjs";
9
+
10
+ //#region src/queue/queue.module.d.ts
11
+ /**
12
+ * Queue module configuration options
13
+ */
14
+ interface QueueModuleOptions {
15
+ /**
16
+ * Queue provider type
17
+ * - 'cloudflare': Production provider using Cloudflare Queue bindings
18
+ * - 'sync': Testing provider that processes messages immediately
19
+ */
20
+ provider: 'cloudflare' | 'sync';
21
+ /**
22
+ * KV binding for queue state (idempotency keys + failed jobs).
23
+ * Defaults to the `CACHE` binding if omitted.
24
+ */
25
+ store?: {
26
+ /**
27
+ * KV namespace binding name.
28
+ * @default CACHE
29
+ */
30
+ binding?: string;
31
+ };
32
+ /**
33
+ * Idempotency configuration.
34
+ *
35
+ * Delivery is **at-least-once with best-effort de-duplication**, not
36
+ * exactly-once. Every dispatch carries an idempotency key (an explicit
37
+ * `metadata.idempotencyKey`, otherwise a deterministic SHA-256 hash of `type`
38
+ * + `payload`), and a message already recorded as processed is skipped. The
39
+ * processed marker is written only after a handler succeeds, and KV `get`/`put`
40
+ * are eventually consistent — so a message redelivered concurrently (or after
41
+ * a crash before the marker was durable) can still run more than once. Make
42
+ * handlers idempotent; don't rely on this as a hard exactly-once guarantee.
43
+ * `ttl` bounds how long processed keys are remembered.
44
+ */
45
+ idempotency?: {
46
+ /** TTL in seconds for processed idempotency keys. Default: 86400 (24h) */ttl?: number;
47
+ };
48
+ /**
49
+ * Failed-job configuration.
50
+ *
51
+ * Failed jobs persist indefinitely until retried or purged. To bound growth,
52
+ * register the opt-in `FailedJobCleanupJob` cron in a module's `jobs` array;
53
+ * it deletes failed jobs older than `retention`.
54
+ */
55
+ failedJobs?: {
56
+ /**
57
+ * Age in seconds beyond which `FailedJobCleanupJob` deletes a failed job.
58
+ * Default: 604800 (7d). Has no effect unless the cron is registered.
59
+ */
60
+ retention?: number;
61
+ };
62
+ /** Max retry attempts before storing as failed job. Default: 3 */
63
+ maxRetries?: number;
64
+ }
65
+ declare class QueueModule implements OnInitialize {
66
+ /**
67
+ * Fail fast at boot if the configured KV store binding is missing, rather
68
+ * than letting every queue invocation hard-fail lazily. The binding backs
69
+ * idempotency claims and failed-job storage, so without it the queue
70
+ * subsystem cannot function.
71
+ */
72
+ onInitialize({
73
+ container
74
+ }: ModuleContext): void;
75
+ /**
76
+ * Configure queue infrastructure with async factory.
77
+ *
78
+ * Use when provider configuration depends on other services like ConfigService.
79
+ *
80
+ * @param options - Async configuration with factory and inject tokens
81
+ * @returns Dynamic module with queue infrastructure
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * QueueModule.forRootAsync({
86
+ * inject: [CONFIG_TOKENS.ConfigService],
87
+ * useFactory: (config: IConfigService) => ({
88
+ * provider: config.get('queue').provider
89
+ * })
90
+ * })
91
+ * ```
92
+ */
93
+ static forRootAsync(options: AsyncModuleOptions<QueueModuleOptions>): DynamicModule;
94
+ /**
95
+ * Register a queue binding for injection.
96
+ *
97
+ * The binding name doubles as the DI injection token and the
98
+ * `env`-lookup key. Binding names are typed against `StratalEnv`
99
+ * (autocomplete works once an app augments `StratalEnv` with its
100
+ * Cloudflare bindings).
101
+ *
102
+ * @param binding - Queue binding identifier (e.g. `NOTIFICATIONS_QUEUE`).
103
+ * @returns Dynamic module that provides the queue sender
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * // In AppModule imports
108
+ * QueueModule.registerQueue('NOTIFICATIONS_QUEUE')
109
+ *
110
+ * // Then inject using the binding name
111
+ * constructor(@InjectQueue('NOTIFICATIONS_QUEUE') private queue: IQueueSender) {}
112
+ * ```
113
+ */
114
+ static registerQueue(binding: QueueBinding): DynamicModule;
115
+ }
116
+ //#endregion
117
+ //#region src/queue/failed-job.d.ts
118
+ interface FailedJobMetadata {
119
+ /** Cloudflare queue name the message was consumed from (display/filtering). */
120
+ queue: string;
121
+ /** Producer binding to re-enqueue through on retry. */
122
+ binding: string;
123
+ type: string;
124
+ consumer: string;
125
+ attempts: number;
126
+ failedAt: string;
127
+ }
128
+ interface FailedJob extends FailedJobMetadata {
129
+ id: string;
130
+ message: QueueMessage;
131
+ error: {
132
+ name: string;
133
+ message: string;
134
+ stack?: string;
135
+ };
136
+ }
137
+ //#endregion
138
+ //#region src/queue/queue-store.d.ts
139
+ /** Default KV binding name used for queue state when none is configured. */
140
+ declare const DEFAULT_STORE_BINDING = "CACHE";
141
+ /**
142
+ * Persists queue idempotency claims and failed jobs.
143
+ *
144
+ * Backed by {@link TieredCacheService} (isolate-local L1 + KV). The L1 is what
145
+ * makes `markProcessed` → `isProcessed` reliable within an isolate: a claim
146
+ * written on this isolate is read back from memory, so a message redelivered to
147
+ * the same warm isolate is de-duplicated even inside KV's eventual-consistency
148
+ * window. Idempotency markers are set-once, the pattern the L1 tier is designed
149
+ * for. Cross-isolate duplicates still rely on KV (eventually consistent) —
150
+ * delivery remains at-least-once with best-effort de-duplication, not
151
+ * exactly-once.
152
+ */
153
+ declare class QueueStore {
154
+ private readonly cache;
155
+ private readonly idempotencyTtl;
156
+ constructor(cache: TieredCacheService, options: QueueModuleOptions);
157
+ isProcessed(key: string): Promise<boolean>;
158
+ markProcessed(key: string): Promise<void>;
159
+ storeFailedJob(job: FailedJob): Promise<void>;
160
+ getFailedJob(messageId: string): Promise<FailedJob | null>;
161
+ removeFailedJob(messageId: string): Promise<void>;
162
+ listFailedJobs(options?: {
163
+ limit?: number;
164
+ cursor?: string;
165
+ }): Promise<{
166
+ keys: {
167
+ id: string;
168
+ metadata: FailedJobMetadata;
169
+ }[];
170
+ cursor?: string;
171
+ }>;
172
+ purgeFailedJobs(): Promise<void>;
173
+ /**
174
+ * Delete failed jobs older than `retentionSeconds` (by their `failedAt`
175
+ * timestamp). Returns the number removed. Backs the opt-in
176
+ * {@link FailedJobCleanupJob} cron — failed jobs otherwise persist
177
+ * indefinitely until retried or purged.
178
+ */
179
+ purgeFailedJobsOlderThan(retentionSeconds: number): Promise<number>;
180
+ }
181
+ //#endregion
182
+ //#region src/queue/queue-manager.d.ts
183
+ declare class QueueManager {
184
+ private readonly registry;
185
+ private readonly logger;
186
+ private readonly store;
187
+ private readonly maxRetries;
188
+ constructor(registry: ConsumerRegistry, logger: LoggerService, store: QueueStore, options: QueueModuleOptions);
189
+ processBatch(queueName: string, batch: MessageBatch): Promise<void>;
190
+ }
191
+ //#endregion
192
+ //#region src/queue/queue-sender.interface.d.ts
193
+ /**
194
+ * Message input for queue dispatch (without auto-generated fields)
195
+ *
196
+ * When dispatching a message, the id is auto-generated.
197
+ * You only need to provide the type, payload, and optional metadata.
198
+ */
199
+ type DispatchMessage<T = unknown> = Omit<QueueMessage<T>, 'id'>;
200
+ /**
201
+ * Queue sender interface for dispatching messages to a queue.
202
+ *
203
+ * Each IQueueSender instance is bound to a specific queue name.
204
+ * Messages are dispatched with auto-generated id, timestamp, and locale metadata.
205
+ *
206
+ * @example
207
+ * ```typescript
208
+ * // Injected via @InjectQueue or token binding
209
+ * constructor(
210
+ * @InjectQueue('notifications-queue') private queue: IQueueSender
211
+ * ) {}
212
+ *
213
+ * // Dispatch a message
214
+ * await this.queue.dispatch({
215
+ * type: 'email.send',
216
+ * payload: {
217
+ * to: 'user@example.com',
218
+ * subject: 'Welcome',
219
+ * html: '<h1>Hello!</h1>'
220
+ * }
221
+ * })
222
+ * ```
223
+ */
224
+ interface IQueueSender {
225
+ /**
226
+ * Dispatch a message to this queue.
227
+ *
228
+ * Auto-adds:
229
+ * - `id`: Unique message identifier (UUID)
230
+ * - `metadata.locale`: Current locale from i18n context
231
+ * - `metadata.idempotencyKey`: Deterministic SHA-256 hash of type + payload (if not provided)
232
+ *
233
+ * @param message - Message to dispatch (without id)
234
+ */
235
+ dispatch<T>(message: DispatchMessage<T>): Promise<void>;
236
+ }
237
+ //#endregion
238
+ //#region src/queue/providers/queue-provider.interface.d.ts
239
+ /**
240
+ * Queue Provider Interface
241
+ *
242
+ * Defines the contract for queue providers. Each provider handles
243
+ * the actual message delivery mechanism.
244
+ *
245
+ * **Available Providers:**
246
+ * - `cloudflare`: Uses Cloudflare Queue bindings (production)
247
+ * - `sync`: Processes messages immediately (testing/development)
248
+ *
249
+ * @example Implementing a custom provider
250
+ * ```typescript
251
+ * export class CustomQueueProvider implements IQueueProvider {
252
+ * async send<T>(binding: string, message: QueueMessage<T>): Promise<void> {
253
+ * // Custom implementation
254
+ * }
255
+ * }
256
+ * ```
257
+ */
258
+ interface IQueueProvider {
259
+ /**
260
+ * Send a message to a queue
261
+ *
262
+ * Provider handles the actual delivery mechanism:
263
+ * - CloudflareQueueProvider: Looks up the binding on env and calls queue.send()
264
+ * - SyncQueueProvider: Finds matching consumers and calls handle() directly
265
+ *
266
+ * @param binding - Queue binding identifier
267
+ * @param message - Complete message with id and metadata
268
+ */
269
+ send<T>(binding: string, message: QueueMessage<T>): Promise<void>;
270
+ }
271
+ //#endregion
272
+ //#region src/queue/providers/cloudflare-queue.provider.d.ts
273
+ /**
274
+ * Cloudflare Queue Provider
275
+ *
276
+ * Sends messages to Cloudflare Queues by resolving the binding directly on
277
+ * the worker's `env`. Used in production environments where Cloudflare Workers
278
+ * handle queue processing.
279
+ *
280
+ * @example
281
+ * ```typescript
282
+ * const provider = new CloudflareQueueProvider(env)
283
+ * await provider.send('NOTIFICATIONS_QUEUE', message)
284
+ * ```
285
+ */
286
+ declare class CloudflareQueueProvider implements IQueueProvider {
287
+ private readonly env;
288
+ constructor(env: StratalEnv);
289
+ /**
290
+ * Send a message to a Cloudflare Queue
291
+ *
292
+ * @param binding - Queue binding identifier (e.g., 'NOTIFICATIONS_QUEUE')
293
+ * @param message - Complete message with id and payload
294
+ * @throws {QueueError} If the binding is not configured on env
295
+ */
296
+ send<T>(binding: string, message: QueueMessage<T>): Promise<void>;
297
+ }
298
+ //#endregion
299
+ //#region src/queue/providers/sync-queue.provider.d.ts
300
+ /**
301
+ * Sync Queue Provider
302
+ *
303
+ * Processes messages immediately by finding matching consumers and calling
304
+ * their handle() method directly. Used for testing and development where
305
+ * real queue infrastructure is not available.
306
+ *
307
+ * **Behavior:**
308
+ * - Messages are processed synchronously when send() is called
309
+ * - Matching consumers are found via ConsumerRegistry by message type
310
+ * - All matching consumers are called sequentially
311
+ * - Errors are re-thrown after onError() is called (fail-fast for testing)
312
+ *
313
+ * **Consumer Matching:**
314
+ * - Consumers are matched by message type, not queue name
315
+ * - Wildcard ('*') matches all message types
316
+ */
317
+ declare class SyncQueueProvider implements IQueueProvider {
318
+ private readonly registry;
319
+ private readonly root;
320
+ constructor(registry: ConsumerRegistry, root: Container);
321
+ /**
322
+ * Process a message synchronously.
323
+ *
324
+ * Runs inside the active request scope when dispatch happens within one (an
325
+ * HTTP request, or `runInScope` for queues/cron/commands). When dispatched
326
+ * with no ambient scope — e.g. a service invoked directly in a test — it
327
+ * establishes its own request scope (mirroring the production queue handler)
328
+ * so consumers and their request-scoped dependencies resolve correctly.
329
+ *
330
+ * @param _binding - Queue binding (not used for routing, consumers match by message type)
331
+ * @param message - Complete message with id and payload
332
+ * @throws Re-throws any error from consumer.handle() after calling onError()
333
+ */
334
+ send<T>(_binding: string, message: QueueMessage<T>): Promise<void>;
335
+ /**
336
+ * Resolve a fresh consumer per message from `container` (matched by type) and
337
+ * invoke each sequentially, fail-fast on the first error after `onError`.
338
+ */
339
+ private process;
340
+ }
341
+ //#endregion
342
+ //#region src/queue/queue-sender.d.ts
343
+ /**
344
+ * Queue Sender
345
+ *
346
+ * Implementation of IQueueSender bound to a specific queue binding.
347
+ * Created by QueueRegistry for each registered binding.
348
+ *
349
+ * Automatically enriches messages with:
350
+ * - `id`: UUID generated via crypto.randomUUID()
351
+ * - `metadata.locale`: Current locale from I18n context
352
+ * - `metadata.idempotencyKey`: Deterministic SHA-256 hash of type + payload (if not provided)
353
+ *
354
+ * @example
355
+ * ```typescript
356
+ * // Created by QueueRegistry, not directly instantiated
357
+ * const sender = registry.getQueue('NOTIFICATIONS_QUEUE')
358
+ *
359
+ * await sender.dispatch({
360
+ * type: 'email.send',
361
+ * payload: { to: 'user@example.com', subject: 'Hello' }
362
+ * })
363
+ * ```
364
+ */
365
+ declare class QueueSender implements IQueueSender {
366
+ private readonly binding;
367
+ private readonly provider;
368
+ private readonly i18n;
369
+ constructor(binding: string, provider: IQueueProvider, i18n: II18nService);
370
+ /**
371
+ * Dispatch a message to this queue.
372
+ *
373
+ * @param message - Message to dispatch (without id)
374
+ */
375
+ dispatch<T>(message: DispatchMessage<T>): Promise<void>;
376
+ private generateIdempotencyKey;
377
+ }
378
+ //#endregion
379
+ //#region src/queue/services/queue-provider-factory.d.ts
380
+ /**
381
+ * Queue Provider Factory
382
+ *
383
+ * Creates the appropriate queue provider based on configuration provided
384
+ * via QueueModule.forRootAsync().
385
+ *
386
+ * **Provider Selection:**
387
+ * - `cloudflare`: Production provider using Cloudflare Queue bindings
388
+ * - `sync`: Testing provider that processes messages immediately
389
+ *
390
+ * @example
391
+ * ```typescript
392
+ * // Configuration via QueueModule.forRootAsync()
393
+ * QueueModule.forRootAsync({
394
+ * inject: [CONFIG_TOKENS.ConfigService],
395
+ * useFactory: (config) => ({ provider: config.get('queue').provider })
396
+ * })
397
+ *
398
+ * // Factory usage (internal)
399
+ * const factory = container.resolve(QueueProviderFactory)
400
+ * const provider = factory.create()
401
+ * ```
402
+ */
403
+ declare class QueueProviderFactory {
404
+ private readonly env;
405
+ private readonly registry;
406
+ private readonly container;
407
+ private readonly options?;
408
+ constructor(env: StratalEnv, registry: ConsumerRegistry, container: Container, options?: QueueModuleOptions | undefined);
409
+ /**
410
+ * Create a queue provider based on module configuration
411
+ *
412
+ * @returns Queue provider instance
413
+ * @throws {QueueError} If provider type is not supported
414
+ */
415
+ create(): IQueueProvider;
416
+ }
417
+ //#endregion
418
+ //#region src/queue/queue-registry.d.ts
419
+ /**
420
+ * Queue Registry
421
+ *
422
+ * Request-scoped factory service for creating QueueSender instances.
423
+ * Caches senders per binding within the request scope.
424
+ *
425
+ * This service is used internally by QueueModule.registerQueue() to provide
426
+ * IQueueSender instances for each registered binding.
427
+ *
428
+ * **Why request-scoped?**
429
+ * - Needs access to I18nService for locale-aware message metadata
430
+ * - Provider is created once per request for consistency
431
+ * - Queue senders are cached per request to avoid recreating them
432
+ *
433
+ * @example
434
+ * ```typescript
435
+ * // Used internally by QueueModule.registerQueue()
436
+ * QueueModule.registerQueue('NOTIFICATIONS_QUEUE')
437
+ *
438
+ * // The module creates a factory provider:
439
+ * {
440
+ * provide: 'NOTIFICATIONS_QUEUE',
441
+ * useFactory: (registry: QueueRegistry) => registry.getQueue('NOTIFICATIONS_QUEUE'),
442
+ * inject: [QUEUE_TOKENS.QueueRegistry],
443
+ * }
444
+ * ```
445
+ */
446
+ declare class QueueRegistry {
447
+ private readonly i18n;
448
+ private readonly provider;
449
+ private readonly senders;
450
+ constructor(providerFactory: QueueProviderFactory, i18n: II18nService);
451
+ /**
452
+ * Get or create a QueueSender for the specified binding.
453
+ *
454
+ * Senders are cached per binding within the request scope.
455
+ *
456
+ * @param binding - The queue binding to get a sender for
457
+ * @returns QueueSender bound to the specified binding
458
+ */
459
+ getQueue(binding: string): IQueueSender;
460
+ }
461
+ //#endregion
462
+ //#region src/queue/jobs/failed-job-cleanup.job.d.ts
463
+ /**
464
+ * Opt-in cron job that deletes failed jobs older than `failedJobs.retention`
465
+ * (default 7 days). Failed jobs are persisted indefinitely by default; register
466
+ * this job only if you want automatic cleanup.
467
+ *
468
+ * ```ts
469
+ * @Module({
470
+ * imports: [
471
+ * QueueModule.forRoot({ provider: 'cloudflare', failedJobs: { retention: 1209600 } }),
472
+ * ],
473
+ * jobs: [FailedJobCleanupJob], // daily at 00:00 UTC
474
+ * })
475
+ * export class AppModule {}
476
+ * ```
477
+ *
478
+ * Add a matching cron trigger to `wrangler.jsonc` (`"0 0 * * *"` for the
479
+ * default schedule), or use {@link failedJobCleanupJob} for a custom one.
480
+ */
481
+ declare class FailedJobCleanupJob implements CronJob {
482
+ private readonly store;
483
+ private readonly options;
484
+ private readonly logger;
485
+ static schedule: string;
486
+ constructor(store: QueueStore, options: QueueModuleOptions, logger: LoggerService);
487
+ execute(): Promise<void>;
488
+ }
489
+ /**
490
+ * Create a {@link FailedJobCleanupJob} bound to a custom cron schedule (which
491
+ * must match a `wrangler.jsonc` trigger). Use when the default daily schedule
492
+ * isn't desired:
493
+ *
494
+ * ```ts
495
+ * @Module({ jobs: [failedJobCleanupJob('0 3 * * 0')] }) // weekly, Sundays 03:00
496
+ * ```
497
+ */
498
+ declare function failedJobCleanupJob(schedule: string): Constructor<CronJob>;
499
+ //#endregion
500
+ //#region src/queue/decorators/inject-queue.decorator.d.ts
501
+ /**
502
+ * Inject a queue sender by binding name.
503
+ *
504
+ * The binding name matches the `binding` field declared under `queues.producers`
505
+ * in `wrangler.jsonc` (e.g. `BACKGROUND_QUEUE`). Stratal looks the binding up
506
+ * directly on the worker's `env`; the underlying Cloudflare queue can be any
507
+ * env-specific name (e.g. `background-queue-dev`) without affecting code.
508
+ *
509
+ * @param binding - Queue binding identifier (typed against `StratalEnv`).
510
+ * @returns Parameter decorator for constructor injection
511
+ *
512
+ * @example
513
+ * ```typescript
514
+ * constructor(
515
+ * @InjectQueue('NOTIFICATIONS_QUEUE') private queue: IQueueSender
516
+ * ) {}
517
+ *
518
+ * await this.queue.dispatch({
519
+ * type: 'email.send',
520
+ * payload: { to: 'user@example.com', subject: 'Hello' }
521
+ * })
522
+ * ```
523
+ *
524
+ * @remarks
525
+ * The binding must be registered via `QueueModule.registerQueue(binding)`
526
+ * before injection. For module-internal bindings (e.g. EmailModule),
527
+ * use `@inject(TOKEN)` with `useExisting` provider binding instead.
528
+ */
529
+ declare function InjectQueue(binding: QueueBinding): ParameterDecorator;
530
+ //#endregion
531
+ //#region src/queue/queue.tokens.d.ts
532
+ declare const QUEUE_TOKENS: {
533
+ readonly QueueProviderFactory: symbol;
534
+ readonly QueueRegistry: symbol;
535
+ readonly QueueModuleOptions: symbol;
536
+ readonly QueueStore: symbol;
537
+ };
538
+ type QueueToken = (typeof QUEUE_TOKENS)[keyof typeof QUEUE_TOKENS];
539
+ //#endregion
540
+ //#region src/queue/queue.error.d.ts
541
+ declare class QueueError extends ApplicationError {}
542
+ //#endregion
543
+ export { QueueStore as _, FailedJobCleanupJob as a, QueueModule as b, QueueProviderFactory as c, CloudflareQueueProvider as d, IQueueProvider as f, DEFAULT_STORE_BINDING as g, QueueManager as h, InjectQueue as i, QueueSender as l, IQueueSender as m, QUEUE_TOKENS as n, failedJobCleanupJob as o, DispatchMessage as p, QueueToken as r, QueueRegistry as s, QueueError as t, SyncQueueProvider as u, FailedJob as v, QueueModuleOptions as x, FailedJobMetadata as y };
544
+ //# sourceMappingURL=index-B5JBRcWD.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-B5JBRcWD.d.mts","names":[],"sources":["../src/queue/queue.module.ts","../src/queue/failed-job.ts","../src/queue/queue-store.ts","../src/queue/queue-manager.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/services/queue-provider-factory.ts","../src/queue/queue-registry.ts","../src/queue/jobs/failed-job-cleanup.job.ts","../src/queue/decorators/inject-queue.decorator.ts","../src/queue/queue.tokens.ts","../src/queue/queue.error.ts"],"mappings":"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"}
@@ -0,0 +1,124 @@
1
+ //#region src/logger/logger.tokens.d.ts
2
+ declare const LOGGER_TOKENS: {
3
+ readonly LoggerService: symbol;
4
+ readonly Formatter: symbol;
5
+ readonly LogLevelOptions: symbol;
6
+ };
7
+ //#endregion
8
+ //#region src/logger/contracts/log-level.d.ts
9
+ /**
10
+ * Log severity levels
11
+ * Ordered from least to most severe
12
+ */
13
+ declare enum LogLevel {
14
+ DEBUG = "debug",
15
+ INFO = "info",
16
+ WARN = "warn",
17
+ ERROR = "error"
18
+ }
19
+ /**
20
+ * Map log levels to numeric priorities (for filtering)
21
+ * Higher numbers = more severe = higher priority
22
+ */
23
+ declare const LOG_LEVEL_PRIORITY: Record<LogLevel, number>;
24
+ //#endregion
25
+ //#region src/logger/contracts/log-context.d.ts
26
+ /**
27
+ * Structured metadata attached to log entries
28
+ * Supports arbitrary key-value pairs for context enrichment
29
+ */
30
+ type LogContext = Record<string, unknown>;
31
+ /**
32
+ * Internal context automatically added by LoggerService
33
+ * Contains request metadata, etc.
34
+ */
35
+ interface InternalLogContext extends LogContext {
36
+ userId?: string;
37
+ timestamp: number;
38
+ }
39
+ //#endregion
40
+ //#region src/logger/contracts/log-entry.d.ts
41
+ /**
42
+ * Complete log entry structure passed to transports
43
+ * Combines message, level, and enriched context
44
+ */
45
+ interface LogEntry {
46
+ level: LogLevel;
47
+ message: string;
48
+ context: InternalLogContext;
49
+ error?: {
50
+ message: string;
51
+ stack?: string;
52
+ name?: string;
53
+ };
54
+ }
55
+ //#endregion
56
+ //#region src/logger/formatters/formatter.interface.d.ts
57
+ /**
58
+ * Formatter contract
59
+ * Transforms LogEntry into string representation for transport output
60
+ */
61
+ interface ILogFormatter {
62
+ /**
63
+ * Format log entry into string
64
+ * @param entry - Complete log entry with context
65
+ * @returns Formatted string ready for transport
66
+ */
67
+ format(entry: LogEntry): string;
68
+ }
69
+ //#endregion
70
+ //#region src/logger/services/logger.service.d.ts
71
+ declare class LoggerService {
72
+ private readonly logLevel;
73
+ private readonly formatter;
74
+ constructor(logLevel: LogLevel, formatter: ILogFormatter);
75
+ debug(message: string, context?: LogContext): void;
76
+ info(message: string, context?: LogContext): void;
77
+ warn(message: string, context?: LogContext): void;
78
+ error(message: string, error: Error, context?: LogContext): void;
79
+ error(message: string, context?: LogContext): void;
80
+ private log;
81
+ private writeToConsole;
82
+ private enrichContext;
83
+ private serializeError;
84
+ }
85
+ //#endregion
86
+ //#region src/logger/formatters/json-formatter.d.ts
87
+ /**
88
+ * JSON Formatter
89
+ *
90
+ * Produces structured JSON logs for production environments.
91
+ * Optimized for log aggregation systems (Cloudflare Analytics, Datadog, etc.)
92
+ *
93
+ * Output format:
94
+ * {
95
+ * "level": "info",
96
+ * "message": "User logged in",
97
+ * "timestamp": 1234567890,
98
+ * "userId": "user_456",
99
+ * "error": { "message": "...", "stack": "..." }
100
+ * }
101
+ */
102
+ declare class JsonFormatter implements ILogFormatter {
103
+ format(entry: LogEntry): string;
104
+ }
105
+ //#endregion
106
+ //#region src/logger/formatters/pretty-formatter.d.ts
107
+ /**
108
+ * Pretty Formatter
109
+ *
110
+ * Human-readable colored output for development environments.
111
+ * Uses ANSI color codes for terminal output.
112
+ *
113
+ * Output format:
114
+ * [2024-01-15 10:30:45] INFO: User logged in
115
+ * userId: user_456
116
+ */
117
+ declare class PrettyFormatter implements ILogFormatter {
118
+ private readonly colors;
119
+ private readonly reset;
120
+ format(entry: LogEntry): string;
121
+ }
122
+ //#endregion
123
+ export { InternalLogContext as a, LogLevel as c, LogEntry as i, LOGGER_TOKENS as l, JsonFormatter as n, LogContext as o, LoggerService as r, LOG_LEVEL_PRIORITY as s, PrettyFormatter as t };
124
+ //# sourceMappingURL=index-BUt92sAE.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BUt92sAE.d.mts","names":[],"sources":["../src/logger/logger.tokens.ts","../src/logger/contracts/log-level.ts","../src/logger/contracts/log-context.ts","../src/logger/contracts/log-entry.ts","../src/logger/formatters/formatter.interface.ts","../src/logger/services/logger.service.ts","../src/logger/formatters/json-formatter.ts","../src/logger/formatters/pretty-formatter.ts"],"mappings":";cAAa,aAAA;EAAA;;;;;;;AAAb;;;aCIY,QAAA;EACV,KAAA;EACA,IAAA;EACA,IAAA;EACA,KAAA;AAAA;;;;AAJF;cAWa,kBAAA,EAAoB,MAAM,CAAC,QAAA;;;;ADfxC;;;KEIY,UAAA,GAAa,MAAM;;;;;UAMd,kBAAA,SAA2B,UAAU;EACpD,MAAA;EACA,SAAA;AAAA;;;;;;;UCLe,QAAA;EACf,KAAA,EAAO,QAAA;EACP,OAAA;EACA,OAAA,EAAS,kBAAkB;EAC3B,KAAA;IACE,OAAA;IACA,KAAA;IACA,IAAA;EAAA;AAAA;;;AHdJ;;;;AAAA,UIMiB,aAAA;;;;;;EAMf,MAAA,CAAO,KAAA,EAAO,QAAQ;AAAA;;;cCJX,aAAA;EAAA,iBAGQ,QAAA;EAAA,iBAGA,SAAA;cAHA,QAAA,EAAU,QAAA,EAGV,SAAA,EAAW,aAAA;EAG9B,KAAA,CAAM,OAAA,UAAiB,OAAA,GAAU,UAAA;EAIjC,IAAA,CAAK,OAAA,UAAiB,OAAA,GAAU,UAAA;EAIhC,IAAA,CAAK,OAAA,UAAiB,OAAA,GAAU,UAAA;EAIhC,KAAA,CAAM,OAAA,UAAiB,KAAA,EAAO,KAAA,EAAO,OAAA,GAAU,UAAA;EAC/C,KAAA,CAAM,OAAA,UAAiB,OAAA,GAAU,UAAA;EAAA,QAezB,GAAA;EAAA,QAqBA,cAAA;EAAA,QAiBA,aAAA;EAAA,QAOA,cAAA;AAAA;;;;;;;;;;;;;;AJtFV;;;;cKca,aAAA,YAAyB,aAAa;EACjD,MAAA,CAAO,KAAA,EAAO,QAAA;AAAA;;;;;;;;;;;;;cCLH,eAAA,YAA2B,aAAa;EAAA,iBAClC,MAAA;EAAA,iBAOA,KAAA;EAEjB,MAAA,CAAO,KAAA,EAAO,QAAA;AAAA"}