gemi 0.204.2 → 0.205.1
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/AgentProvider.d.ts +83 -3
- package/dist/ai/AgentProvider.d.ts.map +1 -1
- package/dist/ai/client/index.js +12 -10
- package/dist/ai/client/index.js.map +1 -1
- package/dist/ai/index.d.ts +2 -2
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +4 -4
- package/dist/ai/index.js.map +3 -3
- package/dist/ai/providers/anthropicRequest.d.ts +142 -0
- package/dist/ai/providers/anthropicRequest.d.ts.map +1 -0
- package/dist/ai/providers/anthropicStream.d.ts +54 -0
- package/dist/ai/providers/anthropicStream.d.ts.map +1 -0
- package/dist/ai/providers/call.d.ts +14 -3
- package/dist/ai/providers/call.d.ts.map +1 -1
- package/dist/ai/providers/capabilities.d.ts +31 -0
- package/dist/ai/providers/capabilities.d.ts.map +1 -1
- package/dist/ai/providers/endpoints.d.ts +51 -0
- package/dist/ai/providers/endpoints.d.ts.map +1 -1
- package/dist/ai/providers/http.d.ts.map +1 -1
- package/dist/ai/providers/request.d.ts +43 -1
- package/dist/ai/providers/request.d.ts.map +1 -1
- package/dist/ai/runtime.d.ts +5 -1
- package/dist/ai/runtime.d.ts.map +1 -1
- package/dist/ai/testing/RecordingProvider.d.ts +5 -2
- package/dist/ai/testing/RecordingProvider.d.ts.map +1 -1
- package/dist/ai/testing/index.js +3 -3
- package/dist/ai/testing/index.js.map +3 -3
- package/dist/ai/types.d.ts +34 -0
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/usageMeter.d.ts +4 -1
- package/dist/ai/usageMeter.d.ts.map +1 -1
- package/dist/app/index.js +2 -2
- package/dist/app/index.js.map +1 -1
- 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-2t1eyzvq.js → chunk-06w8hhnk.js} +2 -2
- package/dist/{chunk-2t1eyzvq.js.map → chunk-06w8hhnk.js.map} +1 -1
- package/dist/{chunk-0t1d9s34.js → chunk-09hzyf9g.js} +3 -3
- package/dist/{chunk-0t1d9s34.js.map → chunk-09hzyf9g.js.map} +1 -1
- package/dist/{chunk-bq4pgzcd.js → chunk-0cckwd91.js} +2 -2
- package/dist/{chunk-bq4pgzcd.js.map → chunk-0cckwd91.js.map} +1 -1
- package/dist/{chunk-9hqnecjt.js → chunk-0eq7am78.js} +2 -2
- package/dist/{chunk-9hqnecjt.js.map → chunk-0eq7am78.js.map} +1 -1
- package/dist/{chunk-jma5d7zd.js → chunk-1em8t2x1.js} +3 -3
- package/dist/{chunk-jma5d7zd.js.map → chunk-1em8t2x1.js.map} +1 -1
- package/dist/{chunk-ek0dvbck.js → chunk-1tc6j8bn.js} +3 -3
- package/dist/{chunk-ek0dvbck.js.map → chunk-1tc6j8bn.js.map} +1 -1
- package/dist/{chunk-dk1xxtgk.js → chunk-24tj4dzx.js} +2 -2
- package/dist/{chunk-dk1xxtgk.js.map → chunk-24tj4dzx.js.map} +1 -1
- package/dist/{chunk-s5hdrpam.js → chunk-34vvev4a.js} +3 -3
- package/dist/{chunk-s5hdrpam.js.map → chunk-34vvev4a.js.map} +1 -1
- package/dist/{chunk-f52maa9b.js → chunk-3830ee5d.js} +2 -2
- package/dist/{chunk-f52maa9b.js.map → chunk-3830ee5d.js.map} +1 -1
- package/dist/{chunk-yykrvrpt.js → chunk-39dz1abf.js} +1 -1
- package/dist/{chunk-yjvqq4hj.js → chunk-3ek0s8fx.js} +2 -2
- package/dist/{chunk-yjvqq4hj.js.map → chunk-3ek0s8fx.js.map} +1 -1
- package/dist/{chunk-vsd5h2d9.js → chunk-3z8d8v8q.js} +3 -3
- package/dist/{chunk-vsd5h2d9.js.map → chunk-3z8d8v8q.js.map} +1 -1
- package/dist/{chunk-f9c8bnzx.js → chunk-460c8k50.js} +3 -3
- package/dist/{chunk-f9c8bnzx.js.map → chunk-460c8k50.js.map} +1 -1
- package/dist/{chunk-wxyxnbh6.js → chunk-4ksnhx8x.js} +4 -4
- package/dist/{chunk-wxyxnbh6.js.map → chunk-4ksnhx8x.js.map} +1 -1
- package/dist/chunk-4q59y78y.js +5 -0
- package/dist/{chunk-cf7xc02m.js.map → chunk-4q59y78y.js.map} +1 -1
- package/dist/{chunk-4m8t67px.js → chunk-65btke6p.js} +2 -2
- package/dist/{chunk-4m8t67px.js.map → chunk-65btke6p.js.map} +1 -1
- package/dist/{chunk-efnerp0c.js → chunk-6cx6kh04.js} +2 -2
- package/dist/{chunk-efnerp0c.js.map → chunk-6cx6kh04.js.map} +1 -1
- package/dist/{chunk-jmsfkzav.js → chunk-6ge27ygx.js} +2 -2
- package/dist/{chunk-jmsfkzav.js.map → chunk-6ge27ygx.js.map} +1 -1
- package/dist/{chunk-x26jb60f.js → chunk-6x2zbh1q.js} +2 -2
- package/dist/{chunk-x26jb60f.js.map → chunk-6x2zbh1q.js.map} +1 -1
- package/dist/{chunk-0hfzzb3k.js → chunk-6zpf257t.js} +3 -3
- package/dist/{chunk-0hfzzb3k.js.map → chunk-6zpf257t.js.map} +1 -1
- package/dist/{chunk-cq7hk8v9.js → chunk-72e857nw.js} +2 -2
- package/dist/{chunk-cq7hk8v9.js.map → chunk-72e857nw.js.map} +1 -1
- package/dist/{chunk-4v5c4mes.js → chunk-77dt2tap.js} +2 -2
- package/dist/{chunk-4v5c4mes.js.map → chunk-77dt2tap.js.map} +1 -1
- package/dist/{chunk-ptpzh61m.js → chunk-78g1cngk.js} +2 -2
- package/dist/{chunk-ptpzh61m.js.map → chunk-78g1cngk.js.map} +1 -1
- package/dist/{chunk-d7kknkmq.js → chunk-7wzhdq1x.js} +3 -3
- package/dist/{chunk-d7kknkmq.js.map → chunk-7wzhdq1x.js.map} +1 -1
- package/dist/{chunk-cg009t41.js → chunk-8a5wngew.js} +2 -2
- package/dist/{chunk-cg009t41.js.map → chunk-8a5wngew.js.map} +1 -1
- package/dist/{chunk-6g1xac70.js → chunk-8ar7180x.js} +2 -2
- package/dist/{chunk-6g1xac70.js.map → chunk-8ar7180x.js.map} +1 -1
- package/dist/{chunk-d3k38gk1.js → chunk-8d2g78vc.js} +2 -2
- package/dist/{chunk-d3k38gk1.js.map → chunk-8d2g78vc.js.map} +1 -1
- package/dist/{chunk-yrbvfda9.js → chunk-8ncqxja2.js} +1 -1
- package/dist/{chunk-6w6q9mxe.js → chunk-8q5kxzxn.js} +3 -3
- package/dist/{chunk-6w6q9mxe.js.map → chunk-8q5kxzxn.js.map} +1 -1
- package/dist/{chunk-y45whafz.js → chunk-9m6mkaqb.js} +2 -2
- package/dist/{chunk-y45whafz.js.map → chunk-9m6mkaqb.js.map} +1 -1
- package/dist/{chunk-zk1vwwv6.js → chunk-9qyet3nb.js} +2 -2
- package/dist/{chunk-zk1vwwv6.js.map → chunk-9qyet3nb.js.map} +1 -1
- package/dist/{chunk-p2nqksdq.js → chunk-a7rgrcs0.js} +3 -3
- package/dist/{chunk-p2nqksdq.js.map → chunk-a7rgrcs0.js.map} +1 -1
- package/dist/{chunk-x244kqcc.js → chunk-a7zqp5m7.js} +2 -2
- package/dist/{chunk-x244kqcc.js.map → chunk-a7zqp5m7.js.map} +1 -1
- package/dist/{chunk-y5kfqq4f.js → chunk-aed0vv5g.js} +2 -2
- package/dist/{chunk-y5kfqq4f.js.map → chunk-aed0vv5g.js.map} +1 -1
- package/dist/{chunk-9m7c4mws.js → chunk-ba1h9pm6.js} +2 -2
- package/dist/{chunk-9m7c4mws.js.map → chunk-ba1h9pm6.js.map} +1 -1
- package/dist/chunk-bb74k64k.js +11 -0
- package/dist/chunk-bb74k64k.js.map +21 -0
- package/dist/{chunk-7gxmf9rg.js → chunk-bpqkzpkt.js} +2 -2
- package/dist/{chunk-7gxmf9rg.js.map → chunk-bpqkzpkt.js.map} +1 -1
- package/dist/{chunk-qcrj4t72.js → chunk-bxznwntw.js} +2 -2
- package/dist/{chunk-qcrj4t72.js.map → chunk-bxznwntw.js.map} +1 -1
- package/dist/{chunk-4c0rb2ng.js → chunk-c8bvpkr2.js} +2 -2
- package/dist/{chunk-4c0rb2ng.js.map → chunk-c8bvpkr2.js.map} +1 -1
- package/dist/{chunk-jeq8wvj6.js → chunk-cffx7wqp.js} +2 -2
- package/dist/{chunk-jeq8wvj6.js.map → chunk-cffx7wqp.js.map} +1 -1
- package/dist/{chunk-8jfnn7v6.js → chunk-djnn8vvp.js} +2 -2
- package/dist/{chunk-8jfnn7v6.js.map → chunk-djnn8vvp.js.map} +1 -1
- package/dist/{chunk-s6bq91cm.js → chunk-dwya9z8p.js} +2 -2
- package/dist/{chunk-s6bq91cm.js.map → chunk-dwya9z8p.js.map} +1 -1
- package/dist/chunk-e0scxs81.js +5 -0
- package/dist/{chunk-xwqdh388.js.map → chunk-e0scxs81.js.map} +4 -4
- package/dist/{chunk-0shq2d31.js → chunk-eeq9ty68.js} +2 -2
- package/dist/{chunk-0shq2d31.js.map → chunk-eeq9ty68.js.map} +1 -1
- package/dist/{chunk-77x9vxht.js → chunk-emt36pxm.js} +2 -2
- package/dist/{chunk-77x9vxht.js.map → chunk-emt36pxm.js.map} +1 -1
- package/dist/{chunk-k62338g2.js → chunk-etcds9w3.js} +2 -2
- package/dist/{chunk-k62338g2.js.map → chunk-etcds9w3.js.map} +1 -1
- package/dist/{chunk-kgjcszx0.js → chunk-fe2nkshn.js} +2 -2
- package/dist/{chunk-kgjcszx0.js.map → chunk-fe2nkshn.js.map} +1 -1
- package/dist/{chunk-d5d3a8bm.js → chunk-fhn92are.js} +2 -2
- package/dist/{chunk-d5d3a8bm.js.map → chunk-fhn92are.js.map} +1 -1
- package/dist/{chunk-crqbzfd5.js → chunk-g6tqje74.js} +2 -2
- package/dist/{chunk-crqbzfd5.js.map → chunk-g6tqje74.js.map} +1 -1
- package/dist/{chunk-p9pwskv6.js → chunk-hke4hzfm.js} +2 -2
- package/dist/{chunk-p9pwskv6.js.map → chunk-hke4hzfm.js.map} +1 -1
- package/dist/{chunk-3gkxnfef.js → chunk-hqg4dfca.js} +2 -2
- package/dist/{chunk-3gkxnfef.js.map → chunk-hqg4dfca.js.map} +1 -1
- package/dist/{chunk-39hed4yr.js → chunk-hthyn5pj.js} +3 -3
- package/dist/{chunk-39hed4yr.js.map → chunk-hthyn5pj.js.map} +1 -1
- package/dist/{chunk-w3mc696j.js → chunk-jn1h76sa.js} +2 -2
- package/dist/{chunk-w3mc696j.js.map → chunk-jn1h76sa.js.map} +1 -1
- package/dist/{chunk-ezvtkbp9.js → chunk-jy26hy7z.js} +2 -2
- package/dist/{chunk-ezvtkbp9.js.map → chunk-jy26hy7z.js.map} +1 -1
- package/dist/{chunk-5km0np8s.js → chunk-jy61580r.js} +2 -2
- package/dist/{chunk-5km0np8s.js.map → chunk-jy61580r.js.map} +1 -1
- package/dist/{chunk-phvvxv1a.js → chunk-k8peybx0.js} +3 -3
- package/dist/{chunk-phvvxv1a.js.map → chunk-k8peybx0.js.map} +1 -1
- package/dist/{chunk-3xzhbkya.js → chunk-m3v661b3.js} +3 -3
- package/dist/{chunk-3xzhbkya.js.map → chunk-m3v661b3.js.map} +1 -1
- package/dist/{chunk-js9rm7g0.js → chunk-ndcqbwsj.js} +2 -2
- package/dist/{chunk-js9rm7g0.js.map → chunk-ndcqbwsj.js.map} +1 -1
- package/dist/{chunk-cdgnwzwf.js → chunk-ne51fxg2.js} +2 -2
- package/dist/{chunk-cdgnwzwf.js.map → chunk-ne51fxg2.js.map} +1 -1
- package/dist/{chunk-b1mdan5a.js → chunk-nfher0gz.js} +2 -2
- package/dist/{chunk-b1mdan5a.js.map → chunk-nfher0gz.js.map} +1 -1
- package/dist/{chunk-e5mqjren.js → chunk-njnng5ew.js} +4 -4
- package/dist/{chunk-e5mqjren.js.map → chunk-njnng5ew.js.map} +1 -1
- package/dist/{chunk-e3ehv27z.js → chunk-p9c5rc1z.js} +3 -3
- package/dist/{chunk-e3ehv27z.js.map → chunk-p9c5rc1z.js.map} +1 -1
- package/dist/{chunk-rr8bzm6k.js → chunk-q1t9gvm1.js} +2 -2
- package/dist/{chunk-rr8bzm6k.js.map → chunk-q1t9gvm1.js.map} +1 -1
- package/dist/{chunk-xvk6aqd7.js → chunk-q751b0jx.js} +3 -3
- package/dist/{chunk-xvk6aqd7.js.map → chunk-q751b0jx.js.map} +1 -1
- package/dist/{chunk-1kehwa3s.js → chunk-qc0e278w.js} +1 -1
- package/dist/{chunk-re9ac4tc.js → chunk-rbkvkv2m.js} +4 -4
- package/dist/{chunk-re9ac4tc.js.map → chunk-rbkvkv2m.js.map} +1 -1
- package/dist/{chunk-k1gt7fgy.js → chunk-rjtge67x.js} +3 -3
- package/dist/{chunk-k1gt7fgy.js.map → chunk-rjtge67x.js.map} +1 -1
- package/dist/{chunk-ybcdxrqx.js → chunk-s1fa5f8b.js} +2 -2
- package/dist/{chunk-ybcdxrqx.js.map → chunk-s1fa5f8b.js.map} +1 -1
- package/dist/{chunk-8pw4zjnx.js → chunk-scw0vknj.js} +1 -1
- package/dist/{chunk-gc9g7c4p.js → chunk-sjve1yvv.js} +3 -3
- package/dist/{chunk-gc9g7c4p.js.map → chunk-sjve1yvv.js.map} +1 -1
- package/dist/{chunk-wn4j741t.js → chunk-te4vz0rw.js} +2 -2
- package/dist/{chunk-wn4j741t.js.map → chunk-te4vz0rw.js.map} +1 -1
- package/dist/{chunk-2ngdhbz7.js → chunk-tx5zrdmb.js} +2 -2
- package/dist/{chunk-2ngdhbz7.js.map → chunk-tx5zrdmb.js.map} +1 -1
- package/dist/{chunk-pq15dt8j.js → chunk-v1d7xya8.js} +15 -15
- package/dist/{chunk-pq15dt8j.js.map → chunk-v1d7xya8.js.map} +5 -5
- package/dist/{chunk-fq5b1k4n.js → chunk-v2fd69at.js} +2 -2
- package/dist/{chunk-fq5b1k4n.js.map → chunk-v2fd69at.js.map} +1 -1
- package/dist/{chunk-n5k42dh7.js → chunk-vebstesm.js} +3 -3
- package/dist/{chunk-n5k42dh7.js.map → chunk-vebstesm.js.map} +1 -1
- package/dist/{chunk-n3kg99yw.js → chunk-vyaedzr8.js} +3 -3
- package/dist/{chunk-n3kg99yw.js.map → chunk-vyaedzr8.js.map} +1 -1
- package/dist/{chunk-9bjggtdt.js → chunk-wdrmzjtq.js} +2 -2
- package/dist/{chunk-9bjggtdt.js.map → chunk-wdrmzjtq.js.map} +1 -1
- package/dist/{chunk-5gvc03cv.js → chunk-wfees83q.js} +3 -3
- package/dist/{chunk-5gvc03cv.js.map → chunk-wfees83q.js.map} +1 -1
- package/dist/{chunk-n26atakz.js → chunk-wpfempaj.js} +3 -3
- package/dist/{chunk-n26atakz.js.map → chunk-wpfempaj.js.map} +1 -1
- package/dist/{chunk-0pgk811s.js → chunk-wrfz0jsw.js} +2 -2
- package/dist/{chunk-0pgk811s.js.map → chunk-wrfz0jsw.js.map} +1 -1
- package/dist/{chunk-c7nbzryd.js → chunk-xgc5tj8k.js} +3 -3
- package/dist/{chunk-c7nbzryd.js.map → chunk-xgc5tj8k.js.map} +1 -1
- package/dist/{chunk-1e82gfk9.js → chunk-yj1h4rzn.js} +3 -3
- package/dist/{chunk-1e82gfk9.js.map → chunk-yj1h4rzn.js.map} +1 -1
- package/dist/{chunk-k9882kqg.js → chunk-zf1eqgzt.js} +2 -2
- package/dist/{chunk-k9882kqg.js.map → chunk-zf1eqgzt.js.map} +1 -1
- package/dist/{chunk-4ex4s616.js → chunk-znw55n6g.js} +2 -2
- package/dist/{chunk-4ex4s616.js.map → chunk-znw55n6g.js.map} +1 -1
- package/dist/{chunk-6bfj0mbp.js → chunk-zvk6dydb.js} +3 -3
- package/dist/{chunk-6bfj0mbp.js.map → chunk-zvk6dydb.js.map} +1 -1
- package/dist/config/index.js +1 -1
- package/dist/console/run.js +2 -2
- package/dist/console/run.js.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/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/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/i18n/dictionaryRuntime.js +2 -2
- package/dist/i18n/dictionaryRuntime.js.map +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +1 -1
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +1 -1
- package/dist/orm/index.js +2 -2
- package/dist/orm/index.js.map +1 -1
- package/dist/probe/index.js +2 -2
- package/dist/probe/index.js.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/index.js +2 -2
- package/dist/services/index.js.map +1 -1
- package/dist/services/queue/work.js +2 -2
- package/dist/services/queue/work.js.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/vitest/index.js +2 -2
- package/dist/vitest/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-1x60thpm.js +0 -8
- package/dist/chunk-1x60thpm.js.map +0 -19
- package/dist/chunk-cf7xc02m.js +0 -5
- package/dist/chunk-xwqdh388.js +0 -5
- /package/dist/{chunk-yykrvrpt.js.map → chunk-39dz1abf.js.map} +0 -0
- /package/dist/{chunk-yrbvfda9.js.map → chunk-8ncqxja2.js.map} +0 -0
- /package/dist/{chunk-1kehwa3s.js.map → chunk-qc0e278w.js.map} +0 -0
- /package/dist/{chunk-8pw4zjnx.js.map → chunk-scw0vknj.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{readFile as P}from"fs/promises";import{join as Q}from"path";var K="/",W=".vite/gemi.json";function N(H){let q=H?.trim()??"";if(q==="")return K;if(!q.startsWith("/")&&!/^[a-z][a-z\d+.-]*:\/\//i.test(q))throw Error(`Asset base ${JSON.stringify(H)} is neither an absolute URL nor a path starting with "/". The server-rendered document links the build's chunks by this prefix, and a relative one would resolve against each page's URL instead of the build's.`);return q.endsWith("/")?q:`${q}/`}function Z(H,q=process.env.GEMI_ASSET_BASE){let J=q?.trim()?q:H;return J?.trim()?N(J):void 0}function $(H,q=K){return`${q}${H}`}async function x(H){let q;try{q=await P(Q(H,W),"utf8")}catch(J){if(J?.code==="ENOENT")return K;throw J}return N(JSON.parse(q).assetBase)}
|
|
3
|
-
export{K as
|
|
3
|
+
export{K as Da,W as Ea,N as Fa,Z as Ga,$ as Ha,x as Ia};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=0E5A959D339C8D3C64756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import { readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\n/**\n * Where the browser fetches the client build from — the prefix every URL gemi\n * builds out of a Vite manifest entry starts with. `/` unless the app sets one,\n * which is the root-relative `/assets/...` every gemi app has always served.\n */\nexport const DEFAULT_ASSET_BASE = \"/\";\n\n/**\n * The file the client build records its base in, relative to `dist/client`.\n * Next to Vite's own `manifest.json`, and like it outside anything the static\n * handler serves.\n */\nexport const ASSET_BASE_RECORD = \".vite/gemi.json\";\n\n/**\n * The base as a URL prefix: trimmed, `/` when empty, and always ending in `/`\n * so `${base}${file}` never needs to know which way round the caller wrote it.\n *\n * Only an absolute URL (`https://cdn.example.com/r42/`) or an absolute path\n * (`/static/`) is accepted. Vite also takes a relative base (`./`, `\"\"`), which\n * resolves each chunk against the module that imports it — but the document\n * has no importing module: a relative `<link rel=\"modulepreload\">` in the SSR\n * head resolves against the page's own URL, so `/users/7` would ask for\n * `/users/assets/...`. Refused here rather than served broken.\n */\nexport function normalizeAssetBase(value: string | undefined): string {\n const base = value?.trim() ?? \"\";\n if (base === \"\") {\n return DEFAULT_ASSET_BASE;\n }\n if (!base.startsWith(\"/\") && !/^[a-z][a-z\\d+.-]*:\\/\\//i.test(base)) {\n throw new Error(\n `Asset base ${JSON.stringify(value)} is neither an absolute URL nor a path starting with \"/\". ` +\n `The server-rendered document links the build's chunks by this prefix, and a relative one would ` +\n `resolve against each page's URL instead of the build's.`,\n );\n }\n return base.endsWith(\"/\") ? base : `${base}/`;\n}\n\n/**\n * The asset base the build should use, from `GEMI_ASSET_BASE` or the\n * `assetBase` field of `gemi.config.ts`, in that order. `undefined` when\n * neither is set, which leaves Vite's own default in place.\n *\n * The variable wins because the thing it usually carries — a release id in the\n * path — is known to the CI job running the build, not to a file checked in\n * beside the code.\n */\nexport function resolveAssetBase(\n configured: string | undefined,\n env: string | undefined = process.env.GEMI_ASSET_BASE,\n): string | undefined {\n const value = env?.trim() ? env : configured;\n return value?.trim() ? normalizeAssetBase(value) : undefined;\n}\n\n/** A manifest entry's `file` (`assets/client-abc.js`) as a URL under `base`. */\nexport function assetUrl(file: string, base: string = DEFAULT_ASSET_BASE): string {\n return `${base}${file}`;\n}\n\n/**\n * The base the client build in `clientDir` was built with, as the build\n * recorded it.\n *\n * Read from the build output rather than from `GEMI_ASSET_BASE` at boot: the\n * base is baked into the bundle — Vite writes it into every preload helper and\n * CSS `url()` — so the only value the document can safely use is the one the\n * bundle already has. An environment read here could differ from the build's\n * (a variable set on the CI job and not on the container is the ordinary case),\n * and the document would then link chunks the bundle does not import.\n *\n * `/` when there is no record, which is a build from before the record existed\n * and therefore one built without a base.\n */\nexport async function readBuiltAssetBase(clientDir: string): Promise<string> {\n let raw: string;\n try {\n raw = await readFile(join(clientDir, ASSET_BASE_RECORD), \"utf8\");\n } catch (error) {\n if ((error as NodeJS.ErrnoException)?.code === \"ENOENT\") {\n return DEFAULT_ASSET_BASE;\n }\n throw error;\n }\n return normalizeAssetBase(JSON.parse(raw).assetBase);\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AAAA,mBAAS,oBACT,eAAS,aAOF,IAAM,EAAqB,IAOrB,EAAoB,kBAa1B,SAAS,CAAkB,CAAC,EAAmC,CACpE,IAAM,EAAO,GAAO,KAAK,GAAK,GAC9B,GAAI,IAAS,GACX,OAAO,EAET,GAAI,CAAC,EAAK,WAAW,GAAG,GAAK,CAAC,0BAA0B,KAAK,CAAI,EAC/D,MAAU,MACR,cAAc,KAAK,UAAU,CAAK,mNAGpC,EAEF,OAAO,EAAK,SAAS,GAAG,EAAI,EAAO,GAAG,KAYjC,SAAS,CAAgB,CAC9B,EACA,EAA0B,QAAQ,IAAI,gBAClB,CACpB,IAAM,EAAQ,GAAK,KAAK,EAAI,EAAM,EAClC,OAAO,GAAO,KAAK,EAAI,EAAmB,CAAK,EAAI,OAI9C,SAAS,CAAQ,CAAC,EAAc,EAAe,EAA4B,CAChF,MAAO,GAAG,IAAO,IAiBnB,eAAsB,CAAkB,CAAC,EAAoC,CAC3E,IAAI,EACJ,GAAI,CACF,EAAM,MAAM,EAAS,EAAK,EAAW,CAAiB,EAAG,MAAM,EAC/D,MAAO,EAAO,CACd,GAAK,GAAiC,OAAS,SAC7C,OAAO,EAET,MAAM,EAER,OAAO,EAAmB,KAAK,MAAM,CAAG,EAAE,SAAS",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "0E5A959D339C8D3C64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Tk as n,Uk as k,Wk as T0}from"./chunk-06w8hhnk.js";import{Xk as S0}from"./chunk-24tj4dzx.js";import{$k as Q0,Zk as N0,_k as R0,bl as D,dl as q,ml as B0}from"./chunk-xgc5tj8k.js";import{Fl as X0}from"./chunk-etcds9w3.js";import{am as W0,dm as m}from"./chunk-vyaedzr8.js";import{mm as M0}from"./chunk-0eq7am78.js";class y{table;sql;dialect;connection;busyTimeout;configured;constructor(z,V={}){let Y=V.table??"gemi_locks";if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(Y))throw Error(`The lock table name "${Y}" is not a plain identifier. Use letters, digits and underscores.`);this.table=Y,this.sql=z.sql,this.dialect=z.dialect,this.connection=z.name,this.busyTimeout=V.busyTimeout??1000}async createTable(){await this.configure();for(let z of v0(this.dialect,this.table))await this.sql.unsafe(z)}async acquire(z,V,Y){await this.configure();let Z=this.sql,$=this.now(Z);if(await this.seed(Z,z),this.mysql){let H=await Z`
|
|
3
3
|
UPDATE ${this.name(Z)}
|
|
4
4
|
SET owner = ${V}, token = token + 1, expires_at = ${$} + ${this.ms(Z,Y)},
|
|
5
5
|
updated_at = ${$}
|
|
@@ -411,6 +411,6 @@ ADD COLUMN IF NOT EXISTS "progress" ${Y}`,`CREATE INDEX IF NOT EXISTS "${V}_batc
|
|
|
411
411
|
}
|
|
412
412
|
};
|
|
413
413
|
`],"worker.ts"),$=URL.createObjectURL(Z);return new Worker($)}async function d0(z,V){let Y=w0();return Y.postMessage({jobName:z,args:V}),await new Promise((Z,$)=>{Y.onmessage=(X)=>{let H=X.data;if("error"in H)$(H.error);else Z(H.result)}})}var c0=new k0("gemi.queue"),l0=60000;class h{static token="queue";jobs={};config;driver;application;inFlight=new Map;state="idle";looping=!1;claiming;woken=!1;claimFailures=0;resume;unsubscribe;heartbeatTimer;releasedNames=new Set;lockManager;workflowRuntime;constructor(z={},V={}){if(this.config=S0(D0(),z),this.application=V.application,this.driver=r0(this.config.driver,this.application),this.useJobs(this.config.jobs),this.config.workflows.length>0)this.useWorkflows(this.config.workflows)}useJobs(z){this.config.jobs=z,this.jobs={};for(let V of z)this.claim(V);this.registerTickJob()}useWorkflows(z){this.config.workflows=z,this.workflows.use(z),this.registerTickJob()}get registeredWorkflows(){return[...this.config.workflows]}get workflows(){return this.workflowRuntime??=new H0(this),this.workflowRuntime}registerTickJob(){if(!this.workflowRuntime||Object.keys(this.workflowRuntime.workflows).length===0)return;let z=this.workflowRuntime.tickJob;if(this.jobs[z.name]&&this.jobs[z.name]!==z){console.error(`A queued job is named "${z.name}", which the workflow runtime uses. Workflows will not run until it is renamed.`);return}this.jobs[z.name]=z}registerJob(z){this.config.jobs=[...this.config.jobs,z],this.claim(z)}claim(z){if(this.jobs[z.name]){console.error(`Two queued jobs are named "${z.name}" \u2014 the first is registered `+"and this one is not, so dispatching either would have run one of them. A class name is the queue's key, so only one job can hold it. Rename one.");return}this.jobs[z.name]=z}get registeredJobs(){return[...this.config.jobs]}dispatchJob(z,V){if(this.jobs[z])return new this.jobs[z]().run(JSON.parse(V))}push(z,V,Y={}){let Z=this.uniqueKey(z,V);if(Z)return this.pushUnique(z,V,Z,Y);let $=this.driver.joinsTransaction?.()===!0;if(!$){let X=Bun.randomUUIDv7();if(D(()=>this.record(z,V,{id:X,reportFailure:!0,committed:!0}).then(()=>{},()=>{})))return Promise.resolve(X)}return this.record(z,V,{reportFailure:Y.reportFailure,joins:$})}pushBatch(z,V,Y={}){let Z=this.buildBatch(z,V,Y),$={id:Z.id,total:V.length},X=this.driver.joinsTransaction?.()===!0;if(!X){if(D(()=>this.recordBatch(Z,{committed:!0}).then(()=>{},()=>{})))return Promise.resolve($)}return this.recordBatch(Z,{joins:X}).then(()=>$)}buildBatch(z,V,Y={}){if(!this.driver.enqueueBatch)throw Error("This queue's driver does not support batches. The memory and database drivers do.");if(new z().worker)throw Error(`${z.name} is a worker job, and a worker job cannot be dispatched in a batch: its thread has no way to report progress or reach the batch.`);if(z.prototype.uniqueId!==S.prototype.uniqueId)throw Error(`${z.name} is unique (it defines uniqueId), and a unique job cannot be dispatched in a batch: a duplicate would resolve to a job outside the batch, and the batch would wait for it forever.`);let $={};for(let X of["then","catch","finally"]){let H=Y[X];if(H===void 0)continue;if(typeof H?.name!=="string"||!Array.isArray(H.args))throw Error(`The batch's ${X} callback is not a job call. Build it with SomeJob.with(...args).`);$[X]={name:H.name,args:H.args}}return{id:Bun.randomUUIDv7(),name:Y.name??null,job:z.name,args:V,allowFailures:Y.allowFailures===!0,callbacks:$}}recordBatch(z,V){let Y=this.driver.enqueueBatch(z);this.startIfIdle();let Z=()=>!this.driver.subscribe&&this.state==="running"&&this.wake(),$=V.joins===!0&&D(Z);return Y.then(()=>$||Z(),(X)=>{if(!V.committed)return;console.error(`[gemi] The queue driver could not record a batch of ${z.job}, which was held until its transaction committed. The transaction stays committed; the batch's jobs did not run and will not be retried.`,X)}),Y}async findBatch(z){if(!this.driver.findBatch)throw Error("This queue's driver does not support batches.");return this.driver.findBatch(z)}async cancelBatch(z){if(!this.driver.cancelBatch)throw Error("This queue's driver does not support batches.");let V=await this.driver.cancelBatch(z);if(V)this.claimSoon();return V}get locks(){return this.lockManager??=new T0(this.resolveLockStore()),this.lockManager}resolveLockStore(){let z=this.config.locks;if(z==="auto"){let V=this.driver.lockStore?.();if(V)return V;if(this.durable)console.warn('[gemi] The queue driver keeps no locks, so unique jobs, withoutOverlapping and onOneServer only hold within this process. Set the queue slice\'s `locks` to "database" or a LockStore.');return new p}if(z==="memory")return new p;if(z==="database"||typeof z==="function"){if(!this.application&&(z==="database"||z.length>0))throw Error("The queue's locks need the application they belong to, and this QueueManager was built without one. Pass { application }.");if(z==="database")return new y(this.application.make(X0));return z(this.application)}if(typeof z==="string")throw Error(`Unknown queue locks "${z}". The queue slice's locks is "auto", "memory", "database", a LockStore, or a function returning one.`);return z}uniqueKey(z,V){if(z.prototype.uniqueId===S.prototype.uniqueId)return;let Y=new z,Z=Y.uniqueId(...JSON.parse(V));if(Z===void 0||Z===null||Z==="")return;return{key:L0(z.name,Z),ttl:Math.max(1,Y.uniqueFor)}}pushUnique(z,V,Y,Z){let $=Bun.randomUUIDv7();if(D(()=>this.recordUnique(z,V,Y,$,{report:!0,committed:!0}).then(()=>{},()=>{})))return Promise.resolve($);return this.recordUnique(z,V,Y,$,{report:Z.reportFailure!==!1,committed:!1})}recordUnique(z,V,Y,Z,$){let X=this.locks.store,H=(async()=>{for(let G=0;G<5;G++){if(await X.acquire(Y.key,Z,Y.ttl)!==null)try{return await this.record(z,V,{id:Z,reportFailure:!1})}catch(B){throw await X.release(Y.key,Z).catch(()=>{}),B}let Q=await X.holder(Y.key);if(Q)return Q.owner}throw Error(`The unique key "${Y.key}" kept changing hands, so ${z.name} was not queued.`)})();return H.catch((G)=>{if(!$.report)return;console.error(`[gemi] The queue could not record the unique job ${z.name}`+($.committed?", which was held until its transaction committed. The transaction stays committed; the job did not run and will not be retried.":", so it did not run and will not be retried."),G)}),H}async releaseUnique(z,V,Y){if(z.uniqueId===S.prototype.uniqueId)return;try{let Z=z.uniqueId(...V);if(Z===void 0||Z===null||Z==="")return;await this.locks.store.release(L0(Y.name,Z),Y.id)}catch(Z){console.error(`[gemi] Could not free the unique key of ${Y.name} (${Y.id}); it frees itself after uniqueFor.`,Z)}}record(z,V,Y){let Z=this.driver.enqueue({name:z.name,args:V,...Y.id===void 0?{}:{id:Y.id}});this.startIfIdle();let $=()=>!this.driver.subscribe&&this.state==="running"&&this.wake(),X=Y.joins===!0&&D($);return Z.then(()=>X||$(),(H)=>{if(Y.reportFailure===!1)return;console.error(`[gemi] The queue driver could not record ${z.name}`+(Y.committed?", which was held until its transaction committed. The transaction stays committed; the job did not run and will not be retried.":", so it did not run and will not be retried."),H)}),Z}async retryDead(z){if(!this.driver.retryDead)throw Error("This queue's driver keeps nothing of a dead-lettered job, so there is nothing to retry. The database driver keeps them.");let V=await this.driver.retryDead(z);if(V)this.claimSoon();return V}startIfIdle(){if(this.state==="idle"&&(!this.durable||this.mayClaimHere()))this.start()}claimSoon(){if(this.startIfIdle(),!this.driver.subscribe&&this.state==="running")this.wake()}start(){if(this.state==="running")return;if(this.state="running",this.durable&&this.application&&this.mayClaimHere()&&!i0())globalThis.__gemiDevQueue=this;if(this.unsubscribe=this.driver.subscribe?.(()=>this.wake()),this.looping)return this.wake();c0.runInAsyncScope(()=>void this.loop())}async drain(z=1/0){if(this.state="stopped",globalThis.__gemiDevQueue===this)globalThis.__gemiDevQueue=void 0;this.unsubscribe?.(),this.unsubscribe=void 0,this.wake();let V,Y=new Promise(($)=>{if(z!==1/0)V=setTimeout($,z)}),Z=(async()=>{await this.claiming?.catch(()=>{}),await Promise.allSettled([...this.inFlight.values()].map(($)=>$.done))})();return await Promise.race([Z,Y]),clearTimeout(V),{unfinished:[...this.inFlight.values()].map(($)=>({...$.job}))}}stop(){return this.drain(0)}get running(){return this.inFlight.size}async loop(){this.looping=!0;try{await this.claimWhileRunning()}finally{this.looping=!1}}async claimWhileRunning(){while(this.state==="running"){let z=this.durable&&M0()?0:this.config.concurrency-this.inFlight.size;if(z>0){this.woken=!1;let V=this.driver.claim(z,{...this.lease(),registered:{names:Object.keys(this.jobs),graceMs:this.config.unknownJobGrace}});this.claiming=V;let Y=[];try{Y=await V,this.claimFailures=0}catch(Z){this.claimFailures++,console.error(`The queue could not claim jobs from its driver; it will try again in ${this.retryDelay()}ms.`,Z)}finally{this.claiming=void 0}for(let Z of Y)this.execute(Z);if(Y.length===z)continue;if(this.woken&&this.inFlight.size<this.config.concurrency)continue}await this.sleep()}}sleep(){return new Promise((z)=>{let V,Y=this.claimFailures>0?this.retryDelay():this.driver.subscribe?void 0:this.config.pollInterval;if(Y!==void 0)V=setTimeout(()=>this.wake(),Y),V.unref?.();this.resume=()=>{clearTimeout(V),z()}})}retryDelay(){let z=Math.min(Math.max(0,this.claimFailures-1),30);return Math.min(this.config.pollInterval*2**z,l0)}wake(){this.woken=!0;let z=this.resume;this.resume=void 0,z?.()}get durable(){return!(this.driver instanceof i)}mayClaimHere(){return!this.application||s0()}lease(){return{visibilityTimeoutMs:this.config.visibilityTimeout}}execute(z){let V=`${z.id}:${z.attempt}`,Y=()=>this.run(z),Z=(this.application?W0.run(this.application,Y):Y()).catch(($)=>{console.error(`The queue could not record the outcome of ${z.name}.`,$)}).finally(()=>{this.inFlight.delete(V),this.wake()});this.inFlight.set(V,{job:z,done:Z}),this.heartbeat()}heartbeat(){let z=this.driver;if(!z.heartbeat||this.heartbeatTimer)return;this.heartbeatTimer=setInterval(()=>{if(this.inFlight.size===0){clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0;return}let V=[...this.inFlight.values()].map((Y)=>Y.job);z.heartbeat(V,this.lease()).catch((Y)=>{console.error("The queue could not extend its job leases.",Y)})},Math.max(1,Math.floor(this.config.visibilityTimeout/3))),this.heartbeatTimer.unref?.()}async run(z){let V=this.jobs[z.name];if(!V){let B=Date.now()-z.createdAt;if(this.durable&&B<this.config.unknownJobGrace){if(!this.releasedNames.has(z.name))this.releasedNames.add(z.name),console.error(`Left a queued "${z.name}" for another replica: nothing is registered here under that name. It is dead-lettered if no replica has run it within unknownJobGrace (${this.config.unknownJobGrace}ms) of its dispatch.`);await this.driver.release(z,{retryInMs:Math.round(this.config.pollInterval*(1+Math.random()))});return}console.error(`Dropped a queued job: nothing is registered under the name "${z.name}". If the class exists, it was not `+"discovered \u2014 check that it is under the queue slice's jobsDir "+"(app/jobs by default), or list it in app/config/queue.ts."),await this.driver.fail(z,{error:`No job is registered under the name "${z.name}".`,retryInMs:null});return}let Y;try{Y=new V}catch(B){console.error(`Dropped a queued ${z.name}: it could not be constructed.`,B),await this.driver.fail(z,{error:`The job could not be constructed: ${String(B)}`,retryInMs:null});return}let Z;try{Z=JSON.parse(z.args)}catch(B){console.error(`Dropped a queued ${z.name}: its arguments are not JSON.`,B),await this.driver.fail(z,{error:`The arguments are not JSON: ${String(B)}`,retryInMs:null});return}if(z.attempt>Math.max(1,Y.maxAttempts)){let B=Error(`${z.name} was claimed for attempt ${z.attempt} of ${Y.maxAttempts}: an earlier attempt never finished, most likely because the process running it exited. Dead-lettered without running it again.`);$0(`${z.name}.onDeadletter`,()=>Y.onDeadletter(B,...Z)),await this.driver.fail(z,{error:B.message,retryInMs:null}),await this.releaseUnique(Y,Z,z);return}if(Y.$claimed={...z},z.batchId!==void 0){if((await this.driver.findBatch?.(z.batchId,{progress:!1}))?.cancelledAt!=null){await this.driver.fail(z,{error:"Its batch was cancelled before it ran.",retryInMs:null,cancelled:!0});return}let K=this.batchHandle(z);Y.batch=K.batch,Y.$progress=K.progress}let $=await this.admit(Y,Z,z);if(!$)return;let X,H;try{H=await(Y.worker?d0(z.name,z.args):Y.run(...Z))}catch(B){X=B}finally{await $.done()}let G=Y.$outcome;if(X===void 0&&G?.kind==="release"){await this.driver.release(z,{retryInMs:Math.max(0,G.delayMs)});return}if(X===void 0&&G?.kind==="fail")X=G.error;let Q=G?.kind==="fail"?G.retry:!0;if(X===void 0)try{Y.onSuccess(H,...Z)}catch(B){X=B}if(X!==void 0){let B=String(X?.stack??X);if($0(`${z.name}.onFail`,()=>Y.onFail(X,...Z)),!Q||z.attempt>=Y.maxAttempts)$0(`${z.name}.onDeadletter`,()=>Y.onDeadletter(X,...Z)),await this.driver.fail(z,{error:B,retryInMs:null}),await this.releaseUnique(Y,Z,z);else await this.driver.fail(z,{error:B,retryInMs:s(Y.backoff,z.attempt)});return}await this.driver.complete(z),await this.releaseUnique(Y,Z,z)}batchHandle(z){let V=z.batchId,Y=this.driver;return{batch:{id:V,cancelled:async()=>(await Y.findBatch?.(V,{progress:!1}))?.cancelledAt!=null},progress:(Z)=>Y.reportProgress?.(z,Z)??Promise.resolve()}}async admit(z,V,Y){let Z=z.concurrency(...V),$=[z.throttle(...V)??[]].flat();if(!Z&&$.length===0)return{done:async()=>{}};let X=this.locks,H;if(Z&&Z.limit>0){let Q=this.config.visibilityTimeout;for(let B=0;B<Z.limit&&!H;B++)H=await X.acquire(`gemi:concurrency:${Z.key}:${B}`,{ttl:Q,renew:!0})??void 0;if(!H){await this.driver.release(Y,{retryInMs:Math.round(this.config.pollInterval*(1+Math.random()))});return}}let G=[];for(let Q of $){let B=`gemi:throttle:${Q.key}`,K=await X.store.hit(B,Q.limit,Q.window);if(!K.allowed){await Promise.all(G.map((A)=>X.store.refund(A))),await H?.release(),await this.driver.release(Y,{retryInMs:Math.max(1,K.resetInMs)});return}G.push(B)}return{done:async()=>{await H?.release().catch((Q)=>{console.error(`[gemi] Could not free a concurrency slot of ${Y.name}.`,Q)})}}}}function L0(z,V){return`gemi:job:${z}:${String(V)}`}function $0(z,V){try{V()}catch(Y){console.error(`${z} threw; the job's claim was ended anyway.`,Y)}}function i0(){return Bun.env.NODE_ENV==="production"}function s0(){if(!p0)return!1;if(a0())return!0;return process.env.ROOT_DIR!==void 0&&!n0()}function n0(z=process.env){return(z.GEMI_QUEUE_CLAIM??"").trim().toLowerCase()==="off"}var x0=Symbol.for("gemi.queue.worker");function cz(z=!0){globalThis[x0]=z}function a0(){return globalThis[x0]===!0}function r0(z,V){if(z==="memory")return new i;if(z==="database"||typeof z==="function"){if(!V&&(z==="database"||z.length>0))throw Error("The queue driver needs the application it belongs to, and this QueueManager was built without one. Pass { application }.");if(z==="database")return new z0(V.make(X0));return z(V)}if(typeof z==="string")throw Error(`Unknown queue driver "${z}". The queue slice's driver is "memory", "database", a QueueDriver, or a function returning one.`);return z}class S{static name="unset";worker=!1;maxAttempts=3;backoff=0;uniqueId(...z){return}uniqueFor=3600000;throttle(...z){return}concurrency(...z){return}release(z=0){this.$outcome={kind:"release",delayMs:z}}fail(z,V={}){this.$outcome={kind:"fail",error:z instanceof Error?z:Error(String(z)),retry:V.retry??!0}}batch=void 0;async progress(z){let V=E(z);await this.$progress?.(V)}$progress;$claimed;$outcome;run(...z){}onFail(z,...V){}onSuccess(z,...V){}onDeadletter(z,...V){}static dispatch(...z){if(this.name==="unset")throw Error("Cannot dispatch a job with no name");return m(h).push(this,JSON.stringify(z))}static dispatchBatch(z,V={}){if(this.name==="unset")throw Error("Cannot dispatch a job with no name");return m(h).pushBatch(this,z.map((Y)=>JSON.stringify(Y)),V)}static with(...z){if(this.name==="unset")throw Error("Cannot use a job with no name as a callback");return JSON.stringify(z),{name:this.name,args:z}}static findBatch(z){return m(h).findBatch(z)}static cancelBatch(z){return m(h).cancelBatch(z)}}var r=["completed","failed","cancelled"],t0=1000;class H0{queue;registry={};storeInstance;tickClass;reportedNames=new Set;constructor(z){this.queue=z}get workflows(){return this.registry}use(z){this.registry={};for(let V of z){if(V.name==="unset"||!V.name){console.error("A workflow class has no `static name`, so it was not registered. Add one.");continue}if(this.registry[V.name]){console.error(`Two workflows are named "${V.name}" \u2014 the first is registered `+"and this one is not. A workflow's name is its key in storage. Rename one.");continue}this.registry[V.name]=V}}get tickJob(){return this.tickClass??=o0(this),this.tickClass}get store(){if(!this.storeInstance){let z=this.queue.driver.workflowStore?.();if(!z||!this.queue.driver.enqueueBatch)throw Error("This queue's driver does not support workflows. The memory and database drivers do.");this.storeInstance=z}return this.storeInstance}start(z,V){if(z.name==="unset"||!z.name)throw Error("Cannot start a workflow with no name");let Y=this.store,Z={id:Bun.randomUUIDv7(),name:z.name,args:u(V,`The arguments of ${z.name}`)??"[]"},$=()=>this.queue.claimSoon(),X=Y.joinsTransaction?.()===!0;if(!X){if(D(()=>Y.create(Z).then($,(B)=>{console.error(`[gemi] The queue could not record the workflow ${z.name}, which was held until its transaction committed. The transaction stays committed; the workflow did not start.`,B)})))return Promise.resolve(Z.id)}let H=Y.create(Z),G=X&&D($);return H.then(()=>{if(!G)$();return Z.id})}async signal(z,V,Y){if(typeof V!=="string"||V.length===0||V.length>191)throw TypeError("A signal key is a string of 1 to 191 characters.");let Z=u(Y,`The payload of signal "${V}"`),$=await this.store.update(z,{key:V},({workflow:X,step:H,now:G})=>{if(r.includes(X.status)||X.status==="cancelling")return{result:!1};if(!H)return{result:!0,step:{workflowId:z,key:V,status:"signalled",attempt:0,output:Z,error:null,batchId:null,wakeAt:null,startedAt:null,finishedAt:G,createdAt:G,updatedAt:G}};if(H.status!=="waiting")return{result:!1};return{result:!0,step:{...H,status:"signalled",output:Z,wakeAt:H.wakeAt,finishedAt:G},tick:{delayMs:0}}});if($)this.queue.claimSoon();return $===!0}async cancel(z){let V=await this.store.update(z,{allSteps:!0},({workflow:Y,steps:Z})=>{if(r.includes(Y.status)||Y.status==="cancelling")return{result:!1};return{result:!0,workflow:{status:"cancelling"},cancelBatches:Z.filter(($)=>$.status==="batching"&&$.batchId!==null).map(($)=>$.batchId),tick:{delayMs:0}}});if(V)this.queue.claimSoon();return V===!0}async find(z){let V=await this.store.find(z);if(!V)return null;let{workflow:Y,steps:Z}=V,$=[];try{$=JSON.parse(Y.args)}catch{}return{id:Y.id,name:Y.name,status:Y.status,args:$,currentStep:Y.currentStep,progress:Y.progress,result:e0(Y.result),error:Y.error,steps:await Promise.all(Z.map(async(X)=>{let H={key:X.key,status:X.status,attempt:X.attempt,error:X.error,batchId:X.batchId,wakeAt:X.wakeAt,startedAt:X.startedAt,finishedAt:X.finishedAt};if(X.batchId===null)return H;let G=await this.queue.driver.findBatch?.(X.batchId);return G?{...H,progress:G.progress}:H})),createdAt:Y.createdAt,updatedAt:Y.updatedAt}}async tick(z,V){let Y=this.store,Z=V.$claimed,$=Z?`${Z.id}:${Z.attempt}`:`${crypto.randomUUID()}:1`,X=Math.max(1,this.queue.config.visibilityTimeout),H=await Y.acquire(z,$,X);if(H.kind!=="acquired")return;let{workflow:G}=H,Q=(J={})=>Y.update(z,{owner:$},()=>({...J,result:void 0,unlock:!0})).then(()=>this.queue.claimSoon()).catch((P)=>{if(!(P instanceof R))throw P});if(r.includes(G.status))return Q();let B=this.registry[G.name];if(!B)return this.unknown(G,V,Q);let K;try{K=JSON.parse(G.args)}catch(J){return Q({workflow:{status:"failed",error:`The arguments are not JSON: ${a(J)}`}})}let A=setInterval(()=>{Y.renew(z,$,X).catch((J)=>{console.error(`[gemi] Could not extend the hold on workflow ${z}.`,J)})},Math.max(1,Math.floor(X/3)));A.unref?.();let U=G.status==="cancelling",F=new Z0({workflowId:z,owner:$,store:Y,steps:H.steps,cancelling:U,findBatch:(J)=>this.queue.driver.findBatch?.(J,{progress:!1})??Promise.resolve(null),buildBatch:(J,P,N)=>this.queue.buildBatch(J,P.map((C)=>JSON.stringify(C)),{name:N.name,allowFailures:N.allowFailures,finally:{name:I,args:[z]}}),scheduled:()=>this.queue.claimSoon(),cancelCheckMs:t0});try{let J;try{let P=new B,N=await(U?P.onCancel(F,...K):P.run(F,...K));J=F.suspension?{kind:"suspended"}:{kind:"completed",result:U?null:u(N,`The result of ${G.name}`)}}catch(P){if(J=F.suspension||P instanceof g?{kind:"suspended"}:{kind:"failed",error:a(P)},P instanceof R)F.lost=!0}if(await F.settled(),F.lost)return;if(J.kind==="completed"&&F.suspension)J={kind:"suspended"};await Y.update(z,{owner:$},({workflow:P,now:N})=>this.finish(P,J,F,U,N)),this.queue.claimSoon()}catch(J){if(J instanceof R)return;throw J}finally{clearInterval(A)}}finish(z,V,Y,Z,$){let X={result:void 0,unlock:!0};if(z.status==="cancelling"&&!Z)return{...X,tick:{delayMs:0}};if(V.kind==="completed")return{...X,workflow:Z?{status:"cancelled",currentStep:null,wakeAt:null}:{status:"completed",result:V.result,progress:1,currentStep:null,wakeAt:null,error:null}};if(V.kind==="failed")return{...X,workflow:{status:Z?"cancelled":"failed",error:V.error,wakeAt:null}};let H=Y.suspension??{status:"waiting",wakes:[]},G={...X,workflow:{status:Z?"cancelling":H.status,currentStep:Y.current??z.currentStep}};if(H.wakes.length>0){let Q=Math.min(...H.wakes);if(!(z.wakeAt!==null&&z.wakeAt>$&&z.wakeAt<=Q))G.tick={delayMs:Math.max(0,Q-$)},G.workflow.wakeAt=Q}return G}async unknown(z,V,Y){let Z=Date.now()-z.createdAt;if(this.queue.durable&&Z<this.queue.config.unknownJobGrace){if(!this.reportedNames.has(z.name))this.reportedNames.add(z.name),console.error(`Left workflow "${z.name}" for another replica: nothing is registered here under that name.`);await Y(),V.release(Math.round(this.queue.config.pollInterval*(1+Math.random())));return}console.error(`Failed workflow ${z.id}: nothing is registered under the name "${z.name}". If the class exists, it was not discovered: check that it is under the queue slice's workflowsDir (app/workflows by default), or list it in app/config/queue.ts.`),await Y({workflow:{status:"failed",error:`No workflow is registered under the name "${z.name}".`}})}tickDeadLettered(z,V){console.error(`[gemi] The tick of workflow ${z} was dead-lettered.`,V),this.store.update(z,{},({workflow:Y})=>r.includes(Y.status)?{result:void 0}:{result:void 0,workflow:{status:"failed",error:`Its tick job was dead-lettered: ${V.message}`},unlock:!0}).catch(()=>{})}}function o0(z){return class extends S{static name=I;maxAttempts=20;backoff=[1000,5000,15000,30000,60000];async run(Y){await z.tick(Y,this)}onDeadletter(Y,Z){z.tickDeadLettered(Z,Y)}}}function e0(z){try{return _(z)}catch{return z}}
|
|
414
|
-
export{y as
|
|
414
|
+
export{y as oe,p as pe,o as qe,U0 as re,z0 as se,Az as te,D0 as ue,V0 as ve,i as we,I0 as xe,Y0 as ye,E0 as ze,O0 as Ae,Z0 as Be,H0 as Ce,h as De,s0 as Ee,n0 as Fe,cz as Ge,a0 as He,S as Ie};
|
|
415
415
|
|
|
416
|
-
//# debugId=
|
|
416
|
+
//# debugId=3E5053F15860D3B064756E2164756E21
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
"import { deferUntilCommit } from \"../../../orm/context\";\nimport { Job } from \"../Job\";\nimport type { QueueManager } from \"../QueueManager\";\nimport {\n Step,\n WorkflowSuspended,\n decode,\n describe,\n encode,\n} from \"./Step\";\nimport type { WorkflowClass, WorkflowStatus } from \"./Workflow\";\nimport {\n WORKFLOW_TICK_JOB,\n type WorkflowChange,\n WorkflowLeaseLostError,\n type WorkflowRecord,\n type WorkflowRunStatus,\n type WorkflowStore,\n} from \"./WorkflowStore\";\n\nconst ENDED: readonly WorkflowRunStatus[] = [\"completed\", \"failed\", \"cancelled\"];\n\n/** How often a running `step.run` checks whether its workflow was cancelled. */\nconst CANCEL_CHECK_MS = 1000;\n\ntype Outcome =\n | { kind: \"completed\"; result: string | null }\n | { kind: \"failed\"; error: string }\n | { kind: \"suspended\" };\n\n/**\n * The queue's half of workflows: the registry of workflow classes, what\n * `Workflow.start`, `signal`, `find` and `cancel` do, and the tick.\n *\n * ### The tick\n *\n * A workflow advances only inside its tick job, which takes the workflow\n * from the store for a lease (the queue's `visibilityTimeout`, renewed while\n * it runs), runs one pass of `run`, and lets go with the outcome written in\n * the same step. Every write of the pass is fenced by that hold, so a tick\n * that lost it (it was too slow and another took over) changes nothing.\n *\n * A tick that finds the workflow held by another is dropped, after marking\n * the workflow so the holder enqueues a fresh tick when it lets go: a signal\n * that lands mid-pass is never lost, and two passes of one workflow never\n * overlap. A tick that failed or died holds the workflow under its job's id,\n * so its own retry takes it straight back.\n */\nexport class WorkflowRuntime {\n private registry: Record<string, WorkflowClass> = {};\n private storeInstance: WorkflowStore | undefined;\n private tickClass: (new () => Job) | undefined;\n private readonly reportedNames = new Set<string>();\n\n constructor(private readonly queue: QueueManager) {}\n\n /** The workflow classes this process can run, by `static name`. */\n get workflows(): Readonly<Record<string, WorkflowClass>> {\n return this.registry;\n }\n\n /** Replaces the registry. The first class to claim a name wins. */\n use(workflows: readonly WorkflowClass[]) {\n this.registry = {};\n for (const workflow of workflows) {\n if (workflow.name === \"unset\" || !workflow.name) {\n console.error(\n `A workflow class has no \\`static name\\`, so it was not registered. Add one.`,\n );\n continue;\n }\n if (this.registry[workflow.name]) {\n console.error(\n `Two workflows are named \"${workflow.name}\" — the first is registered ` +\n `and this one is not. A workflow's name is its key in storage. Rename one.`,\n );\n continue;\n }\n this.registry[workflow.name] = workflow;\n }\n }\n\n /** The internal job a workflow's passes run in, one class per manager. */\n get tickJob(): new () => Job {\n this.tickClass ??= tickJobFor(this);\n return this.tickClass;\n }\n\n get store(): WorkflowStore {\n if (!this.storeInstance) {\n const store = this.queue.driver.workflowStore?.();\n if (!store || !this.queue.driver.enqueueBatch) {\n throw new Error(\n `This queue's driver does not support workflows. The memory and ` +\n `database drivers do.`,\n );\n }\n this.storeInstance = store;\n }\n return this.storeInstance;\n }\n\n start(workflow: WorkflowClass, args: unknown[]): Promise<string> {\n if (workflow.name === \"unset\" || !workflow.name) {\n throw new Error(\"Cannot start a workflow with no name\");\n }\n const store = this.store;\n const record = {\n id: Bun.randomUUIDv7(),\n name: workflow.name,\n args: encode(args, `The arguments of ${workflow.name}`) ?? \"[]\",\n };\n const wake = () => this.queue.claimSoon();\n\n // As `QueueManager.push`: on the caller's transaction when the store\n // joins it, otherwise held until it commits.\n const joins = store.joinsTransaction?.() === true;\n if (!joins) {\n const held = deferUntilCommit(() =>\n store.create(record).then(wake, (error: unknown) => {\n console.error(\n `[gemi] The queue could not record the workflow ${workflow.name}, which ` +\n `was held until its transaction committed. The transaction stays ` +\n `committed; the workflow did not start.`,\n error,\n );\n }),\n );\n if (held) return Promise.resolve(record.id);\n }\n const written = store.create(record);\n const wakeAtCommit = joins && deferUntilCommit(wake);\n return written.then(() => {\n if (!wakeAtCommit) wake();\n return record.id;\n });\n }\n\n async signal(id: string, key: string, payload?: unknown): Promise<boolean> {\n if (typeof key !== \"string\" || key.length === 0 || key.length > 191) {\n throw new TypeError(`A signal key is a string of 1 to 191 characters.`);\n }\n const output = encode(payload, `The payload of signal \"${key}\"`);\n const taken = await this.store.update(id, { key }, ({ workflow, step, now }) => {\n if (ENDED.includes(workflow.status) || workflow.status === \"cancelling\") {\n return { result: false };\n }\n if (!step) {\n return {\n result: true,\n step: {\n workflowId: id,\n key,\n status: \"signalled\",\n attempt: 0,\n output,\n error: null,\n batchId: null,\n wakeAt: null,\n startedAt: null,\n finishedAt: now,\n createdAt: now,\n updatedAt: now,\n },\n };\n }\n if (step.status !== \"waiting\") return { result: false };\n return {\n result: true,\n step: { ...step, status: \"signalled\", output, wakeAt: step.wakeAt, finishedAt: now },\n tick: { delayMs: 0 },\n };\n });\n if (taken) this.queue.claimSoon();\n return taken === true;\n }\n\n async cancel(id: string): Promise<boolean> {\n const cancelled = await this.store.update(id, { allSteps: true }, ({ workflow, steps }) => {\n if (ENDED.includes(workflow.status) || workflow.status === \"cancelling\") {\n return { result: false };\n }\n return {\n result: true,\n workflow: { status: \"cancelling\" },\n cancelBatches: steps\n .filter((step) => step.status === \"batching\" && step.batchId !== null)\n .map((step) => step.batchId!),\n tick: { delayMs: 0 },\n };\n });\n if (cancelled) this.queue.claimSoon();\n return cancelled === true;\n }\n\n async find(id: string): Promise<WorkflowStatus | null> {\n const state = await this.store.find(id);\n if (!state) return null;\n const { workflow, steps } = state;\n let args: unknown[] = [];\n try {\n args = JSON.parse(workflow.args) as unknown[];\n } catch {}\n return {\n id: workflow.id,\n name: workflow.name,\n status: workflow.status,\n args,\n currentStep: workflow.currentStep,\n progress: workflow.progress,\n result: safeDecode(workflow.result),\n error: workflow.error,\n steps: await Promise.all(\n steps.map(async (step) => {\n const status = {\n key: step.key,\n status: step.status,\n attempt: step.attempt,\n error: step.error,\n batchId: step.batchId,\n wakeAt: step.wakeAt,\n startedAt: step.startedAt,\n finishedAt: step.finishedAt,\n };\n if (step.batchId === null) return status;\n const batch = await this.queue.driver.findBatch?.(step.batchId);\n return batch ? { ...status, progress: batch.progress } : status;\n }),\n ),\n createdAt: workflow.createdAt,\n updatedAt: workflow.updatedAt,\n };\n }\n\n /** One pass of the workflow `id`, run by its tick job. */\n async tick(id: string, job: Job): Promise<void> {\n const store = this.store;\n const claimed = job.$claimed;\n const owner = claimed\n ? `${claimed.id}:${claimed.attempt}`\n : `${crypto.randomUUID()}:1`;\n const lease = Math.max(1, this.queue.config.visibilityTimeout);\n const acquired = await store.acquire(id, owner, lease);\n if (acquired.kind !== \"acquired\") return;\n const { workflow } = acquired;\n\n const letGo = (change: Partial<WorkflowChange<undefined>> = {}) =>\n store\n .update(id, { owner }, () => ({ ...change, result: undefined, unlock: true }))\n .then(() => this.queue.claimSoon())\n .catch((error) => {\n if (!(error instanceof WorkflowLeaseLostError)) throw error;\n });\n\n if (ENDED.includes(workflow.status)) return letGo();\n\n const Class = this.registry[workflow.name];\n if (!Class) return this.unknown(workflow, job, letGo);\n\n let args: unknown[];\n try {\n args = JSON.parse(workflow.args) as unknown[];\n } catch (error) {\n return letGo({\n workflow: { status: \"failed\", error: `The arguments are not JSON: ${describe(error)}` },\n });\n }\n\n const renew = setInterval(\n () => {\n store.renew(id, owner, lease).catch((error) => {\n console.error(`[gemi] Could not extend the hold on workflow ${id}.`, error);\n });\n },\n Math.max(1, Math.floor(lease / 3)),\n );\n renew.unref?.();\n\n const cancelling = workflow.status === \"cancelling\";\n const step = new Step({\n workflowId: id,\n owner,\n store,\n steps: acquired.steps,\n cancelling,\n findBatch: (batchId) =>\n this.queue.driver.findBatch?.(batchId, { progress: false }) ?? Promise.resolve(null),\n buildBatch: (batchJob, tuples, options) =>\n this.queue.buildBatch(\n batchJob,\n tuples.map((tuple) => JSON.stringify(tuple)),\n {\n name: options.name,\n allowFailures: options.allowFailures,\n finally: { name: WORKFLOW_TICK_JOB, args: [id] },\n },\n ),\n scheduled: () => this.queue.claimSoon(),\n cancelCheckMs: CANCEL_CHECK_MS,\n });\n\n try {\n let outcome: Outcome;\n try {\n const instance = new Class();\n const value = await (cancelling\n ? instance.onCancel(step, ...args)\n : instance.run(step, ...args));\n outcome = step.suspension\n ? { kind: \"suspended\" }\n : {\n kind: \"completed\",\n result: cancelling ? null : encode(value, `The result of ${workflow.name}`),\n };\n } catch (error) {\n outcome =\n step.suspension || error instanceof WorkflowSuspended\n ? { kind: \"suspended\" }\n : { kind: \"failed\", error: describe(error) };\n if (error instanceof WorkflowLeaseLostError) step.lost = true;\n }\n // A step the code did not await (or one that ran beside a sleep in a\n // `Promise.all`) is still writing; it finishes inside this pass.\n await step.settled();\n if (step.lost) return;\n // One of those suspended the workflow after `run` had returned: it is\n // not done until that step is.\n if (outcome.kind === \"completed\" && step.suspension) outcome = { kind: \"suspended\" };\n\n await store.update(id, { owner }, ({ workflow: current, now }) =>\n this.finish(current, outcome, step, cancelling, now),\n );\n this.queue.claimSoon();\n } catch (error) {\n if (error instanceof WorkflowLeaseLostError) return;\n throw error;\n } finally {\n clearInterval(renew);\n }\n }\n\n /** The tick's last write: the pass's outcome, and letting go. */\n private finish(\n current: WorkflowRecord,\n outcome: Outcome,\n step: Step,\n cancelling: boolean,\n now: number,\n ): WorkflowChange<undefined> {\n const change: WorkflowChange<undefined> = { result: undefined, unlock: true };\n\n // Cancelled during this pass of `run`: `onCancel` is next, whatever the\n // pass came to.\n if (current.status === \"cancelling\" && !cancelling) {\n return { ...change, tick: { delayMs: 0 } };\n }\n\n if (outcome.kind === \"completed\") {\n return {\n ...change,\n workflow: cancelling\n ? { status: \"cancelled\", currentStep: null, wakeAt: null }\n : {\n status: \"completed\",\n result: outcome.result,\n progress: 1,\n currentStep: null,\n wakeAt: null,\n error: null,\n },\n };\n }\n if (outcome.kind === \"failed\") {\n return {\n ...change,\n workflow: { status: cancelling ? \"cancelled\" : \"failed\", error: outcome.error, wakeAt: null },\n };\n }\n\n const suspension = step.suspension ?? { status: \"waiting\" as const, wakes: [] };\n const next: WorkflowChange<undefined> = {\n ...change,\n workflow: {\n status: cancelling ? \"cancelling\" : suspension.status,\n currentStep: step.current ?? current.currentStep,\n },\n };\n if (suspension.wakes.length > 0) {\n const wakeAt = Math.min(...suspension.wakes);\n // A tick already scheduled no later than this one wakes the workflow\n // in time, and schedules this one itself; a second would only run the\n // pass twice.\n const scheduled =\n current.wakeAt !== null && current.wakeAt > now && current.wakeAt <= wakeAt;\n if (!scheduled) {\n next.tick = { delayMs: Math.max(0, wakeAt - now) };\n next.workflow!.wakeAt = wakeAt;\n }\n }\n return next;\n }\n\n /**\n * A tick for a workflow this process has no class for. During a\n * blue/green ramp that is usually one only the other release has, so on a\n * shared driver it goes back for another replica until `unknownJobGrace`\n * has passed since the workflow started; then it fails.\n */\n private async unknown(\n workflow: WorkflowRecord,\n job: Job,\n letGo: (change?: Partial<WorkflowChange<undefined>>) => Promise<void>,\n ) {\n const age = Date.now() - workflow.createdAt;\n if (this.queue.durable && age < this.queue.config.unknownJobGrace) {\n if (!this.reportedNames.has(workflow.name)) {\n this.reportedNames.add(workflow.name);\n console.error(\n `Left workflow \"${workflow.name}\" for another replica: nothing is ` +\n `registered here under that name.`,\n );\n }\n await letGo();\n job.release(Math.round(this.queue.config.pollInterval * (1 + Math.random())));\n return;\n }\n console.error(\n `Failed workflow ${workflow.id}: nothing is registered under the name ` +\n `\"${workflow.name}\". If the class exists, it was not discovered: check ` +\n `that it is under the queue slice's workflowsDir (app/workflows by ` +\n `default), or list it in app/config/queue.ts.`,\n );\n await letGo({\n workflow: {\n status: \"failed\",\n error: `No workflow is registered under the name \"${workflow.name}\".`,\n },\n });\n }\n\n /**\n * The tick job ran out of attempts, which only a store that stayed\n * unreachable causes. Fails the workflow if it still can, so it does not\n * sit in `running` with nothing left to advance it.\n */\n /** @internal */\n tickDeadLettered(id: string, error: Error) {\n console.error(`[gemi] The tick of workflow ${id} was dead-lettered.`, error);\n void this.store\n .update(id, {}, ({ workflow }) =>\n ENDED.includes(workflow.status)\n ? { result: undefined }\n : {\n result: undefined,\n workflow: {\n status: \"failed\",\n error: `Its tick job was dead-lettered: ${error.message}`,\n },\n unlock: true,\n },\n )\n .catch(() => {});\n }\n}\n\n/** The internal job a workflow's passes run in, bound to one runtime. */\nfunction tickJobFor(runtime: WorkflowRuntime): new () => Job {\n return class WorkflowTickJob extends Job {\n static name = WORKFLOW_TICK_JOB;\n // A tick fails only when the store cannot be reached (a workflow's own\n // errors are recorded, not thrown), so it keeps trying for a while rather\n // than leaving the workflow stuck.\n maxAttempts = 20;\n backoff = [1000, 5000, 15000, 30000, 60000];\n async run(id: string) {\n await runtime.tick(id, this);\n }\n onDeadletter(error: Error, id: string) {\n runtime.tickDeadLettered(id, error);\n }\n };\n}\n\nfunction safeDecode(output: string | null): unknown {\n try {\n return decode(output);\n } catch {\n return output;\n }\n}\n"
|
|
19
19
|
],
|
|
20
20
|
"mappings": ";6VAuCO,AAAM,LAAuC,LACzC,AACQ,FACA,QACA,WACA,YACT,WAER,WAAW,CACT,EAEA,EAAoC,CAAC,EACrC,CACA,IAAM,EAAQ,EAAQ,OAAS,aAC/B,GAAI,CAAC,2BAA2B,KAAK,CAAK,EACxC,MAAU,MACR,wBAAwB,oEAE1B,EAEF,KAAK,MAAQ,EACb,KAAK,IAAM,EAAW,IACtB,KAAK,QAAU,EAAW,QAC1B,KAAK,WAAa,EAAW,KAC7B,KAAK,YAAc,EAAQ,aAAe,UAItC,YAAW,EAAkB,CACjC,MAAM,KAAK,UAAU,EACrB,QAAW,KAAa,GAA0B,KAAK,QAAS,KAAK,K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EAAE,CAAC,EAC5E,OAEF,QAAQ,MACN,mBAAmB,EAAS,6CACtB,EAAS,yKAGjB,EACA,MAAM,EAAM,CACV,SAAU,CACR,OAAQ,SACR,MAAO,6CAA6C,EAAS,QAC/D,CACF,CAAC,EASH,gBAAgB,CAAC,EAAY,EAAc,CACzC,QAAQ,MAAM,+BAA+B,uBAAyB,CAAK,EACtE,KAAK,MACP,OAAO,EAAI,CAAC,EAAG,EAAG,cACjB,EAAM,SAAS,EAAS,MAAM,EAC1B,CAAE,OAAQ,MAAU,EACpB,CACE,OAAQ,OACR,SAAU,CACR,OAAQ,SACR,MAAO,mCAAmC,EAAM,SAClD,EACA,OAAQ,EACV,CACN,EACC,MAAM,IAAM,EAAE,EAErB,CAGA,SAAS,EAAU,CAAC,EAAyC,CAC3D,OAAO,cAA8B,CAAI,OAChC,MAAO,EAId,YAAc,GACd,QAAU,CAAC,KAAM,KAAM,MAAO,MAAO,KAAK,OACpC,IAAG,CAAC,EAAY,CACpB,MAAM,EAAQ,KAAK,EAAI,IAAI,EAE7B,YAAY,CAAC,EAAc,EAAY,CACrC,EAAQ,iBAAiB,EAAI,CAAK,EAEtC,EAGF,SAAS,EAAU,CAAC,EAAgC,CAClD,GAAI,CACF,OAAO,EAAO,CAAM,EACpB,KAAM,CACN,OAAO",
|
|
21
|
-
"debugId": "
|
|
21
|
+
"debugId": "3E5053F15860D3B064756E2164756E21",
|
|
22
22
|
"names": []
|
|
23
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{K as
|
|
2
|
+
import{fm as D}from"./chunk-djnn8vvp.js";function j(z){return z.split(".")}class W{static token="config";items;constructor(z={}){this.items=z}has(z){let F=this.items;for(let E of j(z)){if(F===null||typeof F!=="object"||!(E in F))return!1;F=F[E]}return!0}get(z,F){let E=this.items;for(let G of j(z)){if(E===null||typeof E!=="object"||!(G in E))return F;E=E[G]}return E===void 0?F:E}getMany(z){let F=Array.isArray(z)?z.map((G)=>[G,void 0]):Object.entries(z),E={};for(let[G,J]of F)E[G]=this.get(G,J);return E}set(z,F){let E=typeof z==="string"?[[z,F]]:Object.entries(z);for(let[G,J]of E){let H=j(G),U=H.pop(),Q=this.items;for(let X of H){let Y=Q[X];if(Y===null||typeof Y!=="object")Q[X]={};Q=Q[X]}Q[U]=J}}prepend(z,F){let E=this.get(z,[]);E.unshift(F),this.set(z,E)}push(z,F){let E=this.get(z,[]);E.push(F),this.set(z,E)}merge(z){for(let[F,E]of Object.entries(z)){let G=this.items[F];if(G!==null&&typeof G==="object"&&!Array.isArray(G)&&E!==null&&typeof E==="object"&&!Array.isArray(E))this.items[F]={...G,...E};else this.items[F]=E}}all(){return this.items}}var B=Symbol.for("gemi.foundation.Application");class Z extends D{[B]=!0;static isApplication(z){return typeof z==="object"&&z!==null&&B in z}config;providers=[];services=[];booted=!1;constructor(z=new W){super();this.config=z,this.instance(W,z)}static currentInstance;static getInstance(){return Z.currentInstance}static setInstance(z){return Z.currentInstance=z,z}register(z){let F=this.providers.find((G)=>G instanceof z);if(F)return F;let E=new z(this);return E.register(),this.providers.push(E),E}registerMany(z){for(let F of z)this.register(F)}setShutdownHooks(z){this.services=[...z]}getProviders(){return[...this.providers]}isBooted(){return this.booted}async boot(){if(this.booted)return;for(let z of this.providers)await z.boot();this.booted=!0}shutdown(z={}){return this.shutdownPromise??=this.shutdownProviders(z.timeoutMs??5000),this.shutdownPromise}shutdownPromise;async shutdownProviders(z){let F={failed:[],timedOut:[]},E=[...[...this.services].reverse(),...[...this.providers].reverse().map((J)=>({name:`${J.constructor.name}.shutdown`,shutdown:(H)=>J.shutdown(H)}))];if(z<=0){if(E.length>0)console.log(`[gemi] Skipping ${E.length} provider shutdown hook(s): no time is budgeted for them.`);return F}let G=Date.now()+z;for(let J of E){let H=J.name,U=H.slice(0,H.lastIndexOf(".")),Q=G-Date.now();if(Q<=0){console.error(`[gemi] ${H}() skipped: the provider shutdown deadline had passed.`),F.timedOut.push(U);continue}let X,Y=await Promise.race([Promise.resolve().then(()=>J.shutdown({timeoutMs:Q})).then(($)=>$?.abandoned?"abandoned":"done",($)=>{return console.error(`[gemi] ${H}() failed:`,$),"failed"}),new Promise(($)=>{X=setTimeout(()=>$("timeout"),Q)})]);if(clearTimeout(X),Y==="failed")F.failed.push(U);if(Y==="abandoned")F.timedOut.push(U);if(Y==="timeout")console.error(`[gemi] ${H}() did not finish within the provider shutdown deadline; moving on.`),F.timedOut.push(U)}return F}flush(){super.flush(),this.instance(W,this.config),this.providers=[],this.services=[],this.booted=!1,this.shutdownPromise=void 0}}import{AsyncLocalStorage as _}from"async_hooks";var K=new _;function P(z){let F=K.getStore(),E=Z.isApplication(F)?F:Z.getInstance();if(!E)throw Error("No Application instance is available. Boot a Kernel before resolving services.");return z?E.make(z):E}
|
|
3
|
+
export{K as am,W as bm,Z as cm,P as dm};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=26514A3366A2E86364756E2164756E21
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
"import type { ServiceToken } from \"../container/Container\";\nimport { kernelContext } from \"../kernel/context\";\nimport { Application } from \"./Application\";\n\n/**\n * Resolves the Application for the current async context. Reads the kernel\n * AsyncLocalStorage — there is exactly one ALS in the framework, and\n * `Kernel.run()` stores the Application in it, so this is the primary path for\n * anything running inside a request or a cron tick.\n *\n * The static instance (Laravel's `Container::setInstance`, set by\n * `Kernel.boot()`) is the fallback for code that runs outside any `run()`\n * scope — build-time tooling, module top level, a stray `setTimeout`.\n */\nexport function app(): Application;\nexport function app<T>(token: ServiceToken<T>): T;\nexport function app<T>(token?: ServiceToken<T>): Application | T {\n const store = kernelContext.getStore();\n const instance = Application.isApplication(store)\n ? store\n : Application.getInstance();\n\n if (!instance) {\n throw new Error(\n \"No Application instance is available. Boot a Kernel before resolving services.\",\n );\n }\n\n return token ? instance.make(token) : instance;\n}\n"
|
|
9
9
|
],
|
|
10
10
|
"mappings": ";yCAOA,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,KACC,CAAC,IACE,GAAgD,UAC5C,YACA,OACP,CAAC,IAAmB,CAElB,OADA,QAAQ,MAAM,UAAU,cAAmB,CAAK,EACzC,SAEX,EACF,IAAI,QAAmB,CAAC,IAAY,CAClC,EAAQ,WAAW,IAAM,EAAQ,SAAS,EAAG,CAAS,EACvD,CACH,CAAC,EAGD,GAFA,aAAa,CAAK,EAEd,IAAY,SAAU,EAAO,OAAO,KAAK,CAAI,EAGjD,GAAI,IAAY,YAAa,EAAO,SAAS,KAAK,CAAI,EACtD,GAAI,IAAY,UACd,QAAQ,MACN,UAAU,sEACZ,EACA,EAAO,SAAS,KAAK,CAAI,EAI7B,OAAO,EAGT,KAAK,EAAG,CACN,MAAM,MAAM,EACZ,KAAK,SAAS,EAAY,KAAK,MAAM,EACrC,KAAK,UAAY,CAAC,EAClB,KAAK,SAAW,CAAC,EACjB,KAAK,OAAS,GACd,KAAK,gBAAkB,OAE3B,CCzPA,4BAAS,oBA4CF,IAAM,EAAgB,IAAI,EC5B1B,SAAS,CAAM,CAAC,EAA0C,CAC/D,IAAM,EAAQ,EAAc,SAAS,EAC/B,EAAW,EAAY,cAAc,CAAK,EAC5C,EACA,EAAY,YAAY,EAE5B,GAAI,CAAC,EACH,MAAU,MACR,gFACF,EAGF,OAAO,EAAQ,EAAS,KAAK,CAAK,EAAI",
|
|
11
|
-
"debugId": "
|
|
11
|
+
"debugId": "26514A3366A2E86364756E2164756E21",
|
|
12
12
|
"names": []
|
|
13
13
|
}
|
|
@@ -45,6 +45,6 @@ Say which, and registerModels will leave it alone:
|
|
|
45
45
|
register("${j}", ${z[0]})
|
|
46
46
|
|
|
47
47
|
A class that is only a typed view over the same rows belongs in a module you do not hand to registerModels.`);this.model=j;this.candidates=z;this.name="AmbiguousModelRegistrationError"}}class C extends Error{model;operation;required;limit;dialect;constructor(j,z,B,G,H,I){super(`${j}.${z} would bind ${B} parameters, and the '${H}' driver accepts at most ${G} in one statement. ${I}`+(z==="createMany"?" A createMany over the ceiling is normally split across statements inside one transaction, so reaching this means splitting cannot help: a single row binds more than the driver accepts.":" Splitting is not something this operation can do for you \u2014 one "+"statement has to carry one answer. Narrow the query."));this.model=j;this.operation=z;this.required=B;this.limit=G;this.dialect=H;this.name="ParameterLimitError"}}class D extends Error{model;operation;field;constructor(j,z,B){super(`${j}.${z} is missing a value for '${B}', which is required and has no default.`);this.model=j;this.operation=z;this.field=B;this.name="MissingRequiredValueError"}}class F extends Error{relation;model;constructor(j,z,B){super(`'${j}' is not a relation on model ${z}. `+(B.length>0?`Known relations: ${B.join(", ")}.`:`${z} declares no relations.`));this.relation=j;this.model=z;this.name="UnknownRelationError"}}class b extends Error{model;limit;constructor(j,z){super(`The include tree nests more than ${z} relations deep (at model ${j}). Deeply nested includes are legal, so this is a guard against a generated or malformed argument tree rather than a limit on `+"modelling \u2014 every level costs at least one query.");this.model=j;this.limit=z;this.name="RelationDepthExceededError"}}class P extends Error{model;relation;target;constructor(j,z,B,G){super(`${j}.${z} points at model '${B}', which nothing has registered. The generated artifact and the registry disagree: re-run \`prisma generate\`, and check that app/models/generated/index.ts is imported. `+(G.length>0?`Registered models: ${G.join(", ")}.`:"Nothing is registered at all."));this.model=j;this.relation=z;this.target=B;this.name="UnregisteredRelationTargetError"}}class R extends Error{model;relation;constructor(j,z,B){super(`Cannot resolve how ${j}.${z} joins: ${B} This means `+"app/models/generated is stale or hand-edited \u2014 re-run "+"`prisma generate`.");this.model=j;this.relation=z;this.name="MalformedRelationError"}}class v extends Error{constructor(j,z){super(`No model is registered under the name '${j}'. `+(z.length>0?`Registered models: ${z.join(", ")}.`:"Nothing is registered \u2014 is app/models/generated/index.ts imported?"));this.name="ModelNotRegisteredError"}}class N extends Error{constructor(j){super(`${j} has no $schema. Model subclasses must extend a generated base class from app/models/generated/models.ts.`);this.name="MissingModelSchemaError"}}class Q extends Error{model;operation;constructor(j,z){super(`${j}.${z} was given 'lock' outside a transaction. A row lock lasts until the transaction that took it ends, so outside one it is released as soon as the row is read and protects nothing. Run the read and the writes it guards inside Model.transaction(async () => { ... }).`);this.model=j;this.operation=z;this.name="LockOutsideTransactionError"}}
|
|
48
|
-
export{K as
|
|
48
|
+
export{K as tk,Z as uk,_ as vk,$ as wk,L as xk,M as yk,U as zk,V as Ak,y as Bk,O as Ck,W as Dk,E as Ek,S as Fk,T as Gk,x as Hk,A as Ik,C as Jk,D as Kk,F as Lk,b as Mk,P as Nk,R as Ok,v as Pk,N as Qk,Q as Rk};
|
|
49
49
|
|
|
50
|
-
//# debugId=
|
|
50
|
+
//# debugId=E8932076CF2F8BBE64756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * Thrown when the compiler is handed an argument it does not implement yet.\n *\n * Every public operation accepts the full Prisma argument type from iteration 1\n * — signatures are final, capability grows underneath them. The price of that is\n * that anything unimplemented has to fail loudly: silently dropping a `take: 10`\n * and returning the whole table is the worst failure mode this ORM has.\n */\nexport class UnsupportedQueryError extends Error {\n constructor(\n public readonly argument: string,\n public readonly model: string,\n public readonly operation: string,\n /**\n * What cannot work, and what to do instead.\n *\n * **Required**, which is the second half of #61 — the first being the\n * `UnsupportedByDesignError` split beside this. It was optional, and the\n * refusals that omitted it were the highest-traffic ones: an argument the\n * operation does not accept, on the path a typo takes. Those said only\n * *that* something was refused, to the reader least likely to know why.\n *\n * Required rather than conventionally-supplied for the reason five other\n * parameters here are — `render`'s `origin`, `changedFields`' `schema`,\n * `RelationExecutor.exec`'s `preScoped`, `resolveLink`'s `operation`,\n * `assertPageArgument`'s reported name: where omitting an argument produces\n * a *worse* result rather than an error, `tsc` is the only thing that keeps\n * a convention. Ninety-five of a hundred call sites already passed one; the\n * five that did not are exactly the ones nobody revisited.\n *\n * `UnknownFieldError` and `UnknownRelationError` set the standard this\n * meets: both enumerate the valid names rather than only rejecting the\n * invalid one.\n */\n detail: string,\n ) {\n super(\n `gemi ORM does not support '${argument}' yet (${model}.${operation}). ` +\n detail,\n );\n this.name = \"UnsupportedQueryError\";\n }\n}\n\n/**\n * An argument the ORM has **decided not to implement**, as opposed to one it has\n * not implemented yet.\n *\n * The distinction is the whole point, and it is a distinction a caller can act\n * on: \"yet\" means wait for a release, \"will not\" means change the code. Sharing\n * one error for both meant `docs/orm.md` could list `omit` under *Not in scope*\n * while the runtime said \"yet\" — a contradiction a reader has no way to\n * resolve, and the one #68 exists to end.\n *\n * A subclass rather than a sibling, so `catch (e) { if (e instanceof\n * UnsupportedQueryError) … }` keeps working for callers that do not care which\n * kind it is.\n */\n/**\n * An argument the ORM **does** implement, given a value it cannot mean.\n *\n * The third category, and the one that made \"yet\" wrong four separate times —\n * #82, #88, #100 and #101 each corrected it at their own call site before #61\n * was found to own the problem. The taxonomy the three classes now draw:\n *\n * not implemented yet UnsupportedQueryError wait for a release\n * decided against UnsupportedByDesignError change the call (#78)\n * implemented, bad value InvalidArgumentError fix the value\n *\n * `take: \"-2\"` is the clearest case. `take` is implemented; `\"-2\"` is not a\n * take. Telling that caller the ORM \"does not support 'take' yet\" is wrong on\n * both halves — it does, and there is nothing to wait for — and it sends them\n * to a changelog when the fix is one character in their own code.\n *\n * **Extends `UnsupportedQueryError`**, so every existing `catch` and every test\n * asserting the base class keeps working. That is the same choice\n * `UnsupportedByDesignError` made, and it is what lets a taxonomy be added to a\n * shipped ORM without a breaking change: the specific classes are for the\n * reader, the base class is for the handler.\n *\n * **Where the taxonomy stops, and why it stops there.** An argument that is not\n * in the grammar at all keeps the base class and its \"yet\" — `{ nope: 1 }`\n * reports \"does not support 'nope' yet\". That is right for half of what reaches\n * that path and wrong for the other half: the same check refuses a typo and a\n * real Prisma argument this ORM has genuinely not implemented, and nothing at\n * that point can tell them apart. Splitting it would mean carrying Prisma's\n * full argument grammar per operation, which is a large amount of duplicated\n * schema for a small gain.\n *\n * What makes it tolerable is the sentence after it. Since #61's other half made\n * `detail` mandatory, that refusal always continues *\"findMany takes include,\n * omit, orderBy, select, skip, take, where\"* — so a caller who typed `nope`\n * learns it is not coming from the very next clause, without the class having\n * to know. Recorded here rather than left to be re-derived, because \"the third\n * class did not cover this one\" is the obvious first reading and it is not the\n * interesting part.\n */\nexport class InvalidArgumentError extends UnsupportedQueryError {\n constructor(\n argument: string,\n model: string,\n operation: string,\n /** What is wrong with the value, and what a good one looks like. */\n reason: string,\n ) {\n super(argument, model, operation, reason);\n this.name = \"InvalidArgumentError\";\n this.message = `Invalid '${argument}' (${model}.${operation}). ${reason}`;\n }\n}\n\nexport class UnsupportedByDesignError extends UnsupportedQueryError {\n constructor(\n argument: string,\n model: string,\n operation: string,\n /** What to use instead. Required — see #61: a refusal owes the caller a next step. */\n reason: string,\n ) {\n super(argument, model, operation, reason);\n this.name = \"UnsupportedByDesignError\";\n this.message =\n `gemi ORM does not implement '${argument}' (${model}.${operation}), ` +\n `and this is a decision rather than a gap. ${reason}`;\n }\n}\n\n/**\n * Thrown when an argument names something that is not a field on the model. A\n * `where` key with no matching field is an error, never a passthrough — that is\n * the rule that keeps user input out of the identifier positions in the SQL.\n */\nexport class UnknownFieldError extends Error {\n constructor(\n public readonly field: string,\n public readonly model: string,\n known: string[],\n ) {\n super(\n `'${field}' is not a field on model ${model}. ` +\n `Known fields: ${known.join(\", \")}.`,\n );\n this.name = \"UnknownFieldError\";\n }\n}\n\n/**\n * Thrown when a column holds something the generated schema says it cannot —\n * an unparseable timestamp, a fractional value in a `BigInt` column, malformed\n * JSON. Every dialect needs it, which is why it lives here rather than beside\n * one of them.\n *\n * It exists so those cases fail rather than decode into a plausible wrong\n * value: `new Date(\"nonsense\")` is an `Invalid Date`, not an error, and it\n * would travel a long way before anyone noticed.\n */\nexport class DecodeError extends Error {\n constructor(\n public readonly field: { column: string; type: string },\n public readonly value: unknown,\n ) {\n super(\n `Could not decode the value ${JSON.stringify(String(value))} from column ` +\n `'${field.column}' as ${field.type}. The column's contents do not match ` +\n `the Prisma schema — was it written by something other than Prisma or ` +\n `the gemi ORM?`,\n );\n this.name = \"DecodeError\";\n }\n}\n\n/**\n * Thrown by the `*OrThrow` operations when the query matched nothing. Prisma\n * raises `NotFoundError` / `P2025` for the same case; the differential harness\n * compares the fact of throwing, not the error type.\n */\nexport class RecordNotFoundError extends Error {\n constructor(\n public readonly model: string,\n public readonly operation: string,\n ) {\n super(`No ${model} found (${model}.${operation}).`);\n this.name = \"RecordNotFoundError\";\n }\n}\n\n/**\n * The dispatchers' test for a lookup that matched nothing and should be\n * answered with a 404.\n *\n * Matches the name as well as the class for the reason `isPolicyDeniedError`\n * and `isUniqueConstraintError` do: `instanceof` compares against *this*\n * module instance's class object, so a second copy of `gemi/orm` — two\n * versions in one dependency tree, a linked package beside a bundled one —\n * throws an error this would not recognise, and the request would go back to\n * being a 500 carrying the model's name in its body.\n *\n * The name is the identity here, so an application error that calls itself\n * `RecordNotFoundError` is deliberately matched too. That is the same bargain\n * the other two predicates make, and the failure it trades against — a 500\n * where a 404 was meant — is the worse one.\n */\nexport function isRecordNotFoundError(error: unknown): error is RecordNotFoundError {\n if (error instanceof RecordNotFoundError) return true;\n\n return (\n typeof error === \"object\" &&\n error !== null &&\n (error as { name?: unknown }).name === \"RecordNotFoundError\"\n );\n}\n\n/**\n * Thrown when a write violates a unique constraint.\n *\n * DECISION — gemi defines its own error rather than mirroring Prisma's codes.\n *\n * Prisma raises `PrismaClientKnownRequestError` with code `P2002` and\n * `meta.target` holding the field names. Mirroring that would ease a migration\n * for code already branching on `P2002`.\n *\n * **The premise this note used to rest on was wrong, and the conclusion is\n * unchanged.** It said \"nothing in this repository does (checked)\", which was\n * true of *this* repository and was never the question — the code that branches\n * on `P2002` lives in the applications the ORM is for. The first real port\n * measured four such guards, every one of them in concurrency-recovery code\n * (catch the collision, re-read, retry), and every one of them silently dead the\n * moment the write moved onto gemi: the `catch` still ran, the condition was\n * false, the recovery did not happen. Nor was the repository itself clean —\n * `templates/saas-starter/app/models/differential.ts:621` branches on `P2002`\n * today, and did when this was written.\n *\n * What the premise was doing was answering \"would anyone notice?\", and the\n * answer is that four people noticed at once. The decision never depended on it.\n * Carrying a `P` code implies the rest of the taxonomy is implemented too:\n * `P2003`, `P2025`, and the fifty others an application might reasonably then\n * expect to catch. Claiming a compatibility surface we have not built is worse\n * than asking the call sites that need it to catch a gemi error instead —\n * *especially* when the code in question is a retry loop, because a\n * compatibility surface that covers `P2002` and not `P2034` fails in exactly\n * the same silent way, one layer further in.\n *\n * A porter reaches for `isUniqueConstraintError` below. `UPGRADE.md` carries\n * the temporary `|| error.code === \"P2002\"` bridge, for a codebase halfway\n * through the move, with the marker that says when to delete it; it is\n * deliberately not exported, because a Prisma code in gemi's permanent surface\n * is the thing this note declined.\n *\n * What the contract does promise is the part that matters: the error is typed,\n * catchable, and names the fields — as *field* names, the way Prisma's\n * `meta.target` does, not as the database columns the driver reported.\n */\nexport class UniqueConstraintError extends Error {\n constructor(\n public readonly model: string,\n public readonly operation: string,\n /** Field names, mapped back through the schema from the driver's columns. */\n public readonly fields: string[],\n /** The constraint's own name, when the dialect reports one. */\n public readonly constraint?: string,\n options?: { cause?: unknown },\n ) {\n super(\n `Unique constraint violated on ${model}.${operation}` +\n (fields.length > 0 ? ` for ${fields.join(\", \")}` : \"\") +\n (constraint ? ` (constraint '${constraint}')` : \"\") +\n `. A ${model} with those values already exists.`,\n options,\n );\n this.name = \"UniqueConstraintError\";\n }\n}\n\n/**\n * The guard to write in a retry-on-collision `catch`, which is where a\n * `code === \"P2002\"` test almost always was:\n *\n * try {\n * return await Invite.create({ data: { token } })\n * } catch (error) {\n * if (!isUniqueConstraintError(error)) throw error\n * return await Invite.findUniqueOrThrow({ where: { token } })\n * }\n *\n * **Why this is worth shipping rather than telling people to write\n * `instanceof`**, which is the obvious objection and the reason it nearly was\n * not shipped. The second half of the test is the whole of it:\n *\n * error instanceof UniqueConstraintError || error.name === \"UniqueConstraintError\"\n *\n * `instanceof` compares against *this module instance's* class object, so it is\n * false across a duplicate copy of `gemi/orm` — two versions in one dependency\n * tree, a bundled build alongside a linked one, a monorepo package resolving\n * its own. The error is the right error, thrown by the right code, and the\n * guard silently does not fire. That is not a hypothetical: duck-typing rather\n * than importing the class is precisely what the ported application had already\n * done for Prisma's error, for precisely this reason, and shipping a predicate\n * that only does `instanceof` would hand it back the same trap under a new\n * name.\n *\n * So the name is load-bearing rather than a convenience: it is the identity\n * that survives module duplication, which is why every error in this file sets\n * `this.name` explicitly instead of relying on the class name surviving\n * minification.\n *\n * **The narrowing is a claim, and this is what it rests on.** The name branch\n * asserts `UniqueConstraintError` on the strength of a string — a second copy\n * of this module really does carry `model`, `operation` and `fields`, so the\n * claim holds for the case it exists for. An unrelated object named\n * `\"UniqueConstraintError\"` would defeat it, and that is not something that\n * happens by accident.\n *\n * **It deliberately does not match `code === \"P2002\"`.** See the DECISION\n * above: the temporary bridge for a half-ported codebase is in `UPGRADE.md`,\n * where it can carry a delete-me marker, rather than in gemi's permanent\n * surface, where it would have neither.\n */\nexport function isUniqueConstraintError(\n error: unknown,\n): error is UniqueConstraintError {\n if (error instanceof UniqueConstraintError) return true;\n\n return (\n typeof error === \"object\" &&\n error !== null &&\n (error as { name?: unknown }).name === \"UniqueConstraintError\"\n );\n}\n\n/**\n * Thrown when a write needs `RETURNING` and the dialect has none.\n *\n * Unreachable on SQLite and Postgres, which both support it. It exists so that\n * the MySQL / MariaDB path is a named gap rather than a wrong answer: the\n * fallback there is `lastInsertRowid` plus a re-select, which is a different\n * statement shape and is not implemented.\n */\nexport class ReturningUnsupportedError extends Error {\n constructor(\n public readonly model: string,\n public readonly operation: string,\n public readonly dialect: string,\n ) {\n super(\n `${model}.${operation} needs RETURNING to report its result, and the ` +\n `'${dialect}' dialect does not support it. The fallback — ` +\n `lastInsertRowid plus a re-select — is not implemented.`,\n );\n this.name = \"ReturningUnsupportedError\";\n }\n}\n\n/**\n * Thrown when a policy denies an operation.\n *\n * Two ways to get here, and the message distinguishes them because the fixes\n * are different: a policy's `before` returned false, or the model is policied\n * and there is no user in scope at all.\n *\n * The second is the deny-by-default rule, and it is the reason this error is\n * loud. A cron tick or a queue worker reading a policied model has no user, and\n * the alternative — treating \"no user\" as \"no policy\" — means the dangerous\n * case is the silent one: a request whose auth middleware was misconfigured\n * would read every tenant's rows rather than failing. So unscoped access is\n * always a decision written at the call site, through `Model.asSystem`.\n */\nexport class PolicyDeniedError extends Error {\n constructor(\n public readonly model: string,\n public readonly operation: string,\n public readonly reason: \"denied\" | \"no-user\" = \"denied\",\n ) {\n super(\n reason === \"no-user\"\n ? `${model}.${operation} is governed by a policy and there is no user ` +\n `in scope. If this is a cron tick, a queue worker or a script, say ` +\n `so at the call site: Model.asSystem(() => ...). Policies are ` +\n `never skipped just because a user failed to turn up.`\n : `${model}.${operation} was denied by ${model}'s policy.`,\n );\n this.name = \"PolicyDeniedError\";\n }\n}\n\n/**\n * The api dispatcher's test for a denial it should answer with a 403. It\n * matches the name as well as the class for the reason\n * `isUniqueConstraintError` does: a second copy of `gemi/orm` throws an error\n * that is not `instanceof` this class, and a denial that failed the test would\n * go back to being a 500 that carries the policy's message.\n */\nexport function isPolicyDeniedError(error: unknown): error is PolicyDeniedError {\n if (error instanceof PolicyDeniedError) return true;\n\n return (\n typeof error === \"object\" &&\n error !== null &&\n (error as { name?: unknown }).name === \"PolicyDeniedError\"\n );\n}\n\n/**\n * Thrown when an `update` writes to a column its own policy's `scope` selects on,\n * and the policy has no `onUpdate` saying what that should mean.\n *\n * The shape it catches:\n *\n * scope: (ctx) => ({ organizationId: ctx.user.organizationId })\n * // ...and then\n * User.update({ where: { id }, data: { organizationId: 999 } })\n *\n * The scope did its job — only rows in the caller's own tenant could be selected\n * — and the statement still hands one of them to another tenant. Afterwards the\n * row is outside the scope, so it cannot be read back and cannot be put right by\n * the same caller: a one-way door rather than a visible failure. The usual way in\n * is not malice but mass assignment, a handler forwarding request fields into\n * `data`.\n *\n * This is `assertCreateCovered`'s question asked of the other write. There it is\n * \"you scoped reads but never said what an insert means\"; here it is \"you scoped\n * reads but never said whether an update may move a row out\". Both are answered\n * by writing the hook, including when the answer is \"allow it\" —\n * `onUpdate: (_ctx, data) => data` is a complete and legitimate answer, and\n * saying it out loud is the point.\n *\n * **What it cannot see.** The scope-owned columns are read off the top level of\n * the fragment the policy returned, so `{ organizationId: 7 }` is understood and\n * `{ OR: [...] }` is not — a scope built from combinators is not attributed to\n * any column and an update through it is not checked. Narrowing that would mean\n * either interpreting arbitrary `where` grammar or refusing every update on such\n * a model, and neither is worth it: the guard is a rail on the common shape, not\n * a proof.\n */\nexport class ScopeEscapeError extends Error {\n constructor(\n public readonly model: string,\n public readonly operation: string,\n public readonly fields: readonly string[],\n ) {\n const named = fields.map((field) => `'${field}'`).join(\", \");\n super(\n `${model}.${operation} writes ${named}, which ${model}'s policy also ` +\n `scopes on — so this update can move a row outside the scope that ` +\n `selected it, where the caller can no longer read or repair it.\\n\\n` +\n `Add an onUpdate to that policy. It may reassert the column ` +\n `(data => ({ ...data, ${fields[0]}: ctx.user.${fields[0]} })), reject ` +\n `the write, or allow it explicitly with (_ctx, data) => data — all ` +\n `three are fine, and the point is that the policy says which.`,\n );\n this.name = \"ScopeEscapeError\";\n }\n}\n\n/**\n * Thrown when a model class carries policies but is not the class the registry\n * resolves its name to.\n *\n * This exists because of a cross-tenant leak that shipped past review. The\n * generated `index.ts` registers the *generated* base — `register(\"Account\",\n * AccountModel)` — while an application authors its policy on a subclass:\n *\n * export class Account extends AccountModel {\n * static $policies = [{ scope: (ctx) => ({ organizationId: … }) }]\n * }\n *\n * A root query goes through `Account`, so `policiesFor(this)` finds the policy\n * and the scope applies. A **nested** relation read resolves through the\n * registry, gets `AccountModel`, and walks a prototype chain the policy is not\n * on — so `User.findMany({ include: { accounts: true } })` returned every\n * tenant's accounts. Root queries scoped, nested reads unscoped: exactly the\n * Prisma behaviour policies exist to fix, and silent.\n *\n * Raised at the first query through the unregistered class, naming the one-line\n * fix, because the alternative is data crossing a tenant boundary with nothing\n * to notice it.\n *\n * It fires on a divergence in the resolved policy *chain*, not merely on the two\n * classes differing. A plain subclass that adds no policy of its own inherits\n * the same policy objects in the same order, so a nested read resolving to its\n * parent applies exactly what the root query applied — no divergence, nothing\n * to refuse. An earlier version compared class identity and rejected\n * `class AdminUser extends User {}` for policies it had not written.\n */\nexport class UnregisteredPolicyClassError extends Error {\n constructor(\n public readonly model: string,\n /**\n * Under `carries: \"narrowing\"` this is the *ancestor* — the class the model\n * belongs to — rather than whatever the registry currently holds. The two\n * classes are on one prototype chain there, and which of them is registered\n * is the thing in question, so naming them by their relationship is what\n * makes the message readable.\n */\n public readonly registered: string,\n /** Under `carries: \"narrowing\"`, the descendant: the view that narrows. */\n public readonly queried: string,\n /**\n * Which side carries the policies that would be skipped, and therefore what\n * the author should do about it. Three, because they need three different\n * answers: a missing registration, a query through the wrong class, and a\n * view that should not be competing for the name at all.\n */\n public readonly carries: \"queried\" | \"registered\" | \"narrowing\" = \"queried\",\n ) {\n super(\n carries === \"narrowing\"\n ? `${queried} extends ${registered}, which owns the model '${model}', ` +\n `and carries policies of its own on top of it. A class that ` +\n `narrows an existing model is a view, and the registry holds one ` +\n `class per name — so registering ${queried} would apply its ` +\n `narrowing to every nested read of ${model}, and leaving ` +\n `${registered} registered would skip ${queried}'s policies ` +\n `entirely. Neither is a thing to choose for you.\\n\\n` +\n `Keep the view out of the modules you hand to Kernel.models, and ` +\n `query it directly where you want it:\\n\\n` +\n ` ${queried}.findMany(…) // narrowed, at the call site\\n\\n` +\n `If it is not a view but the model itself, move the policies onto ` +\n `${registered} — the class the model's name resolves to — and ` +\n `${queried} inherits them everywhere.\\n`\n : carries === \"queried\"\n ? `${queried} carries policies but the registry resolves '${model}' to ` +\n `${registered}. Nested relation reads go through the registry, so ` +\n `they would run on ${registered} and skip every policy on ` +\n `${queried} — scoped at the root, unscoped inside an include. ` +\n `Register the class that carries the policy:\\n\\n` +\n ` import { register } from \"gemi/orm\"\\n` +\n ` export class ${queried} extends ${registered} { … }\\n` +\n ` register(\"${model}\", ${queried})\\n`\n : `This query goes through ${queried}, but the registry resolves ` +\n `'${model}' to ${registered}, which carries policies ${queried} ` +\n `does not. Nested relation reads would be scoped and this query is ` +\n `not — the same policy applying to some queries and not others. ` +\n `Query ${registered} instead:\\n\\n` +\n ` ${registered}.findMany(…)\\n\\n` +\n `If skipping policies is intended, say so at the call site — that ` +\n `is what Model.asSystem() is for, and it is the only way to do it ` +\n `that a reader can see.\\n`,\n );\n this.name = \"UnregisteredPolicyClassError\";\n }\n}\n\n/**\n * Thrown when a `$policies` array holds something that is not a usable policy.\n *\n * Every case it covers is refused today — by `tsc`, at the class declaration,\n * with `TS2417`, because `Model` declares `static $policies?: readonly\n * PolicyEntry[]` and `ModelPolicy`'s members are all optional, so a typo'd key\n * trips weak-type detection. This is therefore a guard on the paths that import\n * user code *without* having type-checked it: `registerModels` at boot, and\n * `gemi check models`, whose whole job is to find mistakes in a file somebody is\n * still writing.\n *\n * Two failures, and the second is the one that matters.\n *\n * **A function the ORM cannot get a policy out of.** `resolveEntry` instantiates\n * every function entry with no arguments, and there are two ways that goes\n * wrong. A factory nobody called — `softDeletes` rather than\n * `softDeletes({ field })` — is not constructable at all and reached `new entry`\n * to produce `TypeError: function is not a constructor`. A class that *is*\n * constructable and whose constructor wants an argument gets through that check\n * and dies inside its own body instead, with\n * `TypeError: undefined is not an object (evaluating 'opts.field')`. Both are\n * loud and neither named the model, the index or the file, which on a 79-model\n * app leaves the first question unanswered; the second is the case that survived\n * a first pass at this error, because \"constructable\" is a fact about\n * `[[Construct]]` and says nothing about what the constructor then does.\n *\n * **An entry with no recognised hook.** `{ scopes: … }` and\n * `{ default: { scope: … } }` were accepted in silence: `applyPolicies`\n * dispatches on `before` / `scope` / `onCreate` / `onUpdate` and\n * `applyRedaction` on `redact`, so an entry spelling none of them contributes\n * nothing. The model then carries a visible `$policies` array, passes\n * `gemi check models` as correctly registered, and **reads unscoped** — the same\n * written-believed-not-in-effect shape `UnregisteredPolicyClassError` exists\n * for, arriving through a typo instead of through the registry.\n *\n * The line between *empty but valid* and *malformed* is drawn at \"would this\n * ever run\": an entry with at least one recognised hook that is callable is\n * accepted whatever else it carries, because a factory's return value and a\n * policy class routinely hold configuration and helpers beside the hooks, and\n * refusing unknown *extra* keys would reject code that works. An entry with no\n * callable hook at all is refused, `{}` included — it is indistinguishable from\n * a policy that was meant to do something, and a conditional policy belongs in\n * the array rather than in the entry.\n */\nexport class InvalidPolicyEntryError extends Error {\n constructor(\n /**\n * The class whose **own** `$policies` array holds the entry — the class the\n * author wrote the array on, which is not necessarily the model being\n * queried when the array is on a base.\n */\n public readonly model: string,\n /** The entry's index in that array. */\n public readonly index: number,\n public readonly reason:\n | \"not-a-policy\"\n | \"not-constructable\"\n | \"constructor-threw\"\n | \"no-hooks\"\n | \"hook-not-callable\",\n /** What was found in the entry's place, rendered for a human. */\n public readonly found: string,\n /**\n * The hook names the runtime dispatches on, supplied by `policy.ts` so the\n * list lives beside the code that reads it rather than being restated here.\n */\n hooks: readonly string[],\n /**\n * A key the entry actually spells and the hook it is within one edit of.\n *\n * **The pair, not the hook alone.** An unattributed \"Did you mean `scope`?\"\n * after a list of five keys does not say which of them was read as a\n * misspelling, so a reader who can see that none of them are has no way to\n * dismiss it — and this error is about an authorization rule that is not in\n * effect, where a suggestion followed wrongly costs a rename of something\n * that was never the problem.\n */\n public readonly suggestion?: { key: string; hook: string },\n options?: { cause?: unknown },\n ) {\n const where = `${model}.$policies[${index}]`;\n const named =\n hooks.length > 1\n ? `${hooks.slice(0, -1).join(\", \")} or ${hooks[hooks.length - 1]}`\n : (hooks[0] ?? \"\");\n\n super(\n reason === \"not-a-policy\"\n ? `${where} is ${found}, which is not a policy. An entry is either a ` +\n `policy object — { scope, onCreate, … } — or a class the ORM ` +\n `constructs with no arguments.\\n\\n` +\n `A policy that only sometimes applies belongs in the array rather ` +\n `than in the entry:\\n\\n` +\n ` static $policies = [...(multiTenant ? [tenantScope] : [])]\\n`\n : reason === \"not-constructable\"\n ? `${where} is ${found}, and a function entry is instantiated with ` +\n `no arguments — so an arrow function, a plain function, or a ` +\n `factory that was never called cannot be one.\\n\\n` +\n `If it is a factory, call it:\\n\\n` +\n ` static $policies = [softDeletes({ field: \"deletedAt\" })]\\n`\n : reason === \"constructor-threw\"\n ? `${where} is ${found}\\n\\n` +\n `A class entry is constructed with no arguments. If this one ` +\n `needs some, construct it yourself and put the instance in the ` +\n `array:\\n\\n` +\n ` static $policies = [new TenantPolicy({ field: \"orgId\" })]\\n\\n` +\n `If the constructor reaches for something that is not ready yet, ` +\n `note that it runs on the first query through this model, not at ` +\n `boot.\\n`\n : reason === \"hook-not-callable\"\n ? `${where} has a ${found}, and every hook is called — so this ` +\n `would throw on the first query that reached it rather than ` +\n `doing whatever it was meant to do. Give it a function, or ` +\n `leave the key out.\\n`\n : `${where} has none of ${named}, so it would never run. The ` +\n `model carries a visible $policies array and nothing in it ` +\n `applies to any query — which for a scope means the model ` +\n `reads unscoped. ${found}` +\n (suggestion\n ? ` Is '${suggestion.key}' meant to be \\`${suggestion.hook}\\`?`\n : \"\") +\n `\\n`,\n options,\n );\n this.name = \"InvalidPolicyEntryError\";\n }\n}\n\n/**\n * Thrown when `registerModels` finds two unrelated classes in one module both\n * claiming the same model name.\n *\n * Deriving registration from a module namespace works because the candidates\n * are normally a chain — a generated base, the application's subclass, perhaps\n * a typed view over it — and a chain has a least element to elect. Two classes\n * that extend the same base without extending each other do not: both were\n * written for this model, and only the author knows which one nested reads\n * should run.\n *\n * Refused rather than guessed at, because both guesses are silent. Picking\n * either would scope every `include` of the model by one class's policies while\n * the other's code keeps reading as though its own applied.\n *\n * **\"In one module\" is the exact scope, and the asymmetry is deliberate.**\n * Election happens per module, so two unrelated claims split across *different*\n * modules never meet inside one — the later import simply wins. What catches\n * that is the audit at the end of `registerModels` rather than this error, and\n * only when the two diverge in policies. Two unrelated *unpolicied* claims on\n * one name resolve by import order and nothing reports it, which is tolerable\n * for the same reason it is invisible: with no policies on either, the choice\n * changes no query's scope.\n */\nexport class AmbiguousModelRegistrationError extends Error {\n constructor(\n public readonly model: string,\n public readonly candidates: readonly string[],\n ) {\n const named = candidates.map((candidate) => `'${candidate}'`).join(\", \");\n super(\n `Two classes in one module claim the model '${model}' — ${named} — and ` +\n `neither extends the other, so there is no way to tell which one ` +\n `nested relation reads should run.\\n\\n` +\n `Say which, and registerModels will leave it alone:\\n\\n` +\n ` import { register } from \"gemi/orm\"\\n` +\n ` register(\"${model}\", ${candidates[0]})\\n\\n` +\n `A class that is only a typed view over the same rows belongs in a ` +\n `module you do not hand to registerModels.`,\n );\n this.name = \"AmbiguousModelRegistrationError\";\n }\n}\n\n/**\n * Thrown when a statement would bind more parameters than the driver's wire\n * protocol can carry.\n *\n * Three shapes reach it, all of them scaling with the caller's *data* rather\n * than with the query's shape: `createMany` at `rows × columns`, an `in` list on\n * SQLite (one placeholder per element, and such a list is routinely\n * request-derived), and a to-many `include` on SQLite, which batches an `in`\n * over the parent keys. Both limits are hard and low enough to hit with an\n * ordinary import — Postgres counts parameters in an int16 (65535), SQLite\n * defaults `SQLITE_MAX_VARIABLE_NUMBER` to 32766. Postgres escapes the last two\n * either way: `= any($1)` is one parameter however long the array.\n *\n * Prisma chunks the insert automatically. Doing that here means several\n * statements, which without a transaction is a partially-applied `createMany`\n * on failure — so it waits for iteration 5, and until then this is a named gap\n * rather than a driver error naming neither the model nor the cause. Same\n * treatment as `ReturningUnsupportedError`, for the same reason.\n */\nexport class ParameterLimitError extends Error {\n constructor(\n public readonly model: string,\n public readonly operation: string,\n public readonly required: number,\n public readonly limit: number,\n public readonly dialect: string,\n detail: string,\n ) {\n super(\n `${model}.${operation} would bind ${required} parameters, and the ` +\n `'${dialect}' driver accepts at most ${limit} in one statement. ` +\n `${detail}` +\n (operation === \"createMany\"\n ? ` A createMany over the ceiling is normally split across statements ` +\n `inside one transaction, so reaching this means splitting cannot ` +\n `help: a single row binds more than the driver accepts.`\n : ` Splitting is not something this operation can do for you — one ` +\n `statement has to carry one answer. Narrow the query.`),\n );\n this.name = \"ParameterLimitError\";\n }\n}\n\n/**\n * Thrown when a write omits a column that has no value to fall back on: not\n * supplied, no client-side default, no database default, and not nullable.\n *\n * Raised in the compiler rather than left to the database so the message names\n * the field and the model, instead of surfacing as `NOT NULL constraint failed`\n * with a column name and no context.\n */\nexport class MissingRequiredValueError extends Error {\n constructor(\n public readonly model: string,\n public readonly operation: string,\n public readonly field: string,\n ) {\n super(\n `${model}.${operation} is missing a value for '${field}', which is ` +\n `required and has no default.`,\n );\n this.name = \"MissingRequiredValueError\";\n }\n}\n\n/**\n * Thrown when an `include` — or a relation-shaped key inside a `select` — names\n * something the model does not declare as a relation.\n */\nexport class UnknownRelationError extends Error {\n constructor(\n public readonly relation: string,\n public readonly model: string,\n known: string[],\n ) {\n super(\n `'${relation}' is not a relation on model ${model}. ` +\n (known.length > 0\n ? `Known relations: ${known.join(\", \")}.`\n : `${model} declares no relations.`),\n );\n this.name = \"UnknownRelationError\";\n }\n}\n\n/**\n * Thrown when an include tree nests deeper than the guard allows.\n *\n * A cyclic include is legal and finite — `user -> accounts -> user` terminates\n * because the caller wrote a finite tree. What this catches is an *unbounded*\n * one: an argument tree built by a loop, or forwarded from a request body, that\n * describes a thousand levels. Under the batched planner every level is at least\n * one query, so the guard is what stops a malformed argument from becoming a\n * self-inflicted denial of service.\n */\nexport class RelationDepthExceededError extends Error {\n constructor(\n public readonly model: string,\n public readonly limit: number,\n ) {\n super(\n `The include tree nests more than ${limit} relations deep (at model ` +\n `${model}). Deeply nested includes are legal, so this is a guard ` +\n `against a generated or malformed argument tree rather than a limit on ` +\n `modelling — every level costs at least one query.`,\n );\n this.name = \"RelationDepthExceededError\";\n }\n}\n\n/**\n * Thrown when a relation names a model the registry does not hold. Every\n * relation in a generated artifact was emitted from a model in the same\n * `schema.prisma`, so this can only mean the artifact and the registry disagree.\n */\nexport class UnregisteredRelationTargetError extends Error {\n constructor(\n public readonly model: string,\n public readonly relation: string,\n public readonly target: string,\n known: string[],\n ) {\n super(\n `${model}.${relation} points at model '${target}', which nothing has ` +\n `registered. The generated artifact and the registry disagree: re-run ` +\n `\\`prisma generate\\`, and check that app/models/generated/index.ts is ` +\n `imported. ` +\n (known.length > 0\n ? `Registered models: ${known.join(\", \")}.`\n : `Nothing is registered at all.`),\n );\n this.name = \"UnregisteredRelationTargetError\";\n }\n}\n\n/**\n * Thrown when a relation is registered on both sides but the two sides do not\n * describe a link the planner can follow: no matching `relationName` on the\n * other model, or a `from` / `to` naming a field that is not there. Like\n * `UnregisteredRelationTargetError`, it means a stale generated artifact — a\n * consistent one cannot produce it.\n */\nexport class MalformedRelationError extends Error {\n constructor(\n public readonly model: string,\n public readonly relation: string,\n detail: string,\n ) {\n super(\n `Cannot resolve how ${model}.${relation} joins: ${detail} This means ` +\n `app/models/generated is stale or hand-edited — re-run ` +\n `\\`prisma generate\\`.`,\n );\n this.name = \"MalformedRelationError\";\n }\n}\n\n/** Thrown when a relation resolves to a model name nothing registered. */\nexport class ModelNotRegisteredError extends Error {\n constructor(name: string, known: string[]) {\n super(\n `No model is registered under the name '${name}'. ` +\n (known.length > 0\n ? `Registered models: ${known.join(\", \")}.`\n : `Nothing is registered — is app/models/generated/index.ts imported?`),\n );\n this.name = \"ModelNotRegisteredError\";\n }\n}\n\n/** Thrown when a model class is used before the generator has given it a schema. */\nexport class MissingModelSchemaError extends Error {\n constructor(className: string) {\n super(\n `${className} has no $schema. Model subclasses must extend a generated ` +\n `base class from app/models/generated/models.ts.`,\n );\n this.name = \"MissingModelSchemaError\";\n }\n}\n\n/**\n * A `lock` asked for outside a transaction.\n *\n * A row lock is held until the transaction that took it ends. Outside one, the\n * statement is its own transaction, so the lock is released the moment the row\n * comes back — before the write it was meant to guard has even been issued. The\n * read would succeed and protect nothing, which is the failure this refuses: the\n * race the lock was written to close stays open, silently.\n *\n * Raised on SQLite too, where the lock itself compiles to nothing, so code that\n * forgot its transaction fails in development rather than first on Postgres.\n */\nexport class LockOutsideTransactionError extends Error {\n constructor(\n public readonly model: string,\n public readonly operation: string,\n ) {\n super(\n `${model}.${operation} was given 'lock' outside a transaction. A row ` +\n `lock lasts until the transaction that took it ends, so outside one it ` +\n `is released as soon as the row is read and protects nothing. Run the ` +\n `read and the writes it guards inside Model.transaction(async () => { ` +\n `... }).`,\n );\n this.name = \"LockOutsideTransactionError\";\n }\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AAQO,MAAM,UAA8B,KAAM,CAE7B,SACA,MACA,UAHlB,WAAW,CACO,EACA,EACA,EAsBhB,EACA,CACA,MACE,8BAA8B,WAAkB,KAAS,OACvD,CACJ,EA7BgB,gBACA,aACA,iBA4BhB,KAAK,KAAO,wBAEhB,CAuDO,MAAM,UAA6B,CAAsB,CAC9D,WAAW,CACT,EACA,EACA,EAEA,EACA,CACA,MAAM,EAAU,EAAO,EAAW,CAAM,EACxC,KAAK,KAAO,uBACZ,KAAK,QAAU,YAAY,OAAc,KAAS,OAAe,IAErE,CAEO,MAAM,UAAiC,CAAsB,CAClE,WAAW,CACT,EACA,EACA,EAEA,EACA,CACA,MAAM,EAAU,EAAO,EAAW,CAAM,EACxC,KAAK,KAAO,2BACZ,KAAK,QACH,gCAAgC,OAAc,KAAS,iDACV,IAEnD,CAOO,MAAM,UAA0B,KAAM,CAEzB,MACA,MAFlB,WAAW,CACO,EACA,EAChB,EACA,CACA,MACE,IAAI,8BAAkC,oBACnB,EAAM,KAAK,IAAI,IACpC,EAPgB,aACA,aAOhB,KAAK,KAAO,oBAEhB,CAYO,MAAM,UAAoB,KAAM,CAEnB,MACA,MAFlB,WAAW,CACO,EACA,EAChB,CACA,MACE,8BAA8B,KAAK,UAAU,OAAO,CAAK,CAAC,kBACpD,EAAM,cAAc,EAAM,4CAC9B,6EACA,eACJ,EARgB,aACA,aAQhB,KAAK,KAAO,cAEhB,CAOO,MAAM,UAA4B,KAAM,CAE3B,MACA,UAFlB,WAAW,CACO,EACA,EAChB,CACA,MAAM,MAAM,YAAgB,KAAS,KAAa,EAHlC,aACA,iBAGhB,KAAK,KAAO,sBAEhB,CAkBO,SAAS,CAAqB,CAAC,EAA8C,CAClF,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sBAAsB,EAAM,KAAK,IAAI,KACrC,gCACR,EAbgB,aACA,gBACA,cAYhB,KAAK,KAAO,kCAEhB,CASO,MAAM,UAA+B,KAAM,CAE9B,MACA,SAFlB,WAAW,CACO,EACA,EAChB,EACA,CACA,MACE,sBAAsB,KAAS,YAAmB,gBAChD,8DACA,oBACJ,EARgB,aACA,gBAQhB,KAAK,KAAO,yBAEhB,CAGO,MAAM,UAAgC,KAAM,CACjD,WAAW,CAAC,EAAc,EAAiB,CACzC,MACE,0CAA0C,QACvC,EAAM,OAAS,EACZ,sBAAsB,EAAM,KAAK,IAAI,KACrC,0EACR,EACA,KAAK,KAAO,0BAEhB,CAGO,MAAM,UAAgC,KAAM,CACjD,WAAW,CAAC,EAAmB,CAC7B,MACE,GAAG,4GAEL,EACA,KAAK,KAAO,0BAEhB,CAcO,MAAM,UAAoC,KAAM,CAEnC,MACA,UAFlB,WAAW,CACO,EACA,EAChB,CACA,MACE,GAAG,KAAS,yQAKd,EATgB,aACA,iBAShB,KAAK,KAAO,8BAEhB",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "E8932076CF2F8BBE64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{F as
|
|
2
|
+
import{Im as P}from"./chunk-zf1eqgzt.js";class F{provider="custom";supportsIdempotencyKey=!1;async deliver(j){let x=await this.send(j);return{ok:Boolean(x),id:null}}}class G extends F{apiKey;provider="resend";supportsIdempotencyKey=!0;constructor(j=process.env.RESEND_API_KEY){super();this.apiKey=j}async send(j){return(await this.deliver(j)).ok}async deliver(j){let{Resend:x}=await import("./chunk-6ge27ygx.js"),z=new x(this.apiKey),{idempotencyKey:A,...N}=j,{data:H,error:B}=await z.emails.send(N,A?{idempotencyKey:A}:void 0);if(B)return console.error(B),{ok:!1,id:null,error:B};if(H)return{ok:!0,id:H.id??null};return{ok:!1,id:null}}}function Z(j){return j}function J(){return{driver:new G,drivers:{},headers:{},filterRecipients:(j)=>j}}function Q(j){for(let x=j;x;x=Object.getPrototypeOf(x)){let z=Object.prototype.hasOwnProperty.call(x,"deliver"),A=Object.prototype.hasOwnProperty.call(x,"send");if(z)return!1;if(A)return!0}return!0}async function M(j,x){if(typeof j.deliver==="function"&&!Q(j))return j.deliver(x);return{ok:Boolean(await j.send(x)),id:null}}class U{static token="mail";driver;drivers;headers;recipientFilter;constructor(j={}){let x=J();this.driver=j.driver??x.driver,this.drivers=j.drivers??x.drivers,this.headers=j.headers??x.headers,this.recipientFilter=j.filterRecipients??x.filterRecipients}driverFor(j){if(j===void 0)return this.driver;let x=Object.hasOwn(this.drivers,j)?this.drivers[j]:void 0;if(!x){let z=Object.keys(this.drivers);throw Error(`No mail driver named "${j}". Register it under \`drivers\` in the mail config${z.length?` (registered: ${z.join(", ")})`:""}.`)}return x}filterRecipients(j){return this.recipientFilter(j)}send(j){return this.driver.send(j)}async deliver(j){return M(this.driver,j)}}
|
|
3
|
+
export{F as Ql,G as Rl,Z as Sl,J as Tl,M as Ul,U as Vl};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=9E1495A7D3CC4B8664756E2164756E21
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
"import { mailConfigDefaults, type MailConfig } from \"./config\";\nimport { deliverThrough } from \"./deliver\";\nimport type { EmailDriver } from \"./drivers/EmailDriver\";\nimport type { EmailDeliveryResult, SendEmailParams } from \"./drivers/types\";\n\nexport class MailManager {\n static token = \"mail\";\n\n readonly driver: EmailDriver;\n readonly drivers: Record<string, EmailDriver>;\n readonly headers: Record<string, string>;\n\n private readonly recipientFilter: NonNullable<MailConfig[\"filterRecipients\"]>;\n\n constructor(config: MailConfig = {}) {\n const defaults = mailConfigDefaults();\n\n this.driver = config.driver ?? defaults.driver;\n this.drivers = config.drivers ?? defaults.drivers;\n this.headers = config.headers ?? defaults.headers;\n this.recipientFilter = config.filterRecipients ?? defaults.filterRecipients;\n }\n\n /**\n * The driver registered as `name` in `drivers`, or the default `driver`\n * without a name. An unknown name throws rather than falling back, so a typo\n * can't send through the wrong provider.\n */\n driverFor(name?: string): EmailDriver {\n if (name === undefined) return this.driver;\n const driver = Object.hasOwn(this.drivers, name) ? this.drivers[name] : undefined;\n if (!driver) {\n const known = Object.keys(this.drivers);\n throw new Error(\n `No mail driver named \"${name}\". Register it under \\`drivers\\` in the mail config${known.length ? ` (registered: ${known.join(\", \")})` : \"\"}.`,\n );\n }\n return driver;\n }\n\n filterRecipients(emails: string[]): Promise<Array<string>> | Array<string> {\n return this.recipientFilter(emails);\n }\n\n send(params: SendEmailParams) {\n return this.driver.send(params);\n }\n\n /** Like `send`, but reports the outcome and the provider's message id. */\n async deliver(params: SendEmailParams): Promise<EmailDeliveryResult> {\n // A driver that doesn't extend `EmailDriver`, or a subclass that only\n // overrides `send`, is called through `send`.\n return deliverThrough(this.driver, params);\n }\n}\n"
|
|
10
10
|
],
|
|
11
11
|
"mappings": ";yCAEO,MAAe,CAAY,CAKvB,SAAmB,SAMnB,uBAAkC,QASrC,QAAO,CAAC,EAAuD,CACnE,IAAM,EAAK,MAAM,KAAK,KAAK,CAAM,EACjC,MAAO,CAAE,GAAI,QAAQ,CAAE,EAAG,GAAI,IAAK,EAEvC,CCvBO,MAAM,UAAqB,CAAY,CAIxB,OAHF,SAAW,SACX,uBAAyB,GAE3C,WAAW,CAAS,EAAS,QAAQ,IAAI,eAAgB,CACvD,MAAM,EADY,mBAId,KAAI,CAAC,EAAyB,CAClC,OAAQ,MAAM,KAAK,QAAQ,CAAM,GAAG,QAGvB,QAAO,CAAC,EAAuD,CAO5E,IAAQ,UAAW,KAAa,+BAC1B,EAAS,IAAI,EAAO,KAAK,MAAM,GAG7B,oBAAmB,GAAY,GAC/B,OAAM,SAAU,MAAM,EAAO,OAAO,KAC1C,EACA,EAAiB,CAAE,gBAAe,EAAI,MACxC,EAEA,GAAI,EAEF,OADA,QAAQ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I,CAAC,EAAQ,CACX,IAAM,EAAQ,OAAO,KAAK,KAAK,OAAO,EACtC,MAAU,MACR,yBAAyB,uDAA0D,EAAM,OAAS,iBAAiB,EAAM,KAAK,IAAI,KAAO,KAC3I,EAEF,OAAO,EAGT,gBAAgB,CAAC,EAA0D,CACzE,OAAO,KAAK,gBAAgB,CAAM,EAGpC,IAAI,CAAC,EAAyB,CAC5B,OAAO,KAAK,OAAO,KAAK,CAAM,OAI1B,QAAO,CAAC,EAAuD,CAGnE,OAAO,EAAe,KAAK,OAAQ,CAAM,EAE7C",
|
|
12
|
-
"debugId": "
|
|
12
|
+
"debugId": "9E1495A7D3CC4B8664756E2164756E21",
|
|
13
13
|
"names": []
|
|
14
14
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{M as
|
|
2
|
+
import{Ja as B,Ka as C,Ma as E}from"./chunk-hke4hzfm.js";import{Gl as x,Il as z,Jl as A}from"./chunk-nfher0gz.js";function M(b,f={}){let j=B(b,f.sourceLocale);return G(E(b),j,(q)=>C(b,q,j))}function N(b,f){let j=Object.keys(f);return G(b,j,(q)=>{let v=f[q]??f[j[0]];if(!v)return{};return v().then((k)=>k.default)})}function G(b,f,j){let q={id:b,locales:f,load:j};x(q);let v=()=>x(q);return{id:b,locales:f,load:(k)=>{return v(),z(b,k)},loadForRender:(k)=>{return v(),A(b,k)},get:(k)=>{v();let w=z(b,k);if(w instanceof Promise){w.catch(()=>{});return}return w}}}
|
|
3
|
+
export{M as ra,N as sa};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=4E419102194E06AE64756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import {\n dictionaryId,\n dictionaryLocales,\n localeStrings,\n type DictionaryTranslations,\n type LocaleStrings,\n} from \"./dictionaryShape\";\nimport {\n loadDictionary,\n loadDictionaryForRender,\n registerDictionary,\n type RenderThenable,\n} from \"./dictionaryRegistry\";\n\ndeclare const brand: unique symbol;\n\nexport interface DictionaryHandle<\n T extends DictionaryTranslations = DictionaryTranslations,\n> {\n readonly id: string;\n /** Locales this dictionary declares, source language first. */\n readonly locales: readonly string[];\n /**\n * Strings for `locale`. Synchronous when they are already in memory —\n * always, for an unbundled dictionary; after a preload or the SSR seed, for a\n * bundled one.\n */\n load(locale: string): LocaleStrings | Promise<LocaleStrings>;\n /**\n * `load`, but as the exact thing React's `use()` wants: never rejecting, so\n * a failed locale chunk degrades the component to rendering keys instead of\n * unmounting it into an error boundary; and always a thenable, even when the\n * strings are already in memory. The caller skips `use()` only for a\n * thenable built from strings already in hand, which carries them as\n * `inHand`; every thenable a render could have suspended on still goes\n * through it. `loadDictionaryForRender` has the whole reasoning.\n */\n loadForRender(locale: string): RenderThenable;\n get(locale: string): LocaleStrings | undefined;\n /** Type-only: carries the literal's shape through to `useDictionary`. */\n readonly [brand]?: T;\n}\n\n/**\n * Declare the strings a component needs, next to the component.\n *\n * ```ts\n * export const homeDict = defineDictionary({\n * title: { \"en-US\": \"Welcome {{name}}\", \"tr-TR\": \"Hoş geldin {{name}}\" },\n * });\n * ```\n *\n * As written this holds every locale. Under gemi's Vite plugin the call is\n * rewritten so each locale becomes its own chunk and a page downloads only the\n * one it renders in — but the plugin is strictly an optimization, and the\n * behaviour is identical without it (in `bun test`, and in server code that\n * does not go through the bundler).\n *\n * The first locale in the literal is the source language: a key missing from\n * another locale falls back to it rather than rendering as its own key.\n */\nexport interface DefineDictionaryOptions {\n /**\n * The locale this dictionary is authored in. Keys missing from another locale\n * fall back to it, and it is what renders when the app has no locale\n * configured.\n *\n * Optional, but worth setting on any dictionary that is not uniformly\n * translated: without it the source language is whichever locale appears\n * first in the literal, so adding a key at the top can re-point every\n * fallback in the dictionary.\n */\n sourceLocale?: string;\n}\n\nexport function defineDictionary<const T extends DictionaryTranslations>(\n translations: T,\n options: DefineDictionaryOptions = {},\n): DictionaryHandle<T> {\n const locales = dictionaryLocales(translations, options.sourceLocale);\n return createHandle(dictionaryId(translations), locales, (locale) =>\n localeStrings(translations, locale, locales),\n );\n}\n\n/**\n * The rewritten form of a `defineDictionary` call — emitted by\n * `packages/gemi/vite/dictionaryPlugin.ts`, never written by hand. `loaders`\n * holds one dynamic import per locale so the bundler emits one chunk per\n * locale and the untaken ones never reach the browser.\n */\nexport function __gemi_dict__<\n const T extends DictionaryTranslations = DictionaryTranslations,\n>(\n id: string,\n loaders: Record<string, () => Promise<{ default: LocaleStrings }>>,\n): DictionaryHandle<T> {\n const locales = Object.keys(loaders);\n return createHandle(id, locales, (locale) => {\n // An unknown locale falls back to the source language, matching what\n // `localeStrings` does per key on the unbundled path.\n const load = loaders[locale] ?? loaders[locales[0]];\n if (!load) {\n return {};\n }\n return load().then((mod) => mod.default);\n });\n}\n\nfunction createHandle<T extends DictionaryTranslations>(\n id: string,\n locales: string[],\n load: (locale: string) => LocaleStrings | Promise<LocaleStrings>,\n): DictionaryHandle<T> {\n const entry = { id, locales, load };\n registerDictionary(entry);\n\n // Re-asserted on every read rather than only at construction. A handle is\n // created once, at module scope, but the registry it delegates to can be\n // emptied under it — a test's `afterEach` reset, an HMR boundary — and the\n // handle would then be permanently orphaned, throwing \"Unknown dictionary\"\n // for a dictionary the caller is holding. `registerDictionary` is a no-op\n // when the id is already there, so this costs one Map lookup.\n const ensure = () => registerDictionary(entry);\n\n return {\n id,\n locales,\n // Routed through the registry rather than calling `load` directly so\n // concurrent readers share one in-flight import and results are cached.\n load: (locale: string) => {\n ensure();\n return loadDictionary(id, locale);\n },\n loadForRender: (locale: string) => {\n ensure();\n return loadDictionaryForRender(id, locale);\n },\n get: (locale: string) => {\n ensure();\n const strings = loadDictionary(id, locale);\n if (strings instanceof Promise) {\n // Nothing downstream awaits this one — `get` is the synchronous peek,\n // and the caller is about to discard it. An unattached rejection (a\n // locale chunk that 404s mid-deploy) would surface as an\n // `unhandledRejection`, which under Node's default handler takes the\n // process down over one missing translation file. The load itself is\n // still cached and still retried through `loadDictionary`.\n strings.catch(() => {});\n return undefined;\n }\n return strings;\n },\n };\n}\n\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";wHA2EO,GAAS,CAAwD,CACtE,EACA,EAAmC,CAAC,EACf,CACrB,IAAM,EAAU,EAAkB,EAAc,EAAQ,YAAY,EACpE,OAAO,EAAa,EAAa,CAAY,EAAG,EAAS,CAAC,IACxD,EAAc,EAAc,EAAQ,CAAO,CAC7C,EASK,SAAS,CAEf,CACC,EACA,EACqB,CACrB,IAAM,EAAU,OAAO,KAAK,CAAO,EACnC,OAAO,EAAa,EAAI,EAAS,CAAC,IAAW,CAG3C,IAAM,EAAO,EAAQ,IAAW,EAAQ,EAAQ,IAChD,GAAI,CAAC,EACH,MAAO,CAAC,EAEV,OAAO,EAAK,EAAE,KAAK,CAAC,IAAQ,EAAI,OAAO,EACxC,EAGH,SAAS,CAA8C,CACrD,EACA,EACA,EACqB,CACrB,IAAM,EAAQ,CAAE,KAAI,UAAS,MAAK,EAClC,EAAmB,CAAK,EAQxB,IAAM,EAAS,IAAM,EAAmB,CAAK,EAE7C,MAAO,CACL,KACA,UAGA,KAAM,CAAC,IAAmB,CAExB,OADA,EAAO,EACA,EAAe,EAAI,CAAM,GAElC,cAAe,CAAC,IAAmB,CAEjC,OADA,EAAO,EACA,EAAwB,EAAI,CAAM,GAE3C,IAAK,CAAC,IAAmB,CACvB,EAAO,EACP,IAAM,EAAU,EAAe,EAAI,CAAM,EACzC,GAAI,aAAmB,QAAS,CAO9B,EAAQ,MAAM,IAAM,EAAE,EACtB,OAEF,OAAO,EAEX",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "4E419102194E06AE64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|