gemi 0.144.0 → 0.145.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/AgentController.d.ts +2 -2
- package/dist/ai/AgentController.d.ts.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 +11 -11
- package/dist/ai/index.js.map +3 -3
- package/dist/ai/store/Nonces.d.ts +68 -0
- package/dist/ai/store/Nonces.d.ts.map +1 -1
- package/dist/ai/store/index.d.ts +1 -1
- package/dist/ai/store/index.d.ts.map +1 -1
- package/dist/app/index.js +1 -1
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-fg2k18d2.js → chunk-0k8fk96c.js} +2 -2
- package/dist/{chunk-fg2k18d2.js.map → chunk-0k8fk96c.js.map} +1 -1
- package/dist/{chunk-y5yac6n1.js → chunk-0mt7kqwx.js} +2 -2
- package/dist/{chunk-y5yac6n1.js.map → chunk-0mt7kqwx.js.map} +1 -1
- package/dist/{chunk-1ed75a7b.js → chunk-1fyn63ka.js} +3 -3
- package/dist/{chunk-1ed75a7b.js.map → chunk-1fyn63ka.js.map} +1 -1
- package/dist/{chunk-tkvamktq.js → chunk-1ttd4rn9.js} +2 -2
- package/dist/{chunk-tkvamktq.js.map → chunk-1ttd4rn9.js.map} +1 -1
- package/dist/{chunk-m70hn4eg.js → chunk-1wz6kwjc.js} +2 -2
- package/dist/{chunk-m70hn4eg.js.map → chunk-1wz6kwjc.js.map} +1 -1
- package/dist/{chunk-fsem81ec.js → chunk-29jmaj16.js} +1 -1
- package/dist/{chunk-fpz9e3xx.js → chunk-2b3hh9xw.js} +3 -3
- package/dist/{chunk-fpz9e3xx.js.map → chunk-2b3hh9xw.js.map} +1 -1
- package/dist/{chunk-n9zycjm1.js → chunk-2djjs8f1.js} +3 -3
- package/dist/{chunk-n9zycjm1.js.map → chunk-2djjs8f1.js.map} +1 -1
- package/dist/{chunk-p81qeav5.js → chunk-2ery6a75.js} +3 -3
- package/dist/{chunk-p81qeav5.js.map → chunk-2ery6a75.js.map} +1 -1
- package/dist/{chunk-hyhbk12v.js → chunk-2k3935ke.js} +2 -2
- package/dist/{chunk-hyhbk12v.js.map → chunk-2k3935ke.js.map} +1 -1
- package/dist/{chunk-qt6x2r6a.js → chunk-2x6cv37t.js} +2 -2
- package/dist/{chunk-qt6x2r6a.js.map → chunk-2x6cv37t.js.map} +1 -1
- package/dist/{chunk-68f0jpje.js → chunk-313593t3.js} +2 -2
- package/dist/{chunk-68f0jpje.js.map → chunk-313593t3.js.map} +1 -1
- package/dist/{chunk-5qfzvnyp.js → chunk-3csz8pfk.js} +3 -3
- package/dist/{chunk-5qfzvnyp.js.map → chunk-3csz8pfk.js.map} +1 -1
- package/dist/{chunk-rezmtdyt.js → chunk-3x8zrsby.js} +2 -2
- package/dist/{chunk-rezmtdyt.js.map → chunk-3x8zrsby.js.map} +1 -1
- package/dist/{chunk-6d3m2w2p.js → chunk-43ws58db.js} +2 -2
- package/dist/{chunk-6d3m2w2p.js.map → chunk-43ws58db.js.map} +1 -1
- package/dist/chunk-49s8wwp2.js +5 -0
- package/dist/{chunk-b6mgrrk6.js.map → chunk-49s8wwp2.js.map} +1 -1
- package/dist/{chunk-ncb1qtae.js → chunk-4d4td4k9.js} +2 -2
- package/dist/{chunk-ncb1qtae.js.map → chunk-4d4td4k9.js.map} +1 -1
- package/dist/{chunk-v57ndv0h.js → chunk-4jd25v6d.js} +2 -2
- package/dist/{chunk-v57ndv0h.js.map → chunk-4jd25v6d.js.map} +1 -1
- package/dist/{chunk-78bfmwp0.js → chunk-4m0eqq80.js} +2 -2
- package/dist/{chunk-78bfmwp0.js.map → chunk-4m0eqq80.js.map} +1 -1
- package/dist/{chunk-ktrm6y5j.js → chunk-563ksar3.js} +3 -3
- package/dist/{chunk-ktrm6y5j.js.map → chunk-563ksar3.js.map} +1 -1
- package/dist/{chunk-z80v4z8y.js → chunk-5q2pmve9.js} +2 -2
- package/dist/{chunk-z80v4z8y.js.map → chunk-5q2pmve9.js.map} +1 -1
- package/dist/{chunk-20d0n391.js → chunk-5yz684rw.js} +2 -2
- package/dist/{chunk-20d0n391.js.map → chunk-5yz684rw.js.map} +1 -1
- package/dist/{chunk-236be97q.js → chunk-63xwah5k.js} +1 -1
- package/dist/{chunk-b4jx4fzq.js → chunk-65wy1r1a.js} +1 -1
- package/dist/{chunk-9tgcmx4h.js → chunk-70yz9e7f.js} +2 -2
- package/dist/{chunk-9tgcmx4h.js.map → chunk-70yz9e7f.js.map} +1 -1
- package/dist/{chunk-t03nda3s.js → chunk-73rzf7ys.js} +2 -2
- package/dist/{chunk-t03nda3s.js.map → chunk-73rzf7ys.js.map} +1 -1
- package/dist/{chunk-1cn7ets3.js → chunk-7txqv2qq.js} +3 -3
- package/dist/{chunk-1cn7ets3.js.map → chunk-7txqv2qq.js.map} +1 -1
- package/dist/{chunk-1skdsmjx.js → chunk-86zhngpg.js} +2 -2
- package/dist/{chunk-1skdsmjx.js.map → chunk-86zhngpg.js.map} +1 -1
- package/dist/{chunk-ce9wm3r9.js → chunk-877yc341.js} +3 -3
- package/dist/{chunk-ce9wm3r9.js.map → chunk-877yc341.js.map} +1 -1
- package/dist/{chunk-wffc5k3m.js → chunk-87y2nrjy.js} +2 -2
- package/dist/{chunk-wffc5k3m.js.map → chunk-87y2nrjy.js.map} +1 -1
- package/dist/{chunk-9zd7c4wq.js → chunk-8k346pjw.js} +14 -14
- package/dist/{chunk-9zd7c4wq.js.map → chunk-8k346pjw.js.map} +3 -3
- package/dist/{chunk-27xsjq8a.js → chunk-8km4drvv.js} +3 -3
- package/dist/{chunk-27xsjq8a.js.map → chunk-8km4drvv.js.map} +1 -1
- package/dist/{chunk-sa6a0wy1.js → chunk-94hcjdbe.js} +2 -2
- package/dist/{chunk-sa6a0wy1.js.map → chunk-94hcjdbe.js.map} +1 -1
- package/dist/{chunk-kaphqnpp.js → chunk-9z8zq4rx.js} +3 -3
- package/dist/{chunk-kaphqnpp.js.map → chunk-9z8zq4rx.js.map} +1 -1
- package/dist/{chunk-8ex0y47w.js → chunk-apga49vp.js} +2 -2
- package/dist/{chunk-8ex0y47w.js.map → chunk-apga49vp.js.map} +1 -1
- package/dist/{chunk-yjszzjyj.js → chunk-attr793y.js} +2 -2
- package/dist/{chunk-yjszzjyj.js.map → chunk-attr793y.js.map} +1 -1
- package/dist/{chunk-1x9ghjpt.js → chunk-bsa6b82q.js} +1 -1
- package/dist/{chunk-ceb4jcrm.js → chunk-bstn00nx.js} +2 -2
- package/dist/{chunk-ceb4jcrm.js.map → chunk-bstn00nx.js.map} +1 -1
- package/dist/{chunk-azd6da5h.js → chunk-bykkqvd8.js} +2 -2
- package/dist/{chunk-azd6da5h.js.map → chunk-bykkqvd8.js.map} +1 -1
- package/dist/{chunk-9k46m1vf.js → chunk-cee5gq7t.js} +2 -2
- package/dist/{chunk-9k46m1vf.js.map → chunk-cee5gq7t.js.map} +1 -1
- package/dist/{chunk-9dkpv8ev.js → chunk-dxh8njb4.js} +2 -2
- package/dist/{chunk-9dkpv8ev.js.map → chunk-dxh8njb4.js.map} +1 -1
- package/dist/{chunk-maqkrbsb.js → chunk-e06t0625.js} +2 -2
- package/dist/{chunk-maqkrbsb.js.map → chunk-e06t0625.js.map} +1 -1
- package/dist/{chunk-0839f72f.js → chunk-e9z8p2fy.js} +2 -2
- package/dist/{chunk-0839f72f.js.map → chunk-e9z8p2fy.js.map} +1 -1
- package/dist/{chunk-6hs102jh.js → chunk-eqv7yxk7.js} +2 -2
- package/dist/{chunk-6hs102jh.js.map → chunk-eqv7yxk7.js.map} +1 -1
- package/dist/{chunk-m6t5a0me.js → chunk-fqqbnp0z.js} +2 -2
- package/dist/{chunk-m6t5a0me.js.map → chunk-fqqbnp0z.js.map} +1 -1
- package/dist/{chunk-1w5dnkd1.js → chunk-g22kph4n.js} +2 -2
- package/dist/{chunk-1w5dnkd1.js.map → chunk-g22kph4n.js.map} +1 -1
- package/dist/{chunk-rvm5mkwm.js → chunk-g8sh9btf.js} +2 -2
- package/dist/{chunk-rvm5mkwm.js.map → chunk-g8sh9btf.js.map} +1 -1
- package/dist/{chunk-a78b9v7h.js → chunk-gvdg52ew.js} +4 -4
- package/dist/{chunk-a78b9v7h.js.map → chunk-gvdg52ew.js.map} +1 -1
- package/dist/{chunk-8ky8cmde.js → chunk-h8eawyhx.js} +2 -2
- package/dist/{chunk-8ky8cmde.js.map → chunk-h8eawyhx.js.map} +1 -1
- package/dist/{chunk-r567t83k.js → chunk-hcw671mg.js} +4 -4
- package/dist/{chunk-r567t83k.js.map → chunk-hcw671mg.js.map} +1 -1
- package/dist/{chunk-ej4kf7m5.js → chunk-hh5bs656.js} +3 -3
- package/dist/{chunk-ej4kf7m5.js.map → chunk-hh5bs656.js.map} +1 -1
- package/dist/{chunk-3q7sc68p.js → chunk-j6ygdvj8.js} +2 -2
- package/dist/{chunk-3q7sc68p.js.map → chunk-j6ygdvj8.js.map} +1 -1
- package/dist/{chunk-t2nsn0r2.js → chunk-jzpbwvbt.js} +2 -2
- package/dist/{chunk-t2nsn0r2.js.map → chunk-jzpbwvbt.js.map} +1 -1
- package/dist/{chunk-en33hg1c.js → chunk-k79ajvtc.js} +2 -2
- package/dist/{chunk-en33hg1c.js.map → chunk-k79ajvtc.js.map} +1 -1
- package/dist/{chunk-t0wfj6hy.js → chunk-k8pn2qvf.js} +2 -2
- package/dist/{chunk-t0wfj6hy.js.map → chunk-k8pn2qvf.js.map} +1 -1
- package/dist/{chunk-83cvkhzn.js → chunk-kmh402m4.js} +2 -2
- package/dist/{chunk-83cvkhzn.js.map → chunk-kmh402m4.js.map} +1 -1
- package/dist/{chunk-b4mg6v4g.js → chunk-m9am5fqq.js} +5 -5
- package/dist/{chunk-b4mg6v4g.js.map → chunk-m9am5fqq.js.map} +3 -3
- package/dist/{chunk-m8yd59gg.js → chunk-mr3szvr3.js} +2 -2
- package/dist/{chunk-m8yd59gg.js.map → chunk-mr3szvr3.js.map} +1 -1
- package/dist/{chunk-mkw35cz7.js → chunk-mtamgvf4.js} +2 -2
- package/dist/{chunk-mkw35cz7.js.map → chunk-mtamgvf4.js.map} +1 -1
- package/dist/{chunk-5xfpqda5.js → chunk-mv1rs9he.js} +1 -1
- package/dist/{chunk-s29tgy4y.js → chunk-mzkzgp2j.js} +2 -2
- package/dist/{chunk-s29tgy4y.js.map → chunk-mzkzgp2j.js.map} +1 -1
- package/dist/{chunk-9xzg05xg.js → chunk-n9n4qt20.js} +3 -3
- package/dist/{chunk-9xzg05xg.js.map → chunk-n9n4qt20.js.map} +1 -1
- package/dist/{chunk-2ra5skyk.js → chunk-p27y4xrw.js} +2 -2
- package/dist/{chunk-2ra5skyk.js.map → chunk-p27y4xrw.js.map} +1 -1
- package/dist/{chunk-sgwgj2q0.js → chunk-pq657qcp.js} +1 -1
- package/dist/{chunk-63q7ycwt.js → chunk-pwbm3x1y.js} +2 -2
- package/dist/{chunk-63q7ycwt.js.map → chunk-pwbm3x1y.js.map} +1 -1
- package/dist/{chunk-w4ma7978.js → chunk-q4qw629n.js} +2 -2
- package/dist/{chunk-w4ma7978.js.map → chunk-q4qw629n.js.map} +1 -1
- package/dist/{chunk-f2e7n064.js → chunk-q9na1syb.js} +2 -2
- package/dist/{chunk-f2e7n064.js.map → chunk-q9na1syb.js.map} +1 -1
- package/dist/{chunk-x0t3t7g3.js → chunk-rkbwb3v5.js} +2 -2
- package/dist/{chunk-x0t3t7g3.js.map → chunk-rkbwb3v5.js.map} +1 -1
- package/dist/{chunk-0t2ym9ap.js → chunk-rma7afjd.js} +3 -3
- package/dist/{chunk-0t2ym9ap.js.map → chunk-rma7afjd.js.map} +1 -1
- package/dist/{chunk-f5qdyw45.js → chunk-tr9ynv3w.js} +2 -2
- package/dist/{chunk-f5qdyw45.js.map → chunk-tr9ynv3w.js.map} +1 -1
- package/dist/{chunk-kzc6bn8n.js → chunk-twrf6d08.js} +2 -2
- package/dist/{chunk-kzc6bn8n.js.map → chunk-twrf6d08.js.map} +1 -1
- package/dist/{chunk-6jd0e1dz.js → chunk-v9z4x5j2.js} +2 -2
- package/dist/{chunk-6jd0e1dz.js.map → chunk-v9z4x5j2.js.map} +1 -1
- package/dist/{chunk-jmhrpfqn.js → chunk-vm5t0j24.js} +2 -2
- package/dist/{chunk-jmhrpfqn.js.map → chunk-vm5t0j24.js.map} +1 -1
- package/dist/{chunk-a37shxb1.js → chunk-xv58jnpb.js} +2 -2
- package/dist/{chunk-a37shxb1.js.map → chunk-xv58jnpb.js.map} +1 -1
- package/dist/{chunk-p57nt0pm.js → chunk-ydkv9e8w.js} +3 -3
- package/dist/{chunk-p57nt0pm.js.map → chunk-ydkv9e8w.js.map} +1 -1
- package/dist/{chunk-aw8gj99f.js → chunk-ymdpt00k.js} +2 -2
- package/dist/{chunk-aw8gj99f.js.map → chunk-ymdpt00k.js.map} +1 -1
- package/dist/{chunk-5g7m7g4a.js → chunk-z7tsh9qr.js} +3 -3
- package/dist/{chunk-5g7m7g4a.js.map → chunk-z7tsh9qr.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/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/index.d.ts +2 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +9 -9
- package/dist/services/index.js.map +4 -3
- package/dist/services/mcp/http/McpHttpServer.d.ts +81 -1
- package/dist/services/mcp/http/McpHttpServer.d.ts.map +1 -1
- package/dist/services/mcp/http/oauth/prismaStore.d.ts +112 -0
- package/dist/services/mcp/http/oauth/prismaStore.d.ts.map +1 -0
- 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 +1 -1
- package/package.json +1 -1
- package/dist/chunk-b6mgrrk6.js +0 -5
- /package/dist/{chunk-fsem81ec.js.map → chunk-29jmaj16.js.map} +0 -0
- /package/dist/{chunk-236be97q.js.map → chunk-63xwah5k.js.map} +0 -0
- /package/dist/{chunk-b4jx4fzq.js.map → chunk-65wy1r1a.js.map} +0 -0
- /package/dist/{chunk-1x9ghjpt.js.map → chunk-bsa6b82q.js.map} +0 -0
- /package/dist/{chunk-5xfpqda5.js.map → chunk-mv1rs9he.js.map} +0 -0
- /package/dist/{chunk-sgwgj2q0.js.map → chunk-pq657qcp.js.map} +0 -0
|
@@ -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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AChB,EACA,CACA,MACE,IAAI,iCAAwC,OACzC,EAAM,OAAS,EACZ,oBAAoB,EAAM,KAAK,IAAI,KACnC,GAAG,2BACX,EATgB,gBACA,aAShB,KAAK,KAAO,uBAEhB,CAYO,MAAM,UAAmC,KAAM,CAElC,MACA,MAFlB,WAAW,CACO,EACA,EAChB,CACA,MACE,oCAAoC,8BAC/B,kIAEH,wDACJ,EARgB,aACA,aAQhB,KAAK,KAAO,6BAEhB,CAOO,MAAM,UAAwC,KAAM,CAEvC,MACA,SACA,OAHlB,WAAW,CACO,EACA,EACA,EAChB,EACA,CACA,MACE,GAAG,KAAS,sBAA6B,8KAItC,EAAM,OAAS,EACZ,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": "8AF2550E5FFCFA7A64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{B as
|
|
2
|
+
import{Rk as x}from"./chunk-mr3szvr3.js";function B(j){return j}function C(){return{supportedLocales:[],defaultLocale:"en-US",prefetch:{},components:{},detectLocale:()=>null,onLocaleChange:(j)=>{console.log(`Locale changed to ${j}`)},timeZone:x,detectTimeZone:()=>null}}
|
|
3
|
+
export{B as Zd,C as _d};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=9A4234C58DC3B74F64756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import { DEFAULT_TIME_ZONE } from \"./formatter\";\nimport type { Dictionary } from \"./Dictionary\";\nimport type { HttpRequest } from \"../http/HttpRequest\";\n\n// Config key: `translation`. Derived from `I18nServiceProvider`.\nexport interface TranslationConfig {\n supportedLocales?: string[];\n defaultLocale?: string;\n /**\n * @deprecated Only for `Dictionary.create` dictionaries. A `defineDictionary`\n * dictionary needs no entry here — the component that reads it pulls it in,\n * and the bundler ships only the active locale.\n */\n prefetch?: Record<string, Array<Dictionary<any>>>;\n /** @deprecated Only for `Dictionary.create` dictionaries. See `prefetch`. */\n components?: Record<string, Dictionary<any>>;\n\n // Returning `null` falls back to gemi's own locale detection.\n detectLocale?: (req: HttpRequest) => string | null;\n onLocaleChange?: (locale: string) => Promise<void> | void;\n\n /**\n * The IANA time zone dates are formatted in by `useFormatter`,\n * `useDictionary(...).format` and `Lang.formatter()`. Defaults to `UTC`.\n *\n * One zone for server and browser alike, so a server-rendered date and its\n * hydrated copy print the same text. Override per call with\n * `format.date(value, { timeZone })`.\n */\n timeZone?: string;\n /**\n * Resolve the zone for one request, e.g. from a cookie or the signed-in\n * user's profile. Returning `null` (or a zone `Intl` does not know) falls back\n * to `timeZone`. Runs on the server; the result ships with the page.\n */\n detectTimeZone?: (req: HttpRequest) => string | null;\n}\n\nexport function defineTranslationConfig(\n config: TranslationConfig,\n): TranslationConfig {\n return config;\n}\n\nexport function translationConfigDefaults(): Required<TranslationConfig> {\n return {\n supportedLocales: [],\n defaultLocale: \"en-US\",\n prefetch: {},\n components: {},\n detectLocale: () => null,\n onLocaleChange: (locale) => {\n console.log(`Locale changed to ${locale}`);\n },\n timeZone: DEFAULT_TIME_ZONE,\n detectTimeZone: () => null,\n };\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";yCAsCO,SAAS,CAAuB,CACrC,EACmB,CACnB,OAAO,EAGF,SAAS,CAAyB,EAAgC,CACvE,MAAO,CACL,iBAAkB,CAAC,EACnB,cAAe,QACf,SAAU,CAAC,EACX,WAAY,CAAC,EACb,aAAc,IAAM,KACpB,eAAgB,CAAC,IAAW,CAC1B,QAAQ,IAAI,qBAAqB,GAAQ,GAE3C,SAAU,EACV,eAAgB,IAAM,IACxB",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "9A4234C58DC3B74F64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ql as J}from"./chunk-fqqbnp0z.js";class L{kernel;onException;constructor(f){this.kernel=new f.kernel,this.kernel.boot.call(this.kernel),this.onException=f.onException??((A)=>{console.error("Unhandled exception in App:",A)})}async waitForBoot(){await this.kernel.waitForBoot()}getComponentTree(){return this.kernel.viewRoutes().componentTree}getFlatComponentTree(){let f=new Set;for(let A of this.kernel.domains().viewDispatchers())for(let C of A.flatComponentTree)f.add(C);return Array.from(f)}devAllowedHosts(){let f=this.kernel.domains();if(!f.resolver)return[];return f.acceptsCustomDomains?!0:[`.${f.resolver.root}`]}sockets(){return this.kernel.sockets.call(this.kernel)}applyTrustedClientIp(f){this.kernel.domains().applyClientIp(f)}getRouteManifest(){return this.kernel.viewRoutes().routeManifest}globallyGated=new WeakMap;async withGlobalMiddleware(f,A,C){let z;try{z=await this.kernel.run.call(this.kernel,()=>this.kernel.globalMiddleware(f))}catch(F){return await C(F)}if(z.refusal)return z.refusal;return this.globallyGated.set(f,z.carried),z.apply(await A(f))}async fetch(f){let A=new URL(f.url);return this.kernel.run.call(this.kernel,async()=>{this.applyTrustedClientIp(f);let C=this.globallyGated.has(f),z=C?null:await this.kernel.globalMiddleware(f),F=C?this.globallyGated.get(f):z.carried;if(z?.refusal)return z.refusal;let H=this.kernel.mcpHttp();if(H){let B=await H.handle(f);if(B)return z?z.apply(B):B}let I=this.kernel.domains(),D=await I.ask(f)??await I.route(f);if(D instanceof Response)return z?z.apply(D):D;if(!D){let B=new Response("Unknown host",{status:404});return z?z.apply(B):B}let G=J(A.pathname)?await D.api.handleApiRequest(f,F):await D.view.handleViewRequest(f,F);if(!z)return G;if(typeof G==="function"){let B=G;return async(...M)=>z.apply(await B(...M))}return z.apply(G)})}dispatchJob(f,A){return this.kernel.run.bind(this.kernel)(()=>{return this.kernel.queue().dispatchJob(f,A)})}shutdown(f){return this.kernel.shutdown(f)}destroy(){this.kernel.destroy()}clone(){return Object.assign(Object.create(Object.getPrototypeOf(this)),this)}}export{L as Da};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=77A19EB97244226164756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import type { Kernel } from \"../kernel\";\nimport type { CarriedContext } from \"../http/requestContext\";\nimport { isApiPath } from \"../services/router/apiPath\";\nimport type { SocketHub } from \"../services/broadcast/SocketHub\";\n\n/** What the servers use of the broadcast `SocketHub`. */\nexport type SocketTransport = Pick<\n SocketHub,\n \"matches\" | \"upgrade\" | \"websocket\" | \"socketOptions\" | \"start\" | \"shutdown\"\n>;\n\ninterface AppParams {\n kernel: new () => Kernel;\n onException?: (error: Error) => void;\n}\n\nexport class App {\n private kernel: Kernel;\n public onException?: (error: Error) => void;\n\n constructor(params: AppParams) {\n this.kernel = new params.kernel();\n this.kernel.boot.call(this.kernel);\n this.onException =\n params.onException ??\n ((error: Error) => {\n console.error(\"Unhandled exception in App:\", error);\n });\n }\n\n // Every service this class touches is resolved through a `this.kernel.*`\n // accessor rather than by importing the service class and calling `app()`\n // here. That is deliberate: the built bin (`dist/bin/gemi.js`) bundles its own\n // copy of gemi, while the app's Kernel is loaded from source and resolves\n // `gemi/*` to the source modules — so the two copies have *different*\n // `kernelContext` AsyncLocalStorage instances and different `Application`\n // class objects. A method call on the Kernel executes in the app's copy and\n // reads the app's container; a resolution attempted here would not. Service\n // *tokens* still cross the boundary safely (they are plain strings), which is\n // why `kernel.resolve()` works from either side.\n public async waitForBoot() {\n await this.kernel.waitForBoot();\n }\n\n public getComponentTree() {\n return this.kernel.viewRoutes().componentTree;\n }\n\n // Every host group's views, not just the root's: the servers load these\n // modules up front, and a view only an `admin.` group routes to still has\n // to be among them.\n public getFlatComponentTree() {\n const views = new Set<string>();\n for (const dispatcher of this.kernel.domains().viewDispatchers()) {\n for (const view of dispatcher.flatComponentTree) {\n views.add(view);\n }\n }\n return Array.from(views);\n }\n\n /**\n * The hosts the dev server's Vite may answer: the `route.domains` root and\n * its subdomains, or any host when custom domains are on, since those are\n * only known to the app's resolver.\n */\n public devAllowedHosts(): true | string[] {\n const domains = this.kernel.domains();\n if (!domains.resolver) {\n return [];\n }\n return domains.acceptsCustomDomains ? true : [`.${domains.resolver.root}`];\n }\n\n /**\n * The broadcast WebSocket endpoint the servers wire into `Bun.serve`, or\n * `null` when the app has no `route.channels`. Typed structurally: the hub\n * belongs to the app's copy of gemi (see the note above).\n */\n public sockets(): SocketTransport | null {\n return this.kernel.sockets.call(this.kernel);\n }\n\n /**\n * Applies `route.domains.trustProxy.clientIpHeader`, or\n * `GEMI_CLIENT_IP_HEADER` for an app without `route.domains`: on a request\n * that carries the proxy's secret, the address that header names becomes\n * the one in `X-Forwarded-For`. The servers call it right after settling\n * `X-Forwarded-For` (`GEMI_TRUST_PROXY`) and before anything reads it —\n * the socket upgrade and the global middleware included. `fetch` calls it\n * too, for a caller that is not one of the servers. Idempotent.\n */\n public applyTrustedClientIp(req: Request) {\n this.kernel.domains().applyClientIp(req);\n }\n\n public getRouteManifest() {\n return this.kernel.viewRoutes().routeManifest;\n }\n\n // Requests `withGlobalMiddleware` already ran the global middleware for, so\n // `fetch` inside it does not run the list a second time, and can still hand\n // the route what the list carried. Keyed by the Request object: the servers\n // hand `fetch` the same one they gated.\n private globallyGated = new WeakMap<Request, CarriedContext | null>();\n\n /**\n * Runs the `global` middleware list, then `next` — what the servers put in\n * front of everything they serve, so the list covers static files, which\n * never reach `fetch`, as well as routes. A refusal is answered without\n * calling `next`. A global middleware that throws something other than a\n * break is answered by `onError` rather than by `next`, since a gate that\n * failed must not let a static file through.\n */\n public async withGlobalMiddleware(\n req: Request,\n next: (req: Request) => Promise<Response>,\n onError: (err: unknown) => Response | Promise<Response>,\n ): Promise<Response> {\n let outcome: Awaited<ReturnType<Kernel[\"globalMiddleware\"]>>;\n try {\n outcome = await this.kernel.run.call(this.kernel, () => this.kernel.globalMiddleware(req));\n } catch (err) {\n return await onError(err);\n }\n if (outcome.refusal) {\n return outcome.refusal;\n }\n this.globallyGated.set(req, outcome.carried);\n return outcome.apply(await next(req));\n }\n\n public async fetch(req: Request): Promise<Response> {\n const url = new URL(req.url);\n return this.kernel.run.call(this.kernel, async () => {\n // Repeated from the servers, for a caller that is not one of them.\n this.applyTrustedClientIp(req);\n // Run here too for a caller that is not one of the servers, a test or an\n // app's own `Bun.serve`, so the list is not skipped by calling `fetch`.\n const gated = this.globallyGated.has(req);\n const outcome = gated ? null : await this.kernel.globalMiddleware(req);\n const carried = gated ? this.globallyGated.get(req) : outcome.carried;\n if (outcome?.refusal) {\n return outcome.refusal;\n }\n // The MCP endpoint, and its OAuth endpoints, on the host it is\n // configured for. Ahead of routing, so no route can shadow it, and after\n // the global middleware, which covers it as it covers everything.\n const mcp = this.kernel.mcpHttp();\n if (mcp) {\n const answered = await mcp.handle(req);\n if (answered) {\n return outcome ? outcome.apply(answered) : answered;\n }\n }\n const domains = this.kernel.domains();\n const dispatchers = (await domains.ask(req)) ?? (await domains.route(req));\n if (dispatchers instanceof Response) {\n return outcome ? outcome.apply(dispatchers) : dispatchers;\n }\n if (!dispatchers) {\n const unknown = new Response(\"Unknown host\", { status: 404 });\n return outcome ? outcome.apply(unknown) : unknown;\n }\n const result = isApiPath(url.pathname)\n ? await dispatchers.api.handleApiRequest(req, carried)\n : await dispatchers.view.handleViewRequest(req, carried);\n if (!outcome) {\n return result;\n }\n // A document comes back as a render function the server calls with its\n // manifests, and the Response only exists once it has.\n if (typeof result === \"function\") {\n const render = result as (...args: any[]) => Promise<Response>;\n return (async (...args: any[]) => outcome.apply(await render(...args))) as any;\n }\n return outcome.apply(result);\n });\n }\n\n public dispatchJob(jobName: string, args: string) {\n const kernelRun = this.kernel.run.bind(this.kernel);\n return kernelRun(() => {\n return this.kernel.queue().dispatchJob(jobName, args);\n });\n }\n\n /** Every provider's `shutdown()`; see `Kernel.shutdown`. */\n public shutdown(options?: { timeoutMs?: number }) {\n return this.kernel.shutdown(options);\n }\n\n public destroy() {\n this.kernel.destroy();\n }\n\n public clone() {\n return Object.assign(Object.create(Object.getPrototypeOf(this)), this);\n }\n}\n\nexport type FetchHandler = InstanceType<typeof App>[\"fetch\"];\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";yCAgBO,MAAM,CAAI,CACP,OACD,YAEP,WAAW,CAAC,EAAmB,CAC7B,KAAK,OAAS,IAAI,EAAO,OACzB,KAAK,OAAO,KAAK,KAAK,KAAK,MAAM,EACjC,KAAK,YACH,EAAO,cACN,CAAC,IAAiB,CACjB,QAAQ,MAAM,8BAA+B,CAAK,SAc3C,YAAW,EAAG,CACzB,MAAM,KAAK,OAAO,YAAY,EAGzB,gBAAgB,EAAG,CACxB,OAAO,KAAK,OAAO,WAAW,EAAE,cAM3B,oBAAoB,EAAG,CAC5B,IAAM,EAAQ,IAAI,IAClB,QAAW,KAAc,KAAK,OAAO,QAAQ,EAAE,gBAAgB,EAC7D,QAAW,KAAQ,EAAW,kBAC5B,EAAM,IAAI,CAAI,EAGlB,OAAO,MAAM,KAAK,CAAK,E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,EAAU,KAAK,OAAO,QAAQ,EAC9B,EAAe,MAAM,EAAQ,IAAI,CAAG,GAAO,MAAM,EAAQ,MAAM,CAAG,EACxE,GAAI,aAAuB,SACzB,OAAO,EAAU,EAAQ,MAAM,CAAW,EAAI,EAEhD,GAAI,CAAC,EAAa,CAChB,IAAM,EAAU,IAAI,SAAS,eAAgB,CAAE,OAAQ,GAAI,CAAC,EAC5D,OAAO,EAAU,EAAQ,MAAM,CAAO,EAAI,EAE5C,IAAM,EAAS,EAAU,EAAI,QAAQ,EACjC,MAAM,EAAY,IAAI,iBAAiB,EAAK,CAAO,EACnD,MAAM,EAAY,KAAK,kBAAkB,EAAK,CAAO,EACzD,GAAI,CAAC,EACH,OAAO,EAIT,GAAI,OAAO,IAAW,WAAY,CAChC,IAAM,EAAS,EACf,MAAQ,UAAU,IAAgB,EAAQ,MAAM,MAAM,EAAO,GAAG,CAAI,CAAC,EAEvE,OAAO,EAAQ,MAAM,CAAM,EAC5B,EAGI,WAAW,CAAC,EAAiB,EAAc,CAEhD,OADkB,KAAK,OAAO,IAAI,KAAK,KAAK,MAAM,EACjC,IAAM,CACrB,OAAO,KAAK,OAAO,MAAM,EAAE,YAAY,EAAS,CAAI,EACrD,EAII,QAAQ,CAAC,EAAkC,CAChD,OAAO,KAAK,OAAO,SAAS,CAAO,EAG9B,OAAO,EAAG,CACf,KAAK,OAAO,QAAQ,EAGf,KAAK,EAAG,CACb,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,eAAe,IAAI,CAAC,EAAG,IAAI,EAEzE",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "77A19EB97244226164756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{F as
|
|
2
|
+
import{wl as P}from"./chunk-jzpbwvbt.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-87y2nrjy.js"),A=new x(this.apiKey),{idempotencyKey:z,...N}=j,{data:H,error:B}=await A.emails.send(N,z?{idempotencyKey:z}: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,headers:{},filterRecipients:(j)=>j}}function Q(j){for(let x=j;x;x=Object.getPrototypeOf(x)){let A=Object.prototype.hasOwnProperty.call(x,"deliver"),z=Object.prototype.hasOwnProperty.call(x,"send");if(A)return!1;if(z)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;headers;recipientFilter;constructor(j={}){let x=J();this.driver=j.driver??x.driver,this.headers=j.headers??x.headers,this.recipientFilter=j.filterRecipients??x.filterRecipients}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 Jk,G as Kk,Z as Lk,J as Mk,M as Nk,U as Ok};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=651E81E9055B5A1364756E2164756E21
|
|
@@ -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 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.headers = config.headers ?? defaults.headers;\n this.recipientFilter = config.filterRecipients ?? defaults.filterRecipients;\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,MAAM,CAAK,EACZ,CAAE,GAAI,GAAO,GAAI,KAAM,OAAM,EAGtC,GAAI,EACF,MAAO,CAAE,GAAI,GAAM,GAAI,EAAK,IAAM,IAAK,EAGzC,MAAO,CAAE,GAAI,GAAO,GAAI,IAAK,EAEjC,CC7BO,SAAS,CAAgB,CAAC,EAAgC,CAC/D,OAAO,EAGF,SAAS,CAAkB,EAAyB,CACzD,MAAO,CACL,OAAQ,IAAI,EACZ,QAAS,CAAC,EACV,iBAAkB,CAAC,IAAW,CAChC,ECVF,SAAS,CAAgB,CAAC,EAAgB,CACxC,QAAS,EAAQ,EAAQ,EAAO,EAAQ,OAAO,eAAe,CAAK,EAAG,CACpE,IAAM,EAAa,OAAO,UAAU,eAAe,KAAK,EAAO,SAAS,EAClE,EAAU,OAAO,UAAU,eAAe,KAAK,EAAO,MAAM,EAClE,GAAI,EAAY,MAAO,GACvB,GAAI,EAAS,MAAO,GAEtB,MAAO,GAOT,eAAsB,CAAc,CAClC,EACA,EAC8B,CAC9B,GAAI,OAAO,EAAO,UAAY,YAAc,CAAC,EAAiB,CAAM,EAClE,OAAO,EAAO,QAAQ,CAAM,EAE9B,MAAO,CAAE,GAAI,QAAQ,MAAM,EAAO,KAAK,CAAM,CAAC,EAAG,GAAI,IAAK,EC7BrD,MAAM,CAAY,OAChB,OAAQ,OAEN,OACA,QAEQ,gBAEjB,WAAW,CAAC,EAAqB,CAAC,EAAG,CACnC,IAAM,EAAW,EAAmB,EAEpC,KAAK,OAAS,EAAO,QAAU,EAAS,OACxC,KAAK,QAAU,EAAO,SAAW,EAAS,QAC1C,KAAK,gBAAkB,EAAO,kBAAoB,EAAS,iBAG7D,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": "651E81E9055B5A1364756E2164756E21",
|
|
13
13
|
"names": []
|
|
14
14
|
}
|
package/dist/config/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../chunk-
|
|
2
|
+
import"../chunk-jzpbwvbt.js";function k(b){return b}function q(b){if((process.env.GEMI_REACT_COMPILER??"auto").toLowerCase()==="off")return!1;return b??!0}export{q as reactCompiler,k as defineConfig};
|
|
3
3
|
|
|
4
4
|
//# debugId=2F7F86887FCF6F1A64756E2164756E21
|
package/dist/console/run.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ba as c}from"../chunk-
|
|
2
|
+
import{ba as c}from"../chunk-j6ygdvj8.js";import{bb as f,cb as o}from"../chunk-fcqx2t0p.js";import{Bd as r,nd as A,qd as n,rd as u}from"../chunk-2b3hh9xw.js";import"../chunk-v9z4x5j2.js";import"../chunk-877yc341.js";import{Vi as g,Zi as v}from"../chunk-563ksar3.js";import{ij as h}from"../chunk-n9n4qt20.js";import"../chunk-xv58jnpb.js";import"../chunk-86zhngpg.js";import{Uj as t}from"../chunk-attr793y.js";import"../chunk-2ery6a75.js";import"../chunk-73rzf7ys.js";import{Yk as k}from"../chunk-1fyn63ka.js";import"../chunk-e9z8p2fy.js";import"../chunk-mzkzgp2j.js";import{nl as a}from"../chunk-apga49vp.js";import"../chunk-jzpbwvbt.js";function E(){let z=Promise.resolve(),J=Promise.resolve(),Y=(Q,G)=>new Promise(($)=>{Q.write(G,()=>$())});return{stdout:(Q)=>{z=Y(process.stdout,Q)},stderr:(Q)=>{J=Y(process.stderr,Q)},flush:async()=>{await Promise.all([z,J])}}}function x(z){let J=z.writers??E();return{args:z.args,options:z.options,argv:z.argv,line:(Y="")=>J.stdout(`${Y}
|
|
3
3
|
`),error:(Y)=>J.stderr(`${Y}
|
|
4
4
|
`),fail:(Y,Q=1)=>{throw new A(Y,Q)}}}import b from"path";var Gz=u("encryption:rotate").describe("Re-encrypt encrypted columns that are still under an older key").arg("model",{description:"The model to rotate. Omit to rotate every model with encrypted columns"}).option("batchSize",{type:"number",default:500,description:"Rows read and rewritten per batch"}).option("dryRun",{type:"boolean",description:"Count what would be re-encrypted, and write nothing"}).option("encryptPlaintext",{type:"boolean",description:"Also encrypt values that are not encrypted yet (a column just marked @gemi.encrypted)"}).handle(async({args:z,options:J,line:Y,fail:Q})=>{let G=z.model?[z.model]:[...new Set(h().map((B)=>B.split(".")[0]))],$=z.model?null:Jz();if(G.length===0&&!$){Y("No model has encrypted columns.");return}if($){let B=await $.rotateEncryption({dryRun:J.dryRun});Y(`OAuth connections: ${B.scanned} rows, ${B.rotated} ${J.dryRun?"to re-encrypt":"re-encrypted"}`)}let _=0;for(let B of G){let V=await c(B,{batchSize:J.batchSize,dryRun:J.dryRun,encryptPlaintext:J.encryptPlaintext});_+=V.plaintext,Y(`${V.model} (${V.fields.join(", ")}): ${V.scanned} rows, ${V.rotated} ${J.dryRun?"to re-encrypt":"re-encrypted"}`+(V.skipped>0?`, ${V.skipped} changed meanwhile (already current)`:"")+(V.plaintext>0?`, ${V.plaintext} not encrypted yet`:""))}if(_>0)Q(`${_} value${_===1?" is":"s are"} not encrypted. If the column was just marked @gemi.encrypted, run again with --encrypt-plaintext.`)});function Jz(){let z=k();if(!z.bound(v))return null;let J=z.make(v);if(Object.keys(J.providers).length===0)return null;let Y=J.store;return Y instanceof g?Y:null}var m=[Gz];function R(z){return z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z])([A-Z][a-z])/g,"$1-$2").toLowerCase()}function Qz(z){let J=new Map,Y=new Map;for(let Q of z){J.set(R(Q.name),Q),J.set(Q.name,Q);let G="alias"in Q?Q.alias:void 0;if(G)Y.set(G,Q)}return{byName:J,byAlias:Y}}function l(z){if(z==="--")return!0;if(!z.startsWith("-"))return!1;if(z==="-")return!1;if(/^-(\d|\.\d)/.test(z))return!1;return!0}function p(z,J){let{byName:Y,byAlias:Q}=Qz(z.options),G=[],$=[],_=new Map,B=!Y.has("help"),V=!Q.has("h"),F=!1,N=!1,W=(X)=>G.push(`Unknown option ${X} for command "${z.commandName}".`),T=(X,Z)=>{if(Z==="--help"||Z==="-h")N=!0;G.push(Z===void 0?`Option ${X} needs a value.`:`Option ${X} needs a value, but the next token is ${JSON.stringify(Z)}, which is another option. If that really is the value, write ${X}=${Z}.`)},j=0;while(j<J.length){let X=J[j];if(X==="--"){$.push(...J.slice(j+1));break}if(X.startsWith("--")){let Z=X.slice(2),K=Z.indexOf("="),M=K===-1?Z:Z.slice(0,K),O=K===-1?void 0:Z.slice(K+1),P=Y.get(M),D=!1;if(!P&&M.startsWith("no-")){let S=Y.get(M.slice(3));if(S&&S.type==="boolean")P=S,D=!0}if(!P&&M==="help"&&B){F=!0,j+=1;continue}if(!P){W(`--${M}`),j+=1;continue}if(P.type==="boolean"){if(O!==void 0&&O!=="true"&&O!=="false")G.push(`Option --${R(P.name)} is a flag and takes no value, but got ${JSON.stringify(O)}.`);else{let S=O===void 0?!0:O==="true";_.set(P.name,D?!S:S)}j+=1;continue}if(O!==void 0){_.set(P.name,O),j+=1;continue}let L=J[j+1];if(L===void 0||l(L)){T(`--${R(P.name)}`,L),j+=1;continue}_.set(P.name,L),j+=2;continue}if(X.startsWith("-")&&X.length>1){let Z=X.slice(1),K=!1;for(let M=0;M<Z.length;M+=1){let O=Q.get(Z[M]);if(!O){if(Z[M]==="h"&&V){F=!0;continue}W(`-${Z[M]}`);break}if(O.type==="boolean"){_.set(O.name,!0);continue}let P=Z.slice(M+1),D=P.startsWith("=")?P.slice(1):P;if(D!==""){_.set(O.name,D);break}let L=J[j+1];if(L===void 0||l(L)){T(`-${O.alias}`,L);break}_.set(O.name,L),K=!0;break}j+=K?2:1;continue}$.push(X),j+=1}let H={},I=0;for(let X of z.args){if(X.variadic){let K=$.slice(I);if(I=$.length,H[X.name]=K,X.required&&K.length===0)G.push(`Missing required argument <${X.name}...>. Command "${z.commandName}" needs at least one.`);continue}let Z=$[I];if(I+=1,Z!==void 0){H[X.name]=Z;continue}if(X.default!==void 0){H[X.name]=X.default;continue}if(X.required)G.push(`Missing required argument <${X.name}>.`);H[X.name]=void 0}if(I<$.length){let X=$.slice(I);G.push(`Unexpected argument${X.length===1?"":"s"} ${X.map((Z)=>JSON.stringify(Z)).join(", ")}. Command "${z.commandName}" takes ${z.args.length} argument${z.args.length===1?"":"s"}.`)}let U={};for(let X of z.options){let Z=_.get(X.name);if(X.type==="boolean"){U[X.name]=Z===void 0?X.default??!1:Boolean(Z);continue}if(Z===void 0){if(X.default!==void 0)U[X.name]=X.default;else if(X.required)G.push(`Missing required option --${R(X.name)}.`),U[X.name]=void 0;else U[X.name]=void 0;continue}let K=String(Z);if(X.type==="number"){let M=Number(K);if(K.trim()===""||!Number.isFinite(M))G.push(`Option --${R(X.name)} expects a number, but got ${JSON.stringify(K)}.`),U[X.name]=void 0;else U[X.name]=M;continue}U[X.name]=K}let q=F&&!N;if(G.length>0)return{ok:!1,help:q,errors:G};return{ok:!0,help:q,args:H,options:U}}function C(z,J=" "){let Y=z.reduce((Q,[G])=>Math.max(Q,G.length),0);return z.map(([Q,G])=>G===""?`${J}${Q}`:`${J}${Q.padEnd(Y)} ${G}`)}function d(z){let J=z.variadic?`${z.name}...`:z.name;return z.required?`<${J}>`:`[${J}]`}function Xz(z){let J=(G)=>z.options.some(G),Y=J((G)=>G.name==="help"||R(G.name)==="help"),Q=J((G)=>("alias"in G)&&G.alias==="h");if(Y&&Q)return[];if(Y)return[["-h","Show this message"]];return[[`${Q?"":"-h, "}--help`,"Show this message"]]}function w(z){let J=[],Y=z.args.map(d).join(" "),Q=["gemi run",z.commandName,z.options.length>0?"[options]":"",Y].filter(Boolean).join(" ");if(J.push(`Usage: ${Q}`),z.description)J.push("",z.description);if(z.args.length>0)J.push("","Arguments:"),J.push(...C(z.args.map((G)=>{let $=[G.description??"",G.default!==void 0?`(default: ${JSON.stringify(G.default)})`:""].filter(Boolean).join(" ");return[d(G),$]})));return J.push("","Options:"),J.push(...C([...z.options.map((G)=>{let $="alias"in G&&G.alias?`-${G.alias}, `:"",_=G.type==="boolean"?"":` <${G.type}>`,B=[G.description??"",G.default!==void 0?`(default: ${JSON.stringify(G.default)})`:"","required"in G&&G.required?"(required)":""].filter(Boolean).join(" ");return[`${$}--${R(G.name)}${_}`,B]}),...Xz(z)])),J.join(`
|
|
5
5
|
`)}function i(z){return["Provided by gemi:","",...C(z.map((J)=>[J.commandName,J.description]))].join(`
|
|
@@ -15,4 +15,4 @@ ${i(j)}`);return 0}let H=W.get(z.name)??j.find((Z)=>Z.commandName===z.name);if($
|
|
|
15
15
|
${Q.message}
|
|
16
16
|
\`gemi run\` boots your application the way the server does, so it needs the Kernel. Run it from the root of a gemi project.`,{cause:Q})}if(typeof Y.default!=="function")throw new f(`${J} has no default export. gemi expects the Kernel subclass to be the default export of that file.`);return new Y.default}function s(z,J,Y,Q="returned"){if(z===void 0||z===null)return 0;if(typeof z==="number"&&Number.isInteger(z)&&z>=0&&z<=255)return z;let G=J?`Command "${J.commandName}"`:"The command";return Y(`${G} ${Q} ${JSON.stringify(z)}, which is not an exit `+"code \u2014 an exit code is an integer from 0 to 255. Treating this as a "+"failure."),1}var[Zz,..._z]=process.argv.slice(2),zz=E();e({rootDir:process.cwd(),name:Zz,argv:_z,writers:zz}).then(async(z)=>{await zz.flush(),process.exit(z)});
|
|
17
17
|
|
|
18
|
-
//# debugId=
|
|
18
|
+
//# debugId=12F4A505BEA7F4D464756E2164756E21
|
package/dist/console/run.js.map
CHANGED
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
"/**\n * The entry point `gemi run` spawns.\n *\n * Exposed through the exports map as `gemi/console/run` and resolved by the CLI\n * out of the *application's* `node_modules`, the same way `dev` and `start`\n * resolve `gemi/bun/preload`. That indirection is the point: the runner has to\n * be the application's copy of gemi, not the one bundled into `dist/bin/gemi.js`\n * — see the note at the top of `runner.ts`.\n *\n * Nothing but argv handling lives here, so that everything worth testing lives\n * in `runConsole`, which returns an exit code instead of taking one.\n */\nimport { processWriters } from \"./context\";\nimport { runConsole } from \"./runner\";\n\n// The tail is forwarded exactly as commander handed it over, `--` and all.\n// commander passes a `--` through as a literal operand (verified: `gemi run x --\n// --weird` arrives as `[\"--\", \"--weird\"]`), and `parse.ts` already treats a `--`\n// as \"everything after this is positional\". Stripping it here — which an earlier\n// draft did — consumed the escape hatch before the only thing that reads it,\n// leaving `-- --weird` reported as an unknown option and `-- --` the only way to\n// pass a flag-shaped value.\nconst [name, ...argv] = process.argv.slice(2);\n\nconst writers = processWriters();\n\n// `.then` rather than a top-level `await`, so this file typechecks under the\n// package's inherited `module: NodeNext` — the same TS1309 that keeps `bun/` out\n// of tsconfig.json's `include`. Bun runs it as ESM either way; this just avoids\n// buying a nested tsconfig for two lines.\nrunConsole({ rootDir: process.cwd(), name, argv, writers }).then(\n async (code) => {\n // Everything written has to reach the OS before the exit below discards it —\n // see `processWriters` for what that costs when it is skipped.\n await writers.flush();\n\n // Explicit, and not belt-and-braces. `kernel.destroy()` stops the scheduler,\n // but an open database pool, a Redis client or an unref'd timer will happily\n // hold the loop open after the work is done — a command that finishes and then\n // sits there, which is the failure `kernel/exit.test.ts` exists for and the\n // one `orm/context.test.ts` names by example.\n process.exit(code);\n },\n);\n"
|
|
11
11
|
],
|
|
12
12
|
"mappings": ";6sBA+FO,IAAS,JAAc,HAAmB,JAG/C,DAAI,HAAwB,GAAQ,GAAQ,HACxC,HAAwB,GAAQ,GAAQ,HAEtC,HAAQ,JAAC,HAA4B,IACzC,IAAI,QAAQ,CAAC,IAAY,CAIvB,EAAO,MAAM,EAAO,IAAM,EAAQ,CAAC,EACpC,EAEH,MAAO,CACL,OAAQ,CAAC,IAAU,CACjB,EAAS,EAAM,QAAQ,OAAQ,CAAK,GAEtC,OAAQ,CAAC,IAAU,CACjB,EAAS,EAAM,QAAQ,OAAQ,CAAK,GAEtC,MAAO,SAAY,CACjB,MAAM,QAAQ,IAAI,CAAC,EAAQ,CAAM,CAAC,EAEtC,EAGK,SAAS,CAAmB,CAAC,EAKX,CACvB,IAAM,EAAU,EAAO,SAAW,EAAe,EAEjD,MAAO,CACL,KAAM,EAAO,KACb,QAAS,EAAO,QAChB,KAAM,EAAO,KACb,KAAM,CAAC,EAAU,KAAO,EAAQ,OAAO,GAAG;AAAA,CAAW,EACrD,MAAO,CAAC,IAAo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,EAAS,sBAAsB,EAE3D,EACJ,GAAI,CACF,EAAS,MAAa,UACtB,MAAO,EAAO,CACd,MAAM,IAAI,EACR,kBAAkB;AAAA,MAAqB,EAAgB;AAAA,8HAGvD,CAAE,MAAO,CAAM,CACjB,EAGF,GAAI,OAAO,EAAO,UAAY,WAC5B,MAAM,IAAI,EACR,GAAG,kGAEL,EAGF,OAAO,IAAI,EAAO,QAgBpB,SAAS,CAAW,CAClB,EACA,EACA,EACA,EAAS,WACD,CACR,GAAI,IAAW,QAAa,IAAW,KAAM,MAAO,GAEpD,GACE,OAAO,IAAW,UAClB,OAAO,UAAU,CAAM,GACvB,GAAU,GACV,GAAU,IAEV,OAAO,EAGT,IAAM,EAAU,EAAU,YAAY,EAAQ,eAAiB,cAO/D,OALA,EACE,GAAG,KAAW,KAAU,KAAK,UAAU,CAAM,2BAC3C,4EACA,UACJ,EACO,EI7PT,IAAO,MAAS,IAAQ,QAAQ,KAAK,MAAM,CAAC,EAEtC,GAAU,EAAe,EAM/B,EAAW,CAAE,QAAS,QAAQ,IAAI,EAAG,QAAM,QAAM,UAAQ,CAAC,EAAE,KAC1D,MAAO,IAAS,CAGd,MAAM,GAAQ,MAAM,EAOpB,QAAQ,KAAK,CAAI,EAErB",
|
|
13
|
-
"debugId": "
|
|
13
|
+
"debugId": "12F4A505BEA7F4D464756E2164756E21",
|
|
14
14
|
"names": []
|
|
15
15
|
}
|
package/dist/container/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Zk as e,_k as o}from"../chunk-e9z8p2fy.js";import"../chunk-jzpbwvbt.js";export{o as Container,e as BindingResolutionError};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=BB1ED1E26DFF0E5464756E2164756E21
|
package/dist/database/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ea as N}from"../chunk-
|
|
2
|
+
import{Ea as N}from"../chunk-bstn00nx.js";import"../chunk-eqv7yxk7.js";import"../chunk-3csz8pfk.js";import"../chunk-xv58jnpb.js";import"../chunk-attr793y.js";import{kk as j,lk as k,nk as w,ok as x,pk as z,qk as A,rk as E,sk as F,tk as G,uk as H,vk as I,wk as J,xk as K,yk as L}from"../chunk-73rzf7ys.js";import"../chunk-jzpbwvbt.js";export{A as isSqlite,E as isMysqlFamily,z as inferDialect,j as defineDatabaseConfig,k as databaseConfigDefaults,w as UnknownDatabaseUrlError,H as UnknownConnectionError,I as ReservedConnectionNameError,x as MissingDatabaseUrlError,N as DatabaseServiceProvider,L as DatabaseManager,G as DEFAULT_CONNECTION,J as CrossConnectionTransactionError,K as Connection,F as AmbiguousSqlitePathError};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=FF3484E5B0CA29E964756E2164756E21
|
package/dist/email/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Nk as qS,Ok as JS}from"../chunk-z7tsh9qr.js";import{Uk as $S}from"../chunk-mr3szvr3.js";import{Yk as P}from"../chunk-1fyn63ka.js";import"../chunk-e9z8p2fy.js";import"../chunk-jzpbwvbt.js";import{render as s}from"jsx-email";import B from"process";import{Buffer as n}from"buffer";import r from"path";import{fileURLToPath as PS}from"url";import{promisify as yS}from"util";import o from"child_process";import wS,{constants as fS}from"fs/promises";import h from"process";import l,{constants as zS}from"fs/promises";import g from"process";import NS from"os";import W from"fs";import RS from"fs";import b from"fs";var F;function HS(){try{return b.statSync("/.dockerenv"),!0}catch{return!1}}function XS(){try{return b.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function L(){if(F===void 0)F=HS()||XS();return F}var O,US=()=>{try{return RS.statSync("/run/.containerenv"),!0}catch{return!1}};function R(){if(O===void 0)O=US()||L();return O}var u=()=>{if(g.platform!=="linux")return!1;if(NS.release().toLowerCase().includes("microsoft")){if(R())return!1;return!0}try{if(W.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft"))return!R()}catch{}if(W.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")||W.existsSync("/run/WSL"))return!R();return!1},H=g.env.__IS_WSL_TEST__?u:u();var ES=(()=>{let S;return async function(){if(S)return S;let q="/etc/wsl.conf",J=!1;try{await l.access(q,zS.F_OK),J=!0}catch{}if(!J)return"/mnt/";let K=await l.readFile(q,{encoding:"utf8"}),Q=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(K);if(!Q)return"/mnt/";return S=Q.groups.mountPoint.trim(),S=S.endsWith("/")?S:`${S}/`,S}})(),MS=async()=>{return`${await ES()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`},v=async()=>{if(H)return MS();return`${h.env.SYSTEMROOT||h.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`};function X($,S,q){let J=(K)=>Object.defineProperty($,S,{value:K,enumerable:!0,writable:!0});return Object.defineProperty($,S,{configurable:!0,enumerable:!0,get(){let K=q();return J(K),K},set(K){J(K)}}),$}import{promisify as jS}from"util";import j from"process";import{execFile as xS}from"child_process";import{promisify as _S}from"util";import kS from"process";import{execFile as DS}from"child_process";var FS=_S(DS);async function T(){if(kS.platform!=="darwin")throw Error("macOS only");let{stdout:$}=await FS("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),q=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec($)?.groups.id??"com.apple.Safari";if(q==="com.apple.safari")return"com.apple.Safari";return q}import LS from"process";import{promisify as OS}from"util";import{execFile as WS,execFileSync as H0}from"child_process";var vS=OS(WS);async function m($,{humanReadableOutput:S=!0,signal:q}={}){if(LS.platform!=="darwin")throw Error("macOS only");let J=S?[]:["-ss"],K={};if(q)K.signal=q;let{stdout:Q}=await vS("osascript",["-e",$,J],K);return Q.trim()}async function C($){return m(`tell application "Finder" to set app_path to application file id "${$}" as string
|
|
3
3
|
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as TS}from"util";import{execFile as CS}from"child_process";var IS=TS(CS),_={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},E0=new Map(Object.entries(_));class c extends Error{}async function I($=IS){let{stdout:S}=await $("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),q=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(S);if(!q)throw new c(`Cannot find Windows browser in stdout: ${JSON.stringify(S)}`);let{id:J}=q.groups,K=J.lastIndexOf("."),Q=J.lastIndexOf("-"),Z=K===-1?void 0:J.slice(0,K),V=Q===-1?void 0:J.slice(0,Q);return _[J]??_[Z]??_[V]??{name:J,id:J}}var BS=jS(xS),AS=($)=>$.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,(S)=>S.toUpperCase());async function x(){if(j.platform==="darwin"){let $=await T();return{name:await C($),id:$}}if(j.platform==="linux"){let{stdout:$}=await BS("xdg-mime",["query","default","x-scheme-handler/http"]),S=$.trim();return{name:AS(S.replace(/.desktop$/,"").replace("-"," ")),id:S}}if(j.platform==="win32")return I();throw Error("Only macOS, Linux, and Windows are supported")}var bS=yS(o.execFile),A=r.dirname(PS(import.meta.url)),d=r.join(A,"xdg-open"),{platform:N,arch:p}=B;async function uS(){let $=await v(),S=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,q=n.from(S,"utf16le").toString("base64"),{stdout:J}=await bS($,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",q],{encoding:"utf8"}),K=J.trim(),Q={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return Q[K]?{id:Q[K]}:{}}var t=async($,S)=>{let q;for(let J of $)try{return await S(J)}catch(K){q=K}throw q},k=async($)=>{if($={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...$},Array.isArray($.app))return t($.app,(V)=>k({...$,app:V}));let{name:S,arguments:q=[]}=$.app??{};if(q=[...q],Array.isArray(S))return t(S,(V)=>k({...$,app:{name:V,arguments:q}}));if(S==="browser"||S==="browserPrivate"){let V={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},Y={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},G=H?await uS():await x();if(G.id in V){let z=V[G.id];if(S==="browserPrivate")q.push(Y[z]);return k({...$,app:{name:U[z],arguments:q}})}throw Error(`${G.name} is not supported as a default browser`)}let J,K=[],Q={};if(N==="darwin"){if(J="open",$.wait)K.push("--wait-apps");if($.background)K.push("--background");if($.newInstance)K.push("--new");if(S)K.push("-a",S)}else if(N==="win32"||H&&!R()&&!S){if(J=await v(),K.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),!H)Q.windowsVerbatimArguments=!0;let V=["Start"];if($.wait)V.push("-Wait");if(S){if(V.push(`"\`"${S}\`""`),$.target)q.push($.target)}else if($.target)V.push(`"${$.target}"`);if(q.length>0)q=q.map((Y)=>`"\`"${Y}\`""`),V.push("-ArgumentList",q.join(","));$.target=n.from(V.join(" "),"utf16le").toString("base64")}else{if(S)J=S;else{let V=!A||A==="/",Y=!1;try{await wS.access(d,fS.X_OK),Y=!0}catch{}J=B.versions.electron??(N==="android"||V||!Y)?"xdg-open":d}if(q.length>0)K.push(...q);if(!$.wait)Q.stdio="ignore",Q.detached=!0}if(N==="darwin"&&q.length>0)K.push("--args",...q);if($.target)K.push($.target);let Z=o.spawn(J,K,Q);if($.wait)return new Promise((V,Y)=>{Z.once("error",Y),Z.once("close",(G)=>{if(!$.allowNonzeroExitCode&&G>0){Y(Error(`Exited with code ${G}`));return}V(Z)})});return Z.unref(),Z},gS=($,S)=>{if(typeof $!=="string")throw TypeError("Expected a `target`");return k({...S,target:$})};function i($){if(typeof $==="string"||Array.isArray($))return $;let{[p]:S}=$;if(!S)throw Error(`${p} is not supported`);return S}function D({[N]:$},{wsl:S}){if(S&&H)return i(S);if(!$)throw Error(`${N} is not supported`);return i($)}var U={};X(U,"chrome",()=>D({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));X(U,"brave",()=>D({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));X(U,"firefox",()=>D({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));X(U,"edge",()=>D({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));X(U,"browser",()=>"browser");X(U,"browserPrivate",()=>"browserPrivate");var a=gS;function hS($){return Array.from($,(S)=>{let q=S.charCodeAt(0);return S==="/"||S==="\\"||q<32||q===127?"_":S}).join("")}async function e($,S,q={}){let J=`${$}/${new Date().toISOString()}${hS(S.subject)}`,K={to:S.to,cc:S.cc,bcc:S.bcc,from:S.from,subject:S.subject,headers:S.headers??{},attachments:S.attachments.map((Q)=>({filename:Q.filename,bytes:Buffer.byteLength(Q.content)})),scheduledAt:S.scheduledAt??null,idempotencyKey:S.idempotencyKey??null,locale:q.locale??null,text:S.text??null};return await Bun.write(`${J}.json`,`${JSON.stringify(K,null,2)}
|
|
4
4
|
`),await Bun.write(`${J}.html`,S.html),`${J}.html`}import{jsx as SS}from"react/jsx-runtime";class KS{from="";to=[];subject="No Subject";cc=[];bcc=[];attachments=[];template;headers={};static async send($){let S=new this,q=P($S).defaultLocale,J=P(JS),{to:K=S.to,from:Q=S.from,subject:Z=typeof S.subject==="string"?S.subject:S.subject[$.locale||q],cc:V=S.cc,bcc:Y=S.bcc,attachments:G=S.attachments,data:z,headers:QS={}}=$,VS={...J.headers??{},...S.headers??{},...QS??{}},y=process.env.EMAIL_DEBUG==="true",E=y?"debug":J.driver?.provider??"custom",w=await J.filterRecipients(K);if(!w.length)return{id:null,provider:E,status:"skipped"};let[YS,ZS]=await Promise.all([S.render({...z,locale:$.locale}),S.renderText({...z,locale:$.locale})]),f={bcc:Y,cc:V,from:Q,subject:Z,to:w,attachments:G,html:YS,headers:VS,text:ZS,scheduledAt:$.scheduledAt,idempotencyKey:$.idempotencyKey};if(y){let GS=await e(`${process.env.ROOT_DIR}/.debug/emails`,f,{locale:$.locale});if(process.env.CI!=="true")await a(GS);return{id:`debug_${crypto.randomUUID()}`,provider:E,status:"debug"}}let M=await qS(J,f);return M.ok?{id:M.id,provider:E,status:"sent"}:{id:M.id,provider:E,status:"failed",error:M.error}}static async preview($){return await new this().render({...$.data,locale:$.locale})}async render($){let S=this.template;return await s(SS(S,{...$}))}async renderText($){let S=this.template;return await s(SS(S,{...$}),{plainText:!0})}}export{KS as Email};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
6
|
+
//# debugId=73F4C698BC176C7364756E2164756E21
|
package/dist/email/index.js.map
CHANGED
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
"import type { SendEmailParams } from \"../services/email/drivers/types\";\n\n/**\n * What `EMAIL_DEBUG=true` records about a send, next to the rendered HTML.\n *\n * The HTML alone can't say who a mail went to: plenty of templates render\n * nothing per recipient, so a test asserting \"this action mailed this user\"\n * could match another send with the same subject. The sidecar holds the\n * envelope the driver would have been handed, with `to` already filtered.\n */\nexport interface DebugEmailRecord {\n to: string[];\n cc: string[];\n bcc: string[];\n from: string;\n subject: string;\n headers: Record<string, string>;\n // Attachment bodies are left out: name and size are enough to assert on.\n attachments: Array<{ filename: string; bytes: number }>;\n scheduledAt: string | null;\n idempotencyKey: string | null;\n locale: string | null;\n text: string | null;\n}\n\n/**\n * A subject as a filename fragment. Path separators would write into a\n * subdirectory (or fail), and control characters aren't valid on every\n * filesystem. Everything else is kept, so a reader matching on the subject\n * substring keeps working.\n */\nexport function debugEmailFileSubject(subject: string) {\n return Array.from(subject, (char) => {\n const code = char.charCodeAt(0);\n return char === \"/\" || char === \"\\\\\" || code < 0x20 || code === 0x7f ? \"_\" : char;\n }).join(\"\");\n}\n\n/**\n * Writes `<dir>/<iso><subject>.json` and then `<dir>/<iso><subject>.html`, and\n * returns the HTML path. The sidecar goes first so a reader that sees the HTML\n * can rely on its envelope being there.\n */\nexport async function writeDebugEmail(\n dir: string,\n params: SendEmailParams,\n options: { locale?: string } = {},\n) {\n const base = `${dir}/${new Date().toISOString()}${debugEmailFileSubject(params.subject)}`;\n\n const record: DebugEmailRecord = {\n to: params.to,\n cc: params.cc,\n bcc: params.bcc,\n from: params.from,\n subject: params.subject,\n headers: params.headers ?? {},\n attachments: params.attachments.map((attachment) => ({\n filename: attachment.filename,\n bytes: Buffer.byteLength(attachment.content),\n })),\n scheduledAt: params.scheduledAt ?? null,\n idempotencyKey: params.idempotencyKey ?? null,\n locale: options.locale ?? null,\n text: params.text ?? null,\n };\n\n await Bun.write(`${base}.json`, `${JSON.stringify(record, null, 2)}\\n`);\n await Bun.write(`${base}.html`, params.html);\n\n return `${base}.html`;\n}\n"
|
|
18
18
|
],
|
|
19
19
|
"mappings": ";uNACA,YAAS,aCDT,kBACA,YAAQ,eACR,oBACA,wBAAQ,aACR,oBAAQ,cACR,6BACA,wBAAY,qBCNZ,uBACA,uBAAY,qBCDZ,uBACA,mBACA,kBCFA,mBCAA,kBAEA,IAAI,EAEJ,SAAS,EAAY,EAAG,CACvB,GAAI,CAEH,OADA,EAAG,SAAS,aAAa,EAClB,GACN,KAAM,CACP,MAAO,IAIT,SAAS,EAAe,EAAG,CAC1B,GAAI,CACH,OAAO,EAAG,aAAa,oBAAqB,MAAM,EAAE,SAAS,QAAQ,EACpE,KAAM,CACP,MAAO,IAIT,SAAwB,CAAQ,EAAG,CAElC,GAAI,IAAmB,OACtB,EAAiB,GAAa,GAAK,GAAgB,EAGpD,OAAO,EDxBR,IAAI,EAGE,GAAkB,IAAM,CAC7B,GAAI,CAEH,OADA,GAAG,SAAS,oBAAoB,EACzB,GACN,KAAM,CACP,MAAO,KAIT,SAAwB,CAA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ACA,CAIA,OAAO,MAFU,IAAI,KAAK,EAEJ,OAAO,IACxB,EAAK,KACR,OAAQ,EAAK,MACf,CAAC,OAGa,OAAqC,CAAC,EAAU,CAC9D,IAAM,EAAW,KAAK,SACtB,OAAO,MAAM,EAAO,GAAC,EAAD,IAAc,EAAO,CAAE,OAG7B,WAAyC,CAAC,EAAU,CAClE,IAAM,EAAW,KAAK,SACtB,OAAO,MAAM,EAAO,GAAC,EAAD,IAAc,EAAO,EAAI,CAAE,UAAW,EAAK,CAAC,EAEpE",
|
|
20
|
-
"debugId": "
|
|
20
|
+
"debugId": "73F4C698BC176C7364756E2164756E21",
|
|
21
21
|
"names": []
|
|
22
22
|
}
|
package/dist/facades/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{$e as j,Dg as v,Kf as q,Re as a,Vf as r,We as c,Wf as s,Xe as e,Xf as t,Ye as f,Yf as u,Ze as h,_e as i,gf as k,hf as l,if as m,jf as n,kf as o,uf as p}from"../chunk-gvdg52ew.js";import"../chunk-hh5bs656.js";import"../chunk-3csz8pfk.js";import{Bi as g,ai as b,zi as d}from"../chunk-8km4drvv.js";import"../chunk-cee5gq7t.js";import"../chunk-0k8fk96c.js";import"../chunk-563ksar3.js";import"../chunk-n9n4qt20.js";import"../chunk-xv58jnpb.js";import"../chunk-313593t3.js";import"../chunk-86zhngpg.js";import"../chunk-attr793y.js";import"../chunk-2ery6a75.js";import"../chunk-73rzf7ys.js";import"../chunk-2x6cv37t.js";import"../chunk-mr3szvr3.js";import"../chunk-1fyn63ka.js";import"../chunk-e9z8p2fy.js";import"../chunk-g8sh9btf.js";import"../chunk-mzkzgp2j.js";import"../chunk-apga49vp.js";import"../chunk-fqqbnp0z.js";import"../chunk-jzpbwvbt.js";export{f as Url,d as Storage,r as Runs,j as Redis,a as Redirect,l as RateLimiter,e as Query,h as Meta,g as Log,m as Lock,c as Lang,s as Features,b as Facade,u as DB,n as Crypt,i as Cookie,o as Connections,t as ConnectionQueries,p as ChangeFeed,k as Cache,q as Broadcast,v as Auth};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=69E09A242D23B23E64756E2164756E21
|
package/dist/foundation/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Xk as o,Yk as r}from"../chunk-1fyn63ka.js";import"../chunk-e9z8p2fy.js";import"../chunk-jzpbwvbt.js";export{r as app,o as Application};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=DCF97866EB76436D64756E2164756E21
|
package/dist/http/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Eg as $,Fg as aa,Gg as ba,Jg as ca,Kg as da,Lg as ea,Mg as fa,Ng as ga,Og as ha,Pe as G,Pg as ia,Qe as H,Qg as ja,Rg as ka,Se as I,Sg as la,Te as J,Tg as ma,Ue as K,Ug as na,Ve as L,Vg as oa,Wg as pa,Xg as qa,Yg as ra,Zg as sa,_g as ta,ae as q,be as r,ce as s,de as t,ee as u,eg as _,fe as B,ke as C,ne as D,oe as E,pe as F}from"../chunk-gvdg52ew.js";import"../chunk-hh5bs656.js";import"../chunk-3csz8pfk.js";import{$h as A,Ah as d,Fh as e,Gh as f,Hh as g,Ih as h,Jh as i,Kh as j,Ph as n,Qh as o,Vh as p,Wh as v,Xh as w,Yh as x,Zh as y,_h as z,ji as M,ki as N,li as O,mi as P,ni as Q,oi as R,pi as S,qi as T,ri as U,si as V,ti as W,ui as X,vi as Y,wi as Z,yh as a,zh as b}from"../chunk-8km4drvv.js";import{Ji as c}from"../chunk-cee5gq7t.js";import{Oi as k,Pi as l,Qi as m}from"../chunk-0k8fk96c.js";import"../chunk-563ksar3.js";import"../chunk-n9n4qt20.js";import"../chunk-xv58jnpb.js";import"../chunk-313593t3.js";import"../chunk-86zhngpg.js";import"../chunk-attr793y.js";import"../chunk-2ery6a75.js";import"../chunk-73rzf7ys.js";import"../chunk-2x6cv37t.js";import"../chunk-mr3szvr3.js";import"../chunk-1fyn63ka.js";import"../chunk-e9z8p2fy.js";import"../chunk-g8sh9btf.js";import"../chunk-mzkzgp2j.js";import"../chunk-apga49vp.js";import"../chunk-fqqbnp0z.js";import"../chunk-jzpbwvbt.js";export{g as toRangeHeaderValue,q as toMiddlewareList,k as stateKey,Z as safeFetch,f as resolveRange,e as parseRangeHeader,h as parseContentRange,u as parseByteSize,ha as middlewareConfigDefaults,J as httpError,d as getCookies,j as formatUnsatisfiedContentRange,i as formatContentRange,pa as defineResourcePolicy,ga as defineMiddlewareConfig,r as createUnsatisfiableResponse,s as createStreamResponse,K as createFileResponse,F as clientIp,X as classifyAddress,ba as authorizeChannel,L as ViewRouter,n as ValidationError,U as TooManyRedirectsError,S as TooLargeError,R as TimeoutError,qa as SitemapError,ra as Sitemap,H as SameSiteBounceMiddleware,Y as SafeResponse,M as SafeFetchError,G as SAME_SITE_BOUNCE_PARAM,sa as RobotsTxt,ta as Robots,oa as ResourcePolicy,b as ResourceController,m as RequestState,c as RequestBreakerError,E as RateLimitMiddleware,C as RateLimitExceededError,x as RangeNotSatisfiableError,ma as PoliciesServiceProvider,na as Policies,t as PayloadTooLargeError,y as NotFoundError,V as NetworkError,l as MissingRequestStateError,D as Middleware,ea as McpToolDeclaration,fa as McpRouter,da as McpRouteDeclaration,ca as McpModelParam,o as InvalidValidationRuleError,N as InvalidUrlError,w as InsufficientPermissionsError,W as HttpStatusError,I as HttpResponse,p as HttpRequest,z as FileNotFoundError,Q as DnsError,ka as CorsMiddleware,a as Controller,T as ContentTypeError,aa as ChannelRouter,$ as ChannelDeclaration,ja as CacheMiddleware,la as CSRFMiddleware,_ as BodyLimitMiddleware,O as BlockedHostError,P as BlockedAddressError,v as AuthorizationError,ia as AuthenticationMiddleware,A as AuthenticationError,B as ApiRouter};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=844366D436F915D964756E2164756E21
|
package/dist/http/index.js.map
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ca as y,da as p}from"../chunk-
|
|
2
|
+
import{ca as y,da as p}from"../chunk-4d4td4k9.js";import{ua as c,va as d,xa as l}from"../chunk-epvpmakp.js";import{Ak as e,Bk as i,Dk as t,Ek as r,Fk as o,Gk as n,Hk as a,Ik as s}from"../chunk-2x6cv37t.js";import"../chunk-jzpbwvbt.js";export{o as setActiveLocale,r as seedDictionaries,t as preloadDictionaries,d as localeStrings,i as loadDictionary,n as getActiveLocale,e as dictionaryRegistrationMark,c as dictionaryLocales,l as dictionaryId,y as defineDictionary,s as createDictionarySink,a as __resetDictionaryRegistry,p as __gemi_dict__};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=A2BB4E55D83C935964756E2164756E21
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ca as T}from"../chunk-
|
|
2
|
+
import{ca as T}from"../chunk-4d4td4k9.js";import"../chunk-epvpmakp.js";import{ab as D}from"../chunk-49s8wwp2.js";import{Zd as b,_d as w}from"../chunk-ydkv9e8w.js";import"../chunk-eqv7yxk7.js";import{We as j}from"../chunk-gvdg52ew.js";import"../chunk-hh5bs656.js";import"../chunk-3csz8pfk.js";import"../chunk-8km4drvv.js";import"../chunk-cee5gq7t.js";import"../chunk-0k8fk96c.js";import"../chunk-563ksar3.js";import"../chunk-n9n4qt20.js";import"../chunk-xv58jnpb.js";import"../chunk-313593t3.js";import"../chunk-86zhngpg.js";import"../chunk-attr793y.js";import"../chunk-2ery6a75.js";import"../chunk-73rzf7ys.js";import"../chunk-2x6cv37t.js";import{Pk as V,Qk as X,Rk as E,Sk as L,Tk as R,Uk as S}from"../chunk-mr3szvr3.js";import"../chunk-1fyn63ka.js";import"../chunk-e9z8p2fy.js";import"../chunk-g8sh9btf.js";import"../chunk-mzkzgp2j.js";import"../chunk-apga49vp.js";import"../chunk-fqqbnp0z.js";import"../chunk-jzpbwvbt.js";import{createElement as J,Fragment as M,isValidElement as U}from"react";function $(q,B){let G=Object.values(B).some((z)=>typeof z==="function"&&U(z(""))),Q=/{{([^{}]+?)(?::([^{}\[\]]+?))?(?:\[(.*?)\])?}}/g;if(!G)return q.replace(Q,(W,O,_,Z)=>{let C=O.includes(":")?O.split(":")[0]:O,H=B[C];if(H===void 0)return W;if(typeof H==="function"){let K=H(Z!==void 0?Z:"");if(U(K))throw Error("JSX returned in string context");return String(K)}if(_)switch(_.toLowerCase()){case"number":return Number(H).toString();case"string":return String(H);case"boolean":return Boolean(H).toString();default:return String(H)}return String(H)});else{let z=[],W=0,O=null;while((O=Q.exec(q))!==null){let[_,Z,C,H]=O,F=O.index,K=Z.includes(":")?Z.split(":")[0]:Z;if(F>W)z.push(q.substring(W,F));let Y=B[K];if(Y===void 0)z.push(_);else if(typeof Y==="function"){let A=Y(H!==void 0?H:"");z.push(A)}else if(C)switch(C.toLowerCase()){case"number":z.push(Number(Y).toString());break;case"string":z.push(String(Y));break;case"boolean":z.push(Boolean(Y).toString());break;default:z.push(String(Y))}else z.push(String(Y));W=F+_.length}if(W<q.length)z.push(q.substring(W));return J(M,{},...z)}}class P{name;dictionary;constructor(q,B){this.name=q;this.dictionary=B}reference(q){if(typeof window<"u")throw Error("Cannot use reference in the browser");if(!this.dictionary?.[q])throw Error(`Translation not found for ${String(q)}`);return this.dictionary[q]}render(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B[0]};if(typeof window<"u")throw Error("Cannot use render in the browser");if(!this.dictionary?.[q]?.[G])throw Error(`Translation not found for ${String(q)} in ${String(G)}`);return $(this.dictionary[q][G],Q??{})}static create(q,B){return new P(q,B)}static text(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B?.[0]};if(!q?.[G])throw Error(`Translation not found for ${String(G)}`);return $(q[G],Q??{})}}async function N(q,B,...G){let{locale:Q=j.locale(),params:z}={params:{},...G[0]},O=(await q.load(String(Q)))[B];if(typeof O!=="string")throw Error(`Translation not found for "${B}" in "${String(Q)}" (dictionary ${q.id})`);return $(O,z??{})}export{w as translationConfigDefaults,N as translate,V as resolveLocale,X as negotiateLocale,L as isValidTimeZone,b as defineTranslationConfig,T as defineDictionary,R as createFormatter,S as Translator,D as TranslationServiceProvider,P as Dictionary,E as DEFAULT_TIME_ZONE};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=6C726BA87AA78FDC64756E2164756E21
|
package/dist/i18n/index.js.map
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"import { Lang } from \"../facades\";\nimport { parseTranslation } from \"../utils/parseTranslation\";\nimport type { ParseTranslationParamsServer, Prettify } from \"../utils/type\";\nimport type { DictionaryHandle } from \"./defineDictionary\";\nimport type { DictionaryTranslations } from \"./dictionaryShape\";\n\n/**\n * Read one string from a `defineDictionary` dictionary outside React — a\n * controller, a job, an email template.\n *\n * Async because a bundled dictionary loads its locale on demand. Server code\n * does not go through the bundler, so in practice this resolves without ever\n * yielding; the `await` is what makes the same call work either way.\n *\n * Kept out of `defineDictionary.ts` on purpose: that module is imported by\n * components and has to stay free of the server facades this one needs.\n */\nexport async function translate<\n T extends DictionaryTranslations,\n K extends keyof T & string,\n U extends keyof T[K],\n R = Prettify<ParseTranslationParamsServer<T[K][U] & string>>,\n>(\n dictionary: DictionaryHandle<T>,\n key: K,\n ...args: R extends Record<string, never>\n ? [args?: { locale?: U | (string & {}) }]\n : [args: { locale?: U | (string & {}); params: R }]\n): Promise<string> {\n const { locale = Lang.locale(), params } = { params: {}, ...args[0] };\n const strings = await dictionary.load(String(locale));\n const template = strings[key];\n\n if (typeof template !== \"string\") {\n throw new Error(\n `Translation not found for \"${key}\" in \"${String(locale)}\" (dictionary ${dictionary.id})`,\n );\n }\n\n return parseTranslation(template, (params ?? {}) as any) as string;\n}\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