@prisma/client-generator-js 7.3.0-dev.1 → 7.3.0-dev.10

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.
@@ -22,6 +22,7 @@ export interface GenerateClientOptions {
22
22
  clientVersion: string;
23
23
  activeProvider: ActiveConnectorType;
24
24
  typedSql?: SqlQueryOutput[];
25
+ compilerBuild: 'fast' | 'small';
25
26
  }
26
27
  export interface FileMap {
27
28
  [name: string]: string | FileMap;
@@ -30,5 +31,5 @@ export interface BuildClientResult {
30
31
  fileMap: FileMap;
31
32
  prismaClientDmmf: DMMF.Document;
32
33
  }
33
- export declare function buildClient({ schemaPath, runtimeBase, runtimeSourcePath, datamodel, binaryPaths, outputDir, generator, dmmf, datasources, engineVersion, clientVersion, activeProvider, typedSql, }: O.Required<GenerateClientOptions, 'runtimeBase'>): Promise<BuildClientResult>;
34
+ export declare function buildClient({ schemaPath, runtimeBase, runtimeSourcePath, datamodel, binaryPaths, outputDir, generator, dmmf, datasources, engineVersion, clientVersion, activeProvider, typedSql, compilerBuild, }: O.Required<GenerateClientOptions, 'runtimeBase'>): Promise<BuildClientResult>;
34
35
  export declare function generateClient(options: GenerateClientOptions): Promise<void>;
package/dist/index.d.mts CHANGED
@@ -41,6 +41,7 @@ export declare interface GenerateClientOptions {
41
41
  clientVersion: string;
42
42
  activeProvider: ActiveConnectorType;
43
43
  typedSql?: SqlQueryOutput[];
44
+ compilerBuild: 'fast' | 'small';
44
45
  }
45
46
 
46
47
  export declare function getDMMF(options: GetDMMFOptions): Promise<DMMF.Document>;
package/dist/index.d.ts CHANGED
@@ -41,6 +41,7 @@ export declare interface GenerateClientOptions {
41
41
  clientVersion: string;
42
42
  activeProvider: ActiveConnectorType;
43
43
  typedSql?: SqlQueryOutput[];
44
+ compilerBuild: 'fast' | 'small';
44
45
  }
45
46
 
46
47
  export declare function getDMMF(options: GetDMMFOptions): Promise<DMMF.Document>;
package/dist/index.js CHANGED
@@ -2483,7 +2483,7 @@ var package_default = {
2483
2483
  "@prisma/dmmf": "workspace:*",
2484
2484
  "@prisma/driver-adapter-utils": "workspace:*",
2485
2485
  "@prisma/engines": "workspace:*",
2486
- "@prisma/engines-version": "7.2.0-4.0c8ef2ce45c83248ab3df073180d5eda9e8be7a3",
2486
+ "@prisma/engines-version": "7.3.0-8.aee8f579c2872ad0cedd6fd7e9070704fdb3610e",
2487
2487
  "@prisma/fetch-engine": "workspace:*",
2488
2488
  "@prisma/generator": "workspace:*",
2489
2489
  "@prisma/generator-helper": "workspace:*",
@@ -2493,7 +2493,7 @@ var package_default = {
2493
2493
  "@prisma/internals": "workspace:*",
2494
2494
  "@prisma/json-protocol": "workspace:*",
2495
2495
  "@prisma/migrate": "workspace:*",
2496
- "@prisma/query-compiler-wasm": "7.2.0-4.0c8ef2ce45c83248ab3df073180d5eda9e8be7a3",
2496
+ "@prisma/query-compiler-wasm": "7.3.0-8.aee8f579c2872ad0cedd6fd7e9070704fdb3610e",
2497
2497
  "@prisma/query-plan-executor": "workspace:*",
2498
2498
  "@prisma/sqlcommenter": "workspace:*",
2499
2499
  "@prisma/sqlcommenter-trace-context": "workspace:*",
@@ -2597,7 +2597,7 @@ var Enum = class {
2597
2597
  toJS() {
2598
2598
  const { type } = this;
2599
2599
  const enumVariants = `{
2600
- ${(0, import_indent_string.default)(type.data.map((v) => `${v.key}: ${this.getValueJS(v.value)}`).join(",\n"), TAB_SIZE)}
2600
+ ${(0, import_indent_string.default)(type.values.map((v) => `${v}: ${this.getValueJS(v)}`).join(",\n"), TAB_SIZE)}
2601
2601
  }`;
2602
2602
  const enumBody = this.isStrictEnum() ? `makeStrictEnum(${enumVariants})` : enumVariants;
2603
2603
  return this.useNamespace ? `exports.Prisma.${type.name} = ${enumBody};` : `exports.${type.name} = exports.$Enums.${type.name} = ${enumBody};`;
@@ -2608,7 +2608,7 @@ ${(0, import_indent_string.default)(type.data.map((v) => `${v.key}: ${this.getVa
2608
2608
  toTS() {
2609
2609
  const { type } = this;
2610
2610
  return `export const ${type.name}: {
2611
- ${(0, import_indent_string.default)(type.data.map((v) => `${v.key}: ${this.getValueTS(v.value)}`).join(",\n"), TAB_SIZE)}
2611
+ ${(0, import_indent_string.default)(type.values.map((v) => `${v}: ${this.getValueTS(v)}`).join(",\n"), TAB_SIZE)}
2612
2612
  };
2613
2613
 
2614
2614
  export type ${type.name} = (typeof ${type.name})[keyof typeof ${type.name}]
@@ -4560,27 +4560,30 @@ defineDmmfProperty(exports.Prisma, config.runtimeDataModel)`;
4560
4560
  }
4561
4561
 
4562
4562
  // src/utils/buildGetQueryCompilerWasmModule.ts
4563
- function buildQueryCompilerWasmModule(forceEdgeWasmLoader, runtimeName) {
4563
+ function buildQueryCompilerWasmModule(forceEdgeWasmLoader, runtimeName, compilerBuild) {
4564
+ const artifactName = `query_compiler_${compilerBuild}_bg`;
4564
4565
  if (runtimeName === "client" && !forceEdgeWasmLoader) {
4565
4566
  return `config.compilerWasm = {
4566
- getRuntime: async () => require('./query_compiler_bg.js'),
4567
+ getRuntime: async () => require('./${artifactName}.js'),
4567
4568
  getQueryCompilerWasmModule: async () => {
4568
4569
  const { Buffer } = require('node:buffer')
4569
- const { wasm } = require('./query_compiler_bg.wasm-base64.js')
4570
+ const { wasm } = require('./${artifactName}.wasm-base64.js')
4570
4571
  const queryCompilerWasmFileBytes = Buffer.from(wasm, 'base64')
4571
4572
 
4572
4573
  return new WebAssembly.Module(queryCompilerWasmFileBytes)
4573
- }
4574
+ },
4575
+ importName: './${artifactName}.js',
4574
4576
  }`;
4575
4577
  }
4576
4578
  if (runtimeName === "client" && forceEdgeWasmLoader || runtimeName === "wasm-compiler-edge") {
4577
4579
  return `config.compilerWasm = {
4578
- getRuntime: async () => require('./query_compiler_bg.js'),
4580
+ getRuntime: async () => require('./${artifactName}.js'),
4579
4581
  getQueryCompilerWasmModule: async () => {
4580
4582
  const loader = (await import('#wasm-compiler-loader')).default
4581
4583
  const compiler = (await loader).default
4582
4584
  return compiler
4583
- }
4585
+ },
4586
+ importName: './${artifactName}.js',
4584
4587
  }`;
4585
4588
  }
4586
4589
  return `config.compilerWasm = undefined`;
@@ -5801,7 +5804,7 @@ var TSClient = class {
5801
5804
  dmmf;
5802
5805
  genericsInfo;
5803
5806
  toJS() {
5804
- const { edge, wasm, generator, datamodel: inlineSchema, runtimeName, reusedJs } = this.options;
5807
+ const { edge, wasm, generator, datamodel: inlineSchema, runtimeName, reusedJs, compilerBuild } = this.options;
5805
5808
  if (reusedJs) {
5806
5809
  return `module.exports = { ...require('${reusedJs}') }`;
5807
5810
  }
@@ -5818,16 +5821,13 @@ ${buildRequirePath(edge)}
5818
5821
  /**
5819
5822
  * Enums
5820
5823
  */
5821
- ${this.dmmf.schema.enumTypes.prisma?.map((type) => new Enum((0, import_dmmf.datamodelSchemaEnumToSchemaEnum)(type), true).toJS()).join("\n\n")}
5824
+ ${this.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toJS()).join("\n\n")}
5822
5825
  ${this.dmmf.datamodel.enums.map((datamodelEnum) => new Enum((0, import_dmmf.datamodelEnumToSchemaEnum)(datamodelEnum), false).toJS()).join("\n\n")}
5823
5826
 
5824
5827
  ${new Enum(
5825
5828
  {
5826
5829
  name: "ModelName",
5827
- data: this.dmmf.mappings.modelOperations.map((m) => ({
5828
- key: m.model,
5829
- value: m.model
5830
- }))
5830
+ values: this.dmmf.mappings.modelOperations.map((m) => m.model)
5831
5831
  },
5832
5832
  true
5833
5833
  ).toJS()}
@@ -5836,7 +5836,7 @@ ${new Enum(
5836
5836
  */
5837
5837
  const config = ${JSON.stringify(config, null, 2)}
5838
5838
  ${buildRuntimeDataModel(this.dmmf.datamodel, runtimeName)}
5839
- ${buildQueryCompilerWasmModule(wasm, runtimeName)}
5839
+ ${buildQueryCompilerWasmModule(wasm, runtimeName, compilerBuild)}
5840
5840
  ${buildDebugInitialization(edge)}
5841
5841
  const PrismaClient = getPrismaClient(config)
5842
5842
  exports.PrismaClient = PrismaClient
@@ -5870,9 +5870,7 @@ Object.assign(exports, Prisma)
5870
5870
  }
5871
5871
  return acc;
5872
5872
  }, []);
5873
- const prismaEnums = this.dmmf.schema.enumTypes.prisma?.map(
5874
- (type) => new Enum((0, import_dmmf.datamodelSchemaEnumToSchemaEnum)(type), true).toTS()
5875
- );
5873
+ const prismaEnums = this.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
5876
5874
  const modelEnums = [];
5877
5875
  const modelEnumsAliases = [];
5878
5876
  for (const datamodelEnum of this.dmmf.datamodel.enums) {
@@ -5914,10 +5912,7 @@ ${(0, import_indent_string7.default)(
5914
5912
  ${new Enum(
5915
5913
  {
5916
5914
  name: "ModelName",
5917
- data: this.dmmf.mappings.modelOperations.map((m) => ({
5918
- key: m.model,
5919
- value: m.model
5920
- }))
5915
+ values: this.dmmf.mappings.modelOperations.map((m) => m.model)
5921
5916
  },
5922
5917
  true
5923
5918
  ).toTS()}
@@ -6001,16 +5996,13 @@ export const dmmf: runtime.BaseDMMF
6001
5996
  * Enums
6002
5997
  */
6003
5998
 
6004
- ${this.dmmf.schema.enumTypes.prisma?.map((type) => new Enum((0, import_dmmf.datamodelSchemaEnumToSchemaEnum)(type), true).toJS()).join("\n\n")}
6005
- ${this.dmmf.schema.enumTypes.model?.map((type) => new Enum((0, import_dmmf.datamodelSchemaEnumToSchemaEnum)(type), false).toJS()).join("\n\n") ?? ""}
5999
+ ${this.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toJS()).join("\n\n")}
6000
+ ${this.dmmf.schema.enumTypes.model?.map((type) => new Enum(type, false).toJS()).join("\n\n") ?? ""}
6006
6001
 
6007
6002
  ${new Enum(
6008
6003
  {
6009
6004
  name: "ModelName",
6010
- data: this.dmmf.mappings.modelOperations.map((m) => ({
6011
- key: m.model,
6012
- value: m.model
6013
- }))
6005
+ values: this.dmmf.mappings.modelOperations.map((m) => m.model)
6014
6006
  },
6015
6007
  true
6016
6008
  ).toJS()}
@@ -6368,7 +6360,8 @@ async function buildClient({
6368
6360
  engineVersion,
6369
6361
  clientVersion,
6370
6362
  activeProvider,
6371
- typedSql
6363
+ typedSql,
6364
+ compilerBuild
6372
6365
  }) {
6373
6366
  const baseClientOptions = {
6374
6367
  dmmf: getPrismaClientDMMF(dmmf),
@@ -6383,6 +6376,7 @@ async function buildClient({
6383
6376
  engineVersion,
6384
6377
  activeProvider,
6385
6378
  datamodel,
6379
+ compilerBuild,
6386
6380
  browser: false,
6387
6381
  edge: false,
6388
6382
  wasm: false
@@ -6445,8 +6439,9 @@ async function buildClient({
6445
6439
  fileMap["client.d.ts"] = TS(defaultClient);
6446
6440
  fileMap["default.js"] = JS(trampolineTsClient);
6447
6441
  fileMap["default.d.ts"] = TS(trampolineTsClient);
6448
- fileMap["wasm-worker-loader.mjs"] = `export default import('./query_compiler_bg.wasm')`;
6449
- fileMap["wasm-edge-light-loader.mjs"] = `export default import('./query_compiler_bg.wasm?module')`;
6442
+ const qcArtifactName = `query_compiler_${compilerBuild}_bg`;
6443
+ fileMap["wasm-worker-loader.mjs"] = `export default import('./${qcArtifactName}.wasm')`;
6444
+ fileMap["wasm-edge-light-loader.mjs"] = `export default import('./${qcArtifactName}.wasm?module')`;
6450
6445
  pkgJson["browser"] = "default.js";
6451
6446
  pkgJson["imports"] = {
6452
6447
  // when `import('#wasm-compiler-loader')` is called, it will be resolved to the correct file
@@ -6552,7 +6547,8 @@ async function generateClient(options) {
6552
6547
  clientVersion,
6553
6548
  engineVersion,
6554
6549
  activeProvider,
6555
- typedSql
6550
+ typedSql,
6551
+ compilerBuild
6556
6552
  } = options;
6557
6553
  const { runtimeBase, outputDir } = await getGenerationDirs(options);
6558
6554
  const { prismaClientDmmf, fileMap } = await buildClient({
@@ -6569,7 +6565,8 @@ async function generateClient(options) {
6569
6565
  engineVersion,
6570
6566
  activeProvider,
6571
6567
  testMode,
6572
- typedSql
6568
+ typedSql,
6569
+ compilerBuild
6573
6570
  });
6574
6571
  const provider = datasources[0].provider;
6575
6572
  const denylistsErrors = validateDmmfAgainstDenylists(prismaClientDmmf);
@@ -6601,7 +6598,7 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
6601
6598
  await import_promises.default.writeFile(schemaTargetPath, datamodel, { encoding: "utf-8" });
6602
6599
  if (isWasmEngineSupported(provider)) {
6603
6600
  const suffix = provider === "postgres" ? "postgresql" : provider;
6604
- const filename = "query_compiler_bg";
6601
+ const filename = `query_compiler_${compilerBuild}_bg`;
6605
6602
  const wasmJsBundlePath = import_path.default.join(runtimeSourcePath, `${filename}.${suffix}.wasm-base64.js`);
6606
6603
  const wasmBase64 = require(wasmJsBundlePath).wasm;
6607
6604
  await import_promises.default.writeFile(import_path.default.join(outputDir, `${filename}.wasm`), Buffer.from(wasmBase64, "base64"));
@@ -6816,7 +6813,7 @@ var import_engines_version = require("@prisma/engines-version");
6816
6813
  var import_internals9 = require("@prisma/internals");
6817
6814
 
6818
6815
  // package.json
6819
- var version = "7.3.0-dev.1";
6816
+ var version = "7.3.0-dev.10";
6820
6817
 
6821
6818
  // src/resolvePrismaClient.ts
6822
6819
  var import_promises2 = __toESM(require("node:fs/promises"));
@@ -6892,7 +6889,8 @@ var PrismaClientJsGenerator = class {
6892
6889
  engineVersion: options.version,
6893
6890
  clientVersion: version,
6894
6891
  activeProvider: options.datasources[0]?.activeProvider,
6895
- typedSql: options.typedSql
6892
+ typedSql: options.typedSql,
6893
+ compilerBuild: parseCompilerBuildFromUnknown(options.generator.config.compilerBuild)
6896
6894
  });
6897
6895
  }
6898
6896
  async #getPrismaClientPath(config) {
@@ -6910,6 +6908,15 @@ var PrismaClientJsGenerator = class {
6910
6908
  return this.#runtimePath;
6911
6909
  }
6912
6910
  };
6911
+ function parseCompilerBuildFromUnknown(value) {
6912
+ if (value === void 0) {
6913
+ return "fast";
6914
+ }
6915
+ if (value === "small" || value === "fast") {
6916
+ return value;
6917
+ }
6918
+ throw new Error(`Invalid compiler build: ${JSON.stringify(value)}, expected one of: "fast", "small"`);
6919
+ }
6913
6920
 
6914
6921
  // src/utils/types/dmmfToTypes.ts
6915
6922
  var import_node_path3 = __toESM(require("node:path"));
@@ -6939,7 +6946,8 @@ function dmmfToTypes(dmmf) {
6939
6946
  datamodel: "",
6940
6947
  browser: false,
6941
6948
  edge: false,
6942
- wasm: false
6949
+ wasm: false,
6950
+ compilerBuild: "fast"
6943
6951
  }).toTS();
6944
6952
  }
6945
6953
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -2472,7 +2472,7 @@ var package_default = {
2472
2472
  "@prisma/dmmf": "workspace:*",
2473
2473
  "@prisma/driver-adapter-utils": "workspace:*",
2474
2474
  "@prisma/engines": "workspace:*",
2475
- "@prisma/engines-version": "7.2.0-4.0c8ef2ce45c83248ab3df073180d5eda9e8be7a3",
2475
+ "@prisma/engines-version": "7.3.0-8.aee8f579c2872ad0cedd6fd7e9070704fdb3610e",
2476
2476
  "@prisma/fetch-engine": "workspace:*",
2477
2477
  "@prisma/generator": "workspace:*",
2478
2478
  "@prisma/generator-helper": "workspace:*",
@@ -2482,7 +2482,7 @@ var package_default = {
2482
2482
  "@prisma/internals": "workspace:*",
2483
2483
  "@prisma/json-protocol": "workspace:*",
2484
2484
  "@prisma/migrate": "workspace:*",
2485
- "@prisma/query-compiler-wasm": "7.2.0-4.0c8ef2ce45c83248ab3df073180d5eda9e8be7a3",
2485
+ "@prisma/query-compiler-wasm": "7.3.0-8.aee8f579c2872ad0cedd6fd7e9070704fdb3610e",
2486
2486
  "@prisma/query-plan-executor": "workspace:*",
2487
2487
  "@prisma/sqlcommenter": "workspace:*",
2488
2488
  "@prisma/sqlcommenter-trace-context": "workspace:*",
@@ -2586,7 +2586,7 @@ var Enum = class {
2586
2586
  toJS() {
2587
2587
  const { type } = this;
2588
2588
  const enumVariants = `{
2589
- ${indent(type.data.map((v) => `${v.key}: ${this.getValueJS(v.value)}`).join(",\n"), TAB_SIZE)}
2589
+ ${indent(type.values.map((v) => `${v}: ${this.getValueJS(v)}`).join(",\n"), TAB_SIZE)}
2590
2590
  }`;
2591
2591
  const enumBody = this.isStrictEnum() ? `makeStrictEnum(${enumVariants})` : enumVariants;
2592
2592
  return this.useNamespace ? `exports.Prisma.${type.name} = ${enumBody};` : `exports.${type.name} = exports.$Enums.${type.name} = ${enumBody};`;
@@ -2597,7 +2597,7 @@ ${indent(type.data.map((v) => `${v.key}: ${this.getValueJS(v.value)}`).join(",\n
2597
2597
  toTS() {
2598
2598
  const { type } = this;
2599
2599
  return `export const ${type.name}: {
2600
- ${indent(type.data.map((v) => `${v.key}: ${this.getValueTS(v.value)}`).join(",\n"), TAB_SIZE)}
2600
+ ${indent(type.values.map((v) => `${v}: ${this.getValueTS(v)}`).join(",\n"), TAB_SIZE)}
2601
2601
  };
2602
2602
 
2603
2603
  export type ${type.name} = (typeof ${type.name})[keyof typeof ${type.name}]
@@ -4323,7 +4323,7 @@ function fluentWrapperName(modelName) {
4323
4323
  }
4324
4324
 
4325
4325
  // src/TSClient/TSClient.ts
4326
- import { datamodelEnumToSchemaEnum, datamodelSchemaEnumToSchemaEnum } from "@prisma/dmmf";
4326
+ import { datamodelEnumToSchemaEnum } from "@prisma/dmmf";
4327
4327
  import * as ts12 from "@prisma/ts-builders";
4328
4328
  import indent7 from "indent-string";
4329
4329
 
@@ -4552,27 +4552,30 @@ defineDmmfProperty(exports.Prisma, config.runtimeDataModel)`;
4552
4552
  }
4553
4553
 
4554
4554
  // src/utils/buildGetQueryCompilerWasmModule.ts
4555
- function buildQueryCompilerWasmModule(forceEdgeWasmLoader, runtimeName) {
4555
+ function buildQueryCompilerWasmModule(forceEdgeWasmLoader, runtimeName, compilerBuild) {
4556
+ const artifactName = `query_compiler_${compilerBuild}_bg`;
4556
4557
  if (runtimeName === "client" && !forceEdgeWasmLoader) {
4557
4558
  return `config.compilerWasm = {
4558
- getRuntime: async () => require('./query_compiler_bg.js'),
4559
+ getRuntime: async () => require('./${artifactName}.js'),
4559
4560
  getQueryCompilerWasmModule: async () => {
4560
4561
  const { Buffer } = require('node:buffer')
4561
- const { wasm } = require('./query_compiler_bg.wasm-base64.js')
4562
+ const { wasm } = require('./${artifactName}.wasm-base64.js')
4562
4563
  const queryCompilerWasmFileBytes = Buffer.from(wasm, 'base64')
4563
4564
 
4564
4565
  return new WebAssembly.Module(queryCompilerWasmFileBytes)
4565
- }
4566
+ },
4567
+ importName: './${artifactName}.js',
4566
4568
  }`;
4567
4569
  }
4568
4570
  if (runtimeName === "client" && forceEdgeWasmLoader || runtimeName === "wasm-compiler-edge") {
4569
4571
  return `config.compilerWasm = {
4570
- getRuntime: async () => require('./query_compiler_bg.js'),
4572
+ getRuntime: async () => require('./${artifactName}.js'),
4571
4573
  getQueryCompilerWasmModule: async () => {
4572
4574
  const loader = (await import('#wasm-compiler-loader')).default
4573
4575
  const compiler = (await loader).default
4574
4576
  return compiler
4575
- }
4577
+ },
4578
+ importName: './${artifactName}.js',
4576
4579
  }`;
4577
4580
  }
4578
4581
  return `config.compilerWasm = undefined`;
@@ -5793,7 +5796,7 @@ var TSClient = class {
5793
5796
  dmmf;
5794
5797
  genericsInfo;
5795
5798
  toJS() {
5796
- const { edge, wasm, generator, datamodel: inlineSchema, runtimeName, reusedJs } = this.options;
5799
+ const { edge, wasm, generator, datamodel: inlineSchema, runtimeName, reusedJs, compilerBuild } = this.options;
5797
5800
  if (reusedJs) {
5798
5801
  return `module.exports = { ...require('${reusedJs}') }`;
5799
5802
  }
@@ -5810,16 +5813,13 @@ ${buildRequirePath(edge)}
5810
5813
  /**
5811
5814
  * Enums
5812
5815
  */
5813
- ${this.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(datamodelSchemaEnumToSchemaEnum(type), true).toJS()).join("\n\n")}
5816
+ ${this.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toJS()).join("\n\n")}
5814
5817
  ${this.dmmf.datamodel.enums.map((datamodelEnum) => new Enum(datamodelEnumToSchemaEnum(datamodelEnum), false).toJS()).join("\n\n")}
5815
5818
 
5816
5819
  ${new Enum(
5817
5820
  {
5818
5821
  name: "ModelName",
5819
- data: this.dmmf.mappings.modelOperations.map((m) => ({
5820
- key: m.model,
5821
- value: m.model
5822
- }))
5822
+ values: this.dmmf.mappings.modelOperations.map((m) => m.model)
5823
5823
  },
5824
5824
  true
5825
5825
  ).toJS()}
@@ -5828,7 +5828,7 @@ ${new Enum(
5828
5828
  */
5829
5829
  const config = ${JSON.stringify(config, null, 2)}
5830
5830
  ${buildRuntimeDataModel(this.dmmf.datamodel, runtimeName)}
5831
- ${buildQueryCompilerWasmModule(wasm, runtimeName)}
5831
+ ${buildQueryCompilerWasmModule(wasm, runtimeName, compilerBuild)}
5832
5832
  ${buildDebugInitialization(edge)}
5833
5833
  const PrismaClient = getPrismaClient(config)
5834
5834
  exports.PrismaClient = PrismaClient
@@ -5862,9 +5862,7 @@ Object.assign(exports, Prisma)
5862
5862
  }
5863
5863
  return acc;
5864
5864
  }, []);
5865
- const prismaEnums = this.dmmf.schema.enumTypes.prisma?.map(
5866
- (type) => new Enum(datamodelSchemaEnumToSchemaEnum(type), true).toTS()
5867
- );
5865
+ const prismaEnums = this.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
5868
5866
  const modelEnums = [];
5869
5867
  const modelEnumsAliases = [];
5870
5868
  for (const datamodelEnum of this.dmmf.datamodel.enums) {
@@ -5906,10 +5904,7 @@ ${indent7(
5906
5904
  ${new Enum(
5907
5905
  {
5908
5906
  name: "ModelName",
5909
- data: this.dmmf.mappings.modelOperations.map((m) => ({
5910
- key: m.model,
5911
- value: m.model
5912
- }))
5907
+ values: this.dmmf.mappings.modelOperations.map((m) => m.model)
5913
5908
  },
5914
5909
  true
5915
5910
  ).toTS()}
@@ -5993,16 +5988,13 @@ export const dmmf: runtime.BaseDMMF
5993
5988
  * Enums
5994
5989
  */
5995
5990
 
5996
- ${this.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(datamodelSchemaEnumToSchemaEnum(type), true).toJS()).join("\n\n")}
5997
- ${this.dmmf.schema.enumTypes.model?.map((type) => new Enum(datamodelSchemaEnumToSchemaEnum(type), false).toJS()).join("\n\n") ?? ""}
5991
+ ${this.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toJS()).join("\n\n")}
5992
+ ${this.dmmf.schema.enumTypes.model?.map((type) => new Enum(type, false).toJS()).join("\n\n") ?? ""}
5998
5993
 
5999
5994
  ${new Enum(
6000
5995
  {
6001
5996
  name: "ModelName",
6002
- data: this.dmmf.mappings.modelOperations.map((m) => ({
6003
- key: m.model,
6004
- value: m.model
6005
- }))
5997
+ values: this.dmmf.mappings.modelOperations.map((m) => m.model)
6006
5998
  },
6007
5999
  true
6008
6000
  ).toJS()}
@@ -6360,7 +6352,8 @@ async function buildClient({
6360
6352
  engineVersion,
6361
6353
  clientVersion,
6362
6354
  activeProvider,
6363
- typedSql
6355
+ typedSql,
6356
+ compilerBuild
6364
6357
  }) {
6365
6358
  const baseClientOptions = {
6366
6359
  dmmf: getPrismaClientDMMF(dmmf),
@@ -6375,6 +6368,7 @@ async function buildClient({
6375
6368
  engineVersion,
6376
6369
  activeProvider,
6377
6370
  datamodel,
6371
+ compilerBuild,
6378
6372
  browser: false,
6379
6373
  edge: false,
6380
6374
  wasm: false
@@ -6437,8 +6431,9 @@ async function buildClient({
6437
6431
  fileMap["client.d.ts"] = TS(defaultClient);
6438
6432
  fileMap["default.js"] = JS(trampolineTsClient);
6439
6433
  fileMap["default.d.ts"] = TS(trampolineTsClient);
6440
- fileMap["wasm-worker-loader.mjs"] = `export default import('./query_compiler_bg.wasm')`;
6441
- fileMap["wasm-edge-light-loader.mjs"] = `export default import('./query_compiler_bg.wasm?module')`;
6434
+ const qcArtifactName = `query_compiler_${compilerBuild}_bg`;
6435
+ fileMap["wasm-worker-loader.mjs"] = `export default import('./${qcArtifactName}.wasm')`;
6436
+ fileMap["wasm-edge-light-loader.mjs"] = `export default import('./${qcArtifactName}.wasm?module')`;
6442
6437
  pkgJson["browser"] = "default.js";
6443
6438
  pkgJson["imports"] = {
6444
6439
  // when `import('#wasm-compiler-loader')` is called, it will be resolved to the correct file
@@ -6544,7 +6539,8 @@ async function generateClient(options) {
6544
6539
  clientVersion,
6545
6540
  engineVersion,
6546
6541
  activeProvider,
6547
- typedSql
6542
+ typedSql,
6543
+ compilerBuild
6548
6544
  } = options;
6549
6545
  const { runtimeBase, outputDir } = await getGenerationDirs(options);
6550
6546
  const { prismaClientDmmf, fileMap } = await buildClient({
@@ -6561,7 +6557,8 @@ async function generateClient(options) {
6561
6557
  engineVersion,
6562
6558
  activeProvider,
6563
6559
  testMode,
6564
- typedSql
6560
+ typedSql,
6561
+ compilerBuild
6565
6562
  });
6566
6563
  const provider = datasources[0].provider;
6567
6564
  const denylistsErrors = validateDmmfAgainstDenylists(prismaClientDmmf);
@@ -6593,7 +6590,7 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
6593
6590
  await fs.writeFile(schemaTargetPath, datamodel, { encoding: "utf-8" });
6594
6591
  if (isWasmEngineSupported(provider)) {
6595
6592
  const suffix = provider === "postgres" ? "postgresql" : provider;
6596
- const filename = "query_compiler_bg";
6593
+ const filename = `query_compiler_${compilerBuild}_bg`;
6597
6594
  const wasmJsBundlePath = path.join(runtimeSourcePath, `${filename}.${suffix}.wasm-base64.js`);
6598
6595
  const wasmBase64 = __require(wasmJsBundlePath).wasm;
6599
6596
  await fs.writeFile(path.join(outputDir, `${filename}.wasm`), Buffer.from(wasmBase64, "base64"));
@@ -6808,7 +6805,7 @@ import { enginesVersion } from "@prisma/engines-version";
6808
6805
  import { parseEnvValue } from "@prisma/internals";
6809
6806
 
6810
6807
  // package.json
6811
- var version = "7.3.0-dev.1";
6808
+ var version = "7.3.0-dev.10";
6812
6809
 
6813
6810
  // src/resolvePrismaClient.ts
6814
6811
  import fs2 from "node:fs/promises";
@@ -6884,7 +6881,8 @@ var PrismaClientJsGenerator = class {
6884
6881
  engineVersion: options.version,
6885
6882
  clientVersion: version,
6886
6883
  activeProvider: options.datasources[0]?.activeProvider,
6887
- typedSql: options.typedSql
6884
+ typedSql: options.typedSql,
6885
+ compilerBuild: parseCompilerBuildFromUnknown(options.generator.config.compilerBuild)
6888
6886
  });
6889
6887
  }
6890
6888
  async #getPrismaClientPath(config) {
@@ -6902,6 +6900,15 @@ var PrismaClientJsGenerator = class {
6902
6900
  return this.#runtimePath;
6903
6901
  }
6904
6902
  };
6903
+ function parseCompilerBuildFromUnknown(value) {
6904
+ if (value === void 0) {
6905
+ return "fast";
6906
+ }
6907
+ if (value === "small" || value === "fast") {
6908
+ return value;
6909
+ }
6910
+ throw new Error(`Invalid compiler build: ${JSON.stringify(value)}, expected one of: "fast", "small"`);
6911
+ }
6905
6912
 
6906
6913
  // src/utils/types/dmmfToTypes.ts
6907
6914
  import path4 from "node:path";
@@ -6931,7 +6938,8 @@ function dmmfToTypes(dmmf) {
6931
6938
  datamodel: "",
6932
6939
  browser: false,
6933
6940
  edge: false,
6934
- wasm: false
6941
+ wasm: false,
6942
+ compilerBuild: "fast"
6935
6943
  }).toTS();
6936
6944
  }
6937
6945
  export {
@@ -3,4 +3,4 @@ import { TSClientOptions } from '../TSClient/TSClient';
3
3
  * Builds the necessary glue code to load the query compiler wasm module.
4
4
  * @returns
5
5
  */
6
- export declare function buildQueryCompilerWasmModule(forceEdgeWasmLoader: boolean, runtimeName: TSClientOptions['runtimeName']): "config.compilerWasm = {\n getRuntime: async () => require('./query_compiler_bg.js'),\n getQueryCompilerWasmModule: async () => {\n const { Buffer } = require('node:buffer')\n const { wasm } = require('./query_compiler_bg.wasm-base64.js')\n const queryCompilerWasmFileBytes = Buffer.from(wasm, 'base64')\n\n return new WebAssembly.Module(queryCompilerWasmFileBytes)\n }\n }" | "config.compilerWasm = {\n getRuntime: async () => require('./query_compiler_bg.js'),\n getQueryCompilerWasmModule: async () => {\n const loader = (await import('#wasm-compiler-loader')).default\n const compiler = (await loader).default\n return compiler\n }\n}" | "config.compilerWasm = undefined";
6
+ export declare function buildQueryCompilerWasmModule(forceEdgeWasmLoader: boolean, runtimeName: TSClientOptions['runtimeName'], compilerBuild: TSClientOptions['compilerBuild']): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-generator-js",
3
- "version": "7.3.0-dev.1",
3
+ "version": "7.3.0-dev.10",
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,21 +25,21 @@
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
27
  "@antfu/ni": "0.21.12",
28
- "@prisma/engines-version": "7.2.0-4.0c8ef2ce45c83248ab3df073180d5eda9e8be7a3",
28
+ "@prisma/engines-version": "7.3.0-8.aee8f579c2872ad0cedd6fd7e9070704fdb3610e",
29
29
  "env-paths": "2.2.1",
30
30
  "indent-string": "4.0.0",
31
31
  "klona": "2.0.6",
32
32
  "package-up": "5.0.0",
33
33
  "pluralize": "8.0.0",
34
34
  "ts-pattern": "5.6.2",
35
- "@prisma/client-common": "7.3.0-dev.1",
36
- "@prisma/debug": "7.3.0-dev.1",
37
- "@prisma/fetch-engine": "7.3.0-dev.1",
38
- "@prisma/dmmf": "7.3.0-dev.1",
39
- "@prisma/get-platform": "7.3.0-dev.1",
40
- "@prisma/ts-builders": "7.3.0-dev.1",
41
- "@prisma/internals": "7.3.0-dev.1",
42
- "@prisma/generator": "7.3.0-dev.1"
35
+ "@prisma/client-common": "7.3.0-dev.10",
36
+ "@prisma/dmmf": "7.3.0-dev.10",
37
+ "@prisma/debug": "7.3.0-dev.10",
38
+ "@prisma/fetch-engine": "7.3.0-dev.10",
39
+ "@prisma/generator": "7.3.0-dev.10",
40
+ "@prisma/get-platform": "7.3.0-dev.10",
41
+ "@prisma/internals": "7.3.0-dev.10",
42
+ "@prisma/ts-builders": "7.3.0-dev.10"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/pluralize": "0.0.33",