prisma 6.2.0-dev.7 → 6.2.0-dev.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +24 -24
- package/package.json +10 -10
- package/prisma-client/generator-build/index.js +1 -1
- package/prisma-client/package.json +1 -1
- package/prisma-client/runtime/binary.js +2 -2
- package/prisma-client/runtime/edge-esm.js +2 -2
- package/prisma-client/runtime/edge.js +2 -2
- package/prisma-client/runtime/library.js +2 -2
- package/prisma-client/runtime/react-native.js +2 -2
- package/prisma-client/scripts/default-index.js +1 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "6.2.0-dev.
|
|
2
|
+
"version": "6.2.0-dev.8",
|
|
3
3
|
"name": "prisma",
|
|
4
4
|
"description": "Prisma is an open-source database toolkit. It includes a JavaScript/TypeScript ORM for Node.js, migrations and a modern GUI to view and edit the data in your database. You can use Prisma in new projects or add it to an existing one.",
|
|
5
5
|
"keywords": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"node": ">=18.18"
|
|
42
42
|
},
|
|
43
43
|
"prisma": {
|
|
44
|
-
"prismaCommit": "
|
|
44
|
+
"prismaCommit": "c43e181b6dee722eba845488f2fb172d5f37a2a0"
|
|
45
45
|
},
|
|
46
46
|
"files": [
|
|
47
47
|
"README.md",
|
|
@@ -107,16 +107,16 @@
|
|
|
107
107
|
"typescript": "5.4.5",
|
|
108
108
|
"xdg-app-paths": "8.3.0",
|
|
109
109
|
"zx": "7.2.3",
|
|
110
|
-
"@prisma/
|
|
111
|
-
"@prisma/
|
|
112
|
-
"@prisma/
|
|
113
|
-
"@prisma/
|
|
114
|
-
"@prisma/
|
|
115
|
-
"@prisma/internals": "6.2.0-dev.
|
|
116
|
-
"@prisma/migrate": "6.2.0-dev.
|
|
110
|
+
"@prisma/client": "6.2.0-dev.8",
|
|
111
|
+
"@prisma/debug": "6.2.0-dev.8",
|
|
112
|
+
"@prisma/generator-helper": "6.2.0-dev.8",
|
|
113
|
+
"@prisma/get-platform": "6.2.0-dev.8",
|
|
114
|
+
"@prisma/fetch-engine": "6.2.0-dev.8",
|
|
115
|
+
"@prisma/internals": "6.2.0-dev.8",
|
|
116
|
+
"@prisma/migrate": "6.2.0-dev.8"
|
|
117
117
|
},
|
|
118
118
|
"dependencies": {
|
|
119
|
-
"@prisma/engines": "6.2.0-dev.
|
|
119
|
+
"@prisma/engines": "6.2.0-dev.8"
|
|
120
120
|
},
|
|
121
121
|
"optionalDependencies": {
|
|
122
122
|
"fsevents": "2.3.3"
|
|
@@ -3946,7 +3946,7 @@ var require_package2 = __commonJS({
|
|
|
3946
3946
|
"package.json"(exports2, module2) {
|
|
3947
3947
|
module2.exports = {
|
|
3948
3948
|
name: "@prisma/client",
|
|
3949
|
-
version: "6.2.0-dev.
|
|
3949
|
+
version: "6.2.0-dev.8",
|
|
3950
3950
|
description: "Prisma Client is an auto-generated, type-safe and modern JavaScript/TypeScript ORM for Node.js that's tailored to your data. Supports PostgreSQL, CockroachDB, MySQL, MariaDB, SQL Server, SQLite & MongoDB databases.",
|
|
3951
3951
|
keywords: [
|
|
3952
3952
|
"ORM",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client",
|
|
3
|
-
"version": "6.2.0-dev.
|
|
3
|
+
"version": "6.2.0-dev.8",
|
|
4
4
|
"description": "Prisma Client is an auto-generated, type-safe and modern JavaScript/TypeScript ORM for Node.js that's tailored to your data. Supports PostgreSQL, CockroachDB, MySQL, MariaDB, SQL Server, SQLite & MongoDB databases.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ORM",
|
|
@@ -77,7 +77,7 @@ ${(0,Af.default)(OS(r),2)}
|
|
|
77
77
|
`)}function iF(e){let A=[e.fileName];return e.lineNumber&&A.push(String(e.lineNumber)),e.columnNumber&&A.push(String(e.columnNumber)),A.join(":")}function wa(e){let A=e.showColors?zN:$N,t;return t=AF(e,A),nF(t,A)}var Mf=Z(Kl());function Lf(e,A,t){let r=Uf(e),n=sF(r),i=aF(n);i?Ra(i,A,t):A.addErrorMessage(()=>"Unknown error")}function Uf(e){return e.errors.flatMap(A=>A.kind==="Union"?Uf(A):[A])}function sF(e){let A=new Map,t=[];for(let r of e){if(r.kind!=="InvalidArgumentType"){t.push(r);continue}let n=`${r.selectionPath.join(".")}:${r.argumentPath.join(".")}`,i=A.get(n);i?A.set(n,{...r,argument:{...r.argument,typeNames:oF(i.argument.typeNames,r.argument.typeNames)}}):A.set(n,r)}return t.push(...A.values()),t}function oF(e,A){return[...new Set(e.concat(A))]}function aF(e){return Vl(e,(A,t)=>{let r=Ff(A),n=Ff(t);return r!==n?r-n:xf(A)-xf(t)})}function Ff(e){let A=0;return Array.isArray(e.selectionPath)&&(A+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(A+=e.argumentPath.length),A}function xf(e){switch(e.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}var DA=class{constructor(A,t){this.name=A;this.value=t;this.isRequired=!1}makeRequired(){return this.isRequired=!0,this}write(A){let{colors:{green:t}}=A.context;A.addMarginSymbol(t(this.isRequired?"+":"?")),A.write(t(this.name)),this.isRequired||A.write(t("?")),A.write(t(": ")),typeof this.value=="string"?A.write(t(this.value)):A.write(this.value)}};var Ln=class{constructor(A=0,t){this.context=t;this.lines=[];this.currentLine="";this.currentIndent=0;this.currentIndent=A}write(A){return typeof A=="string"?this.currentLine+=A:A.write(this),this}writeJoined(A,t,r=(n,i)=>i.write(n)){let n=t.length-1;for(let i=0;i<t.length;i++)r(t[i],this),i!==n&&this.write(A);return this}writeLine(A){return this.write(A).newLine()}newLine(){this.lines.push(this.indentedCurrentLine()),this.currentLine="",this.marginSymbol=void 0;let A=this.afterNextNewLineCallback;return this.afterNextNewLineCallback=void 0,A?.(),this}withIndent(A){return this.indent(),A(this),this.unindent(),this}afterNextNewline(A){return this.afterNextNewLineCallback=A,this}indent(){return this.currentIndent++,this}unindent(){return this.currentIndent>0&&this.currentIndent--,this}addMarginSymbol(A){return this.marginSymbol=A,this}toString(){return this.lines.concat(this.indentedCurrentLine()).join(`
|
|
78
78
|
`)}getCurrentLineLength(){return this.currentLine.length}indentedCurrentLine(){let A=this.currentLine.padStart(this.currentLine.length+2*this.currentIndent);return this.marginSymbol?this.marginSymbol+A.slice(1):A}};var Da=class{constructor(A){this.value=A}write(A){A.write(this.value)}markAsError(){this.value.markAsError()}};var ba=e=>e,ka={bold:ba,red:ba,green:ba,dim:ba,enabled:!1},Tf={bold:He,red:PA,green:nr,dim:Lr,enabled:!0},Un={write(e){e.writeLine(",")}};var ht=class{constructor(A){this.contents=A;this.isUnderlined=!1;this.color=A=>A}underline(){return this.isUnderlined=!0,this}setColor(A){return this.color=A,this}write(A){let t=A.getCurrentLineLength();A.write(this.color(this.contents)),this.isUnderlined&&A.afterNextNewline(()=>{A.write(" ".repeat(t)).writeLine(this.color("~".repeat(this.contents.length)))})}};var hr=class{constructor(){this.hasError=!1}markAsError(){return this.hasError=!0,this}};var Tn=class extends hr{constructor(){super(...arguments);this.items=[]}addItem(t){return this.items.push(new Da(t)),this}getField(t){return this.items[t]}getPrintWidth(){return this.items.length===0?2:Math.max(...this.items.map(r=>r.value.getPrintWidth()))+2}write(t){if(this.items.length===0){this.writeEmpty(t);return}this.writeWithItems(t)}writeEmpty(t){let r=new ht("[]");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithItems(t){let{colors:r}=t.context;t.writeLine("[").withIndent(()=>t.writeJoined(Un,this.items).newLine()).write("]"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(r.red("~".repeat(this.getPrintWidth())))})}asObject(){}};var Mn=class e extends hr{constructor(){super(...arguments);this.fields={};this.suggestions=[]}addField(t){this.fields[t.name]=t}addSuggestion(t){this.suggestions.push(t)}getField(t){return this.fields[t]}getDeepField(t){let[r,...n]=t,i=this.getField(r);if(!i)return;let s=i;for(let o of n){let a;if(s.value instanceof e?a=s.value.getField(o):s.value instanceof Tn&&(a=s.value.getField(Number(o))),!a)return;s=a}return s}getDeepFieldValue(t){return t.length===0?this:this.getDeepField(t)?.value}hasField(t){return!!this.getField(t)}removeAllFields(){this.fields={}}removeField(t){delete this.fields[t]}getFields(){return this.fields}isEmpty(){return Object.keys(this.fields).length===0}getFieldValue(t){return this.getField(t)?.value}getDeepSubSelectionValue(t){let r=this;for(let n of t){if(!(r instanceof e))return;let i=r.getSubSelectionValue(n);if(!i)return;r=i}return r}getDeepSelectionParent(t){let r=this.getSelectionParent();if(!r)return;let n=r;for(let i of t){let s=n.value.getFieldValue(i);if(!s||!(s instanceof e))return;let o=s.getSelectionParent();if(!o)return;n=o}return n}getSelectionParent(){let t=this.getField("select")?.value.asObject();if(t)return{kind:"select",value:t};let r=this.getField("include")?.value.asObject();if(r)return{kind:"include",value:r}}getSubSelectionValue(t){return this.getSelectionParent()?.value.fields[t].value}getPrintWidth(){let t=Object.values(this.fields);return t.length==0?2:Math.max(...t.map(n=>n.getPrintWidth()))+2}write(t){let r=Object.values(this.fields);if(r.length===0&&this.suggestions.length===0){this.writeEmpty(t);return}this.writeWithContents(t,r)}asObject(){return this}writeEmpty(t){let r=new ht("{}");this.hasError&&r.setColor(t.context.colors.red).underline(),t.write(r)}writeWithContents(t,r){t.writeLine("{").withIndent(()=>{t.writeJoined(Un,[...r,...this.suggestions]).newLine()}),t.write("}"),this.hasError&&t.afterNextNewline(()=>{t.writeLine(t.context.colors.red("~".repeat(this.getPrintWidth())))})}};var qe=class extends hr{constructor(t){super();this.text=t}getPrintWidth(){return this.text.length}write(t){let r=new ht(this.text);this.hasError&&r.underline().setColor(t.context.colors.red),t.write(r)}asObject(){}};var gs=class{constructor(){this.fields=[]}addField(A,t){return this.fields.push({write(r){let{green:n,dim:i}=r.context.colors;r.write(n(i(`${A}: ${t}`))).addMarginSymbol(n(i("+")))}}),this}write(A){let{colors:{green:t}}=A.context;A.writeLine(t("{")).withIndent(()=>{A.writeJoined(Un,this.fields).newLine()}).write(t("}")).addMarginSymbol(t("+"))}};function Ra(e,A,t){switch(e.kind){case"MutuallyExclusiveFields":gF(e,A);break;case"IncludeOnScalar":lF(e,A);break;case"EmptySelection":uF(e,A,t);break;case"UnknownSelectionField":QF(e,A);break;case"InvalidSelectionValue":CF(e,A);break;case"UnknownArgument":fF(e,A);break;case"UnknownInputField":IF(e,A);break;case"RequiredArgumentMissing":BF(e,A);break;case"InvalidArgumentType":pF(e,A);break;case"InvalidArgumentValue":mF(e,A);break;case"ValueTooLarge":yF(e,A);break;case"SomeFieldsMissing":wF(e,A);break;case"TooManyFieldsGiven":RF(e,A);break;case"Union":Lf(e,A,t);break;default:throw new Error("not implemented: "+e.kind)}}function gF(e,A){let t=A.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();t&&(t.getField(e.firstField)?.markAsError(),t.getField(e.secondField)?.markAsError()),A.addErrorMessage(r=>`Please ${r.bold("either")} use ${r.green(`\`${e.firstField}\``)} or ${r.green(`\`${e.secondField}\``)}, but ${r.red("not both")} at the same time.`)}function lF(e,A){let[t,r]=ls(e.selectionPath),n=e.outputType,i=A.arguments.getDeepSelectionParent(t)?.value;if(i&&(i.getField(r)?.markAsError(),n))for(let s of n.fields)s.isRelation&&i.addSuggestion(new DA(s.name,"true"));A.addErrorMessage(s=>{let o=`Invalid scalar field ${s.red(`\`${r}\``)} for ${s.bold("include")} statement`;return n?o+=` on model ${s.bold(n.name)}. ${us(s)}`:o+=".",o+=`
|
|
79
79
|
Note that ${s.bold("include")} statements only accept relation fields.`,o})}function uF(e,A,t){let r=A.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(r){let n=r.getField("omit")?.value.asObject();if(n){EF(e,A,n);return}if(r.hasField("select")){hF(e,A);return}}if(t?.[Nn(e.outputType.name)]){dF(e,A);return}A.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function EF(e,A,t){t.removeAllFields();for(let r of e.outputType.fields)t.addSuggestion(new DA(r.name,"false"));A.addErrorMessage(r=>`The ${r.red("omit")} statement includes every field of the model ${r.bold(e.outputType.name)}. At least one field must be included in the result`)}function hF(e,A){let t=e.outputType,r=A.arguments.getDeepSelectionParent(e.selectionPath)?.value,n=r?.isEmpty()??!1;r&&(r.removeAllFields(),Gf(r,t)),A.addErrorMessage(i=>n?`The ${i.red("`select`")} statement for type ${i.bold(t.name)} must not be empty. ${us(i)}`:`The ${i.red("`select`")} statement for type ${i.bold(t.name)} needs ${i.bold("at least one truthy value")}.`)}function dF(e,A){let t=new gs;for(let n of e.outputType.fields)n.isRelation||t.addField(n.name,"false");let r=new DA("omit",t).makeRequired();if(e.selectionPath.length===0)A.arguments.addSuggestion(r);else{let[n,i]=ls(e.selectionPath),o=A.arguments.getDeepSelectionParent(n)?.value.asObject()?.getField(i);if(o){let a=o?.value.asObject()??new Mn;a.addSuggestion(r),o.value=a}}A.addErrorMessage(n=>`The global ${n.red("omit")} configuration excludes every field of the model ${n.bold(e.outputType.name)}. At least one field must be included in the result`)}function QF(e,A){let t=Yf(e.selectionPath,A);if(t.parentKind!=="unknown"){t.field.markAsError();let r=t.parent;switch(t.parentKind){case"select":Gf(r,e.outputType);break;case"include":DF(r,e.outputType);break;case"omit":bF(r,e.outputType);break}}A.addErrorMessage(r=>{let n=[`Unknown field ${r.red(`\`${t.fieldName}\``)}`];return t.parentKind!=="unknown"&&n.push(`for ${r.bold(t.parentKind)} statement`),n.push(`on model ${r.bold(`\`${e.outputType.name}\``)}.`),n.push(us(r)),n.join(" ")})}function CF(e,A){let t=Yf(e.selectionPath,A);t.parentKind!=="unknown"&&t.field.value.markAsError(),A.addErrorMessage(r=>`Invalid value for selection field \`${r.red(t.fieldName)}\`: ${e.underlyingError}`)}function fF(e,A){let t=e.argumentPath[0],r=A.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();r&&(r.getField(t)?.markAsError(),kF(r,e.arguments)),A.addErrorMessage(n=>vf(n,t,e.arguments.map(i=>i.name)))}function IF(e,A){let[t,r]=ls(e.argumentPath),n=A.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){n.getDeepField(e.argumentPath)?.markAsError();let i=n.getDeepFieldValue(t)?.asObject();i&&Jf(i,e.inputType)}A.addErrorMessage(i=>vf(i,r,e.inputType.fields.map(s=>s.name)))}function vf(e,A,t){let r=[`Unknown argument \`${e.red(A)}\`.`],n=NF(A,t);return n&&r.push(`Did you mean \`${e.green(n)}\`?`),t.length>0&&r.push(us(e)),r.join(" ")}function BF(e,A){let t;A.addErrorMessage(a=>t?.value instanceof qe&&t.value.text==="null"?`Argument \`${a.green(i)}\` must not be ${a.red("null")}.`:`Argument \`${a.green(i)}\` is missing.`);let r=A.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(!r)return;let[n,i]=ls(e.argumentPath),s=new gs,o=r.getDeepFieldValue(n)?.asObject();if(o)if(t=o.getField(i),t&&o.removeField(i),e.inputTypes.length===1&&e.inputTypes[0].kind==="object"){for(let a of e.inputTypes[0].fields)s.addField(a.name,a.typeNames.join(" | "));o.addSuggestion(new DA(i,s).makeRequired())}else{let a=e.inputTypes.map(Pf).join(" | ");o.addSuggestion(new DA(i,a).makeRequired())}}function Pf(e){return e.kind==="list"?`${Pf(e.elementType)}[]`:e.name}function pF(e,A){let t=e.argument.name,r=A.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();r&&r.getDeepFieldValue(e.argumentPath)?.markAsError(),A.addErrorMessage(n=>{let i=Sa("or",e.argument.typeNames.map(s=>n.green(s)));return`Argument \`${n.bold(t)}\`: Invalid value provided. Expected ${i}, provided ${n.red(e.inferredType)}.`})}function mF(e,A){let t=e.argument.name,r=A.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();r&&r.getDeepFieldValue(e.argumentPath)?.markAsError(),A.addErrorMessage(n=>{let i=[`Invalid value for argument \`${n.bold(t)}\``];if(e.underlyingError&&i.push(`: ${e.underlyingError}`),i.push("."),e.argument.typeNames.length>0){let s=Sa("or",e.argument.typeNames.map(o=>n.green(o)));i.push(` Expected ${s}.`)}return i.join("")})}function yF(e,A){let t=e.argument.name,r=A.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject(),n;if(r){let s=r.getDeepField(e.argumentPath)?.value;s?.markAsError(),s instanceof qe&&(n=s.text)}A.addErrorMessage(i=>{let s=["Unable to fit value"];return n&&s.push(i.red(n)),s.push(`into a 64-bit signed integer for field \`${i.bold(t)}\``),s.join(" ")})}function wF(e,A){let t=e.argumentPath[e.argumentPath.length-1],r=A.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(r){let n=r.getDeepFieldValue(e.argumentPath)?.asObject();n&&Jf(n,e.inputType)}A.addErrorMessage(n=>{let i=[`Argument \`${n.bold(t)}\` of type ${n.bold(e.inputType.name)} needs`];return e.constraints.minFieldCount===1?e.constraints.requiredFields?i.push(`${n.green("at least one of")} ${Sa("or",e.constraints.requiredFields.map(s=>`\`${n.bold(s)}\``))} arguments.`):i.push(`${n.green("at least one")} argument.`):i.push(`${n.green(`at least ${e.constraints.minFieldCount}`)} arguments.`),i.push(us(n)),i.join(" ")})}function RF(e,A){let t=e.argumentPath[e.argumentPath.length-1],r=A.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject(),n=[];if(r){let i=r.getDeepFieldValue(e.argumentPath)?.asObject();i&&(i.markAsError(),n=Object.keys(i.getFields()))}A.addErrorMessage(i=>{let s=[`Argument \`${i.bold(t)}\` of type ${i.bold(e.inputType.name)} needs`];return e.constraints.minFieldCount===1&&e.constraints.maxFieldCount==1?s.push(`${i.green("exactly one")} argument,`):e.constraints.maxFieldCount==1?s.push(`${i.green("at most one")} argument,`):s.push(`${i.green(`at most ${e.constraints.maxFieldCount}`)} arguments,`),s.push(`but you provided ${Sa("and",n.map(o=>i.red(o)))}. Please choose`),e.constraints.maxFieldCount===1?s.push("one."):s.push(`${e.constraints.maxFieldCount}.`),s.join(" ")})}function Gf(e,A){for(let t of A.fields)e.hasField(t.name)||e.addSuggestion(new DA(t.name,"true"))}function DF(e,A){for(let t of A.fields)t.isRelation&&!e.hasField(t.name)&&e.addSuggestion(new DA(t.name,"true"))}function bF(e,A){for(let t of A.fields)!e.hasField(t.name)&&!t.isRelation&&e.addSuggestion(new DA(t.name,"true"))}function kF(e,A){for(let t of A)e.hasField(t.name)||e.addSuggestion(new DA(t.name,t.typeNames.join(" | ")))}function Yf(e,A){let[t,r]=ls(e),n=A.arguments.getDeepSubSelectionValue(t)?.asObject();if(!n)return{parentKind:"unknown",fieldName:r};let i=n.getFieldValue("select")?.asObject(),s=n.getFieldValue("include")?.asObject(),o=n.getFieldValue("omit")?.asObject(),a=i?.getField(r);return i&&a?{parentKind:"select",parent:i,field:a,fieldName:r}:(a=s?.getField(r),s&&a?{parentKind:"include",field:a,parent:s,fieldName:r}:(a=o?.getField(r),o&&a?{parentKind:"omit",field:a,parent:o,fieldName:r}:{parentKind:"unknown",fieldName:r}))}function Jf(e,A){if(A.kind==="object")for(let t of A.fields)e.hasField(t.name)||e.addSuggestion(new DA(t.name,t.typeNames.join(" | ")))}function ls(e){let A=[...e],t=A.pop();if(!t)throw new Error("unexpected empty path");return[A,t]}function us({green:e,enabled:A}){return"Available options are "+(A?`listed in ${e("green")}`:"marked with ?")+"."}function Sa(e,A){if(A.length===1)return A[0];let t=[...A],r=t.pop();return`${t.join(", ")} ${e} ${r}`}var SF=3;function NF(e,A){let t=1/0,r;for(let n of A){let i=(0,Mf.default)(e,n);i>SF||i<t&&(t=i,r=n)}return r}function Vf(e){return e.substring(0,1).toLowerCase()+e.substring(1)}var Es=class{constructor(A,t,r,n,i){this.modelName=A,this.name=t,this.typeName=r,this.isList=n,this.isEnum=i}_toGraphQLInputType(){let A=this.isList?"List":"",t=this.isEnum?"Enum":"";return`${A}${t}${this.typeName}FieldRefInput<${this.modelName}>`}};function vn(e){return e instanceof Es}var Na=Symbol(),Zl=new WeakMap,Jt=class{constructor(A){A===Na?Zl.set(this,`Prisma.${this._getName()}`):Zl.set(this,`new Prisma.${this._getNamespace()}.${this._getName()}()`)}_getName(){return this.constructor.name}toString(){return Zl.get(this)}},hs=class extends Jt{_getNamespace(){return"NullTypes"}},ds=class extends hs{};Xl(ds,"DbNull");var Qs=class extends hs{};Xl(Qs,"JsonNull");var Cs=class extends hs{};Xl(Cs,"AnyNull");var Fa={classes:{DbNull:ds,JsonNull:Qs,AnyNull:Cs},instances:{DbNull:new ds(Na),JsonNull:new Qs(Na),AnyNull:new Cs(Na)}};function Xl(e,A){Object.defineProperty(e,"name",{value:A,configurable:!0})}var qf=": ",xa=class{constructor(A,t){this.name=A;this.value=t;this.hasError=!1}markAsError(){this.hasError=!0}getPrintWidth(){return this.name.length+this.value.getPrintWidth()+qf.length}write(A){let t=new ht(this.name);this.hasError&&t.underline().setColor(A.context.colors.red),A.write(t).write(qf).write(this.value)}};var zl=class{constructor(A){this.errorMessages=[];this.arguments=A}write(A){A.write(this.arguments)}addErrorMessage(A){this.errorMessages.push(A)}renderAllMessages(A){return this.errorMessages.map(t=>t(A)).join(`
|
|
80
|
-
`)}};function Pn(e){return new zl(Of(e))}function Of(e){let A=new Mn;for(let[t,r]of Object.entries(e)){let n=new xa(t,Hf(r));A.addField(n)}return A}function Hf(e){if(typeof e=="string")return new qe(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new qe(String(e));if(typeof e=="bigint")return new qe(`${e}n`);if(e===null)return new qe("null");if(e===void 0)return new qe("undefined");if(xn(e))return new qe(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return Buffer.isBuffer(e)?new qe(`Buffer.alloc(${e.byteLength})`):new qe(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let A=pa(e)?e.toISOString():"Invalid Date";return new qe(`new Date("${A}")`)}return e instanceof Jt?new qe(`Prisma.${e._getName()}`):vn(e)?new qe(`prisma.${Vf(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?FF(e):typeof e=="object"?Of(e):new qe(Object.prototype.toString.call(e))}function FF(e){let A=new Tn;for(let t of e)A.addItem(Hf(t));return A}function La(e,A){let t=A==="pretty"?Tf:ka,r=e.renderAllMessages(t),n=new Ln(0,{colors:t}).write(e).toString();return{message:r,args:n}}function Ua({args:e,errors:A,errorFormat:t,callsite:r,originalMethod:n,clientVersion:i,globalOmit:s}){let o=Pn(e);for(let l of A)Ra(l,o,s);let{message:a,args:c}=La(o,t),g=wa({message:a,callsite:r,originalMethod:n,showColors:t==="pretty",callArguments:c});throw new ze(g,{clientVersion:i})}var dt=class{constructor(){this._map=new Map}get(A){return this._map.get(A)?.value}set(A,t){this._map.set(A,{value:t})}getOrCreate(A,t){let r=this._map.get(A);if(r)return r.value;let n=t();return this.set(A,n),n}};function fs(e){let A;return{get(){return A||(A={value:e()}),A.value}}}function Qt(e){return e.replace(/^./,A=>A.toLowerCase())}function _f(e,A,t){let r=Qt(t);return!A.result||!(A.result.$allModels||A.result[r])?e:xF({...e,...Wf(A.name,e,A.result.$allModels),...Wf(A.name,e,A.result[r])})}function xF(e){let A=new dt,t=(r,n)=>A.getOrCreate(r,()=>n.has(r)?[r]:(n.add(r),e[r]?e[r].needs.flatMap(i=>t(i,n)):[r]));return Dn(e,r=>({...r,needs:t(r.name,new Set)}))}function Wf(e,A,t){return t?Dn(t,({needs:r,compute:n},i)=>({name:i,needs:r?Object.keys(r).filter(s=>r[s]):[],compute:LF(A,i,n)})):{}}function LF(e,A,t){let r=e?.[A]?.compute;return r?n=>t({...n,[A]:r(n)}):t}function jf(e,A){if(!A)return e;let t={...e};for(let r of Object.values(A))if(e[r.name])for(let n of r.needs)t[n]=!0;return t}function Kf(e,A){if(!A)return e;let t={...e};for(let r of Object.values(A))if(!e[r.name])for(let n of r.needs)delete t[n];return t}var Ta=class{constructor(A,t){this.extension=A;this.previous=t;this.computedFieldsCache=new dt;this.modelExtensionsCache=new dt;this.queryCallbacksCache=new dt;this.clientExtensions=fs(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());this.batchCallbacks=fs(()=>{let A=this.previous?.getAllBatchQueryCallbacks()??[],t=this.extension.query?.$__internalBatch;return t?A.concat(t):A})}getAllComputedFields(A){return this.computedFieldsCache.getOrCreate(A,()=>_f(this.previous?.getAllComputedFields(A),this.extension,A))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(A){return this.modelExtensionsCache.getOrCreate(A,()=>{let t=Qt(A);return!this.extension.model||!(this.extension.model[t]||this.extension.model.$allModels)?this.previous?.getAllModelExtensions(A):{...this.previous?.getAllModelExtensions(A),...this.extension.model.$allModels,...this.extension.model[t]}})}getAllQueryCallbacks(A,t){return this.queryCallbacksCache.getOrCreate(`${A}:${t}`,()=>{let r=this.previous?.getAllQueryCallbacks(A,t)??[],n=[],i=this.extension.query;return!i||!(i[A]||i.$allModels||i[t]||i.$allOperations)?r:(i[A]!==void 0&&(i[A][t]!==void 0&&n.push(i[A][t]),i[A].$allOperations!==void 0&&n.push(i[A].$allOperations)),A!=="$none"&&i.$allModels!==void 0&&(i.$allModels[t]!==void 0&&n.push(i.$allModels[t]),i.$allModels.$allOperations!==void 0&&n.push(i.$allModels.$allOperations)),i[t]!==void 0&&n.push(i[t]),i.$allOperations!==void 0&&n.push(i.$allOperations),r.concat(n))})}getAllBatchQueryCallbacks(){return this.batchCallbacks.get()}},Gn=class e{constructor(A){this.head=A}static empty(){return new e}static single(A){return new e(new Ta(A))}isEmpty(){return this.head===void 0}append(A){return new e(new Ta(A,this.head))}getAllComputedFields(A){return this.head?.getAllComputedFields(A)}getAllClientExtensions(){return this.head?.getAllClientExtensions()}getAllModelExtensions(A){return this.head?.getAllModelExtensions(A)}getAllQueryCallbacks(A,t){return this.head?.getAllQueryCallbacks(A,t)??[]}getAllBatchQueryCallbacks(){return this.head?.getAllBatchQueryCallbacks()??[]}};var Zf=Symbol(),Is=class{constructor(A){if(A!==Zf)throw new Error("Skip instance can not be constructed directly")}ifUndefined(A){return A===void 0?Ma:A}},Ma=new Is(Zf);function Ct(e){return e instanceof Is}var UF={findUnique:"findUnique",findUniqueOrThrow:"findUniqueOrThrow",findFirst:"findFirst",findFirstOrThrow:"findFirstOrThrow",findMany:"findMany",count:"aggregate",create:"createOne",createMany:"createMany",createManyAndReturn:"createManyAndReturn",update:"updateOne",updateMany:"updateMany",upsert:"upsertOne",delete:"deleteOne",deleteMany:"deleteMany",executeRaw:"executeRaw",queryRaw:"queryRaw",aggregate:"aggregate",groupBy:"groupBy",runCommandRaw:"runCommandRaw",findRaw:"findRaw",aggregateRaw:"aggregateRaw"},Xf="explicitly `undefined` values are not allowed";function va({modelName:e,action:A,args:t,runtimeDataModel:r,extensions:n=Gn.empty(),callsite:i,clientMethod:s,errorFormat:o,clientVersion:a,previewFeatures:c,globalOmit:g}){let l=new $l({runtimeDataModel:r,modelName:e,action:A,rootArgs:t,callsite:i,extensions:n,selectionPath:[],argumentPath:[],originalMethod:s,errorFormat:o,clientVersion:a,previewFeatures:c,globalOmit:g});return{modelName:e,action:UF[A],query:Bs(t,l)}}function Bs({select:e,include:A,...t}={},r){let n;return r.isPreviewFeatureOn("omitApi")&&(n=t.omit,delete t.omit),{arguments:$f(t,r),selection:TF(e,A,n,r)}}function TF(e,A,t,r){return e?(A?r.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"include",secondField:"select",selectionPath:r.getSelectionPath()}):t&&r.isPreviewFeatureOn("omitApi")&&r.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"omit",secondField:"select",selectionPath:r.getSelectionPath()}),GF(e,r)):MF(r,A,t)}function MF(e,A,t){let r={};return e.modelOrType&&!e.isRawAction()&&(r.$composites=!0,r.$scalars=!0),A&&vF(r,A,e),e.isPreviewFeatureOn("omitApi")&&PF(r,t,e),r}function vF(e,A,t){for(let[r,n]of Object.entries(A)){if(Ct(n))continue;let i=t.nestSelection(r);if(eu(n,i),n===!1||n===void 0){e[r]=!1;continue}let s=t.findField(r);if(s&&s.kind!=="object"&&t.throwValidationError({kind:"IncludeOnScalar",selectionPath:t.getSelectionPath().concat(r),outputType:t.getOutputTypeDescription()}),s){e[r]=Bs(n===!0?{}:n,i);continue}if(n===!0){e[r]=!0;continue}e[r]=Bs(n,i)}}function PF(e,A,t){let r=t.getComputedFields(),n={...t.getGlobalOmit(),...A},i=Kf(n,r);for(let[s,o]of Object.entries(i)){if(Ct(o))continue;eu(o,t.nestSelection(s));let a=t.findField(s);r?.[s]&&!a||(e[s]=!o)}}function GF(e,A){let t={},r=A.getComputedFields(),n=jf(e,r);for(let[i,s]of Object.entries(n)){if(Ct(s))continue;let o=A.nestSelection(i);eu(s,o);let a=A.findField(i);if(!(r?.[i]&&!a)){if(s===!1||s===void 0||Ct(s)){t[i]=!1;continue}if(s===!0){a?.kind==="object"?t[i]=Bs({},o):t[i]=!0;continue}t[i]=Bs(s,o)}}return t}function zf(e,A){if(e===null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="bigint")return{$type:"BigInt",value:String(e)};if(Fn(e)){if(pa(e))return{$type:"DateTime",value:e.toISOString()};A.throwValidationError({kind:"InvalidArgumentValue",selectionPath:A.getSelectionPath(),argumentPath:A.getArgumentPath(),argument:{name:A.getArgumentName(),typeNames:["Date"]},underlyingError:"Provided Date object is invalid"})}if(vn(e))return{$type:"FieldRef",value:{_ref:e.name,_container:e.modelName}};if(Array.isArray(e))return YF(e,A);if(ArrayBuffer.isView(e)){let{buffer:t,byteOffset:r,byteLength:n}=e;return{$type:"Bytes",value:Buffer.from(t,r,n).toString("base64")}}if(JF(e))return e.values;if(xn(e))return{$type:"Decimal",value:e.toFixed()};if(e instanceof Jt){if(e!==Fa.instances[e._getName()])throw new Error("Invalid ObjectEnumValue");return{$type:"Enum",value:e._getName()}}if(VF(e))return e.toJSON();if(typeof e=="object")return $f(e,A);A.throwValidationError({kind:"InvalidArgumentValue",selectionPath:A.getSelectionPath(),argumentPath:A.getArgumentPath(),argument:{name:A.getArgumentName(),typeNames:[]},underlyingError:`We could not serialize ${Object.prototype.toString.call(e)} value. Serialize the object to JSON or implement a ".toJSON()" method on it`})}function $f(e,A){if(e.$type)return{$type:"Raw",value:e};let t={};for(let r in e){let n=e[r],i=A.nestArgument(r);Ct(n)||(n!==void 0?t[r]=zf(n,i):A.isPreviewFeatureOn("strictUndefinedChecks")&&A.throwValidationError({kind:"InvalidArgumentValue",argumentPath:i.getArgumentPath(),selectionPath:A.getSelectionPath(),argument:{name:A.getArgumentName(),typeNames:[]},underlyingError:Xf}))}return t}function YF(e,A){let t=[];for(let r=0;r<e.length;r++){let n=A.nestArgument(String(r)),i=e[r];if(i===void 0||Ct(i)){let s=i===void 0?"undefined":"Prisma.skip";A.throwValidationError({kind:"InvalidArgumentValue",selectionPath:n.getSelectionPath(),argumentPath:n.getArgumentPath(),argument:{name:`${A.getArgumentName()}[${r}]`,typeNames:[]},underlyingError:`Can not use \`${s}\` value within array. Use \`null\` or filter out \`${s}\` values`})}t.push(zf(i,n))}return t}function JF(e){return typeof e=="object"&&e!==null&&e.__prismaRawParameters__===!0}function VF(e){return typeof e=="object"&&e!==null&&typeof e.toJSON=="function"}function eu(e,A){e===void 0&&A.isPreviewFeatureOn("strictUndefinedChecks")&&A.throwValidationError({kind:"InvalidSelectionValue",selectionPath:A.getSelectionPath(),underlyingError:Xf})}var $l=class e{constructor(A){this.params=A;this.params.modelName&&(this.modelOrType=this.params.runtimeDataModel.models[this.params.modelName]??this.params.runtimeDataModel.types[this.params.modelName])}throwValidationError(A){Ua({errors:[A],originalMethod:this.params.originalMethod,args:this.params.rootArgs??{},callsite:this.params.callsite,errorFormat:this.params.errorFormat,clientVersion:this.params.clientVersion,globalOmit:this.params.globalOmit})}getSelectionPath(){return this.params.selectionPath}getArgumentPath(){return this.params.argumentPath}getArgumentName(){return this.params.argumentPath[this.params.argumentPath.length-1]}getOutputTypeDescription(){if(!(!this.params.modelName||!this.modelOrType))return{name:this.params.modelName,fields:this.modelOrType.fields.map(A=>({name:A.name,typeName:"boolean",isRelation:A.kind==="object"}))}}isRawAction(){return["executeRaw","queryRaw","runCommandRaw","findRaw","aggregateRaw"].includes(this.params.action)}isPreviewFeatureOn(A){return this.params.previewFeatures.includes(A)}getComputedFields(){if(this.params.modelName)return this.params.extensions.getAllComputedFields(this.params.modelName)}findField(A){return this.modelOrType?.fields.find(t=>t.name===A)}nestSelection(A){let t=this.findField(A),r=t?.kind==="object"?t.type:void 0;return new e({...this.params,modelName:r,selectionPath:this.params.selectionPath.concat(A)})}getGlobalOmit(){return this.params.modelName&&this.shouldApplyGlobalOmit()?this.params.globalOmit?.[Nn(this.params.modelName)]??{}:{}}shouldApplyGlobalOmit(){switch(this.params.action){case"findFirst":case"findFirstOrThrow":case"findUniqueOrThrow":case"findMany":case"upsert":case"findUnique":case"createManyAndReturn":case"create":case"update":case"delete":return!0;case"executeRaw":case"aggregateRaw":case"runCommandRaw":case"findRaw":case"createMany":case"deleteMany":case"groupBy":case"updateMany":case"count":case"aggregate":case"queryRaw":return!1;default:Gt(this.params.action,"Unknown action")}}nestArgument(A){return new e({...this.params,argumentPath:this.params.argumentPath.concat(A)})}};var Yn=class{constructor(A){this._engine=A}prometheus(A){return this._engine.metrics({format:"prometheus",...A})}json(A){return this._engine.metrics({format:"json",...A})}};function eI(e){return{models:Au(e.models),enums:Au(e.enums),types:Au(e.types)}}function Au(e){let A={};for(let{name:t,...r}of e)A[t]=r;return A}function AI(e,A){let t=fs(()=>qF(A));Object.defineProperty(e,"dmmf",{get:()=>t.get()})}function qF(e){return{datamodel:{models:tu(e.models),enums:tu(e.enums),types:tu(e.types)}}}function tu(e){return Object.entries(e).map(([A,t])=>({name:A,...t}))}var ru=new WeakMap,Pa="$$PrismaTypedSql",nu=class{constructor(A,t){ru.set(this,{sql:A,values:t}),Object.defineProperty(this,Pa,{value:Pa})}get sql(){return ru.get(this).sql}get values(){return ru.get(this).values}};function tI(e){return(...A)=>new nu(e,A)}function rI(e){return e!=null&&e[Pa]===Pa}function ps(e){return{ok:!1,error:e,map(){return ps(e)},flatMap(){return ps(e)}}}var iu=class{constructor(){this.registeredErrors=[]}consumeError(A){return this.registeredErrors[A]}registerNewError(A){let t=0;for(;this.registeredErrors[t]!==void 0;)t++;return this.registeredErrors[t]={error:A},t}},su=e=>{let A=new iu,t=ft(A,e.transactionContext.bind(e)),r={adapterName:e.adapterName,errorRegistry:A,queryRaw:ft(A,e.queryRaw.bind(e)),executeRaw:ft(A,e.executeRaw.bind(e)),provider:e.provider,transactionContext:async(...n)=>(await t(...n)).map(s=>OF(A,s))};return e.getConnectionInfo&&(r.getConnectionInfo=WF(A,e.getConnectionInfo.bind(e))),r},OF=(e,A)=>{let t=ft(e,A.startTransaction.bind(A));return{adapterName:A.adapterName,provider:A.provider,queryRaw:ft(e,A.queryRaw.bind(A)),executeRaw:ft(e,A.executeRaw.bind(A)),startTransaction:async(...r)=>(await t(...r)).map(i=>HF(e,i))}},HF=(e,A)=>({adapterName:A.adapterName,provider:A.provider,options:A.options,queryRaw:ft(e,A.queryRaw.bind(A)),executeRaw:ft(e,A.executeRaw.bind(A)),commit:ft(e,A.commit.bind(A)),rollback:ft(e,A.rollback.bind(A))});function ft(e,A){return async(...t)=>{try{return await A(...t)}catch(r){let n=e.registerNewError(r);return ps({kind:"GenericJs",id:n})}}}function WF(e,A){return(...t)=>{try{return A(...t)}catch(r){let n=e.registerNewError(r);return ps({kind:"GenericJs",id:n})}}}var yD=Z(Rl());var wD=require("async_hooks"),RD=require("events"),DD=Z(require("fs")),Uo=Z(require("path"));var QA=class e{constructor(A,t){if(A.length-1!==t.length)throw A.length===0?new TypeError("Expected at least 1 string"):new TypeError(`Expected ${A.length} strings to have ${A.length-1} values`);let r=t.reduce((s,o)=>s+(o instanceof e?o.values.length:1),0);this.values=new Array(r),this.strings=new Array(r+1),this.strings[0]=A[0];let n=0,i=0;for(;n<t.length;){let s=t[n++],o=A[n];if(s instanceof e){this.strings[i]+=s.strings[0];let a=0;for(;a<s.values.length;)this.values[i++]=s.values[a++],this.strings[i]=s.strings[a];this.strings[i]+=o}else this.values[i++]=s,this.strings[i]=o}}get sql(){let A=this.strings.length,t=1,r=this.strings[0];for(;t<A;)r+=`?${this.strings[t++]}`;return r}get statement(){let A=this.strings.length,t=1,r=this.strings[0];for(;t<A;)r+=`:${t}${this.strings[t++]}`;return r}get text(){let A=this.strings.length,t=1,r=this.strings[0];for(;t<A;)r+=`$${t}${this.strings[t++]}`;return r}inspect(){return{sql:this.sql,statement:this.statement,text:this.text,values:this.values}}};function nI(e,A=",",t="",r=""){if(e.length===0)throw new TypeError("Expected `join([])` to be called with an array of multiple elements, but got an empty array");return new QA([t,...Array(e.length-1).fill(A),r],e)}function ou(e){return new QA([e],[])}var iI=ou("");function au(e,...A){return new QA(e,A)}function ms(e){return{getKeys(){return Object.keys(e)},getPropertyValue(A){return e[A]}}}function iA(e,A){return{getKeys(){return[e]},getPropertyValue(){return A()}}}function Jr(e){let A=new dt;return{getKeys(){return e.getKeys()},getPropertyValue(t){return A.getOrCreate(t,()=>e.getPropertyValue(t))},getPropertyDescriptor(t){return e.getPropertyDescriptor?.(t)}}}var Ga={enumerable:!0,configurable:!0,writable:!0};function Ya(e){let A=new Set(e);return{getOwnPropertyDescriptor:()=>Ga,has:(t,r)=>A.has(r),set:(t,r,n)=>A.add(r)&&Reflect.set(t,r,n),ownKeys:()=>[...A]}}var sI=Symbol.for("nodejs.util.inspect.custom");function It(e,A){let t=_F(A),r=new Set,n=new Proxy(e,{get(i,s){if(r.has(s))return i[s];let o=t.get(s);return o?o.getPropertyValue(s):i[s]},has(i,s){if(r.has(s))return!0;let o=t.get(s);return o?o.has?.(s)??!0:Reflect.has(i,s)},ownKeys(i){let s=oI(Reflect.ownKeys(i),t),o=oI(Array.from(t.keys()),t);return[...new Set([...s,...o,...r])]},set(i,s,o){return t.get(s)?.getPropertyDescriptor?.(s)?.writable===!1?!1:(r.add(s),Reflect.set(i,s,o))},getOwnPropertyDescriptor(i,s){let o=Reflect.getOwnPropertyDescriptor(i,s);if(o&&!o.configurable)return o;let a=t.get(s);return a?a.getPropertyDescriptor?{...Ga,...a?.getPropertyDescriptor(s)}:Ga:o},defineProperty(i,s,o){return r.add(s),Reflect.defineProperty(i,s,o)}});return n[sI]=function(){let i={...this};return delete i[sI],i},n}function _F(e){let A=new Map;for(let t of e){let r=t.getKeys();for(let n of r)A.set(n,t)}return A}function oI(e,A){return e.filter(t=>A.get(t)?.has?.(t)??!0)}function Jn(e){return{getKeys(){return e},has(){return!1},getPropertyValue(){}}}function Vn(e,A){return{batch:e,transaction:A?.kind==="batch"?{isolationLevel:A.options.isolationLevel}:void 0}}function aI(e){if(e===void 0)return"";let A=Pn(e);return new Ln(0,{colors:ka}).write(A).toString()}var jF="P2037";function dr({error:e,user_facing_error:A},t,r){return A.error_code?new We(KF(A,r),{code:A.error_code,clientVersion:t,meta:A.meta,batchRequestIdx:A.batch_request_idx}):new ve(e,{clientVersion:t,batchRequestIdx:A.batch_request_idx})}function KF(e,A){let t=e.message;return(A==="postgresql"||A==="postgres"||A==="mysql")&&e.error_code===jF&&(t+=`
|
|
80
|
+
`)}};function Pn(e){return new zl(Of(e))}function Of(e){let A=new Mn;for(let[t,r]of Object.entries(e)){let n=new xa(t,Hf(r));A.addField(n)}return A}function Hf(e){if(typeof e=="string")return new qe(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new qe(String(e));if(typeof e=="bigint")return new qe(`${e}n`);if(e===null)return new qe("null");if(e===void 0)return new qe("undefined");if(xn(e))return new qe(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return Buffer.isBuffer(e)?new qe(`Buffer.alloc(${e.byteLength})`):new qe(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let A=pa(e)?e.toISOString():"Invalid Date";return new qe(`new Date("${A}")`)}return e instanceof Jt?new qe(`Prisma.${e._getName()}`):vn(e)?new qe(`prisma.${Vf(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?FF(e):typeof e=="object"?Of(e):new qe(Object.prototype.toString.call(e))}function FF(e){let A=new Tn;for(let t of e)A.addItem(Hf(t));return A}function La(e,A){let t=A==="pretty"?Tf:ka,r=e.renderAllMessages(t),n=new Ln(0,{colors:t}).write(e).toString();return{message:r,args:n}}function Ua({args:e,errors:A,errorFormat:t,callsite:r,originalMethod:n,clientVersion:i,globalOmit:s}){let o=Pn(e);for(let l of A)Ra(l,o,s);let{message:a,args:c}=La(o,t),g=wa({message:a,callsite:r,originalMethod:n,showColors:t==="pretty",callArguments:c});throw new ze(g,{clientVersion:i})}var dt=class{constructor(){this._map=new Map}get(A){return this._map.get(A)?.value}set(A,t){this._map.set(A,{value:t})}getOrCreate(A,t){let r=this._map.get(A);if(r)return r.value;let n=t();return this.set(A,n),n}};function fs(e){let A;return{get(){return A||(A={value:e()}),A.value}}}function Qt(e){return e.replace(/^./,A=>A.toLowerCase())}function _f(e,A,t){let r=Qt(t);return!A.result||!(A.result.$allModels||A.result[r])?e:xF({...e,...Wf(A.name,e,A.result.$allModels),...Wf(A.name,e,A.result[r])})}function xF(e){let A=new dt,t=(r,n)=>A.getOrCreate(r,()=>n.has(r)?[r]:(n.add(r),e[r]?e[r].needs.flatMap(i=>t(i,n)):[r]));return Dn(e,r=>({...r,needs:t(r.name,new Set)}))}function Wf(e,A,t){return t?Dn(t,({needs:r,compute:n},i)=>({name:i,needs:r?Object.keys(r).filter(s=>r[s]):[],compute:LF(A,i,n)})):{}}function LF(e,A,t){let r=e?.[A]?.compute;return r?n=>t({...n,[A]:r(n)}):t}function jf(e,A){if(!A)return e;let t={...e};for(let r of Object.values(A))if(e[r.name])for(let n of r.needs)t[n]=!0;return t}function Kf(e,A){if(!A)return e;let t={...e};for(let r of Object.values(A))if(!e[r.name])for(let n of r.needs)delete t[n];return t}var Ta=class{constructor(A,t){this.extension=A;this.previous=t;this.computedFieldsCache=new dt;this.modelExtensionsCache=new dt;this.queryCallbacksCache=new dt;this.clientExtensions=fs(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());this.batchCallbacks=fs(()=>{let A=this.previous?.getAllBatchQueryCallbacks()??[],t=this.extension.query?.$__internalBatch;return t?A.concat(t):A})}getAllComputedFields(A){return this.computedFieldsCache.getOrCreate(A,()=>_f(this.previous?.getAllComputedFields(A),this.extension,A))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(A){return this.modelExtensionsCache.getOrCreate(A,()=>{let t=Qt(A);return!this.extension.model||!(this.extension.model[t]||this.extension.model.$allModels)?this.previous?.getAllModelExtensions(A):{...this.previous?.getAllModelExtensions(A),...this.extension.model.$allModels,...this.extension.model[t]}})}getAllQueryCallbacks(A,t){return this.queryCallbacksCache.getOrCreate(`${A}:${t}`,()=>{let r=this.previous?.getAllQueryCallbacks(A,t)??[],n=[],i=this.extension.query;return!i||!(i[A]||i.$allModels||i[t]||i.$allOperations)?r:(i[A]!==void 0&&(i[A][t]!==void 0&&n.push(i[A][t]),i[A].$allOperations!==void 0&&n.push(i[A].$allOperations)),A!=="$none"&&i.$allModels!==void 0&&(i.$allModels[t]!==void 0&&n.push(i.$allModels[t]),i.$allModels.$allOperations!==void 0&&n.push(i.$allModels.$allOperations)),i[t]!==void 0&&n.push(i[t]),i.$allOperations!==void 0&&n.push(i.$allOperations),r.concat(n))})}getAllBatchQueryCallbacks(){return this.batchCallbacks.get()}},Gn=class e{constructor(A){this.head=A}static empty(){return new e}static single(A){return new e(new Ta(A))}isEmpty(){return this.head===void 0}append(A){return new e(new Ta(A,this.head))}getAllComputedFields(A){return this.head?.getAllComputedFields(A)}getAllClientExtensions(){return this.head?.getAllClientExtensions()}getAllModelExtensions(A){return this.head?.getAllModelExtensions(A)}getAllQueryCallbacks(A,t){return this.head?.getAllQueryCallbacks(A,t)??[]}getAllBatchQueryCallbacks(){return this.head?.getAllBatchQueryCallbacks()??[]}};var Zf=Symbol(),Is=class{constructor(A){if(A!==Zf)throw new Error("Skip instance can not be constructed directly")}ifUndefined(A){return A===void 0?Ma:A}},Ma=new Is(Zf);function Ct(e){return e instanceof Is}var UF={findUnique:"findUnique",findUniqueOrThrow:"findUniqueOrThrow",findFirst:"findFirst",findFirstOrThrow:"findFirstOrThrow",findMany:"findMany",count:"aggregate",create:"createOne",createMany:"createMany",createManyAndReturn:"createManyAndReturn",update:"updateOne",updateMany:"updateMany",upsert:"upsertOne",delete:"deleteOne",deleteMany:"deleteMany",executeRaw:"executeRaw",queryRaw:"queryRaw",aggregate:"aggregate",groupBy:"groupBy",runCommandRaw:"runCommandRaw",findRaw:"findRaw",aggregateRaw:"aggregateRaw"},Xf="explicitly `undefined` values are not allowed";function va({modelName:e,action:A,args:t,runtimeDataModel:r,extensions:n=Gn.empty(),callsite:i,clientMethod:s,errorFormat:o,clientVersion:a,previewFeatures:c,globalOmit:g}){let l=new $l({runtimeDataModel:r,modelName:e,action:A,rootArgs:t,callsite:i,extensions:n,selectionPath:[],argumentPath:[],originalMethod:s,errorFormat:o,clientVersion:a,previewFeatures:c,globalOmit:g});return{modelName:e,action:UF[A],query:Bs(t,l)}}function Bs({select:e,include:A,...t}={},r){let n;return r.isPreviewFeatureOn("omitApi")&&(n=t.omit,delete t.omit),{arguments:$f(t,r),selection:TF(e,A,n,r)}}function TF(e,A,t,r){return e?(A?r.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"include",secondField:"select",selectionPath:r.getSelectionPath()}):t&&r.isPreviewFeatureOn("omitApi")&&r.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"omit",secondField:"select",selectionPath:r.getSelectionPath()}),GF(e,r)):MF(r,A,t)}function MF(e,A,t){let r={};return e.modelOrType&&!e.isRawAction()&&(r.$composites=!0,r.$scalars=!0),A&&vF(r,A,e),e.isPreviewFeatureOn("omitApi")&&PF(r,t,e),r}function vF(e,A,t){for(let[r,n]of Object.entries(A)){if(Ct(n))continue;let i=t.nestSelection(r);if(eu(n,i),n===!1||n===void 0){e[r]=!1;continue}let s=t.findField(r);if(s&&s.kind!=="object"&&t.throwValidationError({kind:"IncludeOnScalar",selectionPath:t.getSelectionPath().concat(r),outputType:t.getOutputTypeDescription()}),s){e[r]=Bs(n===!0?{}:n,i);continue}if(n===!0){e[r]=!0;continue}e[r]=Bs(n,i)}}function PF(e,A,t){let r=t.getComputedFields(),n={...t.getGlobalOmit(),...A},i=Kf(n,r);for(let[s,o]of Object.entries(i)){if(Ct(o))continue;eu(o,t.nestSelection(s));let a=t.findField(s);r?.[s]&&!a||(e[s]=!o)}}function GF(e,A){let t={},r=A.getComputedFields(),n=jf(e,r);for(let[i,s]of Object.entries(n)){if(Ct(s))continue;let o=A.nestSelection(i);eu(s,o);let a=A.findField(i);if(!(r?.[i]&&!a)){if(s===!1||s===void 0||Ct(s)){t[i]=!1;continue}if(s===!0){a?.kind==="object"?t[i]=Bs({},o):t[i]=!0;continue}t[i]=Bs(s,o)}}return t}function zf(e,A){if(e===null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="bigint")return{$type:"BigInt",value:String(e)};if(Fn(e)){if(pa(e))return{$type:"DateTime",value:e.toISOString()};A.throwValidationError({kind:"InvalidArgumentValue",selectionPath:A.getSelectionPath(),argumentPath:A.getArgumentPath(),argument:{name:A.getArgumentName(),typeNames:["Date"]},underlyingError:"Provided Date object is invalid"})}if(vn(e))return{$type:"FieldRef",value:{_ref:e.name,_container:e.modelName}};if(Array.isArray(e))return YF(e,A);if(ArrayBuffer.isView(e)){let{buffer:t,byteOffset:r,byteLength:n}=e;return{$type:"Bytes",value:Buffer.from(t,r,n).toString("base64")}}if(JF(e))return e.values;if(xn(e))return{$type:"Decimal",value:e.toFixed()};if(e instanceof Jt){if(e!==Fa.instances[e._getName()])throw new Error("Invalid ObjectEnumValue");return{$type:"Enum",value:e._getName()}}if(VF(e))return e.toJSON();if(typeof e=="object")return $f(e,A);A.throwValidationError({kind:"InvalidArgumentValue",selectionPath:A.getSelectionPath(),argumentPath:A.getArgumentPath(),argument:{name:A.getArgumentName(),typeNames:[]},underlyingError:`We could not serialize ${Object.prototype.toString.call(e)} value. Serialize the object to JSON or implement a ".toJSON()" method on it`})}function $f(e,A){if(e.$type)return{$type:"Raw",value:e};let t={};for(let r in e){let n=e[r],i=A.nestArgument(r);Ct(n)||(n!==void 0?t[r]=zf(n,i):A.isPreviewFeatureOn("strictUndefinedChecks")&&A.throwValidationError({kind:"InvalidArgumentValue",argumentPath:i.getArgumentPath(),selectionPath:A.getSelectionPath(),argument:{name:A.getArgumentName(),typeNames:[]},underlyingError:Xf}))}return t}function YF(e,A){let t=[];for(let r=0;r<e.length;r++){let n=A.nestArgument(String(r)),i=e[r];if(i===void 0||Ct(i)){let s=i===void 0?"undefined":"Prisma.skip";A.throwValidationError({kind:"InvalidArgumentValue",selectionPath:n.getSelectionPath(),argumentPath:n.getArgumentPath(),argument:{name:`${A.getArgumentName()}[${r}]`,typeNames:[]},underlyingError:`Can not use \`${s}\` value within array. Use \`null\` or filter out \`${s}\` values`})}t.push(zf(i,n))}return t}function JF(e){return typeof e=="object"&&e!==null&&e.__prismaRawParameters__===!0}function VF(e){return typeof e=="object"&&e!==null&&typeof e.toJSON=="function"}function eu(e,A){e===void 0&&A.isPreviewFeatureOn("strictUndefinedChecks")&&A.throwValidationError({kind:"InvalidSelectionValue",selectionPath:A.getSelectionPath(),underlyingError:Xf})}var $l=class e{constructor(A){this.params=A;this.params.modelName&&(this.modelOrType=this.params.runtimeDataModel.models[this.params.modelName]??this.params.runtimeDataModel.types[this.params.modelName])}throwValidationError(A){Ua({errors:[A],originalMethod:this.params.originalMethod,args:this.params.rootArgs??{},callsite:this.params.callsite,errorFormat:this.params.errorFormat,clientVersion:this.params.clientVersion,globalOmit:this.params.globalOmit})}getSelectionPath(){return this.params.selectionPath}getArgumentPath(){return this.params.argumentPath}getArgumentName(){return this.params.argumentPath[this.params.argumentPath.length-1]}getOutputTypeDescription(){if(!(!this.params.modelName||!this.modelOrType))return{name:this.params.modelName,fields:this.modelOrType.fields.map(A=>({name:A.name,typeName:"boolean",isRelation:A.kind==="object"}))}}isRawAction(){return["executeRaw","queryRaw","runCommandRaw","findRaw","aggregateRaw"].includes(this.params.action)}isPreviewFeatureOn(A){return this.params.previewFeatures.includes(A)}getComputedFields(){if(this.params.modelName)return this.params.extensions.getAllComputedFields(this.params.modelName)}findField(A){return this.modelOrType?.fields.find(t=>t.name===A)}nestSelection(A){let t=this.findField(A),r=t?.kind==="object"?t.type:void 0;return new e({...this.params,modelName:r,selectionPath:this.params.selectionPath.concat(A)})}getGlobalOmit(){return this.params.modelName&&this.shouldApplyGlobalOmit()?this.params.globalOmit?.[Nn(this.params.modelName)]??{}:{}}shouldApplyGlobalOmit(){switch(this.params.action){case"findFirst":case"findFirstOrThrow":case"findUniqueOrThrow":case"findMany":case"upsert":case"findUnique":case"createManyAndReturn":case"create":case"update":case"delete":return!0;case"executeRaw":case"aggregateRaw":case"runCommandRaw":case"findRaw":case"createMany":case"deleteMany":case"groupBy":case"updateMany":case"count":case"aggregate":case"queryRaw":return!1;default:Gt(this.params.action,"Unknown action")}}nestArgument(A){return new e({...this.params,argumentPath:this.params.argumentPath.concat(A)})}};var Yn=class{constructor(A){this._engine=A}prometheus(A){return this._engine.metrics({format:"prometheus",...A})}json(A){return this._engine.metrics({format:"json",...A})}};function eI(e){return{models:Au(e.models),enums:Au(e.enums),types:Au(e.types)}}function Au(e){let A={};for(let{name:t,...r}of e)A[t]=r;return A}function AI(e,A){let t=fs(()=>qF(A));Object.defineProperty(e,"dmmf",{get:()=>t.get()})}function qF(e){return{datamodel:{models:tu(e.models),enums:tu(e.enums),types:tu(e.types)}}}function tu(e){return Object.entries(e).map(([A,t])=>({name:A,...t}))}var ru=new WeakMap,Pa="$$PrismaTypedSql",nu=class{constructor(A,t){ru.set(this,{sql:A,values:t}),Object.defineProperty(this,Pa,{value:Pa})}get sql(){return ru.get(this).sql}get values(){return ru.get(this).values}};function tI(e){return(...A)=>new nu(e,A)}function rI(e){return e!=null&&e[Pa]===Pa}function ps(e){return{ok:!1,error:e,map(){return ps(e)},flatMap(){return ps(e)}}}var iu=class{constructor(){this.registeredErrors=[]}consumeError(A){return this.registeredErrors[A]}registerNewError(A){let t=0;for(;this.registeredErrors[t]!==void 0;)t++;return this.registeredErrors[t]={error:A},t}},su=e=>{let A=new iu,t=ft(A,e.transactionContext.bind(e)),r={adapterName:e.adapterName,errorRegistry:A,queryRaw:ft(A,e.queryRaw.bind(e)),executeRaw:ft(A,e.executeRaw.bind(e)),provider:e.provider,transactionContext:async(...n)=>(await t(...n)).map(s=>OF(A,s))};return e.getConnectionInfo&&(r.getConnectionInfo=WF(A,e.getConnectionInfo.bind(e))),r},OF=(e,A)=>{let t=ft(e,A.startTransaction.bind(A));return{adapterName:A.adapterName,provider:A.provider,queryRaw:ft(e,A.queryRaw.bind(A)),executeRaw:ft(e,A.executeRaw.bind(A)),startTransaction:async(...r)=>(await t(...r)).map(i=>HF(e,i))}},HF=(e,A)=>({adapterName:A.adapterName,provider:A.provider,options:A.options,queryRaw:ft(e,A.queryRaw.bind(A)),executeRaw:ft(e,A.executeRaw.bind(A)),commit:ft(e,A.commit.bind(A)),rollback:ft(e,A.rollback.bind(A))});function ft(e,A){return async(...t)=>{try{return await A(...t)}catch(r){let n=e.registerNewError(r);return ps({kind:"GenericJs",id:n})}}}function WF(e,A){return(...t)=>{try{return A(...t)}catch(r){let n=e.registerNewError(r);return ps({kind:"GenericJs",id:n})}}}var yD=Z(Rl());var wD=require("async_hooks"),RD=require("events"),DD=Z(require("fs")),Uo=Z(require("path"));var QA=class e{constructor(A,t){if(A.length-1!==t.length)throw A.length===0?new TypeError("Expected at least 1 string"):new TypeError(`Expected ${A.length} strings to have ${A.length-1} values`);let r=t.reduce((s,o)=>s+(o instanceof e?o.values.length:1),0);this.values=new Array(r),this.strings=new Array(r+1),this.strings[0]=A[0];let n=0,i=0;for(;n<t.length;){let s=t[n++],o=A[n];if(s instanceof e){this.strings[i]+=s.strings[0];let a=0;for(;a<s.values.length;)this.values[i++]=s.values[a++],this.strings[i]=s.strings[a];this.strings[i]+=o}else this.values[i++]=s,this.strings[i]=o}}get sql(){let A=this.strings.length,t=1,r=this.strings[0];for(;t<A;)r+=`?${this.strings[t++]}`;return r}get statement(){let A=this.strings.length,t=1,r=this.strings[0];for(;t<A;)r+=`:${t}${this.strings[t++]}`;return r}get text(){let A=this.strings.length,t=1,r=this.strings[0];for(;t<A;)r+=`$${t}${this.strings[t++]}`;return r}inspect(){return{sql:this.sql,statement:this.statement,text:this.text,values:this.values}}};function nI(e,A=",",t="",r=""){if(e.length===0)throw new TypeError("Expected `join([])` to be called with an array of multiple elements, but got an empty array");return new QA([t,...Array(e.length-1).fill(A),r],e)}function ou(e){return new QA([e],[])}var iI=ou("");function au(e,...A){return new QA(e,A)}function ms(e){return{getKeys(){return Object.keys(e)},getPropertyValue(A){return e[A]}}}function iA(e,A){return{getKeys(){return[e]},getPropertyValue(){return A()}}}function Jr(e){let A=new dt;return{getKeys(){return e.getKeys()},getPropertyValue(t){return A.getOrCreate(t,()=>e.getPropertyValue(t))},getPropertyDescriptor(t){return e.getPropertyDescriptor?.(t)}}}var Ga={enumerable:!0,configurable:!0,writable:!0};function Ya(e){let A=new Set(e);return{getPrototypeOf:()=>Object.prototype,getOwnPropertyDescriptor:()=>Ga,has:(t,r)=>A.has(r),set:(t,r,n)=>A.add(r)&&Reflect.set(t,r,n),ownKeys:()=>[...A]}}var sI=Symbol.for("nodejs.util.inspect.custom");function It(e,A){let t=_F(A),r=new Set,n=new Proxy(e,{get(i,s){if(r.has(s))return i[s];let o=t.get(s);return o?o.getPropertyValue(s):i[s]},has(i,s){if(r.has(s))return!0;let o=t.get(s);return o?o.has?.(s)??!0:Reflect.has(i,s)},ownKeys(i){let s=oI(Reflect.ownKeys(i),t),o=oI(Array.from(t.keys()),t);return[...new Set([...s,...o,...r])]},set(i,s,o){return t.get(s)?.getPropertyDescriptor?.(s)?.writable===!1?!1:(r.add(s),Reflect.set(i,s,o))},getOwnPropertyDescriptor(i,s){let o=Reflect.getOwnPropertyDescriptor(i,s);if(o&&!o.configurable)return o;let a=t.get(s);return a?a.getPropertyDescriptor?{...Ga,...a?.getPropertyDescriptor(s)}:Ga:o},defineProperty(i,s,o){return r.add(s),Reflect.defineProperty(i,s,o)},getPrototypeOf:()=>Object.prototype});return n[sI]=function(){let i={...this};return delete i[sI],i},n}function _F(e){let A=new Map;for(let t of e){let r=t.getKeys();for(let n of r)A.set(n,t)}return A}function oI(e,A){return e.filter(t=>A.get(t)?.has?.(t)??!0)}function Jn(e){return{getKeys(){return e},has(){return!1},getPropertyValue(){}}}function Vn(e,A){return{batch:e,transaction:A?.kind==="batch"?{isolationLevel:A.options.isolationLevel}:void 0}}function aI(e){if(e===void 0)return"";let A=Pn(e);return new Ln(0,{colors:ka}).write(A).toString()}var jF="P2037";function dr({error:e,user_facing_error:A},t,r){return A.error_code?new We(KF(A,r),{code:A.error_code,clientVersion:t,meta:A.meta,batchRequestIdx:A.batch_request_idx}):new ve(e,{clientVersion:t,batchRequestIdx:A.batch_request_idx})}function KF(e,A){let t=e.message;return(A==="postgresql"||A==="postgres"||A==="mysql")&&e.error_code===jF&&(t+=`
|
|
81
81
|
Prisma Accelerate has built-in connection pooling to prevent such errors: https://pris.ly/client/error-accelerate`),t}var ys="<unknown>";function cI(e){var A=e.split(`
|
|
82
82
|
`);return A.reduce(function(t,r){var n=zF(r)||ex(r)||rx(r)||ox(r)||ix(r);return n&&t.push(n),t},[])}var ZF=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,XF=/\((\S*)(?::(\d+))(?::(\d+))\)/;function zF(e){var A=ZF.exec(e);if(!A)return null;var t=A[2]&&A[2].indexOf("native")===0,r=A[2]&&A[2].indexOf("eval")===0,n=XF.exec(A[2]);return r&&n!=null&&(A[2]=n[1],A[3]=n[2],A[4]=n[3]),{file:t?null:A[2],methodName:A[1]||ys,arguments:t?[A[2]]:[],lineNumber:A[3]?+A[3]:null,column:A[4]?+A[4]:null}}var $F=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function ex(e){var A=$F.exec(e);return A?{file:A[2],methodName:A[1]||ys,arguments:[],lineNumber:+A[3],column:A[4]?+A[4]:null}:null}var Ax=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,tx=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function rx(e){var A=Ax.exec(e);if(!A)return null;var t=A[3]&&A[3].indexOf(" > eval")>-1,r=tx.exec(A[3]);return t&&r!=null&&(A[3]=r[1],A[4]=r[2],A[5]=null),{file:A[3],methodName:A[1]||ys,arguments:A[2]?A[2].split(","):[],lineNumber:A[4]?+A[4]:null,column:A[5]?+A[5]:null}}var nx=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;function ix(e){var A=nx.exec(e);return A?{file:A[3],methodName:A[1]||ys,arguments:[],lineNumber:+A[4],column:A[5]?+A[5]:null}:null}var sx=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;function ox(e){var A=sx.exec(e);return A?{file:A[2],methodName:A[1]||ys,arguments:[],lineNumber:+A[3],column:A[4]?+A[4]:null}:null}var cu=class{getLocation(){return null}},gu=class{constructor(){this._error=new Error}getLocation(){let A=this._error.stack;if(!A)return null;let r=cI(A).find(n=>{if(!n.file)return!1;let i=Ul(n.file);return i!=="<anonymous>"&&!i.includes("@prisma")&&!i.includes("/packages/client/src/runtime/")&&!i.endsWith("/runtime/binary.js")&&!i.endsWith("/runtime/library.js")&&!i.endsWith("/runtime/edge.js")&&!i.endsWith("/runtime/edge-esm.js")&&!i.startsWith("internal/")&&!n.methodName.includes("new ")&&!n.methodName.includes("getCallSite")&&!n.methodName.includes("Proxy.")&&n.methodName.split(".").length<4});return!r||!r.file?null:{fileName:r.file,lineNumber:r.lineNumber,columnNumber:r.column}}};function Qr(e){return e==="minimal"?typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new cu:new gu}var gI={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function qn(e={}){let A=cx(e);return Object.entries(A).reduce((r,[n,i])=>(gI[n]!==void 0?r.select[n]={select:i}:r[n]=i,r),{select:{}})}function cx(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function Ja(e={}){return A=>(typeof e._count=="boolean"&&(A._count=A._count._all),A)}function lI(e,A){let t=Ja(e);return A({action:"aggregate",unpacker:t,argsMapper:qn})(e)}function gx(e={}){let{select:A,...t}=e;return typeof A=="object"?qn({...t,_count:A}):qn({...t,_count:{_all:!0}})}function lx(e={}){return typeof e.select=="object"?A=>Ja(e)(A)._count:A=>Ja(e)(A)._count._all}function uI(e,A){return A({action:"count",unpacker:lx(e),argsMapper:gx})(e)}function ux(e={}){let A=qn(e);if(Array.isArray(A.by))for(let t of A.by)typeof t=="string"&&(A.select[t]=!0);else typeof A.by=="string"&&(A.select[A.by]=!0);return A}function Ex(e={}){return A=>(typeof e?._count=="boolean"&&A.forEach(t=>{t._count=t._count._all}),A)}function EI(e,A){return A({action:"groupBy",unpacker:Ex(e),argsMapper:ux})(e)}function hI(e,A,t){if(A==="aggregate")return r=>lI(r,t);if(A==="count")return r=>uI(r,t);if(A==="groupBy")return r=>EI(r,t)}function dI(e,A){let t=A.fields.filter(n=>!n.relationName),r=Jl(t,n=>n.name);return new Proxy({},{get(n,i){if(i in n||typeof i=="symbol")return n[i];let s=r[i];if(s)return new Es(e,i,s.type,s.isList,s.kind==="enum")},...Ya(Object.keys(r))})}var QI=e=>Array.isArray(e)?e:e.split("."),lu=(e,A)=>QI(A).reduce((t,r)=>t&&t[r],e),CI=(e,A,t)=>QI(A).reduceRight((r,n,i,s)=>Object.assign({},lu(e,s.slice(0,i)),{[n]:r}),t);function hx(e,A){return e===void 0||A===void 0?[]:[...A,"select",e]}function dx(e,A,t){return A===void 0?e??{}:CI(A,t,e||!0)}function uu(e,A,t,r,n,i){let o=e._runtimeDataModel.models[A].fields.reduce((a,c)=>({...a,[c.name]:c}),{});return a=>{let c=Qr(e._errorFormat),g=hx(r,n),l=dx(a,i,g),u=t({dataPath:g,callsite:c})(l),E=Qx(e,A);return new Proxy(u,{get(h,d){if(!E.includes(d))return h[d];let I=[o[d].type,t,d],p=[g,l];return uu(e,...I,...p)},...Ya([...E,...Object.getOwnPropertyNames(u)])})}}function Qx(e,A){return e._runtimeDataModel.models[A].fields.filter(t=>t.kind==="object").map(t=>t.name)}var Cx=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],fx=["aggregate","count","groupBy"];function Eu(e,A){let t=e._extensions.getAllModelExtensions(A)??{},r=[Ix(e,A),px(e,A),ms(t),iA("name",()=>A),iA("$name",()=>A),iA("$parent",()=>e._appliedParent)];return It({},r)}function Ix(e,A){let t=Qt(A),r=Object.keys(rs.ModelAction).concat("count");return{getKeys(){return r},getPropertyValue(n){let i=n,s=o=>a=>{let c=Qr(e._errorFormat);return e._createPrismaPromise(g=>{let l={args:a,dataPath:[],action:i,model:A,clientMethod:`${t}.${n}`,jsModelName:t,transaction:g,callsite:c};return e._request({...l,...o})})};return Cx.includes(i)?uu(e,A,s):Bx(n)?hI(e,n,s):s({})}}}function Bx(e){return fx.includes(e)}function px(e,A){return Jr(iA("fields",()=>{let t=e._runtimeDataModel.models[A];return dI(A,t)}))}function fI(e){return e.replace(/^./,A=>A.toUpperCase())}var hu=Symbol();function ws(e){let A=[mx(e),iA(hu,()=>e),iA("$parent",()=>e._appliedParent)],t=e._extensions.getAllClientExtensions();return t&&A.push(ms(t)),It(e,A)}function mx(e){let A=Object.keys(e._runtimeDataModel.models),t=A.map(Qt),r=[...new Set(A.concat(t))];return Jr({getKeys(){return r},getPropertyValue(n){let i=fI(n);if(e._runtimeDataModel.models[i]!==void 0)return Eu(e,i);if(e._runtimeDataModel.models[n]!==void 0)return Eu(e,n)},getPropertyDescriptor(n){if(!t.includes(n))return{enumerable:!1}}})}function II(e){return e[hu]?e[hu]:e}function BI(e){if(typeof e=="function")return e(this);if(e.client?.__AccelerateEngine){let t=e.client.__AccelerateEngine;this._originalClient._engine=new t(this._originalClient._accelerateEngineConfig)}let A=Object.create(this._originalClient,{_extensions:{value:this._extensions.append(e)},_appliedParent:{value:this,configurable:!0},$use:{value:void 0},$on:{value:void 0}});return ws(A)}function pI({result:e,modelName:A,select:t,omit:r,extensions:n}){let i=n.getAllComputedFields(A);if(!i)return e;let s=[],o=[];for(let a of Object.values(i)){if(r){if(r[a.name])continue;let c=a.needs.filter(g=>r[g]);c.length>0&&o.push(Jn(c))}else if(t){if(!t[a.name])continue;let c=a.needs.filter(g=>!t[g]);c.length>0&&o.push(Jn(c))}yx(e,a.needs)&&s.push(wx(a,It(e,s)))}return s.length>0||o.length>0?It(e,[...s,...o]):e}function yx(e,A){return A.every(t=>Yl(e,t))}function wx(e,A){return Jr(iA(e.name,()=>e.compute(A)))}function Va({visitor:e,result:A,args:t,runtimeDataModel:r,modelName:n}){if(Array.isArray(A)){for(let s=0;s<A.length;s++)A[s]=Va({result:A[s],args:t,modelName:n,runtimeDataModel:r,visitor:e});return A}let i=e(A,n,t)??A;return t.include&&mI({includeOrSelect:t.include,result:i,parentModelName:n,runtimeDataModel:r,visitor:e}),t.select&&mI({includeOrSelect:t.select,result:i,parentModelName:n,runtimeDataModel:r,visitor:e}),i}function mI({includeOrSelect:e,result:A,parentModelName:t,runtimeDataModel:r,visitor:n}){for(let[i,s]of Object.entries(e)){if(!s||A[i]==null||Ct(s))continue;let a=r.models[t].fields.find(g=>g.name===i);if(!a||a.kind!=="object"||!a.relationName)continue;let c=typeof s=="object"?s:{};A[i]=Va({visitor:n,result:A[i],args:c,modelName:a.type,runtimeDataModel:r})}}function yI({result:e,modelName:A,args:t,extensions:r,runtimeDataModel:n,globalOmit:i}){return r.isEmpty()||e==null||typeof e!="object"||!n.models[A]?e:Va({result:e,args:t??{},modelName:A,runtimeDataModel:n,visitor:(o,a,c)=>{let g=Qt(a);return pI({result:o,modelName:g,select:c.select,omit:c.select?void 0:{...i?.[g],...c.omit},extensions:r})}})}function wI(e){if(e instanceof QA)return Rx(e);if(Array.isArray(e)){let t=[e[0]];for(let r=1;r<e.length;r++)t[r]=Rs(e[r]);return t}let A={};for(let t in e)A[t]=Rs(e[t]);return A}function Rx(e){return new QA(e.strings,e.values)}function Rs(e){if(typeof e!="object"||e==null||e instanceof Jt||vn(e))return e;if(xn(e))return new Et(e.toFixed());if(Fn(e))return new Date(+e);if(ArrayBuffer.isView(e))return e.slice(0);if(Array.isArray(e)){let A=e.length,t;for(t=Array(A);A--;)t[A]=Rs(e[A]);return t}if(typeof e=="object"){let A={};for(let t in e)t==="__proto__"?Object.defineProperty(A,t,{value:Rs(e[t]),configurable:!0,enumerable:!0,writable:!0}):A[t]=Rs(e[t]);return A}Gt(e,"Unknown value")}function DI(e,A,t,r=0){return e._createPrismaPromise(n=>{let i=A.customDataProxyFetch;return"transaction"in A&&n!==void 0&&(A.transaction?.kind==="batch"&&A.transaction.lock.then(),A.transaction=n),r===t.length?e._executeRequest(A):t[r]({model:A.model,operation:A.model?A.action:A.clientMethod,args:wI(A.args??{}),__internalParams:A,query:(s,o=A)=>{let a=o.customDataProxyFetch;return o.customDataProxyFetch=NI(i,a),o.args=s,DI(e,o,t,r+1)}})})}function bI(e,A){let{jsModelName:t,action:r,clientMethod:n}=A,i=t?r:n;if(e._extensions.isEmpty())return e._executeRequest(A);let s=e._extensions.getAllQueryCallbacks(t??"$none",i);return DI(e,A,s)}function kI(e){return A=>{let t={requests:A},r=A[0].extensions.getAllBatchQueryCallbacks();return r.length?SI(t,r,0,e):e(t)}}function SI(e,A,t,r){if(t===A.length)return r(e);let n=e.customDataProxyFetch,i=e.requests[0].transaction;return A[t]({args:{queries:e.requests.map(s=>({model:s.modelName,operation:s.action,args:s.args})),transaction:i?{isolationLevel:i.kind==="batch"?i.isolationLevel:void 0}:void 0},__internalParams:e,query(s,o=e){let a=o.customDataProxyFetch;return o.customDataProxyFetch=NI(n,a),SI(o,A,t+1,r)}})}var RI=e=>e;function NI(e=RI,A=RI){return t=>e(A(t))}var FI=ie("prisma:client"),xI={Vercel:"vercel","Netlify CI":"netlify"};function LI({postinstall:e,ciName:A,clientVersion:t}){if(FI("checkPlatformCaching:postinstall",e),FI("checkPlatformCaching:ciName",A),e===!0&&A&&A in xI){let r=`Prisma has detected that this project was built on ${A}, which caches dependencies. This leads to an outdated Prisma Client because Prisma's auto-generation isn't triggered. To fix this, make sure to run the \`prisma generate\` command during the build process.
|
|
83
83
|
|
|
@@ -179,7 +179,7 @@ Example:
|
|
|
179
179
|
await prisma.$executeRawUnsafe(\`ALTER USER prisma WITH PASSWORD '\${password}'\`)
|
|
180
180
|
|
|
181
181
|
More Information: https://pris.ly/d/execute-raw
|
|
182
|
-
`)}var md=({clientMethod:e,activeProvider:A})=>t=>{let r="",n;if(rI(t))r=t.sql,n={values:Yi(t.values),__prismaRawParameters__:!0};else if(Array.isArray(t)){let[i,...s]=t;r=i,n={values:Yi(s||[]),__prismaRawParameters__:!0}}else switch(A){case"sqlite":case"mysql":{r=t.sql,n={values:Yi(t.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{r=t.text,n={values:Yi(t.values),__prismaRawParameters__:!0};break}case"sqlserver":{r=ZR(t),n={values:Yi(t.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${A} provider does not support ${e}`)}return n?.values?tD(`prisma.${e}(${r}, ${n.values})`):tD(`prisma.${e}(${r})`),{query:r,parameters:n}},rD={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[A,...t]=e;return new QA(A,t)}},nD={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};function yd(e){return function(t){let r,n=(i=e)=>{try{return i===void 0||i?.kind==="itx"?r??=iD(t(i)):iD(t(i))}catch(s){return Promise.reject(s)}};return{then(i,s){return n().then(i,s)},catch(i){return n().catch(i)},finally(i){return n().finally(i)},requestTransaction(i){let s=n(i);return s.requestTransaction?s.requestTransaction(i):s},[Symbol.toStringTag]:"PrismaPromise"}}}function iD(e){return typeof e.then=="function"?e:Promise.resolve(e)}var WJ={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(){},getActiveContext(){},runInChildSpan(e,A){return A()}},wd=class{isEnabled(){return this.getGlobalTracingHelper().isEnabled()}getTraceParent(A){return this.getGlobalTracingHelper().getTraceParent(A)}dispatchEngineSpans(A){return this.getGlobalTracingHelper().dispatchEngineSpans(A)}getActiveContext(){return this.getGlobalTracingHelper().getActiveContext()}runInChildSpan(A,t){return this.getGlobalTracingHelper().runInChildSpan(A,t)}getGlobalTracingHelper(){return globalThis.PRISMA_INSTRUMENTATION?.helper??WJ}};function sD(){return new wd}function oD(e,A=()=>{}){let t,r=new Promise(n=>t=n);return{then(n){return--e===0&&t(A()),n?.(r)}}}function aD(e){return typeof e=="string"?e:e.reduce((A,t)=>{let r=typeof t=="string"?t:t.level;return r==="query"?A:A&&(t==="info"||A==="info")?"info":r},void 0)}var Yg=class{constructor(){this._middlewares=[]}use(A){this._middlewares.push(A)}get(A){return this._middlewares[A]}has(A){return!!this._middlewares[A]}length(){return this._middlewares.length}};var gD=Z(Gl());function Jg(e){return typeof e.batchRequestIdx=="number"}function cD(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let A=[];return e.modelName&&A.push(e.modelName),e.query.arguments&&A.push(Rd(e.query.arguments)),A.push(Rd(e.query.selection)),A.join("")}function Rd(e){return`(${Object.keys(e).sort().map(t=>{let r=e[t];return typeof r=="object"&&r!==null?`(${t} ${Rd(r)})`:t}).join(" ")})`}var _J={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 Dd(e){return _J[e]}var Vg=class{constructor(A){this.options=A;this.tickActive=!1;this.batches={}}request(A){let t=this.options.batchBy(A);return t?(this.batches[t]||(this.batches[t]=[],this.tickActive||(this.tickActive=!0,process.nextTick(()=>{this.dispatchBatches(),this.tickActive=!1}))),new Promise((r,n)=>{this.batches[t].push({request:A,resolve:r,reject:n})})):this.options.singleLoader(A)}dispatchBatches(){for(let A in this.batches){let t=this.batches[A];delete this.batches[A],t.length===1?this.options.singleLoader(t[0].request).then(r=>{r instanceof Error?t[0].reject(r):t[0].resolve(r)}).catch(r=>{t[0].reject(r)}):(t.sort((r,n)=>this.options.batchOrder(r.request,n.request)),this.options.batchLoader(t.map(r=>r.request)).then(r=>{if(r instanceof Error)for(let n=0;n<t.length;n++)t[n].reject(r);else for(let n=0;n<t.length;n++){let i=r[n];i instanceof Error?t[n].reject(i):t[n].resolve(i)}}).catch(r=>{for(let n=0;n<t.length;n++)t[n].reject(r)}))}}get[Symbol.toStringTag](){return"DataLoader"}};function Qn(e,A){if(A===null)return A;switch(e){case"bigint":return BigInt(A);case"bytes":{let{buffer:t,byteOffset:r,byteLength:n}=Buffer.from(A,"base64");return new Uint8Array(t,r,n)}case"decimal":return new Et(A);case"datetime":case"date":return new Date(A);case"time":return new Date(`1970-01-01T${A}Z`);case"bigint-array":return A.map(t=>Qn("bigint",t));case"bytes-array":return A.map(t=>Qn("bytes",t));case"decimal-array":return A.map(t=>Qn("decimal",t));case"datetime-array":return A.map(t=>Qn("datetime",t));case"date-array":return A.map(t=>Qn("date",t));case"time-array":return A.map(t=>Qn("time",t));default:return A}}function qg(e){let A=[],t=jJ(e);for(let r=0;r<e.rows.length;r++){let n=e.rows[r],i={...t};for(let s=0;s<n.length;s++)i[e.columns[s]]=Qn(e.types[s],n[s]);A.push(i)}return A}function jJ(e){let A={};for(let t=0;t<e.columns.length;t++)A[e.columns[t]]=null;return A}var KJ=ie("prisma:client:request_handler"),Og=class{constructor(A,t){this.logEmitter=t,this.client=A,this.dataloader=new Vg({batchLoader:kI(async({requests:r,customDataProxyFetch:n})=>{let{transaction:i,otelParentCtx:s}=r[0],o=r.map(l=>l.protocolQuery),a=this.client._tracingHelper.getTraceParent(s),c=r.some(l=>Dd(l.protocolQuery.action));return(await this.client._engine.requestBatch(o,{traceparent:a,transaction:ZJ(i),containsWrite:c,customDataProxyFetch:n})).map((l,u)=>{if(l instanceof Error)return l;try{return this.mapQueryEngineResult(r[u],l)}catch(E){return E}})}),singleLoader:async r=>{let n=r.transaction?.kind==="itx"?lD(r.transaction):void 0,i=await this.client._engine.request(r.protocolQuery,{traceparent:this.client._tracingHelper.getTraceParent(),interactiveTransaction:n,isWrite:Dd(r.protocolQuery.action),customDataProxyFetch:r.customDataProxyFetch});return this.mapQueryEngineResult(r,i)},batchBy:r=>r.transaction?.id?`transaction-${r.transaction.id}`:cD(r.protocolQuery),batchOrder(r,n){return r.transaction?.kind==="batch"&&n.transaction?.kind==="batch"?r.transaction.index-n.transaction.index:0}})}async request(A){try{return await this.dataloader.request(A)}catch(t){let{clientMethod:r,callsite:n,transaction:i,args:s,modelName:o}=A;this.handleAndLogRequestError({error:t,clientMethod:r,callsite:n,transaction:i,args:s,modelName:o,globalOmit:A.globalOmit})}}mapQueryEngineResult({dataPath:A,unpacker:t},r){let n=r?.data,i=this.unpack(n,A,t);return process.env.PRISMA_CLIENT_GET_TIME?{data:i}:i}handleAndLogRequestError(A){try{this.handleRequestError(A)}catch(t){throw this.logEmitter&&this.logEmitter.emit("error",{message:t.message,target:A.clientMethod,timestamp:new Date}),t}}handleRequestError({error:A,clientMethod:t,callsite:r,transaction:n,args:i,modelName:s,globalOmit:o}){if(KJ(A),XJ(A,n))throw A;if(A instanceof We&&zJ(A)){let c=uD(A.meta);Ua({args:i,errors:[c],callsite:r,errorFormat:this.client._errorFormat,originalMethod:t,clientVersion:this.client._clientVersion,globalOmit:o})}let a=A.message;if(r&&(a=wa({callsite:r,originalMethod:t,isPanic:A.isPanic,showColors:this.client._errorFormat==="pretty",message:a})),a=this.sanitizeMessage(a),A.code){let c=s?{modelName:s,...A.meta}:A.meta;throw new We(a,{code:A.code,clientVersion:this.client._clientVersion,meta:c,batchRequestIdx:A.batchRequestIdx})}else{if(A.isPanic)throw new JA(a,this.client._clientVersion);if(A instanceof ve)throw new ve(a,{clientVersion:this.client._clientVersion,batchRequestIdx:A.batchRequestIdx});if(A instanceof z)throw new z(a,this.client._clientVersion);if(A instanceof JA)throw new JA(a,this.client._clientVersion)}throw A.clientVersion=this.client._clientVersion,A}sanitizeMessage(A){return this.client._errorFormat&&this.client._errorFormat!=="pretty"?(0,gD.default)(A):A}unpack(A,t,r){if(!A||(A.data&&(A=A.data),!A))return A;let n=Object.keys(A)[0],i=Object.values(A)[0],s=t.filter(c=>c!=="select"&&c!=="include"),o=lu(i,s),a=n==="queryRaw"?qg(o):Sn(o);return r?r(a):a}get[Symbol.toStringTag](){return"RequestHandler"}};function ZJ(e){if(e){if(e.kind==="batch")return{kind:"batch",options:{isolationLevel:e.isolationLevel}};if(e.kind==="itx")return{kind:"itx",options:lD(e)};Gt(e,"Unknown transaction kind")}}function lD(e){return{id:e.id,payload:e.payload}}function XJ(e,A){return Jg(e)&&A?.kind==="batch"&&e.batchRequestIdx!==A.index}function zJ(e){return e.code==="P2009"||e.code==="P2012"}function uD(e){if(e.kind==="Union")return{kind:"Union",errors:e.errors.map(uD)};if(Array.isArray(e.selectionPath)){let[,...A]=e.selectionPath;return{...e,selectionPath:A}}return e}var ED="6.2.0-dev.
|
|
182
|
+
`)}var md=({clientMethod:e,activeProvider:A})=>t=>{let r="",n;if(rI(t))r=t.sql,n={values:Yi(t.values),__prismaRawParameters__:!0};else if(Array.isArray(t)){let[i,...s]=t;r=i,n={values:Yi(s||[]),__prismaRawParameters__:!0}}else switch(A){case"sqlite":case"mysql":{r=t.sql,n={values:Yi(t.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{r=t.text,n={values:Yi(t.values),__prismaRawParameters__:!0};break}case"sqlserver":{r=ZR(t),n={values:Yi(t.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${A} provider does not support ${e}`)}return n?.values?tD(`prisma.${e}(${r}, ${n.values})`):tD(`prisma.${e}(${r})`),{query:r,parameters:n}},rD={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[A,...t]=e;return new QA(A,t)}},nD={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};function yd(e){return function(t){let r,n=(i=e)=>{try{return i===void 0||i?.kind==="itx"?r??=iD(t(i)):iD(t(i))}catch(s){return Promise.reject(s)}};return{then(i,s){return n().then(i,s)},catch(i){return n().catch(i)},finally(i){return n().finally(i)},requestTransaction(i){let s=n(i);return s.requestTransaction?s.requestTransaction(i):s},[Symbol.toStringTag]:"PrismaPromise"}}}function iD(e){return typeof e.then=="function"?e:Promise.resolve(e)}var WJ={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(){},getActiveContext(){},runInChildSpan(e,A){return A()}},wd=class{isEnabled(){return this.getGlobalTracingHelper().isEnabled()}getTraceParent(A){return this.getGlobalTracingHelper().getTraceParent(A)}dispatchEngineSpans(A){return this.getGlobalTracingHelper().dispatchEngineSpans(A)}getActiveContext(){return this.getGlobalTracingHelper().getActiveContext()}runInChildSpan(A,t){return this.getGlobalTracingHelper().runInChildSpan(A,t)}getGlobalTracingHelper(){return globalThis.PRISMA_INSTRUMENTATION?.helper??WJ}};function sD(){return new wd}function oD(e,A=()=>{}){let t,r=new Promise(n=>t=n);return{then(n){return--e===0&&t(A()),n?.(r)}}}function aD(e){return typeof e=="string"?e:e.reduce((A,t)=>{let r=typeof t=="string"?t:t.level;return r==="query"?A:A&&(t==="info"||A==="info")?"info":r},void 0)}var Yg=class{constructor(){this._middlewares=[]}use(A){this._middlewares.push(A)}get(A){return this._middlewares[A]}has(A){return!!this._middlewares[A]}length(){return this._middlewares.length}};var gD=Z(Gl());function Jg(e){return typeof e.batchRequestIdx=="number"}function cD(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let A=[];return e.modelName&&A.push(e.modelName),e.query.arguments&&A.push(Rd(e.query.arguments)),A.push(Rd(e.query.selection)),A.join("")}function Rd(e){return`(${Object.keys(e).sort().map(t=>{let r=e[t];return typeof r=="object"&&r!==null?`(${t} ${Rd(r)})`:t}).join(" ")})`}var _J={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 Dd(e){return _J[e]}var Vg=class{constructor(A){this.options=A;this.tickActive=!1;this.batches={}}request(A){let t=this.options.batchBy(A);return t?(this.batches[t]||(this.batches[t]=[],this.tickActive||(this.tickActive=!0,process.nextTick(()=>{this.dispatchBatches(),this.tickActive=!1}))),new Promise((r,n)=>{this.batches[t].push({request:A,resolve:r,reject:n})})):this.options.singleLoader(A)}dispatchBatches(){for(let A in this.batches){let t=this.batches[A];delete this.batches[A],t.length===1?this.options.singleLoader(t[0].request).then(r=>{r instanceof Error?t[0].reject(r):t[0].resolve(r)}).catch(r=>{t[0].reject(r)}):(t.sort((r,n)=>this.options.batchOrder(r.request,n.request)),this.options.batchLoader(t.map(r=>r.request)).then(r=>{if(r instanceof Error)for(let n=0;n<t.length;n++)t[n].reject(r);else for(let n=0;n<t.length;n++){let i=r[n];i instanceof Error?t[n].reject(i):t[n].resolve(i)}}).catch(r=>{for(let n=0;n<t.length;n++)t[n].reject(r)}))}}get[Symbol.toStringTag](){return"DataLoader"}};function Qn(e,A){if(A===null)return A;switch(e){case"bigint":return BigInt(A);case"bytes":{let{buffer:t,byteOffset:r,byteLength:n}=Buffer.from(A,"base64");return new Uint8Array(t,r,n)}case"decimal":return new Et(A);case"datetime":case"date":return new Date(A);case"time":return new Date(`1970-01-01T${A}Z`);case"bigint-array":return A.map(t=>Qn("bigint",t));case"bytes-array":return A.map(t=>Qn("bytes",t));case"decimal-array":return A.map(t=>Qn("decimal",t));case"datetime-array":return A.map(t=>Qn("datetime",t));case"date-array":return A.map(t=>Qn("date",t));case"time-array":return A.map(t=>Qn("time",t));default:return A}}function qg(e){let A=[],t=jJ(e);for(let r=0;r<e.rows.length;r++){let n=e.rows[r],i={...t};for(let s=0;s<n.length;s++)i[e.columns[s]]=Qn(e.types[s],n[s]);A.push(i)}return A}function jJ(e){let A={};for(let t=0;t<e.columns.length;t++)A[e.columns[t]]=null;return A}var KJ=ie("prisma:client:request_handler"),Og=class{constructor(A,t){this.logEmitter=t,this.client=A,this.dataloader=new Vg({batchLoader:kI(async({requests:r,customDataProxyFetch:n})=>{let{transaction:i,otelParentCtx:s}=r[0],o=r.map(l=>l.protocolQuery),a=this.client._tracingHelper.getTraceParent(s),c=r.some(l=>Dd(l.protocolQuery.action));return(await this.client._engine.requestBatch(o,{traceparent:a,transaction:ZJ(i),containsWrite:c,customDataProxyFetch:n})).map((l,u)=>{if(l instanceof Error)return l;try{return this.mapQueryEngineResult(r[u],l)}catch(E){return E}})}),singleLoader:async r=>{let n=r.transaction?.kind==="itx"?lD(r.transaction):void 0,i=await this.client._engine.request(r.protocolQuery,{traceparent:this.client._tracingHelper.getTraceParent(),interactiveTransaction:n,isWrite:Dd(r.protocolQuery.action),customDataProxyFetch:r.customDataProxyFetch});return this.mapQueryEngineResult(r,i)},batchBy:r=>r.transaction?.id?`transaction-${r.transaction.id}`:cD(r.protocolQuery),batchOrder(r,n){return r.transaction?.kind==="batch"&&n.transaction?.kind==="batch"?r.transaction.index-n.transaction.index:0}})}async request(A){try{return await this.dataloader.request(A)}catch(t){let{clientMethod:r,callsite:n,transaction:i,args:s,modelName:o}=A;this.handleAndLogRequestError({error:t,clientMethod:r,callsite:n,transaction:i,args:s,modelName:o,globalOmit:A.globalOmit})}}mapQueryEngineResult({dataPath:A,unpacker:t},r){let n=r?.data,i=this.unpack(n,A,t);return process.env.PRISMA_CLIENT_GET_TIME?{data:i}:i}handleAndLogRequestError(A){try{this.handleRequestError(A)}catch(t){throw this.logEmitter&&this.logEmitter.emit("error",{message:t.message,target:A.clientMethod,timestamp:new Date}),t}}handleRequestError({error:A,clientMethod:t,callsite:r,transaction:n,args:i,modelName:s,globalOmit:o}){if(KJ(A),XJ(A,n))throw A;if(A instanceof We&&zJ(A)){let c=uD(A.meta);Ua({args:i,errors:[c],callsite:r,errorFormat:this.client._errorFormat,originalMethod:t,clientVersion:this.client._clientVersion,globalOmit:o})}let a=A.message;if(r&&(a=wa({callsite:r,originalMethod:t,isPanic:A.isPanic,showColors:this.client._errorFormat==="pretty",message:a})),a=this.sanitizeMessage(a),A.code){let c=s?{modelName:s,...A.meta}:A.meta;throw new We(a,{code:A.code,clientVersion:this.client._clientVersion,meta:c,batchRequestIdx:A.batchRequestIdx})}else{if(A.isPanic)throw new JA(a,this.client._clientVersion);if(A instanceof ve)throw new ve(a,{clientVersion:this.client._clientVersion,batchRequestIdx:A.batchRequestIdx});if(A instanceof z)throw new z(a,this.client._clientVersion);if(A instanceof JA)throw new JA(a,this.client._clientVersion)}throw A.clientVersion=this.client._clientVersion,A}sanitizeMessage(A){return this.client._errorFormat&&this.client._errorFormat!=="pretty"?(0,gD.default)(A):A}unpack(A,t,r){if(!A||(A.data&&(A=A.data),!A))return A;let n=Object.keys(A)[0],i=Object.values(A)[0],s=t.filter(c=>c!=="select"&&c!=="include"),o=lu(i,s),a=n==="queryRaw"?qg(o):Sn(o);return r?r(a):a}get[Symbol.toStringTag](){return"RequestHandler"}};function ZJ(e){if(e){if(e.kind==="batch")return{kind:"batch",options:{isolationLevel:e.isolationLevel}};if(e.kind==="itx")return{kind:"itx",options:lD(e)};Gt(e,"Unknown transaction kind")}}function lD(e){return{id:e.id,payload:e.payload}}function XJ(e,A){return Jg(e)&&A?.kind==="batch"&&e.batchRequestIdx!==A.index}function zJ(e){return e.code==="P2009"||e.code==="P2012"}function uD(e){if(e.kind==="Union")return{kind:"Union",errors:e.errors.map(uD)};if(Array.isArray(e.selectionPath)){let[,...A]=e.selectionPath;return{...e,selectionPath:A}}return e}var ED="6.2.0-dev.8";var hD=ED;var ID=Z(Kl());var oe=class extends Error{constructor(A){super(A+`
|
|
183
183
|
Read more at https://pris.ly/d/client-constructor`),this.name="PrismaClientConstructorValidationError"}get[Symbol.toStringTag](){return"PrismaClientConstructorValidationError"}};U(oe,"PrismaClientConstructorValidationError");var dD=["datasources","datasourceUrl","errorFormat","adapter","log","transactionOptions","omit","__internal"],QD=["pretty","colorless","minimal"],CD=["info","query","warn","error"],eV={datasources:(e,{datasourceNames:A})=>{if(e){if(typeof e!="object"||Array.isArray(e))throw new oe(`Invalid value ${JSON.stringify(e)} for "datasources" provided to PrismaClient constructor`);for(let[t,r]of Object.entries(e)){if(!A.includes(t)){let n=Ji(t,A)||` Available datasources: ${A.join(", ")}`;throw new oe(`Unknown datasource ${t} provided to PrismaClient constructor.${n}`)}if(typeof r!="object"||Array.isArray(r))throw new oe(`Invalid value ${JSON.stringify(e)} for datasource "${t}" provided to PrismaClient constructor.
|
|
184
184
|
It should have this form: { url: "CONNECTION_STRING" }`);if(r&&typeof r=="object")for(let[n,i]of Object.entries(r)){if(n!=="url")throw new oe(`Invalid value ${JSON.stringify(e)} for datasource "${t}" provided to PrismaClient constructor.
|
|
185
185
|
It should have this form: { url: "CONNECTION_STRING" }`);if(typeof i!="string")throw new oe(`Invalid value ${JSON.stringify(i)} for datasource "${t}" provided to PrismaClient constructor.
|
|
@@ -2,7 +2,7 @@ var ea=Object.create;var Kr=Object.defineProperty;var ta=Object.getOwnPropertyDe
|
|
|
2
2
|
`)}function Yl(e){let t=[e.fileName];return e.lineNumber&&t.push(String(e.lineNumber)),e.columnNumber&&t.push(String(e.columnNumber)),t.join(":")}function xr(e){let t=e.showColors?Wl:Hl,r;return typeof $getTemplateParameters<"u"?r=$getTemplateParameters(e,t):r=Kl(e),zl(r,t)}d();u();c();p();m();var Eo=Le(yn());d();u();c();p();m();function ho(e,t,r){let n=yo(e),i=Zl(n),o=eu(i);o?Pr(o,t,r):t.addErrorMessage(()=>"Unknown error")}function yo(e){return e.errors.flatMap(t=>t.kind==="Union"?yo(t):[t])}function Zl(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:Xl(o.argument.typeNames,n.argument.typeNames)}}):t.set(i,n)}return r.push(...t.values()),r}function Xl(e,t){return[...new Set(e.concat(t))]}function eu(e){return cn(e,(t,r)=>{let n=fo(t),i=fo(r);return n!==i?n-i:go(t)-go(r)})}function fo(e){let t=0;return Array.isArray(e.selectionPath)&&(t+=e.selectionPath.length),Array.isArray(e.argumentPath)&&(t+=e.argumentPath.length),t}function go(e){switch(e.kind){case"InvalidArgumentValue":case"ValueTooLarge":return 20;case"InvalidArgumentType":return 10;case"RequiredArgumentMissing":return-10;default:return 0}}d();u();c();p();m();var ae=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)}};d();u();c();p();m();d();u();c();p();m();var nt=class{constructor(t=0,r){this.context=r;this.lines=[];this.currentLine="";this.currentIndent=0;this.currentIndent=t}write(t){return typeof t=="string"?this.currentLine+=t:t.write(this),this}writeJoined(t,r,n=(i,o)=>o.write(i)){let i=r.length-1;for(let o=0;o<r.length;o++)n(r[o],this),o!==i&&this.write(t);return this}writeLine(t){return this.write(t).newLine()}newLine(){this.lines.push(this.indentedCurrentLine()),this.currentLine="",this.marginSymbol=void 0;let t=this.afterNextNewLineCallback;return this.afterNextNewLineCallback=void 0,t?.(),this}withIndent(t){return this.indent(),t(this),this.unindent(),this}afterNextNewline(t){return this.afterNextNewLineCallback=t,this}indent(){return this.currentIndent++,this}unindent(){return this.currentIndent>0&&this.currentIndent--,this}addMarginSymbol(t){return this.marginSymbol=t,this}toString(){return this.lines.concat(this.indentedCurrentLine()).join(`
|
|
3
3
|
`)}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}};d();u();c();p();m();d();u();c();p();m();var vr=class{constructor(t){this.value=t}write(t){t.write(this.value)}markAsError(){this.value.markAsError()}};d();u();c();p();m();var Tr=e=>e,Cr={bold:Tr,red:Tr,green:Tr,dim:Tr,enabled:!1},wo={bold:ar,red:ze,green:Oi,dim:lr,enabled:!0},it={write(e){e.writeLine(",")}};d();u();c();p();m();var fe=class{constructor(t){this.contents=t;this.isUnderlined=!1;this.color=t=>t}underline(){return this.isUnderlined=!0,this}setColor(t){return this.color=t,this}write(t){let r=t.getCurrentLineLength();t.write(this.color(this.contents)),this.isUnderlined&&t.afterNextNewline(()=>{t.write(" ".repeat(r)).writeLine(this.color("~".repeat(this.contents.length)))})}};d();u();c();p();m();var Me=class{constructor(){this.hasError=!1}markAsError(){return this.hasError=!0,this}};var ot=class extends Me{constructor(){super(...arguments);this.items=[]}addItem(r){return this.items.push(new vr(r)),this}getField(r){return this.items[r]}getPrintWidth(){return this.items.length===0?2:Math.max(...this.items.map(n=>n.value.getPrintWidth()))+2}write(r){if(this.items.length===0){this.writeEmpty(r);return}this.writeWithItems(r)}writeEmpty(r){let n=new fe("[]");this.hasError&&n.setColor(r.context.colors.red).underline(),r.write(n)}writeWithItems(r){let{colors:n}=r.context;r.writeLine("[").withIndent(()=>r.writeJoined(it,this.items).newLine()).write("]"),this.hasError&&r.afterNextNewline(()=>{r.writeLine(n.red("~".repeat(this.getPrintWidth())))})}asObject(){}};var st=class e extends Me{constructor(){super(...arguments);this.fields={};this.suggestions=[]}addField(r){this.fields[r.name]=r}addSuggestion(r){this.suggestions.push(r)}getField(r){return this.fields[r]}getDeepField(r){let[n,...i]=r,o=this.getField(n);if(!o)return;let s=o;for(let a of i){let l;if(s.value instanceof e?l=s.value.getField(a):s.value instanceof ot&&(l=s.value.getField(Number(a))),!l)return;s=l}return s}getDeepFieldValue(r){return r.length===0?this:this.getDeepField(r)?.value}hasField(r){return!!this.getField(r)}removeAllFields(){this.fields={}}removeField(r){delete this.fields[r]}getFields(){return this.fields}isEmpty(){return Object.keys(this.fields).length===0}getFieldValue(r){return this.getField(r)?.value}getDeepSubSelectionValue(r){let n=this;for(let i of r){if(!(n instanceof e))return;let o=n.getSubSelectionValue(i);if(!o)return;n=o}return n}getDeepSelectionParent(r){let n=this.getSelectionParent();if(!n)return;let i=n;for(let o of r){let s=i.value.getFieldValue(o);if(!s||!(s instanceof e))return;let a=s.getSelectionParent();if(!a)return;i=a}return i}getSelectionParent(){let r=this.getField("select")?.value.asObject();if(r)return{kind:"select",value:r};let n=this.getField("include")?.value.asObject();if(n)return{kind:"include",value:n}}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(i=>i.getPrintWidth()))+2}write(r){let n=Object.values(this.fields);if(n.length===0&&this.suggestions.length===0){this.writeEmpty(r);return}this.writeWithContents(r,n)}asObject(){return this}writeEmpty(r){let n=new fe("{}");this.hasError&&n.setColor(r.context.colors.red).underline(),r.write(n)}writeWithContents(r,n){r.writeLine("{").withIndent(()=>{r.writeJoined(it,[...n,...this.suggestions]).newLine()}),r.write("}"),this.hasError&&r.afterNextNewline(()=>{r.writeLine(r.context.colors.red("~".repeat(this.getPrintWidth())))})}};d();u();c();p();m();var H=class extends Me{constructor(r){super();this.text=r}getPrintWidth(){return this.text.length}write(r){let n=new fe(this.text);this.hasError&&n.underline().setColor(r.context.colors.red),r.write(n)}asObject(){}};d();u();c();p();m();var Rt=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(it,this.fields).newLine()}).write(r("}")).addMarginSymbol(r("+"))}};function Pr(e,t,r){switch(e.kind){case"MutuallyExclusiveFields":ru(e,t);break;case"IncludeOnScalar":nu(e,t);break;case"EmptySelection":iu(e,t,r);break;case"UnknownSelectionField":lu(e,t);break;case"InvalidSelectionValue":uu(e,t);break;case"UnknownArgument":cu(e,t);break;case"UnknownInputField":pu(e,t);break;case"RequiredArgumentMissing":mu(e,t);break;case"InvalidArgumentType":du(e,t);break;case"InvalidArgumentValue":fu(e,t);break;case"ValueTooLarge":gu(e,t);break;case"SomeFieldsMissing":hu(e,t);break;case"TooManyFieldsGiven":yu(e,t);break;case"Union":ho(e,t,r);break;default:throw new Error("not implemented: "+e.kind)}}function ru(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 nu(e,t){let[r,n]=St(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 ae(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)}. ${It(s)}`:a+=".",a+=`
|
|
4
4
|
Note that ${s.bold("include")} statements only accept relation fields.`,a})}function iu(e,t,r){let n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getField("omit")?.value.asObject();if(i){ou(e,t,i);return}if(n.hasField("select")){su(e,t);return}}if(r?.[et(e.outputType.name)]){au(e,t);return}t.addErrorMessage(()=>`Unknown field at "${e.selectionPath.join(".")} selection"`)}function ou(e,t,r){r.removeAllFields();for(let n of e.outputType.fields)r.addSuggestion(new ae(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 su(e,t){let r=e.outputType,n=t.arguments.getDeepSelectionParent(e.selectionPath)?.value,i=n?.isEmpty()??!1;n&&(n.removeAllFields(),Po(n,r)),t.addErrorMessage(o=>i?`The ${o.red("`select`")} statement for type ${o.bold(r.name)} must not be empty. ${It(o)}`:`The ${o.red("`select`")} statement for type ${o.bold(r.name)} needs ${o.bold("at least one truthy value")}.`)}function au(e,t){let r=new Rt;for(let i of e.outputType.fields)i.isRelation||r.addField(i.name,"false");let n=new ae("omit",r).makeRequired();if(e.selectionPath.length===0)t.arguments.addSuggestion(n);else{let[i,o]=St(e.selectionPath),a=t.arguments.getDeepSelectionParent(i)?.value.asObject()?.getField(o);if(a){let l=a?.value.asObject()??new st;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 lu(e,t){let r=vo(e.selectionPath,t);if(r.parentKind!=="unknown"){r.field.markAsError();let n=r.parent;switch(r.parentKind){case"select":Po(n,e.outputType);break;case"include":wu(n,e.outputType);break;case"omit":Eu(n,e.outputType);break}}t.addErrorMessage(n=>{let i=[`Unknown field ${n.red(`\`${r.fieldName}\``)}`];return r.parentKind!=="unknown"&&i.push(`for ${n.bold(r.parentKind)} statement`),i.push(`on model ${n.bold(`\`${e.outputType.name}\``)}.`),i.push(It(n)),i.join(" ")})}function uu(e,t){let r=vo(e.selectionPath,t);r.parentKind!=="unknown"&&r.field.value.markAsError(),t.addErrorMessage(n=>`Invalid value for selection field \`${n.red(r.fieldName)}\`: ${e.underlyingError}`)}function cu(e,t){let r=e.argumentPath[0],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();n&&(n.getField(r)?.markAsError(),bu(n,e.arguments)),t.addErrorMessage(i=>bo(i,r,e.arguments.map(o=>o.name)))}function pu(e,t){let[r,n]=St(e.argumentPath),i=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(i){i.getDeepField(e.argumentPath)?.markAsError();let o=i.getDeepFieldValue(r)?.asObject();o&&To(o,e.inputType)}t.addErrorMessage(o=>bo(o,n,e.inputType.fields.map(s=>s.name)))}function bo(e,t,r){let n=[`Unknown argument \`${e.red(t)}\`.`],i=Pu(t,r);return i&&n.push(`Did you mean \`${e.green(i)}\`?`),r.length>0&&n.push(It(e)),n.join(" ")}function mu(e,t){let r;t.addErrorMessage(l=>r?.value instanceof H&&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]=St(e.argumentPath),s=new Rt,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 ae(o,s).makeRequired())}else{let l=e.inputTypes.map(xo).join(" | ");a.addSuggestion(new ae(o,l).makeRequired())}}function xo(e){return e.kind==="list"?`${xo(e.elementType)}[]`:e.name}function du(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=Ar("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 fu(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=[`Invalid value for argument \`${i.bold(r)}\``];if(e.underlyingError&&o.push(`: ${e.underlyingError}`),o.push("."),e.argument.typeNames.length>0){let s=Ar("or",e.argument.typeNames.map(a=>i.green(a)));o.push(` Expected ${s}.`)}return o.join("")})}function gu(e,t){let r=e.argument.name,n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject(),i;if(n){let s=n.getDeepField(e.argumentPath)?.value;s?.markAsError(),s instanceof H&&(i=s.text)}t.addErrorMessage(o=>{let s=["Unable to fit value"];return i&&s.push(o.red(i)),s.push(`into a 64-bit signed integer for field \`${o.bold(r)}\``),s.join(" ")})}function hu(e,t){let r=e.argumentPath[e.argumentPath.length-1],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject();if(n){let i=n.getDeepFieldValue(e.argumentPath)?.asObject();i&&To(i,e.inputType)}t.addErrorMessage(i=>{let o=[`Argument \`${i.bold(r)}\` of type ${i.bold(e.inputType.name)} needs`];return e.constraints.minFieldCount===1?e.constraints.requiredFields?o.push(`${i.green("at least one of")} ${Ar("or",e.constraints.requiredFields.map(s=>`\`${i.bold(s)}\``))} arguments.`):o.push(`${i.green("at least one")} argument.`):o.push(`${i.green(`at least ${e.constraints.minFieldCount}`)} arguments.`),o.push(It(i)),o.join(" ")})}function yu(e,t){let r=e.argumentPath[e.argumentPath.length-1],n=t.arguments.getDeepSubSelectionValue(e.selectionPath)?.asObject(),i=[];if(n){let o=n.getDeepFieldValue(e.argumentPath)?.asObject();o&&(o.markAsError(),i=Object.keys(o.getFields()))}t.addErrorMessage(o=>{let s=[`Argument \`${o.bold(r)}\` of type ${o.bold(e.inputType.name)} needs`];return e.constraints.minFieldCount===1&&e.constraints.maxFieldCount==1?s.push(`${o.green("exactly one")} argument,`):e.constraints.maxFieldCount==1?s.push(`${o.green("at most one")} argument,`):s.push(`${o.green(`at most ${e.constraints.maxFieldCount}`)} arguments,`),s.push(`but you provided ${Ar("and",i.map(a=>o.red(a)))}. Please choose`),e.constraints.maxFieldCount===1?s.push("one."):s.push(`${e.constraints.maxFieldCount}.`),s.join(" ")})}function Po(e,t){for(let r of t.fields)e.hasField(r.name)||e.addSuggestion(new ae(r.name,"true"))}function wu(e,t){for(let r of t.fields)r.isRelation&&!e.hasField(r.name)&&e.addSuggestion(new ae(r.name,"true"))}function Eu(e,t){for(let r of t.fields)!e.hasField(r.name)&&!r.isRelation&&e.addSuggestion(new ae(r.name,"true"))}function bu(e,t){for(let r of t)e.hasField(r.name)||e.addSuggestion(new ae(r.name,r.typeNames.join(" | ")))}function vo(e,t){let[r,n]=St(e),i=t.arguments.getDeepSubSelectionValue(r)?.asObject();if(!i)return{parentKind:"unknown",fieldName:n};let o=i.getFieldValue("select")?.asObject(),s=i.getFieldValue("include")?.asObject(),a=i.getFieldValue("omit")?.asObject(),l=o?.getField(n);return o&&l?{parentKind:"select",parent:o,field:l,fieldName:n}:(l=s?.getField(n),s&&l?{parentKind:"include",field:l,parent:s,fieldName:n}:(l=a?.getField(n),a&&l?{parentKind:"omit",field:l,parent:a,fieldName:n}:{parentKind:"unknown",fieldName:n}))}function To(e,t){if(t.kind==="object")for(let r of t.fields)e.hasField(r.name)||e.addSuggestion(new ae(r.name,r.typeNames.join(" | ")))}function St(e){let t=[...e],r=t.pop();if(!r)throw new Error("unexpected empty path");return[t,r]}function It({green:e,enabled:t}){return"Available options are "+(t?`listed in ${e("green")}`:"marked with ?")+"."}function Ar(e,t){if(t.length===1)return t[0];let r=[...t],n=r.pop();return`${r.join(", ")} ${e} ${n}`}var xu=3;function Pu(e,t){let r=1/0,n;for(let i of t){let o=(0,Eo.default)(e,i);o>xu||o<r&&(r=o,n=i)}return n}d();u();c();p();m();d();u();c();p();m();function Co(e){return e.substring(0,1).toLowerCase()+e.substring(1)}d();u();c();p();m();var Ot=class{constructor(t,r,n,i,o){this.modelName=t,this.name=r,this.typeName=n,this.isList=i,this.isEnum=o}_toGraphQLInputType(){let t=this.isList?"List":"",r=this.isEnum?"Enum":"";return`${t}${r}${this.typeName}FieldRefInput<${this.modelName}>`}};function at(e){return e instanceof Ot}d();u();c();p();m();var Rr=Symbol(),wn=new WeakMap,Te=class{constructor(t){t===Rr?wn.set(this,`Prisma.${this._getName()}`):wn.set(this,`new Prisma.${this._getNamespace()}.${this._getName()}()`)}_getName(){return this.constructor.name}toString(){return wn.get(this)}},kt=class extends Te{_getNamespace(){return"NullTypes"}},Dt=class extends kt{};bn(Dt,"DbNull");var Mt=class extends kt{};bn(Mt,"JsonNull");var Nt=class extends kt{};bn(Nt,"AnyNull");var En={classes:{DbNull:Dt,JsonNull:Mt,AnyNull:Nt},instances:{DbNull:new Dt(Rr),JsonNull:new Mt(Rr),AnyNull:new Nt(Rr)}};function bn(e,t){Object.defineProperty(e,"name",{value:t,configurable:!0})}d();u();c();p();m();var Ao=": ",Sr=class{constructor(t,r){this.name=t;this.value=r;this.hasError=!1}markAsError(){this.hasError=!0}getPrintWidth(){return this.name.length+this.value.getPrintWidth()+Ao.length}write(t){let r=new fe(this.name);this.hasError&&r.underline().setColor(t.context.colors.red),t.write(r).write(Ao).write(this.value)}};var xn=class{constructor(t){this.errorMessages=[];this.arguments=t}write(t){t.write(this.arguments)}addErrorMessage(t){this.errorMessages.push(t)}renderAllMessages(t){return this.errorMessages.map(r=>r(t)).join(`
|
|
5
|
-
`)}};function lt(e){return new xn(Ro(e))}function Ro(e){let t=new st;for(let[r,n]of Object.entries(e)){let i=new Sr(r,So(n));t.addField(i)}return t}function So(e){if(typeof e=="string")return new H(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new H(String(e));if(typeof e=="bigint")return new H(`${e}n`);if(e===null)return new H("null");if(e===void 0)return new H("undefined");if(rt(e))return new H(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return w.Buffer.isBuffer(e)?new H(`Buffer.alloc(${e.byteLength})`):new H(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=br(e)?e.toISOString():"Invalid Date";return new H(`new Date("${t}")`)}return e instanceof Te?new H(`Prisma.${e._getName()}`):at(e)?new H(`prisma.${Co(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?vu(e):typeof e=="object"?Ro(e):new H(Object.prototype.toString.call(e))}function vu(e){let t=new ot;for(let r of e)t.addItem(So(r));return t}function Ir(e,t){let r=t==="pretty"?wo:Cr,n=e.renderAllMessages(r),i=new nt(0,{colors:r}).write(e).toString();return{message:n,args:i}}function Or({args:e,errors:t,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=lt(e);for(let h of t)Pr(h,a,s);let{message:l,args:f}=Ir(a,r),g=xr({message:l,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:f});throw new X(g,{clientVersion:o})}d();u();c();p();m();d();u();c();p();m();var ge=class{constructor(){this._map=new Map}get(t){return this._map.get(t)?.value}set(t,r){this._map.set(t,{value:r})}getOrCreate(t,r){let n=this._map.get(t);if(n)return n.value;let i=r();return this.set(t,i),i}};d();u();c();p();m();function Ft(e){let t;return{get(){return t||(t={value:e()}),t.value}}}d();u();c();p();m();function he(e){return e.replace(/^./,t=>t.toLowerCase())}d();u();c();p();m();function Oo(e,t,r){let n=he(r);return!t.result||!(t.result.$allModels||t.result[n])?e:Tu({...e,...Io(t.name,e,t.result.$allModels),...Io(t.name,e,t.result[n])})}function Tu(e){let t=new ge,r=(n,i)=>t.getOrCreate(n,()=>i.has(n)?[n]:(i.add(n),e[n]?e[n].needs.flatMap(o=>r(o,i)):[n]));return Ye(e,n=>({...n,needs:r(n.name,new Set)}))}function Io(e,t,r){return r?Ye(r,({needs:n,compute:i},o)=>({name:o,needs:n?Object.keys(n).filter(s=>n[s]):[],compute:Cu(t,o,i)})):{}}function Cu(e,t,r){let n=e?.[t]?.compute;return n?i=>r({...i,[t]:n(i)}):r}function ko(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(e[n.name])for(let i of n.needs)r[i]=!0;return r}function Do(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(!e[n.name])for(let i of n.needs)delete r[i];return r}var kr=class{constructor(t,r){this.extension=t;this.previous=r;this.computedFieldsCache=new ge;this.modelExtensionsCache=new ge;this.queryCallbacksCache=new ge;this.clientExtensions=Ft(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());this.batchCallbacks=Ft(()=>{let t=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?t.concat(r):t})}getAllComputedFields(t){return this.computedFieldsCache.getOrCreate(t,()=>Oo(this.previous?.getAllComputedFields(t),this.extension,t))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(t){return this.modelExtensionsCache.getOrCreate(t,()=>{let r=he(t);return!this.extension.model||!(this.extension.model[r]||this.extension.model.$allModels)?this.previous?.getAllModelExtensions(t):{...this.previous?.getAllModelExtensions(t),...this.extension.model.$allModels,...this.extension.model[r]}})}getAllQueryCallbacks(t,r){return this.queryCallbacksCache.getOrCreate(`${t}:${r}`,()=>{let n=this.previous?.getAllQueryCallbacks(t,r)??[],i=[],o=this.extension.query;return!o||!(o[t]||o.$allModels||o[r]||o.$allOperations)?n:(o[t]!==void 0&&(o[t][r]!==void 0&&i.push(o[t][r]),o[t].$allOperations!==void 0&&i.push(o[t].$allOperations)),t!=="$none"&&o.$allModels!==void 0&&(o.$allModels[r]!==void 0&&i.push(o.$allModels[r]),o.$allModels.$allOperations!==void 0&&i.push(o.$allModels.$allOperations)),o[r]!==void 0&&i.push(o[r]),o.$allOperations!==void 0&&i.push(o.$allOperations),n.concat(i))})}getAllBatchQueryCallbacks(){return this.batchCallbacks.get()}},ut=class e{constructor(t){this.head=t}static empty(){return new e}static single(t){return new e(new kr(t))}isEmpty(){return this.head===void 0}append(t){return new e(new kr(t,this.head))}getAllComputedFields(t){return this.head?.getAllComputedFields(t)}getAllClientExtensions(){return this.head?.getAllClientExtensions()}getAllModelExtensions(t){return this.head?.getAllModelExtensions(t)}getAllQueryCallbacks(t,r){return this.head?.getAllQueryCallbacks(t,r)??[]}getAllBatchQueryCallbacks(){return this.head?.getAllBatchQueryCallbacks()??[]}};d();u();c();p();m();d();u();c();p();m();var Mo=Symbol(),_t=class{constructor(t){if(t!==Mo)throw new Error("Skip instance can not be constructed directly")}ifUndefined(t){return t===void 0?Pn:t}},Pn=new _t(Mo);function ye(e){return e instanceof _t}var Au={findUnique:"findUnique",findUniqueOrThrow:"findUniqueOrThrow",findFirst:"findFirst",findFirstOrThrow:"findFirstOrThrow",findMany:"findMany",count:"aggregate",create:"createOne",createMany:"createMany",createManyAndReturn:"createManyAndReturn",update:"updateOne",updateMany:"updateMany",upsert:"upsertOne",delete:"deleteOne",deleteMany:"deleteMany",executeRaw:"executeRaw",queryRaw:"queryRaw",aggregate:"aggregate",groupBy:"groupBy",runCommandRaw:"runCommandRaw",findRaw:"findRaw",aggregateRaw:"aggregateRaw"},No="explicitly `undefined` values are not allowed";function Tn({modelName:e,action:t,args:r,runtimeDataModel:n,extensions:i=ut.empty(),callsite:o,clientMethod:s,errorFormat:a,clientVersion:l,previewFeatures:f,globalOmit:g}){let h=new vn({runtimeDataModel:n,modelName:e,action:t,rootArgs:r,callsite:o,extensions:i,selectionPath:[],argumentPath:[],originalMethod:s,errorFormat:a,clientVersion:l,previewFeatures:f,globalOmit:g});return{modelName:e,action:Au[t],query:Lt(r,h)}}function Lt({select:e,include:t,...r}={},n){let i;return n.isPreviewFeatureOn("omitApi")&&(i=r.omit,delete r.omit),{arguments:_o(r,n),selection:Ru(e,t,i,n)}}function Ru(e,t,r,n){return e?(t?n.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"include",secondField:"select",selectionPath:n.getSelectionPath()}):r&&n.isPreviewFeatureOn("omitApi")&&n.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"omit",secondField:"select",selectionPath:n.getSelectionPath()}),ku(e,n)):Su(n,t,r)}function Su(e,t,r){let n={};return e.modelOrType&&!e.isRawAction()&&(n.$composites=!0,n.$scalars=!0),t&&Iu(n,t,e),e.isPreviewFeatureOn("omitApi")&&Ou(n,r,e),n}function Iu(e,t,r){for(let[n,i]of Object.entries(t)){if(ye(i))continue;let o=r.nestSelection(n);if(Cn(i,o),i===!1||i===void 0){e[n]=!1;continue}let s=r.findField(n);if(s&&s.kind!=="object"&&r.throwValidationError({kind:"IncludeOnScalar",selectionPath:r.getSelectionPath().concat(n),outputType:r.getOutputTypeDescription()}),s){e[n]=Lt(i===!0?{}:i,o);continue}if(i===!0){e[n]=!0;continue}e[n]=Lt(i,o)}}function Ou(e,t,r){let n=r.getComputedFields(),i={...r.getGlobalOmit(),...t},o=Do(i,n);for(let[s,a]of Object.entries(o)){if(ye(a))continue;Cn(a,r.nestSelection(s));let l=r.findField(s);n?.[s]&&!l||(e[s]=!a)}}function ku(e,t){let r={},n=t.getComputedFields(),i=ko(e,n);for(let[o,s]of Object.entries(i)){if(ye(s))continue;let a=t.nestSelection(o);Cn(s,a);let l=t.findField(o);if(!(n?.[o]&&!l)){if(s===!1||s===void 0||ye(s)){r[o]=!1;continue}if(s===!0){l?.kind==="object"?r[o]=Lt({},a):r[o]=!0;continue}r[o]=Lt(s,a)}}return r}function Fo(e,t){if(e===null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="bigint")return{$type:"BigInt",value:String(e)};if(tt(e)){if(br(e))return{$type:"DateTime",value:e.toISOString()};t.throwValidationError({kind:"InvalidArgumentValue",selectionPath:t.getSelectionPath(),argumentPath:t.getArgumentPath(),argument:{name:t.getArgumentName(),typeNames:["Date"]},underlyingError:"Provided Date object is invalid"})}if(at(e))return{$type:"FieldRef",value:{_ref:e.name,_container:e.modelName}};if(Array.isArray(e))return Du(e,t);if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:n,byteLength:i}=e;return{$type:"Bytes",value:w.Buffer.from(r,n,i).toString("base64")}}if(Mu(e))return e.values;if(rt(e))return{$type:"Decimal",value:e.toFixed()};if(e instanceof Te){if(e!==En.instances[e._getName()])throw new Error("Invalid ObjectEnumValue");return{$type:"Enum",value:e._getName()}}if(Nu(e))return e.toJSON();if(typeof e=="object")return _o(e,t);t.throwValidationError({kind:"InvalidArgumentValue",selectionPath:t.getSelectionPath(),argumentPath:t.getArgumentPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:`We could not serialize ${Object.prototype.toString.call(e)} value. Serialize the object to JSON or implement a ".toJSON()" method on it`})}function _o(e,t){if(e.$type)return{$type:"Raw",value:e};let r={};for(let n in e){let i=e[n],o=t.nestArgument(n);ye(i)||(i!==void 0?r[n]=Fo(i,o):t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidArgumentValue",argumentPath:o.getArgumentPath(),selectionPath:t.getSelectionPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:No}))}return r}function Du(e,t){let r=[];for(let n=0;n<e.length;n++){let i=t.nestArgument(String(n)),o=e[n];if(o===void 0||ye(o)){let s=o===void 0?"undefined":"Prisma.skip";t.throwValidationError({kind:"InvalidArgumentValue",selectionPath:i.getSelectionPath(),argumentPath:i.getArgumentPath(),argument:{name:`${t.getArgumentName()}[${n}]`,typeNames:[]},underlyingError:`Can not use \`${s}\` value within array. Use \`null\` or filter out \`${s}\` values`})}r.push(Fo(o,i))}return r}function Mu(e){return typeof e=="object"&&e!==null&&e.__prismaRawParameters__===!0}function Nu(e){return typeof e=="object"&&e!==null&&typeof e.toJSON=="function"}function Cn(e,t){e===void 0&&t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidSelectionValue",selectionPath:t.getSelectionPath(),underlyingError:No})}var vn=class e{constructor(t){this.params=t;this.params.modelName&&(this.modelOrType=this.params.runtimeDataModel.models[this.params.modelName]??this.params.runtimeDataModel.types[this.params.modelName])}throwValidationError(t){Or({errors:[t],originalMethod:this.params.originalMethod,args:this.params.rootArgs??{},callsite:this.params.callsite,errorFormat:this.params.errorFormat,clientVersion:this.params.clientVersion,globalOmit:this.params.globalOmit})}getSelectionPath(){return this.params.selectionPath}getArgumentPath(){return this.params.argumentPath}getArgumentName(){return this.params.argumentPath[this.params.argumentPath.length-1]}getOutputTypeDescription(){if(!(!this.params.modelName||!this.modelOrType))return{name:this.params.modelName,fields:this.modelOrType.fields.map(t=>({name:t.name,typeName:"boolean",isRelation:t.kind==="object"}))}}isRawAction(){return["executeRaw","queryRaw","runCommandRaw","findRaw","aggregateRaw"].includes(this.params.action)}isPreviewFeatureOn(t){return this.params.previewFeatures.includes(t)}getComputedFields(){if(this.params.modelName)return this.params.extensions.getAllComputedFields(this.params.modelName)}findField(t){return this.modelOrType?.fields.find(r=>r.name===t)}nestSelection(t){let r=this.findField(t),n=r?.kind==="object"?r.type:void 0;return new e({...this.params,modelName:n,selectionPath:this.params.selectionPath.concat(t)})}getGlobalOmit(){return this.params.modelName&&this.shouldApplyGlobalOmit()?this.params.globalOmit?.[et(this.params.modelName)]??{}:{}}shouldApplyGlobalOmit(){switch(this.params.action){case"findFirst":case"findFirstOrThrow":case"findUniqueOrThrow":case"findMany":case"upsert":case"findUnique":case"createManyAndReturn":case"create":case"update":case"delete":return!0;case"executeRaw":case"aggregateRaw":case"runCommandRaw":case"findRaw":case"createMany":case"deleteMany":case"groupBy":case"updateMany":case"count":case"aggregate":case"queryRaw":return!1;default:xe(this.params.action,"Unknown action")}}nestArgument(t){return new e({...this.params,argumentPath:this.params.argumentPath.concat(t)})}};d();u();c();p();m();var Bt=class{constructor(t){this._engine=t}prometheus(t){return this._engine.metrics({format:"prometheus",...t})}json(t){return this._engine.metrics({format:"json",...t})}};d();u();c();p();m();function Fu(e){return{models:An(e.models),enums:An(e.enums),types:An(e.types)}}function An(e){let t={};for(let{name:r,...n}of e)t[r]=n;return t}function _u(e,t){let r=Ft(()=>Lu(t));Object.defineProperty(e,"dmmf",{get:()=>r.get()})}function Lu(e){return{datamodel:{models:Rn(e.models),enums:Rn(e.enums),types:Rn(e.types)}}}function Rn(e){return Object.entries(e).map(([t,r])=>({name:t,...r}))}d();u();c();p();m();var Sn=new WeakMap,Dr="$$PrismaTypedSql",In=class{constructor(t,r){Sn.set(this,{sql:t,values:r}),Object.defineProperty(this,Dr,{value:Dr})}get sql(){return Sn.get(this).sql}get values(){return Sn.get(this).values}};function Bu(e){return(...t)=>new In(e,t)}function Lo(e){return e!=null&&e[Dr]===Dr}d();u();c();p();m();d();u();c();p();m();d();u();c();p();m();d();u();c();p();m();function Ut(e){return{ok:!1,error:e,map(){return Ut(e)},flatMap(){return Ut(e)}}}var On=class{constructor(){this.registeredErrors=[]}consumeError(t){return this.registeredErrors[t]}registerNewError(t){let r=0;for(;this.registeredErrors[r]!==void 0;)r++;return this.registeredErrors[r]={error:t},r}},kn=e=>{let t=new On,r=we(t,e.transactionContext.bind(e)),n={adapterName:e.adapterName,errorRegistry:t,queryRaw:we(t,e.queryRaw.bind(e)),executeRaw:we(t,e.executeRaw.bind(e)),provider:e.provider,transactionContext:async(...i)=>(await r(...i)).map(s=>Uu(t,s))};return e.getConnectionInfo&&(n.getConnectionInfo=qu(t,e.getConnectionInfo.bind(e))),n},Uu=(e,t)=>{let r=we(e,t.startTransaction.bind(t));return{adapterName:t.adapterName,provider:t.provider,queryRaw:we(e,t.queryRaw.bind(t)),executeRaw:we(e,t.executeRaw.bind(t)),startTransaction:async(...n)=>(await r(...n)).map(o=>$u(e,o))}},$u=(e,t)=>({adapterName:t.adapterName,provider:t.provider,options:t.options,queryRaw:we(e,t.queryRaw.bind(t)),executeRaw:we(e,t.executeRaw.bind(t)),commit:we(e,t.commit.bind(t)),rollback:we(e,t.rollback.bind(t))});function we(e,t){return async(...r)=>{try{return await t(...r)}catch(n){let i=e.registerNewError(n);return Ut({kind:"GenericJs",id:i})}}}function qu(e,t){return(...r)=>{try{return t(...r)}catch(n){let i=e.registerNewError(n);return Ut({kind:"GenericJs",id:i})}}}var Xs=Le(Bo());var Tk=Le(Uo());Vi();Ti();$i();d();u();c();p();m();var le=class e{constructor(t,r){if(t.length-1!==r.length)throw t.length===0?new TypeError("Expected at least 1 string"):new TypeError(`Expected ${t.length} strings to have ${t.length-1} values`);let n=r.reduce((s,a)=>s+(a instanceof e?a.values.length:1),0);this.values=new Array(n),this.strings=new Array(n+1),this.strings[0]=t[0];let i=0,o=0;for(;i<r.length;){let s=r[i++],a=t[i];if(s instanceof e){this.strings[o]+=s.strings[0];let l=0;for(;l<s.values.length;)this.values[o++]=s.values[l++],this.strings[o]=s.strings[l];this.strings[o]+=a}else this.values[o++]=s,this.strings[o]=a}}get sql(){let t=this.strings.length,r=1,n=this.strings[0];for(;r<t;)n+=`?${this.strings[r++]}`;return n}get statement(){let t=this.strings.length,r=1,n=this.strings[0];for(;r<t;)n+=`:${r}${this.strings[r++]}`;return n}get text(){let t=this.strings.length,r=1,n=this.strings[0];for(;r<t;)n+=`$${r}${this.strings[r++]}`;return n}inspect(){return{sql:this.sql,statement:this.statement,text:this.text,values:this.values}}};function ju(e,t=",",r="",n=""){if(e.length===0)throw new TypeError("Expected `join([])` to be called with an array of multiple elements, but got an empty array");return new le([r,...Array(e.length-1).fill(t),n],e)}function $o(e){return new le([e],[])}var Ju=$o("");function qo(e,...t){return new le(e,t)}d();u();c();p();m();d();u();c();p();m();function $t(e){return{getKeys(){return Object.keys(e)},getPropertyValue(t){return e[t]}}}d();u();c();p();m();function ee(e,t){return{getKeys(){return[e]},getPropertyValue(){return t()}}}d();u();c();p();m();function $e(e){let t=new ge;return{getKeys(){return e.getKeys()},getPropertyValue(r){return t.getOrCreate(r,()=>e.getPropertyValue(r))},getPropertyDescriptor(r){return e.getPropertyDescriptor?.(r)}}}d();u();c();p();m();d();u();c();p();m();var Mr={enumerable:!0,configurable:!0,writable:!0};function Nr(e){let t=new Set(e);return{getOwnPropertyDescriptor:()=>Mr,has:(r,n)=>t.has(n),set:(r,n,i)=>t.add(n)&&Reflect.set(r,n,i),ownKeys:()=>[...t]}}var Vo=Symbol.for("nodejs.util.inspect.custom");function Ee(e,t){let r=Gu(t),n=new Set,i=new Proxy(e,{get(o,s){if(n.has(s))return o[s];let a=r.get(s);return a?a.getPropertyValue(s):o[s]},has(o,s){if(n.has(s))return!0;let a=r.get(s);return a?a.has?.(s)??!0:Reflect.has(o,s)},ownKeys(o){let s=jo(Reflect.ownKeys(o),r),a=jo(Array.from(r.keys()),r);return[...new Set([...s,...a,...n])]},set(o,s,a){return r.get(s)?.getPropertyDescriptor?.(s)?.writable===!1?!1:(n.add(s),Reflect.set(o,s,a))},getOwnPropertyDescriptor(o,s){let a=Reflect.getOwnPropertyDescriptor(o,s);if(a&&!a.configurable)return a;let l=r.get(s);return l?l.getPropertyDescriptor?{...Mr,...l?.getPropertyDescriptor(s)}:Mr:a},defineProperty(o,s,a){return n.add(s),Reflect.defineProperty(o,s,a)}});return i[Vo]=function(){let o={...this};return delete o[Vo],o},i}function Gu(e){let t=new Map;for(let r of e){let n=r.getKeys();for(let i of n)t.set(i,r)}return t}function jo(e,t){return e.filter(r=>t.get(r)?.has?.(r)??!0)}d();u();c();p();m();function ct(e){return{getKeys(){return e},has(){return!1},getPropertyValue(){}}}d();u();c();p();m();function Fr(e,t){return{batch:e,transaction:t?.kind==="batch"?{isolationLevel:t.options.isolationLevel}:void 0}}d();u();c();p();m();function Jo(e){if(e===void 0)return"";let t=lt(e);return new nt(0,{colors:Cr}).write(t).toString()}d();u();c();p();m();var Qu="P2037";function _r({error:e,user_facing_error:t},r,n){return t.error_code?new oe(Wu(t,n),{code:t.error_code,clientVersion:r,meta:t.meta,batchRequestIdx:t.batch_request_idx}):new se(e,{clientVersion:r,batchRequestIdx:t.batch_request_idx})}function Wu(e,t){let r=e.message;return(t==="postgresql"||t==="postgres"||t==="mysql")&&e.error_code===Qu&&(r+=`
|
|
5
|
+
`)}};function lt(e){return new xn(Ro(e))}function Ro(e){let t=new st;for(let[r,n]of Object.entries(e)){let i=new Sr(r,So(n));t.addField(i)}return t}function So(e){if(typeof e=="string")return new H(JSON.stringify(e));if(typeof e=="number"||typeof e=="boolean")return new H(String(e));if(typeof e=="bigint")return new H(`${e}n`);if(e===null)return new H("null");if(e===void 0)return new H("undefined");if(rt(e))return new H(`new Prisma.Decimal("${e.toFixed()}")`);if(e instanceof Uint8Array)return w.Buffer.isBuffer(e)?new H(`Buffer.alloc(${e.byteLength})`):new H(`new Uint8Array(${e.byteLength})`);if(e instanceof Date){let t=br(e)?e.toISOString():"Invalid Date";return new H(`new Date("${t}")`)}return e instanceof Te?new H(`Prisma.${e._getName()}`):at(e)?new H(`prisma.${Co(e.modelName)}.$fields.${e.name}`):Array.isArray(e)?vu(e):typeof e=="object"?Ro(e):new H(Object.prototype.toString.call(e))}function vu(e){let t=new ot;for(let r of e)t.addItem(So(r));return t}function Ir(e,t){let r=t==="pretty"?wo:Cr,n=e.renderAllMessages(r),i=new nt(0,{colors:r}).write(e).toString();return{message:n,args:i}}function Or({args:e,errors:t,errorFormat:r,callsite:n,originalMethod:i,clientVersion:o,globalOmit:s}){let a=lt(e);for(let h of t)Pr(h,a,s);let{message:l,args:f}=Ir(a,r),g=xr({message:l,callsite:n,originalMethod:i,showColors:r==="pretty",callArguments:f});throw new X(g,{clientVersion:o})}d();u();c();p();m();d();u();c();p();m();var ge=class{constructor(){this._map=new Map}get(t){return this._map.get(t)?.value}set(t,r){this._map.set(t,{value:r})}getOrCreate(t,r){let n=this._map.get(t);if(n)return n.value;let i=r();return this.set(t,i),i}};d();u();c();p();m();function Ft(e){let t;return{get(){return t||(t={value:e()}),t.value}}}d();u();c();p();m();function he(e){return e.replace(/^./,t=>t.toLowerCase())}d();u();c();p();m();function Oo(e,t,r){let n=he(r);return!t.result||!(t.result.$allModels||t.result[n])?e:Tu({...e,...Io(t.name,e,t.result.$allModels),...Io(t.name,e,t.result[n])})}function Tu(e){let t=new ge,r=(n,i)=>t.getOrCreate(n,()=>i.has(n)?[n]:(i.add(n),e[n]?e[n].needs.flatMap(o=>r(o,i)):[n]));return Ye(e,n=>({...n,needs:r(n.name,new Set)}))}function Io(e,t,r){return r?Ye(r,({needs:n,compute:i},o)=>({name:o,needs:n?Object.keys(n).filter(s=>n[s]):[],compute:Cu(t,o,i)})):{}}function Cu(e,t,r){let n=e?.[t]?.compute;return n?i=>r({...i,[t]:n(i)}):r}function ko(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(e[n.name])for(let i of n.needs)r[i]=!0;return r}function Do(e,t){if(!t)return e;let r={...e};for(let n of Object.values(t))if(!e[n.name])for(let i of n.needs)delete r[i];return r}var kr=class{constructor(t,r){this.extension=t;this.previous=r;this.computedFieldsCache=new ge;this.modelExtensionsCache=new ge;this.queryCallbacksCache=new ge;this.clientExtensions=Ft(()=>this.extension.client?{...this.previous?.getAllClientExtensions(),...this.extension.client}:this.previous?.getAllClientExtensions());this.batchCallbacks=Ft(()=>{let t=this.previous?.getAllBatchQueryCallbacks()??[],r=this.extension.query?.$__internalBatch;return r?t.concat(r):t})}getAllComputedFields(t){return this.computedFieldsCache.getOrCreate(t,()=>Oo(this.previous?.getAllComputedFields(t),this.extension,t))}getAllClientExtensions(){return this.clientExtensions.get()}getAllModelExtensions(t){return this.modelExtensionsCache.getOrCreate(t,()=>{let r=he(t);return!this.extension.model||!(this.extension.model[r]||this.extension.model.$allModels)?this.previous?.getAllModelExtensions(t):{...this.previous?.getAllModelExtensions(t),...this.extension.model.$allModels,...this.extension.model[r]}})}getAllQueryCallbacks(t,r){return this.queryCallbacksCache.getOrCreate(`${t}:${r}`,()=>{let n=this.previous?.getAllQueryCallbacks(t,r)??[],i=[],o=this.extension.query;return!o||!(o[t]||o.$allModels||o[r]||o.$allOperations)?n:(o[t]!==void 0&&(o[t][r]!==void 0&&i.push(o[t][r]),o[t].$allOperations!==void 0&&i.push(o[t].$allOperations)),t!=="$none"&&o.$allModels!==void 0&&(o.$allModels[r]!==void 0&&i.push(o.$allModels[r]),o.$allModels.$allOperations!==void 0&&i.push(o.$allModels.$allOperations)),o[r]!==void 0&&i.push(o[r]),o.$allOperations!==void 0&&i.push(o.$allOperations),n.concat(i))})}getAllBatchQueryCallbacks(){return this.batchCallbacks.get()}},ut=class e{constructor(t){this.head=t}static empty(){return new e}static single(t){return new e(new kr(t))}isEmpty(){return this.head===void 0}append(t){return new e(new kr(t,this.head))}getAllComputedFields(t){return this.head?.getAllComputedFields(t)}getAllClientExtensions(){return this.head?.getAllClientExtensions()}getAllModelExtensions(t){return this.head?.getAllModelExtensions(t)}getAllQueryCallbacks(t,r){return this.head?.getAllQueryCallbacks(t,r)??[]}getAllBatchQueryCallbacks(){return this.head?.getAllBatchQueryCallbacks()??[]}};d();u();c();p();m();d();u();c();p();m();var Mo=Symbol(),_t=class{constructor(t){if(t!==Mo)throw new Error("Skip instance can not be constructed directly")}ifUndefined(t){return t===void 0?Pn:t}},Pn=new _t(Mo);function ye(e){return e instanceof _t}var Au={findUnique:"findUnique",findUniqueOrThrow:"findUniqueOrThrow",findFirst:"findFirst",findFirstOrThrow:"findFirstOrThrow",findMany:"findMany",count:"aggregate",create:"createOne",createMany:"createMany",createManyAndReturn:"createManyAndReturn",update:"updateOne",updateMany:"updateMany",upsert:"upsertOne",delete:"deleteOne",deleteMany:"deleteMany",executeRaw:"executeRaw",queryRaw:"queryRaw",aggregate:"aggregate",groupBy:"groupBy",runCommandRaw:"runCommandRaw",findRaw:"findRaw",aggregateRaw:"aggregateRaw"},No="explicitly `undefined` values are not allowed";function Tn({modelName:e,action:t,args:r,runtimeDataModel:n,extensions:i=ut.empty(),callsite:o,clientMethod:s,errorFormat:a,clientVersion:l,previewFeatures:f,globalOmit:g}){let h=new vn({runtimeDataModel:n,modelName:e,action:t,rootArgs:r,callsite:o,extensions:i,selectionPath:[],argumentPath:[],originalMethod:s,errorFormat:a,clientVersion:l,previewFeatures:f,globalOmit:g});return{modelName:e,action:Au[t],query:Lt(r,h)}}function Lt({select:e,include:t,...r}={},n){let i;return n.isPreviewFeatureOn("omitApi")&&(i=r.omit,delete r.omit),{arguments:_o(r,n),selection:Ru(e,t,i,n)}}function Ru(e,t,r,n){return e?(t?n.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"include",secondField:"select",selectionPath:n.getSelectionPath()}):r&&n.isPreviewFeatureOn("omitApi")&&n.throwValidationError({kind:"MutuallyExclusiveFields",firstField:"omit",secondField:"select",selectionPath:n.getSelectionPath()}),ku(e,n)):Su(n,t,r)}function Su(e,t,r){let n={};return e.modelOrType&&!e.isRawAction()&&(n.$composites=!0,n.$scalars=!0),t&&Iu(n,t,e),e.isPreviewFeatureOn("omitApi")&&Ou(n,r,e),n}function Iu(e,t,r){for(let[n,i]of Object.entries(t)){if(ye(i))continue;let o=r.nestSelection(n);if(Cn(i,o),i===!1||i===void 0){e[n]=!1;continue}let s=r.findField(n);if(s&&s.kind!=="object"&&r.throwValidationError({kind:"IncludeOnScalar",selectionPath:r.getSelectionPath().concat(n),outputType:r.getOutputTypeDescription()}),s){e[n]=Lt(i===!0?{}:i,o);continue}if(i===!0){e[n]=!0;continue}e[n]=Lt(i,o)}}function Ou(e,t,r){let n=r.getComputedFields(),i={...r.getGlobalOmit(),...t},o=Do(i,n);for(let[s,a]of Object.entries(o)){if(ye(a))continue;Cn(a,r.nestSelection(s));let l=r.findField(s);n?.[s]&&!l||(e[s]=!a)}}function ku(e,t){let r={},n=t.getComputedFields(),i=ko(e,n);for(let[o,s]of Object.entries(i)){if(ye(s))continue;let a=t.nestSelection(o);Cn(s,a);let l=t.findField(o);if(!(n?.[o]&&!l)){if(s===!1||s===void 0||ye(s)){r[o]=!1;continue}if(s===!0){l?.kind==="object"?r[o]=Lt({},a):r[o]=!0;continue}r[o]=Lt(s,a)}}return r}function Fo(e,t){if(e===null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="bigint")return{$type:"BigInt",value:String(e)};if(tt(e)){if(br(e))return{$type:"DateTime",value:e.toISOString()};t.throwValidationError({kind:"InvalidArgumentValue",selectionPath:t.getSelectionPath(),argumentPath:t.getArgumentPath(),argument:{name:t.getArgumentName(),typeNames:["Date"]},underlyingError:"Provided Date object is invalid"})}if(at(e))return{$type:"FieldRef",value:{_ref:e.name,_container:e.modelName}};if(Array.isArray(e))return Du(e,t);if(ArrayBuffer.isView(e)){let{buffer:r,byteOffset:n,byteLength:i}=e;return{$type:"Bytes",value:w.Buffer.from(r,n,i).toString("base64")}}if(Mu(e))return e.values;if(rt(e))return{$type:"Decimal",value:e.toFixed()};if(e instanceof Te){if(e!==En.instances[e._getName()])throw new Error("Invalid ObjectEnumValue");return{$type:"Enum",value:e._getName()}}if(Nu(e))return e.toJSON();if(typeof e=="object")return _o(e,t);t.throwValidationError({kind:"InvalidArgumentValue",selectionPath:t.getSelectionPath(),argumentPath:t.getArgumentPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:`We could not serialize ${Object.prototype.toString.call(e)} value. Serialize the object to JSON or implement a ".toJSON()" method on it`})}function _o(e,t){if(e.$type)return{$type:"Raw",value:e};let r={};for(let n in e){let i=e[n],o=t.nestArgument(n);ye(i)||(i!==void 0?r[n]=Fo(i,o):t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidArgumentValue",argumentPath:o.getArgumentPath(),selectionPath:t.getSelectionPath(),argument:{name:t.getArgumentName(),typeNames:[]},underlyingError:No}))}return r}function Du(e,t){let r=[];for(let n=0;n<e.length;n++){let i=t.nestArgument(String(n)),o=e[n];if(o===void 0||ye(o)){let s=o===void 0?"undefined":"Prisma.skip";t.throwValidationError({kind:"InvalidArgumentValue",selectionPath:i.getSelectionPath(),argumentPath:i.getArgumentPath(),argument:{name:`${t.getArgumentName()}[${n}]`,typeNames:[]},underlyingError:`Can not use \`${s}\` value within array. Use \`null\` or filter out \`${s}\` values`})}r.push(Fo(o,i))}return r}function Mu(e){return typeof e=="object"&&e!==null&&e.__prismaRawParameters__===!0}function Nu(e){return typeof e=="object"&&e!==null&&typeof e.toJSON=="function"}function Cn(e,t){e===void 0&&t.isPreviewFeatureOn("strictUndefinedChecks")&&t.throwValidationError({kind:"InvalidSelectionValue",selectionPath:t.getSelectionPath(),underlyingError:No})}var vn=class e{constructor(t){this.params=t;this.params.modelName&&(this.modelOrType=this.params.runtimeDataModel.models[this.params.modelName]??this.params.runtimeDataModel.types[this.params.modelName])}throwValidationError(t){Or({errors:[t],originalMethod:this.params.originalMethod,args:this.params.rootArgs??{},callsite:this.params.callsite,errorFormat:this.params.errorFormat,clientVersion:this.params.clientVersion,globalOmit:this.params.globalOmit})}getSelectionPath(){return this.params.selectionPath}getArgumentPath(){return this.params.argumentPath}getArgumentName(){return this.params.argumentPath[this.params.argumentPath.length-1]}getOutputTypeDescription(){if(!(!this.params.modelName||!this.modelOrType))return{name:this.params.modelName,fields:this.modelOrType.fields.map(t=>({name:t.name,typeName:"boolean",isRelation:t.kind==="object"}))}}isRawAction(){return["executeRaw","queryRaw","runCommandRaw","findRaw","aggregateRaw"].includes(this.params.action)}isPreviewFeatureOn(t){return this.params.previewFeatures.includes(t)}getComputedFields(){if(this.params.modelName)return this.params.extensions.getAllComputedFields(this.params.modelName)}findField(t){return this.modelOrType?.fields.find(r=>r.name===t)}nestSelection(t){let r=this.findField(t),n=r?.kind==="object"?r.type:void 0;return new e({...this.params,modelName:n,selectionPath:this.params.selectionPath.concat(t)})}getGlobalOmit(){return this.params.modelName&&this.shouldApplyGlobalOmit()?this.params.globalOmit?.[et(this.params.modelName)]??{}:{}}shouldApplyGlobalOmit(){switch(this.params.action){case"findFirst":case"findFirstOrThrow":case"findUniqueOrThrow":case"findMany":case"upsert":case"findUnique":case"createManyAndReturn":case"create":case"update":case"delete":return!0;case"executeRaw":case"aggregateRaw":case"runCommandRaw":case"findRaw":case"createMany":case"deleteMany":case"groupBy":case"updateMany":case"count":case"aggregate":case"queryRaw":return!1;default:xe(this.params.action,"Unknown action")}}nestArgument(t){return new e({...this.params,argumentPath:this.params.argumentPath.concat(t)})}};d();u();c();p();m();var Bt=class{constructor(t){this._engine=t}prometheus(t){return this._engine.metrics({format:"prometheus",...t})}json(t){return this._engine.metrics({format:"json",...t})}};d();u();c();p();m();function Fu(e){return{models:An(e.models),enums:An(e.enums),types:An(e.types)}}function An(e){let t={};for(let{name:r,...n}of e)t[r]=n;return t}function _u(e,t){let r=Ft(()=>Lu(t));Object.defineProperty(e,"dmmf",{get:()=>r.get()})}function Lu(e){return{datamodel:{models:Rn(e.models),enums:Rn(e.enums),types:Rn(e.types)}}}function Rn(e){return Object.entries(e).map(([t,r])=>({name:t,...r}))}d();u();c();p();m();var Sn=new WeakMap,Dr="$$PrismaTypedSql",In=class{constructor(t,r){Sn.set(this,{sql:t,values:r}),Object.defineProperty(this,Dr,{value:Dr})}get sql(){return Sn.get(this).sql}get values(){return Sn.get(this).values}};function Bu(e){return(...t)=>new In(e,t)}function Lo(e){return e!=null&&e[Dr]===Dr}d();u();c();p();m();d();u();c();p();m();d();u();c();p();m();d();u();c();p();m();function Ut(e){return{ok:!1,error:e,map(){return Ut(e)},flatMap(){return Ut(e)}}}var On=class{constructor(){this.registeredErrors=[]}consumeError(t){return this.registeredErrors[t]}registerNewError(t){let r=0;for(;this.registeredErrors[r]!==void 0;)r++;return this.registeredErrors[r]={error:t},r}},kn=e=>{let t=new On,r=we(t,e.transactionContext.bind(e)),n={adapterName:e.adapterName,errorRegistry:t,queryRaw:we(t,e.queryRaw.bind(e)),executeRaw:we(t,e.executeRaw.bind(e)),provider:e.provider,transactionContext:async(...i)=>(await r(...i)).map(s=>Uu(t,s))};return e.getConnectionInfo&&(n.getConnectionInfo=qu(t,e.getConnectionInfo.bind(e))),n},Uu=(e,t)=>{let r=we(e,t.startTransaction.bind(t));return{adapterName:t.adapterName,provider:t.provider,queryRaw:we(e,t.queryRaw.bind(t)),executeRaw:we(e,t.executeRaw.bind(t)),startTransaction:async(...n)=>(await r(...n)).map(o=>$u(e,o))}},$u=(e,t)=>({adapterName:t.adapterName,provider:t.provider,options:t.options,queryRaw:we(e,t.queryRaw.bind(t)),executeRaw:we(e,t.executeRaw.bind(t)),commit:we(e,t.commit.bind(t)),rollback:we(e,t.rollback.bind(t))});function we(e,t){return async(...r)=>{try{return await t(...r)}catch(n){let i=e.registerNewError(n);return Ut({kind:"GenericJs",id:i})}}}function qu(e,t){return(...r)=>{try{return t(...r)}catch(n){let i=e.registerNewError(n);return Ut({kind:"GenericJs",id:i})}}}var Xs=Le(Bo());var Tk=Le(Uo());Vi();Ti();$i();d();u();c();p();m();var le=class e{constructor(t,r){if(t.length-1!==r.length)throw t.length===0?new TypeError("Expected at least 1 string"):new TypeError(`Expected ${t.length} strings to have ${t.length-1} values`);let n=r.reduce((s,a)=>s+(a instanceof e?a.values.length:1),0);this.values=new Array(n),this.strings=new Array(n+1),this.strings[0]=t[0];let i=0,o=0;for(;i<r.length;){let s=r[i++],a=t[i];if(s instanceof e){this.strings[o]+=s.strings[0];let l=0;for(;l<s.values.length;)this.values[o++]=s.values[l++],this.strings[o]=s.strings[l];this.strings[o]+=a}else this.values[o++]=s,this.strings[o]=a}}get sql(){let t=this.strings.length,r=1,n=this.strings[0];for(;r<t;)n+=`?${this.strings[r++]}`;return n}get statement(){let t=this.strings.length,r=1,n=this.strings[0];for(;r<t;)n+=`:${r}${this.strings[r++]}`;return n}get text(){let t=this.strings.length,r=1,n=this.strings[0];for(;r<t;)n+=`$${r}${this.strings[r++]}`;return n}inspect(){return{sql:this.sql,statement:this.statement,text:this.text,values:this.values}}};function ju(e,t=",",r="",n=""){if(e.length===0)throw new TypeError("Expected `join([])` to be called with an array of multiple elements, but got an empty array");return new le([r,...Array(e.length-1).fill(t),n],e)}function $o(e){return new le([e],[])}var Ju=$o("");function qo(e,...t){return new le(e,t)}d();u();c();p();m();d();u();c();p();m();function $t(e){return{getKeys(){return Object.keys(e)},getPropertyValue(t){return e[t]}}}d();u();c();p();m();function ee(e,t){return{getKeys(){return[e]},getPropertyValue(){return t()}}}d();u();c();p();m();function $e(e){let t=new ge;return{getKeys(){return e.getKeys()},getPropertyValue(r){return t.getOrCreate(r,()=>e.getPropertyValue(r))},getPropertyDescriptor(r){return e.getPropertyDescriptor?.(r)}}}d();u();c();p();m();d();u();c();p();m();var Mr={enumerable:!0,configurable:!0,writable:!0};function Nr(e){let t=new Set(e);return{getPrototypeOf:()=>Object.prototype,getOwnPropertyDescriptor:()=>Mr,has:(r,n)=>t.has(n),set:(r,n,i)=>t.add(n)&&Reflect.set(r,n,i),ownKeys:()=>[...t]}}var Vo=Symbol.for("nodejs.util.inspect.custom");function Ee(e,t){let r=Gu(t),n=new Set,i=new Proxy(e,{get(o,s){if(n.has(s))return o[s];let a=r.get(s);return a?a.getPropertyValue(s):o[s]},has(o,s){if(n.has(s))return!0;let a=r.get(s);return a?a.has?.(s)??!0:Reflect.has(o,s)},ownKeys(o){let s=jo(Reflect.ownKeys(o),r),a=jo(Array.from(r.keys()),r);return[...new Set([...s,...a,...n])]},set(o,s,a){return r.get(s)?.getPropertyDescriptor?.(s)?.writable===!1?!1:(n.add(s),Reflect.set(o,s,a))},getOwnPropertyDescriptor(o,s){let a=Reflect.getOwnPropertyDescriptor(o,s);if(a&&!a.configurable)return a;let l=r.get(s);return l?l.getPropertyDescriptor?{...Mr,...l?.getPropertyDescriptor(s)}:Mr:a},defineProperty(o,s,a){return n.add(s),Reflect.defineProperty(o,s,a)},getPrototypeOf:()=>Object.prototype});return i[Vo]=function(){let o={...this};return delete o[Vo],o},i}function Gu(e){let t=new Map;for(let r of e){let n=r.getKeys();for(let i of n)t.set(i,r)}return t}function jo(e,t){return e.filter(r=>t.get(r)?.has?.(r)??!0)}d();u();c();p();m();function ct(e){return{getKeys(){return e},has(){return!1},getPropertyValue(){}}}d();u();c();p();m();function Fr(e,t){return{batch:e,transaction:t?.kind==="batch"?{isolationLevel:t.options.isolationLevel}:void 0}}d();u();c();p();m();function Jo(e){if(e===void 0)return"";let t=lt(e);return new nt(0,{colors:Cr}).write(t).toString()}d();u();c();p();m();var Qu="P2037";function _r({error:e,user_facing_error:t},r,n){return t.error_code?new oe(Wu(t,n),{code:t.error_code,clientVersion:r,meta:t.meta,batchRequestIdx:t.batch_request_idx}):new se(e,{clientVersion:r,batchRequestIdx:t.batch_request_idx})}function Wu(e,t){let r=e.message;return(t==="postgresql"||t==="postgres"||t==="mysql")&&e.error_code===Qu&&(r+=`
|
|
6
6
|
Prisma Accelerate has built-in connection pooling to prevent such errors: https://pris.ly/client/error-accelerate`),r}d();u();c();p();m();d();u();c();p();m();d();u();c();p();m();d();u();c();p();m();d();u();c();p();m();var Dn=class{getLocation(){return null}};function Ne(e){return typeof $EnabledCallSite=="function"&&e!=="minimal"?new $EnabledCallSite:new Dn}d();u();c();p();m();d();u();c();p();m();d();u();c();p();m();var Go={_avg:!0,_count:!0,_sum:!0,_min:!0,_max:!0};function pt(e={}){let t=Ku(e);return Object.entries(t).reduce((n,[i,o])=>(Go[i]!==void 0?n.select[i]={select:o}:n[i]=o,n),{select:{}})}function Ku(e={}){return typeof e._count=="boolean"?{...e,_count:{_all:e._count}}:e}function Lr(e={}){return t=>(typeof e._count=="boolean"&&(t._count=t._count._all),t)}function Qo(e,t){let r=Lr(e);return t({action:"aggregate",unpacker:r,argsMapper:pt})(e)}d();u();c();p();m();function zu(e={}){let{select:t,...r}=e;return typeof t=="object"?pt({...r,_count:t}):pt({...r,_count:{_all:!0}})}function Yu(e={}){return typeof e.select=="object"?t=>Lr(e)(t)._count:t=>Lr(e)(t)._count._all}function Wo(e,t){return t({action:"count",unpacker:Yu(e),argsMapper:zu})(e)}d();u();c();p();m();function Zu(e={}){let t=pt(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 Xu(e={}){return t=>(typeof e?._count=="boolean"&&t.forEach(r=>{r._count=r._count._all}),t)}function Ho(e,t){return t({action:"groupBy",unpacker:Xu(e),argsMapper:Zu})(e)}function Ko(e,t,r){if(t==="aggregate")return n=>Qo(n,r);if(t==="count")return n=>Wo(n,r);if(t==="groupBy")return n=>Ho(n,r)}d();u();c();p();m();function zo(e,t){let r=t.fields.filter(i=>!i.relationName),n=un(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 Ot(e,o,s.type,s.isList,s.kind==="enum")},...Nr(Object.keys(n))})}d();u();c();p();m();d();u();c();p();m();var Yo=e=>Array.isArray(e)?e:e.split("."),Mn=(e,t)=>Yo(t).reduce((r,n)=>r&&r[n],e),Zo=(e,t,r)=>Yo(t).reduceRight((n,i,o,s)=>Object.assign({},Mn(e,s.slice(0,o)),{[i]:n}),r);function ec(e,t){return e===void 0||t===void 0?[]:[...t,"select",e]}function tc(e,t,r){return t===void 0?e??{}:Zo(t,r,e||!0)}function Nn(e,t,r,n,i,o){let a=e._runtimeDataModel.models[t].fields.reduce((l,f)=>({...l,[f.name]:f}),{});return l=>{let f=Ne(e._errorFormat),g=ec(n,i),h=tc(l,o,g),v=r({dataPath:g,callsite:f})(h),S=rc(e,t);return new Proxy(v,{get(A,R){if(!S.includes(R))return A[R];let N=[a[R].type,r,R],B=[g,h];return Nn(e,...N,...B)},...Nr([...S,...Object.getOwnPropertyNames(v)])})}}function rc(e,t){return e._runtimeDataModel.models[t].fields.filter(r=>r.kind==="object").map(r=>r.name)}var nc=["findUnique","findUniqueOrThrow","findFirst","findFirstOrThrow","create","update","upsert","delete"],ic=["aggregate","count","groupBy"];function Fn(e,t){let r=e._extensions.getAllModelExtensions(t)??{},n=[oc(e,t),ac(e,t),$t(r),ee("name",()=>t),ee("$name",()=>t),ee("$parent",()=>e._appliedParent)];return Ee({},n)}function oc(e,t){let r=he(t),n=Object.keys(cr.ModelAction).concat("count");return{getKeys(){return n},getPropertyValue(i){let o=i,s=a=>l=>{let f=Ne(e._errorFormat);return e._createPrismaPromise(g=>{let h={args:l,dataPath:[],action:o,model:t,clientMethod:`${r}.${i}`,jsModelName:r,transaction:g,callsite:f};return e._request({...h,...a})})};return nc.includes(o)?Nn(e,t,s):sc(i)?Ko(e,i,s):s({})}}}function sc(e){return ic.includes(e)}function ac(e,t){return $e(ee("fields",()=>{let r=e._runtimeDataModel.models[t];return zo(t,r)}))}d();u();c();p();m();function Xo(e){return e.replace(/^./,t=>t.toUpperCase())}var _n=Symbol();function qt(e){let t=[lc(e),ee(_n,()=>e),ee("$parent",()=>e._appliedParent)],r=e._extensions.getAllClientExtensions();return r&&t.push($t(r)),Ee(e,t)}function lc(e){let t=Object.keys(e._runtimeDataModel.models),r=t.map(he),n=[...new Set(t.concat(r))];return $e({getKeys(){return n},getPropertyValue(i){let o=Xo(i);if(e._runtimeDataModel.models[o]!==void 0)return Fn(e,o);if(e._runtimeDataModel.models[i]!==void 0)return Fn(e,i)},getPropertyDescriptor(i){if(!r.includes(i))return{enumerable:!1}}})}function es(e){return e[_n]?e[_n]:e}function ts(e){if(typeof e=="function")return e(this);if(e.client?.__AccelerateEngine){let r=e.client.__AccelerateEngine;this._originalClient._engine=new r(this._originalClient._accelerateEngineConfig)}let t=Object.create(this._originalClient,{_extensions:{value:this._extensions.append(e)},_appliedParent:{value:this,configurable:!0},$use:{value:void 0},$on:{value:void 0}});return qt(t)}d();u();c();p();m();d();u();c();p();m();function rs({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 f=l.needs.filter(g=>n[g]);f.length>0&&a.push(ct(f))}else if(r){if(!r[l.name])continue;let f=l.needs.filter(g=>!r[g]);f.length>0&&a.push(ct(f))}uc(e,l.needs)&&s.push(cc(l,Ee(e,s)))}return s.length>0||a.length>0?Ee(e,[...s,...a]):e}function uc(e,t){return t.every(r=>ln(e,r))}function cc(e,t){return $e(ee(e.name,()=>e.compute(t)))}d();u();c();p();m();function Br({visitor:e,result:t,args:r,runtimeDataModel:n,modelName:i}){if(Array.isArray(t)){for(let s=0;s<t.length;s++)t[s]=Br({result:t[s],args:r,modelName:i,runtimeDataModel:n,visitor:e});return t}let o=e(t,i,r)??t;return r.include&&ns({includeOrSelect:r.include,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),r.select&&ns({includeOrSelect:r.select,result:o,parentModelName:i,runtimeDataModel:n,visitor:e}),o}function ns({includeOrSelect:e,result:t,parentModelName:r,runtimeDataModel:n,visitor:i}){for(let[o,s]of Object.entries(e)){if(!s||t[o]==null||ye(s))continue;let l=n.models[r].fields.find(g=>g.name===o);if(!l||l.kind!=="object"||!l.relationName)continue;let f=typeof s=="object"?s:{};t[o]=Br({visitor:i,result:t[o],args:f,modelName:l.type,runtimeDataModel:n})}}function is({result:e,modelName:t,args:r,extensions:n,runtimeDataModel:i,globalOmit:o}){return n.isEmpty()||e==null||typeof e!="object"||!i.models[t]?e:Br({result:e,args:r??{},modelName:t,runtimeDataModel:i,visitor:(a,l,f)=>{let g=he(l);return rs({result:a,modelName:g,select:f.select,omit:f.select?void 0:{...o?.[g],...f.omit},extensions:n})}})}d();u();c();p();m();d();u();c();p();m();function os(e){if(e instanceof le)return pc(e);if(Array.isArray(e)){let r=[e[0]];for(let n=1;n<e.length;n++)r[n]=Vt(e[n]);return r}let t={};for(let r in e)t[r]=Vt(e[r]);return t}function pc(e){return new le(e.strings,e.values)}function Vt(e){if(typeof e!="object"||e==null||e instanceof Te||at(e))return e;if(rt(e))return new ve(e.toFixed());if(tt(e))return new Date(+e);if(ArrayBuffer.isView(e))return e.slice(0);if(Array.isArray(e)){let t=e.length,r;for(r=Array(t);t--;)r[t]=Vt(e[t]);return r}if(typeof e=="object"){let t={};for(let r in e)r==="__proto__"?Object.defineProperty(t,r,{value:Vt(e[r]),configurable:!0,enumerable:!0,writable:!0}):t[r]=Vt(e[r]);return t}xe(e,"Unknown value")}function as(e,t,r,n=0){return e._createPrismaPromise(i=>{let o=t.customDataProxyFetch;return"transaction"in t&&i!==void 0&&(t.transaction?.kind==="batch"&&t.transaction.lock.then(),t.transaction=i),n===r.length?e._executeRequest(t):r[n]({model:t.model,operation:t.model?t.action:t.clientMethod,args:os(t.args??{}),__internalParams:t,query:(s,a=t)=>{let l=a.customDataProxyFetch;return a.customDataProxyFetch=ps(o,l),a.args=s,as(e,a,r,n+1)}})})}function ls(e,t){let{jsModelName:r,action:n,clientMethod:i}=t,o=r?n:i;if(e._extensions.isEmpty())return e._executeRequest(t);let s=e._extensions.getAllQueryCallbacks(r??"$none",o);return as(e,t,s)}function us(e){return t=>{let r={requests:t},n=t[0].extensions.getAllBatchQueryCallbacks();return n.length?cs(r,n,0,e):e(r)}}function cs(e,t,r,n){if(r===t.length)return n(e);let i=e.customDataProxyFetch,o=e.requests[0].transaction;return t[r]({args:{queries:e.requests.map(s=>({model:s.modelName,operation:s.action,args:s.args})),transaction:o?{isolationLevel:o.kind==="batch"?o.isolationLevel:void 0}:void 0},__internalParams:e,query(s,a=e){let l=a.customDataProxyFetch;return a.customDataProxyFetch=ps(i,l),cs(a,t,r+1,n)}})}var ss=e=>e;function ps(e=ss,t=ss){return r=>e(t(r))}d();u();c();p();m();var ms=Z("prisma:client"),ds={Vercel:"vercel","Netlify CI":"netlify"};function fs({postinstall:e,ciName:t,clientVersion:r}){if(ms("checkPlatformCaching:postinstall",e),ms("checkPlatformCaching:ciName",t),e===!0&&t&&t in ds){let n=`Prisma has detected that this project was built on ${t}, which caches dependencies. This leads to an outdated Prisma Client because Prisma's auto-generation isn't triggered. To fix this, make sure to run the \`prisma generate\` command during the build process.
|
|
7
7
|
|
|
8
8
|
Learn how: https://pris.ly/d/${ds[t]}-build`;throw console.error(n),new G(n,r)}}d();u();c();p();m();function gs(e,t){return e?e.datasources?e.datasources:e.datasourceUrl?{[t[0]]:{url:e.datasourceUrl}}:{}:{}}d();u();c();p();m();d();u();c();p();m();d();u();c();p();m();var mc="Cloudflare-Workers",dc="node";function hs(){return typeof Netlify=="object"?"netlify":typeof EdgeRuntime=="string"?"edge-light":globalThis.navigator?.userAgent===mc?"workerd":globalThis.Deno?"deno":globalThis.__lagon__?"lagon":globalThis.process?.release?.name===dc?"node":globalThis.Bun?"bun":globalThis.fastly?"fastly":"unknown"}var fc={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 Ln(){let e=hs();return{id:e,prettyName:fc[e]||e,isEdge:["workerd","deno","netlify","edge-light"].includes(e)}}d();u();c();p();m();d();u();c();p();m();d();u();c();p();m();function mt({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 Ln().id==="workerd"?new G(`error: Environment variable not found: ${s.fromEnvVar}.
|
|
@@ -17,7 +17,7 @@ Example:
|
|
|
17
17
|
await prisma.$executeRawUnsafe(\`ALTER USER prisma WITH PASSWORD '\${password}'\`)
|
|
18
18
|
|
|
19
19
|
More Information: https://pris.ly/d/execute-raw
|
|
20
|
-
`)}var Wn=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if(Lo(r))n=r.sql,i={values:ht(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:ht(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:ht(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:ht(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=As(r),i={values:ht(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?Ds(`prisma.${e}(${n}, ${i.values})`):Ds(`prisma.${e}(${n})`),{query:n,parameters:i}},Ms={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new le(t,r)}},Ns={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};d();u();c();p();m();function Hn(e){return function(r){let n,i=(o=e)=>{try{return o===void 0||o?.kind==="itx"?n??=Fs(r(o)):Fs(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 Fs(e){return typeof e.then=="function"?e:Promise.resolve(e)}d();u();c();p();m();var Ac={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(){},getActiveContext(){},runInChildSpan(e,t){return t()}},Kn=class{isEnabled(){return this.getGlobalTracingHelper().isEnabled()}getTraceParent(t){return this.getGlobalTracingHelper().getTraceParent(t)}dispatchEngineSpans(t){return this.getGlobalTracingHelper().dispatchEngineSpans(t)}getActiveContext(){return this.getGlobalTracingHelper().getActiveContext()}runInChildSpan(t,r){return this.getGlobalTracingHelper().runInChildSpan(t,r)}getGlobalTracingHelper(){return globalThis.PRISMA_INSTRUMENTATION?.helper??Ac}};function _s(){return new Kn}d();u();c();p();m();function Ls(e,t=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--e===0&&r(t()),i?.(n)}}}d();u();c();p();m();function Bs(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)}d();u();c();p();m();var Vr=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}};d();u();c();p();m();var $s=Le(Ki());d();u();c();p();m();function jr(e){return typeof e.batchRequestIdx=="number"}d();u();c();p();m();function Us(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(zn(e.query.arguments)),t.push(zn(e.query.selection)),t.join("")}function zn(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${zn(n)})`:r}).join(" ")})`}d();u();c();p();m();var Rc={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 Yn(e){return Rc[e]}d();u();c();p();m();var Jr=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,y.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 r=this.batches[t];delete this.batches[t],r.length===1?this.options.singleLoader(r[0].request).then(n=>{n instanceof Error?r[0].reject(n):r[0].resolve(n)}).catch(n=>{r[0].reject(n)}):(r.sort((n,i)=>this.options.batchOrder(n.request,i.request)),this.options.batchLoader(r.map(n=>n.request)).then(n=>{if(n instanceof Error)for(let i=0;i<r.length;i++)r[i].reject(n);else for(let i=0;i<r.length;i++){let o=n[i];o instanceof Error?r[i].reject(o):r[i].resolve(o)}}).catch(n=>{for(let i=0;i<r.length;i++)r[i].reject(n)}))}}get[Symbol.toStringTag](){return"DataLoader"}};d();u();c();p();m();function Ge(e,t){if(t===null)return t;switch(e){case"bigint":return BigInt(t);case"bytes":{let{buffer:r,byteOffset:n,byteLength:i}=w.Buffer.from(t,"base64");return new Uint8Array(r,n,i)}case"decimal":return new ve(t);case"datetime":case"date":return new Date(t);case"time":return new Date(`1970-01-01T${t}Z`);case"bigint-array":return t.map(r=>Ge("bigint",r));case"bytes-array":return t.map(r=>Ge("bytes",r));case"decimal-array":return t.map(r=>Ge("decimal",r));case"datetime-array":return t.map(r=>Ge("datetime",r));case"date-array":return t.map(r=>Ge("date",r));case"time-array":return t.map(r=>Ge("time",r));default:return t}}function Zn(e){let t=[],r=Sc(e);for(let n=0;n<e.rows.length;n++){let i=e.rows[n],o={...r};for(let s=0;s<i.length;s++)o[e.columns[s]]=Ge(e.types[s],i[s]);t.push(o)}return t}function Sc(e){let t={};for(let r=0;r<e.columns.length;r++)t[e.columns[r]]=null;return t}var Ic=Z("prisma:client:request_handler"),Gr=class{constructor(t,r){this.logEmitter=r,this.client=t,this.dataloader=new Jr({batchLoader:us(async({requests:n,customDataProxyFetch:i})=>{let{transaction:o,otelParentCtx:s}=n[0],a=n.map(h=>h.protocolQuery),l=this.client._tracingHelper.getTraceParent(s),f=n.some(h=>Yn(h.protocolQuery.action));return(await this.client._engine.requestBatch(a,{traceparent:l,transaction:Oc(o),containsWrite:f,customDataProxyFetch:i})).map((h,v)=>{if(h instanceof Error)return h;try{return this.mapQueryEngineResult(n[v],h)}catch(S){return S}})}),singleLoader:async n=>{let i=n.transaction?.kind==="itx"?qs(n.transaction):void 0,o=await this.client._engine.request(n.protocolQuery,{traceparent:this.client._tracingHelper.getTraceParent(),interactiveTransaction:i,isWrite:Yn(n.protocolQuery.action),customDataProxyFetch:n.customDataProxyFetch});return this.mapQueryEngineResult(n,o)},batchBy:n=>n.transaction?.id?`transaction-${n.transaction.id}`:Us(n.protocolQuery),batchOrder(n,i){return n.transaction?.kind==="batch"&&i.transaction?.kind==="batch"?n.transaction.index-i.transaction.index:0}})}async request(t){try{return await this.dataloader.request(t)}catch(r){let{clientMethod:n,callsite:i,transaction:o,args:s,modelName:a}=t;this.handleAndLogRequestError({error:r,clientMethod:n,callsite:i,transaction:o,args:s,modelName:a,globalOmit:t.globalOmit})}}mapQueryEngineResult({dataPath:t,unpacker:r},n){let i=n?.data,o=this.unpack(i,t,r);return y.env.PRISMA_CLIENT_GET_TIME?{data:o}:o}handleAndLogRequestError(t){try{this.handleRequestError(t)}catch(r){throw this.logEmitter&&this.logEmitter.emit("error",{message:r.message,target:t.clientMethod,timestamp:new Date}),r}}handleRequestError({error:t,clientMethod:r,callsite:n,transaction:i,args:o,modelName:s,globalOmit:a}){if(Ic(t),kc(t,i))throw t;if(t instanceof oe&&Dc(t)){let f=Vs(t.meta);Or({args:o,errors:[f],callsite:n,errorFormat:this.client._errorFormat,originalMethod:r,clientVersion:this.client._clientVersion,globalOmit:a})}let l=t.message;if(n&&(l=xr({callsite:n,originalMethod:r,isPanic:t.isPanic,showColors:this.client._errorFormat==="pretty",message:l})),l=this.sanitizeMessage(l),t.code){let f=s?{modelName:s,...t.meta}:t.meta;throw new oe(l,{code:t.code,clientVersion:this.client._clientVersion,meta:f,batchRequestIdx:t.batchRequestIdx})}else{if(t.isPanic)throw new Se(l,this.client._clientVersion);if(t instanceof se)throw new se(l,{clientVersion:this.client._clientVersion,batchRequestIdx:t.batchRequestIdx});if(t instanceof G)throw new G(l,this.client._clientVersion);if(t instanceof Se)throw new Se(l,this.client._clientVersion)}throw t.clientVersion=this.client._clientVersion,t}sanitizeMessage(t){return this.client._errorFormat&&this.client._errorFormat!=="pretty"?(0,$s.default)(t):t}unpack(t,r,n){if(!t||(t.data&&(t=t.data),!t))return t;let i=Object.keys(t)[0],o=Object.values(t)[0],s=r.filter(f=>f!=="select"&&f!=="include"),a=Mn(o,s),l=i==="queryRaw"?Zn(a):At(a);return n?n(l):l}get[Symbol.toStringTag](){return"RequestHandler"}};function Oc(e){if(e){if(e.kind==="batch")return{kind:"batch",options:{isolationLevel:e.isolationLevel}};if(e.kind==="itx")return{kind:"itx",options:qs(e)};xe(e,"Unknown transaction kind")}}function qs(e){return{id:e.id,payload:e.payload}}function kc(e,t){return jr(e)&&t?.kind==="batch"&&e.batchRequestIdx!==t.index}function Dc(e){return e.code==="P2009"||e.code==="P2012"}function Vs(e){if(e.kind==="Union")return{kind:"Union",errors:e.errors.map(Vs)};if(Array.isArray(e.selectionPath)){let[,...t]=e.selectionPath;return{...e,selectionPath:t}}return e}d();u();c();p();m();var js="6.2.0-dev.
|
|
20
|
+
`)}var Wn=({clientMethod:e,activeProvider:t})=>r=>{let n="",i;if(Lo(r))n=r.sql,i={values:ht(r.values),__prismaRawParameters__:!0};else if(Array.isArray(r)){let[o,...s]=r;n=o,i={values:ht(s||[]),__prismaRawParameters__:!0}}else switch(t){case"sqlite":case"mysql":{n=r.sql,i={values:ht(r.values),__prismaRawParameters__:!0};break}case"cockroachdb":case"postgresql":case"postgres":{n=r.text,i={values:ht(r.values),__prismaRawParameters__:!0};break}case"sqlserver":{n=As(r),i={values:ht(r.values),__prismaRawParameters__:!0};break}default:throw new Error(`The ${t} provider does not support ${e}`)}return i?.values?Ds(`prisma.${e}(${n}, ${i.values})`):Ds(`prisma.${e}(${n})`),{query:n,parameters:i}},Ms={requestArgsToMiddlewareArgs(e){return[e.strings,...e.values]},middlewareArgsToRequestArgs(e){let[t,...r]=e;return new le(t,r)}},Ns={requestArgsToMiddlewareArgs(e){return[e]},middlewareArgsToRequestArgs(e){return e[0]}};d();u();c();p();m();function Hn(e){return function(r){let n,i=(o=e)=>{try{return o===void 0||o?.kind==="itx"?n??=Fs(r(o)):Fs(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 Fs(e){return typeof e.then=="function"?e:Promise.resolve(e)}d();u();c();p();m();var Ac={isEnabled(){return!1},getTraceParent(){return"00-10-10-00"},dispatchEngineSpans(){},getActiveContext(){},runInChildSpan(e,t){return t()}},Kn=class{isEnabled(){return this.getGlobalTracingHelper().isEnabled()}getTraceParent(t){return this.getGlobalTracingHelper().getTraceParent(t)}dispatchEngineSpans(t){return this.getGlobalTracingHelper().dispatchEngineSpans(t)}getActiveContext(){return this.getGlobalTracingHelper().getActiveContext()}runInChildSpan(t,r){return this.getGlobalTracingHelper().runInChildSpan(t,r)}getGlobalTracingHelper(){return globalThis.PRISMA_INSTRUMENTATION?.helper??Ac}};function _s(){return new Kn}d();u();c();p();m();function Ls(e,t=()=>{}){let r,n=new Promise(i=>r=i);return{then(i){return--e===0&&r(t()),i?.(n)}}}d();u();c();p();m();function Bs(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)}d();u();c();p();m();var Vr=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}};d();u();c();p();m();var $s=Le(Ki());d();u();c();p();m();function jr(e){return typeof e.batchRequestIdx=="number"}d();u();c();p();m();function Us(e){if(e.action!=="findUnique"&&e.action!=="findUniqueOrThrow")return;let t=[];return e.modelName&&t.push(e.modelName),e.query.arguments&&t.push(zn(e.query.arguments)),t.push(zn(e.query.selection)),t.join("")}function zn(e){return`(${Object.keys(e).sort().map(r=>{let n=e[r];return typeof n=="object"&&n!==null?`(${r} ${zn(n)})`:r}).join(" ")})`}d();u();c();p();m();var Rc={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 Yn(e){return Rc[e]}d();u();c();p();m();var Jr=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,y.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 r=this.batches[t];delete this.batches[t],r.length===1?this.options.singleLoader(r[0].request).then(n=>{n instanceof Error?r[0].reject(n):r[0].resolve(n)}).catch(n=>{r[0].reject(n)}):(r.sort((n,i)=>this.options.batchOrder(n.request,i.request)),this.options.batchLoader(r.map(n=>n.request)).then(n=>{if(n instanceof Error)for(let i=0;i<r.length;i++)r[i].reject(n);else for(let i=0;i<r.length;i++){let o=n[i];o instanceof Error?r[i].reject(o):r[i].resolve(o)}}).catch(n=>{for(let i=0;i<r.length;i++)r[i].reject(n)}))}}get[Symbol.toStringTag](){return"DataLoader"}};d();u();c();p();m();function Ge(e,t){if(t===null)return t;switch(e){case"bigint":return BigInt(t);case"bytes":{let{buffer:r,byteOffset:n,byteLength:i}=w.Buffer.from(t,"base64");return new Uint8Array(r,n,i)}case"decimal":return new ve(t);case"datetime":case"date":return new Date(t);case"time":return new Date(`1970-01-01T${t}Z`);case"bigint-array":return t.map(r=>Ge("bigint",r));case"bytes-array":return t.map(r=>Ge("bytes",r));case"decimal-array":return t.map(r=>Ge("decimal",r));case"datetime-array":return t.map(r=>Ge("datetime",r));case"date-array":return t.map(r=>Ge("date",r));case"time-array":return t.map(r=>Ge("time",r));default:return t}}function Zn(e){let t=[],r=Sc(e);for(let n=0;n<e.rows.length;n++){let i=e.rows[n],o={...r};for(let s=0;s<i.length;s++)o[e.columns[s]]=Ge(e.types[s],i[s]);t.push(o)}return t}function Sc(e){let t={};for(let r=0;r<e.columns.length;r++)t[e.columns[r]]=null;return t}var Ic=Z("prisma:client:request_handler"),Gr=class{constructor(t,r){this.logEmitter=r,this.client=t,this.dataloader=new Jr({batchLoader:us(async({requests:n,customDataProxyFetch:i})=>{let{transaction:o,otelParentCtx:s}=n[0],a=n.map(h=>h.protocolQuery),l=this.client._tracingHelper.getTraceParent(s),f=n.some(h=>Yn(h.protocolQuery.action));return(await this.client._engine.requestBatch(a,{traceparent:l,transaction:Oc(o),containsWrite:f,customDataProxyFetch:i})).map((h,v)=>{if(h instanceof Error)return h;try{return this.mapQueryEngineResult(n[v],h)}catch(S){return S}})}),singleLoader:async n=>{let i=n.transaction?.kind==="itx"?qs(n.transaction):void 0,o=await this.client._engine.request(n.protocolQuery,{traceparent:this.client._tracingHelper.getTraceParent(),interactiveTransaction:i,isWrite:Yn(n.protocolQuery.action),customDataProxyFetch:n.customDataProxyFetch});return this.mapQueryEngineResult(n,o)},batchBy:n=>n.transaction?.id?`transaction-${n.transaction.id}`:Us(n.protocolQuery),batchOrder(n,i){return n.transaction?.kind==="batch"&&i.transaction?.kind==="batch"?n.transaction.index-i.transaction.index:0}})}async request(t){try{return await this.dataloader.request(t)}catch(r){let{clientMethod:n,callsite:i,transaction:o,args:s,modelName:a}=t;this.handleAndLogRequestError({error:r,clientMethod:n,callsite:i,transaction:o,args:s,modelName:a,globalOmit:t.globalOmit})}}mapQueryEngineResult({dataPath:t,unpacker:r},n){let i=n?.data,o=this.unpack(i,t,r);return y.env.PRISMA_CLIENT_GET_TIME?{data:o}:o}handleAndLogRequestError(t){try{this.handleRequestError(t)}catch(r){throw this.logEmitter&&this.logEmitter.emit("error",{message:r.message,target:t.clientMethod,timestamp:new Date}),r}}handleRequestError({error:t,clientMethod:r,callsite:n,transaction:i,args:o,modelName:s,globalOmit:a}){if(Ic(t),kc(t,i))throw t;if(t instanceof oe&&Dc(t)){let f=Vs(t.meta);Or({args:o,errors:[f],callsite:n,errorFormat:this.client._errorFormat,originalMethod:r,clientVersion:this.client._clientVersion,globalOmit:a})}let l=t.message;if(n&&(l=xr({callsite:n,originalMethod:r,isPanic:t.isPanic,showColors:this.client._errorFormat==="pretty",message:l})),l=this.sanitizeMessage(l),t.code){let f=s?{modelName:s,...t.meta}:t.meta;throw new oe(l,{code:t.code,clientVersion:this.client._clientVersion,meta:f,batchRequestIdx:t.batchRequestIdx})}else{if(t.isPanic)throw new Se(l,this.client._clientVersion);if(t instanceof se)throw new se(l,{clientVersion:this.client._clientVersion,batchRequestIdx:t.batchRequestIdx});if(t instanceof G)throw new G(l,this.client._clientVersion);if(t instanceof Se)throw new Se(l,this.client._clientVersion)}throw t.clientVersion=this.client._clientVersion,t}sanitizeMessage(t){return this.client._errorFormat&&this.client._errorFormat!=="pretty"?(0,$s.default)(t):t}unpack(t,r,n){if(!t||(t.data&&(t=t.data),!t))return t;let i=Object.keys(t)[0],o=Object.values(t)[0],s=r.filter(f=>f!=="select"&&f!=="include"),a=Mn(o,s),l=i==="queryRaw"?Zn(a):At(a);return n?n(l):l}get[Symbol.toStringTag](){return"RequestHandler"}};function Oc(e){if(e){if(e.kind==="batch")return{kind:"batch",options:{isolationLevel:e.isolationLevel}};if(e.kind==="itx")return{kind:"itx",options:qs(e)};xe(e,"Unknown transaction kind")}}function qs(e){return{id:e.id,payload:e.payload}}function kc(e,t){return jr(e)&&t?.kind==="batch"&&e.batchRequestIdx!==t.index}function Dc(e){return e.code==="P2009"||e.code==="P2012"}function Vs(e){if(e.kind==="Union")return{kind:"Union",errors:e.errors.map(Vs)};if(Array.isArray(e.selectionPath)){let[,...t]=e.selectionPath;return{...e,selectionPath:t}}return e}d();u();c();p();m();var js="6.2.0-dev.8";var Js=js;d();u();c();p();m();var Ks=Le(yn());d();u();c();p();m();var U=class extends Error{constructor(t){super(t+`
|
|
21
21
|
Read more at https://pris.ly/d/client-constructor`),this.name="PrismaClientConstructorValidationError"}get[Symbol.toStringTag](){return"PrismaClientConstructorValidationError"}};_(U,"PrismaClientConstructorValidationError");var Gs=["datasources","datasourceUrl","errorFormat","adapter","log","transactionOptions","omit","__internal"],Qs=["pretty","colorless","minimal"],Ws=["info","query","warn","error"],Nc={datasources:(e,{datasourceNames:t})=>{if(e){if(typeof e!="object"||Array.isArray(e))throw new U(`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=yt(r,t)||` Available datasources: ${t.join(", ")}`;throw new U(`Unknown datasource ${r} provided to PrismaClient constructor.${i}`)}if(typeof n!="object"||Array.isArray(n))throw new U(`Invalid value ${JSON.stringify(e)} for datasource "${r}" provided to PrismaClient constructor.
|
|
22
22
|
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 U(`Invalid value ${JSON.stringify(e)} for datasource "${r}" provided to PrismaClient constructor.
|
|
23
23
|
It should have this form: { url: "CONNECTION_STRING" }`);if(typeof o!="string")throw new U(`Invalid value ${JSON.stringify(o)} for datasource "${r}" provided to PrismaClient constructor.
|