gemi 0.112.0 → 0.113.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/index.js +2 -2
- package/dist/ai/index.js.map +1 -1
- package/dist/app/index.js +1 -1
- package/dist/auth/AuthController.d.ts +19 -2
- package/dist/auth/AuthController.d.ts.map +1 -1
- package/dist/auth/config.d.ts +9 -0
- package/dist/auth/config.d.ts.map +1 -1
- package/dist/auth/oauth/GoogleOAuthProvider.d.ts +16 -17
- package/dist/auth/oauth/GoogleOAuthProvider.d.ts.map +1 -1
- package/dist/auth/oauth/OAuthProvider.d.ts +56 -7
- package/dist/auth/oauth/OAuthProvider.d.ts.map +1 -1
- package/dist/auth/oauth/XOAuthProvider.d.ts +10 -9
- package/dist/auth/oauth/XOAuthProvider.d.ts.map +1 -1
- package/dist/auth/oauth/oauthState.d.ts +70 -0
- package/dist/auth/oauth/oauthState.d.ts.map +1 -0
- package/dist/auth/routes.d.ts +3 -2
- package/dist/auth/routes.d.ts.map +1 -1
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-jdtn0zk2.js → chunk-01qd6xx3.js} +3 -3
- package/dist/{chunk-jdtn0zk2.js.map → chunk-01qd6xx3.js.map} +1 -1
- package/dist/{chunk-15a1mrdv.js → chunk-1p85fdrk.js} +2 -2
- package/dist/{chunk-15a1mrdv.js.map → chunk-1p85fdrk.js.map} +1 -1
- package/dist/{chunk-qyp652jz.js → chunk-1se4t9rg.js} +3 -3
- package/dist/{chunk-qyp652jz.js.map → chunk-1se4t9rg.js.map} +1 -1
- package/dist/{chunk-b7cqwcbm.js → chunk-3f1kq32g.js} +2 -2
- package/dist/{chunk-b7cqwcbm.js.map → chunk-3f1kq32g.js.map} +1 -1
- package/dist/{chunk-57edag57.js → chunk-4t1pbt9p.js} +3 -3
- package/dist/{chunk-57edag57.js.map → chunk-4t1pbt9p.js.map} +1 -1
- package/dist/{chunk-851k0b26.js → chunk-4tp2cr02.js} +2 -2
- package/dist/{chunk-851k0b26.js.map → chunk-4tp2cr02.js.map} +1 -1
- package/dist/{chunk-a9q2cr4w.js → chunk-571rvxe6.js} +2 -2
- package/dist/{chunk-a9q2cr4w.js.map → chunk-571rvxe6.js.map} +1 -1
- package/dist/{chunk-mx9y9mtx.js → chunk-5nqkwa2w.js} +1 -1
- package/dist/{chunk-d0trs736.js → chunk-5q4a7yqf.js} +2 -2
- package/dist/{chunk-d0trs736.js.map → chunk-5q4a7yqf.js.map} +1 -1
- package/dist/{chunk-dan79jab.js → chunk-5x0aacrn.js} +2 -2
- package/dist/{chunk-dan79jab.js.map → chunk-5x0aacrn.js.map} +1 -1
- package/dist/{chunk-bf1ets45.js → chunk-5zzhypmt.js} +2 -2
- package/dist/{chunk-bf1ets45.js.map → chunk-5zzhypmt.js.map} +1 -1
- package/dist/{chunk-18c3y8m3.js → chunk-68s1f5d5.js} +2 -2
- package/dist/{chunk-18c3y8m3.js.map → chunk-68s1f5d5.js.map} +1 -1
- package/dist/chunk-6g20zec2.js +46 -0
- package/dist/{chunk-4sb1484x.js.map → chunk-6g20zec2.js.map} +7 -5
- package/dist/{chunk-csbc1fxa.js → chunk-6wymbbes.js} +3 -3
- package/dist/{chunk-csbc1fxa.js.map → chunk-6wymbbes.js.map} +1 -1
- package/dist/{chunk-b7qjp7r1.js → chunk-7jnpnjth.js} +2 -2
- package/dist/{chunk-b7qjp7r1.js.map → chunk-7jnpnjth.js.map} +1 -1
- package/dist/{chunk-ddad3902.js → chunk-8mbyyh8j.js} +2 -2
- package/dist/{chunk-ddad3902.js.map → chunk-8mbyyh8j.js.map} +1 -1
- package/dist/{chunk-dx7wpz5b.js → chunk-9tpx9ag3.js} +2 -2
- package/dist/{chunk-dx7wpz5b.js.map → chunk-9tpx9ag3.js.map} +1 -1
- package/dist/{chunk-beks65me.js → chunk-9vsj0ksk.js} +2 -2
- package/dist/{chunk-beks65me.js.map → chunk-9vsj0ksk.js.map} +1 -1
- package/dist/{chunk-rx2shb3t.js → chunk-agw3anaf.js} +1 -1
- package/dist/{chunk-sj8jp4p9.js → chunk-atmzm0z3.js} +2 -2
- package/dist/{chunk-sj8jp4p9.js.map → chunk-atmzm0z3.js.map} +1 -1
- package/dist/{chunk-es487acc.js → chunk-bq5nqqeq.js} +1 -1
- package/dist/{chunk-b1mk12xg.js → chunk-c7mp2kyp.js} +2 -2
- package/dist/{chunk-b1mk12xg.js.map → chunk-c7mp2kyp.js.map} +1 -1
- package/dist/{chunk-j0sncgxc.js → chunk-cqnfp0n9.js} +3 -3
- package/dist/{chunk-j0sncgxc.js.map → chunk-cqnfp0n9.js.map} +1 -1
- package/dist/{chunk-kk502yk2.js → chunk-d04r0hdf.js} +2 -2
- package/dist/{chunk-kk502yk2.js.map → chunk-d04r0hdf.js.map} +1 -1
- package/dist/{chunk-2taa0brj.js → chunk-dbwhgyg3.js} +2 -2
- package/dist/{chunk-2taa0brj.js.map → chunk-dbwhgyg3.js.map} +1 -1
- package/dist/{chunk-nv7mv51r.js → chunk-de03dewf.js} +2 -2
- package/dist/{chunk-nv7mv51r.js.map → chunk-de03dewf.js.map} +1 -1
- package/dist/{chunk-qtbf3w6w.js → chunk-essqp1ek.js} +2 -2
- package/dist/{chunk-qtbf3w6w.js.map → chunk-essqp1ek.js.map} +1 -1
- package/dist/{chunk-5waxjsvv.js → chunk-fnkjmq94.js} +2 -2
- package/dist/{chunk-5waxjsvv.js.map → chunk-fnkjmq94.js.map} +1 -1
- package/dist/{chunk-8reepafh.js → chunk-fr0arqdj.js} +2 -2
- package/dist/{chunk-8reepafh.js.map → chunk-fr0arqdj.js.map} +1 -1
- package/dist/chunk-fsfbyg5e.js +5 -0
- package/dist/{chunk-d9an2nra.js.map → chunk-fsfbyg5e.js.map} +1 -1
- package/dist/{chunk-ga7c7tq0.js → chunk-g8kx549d.js} +2 -2
- package/dist/{chunk-ga7c7tq0.js.map → chunk-g8kx549d.js.map} +1 -1
- package/dist/{chunk-xs4c2nvz.js → chunk-g8sc6scv.js} +2 -2
- package/dist/{chunk-xs4c2nvz.js.map → chunk-g8sc6scv.js.map} +1 -1
- package/dist/{chunk-75ptmewf.js → chunk-k2fh4r0p.js} +2 -2
- package/dist/{chunk-75ptmewf.js.map → chunk-k2fh4r0p.js.map} +1 -1
- package/dist/{chunk-wexs11yy.js → chunk-kexsfyjj.js} +2 -2
- package/dist/{chunk-wexs11yy.js.map → chunk-kexsfyjj.js.map} +1 -1
- package/dist/{chunk-ryzcfxq7.js → chunk-kp7k4s5c.js} +2 -2
- package/dist/{chunk-ryzcfxq7.js.map → chunk-kp7k4s5c.js.map} +1 -1
- package/dist/{chunk-tmrmwthr.js → chunk-kz4yp5n7.js} +2 -2
- package/dist/{chunk-tmrmwthr.js.map → chunk-kz4yp5n7.js.map} +1 -1
- package/dist/{chunk-j9jqxv1d.js → chunk-mepaedy5.js} +2 -2
- package/dist/{chunk-j9jqxv1d.js.map → chunk-mepaedy5.js.map} +1 -1
- package/dist/{chunk-scbvv2e4.js → chunk-mk0rtgd1.js} +2 -2
- package/dist/{chunk-scbvv2e4.js.map → chunk-mk0rtgd1.js.map} +1 -1
- package/dist/{chunk-mvtgx1mr.js → chunk-nksn6xcd.js} +2 -2
- package/dist/{chunk-mvtgx1mr.js.map → chunk-nksn6xcd.js.map} +1 -1
- package/dist/{chunk-s9rfgxj5.js → chunk-nysqgzp1.js} +2 -2
- package/dist/{chunk-s9rfgxj5.js.map → chunk-nysqgzp1.js.map} +1 -1
- package/dist/{chunk-5az0mq4p.js → chunk-p3zmc8k8.js} +2 -2
- package/dist/{chunk-5az0mq4p.js.map → chunk-p3zmc8k8.js.map} +1 -1
- package/dist/{chunk-9hr0bcfy.js → chunk-qpttgn4k.js} +3 -3
- package/dist/{chunk-9hr0bcfy.js.map → chunk-qpttgn4k.js.map} +1 -1
- package/dist/{chunk-bhw7k8vp.js → chunk-qt8nvpqp.js} +2 -2
- package/dist/{chunk-bhw7k8vp.js.map → chunk-qt8nvpqp.js.map} +1 -1
- package/dist/{chunk-teny6xkw.js → chunk-r7b12dmm.js} +2 -2
- package/dist/{chunk-teny6xkw.js.map → chunk-r7b12dmm.js.map} +1 -1
- package/dist/{chunk-amvy4r59.js → chunk-rg4hhxj3.js} +2 -2
- package/dist/{chunk-amvy4r59.js.map → chunk-rg4hhxj3.js.map} +1 -1
- package/dist/{chunk-53bek7sp.js → chunk-rh2fad7n.js} +1 -1
- package/dist/{chunk-xv74rhay.js → chunk-sr18y2ck.js} +2 -2
- package/dist/{chunk-xv74rhay.js.map → chunk-sr18y2ck.js.map} +1 -1
- package/dist/{chunk-vgdcz7tk.js → chunk-szr1k584.js} +2 -2
- package/dist/{chunk-vgdcz7tk.js.map → chunk-szr1k584.js.map} +1 -1
- package/dist/{chunk-dm59ze55.js → chunk-v4gwmhtf.js} +2 -2
- package/dist/{chunk-dm59ze55.js.map → chunk-v4gwmhtf.js.map} +1 -1
- package/dist/{chunk-et3vhkbf.js → chunk-vc9phr57.js} +2 -2
- package/dist/{chunk-et3vhkbf.js.map → chunk-vc9phr57.js.map} +1 -1
- package/dist/{chunk-30yg31sz.js → chunk-vdwagp7y.js} +2 -2
- package/dist/{chunk-30yg31sz.js.map → chunk-vdwagp7y.js.map} +1 -1
- package/dist/{chunk-6w79zajj.js → chunk-vqa3agzw.js} +3 -3
- package/dist/{chunk-6w79zajj.js.map → chunk-vqa3agzw.js.map} +1 -1
- package/dist/{chunk-jn59bsww.js → chunk-vwprq300.js} +2 -2
- package/dist/{chunk-jn59bsww.js.map → chunk-vwprq300.js.map} +1 -1
- package/dist/{chunk-0z2h35d7.js → chunk-vzf5pbx3.js} +2 -2
- package/dist/{chunk-0z2h35d7.js.map → chunk-vzf5pbx3.js.map} +1 -1
- package/dist/{chunk-1pvkw2pq.js → chunk-w45agtch.js} +2 -2
- package/dist/{chunk-1pvkw2pq.js.map → chunk-w45agtch.js.map} +1 -1
- package/dist/{chunk-ck0v2kzw.js → chunk-wr3e4sez.js} +2 -2
- package/dist/{chunk-ck0v2kzw.js.map → chunk-wr3e4sez.js.map} +1 -1
- package/dist/{chunk-mrdarm2q.js → chunk-x5sert1k.js} +2 -2
- package/dist/{chunk-mrdarm2q.js.map → chunk-x5sert1k.js.map} +1 -1
- package/dist/{chunk-d8ekyng4.js → chunk-x5yq097b.js} +2 -2
- package/dist/{chunk-d8ekyng4.js.map → chunk-x5yq097b.js.map} +1 -1
- package/dist/{chunk-p2fhtf5r.js → chunk-xqwdn9kb.js} +3 -3
- package/dist/{chunk-p2fhtf5r.js.map → chunk-xqwdn9kb.js.map} +1 -1
- package/dist/{chunk-yv1psptb.js → chunk-y596ghpz.js} +2 -2
- package/dist/{chunk-yv1psptb.js.map → chunk-y596ghpz.js.map} +1 -1
- package/dist/{chunk-rend2sbk.js → chunk-y6frz1vm.js} +1 -1
- package/dist/{chunk-hfyxvdjj.js → chunk-y6v0x869.js} +2 -2
- package/dist/{chunk-hfyxvdjj.js.map → chunk-y6v0x869.js.map} +1 -1
- package/dist/{chunk-gcs9ydjv.js → chunk-yyzexrnb.js} +2 -2
- package/dist/{chunk-gcs9ydjv.js.map → chunk-yyzexrnb.js.map} +1 -1
- package/dist/{chunk-eazqda9z.js → chunk-z5hrymvn.js} +3 -3
- package/dist/{chunk-eazqda9z.js.map → chunk-z5hrymvn.js.map} +1 -1
- package/dist/{chunk-cptzbdn6.js → chunk-zng3qexn.js} +2 -2
- package/dist/{chunk-cptzbdn6.js.map → chunk-zng3qexn.js.map} +1 -1
- package/dist/{chunk-zfter1x0.js → chunk-zyer1g7k.js} +4 -4
- package/dist/{chunk-zfter1x0.js.map → chunk-zyer1g7k.js.map} +1 -1
- package/dist/client/ClientRouter.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/console/run.js +2 -2
- package/dist/console/run.js.map +1 -1
- package/dist/container/index.js +2 -2
- package/dist/container/index.js.map +1 -1
- package/dist/database/index.js +2 -2
- package/dist/database/index.js.map +1 -1
- package/dist/email/index.js +2 -2
- package/dist/email/index.js.map +1 -1
- package/dist/facades/index.js +2 -2
- package/dist/facades/index.js.map +1 -1
- package/dist/foundation/index.js +2 -2
- package/dist/foundation/index.js.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/i18n/dictionaryRuntime.js +2 -2
- package/dist/i18n/dictionaryRuntime.js.map +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +1 -1
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +1 -1
- package/dist/orm/index.js +2 -2
- package/dist/orm/index.js.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/index.d.ts +2 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +8 -8
- package/dist/services/index.js.map +5 -6
- package/dist/services/queue/work.js +2 -2
- package/dist/services/queue/work.js.map +1 -1
- package/dist/stats/route-table.js +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/vitest/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4sb1484x.js +0 -46
- package/dist/chunk-d9an2nra.js +0 -5
- /package/dist/{chunk-mx9y9mtx.js.map → chunk-5nqkwa2w.js.map} +0 -0
- /package/dist/{chunk-rx2shb3t.js.map → chunk-agw3anaf.js.map} +0 -0
- /package/dist/{chunk-es487acc.js.map → chunk-bq5nqqeq.js.map} +0 -0
- /package/dist/{chunk-53bek7sp.js.map → chunk-rh2fad7n.js.map} +0 -0
- /package/dist/{chunk-rend2sbk.js.map → chunk-y6frz1vm.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Vh as y}from"./chunk-8mbyyh8j.js";var v=y((x)=>{class s extends Error{name="ProviderError";tryNextLink;constructor(r,t=!0){let n,e=!0;if(typeof t==="boolean")n=void 0,e=t;else if(t!=null&&typeof t==="object")n=t.logger,e=t.tryNextLink??!0;super(r);this.tryNextLink=e,Object.setPrototypeOf(this,s.prototype),n?.debug?.(`@smithy/property-provider ${e?"->":"(!)"} ${r}`)}static from(r,t=!0){return Object.assign(new this(r.message,t),r)}}class f extends s{name="CredentialsProviderError";constructor(r,t=!0){super(r,t);Object.setPrototypeOf(this,f.prototype)}}class l extends s{name="TokenProviderError";constructor(r,t=!0){super(r,t);Object.setPrototypeOf(this,l.prototype)}}var p=(...r)=>async()=>{if(r.length===0)throw new s("No providers in chain");let t;for(let n of r)try{return await n()}catch(e){if(t=e,e?.tryNextLink)continue;throw e}throw t},d=(r)=>()=>Promise.resolve(r),h=(r,t,n)=>{let e,o,i,c=!1,a=async()=>{if(!o)o=r();try{e=await o,i=!0,c=!1}finally{o=void 0}return e};if(t===void 0)return async(u)=>{if(!i||u?.forceRefresh)e=await a();return e};return async(u)=>{if(!i||u?.forceRefresh)e=await a();if(c)return e;if(n&&!n(e))return c=!0,e;if(t(e))return await a(),e;return e}};x.CredentialsProviderError=f;x.ProviderError=s;x.TokenProviderError=l;x.chain=p;x.fromStatic=d;x.memoize=h});
|
|
3
3
|
export{v as aa};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=17A4F7F814F90CCF64756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"'use strict';\n\nclass ProviderError extends Error {\n name = \"ProviderError\";\n tryNextLink;\n constructor(message, options = true) {\n let logger;\n let tryNextLink = true;\n if (typeof options === \"boolean\") {\n logger = undefined;\n tryNextLink = options;\n }\n else if (options != null && typeof options === \"object\") {\n logger = options.logger;\n tryNextLink = options.tryNextLink ?? true;\n }\n super(message);\n this.tryNextLink = tryNextLink;\n Object.setPrototypeOf(this, ProviderError.prototype);\n logger?.debug?.(`@smithy/property-provider ${tryNextLink ? \"->\" : \"(!)\"} ${message}`);\n }\n static from(error, options = true) {\n return Object.assign(new this(error.message, options), error);\n }\n}\n\nclass CredentialsProviderError extends ProviderError {\n name = \"CredentialsProviderError\";\n constructor(message, options = true) {\n super(message, options);\n Object.setPrototypeOf(this, CredentialsProviderError.prototype);\n }\n}\n\nclass TokenProviderError extends ProviderError {\n name = \"TokenProviderError\";\n constructor(message, options = true) {\n super(message, options);\n Object.setPrototypeOf(this, TokenProviderError.prototype);\n }\n}\n\nconst chain = (...providers) => async () => {\n if (providers.length === 0) {\n throw new ProviderError(\"No providers in chain\");\n }\n let lastProviderError;\n for (const provider of providers) {\n try {\n const credentials = await provider();\n return credentials;\n }\n catch (err) {\n lastProviderError = err;\n if (err?.tryNextLink) {\n continue;\n }\n throw err;\n }\n }\n throw lastProviderError;\n};\n\nconst fromStatic = (staticValue) => () => Promise.resolve(staticValue);\n\nconst memoize = (provider, isExpired, requiresRefresh) => {\n let resolved;\n let pending;\n let hasResult;\n let isConstant = false;\n const coalesceProvider = async () => {\n if (!pending) {\n pending = provider();\n }\n try {\n resolved = await pending;\n hasResult = true;\n isConstant = false;\n }\n finally {\n pending = undefined;\n }\n return resolved;\n };\n if (isExpired === undefined) {\n return async (options) => {\n if (!hasResult || options?.forceRefresh) {\n resolved = await coalesceProvider();\n }\n return resolved;\n };\n }\n return async (options) => {\n if (!hasResult || options?.forceRefresh) {\n resolved = await coalesceProvider();\n }\n if (isConstant) {\n return resolved;\n }\n if (requiresRefresh && !requiresRefresh(resolved)) {\n isConstant = true;\n return resolved;\n }\n if (isExpired(resolved)) {\n await coalesceProvider();\n return resolved;\n }\n return resolved;\n };\n};\n\nexports.CredentialsProviderError = CredentialsProviderError;\nexports.ProviderError = ProviderError;\nexports.TokenProviderError = TokenProviderError;\nexports.chain = chain;\nexports.fromStatic = fromStatic;\nexports.memoize = memoize;\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";uDAEA,MAAM,UAAsB,KAAM,CAC9B,KAAO,gBACP,YACA,WAAW,CAAC,EAAS,EAAU,GAAM,CACjC,IAAI,EACA,EAAc,GAClB,GAAI,OAAO,IAAY,UACn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O,GAGf,MAAO,OAAO,IAAY,CACtB,GAAI,CAAC,GAAa,GAAS,aACvB,EAAW,MAAM,EAAiB,EAEtC,GAAI,EACA,OAAO,EAEX,GAAI,GAAmB,CAAC,EAAgB,CAAQ,EAE5C,OADA,EAAa,GACN,EAEX,GAAI,EAAU,CAAQ,EAElB,OADA,MAAM,EAAiB,EAChB,EAEX,OAAO,IAIP,2BAA2B,EAC3B,gBAAgB,EAChB,qBAAqB,EACrB,QAAQ,EACR,aAAa,EACb,UAAU",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "17A4F7F814F90CCF64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Wg as X,bh as K,eh as W}from"./chunk-vwprq300.js";import{AsyncLocalStorage as S}from"async_hooks";var z=new S;function g(){return z.getStore()?.tx}function U(){return z.getStore()?.connection??K}function O(j,q){let v=z.getStore();if(U()===j)return q();return y(j),z.run({...v,depth:v?.depth??0,connection:j===K?void 0:j},q)}function y(j){let q=z.getStore();if(q?.tx===void 0)return;let v=q.connection??K;if(v===j)return;throw new W(v,j)}function L(j){let q=z.getStore();if(q?.tx===void 0||q.afterCommit===void 0)return!1;return q.afterCommit.push(j),!0}function h(j){if(L(j))return Promise.resolve();let q=(v)=>{console.error("An after-commit callback threw. No transaction was open, so it ran immediately.",v)};try{return Promise.resolve(j()).catch(q)}catch(v){return q(v),Promise.resolve()}}function k(j){let q=z.getStore();if(q?.tx===void 0||q.commitDependsOn===void 0)return!1;return q.commitDependsOn.push(j),!0}class F extends Error{constructor(j){super(`A statement this transaction depended on failed after being issued on it, so the transaction rolled back instead of committing: ${j instanceof Error?j.message:String(j)}`,{cause:j});this.name="TransactionDependencyError"}}async function R(j,q){if(j.length===q)return;let B=(await Promise.allSettled(j.slice(q))).find((G)=>G.status==="rejected");if(B)throw new F(B.reason)}function N(){let j=z.getStore();return j?.tx===void 0?null:j.depth}function T(){return z.getStore()?.system===!0}function x(j){let q=z.getStore();return z.run({...q,depth:q?.depth??0,system:!0},j)}function p(j){return z.getStore()?.trashed?.get(j)}function f(j,q,v){let B=z.getStore(),G=new Map(B?.trashed);return G.set(j,q),z.run({...B,depth:B?.depth??0,trashed:G},v)}function C(){return z.getStore()?.actor}function l(j,q){let v=z.getStore();return z.run({...v,depth:v?.depth??0,system:!1,actor:{user:j??null}},q)}function _(j){if(Bun.env.NODE_ENV!=="development")return null;if(j===!1)return null;if(j===void 0)return X;if(!Number.isFinite(j)||j<=0)return X;return j}function A(j){let q=_(j);if(q===null)return()=>{};let v=Error("transaction opened here"),B=setTimeout(()=>{let G=v.stack?.split(`
|
|
3
3
|
`).slice(1).join(`
|
|
4
4
|
`)??"";console.warn(`[gemi] A database transaction has not settled after ${q}ms. It `+"reserves a pooled connection until it does \u2014 check for network or "+`filesystem I/O inside the callback, and move it outside the transaction if you find any.
|
|
5
5
|
${G}
|
|
6
6
|
(development only; set database.slowTransactionThreshold to change the threshold, or false to switch this off)`)},q);return B.unref?.(),()=>clearTimeout(B)}async function D(j,q){if(j.length===0)return;await z.run({...q,tx:void 0,afterCommit:void 0,commitDependsOn:void 0,depth:q?.depth??0},async()=>{for(let v of j)try{await v()}catch(B){console.error("An after-commit callback threw. The transaction it was waiting on had already committed and stays committed, and the callbacks after it still ran.",B)}})}function u(j,q,v){let B=z.getStore(),G=v?.connection??K;if(y(G),B?.tx){let J=B.afterCommit,Q=J?.length??0,P=B.commitDependsOn,M=P?.length??0;return B.tx.savepoint((V)=>{let H=V;return z.run({...B,tx:H,depth:B.depth+1},async()=>{let I=await q(H);if(P)await R(P,M);return I})}).catch((V)=>{if(J)J.length=Q;if(P)P.length=M;throw V})}let Y=A(v?.slowTransactionThreshold),Z=[],$=[];try{return j.begin((J)=>z.run({...B,tx:J,depth:0,connection:G===K?void 0:G,afterCommit:Z,commitDependsOn:$},async()=>{let Q=await q(J);return await R($,0),Q})).finally(Y).then(async(J)=>{return await D(Z,B),J})}catch(J){throw Y(),J}}
|
|
7
|
-
export{z as
|
|
7
|
+
export{z as Dg,g as Eg,U as Fg,O as Gg,y as Hg,L as Ig,h as Jg,k as Kg,F as Lg,N as Mg,T as Ng,x as Og,p as Pg,f as Qg,C as Rg,l as Sg,u as Tg};
|
|
8
8
|
|
|
9
|
-
//# debugId=
|
|
9
|
+
//# debugId=D95A211D5158399664756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import type { SQL, TransactionSQL } from \"bun\";\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { SLOW_TRANSACTION_THRESHOLD } from \"../database/config\";\nimport {\n CrossConnectionTransactionError,\n DEFAULT_CONNECTION,\n} from \"../database/Connection\";\n\n/**\n * The ambient transaction: the ORM's own `AsyncLocalStorage`, holding nothing\n * but the open handle and how deep the nesting is.\n *\n * One store per scope with one owner, which is the pattern the framework\n * already follows — `kernel/context.ts` holds the Application,\n * `http/requestContext.ts` the request and its user. The reasoning for\n * not folding this into the kernel's is written up beside it, and the short\n * version is that a transaction scope has to *nest inside* an Application scope\n * without replacing it, and `foundation/app.ts` must keep reading exactly one\n * shape out of the kernel store or resolving a service becomes a transaction\n * concern.\n *\n * What makes an ALS the right home rather than a field somewhere: two concurrent\n * requests each in their own transaction must never see each other's handle.\n * Anything reachable from the Application — which is one object shared by every\n * in-flight request — fails that by construction, and fails it as silently\n * written data, not as an error. \"two concurrent transactions never see each\n * other's handle\" in `context.test.ts` is the test that would catch it.\n */\nexport interface OrmScope {\n /**\n * Bun's transaction handle. Every ORM statement in scope runs on it, which\n * means they all run on one reserved connection — so nothing here may issue\n * two statements concurrently. `Model.$exec` already runs its nested writes\n * and its relation reads sequentially, for exactly this reason.\n */\n tx?: TransactionSQL;\n /** 0 for the outermost transaction, 1+ for each savepoint inside it. */\n depth: number;\n /**\n * Which named connection this subtree's queries run on, and — when `tx` is\n * set — which connection the open transaction belongs to.\n *\n * Ambient rather than an argument threaded through `$exec`, for the same\n * reason the handle above is: a relation read resolves its target through the\n * registry and calls that class's `$exec`, so an argument would have to be\n * carried by every intermediate that has no interest in it, and the one that\n * forgot would silently read a nested `include` off the *other* pool. There\n * is no error that shape produces; there are just rows from the wrong place.\n *\n * `undefined` means the default connection. Kept as absent-rather-than-\n * `\"default\"` so that entering a scope on the default connection is\n * indistinguishable from not entering one, which is what makes the\n * cross-connection check below cost a comparison of two `undefined`s on every\n * application that never declares a second connection.\n */\n connection?: string;\n /**\n * Whether policies are suspended for this scope. Set only by\n * `Model.asSystem`, and never by anything ambient — the whole point is that\n * unscoped access is a decision visible at the call site, not the accidental\n * result of a missing user.\n */\n system?: boolean;\n /**\n * The user policies should scope to, when there is no request to read one\n * from. Set only by `Model.asUser`.\n *\n * A sentinel wrapper rather than the bare value, so that \"a scope was entered\n * with `null`\" stays distinguishable from \"no scope was entered\" — the two\n * mean different things under deny-by-default.\n */\n actor?: { user: unknown };\n /**\n * Work that must not happen unless this transaction commits — an event whose\n * `static afterCommit` is set, today, and nothing else.\n *\n * **Created by the outermost `withTransaction` and never by a savepoint.** A\n * savepoint's scope is a spread of its parent's (`{ ...current, tx: nested }`),\n * so the array arrives here already shared by reference with the transaction\n * that opened it — which is the behaviour wanted rather than a leak. A\n * dispatch made inside a savepoint that commits, in a transaction that then\n * rolls back, must not run: rolling back the outermost transaction discards\n * the list whole, savepoint entries included, because nothing ever drains it.\n *\n * The inverse — a savepoint that rolls back under a transaction that commits\n * — is the case sharing gets wrong on its own, and `withTransaction`'s\n * savepoint branch is where it is put right.\n *\n * Absent, rather than an empty array, on every scope that is not a\n * transaction: `runAsSystem`, `runAsUser` and `runOnConnection` spread\n * whatever they are given, so \"there is a list here\" and \"there is an open\n * transaction here\" have to stay the same question. `deferUntilCommit`\n * answers `false` when either half is missing and the caller runs the work\n * now, which is what keeps a hand-built scope carrying a `tx` — the shape\n * tests write — from swallowing a dispatch into a list nothing drains.\n */\n afterCommit?: AfterCommitCallback[];\n /**\n * Statements written on `tx` that the commit must wait for and must not\n * outlive — today, a job row the database queue driver wrote on the\n * transaction (#563), and nothing else. See `commitDependsOn`.\n *\n * Created and shared exactly as `afterCommit` is, and truncated with it\n * when a savepoint rolls back.\n */\n commitDependsOn?: Promise<unknown>[];\n /**\n * Models whose soft-delete scope (`static $softDeletes`) is lifted or\n * inverted for this async subtree, by name — set only by\n * `Model.withTrashed(fn)` / `Model.onlyTrashed(fn)`.\n *\n * Keyed by model name rather than class because a nested relation read\n * resolves its target through the registry by name, and the block has to\n * reach those reads too. A fresh map per block, never mutated, so an inner\n * block cannot leak its entry back into the enclosing one.\n */\n trashed?: ReadonlyMap<string, TrashedMode>;\n}\n\n/**\n * How a soft-deleted model's trashed rows are treated: `\"with\"` includes them,\n * `\"only\"` reads nothing else. Absent means the default — they are hidden.\n */\nexport type TrashedMode = \"with\" | \"only\";\n\n/**\n * Work deferred to a transaction's commit.\n *\n * Awaited when it is drained, and its rejection is caught there: a callback is\n * a side effect that the transaction is not waiting on and cannot be told\n * about, so the only thing left to do with a failure is report it.\n *\n * Not exported: a caller passes a lambda and never names this, and an export\n * nothing outside this file uses is what `orm/architecture.test.ts` is pointed\n * at. The declaration emit carries it along regardless, so `OrmScope` stays\n * readable from a `.d.ts`.\n */\ntype AfterCommitCallback = () => void | Promise<void>;\n\n/**\n * One ambient scope for the ORM, not one per feature.\n *\n * Transactions (iteration 5) and system access (iteration 6) are both\n * \"something is true for this async subtree and every query in it\", so they\n * share a store rather than minting a second `AsyncLocalStorage` each. The\n * inventory note in `kernel/context.ts` sets the bar for adding one; two\n * booleans-worth of ORM state does not clear it.\n */\nexport const ormContext = new AsyncLocalStorage<OrmScope>();\n\n/**\n * The open transaction, or `undefined` outside one. This is what `Model.$exec`\n * consults to decide which connection a statement runs on.\n *\n * Exported as the escape hatch for code that genuinely needs the handle — a raw\n * query that must join the surrounding transaction, say. **Do not store what it\n * returns.** Bun's handle stays callable after its `begin` resolves: queries on\n * it then run on the pooled connection, outside any transaction, and succeed.\n * Verified against both dialects, and it is the reason `Model.transaction`'s\n * callback takes no argument.\n */\nexport function currentTransaction(): TransactionSQL | undefined {\n return ormContext.getStore()?.tx;\n}\n\n/**\n * The connection every query in this scope runs on unless it names another.\n *\n * `\"default\"` outside any scope, so callers get a name rather than a\n * `string | undefined` to normalise themselves — the store keeps it absent,\n * which is not the same distinction and is nobody else's business.\n */\nexport function currentConnectionName(): string {\n return ormContext.getStore()?.connection ?? DEFAULT_CONNECTION;\n}\n\n/**\n * Run `fn` with `name` as the ambient connection.\n *\n * Merged into the current scope rather than replacing it, exactly as\n * `runAsSystem` and `runAsUser` are: naming a connection must not drop an open\n * transaction handle or re-enable policies underneath it.\n *\n * Deliberately absent from `orm/index.ts`, so it is not part of what an\n * application can reach — `Model.on(name)` and `DB.connection(name)` are the\n * two doors, and both funnel through here so that a nested relation read,\n * which resolves its own class out of the registry and calls its `$exec`,\n * inherits the connection without anything having to pass it along.\n */\nexport function runOnConnection<T>(\n name: string,\n fn: () => Promise<T>,\n): Promise<T> {\n const current = ormContext.getStore();\n if (currentConnectionName() === name) return fn();\n\n // ENTERING A CONNECTION IS WHERE THE CROSS-CONNECTION CHECK BELONGS, not at\n // each door — and it has to be *here*, before the scope is entered, because\n // entering it is what makes the check impossible afterwards.\n //\n // The scope carries `tx` and `connection` together, so overwriting the name\n // while an open handle stays in place produces a store that says \"a\n // transaction on analytics\" while holding the *default* connection's handle.\n // Every check downstream then agrees with itself and the statement runs on\n // the wrong connection's transaction. `Model.save` found this: it routes to\n // the row's own connection, so it is the one caller that switches connections\n // with a transaction already open.\n assertConnectionUsable(name);\n\n return ormContext.run(\n {\n ...current,\n depth: current?.depth ?? 0,\n connection: name === DEFAULT_CONNECTION ? undefined : name,\n },\n fn,\n );\n}\n\n/**\n * Refuse a statement that names one connection while a transaction is open on\n * another.\n *\n * The check `withTransaction`'s single-connection note asked for, and the\n * reasoning for refusing rather than routing is on\n * `CrossConnectionTransactionError`. Both doors call it — `Model.$exec` for\n * every model operation, `DB` for a raw fragment — because either one alone\n * leaves the other free to straddle the two connections, and a raw `DB.execute`\n * escaping a transaction is the more damaging of the two.\n *\n * Only ever fires on a query that *names* a connection: an unqualified one\n * resolves to the ambient name, which is the transaction's own.\n */\nexport function assertConnectionUsable(name: string): void {\n const store = ormContext.getStore();\n if (store?.tx === undefined) return;\n\n const open = store.connection ?? DEFAULT_CONNECTION;\n if (open === name) return;\n\n throw new CrossConnectionTransactionError(open, name);\n}\n\n/**\n * Hold `callback` until the open transaction commits, and say whether that\n * happened.\n *\n * `false` means there was nothing to wait for — no transaction is open, or the\n * scope was entered by hand rather than by `withTransaction` — and the caller\n * must run the work itself, now. That return value is the whole contract: a\n * caller that ignores it turns \"no transaction here\" into a side effect queued\n * on a list nothing will ever drain, which is a dispatch that silently never\n * happens.\n *\n * `true` means the callback is on the outermost scope's list and will run after\n * `begin` resolves, outside the transaction, whatever the caller does next. It\n * will not run at all if the transaction rolls back, or if a savepoint it was\n * registered inside rolls back — both of which are the point.\n *\n * Nothing here is ordered against anything but the other deferred callbacks:\n * they run in registration order, one at a time, after the commit round-trip.\n */\nexport function deferUntilCommit(callback: AfterCommitCallback): boolean {\n const store = ormContext.getStore();\n if (store?.tx === undefined || store.afterCommit === undefined) return false;\n\n store.afterCommit.push(callback);\n return true;\n}\n\n/**\n * Run `callback` once the open transaction commits, or now when none is open.\n * Never when the transaction rolls back, nor when a savepoint it was\n * registered inside rolls back.\n *\n * The application-facing form of `deferUntilCommit`, exported from `gemi/orm`\n * (#786). The difference is the `false` branch: `deferUntilCommit` hands the\n * \"no transaction\" case back to the caller, who must remember to run the work\n * itself, and this runs it. A caller that wants a side effect only once its\n * writes are durable — waking a long-poll, notifying another process — has\n * nothing left to get wrong.\n *\n * Inside a transaction the callback joins the same list `static afterCommit`\n * events use, so it is drained after `begin` resolves, outside the\n * transaction, in registration order with them.\n *\n * The returned promise resolves once the callback has run (no transaction) or\n * been queued (inside one). It never rejects: a callback that throws is\n * reported on stderr, as a deferred one is at the drain, so a caller that does\n * not await — the usual case — cannot leave an unhandled rejection behind, and\n * the two branches fail the same way. A sync callback outside a transaction\n * runs before this returns.\n */\nexport function afterCommit(\n callback: () => void | Promise<void>,\n): Promise<void> {\n if (deferUntilCommit(callback)) return Promise.resolve();\n\n const report = (error: unknown) => {\n console.error(\n `An after-commit callback threw. No transaction was open, so it ran ` +\n `immediately.`,\n error,\n );\n };\n try {\n return Promise.resolve(callback()).catch(report);\n } catch (error) {\n report(error);\n return Promise.resolve();\n }\n}\n\n/**\n * Make the open transaction's commit depend on `write`, a statement issued on\n * its handle: the transaction does not commit until `write` settles, and\n * rolls back — rejecting with `TransactionDependencyError` — if it rejected.\n *\n * For a write the caller may not await. A queued listener's dispatch never is\n * (`EventManager` pushes it and moves on), and on Postgres a statement that\n * fails aborts the whole transaction: every statement after it is refused and\n * Bun's `COMMIT` quietly becomes a rollback. Without this, the callback's\n * promise resolved, `begin` resolved, and the rows the caller wrote were gone\n * with nothing to say so. MySQL does not abort on a failed statement, and is\n * failed here anyway, so that a joined write means the same thing on both:\n * it commits with the transaction or the transaction does not commit.\n *\n * `false` when there is no transaction to depend on, as for\n * `deferUntilCommit`.\n */\nexport function commitDependsOn(write: Promise<unknown>): boolean {\n const store = ormContext.getStore();\n if (store?.tx === undefined || store.commitDependsOn === undefined) {\n return false;\n }\n store.commitDependsOn.push(write);\n return true;\n}\n\n/**\n * A write the transaction's commit depended on failed, so the transaction —\n * or the savepoint the write was made in — rolled back. `cause` is the write's\n * own error.\n */\nexport class TransactionDependencyError extends Error {\n constructor(cause: unknown) {\n super(\n `A statement this transaction depended on failed after being issued on ` +\n `it, so the transaction rolled back instead of committing: ` +\n `${cause instanceof Error ? cause.message : String(cause)}`,\n { cause },\n );\n this.name = \"TransactionDependencyError\";\n }\n}\n\n/**\n * Wait for the writes registered from `mark` on, and throw if one failed.\n *\n * Called at the end of a transaction's or savepoint's callback, *inside*\n * `begin`/`savepoint`, so a throw is what makes Bun roll back rather than\n * commit — after `begin` has resolved it is too late to do anything but\n * report. Every write is settled before throwing, so none is still running on\n * the handle when the rollback is issued.\n */\nasync function awaitDependencies(\n writes: Promise<unknown>[],\n mark: number,\n): Promise<void> {\n if (writes.length === mark) return;\n const settled = await Promise.allSettled(writes.slice(mark));\n const failed = settled.find(\n (outcome): outcome is PromiseRejectedResult => outcome.status === \"rejected\",\n );\n if (failed) throw new TransactionDependencyError(failed.reason);\n}\n\n/** How deeply nested the current transaction is; `null` outside one. */\nexport function transactionDepth(): number | null {\n const store = ormContext.getStore();\n return store?.tx === undefined ? null : store.depth;\n}\n\n/** Whether policies are suspended for the current async scope. */\nexport function isSystemScope(): boolean {\n return ormContext.getStore()?.system === true;\n}\n\n/**\n * Run `fn` with policies suspended.\n *\n * The escape hatch the deny-by-default rule needs to be usable: a cron tick, a\n * queue worker or a seed script has no user, and under deny-by-default every\n * policied model would refuse it. This makes that intent explicit *at the call\n * site*, which is the property that matters — unscoped access must never be\n * what happens when a user simply fails to turn up.\n *\n * It nests inside a transaction and a transaction nests inside it: the scope is\n * merged rather than replaced, so `asSystem` does not silently drop an open\n * handle.\n */\nexport function runAsSystem<T>(fn: () => Promise<T>): Promise<T> {\n const current = ormContext.getStore();\n return ormContext.run({ ...current, depth: current?.depth ?? 0, system: true }, fn);\n}\n\n/**\n * How `model`'s trashed rows are treated in this async scope, or `undefined`\n * for the default (hidden). See `OrmScope.trashed`.\n */\nexport function trashedMode(model: string): TrashedMode | undefined {\n return ormContext.getStore()?.trashed?.get(model);\n}\n\n/**\n * Run `fn` with `model`'s soft-delete scope lifted (`\"with\"`) or inverted\n * (`\"only\"`). Merged into the current scope like `runAsSystem`, so it keeps an\n * open transaction, the system flag and the actor — and every other policy.\n */\nexport function runWithTrashed<T>(\n model: string,\n mode: TrashedMode,\n fn: () => Promise<T>,\n): Promise<T> {\n const current = ormContext.getStore();\n const trashed = new Map(current?.trashed);\n trashed.set(model, mode);\n return ormContext.run(\n { ...current, depth: current?.depth ?? 0, trashed },\n fn,\n );\n}\n\n/** The explicitly-set actor, or `undefined` when none was. */\nexport function currentActor(): { user: unknown } | undefined {\n return ormContext.getStore()?.actor;\n}\n\n/**\n * Run `fn` with policies scoped to `user`, for code with no request to read one\n * from.\n *\n * The counterpart to `runAsSystem`, and the reason that one is not the only\n * escape hatch. A queue worker processing \"send the invoice for organisation 7\"\n * genuinely acts *as somebody*; giving it `asSystem` would suspend policies\n * entirely and leave it hand-scoping every query — which is precisely the\n * unscoped-by-accident failure the deny-by-default rule exists to prevent. The\n * narrow tool should be the easy one.\n *\n * It is also what makes policies testable without reaching into\n * `RequestContext`'s internals.\n *\n * Takes precedence over the request store, so a job that says who it is acting\n * as is not quietly overridden by an ambient request that happens to enclose it.\n *\n * It also **clears `system`**, which is the more surprising half. Acting as a\n * user is strictly narrower than acting as the system, so naming one inside an\n * `asSystem` block has to narrow back — and the spread would otherwise carry\n * `system: true` forward, leaving `$exec` to skip policies entirely while\n * `currentUser()` cheerfully returned the actor. Silently unscoped, from the\n * realistic shape: a worker enters `asSystem` to read its job queue, then\n * narrows to the job's owner for the work itself. The reverse nesting —\n * `asSystem` inside `asUser` — suspends policies, which is what it should do.\n */\nexport function runAsUser<T>(user: unknown, fn: () => Promise<T>): Promise<T> {\n const current = ormContext.getStore();\n return ormContext.run(\n {\n ...current,\n depth: current?.depth ?? 0,\n system: false,\n actor: { user: user ?? null },\n },\n fn,\n );\n}\n\n/**\n * The warning threshold in milliseconds, or `null` when the warning is off.\n *\n * `configured` is `database.slowTransactionThreshold` — see `DatabaseConfig`.\n * It arrives as a value rather than being read from here so that this file\n * keeps knowing nothing about the container: `withTransaction` is reachable\n * with a bare pool, and its tests use one.\n *\n * Exported for its own tests. The behaviour worth pinning is the fallback —\n * that a malformed threshold lands on the default rather than disabling — and\n * that cannot be observed through `withTransaction`: \"no warning fired\" is what\n * a disabled warning looks like too, so a behavioural test of it passes just as\n * happily when the fallback is gone. Asserting the number directly is the only\n * form of that test that can fail.\n */\nexport function slowTransactionThreshold(\n configured?: number | false,\n): number | null {\n // Read per call, never cached at module scope. `scripts/build.ts` rewrites\n // `process.env.NODE_ENV` to `Bun.env.NODE_ENV` precisely so mode stays a\n // runtime question in the built framework; caching it here would undo that.\n if (process.env.NODE_ENV !== \"development\") return null;\n\n // The one way to switch it off, and it has to be spelled. Everything else\n // falls back, so the warning is never lost to a mistyped value — only to an\n // explicit `false`.\n if (configured === false) return null;\n\n if (configured === undefined) return SLOW_TRANSACTION_THRESHOLD;\n if (!Number.isFinite(configured) || configured <= 0) {\n return SLOW_TRANSACTION_THRESHOLD;\n }\n return configured;\n}\n\n/**\n * Warn, in development only, about a transaction that has been open too long.\n *\n * The risk is structural rather than occasional: an open transaction holds one\n * reserved connection for as long as its callback runs, and nothing about\n * `Model.transaction(async () => { ... })` stops that callback from awaiting a\n * `fetch`, an S3 upload or a slow queue push. Under concurrency that drains the\n * pool, and the symptom — every unrelated query in the process blocking on\n * connection acquisition — names neither the callback nor the I/O in it.\n *\n * A timer rather than measuring elapsed time on the way out, for one reason:\n * the worst case is the transaction that *never* settles (a hung request, a\n * lock wait, a deadlock). After-the-fact measurement is silent for exactly that\n * case; a timer fires while it is still open and still holding the connection.\n *\n * The `Error` is constructed up front and read only if the timer fires — V8\n * formats `.stack` lazily on first access, so an ordinary fast transaction pays\n * for an object allocation and nothing else.\n *\n * The clock starts at the `begin` call, not at the moment a connection is\n * acquired, and stops when `begin` settles rather than when the callback\n * returns — so it spans the pool wait and the commit round-trip as well as the\n * callback. That is deliberate: all three are time this transaction is in\n * flight, and a warning that only covered the callback would stay silent for a\n * transaction stuck waiting on an exhausted pool, which is the exact situation\n * a long transaction elsewhere creates. Hence \"not settled\" rather than \"open\n * for\" — the message must not claim a connection was held for the whole span.\n */\nfunction watchForSlowTransaction(configured?: number | false): () => void {\n const threshold = slowTransactionThreshold(configured);\n if (threshold === null) return () => {};\n\n const site = new Error(\"transaction opened here\");\n\n const timer = setTimeout(() => {\n const stack = site.stack?.split(\"\\n\").slice(1).join(\"\\n\") ?? \"\";\n console.warn(\n `[gemi] A database transaction has not settled after ${threshold}ms. It ` +\n `reserves a pooled connection until it does — check for network or ` +\n `filesystem I/O inside the callback, and move it outside the ` +\n `transaction if you find any.\\n${stack}\\n` +\n `(development only; set database.slowTransactionThreshold to change ` +\n `the threshold, or false to switch this off)`,\n );\n }, threshold);\n\n // Otherwise the warning timer is itself a reason the process stays alive,\n // which would turn a diagnostic into a hang in short-lived commands and\n // scripts.\n timer.unref?.();\n\n return () => clearTimeout(timer);\n}\n\n/**\n * Runs what a committed transaction deferred, outside the transaction it was\n * deferred by.\n *\n * `outside` is the scope that was ambient before `begin` — an `asSystem` block,\n * a named connection, or nothing at all — and re-entering it explicitly is the\n * guarantee rather than a tidy-up. The alternative is relying on where a `.then`\n * happens to have captured its context, and the failure that produces is the\n * one the whole feature is about: a listener that runs \"after commit\" while\n * still holding the closed transaction's handle joins nothing, because Bun's\n * handle stays callable and simply runs on the pool. So the scope is rebuilt\n * with `tx` and the drained list cleared, and a listener that opens its own\n * transaction gets a real one.\n *\n * Errors are caught per callback and the next one still runs, for the reason\n * the event subsystem catches per listener: these are independent side effects\n * whose order came from a filesystem walk. And the transaction is not failed by\n * one — it committed, the database kept the rows, and reporting a rejection to\n * the caller would have it roll back or retry work that is already durable.\n * stderr is all that is left, and it is enough: the caller has no decision to\n * make here.\n *\n * The transaction's own promise does not resolve until this has finished, which\n * is the one thing about `afterCommit` that a caller can feel. Deliberate: the\n * alternative is a floating promise whose rejection nobody sees and whose work\n * a short-lived process — a command, a seed — exits out from under.\n */\nasync function drainAfterCommit(\n callbacks: AfterCommitCallback[],\n outside: OrmScope | undefined,\n): Promise<void> {\n if (callbacks.length === 0) return;\n\n await ormContext.run(\n {\n ...outside,\n tx: undefined,\n afterCommit: undefined,\n commitDependsOn: undefined,\n depth: outside?.depth ?? 0,\n },\n async () => {\n for (const callback of callbacks) {\n try {\n await callback();\n } catch (error) {\n console.error(\n `An after-commit callback threw. The transaction it was waiting ` +\n `on had already committed and stays committed, and the ` +\n `callbacks after it still ran.`,\n error,\n );\n }\n }\n },\n );\n}\n\n/**\n * Run `fn` inside a transaction, entering the ambient scope for its whole async\n * subtree.\n *\n * The single implementation behind both `Model.transaction` and\n * `DB.transaction`, so the two cannot become transaction systems that ignore\n * each other: a `Model.create` inside a `DB.transaction` joins it, and a raw\n * `DB.sql` inside a `Model.transaction` can join it through\n * `currentTransaction()`.\n *\n * Nesting becomes a savepoint. Not a preference — Bun refuses the alternative\n * outright (`cannot call begin inside a transaction use savepoint() instead`),\n * and a savepoint is the semantics worth having anyway: an inner failure rolls\n * back to it and leaves the outer transaction usable, which a caller that\n * catches can rely on. Verified on SQLite and Postgres.\n *\n * Note Bun hands the savepoint callback the *same* handle object as the outer\n * transaction (`sp === tx`), so the depth counter is the only thing that\n * actually changes on the way in. The callback's argument is still what gets\n * stored, so this keeps working if that ever stops being true. The cast is\n * because Bun types a savepoint handle as plain `SQL` — without `savepoint` on\n * it — while the runtime object does carry the method, which is what makes\n * three levels of nesting work.\n *\n * Anything `deferUntilCommit` queued is drained once `begin` resolves, outside\n * the transaction and only on the outermost call — a savepoint has committed\n * nothing durable, so draining there would run work that a later rollback of\n * the enclosing transaction was meant to have prevented. See `drainAfterCommit`\n * for what that costs the caller.\n *\n * In development, an outermost transaction that stays open past\n * `options.slowTransactionThreshold` (2s by default, `false` to disable) warns\n * — see `watchForSlowTransaction`. Nothing here *prevents* a long transaction;\n * the warning exists because the cost of one is paid by unrelated queries\n * elsewhere in the process, which makes it hard to trace back.\n *\n * The threshold is passed in rather than read from `app(DatabaseManager)` here.\n * Every caller already holds the manager — it is where `pool` came from — and\n * taking it as an argument keeps this file free of the container, so a bare\n * `SQL` is still enough to call it. Its tests rely on that.\n *\n * `options.connection` is the name `pool` belongs to, and follows the same rule\n * for the same reason: the pool cannot be asked what it is called. Passing it\n * is what lets a nested `withTransaction` tell \"the same connection, so take a\n * savepoint\" from \"a different one, so refuse\" — omitting it means the default\n * connection, which is what a two-argument call always meant.\n *\n * The return type is asserted rather than inferred for one reason worth\n * knowing: Bun's `begin` unwraps a callback that resolves to an *array of\n * promises*, awaiting each. So `Model.transaction(async () => [a, b])` where\n * `a` and `b` are promises resolves to their values, not to the promises. That\n * is Bun's behaviour and is left alone; it is only surprising if unmentioned.\n */\nexport function withTransaction<T>(\n pool: SQL,\n fn: (tx: TransactionSQL) => Promise<T>,\n options?: { slowTransactionThreshold?: number | false; connection?: string },\n): Promise<T> {\n const current = ormContext.getStore();\n\n // THE SINGLE-CONNECTION ASSUMPTION, WHICH IS NOW CHECKED RATHER THAN PINNED.\n //\n // The savepoint branch below ignores `pool` entirely. That was correct while\n // there was one `DatabaseManager` and one `SQL` — the ambient handle and\n // whatever pool the caller passed were necessarily the same database — and\n // the note that stood here said what would happen when a second connection\n // became configurable (#327): a `DB.transaction` on B inside a\n // `Model.transaction` on A would savepoint on **A** and hand the callback A's\n // handle, so statements landed in the wrong database with no error at all.\n //\n // So the name is compared before the branch is taken, and a mismatch raises.\n // Refusing is the whole answer rather than half of one — there is no way to\n // make one transaction span two pools, and the alternatives are covered on\n // `CrossConnectionTransactionError`.\n //\n // A caller that passes no `connection` is treated as naming the default,\n // which is what `withTransaction(pool, fn)` meant before this argument\n // existed.\n const name = options?.connection ?? DEFAULT_CONNECTION;\n assertConnectionUsable(name);\n\n // `current?.tx` rather than `current`: since iteration 6 a scope can exist\n // with no open transaction — `Model.asSystem` enters one — and a savepoint\n // needs an actual handle, not merely a store.\n if (current?.tx) {\n // WHERE THE SHARED AFTER-COMMIT LIST IS PUT RIGHT.\n //\n // The savepoint's scope is a spread of this one, so it appends to the\n // transaction's list rather than to a list of its own — which is what makes\n // \"the outer transaction rolled back, so nothing runs\" free. The case that\n // is not free is this one: the savepoint rolls back and the transaction\n // goes on to commit. Its entries have to go, or a dispatch made inside a\n // block the database threw away runs anyway, which is the same wrong answer\n // as before with an extra step.\n //\n // A mark on the way in and a truncate on the way out, rather than tagging\n // each entry with its depth and dropping everything at or below the failing\n // one. Depth cannot tell two *siblings* apart: a savepoint that committed\n // and one that rolled back both left entries at the same depth, adjacent in\n // the list, and dropping by depth would discard the committed sibling's\n // work as well. The index is exact because the ORM issues one statement at\n // a time on a transaction handle — see `OrmScope.tx` — so nothing appends\n // between the mark and the failure but this savepoint's own subtree.\n const deferred = current.afterCommit;\n const mark = deferred?.length ?? 0;\n // The same mark for the writes the commit depends on. The savepoint waits\n // for its own before it releases, so one that failed rolls back only the\n // savepoint — which a caller that catches can survive, exactly as it\n // survives a statement that threw inside it — and is then forgotten\n // rather than failing the transaction a second time.\n const dependencies = current.commitDependsOn;\n const dependencyMark = dependencies?.length ?? 0;\n\n return current.tx\n .savepoint((sp) => {\n const nested = sp as TransactionSQL;\n return ormContext.run(\n { ...current, tx: nested, depth: current.depth + 1 },\n async () => {\n const result = await fn(nested);\n if (dependencies) {\n await awaitDependencies(dependencies, dependencyMark);\n }\n return result;\n },\n );\n })\n .catch((error: unknown) => {\n if (deferred) deferred.length = mark;\n if (dependencies) dependencies.length = dependencyMark;\n throw error;\n }) as Promise<T>;\n }\n\n // Only the outermost scope is watched. A savepoint reserves no connection of\n // its own — its lifetime is bounded by the transaction it sits in, which is\n // already being timed — so warning per depth would report one slow block as\n // several warnings and point at the innermost frame rather than the one\n // holding the connection.\n const stopWatching = watchForSlowTransaction(\n options?.slowTransactionThreshold,\n );\n\n // Built out here rather than inside the `begin` callback, because the drain\n // below needs it *after* that callback's scope is gone, and reading it off\n // the store then is exactly what is no longer possible.\n const deferred: AfterCommitCallback[] = [];\n const dependencies: Promise<unknown>[] = [];\n\n // The `try` covers a *synchronous* throw from `begin` — a closed pool, say.\n // `.finally` alone would not: it is only attached once `begin` has returned a\n // promise, so a synchronous throw escapes with the timer still armed and\n // eventually warns about a transaction that never opened. `unref` keeps that\n // from holding the process, which makes it cosmetic rather than a leak, but\n // it is the same gap the `.finally` below exists to close.\n try {\n // Spread rather than replace: a `Model.transaction` inside a\n // `Model.asSystem` must not silently re-enable policies for its subtree.\n //\n // The connection goes into the scope alongside the handle, and the pair is\n // what makes the check at the top of this function possible: \"which\n // connection is this transaction on\" has to be answerable from the store,\n // because the handle itself does not say. It is also what makes an\n // unqualified query inside `DB.connection(\"analytics\").transaction(...)`\n // *join* the transaction instead of being refused by it — the query\n // inherits the name rather than defaulting to the hot path.\n return (\n pool\n .begin((tx) =>\n ormContext.run(\n {\n ...current,\n tx,\n depth: 0,\n connection: name === DEFAULT_CONNECTION ? undefined : name,\n // A fresh list per outermost transaction, assigned rather than\n // left to the spread. `current` holds no list today — the drain\n // clears the field before it runs anything — and assigning is\n // what keeps that from being load-bearing: a transaction opened\n // by a callback during a drain gets its own list either way,\n // rather than appending to the array it is being run out of.\n afterCommit: deferred,\n commitDependsOn: dependencies,\n },\n async () => {\n const result = await fn(tx);\n await awaitDependencies(dependencies, 0);\n return result;\n },\n ),\n )\n // `finally` and not a `then`/`catch` pair: the connection is released on\n // rollback exactly as it is on commit, so a throwing callback must clear\n // the timer too or every failed transaction leaves a warning armed\n // against a connection that has already gone back to the pool.\n //\n // Before the drain, so that a slow after-commit listener is not\n // reported as a transaction that will not settle. The connection went\n // back to the pool at the commit; the warning is about holding it.\n .finally(stopWatching)\n // Only here, on the fulfilled path. A rejected `begin` rolled back, so\n // the scope and everything queued on it are discarded unread — which is\n // the whole of what `afterCommit` promises.\n .then(async (result) => {\n await drainAfterCommit(deferred, current);\n return result;\n }) as Promise<T>\n );\n } catch (error) {\n stopWatching();\n throw error;\n }\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";yDACA,4BAAS,oBAmJF,IAAM,EAAa,IAAI,EAavB,SAAS,CAAkB,EAA+B,CAC/D,OAAO,EAAW,SAAS,GAAG,GAUzB,SAAS,CAAqB,EAAW,CAC9C,OAAO,EAAW,SAAS,GAAG,YAAc,EAgBvC,SAAS,CAAkB,CAChC,EACA,EACY,CACZ,IAAM,EAAU,EAAW,SAAS,EACpC,GAAI,EAAsB,IAAM,EA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I,CAWF,OACE,EACG,MAAM,CAAC,IACN,EAAW,IACT,IACK,EACH,KACA,MAAO,EACP,WAAY,IAAS,EAAqB,OAAY,EAOtD,YAAa,EACb,gBAAiB,CACnB,EACA,SAAY,CACV,IAAM,EAAS,MAAM,EAAG,CAAE,EAE1B,OADA,MAAM,EAAkB,EAAc,CAAC,EAChC,EAEX,CACF,EASC,QAAQ,CAAY,EAIpB,KAAK,MAAO,IAAW,CAEtB,OADA,MAAM,EAAiB,EAAU,CAAO,EACjC,EACR,EAEL,MAAO,EAAO,CAEd,MADA,EAAa,EACP",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "D95A211D5158399664756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Q as I}from"./chunk-
|
|
2
|
+
import{Q as I}from"./chunk-k2fh4r0p.js";import{_ as A}from"./chunk-p3zmc8k8.js";import"./chunk-dbwhgyg3.js";import{aa as f}from"./chunk-3f1kq32g.js";import{Uh as t,Yh as T}from"./chunk-8mbyyh8j.js";var N=t(I(),1),a=t(f(),1),d=t(A(),1);import{readFileSync as g}from"fs";var c=(e)=>async(s)=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");let{roleArn:o,roleSessionName:r,webIdentityToken:i,providerId:n,policyArns:m,policy:S,durationSeconds:l}=e,{roleAssumerWithWebIdentity:E}=e;if(!E){let{getDefaultRoleAssumerWithWebIdentity:p}=await import("./chunk-qt8nvpqp.js").then((m)=>t(m.default,1));E=p({...e.clientConfig,credentialProviderLogger:e.logger,parentClientConfig:{...s?.callerClientConfig,...e.parentClientConfig}},e.clientPlugins)}return E({RoleArn:o,RoleSessionName:r??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:i,ProviderId:n,PolicyArns:m,Policy:S,DurationSeconds:l})};var _="AWS_WEB_IDENTITY_TOKEN_FILE",O="AWS_ROLE_ARN",k="AWS_ROLE_SESSION_NAME",L=(e={})=>async(s)=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");let o=e?.webIdentityTokenFile??process.env[_],r=e?.roleArn??process.env[O],i=e?.roleSessionName??process.env[k];if(!o||!r)throw new a.CredentialsProviderError("Web identity configuration not specified",{logger:e.logger});let n=await c({...e,webIdentityToken:d.externalDataInterceptor?.getTokenRecord?.()[o]??g(o,{encoding:"ascii"}),roleArn:r,roleSessionName:i})(s);if(o===process.env[_])N.setCredentialFeature(n,"CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN","h");return n};export{c as fromWebToken,L as fromTokenFile};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=66FBB7CC6561FFF864756E2164756E21
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"export const fromWebToken = (init) => async (awsIdentityProperties) => {\n init.logger?.debug(\"@aws-sdk/credential-provider-web-identity - fromWebToken\");\n const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds } = init;\n let { roleAssumerWithWebIdentity } = init;\n if (!roleAssumerWithWebIdentity) {\n const { getDefaultRoleAssumerWithWebIdentity } = await import(\"@aws-sdk/nested-clients/sts\");\n roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity({\n ...init.clientConfig,\n credentialProviderLogger: init.logger,\n parentClientConfig: {\n ...awsIdentityProperties?.callerClientConfig,\n ...init.parentClientConfig,\n },\n }, init.clientPlugins);\n }\n return roleAssumerWithWebIdentity({\n RoleArn: roleArn,\n RoleSessionName: roleSessionName ?? `aws-sdk-js-session-${Date.now()}`,\n WebIdentityToken: webIdentityToken,\n ProviderId: providerId,\n PolicyArns: policyArns,\n Policy: policy,\n DurationSeconds: durationSeconds,\n });\n};\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": ";8NAAA,SACA,KACA,KACA,iBAAS,WCHF,IAAM,EAAe,CAAC,IAAS,MAAO,IAA0B,CACnE,EAAK,QAAQ,MAAM,0DAA0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f,m,u,x,l,D,z,_,d,c,E,v,n,p,i,s,a,o,t,r,w,e,CC,HC;(function(X){var R=typeof global==="object"?global:typeof self==="object"?self:typeof this==="object"?this:{};if(typeof define==="function"&&define.amd)define("tslib",["exports"],function(G){X(q(R,q(G)))});else if(typeof A==="object"&&typeof QC==="object")X(q(R,q(QC)));else X(q(R));function q(G,S){if(G!==R)if(typeof Object.create==="function")Object.defineProperty(G,"__esModule",{value:!0});else G.__esModule=!0;return function(C,H){return G[C]=S?S(C,H):H}}})(function(X){var R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,H){C.__proto__=H}||function(C,H){for(var L in H)if(Object.prototype.hasOwnProperty.call(H,L))C[L]=H[L]};P=function(C,H){if(typeof H!=="function"&&H!==null)throw TypeError("Class extends value "+String(H)+" is not a constructor or null");R(C,H);function L(){this.constructor=C}C.prototype=H===null?Object.create(H):(L.prototype=H.prototype,new L)},h=Object.assign||function(C){for(var H,L=1,O=arguments.length;L<O;L++){H=arguments[L];for(var Q in H)if(Object.prototype.hasOwnProperty.call(H,Q))C[Q]=H[Q]}return C},j=function(C,H){var L={};for(var O in C)if(Object.prototype.hasOwnProperty.call(C,O)&&H.indexOf(O)<0)L[O]=C[O];if(C!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var Q=0,O=Object.getOwnPropertySymbols(C);Q<O.length;Q++)if(H.indexOf(O[Q])<0&&Object.prototype.propertyIsEnumerable.call(C,O[Q]))L[O[Q]]=C[O[Q]]}return L},I=function(C,H,L,O){var Q=arguments.length,T=Q<3?H:O===null?O=Object.getOwnPropertyDescriptor(H,L):O,U;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")T=Reflect.decorate(C,H,L,O);else for(var Y=C.length-1;Y>=0;Y--)if(U=C[Y])T=(Q<3?U(T):Q>3?U(H,L,T):U(H,L))||T;return Q>3&&T&&Object.defineProperty(H,L,T),T},b=function(C,H){return function(L,O){H(L,O,C)}},y=function(C,H,L,O,Q,T){function U(K){if(K!==void 0&&typeof K!=="function")throw TypeError("Function expected");return K}var Y=O.kind,J=Y==="getter"?"get":Y==="setter"?"set":"value",W=!H&&C?O.static?C:C.prototype:null,$=H||(W?Object.getOwnPropertyDescriptor(W,O.name):{}),M,F=!1;for(var Z=L.length-1;Z>=0;Z--){var N={};for(var B in O)N[B]=B==="access"?{}:O[B];for(var B in O.access)N.access[B]=O.access[B];N.addInitializer=function(K){if(F)throw TypeError("Cannot add initializers after decoration has completed");T.push(U(K||null))};var V=(0,L[Z])(Y==="accessor"?{get:$.get,set:$.set}:$[J],N);if(Y==="accessor"){if(V===void 0)continue;if(V===null||typeof V!=="object")throw TypeError("Object expected");if(M=U(V.get))$.get=M;if(M=U(V.set))$.set=M;if(M=U(V.init))Q.unshift(M)}else if(M=U(V))if(Y==="field")Q.unshift(M);else $[J]=M}if(W)Object.defineProperty(W,O.name,$);F=!0},g=function(C,H,L){var O=arguments.length>2;for(var Q=0;Q<H.length;Q++)L=O?H[Q].call(C,L):H[Q].call(C);return O?L:void 0},k=function(C){return typeof C==="symbol"?C:"".concat(C)},f=function(C,H,L){if(typeof H==="symbol")H=H.description?"[".concat(H.description,"]"):"";return Object.defineProperty(C,"name",{configurable:!0,value:L?"".concat(L," ",H):H})},m=function(C,H){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(C,H)},u=function(C,H,L,O){function Q(T){return T instanceof L?T:new L(function(U){U(T)})}return new(L||(L=Promise))(function(T,U){function Y($){try{W(O.next($))}catch(M){U(M)}}function J($){try{W(O.throw($))}catch(M){U(M)}}function W($){$.done?T($.value):Q($.value).then(Y,J)}W((O=O.apply(C,H||[])).next())})},x=function(C,H){var L={label:0,sent:function(){if(T[0]&1)throw T[1];return T[1]},trys:[],ops:[]},O,Q,T,U=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return U.next=Y(0),U.throw=Y(1),U.return=Y(2),typeof Symbol==="function"&&(U[Symbol.iterator]=function(){return this}),U;function Y(W){return function($){return J([W,$])}}function J(W){if(O)throw TypeError("Generator is already executing.");while(U&&(U=0,W[0]&&(L=0)),L)try{if(O=1,Q&&(T=W[0]&2?Q.return:W[0]?Q.throw||((T=Q.return)&&T.call(Q),0):Q.next)&&!(T=T.call(Q,W[1])).done)return T;if(Q=0,T)W=[W[0]&2,T.value];switch(W[0]){case 0:case 1:T=W;break;case 4:return L.label++,{value:W[1],done:!1};case 5:L.label++,Q=W[1],W=[0];continue;case 7:W=L.ops.pop(),L.trys.pop();continue;default:if((T=L.trys,!(T=T.length>0&&T[T.length-1]))&&(W[0]===6||W[0]===2)){L=0;continue}if(W[0]===3&&(!T||W[1]>T[0]&&W[1]<T[3])){L.label=W[1];break}if(W[0]===6&&L.label<T[1]){L.label=T[1],T=W;break}if(T&&L.label<T[2]){L.label=T[2],L.ops.push(W);break}if(T[2])L.ops.pop();L.trys.pop();continue}W=H.call(C,L)}catch($){W=[6,$],Q=0}finally{O=T=0}if(W[0]&5)throw W[1];return{value:W[0]?W[1]:void 0,done:!0}}},l=function(C,H){for(var L in C)if(L!=="default"&&!Object.prototype.hasOwnProperty.call(H,L))w(H,C,L)},w=Object.create?function(C,H,L,O){if(O===void 0)O=L;var Q=Object.getOwnPropertyDescriptor(H,L);if(!Q||("get"in Q?!H.__esModule:Q.writable||Q.configurable))Q={enumerable:!0,get:function(){return H[L]}};Object.defineProperty(C,O,Q)}:function(C,H,L,O){if(O===void 0)O=L;C[O]=H[L]},D=function(C){var H=typeof Symbol==="function"&&Symbol.iterator,L=H&&C[H],O=0;if(L)return L.call(C);if(C&&typeof C.length==="number")return{next:function(){if(C&&O>=C.length)C=void 0;return{value:C&&C[O++],done:!C}}};throw TypeError(H?"Object is not iterable.":"Symbol.iterator is not defined.")},z=function(C,H){var L=typeof Symbol==="function"&&C[Symbol.iterator];if(!L)return C;var O=L.call(C),Q,T=[],U;try{while((H===void 0||H-- >0)&&!(Q=O.next()).done)T.push(Q.value)}catch(Y){U={error:Y}}finally{try{if(Q&&!Q.done&&(L=O.return))L.call(O)}finally{if(U)throw U.error}}return T},_=function(){for(var C=[],H=0;H<arguments.length;H++)C=C.concat(z(arguments[H]));return C},d=function(){for(var C=0,H=0,L=arguments.length;H<L;H++)C+=arguments[H].length;for(var O=Array(C),Q=0,H=0;H<L;H++)for(var T=arguments[H],U=0,Y=T.length;U<Y;U++,Q++)O[Q]=T[U];return O},c=function(C,H,L){if(L||arguments.length===2){for(var O=0,Q=H.length,T;O<Q;O++)if(T||!(O in H)){if(!T)T=Array.prototype.slice.call(H,0,O);T[O]=H[O]}}return C.concat(T||Array.prototype.slice.call(H))},E=function(C){return this instanceof E?(this.v=C,this):new E(C)},v=function(C,H,L){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var O=L.apply(C,H||[]),Q,T=[];return Q=Object.create((typeof AsyncIterator==="function"?AsyncIterator:Object).prototype),Y("next"),Y("throw"),Y("return",U),Q[Symbol.asyncIterator]=function(){return this},Q;function U(Z){return function(N){return Promise.resolve(N).then(Z,M)}}function Y(Z,N){if(O[Z]){if(Q[Z]=function(B){return new Promise(function(V,K){T.push([Z,B,V,K])>1||J(Z,B)})},N)Q[Z]=N(Q[Z])}}function J(Z,N){try{W(O[Z](N))}catch(B){F(T[0][3],B)}}function W(Z){Z.value instanceof E?Promise.resolve(Z.value.v).then($,M):F(T[0][2],Z)}function $(Z){J("next",Z)}function M(Z){J("throw",Z)}function F(Z,N){if(Z(N),T.shift(),T.length)J(T[0][0],T[0][1])}},n=function(C){var H,L;return H={},O("next"),O("throw",function(Q){throw Q}),O("return"),H[Symbol.iterator]=function(){return this},H;function O(Q,T){H[Q]=C[Q]?function(U){return(L=!L)?{value:E(C[Q](U)),done:!1}:T?T(U):U}:T}},p=function(C){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var H=C[Symbol.asyncIterator],L;return H?H.call(C):(C=typeof D==="function"?D(C):C[Symbol.iterator](),L={},O("next"),O("throw"),O("return"),L[Symbol.asyncIterator]=function(){return this},L);function O(T){L[T]=C[T]&&function(U){return new Promise(function(Y,J){U=C[T](U),Q(Y,J,U.done,U.value)})}}function Q(T,U,Y,J){Promise.resolve(J).then(function(W){T({value:W,done:Y})},U)}},i=function(C,H){if(Object.defineProperty)Object.defineProperty(C,"raw",{value:H});else C.raw=H;return C};var q=Object.create?function(C,H){Object.defineProperty(C,"default",{enumerable:!0,value:H})}:function(C,H){C.default=H},G=function(C){return G=Object.getOwnPropertyNames||function(H){var L=[];for(var O in H)if(Object.prototype.hasOwnProperty.call(H,O))L[L.length]=O;return L},G(C)};s=function(C){if(C&&C.__esModule)return C;var H={};if(C!=null){for(var L=G(C),O=0;O<L.length;O++)if(L[O]!=="default")w(H,C,L[O])}return q(H,C),H},a=function(C){return C&&C.__esModule?C:{default:C}},o=function(C,H,L,O){if(L==="a"&&!O)throw TypeError("Private accessor was defined without a getter");if(typeof H==="function"?C!==H||!O:!H.has(C))throw TypeError("Cannot read private member from an object whose class did not declare it");return L==="m"?O:L==="a"?O.call(C):O?O.value:H.get(C)},t=function(C,H,L,O,Q){if(O==="m")throw TypeError("Private method is not writable");if(O==="a"&&!Q)throw TypeError("Private accessor was defined without a setter");if(typeof H==="function"?C!==H||!Q:!H.has(C))throw TypeError("Cannot write private member to an object whose class did not declare it");return O==="a"?Q.call(C,L):Q?Q.value=L:H.set(C,L),L},r=function(C,H){if(H===null||typeof H!=="object"&&typeof H!=="function")throw TypeError("Cannot use 'in' operator on non-object");return typeof C==="function"?H===C:C.has(H)},e=function(C,H,L){if(H!==null&&H!==void 0){if(typeof H!=="object"&&typeof H!=="function")throw TypeError("Object expected.");var O,Q;if(L){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");O=H[Symbol.asyncDispose]}if(O===void 0){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");if(O=H[Symbol.dispose],L)Q=O}if(typeof O!=="function")throw TypeError("Object not disposable.");if(Q)O=function(){try{Q.call(this)}catch(T){return Promise.reject(T)}};C.stack.push({value:H,dispose:O,async:L})}else if(L)C.stack.push({async:!0});return H};var S=typeof SuppressedError==="function"?SuppressedError:function(C,H,L){var O=Error(L);return O.name="SuppressedError",O.error=C,O.suppressed=H,O};CC=function(C){function H(T){C.error=C.hasError?new S(T,C.error,"An error was suppressed during disposal."):T,C.hasError=!0}var L,O=0;function Q(){while(L=C.stack.pop())try{if(!L.async&&O===1)return O=0,C.stack.push(L),Promise.resolve().then(Q);if(L.dispose){var T=L.dispose.call(L.value);if(L.async)return O|=2,Promise.resolve(T).then(Q,function(U){return H(U),Q()})}else O|=1}catch(U){H(U)}if(O===1)return C.hasError?Promise.reject(C.error):Promise.resolve();if(C.hasError)throw C.error}return Q()},HC=function(C,H){if(typeof C==="string"&&/^\.\.?\//.test(C))return C.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(L,O,Q,T,U){return O?H?".jsx":".js":Q&&(!T||!U)?L:Q+T+"."+U.toLowerCase()+"js"});return C},X("__extends",P),X("__assign",h),X("__rest",j),X("__decorate",I),X("__param",b),X("__esDecorate",y),X("__runInitializers",g),X("__propKey",k),X("__setFunctionName",f),X("__metadata",m),X("__awaiter",u),X("__generator",x),X("__exportStar",l),X("__createBinding",w),X("__values",D),X("__read",z),X("__spread",_),X("__spreadArrays",d),X("__spreadArray",c),X("__await",E),X("__asyncGenerator",v),X("__asyncDelegator",n),X("__asyncValues",p),X("__makeTemplateObject",i),X("__importStar",s),X("__importDefault",a),X("__classPrivateFieldGet",o),X("__classPrivateFieldSet",t),X("__classPrivateFieldIn",r),X("__addDisposableResource",e),X("__disposeResources",CC),X("__rewriteRelativeImportExtension",HC)})});
|
|
2
|
+
import{Vh as LC}from"./chunk-8mbyyh8j.js";var OC=LC((QC,A)=>{var P,h,j,I,b,y,g,k,f,m,u,x,l,D,z,_,d,c,E,v,n,p,i,s,a,o,t,r,w,e,CC,HC;(function(X){var R=typeof global==="object"?global:typeof self==="object"?self:typeof this==="object"?this:{};if(typeof define==="function"&&define.amd)define("tslib",["exports"],function(G){X(q(R,q(G)))});else if(typeof A==="object"&&typeof QC==="object")X(q(R,q(QC)));else X(q(R));function q(G,S){if(G!==R)if(typeof Object.create==="function")Object.defineProperty(G,"__esModule",{value:!0});else G.__esModule=!0;return function(C,H){return G[C]=S?S(C,H):H}}})(function(X){var R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,H){C.__proto__=H}||function(C,H){for(var L in H)if(Object.prototype.hasOwnProperty.call(H,L))C[L]=H[L]};P=function(C,H){if(typeof H!=="function"&&H!==null)throw TypeError("Class extends value "+String(H)+" is not a constructor or null");R(C,H);function L(){this.constructor=C}C.prototype=H===null?Object.create(H):(L.prototype=H.prototype,new L)},h=Object.assign||function(C){for(var H,L=1,O=arguments.length;L<O;L++){H=arguments[L];for(var Q in H)if(Object.prototype.hasOwnProperty.call(H,Q))C[Q]=H[Q]}return C},j=function(C,H){var L={};for(var O in C)if(Object.prototype.hasOwnProperty.call(C,O)&&H.indexOf(O)<0)L[O]=C[O];if(C!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var Q=0,O=Object.getOwnPropertySymbols(C);Q<O.length;Q++)if(H.indexOf(O[Q])<0&&Object.prototype.propertyIsEnumerable.call(C,O[Q]))L[O[Q]]=C[O[Q]]}return L},I=function(C,H,L,O){var Q=arguments.length,T=Q<3?H:O===null?O=Object.getOwnPropertyDescriptor(H,L):O,U;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")T=Reflect.decorate(C,H,L,O);else for(var Y=C.length-1;Y>=0;Y--)if(U=C[Y])T=(Q<3?U(T):Q>3?U(H,L,T):U(H,L))||T;return Q>3&&T&&Object.defineProperty(H,L,T),T},b=function(C,H){return function(L,O){H(L,O,C)}},y=function(C,H,L,O,Q,T){function U(K){if(K!==void 0&&typeof K!=="function")throw TypeError("Function expected");return K}var Y=O.kind,J=Y==="getter"?"get":Y==="setter"?"set":"value",W=!H&&C?O.static?C:C.prototype:null,$=H||(W?Object.getOwnPropertyDescriptor(W,O.name):{}),M,F=!1;for(var Z=L.length-1;Z>=0;Z--){var N={};for(var B in O)N[B]=B==="access"?{}:O[B];for(var B in O.access)N.access[B]=O.access[B];N.addInitializer=function(K){if(F)throw TypeError("Cannot add initializers after decoration has completed");T.push(U(K||null))};var V=(0,L[Z])(Y==="accessor"?{get:$.get,set:$.set}:$[J],N);if(Y==="accessor"){if(V===void 0)continue;if(V===null||typeof V!=="object")throw TypeError("Object expected");if(M=U(V.get))$.get=M;if(M=U(V.set))$.set=M;if(M=U(V.init))Q.unshift(M)}else if(M=U(V))if(Y==="field")Q.unshift(M);else $[J]=M}if(W)Object.defineProperty(W,O.name,$);F=!0},g=function(C,H,L){var O=arguments.length>2;for(var Q=0;Q<H.length;Q++)L=O?H[Q].call(C,L):H[Q].call(C);return O?L:void 0},k=function(C){return typeof C==="symbol"?C:"".concat(C)},f=function(C,H,L){if(typeof H==="symbol")H=H.description?"[".concat(H.description,"]"):"";return Object.defineProperty(C,"name",{configurable:!0,value:L?"".concat(L," ",H):H})},m=function(C,H){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(C,H)},u=function(C,H,L,O){function Q(T){return T instanceof L?T:new L(function(U){U(T)})}return new(L||(L=Promise))(function(T,U){function Y($){try{W(O.next($))}catch(M){U(M)}}function J($){try{W(O.throw($))}catch(M){U(M)}}function W($){$.done?T($.value):Q($.value).then(Y,J)}W((O=O.apply(C,H||[])).next())})},x=function(C,H){var L={label:0,sent:function(){if(T[0]&1)throw T[1];return T[1]},trys:[],ops:[]},O,Q,T,U=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return U.next=Y(0),U.throw=Y(1),U.return=Y(2),typeof Symbol==="function"&&(U[Symbol.iterator]=function(){return this}),U;function Y(W){return function($){return J([W,$])}}function J(W){if(O)throw TypeError("Generator is already executing.");while(U&&(U=0,W[0]&&(L=0)),L)try{if(O=1,Q&&(T=W[0]&2?Q.return:W[0]?Q.throw||((T=Q.return)&&T.call(Q),0):Q.next)&&!(T=T.call(Q,W[1])).done)return T;if(Q=0,T)W=[W[0]&2,T.value];switch(W[0]){case 0:case 1:T=W;break;case 4:return L.label++,{value:W[1],done:!1};case 5:L.label++,Q=W[1],W=[0];continue;case 7:W=L.ops.pop(),L.trys.pop();continue;default:if((T=L.trys,!(T=T.length>0&&T[T.length-1]))&&(W[0]===6||W[0]===2)){L=0;continue}if(W[0]===3&&(!T||W[1]>T[0]&&W[1]<T[3])){L.label=W[1];break}if(W[0]===6&&L.label<T[1]){L.label=T[1],T=W;break}if(T&&L.label<T[2]){L.label=T[2],L.ops.push(W);break}if(T[2])L.ops.pop();L.trys.pop();continue}W=H.call(C,L)}catch($){W=[6,$],Q=0}finally{O=T=0}if(W[0]&5)throw W[1];return{value:W[0]?W[1]:void 0,done:!0}}},l=function(C,H){for(var L in C)if(L!=="default"&&!Object.prototype.hasOwnProperty.call(H,L))w(H,C,L)},w=Object.create?function(C,H,L,O){if(O===void 0)O=L;var Q=Object.getOwnPropertyDescriptor(H,L);if(!Q||("get"in Q?!H.__esModule:Q.writable||Q.configurable))Q={enumerable:!0,get:function(){return H[L]}};Object.defineProperty(C,O,Q)}:function(C,H,L,O){if(O===void 0)O=L;C[O]=H[L]},D=function(C){var H=typeof Symbol==="function"&&Symbol.iterator,L=H&&C[H],O=0;if(L)return L.call(C);if(C&&typeof C.length==="number")return{next:function(){if(C&&O>=C.length)C=void 0;return{value:C&&C[O++],done:!C}}};throw TypeError(H?"Object is not iterable.":"Symbol.iterator is not defined.")},z=function(C,H){var L=typeof Symbol==="function"&&C[Symbol.iterator];if(!L)return C;var O=L.call(C),Q,T=[],U;try{while((H===void 0||H-- >0)&&!(Q=O.next()).done)T.push(Q.value)}catch(Y){U={error:Y}}finally{try{if(Q&&!Q.done&&(L=O.return))L.call(O)}finally{if(U)throw U.error}}return T},_=function(){for(var C=[],H=0;H<arguments.length;H++)C=C.concat(z(arguments[H]));return C},d=function(){for(var C=0,H=0,L=arguments.length;H<L;H++)C+=arguments[H].length;for(var O=Array(C),Q=0,H=0;H<L;H++)for(var T=arguments[H],U=0,Y=T.length;U<Y;U++,Q++)O[Q]=T[U];return O},c=function(C,H,L){if(L||arguments.length===2){for(var O=0,Q=H.length,T;O<Q;O++)if(T||!(O in H)){if(!T)T=Array.prototype.slice.call(H,0,O);T[O]=H[O]}}return C.concat(T||Array.prototype.slice.call(H))},E=function(C){return this instanceof E?(this.v=C,this):new E(C)},v=function(C,H,L){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var O=L.apply(C,H||[]),Q,T=[];return Q=Object.create((typeof AsyncIterator==="function"?AsyncIterator:Object).prototype),Y("next"),Y("throw"),Y("return",U),Q[Symbol.asyncIterator]=function(){return this},Q;function U(Z){return function(N){return Promise.resolve(N).then(Z,M)}}function Y(Z,N){if(O[Z]){if(Q[Z]=function(B){return new Promise(function(V,K){T.push([Z,B,V,K])>1||J(Z,B)})},N)Q[Z]=N(Q[Z])}}function J(Z,N){try{W(O[Z](N))}catch(B){F(T[0][3],B)}}function W(Z){Z.value instanceof E?Promise.resolve(Z.value.v).then($,M):F(T[0][2],Z)}function $(Z){J("next",Z)}function M(Z){J("throw",Z)}function F(Z,N){if(Z(N),T.shift(),T.length)J(T[0][0],T[0][1])}},n=function(C){var H,L;return H={},O("next"),O("throw",function(Q){throw Q}),O("return"),H[Symbol.iterator]=function(){return this},H;function O(Q,T){H[Q]=C[Q]?function(U){return(L=!L)?{value:E(C[Q](U)),done:!1}:T?T(U):U}:T}},p=function(C){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var H=C[Symbol.asyncIterator],L;return H?H.call(C):(C=typeof D==="function"?D(C):C[Symbol.iterator](),L={},O("next"),O("throw"),O("return"),L[Symbol.asyncIterator]=function(){return this},L);function O(T){L[T]=C[T]&&function(U){return new Promise(function(Y,J){U=C[T](U),Q(Y,J,U.done,U.value)})}}function Q(T,U,Y,J){Promise.resolve(J).then(function(W){T({value:W,done:Y})},U)}},i=function(C,H){if(Object.defineProperty)Object.defineProperty(C,"raw",{value:H});else C.raw=H;return C};var q=Object.create?function(C,H){Object.defineProperty(C,"default",{enumerable:!0,value:H})}:function(C,H){C.default=H},G=function(C){return G=Object.getOwnPropertyNames||function(H){var L=[];for(var O in H)if(Object.prototype.hasOwnProperty.call(H,O))L[L.length]=O;return L},G(C)};s=function(C){if(C&&C.__esModule)return C;var H={};if(C!=null){for(var L=G(C),O=0;O<L.length;O++)if(L[O]!=="default")w(H,C,L[O])}return q(H,C),H},a=function(C){return C&&C.__esModule?C:{default:C}},o=function(C,H,L,O){if(L==="a"&&!O)throw TypeError("Private accessor was defined without a getter");if(typeof H==="function"?C!==H||!O:!H.has(C))throw TypeError("Cannot read private member from an object whose class did not declare it");return L==="m"?O:L==="a"?O.call(C):O?O.value:H.get(C)},t=function(C,H,L,O,Q){if(O==="m")throw TypeError("Private method is not writable");if(O==="a"&&!Q)throw TypeError("Private accessor was defined without a setter");if(typeof H==="function"?C!==H||!Q:!H.has(C))throw TypeError("Cannot write private member to an object whose class did not declare it");return O==="a"?Q.call(C,L):Q?Q.value=L:H.set(C,L),L},r=function(C,H){if(H===null||typeof H!=="object"&&typeof H!=="function")throw TypeError("Cannot use 'in' operator on non-object");return typeof C==="function"?H===C:C.has(H)},e=function(C,H,L){if(H!==null&&H!==void 0){if(typeof H!=="object"&&typeof H!=="function")throw TypeError("Object expected.");var O,Q;if(L){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");O=H[Symbol.asyncDispose]}if(O===void 0){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");if(O=H[Symbol.dispose],L)Q=O}if(typeof O!=="function")throw TypeError("Object not disposable.");if(Q)O=function(){try{Q.call(this)}catch(T){return Promise.reject(T)}};C.stack.push({value:H,dispose:O,async:L})}else if(L)C.stack.push({async:!0});return H};var S=typeof SuppressedError==="function"?SuppressedError:function(C,H,L){var O=Error(L);return O.name="SuppressedError",O.error=C,O.suppressed=H,O};CC=function(C){function H(T){C.error=C.hasError?new S(T,C.error,"An error was suppressed during disposal."):T,C.hasError=!0}var L,O=0;function Q(){while(L=C.stack.pop())try{if(!L.async&&O===1)return O=0,C.stack.push(L),Promise.resolve().then(Q);if(L.dispose){var T=L.dispose.call(L.value);if(L.async)return O|=2,Promise.resolve(T).then(Q,function(U){return H(U),Q()})}else O|=1}catch(U){H(U)}if(O===1)return C.hasError?Promise.reject(C.error):Promise.resolve();if(C.hasError)throw C.error}return Q()},HC=function(C,H){if(typeof C==="string"&&/^\.\.?\//.test(C))return C.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(L,O,Q,T,U){return O?H?".jsx":".js":Q&&(!T||!U)?L:Q+T+"."+U.toLowerCase()+"js"});return C},X("__extends",P),X("__assign",h),X("__rest",j),X("__decorate",I),X("__param",b),X("__esDecorate",y),X("__runInitializers",g),X("__propKey",k),X("__setFunctionName",f),X("__metadata",m),X("__awaiter",u),X("__generator",x),X("__exportStar",l),X("__createBinding",w),X("__values",D),X("__read",z),X("__spread",_),X("__spreadArrays",d),X("__spreadArray",c),X("__await",E),X("__asyncGenerator",v),X("__asyncDelegator",n),X("__asyncValues",p),X("__makeTemplateObject",i),X("__importStar",s),X("__importDefault",a),X("__classPrivateFieldGet",o),X("__classPrivateFieldSet",t),X("__classPrivateFieldIn",r),X("__addDisposableResource",e),X("__disposeResources",CC),X("__rewriteRelativeImportExtension",HC)})});
|
|
3
3
|
export{OC as ka};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=CA1E79914F62D6D464756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global global, define, Symbol, Reflect, Promise, SuppressedError, Iterator */\r\nvar __extends;\r\nvar __assign;\r\nvar __rest;\r\nvar __decorate;\r\nvar __param;\r\nvar __esDecorate;\r\nvar __runInitializers;\r\nvar __propKey;\r\nvar __setFunctionName;\r\nvar __metadata;\r\nvar __awaiter;\r\nvar __generator;\r\nvar __exportStar;\r\nvar __values;\r\nvar __read;\r\nvar __spread;\r\nvar __spreadArrays;\r\nvar __spreadArray;\r\nvar __await;\r\nvar __asyncGenerator;\r\nvar __asyncDelegator;\r\nvar __asyncValues;\r\nvar __makeTemplateObject;\r\nvar __importStar;\r\nvar __importDefault;\r\nvar __classPrivateFieldGet;\r\nvar __classPrivateFieldSet;\r\nvar __classPrivateFieldIn;\r\nvar __createBinding;\r\nvar __addDisposableResource;\r\nvar __disposeResources;\r\nvar __rewriteRelativeImportExtension;\r\n(function (factory) {\r\n var root = typeof global === \"object\" ? global : typeof self === \"object\" ? self : typeof this === \"object\" ? this : {};\r\n if (typeof define === \"function\" && define.amd) {\r\n define(\"tslib\", [\"exports\"], function (exports) { factory(createExporter(root, createExporter(exports))); });\r\n }\r\n else if (typeof module === \"object\" && typeof module.exports === \"object\") {\r\n factory(createExporter(root, createExporter(module.exports)));\r\n }\r\n else {\r\n factory(createExporter(root));\r\n }\r\n function createExporter(exports, previous) {\r\n if (exports !== root) {\r\n if (typeof Object.create === \"function\") {\r\n Object.defineProperty(exports, \"__esModule\", { value: true });\r\n }\r\n else {\r\n exports.__esModule = true;\r\n }\r\n }\r\n return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };\r\n }\r\n})\r\n(function (exporter) {\r\n var extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n\r\n __extends = function (d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n\r\n __assign = Object.assign || function (t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n\r\n __rest = function (s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n };\r\n\r\n __decorate = function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n };\r\n\r\n __param = function (paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n };\r\n\r\n __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n };\r\n\r\n __runInitializers = function (thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n };\r\n\r\n __propKey = function (x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n };\r\n\r\n __setFunctionName = function (f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n };\r\n\r\n __metadata = function (metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n };\r\n\r\n __awaiter = function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n };\r\n\r\n __generator = function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n };\r\n\r\n __exportStar = function(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n };\r\n\r\n __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n }) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n });\r\n\r\n __values = function (o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n };\r\n\r\n __read = function (o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n };\r\n\r\n /** @deprecated */\r\n __spread = function () {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n };\r\n\r\n /** @deprecated */\r\n __spreadArrays = function () {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n };\r\n\r\n __spreadArray = function (to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n };\r\n\r\n __await = function (v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n };\r\n\r\n __asyncGenerator = function (thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n };\r\n\r\n __asyncDelegator = function (o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n };\r\n\r\n __asyncValues = function (o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n };\r\n\r\n __makeTemplateObject = function (cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n };\r\n\r\n var __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n }) : function(o, v) {\r\n o[\"default\"] = v;\r\n };\r\n\r\n var ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n };\r\n\r\n __importStar = function (mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n };\r\n\r\n __importDefault = function (mod) {\r\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\r\n };\r\n\r\n __classPrivateFieldGet = function (receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n };\r\n\r\n __classPrivateFieldSet = function (receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n };\r\n\r\n __classPrivateFieldIn = function (state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n };\r\n\r\n __addDisposableResource = function (env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n };\r\n\r\n var _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n };\r\n\r\n __disposeResources = function (env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n };\r\n\r\n __rewriteRelativeImportExtension = function (path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n };\r\n\r\n exporter(\"__extends\", __extends);\r\n exporter(\"__assign\", __assign);\r\n exporter(\"__rest\", __rest);\r\n exporter(\"__decorate\", __decorate);\r\n exporter(\"__param\", __param);\r\n exporter(\"__esDecorate\", __esDecorate);\r\n exporter(\"__runInitializers\", __runInitializers);\r\n exporter(\"__propKey\", __propKey);\r\n exporter(\"__setFunctionName\", __setFunctionName);\r\n exporter(\"__metadata\", __metadata);\r\n exporter(\"__awaiter\", __awaiter);\r\n exporter(\"__generator\", __generator);\r\n exporter(\"__exportStar\", __exportStar);\r\n exporter(\"__createBinding\", __createBinding);\r\n exporter(\"__values\", __values);\r\n exporter(\"__read\", __read);\r\n exporter(\"__spread\", __spread);\r\n exporter(\"__spreadArrays\", __spreadArrays);\r\n exporter(\"__spreadArray\", __spreadArray);\r\n exporter(\"__await\", __await);\r\n exporter(\"__asyncGenerator\", __asyncGenerator);\r\n exporter(\"__asyncDelegator\", __asyncDelegator);\r\n exporter(\"__asyncValues\", __asyncValues);\r\n exporter(\"__makeTemplateObject\", __makeTemplateObject);\r\n exporter(\"__importStar\", __importStar);\r\n exporter(\"__importDefault\", __importDefault);\r\n exporter(\"__classPrivateFieldGet\", __classPrivateFieldGet);\r\n exporter(\"__classPrivateFieldSet\", __classPrivateFieldSet);\r\n exporter(\"__classPrivateFieldIn\", __classPrivateFieldIn);\r\n exporter(\"__addDisposableResource\", __addDisposableResource);\r\n exporter(\"__disposeResources\", __disposeResources);\r\n exporter(\"__rewriteRelativeImportExtension\", __rewriteRelativeImportExtension);\r\n});\r\n\r\n0 && (module.exports = {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __exportStar: __exportStar,\r\n __createBinding: __createBinding,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n});\r\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";6DAeA,IAAI,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,GACA,IACH,QAAS,CAAC,EAAS,CAChB,IAAI,EAAO,OAAO,SAAW,SAAW,OAAS,OAAO,OAAS,SAAW,KAAO,OAAO,OAAS,SAAW,KAAO,CAAC,EACtH,GAAI,OAAO,SAAW,YAAc,OAAO,IACvC,OAAO,QAAS,CAAC,SAAS,EAAG,QAAS,CAAC,EAAS,CAAE,EAAQ,EAAe,EAAM,EAAe,CAAO,CAAC,CAAC,EAAI,EAE1G,QAAI,OAAO,IAAW,UAAY,OAAc,KAAY,SAC7D,EAAQ,EAAe,EAAM,EAAsB,EAAO,CAAC,CAAC,EAG5D,OAAQ,EAAe,CAAI,CAAC,EAEhC,SAAS,CAAc,CAAC,EAAS,EAAU,CACvC,GAAI,IAAY,EACZ,GAAI,OAAO,OAAO,SAAW,WACzB,OAAO,eAAe,EAAS,aAAc,CAAE,MAAO,EAAK,CAAC,EAG5D,OAAQ,WAAa,GAG7B,OAAO,QAAS,CAAC,EAAI,EAAG,CAAE,OAAO,EAAQ,GAAM,EAAW,EAAS,EAAI,CAAC,EAAI,MAGnF,QAAS,CAAC,EAAU,CACjB,IAAI,EAAgB,OAAO,gBACtB,CAAE,UAAW,CAAC,CAAE,YAAa,OAAS,QAAS,CAAC,EAAG,EAAG,CAAE,EAAE,UAAY,IACvE,QAAS,CAAC,EAAG,EAAG,CAA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AY,EAAI,KAC5G,EAEL,OAAO,GAGX,EAAS,YAAa,CAAS,EAC/B,EAAS,WAAY,CAAQ,EAC7B,EAAS,SAAU,CAAM,EACzB,EAAS,aAAc,CAAU,EACjC,EAAS,UAAW,CAAO,EAC3B,EAAS,eAAgB,CAAY,EACrC,EAAS,oBAAqB,CAAiB,EAC/C,EAAS,YAAa,CAAS,EAC/B,EAAS,oBAAqB,CAAiB,EAC/C,EAAS,aAAc,CAAU,EACjC,EAAS,YAAa,CAAS,EAC/B,EAAS,cAAe,CAAW,EACnC,EAAS,eAAgB,CAAY,EACrC,EAAS,kBAAmB,CAAe,EAC3C,EAAS,WAAY,CAAQ,EAC7B,EAAS,SAAU,CAAM,EACzB,EAAS,WAAY,CAAQ,EAC7B,EAAS,iBAAkB,CAAc,EACzC,EAAS,gBAAiB,CAAa,EACvC,EAAS,UAAW,CAAO,EAC3B,EAAS,mBAAoB,CAAgB,EAC7C,EAAS,mBAAoB,CAAgB,EAC7C,EAAS,gBAAiB,CAAa,EACvC,EAAS,uBAAwB,CAAoB,EACrD,EAAS,eAAgB,CAAY,EACrC,EAAS,kBAAmB,CAAe,EAC3C,EAAS,yBAA0B,CAAsB,EACzD,EAAS,yBAA0B,CAAsB,EACzD,EAAS,wBAAyB,CAAqB,EACvD,EAAS,0BAA2B,CAAuB,EAC3D,EAAS,qBAAsB,EAAkB,EACjD,EAAS,mCAAoC,EAAgC,EAChF",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "CA1E79914F62D6D464756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-8mbyyh8j.js";function R(f,D){let P=new Map;for(let p of[...D.tables].sort())P.set(p,{name:p,columns:[],primaryKey:[],relations:[]});for(let{table:p,...s}of D.columns)P.get(p)?.columns.push(s);for(let{table:p,column:s}of D.primaryKeys)P.get(p)?.primaryKey.push(s);let d=new Map;for(let p of D.foreignKeys){let s=P.get(p.table);if(!s)continue;let M=`${p.table}\x00${p.key}`,q=d.get(M);if(!q)q={name:p.name,columns:[],referencedTable:p.referencedTable,referencedColumns:[],onDelete:p.onDelete,onUpdate:p.onUpdate},d.set(M,q),s.relations.push(q);q.columns.push(p.column),q.referencedColumns.push(p.referencedColumn)}return{dialect:f,tables:[...P.values()]}}async function h(f,D){let P=await f.unsafe(`
|
|
3
3
|
select TABLE_NAME as name
|
|
4
4
|
from information_schema.TABLES
|
|
5
5
|
where TABLE_SCHEMA = database() and TABLE_TYPE = 'BASE TABLE'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Vh as t,Yh as A}from"./chunk-8mbyyh8j.js";var o=t((b)=>{var i=(r)=>typeof ArrayBuffer==="function"&&r instanceof ArrayBuffer||Object.prototype.toString.call(r)==="[object ArrayBuffer]";b.isArrayBuffer=i});var y=t((g)=>{var m=o(),f=A("buffer"),B=(r,e=0,u=r.byteLength-e)=>{if(!m.isArrayBuffer(r))throw TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof r} (${r})`);return f.Buffer.from(r,e,u)},a=(r,e)=>{if(typeof r!=="string")throw TypeError(`The "input" argument must be of type string. Received type ${typeof r} (${r})`);return e?f.Buffer.from(r,e):f.Buffer.from(r)};g.fromArrayBuffer=B;g.fromString=a});var x=t((w)=>{var n=y(),s=(r)=>{let e=n.fromString(r,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},h=(r)=>{if(typeof r==="string")return s(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(r)},p=(r)=>{if(typeof r==="string")return r;if(typeof r!=="object"||typeof r.byteOffset!=="number"||typeof r.byteLength!=="number")throw Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return n.fromArrayBuffer(r.buffer,r.byteOffset,r.byteLength).toString("utf8")};w.fromUtf8=s;w.toUint8Array=h;w.toUtf8=p});
|
|
3
3
|
export{o as V,y as W,x as X};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=ACD69B3148B8B05B64756E2164756E21
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"'use strict';\n\nvar utilBufferFrom = require('@smithy/util-buffer-from');\n\nconst fromUtf8 = (input) => {\n const buf = utilBufferFrom.fromString(input, \"utf8\");\n return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);\n};\n\nconst toUint8Array = (data) => {\n if (typeof data === \"string\") {\n return fromUtf8(data);\n }\n if (ArrayBuffer.isView(data)) {\n return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT);\n }\n return new Uint8Array(data);\n};\n\nconst toUtf8 = (input) => {\n if (typeof input === \"string\") {\n return input;\n }\n if (typeof input !== \"object\" || typeof input.byteOffset !== \"number\" || typeof input.byteLength !== \"number\") {\n throw new Error(\"@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.\");\n }\n return utilBufferFrom.fromArrayBuffer(input.buffer, input.byteOffset, input.byteLength).toString(\"utf8\");\n};\n\nexports.fromUtf8 = fromUtf8;\nexports.toUint8Array = toUint8Array;\nexports.toUtf8 = toUtf8;\n"
|
|
8
8
|
],
|
|
9
9
|
"mappings": ";+DAEA,IAAM,EAAgB,CAAC,IAAS,OAAO,cAAgB,YAAc,aAAe,aAChF,OAAO,UAAU,SAAS,KAAK,CAAG,IAAM,uBAEpC,gBAAgB,kBCHxB,IAAI,MACA,cAEE,EAAkB,CAAC,EAAO,EAAS,EAAG,EAAS,EAAM,WAAa,IAAW,CAC/E,GAAI,CAAC,EAAc,cAAc,CAAK,EAClC,MAAU,UAAU,2DAA2D,OAAO,MAAU,IAAQ,EAE5G,OAAO,EAAO,OAAO,KAAK,EAAO,EAAQ,CAAM,GAE7C,EAAa,CAAC,EAAO,IAAa,CACpC,GAAI,OAAO,IAAU,SACjB,MAAU,UAAU,8DAA8D,OAAO,MAAU,IAAQ,EAE/G,OAAO,EAAW,EAAO,OAAO,KAAK,EAAO,CAAQ,EAAI,EAAO,OAAO,KAAK,CAAK,GAG5E,kBAAkB,EAClB,aAAa,kBCjBrB,IAAI,MAEE,EAAW,CAAC,IAAU,CACxB,IAAM,EAAM,EAAe,WAAW,EAAO,MAAM,EACnD,OAAO,IAAI,WAAW,EAAI,OAAQ,EAAI,WAAY,EAAI,WAAa,WAAW,iBAAiB,GAG7F,EAAe,CAAC,IAAS,CAC3B,GAAI,OAAO,IAAS,SAChB,OAAO,EAAS,CAAI,EAExB,GAAI,YAAY,OAAO,CAAI,EACvB,OAAO,IAAI,WAAW,EAAK,OAAQ,EAAK,WAAY,EAAK,WAAa,WAAW,iBAAiB,EAEtG,OAAO,IAAI,WAAW,CAAI,GAGxB,EAAS,CAAC,IAAU,CACtB,GAAI,OAAO,IAAU,SACjB,OAAO,EAEX,GAAI,OAAO,IAAU,UAAY,OAAO,EAAM,aAAe,UAAY,OAAO,EAAM,aAAe,SACjG,MAAU,MAAM,8EAA8E,EAElG,OAAO,EAAe,gBAAgB,EAAM,OAAQ,EAAM,WAAY,EAAM,UAAU,EAAE,SAAS,MAAM,GAGnG,WAAW,EACX,eAAe,EACf,SAAS",
|
|
10
|
-
"debugId": "
|
|
10
|
+
"debugId": "ACD69B3148B8B05B64756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ta as B,ua as C,wa as E}from"./chunk-yer1r3t3.js";import{
|
|
2
|
+
import{ta as B,ua as C,wa as E}from"./chunk-yer1r3t3.js";import{hh as x,jh as z,kh as A}from"./chunk-9tpx9ag3.js";function M(b,f={}){let j=B(b,f.sourceLocale);return G(E(b),j,(q)=>C(b,q,j))}function N(b,f){let j=Object.keys(f);return G(b,j,(q)=>{let v=f[q]??f[j[0]];if(!v)return{};return v().then((k)=>k.default)})}function G(b,f,j){let q={id:b,locales:f,load:j};x(q);let v=()=>x(q);return{id:b,locales:f,load:(k)=>{return v(),z(b,k)},loadForRender:(k)=>{return v(),A(b,k)},get:(k)=>{v();let w=z(b,k);if(w instanceof Promise){w.catch(()=>{});return}return w}}}
|
|
3
3
|
export{M as ba,N as ca};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=B0CAC6E79DCE953264756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import {\n dictionaryId,\n dictionaryLocales,\n localeStrings,\n type DictionaryTranslations,\n type LocaleStrings,\n} from \"./dictionaryShape\";\nimport {\n loadDictionary,\n loadDictionaryForRender,\n registerDictionary,\n type RenderThenable,\n} from \"./dictionaryRegistry\";\n\ndeclare const brand: unique symbol;\n\nexport interface DictionaryHandle<\n T extends DictionaryTranslations = DictionaryTranslations,\n> {\n readonly id: string;\n /** Locales this dictionary declares, source language first. */\n readonly locales: readonly string[];\n /**\n * Strings for `locale`. Synchronous when they are already in memory —\n * always, for an unbundled dictionary; after a preload or the SSR seed, for a\n * bundled one.\n */\n load(locale: string): LocaleStrings | Promise<LocaleStrings>;\n /**\n * `load`, but as the exact thing React's `use()` wants: never rejecting, so\n * a failed locale chunk degrades the component to rendering keys instead of\n * unmounting it into an error boundary; and always a thenable, even when the\n * strings are already in memory. The caller skips `use()` only for a\n * thenable built from strings already in hand, which carries them as\n * `inHand`; every thenable a render could have suspended on still goes\n * through it. `loadDictionaryForRender` has the whole reasoning.\n */\n loadForRender(locale: string): RenderThenable;\n get(locale: string): LocaleStrings | undefined;\n /** Type-only: carries the literal's shape through to `useDictionary`. */\n readonly [brand]?: T;\n}\n\n/**\n * Declare the strings a component needs, next to the component.\n *\n * ```ts\n * export const homeDict = defineDictionary({\n * title: { \"en-US\": \"Welcome {{name}}\", \"tr-TR\": \"Hoş geldin {{name}}\" },\n * });\n * ```\n *\n * As written this holds every locale. Under gemi's Vite plugin the call is\n * rewritten so each locale becomes its own chunk and a page downloads only the\n * one it renders in — but the plugin is strictly an optimization, and the\n * behaviour is identical without it (in `bun test`, and in server code that\n * does not go through the bundler).\n *\n * The first locale in the literal is the source language: a key missing from\n * another locale falls back to it rather than rendering as its own key.\n */\nexport interface DefineDictionaryOptions {\n /**\n * The locale this dictionary is authored in. Keys missing from another locale\n * fall back to it, and it is what renders when the app has no locale\n * configured.\n *\n * Optional, but worth setting on any dictionary that is not uniformly\n * translated: without it the source language is whichever locale appears\n * first in the literal, so adding a key at the top can re-point every\n * fallback in the dictionary.\n */\n sourceLocale?: string;\n}\n\nexport function defineDictionary<const T extends DictionaryTranslations>(\n translations: T,\n options: DefineDictionaryOptions = {},\n): DictionaryHandle<T> {\n const locales = dictionaryLocales(translations, options.sourceLocale);\n return createHandle(dictionaryId(translations), locales, (locale) =>\n localeStrings(translations, locale, locales),\n );\n}\n\n/**\n * The rewritten form of a `defineDictionary` call — emitted by\n * `packages/gemi/vite/dictionaryPlugin.ts`, never written by hand. `loaders`\n * holds one dynamic import per locale so the bundler emits one chunk per\n * locale and the untaken ones never reach the browser.\n */\nexport function __gemi_dict__<\n const T extends DictionaryTranslations = DictionaryTranslations,\n>(\n id: string,\n loaders: Record<string, () => Promise<{ default: LocaleStrings }>>,\n): DictionaryHandle<T> {\n const locales = Object.keys(loaders);\n return createHandle(id, locales, (locale) => {\n // An unknown locale falls back to the source language, matching what\n // `localeStrings` does per key on the unbundled path.\n const load = loaders[locale] ?? loaders[locales[0]];\n if (!load) {\n return {};\n }\n return load().then((mod) => mod.default);\n });\n}\n\nfunction createHandle<T extends DictionaryTranslations>(\n id: string,\n locales: string[],\n load: (locale: string) => LocaleStrings | Promise<LocaleStrings>,\n): DictionaryHandle<T> {\n const entry = { id, locales, load };\n registerDictionary(entry);\n\n // Re-asserted on every read rather than only at construction. A handle is\n // created once, at module scope, but the registry it delegates to can be\n // emptied under it — a test's `afterEach` reset, an HMR boundary — and the\n // handle would then be permanently orphaned, throwing \"Unknown dictionary\"\n // for a dictionary the caller is holding. `registerDictionary` is a no-op\n // when the id is already there, so this costs one Map lookup.\n const ensure = () => registerDictionary(entry);\n\n return {\n id,\n locales,\n // Routed through the registry rather than calling `load` directly so\n // concurrent readers share one in-flight import and results are cached.\n load: (locale: string) => {\n ensure();\n return loadDictionary(id, locale);\n },\n loadForRender: (locale: string) => {\n ensure();\n return loadDictionaryForRender(id, locale);\n },\n get: (locale: string) => {\n ensure();\n const strings = loadDictionary(id, locale);\n if (strings instanceof Promise) {\n // Nothing downstream awaits this one — `get` is the synchronous peek,\n // and the caller is about to discard it. An unattached rejection (a\n // locale chunk that 404s mid-deploy) would surface as an\n // `unhandledRejection`, which under Node's default handler takes the\n // process down over one missing translation file. The load itself is\n // still cached and still retried through `loadDictionary`.\n strings.catch(() => {});\n return undefined;\n }\n return strings;\n },\n };\n}\n\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";wHA2EO,GAAS,CAAwD,CACtE,EACA,EAAmC,CAAC,EACf,CACrB,IAAM,EAAU,EAAkB,EAAc,EAAQ,YAAY,EACpE,OAAO,EAAa,EAAa,CAAY,EAAG,EAAS,CAAC,IACxD,EAAc,EAAc,EAAQ,CAAO,CAC7C,EASK,SAAS,CAEf,CACC,EACA,EACqB,CACrB,IAAM,EAAU,OAAO,KAAK,CAAO,EACnC,OAAO,EAAa,EAAI,EAAS,CAAC,IAAW,CAG3C,IAAM,EAAO,EAAQ,IAAW,EAAQ,EAAQ,IAChD,GAAI,CAAC,EACH,MAAO,CAAC,EAEV,OAAO,EAAK,EAAE,KAAK,CAAC,IAAQ,EAAI,OAAO,EACxC,EAGH,SAAS,CAA8C,CACrD,EACA,EACA,EACqB,CACrB,IAAM,EAAQ,CAAE,KAAI,UAAS,MAAK,EAClC,EAAmB,CAAK,EAQxB,IAAM,EAAS,IAAM,EAAmB,CAAK,EAE7C,MAAO,CACL,KACA,UAGA,KAAM,CAAC,IAAmB,CAExB,OADA,EAAO,EACA,EAAe,EAAI,CAAM,GAElC,cAAe,CAAC,IAAmB,CAEjC,OADA,EAAO,EACA,EAAwB,EAAI,CAAM,GAE3C,IAAK,CAAC,IAAmB,CACvB,EAAO,EACP,IAAM,EAAU,EAAe,EAAI,CAAM,EACzC,GAAI,aAAmB,QAAS,CAO9B,EAAQ,MAAM,IAAM,EAAE,EACtB,OAEF,OAAO,EAEX",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "B0CAC6E79DCE953264756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Kb as e}from"./chunk-3z9vhjd7.js";import{Vb as l,Xb as g,Zb as YZ,_b as UZ,ac as _Z}from"./chunk-beks65me.js";import{cc as WZ,fc as OZ,hc as HZ,ic as zZ,jc as q,kc as VZ,lc as KZ,nc as XZ}from"./chunk-ga7c7tq0.js";import{qc as I}from"./chunk-f1y8eggf.js";import{Cd as f,Hc as xZ,Kd as o,Lc as a,Md as m,Qd as r,Sc as PZ,Yd as y,ae as R,be as u,ce as d,nd as j,xd as CZ,yd as s}from"./chunk-4sb1484x.js";import{Ae as i,ze as BZ}from"./chunk-9hr0bcfy.js";import{Sf as h,gg as t,ig as v,jg as w,kg as k}from"./chunk-j0sncgxc.js";import{xg as GZ,zg as P}from"./chunk-b1mk12xg.js";import{Ag as B}from"./chunk-hfyxvdjj.js";import{Gg as NZ}from"./chunk-57edag57.js";import{uh as n}from"./chunk-6w79zajj.js";import{Ah as JZ,Dh as b}from"./chunk-eazqda9z.js";async function kZ(Z,$={}){try{if(!await Z.shouldRun.call(Z))return}catch(W){console.error(`Error evaluating shouldRun for cron job ${Z.name}:`,W);return}let G=MZ(Z.withoutOverlapping);if(!Z.onOneServer&&G===void 0){await p(Z);return}let H;try{if(H=$.locks?.()??yZ(),Z.onOneServer){let W=Math.floor(($.now??Date.now())/60000);if(!await H.store.advance(`gemi:cron-tick:${Z.name}`,W))return}}catch(W){console.error(`Could not claim the tick of cron job ${Z.name}; skipped it:`,W);return}if(G===void 0){await p(Z);return}try{await H.run(`gemi:cron:${Z.name}`,{ttl:G},(W)=>p(Z,W))}catch(W){if(W instanceof GZ)console.error(`Cron job ${Z.name} lost its withoutOverlapping lock while running: another tick may have started alongside it.`,W);else console.error(`Could not take the withoutOverlapping lock of cron job ${Z.name}:`,W)}}var ZZ=300000;function MZ(Z){if(!Z)return;if(Z===!0)return ZZ;return Z.expiresAfter??ZZ}var $Z;function yZ(){return $Z??=new P(new WZ),$Z}async function p(Z,$){try{await Z.onTick.call(Z)}catch(G){console.error(`Error executing cron job ${Z.name}:`,G)}try{await Z.callback.call(Z,$)}catch(G){console.error(`Error in cron job ${Z.name}:`,G)}try{await Z.onComplete.call(Z)}catch(G){console.error(`Error completing cron job ${Z.name}:`,G)}}class F{static token="scheduler";handles=[];resolved;inFlight=new Map;stopped=!1;locks;constructor(Z){this.resolved=Z.jobs}get jobs(){return[...this.resolved]}useJobs(Z){this.resolved=Z}useLocks(Z){this.locks=Z}start(Z=($)=>$()){if(this.stopped=!1,this.resolved.length===0)return;let $=globalThis.__gemiCronJobs??=new Map,G=new Map;for(let H of this.resolved){let W=new H;if(!W.name){console.error(`Cron job must have a name \u2014 ${H.name||"an anonymous class"} has none, so it is not scheduled. If this is a base class that other jobs extend, move it out of the discovered directory: \`abstract\` does not survive to runtime, so a class under app/cron is indistinguishable from a job.`);continue}if(!W.cron){console.error(`Cron job must have an expression. Job: ${W.name}`);continue}let z=G.get(W.name);if(z!==void 0){console.error(`Two cron jobs claim the name "${W.name}" \u2014 ${z} is scheduled and ${H.name||"an anonymous class"} is not. A name is the scheduler's key, so only one job can hold it. Rename one.`);continue}G.set(W.name,H.name||"an anonymous class"),$.get(W.name)?.stop();let Y=Bun.cron(W.cron,()=>{if(this.stopped)return;let V=this.locks;return this.track(W.name,()=>Z(()=>kZ(W,{locks:V})))});$.set(W.name,Y),this.handles.push(Y)}}stop(){this.stopped=!0;for(let Z of this.handles)Z.stop();this.handles=[]}async drain(Z=1/0){this.stop();let $,G=new Promise((H)=>{if(Z!==1/0)$=setTimeout(H,Z)});return await Promise.race([Promise.allSettled([...this.inFlight.values()].map((H)=>H.done)),G]),clearTimeout($),{unfinished:[...this.inFlight.values()].map((H)=>({...H.tick}))}}get running(){return this.inFlight.size}track(Z,$){let G={},H=Promise.resolve().then($).finally(()=>this.inFlight.delete(G));return this.inFlight.set(G,{tick:{name:Z,startedAt:new Date},done:H}),H}}import{isMainThread as wZ}from"worker_threads";var fZ=100,bZ=(Z)=>Math.min(fZ,Math.floor(Z/10));class gZ extends I{register(){this.app.singleton(q,()=>new q(this.app.config.get("queue",{}),{application:this.app})),this.app.singleton(P,()=>this.app.make(q).locks)}async boot(){let Z=this.app.config.get("queue",{});if(Z.jobs!==void 0)return;let{jobsDir:$}=B(HZ(),Z);this.app.make(q).useJobs(await YZ($))}async shutdown(Z){if(!this.app.resolved(q))return;let $=this.app.make(q);if($.running>0)console.log(`[gemi] Shutting down: waiting for ${$.running} running queued job(s).`);let G=Z?.timeoutMs,{unfinished:H}=await $.drain(G===void 0?1/0:Math.max(0,G-bZ(G)));if(H.length>0)return console.error("[gemi] Queued jobs still running at shutdown: "+H.map((W)=>`${W.name} (${W.id})`).join(", ")),{abandoned:!0}}}function T3(Z){if(mZ(Z),Bun.env.NODE_ENV!=="production")return hZ(Z);if(IZ(Z))return;if(!VZ())return;if(!Z.bound(q))return;Z.make(q).start()}function IZ(Z){let $=Z.config.get("queue",{}).driver??"memory";return $==="memory"||$ instanceof zZ}function vZ(Z){if(IZ(Z))return!0;if(typeof Z.config.get("queue",{}).driver!=="function"||!Z.bound(q))return!1;try{return!Z.make(q).durable}catch{return!1}}function mZ(Z){let $=process.env.GEMI_QUEUE_CLAIM;if($===void 0||XZ())return;if(process.env.ROOT_DIR===void 0||!wZ)return;if(KZ()){if(!vZ(Z))return;console.warn('[gemi] GEMI_QUEUE_CLAIM=off is ignored: the memory queue driver keeps jobs in the process that dispatched them, so no worker could run them. This server runs its own jobs. Use a driver other processes can read, such as "database", to hand jobs to `gemi queue:work`.')}else if($.trim().toLowerCase()!=="on")console.warn(`[gemi] GEMI_QUEUE_CLAIM="${$}" is not "off" or "on", so this server claims jobs. Set it to "off" to leave them to \`gemi queue:work\`.`)}function hZ(Z){let $=globalThis.__gemiDevQueue;if(!$)return;if(globalThis.__gemiDevQueue=void 0,$.stop(),Z.bound(q))Z.make(q).start()}class cZ extends I{register(){this.app.singleton(j,()=>new j(this.app.config.get("changeFeed",{}),{application:this.app}))}async shutdown(){if(!this.app.resolved(j))return;await this.app.make(j).close()}}class uZ extends I{register(){this.app.singleton(d,()=>new d(this.app.config.get("auth",{})))}}var pZ=100,dZ=(Z)=>Math.min(pZ,Math.floor(Z/10));class lZ extends I{register(){this.app.singleton(F,()=>new F(B(l(),this.app.config.get("schedule",{}))))}async boot(){let Z=this.app.make(F),$=this.app.config.get("schedule",{});if($.jobs===void 0){let{jobsDir:H}=B(l(),$);Z.useJobs(await UZ(H))}if(process.env.GEMI_NO_SCHEDULE==="1")return;let G=this.app;if(G.bound(P))Z.useLocks(()=>G.make(P));Z.start((H)=>JZ.run(G,H))}async shutdown(Z){if(!this.app.resolved(F))return;let $=this.app.make(F);if($.running>0)console.log(`[gemi] Shutting down: waiting for ${$.running} running cron tick(s).`);let G=Z?.timeoutMs,{unfinished:H}=await $.drain(G===void 0?1/0:Math.max(0,G-dZ(G)));if(H.length>0)return console.error("[gemi] Cron jobs still running at shutdown: "+H.map((W)=>`${W.name} (started ${W.startedAt.toISOString()})`).join(", ")),{abandoned:!0}}}class T extends CZ{modelName;constructor(Z="FeatureFlag"){super();this.modelName=Z}get available(){return BZ(this.modelName)}async load(){if(!this.available)throw new s(this.modelName);let Z=i(this.modelName);return await Z.asSystem(()=>Z.findMany())}async write(Z,$,G){if(!this.available)throw new s(this.modelName);let H=i(this.modelName),W=this.hasActorColumn(H),z={active:$};if(W)z.updatedBy=G.actor;return await H.asSystem(()=>H.upsert({where:{key:Z},create:{key:Z,...z},update:z})),{actorRecorded:W}}hasActorColumn(Z){let $=Z?.$schema?.fields?.updatedBy;return $!==void 0&&$.type==="String"}}function i3(Z){return Z}function qZ(){return{features:void 0,enabled:!0,source:new T,model:"FeatureFlag",ttl:30,context:void 0,onEvaluate:void 0,maxClientFlags:200}}class iZ extends I{register(){this.app.singleton(f,()=>{let Z=this.app.config.get("features",{}),$=B(qZ(),Z);if(Z?.model!==void 0&&Z?.source===void 0)$.source=new T(Z.model);else if(Z?.model!==void 0&&Z.source instanceof T&&Z.source.modelName!==Z.model)w.warning(`app/config/features.ts sets \`model: "${Z.model}"\` and a source reading "${Z.source.modelName}". The source wins; drop \`model\` to silence this.`);return new f($,(G)=>w.warning(G))})}async boot(){let Z=this.app.make(f);if(!Z.config.enabled)return;try{await Z.refresh()}catch($){w.error(`Could not warm the feature flag cache at boot. ${$ instanceof Error?$.message:String($)}`)}}}class sZ extends I{register(){this.app.singleton(n,()=>new n(this.app.config.get("mail",{})))}}function nZ(Z){return`listener:${Z}`}function QZ(Z,$){tZ(Z);let{maxAttempts:G,backoff:H,worker:W}=$,z=Z.event.name,Y=class extends OZ{maxAttempts=G;backoff=H;worker=W;async run(...V){let[K,J]=oZ(V),C=b(L).rehydrate(K,J);await new Z().handle(C)}onFail(V){console.error(`The listener ${Z.name} threw while handling ${z} off the queue. The queue will retry it up to ${G} times in total; nothing the dispatcher did is waiting on it.`,V)}onDeadletter(V){console.error(`The listener ${Z.name} failed every one of its ${G} attempts at ${z} and has been dead-lettered, so this side effect did not happen and will not be retried.`,V)}};return Object.defineProperty(Y,"name",{value:nZ(Z.name),writable:!0}),Y}function tZ(Z){if(Object.getOwnPropertyDescriptor(Z,"name")?.writable)return;throw Error(`The listener ${Z.name} sets \`queued = true\` but does not declare \`static name\`, so it would be registered with the queue `+"under its class name \u2014 which a production build renames while the "+`payload that names it does not. Add: static name = "${Z.name}";`)}function oZ(Z){return typeof Z[0]==="string"?Z:Z[0]}class L{static token="events";listeners={};events={};warnedFor=new Set;warnedAboutWaiting=new Set;config;constructor(Z={}){this.config=B(g(),Z),this.useListeners(this.config.listeners)}useListeners(Z){this.config.listeners=Z,this.listeners={},this.events={};let $=new Set;for(let G of Z){if(!G.event){console.error(`Listener ${G.name} does not declare \`static event\`, so there is no event name to register it under and its handle will never run. Add: static event = SomeEvent;`);continue}if($.has(G.name)){console.error(`Two event listeners are named "${G.name}" \u2014 the first is `+"registered and this one is not. A listener's name identifies it across the framework, so only one class can hold it. Rename one.");continue}$.add(G.name);let H=G.event.name,W=new G;this.events[H]??=G.event,(this.listeners[H]??=[]).push({listener:G,job:W.queued?QZ(G,W):null})}}get queuedListenerJobs(){return Object.values(this.listeners).flat().flatMap(({job:Z})=>Z?[Z]:[])}get registeredListeners(){return[...this.config.listeners]}dispatch(Z,$){if(this.deferToCommit(Z,$,!1))return;this.runListeners(Z,$)}async dispatchAndWait(Z,$){if(this.deferToCommit(Z,$,!0))return;return this.runListeners(Z,$)}deferToCommit(Z,$,G){let{name:H,afterCommit:W}=Z.constructor;if(!W)return!1;let z=NZ(()=>this.runListeners(Z,$));if(z&&G)this.warnNothingIsWaitedFor(H);return z}async runListeners(Z,$){let G=Z.constructor.name,H=this.listeners[G];if(!H?.length){this.warnNothingIsListening(G);return}for(let{listener:W,job:z}of H){if(z){this.enqueue(z,W,G,$);continue}try{await new W().handle(Z)}catch(Y){console.error(`The listener ${W.name} threw while handling ${G}. The `+"listeners after it still ran \u2014 a listener's failure is its own.",Y)}}}rehydrate(Z,$=[]){let G=this.events[Z];if(!G)throw Error(`Cannot rebuild the event "${Z}" that came off the queue: no registered listener binds to an event of that name, so there is no class to construct. A queued listener runs in an application that `+"discovered its own listeners \u2014 check that this process sees the "+`same app/listeners as the one that dispatched, and that the event declares \`static name = "${Z}"\`.`);return new G(...$)}enqueue(Z,$,G,H){if(H===void 0){console.error(`The listener ${$.name} is queued, but ${G} reached the dispatcher without its constructor arguments, so there is nothing for the queue to rebuild it from and the listener was skipped. Dispatch through ${G}.dispatch(...) or ${G}.dispatchAndWait(...), which carry them.`);return}let W=(z)=>console.error(`The listener ${$.name} could not be queued for ${G}, so it did not run and will not be retried. The listeners after it still ran.`,z);try{b(q).push(Z,JSON.stringify([G,H]),{reportFailure:!1}).catch(W)}catch(z){W(z)}}warnNothingIsWaitedFor(Z){if(Bun.env.NODE_ENV==="production")return;if(this.warnedAboutWaiting.has(Z))return;this.warnedAboutWaiting.add(Z),console.warn(`[gemi] ${Z}.dispatchAndWait() was called inside a transaction and ${Z} declares \`static afterCommit = true\`, so it resolved `+"immediately with no listener having run \u2014 they run when the "+"transaction commits. Await the transaction instead, or drop afterCommit if the caller needs the side effects first. Development only.")}warnNothingIsListening(Z){if(Bun.env.NODE_ENV==="production")return;if(this.warnedFor.has(Z))return;this.warnedFor.add(Z),console.warn(`[gemi] ${Z} was dispatched and nothing is listening for it. A listener registers under the name its event declares, so check that app/listeners holds a Listener with \`static event = ${Z}\` and that ${Z} declares \`static name = "${Z}"\`. Development only.`)}}class rZ extends I{register(){this.app.singleton(L,()=>new L(this.app.config.get("events",{})))}async boot(){let Z=this.app.make(L),$=this.app.config.get("events",{});if($.listeners===void 0){let{listenersDir:W}=B(g(),$);Z.useListeners(await _Z(W))}let G=Z.queuedListenerJobs;if(G.length===0)return;let H=this.app.make(q);for(let W of G)H.registerJob(W)}}class aZ extends I{register(){this.app.singleton(t,()=>new t(this.app.config.get("filesystem",{})))}}class eZ extends I{register(){this.app.singleton(o,()=>new o(this.app.config.get("image",{})))}}class Z3 extends I{register(){this.app.instance(r,new r)}}function M4(Z){return Z}function AZ(){return{maxFileSize:10485760,onLogFileClosed:()=>{},onLogCreated:()=>{}}}class $3 extends I{register(){this.app.singleton(v,()=>new v(B(AZ(),this.app.config.get("log",{}))))}async boot(){if(!process.env.ROOT_DIR)return;await this.app.make(v).boot()}}class G3 extends I{register(){this.app.singleton(m,()=>new m(B(xZ(),this.app.config.get("middleware",{}))))}boot(){this.app.make(m).assertGlobalMiddleware()}}function l4(Z){return Z}function FZ(){return{driver:new PZ,limit:1000,window:60}}class W3 extends I{register(){this.app.singleton(a,()=>new a(B(FZ(),this.app.config.get("ratelimiter",{}))))}}function a4(Z){return Z}function LZ(){return{url:process.env.REDIS_URL,options:void 0}}class H3 extends I{register(){this.app.singleton(k,()=>new k(B(LZ(),this.app.config.get("redis",{}))))}shutdown(){if(!this.app.resolved(k))return;this.app.make(k).close()}}class N extends e{status;constructor(Z,$){super(Z);this.status=$;this.name="McpToolError"}}var z3=/^[A-Za-z0-9_-]{1,64}$/,V3=/:([A-Za-z_][A-Za-z0-9_]*)([?*+]?)/g,SZ=4000,E=1e5,K3=/^(text\/|application\/([\w.+-]*\+)?(json|xml))/i;class M{router;dispatcher;static token="router.mcp";plans=new Map;constructor(Z,$){this.router=Z;this.dispatcher=$;for(let[G,H]of Object.entries(Z.routes??{}))this.plans.set(G,this.plan(G,H))}list(Z,$){return TZ(Z),this.descriptors($)}descriptors(Z){let $=[];for(let{descriptor:G}of this.plans.values()){if(Z?.names&&!Z.names.includes(G.name))continue;if(Z?.tags&&!G.tags.some((H)=>Z.tags.includes(H)))continue;$.push(G)}return $}async execute(Z,$,G,H){TZ(Z);let W=this.plans.get($);if(!W)throw Error(`McpRegistry: there is no tool named "${$}".`);let{descriptor:z}=W,Y=z.inputSchema.safeParse(G);if(Y.ok===!1)throw new N(`Invalid arguments for "${$}": ${Y.errors.join(", ")}`);let V=Y.value,K={caller:Z,req:Z.req,tool:z,input:V,ctx:H},J=await this.fillPath(W,K),{path:C}=this.dispatcher.getRouteHandlerAndParams(new Request(`http://gemi.internal/api${J}`));if(C!==z.url)throw new N(`"${$}" has nothing at ${J}.`,404);let U={};for(let _ of W.jsonKeys)if(V[_]!==void 0)U[_]=V[_];let Q,A="";if(W.fileFields.length>0)Q=await this.formData(W,U,K);else if(z.method==="GET")A=U3(U);else if(W.jsonKeys.length>0)Q=U;let D=this.router.credentials?await this.bind(W,"the credentials",()=>this.router.credentials(K)):void 0,S;try{let _=A?`${J}?${A}`:J;S=D?await this.dispatcher.dispatchAs(Z.req,z.method,_,Q,{credentials:D}):await this.dispatcher.dispatchAs(Z.req,z.method,_,Q)}catch(_){throw console.error(`[gemi/mcp] Dispatching "${$}" failed:`,_),new N(`"${$}" failed on the server.`,500)}if(!W.result&&!z.outputSchema)return await DZ($,S);return await this.project(W,K,S)}plan(Z,$){if(!z3.test(Z))throw Error(`McpRouter: "${Z}" is not a valid tool name. A routes key is the tool's name as a model and an MCP client see it, used verbatim \u2014 letters, digits, "_" and "-", at most 64.`);let G=`McpRouter: "${Z}" (${$?.method} ${$?.url})`;if(!($ instanceof Object)||$.__internal_brand!=="McpRoute")throw Error(`McpRouter: "${Z}" is not a route. Declare it with this.fromApiRoute(...).`);let{method:H,url:W,meta:z}=$;if(W.startsWith("/__gemi__"))throw Error(`${G} is a framework route, not an app route.`);let Y=this.dispatcher.flatRoutes[W]?.[H];if(!Y)throw Error(`${G} names no route of this app. Expose a route by the path and verb it is mounted at.`);let V=[...W.matchAll(V3)].map(([,X,O])=>({name:X,modifier:O})),K=z.params??{};for(let X of V)if(!(X.name in K))throw Error(`${G}: the path param "${X.name}" must be bound or declared "input".`);for(let[X,O]of Object.entries(K)){if(!V.some((x)=>x.name===X))throw Error(`${G}: "${X}" in params is not a param of the url.`);if(RZ(O))X3(G,`params.${X}`,O);else EZ(G,`params.${X}`,O)}let J=[],C;if(z.input){if(C=z.input.toJSONSchema(),C.type!=="object"||!C.properties)throw Error(`${G}: input must be an s.object(...), the fields of the request body.`);J=Object.keys(C.properties)}let U=Object.entries(z.files??{}).map(([X,O])=>({name:X,binder:O}));for(let X of U)EZ(G,`files.${X.name}`,X.binder);if(z.result!==void 0&&typeof z.result!=="function")throw Error(`${G}: result must be a function.`);if(z.output!==void 0&&typeof z.output?.safeParse!=="function")throw Error(`${G}: output must be a schema, built with s.`);if(U.length>0&&H==="GET")throw Error(`${G}: a GET has no body to carry a file.`);let Q={},A=(X,O)=>{if(X in Q)throw Error(`${G}: "${X}" is the input key of two params or files, and the model can only send one.`);Q[X]=O},D=new Map,S=new Map;for(let X of V){let O=K[X.name];if(O==="input"){let x=h.string().describe(`The ":${X.name}" segment of the url.`);A(X.name,X.modifier==="?"||X.modifier==="*"?x.optional():x)}else if(RZ(O)){let x=O.as??X.name;A(x,O.input),S.set(X.name,{key:x,param:O})}else D.set(X.name,O)}for(let X of U)if(X.binder==="input")A(X.name,h.string().describe("The id of an attachment the user uploaded or a tool produced (gemi_att_\u2026), whose file is sent as this field."));let _=[...Object.keys(Q),...U.map((X)=>X.name)];for(let X of new Set(_))if(J.includes(X))throw Error(`${G}: "${X}" is both an input field and a param or file, and the model can only send one.`);return{descriptor:Object.freeze({name:Z,description:z.description,method:H,url:W,inputSchema:I3(z.input,C,h.object(Q)),...z.output?{outputSchema:z.output}:{},annotations:Y3(H),tags:Object.freeze([...z.tags??[]]),requiresApproval:z.requiresApproval===!0,...Y.source?{source:Y.source}:{}}),params:V,paramBinders:D,modelParams:S,fileFields:U,jsonKeys:J,...z.result?{result:z.result}:{}}}async fillPath(Z,$){let{input:G,req:H}=$,W=Z.descriptor.url;for(let z of Z.params){let Y=Z.paramBinders.get(z.name),V=Z.modelParams.get(z.name),K;if(Y||V){if(K=V?await this.bind(Z,`the param "${z.name}"`,()=>V.param.bind(G[V.key],H,$),{refusals:!0}):await this.bind(Z,`the param "${z.name}"`,()=>Y(H,$)),K===void 0||K===null||K==="")throw console.error(`[gemi/mcp] The ${V?"resolver":"binder"} for "${z.name}" of "${Z.descriptor.name}" returned ${JSON.stringify(K)}.`),new N(`"${Z.descriptor.name}" failed on the server.`,500)}else K=G[z.name];let J=`:${z.name}${z.modifier}`;if(K===void 0||K===null||K===""){if(z.modifier!=="?"&&z.modifier!=="*")throw new N(`"${z.name}" of "${Z.descriptor.name}" must not be empty.`);W=W.replace(`/${J}`,"");continue}W=W.replace(J,J3(Z.descriptor.name,z,String(K)))}return W}async formData(Z,$,G){let{input:H,ctx:W}=G,z=Z.descriptor.name;if(!W)throw Error(`McpRegistry: "${z}" sends a file, which is resolved through the tool context's attachments, and none was passed to execute().`);let Y=new FormData;for(let[V,K]of Object.entries($))jZ(Y,V,K);for(let V of Z.fileFields){let K=V.binder==="input"?H[V.name]:await this.bind(Z,`the file "${V.name}"`,()=>V.binder(W,G));if(typeof K!=="string"||K==="")throw new N(`"${z}" needs a file for "${V.name}", and this turn has none. Ask the user to attach one.`);Y.append(V.name,await W.attachments.file(K))}return Y}async project(Z,$,G){let{name:H,outputSchema:W}=Z.descriptor;if(G.status<200||G.status>=300)return await DZ(H,G);let z=(U,Q)=>{if(Q===void 0)console.error(`[gemi/mcp] "${H}" ${U}`);else console.error(`[gemi/mcp] "${H}" ${U}`,Q);return new N(`"${H}" failed on the server.`,500)},Y=G.headers.get("Content-Type"),V=await G.text(),K=null;if(V!=="")try{K=JSON.parse(V)}catch{throw z(`answered ${Y??"a body with no content-type"} that is not JSON, and its result or output needs JSON.`)}let J=K;if(Z.result)try{J=await Z.result(K,$)}catch(U){throw z("failed in its result projection:",U)}if(W){let U=W.safeParse(J);if(U.ok===!1)throw z(`answered what its output schema refuses: ${U.errors.join(", ")}`);J=U.value}if(J===void 0)return null;let C=JSON.stringify(J);if(C!==void 0&&C.length>E)return`${C.slice(0,E)}\u2026 [cut at ${E} of ${C.length} characters]`;return J}async bind(Z,$,G,H={}){try{return await G()}catch(W){if(H.refusals&&W instanceof e)throw W;throw console.error(`[gemi/mcp] Binding ${$} of "${Z.descriptor.name}" failed:`,W),new N(`"${Z.descriptor.name}" failed on the server.`,500)}}}function TZ(Z){if(Z?.kind!=="local")throw Error("McpRegistry: only local callers are implemented. A remote caller needs a bearer-token resolver, which v1 does not have \u2014 and until it does there is no remote surface to call from.")}function EZ(Z,$,G){if(G!=="input"&&typeof G!=="function")throw Error(`${Z}: ${$} must be a function or "input".`)}function RZ(Z){return Z instanceof Object&&Z.__internal_brand==="McpModelParam"}function X3(Z,$,G){if(G.as!==void 0&&(typeof G.as!=="string"||G.as===""))throw Error(`${Z}: ${$}.as must be a non-empty string.`);let H=G.input;if(typeof H?.safeParse!=="function"||typeof H.toJSONSchema!=="function")throw Error(`${Z}: ${$}.input must be a schema, built with s.`);if(typeof G.bind!=="function")throw Error(`${Z}: ${$}.bind must be a function.`)}function Y3(Z){switch(Z){case"GET":return Object.freeze({readOnlyHint:!0});case"DELETE":return Object.freeze({destructiveHint:!0});case"PUT":return Object.freeze({idempotentHint:!0});default:return Object.freeze({})}}function I3(Z,$,G){let H=G.toJSONSchema(),W={...$??{},type:"object",properties:{...$?.properties??{},...H.properties},required:[...$?.required??[],...H.required??[]],additionalProperties:!1},z=(Y)=>{if(typeof Y!=="object"||Y===null||Array.isArray(Y))return{ok:!1,errors:["expected an object"]};let V=[],K={};if(Z){let C=Z.safeParse(Y);if(C.ok===!1)V.push(...C.errors);else K={...C.value}}let J=G.safeParse(Y);if(J.ok===!1)V.push(...J.errors);else K={...K,...J.value};return V.length>0?{ok:!1,errors:V}:{ok:!0,value:K}};return{toJSONSchema:()=>W,safeParse:z,parse(Y){let V=z(Y);if(V.ok===!1)throw Error(V.errors.join(", "));return V.value}}}function J3(Z,$,G){let H=$.modifier==="*"||$.modifier==="+"?G.split("/"):[G];if(H.some((W)=>W==="."||W===".."))throw new N(`"${G}" is not a valid value for "${$.name}" of "${Z}".`);return H.map(encodeURIComponent).join("/")}function jZ(Z,$,G){if(G===void 0||G===null)return;if(Array.isArray(G)){for(let H of G)jZ(Z,$,H);return}Z.append($,typeof G==="object"?JSON.stringify(G):String(G))}function U3(Z){let $=new URLSearchParams,G=(H,W)=>{if(W===void 0||W===null)return;if(Array.isArray(W)){for(let z of W)G(H,z);return}$.append(H,typeof W==="object"?JSON.stringify(W):String(W))};for(let[H,W]of Object.entries(Z))G(H,W);return $.toString()}async function DZ(Z,$){if($.status>=200&&$.status<300){let H=$.headers.get("Content-Type");if(H&&!K3.test(H)){let z=(await $.arrayBuffer()).byteLength;return`"${Z}" answered with ${z} bytes of ${H}, which is not shown.`}let W=await $.text();if(W==="")return null;if(W.length>E)return`${W.slice(0,E)}\u2026 [cut at ${E} of ${W.length} characters]`;try{return JSON.parse(W)}catch{return W}}let G=await $.text();if($.status>=400&&$.status<500){let H=G.length>SZ?`${G.slice(0,SZ)}\u2026`:G;throw new N(`"${Z}" was refused with ${$.status}${H?`: ${H}`:"."}`,$.status)}if($.status<500)console.error(`[gemi/mcp] "${Z}" answered ${$.status}${$.headers.get("Location")?` to ${$.headers.get("Location")}`:""}, which a tool call cannot follow.`);throw new N(`"${Z}" failed on the server.`,$.status)}function c(Z,$){let G=Z.get($);if(!G)throw Error(`Missing "${$}" configuration. Route dispatching needs a root router \u2014 declare it in "app/config/route.ts".`);return G}class B3 extends I{register(){this.app.singleton(R,()=>new R(c(this.app.config,"route.api"))),this.app.singleton(y,()=>new y(c(this.app.config,"route.view"))),this.app.singleton(u,()=>new u({api:this.app.make(R),view:this.app.make(y)},{api:c(this.app.config,"route.api"),view:c(this.app.config,"route.view"),domains:this.app.config.get("route.domains")})),this.app.singleton(M,()=>{let Z=this.app.config.get("route.mcp");if(!Z?.router)throw Error('No MCP router is configured. Declare one as `mcp: { router }` in "app/config/route.ts".');return new M(new Z.router,this.app.make(R))})}boot(){if(this.app.make(R),this.app.make(y),this.app.make(u),this.app.config.get("route.mcp"))this.app.make(M)}}
|
|
2
|
+
import{Kb as e}from"./chunk-3z9vhjd7.js";import{Vb as l,Xb as g,Zb as YZ,_b as UZ,ac as _Z}from"./chunk-9vsj0ksk.js";import{cc as WZ,fc as OZ,hc as HZ,ic as zZ,jc as q,kc as VZ,lc as KZ,nc as XZ}from"./chunk-g8kx549d.js";import{qc as I}from"./chunk-f1y8eggf.js";import{Cd as f,Hc as xZ,Lc as a,Md as o,Od as m,Sc as PZ,Sd as r,_d as y,ce as R,de as u,ee as d,nd as j,xd as CZ,yd as s}from"./chunk-6g20zec2.js";import{Be as BZ,Ce as i}from"./chunk-qpttgn4k.js";import{Uf as h,ig as t,kg as v,lg as w,mg as k}from"./chunk-cqnfp0n9.js";import{Bg as P,zg as GZ}from"./chunk-c7mp2kyp.js";import{Cg as B}from"./chunk-y6v0x869.js";import{Ig as NZ}from"./chunk-4t1pbt9p.js";import{wh as n}from"./chunk-vqa3agzw.js";import{Ch as JZ,Fh as b}from"./chunk-z5hrymvn.js";async function kZ(Z,$={}){try{if(!await Z.shouldRun.call(Z))return}catch(W){console.error(`Error evaluating shouldRun for cron job ${Z.name}:`,W);return}let G=MZ(Z.withoutOverlapping);if(!Z.onOneServer&&G===void 0){await p(Z);return}let H;try{if(H=$.locks?.()??yZ(),Z.onOneServer){let W=Math.floor(($.now??Date.now())/60000);if(!await H.store.advance(`gemi:cron-tick:${Z.name}`,W))return}}catch(W){console.error(`Could not claim the tick of cron job ${Z.name}; skipped it:`,W);return}if(G===void 0){await p(Z);return}try{await H.run(`gemi:cron:${Z.name}`,{ttl:G},(W)=>p(Z,W))}catch(W){if(W instanceof GZ)console.error(`Cron job ${Z.name} lost its withoutOverlapping lock while running: another tick may have started alongside it.`,W);else console.error(`Could not take the withoutOverlapping lock of cron job ${Z.name}:`,W)}}var ZZ=300000;function MZ(Z){if(!Z)return;if(Z===!0)return ZZ;return Z.expiresAfter??ZZ}var $Z;function yZ(){return $Z??=new P(new WZ),$Z}async function p(Z,$){try{await Z.onTick.call(Z)}catch(G){console.error(`Error executing cron job ${Z.name}:`,G)}try{await Z.callback.call(Z,$)}catch(G){console.error(`Error in cron job ${Z.name}:`,G)}try{await Z.onComplete.call(Z)}catch(G){console.error(`Error completing cron job ${Z.name}:`,G)}}class F{static token="scheduler";handles=[];resolved;inFlight=new Map;stopped=!1;locks;constructor(Z){this.resolved=Z.jobs}get jobs(){return[...this.resolved]}useJobs(Z){this.resolved=Z}useLocks(Z){this.locks=Z}start(Z=($)=>$()){if(this.stopped=!1,this.resolved.length===0)return;let $=globalThis.__gemiCronJobs??=new Map,G=new Map;for(let H of this.resolved){let W=new H;if(!W.name){console.error(`Cron job must have a name \u2014 ${H.name||"an anonymous class"} has none, so it is not scheduled. If this is a base class that other jobs extend, move it out of the discovered directory: \`abstract\` does not survive to runtime, so a class under app/cron is indistinguishable from a job.`);continue}if(!W.cron){console.error(`Cron job must have an expression. Job: ${W.name}`);continue}let z=G.get(W.name);if(z!==void 0){console.error(`Two cron jobs claim the name "${W.name}" \u2014 ${z} is scheduled and ${H.name||"an anonymous class"} is not. A name is the scheduler's key, so only one job can hold it. Rename one.`);continue}G.set(W.name,H.name||"an anonymous class"),$.get(W.name)?.stop();let Y=Bun.cron(W.cron,()=>{if(this.stopped)return;let V=this.locks;return this.track(W.name,()=>Z(()=>kZ(W,{locks:V})))});$.set(W.name,Y),this.handles.push(Y)}}stop(){this.stopped=!0;for(let Z of this.handles)Z.stop();this.handles=[]}async drain(Z=1/0){this.stop();let $,G=new Promise((H)=>{if(Z!==1/0)$=setTimeout(H,Z)});return await Promise.race([Promise.allSettled([...this.inFlight.values()].map((H)=>H.done)),G]),clearTimeout($),{unfinished:[...this.inFlight.values()].map((H)=>({...H.tick}))}}get running(){return this.inFlight.size}track(Z,$){let G={},H=Promise.resolve().then($).finally(()=>this.inFlight.delete(G));return this.inFlight.set(G,{tick:{name:Z,startedAt:new Date},done:H}),H}}import{isMainThread as wZ}from"worker_threads";var fZ=100,bZ=(Z)=>Math.min(fZ,Math.floor(Z/10));class gZ extends I{register(){this.app.singleton(q,()=>new q(this.app.config.get("queue",{}),{application:this.app})),this.app.singleton(P,()=>this.app.make(q).locks)}async boot(){let Z=this.app.config.get("queue",{});if(Z.jobs!==void 0)return;let{jobsDir:$}=B(HZ(),Z);this.app.make(q).useJobs(await YZ($))}async shutdown(Z){if(!this.app.resolved(q))return;let $=this.app.make(q);if($.running>0)console.log(`[gemi] Shutting down: waiting for ${$.running} running queued job(s).`);let G=Z?.timeoutMs,{unfinished:H}=await $.drain(G===void 0?1/0:Math.max(0,G-bZ(G)));if(H.length>0)return console.error("[gemi] Queued jobs still running at shutdown: "+H.map((W)=>`${W.name} (${W.id})`).join(", ")),{abandoned:!0}}}function T3(Z){if(mZ(Z),Bun.env.NODE_ENV!=="production")return hZ(Z);if(IZ(Z))return;if(!VZ())return;if(!Z.bound(q))return;Z.make(q).start()}function IZ(Z){let $=Z.config.get("queue",{}).driver??"memory";return $==="memory"||$ instanceof zZ}function vZ(Z){if(IZ(Z))return!0;if(typeof Z.config.get("queue",{}).driver!=="function"||!Z.bound(q))return!1;try{return!Z.make(q).durable}catch{return!1}}function mZ(Z){let $=process.env.GEMI_QUEUE_CLAIM;if($===void 0||XZ())return;if(process.env.ROOT_DIR===void 0||!wZ)return;if(KZ()){if(!vZ(Z))return;console.warn('[gemi] GEMI_QUEUE_CLAIM=off is ignored: the memory queue driver keeps jobs in the process that dispatched them, so no worker could run them. This server runs its own jobs. Use a driver other processes can read, such as "database", to hand jobs to `gemi queue:work`.')}else if($.trim().toLowerCase()!=="on")console.warn(`[gemi] GEMI_QUEUE_CLAIM="${$}" is not "off" or "on", so this server claims jobs. Set it to "off" to leave them to \`gemi queue:work\`.`)}function hZ(Z){let $=globalThis.__gemiDevQueue;if(!$)return;if(globalThis.__gemiDevQueue=void 0,$.stop(),Z.bound(q))Z.make(q).start()}class cZ extends I{register(){this.app.singleton(j,()=>new j(this.app.config.get("changeFeed",{}),{application:this.app}))}async shutdown(){if(!this.app.resolved(j))return;await this.app.make(j).close()}}class uZ extends I{register(){this.app.singleton(d,()=>new d(this.app.config.get("auth",{})))}}var pZ=100,dZ=(Z)=>Math.min(pZ,Math.floor(Z/10));class lZ extends I{register(){this.app.singleton(F,()=>new F(B(l(),this.app.config.get("schedule",{}))))}async boot(){let Z=this.app.make(F),$=this.app.config.get("schedule",{});if($.jobs===void 0){let{jobsDir:H}=B(l(),$);Z.useJobs(await UZ(H))}if(process.env.GEMI_NO_SCHEDULE==="1")return;let G=this.app;if(G.bound(P))Z.useLocks(()=>G.make(P));Z.start((H)=>JZ.run(G,H))}async shutdown(Z){if(!this.app.resolved(F))return;let $=this.app.make(F);if($.running>0)console.log(`[gemi] Shutting down: waiting for ${$.running} running cron tick(s).`);let G=Z?.timeoutMs,{unfinished:H}=await $.drain(G===void 0?1/0:Math.max(0,G-dZ(G)));if(H.length>0)return console.error("[gemi] Cron jobs still running at shutdown: "+H.map((W)=>`${W.name} (started ${W.startedAt.toISOString()})`).join(", ")),{abandoned:!0}}}class T extends CZ{modelName;constructor(Z="FeatureFlag"){super();this.modelName=Z}get available(){return BZ(this.modelName)}async load(){if(!this.available)throw new s(this.modelName);let Z=i(this.modelName);return await Z.asSystem(()=>Z.findMany())}async write(Z,$,G){if(!this.available)throw new s(this.modelName);let H=i(this.modelName),W=this.hasActorColumn(H),z={active:$};if(W)z.updatedBy=G.actor;return await H.asSystem(()=>H.upsert({where:{key:Z},create:{key:Z,...z},update:z})),{actorRecorded:W}}hasActorColumn(Z){let $=Z?.$schema?.fields?.updatedBy;return $!==void 0&&$.type==="String"}}function i3(Z){return Z}function qZ(){return{features:void 0,enabled:!0,source:new T,model:"FeatureFlag",ttl:30,context:void 0,onEvaluate:void 0,maxClientFlags:200}}class iZ extends I{register(){this.app.singleton(f,()=>{let Z=this.app.config.get("features",{}),$=B(qZ(),Z);if(Z?.model!==void 0&&Z?.source===void 0)$.source=new T(Z.model);else if(Z?.model!==void 0&&Z.source instanceof T&&Z.source.modelName!==Z.model)w.warning(`app/config/features.ts sets \`model: "${Z.model}"\` and a source reading "${Z.source.modelName}". The source wins; drop \`model\` to silence this.`);return new f($,(G)=>w.warning(G))})}async boot(){let Z=this.app.make(f);if(!Z.config.enabled)return;try{await Z.refresh()}catch($){w.error(`Could not warm the feature flag cache at boot. ${$ instanceof Error?$.message:String($)}`)}}}class sZ extends I{register(){this.app.singleton(n,()=>new n(this.app.config.get("mail",{})))}}function nZ(Z){return`listener:${Z}`}function QZ(Z,$){tZ(Z);let{maxAttempts:G,backoff:H,worker:W}=$,z=Z.event.name,Y=class extends OZ{maxAttempts=G;backoff=H;worker=W;async run(...V){let[K,J]=oZ(V),C=b(L).rehydrate(K,J);await new Z().handle(C)}onFail(V){console.error(`The listener ${Z.name} threw while handling ${z} off the queue. The queue will retry it up to ${G} times in total; nothing the dispatcher did is waiting on it.`,V)}onDeadletter(V){console.error(`The listener ${Z.name} failed every one of its ${G} attempts at ${z} and has been dead-lettered, so this side effect did not happen and will not be retried.`,V)}};return Object.defineProperty(Y,"name",{value:nZ(Z.name),writable:!0}),Y}function tZ(Z){if(Object.getOwnPropertyDescriptor(Z,"name")?.writable)return;throw Error(`The listener ${Z.name} sets \`queued = true\` but does not declare \`static name\`, so it would be registered with the queue `+"under its class name \u2014 which a production build renames while the "+`payload that names it does not. Add: static name = "${Z.name}";`)}function oZ(Z){return typeof Z[0]==="string"?Z:Z[0]}class L{static token="events";listeners={};events={};warnedFor=new Set;warnedAboutWaiting=new Set;config;constructor(Z={}){this.config=B(g(),Z),this.useListeners(this.config.listeners)}useListeners(Z){this.config.listeners=Z,this.listeners={},this.events={};let $=new Set;for(let G of Z){if(!G.event){console.error(`Listener ${G.name} does not declare \`static event\`, so there is no event name to register it under and its handle will never run. Add: static event = SomeEvent;`);continue}if($.has(G.name)){console.error(`Two event listeners are named "${G.name}" \u2014 the first is `+"registered and this one is not. A listener's name identifies it across the framework, so only one class can hold it. Rename one.");continue}$.add(G.name);let H=G.event.name,W=new G;this.events[H]??=G.event,(this.listeners[H]??=[]).push({listener:G,job:W.queued?QZ(G,W):null})}}get queuedListenerJobs(){return Object.values(this.listeners).flat().flatMap(({job:Z})=>Z?[Z]:[])}get registeredListeners(){return[...this.config.listeners]}dispatch(Z,$){if(this.deferToCommit(Z,$,!1))return;this.runListeners(Z,$)}async dispatchAndWait(Z,$){if(this.deferToCommit(Z,$,!0))return;return this.runListeners(Z,$)}deferToCommit(Z,$,G){let{name:H,afterCommit:W}=Z.constructor;if(!W)return!1;let z=NZ(()=>this.runListeners(Z,$));if(z&&G)this.warnNothingIsWaitedFor(H);return z}async runListeners(Z,$){let G=Z.constructor.name,H=this.listeners[G];if(!H?.length){this.warnNothingIsListening(G);return}for(let{listener:W,job:z}of H){if(z){this.enqueue(z,W,G,$);continue}try{await new W().handle(Z)}catch(Y){console.error(`The listener ${W.name} threw while handling ${G}. The `+"listeners after it still ran \u2014 a listener's failure is its own.",Y)}}}rehydrate(Z,$=[]){let G=this.events[Z];if(!G)throw Error(`Cannot rebuild the event "${Z}" that came off the queue: no registered listener binds to an event of that name, so there is no class to construct. A queued listener runs in an application that `+"discovered its own listeners \u2014 check that this process sees the "+`same app/listeners as the one that dispatched, and that the event declares \`static name = "${Z}"\`.`);return new G(...$)}enqueue(Z,$,G,H){if(H===void 0){console.error(`The listener ${$.name} is queued, but ${G} reached the dispatcher without its constructor arguments, so there is nothing for the queue to rebuild it from and the listener was skipped. Dispatch through ${G}.dispatch(...) or ${G}.dispatchAndWait(...), which carry them.`);return}let W=(z)=>console.error(`The listener ${$.name} could not be queued for ${G}, so it did not run and will not be retried. The listeners after it still ran.`,z);try{b(q).push(Z,JSON.stringify([G,H]),{reportFailure:!1}).catch(W)}catch(z){W(z)}}warnNothingIsWaitedFor(Z){if(Bun.env.NODE_ENV==="production")return;if(this.warnedAboutWaiting.has(Z))return;this.warnedAboutWaiting.add(Z),console.warn(`[gemi] ${Z}.dispatchAndWait() was called inside a transaction and ${Z} declares \`static afterCommit = true\`, so it resolved `+"immediately with no listener having run \u2014 they run when the "+"transaction commits. Await the transaction instead, or drop afterCommit if the caller needs the side effects first. Development only.")}warnNothingIsListening(Z){if(Bun.env.NODE_ENV==="production")return;if(this.warnedFor.has(Z))return;this.warnedFor.add(Z),console.warn(`[gemi] ${Z} was dispatched and nothing is listening for it. A listener registers under the name its event declares, so check that app/listeners holds a Listener with \`static event = ${Z}\` and that ${Z} declares \`static name = "${Z}"\`. Development only.`)}}class rZ extends I{register(){this.app.singleton(L,()=>new L(this.app.config.get("events",{})))}async boot(){let Z=this.app.make(L),$=this.app.config.get("events",{});if($.listeners===void 0){let{listenersDir:W}=B(g(),$);Z.useListeners(await _Z(W))}let G=Z.queuedListenerJobs;if(G.length===0)return;let H=this.app.make(q);for(let W of G)H.registerJob(W)}}class aZ extends I{register(){this.app.singleton(t,()=>new t(this.app.config.get("filesystem",{})))}}class eZ extends I{register(){this.app.singleton(o,()=>new o(this.app.config.get("image",{})))}}class Z3 extends I{register(){this.app.instance(r,new r)}}function M4(Z){return Z}function AZ(){return{maxFileSize:10485760,onLogFileClosed:()=>{},onLogCreated:()=>{}}}class $3 extends I{register(){this.app.singleton(v,()=>new v(B(AZ(),this.app.config.get("log",{}))))}async boot(){if(!process.env.ROOT_DIR)return;await this.app.make(v).boot()}}class G3 extends I{register(){this.app.singleton(m,()=>new m(B(xZ(),this.app.config.get("middleware",{}))))}boot(){this.app.make(m).assertGlobalMiddleware()}}function l4(Z){return Z}function FZ(){return{driver:new PZ,limit:1000,window:60}}class W3 extends I{register(){this.app.singleton(a,()=>new a(B(FZ(),this.app.config.get("ratelimiter",{}))))}}function a4(Z){return Z}function LZ(){return{url:process.env.REDIS_URL,options:void 0}}class H3 extends I{register(){this.app.singleton(k,()=>new k(B(LZ(),this.app.config.get("redis",{}))))}shutdown(){if(!this.app.resolved(k))return;this.app.make(k).close()}}class N extends e{status;constructor(Z,$){super(Z);this.status=$;this.name="McpToolError"}}var z3=/^[A-Za-z0-9_-]{1,64}$/,V3=/:([A-Za-z_][A-Za-z0-9_]*)([?*+]?)/g,SZ=4000,E=1e5,K3=/^(text\/|application\/([\w.+-]*\+)?(json|xml))/i;class M{router;dispatcher;static token="router.mcp";plans=new Map;constructor(Z,$){this.router=Z;this.dispatcher=$;for(let[G,H]of Object.entries(Z.routes??{}))this.plans.set(G,this.plan(G,H))}list(Z,$){return TZ(Z),this.descriptors($)}descriptors(Z){let $=[];for(let{descriptor:G}of this.plans.values()){if(Z?.names&&!Z.names.includes(G.name))continue;if(Z?.tags&&!G.tags.some((H)=>Z.tags.includes(H)))continue;$.push(G)}return $}async execute(Z,$,G,H){TZ(Z);let W=this.plans.get($);if(!W)throw Error(`McpRegistry: there is no tool named "${$}".`);let{descriptor:z}=W,Y=z.inputSchema.safeParse(G);if(Y.ok===!1)throw new N(`Invalid arguments for "${$}": ${Y.errors.join(", ")}`);let V=Y.value,K={caller:Z,req:Z.req,tool:z,input:V,ctx:H},J=await this.fillPath(W,K),{path:C}=this.dispatcher.getRouteHandlerAndParams(new Request(`http://gemi.internal/api${J}`));if(C!==z.url)throw new N(`"${$}" has nothing at ${J}.`,404);let U={};for(let _ of W.jsonKeys)if(V[_]!==void 0)U[_]=V[_];let Q,A="";if(W.fileFields.length>0)Q=await this.formData(W,U,K);else if(z.method==="GET")A=U3(U);else if(W.jsonKeys.length>0)Q=U;let D=this.router.credentials?await this.bind(W,"the credentials",()=>this.router.credentials(K)):void 0,S;try{let _=A?`${J}?${A}`:J;S=D?await this.dispatcher.dispatchAs(Z.req,z.method,_,Q,{credentials:D}):await this.dispatcher.dispatchAs(Z.req,z.method,_,Q)}catch(_){throw console.error(`[gemi/mcp] Dispatching "${$}" failed:`,_),new N(`"${$}" failed on the server.`,500)}if(!W.result&&!z.outputSchema)return await DZ($,S);return await this.project(W,K,S)}plan(Z,$){if(!z3.test(Z))throw Error(`McpRouter: "${Z}" is not a valid tool name. A routes key is the tool's name as a model and an MCP client see it, used verbatim \u2014 letters, digits, "_" and "-", at most 64.`);let G=`McpRouter: "${Z}" (${$?.method} ${$?.url})`;if(!($ instanceof Object)||$.__internal_brand!=="McpRoute")throw Error(`McpRouter: "${Z}" is not a route. Declare it with this.fromApiRoute(...).`);let{method:H,url:W,meta:z}=$;if(W.startsWith("/__gemi__"))throw Error(`${G} is a framework route, not an app route.`);let Y=this.dispatcher.flatRoutes[W]?.[H];if(!Y)throw Error(`${G} names no route of this app. Expose a route by the path and verb it is mounted at.`);let V=[...W.matchAll(V3)].map(([,X,O])=>({name:X,modifier:O})),K=z.params??{};for(let X of V)if(!(X.name in K))throw Error(`${G}: the path param "${X.name}" must be bound or declared "input".`);for(let[X,O]of Object.entries(K)){if(!V.some((x)=>x.name===X))throw Error(`${G}: "${X}" in params is not a param of the url.`);if(RZ(O))X3(G,`params.${X}`,O);else EZ(G,`params.${X}`,O)}let J=[],C;if(z.input){if(C=z.input.toJSONSchema(),C.type!=="object"||!C.properties)throw Error(`${G}: input must be an s.object(...), the fields of the request body.`);J=Object.keys(C.properties)}let U=Object.entries(z.files??{}).map(([X,O])=>({name:X,binder:O}));for(let X of U)EZ(G,`files.${X.name}`,X.binder);if(z.result!==void 0&&typeof z.result!=="function")throw Error(`${G}: result must be a function.`);if(z.output!==void 0&&typeof z.output?.safeParse!=="function")throw Error(`${G}: output must be a schema, built with s.`);if(U.length>0&&H==="GET")throw Error(`${G}: a GET has no body to carry a file.`);let Q={},A=(X,O)=>{if(X in Q)throw Error(`${G}: "${X}" is the input key of two params or files, and the model can only send one.`);Q[X]=O},D=new Map,S=new Map;for(let X of V){let O=K[X.name];if(O==="input"){let x=h.string().describe(`The ":${X.name}" segment of the url.`);A(X.name,X.modifier==="?"||X.modifier==="*"?x.optional():x)}else if(RZ(O)){let x=O.as??X.name;A(x,O.input),S.set(X.name,{key:x,param:O})}else D.set(X.name,O)}for(let X of U)if(X.binder==="input")A(X.name,h.string().describe("The id of an attachment the user uploaded or a tool produced (gemi_att_\u2026), whose file is sent as this field."));let _=[...Object.keys(Q),...U.map((X)=>X.name)];for(let X of new Set(_))if(J.includes(X))throw Error(`${G}: "${X}" is both an input field and a param or file, and the model can only send one.`);return{descriptor:Object.freeze({name:Z,description:z.description,method:H,url:W,inputSchema:I3(z.input,C,h.object(Q)),...z.output?{outputSchema:z.output}:{},annotations:Y3(H),tags:Object.freeze([...z.tags??[]]),requiresApproval:z.requiresApproval===!0,...Y.source?{source:Y.source}:{}}),params:V,paramBinders:D,modelParams:S,fileFields:U,jsonKeys:J,...z.result?{result:z.result}:{}}}async fillPath(Z,$){let{input:G,req:H}=$,W=Z.descriptor.url;for(let z of Z.params){let Y=Z.paramBinders.get(z.name),V=Z.modelParams.get(z.name),K;if(Y||V){if(K=V?await this.bind(Z,`the param "${z.name}"`,()=>V.param.bind(G[V.key],H,$),{refusals:!0}):await this.bind(Z,`the param "${z.name}"`,()=>Y(H,$)),K===void 0||K===null||K==="")throw console.error(`[gemi/mcp] The ${V?"resolver":"binder"} for "${z.name}" of "${Z.descriptor.name}" returned ${JSON.stringify(K)}.`),new N(`"${Z.descriptor.name}" failed on the server.`,500)}else K=G[z.name];let J=`:${z.name}${z.modifier}`;if(K===void 0||K===null||K===""){if(z.modifier!=="?"&&z.modifier!=="*")throw new N(`"${z.name}" of "${Z.descriptor.name}" must not be empty.`);W=W.replace(`/${J}`,"");continue}W=W.replace(J,J3(Z.descriptor.name,z,String(K)))}return W}async formData(Z,$,G){let{input:H,ctx:W}=G,z=Z.descriptor.name;if(!W)throw Error(`McpRegistry: "${z}" sends a file, which is resolved through the tool context's attachments, and none was passed to execute().`);let Y=new FormData;for(let[V,K]of Object.entries($))jZ(Y,V,K);for(let V of Z.fileFields){let K=V.binder==="input"?H[V.name]:await this.bind(Z,`the file "${V.name}"`,()=>V.binder(W,G));if(typeof K!=="string"||K==="")throw new N(`"${z}" needs a file for "${V.name}", and this turn has none. Ask the user to attach one.`);Y.append(V.name,await W.attachments.file(K))}return Y}async project(Z,$,G){let{name:H,outputSchema:W}=Z.descriptor;if(G.status<200||G.status>=300)return await DZ(H,G);let z=(U,Q)=>{if(Q===void 0)console.error(`[gemi/mcp] "${H}" ${U}`);else console.error(`[gemi/mcp] "${H}" ${U}`,Q);return new N(`"${H}" failed on the server.`,500)},Y=G.headers.get("Content-Type"),V=await G.text(),K=null;if(V!=="")try{K=JSON.parse(V)}catch{throw z(`answered ${Y??"a body with no content-type"} that is not JSON, and its result or output needs JSON.`)}let J=K;if(Z.result)try{J=await Z.result(K,$)}catch(U){throw z("failed in its result projection:",U)}if(W){let U=W.safeParse(J);if(U.ok===!1)throw z(`answered what its output schema refuses: ${U.errors.join(", ")}`);J=U.value}if(J===void 0)return null;let C=JSON.stringify(J);if(C!==void 0&&C.length>E)return`${C.slice(0,E)}\u2026 [cut at ${E} of ${C.length} characters]`;return J}async bind(Z,$,G,H={}){try{return await G()}catch(W){if(H.refusals&&W instanceof e)throw W;throw console.error(`[gemi/mcp] Binding ${$} of "${Z.descriptor.name}" failed:`,W),new N(`"${Z.descriptor.name}" failed on the server.`,500)}}}function TZ(Z){if(Z?.kind!=="local")throw Error("McpRegistry: only local callers are implemented. A remote caller needs a bearer-token resolver, which v1 does not have \u2014 and until it does there is no remote surface to call from.")}function EZ(Z,$,G){if(G!=="input"&&typeof G!=="function")throw Error(`${Z}: ${$} must be a function or "input".`)}function RZ(Z){return Z instanceof Object&&Z.__internal_brand==="McpModelParam"}function X3(Z,$,G){if(G.as!==void 0&&(typeof G.as!=="string"||G.as===""))throw Error(`${Z}: ${$}.as must be a non-empty string.`);let H=G.input;if(typeof H?.safeParse!=="function"||typeof H.toJSONSchema!=="function")throw Error(`${Z}: ${$}.input must be a schema, built with s.`);if(typeof G.bind!=="function")throw Error(`${Z}: ${$}.bind must be a function.`)}function Y3(Z){switch(Z){case"GET":return Object.freeze({readOnlyHint:!0});case"DELETE":return Object.freeze({destructiveHint:!0});case"PUT":return Object.freeze({idempotentHint:!0});default:return Object.freeze({})}}function I3(Z,$,G){let H=G.toJSONSchema(),W={...$??{},type:"object",properties:{...$?.properties??{},...H.properties},required:[...$?.required??[],...H.required??[]],additionalProperties:!1},z=(Y)=>{if(typeof Y!=="object"||Y===null||Array.isArray(Y))return{ok:!1,errors:["expected an object"]};let V=[],K={};if(Z){let C=Z.safeParse(Y);if(C.ok===!1)V.push(...C.errors);else K={...C.value}}let J=G.safeParse(Y);if(J.ok===!1)V.push(...J.errors);else K={...K,...J.value};return V.length>0?{ok:!1,errors:V}:{ok:!0,value:K}};return{toJSONSchema:()=>W,safeParse:z,parse(Y){let V=z(Y);if(V.ok===!1)throw Error(V.errors.join(", "));return V.value}}}function J3(Z,$,G){let H=$.modifier==="*"||$.modifier==="+"?G.split("/"):[G];if(H.some((W)=>W==="."||W===".."))throw new N(`"${G}" is not a valid value for "${$.name}" of "${Z}".`);return H.map(encodeURIComponent).join("/")}function jZ(Z,$,G){if(G===void 0||G===null)return;if(Array.isArray(G)){for(let H of G)jZ(Z,$,H);return}Z.append($,typeof G==="object"?JSON.stringify(G):String(G))}function U3(Z){let $=new URLSearchParams,G=(H,W)=>{if(W===void 0||W===null)return;if(Array.isArray(W)){for(let z of W)G(H,z);return}$.append(H,typeof W==="object"?JSON.stringify(W):String(W))};for(let[H,W]of Object.entries(Z))G(H,W);return $.toString()}async function DZ(Z,$){if($.status>=200&&$.status<300){let H=$.headers.get("Content-Type");if(H&&!K3.test(H)){let z=(await $.arrayBuffer()).byteLength;return`"${Z}" answered with ${z} bytes of ${H}, which is not shown.`}let W=await $.text();if(W==="")return null;if(W.length>E)return`${W.slice(0,E)}\u2026 [cut at ${E} of ${W.length} characters]`;try{return JSON.parse(W)}catch{return W}}let G=await $.text();if($.status>=400&&$.status<500){let H=G.length>SZ?`${G.slice(0,SZ)}\u2026`:G;throw new N(`"${Z}" was refused with ${$.status}${H?`: ${H}`:"."}`,$.status)}if($.status<500)console.error(`[gemi/mcp] "${Z}" answered ${$.status}${$.headers.get("Location")?` to ${$.headers.get("Location")}`:""}, which a tool call cannot follow.`);throw new N(`"${Z}" failed on the server.`,$.status)}function c(Z,$){let G=Z.get($);if(!G)throw Error(`Missing "${$}" configuration. Route dispatching needs a root router \u2014 declare it in "app/config/route.ts".`);return G}class B3 extends I{register(){this.app.singleton(R,()=>new R(c(this.app.config,"route.api"))),this.app.singleton(y,()=>new y(c(this.app.config,"route.view"))),this.app.singleton(u,()=>new u({api:this.app.make(R),view:this.app.make(y)},{api:c(this.app.config,"route.api"),view:c(this.app.config,"route.view"),domains:this.app.config.get("route.domains")})),this.app.singleton(M,()=>{let Z=this.app.config.get("route.mcp");if(!Z?.router)throw Error('No MCP router is configured. Declare one as `mcp: { router }` in "app/config/route.ts".');return new M(new Z.router,this.app.make(R))})}boot(){if(this.app.make(R),this.app.make(y),this.app.make(u),this.app.config.get("route.mcp"))this.app.make(M)}}
|
|
3
3
|
export{F as hb,gZ as ib,T3 as jb,cZ as kb,uZ as lb,lZ as mb,T as nb,i3 as ob,qZ as pb,iZ as qb,sZ as rb,L as sb,rZ as tb,aZ as ub,eZ as vb,Z3 as wb,M4 as xb,AZ as yb,$3 as zb,G3 as Ab,l4 as Bb,FZ as Cb,W3 as Db,a4 as Eb,LZ as Fb,H3 as Gb,N as Hb,M as Ib,B3 as Jb};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=99432915D07BB43864756E2164756E21
|