gemi 0.115.0 → 0.117.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.
- package/dist/ai/index.js +2 -2
- package/dist/ai/index.js.map +1 -1
- package/dist/app/index.js +2 -2
- package/dist/app/index.js.map +1 -1
- package/dist/auth/AuthServiceProvider.d.ts.map +1 -1
- package/dist/auth/config.d.ts +27 -0
- package/dist/auth/config.d.ts.map +1 -1
- package/dist/auth/connections/ConnectionManager.d.ts +133 -0
- package/dist/auth/connections/ConnectionManager.d.ts.map +1 -0
- package/dist/auth/connections/ConnectionStore.d.ts +146 -0
- package/dist/auth/connections/ConnectionStore.d.ts.map +1 -0
- package/dist/auth/connections/ConnectionsController.d.ts +23 -0
- package/dist/auth/connections/ConnectionsController.d.ts.map +1 -0
- package/dist/auth/connections/OAuthConnectionProvider.d.ts +105 -0
- package/dist/auth/connections/OAuthConnectionProvider.d.ts.map +1 -0
- package/dist/auth/connections/errors.d.ts +32 -0
- package/dist/auth/connections/errors.d.ts.map +1 -0
- package/dist/auth/oauth/oauthState.d.ts +15 -2
- package/dist/auth/oauth/oauthState.d.ts.map +1 -1
- package/dist/auth/routes.d.ts +13 -0
- package/dist/auth/routes.d.ts.map +1 -1
- package/dist/bin/orm/emit.d.ts.map +1 -1
- package/dist/bin/orm-generator.js +51 -4
- package/dist/bin/orm-generator.js.map +4 -4
- package/dist/bun/plugin.js +2 -2
- package/dist/bun/plugin.js.map +1 -1
- package/dist/bun/preload.js +2 -2
- package/dist/bun/preload.js.map +1 -1
- package/dist/chunk-00n3gwr8.js +71 -0
- package/dist/chunk-00n3gwr8.js.map +13 -0
- package/dist/{chunk-t4yh4nf9.js → chunk-076jezzg.js} +3 -3
- package/dist/{chunk-t4yh4nf9.js.map → chunk-076jezzg.js.map} +1 -1
- package/dist/{chunk-qjhw8nje.js → chunk-077rea02.js} +1 -1
- package/dist/{chunk-0av6xvm6.js → chunk-1ckha5dt.js} +3 -3
- package/dist/{chunk-0av6xvm6.js.map → chunk-1ckha5dt.js.map} +1 -1
- package/dist/{chunk-mschc94q.js → chunk-1zzd39qg.js} +2 -2
- package/dist/{chunk-mschc94q.js.map → chunk-1zzd39qg.js.map} +1 -1
- package/dist/{chunk-5stgtwqw.js → chunk-2bja99cq.js} +2 -2
- package/dist/{chunk-5stgtwqw.js.map → chunk-2bja99cq.js.map} +1 -1
- package/dist/chunk-2czfefn2.js +10 -0
- package/dist/{chunk-t4t3hqe0.js.map → chunk-2czfefn2.js.map} +5 -4
- package/dist/{chunk-aazmrxj9.js → chunk-37pk2cjg.js} +2 -2
- package/dist/{chunk-aazmrxj9.js.map → chunk-37pk2cjg.js.map} +1 -1
- package/dist/{chunk-qsrcdzan.js → chunk-3w4hk6q2.js} +3 -3
- package/dist/{chunk-qsrcdzan.js.map → chunk-3w4hk6q2.js.map} +1 -1
- package/dist/chunk-51w202vr.js +5 -0
- package/dist/{chunk-whtzggn6.js.map → chunk-51w202vr.js.map} +3 -4
- package/dist/{chunk-0z8ejxre.js → chunk-5m8vvtvn.js} +3 -3
- package/dist/{chunk-0z8ejxre.js.map → chunk-5m8vvtvn.js.map} +1 -1
- package/dist/{chunk-jafm3613.js → chunk-5p4z1fgc.js} +2 -2
- package/dist/{chunk-jafm3613.js.map → chunk-5p4z1fgc.js.map} +1 -1
- package/dist/{chunk-kejwjerj.js → chunk-5w6kyxsj.js} +2 -2
- package/dist/{chunk-kejwjerj.js.map → chunk-5w6kyxsj.js.map} +1 -1
- package/dist/{chunk-pyk3gzvc.js → chunk-62jw0vsf.js} +2 -2
- package/dist/{chunk-pyk3gzvc.js.map → chunk-62jw0vsf.js.map} +1 -1
- package/dist/chunk-63ewmmhc.js +5 -0
- package/dist/{chunk-t24p7gc6.js.map → chunk-63ewmmhc.js.map} +1 -1
- package/dist/{chunk-p1aqq0ga.js → chunk-6ggmk2eg.js} +3 -3
- package/dist/{chunk-p1aqq0ga.js.map → chunk-6ggmk2eg.js.map} +1 -1
- package/dist/{chunk-2tzm58j3.js → chunk-6y4nk9f1.js} +2 -2
- package/dist/{chunk-2tzm58j3.js.map → chunk-6y4nk9f1.js.map} +1 -1
- package/dist/{chunk-1hr4xht1.js → chunk-8gtc3s1y.js} +2 -2
- package/dist/{chunk-1hr4xht1.js.map → chunk-8gtc3s1y.js.map} +1 -1
- package/dist/{chunk-frerzsxq.js → chunk-a22h5cby.js} +2 -2
- package/dist/{chunk-frerzsxq.js.map → chunk-a22h5cby.js.map} +1 -1
- package/dist/{chunk-zyt2w03d.js → chunk-a32wfzdq.js} +2 -2
- package/dist/{chunk-zyt2w03d.js.map → chunk-a32wfzdq.js.map} +1 -1
- package/dist/{chunk-t04f3akb.js → chunk-a77586gv.js} +2 -2
- package/dist/{chunk-t04f3akb.js.map → chunk-a77586gv.js.map} +1 -1
- package/dist/chunk-a7r39713.js +5 -0
- package/dist/chunk-a7r39713.js.map +10 -0
- package/dist/{chunk-vxm6yevm.js → chunk-arwmvgrz.js} +2 -2
- package/dist/{chunk-vxm6yevm.js.map → chunk-arwmvgrz.js.map} +1 -1
- package/dist/{chunk-41da9628.js → chunk-bvqae0px.js} +1 -1
- package/dist/{chunk-d9mar37g.js → chunk-c2n6zdyd.js} +2 -2
- package/dist/{chunk-d9mar37g.js.map → chunk-c2n6zdyd.js.map} +1 -1
- package/dist/{chunk-56jky6vf.js → chunk-cytss9mb.js} +2 -2
- package/dist/{chunk-56jky6vf.js.map → chunk-cytss9mb.js.map} +1 -1
- package/dist/{chunk-vw8849ys.js → chunk-dcgvq79a.js} +2 -2
- package/dist/{chunk-m54s6jpr.js.map → chunk-dcgvq79a.js.map} +1 -1
- package/dist/{chunk-6chz1ktz.js → chunk-de4t48j9.js} +3 -3
- package/dist/{chunk-6chz1ktz.js.map → chunk-de4t48j9.js.map} +1 -1
- package/dist/{chunk-cbqazg9k.js → chunk-dz99g58c.js} +2 -2
- package/dist/{chunk-cbqazg9k.js.map → chunk-dz99g58c.js.map} +1 -1
- package/dist/{chunk-e573yxpq.js → chunk-e7ezmag9.js} +3 -3
- package/dist/{chunk-e573yxpq.js.map → chunk-e7ezmag9.js.map} +1 -1
- package/dist/{chunk-yer1r3t3.js → chunk-epvpmakp.js} +2 -2
- package/dist/{chunk-yer1r3t3.js.map → chunk-epvpmakp.js.map} +1 -1
- package/dist/{chunk-yhrye9cm.js → chunk-f8vcwzgd.js} +2 -2
- package/dist/{chunk-yhrye9cm.js.map → chunk-f8vcwzgd.js.map} +1 -1
- package/dist/chunk-fa37qzm3.js +5 -0
- package/dist/chunk-fa37qzm3.js.map +12 -0
- package/dist/{chunk-fxgxf16k.js → chunk-ffgmqwzy.js} +2 -2
- package/dist/{chunk-fxgxf16k.js.map → chunk-ffgmqwzy.js.map} +1 -1
- package/dist/{chunk-er3wf6ng.js → chunk-fk6nxhxn.js} +2 -2
- package/dist/{chunk-er3wf6ng.js.map → chunk-fk6nxhxn.js.map} +1 -1
- package/dist/{chunk-3hrj5rwm.js → chunk-fnwbbmnk.js} +2 -2
- package/dist/{chunk-3hrj5rwm.js.map → chunk-fnwbbmnk.js.map} +1 -1
- package/dist/chunk-g2wncay4.js +9 -0
- package/dist/{chunk-hytt9qyj.js.map → chunk-g2wncay4.js.map} +3 -4
- package/dist/{chunk-gts5p6mw.js → chunk-ge9xjwgq.js} +4 -4
- package/dist/{chunk-gts5p6mw.js.map → chunk-ge9xjwgq.js.map} +1 -1
- package/dist/{chunk-tw5kwbx4.js → chunk-gjy2qjcr.js} +2 -2
- package/dist/{chunk-tw5kwbx4.js.map → chunk-gjy2qjcr.js.map} +1 -1
- package/dist/{chunk-15c2vgaf.js → chunk-gn7kne7r.js} +2 -2
- package/dist/{chunk-15c2vgaf.js.map → chunk-gn7kne7r.js.map} +1 -1
- package/dist/{chunk-9n1hx3mq.js → chunk-hr61ekcr.js} +3 -3
- package/dist/{chunk-9n1hx3mq.js.map → chunk-hr61ekcr.js.map} +1 -1
- package/dist/{chunk-m54s6jpr.js → chunk-hvgmqt6z.js} +2 -2
- package/dist/{chunk-vw8849ys.js.map → chunk-hvgmqt6z.js.map} +1 -1
- package/dist/{chunk-aeh67ynz.js → chunk-hvpn18bb.js} +3 -3
- package/dist/{chunk-aeh67ynz.js.map → chunk-hvpn18bb.js.map} +1 -1
- package/dist/{chunk-jdhdrr2k.js → chunk-j1453bn1.js} +2 -2
- package/dist/{chunk-jdhdrr2k.js.map → chunk-j1453bn1.js.map} +1 -1
- package/dist/{chunk-tn2bryy2.js → chunk-jpetnpzn.js} +2 -2
- package/dist/{chunk-tn2bryy2.js.map → chunk-jpetnpzn.js.map} +1 -1
- package/dist/{chunk-mtbygktb.js → chunk-jqrs16g2.js} +3 -3
- package/dist/{chunk-mtbygktb.js.map → chunk-jqrs16g2.js.map} +1 -1
- package/dist/{chunk-4mfrgd5m.js → chunk-kk77x2v4.js} +2 -2
- package/dist/{chunk-4mfrgd5m.js.map → chunk-kk77x2v4.js.map} +1 -1
- package/dist/chunk-kpn7f58a.js +14 -0
- package/dist/{chunk-dexdkh3z.js.map → chunk-kpn7f58a.js.map} +11 -6
- package/dist/chunk-mhteg4yz.js +57 -0
- package/dist/{chunk-d6591xck.js.map → chunk-mhteg4yz.js.map} +16 -12
- package/dist/{chunk-n672d4g8.js → chunk-n9jyjp4a.js} +2 -2
- package/dist/{chunk-n672d4g8.js.map → chunk-n9jyjp4a.js.map} +1 -1
- package/dist/{chunk-vbdty91k.js → chunk-nb2gggba.js} +3 -3
- package/dist/{chunk-vbdty91k.js.map → chunk-nb2gggba.js.map} +1 -1
- package/dist/chunk-ntxsdchf.js +50 -0
- package/dist/chunk-ntxsdchf.js.map +10 -0
- package/dist/{chunk-2z1981d0.js → chunk-pepzecrm.js} +2 -2
- package/dist/{chunk-2z1981d0.js.map → chunk-pepzecrm.js.map} +1 -1
- package/dist/{chunk-785b41h1.js → chunk-pgy3mfxw.js} +3 -3
- package/dist/{chunk-785b41h1.js.map → chunk-pgy3mfxw.js.map} +1 -1
- package/dist/{chunk-98m15b9x.js → chunk-qhw0hej0.js} +2 -2
- package/dist/{chunk-98m15b9x.js.map → chunk-qhw0hej0.js.map} +1 -1
- package/dist/{chunk-303mprnv.js → chunk-r3v2cnrj.js} +2 -2
- package/dist/{chunk-303mprnv.js.map → chunk-r3v2cnrj.js.map} +1 -1
- package/dist/{chunk-ktr3k768.js → chunk-rhmpphhc.js} +3 -3
- package/dist/{chunk-ktr3k768.js.map → chunk-rhmpphhc.js.map} +1 -1
- package/dist/{chunk-fre6f4nk.js → chunk-s4f56035.js} +2 -2
- package/dist/{chunk-fre6f4nk.js.map → chunk-s4f56035.js.map} +1 -1
- package/dist/{chunk-sr942vb1.js → chunk-sj4f7x4p.js} +2 -2
- package/dist/{chunk-sr942vb1.js.map → chunk-sj4f7x4p.js.map} +1 -1
- package/dist/{chunk-wyw6p3fg.js → chunk-sksmnjkn.js} +3 -3
- package/dist/{chunk-wyw6p3fg.js.map → chunk-sksmnjkn.js.map} +1 -1
- package/dist/{chunk-kqxdsv22.js → chunk-stnd9qht.js} +2 -2
- package/dist/{chunk-kqxdsv22.js.map → chunk-stnd9qht.js.map} +1 -1
- package/dist/{chunk-1myhm0g3.js → chunk-t65074mw.js} +3 -3
- package/dist/{chunk-1myhm0g3.js.map → chunk-t65074mw.js.map} +1 -1
- package/dist/chunk-t87w4h84.js +24 -0
- package/dist/{chunk-wzrt5mac.js.map → chunk-t87w4h84.js.map} +2 -2
- package/dist/{chunk-z10cas5r.js → chunk-thz75w6e.js} +2 -2
- package/dist/{chunk-z10cas5r.js.map → chunk-thz75w6e.js.map} +1 -1
- package/dist/{chunk-xt9tv99x.js → chunk-v8vnxkvp.js} +2 -2
- package/dist/{chunk-xt9tv99x.js.map → chunk-v8vnxkvp.js.map} +1 -1
- package/dist/{chunk-x7cpth2f.js → chunk-veq07rp8.js} +1 -1
- package/dist/{chunk-agyfv3f8.js → chunk-vj5necm0.js} +1 -1
- package/dist/{chunk-mps6ynbh.js → chunk-vtc23xpk.js} +2 -2
- package/dist/{chunk-mps6ynbh.js.map → chunk-vtc23xpk.js.map} +1 -1
- package/dist/{chunk-jmpw6bqz.js → chunk-w4e480he.js} +2 -2
- package/dist/{chunk-jmpw6bqz.js.map → chunk-w4e480he.js.map} +1 -1
- package/dist/{chunk-8rv62v14.js → chunk-wgb79ysr.js} +2 -2
- package/dist/{chunk-8rv62v14.js.map → chunk-wgb79ysr.js.map} +1 -1
- package/dist/{chunk-1vzks22y.js → chunk-wk1tp1f1.js} +2 -2
- package/dist/{chunk-1vzks22y.js.map → chunk-wk1tp1f1.js.map} +1 -1
- package/dist/{chunk-bra1a1fq.js → chunk-wwdbgshx.js} +2 -2
- package/dist/{chunk-bra1a1fq.js.map → chunk-wwdbgshx.js.map} +1 -1
- package/dist/{chunk-eqse2m6n.js → chunk-wzzrz612.js} +2 -2
- package/dist/{chunk-eqse2m6n.js.map → chunk-wzzrz612.js.map} +1 -1
- package/dist/{chunk-hdps9n52.js → chunk-x7qwx07b.js} +3 -3
- package/dist/{chunk-hdps9n52.js.map → chunk-x7qwx07b.js.map} +1 -1
- package/dist/chunk-x84as3vy.js +5 -0
- package/dist/chunk-x84as3vy.js.map +12 -0
- package/dist/chunk-y0en07zh.js +302 -0
- package/dist/chunk-y0en07zh.js.map +17 -0
- package/dist/{chunk-d2gfcf85.js → chunk-yfwrbfnw.js} +2 -2
- package/dist/{chunk-d2gfcf85.js.map → chunk-yfwrbfnw.js.map} +1 -1
- package/dist/{chunk-mazznq15.js → chunk-yhp6bvhj.js} +3 -3
- package/dist/{chunk-mazznq15.js.map → chunk-yhp6bvhj.js.map} +1 -1
- package/dist/{chunk-tzm3c7n6.js → chunk-yvtmygrk.js} +4 -4
- package/dist/{chunk-tzm3c7n6.js.map → chunk-yvtmygrk.js.map} +1 -1
- package/dist/{chunk-mqfzdfnz.js → chunk-zkjs3m5m.js} +2 -2
- package/dist/{chunk-mqfzdfnz.js.map → chunk-zkjs3m5m.js.map} +1 -1
- package/dist/chunk-zw6843j3.js +5 -0
- package/dist/chunk-zw6843j3.js.map +12 -0
- package/dist/chunks/{ThemeProvider-BgLyzzOL.js → ThemeProvider-BLI4zpLu.js} +8 -3
- package/dist/chunks/ThemeProvider-BLI4zpLu.js.map +1 -0
- package/dist/client/ClientRouter.d.ts +3 -5
- package/dist/client/ClientRouter.d.ts.map +1 -1
- package/dist/client/ClientRouterContext.d.ts.map +1 -1
- package/dist/client/Head.d.ts +1 -1
- package/dist/client/Head.d.ts.map +1 -1
- package/dist/client/ServerDataProvider.d.ts +2 -0
- package/dist/client/ServerDataProvider.d.ts.map +1 -1
- package/dist/client/createRoot.d.ts +2 -4
- package/dist/client/createRoot.d.ts.map +1 -1
- package/dist/client/fonts.d.ts +69 -0
- package/dist/client/fonts.d.ts.map +1 -0
- package/dist/client/htmlAttributes.d.ts +18 -0
- package/dist/client/htmlAttributes.d.ts.map +1 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +153 -6
- package/dist/client/index.js.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/console/builtins.d.ts +13 -0
- package/dist/console/builtins.d.ts.map +1 -0
- package/dist/console/run.js +13 -11
- package/dist/console/run.js.map +6 -5
- package/dist/console/runner.d.ts.map +1 -1
- package/dist/console/usage.d.ts +2 -0
- package/dist/console/usage.d.ts.map +1 -1
- package/dist/container/index.js +2 -2
- package/dist/container/index.js.map +1 -1
- package/dist/database/index.js +2 -2
- package/dist/database/index.js.map +1 -1
- package/dist/email/index.js +2 -2
- package/dist/email/index.js.map +1 -1
- package/dist/facades/Connections.d.ts +36 -0
- package/dist/facades/Connections.d.ts.map +1 -0
- package/dist/facades/Crypt.d.ts +26 -0
- package/dist/facades/Crypt.d.ts.map +1 -0
- package/dist/facades/Meta.d.ts +17 -1
- package/dist/facades/Meta.d.ts.map +1 -1
- package/dist/facades/Storage.d.ts +29 -0
- package/dist/facades/Storage.d.ts.map +1 -1
- package/dist/facades/index.d.ts +2 -0
- package/dist/facades/index.d.ts.map +1 -1
- package/dist/facades/index.js +2 -2
- package/dist/facades/index.js.map +1 -1
- package/dist/foundation/index.js +2 -2
- package/dist/foundation/index.js.map +1 -1
- package/dist/http/HttpRequest.d.ts +4 -0
- package/dist/http/HttpRequest.d.ts.map +1 -1
- package/dist/http/Metadata.d.ts +28 -0
- package/dist/http/Metadata.d.ts.map +1 -1
- package/dist/http/index.d.ts +3 -1
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/http/requestContext.d.ts +4 -0
- package/dist/http/requestContext.d.ts.map +1 -1
- package/dist/http/safeFetch/errors.d.ts +10 -0
- package/dist/http/safeFetch/errors.d.ts.map +1 -1
- package/dist/http/safeFetch/index.d.ts +1 -1
- package/dist/http/safeFetch/index.d.ts.map +1 -1
- package/dist/http/sitemap/Robots.d.ts +95 -0
- package/dist/http/sitemap/Robots.d.ts.map +1 -0
- package/dist/http/sitemap/Sitemap.d.ts +145 -0
- package/dist/http/sitemap/Sitemap.d.ts.map +1 -0
- package/dist/http/sitemap/fetchText.d.ts +16 -0
- package/dist/http/sitemap/fetchText.d.ts.map +1 -0
- package/dist/http/sitemap/index.d.ts +3 -0
- package/dist/http/sitemap/index.d.ts.map +1 -0
- package/dist/http/sitemap/xml.d.ts +21 -0
- package/dist/http/sitemap/xml.d.ts.map +1 -0
- package/dist/i18n/Translator.d.ts.map +1 -1
- package/dist/i18n/dictionaryRuntime.js +2 -2
- package/dist/i18n/dictionaryRuntime.js.map +1 -1
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +2 -2
- package/dist/i18n/resolveLocale.d.ts +18 -0
- package/dist/i18n/resolveLocale.d.ts.map +1 -1
- package/dist/kernel/index.js +3 -3
- package/dist/kernel/index.js.map +3 -3
- package/dist/kernel/providers.d.ts +2 -2
- package/dist/kernel/providers.d.ts.map +1 -1
- package/dist/orm/Model.d.ts.map +1 -1
- package/dist/orm/encryption-rotate.d.ts +44 -0
- package/dist/orm/encryption-rotate.d.ts.map +1 -0
- package/dist/orm/encryption.d.ts +54 -0
- package/dist/orm/encryption.d.ts.map +1 -0
- package/dist/orm/index.d.ts +2 -0
- package/dist/orm/index.d.ts.map +1 -1
- package/dist/orm/index.js +3 -3
- package/dist/orm/index.js.map +4 -4
- package/dist/orm/schema.d.ts +25 -1
- package/dist/orm/schema.d.ts.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/encryption/Encrypter.d.ts +86 -0
- package/dist/services/encryption/Encrypter.d.ts.map +1 -0
- package/dist/services/encryption/EncryptionServiceProvider.d.ts +13 -0
- package/dist/services/encryption/EncryptionServiceProvider.d.ts.map +1 -0
- package/dist/services/encryption/config.d.ts +36 -0
- package/dist/services/encryption/config.d.ts.map +1 -0
- package/dist/services/file-storage/drivers/FileStorageDriver.d.ts +12 -1
- package/dist/services/file-storage/drivers/FileStorageDriver.d.ts.map +1 -1
- package/dist/services/file-storage/drivers/FileSystemDriver.d.ts +8 -1
- package/dist/services/file-storage/drivers/FileSystemDriver.d.ts.map +1 -1
- package/dist/services/file-storage/drivers/types.d.ts +17 -0
- package/dist/services/file-storage/drivers/types.d.ts.map +1 -1
- package/dist/services/file-storage/putFromUrl.d.ts +56 -0
- package/dist/services/file-storage/putFromUrl.d.ts.map +1 -0
- package/dist/services/file-storage/sniffContentType.d.ts +33 -0
- package/dist/services/file-storage/sniffContentType.d.ts.map +1 -0
- package/dist/services/index.d.ts +19 -5
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +10 -10
- package/dist/services/index.js.map +4 -3
- package/dist/services/queue/DatabaseQueueDriver.d.ts +96 -7
- package/dist/services/queue/DatabaseQueueDriver.d.ts.map +1 -1
- package/dist/services/queue/Job.d.ts +72 -0
- package/dist/services/queue/Job.d.ts.map +1 -1
- package/dist/services/queue/MemoryQueueDriver.d.ts +22 -2
- package/dist/services/queue/MemoryQueueDriver.d.ts.map +1 -1
- package/dist/services/queue/QueueDriver.d.ts +74 -1
- package/dist/services/queue/QueueDriver.d.ts.map +1 -1
- package/dist/services/queue/QueueManager.d.ts +47 -0
- package/dist/services/queue/QueueManager.d.ts.map +1 -1
- package/dist/services/queue/batch.d.ts +112 -0
- package/dist/services/queue/batch.d.ts.map +1 -0
- package/dist/services/queue/queueDriverContract.d.ts +5 -0
- package/dist/services/queue/queueDriverContract.d.ts.map +1 -1
- package/dist/services/queue/work.js +2 -2
- package/dist/services/queue/work.js.map +1 -1
- package/dist/services/router/ViewRouteDispatcher.d.ts +3 -1
- package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
- package/dist/services/router/config.d.ts +19 -0
- package/dist/services/router/config.d.ts.map +1 -1
- package/dist/stats/route-table.js +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/vitest/index.js +2 -2
- package/dist/vitest/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-7g9yh5ae.js +0 -5
- package/dist/chunk-7g9yh5ae.js.map +0 -12
- package/dist/chunk-7vb4eey2.js +0 -217
- package/dist/chunk-7vb4eey2.js.map +0 -16
- package/dist/chunk-9b4erdy2.js +0 -5
- package/dist/chunk-9b4erdy2.js.map +0 -11
- package/dist/chunk-d6591xck.js +0 -46
- package/dist/chunk-dexdkh3z.js +0 -14
- package/dist/chunk-hytt9qyj.js +0 -54
- package/dist/chunk-t24p7gc6.js +0 -5
- package/dist/chunk-t4t3hqe0.js +0 -10
- package/dist/chunk-whtzggn6.js +0 -5
- package/dist/chunk-wzrt5mac.js +0 -24
- package/dist/chunks/ThemeProvider-BgLyzzOL.js.map +0 -1
- /package/dist/{chunk-qjhw8nje.js.map → chunk-077rea02.js.map} +0 -0
- /package/dist/{chunk-41da9628.js.map → chunk-bvqae0px.js.map} +0 -0
- /package/dist/{chunk-x7cpth2f.js.map → chunk-veq07rp8.js.map} +0 -0
- /package/dist/{chunk-agyfv3f8.js.map → chunk-vj5necm0.js.map} +0 -0
|
@@ -1,13 +1,21 @@
|
|
|
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
|
|
4
|
+
import { type BatchStatus } from "./batch";
|
|
5
|
+
import type { ClaimOptions, ClaimedJob, EnqueueBatch, EnqueueJob, JobFailure, JobRelease, QueueDriver } from "./QueueDriver";
|
|
5
6
|
export type DatabaseQueueDriverOptions = {
|
|
6
7
|
/**
|
|
7
8
|
* The jobs table. Default `gemi_jobs`. A plain identifier — letters, digits
|
|
8
9
|
* and underscores — because it is spliced into every statement.
|
|
9
10
|
*/
|
|
10
11
|
table?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The table batches are kept in. Default `gemi_job_batches` beside
|
|
14
|
+
* `gemi_jobs`, and `<table>_batches` beside a jobs table of another name.
|
|
15
|
+
* A plain identifier, like `table`. Only touched by `Job.dispatchBatch` and
|
|
16
|
+
* the batch methods.
|
|
17
|
+
*/
|
|
18
|
+
batchTable?: string;
|
|
11
19
|
/**
|
|
12
20
|
* SQLite only: how long, in milliseconds, a statement waits for another
|
|
13
21
|
* process's write lock before failing with `SQLITE_BUSY`. Default `1000`.
|
|
@@ -72,6 +80,15 @@ export type DatabaseJobStatus = "pending" | "claimed" | "dead";
|
|
|
72
80
|
* `transaction` below for why SQLite is left out, and why a driver built from
|
|
73
81
|
* a bare client never joins.
|
|
74
82
|
*
|
|
83
|
+
* ### Batches
|
|
84
|
+
*
|
|
85
|
+
* A batch is a row of `batchTable`, and its jobs are rows of the jobs table
|
|
86
|
+
* with `batch_id` set. Ending a job of a batch, counting it and enqueueing any
|
|
87
|
+
* callback it makes due happen in one transaction that locks the batch row
|
|
88
|
+
* first; see the "Batches" section below. A table from before batches, without
|
|
89
|
+
* `batch_id` and `progress`, still runs every other job: the claim reads `*`,
|
|
90
|
+
* and only the batch methods need the new columns.
|
|
91
|
+
*
|
|
75
92
|
* ### What it does not do
|
|
76
93
|
*
|
|
77
94
|
* It has no `subscribe`: another process's dispatch cannot wake this one, so
|
|
@@ -80,12 +97,15 @@ export type DatabaseJobStatus = "pending" | "claimed" | "dead";
|
|
|
80
97
|
*/
|
|
81
98
|
export declare class DatabaseQueueDriver implements QueueDriver {
|
|
82
99
|
readonly table: string;
|
|
100
|
+
readonly batchTable: string;
|
|
83
101
|
private readonly sql;
|
|
84
102
|
private readonly dialect;
|
|
85
103
|
/** The connection's name, when it came with one; see `transaction`. */
|
|
86
104
|
private readonly connection;
|
|
87
105
|
private readonly busyTimeout;
|
|
88
106
|
private configured;
|
|
107
|
+
/** SQLite: the transaction before the next; see `atomically`. */
|
|
108
|
+
private sqliteTail;
|
|
89
109
|
constructor(connection: Pick<DatabaseConnection, "sql" | "dialect"> & Partial<Pick<DatabaseConnection, "name">>, options?: DatabaseQueueDriverOptions);
|
|
90
110
|
/**
|
|
91
111
|
* Gives a SQLite connection a busy timeout, once, before the driver's first
|
|
@@ -118,14 +138,17 @@ export declare class DatabaseQueueDriver implements QueueDriver {
|
|
|
118
138
|
*/
|
|
119
139
|
private configure;
|
|
120
140
|
/**
|
|
121
|
-
* Creates the table and
|
|
122
|
-
* Prisma generates for the
|
|
123
|
-
* the table the other expects
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* it
|
|
141
|
+
* Creates the jobs table, the batches table and their indexes if they do
|
|
142
|
+
* not exist — the same DDL Prisma generates for the models in the docs, so
|
|
143
|
+
* a table made either way is the table the other expects — and adds the
|
|
144
|
+
* batch columns to a jobs table from before batches. For tests and for an
|
|
145
|
+
* app that does not manage its schema with Prisma; one that does should add
|
|
146
|
+
* the models instead, or `prisma migrate` will see tables it does not know
|
|
147
|
+
* and drop them.
|
|
127
148
|
*/
|
|
128
149
|
createTable(): Promise<void>;
|
|
150
|
+
/** Whether the jobs table has `batch_id` and `progress` yet. */
|
|
151
|
+
private hasBatchColumns;
|
|
129
152
|
enqueue(job: EnqueueJob): Promise<string>;
|
|
130
153
|
private insert;
|
|
131
154
|
/**
|
|
@@ -182,6 +205,57 @@ export declare class DatabaseQueueDriver implements QueueDriver {
|
|
|
182
205
|
* a scheduled job, say.
|
|
183
206
|
*/
|
|
184
207
|
prune(olderThanMs: number): Promise<number>;
|
|
208
|
+
enqueueBatch(batch: EnqueueBatch): Promise<void>;
|
|
209
|
+
private insertBatch;
|
|
210
|
+
findBatch(id: string, options?: {
|
|
211
|
+
progress?: boolean;
|
|
212
|
+
}): Promise<BatchStatus | null>;
|
|
213
|
+
cancelBatch(id: string): Promise<boolean>;
|
|
214
|
+
reportProgress(job: ClaimedJob, progress: number): Promise<void>;
|
|
215
|
+
/**
|
|
216
|
+
* Deletes batches that finished more than `olderThanMs` ago, and resolves
|
|
217
|
+
* to how many. Nothing else removes them; a finished batch is only kept so
|
|
218
|
+
* `findBatch` can still answer for it.
|
|
219
|
+
*/
|
|
220
|
+
pruneBatches(olderThanMs: number): Promise<number>;
|
|
221
|
+
/**
|
|
222
|
+
* `complete` and `fail` for a job of a batch: the job's row is ended and the
|
|
223
|
+
* batch counts it, in one transaction.
|
|
224
|
+
*/
|
|
225
|
+
private endBatchJob;
|
|
226
|
+
/** Counts one job's end against its locked batch row. */
|
|
227
|
+
private count;
|
|
228
|
+
/**
|
|
229
|
+
* Ends the batch's waiting jobs as cancelled — kept as dead rows that say
|
|
230
|
+
* why — and resolves to how many there were. Their rows are locked after
|
|
231
|
+
* the batch row, the order every batch transaction takes.
|
|
232
|
+
*/
|
|
233
|
+
private cancelWaiting;
|
|
234
|
+
/** Writes the batch's new counters and enqueues the callbacks they made due. */
|
|
235
|
+
private saveBatch;
|
|
236
|
+
/**
|
|
237
|
+
* Reads the batch row and holds it until the transaction ends. Postgres and
|
|
238
|
+
* MySQL lock the row; SQLite has no row locks, so a write to the row takes
|
|
239
|
+
* the file's write lock instead, waiting out another process's for the
|
|
240
|
+
* busy timeout rather than failing on the upgrade from a read lock.
|
|
241
|
+
*/
|
|
242
|
+
private lockBatch;
|
|
243
|
+
/**
|
|
244
|
+
* Runs `fn` in a transaction of the driver's own.
|
|
245
|
+
*
|
|
246
|
+
* On SQLite one at a time per driver. Bun gives a SQLite client a single
|
|
247
|
+
* connection, and a second `begin` on it while one is open is refused with
|
|
248
|
+
* "cannot start a transaction within a transaction". One the application
|
|
249
|
+
* has open on the same client — an ORM transaction, when the queue shares
|
|
250
|
+
* the default connection — is waited out the same way, a few times.
|
|
251
|
+
*/
|
|
252
|
+
private atomically;
|
|
253
|
+
/** The database's clock now, as a number, for values computed here. */
|
|
254
|
+
private clock;
|
|
255
|
+
/** An epoch-milliseconds value or `NULL`, typed as the BIGINT columns are. */
|
|
256
|
+
private timeOrNull;
|
|
257
|
+
/** A 0..1 progress value as a parameter Postgres can assign to its column. */
|
|
258
|
+
private fraction;
|
|
185
259
|
/**
|
|
186
260
|
* Postgres and SQLite: one statement. Postgres locks the rows it picks with
|
|
187
261
|
* `SKIP LOCKED` in a CTE, which it evaluates once, so a concurrent claimer
|
|
@@ -242,6 +316,9 @@ export declare class DatabaseQueueDriver implements QueueDriver {
|
|
|
242
316
|
* `@@map`) made, and a reserved word such as `order` is a syntax error.
|
|
243
317
|
*/
|
|
244
318
|
private name;
|
|
319
|
+
/** The batches table, quoted as `name` quotes the jobs table. */
|
|
320
|
+
private batches;
|
|
321
|
+
private quoted;
|
|
245
322
|
/** The database's clock, in epoch milliseconds. */
|
|
246
323
|
private now;
|
|
247
324
|
/**
|
|
@@ -257,4 +334,16 @@ export declare class DatabaseQueueDriver implements QueueDriver {
|
|
|
257
334
|
* the table, which is also where Prisma puts them.
|
|
258
335
|
*/
|
|
259
336
|
export declare function createTableStatements(dialect: Dialect, table: string): string[];
|
|
337
|
+
/**
|
|
338
|
+
* The two columns and the index batches add to a jobs table made before them,
|
|
339
|
+
* as Prisma's migration for the updated model writes them. `createTable` runs
|
|
340
|
+
* these when the columns are missing; an app on Prisma gets the same from
|
|
341
|
+
* `prisma migrate dev` after updating the model.
|
|
342
|
+
*/
|
|
343
|
+
export declare function addBatchColumnsStatements(dialect: Dialect, table: string): string[];
|
|
344
|
+
/**
|
|
345
|
+
* The batches table, as Prisma generates it for the `GemiJobBatch` model in
|
|
346
|
+
* the docs, with `IF NOT EXISTS` added.
|
|
347
|
+
*/
|
|
348
|
+
export declare function createBatchTableStatements(dialect: Dialect, table: string): string[];
|
|
260
349
|
//# 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,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;
|
|
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,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,C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atchOptions } from "./QueueManager";
|
|
3
|
+
/** `this.batch` inside a job dispatched with `dispatchBatch`. */
|
|
4
|
+
export type JobBatch = {
|
|
5
|
+
/** The batch's id. */
|
|
6
|
+
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the batch has been cancelled — by `Job.cancelBatch`, or by a
|
|
9
|
+
* failed job of a batch without `allowFailures`. Running jobs are not
|
|
10
|
+
* stopped; a long one checks this between steps and returns early.
|
|
11
|
+
*/
|
|
12
|
+
cancelled(): Promise<boolean>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The arguments `Job.with` takes for a job whose `run` ends with a
|
|
16
|
+
* `BatchStatus` parameter: the ones before it, because the batch appends its
|
|
17
|
+
* status when it enqueues the callback. Any other `run` takes its parameters
|
|
18
|
+
* as they are.
|
|
19
|
+
*/
|
|
20
|
+
export type JobCallArgs<A extends any[]> = A extends [...infer Rest, infer Last] ? BatchStatus extends Last ? Rest : A : A;
|
|
1
21
|
export declare class Job {
|
|
2
22
|
static name: string;
|
|
3
23
|
worker: boolean;
|
|
@@ -55,6 +75,20 @@ export declare class Job {
|
|
|
55
75
|
fail(error: unknown, options?: {
|
|
56
76
|
retry?: boolean;
|
|
57
77
|
}): void;
|
|
78
|
+
/**
|
|
79
|
+
* The batch this run belongs to, when the job was dispatched with
|
|
80
|
+
* `dispatchBatch`; `undefined` otherwise. Set by the queue before `run`.
|
|
81
|
+
*/
|
|
82
|
+
batch: JobBatch | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Called from `run` in a job of a batch: how far this job is, from 0 to 1,
|
|
85
|
+
* for the batch's `progress`. A retry starts again from 0, and a job that
|
|
86
|
+
* ends counts as 1 whatever it last said. Outside a batch it does nothing.
|
|
87
|
+
* Each call is a write, so report at steps, not per item of a hot loop.
|
|
88
|
+
*/
|
|
89
|
+
progress(value: number): Promise<void>;
|
|
90
|
+
/** @internal Where `progress` writes; set by the queue for a job of a batch. */
|
|
91
|
+
$progress: ((value: number) => Promise<void>) | undefined;
|
|
58
92
|
/** @internal What `release` or `fail` asked for during this run. */
|
|
59
93
|
$outcome: {
|
|
60
94
|
kind: "release";
|
|
@@ -78,6 +112,44 @@ export declare class Job {
|
|
|
78
112
|
* that can, an ignored rejection is an unhandled one, so await it.
|
|
79
113
|
*/
|
|
80
114
|
static dispatch<T extends Job>(this: new () => T, ...args: Parameters<T["run"]>): Promise<string>;
|
|
115
|
+
/**
|
|
116
|
+
* Queues one job per argument tuple as a batch, and resolves to the batch's
|
|
117
|
+
* id and size once every job is recorded. The jobs, the batch and its
|
|
118
|
+
* callbacks are recorded in one atomic write: all of them or none.
|
|
119
|
+
*
|
|
120
|
+
* ```ts
|
|
121
|
+
* const { id } = await BuildPageJob.dispatchBatch(
|
|
122
|
+
* pages.map((page) => [page.id, importId] as const),
|
|
123
|
+
* {
|
|
124
|
+
* name: `import:${importId}`,
|
|
125
|
+
* allowFailures: true,
|
|
126
|
+
* then: ImportFinishedJob.with(importId),
|
|
127
|
+
* catch: ImportFailedJob.with(importId),
|
|
128
|
+
* finally: ImportCleanupJob.with(importId),
|
|
129
|
+
* },
|
|
130
|
+
* );
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* Callbacks are jobs, enqueued exactly once, by whichever process ends the
|
|
134
|
+
* job that makes them due, with the batch's status appended to their
|
|
135
|
+
* arguments. Each job's own hooks run as usual. A worker job, a unique job
|
|
136
|
+
* and a driver without batches are refused here, on the caller's stack.
|
|
137
|
+
*/
|
|
138
|
+
static dispatchBatch<T extends Job>(this: new () => T, args: ReadonlyArray<Readonly<Parameters<T["run"]>>>, options?: JobBatchOptions): Promise<DispatchedBatch>;
|
|
139
|
+
/**
|
|
140
|
+
* A job and its arguments, without dispatching it: a batch's `then`,
|
|
141
|
+
* `catch` or `finally`. When the job runs, the batch's `BatchStatus` is
|
|
142
|
+
* appended to these arguments.
|
|
143
|
+
*/
|
|
144
|
+
static with<T extends Job>(this: new () => T, ...args: JobCallArgs<Parameters<T["run"]>>): JobCall;
|
|
145
|
+
/** A batch's status, or `null` for an id the queue has no batch under. */
|
|
146
|
+
static findBatch(id: string): Promise<BatchStatus | null>;
|
|
147
|
+
/**
|
|
148
|
+
* Cancels a batch that is still running, and resolves to whether it did.
|
|
149
|
+
* Its waiting jobs never run; running ones finish unless they check
|
|
150
|
+
* `this.batch.cancelled()`. `catch` and then `finally` run; `then` does not.
|
|
151
|
+
*/
|
|
152
|
+
static cancelBatch(id: string): Promise<boolean>;
|
|
81
153
|
}
|
|
82
154
|
export type JobThrottle = {
|
|
83
155
|
/** 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":"
|
|
1
|
+
{"version":3,"file":"Job.d.ts","sourceRoot":"","sources":["../../../services/queue/Job.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,OAAO,EAAiB,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAgB,MAAM,gBAAgB,CAAC;AAE1F,iEAAiE;AACjE,MAAM,MAAM,QAAQ,GAAG;IACrB,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,MAAM,IAAI,EAAE,MAAM,IAAI,CAAC,GAC5E,WAAW,SAAS,IAAI,GACtB,IAAI,GACJ,CAAC,GACH,CAAC,CAAC;AAEN,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;;;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KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type BatchStatus } from "./batch";
|
|
2
|
+
import type { ClaimOptions, ClaimedJob, EnqueueBatch, EnqueueJob, JobFailure, JobRelease, QueueDriver } from "./QueueDriver";
|
|
2
3
|
/**
|
|
3
4
|
* The default driver: a Map in this process's memory.
|
|
4
5
|
*
|
|
@@ -22,12 +23,17 @@ import type { ClaimOptions, ClaimedJob, EnqueueJob, JobFailure, JobRelease, Queu
|
|
|
22
23
|
* not be known by anyone, and the manager dead-letters it at once with a line
|
|
23
24
|
* saying so; filtered out, it would wait here unseen until the process exited.
|
|
24
25
|
*
|
|
26
|
+
* Batches are kept in a Map beside the jobs, and a finished one for a day.
|
|
27
|
+
* Everything a batch does happens synchronously inside the call that causes
|
|
28
|
+
* it, so the counters and the callbacks need no further care here.
|
|
29
|
+
*
|
|
25
30
|
* One timer at most, for the next moment something becomes claimable, and it
|
|
26
31
|
* is unref'd: a queue with nothing due does not hold the process open, and
|
|
27
32
|
* neither does one waiting out a backoff — the same way the queue never has.
|
|
28
33
|
*/
|
|
29
34
|
export declare class MemoryQueueDriver implements QueueDriver {
|
|
30
35
|
private entries;
|
|
36
|
+
private batches;
|
|
31
37
|
private listeners;
|
|
32
38
|
private timer;
|
|
33
39
|
private timerAt;
|
|
@@ -36,12 +42,26 @@ export declare class MemoryQueueDriver implements QueueDriver {
|
|
|
36
42
|
get waiting(): number;
|
|
37
43
|
/** Jobs currently claimed and not yet reported on. */
|
|
38
44
|
get leased(): number;
|
|
39
|
-
enqueue(
|
|
45
|
+
enqueue(job: EnqueueJob): Promise<string>;
|
|
46
|
+
private add;
|
|
47
|
+
enqueueBatch(batch: EnqueueBatch): Promise<void>;
|
|
48
|
+
findBatch(id: string, options?: {
|
|
49
|
+
progress?: boolean;
|
|
50
|
+
}): Promise<BatchStatus | null>;
|
|
51
|
+
cancelBatch(id: string): Promise<boolean>;
|
|
52
|
+
reportProgress(job: ClaimedJob, progress: number): Promise<void>;
|
|
40
53
|
claim(limit: number, options: ClaimOptions): Promise<ClaimedJob[]>;
|
|
41
54
|
complete(job: ClaimedJob): Promise<void>;
|
|
42
55
|
fail(job: ClaimedJob, failure: JobFailure): Promise<void>;
|
|
43
56
|
release(job: ClaimedJob, release: JobRelease): Promise<void>;
|
|
44
57
|
heartbeat(jobs: ClaimedJob[], options: ClaimOptions): Promise<void>;
|
|
58
|
+
/** Counts a job's end against its batch, if it has one. */
|
|
59
|
+
private count;
|
|
60
|
+
/** Stores the batch's new state and enqueues the callbacks it made due. */
|
|
61
|
+
private save;
|
|
62
|
+
/** Drops the batch's waiting jobs, and says how many there were. */
|
|
63
|
+
private cancelWaiting;
|
|
64
|
+
private forgetFinishedBatches;
|
|
45
65
|
subscribe(wake: () => void): () => void;
|
|
46
66
|
/**
|
|
47
67
|
* 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,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"MemoryQueueDriver.d.ts","sourceRoot":"","sources":["../../../services/queue/MemoryQueueDriver.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EAQjB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,eAAe,CAAC;AAoBvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,iBAAkB,YAAW,WAAW;IACnD,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,OAAO,CAAkC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E;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,7 @@
|
|
|
41
41
|
* every other one.
|
|
42
42
|
*/
|
|
43
43
|
import type { LockStore } from "../lock/LockStore";
|
|
44
|
+
import type { BatchCallbacks, BatchStatus } from "./batch";
|
|
44
45
|
export interface QueueDriver {
|
|
45
46
|
/**
|
|
46
47
|
* Records a job and returns its id. The job is claimable once `delayMs` has
|
|
@@ -83,13 +84,25 @@ export interface QueueDriver {
|
|
|
83
84
|
* ahead of everything enqueued while it waited. The contract suite pins it.
|
|
84
85
|
*/
|
|
85
86
|
claim(limit: number, options: ClaimOptions): Promise<ClaimedJob[]>;
|
|
86
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* Ends a claim successfully. The job is never claimed again.
|
|
89
|
+
*
|
|
90
|
+
* For a job of a batch (`batchId`), the batch's counters are updated in the
|
|
91
|
+
* same atomic step as the job is ended, and any batch callback that became
|
|
92
|
+
* due is enqueued in it too; see `enqueueBatch`. A stale claim's report
|
|
93
|
+
* changes neither.
|
|
94
|
+
*/
|
|
87
95
|
complete(job: ClaimedJob): Promise<void>;
|
|
88
96
|
/**
|
|
89
97
|
* Ends a claim unsuccessfully. With a `retryInMs`, the job becomes claimable
|
|
90
98
|
* again after that long, keeping its attempt count. With `retryInMs: null`
|
|
91
99
|
* it is dead-lettered: terminal, never claimed again. What a driver keeps of
|
|
92
100
|
* a dead-lettered job is its own business; the memory driver keeps nothing.
|
|
101
|
+
*
|
|
102
|
+
* For a job of a batch, a dead-letter is counted as the batch's `complete`
|
|
103
|
+
* counts a success, and a retry resets the job's reported progress to 0. A
|
|
104
|
+
* retry of a job whose batch has been cancelled is a dead-letter instead,
|
|
105
|
+
* counted as `cancelled`, as is a failure with `cancelled: true`.
|
|
93
106
|
*/
|
|
94
107
|
fail(job: ClaimedJob, failure: JobFailure): Promise<void>;
|
|
95
108
|
/**
|
|
@@ -136,7 +149,60 @@ export interface QueueDriver {
|
|
|
136
149
|
* once per manager.
|
|
137
150
|
*/
|
|
138
151
|
lockStore?(): LockStore;
|
|
152
|
+
/**
|
|
153
|
+
* Records a batch and all of its jobs in one atomic step: either every job
|
|
154
|
+
* and the batch are recorded, or none is. Optional; a driver without it
|
|
155
|
+
* cannot run `Job.dispatchBatch`.
|
|
156
|
+
*
|
|
157
|
+
* The driver then keeps the batch's counters (see `batch.ts`): every
|
|
158
|
+
* `complete` or dead-lettering `fail` of one of its jobs counts it, in the
|
|
159
|
+
* same atomic step that ends the job, and the step that counts the last one
|
|
160
|
+
* finishes the batch and enqueues its due callbacks. A callback's arguments
|
|
161
|
+
* are its own followed by the batch's status, and it is enqueued in that
|
|
162
|
+
* same step, so it is enqueued exactly once, by whichever process ended the
|
|
163
|
+
* job that made it due.
|
|
164
|
+
*
|
|
165
|
+
* Like `enqueue`, it writes on the caller's ORM transaction when
|
|
166
|
+
* `joinsTransaction` says so. A batch of no jobs is finished at once.
|
|
167
|
+
*/
|
|
168
|
+
enqueueBatch?(batch: EnqueueBatch): Promise<void>;
|
|
169
|
+
/**
|
|
170
|
+
* The batch's status, or `null` for an id the driver has no batch under.
|
|
171
|
+
* `progress: false` skips summing what the running jobs reported, for a
|
|
172
|
+
* caller that only wants the counters and `cancelledAt`; `progress` is then
|
|
173
|
+
* the ended jobs over `total`.
|
|
174
|
+
*/
|
|
175
|
+
findBatch?(id: string, options?: {
|
|
176
|
+
progress?: boolean;
|
|
177
|
+
}): Promise<BatchStatus | null>;
|
|
178
|
+
/**
|
|
179
|
+
* Cancels a batch that is still running, and resolves to whether it did:
|
|
180
|
+
* `false` for a batch that is unknown, finished or already cancelled. Its
|
|
181
|
+
* waiting jobs are ended as `cancelled` and never claimed; running ones
|
|
182
|
+
* finish, or notice through `this.batch.cancelled()`. `catch` becomes due
|
|
183
|
+
* unless a failure already made it due, and `finally` once nothing is
|
|
184
|
+
* pending. `then` never runs for a cancelled batch.
|
|
185
|
+
*/
|
|
186
|
+
cancelBatch?(id: string): Promise<boolean>;
|
|
187
|
+
/**
|
|
188
|
+
* Records how far a claimed job of a batch is, from 0 to 1, for the batch's
|
|
189
|
+
* `progress`. A stale claim's report is ignored.
|
|
190
|
+
*/
|
|
191
|
+
reportProgress?(job: ClaimedJob, progress: number): Promise<void>;
|
|
139
192
|
}
|
|
193
|
+
export type EnqueueBatch = {
|
|
194
|
+
/** The id to record the batch under. Chosen by the manager. */
|
|
195
|
+
id: string;
|
|
196
|
+
/** The `name` option, for finding it in storage. */
|
|
197
|
+
name: string | null;
|
|
198
|
+
/** The registered name every job of the batch runs as. */
|
|
199
|
+
job: string;
|
|
200
|
+
/** One JSON array of `run` arguments per job. */
|
|
201
|
+
args: string[];
|
|
202
|
+
/** Whether a failed job leaves the rest running; see `batch.ts`. */
|
|
203
|
+
allowFailures: boolean;
|
|
204
|
+
callbacks: BatchCallbacks;
|
|
205
|
+
};
|
|
140
206
|
export type EnqueueJob = {
|
|
141
207
|
/** The job's registered name — its class's `static name`. */
|
|
142
208
|
name: string;
|
|
@@ -194,6 +260,8 @@ export type ClaimedJob = {
|
|
|
194
260
|
attempt: number;
|
|
195
261
|
/** When `enqueue` recorded it, in epoch milliseconds. */
|
|
196
262
|
createdAt: number;
|
|
263
|
+
/** The batch the job belongs to. Absent for a job dispatched on its own. */
|
|
264
|
+
batchId?: string;
|
|
197
265
|
};
|
|
198
266
|
export type JobRelease = {
|
|
199
267
|
/** Milliseconds until the job is claimable again. */
|
|
@@ -204,5 +272,10 @@ export type JobFailure = {
|
|
|
204
272
|
error: string;
|
|
205
273
|
/** Milliseconds until the retry is claimable, or `null` to dead-letter. */
|
|
206
274
|
retryInMs: number | null;
|
|
275
|
+
/**
|
|
276
|
+
* The job is dead-lettered because its batch was cancelled, not because it
|
|
277
|
+
* failed: the batch counts it as `cancelled`. Only with `retryInMs: null`.
|
|
278
|
+
*/
|
|
279
|
+
cancelled?: boolean;
|
|
207
280
|
};
|
|
208
281
|
//# 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;
|
|
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;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3D,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;;;;;;;OAOG;IACH,QAAQ,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;;;;;;;;;OAUG;IACH,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;I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Aa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,cAAc,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,UAAU,CAAC,EAAE;QAAE,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,OAAO,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"}
|
|
@@ -3,6 +3,7 @@ import { LockManager } from "../lock/LockManager";
|
|
|
3
3
|
import { Job } from "./Job";
|
|
4
4
|
import { type QueueConfig } from "./config";
|
|
5
5
|
import type { ClaimedJob, QueueDriver } from "./QueueDriver";
|
|
6
|
+
import type { BatchStatus, JobCall } from "./batch";
|
|
6
7
|
declare global {
|
|
7
8
|
/**
|
|
8
9
|
* The queue loop a `gemi dev` server is running over a driver that outlives
|
|
@@ -19,6 +20,32 @@ declare global {
|
|
|
19
20
|
stop(): Promise<unknown>;
|
|
20
21
|
} | undefined;
|
|
21
22
|
}
|
|
23
|
+
/** What `Job.dispatchBatch` resolves to. */
|
|
24
|
+
export type DispatchedBatch = {
|
|
25
|
+
/** The batch's id, for `Job.findBatch` and `Job.cancelBatch`. */
|
|
26
|
+
id: string;
|
|
27
|
+
/** How many jobs it was dispatched with. */
|
|
28
|
+
total: number;
|
|
29
|
+
};
|
|
30
|
+
/** The options of `Job.dispatchBatch`. */
|
|
31
|
+
export type JobBatchOptions = {
|
|
32
|
+
/** A label kept with the batch, for finding it in storage and in its status. */
|
|
33
|
+
name?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Whether a dead-lettered job leaves the rest running. Default `false`: the
|
|
36
|
+
* first one cancels the batch.
|
|
37
|
+
*/
|
|
38
|
+
allowFailures?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Enqueued once every job has ended, when the batch was not cancelled and
|
|
41
|
+
* no job failed (or `allowFailures` is set). Build it with `Job.with(...)`.
|
|
42
|
+
*/
|
|
43
|
+
then?: JobCall;
|
|
44
|
+
/** Enqueued at the first failed job, or at `cancelBatch`, whichever is first. */
|
|
45
|
+
catch?: JobCall;
|
|
46
|
+
/** Enqueued once every job has ended, whatever happened. */
|
|
47
|
+
finally?: JobCall;
|
|
48
|
+
};
|
|
22
49
|
/** What `drain` could not wait out. */
|
|
23
50
|
export type DrainResult = {
|
|
24
51
|
/**
|
|
@@ -163,6 +190,24 @@ export declare class QueueManager {
|
|
|
163
190
|
*/
|
|
164
191
|
reportFailure?: boolean;
|
|
165
192
|
}): Promise<string>;
|
|
193
|
+
/**
|
|
194
|
+
* Queues a batch: every job, the batch and its callbacks in one atomic
|
|
195
|
+
* write. See `Job.dispatchBatch`.
|
|
196
|
+
*
|
|
197
|
+
* Inside an ORM transaction the batch belongs to it, exactly as a single
|
|
198
|
+
* dispatch does in `push`: written on it by a driver that joins, otherwise
|
|
199
|
+
* held and recorded at the commit, resolving at once to the id it will have.
|
|
200
|
+
*/
|
|
201
|
+
pushBatch(job: new () => Job, args: string[], options?: JobBatchOptions): Promise<DispatchedBatch>;
|
|
202
|
+
/** `pushBatch`, once it is known that the batch is recorded now; see `record`. */
|
|
203
|
+
private recordBatch;
|
|
204
|
+
/** The batch's status, or `null` for an unknown id. See `Job.findBatch`. */
|
|
205
|
+
findBatch(id: string): Promise<BatchStatus | null>;
|
|
206
|
+
/**
|
|
207
|
+
* Cancels a running batch, and resolves to whether it did. See
|
|
208
|
+
* `Job.cancelBatch`.
|
|
209
|
+
*/
|
|
210
|
+
cancelBatch(id: string): Promise<boolean>;
|
|
166
211
|
/**
|
|
167
212
|
* The locks unique jobs, cron jobs' `withoutOverlapping` and `onOneServer`,
|
|
168
213
|
* and the `Lock` facade use, over the store the `locks` setting names. Built
|
|
@@ -309,6 +354,8 @@ export declare class QueueManager {
|
|
|
309
354
|
* escape the queue with the job's slot still counted as taken.
|
|
310
355
|
*/
|
|
311
356
|
private run;
|
|
357
|
+
/** What `this.batch` and `this.progress()` reach in a job of a batch. */
|
|
358
|
+
private batchHandle;
|
|
312
359
|
/**
|
|
313
360
|
* Takes a slot under the job's `concurrency` key and a hit under each of
|
|
314
361
|
* its `throttle` keys, all in the queue's lock store, so the limits hold
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueueManager.d.ts","sourceRoot":"","sources":["../../../services/queue/QueueManager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAMhE,OAAO,EAAiB,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIjE,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAE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