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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{ye as
|
|
2
|
+
import{Ja as re}from"./chunk-tztqkat2.js";import{Qe as _,Te as a}from"./chunk-0h3jr9d9.js";var I=_((b)=>{Object.defineProperty(b,"__esModule",{value:!0});b.getHomeDir=void 0;var W=a("os"),V=a("path"),x={},G=()=>{if(process&&process.geteuid)return`${process.geteuid()}`;return"DEFAULT"},U=()=>{let{HOME:e,USERPROFILE:t,HOMEPATH:r,HOMEDRIVE:o=`C:${V.sep}`}=process.env;if(e)return e;if(t)return t;if(r)return`${o}${r}`;let i=G();if(!x[i])x[i]=(0,W.homedir)();return x[i]};b.getHomeDir=U});var P=_((j)=>{Object.defineProperty(j,"__esModule",{value:!0});j.getSSOTokenFilepath=void 0;var X=a("crypto"),B=a("path"),J=I(),z=(e)=>{let r=(0,X.createHash)("sha1").update(e).digest("hex");return(0,B.join)((0,J.getHomeDir)(),".aws","sso","cache",`${r}.json`)};j.getSSOTokenFilepath=z});var R=_((C)=>{Object.defineProperty(C,"__esModule",{value:!0});C.getSSOTokenFromFile=C.tokenIntercept=void 0;var Q=a("fs/promises"),Y=P();C.tokenIntercept={};var Z=async(e)=>{if(C.tokenIntercept[e])return C.tokenIntercept[e];let t=(0,Y.getSSOTokenFilepath)(e),r=await(0,Q.readFile)(t,"utf8");return JSON.parse(r)};C.getSSOTokenFromFile=Z});var k=_((L)=>{Object.defineProperty(L,"__esModule",{value:!0});L.readFile=L.fileIntercept=L.filePromises=void 0;var ee=a("fs/promises");L.filePromises={};L.fileIntercept={};var te=(e,t)=>{if(L.fileIntercept[e]!==void 0)return L.fileIntercept[e];if(!L.filePromises[e]||t?.ignoreCache)L.filePromises[e]=(0,ee.readFile)(e,"utf8");return L.filePromises[e]};L.readFile=te});var ye=_((c)=>{var l=I(),O=P(),y=R(),g=a("path"),S=re(),f=k(),q="AWS_PROFILE",$="default",oe=(e)=>e.profile||process.env[q]||$,p=".",ie=(e)=>Object.entries(e).filter(([t])=>{let r=t.indexOf(p);if(r===-1)return!1;return Object.values(S.IniSectionType).includes(t.substring(0,r))}).reduce((t,[r,o])=>{let i=r.indexOf(p),n=r.substring(0,i)===S.IniSectionType.PROFILE?r.substring(i+1):r;return t[n]=o,t},{...e.default&&{default:e.default}}),ne="AWS_CONFIG_FILE",M=()=>process.env[ne]||g.join(l.getHomeDir(),".aws","config"),se="AWS_SHARED_CREDENTIALS_FILE",ce=()=>process.env[se]||g.join(l.getHomeDir(),".aws","credentials"),ae=/^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/,le=["__proto__","profile __proto__"],T=(e)=>{let t={},r,o;for(let i of e.split(/\r?\n/)){let n=i.split(/(^|\s)[;#]/)[0].trim();if(n[0]==="["&&n[n.length-1]==="]"){r=void 0,o=void 0;let s=n.substring(1,n.length-1),u=ae.exec(s);if(u){let[,d,,m]=u;if(Object.values(S.IniSectionType).includes(d))r=[d,m].join(p)}else r=s;if(le.includes(s))throw Error(`Found invalid profile name "${s}"`)}else if(r){let s=n.indexOf("=");if(![0,-1].includes(s)){let[u,d]=[n.substring(0,s).trim(),n.substring(s+1).trim()];if(d==="")o=u;else{if(o&&i.trimStart()===i)o=void 0;t[r]=t[r]||{};let m=o?[o,u].join(p):u;t[r][m]=d}}}}return t},A=()=>({}),K=async(e={})=>{let{filepath:t=ce(),configFilepath:r=M()}=e,o=l.getHomeDir(),i="~/",n=t;if(t.startsWith("~/"))n=g.join(o,t.slice(2));let h=r;if(r.startsWith("~/"))h=g.join(o,r.slice(2));let s=await Promise.all([f.readFile(h,{ignoreCache:e.ignoreCache}).then(T).then(ie).catch(A),f.readFile(n,{ignoreCache:e.ignoreCache}).then(T).catch(A)]);return{configFile:s[0],credentialsFile:s[1]}},pe=(e)=>Object.entries(e).filter(([t])=>t.startsWith(S.IniSectionType.SSO_SESSION+p)).reduce((t,[r,o])=>({...t,[r.substring(r.indexOf(p)+1)]:o}),{}),ue=()=>({}),fe=async(e={})=>f.readFile(e.configFilepath??M()).then(T).then(pe).catch(ue),de=(...e)=>{let t={};for(let r of e)for(let[o,i]of Object.entries(r))if(t[o]!==void 0)Object.assign(t[o],i);else t[o]=i;return t},_e=async(e)=>{let t=await K(e);return de(t.configFile,t.credentialsFile)},Fe={getFileRecord(){return f.fileIntercept},interceptFile(e,t){f.fileIntercept[e]=Promise.resolve(t)},getTokenRecord(){return y.tokenIntercept},interceptToken(e,t){y.tokenIntercept[e]=t}};c.getSSOTokenFromFile=y.getSSOTokenFromFile;c.readFile=f.readFile;c.CONFIG_PREFIX_SEPARATOR=p;c.DEFAULT_PROFILE=$;c.ENV_PROFILE=q;c.externalDataInterceptor=Fe;c.getProfileName=oe;c.loadSharedConfigFiles=K;c.loadSsoSessionData=fe;c.parseKnownFiles=_e;Object.prototype.hasOwnProperty.call(l,"__proto__")&&!Object.prototype.hasOwnProperty.call(c,"__proto__")&&Object.defineProperty(c,"__proto__",{enumerable:!0,value:l.__proto__});Object.keys(l).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(c,e))c[e]=l[e]});Object.prototype.hasOwnProperty.call(O,"__proto__")&&!Object.prototype.hasOwnProperty.call(c,"__proto__")&&Object.defineProperty(c,"__proto__",{enumerable:!0,value:O.__proto__});Object.keys(O).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(c,e))c[e]=O[e]})});
|
|
3
|
+
export{ye as Ia};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=A2826CBD3EB9A71D64756E2164756E21
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
"'use strict';\n\nvar getHomeDir = require('./getHomeDir');\nvar getSSOTokenFilepath = require('./getSSOTokenFilepath');\nvar getSSOTokenFromFile = require('./getSSOTokenFromFile');\nvar path = require('path');\nvar types = require('@smithy/types');\nvar readFile = require('./readFile');\n\nconst ENV_PROFILE = \"AWS_PROFILE\";\nconst DEFAULT_PROFILE = \"default\";\nconst getProfileName = (init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE;\n\nconst CONFIG_PREFIX_SEPARATOR = \".\";\n\nconst getConfigData = (data) => Object.entries(data)\n .filter(([key]) => {\n const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);\n if (indexOfSeparator === -1) {\n return false;\n }\n return Object.values(types.IniSectionType).includes(key.substring(0, indexOfSeparator));\n})\n .reduce((acc, [key, value]) => {\n const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);\n const updatedKey = key.substring(0, indexOfSeparator) === types.IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key;\n acc[updatedKey] = value;\n return acc;\n}, {\n ...(data.default && { default: data.default }),\n});\n\nconst ENV_CONFIG_PATH = \"AWS_CONFIG_FILE\";\nconst getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || path.join(getHomeDir.getHomeDir(), \".aws\", \"config\");\n\nconst ENV_CREDENTIALS_PATH = \"AWS_SHARED_CREDENTIALS_FILE\";\nconst getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || path.join(getHomeDir.getHomeDir(), \".aws\", \"credentials\");\n\nconst prefixKeyRegex = /^([\\w-]+)\\s([\"'])?([\\w-@\\+\\.%:/]+)\\2$/;\nconst profileNameBlockList = [\"__proto__\", \"profile __proto__\"];\nconst parseIni = (iniData) => {\n const map = {};\n let currentSection;\n let currentSubSection;\n for (const iniLine of iniData.split(/\\r?\\n/)) {\n const trimmedLine = iniLine.split(/(^|\\s)[;#]/)[0].trim();\n const isSection = trimmedLine[0] === \"[\" && trimmedLine[trimmedLine.length - 1] === \"]\";\n if (isSection) {\n currentSection = undefined;\n currentSubSection = undefined;\n const sectionName = trimmedLine.substring(1, trimmedLine.length - 1);\n const matches = prefixKeyRegex.exec(sectionName);\n if (matches) {\n const [, prefix, , name] = matches;\n if (Object.values(types.IniSectionType).includes(prefix)) {\n currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR);\n }\n }\n else {\n currentSection = sectionName;\n }\n if (profileNameBlockList.includes(sectionName)) {\n throw new Error(`Found invalid profile name \"${sectionName}\"`);\n }\n }\n else if (currentSection) {\n const indexOfEqualsSign = trimmedLine.indexOf(\"=\");\n if (![0, -1].includes(indexOfEqualsSign)) {\n const [name, value] = [\n trimmedLine.substring(0, indexOfEqualsSign).trim(),\n trimmedLine.substring(indexOfEqualsSign + 1).trim(),\n ];\n if (value === \"\") {\n currentSubSection = name;\n }\n else {\n if (currentSubSection && iniLine.trimStart() === iniLine) {\n currentSubSection = undefined;\n }\n map[currentSection] = map[currentSection] || {};\n const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name;\n map[currentSection][key] = value;\n }\n }\n }\n }\n return map;\n};\n\nconst swallowError$1 = () => ({});\nconst loadSharedConfigFiles = async (init = {}) => {\n const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init;\n const homeDir = getHomeDir.getHomeDir();\n const relativeHomeDirPrefix = \"~/\";\n let resolvedFilepath = filepath;\n if (filepath.startsWith(relativeHomeDirPrefix)) {\n resolvedFilepath = path.join(homeDir, filepath.slice(2));\n }\n let resolvedConfigFilepath = configFilepath;\n if (configFilepath.startsWith(relativeHomeDirPrefix)) {\n resolvedConfigFilepath = path.join(homeDir, configFilepath.slice(2));\n }\n const parsedFiles = await Promise.all([\n readFile.readFile(resolvedConfigFilepath, {\n ignoreCache: init.ignoreCache,\n })\n .then(parseIni)\n .then(getConfigData)\n .catch(swallowError$1),\n readFile.readFile(resolvedFilepath, {\n ignoreCache: init.ignoreCache,\n })\n .then(parseIni)\n .catch(swallowError$1),\n ]);\n return {\n configFile: parsedFiles[0],\n credentialsFile: parsedFiles[1],\n };\n};\n\nconst getSsoSessionData = (data) => Object.entries(data)\n .filter(([key]) => key.startsWith(types.IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR))\n .reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {});\n\nconst swallowError = () => ({});\nconst loadSsoSessionData = async (init = {}) => readFile.readFile(init.configFilepath ?? getConfigFilepath())\n .then(parseIni)\n .then(getSsoSessionData)\n .catch(swallowError);\n\nconst mergeConfigFiles = (...files) => {\n const merged = {};\n for (const file of files) {\n for (const [key, values] of Object.entries(file)) {\n if (merged[key] !== undefined) {\n Object.assign(merged[key], values);\n }\n else {\n merged[key] = values;\n }\n }\n }\n return merged;\n};\n\nconst parseKnownFiles = async (init) => {\n const parsedFiles = await loadSharedConfigFiles(init);\n return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile);\n};\n\nconst externalDataInterceptor = {\n getFileRecord() {\n return readFile.fileIntercept;\n },\n interceptFile(path, contents) {\n readFile.fileIntercept[path] = Promise.resolve(contents);\n },\n getTokenRecord() {\n return getSSOTokenFromFile.tokenIntercept;\n },\n interceptToken(id, contents) {\n getSSOTokenFromFile.tokenIntercept[id] = contents;\n },\n};\n\nexports.getSSOTokenFromFile = getSSOTokenFromFile.getSSOTokenFromFile;\nexports.readFile = readFile.readFile;\nexports.CONFIG_PREFIX_SEPARATOR = CONFIG_PREFIX_SEPARATOR;\nexports.DEFAULT_PROFILE = DEFAULT_PROFILE;\nexports.ENV_PROFILE = ENV_PROFILE;\nexports.externalDataInterceptor = externalDataInterceptor;\nexports.getProfileName = getProfileName;\nexports.loadSharedConfigFiles = loadSharedConfigFiles;\nexports.loadSsoSessionData = loadSsoSessionData;\nexports.parseKnownFiles = parseKnownFiles;\nObject.prototype.hasOwnProperty.call(getHomeDir, '__proto__') &&\n !Object.prototype.hasOwnProperty.call(exports, '__proto__') &&\n Object.defineProperty(exports, '__proto__', {\n enumerable: true,\n value: getHomeDir['__proto__']\n });\n\nObject.keys(getHomeDir).forEach(function (k) {\n if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = getHomeDir[k];\n});\nObject.prototype.hasOwnProperty.call(getSSOTokenFilepath, '__proto__') &&\n !Object.prototype.hasOwnProperty.call(exports, '__proto__') &&\n Object.defineProperty(exports, '__proto__', {\n enumerable: true,\n value: getSSOTokenFilepath['__proto__']\n });\n\nObject.keys(getSSOTokenFilepath).forEach(function (k) {\n if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = getSSOTokenFilepath[k];\n});\n"
|
|
10
10
|
],
|
|
11
11
|
"mappings": ";+GACA,CAAO,eAAe,EAAS,aAAc,CAAE,MAAO,EAAK,CAAC,EACpD,aAAkB,OAC1B,IAAM,UACA,YACA,EAAe,CAAC,EAChB,EAAqB,IAAM,CAC7B,GAAI,SAAW,QAAQ,QACnB,MAAO,GAAG,QAAQ,QAAQ,IAE9B,MAAO,WAEL,EAAa,IAAM,CACrB,IAAQ,OAAM,cAAa,WAAU,YAAY,KAAK,EAAO,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AAW,GAC1D,OAAO,eAAe,EAAS,YAAa,CACxC,WAAY,GACZ,MAAO,EAAW,SACtB,CAAC,EAEL,OAAO,KAAK,CAAU,EAAE,QAAQ,QAAS,CAAC,EAAG,CACzC,GAAI,IAAM,WAAa,CAAC,OAAO,UAAU,eAAe,KAAK,EAAS,CAAC,EAAG,EAAQ,GAAK,EAAW,GACrG,EACD,OAAO,UAAU,eAAe,KAAK,EAAqB,WAAW,GACjE,CAAC,OAAO,UAAU,eAAe,KAAK,EAAS,WAAW,GAC1D,OAAO,eAAe,EAAS,YAAa,CACxC,WAAY,GACZ,MAAO,EAAoB,SAC/B,CAAC,EAEL,OAAO,KAAK,CAAmB,EAAE,QAAQ,QAAS,CAAC,EAAG,CAClD,GAAI,IAAM,WAAa,CAAC,OAAO,UAAU,eAAe,KAAK,EAAS,CAAC,EAAG,EAAQ,GAAK,EAAoB,GAC9G",
|
|
12
|
-
"debugId": "
|
|
12
|
+
"debugId": "A2826CBD3EB9A71D64756E2164756E21",
|
|
13
13
|
"names": []
|
|
14
14
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ce as X,me as k}from"./chunk-nbx9mgmr.js";class S extends Error{constructor(z){super(`Could not infer a database dialect from "${z}". Expected a URL starting with postgres://, postgresql://, mysql://, mariadb://, `+"sqlite://, or file: \u2014 or a SQLite path such as ./dev.db or :memory:.");this.name="UnknownDatabaseUrlError"}}class U extends Error{constructor(z){super(z===void 0||z==="default"?"No database URL configured. Set the DATABASE_URL environment variable, or set `url` in app/config/database.ts.":`The "${z}" database connection has no \`url\`. Set one under \`connections.${z}\` in app/config/database.ts.`);this.name="MissingDatabaseUrlError"}}var D={"postgres:":"postgres","postgresql:":"postgres","mysql:":"mysql","mariadb:":"mariadb","sqlite:":"sqlite","file:":"sqlite"},h=[".db",".sqlite",".sqlite3"];function N(z){let G=z.trim();if(G==="")throw new S(z);if(G===":memory:")return"sqlite";let V=G.indexOf(":");if(V!==-1){let Y=G.slice(0,V+1).toLowerCase(),$=D[Y];if($)return $}if(y(G))return"sqlite";throw new S(z)}function y(z){if(z.startsWith("./")||z.startsWith("../")||z.startsWith("/"))return!0;let G=z.toLowerCase();return h.some((V)=>G.endsWith(V))}function o(z){return z==="sqlite"}function i(z){return z==="mysql"||z==="mariadb"}var{SQL:L}=globalThis.Bun;var Q="default";class R extends Error{constructor(z,G){super(`No database connection named "${z}". Configured: ${G.map((V)=>`"${V}"`).join(", ")}. Declare it under \`connections\` in app/config/database.ts.`);this.name="UnknownConnectionError"}}class b extends Error{constructor(z){super(`"${z}" is the name of the connection declared by the top-level \`url\` and \`options\`, so it cannot also appear under \`connections\`. Rename it, or move its settings up to the top level.`);this.name="ReservedConnectionNameError"}}class E extends Error{open;requested;constructor(z,G){super(`A transaction is open on the "${z}" connection, and this statement names "${G}". A transaction cannot span two connections: the statement would run outside it and stay committed when the transaction rolls back. Move this query outside the transaction, or run the whole unit on one connection.`);this.open=z;this.requested=G;this.name="CrossConnectionTransactionError"}}class P{name;config;sql;dialect;url;ready;constructor(z,G={}){this.name=z;this.config=G;let V=G.url;if(!V)throw new U(z);this.url=V,this.dialect=G.dialect??N(V),this.sql=G.options?new L(V,G.options):new L(V),this.ready=this.configure()}async configure(){if(this.dialect!=="sqlite")return;await this.sql.unsafe("pragma foreign_keys = ON")}get query(){return this.sql}async close(){this.ready.catch(()=>{}),await this.sql.close()}}class g{config;static token="database";name=Q;pools=new Map;ready;constructor(z={}){this.config=z;let{connections:G={},...V}=z;this.pools.set(Q,new P(Q,V));try{this.build(G,V.slowTransactionThreshold)}catch(Y){for(let $ of this.pools.values())$.ready.catch(()=>{}),$.close().catch(()=>{});throw Y}this.ready=Promise.all([...this.pools.values()].map((Y)=>Y.ready)).then(()=>{return})}build(z,G){for(let[V,Y]of Object.entries(z)){if(V===Q)throw new b(V);this.pools.set(V,new P(V,{slowTransactionThreshold:G,...Y}))}}connection(z=Q){if(z===Q)return this;let G=this.pools.get(z);if(!G)throw new R(z,this.connectionNames);return G}get connectionNames(){return[...this.pools.keys()]}get sql(){return this.default.sql}get dialect(){return this.default.dialect}get url(){return this.default.url}get query(){return this.sql}async close(){this.ready.catch(()=>{}),await Promise.all([...this.pools.values()].map((z)=>z.close()))}get default(){return this.pools.get(Q)}}function e(z){return z}function zz(){return{url:process.env.DATABASE_URL,dialect:void 0,options:void 0,slowTransactionThreshold:x,connections:void 0}}var x=2000;function Yz(){return{now:new Date,resolved:{}}}var f={now:new Date(0),resolved:{}};function Zz(z){return(G,V=f)=>{let Y=[];for(let $=0;$<z.length;$++)Y.push(z[$](G,V));return Y}}var I="\x00";function B(z){return{text:z,binders:[]}}function J(z,G=""){return{text:I+G,binders:[z]}}function $z(z){return z.text.split(I)}function Bz(z,G){return{text:z.join(I),binders:G}}function W(...z){return C(z,"")}function C(z,G){let V="",Y=[];for(let $=0;$<z.length;$++){if($>0)V+=G;V+=z[$].text;for(let Z of z[$].binders)Y.push(Z)}return{text:V,binders:Y}}function Wz(z,G,V){let Y=z.text.split(I),$=Y.length-1;if($!==z.binders.length)throw Error(`Compiled ${$} parameter placeholders but collected ${z.binders.length} binders.`);if($>G.maxBoundParameters)throw new k(V.model,V.operation,$,G.maxBoundParameters,G.name,G.bindsListAsOneParameter?"That is one parameter per value in the statement.":`That is one parameter per value, and on ${G.name} each element of an 'in' list counts separately.`);let Z=Y[0];for(let H=0;H<$;H++)Z+=G.placeholder(H)+Y[H+1];return{text:Z,binders:z.binders}}class F{name="postgres";supportsInsensitiveMode=!0;bindsListAsOneParameter=!0;supportsReturning=!0;maxBoundParameters=65535;typesParametersFromStatement=!0;quoteIdent(z){if(z.includes("\x00"))throw Error(`Refusing to quote the identifier ${JSON.stringify(z)}: it contains a NUL byte, which is reserved as the parameter marker.`);return`"${z.replace(/"/g,'""')}"`}placeholder(z){return`$${z+1}`}inList(z,G,V,Y){return W(B(`${z} ${G?"<> all":"= any"} (`),J((Z,H)=>K(Y(Z,H))),B(")"))}static COMPOSITE_IN_TYPES={Int:"int",BigInt:"bigint",String:"text",Boolean:"boolean"};canBindCompositeIn(z){return z.length>0&&z.every((G)=>F.COMPOSITE_IN_TYPES[G])}compositeIn(z,G,V){let Y=z.map(($,Z)=>W(J((H,j)=>K(V(H,j).map((_)=>_[Z]))),B(`::${F.COMPOSITE_IN_TYPES[G[Z]]}[]`)));return W(B(`(${z.join(", ")}) in (select * from unnest(`),...Y.flatMap(($,Z)=>Z===0?[$]:[B(", "),$]),B("))"))}listFilters=new Set(["equals","has","hasEvery","hasSome","isEmpty"]);listHas(z,G){return W(G,B(` = any(${z})`))}listHasEvery(z,G){return W(B(`${z} @> `),G)}listHasSome(z,G){return W(B(`${z} && `),G)}listIsEmpty(z,G){return W(B(`${z} ${G?"=":"<>"} `),J(()=>K([])))}listPush(z,G){return W(B(`array_cat(${z}, `),G,B(")"))}jsonPathSyntax="array";jsonFilters=new Set(["equals","not","string_contains","string_starts_with","string_ends_with","array_contains","lt","lte","gt","gte"]);jsonComparesAsText=!0;jsonExtract(z,G,V){return W(B(`${z} ${V?"#>>":"#>"} `),J((Y,$)=>K(G(Y,$))))}jsonArrayContains(z,G,V){return W(B("("),this.jsonExtract(z,G,!1),B(") @> "),J((Y,$)=>{let Z=V(Y,$);if(Z===null||Z===void 0)return null;return typeof Z==="string"||typeof Z==="object"?Z:JSON.stringify(Z)}),B("::jsonb"))}like(z,G,V){return W(B(`${z} ${G?"ilike":"like"} `),J(V))}ignoreConflicts(){return B(" on conflict do nothing")}paginate(z,G){let V=[];if(z)V.push(W(B(" limit "),J(z)));if(G)V.push(W(B(" offset "),J(G)));return W(...V)}constraintViolation(z){let G=z;if(!G)return null;if(String(G.errno??G.code??"")!=="23505")return null;let Y=typeof G.constraint==="string"&&G.constraint!==""?G.constraint:void 0,$=typeof G.detail==="string"?G.detail:"",Z=/\((.+?)\)=/.exec($);return{kind:"unique",columns:Z?Z[1].split(",").map((j)=>j.trim()).filter((j)=>j!==""):[],constraint:Y}}castParameter(z){if(z.isList)return"";return z.type==="Json"?"::text::jsonb":""}encode(z,G){if(z===null||z===void 0)return null;if(G.isList){if(!Array.isArray(z))throw Error(`gemi ORM bug: a non-array reached the parameter binder for the scalar list '${G.column}' (received ${typeof z}). Every path that binds a list is supposed to have checked its operand.`);return K(G.type==="Json"?z.map((V)=>V===null||V===void 0?null:JSON.stringify(V)):z)}return z}encodeUntyped(z){return z}needsDecode(z){return z.isList===!0||z.type==="BigInt"||z.type==="Bytes"}decode(z,G){if(z===null||z===void 0)return null;if(G.isList)return this.decodeList(z,G);return this.decodeScalar(z,G)}decodeList(z,G){let V=Array.isArray(z)?z:typeof z==="string"?m(z,G):ArrayBuffer.isView(z)?Array.from(z):null;if(V===null)throw new X(G,z);return V.map((Y)=>Y===null||Y===void 0?null:this.decodeScalar(Y,G))}decodeScalar(z,G){switch(G.type){case"BigInt":if(typeof z==="bigint")return z;try{return BigInt(z)}catch{throw new X(G,z)}case"Json":return z;case"Bytes":return Buffer.isBuffer(z)?new Uint8Array(z.buffer,z.byteOffset,z.byteLength):z;default:return z}}}function K(z){let G="{";for(let V=0;V<z.length;V++){if(V>0)G+=",";G+=p(z[V])}return G+"}"}function p(z){if(z===null||z===void 0)return"NULL";if(z instanceof Date)return`"${z.toISOString()}"`;if(ArrayBuffer.isView(z)){let V="";for(let Y of new Uint8Array(z.buffer,z.byteOffset,z.byteLength))V+=Y.toString(16).padStart(2,"0");return`"\\\\x${V}"`}return`"${(typeof z==="string"?z:String(z)).replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`}function m(z,G){if(!z.startsWith("{")||!z.endsWith("}"))throw new X(G,z);if(z==="{}")return[];let V=[],Y=1,$=z.length-1;while(Y<=$){let Z="",H=!1;if(z[Y]==='"'){H=!0,Y++;while(Y<$&&z[Y]!=='"')Z+=z[Y]==="\\"?z[++Y]:z[Y],Y++;Y++}else while(Y<$&&z[Y]!==","){if(z[Y]==="{")throw new X(G,z);Z+=z[Y],Y++}if(V.push(!H&&Z.toUpperCase()==="NULL"?null:Z),Y<$&&z[Y]!==",")throw new X(G,z);Y++}if(G.type!=="Json")return V;return V.map((Z)=>{if(Z===null)return null;try{return JSON.parse(Z)}catch{throw new X(G,Z)}})}var c={"Prisma.DbNull":"db","Prisma.JsonNull":"json","Prisma.AnyNull":"any"};function O(z){return new class{toString(){return z}}}var jz=O("Prisma.DbNull"),d=O("Prisma.JsonNull"),Kz=O("Prisma.AnyNull"),Fz=d;function T(z){if(typeof z!=="object"||z===null)return null;for(let V in z)return null;if(Object.getOwnPropertyNames(z).length>0)return null;let G;try{G=String(z)}catch{return null}return c[G]??null}var v=/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(\.\d+)?$/;function s(z,G){if(z instanceof Date)return z;let V;if(typeof z==="number")V=new Date(z);else if(typeof z==="bigint")V=new Date(Number(z));else if(typeof z==="string")V=new Date(v.test(z)?`${z.replace(" ","T")}Z`:z);else throw new X(G,z);if(Number.isNaN(V.getTime()))throw new X(G,z);return V}class w{name="sqlite";supportsInsensitiveMode=!1;bindsListAsOneParameter=!1;supportsReturning=!0;maxBoundParameters=32766;typesParametersFromStatement=!1;quoteIdent(z){if(z.includes("\x00"))throw Error(`Refusing to quote the identifier ${JSON.stringify(z)}: it contains a NUL byte, which is reserved as the parameter marker.`);return`"${z.replace(/"/g,'""')}"`}placeholder(z){return"?"}inList(z,G,V,Y){let $=G?"not in":"in",Z=[];for(let H=0;H<V;H++)Z.push(J((j,_)=>Y(j,_)[H]));return W(B(`${z} ${$} (`),C(Z,", "),B(")"))}canBindCompositeIn(){return!1}compositeIn(){throw Error("SQLite cannot bind a composite `in`; `canBindCompositeIn` is the guard.")}listFilters=new Set;listHas(){throw Error(M("has"))}listHasEvery(){throw Error(M("hasEvery"))}listHasSome(){throw Error(M("hasSome"))}listIsEmpty(){throw Error(M("isEmpty"))}listPush(){throw Error(M("push"))}jsonPathSyntax="jsonpath";jsonFilters=new Set(["equals","not","string_contains","string_starts_with","string_ends_with"]);jsonComparesAsText=!1;jsonExtract(z,G,V){return W(B(`json_extract(${z}, `),J(G),B(")"))}jsonArrayContains(){throw Error("SQLite cannot express array_contains; `jsonFilters` is the guard.")}like(z,G,V){return W(B(`${z} like `),J(V))}ignoreConflicts(){return null}paginate(z,G){if(!z&&!G)return B("");if(!G)return W(B(" limit "),J(z));return W(B(" limit "),J(z??(()=>-1)),B(" offset "),J(G))}constraintViolation(z){let G=z?.code;if(G!=="SQLITE_CONSTRAINT_UNIQUE"&&G!=="SQLITE_CONSTRAINT_PRIMARYKEY")return null;let V=String(z.message??""),Y=/constraint failed:\s*(.+)$/.exec(V);if(!Y)return{kind:"unique",columns:[]};return{kind:"unique",columns:Y[1].split(",").map((Z)=>Z.trim()).map((Z)=>{let H=Z.indexOf(".");return H===-1?Z:Z.slice(H+1)}).filter((Z)=>Z!=="")}}castParameter(z){return""}encode(z,G){if(z===null||z===void 0)return null;switch(G.type){case"DateTime":return z instanceof Date?z.getTime():z;case"Boolean":return typeof z==="boolean"?z?1:0:z;case"Json":{let V=T(z);if(V==="db")return null;if(V==="json")return"null";if(V==="any")throw Error("gemi ORM bug: Prisma.AnyNull reached the SQLite encoder. It is a filter operand only, and both the filter and write paths are supposed to have handled it before this point.")}return JSON.stringify(z);default:return z}}encodeUntyped(z){if(z instanceof Date)return z.getTime();if(typeof z==="boolean")return z?1:0;return z}needsDecode(z){switch(z.type){case"DateTime":case"Boolean":case"BigInt":case"Json":return!0;default:return!1}}decode(z,G){if(z===null||z===void 0)return null;switch(G.type){case"DateTime":return s(z,G);case"Boolean":if(typeof z==="boolean")return z;return Number(z)!==0;case"BigInt":if(typeof z==="bigint")return z;try{return BigInt(z)}catch{throw new X(G,z)}case"Json":try{return typeof z==="string"?JSON.parse(z):z}catch{throw new X(G,z)}default:return z}}}function M(z){return`SQLite has no array type, so it cannot express '${z}' on a scalar list; \`listFilters\` is the guard.`}class q extends Error{constructor(z){super(`The gemi ORM does not support the '${z}' dialect. Only sqlite `+"and postgres are implemented \u2014 see the supported matrix in "+`docs/orm.md.
|
|
2
|
+
import{je as X,te as k}from"./chunk-cg53h5ht.js";class S extends Error{constructor(z){super(`Could not infer a database dialect from "${z}". Expected a URL starting with postgres://, postgresql://, mysql://, mariadb://, `+"sqlite://, or file: \u2014 or a SQLite path such as ./dev.db or :memory:.");this.name="UnknownDatabaseUrlError"}}class U extends Error{constructor(z){super(z===void 0||z==="default"?"No database URL configured. Set the DATABASE_URL environment variable, or set `url` in app/config/database.ts.":`The "${z}" database connection has no \`url\`. Set one under \`connections.${z}\` in app/config/database.ts.`);this.name="MissingDatabaseUrlError"}}var D={"postgres:":"postgres","postgresql:":"postgres","mysql:":"mysql","mariadb:":"mariadb","sqlite:":"sqlite","file:":"sqlite"},h=[".db",".sqlite",".sqlite3"];function N(z){let G=z.trim();if(G==="")throw new S(z);if(G===":memory:")return"sqlite";let V=G.indexOf(":");if(V!==-1){let Y=G.slice(0,V+1).toLowerCase(),$=D[Y];if($)return $}if(y(G))return"sqlite";throw new S(z)}function y(z){if(z.startsWith("./")||z.startsWith("../")||z.startsWith("/"))return!0;let G=z.toLowerCase();return h.some((V)=>G.endsWith(V))}function o(z){return z==="sqlite"}function i(z){return z==="mysql"||z==="mariadb"}var{SQL:L}=globalThis.Bun;var Q="default";class R extends Error{constructor(z,G){super(`No database connection named "${z}". Configured: ${G.map((V)=>`"${V}"`).join(", ")}. Declare it under \`connections\` in app/config/database.ts.`);this.name="UnknownConnectionError"}}class b extends Error{constructor(z){super(`"${z}" is the name of the connection declared by the top-level \`url\` and \`options\`, so it cannot also appear under \`connections\`. Rename it, or move its settings up to the top level.`);this.name="ReservedConnectionNameError"}}class E extends Error{open;requested;constructor(z,G){super(`A transaction is open on the "${z}" connection, and this statement names "${G}". A transaction cannot span two connections: the statement would run outside it and stay committed when the transaction rolls back. Move this query outside the transaction, or run the whole unit on one connection.`);this.open=z;this.requested=G;this.name="CrossConnectionTransactionError"}}class P{name;config;sql;dialect;url;ready;constructor(z,G={}){this.name=z;this.config=G;let V=G.url;if(!V)throw new U(z);this.url=V,this.dialect=G.dialect??N(V),this.sql=G.options?new L(V,G.options):new L(V),this.ready=this.configure()}async configure(){if(this.dialect!=="sqlite")return;await this.sql.unsafe("pragma foreign_keys = ON")}get query(){return this.sql}async close(){this.ready.catch(()=>{}),await this.sql.close()}}class g{config;static token="database";name=Q;pools=new Map;ready;constructor(z={}){this.config=z;let{connections:G={},...V}=z;this.pools.set(Q,new P(Q,V));try{this.build(G,V.slowTransactionThreshold)}catch(Y){for(let $ of this.pools.values())$.ready.catch(()=>{}),$.close().catch(()=>{});throw Y}this.ready=Promise.all([...this.pools.values()].map((Y)=>Y.ready)).then(()=>{return})}build(z,G){for(let[V,Y]of Object.entries(z)){if(V===Q)throw new b(V);this.pools.set(V,new P(V,{slowTransactionThreshold:G,...Y}))}}connection(z=Q){if(z===Q)return this;let G=this.pools.get(z);if(!G)throw new R(z,this.connectionNames);return G}get connectionNames(){return[...this.pools.keys()]}get sql(){return this.default.sql}get dialect(){return this.default.dialect}get url(){return this.default.url}get query(){return this.sql}async close(){this.ready.catch(()=>{}),await Promise.all([...this.pools.values()].map((z)=>z.close()))}get default(){return this.pools.get(Q)}}function e(z){return z}function zz(){return{url:process.env.DATABASE_URL,dialect:void 0,options:void 0,slowTransactionThreshold:x,connections:void 0}}var x=2000;function Yz(){return{now:new Date,resolved:{}}}var f={now:new Date(0),resolved:{}};function Zz(z){return(G,V=f)=>{let Y=[];for(let $=0;$<z.length;$++)Y.push(z[$](G,V));return Y}}var I="\x00";function B(z){return{text:z,binders:[]}}function J(z,G=""){return{text:I+G,binders:[z]}}function $z(z){return z.text.split(I)}function Bz(z,G){return{text:z.join(I),binders:G}}function W(...z){return C(z,"")}function C(z,G){let V="",Y=[];for(let $=0;$<z.length;$++){if($>0)V+=G;V+=z[$].text;for(let Z of z[$].binders)Y.push(Z)}return{text:V,binders:Y}}function Wz(z,G,V){let Y=z.text.split(I),$=Y.length-1;if($!==z.binders.length)throw Error(`Compiled ${$} parameter placeholders but collected ${z.binders.length} binders.`);if($>G.maxBoundParameters)throw new k(V.model,V.operation,$,G.maxBoundParameters,G.name,G.bindsListAsOneParameter?"That is one parameter per value in the statement.":`That is one parameter per value, and on ${G.name} each element of an 'in' list counts separately.`);let Z=Y[0];for(let H=0;H<$;H++)Z+=G.placeholder(H)+Y[H+1];return{text:Z,binders:z.binders}}class F{name="postgres";supportsInsensitiveMode=!0;bindsListAsOneParameter=!0;supportsReturning=!0;maxBoundParameters=65535;typesParametersFromStatement=!0;quoteIdent(z){if(z.includes("\x00"))throw Error(`Refusing to quote the identifier ${JSON.stringify(z)}: it contains a NUL byte, which is reserved as the parameter marker.`);return`"${z.replace(/"/g,'""')}"`}placeholder(z){return`$${z+1}`}inList(z,G,V,Y){return W(B(`${z} ${G?"<> all":"= any"} (`),J((Z,H)=>K(Y(Z,H))),B(")"))}static COMPOSITE_IN_TYPES={Int:"int",BigInt:"bigint",String:"text",Boolean:"boolean"};canBindCompositeIn(z){return z.length>0&&z.every((G)=>F.COMPOSITE_IN_TYPES[G])}compositeIn(z,G,V){let Y=z.map(($,Z)=>W(J((H,j)=>K(V(H,j).map((_)=>_[Z]))),B(`::${F.COMPOSITE_IN_TYPES[G[Z]]}[]`)));return W(B(`(${z.join(", ")}) in (select * from unnest(`),...Y.flatMap(($,Z)=>Z===0?[$]:[B(", "),$]),B("))"))}listFilters=new Set(["equals","has","hasEvery","hasSome","isEmpty"]);listHas(z,G){return W(G,B(` = any(${z})`))}listHasEvery(z,G){return W(B(`${z} @> `),G)}listHasSome(z,G){return W(B(`${z} && `),G)}listIsEmpty(z,G){return W(B(`${z} ${G?"=":"<>"} `),J(()=>K([])))}listPush(z,G){return W(B(`array_cat(${z}, `),G,B(")"))}jsonPathSyntax="array";jsonFilters=new Set(["equals","not","string_contains","string_starts_with","string_ends_with","array_contains","lt","lte","gt","gte"]);jsonComparesAsText=!0;jsonExtract(z,G,V){return W(B(`${z} ${V?"#>>":"#>"} `),J((Y,$)=>K(G(Y,$))))}jsonArrayContains(z,G,V){return W(B("("),this.jsonExtract(z,G,!1),B(") @> "),J((Y,$)=>{let Z=V(Y,$);if(Z===null||Z===void 0)return null;return typeof Z==="string"||typeof Z==="object"?Z:JSON.stringify(Z)}),B("::jsonb"))}like(z,G,V){return W(B(`${z} ${G?"ilike":"like"} `),J(V))}ignoreConflicts(){return B(" on conflict do nothing")}paginate(z,G){let V=[];if(z)V.push(W(B(" limit "),J(z)));if(G)V.push(W(B(" offset "),J(G)));return W(...V)}constraintViolation(z){let G=z;if(!G)return null;if(String(G.errno??G.code??"")!=="23505")return null;let Y=typeof G.constraint==="string"&&G.constraint!==""?G.constraint:void 0,$=typeof G.detail==="string"?G.detail:"",Z=/\((.+?)\)=/.exec($);return{kind:"unique",columns:Z?Z[1].split(",").map((j)=>j.trim()).filter((j)=>j!==""):[],constraint:Y}}castParameter(z){if(z.isList)return"";return z.type==="Json"?"::text::jsonb":""}encode(z,G){if(z===null||z===void 0)return null;if(G.isList){if(!Array.isArray(z))throw Error(`gemi ORM bug: a non-array reached the parameter binder for the scalar list '${G.column}' (received ${typeof z}). Every path that binds a list is supposed to have checked its operand.`);return K(G.type==="Json"?z.map((V)=>V===null||V===void 0?null:JSON.stringify(V)):z)}return z}encodeUntyped(z){return z}needsDecode(z){return z.isList===!0||z.type==="BigInt"||z.type==="Bytes"}decode(z,G){if(z===null||z===void 0)return null;if(G.isList)return this.decodeList(z,G);return this.decodeScalar(z,G)}decodeList(z,G){let V=Array.isArray(z)?z:typeof z==="string"?m(z,G):ArrayBuffer.isView(z)?Array.from(z):null;if(V===null)throw new X(G,z);return V.map((Y)=>Y===null||Y===void 0?null:this.decodeScalar(Y,G))}decodeScalar(z,G){switch(G.type){case"BigInt":if(typeof z==="bigint")return z;try{return BigInt(z)}catch{throw new X(G,z)}case"Json":return z;case"Bytes":return Buffer.isBuffer(z)?new Uint8Array(z.buffer,z.byteOffset,z.byteLength):z;default:return z}}}function K(z){let G="{";for(let V=0;V<z.length;V++){if(V>0)G+=",";G+=p(z[V])}return G+"}"}function p(z){if(z===null||z===void 0)return"NULL";if(z instanceof Date)return`"${z.toISOString()}"`;if(ArrayBuffer.isView(z)){let V="";for(let Y of new Uint8Array(z.buffer,z.byteOffset,z.byteLength))V+=Y.toString(16).padStart(2,"0");return`"\\\\x${V}"`}return`"${(typeof z==="string"?z:String(z)).replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`}function m(z,G){if(!z.startsWith("{")||!z.endsWith("}"))throw new X(G,z);if(z==="{}")return[];let V=[],Y=1,$=z.length-1;while(Y<=$){let Z="",H=!1;if(z[Y]==='"'){H=!0,Y++;while(Y<$&&z[Y]!=='"')Z+=z[Y]==="\\"?z[++Y]:z[Y],Y++;Y++}else while(Y<$&&z[Y]!==","){if(z[Y]==="{")throw new X(G,z);Z+=z[Y],Y++}if(V.push(!H&&Z.toUpperCase()==="NULL"?null:Z),Y<$&&z[Y]!==",")throw new X(G,z);Y++}if(G.type!=="Json")return V;return V.map((Z)=>{if(Z===null)return null;try{return JSON.parse(Z)}catch{throw new X(G,Z)}})}var c={"Prisma.DbNull":"db","Prisma.JsonNull":"json","Prisma.AnyNull":"any"};function O(z){return new class{toString(){return z}}}var jz=O("Prisma.DbNull"),d=O("Prisma.JsonNull"),Kz=O("Prisma.AnyNull"),Fz=d;function T(z){if(typeof z!=="object"||z===null)return null;for(let V in z)return null;if(Object.getOwnPropertyNames(z).length>0)return null;let G;try{G=String(z)}catch{return null}return c[G]??null}var v=/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(\.\d+)?$/;function s(z,G){if(z instanceof Date)return z;let V;if(typeof z==="number")V=new Date(z);else if(typeof z==="bigint")V=new Date(Number(z));else if(typeof z==="string")V=new Date(v.test(z)?`${z.replace(" ","T")}Z`:z);else throw new X(G,z);if(Number.isNaN(V.getTime()))throw new X(G,z);return V}class w{name="sqlite";supportsInsensitiveMode=!1;bindsListAsOneParameter=!1;supportsReturning=!0;maxBoundParameters=32766;typesParametersFromStatement=!1;quoteIdent(z){if(z.includes("\x00"))throw Error(`Refusing to quote the identifier ${JSON.stringify(z)}: it contains a NUL byte, which is reserved as the parameter marker.`);return`"${z.replace(/"/g,'""')}"`}placeholder(z){return"?"}inList(z,G,V,Y){let $=G?"not in":"in",Z=[];for(let H=0;H<V;H++)Z.push(J((j,_)=>Y(j,_)[H]));return W(B(`${z} ${$} (`),C(Z,", "),B(")"))}canBindCompositeIn(){return!1}compositeIn(){throw Error("SQLite cannot bind a composite `in`; `canBindCompositeIn` is the guard.")}listFilters=new Set;listHas(){throw Error(M("has"))}listHasEvery(){throw Error(M("hasEvery"))}listHasSome(){throw Error(M("hasSome"))}listIsEmpty(){throw Error(M("isEmpty"))}listPush(){throw Error(M("push"))}jsonPathSyntax="jsonpath";jsonFilters=new Set(["equals","not","string_contains","string_starts_with","string_ends_with"]);jsonComparesAsText=!1;jsonExtract(z,G,V){return W(B(`json_extract(${z}, `),J(G),B(")"))}jsonArrayContains(){throw Error("SQLite cannot express array_contains; `jsonFilters` is the guard.")}like(z,G,V){return W(B(`${z} like `),J(V))}ignoreConflicts(){return null}paginate(z,G){if(!z&&!G)return B("");if(!G)return W(B(" limit "),J(z));return W(B(" limit "),J(z??(()=>-1)),B(" offset "),J(G))}constraintViolation(z){let G=z?.code;if(G!=="SQLITE_CONSTRAINT_UNIQUE"&&G!=="SQLITE_CONSTRAINT_PRIMARYKEY")return null;let V=String(z.message??""),Y=/constraint failed:\s*(.+)$/.exec(V);if(!Y)return{kind:"unique",columns:[]};return{kind:"unique",columns:Y[1].split(",").map((Z)=>Z.trim()).map((Z)=>{let H=Z.indexOf(".");return H===-1?Z:Z.slice(H+1)}).filter((Z)=>Z!=="")}}castParameter(z){return""}encode(z,G){if(z===null||z===void 0)return null;switch(G.type){case"DateTime":return z instanceof Date?z.getTime():z;case"Boolean":return typeof z==="boolean"?z?1:0:z;case"Json":{let V=T(z);if(V==="db")return null;if(V==="json")return"null";if(V==="any")throw Error("gemi ORM bug: Prisma.AnyNull reached the SQLite encoder. It is a filter operand only, and both the filter and write paths are supposed to have handled it before this point.")}return JSON.stringify(z);default:return z}}encodeUntyped(z){if(z instanceof Date)return z.getTime();if(typeof z==="boolean")return z?1:0;return z}needsDecode(z){switch(z.type){case"DateTime":case"Boolean":case"BigInt":case"Json":return!0;default:return!1}}decode(z,G){if(z===null||z===void 0)return null;switch(G.type){case"DateTime":return s(z,G);case"Boolean":if(typeof z==="boolean")return z;return Number(z)!==0;case"BigInt":if(typeof z==="bigint")return z;try{return BigInt(z)}catch{throw new X(G,z)}case"Json":try{return typeof z==="string"?JSON.parse(z):z}catch{throw new X(G,z)}default:return z}}}function M(z){return`SQLite has no array type, so it cannot express '${z}' on a scalar list; \`listFilters\` is the guard.`}class q extends Error{constructor(z){super(`The gemi ORM does not support the '${z}' dialect. Only sqlite `+"and postgres are implemented \u2014 see the supported matrix in "+`docs/orm.md.
|
|
3
3
|
|
|
4
4
|
The *connection* is fine: Bun's client speaks ${z}, so raw SQL through DB.query / DB.sql and transactions all work. It is the query compiler that has no ${z} dialect, so every model operation raises this.
|
|
5
5
|
|
|
6
6
|
Point DATABASE_URL at Postgres or SQLite to use the ORM, or keep using Prisma's own client for this database.`);this.name="UnsupportedDialectError"}}function Cz(z){return A[z]!==null}function Oz(){return Object.keys(A)}var A={sqlite:new w,postgres:new F,mysql:null,mariadb:null};function wz(z){let G=A[z];if(G===null)throw new q(z);return G}
|
|
7
|
-
export{S as
|
|
7
|
+
export{S as Cc,U as Dc,N as Ec,o as Fc,i as Gc,Q as Hc,R as Ic,b as Jc,E as Kc,P as Lc,g as Mc,e as Nc,zz as Oc,x as Pc,Yz as Qc,Zz as Rc,B as Sc,J as Tc,$z as Uc,Bz as Vc,W as Wc,C as Xc,Wz as Yc,F as Zc,jz as _c,d as $c,Kz as ad,Fz as bd,T as cd,w as dd,q as ed,Cz as fd,Oz as gd,wz as hd};
|
|
8
8
|
|
|
9
|
-
//# debugId=
|
|
9
|
+
//# debugId=A91B85C09BFA044964756E2164756E21
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
"import type { Dialect } from \"../../database/dialect\";\nimport type { Binder, Fragment } from \"../compile/fragment\";\nimport type { FieldSchema, ScalarType } from \"../schema\";\nimport { PostgresDialect } from \"./postgres\";\nimport { SqliteDialect } from \"./sqlite\";\n\n/**\n * The per-database strategy.\n *\n * The rule this interface exists to enforce: no `if (dialect === \"postgres\")`\n * ever appears inside the compiler. When something genuinely cannot be\n * expressed through the interface, the interface widens — which is why\n * `inList`, `like` and `paginate` return `Fragment`s rather than strings. Each\n * of the three is a place where SQLite and Postgres disagree about *structure*,\n * not just spelling:\n *\n * - `inList` — SQLite expands one placeholder per element, so `in: [1,2]` and\n * `in: [1,2,3]` are different SQL and different plans. Postgres binds the\n * whole array to one parameter with `= any($1)`, so every length shares a\n * single plan and a single prepared statement.\n * - `like` — Postgres has `ilike` for `mode: \"insensitive\"`; SQLite has no\n * equivalent, and Prisma rejects the argument there outright.\n * - `paginate` — SQLite cannot parse `offset` without a preceding `limit`.\n */\nexport interface SqlDialect {\n readonly name: Dialect;\n\n /**\n * Whether `mode: \"insensitive\"` can be expressed at all. False on SQLite,\n * where Prisma rejects the argument rather than emulating it.\n */\n readonly supportsInsensitiveMode: boolean;\n\n /**\n * Whether an `in` list binds as a single parameter however long it is.\n *\n * True on Postgres (`= any($1)`), false on SQLite (`in (?, ?, ?)`). It is the\n * plan *cache* that needs to know: where the length does not change the SQL\n * text, it must not change the cache key either, or every distinct list\n * length mints another entry holding SQL identical to its neighbours'. That\n * matters most for relations, where the list length is the parent row count\n * and so varies with the data rather than with the code.\n */\n readonly bindsListAsOneParameter: boolean;\n\n /**\n * Whether `insert`/`update`/`delete` can return the rows they touched.\n *\n * True on both implemented dialects — Postgres has had `RETURNING` forever,\n * and SQLite since 3.35 (Bun 1.3.14 bundles 3.51.0, verified by querying\n * `sqlite_version()` rather than by reading a changelog).\n *\n * It is a capability rather than an assumption because MySQL and MariaDB have\n * no `RETURNING` at all. Their fallback — `lastInsertRowid` plus a re-select,\n * and no way to identify the rows an `updateMany` touched — is a different\n * statement shape, not a different spelling. Iteration 4 does not build it,\n * but it must stay expressible, so the write compiler asks rather than\n * assumes and raises a clear error when the answer is no.\n */\n readonly supportsReturning: boolean;\n\n /**\n * How many parameters one statement may bind.\n *\n * A hard protocol/driver limit, not a tuning knob: Postgres sends the\n * parameter count as an int16 in the Bind message, and SQLite compiles\n * `SQLITE_MAX_VARIABLE_NUMBER` in.\n *\n * Three shapes can approach it, all of them scaling with the caller's *data*\n * rather than with the query's shape:\n *\n * - `createMany`, at `rows × columns`.\n * - An `in` list on SQLite, which binds one placeholder per element — and\n * such a list is routinely request-derived (`?ids=…`).\n * - A to-many `include` on SQLite, which batches an `in` over the parent\n * keys, so a large enough `findMany` reaches it with no big list in sight.\n *\n * Postgres escapes the last two: `= any($1)` is one parameter however long\n * the array. The check itself lives in `compile/fragment.ts`'s `render`,\n * because that is the one place that sees a statement's final count.\n *\n * It lives *here* rather than as a constant in the compiler for the usual\n * reason: the number differs per dialect, and the compiler is not allowed to\n * know which dialect it is compiling for.\n */\n readonly maxBoundParameters: number;\n\n /**\n * Whether the **statement** decides a parameter's type, so a cast the caller\n * wrote onto their own placeholder changes how the driver encodes the value.\n *\n * True on Postgres: the server describes the statement, the client is told\n * the parameter is `jsonb`, and Bun then JSON-*encodes* whatever JS value it\n * was handed. That is the whole of #376 — the reason `json-param.ts` retypes\n * such a parameter through `text` and serialises it to match.\n *\n * False on SQLite, and not merely because the correction is unnecessary\n * there: it would be **wrong**, and it would not parse. A parameter's type is\n * the bound value's, and `cast(x as json)` is not a JSON cast at all — SQLite\n * takes any type name and applies affinity rules, and a name containing none\n * of INT/CHAR/CLOB/TEXT/BLOB/REAL/FLOA/DOUB gets NUMERIC affinity, so\n * `cast('{\"a\":1}' as json)` is `0`. Measured through `bun:sqlite` (Bun\n * 1.3.14):\n *\n * select cast(? as jsonb) -> 0 (runs)\n * select json_set('{\"a\":1}','$.b', cast(? as json)) -> {\"a\":1,\"b\":2}\n * select cast(? as text)::json -> ERROR unrecognized token: \":\"\n *\n * So the retyping's rewrite — `cast(? as text)::json` — turns a statement\n * that runs on SQLite today into a syntax error. `::` genuinely cannot fire\n * there (it does not parse), but `cast(… as …)` is not Postgres-only syntax,\n * and \"SQLite has no jsonb type\" is a claim about semantics rather than about\n * what the parser accepts. Asking here rather than matching on `name` is what\n * makes that a fact `tsc` and a test can hold.\n */\n readonly typesParametersFromStatement: boolean;\n\n /** Quote a table or column name. Only ever called with names from the schema. */\n quoteIdent(name: string): string;\n\n /**\n * The parameter marker for the `index`-th (0-based) parameter in a statement.\n * SQLite ignores the index and returns `?`; Postgres returns `$1`, `$2`, ...\n */\n placeholder(index: number): string;\n\n /**\n * Prisma-shaped value -> the value the driver must be handed for this field.\n * The mirror of `decode`, and just as load-bearing: Bun's SQLite driver binds\n * a `Date` to `NULL`, so an unencoded `where: { createdAt: date }` would\n * return no rows rather than failing.\n *\n * Applied at bind time, not compile time — it is a function of the value.\n * Which encoder runs is still decided from the schema, so compile stays pure.\n */\n encode(value: unknown, field: FieldSchema): unknown;\n\n /**\n * SQL appended to this field's placeholder, or `\"\"` for none.\n *\n * The one string a dialect contributes to the statement that is not a\n * parameter, so it must be a constant — never derived from a value, and never\n * from anything an application supplies. `fieldParam` is the only caller, and\n * a non-empty cast also means it serialises the value; the two travel\n * together and neither is correct alone (#209).\n */\n castParameter(field: FieldSchema): string;\n\n /**\n * The same, for a value with **no declared column type** — a parameter\n * interpolated into a composed raw fragment, where there is no schema to ask.\n *\n * It exists because \"raw\" cannot mean \"unportable\". Bun's SQLite driver\n * rejects a `Date` outright (`Binding expected string, TypedArray, boolean,\n * number, bigint or null`) while Postgres takes one, so\n * ``sql`where \"createdAt\" > ${date}` `` would work on one dialect and throw on\n * the other — and the caller has no dialect-independent value to reach for\n * instead, because milliseconds are only correct if that is what the ORM\n * stored. Which it is: this converts to exactly what `encode` writes for a\n * `DateTime`, so a raw statement compares against ORM-written rows correctly.\n *\n * Deliberately narrow. It normalises the JavaScript types whose SQL form the\n * ORM has already decided — a `Date`, a boolean — and touches nothing else. A\n * plain object is *not* JSON-encoded here: the compiler only knows to do that\n * because a field says `Json`, and guessing from the value would turn a\n * mistyped parameter into a successfully-written string.\n *\n * The exception is a parameter the *caller* cast to `json`/`jsonb`, which is\n * a declared type by another route and does not reach this at all — see\n * `json-param.ts`. It is still not a guess from the value: the statement says\n * so.\n */\n encodeUntyped(value: unknown): unknown;\n\n /** Driver value -> the value Prisma would have returned for this field. */\n decode(value: unknown, field: FieldSchema): unknown;\n\n /**\n * False when the driver already returns exactly what Prisma would for this\n * field, letting the shaper skip the call entirely on the hot path.\n */\n needsDecode(field: FieldSchema): boolean;\n\n /**\n * `<lhs> in (...)` / `<lhs> not in (...)`.\n *\n * `length` is the element count, which is shape information and is already\n * part of the plan key. `values` returns the whole array at bind time; how it\n * is spread across parameters is the dialect's business.\n */\n inList(\n lhs: string,\n negated: boolean,\n length: number,\n values: Binder,\n ): Fragment;\n\n /** `<lhs> like <pattern>`, case-insensitively when the dialect can. */\n like(lhs: string, insensitive: boolean, pattern: Binder): Fragment;\n\n /**\n * Whether this dialect can match a **tuple** of columns against a list of\n * tuples in a statement whose text does not grow with the list.\n *\n * The single-column case is `inList`, and on Postgres `= any($1)` already\n * gives one SQL text for every length — which is what lets `collapsedList`\n * keep a batched relation query to one plan entry however many parents it\n * has. A relation joining on *more than one* field cannot use it, so the\n * loader falls back to an `OR` of `AND`s whose text does grow, and the plan\n * cache churns with the parent count (#97).\n *\n * `unnest` closes that on Postgres — one array parameter per *column*, so the\n * text is fixed — but it needs each column's SQL type for the cast, and the\n * types are asked about here rather than assumed: a dialect that cannot spell\n * one of them says so and the caller keeps the portable `OR`.\n */\n canBindCompositeIn(types: readonly ScalarType[]): boolean;\n\n /**\n * `(a, b) in (select * from unnest($1::t[], $2::u[]))`.\n *\n * `values` yields one tuple per parent at bind time; the dialect decides how\n * they are transposed into per-column arrays. Only called when\n * {@link canBindCompositeIn} returned true for these types.\n */\n compositeIn(\n columns: readonly string[],\n types: readonly ScalarType[],\n values: Binder,\n ): Fragment;\n\n /**\n * The filters this dialect can apply to a **scalar list** — `tags String[]`.\n *\n * **Empty is the whole of SQLite's answer**, and it is a capability rather\n * than a gap in this ORM: SQLite has no array type, and Prisma refuses the\n * declaration there at validation time — *\"Field `tags` in model `User` can't\n * be a list. The current connector does not support lists of primitive\n * types.\"* So a SQLite database cannot hold such a column to begin with.\n *\n * The refusal lives here rather than in the generator, which is where it used\n * to live (#300). The generated artifact is dialect-agnostic on purpose —\n * `DATABASE_URL` can name a different database than `prisma generate` saw —\n * so a generator that refused a scalar list refused it for Postgres too, and\n * one `String[]` anywhere meant no artifact for *any* model. Asking the\n * dialect at compile time refuses exactly the combination that cannot work,\n * and names it, which is the shape {@link UnsupportedDialectError} already\n * has for the dialects with no compiler at all.\n */\n readonly listFilters: ReadonlySet<string>;\n\n /**\n * `<value> = any(<column>)` — is this element in the list?\n *\n * The mirror of {@link inList} rather than a variant of it, and the two are\n * easy to confuse: there, one column is matched against a caller's list;\n * here, one caller value is matched against a column that *is* a list.\n *\n * **These four take a `Fragment` where every other member here takes a\n * `Binder`**, which is a deliberate exception. A list operand may need a cast\n * on its placeholder — a single element of a `Json[]` needs #209's\n * `::text::jsonb`, and the serialisation that must travel with it — so the\n * parameter is built by `fieldParam` before it arrives and the dialect\n * chooses only the operator. Handing over a `Binder` instead would oblige\n * each dialect to restate `fieldParam`'s rule, and restating it slightly\n * wrong is silent: `$1::jsonb = any(col)` answers *false* where\n * `$1::text::jsonb = any(col)` answers true, with no error on either.\n */\n listHas(column: string, value: Fragment): Fragment;\n\n /** `hasEvery` — every element of the operand is present in the column. */\n listHasEvery(column: string, values: Fragment): Fragment;\n\n /** `hasSome` — the column and the operand share at least one element. */\n listHasSome(column: string, values: Fragment): Fragment;\n\n /**\n * `isEmpty: true`, or its negation when `empty` is false.\n *\n * The odd one out with no operand at all: the value being compared against is\n * the empty list, which is the compiler's own constant rather than the\n * caller's. It stays a bound parameter regardless — see `jsonNullComparison`,\n * which declines the same exception for the same reason.\n */\n listIsEmpty(column: string, empty: boolean): Fragment;\n\n /**\n * The right-hand side of a `push`: the column's current value with the\n * operand appended. An expression rather than a statement, because it is\n * assigned by the write compiler like any other `set` value.\n */\n listPush(column: string, values: Fragment): Fragment;\n\n /**\n * How this dialect spells a JSON path, and which filters it can apply to one.\n *\n * The **path grammar itself differs**, which is unusual enough to be worth\n * stating rather than hiding: Prisma takes `path: [\"a\", \"b\"]` on Postgres and\n * `path: \"$.a.b\"` on SQLite, and refuses the other form on each. That is not\n * a gemi choice — it is the shape the generated client accepts, measured on\n * both — so reproducing it is what \"Prisma-compatible\" means here.\n *\n * `jsonFilters` is the set of scalar filters the dialect can apply to an\n * extracted value. Prisma refuses `array_contains` and the numeric\n * comparisons on SQLite with *\"Unknown argument\"*, so refusing them here is\n * matching it rather than falling short of it.\n */\n readonly jsonPathSyntax: \"array\" | \"jsonpath\";\n readonly jsonFilters: ReadonlySet<string>;\n\n /**\n * Whether an extracted value compares as **text**.\n *\n * Postgres's `#>>` yields `text`, so `equals: 3` has to bind `\"3\"` — comparing\n * text to an integer parameter is a type error there. SQLite's `json_extract`\n * yields a native value, so the same filter has to bind `3`: bind `\"3\"` and\n * SQLite compares an INTEGER to a TEXT, which is silently *false* rather than\n * an error. One filter, two encodings, and the wrong one is a returned-no-rows\n * bug on one dialect and a raised error on the other.\n */\n readonly jsonComparesAsText: boolean;\n\n /**\n * The extracted value, as a fragment whose path is **bound**.\n *\n * A JSON path is the one place a caller's *value* decides part of an\n * expression's meaning, which makes it the obvious place to interpolate by\n * accident and break invariant 2. Both dialects can take it as a parameter —\n * Postgres's `#>` accepts a `text[]`, SQLite's `json_extract` a string — so\n * nothing has to be bent to keep it out of the SQL text.\n *\n * `asText` picks the extraction that yields SQL text rather than JSON. Every\n * comparison in `jsonComparison` passes `true` — the string filters compare\n * against text, and `equals` / `not` / the numeric operators compare an\n * extracted *scalar*, which is what the text form gives them. The JSON form\n * has exactly one caller, `jsonArrayContains`, because containment is the one\n * operator whose right-hand side is a document.\n *\n * SQLite ignores the flag: `json_extract` already yields a SQL value rather\n * than a JSON document for a scalar at the path.\n */\n jsonExtract(column: string, path: Binder, asText: boolean): Fragment;\n\n /** `<extracted> @> <value>` — Postgres only; see `jsonFilters`. */\n jsonArrayContains(column: string, path: Binder, value: Binder): Fragment;\n\n /**\n * `limit`/`offset`. Both are values and therefore parameters — this is the\n * single most tempting place in the compiler to inline a number.\n */\n paginate(take: Binder | null, skip: Binder | null): Fragment;\n\n /**\n * The clause that makes an insert skip rows violating a unique constraint —\n * `createMany({ skipDuplicates: true })` — or `null` where it is not offered.\n *\n * **`null` is a parity decision, not a missing feature**, and that is worth\n * knowing before someone \"fixes\" SQLite by returning `insert or ignore`.\n * SQLite has `on conflict do nothing` and has since 3.24; Prisma nonetheless\n * rejects the *argument* on SQLite — `Unknown argument 'skipDuplicates'`,\n * whatever its value, verified against a generated 6.19 client. Offering it\n * here would make gemi a silent superset of Prisma on the one dialect the\n * differential harness could then no longer compare, which is the trade this\n * project has declined every other time it came up.\n *\n * A method rather than a boolean because the SQL differs where it exists, and\n * a `Fragment` because everything the compiler emits is one.\n */\n ignoreConflicts(): Fragment | null;\n\n /**\n * Recognise a driver error as a constraint violation, and say which columns\n * it names.\n *\n * Returns `null` for anything else, including the *other* constraint kinds:\n * SQLite reports NOT NULL and FOREIGN KEY failures through the same exception\n * type, and reporting one of those as a duplicate-key error would send a\n * caller looking for a row that does not exist.\n *\n * Columns, not fields — the driver only knows the database's names. The\n * caller maps them back through the schema, where `@map` is in scope.\n */\n constraintViolation(error: unknown): ConstraintViolation | null;\n}\n\n/** A driver error identified as a constraint failure, in dialect-neutral terms. */\nexport interface ConstraintViolation {\n /** Only `unique` is translated today; the rest surface as the raw error. */\n kind: \"unique\";\n /** Database column names, in the order the driver reported them. */\n columns: string[];\n /** The constraint's own name, when the driver gives one. Postgres does. */\n constraint?: string;\n}\n\n/**\n * The ORM was asked to compile against a dialect it does not implement.\n *\n * **The split this message has to convey**, because it is the surprising part:\n * `DatabaseManager` connects to MySQL and MariaDB perfectly well — Bun's client\n * speaks all four — so raw SQL through `DB.query` / `DB.sql` works, and\n * transactions work. What does not exist is a `SqlDialect` for them, so\n * everything that *compiles* a statement stops here.\n *\n * A caller who reads only \"not supported\" reasonably concludes the connection\n * is unusable, which is wrong and is the more expensive misreading: it is the\n * ORM that is unavailable, not the database.\n */\nexport class UnsupportedDialectError extends Error {\n constructor(dialect: Dialect) {\n super(\n `The gemi ORM does not support the '${dialect}' dialect. Only sqlite ` +\n `and postgres are implemented — see the supported matrix in ` +\n `docs/orm.md.\\n\\n` +\n `The *connection* is fine: Bun's client speaks ${dialect}, so raw SQL ` +\n `through DB.query / DB.sql and transactions all work. It is the query ` +\n `compiler that has no ${dialect} dialect, so every model operation ` +\n `raises this.\\n\\n` +\n `Point DATABASE_URL at Postgres or SQLite to use the ORM, or keep ` +\n `using Prisma's own client for this database.`,\n );\n this.name = \"UnsupportedDialectError\";\n }\n}\n\n/**\n * Whether the ORM can compile for this dialect at all.\n *\n * Exported so an application can find out at **boot** rather than on its first\n * query. That is the whole gap this closes: `DatabaseManager` constructs\n * happily against MySQL, so a deploy pointed at one starts, passes a health\n * check, serves traffic, and fails on the first model read — which is the\n * latest and most expensive moment to learn it.\n */\nexport function ormSupports(dialect: Dialect): boolean {\n return COMPILERS[dialect] !== null;\n}\n\n/** Every dialect `Dialect` names, for anything that has to walk them all. */\nexport function everyDialect(): Dialect[] {\n return Object.keys(COMPILERS) as Dialect[];\n}\n\n/**\n * The compiler for each dialect, or `null` where the ORM has none.\n *\n * **One map rather than two lists, and `satisfies` rather than a lookup.** The\n * supported set used to be written three times — `ormSupports`' `||` chain,\n * `dialectFor`'s `if` chain, and a test enumerating a hand-written copy of the\n * `Dialect` union — so adding a fifth member to that union changed nothing\n * anywhere: `tsc` clean, tests green, the new dialect silently reported as\n * unsupported by one function and unknown to the other.\n *\n * That moment is exactly what the guard exists for. Adding a dialect to the\n * union is the *first step of implementing one*, and it is the step where a\n * half-added dialect would disagree with itself.\n *\n * `satisfies Record<Dialect, …>` makes it a compile error in a file the build\n * actually checks. It has to live here rather than in a test: `tsconfig.json`\n * excludes test files and vitest transpiles without type-checking, so an\n * exhaustiveness check written there is a type error nothing ever evaluates.\n *\n * The sixth thing in this codebase made `tsc`'s job rather than a convention's\n * — see the note on `resolveLink`'s `operation`.\n */\nconst COMPILERS = {\n sqlite: new SqliteDialect(),\n postgres: new PostgresDialect(),\n // Bun's client speaks both; the ORM has no compiler for either. See\n // `UnsupportedDialectError`, which is careful to say that the *connection*\n // still works.\n mysql: null,\n mariadb: null,\n} satisfies Record<Dialect, SqlDialect | null>;\n\n/**\n * Resolved per call from `DatabaseManager.dialect`, never baked into a\n * generated artifact — `DATABASE_URL` can point at a different database than\n * the one `prisma generate` saw.\n */\nexport function dialectFor(dialect: Dialect): SqlDialect {\n const compiler = COMPILERS[dialect];\n if (compiler === null) throw new UnsupportedDialectError(dialect);\n return compiler;\n}\n\nexport { PostgresDialect, SqliteDialect };\n"
|
|
14
14
|
],
|
|
15
15
|
"mappings": ";iDAOO,MAAM,UAAgC,KAAM,CACjD,WAAW,CAAC,EAAa,CACvB,MACE,4CAA4C,sFAE1C,2EACJ,EACA,KAAK,KAAO,0BAEhB,CAEO,MAAM,UAAgC,KAAM,CAKjD,WAAW,CAAC,EAAqB,CAC/B,MACE,IAAe,QAAa,IAAe,UACvC,iHAEA,QAAQ,sEACiB,gCAC/B,EACA,KAAK,KAAO,0BAEhB,CAEA,IAAM,EAAqC,CACzC,YAAa,WACb,cAAe,WACf,SAAU,QACV,WAAY,UACZ,UAAW,SACX,QAAS,QACX,EAEM,EAAyB,CAAC,MAAO,UAAW,UAAU,EAUrD,SAAS,CAAY,CAAC,EAAsB,CACjD,IAAM,EAAU,EAAI,KAAK,EAEzB,GAAI,IAAY,G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UACH,GAAI,OAAO,IAAU,UAAW,OAAO,EAGvC,OAAO,OAAO,CAAK,IAAM,MACtB,SACH,GAAI,OAAO,IAAU,SAAU,OAAO,EACtC,GAAI,CACF,OAAO,OAAO,CAAe,EAC7B,KAAM,CAGN,MAAM,IAAI,EAAY,EAAO,CAAK,MAEjC,OACH,GAAI,CACF,OAAO,OAAO,IAAU,SAAW,KAAK,MAAM,CAAK,EAAI,EACvD,KAAM,CACN,MAAM,IAAI,EAAY,EAAO,CAAK,UAGpC,OAAO,GAGf,CAEA,SAAS,CAAe,CAAC,EAA0B,CACjD,MACE,mDAAmD,qDCnChD,MAAM,UAAgC,KAAM,CACjD,WAAW,CAAC,EAAkB,CAC5B,MACE,sCAAsC,2BACpC,mEACA;AAAA;AAAA,gDACiD,2GAEzB;AAAA;AAAA,8GAI5B,EACA,KAAK,KAAO,0BAEhB,CAWO,SAAS,EAAW,CAAC,EAA2B,CACrD,OAAO,EAAU,KAAa,KAIzB,SAAS,EAAY,EAAc,CACxC,OAAO,OAAO,KAAK,CAAS,EAyB9B,IAAM,EAAY,CAChB,OAAQ,IAAI,EACZ,SAAU,IAAI,EAId,MAAO,KACP,QAAS,IACX,EAOO,SAAS,EAAU,CAAC,EAA8B,CACvD,IAAM,EAAW,EAAU,GAC3B,GAAI,IAAa,KAAM,MAAM,IAAI,EAAwB,CAAO,EAChE,OAAO",
|
|
16
|
-
"debugId": "
|
|
16
|
+
"debugId": "A91B85C09BFA044964756E2164756E21",
|
|
17
17
|
"names": []
|
|
18
18
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Cb as W,Db as M,Eb as I}from"./chunk-ha7n1c94.js";import{Ce as E}from"./chunk-3y9nf09k.js";import{Me as C}from"./chunk-mt2755rs.js";function p(_){return _}function z(){return{jobs:[],jobsDir:"app/jobs",concurrency:1}}function R(){let _=process.env.APP_DIR,Q=process.env.ROOT_DIR,F=Bun.env.NODE_ENV==="production"?`${Q}/dist/server/bootstrap.mjs`:`${_}/bootstrap.ts`,V=new File([`
|
|
3
|
+
import { app } from "${F}"
|
|
4
|
+
self.onmessage = async (event) => {
|
|
5
|
+
const clone = app.clone()
|
|
6
|
+
let result = null;
|
|
7
|
+
let error = null;
|
|
8
|
+
try {
|
|
9
|
+
result = clone.dispatchJob(event.data.jobName, event.data.args)
|
|
10
|
+
} catch (err) {
|
|
11
|
+
error = err
|
|
12
|
+
}
|
|
13
|
+
clone.destroy()
|
|
14
|
+
if(error) {
|
|
15
|
+
self.postMessage({error});
|
|
16
|
+
} else {
|
|
17
|
+
self.postMessage({result});
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
`],"worker.ts"),H=URL.createObjectURL(V);return new Worker(H)}async function x(_,Q){let F=R();return F.postMessage({jobName:_,args:Q}),await new Promise((V,H)=>{F.onmessage=(G)=>{let K=G.data;if("error"in K)H(K.error);else V(K.result)}})}class O{static token="queue";queue=new Set;activeRunningJobsCount=0;isRunning=!1;jobs={};config;constructor(_={}){this.config=E(z(),_),this.useJobs(this.config.jobs)}useJobs(_){this.config.jobs=_,this.jobs={};for(let Q of _){if(this.jobs[Q.name]){console.error(`Two queued jobs are named "${Q.name}" \u2014 the first is registered `+"and this one is not, so dispatching either would have run one of them. A class name is the queue's key, so only one job can hold it. Rename one.");continue}this.jobs[Q.name]=Q}}get registeredJobs(){return[...this.config.jobs]}dispatchJob(_,Q){if(this.jobs[_])return new this.jobs[_]().run(JSON.parse(Q))}async next(){if(!this.isRunning)this.isRunning=!0;if(this.activeRunningJobsCount>=this.config.concurrency)return await new Promise((Q)=>setTimeout(Q,1000)),this.next();let _=this.queue.values().next().value;if(_)if(this.queue.delete(_),this.jobs[_.class])this.run(_);else console.error(`Dropped a queued job: nothing is registered under the name "${_.class}". If the class exists, it was not `+"discovered \u2014 check that it is under the queue slice's jobsDir "+"(app/jobs by default), or list it in app/config/queue.ts.");if(this.queue.size===0){this.isRunning=!1;return}await this.next()}async run(_){let Q=this.jobs[_.class],F=new Q,V=JSON.parse(_.args);this.activeRunningJobsCount++;try{let H=await(F.worker?x(_.class,_.args):F.run(...V));F.onSuccess(H,...V)}catch(H){if(F.onFail(H,...V),_.retries>=F.maxAttempts-1)F.onDeadletter(H,...V);else this.push(Q,_.args,_.retries+1)}this.activeRunningJobsCount--}push(_,Q,F=0){if(this.queue.add({class:_.name,args:Q,createdAt:Date.now(),retries:F}),!this.isRunning)this.next()}}class k extends Error{code;constructor(_,Q=1){super(_);this.code=Q;this.name="CommandFailed"}}class ${static commandName="unset";static description="";static args=[];static options=[];run(_){}}function h(_){return _}function U(){return{commands:[],commandsDir:"app/commands"}}var P=Symbol.for("gemi.console.builder");function D(_){if(_.trim()==="")throw Error("A command name cannot be empty.");if(/[{}]/.test(_)||/\s/.test(_))throw Error(`Invalid command name ${JSON.stringify(_)}. gemi does not parse a signature string; the name is the whole of it. Declare arguments with .arg() and flags with .option():
|
|
21
|
+
|
|
22
|
+
defineCommand("mail:send")
|
|
23
|
+
.arg("user", { required: true })
|
|
24
|
+
.option("queue", { type: "boolean" })
|
|
25
|
+
.handle(async ({ args, options }) => { ... })`)}function l(_){D(_);let Q=[],F=[],V="",H={[P]:_,describe(G){return V=G,H},arg(G,K={}){if(K.required&&K.default!==void 0)throw Error(`Argument "${G}" of command "${_}" is both required and has a default. An argument that is supplied when absent cannot also be `+"absent \u2014 drop one.");if(K.variadic&&K.default!==void 0)throw Error(`Argument "${G}" of command "${_}" is variadic and has a default. A variadic argument collects the remaining values and is an empty list when there are none, so the default could never `+"apply \u2014 drop it, or drop `variadic`.");let Y=Q.find((X)=>X.variadic);if(Y)throw Error(`Argument "${G}" of command "${_}" is declared after the variadic argument "${Y.name}", which collects everything that follows, so "${G}" could never receive a value. A variadic argument must be declared last.`);if(Q.some((X)=>X.name===G))throw Error(`Command "${_}" declares the argument "${G}" twice.`);return Q.push({...K,name:G}),H},option(G,K){if(F.some((Z)=>Z.name===G))throw Error(`Command "${_}" declares the option "${G}" twice.`);let Y="alias"in K?K.alias:void 0,X=Y===void 0?void 0:F.find((Z)=>("alias"in Z)&&Z.alias===Y);if(X)throw Error(`Options "${X.name}" and "${G}" of command "${_}" both use the alias "-${Y}".`);return F.push({...K,name:G}),H},handle(G){let K=_,Y=V,X=class extends ${static commandName=K;static description=Y;static args=[...Q];static options=[...F];run(Z){return G(Z)}};return delete H[P],Object.defineProperty(X,"name",{value:K,configurable:!0}),X}};return H}function T(_){return typeof _==="object"&&_!==null&&typeof _[P]==="string"}class q{name;cron;shouldRun(){return!0}callback(){}onTick(){}onComplete(){}static exp(_){return _}}function i(_){return _}function B(){return{jobs:[],jobsDir:"app/cron"}}class J{static name="unset";worker=!1;maxAttempts=3;run(..._){}onFail(_,...Q){}onSuccess(_,...Q){}onDeadletter(_,...Q){}static dispatch(..._){if(this.name==="unset")throw Error("Cannot dispatch a job with no name");C(O).push(this,JSON.stringify(_))}}import{existsSync as A}from"fs";import{dirname as y,isAbsolute as N,join as v}from"path";function L(_){return N(_)?_:v(I(),_)}function S(_,Q,F){if(A(_)||A(y(_)))return;console.warn(`No ${Q} were discovered: neither ${_} nor the directory above it exists, so this process cannot see the application's source. If this is a deploy that ships only the build output, list the classes explicitly in app/config/${F}.ts so they travel with it.`)}async function $_(_=z().jobsDir){let Q=L(_);S(Q,"queue jobs","queue");let F=await M(Q,J);return w(F),F}function w(_){for(let Q of _){if(Object.getOwnPropertyDescriptor(Q,"name")?.writable)continue;console.warn(`Queued job ${Q.name} does not declare \`static name\`, so it is registered under its class name. A production build minifies the class that dispatches it and renames it, while discovery reads this `+"file from source and does not \u2014 so the dispatch would be dropped in "+`production and nowhere else. Add: static name = "${Q.name}";`)}}async function z_(_=B().jobsDir){let Q=L(_);return S(Q,"cron jobs","schedule"),await M(Q,q)}async function M_(_=U().commandsDir){let Q=L(_);S(Q,"commands","command");let F=[],V=await M(Q,$,[],(H,G)=>{if(T(H))F.push(G)});return j(F),V}function j(_){if(_.length===0)return;let Q=_.length===1?`${_[0]} exports a command builder that never called \`.handle()\``:`${_.length} files export a command builder that never called \`.handle()\`:
|
|
26
|
+
${_.join(`
|
|
27
|
+
`)}`;throw new W(`${Q}, so there is no command to run. \`.handle()\` is what turns `+`the chain into a command \u2014 finish it:
|
|
28
|
+
|
|
29
|
+
`+` export default defineCommand("my-command")
|
|
30
|
+
.handle(async ({ line }) => { line("hello") })`)}
|
|
31
|
+
export{p as kb,z as lb,O as mb,k as nb,$ as ob,h as pb,U as qb,l as rb,q as sb,i as tb,B as ub,J as vb,$_ as wb,z_ as xb,M_ as yb};
|
|
32
|
+
|
|
33
|
+
//# debugId=D1A465A9DBBC085B64756E2164756E21
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../services/queue/config.ts", "../services/queue/QueueManager.ts", "../console/Command.ts", "../console/config.ts", "../console/builder.ts", "../services/cron/CronJob.ts", "../services/cron/config.ts", "../services/queue/Job.ts", "../services/discovery.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { Job } from \"./Job\";\n\n// Config key: `queue`. Derived from `QueueServiceProvider`.\nexport interface QueueConfig {\n /**\n * The `Job` subclasses this application dispatches, or nothing.\n *\n * ### Why \"or nothing\" is the point\n *\n * A dispatch that names a job the `QueueManager` has never heard of does not\n * fail — `next()` looks the name up in this list, and what is not there is\n * dropped with a line on stderr and nothing else. `Job.dispatch` has already\n * returned by then, so nothing upstream can be told. The list is therefore a\n * second spelling of `app/jobs`, kept in step by hand, and the cost of the\n * two disagreeing is paid by whatever was supposed to happen after the\n * dispatch.\n *\n * Leaving this out spells it once: the jobs are the classes under `jobsDir`.\n *\n * ### The rule, exactly\n *\n * **Declared wins, and `[]` is declared.** A `jobs` that is present is used\n * verbatim and no directory is read — that is the escape hatch for an app\n * whose jobs live somewhere this cannot walk, for one that deliberately\n * registers a subset, and for a deploy that ships no source. An empty array\n * means an app with no jobs and says so; it does not mean \"find some\".\n *\n * **Absent or `undefined` discovers.** `undefined` counts as absent for the\n * same reason `withDefaults` treats it that way everywhere else: a key spread\n * in from an optional value is an omission, not an instruction.\n */\n jobs?: Array<new () => Job>;\n\n /**\n * Where to look when `jobs` was not declared. Relative to the project root,\n * or absolute.\n *\n * Every `.ts`/`.tsx` file underneath it is imported at boot and every exported\n * class extending `Job` is registered, so this wants to be a directory of job\n * declarations rather than a directory that merely contains some. Moving the\n * jobs is what this field is for; pointing it at `app/` is not.\n */\n jobsDir?: string;\n\n concurrency?: number;\n}\n\nexport function defineQueueConfig(config: QueueConfig): QueueConfig {\n return config;\n}\n\nexport function queueConfigDefaults(): Required<QueueConfig> {\n return {\n jobs: [],\n jobsDir: \"app/jobs\",\n concurrency: 1,\n };\n}\n",
|
|
6
|
+
"import { Job } from \"./Job\";\nimport { queueConfigDefaults, type QueueConfig } from \"./config\";\nimport { withDefaults } from \"../../support/withDefaults\";\n\nfunction createWorker() {\n const APP_DIR = process.env.APP_DIR;\n const ROOT_DIR = process.env.ROOT_DIR;\n\n const appPath =\n process.env.NODE_ENV === \"production\"\n ? `${ROOT_DIR}/dist/server/bootstrap.mjs`\n : `${APP_DIR}/bootstrap.ts`;\n\n const file = new File(\n [\n `\n import { app } from \"${appPath}\"\n self.onmessage = async (event) => {\n const clone = app.clone()\n let result = null;\n let error = null;\n try {\n result = clone.dispatchJob(event.data.jobName, event.data.args)\n } catch (err) {\n error = err\n }\n clone.destroy()\n if(error) {\n self.postMessage({error});\n } else {\n self.postMessage({result});\n }\n };\n `,\n ],\n \"worker.ts\",\n );\n const url = URL.createObjectURL(file);\n return new Worker(url);\n}\n\n// TODO: terminate worker after the job is done\nasync function runInWorker(jobName: string, args: string) {\n const worker = createWorker();\n worker.postMessage({ jobName, args });\n return await new Promise((resolve, reject) => {\n worker.onmessage = (e) => {\n const data = e.data;\n if (\"error\" in data) {\n reject(data.error);\n } else {\n resolve(data.result);\n }\n };\n });\n}\n\ntype JobDefinition = {\n class: string;\n args: string;\n createdAt: number;\n retries: number;\n};\n\nexport class QueueManager {\n static token = \"queue\";\n\n queue: Set<JobDefinition> = new Set();\n activeRunningJobsCount = 0;\n isRunning = false;\n jobs: Record<string, new () => Job> = {};\n\n readonly config: Required<QueueConfig>;\n\n constructor(config: QueueConfig = {}) {\n this.config = withDefaults(queueConfigDefaults(), config);\n this.useJobs(this.config.jobs);\n }\n\n /**\n * Replaces the registered set, for the provider to hand over what it found\n * under `app/jobs`.\n *\n * This exists because the two phases disagree about when the answer is\n * knowable. The manager is constructed in `register()`, which is synchronous\n * and must resolve nothing; reading a directory and importing what is in it is\n * neither. So the manager is built from whatever the config slice declared —\n * nothing, when the app left `jobs` out — and the discovered set arrives in\n * `boot()`.\n *\n * The consequence worth knowing: anything that constructs an application and\n * skips phase two sees an empty registry, and every dispatch against an empty\n * registry is dropped — loudly on stderr, but after `Job.dispatch` has already\n * returned, so no caller finds out. An app that lists its jobs explicitly is\n * unaffected, because that list is already in place by the end of `register()`.\n */\n useJobs(jobs: Array<new () => Job>) {\n this.config.jobs = jobs;\n\n // Built one at a time rather than by `Object.fromEntries`, which resolves a\n // repeated key by keeping the last and saying nothing.\n //\n // Two classes with one name is the worst failure in this subsystem, and it\n // is worse than the dropped dispatch the rest of this file is about: the\n // registry is keyed by class name, a dispatch carries a class name, so\n // `SendEmail.dispatch(...)` on the one under `app/jobs/auth` would run the\n // body of the one under `app/jobs/billing`. Nothing is dropped and nothing\n // errors — the wrong work happens and reports success.\n //\n // Discovery is what makes it ordinary. A hand-written list forces an import\n // alias in one visible file the moment two names clash; a directory walk\n // does not, and `auth/SendEmail.ts` beside `billing/SendEmail.ts` is a\n // perfectly natural thing to write. So the first claim wins and the second\n // is refused out loud — the same rule `Scheduler.start` applies to a cron\n // name, and the reverse of the silent last-wins this replaces.\n this.jobs = {};\n for (const job of jobs) {\n const taken = this.jobs[job.name];\n if (taken) {\n console.error(\n `Two queued jobs are named \"${job.name}\" — the first is registered ` +\n `and this one is not, so dispatching either would have run one of ` +\n `them. A class name is the queue's key, so only one job can hold ` +\n `it. Rename one.`,\n );\n continue;\n }\n this.jobs[job.name] = job;\n }\n }\n\n /**\n * What the manager was handed, discovered or declared.\n *\n * The registry is keyed by name, and a name is exactly what a dispatch\n * carries, so \"is this job registered?\" is a question with a silent wrong\n * answer — `next()` drops an unknown name long after the caller moved on.\n * This is where a test asks it out loud.\n *\n * It reports what came in, not what the registry accepted, so a name claimed\n * twice appears twice here — deliberately, the same way `Scheduler.jobs`\n * does. A test walking this should see the collision rather than have it\n * tidied away. A copy, so that walk cannot edit the registry underneath it.\n */\n get registeredJobs(): ReadonlyArray<new () => Job> {\n return [...this.config.jobs];\n }\n\n dispatchJob(jobName: string, args: string) {\n if (this.jobs[jobName]) {\n const job = new this.jobs[jobName]();\n return job.run(JSON.parse(args));\n }\n }\n\n async next() {\n if (!this.isRunning) {\n this.isRunning = true;\n }\n\n if (this.activeRunningJobsCount >= this.config.concurrency) {\n await new Promise((resolve) => setTimeout(resolve, 1000));\n return this.next();\n }\n\n const jobDefinition = this.queue.values().next().value as\n | JobDefinition\n | undefined;\n\n if (jobDefinition) {\n // Taken off the queue before anything decides what to do with it. The\n // delete used to live inside the `if` below, so a name the registry could\n // not resolve left the head in place, the `size === 0` check below was\n // never reached, and `next()` recursed on the same entry until the stack\n // gave out. An unregistered dispatch is meant to be a dropped job, not a\n // crash — and discovery makes an empty registry newly reachable (a deploy\n // that ships no source finds nothing to register), so the difference\n // stopped being theoretical.\n this.queue.delete(jobDefinition);\n\n if (this.jobs[jobDefinition.class]) {\n this.run(jobDefinition);\n } else {\n // The one place this is observable. A dispatch carries a name, the\n // registry is keyed by name, and a name nobody registered matches\n // nothing — which is exactly the silence #322 is about, except here it\n // has already happened and the work is gone. Saying so is all that is\n // left to do about it.\n console.error(\n `Dropped a queued job: nothing is registered under the name ` +\n `\"${jobDefinition.class}\". If the class exists, it was not ` +\n `discovered — check that it is under the queue slice's jobsDir ` +\n `(app/jobs by default), or list it in app/config/queue.ts.`,\n );\n }\n }\n\n if (this.queue.size === 0) {\n this.isRunning = false;\n return;\n }\n\n await this.next();\n }\n\n private async run(jobDefinition: JobDefinition) {\n const Job = this.jobs[jobDefinition.class];\n const jobInstance = new Job();\n const args: any[] = JSON.parse(jobDefinition.args);\n\n this.activeRunningJobsCount++;\n\n try {\n const result = await (jobInstance.worker\n ? runInWorker(jobDefinition.class, jobDefinition.args)\n : jobInstance.run(...args));\n\n jobInstance.onSuccess(result, ...args);\n } catch (err) {\n jobInstance.onFail(err, ...args);\n if (jobDefinition.retries >= jobInstance.maxAttempts - 1) {\n jobInstance.onDeadletter(err, ...args);\n } else {\n this.push(Job, jobDefinition.args, jobDefinition.retries + 1);\n }\n }\n\n this.activeRunningJobsCount--;\n }\n\n push(job: new () => Job, args: string, retries = 0) {\n this.queue.add({\n class: job.name,\n args,\n createdAt: Date.now(),\n retries,\n });\n if (!this.isRunning) {\n this.next();\n }\n }\n}\n",
|
|
7
|
+
"/**\n * A command an operator runs by hand: `gemi run backfill-avatars --dry-run`.\n *\n * This file is the *runtime* shape — the base class discovery walks the\n * prototype chain for, and the statics the runner reads. It is not the\n * authoring surface. Applications write commands with `defineCommand` in\n * `./builder`, which produces one of these; see that file for why the authoring\n * surface is a builder and not a class body.\n *\n * ### Why the schema is descriptors and not a signature string\n *\n * Laravel spells this `protected $signature = 'mail:send {user} {--queue}'`, and\n * the string is the whole schema. It reads beautifully and TypeScript cannot see\n * a word of it: a brace in the wrong place is a parse error the first time\n * somebody runs the command, months after it was written, and the parser is a\n * piece of framework surface with its own failure modes. The descriptors below\n * say the same thing in a shape the compiler checks — and, through the builder,\n * in a shape that types the handler's own body.\n *\n * ### Why the name is declared and never falls back to the class name\n *\n * `Job` keys off `static name`, which shadows `Function.name`. That is the right\n * trade there: a job's name *is* its class name, and the shadow is what makes it\n * a string literal that survives minification. Here it is the wrong one twice\n * over. A command's name is a CLI token (`backfill-avatars`, `db:seed`) with no\n * relationship to the class name, so an implicit fallback would only ever be\n * wrong; and shadowing `Function.name` costs the one error anybody will actually\n * hit — \"two commands claim `db:seed`\" — the ability to say *which two*.\n *\n * ### The minification hazard does not reach here\n *\n * `services/discovery.ts` warns about a job that never declared `static name`,\n * because two halves have to agree on one string across a bundler: the\n * dispatcher, minified into `dist/server/server.mjs`, and discovery, reading the\n * source. A command has one half — a human types the name and it is matched\n * against discovery-on-source. Nothing in the server bundle names a command, and\n * `gemi build` keeps `app/commands` out of the bundle anyway. So there is no\n * `warnIfNameWillNotSurviveTheBuild` equivalent below, and adding one by analogy\n * would be noise.\n *\n * If a `Command.call(\"db:seed\")` reachable from a controller is ever added, that\n * changes — and `commandName` being a declared string literal already covers it,\n * which is one more reason not to fall back to the class binding.\n */\n\n/** A positional argument. `variadic` collects the rest and must come last. */\nexport interface ArgSpec {\n description?: string;\n /**\n * Missing it is a usage error rather than an `undefined` in the handler.\n * Mutually exclusive with `default` — an argument that is supplied when absent\n * cannot also be absent, and declaring both is refused rather than silently\n * resolved in one direction.\n */\n required?: boolean;\n /** Collects every remaining positional. Only legal on the last argument. */\n variadic?: boolean;\n /** Supplied when the argument is absent, which makes it always present. */\n default?: string;\n}\n\n/**\n * A flag. The `type` decides both how the value is parsed and what the handler\n * sees, which is why it is required rather than defaulted to `string`: a\n * `--dry-run` declared without a type would arrive as the string `\"\"`, and every\n * `if (options.dryRun)` over it would be wrong in the one direction nobody\n * tests.\n */\nexport type OptionSpec =\n | {\n type: \"boolean\";\n description?: string;\n /** Single character, without the dash. */\n alias?: string;\n default?: boolean;\n }\n | {\n type: \"string\";\n description?: string;\n alias?: string;\n default?: string;\n required?: boolean;\n }\n | {\n type: \"number\";\n description?: string;\n alias?: string;\n default?: number;\n required?: boolean;\n };\n\n/** An argument as stored on the class: the spec, plus the name it was given. */\nexport type CommandArgument = ArgSpec & { name: string };\n\n/** An option as stored on the class: the spec, plus the name it was given. */\nexport type CommandOption = OptionSpec & { name: string };\n\n/** What a handler may return. `void` and `0` mean the same thing. */\nexport type CommandResult = Promise<number | void> | number | void;\n\n/**\n * A command that failed on purpose.\n *\n * The distinction `bin/check-models.ts` draws between `CheckModelsError` and\n * everything else, in the one place an application can reach it: this is a\n * sentence written for the terminal and is printed without a stack, while\n * anything else that escapes a handler is a bug and keeps its stack.\n */\nexport class CommandFailed extends Error {\n constructor(\n message: string,\n readonly code: number = 1,\n ) {\n super(message);\n this.name = \"CommandFailed\";\n }\n}\n\n/**\n * The base class. Discovery finds subclasses of this; the runner reads the\n * statics and calls `run`.\n *\n * Subclassing it by hand works and is what `defineCommand` does under the hood,\n * but it gives up the typing that is the whole point of the builder — `run`'s\n * parameter cannot be inferred from statics declared on the subclass, because\n * TypeScript does not contextually type an overriding method's parameters. Write\n * commands with `defineCommand`.\n */\nexport class Command {\n /**\n * The name typed on the command line. Mandatory: there is no sensible default\n * and the class name is not one.\n */\n static commandName = \"unset\";\n\n /** One line, printed by `gemi run` with no name and at the top of `--help`. */\n static description = \"\";\n\n /** Positional arguments, in order. A variadic one must be last. */\n static args: CommandArgument[] = [];\n\n /** Flags. Declared in camelCase; `dryRun` is spelled `--dry-run` on the CLI. */\n static options: CommandOption[] = [];\n\n /**\n * The body.\n *\n * Runs inside `kernel.run()`, so `app(MailManager)` and a model read resolve\n * exactly as they do in a request handler. Resolve services *here* rather than\n * at module load: a command file is imported by discovery before the container\n * has finished booting, and a service captured at the top of the file is\n * captured from a container that is not ready.\n */\n run(_ctx: any): CommandResult {}\n}\n\n/** The type of a class `defineCommand(...).handle(...)` produces. */\nexport type CommandClass = typeof Command;\n",
|
|
8
|
+
"import type { CommandClass } from \"./Command\";\n\n// Config key: `command`. Consumed by `gemi run`, and by nothing at boot.\n//\n// Named `command` rather than `console` on purpose. An app declares its slices\n// by importing them into `app/kernel/Kernel.ts`, and a file called\n// `app/config/console.ts` arrives there as `import console from\n// \"../config/console\"` — which shadows the global `console` for the rest of that\n// module. Every application would inherit that, silently. `command` also matches\n// the singular slice names already in use: `route`, `queue`, `schedule`, `log`.\nexport interface CommandConfig {\n /**\n * The `Command` classes this application can run, or nothing.\n *\n * ### The rule, exactly\n *\n * **Declared wins, and `[]` is declared.** A `commands` that is present is\n * used verbatim and no directory is read — the escape hatch for an app whose\n * commands live somewhere the walk cannot reach, and for a deploy that ships\n * no source. An empty array means an app with no commands and says so; it does\n * not mean \"find some\".\n *\n * **Absent or `undefined` discovers.** `undefined` counts as absent for the\n * same reason `withDefaults` treats it that way everywhere else: a key spread\n * in from an optional value is an omission, not an instruction.\n *\n * ### One way this differs from `queue` and `schedule`\n *\n * There, the cost of the list and the directory disagreeing is silence — a\n * dispatch dropped with a line on stderr nobody reads, a report that stops\n * arriving. Here it is a person typing `gemi run thing` and being told, in\n * those words, that there is no command called `thing`. The rule is kept for\n * consistency and for the source-less-deploy case, not because the stakes are\n * the same.\n */\n commands?: CommandClass[];\n\n /**\n * Where to look when `commands` was not declared. Relative to the project\n * root, or absolute.\n *\n * Every `.ts`/`.tsx` file underneath is imported when a command is run, so\n * this wants to be a directory of command declarations rather than a directory\n * that merely contains some.\n */\n commandsDir?: string;\n}\n\nexport function defineCommandConfig(config: CommandConfig): CommandConfig {\n return config;\n}\n\nexport function commandConfigDefaults(): Required<CommandConfig> {\n return {\n commands: [],\n commandsDir: \"app/commands\",\n };\n}\n",
|
|
9
|
+
"import {\n Command,\n type ArgSpec,\n type CommandArgument,\n type CommandClass,\n type CommandOption,\n type CommandResult,\n type OptionSpec,\n} from \"./Command\";\nimport type { CommandContext } from \"./context\";\n\n/**\n * Declaring a command, in the one shape that can type its own body.\n *\n * ### Why a builder and not a class\n *\n * The point of declaring arguments and options at all is that the handler then\n * knows what it has. A class body cannot deliver that, and the reason is a hard\n * TypeScript rule rather than a matter of arrangement: **TypeScript does not\n * contextually type a method's parameters from the base-class method it\n * overrides.** So both class-shaped designs fail in the same place:\n *\n * ```ts\n * class Backfill extends Command {\n * static args = [{ name: \"since\", required: true }];\n * async run(ctx) {} // implicit any\n * }\n *\n * class Backfill extends Command.define({ since: { required: true } }) {\n * async run(ctx) {} // still implicit any — the\n * } // configured base's signature does\n * // not flow into the override\n * ```\n *\n * The author's only way out is to restate the type by hand, which is the\n * ceremony the descriptors existed to remove — and which nothing enforces, so a\n * wrong restatement compiles.\n *\n * A **function expression passed as an argument is contextually typed**. That is\n * the entire mechanism here, and it is why this is a builder rather than sugar:\n * `.handle(fn)` carries the accumulated argument and option types into `fn`'s\n * parameter with nothing written by hand and nothing to keep in step.\n *\n * ### What it produces\n *\n * A `Command` subclass, so nothing downstream knows the difference: discovery\n * finds it by prototype chain, and the registry, parser and `--help` read the\n * same statics they would read off a hand-written class. The builder is an\n * authoring surface over one runtime shape, not a second mechanism.\n */\n\n/**\n * Marks a builder that was never finished. `discoverCommands` looks for this on\n * the exports it is about to discard — see the note on `handle` below.\n */\nexport const BUILDER_BRAND: unique symbol = Symbol.for(\"gemi.console.builder\");\n\n/** Flattens an accumulated intersection so editor hovers stay readable. */\ntype Simplify<T> = { [K in keyof T]: T[K] } & {};\n\n/**\n * What the handler sees for one argument.\n *\n * The order matters: `variadic` first because it wins over everything, then the\n * two ways an argument is guaranteed present. Anything else can be absent and\n * says so.\n */\nexport type ArgValue<S> = S extends { variadic: true }\n ? string[]\n : S extends { required: true }\n ? string\n : S extends { default: string }\n ? string\n : string | undefined;\n\n/** What the handler sees for one option. */\nexport type OptionValue<S> = S extends { type: \"boolean\" }\n ? boolean\n : S extends { type: \"number\" }\n ? S extends { default: number }\n ? number\n : S extends { required: true }\n ? number\n : number | undefined\n : S extends { default: string }\n ? string\n : S extends { required: true }\n ? string\n : string | undefined;\n\nexport interface CommandBuilder<\n A extends Record<string, unknown>,\n O extends Record<string, unknown>,\n> {\n /** One line, shown in the listing and at the top of `--help`. */\n describe(text: string): CommandBuilder<A, O>;\n\n /**\n * A positional argument. Declared in the order it is read from the command\n * line; a `variadic` one must be last.\n */\n arg<N extends string, const S extends ArgSpec = {}>(\n name: N,\n spec?: S,\n ): CommandBuilder<A & { [K in N]: ArgValue<S> }, O>;\n\n /**\n * A flag. Declared in camelCase and spelled in kebab-case on the command line,\n * so `.option(\"dryRun\", …)` is `--dry-run` for the operator and\n * `options.dryRun` in the handler — no string key nobody can autocomplete, and\n * no CLI flag with a capital letter in it.\n */\n option<N extends string, const S extends OptionSpec>(\n name: N,\n spec: S,\n ): CommandBuilder<A, O & { [K in N]: OptionValue<S> }>;\n\n /**\n * The body, and the terminal of the chain.\n *\n * A builder that never reaches here is not a class, so discovery would skip it\n * and the command would simply vanish from `gemi run` with nothing raised —\n * the silence #322 and #323 exist to remove, reintroduced by a new authoring\n * surface. `discoverCommands` therefore looks for `BUILDER_BRAND` among the\n * exports it discards and refuses the file by name.\n */\n handle(\n fn: (ctx: CommandContext<Simplify<A>, Simplify<O>>) => CommandResult,\n ): CommandClass;\n}\n\n/**\n * Refused early, where the author is looking.\n *\n * The whitespace and brace checks are aimed at one specific reader: somebody who\n * knows Laravel and reaches for `defineCommand(\"mail:send {user} {--queue}\")`.\n * Without this they get a command registered under a name containing a space,\n * which can never be typed and never runs, and no explanation.\n */\nfunction assertUsableName(name: string): void {\n if (name.trim() === \"\") {\n throw new Error(\"A command name cannot be empty.\");\n }\n\n if (/[{}]/.test(name) || /\\s/.test(name)) {\n throw new Error(\n `Invalid command name ${JSON.stringify(name)}. gemi does not parse a ` +\n `signature string; the name is the whole of it. Declare arguments ` +\n `with .arg() and flags with .option():\\n\\n` +\n ` defineCommand(\"mail:send\")\\n` +\n ` .arg(\"user\", { required: true })\\n` +\n ` .option(\"queue\", { type: \"boolean\" })\\n` +\n ` .handle(async ({ args, options }) => { ... })`,\n );\n }\n}\n\nexport function defineCommand(name: string): CommandBuilder<{}, {}> {\n assertUsableName(name);\n\n const args: CommandArgument[] = [];\n const options: CommandOption[] = [];\n let description = \"\";\n\n const builder = {\n [BUILDER_BRAND]: name,\n\n describe(text: string) {\n description = text;\n return builder;\n },\n\n arg(argName: string, spec: ArgSpec = {}) {\n // Checked here rather than at parse time because both of these are\n // mistakes in the declaration, and the declaration is what the author is\n // looking at right now. At parse time they would surface as a confusing\n // usage error in front of an operator who cannot fix them.\n if (spec.required && spec.default !== undefined) {\n throw new Error(\n `Argument \"${argName}\" of command \"${name}\" is both required and has ` +\n `a default. An argument that is supplied when absent cannot also be ` +\n `absent — drop one.`,\n );\n }\n\n // A variadic collects whatever is left, so there is no \"absent\" for a\n // default to fill — the empty list is the answer. Refused rather than\n // ignored, for the same reason as the pair above: a declaration the parser\n // silently drops reads, to whoever wrote it, exactly like one it honours.\n if (spec.variadic && spec.default !== undefined) {\n throw new Error(\n `Argument \"${argName}\" of command \"${name}\" is variadic and has a ` +\n `default. A variadic argument collects the remaining values and is ` +\n `an empty list when there are none, so the default could never ` +\n `apply — drop it, or drop \\`variadic\\`.`,\n );\n }\n\n const variadic = args.find((existing) => existing.variadic);\n if (variadic) {\n throw new Error(\n `Argument \"${argName}\" of command \"${name}\" is declared after the ` +\n `variadic argument \"${variadic.name}\", which collects everything ` +\n `that follows, so \"${argName}\" could never receive a value. A ` +\n `variadic argument must be declared last.`,\n );\n }\n\n if (args.some((existing) => existing.name === argName)) {\n throw new Error(\n `Command \"${name}\" declares the argument \"${argName}\" twice.`,\n );\n }\n\n args.push({ ...spec, name: argName });\n return builder;\n },\n\n option(optionName: string, spec: OptionSpec) {\n if (options.some((existing) => existing.name === optionName)) {\n throw new Error(\n `Command \"${name}\" declares the option \"${optionName}\" twice.`,\n );\n }\n\n const alias = \"alias\" in spec ? spec.alias : undefined;\n const clash =\n alias === undefined\n ? undefined\n : options.find(\n (existing) => \"alias\" in existing && existing.alias === alias,\n );\n if (clash) {\n throw new Error(\n `Options \"${clash.name}\" and \"${optionName}\" of command \"${name}\" ` +\n `both use the alias \"-${alias}\".`,\n );\n }\n\n options.push({ ...spec, name: optionName });\n return builder;\n },\n\n handle(fn: (ctx: any) => CommandResult) {\n const commandName = name;\n const commandDescription = description;\n\n const cls = class extends Command {\n static commandName = commandName;\n static description = commandDescription;\n // Copied, not aliased. The builder goes on owning `args`/`options` and\n // mutating them on every subsequent `.arg()`/`.option()`, so storing the\n // instances themselves let a chain reach back into a class it had\n // already produced — and `--help` and the parser both read these\n // statics, so the printed usage and the accepted arguments would change\n // under a command that was finished.\n static args = [...args];\n static options = [...options];\n\n run(ctx: any) {\n return fn(ctx);\n }\n };\n\n // This chain produced a command, so it is no longer unfinished. The brand\n // exists to catch a file that exports a builder and never calls `.handle()`\n // — see `refuseUnfinishedBuilders` in `services/discovery.ts`. Leaving it\n // set meant the natural way to share declarations,\n //\n // export const base = defineCommand(\"reindex\").option(\"verbose\", ...);\n // export default base.handle(async () => {});\n //\n // left a branded object among the file's exports and aborted the whole of\n // `gemi run` — every command in the project unrunnable, under a message\n // that was untrue for that file.\n delete (builder as Record<PropertyKey, unknown>)[BUILDER_BRAND];\n\n // An anonymous class expression reports `name === \"\"`, and the duplicate-\n // name error's whole job is to say *which two*. Give it the one name it\n // has.\n Object.defineProperty(cls, \"name\", {\n value: commandName,\n configurable: true,\n });\n\n return cls;\n },\n };\n\n return builder as unknown as CommandBuilder<{}, {}>;\n}\n\n/** True for a builder that never called `.handle()`. */\nexport function isUnfinishedBuilder(\n value: unknown,\n): value is { [BUILDER_BRAND]: string } {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as Record<PropertyKey, unknown>)[BUILDER_BRAND] === \"string\"\n );\n}\n",
|
|
10
|
+
"// A cron expression accepted by `Bun.cron`: a 5-field expression\n// (`minute hour day-of-month month day-of-week`, interpreted in UTC) or one of\n// the nicknames below. The `string & {}` member keeps arbitrary expressions\n// assignable while still surfacing the nicknames in editor autocomplete.\nexport type CronExpression =\n | \"@yearly\"\n | \"@annually\"\n | \"@monthly\"\n | \"@weekly\"\n | \"@daily\"\n | \"@midnight\"\n | \"@hourly\"\n | (string & {});\n\nexport class CronJob {\n name: string;\n cron: CronExpression;\n\n /**\n * Decides whether this tick happens at all. Evaluated once per tick, before\n * anything else; returning `false` skips `onTick`, `callback` and\n * `onComplete` alike.\n *\n * ### Why this is a member and not a line the job writes for itself\n *\n * A job that reports outward — mails a digest, opens a Sentry issue, pings a\n * channel — must not fire from a laptop, and the guard for that has to cover\n * the whole tick. There was nowhere to write it. gemi calls `onTick` and\n * `onComplete` *outside* `callback`, so a guard placed in a lifecycle hook\n * only stops the hook it lives in: an early `return` at the top of `callback`\n * leaves the job still announcing that it started and still announcing that\n * it finished, which for an outward-reporting job is most of the damage.\n *\n * The only construct that covered every hook was an abstract base class that\n * shadowed `callback` with the guard and renamed the real body to `run()` —\n * and that costs the app the framework's own vocabulary. A job then reads\n * `async run()` while every page of the documentation reads `async\n * callback()`, so the next person to follow the docs writes a `callback` the\n * base class never calls: no error, no output, a job that silently does\n * nothing. Forgetting *this* member fails the other way round — the job runs,\n * which is what it did before anyone asked for a gate.\n *\n * ### What it gates\n *\n * Work, not registration. A job whose gate returns `false` is still\n * scheduled, still holds its `Bun.cron` handle, and still appears in\n * `app(Scheduler).jobs` — \"is it scheduled\" and \"will it do anything\" are\n * different questions and the second one is answered per tick. That is also\n * why this is a method: a field would be read once, when the scheduler\n * constructs the job at boot, and would freeze whatever it saw then.\n *\n * A gate that throws is logged and treated as `false`. Cron work recurs, so\n * a skipped tick is recovered by the next one, while an email sent from the\n * wrong machine is not recovered at all.\n *\n * ### Composing with a base class\n *\n * Nothing here calls `super` for you. A subclass that overrides `shouldRun`\n * for its own reason silently replaces whatever its base was gating on, so\n * narrow rather than redefine:\n *\n * ```typescript\n * async shouldRun() {\n * return (await super.shouldRun()) && this.hasSubscribers();\n * }\n * ```\n *\n * A shared base should annotate its return type as written here rather than\n * let it be inferred: a base returning a plain `boolean` narrows the\n * signature its subclasses inherit, and the `await super` above then does not\n * typecheck against it.\n */\n shouldRun(): Promise<boolean> | boolean {\n return true;\n }\n\n callback(): Promise<void> | void {}\n onTick(): Promise<void> | void {}\n onComplete(): Promise<void> | void {}\n\n static exp(expression: CronExpression) {\n return expression;\n }\n}\n",
|
|
11
|
+
"import type { CronJob } from \"./CronJob\";\n\n// Config key: `schedule`. Consumed by `ScheduleServiceProvider`.\nexport interface ScheduleConfig {\n /**\n * The `CronJob` subclasses this application runs on a schedule, or nothing.\n *\n * ### Why \"or nothing\" is the point\n *\n * A cron job that is written and not listed here never fires, and unlike a\n * dropped dispatch there is no caller left waiting to notice: nothing is\n * downstream of a tick that did not happen. The report is simply not sent,\n * for as long as it takes somebody to ask why they stopped seeing it. That is\n * the whole failure — the file exists, the expression is right, and the class\n * was never in the module graph.\n *\n * Leaving this out spells the schedule once: the jobs are the classes under\n * `jobsDir`.\n *\n * ### The rule, exactly\n *\n * **Declared wins, and `[]` is declared.** A `jobs` that is present is used\n * verbatim and no directory is read — the escape hatch for an app whose jobs\n * live somewhere this cannot walk, for one that runs a deliberate subset, and\n * for a deploy that ships no source. An empty array means an app with nothing\n * scheduled and says so; it does not mean \"find some\".\n *\n * **Absent or `undefined` discovers.** `undefined` counts as absent for the\n * same reason `withDefaults` treats it that way everywhere else: a key spread\n * in from an optional value is an omission, not an instruction.\n *\n * Either way the set the scheduler ended up with is readable afterwards, as\n * `app(Scheduler).jobs` — an app that used to import this array to assert\n * something about its own schedule asks the scheduler instead.\n */\n jobs?: Array<new () => CronJob>;\n\n /**\n * Where to look when `jobs` was not declared. Relative to the project root,\n * or absolute.\n *\n * Every `.ts`/`.tsx` file underneath it is imported at boot and every exported\n * class extending `CronJob` is scheduled, so this wants to be a directory of\n * cron declarations rather than a directory that merely contains some. Moving\n * the jobs is what this field is for; pointing it at `app/` is not.\n */\n jobsDir?: string;\n}\n\nexport function defineScheduleConfig(config: ScheduleConfig): ScheduleConfig {\n return config;\n}\n\nexport function scheduleConfigDefaults(): Required<ScheduleConfig> {\n return {\n jobs: [],\n jobsDir: \"app/cron\",\n };\n}\n",
|
|
12
|
+
"import { app } from \"../../foundation/app\";\nimport { QueueManager } from \"./QueueManager\";\n\nexport class Job {\n static name = \"unset\";\n worker = false;\n maxAttempts = 3;\n\n run(..._args: any[]): Promise<any> | any {}\n\n onFail(_error: Error, ..._args: any[]): void {}\n onSuccess(_result: any, ..._args: any[]): void {}\n onDeadletter(_error: Error, ..._args: any[]): void {}\n\n static dispatch<T extends Job>(\n this: new () => T,\n ...args: Parameters<T[\"run\"]>\n ): void {\n if (this.name === \"unset\") {\n throw new Error(\"Cannot dispatch a job with no name\");\n }\n\n app(QueueManager).push(this, JSON.stringify(args));\n }\n}\n",
|
|
13
|
+
"import { existsSync } from \"node:fs\";\nimport { dirname, isAbsolute, join } from \"node:path\";\n\nimport {\n discoverClasses,\n DiscoveryError,\n projectRoot,\n} from \"../support/discover\";\nimport { Command, type CommandClass } from \"../console/Command\";\nimport { commandConfigDefaults } from \"../console/config\";\nimport { isUnfinishedBuilder } from \"../console/builder\";\nimport { CronJob } from \"./cron/CronJob\";\nimport { scheduleConfigDefaults } from \"./cron/config\";\nimport { Job } from \"./queue/Job\";\nimport { queueConfigDefaults } from \"./queue/config\";\n\n/**\n * Reading an application's jobs off the filesystem, for the two subsystems that\n * were asking every app to write its job list twice.\n *\n * Both functions here are the same call to `discoverClasses` with a different\n * base class, which is deliberate: one walk, one set of skip rules, one answer\n * to \"what does this app have\". They are exported from `gemi/services` rather\n * than kept private to the providers because the list stopped being something\n * an app could import — a test that used to walk the exported `jobs` array\n * needs somewhere to ask the same question, and so does a script.\n *\n * What the providers add on top of these is the decision of *whether* to ask,\n * which is the config's to make and not this file's.\n */\n\n/**\n * A directory the app named, resolved the way the app meant it.\n *\n * Relative paths hang off the project root rather than `process.cwd()` at the\n * moment of the call, because a config slice saying `app/jobs` means the app's\n * `app/jobs` and not whatever directory somebody happened to launch a script\n * from. Absolute paths are taken as given, which is what makes these callable\n * from a test that has no project around it.\n */\nfunction resolveDir(dir: string): string {\n return isAbsolute(dir) ? dir : join(projectRoot(), dir);\n}\n\n/**\n * Says something when the directory is missing *and so is the tree it lives in*.\n *\n * A missing directory has two readings and they want opposite responses. An app\n * that has never written a cron job has no `app/cron`, and warning about that on\n * every boot for the rest of its life is noise — the answer \"you have no cron\n * jobs\" is correct and uninteresting. But a deploy that ships `dist/` and\n * `node_modules/` without the source has no `app/cron` *and no `app/`*, and\n * there discovery quietly returns nothing while the app very much does have\n * jobs: the exact silence #322 and #323 exist to remove, reintroduced one layer\n * down and in production only.\n *\n * The parent directory is what tells them apart. If neither the directory nor\n * the one above it is there, the tree this was pointed into is not there\n * either, and that is worth a sentence.\n */\nfunction warnIfSourceIsMissing(\n resolved: string,\n subject: string,\n slice: string,\n) {\n if (existsSync(resolved) || existsSync(dirname(resolved))) return;\n\n console.warn(\n `No ${subject} were discovered: neither ${resolved} nor the directory ` +\n `above it exists, so this process cannot see the application's source. ` +\n `If this is a deploy that ships only the build output, list the classes ` +\n `explicitly in app/config/${slice}.ts so they travel with it.`,\n );\n}\n\n/**\n * The `Job` subclasses under `dir`, defaulting to the config slice's `app/jobs`.\n *\n * This is what a `queue` config slice with no `jobs` key resolves to. Call it\n * directly to ask the question a test used to answer by importing the array:\n * every job this application would register, in the order it would register\n * them.\n *\n * Every file underneath is imported, so calling this runs the app's job modules\n * — the cost `discoverClasses` documents at length, paid once per call.\n */\nexport async function discoverJobs(\n dir: string = queueConfigDefaults().jobsDir,\n): Promise<Array<new () => Job>> {\n const resolved = resolveDir(dir);\n warnIfSourceIsMissing(resolved, \"queue jobs\", \"queue\");\n const jobs = await discoverClasses(resolved, Job);\n warnIfNameWillNotSurviveTheBuild(jobs);\n return jobs;\n}\n\n/**\n * Says something about a discovered job that never declared `static name`.\n *\n * This is the one hazard discovery introduces rather than removes, and it is\n * production-only. `gemi build` minifies the server entry, and app code\n * reachable from it — a controller, and every job class that controller\n * imports to dispatch — is bundled and minified with it. Minification renames\n * the class binding, and a class's implicit `.name` is that binding: a\n * `TestJob` in the bundle reports `\"D\"`. Discovery, meanwhile, imports\n * `app/jobs/TestJob.ts` from source at runtime, where it is still `\"TestJob\"`.\n * The queue is keyed by that name, so the two halves stop agreeing and the\n * dispatch is dropped — in production, and only there.\n *\n * A declared `static name = \"TestJob\"` is a string literal, which survives\n * minification intact, and the two halves agree again. `docs/jobs-and-queues.md`\n * has always called it required; before discovery an app could get away without\n * it, because the explicit `jobs` array was bundled too and both sides were\n * wrong in the same way.\n *\n * The check is exact rather than a guess: a `static name = \"...\"` class field\n * defines a *writable* own property, while the implicit class name is\n * non-writable. Cron is unaffected — `CronJob.name` is an instance field\n * holding a string literal, not the class binding.\n */\nfunction warnIfNameWillNotSurviveTheBuild(jobs: Array<new () => Job>) {\n for (const job of jobs) {\n if (Object.getOwnPropertyDescriptor(job, \"name\")?.writable) continue;\n\n console.warn(\n `Queued job ${job.name} does not declare \\`static name\\`, so it is ` +\n `registered under its class name. A production build minifies the ` +\n `class that dispatches it and renames it, while discovery reads this ` +\n `file from source and does not — so the dispatch would be dropped in ` +\n `production and nowhere else. Add: static name = \"${job.name}\";`,\n );\n }\n}\n\n/**\n * The `CronJob` subclasses under `dir`, defaulting to the config slice's\n * `app/cron`.\n *\n * This is what a `schedule` config slice with no `jobs` key resolves to. Call it\n * directly to ask the question a test used to answer by importing the array —\n * though after boot `app(Scheduler).jobs` is the better one, because it is what\n * the scheduler actually took rather than what this would find if asked again.\n *\n * Every file underneath is imported, so calling this runs the app's cron\n * modules — the cost `discoverClasses` documents at length, paid once per call.\n */\nexport async function discoverCronJobs(\n dir: string = scheduleConfigDefaults().jobsDir,\n): Promise<Array<new () => CronJob>> {\n const resolved = resolveDir(dir);\n warnIfSourceIsMissing(resolved, \"cron jobs\", \"schedule\");\n return await discoverClasses(resolved, CronJob);\n}\n\n/**\n * The `Command` subclasses under `dir`, defaulting to the config slice's\n * `app/commands`.\n *\n * This is what a `commands`-less `command` slice resolves to, and what\n * `gemi run` lists. Unlike the two above it is not called during boot — a\n * command registry has one consumer, and importing every file under\n * `app/commands` into every server process would be a cost paid on every start\n * for code no request reaches.\n *\n * Every file underneath is imported, so calling this runs the app's command\n * modules — the cost `discoverClasses` documents at length, paid once per call.\n */\nexport async function discoverCommands(\n dir: string = commandConfigDefaults().commandsDir,\n): Promise<CommandClass[]> {\n const resolved = resolveDir(dir);\n warnIfSourceIsMissing(resolved, \"commands\", \"command\");\n\n const unfinished: string[] = [];\n\n const commands = await discoverClasses(\n resolved,\n Command,\n [],\n (value, file) => {\n if (isUnfinishedBuilder(value)) unfinished.push(file);\n },\n );\n\n refuseUnfinishedBuilders(unfinished);\n\n return commands as CommandClass[];\n}\n\n/**\n * Stops the walk for a builder chain that was never finished.\n *\n * This is the one silence the builder introduces, and it is the exact shape\n * #322 and #323 exist to remove. `defineCommand(...).arg(...)` without a\n * trailing `.handle(...)` is a plain object rather than a class, so\n * `discoverClasses` discards it along with every constant and helper a command\n * file happens to export — and the command disappears from `gemi run` with\n * nothing raised. The author sees a listing containing every command except the\n * one they just wrote.\n *\n * A throw rather than a warning, because there is no reading of an unfinished\n * builder under which the author meant it: the chain builds a description of a\n * command and then discards it.\n *\n * \"Unfinished\" is decided by `.handle()` clearing the brand, not by the export\n * still being a builder object. Those differ for the natural way to share\n * declarations —\n *\n * export const base = defineCommand(\"reindex\").option(\"verbose\", …);\n * export default base.handle(async () => {});\n *\n * — where `base` is a builder that *did* produce a command. Keying off the shape\n * alone made that file abort the whole of `gemi run`, taking every other command\n * in the project down with it, under a message that was untrue for it.\n */\nfunction refuseUnfinishedBuilders(files: string[]): void {\n if (files.length === 0) return;\n\n const subject =\n files.length === 1\n ? `${files[0]} exports a command builder that never called \\`.handle()\\``\n : `${files.length} files export a command builder that never called ` +\n `\\`.handle()\\`:\\n ${files.join(\"\\n \")}`;\n\n throw new DiscoveryError(\n `${subject}, so there is no command to run. \\`.handle()\\` is what turns ` +\n `the chain into a command — finish it:\\n\\n` +\n ` export default defineCommand(\"my-command\")\\n` +\n ` .handle(async ({ line }) => { line(\"hello\") })`,\n );\n}\n"
|
|
14
|
+
],
|
|
15
|
+
"mappings": ";uJA+CO,GAAS,LAAiB,CAAC,EAAkC,CAClE,OAAO,EAGF,SAAS,CAAmB,EAA0B,CAC3D,MAAO,CACL,KAAM,CAAC,EACP,QAAS,WACT,YAAa,CACf,EC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AK,CAAI,EAExD,EAIA,OAFA,EAAyB,CAAU,EAE5B,EA6BT,SAAS,CAAwB,CAAC,EAAuB,CACvD,GAAI,EAAM,SAAW,EAAG,OAExB,IAAM,EACJ,EAAM,SAAW,EACb,GAAG,EAAM,+DACT,GAAG,EAAM;AAAA,MACc,EAAM,KAAK;AAAA,KAAQ,IAEhD,MAAM,IAAI,EACR,GAAG,iEACD;AAAA;AAAA,EACA;AAAA,qDAEJ",
|
|
16
|
+
"debugId": "D1A465A9DBBC085B64756E2164756E21",
|
|
17
|
+
"names": []
|
|
18
|
+
}
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import type { Application } from \"../foundation/Application\";\n\n/**\n * Both hooks default to no-ops. `register()` binds services into the container\n * and must not resolve any of them; `boot()` runs after every provider has\n * registered, so it may resolve freely.\n */\nexport abstract class ServiceProvider {\n constructor(protected app: Application) {}\n\n register(): void {}\n\n boot(): void | Promise<void> {}\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AAOO,MAAe,CAAgB,CACd,IAAtB,WAAW,CAAW,EAAkB,CAAlB,WAEtB,QAAQ,EAAS,EAEjB,IAAI,EAAyB,EAC/B",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "655094B3589CAB3764756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{A as
|
|
2
|
+
import{Qe as h}from"./chunk-0h3jr9d9.js";var A=h((f)=>{f.HttpAuthLocation=void 0;(function(t){t.HEADER="header",t.QUERY="query"})(f.HttpAuthLocation||(f.HttpAuthLocation={}));f.HttpApiKeyAuthLocation=void 0;(function(t){t.HEADER="header",t.QUERY="query"})(f.HttpApiKeyAuthLocation||(f.HttpApiKeyAuthLocation={}));f.EndpointURLScheme=void 0;(function(t){t.HTTP="http",t.HTTPS="https"})(f.EndpointURLScheme||(f.EndpointURLScheme={}));f.AlgorithmId=void 0;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(f.AlgorithmId||(f.AlgorithmId={}));var x=(t)=>{let o=[];if(t.sha256!==void 0)o.push({algorithmId:()=>f.AlgorithmId.SHA256,checksumConstructor:()=>t.sha256});if(t.md5!=null)o.push({algorithmId:()=>f.AlgorithmId.MD5,checksumConstructor:()=>t.md5});return{addChecksumAlgorithm(s){o.push(s)},checksumAlgorithms(){return o}}},d=(t)=>{let o={};return t.checksumAlgorithms().forEach((s)=>{o[s.algorithmId()]=s.checksumConstructor()}),o},a=(t)=>{return x(t)},E=(t)=>{return d(t)};f.FieldPosition=void 0;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(f.FieldPosition||(f.FieldPosition={}));var m="__smithy_context";f.IniSectionType=void 0;(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(f.IniSectionType||(f.IniSectionType={}));f.RequestHandlerProtocol=void 0;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(f.RequestHandlerProtocol||(f.RequestHandlerProtocol={}));f.SMITHY_CONTEXT_KEY=m;f.getDefaultClientConfiguration=a;f.resolveDefaultRuntimeConfig=E});
|
|
3
|
+
export{A as Ja};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=83DCF0CC9F5E23E064756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"'use strict';\n\nexports.HttpAuthLocation = void 0;\n(function (HttpAuthLocation) {\n HttpAuthLocation[\"HEADER\"] = \"header\";\n HttpAuthLocation[\"QUERY\"] = \"query\";\n})(exports.HttpAuthLocation || (exports.HttpAuthLocation = {}));\n\nexports.HttpApiKeyAuthLocation = void 0;\n(function (HttpApiKeyAuthLocation) {\n HttpApiKeyAuthLocation[\"HEADER\"] = \"header\";\n HttpApiKeyAuthLocation[\"QUERY\"] = \"query\";\n})(exports.HttpApiKeyAuthLocation || (exports.HttpApiKeyAuthLocation = {}));\n\nexports.EndpointURLScheme = void 0;\n(function (EndpointURLScheme) {\n EndpointURLScheme[\"HTTP\"] = \"http\";\n EndpointURLScheme[\"HTTPS\"] = \"https\";\n})(exports.EndpointURLScheme || (exports.EndpointURLScheme = {}));\n\nexports.AlgorithmId = void 0;\n(function (AlgorithmId) {\n AlgorithmId[\"MD5\"] = \"md5\";\n AlgorithmId[\"CRC32\"] = \"crc32\";\n AlgorithmId[\"CRC32C\"] = \"crc32c\";\n AlgorithmId[\"SHA1\"] = \"sha1\";\n AlgorithmId[\"SHA256\"] = \"sha256\";\n})(exports.AlgorithmId || (exports.AlgorithmId = {}));\nconst getChecksumConfiguration = (runtimeConfig) => {\n const checksumAlgorithms = [];\n if (runtimeConfig.sha256 !== undefined) {\n checksumAlgorithms.push({\n algorithmId: () => exports.AlgorithmId.SHA256,\n checksumConstructor: () => runtimeConfig.sha256,\n });\n }\n if (runtimeConfig.md5 != undefined) {\n checksumAlgorithms.push({\n algorithmId: () => exports.AlgorithmId.MD5,\n checksumConstructor: () => runtimeConfig.md5,\n });\n }\n return {\n addChecksumAlgorithm(algo) {\n checksumAlgorithms.push(algo);\n },\n checksumAlgorithms() {\n return checksumAlgorithms;\n },\n };\n};\nconst resolveChecksumRuntimeConfig = (clientConfig) => {\n const runtimeConfig = {};\n clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => {\n runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor();\n });\n return runtimeConfig;\n};\n\nconst getDefaultClientConfiguration = (runtimeConfig) => {\n return getChecksumConfiguration(runtimeConfig);\n};\nconst resolveDefaultRuntimeConfig = (config) => {\n return resolveChecksumRuntimeConfig(config);\n};\n\nexports.FieldPosition = void 0;\n(function (FieldPosition) {\n FieldPosition[FieldPosition[\"HEADER\"] = 0] = \"HEADER\";\n FieldPosition[FieldPosition[\"TRAILER\"] = 1] = \"TRAILER\";\n})(exports.FieldPosition || (exports.FieldPosition = {}));\n\nconst SMITHY_CONTEXT_KEY = \"__smithy_context\";\n\nexports.IniSectionType = void 0;\n(function (IniSectionType) {\n IniSectionType[\"PROFILE\"] = \"profile\";\n IniSectionType[\"SSO_SESSION\"] = \"sso-session\";\n IniSectionType[\"SERVICES\"] = \"services\";\n})(exports.IniSectionType || (exports.IniSectionType = {}));\n\nexports.RequestHandlerProtocol = void 0;\n(function (RequestHandlerProtocol) {\n RequestHandlerProtocol[\"HTTP_0_9\"] = \"http/0.9\";\n RequestHandlerProtocol[\"HTTP_1_0\"] = \"http/1.0\";\n RequestHandlerProtocol[\"TDS_8_0\"] = \"tds/8.0\";\n})(exports.RequestHandlerProtocol || (exports.RequestHandlerProtocol = {}));\n\nexports.SMITHY_CONTEXT_KEY = SMITHY_CONTEXT_KEY;\nexports.getDefaultClientConfiguration = getDefaultClientConfiguration;\nexports.resolveDefaultRuntimeConfig = resolveDefaultRuntimeConfig;\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";uDAEQ,mBAAwB,QAC/B,QAAS,CAAC,EAAkB,CACzB,EAAiB,OAAY,SAC7B,EAAiB,MAAW,UACrB,qBAA6B,mBAAmB,CAAC,EAAE,EAEtD,yBAA8B,QACrC,QAAS,CAAC,EAAwB,CAC/B,EAAuB,OAAY,SACnC,EAAuB,MAAW,UAC3B,2BAAmC,yBAAyB,CAAC,EAAE,EAElE,oBAAyB,QAChC,QAAS,CAAC,EAAmB,CAC1B,EAAkB,KAAU,OAC5B,EAAkB,MAAW,UACtB,sBAA8B,oBAAoB,CAAC,EAAE,EAExD,cAAmB,QAC1B,QAAS,CAAC,EAAa,CACpB,EAAY,IAAS,MACrB,EAAY,MAAW,QACvB,EAAY,OAAY,SACxB,EAAY,KAAU,OACtB,EAAY,OAAY,WACjB,gBAAwB,cAAc,CAAC,EAAE,EACpD,IAAM,EAA2B,CAAC,IAAkB,CAChD,IAAM,EAAqB,CAAC,EAC5B,GAAI,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