32 lines
160 KiB
JavaScript
32 lines
160 KiB
JavaScript
|
var zs=Object.create;var Hr=Object.defineProperty;var Ys=Object.getOwnPropertyDescriptor;var Zs=Object.getOwnPropertyNames;var Xs=Object.getPrototypeOf,ea=Object.prototype.hasOwnProperty;var Wr=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Te=(e,t)=>()=>(e&&(t=e(e=0)),t);var Fe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Kr=(e,t)=>{for(var r in t)Hr(e,r,{get:t[r],enumerable:!0})},ta=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Zs(t))!ea.call(e,i)&&i!==r&&Hr(e,i,{get:()=>t[i],enumerable:!(n=Ys(t,i))||n.enumerable});return e};var _e=(e,t,r)=>(r=e!=null?zs(Xs(e)):{},ta(t||!e||!e.__esModule?Hr(r,"default",{value:e,enumerable:!0}):r,e));var y,c=Te(()=>{"use strict";y={nextTick:(e,...t)=>{setTimeout(()=>{e(...t)},0)},env:{},version:"",cwd:()=>"/",stderr:{},argv:["/bin/node"]}});var b,p=Te(()=>{"use strict";b=globalThis.performance??(()=>{let e=Date.now();return{now:()=>Date.now()-e}})()});var E,d=Te(()=>{"use strict";E=()=>{};E.prototype=E});var m=Te(()=>{"use strict"});var di=Fe(ze=>{"use strict";f();c();p();d();m();var Zn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ra=Zn(e=>{"use strict";e.byteLength=l,e.toByteArray=g,e.fromByteArray=S;var t=[],r=[],n=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(o=0,s=i.length;o<s;++o)t[o]=i[o],r[i.charCodeAt(o)]=o;var o,s;r[45]=62,r[95]=63;function a(C){var R=C.length;if(R%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var M=C.indexOf("=");M===-1&&(M=R);var F=M===R?0:4-M%4;return[M,F]}function l(C){var R=a(C),M=R[0],F=R[1];return(M+F)*3/4-F}function u(C,R,M){return(R+M)*3/4-M}function g(C){var R,M=a(C),F=M[0],q=M[1],D=new n(u(C,F,q)),I=0,oe=q>0?F-4:F,G;for(G=0;G<oe;G+=4)R=r[C.charCodeAt(G)]<<18|r[C.charCodeAt(G+1)]<<12|r[C.charCodeAt(G+2)]<<6|r[C.charCodeAt(G+3)],D[I++]=R>>16&255,D[I++]=R>>8&255,D[I++]=R&255;return q===2&&(R=r[C.charCodeAt(G)]<<2|r[C.charCodeAt(G+1)]>>4,D[I++]=R&255),q===1&&(R=r[C.charCodeAt(G)]<<10|r[C.charCodeAt(G+1)]<<4|r[C.charCodeAt(G+2)]>>2,D[I++]=R>>8&255,D[I++]=R&255),D}function h(C){return t[C>>18&63]+t[C>>12&63]+t[C>>6&63]+t[C&63]}function v(C,R,M){for(var F,q=[],D=R;D<M;D+=3)F=(C[D]<<16&16711680)+(C[D+1]<<8&65280)+(C[D+2]&255),q.push(h(F));return q.join("")}function S(C){for(var R,M=C.length,F=M%3,q=[],D=16383,I=0,oe=M-F;I<oe;I+=D)q.push(v(C,I,I+D>oe?oe:I+D));return F===1?(R=C[M-1],q.push(t[R>>2]+t[R<<4&63]+"==")):F===2&&(R=(C[M-2]<<8)+C[M-1],q.push(t[R>>10]+t[R>>4&63]+t[R<<2&63]+"=")),q.join("")}}),na=Zn(e=>{e.read=function(t,r,n,i,o){var s,a,l=o*8-i-1,u=(1<<l)-1,g=u>>1,h=-7,v=n?o-1:0,S=n?-1:1,C=t[r+v];for(v+=S,s=C&(1<<-h)-1,C>>=-h,h+=l;h>0;s=s*256+t[r+v],v+=S,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=i;h>0;a=a*256+t[r+v],v+=S,h-=8);if(s===0)s=1-g;else{if(s===u)return a?NaN:(C?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-g}return(C?-1:1)*a*Math.pow(2,s-i)},e.write=function(t,r,n,i,o,s){var a,l,u,g=s*8-o-1,h=(1<<g)-1,v=h>>1,S=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=i?0:s-1,R=i?1:-1,M=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(l=isNaN(r)?1:0,a=h):(a=Math.floor(Math.log(r)/Math.LN2),r*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+v>=1?r+=S/u:r+=S*Math.pow(2,1-v),r*u>=2&&(a++,u/=2),a+v>=h?(l=0,a=h):a+v>=1?(l=(r*u-1)*Math.pow(2,o),a=a+v):(l=r*Math.pow(2,v-1)*Math.pow(2,o),a=0));o>=8;t[n+C]=l&255,C+=R,l/=256,o-=8);for(a=a<<o|l,g+=o;g>0;t[n+C]=a&255,C+=R,a/=256,g-=8);t[n+C-R]|=M*128}}),zr=ra(),We=na(),Wn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ze.Buffer=T;ze.SlowBuffer=ua;ze.INSPECT_MAX_BYTES=50;var sr=2147483647;ze.kMaxLength=sr;T.TYPED_ARRAY_SUPPORT=ia();!T.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser sup
|
||
|
`)}getCurrentLineLength(){return this.currentLine.length}indentedCurrentLine(){let t=this.currentLine.padStart(this.currentLine.length+2*this.currentIndent);return this.marginSymbol?this.marginSymbol+t.slice(1):t}};f();c();p();d();m();f();c();p();d();m();function Xi(e){return e.substring(0,1).toLowerCase()+e.substring(1)}f();c();p();d();m();function tt(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function yr(e){return e.toString()!=="Invalid Date"}f();c();p();d();m();f();c();p();d();m();var rt=9e15,ke=1e9,yn="0123456789abcdef",Er="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",br="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",wn={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-rt,maxE:rt,crypto:!1},no,xe,_=!0,Pr="[DecimalError] ",Oe=Pr+"Invalid argument: ",io=Pr+"Precision limit exceeded",oo=Pr+"crypto unavailable",so="[object Decimal]",X=Math.floor,Q=Math.pow,rl=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,nl=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,il=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,ao=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,pe=1e7,k=7,ol=9007199254740991,sl=Er.length-1,En=br.length-1,A={toStringTag:so};A.absoluteValue=A.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),O(e)};A.ceil=function(){return O(new this.constructor(this),this.e+1,2)};A.clampedTo=A.clamp=function(e,t){var r,n=this,i=n.constructor;if(e=new i(e),t=new i(t),!e.s||!t.s)return new i(NaN);if(e.gt(t))throw Error(Oe+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)};A.comparedTo=A.cmp=function(e){var t,r,n,i,o=this,s=o.d,a=(e=new o.constructor(e)).d,l=o.s,u=e.s;if(!s||!a)return!l||!u?NaN:l!==u?l:s===a?0:!s^l<0?1:-1;if(!s[0]||!a[0])return s[0]?l:a[0]?-u:0;if(l!==u)return l;if(o.e!==e.e)return o.e>e.e^l<0?1:-1;for(n=s.length,i=a.length,t=0,r=n<i?n:i;t<r;++t)if(s[t]!==a[t])return s[t]>a[t]^l<0?1:-1;return n===i?0:n>i^l<0?1:-1};A.cosine=A.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+k,n.rounding=1,r=al(n,mo(n,r)),n.precision=e,n.rounding=t,O(xe==2||xe==3
|
||
|
`)}};function ut(e){return new vn(yo(e))}function yo(e){let t=new lt;for(let[r,n]of Object.entries(e)){let i=new Sr(r,wo(n));t.addField(i)}return t}function wo(e){if(typeof e=="string")return new W(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new W(String(e));if(typeof e=="bigint")return new W(`${e}n`);if(e===null)return new W("null");if(e===void 0)return new W("undefined");if(it(e))return new W(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return w.Buffer.isBuffer(e)?new W(`Buffer.alloc(${e.byteLength})`):new W(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=yr(e)?e.toISOString():"Invalid Date";return new W(`new Date("${t}")`)}return e instanceof be?new W(`Prisma.${e._getName()}`):ot(e)?new W(`prisma.${Xi(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?zl(e):typeof e=="object"?yo(e):new W(Object.prototype.toString.call(e))}function zl(e){let t=new at;for(let r of e)t.addItem(wo(r));return t}function Ir(e,t){let r=t==="pretty"?go:Rr,n=e.renderAllMessages(r),i=new et(0,{colors:r}).write(e).toString();return{message:n,args:i}}function Eo(e){if(e===void 0)return"";let t=ut(e);return new et(0,{colors:Rr}).write(t).toString()}f();c();p();d();m();var Yl="P2037";function Lt({error:e,user_facing_error:t},r,n){return t.error_code?new K(Zl(t,n),{code:t.error_code,clientVersion:r,meta:t.meta,batchRequestIdx:t.batch_request_idx}):new se(e,{clientVersion:r,batchRequestIdx:t.batch_request_idx})}function Zl(e,t){let r=e.message;return(t==="postgresql"||t==="postgres"||t==="mysql")&&e.error_code===Yl&&(r+=`
|
||
|
Prisma Accelerate has built-in connection pooling to prevent such errors: https://pris.ly/client/error-accelerate`),r}f();c();p();d();m();f();c();p();d();m();f();c();p();d();m();f();c();p();d();m();f();c();p();d();m();var Tn=class{getLocation(){return null}};function Me(e){return typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new Tn}f();c();p();d();m();f();c();p();d();m();f();c();p();d();m();var bo={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function ct(e={}){let t=eu(e);return Object.entries(t).reduce((n,[i,o])=>(bo[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function eu(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function Or(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function xo(e,t){let r=Or(e);return t({action:"aggregate",unpacker:r,argsMapper:ct})(e)}f();c();p();d();m();function tu(e={}){let{select:t,...r}=e;return typeof t=="object"?ct({...r,_count:t}):ct({...r,_count:{_all:!0}})}function ru(e={}){return typeof e.select=="object"?t=>Or(e)(t)._count:t=>Or(e)(t)._count._all}function Po(e,t){return t({action:"count",unpacker:ru(e),argsMapper:tu})(e)}f();c();p();d();m();function nu(e={}){let t=ct(e);if(Array.isArray(t.by))for(let r of t.by)typeof r=="string"&&(t.select[r]=!0);else typeof t.by=="string"&&(t.select[t.by]=!0);return t}function iu(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function vo(e,t){return t({action:"groupBy",unpacker:iu(e),argsMapper:nu})(e)}function To(e,t,r){if(t==="aggregate")return n=>xo(n,r);if(t==="count")return n=>Po(n,r);if(t==="groupBy")return n=>vo(n,r)}f();c();p();d();m();function Ao(e,t){let r=t.fields.filter(i=>!i.relationName),n=ln(r,i=>i.name);return new Proxy({},{get(i,o){if(o in i||typeof o=="symbol")return i[o];let s=n[o];if(s)return new _t(e,o,s.type,s.isList,s.kind==="enum")},...gr(Object.keys(n))})}f();c();p();d();m();f();c();p();d();m();var Co=e=>Array.isArray(e)?e:e.split("."),An=(e,t)=>Co(t).reduce((r,n)=>r&&r[n],e),Ro=(e,t,r)=>Co(t).reduceRight((n,i,o,s)=>Object.assign({},An(e,s.slice(0,o)),{[i]:n}),r);function ou(e,t){return e===void 0||t===void 0?[]:[...t,"select",e]}function su(e,t,r){return t===void 0?e??{}:Ro(t,r,e||!0)}function Cn(e,t,r,n,i,o){let a=e._runtimeDataModel.models[t].fields.reduce((l,u)=>({...l,[u.name]:u}),{});return l=>{let u=Me(e._errorFormat),g=ou(n,i),h=su(l,o,g),v=r({dataPath:g,callsite:u})(h),S=au(e,t);return new Proxy(v,{get(C,R){if(!S.includes(R))return C[R];let F=[a[R].type,r,R],q=[g,h];return Cn(e,...F,...q)},...gr([...S,...Object.getOwnPropertyNames(v)])})}}function au(e,t){return e._runtimeDataModel.models[t].fields.filter(r=>r.kind==="object").map(r=>r.name)}f();c();p();d();m();f();c();p();d();m();var lu=_e(Bi());var uu={red:Ye,gray:Ii,dim:ur,bold:lr,underline:Ti,highlightSource:e=>e.highlight()},cu={red:e=>e,gray:e=>e,dim:e=>e,bold:e=>e,underline:e=>e,highlightSource:e=>e};function pu({message:e,originalMethod:t,isPanic:r,callArguments:n}){return{functionName:`prisma.${t}()`,message:e,isPanic:r??!1,callArguments:n}}function du({functionName:e,location:t,message:r,isPanic:n,contextLines:i,callArguments:o},s){let a=[""],l=t?" in":":";if(n?(a.push(s.red(`Oops, an unknown error occurred! This is ${s.bold("on us")}, you did nothing wrong.`)),a.push(s.red(`It occurred in the ${s.bold(`\`${e}\``)} invocation${l}`))):a.push(s.red(`Invalid ${s.bold(`\`${e}\``)} invocation${l}`)),t&&a.push(s.underline(mu(t))),i){a.push("");let u=[i.toString()];o&&(u.push(o),u.push(s.dim(")"))),a.push(u.join("")),o&&a.push("")}else a.push(""),o&&a.push(o),a.push("");return a.push(r),a.join(`
|
||
|
`)}function mu(e){let t=[e.fileName];return e.lineNumber&&t.push(String(e.lineNumber)),e.columnNumber&&t.push(String(e.columnNumber)),t.join(":")}function pt(e){let t=e.showColors?uu:cu,r;return typeof $getTemplateParameters<"u"?r=$getTemplateParameters(e,t):r=pu(e),du(r,t)}function So(e,t,r,n){return e===qe.ModelAction.findFirstOrThrow||e===qe.ModelAction.findUniqueOrThrow?fu(t,r,n):n}function fu(e,t,r){return async n=>{if("rejectOnNotFound"in n.args){let o=pt({originalMethod:n.clientMethod,callsite:n.callsite,message:"'rejectOnNotFound' option is not supported"});throw new z(o,{clientVersion:t})}return await r(n).catch(o=>{throw o instanceof K&&o.code==="P2025"?new Ce(`No ${e} found`,t):o})}}f();c();p();d();m();function ye(e){return e.replace(/^./,t=>t.toLowerCase())}var gu=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],hu=["aggregate","count","groupBy"];function Rn(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[yu(e,t),Eu(e,t),Nt(r),te("name",()=>t),te("$name",()=>t),te("$parent",()=>e._appliedParent)];return fe({},n)}function yu(e,t){let r=ye(t),n=Object.keys(qe.ModelAction).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=l=>e._request(l);s=So(o,t,e._clientVersion,s);let a=l=>u=>{let g=Me(e._errorFormat);return e._createPrismaPromise(h=>{let v={args:u,dataPath:[],action:o,model:t,clientMethod:`${r}.${i}`,jsModelName:r,transaction:h,callsite:g};return s({...v,...l})})};return gu.includes(o)?Cn(e,t,a):wu(i)?To(e,i,a):a({})}}}function wu(e){return hu.includes(e)}function Eu(e,t){return Ue(te("fields",()=>{let r=e._runtimeDataModel.models[t];return Ao(t,r)}))}f();c();p();d();m();function Io(e){return e.replace(/^./,t=>t.toUpperCase())}var Sn=Symbol();function qt(e){let t=[bu(e),te(Sn,()=>e),te("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push(Nt(r)),fe(e,t)}function bu(e){let t=Object.keys(e._runtimeDataModel.models),r=t.map(ye),n=[...new Set(t.concat(r))];return Ue({getKeys(){return n},getPropertyValue(i){let o=Io(i);if(e._runtimeDataModel.models[o]!==void 0)return Rn(e,o);if(e._runtimeDataModel.models[i]!==void 0)return Rn(e,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function Oo(e){return e[Sn]?e[Sn]:e}function ko(e){if(typeof e=="function")return e(this);if(e.client?.__AccelerateEngine){let r=e.client.__AccelerateEngine;this._originalClient._engine=new r(this._originalClient._accelerateEngineConfig)}let t=Object.create(this._originalClient,{_extensions:{value:this._extensions.append(e)},_appliedParent:{value:this,configurable:!0},$use:{value:void 0},$on:{value:void 0}});return qt(t)}f();c();p();d();m();f();c();p();d();m();function Do({result:e,modelName:t,select:r,omit:n,extensions:i}){let o=i.getAllComputedFields(t);if(!o)return e;let s=[],a=[];for(let l of Object.values(o)){if(n){if(n[l.name])continue;let u=l.needs.filter(g=>n[g]);u.length>0&&a.push(Xe(u))}else if(r){if(!r[l.name])continue;let u=l.needs.filter(g=>!r[g]);u.length>0&&a.push(Xe(u))}xu(e,l.needs)&&s.push(Pu(l,fe(e,s)))}return s.length>0||a.length>0?fe(e,[...s,...a]):e}function xu(e,t){return t.every(r=>an(e,r))}function Pu(e,t){return Ue(te(e.name,()=>e.compute(t)))}f();c();p();d();m();function kr({visitor:e,result:t,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(t)){for(let s=0;s<t.length;s++)t[s]=kr({result:t[s],args:r,modelName:i,runtimeDataModel:n,visitor:e});return t}let o=e(t,i,r)??t;return r.include&&Mo({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),r.select&&Mo({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),o}function Mo({includeOrSelect:e,result:t,parentModelName:r,runtimeDataModel:n,visitor:i}){for(let[o,s]of Object.entries(e)){if(!s||t[o]==null)continue;let l=n.models[r].fields.find(g=>g.name===o);if(!l||l.kind!=="object"||!l.relationName)continue;let u=typeof s=="object"?s:{};t[o]=kr({visitor:i,result:t[o],args:u,modelName:l.type,runtimeDataModel:n})}}function No({result:e,modelName:t,args:r,extensio
|
||
|
|
||
|
Learn how: https://pris.ly/d/${Ho[t]}-build`;throw console.error(n),new J(n,r)}}f();c();p();d();m();function Ko(e,t){return e?e.datasources?e.datasources:e.datasourceUrl?{[t[0]]:{url:e.datasourceUrl}}:{}:{}}f();c();p();d();m();f();c();p();d();m();f();c();p();d();m();var Cu="Cloudflare-Workers",Ru="node";function zo(){return typeof Netlify=="object"?"netlify":typeof EdgeRuntime=="string"?"edge-light":globalThis.navigator?.userAgent===Cu?"workerd":globalThis.Deno?"deno":globalThis.__lagon__?"lagon":globalThis.process?.release?.name===Ru?"node":globalThis.Bun?"bun":globalThis.fastly?"fastly":"unknown"}var Su={node:"Node.js",workerd:"Cloudflare Workers",deno:"Deno and Deno Deploy",netlify:"Netlify Edge Functions","edge-light":"Edge Runtime (Vercel Edge Functions, Vercel Edge Middleware, Next.js (Pages Router) Edge API Routes, Next.js (App Router) Edge Route Handlers or Next.js Middleware)"};function In(){let e=zo();return{id:e,prettyName:Su[e]||e,isEdge:["workerd","deno","netlify","edge-light"].includes(e)}}f();c();p();d();m();f();c();p();d();m();f();c();p();d();m();function dt({inlineDatasources:e,overrideDatasources:t,env:r,clientVersion:n}){let i,o=Object.keys(e)[0],s=e[o]?.url,a=t[o]?.url;if(o===void 0?i=void 0:a?i=a:s?.value?i=s.value:s?.fromEnvVar&&(i=r[s.fromEnvVar]),s?.fromEnvVar!==void 0&&i===void 0)throw In().id==="workerd"?new J(`error: Environment variable not found: ${s.fromEnvVar}.
|
||
|
|
||
|
In Cloudflare module Workers, environment variables are available only in the Worker's \`env\` parameter of \`fetch\`.
|
||
|
To solve this, provide the connection string directly: https://pris.ly/d/cloudflare-datasource-url`,n):new J(`error: Environment variable not found: ${s.fromEnvVar}.`,n);if(i===void 0)throw new J("error: Missing URL environment variable, value, or override.",n);return i}f();c();p();d();m();f();c();p();d();m();var Nr=class extends Error{constructor(t,r){super(t),this.clientVersion=r.clientVersion,this.cause=r.cause}get[Symbol.toStringTag](){return this.name}};var ie=class extends Nr{constructor(t,r){super(t,r),this.isRetryable=r.isRetryable??!0}};f();c();p();d();m();f();c();p();d();m();function L(e,t){return{...e,isRetryable:t}}var mt=class extends ie{constructor(r){super("This request must be retried",L(r,!0));this.name="ForcedRetryError";this.code="P5001"}};N(mt,"ForcedRetryError");f();c();p();d();m();var Ve=class extends ie{constructor(r,n){super(r,L(n,!1));this.name="InvalidDatasourceError";this.code="P6001"}};N(Ve,"InvalidDatasourceError");f();c();p();d();m();var je=class extends ie{constructor(r,n){super(r,L(n,!1));this.name="NotImplementedYetError";this.code="P5004"}};N(je,"NotImplementedYetError");f();c();p();d();m();f();c();p();d();m();var j=class extends ie{constructor(t,r){super(t,r),this.response=r.response;let n=this.response.headers.get("prisma-request-id");if(n){let i=`(The request id was: ${n})`;this.message=this.message+" "+i}}};var Ge=class extends j{constructor(r){super("Schema needs to be uploaded",L(r,!0));this.name="SchemaMissingError";this.code="P5005"}};N(Ge,"SchemaMissingError");f();c();p();d();m();f();c();p();d();m();var On="This request could not be understood by the server",Ut=class extends j{constructor(r,n,i){super(n||On,L(r,!1));this.name="BadRequestError";this.code="P5000";i&&(this.code=i)}};N(Ut,"BadRequestError");f();c();p();d();m();var $t=class extends j{constructor(r,n){super("Engine not started: healthcheck timeout",L(r,!0));this.name="HealthcheckTimeoutError";this.code="P5013";this.logs=n}};N($t,"HealthcheckTimeoutError");f();c();p();d();m();var Vt=class extends j{constructor(r,n,i){super(n,L(r,!0));this.name="EngineStartupError";this.code="P5014";this.logs=i}};N(Vt,"EngineStartupError");f();c();p();d();m();var jt=class extends j{constructor(r){super("Engine version is not supported",L(r,!1));this.name="EngineVersionNotSupportedError";this.code="P5012"}};N(jt,"EngineVersionNotSupportedError");f();c();p();d();m();var kn="Request timed out",Gt=class extends j{constructor(r,n=kn){super(n,L(r,!1));this.name="GatewayTimeoutError";this.code="P5009"}};N(Gt,"GatewayTimeoutError");f();c();p();d();m();var Iu="Interactive transaction error",Jt=class extends j{constructor(r,n=Iu){super(n,L(r,!1));this.name="InteractiveTransactionError";this.code="P5015"}};N(Jt,"InteractiveTransactionError");f();c();p();d();m();var Ou="Request parameters are invalid",Qt=class extends j{constructor(r,n=Ou){super(n,L(r,!1));this.name="InvalidRequestError";this.code="P5011"}};N(Qt,"InvalidRequestError");f();c();p();d();m();var Dn="Requested resource does not exist",Ht=class extends j{constructor(r,n=Dn){super(n,L(r,!1));this.name="NotFoundError";this.code="P5003"}};N(Ht,"NotFoundError");f();c();p();d();m();var Mn="Unknown server error",ft=class extends j{constructor(r,n,i){super(n||Mn,L(r,!0));this.name="ServerError";this.code="P5006";this.logs=i}};N(ft,"ServerError");f();c();p();d();m();var Nn="Unauthorized, check your connection string",Wt=class extends j{constructor(r,n=Nn){super(n,L(r,!1));this.name="UnauthorizedError";this.code="P5007"}};N(Wt,"UnauthorizedError");f();c();p();d();m();var Fn="Usage exceeded, retry again later",Kt=class extends j{constructor(r,n=Fn){super(n,L(r,!0));this.name="UsageExceededError";this.code="P5008"}};N(Kt,"UsageExceededError");async function ku(e){let t;try{t=await e.text()}catch{return{type:"EmptyError"}}try{let r=JSON.parse(t);if(typeof r=="string")switch(r){case"InternalDataProxyError":return{type:"DataProxyError",body:r};default:return{type:"UnknownTextError",body:r}}if(typeof r=="object"&&r!==null){if("is_panic"in r&&"message"in r&&"error_code"in r)return{type:"QueryEngineErro
|
||
|
${r}`,L(n,!0));this.name="RequestError";this.code="P5010"}};N(Yt,"RequestError");async function Je(e,t,r=n=>n){let n=t.clientVersion;try{return typeof fetch=="function"?await r(fetch)(e,t):await r(_n)(e,t)}catch(i){let o=i.message??"Unknown error";throw new Yt(o,{clientVersion:n})}}function Nu(e){return{...e.headers,"Content-Type":"application/json"}}function Fu(e){return{method:e.method,headers:Nu(e)}}function _u(e,t){return{text:()=>Promise.resolve(w.Buffer.concat(e).toString()),json:()=>Promise.resolve().then(()=>JSON.parse(w.Buffer.concat(e).toString())),ok:t.statusCode>=200&&t.statusCode<=299,status:t.statusCode,url:t.url,headers:new Ln(t.headers)}}async function _n(e,t={}){let r=Lu("https"),n=Fu(t),i=[],{origin:o}=new URL(e);return new Promise((s,a)=>{let l=r.request(e,n,u=>{let{statusCode:g,headers:{location:h}}=u;g>=301&&g<=399&&h&&(h.startsWith("http")===!1?s(_n(`${o}${h}`,t)):s(_n(h,t))),u.on("data",v=>i.push(v)),u.on("end",()=>s(_u(i,u))),u.on("error",a)});l.on("error",a),l.end(t.body??"")})}var Lu=typeof Wr<"u"?Wr:()=>{},Ln=class{constructor(t={}){this.headers=new Map;for(let[r,n]of Object.entries(t))if(typeof n=="string")this.headers.set(r,n);else if(Array.isArray(n))for(let i of n)this.headers.set(r,i)}append(t,r){this.headers.set(t,r)}delete(t){this.headers.delete(t)}get(t){return this.headers.get(t)??null}has(t){return this.headers.has(t)}set(t,r){this.headers.set(t,r)}forEach(t,r){for(let[n,i]of this.headers)t.call(r,i,n,this)}};var qu=/^[1-9][0-9]*\.[0-9]+\.[0-9]+$/,rs=ee("prisma:client:dataproxyEngine");async function Bu(e,t){let r=ts["@prisma/engines-version"],n=t.clientVersion??"unknown";if(y.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION)return y.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION;if(e.includes("accelerate")&&n!=="0.0.0"&&n!=="in-memory")return n;let[i,o]=n?.split("-")??[];if(o===void 0&&qu.test(i))return i;if(o!==void 0||n==="0.0.0"||n==="in-memory"){if(e.startsWith("localhost")||e.startsWith("127.0.0.1"))return"0.0.0";let[s]=r.split("-")??[],[a,l,u]=s.split("."),g=Uu(`<=${a}.${l}.${u}`),h=await Je(g,{clientVersion:n});if(!h.ok)throw new Error(`Failed to fetch stable Prisma version, unpkg.com status ${h.status} ${h.statusText}, response body: ${await h.text()||"<empty body>"}`);let v=await h.text();rs("length of body fetched from unpkg.com",v.length);let S;try{S=JSON.parse(v)}catch(C){throw console.error("JSON.parse error: body fetched from unpkg.com: ",v),C}return S.version}throw new je("Only `major.minor.patch` versions are supported by Accelerate.",{clientVersion:n})}async function ns(e,t){let r=await Bu(e,t);return rs("version",r),r}function Uu(e){return encodeURI(`https://unpkg.com/prisma@${e}/package.json`)}var is=3,qn=ee("prisma:client:dataproxyEngine"),Bn=class{constructor({apiKey:t,tracingHelper:r,logLevel:n,logQueries:i,engineHash:o}){this.apiKey=t,this.tracingHelper=r,this.logLevel=n,this.logQueries=i,this.engineHash=o}build({traceparent:t,interactiveTransaction:r}={}){let n={Authorization:`Bearer ${this.apiKey}`,"Prisma-Engine-Hash":this.engineHash};this.tracingHelper.isEnabled()&&(n.traceparent=t??this.tracingHelper.getTraceParent()),r&&(n["X-transaction-id"]=r.id);let i=this.buildCaptureSettings();return i.length>0&&(n["X-capture-telemetry"]=i.join(", ")),n}buildCaptureSettings(){let t=[];return this.tracingHelper.isEnabled()&&t.push("tracing"),this.logLevel&&t.push(this.logLevel),this.logQueries&&t.push("query"),t}},Zt=class{constructor(t){this.name="DataProxyEngine";Xo(t),this.config=t,this.env={...t.env,...typeof y<"u"?y.env:{}},this.inlineSchema=Zo(t.inlineSchema),this.inlineDatasources=t.inlineDatasources,this.inlineSchemaHash=t.inlineSchemaHash,this.clientVersion=t.clientVersion,this.engineHash=t.engineVersion,this.logEmitter=t.logEmitter,this.tracingHelper=t.tracingHelper}apiKey(){return this.headerBuilder.apiKey}version(){return this.engineHash}async start(){this.startPromise!==void 0&&await this.startPromise,this.startPromise=(async()=>{let[t,r]=this.extractHostAndApiKey();this.host=t,this.headerBuilder=new Bn({apiKey:r,tracingHelper:this.tracingHelper,logLevel:this.co
|
||
|
`),{clientVersion:t.clientVersion})}if(i)return new Zt(t);throw new z("Invalid client engine type, please use `library` or `binary`",{clientVersion:t.clientVersion})}f();c();p();d();m();function Fr({generator:e}){return e?.previewFeatures??[]}f();c();p();d();m();f();c();p();d();m();function ht(e){return e.substring(0,1).toLowerCase()+e.substring(1)}f();c();p();d();m();f();c();p();d();m();var ps=_e(Un());f();c();p();d();m();function us(e,t,r){let n=cs(e),i=$u(n),o=ju(i);o?_r(o,t,r):t.addErrorMessage(()=>"Unknown error")}function cs(e){return e.errors.flatMap(t=>t.kind==="Union"?cs(t):[t])}function $u(e){let t=new Map,r=[];for(let n of e){if(n.kind!=="InvalidArgumentType"){r.push(n);continue}let i=`${n.selectionPath.join(".")}:${n.argumentPath.join(".")}`,o=t.get(i);o?t.set(i,{...n,argument:{...n.argument,typeNames:Vu(o.argument.typeNames,n.argument.typeNames)}}):t.set(i,n)}return r.push(...t.values()),r}function Vu(e,t){return[...new Set(e.concat(t))]}function ju(e){return un(e,(t,r)=>{let n=as(t),i=as(r);return n!==i?n-i:ls(t)-ls(r)})}function as(e){let t=0;return Array.isArray(e.selectionPath)&&(t+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(t+=e.argumentPath.length),t}function ls(e){switch(e.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}f();c();p();d();m();var le=class{constructor(t,r){this.name=t;this.value=r;this.isRequired=!1}makeRequired(){return this.isRequired=!0,this}write(t){let{colors:{green:r}}=t.context;t.addMarginSymbol(r(this.isRequired?"+":"?")),t.write(r(this.name)),this.isRequired||t.write(r("?")),t.write(r(": ")),typeof this.value=="string"?t.write(r(this.value)):t.write(this.value)}};f();c();p();d();m();var Xt=class{constructor(){this.fields=[]}addField(t,r){return this.fields.push({write(n){let{green:i,dim:o}=n.context.colors;n.write(i(o(`${t}: ${r}`))).addMarginSymbol(i(o("+")))}}),this}write(t){let{colors:{green:r}}=t.context;t.writeLine(r("{")).withIndent(()=>{t.writeJoined(st,this.fields).newLine()}).write(r("}")).addMarginSymbol(r("+"))}};function _r(e,t,r){switch(e.kind){case"MutuallyExclusiveFields":Gu(e,t);break;case"IncludeOnScalar":Ju(e,t);break;case"EmptySelection":Qu(e,t,r);break;case"UnknownSelectionField":zu(e,t);break;case"UnknownArgument":Yu(e,t);break;case"UnknownInputField":Zu(e,t);break;case"RequiredArgumentMissing":Xu(e,t);break;case"InvalidArgumentType":ec(e,t);break;case"InvalidArgumentValue":tc(e,t);break;case"ValueTooLarge":rc(e,t);break;case"SomeFieldsMissing":nc(e,t);break;case"TooManyFieldsGiven":ic(e,t);break;case"Union":us(e,t,r);break;default:throw new Error("not implemented: "+e.kind)}}function Gu(e,t){let r=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();r&&(r.getField(e.firstField)?.markAsError(),r.getField(e.secondField)?.markAsError()),t.addErrorMessage(n=>`Please ${n.bold("either")} use ${n.green(`\`${e.firstField}\``)} or ${n.green(`\`${e.secondField}\``)}, but ${n.red("not both")} at the same time.`)}function Ju(e,t){let[r,n]=er(e.selectionPath),i=e.outputType,o=t.arguments.getDeepSelectionParent(r)?.value;if(o&&(o.getField(n)?.markAsError(),i))for(let s of i.fields)s.isRelation&&o.addSuggestion(new le(s.name,"true"));t.addErrorMessage(s=>{let a=`Invalid scalar field ${s.red(`\`${n}\``)} for ${s.bold("include")} statement`;return i?a+=` on model ${s.bold(i.name)}. ${tr(s)}`:a+=".",a+=`
|
||
|
Note that ${s.bold("include")} statements only accept relation fields.`,a})}function Qu(e,t,r){let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getField("omit")?.value.asObject();if(i){Hu(e,t,i);return}if(n.hasField("select")){Wu(e,t);return}}if(r?.[ht(e.outputType.name)]){Ku(e,t);return}t.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function Hu(e,t,r){r.removeAllFields();for(let n of e.outputType.fields)r.addSuggestion(new le(n.name,"false"));t.addErrorMessage(n=>`The ${n.red("omit")} statement includes every field of the model ${n.bold(e.outputType.name)}. At least one field must be included in the result`)}function Wu(e,t){let r=e.outputType,n=t.arguments.getDeepSelectionParent(e.selectionPath)?.value,i=n?.isEmpty()??!1;n&&(n.removeAllFields(),fs(n,r)),t.addErrorMessage(o=>i?`The ${o.red("`select`")} statement for type ${o.bold(r.name)} must not be empty. ${tr(o)}`:`The ${o.red("`select`")} statement for type ${o.bold(r.name)} needs ${o.bold("at least one truthy value")}.`)}function Ku(e,t){let r=new Xt;for(let i of e.outputType.fields)i.isRelation||r.addField(i.name,"false");let n=new le("omit",r).makeRequired();if(e.selectionPath.length===0)t.arguments.addSuggestion(n);else{let[i,o]=er(e.selectionPath),a=t.arguments.getDeepSelectionParent(i)?.value.asObject()?.getField(o);if(a){let l=a?.value.asObject()??new lt;l.addSuggestion(n),a.value=l}}t.addErrorMessage(i=>`The global ${i.red("omit")} configuration excludes every field of the model ${i.bold(e.outputType.name)}. At least one field must be included in the result`)}function zu(e,t){let[r,n]=er(e.selectionPath),i=t.arguments.getDeepSubSelectionValue(r)?.asObject(),o;if(i){let s=i.getFieldValue("select")?.asObject(),a=i.getFieldValue("include")?.asObject(),l=i.getFieldValue("omit")?.asObject();s?.hasField(n)?(o="select",s.getField(n)?.markAsError(),fs(s,e.outputType)):a?.hasField(n)?(o="include",a.getField(n)?.markAsError(),oc(a,e.outputType)):l?.hasField(n)&&(o="omit",l.getField(n)?.markAsError(),sc(l,e.outputType))}t.addErrorMessage(s=>{let a=[`Unknown field ${s.red(`\`${n}\``)}`];return o&&a.push(`for ${s.bold(o)} statement`),a.push(`on model ${s.bold(`\`${e.outputType.name}\``)}.`),a.push(tr(s)),a.join(" ")})}function Yu(e,t){let r=e.argumentPath[0],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&(n.getField(r)?.markAsError(),ac(n,e.arguments)),t.addErrorMessage(i=>ds(i,r,e.arguments.map(o=>o.name)))}function Zu(e,t){let[r,n]=er(e.argumentPath),i=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(i){i.getDeepField(e.argumentPath)?.markAsError();let o=i.getDeepFieldValue(r)?.asObject();o&&gs(o,e.inputType)}t.addErrorMessage(o=>ds(o,n,e.inputType.fields.map(s=>s.name)))}function ds(e,t,r){let n=[`Unknown argument \`${e.red(t)}\`.`],i=uc(t,r);return i&&n.push(`Did you mean \`${e.green(i)}\`?`),r.length>0&&n.push(tr(e)),n.join(" ")}function Xu(e,t){let r;t.addErrorMessage(l=>r?.value instanceof W&&r.value.text==="null"?`Argument \`${l.green(o)}\` must not be ${l.red("null")}.`:`Argument \`${l.green(o)}\` is missing.`);let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(!n)return;let[i,o]=er(e.argumentPath),s=new Xt,a=n.getDeepFieldValue(i)?.asObject();if(a)if(r=a.getField(o),r&&a.removeField(o),e.inputTypes.length===1&&e.inputTypes[0].kind==="object"){for(let l of e.inputTypes[0].fields)s.addField(l.name,l.typeNames.join(" | "));a.addSuggestion(new le(o,s).makeRequired())}else{let l=e.inputTypes.map(ms).join(" | ");a.addSuggestion(new le(o,l).makeRequired())}}function ms(e){return e.kind==="list"?`${ms(e.elementType)}[]`:e.name}function ec(e,t){let r=e.argument.name,n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&n.getDeepFieldValue(e.argumentPath)?.markAsError(),t.addErrorMessage(i=>{let o=Lr("or",e.argument.typeNames.map(s=>i.green(s)));return`Argument \`${i.bold(r)}\`: Invalid value provided. Expected ${o}, provided ${i.red(e.inferredType)}.`})}function tc(e,t){let r=e.argument.name,n=t.arguments.getDeepS
|
||
|
Using the example below you can still execute your query with Prisma, but please note that it is vulnerable to SQL injection attacks and requires you to take care of input sanitization.
|
||
|
|
||
|
Example:
|
||
|
await prisma.$executeRawUnsafe(\`ALTER USER prisma WITH PASSWORD '\${password}'\`)
|
||
|
|
||
|
More Information: https://pris.ly/d/execute-raw
|
||
|
`)}var jn=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if(r instanceof Dt)n=r.sql,i={values:yt(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:yt(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:yt(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:yt(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=bs(r),i={values:yt(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?Cs(`prisma.${e}(${n}, ${i.values})`):Cs(`prisma.${e}(${n})`),{query:n,parameters:i}},Rs={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new ae(t,r)}},Ss={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};f();c();p();d();m();function Gn(e){return function(r){let n,i=(o=e)=>{try{return o===void 0||o?.kind==="itx"?n??=Is(r(o)):Is(r(o))}catch(s){return Promise.reject(s)}};return{then(o,s){return i().then(o,s)},catch(o){return i().catch(o)},finally(o){return i().finally(o)},requestTransaction(o){let s=i(o);return s.requestTransaction?s.requestTransaction(o):s},[Symbol.toStringTag]:"PrismaPromise"}}}function Is(e){return typeof e.then=="function"?e:Promise.resolve(e)}f();c();p();d();m();var Os={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},async createEngineSpan(){},getActiveContext(){},runInChildSpan(e,t){return t()}},Jn=class{isEnabled(){return this.getGlobalTracingHelper().isEnabled()}getTraceParent(t){return this.getGlobalTracingHelper().getTraceParent(t)}createEngineSpan(t){return this.getGlobalTracingHelper().createEngineSpan(t)}getActiveContext(){return this.getGlobalTracingHelper().getActiveContext()}runInChildSpan(t,r){return this.getGlobalTracingHelper().runInChildSpan(t,r)}getGlobalTracingHelper(){return globalThis.PRISMA_INSTRUMENTATION?.helper??Os}};function ks(e){return e.includes("tracing")?new Jn:Os}f();c();p();d();m();function Ds(e,t=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--e===0&&r(t()),i?.(n)}}}f();c();p();d();m();function Ms(e){return typeof e=="string"?e:e.reduce((t,r)=>{let n=typeof r=="string"?r:r.level;return n==="query"?t:t&&(r==="info"||t==="info")?"info":n},void 0)}f();c();p();d();m();var Br=class{constructor(){this._middlewares=[]}use(t){this._middlewares.push(t)}get(t){return this._middlewares[t]}has(t){return!!this._middlewares[t]}length(){return this._middlewares.length}};f();c();p();d();m();var _s=_e(Gi());f();c();p();d();m();function Ur(e){return typeof e.batchRequestIdx=="number"}f();c();p();d();m();function $r(e){return e===null?e:Array.isArray(e)?e.map($r):typeof e=="object"?Pc(e)?vc(e):Ze(e,$r):e}function Pc(e){return e!==null&&typeof e=="object"&&typeof e.$type=="string"}function vc({$type:e,value:t}){switch(e){case"BigInt":return BigInt(t);case"Bytes":return w.Buffer.from(t,"base64");case"DateTime":return new Date(t);case"Decimal":return new Pe(t);case"Json":return JSON.parse(t);default:Ee(t,"Unknown tagged value")}}f();c();p();d();m();function Ns(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(Qn(e.query.arguments)),t.push(Qn(e.query.selection)),t.join("")}function Qn(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${Qn(n)})`:r}).join(" ")})`}f();c();p();d();m();var Tc={aggregate:!1,aggregateRaw:!1,createMany:!0,createManyAndReturn:!0,createOne:!0,deleteMany:!0,deleteOne:!0,executeRaw:!0,findFirst:!1,findFirstOrThrow:!1,findMany:!1,findRaw:!1,findUnique:!1,findUniqueOrThrow:!1,groupBy:!1,queryRaw:!1,runCommandRaw:!0,updateMany:!0,updateOne:!0,upsertOne:!0};function Hn(e){return Tc[e]}f();c();p();d();m();var Vr=class{constructor(t){this.options=t;this.tickActive=!1;this.batches={}}request(t){let r=this.options.batchBy(t);return r?(this.batches[r]||(this.batches[r]=[],this.tickActive||(this.tickActive=!0
|
||
|
Read more at https://pris.ly/d/client-constructor`),this.name="PrismaClientConstructorValidationError"}get[Symbol.toStringTag](){return"PrismaClientConstructorValidationError"}};N(B,"PrismaClientConstructorValidationError");var $s=["datasources","datasourceUrl","errorFormat","adapter","log","transactionOptions","omit","__internal"],Vs=["pretty","colorless","minimal"],js=["info","query","warn","error"],kc={datasources:(e,{datasourceNames:t})=>{if(e){if(typeof e!="object"||Array.isArray(e))throw new B(`Invalid value ${JSON.stringify(e)} for "datasources" provided to PrismaClient constructor`);for(let[r,n]of Object.entries(e)){if(!t.includes(r)){let i=wt(r,t)||` Available datasources: ${t.join(", ")}`;throw new B(`Unknown datasource ${r} provided to PrismaClient constructor.${i}`)}if(typeof n!="object"||Array.isArray(n))throw new B(`Invalid value ${JSON.stringify(e)} for datasource "${r}" provided to PrismaClient constructor.
|
||
|
It should have this form: { url: "CONNECTION_STRING" }`);if(n&&typeof n=="object")for(let[i,o]of Object.entries(n)){if(i!=="url")throw new B(`Invalid value ${JSON.stringify(e)} for datasource "${r}" provided to PrismaClient constructor.
|
||
|
It should have this form: { url: "CONNECTION_STRING" }`);if(typeof o!="string")throw new B(`Invalid value ${JSON.stringify(o)} for datasource "${r}" provided to PrismaClient constructor.
|
||
|
It should have this form: { url: "CONNECTION_STRING" }`)}}}},adapter:(e,t)=>{if(e===null)return;if(e===void 0)throw new B('"adapter" property must not be undefined, use null to conditionally disable driver adapters.');if(!Fr(t).includes("driverAdapters"))throw new B('"adapter" property can only be provided to PrismaClient constructor when "driverAdapters" preview feature is enabled.');if(vt()==="binary")throw new B('Cannot use a driver adapter with the "binary" Query Engine. Please use the "library" Query Engine.')},datasourceUrl:e=>{if(typeof e<"u"&&typeof e!="string")throw new B(`Invalid value ${JSON.stringify(e)} for "datasourceUrl" provided to PrismaClient constructor.
|
||
|
Expected string or undefined.`)},errorFormat:e=>{if(e){if(typeof e!="string")throw new B(`Invalid value ${JSON.stringify(e)} for "errorFormat" provided to PrismaClient constructor.`);if(!Vs.includes(e)){let t=wt(e,Vs);throw new B(`Invalid errorFormat ${e} provided to PrismaClient constructor.${t}`)}}},log:e=>{if(!e)return;if(!Array.isArray(e))throw new B(`Invalid value ${JSON.stringify(e)} for "log" provided to PrismaClient constructor.`);function t(r){if(typeof r=="string"&&!js.includes(r)){let n=wt(r,js);throw new B(`Invalid log level "${r}" provided to PrismaClient constructor.${n}`)}}for(let r of e){t(r);let n={level:t,emit:i=>{let o=["stdout","event"];if(!o.includes(i)){let s=wt(i,o);throw new B(`Invalid value ${JSON.stringify(i)} for "emit" in logLevel provided to PrismaClient constructor.${s}`)}}};if(r&&typeof r=="object")for(let[i,o]of Object.entries(r))if(n[i])n[i](o);else throw new B(`Invalid property ${i} for "log" provided to PrismaClient constructor`)}},transactionOptions:e=>{if(!e)return;let t=e.maxWait;if(t!=null&&t<=0)throw new B(`Invalid value ${t} for maxWait in "transactionOptions" provided to PrismaClient constructor. maxWait needs to be greater than 0`);let r=e.timeout;if(r!=null&&r<=0)throw new B(`Invalid value ${r} for timeout in "transactionOptions" provided to PrismaClient constructor. timeout needs to be greater than 0`)},omit:(e,t)=>{if(typeof e!="object")throw new B('"omit" option is expected to be an object.');if(e===null)throw new B('"omit" option can not be `null`');let r=[];for(let[n,i]of Object.entries(e)){let o=Mc(n,t.runtimeDataModel);if(!o){r.push({kind:"UnknownModel",modelKey:n});continue}for(let[s,a]of Object.entries(i)){let l=o.fields.find(u=>u.name===s);if(!l){r.push({kind:"UnknownField",modelKey:n,fieldName:s});continue}if(l.relationName){r.push({kind:"RelationInOmit",modelKey:n,fieldName:s});continue}typeof a!="boolean"&&r.push({kind:"InvalidFieldValue",modelKey:n,fieldName:s})}}if(r.length>0)throw new B(Nc(e,r))},__internal:e=>{if(!e)return;let t=["debug","engine","configOverride"];if(typeof e!="object")throw new B(`Invalid value ${JSON.stringify(e)} for "__internal" to PrismaClient constructor`);for(let[r]of Object.entries(e))if(!t.includes(r)){let n=wt(r,t);throw new B(`Invalid property ${JSON.stringify(r)} for "__internal" provided to PrismaClient constructor.${n}`)}}};function Qs(e,t){for(let[r,n]of Object.entries(e)){if(!$s.includes(r)){let i=wt(r,$s);throw new B(`Unknown property ${r} provided to PrismaClient constructor.${i}`)}kc[r](n,t)}if(e.datasourceUrl&&e.datasources)throw new B('Can not use "datasourceUrl" and "datasources" options at the same time. Pick one of them')}function wt(e,t){if(t.length===0||typeof e!="string")return"";let r=Dc(e,t);return r?` Did you mean "${r}"?`:""}function Dc(e,t){if(t.length===0)return null;let r=t.map(i=>({value:i,distance:(0,Js.default)(e,i)}));r.sort((i,o)=>i.distance<o.distance?-1:1);let n=r[0];return n.distance<3?n.value:null}function Mc(e,t){return Gs(t.models,e)??Gs(t.types,e)}function Gs(e,t){let r=Object.keys(e).find(n=>ht(n)===t);if(r)return e[r]}function Nc(e,t){let r=ut(e);for(let o of t)switch(o.kind){case"UnknownModel":r.arguments.getField(o.modelKey)?.markAsError(),r.addErrorMessage(()=>`Unknown model name: ${o.modelKey}.`);break;case"UnknownField":r.arguments.getDeepField([o.modelKey,o.fieldName])?.markAsError(),r.addErrorMessage(()=>`Model "${o.modelKey}" does not have a field named "${o.fieldName}".`);break;case"RelationInOmit":r.arguments.getDeepField([o.modelKey,o.fieldName])?.markAsError(),r.addErrorMessage(()=>'Relations are already excluded by default and can not be specified in "omit".');break;case"InvalidFieldValue":r.arguments.getDeepFieldValue([o.modelKey,o.fieldName])?.markAsError(),r.addErrorMessage(()=>"Omit field option value must be a boolean.");break}let{message:n,args:i}=Ir(r,"colorless");return`Error validating "omit" option:
|
||
|
|
||
|
${i}
|
||
|
|
||
|
${n}`}f();c();p();d();m();function Hs(e){return e.length===0?Promise.resolve([]):new Promise((t,r)=>{let n=new Array(e.length),i=null,o=!1,s=0,a=()=>{o||(s++,s===e.length&&(o=!0,i?r(i):t(n)))},l=u=>{o||(o=!0,r(u))};for(let u=0;u<e.length;u++)e[u].then(g=>{n[u]=g,a()},g=>{if(!Ur(g)){l(g);return}g.batchRequestIdx===u?l(g):(i||(i=g),a())})})}var Ne=ee("prisma:client");typeof globalThis=="object"&&(globalThis.NODE_CLIENT=!0);var Fc={requestArgsToMiddlewareArgs:e=>e,middlewareArgsToRequestArgs:e=>e},_c=Symbol.for("prisma.client.transaction.id"),Lc={id:0,nextId(){return++this.id}};function qc(e){class t{constructor(n){this._originalClient=this;this._middlewares=new Br;this._createPrismaPromise=Gn();this.$extends=ko;e=n?.__internal?.configOverride?.(e)??e,Wo(e),n&&Qs(n,e);let i=new pr().on("error",()=>{});this._extensions=Mr.empty(),this._previewFeatures=Fr(e),this._clientVersion=e.clientVersion??Us,this._activeProvider=e.activeProvider,this._globalOmit=n?.omit,this._tracingHelper=ks(this._previewFeatures);let o={rootEnvPath:e.relativeEnvPaths.rootEnvPath&&Pt.resolve(e.dirname,e.relativeEnvPaths.rootEnvPath),schemaEnvPath:e.relativeEnvPaths.schemaEnvPath&&Pt.resolve(e.dirname,e.relativeEnvPaths.schemaEnvPath)},s;if(n?.adapter){s=hn(n.adapter);let l=e.activeProvider==="postgresql"?"postgres":e.activeProvider;if(s.provider!==l)throw new J(`The Driver Adapter \`${s.adapterName}\`, based on \`${s.provider}\`, is not compatible with the provider \`${l}\` specified in the Prisma schema.`,this._clientVersion);if(n.datasources||n.datasourceUrl!==void 0)throw new J("Custom datasource configuration is not compatible with Prisma Driver Adapters. Please define the database connection string directly in the Driver Adapter configuration.",this._clientVersion)}let a=e.injectableEdgeEnv?.();try{let l=n??{},u=l.__internal??{},g=u.debug===!0;g&&ee.enable("prisma:client");let h=Pt.resolve(e.dirname,e.relativePath);wi.existsSync(h)||(h=e.dirname),Ne("dirname",e.dirname),Ne("relativePath",e.relativePath),Ne("cwd",h);let v=u.engine||{};if(l.errorFormat?this._errorFormat=l.errorFormat:y.env.NODE_ENV==="production"?this._errorFormat="minimal":y.env.NO_COLOR?this._errorFormat="colorless":this._errorFormat="colorless",this._runtimeDataModel=e.runtimeDataModel,this._engineConfig={cwd:h,dirname:e.dirname,enableDebugLogs:g,allowTriggerPanic:v.allowTriggerPanic,datamodelPath:Pt.join(e.dirname,e.filename??"schema.prisma"),prismaPath:v.binaryPath??void 0,engineEndpoint:v.endpoint,generator:e.generator,showColors:this._errorFormat==="pretty",logLevel:l.log&&Ms(l.log),logQueries:l.log&&!!(typeof l.log=="string"?l.log==="query":l.log.find(S=>typeof S=="string"?S==="query":S.level==="query")),env:a?.parsed??{},flags:[],engineWasm:e.engineWasm,clientVersion:e.clientVersion,engineVersion:e.engineVersion,previewFeatures:this._previewFeatures,activeProvider:e.activeProvider,inlineSchema:e.inlineSchema,overrideDatasources:Ko(l,e.datasourceNames),inlineDatasources:e.inlineDatasources,inlineSchemaHash:e.inlineSchemaHash,tracingHelper:this._tracingHelper,transactionOptions:{maxWait:l.transactionOptions?.maxWait??2e3,timeout:l.transactionOptions?.timeout??5e3,isolationLevel:l.transactionOptions?.isolationLevel},logEmitter:i,isBundled:e.isBundled,adapter:s},this._accelerateEngineConfig={...this._engineConfig,accelerateUtils:{resolveDatasourceUrl:dt,getBatchRequestPayload:hr,prismaGraphQLToJSError:Lt,PrismaClientUnknownRequestError:se,PrismaClientInitializationError:J,PrismaClientKnownRequestError:K,debug:ee("prisma:client:accelerateEngine"),engineVersion:Ks.version,clientVersion:e.clientVersion}},Ne("clientVersion",e.clientVersion),this._engine=os(e,this._engineConfig),this._requestHandler=new jr(this,i),l.log)for(let S of l.log){let C=typeof S=="string"?S:S.emit==="stdout"?S.level:null;C&&this.$on(C,R=>{At.log(`${At.tags[C]??""}`,R.message||R.query)})}this._metrics=new Ct(this._engine)}catch(l){throw l.clientVersion=this._clientVersion,l}return this._appliedParent=qt(this)}get[Symbol.toStringTag](){return"PrismaClient"}$use(n){this._middlewares.use(n)}$on(n,i){n==="befor
|
||
|
`)),g?.kind==="batch"&&await g.lock,this._requestHandler.request({protocolQuery:R,modelName:l,action:a,clientMethod:i,dataPath:o,callsite:s,args:n,extensions:this._extensions,transaction:g,unpacker:h,otelParentCtx:v,otelChildCtx:this._tracingHelper.getActiveContext(),globalOmit:this._globalOmit,customDataProxyFetch:S})}catch(C){throw C.clientVersion=this._clientVersion,C}}get $metrics(){if(!this._hasPreviewFlag("metrics"))throw new z("`metrics` preview feature must be enabled in order to access metrics API",{clientVersion:this._clientVersion});return this._metrics}_hasPreviewFlag(n){return!!this._engineConfig.previewFeatures?.includes(n)}$applyPendingMigrations(){return this._engine.applyPendingMigrations()}}return t}function Ws(e,t){return Bc(e)?[new ae(e,t),Rs]:[e,Ss]}function Bc(e){return Array.isArray(e)&&Array.isArray(e.raw)}f();c();p();d();m();var Uc=new Set(["toJSON","$$typeof","asymmetricMatch",Symbol.iterator,Symbol.toStringTag,Symbol.isConcatSpreadable,Symbol.toPrimitive]);function $c(e){return new Proxy(e,{get(t,r){if(r in t)return t[r];if(!Uc.has(r))throw new TypeError(`Invalid enum value: ${String(r)}`)}})}f();c();p();d();m();var export_warnEnvConflicts=void 0;export{Di as Debug,Pe as Decimal,gi as Extensions,Ct as MetricsClient,Ce as NotFoundError,J as PrismaClientInitializationError,K as PrismaClientKnownRequestError,Re as PrismaClientRustPanicError,se as PrismaClientUnknownRequestError,z as PrismaClientValidationError,yi as Public,ae as Sql,Ha as defineDmmfProperty,el as empty,qc as getPrismaClient,In as getRuntime,Xa as join,$c as makeStrictEnum,Ka as makeTypedQueryFactory,dn as objectEnumValues,Ki as raw,zi as sqltag,export_warnEnvConflicts as warnEnvConflicts,dr as warnOnce};
|
||
|
//# sourceMappingURL=edge-esm.js.map
|