gemi 0.116.0 → 0.118.0

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 (355) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/ai/index.js.map +1 -1
  3. package/dist/app/index.js +2 -2
  4. package/dist/app/index.js.map +1 -1
  5. package/dist/auth/AuthServiceProvider.d.ts.map +1 -1
  6. package/dist/auth/config.d.ts +27 -0
  7. package/dist/auth/config.d.ts.map +1 -1
  8. package/dist/auth/connections/ConnectionManager.d.ts +133 -0
  9. package/dist/auth/connections/ConnectionManager.d.ts.map +1 -0
  10. package/dist/auth/connections/ConnectionStore.d.ts +146 -0
  11. package/dist/auth/connections/ConnectionStore.d.ts.map +1 -0
  12. package/dist/auth/connections/ConnectionsController.d.ts +23 -0
  13. package/dist/auth/connections/ConnectionsController.d.ts.map +1 -0
  14. package/dist/auth/connections/OAuthConnectionProvider.d.ts +105 -0
  15. package/dist/auth/connections/OAuthConnectionProvider.d.ts.map +1 -0
  16. package/dist/auth/connections/errors.d.ts +32 -0
  17. package/dist/auth/connections/errors.d.ts.map +1 -0
  18. package/dist/auth/oauth/oauthState.d.ts +15 -2
  19. package/dist/auth/oauth/oauthState.d.ts.map +1 -1
  20. package/dist/auth/routes.d.ts +13 -0
  21. package/dist/auth/routes.d.ts.map +1 -1
  22. package/dist/bin/orm/emit.d.ts.map +1 -1
  23. package/dist/bin/orm-generator.js +51 -4
  24. package/dist/bin/orm-generator.js.map +4 -4
  25. package/dist/bun/plugin.js +2 -2
  26. package/dist/bun/plugin.js.map +1 -1
  27. package/dist/bun/preload.js +2 -2
  28. package/dist/bun/preload.js.map +1 -1
  29. package/dist/{chunk-2tzm58j3.js → chunk-01ehxca0.js} +2 -2
  30. package/dist/{chunk-2tzm58j3.js.map → chunk-01ehxca0.js.map} +1 -1
  31. package/dist/chunk-0gtyects.js +10 -0
  32. package/dist/{chunk-yf1njzd5.js.map → chunk-0gtyects.js.map} +6 -5
  33. package/dist/{chunk-15c2vgaf.js → chunk-1m3hvy3q.js} +2 -2
  34. package/dist/{chunk-15c2vgaf.js.map → chunk-1m3hvy3q.js.map} +1 -1
  35. package/dist/{chunk-6cx8ncd4.js → chunk-1z1rj2zq.js} +3 -3
  36. package/dist/{chunk-6cx8ncd4.js.map → chunk-1z1rj2zq.js.map} +1 -1
  37. package/dist/{chunk-5stgtwqw.js → chunk-2bja99cq.js} +2 -2
  38. package/dist/{chunk-5stgtwqw.js.map → chunk-2bja99cq.js.map} +1 -1
  39. package/dist/{chunk-n672d4g8.js → chunk-30xxc6r7.js} +2 -2
  40. package/dist/{chunk-n672d4g8.js.map → chunk-30xxc6r7.js.map} +1 -1
  41. package/dist/{chunk-qjhw8nje.js → chunk-33s2xqv1.js} +1 -1
  42. package/dist/{chunk-4088szy9.js → chunk-39kyz4k6.js} +3 -3
  43. package/dist/{chunk-4088szy9.js.map → chunk-39kyz4k6.js.map} +1 -1
  44. package/dist/chunk-3nf95j9e.js +5 -0
  45. package/dist/{chunk-1q9kd20m.js.map → chunk-3nf95j9e.js.map} +1 -1
  46. package/dist/chunk-3zxfd7pn.js +14 -0
  47. package/dist/{chunk-pn8v6fj2.js.map → chunk-3zxfd7pn.js.map} +11 -6
  48. package/dist/{chunk-pyk3gzvc.js → chunk-453rmkpm.js} +2 -2
  49. package/dist/{chunk-pyk3gzvc.js.map → chunk-453rmkpm.js.map} +1 -1
  50. package/dist/chunk-47h12eme.js +57 -0
  51. package/dist/{chunk-ms9k0rx6.js.map → chunk-47h12eme.js.map} +15 -11
  52. package/dist/chunk-490sbcma.js +5 -0
  53. package/dist/chunk-490sbcma.js.map +12 -0
  54. package/dist/{chunk-kqxdsv22.js → chunk-4c1kdd8p.js} +2 -2
  55. package/dist/{chunk-kqxdsv22.js.map → chunk-4c1kdd8p.js.map} +1 -1
  56. package/dist/{chunk-jdhdrr2k.js → chunk-5cgq9c43.js} +2 -2
  57. package/dist/{chunk-jdhdrr2k.js.map → chunk-5cgq9c43.js.map} +1 -1
  58. package/dist/{chunk-9n1hx3mq.js → chunk-5dbpgyrx.js} +3 -3
  59. package/dist/{chunk-9n1hx3mq.js.map → chunk-5dbpgyrx.js.map} +1 -1
  60. package/dist/{chunk-eqse2m6n.js → chunk-5ses4tcz.js} +2 -2
  61. package/dist/{chunk-eqse2m6n.js.map → chunk-5ses4tcz.js.map} +1 -1
  62. package/dist/{chunk-2z1981d0.js → chunk-675kzd7z.js} +2 -2
  63. package/dist/{chunk-2z1981d0.js.map → chunk-675kzd7z.js.map} +1 -1
  64. package/dist/{chunk-p1aqq0ga.js → chunk-6ggmk2eg.js} +3 -3
  65. package/dist/{chunk-p1aqq0ga.js.map → chunk-6ggmk2eg.js.map} +1 -1
  66. package/dist/{chunk-mazznq15.js → chunk-76p0rf4d.js} +3 -3
  67. package/dist/{chunk-mazznq15.js.map → chunk-76p0rf4d.js.map} +1 -1
  68. package/dist/{chunk-41da9628.js → chunk-8t6dwwz6.js} +1 -1
  69. package/dist/{chunk-zyt2w03d.js → chunk-8wcpxm41.js} +2 -2
  70. package/dist/{chunk-zyt2w03d.js.map → chunk-8wcpxm41.js.map} +1 -1
  71. package/dist/chunk-9pkj7sk6.js +50 -0
  72. package/dist/chunk-9pkj7sk6.js.map +10 -0
  73. package/dist/{chunk-jmpw6bqz.js → chunk-a1qt8aky.js} +2 -2
  74. package/dist/{chunk-jmpw6bqz.js.map → chunk-a1qt8aky.js.map} +1 -1
  75. package/dist/{chunk-frerzsxq.js → chunk-a22h5cby.js} +2 -2
  76. package/dist/{chunk-frerzsxq.js.map → chunk-a22h5cby.js.map} +1 -1
  77. package/dist/{chunk-e573yxpq.js → chunk-aedkrck1.js} +3 -3
  78. package/dist/{chunk-e573yxpq.js.map → chunk-aedkrck1.js.map} +1 -1
  79. package/dist/{chunk-vxm6yevm.js → chunk-aqpaw4jq.js} +2 -2
  80. package/dist/{chunk-vxm6yevm.js.map → chunk-aqpaw4jq.js.map} +1 -1
  81. package/dist/{chunk-aeh67ynz.js → chunk-bgwtdbfw.js} +3 -3
  82. package/dist/{chunk-aeh67ynz.js.map → chunk-bgwtdbfw.js.map} +1 -1
  83. package/dist/{chunk-tw5kwbx4.js → chunk-bz8xssrc.js} +2 -2
  84. package/dist/{chunk-tw5kwbx4.js.map → chunk-bz8xssrc.js.map} +1 -1
  85. package/dist/{chunk-tzm3c7n6.js → chunk-cte6ysqd.js} +4 -4
  86. package/dist/{chunk-tzm3c7n6.js.map → chunk-cte6ysqd.js.map} +1 -1
  87. package/dist/{chunk-qsrcdzan.js → chunk-cvfg88cx.js} +3 -3
  88. package/dist/{chunk-qsrcdzan.js.map → chunk-cvfg88cx.js.map} +1 -1
  89. package/dist/{chunk-1vzks22y.js → chunk-d806cy7p.js} +2 -2
  90. package/dist/{chunk-1vzks22y.js.map → chunk-d806cy7p.js.map} +1 -1
  91. package/dist/{chunk-6chz1ktz.js → chunk-de4t48j9.js} +3 -3
  92. package/dist/{chunk-6chz1ktz.js.map → chunk-de4t48j9.js.map} +1 -1
  93. package/dist/{chunk-mqfzdfnz.js → chunk-dwpn6fze.js} +2 -2
  94. package/dist/{chunk-mqfzdfnz.js.map → chunk-dwpn6fze.js.map} +1 -1
  95. package/dist/{chunk-vbdty91k.js → chunk-ebret82e.js} +3 -3
  96. package/dist/{chunk-vbdty91k.js.map → chunk-ebret82e.js.map} +1 -1
  97. package/dist/chunk-eke2frrm.js +9 -0
  98. package/dist/{chunk-hytt9qyj.js.map → chunk-eke2frrm.js.map} +3 -4
  99. package/dist/{chunk-yer1r3t3.js → chunk-epvpmakp.js} +2 -2
  100. package/dist/{chunk-yer1r3t3.js.map → chunk-epvpmakp.js.map} +1 -1
  101. package/dist/{chunk-fxgxf16k.js → chunk-fsj5k511.js} +2 -2
  102. package/dist/{chunk-fxgxf16k.js.map → chunk-fsj5k511.js.map} +1 -1
  103. package/dist/{chunk-t4yh4nf9.js → chunk-g5ppst76.js} +3 -3
  104. package/dist/{chunk-t4yh4nf9.js.map → chunk-g5ppst76.js.map} +1 -1
  105. package/dist/{chunk-aazmrxj9.js → chunk-g9hhdcax.js} +2 -2
  106. package/dist/{chunk-aazmrxj9.js.map → chunk-g9hhdcax.js.map} +1 -1
  107. package/dist/{chunk-cbqazg9k.js → chunk-gqfqnv3f.js} +2 -2
  108. package/dist/{chunk-cbqazg9k.js.map → chunk-gqfqnv3f.js.map} +1 -1
  109. package/dist/chunk-hkf2k2eq.js +5 -0
  110. package/dist/{chunk-whtzggn6.js.map → chunk-hkf2k2eq.js.map} +3 -4
  111. package/dist/{chunk-vw8849ys.js → chunk-hm9cjxy2.js} +2 -2
  112. package/dist/{chunk-m54s6jpr.js.map → chunk-hm9cjxy2.js.map} +1 -1
  113. package/dist/{chunk-kejwjerj.js → chunk-hr1r3g0d.js} +2 -2
  114. package/dist/{chunk-kejwjerj.js.map → chunk-hr1r3g0d.js.map} +1 -1
  115. package/dist/{chunk-3hrj5rwm.js → chunk-hzepfrzy.js} +2 -2
  116. package/dist/{chunk-3hrj5rwm.js.map → chunk-hzepfrzy.js.map} +1 -1
  117. package/dist/{chunk-785b41h1.js → chunk-j5858bz7.js} +3 -3
  118. package/dist/{chunk-785b41h1.js.map → chunk-j5858bz7.js.map} +1 -1
  119. package/dist/{chunk-d9mar37g.js → chunk-jf6qqzat.js} +2 -2
  120. package/dist/{chunk-d9mar37g.js.map → chunk-jf6qqzat.js.map} +1 -1
  121. package/dist/{chunk-1hr4xht1.js → chunk-jg79n382.js} +2 -2
  122. package/dist/{chunk-1hr4xht1.js.map → chunk-jg79n382.js.map} +1 -1
  123. package/dist/chunk-k31qfe7a.js +71 -0
  124. package/dist/chunk-k31qfe7a.js.map +13 -0
  125. package/dist/{chunk-4mfrgd5m.js → chunk-kk77x2v4.js} +2 -2
  126. package/dist/{chunk-4mfrgd5m.js.map → chunk-kk77x2v4.js.map} +1 -1
  127. package/dist/{chunk-1myhm0g3.js → chunk-kkte8nze.js} +3 -3
  128. package/dist/{chunk-1myhm0g3.js.map → chunk-kkte8nze.js.map} +1 -1
  129. package/dist/{chunk-hdps9n52.js → chunk-m4kmetpb.js} +3 -3
  130. package/dist/{chunk-hdps9n52.js.map → chunk-m4kmetpb.js.map} +1 -1
  131. package/dist/{chunk-gts5p6mw.js → chunk-n4sdm0jn.js} +4 -4
  132. package/dist/{chunk-gts5p6mw.js.map → chunk-n4sdm0jn.js.map} +1 -1
  133. package/dist/chunk-nang3847.js +416 -0
  134. package/dist/chunk-nang3847.js.map +24 -0
  135. package/dist/{chunk-agyfv3f8.js → chunk-nrezmscd.js} +1 -1
  136. package/dist/{chunk-xt9tv99x.js → chunk-p83erprx.js} +2 -2
  137. package/dist/{chunk-xt9tv99x.js.map → chunk-p83erprx.js.map} +1 -1
  138. package/dist/{chunk-sr942vb1.js → chunk-pkr5dsbk.js} +2 -2
  139. package/dist/{chunk-sr942vb1.js.map → chunk-pkr5dsbk.js.map} +1 -1
  140. package/dist/{chunk-yhrye9cm.js → chunk-pqc16rrx.js} +2 -2
  141. package/dist/{chunk-yhrye9cm.js.map → chunk-pqc16rrx.js.map} +1 -1
  142. package/dist/{chunk-m54s6jpr.js → chunk-pvz90a49.js} +2 -2
  143. package/dist/{chunk-vw8849ys.js.map → chunk-pvz90a49.js.map} +1 -1
  144. package/dist/{chunk-fre6f4nk.js → chunk-q290tgza.js} +2 -2
  145. package/dist/{chunk-fre6f4nk.js.map → chunk-q290tgza.js.map} +1 -1
  146. package/dist/{chunk-8rv62v14.js → chunk-qf4bmee9.js} +2 -2
  147. package/dist/{chunk-8rv62v14.js.map → chunk-qf4bmee9.js.map} +1 -1
  148. package/dist/chunk-qkxnvpaj.js +5 -0
  149. package/dist/chunk-qkxnvpaj.js.map +10 -0
  150. package/dist/chunk-r1favzz4.js +19 -0
  151. package/dist/{chunk-ktr3k768.js.map → chunk-r1favzz4.js.map} +5 -4
  152. package/dist/{chunk-303mprnv.js → chunk-r3v2cnrj.js} +2 -2
  153. package/dist/{chunk-303mprnv.js.map → chunk-r3v2cnrj.js.map} +1 -1
  154. package/dist/{chunk-x7cpth2f.js → chunk-razjfecn.js} +1 -1
  155. package/dist/{chunk-t04f3akb.js → chunk-scc0j5k9.js} +2 -2
  156. package/dist/{chunk-t04f3akb.js.map → chunk-scc0j5k9.js.map} +1 -1
  157. package/dist/{chunk-56jky6vf.js → chunk-sce5jes2.js} +2 -2
  158. package/dist/{chunk-56jky6vf.js.map → chunk-sce5jes2.js.map} +1 -1
  159. package/dist/chunk-sd02ktf2.js +24 -0
  160. package/dist/{chunk-79xg42e7.js.map → chunk-sd02ktf2.js.map} +2 -2
  161. package/dist/{chunk-mschc94q.js → chunk-sn04cyw0.js} +2 -2
  162. package/dist/{chunk-mschc94q.js.map → chunk-sn04cyw0.js.map} +1 -1
  163. package/dist/{chunk-bra1a1fq.js → chunk-tfdmvxza.js} +2 -2
  164. package/dist/{chunk-bra1a1fq.js.map → chunk-tfdmvxza.js.map} +1 -1
  165. package/dist/{chunk-z10cas5r.js → chunk-thz75w6e.js} +2 -2
  166. package/dist/{chunk-z10cas5r.js.map → chunk-thz75w6e.js.map} +1 -1
  167. package/dist/{chunk-v1tfdgy1.js → chunk-tzdenj0n.js} +3 -3
  168. package/dist/{chunk-v1tfdgy1.js.map → chunk-tzdenj0n.js.map} +1 -1
  169. package/dist/{chunk-98m15b9x.js → chunk-x6v2zex2.js} +2 -2
  170. package/dist/{chunk-98m15b9x.js.map → chunk-x6v2zex2.js.map} +1 -1
  171. package/dist/{chunk-d2gfcf85.js → chunk-xfw8zyvn.js} +2 -2
  172. package/dist/{chunk-d2gfcf85.js.map → chunk-xfw8zyvn.js.map} +1 -1
  173. package/dist/{chunk-wyw6p3fg.js → chunk-xtzn0qfh.js} +3 -3
  174. package/dist/{chunk-wyw6p3fg.js.map → chunk-xtzn0qfh.js.map} +1 -1
  175. package/dist/{chunk-tn2bryy2.js → chunk-xx3zvc3g.js} +2 -2
  176. package/dist/{chunk-tn2bryy2.js.map → chunk-xx3zvc3g.js.map} +1 -1
  177. package/dist/{chunk-er3wf6ng.js → chunk-xzn2nmny.js} +2 -2
  178. package/dist/{chunk-er3wf6ng.js.map → chunk-xzn2nmny.js.map} +1 -1
  179. package/dist/{chunk-p91b8zcn.js → chunk-xzyy896s.js} +2 -2
  180. package/dist/{chunk-p91b8zcn.js.map → chunk-xzyy896s.js.map} +1 -1
  181. package/dist/chunk-y09r0wsw.js +5 -0
  182. package/dist/chunk-y09r0wsw.js.map +12 -0
  183. package/dist/{chunk-6d8rvr1v.js → chunk-ygf0z7kk.js} +2 -2
  184. package/dist/{chunk-6d8rvr1v.js.map → chunk-ygf0z7kk.js.map} +1 -1
  185. package/dist/chunk-z759yah5.js +5 -0
  186. package/dist/chunk-z759yah5.js.map +12 -0
  187. package/dist/client/Head.d.ts.map +1 -1
  188. package/dist/client/fonts.d.ts +69 -0
  189. package/dist/client/fonts.d.ts.map +1 -0
  190. package/dist/client/index.d.ts +1 -0
  191. package/dist/client/index.d.ts.map +1 -1
  192. package/dist/client/index.js +75 -1
  193. package/dist/client/index.js.map +1 -1
  194. package/dist/config/index.js +1 -1
  195. package/dist/console/builtins.d.ts +13 -0
  196. package/dist/console/builtins.d.ts.map +1 -0
  197. package/dist/console/run.js +13 -11
  198. package/dist/console/run.js.map +6 -5
  199. package/dist/console/runner.d.ts.map +1 -1
  200. package/dist/console/usage.d.ts +2 -0
  201. package/dist/console/usage.d.ts.map +1 -1
  202. package/dist/container/index.js +2 -2
  203. package/dist/container/index.js.map +1 -1
  204. package/dist/database/index.js +2 -2
  205. package/dist/database/index.js.map +1 -1
  206. package/dist/email/index.js +2 -2
  207. package/dist/email/index.js.map +1 -1
  208. package/dist/facades/Connections.d.ts +36 -0
  209. package/dist/facades/Connections.d.ts.map +1 -0
  210. package/dist/facades/Crypt.d.ts +26 -0
  211. package/dist/facades/Crypt.d.ts.map +1 -0
  212. package/dist/facades/Meta.d.ts +7 -1
  213. package/dist/facades/Meta.d.ts.map +1 -1
  214. package/dist/facades/Storage.d.ts +29 -0
  215. package/dist/facades/Storage.d.ts.map +1 -1
  216. package/dist/facades/index.d.ts +2 -0
  217. package/dist/facades/index.d.ts.map +1 -1
  218. package/dist/facades/index.js +2 -2
  219. package/dist/facades/index.js.map +1 -1
  220. package/dist/foundation/index.js +2 -2
  221. package/dist/foundation/index.js.map +1 -1
  222. package/dist/http/HttpRequest.d.ts +1 -0
  223. package/dist/http/HttpRequest.d.ts.map +1 -1
  224. package/dist/http/Metadata.d.ts +5 -0
  225. package/dist/http/Metadata.d.ts.map +1 -1
  226. package/dist/http/index.d.ts +3 -1
  227. package/dist/http/index.d.ts.map +1 -1
  228. package/dist/http/index.js +2 -2
  229. package/dist/http/index.js.map +1 -1
  230. package/dist/http/requestContext.d.ts +1 -0
  231. package/dist/http/requestContext.d.ts.map +1 -1
  232. package/dist/http/safeFetch/errors.d.ts +10 -0
  233. package/dist/http/safeFetch/errors.d.ts.map +1 -1
  234. package/dist/http/safeFetch/index.d.ts +1 -1
  235. package/dist/http/safeFetch/index.d.ts.map +1 -1
  236. package/dist/http/sitemap/Robots.d.ts +95 -0
  237. package/dist/http/sitemap/Robots.d.ts.map +1 -0
  238. package/dist/http/sitemap/Sitemap.d.ts +145 -0
  239. package/dist/http/sitemap/Sitemap.d.ts.map +1 -0
  240. package/dist/http/sitemap/fetchText.d.ts +16 -0
  241. package/dist/http/sitemap/fetchText.d.ts.map +1 -0
  242. package/dist/http/sitemap/index.d.ts +3 -0
  243. package/dist/http/sitemap/index.d.ts.map +1 -0
  244. package/dist/http/sitemap/xml.d.ts +21 -0
  245. package/dist/http/sitemap/xml.d.ts.map +1 -0
  246. package/dist/i18n/Translator.d.ts.map +1 -1
  247. package/dist/i18n/dictionaryRuntime.js +2 -2
  248. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  249. package/dist/i18n/index.d.ts +1 -1
  250. package/dist/i18n/index.d.ts.map +1 -1
  251. package/dist/i18n/index.js +2 -2
  252. package/dist/i18n/index.js.map +2 -2
  253. package/dist/i18n/resolveLocale.d.ts +18 -0
  254. package/dist/i18n/resolveLocale.d.ts.map +1 -1
  255. package/dist/kernel/index.js +3 -3
  256. package/dist/kernel/index.js.map +3 -3
  257. package/dist/kernel/providers.d.ts +2 -2
  258. package/dist/kernel/providers.d.ts.map +1 -1
  259. package/dist/orm/Model.d.ts.map +1 -1
  260. package/dist/orm/encryption-rotate.d.ts +44 -0
  261. package/dist/orm/encryption-rotate.d.ts.map +1 -0
  262. package/dist/orm/encryption.d.ts +54 -0
  263. package/dist/orm/encryption.d.ts.map +1 -0
  264. package/dist/orm/index.d.ts +2 -0
  265. package/dist/orm/index.d.ts.map +1 -1
  266. package/dist/orm/index.js +3 -3
  267. package/dist/orm/index.js.map +4 -4
  268. package/dist/orm/schema.d.ts +25 -1
  269. package/dist/orm/schema.d.ts.map +1 -1
  270. package/dist/server/index.js +2 -2
  271. package/dist/server/index.js.map +1 -1
  272. package/dist/services/discovery.d.ts +8 -0
  273. package/dist/services/discovery.d.ts.map +1 -1
  274. package/dist/services/encryption/Encrypter.d.ts +86 -0
  275. package/dist/services/encryption/Encrypter.d.ts.map +1 -0
  276. package/dist/services/encryption/EncryptionServiceProvider.d.ts +13 -0
  277. package/dist/services/encryption/EncryptionServiceProvider.d.ts.map +1 -0
  278. package/dist/services/encryption/config.d.ts +36 -0
  279. package/dist/services/encryption/config.d.ts.map +1 -0
  280. package/dist/services/file-storage/drivers/FileStorageDriver.d.ts +12 -1
  281. package/dist/services/file-storage/drivers/FileStorageDriver.d.ts.map +1 -1
  282. package/dist/services/file-storage/drivers/FileSystemDriver.d.ts +8 -1
  283. package/dist/services/file-storage/drivers/FileSystemDriver.d.ts.map +1 -1
  284. package/dist/services/file-storage/drivers/types.d.ts +17 -0
  285. package/dist/services/file-storage/drivers/types.d.ts.map +1 -1
  286. package/dist/services/file-storage/putFromUrl.d.ts +56 -0
  287. package/dist/services/file-storage/putFromUrl.d.ts.map +1 -0
  288. package/dist/services/file-storage/sniffContentType.d.ts +33 -0
  289. package/dist/services/file-storage/sniffContentType.d.ts.map +1 -0
  290. package/dist/services/index.d.ts +26 -5
  291. package/dist/services/index.d.ts.map +1 -1
  292. package/dist/services/index.js +10 -10
  293. package/dist/services/index.js.map +4 -3
  294. package/dist/services/queue/DatabaseQueueDriver.d.ts +117 -7
  295. package/dist/services/queue/DatabaseQueueDriver.d.ts.map +1 -1
  296. package/dist/services/queue/Job.d.ts +75 -0
  297. package/dist/services/queue/Job.d.ts.map +1 -1
  298. package/dist/services/queue/MemoryQueueDriver.d.ts +32 -2
  299. package/dist/services/queue/MemoryQueueDriver.d.ts.map +1 -1
  300. package/dist/services/queue/QueueDriver.d.ts +83 -1
  301. package/dist/services/queue/QueueDriver.d.ts.map +1 -1
  302. package/dist/services/queue/QueueManager.d.ts +80 -7
  303. package/dist/services/queue/QueueManager.d.ts.map +1 -1
  304. package/dist/services/queue/QueueServiceProvider.d.ts.map +1 -1
  305. package/dist/services/queue/backoff.d.ts +6 -0
  306. package/dist/services/queue/backoff.d.ts.map +1 -0
  307. package/dist/services/queue/batch.d.ts +112 -0
  308. package/dist/services/queue/batch.d.ts.map +1 -0
  309. package/dist/services/queue/config.d.ts +9 -0
  310. package/dist/services/queue/config.d.ts.map +1 -1
  311. package/dist/services/queue/queueDriverContract.d.ts +5 -0
  312. package/dist/services/queue/queueDriverContract.d.ts.map +1 -1
  313. package/dist/services/queue/work.js +2 -2
  314. package/dist/services/queue/work.js.map +1 -1
  315. package/dist/services/queue/workflow/DatabaseWorkflowStore.d.ts +89 -0
  316. package/dist/services/queue/workflow/DatabaseWorkflowStore.d.ts.map +1 -0
  317. package/dist/services/queue/workflow/MemoryWorkflowStore.d.ts +43 -0
  318. package/dist/services/queue/workflow/MemoryWorkflowStore.d.ts.map +1 -0
  319. package/dist/services/queue/workflow/Step.d.ts +202 -0
  320. package/dist/services/queue/workflow/Step.d.ts.map +1 -0
  321. package/dist/services/queue/workflow/Workflow.d.ts +124 -0
  322. package/dist/services/queue/workflow/Workflow.d.ts.map +1 -0
  323. package/dist/services/queue/workflow/WorkflowRuntime.d.ts +60 -0
  324. package/dist/services/queue/workflow/WorkflowRuntime.d.ts.map +1 -0
  325. package/dist/services/queue/workflow/WorkflowStore.d.ts +184 -0
  326. package/dist/services/queue/workflow/WorkflowStore.d.ts.map +1 -0
  327. package/dist/services/queue/workflow/duration.d.ts +8 -0
  328. package/dist/services/queue/workflow/duration.d.ts.map +1 -0
  329. package/dist/services/queue/workflow/workflowContract.d.ts +30 -0
  330. package/dist/services/queue/workflow/workflowContract.d.ts.map +1 -0
  331. package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
  332. package/dist/stats/route-table.js +1 -1
  333. package/dist/support/index.js +2 -2
  334. package/dist/support/index.js.map +1 -1
  335. package/dist/vitest/index.js +2 -2
  336. package/dist/vitest/index.js.map +1 -1
  337. package/package.json +1 -1
  338. package/dist/chunk-1q9kd20m.js +0 -5
  339. package/dist/chunk-49nyyjfe.js +0 -5
  340. package/dist/chunk-49nyyjfe.js.map +0 -11
  341. package/dist/chunk-79xg42e7.js +0 -24
  342. package/dist/chunk-7vb4eey2.js +0 -217
  343. package/dist/chunk-7vb4eey2.js.map +0 -16
  344. package/dist/chunk-hytt9qyj.js +0 -54
  345. package/dist/chunk-jmg2zsaf.js +0 -5
  346. package/dist/chunk-jmg2zsaf.js.map +0 -12
  347. package/dist/chunk-ktr3k768.js +0 -19
  348. package/dist/chunk-ms9k0rx6.js +0 -46
  349. package/dist/chunk-pn8v6fj2.js +0 -14
  350. package/dist/chunk-whtzggn6.js +0 -5
  351. package/dist/chunk-yf1njzd5.js +0 -10
  352. /package/dist/{chunk-qjhw8nje.js.map → chunk-33s2xqv1.js.map} +0 -0
  353. /package/dist/{chunk-41da9628.js.map → chunk-8t6dwwz6.js.map} +0 -0
  354. /package/dist/{chunk-agyfv3f8.js.map → chunk-nrezmscd.js.map} +0 -0
  355. /package/dist/{chunk-x7cpth2f.js.map → chunk-razjfecn.js.map} +0 -0
@@ -1,13 +1,30 @@
1
1
  import type { DatabaseConnection } from "../../database/Connection";
2
2
  import type { Dialect } from "../../database/dialect";
3
3
  import { DatabaseLockStore } from "../lock/DatabaseLockStore";
4
- import type { ClaimOptions, ClaimedJob, EnqueueJob, JobFailure, JobRelease, QueueDriver } from "./QueueDriver";
4
+ import { type BatchStatus } from "./batch";
5
+ import type { ClaimOptions, ClaimedJob, EnqueueBatch, EnqueueJob, JobFailure, JobRelease, QueueDriver } from "./QueueDriver";
6
+ import { DatabaseWorkflowStore } from "./workflow/DatabaseWorkflowStore";
5
7
  export type DatabaseQueueDriverOptions = {
6
8
  /**
7
9
  * The jobs table. Default `gemi_jobs`. A plain identifier — letters, digits
8
10
  * and underscores — because it is spliced into every statement.
9
11
  */
10
12
  table?: string;
13
+ /**
14
+ * The table batches are kept in. Default `gemi_job_batches` beside
15
+ * `gemi_jobs`, and `<table>_batches` beside a jobs table of another name.
16
+ * A plain identifier, like `table`. Only touched by `Job.dispatchBatch` and
17
+ * the batch methods.
18
+ */
19
+ batchTable?: string;
20
+ /**
21
+ * The tables workflows are kept in. Default `gemi_workflows` and
22
+ * `gemi_workflow_steps` beside `gemi_jobs`, and `<table>_workflows` and
23
+ * `<table>_workflow_steps` beside a jobs table of another name. Plain
24
+ * identifiers, like `table`. Only touched by `Workflow`.
25
+ */
26
+ workflowTable?: string;
27
+ workflowStepTable?: string;
11
28
  /**
12
29
  * SQLite only: how long, in milliseconds, a statement waits for another
13
30
  * process's write lock before failing with `SQLITE_BUSY`. Default `1000`.
@@ -72,6 +89,15 @@ export type DatabaseJobStatus = "pending" | "claimed" | "dead";
72
89
  * `transaction` below for why SQLite is left out, and why a driver built from
73
90
  * a bare client never joins.
74
91
  *
92
+ * ### Batches
93
+ *
94
+ * A batch is a row of `batchTable`, and its jobs are rows of the jobs table
95
+ * with `batch_id` set. Ending a job of a batch, counting it and enqueueing any
96
+ * callback it makes due happen in one transaction that locks the batch row
97
+ * first; see the "Batches" section below. A table from before batches, without
98
+ * `batch_id` and `progress`, still runs every other job: the claim reads `*`,
99
+ * and only the batch methods need the new columns.
100
+ *
75
101
  * ### What it does not do
76
102
  *
77
103
  * It has no `subscribe`: another process's dispatch cannot wake this one, so
@@ -80,12 +106,18 @@ export type DatabaseJobStatus = "pending" | "claimed" | "dead";
80
106
  */
81
107
  export declare class DatabaseQueueDriver implements QueueDriver {
82
108
  readonly table: string;
109
+ readonly batchTable: string;
110
+ readonly workflowTable: string;
111
+ readonly workflowStepTable: string;
112
+ private workflows;
83
113
  private readonly sql;
84
114
  private readonly dialect;
85
115
  /** The connection's name, when it came with one; see `transaction`. */
86
116
  private readonly connection;
87
117
  private readonly busyTimeout;
88
118
  private configured;
119
+ /** SQLite: the transaction before the next; see `atomically`. */
120
+ private sqliteTail;
89
121
  constructor(connection: Pick<DatabaseConnection, "sql" | "dialect"> & Partial<Pick<DatabaseConnection, "name">>, options?: DatabaseQueueDriverOptions);
90
122
  /**
91
123
  * Gives a SQLite connection a busy timeout, once, before the driver's first
@@ -118,14 +150,18 @@ export declare class DatabaseQueueDriver implements QueueDriver {
118
150
  */
119
151
  private configure;
120
152
  /**
121
- * Creates the table and its indexes if they do not exist — the same DDL
122
- * Prisma generates for the model in the docs, so a table made either way is
123
- * the table the other expects. For tests and for an app that does not
124
- * manage its schema with Prisma; one that does should add the model
125
- * instead, or `prisma migrate` will see a table it does not know and drop
126
- * it.
153
+ * Creates the jobs table, the batches table, the two workflow tables and
154
+ * their indexes if they do not exist — the same DDL Prisma generates for
155
+ * the models in the docs, so
156
+ * a table made either way is the table the other expects — and adds the
157
+ * batch columns to a jobs table from before batches. For tests and for an
158
+ * app that does not manage its schema with Prisma; one that does should add
159
+ * the models instead, or `prisma migrate` will see tables it does not know
160
+ * and drop them.
127
161
  */
128
162
  createTable(): Promise<void>;
163
+ /** Whether the jobs table has `batch_id` and `progress` yet. */
164
+ private hasBatchColumns;
129
165
  enqueue(job: EnqueueJob): Promise<string>;
130
166
  private insert;
131
167
  /**
@@ -182,6 +218,65 @@ export declare class DatabaseQueueDriver implements QueueDriver {
182
218
  * a scheduled job, say.
183
219
  */
184
220
  prune(olderThanMs: number): Promise<number>;
221
+ enqueueBatch(batch: EnqueueBatch): Promise<void>;
222
+ private insertBatch;
223
+ findBatch(id: string, options?: {
224
+ progress?: boolean;
225
+ }): Promise<BatchStatus | null>;
226
+ cancelBatch(id: string): Promise<boolean>;
227
+ /** `cancelBatch`, inside a transaction the caller has open. */
228
+ private cancelBatchOn;
229
+ /**
230
+ * Workflows (#846), in `workflowTable` and `workflowStepTable` of this
231
+ * driver's database. Their writes share this driver's transactions, so a
232
+ * step's record and the tick or batch it schedules commit together.
233
+ */
234
+ workflowStore(): DatabaseWorkflowStore;
235
+ reportProgress(job: ClaimedJob, progress: number): Promise<void>;
236
+ /**
237
+ * Deletes batches that finished more than `olderThanMs` ago, and resolves
238
+ * to how many. Nothing else removes them; a finished batch is only kept so
239
+ * `findBatch` can still answer for it.
240
+ */
241
+ pruneBatches(olderThanMs: number): Promise<number>;
242
+ /**
243
+ * `complete` and `fail` for a job of a batch: the job's row is ended and the
244
+ * batch counts it, in one transaction.
245
+ */
246
+ private endBatchJob;
247
+ /** Counts one job's end against its locked batch row. */
248
+ private count;
249
+ /**
250
+ * Ends the batch's waiting jobs as cancelled — kept as dead rows that say
251
+ * why — and resolves to how many there were. Their rows are locked after
252
+ * the batch row, the order every batch transaction takes.
253
+ */
254
+ private cancelWaiting;
255
+ /** Writes the batch's new counters and enqueues the callbacks they made due. */
256
+ private saveBatch;
257
+ /**
258
+ * Reads the batch row and holds it until the transaction ends. Postgres and
259
+ * MySQL lock the row; SQLite has no row locks, so a write to the row takes
260
+ * the file's write lock instead, waiting out another process's for the
261
+ * busy timeout rather than failing on the upgrade from a read lock.
262
+ */
263
+ private lockBatch;
264
+ /**
265
+ * Runs `fn` in a transaction of the driver's own.
266
+ *
267
+ * On SQLite one at a time per driver. Bun gives a SQLite client a single
268
+ * connection, and a second `begin` on it while one is open is refused with
269
+ * "cannot start a transaction within a transaction". One the application
270
+ * has open on the same client — an ORM transaction, when the queue shares
271
+ * the default connection — is waited out the same way, a few times.
272
+ */
273
+ private atomically;
274
+ /** The database's clock now, as a number, for values computed here. */
275
+ private clock;
276
+ /** An epoch-milliseconds value or `NULL`, typed as the BIGINT columns are. */
277
+ private timeOrNull;
278
+ /** A 0..1 progress value as a parameter Postgres can assign to its column. */
279
+ private fraction;
185
280
  /**
186
281
  * Postgres and SQLite: one statement. Postgres locks the rows it picks with
187
282
  * `SKIP LOCKED` in a CTE, which it evaluates once, so a concurrent claimer
@@ -242,6 +337,9 @@ export declare class DatabaseQueueDriver implements QueueDriver {
242
337
  * `@@map`) made, and a reserved word such as `order` is a syntax error.
243
338
  */
244
339
  private name;
340
+ /** The batches table, quoted as `name` quotes the jobs table. */
341
+ private batches;
342
+ private quoted;
245
343
  /** The database's clock, in epoch milliseconds. */
246
344
  private now;
247
345
  /**
@@ -257,4 +355,16 @@ export declare class DatabaseQueueDriver implements QueueDriver {
257
355
  * the table, which is also where Prisma puts them.
258
356
  */
259
357
  export declare function createTableStatements(dialect: Dialect, table: string): string[];
358
+ /**
359
+ * The two columns and the index batches add to a jobs table made before them,
360
+ * as Prisma's migration for the updated model writes them. `createTable` runs
361
+ * these when the columns are missing; an app on Prisma gets the same from
362
+ * `prisma migrate dev` after updating the model.
363
+ */
364
+ export declare function addBatchColumnsStatements(dialect: Dialect, table: string): string[];
365
+ /**
366
+ * The batches table, as Prisma generates it for the `GemiJobBatch` model in
367
+ * the docs, with `IF NOT EXISTS` added.
368
+ */
369
+ export declare function createBatchTableStatements(dialect: Dialect, table: string): string[];
260
370
  //# sourceMappingURL=DatabaseQueueDriver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatabaseQueueDriver.d.ts","sourceRoot":"","sources":["../../../services/queue/DatabaseQueueDriver.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,O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,OAAO,CAAC,GAAG;IAcX;;;OAGG;IACH,OAAO,CAAC,EAAE;CAMX;AAYD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAiD/E;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAqBnF;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CA2CpF"}
@@ -1,3 +1,24 @@
1
+ import { type BatchStatus, type JobCall } from "./batch";
2
+ import type { ClaimedJob } from "./QueueDriver";
3
+ import { type DispatchedBatch, type JobBatchOptions } from "./QueueManager";
4
+ /** `this.batch` inside a job dispatched with `dispatchBatch`. */
5
+ export type JobBatch = {
6
+ /** The batch's id. */
7
+ id: string;
8
+ /**
9
+ * Whether the batch has been cancelled — by `Job.cancelBatch`, or by a
10
+ * failed job of a batch without `allowFailures`. Running jobs are not
11
+ * stopped; a long one checks this between steps and returns early.
12
+ */
13
+ cancelled(): Promise<boolean>;
14
+ };
15
+ /**
16
+ * The arguments `Job.with` takes for a job whose `run` ends with a
17
+ * `BatchStatus` parameter: the ones before it, because the batch appends its
18
+ * status when it enqueues the callback. Any other `run` takes its parameters
19
+ * as they are.
20
+ */
21
+ export type JobCallArgs<A extends any[]> = A extends [...infer Rest, infer Last] ? BatchStatus extends Last ? Rest : A : A;
1
22
  export declare class Job {
2
23
  static name: string;
3
24
  worker: boolean;
@@ -55,6 +76,22 @@ export declare class Job {
55
76
  fail(error: unknown, options?: {
56
77
  retry?: boolean;
57
78
  }): void;
79
+ /**
80
+ * The batch this run belongs to, when the job was dispatched with
81
+ * `dispatchBatch`; `undefined` otherwise. Set by the queue before `run`.
82
+ */
83
+ batch: JobBatch | undefined;
84
+ /**
85
+ * Called from `run` in a job of a batch: how far this job is, from 0 to 1,
86
+ * for the batch's `progress`. A retry starts again from 0, and a job that
87
+ * ends counts as 1 whatever it last said. Outside a batch it does nothing.
88
+ * Each call is a write, so report at steps, not per item of a hot loop.
89
+ */
90
+ progress(value: number): Promise<void>;
91
+ /** @internal Where `progress` writes; set by the queue for a job of a batch. */
92
+ $progress: ((value: number) => Promise<void>) | undefined;
93
+ /** @internal The claim this run is, set by the queue before `run`. */
94
+ $claimed: ClaimedJob | undefined;
58
95
  /** @internal What `release` or `fail` asked for during this run. */
59
96
  $outcome: {
60
97
  kind: "release";
@@ -78,6 +115,44 @@ export declare class Job {
78
115
  * that can, an ignored rejection is an unhandled one, so await it.
79
116
  */
80
117
  static dispatch<T extends Job>(this: new () => T, ...args: Parameters<T["run"]>): Promise<string>;
118
+ /**
119
+ * Queues one job per argument tuple as a batch, and resolves to the batch's
120
+ * id and size once every job is recorded. The jobs, the batch and its
121
+ * callbacks are recorded in one atomic write: all of them or none.
122
+ *
123
+ * ```ts
124
+ * const { id } = await BuildPageJob.dispatchBatch(
125
+ * pages.map((page) => [page.id, importId] as const),
126
+ * {
127
+ * name: `import:${importId}`,
128
+ * allowFailures: true,
129
+ * then: ImportFinishedJob.with(importId),
130
+ * catch: ImportFailedJob.with(importId),
131
+ * finally: ImportCleanupJob.with(importId),
132
+ * },
133
+ * );
134
+ * ```
135
+ *
136
+ * Callbacks are jobs, enqueued exactly once, by whichever process ends the
137
+ * job that makes them due, with the batch's status appended to their
138
+ * arguments. Each job's own hooks run as usual. A worker job, a unique job
139
+ * and a driver without batches are refused here, on the caller's stack.
140
+ */
141
+ static dispatchBatch<T extends Job>(this: new () => T, args: ReadonlyArray<Readonly<Parameters<T["run"]>>>, options?: JobBatchOptions): Promise<DispatchedBatch>;
142
+ /**
143
+ * A job and its arguments, without dispatching it: a batch's `then`,
144
+ * `catch` or `finally`. When the job runs, the batch's `BatchStatus` is
145
+ * appended to these arguments.
146
+ */
147
+ static with<T extends Job>(this: new () => T, ...args: JobCallArgs<Parameters<T["run"]>>): JobCall;
148
+ /** A batch's status, or `null` for an id the queue has no batch under. */
149
+ static findBatch(id: string): Promise<BatchStatus | null>;
150
+ /**
151
+ * Cancels a batch that is still running, and resolves to whether it did.
152
+ * Its waiting jobs never run; running ones finish unless they check
153
+ * `this.batch.cancelled()`. `catch` and then `finally` run; `then` does not.
154
+ */
155
+ static cancelBatch(id: string): Promise<boolean>;
81
156
  }
82
157
  export type JobThrottle = {
83
158
  /** Shared by every job that counts against the same budget. */
@@ -1 +1 @@
1
- {"version":3,"file":"Job.d.ts","sourceRoot":"","sources":["../../../services/queue/Job.ts"],"names":[],"mappings":"AAGA,qBAAa,GAAG;IACd,MAAM,CAAC,IAAI,SAAW;IACtB,MAAM,UAAS;IACf,WAAW,SAAK;IAEhB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAK;IAE/B;;;;;;;;;OASG;IACH,QAAQ,CAAC,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI;IAI7D;;;OAGG;IACH,SAAS,SAAe;IAExB;;;;;;OAMG;IACH,QAAQ,CAAC,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,WAAW,GAAG,WAAW,EAAE,GAAG,SAAS,GAAG,IAAI;IAIzE;;;;OAIG;IACH,WAAW,CAAC,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,cAAc,GAAG,SAAS,GAAG,IAAI;IAI/D;;;;OAIG;IACH,OAAO,CAAC,OAAO,SAAI,GAAG,IAAI;IAI1B;;;;;;OAMG;IACH,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,IAAI;IAQ7D,oEAAoE;IACpE,QAAQ,EACJ;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GACpC;QAAE,IAAI,E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AE,UAAU,CAAC,EACjB,GAAG,IAAI,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GACzC,OAAO;IAUV,0EAA0E;IAC1E,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAIzD;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGjD;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,+DAA+D;IAC/D,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
@@ -1,4 +1,6 @@
1
- import type { ClaimOptions, ClaimedJob, EnqueueJob, JobFailure, JobRelease, QueueDriver } from "./QueueDriver";
1
+ import { type BatchStatus } from "./batch";
2
+ import type { ClaimOptions, ClaimedJob, EnqueueBatch, EnqueueJob, JobFailure, JobRelease, QueueDriver } from "./QueueDriver";
3
+ import type { WorkflowStore } from "./workflow/WorkflowStore";
2
4
  /**
3
5
  * The default driver: a Map in this process's memory.
4
6
  *
@@ -22,12 +24,18 @@ import type { ClaimOptions, ClaimedJob, EnqueueJob, JobFailure, JobRelease, Queu
22
24
  * not be known by anyone, and the manager dead-letters it at once with a line
23
25
  * saying so; filtered out, it would wait here unseen until the process exited.
24
26
  *
27
+ * Batches are kept in a Map beside the jobs, and a finished one for a day.
28
+ * Everything a batch does happens synchronously inside the call that causes
29
+ * it, so the counters and the callbacks need no further care here.
30
+ *
25
31
  * One timer at most, for the next moment something becomes claimable, and it
26
32
  * is unref'd: a queue with nothing due does not hold the process open, and
27
33
  * neither does one waiting out a backoff — the same way the queue never has.
28
34
  */
29
35
  export declare class MemoryQueueDriver implements QueueDriver {
30
36
  private entries;
37
+ private batches;
38
+ private workflows;
31
39
  private listeners;
32
40
  private timer;
33
41
  private timerAt;
@@ -36,12 +44,34 @@ export declare class MemoryQueueDriver implements QueueDriver {
36
44
  get waiting(): number;
37
45
  /** Jobs currently claimed and not yet reported on. */
38
46
  get leased(): number;
39
- enqueue({ name, args, delayMs, id, }: EnqueueJob): Promise<string>;
47
+ enqueue(job: EnqueueJob): Promise<string>;
48
+ private add;
49
+ enqueueBatch(batch: EnqueueBatch): Promise<void>;
50
+ /** `enqueueBatch`, synchronously, for the workflow store too. */
51
+ private recordBatch;
52
+ findBatch(id: string, options?: {
53
+ progress?: boolean;
54
+ }): Promise<BatchStatus | null>;
55
+ cancelBatch(id: string): Promise<boolean>;
56
+ private cancelBatchNow;
57
+ /**
58
+ * Workflows (#846), kept in memory beside the jobs and lost with them. The
59
+ * store's writes, ticks and batches included, happen synchronously here.
60
+ */
61
+ workflowStore(): WorkflowStore;
62
+ reportProgress(job: ClaimedJob, progress: number): Promise<void>;
40
63
  claim(limit: number, options: ClaimOptions): Promise<ClaimedJob[]>;
41
64
  complete(job: ClaimedJob): Promise<void>;
42
65
  fail(job: ClaimedJob, failure: JobFailure): Promise<void>;
43
66
  release(job: ClaimedJob, release: JobRelease): Promise<void>;
44
67
  heartbeat(jobs: ClaimedJob[], options: ClaimOptions): Promise<void>;
68
+ /** Counts a job's end against its batch, if it has one. */
69
+ private count;
70
+ /** Stores the batch's new state and enqueues the callbacks it made due. */
71
+ private save;
72
+ /** Drops the batch's waiting jobs, and says how many there were. */
73
+ private cancelWaiting;
74
+ private forgetFinishedBatches;
45
75
  subscribe(wake: () => void): () => void;
46
76
  /**
47
77
  * The entry for a report, if the report is about the claim that currently
@@ -1 +1 @@
1
- {"version":3,"file":"MemoryQueueDriver.d.ts","sourceRoot":"","sources":["../../../services/queue/MemoryQueueDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YA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AAC,IAAI,CAAC;IAKhE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAkBlE,QAAQ,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBzD,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAW5D,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IASzE,2DAA2D;IAC3D,OAAO,CAAC,KAAK;IAcb,2EAA2E;IAC3E,OAAO,CAAC,IAAI;IAMZ,oEAAoE;IACpE,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,qBAAqB;IAQ7B,SAAS,CAAC,IAAI,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAKvC;;;;OAIG;IACH,OAAO,CAAC,OAAO;IAQf,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,IAAI;IAIZ,2EAA2E;IAC3E,OAAO,CAAC,QAAQ;CAoBjB"}
@@ -41,6 +41,8 @@
41
41
  * every other one.
42
42
  */
43
43
  import type { LockStore } from "../lock/LockStore";
44
+ import type { BatchCallbacks, BatchStatus } from "./batch";
45
+ import type { WorkflowStore } from "./workflow/WorkflowStore";
44
46
  export interface QueueDriver {
45
47
  /**
46
48
  * Records a job and returns its id. The job is claimable once `delayMs` has
@@ -83,13 +85,25 @@ export interface QueueDriver {
83
85
  * ahead of everything enqueued while it waited. The contract suite pins it.
84
86
  */
85
87
  claim(limit: number, options: ClaimOptions): Promise<ClaimedJob[]>;
86
- /** Ends a claim successfully. The job is never claimed again. */
88
+ /**
89
+ * Ends a claim successfully. The job is never claimed again.
90
+ *
91
+ * For a job of a batch (`batchId`), the batch's counters are updated in the
92
+ * same atomic step as the job is ended, and any batch callback that became
93
+ * due is enqueued in it too; see `enqueueBatch`. A stale claim's report
94
+ * changes neither.
95
+ */
87
96
  complete(job: ClaimedJob): Promise<void>;
88
97
  /**
89
98
  * Ends a claim unsuccessfully. With a `retryInMs`, the job becomes claimable
90
99
  * again after that long, keeping its attempt count. With `retryInMs: null`
91
100
  * it is dead-lettered: terminal, never claimed again. What a driver keeps of
92
101
  * a dead-lettered job is its own business; the memory driver keeps nothing.
102
+ *
103
+ * For a job of a batch, a dead-letter is counted as the batch's `complete`
104
+ * counts a success, and a retry resets the job's reported progress to 0. A
105
+ * retry of a job whose batch has been cancelled is a dead-letter instead,
106
+ * counted as `cancelled`, as is a failure with `cancelled: true`.
93
107
  */
94
108
  fail(job: ClaimedJob, failure: JobFailure): Promise<void>;
95
109
  /**
@@ -136,7 +150,68 @@ export interface QueueDriver {
136
150
  * once per manager.
137
151
  */
138
152
  lockStore?(): LockStore;
153
+ /**
154
+ * Records a batch and all of its jobs in one atomic step: either every job
155
+ * and the batch are recorded, or none is. Optional; a driver without it
156
+ * cannot run `Job.dispatchBatch`.
157
+ *
158
+ * The driver then keeps the batch's counters (see `batch.ts`): every
159
+ * `complete` or dead-lettering `fail` of one of its jobs counts it, in the
160
+ * same atomic step that ends the job, and the step that counts the last one
161
+ * finishes the batch and enqueues its due callbacks. A callback's arguments
162
+ * are its own followed by the batch's status, and it is enqueued in that
163
+ * same step, so it is enqueued exactly once, by whichever process ended the
164
+ * job that made it due.
165
+ *
166
+ * Like `enqueue`, it writes on the caller's ORM transaction when
167
+ * `joinsTransaction` says so. A batch of no jobs is finished at once.
168
+ */
169
+ enqueueBatch?(batch: EnqueueBatch): Promise<void>;
170
+ /**
171
+ * The batch's status, or `null` for an id the driver has no batch under.
172
+ * `progress: false` skips summing what the running jobs reported, for a
173
+ * caller that only wants the counters and `cancelledAt`; `progress` is then
174
+ * the ended jobs over `total`.
175
+ */
176
+ findBatch?(id: string, options?: {
177
+ progress?: boolean;
178
+ }): Promise<BatchStatus | null>;
179
+ /**
180
+ * Cancels a batch that is still running, and resolves to whether it did:
181
+ * `false` for a batch that is unknown, finished or already cancelled. Its
182
+ * waiting jobs are ended as `cancelled` and never claimed; running ones
183
+ * finish, or notice through `this.batch.cancelled()`. `catch` becomes due
184
+ * unless a failure already made it due, and `finally` once nothing is
185
+ * pending. `then` never runs for a cancelled batch.
186
+ */
187
+ cancelBatch?(id: string): Promise<boolean>;
188
+ /**
189
+ * Records how far a claimed job of a batch is, from 0 to 1, for the batch's
190
+ * `progress`. A stale claim's report is ignored.
191
+ */
192
+ reportProgress?(job: ClaimedJob, progress: number): Promise<void>;
193
+ /**
194
+ * Where `Workflow` keeps its workflows and steps (#846), over the same
195
+ * storage, so that a workflow's writes and the jobs and batches they
196
+ * schedule are recorded in one atomic step. Optional; a driver without it
197
+ * cannot run workflows. Called once per manager. A driver that has it also
198
+ * needs the batch methods for `step.batch`.
199
+ */
200
+ workflowStore?(): WorkflowStore;
139
201
  }
202
+ export type EnqueueBatch = {
203
+ /** The id to record the batch under. Chosen by the manager. */
204
+ id: string;
205
+ /** The `name` option, for finding it in storage. */
206
+ name: string | null;
207
+ /** The registered name every job of the batch runs as. */
208
+ job: string;
209
+ /** One JSON array of `run` arguments per job. */
210
+ args: string[];
211
+ /** Whether a failed job leaves the rest running; see `batch.ts`. */
212
+ allowFailures: boolean;
213
+ callbacks: BatchCallbacks;
214
+ };
140
215
  export type EnqueueJob = {
141
216
  /** The job's registered name — its class's `static name`. */
142
217
  name: string;
@@ -194,6 +269,8 @@ export type ClaimedJob = {
194
269
  attempt: number;
195
270
  /** When `enqueue` recorded it, in epoch milliseconds. */
196
271
  createdAt: number;
272
+ /** The batch the job belongs to. Absent for a job dispatched on its own. */
273
+ batchId?: string;
197
274
  };
198
275
  export type JobRelease = {
199
276
  /** Milliseconds until the job is claimable again. */
@@ -204,5 +281,10 @@ export type JobFailure = {
204
281
  error: string;
205
282
  /** Milliseconds until the retry is claimable, or `null` to dead-letter. */
206
283
  retryInMs: number | null;
284
+ /**
285
+ * The job is dead-lettered because its batch was cancelled, not because it
286
+ * failed: the batch counts it as `cancelled`. Only with `retryInMs: null`.
287
+ */
288
+ cancelled?: boolean;
207
289
  };
208
290
  //# sourceMappingURL=QueueDriver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"QueueDriver.d.ts","sourceRoot":"","sources":["../../../services/queue/QueueDriver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1C;;;;;;;;;;;;;;;;;;OAkBG;IACH,gBAAgB,CAAC,IAAI,OAAO,CAAC;IAE7B;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAEnE,iEAAiE;IACjE,QAAQ,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;;;;OAKG;IACH,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1D;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7D;;;OAGG;IACH,SAAS,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErE;;;;;;;OAOG;IACH,SAAS,CAAC,CAA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,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC"}
@@ -2,7 +2,12 @@ import type { Application } from "../../foundation/Application";
2
2
  import { LockManager } from "../lock/LockManager";
3
3
  import { Job } from "./Job";
4
4
  import { type QueueConfig } from "./config";
5
- import type { ClaimedJob, QueueDriver } from "./QueueDriver";
5
+ import type { ClaimedJob, EnqueueBatch, QueueDriver } from "./QueueDriver";
6
+ import type { BatchStatus, JobCall } from "./batch";
7
+ import { backoffFor } from "./backoff";
8
+ import type { WorkflowClass } from "./workflow/Workflow";
9
+ import { WorkflowRuntime } from "./workflow/WorkflowRuntime";
10
+ export { backoffFor };
6
11
  declare global {
7
12
  /**
8
13
  * The queue loop a `gemi dev` server is running over a driver that outlives
@@ -19,6 +24,32 @@ declare global {
19
24
  stop(): Promise<unknown>;
20
25
  } | undefined;
21
26
  }
27
+ /** What `Job.dispatchBatch` resolves to. */
28
+ export type DispatchedBatch = {
29
+ /** The batch's id, for `Job.findBatch` and `Job.cancelBatch`. */
30
+ id: string;
31
+ /** How many jobs it was dispatched with. */
32
+ total: number;
33
+ };
34
+ /** The options of `Job.dispatchBatch`. */
35
+ export type JobBatchOptions = {
36
+ /** A label kept with the batch, for finding it in storage and in its status. */
37
+ name?: string;
38
+ /**
39
+ * Whether a dead-lettered job leaves the rest running. Default `false`: the
40
+ * first one cancels the batch.
41
+ */
42
+ allowFailures?: boolean;
43
+ /**
44
+ * Enqueued once every job has ended, when the batch was not cancelled and
45
+ * no job failed (or `allowFailures` is set). Build it with `Job.with(...)`.
46
+ */
47
+ then?: JobCall;
48
+ /** Enqueued at the first failed job, or at `cancelBatch`, whichever is first. */
49
+ catch?: JobCall;
50
+ /** Enqueued once every job has ended, whatever happened. */
51
+ finally?: JobCall;
52
+ };
22
53
  /** What `drain` could not wait out. */
23
54
  export type DrainResult = {
24
55
  /**
@@ -59,6 +90,7 @@ export declare class QueueManager {
59
90
  /** Unknown names already reported as left for another replica; see `run`. */
60
91
  private readonly releasedNames;
61
92
  private lockManager;
93
+ private workflowRuntime;
62
94
  /**
63
95
  * `application` is entered around every job, so `app()` inside one resolves
64
96
  * to it rather than to whichever application happens to be the static
@@ -88,6 +120,24 @@ export declare class QueueManager {
88
120
  * unaffected, because that list is already in place by the end of `register()`.
89
121
  */
90
122
  useJobs(jobs: Array<new () => Job>): void;
123
+ /**
124
+ * Replaces the registered workflows, for the provider to hand over what it
125
+ * found under `app/workflows`. With at least one, the internal job their
126
+ * passes run in is registered too. See `Workflow`.
127
+ */
128
+ useWorkflows(workflows: WorkflowClass[]): void;
129
+ /** The registered workflow classes, as handed over. */
130
+ get registeredWorkflows(): ReadonlyArray<WorkflowClass>;
131
+ /**
132
+ * Workflows (#846) over this queue's driver: what `Workflow.start`,
133
+ * `signal`, `find` and `cancel` call.
134
+ */
135
+ get workflows(): WorkflowRuntime;
136
+ /**
137
+ * The tick job, beside the app's own, once there is a workflow to tick.
138
+ * Not in `registeredJobs`, which reports what the app handed over.
139
+ */
140
+ private registerTickJob;
91
141
  /**
92
142
  * Registers one more job beside whatever `useJobs` already took.
93
143
  *
@@ -163,6 +213,31 @@ export declare class QueueManager {
163
213
  */
164
214
  reportFailure?: boolean;
165
215
  }): Promise<string>;
216
+ /**
217
+ * Queues a batch: every job, the batch and its callbacks in one atomic
218
+ * write. See `Job.dispatchBatch`.
219
+ *
220
+ * Inside an ORM transaction the batch belongs to it, exactly as a single
221
+ * dispatch does in `push`: written on it by a driver that joins, otherwise
222
+ * held and recorded at the commit, resolving at once to the id it will have.
223
+ */
224
+ pushBatch(job: new () => Job, args: string[], options?: JobBatchOptions): Promise<DispatchedBatch>;
225
+ /**
226
+ * @internal The batch `pushBatch` records, checked: for `pushBatch` and for
227
+ * a workflow's `step.batch`, which records it in a write of its own. Throws
228
+ * on the caller's stack for a driver without batches, a worker job, a
229
+ * unique job and a callback that is not a job call.
230
+ */
231
+ buildBatch(job: new () => Job, args: string[], options?: JobBatchOptions): EnqueueBatch;
232
+ /** `pushBatch`, once it is known that the batch is recorded now; see `record`. */
233
+ private recordBatch;
234
+ /** The batch's status, or `null` for an unknown id. See `Job.findBatch`. */
235
+ findBatch(id: string): Promise<BatchStatus | null>;
236
+ /**
237
+ * Cancels a running batch, and resolves to whether it did. See
238
+ * `Job.cancelBatch`.
239
+ */
240
+ cancelBatch(id: string): Promise<boolean>;
166
241
  /**
167
242
  * The locks unique jobs, cron jobs' `withoutOverlapping` and `onOneServer`,
168
243
  * and the `Lock` facade use, over the store the `locks` setting names. Built
@@ -224,7 +299,8 @@ export declare class QueueManager {
224
299
  * For a job the driver has just made claimable: start the loop, or wake a
225
300
  * running one that only polls, as `push` does for a dispatch.
226
301
  */
227
- private claimSoon;
302
+ /** @internal */
303
+ claimSoon(): void;
228
304
  /**
229
305
  * Starts claiming. Idempotent, and called by the first `push`, so an app
230
306
  * does not need to; it is public for a process that should run jobs it
@@ -309,6 +385,8 @@ export declare class QueueManager {
309
385
  * escape the queue with the job's slot still counted as taken.
310
386
  */
311
387
  private run;
388
+ /** What `this.batch` and `this.progress()` reach in a job of a batch. */
389
+ private batchHandle;
312
390
  /**
313
391
  * Takes a slot under the job's `concurrency` key and a hit under each of
314
392
  * its `throttle` keys, all in the queue's lock store, so the limits hold
@@ -346,9 +424,4 @@ export declare function claimingTurnedOff(env?: Record<string, string | undefine
346
424
  /** Marks this process as a `gemi queue:work` worker; see `claimsInThisProcess`. */
347
425
  export declare function markQueueWorker(worker?: boolean): void;
348
426
  export declare function isQueueWorker(): boolean;
349
- /**
350
- * The delay before the retry that follows attempt `attempt`: the number
351
- * itself, or the array's entry for that retry with its last entry repeated.
352
- */
353
- export declare function backoffFor(backoff: number | number[], attempt: number): number;
354
427
  //# sourceMappingURL=QueueManager.d.ts.map