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,945 @@
1
+ import { d as inject, r as DI_TOKENS, v as ROUTER_TOKENS } from "../di-DseMn-z9.mjs";
2
+ import { n as __decorateParam, t as __decorate } from "../decorate-CuAoSZvs.mjs";
3
+ import "../logger/index.mjs";
4
+ import { a as getListenerHandlers } from "../events-BXJGZjpG.mjs";
5
+ import { n as Module } from "../module.decorator-CYHY6pG5.mjs";
6
+ import { a as cyan, c as green, i as bold, l as red, t as Command, u as yellow } from "../command-BvmUAPPQ.mjs";
7
+ import { t as Stratal } from "../stratal-DL9M38_s.mjs";
8
+ import { t as QUEUE_TOKENS } from "../queue.tokens-DjHnFmre.mjs";
9
+ import { t as I18N_TOKENS } from "../i18n.tokens-CZ_v8oyS.mjs";
10
+ import { n as OPENAPI_TOKENS, t as OpenApiToolsService } from "../openapi-tools.service-BC5EC3R3.mjs";
11
+ import { t as CommandNotFoundError } from "../command-not-found.error-ONAZ2Bpk.mjs";
12
+ import { n as DbSeedListCommand, t as DbSeedCommand } from "../seeder-7ubkms-Y.mjs";
13
+ import { z } from "zod";
14
+ import { writeFileSync } from "node:fs";
15
+ import { resolve } from "node:path";
16
+ //#region src/quarry/commands/api.command.ts
17
+ let ApiCommand = class ApiCommand extends Command {
18
+ app;
19
+ static command = "api {route?} {--method= : HTTP method} {--data= : JSON request body} {--header=* : Headers (Key:Value)} {--query=* : Query params (key=value)}";
20
+ static description = "Call an API route directly";
21
+ static aliases = ["api:call"];
22
+ constructor(app) {
23
+ super();
24
+ this.app = app;
25
+ }
26
+ async handle() {
27
+ const route = this.string("route");
28
+ if (!route) return (await this.call("route:list")).exitCode;
29
+ return this.callRoute(route);
30
+ }
31
+ async callRoute(route) {
32
+ const method = (this.string("method") || "GET").toUpperCase();
33
+ const data = this.string("data");
34
+ const headerArgs = this.array("header");
35
+ const queryArgs = this.array("query");
36
+ const headers = {};
37
+ if (data) headers["Content-Type"] = "application/json";
38
+ for (const h of headerArgs) {
39
+ const colonIdx = h.indexOf(":");
40
+ if (colonIdx > 0) headers[h.slice(0, colonIdx).trim()] = h.slice(colonIdx + 1).trim();
41
+ }
42
+ let url = route;
43
+ if (queryArgs.length > 0) {
44
+ const parts = queryArgs.map((q) => {
45
+ const eqIdx = q.indexOf("=");
46
+ if (eqIdx > 0) return `${encodeURIComponent(q.slice(0, eqIdx))}=${encodeURIComponent(q.slice(eqIdx + 1))}`;
47
+ return encodeURIComponent(q);
48
+ });
49
+ url += `?${parts.join("&")}`;
50
+ }
51
+ const request = new Request(`http://localhost${url}`, {
52
+ method,
53
+ headers,
54
+ body: data || void 0
55
+ });
56
+ const response = await (await this.app.ensureHono()).fetch(request, this.app.env);
57
+ const body = await response.text();
58
+ const statusText = `${response.status} ${response.statusText}`;
59
+ let coloredStatus;
60
+ if (response.status >= 200 && response.status < 300) coloredStatus = green(bold(statusText));
61
+ else if (response.status >= 300 && response.status < 400) coloredStatus = yellow(bold(statusText));
62
+ else coloredStatus = red(bold(statusText));
63
+ this.line(`${cyan(method)} ${route} ${coloredStatus}`);
64
+ this.newLine();
65
+ const headerLines = [];
66
+ response.headers.forEach((value, key) => {
67
+ headerLines.push(` ${key}: ${value}`);
68
+ });
69
+ if (headerLines.length > 0) {
70
+ this.line(bold("Headers:"));
71
+ for (const hl of headerLines) this.line(hl);
72
+ this.newLine();
73
+ }
74
+ if (body) {
75
+ this.line(bold("Body:"));
76
+ try {
77
+ this.line(JSON.stringify(JSON.parse(body), null, 2));
78
+ } catch {
79
+ this.line(body);
80
+ }
81
+ }
82
+ return response.status >= 400 ? 1 : 0;
83
+ }
84
+ };
85
+ ApiCommand = __decorate([__decorateParam(0, inject(DI_TOKENS.Application))], ApiCommand);
86
+ //#endregion
87
+ //#region src/quarry/commands/event-list.command.ts
88
+ let EventListCommand = class EventListCommand extends Command {
89
+ modules;
90
+ static command = "event:list";
91
+ static description = "List all registered event listeners";
92
+ constructor(modules) {
93
+ super();
94
+ this.modules = modules;
95
+ }
96
+ handle() {
97
+ const listeners = this.modules.getAllListeners();
98
+ if (listeners.length === 0) {
99
+ this.info("No event listeners found");
100
+ return 0;
101
+ }
102
+ const rows = [];
103
+ for (const ListenerClass of listeners) {
104
+ const handlers = getListenerHandlers(ListenerClass);
105
+ for (const { methodName, event, options } of handlers) rows.push([
106
+ event,
107
+ ListenerClass.name,
108
+ methodName,
109
+ String(options?.priority ?? 0),
110
+ options?.blocking ? "Yes" : "No"
111
+ ]);
112
+ }
113
+ if (rows.length === 0) {
114
+ this.info("No event handlers found");
115
+ return 0;
116
+ }
117
+ this.table([
118
+ "Event",
119
+ "Listener",
120
+ "Method",
121
+ "Priority",
122
+ "Blocking"
123
+ ], rows);
124
+ }
125
+ };
126
+ EventListCommand = __decorate([__decorateParam(0, inject(DI_TOKENS.ModuleRegistry))], EventListCommand);
127
+ //#endregion
128
+ //#region src/quarry/commands/help.command.ts
129
+ let HelpCommand = class HelpCommand extends Command {
130
+ quarryRegistry;
131
+ static command = "help {command?}";
132
+ static description = "Show help for a command or list all commands";
133
+ static aliases = ["list"];
134
+ constructor(quarryRegistry) {
135
+ super();
136
+ this.quarryRegistry = quarryRegistry;
137
+ }
138
+ async handle() {
139
+ const commandName = this.string("command");
140
+ if (!commandName) {
141
+ const listing = await this.quarryRegistry.listUsage();
142
+ this.line(listing);
143
+ return 0;
144
+ }
145
+ try {
146
+ const usage = await this.quarryRegistry.usage(commandName);
147
+ this.line(usage);
148
+ return 0;
149
+ } catch (error) {
150
+ if (error instanceof CommandNotFoundError) {
151
+ this.fail(`Unknown command: ${commandName}`);
152
+ return 1;
153
+ }
154
+ throw error;
155
+ }
156
+ }
157
+ };
158
+ HelpCommand = __decorate([__decorateParam(0, inject(DI_TOKENS.Quarry))], HelpCommand);
159
+ //#endregion
160
+ //#region src/quarry/commands/i18n-utils.ts
161
+ function computeKeyDiff(baseKeys, targetKeys) {
162
+ const missing = [];
163
+ const extra = [];
164
+ for (const key of baseKeys) if (!targetKeys.has(key)) missing.push(key);
165
+ for (const key of targetKeys) if (!baseKeys.has(key)) extra.push(key);
166
+ return {
167
+ missing: missing.sort(),
168
+ extra: extra.sort()
169
+ };
170
+ }
171
+ function extractNamespace(key, depth) {
172
+ return key.split(".").slice(0, depth).join(".");
173
+ }
174
+ //#endregion
175
+ //#region src/quarry/commands/i18n-check.command.ts
176
+ let I18nCheckCommand = class I18nCheckCommand extends Command {
177
+ loader;
178
+ static command = "i18n:check {--locale= : Check a specific locale only} {--prefix= : Filter by namespace prefix}";
179
+ static description = "Check i18n translations for missing or extra keys";
180
+ constructor(loader) {
181
+ super();
182
+ this.loader = loader;
183
+ }
184
+ handle() {
185
+ const localeFilter = this.string("locale");
186
+ const prefix = this.string("prefix");
187
+ const filterOptions = prefix ? { only: [prefix] } : void 0;
188
+ const enKeys = new Set(Object.keys(this.loader.getFilteredMessages("en", filterOptions)));
189
+ if (enKeys.size === 0) {
190
+ this.info("No message keys found");
191
+ return 0;
192
+ }
193
+ const locales = this.loader.getAvailableLocales().filter((l) => l !== "en");
194
+ const targets = localeFilter ? locales.filter((l) => l === localeFilter) : locales;
195
+ if (targets.length === 0) {
196
+ this.info(localeFilter ? `Locale "${localeFilter}" not found` : "No non-en locales configured");
197
+ return 0;
198
+ }
199
+ let totalIssues = 0;
200
+ const summaryRows = [];
201
+ for (const locale of targets) {
202
+ const { missing, extra } = computeKeyDiff(enKeys, new Set(Object.keys(this.loader.getFilteredMessages(locale, filterOptions))));
203
+ this.newLine();
204
+ this.info(`Locale: ${locale}`);
205
+ if (missing.length > 0) {
206
+ this.warn(` Missing (${missing.length}):`);
207
+ for (const key of missing) this.line(` ${key}`);
208
+ } else this.line(" Missing (0)");
209
+ if (extra.length > 0) {
210
+ this.warn(` Extra (${extra.length}):`);
211
+ for (const key of extra) this.line(` ${key}`);
212
+ } else this.line(" Extra (0)");
213
+ totalIssues += missing.length + extra.length;
214
+ summaryRows.push([
215
+ locale,
216
+ String(enKeys.size),
217
+ String(missing.length),
218
+ String(extra.length)
219
+ ]);
220
+ }
221
+ this.newLine();
222
+ this.table([
223
+ "Locale",
224
+ "Total",
225
+ "Missing",
226
+ "Extra"
227
+ ], summaryRows);
228
+ if (totalIssues > 0) {
229
+ this.newLine();
230
+ this.fail(`${totalIssues} issue(s) found`);
231
+ return;
232
+ }
233
+ this.newLine();
234
+ this.success("All translations are complete");
235
+ return 0;
236
+ }
237
+ };
238
+ I18nCheckCommand = __decorate([__decorateParam(0, inject(I18N_TOKENS.MessageLoader))], I18nCheckCommand);
239
+ //#endregion
240
+ //#region src/quarry/commands/i18n-duplicates.command.ts
241
+ let I18nDuplicatesCommand = class I18nDuplicatesCommand extends Command {
242
+ loader;
243
+ static command = "i18n:duplicates {--locale= : Locale to check (default: en)} {--prefix= : Filter by namespace prefix}";
244
+ static description = "Find i18n keys with duplicate translation values";
245
+ constructor(loader) {
246
+ super();
247
+ this.loader = loader;
248
+ }
249
+ handle() {
250
+ const locale = this.string("locale") || "en";
251
+ const prefix = this.string("prefix");
252
+ const filterOptions = prefix ? { only: [prefix] } : void 0;
253
+ const messages = this.loader.getFilteredMessages(locale, filterOptions);
254
+ const valueToKeys = /* @__PURE__ */ new Map();
255
+ for (const [key, value] of Object.entries(messages)) {
256
+ const existing = valueToKeys.get(value);
257
+ if (existing) existing.push(key);
258
+ else valueToKeys.set(value, [key]);
259
+ }
260
+ const duplicates = [];
261
+ for (const [value, keys] of valueToKeys) if (keys.length > 1) duplicates.push([value, keys.sort().join(", ")]);
262
+ if (duplicates.length === 0) {
263
+ this.info("No duplicate values found");
264
+ return 0;
265
+ }
266
+ duplicates.sort((a, b) => a[0].localeCompare(b[0]));
267
+ this.table(["Value", "Keys"], duplicates);
268
+ return 0;
269
+ }
270
+ };
271
+ I18nDuplicatesCommand = __decorate([__decorateParam(0, inject(I18N_TOKENS.MessageLoader))], I18nDuplicatesCommand);
272
+ //#endregion
273
+ //#region src/quarry/commands/i18n-list.command.ts
274
+ let I18nListCommand = class I18nListCommand extends Command {
275
+ loader;
276
+ static command = "i18n:list {--locale= : Show keys for a specific locale} {--prefix= : Filter by namespace prefix} {--values : Show translated values}";
277
+ static description = "List all i18n message keys";
278
+ constructor(loader) {
279
+ super();
280
+ this.loader = loader;
281
+ }
282
+ handle() {
283
+ const localeFilter = this.string("locale");
284
+ const prefix = this.string("prefix");
285
+ const showValues = this.boolean("values");
286
+ const filterOptions = prefix ? { only: [prefix] } : void 0;
287
+ const enMessages = this.loader.getFilteredMessages("en", filterOptions);
288
+ const enKeys = Object.keys(enMessages).sort();
289
+ if (enKeys.length === 0) {
290
+ this.info("No message keys found");
291
+ return 0;
292
+ }
293
+ if (localeFilter && showValues) {
294
+ const localeMessages = this.loader.getFilteredMessages(localeFilter, filterOptions);
295
+ const rows = enKeys.map((key) => [key, localeMessages[key] ?? "-"]);
296
+ this.table(["Key", "Value"], rows);
297
+ return 0;
298
+ }
299
+ const locales = localeFilter ? [localeFilter] : this.loader.getAvailableLocales();
300
+ const localeMessages = /* @__PURE__ */ new Map();
301
+ for (const locale of locales) localeMessages.set(locale, new Set(Object.keys(this.loader.getFilteredMessages(locale, filterOptions))));
302
+ const headers = ["Key", ...locales];
303
+ const rows = enKeys.map((key) => {
304
+ return [key, ...locales.map((locale) => localeMessages.get(locale).has(key) ? "Y" : "N")];
305
+ });
306
+ this.table(headers, rows);
307
+ return 0;
308
+ }
309
+ };
310
+ I18nListCommand = __decorate([__decorateParam(0, inject(I18N_TOKENS.MessageLoader))], I18nListCommand);
311
+ //#endregion
312
+ //#region src/quarry/commands/i18n-namespaces.command.ts
313
+ let I18nNamespacesCommand = class I18nNamespacesCommand extends Command {
314
+ loader;
315
+ static command = "i18n:namespaces {--depth= : Namespace depth (default: 1)} {--locale= : Show counts for a specific locale}";
316
+ static description = "List i18n message namespaces with key counts";
317
+ constructor(loader) {
318
+ super();
319
+ this.loader = loader;
320
+ }
321
+ handle() {
322
+ const depth = this.number("depth") || 1;
323
+ const localeFilter = this.string("locale");
324
+ const locales = localeFilter ? [localeFilter] : this.loader.getAvailableLocales();
325
+ const namespaceCounts = /* @__PURE__ */ new Map();
326
+ for (const locale of locales) {
327
+ const messages = this.loader.getFilteredMessages(locale);
328
+ for (const key of Object.keys(messages)) {
329
+ const ns = extractNamespace(key, depth);
330
+ if (!namespaceCounts.has(ns)) namespaceCounts.set(ns, /* @__PURE__ */ new Map());
331
+ const counts = namespaceCounts.get(ns);
332
+ counts.set(locale, (counts.get(locale) ?? 0) + 1);
333
+ }
334
+ }
335
+ if (namespaceCounts.size === 0) {
336
+ this.info("No namespaces found");
337
+ return 0;
338
+ }
339
+ const sortedNamespaces = [...namespaceCounts.keys()].sort();
340
+ const headers = ["Namespace", ...locales];
341
+ const rows = sortedNamespaces.map((ns) => {
342
+ const counts = namespaceCounts.get(ns);
343
+ return [ns, ...locales.map((locale) => String(counts.get(locale) ?? 0))];
344
+ });
345
+ this.table(headers, rows);
346
+ return 0;
347
+ }
348
+ };
349
+ I18nNamespacesCommand = __decorate([__decorateParam(0, inject(I18N_TOKENS.MessageLoader))], I18nNamespacesCommand);
350
+ //#endregion
351
+ //#region src/quarry/commands/i18n-search.command.ts
352
+ let I18nSearchCommand = class I18nSearchCommand extends Command {
353
+ loader;
354
+ static command = "i18n:search {query : Search term (substring match)} {--locale= : Locale to search in (default: en)} {--keys-only : Only match key names, not values}";
355
+ static description = "Search for i18n message keys or values";
356
+ constructor(loader) {
357
+ super();
358
+ this.loader = loader;
359
+ }
360
+ handle() {
361
+ const query = this.string("query").toLowerCase();
362
+ const locale = this.string("locale") || "en";
363
+ const keysOnly = this.boolean("keys-only");
364
+ const messages = this.loader.getFilteredMessages(locale);
365
+ const matches = [];
366
+ for (const [key, value] of Object.entries(messages)) {
367
+ const keyMatch = key.toLowerCase().includes(query);
368
+ const valueMatch = !keysOnly && value.toLowerCase().includes(query);
369
+ if (keyMatch || valueMatch) matches.push([key, value]);
370
+ }
371
+ if (matches.length === 0) {
372
+ this.info(`No keys matching "${this.string("query")}" found`);
373
+ return 0;
374
+ }
375
+ matches.sort((a, b) => a[0].localeCompare(b[0]));
376
+ this.table(["Key", "Value"], matches);
377
+ return 0;
378
+ }
379
+ };
380
+ I18nSearchCommand = __decorate([__decorateParam(0, inject(I18N_TOKENS.MessageLoader))], I18nSearchCommand);
381
+ //#endregion
382
+ //#region src/quarry/commands/i18n-stats.command.ts
383
+ let I18nStatsCommand = class I18nStatsCommand extends Command {
384
+ loader;
385
+ static command = "i18n:stats {--prefix= : Filter by namespace prefix}";
386
+ static description = "Show i18n translation coverage statistics";
387
+ constructor(loader) {
388
+ super();
389
+ this.loader = loader;
390
+ }
391
+ handle() {
392
+ const prefix = this.string("prefix");
393
+ const filterOptions = prefix ? { only: [prefix] } : void 0;
394
+ const enKeys = new Set(Object.keys(this.loader.getFilteredMessages("en", filterOptions)));
395
+ if (enKeys.size === 0) {
396
+ this.info("No message keys found");
397
+ return 0;
398
+ }
399
+ const locales = this.loader.getAvailableLocales();
400
+ const rows = [];
401
+ for (const locale of locales) {
402
+ const localeKeys = new Set(Object.keys(this.loader.getFilteredMessages(locale, filterOptions)));
403
+ const isBase = locale === "en";
404
+ let translated = 0;
405
+ for (const key of enKeys) if (localeKeys.has(key)) translated++;
406
+ const missing = enKeys.size - translated;
407
+ let extra = 0;
408
+ for (const key of localeKeys) if (!enKeys.has(key)) extra++;
409
+ const coverage = (translated / enKeys.size * 100).toFixed(1) + "%";
410
+ rows.push([
411
+ locale,
412
+ String(enKeys.size),
413
+ String(translated),
414
+ String(missing),
415
+ isBase ? "-" : String(extra),
416
+ coverage
417
+ ]);
418
+ }
419
+ this.table([
420
+ "Locale",
421
+ "Keys",
422
+ "Translated",
423
+ "Missing",
424
+ "Extra",
425
+ "Coverage"
426
+ ], rows);
427
+ return 0;
428
+ }
429
+ };
430
+ I18nStatsCommand = __decorate([__decorateParam(0, inject(I18N_TOKENS.MessageLoader))], I18nStatsCommand);
431
+ //#endregion
432
+ //#region src/quarry/commands/mcp-serve.command.ts
433
+ let McpServeCommand = class McpServeCommand extends Command {
434
+ app;
435
+ openAPIService;
436
+ static command = "mcp:serve {--url= : Base URL for external dispatch} {--header=* : Headers (Key:Value)} {--tag=* : Only expose routes with these OpenAPI tags} {--path= : Only expose routes matching this path prefix}";
437
+ static description = "Start an MCP stdio server exposing API routes as tools";
438
+ constructor(app, openAPIService) {
439
+ super();
440
+ this.app = app;
441
+ this.openAPIService = openAPIService;
442
+ }
443
+ async handle() {
444
+ const { McpServer } = await import("@modelcontextprotocol/sdk/server/mcp.js");
445
+ const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
446
+ const baseUrl = this.string("url");
447
+ const headerArgs = this.array("header");
448
+ const tags = this.array("tag");
449
+ const pathPrefix = this.string("path");
450
+ const headers = {};
451
+ for (const h of headerArgs) {
452
+ const colonIdx = h.indexOf(":");
453
+ if (colonIdx > 0) headers[h.slice(0, colonIdx).trim()] = h.slice(colonIdx + 1).trim();
454
+ }
455
+ const hono = await this.app.ensureHono();
456
+ const spec = this.openAPIService.getSpec(hono, this.app.container);
457
+ const service = new OpenApiToolsService(spec, { dispatcher: baseUrl ? async (method, url, opts) => {
458
+ const fullUrl = `${baseUrl}${url}`;
459
+ try {
460
+ return await fetch(fullUrl, {
461
+ method,
462
+ headers: {
463
+ "Content-Type": "application/json",
464
+ ...headers,
465
+ ...opts?.headers
466
+ },
467
+ body: opts?.body !== void 0 ? JSON.stringify(opts.body) : void 0
468
+ });
469
+ } catch (error) {
470
+ throw new Error(`MCP dispatch failed: ${method} ${fullUrl} — ${error instanceof Error ? error.message : String(error)}`, { cause: error });
471
+ }
472
+ } : async (method, url, opts) => {
473
+ const request = new Request(`http://localhost${url}`, {
474
+ method,
475
+ headers: {
476
+ "Content-Type": "application/json",
477
+ ...headers,
478
+ ...opts?.headers
479
+ },
480
+ body: opts?.body !== void 0 ? JSON.stringify(opts.body) : void 0
481
+ });
482
+ try {
483
+ return await hono.fetch(request, this.app.env);
484
+ } catch (error) {
485
+ throw new Error(`MCP dispatch failed: ${method} ${url} — ${error instanceof Error ? error.message : String(error)}`, { cause: error });
486
+ }
487
+ } });
488
+ const filter = {
489
+ tags: tags.length > 0 ? tags : void 0,
490
+ pathPrefix: pathPrefix || void 0
491
+ };
492
+ const tools = service.getTools(filter);
493
+ const config = this.app.container.resolve(OPENAPI_TOKENS.ConfigStore).getBaseConfig();
494
+ const server = new McpServer({
495
+ name: config.info.title,
496
+ version: config.info.version
497
+ });
498
+ for (const tool of tools) {
499
+ const inputSchema = z.fromJSONSchema(tool.inputSchema);
500
+ server.registerTool(tool.name, {
501
+ description: tool.description,
502
+ inputSchema
503
+ }, async (args) => {
504
+ const result = await service.executeTool(tool.name, args);
505
+ return { content: [{
506
+ type: "text",
507
+ text: `Status: ${result.status}\n\n${result.body}`
508
+ }] };
509
+ });
510
+ }
511
+ server.registerResource("openapi-spec", "openapi://spec", {
512
+ description: "Full OpenAPI specification",
513
+ mimeType: "application/json"
514
+ }, () => ({ contents: [{
515
+ uri: "openapi://spec",
516
+ mimeType: "application/json",
517
+ text: JSON.stringify(spec, null, 2)
518
+ }] }));
519
+ const transport = new StdioServerTransport();
520
+ const closed = new Promise((resolve) => {
521
+ transport.onclose = resolve;
522
+ });
523
+ await server.connect(transport);
524
+ process.stderr.write(`MCP server started with ${tools.length} tool(s)\n`);
525
+ await closed;
526
+ return 0;
527
+ }
528
+ };
529
+ McpServeCommand = __decorate([__decorateParam(0, inject(DI_TOKENS.Application)), __decorateParam(1, inject(OPENAPI_TOKENS.OpenAPIService))], McpServeCommand);
530
+ //#endregion
531
+ //#region src/quarry/commands/mcp-tools.command.ts
532
+ let McpToolsCommand = class McpToolsCommand extends Command {
533
+ app;
534
+ openAPIService;
535
+ static command = "mcp:tools {--tag=* : Filter by OpenAPI tags} {--path= : Filter by path prefix}";
536
+ static description = "List API routes that would be exposed as MCP tools";
537
+ constructor(app, openAPIService) {
538
+ super();
539
+ this.app = app;
540
+ this.openAPIService = openAPIService;
541
+ }
542
+ async handle() {
543
+ const tags = this.array("tag");
544
+ const pathPrefix = this.string("path");
545
+ const hono = await this.app.ensureHono();
546
+ const service = new OpenApiToolsService(this.openAPIService.getSpec(hono, this.app.container));
547
+ const filter = {
548
+ tags: tags.length > 0 ? tags : void 0,
549
+ pathPrefix: pathPrefix || void 0
550
+ };
551
+ const tools = service.getTools(filter);
552
+ if (tools.length === 0) {
553
+ this.info("No tools found");
554
+ return 0;
555
+ }
556
+ this.table([
557
+ "Name",
558
+ "Method",
559
+ "Path",
560
+ "Description"
561
+ ], tools.map((t) => [
562
+ t.name,
563
+ t.method,
564
+ t.path,
565
+ t.description
566
+ ]));
567
+ return 0;
568
+ }
569
+ };
570
+ McpToolsCommand = __decorate([__decorateParam(0, inject(DI_TOKENS.Application)), __decorateParam(1, inject(OPENAPI_TOKENS.OpenAPIService))], McpToolsCommand);
571
+ //#endregion
572
+ //#region src/quarry/commands/queue-failed.command.ts
573
+ let QueueFailedCommand = class QueueFailedCommand extends Command {
574
+ store;
575
+ static command = "queue:failed {--queue= : Filter by queue name} {--limit= : Max results (default 50)}";
576
+ static description = "List failed queue jobs";
577
+ constructor(store) {
578
+ super();
579
+ this.store = store;
580
+ }
581
+ async handle() {
582
+ const queueFilter = this.string("queue");
583
+ const limit = this.number("limit") || 50;
584
+ const filtered = [];
585
+ let cursor;
586
+ let more = false;
587
+ do {
588
+ const result = await this.store.listFailedJobs({
589
+ cursor,
590
+ limit
591
+ });
592
+ cursor = result.cursor;
593
+ for (const key of result.keys) {
594
+ if (queueFilter && key.metadata.queue !== queueFilter) continue;
595
+ if (filtered.length >= limit) {
596
+ more = true;
597
+ break;
598
+ }
599
+ filtered.push(key);
600
+ }
601
+ } while (cursor && filtered.length < limit);
602
+ if (cursor) more = true;
603
+ if (filtered.length === 0) {
604
+ this.info("No failed jobs found");
605
+ return 0;
606
+ }
607
+ this.table([
608
+ "ID",
609
+ "Queue",
610
+ "Type",
611
+ "Consumer",
612
+ "Attempts",
613
+ "Failed At"
614
+ ], filtered.map((k) => [
615
+ k.id,
616
+ k.metadata.queue,
617
+ k.metadata.type,
618
+ k.metadata.consumer,
619
+ String(k.metadata.attempts),
620
+ k.metadata.failedAt
621
+ ]));
622
+ if (more) this.comment(`Showing first ${limit} results. More jobs available.`);
623
+ }
624
+ };
625
+ QueueFailedCommand = __decorate([__decorateParam(0, inject(QUEUE_TOKENS.QueueStore))], QueueFailedCommand);
626
+ //#endregion
627
+ //#region src/quarry/commands/queue-list.command.ts
628
+ let QueueListCommand = class QueueListCommand extends Command {
629
+ consumers;
630
+ static command = "queue:list";
631
+ static description = "List all registered queue consumers";
632
+ constructor(consumers) {
633
+ super();
634
+ this.consumers = consumers;
635
+ }
636
+ handle() {
637
+ const registrations = this.consumers.getRegistrations();
638
+ if (registrations.length === 0) {
639
+ this.info("No queue consumers found");
640
+ return 0;
641
+ }
642
+ this.table(["Consumer", "Message Types"], registrations.map((r) => [r.consumerClass.name, r.messageTypes.join(", ")]));
643
+ }
644
+ };
645
+ QueueListCommand = __decorate([__decorateParam(0, inject(DI_TOKENS.ConsumerRegistry))], QueueListCommand);
646
+ //#endregion
647
+ //#region src/quarry/commands/queue-purge.command.ts
648
+ let QueuePurgeCommand = class QueuePurgeCommand extends Command {
649
+ store;
650
+ static command = "queue:purge {id? : Message ID to purge} {--all : Purge all failed jobs} {--queue= : Filter by queue name}";
651
+ static description = "Delete failed queue jobs without retrying";
652
+ constructor(store) {
653
+ super();
654
+ this.store = store;
655
+ }
656
+ async handle() {
657
+ const id = this.string("id");
658
+ const all = this.boolean("all");
659
+ const queueFilter = this.string("queue");
660
+ if (!id && !all) {
661
+ this.fail("Provide a message ID or use --all");
662
+ return 1;
663
+ }
664
+ if (id) {
665
+ await this.store.removeFailedJob(id);
666
+ this.success(`Purged job ${id}`);
667
+ return;
668
+ }
669
+ if (queueFilter) {
670
+ const ids = [];
671
+ let cursor;
672
+ do {
673
+ const result = await this.store.listFailedJobs({
674
+ cursor,
675
+ limit: 100
676
+ });
677
+ cursor = result.cursor;
678
+ for (const key of result.keys) {
679
+ if (key.metadata.queue !== queueFilter) continue;
680
+ ids.push(key.id);
681
+ }
682
+ } while (cursor);
683
+ for (const id of ids) await this.store.removeFailedJob(id);
684
+ this.success(`Purged ${ids.length} job(s) from queue "${queueFilter}"`);
685
+ } else {
686
+ await this.store.purgeFailedJobs();
687
+ this.success("Purged all failed jobs");
688
+ }
689
+ }
690
+ };
691
+ QueuePurgeCommand = __decorate([__decorateParam(0, inject(QUEUE_TOKENS.QueueStore))], QueuePurgeCommand);
692
+ //#endregion
693
+ //#region src/quarry/commands/queue-retry.command.ts
694
+ let QueueRetryCommand = class QueueRetryCommand extends Command {
695
+ store;
696
+ static command = "queue:retry {id? : Message ID to retry} {--all : Retry all failed jobs} {--queue= : Filter by queue name}";
697
+ static description = "Retry failed queue jobs";
698
+ provider;
699
+ constructor(store, factory) {
700
+ super();
701
+ this.store = store;
702
+ this.provider = factory.create();
703
+ }
704
+ async handle() {
705
+ const id = this.string("id");
706
+ const all = this.boolean("all");
707
+ const queueFilter = this.string("queue");
708
+ if (!id && !all) {
709
+ this.fail("Provide a message ID or use --all");
710
+ return 1;
711
+ }
712
+ if (id) return this.retryOne(id);
713
+ return this.retryAll(queueFilter);
714
+ }
715
+ async retryOne(id) {
716
+ const job = await this.store.getFailedJob(id);
717
+ if (!job) {
718
+ this.fail(`Failed job "${id}" not found`);
719
+ return 1;
720
+ }
721
+ await this.provider.send(job.binding, {
722
+ ...job.message,
723
+ id: crypto.randomUUID()
724
+ });
725
+ await this.store.removeFailedJob(id);
726
+ this.success(`Retried job ${id}`);
727
+ }
728
+ async retryAll(queueFilter) {
729
+ const ids = [];
730
+ let cursor;
731
+ do {
732
+ const result = await this.store.listFailedJobs({
733
+ cursor,
734
+ limit: 100
735
+ });
736
+ cursor = result.cursor;
737
+ for (const key of result.keys) {
738
+ if (queueFilter && key.metadata.queue !== queueFilter) continue;
739
+ ids.push(key.id);
740
+ }
741
+ } while (cursor);
742
+ let count = 0;
743
+ for (const id of ids) {
744
+ const job = await this.store.getFailedJob(id);
745
+ if (!job) continue;
746
+ await this.provider.send(job.binding, {
747
+ ...job.message,
748
+ id: crypto.randomUUID()
749
+ });
750
+ await this.store.removeFailedJob(id);
751
+ count++;
752
+ }
753
+ this.success(`Retried ${count} job(s)`);
754
+ }
755
+ };
756
+ QueueRetryCommand = __decorate([__decorateParam(0, inject(QUEUE_TOKENS.QueueStore)), __decorateParam(1, inject(QUEUE_TOKENS.QueueProviderFactory))], QueueRetryCommand);
757
+ //#endregion
758
+ //#region src/quarry/commands/route-list.command.ts
759
+ let RouteListCommand = class RouteListCommand extends Command {
760
+ registry;
761
+ static command = "route:list {--method= : Filter by HTTP method} {--path= : Filter by path substring} {--name= : Filter by route name} {--hidden : Include hidden routes}";
762
+ static description = "List all registered routes";
763
+ constructor(registry) {
764
+ super();
765
+ this.registry = registry;
766
+ }
767
+ handle() {
768
+ const methodFilter = this.string("method").toUpperCase();
769
+ const pathFilter = this.string("path");
770
+ const nameFilter = this.string("name");
771
+ const showHidden = this.boolean("hidden");
772
+ let routes = this.registry.all();
773
+ if (!showHidden) routes = routes.filter((r) => !r.hidden);
774
+ if (methodFilter) routes = routes.filter((r) => r.method.toUpperCase() === methodFilter);
775
+ if (pathFilter) routes = routes.filter((r) => r.path.includes(pathFilter));
776
+ if (nameFilter) routes = routes.filter((r) => r.name?.includes(nameFilter));
777
+ if (routes.length === 0) {
778
+ this.info("No routes found");
779
+ return 0;
780
+ }
781
+ this.table([
782
+ "Method",
783
+ "Path",
784
+ "Name",
785
+ "Handler",
786
+ "Domain"
787
+ ], routes.map((r) => this.formatRow(r)));
788
+ }
789
+ formatRow(route) {
790
+ return [
791
+ route.method.toUpperCase(),
792
+ route.path,
793
+ route.name ?? "-",
794
+ `${route.controller}.${route.action}`,
795
+ route.domain ?? "-"
796
+ ];
797
+ }
798
+ };
799
+ RouteListCommand = __decorate([__decorateParam(0, inject(ROUTER_TOKENS.RouteRegistry))], RouteListCommand);
800
+ //#endregion
801
+ //#region src/quarry/commands/route-types.command.ts
802
+ let RouteTypesCommand = class RouteTypesCommand extends Command {
803
+ registry;
804
+ localePathService;
805
+ static command = "route:types {--output=src/stratal.d.ts : Output file path}";
806
+ static description = "Generate TypeScript types for named routes";
807
+ constructor(registry, localePathService) {
808
+ super();
809
+ this.registry = registry;
810
+ this.localePathService = localePathService;
811
+ }
812
+ handle() {
813
+ const outputPath = resolve(this.string("output") || "src/stratal.d.ts");
814
+ const namedRoutes = this.registry.named();
815
+ if (namedRoutes.length === 0) {
816
+ this.warn("No named routes found. Add name to your @Route() or @Get()/@Post() decorators.");
817
+ return 0;
818
+ }
819
+ writeFileSync(outputPath, this.generateDeclaration(namedRoutes), "utf-8");
820
+ this.info(`Generated route types for ${namedRoutes.length} named routes → ${outputPath}`);
821
+ }
822
+ /**
823
+ * Generate the StratalRouteMap declaration content.
824
+ */
825
+ generateDeclaration(routes) {
826
+ const localeConfig = this.localePathService.enabled ? this.localePathService.localePathConfig : null;
827
+ const localeType = localeConfig ? localeConfig.allLocales.map((l) => `'${l}'`).join(" | ") : null;
828
+ const localeOptional = localeConfig ? this.localePathService.prefixDefaultLocale !== true : false;
829
+ const entries = routes.filter((r) => r.name !== void 0).sort((a, b) => a.name.localeCompare(b.name)).map((route) => {
830
+ const paramEntries = [...route.paramNames.map((p) => `${p}: string`), ...route.domainParamNames.map((p) => `${p}: string`)];
831
+ if (localeType && route.localePaths?.length) {
832
+ const optionalMarker = localeOptional ? "?" : "";
833
+ paramEntries.push(`locale${optionalMarker}: StratalLocale`);
834
+ }
835
+ const indexSignature = localeType && route.localePaths?.length ? "[key: string]: string | StratalLocale | undefined" : "[key: string]: string | undefined";
836
+ paramEntries.push(indexSignature);
837
+ const paramsType = `{ ${paramEntries.join("; ")} }`;
838
+ return ` '${route.name}': { params: ${paramsType} }`;
839
+ }).join("\n");
840
+ const lines = ["// Auto-generated by `quarry route:types` — do not edit manually", "declare module 'stratal/router' {"];
841
+ if (localeType) {
842
+ lines.push(` type StratalLocale = ${localeType}`);
843
+ lines.push("");
844
+ }
845
+ lines.push(" interface StratalRouteMap {", entries, " }", "}");
846
+ return [
847
+ ...lines,
848
+ "",
849
+ "export {}",
850
+ ""
851
+ ].join("\n");
852
+ }
853
+ };
854
+ RouteTypesCommand = __decorate([__decorateParam(0, inject(ROUTER_TOKENS.RouteRegistry)), __decorateParam(1, inject(ROUTER_TOKENS.LocalePathService))], RouteTypesCommand);
855
+ //#endregion
856
+ //#region src/quarry/commands/schedule-list.command.ts
857
+ let ScheduleListCommand = class ScheduleListCommand extends Command {
858
+ loader;
859
+ static command = "schedule:list";
860
+ static description = "List all registered cron jobs";
861
+ constructor(loader) {
862
+ super();
863
+ this.loader = loader;
864
+ }
865
+ async handle() {
866
+ const cron = (await this.loader.load(() => import("../cron.module-Bgzq5hiT.mjs").then((n) => n.n).then((m) => m.CronModule))).get(DI_TOKENS.Cron);
867
+ const schedules = cron.getAllSchedules();
868
+ if (schedules.length === 0) {
869
+ this.info("No cron jobs found");
870
+ return 0;
871
+ }
872
+ const rows = [];
873
+ for (const schedule of schedules) {
874
+ const jobs = cron.getJobsForSchedule(schedule);
875
+ for (const { jobClass } of jobs) rows.push([schedule, jobClass.name]);
876
+ }
877
+ this.table(["Schedule", "Job"], rows);
878
+ }
879
+ };
880
+ ScheduleListCommand = __decorate([__decorateParam(0, inject(DI_TOKENS.LazyModuleLoader))], ScheduleListCommand);
881
+ //#endregion
882
+ //#region src/quarry/builtin-quarry.module.ts
883
+ let BuiltinQuarryModule = class BuiltinQuarryModule {};
884
+ BuiltinQuarryModule = __decorate([Module({ providers: [
885
+ HelpCommand,
886
+ DbSeedCommand,
887
+ DbSeedListCommand,
888
+ RouteListCommand,
889
+ RouteTypesCommand,
890
+ EventListCommand,
891
+ ScheduleListCommand,
892
+ QueueListCommand,
893
+ QueueFailedCommand,
894
+ QueueRetryCommand,
895
+ QueuePurgeCommand,
896
+ McpServeCommand,
897
+ McpToolsCommand,
898
+ ApiCommand,
899
+ I18nCheckCommand,
900
+ I18nDuplicatesCommand,
901
+ I18nListCommand,
902
+ I18nNamespacesCommand,
903
+ I18nSearchCommand,
904
+ I18nStatsCommand
905
+ ] })], BuiltinQuarryModule);
906
+ //#endregion
907
+ //#region src/quarry/quarry-runner.ts
908
+ /**
909
+ * Builds a `Stratal` instance for the quarry CLI entry (`src/quarry.ts`).
910
+ *
911
+ * Synthesizes a wrapper module from the given `imports` and `providers`,
912
+ * so CLI-only classes (seeders, ecosystem CLI commands) stay out of the
913
+ * worker bundle — `src/index.ts` doesn't reference any of them. Forces
914
+ * CLI-friendly logging defaults (`level: 'error'`, `formatter: 'pretty'`).
915
+ *
916
+ * @example
917
+ * ```ts
918
+ * // src/quarry.ts
919
+ * export default QuarryRunner.run({
920
+ * imports: [AppModule, InertiaQuarryModule],
921
+ * providers: [GeoSeeder, DemoSeeder],
922
+ * })
923
+ * ```
924
+ */
925
+ var QuarryRunner = class {
926
+ static run(options) {
927
+ let QuarryEntryModule = class QuarryEntryModule {};
928
+ QuarryEntryModule = __decorate([Module({
929
+ imports: [BuiltinQuarryModule, ...options.imports],
930
+ providers: options.providers ?? []
931
+ })], QuarryEntryModule);
932
+ return new Stratal({
933
+ module: QuarryEntryModule,
934
+ exceptionHandler: options.exceptionHandler,
935
+ logging: {
936
+ level: "error",
937
+ formatter: "pretty"
938
+ }
939
+ });
940
+ }
941
+ };
942
+ //#endregion
943
+ export { ApiCommand, BuiltinQuarryModule, EventListCommand, HelpCommand, McpServeCommand, McpToolsCommand, QuarryRunner, QueueListCommand, RouteListCommand, RouteTypesCommand, ScheduleListCommand };
944
+
945
+ //# sourceMappingURL=runner.mjs.map