prisma 6.4.0-dev.15 → 6.4.0-dev.17

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.
@@ -33,18 +33,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
- // ../../node_modules/.pnpm/@prisma+engines-version@6.4.0-4.e2a33755136ec1c2b3a5d7d322f86a8fb1205a40/node_modules/@prisma/engines-version/package.json
36
+ // ../../node_modules/.pnpm/@prisma+engines-version@6.4.0-6.ea0929672a4a933a7dbc5b2f9031bb90560f894e/node_modules/@prisma/engines-version/package.json
37
37
  var require_package = __commonJS({
38
- "../../node_modules/.pnpm/@prisma+engines-version@6.4.0-4.e2a33755136ec1c2b3a5d7d322f86a8fb1205a40/node_modules/@prisma/engines-version/package.json"(exports2, module2) {
38
+ "../../node_modules/.pnpm/@prisma+engines-version@6.4.0-6.ea0929672a4a933a7dbc5b2f9031bb90560f894e/node_modules/@prisma/engines-version/package.json"(exports2, module2) {
39
39
  module2.exports = {
40
40
  name: "@prisma/engines-version",
41
- version: "6.4.0-4.e2a33755136ec1c2b3a5d7d322f86a8fb1205a40",
41
+ version: "6.4.0-6.ea0929672a4a933a7dbc5b2f9031bb90560f894e",
42
42
  main: "index.js",
43
43
  types: "index.d.ts",
44
44
  license: "Apache-2.0",
45
45
  author: "Tim Suchanek <suchanek@prisma.io>",
46
46
  prisma: {
47
- enginesVersion: "e2a33755136ec1c2b3a5d7d322f86a8fb1205a40"
47
+ enginesVersion: "ea0929672a4a933a7dbc5b2f9031bb90560f894e"
48
48
  },
49
49
  repository: {
50
50
  type: "git",
@@ -66,9 +66,9 @@ var require_package = __commonJS({
66
66
  }
67
67
  });
68
68
 
69
- // ../../node_modules/.pnpm/@prisma+engines-version@6.4.0-4.e2a33755136ec1c2b3a5d7d322f86a8fb1205a40/node_modules/@prisma/engines-version/index.js
69
+ // ../../node_modules/.pnpm/@prisma+engines-version@6.4.0-6.ea0929672a4a933a7dbc5b2f9031bb90560f894e/node_modules/@prisma/engines-version/index.js
70
70
  var require_engines_version = __commonJS({
71
- "../../node_modules/.pnpm/@prisma+engines-version@6.4.0-4.e2a33755136ec1c2b3a5d7d322f86a8fb1205a40/node_modules/@prisma/engines-version/index.js"(exports2) {
71
+ "../../node_modules/.pnpm/@prisma+engines-version@6.4.0-6.ea0929672a4a933a7dbc5b2f9031bb90560f894e/node_modules/@prisma/engines-version/index.js"(exports2) {
72
72
  "use strict";
73
73
  Object.defineProperty(exports2, "__esModule", { value: true });
74
74
  exports2.enginesVersion = void 0;
@@ -3946,7 +3946,7 @@ var require_package2 = __commonJS({
3946
3946
  "package.json"(exports2, module2) {
3947
3947
  module2.exports = {
3948
3948
  name: "@prisma/client",
3949
- version: "6.4.0-dev.15",
3949
+ version: "6.4.0-dev.17",
3950
3950
  description: "Prisma Client is an auto-generated, type-safe and modern JavaScript/TypeScript ORM for Node.js that's tailored to your data. Supports PostgreSQL, CockroachDB, MySQL, MariaDB, SQL Server, SQLite & MongoDB databases.",
3951
3951
  keywords: [
3952
3952
  "ORM",
@@ -4130,10 +4130,10 @@ var require_package2 = __commonJS({
4130
4130
  "@libsql/client": "0.8.0",
4131
4131
  "@neondatabase/serverless": "0.10.2",
4132
4132
  "@opentelemetry/api": "1.9.0",
4133
- "@opentelemetry/context-async-hooks": "1.29.0",
4134
- "@opentelemetry/instrumentation": "0.56.0",
4135
- "@opentelemetry/resources": "1.29.0",
4136
- "@opentelemetry/sdk-trace-base": "1.29.0",
4133
+ "@opentelemetry/context-async-hooks": "1.30.1",
4134
+ "@opentelemetry/instrumentation": "0.57.1",
4135
+ "@opentelemetry/resources": "1.30.1",
4136
+ "@opentelemetry/sdk-trace-base": "1.30.1",
4137
4137
  "@opentelemetry/semantic-conventions": "1.28.0",
4138
4138
  "@planetscale/database": "1.18.0",
4139
4139
  "@prisma/adapter-d1": "workspace:*",
@@ -4145,7 +4145,7 @@ var require_package2 = __commonJS({
4145
4145
  "@prisma/debug": "workspace:*",
4146
4146
  "@prisma/driver-adapter-utils": "workspace:*",
4147
4147
  "@prisma/engines": "workspace:*",
4148
- "@prisma/engines-version": "6.4.0-4.e2a33755136ec1c2b3a5d7d322f86a8fb1205a40",
4148
+ "@prisma/engines-version": "6.4.0-6.ea0929672a4a933a7dbc5b2f9031bb90560f894e",
4149
4149
  "@prisma/fetch-engine": "workspace:*",
4150
4150
  "@prisma/generator-helper": "workspace:*",
4151
4151
  "@prisma/get-platform": "workspace:*",
@@ -4154,8 +4154,8 @@ var require_package2 = __commonJS({
4154
4154
  "@prisma/migrate": "workspace:*",
4155
4155
  "@prisma/mini-proxy": "0.9.5",
4156
4156
  "@prisma/pg-worker": "workspace:*",
4157
- "@prisma/query-compiler-wasm": "6.4.0-4.e2a33755136ec1c2b3a5d7d322f86a8fb1205a40",
4158
- "@prisma/query-engine-wasm": "6.4.0-4.e2a33755136ec1c2b3a5d7d322f86a8fb1205a40",
4157
+ "@prisma/query-compiler-wasm": "6.4.0-6.ea0929672a4a933a7dbc5b2f9031bb90560f894e",
4158
+ "@prisma/query-engine-wasm": "6.4.0-6.ea0929672a4a933a7dbc5b2f9031bb90560f894e",
4159
4159
  "@snaplet/copycat": "0.17.3",
4160
4160
  "@swc-node/register": "1.10.9",
4161
4161
  "@swc/core": "1.10.11",
@@ -4171,7 +4171,7 @@ var require_package2 = __commonJS({
4171
4171
  arg: "5.0.2",
4172
4172
  benchmark: "2.1.4",
4173
4173
  "ci-info": "4.0.0",
4174
- "decimal.js": "10.4.3",
4174
+ "decimal.js": "10.5.0",
4175
4175
  "detect-runtime": "1.0.4",
4176
4176
  "env-paths": "2.2.1",
4177
4177
  esbuild: "0.24.2",
@@ -4191,7 +4191,7 @@ var require_package2 = __commonJS({
4191
4191
  kleur: "4.1.5",
4192
4192
  klona: "2.0.6",
4193
4193
  mariadb: "3.3.1",
4194
- memfs: "4.15.0",
4194
+ memfs: "4.17.0",
4195
4195
  mssql: "11.0.1",
4196
4196
  "new-github-issue-url": "0.2.1",
4197
4197
  "node-fetch": "3.3.2",
@@ -4212,7 +4212,7 @@ var require_package2 = __commonJS({
4212
4212
  "ts-pattern": "5.6.2",
4213
4213
  tsd: "0.31.2",
4214
4214
  typescript: "5.4.5",
4215
- undici: "7.2.3",
4215
+ undici: "7.3.0",
4216
4216
  wrangler: "3.91.0",
4217
4217
  zx: "7.2.3"
4218
4218
  },
@@ -5016,7 +5016,7 @@ var Debug = new Proxy(debugCreate, {
5016
5016
  get: (_, prop) => topProps[prop],
5017
5017
  set: (_, prop, value) => topProps[prop] = value
5018
5018
  });
5019
- function safeStringify(value, indent8 = 2) {
5019
+ function safeStringify(value, indent9 = 2) {
5020
5020
  const cache = /* @__PURE__ */ new Set();
5021
5021
  return JSON.stringify(
5022
5022
  value,
@@ -5031,7 +5031,7 @@ function safeStringify(value, indent8 = 2) {
5031
5031
  }
5032
5032
  return value2;
5033
5033
  },
5034
- indent8
5034
+ indent9
5035
5035
  );
5036
5036
  }
5037
5037
  var src_default = Debug;
@@ -5696,9 +5696,9 @@ function docCommentTag(strings, args) {
5696
5696
  if (lines.length === 0) {
5697
5697
  return docComment2;
5698
5698
  }
5699
- const indent8 = getIndent(lines[0]);
5699
+ const indent9 = getIndent(lines[0]);
5700
5700
  for (const line of lines) {
5701
- docComment2.addText(line.slice(indent8));
5701
+ docComment2.addText(line.slice(indent9));
5702
5702
  }
5703
5703
  return docComment2;
5704
5704
  }
@@ -5724,11 +5724,11 @@ function isEmptyLine(line) {
5724
5724
  return line.trim().length === 0;
5725
5725
  }
5726
5726
  function getIndent(line) {
5727
- let indent8 = 0;
5728
- while (line[indent8] === " ") {
5729
- indent8++;
5727
+ let indent9 = 0;
5728
+ while (line[indent9] === " ") {
5729
+ indent9++;
5730
5730
  }
5731
- return indent8;
5731
+ return indent9;
5732
5732
  }
5733
5733
 
5734
5734
  // src/generation/ts-builders/Export.ts
@@ -6786,8 +6786,6 @@ function buildSingleFieldType(t, genericsInfo, source) {
6786
6786
  return union.mapVariants((variant) => array(variant));
6787
6787
  }
6788
6788
  return union;
6789
- } else if (t.namespace === "prisma") {
6790
- type = namedInputType(`Prisma.${t.type}`);
6791
6789
  } else {
6792
6790
  type = namedInputType(scalarType ?? t.type);
6793
6791
  }
@@ -6820,7 +6818,7 @@ function buildAllFieldTypes(inputTypes, context, source) {
6820
6818
  return unionType(xorTypes(tsInputObjectTypes)).addVariants(tsOtherTypes);
6821
6819
  }
6822
6820
  function xorTypes(types) {
6823
- return types.reduce((prev, curr) => namedType("Prisma.XOR").addGenericArgument(prev).addGenericArgument(curr));
6821
+ return types.reduce((prev, curr) => namedType("XOR").addGenericArgument(prev).addGenericArgument(curr));
6824
6822
  }
6825
6823
  var InputType = class {
6826
6824
  constructor(type, context) {
@@ -7422,14 +7420,8 @@ var ArgsTypeBuilder = class {
7422
7420
  this.addProperty(
7423
7421
  property(
7424
7422
  "select",
7425
- unionType([
7426
- namedType(`Prisma.${selectTypeName}`).addGenericArgument(extArgsParam.toArgument()),
7427
- nullType
7428
- ])
7429
- ).optional().setDocComment(
7430
- docComment(`Select specific fields to fetch
7431
- from the ${this.type.name}`)
7432
- )
7423
+ unionType([namedType(selectTypeName).addGenericArgument(extArgsParam.toArgument()), nullType])
7424
+ ).optional().setDocComment(docComment(`Select specific fields to fetch from the ${this.type.name}`))
7433
7425
  );
7434
7426
  return this;
7435
7427
  }
@@ -7441,10 +7433,7 @@ var ArgsTypeBuilder = class {
7441
7433
  this.addProperty(
7442
7434
  property(
7443
7435
  "include",
7444
- unionType([
7445
- namedType(`Prisma.${includeTypeName}`).addGenericArgument(extArgsParam.toArgument()),
7446
- nullType
7447
- ])
7436
+ unionType([namedType(includeTypeName).addGenericArgument(extArgsParam.toArgument()), nullType])
7448
7437
  ).optional().setDocComment(docComment("Choose, which related nodes to fetch as well"))
7449
7438
  );
7450
7439
  return this;
@@ -7454,7 +7443,7 @@ var ArgsTypeBuilder = class {
7454
7443
  property(
7455
7444
  "omit",
7456
7445
  unionType([
7457
- namedType(`Prisma.${getOmitName(this.type.name)}`).addGenericArgument(extArgsParam.toArgument()),
7446
+ namedType(getOmitName(this.type.name)).addGenericArgument(extArgsParam.toArgument()),
7458
7447
  nullType
7459
7448
  ])
7460
7449
  ).optional().setDocComment(docComment(`Omit specific fields from the ${this.type.name}`))
@@ -7497,7 +7486,7 @@ ${this.stringifyFields()}
7497
7486
  return this.outputType.fields.filter((field) => field.outputType.location !== "outputObjectTypes").map((field) => {
7498
7487
  const fieldOutput = field.outputType;
7499
7488
  const refTypeName = getRefAllowedTypeName(fieldOutput);
7500
- return ` readonly ${field.name}: Prisma.FieldRef<"${name}", ${refTypeName}>`;
7489
+ return ` readonly ${field.name}: FieldRef<"${name}", ${refTypeName}>`;
7501
7490
  }).join("\n");
7502
7491
  }
7503
7492
  };
@@ -7640,7 +7629,7 @@ function buildSelectOrIncludeObject(modelName, fields, context) {
7640
7629
  for (const field of fields) {
7641
7630
  const fieldType = unionType(booleanType);
7642
7631
  if (field.outputType.location === "outputObjectTypes") {
7643
- const subSelectType = namedType(`Prisma.${getFieldArgName(field, modelName)}`);
7632
+ const subSelectType = namedType(getFieldArgName(field, modelName));
7644
7633
  subSelectType.addGenericArgument(extArgsParam.toArgument());
7645
7634
  fieldType.addVariant(subSelectType);
7646
7635
  }
@@ -7778,13 +7767,13 @@ ${stringify(buildOutputType(groupByType))}
7778
7767
 
7779
7768
  type ${getGroupByPayloadName(model.name)}<T extends ${groupByArgsName}> = Prisma.PrismaPromise<
7780
7769
  Array<
7781
- Prisma.PickEnumerable<${groupByType.name}, T['by']> &
7770
+ PickEnumerable<${groupByType.name}, T['by']> &
7782
7771
  {
7783
7772
  [P in ((keyof T) & (keyof ${groupByType.name}))]: P extends '_count'
7784
7773
  ? T[P] extends boolean
7785
7774
  ? number
7786
- : Prisma.GetScalarType<T[P], ${groupByType.name}[P]>
7787
- : Prisma.GetScalarType<T[P], ${groupByType.name}[P]>
7775
+ : GetScalarType<T[P], ${groupByType.name}[P]>
7776
+ : GetScalarType<T[P], ${groupByType.name}[P]>
7788
7777
  }
7789
7778
  >
7790
7779
  >
@@ -7876,13 +7865,10 @@ export type ${getAggregateGetName(model.name)}<T extends ${getAggregateArgsName(
7876
7865
  [P in keyof T & keyof ${aggregateName}]: P extends '_count' | 'count'
7877
7866
  ? T[P] extends true
7878
7867
  ? number
7879
- : Prisma.GetScalarType<T[P], ${aggregateName}[P]>
7880
- : Prisma.GetScalarType<T[P], ${aggregateName}[P]>
7868
+ : GetScalarType<T[P], ${aggregateName}[P]>
7869
+ : GetScalarType<T[P], ${aggregateName}[P]>
7881
7870
  }`;
7882
7871
  }
7883
- fileName() {
7884
- return `${this.model.name}.d.ts`;
7885
- }
7886
7872
  toTSWithoutNamespace() {
7887
7873
  const { model } = this;
7888
7874
  const docLines = model.documentation ?? "";
@@ -8030,39 +8016,39 @@ ${nonAggregateActions.map((action) => {
8030
8016
 
8031
8017
  ${availableActions.includes(DMMF.ModelAction.aggregate) ? `${(0, import_indent_string3.default)(getMethodJSDoc(DMMF.ModelAction.count, mapping, modelOrType), TAB_SIZE)}
8032
8018
  count<T extends ${countArgsName}>(
8033
- args?: Prisma.Subset<T, ${countArgsName}>,
8019
+ args?: Subset<T, ${countArgsName}>,
8034
8020
  ): Prisma.PrismaPromise<
8035
8021
  T extends $Utils.Record<'select', any>
8036
8022
  ? T['select'] extends true
8037
8023
  ? number
8038
- : Prisma.GetScalarType<T['select'], ${getCountAggregateOutputName(name)}>
8024
+ : GetScalarType<T['select'], ${getCountAggregateOutputName(name)}>
8039
8025
  : number
8040
8026
  >
8041
8027
  ` : ""}
8042
8028
  ${availableActions.includes(DMMF.ModelAction.aggregate) ? `${(0, import_indent_string3.default)(getMethodJSDoc(DMMF.ModelAction.aggregate, mapping, modelOrType), TAB_SIZE)}
8043
- aggregate<T extends ${getAggregateArgsName(name)}>(args: Prisma.Subset<T, ${getAggregateArgsName(
8029
+ aggregate<T extends ${getAggregateArgsName(name)}>(args: Subset<T, ${getAggregateArgsName(
8044
8030
  name
8045
8031
  )}>): Prisma.PrismaPromise<${getAggregateGetName(name)}<T>>
8046
8032
  ` : ""}
8047
8033
  ${availableActions.includes(DMMF.ModelAction.groupBy) ? `${(0, import_indent_string3.default)(getMethodJSDoc(DMMF.ModelAction.groupBy, mapping, modelOrType), TAB_SIZE)}
8048
8034
  groupBy<
8049
8035
  T extends ${groupByArgsName},
8050
- HasSelectOrTake extends Prisma.Or<
8051
- Prisma.Extends<'skip', Prisma.Keys<T>>,
8052
- Prisma.Extends<'take', Prisma.Keys<T>>
8036
+ HasSelectOrTake extends Or<
8037
+ Extends<'skip', Keys<T>>,
8038
+ Extends<'take', Keys<T>>
8053
8039
  >,
8054
- OrderByArg extends Prisma.True extends HasSelectOrTake
8040
+ OrderByArg extends True extends HasSelectOrTake
8055
8041
  ? { orderBy: ${groupByArgsName}['orderBy'] }
8056
8042
  : { orderBy?: ${groupByArgsName}['orderBy'] },
8057
- OrderFields extends Prisma.ExcludeUnderscoreKeys<Prisma.Keys<Prisma.MaybeTupleToUnion<T['orderBy']>>>,
8058
- ByFields extends Prisma.MaybeTupleToUnion<T['by']>,
8059
- ByValid extends Prisma.Has<ByFields, OrderFields>,
8060
- HavingFields extends Prisma.GetHavingFields<T['having']>,
8061
- HavingValid extends Prisma.Has<ByFields, HavingFields>,
8062
- ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False,
8063
- InputErrors extends ByEmpty extends Prisma.True
8043
+ OrderFields extends ExcludeUnderscoreKeys<Keys<MaybeTupleToUnion<T['orderBy']>>>,
8044
+ ByFields extends MaybeTupleToUnion<T['by']>,
8045
+ ByValid extends Has<ByFields, OrderFields>,
8046
+ HavingFields extends GetHavingFields<T['having']>,
8047
+ HavingValid extends Has<ByFields, HavingFields>,
8048
+ ByEmpty extends T['by'] extends never[] ? True : False,
8049
+ InputErrors extends ByEmpty extends True
8064
8050
  ? \`Error: "by" must not be empty.\`
8065
- : HavingValid extends Prisma.False
8051
+ : HavingValid extends False
8066
8052
  ? {
8067
8053
  [P in HavingFields]: P extends ByFields
8068
8054
  ? never
@@ -8075,9 +8061,9 @@ ${availableActions.includes(DMMF.ModelAction.groupBy) ? `${(0, import_indent_str
8075
8061
  \` in "having" needs to be provided in "by"\`,
8076
8062
  ]
8077
8063
  }[HavingFields]
8078
- : 'take' extends Prisma.Keys<T>
8079
- ? 'orderBy' extends Prisma.Keys<T>
8080
- ? ByValid extends Prisma.True
8064
+ : 'take' extends Keys<T>
8065
+ ? 'orderBy' extends Keys<T>
8066
+ ? ByValid extends True
8081
8067
  ? {}
8082
8068
  : {
8083
8069
  [P in OrderFields]: P extends ByFields
@@ -8085,9 +8071,9 @@ ${availableActions.includes(DMMF.ModelAction.groupBy) ? `${(0, import_indent_str
8085
8071
  : \`Error: Field "\${P}" in "orderBy" needs to be provided in "by"\`
8086
8072
  }[OrderFields]
8087
8073
  : 'Error: If you provide "take", you also need to provide "orderBy"'
8088
- : 'skip' extends Prisma.Keys<T>
8089
- ? 'orderBy' extends Prisma.Keys<T>
8090
- ? ByValid extends Prisma.True
8074
+ : 'skip' extends Keys<T>
8075
+ ? 'orderBy' extends Keys<T>
8076
+ ? ByValid extends True
8091
8077
  ? {}
8092
8078
  : {
8093
8079
  [P in OrderFields]: P extends ByFields
@@ -8095,14 +8081,14 @@ ${availableActions.includes(DMMF.ModelAction.groupBy) ? `${(0, import_indent_str
8095
8081
  : \`Error: Field "\${P}" in "orderBy" needs to be provided in "by"\`
8096
8082
  }[OrderFields]
8097
8083
  : 'Error: If you provide "skip", you also need to provide "orderBy"'
8098
- : ByValid extends Prisma.True
8084
+ : ByValid extends True
8099
8085
  ? {}
8100
8086
  : {
8101
8087
  [P in OrderFields]: P extends ByFields
8102
8088
  ? never
8103
8089
  : \`Error: Field "\${P}" in "orderBy" needs to be provided in "by"\`
8104
8090
  }[OrderFields]
8105
- >(args: Prisma.SubsetIntersection<T, ${groupByArgsName}, OrderByArg> & InputErrors): {} extends InputErrors ? ${getGroupByPayloadName(
8091
+ >(args: SubsetIntersection<T, ${groupByArgsName}, OrderByArg> & InputErrors): {} extends InputErrors ? ${getGroupByPayloadName(
8106
8092
  name
8107
8093
  )}<T> : Prisma.PrismaPromise<InputErrors>` : ""}
8108
8094
  /**
@@ -8137,7 +8123,7 @@ function getNonAggregateMethodArgs(modelName, actionName) {
8137
8123
  if (actionName === DMMF.ModelAction.findRaw || actionName === DMMF.ModelAction.aggregateRaw) {
8138
8124
  return makeParameter(namedType(getModelArgName(modelName, actionName))).optional();
8139
8125
  }
8140
- const type = namedType("Prisma.SelectSubset").addGenericArgument(namedType("T")).addGenericArgument(
8126
+ const type = namedType("SelectSubset").addGenericArgument(namedType("T")).addGenericArgument(
8141
8127
  namedType(getModelArgName(modelName, actionName)).addGenericArgument(extArgsParam.toArgument())
8142
8128
  );
8143
8129
  const param = makeParameter(type);
@@ -8172,7 +8158,7 @@ function getReturnType({
8172
8158
  return prismaPromise(namedType("JsonObject"));
8173
8159
  }
8174
8160
  if (actionName === DMMF.ModelAction.deleteMany || actionName === DMMF.ModelAction.updateMany || actionName === DMMF.ModelAction.createMany) {
8175
- return prismaPromise(namedType("Prisma.BatchPayload"));
8161
+ return prismaPromise(namedType("BatchPayload"));
8176
8162
  }
8177
8163
  const isList = actionName === DMMF.ModelAction.findMany || actionName === DMMF.ModelAction.createManyAndReturn || actionName === DMMF.ModelAction.updateManyAndReturn;
8178
8164
  if (isList) {
@@ -8194,7 +8180,7 @@ function getReturnType({
8194
8180
  return getFluentWrapper(modelName, getResultType(modelName, actionName));
8195
8181
  }
8196
8182
  function getFluentWrapper(modelName, resultType, nullType2 = neverType) {
8197
- return namedType(`Prisma.${fluentWrapperName(modelName)}`).addGenericArgument(resultType).addGenericArgument(nullType2).addGenericArgument(extArgsParam.toArgument()).addGenericArgument(namedType("ClientOptions"));
8183
+ return namedType(fluentWrapperName(modelName)).addGenericArgument(resultType).addGenericArgument(nullType2).addGenericArgument(extArgsParam.toArgument()).addGenericArgument(namedType("ClientOptions"));
8198
8184
  }
8199
8185
  function getResultType(modelName, actionName) {
8200
8186
  return namedType("$Result.GetResult").addGenericArgument(namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument())).addGenericArgument(namedType("T")).addGenericArgument(stringLiteral(actionName)).addGenericArgument(namedType("ClientOptions"));
@@ -8207,7 +8193,7 @@ function buildFluentWrapperDefinition(modelName, outputType, context) {
8207
8193
  outputType.fields.filter(
8208
8194
  (field) => field.outputType.location === "outputObjectTypes" && !context.dmmf.isComposite(field.outputType.type) && field.name !== "_count"
8209
8195
  ).map((field) => {
8210
- const fieldArgType = namedType(`Prisma.${getFieldArgName(field, modelName)}`).addGenericArgument(extArgsParam.toArgument());
8196
+ const fieldArgType = namedType(getFieldArgName(field, modelName)).addGenericArgument(extArgsParam.toArgument());
8211
8197
  const argsParam = genericParameter("T").extends(fieldArgType).default(objectType());
8212
8198
  return method(field.name).addGenericParameter(argsParam).addParameter(parameter("args", subset(argsParam.toArgument(), fieldArgType)).optional()).setReturnType(
8213
8199
  getReturnType({
@@ -8271,7 +8257,7 @@ function typeOrPromiseLike(type) {
8271
8257
  return unionType([type, namedType("PromiseLike").addGenericArgument(type)]);
8272
8258
  }
8273
8259
  function subset(arg, baseType) {
8274
- return namedType("Prisma.Subset").addGenericArgument(arg).addGenericArgument(baseType);
8260
+ return namedType("Subset").addGenericArgument(arg).addGenericArgument(baseType);
8275
8261
  }
8276
8262
  function fluentWrapperName(modelName) {
8277
8263
  return `Prisma__${modelName}Client`;
@@ -8280,6 +8266,7 @@ function fluentWrapperName(modelName) {
8280
8266
  // src/generation/TSClient/TSClient.ts
8281
8267
  var import_ci_info = __toESM(require_ci_info());
8282
8268
  var import_crypto = __toESM(require("crypto"));
8269
+ var import_indent_string8 = __toESM(require_indent_string());
8283
8270
  var import_path4 = __toESM(require("path"));
8284
8271
 
8285
8272
  // src/generation/dmmf.ts
@@ -8739,995 +8726,415 @@ warnEnvConflicts({
8739
8726
  })`;
8740
8727
  }
8741
8728
 
8742
- // src/generation/TSClient/PrismaClient.ts
8743
- var import_indent_string5 = __toESM(require_indent_string());
8729
+ // src/generation/TSClient/common.ts
8730
+ var import_indent_string4 = __toESM(require_indent_string());
8731
+ var commonCodeJS = ({
8732
+ runtimeBase,
8733
+ runtimeNameJs,
8734
+ browser,
8735
+ clientVersion: clientVersion2,
8736
+ engineVersion,
8737
+ generator,
8738
+ deno
8739
+ }) => `${deno ? "const exports = {}" : ""}
8740
+ Object.defineProperty(exports, "__esModule", { value: true });
8741
+ ${deno ? `
8742
+ import {
8743
+ PrismaClientKnownRequestError,
8744
+ PrismaClientUnknownRequestError,
8745
+ PrismaClientRustPanicError,
8746
+ PrismaClientInitializationError,
8747
+ PrismaClientValidationError,
8748
+ getPrismaClient,
8749
+ sqltag,
8750
+ empty,
8751
+ join,
8752
+ raw,
8753
+ Decimal,
8754
+ Debug,
8755
+ objectEnumValues,
8756
+ makeStrictEnum,
8757
+ Extensions,
8758
+ defineDmmfProperty,
8759
+ Public,
8760
+ getRuntime,
8761
+ skip
8762
+ } from '${runtimeBase}/${runtimeNameJs}.js'` : browser ? `
8763
+ const {
8764
+ Decimal,
8765
+ objectEnumValues,
8766
+ makeStrictEnum,
8767
+ Public,
8768
+ getRuntime,
8769
+ skip
8770
+ } = require('${runtimeBase}/${runtimeNameJs}.js')
8771
+ ` : `
8772
+ const {
8773
+ PrismaClientKnownRequestError,
8774
+ PrismaClientUnknownRequestError,
8775
+ PrismaClientRustPanicError,
8776
+ PrismaClientInitializationError,
8777
+ PrismaClientValidationError,
8778
+ getPrismaClient,
8779
+ sqltag,
8780
+ empty,
8781
+ join,
8782
+ raw,
8783
+ skip,
8784
+ Decimal,
8785
+ Debug,
8786
+ objectEnumValues,
8787
+ makeStrictEnum,
8788
+ Extensions,
8789
+ warnOnce,
8790
+ defineDmmfProperty,
8791
+ Public,
8792
+ getRuntime,
8793
+ createParam,
8794
+ } = require('${runtimeBase}/${runtimeNameJs}.js')
8795
+ `}
8744
8796
 
8745
- // src/generation/utils/runtimeImport.ts
8746
- function runtimeImport(name) {
8747
- return name;
8797
+ const Prisma = {}
8798
+
8799
+ exports.Prisma = Prisma
8800
+ exports.$Enums = {}
8801
+
8802
+ /**
8803
+ * Prisma Client JS version: ${clientVersion2}
8804
+ * Query Engine version: ${engineVersion}
8805
+ */
8806
+ Prisma.prismaVersion = {
8807
+ client: "${clientVersion2}",
8808
+ engine: "${engineVersion}"
8748
8809
  }
8749
- function runtimeImportedType(name) {
8750
- return namedType(`runtime.${name}`);
8810
+
8811
+ Prisma.PrismaClientKnownRequestError = ${notSupportOnBrowser("PrismaClientKnownRequestError", browser)};
8812
+ Prisma.PrismaClientUnknownRequestError = ${notSupportOnBrowser("PrismaClientUnknownRequestError", browser)}
8813
+ Prisma.PrismaClientRustPanicError = ${notSupportOnBrowser("PrismaClientRustPanicError", browser)}
8814
+ Prisma.PrismaClientInitializationError = ${notSupportOnBrowser("PrismaClientInitializationError", browser)}
8815
+ Prisma.PrismaClientValidationError = ${notSupportOnBrowser("PrismaClientValidationError", browser)}
8816
+ Prisma.Decimal = Decimal
8817
+
8818
+ /**
8819
+ * Re-export of sql-template-tag
8820
+ */
8821
+ Prisma.sql = ${notSupportOnBrowser("sqltag", browser)}
8822
+ Prisma.empty = ${notSupportOnBrowser("empty", browser)}
8823
+ Prisma.join = ${notSupportOnBrowser("join", browser)}
8824
+ Prisma.raw = ${notSupportOnBrowser("raw", browser)}
8825
+ Prisma.validator = Public.validator
8826
+
8827
+ /**
8828
+ * Extensions
8829
+ */
8830
+ Prisma.getExtensionContext = ${notSupportOnBrowser("Extensions.getExtensionContext", browser)}
8831
+ Prisma.defineExtension = ${notSupportOnBrowser("Extensions.defineExtension", browser)}
8832
+
8833
+ /**
8834
+ * Shorthand utilities for JSON filtering
8835
+ */
8836
+ Prisma.DbNull = objectEnumValues.instances.DbNull
8837
+ Prisma.JsonNull = objectEnumValues.instances.JsonNull
8838
+ Prisma.AnyNull = objectEnumValues.instances.AnyNull
8839
+
8840
+ Prisma.NullTypes = {
8841
+ DbNull: objectEnumValues.classes.DbNull,
8842
+ JsonNull: objectEnumValues.classes.JsonNull,
8843
+ AnyNull: objectEnumValues.classes.AnyNull
8751
8844
  }
8752
8845
 
8753
- // src/generation/TSClient/Datasources.ts
8754
- var import_indent_string4 = __toESM(require_indent_string());
8755
- var Datasources = class {
8756
- constructor(internalDatasources) {
8757
- this.internalDatasources = internalDatasources;
8758
- }
8759
- toTS() {
8760
- const sources = this.internalDatasources;
8761
- return `export type Datasources = {
8762
- ${(0, import_indent_string4.default)(sources.map((s) => `${s.name}?: Datasource`).join("\n"), 2)}
8763
- }`;
8846
+ ${buildPrismaSkipJs(generator.previewFeatures)}
8847
+ `;
8848
+ var notSupportOnBrowser = (fnc, browser) => {
8849
+ if (browser) {
8850
+ return `() => {
8851
+ const runtimeName = getRuntime().prettyName;
8852
+ throw new Error(\`${fnc} is unable to run in this browser environment, or has been bundled for the browser (running in \${runtimeName}).
8853
+ In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report\`,
8854
+ )}`;
8764
8855
  }
8856
+ return fnc;
8765
8857
  };
8858
+ var commonCodeTS = ({
8859
+ runtimeBase,
8860
+ runtimeNameTs,
8861
+ clientVersion: clientVersion2,
8862
+ engineVersion,
8863
+ generator
8864
+ }) => ({
8865
+ tsWithoutNamespace: () => `import * as runtime from '${runtimeBase}/${runtimeNameTs}';
8866
+ import $Types = runtime.Types // general types
8867
+ import $Public = runtime.Types.Public
8868
+ import $Utils = runtime.Types.Utils
8869
+ import $Extensions = runtime.Types.Extensions
8870
+ import $Result = runtime.Types.Result
8766
8871
 
8767
- // src/generation/TSClient/globalOmit.ts
8768
- function globalOmitConfig(dmmf) {
8769
- const objectType2 = objectType().addMultiple(
8770
- dmmf.datamodel.models.map((model) => {
8771
- const type = namedType(`Prisma.${getOmitName(model.name)}`);
8772
- return property(lowerCase(model.name), type).optional();
8773
- })
8774
- );
8775
- return moduleExport(typeDeclaration("GlobalOmitConfig", objectType2));
8872
+ export type PrismaPromise<T> = $Public.PrismaPromise<T>
8873
+ `,
8874
+ ts: () => `export import DMMF = runtime.DMMF
8875
+
8876
+ export type PrismaPromise<T> = $Public.PrismaPromise<T>
8877
+
8878
+ /**
8879
+ * Validator
8880
+ */
8881
+ export import validator = runtime.Public.validator
8882
+
8883
+ /**
8884
+ * Prisma Errors
8885
+ */
8886
+ export import PrismaClientKnownRequestError = runtime.PrismaClientKnownRequestError
8887
+ export import PrismaClientUnknownRequestError = runtime.PrismaClientUnknownRequestError
8888
+ export import PrismaClientRustPanicError = runtime.PrismaClientRustPanicError
8889
+ export import PrismaClientInitializationError = runtime.PrismaClientInitializationError
8890
+ export import PrismaClientValidationError = runtime.PrismaClientValidationError
8891
+
8892
+ /**
8893
+ * Re-export of sql-template-tag
8894
+ */
8895
+ export import sql = runtime.sqltag
8896
+ export import empty = runtime.empty
8897
+ export import join = runtime.join
8898
+ export import raw = runtime.raw
8899
+ export import Sql = runtime.Sql
8900
+
8901
+ ${buildPrismaSkipTs(generator.previewFeatures)}
8902
+
8903
+ /**
8904
+ * Decimal.js
8905
+ */
8906
+ export import Decimal = runtime.Decimal
8907
+
8908
+ export type DecimalJsLike = runtime.DecimalJsLike
8909
+
8910
+ /**
8911
+ * Metrics
8912
+ */
8913
+ export type Metrics = runtime.Metrics
8914
+ export type Metric<T> = runtime.Metric<T>
8915
+ export type MetricHistogram = runtime.MetricHistogram
8916
+ export type MetricHistogramBucket = runtime.MetricHistogramBucket
8917
+
8918
+ /**
8919
+ * Extensions
8920
+ */
8921
+ export import Extension = $Extensions.UserArgs
8922
+ export import getExtensionContext = runtime.Extensions.getExtensionContext
8923
+ export import Args = $Public.Args
8924
+ export import Payload = $Public.Payload
8925
+ export import Result = $Public.Result
8926
+ export import Exact = $Public.Exact
8927
+
8928
+ /**
8929
+ * Prisma Client JS version: ${clientVersion2}
8930
+ * Query Engine version: ${engineVersion}
8931
+ */
8932
+ export type PrismaVersion = {
8933
+ client: string
8776
8934
  }
8777
8935
 
8778
- // src/generation/TSClient/PrismaClient.ts
8779
- function clientTypeMapModelsDefinition(context) {
8780
- const meta = objectType();
8781
- const modelNames = context.dmmf.datamodel.models.map((m) => m.name);
8782
- if (modelNames.length === 0) {
8783
- meta.add(property("modelProps", neverType));
8784
- } else {
8785
- meta.add(property("modelProps", unionType(modelNames.map((name) => stringLiteral(lowerCase(name))))));
8786
- }
8787
- const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? namedType("TransactionIsolationLevel") : neverType;
8788
- meta.add(property("txIsolationLevel", isolationLevel));
8789
- const model = objectType();
8790
- model.addMultiple(
8791
- modelNames.map((modelName) => {
8792
- const entry = objectType();
8793
- entry.add(
8794
- property("payload", namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument()))
8795
- );
8796
- entry.add(property("fields", namedType(`Prisma.${getFieldRefsTypeName(modelName)}`)));
8797
- const actions = getModelActions(context.dmmf, modelName);
8798
- const operations = objectType();
8799
- operations.addMultiple(
8800
- actions.map((action) => {
8801
- const operationType = objectType();
8802
- const argsType = `Prisma.${getModelArgName(modelName, action)}`;
8803
- operationType.add(property("args", namedType(argsType).addGenericArgument(extArgsParam.toArgument())));
8804
- operationType.add(property("result", clientTypeMapModelsResultDefinition(modelName, action)));
8805
- return property(action, operationType);
8806
- })
8807
- );
8808
- entry.add(property("operations", operations));
8809
- return property(modelName, entry);
8810
- })
8811
- );
8812
- return objectType().add(property("meta", meta)).add(property("model", model));
8813
- }
8814
- function clientTypeMapModelsResultDefinition(modelName, action) {
8815
- if (action === "count")
8816
- return unionType([optional(namedType(`Prisma.${getCountAggregateOutputName(modelName)}`)), numberType]);
8817
- if (action === "groupBy") return array(optional(namedType(`Prisma.${getGroupByName(modelName)}`)));
8818
- if (action === "aggregate") return optional(namedType(`Prisma.${getAggregateName(modelName)}`));
8819
- if (action === "findRaw") return namedType("JsonObject");
8820
- if (action === "aggregateRaw") return namedType("JsonObject");
8821
- if (action === "deleteMany") return namedType("BatchPayload");
8822
- if (action === "createMany") return namedType("BatchPayload");
8823
- if (action === "createManyAndReturn") return array(payloadToResult(modelName));
8824
- if (action === "updateMany") return namedType("BatchPayload");
8825
- if (action === "updateManyAndReturn") return array(payloadToResult(modelName));
8826
- if (action === "findMany") return array(payloadToResult(modelName));
8827
- if (action === "findFirst") return unionType([payloadToResult(modelName), nullType]);
8828
- if (action === "findUnique") return unionType([payloadToResult(modelName), nullType]);
8829
- if (action === "findFirstOrThrow") return payloadToResult(modelName);
8830
- if (action === "findUniqueOrThrow") return payloadToResult(modelName);
8831
- if (action === "create") return payloadToResult(modelName);
8832
- if (action === "update") return payloadToResult(modelName);
8833
- if (action === "upsert") return payloadToResult(modelName);
8834
- if (action === "delete") return payloadToResult(modelName);
8835
- assertNever(action, `Unknown action: ${action}`);
8836
- }
8837
- function payloadToResult(modelName) {
8838
- return namedType("$Utils.PayloadToResult").addGenericArgument(namedType(getPayloadName(modelName)));
8839
- }
8840
- function clientTypeMapOthersDefinition(context) {
8841
- const otherOperationsNames = context.dmmf.getOtherOperationNames().flatMap((name) => {
8842
- const results = [`$${name}`];
8843
- if (name === "executeRaw" || name === "queryRaw") {
8844
- results.push(`$${name}Unsafe`);
8845
- }
8846
- if (name === "queryRaw" && context.isPreviewFeatureOn("typedSql")) {
8847
- results.push(`$queryRawTyped`);
8848
- }
8849
- return results;
8850
- });
8851
- const argsResultMap = {
8852
- $executeRaw: { args: "[query: TemplateStringsArray | Sql, ...values: any[]]", result: "any" },
8853
- $queryRaw: { args: "[query: TemplateStringsArray | Sql, ...values: any[]]", result: "any" },
8854
- $executeRawUnsafe: { args: "[query: string, ...values: any[]]", result: "any" },
8855
- $queryRawUnsafe: { args: "[query: string, ...values: any[]]", result: "any" },
8856
- $runCommandRaw: { args: "Prisma.InputJsonObject", result: "Prisma.JsonObject" },
8857
- $queryRawTyped: { args: "runtime.UnknownTypedSql", result: "Prisma.JsonObject" }
8858
- };
8859
- return `{
8860
- other: {
8861
- payload: any
8862
- operations: {${otherOperationsNames.reduce((acc, action) => {
8863
- return `${acc}
8864
- ${action}: {
8865
- args: ${argsResultMap[action].args},
8866
- result: ${argsResultMap[action].result}
8867
- }`;
8868
- }, "")}
8869
- }
8870
- }
8871
- }`;
8872
- }
8873
- function clientTypeMapDefinition(context) {
8874
- const typeMap = `${stringify(clientTypeMapModelsDefinition(context))} & ${clientTypeMapOthersDefinition(context)}`;
8875
- return `
8876
- export interface TypeMapCb extends $Utils.Fn<{extArgs: $Extensions.InternalArgs, clientOptions: PrismaClientOptions }, $Utils.Record<string, any>> {
8877
- returns: TypeMap<this['params']['extArgs'], this['params']['clientOptions']>
8878
- }
8936
+ export const prismaVersion: PrismaVersion
8879
8937
 
8880
- export type TypeMap<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs, ClientOptions = {}> = ${typeMap}`;
8881
- }
8882
- function clientExtensionsDefinitions(context) {
8883
- const typeMap = clientTypeMapDefinition(context);
8884
- const define2 = moduleExport(
8885
- constDeclaration(
8886
- "defineExtension",
8887
- namedType("$Extensions.ExtendsHook").addGenericArgument(stringLiteral("define")).addGenericArgument(namedType("TypeMapCb")).addGenericArgument(namedType("$Extensions.DefaultArgs"))
8888
- )
8889
- );
8890
- return [typeMap, stringify(define2)].join("\n");
8891
- }
8892
- function extendsPropertyDefinition() {
8893
- const extendsDefinition = namedType("$Extensions.ExtendsHook").addGenericArgument(stringLiteral("extends")).addGenericArgument(namedType("Prisma.TypeMapCb")).addGenericArgument(namedType("ExtArgs")).addGenericArgument(
8894
- namedType("$Utils.Call").addGenericArgument(namedType("Prisma.TypeMapCb")).addGenericArgument(objectType().add(property("extArgs", namedType("ExtArgs"))))
8895
- ).addGenericArgument(namedType("ClientOptions"));
8896
- return stringify(property("$extends", extendsDefinition), { indentLevel: 1 });
8897
- }
8898
- function batchingTransactionDefinition(context) {
8899
- const method2 = method("$transaction").setDocComment(
8900
- docComment`
8901
- Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.
8902
- @example
8903
- \`\`\`
8904
- const [george, bob, alice] = await prisma.$transaction([
8905
- prisma.user.create({ data: { name: 'George' } }),
8906
- prisma.user.create({ data: { name: 'Bob' } }),
8907
- prisma.user.create({ data: { name: 'Alice' } }),
8908
- ])
8909
- \`\`\`
8938
+ /**
8939
+ * Utility Types
8940
+ */
8910
8941
 
8911
- Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).
8912
- `
8913
- ).addGenericParameter(genericParameter("P").extends(array(prismaPromise(anyType)))).addParameter(parameter("arg", arraySpread(namedType("P")))).setReturnType(promise(namedType("runtime.Types.Utils.UnwrapTuple").addGenericArgument(namedType("P"))));
8914
- if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
8915
- const options = objectType().formatInline().add(property("isolationLevel", namedType("Prisma.TransactionIsolationLevel")).optional());
8916
- method2.addParameter(parameter("options", options).optional());
8917
- }
8918
- return stringify(method2, { indentLevel: 1, newLine: "leading" });
8919
- }
8920
- function interactiveTransactionDefinition(context) {
8921
- const options = objectType().formatInline().add(property("maxWait", numberType).optional()).add(property("timeout", numberType).optional());
8922
- if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
8923
- const isolationLevel = property("isolationLevel", namedType("Prisma.TransactionIsolationLevel")).optional();
8924
- options.add(isolationLevel);
8925
- }
8926
- const returnType = promise(namedType("R"));
8927
- const callbackType = functionType().addParameter(
8928
- parameter("prisma", omit(namedType("PrismaClient"), namedType("runtime.ITXClientDenyList")))
8929
- ).setReturnType(returnType);
8930
- const method2 = method("$transaction").addGenericParameter(genericParameter("R")).addParameter(parameter("fn", callbackType)).addParameter(parameter("options", options).optional()).setReturnType(returnType);
8931
- return stringify(method2, { indentLevel: 1, newLine: "leading" });
8932
- }
8933
- function queryRawDefinition(context) {
8934
- if (!context.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
8935
- return "";
8936
- }
8937
- return `
8938
- /**
8939
- * Performs a prepared raw query and returns the \`SELECT\` data.
8940
- * @example
8941
- * \`\`\`
8942
- * const result = await prisma.$queryRaw\`SELECT * FROM User WHERE id = \${1} OR email = \${'user@email.com'};\`
8943
- * \`\`\`
8944
- *
8945
- * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
8946
- */
8947
- $queryRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<T>;
8948
8942
 
8949
- /**
8950
- * Performs a raw query and returns the \`SELECT\` data.
8951
- * Susceptible to SQL injections, see documentation.
8952
- * @example
8953
- * \`\`\`
8954
- * const result = await prisma.$queryRawUnsafe('SELECT * FROM User WHERE id = $1 OR email = $2;', 1, 'user@email.com')
8955
- * \`\`\`
8956
- *
8957
- * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
8958
- */
8959
- $queryRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<T>;`;
8960
- }
8961
- function executeRawDefinition(context) {
8962
- if (!context.dmmf.mappings.otherOperations.write.includes("executeRaw")) {
8963
- return "";
8964
- }
8965
- return `
8966
- /**
8967
- * Executes a prepared raw query and returns the number of affected rows.
8968
- * @example
8969
- * \`\`\`
8970
- * const result = await prisma.$executeRaw\`UPDATE User SET cool = \${true} WHERE email = \${'user@email.com'};\`
8971
- * \`\`\`
8972
- *
8973
- * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
8974
- */
8975
- $executeRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<number>;
8943
+ export import JsonObject = runtime.JsonObject
8944
+ export import JsonArray = runtime.JsonArray
8945
+ export import JsonValue = runtime.JsonValue
8946
+ export import InputJsonObject = runtime.InputJsonObject
8947
+ export import InputJsonArray = runtime.InputJsonArray
8948
+ export import InputJsonValue = runtime.InputJsonValue
8976
8949
 
8977
- /**
8978
- * Executes a raw query and returns the number of affected rows.
8979
- * Susceptible to SQL injections, see documentation.
8980
- * @example
8981
- * \`\`\`
8982
- * const result = await prisma.$executeRawUnsafe('UPDATE User SET cool = $1 WHERE email = $2 ;', true, 'user@email.com')
8983
- * \`\`\`
8984
- *
8985
- * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
8986
- */
8987
- $executeRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<number>;`;
8950
+ /**
8951
+ * Types of the values used to represent different kinds of \`null\` values when working with JSON fields.
8952
+ *
8953
+ * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
8954
+ */
8955
+ namespace NullTypes {
8956
+ ${buildNullClass("DbNull")}
8957
+
8958
+ ${buildNullClass("JsonNull")}
8959
+
8960
+ ${buildNullClass("AnyNull")}
8988
8961
  }
8989
- function queryRawTypedDefinition(context) {
8990
- if (!context.isPreviewFeatureOn("typedSql")) {
8991
- return "";
8992
- }
8993
- if (!context.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
8994
- return "";
8995
- }
8996
- const param = genericParameter("T");
8997
- const method2 = method("$queryRawTyped").setDocComment(
8998
- docComment`
8999
- Executes a typed SQL query and returns a typed result
9000
- @example
9001
- \`\`\`
9002
- import { myQuery } from '@prisma/client/sql'
9003
8962
 
9004
- const result = await prisma.$queryRawTyped(myQuery())
9005
- \`\`\`
9006
- `
9007
- ).addGenericParameter(param).addParameter(
9008
- parameter(
9009
- "typedSql",
9010
- runtimeImportedType("TypedSql").addGenericArgument(array(unknownType)).addGenericArgument(param.toArgument())
9011
- )
9012
- ).setReturnType(prismaPromise(array(param.toArgument())));
9013
- return stringify(method2, { indentLevel: 1, newLine: "leading" });
8963
+ /**
8964
+ * Helper for filtering JSON entries that have \`null\` on the database (empty on the db)
8965
+ *
8966
+ * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
8967
+ */
8968
+ export const DbNull: NullTypes.DbNull
8969
+
8970
+ /**
8971
+ * Helper for filtering JSON entries that have JSON \`null\` values (not empty on the db)
8972
+ *
8973
+ * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
8974
+ */
8975
+ export const JsonNull: NullTypes.JsonNull
8976
+
8977
+ /**
8978
+ * Helper for filtering JSON entries that are \`Prisma.DbNull\` or \`Prisma.JsonNull\`
8979
+ *
8980
+ * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
8981
+ */
8982
+ export const AnyNull: NullTypes.AnyNull
8983
+
8984
+ type SelectAndInclude = {
8985
+ select: any
8986
+ include: any
9014
8987
  }
9015
- function metricDefinition(context) {
9016
- if (!context.isPreviewFeatureOn("metrics")) {
9017
- return "";
9018
- }
9019
- const property2 = property("$metrics", namedType(`runtime.${runtimeImport("MetricsClient")}`)).setDocComment(
9020
- docComment`
9021
- Gives access to the client metrics in json or prometheus format.
9022
8988
 
9023
- @example
9024
- \`\`\`
9025
- const metrics = await prisma.$metrics.json()
9026
- // or
9027
- const metrics = await prisma.$metrics.prometheus()
9028
- \`\`\`
9029
- `
9030
- ).readonly();
9031
- return stringify(property2, { indentLevel: 1, newLine: "leading" });
8989
+ type SelectAndOmit = {
8990
+ select: any
8991
+ omit: any
9032
8992
  }
9033
- function runCommandRawDefinition(context) {
9034
- if (!context.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
9035
- return "";
9036
- }
9037
- const method2 = method("$runCommandRaw").addParameter(parameter("command", namedType("Prisma.InputJsonObject"))).setReturnType(prismaPromise(namedType("Prisma.JsonObject"))).setDocComment(docComment`
9038
- Executes a raw MongoDB command and returns the result of it.
9039
- @example
9040
- \`\`\`
9041
- const user = await prisma.$runCommandRaw({
9042
- aggregate: 'User',
9043
- pipeline: [{ $match: { name: 'Bob' } }, { $project: { email: true, _id: false } }],
9044
- explain: false,
9045
- })
9046
- \`\`\`
9047
-
9048
- Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
9049
- `);
9050
- return stringify(method2, { indentLevel: 1, newLine: "leading" });
9051
- }
9052
- function applyPendingMigrationsDefinition() {
9053
- if (this.runtimeNameTs !== "react-native") {
9054
- return null;
9055
- }
9056
- const method2 = method("$applyPendingMigrations").setReturnType(promise(voidType)).setDocComment(
9057
- 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.`
9058
- );
9059
- return stringify(method2, { indentLevel: 1, newLine: "leading" });
9060
- }
9061
- function eventRegistrationMethodDeclaration(runtimeNameTs) {
9062
- if (runtimeNameTs === "binary.js") {
9063
- return `$on<V extends (U | 'beforeExit')>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : V extends 'beforeExit' ? () => $Utils.JsPromise<void> : Prisma.LogEvent) => void): void;`;
9064
- } else {
9065
- return `$on<V extends U>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): void;`;
9066
- }
9067
- }
9068
- var PrismaClientClass = class {
9069
- constructor(context, internalDatasources, outputDir, runtimeNameTs, browser) {
9070
- this.context = context;
9071
- this.internalDatasources = internalDatasources;
9072
- this.outputDir = outputDir;
9073
- this.runtimeNameTs = runtimeNameTs;
9074
- this.browser = browser;
9075
- }
9076
- get jsDoc() {
9077
- const { dmmf } = this.context;
9078
- let example;
9079
- if (dmmf.mappings.modelOperations.length) {
9080
- example = dmmf.mappings.modelOperations[0];
9081
- } else {
9082
- example = {
9083
- model: "User",
9084
- plural: "users"
9085
- };
9086
- }
9087
- return `/**
9088
- * ## Prisma Client \u02B2\u02E2
9089
- *
9090
- * Type-safe database client for TypeScript & Node.js
9091
- * @example
9092
- * \`\`\`
9093
- * const prisma = new PrismaClient()
9094
- * // Fetch zero or more ${capitalize2(example.plural)}
9095
- * const ${lowerCase(example.plural)} = await prisma.${lowerCase(example.model)}.findMany()
9096
- * \`\`\`
9097
- *
9098
- *
9099
- * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
9100
- */`;
9101
- }
9102
- toTSWithoutNamespace() {
9103
- const { dmmf } = this.context;
9104
- return `
9105
- import * as runtime from './runtime/library.js'
9106
- import $Utils = runtime.Types.Utils
9107
- import $Extensions = runtime.Types.Extensions
9108
-
9109
- import type * as Prisma from './common'
9110
-
9111
- ${this.jsDoc}
9112
- export class PrismaClient<
9113
- ClientOptions extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,
9114
- U = 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never,
9115
- ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs
9116
- > {
9117
- [K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
9118
8993
 
9119
- ${(0, import_indent_string5.default)(this.jsDoc, TAB_SIZE)}
9120
-
9121
- constructor(optionsArg ?: Prisma.Subset<ClientOptions, Prisma.PrismaClientOptions>);
9122
- ${eventRegistrationMethodDeclaration(this.runtimeNameTs)}
9123
-
9124
- /**
9125
- * Connect with the database
9126
- */
9127
- $connect(): $Utils.JsPromise<void>;
9128
-
9129
- /**
9130
- * Disconnect from the database
9131
- */
9132
- $disconnect(): $Utils.JsPromise<void>;
8994
+ /**
8995
+ * Get the type of the value, that the Promise holds.
8996
+ */
8997
+ export type PromiseType<T extends PromiseLike<any>> = T extends PromiseLike<infer U> ? U : T;
9133
8998
 
9134
- /**
9135
- * Add a middleware
9136
- * @deprecated since 4.16.0. For new code, prefer client extensions instead.
9137
- * @see https://pris.ly/d/extensions
9138
- */
9139
- $use(cb: Prisma.Middleware): void
8999
+ /**
9000
+ * Get the return type of a function which returns a Promise.
9001
+ */
9002
+ export type PromiseReturnType<T extends (...args: any) => $Utils.JsPromise<any>> = PromiseType<ReturnType<T>>
9140
9003
 
9141
- ${[
9142
- executeRawDefinition(this.context),
9143
- queryRawDefinition(this.context),
9144
- queryRawTypedDefinition(this.context),
9145
- batchingTransactionDefinition(this.context),
9146
- interactiveTransactionDefinition(this.context),
9147
- runCommandRawDefinition(this.context),
9148
- metricDefinition(this.context),
9149
- applyPendingMigrationsDefinition.bind(this)(),
9150
- extendsPropertyDefinition()
9151
- ].filter((d) => d !== null).join("\n").trim()}
9004
+ /**
9005
+ * From T, pick a set of properties whose keys are in the union K
9006
+ */
9007
+ type Prisma__Pick<T, K extends keyof T> = {
9008
+ [P in K]: T[P];
9009
+ };
9152
9010
 
9153
- ${(0, import_indent_string5.default)(
9154
- dmmf.mappings.modelOperations.filter((m) => m.findMany).map((m) => {
9155
- let methodName = lowerCase(m.model);
9156
- if (methodName === "constructor") {
9157
- methodName = '["constructor"]';
9158
- }
9159
- const generics = ["ExtArgs", "ClientOptions"];
9160
- return `/**
9161
- * \`prisma.${methodName}\`: Exposes CRUD operations for the **${m.model}** model.
9162
- * Example usage:
9163
- * \`\`\`ts
9164
- * // Fetch zero or more ${capitalize2(m.plural)}
9165
- * const ${lowerCase(m.plural)} = await prisma.${methodName}.findMany()
9166
- * \`\`\`
9167
- */
9168
- get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
9169
- }).join("\n\n"),
9170
- 2
9171
- )}
9172
- }`;
9173
- }
9174
- toTS() {
9175
- const clientOptions = this.buildClientOptions();
9176
- return `${new Datasources(this.internalDatasources).toTS()}
9177
- ${clientExtensionsDefinitions(this.context)}
9178
- export type DefaultPrismaClient = PrismaClient
9179
- export type ErrorFormat = 'pretty' | 'colorless' | 'minimal'
9180
- ${stringify(moduleExport(clientOptions))}
9181
- ${stringify(globalOmitConfig(this.context.dmmf))}
9182
9011
 
9183
- /* Types for Logging */
9184
- export type LogLevel = 'info' | 'query' | 'warn' | 'error'
9185
- export type LogDefinition = {
9186
- level: LogLevel
9187
- emit: 'stdout' | 'event'
9188
- }
9012
+ export type Enumerable<T> = T | Array<T>;
9189
9013
 
9190
- export type GetLogType<T extends LogLevel | LogDefinition> = T extends LogDefinition ? T['emit'] extends 'event' ? T['level'] : never : never
9191
- export type GetEvents<T extends any> = T extends Array<LogLevel | LogDefinition> ?
9192
- GetLogType<T[0]> | GetLogType<T[1]> | GetLogType<T[2]> | GetLogType<T[3]>
9193
- : never
9014
+ export type RequiredKeys<T> = {
9015
+ [K in keyof T]-?: {} extends Prisma__Pick<T, K> ? never : K
9016
+ }[keyof T]
9194
9017
 
9195
- export type QueryEvent = {
9196
- timestamp: Date
9197
- query: string
9198
- params: string
9199
- duration: number
9200
- target: string
9018
+ export type TruthyKeys<T> = keyof {
9019
+ [K in keyof T as T[K] extends false | undefined | null ? never : K]: K
9201
9020
  }
9202
9021
 
9203
- export type LogEvent = {
9204
- timestamp: Date
9205
- message: string
9206
- target: string
9207
- }
9208
- /* End Types for Logging */
9022
+ export type TrueKeys<T> = TruthyKeys<Prisma__Pick<T, RequiredKeys<T>>>
9209
9023
 
9024
+ /**
9025
+ * Subset
9026
+ * @desc From \`T\` pick properties that exist in \`U\`. Simple version of Intersection
9027
+ */
9028
+ export type Subset<T, U> = {
9029
+ [key in keyof T]: key extends keyof U ? T[key] : never;
9030
+ };
9210
9031
 
9211
- export type PrismaAction =
9212
- | 'findUnique'
9213
- | 'findUniqueOrThrow'
9214
- | 'findMany'
9215
- | 'findFirst'
9216
- | 'findFirstOrThrow'
9217
- | 'create'
9218
- | 'createMany'
9219
- | 'createManyAndReturn'
9220
- | 'update'
9221
- | 'updateMany'
9222
- | 'updateManyAndReturn'
9223
- | 'upsert'
9224
- | 'delete'
9225
- | 'deleteMany'
9226
- | 'executeRaw'
9227
- | 'queryRaw'
9228
- | 'aggregate'
9229
- | 'count'
9230
- | 'runCommandRaw'
9231
- | 'findRaw'
9232
- | 'groupBy'
9032
+ /**
9033
+ * SelectSubset
9034
+ * @desc From \`T\` pick properties that exist in \`U\`. Simple version of Intersection.
9035
+ * Additionally, it validates, if both select and include are present. If the case, it errors.
9036
+ */
9037
+ export type SelectSubset<T, U> = {
9038
+ [key in keyof T]: key extends keyof U ? T[key] : never
9039
+ } &
9040
+ (T extends SelectAndInclude
9041
+ ? 'Please either choose \`select\` or \`include\`.'
9042
+ : T extends SelectAndOmit
9043
+ ? 'Please either choose \`select\` or \`omit\`.'
9044
+ : {})
9233
9045
 
9234
9046
  /**
9235
- * These options are being passed into the middleware as "params"
9047
+ * Subset + Intersection
9048
+ * @desc From \`T\` pick properties that exist in \`U\` and intersect \`K\`
9236
9049
  */
9237
- export type MiddlewareParams = {
9238
- model?: ModelName
9239
- action: PrismaAction
9240
- args: any
9241
- dataPath: string[]
9242
- runInTransaction: boolean
9243
- }
9050
+ export type SubsetIntersection<T, U, K> = {
9051
+ [key in keyof T]: key extends keyof U ? T[key] : never
9052
+ } &
9053
+ K
9054
+
9055
+ type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
9244
9056
 
9245
9057
  /**
9246
- * The \`T\` type makes sure, that the \`return proceed\` is not forgotten in the middleware implementation
9058
+ * XOR is needed to have a real mutually exclusive union type
9059
+ * https://stackoverflow.com/questions/42123407/does-typescript-support-mutually-exclusive-types
9247
9060
  */
9248
- export type Middleware<T = any> = (
9249
- params: MiddlewareParams,
9250
- next: (params: MiddlewareParams) => $Utils.JsPromise<T>,
9251
- ) => $Utils.JsPromise<T>
9061
+ type XOR<T, U> =
9062
+ T extends object ?
9063
+ U extends object ?
9064
+ (Without<T, U> & U) | (Without<U, T> & T)
9065
+ : U : T
9252
9066
 
9253
- // tested in getLogLevel.test.ts
9254
- export function getLogLevel(log: Array<LogLevel | LogDefinition>): LogLevel | undefined;
9255
9067
 
9256
9068
  /**
9257
- * \`PrismaClient\` proxy available in interactive transactions.
9069
+ * Is T a Record?
9258
9070
  */
9259
- export type TransactionClient = Omit<DefaultPrismaClient, runtime.ITXClientDenyList>
9260
- `;
9261
- }
9262
- buildClientOptions() {
9263
- const clientOptions = interfaceDeclaration("PrismaClientOptions").add(
9264
- property("datasources", namedType("Datasources")).optional().setDocComment(docComment("Overwrites the datasource url from your schema.prisma file"))
9265
- ).add(
9266
- property("datasourceUrl", stringType).optional().setDocComment(docComment("Overwrites the datasource url from your schema.prisma file"))
9267
- ).add(
9268
- property("errorFormat", namedType("ErrorFormat")).optional().setDocComment(docComment('@default "colorless"'))
9269
- ).add(
9270
- property("log", array(unionType([namedType("LogLevel"), namedType("LogDefinition")]))).optional().setDocComment(docComment`
9271
- @example
9272
- \`\`\`
9273
- // Defaults to stdout
9274
- log: ['query', 'info', 'warn', 'error']
9275
-
9276
- // Emit as events
9277
- log: [
9278
- { emit: 'stdout', level: 'query' },
9279
- { emit: 'stdout', level: 'info' },
9280
- { emit: 'stdout', level: 'warn' }
9281
- { emit: 'stdout', level: 'error' }
9282
- ]
9283
- \`\`\`
9284
- Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/logging#the-log-option).
9285
- `)
9286
- );
9287
- const transactionOptions = objectType().add(property("maxWait", numberType).optional()).add(property("timeout", numberType).optional());
9288
- if (this.context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
9289
- transactionOptions.add(property("isolationLevel", namedType("TransactionIsolationLevel")).optional());
9290
- }
9291
- clientOptions.add(
9292
- property("transactionOptions", transactionOptions).optional().setDocComment(docComment`
9293
- The default values for transactionOptions
9294
- maxWait ?= 2000
9295
- timeout ?= 5000
9296
- `)
9297
- );
9298
- if (["library.js", "client.js"].includes(this.runtimeNameTs) && this.context.isPreviewFeatureOn("driverAdapters")) {
9299
- clientOptions.add(
9300
- property("adapter", unionType([namedType("runtime.DriverAdapter"), namedType("null")])).optional().setDocComment(
9301
- docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
9302
- )
9303
- );
9304
- }
9305
- clientOptions.add(
9306
- property("omit", namedType("GlobalOmitConfig")).optional().setDocComment(docComment`
9307
- Global configuration for omitting model fields by default.
9308
-
9309
- @example
9310
- \`\`\`
9311
- const prisma = new PrismaClient({
9312
- omit: {
9313
- user: {
9314
- password: true
9315
- }
9316
- }
9317
- })
9318
- \`\`\`
9319
- `)
9320
- );
9321
- return clientOptions;
9322
- }
9323
- };
9324
-
9325
- // src/generation/TSClient/ClientFile.ts
9326
- function createClientFile(context, options) {
9327
- const prismaClientClass = new PrismaClientClass(
9328
- context,
9329
- options.datasources,
9330
- options.outputDir,
9331
- options.runtimeNameTs,
9332
- options.browser
9333
- );
9334
- return prismaClientClass.toTSWithoutNamespace();
9335
- }
9336
-
9337
- // src/generation/TSClient/common.ts
9338
- var import_indent_string6 = __toESM(require_indent_string());
9339
- var commonCodeJS = ({
9340
- runtimeBase,
9341
- runtimeNameJs,
9342
- browser,
9343
- clientVersion: clientVersion2,
9344
- engineVersion,
9345
- generator,
9346
- deno
9347
- }) => `${deno ? "const exports = {}" : ""}
9348
- Object.defineProperty(exports, "__esModule", { value: true });
9349
- ${deno ? `
9350
- import {
9351
- PrismaClientKnownRequestError,
9352
- PrismaClientUnknownRequestError,
9353
- PrismaClientRustPanicError,
9354
- PrismaClientInitializationError,
9355
- PrismaClientValidationError,
9356
- getPrismaClient,
9357
- sqltag,
9358
- empty,
9359
- join,
9360
- raw,
9361
- Decimal,
9362
- Debug,
9363
- objectEnumValues,
9364
- makeStrictEnum,
9365
- Extensions,
9366
- defineDmmfProperty,
9367
- Public,
9368
- getRuntime,
9369
- skip
9370
- } from '${runtimeBase}/${runtimeNameJs}.js'` : browser ? `
9371
- const {
9372
- Decimal,
9373
- objectEnumValues,
9374
- makeStrictEnum,
9375
- Public,
9376
- getRuntime,
9377
- skip
9378
- } = require('${runtimeBase}/${runtimeNameJs}.js')
9379
- ` : `
9380
- const {
9381
- PrismaClientKnownRequestError,
9382
- PrismaClientUnknownRequestError,
9383
- PrismaClientRustPanicError,
9384
- PrismaClientInitializationError,
9385
- PrismaClientValidationError,
9386
- getPrismaClient,
9387
- sqltag,
9388
- empty,
9389
- join,
9390
- raw,
9391
- skip,
9392
- Decimal,
9393
- Debug,
9394
- objectEnumValues,
9395
- makeStrictEnum,
9396
- Extensions,
9397
- warnOnce,
9398
- defineDmmfProperty,
9399
- Public,
9400
- getRuntime,
9401
- createParam,
9402
- } = require('${runtimeBase}/${runtimeNameJs}.js')
9403
- `}
9404
-
9405
- const Prisma = {}
9071
+ type IsObject<T extends any> = T extends Array<any>
9072
+ ? False
9073
+ : T extends Date
9074
+ ? False
9075
+ : T extends Uint8Array
9076
+ ? False
9077
+ : T extends BigInt
9078
+ ? False
9079
+ : T extends object
9080
+ ? True
9081
+ : False
9406
9082
 
9407
- exports.Prisma = Prisma
9408
- exports.$Enums = {}
9409
9083
 
9410
9084
  /**
9411
- * Prisma Client JS version: ${clientVersion2}
9412
- * Query Engine version: ${engineVersion}
9085
+ * If it's T[], return T
9413
9086
  */
9414
- Prisma.prismaVersion = {
9415
- client: "${clientVersion2}",
9416
- engine: "${engineVersion}"
9417
- }
9418
-
9419
- Prisma.PrismaClientKnownRequestError = ${notSupportOnBrowser("PrismaClientKnownRequestError", browser)};
9420
- Prisma.PrismaClientUnknownRequestError = ${notSupportOnBrowser("PrismaClientUnknownRequestError", browser)}
9421
- Prisma.PrismaClientRustPanicError = ${notSupportOnBrowser("PrismaClientRustPanicError", browser)}
9422
- Prisma.PrismaClientInitializationError = ${notSupportOnBrowser("PrismaClientInitializationError", browser)}
9423
- Prisma.PrismaClientValidationError = ${notSupportOnBrowser("PrismaClientValidationError", browser)}
9424
- Prisma.Decimal = Decimal
9087
+ export type UnEnumerate<T extends unknown> = T extends Array<infer U> ? U : T
9425
9088
 
9426
9089
  /**
9427
- * Re-export of sql-template-tag
9090
+ * From ts-toolbelt
9428
9091
  */
9429
- Prisma.sql = ${notSupportOnBrowser("sqltag", browser)}
9430
- Prisma.empty = ${notSupportOnBrowser("empty", browser)}
9431
- Prisma.join = ${notSupportOnBrowser("join", browser)}
9432
- Prisma.raw = ${notSupportOnBrowser("raw", browser)}
9433
- Prisma.validator = Public.validator
9434
9092
 
9435
- /**
9436
- * Extensions
9437
- */
9438
- Prisma.getExtensionContext = ${notSupportOnBrowser("Extensions.getExtensionContext", browser)}
9439
- Prisma.defineExtension = ${notSupportOnBrowser("Extensions.defineExtension", browser)}
9093
+ type __Either<O extends object, K extends Key> = Omit<O, K> &
9094
+ {
9095
+ // Merge all but K
9096
+ [P in K]: Prisma__Pick<O, P & keyof O> // With K possibilities
9097
+ }[K]
9440
9098
 
9441
- /**
9442
- * Shorthand utilities for JSON filtering
9443
- */
9444
- Prisma.DbNull = objectEnumValues.instances.DbNull
9445
- Prisma.JsonNull = objectEnumValues.instances.JsonNull
9446
- Prisma.AnyNull = objectEnumValues.instances.AnyNull
9099
+ type EitherStrict<O extends object, K extends Key> = Strict<__Either<O, K>>
9447
9100
 
9448
- Prisma.NullTypes = {
9449
- DbNull: objectEnumValues.classes.DbNull,
9450
- JsonNull: objectEnumValues.classes.JsonNull,
9451
- AnyNull: objectEnumValues.classes.AnyNull
9452
- }
9101
+ type EitherLoose<O extends object, K extends Key> = ComputeRaw<__Either<O, K>>
9453
9102
 
9454
- ${buildPrismaSkipJs(generator.previewFeatures)}
9455
- `;
9456
- var notSupportOnBrowser = (fnc, browser) => {
9457
- if (browser) {
9458
- return `() => {
9459
- const runtimeName = getRuntime().prettyName;
9460
- throw new Error(\`${fnc} is unable to run in this browser environment, or has been bundled for the browser (running in \${runtimeName}).
9461
- In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report\`,
9462
- )}`;
9463
- }
9464
- return fnc;
9465
- };
9466
- var commonCodeTS = ({ clientVersion: clientVersion2, engineVersion, generator }) => ({
9467
- ts: () => `export import DMMF = runtime.DMMF
9103
+ type _Either<
9104
+ O extends object,
9105
+ K extends Key,
9106
+ strict extends Boolean
9107
+ > = {
9108
+ 1: EitherStrict<O, K>
9109
+ 0: EitherLoose<O, K>
9110
+ }[strict]
9468
9111
 
9469
- export type PrismaPromise<T> = $Public.PrismaPromise<T>
9112
+ type Either<
9113
+ O extends object,
9114
+ K extends Key,
9115
+ strict extends Boolean = 1
9116
+ > = O extends unknown ? _Either<O, K, strict> : never
9470
9117
 
9471
- /**
9472
- * Validator
9473
- */
9474
- export import validator = runtime.Public.validator
9118
+ export type Union = any
9475
9119
 
9476
- /**
9477
- * Prisma Errors
9478
- */
9479
- export import PrismaClientKnownRequestError = runtime.PrismaClientKnownRequestError
9480
- export import PrismaClientUnknownRequestError = runtime.PrismaClientUnknownRequestError
9481
- export import PrismaClientRustPanicError = runtime.PrismaClientRustPanicError
9482
- export import PrismaClientInitializationError = runtime.PrismaClientInitializationError
9483
- export import PrismaClientValidationError = runtime.PrismaClientValidationError
9120
+ type PatchUndefined<O extends object, O1 extends object> = {
9121
+ [K in keyof O]: O[K] extends undefined ? At<O1, K> : O[K]
9122
+ } & {}
9484
9123
 
9485
- /**
9486
- * Re-export of sql-template-tag
9487
- */
9488
- export import sql = runtime.sqltag
9489
- export import empty = runtime.empty
9490
- export import join = runtime.join
9491
- export import raw = runtime.raw
9492
- export import Sql = runtime.Sql
9124
+ /** Helper Types for "Merge" **/
9125
+ export type IntersectOf<U extends Union> = (
9126
+ U extends unknown ? (k: U) => void : never
9127
+ ) extends (k: infer I) => void
9128
+ ? I
9129
+ : never
9493
9130
 
9494
- ${buildPrismaSkipTs(generator.previewFeatures)}
9131
+ export type Overwrite<O extends object, O1 extends object> = {
9132
+ [K in keyof O]: K extends keyof O1 ? O1[K] : O[K];
9133
+ } & {};
9495
9134
 
9496
- /**
9497
- * Decimal.js
9498
- */
9499
- export import Decimal = runtime.Decimal
9500
-
9501
- export type DecimalJsLike = runtime.DecimalJsLike
9502
-
9503
- /**
9504
- * Metrics
9505
- */
9506
- export type Metrics = runtime.Metrics
9507
- export type Metric<T> = runtime.Metric<T>
9508
- export type MetricHistogram = runtime.MetricHistogram
9509
- export type MetricHistogramBucket = runtime.MetricHistogramBucket
9510
-
9511
- /**
9512
- * Extensions
9513
- */
9514
- export import Extension = $Extensions.UserArgs
9515
- export import getExtensionContext = runtime.Extensions.getExtensionContext
9516
- export import Args = $Public.Args
9517
- export import Payload = $Public.Payload
9518
- export import Result = $Public.Result
9519
- export import Exact = $Public.Exact
9520
-
9521
- /**
9522
- * Prisma Client JS version: ${clientVersion2}
9523
- * Query Engine version: ${engineVersion}
9524
- */
9525
- export type PrismaVersion = {
9526
- client: string
9527
- }
9528
-
9529
- export const prismaVersion: PrismaVersion
9530
-
9531
- /**
9532
- * Utility Types
9533
- */
9534
-
9535
-
9536
- export import JsonObject = runtime.JsonObject
9537
- export import JsonArray = runtime.JsonArray
9538
- export import JsonValue = runtime.JsonValue
9539
- export import InputJsonObject = runtime.InputJsonObject
9540
- export import InputJsonArray = runtime.InputJsonArray
9541
- export import InputJsonValue = runtime.InputJsonValue
9542
-
9543
- /**
9544
- * Types of the values used to represent different kinds of \`null\` values when working with JSON fields.
9545
- *
9546
- * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
9547
- */
9548
- declare namespace NullTypes {
9549
- ${buildNullClass("DbNull")}
9550
-
9551
- ${buildNullClass("JsonNull")}
9552
-
9553
- ${buildNullClass("AnyNull")}
9554
- }
9555
-
9556
- /**
9557
- * Helper for filtering JSON entries that have \`null\` on the database (empty on the db)
9558
- *
9559
- * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
9560
- */
9561
- export const DbNull: NullTypes.DbNull
9562
-
9563
- /**
9564
- * Helper for filtering JSON entries that have JSON \`null\` values (not empty on the db)
9565
- *
9566
- * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
9567
- */
9568
- export const JsonNull: NullTypes.JsonNull
9569
-
9570
- /**
9571
- * Helper for filtering JSON entries that are \`Prisma.DbNull\` or \`Prisma.JsonNull\`
9572
- *
9573
- * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
9574
- */
9575
- export const AnyNull: NullTypes.AnyNull
9576
-
9577
- type SelectAndInclude = {
9578
- select: any
9579
- include: any
9580
- }
9581
-
9582
- type SelectAndOmit = {
9583
- select: any
9584
- omit: any
9585
- }
9586
-
9587
- /**
9588
- * Get the type of the value, that the Promise holds.
9589
- */
9590
- export type PromiseType<T extends PromiseLike<any>> = T extends PromiseLike<infer U> ? U : T;
9591
-
9592
- /**
9593
- * Get the return type of a function which returns a Promise.
9594
- */
9595
- export type PromiseReturnType<T extends (...args: any) => $Utils.JsPromise<any>> = PromiseType<ReturnType<T>>
9596
-
9597
- /**
9598
- * From T, pick a set of properties whose keys are in the union K
9599
- */
9600
- type Prisma__Pick<T, K extends keyof T> = {
9601
- [P in K]: T[P];
9602
- };
9603
-
9604
-
9605
- export type Enumerable<T> = T | Array<T>;
9606
-
9607
- export type RequiredKeys<T> = {
9608
- [K in keyof T]-?: {} extends Prisma__Pick<T, K> ? never : K
9609
- }[keyof T]
9610
-
9611
- export type TruthyKeys<T> = keyof {
9612
- [K in keyof T as T[K] extends false | undefined | null ? never : K]: K
9613
- }
9614
-
9615
- export type TrueKeys<T> = TruthyKeys<Prisma__Pick<T, RequiredKeys<T>>>
9616
-
9617
- /**
9618
- * Subset
9619
- * @desc From \`T\` pick properties that exist in \`U\`. Simple version of Intersection
9620
- */
9621
- export type Subset<T, U> = {
9622
- [key in keyof T]: key extends keyof U ? T[key] : never;
9623
- };
9624
-
9625
- /**
9626
- * SelectSubset
9627
- * @desc From \`T\` pick properties that exist in \`U\`. Simple version of Intersection.
9628
- * Additionally, it validates, if both select and include are present. If the case, it errors.
9629
- */
9630
- export type SelectSubset<T, U> = {
9631
- [key in keyof T]: key extends keyof U ? T[key] : never
9632
- } &
9633
- (T extends SelectAndInclude
9634
- ? 'Please either choose \`select\` or \`include\`.'
9635
- : T extends SelectAndOmit
9636
- ? 'Please either choose \`select\` or \`omit\`.'
9637
- : {})
9638
-
9639
- /**
9640
- * Subset + Intersection
9641
- * @desc From \`T\` pick properties that exist in \`U\` and intersect \`K\`
9642
- */
9643
- export type SubsetIntersection<T, U, K> = {
9644
- [key in keyof T]: key extends keyof U ? T[key] : never
9645
- } &
9646
- K
9647
-
9648
- export type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
9649
-
9650
- /**
9651
- * XOR is needed to have a real mutually exclusive union type
9652
- * https://stackoverflow.com/questions/42123407/does-typescript-support-mutually-exclusive-types
9653
- */
9654
- export type XOR<T, U> =
9655
- T extends object ?
9656
- U extends object ?
9657
- (Without<T, U> & U) | (Without<U, T> & T)
9658
- : U : T
9659
-
9660
-
9661
- /**
9662
- * Is T a Record?
9663
- */
9664
- export type IsObject<T extends any> = T extends Array<any>
9665
- ? False
9666
- : T extends Date
9667
- ? False
9668
- : T extends Uint8Array
9669
- ? False
9670
- : T extends BigInt
9671
- ? False
9672
- : T extends object
9673
- ? True
9674
- : False
9675
-
9676
-
9677
- /**
9678
- * If it's T[], return T
9679
- */
9680
- export type UnEnumerate<T extends unknown> = T extends Array<infer U> ? U : T
9681
-
9682
- /**
9683
- * From ts-toolbelt
9684
- */
9685
-
9686
- type __Either<O extends object, K extends Key> = Omit<O, K> &
9687
- {
9688
- // Merge all but K
9689
- [P in K]: Prisma__Pick<O, P & keyof O> // With K possibilities
9690
- }[K]
9691
-
9692
- type EitherStrict<O extends object, K extends Key> = Strict<__Either<O, K>>
9693
-
9694
- type EitherLoose<O extends object, K extends Key> = ComputeRaw<__Either<O, K>>
9695
-
9696
- type _Either<
9697
- O extends object,
9698
- K extends Key,
9699
- strict extends Boolean
9700
- > = {
9701
- 1: EitherStrict<O, K>
9702
- 0: EitherLoose<O, K>
9703
- }[strict]
9704
-
9705
- export type Either<
9706
- O extends object,
9707
- K extends Key,
9708
- strict extends Boolean = 1
9709
- > = O extends unknown ? _Either<O, K, strict> : never
9710
-
9711
- export type Union = any
9712
-
9713
- export type PatchUndefined<O extends object, O1 extends object> = {
9714
- [K in keyof O]: O[K] extends undefined ? At<O1, K> : O[K]
9715
- } & {}
9716
-
9717
- /** Helper Types for "Merge" **/
9718
- export type IntersectOf<U extends Union> = (
9719
- U extends unknown ? (k: U) => void : never
9720
- ) extends (k: infer I) => void
9721
- ? I
9722
- : never
9723
-
9724
- export type Overwrite<O extends object, O1 extends object> = {
9725
- [K in keyof O]: K extends keyof O1 ? O1[K] : O[K];
9726
- } & {};
9727
-
9728
- type _Merge<U extends object> = IntersectOf<Overwrite<U, {
9729
- [K in keyof U]-?: At<U, K>;
9730
- }>>;
9135
+ type _Merge<U extends object> = IntersectOf<Overwrite<U, {
9136
+ [K in keyof U]-?: At<U, K>;
9137
+ }>>;
9731
9138
 
9732
9139
  type Key = string | number | symbol;
9733
9140
  type AtBasic<O extends object, K extends Key> = K extends keyof O ? O[K] : never;
@@ -9754,7 +9161,7 @@ type _Record<K extends keyof any, T> = {
9754
9161
  type NoExpand<T> = T extends unknown ? T : never;
9755
9162
 
9756
9163
  // this type assumes the passed object is entirely optional
9757
- export type AtLeast<O extends object, K extends string> = NoExpand<
9164
+ type AtLeast<O extends object, K extends string> = NoExpand<
9758
9165
  O extends unknown
9759
9166
  ? | (K extends keyof O ? { [P in K]: O[P] } & O : O)
9760
9167
  | {[P in keyof O as P extends K ? K : never]-?: O[P]} & O
@@ -9802,379 +9209,773 @@ export type Or<B1 extends Boolean, B2 extends Boolean> = {
9802
9209
  0: 0
9803
9210
  1: 1
9804
9211
  }
9805
- 1: {
9806
- 0: 1
9807
- 1: 1
9212
+ 1: {
9213
+ 0: 1
9214
+ 1: 1
9215
+ }
9216
+ }[B1][B2]
9217
+
9218
+ export type Keys<U extends Union> = U extends unknown ? keyof U : never
9219
+
9220
+ type Cast<A, B> = A extends B ? A : B;
9221
+
9222
+ export const type: unique symbol;
9223
+
9224
+
9225
+
9226
+ /**
9227
+ * Used by group by
9228
+ */
9229
+
9230
+ export type GetScalarType<T, O> = O extends object ? {
9231
+ [P in keyof T]: P extends keyof O
9232
+ ? O[P]
9233
+ : never
9234
+ } : never
9235
+
9236
+ type FieldPaths<
9237
+ T,
9238
+ U = Omit<T, '_avg' | '_sum' | '_count' | '_min' | '_max'>
9239
+ > = IsObject<T> extends True ? U : T
9240
+
9241
+ type GetHavingFields<T> = {
9242
+ [K in keyof T]: Or<
9243
+ Or<Extends<'OR', K>, Extends<'AND', K>>,
9244
+ Extends<'NOT', K>
9245
+ > extends True
9246
+ ? // infer is only needed to not hit TS limit
9247
+ // based on the brilliant idea of Pierre-Antoine Mills
9248
+ // https://github.com/microsoft/TypeScript/issues/30188#issuecomment-478938437
9249
+ T[K] extends infer TK
9250
+ ? GetHavingFields<UnEnumerate<TK> extends object ? Merge<UnEnumerate<TK>> : never>
9251
+ : never
9252
+ : {} extends FieldPaths<T[K]>
9253
+ ? never
9254
+ : K
9255
+ }[keyof T]
9256
+
9257
+ /**
9258
+ * Convert tuple to union
9259
+ */
9260
+ type _TupleToUnion<T> = T extends (infer E)[] ? E : never
9261
+ type TupleToUnion<K extends readonly any[]> = _TupleToUnion<K>
9262
+ type MaybeTupleToUnion<T> = T extends any[] ? TupleToUnion<T> : T
9263
+
9264
+ /**
9265
+ * Like \`Pick\`, but additionally can also accept an array of keys
9266
+ */
9267
+ type PickEnumerable<T, K extends Enumerable<keyof T> | keyof T> = Prisma__Pick<T, MaybeTupleToUnion<K>>
9268
+
9269
+ /**
9270
+ * Exclude all keys with underscores
9271
+ */
9272
+ type ExcludeUnderscoreKeys<T extends string> = T extends \`_\${string}\` ? never : T
9273
+
9274
+
9275
+ export type FieldRef<Model, FieldType> = runtime.FieldRef<Model, FieldType>
9276
+
9277
+ type FieldRefInputType<Model, FieldType> = Model extends never ? never : FieldRef<Model, FieldType>
9278
+
9279
+ `
9280
+ });
9281
+ function buildNullClass(name) {
9282
+ const source = `/**
9283
+ * Type of \`Prisma.${name}\`.
9284
+ *
9285
+ * You cannot use other instances of this class. Please use the \`Prisma.${name}\` value.
9286
+ *
9287
+ * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
9288
+ */
9289
+ class ${name} {
9290
+ private ${name}: never
9291
+ private constructor()
9292
+ }`;
9293
+ return (0, import_indent_string4.default)(source, TAB_SIZE);
9294
+ }
9295
+ function buildPrismaSkipTs(previewFeatures) {
9296
+ if (previewFeatures.includes("strictUndefinedChecks")) {
9297
+ return `
9298
+ /**
9299
+ * Prisma.skip
9300
+ */
9301
+ export import skip = runtime.skip
9302
+ `;
9303
+ }
9304
+ return "";
9305
+ }
9306
+ function buildPrismaSkipJs(previewFeatures) {
9307
+ if (previewFeatures.includes("strictUndefinedChecks")) {
9308
+ return `
9309
+ Prisma.skip = skip
9310
+ `;
9311
+ }
9312
+ return "";
9313
+ }
9314
+
9315
+ // src/generation/TSClient/Count.ts
9316
+ var import_indent_string5 = __toESM(require_indent_string());
9317
+ var Count = class {
9318
+ constructor(type, context) {
9319
+ this.type = type;
9320
+ this.context = context;
9321
+ }
9322
+ get argsTypes() {
9323
+ const argsTypes = [];
9324
+ argsTypes.push(
9325
+ new ArgsTypeBuilder(this.type, this.context).addSelectArg().addIncludeArgIfHasRelations().createExport()
9326
+ );
9327
+ for (const field of this.type.fields) {
9328
+ if (field.args.length > 0) {
9329
+ argsTypes.push(
9330
+ new ArgsTypeBuilder(this.type, this.context).addSchemaArgs(field.args).setGeneratedName(getCountArgsType(this.type.name, field.name)).createExport()
9331
+ );
9332
+ }
9333
+ }
9334
+ return argsTypes;
9335
+ }
9336
+ toTS() {
9337
+ const { type } = this;
9338
+ const { name } = type;
9339
+ const outputType = buildOutputType(type);
9340
+ return `
9341
+ /**
9342
+ * Count Type ${name}
9343
+ */
9344
+
9345
+ ${stringify(outputType)}
9346
+
9347
+ export type ${getSelectName(name)}<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = {
9348
+ ${(0, import_indent_string5.default)(
9349
+ type.fields.map((field) => {
9350
+ const types = ["boolean"];
9351
+ if (field.outputType.location === "outputObjectTypes") {
9352
+ types.push(getFieldArgName(field, this.type.name));
9353
+ }
9354
+ if (field.args.length > 0) {
9355
+ types.push(getCountArgsType(name, field.name));
9356
+ }
9357
+ return `${field.name}?: ${types.join(" | ")}`;
9358
+ }).join("\n"),
9359
+ TAB_SIZE
9360
+ )}
9361
+ }
9362
+
9363
+ // Custom InputTypes
9364
+ ${this.argsTypes.map((typeExport) => stringify(typeExport)).join("\n\n")}
9365
+ `;
9366
+ }
9367
+ };
9368
+ function getCountArgsType(typeName, fieldName) {
9369
+ return `${typeName}Count${capitalize2(fieldName)}Args`;
9370
+ }
9371
+
9372
+ // src/generation/TSClient/FieldRefInput.ts
9373
+ var FieldRefInput = class {
9374
+ constructor(type) {
9375
+ this.type = type;
9376
+ }
9377
+ toTS() {
9378
+ const allowedTypes = this.getAllowedTypes();
9379
+ return `
9380
+ /**
9381
+ * Reference to a field of type ${allowedTypes}
9382
+ */
9383
+ export type ${this.type.name}<$PrismaModel> = FieldRefInputType<$PrismaModel, ${allowedTypes}>
9384
+ `;
9385
+ }
9386
+ getAllowedTypes() {
9387
+ return this.type.allowTypes.map(getRefAllowedTypeName).join(" | ");
9388
+ }
9389
+ };
9390
+
9391
+ // src/generation/TSClient/GenerateContext.ts
9392
+ var GenerateContext = class {
9393
+ constructor({ dmmf, genericArgsInfo, generator }) {
9394
+ this.dmmf = dmmf;
9395
+ this.genericArgsInfo = genericArgsInfo;
9396
+ this.generator = generator;
9397
+ }
9398
+ isPreviewFeatureOn(previewFeature) {
9399
+ return this.generator?.previewFeatures?.includes(previewFeature) ?? false;
9400
+ }
9401
+ };
9402
+
9403
+ // src/generation/TSClient/PrismaClient.ts
9404
+ var import_indent_string7 = __toESM(require_indent_string());
9405
+
9406
+ // src/generation/utils/runtimeImport.ts
9407
+ function runtimeImport(name) {
9408
+ return name;
9409
+ }
9410
+ function runtimeImportedType(name) {
9411
+ return namedType(`runtime.${name}`);
9412
+ }
9413
+
9414
+ // src/generation/TSClient/Datasources.ts
9415
+ var import_indent_string6 = __toESM(require_indent_string());
9416
+ var Datasources = class {
9417
+ constructor(internalDatasources) {
9418
+ this.internalDatasources = internalDatasources;
9419
+ }
9420
+ toTS() {
9421
+ const sources = this.internalDatasources;
9422
+ return `export type Datasources = {
9423
+ ${(0, import_indent_string6.default)(sources.map((s) => `${s.name}?: Datasource`).join("\n"), 2)}
9424
+ }`;
9425
+ }
9426
+ };
9427
+
9428
+ // src/generation/TSClient/globalOmit.ts
9429
+ function globalOmitConfig(dmmf) {
9430
+ const objectType2 = objectType().addMultiple(
9431
+ dmmf.datamodel.models.map((model) => {
9432
+ const type = namedType(getOmitName(model.name));
9433
+ return property(lowerCase(model.name), type).optional();
9434
+ })
9435
+ );
9436
+ return moduleExport(typeDeclaration("GlobalOmitConfig", objectType2));
9437
+ }
9438
+
9439
+ // src/generation/TSClient/PrismaClient.ts
9440
+ function clientTypeMapModelsDefinition(context) {
9441
+ const meta = objectType();
9442
+ const modelNames = context.dmmf.datamodel.models.map((m) => m.name);
9443
+ if (modelNames.length === 0) {
9444
+ meta.add(property("modelProps", neverType));
9445
+ } else {
9446
+ meta.add(property("modelProps", unionType(modelNames.map((name) => stringLiteral(lowerCase(name))))));
9447
+ }
9448
+ const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? namedType("Prisma.TransactionIsolationLevel") : neverType;
9449
+ meta.add(property("txIsolationLevel", isolationLevel));
9450
+ const model = objectType();
9451
+ model.addMultiple(
9452
+ modelNames.map((modelName) => {
9453
+ const entry = objectType();
9454
+ entry.add(
9455
+ property("payload", namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument()))
9456
+ );
9457
+ entry.add(property("fields", namedType(`Prisma.${getFieldRefsTypeName(modelName)}`)));
9458
+ const actions = getModelActions(context.dmmf, modelName);
9459
+ const operations = objectType();
9460
+ operations.addMultiple(
9461
+ actions.map((action) => {
9462
+ const operationType = objectType();
9463
+ const argsType = `Prisma.${getModelArgName(modelName, action)}`;
9464
+ operationType.add(property("args", namedType(argsType).addGenericArgument(extArgsParam.toArgument())));
9465
+ operationType.add(property("result", clientTypeMapModelsResultDefinition(modelName, action)));
9466
+ return property(action, operationType);
9467
+ })
9468
+ );
9469
+ entry.add(property("operations", operations));
9470
+ return property(modelName, entry);
9471
+ })
9472
+ );
9473
+ return objectType().add(property("meta", meta)).add(property("model", model));
9474
+ }
9475
+ function clientTypeMapModelsResultDefinition(modelName, action) {
9476
+ if (action === "count")
9477
+ return unionType([optional(namedType(getCountAggregateOutputName(modelName))), numberType]);
9478
+ if (action === "groupBy") return array(optional(namedType(getGroupByName(modelName))));
9479
+ if (action === "aggregate") return optional(namedType(getAggregateName(modelName)));
9480
+ if (action === "findRaw") return namedType("JsonObject");
9481
+ if (action === "aggregateRaw") return namedType("JsonObject");
9482
+ if (action === "deleteMany") return namedType("BatchPayload");
9483
+ if (action === "createMany") return namedType("BatchPayload");
9484
+ if (action === "createManyAndReturn") return array(payloadToResult(modelName));
9485
+ if (action === "updateMany") return namedType("BatchPayload");
9486
+ if (action === "updateManyAndReturn") return array(payloadToResult(modelName));
9487
+ if (action === "findMany") return array(payloadToResult(modelName));
9488
+ if (action === "findFirst") return unionType([payloadToResult(modelName), nullType]);
9489
+ if (action === "findUnique") return unionType([payloadToResult(modelName), nullType]);
9490
+ if (action === "findFirstOrThrow") return payloadToResult(modelName);
9491
+ if (action === "findUniqueOrThrow") return payloadToResult(modelName);
9492
+ if (action === "create") return payloadToResult(modelName);
9493
+ if (action === "update") return payloadToResult(modelName);
9494
+ if (action === "upsert") return payloadToResult(modelName);
9495
+ if (action === "delete") return payloadToResult(modelName);
9496
+ assertNever(action, `Unknown action: ${action}`);
9497
+ }
9498
+ function payloadToResult(modelName) {
9499
+ return namedType("$Utils.PayloadToResult").addGenericArgument(namedType(getPayloadName(modelName)));
9500
+ }
9501
+ function clientTypeMapOthersDefinition(context) {
9502
+ const otherOperationsNames = context.dmmf.getOtherOperationNames().flatMap((name) => {
9503
+ const results = [`$${name}`];
9504
+ if (name === "executeRaw" || name === "queryRaw") {
9505
+ results.push(`$${name}Unsafe`);
9506
+ }
9507
+ if (name === "queryRaw" && context.isPreviewFeatureOn("typedSql")) {
9508
+ results.push(`$queryRawTyped`);
9509
+ }
9510
+ return results;
9511
+ });
9512
+ const argsResultMap = {
9513
+ $executeRaw: { args: "[query: TemplateStringsArray | Prisma.Sql, ...values: any[]]", result: "any" },
9514
+ $queryRaw: { args: "[query: TemplateStringsArray | Prisma.Sql, ...values: any[]]", result: "any" },
9515
+ $executeRawUnsafe: { args: "[query: string, ...values: any[]]", result: "any" },
9516
+ $queryRawUnsafe: { args: "[query: string, ...values: any[]]", result: "any" },
9517
+ $runCommandRaw: { args: "Prisma.InputJsonObject", result: "Prisma.JsonObject" },
9518
+ $queryRawTyped: { args: "runtime.UnknownTypedSql", result: "Prisma.JsonObject" }
9519
+ };
9520
+ return `{
9521
+ other: {
9522
+ payload: any
9523
+ operations: {${otherOperationsNames.reduce((acc, action) => {
9524
+ return `${acc}
9525
+ ${action}: {
9526
+ args: ${argsResultMap[action].args},
9527
+ result: ${argsResultMap[action].result}
9528
+ }`;
9529
+ }, "")}
9530
+ }
9531
+ }
9532
+ }`;
9533
+ }
9534
+ function clientTypeMapDefinition(context) {
9535
+ const typeMap = `${stringify(clientTypeMapModelsDefinition(context))} & ${clientTypeMapOthersDefinition(context)}`;
9536
+ return `
9537
+ interface TypeMapCb extends $Utils.Fn<{extArgs: $Extensions.InternalArgs, clientOptions: PrismaClientOptions }, $Utils.Record<string, any>> {
9538
+ returns: Prisma.TypeMap<this['params']['extArgs'], this['params']['clientOptions']>
9539
+ }
9540
+
9541
+ export type TypeMap<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs, ClientOptions = {}> = ${typeMap}`;
9542
+ }
9543
+ function clientExtensionsDefinitions(context) {
9544
+ const typeMap = clientTypeMapDefinition(context);
9545
+ const define2 = moduleExport(
9546
+ constDeclaration(
9547
+ "defineExtension",
9548
+ namedType("$Extensions.ExtendsHook").addGenericArgument(stringLiteral("define")).addGenericArgument(namedType("Prisma.TypeMapCb")).addGenericArgument(namedType("$Extensions.DefaultArgs"))
9549
+ )
9550
+ );
9551
+ return [typeMap, stringify(define2)].join("\n");
9552
+ }
9553
+ function extendsPropertyDefinition() {
9554
+ const extendsDefinition = namedType("$Extensions.ExtendsHook").addGenericArgument(stringLiteral("extends")).addGenericArgument(namedType("Prisma.TypeMapCb")).addGenericArgument(namedType("ExtArgs")).addGenericArgument(
9555
+ namedType("$Utils.Call").addGenericArgument(namedType("Prisma.TypeMapCb")).addGenericArgument(objectType().add(property("extArgs", namedType("ExtArgs"))))
9556
+ ).addGenericArgument(namedType("ClientOptions"));
9557
+ return stringify(property("$extends", extendsDefinition), { indentLevel: 1 });
9558
+ }
9559
+ function batchingTransactionDefinition(context) {
9560
+ const method2 = method("$transaction").setDocComment(
9561
+ docComment`
9562
+ Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.
9563
+ @example
9564
+ \`\`\`
9565
+ const [george, bob, alice] = await prisma.$transaction([
9566
+ prisma.user.create({ data: { name: 'George' } }),
9567
+ prisma.user.create({ data: { name: 'Bob' } }),
9568
+ prisma.user.create({ data: { name: 'Alice' } }),
9569
+ ])
9570
+ \`\`\`
9571
+
9572
+ Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).
9573
+ `
9574
+ ).addGenericParameter(genericParameter("P").extends(array(prismaPromise(anyType)))).addParameter(parameter("arg", arraySpread(namedType("P")))).setReturnType(promise(namedType("runtime.Types.Utils.UnwrapTuple").addGenericArgument(namedType("P"))));
9575
+ if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
9576
+ const options = objectType().formatInline().add(property("isolationLevel", namedType("Prisma.TransactionIsolationLevel")).optional());
9577
+ method2.addParameter(parameter("options", options).optional());
9578
+ }
9579
+ return stringify(method2, { indentLevel: 1, newLine: "leading" });
9580
+ }
9581
+ function interactiveTransactionDefinition(context) {
9582
+ const options = objectType().formatInline().add(property("maxWait", numberType).optional()).add(property("timeout", numberType).optional());
9583
+ if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
9584
+ const isolationLevel = property("isolationLevel", namedType("Prisma.TransactionIsolationLevel")).optional();
9585
+ options.add(isolationLevel);
9586
+ }
9587
+ const returnType = promise(namedType("R"));
9588
+ const callbackType = functionType().addParameter(
9589
+ parameter("prisma", omit(namedType("PrismaClient"), namedType("runtime.ITXClientDenyList")))
9590
+ ).setReturnType(returnType);
9591
+ const method2 = method("$transaction").addGenericParameter(genericParameter("R")).addParameter(parameter("fn", callbackType)).addParameter(parameter("options", options).optional()).setReturnType(returnType);
9592
+ return stringify(method2, { indentLevel: 1, newLine: "leading" });
9593
+ }
9594
+ function queryRawDefinition(context) {
9595
+ if (!context.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
9596
+ return "";
9597
+ }
9598
+ return `
9599
+ /**
9600
+ * Performs a prepared raw query and returns the \`SELECT\` data.
9601
+ * @example
9602
+ * \`\`\`
9603
+ * const result = await prisma.$queryRaw\`SELECT * FROM User WHERE id = \${1} OR email = \${'user@email.com'};\`
9604
+ * \`\`\`
9605
+ *
9606
+ * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
9607
+ */
9608
+ $queryRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<T>;
9609
+
9610
+ /**
9611
+ * Performs a raw query and returns the \`SELECT\` data.
9612
+ * Susceptible to SQL injections, see documentation.
9613
+ * @example
9614
+ * \`\`\`
9615
+ * const result = await prisma.$queryRawUnsafe('SELECT * FROM User WHERE id = $1 OR email = $2;', 1, 'user@email.com')
9616
+ * \`\`\`
9617
+ *
9618
+ * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
9619
+ */
9620
+ $queryRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<T>;`;
9621
+ }
9622
+ function executeRawDefinition(context) {
9623
+ if (!context.dmmf.mappings.otherOperations.write.includes("executeRaw")) {
9624
+ return "";
9625
+ }
9626
+ return `
9627
+ /**
9628
+ * Executes a prepared raw query and returns the number of affected rows.
9629
+ * @example
9630
+ * \`\`\`
9631
+ * const result = await prisma.$executeRaw\`UPDATE User SET cool = \${true} WHERE email = \${'user@email.com'};\`
9632
+ * \`\`\`
9633
+ *
9634
+ * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
9635
+ */
9636
+ $executeRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<number>;
9637
+
9638
+ /**
9639
+ * Executes a raw query and returns the number of affected rows.
9640
+ * Susceptible to SQL injections, see documentation.
9641
+ * @example
9642
+ * \`\`\`
9643
+ * const result = await prisma.$executeRawUnsafe('UPDATE User SET cool = $1 WHERE email = $2 ;', true, 'user@email.com')
9644
+ * \`\`\`
9645
+ *
9646
+ * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
9647
+ */
9648
+ $executeRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<number>;`;
9649
+ }
9650
+ function queryRawTypedDefinition(context) {
9651
+ if (!context.isPreviewFeatureOn("typedSql")) {
9652
+ return "";
9653
+ }
9654
+ if (!context.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
9655
+ return "";
9656
+ }
9657
+ const param = genericParameter("T");
9658
+ const method2 = method("$queryRawTyped").setDocComment(
9659
+ docComment`
9660
+ Executes a typed SQL query and returns a typed result
9661
+ @example
9662
+ \`\`\`
9663
+ import { myQuery } from '@prisma/client/sql'
9664
+
9665
+ const result = await prisma.$queryRawTyped(myQuery())
9666
+ \`\`\`
9667
+ `
9668
+ ).addGenericParameter(param).addParameter(
9669
+ parameter(
9670
+ "typedSql",
9671
+ runtimeImportedType("TypedSql").addGenericArgument(array(unknownType)).addGenericArgument(param.toArgument())
9672
+ )
9673
+ ).setReturnType(prismaPromise(array(param.toArgument())));
9674
+ return stringify(method2, { indentLevel: 1, newLine: "leading" });
9675
+ }
9676
+ function metricDefinition(context) {
9677
+ if (!context.isPreviewFeatureOn("metrics")) {
9678
+ return "";
9679
+ }
9680
+ const property2 = property("$metrics", namedType(`runtime.${runtimeImport("MetricsClient")}`)).setDocComment(
9681
+ docComment`
9682
+ Gives access to the client metrics in json or prometheus format.
9683
+
9684
+ @example
9685
+ \`\`\`
9686
+ const metrics = await prisma.$metrics.json()
9687
+ // or
9688
+ const metrics = await prisma.$metrics.prometheus()
9689
+ \`\`\`
9690
+ `
9691
+ ).readonly();
9692
+ return stringify(property2, { indentLevel: 1, newLine: "leading" });
9693
+ }
9694
+ function runCommandRawDefinition(context) {
9695
+ if (!context.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
9696
+ return "";
9697
+ }
9698
+ const method2 = method("$runCommandRaw").addParameter(parameter("command", namedType("Prisma.InputJsonObject"))).setReturnType(prismaPromise(namedType("Prisma.JsonObject"))).setDocComment(docComment`
9699
+ Executes a raw MongoDB command and returns the result of it.
9700
+ @example
9701
+ \`\`\`
9702
+ const user = await prisma.$runCommandRaw({
9703
+ aggregate: 'User',
9704
+ pipeline: [{ $match: { name: 'Bob' } }, { $project: { email: true, _id: false } }],
9705
+ explain: false,
9706
+ })
9707
+ \`\`\`
9708
+
9709
+ Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
9710
+ `);
9711
+ return stringify(method2, { indentLevel: 1, newLine: "leading" });
9712
+ }
9713
+ function applyPendingMigrationsDefinition() {
9714
+ if (this.runtimeNameTs !== "react-native") {
9715
+ return null;
9716
+ }
9717
+ const method2 = method("$applyPendingMigrations").setReturnType(promise(voidType)).setDocComment(
9718
+ 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.`
9719
+ );
9720
+ return stringify(method2, { indentLevel: 1, newLine: "leading" });
9721
+ }
9722
+ function eventRegistrationMethodDeclaration(runtimeNameTs) {
9723
+ if (runtimeNameTs === "binary.js") {
9724
+ return `$on<V extends (U | 'beforeExit')>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : V extends 'beforeExit' ? () => $Utils.JsPromise<void> : Prisma.LogEvent) => void): void;`;
9725
+ } else {
9726
+ return `$on<V extends U>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): void;`;
9727
+ }
9728
+ }
9729
+ var PrismaClientClass = class {
9730
+ constructor(context, internalDatasources, outputDir, runtimeNameTs, browser) {
9731
+ this.context = context;
9732
+ this.internalDatasources = internalDatasources;
9733
+ this.outputDir = outputDir;
9734
+ this.runtimeNameTs = runtimeNameTs;
9735
+ this.browser = browser;
9736
+ }
9737
+ get jsDoc() {
9738
+ const { dmmf } = this.context;
9739
+ let example;
9740
+ if (dmmf.mappings.modelOperations.length) {
9741
+ example = dmmf.mappings.modelOperations[0];
9742
+ } else {
9743
+ example = {
9744
+ model: "User",
9745
+ plural: "users"
9746
+ };
9747
+ }
9748
+ return `/**
9749
+ * ## Prisma Client \u02B2\u02E2
9750
+ *
9751
+ * Type-safe database client for TypeScript & Node.js
9752
+ * @example
9753
+ * \`\`\`
9754
+ * const prisma = new PrismaClient()
9755
+ * // Fetch zero or more ${capitalize2(example.plural)}
9756
+ * const ${lowerCase(example.plural)} = await prisma.${lowerCase(example.model)}.findMany()
9757
+ * \`\`\`
9758
+ *
9759
+ *
9760
+ * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
9761
+ */`;
9808
9762
  }
9809
- }[B1][B2]
9810
-
9811
- export type Keys<U extends Union> = U extends unknown ? keyof U : never
9812
-
9813
- type Cast<A, B> = A extends B ? A : B;
9814
-
9815
- export const type: unique symbol;
9816
-
9817
-
9818
-
9819
- /**
9820
- * Used by group by
9821
- */
9822
-
9823
- export type GetScalarType<T, O> = O extends object ? {
9824
- [P in keyof T]: P extends keyof O
9825
- ? O[P]
9826
- : never
9827
- } : never
9828
-
9829
- type FieldPaths<
9830
- T,
9831
- U = Omit<T, '_avg' | '_sum' | '_count' | '_min' | '_max'>
9832
- > = IsObject<T> extends True ? U : T
9833
-
9834
- export type GetHavingFields<T> = {
9835
- [K in keyof T]: Or<
9836
- Or<Extends<'OR', K>, Extends<'AND', K>>,
9837
- Extends<'NOT', K>
9838
- > extends True
9839
- ? // infer is only needed to not hit TS limit
9840
- // based on the brilliant idea of Pierre-Antoine Mills
9841
- // https://github.com/microsoft/TypeScript/issues/30188#issuecomment-478938437
9842
- T[K] extends infer TK
9843
- ? GetHavingFields<UnEnumerate<TK> extends object ? Merge<UnEnumerate<TK>> : never>
9844
- : never
9845
- : {} extends FieldPaths<T[K]>
9846
- ? never
9847
- : K
9848
- }[keyof T]
9763
+ toTSWithoutNamespace() {
9764
+ const { dmmf } = this.context;
9765
+ return `${this.jsDoc}
9766
+ export class PrismaClient<
9767
+ ClientOptions extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,
9768
+ U = 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never,
9769
+ ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs
9770
+ > {
9771
+ [K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
9849
9772
 
9850
- /**
9851
- * Convert tuple to union
9852
- */
9853
- type _TupleToUnion<T> = T extends (infer E)[] ? E : never
9854
- type TupleToUnion<K extends readonly any[]> = _TupleToUnion<K>
9855
- export type MaybeTupleToUnion<T> = T extends any[] ? TupleToUnion<T> : T
9773
+ ${(0, import_indent_string7.default)(this.jsDoc, TAB_SIZE)}
9856
9774
 
9857
- /**
9858
- * Like \`Pick\`, but additionally can also accept an array of keys
9859
- */
9860
- export type PickEnumerable<T, K extends Enumerable<keyof T> | keyof T> = Prisma__Pick<T, MaybeTupleToUnion<K>>
9775
+ constructor(optionsArg ?: Prisma.Subset<ClientOptions, Prisma.PrismaClientOptions>);
9776
+ ${eventRegistrationMethodDeclaration(this.runtimeNameTs)}
9861
9777
 
9862
- /**
9863
- * Exclude all keys with underscores
9864
- */
9865
- export type ExcludeUnderscoreKeys<T extends string> = T extends \`_\${string}\` ? never : T
9778
+ /**
9779
+ * Connect with the database
9780
+ */
9781
+ $connect(): $Utils.JsPromise<void>;
9866
9782
 
9783
+ /**
9784
+ * Disconnect from the database
9785
+ */
9786
+ $disconnect(): $Utils.JsPromise<void>;
9867
9787
 
9868
- export type FieldRef<Model, FieldType> = runtime.FieldRef<Model, FieldType>
9788
+ /**
9789
+ * Add a middleware
9790
+ * @deprecated since 4.16.0. For new code, prefer client extensions instead.
9791
+ * @see https://pris.ly/d/extensions
9792
+ */
9793
+ $use(cb: Prisma.Middleware): void
9869
9794
 
9870
- type FieldRefInputType<Model, FieldType> = Model extends never ? never : FieldRef<Model, FieldType>
9795
+ ${[
9796
+ executeRawDefinition(this.context),
9797
+ queryRawDefinition(this.context),
9798
+ queryRawTypedDefinition(this.context),
9799
+ batchingTransactionDefinition(this.context),
9800
+ interactiveTransactionDefinition(this.context),
9801
+ runCommandRawDefinition(this.context),
9802
+ metricDefinition(this.context),
9803
+ applyPendingMigrationsDefinition.bind(this)(),
9804
+ extendsPropertyDefinition()
9805
+ ].filter((d) => d !== null).join("\n").trim()}
9871
9806
 
9872
- `
9873
- });
9874
- function buildNullClass(name) {
9875
- const source = `/**
9876
- * Type of \`Prisma.${name}\`.
9877
- *
9878
- * You cannot use other instances of this class. Please use the \`Prisma.${name}\` value.
9879
- *
9880
- * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
9881
- */
9882
- class ${name} {
9883
- private ${name}: never
9884
- private constructor()
9807
+ ${(0, import_indent_string7.default)(
9808
+ dmmf.mappings.modelOperations.filter((m) => m.findMany).map((m) => {
9809
+ let methodName = lowerCase(m.model);
9810
+ if (methodName === "constructor") {
9811
+ methodName = '["constructor"]';
9812
+ }
9813
+ const generics = ["ExtArgs", "ClientOptions"];
9814
+ return `/**
9815
+ * \`prisma.${methodName}\`: Exposes CRUD operations for the **${m.model}** model.
9816
+ * Example usage:
9817
+ * \`\`\`ts
9818
+ * // Fetch zero or more ${capitalize2(m.plural)}
9819
+ * const ${lowerCase(m.plural)} = await prisma.${methodName}.findMany()
9820
+ * \`\`\`
9821
+ */
9822
+ get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
9823
+ }).join("\n\n"),
9824
+ 2
9825
+ )}
9885
9826
  }`;
9886
- return (0, import_indent_string6.default)(source, TAB_SIZE);
9887
- }
9888
- function buildPrismaSkipTs(previewFeatures) {
9889
- if (previewFeatures.includes("strictUndefinedChecks")) {
9890
- return `
9891
- /**
9892
- * Prisma.skip
9893
- */
9894
- export import skip = runtime.skip
9895
- `;
9896
- }
9897
- return "";
9898
- }
9899
- function buildPrismaSkipJs(previewFeatures) {
9900
- if (previewFeatures.includes("strictUndefinedChecks")) {
9901
- return `
9902
- Prisma.skip = skip
9903
- `;
9904
- }
9905
- return "";
9906
- }
9907
-
9908
- // src/generation/TSClient/FieldRefInput.ts
9909
- var FieldRefInput = class {
9910
- constructor(type) {
9911
- this.type = type;
9912
9827
  }
9913
9828
  toTS() {
9914
- const allowedTypes = this.getAllowedTypes();
9915
- return `
9916
- /**
9917
- * Reference to a field of type ${allowedTypes}
9918
- */
9919
- export type ${this.type.name}<$PrismaModel> = FieldRefInputType<$PrismaModel, ${allowedTypes}>
9920
- `;
9921
- }
9922
- getAllowedTypes() {
9923
- return this.type.allowTypes.map(getRefAllowedTypeName).join(" | ");
9924
- }
9925
- };
9926
-
9927
- // src/generation/TSClient/CommonFile.ts
9928
- function createCommonFile(context, options) {
9929
- const prismaClientClass = new PrismaClientClass(
9930
- context,
9931
- options.datasources,
9932
- options.outputDir,
9933
- options.runtimeNameTs,
9934
- options.browser
9935
- );
9936
- const commonCode = commonCodeTS(options);
9937
- const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
9938
- const fieldRefs = context.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
9939
- return `
9940
- import * as runtime from '${context.runtimeJsPath}';
9941
- import $Types = runtime.Types // general types
9942
- import $Public = runtime.Types.Public
9943
- import $Utils = runtime.Types.Utils
9944
- import $Extensions = runtime.Types.Extensions
9945
- import $Result = runtime.Types.Result
9829
+ const clientOptions = this.buildClientOptions();
9830
+ return `${new Datasources(this.internalDatasources).toTS()}
9831
+ ${clientExtensionsDefinitions(this.context)}
9832
+ export type DefaultPrismaClient = PrismaClient
9833
+ export type ErrorFormat = 'pretty' | 'colorless' | 'minimal'
9834
+ ${stringify(moduleExport(clientOptions))}
9835
+ ${stringify(globalOmitConfig(this.context.dmmf))}
9946
9836
 
9947
- import type * as Prisma from './models';
9948
- import type { PrismaClient } from './client';
9837
+ /* Types for Logging */
9838
+ export type LogLevel = 'info' | 'query' | 'warn' | 'error'
9839
+ export type LogDefinition = {
9840
+ level: LogLevel
9841
+ emit: 'stdout' | 'event'
9842
+ }
9949
9843
 
9950
- export type * from './models';
9951
-
9952
- ${commonCode.ts()}
9953
- ${new Enum(
9954
- {
9955
- name: "ModelName",
9956
- values: context.dmmf.mappings.modelOperations.map((m) => m.model)
9957
- },
9958
- true
9959
- ).toTS()}
9844
+ export type GetLogType<T extends LogLevel | LogDefinition> = T extends LogDefinition ? T['emit'] extends 'event' ? T['level'] : never : never
9845
+ export type GetEvents<T extends any> = T extends Array<LogLevel | LogDefinition> ?
9846
+ GetLogType<T[0]> | GetLogType<T[1]> | GetLogType<T[2]> | GetLogType<T[3]>
9847
+ : never
9960
9848
 
9961
- ${prismaClientClass.toTS()}
9962
- export type Datasource = {
9963
- url?: string
9849
+ export type QueryEvent = {
9850
+ timestamp: Date
9851
+ query: string
9852
+ params: string
9853
+ duration: number
9854
+ target: string
9964
9855
  }
9965
9856
 
9966
- /**
9967
- * Enums
9968
- */
9857
+ export type LogEvent = {
9858
+ timestamp: Date
9859
+ message: string
9860
+ target: string
9861
+ }
9862
+ /* End Types for Logging */
9969
9863
 
9970
- ${prismaEnums?.join("\n\n")}
9971
9864
 
9972
- ${fieldRefs.length > 0 ? `
9973
- /**
9974
- * Field references
9975
- */
9865
+ export type PrismaAction =
9866
+ | 'findUnique'
9867
+ | 'findUniqueOrThrow'
9868
+ | 'findMany'
9869
+ | 'findFirst'
9870
+ | 'findFirstOrThrow'
9871
+ | 'create'
9872
+ | 'createMany'
9873
+ | 'createManyAndReturn'
9874
+ | 'update'
9875
+ | 'updateMany'
9876
+ | 'updateManyAndReturn'
9877
+ | 'upsert'
9878
+ | 'delete'
9879
+ | 'deleteMany'
9880
+ | 'executeRaw'
9881
+ | 'queryRaw'
9882
+ | 'aggregate'
9883
+ | 'count'
9884
+ | 'runCommandRaw'
9885
+ | 'findRaw'
9886
+ | 'groupBy'
9976
9887
 
9977
- ${fieldRefs.join("\n\n")}` : ""}
9978
9888
  /**
9979
- * Deep Input Types
9889
+ * These options are being passed into the middleware as "params"
9980
9890
  */
9981
-
9982
- ${context.dmmf.inputObjectTypes.model?.map((inputType) => new InputType(inputType, context).toTS()).join("\n") ?? ""}
9891
+ export type MiddlewareParams = {
9892
+ model?: ModelName
9893
+ action: PrismaAction
9894
+ args: any
9895
+ dataPath: string[]
9896
+ runInTransaction: boolean
9897
+ }
9983
9898
 
9984
9899
  /**
9985
- * Batch Payload for updateMany & deleteMany & createMany
9900
+ * The \`T\` type makes sure, that the \`return proceed\` is not forgotten in the middleware implementation
9986
9901
  */
9902
+ export type Middleware<T = any> = (
9903
+ params: MiddlewareParams,
9904
+ next: (params: MiddlewareParams) => $Utils.JsPromise<T>,
9905
+ ) => $Utils.JsPromise<T>
9987
9906
 
9988
- export type BatchPayload = {
9989
- count: number
9990
- }
9907
+ // tested in getLogLevel.test.ts
9908
+ export function getLogLevel(log: Array<LogLevel | LogDefinition>): LogLevel | undefined;
9991
9909
 
9992
9910
  /**
9993
- * DMMF
9911
+ * \`PrismaClient\` proxy available in interactive transactions.
9994
9912
  */
9995
- export const dmmf: runtime.BaseDMMF
9913
+ export type TransactionClient = Omit<Prisma.DefaultPrismaClient, runtime.ITXClientDenyList>
9996
9914
  `;
9997
- }
9998
-
9999
- // src/generation/TSClient/Count.ts
10000
- var import_indent_string7 = __toESM(require_indent_string());
10001
- var Count = class {
10002
- constructor(type, context) {
10003
- this.type = type;
10004
- this.context = context;
10005
9915
  }
10006
- get argsTypes() {
10007
- const argsTypes = [];
10008
- argsTypes.push(
10009
- new ArgsTypeBuilder(this.type, this.context).addSelectArg().addIncludeArgIfHasRelations().createExport()
9916
+ buildClientOptions() {
9917
+ const clientOptions = interfaceDeclaration("PrismaClientOptions").add(
9918
+ property("datasources", namedType("Datasources")).optional().setDocComment(docComment("Overwrites the datasource url from your schema.prisma file"))
9919
+ ).add(
9920
+ property("datasourceUrl", stringType).optional().setDocComment(docComment("Overwrites the datasource url from your schema.prisma file"))
9921
+ ).add(
9922
+ property("errorFormat", namedType("ErrorFormat")).optional().setDocComment(docComment('@default "colorless"'))
9923
+ ).add(
9924
+ property("log", array(unionType([namedType("LogLevel"), namedType("LogDefinition")]))).optional().setDocComment(docComment`
9925
+ @example
9926
+ \`\`\`
9927
+ // Defaults to stdout
9928
+ log: ['query', 'info', 'warn', 'error']
9929
+
9930
+ // Emit as events
9931
+ log: [
9932
+ { emit: 'stdout', level: 'query' },
9933
+ { emit: 'stdout', level: 'info' },
9934
+ { emit: 'stdout', level: 'warn' }
9935
+ { emit: 'stdout', level: 'error' }
9936
+ ]
9937
+ \`\`\`
9938
+ Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/logging#the-log-option).
9939
+ `)
10010
9940
  );
10011
- for (const field of this.type.fields) {
10012
- if (field.args.length > 0) {
10013
- argsTypes.push(
10014
- new ArgsTypeBuilder(this.type, this.context).addSchemaArgs(field.args).setGeneratedName(getCountArgsType(this.type.name, field.name)).createExport()
10015
- );
10016
- }
9941
+ const transactionOptions = objectType().add(property("maxWait", numberType).optional()).add(property("timeout", numberType).optional());
9942
+ if (this.context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
9943
+ transactionOptions.add(property("isolationLevel", namedType("Prisma.TransactionIsolationLevel")).optional());
10017
9944
  }
10018
- return argsTypes;
10019
- }
10020
- toTS() {
10021
- const { type } = this;
10022
- const { name } = type;
10023
- const outputType = buildOutputType(type);
10024
- return `
10025
- /**
10026
- * Count Type ${name}
10027
- */
10028
-
10029
- ${stringify(outputType)}
10030
-
10031
- export type ${getSelectName(name)}<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = {
10032
- ${(0, import_indent_string7.default)(
10033
- type.fields.map((field) => {
10034
- const types = ["boolean"];
10035
- if (field.outputType.location === "outputObjectTypes") {
10036
- types.push(getFieldArgName(field, this.type.name));
10037
- }
10038
- if (field.args.length > 0) {
10039
- types.push(getCountArgsType(name, field.name));
10040
- }
10041
- return `${field.name}?: ${types.join(" | ")}`;
10042
- }).join("\n"),
10043
- TAB_SIZE
10044
- )}
10045
- }
10046
-
10047
- // Custom InputTypes
10048
- ${this.argsTypes.map((typeExport) => stringify(typeExport)).join("\n\n")}
10049
- `;
10050
- }
10051
- };
10052
- function getCountArgsType(typeName, fieldName) {
10053
- return `${typeName}Count${capitalize2(fieldName)}Args`;
10054
- }
10055
-
10056
- // src/generation/TSClient/CountTypesFile.ts
10057
- function createCountTypesFile(context) {
10058
- const countTypes = context.dmmf.schema.outputObjectTypes.prisma?.filter((t) => t.name.endsWith("CountOutputType")).map((t) => new Count(t, context));
10059
- return `import * as runtime from '${context.nestedRuntimeJsPath}';
10060
- import $Types = runtime.Types // general types
10061
- import $Public = runtime.Types.Public
10062
- import $Utils = runtime.Types.Utils
10063
- import $Extensions = runtime.Types.Extensions
10064
- import $Result = runtime.Types.Result
10065
- import Decimal = runtime.Decimal
10066
- import DecimalJsLike = runtime.DecimalJsLike
10067
-
10068
- import type * as Prisma from '../common'
10069
-
10070
- ${countTypes.map((t) => t.toTS()).join("\n")}
10071
- `;
10072
- }
10073
-
10074
- // src/generation/TSClient/DeepInputTypesFile.ts
10075
- function createDeepInputTypesFile(context) {
10076
- return `
10077
- import * as runtime from '${context.nestedRuntimeJsPath}';
10078
- import $Types = runtime.Types // general types
10079
- import $Public = runtime.Types.Public
10080
- import $Utils = runtime.Types.Utils
10081
- import $Extensions = runtime.Types.Extensions
10082
- import $Result = runtime.Types.Result
10083
- import Decimal = runtime.Decimal
10084
- import DecimalJsLike = runtime.DecimalJsLike
10085
- import JsonObject = runtime.JsonObject
10086
- import JsonArray = runtime.JsonArray
10087
- import JsonValue = runtime.JsonValue
10088
- import InputJsonObject = runtime.InputJsonObject
10089
- import InputJsonArray = runtime.InputJsonArray
10090
- import InputJsonValue = runtime.InputJsonValue
10091
-
10092
- import type * as $Enums from '../enums'
10093
- import type * as Prisma from '../common';
10094
-
10095
- ${context.dmmf.inputObjectTypes.prisma?.reduce((acc, inputType) => {
10096
- if (inputType.name.includes("Json") && inputType.name.includes("Filter")) {
10097
- const needsGeneric = context.genericArgsInfo.typeNeedsGenericModelArg(inputType);
10098
- const innerName = needsGeneric ? `${inputType.name}Base<$PrismaModel>` : `${inputType.name}Base`;
10099
- const typeName = needsGeneric ? `${inputType.name}<$PrismaModel = never>` : inputType.name;
10100
- const baseName = `Required<${innerName}>`;
10101
- acc.push(`export type ${typeName} =
10102
- | Prisma.PatchUndefined<
10103
- Prisma.Either<${baseName}, Exclude<keyof ${baseName}, 'path'>>,
10104
- ${baseName}
10105
- >
10106
- | Prisma.OptionalFlat<Omit<${baseName}, 'path'>>`);
10107
- acc.push(new InputType(inputType, context).overrideName(`${inputType.name}Base`).toTS());
10108
- } else {
10109
- acc.push(new InputType(inputType, context).toTS());
9945
+ clientOptions.add(
9946
+ property("transactionOptions", transactionOptions).optional().setDocComment(docComment`
9947
+ The default values for transactionOptions
9948
+ maxWait ?= 2000
9949
+ timeout ?= 5000
9950
+ `)
9951
+ );
9952
+ if (["library.js", "client.js"].includes(this.runtimeNameTs) && this.context.isPreviewFeatureOn("driverAdapters")) {
9953
+ clientOptions.add(
9954
+ property("adapter", unionType([namedType("runtime.DriverAdapter"), namedType("null")])).optional().setDocComment(
9955
+ docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
9956
+ )
9957
+ );
10110
9958
  }
10111
- return acc;
10112
- }, []).join("\n")}
10113
- `;
10114
- }
10115
-
10116
- // src/generation/TSClient/EnumsFile.ts
10117
- function createEnumsFile(context) {
10118
- const modelEnums = [];
10119
- for (const datamodelEnum of context.dmmf.datamodel.enums) {
10120
- modelEnums.push(new Enum(datamodelEnumToSchemaEnum(datamodelEnum), false).toTS());
10121
- }
10122
- return modelEnums.join("\n\n");
10123
- }
9959
+ clientOptions.add(
9960
+ property("omit", namedType("Prisma.GlobalOmitConfig")).optional().setDocComment(docComment`
9961
+ Global configuration for omitting model fields by default.
10124
9962
 
10125
- // src/generation/TSClient/GenerateContext.ts
10126
- var GenerateContext = class {
10127
- constructor({ dmmf, genericArgsInfo, generator, runtimeJsPath }) {
10128
- this.dmmf = dmmf;
10129
- this.genericArgsInfo = genericArgsInfo;
10130
- this.generator = generator;
10131
- this.runtimeJsPath = runtimeJsPath;
10132
- }
10133
- isPreviewFeatureOn(previewFeature) {
10134
- return this.generator?.previewFeatures?.includes(previewFeature) ?? false;
10135
- }
10136
- get nestedRuntimeJsPath() {
10137
- if (!this.runtimeJsPath.startsWith(".")) {
10138
- return this.runtimeJsPath;
10139
- }
10140
- if (this.runtimeJsPath.startsWith("./")) {
10141
- return `.${this.runtimeJsPath}`;
10142
- }
10143
- return `../${this.runtimeJsPath}`;
9963
+ @example
9964
+ \`\`\`
9965
+ const prisma = new PrismaClient({
9966
+ omit: {
9967
+ user: {
9968
+ password: true
9969
+ }
9970
+ }
9971
+ })
9972
+ \`\`\`
9973
+ `)
9974
+ );
9975
+ return clientOptions;
10144
9976
  }
10145
9977
  };
10146
9978
 
10147
- // src/generation/TSClient/ModelFiles.ts
10148
- function createModelFiles(context) {
10149
- const importStatements = `import * as runtime from '${context.nestedRuntimeJsPath}';
10150
- import $Types = runtime.Types // general types
10151
- import $Public = runtime.Types.Public
10152
- import $Utils = runtime.Types.Utils
10153
- import $Extensions = runtime.Types.Extensions
10154
- import $Result = runtime.Types.Result
10155
- import Decimal = runtime.Decimal
10156
- import DecimalJsLike = runtime.DecimalJsLike
10157
- import JsonObject = runtime.JsonObject
10158
- import JsonArray = runtime.JsonArray
10159
- import JsonValue = runtime.JsonValue
10160
- import InputJsonObject = runtime.InputJsonObject
10161
- import InputJsonArray = runtime.InputJsonArray
10162
- import InputJsonValue = runtime.InputJsonValue
10163
-
10164
- import type * as $Enums from '../enums'
10165
- import type * as Prisma from '../common'`;
10166
- const modelAndTypes = Object.values(context.dmmf.typeAndModelMap).filter((modelOrType) => context.dmmf.outputTypeMap.model[modelOrType.name]).map((modelOrType) => new Model(modelOrType, context));
10167
- const modelsFileMap = {};
10168
- modelAndTypes.forEach((m) => {
10169
- return modelsFileMap[m.fileName()] = `
10170
- ${importStatements}
10171
-
10172
- ${m.toTS()}
10173
- `;
10174
- });
10175
- return modelsFileMap;
10176
- }
10177
-
10178
9979
  // src/generation/TSClient/TSClient.ts
10179
9980
  var TSClient = class {
10180
9981
  constructor(options) {
@@ -10271,39 +10072,137 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
10271
10072
  const context = new GenerateContext({
10272
10073
  dmmf: this.dmmf,
10273
10074
  genericArgsInfo: this.genericsInfo,
10274
- generator: this.options.generator,
10275
- runtimeJsPath: `${this.options.runtimeBase}/${this.options.runtimeNameTs}`
10075
+ generator: this.options.generator
10276
10076
  });
10277
- const modelAndTypes = Object.values(context.dmmf.typeAndModelMap).filter((modelOrType) => context.dmmf.outputTypeMap.model[modelOrType.name]).map((modelOrType) => new Model(modelOrType, context));
10278
- const modelEnumsAliases = this.dmmf.datamodel.enums.map((datamodelEnum) => {
10279
- return [
10077
+ const prismaClientClass = new PrismaClientClass(
10078
+ context,
10079
+ this.options.datasources,
10080
+ this.options.outputDir,
10081
+ this.options.runtimeNameTs,
10082
+ this.options.browser
10083
+ );
10084
+ const commonCode = commonCodeTS(this.options);
10085
+ const modelAndTypes = Object.values(this.dmmf.typeAndModelMap).reduce((acc, modelOrType) => {
10086
+ if (this.dmmf.outputTypeMap.model[modelOrType.name]) {
10087
+ acc.push(new Model(modelOrType, context));
10088
+ }
10089
+ return acc;
10090
+ }, []);
10091
+ const prismaEnums = this.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
10092
+ const modelEnums = [];
10093
+ const modelEnumsAliases = [];
10094
+ for (const datamodelEnum of this.dmmf.datamodel.enums) {
10095
+ modelEnums.push(new Enum(datamodelEnumToSchemaEnum(datamodelEnum), false).toTS());
10096
+ modelEnumsAliases.push(
10280
10097
  stringify(
10281
10098
  moduleExport(typeDeclaration(datamodelEnum.name, namedType(`$Enums.${datamodelEnum.name}`)))
10282
10099
  ),
10283
10100
  stringify(
10284
10101
  moduleExport(constDeclaration(datamodelEnum.name, namedType(`typeof $Enums.${datamodelEnum.name}`)))
10285
10102
  )
10286
- ].join("\n");
10287
- });
10288
- return `
10289
- import * as runtime from '${context.runtimeJsPath}';
10290
- import $Public = runtime.Types.Public
10291
- import $Result = runtime.Types.Result
10103
+ );
10104
+ }
10105
+ const fieldRefs = this.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
10106
+ const countTypes = this.dmmf.schema.outputObjectTypes.prisma?.filter((t) => t.name.endsWith("CountOutputType")).map((t) => new Count(t, context));
10107
+ const code = `
10108
+ /**
10109
+ * Client
10110
+ **/
10111
+
10112
+ ${commonCode.tsWithoutNamespace()}
10113
+
10114
+ ${modelAndTypes.map((m) => m.toTSWithoutNamespace()).join("\n")}
10115
+ ${modelEnums.length > 0 ? `
10116
+ /**
10117
+ * Enums
10118
+ */
10119
+ export namespace $Enums {
10120
+ ${modelEnums.join("\n\n")}
10121
+ }
10292
10122
 
10293
- import type * as Prisma from './common';
10294
- import type * as $Enums from './enums'
10123
+ ${modelEnumsAliases.join("\n\n")}
10124
+ ` : ""}
10125
+ ${prismaClientClass.toTSWithoutNamespace()}
10295
10126
 
10296
- export type * as Prisma from './common';
10297
- export type * as $Enums from './enums';
10127
+ export namespace Prisma {
10128
+ ${(0, import_indent_string8.default)(
10129
+ `${commonCode.ts()}
10130
+ ${new Enum(
10131
+ {
10132
+ name: "ModelName",
10133
+ values: this.dmmf.mappings.modelOperations.map((m) => m.model)
10134
+ },
10135
+ true
10136
+ ).toTS()}
10298
10137
 
10299
- export { PrismaClient } from './client';
10138
+ ${prismaClientClass.toTS()}
10139
+ export type Datasource = {
10140
+ url?: string
10141
+ }
10300
10142
 
10301
- export type PrismaPromise<T> = $Public.PrismaPromise<T>
10143
+ /**
10144
+ * Count Types
10145
+ */
10302
10146
 
10303
- ${modelAndTypes.map((m) => m.toTSWithoutNamespace()).join("\n")}
10147
+ ${countTypes.map((t) => t.toTS()).join("\n")}
10304
10148
 
10305
- ${modelEnumsAliases.length > 0 ? `${modelEnumsAliases.join("\n\n")}` : ""}
10306
- `;
10149
+ /**
10150
+ * Models
10151
+ */
10152
+ ${modelAndTypes.map((model) => model.toTS()).join("\n")}
10153
+
10154
+ /**
10155
+ * Enums
10156
+ */
10157
+
10158
+ ${prismaEnums?.join("\n\n")}
10159
+ ${fieldRefs.length > 0 ? `
10160
+ /**
10161
+ * Field references
10162
+ */
10163
+
10164
+ ${fieldRefs.join("\n\n")}` : ""}
10165
+ /**
10166
+ * Deep Input Types
10167
+ */
10168
+
10169
+ ${this.dmmf.inputObjectTypes.prisma?.reduce((acc, inputType) => {
10170
+ if (inputType.name.includes("Json") && inputType.name.includes("Filter")) {
10171
+ const needsGeneric = this.genericsInfo.typeNeedsGenericModelArg(inputType);
10172
+ const innerName = needsGeneric ? `${inputType.name}Base<$PrismaModel>` : `${inputType.name}Base`;
10173
+ const typeName = needsGeneric ? `${inputType.name}<$PrismaModel = never>` : inputType.name;
10174
+ const baseName = `Required<${innerName}>`;
10175
+ acc.push(`export type ${typeName} =
10176
+ | PatchUndefined<
10177
+ Either<${baseName}, Exclude<keyof ${baseName}, 'path'>>,
10178
+ ${baseName}
10179
+ >
10180
+ | OptionalFlat<Omit<${baseName}, 'path'>>`);
10181
+ acc.push(new InputType(inputType, context).overrideName(`${inputType.name}Base`).toTS());
10182
+ } else {
10183
+ acc.push(new InputType(inputType, context).toTS());
10184
+ }
10185
+ return acc;
10186
+ }, []).join("\n")}
10187
+
10188
+ ${this.dmmf.inputObjectTypes.model?.map((inputType) => new InputType(inputType, context).toTS()).join("\n") ?? ""}
10189
+
10190
+ /**
10191
+ * Batch Payload for updateMany & deleteMany & createMany
10192
+ */
10193
+
10194
+ export type BatchPayload = {
10195
+ count: number
10196
+ }
10197
+
10198
+ /**
10199
+ * DMMF
10200
+ */
10201
+ export const dmmf: runtime.BaseDMMF
10202
+ `,
10203
+ 2
10204
+ )}}`;
10205
+ return code;
10307
10206
  }
10308
10207
  toBrowserJS() {
10309
10208
  const code = `${commonCodeJS({
@@ -10359,25 +10258,6 @@ Object.assign(exports, Prisma)
10359
10258
  `;
10360
10259
  return code;
10361
10260
  }
10362
- generateModelAndHelperFiles() {
10363
- const context = new GenerateContext({
10364
- dmmf: this.dmmf,
10365
- genericArgsInfo: this.genericsInfo,
10366
- generator: this.options.generator,
10367
- runtimeJsPath: `${this.options.runtimeBase}/${this.options.runtimeNameTs}`
10368
- });
10369
- const modelsFileMap = createModelFiles(context);
10370
- modelsFileMap["deepInputTypes.d.ts"] = createDeepInputTypesFile(context);
10371
- modelsFileMap["countTypes.d.ts"] = createCountTypesFile(context);
10372
- const modelsBarrelFileContent = Object.keys(modelsFileMap).map((m) => `export type * from './models/${m}'`).join("\n");
10373
- return {
10374
- "models.d.ts": modelsBarrelFileContent,
10375
- "common.d.ts": createCommonFile(context, this.options),
10376
- "client.d.ts": createClientFile(context, this.options),
10377
- "enums.d.ts": createEnumsFile(context),
10378
- models: modelsFileMap
10379
- };
10380
- }
10381
10261
  };
10382
10262
 
10383
10263
  // src/generation/typedSql/buildDbEnums.ts
@@ -10749,7 +10629,7 @@ async function buildClient({
10749
10629
  version: clientVersion2,
10750
10630
  sideEffects: false
10751
10631
  };
10752
- const fileMap = nodeClient.generateModelAndHelperFiles();
10632
+ const fileMap = {};
10753
10633
  fileMap["index.js"] = JS(nodeClient);
10754
10634
  fileMap["index.d.ts"] = TS(nodeClient);
10755
10635
  fileMap["default.js"] = JS(defaultClient);