@prisma/client-generator-ts 6.19.0-integration-next.15 → 6.19.0-integration-engines-6-19-0-31-next-6f525e2b254a97a9c547ae5f2b29c54a171f6b23.1

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.
@@ -1 +1 @@
1
- export declare const nullTypes = "\nexport const NullTypes = {\n DbNull: runtime.NullTypes.DbNull as (new (secret: never) => typeof runtime.DbNull),\n JsonNull: runtime.NullTypes.JsonNull as (new (secret: never) => typeof runtime.JsonNull),\n AnyNull: runtime.NullTypes.AnyNull as (new (secret: never) => typeof runtime.AnyNull),\n}\n/**\n * Helper for filtering JSON entries that have `null` on the database (empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const DbNull = runtime.DbNull\n\n/**\n * Helper for filtering JSON entries that have JSON `null` values (not empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const JsonNull = runtime.JsonNull\n\n/**\n * Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull`\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const AnyNull = runtime.AnyNull\n";
1
+ export declare const nullTypes = "\nexport const NullTypes = {\n DbNull: runtime.objectEnumValues.classes.DbNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.DbNull),\n JsonNull: runtime.objectEnumValues.classes.JsonNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.JsonNull),\n AnyNull: runtime.objectEnumValues.classes.AnyNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.AnyNull),\n}\n/**\n * Helper for filtering JSON entries that have `null` on the database (empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const DbNull = runtime.objectEnumValues.instances.DbNull\n/**\n * Helper for filtering JSON entries that have JSON `null` values (not empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const JsonNull = runtime.objectEnumValues.instances.JsonNull\n/**\n * Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull`\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const AnyNull = runtime.objectEnumValues.instances.AnyNull\n";
@@ -8,4 +8,5 @@ export declare class PrismaClientClass {
8
8
  constructor(context: GenerateContext, runtimeName: TSClientOptions['runtimeName']);
9
9
  private get jsDoc();
10
10
  toTS(): string;
11
+ private applyPendingMigrationsDefinition;
11
12
  }
@@ -3,7 +3,7 @@ import { DMMFHelper } from '../dmmf';
3
3
  import type { FileMap } from '../generateClient';
4
4
  import { GenerateClientOptions } from '../generateClient';
5
5
  import { GenericArgsInfo } from '../GenericsArgsInfo';
6
- export type RuntimeName = 'library' | 'wasm-compiler-edge' | 'client' | (string & {});
6
+ export type RuntimeName = 'binary' | 'library' | 'wasm-engine-edge' | 'wasm-compiler-edge' | 'edge' | 'react-native' | 'client' | (string & {});
7
7
  export type TSClientOptions = O.Required<GenerateClientOptions, 'runtimeBase'> & {
8
8
  /** The name of the runtime bundle to use */
9
9
  runtimeName: RuntimeName;
@@ -26,6 +26,8 @@ export interface GenerateClientOptions {
26
26
  envPaths?: EnvPaths;
27
27
  /** When --postinstall is passed via CLI */
28
28
  postinstall?: boolean;
29
+ /** False when --no-engine is passed via CLI */
30
+ copyEngine?: boolean;
29
31
  typedSql?: SqlQueryOutput[];
30
32
  target: RuntimeTargetInternal;
31
33
  generatedFileExtension: GeneratedFileExtension;
@@ -41,5 +43,5 @@ export interface BuildClientResult {
41
43
  fileMap: FileMap;
42
44
  prismaClientDmmf: DMMF.Document;
43
45
  }
44
- export declare function buildClient({ schemaPath, runtimeBase, datamodel, binaryPaths, outputDir, generator, dmmf, datasources, engineVersion, clientVersion, activeProvider, postinstall, envPaths, typedSql, target, generatedFileExtension, importFileExtension, moduleFormat, tsNoCheckPreamble, }: O.Required<GenerateClientOptions, 'runtimeBase'>): BuildClientResult;
46
+ export declare function buildClient({ schemaPath, runtimeBase, datamodel, binaryPaths, outputDir, generator, dmmf, datasources, engineVersion, clientVersion, activeProvider, postinstall, copyEngine, envPaths, typedSql, target, generatedFileExtension, importFileExtension, moduleFormat, tsNoCheckPreamble, }: O.Required<GenerateClientOptions, 'runtimeBase'>): BuildClientResult;
45
47
  export declare function generateClient(options: GenerateClientOptions): Promise<void>;
package/dist/index.d.mts CHANGED
@@ -40,6 +40,8 @@ export declare interface GenerateClientOptions {
40
40
  envPaths?: EnvPaths;
41
41
  /** When --postinstall is passed via CLI */
42
42
  postinstall?: boolean;
43
+ /** False when --no-engine is passed via CLI */
44
+ copyEngine?: boolean;
43
45
  typedSql?: SqlQueryOutput[];
44
46
  target: RuntimeTargetInternal;
45
47
  generatedFileExtension: GeneratedFileExtension;
@@ -70,6 +72,6 @@ export declare class PrismaClientTsGenerator implements Generator_2 {
70
72
  */
71
73
  declare type RuntimeTargetInternal = (typeof supportedInternalRuntimes)[number];
72
74
 
73
- declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno"];
75
+ declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno", "react-native"];
74
76
 
75
77
  export { }
package/dist/index.d.ts CHANGED
@@ -40,6 +40,8 @@ export declare interface GenerateClientOptions {
40
40
  envPaths?: EnvPaths;
41
41
  /** When --postinstall is passed via CLI */
42
42
  postinstall?: boolean;
43
+ /** False when --no-engine is passed via CLI */
44
+ copyEngine?: boolean;
43
45
  typedSql?: SqlQueryOutput[];
44
46
  target: RuntimeTargetInternal;
45
47
  generatedFileExtension: GeneratedFileExtension;
@@ -70,6 +72,6 @@ export declare class PrismaClientTsGenerator implements Generator_2 {
70
72
  */
71
73
  declare type RuntimeTargetInternal = (typeof supportedInternalRuntimes)[number];
72
74
 
73
- declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno"];
75
+ declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno", "react-native"];
74
76
 
75
77
  export { }
package/dist/index.js CHANGED
@@ -2385,7 +2385,7 @@ var Enum = class {
2385
2385
  toTS() {
2386
2386
  const { type } = this;
2387
2387
  const enumVariants = `{
2388
- ${(0, import_indent_string.default)(type.data.map((v) => `${v.key}: ${this.getValue(v.value)}`).join(",\n"), TAB_SIZE)}
2388
+ ${(0, import_indent_string.default)(type.values.map((v) => `${v}: ${this.getValue(v)}`).join(",\n"), TAB_SIZE)}
2389
2389
  } as const`;
2390
2390
  const enumBody = this.isStrictEnum() ? `runtime.makeStrictEnum(${enumVariants})` : enumVariants;
2391
2391
  return `export const ${type.name} = ${enumBody}
@@ -2939,6 +2939,7 @@ ${modelExports(context).join("\n")}
2939
2939
  }
2940
2940
 
2941
2941
  // src/TSClient/file-generators/ClassFile.ts
2942
+ var import_node_crypto = __toESM(require("node:crypto"));
2942
2943
  var import_node_path2 = __toESM(require("node:path"));
2943
2944
  var import_internals4 = require("@prisma/internals");
2944
2945
  var ts6 = __toESM(require("@prisma/ts-builders"));
@@ -3455,7 +3456,7 @@ function escapeJson(str) {
3455
3456
  function buildRuntimeDataModel(datamodel, runtimeName) {
3456
3457
  const runtimeDataModel = (0, import_client_common10.dmmfToRuntimeDataModel)(datamodel);
3457
3458
  let prunedDataModel;
3458
- if (runtimeName === "wasm-compiler-edge" || runtimeName === "client") {
3459
+ if (runtimeName === "wasm-engine-edge" || runtimeName === "wasm-compiler-edge" || runtimeName === "client") {
3459
3460
  prunedDataModel = (0, import_client_common10.pruneRuntimeDataModel)(runtimeDataModel);
3460
3461
  } else {
3461
3462
  prunedDataModel = runtimeDataModel;
@@ -3487,7 +3488,7 @@ var import_debug = require("@prisma/debug");
3487
3488
  var import_ts_pattern = require("ts-pattern");
3488
3489
  var debug = (0, import_debug.Debug)("prisma:client-generator-ts:wasm");
3489
3490
  function usesEdgeWasmRuntime(component, runtimeName) {
3490
- return runtimeName === "wasm-compiler-edge" && component === "compiler";
3491
+ return runtimeName === "wasm-engine-edge" && component === "engine" || runtimeName === "wasm-compiler-edge" && component === "compiler";
3491
3492
  }
3492
3493
  function buildGetWasmModule({
3493
3494
  component,
@@ -3583,6 +3584,9 @@ var import_indent_string3 = __toESM(require("indent-string"));
3583
3584
 
3584
3585
  // src/utils/runtimeImport.ts
3585
3586
  var ts4 = __toESM(require("@prisma/ts-builders"));
3587
+ function runtimeImport(name) {
3588
+ return name;
3589
+ }
3586
3590
  function runtimeImportedType(name) {
3587
3591
  return ts4.namedType(`runtime.${name}`);
3588
3592
  }
@@ -3726,6 +3730,24 @@ function queryRawTypedDefinition(context) {
3726
3730
  ).setReturnType(prismaPromise(ts5.array(param.toArgument())));
3727
3731
  return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
3728
3732
  }
3733
+ function metricDefinition(context) {
3734
+ if (!context.isPreviewFeatureOn("metrics")) {
3735
+ return "";
3736
+ }
3737
+ const property13 = ts5.property("$metrics", ts5.namedType(`runtime.${runtimeImport("MetricsClient")}`)).setDocComment(
3738
+ ts5.docComment`
3739
+ Gives access to the client metrics in json or prometheus format.
3740
+
3741
+ @example
3742
+ \`\`\`
3743
+ const metrics = await prisma.$metrics.json()
3744
+ // or
3745
+ const metrics = await prisma.$metrics.prometheus()
3746
+ \`\`\`
3747
+ `
3748
+ ).readonly();
3749
+ return ts5.stringify(property13, { indentLevel: 1, newLine: "leading" });
3750
+ }
3729
3751
  function runCommandRawDefinition(context) {
3730
3752
  if (!context.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
3731
3753
  return "";
@@ -3745,6 +3767,13 @@ function runCommandRawDefinition(context) {
3745
3767
  `);
3746
3768
  return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
3747
3769
  }
3770
+ function eventRegistrationMethodDeclaration(runtimeName) {
3771
+ if (runtimeName === "binary") {
3772
+ return `$on<V extends (LogOpts | 'beforeExit')>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : V extends 'beforeExit' ? () => runtime.Types.Utils.JsPromise<void> : Prisma.LogEvent) => void): PrismaClient;`;
3773
+ } else {
3774
+ return `$on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;`;
3775
+ }
3776
+ }
3748
3777
  function getPrismaClientClassDocComment({ dmmf }) {
3749
3778
  let example;
3750
3779
  if (dmmf.mappings.modelOperations.length) {
@@ -3800,7 +3829,7 @@ export interface PrismaClient<
3800
3829
  > {
3801
3830
  [K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
3802
3831
 
3803
- $on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;
3832
+ ${eventRegistrationMethodDeclaration(this.runtimeName)}
3804
3833
 
3805
3834
  /**
3806
3835
  * Connect with the database
@@ -3819,6 +3848,8 @@ ${[
3819
3848
  batchingTransactionDefinition(this.context),
3820
3849
  interactiveTransactionDefinition(this.context),
3821
3850
  runCommandRawDefinition(this.context),
3851
+ metricDefinition(this.context),
3852
+ this.applyPendingMigrationsDefinition(),
3822
3853
  extendsPropertyDefinition()
3823
3854
  ].filter((d) => d !== null).join("\n").trim()}
3824
3855
 
@@ -3843,6 +3874,15 @@ get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
3843
3874
  )}
3844
3875
  }`;
3845
3876
  }
3877
+ applyPendingMigrationsDefinition() {
3878
+ if (this.runtimeName !== "react-native") {
3879
+ return null;
3880
+ }
3881
+ const method3 = ts5.method("$applyPendingMigrations").setReturnType(promise(ts5.voidType)).setDocComment(
3882
+ ts5.docComment`Tries to apply pending migrations one by one. If a migration fails to apply, the function will stop and throw an error. You are responsible for informing the user and possibly blocking the app as we cannot guarantee the state of the database.`
3883
+ );
3884
+ return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
3885
+ }
3846
3886
  };
3847
3887
 
3848
3888
  // src/TSClient/file-generators/ClassFile.ts
@@ -3883,12 +3923,14 @@ function clientConfig(context, options) {
3883
3923
  runtimeBase,
3884
3924
  runtimeName,
3885
3925
  datasources,
3926
+ copyEngine = true,
3886
3927
  target,
3887
3928
  activeProvider,
3888
3929
  moduleFormat
3889
3930
  } = options;
3890
3931
  const clientEngineType = (0, import_internals4.getClientEngineType)(generator);
3891
3932
  generator.config.engineType = clientEngineType;
3933
+ const inlineSchemaHash = import_node_crypto.default.createHash("sha256").update(Buffer.from(inlineSchema, "utf8").toString("base64")).digest("hex");
3892
3934
  const datasourceFilePath = datasources[0].sourceFilePath;
3893
3935
  const config = {
3894
3936
  generator,
@@ -3901,6 +3943,8 @@ function clientConfig(context, options) {
3901
3943
  ciName: import_ci_info.default.name ?? void 0,
3902
3944
  inlineDatasources: buildInlineDatasources(datasources),
3903
3945
  inlineSchema,
3946
+ inlineSchemaHash,
3947
+ copyEngine,
3904
3948
  runtimeDataModel: { models: {}, enums: {}, types: {} },
3905
3949
  dirname: ""
3906
3950
  };
@@ -3949,6 +3993,9 @@ function getQueryEngineFilename(engineType, binaryTarget) {
3949
3993
  if (engineType === import_internals5.ClientEngineType.Library) {
3950
3994
  return (0, import_get_platform.getNodeAPIName)(binaryTarget, "fs");
3951
3995
  }
3996
+ if (engineType === import_internals5.ClientEngineType.Binary) {
3997
+ return `query-engine-${binaryTarget}`;
3998
+ }
3952
3999
  return void 0;
3953
4000
  }
3954
4001
  function buildNFTAnnotation(fileName, relativeOutdir) {
@@ -3995,7 +4042,7 @@ function createClientFile(context, options) {
3995
4042
  )
3996
4043
  )
3997
4044
  ].map((e) => ts7.stringify(e));
3998
- const binaryTargets = clientEngineType === import_internals6.ClientEngineType.Library ? Object.keys(options.binaryPaths.libqueryEngine ?? {}) : [];
4045
+ const binaryTargets = clientEngineType === import_internals6.ClientEngineType.Library ? Object.keys(options.binaryPaths.libqueryEngine ?? {}) : Object.keys(options.binaryPaths.queryEngine ?? {});
3999
4046
  const relativeOutdir = import_node_path3.default.relative(process.cwd(), options.outputDir);
4000
4047
  return `${jsDocHeader3}
4001
4048
  ${buildPreamble(options.edge, options.moduleFormat)}
@@ -4004,7 +4051,7 @@ ${imports.join("\n")}
4004
4051
  ${exports2.join("\n")}
4005
4052
  export { Prisma }
4006
4053
 
4007
- ${buildNFTAnnotations(options.edge, clientEngineType, binaryTargets, relativeOutdir)}
4054
+ ${buildNFTAnnotations(options.edge || !options.copyEngine, clientEngineType, binaryTargets, relativeOutdir)}
4008
4055
 
4009
4056
  ${modelExports(context).join("\n")}
4010
4057
  `;
@@ -5106,36 +5153,33 @@ function createModelsFile(context, modelsNames) {
5106
5153
  }
5107
5154
 
5108
5155
  // src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
5109
- var import_dmmf2 = require("@prisma/dmmf");
5110
5156
  var ts16 = __toESM(require("@prisma/ts-builders"));
5111
5157
 
5112
5158
  // src/TSClient/NullTypes.ts
5113
5159
  var nullTypes = `
5114
5160
  export const NullTypes = {
5115
- DbNull: runtime.NullTypes.DbNull as (new (secret: never) => typeof runtime.DbNull),
5116
- JsonNull: runtime.NullTypes.JsonNull as (new (secret: never) => typeof runtime.JsonNull),
5117
- AnyNull: runtime.NullTypes.AnyNull as (new (secret: never) => typeof runtime.AnyNull),
5161
+ DbNull: runtime.objectEnumValues.classes.DbNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.DbNull),
5162
+ JsonNull: runtime.objectEnumValues.classes.JsonNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.JsonNull),
5163
+ AnyNull: runtime.objectEnumValues.classes.AnyNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.AnyNull),
5118
5164
  }
5119
5165
  /**
5120
5166
  * Helper for filtering JSON entries that have \`null\` on the database (empty on the db)
5121
5167
  *
5122
5168
  * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
5123
5169
  */
5124
- export const DbNull = runtime.DbNull
5125
-
5170
+ export const DbNull = runtime.objectEnumValues.instances.DbNull
5126
5171
  /**
5127
5172
  * Helper for filtering JSON entries that have JSON \`null\` values (not empty on the db)
5128
5173
  *
5129
5174
  * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
5130
5175
  */
5131
- export const JsonNull = runtime.JsonNull
5132
-
5176
+ export const JsonNull = runtime.objectEnumValues.instances.JsonNull
5133
5177
  /**
5134
5178
  * Helper for filtering JSON entries that are \`Prisma.DbNull\` or \`Prisma.JsonNull\`
5135
5179
  *
5136
5180
  * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
5137
5181
  */
5138
- export const AnyNull = runtime.AnyNull
5182
+ export const AnyNull = runtime.objectEnumValues.instances.AnyNull
5139
5183
  `;
5140
5184
 
5141
5185
  // src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
@@ -5152,9 +5196,7 @@ var jsDocHeader7 = `/*
5152
5196
  */
5153
5197
  `;
5154
5198
  function createPrismaNamespaceBrowserFile(context) {
5155
- const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
5156
- (datamodelEnum) => new Enum((0, import_dmmf2.datamodelSchemaEnumToSchemaEnum)(datamodelEnum), false).toTS()
5157
- );
5199
+ const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
5158
5200
  return `${jsDocHeader7}
5159
5201
  ${ts16.stringify(ts16.moduleImport(`${context.runtimeBase}/index-browser`).asNamespace("runtime"))}
5160
5202
 
@@ -5168,10 +5210,7 @@ ${nullTypes}
5168
5210
  ${new Enum(
5169
5211
  {
5170
5212
  name: "ModelName",
5171
- data: context.dmmf.mappings.modelOperations.map((m) => ({
5172
- key: m.model,
5173
- value: m.model
5174
- }))
5213
+ values: context.dmmf.mappings.modelOperations.map((m) => m.model)
5175
5214
  },
5176
5215
  true
5177
5216
  ).toTS()}
@@ -5184,7 +5223,6 @@ ${prismaEnums?.join("\n\n")}
5184
5223
  }
5185
5224
 
5186
5225
  // src/TSClient/file-generators/PrismaNamespaceFile.ts
5187
- var import_dmmf3 = require("@prisma/dmmf");
5188
5226
  var ts19 = __toESM(require("@prisma/ts-builders"));
5189
5227
 
5190
5228
  // src/TSClient/common.ts
@@ -5232,6 +5270,14 @@ export type Decimal = runtime.Decimal
5232
5270
 
5233
5271
  export type DecimalJsLike = runtime.DecimalJsLike
5234
5272
 
5273
+ /**
5274
+ * Metrics
5275
+ */
5276
+ export type Metrics = runtime.Metrics
5277
+ export type Metric<T> = runtime.Metric<T>
5278
+ export type MetricHistogram = runtime.MetricHistogram
5279
+ export type MetricHistogramBucket = runtime.MetricHistogramBucket
5280
+
5235
5281
  /**
5236
5282
  * Extensions
5237
5283
  */
@@ -5716,9 +5762,7 @@ function createPrismaNamespaceFile(context, options) {
5716
5762
  ts19.moduleImport(context.importFileName(`../models`)).asNamespace("Prisma").typeOnly(),
5717
5763
  ts19.moduleImport(context.importFileName(`./class`)).named(ts19.namedImport("PrismaClient").typeOnly())
5718
5764
  ].map((i) => ts19.stringify(i));
5719
- const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
5720
- (type) => new Enum((0, import_dmmf3.datamodelSchemaEnumToSchemaEnum)(type), true).toTS()
5721
- );
5765
+ const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
5722
5766
  const fieldRefs = context.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
5723
5767
  return `${jsDocHeader8}
5724
5768
  ${imports.join("\n")}
@@ -5729,10 +5773,7 @@ ${commonCodeTS(options)}
5729
5773
  ${new Enum(
5730
5774
  {
5731
5775
  name: "ModelName",
5732
- data: context.dmmf.mappings.modelOperations.map((m) => ({
5733
- key: m.model,
5734
- value: m.model
5735
- }))
5776
+ values: context.dmmf.mappings.modelOperations.map((m) => m.model)
5736
5777
  },
5737
5778
  true
5738
5779
  ).toTS()}
@@ -5842,6 +5883,8 @@ function clientExtensionsDefinitions() {
5842
5883
  function buildClientOptions(context, options) {
5843
5884
  const clientOptions = ts19.interfaceDeclaration("PrismaClientOptions").add(
5844
5885
  ts19.property("datasources", ts19.namedType("Datasources")).optional().setDocComment(ts19.docComment("Overwrites the datasource url from your schema.prisma file"))
5886
+ ).add(
5887
+ ts19.property("datasourceUrl", ts19.stringType).optional().setDocComment(ts19.docComment("Overwrites the datasource url from your schema.prisma file"))
5845
5888
  ).add(
5846
5889
  ts19.property("errorFormat", ts19.namedType("ErrorFormat")).optional().setDocComment(ts19.docComment('@default "colorless"'))
5847
5890
  ).add(
@@ -5881,20 +5924,13 @@ function buildClientOptions(context, options) {
5881
5924
  timeout ?= 5000
5882
5925
  `)
5883
5926
  );
5884
- if (["library", "client", "wasm-compiler-edge"].includes(options.runtimeName)) {
5927
+ if (["library", "client", "wasm-compiler-edge", "wasm-engine-edge"].includes(options.runtimeName)) {
5885
5928
  clientOptions.add(
5886
- ts19.property("adapter", ts19.namedType("runtime.SqlDriverAdapterFactory")).optional().setDocComment(
5929
+ ts19.property("adapter", ts19.unionType([ts19.namedType("runtime.SqlDriverAdapterFactory"), ts19.namedType("null")])).optional().setDocComment(
5887
5930
  ts19.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
5888
5931
  )
5889
5932
  );
5890
5933
  }
5891
- clientOptions.add(
5892
- ts19.property("accelerateUrl", ts19.stringType).optional().setDocComment(
5893
- ts19.docComment(
5894
- "Prisma Accelerate URL allowing the client to connect through Accelerate instead of a direct database."
5895
- )
5896
- )
5897
- );
5898
5934
  clientOptions.add(
5899
5935
  ts19.property("omit", ts19.namedType("GlobalOmitConfig")).optional().setDocComment(ts19.docComment`
5900
5936
  Global configuration for omitting model fields by default.
@@ -5927,7 +5963,7 @@ var GenerateContext = class {
5927
5963
  dmmf,
5928
5964
  genericArgsInfo,
5929
5965
  runtimeBase,
5930
- runtimeImport,
5966
+ runtimeImport: runtimeImport2,
5931
5967
  outputFileName,
5932
5968
  importFileName,
5933
5969
  generator
@@ -5935,7 +5971,7 @@ var GenerateContext = class {
5935
5971
  this.dmmf = dmmf;
5936
5972
  this.genericArgsInfo = genericArgsInfo;
5937
5973
  this.runtimeBase = runtimeBase;
5938
- this.runtimeImport = runtimeImport;
5974
+ this.runtimeImport = runtimeImport2;
5939
5975
  this.outputFileName = outputFileName;
5940
5976
  this.importFileName = importFileName;
5941
5977
  this.generator = generator;
@@ -6256,6 +6292,7 @@ function buildClient({
6256
6292
  clientVersion,
6257
6293
  activeProvider,
6258
6294
  postinstall,
6295
+ copyEngine,
6259
6296
  envPaths,
6260
6297
  typedSql,
6261
6298
  target,
@@ -6281,8 +6318,9 @@ function buildClient({
6281
6318
  engineVersion,
6282
6319
  activeProvider,
6283
6320
  postinstall,
6321
+ copyEngine,
6284
6322
  datamodel,
6285
- edge: ["wasm-compiler-edge"].includes(runtimeName),
6323
+ edge: ["edge", "wasm-engine-edge", "wasm-compiler-edge", "react-native"].includes(runtimeName),
6286
6324
  runtimeName,
6287
6325
  target,
6288
6326
  generatedFileExtension,
@@ -6290,6 +6328,9 @@ function buildClient({
6290
6328
  moduleFormat,
6291
6329
  tsNoCheckPreamble: tsNoCheckPreamble2
6292
6330
  };
6331
+ if (runtimeName === "react-native" && !generator.previewFeatures.includes("reactNative")) {
6332
+ throw new Error(`Using the "react-native" runtime requires the "reactNative" preview feature to be enabled.`);
6333
+ }
6293
6334
  const client = new TSClient(clientOptions);
6294
6335
  let fileMap = client.generateClientFiles();
6295
6336
  if (typedSql && typedSql.length > 0) {
@@ -6345,6 +6386,7 @@ async function generateClient(options) {
6345
6386
  activeProvider,
6346
6387
  postinstall,
6347
6388
  envPaths,
6389
+ copyEngine = true,
6348
6390
  typedSql,
6349
6391
  target,
6350
6392
  generatedFileExtension,
@@ -6367,6 +6409,7 @@ async function generateClient(options) {
6367
6409
  engineVersion,
6368
6410
  activeProvider,
6369
6411
  postinstall,
6412
+ copyEngine,
6370
6413
  envPaths,
6371
6414
  typedSql,
6372
6415
  target,
@@ -6391,8 +6434,8 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
6391
6434
  await deleteOutputDir(outputDir);
6392
6435
  await (0, import_fs_extra.ensureDir)(outputDir);
6393
6436
  await writeFileMap(outputDir, fileMap);
6394
- const enginePath = clientEngineType === import_internals10.ClientEngineType.Library ? binaryPaths.libqueryEngine : void 0;
6395
- if (enginePath) {
6437
+ const enginePath = clientEngineType === import_internals10.ClientEngineType.Library ? binaryPaths.libqueryEngine : binaryPaths.queryEngine;
6438
+ if (copyEngine && enginePath) {
6396
6439
  if (process.env.NETLIFY) {
6397
6440
  await (0, import_fs_extra.ensureDir)("/tmp/prisma-engines");
6398
6441
  }
@@ -6517,12 +6560,17 @@ function getRuntimeNameForTarget(target, engineType) {
6517
6560
  return getNodeRuntimeName(engineType);
6518
6561
  case "workerd":
6519
6562
  case "vercel-edge":
6520
- return "wasm-compiler-edge";
6563
+ return engineType === import_internals10.ClientEngineType.Client ? "wasm-compiler-edge" : "wasm-engine-edge";
6564
+ case "react-native":
6565
+ return "react-native";
6521
6566
  default:
6522
6567
  (0, import_internals10.assertNever)(target, "Unknown runtime target");
6523
6568
  }
6524
6569
  }
6525
6570
  function getNodeRuntimeName(engineType) {
6571
+ if (engineType === import_internals10.ClientEngineType.Binary) {
6572
+ return "binary";
6573
+ }
6526
6574
  if (engineType === import_internals10.ClientEngineType.Library) {
6527
6575
  return "library";
6528
6576
  }
@@ -6572,7 +6620,7 @@ var import_get_tsconfig = require("get-tsconfig");
6572
6620
  var import_ts_pattern2 = require("ts-pattern");
6573
6621
 
6574
6622
  // package.json
6575
- var version = "6.19.0-integration-next.15";
6623
+ var version = "6.19.0-integration-engines-6-19-0-31-next-6f525e2b254a97a9c547ae5f2b29c54a171f6b23.1";
6576
6624
 
6577
6625
  // src/module-format.ts
6578
6626
  function parseModuleFormat(format) {
@@ -6615,7 +6663,16 @@ function fromTsConfigModule(module2) {
6615
6663
  }
6616
6664
 
6617
6665
  // src/runtime-targets.ts
6618
- var supportedPublicRuntimes = ["nodejs", "deno", "bun", "workerd", "cloudflare", "vercel-edge", "edge-light"];
6666
+ var supportedPublicRuntimes = [
6667
+ "nodejs",
6668
+ "deno",
6669
+ "bun",
6670
+ "workerd",
6671
+ "cloudflare",
6672
+ "vercel-edge",
6673
+ "edge-light",
6674
+ "react-native"
6675
+ ];
6619
6676
  function parseRuntimeTarget(target) {
6620
6677
  switch (target.toLowerCase()) {
6621
6678
  case "workerd":
@@ -6629,6 +6686,8 @@ function parseRuntimeTarget(target) {
6629
6686
  return "nodejs";
6630
6687
  case "deno":
6631
6688
  return "deno";
6689
+ case "react-native":
6690
+ return "react-native";
6632
6691
  default:
6633
6692
  throw new Error(
6634
6693
  `Unknown target runtime: "${target}". The available options are: ${supportedPublicRuntimes.map((runtime) => `"${runtime}"`).join(", ")}`
@@ -6662,7 +6721,7 @@ function getOutputPath(config) {
6662
6721
  var PrismaClientTsGenerator = class {
6663
6722
  name = "prisma-client-ts";
6664
6723
  getManifest(config) {
6665
- const requiresEngines = (0, import_ts_pattern2.match)((0, import_internals11.getClientEngineType)(config)).with(import_internals11.ClientEngineType.Library, () => ["libqueryEngine"]).with(import_internals11.ClientEngineType.Client, () => []).exhaustive();
6724
+ const requiresEngines = (0, import_ts_pattern2.match)((0, import_internals11.getClientEngineType)(config)).with(import_internals11.ClientEngineType.Library, () => ["libqueryEngine"]).with(import_internals11.ClientEngineType.Binary, () => ["queryEngine"]).with(import_internals11.ClientEngineType.Client, () => []).exhaustive();
6666
6725
  debug2("requiresEngines", requiresEngines);
6667
6726
  return Promise.resolve({
6668
6727
  defaultOutput: getOutputPath(config),
@@ -6702,6 +6761,7 @@ var PrismaClientTsGenerator = class {
6702
6761
  clientVersion: version,
6703
6762
  activeProvider: options.datasources[0]?.activeProvider,
6704
6763
  postinstall: options.postinstall,
6764
+ copyEngine: !options.noEngine,
6705
6765
  typedSql: options.typedSql,
6706
6766
  target,
6707
6767
  generatedFileExtension,
package/dist/index.mjs CHANGED
@@ -2381,7 +2381,7 @@ var Enum = class {
2381
2381
  toTS() {
2382
2382
  const { type } = this;
2383
2383
  const enumVariants = `{
2384
- ${indent(type.data.map((v) => `${v.key}: ${this.getValue(v.value)}`).join(",\n"), TAB_SIZE)}
2384
+ ${indent(type.values.map((v) => `${v}: ${this.getValue(v)}`).join(",\n"), TAB_SIZE)}
2385
2385
  } as const`;
2386
2386
  const enumBody = this.isStrictEnum() ? `runtime.makeStrictEnum(${enumVariants})` : enumVariants;
2387
2387
  return `export const ${type.name} = ${enumBody}
@@ -2935,6 +2935,7 @@ ${modelExports(context).join("\n")}
2935
2935
  }
2936
2936
 
2937
2937
  // src/TSClient/file-generators/ClassFile.ts
2938
+ import crypto from "node:crypto";
2938
2939
  import path2 from "node:path";
2939
2940
  import { getClientEngineType as getClientEngineType2, pathToPosix } from "@prisma/internals";
2940
2941
  import * as ts6 from "@prisma/ts-builders";
@@ -3454,7 +3455,7 @@ function escapeJson(str) {
3454
3455
  function buildRuntimeDataModel(datamodel, runtimeName) {
3455
3456
  const runtimeDataModel = dmmfToRuntimeDataModel(datamodel);
3456
3457
  let prunedDataModel;
3457
- if (runtimeName === "wasm-compiler-edge" || runtimeName === "client") {
3458
+ if (runtimeName === "wasm-engine-edge" || runtimeName === "wasm-compiler-edge" || runtimeName === "client") {
3458
3459
  prunedDataModel = pruneRuntimeDataModel(runtimeDataModel);
3459
3460
  } else {
3460
3461
  prunedDataModel = runtimeDataModel;
@@ -3486,7 +3487,7 @@ import { Debug } from "@prisma/debug";
3486
3487
  import { match } from "ts-pattern";
3487
3488
  var debug = Debug("prisma:client-generator-ts:wasm");
3488
3489
  function usesEdgeWasmRuntime(component, runtimeName) {
3489
- return runtimeName === "wasm-compiler-edge" && component === "compiler";
3490
+ return runtimeName === "wasm-engine-edge" && component === "engine" || runtimeName === "wasm-compiler-edge" && component === "compiler";
3490
3491
  }
3491
3492
  function buildGetWasmModule({
3492
3493
  component,
@@ -3582,6 +3583,9 @@ import indent3 from "indent-string";
3582
3583
 
3583
3584
  // src/utils/runtimeImport.ts
3584
3585
  import * as ts4 from "@prisma/ts-builders";
3586
+ function runtimeImport(name) {
3587
+ return name;
3588
+ }
3585
3589
  function runtimeImportedType(name) {
3586
3590
  return ts4.namedType(`runtime.${name}`);
3587
3591
  }
@@ -3725,6 +3729,24 @@ function queryRawTypedDefinition(context) {
3725
3729
  ).setReturnType(prismaPromise(ts5.array(param.toArgument())));
3726
3730
  return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
3727
3731
  }
3732
+ function metricDefinition(context) {
3733
+ if (!context.isPreviewFeatureOn("metrics")) {
3734
+ return "";
3735
+ }
3736
+ const property13 = ts5.property("$metrics", ts5.namedType(`runtime.${runtimeImport("MetricsClient")}`)).setDocComment(
3737
+ ts5.docComment`
3738
+ Gives access to the client metrics in json or prometheus format.
3739
+
3740
+ @example
3741
+ \`\`\`
3742
+ const metrics = await prisma.$metrics.json()
3743
+ // or
3744
+ const metrics = await prisma.$metrics.prometheus()
3745
+ \`\`\`
3746
+ `
3747
+ ).readonly();
3748
+ return ts5.stringify(property13, { indentLevel: 1, newLine: "leading" });
3749
+ }
3728
3750
  function runCommandRawDefinition(context) {
3729
3751
  if (!context.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
3730
3752
  return "";
@@ -3744,6 +3766,13 @@ function runCommandRawDefinition(context) {
3744
3766
  `);
3745
3767
  return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
3746
3768
  }
3769
+ function eventRegistrationMethodDeclaration(runtimeName) {
3770
+ if (runtimeName === "binary") {
3771
+ return `$on<V extends (LogOpts | 'beforeExit')>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : V extends 'beforeExit' ? () => runtime.Types.Utils.JsPromise<void> : Prisma.LogEvent) => void): PrismaClient;`;
3772
+ } else {
3773
+ return `$on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;`;
3774
+ }
3775
+ }
3747
3776
  function getPrismaClientClassDocComment({ dmmf }) {
3748
3777
  let example;
3749
3778
  if (dmmf.mappings.modelOperations.length) {
@@ -3799,7 +3828,7 @@ export interface PrismaClient<
3799
3828
  > {
3800
3829
  [K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
3801
3830
 
3802
- $on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;
3831
+ ${eventRegistrationMethodDeclaration(this.runtimeName)}
3803
3832
 
3804
3833
  /**
3805
3834
  * Connect with the database
@@ -3818,6 +3847,8 @@ ${[
3818
3847
  batchingTransactionDefinition(this.context),
3819
3848
  interactiveTransactionDefinition(this.context),
3820
3849
  runCommandRawDefinition(this.context),
3850
+ metricDefinition(this.context),
3851
+ this.applyPendingMigrationsDefinition(),
3821
3852
  extendsPropertyDefinition()
3822
3853
  ].filter((d) => d !== null).join("\n").trim()}
3823
3854
 
@@ -3842,6 +3873,15 @@ get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
3842
3873
  )}
3843
3874
  }`;
3844
3875
  }
3876
+ applyPendingMigrationsDefinition() {
3877
+ if (this.runtimeName !== "react-native") {
3878
+ return null;
3879
+ }
3880
+ const method3 = ts5.method("$applyPendingMigrations").setReturnType(promise(ts5.voidType)).setDocComment(
3881
+ ts5.docComment`Tries to apply pending migrations one by one. If a migration fails to apply, the function will stop and throw an error. You are responsible for informing the user and possibly blocking the app as we cannot guarantee the state of the database.`
3882
+ );
3883
+ return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
3884
+ }
3845
3885
  };
3846
3886
 
3847
3887
  // src/TSClient/file-generators/ClassFile.ts
@@ -3882,12 +3922,14 @@ function clientConfig(context, options) {
3882
3922
  runtimeBase,
3883
3923
  runtimeName,
3884
3924
  datasources,
3925
+ copyEngine = true,
3885
3926
  target,
3886
3927
  activeProvider,
3887
3928
  moduleFormat
3888
3929
  } = options;
3889
3930
  const clientEngineType = getClientEngineType2(generator);
3890
3931
  generator.config.engineType = clientEngineType;
3932
+ const inlineSchemaHash = crypto.createHash("sha256").update(Buffer.from(inlineSchema, "utf8").toString("base64")).digest("hex");
3891
3933
  const datasourceFilePath = datasources[0].sourceFilePath;
3892
3934
  const config = {
3893
3935
  generator,
@@ -3900,6 +3942,8 @@ function clientConfig(context, options) {
3900
3942
  ciName: ciInfo.name ?? void 0,
3901
3943
  inlineDatasources: buildInlineDatasources(datasources),
3902
3944
  inlineSchema,
3945
+ inlineSchemaHash,
3946
+ copyEngine,
3903
3947
  runtimeDataModel: { models: {}, enums: {}, types: {} },
3904
3948
  dirname: ""
3905
3949
  };
@@ -3948,6 +3992,9 @@ function getQueryEngineFilename(engineType, binaryTarget) {
3948
3992
  if (engineType === ClientEngineType.Library) {
3949
3993
  return getNodeAPIName(binaryTarget, "fs");
3950
3994
  }
3995
+ if (engineType === ClientEngineType.Binary) {
3996
+ return `query-engine-${binaryTarget}`;
3997
+ }
3951
3998
  return void 0;
3952
3999
  }
3953
4000
  function buildNFTAnnotation(fileName, relativeOutdir) {
@@ -3994,7 +4041,7 @@ function createClientFile(context, options) {
3994
4041
  )
3995
4042
  )
3996
4043
  ].map((e) => ts7.stringify(e));
3997
- const binaryTargets = clientEngineType === ClientEngineType2.Library ? Object.keys(options.binaryPaths.libqueryEngine ?? {}) : [];
4044
+ const binaryTargets = clientEngineType === ClientEngineType2.Library ? Object.keys(options.binaryPaths.libqueryEngine ?? {}) : Object.keys(options.binaryPaths.queryEngine ?? {});
3998
4045
  const relativeOutdir = path4.relative(process.cwd(), options.outputDir);
3999
4046
  return `${jsDocHeader3}
4000
4047
  ${buildPreamble(options.edge, options.moduleFormat)}
@@ -4003,7 +4050,7 @@ ${imports.join("\n")}
4003
4050
  ${exports.join("\n")}
4004
4051
  export { Prisma }
4005
4052
 
4006
- ${buildNFTAnnotations(options.edge, clientEngineType, binaryTargets, relativeOutdir)}
4053
+ ${buildNFTAnnotations(options.edge || !options.copyEngine, clientEngineType, binaryTargets, relativeOutdir)}
4007
4054
 
4008
4055
  ${modelExports(context).join("\n")}
4009
4056
  `;
@@ -5105,36 +5152,33 @@ function createModelsFile(context, modelsNames) {
5105
5152
  }
5106
5153
 
5107
5154
  // src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
5108
- import { datamodelSchemaEnumToSchemaEnum } from "@prisma/dmmf";
5109
5155
  import * as ts16 from "@prisma/ts-builders";
5110
5156
 
5111
5157
  // src/TSClient/NullTypes.ts
5112
5158
  var nullTypes = `
5113
5159
  export const NullTypes = {
5114
- DbNull: runtime.NullTypes.DbNull as (new (secret: never) => typeof runtime.DbNull),
5115
- JsonNull: runtime.NullTypes.JsonNull as (new (secret: never) => typeof runtime.JsonNull),
5116
- AnyNull: runtime.NullTypes.AnyNull as (new (secret: never) => typeof runtime.AnyNull),
5160
+ DbNull: runtime.objectEnumValues.classes.DbNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.DbNull),
5161
+ JsonNull: runtime.objectEnumValues.classes.JsonNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.JsonNull),
5162
+ AnyNull: runtime.objectEnumValues.classes.AnyNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.AnyNull),
5117
5163
  }
5118
5164
  /**
5119
5165
  * Helper for filtering JSON entries that have \`null\` on the database (empty on the db)
5120
5166
  *
5121
5167
  * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
5122
5168
  */
5123
- export const DbNull = runtime.DbNull
5124
-
5169
+ export const DbNull = runtime.objectEnumValues.instances.DbNull
5125
5170
  /**
5126
5171
  * Helper for filtering JSON entries that have JSON \`null\` values (not empty on the db)
5127
5172
  *
5128
5173
  * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
5129
5174
  */
5130
- export const JsonNull = runtime.JsonNull
5131
-
5175
+ export const JsonNull = runtime.objectEnumValues.instances.JsonNull
5132
5176
  /**
5133
5177
  * Helper for filtering JSON entries that are \`Prisma.DbNull\` or \`Prisma.JsonNull\`
5134
5178
  *
5135
5179
  * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
5136
5180
  */
5137
- export const AnyNull = runtime.AnyNull
5181
+ export const AnyNull = runtime.objectEnumValues.instances.AnyNull
5138
5182
  `;
5139
5183
 
5140
5184
  // src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
@@ -5151,9 +5195,7 @@ var jsDocHeader7 = `/*
5151
5195
  */
5152
5196
  `;
5153
5197
  function createPrismaNamespaceBrowserFile(context) {
5154
- const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
5155
- (datamodelEnum) => new Enum(datamodelSchemaEnumToSchemaEnum(datamodelEnum), false).toTS()
5156
- );
5198
+ const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
5157
5199
  return `${jsDocHeader7}
5158
5200
  ${ts16.stringify(ts16.moduleImport(`${context.runtimeBase}/index-browser`).asNamespace("runtime"))}
5159
5201
 
@@ -5167,10 +5209,7 @@ ${nullTypes}
5167
5209
  ${new Enum(
5168
5210
  {
5169
5211
  name: "ModelName",
5170
- data: context.dmmf.mappings.modelOperations.map((m) => ({
5171
- key: m.model,
5172
- value: m.model
5173
- }))
5212
+ values: context.dmmf.mappings.modelOperations.map((m) => m.model)
5174
5213
  },
5175
5214
  true
5176
5215
  ).toTS()}
@@ -5183,7 +5222,6 @@ ${prismaEnums?.join("\n\n")}
5183
5222
  }
5184
5223
 
5185
5224
  // src/TSClient/file-generators/PrismaNamespaceFile.ts
5186
- import { datamodelSchemaEnumToSchemaEnum as datamodelSchemaEnumToSchemaEnum2 } from "@prisma/dmmf";
5187
5225
  import * as ts19 from "@prisma/ts-builders";
5188
5226
 
5189
5227
  // src/TSClient/common.ts
@@ -5231,6 +5269,14 @@ export type Decimal = runtime.Decimal
5231
5269
 
5232
5270
  export type DecimalJsLike = runtime.DecimalJsLike
5233
5271
 
5272
+ /**
5273
+ * Metrics
5274
+ */
5275
+ export type Metrics = runtime.Metrics
5276
+ export type Metric<T> = runtime.Metric<T>
5277
+ export type MetricHistogram = runtime.MetricHistogram
5278
+ export type MetricHistogramBucket = runtime.MetricHistogramBucket
5279
+
5234
5280
  /**
5235
5281
  * Extensions
5236
5282
  */
@@ -5715,9 +5761,7 @@ function createPrismaNamespaceFile(context, options) {
5715
5761
  ts19.moduleImport(context.importFileName(`../models`)).asNamespace("Prisma").typeOnly(),
5716
5762
  ts19.moduleImport(context.importFileName(`./class`)).named(ts19.namedImport("PrismaClient").typeOnly())
5717
5763
  ].map((i) => ts19.stringify(i));
5718
- const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
5719
- (type) => new Enum(datamodelSchemaEnumToSchemaEnum2(type), true).toTS()
5720
- );
5764
+ const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
5721
5765
  const fieldRefs = context.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
5722
5766
  return `${jsDocHeader8}
5723
5767
  ${imports.join("\n")}
@@ -5728,10 +5772,7 @@ ${commonCodeTS(options)}
5728
5772
  ${new Enum(
5729
5773
  {
5730
5774
  name: "ModelName",
5731
- data: context.dmmf.mappings.modelOperations.map((m) => ({
5732
- key: m.model,
5733
- value: m.model
5734
- }))
5775
+ values: context.dmmf.mappings.modelOperations.map((m) => m.model)
5735
5776
  },
5736
5777
  true
5737
5778
  ).toTS()}
@@ -5841,6 +5882,8 @@ function clientExtensionsDefinitions() {
5841
5882
  function buildClientOptions(context, options) {
5842
5883
  const clientOptions = ts19.interfaceDeclaration("PrismaClientOptions").add(
5843
5884
  ts19.property("datasources", ts19.namedType("Datasources")).optional().setDocComment(ts19.docComment("Overwrites the datasource url from your schema.prisma file"))
5885
+ ).add(
5886
+ ts19.property("datasourceUrl", ts19.stringType).optional().setDocComment(ts19.docComment("Overwrites the datasource url from your schema.prisma file"))
5844
5887
  ).add(
5845
5888
  ts19.property("errorFormat", ts19.namedType("ErrorFormat")).optional().setDocComment(ts19.docComment('@default "colorless"'))
5846
5889
  ).add(
@@ -5880,20 +5923,13 @@ function buildClientOptions(context, options) {
5880
5923
  timeout ?= 5000
5881
5924
  `)
5882
5925
  );
5883
- if (["library", "client", "wasm-compiler-edge"].includes(options.runtimeName)) {
5926
+ if (["library", "client", "wasm-compiler-edge", "wasm-engine-edge"].includes(options.runtimeName)) {
5884
5927
  clientOptions.add(
5885
- ts19.property("adapter", ts19.namedType("runtime.SqlDriverAdapterFactory")).optional().setDocComment(
5928
+ ts19.property("adapter", ts19.unionType([ts19.namedType("runtime.SqlDriverAdapterFactory"), ts19.namedType("null")])).optional().setDocComment(
5886
5929
  ts19.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
5887
5930
  )
5888
5931
  );
5889
5932
  }
5890
- clientOptions.add(
5891
- ts19.property("accelerateUrl", ts19.stringType).optional().setDocComment(
5892
- ts19.docComment(
5893
- "Prisma Accelerate URL allowing the client to connect through Accelerate instead of a direct database."
5894
- )
5895
- )
5896
- );
5897
5933
  clientOptions.add(
5898
5934
  ts19.property("omit", ts19.namedType("GlobalOmitConfig")).optional().setDocComment(ts19.docComment`
5899
5935
  Global configuration for omitting model fields by default.
@@ -5926,7 +5962,7 @@ var GenerateContext = class {
5926
5962
  dmmf,
5927
5963
  genericArgsInfo,
5928
5964
  runtimeBase,
5929
- runtimeImport,
5965
+ runtimeImport: runtimeImport2,
5930
5966
  outputFileName,
5931
5967
  importFileName,
5932
5968
  generator
@@ -5934,7 +5970,7 @@ var GenerateContext = class {
5934
5970
  this.dmmf = dmmf;
5935
5971
  this.genericArgsInfo = genericArgsInfo;
5936
5972
  this.runtimeBase = runtimeBase;
5937
- this.runtimeImport = runtimeImport;
5973
+ this.runtimeImport = runtimeImport2;
5938
5974
  this.outputFileName = outputFileName;
5939
5975
  this.importFileName = importFileName;
5940
5976
  this.generator = generator;
@@ -6255,6 +6291,7 @@ function buildClient({
6255
6291
  clientVersion,
6256
6292
  activeProvider,
6257
6293
  postinstall,
6294
+ copyEngine,
6258
6295
  envPaths,
6259
6296
  typedSql,
6260
6297
  target,
@@ -6280,8 +6317,9 @@ function buildClient({
6280
6317
  engineVersion,
6281
6318
  activeProvider,
6282
6319
  postinstall,
6320
+ copyEngine,
6283
6321
  datamodel,
6284
- edge: ["wasm-compiler-edge"].includes(runtimeName),
6322
+ edge: ["edge", "wasm-engine-edge", "wasm-compiler-edge", "react-native"].includes(runtimeName),
6285
6323
  runtimeName,
6286
6324
  target,
6287
6325
  generatedFileExtension,
@@ -6289,6 +6327,9 @@ function buildClient({
6289
6327
  moduleFormat,
6290
6328
  tsNoCheckPreamble: tsNoCheckPreamble2
6291
6329
  };
6330
+ if (runtimeName === "react-native" && !generator.previewFeatures.includes("reactNative")) {
6331
+ throw new Error(`Using the "react-native" runtime requires the "reactNative" preview feature to be enabled.`);
6332
+ }
6292
6333
  const client = new TSClient(clientOptions);
6293
6334
  let fileMap = client.generateClientFiles();
6294
6335
  if (typedSql && typedSql.length > 0) {
@@ -6344,6 +6385,7 @@ async function generateClient(options) {
6344
6385
  activeProvider,
6345
6386
  postinstall,
6346
6387
  envPaths,
6388
+ copyEngine = true,
6347
6389
  typedSql,
6348
6390
  target,
6349
6391
  generatedFileExtension,
@@ -6366,6 +6408,7 @@ async function generateClient(options) {
6366
6408
  engineVersion,
6367
6409
  activeProvider,
6368
6410
  postinstall,
6411
+ copyEngine,
6369
6412
  envPaths,
6370
6413
  typedSql,
6371
6414
  target,
@@ -6390,8 +6433,8 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
6390
6433
  await deleteOutputDir(outputDir);
6391
6434
  await (0, import_fs_extra.ensureDir)(outputDir);
6392
6435
  await writeFileMap(outputDir, fileMap);
6393
- const enginePath = clientEngineType === ClientEngineType3.Library ? binaryPaths.libqueryEngine : void 0;
6394
- if (enginePath) {
6436
+ const enginePath = clientEngineType === ClientEngineType3.Library ? binaryPaths.libqueryEngine : binaryPaths.queryEngine;
6437
+ if (copyEngine && enginePath) {
6395
6438
  if (process.env.NETLIFY) {
6396
6439
  await (0, import_fs_extra.ensureDir)("/tmp/prisma-engines");
6397
6440
  }
@@ -6516,12 +6559,17 @@ function getRuntimeNameForTarget(target, engineType) {
6516
6559
  return getNodeRuntimeName(engineType);
6517
6560
  case "workerd":
6518
6561
  case "vercel-edge":
6519
- return "wasm-compiler-edge";
6562
+ return engineType === ClientEngineType3.Client ? "wasm-compiler-edge" : "wasm-engine-edge";
6563
+ case "react-native":
6564
+ return "react-native";
6520
6565
  default:
6521
6566
  assertNever3(target, "Unknown runtime target");
6522
6567
  }
6523
6568
  }
6524
6569
  function getNodeRuntimeName(engineType) {
6570
+ if (engineType === ClientEngineType3.Binary) {
6571
+ return "binary";
6572
+ }
6525
6573
  if (engineType === ClientEngineType3.Library) {
6526
6574
  return "library";
6527
6575
  }
@@ -6571,7 +6619,7 @@ import { getTsconfig } from "get-tsconfig";
6571
6619
  import { match as match2 } from "ts-pattern";
6572
6620
 
6573
6621
  // package.json
6574
- var version = "6.19.0-integration-next.15";
6622
+ var version = "6.19.0-integration-engines-6-19-0-31-next-6f525e2b254a97a9c547ae5f2b29c54a171f6b23.1";
6575
6623
 
6576
6624
  // src/module-format.ts
6577
6625
  function parseModuleFormat(format) {
@@ -6614,7 +6662,16 @@ function fromTsConfigModule(module) {
6614
6662
  }
6615
6663
 
6616
6664
  // src/runtime-targets.ts
6617
- var supportedPublicRuntimes = ["nodejs", "deno", "bun", "workerd", "cloudflare", "vercel-edge", "edge-light"];
6665
+ var supportedPublicRuntimes = [
6666
+ "nodejs",
6667
+ "deno",
6668
+ "bun",
6669
+ "workerd",
6670
+ "cloudflare",
6671
+ "vercel-edge",
6672
+ "edge-light",
6673
+ "react-native"
6674
+ ];
6618
6675
  function parseRuntimeTarget(target) {
6619
6676
  switch (target.toLowerCase()) {
6620
6677
  case "workerd":
@@ -6628,6 +6685,8 @@ function parseRuntimeTarget(target) {
6628
6685
  return "nodejs";
6629
6686
  case "deno":
6630
6687
  return "deno";
6688
+ case "react-native":
6689
+ return "react-native";
6631
6690
  default:
6632
6691
  throw new Error(
6633
6692
  `Unknown target runtime: "${target}". The available options are: ${supportedPublicRuntimes.map((runtime) => `"${runtime}"`).join(", ")}`
@@ -6661,7 +6720,7 @@ function getOutputPath(config) {
6661
6720
  var PrismaClientTsGenerator = class {
6662
6721
  name = "prisma-client-ts";
6663
6722
  getManifest(config) {
6664
- const requiresEngines = match2(getClientEngineType5(config)).with(ClientEngineType4.Library, () => ["libqueryEngine"]).with(ClientEngineType4.Client, () => []).exhaustive();
6723
+ const requiresEngines = match2(getClientEngineType5(config)).with(ClientEngineType4.Library, () => ["libqueryEngine"]).with(ClientEngineType4.Binary, () => ["queryEngine"]).with(ClientEngineType4.Client, () => []).exhaustive();
6665
6724
  debug2("requiresEngines", requiresEngines);
6666
6725
  return Promise.resolve({
6667
6726
  defaultOutput: getOutputPath(config),
@@ -6701,6 +6760,7 @@ var PrismaClientTsGenerator = class {
6701
6760
  clientVersion: version,
6702
6761
  activeProvider: options.datasources[0]?.activeProvider,
6703
6762
  postinstall: options.postinstall,
6763
+ copyEngine: !options.noEngine,
6704
6764
  typedSql: options.typedSql,
6705
6765
  target,
6706
6766
  generatedFileExtension,
@@ -1,5 +1,5 @@
1
- export declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno"];
2
- declare const supportedPublicRuntimes: readonly ["nodejs", "deno", "bun", "workerd", "cloudflare", "vercel-edge", "edge-light"];
1
+ export declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno", "react-native"];
2
+ declare const supportedPublicRuntimes: readonly ["nodejs", "deno", "bun", "workerd", "cloudflare", "vercel-edge", "edge-light", "react-native"];
3
3
  /**
4
4
  * The user-facing `runtime` attribute for the `prisma-client` generator.
5
5
  */
@@ -8,5 +8,5 @@ export type RuntimeTarget = (typeof supportedPublicRuntimes)[number];
8
8
  * The internal representation of the `runtime` attribute for the `prisma-client` generator.
9
9
  */
10
10
  export type RuntimeTargetInternal = (typeof supportedInternalRuntimes)[number];
11
- export declare function parseRuntimeTargetFromUnknown(target: unknown): "nodejs" | "workerd" | "vercel-edge" | "deno";
11
+ export declare function parseRuntimeTargetFromUnknown(target: unknown): "nodejs" | "workerd" | "vercel-edge" | "deno" | "react-native";
12
12
  export {};
@@ -1,4 +1,11 @@
1
1
  import * as ts from '@prisma/ts-builders';
2
2
  type RuntimeExport = keyof typeof import('@prisma/client/runtime/library') & string;
3
+ /**
4
+ * Helps to ensure that when we want to refer to a type or value, imported from runtime Module
5
+ * we are referring to the name, that is actually exported
6
+ *
7
+ * @param name imported name
8
+ */
9
+ export declare function runtimeImport(name: RuntimeExport): string;
3
10
  export declare function runtimeImportedType(name: RuntimeExport): ts.NamedType;
4
11
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-generator-ts",
3
- "version": "6.19.0-integration-next.15",
3
+ "version": "6.19.0-integration-engines-6-19-0-31-next-6f525e2b254a97a9c547ae5f2b29c54a171f6b23.1",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -25,7 +25,7 @@
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
27
  "@antfu/ni": "0.21.12",
28
- "@prisma/engines-version": "6.19.0-29.next-ac95b5893b3c05bf39a2431fc1a748dd46152ab4",
28
+ "@prisma/engines-version": "6.19.0-31.next-6f525e2b254a97a9c547ae5f2b29c54a171f6b23",
29
29
  "ci-info": "4.2.0",
30
30
  "fast-glob": "3.3.3",
31
31
  "get-tsconfig": "4.10.0",
@@ -34,14 +34,14 @@
34
34
  "package-up": "5.0.0",
35
35
  "pluralize": "8.0.0",
36
36
  "ts-pattern": "5.6.2",
37
- "@prisma/client-common": "6.19.0-integration-next.15",
38
- "@prisma/dmmf": "6.19.0-integration-next.15",
39
- "@prisma/generator": "6.19.0-integration-next.15",
40
- "@prisma/fetch-engine": "6.19.0-integration-next.15",
41
- "@prisma/get-platform": "6.19.0-integration-next.15",
42
- "@prisma/debug": "6.19.0-integration-next.15",
43
- "@prisma/ts-builders": "6.19.0-integration-next.15",
44
- "@prisma/internals": "6.19.0-integration-next.15"
37
+ "@prisma/client-common": "6.19.0-integration-engines-6-19-0-31-next-6f525e2b254a97a9c547ae5f2b29c54a171f6b23.1",
38
+ "@prisma/debug": "6.19.0-integration-engines-6-19-0-31-next-6f525e2b254a97a9c547ae5f2b29c54a171f6b23.1",
39
+ "@prisma/dmmf": "6.19.0-integration-engines-6-19-0-31-next-6f525e2b254a97a9c547ae5f2b29c54a171f6b23.1",
40
+ "@prisma/fetch-engine": "6.19.0-integration-engines-6-19-0-31-next-6f525e2b254a97a9c547ae5f2b29c54a171f6b23.1",
41
+ "@prisma/get-platform": "6.19.0-integration-engines-6-19-0-31-next-6f525e2b254a97a9c547ae5f2b29c54a171f6b23.1",
42
+ "@prisma/generator": "6.19.0-integration-engines-6-19-0-31-next-6f525e2b254a97a9c547ae5f2b29c54a171f6b23.1",
43
+ "@prisma/ts-builders": "6.19.0-integration-engines-6-19-0-31-next-6f525e2b254a97a9c547ae5f2b29c54a171f6b23.1",
44
+ "@prisma/internals": "6.19.0-integration-engines-6-19-0-31-next-6f525e2b254a97a9c547ae5f2b29c54a171f6b23.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/pluralize": "0.0.33",