gemi 0.51.1 → 0.53.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/app/index.js +1 -1
- package/dist/bin/gemi.js +30 -1
- package/dist/bin/gemi.js.map +4 -4
- package/dist/broadcasting/index.js +1 -1
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-npeq63a2.js → chunk-07jtzbf0.js} +1 -1
- package/dist/{chunk-5v36t9j3.js → chunk-092pj2j2.js} +3 -3
- package/dist/{chunk-5v36t9j3.js.map → chunk-092pj2j2.js.map} +1 -1
- package/dist/{chunk-zwpx6z5f.js → chunk-0h3jr9d9.js} +2 -2
- package/dist/{chunk-8zd6d5nd.js.map → chunk-0h3jr9d9.js.map} +1 -1
- package/dist/{chunk-hwwp6x2s.js → chunk-1ab1ptq5.js} +2 -2
- package/dist/{chunk-hwwp6x2s.js.map → chunk-1ab1ptq5.js.map} +1 -1
- package/dist/chunk-1pqfmw5h.js +5 -0
- package/dist/chunk-1pqfmw5h.js.map +30 -0
- package/dist/{chunk-dk01r6se.js → chunk-23g7qdpg.js} +2 -2
- package/dist/{chunk-dk01r6se.js.map → chunk-23g7qdpg.js.map} +1 -1
- package/dist/{chunk-fs091xz7.js → chunk-2gw6cyyj.js} +2 -2
- package/dist/{chunk-fs091xz7.js.map → chunk-2gw6cyyj.js.map} +1 -1
- package/dist/chunk-2qn472j4.js +5 -0
- package/dist/{chunk-8gb1w19q.js.map → chunk-2qn472j4.js.map} +1 -1
- package/dist/{chunk-pkzj7c5w.js → chunk-2sfz64xh.js} +2 -2
- package/dist/{chunk-pkzj7c5w.js.map → chunk-2sfz64xh.js.map} +1 -1
- package/dist/{chunk-q0xq0pt0.js → chunk-2yth3kk2.js} +4 -4
- package/dist/{chunk-q0xq0pt0.js.map → chunk-2yth3kk2.js.map} +1 -1
- package/dist/chunk-3d3nmr5g.js +4 -0
- package/dist/{chunk-6x6gb7zg.js.map → chunk-3d3nmr5g.js.map} +3 -3
- package/dist/{chunk-8vnbvfmd.js → chunk-3y9nf09k.js} +2 -2
- package/dist/{chunk-8vnbvfmd.js.map → chunk-3y9nf09k.js.map} +1 -1
- package/dist/{chunk-8zd6d5nd.js → chunk-4e61qbp4.js} +2 -2
- package/dist/{chunk-zwpx6z5f.js.map → chunk-4e61qbp4.js.map} +1 -1
- package/dist/{chunk-j33n723q.js → chunk-5s45prj5.js} +3 -3
- package/dist/{chunk-j33n723q.js.map → chunk-5s45prj5.js.map} +1 -1
- package/dist/{chunk-16bnbtyn.js → chunk-68w225rv.js} +2 -2
- package/dist/{chunk-16bnbtyn.js.map → chunk-68w225rv.js.map} +1 -1
- package/dist/{chunk-rxeyhwqz.js → chunk-69w4egkg.js} +3 -3
- package/dist/{chunk-rxeyhwqz.js.map → chunk-69w4egkg.js.map} +1 -1
- package/dist/{chunk-8m3wq94b.js → chunk-6scjrbw7.js} +2 -2
- package/dist/{chunk-8m3wq94b.js.map → chunk-6scjrbw7.js.map} +1 -1
- package/dist/{chunk-3z4nwzvp.js → chunk-7s1g3v1y.js} +3 -3
- package/dist/{chunk-3z4nwzvp.js.map → chunk-7s1g3v1y.js.map} +1 -1
- package/dist/{chunk-asgfqcwd.js → chunk-88pq4gmf.js} +2 -2
- package/dist/{chunk-asgfqcwd.js.map → chunk-88pq4gmf.js.map} +1 -1
- package/dist/{chunk-p0z35s59.js → chunk-8p6rqegw.js} +1 -1
- package/dist/chunk-92793zh4.js +5 -0
- package/dist/{chunk-98sj7tkf.js.map → chunk-92793zh4.js.map} +3 -4
- package/dist/chunk-9279y4af.js +5 -0
- package/dist/{chunk-tqbp8550.js.map → chunk-9279y4af.js.map} +2 -2
- package/dist/chunk-bq4w14a6.js +5 -0
- package/dist/chunk-bq4w14a6.js.map +10 -0
- package/dist/{chunk-nbx9mgmr.js → chunk-cg53h5ht.js} +2 -2
- package/dist/{chunk-nbx9mgmr.js.map → chunk-cg53h5ht.js.map} +1 -1
- package/dist/{chunk-g4gjn481.js → chunk-cmq5t8p9.js} +3 -3
- package/dist/{chunk-g4gjn481.js.map → chunk-cmq5t8p9.js.map} +1 -1
- package/dist/{chunk-zznpmnp7.js → chunk-d1ahbza9.js} +3 -3
- package/dist/{chunk-zznpmnp7.js.map → chunk-d1ahbza9.js.map} +1 -1
- package/dist/{chunk-c4r1zh9q.js → chunk-ear03axe.js} +24 -24
- package/dist/{chunk-c4r1zh9q.js.map → chunk-ear03axe.js.map} +3 -5
- package/dist/{chunk-an6nq9yd.js → chunk-ebcgdv00.js} +3 -3
- package/dist/{chunk-an6nq9yd.js.map → chunk-ebcgdv00.js.map} +1 -1
- package/dist/{chunk-gvf1d636.js → chunk-faa987e4.js} +2 -2
- package/dist/{chunk-gvf1d636.js.map → chunk-faa987e4.js.map} +1 -1
- package/dist/{chunk-gdegb5t0.js → chunk-fbp5vapa.js} +2 -2
- package/dist/{chunk-gdegb5t0.js.map → chunk-fbp5vapa.js.map} +2 -2
- package/dist/chunk-ffre1z8s.js +6 -0
- package/dist/{chunk-y0wg8aq9.js.map → chunk-ffre1z8s.js.map} +2 -2
- package/dist/{chunk-6wm9bsz9.js → chunk-h5g05qwb.js} +2 -2
- package/dist/{chunk-6wm9bsz9.js.map → chunk-h5g05qwb.js.map} +1 -1
- package/dist/{chunk-x80n922n.js → chunk-h7jv3ame.js} +2 -2
- package/dist/{chunk-x80n922n.js.map → chunk-h7jv3ame.js.map} +1 -1
- package/dist/chunk-ha7n1c94.js +7 -0
- package/dist/{chunk-bm6q0q1q.js.map → chunk-ha7n1c94.js.map} +3 -3
- package/dist/{chunk-3fcgg506.js → chunk-j1knf8gv.js} +3 -3
- package/dist/{chunk-3fcgg506.js.map → chunk-j1knf8gv.js.map} +1 -1
- package/dist/{chunk-1sbm38g3.js → chunk-kaxvw75w.js} +3 -3
- package/dist/{chunk-1sbm38g3.js.map → chunk-kaxvw75w.js.map} +1 -1
- package/dist/{chunk-eyvtf769.js → chunk-kxzwem3g.js} +2 -2
- package/dist/{chunk-eyvtf769.js.map → chunk-kxzwem3g.js.map} +1 -1
- package/dist/{chunk-hnw1jy86.js → chunk-msz8rngs.js} +2 -2
- package/dist/{chunk-hnw1jy86.js.map → chunk-msz8rngs.js.map} +1 -1
- package/dist/chunk-mt2755rs.js +5 -0
- package/dist/{chunk-g0w87jtw.js.map → chunk-mt2755rs.js.map} +4 -3
- package/dist/chunk-p22rkf1g.js +8 -0
- package/dist/chunk-p22rkf1g.js.map +11 -0
- package/dist/{chunk-kv8p4h79.js → chunk-q09mmr05.js} +3 -3
- package/dist/{chunk-kv8p4h79.js.map → chunk-q09mmr05.js.map} +1 -1
- package/dist/{chunk-mrf9tjev.js → chunk-qjnv2rkh.js} +2 -2
- package/dist/{chunk-mrf9tjev.js.map → chunk-qjnv2rkh.js.map} +1 -1
- package/dist/{chunk-d3tf618w.js → chunk-qx6sahe0.js} +2 -2
- package/dist/{chunk-d3tf618w.js.map → chunk-qx6sahe0.js.map} +1 -1
- package/dist/{chunk-w7fpm2pw.js → chunk-qyaqg07q.js} +2 -2
- package/dist/{chunk-w7fpm2pw.js.map → chunk-qyaqg07q.js.map} +1 -1
- package/dist/{chunk-a6w4tpwz.js → chunk-rq770c71.js} +2 -2
- package/dist/{chunk-a6w4tpwz.js.map → chunk-rq770c71.js.map} +1 -1
- package/dist/{chunk-zezdm4ep.js → chunk-t4n25km9.js} +3 -3
- package/dist/{chunk-zezdm4ep.js.map → chunk-t4n25km9.js.map} +1 -1
- package/dist/{chunk-eby61053.js → chunk-tkv6cw94.js} +3 -3
- package/dist/{chunk-eby61053.js.map → chunk-tkv6cw94.js.map} +1 -1
- package/dist/chunk-tmk4zfz9.js +33 -0
- package/dist/chunk-tmk4zfz9.js.map +18 -0
- package/dist/{chunk-k4mjcvsm.js → chunk-ttzkn1qd.js} +2 -2
- package/dist/{chunk-k4mjcvsm.js.map → chunk-ttzkn1qd.js.map} +1 -1
- package/dist/{chunk-94k8pjmf.js → chunk-tztqkat2.js} +3 -3
- package/dist/{chunk-94k8pjmf.js.map → chunk-tztqkat2.js.map} +1 -1
- package/dist/{chunk-ybqftmjx.js → chunk-vnjvd82s.js} +2 -2
- package/dist/{chunk-ybqftmjx.js.map → chunk-vnjvd82s.js.map} +1 -1
- package/dist/{chunk-0k5jhyry.js → chunk-xsmt86n3.js} +2 -2
- package/dist/{chunk-0k5jhyry.js.map → chunk-xsmt86n3.js.map} +1 -1
- package/dist/chunk-y4djde42.js +5 -0
- package/dist/chunk-y4djde42.js.map +11 -0
- package/dist/{chunk-ntr81h76.js → chunk-z4q1ty6w.js} +2 -2
- package/dist/{chunk-ntr81h76.js.map → chunk-z4q1ty6w.js.map} +1 -1
- package/dist/{chunk-53w1njqz.js → chunk-zhsaz9cr.js} +1 -1
- package/dist/chunks/ThemeProvider-CTX9LOFC.js +2718 -0
- package/dist/chunks/ThemeProvider-CTX9LOFC.js.map +1 -0
- package/dist/client/Mutation.d.ts +1 -1
- package/dist/client/Mutation.d.ts.map +1 -1
- package/dist/client/ThemeProvider.d.ts +7 -0
- package/dist/client/ThemeProvider.d.ts.map +1 -1
- package/dist/client/index.js +107 -2673
- package/dist/client/index.js.map +1 -1
- package/dist/client/useIsNavigationPending.d.ts.map +1 -1
- package/dist/client/useMutate.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/console/Command.d.ts +143 -0
- package/dist/console/Command.d.ts.map +1 -0
- package/dist/console/CommandRegistry.d.ts +46 -0
- package/dist/console/CommandRegistry.d.ts.map +1 -0
- package/dist/console/builder.d.ts +115 -0
- package/dist/console/builder.d.ts.map +1 -0
- package/dist/console/builder.test-d.d.ts +2 -0
- package/dist/console/builder.test-d.d.ts.map +1 -0
- package/dist/console/config.d.ts +40 -0
- package/dist/console/config.d.ts.map +1 -0
- package/dist/console/context.d.ts +90 -0
- package/dist/console/context.d.ts.map +1 -0
- package/dist/console/errors.d.ts +19 -0
- package/dist/console/errors.d.ts.map +1 -0
- package/dist/console/parse.d.ts +65 -0
- package/dist/console/parse.d.ts.map +1 -0
- package/dist/console/run.d.ts +2 -0
- package/dist/console/run.d.ts.map +1 -0
- package/dist/console/run.js +16 -0
- package/dist/console/run.js.map +14 -0
- package/dist/console/runner.d.ts +41 -0
- package/dist/console/runner.d.ts.map +1 -0
- package/dist/console/usage.d.ts +7 -0
- package/dist/console/usage.d.ts.map +1 -0
- 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 +2 -2
- 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/ViewRouter.d.ts.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/i18n/Dictionary.d.ts.map +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +3 -3
- package/dist/kernel/Kernel.d.ts +29 -0
- package/dist/kernel/Kernel.d.ts.map +1 -1
- package/dist/kernel/index.js +3 -3
- package/dist/kernel/index.js.map +3 -3
- 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/cron/ScheduleServiceProvider.d.ts.map +1 -1
- package/dist/services/discovery.d.ts +15 -0
- package/dist/services/discovery.d.ts.map +1 -1
- package/dist/services/index.d.ts +8 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +11 -11
- package/dist/services/index.js.map +2 -2
- package/dist/support/Service.d.ts +90 -0
- package/dist/support/Service.d.ts.map +1 -0
- package/dist/support/discover.d.ts +9 -1
- package/dist/support/discover.d.ts.map +1 -1
- package/dist/support/index.d.ts +1 -0
- package/dist/support/index.d.ts.map +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +4 -3
- package/dist/testing/Page.d.ts +166 -0
- package/dist/testing/Page.d.ts.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +352 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/utils/Subject.d.ts.map +1 -1
- package/dist/utils/variantKey.d.ts +19 -0
- package/dist/utils/variantKey.d.ts.map +1 -0
- package/package.json +3 -1
- package/dist/chunk-6fym5bfg.js +0 -23
- package/dist/chunk-6fym5bfg.js.map +0 -36
- package/dist/chunk-6x6gb7zg.js +0 -4
- package/dist/chunk-8gb1w19q.js +0 -5
- package/dist/chunk-98sj7tkf.js +0 -5
- package/dist/chunk-bm6q0q1q.js +0 -7
- package/dist/chunk-g0w87jtw.js +0 -5
- package/dist/chunk-j4rkk01q.js +0 -5
- package/dist/chunk-j4rkk01q.js.map +0 -10
- package/dist/chunk-tqbp8550.js +0 -5
- package/dist/chunk-y0wg8aq9.js +0 -6
- /package/dist/{chunk-npeq63a2.js.map → chunk-07jtzbf0.js.map} +0 -0
- /package/dist/{chunk-p0z35s59.js.map → chunk-8p6rqegw.js.map} +0 -0
- /package/dist/{chunk-53w1njqz.js.map → chunk-zhsaz9cr.js.map} +0 -0
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../support/discover.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { existsSync, readdirSync } from \"node:fs\";\nimport { join, relative } from \"node:path\";\n\n/**\n * Finding the classes an application declared and never imported — the walk\n * #322 and #323 both end at.\n *\n * ### Why it has to run the files\n *\n * A job that is written and not listed does not fail; it disappears.\n * `QueueManager.next` looks a dispatched name up in the map its config built and\n * skips what is not there, so the dispatch is simply lost. A cron drifts worse:\n * nothing is waiting on a tick, so a job that never fires reports nothing to\n * anyone. What both come down to is that `app/config/queue.ts` naming every\n * `Job` subclass is the *only* thing putting those classes in the module graph —\n * the list and the directory are two spellings of one set, kept in step by hand.\n *\n * The way out of that is to read the directory, and there is no static read that\n * will do: the class does not exist until its module has run. So **every file\n * walked here is imported**, and a file that *does something* when imported does\n * it here — at boot, in production, on every start. `gemi check models` makes\n * the same trade for the same reason and pays it once per CI run; a caller of\n * this pays it once per process.\n *\n * ### What that asks of a caller\n *\n * **Point it at a directory of class declarations, not at `app/`.** The skip\n * rules on `sourceFiles` drop what certainly is not one — tests, benchmarks,\n * `.d.ts`, vendored packages — and nothing else. Widening the guesses is how a\n * discovery pass ends up quietly covering less than the directory holds, which\n * is the same silence in a new place.\n *\n * **Let a broken file stop the boot.** `discoverClasses` rethrows an import\n * failure naming the file rather than dropping it and carrying on, for the same\n * reason: four classes found out of five looks exactly like five out of five.\n *\n * **Leave a way out.** Discovery is what should happen when an app said\n * nothing. An app that lists its classes explicitly must not reach this file at\n * all — that is the escape hatch for a directory holding something this cannot\n * import, and it is the sentence an error from here should point at.\n *\n * ### One more thing worth knowing\n *\n * This imports by absolute path, while the application imports the same files\n * through the `@/app/*` alias. Bun keys its module registry by the *resolved*\n * path, so those two specifiers land on one module: a job already reached from\n * a controller is not evaluated a second time here, and the class object is the\n * same one. `gemi build` leaves that true in production — `packages: \"external\"`\n * keeps the app's own code out of `dist/server/server.mjs` and resolves it from\n * source at runtime, exactly as `gemi dev` does.\n *\n * Nothing here depends on that holding, and deliberately: `QueueManager` and the\n * `Scheduler`'s cross-reload registry are both keyed by name rather than by\n * class identity, so a build that did inline the app's modules would produce a\n * duplicate class object and still register the right job. Worth knowing before\n * writing a registry keyed the other way.\n */\n\n/**\n * The files under `dir` that could declare a class.\n *\n * Everything underneath it, because apps do group classes into folders, minus\n * what cannot be one. Each of these is going to be *imported*, so the exclusions\n * are about what is certainly not source rather than about what is probably not:\n *\n * - **Declaration files.** `.d.ts` has no runtime module behind it.\n * - **Tests, type tests and benchmarks**, by the suffix a runner already\n * recognises.\n * - **Dot-directories and `node_modules`.**\n * - **Any directory holding a `package.json`.** That is a package that happens\n * to live here — a vendored client, a generated SDK — not this app's source,\n * and importing its entry point runs somebody else's module graph. The\n * template has two under `app/models`.\n *\n * `ignore` is the escape hatch for the rest: a path prefix, relative to `dir`,\n * naming a file or a directory of adjacent code that runs something on import.\n * Nothing is ignored by default.\n *\n * The order is the same on every run over the same tree, which matters because\n * the caller is going to import in it: entries are sorted per directory before\n * recursing, and `readdirSync` order is the filesystem's rather than\n * alphabetical — a tree written `A.ts` then `B.ts` reads back `B.ts` first on\n * the machines this was tested on. Sorting per directory rather than sorting the\n * finished list is deliberate: for a tree holding both `a.ts` and `a/b.ts`, this\n * emits `a/b.ts` first, because the directory sorts before the file.\n *\n * A directory that does not exist yields an empty list rather than throwing.\n * \"The app has no jobs yet\" is an ordinary state and not this function's to\n * complain about — but it is indistinguishable from \"the app's source did not\n * ship\", so a caller that boots on the answer owes the reader a word about which\n * one it got.\n */\nexport function sourceFiles(dir: string, ignore: string[] = []): string[] {\n const out: string[] = [];\n\n const ignored = (path: string) => {\n const rel = relative(dir, path).split(\"\\\\\").join(\"/\");\n return ignore.some(\n (pattern) => rel === pattern || rel.startsWith(`${pattern}/`),\n );\n };\n\n const walk = (current: string) => {\n for (const entry of readdirSync(current, { withFileTypes: true }).sort(\n (a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0),\n )) {\n const path = join(current, entry.name);\n if (ignored(path)) continue;\n\n if (entry.isDirectory()) {\n if (entry.name.startsWith(\".\") || entry.name === \"node_modules\")\n continue;\n if (existsSync(join(path, \"package.json\"))) continue;\n walk(path);\n continue;\n }\n\n if (!entry.name.endsWith(\".ts\") && !entry.name.endsWith(\".tsx\")) continue;\n if (entry.name.endsWith(\".d.ts\")) continue;\n if (/\\.(test|test-d|spec|bench)\\.tsx?$/.test(entry.name)) continue;\n\n out.push(path);\n }\n };\n\n if (!existsSync(dir)) return out;\n\n walk(dir);\n return out;\n}\n\n/**\n * A class, as much of one as this file can name. `abstract` so that a base an\n * app never instantiates directly is a legal argument.\n */\ntype ClassLike = abstract new (...args: never[]) => unknown;\n\n/**\n * A file that would not import, reported with the file that would not import.\n *\n * Separate from a bare rethrow because the stack of a failed dynamic import\n * names the module that failed to *resolve*, several frames deep, and says\n * nothing about the walk that asked for it — so the reader learns that some\n * `?raw` specifier is unresolvable without learning that discovery is what\n * imported it, or that listing the classes explicitly is how they get their boot\n * back.\n */\nexport class DiscoveryError extends Error {\n constructor(message: string, options?: { cause?: unknown }) {\n super(message, options);\n this.name = \"DiscoveryError\";\n }\n}\n\n/**\n * Every exported class under `dir` whose prototype chain reaches `base`.\n *\n * `base` is a parameter rather than an import so that this file names no\n * service and stays cheap to depend on — `bin/check-models.ts` uses the walker\n * above and is bundled into `dist/bin/gemi.js`, which is not somewhere gemi's\n * service layer should end up. It is also what lets a test hand in a base class\n * of its own instead of standing up a project that can resolve `gemi/services`.\n *\n * `base` itself is never returned. A directory whose files import their base\n * from a sibling — the shape an app reaches for when several jobs share a gate —\n * re-exports it as often as not, and a framework that scheduled the abstract\n * base along with its subclasses would be running a job nobody wrote.\n *\n * A class is returned once no matter how many exports name it. A barrel in the\n * directory re-exporting everything beside it is the ordinary case, and it makes\n * every class reachable twice.\n *\n * The order is the walk's, and within a file the module namespace's, which the\n * language sorts by name. So the answer is the same on every run — worth having\n * where the caller is a scheduler and the alternative is a boot order that\n * depends on the filesystem.\n *\n * @throws DiscoveryError if a walked file cannot be imported. Not a skip: a file\n * that will not load is a class the caller was going to be told about and now is\n * not, which is the failure discovery exists to remove.\n */\nexport async function discoverClasses<T extends ClassLike>(\n dir: string,\n base: T,\n ignore: string[] = [],\n): Promise<T[]> {\n const found = new Set<T>();\n\n for (const path of sourceFiles(dir, ignore)) {\n let module: Record<string, unknown>;\n\n try {\n module = (await import(path)) as Record<string, unknown>;\n } catch (error) {\n throw new DiscoveryError(\n `${path} could not be imported, so the classes in it could not be ` +\n `discovered:\\n ${(error as Error).message}\\n` +\n `List the classes explicitly in the config slice for this directory ` +\n `to skip the walk.`,\n { cause: error },\n );\n }\n\n for (const value of Object.values(module)) {\n if (typeof value !== \"function\" || value === base) continue;\n if (!Object.prototype.isPrototypeOf.call(base, value)) continue;\n found.add(value as unknown as T);\n }\n }\n\n return [...found];\n}\n\n/**\n * The directory an app's `app/` sits in, as the running process can know it.\n *\n * `ROOT_DIR` is the obvious answer and is not available: `Server.start` awaits\n * `waitForBoot()` — every provider's `register` and `boot` — and only then\n * imports the http layer that sets it. Anything resolving paths during boot is\n * earlier than the variable it would want.\n *\n * What it can use is the same rule `httpProd` computes `ROOT_DIR` with a moment\n * later, which is why that file now calls this instead of repeating it. `gemi\n * dev` and `gemi start` both spawn the server with no `cwd`, so the process\n * inherits the CLI's, and the CLI takes `process.cwd()` for the project root\n * itself — `bun/preload.ts` reads `gemi.config` from it on the same assumption.\n *\n * `httpDev` computes a bare `process.cwd()`, so it and `httpProd` already\n * disagree whenever `GEMI_PROJECT_DIR` is set. Nothing in this repo sets it and\n * `gemi start` ignores it when locating the built entry point, so the two rules\n * are the same rule for every configuration that runs today; the divergence is\n * older than this function and wants its own fix.\n */\nexport function projectRoot(): string {\n return join(process.cwd(), process.env.GEMI_PROJECT_DIR ?? \"\");\n}\n"
|
|
5
|
+
"import { existsSync, readdirSync } from \"node:fs\";\nimport { join, relative } from \"node:path\";\n\n/**\n * Finding the classes an application declared and never imported — the walk\n * #322 and #323 both end at.\n *\n * ### Why it has to run the files\n *\n * A job that is written and not listed does not fail; it disappears.\n * `QueueManager.next` looks a dispatched name up in the map its config built and\n * skips what is not there, so the dispatch is simply lost. A cron drifts worse:\n * nothing is waiting on a tick, so a job that never fires reports nothing to\n * anyone. What both come down to is that `app/config/queue.ts` naming every\n * `Job` subclass is the *only* thing putting those classes in the module graph —\n * the list and the directory are two spellings of one set, kept in step by hand.\n *\n * The way out of that is to read the directory, and there is no static read that\n * will do: the class does not exist until its module has run. So **every file\n * walked here is imported**, and a file that *does something* when imported does\n * it here — at boot, in production, on every start. `gemi check models` makes\n * the same trade for the same reason and pays it once per CI run; a caller of\n * this pays it once per process.\n *\n * ### What that asks of a caller\n *\n * **Point it at a directory of class declarations, not at `app/`.** The skip\n * rules on `sourceFiles` drop what certainly is not one — tests, benchmarks,\n * `.d.ts`, vendored packages — and nothing else. Widening the guesses is how a\n * discovery pass ends up quietly covering less than the directory holds, which\n * is the same silence in a new place.\n *\n * **Let a broken file stop the boot.** `discoverClasses` rethrows an import\n * failure naming the file rather than dropping it and carrying on, for the same\n * reason: four classes found out of five looks exactly like five out of five.\n *\n * **Leave a way out.** Discovery is what should happen when an app said\n * nothing. An app that lists its classes explicitly must not reach this file at\n * all — that is the escape hatch for a directory holding something this cannot\n * import, and it is the sentence an error from here should point at.\n *\n * ### One more thing worth knowing\n *\n * This imports by absolute path, while the application imports the same files\n * through the `@/app/*` alias. Bun keys its module registry by the *resolved*\n * path, so those two specifiers land on one module: a job already reached from\n * a controller is not evaluated a second time here, and the class object is the\n * same one. `gemi build` leaves that true in production — `packages: \"external\"`\n * keeps the app's own code out of `dist/server/server.mjs` and resolves it from\n * source at runtime, exactly as `gemi dev` does.\n *\n * Nothing here depends on that holding, and deliberately: `QueueManager` and the\n * `Scheduler`'s cross-reload registry are both keyed by name rather than by\n * class identity, so a build that did inline the app's modules would produce a\n * duplicate class object and still register the right job. Worth knowing before\n * writing a registry keyed the other way.\n */\n\n/**\n * The files under `dir` that could declare a class.\n *\n * Everything underneath it, because apps do group classes into folders, minus\n * what cannot be one. Each of these is going to be *imported*, so the exclusions\n * are about what is certainly not source rather than about what is probably not:\n *\n * - **Declaration files.** `.d.ts` has no runtime module behind it.\n * - **Tests, type tests and benchmarks**, by the suffix a runner already\n * recognises.\n * - **Dot-directories and `node_modules`.**\n * - **Any directory holding a `package.json`.** That is a package that happens\n * to live here — a vendored client, a generated SDK — not this app's source,\n * and importing its entry point runs somebody else's module graph. The\n * template has two under `app/models`.\n *\n * `ignore` is the escape hatch for the rest: a path prefix, relative to `dir`,\n * naming a file or a directory of adjacent code that runs something on import.\n * Nothing is ignored by default.\n *\n * The order is the same on every run over the same tree, which matters because\n * the caller is going to import in it: entries are sorted per directory before\n * recursing, and `readdirSync` order is the filesystem's rather than\n * alphabetical — a tree written `A.ts` then `B.ts` reads back `B.ts` first on\n * the machines this was tested on. Sorting per directory rather than sorting the\n * finished list is deliberate: for a tree holding both `a.ts` and `a/b.ts`, this\n * emits `a/b.ts` first, because the directory sorts before the file.\n *\n * A directory that does not exist yields an empty list rather than throwing.\n * \"The app has no jobs yet\" is an ordinary state and not this function's to\n * complain about — but it is indistinguishable from \"the app's source did not\n * ship\", so a caller that boots on the answer owes the reader a word about which\n * one it got.\n */\nexport function sourceFiles(dir: string, ignore: string[] = []): string[] {\n const out: string[] = [];\n\n const ignored = (path: string) => {\n const rel = relative(dir, path).split(\"\\\\\").join(\"/\");\n return ignore.some(\n (pattern) => rel === pattern || rel.startsWith(`${pattern}/`),\n );\n };\n\n const walk = (current: string) => {\n for (const entry of readdirSync(current, { withFileTypes: true }).sort(\n (a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0),\n )) {\n const path = join(current, entry.name);\n if (ignored(path)) continue;\n\n if (entry.isDirectory()) {\n if (entry.name.startsWith(\".\") || entry.name === \"node_modules\")\n continue;\n if (existsSync(join(path, \"package.json\"))) continue;\n walk(path);\n continue;\n }\n\n if (!entry.name.endsWith(\".ts\") && !entry.name.endsWith(\".tsx\")) continue;\n if (entry.name.endsWith(\".d.ts\")) continue;\n if (/\\.(test|test-d|spec|bench)\\.tsx?$/.test(entry.name)) continue;\n\n out.push(path);\n }\n };\n\n if (!existsSync(dir)) return out;\n\n walk(dir);\n return out;\n}\n\n/**\n * A class, as much of one as this file can name. `abstract` so that a base an\n * app never instantiates directly is a legal argument.\n */\ntype ClassLike = abstract new (...args: never[]) => unknown;\n\n/**\n * A file that would not import, reported with the file that would not import.\n *\n * Separate from a bare rethrow because the stack of a failed dynamic import\n * names the module that failed to *resolve*, several frames deep, and says\n * nothing about the walk that asked for it — so the reader learns that some\n * `?raw` specifier is unresolvable without learning that discovery is what\n * imported it, or that listing the classes explicitly is how they get their boot\n * back.\n */\nexport class DiscoveryError extends Error {\n constructor(message: string, options?: { cause?: unknown }) {\n super(message, options);\n this.name = \"DiscoveryError\";\n }\n}\n\n/**\n * Every exported class under `dir` whose prototype chain reaches `base`.\n *\n * `base` is a parameter rather than an import so that this file names no\n * service and stays cheap to depend on — `bin/check-models.ts` uses the walker\n * above and is bundled into `dist/bin/gemi.js`, which is not somewhere gemi's\n * service layer should end up. It is also what lets a test hand in a base class\n * of its own instead of standing up a project that can resolve `gemi/services`.\n *\n * `base` itself is never returned. A directory whose files import their base\n * from a sibling — the shape an app reaches for when several jobs share a gate —\n * re-exports it as often as not, and a framework that scheduled the abstract\n * base along with its subclasses would be running a job nobody wrote.\n *\n * A class is returned once no matter how many exports name it. A barrel in the\n * directory re-exporting everything beside it is the ordinary case, and it makes\n * every class reachable twice.\n *\n * The order is the walk's, and within a file the module namespace's, which the\n * language sorts by name. So the answer is the same on every run — worth having\n * where the caller is a scheduler and the alternative is a boot order that\n * depends on the filesystem.\n *\n * `onSkipped` is handed every export that did *not* match, with the file it came\n * from. Discovery's characteristic failure is a thing the author wrote and this\n * walk cannot see, and by the time an export has been discarded here the\n * information about why is gone — the caller is left holding \"four classes\"\n * where the directory holds five. A caller that can recognise its own\n * near-misses, as `discoverCommands` recognises a builder chain that was never\n * finished, uses this to say so by name instead.\n *\n * @throws DiscoveryError if a walked file cannot be imported. Not a skip: a file\n * that will not load is a class the caller was going to be told about and now is\n * not, which is the failure discovery exists to remove.\n */\nexport async function discoverClasses<T extends ClassLike>(\n dir: string,\n base: T,\n ignore: string[] = [],\n onSkipped?: (value: unknown, file: string) => void,\n): Promise<T[]> {\n const found = new Set<T>();\n\n for (const path of sourceFiles(dir, ignore)) {\n let module: Record<string, unknown>;\n\n try {\n module = (await import(path)) as Record<string, unknown>;\n } catch (error) {\n throw new DiscoveryError(\n `${path} could not be imported, so the classes in it could not be ` +\n `discovered:\\n ${(error as Error).message}\\n` +\n `List the classes explicitly in the config slice for this directory ` +\n `to skip the walk.`,\n { cause: error },\n );\n }\n\n for (const value of Object.values(module)) {\n if (\n typeof value === \"function\" &&\n value !== base &&\n Object.prototype.isPrototypeOf.call(base, value)\n ) {\n found.add(value as unknown as T);\n continue;\n }\n\n onSkipped?.(value, path);\n }\n }\n\n return [...found];\n}\n\n/**\n * The directory an app's `app/` sits in, as the running process can know it.\n *\n * `ROOT_DIR` is the obvious answer and is not available: `Server.start` awaits\n * `waitForBoot()` — every provider's `register` and `boot` — and only then\n * imports the http layer that sets it. Anything resolving paths during boot is\n * earlier than the variable it would want.\n *\n * What it can use is the same rule `httpProd` computes `ROOT_DIR` with a moment\n * later, which is why that file now calls this instead of repeating it. `gemi\n * dev` and `gemi start` both spawn the server with no `cwd`, so the process\n * inherits the CLI's, and the CLI takes `process.cwd()` for the project root\n * itself — `bun/preload.ts` reads `gemi.config` from it on the same assumption.\n *\n * `httpDev` computes a bare `process.cwd()`, so it and `httpProd` already\n * disagree whenever `GEMI_PROJECT_DIR` is set. Nothing in this repo sets it and\n * `gemi start` ignores it when locating the built entry point, so the two rules\n * are the same rule for every configuration that runs today; the divergence is\n * older than this function and wants its own fix.\n */\nexport function projectRoot(): string {\n return join(process.cwd(), process.env.GEMI_PROJECT_DIR ?? \"\");\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": ";AAAA,qBAAS,iBAAY,WACrB,eAAS,cAAM,aA2FR,SAAS,CAAW,CAAC,EAAa,EAAmB,CAAC,EAAa,CACxE,IAAM,EAAgB,CAAC,EAEjB,EAAU,CAAC,IAAiB,CAChC,IAAM,EAAM,EAAS,EAAK,CAAI,EAAE,MAAM,IAAI,EAAE,KAAK,GAAG,EACpD,OAAO,EAAO,KACZ,CAAC,IAAY,IAAQ,GAAW,EAAI,WAAW,GAAG,IAAU,CAC9D,GAGI,EAAO,CAAC,IAAoB,CAChC,QAAW,KAAS,EAAY,EAAS,CAAE,cAAe,EAAK,CAAC,EAAE,KAChE,CAAC,EAAG,IAAO,EAAE,KAAO,EAAE,KAAO,GAAK,EA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@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{Z as
|
|
2
|
+
import{Ja as J}from"./chunk-tztqkat2.js";import{Qe as I}from"./chunk-0h3jr9d9.js";var Z=I((Q)=>{var K=J(),L=(b)=>{return{setHttpHandler(j){b.httpHandler=j},httpHandler(){return b.httpHandler},updateHttpClientConfig(j,w){b.httpHandler?.updateHttpClientConfig(j,w)},httpHandlerConfigs(){return b.httpHandler.httpHandlerConfigs()}}},M=(b)=>{return{httpHandler:b.httpHandler()}};class B{name;kind;values;constructor({name:b,kind:j=K.FieldPosition.HEADER,values:w=[]}){this.name=b,this.kind=j,this.values=w}add(b){this.values.push(b)}set(b){this.values=b}remove(b){this.values=this.values.filter((j)=>j!==b)}toString(){return this.values.map((b)=>b.includes(",")||b.includes(" ")?`"${b}"`:b).join(", ")}get(){return this.values}}class D{entries={};encoding;constructor({fields:b=[],encoding:j="utf-8"}){b.forEach(this.setField.bind(this)),this.encoding=j}setField(b){this.entries[b.name.toLowerCase()]=b}getField(b){return this.entries[b.toLowerCase()]}removeField(b){delete this.entries[b.toLowerCase()]}getByType(b){return Object.values(this.entries).filter((j)=>j.kind===b)}}class z{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;constructor(b){this.method=b.method||"GET",this.hostname=b.hostname||"localhost",this.port=b.port,this.query=b.query||{},this.headers=b.headers||{},this.body=b.body,this.protocol=b.protocol?b.protocol.slice(-1)!==":"?`${b.protocol}:`:b.protocol:"https:",this.path=b.path?b.path.charAt(0)!=="/"?`/${b.path}`:b.path:"/",this.username=b.username,this.password=b.password,this.fragment=b.fragment}static clone(b){let j=new z({...b,headers:{...b.headers}});if(j.query)j.query=O(j.query);return j}static isInstance(b){if(!b)return!1;let j=b;return"method"in j&&"protocol"in j&&"hostname"in j&&"path"in j&&typeof j.query==="object"&&typeof j.headers==="object"}clone(){return z.clone(this)}}function O(b){return Object.keys(b).reduce((j,w)=>{let A=b[w];return{...j,[w]:Array.isArray(A)?[...A]:A}},{})}class G{statusCode;reason;headers;body;constructor(b){this.statusCode=b.statusCode,this.reason=b.reason,this.headers=b.headers||{},this.body=b.body}static isInstance(b){if(!b)return!1;let j=b;return typeof j.statusCode==="number"&&typeof j.headers==="object"}}function P(b){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(b)}Q.Field=B;Q.Fields=D;Q.HttpRequest=z;Q.HttpResponse=G;Q.getHttpHandlerExtensionConfiguration=L;Q.isValidHostname=P;Q.resolveHttpHandlerRuntimeConfig=M});
|
|
3
|
+
export{Z as za};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=1E3C20A9F9B3A73B64756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"'use strict';\n\nvar types = require('@smithy/types');\n\nconst getHttpHandlerExtensionConfiguration = (runtimeConfig) => {\n return {\n setHttpHandler(handler) {\n runtimeConfig.httpHandler = handler;\n },\n httpHandler() {\n return runtimeConfig.httpHandler;\n },\n updateHttpClientConfig(key, value) {\n runtimeConfig.httpHandler?.updateHttpClientConfig(key, value);\n },\n httpHandlerConfigs() {\n return runtimeConfig.httpHandler.httpHandlerConfigs();\n },\n };\n};\nconst resolveHttpHandlerRuntimeConfig = (httpHandlerExtensionConfiguration) => {\n return {\n httpHandler: httpHandlerExtensionConfiguration.httpHandler(),\n };\n};\n\nclass Field {\n name;\n kind;\n values;\n constructor({ name, kind = types.FieldPosition.HEADER, values = [] }) {\n this.name = name;\n this.kind = kind;\n this.values = values;\n }\n add(value) {\n this.values.push(value);\n }\n set(values) {\n this.values = values;\n }\n remove(value) {\n this.values = this.values.filter((v) => v !== value);\n }\n toString() {\n return this.values.map((v) => (v.includes(\",\") || v.includes(\" \") ? `\"${v}\"` : v)).join(\", \");\n }\n get() {\n return this.values;\n }\n}\n\nclass Fields {\n entries = {};\n encoding;\n constructor({ fields = [], encoding = \"utf-8\" }) {\n fields.forEach(this.setField.bind(this));\n this.encoding = encoding;\n }\n setField(field) {\n this.entries[field.name.toLowerCase()] = field;\n }\n getField(name) {\n return this.entries[name.toLowerCase()];\n }\n removeField(name) {\n delete this.entries[name.toLowerCase()];\n }\n getByType(kind) {\n return Object.values(this.entries).filter((field) => field.kind === kind);\n }\n}\n\nclass HttpRequest {\n method;\n protocol;\n hostname;\n port;\n path;\n query;\n headers;\n username;\n password;\n fragment;\n body;\n constructor(options) {\n this.method = options.method || \"GET\";\n this.hostname = options.hostname || \"localhost\";\n this.port = options.port;\n this.query = options.query || {};\n this.headers = options.headers || {};\n this.body = options.body;\n this.protocol = options.protocol\n ? options.protocol.slice(-1) !== \":\"\n ? `${options.protocol}:`\n : options.protocol\n : \"https:\";\n this.path = options.path ? (options.path.charAt(0) !== \"/\" ? `/${options.path}` : options.path) : \"/\";\n this.username = options.username;\n this.password = options.password;\n this.fragment = options.fragment;\n }\n static clone(request) {\n const cloned = new HttpRequest({\n ...request,\n headers: { ...request.headers },\n });\n if (cloned.query) {\n cloned.query = cloneQuery(cloned.query);\n }\n return cloned;\n }\n static isInstance(request) {\n if (!request) {\n return false;\n }\n const req = request;\n return (\"method\" in req &&\n \"protocol\" in req &&\n \"hostname\" in req &&\n \"path\" in req &&\n typeof req[\"query\"] === \"object\" &&\n typeof req[\"headers\"] === \"object\");\n }\n clone() {\n return HttpRequest.clone(this);\n }\n}\nfunction cloneQuery(query) {\n return Object.keys(query).reduce((carry, paramName) => {\n const param = query[paramName];\n return {\n ...carry,\n [paramName]: Array.isArray(param) ? [...param] : param,\n };\n }, {});\n}\n\nclass HttpResponse {\n statusCode;\n reason;\n headers;\n body;\n constructor(options) {\n this.statusCode = options.statusCode;\n this.reason = options.reason;\n this.headers = options.headers || {};\n this.body = options.body;\n }\n static isInstance(response) {\n if (!response)\n return false;\n const resp = response;\n return typeof resp.statusCode === \"number\" && typeof resp.headers === \"object\";\n }\n}\n\nfunction isValidHostname(hostname) {\n const hostPattern = /^[a-z0-9][a-z0-9\\.\\-]*[a-z0-9]$/;\n return hostPattern.test(hostname);\n}\n\nexports.Field = Field;\nexports.Fields = Fields;\nexports.HttpRequest = HttpRequest;\nexports.HttpResponse = HttpResponse;\nexports.getHttpHandlerExtensionConfiguration = getHttpHandlerExtensionConfiguration;\nexports.isValidHostname = isValidHostname;\nexports.resolveHttpHandlerRuntimeConfig = resolveHttpHandlerRuntimeConfig;\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";sGAEA,FAAI,MAEE,EAAuC,CAAC,IAAkB,CAC5D,MAAO,CACH,cAAc,CAAC,EAAS,CACpB,EAAc,YAAc,GAEhC,WAAW,EAAG,CACV,OAAO,EAAc,aAEzB,sBAAsB,CAAC,EAAK,EAAO,CAC/B,EAAc,aAAa,uBAAuB,EAAK,CAAK,GAEhE,kBAAkB,EAAG,CACjB,OAAO,EAAc,YAAY,mBAAmB,EAE5D,GAEE,EAAkC,CAAC,IAAsC,CAC3E,MAAO,CACH,YAAa,EAAkC,YAAY,CAC/D,GAGJ,MAAM,CAAM,CACR,KACA,KACA,OACA,WAAW,EAAG,OAAM,OAAO,EAAM,cAAc,OAAQ,SAAS,CAAC,GAAK,CAClE,KAAK,KAAO,EACZ,KAAK,KAAO,EACZ,KAAK,OAAS,EAElB,GAAG,CAAC,EAAO,CACP,KAAK,OAAO,KAAK,CAAK,EAE1B,GAAG,CAAC,EAAQ,CACR,KAAK,OAAS,EAElB,MAAM,CAAC,EAAO,CACV,KAAK,OAAS,KAAK,OAAO,OAAO,CAAC,IAAM,IAAM,CAAK,EAEvD,QAAQ,EAAG,CACP,OAAO,KAAK,OAAO,IAAI,CAAC,IAAO,EAAE,SAAS,GAAG,GAAK,EAAE,SAAS,GAAG,EAAI,IAAI,KAAO,CAAE,EAAE,KAAK,IAAI,EAEhG,GAAG,EAAG,CACF,OAAO,KAAK,OAEpB,CAEA,MAAM,CAAO,CACT,QAAU,CAAC,EACX,SACA,WAAW,EAAG,SAAS,CAAC,EAAG,WAAW,SAAW,CAC7C,EAAO,QAAQ,KAAK,SAAS,KAAK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I,UAAe,SAElC,KAAK,EAAG,CACJ,OAAO,EAAY,MAAM,IAAI,EAErC,CACA,SAAS,CAAU,CAAC,EAAO,CACvB,OAAO,OAAO,KAAK,CAAK,EAAE,OAAO,CAAC,EAAO,IAAc,CACnD,IAAM,EAAQ,EAAM,GACpB,MAAO,IACA,GACF,GAAY,MAAM,QAAQ,CAAK,EAAI,CAAC,GAAG,CAAK,EAAI,CACrD,GACD,CAAC,CAAC,EAGT,MAAM,CAAa,CACf,WACA,OACA,QACA,KACA,WAAW,CAAC,EAAS,CACjB,KAAK,WAAa,EAAQ,WAC1B,KAAK,OAAS,EAAQ,OACtB,KAAK,QAAU,EAAQ,SAAW,CAAC,EACnC,KAAK,KAAO,EAAQ,WAEjB,WAAU,CAAC,EAAU,CACxB,GAAI,CAAC,EACD,MAAO,GACX,IAAM,EAAO,EACb,OAAO,OAAO,EAAK,aAAe,UAAY,OAAO,EAAK,UAAY,SAE9E,CAEA,SAAS,CAAe,CAAC,EAAU,CAE/B,MADoB,kCACD,KAAK,CAAQ,EAG5B,QAAQ,EACR,SAAS,EACT,cAAc,EACd,eAAe,EACf,uCAAuC,EACvC,kBAAkB,EAClB,kCAAkC",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "1E3C20A9F9B3A73B64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{v as
|
|
2
|
+
import{Qe as y}from"./chunk-0h3jr9d9.js";var v=y((x)=>{class s extends Error{name="ProviderError";tryNextLink;constructor(r,t=!0){let n,e=!0;if(typeof t==="boolean")n=void 0,e=t;else if(t!=null&&typeof t==="object")n=t.logger,e=t.tryNextLink??!0;super(r);this.tryNextLink=e,Object.setPrototypeOf(this,s.prototype),n?.debug?.(`@smithy/property-provider ${e?"->":"(!)"} ${r}`)}static from(r,t=!0){return Object.assign(new this(r.message,t),r)}}class f extends s{name="CredentialsProviderError";constructor(r,t=!0){super(r,t);Object.setPrototypeOf(this,f.prototype)}}class l extends s{name="TokenProviderError";constructor(r,t=!0){super(r,t);Object.setPrototypeOf(this,l.prototype)}}var p=(...r)=>async()=>{if(r.length===0)throw new s("No providers in chain");let t;for(let n of r)try{return await n()}catch(e){if(t=e,e?.tryNextLink)continue;throw e}throw t},d=(r)=>()=>Promise.resolve(r),h=(r,t,n)=>{let e,o,i,c=!1,a=async()=>{if(!o)o=r();try{e=await o,i=!0,c=!1}finally{o=void 0}return e};if(t===void 0)return async(u)=>{if(!i||u?.forceRefresh)e=await a();return e};return async(u)=>{if(!i||u?.forceRefresh)e=await a();if(c)return e;if(n&&!n(e))return c=!0,e;if(t(e))return await a(),e;return e}};x.CredentialsProviderError=f;x.ProviderError=s;x.TokenProviderError=l;x.chain=p;x.fromStatic=d;x.memoize=h});
|
|
3
|
+
export{v as Ka};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=AEB1FC0502E579DA64756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"'use strict';\n\nclass ProviderError extends Error {\n name = \"ProviderError\";\n tryNextLink;\n constructor(message, options = true) {\n let logger;\n let tryNextLink = true;\n if (typeof options === \"boolean\") {\n logger = undefined;\n tryNextLink = options;\n }\n else if (options != null && typeof options === \"object\") {\n logger = options.logger;\n tryNextLink = options.tryNextLink ?? true;\n }\n super(message);\n this.tryNextLink = tryNextLink;\n Object.setPrototypeOf(this, ProviderError.prototype);\n logger?.debug?.(`@smithy/property-provider ${tryNextLink ? \"->\" : \"(!)\"} ${message}`);\n }\n static from(error, options = true) {\n return Object.assign(new this(error.message, options), error);\n }\n}\n\nclass CredentialsProviderError extends ProviderError {\n name = \"CredentialsProviderError\";\n constructor(message, options = true) {\n super(message, options);\n Object.setPrototypeOf(this, CredentialsProviderError.prototype);\n }\n}\n\nclass TokenProviderError extends ProviderError {\n name = \"TokenProviderError\";\n constructor(message, options = true) {\n super(message, options);\n Object.setPrototypeOf(this, TokenProviderError.prototype);\n }\n}\n\nconst chain = (...providers) => async () => {\n if (providers.length === 0) {\n throw new ProviderError(\"No providers in chain\");\n }\n let lastProviderError;\n for (const provider of providers) {\n try {\n const credentials = await provider();\n return credentials;\n }\n catch (err) {\n lastProviderError = err;\n if (err?.tryNextLink) {\n continue;\n }\n throw err;\n }\n }\n throw lastProviderError;\n};\n\nconst fromStatic = (staticValue) => () => Promise.resolve(staticValue);\n\nconst memoize = (provider, isExpired, requiresRefresh) => {\n let resolved;\n let pending;\n let hasResult;\n let isConstant = false;\n const coalesceProvider = async () => {\n if (!pending) {\n pending = provider();\n }\n try {\n resolved = await pending;\n hasResult = true;\n isConstant = false;\n }\n finally {\n pending = undefined;\n }\n return resolved;\n };\n if (isExpired === undefined) {\n return async (options) => {\n if (!hasResult || options?.forceRefresh) {\n resolved = await coalesceProvider();\n }\n return resolved;\n };\n }\n return async (options) => {\n if (!hasResult || options?.forceRefresh) {\n resolved = await coalesceProvider();\n }\n if (isConstant) {\n return resolved;\n }\n if (requiresRefresh && !requiresRefresh(resolved)) {\n isConstant = true;\n return resolved;\n }\n if (isExpired(resolved)) {\n await coalesceProvider();\n return resolved;\n }\n return resolved;\n };\n};\n\nexports.CredentialsProviderError = CredentialsProviderError;\nexports.ProviderError = ProviderError;\nexports.TokenProviderError = TokenProviderError;\nexports.chain = chain;\nexports.fromStatic = fromStatic;\nexports.memoize = memoize;\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";uDAEA,MAAM,UAAsB,KAAM,CAC9B,KAAO,gBACP,YACA,WAAW,CAAC,EAAS,EAAU,GAAM,CACjC,IAAI,EACA,EAAc,GAClB,GAAI,OAAO,IAAY,UACnB,EAAS,OACT,EAAc,EAEb,QAAI,GAAW,MAAQ,OAAO,IAAY,SAC3C,EAAS,EAAQ,OACjB,EAAc,EAAQ,aAAe,GAEzC,MAAM,CAAO,EACb,KAAK,YAAc,EACnB,OAAO,eAAe,KAAM,EAAc,SAAS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,GAAI,EAAU,CAAQ,EAElB,OADA,MAAM,EAAiB,EAChB,EAEX,OAAO,IAIP,2BAA2B,EAC3B,gBAAgB,EAChB,qBAAqB,EACrB,QAAQ,EACR,aAAa,EACb,UAAU",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "AEB1FC0502E579DA64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ga as r}from"./chunk-ebcgdv00.js";import{Ha as mc}from"./chunk-q09mmr05.js";import"./chunk-t4n25km9.js";import"./chunk-tztqkat2.js";import{Ka as _}from"./chunk-kaxvw75w.js";import{Pe as u,Se as O}from"./chunk-0h3jr9d9.js";import{Buffer as hc}from"buffer";import{request as Yc}from"http";function E(c){return new Promise((I,x)=>{let N=Yc({method:"GET",...c,hostname:c.hostname?.replace(/^\[(.+)\]$/,"$1")});N.on("error",(T)=>{x(Object.assign(new K.ProviderError("Unable to connect to instance metadata service"),T)),N.destroy()}),N.on("timeout",()=>{x(new K.ProviderError("TimeoutError from instance metadata service")),N.destroy()}),N.on("response",(T)=>{let{statusCode:y=400}=T;if(y<200||300<=y)x(Object.assign(new K.ProviderError("Error response received from instance metadata service"),{statusCode:y})),N.destroy();let $=[];T.on("data",(w)=>{$.push(w)}),T.on("end",()=>{I(hc.concat($)),N.destroy()})}),N.end()})}var K;var D=O(()=>{K=u(_(),1)});var G=(c)=>Boolean(c)&&typeof c==="object"&&typeof c.AccessKeyId==="string"&&typeof c.SecretAccessKey==="string"&&typeof c.Token==="string"&&typeof c.Expiration==="string",L=(c)=>({accessKeyId:c.AccessKeyId,secretAccessKey:c.SecretAccessKey,sessionToken:c.Token,expiration:new Date(c.Expiration),...c.AccountId&&{accountId:c.AccountId}});var W=()=>{};var Hc=1000,qc=0,Q=({maxRetries:c=0,timeout:I=1000})=>({maxRetries:c,timeout:I});var X=()=>{};var v=(c,I)=>{let x=c();for(let N=0;N<I;N++)x=x.catch(c);return x};var b=()=>{};import{parse as Sc}from"url";var z,H="AWS_CONTAINER_CREDENTIALS_FULL_URI",q="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",M="AWS_CONTAINER_AUTHORIZATION_TOKEN",kc=(c={})=>{let{timeout:I,maxRetries:x}=Q(c);return()=>v(async()=>{let N=await jc({logger:c.logger}),T=JSON.parse(await fc(I,N));if(!G(T))throw new z.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:c.logger});return L(T)},x)},fc=async(c,I)=>{if(process.env[M])I.headers={...I.headers,Authorization:process.env[M]};return(await E({...I,timeout:c})).toString()},uc="169.254.170.2",Ec,$c,jc=async({logger:c})=>{if(process.env[q])return{hostname:uc,path:process.env[q]};if(process.env[H]){let I=Sc(process.env[H]);if(!I.hostname||!(I.hostname in Ec))throw new z.CredentialsProviderError(`${I.hostname} is not a valid container metadata service hostname`,{tryNextLink:!1,logger:c});if(!I.protocol||!(I.protocol in $c))throw new z.CredentialsProviderError(`${I.protocol} is not a valid container metadata service protocol`,{tryNextLink:!1,logger:c});return{...I,port:I.port?parseInt(I.port,10):void 0}}throw new z.CredentialsProviderError(`The container metadata credential provider cannot be used unless the ${q} or ${H} environment variable is set`,{tryNextLink:!1,logger:c})};var p=O(()=>{D();W();X();b();z=u(_(),1),Ec={localhost:!0,"127.0.0.1":!0},$c={"http:":!0,"https:":!0}});var C,Z;var a=O(()=>{C=u(_(),1);Z=class Z extends C.CredentialsProviderError{tryNextLink;name="InstanceMetadataV1FallbackError";constructor(c,I=!0){super(c,I);this.tryNextLink=I,Object.setPrototypeOf(this,Z.prototype)}}});var J;var B=O(()=>{(function(c){c.IPv4="http://169.254.169.254",c.IPv6="http://[fd00:ec2::254]"})(J||(J={}))});var n;var o=O(()=>{n={environmentVariableSelector:(c)=>c.AWS_EC2_METADATA_SERVICE_ENDPOINT,configFileSelector:(c)=>c.ec2_metadata_service_endpoint,default:void 0}});var f;var t=O(()=>{(function(c){c.IPv4="IPv4",c.IPv6="IPv6"})(f||(f={}))});var Ac="AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE",Jc="ec2_metadata_service_endpoint_mode",s;var g=O(()=>{t();s={environmentVariableSelector:(c)=>c[Ac],configFileSelector:(c)=>c[Jc],default:f.IPv4}});var U,l,F=async()=>l.parseUrl(await vc()||await zc()),vc=async()=>U.loadConfig(n)(),zc=async()=>{let c=await U.loadConfig(s)();switch(c){case f.IPv4:return J.IPv4;case f.IPv6:return J.IPv6;default:throw Error(`Unsupported endpoint mode: ${c}. Select from ${Object.values(f)}`)}};var P=O(()=>{B();o();t();g();U=u(r(),1),l=u(mc(),1)});var V=(c,I)=>{let x=300+Math.floor(Math.random()*300),N=new Date(Date.now()+x*1000);I.warn(`Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(N)}.
|
|
3
3
|
For more information, please visit: https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html`);let T=c.originalExpiration??c.expiration;return{...c,...T?{originalExpiration:T}:{},expiration:N}};var d=()=>{};var e=(c,I={})=>{let x=I?.logger||console,N;return async()=>{let T;try{if(T=await c(),T.expiration&&T.expiration.getTime()<Date.now())T=V(T,x)}catch(y){if(N)x.warn("Credential renew failed: ",y),T=V(N,x);else throw y}return N=T,T}};var i=O(()=>{d()});var Nc,k,Tc="/latest/meta-data/iam/security-credentials/",Kc="/latest/api/token",R="AWS_EC2_METADATA_V1_DISABLED",cc="ec2_metadata_v1_disabled",Ic="x-aws-ec2-metadata-token",YI=(c={})=>e(_c(c),{logger:c.logger}),_c=(c={})=>{let I=!1,{logger:x,profile:N}=c,{timeout:T,maxRetries:y}=Q(c),$=async(w,j)=>{if(I||j.headers?.[Ic]==null){let h=!1,Y=!1,wc=await Nc.loadConfig({environmentVariableSelector:(S)=>{let A=S[R];if(Y=!!A&&A!=="false",A===void 0)throw new k.CredentialsProviderError(`${R} not set in env, checking config file next.`,{logger:c.logger});return Y},configFileSelector:(S)=>{let A=S[cc];return h=!!A&&A!=="false",h},default:!1},{profile:N})();if(c.ec2MetadataV1Disabled||wc){let S=[];if(c.ec2MetadataV1Disabled)S.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");if(h)S.push(`config file profile (${cc})`);if(Y)S.push(`process environment variable (${R})`);throw new Z(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${S.join(", ")}].`)}}let yc=(await v(async()=>{let h;try{h=await Gc(j)}catch(Y){if(Y.statusCode===401)I=!1;throw Y}return h},w)).trim();return v(async()=>{let h;try{h=await Lc(yc,j,c)}catch(Y){if(Y.statusCode===401)I=!1;throw Y}return h},w)};return async()=>{let w=await F();if(I)return x?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)"),$(y,{...w,timeout:T});else{let j;try{j=(await Dc({...w,timeout:T})).toString()}catch(m){if(m?.statusCode===400)throw Object.assign(m,{message:"EC2 Metadata token request returned error"});else if(m.message==="TimeoutError"||[403,404,405].includes(m.statusCode))I=!0;return x?.debug("AWS SDK Instance Metadata","using v1 fallback (initial)"),$(y,{...w,timeout:T})}return $(y,{...w,headers:{[Ic]:j},timeout:T})}}},Dc=async(c)=>E({...c,path:Kc,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}}),Gc=async(c)=>(await E({...c,path:Tc})).toString(),Lc=async(c,I,x)=>{let N=JSON.parse((await E({...I,path:Tc+c})).toString());if(!G(N))throw new k.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:x.logger});return L(N)};var xc=O(()=>{a();D();W();X();b();P();i();Nc=u(r(),1),k=u(_(),1)});var Oc=()=>{};var Qc=O(()=>{D();P();B();p();xc();X();Oc()});Qc();export{Q as providerConfigFromInit,E as httpRequest,F as getInstanceMetadataEndpoint,YI as fromInstanceMetadata,kc as fromContainerMetadata,J as Endpoint,q as ENV_CMDS_RELATIVE_URI,H as ENV_CMDS_FULL_URI,M as ENV_CMDS_AUTH_TOKEN,Hc as DEFAULT_TIMEOUT,qc as DEFAULT_MAX_RETRIES};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=EE5320923726C6F864756E2164756E21
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
"export * from \"./fromContainerMetadata\";\nexport * from \"./fromInstanceMetadata\";\nexport * from \"./remoteProvider/RemoteProviderInit\";\nexport * from \"./types\";\nexport { httpRequest } from \"./remoteProvider/httpRequest\";\nexport { getInstanceMetadataEndpoint } from \"./utils/getInstanceMetadataEndpoint\";\nexport { Endpoint } from \"./config/Endpoint\";\n"
|
|
20
20
|
],
|
|
21
21
|
"mappings": ";mQACA,WAAS,UACT,YAAS,QACF,GAAS,CAAW,CAAC,EAAS,CACjC,OAAO,IAAI,QAAQ,CAAC,EAAS,IAAW,CACpC,IAAM,EAAM,GAAQ,CAChB,OAAQ,SACL,EACH,SAAU,EAAQ,UAAU,QAAQ,aAAc,IAAI,CAC1D,CAAC,EACD,EAAI,GAAG,QAAS,CAAC,IAAQ,CACrB,EAAO,OAAO,OAAO,IAAI,gBAAc,gDAAgD,EAAG,CAAG,CAAC,EAC9F,EAAI,QAAQ,EACf,EACD,EAAI,GAAG,UAAW,IAAM,CACpB,EAAO,IAAI,gBAAc,6CAA6C,CAAC,EACvE,EAAI,QAAQ,EACf,EACD,EAAI,GAAG,WAAY,CAAC,IAAQ,CACxB,IAAQ,aAAa,KAAQ,EAC7B,GAAI,EAAa,KAAO,KAAO,EAC3B,EAAO,OAAO,OAAO,IAAI,gBAAc,wDAAwD,EAAG,CAAE,YAAW,CAAC,CAAC,EACjH,EAAI,QAAQ,EAEhB,IAAM,EAAS,CAAC,EAChB,EAAI,GAAG,OAAQ,CAAC,IAAU,CACtB,EAAO,KAAK,CAAK,EACpB,EACD,EAAI,GAAG,MAAO,IAAM,CAChB,EAAQ,GAAO,OAAO,CAAM,CAAC,EAC7B,EAAI,QAAQ,EACf,EACJ,EACD,EAAI,IAAI,EACX,MAlCL,gCCAa,EAAoB,CAAC,IAA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-1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
function j(h){return h}function p(){return{supportedLocales:[],defaultLocale:"en-US",prefetch:{},components:{},detectLocale:()=>null,onLocaleChange:(h)=>{console.log(`Locale changed to ${h}`)}}}
|
|
3
|
-
export{j as
|
|
3
|
+
export{j as zb,p as Ab};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=45983B44768F956064756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import 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 prefetch?: Record<string, Array<Dictionary<any>>>;\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\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 };\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AAeO,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,EAE7C",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "45983B44768F956064756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Oe as j}from"./chunk-qyaqg07q.js";function $(z){return z.split(".")}class X{static token="config";items;constructor(z={}){this.items=z}has(z){let H=this.items;for(let G of $(z)){if(H===null||typeof H!=="object"||!(G in H))return!1;H=H[G]}return!0}get(z,H){let G=this.items;for(let J of $(z)){if(G===null||typeof G!=="object"||!(J in G))return H;G=G[J]}return G===void 0?H:G}getMany(z){let H=Array.isArray(z)?z.map((J)=>[J,void 0]):Object.entries(z),G={};for(let[J,Y]of H)G[J]=this.get(J,Y);return G}set(z,H){let G=typeof z==="string"?[[z,H]]:Object.entries(z);for(let[J,Y]of G){let E=$(J),K=E.pop(),U=this.items;for(let Z of E){let F=U[Z];if(F===null||typeof F!=="object")U[Z]={};U=U[Z]}U[K]=Y}}prepend(z,H){let G=this.get(z,[]);G.unshift(H),this.set(z,G)}push(z,H){let G=this.get(z,[]);G.push(H),this.set(z,G)}merge(z){for(let[H,G]of Object.entries(z)){let J=this.items[H];if(J!==null&&typeof J==="object"&&!Array.isArray(J)&&G!==null&&typeof G==="object"&&!Array.isArray(G))this.items[H]={...J,...G};else this.items[H]=G}}all(){return this.items}}var W=Symbol.for("gemi.foundation.Application");class Q extends j{[W]=!0;static isApplication(z){return typeof z==="object"&&z!==null&&W in z}config;providers=[];booted=!1;constructor(z=new X){super();this.config=z,this.instance(X,z)}static currentInstance;static getInstance(){return Q.currentInstance}static setInstance(z){return Q.currentInstance=z,z}register(z){let H=this.providers.find((J)=>J instanceof z);if(H)return H;let G=new z(this);return G.register(),this.providers.push(G),G}registerMany(z){for(let H of z)this.register(H)}getProviders(){return[...this.providers]}isBooted(){return this.booted}async boot(){if(this.booted)return;for(let z of this.providers)await z.boot();this.booted=!0}flush(){super.flush(),this.instance(X,this.config),this.providers=[],this.booted=!1}}import{AsyncLocalStorage as _}from"async_hooks";var D=new _;function I(z){let H=D.getStore(),G=Q.isApplication(H)?H:Q.getInstance();if(!G)throw Error("No Application instance is available. Boot a Kernel before resolving services.");return z?G.make(z):G}
|
|
3
|
+
export{D as Je,X as Ke,Q as Le,I as Me};
|
|
4
|
+
|
|
5
|
+
//# debugId=D832AA41B0CD16A864756E2164756E21
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../foundation/Application.ts", "../kernel/context.ts", "../foundation/app.ts"],
|
|
3
|
+
"sources": ["../support/Repository.ts", "../foundation/Application.ts", "../kernel/context.ts", "../foundation/app.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
+
"// Runtime configuration store, modeled on `Illuminate\\Config\\Repository`.\n// Keys are dot paths (\"mail.driver\", \"route.view.rootRouter\") resolved against\n// a plain nested object. This is the RUNTIME config; `gemi/config` is the\n// BUILD config (gemi.config.ts) and is unrelated.\n\nexport type ConfigItems = Record<string, any>;\n\nfunction segments(key: string): string[] {\n return key.split(\".\");\n}\n\nexport class Repository {\n // Container token. The Kernel binds its Repository under `config`, so any\n // provider can `app.make(Repository)` — though `this.app.config` is shorter.\n static token = \"config\";\n\n private items: ConfigItems;\n\n constructor(items: ConfigItems = {}) {\n this.items = items;\n }\n\n has(key: string): boolean {\n let target: any = this.items;\n for (const segment of segments(key)) {\n if (target === null || typeof target !== \"object\" || !(segment in target)) {\n return false;\n }\n target = target[segment];\n }\n return true;\n }\n\n get<T = any>(key: string, defaultValue?: T): T {\n let target: any = this.items;\n for (const segment of segments(key)) {\n if (target === null || typeof target !== \"object\" || !(segment in target)) {\n return defaultValue as T;\n }\n target = target[segment];\n }\n return target === undefined ? (defaultValue as T) : (target as T);\n }\n\n // Reads many keys at once. Accepts either a list of keys or a\n // `{ key: defaultValue }` map, mirroring `Repository::getMany`.\n getMany(keys: string[] | Record<string, any>): Record<string, any> {\n const entries: Array<[string, any]> = Array.isArray(keys)\n ? keys.map((key): [string, any] => [key, undefined])\n : Object.entries(keys);\n\n const result: Record<string, any> = {};\n for (const [key, defaultValue] of entries) {\n result[key] = this.get(key, defaultValue);\n }\n return result;\n }\n\n set(key: string | Record<string, any>, value?: any): void {\n const entries: Array<[string, any]> =\n typeof key === \"string\" ? [[key, value]] : Object.entries(key);\n\n for (const [path, item] of entries) {\n const parts = segments(path);\n const last = parts.pop() as string;\n\n let target: any = this.items;\n for (const segment of parts) {\n const next = target[segment];\n if (next === null || typeof next !== \"object\") {\n target[segment] = {};\n }\n target = target[segment];\n }\n\n target[last] = item;\n }\n }\n\n // Adds `value` to the front of the array stored at `key`.\n prepend(key: string, value: any): void {\n const array = this.get<any[]>(key, []);\n array.unshift(value);\n this.set(key, array);\n }\n\n // Adds `value` to the end of the array stored at `key`.\n push(key: string, value: any): void {\n const array = this.get<any[]>(key, []);\n array.push(value);\n this.set(key, array);\n }\n\n // Shallow-merges a `{ topLevelKey: config }` map into the store. Existing\n // top-level keys are merged one level deep so partial overrides compose.\n merge(items: ConfigItems): void {\n for (const [key, value] of Object.entries(items)) {\n const current = this.items[key];\n if (\n current !== null &&\n typeof current === \"object\" &&\n !Array.isArray(current) &&\n value !== null &&\n typeof value === \"object\" &&\n !Array.isArray(value)\n ) {\n this.items[key] = { ...current, ...value };\n } else {\n this.items[key] = value;\n }\n }\n }\n\n all(): ConfigItems {\n return this.items;\n }\n}\n",
|
|
5
6
|
"import { Container } from \"../container/Container\";\nimport { Repository } from \"../support/Repository\";\nimport type { ServiceProvider } from \"../support/ServiceProvider\";\n\nexport type ServiceProviderConstructor = new (\n app: Application,\n) => ServiceProvider;\n\n/**\n * Cross-copy brand. `dist/bin/gemi.js` bundles its own gemi while the app\n * resolves `gemi/*` to source, so `instanceof Application` is false for an\n * Application built by the other copy. `Symbol.for` is registry-global and\n * survives that boundary — the same reason services key off a `static token`\n * string rather than the constructor object.\n */\nconst APPLICATION_BRAND = Symbol.for(\"gemi.foundation.Application\");\n\nexport class Application extends Container {\n readonly [APPLICATION_BRAND] = true;\n\n static isApplication(value: unknown): value is Application {\n return (\n typeof value === \"object\" && value !== null && APPLICATION_BRAND in value\n );\n }\n\n /**\n * Runtime configuration (`app/config/*.ts`). Also bound in the container, so\n * `app.make(Repository)` and `app.config` are the same object.\n */\n readonly config: Repository;\n\n private providers: ServiceProvider[] = [];\n private booted = false;\n\n constructor(config: Repository = new Repository()) {\n super();\n this.config = config;\n this.instance(Repository, config);\n }\n\n private static currentInstance: Application | undefined;\n\n static getInstance(): Application | undefined {\n return Application.currentInstance;\n }\n\n static setInstance(app: Application | undefined) {\n Application.currentInstance = app;\n return app;\n }\n\n /**\n * Instantiates the provider and runs its `register()` immediately, exactly as\n * Laravel does. Registration is therefore synchronous — only `boot()` is\n * async, which is what lets `new App({ kernel })` stay a sync constructor.\n */\n register(Provider: ServiceProviderConstructor): ServiceProvider {\n const existing = this.providers.find((p) => p instanceof Provider);\n if (existing) {\n return existing;\n }\n\n const provider = new Provider(this);\n provider.register();\n this.providers.push(provider);\n return provider;\n }\n\n registerMany(providers: ServiceProviderConstructor[]) {\n for (const Provider of providers) {\n this.register(Provider);\n }\n }\n\n getProviders(): ServiceProvider[] {\n return [...this.providers];\n }\n\n isBooted(): boolean {\n return this.booted;\n }\n\n /**\n * Phase two. Every provider has already registered by the time any of these\n * run, so a provider's `boot()` may resolve services owned by any other.\n */\n async boot(): Promise<void> {\n if (this.booted) {\n return;\n }\n for (const provider of this.providers) {\n await provider.boot();\n }\n this.booted = true;\n }\n\n flush() {\n super.flush();\n this.instance(Repository, this.config);\n this.providers = [];\n this.booted = false;\n }\n}\n",
|
|
6
7
|
"import { AsyncLocalStorage } from \"async_hooks\";\n\n/**\n * The kernel's AsyncLocalStorage. It holds the Application, and nothing else —\n * `Kernel.run()` enters it once per request, websocket message or cron tick,\n * and `foundation/app.ts` reads it to resolve services.\n *\n * \"The framework's only AsyncLocalStorage\" is a claim that used to sit here. It\n * was already not true — the *kernel's* is the only one, but `http/`, `pubsub/`\n * and now the ORM each keep their own. Four in the shipped framework (a fifth\n * sits in `rfc/workflow.ts`, an unreferenced design sketch that is outside\n * `package.json`'s exports and that nothing imports):\n *\n * kernel kernel/context.ts the Application\n * request http/requestContext.ts req, user, cookies, locale\n * broadcast services/pubsub/BroadcastManager.ts headers, cookies\n * orm orm/context.ts an open transaction\n *\n * The pattern is one store per scope with one owner, entered by that owner and\n * read through its own accessor — `app()`, `RequestContext.getStore()`,\n * `currentTransaction()`. What matters is that this one holds the Application\n * and nothing else, because `foundation/app.ts` reads it unconditionally.\n *\n * The ORM's, added in iteration 5, holds an open transaction handle and its\n * nesting depth. It is deliberately separate rather than merged into this one:\n *\n * - A transaction scope nests *inside* an Application scope without replacing\n * it. Re-entering this store with a `{ app, tx }` wrapper would mean every\n * reader of it — `app()` above all — has to handle two shapes forever, and a\n * miss there is not a transaction bug, it is a service resolving off the\n * wrong Application.\n * - The alternative of hanging the handle off the Application is worse than a\n * style question: one Application serves every concurrent request, so two\n * overlapping transactions would overwrite each other's handle and statements\n * would land in the wrong one. That is silent data corruption.\n *\n * The cost is honest: one more store on the hot path of every query. The ORM's\n * is shallow — one small object, entered only inside `Model.transaction` or\n * `DB.transaction`, never per request — so a query outside a transaction pays\n * one `getStore()` returning undefined.\n *\n * If another is ever proposed, this is the note to read first: the bar is that\n * the state is genuinely per-async-scope *and* cannot live in an existing store\n * without making that store's readers ambiguous.\n */\nexport const kernelContext = new AsyncLocalStorage();\n",
|
|
7
8
|
"import type { ServiceToken } from \"../container/Container\";\nimport { kernelContext } from \"../kernel/context\";\nimport { Application } from \"./Application\";\n\n/**\n * Resolves the Application for the current async context. Reads the kernel\n * AsyncLocalStorage — there is exactly one ALS in the framework, and\n * `Kernel.run()` stores the Application in it, so this is the primary path for\n * anything running inside a request, a websocket message or a cron tick.\n *\n * The static instance (Laravel's `Container::setInstance`, set by\n * `Kernel.boot()`) is the fallback for code that runs outside any `run()`\n * scope — build-time tooling, module top level, a stray `setTimeout`.\n */\nexport function app(): Application;\nexport function app<T>(token: ServiceToken<T>): T;\nexport function app<T>(token?: ServiceToken<T>): Application | T {\n const store = kernelContext.getStore();\n const instance = Application.isApplication(store)\n ? store\n : Application.getInstance();\n\n if (!instance) {\n throw new Error(\n \"No Application instance is available. Boot a Kernel before resolving services.\",\n );\n }\n\n return token ? instance.make(token) : instance;\n}\n"
|
|
8
9
|
],
|
|
9
|
-
"mappings": ";
|
|
10
|
-
"debugId": "
|
|
10
|
+
"mappings": ";yCAOA,SAAS,CAAQ,CAAC,EAAuB,CACvC,OAAO,EAAI,MAAM,GAAG,EAGf,MAAM,CAAW,OAGf,OAAQ,SAEP,MAER,WAAW,CAAC,EAAqB,CAAC,EAAG,CACnC,KAAK,MAAQ,EAGf,GAAG,CAAC,EAAsB,CACxB,IAAI,EAAc,KAAK,MACvB,QAAW,KAAW,EAAS,CAAG,EAAG,CACnC,GAAI,IAAW,MAAQ,OAAO,IAAW,UAAY,EAAE,KAAW,GAChE,MAAO,GAET,EAAS,EAAO,GAElB,MAAO,GAGT,GAAY,CAAC,EAAa,EAAqB,CAC7C,IAAI,EAAc,KAAK,MACvB,QAAW,KAAW,EAAS,CAAG,EAAG,CACnC,GAAI,IAAW,MAAQ,OAAO,IAAW,UAAY,EAAE,KAAW,GAChE,OAAO,EAET,EAAS,EAAO,GAElB,OAAO,IAAW,OAAa,EAAsB,EAKvD,OAAO,CAAC,EAA2D,CACjE,IAAM,EAAgC,MAAM,QAAQ,CAAI,EACpD,EAAK,IAAI,CAAC,IAAuB,CAAC,EAAK,MAAS,CAAC,EACjD,OAAO,QAAQ,CAAI,EAEjB,EAA8B,CAAC,EACrC,QAAY,EAAK,KAAiB,EAChC,EAAO,GAAO,KAAK,IAAI,EAAK,CAAY,EAE1C,OAAO,EAGT,GAAG,CAAC,EAAmC,EAAmB,CACxD,IAAM,EACJ,OAAO,IAAQ,SAAW,CAAC,CAAC,EAAK,CAAK,CAAC,EAAI,OAAO,QAAQ,CAAG,EAE/D,QAAY,EAAM,KAAS,EAAS,CAClC,IAAM,EAAQ,EAAS,CAAI,EACrB,EAAO,EAAM,IAAI,EAEnB,EAAc,KAAK,MACvB,QAAW,KAAW,EAA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,EACjE,GAAI,EACF,OAAO,EAGT,IAAM,EAAW,IAAI,EAAS,IAAI,EAGlC,OAFA,EAAS,SAAS,EAClB,KAAK,UAAU,KAAK,CAAQ,EACrB,EAGT,YAAY,CAAC,EAAyC,CACpD,QAAW,KAAY,EACrB,KAAK,SAAS,CAAQ,EAI1B,YAAY,EAAsB,CAChC,MAAO,CAAC,GAAG,KAAK,SAAS,EAG3B,QAAQ,EAAY,CAClB,OAAO,KAAK,YAOR,KAAI,EAAkB,CAC1B,GAAI,KAAK,OACP,OAEF,QAAW,KAAY,KAAK,UAC1B,MAAM,EAAS,KAAK,EAEtB,KAAK,OAAS,GAGhB,KAAK,EAAG,CACN,MAAM,MAAM,EACZ,KAAK,SAAS,EAAY,KAAK,MAAM,EACrC,KAAK,UAAY,CAAC,EAClB,KAAK,OAAS,GAElB,CCvGA,4BAAS,oBA6CF,IAAM,EAAgB,IAAI,EC7B1B,SAAS,CAAM,CAAC,EAA0C,CAC/D,IAAM,EAAQ,EAAc,SAAS,EAC/B,EAAW,EAAY,cAAc,CAAK,EAC5C,EACA,EAAY,YAAY,EAE5B,GAAI,CAAC,EACH,MAAU,MACR,gFACF,EAGF,OAAO,EAAQ,EAAS,KAAK,CAAK,EAAI",
|
|
11
|
+
"debugId": "D832AA41B0CD16A864756E2164756E21",
|
|
11
12
|
"names": []
|
|
12
13
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
class g extends Error{constructor(h,r){super(h,r);this.name="ConsoleError"}}class w{byName=new Map;constructor(h){for(let r of h){let f=r.commandName;if(!f||f==="unset")throw new g(`${o(r)} does not declare a command name, so there is no name to run it by. Commands are written with \`defineCommand\`:
|
|
3
|
+
|
|
4
|
+
export default defineCommand("my-command")
|
|
5
|
+
.handle(async ({ line }) => { line("hello") })`);let i=this.byName.get(f);if(i)throw new g(`Two commands are named "${f}": ${o(i)} and ${o(r)}. A command name is how it is run, so one of `+"them could never be reached \u2014 rename one.");this.byName.set(f,r)}}get commands(){return[...this.byName.values()]}get(h){return this.byName.get(h)}suggest(h){let r=h.toLowerCase(),f=r.includes(":")?r.split(":")[0]:void 0,i=[];for(let s of this.byName.keys()){let t=s.toLowerCase();if(t.startsWith(r)||r.startsWith(t))i.push([0,s]);else if(t.includes(r)||r.includes(t))i.push([1,s]);else if(f&&t.startsWith(`${f}:`))i.push([2,s]);else if(l(t,r)<=2)i.push([3,s])}return i.sort((s,t)=>s[0]-t[0]||(s[1]<t[1]?-1:1)).slice(0,3).map(([,s])=>s)}}function o(h){return h.name?`\`${h.name}\``:"an anonymous command class"}function l(h,r){if(h===r)return 0;if(Math.abs(h.length-r.length)>2)return 99;let f=Array.from({length:r.length+1},(i,s)=>s);for(let i=1;i<=h.length;i+=1){let s=[i];for(let t=1;t<=r.length;t+=1)s[t]=Math.min(f[t]+1,s[t-1]+1,f[t-1]+(h[i-1]===r[t-1]?0:1));f=s}return f[r.length]}
|
|
6
|
+
export{g as Ba,w as Ca};
|
|
7
|
+
|
|
8
|
+
//# debugId=C70740C631A04CF064756E2164756E21
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../console/errors.ts", "../console/CommandRegistry.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * The failures `gemi run` prints as sentences rather than stack traces.\n *\n * Its own file rather than a declaration in `runner.ts`, because the classes\n * that *raise* these are the ones the runner imports — `CommandRegistry` most of\n * all — and a registry importing the runner to reach its error type is a cycle\n * for no reason.\n *\n * The split this exists to serve is the one `bin/gemi.ts` already draws around\n * `CheckModelsError`: a message written for the operator standing at the\n * terminal, with the fix named in it, is printed alone; anything else is a bug\n * in the framework and keeps its stack so it can be reported.\n */\nexport class ConsoleError extends Error {\n constructor(message: string, options?: { cause?: unknown }) {\n super(message, options);\n this.name = \"ConsoleError\";\n }\n}\n",
|
|
6
|
+
"import type { CommandClass } from \"./Command\";\nimport { ConsoleError } from \"./errors\";\n\n/**\n * The commands an application has, and the rules about what a command may be.\n *\n * A plain class, not a container service, and that is a decision rather than an\n * omission. `QueueManager` and `Scheduler` are bound and populated during boot\n * because the server needs them: a dispatch or a tick can arrive at any moment\n * after boot finishes. A command registry has exactly one consumer — `gemi run`,\n * which builds one, uses it, and exits. Making it a boot step would import every\n * file under `app/commands` into every `gemi dev`, every `gemi start` and every\n * deployed server process, on every start, for code no request will ever reach.\n * That is the cost `bin/check-models.ts` argues against at length, and there is\n * no benefit here to weigh against it.\n *\n * What the class is for is the rules below, and the `commands` getter — the same\n * seam `QueueManager.registeredJobs` and `Scheduler.jobs` exist to give a test:\n * what was actually taken, rather than what a walk would find if asked again.\n */\nexport class CommandRegistry {\n private readonly byName = new Map<string, CommandClass>();\n\n /**\n * @throws ConsoleError naming the offending class for a command that cannot\n * be run.\n *\n * Every refusal here is loud and immediate. There is a human at a terminal,\n * and every one of these is a mistake in the application's own source that\n * they are better off seeing now than after the command they meant to run\n * silently did not exist.\n *\n * `ConsoleError` rather than a plain `Error` so the runner prints the message\n * alone. These are sentences with the fix named in them, and burying one under\n * `at new CommandRegistry (…)` plus the runner's own frames points the reader\n * at framework code when the mistake is in their `app/commands`.\n */\n constructor(commands: CommandClass[]) {\n for (const command of commands) {\n const name = command.commandName;\n\n if (!name || name === \"unset\") {\n throw new ConsoleError(\n `${describe(command)} does not declare a command name, so there is ` +\n `no name to run it by. Commands are written with \\`defineCommand\\`:` +\n `\\n\\n export default defineCommand(\"my-command\")\\n` +\n ` .handle(async ({ line }) => { line(\"hello\") })`,\n );\n }\n\n const existing = this.byName.get(name);\n if (existing) {\n // Deliberately a hard error, where `QueueManager.useJobs` and\n // `Scheduler.start` take the first and warn. Those two must keep a\n // server booting, so running one of two identically-named jobs beats\n // refusing to start at all. Here there is no boot to protect and a\n // person is waiting: running the wrong one of two commands called\n // `db:seed` is strictly worse than running neither and being told why.\n throw new ConsoleError(\n `Two commands are named \"${name}\": ${describe(existing)} and ` +\n `${describe(command)}. A command name is how it is run, so one of ` +\n `them could never be reached — rename one.`,\n );\n }\n\n this.byName.set(name, command);\n }\n }\n\n /** What was actually taken. */\n get commands(): CommandClass[] {\n return [...this.byName.values()];\n }\n\n get(name: string): CommandClass | undefined {\n return this.byName.get(name);\n }\n\n /**\n * The nearest names to something that did not match, for the \"did you mean\"\n * line. Prefix matches first, then substring, then names sharing a namespace —\n * `db:sed` should find `db:seed`, and a typo in a namespace is the common case.\n */\n suggest(name: string): string[] {\n const needle = name.toLowerCase();\n const namespace = needle.includes(\":\") ? needle.split(\":\")[0] : undefined;\n const scored: Array<[number, string]> = [];\n\n for (const candidate of this.byName.keys()) {\n const haystack = candidate.toLowerCase();\n if (haystack.startsWith(needle) || needle.startsWith(haystack)) {\n scored.push([0, candidate]);\n } else if (haystack.includes(needle) || needle.includes(haystack)) {\n scored.push([1, candidate]);\n } else if (namespace && haystack.startsWith(`${namespace}:`)) {\n scored.push([2, candidate]);\n } else if (editDistance(haystack, needle) <= 2) {\n scored.push([3, candidate]);\n }\n }\n\n return scored\n .sort((a, b) => a[0] - b[0] || (a[1] < b[1] ? -1 : 1))\n .slice(0, 3)\n .map(([, candidate]) => candidate);\n }\n}\n\nfunction describe(command: CommandClass): string {\n return command.name ? `\\`${command.name}\\`` : \"an anonymous command class\";\n}\n\n/** Small enough that a dependency would cost more than it saves. */\nfunction editDistance(a: string, b: string): number {\n if (a === b) return 0;\n if (Math.abs(a.length - b.length) > 2) return 99;\n\n let previous = Array.from({ length: b.length + 1 }, (_, index) => index);\n\n for (let i = 1; i <= a.length; i += 1) {\n const current = [i];\n for (let j = 1; j <= b.length; j += 1) {\n current[j] = Math.min(\n previous[j]! + 1,\n current[j - 1]! + 1,\n previous[j - 1]! + (a[i - 1] === b[j - 1] ? 0 : 1),\n );\n }\n previous = current;\n }\n\n return previous[b.length]!;\n}\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": ";AAaO,MAAM,UAAqB,KAAM,CACtC,WAAW,CAAC,EAAiB,E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,GAAK,EAAE,GAAK,GAAK,EAAE,EACpD,MAAM,EAAG,CAAC,EACV,IAAI,GAAI,KAAe,CAAS,EAEvC,CAEA,SAAS,CAAQ,CAAC,EAA+B,CAC/C,OAAO,EAAQ,KAAO,KAAK,EAAQ,SAAW,6BAIhD,SAAS,CAAY,CAAC,EAAW,EAAmB,CAClD,GAAI,IAAM,EAAG,MAAO,GACpB,GAAI,KAAK,IAAI,EAAE,OAAS,EAAE,MAAM,EAAI,EAAG,MAAO,IAE9C,IAAI,EAAW,MAAM,KAAK,CAAE,OAAQ,EAAE,OAAS,CAAE,EAAG,CAAC,EAAG,IAAU,CAAK,EAEvE,QAAS,EAAI,EAAG,GAAK,EAAE,OAAQ,GAAK,EAAG,CACrC,IAAM,EAAU,CAAC,CAAC,EAClB,QAAS,EAAI,EAAG,GAAK,EAAE,OAAQ,GAAK,EAClC,EAAQ,GAAK,KAAK,IAChB,EAAS,GAAM,EACf,EAAQ,EAAI,GAAM,EAClB,EAAS,EAAI,IAAO,EAAE,EAAI,KAAO,EAAE,EAAI,GAAK,EAAI,EAClD,EAEF,EAAW,EAGb,OAAO,EAAS,EAAE",
|
|
9
|
+
"debugId": "C70740C631A04CF064756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{U as
|
|
2
|
+
import{Qe as a}from"./chunk-0h3jr9d9.js";var i=a((f)=>{function u(t){let r={};if(t=t.replace(/^\?/,""),t)for(let n of t.split("&")){let[e,s=null]=n.split("=");if(e=decodeURIComponent(e),s)s=decodeURIComponent(s);if(!(e in r))r[e]=s;else if(Array.isArray(r[e]))r[e].push(s);else r[e]=[r[e],s]}return r}f.parseQueryString=u});var U=a((d)=>{var y=i(),c=(t)=>{if(typeof t==="string")return c(new URL(t));let{hostname:r,pathname:n,port:e,protocol:s,search:o}=t,p;if(o)p=y.parseQueryString(o);return{hostname:r,port:e?parseInt(e):void 0,protocol:s,path:n,query:p}};d.parseUrl=c});
|
|
3
|
+
export{U as Ha};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=B56FB8E38001E0CD64756E2164756E21
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"'use strict';\n\nvar querystringParser = require('@smithy/querystring-parser');\n\nconst parseUrl = (url) => {\n if (typeof url === \"string\") {\n return parseUrl(new URL(url));\n }\n const { hostname, pathname, port, protocol, search } = url;\n let query;\n if (search) {\n query = querystringParser.parseQueryString(search);\n }\n return {\n hostname,\n port: port ? parseInt(port) : undefined,\n protocol,\n path: pathname,\n query,\n };\n};\n\nexports.parseUrl = parseUrl;\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": ";uDAEA,SAAS,CAAgB,CAAC,EAAa,CACnC,IAAM,EAAQ,CAAC,EAEf,GADA,EAAc,EAAY,QAAQ,MAAO,EAAE,EACvC,EACA,QAAW,KAAQ,EAAY,MAAM,GAAG,EAAG,CACvC,IAAK,EAAK,EAAQ,MAAQ,EAAK,MAAM,GAAG,EAExC,GADA,EAAM,mBAAmB,CAAG,EACxB,EACA,EAAQ,mBAAmB,CAAK,EAEpC,GAAI,EAAE,KAAO,GACT,EAAM,GAAO,EAEZ,QAAI,MAAM,QAAQ,EAAM,EAAI,EAC7B,EAAM,GAAK,KAAK,CAAK,EAGrB,OAAM,GAAO,CAAC,EAAM,GAAM,CAAK,EAI3C,OAAO,EAGH,mBAAmB,kBCxB3B,IAAI,MAEE,EAAW,CAAC,IAAQ,CACtB,GAAI,OAAO,IAAQ,SACf,OAAO,EAAS,IAAI,IAAI,CAAG,CAAC,EAEhC,IAAQ,WAAU,WAAU,OAAM,WAAU,UAAW,EACnD,EACJ,GAAI,EACA,EAAQ,EAAkB,iBAAiB,CAAM,EAErD,MAAO,CACH,WACA,KAAM,EAAO,SAAS,CAAI,EAAI,OAC9B,WACA,KAAM,EACN,OACJ,GAGI,WAAW",
|
|
9
|
-
"debugId": "
|
|
9
|
+
"debugId": "B56FB8E38001E0CD64756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Fb as G}from"./chunk-ttzkn1qd.js";import{Mc as z,Oc as E,fd as F}from"./chunk-tkv6cw94.js";import{Ce as B}from"./chunk-3y9nf09k.js";class J extends G{register(){this.app.singleton(z,()=>{let j=new z(B(E(),this.app.config.get("database",{})));return K(j),j})}}function K(j){if(Bun.env.NODE_ENV!=="development")return;for(let x of j.connectionNames){let A=j.connection(x);if(F(A.dialect))continue;let H=x===j.name?"DATABASE_URL":`The "${x}" database connection`;console.warn(`[gemi] ${H} points at ${A.dialect}, which the gemi ORM `+"does not implement \u2014 only sqlite and postgres are. The connection "+`works, so raw SQL through DB.query / DB.sql and transactions are fine, but every model operation will raise UnsupportedDialectError.
|
|
3
3
|
(development only)`)}}
|
|
4
4
|
export{J as p};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
6
|
+
//# debugId=DA5840EA47FEDD4B64756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import { ormSupports } from \"../orm/dialect\";\nimport { ServiceProvider } from \"../support/ServiceProvider\";\nimport { withDefaults } from \"../support/withDefaults\";\nimport { databaseConfigDefaults, type DatabaseConfig } from \"./config\";\nimport { DatabaseManager } from \"./DatabaseManager\";\n\nexport class DatabaseServiceProvider extends ServiceProvider {\n register() {\n this.app.singleton(\n DatabaseManager,\n () => {\n const database = new DatabaseManager(\n withDefaults(\n databaseConfigDefaults(),\n this.app.config.get<DatabaseConfig>(\"database\", {}),\n ),\n );\n\n warnIfOrmUnavailable(database);\n return database;\n },\n );\n }\n}\n\n/**\n * Say it at boot, not on the first model query.\n *\n * `DatabaseManager` connects to MySQL and MariaDB without complaint — Bun's\n * client speaks them — and the ORM's compiler has no dialect for either. So a\n * deploy pointed at one starts, passes a health check, serves whatever does not\n * touch a model, and raises `UnsupportedDialectError` on the first `findMany`.\n * That is the latest and most expensive moment to learn it.\n *\n * A **warning rather than a throw**, deliberately: raw SQL through `DB.query`\n * and `DB.sql` genuinely works on those dialects, and so do transactions.\n * Refusing to construct the manager would break code that is correct today to\n * pre-empt an error the ORM already raises clearly. The supported set is a\n * property of the query compiler, not of the connection.\n *\n * Development only, for the same reason the slow-transaction warning is: it is\n * a diagnostic aimed at whoever is choosing the database, and it should not\n * add noise to a production log every time the container starts.\n */\nfunction warnIfOrmUnavailable(database: DatabaseManager): void {\n if (process.env.NODE_ENV !== \"development\") return;\n\n // Every connection, not only the default one. A named connection is a whole\n // pool an application will run model queries on — `Model.on(\"analytics\")` —\n // so it can be pointed at MySQL exactly as the default can, and warning about\n // only one of them would make the check pass while the query that raises is\n // on the other.\n for (const name of database.connectionNames) {\n const connection = database.connection(name);\n if (ormSupports(connection.dialect)) continue;\n\n const source =\n name === database.name\n ? \"DATABASE_URL\"\n : `The \"${name}\" database connection`;\n\n console.warn(\n `[gemi] ${source} points at ${connection.dialect}, which the gemi ORM ` +\n `does not implement — only sqlite and postgres are. The connection ` +\n `works, so raw SQL through DB.query / DB.sql and transactions are ` +\n `fine, but every model operation will raise ` +\n `UnsupportedDialectError.\\n(development only)`,\n );\n }\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";uJAMO,AAAM,IAAgC,CAAgB,CAC3D,QAAQ,EAAG,CACT,KAAK,IAAI,UACP,EACA,IAAM,CACJ,IAAM,EAAW,IAAI,EACnB,EACE,EAAuB,EACvB,KAAK,IAAI,OAAO,IAAoB,WAAY,CAAC,CAAC,CACpD,CACF,EAGA,OADA,EAAqB,CAAQ,EACtB,EAEX,EAEJ,CAqBA,SAAS,CAAoB,CAAC,EAAiC,CAC7D,GAAI,mBAAyB,cAAe,OAO5C,QAAW,KAAQ,EAAS,gBAAiB,CAC3C,IAAM,EAAa,EAAS,WAAW,CAAI,EAC3C,GAAI,EAAY,EAAW,OAAO,EAAG,SAErC,IAAM,EACJ,IAAS,EAAS,KACd,eACA,QAAQ,yBAEd,QAAQ,KACN,UAAU,eAAoB,EAAW,+BACvC,0EACA;AAAA,mBAGJ",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "DA5840EA47FEDD4B64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Aa as T}from"./chunk-d1ahbza9.js";import{Ia as A}from"./chunk-t4n25km9.js";import"./chunk-tztqkat2.js";import{Ka as y}from"./chunk-kaxvw75w.js";import{Pe as r}from"./chunk-0h3jr9d9.js";var u=r(A(),1);var i=r(y(),1),E=r(A(),1);import{exec as d}from"child_process";import{promisify as I}from"util";var x=r(T(),1),_=(c,n,e)=>{if(n.Version!==1)throw Error(`Profile ${c} credential_process did not return Version 1.`);if(n.AccessKeyId===void 0||n.SecretAccessKey===void 0)throw Error(`Profile ${c} credential_process returned invalid credentials.`);if(n.Expiration){let w=new Date;if(new Date(n.Expiration)<w)throw Error(`Profile ${c} credential_process returned expired credentials.`)}let s=n.AccountId;if(!s&&e?.[c]?.aws_account_id)s=e[c].aws_account_id;let t={accessKeyId:n.AccessKeyId,secretAccessKey:n.SecretAccessKey,...n.SessionToken&&{sessionToken:n.SessionToken},...n.Expiration&&{expiration:new Date(n.Expiration)},...n.CredentialScope&&{credentialScope:n.CredentialScope},...s&&{accountId:s}};return x.setCredentialFeature(t,"CREDENTIALS_PROCESS","w"),t};var K=async(c,n,e)=>{let s=n[c];if(n[c]){let t=s.credential_process;if(t!==void 0){let w=I(E.externalDataInterceptor?.getTokenRecord?.().exec??d);try{let{stdout:o}=await w(t),S;try{S=JSON.parse(o.trim())}catch{throw Error(`Profile ${c} credential_process returned invalid JSON.`)}return _(c,S,n)}catch(o){throw new i.CredentialsProviderError(o.message,{logger:e})}}else throw new i.CredentialsProviderError(`Profile ${c} did not contain credential_process.`,{logger:e})}else throw new i.CredentialsProviderError(`Profile ${c} could not be found in shared credentials file.`,{logger:e})};var R=(c={})=>async({callerClientConfig:n}={})=>{c.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");let e=await u.parseKnownFiles(c);return K(u.getProfileName({profile:c.profile??n?.profile}),e,c.logger)};export{R as fromProcess};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=EBAC9311946422D364756E2164756E21
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"import { setCredentialFeature } from \"@aws-sdk/core/client\";\nexport const getValidatedProcessCredentials = (profileName, data, profiles) => {\n if (data.Version !== 1) {\n throw Error(`Profile ${profileName} credential_process did not return Version 1.`);\n }\n if (data.AccessKeyId === undefined || data.SecretAccessKey === undefined) {\n throw Error(`Profile ${profileName} credential_process returned invalid credentials.`);\n }\n if (data.Expiration) {\n const currentTime = new Date();\n const expireTime = new Date(data.Expiration);\n if (expireTime < currentTime) {\n throw Error(`Profile ${profileName} credential_process returned expired credentials.`);\n }\n }\n let accountId = data.AccountId;\n if (!accountId && profiles?.[profileName]?.aws_account_id) {\n accountId = profiles[profileName].aws_account_id;\n }\n const credentials = {\n accessKeyId: data.AccessKeyId,\n secretAccessKey: data.SecretAccessKey,\n ...(data.SessionToken && { sessionToken: data.SessionToken }),\n ...(data.Expiration && { expiration: new Date(data.Expiration) }),\n ...(data.CredentialScope && { credentialScope: data.CredentialScope }),\n ...(accountId && { accountId }),\n };\n setCredentialFeature(credentials, \"CREDENTIALS_PROCESS\", \"w\");\n return credentials;\n};\n"
|
|
8
8
|
],
|
|
9
9
|
"mappings": ";wNAAA,SCAA,SACA,KACA,SAAS,sBACT,oBAAS,aCHT,eACa,EAAiC,CAAC,EAAa,EAAM,IAAa,CAC3E,GAAI,EAAK,UAAY,EACjB,MAAM,MAAM,WAAW,gDAA0D,EAErF,GAAI,EAAK,cAAgB,QAAa,EAAK,kBAAoB,OAC3D,MAAM,MAAM,WAAW,oDAA8D,EAEzF,GAA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AO,EAA0B,iBAAe,CAC5C,QAAS,EAAK,SAAW,GAAoB,OACjD,CAAC,EAAG,EAAU,EAAK,MAAM",
|
|
10
|
-
"debugId": "
|
|
10
|
+
"debugId": "EBAC9311946422D364756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
class A extends Error{constructor(p,q){super(`Target [${p}] is not bound in the container.`+(q.length>0?` Bound tokens: ${q.join(", ")}.`:" No tokens are bound \u2014 was the application booted?"));this.name="BindingResolutionError"}}class C{bindings=new Map;instances=new Map;bind(p,q){this.bindings.set(p.token,{factory:q,shared:!1}),this.instances.delete(p.token)}singleton(p,q){this.bindings.set(p.token,{factory:q,shared:!0}),this.instances.delete(p.token)}instance(p,q){return this.instances.set(p.token,q),q}bound(p){return this.bindings.has(p.token)||this.instances.has(p.token)}resolved(p){return this.instances.has(p.token)}make(p){let q=p.token;if(this.instances.has(q))return this.instances.get(q);let v=this.bindings.get(q);if(!v)throw new A(q,this.keys());let x=v.factory(this);if(v.shared)this.instances.set(q,x);return x}forget(p){this.instances.delete(p.token)}keys(){return[...new Set([...this.bindings.keys(),...this.instances.keys()])]}flush(){this.bindings.clear(),this.instances.clear()}}
|
|
3
|
-
export{A as
|
|
3
|
+
export{A as Ne,C as Oe};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=D239BBF40551687364756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * Tokens are the service classes themselves, so `make(MailManager)` is typed\n * `MailManager` without a cast. The container keys its bindings off the class's\n * `static token` string rather than the constructor object: the built binary\n * (`dist/bin/gemi.js`) bundles its own copy of gemi while the app resolves\n * `gemi/*` to source, so the same service is two distinct class objects across\n * that boundary. A string survives it. Laravel binds both `'mail'` and\n * `MailManager::class` for the same reason.\n */\nexport type ServiceToken<T> = (abstract new (...args: any[]) => T) & {\n token: string;\n};\n\nexport type Factory<T> = (app: Container) => T;\n\ninterface Binding {\n factory: Factory<any>;\n shared: boolean;\n}\n\nexport class BindingResolutionError extends Error {\n constructor(token: string, known: string[]) {\n super(\n `Target [${token}] is not bound in the container.` +\n (known.length > 0\n ? ` Bound tokens: ${known.join(\", \")}.`\n : \" No tokens are bound — was the application booted?\"),\n );\n this.name = \"BindingResolutionError\";\n }\n}\n\nexport class Container {\n private bindings = new Map<string, Binding>();\n private instances = new Map<string, any>();\n\n bind<T>(token: ServiceToken<T>, factory: Factory<T>) {\n this.bindings.set(token.token, { factory, shared: false });\n this.instances.delete(token.token);\n }\n\n /**\n * Lazy by design — `factory` is not called until the first `make()`.\n */\n singleton<T>(token: ServiceToken<T>, factory: Factory<T>) {\n this.bindings.set(token.token, { factory, shared: true });\n this.instances.delete(token.token);\n }\n\n instance<T>(token: ServiceToken<T>, object: T): T {\n this.instances.set(token.token, object);\n return object;\n }\n\n bound<T>(token: ServiceToken<T>): boolean {\n return (\n this.bindings.has(token.token) || this.instances.has(token.token)\n );\n }\n\n resolved<T>(token: ServiceToken<T>): boolean {\n return this.instances.has(token.token);\n }\n\n make<T>(token: ServiceToken<T>): T {\n const key = token.token;\n\n if (this.instances.has(key)) {\n return this.instances.get(key) as T;\n }\n\n const binding = this.bindings.get(key);\n if (!binding) {\n throw new BindingResolutionError(key, this.keys());\n }\n\n const object = binding.factory(this) as T;\n if (binding.shared) {\n this.instances.set(key, object);\n }\n return object;\n }\n\n forget<T>(token: ServiceToken<T>) {\n this.instances.delete(token.token);\n }\n\n keys(): string[] {\n return [\n ...new Set([...this.bindings.keys(), ...this.instances.keys()]),\n ];\n }\n\n flush() {\n this.bindings.clear();\n this.instances.clear();\n }\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AAoBO,MAAM,UAA+B,KAAM,CAChD,WAAW,CAAC,EAAe,EAAiB,CAC1C,MACE,WAAW,qCACR,EAAM,OAAS,EACZ,kBAAkB,EAAM,KAAK,IAAI,KACjC,0DACR,EACA,KA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