144 lines
185 KiB
JavaScript
144 lines
185 KiB
JavaScript
|
"use strict";var Ul=Object.create;var _r=Object.defineProperty;var Gl=Object.getOwnPropertyDescriptor;var Ql=Object.getOwnPropertyNames;var Jl=Object.getPrototypeOf,Wl=Object.prototype.hasOwnProperty;var Z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),jt=(e,t)=>{for(var r in t)_r(e,r,{get:t[r],enumerable:!0})},lo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ql(t))!Wl.call(e,i)&&i!==r&&_r(e,i,{get:()=>t[i],enumerable:!(n=Gl(t,i))||n.enumerable});return e};var k=(e,t,r)=>(r=e!=null?Ul(Jl(e)):{},lo(t||!e||!e.__esModule?_r(r,"default",{value:e,enumerable:!0}):r,e)),Hl=e=>lo(_r({},"__esModule",{value:!0}),e);var _o=Z((Ym,Hn)=>{"use strict";var v=Hn.exports;Hn.exports.default=v;var D="\x1B[",Qt="\x1B]",mt="\x07",Ur=";",Do=process.env.TERM_PROGRAM==="Apple_Terminal";v.cursorTo=(e,t)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");return typeof t!="number"?D+(e+1)+"G":D+(t+1)+";"+(e+1)+"H"};v.cursorMove=(e,t)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");let r="";return e<0?r+=D+-e+"D":e>0&&(r+=D+e+"C"),t<0?r+=D+-t+"A":t>0&&(r+=D+t+"B"),r};v.cursorUp=(e=1)=>D+e+"A";v.cursorDown=(e=1)=>D+e+"B";v.cursorForward=(e=1)=>D+e+"C";v.cursorBackward=(e=1)=>D+e+"D";v.cursorLeft=D+"G";v.cursorSavePosition=Do?"\x1B7":D+"s";v.cursorRestorePosition=Do?"\x1B8":D+"u";v.cursorGetPosition=D+"6n";v.cursorNextLine=D+"E";v.cursorPrevLine=D+"F";v.cursorHide=D+"?25l";v.cursorShow=D+"?25h";v.eraseLines=e=>{let t="";for(let r=0;r<e;r++)t+=v.eraseLine+(r<e-1?v.cursorUp():"");return e&&(t+=v.cursorLeft),t};v.eraseEndLine=D+"K";v.eraseStartLine=D+"1K";v.eraseLine=D+"2K";v.eraseDown=D+"J";v.eraseUp=D+"1J";v.eraseScreen=D+"2J";v.scrollUp=D+"S";v.scrollDown=D+"T";v.clearScreen="\x1Bc";v.clearTerminal=process.platform==="win32"?`${v.eraseScreen}${D}0f`:`${v.eraseScreen}${D}3J${D}H`;v.beep=mt;v.link=(e,t)=>[Qt,"8",Ur,Ur,t,mt,e,Qt,"8",Ur,Ur,mt].join("");v.image=(e,t={})=>{let r=`${Qt}1337;File=inline=1`;return t.width&&(r+=`;width=${t.width}`),t.height&&(r+=`;height=${t.height}`),t.preserveAspectRatio===!1&&(r+=";preserveAspectRatio=0"),r+":"+e.toString("base64")+mt};v.iTerm={setCwd:(e=process.cwd())=>`${Qt}50;CurrentDir=${e}${mt}`,annotation:(e,t={})=>{let r=`${Qt}1337;`,n=typeof t.x<"u",i=typeof t.y<"u";if((n||i)&&!(n&&i&&typeof t.length<"u"))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return e=e.replace(/\|/g,""),r+=t.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",t.length>0?r+=(n?[e,t.length,t.x,t.y]:[t.length,e]).join("|"):r+=e,r+mt}}});var Kn=Z((Zm,Lo)=>{"use strict";Lo.exports=(e,t=process.argv)=>{let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),i=t.indexOf("--");return n!==-1&&(i===-1||n<i)}});var Mo=Z((Xm,No)=>{"use strict";var _u=require("os"),Fo=require("tty"),de=Kn(),{env:Q}=process,Ue;de("no-color")||de("no-colors")||de("color=false")||de("color=never")?Ue=0:(de("color")||de("colors")||de("color=true")||de("color=always"))&&(Ue=1);"FORCE_COLOR"in Q&&(Q.FORCE_COLOR==="true"?Ue=1:Q.FORCE_COLOR==="false"?Ue=0:Ue=Q.FORCE_COLOR.length===0?1:Math.min(parseInt(Q.FORCE_COLOR,10),3));function zn(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Yn(e,t){if(Ue===0)return 0;if(de("color=16m")||de("color=full")||de("color=truecolor"))return 3;if(de("color=256"))return 2;if(e&&!t&&Ue===void 0)return 0;let r=Ue||0;if(Q.TERM==="dumb")return r;if(process.platform==="win32"){let n=_u.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in Q)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in Q)||Q.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in Q)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Q.TEAMCITY_VERSION)?1:0;if(Q.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Q){let n=parseInt((Q.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Q.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Q.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwi
|
||
|
`);let n;for(;(n=Qu.exec(r))!=null;){let i=n[1],o=n[2]||"";o=o.trim();let s=o[0];o=o.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),s==='"'&&(o=o.replace(/\\n/g,`
|
||
|
`),o=o.replace(/\\r/g,"\r")),t[i]=o}return t}function si(e){console.log(`[dotenv@${Gu}][DEBUG] ${e}`)}function Wu(e){return e[0]==="~"?Wo.join(Bu.homedir(),e.slice(1)):e}function Hu(e){let t=Wo.resolve(process.cwd(),".env"),r="utf8",n=!!(e&&e.debug),i=!!(e&&e.override);e&&(e.path!=null&&(t=Wu(e.path)),e.encoding!=null&&(r=e.encoding));try{let o=Qr.parse(Vu.readFileSync(t,{encoding:r}));return Object.keys(o).forEach(function(s){Object.prototype.hasOwnProperty.call(process.env,s)?(i===!0&&(process.env[s]=o[s]),n&&si(i===!0?`"${s}" is already defined in \`process.env\` and WAS overwritten`:`"${s}" is already defined in \`process.env\` and was NOT overwritten`)):process.env[s]=o[s]}),{parsed:o}}catch(o){return n&&si(`Failed to load ${t} ${o.message}`),{error:o}}}var Qr={config:Hu,parse:Ju};Jr.exports.config=Qr.config;Jr.exports.parse=Qr.parse;Jr.exports=Qr});var es=Z((qf,Xo)=>{"use strict";Xo.exports=e=>{let t=e.match(/^[ \t]*(?=\S)/gm);return t?t.reduce((r,n)=>Math.min(r,n.length),1/0):0}});var rs=Z((jf,ts)=>{"use strict";var Zu=es();ts.exports=e=>{let t=Zu(e);if(t===0)return e;let r=new RegExp(`^[ \\t]{${t}}`,"gm");return e.replace(r,"")}});var ci=Z((Jf,ns)=>{"use strict";ns.exports=(e,t=1,r)=>{if(r={indent:" ",includeEmptyLines:!1,...r},typeof e!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if(typeof t!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(typeof r.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r.indent}\``);if(t===0)return e;let n=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return e.replace(n,r.indent.repeat(t))}});var as=Z((Kf,ss)=>{"use strict";ss.exports=({onlyFirst:e=!1}={})=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}});var fi=Z((zf,ls)=>{"use strict";var sc=as();ls.exports=e=>typeof e=="string"?e.replace(sc(),""):e});var us=Z((Xf,Kr)=>{"use strict";Kr.exports=(e={})=>{let t;if(e.repoUrl)t=e.repoUrl;else if(e.user&&e.repo)t=`https://github.com/${e.user}/${e.repo}`;else throw new Error("You need to specify either the `repoUrl` option or both the `user` and `repo` options");let r=new URL(`${t}/issues/new`),n=["body","title","labels","template","milestone","assignee","projects"];for(let i of n){let o=e[i];if(o!==void 0){if(i==="labels"||i==="projects"){if(!Array.isArray(o))throw new TypeError(`The \`${i}\` option should be an array`);o=o.join(",")}r.searchParams.set(i,o)}}return r.toString()};Kr.exports.default=Kr.exports});var eo=Z((HP,Wa)=>{"use strict";Wa.exports=function(){function e(t,r,n,i,o){return t<r||n<r?t>n?n+1:t+1:i===o?r:r+1}return function(t,r){if(t===r)return 0;if(t.length>r.length){var n=t;t=r,r=n}for(var i=t.length,o=r.length;i>0&&t.charCodeAt(i-1)===r.charCodeAt(o-1);)i--,o--;for(var s=0;s<i&&t.charCodeAt(s)===r.charCodeAt(s);)s++;if(i-=s,o-=s,i===0||o<3)return o;var a=0,l,u,c,p,d,f,g,h,O,T,S,C,E=[];for(l=0;l<i;l++)E.push(l+1),E.push(t.charCodeAt(s+l));for(var me=E.length-1;a<o-3;)for(O=r.charCodeAt(s+(u=a)),T=r.charCodeAt(s+(c=a+1)),S=r.charCodeAt(s+(p=a+2)),C=r.charCodeAt(s+(d=a+3)),f=a+=4,l=0;l<me;l+=2)g=E[l],h=E[l+1],u=e(g,u,c,O,h),c=e(u,c,p,T,h),p=e(c,p,d,S,h),f=e(p,d,f,C,h),E[l]=f,d=p,p=c,c=u,u=g;for(;a<o;)for(O=r.charCodeAt(s+(u=a)),f=++a,l=0;l<me;l+=2)g=E[l],E[l]=f=e(g,u,f,O,E[l+1]),u=g;return f}}()});var vm={};jt(vm,{Debug:()=>jn,Decimal:()=>ve,Extensions:()=>Nn,MetricsClient:()=>yt,NotFoundError:()=>_e,PrismaClientInitializationError:()=>R,PrismaClientKnownRequestError:()=>V,PrismaClientRustPanicError:()=>le,PrismaClientUnknownRequestError:()=>B,PrismaClientValidationError:()=>J,Public:()=>Mn,Sql:()=>ie,defineDmmfProperty:()=>ps,empty:()=>fs,getPrismaClient:()=>jl,getRuntime:()=>xn,join:()=>ms,makeStrictEnum:()=>Vl,makeTypedQueryFactory:()=>ds,objectEnumValues:()=>Zr,raw:()=>Ti,sqltag:()=>Ri,warnEnvConflicts:()=>Bl,warnOnce:()=>Zt});module.exports=
|
||
|
`);return t.length<e?t:t.slice(-e)}function xo(){Bt.length=0}var F=jn;var Po=k(require("fs"));function Vn(){let e=process.env.PRISMA_QUERY_ENGINE_LIBRARY;if(!(e&&Po.default.existsSync(e))&&process.arch==="ia32")throw new Error('The default query engine type (Node-API, "library") is currently not supported for 32bit Node. Please set `engineType = "binary"` in the "generator" block of your "schema.prisma" file (or use the environment variables "PRISMA_CLIENT_ENGINE_TYPE=binary" and/or "PRISMA_CLI_QUERY_ENGINE_TYPE=binary".)')}var Bn=["darwin","darwin-arm64","debian-openssl-1.0.x","debian-openssl-1.1.x","debian-openssl-3.0.x","rhel-openssl-1.0.x","rhel-openssl-1.1.x","rhel-openssl-3.0.x","linux-arm64-openssl-1.1.x","linux-arm64-openssl-1.0.x","linux-arm64-openssl-3.0.x","linux-arm-openssl-1.1.x","linux-arm-openssl-1.0.x","linux-arm-openssl-3.0.x","linux-musl","linux-musl-openssl-3.0.x","linux-musl-arm64-openssl-1.1.x","linux-musl-arm64-openssl-3.0.x","linux-nixos","linux-static-x64","linux-static-arm64","windows","freebsd11","freebsd12","freebsd13","freebsd14","freebsd15","openbsd","netbsd","arm"];var Fr="libquery_engine";function Nr(e,t){let r=t==="url";return e.includes("windows")?r?"query_engine.dll.node":`query_engine-${e}.dll.node`:e.includes("darwin")?r?`${Fr}.dylib.node`:`${Fr}-${e}.dylib.node`:r?`${Fr}.so.node`:`${Fr}-${e}.so.node`}var Co=k(require("child_process")),Jn=k(require("fs/promises")),Vr=k(require("os"));var ke=Symbol.for("@ts-pattern/matcher"),hu=Symbol.for("@ts-pattern/isVariadic"),$r="@ts-pattern/anonymous-select-key",Un=e=>!!(e&&typeof e=="object"),Mr=e=>e&&!!e[ke],Ee=(e,t,r)=>{if(Mr(e)){let n=e[ke](),{matched:i,selections:o}=n.match(t);return i&&o&&Object.keys(o).forEach(s=>r(s,o[s])),i}if(Un(e)){if(!Un(t))return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=[],i=[],o=[];for(let s of e.keys()){let a=e[s];Mr(a)&&a[hu]?o.push(a):o.length?i.push(a):n.push(a)}if(o.length){if(o.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(t.length<n.length+i.length)return!1;let s=t.slice(0,n.length),a=i.length===0?[]:t.slice(-i.length),l=t.slice(n.length,i.length===0?1/0:-i.length);return n.every((u,c)=>Ee(u,s[c],r))&&i.every((u,c)=>Ee(u,a[c],r))&&(o.length===0||Ee(o[0],l,r))}return e.length===t.length&&e.every((s,a)=>Ee(s,t[a],r))}return Object.keys(e).every(n=>{let i=e[n];return(n in t||Mr(o=i)&&o[ke]().matcherType==="optional")&&Ee(i,t[n],r);var o})}return Object.is(t,e)},Be=e=>{var t,r,n;return Un(e)?Mr(e)?(t=(r=(n=e[ke]()).getSelectionKeys)==null?void 0:r.call(n))!=null?t:[]:Array.isArray(e)?Gt(e,Be):Gt(Object.values(e),Be):[]},Gt=(e,t)=>e.reduce((r,n)=>r.concat(t(n)),[]);function pe(e){return Object.assign(e,{optional:()=>yu(e),and:t=>j(e,t),or:t=>bu(e,t),select:t=>t===void 0?vo(e):vo(t,e)})}function yu(e){return pe({[ke]:()=>({match:t=>{let r={},n=(i,o)=>{r[i]=o};return t===void 0?(Be(e).forEach(i=>n(i,void 0)),{matched:!0,selections:r}):{matched:Ee(e,t,n),selections:r}},getSelectionKeys:()=>Be(e),matcherType:"optional"})})}function j(...e){return pe({[ke]:()=>({match:t=>{let r={},n=(i,o)=>{r[i]=o};return{matched:e.every(i=>Ee(i,t,n)),selections:r}},getSelectionKeys:()=>Gt(e,Be),matcherType:"and"})})}function bu(...e){return pe({[ke]:()=>({match:t=>{let r={},n=(i,o)=>{r[i]=o};return Gt(e,Be).forEach(i=>n(i,void 0)),{matched:e.some(i=>Ee(i,t,n)),selections:r}},getSelectionKeys:()=>Gt(e,Be),matcherType:"or"})})}function I(e){return{[ke]:()=>({match:t=>({matched:!!e(t)})})}}function vo(...e){let t=typeof e[0]=="string"?e[0]:void 0,r=e.length===2?e[1]:typeof e[0]=="string"?void 0:e[0];return pe({[ke]:()=>({match:n=>{let i={[t??$r]:n};return{matched:r===void 0||Ee(r,n,(o,s)=>{i[o]=s}),selections:i}},getSelectionKeys:()=>[t??$r].concat(r===void 0?[]:Be(r))})})}function ye(e){return typeof e=="number"}function $e(e){return typeof e=="string"}function qe(e){return typeof e=="bigint"}var Nm=pe(I(function(e){return!0}));var je=e=>Object.assign(pe(e),{startsWith:t=>{return je(j(e,(r=t,I(n=>$e(n)&&n.startsWith(r)))));var r},endsWith:t=>{ret
|
||
|
${JSON.stringify(a,null,2)}`),a}async function Tu(){let e="/etc/os-release";try{let t=await Jn.default.readFile(e,{encoding:"utf-8"});return vu(t)}catch{return{targetDistro:void 0,familyDistro:void 0,originalDistro:void 0}}}function Ru(e){let t=/^OpenSSL\s(\d+\.\d+)\.\d+/.exec(e);if(t){let r=`${t[1]}.x`;return Io(r)}}function To(e){let t=/libssl\.so\.(\d)(\.\d)?/.exec(e);if(t){let r=`${t[1]}${t[2]??".0"}.x`;return Io(r)}}function Io(e){let t=(()=>{if(ko(e))return e;let r=e.split(".");return r[1]="0",r.join(".")})();if(Pu.includes(t))return t}function Cu(e){return dt(e).with({familyDistro:"musl"},()=>(te('Trying platform-specific paths for "alpine"'),["/lib"])).with({familyDistro:"debian"},({archFromUname:t})=>(te('Trying platform-specific paths for "debian" (and "ubuntu")'),[`/usr/lib/${t}-linux-gnu`,`/lib/${t}-linux-gnu`])).with({familyDistro:"rhel"},()=>(te('Trying platform-specific paths for "rhel"'),["/lib64","/usr/lib64"])).otherwise(({familyDistro:t,arch:r,archFromUname:n})=>(te(`Don't know any platform-specific paths for "${t}" on ${r} (${n})`),[]))}async function Su(e){let t='grep -v "libssl.so.0"',r=await Ro(e);if(r){te(`Found libssl.so file using platform-specific paths: ${r}`);let o=To(r);if(te(`The parsed libssl version is: ${o}`),o)return{libssl:o,strategy:"libssl-specific-path"}}te('Falling back to "ldconfig" and other generic paths');let n=await Br(`ldconfig -p | sed "s/.*=>s*//" | sed "s|.*/||" | grep libssl | sort | ${t}`);if(n||(n=await Ro(["/lib64","/usr/lib64","/lib"])),n){te(`Found libssl.so file using "ldconfig" or other generic paths: ${n}`);let o=To(n);if(te(`The parsed libssl version is: ${o}`),o)return{libssl:o,strategy:"ldconfig"}}let i=await Br("openssl version -v");if(i){te(`Found openssl binary with version: ${i}`);let o=Ru(i);if(te(`The parsed openssl version is: ${o}`),o)return{libssl:o,strategy:"openssl-binary"}}return te("Couldn't find any version of libssl or OpenSSL in the system"),{}}async function Ro(e){for(let t of e){let r=await Au(t);if(r)return r}}async function Au(e){try{return(await Jn.default.readdir(e)).find(r=>r.startsWith("libssl.so.")&&!r.startsWith("libssl.so.0"))}catch(t){if(t.code==="ENOENT")return;throw t}}async function tt(){let{binaryTarget:e}=await Oo();return e}function Iu(e){return e.binaryTarget!==void 0}async function Wn(){let{memoized:e,...t}=await Oo();return t}var jr={};async function Oo(){if(Iu(jr))return Promise.resolve({...jr,memoized:!0});let e=await Ao(),t=Ou(e);return jr={...e,binaryTarget:t},{...jr,memoized:!1}}function Ou(e){let{platform:t,arch:r,archFromUname:n,libssl:i,targetDistro:o,familyDistro:s,originalDistro:a}=e;t==="linux"&&!["x64","arm64"].includes(r)&&qr(`Prisma only officially supports Linux on amd64 (x86_64) and arm64 (aarch64) system architectures (detected "${r}" instead). If you are using your own custom Prisma engines, you can ignore this warning, as long as you've compiled the engines for your system architecture "${n}".`);let l="1.1.x";if(t==="linux"&&i===void 0){let c=dt({familyDistro:s}).with({familyDistro:"debian"},()=>"Please manually install OpenSSL via `apt-get update -y && apt-get install -y openssl` and try installing Prisma again. If you're running Prisma on Docker, add this command to your Dockerfile, or switch to an image that already has OpenSSL installed.").otherwise(()=>"Please manually install OpenSSL and try installing Prisma again.");qr(`Prisma failed to detect the libssl/openssl version to use, and may not work as expected. Defaulting to "openssl-${l}".
|
||
|
${c}`)}let u="debian";if(t==="linux"&&o===void 0&&te(`Distro is "${a}". Falling back to Prisma engines built for "${u}".`),t==="darwin"&&r==="arm64")return"darwin-arm64";if(t==="darwin")return"darwin";if(t==="win32")return"windows";if(t==="freebsd")return o;if(t==="openbsd")return"openbsd";if(t==="netbsd")return"netbsd";if(t==="linux"&&o==="nixos")return"linux-nixos";if(t==="linux"&&r==="arm64")return`${o==="musl"?"linux-musl-arm64":"linux-arm64"}-openssl-${i||l}`;if(t==="linux"&&r==="arm")return`linux-arm-openssl-${i||l}`;if(t==="linux"&&o==="musl"){let c="linux-musl";return!i||ko(i)?c:`${c}-openssl-${i}`}return t==="linux"&&o&&i?`${o}-openssl-${i}`:(t!=="linux"&&qr(`Prisma detected unknown OS "${t}" and may not work as expected. Defaulting to "linux".`),i?`${u}-openssl-${i}`:o?`${o}-openssl-${l}`:`${u}-openssl-${l}`)}async function ku(e){try{return await e()}catch{return}}function Br(e){return ku(async()=>{let t=await xu(e);return te(`Command "${e}" successfully returned "${t.stdout}"`),t.stdout})}async function Du(){return typeof Vr.default.machine=="function"?Vr.default.machine():(await Br("uname -m"))?.trim()}function ko(e){return e.startsWith("1.")}var Uo=k(Bo());function ei(e){return(0,Uo.default)(e,e,{fallback:X})}var $u=k(ri());var $=k(require("path")),qu=k(ri()),Pf=F("prisma:engines");function Go(){return $.default.join(__dirname,"../")}var vf="libquery-engine";$.default.join(__dirname,"../query-engine-darwin");$.default.join(__dirname,"../query-engine-darwin-arm64");$.default.join(__dirname,"../query-engine-debian-openssl-1.0.x");$.default.join(__dirname,"../query-engine-debian-openssl-1.1.x");$.default.join(__dirname,"../query-engine-debian-openssl-3.0.x");$.default.join(__dirname,"../query-engine-linux-static-x64");$.default.join(__dirname,"../query-engine-linux-static-arm64");$.default.join(__dirname,"../query-engine-rhel-openssl-1.0.x");$.default.join(__dirname,"../query-engine-rhel-openssl-1.1.x");$.default.join(__dirname,"../query-engine-rhel-openssl-3.0.x");$.default.join(__dirname,"../libquery_engine-darwin.dylib.node");$.default.join(__dirname,"../libquery_engine-darwin-arm64.dylib.node");$.default.join(__dirname,"../libquery_engine-debian-openssl-1.0.x.so.node");$.default.join(__dirname,"../libquery_engine-debian-openssl-1.1.x.so.node");$.default.join(__dirname,"../libquery_engine-debian-openssl-3.0.x.so.node");$.default.join(__dirname,"../libquery_engine-linux-arm64-openssl-1.0.x.so.node");$.default.join(__dirname,"../libquery_engine-linux-arm64-openssl-1.1.x.so.node");$.default.join(__dirname,"../libquery_engine-linux-arm64-openssl-3.0.x.so.node");$.default.join(__dirname,"../libquery_engine-linux-musl.so.node");$.default.join(__dirname,"../libquery_engine-linux-musl-openssl-3.0.x.so.node");$.default.join(__dirname,"../libquery_engine-rhel-openssl-1.0.x.so.node");$.default.join(__dirname,"../libquery_engine-rhel-openssl-1.1.x.so.node");$.default.join(__dirname,"../libquery_engine-rhel-openssl-3.0.x.so.node");$.default.join(__dirname,"../query_engine-windows.dll.node");var ni=k(require("fs")),Qo=F("chmodPlusX");function ii(e){if(process.platform==="win32")return;let t=ni.default.statSync(e),r=t.mode|64|8|1;if(t.mode===r){Qo(`Execution permissions of ${e} are fine`);return}let n=r.toString(8).slice(-3);Qo(`Have to call chmodPlusX on ${e}`),ni.default.chmodSync(e,n)}function oi(e){let t=e.e,r=a=>`Prisma cannot find the required \`${a}\` system library in your system`,n=t.message.includes("cannot open shared object file"),i=`Please refer to the documentation about Prisma's system requirements: ${ei("https://pris.ly/d/system-requirements")}`,o=`Unable to require(\`${Ae(e.id)}\`).`,s=dt({message:t.message,code:t.code}).with({code:"ENOENT"},()=>"File does not exist.").when(({message:a})=>n&&a.includes("libz"),()=>`${r("libz")}. Please install it and try again.`).when(({message:a})=>n&&a.includes("libgcc_s"),()=>`${r("libgcc_s")}. Please install it and try again.`).when(({message:a})=>n&&a.includes("libssl"),()=>{let a=e.platformInfo.libssl?`openssl-${e.platformInfo.libssl}`:"openssl";return`${r("libssl")
|
||
|
${s}
|
||
|
|
||
|
Details: ${t.message}`}var li=k(Ho()),Wr=k(require("fs"));var gt=k(require("path"));function Ko(e){let t=e.ignoreProcessEnv?{}:process.env,r=n=>n.match(/(.?\${(?:[a-zA-Z0-9_]+)?})/g)?.reduce(function(o,s){let a=/(.?)\${([a-zA-Z0-9_]+)?}/g.exec(s);if(!a)return o;let l=a[1],u,c;if(l==="\\")c=a[0],u=c.replace("\\$","$");else{let p=a[2];c=a[0].substring(l.length),u=Object.hasOwnProperty.call(t,p)?t[p]:e.parsed[p]||"",u=r(u)}return o.replace(c,u)},n)??n;for(let n in e.parsed){let i=Object.hasOwnProperty.call(t,n)?t[n]:e.parsed[n];e.parsed[n]=r(i)}for(let n in e.parsed)t[n]=e.parsed[n];return e}var ai=F("prisma:tryLoadEnv");function Wt({rootEnvPath:e,schemaEnvPath:t},r={conflictCheck:"none"}){let n=zo(e);r.conflictCheck!=="none"&&Ku(n,t,r.conflictCheck);let i=null;return Yo(n?.path,t)||(i=zo(t)),!n&&!i&&ai("No Environment variables loaded"),i?.dotenvResult.error?console.error(ce(H("Schema Env Error: "))+i.dotenvResult.error):{message:[n?.message,i?.message].filter(Boolean).join(`
|
||
|
`),parsed:{...n?.dotenvResult?.parsed,...i?.dotenvResult?.parsed}}}function Ku(e,t,r){let n=e?.dotenvResult.parsed,i=!Yo(e?.path,t);if(n&&t&&i&&Wr.default.existsSync(t)){let o=li.default.parse(Wr.default.readFileSync(t)),s=[];for(let a in o)n[a]===o[a]&&s.push(a);if(s.length>0){let a=gt.default.relative(process.cwd(),e.path),l=gt.default.relative(process.cwd(),t);if(r==="error"){let u=`There is a conflict between env var${s.length>1?"s":""} in ${X(a)} and ${X(l)}
|
||
|
Conflicting env vars:
|
||
|
${s.map(c=>` ${H(c)}`).join(`
|
||
|
`)}
|
||
|
|
||
|
We suggest to move the contents of ${X(l)} to ${X(a)} to consolidate your env vars.
|
||
|
`;throw new Error(u)}else if(r==="warn"){let u=`Conflict for env var${s.length>1?"s":""} ${s.map(c=>H(c)).join(", ")} in ${X(a)} and ${X(l)}
|
||
|
Env vars from ${X(l)} overwrite the ones from ${X(a)}
|
||
|
`;console.warn(`${Ie("warn(prisma)")} ${u}`)}}}}function zo(e){if(zu(e)){ai(`Environment variables loaded from ${e}`);let t=li.default.config({path:e,debug:process.env.DOTENV_CONFIG_DEBUG?!0:void 0});return{dotenvResult:Ko(t),message:Ae(`Environment variables loaded from ${gt.default.relative(process.cwd(),e)}`),path:e}}else ai(`Environment variables not found at ${e}`);return null}function Yo(e,t){return e&&t&>.default.resolve(e)===gt.default.resolve(t)}function zu(e){return!!(e&&Wr.default.existsSync(e))}var Zo="library";function Ht(e){let t=Yu();return t||(e?.config.engineType==="library"?"library":e?.config.engineType==="binary"?"binary":Zo)}function Yu(){let e=process.env.PRISMA_CLIENT_ENGINE_TYPE;return e==="library"?"library":e==="binary"?"binary":void 0}var Ge;(t=>{let e;(E=>(E.findUnique="findUnique",E.findUniqueOrThrow="findUniqueOrThrow",E.findFirst="findFirst",E.findFirstOrThrow="findFirstOrThrow",E.findMany="findMany",E.create="create",E.createMany="createMany",E.createManyAndReturn="createManyAndReturn",E.update="update",E.updateMany="updateMany",E.upsert="upsert",E.delete="delete",E.deleteMany="deleteMany",E.groupBy="groupBy",E.count="count",E.aggregate="aggregate",E.findRaw="findRaw",E.aggregateRaw="aggregateRaw"))(e=t.ModelAction||={})})(Ge||={});var Kt=k(require("path"));function ui(e){return Kt.default.sep===Kt.default.posix.sep?e:e.split(Kt.default.sep).join(Kt.default.posix.sep)}var is=k(ci());function di(e){return String(new pi(e))}var pi=class{constructor(t){this.config=t}toString(){let{config:t}=this,r=t.provider.fromEnvVar?`env("${t.provider.fromEnvVar}")`:t.provider.value,n=JSON.parse(JSON.stringify({provider:r,binaryTargets:Xu(t.binaryTargets)}));return`generator ${t.name} {
|
||
|
${(0,is.default)(ec(n),2)}
|
||
|
}`}};function Xu(e){let t;if(e.length>0){let r=e.find(n=>n.fromEnvVar!==null);r?t=`env("${r.fromEnvVar}")`:t=e.map(n=>n.native?"native":n.value)}else t=void 0;return t}function ec(e){let t=Object.keys(e).reduce((r,n)=>Math.max(r,n.length),0);return Object.entries(e).map(([r,n])=>`${r.padEnd(t)} = ${tc(n)}`).join(`
|
||
|
`)}function tc(e){return JSON.parse(JSON.stringify(e,(t,r)=>Array.isArray(r)?`[${r.map(n=>JSON.stringify(n)).join(", ")}]`:JSON.stringify(r)))}var Yt={};jt(Yt,{error:()=>ic,info:()=>nc,log:()=>rc,query:()=>oc,should:()=>os,tags:()=>zt,warn:()=>mi});var zt={error:ce("prisma:error"),warn:Ie("prisma:warn"),info:Oe("prisma:info"),query:et("prisma:query")},os={warn:()=>!process.env.PRISMA_DISABLE_WARNINGS};function rc(...e){console.log(...e)}function mi(e,...t){os.warn()&&console.warn(`${zt.warn} ${e}`,...t)}function nc(e,...t){console.info(`${zt.info} ${e}`,...t)}function ic(e,...t){console.error(`${zt.error} ${e}`,...t)}function oc(e,...t){console.log(`${zt.query} ${e}`,...t)}function Hr(e,t){if(!e)throw new Error(`${t}. This should never happen. If you see this error, please, open an issue at https://pris.ly/prisma-prisma-bug-report`)}function De(e,t){throw new Error(t)}function gi(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var hi=(e,t)=>e.reduce((r,n)=>(r[t(n)]=n,r),{});function ht(e,t){let r={};for(let n of Object.keys(e))r[n]=t(e[n],n);return r}function yi(e,t){if(e.length===0)return;let r=e[0];for(let n=1;n<e.length;n++)t(r,e[n])<0&&(r=e[n]);return r}function w(e,t){Object.defineProperty(e,"name",{value:t,configurable:!0})}var cs=new Set,Zt=(e,t,...r)=>{cs.has(e)||(cs.add(e),mi(t,...r))};var V=class extends Error{constructor(t,{code:r,clientVersion:n,meta:i,batchRequestIdx:o}){super(t),this.name="PrismaClientKnownRequestError",this.code=r,this.clientVersion=n,this.meta=i,Object.defineProperty(this,"batchRequestIdx",{value:o,enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return"PrismaClientKnownRequestError"}};w(V,"PrismaClientKnownRequestError");var _e=class extends V{constructor(t,r){super(t,{code:"P2025",clientVersion:r}),this.name="NotFoundError"}};w(_e,"NotFoundError");var R=class e extends Error{constructor(t,r,n){super(t),this.name="PrismaClientInitializationError",this.clientVersion=r,this.errorCode=n,Error.captureStackTrace(e)}get[Symbol.toStringTag](){return"PrismaClientInitializationError"}};w(R,"PrismaClientInitializationError");var le=class extends Error{constructor(t,r){super(t),this.name="PrismaClientRustPanicError",this.clientVersion=r}get[Symbol.toStringTag](){return"PrismaClientRustPanicError"}};w(le,"PrismaClientRustPanicError");var B=class extends Error{constructor(t,{clientVersion:r,batchRequestIdx:n}){super(t),this.name="PrismaClientUnknownRequestError",this.clientVersion=r,Object.defineProperty(this,"batchRequestIdx",{value:n,writable:!0,enumerable:!1})}get[Symbol.toStringTag](){return"PrismaClientUnknownRequestError"}};w(B,"PrismaClientUnknownRequestError");var J=class extends Error{constructor(r,{clientVersion:n}){super(r);this.name="PrismaClientValidationError";this.clientVersion=n}get[Symbol.toStringTag](){return"PrismaClientValidationError"}};w(J,"PrismaClientValidationError");var yt=class{constructor(t){this._engine=t}prometheus(t){return this._engine.metrics({format:"prometheus",...t})}json(t){return this._engine.metrics({format:"json",...t})}};function Xt(e){let t;return{get(){return t||(t={value:e()}),t.value}}}function ps(e,t){let r=Xt(()=>ac(t));Object.defineProperty(e,"dmmf",{get:()=>r.get()})}function ac(e){return{datamodel:{models:bi(e.models),enums:bi(e.enums),types:bi(e.types)}}}function bi(e){return Object.entries(e).map(([t,r])=>({name:t,...r}))}var Yr=Symbol(),Ei=new WeakMap,Le=class{constructor(t){t===Yr?Ei.set(this,`Prisma.${this._getName()}`):Ei.set(this,`new Prisma.${this._getNamespace()}.${this._getName()}()`)}_getName(){return this.constructor.name}toString(){return Ei.get(this)}},er=class extends Le{_getNamespace(){return"NullTypes"}},tr=class extends er{};wi(tr,"DbNull");var rr=class extends er{};wi(rr,"JsonNull");var nr=class extends er{};wi(nr,"AnyNull");var Zr={classes:{DbNull:tr,JsonNull:rr,AnyNull:nr},instances:{DbNull:new tr(Yr),JsonNull:new rr(Yr),AnyNull:new nr(Yr)}};function wi(e,t){Object.defineProperty(e,"name",{value:t,configurable:!0})}var xi=new WeakMap,ir=class{constructor(t,r){xi.set(this,{sql:t,values:r})}get sql(){return xi.get(this).
|
||
|
`)}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}};function ys(e){return e.substring(0,1).toLowerCase()+e.substring(1)}function xt(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function tn(e){return e.toString()!=="Invalid Date"}var Pt=9e15,He=1e9,Ci="0123456789abcdef",nn="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",on="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Si={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Pt,maxE:Pt,crypto:!1},xs,Fe,x=!0,an="[DecimalError] ",We=an+"Invalid argument: ",Ps=an+"Precision limit exceeded",vs=an+"crypto unavailable",Ts="[object Decimal]",ee=Math.floor,G=Math.pow,pc=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,dc=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,mc=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Rs=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ge=1e7,b=7,fc=9007199254740991,gc=nn.length-1,Ai=on.length-1,m={toStringTag:Ts};m.absoluteValue=m.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),y(e)};m.ceil=function(){return y(new this.constructor(this),this.e+1,2)};m.clampedTo=m.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(We+t);return r=n.cmp(e),r<0?e:n.cmp(t)>0?t:new i(n)};m.comparedTo=m.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};m.cosine=m.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())+b,n.rounding=1,r=hc(n,Os(n,r)),n.precision=e,n.rounding=t,y(Fe==2||Fe==3?r.neg():r,e,t,!0)):new n(1):new n(NaN)};m.cubeRoot=m.cbrt=function(){var e,t,r,n,i,o,s,a,l,u,c=thi
|
||
|
`)}};function It(e){return new Di(Ls(e))}function Ls(e){let t=new At;for(let[r,n]of Object.entries(e)){let i=new mn(r,Fs(n));t.addField(i)}return t}function Fs(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(Tt(e))return new W(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return Buffer.isBuffer(e)?new W(`Buffer.alloc(${e.byteLength})`):new W(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=tn(e)?e.toISOString():"Invalid Date";return new W(`new Date("${t}")`)}return e instanceof Le?new W(`Prisma.${e._getName()}`):Rt(e)?new W(`prisma.${ys(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?op(e):typeof e=="object"?Ls(e):new W(Object.prototype.toString.call(e))}function op(e){let t=new St;for(let r of e)t.addItem(Fs(r));return t}function fn(e,t){let r=t==="pretty"?Ds:dn,n=e.renderAllMessages(r),i=new wt(0,{colors:r}).write(e).toString();return{message:n,args:i}}function Ns(e){if(e===void 0)return"";let t=It(e);return new wt(0,{colors:dn}).write(t).toString()}var sp="P2037";function ot({error:e,user_facing_error:t},r,n){return t.error_code?new V(ap(t,n),{code:t.error_code,clientVersion:r,meta:t.meta,batchRequestIdx:t.batch_request_idx}):new B(e,{clientVersion:r,batchRequestIdx:t.batch_request_idx})}function ap(e,t){let r=e.message;return(t==="postgresql"||t==="postgres"||t==="mysql")&&e.error_code===sp&&(r+=`
|
||
|
Prisma Accelerate has built-in connection pooling to prevent such errors: https://pris.ly/client/error-accelerate`),r}var ur="<unknown>";function Ms(e){var t=e.split(`
|
||
|
`);return t.reduce(function(r,n){var i=cp(n)||dp(n)||gp(n)||Ep(n)||yp(n);return i&&r.push(i),r},[])}var lp=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,up=/\((\S*)(?::(\d+))(?::(\d+))\)/;function cp(e){var t=lp.exec(e);if(!t)return null;var r=t[2]&&t[2].indexOf("native")===0,n=t[2]&&t[2].indexOf("eval")===0,i=up.exec(t[2]);return n&&i!=null&&(t[2]=i[1],t[3]=i[2],t[4]=i[3]),{file:r?null:t[2],methodName:t[1]||ur,arguments:r?[t[2]]:[],lineNumber:t[3]?+t[3]:null,column:t[4]?+t[4]:null}}var pp=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function dp(e){var t=pp.exec(e);return t?{file:t[2],methodName:t[1]||ur,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}var mp=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,fp=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function gp(e){var t=mp.exec(e);if(!t)return null;var r=t[3]&&t[3].indexOf(" > eval")>-1,n=fp.exec(t[3]);return r&&n!=null&&(t[3]=n[1],t[4]=n[2],t[5]=null),{file:t[3],methodName:t[1]||ur,arguments:t[2]?t[2].split(","):[],lineNumber:t[4]?+t[4]:null,column:t[5]?+t[5]:null}}var hp=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;function yp(e){var t=hp.exec(e);return t?{file:t[3],methodName:t[1]||ur,arguments:[],lineNumber:+t[4],column:t[5]?+t[5]:null}:null}var bp=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;function Ep(e){var t=bp.exec(e);return t?{file:t[2],methodName:t[1]||ur,arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}:null}var _i=class{getLocation(){return null}},Li=class{constructor(){this._error=new Error}getLocation(){let t=this._error.stack;if(!t)return null;let n=Ms(t).find(i=>{if(!i.file)return!1;let o=ui(i.file);return o!=="<anonymous>"&&!o.includes("@prisma")&&!o.includes("/packages/client/src/runtime/")&&!o.endsWith("/runtime/binary.js")&&!o.endsWith("/runtime/library.js")&&!o.endsWith("/runtime/edge.js")&&!o.endsWith("/runtime/edge-esm.js")&&!o.startsWith("internal/")&&!i.methodName.includes("new ")&&!i.methodName.includes("getCallSite")&&!i.methodName.includes("Proxy.")&&i.methodName.split(".").length<4});return!n||!n.file?null:{fileName:n.file,lineNumber:n.lineNumber,columnNumber:n.column}}};function ze(e){return e==="minimal"?typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new _i:new Li}var $s={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function Ot(e={}){let t=xp(e);return Object.entries(t).reduce((n,[i,o])=>($s[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function xp(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function gn(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function qs(e,t){let r=gn(e);return t({action:"aggregate",unpacker:r,argsMapper:Ot})(e)}function Pp(e={}){let{select:t,...r}=e;return typeof t=="object"?Ot({...r,_count:t}):Ot({...r,_count:{_all:!0}})}function vp(e={}){return typeof e.select=="object"?t=>gn(e)(t)._count:t=>gn(e)(t)._count._all}function js(e,t){return t({action:"count",unpacker:vp(e),argsMapper:Pp})(e)}function Tp(e={}){let t=Ot(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 Rp(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function Vs(e,t){return t({action:"groupBy",unpacker:Rp(e),argsMapper:Tp})(e)}function Bs(e,t,r){if(t==="aggregate")return n=>qs(n,r);if(t==="count")return n=>js(n,r);if(t==="groupBy")return n=>Vs(n,r)}function Us(e,t){let r=t.fields.filter(i=>!i.relationName),n=hi(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 lr(e,o,s.type,s.isList,s.kind==="enum")},...en(Object.keys(n))})}var Gs=e=>Array.isArray(e)?e:e.split("."),Fi=(e,t)=>Gs(t).reduce((r,n)=>r&&r[n],e),Qs=(e,t,r)=>Gs(t).reduceRight((n,i,
|
||
|
`);return new e(t,Ks(n).split(`
|
||
|
`))}highlight(){let t=Ws(this.toString());return new e(this.firstLineNumber,t.split(`
|
||
|
`))}toString(){return this.lines.join(`
|
||
|
`)}};var _p={red:ce,gray:Vt,dim:Ae,bold:H,underline:X,highlightSource:e=>e.highlight()},Lp={red:e=>e,gray:e=>e,dim:e=>e,bold:e=>e,underline:e=>e,highlightSource:e=>e};function Fp({message:e,originalMethod:t,isPanic:r,callArguments:n}){return{functionName:`prisma.${t}()`,message:e,isPanic:r??!1,callArguments:n}}function Np({callsite:e,message:t,originalMethod:r,isPanic:n,callArguments:i},o){let s=Fp({message:t,originalMethod:r,isPanic:n,callArguments:i});if(!e||typeof window<"u"||process.env.NODE_ENV==="production")return s;let a=e.getLocation();if(!a||!a.lineNumber||!a.columnNumber)return s;let l=Math.max(1,a.lineNumber-3),u=yn.read(a.fileName)?.slice(l,a.lineNumber),c=u?.lineAt(a.lineNumber);if(u&&c){let p=$p(c),d=Mp(c);if(!d)return s;s.functionName=`${d.code})`,s.location=a,n||(u=u.mapLineAt(a.lineNumber,g=>g.slice(0,d.openingBraceIndex))),u=o.highlightSource(u);let f=String(u.lastLineNumber).length;if(s.contextLines=u.mapLines((g,h)=>o.gray(String(h).padStart(f))+" "+g).mapLines(g=>o.dim(g)).prependSymbolAt(a.lineNumber,o.bold(o.red("\u2192"))),i){let g=p+f+1;g+=2,s.callArguments=(0,Ys.default)(i,g).slice(g)}}return s}function Mp(e){let t=Object.keys(Ge.ModelAction).join("|"),n=new RegExp(String.raw`\.(${t})\(`).exec(e);if(n){let i=n.index+n[0].length,o=e.lastIndexOf(" ",n.index)+1;return{code:e.slice(o,i),openingBraceIndex:i}}return null}function $p(e){let t=0;for(let r=0;r<e.length;r++){if(e.charAt(r)!==" ")return t;t++}return t}function qp({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(jp(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 jp(e){let t=[e.fileName];return e.lineNumber&&t.push(String(e.lineNumber)),e.columnNumber&&t.push(String(e.columnNumber)),t.join(":")}function kt(e){let t=e.showColors?_p:Lp,r;return r=Np(e,t),qp(r,t)}function Zs(e,t,r,n){return e===Ge.ModelAction.findFirstOrThrow||e===Ge.ModelAction.findUniqueOrThrow?Vp(t,r,n):n}function Vp(e,t,r){return async n=>{if("rejectOnNotFound"in n.args){let o=kt({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 V&&o.code==="P2025"?new _e(`No ${e} found`,t):o})}}function Re(e){return e.replace(/^./,t=>t.toLowerCase())}var Bp=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],Up=["aggregate","count","groupBy"];function Mi(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[Gp(e,t),Jp(e,t),sr(r),re("name",()=>t),re("$name",()=>t),re("$parent",()=>e._appliedParent)];return xe({},n)}function Gp(e,t){let r=Re(t),n=Object.keys(Ge.ModelAction).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=l=>e._request(l);s=Zs(o,t,e._clientVersion,s);let a=l=>u=>{let c=ze(e._errorFormat);return e._createPrismaPromise(p=>{let d={args:u,dataPath:[],action:o,model:t,clientMethod:`${r}.${i}`,jsModelName:r,transaction:p,callsite:c};return s({...d,...l})})};return Bp.includes(o)?Ni(e,t,a):Qp(i)?Bs(e,i,a):a({})}}}function Qp(e){return Up.includes(e)}function Jp(e,t){return nt(re("fields",()=>{let r=e._runtimeDataModel.models[t];return Us(t,r)}))}function Xs(e){return e.replace(/^./,t=>t.toUpperCase())}var $i=Symbol();function cr(e){let t=[Wp(e),re($i,()=>e),re("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push(sr(r)),xe(e,t)}function Wp(e){let t=Object.keys(e._runtimeDataModel.models),r=t.map(Re),n=[...new Set(t.concat(r))];return nt({getKeys(){return n},getPropertyValue(i){let o=Xs(i);if(e._runtimeDataModel.models[o]!==void 0)return Mi(e,o);if(e._runtimeDataModel.models[i]!==void 0)return Mi(e,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function ea(e){return e[$i]?e[$i]:e}function ta(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 cr(t)}function ra({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(c=>n[c]);u.length>0&&a.push(bt(u))}else if(r){if(!r[l.name])continue;let u=l.needs.filter(c=>!r[c]);u.length>0&&a.push(bt(u))}Hp(e,l.needs)&&s.push(Kp(l,xe(e,s)))}return s.length>0||a.length>0?xe(e,[...s,...a]):e}function Hp(e,t){return t.every(r=>gi(e,r))}function Kp(e,t){return nt(re(e.name,()=>e.compute(t)))}function bn({visitor:e,result:t,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(t)){for(let s=0;s<t.length;s++)t[s]=bn({result:t[s],args:r,modelName:i,runtimeDataModel:n,visitor:e});return t}let o=e(t,i,r)??t;return r.include&&na({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),r.select&&na({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),o}function na({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(c=>c.name===o);if(!l||l.kind!=="object"||!l.relationName)continue;let u=typeof s=="object"?s:{};t[o]=bn({visitor:i,result:t[o],args:u,modelName:l.type,runtimeDataModel:n})}}function ia({result:e,modelName:t,args:r,extensions:n,runtimeDataModel:i,globalOmit:o}){return n.isEmpty()||e==null||typeof e!="object"||!i.models[t]?e:bn({result:e,args:r??{},modelName:t,runtimeDataModel:i,visi
|
||
|
|
||
|
Learn how: https://pris.ly/d/${ya[t]}-build`;throw console.error(n),new R(n,r)}}function Ea(e,t){return e?e.datasources?e.datasources:e.datasourceUrl?{[t[0]]:{url:e.datasourceUrl}}:{}:{}}var Xp="Cloudflare-Workers",ed="node";function wa(){return typeof Netlify=="object"?"netlify":typeof EdgeRuntime=="string"?"edge-light":globalThis.navigator?.userAgent===Xp?"workerd":globalThis.Deno?"deno":globalThis.__lagon__?"lagon":globalThis.process?.release?.name===ed?"node":globalThis.Bun?"bun":globalThis.fastly?"fastly":"unknown"}var td={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 xn(){let e=wa();return{id:e,prettyName:td[e]||e,isEdge:["workerd","deno","netlify","edge-light"].includes(e)}}var Ra=k(require("fs")),dr=k(require("path"));function Pn(e){let{runtimeBinaryTarget:t}=e;return`Add "${t}" to \`binaryTargets\` in the "schema.prisma" file and run \`prisma generate\` after saving it:
|
||
|
|
||
|
${rd(e)}`}function rd(e){let{generator:t,generatorBinaryTargets:r,runtimeBinaryTarget:n}=e,i={fromEnvVar:null,value:n},o=[...r,i];return di({...t,binaryTargets:o})}function Ye(e){let{runtimeBinaryTarget:t}=e;return`Prisma Client could not locate the Query Engine for runtime "${t}".`}function Ze(e){let{searchedLocations:t}=e;return`The following locations have been searched:
|
||
|
${[...new Set(t)].map(i=>` ${i}`).join(`
|
||
|
`)}`}function xa(e){let{runtimeBinaryTarget:t}=e;return`${Ye(e)}
|
||
|
|
||
|
This happened because \`binaryTargets\` have been pinned, but the actual deployment also required "${t}".
|
||
|
${Pn(e)}
|
||
|
|
||
|
${Ze(e)}`}function vn(e){return`We would appreciate if you could take the time to share some information with us.
|
||
|
Please help us by answering a few questions: https://pris.ly/${e}`}function Tn(e){let{errorStack:t}=e;return t?.match(/\/\.next|\/next@|\/next\//)?`
|
||
|
|
||
|
We detected that you are using Next.js, learn how to fix this: https://pris.ly/d/engine-not-found-nextjs.`:""}function Pa(e){let{queryEngineName:t}=e;return`${Ye(e)}${Tn(e)}
|
||
|
|
||
|
This is likely caused by a bundler that has not copied "${t}" next to the resulting bundle.
|
||
|
Ensure that "${t}" has been copied next to the bundle or in "${e.expectedLocation}".
|
||
|
|
||
|
${vn("engine-not-found-bundler-investigation")}
|
||
|
|
||
|
${Ze(e)}`}function va(e){let{runtimeBinaryTarget:t,generatorBinaryTargets:r}=e,n=r.find(i=>i.native);return`${Ye(e)}
|
||
|
|
||
|
This happened because Prisma Client was generated for "${n?.value??"unknown"}", but the actual deployment required "${t}".
|
||
|
${Pn(e)}
|
||
|
|
||
|
${Ze(e)}`}function Ta(e){let{queryEngineName:t}=e;return`${Ye(e)}${Tn(e)}
|
||
|
|
||
|
This is likely caused by tooling that has not copied "${t}" to the deployment folder.
|
||
|
Ensure that you ran \`prisma generate\` and that "${t}" has been copied to "${e.expectedLocation}".
|
||
|
|
||
|
${vn("engine-not-found-tooling-investigation")}
|
||
|
|
||
|
${Ze(e)}`}var nd=F("prisma:client:engines:resolveEnginePath"),id=()=>new RegExp("runtime[\\\\/]library\\.m?js$");async function Ca(e,t){let r={binary:process.env.PRISMA_QUERY_ENGINE_BINARY,library:process.env.PRISMA_QUERY_ENGINE_LIBRARY}[e]??t.prismaPath;if(r!==void 0)return r;let{enginePath:n,searchedLocations:i}=await od(e,t);if(nd("enginePath",n),n!==void 0&&e==="binary"&&ii(n),n!==void 0)return t.prismaPath=n;let o=await tt(),s=t.generator?.binaryTargets??[],a=s.some(d=>d.native),l=!s.some(d=>d.value===o),u=__filename.match(id())===null,c={searchedLocations:i,generatorBinaryTargets:s,generator:t.generator,runtimeBinaryTarget:o,queryEngineName:Sa(e,o),expectedLocation:dr.default.relative(process.cwd(),t.dirname),errorStack:new Error().stack},p;throw a&&l?p=va(c):l?p=xa(c):u?p=Pa(c):p=Ta(c),new R(p,t.clientVersion)}async function od(engineType,config){let binaryTarget=await tt(),searchedLocations=[],dirname=eval("__dirname"),searchLocations=[config.dirname,dr.default.resolve(dirname,".."),config.generator?.output?.value??dirname,dr.default.resolve(dirname,"../../../.prisma/client"),"/tmp/prisma-engines",config.cwd];__filename.includes("resolveEnginePath")&&searchLocations.push(Go());for(let e of searchLocations){let t=Sa(engineType,binaryTarget),r=dr.default.join(e,t);if(searchedLocations.push(e),Ra.default.existsSync(r))return{enginePath:r,searchedLocations}}return{enginePath:void 0,searchedLocations}}function Sa(e,t){return e==="library"?Nr(t,"fs"):`query-engine-${t}${t==="windows"?".exe":""}`}var qi=k(fi());function Aa(e){return e?e.replace(/".*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,t=>`${t[0]}5`):""}function Ia(e){return e.split(`
|
||
|
`).map(t=>t.replace(/^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)\s*/,"").replace(/\+\d+\s*ms$/,"")).join(`
|
||
|
`)}var Oa=k(us());function ka({title:e,user:t="prisma",repo:r="prisma",template:n="bug_report.yml",body:i}){return(0,Oa.default)({user:t,repo:r,template:n,title:e,body:i})}function Da({version:e,binaryTarget:t,title:r,description:n,engineVersion:i,database:o,query:s}){let a=wo(6e3-(s?.length??0)),l=Ia((0,qi.default)(a)),u=n?`# Description
|
||
|
\`\`\`
|
||
|
${n}
|
||
|
\`\`\``:"",c=(0,qi.default)(`Hi Prisma Team! My Prisma Client just crashed. This is the report:
|
||
|
## Versions
|
||
|
|
||
|
| Name | Version |
|
||
|
|-----------------|--------------------|
|
||
|
| Node | ${process.version?.padEnd(19)}|
|
||
|
| OS | ${t?.padEnd(19)}|
|
||
|
| Prisma Client | ${e?.padEnd(19)}|
|
||
|
| Query Engine | ${i?.padEnd(19)}|
|
||
|
| Database | ${o?.padEnd(19)}|
|
||
|
|
||
|
${u}
|
||
|
|
||
|
## Logs
|
||
|
\`\`\`
|
||
|
${l}
|
||
|
\`\`\`
|
||
|
|
||
|
## Client Snippet
|
||
|
\`\`\`ts
|
||
|
// PLEASE FILL YOUR CODE SNIPPET HERE
|
||
|
\`\`\`
|
||
|
|
||
|
## Schema
|
||
|
\`\`\`prisma
|
||
|
// PLEASE ADD YOUR SCHEMA HERE IF POSSIBLE
|
||
|
\`\`\`
|
||
|
|
||
|
## Prisma Engine Query
|
||
|
\`\`\`
|
||
|
${s?Aa(s):""}
|
||
|
\`\`\`
|
||
|
`),p=ka({title:r,body:c});return`${r}
|
||
|
|
||
|
This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.
|
||
|
|
||
|
${X(p)}
|
||
|
|
||
|
If you want the Prisma team to look into it, please open the link above \u{1F64F}
|
||
|
To increase the chance of success, please post your schema and a snippet of
|
||
|
how you used Prisma Client in the issue.
|
||
|
`}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 new R(`error: Environment variable not found: ${s.fromEnvVar}.`,n);if(i===void 0)throw new R("error: Missing URL environment variable, value, or override.",n);return i}var Rn=class extends Error{constructor(t,r){super(t),this.clientVersion=r.clientVersion,this.cause=r.cause}get[Symbol.toStringTag](){return this.name}};var se=class extends Rn{constructor(t,r){super(t,r),this.isRetryable=r.isRetryable??!0}};function A(e,t){return{...e,isRetryable:t}}var _t=class extends se{constructor(r){super("This request must be retried",A(r,!0));this.name="ForcedRetryError";this.code="P5001"}};w(_t,"ForcedRetryError");var st=class extends se{constructor(r,n){super(r,A(n,!1));this.name="InvalidDatasourceError";this.code="P6001"}};w(st,"InvalidDatasourceError");var at=class extends se{constructor(r,n){super(r,A(n,!1));this.name="NotImplementedYetError";this.code="P5004"}};w(at,"NotImplementedYetError");var q=class extends se{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 lt=class extends q{constructor(r){super("Schema needs to be uploaded",A(r,!0));this.name="SchemaMissingError";this.code="P5005"}};w(lt,"SchemaMissingError");var ji="This request could not be understood by the server",mr=class extends q{constructor(r,n,i){super(n||ji,A(r,!1));this.name="BadRequestError";this.code="P5000";i&&(this.code=i)}};w(mr,"BadRequestError");var fr=class extends q{constructor(r,n){super("Engine not started: healthcheck timeout",A(r,!0));this.name="HealthcheckTimeoutError";this.code="P5013";this.logs=n}};w(fr,"HealthcheckTimeoutError");var gr=class extends q{constructor(r,n,i){super(n,A(r,!0));this.name="EngineStartupError";this.code="P5014";this.logs=i}};w(gr,"EngineStartupError");var hr=class extends q{constructor(r){super("Engine version is not supported",A(r,!1));this.name="EngineVersionNotSupportedError";this.code="P5012"}};w(hr,"EngineVersionNotSupportedError");var Vi="Request timed out",yr=class extends q{constructor(r,n=Vi){super(n,A(r,!1));this.name="GatewayTimeoutError";this.code="P5009"}};w(yr,"GatewayTimeoutError");var sd="Interactive transaction error",br=class extends q{constructor(r,n=sd){super(n,A(r,!1));this.name="InteractiveTransactionError";this.code="P5015"}};w(br,"InteractiveTransactionError");var ad="Request parameters are invalid",Er=class extends q{constructor(r,n=ad){super(n,A(r,!1));this.name="InvalidRequestError";this.code="P5011"}};w(Er,"InvalidRequestError");var Bi="Requested resource does not exist",wr=class extends q{constructor(r,n=Bi){super(n,A(r,!1));this.name="NotFoundError";this.code="P5003"}};w(wr,"NotFoundError");var Ui="Unknown server error",Lt=class extends q{constructor(r,n,i){super(n||Ui,A(r,!0));this.name="ServerError";this.code="P5006";this.logs=i}};w(Lt,"ServerError");var Gi="Unauthorized, check your connection string",xr=class extends q{constructor(r,n=Gi){super(n,A(r,!1));this.name="UnauthorizedError";this.code="P5007"}};w(xr,"UnauthorizedError");var Qi="Usage exceeded, retry again later",Pr=class extends q{constructor(r,n=Qi){super(n,A(r,!0));this.name="UsageExceededError";this.code="P5008"}};w(Pr,"UsageExceededError");async function ld(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:"QueryEngineError",body:r};if("EngineNotStarted"in r||"InteractiveTransactionMisrouted"in r||"InvalidRequestError"in r){let n=Object.values(r)[0].reason;return typeof n=="string"&&!["SchemaMissing","EngineVersionNotSupported"].includes(n)?{type:"UnknownJsonError",
|
||
|
${r}`,A(n,!0));this.name="RequestError";this.code="P5010"}};w(Tr,"RequestError");async function ut(e,t,r=n=>n){let n=t.clientVersion;try{return typeof fetch=="function"?await r(fetch)(e,t):await r(Ji)(e,t)}catch(i){let o=i.message??"Unknown error";throw new Tr(o,{clientVersion:n})}}function pd(e){return{...e.headers,"Content-Type":"application/json"}}function dd(e){return{method:e.method,headers:pd(e)}}function md(e,t){return{text:()=>Promise.resolve(Buffer.concat(e).toString()),json:()=>Promise.resolve().then(()=>JSON.parse(Buffer.concat(e).toString())),ok:t.statusCode>=200&&t.statusCode<=299,status:t.statusCode,url:t.url,headers:new Wi(t.headers)}}async function Ji(e,t={}){let r=fd("https"),n=dd(t),i=[],{origin:o}=new URL(e);return new Promise((s,a)=>{let l=r.request(e,n,u=>{let{statusCode:c,headers:{location:p}}=u;c>=301&&c<=399&&p&&(p.startsWith("http")===!1?s(Ji(`${o}${p}`,t)):s(Ji(p,t))),u.on("data",d=>i.push(d)),u.on("end",()=>s(md(i,u))),u.on("error",a)});l.on("error",a),l.end(t.body??"")})}var fd=typeof require<"u"?require:()=>{},Wi=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 gd=/^[1-9][0-9]*\.[0-9]+\.[0-9]+$/,$a=F("prisma:client:dataproxyEngine");async function hd(e,t){let r=Ma["@prisma/engines-version"],n=t.clientVersion??"unknown";if(process.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION)return process.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&&gd.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("."),c=yd(`<=${a}.${l}.${u}`),p=await ut(c,{clientVersion:n});if(!p.ok)throw new Error(`Failed to fetch stable Prisma version, unpkg.com status ${p.status} ${p.statusText}, response body: ${await p.text()||"<empty body>"}`);let d=await p.text();$a("length of body fetched from unpkg.com",d.length);let f;try{f=JSON.parse(d)}catch(g){throw console.error("JSON.parse error: body fetched from unpkg.com: ",d),g}return f.version}throw new at("Only `major.minor.patch` versions are supported by Accelerate.",{clientVersion:n})}async function qa(e,t){let r=await hd(e,t);return $a("version",r),r}function yd(e){return encodeURI(`https://unpkg.com/prisma@${e}/package.json`)}var ja=3,Hi=F("prisma:client:dataproxyEngine"),Ki=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}},Rr=class{constructor(t){this.name="DataProxyEngine";Fa(t),this.config=t,this.env={...t.env,...typeof process<"u"?process.env:{}},this.inlineSchema=La(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 Ki({apiKey:r,tracingHelper:this.tr
|
||
|
You may have to run ${Me("prisma generate")} for your changes to take effect.`,this.config.clientVersion);return t}}parseEngineResponse(t){if(!t)throw new B("Response from the Engine was empty",{clientVersion:this.config.clientVersion});try{return JSON.parse(t)}catch{throw new B("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 WeakRef(this),{adapter:r}=this.config;r&&Ce("Using driver adapter: %O",r),this.engine=new this.QueryEngineConstructor({datamodel:this.datamodel,env:process.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 R(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",xd(r)?this.logEmitter.emit("query",{timestamp:new Date,query:r.query,params:r.params,duration:Number(r.duration_ms),target:r.module_path}):Pd(r)?this.loggerRustPanic=new le(Xi(this,`${r.message}: ${r.reason} in ${r.file}:${r.line}:${r.column}`),this.config.clientVersion):this.logEmitter.emit(r.level,{timestamp:new Date,message:r.message,target:r.module_path})}}parseInitError(t){try{return JSON.parse(t)}catch{}return t}parseRequestError(t){try{return JSON.parse(t)}catch{}return t}onBeforeExit(){throw new Error('"beforeExit" hook is not applicable to the library engine since Prisma 5.0.0, it is only relevant and implemented for the binary engine. Please add your event listener to the `process` object directly instead.')}async start(){if(await this.libraryInstantiationPromise,await this.libraryStoppingPromise,this.libraryStartingPromise)return Ce(`library already starting, this.libraryStarted: ${this.libraryStarted}`),this.libraryStartingPromise;if(this.libraryStarted)return;let t=async()=>{Ce("library starting");try{let r={traceparent:this.config.tracingHelper.getTraceParent()};await this.engine?.connect(JSON.stringify(r)),this.libraryStarted=!0,Ce("library started")}catch(r){let n=this.parseInitError(r.message);throw typeof n=="string"?r:new R(n.message,this.config.clientVersion,n.error_code)}finally{this.libraryStartingPromise=void 0}};return this.libraryStartingPromise=this.config.tracingHelper.runInChildSpan("connect",t),this.libraryStartingPromise}async stop(){if(await this.libraryStartingPromise,await this.executingQueryPromise,this.libraryStoppingPromise)return Ce("library is already stopping"),this.libraryStoppingPromise;if(!this.libraryStarted)return;let t=async()=>{await new Promise(n=>setTimeout(n,5)),Ce("library stopping");let r={traceparent:this.config.tracingHelper.getTraceParent()};await this.engine?.disconnect(JSON.stringify(r)),this.libraryStarted=!1,this.libraryStoppingPromise=void 0,Ce("library stopped")};return this.libraryStoppingPromise=this.config.tracingHelper.runInChildSpan("disconnect",t),this.libraryStoppingPromise}version(){return this.versionInfo=this.library?.version(),this.versionInfo?.version??"unknown"}debugPanic(t){return this.library?.debugPanic(t)}async request(t,{traceparent:r,interactiveTransaction:n}){Ce(`sending request, this.libraryStarted: ${this.libraryStarted}`);let i=JSON.stringify({traceparent:r}),o=JSON.stringify(t);try{await this.start(),this.executingQueryPromise=this.engine?.query(o,i,n?.id),this.lastQuery=o;let s=this.parseEngineResponse(await this.executingQueryPromise);if(s.errors)throw s.errors.length===1?this.buildQueryError(s.errors[0]):new B(JSON.stringify(s.errors),{clientVersion:this.config.clientVersion});if(this.loggerRustPanic)throw this.loggerRustPanic;return{data:s,elapsed:0}}catch(s){if(s instanceof R)throw s;if(s.code==="GenericFailure"&&s.message?.st
|
||
|
${a.backtrace}`,{clientVersion:this.config.clientVersion})}}async requestBatch(t,{transaction:r,traceparent:n}){Ce("requestBatch");let i=Et(t,r);await this.start(),this.lastQuery=JSON.stringify(i),this.executingQueryPromise=this.engine.query(this.lastQuery,JSON.stringify({traceparent:n}),Va(r));let o=await this.executingQueryPromise,s=this.parseEngineResponse(o);if(s.errors)throw s.errors.length===1?this.buildQueryError(s.errors[0]):new B(JSON.stringify(s.errors),{clientVersion:this.config.clientVersion});let{batchResult:a,errors:l}=s;if(Array.isArray(a))return a.map(u=>u.errors&&u.errors.length>0?this.loggerRustPanic??this.buildQueryError(u.errors[0]):{data:u,elapsed:0});throw l&&l.length===1?new Error(l[0].error):new Error(JSON.stringify(s))}buildQueryError(t){if(t.user_facing_error.is_panic)return new le(Xi(this,t.user_facing_error.message),this.config.clientVersion);let r=this.getExternalAdapterError(t.user_facing_error);return r?r.error:ot(t,this.config.clientVersion,this.config.activeProvider)}getExternalAdapterError(t){if(t.error_code===wd&&this.config.adapter){let r=t.meta?.id;Hr(typeof r=="number","Malformed external JS error received from the engine");let n=this.config.adapter.errorRegistry.consumeError(r);return Hr(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 vd(e){return typeof e=="object"&&e!==null&&e.error_code!==void 0}function Xi(e,t){return Da({binaryTarget:e.binaryTarget,title:t,version:e.config.clientVersion,engineVersion:e.versionInfo?.commit,database:e.config.activeProvider,query:e.lastQuery})}function Ja({copyEngine:e=!0},t){let r;try{r=Dt({inlineDatasources:t.inlineDatasources,overrideDatasources:t.overrideDatasources,env:{...t.env,...process.env},clientVersion:t.clientVersion})}catch{}e&&r?.startsWith("prisma://")&&Zt("recommend--no-engine","In production, we recommend using `prisma generate --no-engine` (See: `prisma generate --help`)");let n=Ht(t.generator),i=!!(r?.startsWith("prisma://")||!e),o=!!t.adapter,s=n==="library",a=n==="binary";if(i&&o||o&&!1){let l;throw e?r?.startsWith("prisma://")?l=["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."]:l=["Prisma Client was configured to use both the `adapter` and Accelerate, please chose one."]:l=["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(l.join(`
|
||
|
`),{clientVersion:t.clientVersion})}if(i)return new Rr(t);if(s)return new Cr(t);throw new J("Invalid client engine type, please use `library` or `binary`",{clientVersion:t.clientVersion})}function Cn({generator:e}){return e?.previewFeatures??[]}function Nt(e){return e.substring(0,1).toLowerCase()+e.substring(1)}var Za=k(eo());function za(e,t,r){let n=Ya(e),i=Td(n),o=Cd(i);o?Sn(o,t,r):t.addErrorMessage(()=>"Unknown error")}function Ya(e){return e.errors.flatMap(t=>t.kind==="Union"?Ya(t):[t])}function Td(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:Rd(o.argument.typeNames,n.argument.typeNames)}}):t.set(i,n)}return r.push(...t.values()),r}function Rd(e,t){return[...new Set(e.concat(t))]}function Cd(e){return yi(e,(t,r)=>{let n=Ha(t),i=Ha(r);return n!==i?n-i:Ka(t)-Ka(r)})}function Ha(e){let t=0;return Array.isArray(e.selectionPath)&&(t+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(t+=e.argumentPath.length),t}function Ka(e){switch(e.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}var ue=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)}};var Sr=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(Ct,this.fields).newLine()}).write(r("}")).addMarginSymbol(r("+"))}};function Sn(e,t,r){switch(e.kind){case"MutuallyExclusiveFields":Sd(e,t);break;case"IncludeOnScalar":Ad(e,t);break;case"EmptySelection":Id(e,t,r);break;case"UnknownSelectionField":_d(e,t);break;case"UnknownArgument":Ld(e,t);break;case"UnknownInputField":Fd(e,t);break;case"RequiredArgumentMissing":Nd(e,t);break;case"InvalidArgumentType":Md(e,t);break;case"InvalidArgumentValue":$d(e,t);break;case"ValueTooLarge":qd(e,t);break;case"SomeFieldsMissing":jd(e,t);break;case"TooManyFieldsGiven":Vd(e,t);break;case"Union":za(e,t,r);break;default:throw new Error("not implemented: "+e.kind)}}function Sd(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 Ad(e,t){let[r,n]=Ar(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 ue(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)}. ${Ir(s)}`:a+=".",a+=`
|
||
|
Note that ${s.bold("include")} statements only accept relation fields.`,a})}function Id(e,t,r){let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getField("omit")?.value.asObject();if(i){Od(e,t,i);return}if(n.hasField("select")){kd(e,t);return}}if(r?.[Nt(e.outputType.name)]){Dd(e,t);return}t.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function Od(e,t,r){r.removeAllFields();for(let n of e.outputType.fields)r.addSuggestion(new ue(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 kd(e,t){let r=e.outputType,n=t.arguments.getDeepSelectionParent(e.selectionPath)?.value,i=n?.isEmpty()??!1;n&&(n.removeAllFields(),tl(n,r)),t.addErrorMessage(o=>i?`The ${o.red("`select`")} statement for type ${o.bold(r.name)} must not be empty. ${Ir(o)}`:`The ${o.red("`select`")} statement for type ${o.bold(r.name)} needs ${o.bold("at least one truthy value")}.`)}function Dd(e,t){let r=new Sr;for(let i of e.outputType.fields)i.isRelation||r.addField(i.name,"false");let n=new ue("omit",r).makeRequired();if(e.selectionPath.length===0)t.arguments.addSuggestion(n);else{let[i,o]=Ar(e.selectionPath),a=t.arguments.getDeepSelectionParent(i)?.value.asObject()?.getField(o);if(a){let l=a?.value.asObject()??new At;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 _d(e,t){let[r,n]=Ar(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(),tl(s,e.outputType)):a?.hasField(n)?(o="include",a.getField(n)?.markAsError(),Bd(a,e.outputType)):l?.hasField(n)&&(o="omit",l.getField(n)?.markAsError(),Ud(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(Ir(s)),a.join(" ")})}function Ld(e,t){let r=e.argumentPath[0],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&(n.getField(r)?.markAsError(),Gd(n,e.arguments)),t.addErrorMessage(i=>Xa(i,r,e.arguments.map(o=>o.name)))}function Fd(e,t){let[r,n]=Ar(e.argumentPath),i=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(i){i.getDeepField(e.argumentPath)?.markAsError();let o=i.getDeepFieldValue(r)?.asObject();o&&rl(o,e.inputType)}t.addErrorMessage(o=>Xa(o,n,e.inputType.fields.map(s=>s.name)))}function Xa(e,t,r){let n=[`Unknown argument \`${e.red(t)}\`.`],i=Jd(t,r);return i&&n.push(`Did you mean \`${e.green(i)}\`?`),r.length>0&&n.push(Ir(e)),n.join(" ")}function Nd(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]=Ar(e.argumentPath),s=new Sr,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 ue(o,s).makeRequired())}else{let l=e.inputTypes.map(el).join(" | ");a.addSuggestion(new ue(o,l).makeRequired())}}function el(e){return e.kind==="list"?`${el(e.elementType)}[]`:e.name}function Md(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=An("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 $d(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 no=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if(r instanceof ir)n=r.sql,i={values:Mt(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:Mt(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:Mt(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:Mt(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=al(r),i={values:Mt(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?ml(`prisma.${e}(${n}, ${i.values})`):ml(`prisma.${e}(${n})`),{query:n,parameters:i}},fl={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new ie(t,r)}},gl={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};function io(e){return function(r){let n,i=(o=e)=>{try{return o===void 0||o?.kind==="itx"?n??=hl(r(o)):hl(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 hl(e){return typeof e.then=="function"?e:Promise.resolve(e)}var yl={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},async createEngineSpan(){},getActiveContext(){},runInChildSpan(e,t){return t()}},oo=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??yl}};function bl(e){return e.includes("tracing")?new oo:yl}function El(e,t=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--e===0&&r(t()),i?.(n)}}}function wl(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)}var On=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}};var vl=k(fi());function kn(e){return typeof e.batchRequestIdx=="number"}function Dn(e){return e===null?e:Array.isArray(e)?e.map(Dn):typeof e=="object"?om(e)?sm(e):ht(e,Dn):e}function om(e){return e!==null&&typeof e=="object"&&typeof e.$type=="string"}function sm({$type:e,value:t}){switch(e){case"BigInt":return BigInt(t);case"Bytes":return Buffer.from(t,"base64");case"DateTime":return new Date(t);case"Decimal":return new ve(t);case"Json":return JSON.parse(t);default:De(t,"Unknown tagged value")}}function xl(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(so(e.query.arguments)),t.push(so(e.query.selection)),t.join("")}function so(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${so(n)})`:r}).join(" ")})`}var am={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 ao(e){return am[e]}var _n=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,process.nextTick(()=>{this.dispatchBatches(),this.tickActive=!1}))),new Promise((n,i)=>{this.batches[r].push({request:t,resolve:n,reject:i})})):this.options.singleLoader(t)}dispatchBatches(){for(let t in this.batches){let
|
||
|
Read more at https://pris.ly/d/client-constructor`),this.name="PrismaClientConstructorValidationError"}get[Symbol.toStringTag](){return"PrismaClientConstructorValidationError"}};w(L,"PrismaClientConstructorValidationError");var Al=["datasources","datasourceUrl","errorFormat","adapter","log","transactionOptions","omit","__internal"],Il=["pretty","colorless","minimal"],Ol=["info","query","warn","error"],fm={datasources:(e,{datasourceNames:t})=>{if(e){if(typeof e!="object"||Array.isArray(e))throw new L(`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=$t(r,t)||` Available datasources: ${t.join(", ")}`;throw new L(`Unknown datasource ${r} provided to PrismaClient constructor.${i}`)}if(typeof n!="object"||Array.isArray(n))throw new L(`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 L(`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 L(`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 L('"adapter" property must not be undefined, use null to conditionally disable driver adapters.');if(!Cn(t).includes("driverAdapters"))throw new L('"adapter" property can only be provided to PrismaClient constructor when "driverAdapters" preview feature is enabled.');if(Ht()==="binary")throw new L('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 L(`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 L(`Invalid value ${JSON.stringify(e)} for "errorFormat" provided to PrismaClient constructor.`);if(!Il.includes(e)){let t=$t(e,Il);throw new L(`Invalid errorFormat ${e} provided to PrismaClient constructor.${t}`)}}},log:e=>{if(!e)return;if(!Array.isArray(e))throw new L(`Invalid value ${JSON.stringify(e)} for "log" provided to PrismaClient constructor.`);function t(r){if(typeof r=="string"&&!Ol.includes(r)){let n=$t(r,Ol);throw new L(`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=$t(i,o);throw new L(`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 L(`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 L(`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 L(`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 L('"omit" option is expected to be an object.');if(e===null)throw new L('"omit" option can not be `null`');let r=[];for(let[n,i]of Object.entries(e)){let o=hm(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 L(ym(e,r))},__internal:e=>{if(!e)return;let t=["debug","engine","configOverride"];if(typeof e!="object")throw new L(`Invalid value ${JSON.stringify(e)} for "__internal" to PrismaClient constructor`);for(let[r]of Object.entries(e))if(!t.includes(r)){let n=$t(r,t);throw new L(`Invalid property ${JSON.stringify(r)} for "__internal" provided to PrismaClient constructor.${n}`)}}};function _l(e,t){for(let[r,n]of Object.entries(e)){if(!Al.includes(r)){let i=$t(r,Al);throw new L(`Unknown property ${r} provided to PrismaClient constructor.${i}`)}fm[r](n,t)}if(e.datasourceUrl&&e.datasources)throw new L('Can not use "datasourceUrl" and "datasources" options at the same time. Pick one of them')}function $t(e,t){if(t.length===0||typeof e!="string")return"";let r=gm(e,t);return r?` Did you mean "${r}"?`:""}function gm(e,t){if(t.length===0)return null;let r=t.map(i=>({value:i,distance:(0,Dl.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 hm(e,t){return kl(t.models,e)??kl(t.types,e)}function kl(e,t){let r=Object.keys(e).find(n=>Nt(n)===t);if(r)return e[r]}function ym(e,t){let r=It(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}=fn(r,"colorless");return`Error validating "omit" option:
|
||
|
|
||
|
${i}
|
||
|
|
||
|
${n}`}function Ll(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(c=>{n[u]=c,a()},c=>{if(!kn(c)){l(c);return}c.batchRequestIdx===u?l(c):(i||(i=c),a())})})}var Xe=F("prisma:client");typeof globalThis=="object"&&(globalThis.NODE_CLIENT=!0);var bm={requestArgsToMiddlewareArgs:e=>e,middlewareArgsToRequestArgs:e=>e},Em=Symbol.for("prisma.client.transaction.id"),wm={id:0,nextId(){return++this.id}};function jl(e){class t{constructor(n){this._originalClient=this;this._middlewares=new On;this._createPrismaPromise=io();this.$extends=ta;e=n?.__internal?.configOverride?.(e)??e,ba(e),n&&_l(n,e);let i=new $l.EventEmitter().on("error",()=>{});this._extensions=wn.empty(),this._previewFeatures=Cn(e),this._clientVersion=e.clientVersion??Sl,this._activeProvider=e.activeProvider,this._globalOmit=n?.omit,this._tracingHelper=bl(this._previewFeatures);let o={rootEnvPath:e.relativeEnvPaths.rootEnvPath&&kr.default.resolve(e.dirname,e.relativeEnvPaths.rootEnvPath),schemaEnvPath:e.relativeEnvPaths.schemaEnvPath&&kr.default.resolve(e.dirname,e.relativeEnvPaths.schemaEnvPath)},s;if(n?.adapter){s=vi(n.adapter);let l=e.activeProvider==="postgresql"?"postgres":e.activeProvider;if(s.provider!==l)throw new R(`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 R("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=!s&&Wt(o,{conflictCheck:"none"})||e.injectableEdgeEnv?.();try{let l=n??{},u=l.__internal??{},c=u.debug===!0;c&&F.enable("prisma:client");let p=kr.default.resolve(e.dirname,e.relativePath);ql.default.existsSync(p)||(p=e.dirname),Xe("dirname",e.dirname),Xe("relativePath",e.relativePath),Xe("cwd",p);let d=u.engine||{};if(l.errorFormat?this._errorFormat=l.errorFormat:process.env.NODE_ENV==="production"?this._errorFormat="minimal":process.env.NO_COLOR?this._errorFormat="colorless":this._errorFormat="colorless",this._runtimeDataModel=e.runtimeDataModel,this._engineConfig={cwd:p,dirname:e.dirname,enableDebugLogs:c,allowTriggerPanic:d.allowTriggerPanic,datamodelPath:kr.default.join(e.dirname,e.filename??"schema.prisma"),prismaPath:d.binaryPath??void 0,engineEndpoint:d.endpoint,generator:e.generator,showColors:this._errorFormat==="pretty",logLevel:l.log&&wl(l.log),logQueries:l.log&&!!(typeof l.log=="string"?l.log==="query":l.log.find(f=>typeof f=="string"?f==="query":f.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:Ea(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:Et,prismaGraphQLToJSError:ot,PrismaClientUnknownRequestError:B,PrismaClientInitializationError:R,PrismaClientKnownRequestError:V,debug:F("prisma:client:accelerateEngine"),engineVersion:Nl.version,clientVersion:e.clientVersion}},Xe("clientVersion",e.clientVersion),this._engine=Ja(e,this._engineConfig),this._requestHandler=new Ln(this,i),l.log)for(let f of l.log){let g=typeof f=="string"?f:f.emit==="stdout"?f.level:null;g&&this.$on(g,h=>{Yt.log(`${Yt.tags[g]??""}`,h.message||h.query)})}this._metrics=new yt(this._engine)}catch(l){throw l.clientVersion=this._clientVersion,l}return this._appliedParent=cr(this)}get[Symbol.toStringTag](
|
||
|
`)),c?.kind==="batch"&&await c.lock,this._requestHandler.request({protocolQuery:h,modelName:l,action:a,clientMethod:i,dataPath:o,callsite:s,args:n,extensions:this._extensions,transaction:c,unpacker:p,otelParentCtx:d,otelChildCtx:this._tracingHelper.getActiveContext(),globalOmit:this._globalOmit,customDataProxyFetch:f})}catch(g){throw g.clientVersion=this._clientVersion,g}}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 Fl(e,t){return xm(e)?[new ie(e,t),fl]:[e,gl]}function xm(e){return Array.isArray(e)&&Array.isArray(e.raw)}var Pm=new Set(["toJSON","$$typeof","asymmetricMatch",Symbol.iterator,Symbol.toStringTag,Symbol.isConcatSpreadable,Symbol.toPrimitive]);function Vl(e){return new Proxy(e,{get(t,r){if(r in t)return t[r];if(!Pm.has(r))throw new TypeError(`Invalid enum value: ${String(r)}`)}})}function Bl(e){Wt(e,{conflictCheck:"warn"})}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});
|
||
|
/*! Bundled license information:
|
||
|
|
||
|
decimal.js/decimal.mjs:
|
||
|
(*!
|
||
|
* decimal.js v10.4.3
|
||
|
* An arbitrary-precision Decimal type for JavaScript.
|
||
|
* https://github.com/MikeMcl/decimal.js
|
||
|
* Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
|
||
|
* MIT Licence
|
||
|
*)
|
||
|
*/
|
||
|
//# sourceMappingURL=library.js.map
|