gemi 0.143.0 → 0.144.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 +1 -1
- package/dist/{chunk-j2k408xc.js → chunk-27xsjq8a.js} +1 -1
- package/dist/{chunk-159c392q.js → chunk-6d3m2w2p.js} +1 -1
- package/dist/{chunk-mfn94b95.js → chunk-9zd7c4wq.js} +1 -1
- package/dist/{chunk-kkqw8bqg.js → chunk-a78b9v7h.js} +1 -1
- package/dist/{chunk-9qfd02h8.js → chunk-b4mg6v4g.js} +1 -1
- package/dist/{chunk-r0z27j6t.js → chunk-en33hg1c.js} +1 -1
- package/dist/chunk-fg2k18d2.js +5 -0
- package/dist/{chunk-mnmr27wd.js.map → chunk-fg2k18d2.js.map} +3 -3
- package/dist/{chunk-hnsrwr0p.js → chunk-t0wfj6hy.js} +2 -2
- package/dist/{chunk-hnsrwr0p.js.map → chunk-t0wfj6hy.js.map} +1 -1
- package/dist/{chunk-1rvnk7g8.js → chunk-w4ma7978.js} +1 -1
- package/dist/client/Head.d.ts.map +1 -1
- package/dist/client/index.js +7 -6
- package/dist/client/index.js.map +1 -1
- package/dist/facades/index.js +1 -1
- package/dist/http/Metadata.d.ts +8 -2
- package/dist/http/Metadata.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/kernel/index.js +1 -1
- package/dist/orm/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/services/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-mnmr27wd.js +0 -5
- /package/dist/{chunk-j2k408xc.js.map → chunk-27xsjq8a.js.map} +0 -0
- /package/dist/{chunk-159c392q.js.map → chunk-6d3m2w2p.js.map} +0 -0
- /package/dist/{chunk-mfn94b95.js.map → chunk-9zd7c4wq.js.map} +0 -0
- /package/dist/{chunk-kkqw8bqg.js.map → chunk-a78b9v7h.js.map} +0 -0
- /package/dist/{chunk-9qfd02h8.js.map → chunk-b4mg6v4g.js.map} +0 -0
- /package/dist/{chunk-r0z27j6t.js.map → chunk-en33hg1c.js.map} +0 -0
- /package/dist/{chunk-1rvnk7g8.js.map → chunk-w4ma7978.js.map} +0 -0
package/dist/facades/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Cg as v,Jf as q,Qe as a,Uf as r,Ve as c,Vf as s,We as e,Wf as t,Xe as f,Xf as u,Ye as h,Ze as i,_e as j,ff as k,gf as l,hf as m,if as n,jf as o,tf as p}from"../chunk-
|
|
2
|
+
import{Cg as v,Jf as q,Qe as a,Uf as r,Ve as c,Vf as s,We as e,Wf as t,Xe as f,Xf as u,Ye as h,Ze as i,_e as j,ff as k,gf as l,hf as m,if as n,jf as o,tf as p}from"../chunk-a78b9v7h.js";import"../chunk-ej4kf7m5.js";import"../chunk-5qfzvnyp.js";import{$h as b,Ai as g,yi as d}from"../chunk-27xsjq8a.js";import"../chunk-9k46m1vf.js";import"../chunk-fg2k18d2.js";import"../chunk-ktrm6y5j.js";import"../chunk-9xzg05xg.js";import"../chunk-a37shxb1.js";import"../chunk-68f0jpje.js";import"../chunk-1skdsmjx.js";import"../chunk-yjszzjyj.js";import"../chunk-p81qeav5.js";import"../chunk-t03nda3s.js";import"../chunk-qt6x2r6a.js";import"../chunk-m8yd59gg.js";import"../chunk-1ed75a7b.js";import"../chunk-0839f72f.js";import"../chunk-rvm5mkwm.js";import"../chunk-s29tgy4y.js";import"../chunk-8ex0y47w.js";import"../chunk-m6t5a0me.js";import"../chunk-t2nsn0r2.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=F9308858982AE10F64756E2164756E21
|
package/dist/http/Metadata.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ export type OpenGraphParams = {
|
|
|
5
5
|
description?: string;
|
|
6
6
|
type: string;
|
|
7
7
|
url: string;
|
|
8
|
-
image
|
|
8
|
+
/** Rendered as `og:image` only when set. A path is prefixed with the app origin. */
|
|
9
|
+
image?: string;
|
|
9
10
|
imageAlt?: string;
|
|
10
11
|
imageWidth?: number;
|
|
11
12
|
imageHeight?: number;
|
|
@@ -13,6 +14,11 @@ export type OpenGraphParams = {
|
|
|
13
14
|
twitterImageAlt?: string;
|
|
14
15
|
twitterImageWidth?: number;
|
|
15
16
|
twitterImageHeight?: number;
|
|
17
|
+
/**
|
|
18
|
+
* The `twitter:card` type. Defaults to `"summary_large_image"` when the page
|
|
19
|
+
* has an image (`twitterImage ?? image`), `"summary"` otherwise.
|
|
20
|
+
*/
|
|
21
|
+
twitterCard?: "summary" | "summary_large_image";
|
|
16
22
|
};
|
|
17
23
|
/**
|
|
18
24
|
* Attributes for the document's `<html>` element, handed to the root (or a
|
|
@@ -55,6 +61,6 @@ export declare class Metadata {
|
|
|
55
61
|
fonts(fonts: MetaFont[]): void;
|
|
56
62
|
title(title: string): void;
|
|
57
63
|
description(description: string): void;
|
|
58
|
-
openGraph({ title, description, type, url, image, imageAlt, imageWidth, imageHeight, twitterImage, twitterImageAlt, twitterImageWidth, twitterImageHeight, }: OpenGraphParams): void;
|
|
64
|
+
openGraph({ title, description, type, url, image, imageAlt, imageWidth, imageHeight, twitterImage, twitterImageAlt, twitterImageWidth, twitterImageHeight, twitterCard, }: OpenGraphParams): void;
|
|
59
65
|
}
|
|
60
66
|
//# sourceMappingURL=Metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Metadata.d.ts","sourceRoot":"","sources":["../../http/Metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAuC,MAAM,iBAAiB,CAAC;AAGrF,YAAY,EAAE,QAAQ,EAAE,CAAC;AAEzB,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Metadata.d.ts","sourceRoot":"","sources":["../../http/Metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAuC,MAAM,iBAAiB,CAAC;AAGrF,YAAY,EAAE,QAAQ,EAAE,CAAC;AAEzB,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,GAAG,qBAAqB,CAAC;CACjD,CAAC;AACF;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,8EAA8E;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;CAC9B,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,aAAa,GAAG;IAC1B,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,qBAAa,QAAQ;IACnB,OAAO,EAAE,GAAG,CAQV;IAEF;;;;OAIG;IACH,OAAO,UAAS;IAEhB,MAAM;;;;;;;;;IAYN,iFAAiF;IACjF,cAAc,CAAC,UAAU,EAAE,cAAc;IAQzC,SAAS,CAAC,GAAG,EAAE,MAAM;IAKrB,UAAU,CAAC,KAAK,EAAE,aAAa,EAAE;IAKjC,6FAA6F;IAC7F,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE;IAMvB,KAAK,CAAC,KAAK,EAAE,MAAM;IAKnB,WAAW,CAAC,WAAW,EAAE,MAAM;IAK/B,SAAS,CAAC,EACR,KAAK,EACL,WAAW,EACX,IAAI,EACJ,GAAG,EACH,KAAK,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,YAAoB,EACpB,eAA0B,EAC1B,iBAA8B,EAC9B,kBAAgC,EAChC,WAA8D,GAC/D,EAAE,eAAe;CAsBnB"}
|
package/dist/http/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$d as q,Dg as $,Eg as aa,Fg as ba,Ig as ca,Jg as da,Kg as ea,Lg as fa,Mg as ga,Ng as ha,Oe as G,Og as ia,Pe as H,Pg as ja,Qg as ka,Re as I,Rg as la,Se as J,Sg as ma,Te as K,Tg as na,Ue as L,Ug as oa,Vg as pa,Wg as qa,Xg as ra,Yg as sa,Zg as ta,ae as r,be as s,ce as t,de as u,dg as _,ee as B,je as C,me as D,ne as E,oe as F}from"../chunk-
|
|
2
|
+
import{$d as q,Dg as $,Eg as aa,Fg as ba,Ig as ca,Jg as da,Kg as ea,Lg as fa,Mg as ga,Ng as ha,Oe as G,Og as ia,Pe as H,Pg as ja,Qg as ka,Re as I,Rg as la,Se as J,Sg as ma,Te as K,Tg as na,Ue as L,Ug as oa,Vg as pa,Wg as qa,Xg as ra,Yg as sa,Zg as ta,ae as r,be as s,ce as t,de as u,dg as _,ee as B,je as C,me as D,ne as E,oe as F}from"../chunk-a78b9v7h.js";import"../chunk-ej4kf7m5.js";import"../chunk-5qfzvnyp.js";import{Eh as e,Fh as f,Gh as g,Hh as h,Ih as i,Jh as j,Oh as n,Ph as o,Uh as p,Vh as v,Wh as w,Xh as x,Yh as y,Zh as z,_h as A,ii as M,ji as N,ki as O,li as P,mi as Q,ni as R,oi as S,pi as T,qi as U,ri as V,si as W,ti as X,ui as Y,vi as Z,xh as a,yh as b,zh as d}from"../chunk-27xsjq8a.js";import{Ii as c}from"../chunk-9k46m1vf.js";import{Ni as k,Oi as l,Pi as m}from"../chunk-fg2k18d2.js";import"../chunk-ktrm6y5j.js";import"../chunk-9xzg05xg.js";import"../chunk-a37shxb1.js";import"../chunk-68f0jpje.js";import"../chunk-1skdsmjx.js";import"../chunk-yjszzjyj.js";import"../chunk-p81qeav5.js";import"../chunk-t03nda3s.js";import"../chunk-qt6x2r6a.js";import"../chunk-m8yd59gg.js";import"../chunk-1ed75a7b.js";import"../chunk-0839f72f.js";import"../chunk-rvm5mkwm.js";import"../chunk-s29tgy4y.js";import"../chunk-8ex0y47w.js";import"../chunk-m6t5a0me.js";import"../chunk-t2nsn0r2.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=21D2B7DA417A50CB64756E2164756E21
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ca as T}from"../chunk-ncb1qtae.js";import"../chunk-epvpmakp.js";import{ab as D}from"../chunk-b6mgrrk6.js";import{Yd as b,Zd as w}from"../chunk-p57nt0pm.js";import"../chunk-6hs102jh.js";import{Ve as j}from"../chunk-
|
|
2
|
+
import{ca as T}from"../chunk-ncb1qtae.js";import"../chunk-epvpmakp.js";import{ab as D}from"../chunk-b6mgrrk6.js";import{Yd as b,Zd as w}from"../chunk-p57nt0pm.js";import"../chunk-6hs102jh.js";import{Ve as j}from"../chunk-a78b9v7h.js";import"../chunk-ej4kf7m5.js";import"../chunk-5qfzvnyp.js";import"../chunk-27xsjq8a.js";import"../chunk-9k46m1vf.js";import"../chunk-fg2k18d2.js";import"../chunk-ktrm6y5j.js";import"../chunk-9xzg05xg.js";import"../chunk-a37shxb1.js";import"../chunk-68f0jpje.js";import"../chunk-1skdsmjx.js";import"../chunk-yjszzjyj.js";import"../chunk-p81qeav5.js";import"../chunk-t03nda3s.js";import"../chunk-qt6x2r6a.js";import{Ok as V,Pk as X,Qk as E,Rk as L,Sk as R,Tk as S}from"../chunk-m8yd59gg.js";import"../chunk-1ed75a7b.js";import"../chunk-0839f72f.js";import"../chunk-rvm5mkwm.js";import"../chunk-s29tgy4y.js";import"../chunk-8ex0y47w.js";import"../chunk-m6t5a0me.js";import"../chunk-t2nsn0r2.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=7BD4A860103E718964756E2164756E21
|
package/dist/kernel/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ea as E}from"../chunk-ceb4jcrm.js";import{$a as p}from"../chunk-
|
|
2
|
+
import{Ea as E}from"../chunk-ceb4jcrm.js";import{$a as p}from"../chunk-en33hg1c.js";import{ab as H}from"../chunk-b6mgrrk6.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-b4mg6v4g.js";import"../chunk-9zd7c4wq.js";import"../chunk-fpz9e3xx.js";import"../chunk-6jd0e1dz.js";import{Sd as h}from"../chunk-ce9wm3r9.js";import"../chunk-p57nt0pm.js";import"../chunk-6hs102jh.js";import{Ag as R,Me as n,Ne as v,sg as w,te as a,ue as d,wg as A}from"../chunk-a78b9v7h.js";import"../chunk-ej4kf7m5.js";import"../chunk-5qfzvnyp.js";import"../chunk-27xsjq8a.js";import"../chunk-9k46m1vf.js";import"../chunk-fg2k18d2.js";import"../chunk-ktrm6y5j.js";import{bj as M}from"../chunk-9xzg05xg.js";import"../chunk-a37shxb1.js";import"../chunk-68f0jpje.js";import"../chunk-1skdsmjx.js";import"../chunk-yjszzjyj.js";import"../chunk-p81qeav5.js";import"../chunk-t03nda3s.js";import"../chunk-qt6x2r6a.js";import"../chunk-5g7m7g4a.js";import"../chunk-m8yd59gg.js";import{Uk as O,Wk as z}from"../chunk-1ed75a7b.js";import"../chunk-0839f72f.js";import"../chunk-rvm5mkwm.js";import"../chunk-s29tgy4y.js";import"../chunk-8ex0y47w.js";import"../chunk-m6t5a0me.js";import"../chunk-t2nsn0r2.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/orm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ba as Y6}from"../chunk-3q7sc68p.js";import{$a as J6,Fa as l5,Ga as o5,Ha as i,Ia as T9,Ja as U3,Ka as e8,La as $6,Ma as S0,Na as p5,Oa as N3,Pa as Z6,Qa as t0,Ra as L0,Sa as k4,Ta as f4,Ua as g4,Va as w5,Wa as y4,Xa as h4,Ya as u4,Za as X6,_a as z6}from"../chunk-r0z27j6t.js";import{$g as o8,_g as l8,ah as t8,bh as r8,ch as a8}from"../chunk-ej4kf7m5.js";import{dh as N0,eh as n,fh as P,gh as s,jh as R,kh as w,lh as p,mh as m8,nh as p8,oh as a3,ph as d8,qh as v3,rh as f,sh as c8,th as s8,uh as i8,vh as n8,wh as m5}from"../chunk-5qfzvnyp.js";import"../chunk-mnmr27wd.js";import{$i as P0,_i as E8,aj as G0,bj as W9,cj as h3,ej as h8,fj as u8,kj as q4,lj as E4,mj as w4,nj as x4,oj as v4}from"../chunk-9xzg05xg.js";import{Bj as S8,Cj as v5,Dj as A8,Ej as b8,Fj as k5,Gj as P3,Hj as x0,Ij as g3,Jj as y3,Kj as d,Lj as q8,Mj as v0,Nj as f5,pj as K,qj as I,rj as w0,sj as k,tj as U8,uj as r,vj as N8,wj as x5,xj as O8,yj as j5,zj as F8}from"../chunk-a37shxb1.js";import{Uj as v8,Vj as o0,Wj as _0,Xj as T3,_j as k8,ak as f8,bk as g8,ck as g5,dk as y5,ek as q5,fk as R3,gk as y8,hk as h5,ik as u5}from"../chunk-p81qeav5.js";import{tk as w8,vk as x8,xk as E5}from"../chunk-t03nda3s.js";import{Xk as b5}from"../chunk-1ed75a7b.js";import"../chunk-0839f72f.js";import"../chunk-t2nsn0r2.js";function R0($,Z,X,z,J,H){let Y=e($,Z),G=H0($,Y,Z,H),V=X.quoteIdent(z),W=`${V}.`,M=G.parentFields.map((C,_)=>{let F=`${W}${X.quoteIdent(r0(Y,Z,G.childFields[_]))}`,T=`${J}${X.quoteIdent(r0($,Z,C))}`;return`${F} = ${T}`}).join(" and ");if(!G.join)return{child:Y,source:`${X.quoteIdent(Y.table)} as ${V}`,correlation:M,qualifier:W};let B=`${W}${X.quoteIdent(r0(Y,Z,G.childFields[0]))}`,D=`${J}${X.quoteIdent(r0($,Z,G.parentFields[0]))}`,j=X.quoteIdent(`${z}j`);return{child:Y,source:`${X.quoteIdent(Y.table)} as ${V} join ${X.quoteIdent(G.join.table)} as ${j} on ${j}.${X.quoteIdent(G.join.childColumn)} = ${B}`,correlation:`${j}.${X.quoteIdent(G.join.parentColumn)} = ${D}`,qualifier:W}}function r0($,Z,X){let z=$.fields[X];if(!z)throw new d($.name,Z.name,`it joins on '${X}', which is not a field on ${$.name}.`);return z.column}function h($,Z,X){let z=a0($);if(typeof Z!=="object"||Z===null||Array.isArray(Z))throw i5($,X,z);let J=Object.keys(Z).filter((Y)=>Z[Y]!==void 0),H=Z;for(let Y of z){if(Y.length===1&&J.includes(Y[0]))return s5($,X,Y[0],H[Y[0]]),Y;let G=Y.join("_");if(Y.length>1&&J.includes(G)){let V=H[G];if(V&&typeof V==="object"&&!Array.isArray(V))for(let W of Y)s5($,X,`${G}.${W}`,V[W]);return Y}}throw i5($,X,z)}function A3($){if($===null||$===void 0)return!1;let Z=typeof $;if(Z!=="object")return Z!=="function"&&Z!=="symbol";if(Array.isArray($))return!1;if($ instanceof Date||ArrayBuffer.isView($))return!0;let X=Object.getPrototypeOf($);return X!==Object.prototype&&X!==null}function s5($,Z,X,z){if(z===void 0||A3(z))return;throw new I(`${Z.argument}.${X}`,Z.model,Z.operation,`A unique key takes a plain value to match, not ${z===null?"null":Array.isArray(z)?"an array":"a filter object"}. Use findFirst/findMany (or updateMany/deleteMany) to filter on ${$.name}.${X.split(".").pop()}.`)}function b3($,Z,X){h($,Z,{model:$.name,operation:X,argument:"where"})}function a0($){let Z=[];if($.primaryKey.length>0)Z.push($.primaryKey);for(let X of $.uniques)Z.push(X);return Z}function i5($,Z,X){let z=X.map((Y)=>Y.length===1?Y[0]:Y.join("_")).join(", "),H=Z.argument.startsWith("data.")?`Name it by one of those, or reach it through the ${$.name} model directly.`:`Use ${Z.operation==="delete"||Z.operation==="update"?`${Z.operation}Many`:"findFirst"} to query on anything else.`;return new K(Z.argument,Z.model,Z.operation,`${$.name} needs a unique field here. It declares: ${z}. ${H}`)}function g($,Z,X){let z=Z.castParameter($);if(!z)return s(X);return s((J,H)=>{let Y=X(J,H);if(Y===null||Y===void 0)return null;let G=f(Y);if(G==="db")return null;if(G==="json")return"null";if(G==="any")throw Error("gemi ORM bug: Prisma.AnyNull reached the parameter binder. It is a filter operand only, and both the filter and write paths are supposed to have handled it before this point.");return JSON.stringify(Y)},z)}function v($,Z,X,z){if(Z===void 0||Z===null)return null;if(typeof Z!=="object"||Array.isArray(Z))throw new I("where",$.name,X.operation,"Expected an object.");let J=[];for(let H of Object.keys(Z).sort()){let Y=Z[H];if(Y===void 0)continue;let G=(W)=>z(W)?.[H];if(H==="AND"||H==="OR"){let W=n5($,Y,X,G,H);if(W)J.push(W);continue}if(H===$0){J.push(r4($,Y,X,G));continue}if(H==="NOT"){let W=n5($,Y,X,G,"AND");if(W)J.push(R(P("not "),b0(W)));continue}if(H in $.relations){let W=l4($,$.relations[H],Y,X,G);if(W)J.push(W);continue}let V=$.fields[H];if(!V){let W=t4($,H,Y,X,G);if(W){J.push(W);continue}throw new k(H,$.name,Object.keys($.fields))}J.push(k3($,V,Y,X,G))}if(J.length===0)return null;if(J.length===1)return J[0];return l(J," and ")}function l4($,Z,X,z,J){let H=l5(Z.kind),Y=o4($,Z,X,H,z),G=z.relationDepth??0,V=z.dialect,W=z.qualifier??`${V.quoteIdent($.table)}.`,M=R0($,Z,V,`_r${G}`,W,z.operation),B=M.child,D=P(M.correlation),j={...z,qualifier:M.qualifier,relationDepth:G+1},C=[];for(let _ of H){if(!(_ in Y))continue;let F=Y[_],T=(U)=>Y.direct?J(U):J(U)?.[_];if(F===null){C.push(q3(M,D,null,_==="is"));continue}let Q=v(B,F,j,T);if(_==="every"){if(!Q)continue;C.push(q3(M,D,R(P("not "),b0(Q)),!0));continue}let L=_==="none"||_==="isNot";C.push(q3(M,D,Q,L))}if(C.length===0)return null;if(C.length===1)return C[0];return l(C," and ")}function q3($,Z,X,z){let J=[P(`${z?"not ":""}exists (select 1 from ${$.source} where `),Z];if(X)J.push(P(" and "),X);return J.push(P(")")),R(...J)}function o4($,Z,X,z,J){let H=`where.${Z.name}`,Y=Z.kind==="many";if(X===null){if(Y)throw new K(H,$.name,J.operation,`${Z.name} is a to-many relation, so null is not a filter for it. Use { none: {} } for "has no related rows".`);return{is:null,direct:!0}}if(typeof X!=="object"||Array.isArray(X))throw new I(H,$.name,J.operation,Y?`Expected an object holding ${z.join(", ")}.`:"Expected an object, or null.");if(o5(X,z))return X;if(Y)throw new K(H,$.name,J.operation,`Expected one of ${z.join(", ")}. A to-many relation has no `+"single reading of a bare filter \u2014 { some: \u2026 } and { every: \u2026 } mean "+"different things.");return{is:X,direct:!0}}function t4($,Z,X,z,J){let H=a0($).find((V)=>V.length>1&&V.join("_")===Z);if(!H)return null;if(typeof X!=="object"||X===null||Array.isArray(X))throw new I(`where.${Z}`,$.name,z.operation,`Expected an object holding ${H.join(" and ")}.`);let Y=X,G=[];for(let V of H){if(Y[V]===void 0)throw new K(`where.${Z}`,$.name,z.operation,`Missing '${V}'. A composite key needs all of ${H.join(", ")}.`);if(!A3(Y[V]))throw new I(`where.${Z}.${V}`,$.name,z.operation,`A composite key takes a plain value for each of ${H.join(", ")}, not a filter, an array or null.`);G.push(k3($,$.fields[V],Y[V],z,(W)=>J(W)?.[V]))}return G.length===1?G[0]:l(G," and ")}function n5($,Z,X,z,J){let H=[];if(Array.isArray(Z))for(let Y=0;Y<Z.length;Y++){let G=v($,Z[Y],X,(V)=>z(V)?.[Y]);if(G)H.push(G)}else{let Y=v($,Z,X,z);if(Y)H.push(Y)}if(H.length===0)return J==="AND"?null:t5;if(H.length===1)return H[0];return l(H,J==="AND"?" and ":" or ")}var t5=P("false");function l($,Z){return R(P("("),w($,Z),P(")"))}function b0($){return $.text.startsWith("(")?$:l([$],"")}var x3=new Set(["equals","not","in","notIn","lt","lte","gt","gte","contains","startsWith","endsWith","mode"]),r5={lt:"<",lte:"<=",gt:">",gte:">="},$0="$compositeIn",a5=Symbol("gemi.orm.compositeInFromPlanner");function e5($,Z){return{[a5]:!0,fields:$,values:Z}}function r4($,Z,X,z){let{dialect:J}=X,Y=a4($,Z,X).map((V)=>{let W=$.fields[V];if(!W)throw new k(V,$.name,Object.keys($.fields));return W}),G=Y.map((V)=>`${X.qualifier??""}${J.quoteIdent(V.column)}`);return J.compositeIn(G,Y.map((V)=>V.type),(V)=>z(V).values)}function a4($,Z,X){let z=()=>{throw new k($0,$.name,Object.keys($.fields))};if(typeof Z!=="object"||Z===null||Array.isArray(Z))return z();if(Z[a5]!==!0)return z();let J=(G)=>{throw new K($0,$.name,X.operation,G)},{fields:H,values:Y}=Z;if(!Array.isArray(H)||H.length===0)return J(`the planner built a '${$0}' with no fields.`);if(!H.every((G)=>typeof G==="string"))return J(`the planner built a '${$0}' with a non-string field.`);if(!Array.isArray(Y))return J(`the planner built a '${$0}' with no values.`);if(!Y.every((G)=>Array.isArray(G)&&G.length===H.length))return J(`the planner built a '${$0}' whose tuples do not all have ${H.length} value(s).`);return H}var e4=["equals","has","hasEvery","hasSome","isEmpty"],E3=new Set(e4);function $7($,Z,X,z,J,H){let{dialect:Y}=J;if(U0($,Z,`where.${Z.name}`,J.operation,Y),Array.isArray(z))throw new I(`where.${Z.name}`,$.name,J.operation,`'${Z.name}' is a scalar list, and a bare array is not a filter on `+"one \u2014 Prisma rejects it here too. Say which comparison you mean: "+`{ ${Z.name}: { equals: [...] } } for the whole list, or { ${Z.name}: { hasEvery: [...] } } for "contains all of these". A bare array *is* accepted as a value in \`data\`.`);if(!f3(z))throw new I(`where.${Z.name}`,$.name,J.operation,`'${Z.name}' is a scalar list. Expected an object holding ${[...E3].sort().join(", ")}; received ${z===null?"null":typeof z}.`);let G=z,V=[];for(let W of Object.keys(G).sort()){let M=G[W];if(M===void 0)continue;if(!E3.has(W))throw new I(`where.${Z.name}.${W}`,$.name,J.operation,`'${Z.name}' is a scalar list, and a list filter takes ${[...E3].sort().join(", ")}. The scalar operators \u2014 `+`${[...x3].sort().join(", ")} \u2014 apply to a single value and `+"Prisma does not offer them here.");let B=(D)=>H(D)?.[W];V.push(Z7($,Z,X,W,M,J,B))}if(V.length===0)return P("true");if(V.length===1)return V[0];return l(V," and ")}function Z7($,Z,X,z,J,H,Y){let{dialect:G}=H;if(z==="equals")return X7($,Z,X,J,H,Y);if(z==="isEmpty"){if(typeof J!=="boolean")throw new I(`where.${Z.name}.isEmpty`,$.name,H.operation,`Expected true or false, received ${J===null?"null":typeof J}.`);return G.listIsEmpty(X,J)}if(z==="has"){let W=z7(Z);return G.listHas(X,g(W,G,I0(W,G,Y)))}if(!Array.isArray(J))throw new I(`where.${Z.name}.${z}`,$.name,H.operation,`Expected an array, received ${J===null?"null":typeof J}.`);let V=g(Z,G,I0(Z,G,Y));return z==="hasEvery"?G.listHasEvery(X,V):G.listHasSome(X,V)}function X7($,Z,X,z,J,H){let{dialect:Y}=J;if(z===null)return P(`${X} is null`);if(!Array.isArray(z))throw new I(`where.${Z.name}.equals`,$.name,J.operation,`'${Z.name}' is a scalar list, so it compares against an array. Received ${typeof z}. For "is this element present", use { ${Z.name}: { has: \u2026 } }.`);return R(P(`${X} = `),g(Z,Y,I0(Z,Y,H)))}function z7($){return{...$,isList:!1}}function U0($,Z,X,z,J){if(J.listFilters.size>0)return;throw new K(X,$.name,z,`'${Z.name}' is a scalar list, and ${J.name} has no array type to hold one. Prisma refuses the column itself on ${J.name} \u2014 `+'"the current connector does not support lists of primitive types" \u2014 so '+`this is a difference between the databases rather than a gap in the ORM. The generated artifact is dialect-agnostic, which is why this surfaces here rather than at \`prisma generate\`: the schema was generated against Postgres and DATABASE_URL names a ${J.name} database, which has no '${Z.column}' column either. It works on postgres.`)}var J7=["equals","not","string_contains","string_starts_with","string_ends_with","array_contains","lt","lte","gt","gte"],w3=new Set(J7),Y7=["has_key","has_some_keys","has_every_key"],e0=new Set(Y7);function $9($,Z,X,z,J,H,Y,G){let V=z!=="has_key",W=`where.${Z.name}.${z}`,M=(D)=>{if(!(V?Array.isArray(D)&&D.every((C)=>typeof C==="string"):typeof D==="string"))throw new I(W,$.name,H.operation,V?"Expected an array of key names, like ['a', 'b'].":"Expected a key name, like 'a'.");return D};M(J);let B=(D,j)=>M(G(D,j));return H.dialect.jsonHasKeys(X,Y,B,z==="has_key"?"one":z==="has_some_keys"?"some":"every",Array.isArray(J)?J.length:0)}function H7($,Z,X,z,J,H){let{dialect:Y}=J;if(Z.type!=="Json")throw new K(`${Z.name}.path`,$.name,J.operation,`A 'path' filter reads inside a JSON document, and '${Z.name}' is a ${Z.type} column.`);M7($,Z,z.path,J);let G=(M)=>H(M)?.path,V=Object.keys(z).filter((M)=>M!=="path"&&z[M]!==void 0).sort();if(V.length===0)throw new K(`${Z.name}.path`,$.name,J.operation,`A 'path' needs a filter beside it \u2014 ${[...w3,...e0].sort().join(", ")}. Prisma refuses a bare path too.`);let W=[];for(let M of V){if(e0.has(M)){W.push($9($,Z,X,M,z[M],J,G,(j)=>H(j)?.[M]));continue}if(!w3.has(M))throw new K(`${Z.name}.${M}`,$.name,J.operation,`A JSON path filter takes ${[...w3,...e0].sort().join(", ")}.`);if(!Y.jsonFilters.has(M))throw new K(`${Z.name}.${M}`,$.name,J.operation,`'${M}' on a JSON path is not available on ${Y.name}. Prisma refuses it here too, so this is a difference between the databases rather than a gap in the ORM. It works on postgres.`);let B=z[M],D=B===null?"json":f(B);if(D&&(M==="equals"||M==="not")){W.push(V7(D,X,G,Z,Y,M==="not"));continue}if(D&&B!==null){let j=M==="array_contains"?"'array_contains' tests containment against a document, and a sentinel is not one":`'${M}' compares an extracted value against a scalar, and a sentinel is not one`;throw new I(`where.${Z.name}.${M}`,$.name,J.operation,`${q0(D)} asks which kind of null a value is, which `+`only 'equals' and 'not' can express \u2014 ${j}. Prisma refuses it under this operator too. Write { ${Z.name}: { path: [\u2026], equals: ${q0(D)} } }, `+"or filter the column itself \u2014 "+`{ ${Z.name}: { equals: ${q0(D)} } }.`)}if(Z9(B))throw new I(`where.${Z.name}.${M}`,$.name,J.operation,"Prisma.AnyNull is a question rather than a value \u2014 'either kind of "+"null' \u2014 so it cannot appear inside a document. Ask it directly: "+`{ ${Z.name}: { path: [\u2026], equals: Prisma.AnyNull } }.`);G7(M,B,$,Z,J),W.push(W7(M,X,G,Z,Y,(j)=>H(j)?.[M]))}return W.length===1?W[0]:l(W," and ")}function V7($,Z,X,z,J,H){let Y=()=>R(J.jsonValueAt(Z,X),P(H?" is not null":" is null")),G=()=>R(J.jsonValueAt(Z,X),P(H?" <> ":" = "),g(z,J,()=>J.encode(v3,z)));if($==="db")return Y();if($==="json")return G();return l([G(),Y()],H?" and ":" or ")}function G7($,Z,X,z,J){let H=$==="string_contains"||$==="string_starts_with"||$==="string_ends_with";if(H&&typeof Z!=="string")throw new I(`where.${z.name}.${$}`,X.name,J.operation,`Expected a string, received ${Z===null?"null":typeof Z}. Prisma raises here too \u2014 without this the pattern becomes `+`'%${String(Z)}%', which runs and returns the wrong rows.`);if(Z===null)throw new I(`where.${z.name}.${$}`,X.name,J.operation,$==="array_contains"?"null cannot be tested for containment through a JSON path: the operand binds as SQL NULL rather than as the JSON value, and "+"'x @> NULL' is NULL rather than true \u2014 the query would run and "+`match nothing. A null *inside* the document is an ordinary value and still compiles: { ${z.name}: { path: [\u2026], array_contains: [null] } }.`:`null cannot be compared through a JSON path with '${$}', which `+"compares the extracted value as a number \u2014 the comparison against "+`NULL is NULL rather than true, so the query would run and match nothing. Prisma refuses it here too. For "the value at this path is a JSON null", use equals or not: { ${z.name}: { path: [\u2026], equals: null } }.`);if($==="array_contains"||H)return;if(typeof Z==="object")throw new K(`where.${z.name}.${$}`,X.name,J.operation,`'${$}' on a JSON path compares the extracted value as a scalar, so `+"an object or array operand cannot be expressed \u2014 it would bind as "+`'${String(Z)}' and match nothing. Prisma accepts one here; gemi does not yet. Use array_contains for containment, or narrow the path until it names a scalar.`)}function W7($,Z,X,z,J,H){if($==="array_contains")return J.jsonArrayContains(Z,X,H);let Y=$==="string_contains"||$==="string_starts_with"||$==="string_ends_with",G=J.jsonExtract(Z,X,!0);if(Y){let B=$==="string_contains"?(D)=>`%${D}%`:$==="string_starts_with"?(D)=>`${D}%`:(D)=>`%${D}`;return R(P("("),G,P(") like "),s((D,j)=>{let C=H(D,j);return C===null||C===void 0?null:B(String(C))}))}let V=$==="equals"?"=":$==="not"?"<>":r5[$],W=$!=="equals"&&$!=="not",M=W?R(P("cast(("),G,P(") as real)")):R(P("("),G,P(")"));return R(M,P(` ${V} `),s((B,D)=>{let j=H(B,D);if(j===null||j===void 0)return null;if(W)return Number(j);return J.jsonComparesAsText?String(j):j}))}function M7($,Z,X,z){let{dialect:J}=z,H=J.jsonPathSyntax==="array"?"array":"jsonpath",Y=Array.isArray(X)?"array":typeof X==="string"?"jsonpath":"other";if(Array.isArray(X)&&X.length===0||X==="")throw new K(`${Z.name}.path`,$.name,z.operation,`A JSON path cannot be empty. ${J.jsonPathSyntax==="array"?`On ${J.name} an empty array selects the whole document, `+"which is a filter on the column rather than on a path \u2014 write "+`{ ${Z.name}: { equals: \u2026 } } if that is what you meant.`:`On ${J.name} an empty string raises inside json_extract.`}`);if(Y===H){if(H!=="array")return;let V=X.findIndex((B)=>typeof B!=="string");if(V===-1)return;let W=X[V],M=W===null?"null":W===void 0?"undefined":Array.isArray(W)?"an array":typeof W==="object"?"an object":`a ${typeof W}`;throw new K(`${Z.name}.path`,$.name,z.operation,`A JSON path is an array of strings, and path[${V}] is ${M}. `+(typeof W==="number"?'An array index is a key too \u2014 write ["items", "0"] rather than '+`["items", 0]; it reaches the same element, because ${J.name} takes the path as text. Prisma's path is string[] and its client refuses a number here too.`:"Prisma's path is string[] too."))}throw new K(`${Z.name}.path`,$.name,z.operation,J.jsonPathSyntax==="array"?`On ${J.name} a JSON path is an array of keys \u2014 ["a", "b"] \u2014 `+"not a JSONPath string. Prisma splits them the same way, and refuses the other form on each database.":`On ${J.name} a JSON path is a JSONPath string \u2014 "$.a.b" \u2014 not `+"an array of keys. Prisma splits them the same way, and refuses the other form on each database.")}function k3($,Z,X,z,J){let{dialect:H}=z,Y=`${z.qualifier??""}${H.quoteIdent(Z.column)}`,G=f(X);if(G)throw new I(`where.${Z.name}`,$.name,z.operation,`${q0(G)} is not a filter on `+"its own \u2014 Prisma rejects it here too. Write it as an explicit "+`comparison: { ${Z.name}: { equals: ${q0(G)} } }.`);if(Z.isList)return $7($,Z,Y,X,z,J);if(!f3(X))return $3(Y,Z,X,H,J);let V=X,W=Object.keys(V).sort();if(V.path!==void 0)return H7($,Z,Y,V,z,J);let M=V.mode==="insensitive";if(V.mode!==void 0&&V.mode!=="default"){if(!M)throw new I(`mode: ${JSON.stringify(V.mode)}`,$.name,z.operation,"Prisma takes 'default' or 'insensitive'.");if(!H.supportsInsensitiveMode)throw new K('mode: "insensitive"',$.name,z.operation,`The ${H.name} dialect cannot express it \u2014 Prisma rejects it `+"here too. Note SQLite's LIKE is already case-insensitive for ASCII.")}let B=[];for(let D of W){let j=V[D];if(j===void 0||D==="mode")continue;if(Z.type==="Json"&&e0.has(D)){B.push($9($,Z,Y,D,j,z,void 0,(_)=>J(_)?.[D]));continue}if(!x3.has(D))throw new I(`where.${Z.name}.${D}`,$.name,z.operation,`A scalar filter takes ${[...x3].sort().join(", ")}.`);if(D!=="equals"&&D!=="not"&&Z9(j))throw new I(`where.${Z.name}.${D}`,$.name,z.operation,`Prisma.AnyNull means 'either kind of null', which only 'equals' and 'not' can express. Write { ${Z.name}: { equals: Prisma.AnyNull } }, or name the one you mean with Prisma.DbNull or Prisma.JsonNull.`);let C=(_)=>J(_)?.[D];switch(D){case"equals":B.push($3(Y,Z,j,H,C));break;case"not":B.push(B7($,Z,j,z,C,Y));break;case"in":case"notIn":B.push(j7($,Y,Z,j,z,C,D==="notIn"));break;case"lt":case"lte":case"gt":case"gte":B.push(R(P(`${Y} ${r5[D]} `),g(Z,H,I0(Z,H,C))));break;case"contains":case"startsWith":case"endsWith":if(typeof j!=="string")throw new I(`where.${Z.name}.${D}`,$.name,z.operation,`Expected a string, received ${j===null?"null":typeof j}.`);if(Z.type!=="String")throw new K(`where.${Z.name}.${D}`,$.name,z.operation,`'${Z.name}' is a ${Z.type}, and ${D} only applies to strings.`);B.push(H.like(Y,M,P7(D,C)));break}}if(B.length===0)return P("true");if(B.length===1)return B[0];return l(B," and ")}function q0($){return`Prisma.${$==="db"?"DbNull":$==="json"?"JsonNull":"AnyNull"}`}function Z9($){if(f($)==="any")return!0;return Array.isArray($)&&$.some((Z)=>f(Z)==="any")}function B7($,Z,X,z,J,H){if(X===null||f(X)==="db")return P(`${H} is not null`);if(f(X)==="json")return R(P("not "),b0($3(H,Z,X,z.dialect,J)));if(f(X)==="any")return R(P("not "),b0($3(H,Z,X,z.dialect,J)));if(!f3(X))return R(P(`${H} <> `),g(Z,z.dialect,I0(Z,z.dialect,J)));let Y=k3($,Z,X,z,J);return R(P("not "),b0(Y))}function $3($,Z,X,z,J){if(X===null||f(X)==="db")return P(`${$} is null`);if(f(X)==="any")return l([P(`${$} is null`),D7($,Z,z)]," or ");return R(P(`${$} = `),g(Z,z,I0(Z,z,J)))}function D7($,Z,X){return R(P(`${$} = `),g(Z,X,()=>X.encode(v3,Z)))}function j7($,Z,X,z,J,H,Y){let{dialect:G}=J;if(!Array.isArray(z))throw new I(`where.${X.name}.${Y?"notIn":"in"}`,$.name,J.operation,"Expected an array.");if(z.length===0)return Y?P("true"):t5;return G.inList(Z,Y,z.length,(V)=>{return H(V).map((M)=>G.encode(M,X))})}function P7($,Z){return(X)=>{let z=String(Z(X));if($==="contains")return`%${z}%`;if($==="startsWith")return`${z}%`;return`%${z}`}}function I0($,Z,X){return(z)=>Z.encode(X(z),$)}function f3($){return typeof $==="object"&&$!==null&&!Array.isArray($)&&!($ instanceof Date)&&!ArrayBuffer.isView($)}function X9($,Z,X,z,J,H,Y){let G=`orderBy.${Z.name}`;if(typeof X!=="object"||X===null||Array.isArray(X))throw new I(G,$.name,z,Z.kind==="many"?'Expected { _count: "asc" | "desc" }.':`Expected an object naming one field of ${Z.model}.`);let V=X,W=Object.keys(V).filter((_)=>_!=="where");if(W.length!==1)throw new K(G,$.name,z,W.length===0?"Name the field to order by.":`Name exactly one field to order by; got ${W.join(", ")}. `+"Order by several with an array: [{ a: \u2026 }, { b: \u2026 }].");let[M]=W,B=R0($,Z,J,`_o${Y}`,`${J.quoteIdent($.table)}.`,z),D=K7($,Z,B.child,M,V[M],z,B.qualifier,J),j=v(B.child,V.where,{dialect:J,operation:z,qualifier:B.qualifier},(_)=>H(_)?.where),C=[P(`(select ${D.expression} from ${B.source} where ${B.correlation}`)];if(j)C.push(P(" and "),j);return C.push(P(")")),{expression:R(...C),direction:D.direction,nulls:D.nulls}}function K7($,Z,X,z,J,H,Y,G){let V=`orderBy.${Z.name}.${z}`,{direction:W,nulls:M}=Q7($,V,J,H);if(z===i){if(Z.kind!=="many")throw new K(V,$.name,H,`${Z.name} is a to-one relation, so its count is 0 or 1. Order by one of ${X.name}'s fields instead.`);return{expression:"count(*)",direction:W,nulls:M}}if(Z.kind==="many")throw new K(V,$.name,H,`${Z.name} is a to-many relation, so ordering by '${z}' has no single answer for a parent with several children. Only `+"{ _count: \u2026 } is supported.");let B=X.fields[z];if(!B)throw new K(V,$.name,H,`'${z}' is not a field on ${X.name}. Known fields: ${Object.keys(X.fields).join(", ")}.`);return{expression:`${Y}${G.quoteIdent(B.column)}`,direction:W,nulls:M}}function Q7($,Z,X,z){if(X==="asc"||X==="desc")return{direction:X};if(typeof X==="object"&&X!==null){let{sort:J,nulls:H}=X;if(J!=="asc"&&J!=="desc")throw new I(Z,$.name,z,'Expected "asc" or "desc".');if(H===void 0)return{direction:J};if(H!=="first"&&H!=="last")throw new K(`${Z}.nulls`,$.name,z,'Expected "first" or "last".');return{direction:J,nulls:H}}throw new K(Z,$.name,z,'Expected "asc", "desc", or { sort, nulls }.')}var _7=new Set(["asc","desc"]),C7=new Set(["first","last"]);function V0($,Z,X,z){if(Z===void 0||Z===null)return[];let J=Array.isArray(Z),H=J?Z:[Z],Y=[];for(let G=0;G<H.length;G++){let V=H[G],W=(M)=>{let B=z?.locate(M);return J?B?.[G]:B};if(typeof V!=="object"||V===null)throw new I("orderBy",$.name,X,"Expected an object or an array of objects.");for(let[M,B]of Object.entries(V)){if(B===void 0)continue;if(M in $.relations){if(!z)throw new K(`orderBy.${M}`,$.name,X,"Ordering by a relation is not implemented here.");let j=X9($,$.relations[M],B,X,z.dialect,(C)=>W(C)?.[M],Y.length);Y.push({column:M,direction:j.direction,...j.nulls?{nulls:j.nulls}:{},expression:j.expression});continue}let D=$.fields[M];if(!D)throw new k(M,$.name,Object.keys($.fields));Y.push({column:D.column,...z9($,M,B,X)})}}return Y}function z9($,Z,X,z){if(typeof X==="string"){if(!_7.has(X))throw new I(`orderBy.${Z}: ${JSON.stringify(X)}`,$.name,z,'Expected "asc" or "desc".');return{direction:X}}if(typeof X==="object"&&X!==null){let{sort:J,nulls:H}=X,Y=z9($,Z,J,z).direction;if(H===void 0)return{direction:Y};if(typeof H!=="string"||!C7.has(H))throw new K(`orderBy.${Z}.nulls: ${JSON.stringify(H)}`,$.name,z,'Expected "first" or "last".');return{direction:Y,nulls:H}}throw new K(`orderBy.${Z}`,$.name,z,'Expected "asc", "desc", or { sort, nulls }.')}function Z3($){return $.map((Z)=>({...Z,direction:Z.direction==="asc"?"desc":"asc",...Z.nulls?{nulls:Z.nulls==="first"?"last":"first"}:{}}))}function o($,Z,X){if($.length===0)return null;return w($.map((z)=>{let J=` ${z.direction}`+(z.nulls?` nulls ${z.nulls}`:"");if(z.expression)return w([z.expression,P(J)],"");return P(`${X??""}${Z.quoteIdent(z.column)}${J}`)}),", ")}function X3($,Z,X,z,J){if(typeof J!=="number"||!Number.isInteger(J))throw new I(X,$,Z,`Expected an integer, got ${JSON.stringify(J)}.`);if(z==="skip"&&J<0)throw new I(X,$,Z,"A 'skip' counts rows to pass over, so it cannot be negative. Prisma rejects one too.")}function j0($,Z,X,z,J,H=!1){if(X?.take!==void 0)X3($.name,Z,"take","take",X.take);if(X?.skip!==void 0)X3($.name,Z,"skip","skip",X.skip);let Y=H?1:X?.take,G=X?.skip,V=J;if((Y!==void 0||G!==void 0)&&V.length===0&&!H)V=$.primaryKey.map((j)=>({column:$.fields[j]?.column??j,direction:"asc"}));let M=typeof Y==="number"&&Y<0;if(M)V=Z3(V);let B=Y===void 0?null:H?()=>1:(j)=>Math.abs(Number(j?.take)),D=G===void 0?null:(j)=>Number(j?.skip);return{clause:z.paginate(B,D),terms:V,reversed:M}}function Z0($,Z,X){let z=Z?.select,J=Z?.omit;if(z!==void 0&&Z?.include!==void 0)throw new K("select + include",$.name,X,"Prisma allows only one of them on the same query.");if(z!==void 0&&J!==void 0)throw new K("select + omit",$.name,X,"'select' names what to keep and 'omit' what to drop, so the two describe different column lists. Prisma allows only one of them on "+"the same query. Drop the 'omit' \u2014 a 'select' already excludes "+"everything it does not name.");if(z===void 0||z===null)return L7($,J,X);if(typeof z!=="object"||Array.isArray(z))throw new I("select",$.name,X,"Expected an object.");let H=[];for(let[G,V]of Object.entries($.fields))if(z[G]===!0)H.push(V);let Y=0;for(let G of Object.keys(z)){let V=z[G];if(V===void 0)continue;if(G in $.relations){if(V!==!1)Y++;continue}if(G===i){if(V!==!1)Y++;continue}if(!(G in $.fields))throw new k(G,$.name,Object.keys($.fields));if(typeof V!=="boolean")throw new I(`select.${G}`,$.name,X,"Expected true or false.")}if(H.length===0&&Y===0)throw new K("select",$.name,X,"At least one field must be selected.");return H}function L7($,Z,X){if(Z===void 0||Z===null)return Object.values($.fields);if(typeof Z!=="object"||Array.isArray(Z))throw new I("omit",$.name,X,"Expected an object of fields.");let z=new Set;for(let H of Object.keys(Z)){let Y=Z[H];if(Y===void 0)continue;if(H in $.relations)throw new K(`omit.${H}`,$.name,X,`'${H}' is a relation, not a column. A relation is already absent unless an 'include' asks for it.`);if(!(H in $.fields))throw new k(H,$.name,Object.keys($.fields));if(typeof Y!=="boolean")throw new I(`omit.${H}`,$.name,X,"Expected true or false.");if(Y)z.add(H)}let J=Object.values($.fields).filter((H)=>!z.has(H.name));if(J.length===0)throw new K("omit",$.name,X,`It omits every field on ${$.name}, which leaves no column to select. Prisma rejects that too.`);return J}function z3($,Z,X){if(X.length===0)return{fields:Z};let z=new Set(Z.map((Y)=>Y.name)),J=X.filter((Y)=>!z.has(Y));if(J.length===0)return{fields:Z};let H=new Set([...z,...J]);return{fields:Object.values($.fields).filter((Y)=>H.has(Y.name)),hidden:J}}var J9=new Set(["where","orderBy","select","omit","include","take","skip"]),Y9=new Set(["where","select","omit","include"]),H3=10;function k0($){return[...new Set($.map((Z)=>Z.strategy))].sort()}function O0($,Z,X,z,J=W0){let H=f0($,Z,z);if(H.length===0)return{plans:[],keyFields:[]};let Y=[],G=new Set;for(let V of H){B9($,V,z);let W=P9($,V);D9(W,V.node,z,2);let M=J.plan({parent:$,child:W,relation:V.relation,as:V.as,node:V.node,locate:V.locate,dialect:X,operation:z});Y.push(M);for(let B of M.parentFields)G.add(B)}return{plans:Y,keyFields:[...G]}}async function V3($,Z,X,z,J){let H=Array.isArray(X)?X:X===null||X===void 0?[]:[X];if(H.length===0)return;for(let Y of $){if(Y.root)continue;await Y.load(H,z,J)}if(Z&&Z.length>0)for(let Y of H)for(let G of Z)delete Y[G]}function f0($,Z,X){if(Z===void 0||Z===null)return[];let{include:z,select:J}=Z;M9($,z,J,X);let H=[];if(z!==void 0&&z!==null){if(typeof z!=="object"||Array.isArray(z))throw new I("include",$.name,X,"Expected an object.");for(let Y of Object.keys(z).sort()){let G=z[Y];if(G===void 0||G===!1)continue;if(Y===i)continue;let V=$.relations[Y];if(!V)throw new x0(Y,$.name,Object.keys($.relations));H.push({as:Y,relation:V,node:G,locate:(W)=>W?.include?.[Y]})}return H}if(J!==void 0&&J!==null&&typeof J==="object")for(let Y of Object.keys(J).sort()){let G=J[Y];if(G===void 0||G===!1)continue;let V=$.relations[Y];if(!V)continue;H.push({as:Y,relation:V,node:G,locate:(W)=>W?.select?.[Y]})}return H}function M9($,Z,X,z,J){if(Z===void 0||X===void 0)return;throw new K(J?`${J}: select + include`:"select + include",$.name,z,"Prisma allows only one of them on the same query, at any level.")}function B9($,Z,X){let z=Z.node;if(z===!0)return;if(typeof z!=="object"||z===null||Array.isArray(z))throw new I(Z.as,$.name,X,"Expected true or an object of relation arguments.");let J=z;M9($,J.include,J.select,X,Z.as);let H=Z.relation.kind==="many";for(let Y of Object.keys(J).sort()){if(J[Y]===void 0)continue;if(H&&(Y==="take"||Y==="skip")){T7($,Z,X,Y,J[Y]);continue}if(H?J9.has(Y):Y9.has(Y))continue;if(Y==="lock")throw new w0(`${Z.as}.lock`,$.name,X,"'lock' locks the rows of the model being queried, not an included relation's. Lock the related rows with their own locking read in the same transaction.");if(Y==="orderBy"&&!H)throw new K(`${Z.as}.orderBy`,$.name,X,"Prisma does not accept 'orderBy' on a to-one relation \u2014 there is at "+"most one row to order.");if(Y==="take"||Y==="skip")throw new K(`${Z.as}.${Y}`,$.name,X,`Prisma does not accept '${Y}' on a to-one relation.`);throw new K(`${Z.as}.${Y}`,$.name,X,`A relation node takes ${[...H?J9:Y9].sort().join(", ")}.`)}}function T7($,Z,X,z,J){X3($.name,X,`${Z.as}.${z}`,z,J)}function u3($,Z){let X=$.node;if(typeof X!=="object"||X===null||Array.isArray(X))return;for(let z of["take","skip"]){if(X[z]===void 0)continue;throw new K(`${$.as}.${z}`,$.parent.name,$.operation,`A '${z}' inside a to-many relation is per parent, and the batched `+"relation planner serves every parent from one query \u2014 so the only "+`limit it could emit would page every parent's children as one set. Only the lateral join strategy can express it, by paginating inside a subquery that already runs once per parent row, and it needs Postgres: ${Z}. Load '${$.as}' as its own query, or narrow it with 'where'.`)}}function D9($,Z,X,z){if(typeof Z!=="object"||Z===null||Array.isArray(Z))return;if(Z.select!==void 0)Z0($,Z,X);let J=f0($,Z,X);if(J.length===0)return;if(z>H3)throw new g3($.name,H3);for(let H of J)B9($,H,X),D9(P9($,H),H.node,X,z+1)}function j9($,Z,X,z){if($.parentFields.length!==1)throw new K(X.name,Z.name,z,`${X.name} joins on ${$.parentFields.length} fields (${$.parentFields.join(", ")}), and it is planned through a join table, which links two models by a single primary key each side. Prisma does not build an implicit many-to-many over a composite key.`);return{parentField:$.parentFields[0],childField:$.childFields[0],join:$.join}}function H0($,Z,X,z){if(X.joinTable)return I7($,Z,X);if(X.from.length>0)return H9($,X,X.from,X.to,z);let J=R7($,Z,X);if(J.from.length===0)throw new d($.name,X.name,`neither ${$.name}.${X.name} nor ${Z.name}.${J.name} holds the foreign key.`);return H9($,X,J.to,J.from,z)}function H9($,Z,X,z,J){if(X.length===0)throw new K(Z.name,$.name,J,`${Z.name} names no join fields.`);if(X.length!==z.length)throw new d($.name,Z.name,`it joins ${X.length} field(s) to ${z.length}: ${X.join(", ")} against ${z.join(", ")}.`);return{parentFields:X,childFields:z}}function R7($,Z,X){let z=Object.values(Z.relations).filter((J)=>J.relationName===X.relationName&&!(Z.name===$.name&&J.name===X.name));if(z.length!==1)throw new d($.name,X.name,z.length===0?`${Z.name} declares no relation named '${X.relationName}'.`:`${Z.name} declares ${z.length} relations named '${X.relationName}'.`);return z[0]}function I7($,Z,X){let{table:z,a:J,b:H}=X.joinTable;if(J===H){let G=X.joinTable.ownerColumn;if(!G)throw new K(X.name,$.name,"include",`${X.name} is a self-referential implicit many-to-many, and the generated artifact predates support for one. Re-run \`prisma generate\`.`);return{parentFields:[J3($,X)],childFields:[J3(Z,X)],join:{table:z,parentColumn:G,childColumn:G==="A"?"B":"A"}}}if($.name!==J&&$.name!==H)throw new d($.name,X.name,`the join table '${z}' connects ${J} and ${H}, neither of which is ${$.name}.`);let Y=$.name===J?"A":"B";return{parentFields:[J3($,X)],childFields:[J3(Z,X)],join:{table:z,parentColumn:Y,childColumn:Y==="A"?"B":"A"}}}function J3($,Z){if($.primaryKey.length!==1)throw new d($.name,Z.name,`an implicit many-to-many joins on ${$.name}'s primary key, which has ${$.primaryKey.length} fields.`);return $.primaryKey[0]}function Y3($,Z,X){let z=$.fields[X];if(!z)throw new d($.name,Z.name,`it joins on '${X}', which is not a field on ${$.name}.`);return z}function P9($,Z){return e($,Z.relation,Z.as)}function e($,Z,X=Z.name){let z=Z.model;if(!P0(z))throw new y3($.name,X,z,W9());let J=G0(z)?.$schema;if(!J)throw new v0(z);return J}var V9="batched",W0={name:V9,plan($){u3($,"this query planned with the batched strategy");let Z=H0($.parent,$.child,$.relation,$.operation);for(let H of Z.parentFields)G9($.parent,$.relation,Y3($.parent,$.relation,H));for(let H of Z.childFields)G9($.child,$.relation,Y3($.child,$.relation,H));let X=Y3($.parent,$.relation,Z.parentFields[0]),z=Y3($.child,$.relation,Z.childFields[0]),J=$.relation.kind==="many";return{as:$.as,model:$.relation.model,kind:$.relation.kind,parentFields:Z.parentFields,strategy:V9,load(H,Y,G){let V={parentKeyField:X,childKeyField:z,many:J,parents:H,args:Y,executor:G};return Z.join?N7($,Z,V):U7($,Z,V)}}}};async function U7($,Z,X){let{keys:z,byKey:J}=_9(X.parents,Z.parentFields);if(z.length===0)return;let H=$.locate(X.args),Y=K9(H,Z.childFields,z,$.child,$.dialect),G=await X.executor.exec($.relation.model,"findMany",Y.args,!0);for(let V of G){let W=J.get(E0(Z.childFields.map((M)=>V[M])));if(!W)continue;for(let M of W)Q9(M,$.as,V,X.many)}if(Y.hidden)for(let V of G)for(let W of Z.childFields)delete V[W]}async function N7($,Z,X){let{keys:z,byKey:J}=_9(X.parents,Z.parentFields);if(z.length===0)return;let{dialect:H}=$,Y=Z.join,G=await O7(H,Y,z.map((j)=>H.encode(j[0],X.parentKeyField)),X.executor),V=new Map,W=[];for(let j of G){let C=E0([H.decode(j[Y.parentColumn],X.parentKeyField)]),_=J.get(C);if(!_)continue;let F=H.decode(j[Y.childColumn],X.childKeyField),T=E0([F]),Q=V.get(T);if(Q===void 0)Q=[],V.set(T,Q),W.push([F]);for(let L of _)Q.push(L)}if(W.length===0)return;let M=$.locate(X.args),B=K9(M,Z.childFields,W,$.child,$.dialect),D=await X.executor.exec($.relation.model,"findMany",B.args,!0);for(let j of D){let C=V.get(E0([j[Z.childFields[0]]]));if(!C)continue;for(let _ of C)Q9(_,$.as,j,X.many)}if(B.hidden)for(let j of D)delete j[Z.childFields[0]]}async function O7($,Z,X,z){let J=R(P(`select ${$.quoteIdent(Z.parentColumn)}, ${$.quoteIdent(Z.childColumn)} from ${$.quoteIdent(Z.table)} where `),$.inList($.quoteIdent(Z.parentColumn),!1,X.length,()=>X)),{text:H,binders:Y}=p(J,$,{model:Z.table,operation:"include"}),G=N0();return z.query(H,Y.map((V)=>V(void 0,G)))}function K9($,Z,X,z,J){let H=$===!0||$===null||typeof $!=="object"?{}:$,Y=Z.length===1?{[Z[0]]:{in:X.map((B)=>B[0])}}:F7(z,Z,X,J),G={where:H.where===void 0?Y:{AND:[H.where,Y]}};if(H.orderBy!==void 0)G.orderBy=H.orderBy;if(H.include!==void 0)G.include=H.include;let V=H.omit;if(V!==void 0){let B=Z.filter((D)=>V[D]===!0);if(B.length===0)G.omit=V;else{let D={...V};for(let j of B)delete D[j];return G.omit=D,{args:G,hidden:!0}}}let W=H.select;if(W===void 0)return{args:G,hidden:!1};let M=Z.filter((B)=>W[B]!==!0);if(M.length===0)return G.select=W,{args:G,hidden:!1};G.select={...W};for(let B of M)G.select[B]=!0;return{args:G,hidden:!0}}function F7($,Z,X,z){let J=Z.map((H)=>$.fields[H]?.type);if(J.every((H)=>H!==void 0)&&z.canBindCompositeIn(J))return{[$0]:e5(Z,X)};return{OR:X.map((H)=>Object.fromEntries(Z.map((Y,G)=>[Y,H[G]])))}}function E0($){return JSON.stringify($.map(S7))}function Q9($,Z,X,z){if(z){$[Z].push(X);return}if($[Z]===null)$[Z]=X}function _9($,Z){let X=new Map,z=[];for(let J of $){let H=Z.map((V)=>J[V]);if(H.some((V)=>V===null||V===void 0))continue;let Y=E0(H),G=X.get(Y);if(G===void 0)G=[],X.set(Y,G),z.push(H);G.push(J)}return{keys:z,byKey:X}}function S7($){if(typeof $!=="object"||$===null)return $;if($ instanceof Date)return $.getTime();if(ArrayBuffer.isView($)){let Z=new Uint8Array($.buffer,$.byteOffset,$.byteLength),X="";for(let z of Z)X+=z.toString(16).padStart(2,"0");return`bytes:${X}`}throw Error(`Cannot key a relation stitch on ${Object.prototype.toString.call($)}.`)}function G9($,Z,X){if(X.isList)throw new d($.name,Z.name,`it joins on '${X.name}', a ${X.type} list \u2014 which decodes to a new `+"array per row and so cannot be compared between the two sides.");if(X.type!=="Json")return;throw new d($.name,Z.name,`it joins on '${X.name}', a ${X.type} \u2014 which decodes to a new object `+"per row and so cannot be compared between the two sides.")}var C9=(()=>{try{return Function("return 1")()===1}catch{return!1}})(),L9=!0;function A7($){L9=$}function b7(){return C9}function g0($,Z,X=[]){if(C9&&L9)return q7($,Z,X);return m3($,Z,X)}function m3($,Z,X=[]){let z=$.map((G)=>({key:G.name,column:G.column,field:G,decode:Z.needsDecode(G)})),J=z.length,H=X.map((G)=>({key:G.key,many:G.kind==="many"})),Y=H.length;return(G)=>{let V=[];for(let W=0;W<G.length;W++){let M=G[W],B={};for(let D=0;D<J;D++){let j=z[D],C=M[j.column];B[j.key]=j.decode?Z.decode(C,j.field):C??null}for(let D=0;D<Y;D++)B[H[D].key]=H[D].many?[]:null;V.push(B)}return V}}function q7($,Z,X){let z=[];for(let H=0;H<$.length;H++){let Y=$[H],G=JSON.stringify(Y.name),V=JSON.stringify(Y.column);z.push(Z.needsDecode(Y)?`${G}: d.decode(row[${V}], f[${H}])`:`${G}: row[${V}] ?? null`)}for(let H of X)z.push(`${JSON.stringify(H.key)}: ${H.kind==="many"?"[]":"null"}`);let J=`
|
|
2
|
+
import{ba as Y6}from"../chunk-3q7sc68p.js";import{$a as J6,Fa as l5,Ga as o5,Ha as i,Ia as T9,Ja as U3,Ka as e8,La as $6,Ma as S0,Na as p5,Oa as N3,Pa as Z6,Qa as t0,Ra as L0,Sa as k4,Ta as f4,Ua as g4,Va as w5,Wa as y4,Xa as h4,Ya as u4,Za as X6,_a as z6}from"../chunk-en33hg1c.js";import{$g as o8,_g as l8,ah as t8,bh as r8,ch as a8}from"../chunk-ej4kf7m5.js";import{dh as N0,eh as n,fh as P,gh as s,jh as R,kh as w,lh as p,mh as m8,nh as p8,oh as a3,ph as d8,qh as v3,rh as f,sh as c8,th as s8,uh as i8,vh as n8,wh as m5}from"../chunk-5qfzvnyp.js";import"../chunk-fg2k18d2.js";import{$i as P0,_i as E8,aj as G0,bj as W9,cj as h3,ej as h8,fj as u8,kj as q4,lj as E4,mj as w4,nj as x4,oj as v4}from"../chunk-9xzg05xg.js";import{Bj as S8,Cj as v5,Dj as A8,Ej as b8,Fj as k5,Gj as P3,Hj as x0,Ij as g3,Jj as y3,Kj as d,Lj as q8,Mj as v0,Nj as f5,pj as K,qj as I,rj as w0,sj as k,tj as U8,uj as r,vj as N8,wj as x5,xj as O8,yj as j5,zj as F8}from"../chunk-a37shxb1.js";import{Uj as v8,Vj as o0,Wj as _0,Xj as T3,_j as k8,ak as f8,bk as g8,ck as g5,dk as y5,ek as q5,fk as R3,gk as y8,hk as h5,ik as u5}from"../chunk-p81qeav5.js";import{tk as w8,vk as x8,xk as E5}from"../chunk-t03nda3s.js";import{Xk as b5}from"../chunk-1ed75a7b.js";import"../chunk-0839f72f.js";import"../chunk-t2nsn0r2.js";function R0($,Z,X,z,J,H){let Y=e($,Z),G=H0($,Y,Z,H),V=X.quoteIdent(z),W=`${V}.`,M=G.parentFields.map((C,_)=>{let F=`${W}${X.quoteIdent(r0(Y,Z,G.childFields[_]))}`,T=`${J}${X.quoteIdent(r0($,Z,C))}`;return`${F} = ${T}`}).join(" and ");if(!G.join)return{child:Y,source:`${X.quoteIdent(Y.table)} as ${V}`,correlation:M,qualifier:W};let B=`${W}${X.quoteIdent(r0(Y,Z,G.childFields[0]))}`,D=`${J}${X.quoteIdent(r0($,Z,G.parentFields[0]))}`,j=X.quoteIdent(`${z}j`);return{child:Y,source:`${X.quoteIdent(Y.table)} as ${V} join ${X.quoteIdent(G.join.table)} as ${j} on ${j}.${X.quoteIdent(G.join.childColumn)} = ${B}`,correlation:`${j}.${X.quoteIdent(G.join.parentColumn)} = ${D}`,qualifier:W}}function r0($,Z,X){let z=$.fields[X];if(!z)throw new d($.name,Z.name,`it joins on '${X}', which is not a field on ${$.name}.`);return z.column}function h($,Z,X){let z=a0($);if(typeof Z!=="object"||Z===null||Array.isArray(Z))throw i5($,X,z);let J=Object.keys(Z).filter((Y)=>Z[Y]!==void 0),H=Z;for(let Y of z){if(Y.length===1&&J.includes(Y[0]))return s5($,X,Y[0],H[Y[0]]),Y;let G=Y.join("_");if(Y.length>1&&J.includes(G)){let V=H[G];if(V&&typeof V==="object"&&!Array.isArray(V))for(let W of Y)s5($,X,`${G}.${W}`,V[W]);return Y}}throw i5($,X,z)}function A3($){if($===null||$===void 0)return!1;let Z=typeof $;if(Z!=="object")return Z!=="function"&&Z!=="symbol";if(Array.isArray($))return!1;if($ instanceof Date||ArrayBuffer.isView($))return!0;let X=Object.getPrototypeOf($);return X!==Object.prototype&&X!==null}function s5($,Z,X,z){if(z===void 0||A3(z))return;throw new I(`${Z.argument}.${X}`,Z.model,Z.operation,`A unique key takes a plain value to match, not ${z===null?"null":Array.isArray(z)?"an array":"a filter object"}. Use findFirst/findMany (or updateMany/deleteMany) to filter on ${$.name}.${X.split(".").pop()}.`)}function b3($,Z,X){h($,Z,{model:$.name,operation:X,argument:"where"})}function a0($){let Z=[];if($.primaryKey.length>0)Z.push($.primaryKey);for(let X of $.uniques)Z.push(X);return Z}function i5($,Z,X){let z=X.map((Y)=>Y.length===1?Y[0]:Y.join("_")).join(", "),H=Z.argument.startsWith("data.")?`Name it by one of those, or reach it through the ${$.name} model directly.`:`Use ${Z.operation==="delete"||Z.operation==="update"?`${Z.operation}Many`:"findFirst"} to query on anything else.`;return new K(Z.argument,Z.model,Z.operation,`${$.name} needs a unique field here. It declares: ${z}. ${H}`)}function g($,Z,X){let z=Z.castParameter($);if(!z)return s(X);return s((J,H)=>{let Y=X(J,H);if(Y===null||Y===void 0)return null;let G=f(Y);if(G==="db")return null;if(G==="json")return"null";if(G==="any")throw Error("gemi ORM bug: Prisma.AnyNull reached the parameter binder. It is a filter operand only, and both the filter and write paths are supposed to have handled it before this point.");return JSON.stringify(Y)},z)}function v($,Z,X,z){if(Z===void 0||Z===null)return null;if(typeof Z!=="object"||Array.isArray(Z))throw new I("where",$.name,X.operation,"Expected an object.");let J=[];for(let H of Object.keys(Z).sort()){let Y=Z[H];if(Y===void 0)continue;let G=(W)=>z(W)?.[H];if(H==="AND"||H==="OR"){let W=n5($,Y,X,G,H);if(W)J.push(W);continue}if(H===$0){J.push(r4($,Y,X,G));continue}if(H==="NOT"){let W=n5($,Y,X,G,"AND");if(W)J.push(R(P("not "),b0(W)));continue}if(H in $.relations){let W=l4($,$.relations[H],Y,X,G);if(W)J.push(W);continue}let V=$.fields[H];if(!V){let W=t4($,H,Y,X,G);if(W){J.push(W);continue}throw new k(H,$.name,Object.keys($.fields))}J.push(k3($,V,Y,X,G))}if(J.length===0)return null;if(J.length===1)return J[0];return l(J," and ")}function l4($,Z,X,z,J){let H=l5(Z.kind),Y=o4($,Z,X,H,z),G=z.relationDepth??0,V=z.dialect,W=z.qualifier??`${V.quoteIdent($.table)}.`,M=R0($,Z,V,`_r${G}`,W,z.operation),B=M.child,D=P(M.correlation),j={...z,qualifier:M.qualifier,relationDepth:G+1},C=[];for(let _ of H){if(!(_ in Y))continue;let F=Y[_],T=(U)=>Y.direct?J(U):J(U)?.[_];if(F===null){C.push(q3(M,D,null,_==="is"));continue}let Q=v(B,F,j,T);if(_==="every"){if(!Q)continue;C.push(q3(M,D,R(P("not "),b0(Q)),!0));continue}let L=_==="none"||_==="isNot";C.push(q3(M,D,Q,L))}if(C.length===0)return null;if(C.length===1)return C[0];return l(C," and ")}function q3($,Z,X,z){let J=[P(`${z?"not ":""}exists (select 1 from ${$.source} where `),Z];if(X)J.push(P(" and "),X);return J.push(P(")")),R(...J)}function o4($,Z,X,z,J){let H=`where.${Z.name}`,Y=Z.kind==="many";if(X===null){if(Y)throw new K(H,$.name,J.operation,`${Z.name} is a to-many relation, so null is not a filter for it. Use { none: {} } for "has no related rows".`);return{is:null,direct:!0}}if(typeof X!=="object"||Array.isArray(X))throw new I(H,$.name,J.operation,Y?`Expected an object holding ${z.join(", ")}.`:"Expected an object, or null.");if(o5(X,z))return X;if(Y)throw new K(H,$.name,J.operation,`Expected one of ${z.join(", ")}. A to-many relation has no `+"single reading of a bare filter \u2014 { some: \u2026 } and { every: \u2026 } mean "+"different things.");return{is:X,direct:!0}}function t4($,Z,X,z,J){let H=a0($).find((V)=>V.length>1&&V.join("_")===Z);if(!H)return null;if(typeof X!=="object"||X===null||Array.isArray(X))throw new I(`where.${Z}`,$.name,z.operation,`Expected an object holding ${H.join(" and ")}.`);let Y=X,G=[];for(let V of H){if(Y[V]===void 0)throw new K(`where.${Z}`,$.name,z.operation,`Missing '${V}'. A composite key needs all of ${H.join(", ")}.`);if(!A3(Y[V]))throw new I(`where.${Z}.${V}`,$.name,z.operation,`A composite key takes a plain value for each of ${H.join(", ")}, not a filter, an array or null.`);G.push(k3($,$.fields[V],Y[V],z,(W)=>J(W)?.[V]))}return G.length===1?G[0]:l(G," and ")}function n5($,Z,X,z,J){let H=[];if(Array.isArray(Z))for(let Y=0;Y<Z.length;Y++){let G=v($,Z[Y],X,(V)=>z(V)?.[Y]);if(G)H.push(G)}else{let Y=v($,Z,X,z);if(Y)H.push(Y)}if(H.length===0)return J==="AND"?null:t5;if(H.length===1)return H[0];return l(H,J==="AND"?" and ":" or ")}var t5=P("false");function l($,Z){return R(P("("),w($,Z),P(")"))}function b0($){return $.text.startsWith("(")?$:l([$],"")}var x3=new Set(["equals","not","in","notIn","lt","lte","gt","gte","contains","startsWith","endsWith","mode"]),r5={lt:"<",lte:"<=",gt:">",gte:">="},$0="$compositeIn",a5=Symbol("gemi.orm.compositeInFromPlanner");function e5($,Z){return{[a5]:!0,fields:$,values:Z}}function r4($,Z,X,z){let{dialect:J}=X,Y=a4($,Z,X).map((V)=>{let W=$.fields[V];if(!W)throw new k(V,$.name,Object.keys($.fields));return W}),G=Y.map((V)=>`${X.qualifier??""}${J.quoteIdent(V.column)}`);return J.compositeIn(G,Y.map((V)=>V.type),(V)=>z(V).values)}function a4($,Z,X){let z=()=>{throw new k($0,$.name,Object.keys($.fields))};if(typeof Z!=="object"||Z===null||Array.isArray(Z))return z();if(Z[a5]!==!0)return z();let J=(G)=>{throw new K($0,$.name,X.operation,G)},{fields:H,values:Y}=Z;if(!Array.isArray(H)||H.length===0)return J(`the planner built a '${$0}' with no fields.`);if(!H.every((G)=>typeof G==="string"))return J(`the planner built a '${$0}' with a non-string field.`);if(!Array.isArray(Y))return J(`the planner built a '${$0}' with no values.`);if(!Y.every((G)=>Array.isArray(G)&&G.length===H.length))return J(`the planner built a '${$0}' whose tuples do not all have ${H.length} value(s).`);return H}var e4=["equals","has","hasEvery","hasSome","isEmpty"],E3=new Set(e4);function $7($,Z,X,z,J,H){let{dialect:Y}=J;if(U0($,Z,`where.${Z.name}`,J.operation,Y),Array.isArray(z))throw new I(`where.${Z.name}`,$.name,J.operation,`'${Z.name}' is a scalar list, and a bare array is not a filter on `+"one \u2014 Prisma rejects it here too. Say which comparison you mean: "+`{ ${Z.name}: { equals: [...] } } for the whole list, or { ${Z.name}: { hasEvery: [...] } } for "contains all of these". A bare array *is* accepted as a value in \`data\`.`);if(!f3(z))throw new I(`where.${Z.name}`,$.name,J.operation,`'${Z.name}' is a scalar list. Expected an object holding ${[...E3].sort().join(", ")}; received ${z===null?"null":typeof z}.`);let G=z,V=[];for(let W of Object.keys(G).sort()){let M=G[W];if(M===void 0)continue;if(!E3.has(W))throw new I(`where.${Z.name}.${W}`,$.name,J.operation,`'${Z.name}' is a scalar list, and a list filter takes ${[...E3].sort().join(", ")}. The scalar operators \u2014 `+`${[...x3].sort().join(", ")} \u2014 apply to a single value and `+"Prisma does not offer them here.");let B=(D)=>H(D)?.[W];V.push(Z7($,Z,X,W,M,J,B))}if(V.length===0)return P("true");if(V.length===1)return V[0];return l(V," and ")}function Z7($,Z,X,z,J,H,Y){let{dialect:G}=H;if(z==="equals")return X7($,Z,X,J,H,Y);if(z==="isEmpty"){if(typeof J!=="boolean")throw new I(`where.${Z.name}.isEmpty`,$.name,H.operation,`Expected true or false, received ${J===null?"null":typeof J}.`);return G.listIsEmpty(X,J)}if(z==="has"){let W=z7(Z);return G.listHas(X,g(W,G,I0(W,G,Y)))}if(!Array.isArray(J))throw new I(`where.${Z.name}.${z}`,$.name,H.operation,`Expected an array, received ${J===null?"null":typeof J}.`);let V=g(Z,G,I0(Z,G,Y));return z==="hasEvery"?G.listHasEvery(X,V):G.listHasSome(X,V)}function X7($,Z,X,z,J,H){let{dialect:Y}=J;if(z===null)return P(`${X} is null`);if(!Array.isArray(z))throw new I(`where.${Z.name}.equals`,$.name,J.operation,`'${Z.name}' is a scalar list, so it compares against an array. Received ${typeof z}. For "is this element present", use { ${Z.name}: { has: \u2026 } }.`);return R(P(`${X} = `),g(Z,Y,I0(Z,Y,H)))}function z7($){return{...$,isList:!1}}function U0($,Z,X,z,J){if(J.listFilters.size>0)return;throw new K(X,$.name,z,`'${Z.name}' is a scalar list, and ${J.name} has no array type to hold one. Prisma refuses the column itself on ${J.name} \u2014 `+'"the current connector does not support lists of primitive types" \u2014 so '+`this is a difference between the databases rather than a gap in the ORM. The generated artifact is dialect-agnostic, which is why this surfaces here rather than at \`prisma generate\`: the schema was generated against Postgres and DATABASE_URL names a ${J.name} database, which has no '${Z.column}' column either. It works on postgres.`)}var J7=["equals","not","string_contains","string_starts_with","string_ends_with","array_contains","lt","lte","gt","gte"],w3=new Set(J7),Y7=["has_key","has_some_keys","has_every_key"],e0=new Set(Y7);function $9($,Z,X,z,J,H,Y,G){let V=z!=="has_key",W=`where.${Z.name}.${z}`,M=(D)=>{if(!(V?Array.isArray(D)&&D.every((C)=>typeof C==="string"):typeof D==="string"))throw new I(W,$.name,H.operation,V?"Expected an array of key names, like ['a', 'b'].":"Expected a key name, like 'a'.");return D};M(J);let B=(D,j)=>M(G(D,j));return H.dialect.jsonHasKeys(X,Y,B,z==="has_key"?"one":z==="has_some_keys"?"some":"every",Array.isArray(J)?J.length:0)}function H7($,Z,X,z,J,H){let{dialect:Y}=J;if(Z.type!=="Json")throw new K(`${Z.name}.path`,$.name,J.operation,`A 'path' filter reads inside a JSON document, and '${Z.name}' is a ${Z.type} column.`);M7($,Z,z.path,J);let G=(M)=>H(M)?.path,V=Object.keys(z).filter((M)=>M!=="path"&&z[M]!==void 0).sort();if(V.length===0)throw new K(`${Z.name}.path`,$.name,J.operation,`A 'path' needs a filter beside it \u2014 ${[...w3,...e0].sort().join(", ")}. Prisma refuses a bare path too.`);let W=[];for(let M of V){if(e0.has(M)){W.push($9($,Z,X,M,z[M],J,G,(j)=>H(j)?.[M]));continue}if(!w3.has(M))throw new K(`${Z.name}.${M}`,$.name,J.operation,`A JSON path filter takes ${[...w3,...e0].sort().join(", ")}.`);if(!Y.jsonFilters.has(M))throw new K(`${Z.name}.${M}`,$.name,J.operation,`'${M}' on a JSON path is not available on ${Y.name}. Prisma refuses it here too, so this is a difference between the databases rather than a gap in the ORM. It works on postgres.`);let B=z[M],D=B===null?"json":f(B);if(D&&(M==="equals"||M==="not")){W.push(V7(D,X,G,Z,Y,M==="not"));continue}if(D&&B!==null){let j=M==="array_contains"?"'array_contains' tests containment against a document, and a sentinel is not one":`'${M}' compares an extracted value against a scalar, and a sentinel is not one`;throw new I(`where.${Z.name}.${M}`,$.name,J.operation,`${q0(D)} asks which kind of null a value is, which `+`only 'equals' and 'not' can express \u2014 ${j}. Prisma refuses it under this operator too. Write { ${Z.name}: { path: [\u2026], equals: ${q0(D)} } }, `+"or filter the column itself \u2014 "+`{ ${Z.name}: { equals: ${q0(D)} } }.`)}if(Z9(B))throw new I(`where.${Z.name}.${M}`,$.name,J.operation,"Prisma.AnyNull is a question rather than a value \u2014 'either kind of "+"null' \u2014 so it cannot appear inside a document. Ask it directly: "+`{ ${Z.name}: { path: [\u2026], equals: Prisma.AnyNull } }.`);G7(M,B,$,Z,J),W.push(W7(M,X,G,Z,Y,(j)=>H(j)?.[M]))}return W.length===1?W[0]:l(W," and ")}function V7($,Z,X,z,J,H){let Y=()=>R(J.jsonValueAt(Z,X),P(H?" is not null":" is null")),G=()=>R(J.jsonValueAt(Z,X),P(H?" <> ":" = "),g(z,J,()=>J.encode(v3,z)));if($==="db")return Y();if($==="json")return G();return l([G(),Y()],H?" and ":" or ")}function G7($,Z,X,z,J){let H=$==="string_contains"||$==="string_starts_with"||$==="string_ends_with";if(H&&typeof Z!=="string")throw new I(`where.${z.name}.${$}`,X.name,J.operation,`Expected a string, received ${Z===null?"null":typeof Z}. Prisma raises here too \u2014 without this the pattern becomes `+`'%${String(Z)}%', which runs and returns the wrong rows.`);if(Z===null)throw new I(`where.${z.name}.${$}`,X.name,J.operation,$==="array_contains"?"null cannot be tested for containment through a JSON path: the operand binds as SQL NULL rather than as the JSON value, and "+"'x @> NULL' is NULL rather than true \u2014 the query would run and "+`match nothing. A null *inside* the document is an ordinary value and still compiles: { ${z.name}: { path: [\u2026], array_contains: [null] } }.`:`null cannot be compared through a JSON path with '${$}', which `+"compares the extracted value as a number \u2014 the comparison against "+`NULL is NULL rather than true, so the query would run and match nothing. Prisma refuses it here too. For "the value at this path is a JSON null", use equals or not: { ${z.name}: { path: [\u2026], equals: null } }.`);if($==="array_contains"||H)return;if(typeof Z==="object")throw new K(`where.${z.name}.${$}`,X.name,J.operation,`'${$}' on a JSON path compares the extracted value as a scalar, so `+"an object or array operand cannot be expressed \u2014 it would bind as "+`'${String(Z)}' and match nothing. Prisma accepts one here; gemi does not yet. Use array_contains for containment, or narrow the path until it names a scalar.`)}function W7($,Z,X,z,J,H){if($==="array_contains")return J.jsonArrayContains(Z,X,H);let Y=$==="string_contains"||$==="string_starts_with"||$==="string_ends_with",G=J.jsonExtract(Z,X,!0);if(Y){let B=$==="string_contains"?(D)=>`%${D}%`:$==="string_starts_with"?(D)=>`${D}%`:(D)=>`%${D}`;return R(P("("),G,P(") like "),s((D,j)=>{let C=H(D,j);return C===null||C===void 0?null:B(String(C))}))}let V=$==="equals"?"=":$==="not"?"<>":r5[$],W=$!=="equals"&&$!=="not",M=W?R(P("cast(("),G,P(") as real)")):R(P("("),G,P(")"));return R(M,P(` ${V} `),s((B,D)=>{let j=H(B,D);if(j===null||j===void 0)return null;if(W)return Number(j);return J.jsonComparesAsText?String(j):j}))}function M7($,Z,X,z){let{dialect:J}=z,H=J.jsonPathSyntax==="array"?"array":"jsonpath",Y=Array.isArray(X)?"array":typeof X==="string"?"jsonpath":"other";if(Array.isArray(X)&&X.length===0||X==="")throw new K(`${Z.name}.path`,$.name,z.operation,`A JSON path cannot be empty. ${J.jsonPathSyntax==="array"?`On ${J.name} an empty array selects the whole document, `+"which is a filter on the column rather than on a path \u2014 write "+`{ ${Z.name}: { equals: \u2026 } } if that is what you meant.`:`On ${J.name} an empty string raises inside json_extract.`}`);if(Y===H){if(H!=="array")return;let V=X.findIndex((B)=>typeof B!=="string");if(V===-1)return;let W=X[V],M=W===null?"null":W===void 0?"undefined":Array.isArray(W)?"an array":typeof W==="object"?"an object":`a ${typeof W}`;throw new K(`${Z.name}.path`,$.name,z.operation,`A JSON path is an array of strings, and path[${V}] is ${M}. `+(typeof W==="number"?'An array index is a key too \u2014 write ["items", "0"] rather than '+`["items", 0]; it reaches the same element, because ${J.name} takes the path as text. Prisma's path is string[] and its client refuses a number here too.`:"Prisma's path is string[] too."))}throw new K(`${Z.name}.path`,$.name,z.operation,J.jsonPathSyntax==="array"?`On ${J.name} a JSON path is an array of keys \u2014 ["a", "b"] \u2014 `+"not a JSONPath string. Prisma splits them the same way, and refuses the other form on each database.":`On ${J.name} a JSON path is a JSONPath string \u2014 "$.a.b" \u2014 not `+"an array of keys. Prisma splits them the same way, and refuses the other form on each database.")}function k3($,Z,X,z,J){let{dialect:H}=z,Y=`${z.qualifier??""}${H.quoteIdent(Z.column)}`,G=f(X);if(G)throw new I(`where.${Z.name}`,$.name,z.operation,`${q0(G)} is not a filter on `+"its own \u2014 Prisma rejects it here too. Write it as an explicit "+`comparison: { ${Z.name}: { equals: ${q0(G)} } }.`);if(Z.isList)return $7($,Z,Y,X,z,J);if(!f3(X))return $3(Y,Z,X,H,J);let V=X,W=Object.keys(V).sort();if(V.path!==void 0)return H7($,Z,Y,V,z,J);let M=V.mode==="insensitive";if(V.mode!==void 0&&V.mode!=="default"){if(!M)throw new I(`mode: ${JSON.stringify(V.mode)}`,$.name,z.operation,"Prisma takes 'default' or 'insensitive'.");if(!H.supportsInsensitiveMode)throw new K('mode: "insensitive"',$.name,z.operation,`The ${H.name} dialect cannot express it \u2014 Prisma rejects it `+"here too. Note SQLite's LIKE is already case-insensitive for ASCII.")}let B=[];for(let D of W){let j=V[D];if(j===void 0||D==="mode")continue;if(Z.type==="Json"&&e0.has(D)){B.push($9($,Z,Y,D,j,z,void 0,(_)=>J(_)?.[D]));continue}if(!x3.has(D))throw new I(`where.${Z.name}.${D}`,$.name,z.operation,`A scalar filter takes ${[...x3].sort().join(", ")}.`);if(D!=="equals"&&D!=="not"&&Z9(j))throw new I(`where.${Z.name}.${D}`,$.name,z.operation,`Prisma.AnyNull means 'either kind of null', which only 'equals' and 'not' can express. Write { ${Z.name}: { equals: Prisma.AnyNull } }, or name the one you mean with Prisma.DbNull or Prisma.JsonNull.`);let C=(_)=>J(_)?.[D];switch(D){case"equals":B.push($3(Y,Z,j,H,C));break;case"not":B.push(B7($,Z,j,z,C,Y));break;case"in":case"notIn":B.push(j7($,Y,Z,j,z,C,D==="notIn"));break;case"lt":case"lte":case"gt":case"gte":B.push(R(P(`${Y} ${r5[D]} `),g(Z,H,I0(Z,H,C))));break;case"contains":case"startsWith":case"endsWith":if(typeof j!=="string")throw new I(`where.${Z.name}.${D}`,$.name,z.operation,`Expected a string, received ${j===null?"null":typeof j}.`);if(Z.type!=="String")throw new K(`where.${Z.name}.${D}`,$.name,z.operation,`'${Z.name}' is a ${Z.type}, and ${D} only applies to strings.`);B.push(H.like(Y,M,P7(D,C)));break}}if(B.length===0)return P("true");if(B.length===1)return B[0];return l(B," and ")}function q0($){return`Prisma.${$==="db"?"DbNull":$==="json"?"JsonNull":"AnyNull"}`}function Z9($){if(f($)==="any")return!0;return Array.isArray($)&&$.some((Z)=>f(Z)==="any")}function B7($,Z,X,z,J,H){if(X===null||f(X)==="db")return P(`${H} is not null`);if(f(X)==="json")return R(P("not "),b0($3(H,Z,X,z.dialect,J)));if(f(X)==="any")return R(P("not "),b0($3(H,Z,X,z.dialect,J)));if(!f3(X))return R(P(`${H} <> `),g(Z,z.dialect,I0(Z,z.dialect,J)));let Y=k3($,Z,X,z,J);return R(P("not "),b0(Y))}function $3($,Z,X,z,J){if(X===null||f(X)==="db")return P(`${$} is null`);if(f(X)==="any")return l([P(`${$} is null`),D7($,Z,z)]," or ");return R(P(`${$} = `),g(Z,z,I0(Z,z,J)))}function D7($,Z,X){return R(P(`${$} = `),g(Z,X,()=>X.encode(v3,Z)))}function j7($,Z,X,z,J,H,Y){let{dialect:G}=J;if(!Array.isArray(z))throw new I(`where.${X.name}.${Y?"notIn":"in"}`,$.name,J.operation,"Expected an array.");if(z.length===0)return Y?P("true"):t5;return G.inList(Z,Y,z.length,(V)=>{return H(V).map((M)=>G.encode(M,X))})}function P7($,Z){return(X)=>{let z=String(Z(X));if($==="contains")return`%${z}%`;if($==="startsWith")return`${z}%`;return`%${z}`}}function I0($,Z,X){return(z)=>Z.encode(X(z),$)}function f3($){return typeof $==="object"&&$!==null&&!Array.isArray($)&&!($ instanceof Date)&&!ArrayBuffer.isView($)}function X9($,Z,X,z,J,H,Y){let G=`orderBy.${Z.name}`;if(typeof X!=="object"||X===null||Array.isArray(X))throw new I(G,$.name,z,Z.kind==="many"?'Expected { _count: "asc" | "desc" }.':`Expected an object naming one field of ${Z.model}.`);let V=X,W=Object.keys(V).filter((_)=>_!=="where");if(W.length!==1)throw new K(G,$.name,z,W.length===0?"Name the field to order by.":`Name exactly one field to order by; got ${W.join(", ")}. `+"Order by several with an array: [{ a: \u2026 }, { b: \u2026 }].");let[M]=W,B=R0($,Z,J,`_o${Y}`,`${J.quoteIdent($.table)}.`,z),D=K7($,Z,B.child,M,V[M],z,B.qualifier,J),j=v(B.child,V.where,{dialect:J,operation:z,qualifier:B.qualifier},(_)=>H(_)?.where),C=[P(`(select ${D.expression} from ${B.source} where ${B.correlation}`)];if(j)C.push(P(" and "),j);return C.push(P(")")),{expression:R(...C),direction:D.direction,nulls:D.nulls}}function K7($,Z,X,z,J,H,Y,G){let V=`orderBy.${Z.name}.${z}`,{direction:W,nulls:M}=Q7($,V,J,H);if(z===i){if(Z.kind!=="many")throw new K(V,$.name,H,`${Z.name} is a to-one relation, so its count is 0 or 1. Order by one of ${X.name}'s fields instead.`);return{expression:"count(*)",direction:W,nulls:M}}if(Z.kind==="many")throw new K(V,$.name,H,`${Z.name} is a to-many relation, so ordering by '${z}' has no single answer for a parent with several children. Only `+"{ _count: \u2026 } is supported.");let B=X.fields[z];if(!B)throw new K(V,$.name,H,`'${z}' is not a field on ${X.name}. Known fields: ${Object.keys(X.fields).join(", ")}.`);return{expression:`${Y}${G.quoteIdent(B.column)}`,direction:W,nulls:M}}function Q7($,Z,X,z){if(X==="asc"||X==="desc")return{direction:X};if(typeof X==="object"&&X!==null){let{sort:J,nulls:H}=X;if(J!=="asc"&&J!=="desc")throw new I(Z,$.name,z,'Expected "asc" or "desc".');if(H===void 0)return{direction:J};if(H!=="first"&&H!=="last")throw new K(`${Z}.nulls`,$.name,z,'Expected "first" or "last".');return{direction:J,nulls:H}}throw new K(Z,$.name,z,'Expected "asc", "desc", or { sort, nulls }.')}var _7=new Set(["asc","desc"]),C7=new Set(["first","last"]);function V0($,Z,X,z){if(Z===void 0||Z===null)return[];let J=Array.isArray(Z),H=J?Z:[Z],Y=[];for(let G=0;G<H.length;G++){let V=H[G],W=(M)=>{let B=z?.locate(M);return J?B?.[G]:B};if(typeof V!=="object"||V===null)throw new I("orderBy",$.name,X,"Expected an object or an array of objects.");for(let[M,B]of Object.entries(V)){if(B===void 0)continue;if(M in $.relations){if(!z)throw new K(`orderBy.${M}`,$.name,X,"Ordering by a relation is not implemented here.");let j=X9($,$.relations[M],B,X,z.dialect,(C)=>W(C)?.[M],Y.length);Y.push({column:M,direction:j.direction,...j.nulls?{nulls:j.nulls}:{},expression:j.expression});continue}let D=$.fields[M];if(!D)throw new k(M,$.name,Object.keys($.fields));Y.push({column:D.column,...z9($,M,B,X)})}}return Y}function z9($,Z,X,z){if(typeof X==="string"){if(!_7.has(X))throw new I(`orderBy.${Z}: ${JSON.stringify(X)}`,$.name,z,'Expected "asc" or "desc".');return{direction:X}}if(typeof X==="object"&&X!==null){let{sort:J,nulls:H}=X,Y=z9($,Z,J,z).direction;if(H===void 0)return{direction:Y};if(typeof H!=="string"||!C7.has(H))throw new K(`orderBy.${Z}.nulls: ${JSON.stringify(H)}`,$.name,z,'Expected "first" or "last".');return{direction:Y,nulls:H}}throw new K(`orderBy.${Z}`,$.name,z,'Expected "asc", "desc", or { sort, nulls }.')}function Z3($){return $.map((Z)=>({...Z,direction:Z.direction==="asc"?"desc":"asc",...Z.nulls?{nulls:Z.nulls==="first"?"last":"first"}:{}}))}function o($,Z,X){if($.length===0)return null;return w($.map((z)=>{let J=` ${z.direction}`+(z.nulls?` nulls ${z.nulls}`:"");if(z.expression)return w([z.expression,P(J)],"");return P(`${X??""}${Z.quoteIdent(z.column)}${J}`)}),", ")}function X3($,Z,X,z,J){if(typeof J!=="number"||!Number.isInteger(J))throw new I(X,$,Z,`Expected an integer, got ${JSON.stringify(J)}.`);if(z==="skip"&&J<0)throw new I(X,$,Z,"A 'skip' counts rows to pass over, so it cannot be negative. Prisma rejects one too.")}function j0($,Z,X,z,J,H=!1){if(X?.take!==void 0)X3($.name,Z,"take","take",X.take);if(X?.skip!==void 0)X3($.name,Z,"skip","skip",X.skip);let Y=H?1:X?.take,G=X?.skip,V=J;if((Y!==void 0||G!==void 0)&&V.length===0&&!H)V=$.primaryKey.map((j)=>({column:$.fields[j]?.column??j,direction:"asc"}));let M=typeof Y==="number"&&Y<0;if(M)V=Z3(V);let B=Y===void 0?null:H?()=>1:(j)=>Math.abs(Number(j?.take)),D=G===void 0?null:(j)=>Number(j?.skip);return{clause:z.paginate(B,D),terms:V,reversed:M}}function Z0($,Z,X){let z=Z?.select,J=Z?.omit;if(z!==void 0&&Z?.include!==void 0)throw new K("select + include",$.name,X,"Prisma allows only one of them on the same query.");if(z!==void 0&&J!==void 0)throw new K("select + omit",$.name,X,"'select' names what to keep and 'omit' what to drop, so the two describe different column lists. Prisma allows only one of them on "+"the same query. Drop the 'omit' \u2014 a 'select' already excludes "+"everything it does not name.");if(z===void 0||z===null)return L7($,J,X);if(typeof z!=="object"||Array.isArray(z))throw new I("select",$.name,X,"Expected an object.");let H=[];for(let[G,V]of Object.entries($.fields))if(z[G]===!0)H.push(V);let Y=0;for(let G of Object.keys(z)){let V=z[G];if(V===void 0)continue;if(G in $.relations){if(V!==!1)Y++;continue}if(G===i){if(V!==!1)Y++;continue}if(!(G in $.fields))throw new k(G,$.name,Object.keys($.fields));if(typeof V!=="boolean")throw new I(`select.${G}`,$.name,X,"Expected true or false.")}if(H.length===0&&Y===0)throw new K("select",$.name,X,"At least one field must be selected.");return H}function L7($,Z,X){if(Z===void 0||Z===null)return Object.values($.fields);if(typeof Z!=="object"||Array.isArray(Z))throw new I("omit",$.name,X,"Expected an object of fields.");let z=new Set;for(let H of Object.keys(Z)){let Y=Z[H];if(Y===void 0)continue;if(H in $.relations)throw new K(`omit.${H}`,$.name,X,`'${H}' is a relation, not a column. A relation is already absent unless an 'include' asks for it.`);if(!(H in $.fields))throw new k(H,$.name,Object.keys($.fields));if(typeof Y!=="boolean")throw new I(`omit.${H}`,$.name,X,"Expected true or false.");if(Y)z.add(H)}let J=Object.values($.fields).filter((H)=>!z.has(H.name));if(J.length===0)throw new K("omit",$.name,X,`It omits every field on ${$.name}, which leaves no column to select. Prisma rejects that too.`);return J}function z3($,Z,X){if(X.length===0)return{fields:Z};let z=new Set(Z.map((Y)=>Y.name)),J=X.filter((Y)=>!z.has(Y));if(J.length===0)return{fields:Z};let H=new Set([...z,...J]);return{fields:Object.values($.fields).filter((Y)=>H.has(Y.name)),hidden:J}}var J9=new Set(["where","orderBy","select","omit","include","take","skip"]),Y9=new Set(["where","select","omit","include"]),H3=10;function k0($){return[...new Set($.map((Z)=>Z.strategy))].sort()}function O0($,Z,X,z,J=W0){let H=f0($,Z,z);if(H.length===0)return{plans:[],keyFields:[]};let Y=[],G=new Set;for(let V of H){B9($,V,z);let W=P9($,V);D9(W,V.node,z,2);let M=J.plan({parent:$,child:W,relation:V.relation,as:V.as,node:V.node,locate:V.locate,dialect:X,operation:z});Y.push(M);for(let B of M.parentFields)G.add(B)}return{plans:Y,keyFields:[...G]}}async function V3($,Z,X,z,J){let H=Array.isArray(X)?X:X===null||X===void 0?[]:[X];if(H.length===0)return;for(let Y of $){if(Y.root)continue;await Y.load(H,z,J)}if(Z&&Z.length>0)for(let Y of H)for(let G of Z)delete Y[G]}function f0($,Z,X){if(Z===void 0||Z===null)return[];let{include:z,select:J}=Z;M9($,z,J,X);let H=[];if(z!==void 0&&z!==null){if(typeof z!=="object"||Array.isArray(z))throw new I("include",$.name,X,"Expected an object.");for(let Y of Object.keys(z).sort()){let G=z[Y];if(G===void 0||G===!1)continue;if(Y===i)continue;let V=$.relations[Y];if(!V)throw new x0(Y,$.name,Object.keys($.relations));H.push({as:Y,relation:V,node:G,locate:(W)=>W?.include?.[Y]})}return H}if(J!==void 0&&J!==null&&typeof J==="object")for(let Y of Object.keys(J).sort()){let G=J[Y];if(G===void 0||G===!1)continue;let V=$.relations[Y];if(!V)continue;H.push({as:Y,relation:V,node:G,locate:(W)=>W?.select?.[Y]})}return H}function M9($,Z,X,z,J){if(Z===void 0||X===void 0)return;throw new K(J?`${J}: select + include`:"select + include",$.name,z,"Prisma allows only one of them on the same query, at any level.")}function B9($,Z,X){let z=Z.node;if(z===!0)return;if(typeof z!=="object"||z===null||Array.isArray(z))throw new I(Z.as,$.name,X,"Expected true or an object of relation arguments.");let J=z;M9($,J.include,J.select,X,Z.as);let H=Z.relation.kind==="many";for(let Y of Object.keys(J).sort()){if(J[Y]===void 0)continue;if(H&&(Y==="take"||Y==="skip")){T7($,Z,X,Y,J[Y]);continue}if(H?J9.has(Y):Y9.has(Y))continue;if(Y==="lock")throw new w0(`${Z.as}.lock`,$.name,X,"'lock' locks the rows of the model being queried, not an included relation's. Lock the related rows with their own locking read in the same transaction.");if(Y==="orderBy"&&!H)throw new K(`${Z.as}.orderBy`,$.name,X,"Prisma does not accept 'orderBy' on a to-one relation \u2014 there is at "+"most one row to order.");if(Y==="take"||Y==="skip")throw new K(`${Z.as}.${Y}`,$.name,X,`Prisma does not accept '${Y}' on a to-one relation.`);throw new K(`${Z.as}.${Y}`,$.name,X,`A relation node takes ${[...H?J9:Y9].sort().join(", ")}.`)}}function T7($,Z,X,z,J){X3($.name,X,`${Z.as}.${z}`,z,J)}function u3($,Z){let X=$.node;if(typeof X!=="object"||X===null||Array.isArray(X))return;for(let z of["take","skip"]){if(X[z]===void 0)continue;throw new K(`${$.as}.${z}`,$.parent.name,$.operation,`A '${z}' inside a to-many relation is per parent, and the batched `+"relation planner serves every parent from one query \u2014 so the only "+`limit it could emit would page every parent's children as one set. Only the lateral join strategy can express it, by paginating inside a subquery that already runs once per parent row, and it needs Postgres: ${Z}. Load '${$.as}' as its own query, or narrow it with 'where'.`)}}function D9($,Z,X,z){if(typeof Z!=="object"||Z===null||Array.isArray(Z))return;if(Z.select!==void 0)Z0($,Z,X);let J=f0($,Z,X);if(J.length===0)return;if(z>H3)throw new g3($.name,H3);for(let H of J)B9($,H,X),D9(P9($,H),H.node,X,z+1)}function j9($,Z,X,z){if($.parentFields.length!==1)throw new K(X.name,Z.name,z,`${X.name} joins on ${$.parentFields.length} fields (${$.parentFields.join(", ")}), and it is planned through a join table, which links two models by a single primary key each side. Prisma does not build an implicit many-to-many over a composite key.`);return{parentField:$.parentFields[0],childField:$.childFields[0],join:$.join}}function H0($,Z,X,z){if(X.joinTable)return I7($,Z,X);if(X.from.length>0)return H9($,X,X.from,X.to,z);let J=R7($,Z,X);if(J.from.length===0)throw new d($.name,X.name,`neither ${$.name}.${X.name} nor ${Z.name}.${J.name} holds the foreign key.`);return H9($,X,J.to,J.from,z)}function H9($,Z,X,z,J){if(X.length===0)throw new K(Z.name,$.name,J,`${Z.name} names no join fields.`);if(X.length!==z.length)throw new d($.name,Z.name,`it joins ${X.length} field(s) to ${z.length}: ${X.join(", ")} against ${z.join(", ")}.`);return{parentFields:X,childFields:z}}function R7($,Z,X){let z=Object.values(Z.relations).filter((J)=>J.relationName===X.relationName&&!(Z.name===$.name&&J.name===X.name));if(z.length!==1)throw new d($.name,X.name,z.length===0?`${Z.name} declares no relation named '${X.relationName}'.`:`${Z.name} declares ${z.length} relations named '${X.relationName}'.`);return z[0]}function I7($,Z,X){let{table:z,a:J,b:H}=X.joinTable;if(J===H){let G=X.joinTable.ownerColumn;if(!G)throw new K(X.name,$.name,"include",`${X.name} is a self-referential implicit many-to-many, and the generated artifact predates support for one. Re-run \`prisma generate\`.`);return{parentFields:[J3($,X)],childFields:[J3(Z,X)],join:{table:z,parentColumn:G,childColumn:G==="A"?"B":"A"}}}if($.name!==J&&$.name!==H)throw new d($.name,X.name,`the join table '${z}' connects ${J} and ${H}, neither of which is ${$.name}.`);let Y=$.name===J?"A":"B";return{parentFields:[J3($,X)],childFields:[J3(Z,X)],join:{table:z,parentColumn:Y,childColumn:Y==="A"?"B":"A"}}}function J3($,Z){if($.primaryKey.length!==1)throw new d($.name,Z.name,`an implicit many-to-many joins on ${$.name}'s primary key, which has ${$.primaryKey.length} fields.`);return $.primaryKey[0]}function Y3($,Z,X){let z=$.fields[X];if(!z)throw new d($.name,Z.name,`it joins on '${X}', which is not a field on ${$.name}.`);return z}function P9($,Z){return e($,Z.relation,Z.as)}function e($,Z,X=Z.name){let z=Z.model;if(!P0(z))throw new y3($.name,X,z,W9());let J=G0(z)?.$schema;if(!J)throw new v0(z);return J}var V9="batched",W0={name:V9,plan($){u3($,"this query planned with the batched strategy");let Z=H0($.parent,$.child,$.relation,$.operation);for(let H of Z.parentFields)G9($.parent,$.relation,Y3($.parent,$.relation,H));for(let H of Z.childFields)G9($.child,$.relation,Y3($.child,$.relation,H));let X=Y3($.parent,$.relation,Z.parentFields[0]),z=Y3($.child,$.relation,Z.childFields[0]),J=$.relation.kind==="many";return{as:$.as,model:$.relation.model,kind:$.relation.kind,parentFields:Z.parentFields,strategy:V9,load(H,Y,G){let V={parentKeyField:X,childKeyField:z,many:J,parents:H,args:Y,executor:G};return Z.join?N7($,Z,V):U7($,Z,V)}}}};async function U7($,Z,X){let{keys:z,byKey:J}=_9(X.parents,Z.parentFields);if(z.length===0)return;let H=$.locate(X.args),Y=K9(H,Z.childFields,z,$.child,$.dialect),G=await X.executor.exec($.relation.model,"findMany",Y.args,!0);for(let V of G){let W=J.get(E0(Z.childFields.map((M)=>V[M])));if(!W)continue;for(let M of W)Q9(M,$.as,V,X.many)}if(Y.hidden)for(let V of G)for(let W of Z.childFields)delete V[W]}async function N7($,Z,X){let{keys:z,byKey:J}=_9(X.parents,Z.parentFields);if(z.length===0)return;let{dialect:H}=$,Y=Z.join,G=await O7(H,Y,z.map((j)=>H.encode(j[0],X.parentKeyField)),X.executor),V=new Map,W=[];for(let j of G){let C=E0([H.decode(j[Y.parentColumn],X.parentKeyField)]),_=J.get(C);if(!_)continue;let F=H.decode(j[Y.childColumn],X.childKeyField),T=E0([F]),Q=V.get(T);if(Q===void 0)Q=[],V.set(T,Q),W.push([F]);for(let L of _)Q.push(L)}if(W.length===0)return;let M=$.locate(X.args),B=K9(M,Z.childFields,W,$.child,$.dialect),D=await X.executor.exec($.relation.model,"findMany",B.args,!0);for(let j of D){let C=V.get(E0([j[Z.childFields[0]]]));if(!C)continue;for(let _ of C)Q9(_,$.as,j,X.many)}if(B.hidden)for(let j of D)delete j[Z.childFields[0]]}async function O7($,Z,X,z){let J=R(P(`select ${$.quoteIdent(Z.parentColumn)}, ${$.quoteIdent(Z.childColumn)} from ${$.quoteIdent(Z.table)} where `),$.inList($.quoteIdent(Z.parentColumn),!1,X.length,()=>X)),{text:H,binders:Y}=p(J,$,{model:Z.table,operation:"include"}),G=N0();return z.query(H,Y.map((V)=>V(void 0,G)))}function K9($,Z,X,z,J){let H=$===!0||$===null||typeof $!=="object"?{}:$,Y=Z.length===1?{[Z[0]]:{in:X.map((B)=>B[0])}}:F7(z,Z,X,J),G={where:H.where===void 0?Y:{AND:[H.where,Y]}};if(H.orderBy!==void 0)G.orderBy=H.orderBy;if(H.include!==void 0)G.include=H.include;let V=H.omit;if(V!==void 0){let B=Z.filter((D)=>V[D]===!0);if(B.length===0)G.omit=V;else{let D={...V};for(let j of B)delete D[j];return G.omit=D,{args:G,hidden:!0}}}let W=H.select;if(W===void 0)return{args:G,hidden:!1};let M=Z.filter((B)=>W[B]!==!0);if(M.length===0)return G.select=W,{args:G,hidden:!1};G.select={...W};for(let B of M)G.select[B]=!0;return{args:G,hidden:!0}}function F7($,Z,X,z){let J=Z.map((H)=>$.fields[H]?.type);if(J.every((H)=>H!==void 0)&&z.canBindCompositeIn(J))return{[$0]:e5(Z,X)};return{OR:X.map((H)=>Object.fromEntries(Z.map((Y,G)=>[Y,H[G]])))}}function E0($){return JSON.stringify($.map(S7))}function Q9($,Z,X,z){if(z){$[Z].push(X);return}if($[Z]===null)$[Z]=X}function _9($,Z){let X=new Map,z=[];for(let J of $){let H=Z.map((V)=>J[V]);if(H.some((V)=>V===null||V===void 0))continue;let Y=E0(H),G=X.get(Y);if(G===void 0)G=[],X.set(Y,G),z.push(H);G.push(J)}return{keys:z,byKey:X}}function S7($){if(typeof $!=="object"||$===null)return $;if($ instanceof Date)return $.getTime();if(ArrayBuffer.isView($)){let Z=new Uint8Array($.buffer,$.byteOffset,$.byteLength),X="";for(let z of Z)X+=z.toString(16).padStart(2,"0");return`bytes:${X}`}throw Error(`Cannot key a relation stitch on ${Object.prototype.toString.call($)}.`)}function G9($,Z,X){if(X.isList)throw new d($.name,Z.name,`it joins on '${X.name}', a ${X.type} list \u2014 which decodes to a new `+"array per row and so cannot be compared between the two sides.");if(X.type!=="Json")return;throw new d($.name,Z.name,`it joins on '${X.name}', a ${X.type} \u2014 which decodes to a new object `+"per row and so cannot be compared between the two sides.")}var C9=(()=>{try{return Function("return 1")()===1}catch{return!1}})(),L9=!0;function A7($){L9=$}function b7(){return C9}function g0($,Z,X=[]){if(C9&&L9)return q7($,Z,X);return m3($,Z,X)}function m3($,Z,X=[]){let z=$.map((G)=>({key:G.name,column:G.column,field:G,decode:Z.needsDecode(G)})),J=z.length,H=X.map((G)=>({key:G.key,many:G.kind==="many"})),Y=H.length;return(G)=>{let V=[];for(let W=0;W<G.length;W++){let M=G[W],B={};for(let D=0;D<J;D++){let j=z[D],C=M[j.column];B[j.key]=j.decode?Z.decode(C,j.field):C??null}for(let D=0;D<Y;D++)B[H[D].key]=H[D].many?[]:null;V.push(B)}return V}}function q7($,Z,X){let z=[];for(let H=0;H<$.length;H++){let Y=$[H],G=JSON.stringify(Y.name),V=JSON.stringify(Y.column);z.push(Z.needsDecode(Y)?`${G}: d.decode(row[${V}], f[${H}])`:`${G}: row[${V}] ?? null`)}for(let H of X)z.push(`${JSON.stringify(H.key)}: ${H.kind==="many"?"[]":"null"}`);let J=`
|
|
3
3
|
return function shape(rows) {
|
|
4
4
|
const out = [];
|
|
5
5
|
for (let i = 0; i < rows.length; i++) {
|
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-aw8gj99f.js";import{el as Q,gl as Z,hl as P,il as y,jl as U,kl as A}from"../chunk-s29tgy4y.js";import{ol as H}from"../chunk-8ex0y47w.js";import"../chunk-m6t5a0me.js";import{vl as F}from"../chunk-t2nsn0r2.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-aw8gj99f.js";import{el as Q,gl as Z,hl as P,il as y,jl as U,kl as A}from"../chunk-s29tgy4y.js";import{ol as H}from"../chunk-8ex0y47w.js";import"../chunk-m6t5a0me.js";import{vl as F}from"../chunk-t2nsn0r2.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-w4ma7978.js");this.server=await J(this.app,I)}else{f();let{httpDev:J}=await import("../chunk-6d3m2w2p.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=24E8078E2272CAA564756E2164756E21
|
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-9qfd02h8.js";import"../chunk-mfn94b95.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-fpz9e3xx.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-ce9wm3r9.js";import{Yd as K8,Zd as G8}from"../chunk-p57nt0pm.js";import"../chunk-6hs102jh.js";import{$e as eW,$f as n5,Ae as AW,Af as b5,Be as hW,Bf as T5,Bg as v1,Ce as gW,Cf as P5,De as EW,Ee as mW,Fe as b0,Ff as w5,Ge as cW,Gf as V5,He as uW,Hf as v5,Ie as pW,If as q5,Je as dW,Ke as lW,Kf as y5,Lf as A5,Mf as h5,Mg as KZ,Nf as g5,Ng as GZ,Of as E5,Pf as m5,Qf as c5,Rf as u5,Sf as p5,Tf as d5,Yf as C,Zf as i,_f as l5,af as W5,ag as i5,bf as Z5,bg as o5,cf as $5,cg as s5,df as J5,ef as Q5,eg as a5,fe as o0,fg as t5,ge as bW,gg as r5,he as TW,hg as e5,ie as IW,ig as WZ,ke as PW,kf as D5,lf as F5,lg as ZZ,mf as H5,mg as $Z,nf as U5,ng as JZ,oe as s0,of as O5,pe as v0,pf as S5,qe as q0,qf as R5,re as G4,rf as _5,se as wW,sf as f5,sg as QZ,uf as k5,vf as W6,we as VW,wf as C5,wg as YZ,xe as vW,ye as qW,ze as yW}from"../chunk-kkqw8bqg.js";import"../chunk-ej4kf7m5.js";import"../chunk-5qfzvnyp.js";import{Bi as I1,Fh as K4,Gh as J4,Hh as M1,Uh as L4,Xh as t,Zh as d,bi as Q4,ci as L1,di as T1,ei as nW,fi as iW,gi as oW,hi as sW,wi as aW,xi as tW,zi as rW}from"../chunk-j2k408xc.js";import"../chunk-9k46m1vf.js";import{Li as r}from"../chunk-mnmr27wd.js";import{Ti as j5,Ui as M5,Vi as b1,Wi as L5,Xi as k0,Yi as N5,Zi as x5}from"../chunk-ktrm6y5j.js";import{dj as z5,ej as X5,fj as B5}from"../chunk-9xzg05xg.js";import"../chunk-a37shxb1.js";import{Oj as I5}from"../chunk-68f0jpje.js";import{Qj as Y5,Rj as K5,Sj as G5}from"../chunk-1skdsmjx.js";import"../chunk-yjszzjyj.js";import"../chunk-p81qeav5.js";import"../chunk-t03nda3s.js";import"../chunk-qt6x2r6a.js";import{Ik as zZ,Jk as XZ,Kk as BZ,Lk as jZ,Nk as MZ}from"../chunk-5g7m7g4a.js";import"../chunk-m8yd59gg.js";import{Xk as q}from"../chunk-1ed75a7b.js";import"../chunk-0839f72f.js";import"../chunk-rvm5mkwm.js";import"../chunk-s29tgy4y.js";import"../chunk-8ex0y47w.js";import"../chunk-m6t5a0me.js";import{vl as I0}from"../chunk-t2nsn0r2.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-r567t83k.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-b4mg6v4g.js";import"../chunk-9zd7c4wq.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-fpz9e3xx.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-ce9wm3r9.js";import{Yd as K8,Zd as G8}from"../chunk-p57nt0pm.js";import"../chunk-6hs102jh.js";import{$e as eW,$f as n5,Ae as AW,Af as b5,Be as hW,Bf as T5,Bg as v1,Ce as gW,Cf as P5,De as EW,Ee as mW,Fe as b0,Ff as w5,Ge as cW,Gf as V5,He as uW,Hf as v5,Ie as pW,If as q5,Je as dW,Ke as lW,Kf as y5,Lf as A5,Mf as h5,Mg as KZ,Nf as g5,Ng as GZ,Of as E5,Pf as m5,Qf as c5,Rf as u5,Sf as p5,Tf as d5,Yf as C,Zf as i,_f as l5,af as W5,ag as i5,bf as Z5,bg as o5,cf as $5,cg as s5,df as J5,ef as Q5,eg as a5,fe as o0,fg as t5,ge as bW,gg as r5,he as TW,hg as e5,ie as IW,ig as WZ,ke as PW,kf as D5,lf as F5,lg as ZZ,mf as H5,mg as $Z,nf as U5,ng as JZ,oe as s0,of as O5,pe as v0,pf as S5,qe as q0,qf as R5,re as G4,rf as _5,se as wW,sf as f5,sg as QZ,uf as k5,vf as W6,we as VW,wf as C5,wg as YZ,xe as vW,ye as qW,ze as yW}from"../chunk-a78b9v7h.js";import"../chunk-ej4kf7m5.js";import"../chunk-5qfzvnyp.js";import{Bi as I1,Fh as K4,Gh as J4,Hh as M1,Uh as L4,Xh as t,Zh as d,bi as Q4,ci as L1,di as T1,ei as nW,fi as iW,gi as oW,hi as sW,wi as aW,xi as tW,zi as rW}from"../chunk-27xsjq8a.js";import"../chunk-9k46m1vf.js";import{Li as r}from"../chunk-fg2k18d2.js";import{Ti as j5,Ui as M5,Vi as b1,Wi as L5,Xi as k0,Yi as N5,Zi as x5}from"../chunk-ktrm6y5j.js";import{dj as z5,ej as X5,fj as B5}from"../chunk-9xzg05xg.js";import"../chunk-a37shxb1.js";import{Oj as I5}from"../chunk-68f0jpje.js";import{Qj as Y5,Rj as K5,Sj as G5}from"../chunk-1skdsmjx.js";import"../chunk-yjszzjyj.js";import"../chunk-p81qeav5.js";import"../chunk-t03nda3s.js";import"../chunk-qt6x2r6a.js";import{Ik as zZ,Jk as XZ,Kk as BZ,Lk as jZ,Nk as MZ}from"../chunk-5g7m7g4a.js";import"../chunk-m8yd59gg.js";import{Xk as q}from"../chunk-1ed75a7b.js";import"../chunk-0839f72f.js";import"../chunk-rvm5mkwm.js";import"../chunk-s29tgy4y.js";import"../chunk-8ex0y47w.js";import"../chunk-m6t5a0me.js";import{vl as I0}from"../chunk-t2nsn0r2.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-r567t83k.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])
|
package/package.json
CHANGED
package/dist/chunk-mnmr27wd.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
function v(j){return Object.freeze({name:j})}class T extends Error{key;constructor(j){super(`Request state "${j.name}" is not set. Check that whatever sets it (a middleware, \`context()\`) ran for this request.`);this.key=j;this.name="MissingRequestStateError"}}class K{#j=new Map;get(j){return this.#j.get(j)}require(j){if(!this.#j.has(j))throw new T(j);return this.#j.get(j)}set(j,J){return this.#j.set(j,J),J}has(j){return this.#j.has(j)}delete(j){return this.#j.delete(j)}static carry(j,J){for(let[Q,V]of j.#j)if(!J.#j.has(Q))J.#j.set(Q,V)}}function B(){for(let j of["HOST_NAME","APP_URL"]){let J=process.env[j]?.trim().replace(/\/+$/,"");if(J)return J}return}function p(j){let J=B(),Q=J===void 0?"fallback":J===process.env.HOST_NAME?.trim().replace(/\/+$/,"")?"HOST_NAME":"APP_URL",V=J??j?.trim().replace(/\/+$/,"");if(!V)throw Error("The app's public origin is not configured: set HOST_NAME (or APP_URL), e.g. HOST_NAME=https://example.com.");let Z=URL.canParse(V)?new URL(V).protocol:null;if(Z!=="http:"&&Z!=="https:")throw Error(`The app's public origin from ${Q} (${JSON.stringify(V)}) is not an absolute http(s) URL, e.g. https://example.com.`);return V}import{AsyncLocalStorage as q}from"async_hooks";var A=new Set(["woff2","woff","truetype","opentype","collection","embedded-opentype","svg"]),O={woff2:"woff2",woff:"woff",ttf:"truetype",otf:"opentype",ttc:"collection",eot:"embedded-opentype",svg:"svg"};var S=new Set(["auto","block","swap","fallback","optional"]),I=/^[a-zA-Z0-9.%+\- ]+$/,w=/^[uU]\+[0-9a-fA-F?]{1,6}(-[0-9a-fA-F]{1,6})?(\s*,\s*[uU]\+[0-9a-fA-F?]{1,6}(-[0-9a-fA-F]{1,6})?)*$/;function G(j){throw TypeError(`Meta.fonts: ${j}`)}function R(j){let J=(j.split(/[?#]/)[0]??"").split("/").pop()??"",Q=J.lastIndexOf(".");return Q===-1?null:O[J.slice(Q+1).toLowerCase()]??null}function P(j,J){if(J===void 0||J===null)return null;let Q=String(J).trim();if(!Q||!I.test(Q))G(`${j} ${JSON.stringify(J)} is not a valid font-${j} value`);return Q}function W(j){if(!Array.isArray(j))G("expected an array of fonts");return j.map((J)=>{if(typeof J?.family!=="string"||!J.family.trim())G("every font needs a family");let Q=typeof J.src==="string"?[{url:J.src}]:J.src;if(!Array.isArray(Q)||Q.length===0)G(`font "${J.family}" needs a src`);let V=Q.map(($)=>{if(typeof $?.url!=="string"||!$.url.trim())G(`font "${J.family}" has a source without a url`);if($.format!==void 0&&!A.has($.format))G(`font "${J.family}" has an unknown format ${JSON.stringify($.format)}`);return{url:$.url.trim(),format:$.format??R($.url)}}),Z=J.display??"swap";if(!S.has(Z))G(`display ${JSON.stringify(Z)} is not a valid font-display value`);let X=J.unicodeRange?.trim()||null;if(X&&!w.test(X))G(`unicodeRange ${JSON.stringify(J.unicodeRange)} is not a valid unicode-range`);return{family:J.family.trim(),src:V,weight:P("weight",J.weight),style:P("style",J.style),stretch:P("stretch",J.stretch),display:Z,unicodeRange:X,preload:J.preload===!0}})}class U{content={title:"Gemi App",description:null,openGraph:null,htmlAttributes:null,canonical:null,alternates:null,fonts:null};touched=!1;render(){return{title:this.content.title,description:this.content.description,openGraph:this.content.openGraph,htmlAttributes:this.content.htmlAttributes,canonical:this.content.canonical,alternates:this.content.alternates,fonts:this.content.fonts}}htmlAttributes(j){this.touched=!0;let J=Object.fromEntries(Object.entries(j).filter(([,Q])=>Q!==void 0));this.content.htmlAttributes={...this.content.htmlAttributes,...J}}canonical(j){this.touched=!0,this.content.canonical=j}alternates(j){this.touched=!0,this.content.alternates=j}fonts(j){let J=W(j);this.touched=!0,this.content.fonts=[...this.content.fonts??[],...J]}title(j){this.touched=!0,this.content.title=j}description(j){this.touched=!0,this.content.description=j}openGraph({title:j,description:J,type:Q,url:V,image:Z,imageAlt:X,imageWidth:$,imageHeight:L,twitterImage:D=Z,twitterImageAlt:E=X,twitterImageWidth:_=$,twitterImageHeight:x=L}){this.touched=!0;let H=Z,N=D;if(Z&&!Z.startsWith("http"))H=`${B()}${Z}`,N=`${B()}${D}`;this.content.openGraph=Object.fromEntries(Object.entries({title:j,description:J,type:Q,url:V,image:H,imageAlt:X,imageWidth:$,imageHeight:L,twitterImage:N,twitterImageAlt:E,twitterImageWidth:_,twitterImageHeight:x}).filter(([k,C])=>C!==void 0))}}function F(j,J,Q={}){return[`${j}=${J}`,Q.maxAge?`Max-Age=${Q.maxAge}`:"",Q.httpOnly?"HttpOnly":"",Q.secure?"Secure":"",Q.sameSite?`SameSite=${Q.sameSite}`:"SameSite=Strict",Q.path?`Path=${Q.path}`:"Path=/",Q.domain?`Domain=${Q.domain}`:"",Q.expires?`Expires=${Q.expires.toUTCString()}`:"",Q.partitioned?"Partitioned":""].filter((V)=>V!=="").join("; ")}var z=new q;class M{req;cookies=new Set;headers=new Headers;serverQueries=null;user=null;csrfHmac=null;locale=null;metadata=new U;rangeRequest=null;sessionId=null;featureEvaluations=null;featureContext=null;featureBuckets=null;pendingWork=new Set;ended=!1;constructor(j){this.req=j}waitUntil(j){if(this.ended)return;let J=Promise.resolve(j).then(()=>{},()=>{});this.pendingWork.add(J),J.then(()=>this.pendingWork.delete(J))}hasPendingWork(){return this.pendingWork.size>0}async whenIdle(){while(this.pendingWork.size>0)await Promise.all(Array.from(this.pendingWork))}setLocale(j){this.locale=j}renderMeta(){return this.metadata.render()}setCSRFHmac(j){this.csrfHmac=j}setCookie(j,J,Q={}){this.cookies.add(F(j,J,Q))}deleteCookie(j,J={}){this.cookies.add(F(j,"",{...J,maxAge:-1}))}setHeaders(j,J){this.headers.set(j,J)}setUser(j){this.user=j}setRequest(j){this.req=j}destroy(){this.ended=!0,delete this.cookies,delete this.headers,this.serverQueries=null,this.sessionId=null,this.featureEvaluations=null,this.featureContext=null,this.featureBuckets=null,delete this.user}}var b="session_id";function y(){let j=Y.getStore();if(!j)return null;if(j.sessionId)return j.sessionId;let J=j.req?.cookies?.get(b);if(J)j.sessionId=J;return j.sessionId}function a(){let j=Y.getStore();if(!j)return null;let J=y();if(J)return J;let Q=Bun.randomUUIDv7();return j.sessionId=Q,j.setCookie(b,Q,{httpOnly:!0,secure:Bun.env.NODE_ENV==="production",sameSite:"Lax",expires:new Date(Date.now()+31536000000)}),Q}class Y{static getStore(){return z.getStore()}static setRequest(j){z.getStore().req=j}static run(j,J,Q){let V=new M(j);if(Q){if(V.user=Q.user,Q.state&&j.state)K.carry(Q.state,j.state)}return z.run(V,J)}static runWith(j,J){return z.run(j,J)}static exit(j){return z.exit(j)}}
|
|
3
|
-
export{B as Li,p as Mi,v as Ni,T as Oi,K as Pi,y as Qi,a as Ri,Y as Si};
|
|
4
|
-
|
|
5
|
-
//# debugId=C468952ED6729F0064756E2164756E21
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|