gemi 0.140.0 → 0.140.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/AuthController.d.ts +2 -0
- package/dist/auth/AuthController.d.ts.map +1 -1
- package/dist/auth/types.d.ts +5 -0
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/{chunk-mxqnrn1k.js → chunk-1vfnehjr.js} +1 -1
- package/dist/{chunk-gx202f9t.js → chunk-2vfdahm9.js} +1 -1
- package/dist/{chunk-ygyjtrzb.js → chunk-679ndcdq.js} +2 -2
- package/dist/{chunk-ygyjtrzb.js.map → chunk-679ndcdq.js.map} +1 -1
- package/dist/{chunk-d7a092vd.js → chunk-bmam8bsm.js} +1 -1
- package/dist/{chunk-ny01tp0y.js → chunk-bywhpfyv.js} +25 -25
- package/dist/{chunk-ny01tp0y.js.map → chunk-bywhpfyv.js.map} +5 -4
- package/dist/chunks/{RealtimeClient-B345JtXu.js → RealtimeClient-DFgd6k2O.js} +2 -2
- package/dist/chunks/{RealtimeClient-B345JtXu.js.map → RealtimeClient-DFgd6k2O.js.map} +1 -1
- package/dist/chunks/{ThemeProvider-BwlMubvu.js → ThemeProvider-D8T12nBG.js} +26 -12
- package/dist/chunks/ThemeProvider-D8T12nBG.js.map +1 -0
- package/dist/chunks/{fetchFileRequest-DKKdn8Yp.js → fetchFileRequest-Bu8thkJP.js} +2 -2
- package/dist/chunks/{fetchFileRequest-DKKdn8Yp.js.map → fetchFileRequest-Bu8thkJP.js.map} +1 -1
- package/dist/chunks/{live-Cq65lqVg.js → live-CR8v1KcI.js} +3 -3
- package/dist/chunks/{live-Cq65lqVg.js.map → live-CR8v1KcI.js.map} +1 -1
- package/dist/chunks/{mutationExtras-KMQj-GZD.js → mutationExtras-DuFelh7K.js} +2 -2
- package/dist/chunks/{mutationExtras-KMQj-GZD.js.map → mutationExtras-DuFelh7K.js.map} +1 -1
- package/dist/client/ClientRouterContext.d.ts.map +1 -1
- package/dist/client/Link.d.ts.map +1 -1
- package/dist/client/auth/useSignIn.d.ts +4 -0
- package/dist/client/auth/useSignIn.d.ts.map +1 -1
- package/dist/client/auth/useUser.d.ts +1 -0
- package/dist/client/auth/useUser.d.ts.map +1 -1
- package/dist/client/index.js +5 -7
- package/dist/client/index.js.map +1 -1
- package/dist/facades/index.js +1 -1
- package/dist/http/index.js +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/localePrefix.d.ts +13 -0
- package/dist/i18n/localePrefix.d.ts.map +1 -0
- package/dist/kernel/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
- package/dist/testing/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/ThemeProvider-BwlMubvu.js.map +0 -1
- /package/dist/{chunk-mxqnrn1k.js.map → chunk-1vfnehjr.js.map} +0 -0
- /package/dist/{chunk-gx202f9t.js.map → chunk-2vfdahm9.js.map} +0 -0
- /package/dist/{chunk-d7a092vd.js.map → chunk-bmam8bsm.js.map} +0 -0
package/dist/facades/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{If as q,Pe as a,Tf as r,Ue as c,Uf as s,Ve as e,Vf as t,We as f,Wf as u,Xe as h,Ye as i,Ze as j,ef as k,ff as l,gf as m,hf as n,if as o,sf as p,yg as v}from"../chunk-
|
|
2
|
+
import{If as q,Pe as a,Tf as r,Ue as c,Uf as s,Ve as e,Vf as t,We as f,Wf as u,Xe as h,Ye as i,Ze as j,ef as k,ff as l,gf as m,hf as n,if as o,sf as p,yg as v}from"../chunk-bywhpfyv.js";import"../chunk-9b4ypfcw.js";import"../chunk-5013raxj.js";import{Xh as b,ui as d,wi as g}from"../chunk-eve0hewa.js";import"../chunk-v2cv3wcw.js";import"../chunk-7hdfbp2x.js";import"../chunk-dzvp8ynr.js";import"../chunk-23mcs80p.js";import"../chunk-e9xbdgb2.js";import"../chunk-gy307m19.js";import"../chunk-98dxtkbt.js";import"../chunk-ks7msv3e.js";import"../chunk-yxjfghq3.js";import"../chunk-8r9kna46.js";import"../chunk-rwrcsfzv.js";import"../chunk-rw4z3n9b.js";import"../chunk-kddgfct7.js";import"../chunk-s58hbczk.js";import"../chunk-apfk702c.js";import"../chunk-eyqsvzej.js";import"../chunk-9yfg4nqq.js";import"../chunk-5aj27bgc.js";import"../chunk-tbhtx2t0.js";export{f as Url,d as Storage,r as Runs,j as Redis,a as Redirect,l as RateLimiter,e as Query,h as Meta,g as Log,m as Lock,c as Lang,s as Features,b as Facade,u as DB,n as Crypt,i as Cookie,o as Connections,t as ConnectionQueries,p as ChangeFeed,k as Cache,q as Broadcast,v as Auth};
|
|
3
3
|
|
|
4
4
|
//# debugId=98714DAC0F83E4E564756E2164756E21
|
package/dist/http/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$d as q,Ag as aa,Bg as ba,Eg as ca,Fg as da,Gg as ea,Hg as fa,Ig as ga,Jg as ha,Kg as ia,Lg as ja,Mg as ka,Ne as G,Ng as la,Oe as H,Og as ma,Pg as na,Qe as I,Qg as oa,Re as J,Rg as pa,Se as K,Sg as qa,Te as L,Tg as ra,Ug as sa,Vg as ta,ae as r,be as s,ce as t,cg as _,de as u,ee as B,je as C,le as D,me as E,ne as F,zg as $}from"../chunk-
|
|
2
|
+
import{$d as q,Ag as aa,Bg as ba,Eg as ca,Fg as da,Gg as ea,Hg as fa,Ig as ga,Jg as ha,Kg as ia,Lg as ja,Mg as ka,Ne as G,Ng as la,Oe as H,Og as ma,Pg as na,Qe as I,Qg as oa,Re as J,Rg as pa,Se as K,Sg as qa,Te as L,Tg as ra,Ug as sa,Vg as ta,ae as r,be as s,ce as t,cg as _,de as u,ee as B,je as C,le as D,me as E,ne as F,zg as $}from"../chunk-bywhpfyv.js";import"../chunk-9b4ypfcw.js";import"../chunk-5013raxj.js";import{Ah as e,Bh as f,Ch as g,Dh as h,Eh as i,Fh as j,Kh as n,Lh as o,Qh as p,Rh as v,Sh as w,Th as x,Uh as y,Vh as z,Wh as A,ei as M,fi as N,gi as O,hi as P,ii as Q,ji as R,ki as S,li as T,mi as U,ni as V,oi as W,pi as X,qi as Y,ri as Z,th as a,uh as b,vh as d}from"../chunk-eve0hewa.js";import{Ei as c}from"../chunk-v2cv3wcw.js";import{Ji as k,Ki as l,Li as m}from"../chunk-7hdfbp2x.js";import"../chunk-dzvp8ynr.js";import"../chunk-23mcs80p.js";import"../chunk-e9xbdgb2.js";import"../chunk-gy307m19.js";import"../chunk-98dxtkbt.js";import"../chunk-ks7msv3e.js";import"../chunk-yxjfghq3.js";import"../chunk-8r9kna46.js";import"../chunk-rwrcsfzv.js";import"../chunk-rw4z3n9b.js";import"../chunk-kddgfct7.js";import"../chunk-s58hbczk.js";import"../chunk-apfk702c.js";import"../chunk-eyqsvzej.js";import"../chunk-9yfg4nqq.js";import"../chunk-5aj27bgc.js";import"../chunk-tbhtx2t0.js";export{g as toRangeHeaderValue,q as toMiddlewareList,k as stateKey,Z as safeFetch,f as resolveRange,e as parseRangeHeader,h as parseContentRange,u as parseByteSize,ha as middlewareConfigDefaults,J as httpError,d as getCookies,j as formatUnsatisfiedContentRange,i as formatContentRange,pa as defineResourcePolicy,ga as defineMiddlewareConfig,r as createUnsatisfiableResponse,s as createStreamResponse,K as createFileResponse,F as clientIp,X as classifyAddress,ba as authorizeChannel,L as ViewRouter,n as ValidationError,U as TooManyRedirectsError,S as TooLargeError,R as TimeoutError,qa as SitemapError,ra as Sitemap,H as SameSiteBounceMiddleware,Y as SafeResponse,M as SafeFetchError,G as SAME_SITE_BOUNCE_PARAM,sa as RobotsTxt,ta as Robots,oa as ResourcePolicy,b as ResourceController,m as RequestState,c as RequestBreakerError,E as RateLimitMiddleware,C as RateLimitExceededError,x as RangeNotSatisfiableError,ma as PoliciesServiceProvider,na as Policies,t as PayloadTooLargeError,y as NotFoundError,V as NetworkError,l as MissingRequestStateError,D as Middleware,ea as McpToolDeclaration,fa as McpRouter,da as McpRouteDeclaration,ca as McpModelParam,o as InvalidValidationRuleError,N as InvalidUrlError,w as InsufficientPermissionsError,W as HttpStatusError,I as HttpResponse,p as HttpRequest,z as FileNotFoundError,Q as DnsError,ka as CorsMiddleware,a as Controller,T as ContentTypeError,aa as ChannelRouter,$ as ChannelDeclaration,ja as CacheMiddleware,la as CSRFMiddleware,_ as BodyLimitMiddleware,O as BlockedHostError,P as BlockedAddressError,v as AuthorizationError,ia as AuthenticationMiddleware,A as AuthenticationError,B as ApiRouter};
|
|
3
3
|
|
|
4
4
|
//# debugId=8C984076055B854464756E2164756E21
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ca as T}from"../chunk-d0kw04ym.js";import"../chunk-epvpmakp.js";import{ab as D}from"../chunk-5gkzbhts.js";import{Yd as b,Zd as w}from"../chunk-c7ecv545.js";import"../chunk-6hs102jh.js";import{Ue as j}from"../chunk-
|
|
2
|
+
import{ca as T}from"../chunk-d0kw04ym.js";import"../chunk-epvpmakp.js";import{ab as D}from"../chunk-5gkzbhts.js";import{Yd as b,Zd as w}from"../chunk-c7ecv545.js";import"../chunk-6hs102jh.js";import{Ue as j}from"../chunk-bywhpfyv.js";import"../chunk-9b4ypfcw.js";import"../chunk-5013raxj.js";import"../chunk-eve0hewa.js";import"../chunk-v2cv3wcw.js";import"../chunk-7hdfbp2x.js";import"../chunk-dzvp8ynr.js";import"../chunk-23mcs80p.js";import"../chunk-e9xbdgb2.js";import"../chunk-gy307m19.js";import"../chunk-98dxtkbt.js";import"../chunk-ks7msv3e.js";import"../chunk-yxjfghq3.js";import"../chunk-8r9kna46.js";import"../chunk-rwrcsfzv.js";import{Kk as V,Lk as X,Mk as E,Nk as L,Ok as R,Pk as S}from"../chunk-rw4z3n9b.js";import"../chunk-kddgfct7.js";import"../chunk-s58hbczk.js";import"../chunk-apfk702c.js";import"../chunk-eyqsvzej.js";import"../chunk-9yfg4nqq.js";import"../chunk-5aj27bgc.js";import"../chunk-tbhtx2t0.js";import{createElement as J,Fragment as M,isValidElement as U}from"react";function $(q,B){let G=Object.values(B).some((z)=>typeof z==="function"&&U(z(""))),Q=/{{([^{}]+?)(?::([^{}\[\]]+?))?(?:\[(.*?)\])?}}/g;if(!G)return q.replace(Q,(W,O,_,Z)=>{let C=O.includes(":")?O.split(":")[0]:O,H=B[C];if(H===void 0)return W;if(typeof H==="function"){let K=H(Z!==void 0?Z:"");if(U(K))throw Error("JSX returned in string context");return String(K)}if(_)switch(_.toLowerCase()){case"number":return Number(H).toString();case"string":return String(H);case"boolean":return Boolean(H).toString();default:return String(H)}return String(H)});else{let z=[],W=0,O=null;while((O=Q.exec(q))!==null){let[_,Z,C,H]=O,F=O.index,K=Z.includes(":")?Z.split(":")[0]:Z;if(F>W)z.push(q.substring(W,F));let Y=B[K];if(Y===void 0)z.push(_);else if(typeof Y==="function"){let A=Y(H!==void 0?H:"");z.push(A)}else if(C)switch(C.toLowerCase()){case"number":z.push(Number(Y).toString());break;case"string":z.push(String(Y));break;case"boolean":z.push(Boolean(Y).toString());break;default:z.push(String(Y))}else z.push(String(Y));W=F+_.length}if(W<q.length)z.push(q.substring(W));return J(M,{},...z)}}class P{name;dictionary;constructor(q,B){this.name=q;this.dictionary=B}reference(q){if(typeof window<"u")throw Error("Cannot use reference in the browser");if(!this.dictionary?.[q])throw Error(`Translation not found for ${String(q)}`);return this.dictionary[q]}render(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B[0]};if(typeof window<"u")throw Error("Cannot use render in the browser");if(!this.dictionary?.[q]?.[G])throw Error(`Translation not found for ${String(q)} in ${String(G)}`);return $(this.dictionary[q][G],Q??{})}static create(q,B){return new P(q,B)}static text(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B?.[0]};if(!q?.[G])throw Error(`Translation not found for ${String(G)}`);return $(q[G],Q??{})}}async function N(q,B,...G){let{locale:Q=j.locale(),params:z}={params:{},...G[0]},O=(await q.load(String(Q)))[B];if(typeof O!=="string")throw Error(`Translation not found for "${B}" in "${String(Q)}" (dictionary ${q.id})`);return $(O,z??{})}export{w as translationConfigDefaults,N as translate,V as resolveLocale,X as negotiateLocale,L as isValidTimeZone,b as defineTranslationConfig,T as defineDictionary,R as createFormatter,S as Translator,D as TranslationServiceProvider,P as Dictionary,E as DEFAULT_TIME_ZONE};
|
|
3
3
|
|
|
4
4
|
//# debugId=0B4500F69E785A1064756E2164756E21
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits a leading locale segment off a pathname.
|
|
3
|
+
*
|
|
4
|
+
* Only a whole first segment counts: `/de-DE`, `/de-DE/` and `/de-DE/about`
|
|
5
|
+
* carry `de-DE`, while `/de-DE-shop` or `/delivery` (with a `de` locale) do
|
|
6
|
+
* not. What is left is never empty: a locale's root URL, with or without its
|
|
7
|
+
* trailing slash, is the path `/`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function splitLocalePrefix(pathname: string, locales: readonly string[]): {
|
|
10
|
+
locale: string | null;
|
|
11
|
+
pathname: string;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=localePrefix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localePrefix.d.ts","sourceRoot":"","sources":["../../i18n/localePrefix.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAM7C"}
|
package/dist/kernel/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ea as E}from"../chunk-t6n490ha.js";import{$a as p}from"../chunk-qvtmn7mn.js";import{ab as H}from"../chunk-5gkzbhts.js";import{Bb as L,Cb as Q,Db as T,Hb as U,Ib as y,Jb as F,Kb as C,Nb as D,Ob as I,Rb as b,Ub as f,Vb as k,Wb as m,nb as g,ob as W,pb as _,qb as l,rb as P,sb as u,tb as $,ub as V,vb as q,wb as B,xb as K}from"../chunk-
|
|
2
|
+
import{Ea as E}from"../chunk-t6n490ha.js";import{$a as p}from"../chunk-qvtmn7mn.js";import{ab as H}from"../chunk-5gkzbhts.js";import{Bb as L,Cb as Q,Db as T,Hb as U,Ib as y,Jb as F,Kb as C,Nb as D,Ob as I,Rb as b,Ub as f,Vb as k,Wb as m,nb as g,ob as W,pb as _,qb as l,rb as P,sb as u,tb as $,ub as V,vb as q,wb as B,xb as K}from"../chunk-1vfnehjr.js";import"../chunk-7dwgex81.js";import"../chunk-r1x5ms0y.js";import"../chunk-6jd0e1dz.js";import{Sd as h}from"../chunk-6zz3kez5.js";import"../chunk-c7ecv545.js";import"../chunk-6hs102jh.js";import{Le as n,Me as v,rg as w,se as a,te as d,vg as A,wg as R}from"../chunk-bywhpfyv.js";import"../chunk-9b4ypfcw.js";import"../chunk-5013raxj.js";import"../chunk-eve0hewa.js";import"../chunk-v2cv3wcw.js";import"../chunk-7hdfbp2x.js";import"../chunk-dzvp8ynr.js";import{Zi as M}from"../chunk-23mcs80p.js";import"../chunk-e9xbdgb2.js";import"../chunk-gy307m19.js";import"../chunk-98dxtkbt.js";import"../chunk-ks7msv3e.js";import"../chunk-yxjfghq3.js";import"../chunk-8r9kna46.js";import"../chunk-rwrcsfzv.js";import"../chunk-t7qp951h.js";import"../chunk-rw4z3n9b.js";import{Qk as O,Sk as z}from"../chunk-kddgfct7.js";import"../chunk-s58hbczk.js";import"../chunk-apfk702c.js";import"../chunk-eyqsvzej.js";import"../chunk-9yfg4nqq.js";import"../chunk-5aj27bgc.js";import"../chunk-tbhtx2t0.js";var N=[C,I,E,T,L,k,B,Q,D,y,_,U,f,V,F,H,b,K,q,m,$];class S{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new z;boot(){if(this.models.length>0)p(...this.models);else s();this.app.config.merge(this.config),z.setInstance(this.app),this.app.registerMany([...N,...this.providers]),this.registerServices()}registerServices(){let j=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let X=new Map;for(let G of this.services){let J=typeof G==="function"?new G:G,x=J.constructor;if(!x.token)throw Error(`Service [${x.name}] is listed in \`services\` but does not declare a \`static token\`.`);let Y=X.get(x.token);if(Y)throw Error(`Services [${Y}] and [${x.name}] both declare the token "${x.token}". Tokens are the container's keys, so they must be unique.`);X.set(x.token,x.name);let Z=x;if(!j.has(x.token)&&this.app.bound(Z))throw Error(`Service [${x.name}] declares the token "${x.token}", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`);this.app.instance(Z,J),this.serviceInstances.push(J),this.serviceTokens.add(x.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices(),l(this.app)}async bootServices(){if(this.servicesBooted)return;for(let j of this.serviceInstances)await j.boot();this.servicesBooted=!0}shutdown(j){return this.run(()=>this.app.shutdown(j))}run(j){return O.run(this.app,j)}resolve(j){return this.app.make(j)}apiRoutes(){return this.app.make(A)}viewRoutes(){return this.app.make(w)}domains(){return this.app.make(R)}queue(){return this.app.make(h)}mcpHttp(){return this.app.config.get("route.mcp.remote.enabled")===!0?this.app.make(g):null}sockets(){return this.app.config.get("route.channels")?this.app.make(u):null}globalMiddleware(j){return P(j)}destroy(){if(this.app.resolved(W))this.app.make(W).stop();if(this.app.flush(),z.getInstance()===this.app)z.setInstance(void 0);O.disable()}}function s(){if(Bun.env.NODE_ENV==="production")return;let j=M();if(j.length===0)return;console.warn(`[gemi] ${j.length} model${j.length===1?" is":"s are"} registered, but Kernel.models is empty.
|
|
3
3
|
Nested relation reads resolve a model by name, so a policy on a subclass that does not own its
|
|
4
4
|
`+" name is skipped inside every include \u2014 scoped at the root, "+`unscoped in an include, with nothing
|
|
5
5
|
to notice it. Declaring the modules registers each class under its own name and audits the set:
|
package/dist/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ca as f}from"../chunk-kk18xqgc.js";import{Da as S}from"../chunk-3v4esxbd.js";import{al as Q,cl as Z,dl as P,el as y,fl as U,gl as A}from"../chunk-eyqsvzej.js";import{kl as H}from"../chunk-9yfg4nqq.js";import"../chunk-5aj27bgc.js";import{rl as F}from"../chunk-tbhtx2t0.js";var x="/__gemi__/health",$=Symbol.for("gemi.server.health");function V(){let z=globalThis;return z[$]??={lagMs:0,consecutiveBreaches:0,degraded:!1,timer:void 0},z[$]}function W(){let z=V(),B=Q();return{healthy:!B&&!z.degraded,shuttingDown:B,lagMs:z.lagMs,consecutiveBreaches:z.consecutiveBreaches}}function E(z,B){let I=V();I.lagMs=z,I.consecutiveBreaches=z>B.maxLagMs?I.consecutiveBreaches+1:0;let J=I.consecutiveBreaches>=B.breaches;if(J&&!I.degraded)console.warn(`[gemi] Health: degraded (event-loop lag ${Math.round(z)}ms, ${I.consecutiveBreaches} samples in a row over ${B.maxLagMs}ms).`);else if(!J&&I.degraded)console.log(`[gemi] Health: recovered (event-loop lag ${Math.round(z)}ms).`);I.degraded=J}function G(z){let B=V();if(B.timer)return;let I=performance.now()+z.intervalMs;B.timer=setInterval(()=>{let J=performance.now();E(Math.max(0,J-I),z),I=J+z.intervalMs},z.intervalMs),B.timer.unref?.()}function _(z=process.env){return{paths:D(z.GEMI_HEALTH_PATH),intervalMs:O("GEMI_HEALTH_INTERVAL_MS",z.GEMI_HEALTH_INTERVAL_MS,500),maxLagMs:O("GEMI_HEALTH_MAX_LAG_MS",z.GEMI_HEALTH_MAX_LAG_MS,1000),breaches:Math.ceil(O("GEMI_HEALTH_BREACHES",z.GEMI_HEALTH_BREACHES,3))}}function D(z){if(z===void 0||z.trim()==="")return[x];if(z.trim().toLowerCase()==="off")return[];let B=z.split(",").map((J)=>J.trim()).filter(Boolean);if(B.filter((J)=>!J.startsWith("/")).length>0)throw Error(`GEMI_HEALTH_PATH: expected comma-separated paths starting with "/", or "off"; got ${JSON.stringify(z)}.`);return B}function O(z,B,I){if(B===void 0||B.trim()==="")return I;let J=Number(B);if(Number.isFinite(J)&&J>0)return J;return console.warn(`[gemi] Ignoring ${z}="${B}": expected a positive number.`),I}function j(z,B){if(B.length===0)return z;let I=new Set(B);return async(J,K)=>{if(!B.some((b)=>J.url.includes(b))||!I.has(new URL(J.url).pathname))return z(J,K);return y(R(J.method))}}function R(z){let B={"Cache-Control":"no-store","Content-Type":"text/plain; charset=utf-8"};if(z!=="GET"&&z!=="HEAD")return new Response("Method Not Allowed",{status:405,headers:{...B,Allow:"GET, HEAD"}});let{healthy:I,shuttingDown:J}=W();return new Response(z==="HEAD"?null:I?"ok":J?"shutting down":"degraded",{status:I?200:503,headers:B})}var L=Symbol.for("gemi.server.devGeneration"),X={graceMs:1e4,providerTimeoutMs:5000};class Y{app;inFlight=0;waiters=new Set;constructor(z){this.app=z}track(z){return async(B,I)=>{this.inFlight++;try{return await z(B,I)}finally{if(this.inFlight--,this.inFlight===0)this.wake()}}}get pending(){return this.inFlight}async retire({graceMs:z,providerTimeoutMs:B}){try{await this.idle(z),await Promise.resolve().then(()=>this.app.shutdown({timeoutMs:B}))}catch(I){C(I)}}idle(z){if(this.inFlight===0)return Promise.resolve();return new Promise((B)=>{let I=()=>{clearTimeout(J),this.waiters.delete(I),B()},J=setTimeout(I,z);this.waiters.add(I)})}wake(){for(let z of this.waiters)z()}}function N(z,B=X){let I=globalThis,J=I[L];if(I[L]=z,!J||J===z||typeof J.retire!=="function")return Promise.resolve();let K=J.retire.bind(J);return Promise.resolve().then(()=>K(B)).catch(C)}function C(z){console.error("[gemi] Shutting down the application a reload replaced failed:",z)}class k{app;instrumentation;handleSignals;server;stopping;settings;constructor(z){this.app=new S({kernel:z.kernel}),this.handleSignals=z.handleSignals??!0,this.instrumentation=U(z.instrumentation??((B,I)=>I(B)))}async start(){process.env.ROOT_DIR=H();let z=Bun.env.NODE_ENV==="production",B=_();if(z)G(B);let I=j(this.instrumentation,B.paths);if(z){if(this.handleSignals)A(()=>this.stop());this.settings=Z()}try{await this.app.waitForBoot()}catch(J){if(!z)this.app.shutdown({timeoutMs:X.providerTimeoutMs});throw J}if(z){let{httpProd:J}=await import("../chunk-
|
|
2
|
+
import{Ca as f}from"../chunk-kk18xqgc.js";import{Da as S}from"../chunk-3v4esxbd.js";import{al as Q,cl as Z,dl as P,el as y,fl as U,gl as A}from"../chunk-eyqsvzej.js";import{kl as H}from"../chunk-9yfg4nqq.js";import"../chunk-5aj27bgc.js";import{rl as F}from"../chunk-tbhtx2t0.js";var x="/__gemi__/health",$=Symbol.for("gemi.server.health");function V(){let z=globalThis;return z[$]??={lagMs:0,consecutiveBreaches:0,degraded:!1,timer:void 0},z[$]}function W(){let z=V(),B=Q();return{healthy:!B&&!z.degraded,shuttingDown:B,lagMs:z.lagMs,consecutiveBreaches:z.consecutiveBreaches}}function E(z,B){let I=V();I.lagMs=z,I.consecutiveBreaches=z>B.maxLagMs?I.consecutiveBreaches+1:0;let J=I.consecutiveBreaches>=B.breaches;if(J&&!I.degraded)console.warn(`[gemi] Health: degraded (event-loop lag ${Math.round(z)}ms, ${I.consecutiveBreaches} samples in a row over ${B.maxLagMs}ms).`);else if(!J&&I.degraded)console.log(`[gemi] Health: recovered (event-loop lag ${Math.round(z)}ms).`);I.degraded=J}function G(z){let B=V();if(B.timer)return;let I=performance.now()+z.intervalMs;B.timer=setInterval(()=>{let J=performance.now();E(Math.max(0,J-I),z),I=J+z.intervalMs},z.intervalMs),B.timer.unref?.()}function _(z=process.env){return{paths:D(z.GEMI_HEALTH_PATH),intervalMs:O("GEMI_HEALTH_INTERVAL_MS",z.GEMI_HEALTH_INTERVAL_MS,500),maxLagMs:O("GEMI_HEALTH_MAX_LAG_MS",z.GEMI_HEALTH_MAX_LAG_MS,1000),breaches:Math.ceil(O("GEMI_HEALTH_BREACHES",z.GEMI_HEALTH_BREACHES,3))}}function D(z){if(z===void 0||z.trim()==="")return[x];if(z.trim().toLowerCase()==="off")return[];let B=z.split(",").map((J)=>J.trim()).filter(Boolean);if(B.filter((J)=>!J.startsWith("/")).length>0)throw Error(`GEMI_HEALTH_PATH: expected comma-separated paths starting with "/", or "off"; got ${JSON.stringify(z)}.`);return B}function O(z,B,I){if(B===void 0||B.trim()==="")return I;let J=Number(B);if(Number.isFinite(J)&&J>0)return J;return console.warn(`[gemi] Ignoring ${z}="${B}": expected a positive number.`),I}function j(z,B){if(B.length===0)return z;let I=new Set(B);return async(J,K)=>{if(!B.some((b)=>J.url.includes(b))||!I.has(new URL(J.url).pathname))return z(J,K);return y(R(J.method))}}function R(z){let B={"Cache-Control":"no-store","Content-Type":"text/plain; charset=utf-8"};if(z!=="GET"&&z!=="HEAD")return new Response("Method Not Allowed",{status:405,headers:{...B,Allow:"GET, HEAD"}});let{healthy:I,shuttingDown:J}=W();return new Response(z==="HEAD"?null:I?"ok":J?"shutting down":"degraded",{status:I?200:503,headers:B})}var L=Symbol.for("gemi.server.devGeneration"),X={graceMs:1e4,providerTimeoutMs:5000};class Y{app;inFlight=0;waiters=new Set;constructor(z){this.app=z}track(z){return async(B,I)=>{this.inFlight++;try{return await z(B,I)}finally{if(this.inFlight--,this.inFlight===0)this.wake()}}}get pending(){return this.inFlight}async retire({graceMs:z,providerTimeoutMs:B}){try{await this.idle(z),await Promise.resolve().then(()=>this.app.shutdown({timeoutMs:B}))}catch(I){C(I)}}idle(z){if(this.inFlight===0)return Promise.resolve();return new Promise((B)=>{let I=()=>{clearTimeout(J),this.waiters.delete(I),B()},J=setTimeout(I,z);this.waiters.add(I)})}wake(){for(let z of this.waiters)z()}}function N(z,B=X){let I=globalThis,J=I[L];if(I[L]=z,!J||J===z||typeof J.retire!=="function")return Promise.resolve();let K=J.retire.bind(J);return Promise.resolve().then(()=>K(B)).catch(C)}function C(z){console.error("[gemi] Shutting down the application a reload replaced failed:",z)}class k{app;instrumentation;handleSignals;server;stopping;settings;constructor(z){this.app=new S({kernel:z.kernel}),this.handleSignals=z.handleSignals??!0,this.instrumentation=U(z.instrumentation??((B,I)=>I(B)))}async start(){process.env.ROOT_DIR=H();let z=Bun.env.NODE_ENV==="production",B=_();if(z)G(B);let I=j(this.instrumentation,B.paths);if(z){if(this.handleSignals)A(()=>this.stop());this.settings=Z()}try{await this.app.waitForBoot()}catch(J){if(!z)this.app.shutdown({timeoutMs:X.providerTimeoutMs});throw J}if(z){let{httpProd:J}=await import("../chunk-2vfdahm9.js");this.server=await J(this.app,I)}else{f();let{httpDev:J}=await import("../chunk-bmam8bsm.js"),K=new Y(this.app);this.server=await J(this.app,K.track(I)),N(K)}return this.server}stop(z={}){let B=this.app.sockets();return this.stopping??=P({server:this.server,closeSockets:B?()=>B.shutdown():void 0,shutdownProviders:(I)=>this.app.shutdown(I),settings:{...this.settings??Z(),...z}}),this.stopping}}export{W as liveness,Q as isShuttingDown,k as Server};
|
|
3
3
|
|
|
4
4
|
//# debugId=2702630AE6892FE464756E2164756E21
|
package/dist/services/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{cb as w8}from"../chunk-fcqx2t0p.js";import{Ab as j8,Bb as M8,Cb as L8,Db as N8,Eb as S4,Fb as Z6,Gb as k,Hb as x8,Ib as D8,Jb as F8,Kb as H8,Lb as U8,Mb as O8,Nb as S8,Ob as R8,Pb as _8,Qb as f8,Rb as k8,Sb as C8,Tb as b8,Ub as T8,Vb as I8,Wb as P8,db as PZ,eb as wZ,fb as VZ,gb as vZ,hb as qZ,ib as H4,jb as yZ,kb as N4,lb as x4,mb as V1,nb as AZ,ob as hZ,pb as Z8,tb as $8,ub as J8,vb as Q8,wb as Y8,xb as z8,yb as X8,zb as B8}from"../chunk-mxqnrn1k.js";import"../chunk-7dwgex81.js";import{Ad as eZ,Bd as W8,md as gZ,nd as EZ,od as mZ,pd as cZ,qd as uZ,rd as dZ,sd as lZ,td as nZ,ud as iZ,vd as oZ,wd as sZ,xd as aZ,yd as tZ,zd as rZ}from"../chunk-r1x5ms0y.js";import{Cd as pZ}from"../chunk-6jd0e1dz.js";import{Dd as LZ,Ed as NZ,Fd as xZ,Gd as DZ,Hd as FZ,Id as HZ,Jd as UZ,Kd as OZ,Ld as SZ,Md as RZ,Nd as _Z,Od as fZ,Pd as kZ,Qd as CZ,Rd as bZ,Sd as TZ,Xd as IZ}from"../chunk-6zz3kez5.js";import{Yd as K8,Zd as G8}from"../chunk-c7ecv545.js";import"../chunk-6hs102jh.js";import{$e as W5,$f as i5,Ae as hW,Af as T5,Be as gW,Bf as P5,Ce as EW,De as mW,Ee as b0,Ef as w5,Fe as cW,Ff as V5,Ge as uW,Gf as v5,He as pW,Hf as q5,Ie as dW,Ig as KZ,Je as lW,Jf as y5,Jg as GZ,Kf as A5,Lf as h5,Mf as g5,Nf as E5,Of as m5,Pf as c5,Qf as u5,Rf as p5,Sf as d5,Xf as C,Yf as i,Zf as l5,_e as eW,_f as n5,af as Z5,ag as o5,bf as $5,bg as s5,cf as J5,df as Q5,dg as a5,eg as t5,fe as o0,fg as r5,ge as bW,gg as e5,he as TW,hg as WZ,ie as IW,jf as D5,ke as PW,kf as F5,kg as ZZ,lf as H5,lg as $Z,mf as U5,mg as JZ,ne as s0,nf as O5,oe as v0,of as S5,pe as q0,pf as R5,qe as G4,qf as _5,re as wW,rf as f5,rg as QZ,tf as k5,uf as W6,ve as VW,vf as C5,vg as YZ,we as vW,xe as qW,xg as v1,ye as yW,ze as AW,zf as b5}from"../chunk-ny01tp0y.js";import"../chunk-9b4ypfcw.js";import"../chunk-5013raxj.js";import{$h as T1,Bh as K4,Ch as J4,Dh as M1,Qh as L4,Th as t,Vh as d,Zh as Q4,_h as L1,ai as nW,bi as iW,ci as oW,di as sW,si as aW,ti as tW,vi as rW,xi as I1}from"../chunk-eve0hewa.js";import"../chunk-v2cv3wcw.js";import{Hi as r}from"../chunk-7hdfbp2x.js";import{Pi as j5,Qi as M5,Ri as b1,Si as L5,Ti as k0,Ui as N5,Vi as x5}from"../chunk-dzvp8ynr.js";import{$i as z5,aj as X5,bj as B5}from"../chunk-23mcs80p.js";import"../chunk-e9xbdgb2.js";import{Kj as I5}from"../chunk-gy307m19.js";import{Mj as Y5,Nj as K5,Oj as G5}from"../chunk-98dxtkbt.js";import"../chunk-ks7msv3e.js";import"../chunk-yxjfghq3.js";import"../chunk-8r9kna46.js";import"../chunk-rwrcsfzv.js";import{Ek as zZ,Fk as XZ,Gk as BZ,Hk as jZ,Jk as MZ}from"../chunk-t7qp951h.js";import"../chunk-rw4z3n9b.js";import{Tk as q}from"../chunk-kddgfct7.js";import"../chunk-s58hbczk.js";import"../chunk-apfk702c.js";import"../chunk-eyqsvzej.js";import"../chunk-9yfg4nqq.js";import"../chunk-5aj27bgc.js";import{rl as I0}from"../chunk-tbhtx2t0.js";import{Buffer as T0}from"buffer";class P0 extends L1{client;config;constructor(...W){super();this.config=W}async connect(){let W=await import("../chunk-6d9f4vw0.js");return this.client??=new W.S3Client(...this.config),{sdk:W,client:this.client}}async put(W,{signal:Z}={}){Z?.throwIfAborted();let $,J,Q,Y=process.env.BUCKET_NAME;if(W instanceof Blob)$=W,Q=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,J=W.type;else $=W.body,Q=W.name,Y=W.bucket??Y,J=W.contentType||($ instanceof Blob||$ instanceof File?$.type:void 0);J=J||void 0;let K=$ instanceof T0?$:$ instanceof Blob||$ instanceof File?T0.from(await $.arrayBuffer()):"",{sdk:G,client:z}=await this.connect();return Z?.throwIfAborted(),await z.send(new G.PutObjectCommand({Bucket:Y,Key:Q,Body:K,ContentType:J}),{abortSignal:Z}),Q}async delete(W){let Z=typeof W==="string"?W:W.name,$=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME;if(!Z)throw Error("Object name has to be specified");let{sdk:J,client:Q}=await this.connect();try{await Q.send(new J.DeleteObjectCommand({Bucket:$,Key:Z}))}catch(Y){if(Y?.name==="NoSuchKey"||Y?.$metadata?.httpStatusCode===404)return;throw Y}}async*pages(W,{bucket:Z,signal:$}){let{sdk:J,client:Q}=await this.connect(),Y;do{$?.throwIfAborted();let K=await Q.send(new J.ListObjectsV2Command({Bucket:Z??process.env.BUCKET_NAME,Prefix:W,ContinuationToken:Y}),{abortSignal:$});yield(K.Contents??[]).map((G)=>({name:G.Key,size:G.Size??0,lastModified:G.LastModified??new Date(0)})),Y=K.IsTruncated?K.NextContinuationToken:void 0}while(Y)}async*objects(W,Z={}){for await(let $ of this.pages(W,Z))yield*$}async deletePrefix(W,Z={}){Q4(W);let $=Z.bucket??process.env.BUCKET_NAME,{sdk:J,client:Q}=await this.connect(),Y=0;for await(let K of this.pages(W,{...Z,bucket:$})){if(K.length===0)continue;Z.signal?.throwIfAborted();let z=(await Q.send(new J.DeleteObjectsCommand({Bucket:$,Delete:{Objects:K.map((X)=>({Key:X.name})),Quiet:!0}}),{abortSignal:Z.signal}))?.Errors??[];if(z.length>0){let X=z[0];throw Error(`S3 could not delete ${z.length} object(s) under "${W}", e.g. "${X.Key}": ${X.Code??"unknown"} ${X.Message??""}`.trim())}Y+=K.length}return Y}async list(W){let{sdk:Z,client:$}=await this.connect();return await $.send(new Z.ListObjectsV2Command({Bucket:process.env.BUCKET_NAME,Prefix:W}))}async fetch(W,{signal:Z}={}){Z?.throwIfAborted();let $=process.env.BUCKET_NAME,J;if(typeof W==="string")J=W;else $=W.bucket??$,J=W.name;if(!J)throw Error("Object name has to be specified");let{sdk:Q,client:Y}=await this.connect();Z?.throwIfAborted();let K=await Y.send(new Q.GetObjectCommand({Bucket:$,Key:J}),{abortSignal:Z}),G=T1(K.Body.transformToWebStream(),Z);return Z?.throwIfAborted(),new Response(G,{headers:{"Content-Type":K.ContentType,"Content-Length":K.ContentLength.toString(),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":K.LastModified?.toUTCString()||"",ETag:K.ETag||""}})}async read(W){let Z=typeof W==="string"?{name:W}:W,$=Z.bucket??process.env.BUCKET_NAME,{name:J,range:Q=null}=Z;if(!J)throw Error("Object name has to be specified");let{sdk:Y,client:K}=await this.connect(),G;try{G=await K.send(new Y.GetObjectCommand({Bucket:$,Key:J,Range:Q?J4(Q):void 0}))}catch(j){if(j?.name==="InvalidRange"||j?.$metadata?.httpStatusCode===416)throw new t(await this.size({name:J,bucket:$}));if(j?.name==="NoSuchKey"||j?.$metadata?.httpStatusCode===404)throw new d(J);throw j}let z=M1(G.ContentRange),X=Boolean(z)&&G.$metadata?.httpStatusCode===206,B=z?.total??G.ContentLength??0;return{body:G.Body.transformToWebStream(),start:z?.start??0,end:z?.end??B-1,total:B,partial:X,type:G.ContentType??"application/octet-stream",etag:G.ETag||void 0,lastModified:G.LastModified,name:J}}async size(W){let Z=typeof W==="string"?W:W.name,$=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME,{sdk:J,client:Q}=await this.connect();try{return(await Q.send(new J.HeadObjectCommand({Bucket:$,Key:Z}))).ContentLength??0}catch(Y){if(Y?.name==="NotFound"||Y?.$metadata?.httpStatusCode===404)throw new d(Z);throw Y}}}import{Buffer as w0}from"buffer";import{Readable as m6}from"stream";function Y4(W){return W?.statusCode===404||W?.details?.errorCode==="BlobNotFound"||W?.code==="BlobNotFound"}function c6(W){return W?.statusCode===416||W?.details?.errorCode==="InvalidRange"||W?.code==="InvalidRange"}class V0 extends L1{config;serviceClientPromise=null;constructor(W={}){super();this.config=W}async serviceClient(){if(this.config.serviceClient)return this.config.serviceClient;return this.serviceClientPromise??=(async()=>{let W;try{W=await import("@azure/storage-blob")}catch{throw Error("AzureBlobDriver requires the '@azure/storage-blob' package. Install it with `bun add @azure/storage-blob`, or pass a pre-built `serviceClient`.")}let Z=this.config.connectionString??process.env.AZURE_STORAGE_CONNECTION_STRING;if(this.config.url)return new W.BlobServiceClient(this.config.url,this.config.credential);if(Z)return W.BlobServiceClient.fromConnectionString(Z);throw Error("AzureBlobDriver needs a connection string (AZURE_STORAGE_CONNECTION_STRING), a `url`, or a `serviceClient`.")})(),this.serviceClientPromise}async blob(W,Z){if(!W)throw Error("Object name has to be specified");let $=Z??this.config.container??process.env.BUCKET_NAME;if(!$)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");return(await this.serviceClient()).getContainerClient($).getBlockBlobClient(W)}async put(W,{signal:Z}={}){Z?.throwIfAborted();let $,J,Q,Y;if(W instanceof Blob)$=W,Q=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,J=W.type;else $=W.body,Q=W.name,Y=W.bucket,J=W.contentType??($ instanceof Blob||$ instanceof File?$.type:void 0);let K=$ instanceof w0?$:w0.from(await $.arrayBuffer()),G=await this.blob(Q,Y);return Z?.throwIfAborted(),await G.uploadData(K,{blobHTTPHeaders:J?{blobContentType:J}:void 0,abortSignal:Z}),Q}async*objects(W,{bucket:Z,signal:$}={}){$?.throwIfAborted();let J=Z??this.config.container??process.env.BUCKET_NAME;if(!J)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");let Y=(await this.serviceClient()).getContainerClient(J);for await(let K of Y.listBlobsFlat({prefix:W}))$?.throwIfAborted(),yield{name:K.name,size:K.properties?.contentLength??0,lastModified:K.properties?.lastModified??new Date(0)}}async list(W){let Z=this.config.container??process.env.BUCKET_NAME,J=(await this.serviceClient()).getContainerClient(Z),Q=[];for await(let Y of J.listBlobsFlat({prefix:W}))Q.push(Y.name);return Q}async fetch(W,{signal:Z}={}){Z?.throwIfAborted();let $=await this.download(typeof W==="string"?{name:W}:{name:W.name,bucket:W.bucket},Z);return new Response($.body,{headers:{"Content-Type":$.type,"Content-Length":String($.total),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":$.lastModified?.toUTCString()??"",ETag:$.etag??""}})}async read(W){return this.download(typeof W==="string"?{name:W}:W)}async download(W,Z){let{name:$,bucket:J,range:Q=null}=W,Y=await this.blob($,J);Z?.throwIfAborted();let K,G,z=Q?.kind==="suffix"||Q?.kind==="offset"&&Q.end===null&&Q.start===0;if(Q&&z){let H=await this.size({name:$,bucket:J}),p=K4(Q,H);if(!p)throw new t(H);K=p.start,G=p.length}else if(Q?.kind==="offset")K=Q.start,G=Q.end===null?void 0:Q.end-Q.start+1;let X;try{X=await Y.download(K,G,Z?{abortSignal:Z}:void 0)}catch(H){if(c6(H))throw new t(await this.size({name:$,bucket:J}));if(Y4(H))throw new d($);throw H}let B=M1(X.contentRange),j=Boolean(B),x=B?.total??X.contentLength??0,O=await u6(X);if(O instanceof ReadableStream)O=T1(O,Z);return Z?.throwIfAborted(),{body:O,start:B?.start??0,end:B?.end??x-1,total:x,partial:j,type:X.contentType??"application/octet-stream",etag:X.etag||void 0,lastModified:X.lastModified,name:$}}async size(W){let Z=typeof W==="string"?W:W.name,$=typeof W==="string"?void 0:W.bucket,J=await this.blob(Z,$);try{return(await J.getProperties()).contentLength??0}catch(Q){if(Y4(Q))throw new d(Z);throw Q}}async delete(W){let Z=typeof W==="string"?W:W.name,$=typeof W==="string"?void 0:W.bucket,J=await this.blob(Z,$);try{await J.delete()}catch(Q){if(Y4(Q))return;throw Q}}}async function u6(W){if(W.blobBody)return await W.blobBody;if(W.readableStreamBody)return m6.toWeb(W.readableStreamBody);return null}function p6(W){return W}var d6=`
|
|
2
|
+
import{cb as w8}from"../chunk-fcqx2t0p.js";import{Ab as j8,Bb as M8,Cb as L8,Db as N8,Eb as S4,Fb as Z6,Gb as k,Hb as x8,Ib as D8,Jb as F8,Kb as H8,Lb as U8,Mb as O8,Nb as S8,Ob as R8,Pb as _8,Qb as f8,Rb as k8,Sb as C8,Tb as b8,Ub as T8,Vb as I8,Wb as P8,db as PZ,eb as wZ,fb as VZ,gb as vZ,hb as qZ,ib as H4,jb as yZ,kb as N4,lb as x4,mb as V1,nb as AZ,ob as hZ,pb as Z8,tb as $8,ub as J8,vb as Q8,wb as Y8,xb as z8,yb as X8,zb as B8}from"../chunk-1vfnehjr.js";import"../chunk-7dwgex81.js";import{Ad as eZ,Bd as W8,md as gZ,nd as EZ,od as mZ,pd as cZ,qd as uZ,rd as dZ,sd as lZ,td as nZ,ud as iZ,vd as oZ,wd as sZ,xd as aZ,yd as tZ,zd as rZ}from"../chunk-r1x5ms0y.js";import{Cd as pZ}from"../chunk-6jd0e1dz.js";import{Dd as LZ,Ed as NZ,Fd as xZ,Gd as DZ,Hd as FZ,Id as HZ,Jd as UZ,Kd as OZ,Ld as SZ,Md as RZ,Nd as _Z,Od as fZ,Pd as kZ,Qd as CZ,Rd as bZ,Sd as TZ,Xd as IZ}from"../chunk-6zz3kez5.js";import{Yd as K8,Zd as G8}from"../chunk-c7ecv545.js";import"../chunk-6hs102jh.js";import{$e as W5,$f as i5,Ae as hW,Af as T5,Be as gW,Bf as P5,Ce as EW,De as mW,Ee as b0,Ef as w5,Fe as cW,Ff as V5,Ge as uW,Gf as v5,He as pW,Hf as q5,Ie as dW,Ig as KZ,Je as lW,Jf as y5,Jg as GZ,Kf as A5,Lf as h5,Mf as g5,Nf as E5,Of as m5,Pf as c5,Qf as u5,Rf as p5,Sf as d5,Xf as C,Yf as i,Zf as l5,_e as eW,_f as n5,af as Z5,ag as o5,bf as $5,bg as s5,cf as J5,df as Q5,dg as a5,eg as t5,fe as o0,fg as r5,ge as bW,gg as e5,he as TW,hg as WZ,ie as IW,jf as D5,ke as PW,kf as F5,kg as ZZ,lf as H5,lg as $Z,mf as U5,mg as JZ,ne as s0,nf as O5,oe as v0,of as S5,pe as q0,pf as R5,qe as G4,qf as _5,re as wW,rf as f5,rg as QZ,tf as k5,uf as W6,ve as VW,vf as C5,vg as YZ,we as vW,xe as qW,xg as v1,ye as yW,ze as AW,zf as b5}from"../chunk-bywhpfyv.js";import"../chunk-9b4ypfcw.js";import"../chunk-5013raxj.js";import{$h as T1,Bh as K4,Ch as J4,Dh as M1,Qh as L4,Th as t,Vh as d,Zh as Q4,_h as L1,ai as nW,bi as iW,ci as oW,di as sW,si as aW,ti as tW,vi as rW,xi as I1}from"../chunk-eve0hewa.js";import"../chunk-v2cv3wcw.js";import{Hi as r}from"../chunk-7hdfbp2x.js";import{Pi as j5,Qi as M5,Ri as b1,Si as L5,Ti as k0,Ui as N5,Vi as x5}from"../chunk-dzvp8ynr.js";import{$i as z5,aj as X5,bj as B5}from"../chunk-23mcs80p.js";import"../chunk-e9xbdgb2.js";import{Kj as I5}from"../chunk-gy307m19.js";import{Mj as Y5,Nj as K5,Oj as G5}from"../chunk-98dxtkbt.js";import"../chunk-ks7msv3e.js";import"../chunk-yxjfghq3.js";import"../chunk-8r9kna46.js";import"../chunk-rwrcsfzv.js";import{Ek as zZ,Fk as XZ,Gk as BZ,Hk as jZ,Jk as MZ}from"../chunk-t7qp951h.js";import"../chunk-rw4z3n9b.js";import{Tk as q}from"../chunk-kddgfct7.js";import"../chunk-s58hbczk.js";import"../chunk-apfk702c.js";import"../chunk-eyqsvzej.js";import"../chunk-9yfg4nqq.js";import"../chunk-5aj27bgc.js";import{rl as I0}from"../chunk-tbhtx2t0.js";import{Buffer as T0}from"buffer";class P0 extends L1{client;config;constructor(...W){super();this.config=W}async connect(){let W=await import("../chunk-6d9f4vw0.js");return this.client??=new W.S3Client(...this.config),{sdk:W,client:this.client}}async put(W,{signal:Z}={}){Z?.throwIfAborted();let $,J,Q,Y=process.env.BUCKET_NAME;if(W instanceof Blob)$=W,Q=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,J=W.type;else $=W.body,Q=W.name,Y=W.bucket??Y,J=W.contentType||($ instanceof Blob||$ instanceof File?$.type:void 0);J=J||void 0;let K=$ instanceof T0?$:$ instanceof Blob||$ instanceof File?T0.from(await $.arrayBuffer()):"",{sdk:G,client:z}=await this.connect();return Z?.throwIfAborted(),await z.send(new G.PutObjectCommand({Bucket:Y,Key:Q,Body:K,ContentType:J}),{abortSignal:Z}),Q}async delete(W){let Z=typeof W==="string"?W:W.name,$=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME;if(!Z)throw Error("Object name has to be specified");let{sdk:J,client:Q}=await this.connect();try{await Q.send(new J.DeleteObjectCommand({Bucket:$,Key:Z}))}catch(Y){if(Y?.name==="NoSuchKey"||Y?.$metadata?.httpStatusCode===404)return;throw Y}}async*pages(W,{bucket:Z,signal:$}){let{sdk:J,client:Q}=await this.connect(),Y;do{$?.throwIfAborted();let K=await Q.send(new J.ListObjectsV2Command({Bucket:Z??process.env.BUCKET_NAME,Prefix:W,ContinuationToken:Y}),{abortSignal:$});yield(K.Contents??[]).map((G)=>({name:G.Key,size:G.Size??0,lastModified:G.LastModified??new Date(0)})),Y=K.IsTruncated?K.NextContinuationToken:void 0}while(Y)}async*objects(W,Z={}){for await(let $ of this.pages(W,Z))yield*$}async deletePrefix(W,Z={}){Q4(W);let $=Z.bucket??process.env.BUCKET_NAME,{sdk:J,client:Q}=await this.connect(),Y=0;for await(let K of this.pages(W,{...Z,bucket:$})){if(K.length===0)continue;Z.signal?.throwIfAborted();let z=(await Q.send(new J.DeleteObjectsCommand({Bucket:$,Delete:{Objects:K.map((X)=>({Key:X.name})),Quiet:!0}}),{abortSignal:Z.signal}))?.Errors??[];if(z.length>0){let X=z[0];throw Error(`S3 could not delete ${z.length} object(s) under "${W}", e.g. "${X.Key}": ${X.Code??"unknown"} ${X.Message??""}`.trim())}Y+=K.length}return Y}async list(W){let{sdk:Z,client:$}=await this.connect();return await $.send(new Z.ListObjectsV2Command({Bucket:process.env.BUCKET_NAME,Prefix:W}))}async fetch(W,{signal:Z}={}){Z?.throwIfAborted();let $=process.env.BUCKET_NAME,J;if(typeof W==="string")J=W;else $=W.bucket??$,J=W.name;if(!J)throw Error("Object name has to be specified");let{sdk:Q,client:Y}=await this.connect();Z?.throwIfAborted();let K=await Y.send(new Q.GetObjectCommand({Bucket:$,Key:J}),{abortSignal:Z}),G=T1(K.Body.transformToWebStream(),Z);return Z?.throwIfAborted(),new Response(G,{headers:{"Content-Type":K.ContentType,"Content-Length":K.ContentLength.toString(),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":K.LastModified?.toUTCString()||"",ETag:K.ETag||""}})}async read(W){let Z=typeof W==="string"?{name:W}:W,$=Z.bucket??process.env.BUCKET_NAME,{name:J,range:Q=null}=Z;if(!J)throw Error("Object name has to be specified");let{sdk:Y,client:K}=await this.connect(),G;try{G=await K.send(new Y.GetObjectCommand({Bucket:$,Key:J,Range:Q?J4(Q):void 0}))}catch(j){if(j?.name==="InvalidRange"||j?.$metadata?.httpStatusCode===416)throw new t(await this.size({name:J,bucket:$}));if(j?.name==="NoSuchKey"||j?.$metadata?.httpStatusCode===404)throw new d(J);throw j}let z=M1(G.ContentRange),X=Boolean(z)&&G.$metadata?.httpStatusCode===206,B=z?.total??G.ContentLength??0;return{body:G.Body.transformToWebStream(),start:z?.start??0,end:z?.end??B-1,total:B,partial:X,type:G.ContentType??"application/octet-stream",etag:G.ETag||void 0,lastModified:G.LastModified,name:J}}async size(W){let Z=typeof W==="string"?W:W.name,$=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME,{sdk:J,client:Q}=await this.connect();try{return(await Q.send(new J.HeadObjectCommand({Bucket:$,Key:Z}))).ContentLength??0}catch(Y){if(Y?.name==="NotFound"||Y?.$metadata?.httpStatusCode===404)throw new d(Z);throw Y}}}import{Buffer as w0}from"buffer";import{Readable as m6}from"stream";function Y4(W){return W?.statusCode===404||W?.details?.errorCode==="BlobNotFound"||W?.code==="BlobNotFound"}function c6(W){return W?.statusCode===416||W?.details?.errorCode==="InvalidRange"||W?.code==="InvalidRange"}class V0 extends L1{config;serviceClientPromise=null;constructor(W={}){super();this.config=W}async serviceClient(){if(this.config.serviceClient)return this.config.serviceClient;return this.serviceClientPromise??=(async()=>{let W;try{W=await import("@azure/storage-blob")}catch{throw Error("AzureBlobDriver requires the '@azure/storage-blob' package. Install it with `bun add @azure/storage-blob`, or pass a pre-built `serviceClient`.")}let Z=this.config.connectionString??process.env.AZURE_STORAGE_CONNECTION_STRING;if(this.config.url)return new W.BlobServiceClient(this.config.url,this.config.credential);if(Z)return W.BlobServiceClient.fromConnectionString(Z);throw Error("AzureBlobDriver needs a connection string (AZURE_STORAGE_CONNECTION_STRING), a `url`, or a `serviceClient`.")})(),this.serviceClientPromise}async blob(W,Z){if(!W)throw Error("Object name has to be specified");let $=Z??this.config.container??process.env.BUCKET_NAME;if(!$)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");return(await this.serviceClient()).getContainerClient($).getBlockBlobClient(W)}async put(W,{signal:Z}={}){Z?.throwIfAborted();let $,J,Q,Y;if(W instanceof Blob)$=W,Q=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,J=W.type;else $=W.body,Q=W.name,Y=W.bucket,J=W.contentType??($ instanceof Blob||$ instanceof File?$.type:void 0);let K=$ instanceof w0?$:w0.from(await $.arrayBuffer()),G=await this.blob(Q,Y);return Z?.throwIfAborted(),await G.uploadData(K,{blobHTTPHeaders:J?{blobContentType:J}:void 0,abortSignal:Z}),Q}async*objects(W,{bucket:Z,signal:$}={}){$?.throwIfAborted();let J=Z??this.config.container??process.env.BUCKET_NAME;if(!J)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");let Y=(await this.serviceClient()).getContainerClient(J);for await(let K of Y.listBlobsFlat({prefix:W}))$?.throwIfAborted(),yield{name:K.name,size:K.properties?.contentLength??0,lastModified:K.properties?.lastModified??new Date(0)}}async list(W){let Z=this.config.container??process.env.BUCKET_NAME,J=(await this.serviceClient()).getContainerClient(Z),Q=[];for await(let Y of J.listBlobsFlat({prefix:W}))Q.push(Y.name);return Q}async fetch(W,{signal:Z}={}){Z?.throwIfAborted();let $=await this.download(typeof W==="string"?{name:W}:{name:W.name,bucket:W.bucket},Z);return new Response($.body,{headers:{"Content-Type":$.type,"Content-Length":String($.total),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":$.lastModified?.toUTCString()??"",ETag:$.etag??""}})}async read(W){return this.download(typeof W==="string"?{name:W}:W)}async download(W,Z){let{name:$,bucket:J,range:Q=null}=W,Y=await this.blob($,J);Z?.throwIfAborted();let K,G,z=Q?.kind==="suffix"||Q?.kind==="offset"&&Q.end===null&&Q.start===0;if(Q&&z){let H=await this.size({name:$,bucket:J}),p=K4(Q,H);if(!p)throw new t(H);K=p.start,G=p.length}else if(Q?.kind==="offset")K=Q.start,G=Q.end===null?void 0:Q.end-Q.start+1;let X;try{X=await Y.download(K,G,Z?{abortSignal:Z}:void 0)}catch(H){if(c6(H))throw new t(await this.size({name:$,bucket:J}));if(Y4(H))throw new d($);throw H}let B=M1(X.contentRange),j=Boolean(B),x=B?.total??X.contentLength??0,O=await u6(X);if(O instanceof ReadableStream)O=T1(O,Z);return Z?.throwIfAborted(),{body:O,start:B?.start??0,end:B?.end??x-1,total:x,partial:j,type:X.contentType??"application/octet-stream",etag:X.etag||void 0,lastModified:X.lastModified,name:$}}async size(W){let Z=typeof W==="string"?W:W.name,$=typeof W==="string"?void 0:W.bucket,J=await this.blob(Z,$);try{return(await J.getProperties()).contentLength??0}catch(Q){if(Y4(Q))throw new d(Z);throw Q}}async delete(W){let Z=typeof W==="string"?W:W.name,$=typeof W==="string"?void 0:W.bucket,J=await this.blob(Z,$);try{await J.delete()}catch(Q){if(Y4(Q))return;throw Q}}}async function u6(W){if(W.blobBody)return await W.blobBody;if(W.readableStreamBody)return m6.toWeb(W.readableStreamBody);return null}function p6(W){return W}var d6=`
|
|
3
3
|
local currentKey = KEYS[1]
|
|
4
4
|
local previousKey = KEYS[2]
|
|
5
5
|
local limit = tonumber(ARGV[1])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewRouteDispatcher.d.ts","sourceRoot":"","sources":["../../../services/router/ViewRouteDispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,KAAK,cAAc,EAAmC,MAAM,2BAA2B,CAAC;AAEjG,OAAO,EAEL,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,UAAU,CAAC;AAWlB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ViewRouteDispatcher.d.ts","sourceRoot":"","sources":["../../../services/router/ViewRouteDispatcher.ts"],"names":[],"mappings":"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"}
|
package/dist/testing/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as followLive } from "../chunks/live-
|
|
2
|
-
import { A as
|
|
1
|
+
import { t as followLive } from "../chunks/live-CR8v1KcI.js";
|
|
2
|
+
import { A as I18nProvider, H as liveModule, I as ProgressManager, J as applyParams, L as Action, R as createMemoryHistory, X as QueryManagerContext, Z as QueryManagerProvider, c as ClientRouterContext, i as RouteTransitionProvider, j as ServerDataContext, ot as Subject, q as toVariantKey, r as m, t as ThemeProvider, z as RealtimeContext } from "../chunks/ThemeProvider-D8T12nBG.js";
|
|
3
3
|
import { r as RouteStateProvider } from "../chunks/useParams-BN3XXfmG.js";
|
|
4
4
|
import { t as channelKey } from "../chunks/channelKey-CIhHpX6x.js";
|
|
5
5
|
import { Suspense, createElement, useContext, useMemo, useRef, useState } from "react";
|