33 lines
119 KiB
JavaScript
33 lines
119 KiB
JavaScript
|
"use strict";var Ao=Object.create;var At=Object.defineProperty;var So=Object.getOwnPropertyDescriptor;var Oo=Object.getOwnPropertyNames;var ko=Object.getPrototypeOf,Mo=Object.prototype.hasOwnProperty;var se=(e,t)=>()=>(e&&(t=e(e=0)),t);var _e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),St=(e,t)=>{for(var r in t)At(e,r,{get:t[r],enumerable:!0})},Hr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Oo(t))!Mo.call(e,i)&&i!==r&&At(e,i,{get:()=>t[i],enumerable:!(n=So(t,i))||n.enumerable});return e};var De=(e,t,r)=>(r=e!=null?Ao(ko(e)):{},Hr(t||!e||!e.__esModule?At(r,"default",{value:e,enumerable:!0}):r,e)),Lo=e=>Hr(At({},"__esModule",{value:!0}),e);function mr(e,t){if(t=t.toLowerCase(),t==="utf8"||t==="utf-8")return new h(Fo.encode(e));if(t==="base64"||t==="base64url")return e=e.replace(/-/g,"+").replace(/_/g,"/"),e=e.replace(/[^A-Za-z0-9+/]/g,""),new h([...atob(e)].map(r=>r.charCodeAt(0)));if(t==="binary"||t==="ascii"||t==="latin1"||t==="latin-1")return new h([...e].map(r=>r.charCodeAt(0)));if(t==="ucs2"||t==="ucs-2"||t==="utf16le"||t==="utf-16le"){let r=new h(e.length*2),n=new DataView(r.buffer);for(let i=0;i<e.length;i++)n.setUint16(i*2,e.charCodeAt(i),!0);return r}if(t==="hex"){let r=new h(e.length/2);for(let n=0,i=0;i<e.length;i+=2,n++)r[n]=parseInt(e.slice(i,i+2),16);return r}Yr(`encoding "${t}"`)}function Io(e){let r=Object.getOwnPropertyNames(DataView.prototype).filter(a=>a.startsWith("get")||a.startsWith("set")),n=r.map(a=>a.replace("get","read").replace("set","write")),i=(a,u)=>function(y=0){return q(y,"offset"),Y(y,"offset"),V(y,"offset",this.length-1),new DataView(this.buffer)[r[a]](y,u)},o=(a,u)=>function(y,T=0){let C=r[a].match(/set(\w+\d+)/)[1].toLowerCase(),O=Do[C];return q(T,"offset"),Y(T,"offset"),V(T,"offset",this.length-1),_o(y,"value",O[0],O[1]),new DataView(this.buffer)[r[a]](T,y,u),T+parseInt(r[a].match(/\d+/)[0])/8},s=a=>{a.forEach(u=>{u.includes("Uint")&&(e[u.replace("Uint","UInt")]=e[u]),u.includes("Float64")&&(e[u.replace("Float64","Double")]=e[u]),u.includes("Float32")&&(e[u.replace("Float32","Float")]=e[u])})};n.forEach((a,u)=>{a.startsWith("read")&&(e[a]=i(u,!1),e[a+"LE"]=i(u,!0),e[a+"BE"]=i(u,!1)),a.startsWith("write")&&(e[a]=o(u,!1),e[a+"LE"]=o(u,!0),e[a+"BE"]=o(u,!1)),s([a,a+"LE",a+"BE"])})}function Yr(e){throw new Error(`Buffer polyfill does not implement "${e}"`)}function Ot(e,t){if(!(e instanceof Uint8Array))throw new TypeError(`The "${t}" argument must be an instance of Buffer or Uint8Array`)}function V(e,t,r=Bo+1){if(e<0||e>r){let n=new RangeError(`The value of "${t}" is out of range. It must be >= 0 && <= ${r}. Received ${e}`);throw n.code="ERR_OUT_OF_RANGE",n}}function q(e,t){if(typeof e!="number"){let r=new TypeError(`The "${t}" argument must be of type number. Received type ${typeof e}.`);throw r.code="ERR_INVALID_ARG_TYPE",r}}function Y(e,t){if(!Number.isInteger(e)||Number.isNaN(e)){let r=new RangeError(`The value of "${t}" is out of range. It must be an integer. Received ${e}`);throw r.code="ERR_OUT_OF_RANGE",r}}function _o(e,t,r,n){if(e<r||e>n){let i=new RangeError(`The value of "${t}" is out of range. It must be >= ${r} and <= ${n}. Received ${e}`);throw i.code="ERR_OUT_OF_RANGE",i}}function zr(e,t){if(typeof e!="string"){let r=new TypeError(`The "${t}" argument must be of type string. Received type ${typeof e}`);throw r.code="ERR_INVALID_ARG_TYPE",r}}function qo(e,t="utf8"){return h.from(e,t)}var h,Do,Fo,No,Uo,Bo,b,pr,c=se(()=>{"use strict";h=class e extends Uint8Array{constructor(){super(...arguments);this._isBuffer=!0}get offset(){return this.byteOffset}static alloc(r,n=0,i="utf8"){return zr(i,"encoding"),e.allocUnsafe(r).fill(n,i)}static allocUnsafe(r){return e.from(r)}static allocUnsafeSlow(r){return e.from(r)}static isBuffer(r){return r&&!!r._isBuffer}static byteLength(r,n="utf8"){if(typeof r=="string")return mr(r,n).byteLength;if(r&&r.byteLength)return r.byteLength;let i=new TypeError('The "string" argument must be of type string or an instance of Buffer or ArrayBuffer.');throw i.code="ERR_INVALID_ARG_TYPE",i}static isEncoding(r){return Uo
|
||
|
`)}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}};c();m();p();d();f();l();c();m();p();d();f();l();function Gn(e){return e.substring(0,1).toLowerCase()+e.substring(1)}c();m();p();d();f();l();function je(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function Vt(e){return e.toString()!=="Invalid Date"}c();m();p();d();f();l();l();function Qe(e){return v.isDecimal(e)?!0:e!==null&&typeof e=="object"&&typeof e.s=="number"&&typeof e.e=="number"&&typeof e.toFixed=="function"&&Array.isArray(e.d)}c();m();p();d();f();l();var ht=class{constructor(t,r,n,i,o){this.modelName=t,this.name=r,this.typeName=n,this.isList=i,this.isEnum=o}_toGraphQLInputType(){let t=this.isList?"List":"",r=this.isEnum?"Enum":"";return`${t}${r}${this.typeName}FieldRefInput<${this.modelName}>`}};function Je(e){return e instanceof ht}c();m();p();d();f();l();c();m();p();d();f();l();var jt=class{constructor(t){this.value=t}write(t){t.write(this.value)}markAsError(){this.value.markAsError()}};c();m();p();d();f();l();var Qt=e=>e,Jt={bold:Qt,red:Qt,green:Qt,dim:Qt,enabled:!1},Wn={bold:Lt,red:Ue,green:yn,dim:It,enabled:!0},Ge={write(e){e.writeLine(",")}};c();m();p();d();f();l();var pe=class{constructor(t){this.contents=t;this.isUnderlined=!1;this.color=t=>t}underline(){return this.isUnderlined=!0,this}setColor(t){return this.color=t,this}write(t){let r=t.getCurrentLineLength();t.write(this.color(this.contents)),this.isUnderlined&&t.afterNextNewline(()=>{t.write(" ".repeat(r)).writeLine(this.color("~".repeat(this.contents.length)))})}};c();m();p();d();f();l();var xe=class{constructor(){this.hasError=!1}markAsError(){return this.hasError=!0,this}};var We=class extends xe{constructor(){super(...arguments);this.items=[]}addItem(r){return this.items.push(new jt(r)),this}getField(r){return this.items[r]}getPrintWidth(){return this.items.length===0?2:Math.max(...this.items.map(n=>n.value.getPrintWidth()))+2}write(r){if(this.items.length===0){this.writeEmpty(r);return}this.writeWithItems(r)}writeEmpty(r){let n=new pe("[]");this.hasError&&n.setColor(r.context.colors.red).underline(),r.write(n)}writeWithItems(r){let{colors:n}=r.context;r.writeLine("[").withIndent(()=>r.writeJoined(Ge,this.items).newLine()).write("]"),this.hasError&&r.afterNextNewline(()=>{r.writeLine(n.red("~".repeat(this.getPrintWidth())))})}asObject(){}};c();m();p();d();f();l();var Kn=": ",Gt=class{constructor(t,r){this.name=t;this.value=r;this.hasError=!1}markAsError(){this.hasError=!0}getPrintWidth(){return this.name.length+this.value.getPrintWidth()+Kn.length}write(t){let r=new pe(this.name);this.hasError&&r.underline().setColor(t.context.colors.red),t.write(r).write(Kn).write(this.value)}};c();m();p();d();f();l();var Ke=class e extends xe{constructor(){super(...arguments);this.fields={};this.suggestions=[]}addField(r){this.fields[r.name]=r}addSuggestion(r){this.suggestions.push(r)}getField(r){return this.fields[r]}getDeepField(r){let[n,...i]=r,o=this.getField(n);if(!o)return;let s=o;for(let a of i){let u;if(s.value instanceof e?u=s.value.getField(a):s.value instanceof We&&(u=s.value.getField(Number(a))),!u)return;s=u}return s}getDeepFieldValue(r){return r.length===0?this:this.getDeepField(r)?.value}hasField(r){return!!this.getField(r)}removeAllFields(){this.fields={}}removeField(r){delete this.fields[r]}getFields(){return this.fields}isEmpty(){return Object.keys(this.fields).length===0}getFieldValue(r){return this.getField(r)?.value}getDeepSubSelectionValue(r){let n=this;for(let i of r){if(!(n instanceof e))return;let o=n.getSubSelectionValue(i);if(!o)return;n=o}return n}getDeepSelectionParent(r){let n=this.getSelectionParent();if(!n)return;let i=n;for(let o of r){let s=i.value.getFieldValue(o);if(!s||!(s instanceof e))return;let a=s.getSelectionParent();if(!a)return;i=a}return i}getSelectionParent(){let r=this.getField("select")?.value.asObject();if(r)return{kind:"select",value:r};let n=this.getField("includ
|
||
|
`)}};function He(e){return new _r(Hn(e))}function Hn(e){let t=new Ke;for(let[r,n]of Object.entries(e)){let i=new Gt(r,zn(n));t.addField(i)}return t}function zn(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(Qe(e))return new W(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return b.isBuffer(e)?new W(`Buffer.alloc(${e.byteLength})`):new W(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=Vt(e)?e.toISOString():"Invalid Date";return new W(`new Date("${t}")`)}return e instanceof we?new W(`Prisma.${e._getName()}`):Je(e)?new W(`prisma.${Gn(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?fs(e):typeof e=="object"?Hn(e):new W(Object.prototype.toString.call(e))}function fs(e){let t=new We;for(let r of e)t.addItem(zn(r));return t}function Wt(e,t){let r=t==="pretty"?Wn:Jt,n=e.renderAllMessages(r),i=new Ve(0,{colors:r}).write(e).toString();return{message:n,args:i}}function Yn(e){if(e===void 0)return"";let t=He(e);return new Ve(0,{colors:Jt}).write(t).toString()}c();m();p();d();f();l();var gs="P2037";function Kt({error:e,user_facing_error:t},r,n){return t.error_code?new J(hs(t,n),{code:t.error_code,clientVersion:r,meta:t.meta,batchRequestIdx:t.batch_request_idx}):new G(e,{clientVersion:r,batchRequestIdx:t.batch_request_idx})}function hs(e,t){let r=e.message;return(t==="postgresql"||t==="postgres"||t==="mysql")&&e.error_code===gs&&(r+=`
|
||
|
Prisma Accelerate has built-in connection pooling to prevent such errors: https://pris.ly/client/error-accelerate`),r}c();m();p();d();f();l();c();m();p();d();f();l();c();m();p();d();f();l();c();m();p();d();f();l();c();m();p();d();f();l();var Dr=class{getLocation(){return null}};function Pe(e){return typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new Dr}c();m();p();d();f();l();c();m();p();d();f();l();c();m();p();d();f();l();var Xn={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function ze(e={}){let t=bs(e);return Object.entries(t).reduce((n,[i,o])=>(Xn[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function bs(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function Ht(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function Zn(e,t){let r=Ht(e);return t({action:"aggregate",unpacker:r,argsMapper:ze})(e)}c();m();p();d();f();l();function ws(e={}){let{select:t,...r}=e;return typeof t=="object"?ze({...r,_count:t}):ze({...r,_count:{_all:!0}})}function Es(e={}){return typeof e.select=="object"?t=>Ht(e)(t)._count:t=>Ht(e)(t)._count._all}function ei(e,t){return t({action:"count",unpacker:Es(e),argsMapper:ws})(e)}c();m();p();d();f();l();function xs(e={}){let t=ze(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 Ps(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function ti(e,t){return t({action:"groupBy",unpacker:Ps(e),argsMapper:xs})(e)}function ri(e,t,r){if(t==="aggregate")return n=>Zn(n,r);if(t==="count")return n=>ei(n,r);if(t==="groupBy")return n=>ti(n,r)}c();m();p();d();f();l();function ni(e,t){let r=t.fields.filter(i=>!i.relationName),n=Tr(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 ht(e,o,s.type,s.isList,s.kind==="enum")},...qt(Object.keys(n))})}c();m();p();d();f();l();c();m();p();d();f();l();var ii=e=>Array.isArray(e)?e:e.split("."),Fr=(e,t)=>ii(t).reduce((r,n)=>r&&r[n],e),oi=(e,t,r)=>ii(t).reduceRight((n,i,o,s)=>Object.assign({},Fr(e,s.slice(0,o)),{[i]:n}),r);function vs(e,t){return e===void 0||t===void 0?[]:[...t,"select",e]}function Ts(e,t,r){return t===void 0?e??{}:oi(t,r,e||!0)}function Nr(e,t,r,n,i,o){let a=e._runtimeDataModel.models[t].fields.reduce((u,y)=>({...u,[y.name]:y}),{});return u=>{let y=Pe(e._errorFormat),T=vs(n,i),C=Ts(u,o,T),O=r({dataPath:T,callsite:y})(C),A=Cs(e,t);return new Proxy(O,{get(M,S){if(!A.includes(S))return M[S];let ne=[a[S].type,r,S],z=[T,C];return Nr(e,...ne,...z)},...qt([...A,...Object.getOwnPropertyNames(O)])})}}function Cs(e,t){return e._runtimeDataModel.models[t].fields.filter(r=>r.kind==="object").map(r=>r.name)}c();m();p();d();f();l();c();m();p();d();f();l();var Rs=De(kn());var As={red:Ue,gray:xn,dim:It,bold:Lt,underline:hn,highlightSource:e=>e.highlight()},Ss={red:e=>e,gray:e=>e,dim:e=>e,bold:e=>e,underline:e=>e,highlightSource:e=>e};function Os({message:e,originalMethod:t,isPanic:r,callArguments:n}){return{functionName:`prisma.${t}()`,message:e,isPanic:r??!1,callArguments:n}}function ks({functionName:e,location:t,message:r,isPanic:n,contextLines:i,callArguments:o},s){let a=[""],u=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${u}`))):a.push(s.red(`Invalid ${s.bold(`\`${e}\``)} invocation${u}`)),t&&a.push(s.underline(Ms(t))),i){a.push("");let y=[i.toString()];o&&(y.push(o),y.push(s.dim(")"))),a.push(y.join("")),o&&a.push("")}else a.push(""),o&&a.push(o),a.push("");return a.push(r),a.join(`
|
||
|
`)}function Ms(e){let t=[e.fileName];return e.lineNumber&&t.push(String(e.lineNumber)),e.columnNumber&&t.push(String(e.columnNumber)),t.join(":")}function Ye(e){let t=e.showColors?As:Ss,r;return typeof $getTemplateParameters<"u"?r=$getTemplateParameters(e,t):r=Os(e),ks(r,t)}function si(e,t,r,n){return e===Oe.ModelAction.findFirstOrThrow||e===Oe.ModelAction.findUniqueOrThrow?Ls(t,r,n):n}function Ls(e,t,r){return async n=>{if("rejectOnNotFound"in n.args){let o=Ye({originalMethod:n.clientMethod,callsite:n.callsite,message:"'rejectOnNotFound' option is not supported"});throw new j(o,{clientVersion:t})}return await r(n).catch(o=>{throw o instanceof J&&o.code==="P2025"?new ye(`No ${e} found`,t):o})}}c();m();p();d();f();l();function de(e){return e.replace(/^./,t=>t.toLowerCase())}var Is=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],_s=["aggregate","count","groupBy"];function Ur(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[Ds(e,t),Ns(e,t),gt(r),H("name",()=>t),H("$name",()=>t),H("$parent",()=>e._appliedParent)];return me({},n)}function Ds(e,t){let r=de(t),n=Object.keys(Oe.ModelAction).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=u=>e._request(u);s=si(o,t,e._clientVersion,s);let a=u=>y=>{let T=Pe(e._errorFormat);return e._createPrismaPromise(C=>{let O={args:y,dataPath:[],action:o,model:t,clientMethod:`${r}.${i}`,jsModelName:r,transaction:C,callsite:T};return s({...O,...u})})};return Is.includes(o)?Nr(e,t,a):Fs(i)?ri(e,i,a):a({})}}}function Fs(e){return _s.includes(e)}function Ns(e,t){return Me(H("fields",()=>{let r=e._runtimeDataModel.models[t];return ni(t,r)}))}c();m();p();d();f();l();function ai(e){return e.replace(/^./,t=>t.toUpperCase())}var Br=Symbol();function yt(e){let t=[Us(e),H(Br,()=>e),H("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push(gt(r)),me(e,t)}function Us(e){let t=Object.keys(e._runtimeDataModel.models),r=t.map(de),n=[...new Set(t.concat(r))];return Me({getKeys(){return n},getPropertyValue(i){let o=ai(i);if(e._runtimeDataModel.models[o]!==void 0)return Ur(e,o);if(e._runtimeDataModel.models[i]!==void 0)return Ur(e,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function li(e){return e[Br]?e[Br]:e}function ui(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 yt(t)}c();m();p();d();f();l();c();m();p();d();f();l();function ci({result:e,modelName:t,select:r,omit:n,extensions:i}){let o=i.getAllComputedFields(t);if(!o)return e;let s=[],a=[];for(let u of Object.values(o)){if(n){if(n[u.name])continue;let y=u.needs.filter(T=>n[T]);y.length>0&&a.push($e(y))}else if(r){if(!r[u.name])continue;let y=u.needs.filter(T=>!r[T]);y.length>0&&a.push($e(y))}Bs(e,u.needs)&&s.push(qs(u,me(e,s)))}return s.length>0||a.length>0?me(e,[...s,...a]):e}function Bs(e,t){return t.every(r=>vr(e,r))}function qs(e,t){return Me(H(e.name,()=>e.compute(t)))}c();m();p();d();f();l();function zt({visitor:e,result:t,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(t)){for(let s=0;s<t.length;s++)t[s]=zt({result:t[s],args:r,modelName:i,runtimeDataModel:n,visitor:e});return t}let o=e(t,i,r)??t;return r.include&&mi({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),r.select&&mi({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),o}function mi({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 u=n.models[r].fields.find(T=>T.name===o);if(!u||u.kind!=="object"||!u.relationName)continue;let y=typeof s=="object"?s:{};t[o]=zt({visitor:i,result:t[o],args:y,modelName:u.type,runtimeDataModel:n})}}function pi({result:e,modelName:t,ar
|
||
|
|
||
|
Learn how: https://pris.ly/d/${Ci[t]}-build`;throw console.error(n),new I(n,r)}}c();m();p();d();f();l();function Ai(e,t){return e?e.datasources?e.datasources:e.datasourceUrl?{[t[0]]:{url:e.datasourceUrl}}:{}:{}}c();m();p();d();f();l();c();m();p();d();f();l();c();m();p();d();f();l();var Qs="Cloudflare-Workers",Js="node";function Si(){return typeof Netlify=="object"?"netlify":typeof EdgeRuntime=="string"?"edge-light":globalThis.navigator?.userAgent===Qs?"workerd":globalThis.Deno?"deno":globalThis.__lagon__?"lagon":globalThis.process?.release?.name===Js?"node":globalThis.Bun?"bun":globalThis.fastly?"fastly":"unknown"}var Gs={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 ve(){let e=Si();return{id:e,prettyName:Gs[e]||e,isEdge:["workerd","deno","netlify","edge-light"].includes(e)}}c();m();p();d();f();l();c();m();p();d();f();l();function Zt({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 ve().id==="workerd"?new I(`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 I(`error: Environment variable not found: ${s.fromEnvVar}.`,n);if(i===void 0)throw new I("error: Missing URL environment variable, value, or override.",n);return i}c();m();p();d();f();l();c();m();p();d();f();l();function Oi(e){if(e?.kind==="itx")return e.options.id}c();m();p();d();f();l();var qr,ki={async loadLibrary(e){let{clientVersion:t,adapter:r,engineWasm:n}=e;if(r===void 0)throw new I(`The \`adapter\` option for \`PrismaClient\` is required in this context (${ve().prettyName})`,t);if(n===void 0)throw new I("WASM engine was unexpectedly `undefined`",t);qr===void 0&&(qr=(async()=>{let o=n.getRuntime(),s=await n.getQueryEngineWasmModule();if(s==null)throw new I("The loaded wasm module was unexpectedly `undefined` or `null` once loaded",t);let a={"./query_engine_bg.js":o},u=new WebAssembly.Instance(s,a);return o.__wbg_set_wasm(u.exports),o.QueryEngine})());let i=await qr;return{debugPanic(){return Promise.reject("{}")},dmmf(){return Promise.resolve("{}")},version(){return{commit:"unknown",version:"unknown"}},QueryEngine:i}}};var Ws="P2036",fe=ee("prisma:client:libraryEngine");function Ks(e){return e.item_type==="query"&&"query"in e}function Hs(e){return"level"in e?e.level==="error"&&e.message==="PANIC":!1}var kT=[...xr,"native"],wt=class{constructor(t,r){this.name="LibraryEngine";this.libraryLoader=r??ki,this.config=t,this.libraryStarted=!1,this.logQueries=t.logQueries??!1,this.logLevel=t.logLevel??"error",this.logEmitter=t.logEmitter,this.datamodel=t.inlineSchema,t.enableDebugLogs&&(this.logLevel="debug");let n=Object.keys(t.overrideDatasources)[0],i=t.overrideDatasources[n]?.url;n!==void 0&&i!==void 0&&(this.datasourceOverrides={[n]:i}),this.libraryInstantiationPromise=this.instantiateLibrary()}async applyPendingMigrations(){throw new Error("Cannot call this method from this type of engine instance")}async transaction(t,r,n){await this.start();let i=JSON.stringify(r),o;if(t==="start"){let a=JSON.stringify({max_wait:n.maxWait,timeout:n.timeout,isolation_level:n.isolationLevel});o=await this.engine?.startTransaction(a,i)}else t==="commit"?o=await this.engine?.commitTransaction(n.id,i):t==="rollback"&&(o=await this.engine?.rollbackTransaction(n.id,i));let s=this.parseEngineResponse(o);if(zs(s)){let a=this.getExternalAdapterError(s);throw a?a.error:new J(s.message,{code:s.error_code,clientVersion:this.config.clientVersion,meta:s.meta})}return s}async instantiateLibrary(){if(fe("internalSetup"),this.libraryInstantiationPromise)return this.libraryInstantiationPromise;this.binaryTarget=await this.getCurrentBinaryTarget(),await this.loadEngine(),this.version()}async getCurrentBinaryTarget(){}parseEngineResponse(t){if(!t)throw new G("Response from the Engine was empty",{clientVersion:this.config.clientVersion});try{return JSON.parse(t)}catch{throw new G("Unable to JSON.parse response from engine",{clientVersion:this.config.clientVersion})}}async loadEngine(){if(!this.engine){this.QueryEngineConstructor||(this.library=await this.libraryLoader.loadLibrary(this.config),this.QueryEngineConstructor=this.library.QueryEngine);try{let t=new w(this),{adapter:r}=this.config;r&&fe("Using driver adapter: %O",r),this.engine=new this.QueryEngineConstructor({datamodel:this.datamodel,env:g.env,logQueries:this.config.logQueries??!1,ignoreEnvVarErrors:!0,datasourceOverrides:this.datasourceOverrides??{},logLevel:this.logLevel,configDir:this.config.cwd,engineProtocol:"json"},n=>{t.deref()?.logger(n)},r)}catch(t){let r=t,n=this.parseInitError(r.message);throw typeof n=="string"?r:new I(n.message,this.config.clientVersion,n.error_code)}}}logger(t){let r=this.parseEngineResponse(t);if(r){if("span"in r){this.config.tracingHelper.createEngineSpan(r);return}r.level=r?.level.toLowerCase()??"unknown",Ks(r)?this.logEmitter.emit("query",{timestamp:new Date,query:r.query,params:r.params,duration:Number(r.duration_ms),target:r.module_path}):(Hs(r),this.logEmitter.emit(r.level,{timestamp:new Date,message:r.message,target:r.module_path}))}}parseInitErro
|
||
|
${a.backtrace}`,{clientVersion:this.config.clientVersion})}}async requestBatch(t,{transaction:r,traceparent:n}){fe("requestBatch");let i=$t(t,r);await this.start(),this.lastQuery=JSON.stringify(i),this.executingQueryPromise=this.engine.query(this.lastQuery,JSON.stringify({traceparent:n}),Oi(r));let o=await this.executingQueryPromise,s=this.parseEngineResponse(o);if(s.errors)throw s.errors.length===1?this.buildQueryError(s.errors[0]):new G(JSON.stringify(s.errors),{clientVersion:this.config.clientVersion});let{batchResult:a,errors:u}=s;if(Array.isArray(a))return a.map(y=>y.errors&&y.errors.length>0?this.loggerRustPanic??this.buildQueryError(y.errors[0]):{data:y,elapsed:0});throw u&&u.length===1?new Error(u[0].error):new Error(JSON.stringify(s))}buildQueryError(t){t.user_facing_error.is_panic;let r=this.getExternalAdapterError(t.user_facing_error);return r?r.error:Kt(t,this.config.clientVersion,this.config.activeProvider)}getExternalAdapterError(t){if(t.error_code===Ws&&this.config.adapter){let r=t.meta?.id;Ft(typeof r=="number","Malformed external JS error received from the engine");let n=this.config.adapter.errorRegistry.consumeError(r);return Ft(n,"External error with reported id was not registered"),n}}async metrics(t){await this.start();let r=await this.engine.metrics(JSON.stringify(t));return t.format==="prometheus"?r:this.parseEngineResponse(r)}};function zs(e){return typeof e=="object"&&e!==null&&e.error_code!==void 0}c();m();p();d();f();l();var Et="Accelerate has not been setup correctly. Make sure your client is using `.$extends(withAccelerate())`. See https://pris.ly/d/accelerate-getting-started",er=class{constructor(t){this.config=t;this.name="AccelerateEngine";this.resolveDatasourceUrl=this.config.accelerateUtils?.resolveDatasourceUrl;this.getBatchRequestPayload=this.config.accelerateUtils?.getBatchRequestPayload;this.prismaGraphQLToJSError=this.config.accelerateUtils?.prismaGraphQLToJSError;this.PrismaClientUnknownRequestError=this.config.accelerateUtils?.PrismaClientUnknownRequestError;this.PrismaClientInitializationError=this.config.accelerateUtils?.PrismaClientInitializationError;this.PrismaClientKnownRequestError=this.config.accelerateUtils?.PrismaClientKnownRequestError;this.debug=this.config.accelerateUtils?.debug;this.engineVersion=this.config.accelerateUtils?.engineVersion;this.clientVersion=this.config.accelerateUtils?.clientVersion}onBeforeExit(t){}async start(){}async stop(){}version(t){return"unknown"}transaction(t,r,n){throw new I(Et,this.config.clientVersion)}metrics(t){throw new I(Et,this.config.clientVersion)}request(t,r){throw new I(Et,this.config.clientVersion)}requestBatch(t,r){throw new I(Et,this.config.clientVersion)}applyPendingMigrations(){throw new I(Et,this.config.clientVersion)}};function Mi({copyEngine:e=!0},t){let r;try{r=Zt({inlineDatasources:t.inlineDatasources,overrideDatasources:t.overrideDatasources,env:{...t.env,...g.env},clientVersion:t.clientVersion})}catch{}e&&r?.startsWith("prisma://")&&at("recommend--no-engine","In production, we recommend using `prisma generate --no-engine` (See: `prisma generate --help`)");let n=it(t.generator),i=!!(r?.startsWith("prisma://")||!e),o=!!t.adapter,s=n==="library",a=n==="binary";if(i&&o||o&&!1){let u;throw e?r?.startsWith("prisma://")?u=["Prisma Client was configured to use the `adapter` option but the URL was a `prisma://` URL.","Please either use the `prisma://` URL or remove the `adapter` from the Prisma Client constructor."]:u=["Prisma Client was configured to use both the `adapter` and Accelerate, please chose one."]:u=["Prisma Client was configured to use the `adapter` option but `prisma generate` was run with `--no-engine`.","Please run `prisma generate` without `--no-engine` to be able to use Prisma Client with the adapter."],new j(u.join(`
|
||
|
`),{clientVersion:t.clientVersion})}if(o)return new wt(t);if(i)return new er(t);{let u=[`PrismaClient failed to initialize because it wasn't configured to run in this environment (${ve().prettyName}).`,"In order to run Prisma Client in an edge runtime, you will need to configure one of the following options:","- Enable Driver Adapters: https://pris.ly/d/driver-adapters","- Enable Accelerate: https://pris.ly/d/accelerate"];throw new j(u.join(`
|
||
|
`),{clientVersion:t.clientVersion})}throw new j("Invalid client engine type, please use `library` or `binary`",{clientVersion:t.clientVersion})}c();m();p();d();f();l();function tr({generator:e}){return e?.previewFeatures??[]}c();m();p();d();f();l();c();m();p();d();f();l();function Xe(e){return e.substring(0,1).toLowerCase()+e.substring(1)}c();m();p();d();f();l();c();m();p();d();f();l();var Ni=De($r());c();m();p();d();f();l();function Di(e,t,r){let n=Fi(e),i=Ys(n),o=Zs(i);o?rr(o,t,r):t.addErrorMessage(()=>"Unknown error")}function Fi(e){return e.errors.flatMap(t=>t.kind==="Union"?Fi(t):[t])}function Ys(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:Xs(o.argument.typeNames,n.argument.typeNames)}}):t.set(i,n)}return r.push(...t.values()),r}function Xs(e,t){return[...new Set(e.concat(t))]}function Zs(e){return Cr(e,(t,r)=>{let n=Ii(t),i=Ii(r);return n!==i?n-i:_i(t)-_i(r)})}function Ii(e){let t=0;return Array.isArray(e.selectionPath)&&(t+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(t+=e.argumentPath.length),t}function _i(e){switch(e.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}c();m();p();d();f();l();var te=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)}};c();m();p();d();f();l();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(Ge,this.fields).newLine()}).write(r("}")).addMarginSymbol(r("+"))}};function rr(e,t,r){switch(e.kind){case"MutuallyExclusiveFields":ea(e,t);break;case"IncludeOnScalar":ta(e,t);break;case"EmptySelection":ra(e,t,r);break;case"UnknownSelectionField":sa(e,t);break;case"UnknownArgument":aa(e,t);break;case"UnknownInputField":la(e,t);break;case"RequiredArgumentMissing":ua(e,t);break;case"InvalidArgumentType":ca(e,t);break;case"InvalidArgumentValue":ma(e,t);break;case"ValueTooLarge":pa(e,t);break;case"SomeFieldsMissing":da(e,t);break;case"TooManyFieldsGiven":fa(e,t);break;case"Union":Di(e,t,r);break;default:throw new Error("not implemented: "+e.kind)}}function ea(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 ta(e,t){let[r,n]=Pt(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 te(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)}. ${vt(s)}`:a+=".",a+=`
|
||
|
Note that ${s.bold("include")} statements only accept relation fields.`,a})}function ra(e,t,r){let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getField("omit")?.value.asObject();if(i){na(e,t,i);return}if(n.hasField("select")){ia(e,t);return}}if(r?.[Xe(e.outputType.name)]){oa(e,t);return}t.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function na(e,t,r){r.removeAllFields();for(let n of e.outputType.fields)r.addSuggestion(new te(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 ia(e,t){let r=e.outputType,n=t.arguments.getDeepSelectionParent(e.selectionPath)?.value,i=n?.isEmpty()??!1;n&&(n.removeAllFields(),qi(n,r)),t.addErrorMessage(o=>i?`The ${o.red("`select`")} statement for type ${o.bold(r.name)} must not be empty. ${vt(o)}`:`The ${o.red("`select`")} statement for type ${o.bold(r.name)} needs ${o.bold("at least one truthy value")}.`)}function oa(e,t){let r=new xt;for(let i of e.outputType.fields)i.isRelation||r.addField(i.name,"false");let n=new te("omit",r).makeRequired();if(e.selectionPath.length===0)t.arguments.addSuggestion(n);else{let[i,o]=Pt(e.selectionPath),a=t.arguments.getDeepSelectionParent(i)?.value.asObject()?.getField(o);if(a){let u=a?.value.asObject()??new Ke;u.addSuggestion(n),a.value=u}}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 sa(e,t){let[r,n]=Pt(e.selectionPath),i=t.arguments.getDeepSubSelectionValue(r)?.asObject(),o;if(i){let s=i.getFieldValue("select")?.asObject(),a=i.getFieldValue("include")?.asObject(),u=i.getFieldValue("omit")?.asObject();s?.hasField(n)?(o="select",s.getField(n)?.markAsError(),qi(s,e.outputType)):a?.hasField(n)?(o="include",a.getField(n)?.markAsError(),ga(a,e.outputType)):u?.hasField(n)&&(o="omit",u.getField(n)?.markAsError(),ha(u,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(vt(s)),a.join(" ")})}function aa(e,t){let r=e.argumentPath[0],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&(n.getField(r)?.markAsError(),ya(n,e.arguments)),t.addErrorMessage(i=>Ui(i,r,e.arguments.map(o=>o.name)))}function la(e,t){let[r,n]=Pt(e.argumentPath),i=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(i){i.getDeepField(e.argumentPath)?.markAsError();let o=i.getDeepFieldValue(r)?.asObject();o&&$i(o,e.inputType)}t.addErrorMessage(o=>Ui(o,n,e.inputType.fields.map(s=>s.name)))}function Ui(e,t,r){let n=[`Unknown argument \`${e.red(t)}\`.`],i=wa(t,r);return i&&n.push(`Did you mean \`${e.green(i)}\`?`),r.length>0&&n.push(vt(e)),n.join(" ")}function ua(e,t){let r;t.addErrorMessage(u=>r?.value instanceof W&&r.value.text==="null"?`Argument \`${u.green(o)}\` must not be ${u.red("null")}.`:`Argument \`${u.green(o)}\` is missing.`);let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(!n)return;let[i,o]=Pt(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 u of e.inputTypes[0].fields)s.addField(u.name,u.typeNames.join(" | "));a.addSuggestion(new te(o,s).makeRequired())}else{let u=e.inputTypes.map(Bi).join(" | ");a.addSuggestion(new te(o,u).makeRequired())}}function Bi(e){return e.kind==="list"?`${Bi(e.elementType)}[]`:e.name}function ca(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=nr("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 ma(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 Qr=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if(r instanceof dt)n=r.sql,i={values:Ze(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:Ze(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:Ze(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:Ze(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=Gi(r),i={values:Ze(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?Xi(`prisma.${e}(${n}, ${i.values})`):Xi(`prisma.${e}(${n})`),{query:n,parameters:i}},Zi={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new X(t,r)}},eo={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};c();m();p();d();f();l();function Jr(e){return function(r){let n,i=(o=e)=>{try{return o===void 0||o?.kind==="itx"?n??=to(r(o)):to(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 to(e){return typeof e.then=="function"?e:Promise.resolve(e)}c();m();p();d();f();l();var ro={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},async createEngineSpan(){},getActiveContext(){},runInChildSpan(e,t){return t()}},Gr=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??ro}};function no(e){return e.includes("tracing")?new Gr:ro}c();m();p();d();f();l();function io(e,t=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--e===0&&r(t()),i?.(n)}}}c();m();p();d();f();l();function oo(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)}c();m();p();d();f();l();var or=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}};c();m();p();d();f();l();var lo=De(Dn());c();m();p();d();f();l();function sr(e){return typeof e.batchRequestIdx=="number"}c();m();p();d();f();l();l();function ar(e){return e===null?e:Array.isArray(e)?e.map(ar):typeof e=="object"?La(e)?Ia(e):Be(e,ar):e}function La(e){return e!==null&&typeof e=="object"&&typeof e.$type=="string"}function Ia({$type:e,value:t}){switch(e){case"BigInt":return BigInt(t);case"Bytes":return b.from(t,"base64");case"DateTime":return new Date(t);case"Decimal":return new ue(t);case"Json":return JSON.parse(t);default:he(t,"Unknown tagged value")}}c();m();p();d();f();l();function so(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(Wr(e.query.arguments)),t.push(Wr(e.query.selection)),t.join("")}function Wr(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${Wr(n)})`:r}).join(" ")})`}c();m();p();d();f();l();var _a={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 Kr(e){return _a[e]}c();m();p();d();f();l();var lr=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]
|
||
|
Read more at https://pris.ly/d/client-constructor`),this.name="PrismaClientConstructorValidationError"}get[Symbol.toStringTag](){return"PrismaClientConstructorValidationError"}};K(_,"PrismaClientConstructorValidationError");var fo=["datasources","datasourceUrl","errorFormat","adapter","log","transactionOptions","omit","__internal"],go=["pretty","colorless","minimal"],ho=["info","query","warn","error"],$a={datasources:(e,{datasourceNames:t})=>{if(e){if(typeof e!="object"||Array.isArray(e))throw new _(`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=et(r,t)||` Available datasources: ${t.join(", ")}`;throw new _(`Unknown datasource ${r} provided to PrismaClient constructor.${i}`)}if(typeof n!="object"||Array.isArray(n))throw new _(`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 _(`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 _(`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 _('"adapter" property must not be undefined, use null to conditionally disable driver adapters.');if(!tr(t).includes("driverAdapters"))throw new _('"adapter" property can only be provided to PrismaClient constructor when "driverAdapters" preview feature is enabled.');if(it()==="binary")throw new _('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 _(`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 _(`Invalid value ${JSON.stringify(e)} for "errorFormat" provided to PrismaClient constructor.`);if(!go.includes(e)){let t=et(e,go);throw new _(`Invalid errorFormat ${e} provided to PrismaClient constructor.${t}`)}}},log:e=>{if(!e)return;if(!Array.isArray(e))throw new _(`Invalid value ${JSON.stringify(e)} for "log" provided to PrismaClient constructor.`);function t(r){if(typeof r=="string"&&!ho.includes(r)){let n=et(r,ho);throw new _(`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=et(i,o);throw new _(`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 _(`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 _(`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 _(`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 _('"omit" option is expected to be an object.');if(e===null)throw new _('"omit" option can not be `null`');let r=[];for(let[n,i]of Object.entries(e)){let o=ja(n,t.runtimeDataModel);if(!o){r.push({kind:"UnknownModel",modelKey:n});continue}for(let[s,a]of Object.entries(i)){let u=o.fields.find(y=>y.name===s);if(!u){r.push({kind:"UnknownField",modelKey:n,fieldName:s});continue}if(u.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 _(Qa(e,r))},__internal:e=>{if(!e)return;let t=["debug","engine","configOverride"];if(typeof e!="object")throw new _(`Invalid value ${JSON.stringify(e)} for "__internal" to PrismaClient constructor`);for(let[r]of Object.entries(e))if(!t.includes(r)){let n=et(r,t);throw new _(`Invalid property ${JSON.stringify(r)} for "__internal" provided to PrismaClient constructor.${n}`)}}};function wo(e,t){for(let[r,n]of Object.entries(e)){if(!fo.includes(r)){let i=et(r,fo);throw new _(`Unknown property ${r} provided to PrismaClient constructor.${i}`)}$a[r](n,t)}if(e.datasourceUrl&&e.datasources)throw new _('Can not use "datasourceUrl" and "datasources" options at the same time. Pick one of them')}function et(e,t){if(t.length===0||typeof e!="string")return"";let r=Va(e,t);return r?` Did you mean "${r}"?`:""}function Va(e,t){if(t.length===0)return null;let r=t.map(i=>({value:i,distance:(0,bo.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 ja(e,t){return yo(t.models,e)??yo(t.types,e)}function yo(e,t){let r=Object.keys(e).find(n=>Xe(n)===t);if(r)return e[r]}function Qa(e,t){let r=He(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}=Wt(r,"colorless");return`Error validating "omit" option:
|
||
|
|
||
|
${i}
|
||
|
|
||
|
${n}`}c();m();p();d();f();l();function Eo(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)))},u=y=>{o||(o=!0,r(y))};for(let y=0;y<e.length;y++)e[y].then(T=>{n[y]=T,a()},T=>{if(!sr(T)){u(T);return}T.batchRequestIdx===y?u(T):(i||(i=T),a())})})}var Te=ee("prisma:client");typeof globalThis=="object"&&(globalThis.NODE_CLIENT=!0);var Ja={requestArgsToMiddlewareArgs:e=>e,middlewareArgsToRequestArgs:e=>e},Ga=Symbol.for("prisma.client.transaction.id"),Wa={id:0,nextId(){return++this.id}};function vo(e){class t{constructor(n){this._originalClient=this;this._middlewares=new or;this._createPrismaPromise=Jr();this.$extends=ui;e=n?.__internal?.configOverride?.(e)??e,Ri(e),n&&wo(n,e);let i=new Dt().on("error",()=>{});this._extensions=Xt.empty(),this._previewFeatures=tr(e),this._clientVersion=e.clientVersion??po,this._activeProvider=e.activeProvider,this._globalOmit=n?.omit,this._tracingHelper=no(this._previewFeatures);let o={rootEnvPath:e.relativeEnvPaths.rootEnvPath&&nt.resolve(e.dirname,e.relativeEnvPaths.rootEnvPath),schemaEnvPath:e.relativeEnvPaths.schemaEnvPath&&nt.resolve(e.dirname,e.relativeEnvPaths.schemaEnvPath)},s;if(n?.adapter){s=Mr(n.adapter);let u=e.activeProvider==="postgresql"?"postgres":e.activeProvider;if(s.provider!==u)throw new I(`The Driver Adapter \`${s.adapterName}\`, based on \`${s.provider}\`, is not compatible with the provider \`${u}\` specified in the Prisma schema.`,this._clientVersion);if(n.datasources||n.datasourceUrl!==void 0)throw new I("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 u=n??{},y=u.__internal??{},T=y.debug===!0;T&&ee.enable("prisma:client");let C=nt.resolve(e.dirname,e.relativePath);cn.existsSync(C)||(C=e.dirname),Te("dirname",e.dirname),Te("relativePath",e.relativePath),Te("cwd",C);let O=y.engine||{};if(u.errorFormat?this._errorFormat=u.errorFormat:g.env.NODE_ENV==="production"?this._errorFormat="minimal":g.env.NO_COLOR?this._errorFormat="colorless":this._errorFormat="colorless",this._runtimeDataModel=e.runtimeDataModel,this._engineConfig={cwd:C,dirname:e.dirname,enableDebugLogs:T,allowTriggerPanic:O.allowTriggerPanic,datamodelPath:nt.join(e.dirname,e.filename??"schema.prisma"),prismaPath:O.binaryPath??void 0,engineEndpoint:O.endpoint,generator:e.generator,showColors:this._errorFormat==="pretty",logLevel:u.log&&oo(u.log),logQueries:u.log&&!!(typeof u.log=="string"?u.log==="query":u.log.find(A=>typeof A=="string"?A==="query":A.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:Ai(u,e.datasourceNames),inlineDatasources:e.inlineDatasources,inlineSchemaHash:e.inlineSchemaHash,tracingHelper:this._tracingHelper,transactionOptions:{maxWait:u.transactionOptions?.maxWait??2e3,timeout:u.transactionOptions?.timeout??5e3,isolationLevel:u.transactionOptions?.isolationLevel},logEmitter:i,isBundled:e.isBundled,adapter:s},this._accelerateEngineConfig={...this._engineConfig,accelerateUtils:{resolveDatasourceUrl:Zt,getBatchRequestPayload:$t,prismaGraphQLToJSError:Kt,PrismaClientUnknownRequestError:G,PrismaClientInitializationError:I,PrismaClientKnownRequestError:J,debug:ee("prisma:client:accelerateEngine"),engineVersion:Po.version,clientVersion:e.clientVersion}},Te("clientVersion",e.clientVersion),this._engine=Mi(e,this._engineConfig),this._requestHandler=new ur(this,i),u.log)for(let A of u.log){let M=typeof A=="string"?A:A.emit==="stdout"?A.level:null;M&&this.$on(M,S=>{st.log(`${st.tags[M]??""}`,S.message||S.query)})}this._metrics=new qe(this._engine)}catch(u){throw u.clientVersion=this._clientVersion,u}return this._appliedParent=yt(this)}get[Symbol.toStringTag](){return"PrismaClient"}$use(n){this._middlewares.use(n)}$on(n,i){n==="be
|
||
|
`)),T?.kind==="batch"&&await T.lock,this._requestHandler.request({protocolQuery:S,modelName:u,action:a,clientMethod:i,dataPath:o,callsite:s,args:n,extensions:this._extensions,transaction:T,unpacker:C,otelParentCtx:O,otelChildCtx:this._tracingHelper.getActiveContext(),globalOmit:this._globalOmit,customDataProxyFetch:A})}catch(M){throw M.clientVersion=this._clientVersion,M}}get $metrics(){if(!this._hasPreviewFlag("metrics"))throw new j("`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 xo(e,t){return Ka(e)?[new X(e,t),Zi]:[e,eo]}function Ka(e){return Array.isArray(e)&&Array.isArray(e.raw)}c();m();p();d();f();l();var Ha=new Set(["toJSON","$$typeof","asymmetricMatch",Symbol.iterator,Symbol.toStringTag,Symbol.isConcatSpreadable,Symbol.toPrimitive]);function To(e){return new Proxy(e,{get(t,r){if(r in t)return t[r];if(!Ha.has(r))throw new TypeError(`Invalid enum value: ${String(r)}`)}})}c();m();p();d();f();l();l();0&&(module.exports={Debug,Decimal,Extensions,MetricsClient,NotFoundError,PrismaClientInitializationError,PrismaClientKnownRequestError,PrismaClientRustPanicError,PrismaClientUnknownRequestError,PrismaClientValidationError,Public,Sql,defineDmmfProperty,empty,getPrismaClient,getRuntime,join,makeStrictEnum,makeTypedQueryFactory,objectEnumValues,raw,sqltag,warnEnvConflicts,warnOnce});
|
||
|
//# sourceMappingURL=wasm.js.map
|