@prisma/client-generator-ts 6.16.0-dev.36 → 6.16.0-dev.37

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/dist/index.mjs CHANGED
@@ -1850,7 +1850,7 @@ var require_ensure = __commonJS({
1850
1850
  var require_utils2 = __commonJS({
1851
1851
  "../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js"(exports, module) {
1852
1852
  "use strict";
1853
- function stringify14(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
1853
+ function stringify16(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
1854
1854
  const EOF = finalEOL ? EOL : "";
1855
1855
  const str = JSON.stringify(obj, replacer, spaces);
1856
1856
  return str.replace(/\n/g, EOL) + EOF;
@@ -1859,7 +1859,7 @@ var require_utils2 = __commonJS({
1859
1859
  if (Buffer.isBuffer(content)) content = content.toString("utf8");
1860
1860
  return content.replace(/^\uFEFF/, "");
1861
1861
  }
1862
- module.exports = { stringify: stringify14, stripBom };
1862
+ module.exports = { stringify: stringify16, stripBom };
1863
1863
  }
1864
1864
  });
1865
1865
 
@@ -1874,7 +1874,7 @@ var require_jsonfile = __commonJS({
1874
1874
  _fs = __require("fs");
1875
1875
  }
1876
1876
  var universalify = require_universalify();
1877
- var { stringify: stringify14, stripBom } = require_utils2();
1877
+ var { stringify: stringify16, stripBom } = require_utils2();
1878
1878
  async function _readFile(file4, options = {}) {
1879
1879
  if (typeof options === "string") {
1880
1880
  options = { encoding: options };
@@ -1918,13 +1918,13 @@ var require_jsonfile = __commonJS({
1918
1918
  }
1919
1919
  async function _writeFile(file4, obj, options = {}) {
1920
1920
  const fs3 = options.fs || _fs;
1921
- const str = stringify14(obj, options);
1921
+ const str = stringify16(obj, options);
1922
1922
  await universalify.fromCallback(fs3.writeFile)(file4, str, options);
1923
1923
  }
1924
1924
  var writeFile = universalify.fromPromise(_writeFile);
1925
1925
  function writeFileSync(file4, obj, options = {}) {
1926
1926
  const fs3 = options.fs || _fs;
1927
- const str = stringify14(obj, options);
1927
+ const str = stringify16(obj, options);
1928
1928
  return fs3.writeFileSync(file4, str, options);
1929
1929
  }
1930
1930
  var jsonfile = {
@@ -1986,10 +1986,10 @@ var require_output_file = __commonJS({
1986
1986
  var require_output_json = __commonJS({
1987
1987
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/output-json.js"(exports, module) {
1988
1988
  "use strict";
1989
- var { stringify: stringify14 } = require_utils2();
1989
+ var { stringify: stringify16 } = require_utils2();
1990
1990
  var { outputFile } = require_output_file();
1991
1991
  async function outputJson(file4, data, options = {}) {
1992
- const str = stringify14(data, options);
1992
+ const str = stringify16(data, options);
1993
1993
  await outputFile(file4, str, options);
1994
1994
  }
1995
1995
  module.exports = outputJson;
@@ -2000,10 +2000,10 @@ var require_output_json = __commonJS({
2000
2000
  var require_output_json_sync = __commonJS({
2001
2001
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/output-json-sync.js"(exports, module) {
2002
2002
  "use strict";
2003
- var { stringify: stringify14 } = require_utils2();
2003
+ var { stringify: stringify16 } = require_utils2();
2004
2004
  var { outputFileSync } = require_output_file();
2005
2005
  function outputJsonSync(file4, data, options) {
2006
- const str = stringify14(data, options);
2006
+ const str = stringify16(data, options);
2007
2007
  outputFileSync(file4, str, options);
2008
2008
  }
2009
2009
  module.exports = outputJsonSync;
@@ -2219,7 +2219,7 @@ import { overwriteFile } from "@prisma/fetch-engine";
2219
2219
  import {
2220
2220
  assertNever as assertNever3,
2221
2221
  ClientEngineType as ClientEngineType3,
2222
- getClientEngineType as getClientEngineType3,
2222
+ getClientEngineType as getClientEngineType4,
2223
2223
  pathToPosix as pathToPosix3,
2224
2224
  setClassName
2225
2225
  } from "@prisma/internals";
@@ -2894,11 +2894,51 @@ var GenericArgsInfo = class {
2894
2894
  }
2895
2895
  };
2896
2896
 
2897
+ // src/TSClient/file-generators/BrowserFile.ts
2898
+ import { getClientEngineType } from "@prisma/internals";
2899
+
2900
+ // src/TSClient/ModelExports.ts
2901
+ import * as ts3 from "@prisma/ts-builders";
2902
+ function modelExports(context) {
2903
+ return Object.values(context.dmmf.typeAndModelMap).filter((model) => context.dmmf.outputTypeMap.model[model.name]).map((model) => {
2904
+ const docLines = model.documentation ?? "";
2905
+ const modelLine = `Model ${model.name}
2906
+ `;
2907
+ const docs = `${modelLine}${docLines}`;
2908
+ const suffix = "Model";
2909
+ const modelTypeExport = ts3.moduleExport(ts3.typeDeclaration(model.name, ts3.namedType(`Prisma.${model.name}${suffix}`))).setDocComment(ts3.docComment(docs));
2910
+ return ts3.stringify(modelTypeExport);
2911
+ });
2912
+ }
2913
+
2914
+ // src/TSClient/file-generators/BrowserFile.ts
2915
+ var jsDocHeader = `/*
2916
+ * This file should be your main import to use Prisma-related types and utilities in a browser.
2917
+ * Use it to get access to models, enums, and input types.
2918
+ *
2919
+ * This file does not contain a \`PrismaClient\` class, nor several other helpers that are intended as server-side only.
2920
+ * See \`client.ts\` for the standard, server-side entry point.
2921
+ *
2922
+ * \u{1F7E2} You can import this file directly.
2923
+ */
2924
+ `;
2925
+ function createBrowserFile(context, options) {
2926
+ const clientEngineType = getClientEngineType(options.generator);
2927
+ options.generator.config.engineType = clientEngineType;
2928
+ return `${jsDocHeader}
2929
+ import * as Prisma from '${context.importFileName("./internal/prismaNamespaceBrowser")}'
2930
+ export { Prisma }
2931
+ export * as $Enums from '${context.importFileName("./enums")}'
2932
+ export * from '${context.importFileName("./enums")}';
2933
+ ${modelExports(context).join("\n")}
2934
+ `;
2935
+ }
2936
+
2897
2937
  // src/TSClient/file-generators/ClassFile.ts
2898
2938
  import crypto from "node:crypto";
2899
2939
  import path2 from "node:path";
2900
- import { getClientEngineType, pathToPosix } from "@prisma/internals";
2901
- import * as ts5 from "@prisma/ts-builders";
2940
+ import { getClientEngineType as getClientEngineType2, pathToPosix } from "@prisma/internals";
2941
+ import * as ts6 from "@prisma/ts-builders";
2902
2942
  import ciInfo from "ci-info";
2903
2943
 
2904
2944
  // src/utils/buildInjectableEdgeEnv.ts
@@ -3538,22 +3578,22 @@ function buildWasmFileMap({ activeProvider, runtimeName }) {
3538
3578
 
3539
3579
  // src/TSClient/PrismaClient.ts
3540
3580
  import { capitalize as capitalize7, uncapitalize as uncapitalize4 } from "@prisma/client-common";
3541
- import * as ts4 from "@prisma/ts-builders";
3581
+ import * as ts5 from "@prisma/ts-builders";
3542
3582
  import indent3 from "indent-string";
3543
3583
 
3544
3584
  // src/utils/runtimeImport.ts
3545
- import * as ts3 from "@prisma/ts-builders";
3585
+ import * as ts4 from "@prisma/ts-builders";
3546
3586
  function runtimeImport(name) {
3547
3587
  return name;
3548
3588
  }
3549
3589
  function runtimeImportedType(name) {
3550
- return ts3.namedType(`runtime.${name}`);
3590
+ return ts4.namedType(`runtime.${name}`);
3551
3591
  }
3552
3592
 
3553
3593
  // src/TSClient/utils/type-builders.ts
3554
- import { NamedType, namedType as namedType4 } from "@prisma/ts-builders";
3594
+ import { NamedType, namedType as namedType5 } from "@prisma/ts-builders";
3555
3595
  function omit(type, keyType) {
3556
- return namedType4("Omit").addGenericArgument(type).addGenericArgument(keyType);
3596
+ return namedType5("Omit").addGenericArgument(type).addGenericArgument(keyType);
3557
3597
  }
3558
3598
  function promise(resultType) {
3559
3599
  return new NamedType("runtime.Types.Utils.JsPromise").addGenericArgument(resultType);
@@ -3567,14 +3607,14 @@ function optional(innerType) {
3567
3607
 
3568
3608
  // src/TSClient/PrismaClient.ts
3569
3609
  function extendsPropertyDefinition() {
3570
- const extendsDefinition = ts4.namedType("runtime.Types.Extensions.ExtendsHook").addGenericArgument(ts4.stringLiteral("extends")).addGenericArgument(ts4.namedType("Prisma.TypeMapCb").addGenericArgument(ts4.namedType("OmitOpts"))).addGenericArgument(ts4.namedType("ExtArgs")).addGenericArgument(
3571
- ts4.namedType("runtime.Types.Utils.Call").addGenericArgument(ts4.namedType("Prisma.TypeMapCb").addGenericArgument(ts4.namedType("OmitOpts"))).addGenericArgument(ts4.objectType().add(ts4.property("extArgs", ts4.namedType("ExtArgs"))))
3610
+ const extendsDefinition = ts5.namedType("runtime.Types.Extensions.ExtendsHook").addGenericArgument(ts5.stringLiteral("extends")).addGenericArgument(ts5.namedType("Prisma.TypeMapCb").addGenericArgument(ts5.namedType("OmitOpts"))).addGenericArgument(ts5.namedType("ExtArgs")).addGenericArgument(
3611
+ ts5.namedType("runtime.Types.Utils.Call").addGenericArgument(ts5.namedType("Prisma.TypeMapCb").addGenericArgument(ts5.namedType("OmitOpts"))).addGenericArgument(ts5.objectType().add(ts5.property("extArgs", ts5.namedType("ExtArgs"))))
3572
3612
  );
3573
- return ts4.stringify(ts4.property("$extends", extendsDefinition), { indentLevel: 1 });
3613
+ return ts5.stringify(ts5.property("$extends", extendsDefinition), { indentLevel: 1 });
3574
3614
  }
3575
3615
  function batchingTransactionDefinition(context) {
3576
- const method3 = ts4.method("$transaction").setDocComment(
3577
- ts4.docComment`
3616
+ const method3 = ts5.method("$transaction").setDocComment(
3617
+ ts5.docComment`
3578
3618
  Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.
3579
3619
  @example
3580
3620
  \`\`\`
@@ -3587,25 +3627,25 @@ function batchingTransactionDefinition(context) {
3587
3627
 
3588
3628
  Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).
3589
3629
  `
3590
- ).addGenericParameter(ts4.genericParameter("P").extends(ts4.array(prismaPromise(ts4.anyType)))).addParameter(ts4.parameter("arg", ts4.arraySpread(ts4.namedType("P")))).setReturnType(promise(ts4.namedType("runtime.Types.Utils.UnwrapTuple").addGenericArgument(ts4.namedType("P"))));
3630
+ ).addGenericParameter(ts5.genericParameter("P").extends(ts5.array(prismaPromise(ts5.anyType)))).addParameter(ts5.parameter("arg", ts5.arraySpread(ts5.namedType("P")))).setReturnType(promise(ts5.namedType("runtime.Types.Utils.UnwrapTuple").addGenericArgument(ts5.namedType("P"))));
3591
3631
  if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
3592
- const options = ts4.objectType().formatInline().add(ts4.property("isolationLevel", ts4.namedType("Prisma.TransactionIsolationLevel")).optional());
3593
- method3.addParameter(ts4.parameter("options", options).optional());
3632
+ const options = ts5.objectType().formatInline().add(ts5.property("isolationLevel", ts5.namedType("Prisma.TransactionIsolationLevel")).optional());
3633
+ method3.addParameter(ts5.parameter("options", options).optional());
3594
3634
  }
3595
- return ts4.stringify(method3, { indentLevel: 1, newLine: "leading" });
3635
+ return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
3596
3636
  }
3597
3637
  function interactiveTransactionDefinition(context) {
3598
- const options = ts4.objectType().formatInline().add(ts4.property("maxWait", ts4.numberType).optional()).add(ts4.property("timeout", ts4.numberType).optional());
3638
+ const options = ts5.objectType().formatInline().add(ts5.property("maxWait", ts5.numberType).optional()).add(ts5.property("timeout", ts5.numberType).optional());
3599
3639
  if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
3600
- const isolationLevel = ts4.property("isolationLevel", ts4.namedType("Prisma.TransactionIsolationLevel")).optional();
3640
+ const isolationLevel = ts5.property("isolationLevel", ts5.namedType("Prisma.TransactionIsolationLevel")).optional();
3601
3641
  options.add(isolationLevel);
3602
3642
  }
3603
- const returnType = promise(ts4.namedType("R"));
3604
- const callbackType = ts4.functionType().addParameter(
3605
- ts4.parameter("prisma", omit(ts4.namedType("PrismaClient"), ts4.namedType("runtime.ITXClientDenyList")))
3643
+ const returnType = promise(ts5.namedType("R"));
3644
+ const callbackType = ts5.functionType().addParameter(
3645
+ ts5.parameter("prisma", omit(ts5.namedType("PrismaClient"), ts5.namedType("runtime.ITXClientDenyList")))
3606
3646
  ).setReturnType(returnType);
3607
- const method3 = ts4.method("$transaction").addGenericParameter(ts4.genericParameter("R")).addParameter(ts4.parameter("fn", callbackType)).addParameter(ts4.parameter("options", options).optional()).setReturnType(returnType);
3608
- return ts4.stringify(method3, { indentLevel: 1, newLine: "leading" });
3647
+ const method3 = ts5.method("$transaction").addGenericParameter(ts5.genericParameter("R")).addParameter(ts5.parameter("fn", callbackType)).addParameter(ts5.parameter("options", options).optional()).setReturnType(returnType);
3648
+ return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
3609
3649
  }
3610
3650
  function queryRawDefinition(context) {
3611
3651
  if (!context.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
@@ -3670,9 +3710,9 @@ function queryRawTypedDefinition(context) {
3670
3710
  if (!context.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
3671
3711
  return "";
3672
3712
  }
3673
- const param = ts4.genericParameter("T");
3674
- const method3 = ts4.method("$queryRawTyped").setDocComment(
3675
- ts4.docComment`
3713
+ const param = ts5.genericParameter("T");
3714
+ const method3 = ts5.method("$queryRawTyped").setDocComment(
3715
+ ts5.docComment`
3676
3716
  Executes a typed SQL query and returns a typed result
3677
3717
  @example
3678
3718
  \`\`\`
@@ -3682,19 +3722,19 @@ function queryRawTypedDefinition(context) {
3682
3722
  \`\`\`
3683
3723
  `
3684
3724
  ).addGenericParameter(param).addParameter(
3685
- ts4.parameter(
3725
+ ts5.parameter(
3686
3726
  "typedSql",
3687
- runtimeImportedType("TypedSql").addGenericArgument(ts4.array(ts4.unknownType)).addGenericArgument(param.toArgument())
3727
+ runtimeImportedType("TypedSql").addGenericArgument(ts5.array(ts5.unknownType)).addGenericArgument(param.toArgument())
3688
3728
  )
3689
- ).setReturnType(prismaPromise(ts4.array(param.toArgument())));
3690
- return ts4.stringify(method3, { indentLevel: 1, newLine: "leading" });
3729
+ ).setReturnType(prismaPromise(ts5.array(param.toArgument())));
3730
+ return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
3691
3731
  }
3692
3732
  function metricDefinition(context) {
3693
3733
  if (!context.isPreviewFeatureOn("metrics")) {
3694
3734
  return "";
3695
3735
  }
3696
- const property13 = ts4.property("$metrics", ts4.namedType(`runtime.${runtimeImport("MetricsClient")}`)).setDocComment(
3697
- ts4.docComment`
3736
+ const property13 = ts5.property("$metrics", ts5.namedType(`runtime.${runtimeImport("MetricsClient")}`)).setDocComment(
3737
+ ts5.docComment`
3698
3738
  Gives access to the client metrics in json or prometheus format.
3699
3739
 
3700
3740
  @example
@@ -3705,13 +3745,13 @@ function metricDefinition(context) {
3705
3745
  \`\`\`
3706
3746
  `
3707
3747
  ).readonly();
3708
- return ts4.stringify(property13, { indentLevel: 1, newLine: "leading" });
3748
+ return ts5.stringify(property13, { indentLevel: 1, newLine: "leading" });
3709
3749
  }
3710
3750
  function runCommandRawDefinition(context) {
3711
3751
  if (!context.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
3712
3752
  return "";
3713
3753
  }
3714
- const method3 = ts4.method("$runCommandRaw").addParameter(ts4.parameter("command", ts4.namedType("Prisma.InputJsonObject"))).setReturnType(prismaPromise(ts4.namedType("Prisma.JsonObject"))).setDocComment(ts4.docComment`
3754
+ const method3 = ts5.method("$runCommandRaw").addParameter(ts5.parameter("command", ts5.namedType("Prisma.InputJsonObject"))).setReturnType(prismaPromise(ts5.namedType("Prisma.JsonObject"))).setDocComment(ts5.docComment`
3715
3755
  Executes a raw MongoDB command and returns the result of it.
3716
3756
  @example
3717
3757
  \`\`\`
@@ -3724,7 +3764,7 @@ function runCommandRawDefinition(context) {
3724
3764
 
3725
3765
  Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
3726
3766
  `);
3727
- return ts4.stringify(method3, { indentLevel: 1, newLine: "leading" });
3767
+ return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
3728
3768
  }
3729
3769
  function eventRegistrationMethodDeclaration(runtimeName) {
3730
3770
  if (runtimeName === "binary") {
@@ -3743,7 +3783,7 @@ function getPrismaClientClassDocComment({ dmmf }) {
3743
3783
  plural: "users"
3744
3784
  };
3745
3785
  }
3746
- return ts4.docComment`
3786
+ return ts5.docComment`
3747
3787
  ## Prisma Client
3748
3788
 
3749
3789
  Type-safe database client for TypeScript
@@ -3763,7 +3803,7 @@ var PrismaClientClass = class {
3763
3803
  this.runtimeName = runtimeName;
3764
3804
  }
3765
3805
  get jsDoc() {
3766
- return ts4.stringify(getPrismaClientClassDocComment(this.context));
3806
+ return ts5.stringify(getPrismaClientClassDocComment(this.context));
3767
3807
  }
3768
3808
  toTS() {
3769
3809
  const { dmmf } = this.context;
@@ -3837,15 +3877,15 @@ get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
3837
3877
  if (this.runtimeName !== "react-native") {
3838
3878
  return null;
3839
3879
  }
3840
- const method3 = ts4.method("$applyPendingMigrations").setReturnType(promise(ts4.voidType)).setDocComment(
3841
- ts4.docComment`Tries to apply pending migrations one by one. If a migration fails to apply, the function will stop and throw an error. You are responsible for informing the user and possibly blocking the app as we cannot guarantee the state of the database.`
3880
+ const method3 = ts5.method("$applyPendingMigrations").setReturnType(promise(ts5.voidType)).setDocComment(
3881
+ ts5.docComment`Tries to apply pending migrations one by one. If a migration fails to apply, the function will stop and throw an error. You are responsible for informing the user and possibly blocking the app as we cannot guarantee the state of the database.`
3842
3882
  );
3843
- return ts4.stringify(method3, { indentLevel: 1, newLine: "leading" });
3883
+ return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
3844
3884
  }
3845
3885
  };
3846
3886
 
3847
3887
  // src/TSClient/file-generators/ClassFile.ts
3848
- var jsDocHeader = `/*
3888
+ var jsDocHeader2 = `/*
3849
3889
  * WARNING: This is an internal file that is subject to change!
3850
3890
  *
3851
3891
  * \u{1F6D1} Under no circumstances should you import this file directly! \u{1F6D1}
@@ -3855,12 +3895,12 @@ var jsDocHeader = `/*
3855
3895
  `;
3856
3896
  function createClassFile(context, options) {
3857
3897
  const imports = [
3858
- ts5.moduleImport(context.runtimeImport).asNamespace("runtime"),
3859
- ts5.moduleImport(context.importFileName(`./prismaNamespace`)).asNamespace("Prisma").typeOnly()
3898
+ ts6.moduleImport(context.runtimeImport).asNamespace("runtime"),
3899
+ ts6.moduleImport(context.importFileName(`./prismaNamespace`)).asNamespace("Prisma").typeOnly()
3860
3900
  ];
3861
- const stringifiedImports = imports.map((i) => ts5.stringify(i));
3901
+ const stringifiedImports = imports.map((i) => ts6.stringify(i));
3862
3902
  const prismaClientClass = new PrismaClientClass(context, options.runtimeName);
3863
- return `${jsDocHeader}
3903
+ return `${jsDocHeader2}
3864
3904
  ${stringifiedImports.join("\n")}
3865
3905
 
3866
3906
  ${clientConfig(context, options)}
@@ -3887,7 +3927,7 @@ function clientConfig(context, options) {
3887
3927
  activeProvider,
3888
3928
  moduleFormat
3889
3929
  } = options;
3890
- const clientEngineType = getClientEngineType(generator);
3930
+ const clientEngineType = getClientEngineType2(generator);
3891
3931
  generator.config.engineType = clientEngineType;
3892
3932
  const inlineSchemaHash = crypto.createHash("sha256").update(Buffer.from(inlineSchema, "utf8").toString("base64")).digest("hex");
3893
3933
  const datasourceFilePath = datasources[0].sourceFilePath;
@@ -3919,8 +3959,8 @@ ${buildDebugInitialization(edge)}
3919
3959
 
3920
3960
  // src/TSClient/file-generators/ClientFile.ts
3921
3961
  import path4 from "node:path";
3922
- import { ClientEngineType as ClientEngineType2, getClientEngineType as getClientEngineType2 } from "@prisma/internals";
3923
- import * as ts6 from "@prisma/ts-builders";
3962
+ import { ClientEngineType as ClientEngineType2, getClientEngineType as getClientEngineType3 } from "@prisma/internals";
3963
+ import * as ts7 from "@prisma/ts-builders";
3924
3964
 
3925
3965
  // src/utils/buildNFTAnnotations.ts
3926
3966
  import { getNodeAPIName } from "@prisma/get-platform";
@@ -3966,51 +4006,44 @@ path.join(process.cwd(), ${JSON.stringify(pathToPosix2(relativeFilePath))})`;
3966
4006
  }
3967
4007
 
3968
4008
  // src/TSClient/file-generators/ClientFile.ts
3969
- var jsDocHeader2 = `/*
4009
+ var jsDocHeader3 = `/*
3970
4010
  * This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.
3971
- *
4011
+ * If you're looking for something you can import in the client-side of your application, please refer to the \`browser.ts\` file instead.
4012
+ *
3972
4013
  * \u{1F7E2} You can import this file directly.
3973
4014
  */
3974
4015
  `;
3975
4016
  function createClientFile(context, options) {
3976
- const clientEngineType = getClientEngineType2(options.generator);
4017
+ const clientEngineType = getClientEngineType3(options.generator);
3977
4018
  options.generator.config.engineType = clientEngineType;
3978
4019
  const imports = [
3979
- ts6.moduleImport(context.runtimeImport).asNamespace("runtime"),
3980
- ts6.moduleImport(context.importFileName("./enums")).asNamespace("$Enums"),
3981
- ts6.moduleImport(context.importFileName("./internal/class")).asNamespace("$Class"),
3982
- ts6.moduleImport(context.importFileName("./internal/prismaNamespace")).asNamespace("Prisma")
3983
- ].map((i) => ts6.stringify(i));
4020
+ ts7.moduleImport(context.runtimeImport).asNamespace("runtime"),
4021
+ ts7.moduleImport(context.importFileName("./enums")).asNamespace("$Enums"),
4022
+ ts7.moduleImport(context.importFileName("./internal/class")).asNamespace("$Class"),
4023
+ ts7.moduleImport(context.importFileName("./internal/prismaNamespace")).asNamespace("Prisma")
4024
+ ].map((i) => ts7.stringify(i));
3984
4025
  const exports = [
3985
- ts6.moduleExportFrom(context.importFileName("./enums")).asNamespace("$Enums"),
3986
- ts6.moduleExportFrom(context.importFileName("./enums")),
3987
- ts6.moduleExport(
3988
- ts6.constDeclaration("PrismaClient").setValue(ts6.functionCall("$Class.getPrismaClientClass", [ts6.namedValue("__dirname")]))
4026
+ ts7.moduleExportFrom(context.importFileName("./enums")).asNamespace("$Enums"),
4027
+ ts7.moduleExportFrom(context.importFileName("./enums")),
4028
+ ts7.moduleExport(
4029
+ ts7.constDeclaration("PrismaClient").setValue(ts7.functionCall("$Class.getPrismaClientClass", [ts7.namedValue("__dirname")]))
3989
4030
  ).setDocComment(getPrismaClientClassDocComment(context)),
3990
- ts6.moduleExport(
3991
- ts6.typeDeclaration(
4031
+ ts7.moduleExport(
4032
+ ts7.typeDeclaration(
3992
4033
  "PrismaClient",
3993
- ts6.namedType("$Class.PrismaClient").addGenericArgument(ts6.namedType("LogOpts")).addGenericArgument(ts6.namedType("OmitOpts")).addGenericArgument(ts6.namedType("ExtArgs"))
4034
+ ts7.namedType("$Class.PrismaClient").addGenericArgument(ts7.namedType("LogOpts")).addGenericArgument(ts7.namedType("OmitOpts")).addGenericArgument(ts7.namedType("ExtArgs"))
3994
4035
  ).addGenericParameter(
3995
- ts6.genericParameter("LogOpts").extends(ts6.namedType("Prisma.LogLevel")).default(ts6.neverType)
4036
+ ts7.genericParameter("LogOpts").extends(ts7.namedType("Prisma.LogLevel")).default(ts7.neverType)
3996
4037
  ).addGenericParameter(
3997
- ts6.genericParameter("OmitOpts").extends(ts6.namedType("Prisma.PrismaClientOptions").subKey("omit")).default(ts6.namedType("Prisma.PrismaClientOptions").subKey("omit"))
4038
+ ts7.genericParameter("OmitOpts").extends(ts7.namedType("Prisma.PrismaClientOptions").subKey("omit")).default(ts7.namedType("Prisma.PrismaClientOptions").subKey("omit"))
3998
4039
  ).addGenericParameter(
3999
- ts6.genericParameter("ExtArgs").extends(ts6.namedType("runtime.Types.Extensions.InternalArgs")).default(ts6.namedType("runtime.Types.Extensions.DefaultArgs"))
4040
+ ts7.genericParameter("ExtArgs").extends(ts7.namedType("runtime.Types.Extensions.InternalArgs")).default(ts7.namedType("runtime.Types.Extensions.DefaultArgs"))
4000
4041
  )
4001
4042
  )
4002
- ].map((e) => ts6.stringify(e));
4003
- const modelExports = Object.values(context.dmmf.typeAndModelMap).filter((model) => context.dmmf.outputTypeMap.model[model.name]).map((model) => {
4004
- const docLines = model.documentation ?? "";
4005
- const modelLine = `Model ${model.name}
4006
- `;
4007
- const docs = `${modelLine}${docLines}`;
4008
- const modelTypeExport = ts6.moduleExport(ts6.typeDeclaration(model.name, ts6.namedType(`Prisma.${model.name}Model`))).setDocComment(ts6.docComment(docs));
4009
- return ts6.stringify(modelTypeExport);
4010
- });
4043
+ ].map((e) => ts7.stringify(e));
4011
4044
  const binaryTargets = clientEngineType === ClientEngineType2.Library ? Object.keys(options.binaryPaths.libqueryEngine ?? {}) : Object.keys(options.binaryPaths.queryEngine ?? {});
4012
4045
  const relativeOutdir = path4.relative(process.cwd(), options.outputDir);
4013
- return `${jsDocHeader2}
4046
+ return `${jsDocHeader3}
4014
4047
  ${buildPreamble(options.edge, options.moduleFormat)}
4015
4048
  ${imports.join("\n")}
4016
4049
 
@@ -4019,7 +4052,7 @@ export { Prisma }
4019
4052
 
4020
4053
  ${buildNFTAnnotations(options.edge || !options.copyEngine, clientEngineType, binaryTargets, relativeOutdir)}
4021
4054
 
4022
- ${modelExports.join("\n")}
4055
+ ${modelExports(context).join("\n")}
4023
4056
  `;
4024
4057
  }
4025
4058
  function buildPreamble(edge, moduleFormat) {
@@ -4039,8 +4072,8 @@ globalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url))
4039
4072
  }
4040
4073
 
4041
4074
  // src/TSClient/file-generators/CommonInputTypesFile.ts
4042
- import * as ts7 from "@prisma/ts-builders";
4043
- var jsDocHeader3 = `/*
4075
+ import * as ts8 from "@prisma/ts-builders";
4076
+ var jsDocHeader4 = `/*
4044
4077
  * This file exports various common sort, input & filter types that are not directly linked to a particular model.
4045
4078
  *
4046
4079
  * \u{1F7E2} You can import this file directly.
@@ -4048,12 +4081,12 @@ var jsDocHeader3 = `/*
4048
4081
  `;
4049
4082
  function createCommonInputTypeFiles(context) {
4050
4083
  const imports = [
4051
- ts7.moduleImport(context.runtimeImport).asNamespace("runtime"),
4052
- ts7.moduleImport(context.importFileName(`./enums`)).asNamespace("$Enums"),
4053
- ts7.moduleImport(context.importFileName(`./internal/prismaNamespace`)).asNamespace("Prisma").typeOnly()
4054
- ].map((i) => ts7.stringify(i));
4084
+ ts8.moduleImport(context.runtimeImport).asNamespace("runtime").typeOnly(),
4085
+ ts8.moduleImport(context.importFileName(`./enums`)).asNamespace("$Enums"),
4086
+ ts8.moduleImport(context.importFileName(`./internal/prismaNamespace`)).asNamespace("Prisma").typeOnly()
4087
+ ].map((i) => ts8.stringify(i));
4055
4088
  const genericInputTypes = context.dmmf.inputObjectTypes.prisma?.filter((i) => !i.meta?.grouping)?.map((inputType) => new InputType(inputType, context).toTS()) ?? [];
4056
- return `${jsDocHeader3}
4089
+ return `${jsDocHeader4}
4057
4090
  ${imports.join("\n")}
4058
4091
 
4059
4092
  ${genericInputTypes.join("\n")}
@@ -4064,7 +4097,7 @@ ${context.dmmf.inputObjectTypes.model?.map((inputType) => new InputType(inputTyp
4064
4097
 
4065
4098
  // src/TSClient/file-generators/EnumsFile.ts
4066
4099
  import { datamodelEnumToSchemaEnum } from "@prisma/dmmf";
4067
- var jsDocHeader4 = `/*
4100
+ var jsDocHeader5 = `/*
4068
4101
  * This file exports all enum related types from the schema.
4069
4102
  *
4070
4103
  * \u{1F7E2} You can import this file directly.
@@ -4077,35 +4110,35 @@ function createEnumsFile(context) {
4077
4110
  modelEnums.push(new Enum(datamodelEnumToSchemaEnum(datamodelEnum), false).toTS());
4078
4111
  }
4079
4112
  if (modelEnums.length === 0) {
4080
- return `${jsDocHeader4}
4113
+ return `${jsDocHeader5}
4081
4114
 
4082
4115
  // This file is empty because there are no enums in the schema.
4083
4116
  export {}
4084
4117
  `;
4085
4118
  }
4086
- return jsDocHeader4 + modelEnums.join("\n\n");
4119
+ return jsDocHeader5 + modelEnums.join("\n\n");
4087
4120
  }
4088
4121
 
4089
4122
  // src/TSClient/file-generators/ModelFile.ts
4090
- import * as ts14 from "@prisma/ts-builders";
4123
+ import * as ts15 from "@prisma/ts-builders";
4091
4124
 
4092
4125
  // src/TSClient/Model.ts
4093
4126
  import { capitalize as capitalize9 } from "@prisma/client-common";
4094
4127
  import * as DMMF2 from "@prisma/dmmf";
4095
- import * as ts13 from "@prisma/ts-builders";
4128
+ import * as ts14 from "@prisma/ts-builders";
4096
4129
  import indent5 from "indent-string";
4097
4130
  import { klona } from "klona";
4098
4131
 
4099
4132
  // src/TSClient/Args.ts
4100
- import * as ts8 from "@prisma/ts-builders";
4133
+ import * as ts9 from "@prisma/ts-builders";
4101
4134
  var ArgsTypeBuilder = class {
4102
4135
  constructor(type, context, action) {
4103
4136
  this.type = type;
4104
4137
  this.context = context;
4105
4138
  this.action = action;
4106
- this.moduleExport = ts8.moduleExport(
4107
- ts8.typeDeclaration(getModelArgName(type.name, action), ts8.objectType()).addGenericParameter(extArgsParam)
4108
- ).setDocComment(ts8.docComment(`${type.name} ${action ?? "without action"}`));
4139
+ this.moduleExport = ts9.moduleExport(
4140
+ ts9.typeDeclaration(getModelArgName(type.name, action), ts9.objectType()).addGenericParameter(extArgsParam)
4141
+ ).setDocComment(ts9.docComment(`${type.name} ${action ?? "without action"}`));
4109
4142
  }
4110
4143
  moduleExport;
4111
4144
  addProperty(prop) {
@@ -4116,7 +4149,7 @@ var ArgsTypeBuilder = class {
4116
4149
  const inputField = buildInputField(arg, this.context);
4117
4150
  const docComment9 = getArgFieldJSDoc(this.type, this.action, arg);
4118
4151
  if (docComment9) {
4119
- inputField.setDocComment(ts8.docComment(docComment9));
4152
+ inputField.setDocComment(ts9.docComment(docComment9));
4120
4153
  }
4121
4154
  this.addProperty(inputField);
4122
4155
  }
@@ -4124,13 +4157,13 @@ var ArgsTypeBuilder = class {
4124
4157
  }
4125
4158
  addSelectArg(selectTypeName = getSelectName(this.type.name)) {
4126
4159
  this.addProperty(
4127
- ts8.property(
4160
+ ts9.property(
4128
4161
  "select",
4129
- ts8.unionType([
4130
- ts8.namedType(`Prisma.${selectTypeName}`).addGenericArgument(extArgsParam.toArgument()),
4131
- ts8.nullType
4162
+ ts9.unionType([
4163
+ ts9.namedType(`Prisma.${selectTypeName}`).addGenericArgument(extArgsParam.toArgument()),
4164
+ ts9.nullType
4132
4165
  ])
4133
- ).optional().setDocComment(ts8.docComment(`Select specific fields to fetch from the ${this.type.name}`))
4166
+ ).optional().setDocComment(ts9.docComment(`Select specific fields to fetch from the ${this.type.name}`))
4134
4167
  );
4135
4168
  return this;
4136
4169
  }
@@ -4140,25 +4173,25 @@ var ArgsTypeBuilder = class {
4140
4173
  return this;
4141
4174
  }
4142
4175
  this.addProperty(
4143
- ts8.property(
4176
+ ts9.property(
4144
4177
  "include",
4145
- ts8.unionType([
4146
- ts8.namedType(`Prisma.${includeTypeName}`).addGenericArgument(extArgsParam.toArgument()),
4147
- ts8.nullType
4178
+ ts9.unionType([
4179
+ ts9.namedType(`Prisma.${includeTypeName}`).addGenericArgument(extArgsParam.toArgument()),
4180
+ ts9.nullType
4148
4181
  ])
4149
- ).optional().setDocComment(ts8.docComment("Choose, which related nodes to fetch as well"))
4182
+ ).optional().setDocComment(ts9.docComment("Choose, which related nodes to fetch as well"))
4150
4183
  );
4151
4184
  return this;
4152
4185
  }
4153
4186
  addOmitArg() {
4154
4187
  this.addProperty(
4155
- ts8.property(
4188
+ ts9.property(
4156
4189
  "omit",
4157
- ts8.unionType([
4158
- ts8.namedType(`Prisma.${getOmitName(this.type.name)}`).addGenericArgument(extArgsParam.toArgument()),
4159
- ts8.nullType
4190
+ ts9.unionType([
4191
+ ts9.namedType(`Prisma.${getOmitName(this.type.name)}`).addGenericArgument(extArgsParam.toArgument()),
4192
+ ts9.nullType
4160
4193
  ])
4161
- ).optional().setDocComment(ts8.docComment(`Omit specific fields from the ${this.type.name}`))
4194
+ ).optional().setDocComment(ts9.docComment(`Omit specific fields from the ${this.type.name}`))
4162
4195
  );
4163
4196
  return this;
4164
4197
  }
@@ -4167,7 +4200,7 @@ var ArgsTypeBuilder = class {
4167
4200
  return this;
4168
4201
  }
4169
4202
  setComment(comment) {
4170
- this.moduleExport.setDocComment(ts8.docComment(comment));
4203
+ this.moduleExport.setDocComment(ts9.docComment(comment));
4171
4204
  return this;
4172
4205
  }
4173
4206
  createExport() {
@@ -4177,12 +4210,12 @@ var ArgsTypeBuilder = class {
4177
4210
 
4178
4211
  // src/TSClient/Count.ts
4179
4212
  import { capitalize as capitalize8 } from "@prisma/client-common";
4180
- import * as ts10 from "@prisma/ts-builders";
4213
+ import * as ts11 from "@prisma/ts-builders";
4181
4214
  import indent4 from "indent-string";
4182
4215
 
4183
4216
  // src/TSClient/Output.ts
4184
4217
  import { hasOwnProperty } from "@prisma/internals";
4185
- import * as ts9 from "@prisma/ts-builders";
4218
+ import * as ts10 from "@prisma/ts-builders";
4186
4219
  function buildModelOutputProperty(field, dmmf) {
4187
4220
  let fieldTypeName = hasOwnProperty(GraphQLScalarToJSTypeTable, field.type) ? GraphQLScalarToJSTypeTable[field.type] : field.type;
4188
4221
  if (Array.isArray(fieldTypeName)) {
@@ -4190,47 +4223,47 @@ function buildModelOutputProperty(field, dmmf) {
4190
4223
  }
4191
4224
  let fieldType;
4192
4225
  if (field.kind === "object") {
4193
- const payloadType = ts9.namedType(getPayloadName(field.type));
4226
+ const payloadType = ts10.namedType(getPayloadName(field.type));
4194
4227
  if (!dmmf.isComposite(field.type)) {
4195
- payloadType.addGenericArgument(ts9.namedType("ExtArgs"));
4228
+ payloadType.addGenericArgument(ts10.namedType("ExtArgs"));
4196
4229
  }
4197
4230
  fieldType = payloadType;
4198
4231
  } else if (field.kind === "enum") {
4199
- fieldType = ts9.namedType(`$Enums.${fieldTypeName}`);
4232
+ fieldType = ts10.namedType(`$Enums.${fieldTypeName}`);
4200
4233
  } else {
4201
- fieldType = ts9.namedType(fieldTypeName);
4234
+ fieldType = ts10.namedType(fieldTypeName);
4202
4235
  }
4203
4236
  if (field.isList) {
4204
- fieldType = ts9.array(fieldType);
4237
+ fieldType = ts10.array(fieldType);
4205
4238
  } else if (!field.isRequired) {
4206
- fieldType = ts9.unionType(fieldType).addVariant(ts9.nullType);
4239
+ fieldType = ts10.unionType(fieldType).addVariant(ts10.nullType);
4207
4240
  }
4208
- const property13 = ts9.property(field.name, fieldType);
4241
+ const property13 = ts10.property(field.name, fieldType);
4209
4242
  if (field.documentation) {
4210
- property13.setDocComment(ts9.docComment(field.documentation));
4243
+ property13.setDocComment(ts10.docComment(field.documentation));
4211
4244
  }
4212
4245
  return property13;
4213
4246
  }
4214
4247
  function buildOutputType(type) {
4215
- return ts9.moduleExport(ts9.typeDeclaration(type.name, ts9.objectType().addMultiple(type.fields.map(buildOutputField))));
4248
+ return ts10.moduleExport(ts10.typeDeclaration(type.name, ts10.objectType().addMultiple(type.fields.map(buildOutputField))));
4216
4249
  }
4217
4250
  function buildOutputField(field) {
4218
4251
  let fieldType;
4219
4252
  if (field.outputType.location === "enumTypes" && field.outputType.namespace === "model") {
4220
- fieldType = ts9.namedType(enumTypeName(field.outputType));
4253
+ fieldType = ts10.namedType(enumTypeName(field.outputType));
4221
4254
  } else {
4222
4255
  const typeNames = GraphQLScalarToJSTypeTable[field.outputType.type] ?? field.outputType.type;
4223
- fieldType = Array.isArray(typeNames) ? ts9.namedType(typeNames[0]) : ts9.namedType(typeNames);
4256
+ fieldType = Array.isArray(typeNames) ? ts10.namedType(typeNames[0]) : ts10.namedType(typeNames);
4224
4257
  }
4225
4258
  if (field.outputType.isList) {
4226
- fieldType = ts9.array(fieldType);
4259
+ fieldType = ts10.array(fieldType);
4227
4260
  } else if (field.isNullable) {
4228
- fieldType = ts9.unionType(fieldType).addVariant(ts9.nullType);
4261
+ fieldType = ts10.unionType(fieldType).addVariant(ts10.nullType);
4229
4262
  }
4230
- const property13 = ts9.property(field.name, fieldType);
4263
+ const property13 = ts10.property(field.name, fieldType);
4231
4264
  if (field.deprecation) {
4232
4265
  property13.setDocComment(
4233
- ts9.docComment(`@deprecated since ${field.deprecation.sinceVersion} because ${field.deprecation.reason}`)
4266
+ ts10.docComment(`@deprecated since ${field.deprecation.sinceVersion} because ${field.deprecation.reason}`)
4234
4267
  );
4235
4268
  }
4236
4269
  return property13;
@@ -4270,7 +4303,7 @@ var Count = class {
4270
4303
  * Count Type ${name}
4271
4304
  */
4272
4305
 
4273
- ${ts10.stringify(outputType)}
4306
+ ${ts11.stringify(outputType)}
4274
4307
 
4275
4308
  export type ${getSelectName(
4276
4309
  name
@@ -4290,7 +4323,7 @@ ${indent4(
4290
4323
  )}
4291
4324
  }
4292
4325
 
4293
- ${this.argsTypes.map((typeExport) => ts10.stringify(typeExport)).join("\n\n")}
4326
+ ${this.argsTypes.map((typeExport) => ts11.stringify(typeExport)).join("\n\n")}
4294
4327
  `;
4295
4328
  }
4296
4329
  };
@@ -4327,12 +4360,12 @@ ${this.stringifyFields()}
4327
4360
 
4328
4361
  // src/TSClient/Payload.ts
4329
4362
  import { uncapitalize as uncapitalize5 } from "@prisma/client-common";
4330
- import * as ts11 from "@prisma/ts-builders";
4363
+ import * as ts12 from "@prisma/ts-builders";
4331
4364
  function buildModelPayload(model, context) {
4332
4365
  const isComposite = context.dmmf.isComposite(model.name);
4333
- const objects = ts11.objectType();
4334
- const scalars = ts11.objectType();
4335
- const composites = ts11.objectType();
4366
+ const objects = ts12.objectType();
4367
+ const scalars = ts12.objectType();
4368
+ const composites = ts12.objectType();
4336
4369
  for (const field of model.fields) {
4337
4370
  if (field.kind === "object") {
4338
4371
  if (context.dmmf.isComposite(field.type)) {
@@ -4344,20 +4377,20 @@ function buildModelPayload(model, context) {
4344
4377
  scalars.add(buildModelOutputProperty(field, context.dmmf));
4345
4378
  }
4346
4379
  }
4347
- const scalarsType = isComposite ? scalars : ts11.namedType("runtime.Types.Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts11.namedType("ExtArgs").subKey("result").subKey(uncapitalize5(model.name)));
4348
- const payloadTypeDeclaration = ts11.typeDeclaration(
4380
+ const scalarsType = isComposite ? scalars : ts12.namedType("runtime.Types.Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts12.namedType("ExtArgs").subKey("result").subKey(uncapitalize5(model.name)));
4381
+ const payloadTypeDeclaration = ts12.typeDeclaration(
4349
4382
  getPayloadName(model.name, false),
4350
- ts11.objectType().add(ts11.property("name", ts11.stringLiteral(model.name))).add(ts11.property("objects", objects)).add(ts11.property("scalars", scalarsType)).add(ts11.property("composites", composites))
4383
+ ts12.objectType().add(ts12.property("name", ts12.stringLiteral(model.name))).add(ts12.property("objects", objects)).add(ts12.property("scalars", scalarsType)).add(ts12.property("composites", composites))
4351
4384
  );
4352
4385
  if (!isComposite) {
4353
4386
  payloadTypeDeclaration.addGenericParameter(extArgsParam);
4354
4387
  }
4355
- return ts11.moduleExport(payloadTypeDeclaration);
4388
+ return ts12.moduleExport(payloadTypeDeclaration);
4356
4389
  }
4357
4390
 
4358
4391
  // src/TSClient/SelectIncludeOmit.ts
4359
4392
  import { uncapitalize as uncapitalize6 } from "@prisma/client-common";
4360
- import * as ts12 from "@prisma/ts-builders";
4393
+ import * as ts13 from "@prisma/ts-builders";
4361
4394
  function buildIncludeType({
4362
4395
  modelName,
4363
4396
  typeName = getIncludeName(modelName),
@@ -4368,14 +4401,14 @@ function buildIncludeType({
4368
4401
  return buildExport(typeName, type);
4369
4402
  }
4370
4403
  function buildOmitType({ modelName, fields, context }) {
4371
- const keysType = ts12.unionType(
4404
+ const keysType = ts13.unionType(
4372
4405
  fields.filter(
4373
4406
  (field) => field.outputType.location === "scalar" || field.outputType.location === "enumTypes" || context.dmmf.isComposite(field.outputType.type)
4374
- ).map((field) => ts12.stringLiteral(field.name))
4407
+ ).map((field) => ts13.stringLiteral(field.name))
4375
4408
  );
4376
- const omitType = ts12.namedType("runtime.Types.Extensions.GetOmit").addGenericArgument(keysType).addGenericArgument(modelResultExtensionsType(modelName));
4409
+ const omitType = ts13.namedType("runtime.Types.Extensions.GetOmit").addGenericArgument(keysType).addGenericArgument(modelResultExtensionsType(modelName));
4377
4410
  if (context.isPreviewFeatureOn("strictUndefinedChecks")) {
4378
- omitType.addGenericArgument(ts12.namedType("runtime.Types.Skip"));
4411
+ omitType.addGenericArgument(ts13.namedType("runtime.Types.Skip"));
4379
4412
  }
4380
4413
  return buildExport(getOmitName(modelName), omitType);
4381
4414
  }
@@ -4386,7 +4419,7 @@ function buildSelectType({
4386
4419
  context
4387
4420
  }) {
4388
4421
  const objectType11 = buildSelectOrIncludeObject(modelName, fields, context);
4389
- const selectType = ts12.namedType("runtime.Types.Extensions.GetSelect").addGenericArgument(objectType11).addGenericArgument(modelResultExtensionsType(modelName));
4422
+ const selectType = ts13.namedType("runtime.Types.Extensions.GetSelect").addGenericArgument(objectType11).addGenericArgument(modelResultExtensionsType(modelName));
4390
4423
  return buildExport(typeName, selectType);
4391
4424
  }
4392
4425
  function modelResultExtensionsType(modelName) {
@@ -4398,24 +4431,24 @@ function buildScalarSelectType({ modelName, fields, context }) {
4398
4431
  fields.filter((field) => field.outputType.location === "scalar" || field.outputType.location === "enumTypes"),
4399
4432
  context
4400
4433
  );
4401
- return ts12.moduleExport(ts12.typeDeclaration(`${getSelectName(modelName)}Scalar`, object));
4434
+ return ts13.moduleExport(ts13.typeDeclaration(`${getSelectName(modelName)}Scalar`, object));
4402
4435
  }
4403
4436
  function buildSelectOrIncludeObject(modelName, fields, context) {
4404
- const objectType11 = ts12.objectType();
4437
+ const objectType11 = ts13.objectType();
4405
4438
  for (const field of fields) {
4406
- const fieldType = ts12.unionType(ts12.booleanType);
4439
+ const fieldType = ts13.unionType(ts13.booleanType);
4407
4440
  if (field.outputType.location === "outputObjectTypes") {
4408
- const subSelectType = ts12.namedType(`Prisma.${getFieldArgName(field, modelName)}`);
4441
+ const subSelectType = ts13.namedType(`Prisma.${getFieldArgName(field, modelName)}`);
4409
4442
  subSelectType.addGenericArgument(extArgsParam.toArgument());
4410
4443
  fieldType.addVariant(subSelectType);
4411
4444
  }
4412
- objectType11.add(ts12.property(field.name, appendSkipType(context, fieldType)).optional());
4445
+ objectType11.add(ts13.property(field.name, appendSkipType(context, fieldType)).optional());
4413
4446
  }
4414
4447
  return objectType11;
4415
4448
  }
4416
4449
  function buildExport(typeName, type) {
4417
- const declaration = ts12.typeDeclaration(typeName, type);
4418
- return ts12.moduleExport(declaration.addGenericParameter(extArgsParam));
4450
+ const declaration = ts13.typeDeclaration(typeName, type);
4451
+ return ts13.moduleExport(declaration.addGenericParameter(extArgsParam));
4419
4452
  }
4420
4453
  function getIncludeFields(fields, dmmf) {
4421
4454
  return fields.filter((field) => {
@@ -4544,7 +4577,7 @@ ${indent5(
4544
4577
  )}
4545
4578
  }
4546
4579
 
4547
- ${ts13.stringify(buildOutputType(groupByType))}
4580
+ ${ts14.stringify(buildOutputType(groupByType))}
4548
4581
 
4549
4582
  type ${getGroupByPayloadName(model.name)}<T extends ${groupByArgsName}> = Prisma.PrismaPromise<
4550
4583
  Array<
@@ -4594,7 +4627,7 @@ type ${getGroupByPayloadName(model.name)}<T extends ${groupByArgsName}> = Prisma
4594
4627
  }
4595
4628
  const aggregateArgsName = getAggregateArgsName(model.name);
4596
4629
  const aggregateName = getAggregateName(model.name);
4597
- return `${aggregateTypes.map(buildOutputType).map((type) => ts13.stringify(type)).join("\n\n")}
4630
+ return `${aggregateTypes.map(buildOutputType).map((type) => ts14.stringify(type)).join("\n\n")}
4598
4631
 
4599
4632
  ${aggregateTypes.length > 1 ? aggregateTypes.slice(1).map((type) => {
4600
4633
  const newType = {
@@ -4662,31 +4695,31 @@ export type ${getAggregateGetName(model.name)}<T extends ${getAggregateArgsName(
4662
4695
  const modelLine = `Model ${this.model.name}
4663
4696
  `;
4664
4697
  const docs = `${modelLine}${docLines}`;
4665
- const modelTypeExport = ts13.moduleExport(
4666
- ts13.typeDeclaration(
4698
+ const modelTypeExport = ts14.moduleExport(
4699
+ ts14.typeDeclaration(
4667
4700
  `${this.model.name}Model`,
4668
- ts13.namedType(`runtime.Types.Result.DefaultSelection`).addGenericArgument(ts13.namedType(getPayloadName(this.model.name)))
4701
+ ts14.namedType(`runtime.Types.Result.DefaultSelection`).addGenericArgument(ts14.namedType(getPayloadName(this.model.name)))
4669
4702
  )
4670
- ).setDocComment(ts13.docComment(docs));
4671
- return ts13.stringify(modelTypeExport);
4703
+ ).setDocComment(ts14.docComment(docs));
4704
+ return ts14.stringify(modelTypeExport);
4672
4705
  }
4673
4706
  toTS() {
4674
4707
  const { model } = this;
4675
4708
  const isComposite = this.dmmf.isComposite(model.name);
4676
- const omitType = ts13.stringify(
4709
+ const omitType = ts14.stringify(
4677
4710
  buildOmitType({ modelName: this.model.name, context: this.context, fields: this.type.fields }),
4678
4711
  {
4679
4712
  newLine: "leading"
4680
4713
  }
4681
4714
  );
4682
4715
  const hasRelationField = model.fields.some((f) => f.kind === "object");
4683
- const includeType = hasRelationField ? ts13.stringify(
4716
+ const includeType = hasRelationField ? ts14.stringify(
4684
4717
  buildIncludeType({ modelName: this.model.name, context: this.context, fields: this.type.fields }),
4685
4718
  {
4686
4719
  newLine: "leading"
4687
4720
  }
4688
4721
  ) : "";
4689
- const createManyAndReturnIncludeType = hasRelationField && this.createManyAndReturnType ? ts13.stringify(
4722
+ const createManyAndReturnIncludeType = hasRelationField && this.createManyAndReturnType ? ts14.stringify(
4690
4723
  buildIncludeType({
4691
4724
  typeName: getIncludeCreateManyAndReturnName(this.model.name),
4692
4725
  modelName: this.model.name,
@@ -4697,7 +4730,7 @@ export type ${getAggregateGetName(model.name)}<T extends ${getAggregateArgsName(
4697
4730
  newLine: "leading"
4698
4731
  }
4699
4732
  ) : "";
4700
- const updateManyAndReturnIncludeType = hasRelationField && this.updateManyAndReturnType ? ts13.stringify(
4733
+ const updateManyAndReturnIncludeType = hasRelationField && this.updateManyAndReturnType ? ts14.stringify(
4701
4734
  buildIncludeType({
4702
4735
  typeName: getIncludeUpdateManyAndReturnName(this.model.name),
4703
4736
  modelName: this.model.name,
@@ -4719,8 +4752,8 @@ ${this.getDeepInputTypes()}
4719
4752
 
4720
4753
  ${this.getCountTypes()}
4721
4754
 
4722
- ${ts13.stringify(buildSelectType({ modelName: this.model.name, fields: this.type.fields, context: this.context }))}
4723
- ${this.createManyAndReturnType ? ts13.stringify(
4755
+ ${ts14.stringify(buildSelectType({ modelName: this.model.name, fields: this.type.fields, context: this.context }))}
4756
+ ${this.createManyAndReturnType ? ts14.stringify(
4724
4757
  buildSelectType({
4725
4758
  modelName: this.model.name,
4726
4759
  fields: this.createManyAndReturnType.fields,
@@ -4729,7 +4762,7 @@ ${this.createManyAndReturnType ? ts13.stringify(
4729
4762
  }),
4730
4763
  { newLine: "leading" }
4731
4764
  ) : ""}
4732
- ${this.updateManyAndReturnType ? ts13.stringify(
4765
+ ${this.updateManyAndReturnType ? ts14.stringify(
4733
4766
  buildSelectType({
4734
4767
  modelName: this.model.name,
4735
4768
  fields: this.updateManyAndReturnType.fields,
@@ -4738,12 +4771,12 @@ ${this.updateManyAndReturnType ? ts13.stringify(
4738
4771
  }),
4739
4772
  { newLine: "leading" }
4740
4773
  ) : ""}
4741
- ${ts13.stringify(buildScalarSelectType({ modelName: this.model.name, fields: this.type.fields, context: this.context }), {
4774
+ ${ts14.stringify(buildScalarSelectType({ modelName: this.model.name, fields: this.type.fields, context: this.context }), {
4742
4775
  newLine: "leading"
4743
4776
  })}
4744
4777
  ${omitType}${includeType}${createManyAndReturnIncludeType}${updateManyAndReturnIncludeType}
4745
4778
 
4746
- ${ts13.stringify(buildModelPayload(this.model, this.context), { newLine: "none" })}
4779
+ ${ts14.stringify(buildModelPayload(this.model, this.context), { newLine: "none" })}
4747
4780
 
4748
4781
  export type ${model.name}GetPayload<S extends boolean | null | undefined | ${getModelArgName(
4749
4782
  model.name
@@ -4754,7 +4787,7 @@ ${isComposite ? "" : new ModelDelegate(this.type, this.context).toTS()}
4754
4787
  ${new ModelFieldRefs(this.type).toTS()}
4755
4788
 
4756
4789
  // Custom InputTypes
4757
- ${this.argsTypes.map((type) => ts13.stringify(type)).join("\n\n")}
4790
+ ${this.argsTypes.map((type) => ts14.stringify(type)).join("\n\n")}
4758
4791
  `;
4759
4792
  }
4760
4793
  };
@@ -4785,7 +4818,7 @@ var ModelDelegate = class {
4785
4818
  const nonAggregateActions = this.getNonAggregateActions(availableActions);
4786
4819
  const groupByArgsName = getGroupByArgsName(name);
4787
4820
  const countArgsName = getModelArgName(name, DMMF2.ModelAction.count);
4788
- const genericDelegateParams = [extArgsParam, ts13.genericParameter("GlobalOmitOptions").default(ts13.objectType())];
4821
+ const genericDelegateParams = [extArgsParam, ts14.genericParameter("GlobalOmitOptions").default(ts14.objectType())];
4789
4822
  const excludedArgsForCount = ["select", "include", "distinct", "omit"];
4790
4823
  if (this.context.isPreviewFeatureOn("relationJoins")) {
4791
4824
  excludedArgsForCount.push("relationLoadStrategy");
@@ -4796,11 +4829,11 @@ var ModelDelegate = class {
4796
4829
  select?: ${getCountAggregateInputName(name)} | true
4797
4830
  }
4798
4831
  ` : ""}
4799
- export interface ${name}Delegate<${genericDelegateParams.map((param) => ts13.stringify(param)).join(", ")}> {
4832
+ export interface ${name}Delegate<${genericDelegateParams.map((param) => ts14.stringify(param)).join(", ")}> {
4800
4833
  ${indent5(`[K: symbol]: { types: Prisma.TypeMap<ExtArgs>['model']['${name}'], meta: { name: '${name}' } }`, TAB_SIZE)}
4801
4834
  ${nonAggregateActions.map((action) => {
4802
4835
  const method3 = buildModelDelegateMethod(name, action, this.context);
4803
- return ts13.stringify(method3, { indentLevel: 1, newLine: "trailing" });
4836
+ return ts14.stringify(method3, { indentLevel: 1, newLine: "trailing" });
4804
4837
  }).join("\n")}
4805
4838
 
4806
4839
  ${availableActions.includes(DMMF2.ModelAction.aggregate) ? `${indent5(getMethodJSDoc(DMMF2.ModelAction.count, mapping, modelOrType), TAB_SIZE)}
@@ -4886,7 +4919,7 @@ ${availableActions.includes(DMMF2.ModelAction.groupBy) ? `${indent5(getMethodJSD
4886
4919
  readonly fields: ${getFieldRefsTypeName(name)};
4887
4920
  }
4888
4921
 
4889
- ${ts13.stringify(buildFluentWrapperDefinition(name, this.outputType, this.context))}
4922
+ ${ts14.stringify(buildFluentWrapperDefinition(name, this.outputType, this.context))}
4890
4923
  `;
4891
4924
  }
4892
4925
  };
@@ -4894,7 +4927,7 @@ function buildModelDelegateMethod(modelName, actionName, context) {
4894
4927
  const mapping = context.dmmf.mappingsMap[modelName] ?? { model: modelName, plural: `${modelName}s` };
4895
4928
  const modelOrType = context.dmmf.typeAndModelMap[modelName];
4896
4929
  const dependencyValidators = getNonAggregateMethodDependencyValidations(mapping, actionName, context);
4897
- const method3 = ts13.method(actionName).setDocComment(ts13.docComment(getMethodJSDocBody(actionName, mapping, modelOrType))).addParameter(getNonAggregateMethodArgs(modelName, actionName, dependencyValidators)).setReturnType(getReturnType({ modelName, actionName }));
4930
+ const method3 = ts14.method(actionName).setDocComment(ts14.docComment(getMethodJSDocBody(actionName, mapping, modelOrType))).addParameter(getNonAggregateMethodArgs(modelName, actionName, dependencyValidators)).setReturnType(getReturnType({ modelName, actionName }));
4898
4931
  const generic = getNonAggregateMethodGenericParam(modelName, actionName);
4899
4932
  if (generic) {
4900
4933
  method3.addGenericParameter(generic);
@@ -4907,22 +4940,22 @@ function buildModelDelegateMethod(modelName, actionName, context) {
4907
4940
  function getNonAggregateMethodArgs(modelName, actionName, dependencyValidators) {
4908
4941
  const makeParameter = (type2) => {
4909
4942
  if (dependencyValidators.length > 0) {
4910
- type2 = ts13.intersectionType([type2, ...dependencyValidators.map((validator) => ts13.namedType(validator.name))]);
4943
+ type2 = ts14.intersectionType([type2, ...dependencyValidators.map((validator) => ts14.namedType(validator.name))]);
4911
4944
  }
4912
- return ts13.parameter("args", type2);
4945
+ return ts14.parameter("args", type2);
4913
4946
  };
4914
4947
  if (actionName === DMMF2.ModelAction.count) {
4915
4948
  const type2 = omit(
4916
- ts13.namedType(getModelArgName(modelName, DMMF2.ModelAction.findMany)),
4917
- ts13.unionType(ts13.stringLiteral("select")).addVariant(ts13.stringLiteral("include")).addVariant(ts13.stringLiteral("distinct"))
4949
+ ts14.namedType(getModelArgName(modelName, DMMF2.ModelAction.findMany)),
4950
+ ts14.unionType(ts14.stringLiteral("select")).addVariant(ts14.stringLiteral("include")).addVariant(ts14.stringLiteral("distinct"))
4918
4951
  );
4919
4952
  return makeParameter(type2).optional();
4920
4953
  }
4921
4954
  if (actionName === DMMF2.ModelAction.findRaw || actionName === DMMF2.ModelAction.aggregateRaw) {
4922
- return makeParameter(ts13.namedType(`Prisma.${getModelArgName(modelName, actionName)}`)).optional();
4955
+ return makeParameter(ts14.namedType(`Prisma.${getModelArgName(modelName, actionName)}`)).optional();
4923
4956
  }
4924
- const type = ts13.namedType("Prisma.SelectSubset").addGenericArgument(ts13.namedType("T")).addGenericArgument(
4925
- ts13.namedType(getModelArgName(modelName, actionName)).addGenericArgument(extArgsParam.toArgument())
4957
+ const type = ts14.namedType("Prisma.SelectSubset").addGenericArgument(ts14.namedType("T")).addGenericArgument(
4958
+ ts14.namedType(getModelArgName(modelName, actionName)).addGenericArgument(extArgsParam.toArgument())
4926
4959
  );
4927
4960
  const param = makeParameter(type);
4928
4961
  if (actionName === DMMF2.ModelAction.findMany || actionName === DMMF2.ModelAction.findFirst || actionName === DMMF2.ModelAction.deleteMany || actionName === DMMF2.ModelAction.createMany || actionName === DMMF2.ModelAction.createManyAndReturn || actionName === DMMF2.ModelAction.findFirstOrThrow) {
@@ -4934,11 +4967,11 @@ function getNonAggregateMethodGenericParam(modelName, actionName) {
4934
4967
  if (actionName === DMMF2.ModelAction.count || actionName === DMMF2.ModelAction.findRaw || actionName === DMMF2.ModelAction.aggregateRaw) {
4935
4968
  return null;
4936
4969
  }
4937
- const arg = ts13.genericParameter("T");
4970
+ const arg = ts14.genericParameter("T");
4938
4971
  if (actionName === DMMF2.ModelAction.aggregate) {
4939
- return arg.extends(ts13.namedType(getAggregateArgsName(modelName)));
4972
+ return arg.extends(ts14.namedType(getAggregateArgsName(modelName)));
4940
4973
  }
4941
- return arg.extends(ts13.namedType(getModelArgName(modelName, actionName)));
4974
+ return arg.extends(ts14.namedType(getModelArgName(modelName, actionName)));
4942
4975
  }
4943
4976
  function getNonAggregateMethodDependencyValidations(modelMapping, actionName, context) {
4944
4977
  const outputFieldName = modelMapping[actionName];
@@ -4954,13 +4987,13 @@ function getNonAggregateMethodDependencyValidations(modelMapping, actionName, co
4954
4987
  if (args.requiresOtherFields === void 0) {
4955
4988
  continue;
4956
4989
  }
4957
- const objectType11 = ts13.objectType();
4990
+ const objectType11 = ts14.objectType();
4958
4991
  for (const reqArg of args.requiresOtherFields) {
4959
- objectType11.add(ts13.property(reqArg, ts13.objectType()));
4992
+ objectType11.add(ts14.property(reqArg, ts14.objectType()));
4960
4993
  }
4961
4994
  validators.push(
4962
- ts13.genericParameter(`${capitalize9(args.name)}DependenciesValidator`).extends(
4963
- ts13.conditionalType().check(ts13.stringLiteral(args.name)).extends(ts13.namedType("Prisma.Keys<T>")).then(objectType11).else(ts13.objectType())
4995
+ ts14.genericParameter(`${capitalize9(args.name)}DependenciesValidator`).extends(
4996
+ ts14.conditionalType().check(ts14.stringLiteral(args.name)).extends(ts14.namedType("Prisma.Keys<T>")).then(objectType11).else(ts14.objectType())
4964
4997
  )
4965
4998
  );
4966
4999
  }
@@ -4973,53 +5006,53 @@ function getReturnType({
4973
5006
  isNullable = false
4974
5007
  }) {
4975
5008
  if (actionName === DMMF2.ModelAction.count) {
4976
- return promise(ts13.numberType);
5009
+ return promise(ts14.numberType);
4977
5010
  }
4978
5011
  if (actionName === DMMF2.ModelAction.aggregate) {
4979
- return promise(ts13.namedType(getAggregateGetName(modelName)).addGenericArgument(ts13.namedType("T")));
5012
+ return promise(ts14.namedType(getAggregateGetName(modelName)).addGenericArgument(ts14.namedType("T")));
4980
5013
  }
4981
5014
  if (actionName === DMMF2.ModelAction.findRaw || actionName === DMMF2.ModelAction.aggregateRaw) {
4982
- return prismaPromise(ts13.namedType("Prisma.JsonObject"));
5015
+ return prismaPromise(ts14.namedType("Prisma.JsonObject"));
4983
5016
  }
4984
5017
  if (actionName === DMMF2.ModelAction.deleteMany || actionName === DMMF2.ModelAction.updateMany || actionName === DMMF2.ModelAction.createMany) {
4985
- return prismaPromise(ts13.namedType("Prisma.BatchPayload"));
5018
+ return prismaPromise(ts14.namedType("Prisma.BatchPayload"));
4986
5019
  }
4987
5020
  const isList = actionName === DMMF2.ModelAction.findMany || actionName === DMMF2.ModelAction.createManyAndReturn || actionName === DMMF2.ModelAction.updateManyAndReturn;
4988
5021
  if (isList) {
4989
5022
  let result = getResultType(modelName, actionName);
4990
5023
  if (isChaining) {
4991
- result = ts13.unionType(result).addVariant(ts13.namedType("Null"));
5024
+ result = ts14.unionType(result).addVariant(ts14.namedType("Null"));
4992
5025
  }
4993
5026
  return prismaPromise(result);
4994
5027
  }
4995
5028
  if (isChaining && actionName === DMMF2.ModelAction.findUniqueOrThrow) {
4996
- const nullType7 = isNullable ? ts13.nullType : ts13.namedType("Null");
4997
- const result = ts13.unionType(getResultType(modelName, actionName)).addVariant(nullType7);
5029
+ const nullType7 = isNullable ? ts14.nullType : ts14.namedType("Null");
5030
+ const result = ts14.unionType(getResultType(modelName, actionName)).addVariant(nullType7);
4998
5031
  return getFluentWrapper(modelName, result, nullType7);
4999
5032
  }
5000
5033
  if (actionName === DMMF2.ModelAction.findFirst || actionName === DMMF2.ModelAction.findUnique) {
5001
- const result = ts13.unionType(getResultType(modelName, actionName)).addVariant(ts13.nullType);
5002
- return getFluentWrapper(modelName, result, ts13.nullType);
5034
+ const result = ts14.unionType(getResultType(modelName, actionName)).addVariant(ts14.nullType);
5035
+ return getFluentWrapper(modelName, result, ts14.nullType);
5003
5036
  }
5004
5037
  return getFluentWrapper(modelName, getResultType(modelName, actionName));
5005
5038
  }
5006
- function getFluentWrapper(modelName, resultType, nullType7 = ts13.neverType) {
5007
- return ts13.namedType(`Prisma.${fluentWrapperName(modelName)}`).addGenericArgument(resultType).addGenericArgument(nullType7).addGenericArgument(extArgsParam.toArgument()).addGenericArgument(ts13.namedType("GlobalOmitOptions"));
5039
+ function getFluentWrapper(modelName, resultType, nullType7 = ts14.neverType) {
5040
+ return ts14.namedType(`Prisma.${fluentWrapperName(modelName)}`).addGenericArgument(resultType).addGenericArgument(nullType7).addGenericArgument(extArgsParam.toArgument()).addGenericArgument(ts14.namedType("GlobalOmitOptions"));
5008
5041
  }
5009
5042
  function getResultType(modelName, actionName) {
5010
- return ts13.namedType("runtime.Types.Result.GetResult").addGenericArgument(ts13.namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument())).addGenericArgument(ts13.namedType("T")).addGenericArgument(ts13.stringLiteral(actionName)).addGenericArgument(ts13.namedType("GlobalOmitOptions"));
5043
+ return ts14.namedType("runtime.Types.Result.GetResult").addGenericArgument(ts14.namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument())).addGenericArgument(ts14.namedType("T")).addGenericArgument(ts14.stringLiteral(actionName)).addGenericArgument(ts14.namedType("GlobalOmitOptions"));
5011
5044
  }
5012
5045
  function buildFluentWrapperDefinition(modelName, outputType, context) {
5013
- const definition = ts13.interfaceDeclaration(fluentWrapperName(modelName));
5014
- definition.addGenericParameter(ts13.genericParameter("T")).addGenericParameter(ts13.genericParameter("Null").default(ts13.neverType)).addGenericParameter(extArgsParam).addGenericParameter(ts13.genericParameter("GlobalOmitOptions").default(ts13.objectType())).extends(prismaPromise(ts13.namedType("T")));
5015
- definition.add(ts13.property(ts13.toStringTag, ts13.stringLiteral("PrismaPromise")).readonly());
5046
+ const definition = ts14.interfaceDeclaration(fluentWrapperName(modelName));
5047
+ definition.addGenericParameter(ts14.genericParameter("T")).addGenericParameter(ts14.genericParameter("Null").default(ts14.neverType)).addGenericParameter(extArgsParam).addGenericParameter(ts14.genericParameter("GlobalOmitOptions").default(ts14.objectType())).extends(prismaPromise(ts14.namedType("T")));
5048
+ definition.add(ts14.property(ts14.toStringTag, ts14.stringLiteral("PrismaPromise")).readonly());
5016
5049
  definition.addMultiple(
5017
5050
  outputType.fields.filter(
5018
5051
  (field) => field.outputType.location === "outputObjectTypes" && !context.dmmf.isComposite(field.outputType.type) && field.name !== "_count"
5019
5052
  ).map((field) => {
5020
- const fieldArgType = ts13.namedType(`Prisma.${getFieldArgName(field, modelName)}`).addGenericArgument(extArgsParam.toArgument());
5021
- const argsParam = ts13.genericParameter("T").extends(fieldArgType).default(ts13.objectType());
5022
- return ts13.method(field.name).addGenericParameter(argsParam).addParameter(ts13.parameter("args", subset(argsParam.toArgument(), fieldArgType)).optional()).setReturnType(
5053
+ const fieldArgType = ts14.namedType(`Prisma.${getFieldArgName(field, modelName)}`).addGenericArgument(extArgsParam.toArgument());
5054
+ const argsParam = ts14.genericParameter("T").extends(fieldArgType).default(ts14.objectType());
5055
+ return ts14.method(field.name).addGenericParameter(argsParam).addParameter(ts14.parameter("args", subset(argsParam.toArgument(), fieldArgType)).optional()).setReturnType(
5023
5056
  getReturnType({
5024
5057
  modelName: field.outputType.type,
5025
5058
  actionName: field.outputType.isList ? DMMF2.ModelAction.findMany : DMMF2.ModelAction.findUniqueOrThrow,
@@ -5030,37 +5063,37 @@ function buildFluentWrapperDefinition(modelName, outputType, context) {
5030
5063
  })
5031
5064
  );
5032
5065
  definition.add(
5033
- ts13.method("then").setDocComment(
5034
- ts13.docComment`
5066
+ ts14.method("then").setDocComment(
5067
+ ts14.docComment`
5035
5068
  Attaches callbacks for the resolution and/or rejection of the Promise.
5036
5069
  @param onfulfilled The callback to execute when the Promise is resolved.
5037
5070
  @param onrejected The callback to execute when the Promise is rejected.
5038
5071
  @returns A Promise for the completion of which ever callback is executed.
5039
5072
  `
5040
- ).addGenericParameter(ts13.genericParameter("TResult1").default(ts13.namedType("T"))).addGenericParameter(ts13.genericParameter("TResult2").default(ts13.neverType)).addParameter(promiseCallback("onfulfilled", ts13.parameter("value", ts13.namedType("T")), ts13.namedType("TResult1"))).addParameter(promiseCallback("onrejected", ts13.parameter("reason", ts13.anyType), ts13.namedType("TResult2"))).setReturnType(promise(ts13.unionType([ts13.namedType("TResult1"), ts13.namedType("TResult2")])))
5073
+ ).addGenericParameter(ts14.genericParameter("TResult1").default(ts14.namedType("T"))).addGenericParameter(ts14.genericParameter("TResult2").default(ts14.neverType)).addParameter(promiseCallback("onfulfilled", ts14.parameter("value", ts14.namedType("T")), ts14.namedType("TResult1"))).addParameter(promiseCallback("onrejected", ts14.parameter("reason", ts14.anyType), ts14.namedType("TResult2"))).setReturnType(promise(ts14.unionType([ts14.namedType("TResult1"), ts14.namedType("TResult2")])))
5041
5074
  );
5042
5075
  definition.add(
5043
- ts13.method("catch").setDocComment(
5044
- ts13.docComment`
5076
+ ts14.method("catch").setDocComment(
5077
+ ts14.docComment`
5045
5078
  Attaches a callback for only the rejection of the Promise.
5046
5079
  @param onrejected The callback to execute when the Promise is rejected.
5047
5080
  @returns A Promise for the completion of the callback.
5048
5081
  `
5049
- ).addGenericParameter(ts13.genericParameter("TResult").default(ts13.neverType)).addParameter(promiseCallback("onrejected", ts13.parameter("reason", ts13.anyType), ts13.namedType("TResult"))).setReturnType(promise(ts13.unionType([ts13.namedType("T"), ts13.namedType("TResult")])))
5082
+ ).addGenericParameter(ts14.genericParameter("TResult").default(ts14.neverType)).addParameter(promiseCallback("onrejected", ts14.parameter("reason", ts14.anyType), ts14.namedType("TResult"))).setReturnType(promise(ts14.unionType([ts14.namedType("T"), ts14.namedType("TResult")])))
5050
5083
  );
5051
5084
  definition.add(
5052
- ts13.method("finally").setDocComment(
5053
- ts13.docComment`
5085
+ ts14.method("finally").setDocComment(
5086
+ ts14.docComment`
5054
5087
  Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
5055
5088
  resolved value cannot be modified from the callback.
5056
5089
  @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
5057
5090
  @returns A Promise for the completion of the callback.
5058
5091
  `
5059
5092
  ).addParameter(
5060
- ts13.parameter("onfinally", ts13.unionType([ts13.functionType(), ts13.undefinedType, ts13.nullType])).optional()
5061
- ).setReturnType(promise(ts13.namedType("T")))
5093
+ ts14.parameter("onfinally", ts14.unionType([ts14.functionType(), ts14.undefinedType, ts14.nullType])).optional()
5094
+ ).setReturnType(promise(ts14.namedType("T")))
5062
5095
  );
5063
- return ts13.moduleExport(definition).setDocComment(ts13.docComment`
5096
+ return ts14.moduleExport(definition).setDocComment(ts14.docComment`
5064
5097
  The delegate class that acts as a "Promise-like" for ${modelName}.
5065
5098
  Why is this prefixed with \`Prisma__\`?
5066
5099
  Because we want to prevent naming conflicts as mentioned in
@@ -5068,20 +5101,20 @@ function buildFluentWrapperDefinition(modelName, outputType, context) {
5068
5101
  `);
5069
5102
  }
5070
5103
  function promiseCallback(name, callbackParam, returnType) {
5071
- return ts13.parameter(
5104
+ return ts14.parameter(
5072
5105
  name,
5073
- ts13.unionType([
5074
- ts13.functionType().addParameter(callbackParam).setReturnType(typeOrPromiseLike(returnType)),
5075
- ts13.undefinedType,
5076
- ts13.nullType
5106
+ ts14.unionType([
5107
+ ts14.functionType().addParameter(callbackParam).setReturnType(typeOrPromiseLike(returnType)),
5108
+ ts14.undefinedType,
5109
+ ts14.nullType
5077
5110
  ])
5078
5111
  ).optional();
5079
5112
  }
5080
5113
  function typeOrPromiseLike(type) {
5081
- return ts13.unionType([type, ts13.namedType("PromiseLike").addGenericArgument(type)]);
5114
+ return ts14.unionType([type, ts14.namedType("PromiseLike").addGenericArgument(type)]);
5082
5115
  }
5083
5116
  function subset(arg, baseType) {
5084
- return ts13.namedType("Prisma.Subset").addGenericArgument(arg).addGenericArgument(baseType);
5117
+ return ts14.namedType("Prisma.Subset").addGenericArgument(arg).addGenericArgument(baseType);
5085
5118
  }
5086
5119
  function fluentWrapperName(modelName) {
5087
5120
  return `Prisma__${modelName}Client`;
@@ -5089,24 +5122,24 @@ function fluentWrapperName(modelName) {
5089
5122
 
5090
5123
  // src/TSClient/file-generators/ModelFile.ts
5091
5124
  function createModelFile(context, modelName) {
5092
- const jsDocHeader7 = `/*
5125
+ const jsDocHeader9 = `/*
5093
5126
  * This file exports the \`${modelName}\` model and its related types.
5094
5127
  *
5095
5128
  * \u{1F7E2} You can import this file directly.
5096
5129
  */
5097
5130
  `;
5098
5131
  const imports = [
5099
- ts14.moduleImport(context.runtimeImport).asNamespace("runtime"),
5100
- ts14.moduleImport(context.importFileName(`../enums`)).asNamespace("$Enums").typeOnly(),
5101
- ts14.moduleImport(context.importFileName(`../internal/prismaNamespace`)).asNamespace("Prisma").typeOnly()
5132
+ ts15.moduleImport(context.runtimeImport).asNamespace("runtime").typeOnly(),
5133
+ ts15.moduleImport(context.importFileName(`../enums`)).asNamespace("$Enums").typeOnly(),
5134
+ ts15.moduleImport(context.importFileName(`../internal/prismaNamespace`)).asNamespace("Prisma").typeOnly()
5102
5135
  ];
5103
- const importsString = imports.map((i) => ts14.stringify(i)).join("\n");
5136
+ const importsString = imports.map((i) => ts15.stringify(i)).join("\n");
5104
5137
  const model = context.dmmf.typeAndModelMap[modelName];
5105
- return jsDocHeader7 + importsString + "\n" + new Model(model, context).toTS();
5138
+ return jsDocHeader9 + importsString + "\n" + new Model(model, context).toTS();
5106
5139
  }
5107
5140
 
5108
5141
  // src/TSClient/file-generators/ModelsFile.ts
5109
- var jsDocHeader5 = `/*
5142
+ var jsDocHeader6 = `/*
5110
5143
  * This is a barrel export file for all models and their related types.
5111
5144
  *
5112
5145
  * \u{1F7E2} You can import this file directly.
@@ -5115,11 +5148,46 @@ var jsDocHeader5 = `/*
5115
5148
  function createModelsFile(context, modelsNames) {
5116
5149
  const exports = modelsNames.map((m) => `export type * from './models/${context.importFileName(m)}'`);
5117
5150
  exports.push(`export type * from './${context.importFileName("commonInputTypes")}'`);
5118
- return jsDocHeader5 + exports.join("\n");
5151
+ return jsDocHeader6 + exports.join("\n");
5152
+ }
5153
+
5154
+ // src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
5155
+ import * as ts16 from "@prisma/ts-builders";
5156
+ var jsDocHeader7 = `/*
5157
+ * WARNING: This is an internal file that is subject to change!
5158
+ *
5159
+ * \u{1F6D1} Under no circumstances should you import this file directly! \u{1F6D1}
5160
+ *
5161
+ * All exports from this file are wrapped under a \`Prisma\` namespace object in the browser.ts file.
5162
+ * While this enables partial backward compatibility, it is not part of the stable public API.
5163
+ *
5164
+ * If you are looking for your Models, Enums, and Input Types, please import them from the respective
5165
+ * model files in the \`model\` directory!
5166
+ */
5167
+ `;
5168
+ function createPrismaNamespaceBrowserFile(context) {
5169
+ const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
5170
+ return `${jsDocHeader7}
5171
+ ${ts16.stringify(ts16.moduleImport(`${context.runtimeBase}/index-browser`).asNamespace("runtime"))}
5172
+ export type * from '${context.importFileName(`../models`)}'
5173
+ export type * from '${context.importFileName(`./prismaNamespace`)}'
5174
+ export const Decimal = runtime.Decimal
5175
+ ${new Enum(
5176
+ {
5177
+ name: "ModelName",
5178
+ values: context.dmmf.mappings.modelOperations.map((m) => m.model)
5179
+ },
5180
+ true
5181
+ ).toTS()}
5182
+ /**
5183
+ * Enums
5184
+ */
5185
+ ${prismaEnums?.join("\n\n")}
5186
+ `;
5119
5187
  }
5120
5188
 
5121
5189
  // src/TSClient/file-generators/PrismaNamespaceFile.ts
5122
- import * as ts17 from "@prisma/ts-builders";
5190
+ import * as ts19 from "@prisma/ts-builders";
5123
5191
 
5124
5192
  // src/TSClient/common.ts
5125
5193
  var commonCodeTS = ({ clientVersion, engineVersion, generator }) => {
@@ -5544,23 +5612,23 @@ export type ${this.type.name}<$PrismaModel> = FieldRefInputType<$PrismaModel, ${
5544
5612
 
5545
5613
  // src/TSClient/globalOmit.ts
5546
5614
  import { uncapitalize as uncapitalize7 } from "@prisma/client-common";
5547
- import * as ts15 from "@prisma/ts-builders";
5615
+ import * as ts17 from "@prisma/ts-builders";
5548
5616
  function globalOmitConfig(dmmf) {
5549
- const objectType11 = ts15.objectType().addMultiple(
5617
+ const objectType11 = ts17.objectType().addMultiple(
5550
5618
  dmmf.datamodel.models.map((model) => {
5551
- const type = ts15.namedType(`Prisma.${getOmitName(model.name)}`);
5552
- return ts15.property(uncapitalize7(model.name), type).optional();
5619
+ const type = ts17.namedType(`Prisma.${getOmitName(model.name)}`);
5620
+ return ts17.property(uncapitalize7(model.name), type).optional();
5553
5621
  })
5554
5622
  );
5555
- return ts15.moduleExport(ts15.typeDeclaration("GlobalOmitConfig", objectType11));
5623
+ return ts17.moduleExport(ts17.typeDeclaration("GlobalOmitConfig", objectType11));
5556
5624
  }
5557
5625
 
5558
5626
  // src/TSClient/TypeMap.ts
5559
5627
  import { uncapitalize as uncapitalize8 } from "@prisma/client-common";
5560
5628
  import { assertNever as assertNever2 } from "@prisma/internals";
5561
- import * as ts16 from "@prisma/ts-builders";
5629
+ import * as ts18 from "@prisma/ts-builders";
5562
5630
  function clientTypeMapDefinition(context) {
5563
- const typeMap = `${ts16.stringify(clientTypeMapModelsDefinition(context))} & ${clientTypeMapOthersDefinition(context)}`;
5631
+ const typeMap = `${ts18.stringify(clientTypeMapModelsDefinition(context))} & ${clientTypeMapOthersDefinition(context)}`;
5564
5632
  return `
5565
5633
  export interface TypeMapCb<GlobalOmitOptions = {}> extends runtime.Types.Utils.Fn<{extArgs: runtime.Types.Extensions.InternalArgs }, runtime.Types.Utils.Record<string, any>> {
5566
5634
  returns: TypeMap<this['params']['extArgs'], GlobalOmitOptions>
@@ -5569,39 +5637,39 @@ export interface TypeMapCb<GlobalOmitOptions = {}> extends runtime.Types.Utils.F
5569
5637
  export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> = ${typeMap}`;
5570
5638
  }
5571
5639
  function clientTypeMapModelsDefinition(context) {
5572
- const meta = ts16.objectType();
5640
+ const meta = ts18.objectType();
5573
5641
  const modelNames = context.dmmf.datamodel.models.map((m) => m.name);
5574
5642
  if (modelNames.length === 0) {
5575
- meta.add(ts16.property("modelProps", ts16.neverType));
5643
+ meta.add(ts18.property("modelProps", ts18.neverType));
5576
5644
  } else {
5577
- meta.add(ts16.property("modelProps", ts16.unionType(modelNames.map((name) => ts16.stringLiteral(uncapitalize8(name))))));
5645
+ meta.add(ts18.property("modelProps", ts18.unionType(modelNames.map((name) => ts18.stringLiteral(uncapitalize8(name))))));
5578
5646
  }
5579
- const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? ts16.namedType("TransactionIsolationLevel") : ts16.neverType;
5580
- meta.add(ts16.property("txIsolationLevel", isolationLevel));
5581
- const model = ts16.objectType();
5647
+ const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? ts18.namedType("TransactionIsolationLevel") : ts18.neverType;
5648
+ meta.add(ts18.property("txIsolationLevel", isolationLevel));
5649
+ const model = ts18.objectType();
5582
5650
  model.addMultiple(
5583
5651
  modelNames.map((modelName) => {
5584
- const entry = ts16.objectType();
5652
+ const entry = ts18.objectType();
5585
5653
  entry.add(
5586
- ts16.property("payload", ts16.namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument()))
5654
+ ts18.property("payload", ts18.namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument()))
5587
5655
  );
5588
- entry.add(ts16.property("fields", ts16.namedType(`Prisma.${getFieldRefsTypeName(modelName)}`)));
5656
+ entry.add(ts18.property("fields", ts18.namedType(`Prisma.${getFieldRefsTypeName(modelName)}`)));
5589
5657
  const actions = getModelActions(context.dmmf, modelName);
5590
- const operations = ts16.objectType();
5658
+ const operations = ts18.objectType();
5591
5659
  operations.addMultiple(
5592
5660
  actions.map((action) => {
5593
- const operationType = ts16.objectType();
5661
+ const operationType = ts18.objectType();
5594
5662
  const argsType = `Prisma.${getModelArgName(modelName, action)}`;
5595
- operationType.add(ts16.property("args", ts16.namedType(argsType).addGenericArgument(extArgsParam.toArgument())));
5596
- operationType.add(ts16.property("result", clientTypeMapModelsResultDefinition(modelName, action)));
5597
- return ts16.property(action, operationType);
5663
+ operationType.add(ts18.property("args", ts18.namedType(argsType).addGenericArgument(extArgsParam.toArgument())));
5664
+ operationType.add(ts18.property("result", clientTypeMapModelsResultDefinition(modelName, action)));
5665
+ return ts18.property(action, operationType);
5598
5666
  })
5599
5667
  );
5600
- entry.add(ts16.property("operations", operations));
5601
- return ts16.property(modelName, entry);
5668
+ entry.add(ts18.property("operations", operations));
5669
+ return ts18.property(modelName, entry);
5602
5670
  })
5603
5671
  );
5604
- return ts16.objectType().add(ts16.property("globalOmitOptions", ts16.objectType().add(ts16.property("omit", ts16.namedType("GlobalOmitOptions"))))).add(ts16.property("meta", meta)).add(ts16.property("model", model));
5672
+ return ts18.objectType().add(ts18.property("globalOmitOptions", ts18.objectType().add(ts18.property("omit", ts18.namedType("GlobalOmitOptions"))))).add(ts18.property("meta", meta)).add(ts18.property("model", model));
5605
5673
  }
5606
5674
  function clientTypeMapOthersDefinition(context) {
5607
5675
  const otherOperationsNames = context.dmmf.getOtherOperationNames().flatMap((name) => {
@@ -5638,19 +5706,19 @@ function clientTypeMapOthersDefinition(context) {
5638
5706
  }
5639
5707
  function clientTypeMapModelsResultDefinition(modelName, action) {
5640
5708
  if (action === "count")
5641
- return ts16.unionType([optional(ts16.namedType(`Prisma.${getCountAggregateOutputName(modelName)}`)), ts16.numberType]);
5642
- if (action === "groupBy") return ts16.array(optional(ts16.namedType(`Prisma.${getGroupByName(modelName)}`)));
5643
- if (action === "aggregate") return optional(ts16.namedType(`Prisma.${getAggregateName(modelName)}`));
5644
- if (action === "findRaw") return ts16.namedType("Prisma.JsonObject");
5645
- if (action === "aggregateRaw") return ts16.namedType("Prisma.JsonObject");
5646
- if (action === "deleteMany") return ts16.namedType("BatchPayload");
5647
- if (action === "createMany") return ts16.namedType("BatchPayload");
5648
- if (action === "createManyAndReturn") return ts16.array(payloadToResult(modelName));
5649
- if (action === "updateMany") return ts16.namedType("BatchPayload");
5650
- if (action === "updateManyAndReturn") return ts16.array(payloadToResult(modelName));
5651
- if (action === "findMany") return ts16.array(payloadToResult(modelName));
5652
- if (action === "findFirst") return ts16.unionType([payloadToResult(modelName), ts16.nullType]);
5653
- if (action === "findUnique") return ts16.unionType([payloadToResult(modelName), ts16.nullType]);
5709
+ return ts18.unionType([optional(ts18.namedType(`Prisma.${getCountAggregateOutputName(modelName)}`)), ts18.numberType]);
5710
+ if (action === "groupBy") return ts18.array(optional(ts18.namedType(`Prisma.${getGroupByName(modelName)}`)));
5711
+ if (action === "aggregate") return optional(ts18.namedType(`Prisma.${getAggregateName(modelName)}`));
5712
+ if (action === "findRaw") return ts18.namedType("Prisma.JsonObject");
5713
+ if (action === "aggregateRaw") return ts18.namedType("Prisma.JsonObject");
5714
+ if (action === "deleteMany") return ts18.namedType("BatchPayload");
5715
+ if (action === "createMany") return ts18.namedType("BatchPayload");
5716
+ if (action === "createManyAndReturn") return ts18.array(payloadToResult(modelName));
5717
+ if (action === "updateMany") return ts18.namedType("BatchPayload");
5718
+ if (action === "updateManyAndReturn") return ts18.array(payloadToResult(modelName));
5719
+ if (action === "findMany") return ts18.array(payloadToResult(modelName));
5720
+ if (action === "findFirst") return ts18.unionType([payloadToResult(modelName), ts18.nullType]);
5721
+ if (action === "findUnique") return ts18.unionType([payloadToResult(modelName), ts18.nullType]);
5654
5722
  if (action === "findFirstOrThrow") return payloadToResult(modelName);
5655
5723
  if (action === "findUniqueOrThrow") return payloadToResult(modelName);
5656
5724
  if (action === "create") return payloadToResult(modelName);
@@ -5660,11 +5728,11 @@ function clientTypeMapModelsResultDefinition(modelName, action) {
5660
5728
  assertNever2(action, `Unknown action: ${action}`);
5661
5729
  }
5662
5730
  function payloadToResult(modelName) {
5663
- return ts16.namedType("runtime.Types.Utils.PayloadToResult").addGenericArgument(ts16.namedType(getPayloadName(modelName)));
5731
+ return ts18.namedType("runtime.Types.Utils.PayloadToResult").addGenericArgument(ts18.namedType(getPayloadName(modelName)));
5664
5732
  }
5665
5733
 
5666
5734
  // src/TSClient/file-generators/PrismaNamespaceFile.ts
5667
- var jsDocHeader6 = `/*
5735
+ var jsDocHeader8 = `/*
5668
5736
  * WARNING: This is an internal file that is subject to change!
5669
5737
  *
5670
5738
  * \u{1F6D1} Under no circumstances should you import this file directly! \u{1F6D1}
@@ -5678,13 +5746,13 @@ var jsDocHeader6 = `/*
5678
5746
  `;
5679
5747
  function createPrismaNamespaceFile(context, options) {
5680
5748
  const imports = [
5681
- ts17.moduleImport(context.runtimeImport).asNamespace("runtime"),
5682
- ts17.moduleImport(context.importFileName(`../models`)).asNamespace("Prisma").typeOnly(),
5683
- ts17.moduleImport(context.importFileName(`./class`)).named(ts17.namedImport("PrismaClient").typeOnly())
5684
- ].map((i) => ts17.stringify(i));
5749
+ ts19.moduleImport(context.runtimeImport).asNamespace("runtime"),
5750
+ ts19.moduleImport(context.importFileName(`../models`)).asNamespace("Prisma").typeOnly(),
5751
+ ts19.moduleImport(context.importFileName(`./class`)).named(ts19.namedImport("PrismaClient").typeOnly())
5752
+ ].map((i) => ts19.stringify(i));
5685
5753
  const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
5686
5754
  const fieldRefs = context.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
5687
- return `${jsDocHeader6}
5755
+ return `${jsDocHeader8}
5688
5756
  ${imports.join("\n")}
5689
5757
 
5690
5758
  export type * from '${context.importFileName(`../models`)}'
@@ -5724,8 +5792,8 @@ ${new Datasources(options.datasources).toTS()}
5724
5792
  ${clientExtensionsDefinitions()}
5725
5793
  export type DefaultPrismaClient = PrismaClient
5726
5794
  export type ErrorFormat = 'pretty' | 'colorless' | 'minimal'
5727
- ${ts17.stringify(ts17.moduleExport(buildClientOptions(context, options)))}
5728
- ${ts17.stringify(globalOmitConfig(context.dmmf))}
5795
+ ${ts19.stringify(ts19.moduleExport(buildClientOptions(context, options)))}
5796
+ ${ts19.stringify(globalOmitConfig(context.dmmf))}
5729
5797
 
5730
5798
  /* Types for Logging */
5731
5799
  export type LogLevel = 'info' | 'query' | 'warn' | 'error'
@@ -5791,24 +5859,24 @@ export type TransactionClient = Omit<DefaultPrismaClient, runtime.ITXClientDenyL
5791
5859
  `;
5792
5860
  }
5793
5861
  function clientExtensionsDefinitions() {
5794
- const define = ts17.moduleExport(
5795
- ts17.constDeclaration("defineExtension").setValue(
5796
- ts17.namedValue("runtime.Extensions.defineExtension").as(ts17.namedType("unknown")).as(
5797
- ts17.namedType("runtime.Types.Extensions.ExtendsHook").addGenericArgument(ts17.stringLiteral("define")).addGenericArgument(ts17.namedType("TypeMapCb")).addGenericArgument(ts17.namedType("runtime.Types.Extensions.DefaultArgs"))
5862
+ const define = ts19.moduleExport(
5863
+ ts19.constDeclaration("defineExtension").setValue(
5864
+ ts19.namedValue("runtime.Extensions.defineExtension").as(ts19.namedType("unknown")).as(
5865
+ ts19.namedType("runtime.Types.Extensions.ExtendsHook").addGenericArgument(ts19.stringLiteral("define")).addGenericArgument(ts19.namedType("TypeMapCb")).addGenericArgument(ts19.namedType("runtime.Types.Extensions.DefaultArgs"))
5798
5866
  )
5799
5867
  )
5800
5868
  );
5801
- return ts17.stringify(define);
5869
+ return ts19.stringify(define);
5802
5870
  }
5803
5871
  function buildClientOptions(context, options) {
5804
- const clientOptions = ts17.interfaceDeclaration("PrismaClientOptions").add(
5805
- ts17.property("datasources", ts17.namedType("Datasources")).optional().setDocComment(ts17.docComment("Overwrites the datasource url from your schema.prisma file"))
5872
+ const clientOptions = ts19.interfaceDeclaration("PrismaClientOptions").add(
5873
+ ts19.property("datasources", ts19.namedType("Datasources")).optional().setDocComment(ts19.docComment("Overwrites the datasource url from your schema.prisma file"))
5806
5874
  ).add(
5807
- ts17.property("datasourceUrl", ts17.stringType).optional().setDocComment(ts17.docComment("Overwrites the datasource url from your schema.prisma file"))
5875
+ ts19.property("datasourceUrl", ts19.stringType).optional().setDocComment(ts19.docComment("Overwrites the datasource url from your schema.prisma file"))
5808
5876
  ).add(
5809
- ts17.property("errorFormat", ts17.namedType("ErrorFormat")).optional().setDocComment(ts17.docComment('@default "colorless"'))
5877
+ ts19.property("errorFormat", ts19.namedType("ErrorFormat")).optional().setDocComment(ts19.docComment('@default "colorless"'))
5810
5878
  ).add(
5811
- ts17.property("log", ts17.array(ts17.unionType([ts17.namedType("LogLevel"), ts17.namedType("LogDefinition")]))).optional().setDocComment(ts17.docComment`
5879
+ ts19.property("log", ts19.array(ts19.unionType([ts19.namedType("LogLevel"), ts19.namedType("LogDefinition")]))).optional().setDocComment(ts19.docComment`
5812
5880
  @example
5813
5881
  \`\`\`
5814
5882
  // Shorthand for \`emit: 'stdout'\`
@@ -5833,12 +5901,12 @@ function buildClientOptions(context, options) {
5833
5901
  Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/logging#the-log-option).
5834
5902
  `)
5835
5903
  );
5836
- const transactionOptions = ts17.objectType().add(ts17.property("maxWait", ts17.numberType).optional()).add(ts17.property("timeout", ts17.numberType).optional());
5904
+ const transactionOptions = ts19.objectType().add(ts19.property("maxWait", ts19.numberType).optional()).add(ts19.property("timeout", ts19.numberType).optional());
5837
5905
  if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
5838
- transactionOptions.add(ts17.property("isolationLevel", ts17.namedType("TransactionIsolationLevel")).optional());
5906
+ transactionOptions.add(ts19.property("isolationLevel", ts19.namedType("TransactionIsolationLevel")).optional());
5839
5907
  }
5840
5908
  clientOptions.add(
5841
- ts17.property("transactionOptions", transactionOptions).optional().setDocComment(ts17.docComment`
5909
+ ts19.property("transactionOptions", transactionOptions).optional().setDocComment(ts19.docComment`
5842
5910
  The default values for transactionOptions
5843
5911
  maxWait ?= 2000
5844
5912
  timeout ?= 5000
@@ -5846,13 +5914,13 @@ function buildClientOptions(context, options) {
5846
5914
  );
5847
5915
  if (["library", "client", "wasm-compiler-edge", "wasm-engine-edge"].includes(options.runtimeName)) {
5848
5916
  clientOptions.add(
5849
- ts17.property("adapter", ts17.unionType([ts17.namedType("runtime.SqlDriverAdapterFactory"), ts17.namedType("null")])).optional().setDocComment(
5850
- ts17.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
5917
+ ts19.property("adapter", ts19.unionType([ts19.namedType("runtime.SqlDriverAdapterFactory"), ts19.namedType("null")])).optional().setDocComment(
5918
+ ts19.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
5851
5919
  )
5852
5920
  );
5853
5921
  }
5854
5922
  clientOptions.add(
5855
- ts17.property("omit", ts17.namedType("GlobalOmitConfig")).optional().setDocComment(ts17.docComment`
5923
+ ts19.property("omit", ts19.namedType("GlobalOmitConfig")).optional().setDocComment(ts19.docComment`
5856
5924
  Global configuration for omitting model fields by default.
5857
5925
 
5858
5926
  @example
@@ -5874,6 +5942,7 @@ function buildClientOptions(context, options) {
5874
5942
  var GenerateContext = class {
5875
5943
  dmmf;
5876
5944
  genericArgsInfo;
5945
+ runtimeBase;
5877
5946
  runtimeImport;
5878
5947
  outputFileName;
5879
5948
  importFileName;
@@ -5881,6 +5950,7 @@ var GenerateContext = class {
5881
5950
  constructor({
5882
5951
  dmmf,
5883
5952
  genericArgsInfo,
5953
+ runtimeBase,
5884
5954
  runtimeImport: runtimeImport2,
5885
5955
  outputFileName,
5886
5956
  importFileName,
@@ -5888,6 +5958,7 @@ var GenerateContext = class {
5888
5958
  }) {
5889
5959
  this.dmmf = dmmf;
5890
5960
  this.genericArgsInfo = genericArgsInfo;
5961
+ this.runtimeBase = runtimeBase;
5891
5962
  this.runtimeImport = runtimeImport2;
5892
5963
  this.outputFileName = outputFileName;
5893
5964
  this.importFileName = importFileName;
@@ -5911,6 +5982,7 @@ var TSClient = class {
5911
5982
  const context = new GenerateContext({
5912
5983
  dmmf: this.dmmf,
5913
5984
  genericArgsInfo: this.genericsInfo,
5985
+ runtimeBase: this.options.runtimeBase,
5914
5986
  runtimeImport: `${this.options.runtimeBase}/${this.options.runtimeName}`,
5915
5987
  outputFileName: generatedFileNameMapper(this.options.generatedFileExtension),
5916
5988
  importFileName: importFileNameMapper(this.options.importFileExtension),
@@ -5923,12 +5995,14 @@ var TSClient = class {
5923
5995
  }, {});
5924
5996
  return {
5925
5997
  [context.outputFileName("client")]: createClientFile(context, this.options),
5998
+ [context.outputFileName("browser")]: createBrowserFile(context, this.options),
5926
5999
  [context.outputFileName("enums")]: createEnumsFile(context),
5927
6000
  [context.outputFileName("commonInputTypes")]: createCommonInputTypeFiles(context),
5928
6001
  [context.outputFileName("models")]: createModelsFile(context, modelNames),
5929
6002
  models: modelsFileMap,
5930
6003
  internal: {
5931
6004
  [context.outputFileName("prismaNamespace")]: createPrismaNamespaceFile(context, this.options),
6005
+ [context.outputFileName("prismaNamespaceBrowser")]: createPrismaNamespaceBrowserFile(context),
5932
6006
  [context.outputFileName("class")]: createClassFile(context, this.options)
5933
6007
  }
5934
6008
  };
@@ -5937,7 +6011,7 @@ var TSClient = class {
5937
6011
 
5938
6012
  // src/typedSql/buildDbEnums.ts
5939
6013
  import { isValidJsIdentifier } from "@prisma/internals";
5940
- import * as ts18 from "@prisma/ts-builders";
6014
+ import * as ts20 from "@prisma/ts-builders";
5941
6015
  var DbEnumsList = class {
5942
6016
  enums;
5943
6017
  constructor(enums) {
@@ -5968,16 +6042,16 @@ var DbEnumsList = class {
5968
6042
  }
5969
6043
  };
5970
6044
  function buildDbEnums(list) {
5971
- const file4 = ts18.file();
5972
- const iface = ts18.interfaceDeclaration("$DbEnums");
6045
+ const file4 = ts20.file();
6046
+ const iface = ts20.interfaceDeclaration("$DbEnums");
5973
6047
  for (const dbEnum of list.enums) {
5974
- iface.add(ts18.property(dbEnum.name, enumToUnion(dbEnum)));
6048
+ iface.add(ts20.property(dbEnum.name, enumToUnion(dbEnum)));
5975
6049
  }
5976
- file4.add(ts18.moduleExport(iface));
5977
- return ts18.stringify(file4);
6050
+ file4.add(ts20.moduleExport(iface));
6051
+ return ts20.stringify(file4);
5978
6052
  }
5979
6053
  function enumToUnion(dbEnum) {
5980
- return ts18.unionType(dbEnum.values.map(ts18.stringLiteral));
6054
+ return ts20.unionType(dbEnum.values.map(ts20.stringLiteral));
5981
6055
  }
5982
6056
  function queryUsesEnums(query, enums) {
5983
6057
  if (enums.isEmpty()) {
@@ -5987,82 +6061,82 @@ function queryUsesEnums(query, enums) {
5987
6061
  }
5988
6062
 
5989
6063
  // src/typedSql/buildIndex.ts
5990
- import * as ts19 from "@prisma/ts-builders";
6064
+ import * as ts21 from "@prisma/ts-builders";
5991
6065
  function buildIndex({ queries, enums, importName }) {
5992
- const file4 = ts19.file();
6066
+ const file4 = ts21.file();
5993
6067
  if (!enums.isEmpty()) {
5994
- file4.add(ts19.moduleExportFrom(importName("./sql/$DbEnums")).named(ts19.namedExport("$DbEnums").typeOnly()));
6068
+ file4.add(ts21.moduleExportFrom(importName("./sql/$DbEnums")).named(ts21.namedExport("$DbEnums").typeOnly()));
5995
6069
  }
5996
6070
  for (const query of queries) {
5997
- file4.add(ts19.moduleExportFrom(importName(`./sql/${query.name}`)));
6071
+ file4.add(ts21.moduleExportFrom(importName(`./sql/${query.name}`)));
5998
6072
  }
5999
- return ts19.stringify(file4);
6073
+ return ts21.stringify(file4);
6000
6074
  }
6001
6075
 
6002
6076
  // src/typedSql/buildTypedQuery.ts
6003
- import * as ts21 from "@prisma/ts-builders";
6077
+ import * as ts23 from "@prisma/ts-builders";
6004
6078
 
6005
6079
  // src/typedSql/mapTypes.ts
6006
- import * as ts20 from "@prisma/ts-builders";
6007
- var decimal = ts20.namedType("$runtime.Decimal");
6008
- var uint8Array = ts20.namedType("Uint8Array");
6009
- var date = ts20.namedType("Date");
6010
- var inputJsonValue = ts20.namedType("$runtime.InputJsonObject");
6011
- var jsonValue = ts20.namedType("$runtime.JsonValue");
6012
- var bigintIn = ts20.unionType([ts20.numberType, ts20.bigintType]);
6013
- var decimalIn = ts20.unionType([ts20.numberType, decimal]);
6080
+ import * as ts22 from "@prisma/ts-builders";
6081
+ var decimal = ts22.namedType("$runtime.Decimal");
6082
+ var uint8Array = ts22.namedType("Uint8Array");
6083
+ var date = ts22.namedType("Date");
6084
+ var inputJsonValue = ts22.namedType("$runtime.InputJsonObject");
6085
+ var jsonValue = ts22.namedType("$runtime.JsonValue");
6086
+ var bigintIn = ts22.unionType([ts22.numberType, ts22.bigintType]);
6087
+ var decimalIn = ts22.unionType([ts22.numberType, decimal]);
6014
6088
  var typeMappings = {
6015
- unknown: ts20.unknownType,
6016
- string: ts20.stringType,
6017
- int: ts20.numberType,
6089
+ unknown: ts22.unknownType,
6090
+ string: ts22.stringType,
6091
+ int: ts22.numberType,
6018
6092
  bigint: {
6019
6093
  in: bigintIn,
6020
- out: ts20.bigintType
6094
+ out: ts22.bigintType
6021
6095
  },
6022
6096
  decimal: {
6023
6097
  in: decimalIn,
6024
6098
  out: decimal
6025
6099
  },
6026
- float: ts20.numberType,
6027
- double: ts20.numberType,
6028
- enum: ts20.stringType,
6100
+ float: ts22.numberType,
6101
+ double: ts22.numberType,
6102
+ enum: ts22.stringType,
6029
6103
  // TODO:
6030
6104
  bytes: uint8Array,
6031
- bool: ts20.booleanType,
6032
- char: ts20.stringType,
6105
+ bool: ts22.booleanType,
6106
+ char: ts22.stringType,
6033
6107
  json: {
6034
6108
  in: inputJsonValue,
6035
6109
  out: jsonValue
6036
6110
  },
6037
- xml: ts20.stringType,
6038
- uuid: ts20.stringType,
6111
+ xml: ts22.stringType,
6112
+ uuid: ts22.stringType,
6039
6113
  date,
6040
6114
  datetime: date,
6041
6115
  time: date,
6042
- null: ts20.nullType,
6043
- "int-array": ts20.array(ts20.numberType),
6044
- "string-array": ts20.array(ts20.stringType),
6116
+ null: ts22.nullType,
6117
+ "int-array": ts22.array(ts22.numberType),
6118
+ "string-array": ts22.array(ts22.stringType),
6045
6119
  "json-array": {
6046
- in: ts20.array(inputJsonValue),
6047
- out: ts20.array(jsonValue)
6120
+ in: ts22.array(inputJsonValue),
6121
+ out: ts22.array(jsonValue)
6048
6122
  },
6049
- "uuid-array": ts20.array(ts20.stringType),
6050
- "xml-array": ts20.array(ts20.stringType),
6123
+ "uuid-array": ts22.array(ts22.stringType),
6124
+ "xml-array": ts22.array(ts22.stringType),
6051
6125
  "bigint-array": {
6052
- in: ts20.array(bigintIn),
6053
- out: ts20.array(ts20.bigintType)
6126
+ in: ts22.array(bigintIn),
6127
+ out: ts22.array(ts22.bigintType)
6054
6128
  },
6055
- "float-array": ts20.array(ts20.numberType),
6056
- "double-array": ts20.array(ts20.numberType),
6057
- "char-array": ts20.array(ts20.stringType),
6058
- "bytes-array": ts20.array(uint8Array),
6059
- "bool-array": ts20.array(ts20.booleanType),
6060
- "date-array": ts20.array(date),
6061
- "time-array": ts20.array(date),
6062
- "datetime-array": ts20.array(date),
6129
+ "float-array": ts22.array(ts22.numberType),
6130
+ "double-array": ts22.array(ts22.numberType),
6131
+ "char-array": ts22.array(ts22.stringType),
6132
+ "bytes-array": ts22.array(uint8Array),
6133
+ "bool-array": ts22.array(ts22.booleanType),
6134
+ "date-array": ts22.array(date),
6135
+ "time-array": ts22.array(date),
6136
+ "datetime-array": ts22.array(date),
6063
6137
  "decimal-array": {
6064
- in: ts20.array(decimalIn),
6065
- out: ts20.array(decimal)
6138
+ in: ts22.array(decimalIn),
6139
+ out: ts22.array(decimal)
6066
6140
  }
6067
6141
  };
6068
6142
  function getInputType(introspectionType, nullable, enums) {
@@ -6070,7 +6144,7 @@ function getInputType(introspectionType, nullable, enums) {
6070
6144
  if (!nullable) {
6071
6145
  return inn;
6072
6146
  } else {
6073
- return new ts20.UnionType(inn).addVariant(ts20.nullType);
6147
+ return new ts22.UnionType(inn).addVariant(ts22.nullType);
6074
6148
  }
6075
6149
  }
6076
6150
  function getOutputType(introspectionType, nullable, enums) {
@@ -6078,7 +6152,7 @@ function getOutputType(introspectionType, nullable, enums) {
6078
6152
  if (!nullable) {
6079
6153
  return out;
6080
6154
  } else {
6081
- return new ts20.UnionType(out).addVariant(ts20.nullType);
6155
+ return new ts22.UnionType(out).addVariant(ts22.nullType);
6082
6156
  }
6083
6157
  }
6084
6158
  function getMappingConfig(introspectionType, enums) {
@@ -6090,29 +6164,29 @@ function getMappingConfig(introspectionType, enums) {
6090
6164
  }
6091
6165
  throw new Error("Unknown type");
6092
6166
  }
6093
- if (config instanceof ts20.TypeBuilder) {
6167
+ if (config instanceof ts22.TypeBuilder) {
6094
6168
  return { in: config, out: config };
6095
6169
  }
6096
6170
  return config;
6097
6171
  }
6098
6172
  function getEnumType(name) {
6099
- return ts20.namedType("$DbEnums").subKey(name);
6173
+ return ts22.namedType("$DbEnums").subKey(name);
6100
6174
  }
6101
6175
 
6102
6176
  // src/typedSql/buildTypedQuery.ts
6103
6177
  function buildTypedQuery({ query, runtimeBase, runtimeName, enums, importName }) {
6104
- const file4 = ts21.file();
6105
- file4.addImport(ts21.moduleImport(`${runtimeBase}/${runtimeName}`).asNamespace("$runtime"));
6178
+ const file4 = ts23.file();
6179
+ file4.addImport(ts23.moduleImport(`${runtimeBase}/${runtimeName}`).asNamespace("$runtime"));
6106
6180
  if (queryUsesEnums(query, enums)) {
6107
- file4.addImport(ts21.moduleImport(importName("./$DbEnums")).named(ts21.namedImport("$DbEnums").typeOnly()));
6181
+ file4.addImport(ts23.moduleImport(importName("./$DbEnums")).named(ts23.namedImport("$DbEnums").typeOnly()));
6108
6182
  }
6109
- const doc = ts21.docComment(query.documentation ?? void 0);
6110
- const factoryType = ts21.functionType();
6111
- const parametersType = ts21.tupleType();
6183
+ const doc = ts23.docComment(query.documentation ?? void 0);
6184
+ const factoryType = ts23.functionType();
6185
+ const parametersType = ts23.tupleType();
6112
6186
  for (const param of query.parameters) {
6113
6187
  const paramType = getInputType(param.typ, param.nullable, enums);
6114
- factoryType.addParameter(ts21.parameter(param.name, paramType));
6115
- parametersType.add(ts21.tupleItem(paramType).setName(param.name));
6188
+ factoryType.addParameter(ts23.parameter(param.name, paramType));
6189
+ parametersType.add(ts23.tupleItem(paramType).setName(param.name));
6116
6190
  if (param.documentation) {
6117
6191
  doc.addText(`@param ${param.name} ${param.documentation}`);
6118
6192
  } else {
@@ -6120,26 +6194,26 @@ function buildTypedQuery({ query, runtimeBase, runtimeName, enums, importName })
6120
6194
  }
6121
6195
  }
6122
6196
  factoryType.setReturnType(
6123
- ts21.namedType("$runtime.TypedSql").addGenericArgument(ts21.namedType(`${query.name}.Parameters`)).addGenericArgument(ts21.namedType(`${query.name}.Result`))
6197
+ ts23.namedType("$runtime.TypedSql").addGenericArgument(ts23.namedType(`${query.name}.Parameters`)).addGenericArgument(ts23.namedType(`${query.name}.Result`))
6124
6198
  );
6125
6199
  file4.add(
6126
- ts21.moduleExport(
6127
- ts21.constDeclaration(query.name).setValue(
6128
- ts21.functionCall("$runtime.makeTypedQueryFactory").addArgument(ts21.stringLiteral(query.source).asValue()).as(factoryType)
6200
+ ts23.moduleExport(
6201
+ ts23.constDeclaration(query.name).setValue(
6202
+ ts23.functionCall("$runtime.makeTypedQueryFactory").addArgument(ts23.stringLiteral(query.source).asValue()).as(factoryType)
6129
6203
  )
6130
6204
  ).setDocComment(doc)
6131
6205
  );
6132
- const namespace2 = ts21.namespace(query.name);
6133
- namespace2.add(ts21.moduleExport(ts21.typeDeclaration("Parameters", parametersType)));
6206
+ const namespace2 = ts23.namespace(query.name);
6207
+ namespace2.add(ts23.moduleExport(ts23.typeDeclaration("Parameters", parametersType)));
6134
6208
  namespace2.add(buildResultType(query, enums));
6135
- file4.add(ts21.moduleExport(namespace2));
6136
- return ts21.stringify(file4);
6209
+ file4.add(ts23.moduleExport(namespace2));
6210
+ return ts23.stringify(file4);
6137
6211
  }
6138
6212
  function buildResultType(query, enums) {
6139
- const type = ts21.objectType().addMultiple(
6140
- query.resultColumns.map((column) => ts21.property(column.name, getOutputType(column.typ, column.nullable, enums)))
6213
+ const type = ts23.objectType().addMultiple(
6214
+ query.resultColumns.map((column) => ts23.property(column.name, getOutputType(column.typ, column.nullable, enums)))
6141
6215
  );
6142
- return ts21.moduleExport(ts21.typeDeclaration("Result", type));
6216
+ return ts23.moduleExport(ts23.typeDeclaration("Result", type));
6143
6217
  }
6144
6218
 
6145
6219
  // src/typedSql/typedSql.ts
@@ -6214,7 +6288,7 @@ function buildClient({
6214
6288
  moduleFormat,
6215
6289
  tsNoCheckPreamble: tsNoCheckPreamble2
6216
6290
  }) {
6217
- const clientEngineType = getClientEngineType3(generator);
6291
+ const clientEngineType = getClientEngineType4(generator);
6218
6292
  const runtimeName = getRuntimeNameForTarget(target, clientEngineType, generator.previewFeatures);
6219
6293
  const outputName = generatedFileNameMapper(generatedFileExtension);
6220
6294
  const importName = importFileNameMapper(importFileExtension);
@@ -6307,7 +6381,7 @@ async function generateClient(options) {
6307
6381
  moduleFormat,
6308
6382
  tsNoCheckPreamble: tsNoCheckPreamble2
6309
6383
  } = options;
6310
- const clientEngineType = getClientEngineType3(generator);
6384
+ const clientEngineType = getClientEngineType4(generator);
6311
6385
  const { runtimeBase, outputDir } = await getGenerationDirs(options);
6312
6386
  const { prismaClientDmmf, fileMap } = buildClient({
6313
6387
  datamodel,
@@ -6532,12 +6606,12 @@ async function deleteOutputDir(outputDir) {
6532
6606
  // src/generator.ts
6533
6607
  import { Debug as Debug2 } from "@prisma/debug";
6534
6608
  import { enginesVersion } from "@prisma/engines-version";
6535
- import { ClientEngineType as ClientEngineType4, getClientEngineType as getClientEngineType4, parseEnvValue } from "@prisma/internals";
6609
+ import { ClientEngineType as ClientEngineType4, getClientEngineType as getClientEngineType5, parseEnvValue } from "@prisma/internals";
6536
6610
  import { getTsconfig } from "get-tsconfig";
6537
6611
  import { match as match2 } from "ts-pattern";
6538
6612
 
6539
6613
  // package.json
6540
- var version = "6.16.0-dev.36";
6614
+ var version = "6.16.0-dev.37";
6541
6615
 
6542
6616
  // src/module-format.ts
6543
6617
  function parseModuleFormat(format) {
@@ -6638,7 +6712,7 @@ function getOutputPath(config) {
6638
6712
  var PrismaClientTsGenerator = class {
6639
6713
  name = "prisma-client-ts";
6640
6714
  getManifest(config) {
6641
- const requiresEngines = match2(getClientEngineType4(config)).with(ClientEngineType4.Library, () => ["libqueryEngine"]).with(ClientEngineType4.Binary, () => ["queryEngine"]).with(ClientEngineType4.Client, () => []).exhaustive();
6715
+ const requiresEngines = match2(getClientEngineType5(config)).with(ClientEngineType4.Library, () => ["libqueryEngine"]).with(ClientEngineType4.Binary, () => ["queryEngine"]).with(ClientEngineType4.Client, () => []).exhaustive();
6642
6716
  debug2("requiresEngines", requiresEngines);
6643
6717
  return Promise.resolve({
6644
6718
  defaultOutput: getOutputPath(config),