147 lines
198 KiB
JavaScript
147 lines
198 KiB
JavaScript
|
|
|
||
|
|
/* !!! This is code generated by Prisma. Do not edit directly. !!!
|
||
|
|
/* eslint-disable */
|
||
|
|
"use strict";var yu=Object.create;var jt=Object.defineProperty;var bu=Object.getOwnPropertyDescriptor;var Eu=Object.getOwnPropertyNames;var wu=Object.getPrototypeOf,xu=Object.prototype.hasOwnProperty;var Do=(e,r)=>()=>(e&&(r=e(e=0)),r);var ue=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),tr=(e,r)=>{for(var t in r)jt(e,t,{get:r[t],enumerable:!0})},Oo=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Eu(r))!xu.call(e,i)&&i!==t&&jt(e,i,{get:()=>r[i],enumerable:!(n=bu(r,i))||n.enumerable});return e};var O=(e,r,t)=>(t=e!=null?yu(wu(e)):{},Oo(r||!e||!e.__esModule?jt(t,"default",{value:e,enumerable:!0}):t,e)),vu=e=>Oo(jt({},"__esModule",{value:!0}),e);var hi=ue((_g,is)=>{"use strict";is.exports=(e,r=process.argv)=>{let t=e.startsWith("-")?"":e.length===1?"-":"--",n=r.indexOf(t+e),i=r.indexOf("--");return n!==-1&&(i===-1||n<i)}});var as=ue((Ng,ss)=>{"use strict";var Fc=require("node:os"),os=require("node:tty"),de=hi(),{env:G}=process,Qe;de("no-color")||de("no-colors")||de("color=false")||de("color=never")?Qe=0:(de("color")||de("colors")||de("color=true")||de("color=always"))&&(Qe=1);"FORCE_COLOR"in G&&(G.FORCE_COLOR==="true"?Qe=1:G.FORCE_COLOR==="false"?Qe=0:Qe=G.FORCE_COLOR.length===0?1:Math.min(parseInt(G.FORCE_COLOR,10),3));function yi(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function bi(e,r){if(Qe===0)return 0;if(de("color=16m")||de("color=full")||de("color=truecolor"))return 3;if(de("color=256"))return 2;if(e&&!r&&Qe===void 0)return 0;let t=Qe||0;if(G.TERM==="dumb")return t;if(process.platform==="win32"){let n=Fc.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in G)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in G)||G.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in G)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(G.TEAMCITY_VERSION)?1:0;if(G.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in G){let n=parseInt((G.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(G.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(G.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(G.TERM)||"COLORTERM"in G?1:t}function Mc(e){let r=bi(e,e&&e.isTTY);return yi(r)}ss.exports={supportsColor:Mc,stdout:yi(bi(!0,os.isatty(1))),stderr:yi(bi(!0,os.isatty(2)))}});var cs=ue((Lg,us)=>{"use strict";var $c=as(),br=hi();function ls(e){if(/^\d{3,4}$/.test(e)){let t=/(\d{1,2})(\d{2})/.exec(e)||[];return{major:0,minor:parseInt(t[1],10),patch:parseInt(t[2],10)}}let r=(e||"").split(".").map(t=>parseInt(t,10));return{major:r[0],minor:r[1],patch:r[2]}}function Ei(e){let{CI:r,FORCE_HYPERLINK:t,NETLIFY:n,TEAMCITY_VERSION:i,TERM_PROGRAM:o,TERM_PROGRAM_VERSION:s,VTE_VERSION:a,TERM:l}=process.env;if(t)return!(t.length>0&&parseInt(t,10)===0);if(br("no-hyperlink")||br("no-hyperlinks")||br("hyperlink=false")||br("hyperlink=never"))return!1;if(br("hyperlink=true")||br("hyperlink=always")||n)return!0;if(!$c.supportsColor(e)||e&&!e.isTTY)return!1;if("WT_SESSION"in process.env)return!0;if(process.platform==="win32"||r||i)return!1;if(o){let u=ls(s||"");switch(o){case"iTerm.app":return u.major===3?u.minor>=1:u.major>3;case"WezTerm":return u.major>=20200620;case"vscode":return u.major>1||u.major===1&&u.minor>=72;case"ghostty":return!0}}if(a){if(a==="0.50.0")return!1;let u=ls(a);return u.major>0||u.minor>=50}switch(l){case"alacritty":return!0}return!1}us.exports={supportsHyperlink:Ei,stdout:Ei(process.stdout),stderr:Ei(process.stderr)}});var ps=ue((Kg,qc)=>{qc.exports={name:"@prisma/internals",version:"6.18.0",description:"This package is intended for Prisma's internal use",main:"dist/index.js",types:"dist/index.d.ts",repository:{type:"git",url:"https://github.com/prisma/prisma.git",directory:"packages/internals"},homepage:"https://www.prisma.io",author:"Tim Suchanek <suchanek@prisma.io>",bugs:"https://github.com/prisma/prisma/issues",license:"Apache-2.0",scripts:{dev:"DEV=true tsx helpers/build.ts",build:"tsx helpers/build.ts",test:"dotenv -e ../../.d
|
||
|
|
`);let n;for(;(n=sp.exec(t))!=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")),r[i]=o}return r}function lp(e){let r=Rs(e),t=B.configDotenv({path:r});if(!t.parsed){let s=new Error(`MISSING_DATA: Cannot parse ${r} for an unknown reason`);throw s.code="MISSING_DATA",s}let n=Ss(e).split(","),i=n.length,o;for(let s=0;s<i;s++)try{let a=n[s].trim(),l=cp(t,a);o=B.decrypt(l.ciphertext,l.key);break}catch(a){if(s+1>=i)throw a}return B.parse(o)}function up(e){console.log(`[dotenv@${Ts}][WARN] ${e}`)}function ot(e){console.log(`[dotenv@${Ts}][DEBUG] ${e}`)}function Ss(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function cp(e,r){let t;try{t=new URL(r)}catch(a){if(a.code==="ERR_INVALID_URL"){let l=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw l.code="INVALID_DOTENV_KEY",l}throw a}let n=t.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=t.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let o=`DOTENV_VAULT_${i.toUpperCase()}`,s=e.parsed[o];if(!s){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${o} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:s,key:n}}function Rs(e){let r=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let t of e.path)Fi.existsSync(t)&&(r=t.endsWith(".vault")?t:`${t}.vault`);else r=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else r=Mi.resolve(process.cwd(),".env.vault");return Fi.existsSync(r)?r:null}function Ps(e){return e[0]==="~"?Mi.join(np.homedir(),e.slice(1)):e}function pp(e){!!(e&&e.debug)&&ot("Loading env from encrypted .env.vault");let t=B._parseVault(e),n=process.env;return e&&e.processEnv!=null&&(n=e.processEnv),B.populate(n,t,e),{parsed:t}}function dp(e){let r=Mi.resolve(process.cwd(),".env"),t="utf8",n=!!(e&&e.debug);e&&e.encoding?t=e.encoding:n&&ot("No encoding is specified. UTF-8 is used by default");let i=[r];if(e&&e.path)if(!Array.isArray(e.path))i=[Ps(e.path)];else{i=[];for(let l of e.path)i.push(Ps(l))}let o,s={};for(let l of i)try{let u=B.parse(Fi.readFileSync(l,{encoding:t}));B.populate(s,u,e)}catch(u){n&&ot(`Failed to load ${l} ${u.message}`),o=u}let a=process.env;return e&&e.processEnv!=null&&(a=e.processEnv),B.populate(a,s,e),o?{parsed:s,error:o}:{parsed:s}}function mp(e){if(Ss(e).length===0)return B.configDotenv(e);let r=Rs(e);return r?B._configVault(e):(up(`You set DOTENV_KEY but you are missing a .env.vault file at ${r}. Did you forget to build it?`),B.configDotenv(e))}function fp(e,r){let t=Buffer.from(r.slice(-64),"hex"),n=Buffer.from(e,"base64"),i=n.subarray(0,12),o=n.subarray(-16);n=n.subarray(12,-16);try{let s=ip.createDecipheriv("aes-256-gcm",t,i);return s.setAuthTag(o),`${s.update(n)}${s.final()}`}catch(s){let a=s instanceof RangeError,l=s.message==="Invalid key length",u=s.message==="Unsupported state or unable to authenticate data";if(a||l){let c=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw c.code="INVALID_DOTENV_KEY",c}else if(u){let c=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw c.code="DECRYPTION_FAILED",c}else throw s}}function gp(e,r,t={}){let n=!!(t&&t.debug),i=!!(t&&t.override);if(typeof r!="object"){let o=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw o.code="OBJECT_REQUIRED",o}for(let o of Object.keys(r))Object.prototype.hasOwnProperty.call(e,o)?(i===!0&&(e[o]=r[o]),n&&ot(i===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):e[o]=r[o]}var B={configDotenv:dp,_configVault:pp,_parseVault:lp,config:mp,decrypt:fp,parse:ap,populate:gp};_e.exports.configDotenv=B.configDotenv;_e.exports._configVault=B._configVault;_e.exports._parseVault=B._parseVault;_e.exports.config=B.config;_e.exports.decrypt=B.decrypt;_e.exports.pars
|
||
|
|
`);return r.length<e?r:r.slice(-e)}function Uo(){Yr.length=0}var gr=N;var Go=O(require("node:fs"));function ai(){let e=process.env.PRISMA_QUERY_ENGINE_LIBRARY;if(!(e&&Go.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 li=["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 Ut="libquery_engine";function Gt(e,r){let t=r==="url";return e.includes("windows")?t?"query_engine.dll.node":`query_engine-${e}.dll.node`:e.includes("darwin")?t?`${Ut}.dylib.node`:`${Ut}-${e}.dylib.node`:t?`${Ut}.so.node`:`${Ut}-${e}.so.node`}var Ko=O(require("node:child_process")),mi=O(require("node:fs/promises")),Ht=O(require("node:os"));var Oe=Symbol.for("@ts-pattern/matcher"),Gu=Symbol.for("@ts-pattern/isVariadic"),Wt="@ts-pattern/anonymous-select-key",ui=e=>!!(e&&typeof e=="object"),Qt=e=>e&&!!e[Oe],Ee=(e,r,t)=>{if(Qt(e)){let n=e[Oe](),{matched:i,selections:o}=n.match(r);return i&&o&&Object.keys(o).forEach(s=>t(s,o[s])),i}if(ui(e)){if(!ui(r))return!1;if(Array.isArray(e)){if(!Array.isArray(r))return!1;let n=[],i=[],o=[];for(let s of e.keys()){let a=e[s];Qt(a)&&a[Gu]?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(r.length<n.length+i.length)return!1;let s=r.slice(0,n.length),a=i.length===0?[]:r.slice(-i.length),l=r.slice(n.length,i.length===0?1/0:-i.length);return n.every((u,c)=>Ee(u,s[c],t))&&i.every((u,c)=>Ee(u,a[c],t))&&(o.length===0||Ee(o[0],l,t))}return e.length===r.length&&e.every((s,a)=>Ee(s,r[a],t))}return Reflect.ownKeys(e).every(n=>{let i=e[n];return(n in r||Qt(o=i)&&o[Oe]().matcherType==="optional")&&Ee(i,r[n],t);var o})}return Object.is(r,e)},Ge=e=>{var r,t,n;return ui(e)?Qt(e)?(r=(t=(n=e[Oe]()).getSelectionKeys)==null?void 0:t.call(n))!=null?r:[]:Array.isArray(e)?Zr(e,Ge):Zr(Object.values(e),Ge):[]},Zr=(e,r)=>e.reduce((t,n)=>t.concat(r(n)),[]);function pe(e){return Object.assign(e,{optional:()=>Qu(e),and:r=>q(e,r),or:r=>Wu(e,r),select:r=>r===void 0?Qo(e):Qo(r,e)})}function Qu(e){return pe({[Oe]:()=>({match:r=>{let t={},n=(i,o)=>{t[i]=o};return r===void 0?(Ge(e).forEach(i=>n(i,void 0)),{matched:!0,selections:t}):{matched:Ee(e,r,n),selections:t}},getSelectionKeys:()=>Ge(e),matcherType:"optional"})})}function q(...e){return pe({[Oe]:()=>({match:r=>{let t={},n=(i,o)=>{t[i]=o};return{matched:e.every(i=>Ee(i,r,n)),selections:t}},getSelectionKeys:()=>Zr(e,Ge),matcherType:"and"})})}function Wu(...e){return pe({[Oe]:()=>({match:r=>{let t={},n=(i,o)=>{t[i]=o};return Zr(e,Ge).forEach(i=>n(i,void 0)),{matched:e.some(i=>Ee(i,r,n)),selections:t}},getSelectionKeys:()=>Zr(e,Ge),matcherType:"or"})})}function A(e){return{[Oe]:()=>({match:r=>({matched:!!e(r)})})}}function Qo(...e){let r=typeof e[0]=="string"?e[0]:void 0,t=e.length===2?e[1]:typeof e[0]=="string"?void 0:e[0];return pe({[Oe]:()=>({match:n=>{let i={[r??Wt]:n};return{matched:t===void 0||Ee(t,n,(o,s)=>{i[o]=s}),selections:i}},getSelectionKeys:()=>[r??Wt].concat(t===void 0?[]:Ge(t))})})}function ye(e){return typeof e=="number"}function Ve(e){return typeof e=="string"}function je(e){return typeof e=="bigint"}var eg=pe(A(function(e){return!0}));var Be=e=>Object.assign(pe(e),{startsWith:r=>{return Be(q(e,(t=r,A(n=>Ve(n)&&n.startsWith(t)))))
|
||
|
|
${JSON.stringify(a,null,2)}`),a}async function Zu(){let e="/etc/os-release";try{let r=await mi.default.readFile(e,{encoding:"utf-8"});return zu(r)}catch{return{targetDistro:void 0,familyDistro:void 0,originalDistro:void 0}}}function Xu(e){let r=/^OpenSSL\s(\d+\.\d+)\.\d+/.exec(e);if(r){let t=`${r[1]}.x`;return zo(t)}}function Wo(e){let r=/libssl\.so\.(\d)(\.\d)?/.exec(e);if(r){let t=`${r[1]}${r[2]??".0"}.x`;return zo(t)}}function zo(e){let r=(()=>{if(Xo(e))return e;let t=e.split(".");return t[1]="0",t.join(".")})();if(Yu.includes(r))return r}function ec(e){return hr(e).with({familyDistro:"musl"},()=>(ee('Trying platform-specific paths for "alpine"'),["/lib","/usr/lib"])).with({familyDistro:"debian"},({archFromUname:r})=>(ee('Trying platform-specific paths for "debian" (and "ubuntu")'),[`/usr/lib/${r}-linux-gnu`,`/lib/${r}-linux-gnu`])).with({familyDistro:"rhel"},()=>(ee('Trying platform-specific paths for "rhel"'),["/lib64","/usr/lib64"])).otherwise(({familyDistro:r,arch:t,archFromUname:n})=>(ee(`Don't know any platform-specific paths for "${r}" on ${t} (${n})`),[]))}async function rc(e){let r='grep -v "libssl.so.0"',t=await Jo(e);if(t){ee(`Found libssl.so file using platform-specific paths: ${t}`);let o=Wo(t);if(ee(`The parsed libssl version is: ${o}`),o)return{libssl:o,strategy:"libssl-specific-path"}}ee('Falling back to "ldconfig" and other generic paths');let n=await Yt(`ldconfig -p | sed "s/.*=>s*//" | sed "s|.*/||" | grep libssl | sort | ${r}`);if(n||(n=await Jo(["/lib64","/usr/lib64","/lib","/usr/lib"])),n){ee(`Found libssl.so file using "ldconfig" or other generic paths: ${n}`);let o=Wo(n);if(ee(`The parsed libssl version is: ${o}`),o)return{libssl:o,strategy:"ldconfig"}}let i=await Yt("openssl version -v");if(i){ee(`Found openssl binary with version: ${i}`);let o=Xu(i);if(ee(`The parsed openssl version is: ${o}`),o)return{libssl:o,strategy:"openssl-binary"}}return ee("Couldn't find any version of libssl or OpenSSL in the system"),{}}async function Jo(e){for(let r of e){let t=await tc(r);if(t)return t}}async function tc(e){try{return(await mi.default.readdir(e)).find(t=>t.startsWith("libssl.so.")&&!t.startsWith("libssl.so.0"))}catch(r){if(r.code==="ENOENT")return;throw r}}async function ir(){let{binaryTarget:e}=await Zo();return e}function nc(e){return e.binaryTarget!==void 0}async function fi(){let{memoized:e,...r}=await Zo();return r}var Kt={};async function Zo(){if(nc(Kt))return Promise.resolve({...Kt,memoized:!0});let e=await Yo(),r=ic(e);return Kt={...e,binaryTarget:r},{...Kt,memoized:!1}}function ic(e){let{platform:r,arch:t,archFromUname:n,libssl:i,targetDistro:o,familyDistro:s,originalDistro:a}=e;r==="linux"&&!["x64","arm64"].includes(t)&&Jt(`Prisma only officially supports Linux on amd64 (x86_64) and arm64 (aarch64) system architectures (detected "${t}" 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(r==="linux"&&i===void 0){let c=hr({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.");Jt(`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(r==="linux"&&o===void 0&&ee(`Distro is "${a}". Falling back to Prisma engines built for "${u}".`),r==="darwin"&&t==="arm64")return"darwin-arm64";if(r==="darwin")return"darwin";if(r==="win32")return"windows";if(r==="freebsd")return o;if(r==="openbsd")return"openbsd";if(r==="netbsd")return"netbsd";if(r==="linux"&&o==="nixos")return"linux-nixos";if(r==="linux"&&t==="arm64")return`${o==="musl"?"linux-musl-arm64":"linux-arm64"}-openssl-${i||l}`;if(r==="linux"&&t==="arm")return`linux-arm-openssl-${i||l}`;if(r==="linux"&&o==="musl"){let c="linux-musl";return!i||Xo(i)?c:`${c}-openssl-${i}`}return r==="linux"&&o&&i?`${o}-openssl-${i}`:(r!=="linux"&&Jt(`Prisma detected unknown OS "${r}" and may not work as expected. Defaulting to "linux".`),i?`${u}-openssl-${i}`:o?`${o}-openssl-${l}`:`${u}-openssl-${l}`)}async function oc(e){try{return await e()}catch{return}}function Yt(e){return oc(async()=>{let r=await Hu(e);return ee(`Command "${e}" successfully returned "${r.stdout}"`),r.stdout})}async function sc(){return typeof Ht.default.machine=="function"?Ht.default.machine():(await Yt("uname -m"))?.trim()}function Xo(e){return e.startsWith("1.")}var Xt={};tr(Xt,{beep:()=>kc,clearScreen:()=>Cc,clearTerminal:()=>Ic,cursorBackward:()=>mc,cursorDown:()=>pc,cursorForward:()=>dc,cursorGetPosition:()=>hc,cursorHide:()=>Ec,cursorLeft:()=>ts,cursorMove:()=>cc,cursorNextLine:()=>yc,cursorPrevLine:()=>bc,cursorRestorePosition:()=>gc,cursorSavePosition:()=>fc,cursorShow:()=>wc,cursorTo:()=>uc,cursorUp:()=>rs,enterAlternativeScreen:()=>Dc,eraseDown:()=>Tc,eraseEndLine:()=>vc,eraseLine:()=>ns,eraseLines:()=>xc,eraseScreen:()=>gi,eraseStartLine:()=>Pc,eraseUp:()=>Sc,exitAlternativeScreen:()=>Oc,iTerm:()=>Lc,image:()=>Nc,link:()=>_c,scrollDown:()=>Ac,scrollUp:()=>Rc});var Zt=O(require("node:process"),1);var zt=globalThis.window?.document!==void 0,gg=globalThis.process?.versions?.node!==void 0,hg=globalThis.process?.versions?.bun!==void 0,yg=globalThis.Deno?.version?.deno!==void 0,bg=globalThis.process?.versions?.electron!==void 0,Eg=globalThis.navigator?.userAgent?.includes("jsdom")===!0,wg=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,xg=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,vg=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,Pg=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,Xr=globalThis.navigator?.userAgentData?.platform,Tg=Xr==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",Sg=Xr==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",Rg=Xr==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",Ag=Xr==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),Cg=Xr==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var C="\x1B[",rt="\x1B]",yr="\x07",et=";",es=!zt&&Zt.default.env.TERM_PROGRAM==="Apple_Terminal",ac=!zt&&Zt.default.platform==="win32",lc=zt?()=>{throw new Error("`process.cwd()` only works in Node.js, not the browser.")}:Zt.default.cwd,uc=(e,r)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");return typeof r!="number"?C+(e+1)+"G":C+(r+1)+et+(e+1)+"H"},cc=(e,r)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");let t="";return e<0?t+=C+-e+"D":e>0&&(t+=C+e+"C"),r<0?t+=C+-r+"A":r>0&&(t+=C+r+"B"),t},rs=(e=1)=>C+e+"A",pc=(e=1)=>C+e+"B",dc=(e=1)=>C+e+"C",mc=(e=1)=>C+e+"D",ts=C+"G",fc=es?"\x1B7":C+"s",gc=es?"\x1B8":C+"u",hc=C+"6n",yc=C+"E",bc=C+"F",Ec=C+"?25l",wc=C+"?25h",xc=e=>{let r="";for(let t=0;t<e;t++)r+=ns+(t<e-1?rs():"");return e&&(r+=ts),r},vc=C+"K",Pc=C+"1K",ns=C+"2K",Tc=C
|
||
|
|
${s}
|
||
|
|
|
||
|
|
Details: ${r.message}`}var ys=O(hs(),1);function Ci(e){let r=(0,ys.default)(e);if(r===0)return e;let t=new RegExp(`^[ \\t]{${r}}`,"gm");return e.replace(t,"")}var bs="prisma+postgres",sn=`${bs}:`;function an(e){return e?.toString().startsWith(`${sn}//`)??!1}function Ii(e){if(!an(e))return!1;let{host:r}=new URL(e);return r.includes("localhost")||r.includes("127.0.0.1")||r.includes("[::1]")}var ws=O(Di());function ki(e){return String(new Oi(e))}var Oi=class{constructor(r){this.config=r}toString(){let{config:r}=this,t=r.provider.fromEnvVar?`env("${r.provider.fromEnvVar}")`:r.provider.value,n=JSON.parse(JSON.stringify({provider:t,binaryTargets:Kc(r.binaryTargets)}));return`generator ${r.name} {
|
||
|
|
${(0,ws.default)(Hc(n),2)}
|
||
|
|
}`}};function Kc(e){let r;if(e.length>0){let t=e.find(n=>n.fromEnvVar!==null);t?r=`env("${t.fromEnvVar}")`:r=e.map(n=>n.native?"native":n.value)}else r=void 0;return r}function Hc(e){let r=Object.keys(e).reduce((t,n)=>Math.max(t,n.length),0);return Object.entries(e).map(([t,n])=>`${t.padEnd(r)} = ${Yc(n)}`).join(`
|
||
|
|
`)}function Yc(e){return JSON.parse(JSON.stringify(e,(r,t)=>Array.isArray(t)?`[${t.map(n=>JSON.stringify(n)).join(", ")}]`:JSON.stringify(t)))}var nt={};tr(nt,{error:()=>Xc,info:()=>Zc,log:()=>zc,query:()=>ep,should:()=>xs,tags:()=>tt,warn:()=>_i});var tt={error:ce("prisma:error"),warn:Ie("prisma:warn"),info:De("prisma:info"),query:nr("prisma:query")},xs={warn:()=>!process.env.PRISMA_DISABLE_WARNINGS};function zc(...e){console.log(...e)}function _i(e,...r){xs.warn()&&console.warn(`${tt.warn} ${e}`,...r)}function Zc(e,...r){console.info(`${tt.info} ${e}`,...r)}function Xc(e,...r){console.error(`${tt.error} ${e}`,...r)}function ep(e,...r){console.log(`${tt.query} ${e}`,...r)}function ln(e,r){if(!e)throw new Error(`${r}. This should never happen. If you see this error, please, open an issue at https://pris.ly/prisma-prisma-bug-report`)}function ar(e,r){throw new Error(r)}function Ni({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}var rp=Ni();function wr(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(rp,"")}var it=O(require("node:path"));function Li(e){return it.default.sep===it.default.posix.sep?e:e.split(it.default.sep).join(it.default.posix.sep)}var qi=O(As()),un=O(require("node:fs"));var xr=O(require("node:path"));function Cs(e){let r=e.ignoreProcessEnv?{}:process.env,t=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(r,p)?r[p]:e.parsed[p]||"",u=t(u)}return o.replace(c,u)},n)??n;for(let n in e.parsed){let i=Object.hasOwnProperty.call(r,n)?r[n]:e.parsed[n];e.parsed[n]=t(i)}for(let n in e.parsed)r[n]=e.parsed[n];return e}var $i=gr("prisma:tryLoadEnv");function st({rootEnvPath:e,schemaEnvPath:r},t={conflictCheck:"none"}){let n=Is(e);t.conflictCheck!=="none"&&hp(n,r,t.conflictCheck);let i=null;return Ds(n?.path,r)||(i=Is(r)),!n&&!i&&$i("No Environment variables loaded"),i?.dotenvResult.error?console.error(ce(W("Schema Env Error: "))+i.dotenvResult.error):{message:[n?.message,i?.message].filter(Boolean).join(`
|
||
|
|
`),parsed:{...n?.dotenvResult?.parsed,...i?.dotenvResult?.parsed}}}function hp(e,r,t){let n=e?.dotenvResult.parsed,i=!Ds(e?.path,r);if(n&&r&&i&&un.default.existsSync(r)){let o=qi.default.parse(un.default.readFileSync(r)),s=[];for(let a in o)n[a]===o[a]&&s.push(a);if(s.length>0){let a=xr.default.relative(process.cwd(),e.path),l=xr.default.relative(process.cwd(),r);if(t==="error"){let u=`There is a conflict between env var${s.length>1?"s":""} in ${Y(a)} and ${Y(l)}
|
||
|
|
Conflicting env vars:
|
||
|
|
${s.map(c=>` ${W(c)}`).join(`
|
||
|
|
`)}
|
||
|
|
|
||
|
|
We suggest to move the contents of ${Y(l)} to ${Y(a)} to consolidate your env vars.
|
||
|
|
`;throw new Error(u)}else if(t==="warn"){let u=`Conflict for env var${s.length>1?"s":""} ${s.map(c=>W(c)).join(", ")} in ${Y(a)} and ${Y(l)}
|
||
|
|
Env vars from ${Y(l)} overwrite the ones from ${Y(a)}
|
||
|
|
`;console.warn(`${Ie("warn(prisma)")} ${u}`)}}}}function Is(e){if(yp(e)){$i(`Environment variables loaded from ${e}`);let r=qi.default.config({path:e,debug:process.env.DOTENV_CONFIG_DEBUG?!0:void 0});return{dotenvResult:Cs(r),message:Ce(`Environment variables loaded from ${xr.default.relative(process.cwd(),e)}`),path:e}}else $i(`Environment variables not found at ${e}`);return null}function Ds(e,r){return e&&r&&xr.default.resolve(e)===xr.default.resolve(r)}function yp(e){return!!(e&&un.default.existsSync(e))}function Vi(e,r){return Object.prototype.hasOwnProperty.call(e,r)}function pn(e,r){let t={};for(let n of Object.keys(e))t[n]=r(e[n],n);return t}function ji(e,r){if(e.length===0)return;let t=e[0];for(let n=1;n<e.length;n++)r(t,e[n])<0&&(t=e[n]);return t}function x(e,r){Object.defineProperty(e,"name",{value:r,configurable:!0})}var ks=new Set,at=(e,r,...t)=>{ks.has(e)||(ks.add(e),_i(r,...t))};var P=class e extends Error{clientVersion;errorCode;retryable;constructor(r,t,n){super(r),this.name="PrismaClientInitializationError",this.clientVersion=t,this.errorCode=n,Error.captureStackTrace(e)}get[Symbol.toStringTag](){return"PrismaClientInitializationError"}};x(P,"PrismaClientInitializationError");var z=class extends Error{code;meta;clientVersion;batchRequestIdx;constructor(r,{code:t,clientVersion:n,meta:i,batchRequestIdx:o}){super(r),this.name="PrismaClientKnownRequestError",this.code=t,this.clientVersion=n,this.meta=i,Object.defineProperty(this,"batchRequestIdx",{value:o,enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return"PrismaClientKnownRequestError"}};x(z,"PrismaClientKnownRequestError");var ae=class extends Error{clientVersion;constructor(r,t){super(r),this.name="PrismaClientRustPanicError",this.clientVersion=t}get[Symbol.toStringTag](){return"PrismaClientRustPanicError"}};x(ae,"PrismaClientRustPanicError");var V=class extends Error{clientVersion;batchRequestIdx;constructor(r,{clientVersion:t,batchRequestIdx:n}){super(r),this.name="PrismaClientUnknownRequestError",this.clientVersion=t,Object.defineProperty(this,"batchRequestIdx",{value:n,writable:!0,enumerable:!1})}get[Symbol.toStringTag](){return"PrismaClientUnknownRequestError"}};x(V,"PrismaClientUnknownRequestError");var Z=class extends Error{name="PrismaClientValidationError";clientVersion;constructor(r,{clientVersion:t}){super(r),this.clientVersion=t}get[Symbol.toStringTag](){return"PrismaClientValidationError"}};x(Z,"PrismaClientValidationError");var we=class{_map=new Map;get(r){return this._map.get(r)?.value}set(r,t){this._map.set(r,{value:t})}getOrCreate(r,t){let n=this._map.get(r);if(n)return n.value;let i=t();return this.set(r,i),i}};function We(e){return e.substring(0,1).toLowerCase()+e.substring(1)}function _s(e,r){let t={};for(let n of e){let i=n[r];t[i]=n}return t}function lt(e){let r;return{get(){return r||(r={value:e()}),r.value}}}function Ns(e){return{models:Bi(e.models),enums:Bi(e.enums),types:Bi(e.types)}}function Bi(e){let r={};for(let{name:t,...n}of e)r[t]=n;return r}function vr(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function mn(e){return e.toString()!=="Invalid Date"}var Pr=9e15,Ye=1e9,Ui="0123456789abcdef",hn="2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286248633409525465082806756666287369098781689482907208325554680843799894826233198528393505308965377732628846163366222287698219886746543667474404243274365155048934314939391479619404400222105101714174800368808401264708068556774321622835522011480466371565912137345074785694768346361679210180644507064800027750268491674655058685693567342067058113642922455440575892572420824131469568901675894025677631135691929203337658714166023010570308963457207544037084746994016826928280848118428931484852494864487192780967627127577539702766860595249671667418348570442250719796500471495105049221477656763693866297697952211071826454973477266242570942932258279850258550978526538320760672631716430950599508780752371033310119785754733154142180842754386359177811705430982748238504564801909561029929182431823
|
||
|
|
`);return new e(r,zs(n).split(`
|
||
|
|
`))}highlight(){let r=Ys(this.toString());return new e(this.firstLineNumber,r.split(`
|
||
|
|
`))}toString(){return this.lines.join(`
|
||
|
|
`)}};var hd={red:ce,gray:Hr,dim:Ce,bold:W,underline:Y,highlightSource:e=>e.highlight()},yd={red:e=>e,gray:e=>e,dim:e=>e,bold:e=>e,underline:e=>e,highlightSource:e=>e};function bd({message:e,originalMethod:r,isPanic:t,callArguments:n}){return{functionName:`prisma.${r}()`,message:e,isPanic:t??!1,callArguments:n}}function Ed({callsite:e,message:r,originalMethod:t,isPanic:n,callArguments:i},o){let s=bd({message:r,originalMethod:t,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=Pn.read(a.fileName)?.slice(l,a.lineNumber),c=u?.lineAt(a.lineNumber);if(u&&c){let p=xd(c),d=wd(c);if(!d)return s;s.functionName=`${d.code})`,s.location=a,n||(u=u.mapLineAt(a.lineNumber,h=>h.slice(0,d.openingBraceIndex))),u=o.highlightSource(u);let f=String(u.lastLineNumber).length;if(s.contextLines=u.mapLines((h,g)=>o.gray(String(g).padStart(f))+" "+h).mapLines(h=>o.dim(h)).prependSymbolAt(a.lineNumber,o.bold(o.red("\u2192"))),i){let h=p+f+1;h+=2,s.callArguments=(0,Xs.default)(i,h).slice(h)}}return s}function wd(e){let r=Object.keys(Rr).join("|"),n=new RegExp(String.raw`\.(${r})\(`).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 xd(e){let r=0;for(let t=0;t<e.length;t++){if(e.charAt(t)!==" ")return r;r++}return r}function vd({functionName:e,location:r,message:t,isPanic:n,contextLines:i,callArguments:o},s){let a=[""],l=r?" 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}`)),r&&a.push(s.underline(Pd(r))),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(t),a.join(`
|
||
|
|
`)}function Pd(e){let r=[e.fileName];return e.lineNumber&&r.push(String(e.lineNumber)),e.columnNumber&&r.push(String(e.columnNumber)),r.join(":")}function Tn(e){let r=e.showColors?hd:yd,t;return t=Ed(e,r),vd(t,r)}var la=O(Ki());function na(e,r,t){let n=ia(e),i=Td(n),o=Rd(i);o?Sn(o,r,t):r.addErrorMessage(()=>"Unknown error")}function ia(e){return e.errors.flatMap(r=>r.kind==="Union"?ia(r):[r])}function Td(e){let r=new Map,t=[];for(let n of e){if(n.kind!=="InvalidArgumentType"){t.push(n);continue}let i=`${n.selectionPath.join(".")}:${n.argumentPath.join(".")}`,o=r.get(i);o?r.set(i,{...n,argument:{...n.argument,typeNames:Sd(o.argument.typeNames,n.argument.typeNames)}}):r.set(i,n)}return t.push(...r.values()),t}function Sd(e,r){return[...new Set(e.concat(r))]}function Rd(e){return ji(e,(r,t)=>{let n=ra(r),i=ra(t);return n!==i?n-i:ta(r)-ta(t)})}function ra(e){let r=0;return Array.isArray(e.selectionPath)&&(r+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(r+=e.argumentPath.length),r}function ta(e){switch(e.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}var le=class{constructor(r,t){this.name=r;this.value=t}isRequired=!1;makeRequired(){return this.isRequired=!0,this}write(r){let{colors:{green:t}}=r.context;r.addMarginSymbol(t(this.isRequired?"+":"?")),r.write(t(this.name)),this.isRequired||r.write(t("?")),r.write(t(": ")),typeof this.value=="string"?r.write(t(this.value)):r.write(this.value)}};sa();var Ar=class{constructor(r=0,t){this.context=t;this.currentIndent=r}lines=[];currentLine="";currentIndent=0;marginSymbol;afterNextNewLineCallback;write(r){return typeof r=="string"?this.currentLine+=r:r.write(this),this}writeJoined(r,t,n=(i,o)=>o.write(i)){let i=t.length-1;for(let o=0;o<t.length;o++)n(t[o],this),o!==i&&this.write(r);return this}writeLine(r){return this.write(r).newLine()}newLine(){this.lines.push(this.indentedCurrentLine()),this.currentLine="",this.marginSymbol=void 0;let r=this.afterNextNewLineCallback;return this.afterNextNewLineCallback=void 0,r?.(),this}withIndent(r){return this.indent(),r(this),this.unindent(),this}afterNextNewline(r){return this.afterNextNewLineCallback=r,this}indent(){return this.currentIndent++,this}unindent(){return this.currentIndent>0&&this.currentIndent--,this}addMarginSymbol(r){return this.marginSymbol=r,this}toString(){return this.lines.concat(this.indentedCurrentLine()).join(`
|
||
|
|
`)}getCurrentLineLength(){return this.currentLine.length}indentedCurrentLine(){let r=this.currentLine.padStart(this.currentLine.length+2*this.currentIndent);return this.marginSymbol?this.marginSymbol+r.slice(1):r}};oa();var Rn=class{constructor(r){this.value=r}write(r){r.write(this.value)}markAsError(){this.value.markAsError()}};var An=e=>e,Cn={bold:An,red:An,green:An,dim:An,enabled:!1},aa={bold:W,red:ce,green:qe,dim:Ce,enabled:!0},Cr={write(e){e.writeLine(",")}};var Pe=class{constructor(r){this.contents=r}isUnderlined=!1;color=r=>r;underline(){return this.isUnderlined=!0,this}setColor(r){return this.color=r,this}write(r){let t=r.getCurrentLineLength();r.write(this.color(this.contents)),this.isUnderlined&&r.afterNextNewline(()=>{r.write(" ".repeat(t)).writeLine(this.color("~".repeat(this.contents.length)))})}};var ze=class{hasError=!1;markAsError(){return this.hasError=!0,this}};var Ir=class extends ze{items=[];addItem(r){return this.items.push(new Rn(r)),this}getField(r){return this.items[r]}getPrintWidth(){return this.items.length===0?2:Math.max(...this.items.map(t=>t.value.getPrintWidth()))+2}write(r){if(this.items.length===0){this.writeEmpty(r);return}this.writeWithItems(r)}writeEmpty(r){let t=new Pe("[]");this.hasError&&t.setColor(r.context.colors.red).underline(),r.write(t)}writeWithItems(r){let{colors:t}=r.context;r.writeLine("[").withIndent(()=>r.writeJoined(Cr,this.items).newLine()).write("]"),this.hasError&&r.afterNextNewline(()=>{r.writeLine(t.red("~".repeat(this.getPrintWidth())))})}asObject(){}};var Dr=class e extends ze{fields={};suggestions=[];addField(r){this.fields[r.name]=r}addSuggestion(r){this.suggestions.push(r)}getField(r){return this.fields[r]}getDeepField(r){let[t,...n]=r,i=this.getField(t);if(!i)return;let o=i;for(let s of n){let a;if(o.value instanceof e?a=o.value.getField(s):o.value instanceof Ir&&(a=o.value.getField(Number(s))),!a)return;o=a}return o}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 t=this;for(let n of r){if(!(t instanceof e))return;let i=t.getSubSelectionValue(n);if(!i)return;t=i}return t}getDeepSelectionParent(r){let t=this.getSelectionParent();if(!t)return;let n=t;for(let i of r){let o=n.value.getFieldValue(i);if(!o||!(o instanceof e))return;let s=o.getSelectionParent();if(!s)return;n=s}return n}getSelectionParent(){let r=this.getField("select")?.value.asObject();if(r)return{kind:"select",value:r};let t=this.getField("include")?.value.asObject();if(t)return{kind:"include",value:t}}getSubSelectionValue(r){return this.getSelectionParent()?.value.fields[r].value}getPrintWidth(){let r=Object.values(this.fields);return r.length==0?2:Math.max(...r.map(n=>n.getPrintWidth()))+2}write(r){let t=Object.values(this.fields);if(t.length===0&&this.suggestions.length===0){this.writeEmpty(r);return}this.writeWithContents(r,t)}asObject(){return this}writeEmpty(r){let t=new Pe("{}");this.hasError&&t.setColor(r.context.colors.red).underline(),r.write(t)}writeWithContents(r,t){r.writeLine("{").withIndent(()=>{r.writeJoined(Cr,[...t,...this.suggestions]).newLine()}),r.write("}"),this.hasError&&r.afterNextNewline(()=>{r.writeLine(r.context.colors.red("~".repeat(this.getPrintWidth())))})}};var Q=class extends ze{constructor(t){super();this.text=t}getPrintWidth(){return this.text.length}write(t){let n=new Pe(this.text);this.hasError&&n.underline().setColor(t.context.colors.red),t.write(n)}asObject(){}};var pt=class{fields=[];addField(r,t){return this.fields.push({write(n){let{green:i,dim:o}=n.context.colors;n.write(i(o(`${r}: ${t}`))).addMarginSymbol(i(o("+")))}}),this}write(r){let{colors:{green:t}}=r.context;r.writeLine(t("{")).withIndent(()=>{r.writeJoined(Cr,this.fields).newLine()}).write(t("}")).addMarginSymbol(t("+"))}};function Sn(e,r,t){switch(e.kind){case"MutuallyExclusiveFields":Ad(e,r);break;case"I
|
||
|
|
Note that ${s.bold("include")} statements only accept relation fields.`,a})}function Id(e,r,t){let n=r.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getField("omit")?.value.asObject();if(i){Dd(e,r,i);return}if(n.hasField("select")){Od(e,r);return}}if(t?.[We(e.outputType.name)]){kd(e,r);return}r.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function Dd(e,r,t){t.removeAllFields();for(let n of e.outputType.fields)t.addSuggestion(new le(n.name,"false"));r.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 Od(e,r){let t=e.outputType,n=r.arguments.getDeepSelectionParent(e.selectionPath)?.value,i=n?.isEmpty()??!1;n&&(n.removeAllFields(),pa(n,t)),r.addErrorMessage(o=>i?`The ${o.red("`select`")} statement for type ${o.bold(t.name)} must not be empty. ${dt(o)}`:`The ${o.red("`select`")} statement for type ${o.bold(t.name)} needs ${o.bold("at least one truthy value")}.`)}function kd(e,r){let t=new pt;for(let i of e.outputType.fields)i.isRelation||t.addField(i.name,"false");let n=new le("omit",t).makeRequired();if(e.selectionPath.length===0)r.arguments.addSuggestion(n);else{let[i,o]=Or(e.selectionPath),a=r.arguments.getDeepSelectionParent(i)?.value.asObject()?.getField(o);if(a){let l=a?.value.asObject()??new Dr;l.addSuggestion(n),a.value=l}}r.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,r){let t=da(e.selectionPath,r);if(t.parentKind!=="unknown"){t.field.markAsError();let n=t.parent;switch(t.parentKind){case"select":pa(n,e.outputType);break;case"include":Ud(n,e.outputType);break;case"omit":Gd(n,e.outputType);break}}r.addErrorMessage(n=>{let i=[`Unknown field ${n.red(`\`${t.fieldName}\``)}`];return t.parentKind!=="unknown"&&i.push(`for ${n.bold(t.parentKind)} statement`),i.push(`on model ${n.bold(`\`${e.outputType.name}\``)}.`),i.push(dt(n)),i.join(" ")})}function Nd(e,r){let t=da(e.selectionPath,r);t.parentKind!=="unknown"&&t.field.value.markAsError(),r.addErrorMessage(n=>`Invalid value for selection field \`${n.red(t.fieldName)}\`: ${e.underlyingError}`)}function Ld(e,r){let t=e.argumentPath[0],n=r.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&(n.getField(t)?.markAsError(),Qd(n,e.arguments)),r.addErrorMessage(i=>ua(i,t,e.arguments.map(o=>o.name)))}function Fd(e,r){let[t,n]=Or(e.argumentPath),i=r.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(i){i.getDeepField(e.argumentPath)?.markAsError();let o=i.getDeepFieldValue(t)?.asObject();o&&ma(o,e.inputType)}r.addErrorMessage(o=>ua(o,n,e.inputType.fields.map(s=>s.name)))}function ua(e,r,t){let n=[`Unknown argument \`${e.red(r)}\`.`],i=Jd(r,t);return i&&n.push(`Did you mean \`${e.green(i)}\`?`),t.length>0&&n.push(dt(e)),n.join(" ")}function Md(e,r){let t;r.addErrorMessage(l=>t?.value instanceof Q&&t.value.text==="null"?`Argument \`${l.green(o)}\` must not be ${l.red("null")}.`:`Argument \`${l.green(o)}\` is missing.`);let n=r.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(!n)return;let[i,o]=Or(e.argumentPath),s=new pt,a=n.getDeepFieldValue(i)?.asObject();if(a){if(t=a.getField(o),t&&a.removeField(o),e.inputTypes.length===1&&e.inputTypes[0].kind==="object"){for(let l of e.inputTypes[0].fields)s.addField(l.name,l.typeNames.join(" | "));a.addSuggestion(new le(o,s).makeRequired())}else{let l=e.inputTypes.map(ca).join(" | ");a.addSuggestion(new le(o,l).makeRequired())}if(e.dependentArgumentPath){n.getDeepField(e.dependentArgumentPath)?.markAsError();let[,l]=Or(e.dependentArgumentPath);r.addErrorMessage(u=>`Argument \`${u.green(o)}\` is required because argument \`${u.green(l)}\` was provided.`)}}}function ca(e){return e.kind==="list"?`${ca(e.elementType)}[]`:e.name}function $d(e,r){let t=e.argument.name,n=r.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&n.getDeepFieldValue(e.argumentP
|
||
|
|
`)}};function _r(e){return new Zi(ga(e))}function ga(e){let r=new Dr;for(let[t,n]of Object.entries(e)){let i=new kn(t,ha(n));r.addField(i)}return r}function ha(e){if(typeof e=="string")return new Q(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new Q(String(e));if(typeof e=="bigint")return new Q(`${e}n`);if(e===null)return new Q("null");if(e===void 0)return new Q("undefined");if(Sr(e))return new Q(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return Buffer.isBuffer(e)?new Q(`Buffer.alloc(${e.byteLength})`):new Q(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let r=mn(e)?e.toISOString():"Invalid Date";return new Q(`new Date("${r}")`)}return e instanceof Me?new Q(`Prisma.${e._getName()}`):kr(e)?new Q(`prisma.${We(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?Kd(e):typeof e=="object"?ga(e):new Q(Object.prototype.toString.call(e))}function Kd(e){let r=new Ir;for(let t of e)r.addItem(ha(t));return r}function _n(e,r){let t=r==="pretty"?aa:Cn,n=e.renderAllMessages(t),i=new Ar(0,{colors:t}).write(e).toString();return{message:n,args:i}}function Nn({args:e,errors:r,errorFormat:t,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=_r(e);for(let p of r)Sn(p,a,s);let{message:l,args:u}=_n(a,t),c=Tn({message:l,callsite:n,originalMethod:i,showColors:t==="pretty",callArguments:u});throw new Z(c,{clientVersion:o})}function Te(e){return e.replace(/^./,r=>r.toLowerCase())}function ba(e,r,t){let n=Te(t);return!r.result||!(r.result.$allModels||r.result[n])?e:Hd({...e,...ya(r.name,e,r.result.$allModels),...ya(r.name,e,r.result[n])})}function Hd(e){let r=new we,t=(n,i)=>r.getOrCreate(n,()=>i.has(n)?[n]:(i.add(n),e[n]?e[n].needs.flatMap(o=>t(o,i)):[n]));return pn(e,n=>({...n,needs:t(n.name,new Set)}))}function ya(e,r,t){return t?pn(t,({needs:n,compute:i},o)=>({name:o,needs:n?Object.keys(n).filter(s=>n[s]):[],compute:Yd(r,o,i)})):{}}function Yd(e,r,t){let n=e?.[r]?.compute;return n?i=>t({...i,[r]:n(i)}):t}function Ea(e,r){if(!r)return e;let t={...e};for(let n of Object.values(r))if(e[n.name])for(let i of n.needs)t[i]=!0;return t}function wa(e,r){if(!r)return e;let t={...e};for(let n of Object.values(r))if(!e[n.name])for(let i of n.needs)delete t[i];return t}var Ln=class{constructor(r,t){this.extension=r;this.previous=t}computedFieldsCache=new we;modelExtensionsCache=new we;queryCallbacksCache=new we;clientExtensions=lt(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());batchCallbacks=lt(()=>{let r=this.previous?.getAllBatchQueryCallbacks()??[],t=this.extension.query?.$__internalBatch;return t?r.concat(t):r});getAllComputedFields(r){return this.computedFieldsCache.getOrCreate(r,()=>ba(this.previous?.getAllComputedFields(r),this.extension,r))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(r){return this.modelExtensionsCache.getOrCreate(r,()=>{let t=Te(r);return!this.extension.model||!(this.extension.model[t]||this.extension.model.$allModels)?this.previous?.getAllModelExtensions(r):{...this.previous?.getAllModelExtensions(r),...this.extension.model.$allModels,...this.extension.model[t]}})}getAllQueryCallbacks(r,t){return this.queryCallbacksCache.getOrCreate(`${r}:${t}`,()=>{let n=this.previous?.getAllQueryCallbacks(r,t)??[],i=[],o=this.extension.query;return!o||!(o[r]||o.$allModels||o[t]||o.$allOperations)?n:(o[r]!==void 0&&(o[r][t]!==void 0&&i.push(o[r][t]),o[r].$allOperations!==void 0&&i.push(o[r].$allOperations)),r!=="$none"&&o.$allModels!==void 0&&(o.$allModels[t]!==void 0&&i.push(o.$allModels[t]),o.$allModels.$allOperations!==void 0&&i.push(o.$allModels.$allOperations)),o[t]!==void 0&&i.push(o[t]),o.$allOperations!==void 0&&i.push(o.$allOperations),n.concat(i))})}getAllBatchQueryCallbacks(){return this.batchCallbacks.get()}},Nr=class e{constructor(r){this.head=r}static empty(){return new e}static single(r){return new e(new Ln(r))}isEmpty(){return this.head===void 0}append(r){return new e(new Ln(r,this.head))}getAllComputedFields(r){return this.head?.getAl
|
||
|
|
Prisma Accelerate has built-in connection pooling to prevent such errors: https://pris.ly/client/error-accelerate`),t}var vt="<unknown>";function La(e){var r=e.split(`
|
||
|
|
`);return r.reduce(function(t,n){var i=dm(n)||fm(n)||ym(n)||xm(n)||Em(n);return i&&t.push(i),t},[])}var cm=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|rsc|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,pm=/\((\S*)(?::(\d+))(?::(\d+))\)/;function dm(e){var r=cm.exec(e);if(!r)return null;var t=r[2]&&r[2].indexOf("native")===0,n=r[2]&&r[2].indexOf("eval")===0,i=pm.exec(r[2]);return n&&i!=null&&(r[2]=i[1],r[3]=i[2],r[4]=i[3]),{file:t?null:r[2],methodName:r[1]||vt,arguments:t?[r[2]]:[],lineNumber:r[3]?+r[3]:null,column:r[4]?+r[4]:null}}var mm=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|rsc|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function fm(e){var r=mm.exec(e);return r?{file:r[2],methodName:r[1]||vt,arguments:[],lineNumber:+r[3],column:r[4]?+r[4]:null}:null}var gm=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|rsc|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,hm=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function ym(e){var r=gm.exec(e);if(!r)return null;var t=r[3]&&r[3].indexOf(" > eval")>-1,n=hm.exec(r[3]);return t&&n!=null&&(r[3]=n[1],r[4]=n[2],r[5]=null),{file:r[3],methodName:r[1]||vt,arguments:r[2]?r[2].split(","):[],lineNumber:r[4]?+r[4]:null,column:r[5]?+r[5]:null}}var bm=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;function Em(e){var r=bm.exec(e);return r?{file:r[3],methodName:r[1]||vt,arguments:[],lineNumber:+r[4],column:r[5]?+r[5]:null}:null}var wm=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;function xm(e){var r=wm.exec(e);return r?{file:r[2],methodName:r[1]||vt,arguments:[],lineNumber:+r[3],column:r[4]?+r[4]:null}:null}var oo=class{getLocation(){return null}},so=class{_error;constructor(){this._error=new Error}getLocation(){let r=this._error.stack;if(!r)return null;let n=La(r).find(i=>{if(!i.file)return!1;let o=Li(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 oo:new so}var Fa={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function qr(e={}){let r=Pm(e);return Object.entries(r).reduce((n,[i,o])=>(Fa[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function Pm(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function Un(e={}){return r=>(typeof e._count=="boolean"&&(r._count=r._count._all),r)}function Ma(e,r){let t=Un(e);return r({action:"aggregate",unpacker:t,argsMapper:qr})(e)}function Tm(e={}){let{select:r,...t}=e;return typeof r=="object"?qr({...t,_count:r}):qr({...t,_count:{_all:!0}})}function Sm(e={}){return typeof e.select=="object"?r=>Un(e)(r)._count:r=>Un(e)(r)._count._all}function $a(e,r){return r({action:"count",unpacker:Sm(e),argsMapper:Tm})(e)}function Rm(e={}){let r=qr(e);if(Array.isArray(r.by))for(let t of r.by)typeof t=="string"&&(r.select[t]=!0);else typeof r.by=="string"&&(r.select[r.by]=!0);return r}function Am(e={}){return r=>(typeof e?._count=="boolean"&&r.forEach(t=>{t._count=t._count._all}),r)}function qa(e,r){return r({action:"groupBy",unpacker:Am(e),argsMapper:Rm})(e)}function Va(e,r,t){if(r==="aggregate")return n=>Ma(n,t);if(r==="count")return n=>$a(n,t);if(r==="groupBy")return n=>qa(n,t)}function ja(e,r){let t=r.fields.filter(i=>!i.relationName),n=_s(t,"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 mt(e,o,s.type,s.isList,s.kind==="enum")},...Bn(Object.keys(n))})}var Ba=e=>Array.isArray(e)?e:e.split("."),ao=(e,r)=>Ba(r).reduce((t,n)=>t&&t[n],e),Ua=(e,r,t)=>Ba(r).r
|
||
|
|
|
||
|
|
Learn how: https://pris.ly/d/${ol[r]}-build`;throw console.error(i),new P(i,t)}}function al(e,r){return e?e.datasources?e.datasources:e.datasourceUrl?{[r[0]]:{url:e.datasourceUrl}}:{}:{}}var dl=O(require("node:fs")),St=O(require("node:path"));function Qn(e){let{runtimeBinaryTarget:r}=e;return`Add "${r}" to \`binaryTargets\` in the "schema.prisma" file and run \`prisma generate\` after saving it:
|
||
|
|
|
||
|
|
${Um(e)}`}function Um(e){let{generator:r,generatorBinaryTargets:t,runtimeBinaryTarget:n}=e,i={fromEnvVar:null,value:n},o=[...t,i];return ki({...r,binaryTargets:o})}function Xe(e){let{runtimeBinaryTarget:r}=e;return`Prisma Client could not locate the Query Engine for runtime "${r}".`}function er(e){let{searchedLocations:r}=e;return`The following locations have been searched:
|
||
|
|
${[...new Set(r)].map(i=>` ${i}`).join(`
|
||
|
|
`)}`}function ll(e){let{runtimeBinaryTarget:r}=e;return`${Xe(e)}
|
||
|
|
|
||
|
|
This happened because \`binaryTargets\` have been pinned, but the actual deployment also required "${r}".
|
||
|
|
${Qn(e)}
|
||
|
|
|
||
|
|
${er(e)}`}function Wn(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 Jn(e){let{errorStack:r}=e;return r?.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 ul(e){let{queryEngineName:r}=e;return`${Xe(e)}${Jn(e)}
|
||
|
|
|
||
|
|
This is likely caused by a bundler that has not copied "${r}" next to the resulting bundle.
|
||
|
|
Ensure that "${r}" has been copied next to the bundle or in "${e.expectedLocation}".
|
||
|
|
|
||
|
|
${Wn("engine-not-found-bundler-investigation")}
|
||
|
|
|
||
|
|
${er(e)}`}function cl(e){let{runtimeBinaryTarget:r,generatorBinaryTargets:t}=e,n=t.find(i=>i.native);return`${Xe(e)}
|
||
|
|
|
||
|
|
This happened because Prisma Client was generated for "${n?.value??"unknown"}", but the actual deployment required "${r}".
|
||
|
|
${Qn(e)}
|
||
|
|
|
||
|
|
${er(e)}`}function pl(e){let{queryEngineName:r}=e;return`${Xe(e)}${Jn(e)}
|
||
|
|
|
||
|
|
This is likely caused by tooling that has not copied "${r}" to the deployment folder.
|
||
|
|
Ensure that you ran \`prisma generate\` and that "${r}" has been copied to "${e.expectedLocation}".
|
||
|
|
|
||
|
|
${Wn("engine-not-found-tooling-investigation")}
|
||
|
|
|
||
|
|
${er(e)}`}var Gm=N("prisma:client:engines:resolveEnginePath"),Qm=()=>new RegExp("runtime[\\\\/]library\\.m?js$");async function ml(e,r){let t={binary:process.env.PRISMA_QUERY_ENGINE_BINARY,library:process.env.PRISMA_QUERY_ENGINE_LIBRARY}[e]??r.prismaPath;if(t!==void 0)return t;let{enginePath:n,searchedLocations:i}=await Wm(e,r);if(Gm("enginePath",n),n!==void 0&&e==="binary"&&Ri(n),n!==void 0)return r.prismaPath=n;let o=await ir(),s=r.generator?.binaryTargets??[],a=s.some(d=>d.native),l=!s.some(d=>d.value===o),u=__filename.match(Qm())===null,c={searchedLocations:i,generatorBinaryTargets:s,generator:r.generator,runtimeBinaryTarget:o,queryEngineName:fl(e,o),expectedLocation:St.default.relative(process.cwd(),r.dirname),errorStack:new Error().stack},p;throw a&&l?p=cl(c):l?p=ll(c):u?p=ul(c):p=pl(c),new P(p,r.clientVersion)}async function Wm(e,r){let t=await ir(),n=[],i=[r.dirname,St.default.resolve(__dirname,".."),r.generator?.output?.value??__dirname,St.default.resolve(__dirname,"../../../.prisma/client"),"/tmp/prisma-engines",r.cwd];__filename.includes("resolveEnginePath")&&i.push(ms());for(let o of i){let s=fl(e,t),a=St.default.join(o,s);if(n.push(o),dl.default.existsSync(a))return{enginePath:a,searchedLocations:n}}return{enginePath:void 0,searchedLocations:n}}function fl(e,r){return e==="library"?Gt(r,"fs"):`query-engine-${r}${r==="windows"?".exe":""}`}function gl(e){return e?e.replace(/".*"/g,'"X"').replace(/[\s:\[]([+-]?([0-9]*[.])?[0-9]+)/g,r=>`${r[0]}5`):""}function hl(e){return e.split(`
|
||
|
|
`).map(r=>r.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 yl=O(Os());function bl({title:e,user:r="prisma",repo:t="prisma",template:n="bug_report.yml",body:i}){return(0,yl.default)({user:r,repo:t,template:n,title:e,body:i})}function El({version:e,binaryTarget:r,title:t,description:n,engineVersion:i,database:o,query:s}){let a=Bo(6e3-(s?.length??0)),l=hl(wr(a)),u=n?`# Description
|
||
|
|
\`\`\`
|
||
|
|
${n}
|
||
|
|
\`\`\``:"",c=wr(`Hi Prisma Team! My Prisma Client just crashed. This is the report:
|
||
|
|
## Versions
|
||
|
|
|
||
|
|
| Name | Version |
|
||
|
|
|-----------------|--------------------|
|
||
|
|
| Node | ${process.version?.padEnd(19)}|
|
||
|
|
| OS | ${r?.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?gl(s):""}
|
||
|
|
\`\`\`
|
||
|
|
`),p=bl({title:t,body:c});return`${t}
|
||
|
|
|
||
|
|
This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.
|
||
|
|
|
||
|
|
${Y(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 wl(e,r){throw new Error(r)}function Jm(e){return e!==null&&typeof e=="object"&&typeof e.$type=="string"}function Km(e,r){let t={};for(let n of Object.keys(e))t[n]=r(e[n],n);return t}function Vr(e){return e===null?e:Array.isArray(e)?e.map(Vr):typeof e=="object"?Jm(e)?Hm(e):e.constructor!==null&&e.constructor.name!=="Object"?e:Km(e,Vr):e}function Hm({$type:e,value:r}){switch(e){case"BigInt":return BigInt(r);case"Bytes":{let{buffer:t,byteOffset:n,byteLength:i}=Buffer.from(r,"base64");return new Uint8Array(t,n,i)}case"DateTime":return new Date(r);case"Decimal":return new Le(r);case"Json":return JSON.parse(r);default:wl(r,"Unknown tagged value")}}var xl="6.18.0";var zm=()=>globalThis.process?.release?.name==="node",Zm=()=>!!globalThis.Bun||!!globalThis.process?.versions?.bun,Xm=()=>!!globalThis.Deno,ef=()=>typeof globalThis.Netlify=="object",rf=()=>typeof globalThis.EdgeRuntime=="object",tf=()=>globalThis.navigator?.userAgent==="Cloudflare-Workers";function nf(){return[[ef,"netlify"],[rf,"edge-light"],[tf,"workerd"],[Xm,"deno"],[Zm,"bun"],[zm,"node"]].flatMap(t=>t[0]()?[t[1]]:[]).at(0)??""}var of={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 Kn(){let e=nf();return{id:e,prettyName:of[e]||e,isEdge:["workerd","deno","netlify","edge-light"].includes(e)}}function jr({inlineDatasources:e,overrideDatasources:r,env:t,clientVersion:n}){let i,o=Object.keys(e)[0],s=e[o]?.url,a=r[o]?.url;if(o===void 0?i=void 0:a?i=a:s?.value?i=s.value:s?.fromEnvVar&&(i=t[s.fromEnvVar]),s?.fromEnvVar!==void 0&&i===void 0)throw new P(`error: Environment variable not found: ${s.fromEnvVar}.`,n);if(i===void 0)throw new P("error: Missing URL environment variable, value, or override.",n);return i}var Hn=class extends Error{clientVersion;cause;constructor(r,t){super(r),this.clientVersion=t.clientVersion,this.cause=t.cause}get[Symbol.toStringTag](){return this.name}};var oe=class extends Hn{isRetryable;constructor(r,t){super(r,t),this.isRetryable=t.isRetryable??!0}};function R(e,r){return{...e,isRetryable:r}}var ur=class extends oe{name="InvalidDatasourceError";code="P6001";constructor(r,t){super(r,R(t,!1))}};x(ur,"InvalidDatasourceError");function vl(e){let r={clientVersion:e.clientVersion},t=Object.keys(e.inlineDatasources)[0],n=jr({inlineDatasources:e.inlineDatasources,overrideDatasources:e.overrideDatasources,clientVersion:e.clientVersion,env:{...e.env,...typeof process<"u"?process.env:{}}}),i;try{i=new URL(n)}catch{throw new ur(`Error validating datasource \`${t}\`: the URL must start with the protocol \`prisma://\``,r)}let{protocol:o,searchParams:s}=i;if(o!=="prisma:"&&o!==sn)throw new ur(`Error validating datasource \`${t}\`: the URL must start with the protocol \`prisma://\` or \`prisma+postgres://\``,r);let a=s.get("api_key");if(a===null||a.length<1)throw new ur(`Error validating datasource \`${t}\`: the URL must contain a valid API key`,r);let l=Ii(i)?"http:":"https:";process.env.TEST_CLIENT_ENGINE_REMOTE_EXECUTOR&&i.searchParams.has("use_http")&&(l="http:");let u=new URL(i.href.replace(o,l));return{apiKey:a,url:u}}var Pl=O(on()),Yn=class{apiKey;tracingHelper;logLevel;logQueries;engineHash;constructor({apiKey:r,tracingHelper:t,logLevel:n,logQueries:i,engineHash:o}){this.apiKey=r,this.tracingHelper=t,this.logLevel=n,this.logQueries=i,this.engineHash=o}build({traceparent:r,transactionId:t}={}){let n={Accept:"application/json",Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json","Prisma-Engine-Hash":this.engineHash,"Prisma-Engine-Version":Pl.enginesVersion};this.tracingHelper.isEnabled()&&(n.traceparent=r??this.tracingHelper.getTraceParent()),t&&(n["X-Transaction-Id"]=t);let i=this.#e();return i.length>0&&(n["X-Capture-Telemetry"]=i.join(", ")),n}#e(){let r=[];return this.tracingHelper.isEnabled()&&r.push("tracing"),this.logLevel&&r.push(this.logLevel),this.logQueries&&r.push("qu
|
||
|
|
${r}`,R(t,!0))}};x(Mt,"RequestError");async function dr(e,r,t=n=>n){let{clientVersion:n,...i}=r,o=t(fetch);try{return await o(e,i)}catch(s){let a=s.message??"Unknown error";throw new Mt(a,{clientVersion:n,cause:s})}}var pf=/^[1-9][0-9]*\.[0-9]+\.[0-9]+$/,Cl=N("prisma:client:dataproxyEngine");async function df(e,r){let t=Al["@prisma/engines-version"],n=r.clientVersion??"unknown";if(process.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION||globalThis.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION)return process.env.PRISMA_CLIENT_DATA_PROXY_CLIENT_VERSION||globalThis.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&&pf.test(i))return i;if(o!==void 0||n==="0.0.0"||n==="in-memory"){let[s]=t.split("-")??[],[a,l,u]=s.split("."),c=mf(`<=${a}.${l}.${u}`),p=await dr(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();Cl("length of body fetched from unpkg.com",d.length);let f;try{f=JSON.parse(d)}catch(h){throw console.error("JSON.parse error: body fetched from unpkg.com: ",d),h}return f.version}throw new cr("Only `major.minor.patch` versions are supported by Accelerate.",{clientVersion:n})}async function Il(e,r){let t=await df(e,r);return Cl("version",t),t}function mf(e){return encodeURI(`https://unpkg.com/prisma@${e}/package.json`)}var Dl=3,$t=N("prisma:client:dataproxyEngine"),qt=class{name="DataProxyEngine";inlineSchema;inlineSchemaHash;inlineDatasources;config;logEmitter;env;clientVersion;engineHash;tracingHelper;remoteClientVersion;host;headerBuilder;startPromise;protocol;constructor(r){Rl(r),this.config=r,this.env=r.env,this.inlineSchema=Sl(r.inlineSchema),this.inlineDatasources=r.inlineDatasources,this.inlineSchemaHash=r.inlineSchemaHash,this.clientVersion=r.clientVersion,this.engineHash=r.engineVersion,this.logEmitter=r.logEmitter,this.tracingHelper=r.tracingHelper}apiKey(){return this.headerBuilder.apiKey}version(){return this.engineHash}async start(){this.startPromise!==void 0&&await this.startPromise,this.startPromise=(async()=>{let{apiKey:r,url:t}=this.getURLAndAPIKey();this.host=t.host,this.protocol=t.protocol,this.headerBuilder=new Yn({apiKey:r,tracingHelper:this.tracingHelper,logLevel:this.config.logLevel??"error",logQueries:this.config.logQueries,engineHash:this.engineHash}),this.remoteClientVersion=await Il(this.host,this.config),$t("host",this.host),$t("protocol",this.protocol)})(),await this.startPromise}async stop(){}propagateResponseExtensions(r){r?.logs?.length&&r.logs.forEach(t=>{switch(t.level){case"debug":case"trace":$t(t);break;case"error":case"warn":case"info":{this.logEmitter.emit(t.level,{timestamp:po(t.timestamp),message:t.attributes.message??"",target:t.target??"BinaryEngine"});break}case"query":{this.logEmitter.emit("query",{query:t.attributes.query??"",timestamp:po(t.timestamp),duration:t.attributes.duration_ms??0,params:t.attributes.params??"",target:t.target??"BinaryEngine"});break}default:t.level}}),r?.traces?.length&&this.tracingHelper.dispatchEngineSpans(r.traces)}onBeforeExit(){throw new Error('"beforeExit" hook is not applicable to the remote query engine')}async url(r){return await this.start(),`${this.protocol}//${this.host}/${this.remoteClientVersion}/${this.inlineSchemaHash}/${r}`}async uploadSchema(){let r={name:"schemaUpload",internal:!0};return this.tracingHelper.runInChildSpan(r,async()=>{let t=await dr(await this.url("schema"),{method:"PUT",headers:this.headerBuilder.build(),body:this.inlineSchema,clientVersion:this.clientVersion});t.ok||$t("schema response status",t.status);let n=await Ft(t,this.clientVersion);if(n)throw this.logEmitter.emit("warn",{message:`Error while uploading schema: ${n.message}`,timestamp:new Date,target:""}),n;this.logEmitter.emit("info",{message:`Schema (re)uploaded (hash: ${this.inlineSchemaHash})`,timestamp:new Date,target:""})})}request(r,{traceparent:t,interactiveTransaction:n,customDataProxyFetch:i}){return this.reque
|
||
|
|
You may have to run ${qe("prisma generate")} for your changes to take effect.`,this.config.clientVersion);return r}}parseEngineResponse(r){if(!r)throw new V("Response from the Engine was empty",{clientVersion:this.config.clientVersion});try{return JSON.parse(r)}catch{throw new V("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 r=new WeakRef(this);this.adapterPromise||(this.adapterPromise=this.config.adapter?.connect()?.then(tn));let t=await this.adapterPromise;t&&Re("Using driver adapter: %O",t),this.engine=this.wrapEngine(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",enableTracing:this.tracingHelper.isEnabled()},n=>{r.deref()?.logger(n)},t))}catch(r){let t=r,n=this.parseInitError(t.message);throw typeof n=="string"?t:new P(n.message,this.config.clientVersion,n.error_code)}}}logger(r){let t=this.parseEngineResponse(r);t&&(t.level=t?.level.toLowerCase()??"unknown",yf(t)?this.logEmitter.emit("query",{timestamp:new Date,query:t.query,params:t.params,duration:Number(t.duration_ms),target:t.module_path}):bf(t)?this.loggerRustPanic=new ae(Po(this,`${t.message}: ${t.reason} in ${t.file}:${t.line}:${t.column}`),this.config.clientVersion):this.logEmitter.emit(t.level,{timestamp:new Date,message:t.message,target:t.module_path}))}parseInitError(r){try{return JSON.parse(r)}catch{}return r}parseRequestError(r){try{return JSON.parse(r)}catch{}return r}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(this.libraryInstantiationPromise||(this.libraryInstantiationPromise=this.instantiateLibrary()),await this.libraryInstantiationPromise,await this.libraryStoppingPromise,this.libraryStartingPromise)return Re(`library already starting, this.libraryStarted: ${this.libraryStarted}`),this.libraryStartingPromise;if(this.libraryStarted)return;let r=async()=>{Re("library starting");try{let t={traceparent:this.tracingHelper.getTraceParent()};await this.engine?.connect(JSON.stringify(t)),this.libraryStarted=!0,this.adapterPromise||(this.adapterPromise=this.config.adapter?.connect()?.then(tn)),await this.adapterPromise,Re("library started")}catch(t){let n=this.parseInitError(t.message);throw typeof n=="string"?t:new P(n.message,this.config.clientVersion,n.error_code)}finally{this.libraryStartingPromise=void 0}};return this.libraryStartingPromise=this.tracingHelper.runInChildSpan("connect",r),this.libraryStartingPromise}async stop(){if(await this.libraryInstantiationPromise,await this.libraryStartingPromise,await this.executingQueryPromise,this.libraryStoppingPromise)return Re("library is already stopping"),this.libraryStoppingPromise;if(!this.libraryStarted){await(await this.adapterPromise)?.dispose(),this.adapterPromise=void 0;return}let r=async()=>{await new Promise(n=>setImmediate(n)),Re("library stopping");let t={traceparent:this.tracingHelper.getTraceParent()};await this.engine?.disconnect(JSON.stringify(t)),this.engine?.free&&this.engine.free(),this.engine=void 0,this.libraryStarted=!1,this.libraryStoppingPromise=void 0,this.libraryInstantiationPromise=void 0,await(await this.adapterPromise)?.dispose(),this.adapterPromise=void 0,Re("library stopped")};return this.libraryStoppingPromise=this.tracingHelper.runInChildSpan("disconnect",r),this.libraryStoppingPromise}version(){return this.versionInfo=this.library?.version(),this.versionInfo?.version??"unknown"}debugPanic(r){return this.library?.debugPanic(r)}async request(r,{traceparent:t,interactiveTransaction:n}){Re(`sending request, this.libraryStarted: ${thi
|
||
|
|
${a.backtrace}`,{clientVersion:this.config.clientVersion})}}async requestBatch(r,{transaction:t,traceparent:n}){Re("requestBatch");let i=Mr(r,t);await this.start();let o=await this.adapterPromise;this.lastQuery=JSON.stringify(i),this.executingQueryPromise=this.engine?.query(this.lastQuery,JSON.stringify({traceparent:n}),Ol(t));let s=await this.executingQueryPromise,a=this.parseEngineResponse(s);if(a.errors)throw a.errors.length===1?this.buildQueryError(a.errors[0],o?.errorRegistry):new V(JSON.stringify(a.errors),{clientVersion:this.config.clientVersion});let{batchResult:l,errors:u}=a;if(Array.isArray(l))return l.map(c=>c.errors&&c.errors.length>0?this.loggerRustPanic??this.buildQueryError(c.errors[0],o?.errorRegistry):{data:c});throw u&&u.length===1?new Error(u[0].error):new Error(JSON.stringify(a))}buildQueryError(r,t){if(r.user_facing_error.is_panic)return new ae(Po(this,r.user_facing_error.message),this.config.clientVersion);let n=this.getExternalAdapterError(r.user_facing_error,t);return n?n.error:$r(r,this.config.clientVersion,this.config.activeProvider)}getExternalAdapterError(r,t){if(r.error_code===hf&&t){let n=r.meta?.id;ln(typeof n=="number","Malformed external JS error received from the engine");let i=t.consumeError(n);return ln(i,"External error with reported id was not registered"),i}}async metrics(r){await this.start();let t=await this.engine.metrics(JSON.stringify(r));return r.format==="prometheus"?t:this.parseEngineResponse(t)}};function xf(e){return typeof e=="object"&&e!==null&&e.error_code!==void 0}function Po(e,r){return El({binaryTarget:e.binaryTarget,title:r,version:e.config.clientVersion,engineVersion:e.versionInfo?.commit,database:e.config.activeProvider,query:e.lastQuery})}function Fl({url:e,adapter:r,copyEngine:t,targetBuildType:n}){let i=[],o=[],s=g=>{i.push({_tag:"warning",value:g})},a=g=>{let I=g.join(`
|
||
|
|
`);o.push({_tag:"error",value:I})},l=!!e?.startsWith("prisma://"),u=an(e),c=!!r,p=l||u;!c&&t&&p&&n!=="client"&&n!=="wasm-compiler-edge"&&s(["recommend--no-engine","In production, we recommend using `prisma generate --no-engine` (See: `prisma generate --help`)"]);let d=p||!t;c&&(d||n==="edge")&&(n==="edge"?a(["Prisma Client was configured to use the `adapter` option but it was imported via its `/edge` endpoint.","Please either remove the `/edge` endpoint or remove the `adapter` from the Prisma Client constructor."]):p?a(["You've provided both a driver adapter and an Accelerate database URL. Driver adapters currently cannot connect to Accelerate.","Please provide either a driver adapter with a direct database URL or an Accelerate URL and no driver adapter."]):t||a(["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."]));let f={accelerate:d,ppg:u,driverAdapters:c};function h(g){return g.length>0}return h(o)?{ok:!1,diagnostics:{warnings:i,errors:o},isUsing:f}:{ok:!0,diagnostics:{warnings:i},isUsing:f}}function Ml({copyEngine:e=!0},r){let t;try{t=jr({inlineDatasources:r.inlineDatasources,overrideDatasources:r.overrideDatasources,env:{...r.env,...process.env},clientVersion:r.clientVersion})}catch{}let{ok:n,isUsing:i,diagnostics:o}=Fl({url:t,adapter:r.adapter,copyEngine:e,targetBuildType:"library"});for(let p of o.warnings)at(...p.value);if(!n){let p=o.errors[0];throw new Z(p.value,{clientVersion:r.clientVersion})}let s=Er(r.generator),a=s==="library",l=s==="binary",u=s==="client",c=(i.accelerate||i.ppg)&&!i.driverAdapters;return i.accelerate?new qt(r):(i.driverAdapters,a?new Qr(r):(i.accelerate,new Qr(r)))}function $l({generator:e}){return e?.previewFeatures??[]}var ql=e=>({command:e});var Vl=e=>e.strings.reduce((r,t,n)=>`${r}@P${n}${t}`);function Wr(e){try{return jl(e,"fast")}catch{return jl(e,"slow")}}function jl(e,r){return JSON.stringify(e.map(t=>Ul(t,r)))}function Ul(e,r){if(Array.isArray(e))return e.map(t=>Ul(t,r));if(typeof e=="bigint")return{prisma__type:"bigint",prisma__value:e.toString()};if(vr(e))return{prisma__type:"date",prisma__value:e.toJSON()};if(Fe.isDecimal(e))return{prisma__type:"decimal",prisma__value:e.toJSON()};if(Buffer.isBuffer(e))return{prisma__type:"bytes",prisma__value:e.toString("base64")};if(vf(e))return{prisma__type:"bytes",prisma__value:Buffer.from(e).toString("base64")};if(ArrayBuffer.isView(e)){let{buffer:t,byteOffset:n,byteLength:i}=e;return{prisma__type:"bytes",prisma__value:Buffer.from(t,n,i).toString("base64")}}return typeof e=="object"&&r==="slow"?Gl(e):e}function vf(e){return e instanceof ArrayBuffer||e instanceof SharedArrayBuffer?!0:typeof e=="object"&&e!==null?e[Symbol.toStringTag]==="ArrayBuffer"||e[Symbol.toStringTag]==="SharedArrayBuffer":!1}function Gl(e){if(typeof e!="object"||e===null)return e;if(typeof e.toJSON=="function")return e.toJSON();if(Array.isArray(e))return e.map(Bl);let r={};for(let t of Object.keys(e))r[t]=Bl(e[t]);return r}function Bl(e){return typeof e=="bigint"?e.toString():Gl(e)}var Pf=/^(\s*alter\s)/i,Ql=N("prisma:client");function To(e,r,t,n){if(!(e!=="postgresql"&&e!=="cockroachdb")&&t.length>0&&Pf.exec(r))throw new Error(`Running ALTER using ${n} is not supported
|
||
|
|
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 So=({clientMethod:e,activeProvider:r})=>t=>{let n="",i;if(Vn(t))n=t.sql,i={values:Wr(t.values),__prismaRawParameters__:!0};else if(Array.isArray(t)){let[o,...s]=t;n=o,i={values:Wr(s||[]),__prismaRawParameters__:!0}}else switch(r){case"sqlite":case"mysql":{n=t.sql,i={values:Wr(t.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=t.text,i={values:Wr(t.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=Vl(t),i={values:Wr(t.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${r} provider does not support ${e}`)}return i?.values?Ql(`prisma.${e}(${n}, ${i.values})`):Ql(`prisma.${e}(${n})`),{query:n,parameters:i}},Wl={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[r,...t]=e;return new ie(r,t)}},Jl={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};function Ro(e){return function(t,n){let i,o=(s=e)=>{try{return s===void 0||s?.kind==="itx"?i??=Kl(t(s)):Kl(t(s))}catch(a){return Promise.reject(a)}};return{get spec(){return n},then(s,a){return o().then(s,a)},catch(s){return o().catch(s)},finally(s){return o().finally(s)},requestTransaction(s){let a=o(s);return a.requestTransaction?a.requestTransaction(s):a},[Symbol.toStringTag]:"PrismaPromise"}}}function Kl(e){return typeof e.then=="function"?e:Promise.resolve(e)}var Tf=xi.split(".")[0],Sf={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(){},getActiveContext(){},runInChildSpan(e,r){return r()}},Ao=class{isEnabled(){return this.getGlobalTracingHelper().isEnabled()}getTraceParent(r){return this.getGlobalTracingHelper().getTraceParent(r)}dispatchEngineSpans(r){return this.getGlobalTracingHelper().dispatchEngineSpans(r)}getActiveContext(){return this.getGlobalTracingHelper().getActiveContext()}runInChildSpan(r,t){return this.getGlobalTracingHelper().runInChildSpan(r,t)}getGlobalTracingHelper(){let r=globalThis[`V${Tf}_PRISMA_INSTRUMENTATION`],t=globalThis.PRISMA_INSTRUMENTATION;return r?.helper??t?.helper??Sf}};function Hl(){return new Ao}function Yl(e,r=()=>{}){let t,n=new Promise(i=>t=i);return{then(i){return--e===0&&t(r()),i?.(n)}}}function zl(e){return typeof e=="string"?e:e.reduce((r,t)=>{let n=typeof t=="string"?t:t.level;return n==="query"?r:r&&(t==="info"||r==="info")?"info":n},void 0)}function zn(e){return typeof e.batchRequestIdx=="number"}function Zl(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let r=[];return e.modelName&&r.push(e.modelName),e.query.arguments&&r.push(Co(e.query.arguments)),r.push(Co(e.query.selection)),r.join("")}function Co(e){return`(${Object.keys(e).sort().map(t=>{let n=e[t];return typeof n=="object"&&n!==null?`(${t} ${Co(n)})`:t}).join(" ")})`}var Rf={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,updateManyAndReturn:!0,updateOne:!0,upsertOne:!0};function Io(e){return Rf[e]}var Zn=class{constructor(r){this.options=r;this.batches={}}batches;tickActive=!1;request(r){let t=this.options.batchBy(r);return t?(this.batches[t]||(this.batches[t]=[],this.tickActive||(this.tickActive=!0,process.nextTick(()=>{this.dispatchBatches(),this.tickActive=!1}))),new Promise((n,i)=>{this.batches[t].push({request:r,resolve:n,reject:i})})):this.options.singleLoader(r)}dispatchBatches(){for(let r in this.batches){let t=this.batches[r];delete this.batches[r],t.length===1?this.options.singleLoader(t[0].request).then(n=>{n instanceof Error?t[0].reject(n):t[0].resolve(n)}).catch(n=>{t[0].reject(n)}):(t.sort((n,i)=>this.options.batchOrder(n.request,i.request)),this.options.batchLoader(t.map(n=>n.request)).then(n=>{if(n instanceof Error)for(let i=0;i<t.length;i++)t[i].reject(n);else for(let i=0;i<t.length;i++){let o=n[i];o instanceof Error?t[i].reject(o):t[i].resolve(o)}}).catch(n=>{for(let i=0;i<t.length;i++)t[i].reject(n)}))}}get[Symbol.toStringTag
|
||
|
|
Read more at https://pris.ly/d/client-constructor`),this.name="PrismaClientConstructorValidationError"}get[Symbol.toStringTag](){return"PrismaClientConstructorValidationError"}};x(_,"PrismaClientConstructorValidationError");var tu=["datasources","datasourceUrl","errorFormat","adapter","log","transactionOptions","omit","__internal"],nu=["pretty","colorless","minimal"],iu=["info","query","warn","error"],kf={datasources:(e,{datasourceNames:r})=>{if(e){if(typeof e!="object"||Array.isArray(e))throw new _(`Invalid value ${JSON.stringify(e)} for "datasources" provided to PrismaClient constructor`);for(let[t,n]of Object.entries(e)){if(!r.includes(t)){let i=Jr(t,r)||` Available datasources: ${r.join(", ")}`;throw new _(`Unknown datasource ${t} provided to PrismaClient constructor.${i}`)}if(typeof n!="object"||Array.isArray(n))throw new _(`Invalid value ${JSON.stringify(e)} for datasource "${t}" 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 "${t}" 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 "${t}" provided to PrismaClient constructor.
|
||
|
|
It should have this form: { url: "CONNECTION_STRING" }`)}}}},adapter:(e,r)=>{if(!e&&Er(r.generator)==="client")throw new _('Using engine type "client" requires a driver adapter to be provided to PrismaClient constructor.');if(e!==null){if(e===void 0)throw new _('"adapter" property must not be undefined, use null to conditionally disable driver adapters.');if(Er(r.generator)==="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(!nu.includes(e)){let r=Jr(e,nu);throw new _(`Invalid errorFormat ${e} provided to PrismaClient constructor.${r}`)}}},log:e=>{if(!e)return;if(!Array.isArray(e))throw new _(`Invalid value ${JSON.stringify(e)} for "log" provided to PrismaClient constructor.`);function r(t){if(typeof t=="string"&&!iu.includes(t)){let n=Jr(t,iu);throw new _(`Invalid log level "${t}" provided to PrismaClient constructor.${n}`)}}for(let t of e){r(t);let n={level:r,emit:i=>{let o=["stdout","event"];if(!o.includes(i)){let s=Jr(i,o);throw new _(`Invalid value ${JSON.stringify(i)} for "emit" in logLevel provided to PrismaClient constructor.${s}`)}}};if(t&&typeof t=="object")for(let[i,o]of Object.entries(t))if(n[i])n[i](o);else throw new _(`Invalid property ${i} for "log" provided to PrismaClient constructor`)}},transactionOptions:e=>{if(!e)return;let r=e.maxWait;if(r!=null&&r<=0)throw new _(`Invalid value ${r} for maxWait in "transactionOptions" provided to PrismaClient constructor. maxWait needs to be greater than 0`);let t=e.timeout;if(t!=null&&t<=0)throw new _(`Invalid value ${t} for timeout in "transactionOptions" provided to PrismaClient constructor. timeout needs to be greater than 0`)},omit:(e,r)=>{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 t=[];for(let[n,i]of Object.entries(e)){let o=Nf(n,r.runtimeDataModel);if(!o){t.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){t.push({kind:"UnknownField",modelKey:n,fieldName:s});continue}if(l.relationName){t.push({kind:"RelationInOmit",modelKey:n,fieldName:s});continue}typeof a!="boolean"&&t.push({kind:"InvalidFieldValue",modelKey:n,fieldName:s})}}if(t.length>0)throw new _(Lf(e,t))},__internal:e=>{if(!e)return;let r=["debug","engine","configOverride"];if(typeof e!="object")throw new _(`Invalid value ${JSON.stringify(e)} for "__internal" to PrismaClient constructor`);for(let[t]of Object.entries(e))if(!r.includes(t)){let n=Jr(t,r);throw new _(`Invalid property ${JSON.stringify(t)} for "__internal" provided to PrismaClient constructor.${n}`)}}};function au(e,r){for(let[t,n]of Object.entries(e)){if(!tu.includes(t)){let i=Jr(t,tu);throw new _(`Unknown property ${t} provided to PrismaClient constructor.${i}`)}kf[t](n,r)}if(e.datasourceUrl&&e.datasources)throw new _('Can not use "datasourceUrl" and "datasources" options at the same time. Pick one of them')}function Jr(e,r){if(r.length===0||typeof e!="string")return"";let t=_f(e,r);return t?` Did you mean "${t}"?`:""}function _f(e,r){if(r.length===0)return null;let t=r.map(i=>({value:i,distance:(0,su.default)(e,i)}));t.sort((i,o)=>i.distance<o.distance?-1:1);let n=t[0];return n.distance<3?n.value:null}function Nf(e,r){return ou(r.models,e)??ou(r.types,e)}function ou(e,r){let t=Object.keys(e).find(n=>We(n)===r);if(t)return e[t]}function Lf(e,r){let t=_r(e);for(let o of r)switch(o.kind){case"UnknownModel":t.arguments.getField(o.modelKey)?.markAsError(),t.addErrorMessage(()=>`Unknown model name: ${o.modelKey}.`);break;case"UnknownField":t.arguments.getDeepField([o.modelKey,o.fieldName])?.markAsError(),t.addErrorMessage(()=>`Model "${o.modelKey}" does not have a field named "${o.fieldName}".`);break;case"RelationInOmit":t.arguments.getDeepField([o.modelKey,o.fieldName])?.markAsError(),t.addErrorMessage(()=>'Relations are already excluded by default and can not be specified in "omit".');break;case"InvalidFieldValue":t.arguments.getDeepFieldValue([o.modelKey,o.fieldName])?.markAsError(),t.addErrorMessage(()=>"Omit field option value must be a boolean.");break}let{message:n,args:i}=_n(t,"colorless");return`Error validating "omit" option:
|
||
|
|
|
||
|
|
${i}
|
||
|
|
|
||
|
|
${n}`}function lu(e){return e.length===0?Promise.resolve([]):new Promise((r,t)=>{let n=new Array(e.length),i=null,o=!1,s=0,a=()=>{o||(s++,s===e.length&&(o=!0,i?t(i):r(n)))},l=u=>{o||(o=!0,t(u))};for(let u=0;u<e.length;u++)e[u].then(c=>{n[u]=c,a()},c=>{if(!zn(c)){l(c);return}c.batchRequestIdx===u?l(c):(i||(i=c),a())})})}var rr=N("prisma:client");typeof globalThis=="object"&&(globalThis.NODE_CLIENT=!0);var Ff={requestArgsToMiddlewareArgs:e=>e,middlewareArgsToRequestArgs:e=>e},Mf=Symbol.for("prisma.client.transaction.id"),$f={id:0,nextId(){return++this.id}};function fu(e){class r{_originalClient=this;_runtimeDataModel;_requestHandler;_connectionPromise;_disconnectionPromise;_engineConfig;_accelerateEngineConfig;_clientVersion;_errorFormat;_tracingHelper;_previewFeatures;_activeProvider;_globalOmit;_extensions;_engine;_appliedParent;_createPrismaPromise=Ro();constructor(n){e=n?.__internal?.configOverride?.(e)??e,sl(e),n&&au(n,e);let i=new du.EventEmitter().on("error",()=>{});this._extensions=Nr.empty(),this._previewFeatures=$l(e),this._clientVersion=e.clientVersion??ru,this._activeProvider=e.activeProvider,this._globalOmit=n?.omit,this._tracingHelper=Hl();let o=e.relativeEnvPaths&&{rootEnvPath:e.relativeEnvPaths.rootEnvPath&&ri.default.resolve(e.dirname,e.relativeEnvPaths.rootEnvPath),schemaEnvPath:e.relativeEnvPaths.schemaEnvPath&&ri.default.resolve(e.dirname,e.relativeEnvPaths.schemaEnvPath)},s;if(n?.adapter){s=n.adapter;let l=e.activeProvider==="postgresql"||e.activeProvider==="cockroachdb"?"postgres":e.activeProvider;if(s.provider!==l)throw new P(`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 P("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&&o&&st(o,{conflictCheck:"none"})||e.injectableEdgeEnv?.();try{let l=n??{},u=l.__internal??{},c=u.debug===!0;c&&N.enable("prisma:client");let p=ri.default.resolve(e.dirname,e.relativePath);mu.default.existsSync(p)||(p=e.dirname),rr("dirname",e.dirname),rr("relativePath",e.relativePath),rr("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,prismaPath:d.binaryPath??void 0,engineEndpoint:d.endpoint,generator:e.generator,showColors:this._errorFormat==="pretty",logLevel:l.log&&zl(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,compilerWasm:e.compilerWasm,clientVersion:e.clientVersion,engineVersion:e.engineVersion,previewFeatures:this._previewFeatures,activeProvider:e.activeProvider,inlineSchema:e.inlineSchema,overrideDatasources:al(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:jr,getBatchRequestPayload:Mr,prismaGraphQLToJSError:$r,PrismaClientUnknownRequestError:V,PrismaClientInitializationError:P,PrismaClientKnownRequestError:z,debug:N("prisma:client:accelerateEngine"),engineVersion:cu.version,clientVersion:e.clientVersion}},rr("clientVersion",e.clientVersion),this._engine=Ml(e,this._engineConfig),this._requestHandler=new ei(this,i),l.log)for(let f of l.log){let h=typeof f=="string"?f:f.emit==="stdout"?f.level:null;h&&this.$on(h,g=>{nt.log(`${nt.tags[h]??
|
||
|
|
`)),c?.kind==="batch"&&await c.lock,this._requestHandler.request({protocolQuery:g,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(h){throw h.clientVersion=this._clientVersion,h}}$metrics=new Lr(this);_hasPreviewFlag(n){return!!this._engineConfig.previewFeatures?.includes(n)}$applyPendingMigrations(){return this._engine.applyPendingMigrations()}$extends=Wa}return r}function uu(e,r){return qf(e)?[new ie(e,r),Wl]:[e,Jl]}function qf(e){return Array.isArray(e)&&Array.isArray(e.raw)}var Vf=new Set(["toJSON","$$typeof","asymmetricMatch",Symbol.iterator,Symbol.toStringTag,Symbol.isConcatSpreadable,Symbol.toPrimitive]);function gu(e){return new Proxy(e,{get(r,t){if(t in r)return r[t];if(!Vf.has(t))throw new TypeError(`Invalid enum value: ${String(t)}`)}})}function hu(e){st(e,{conflictCheck:"warn"})}0&&(module.exports={DMMF,Debug,Decimal,Extensions,MetricsClient,PrismaClientInitializationError,PrismaClientKnownRequestError,PrismaClientRustPanicError,PrismaClientUnknownRequestError,PrismaClientValidationError,Public,Sql,createParam,defineDmmfProperty,deserializeJsonResponse,deserializeRawResult,dmmfToRuntimeDataModel,empty,getPrismaClient,getRuntime,join,makeStrictEnum,makeTypedQueryFactory,objectEnumValues,raw,serializeJsonQuery,skip,sqltag,warnEnvConflicts,warnOnce});
|
||
|
|
/*! Bundled license information:
|
||
|
|
|
||
|
|
decimal.js/decimal.mjs:
|
||
|
|
(*!
|
||
|
|
* decimal.js v10.5.0
|
||
|
|
* An arbitrary-precision Decimal type for JavaScript.
|
||
|
|
* https://github.com/MikeMcl/decimal.js
|
||
|
|
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|
||
|
|
* MIT Licence
|
||
|
|
*)
|
||
|
|
*/
|
||
|
|
//# sourceMappingURL=library.js.map
|