@prisma/client-generator-ts 6.6.0-dev.92 → 6.6.0-dev.94

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.
@@ -6,9 +6,9 @@ export declare class PrismaClientClass implements Generable {
6
6
  protected readonly context: GenerateContext;
7
7
  protected readonly internalDatasources: DataSource[];
8
8
  protected readonly outputDir: string;
9
- protected readonly runtimeNameTs: TSClientOptions['runtimeNameTs'];
9
+ protected readonly runtimeName: TSClientOptions['runtimeName'];
10
10
  protected readonly browser?: boolean | undefined;
11
- constructor(context: GenerateContext, internalDatasources: DataSource[], outputDir: string, runtimeNameTs: TSClientOptions['runtimeNameTs'], browser?: boolean | undefined);
11
+ constructor(context: GenerateContext, internalDatasources: DataSource[], outputDir: string, runtimeName: TSClientOptions['runtimeName'], browser?: boolean | undefined);
12
12
  private get jsDoc();
13
13
  toTSWithoutNamespace(): string;
14
14
  toTS(): string;
@@ -4,12 +4,10 @@ import { DMMFHelper } from '../dmmf';
4
4
  import { GenerateClientOptions } from '../generateClient';
5
5
  import { GenericArgsInfo } from '../GenericsArgsInfo';
6
6
  import { type Generable } from './Generable';
7
- type RuntimeName = 'binary' | 'library' | 'wasm' | 'edge' | 'edge-esm' | 'index-browser' | 'react-native' | 'client' | (string & {});
7
+ type RuntimeName = 'binary' | 'library' | 'wasm' | 'edge' | 'react-native' | 'client' | (string & {});
8
8
  export type TSClientOptions = O.Required<GenerateClientOptions, 'runtimeBase'> & {
9
- /** More granular way to define JS runtime name */
10
- runtimeNameJs: RuntimeName;
11
- /** More granular way to define TS runtime name */
12
- runtimeNameTs: RuntimeName;
9
+ /** The name of the runtime bundle to use */
10
+ runtimeName: RuntimeName;
13
11
  /** When generating the browser client */
14
12
  browser: boolean;
15
13
  /** When generating via the Deno CLI */
@@ -18,10 +16,6 @@ export type TSClientOptions = O.Required<GenerateClientOptions, 'runtimeBase'> &
18
16
  edge: boolean;
19
17
  /** When we are generating a /wasm client */
20
18
  wasm: boolean;
21
- /** When types don't need to be regenerated */
22
- reusedTs?: string;
23
- /** When js doesn't need to be regenerated */
24
- reusedJs?: string;
25
19
  /** result of getEnvPaths call */
26
20
  envPaths: EnvPaths;
27
21
  };
@@ -1,7 +1,7 @@
1
1
  import type { TSClientOptions } from './TSClient';
2
- export declare const commonCodeJS: ({ runtimeBase, runtimeNameJs, browser, clientVersion, engineVersion, generator, deno, }: TSClientOptions) => string;
2
+ export declare const commonCodeJS: ({ runtimeBase, runtimeName, browser, clientVersion, engineVersion, generator, deno, }: TSClientOptions) => string;
3
3
  export declare const notSupportOnBrowser: (fnc: string, browser?: boolean) => string;
4
- export declare const commonCodeTS: ({ runtimeBase, runtimeNameTs, clientVersion, engineVersion, generator, }: TSClientOptions) => {
4
+ export declare const commonCodeTS: ({ runtimeBase, runtimeName, clientVersion, engineVersion, generator, }: TSClientOptions) => {
5
5
  tsWithoutNamespace: () => string;
6
6
  ts: () => string;
7
7
  };
package/dist/index.js CHANGED
@@ -4283,10 +4283,10 @@ function buildDirnameDefault() {
4283
4283
 
4284
4284
  // src/utils/buildDMMF.ts
4285
4285
  var import_client_common10 = require("@prisma/client-common");
4286
- function buildRuntimeDataModel(datamodel, runtimeNameJs) {
4286
+ function buildRuntimeDataModel(datamodel, runtimeName) {
4287
4287
  const runtimeDataModel = (0, import_client_common10.dmmfToRuntimeDataModel)(datamodel);
4288
4288
  let prunedDataModel;
4289
- if (runtimeNameJs === "wasm" || runtimeNameJs === "client") {
4289
+ if (runtimeName === "wasm" || runtimeName === "client") {
4290
4290
  prunedDataModel = (0, import_client_common10.pruneRuntimeDataModel)(runtimeDataModel);
4291
4291
  } else {
4292
4292
  prunedDataModel = runtimeDataModel;
@@ -4298,25 +4298,25 @@ defineDmmfProperty(exports.Prisma, config.runtimeDataModel)`;
4298
4298
  }
4299
4299
 
4300
4300
  // src/utils/buildGetQueryCompilerWasmModule.ts
4301
- function buildQueryCompilerWasmModule(wasm, copyCompiler, runtimeNameJs) {
4302
- if (copyCompiler && runtimeNameJs === "client") {
4301
+ function buildQueryCompilerWasmModule(wasm, copyCompiler, runtimeName) {
4302
+ if (copyCompiler && runtimeName === "client") {
4303
4303
  return `config.compilerWasm = {
4304
4304
  getRuntime: () => require('./query_compiler_bg.js'),
4305
4305
  getQueryCompilerWasmModule: async () => {
4306
4306
  const queryCompilerWasmFilePath = require('path').join(config.dirname, 'query_compiler_bg.wasm')
4307
4307
  const queryCompilerWasmFileBytes = require('fs').readFileSync(queryCompilerWasmFilePath)
4308
-
4308
+
4309
4309
  return new WebAssembly.Module(queryCompilerWasmFileBytes)
4310
4310
  }
4311
4311
  }`;
4312
4312
  }
4313
- if (copyCompiler && runtimeNameJs === "client" && wasm === true) {
4313
+ if (copyCompiler && runtimeName === "client" && wasm === true) {
4314
4314
  return `config.compilerWasm = {
4315
4315
  getRuntime: () => require('./query_compiler_bg.js'),
4316
4316
  getQueryCompilerWasmModule: async () => {
4317
4317
  const loader = (await import('#wasm-compiler-loader')).default
4318
4318
  const compiler = (await loader).default
4319
- return compiler
4319
+ return compiler
4320
4320
  }
4321
4321
  }`;
4322
4322
  }
@@ -4324,14 +4324,14 @@ function buildQueryCompilerWasmModule(wasm, copyCompiler, runtimeNameJs) {
4324
4324
  }
4325
4325
 
4326
4326
  // src/utils/buildGetQueryEngineWasmModule.ts
4327
- function buildQueryEngineWasmModule(wasm, copyEngine, runtimeNameJs) {
4328
- if (copyEngine && runtimeNameJs === "library" && process.env.PRISMA_CLIENT_FORCE_WASM) {
4327
+ function buildQueryEngineWasmModule(wasm, copyEngine, runtimeName) {
4328
+ if (copyEngine && runtimeName === "library" && process.env.PRISMA_CLIENT_FORCE_WASM) {
4329
4329
  return `config.engineWasm = {
4330
4330
  getRuntime: () => require('./query_engine_bg.js'),
4331
4331
  getQueryEngineWasmModule: async () => {
4332
4332
  const queryEngineWasmFilePath = require('path').join(config.dirname, 'query_engine_bg.wasm')
4333
4333
  const queryEngineWasmFileBytes = require('fs').readFileSync(queryEngineWasmFilePath)
4334
-
4334
+
4335
4335
  return new WebAssembly.Module(queryEngineWasmFileBytes)
4336
4336
  }
4337
4337
  }`;
@@ -4342,7 +4342,7 @@ function buildQueryEngineWasmModule(wasm, copyEngine, runtimeNameJs) {
4342
4342
  getQueryEngineWasmModule: async () => {
4343
4343
  const loader = (await import('#wasm-engine-loader')).default
4344
4344
  const engine = (await loader).default
4345
- return engine
4345
+ return engine
4346
4346
  }
4347
4347
  }`;
4348
4348
  }
@@ -4401,10 +4401,10 @@ function buildRequirePath(edge) {
4401
4401
  }
4402
4402
 
4403
4403
  // src/utils/buildWarnEnvConflicts.ts
4404
- function buildWarnEnvConflicts(edge, runtimeBase, runtimeNameJs) {
4404
+ function buildWarnEnvConflicts(edge, runtimeBase, runtimeName) {
4405
4405
  if (edge === true) return "";
4406
4406
  return `
4407
- const { warnEnvConflicts } = require('${runtimeBase}/${runtimeNameJs}.js')
4407
+ const { warnEnvConflicts } = require('${runtimeBase}/${runtimeName}')
4408
4408
 
4409
4409
  warnEnvConflicts({
4410
4410
  rootEnvPath: config.relativeEnvPaths.rootEnvPath && path.resolve(config.dirname, config.relativeEnvPaths.rootEnvPath),
@@ -4416,7 +4416,7 @@ warnEnvConflicts({
4416
4416
  var import_indent_string4 = __toESM(require("indent-string"));
4417
4417
  var commonCodeJS = ({
4418
4418
  runtimeBase,
4419
- runtimeNameJs,
4419
+ runtimeName,
4420
4420
  browser,
4421
4421
  clientVersion,
4422
4422
  engineVersion,
@@ -4445,7 +4445,7 @@ import {
4445
4445
  Public,
4446
4446
  getRuntime,
4447
4447
  skip
4448
- } from '${runtimeBase}/${runtimeNameJs}.js'` : browser ? `
4448
+ } from '${runtimeBase}/${runtimeName}'` : browser ? `
4449
4449
  const {
4450
4450
  Decimal,
4451
4451
  objectEnumValues,
@@ -4453,7 +4453,7 @@ const {
4453
4453
  Public,
4454
4454
  getRuntime,
4455
4455
  skip
4456
- } = require('${runtimeBase}/${runtimeNameJs}.js')
4456
+ } = require('${runtimeBase}/${runtimeName}')
4457
4457
  ` : `
4458
4458
  const {
4459
4459
  PrismaClientKnownRequestError,
@@ -4477,7 +4477,7 @@ const {
4477
4477
  Public,
4478
4478
  getRuntime,
4479
4479
  createParam,
4480
- } = require('${runtimeBase}/${runtimeNameJs}.js')
4480
+ } = require('${runtimeBase}/${runtimeName}')
4481
4481
  `}
4482
4482
 
4483
4483
  const Prisma = {}
@@ -4543,12 +4543,12 @@ In case this error is unexpected for you, please report it in https://pris.ly/pr
4543
4543
  };
4544
4544
  var commonCodeTS = ({
4545
4545
  runtimeBase,
4546
- runtimeNameTs,
4546
+ runtimeName,
4547
4547
  clientVersion,
4548
4548
  engineVersion,
4549
4549
  generator
4550
4550
  }) => ({
4551
- tsWithoutNamespace: () => `import * as runtime from '${runtimeBase}/${runtimeNameTs}';
4551
+ tsWithoutNamespace: () => `import * as runtime from '${runtimeBase}/${runtimeName}';
4552
4552
  import $Types = runtime.Types // general types
4553
4553
  import $Public = runtime.Types.Public
4554
4554
  import $Utils = runtime.Types.Utils
@@ -5407,7 +5407,7 @@ function runCommandRawDefinition(context) {
5407
5407
  return ts11.stringify(method3, { indentLevel: 1, newLine: "leading" });
5408
5408
  }
5409
5409
  function applyPendingMigrationsDefinition() {
5410
- if (this.runtimeNameTs !== "react-native") {
5410
+ if (this.runtimeName !== "react-native") {
5411
5411
  return null;
5412
5412
  }
5413
5413
  const method3 = ts11.method("$applyPendingMigrations").setReturnType(ts11.promise(ts11.voidType)).setDocComment(
@@ -5415,19 +5415,19 @@ function applyPendingMigrationsDefinition() {
5415
5415
  );
5416
5416
  return ts11.stringify(method3, { indentLevel: 1, newLine: "leading" });
5417
5417
  }
5418
- function eventRegistrationMethodDeclaration(runtimeNameTs) {
5419
- if (runtimeNameTs === "binary.js") {
5418
+ function eventRegistrationMethodDeclaration(runtimeName) {
5419
+ if (runtimeName === "binary") {
5420
5420
  return `$on<V extends (U | 'beforeExit')>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : V extends 'beforeExit' ? () => $Utils.JsPromise<void> : Prisma.LogEvent) => void): PrismaClient;`;
5421
5421
  } else {
5422
5422
  return `$on<V extends U>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;`;
5423
5423
  }
5424
5424
  }
5425
5425
  var PrismaClientClass = class {
5426
- constructor(context, internalDatasources, outputDir, runtimeNameTs, browser) {
5426
+ constructor(context, internalDatasources, outputDir, runtimeName, browser) {
5427
5427
  this.context = context;
5428
5428
  this.internalDatasources = internalDatasources;
5429
5429
  this.outputDir = outputDir;
5430
- this.runtimeNameTs = runtimeNameTs;
5430
+ this.runtimeName = runtimeName;
5431
5431
  this.browser = browser;
5432
5432
  }
5433
5433
  get jsDoc() {
@@ -5469,7 +5469,7 @@ export class PrismaClient<
5469
5469
  ${(0, import_indent_string7.default)(this.jsDoc, TAB_SIZE)}
5470
5470
 
5471
5471
  constructor(optionsArg ?: Prisma.Subset<ClientOptions, Prisma.PrismaClientOptions>);
5472
- ${eventRegistrationMethodDeclaration(this.runtimeNameTs)}
5472
+ ${eventRegistrationMethodDeclaration(this.runtimeName)}
5473
5473
 
5474
5474
  /**
5475
5475
  * Connect with the database
@@ -5645,7 +5645,7 @@ export type TransactionClient = Omit<Prisma.DefaultPrismaClient, runtime.ITXClie
5645
5645
  timeout ?= 5000
5646
5646
  `)
5647
5647
  );
5648
- if (["library.js", "client.js"].includes(this.runtimeNameTs) && this.context.isPreviewFeatureOn("driverAdapters")) {
5648
+ if (["library", "client"].includes(this.runtimeName) && this.context.isPreviewFeatureOn("driverAdapters")) {
5649
5649
  clientOptions.add(
5650
5650
  ts11.property("adapter", ts11.unionType([ts11.namedType("runtime.SqlDriverAdapterFactory"), ts11.namedType("null")])).optional().setDocComment(
5651
5651
  ts11.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
@@ -5690,16 +5690,12 @@ var TSClient = class {
5690
5690
  outputDir,
5691
5691
  datamodel: inlineSchema,
5692
5692
  runtimeBase,
5693
- runtimeNameJs,
5693
+ runtimeName,
5694
5694
  datasources,
5695
5695
  deno,
5696
5696
  copyEngine = true,
5697
- reusedJs,
5698
5697
  envPaths
5699
5698
  } = this.options;
5700
- if (reusedJs) {
5701
- return `module.exports = { ...require('${reusedJs}') }`;
5702
- }
5703
5699
  const relativeEnvPaths = {
5704
5700
  rootEnvPath: envPaths.rootEnvPath && (0, import_internals7.pathToPosix)(import_path2.default.relative(outputDir, envPaths.rootEnvPath)),
5705
5701
  schemaEnvPath: envPaths.schemaEnvPath && (0, import_internals7.pathToPosix)(import_path2.default.relative(outputDir, envPaths.schemaEnvPath))
@@ -5748,11 +5744,11 @@ ${new Enum(
5748
5744
  */
5749
5745
  const config = ${JSON.stringify(config, null, 2)}
5750
5746
  ${buildDirname(edge, relativeOutdir)}
5751
- ${buildRuntimeDataModel(this.dmmf.datamodel, runtimeNameJs)}
5752
- ${buildQueryEngineWasmModule(wasm, copyEngine, runtimeNameJs)}
5753
- ${buildQueryCompilerWasmModule(wasm, copyEngine, runtimeNameJs)}
5747
+ ${buildRuntimeDataModel(this.dmmf.datamodel, runtimeName)}
5748
+ ${buildQueryEngineWasmModule(wasm, copyEngine, runtimeName)}
5749
+ ${buildQueryCompilerWasmModule(wasm, copyEngine, runtimeName)}
5754
5750
  ${buildInjectableEdgeEnv(edge, datasources)}
5755
- ${buildWarnEnvConflicts(edge, runtimeBase, runtimeNameJs)}
5751
+ ${buildWarnEnvConflicts(edge, runtimeBase, runtimeName)}
5756
5752
  ${buildDebugInitialization(edge)}
5757
5753
  const PrismaClient = getPrismaClient(config)
5758
5754
  exports.PrismaClient = PrismaClient
@@ -5762,11 +5758,6 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
5762
5758
  return code;
5763
5759
  }
5764
5760
  toTS() {
5765
- const { reusedTs } = this.options;
5766
- if (reusedTs) {
5767
- const topExports = ts12.moduleExportFrom(`./${reusedTs}`);
5768
- return ts12.stringify(topExports);
5769
- }
5770
5761
  const context = new GenerateContext({
5771
5762
  dmmf: this.dmmf,
5772
5763
  genericArgsInfo: this.genericsInfo,
@@ -5776,7 +5767,7 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
5776
5767
  context,
5777
5768
  this.options.datasources,
5778
5769
  this.options.outputDir,
5779
- this.options.runtimeNameTs,
5770
+ this.options.runtimeName,
5780
5771
  this.options.browser
5781
5772
  );
5782
5773
  const commonCode = commonCodeTS(this.options);
@@ -5905,7 +5896,7 @@ export const dmmf: runtime.BaseDMMF
5905
5896
  toBrowserJS() {
5906
5897
  const code = `${commonCodeJS({
5907
5898
  ...this.options,
5908
- runtimeNameJs: "index-browser",
5899
+ runtimeName: "index-browser",
5909
5900
  browser: true
5910
5901
  })}
5911
5902
  /**
@@ -6284,26 +6275,20 @@ function buildClient({
6284
6275
  };
6285
6276
  const nodeClientOptions = {
6286
6277
  ...baseClientOptions,
6287
- runtimeNameJs: getNodeRuntimeName(clientEngineType),
6288
- runtimeNameTs: `${getNodeRuntimeName(clientEngineType)}.js`
6278
+ runtimeName: getNodeRuntimeName(clientEngineType)
6289
6279
  };
6290
6280
  const nodeClient = new TSClient(nodeClientOptions);
6291
6281
  const defaultClient = new TSClient({
6292
- ...nodeClientOptions,
6293
- reusedTs: "index",
6294
- reusedJs: "."
6282
+ ...nodeClientOptions
6295
6283
  });
6296
6284
  const edgeClient = new TSClient({
6297
6285
  ...baseClientOptions,
6298
- runtimeNameJs: "edge",
6299
- runtimeNameTs: "library.js",
6300
- reusedTs: "default",
6286
+ runtimeName: "edge",
6301
6287
  edge: true
6302
6288
  });
6303
6289
  const rnTsClient = new TSClient({
6304
6290
  ...baseClientOptions,
6305
- runtimeNameJs: "react-native",
6306
- runtimeNameTs: "react-native",
6291
+ runtimeName: "react-native",
6307
6292
  edge: true
6308
6293
  });
6309
6294
  const fileMap = {};
@@ -6332,9 +6317,7 @@ function buildClient({
6332
6317
  }
6333
6318
  const wasmClient = new TSClient({
6334
6319
  ...baseClientOptions,
6335
- runtimeNameJs: "wasm",
6336
- runtimeNameTs: "library.js",
6337
- reusedTs: "default",
6320
+ runtimeName: "wasm",
6338
6321
  edge: true,
6339
6322
  wasm: true
6340
6323
  });
@@ -6348,8 +6331,7 @@ function buildClient({
6348
6331
  const denoEdgeClient = new TSClient({
6349
6332
  ...baseClientOptions,
6350
6333
  runtimeBase: `../${runtimeBase}`,
6351
- runtimeNameJs: "edge-esm",
6352
- runtimeNameTs: "library.d.ts",
6334
+ runtimeName: "edge",
6353
6335
  deno: true,
6354
6336
  edge: true
6355
6337
  });
@@ -6622,7 +6604,7 @@ var import_internals11 = require("@prisma/internals");
6622
6604
  var import_ts_pattern = require("ts-pattern");
6623
6605
 
6624
6606
  // package.json
6625
- var version = "6.6.0-dev.92";
6607
+ var version = "6.6.0-dev.94";
6626
6608
 
6627
6609
  // src/generator.ts
6628
6610
  var debug = (0, import_debug.default)("prisma:client:generator");
@@ -6683,8 +6665,7 @@ function dmmfToTypes(dmmf) {
6683
6665
  clientVersion: "",
6684
6666
  engineVersion: "",
6685
6667
  runtimeBase: "@prisma/client",
6686
- runtimeNameJs: "library",
6687
- runtimeNameTs: "library",
6668
+ runtimeName: "library",
6688
6669
  schemaPath: "",
6689
6670
  outputDir: "",
6690
6671
  activeProvider: "",
package/dist/index.mjs CHANGED
@@ -4281,10 +4281,10 @@ import {
4281
4281
  dmmfToRuntimeDataModel,
4282
4282
  pruneRuntimeDataModel
4283
4283
  } from "@prisma/client-common";
4284
- function buildRuntimeDataModel(datamodel, runtimeNameJs) {
4284
+ function buildRuntimeDataModel(datamodel, runtimeName) {
4285
4285
  const runtimeDataModel = dmmfToRuntimeDataModel(datamodel);
4286
4286
  let prunedDataModel;
4287
- if (runtimeNameJs === "wasm" || runtimeNameJs === "client") {
4287
+ if (runtimeName === "wasm" || runtimeName === "client") {
4288
4288
  prunedDataModel = pruneRuntimeDataModel(runtimeDataModel);
4289
4289
  } else {
4290
4290
  prunedDataModel = runtimeDataModel;
@@ -4296,25 +4296,25 @@ defineDmmfProperty(exports.Prisma, config.runtimeDataModel)`;
4296
4296
  }
4297
4297
 
4298
4298
  // src/utils/buildGetQueryCompilerWasmModule.ts
4299
- function buildQueryCompilerWasmModule(wasm, copyCompiler, runtimeNameJs) {
4300
- if (copyCompiler && runtimeNameJs === "client") {
4299
+ function buildQueryCompilerWasmModule(wasm, copyCompiler, runtimeName) {
4300
+ if (copyCompiler && runtimeName === "client") {
4301
4301
  return `config.compilerWasm = {
4302
4302
  getRuntime: () => require('./query_compiler_bg.js'),
4303
4303
  getQueryCompilerWasmModule: async () => {
4304
4304
  const queryCompilerWasmFilePath = require('path').join(config.dirname, 'query_compiler_bg.wasm')
4305
4305
  const queryCompilerWasmFileBytes = require('fs').readFileSync(queryCompilerWasmFilePath)
4306
-
4306
+
4307
4307
  return new WebAssembly.Module(queryCompilerWasmFileBytes)
4308
4308
  }
4309
4309
  }`;
4310
4310
  }
4311
- if (copyCompiler && runtimeNameJs === "client" && wasm === true) {
4311
+ if (copyCompiler && runtimeName === "client" && wasm === true) {
4312
4312
  return `config.compilerWasm = {
4313
4313
  getRuntime: () => require('./query_compiler_bg.js'),
4314
4314
  getQueryCompilerWasmModule: async () => {
4315
4315
  const loader = (await import('#wasm-compiler-loader')).default
4316
4316
  const compiler = (await loader).default
4317
- return compiler
4317
+ return compiler
4318
4318
  }
4319
4319
  }`;
4320
4320
  }
@@ -4322,14 +4322,14 @@ function buildQueryCompilerWasmModule(wasm, copyCompiler, runtimeNameJs) {
4322
4322
  }
4323
4323
 
4324
4324
  // src/utils/buildGetQueryEngineWasmModule.ts
4325
- function buildQueryEngineWasmModule(wasm, copyEngine, runtimeNameJs) {
4326
- if (copyEngine && runtimeNameJs === "library" && process.env.PRISMA_CLIENT_FORCE_WASM) {
4325
+ function buildQueryEngineWasmModule(wasm, copyEngine, runtimeName) {
4326
+ if (copyEngine && runtimeName === "library" && process.env.PRISMA_CLIENT_FORCE_WASM) {
4327
4327
  return `config.engineWasm = {
4328
4328
  getRuntime: () => require('./query_engine_bg.js'),
4329
4329
  getQueryEngineWasmModule: async () => {
4330
4330
  const queryEngineWasmFilePath = require('path').join(config.dirname, 'query_engine_bg.wasm')
4331
4331
  const queryEngineWasmFileBytes = require('fs').readFileSync(queryEngineWasmFilePath)
4332
-
4332
+
4333
4333
  return new WebAssembly.Module(queryEngineWasmFileBytes)
4334
4334
  }
4335
4335
  }`;
@@ -4340,7 +4340,7 @@ function buildQueryEngineWasmModule(wasm, copyEngine, runtimeNameJs) {
4340
4340
  getQueryEngineWasmModule: async () => {
4341
4341
  const loader = (await import('#wasm-engine-loader')).default
4342
4342
  const engine = (await loader).default
4343
- return engine
4343
+ return engine
4344
4344
  }
4345
4345
  }`;
4346
4346
  }
@@ -4399,10 +4399,10 @@ function buildRequirePath(edge) {
4399
4399
  }
4400
4400
 
4401
4401
  // src/utils/buildWarnEnvConflicts.ts
4402
- function buildWarnEnvConflicts(edge, runtimeBase, runtimeNameJs) {
4402
+ function buildWarnEnvConflicts(edge, runtimeBase, runtimeName) {
4403
4403
  if (edge === true) return "";
4404
4404
  return `
4405
- const { warnEnvConflicts } = require('${runtimeBase}/${runtimeNameJs}.js')
4405
+ const { warnEnvConflicts } = require('${runtimeBase}/${runtimeName}')
4406
4406
 
4407
4407
  warnEnvConflicts({
4408
4408
  rootEnvPath: config.relativeEnvPaths.rootEnvPath && path.resolve(config.dirname, config.relativeEnvPaths.rootEnvPath),
@@ -4414,7 +4414,7 @@ warnEnvConflicts({
4414
4414
  import indent4 from "indent-string";
4415
4415
  var commonCodeJS = ({
4416
4416
  runtimeBase,
4417
- runtimeNameJs,
4417
+ runtimeName,
4418
4418
  browser,
4419
4419
  clientVersion,
4420
4420
  engineVersion,
@@ -4443,7 +4443,7 @@ import {
4443
4443
  Public,
4444
4444
  getRuntime,
4445
4445
  skip
4446
- } from '${runtimeBase}/${runtimeNameJs}.js'` : browser ? `
4446
+ } from '${runtimeBase}/${runtimeName}'` : browser ? `
4447
4447
  const {
4448
4448
  Decimal,
4449
4449
  objectEnumValues,
@@ -4451,7 +4451,7 @@ const {
4451
4451
  Public,
4452
4452
  getRuntime,
4453
4453
  skip
4454
- } = require('${runtimeBase}/${runtimeNameJs}.js')
4454
+ } = require('${runtimeBase}/${runtimeName}')
4455
4455
  ` : `
4456
4456
  const {
4457
4457
  PrismaClientKnownRequestError,
@@ -4475,7 +4475,7 @@ const {
4475
4475
  Public,
4476
4476
  getRuntime,
4477
4477
  createParam,
4478
- } = require('${runtimeBase}/${runtimeNameJs}.js')
4478
+ } = require('${runtimeBase}/${runtimeName}')
4479
4479
  `}
4480
4480
 
4481
4481
  const Prisma = {}
@@ -4541,12 +4541,12 @@ In case this error is unexpected for you, please report it in https://pris.ly/pr
4541
4541
  };
4542
4542
  var commonCodeTS = ({
4543
4543
  runtimeBase,
4544
- runtimeNameTs,
4544
+ runtimeName,
4545
4545
  clientVersion,
4546
4546
  engineVersion,
4547
4547
  generator
4548
4548
  }) => ({
4549
- tsWithoutNamespace: () => `import * as runtime from '${runtimeBase}/${runtimeNameTs}';
4549
+ tsWithoutNamespace: () => `import * as runtime from '${runtimeBase}/${runtimeName}';
4550
4550
  import $Types = runtime.Types // general types
4551
4551
  import $Public = runtime.Types.Public
4552
4552
  import $Utils = runtime.Types.Utils
@@ -5405,7 +5405,7 @@ function runCommandRawDefinition(context) {
5405
5405
  return ts11.stringify(method3, { indentLevel: 1, newLine: "leading" });
5406
5406
  }
5407
5407
  function applyPendingMigrationsDefinition() {
5408
- if (this.runtimeNameTs !== "react-native") {
5408
+ if (this.runtimeName !== "react-native") {
5409
5409
  return null;
5410
5410
  }
5411
5411
  const method3 = ts11.method("$applyPendingMigrations").setReturnType(ts11.promise(ts11.voidType)).setDocComment(
@@ -5413,19 +5413,19 @@ function applyPendingMigrationsDefinition() {
5413
5413
  );
5414
5414
  return ts11.stringify(method3, { indentLevel: 1, newLine: "leading" });
5415
5415
  }
5416
- function eventRegistrationMethodDeclaration(runtimeNameTs) {
5417
- if (runtimeNameTs === "binary.js") {
5416
+ function eventRegistrationMethodDeclaration(runtimeName) {
5417
+ if (runtimeName === "binary") {
5418
5418
  return `$on<V extends (U | 'beforeExit')>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : V extends 'beforeExit' ? () => $Utils.JsPromise<void> : Prisma.LogEvent) => void): PrismaClient;`;
5419
5419
  } else {
5420
5420
  return `$on<V extends U>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;`;
5421
5421
  }
5422
5422
  }
5423
5423
  var PrismaClientClass = class {
5424
- constructor(context, internalDatasources, outputDir, runtimeNameTs, browser) {
5424
+ constructor(context, internalDatasources, outputDir, runtimeName, browser) {
5425
5425
  this.context = context;
5426
5426
  this.internalDatasources = internalDatasources;
5427
5427
  this.outputDir = outputDir;
5428
- this.runtimeNameTs = runtimeNameTs;
5428
+ this.runtimeName = runtimeName;
5429
5429
  this.browser = browser;
5430
5430
  }
5431
5431
  get jsDoc() {
@@ -5467,7 +5467,7 @@ export class PrismaClient<
5467
5467
  ${indent7(this.jsDoc, TAB_SIZE)}
5468
5468
 
5469
5469
  constructor(optionsArg ?: Prisma.Subset<ClientOptions, Prisma.PrismaClientOptions>);
5470
- ${eventRegistrationMethodDeclaration(this.runtimeNameTs)}
5470
+ ${eventRegistrationMethodDeclaration(this.runtimeName)}
5471
5471
 
5472
5472
  /**
5473
5473
  * Connect with the database
@@ -5643,7 +5643,7 @@ export type TransactionClient = Omit<Prisma.DefaultPrismaClient, runtime.ITXClie
5643
5643
  timeout ?= 5000
5644
5644
  `)
5645
5645
  );
5646
- if (["library.js", "client.js"].includes(this.runtimeNameTs) && this.context.isPreviewFeatureOn("driverAdapters")) {
5646
+ if (["library", "client"].includes(this.runtimeName) && this.context.isPreviewFeatureOn("driverAdapters")) {
5647
5647
  clientOptions.add(
5648
5648
  ts11.property("adapter", ts11.unionType([ts11.namedType("runtime.SqlDriverAdapterFactory"), ts11.namedType("null")])).optional().setDocComment(
5649
5649
  ts11.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
@@ -5688,16 +5688,12 @@ var TSClient = class {
5688
5688
  outputDir,
5689
5689
  datamodel: inlineSchema,
5690
5690
  runtimeBase,
5691
- runtimeNameJs,
5691
+ runtimeName,
5692
5692
  datasources,
5693
5693
  deno,
5694
5694
  copyEngine = true,
5695
- reusedJs,
5696
5695
  envPaths
5697
5696
  } = this.options;
5698
- if (reusedJs) {
5699
- return `module.exports = { ...require('${reusedJs}') }`;
5700
- }
5701
5697
  const relativeEnvPaths = {
5702
5698
  rootEnvPath: envPaths.rootEnvPath && pathToPosix3(path2.relative(outputDir, envPaths.rootEnvPath)),
5703
5699
  schemaEnvPath: envPaths.schemaEnvPath && pathToPosix3(path2.relative(outputDir, envPaths.schemaEnvPath))
@@ -5746,11 +5742,11 @@ ${new Enum(
5746
5742
  */
5747
5743
  const config = ${JSON.stringify(config, null, 2)}
5748
5744
  ${buildDirname(edge, relativeOutdir)}
5749
- ${buildRuntimeDataModel(this.dmmf.datamodel, runtimeNameJs)}
5750
- ${buildQueryEngineWasmModule(wasm, copyEngine, runtimeNameJs)}
5751
- ${buildQueryCompilerWasmModule(wasm, copyEngine, runtimeNameJs)}
5745
+ ${buildRuntimeDataModel(this.dmmf.datamodel, runtimeName)}
5746
+ ${buildQueryEngineWasmModule(wasm, copyEngine, runtimeName)}
5747
+ ${buildQueryCompilerWasmModule(wasm, copyEngine, runtimeName)}
5752
5748
  ${buildInjectableEdgeEnv(edge, datasources)}
5753
- ${buildWarnEnvConflicts(edge, runtimeBase, runtimeNameJs)}
5749
+ ${buildWarnEnvConflicts(edge, runtimeBase, runtimeName)}
5754
5750
  ${buildDebugInitialization(edge)}
5755
5751
  const PrismaClient = getPrismaClient(config)
5756
5752
  exports.PrismaClient = PrismaClient
@@ -5760,11 +5756,6 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
5760
5756
  return code;
5761
5757
  }
5762
5758
  toTS() {
5763
- const { reusedTs } = this.options;
5764
- if (reusedTs) {
5765
- const topExports = ts12.moduleExportFrom(`./${reusedTs}`);
5766
- return ts12.stringify(topExports);
5767
- }
5768
5759
  const context = new GenerateContext({
5769
5760
  dmmf: this.dmmf,
5770
5761
  genericArgsInfo: this.genericsInfo,
@@ -5774,7 +5765,7 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
5774
5765
  context,
5775
5766
  this.options.datasources,
5776
5767
  this.options.outputDir,
5777
- this.options.runtimeNameTs,
5768
+ this.options.runtimeName,
5778
5769
  this.options.browser
5779
5770
  );
5780
5771
  const commonCode = commonCodeTS(this.options);
@@ -5903,7 +5894,7 @@ export const dmmf: runtime.BaseDMMF
5903
5894
  toBrowserJS() {
5904
5895
  const code = `${commonCodeJS({
5905
5896
  ...this.options,
5906
- runtimeNameJs: "index-browser",
5897
+ runtimeName: "index-browser",
5907
5898
  browser: true
5908
5899
  })}
5909
5900
  /**
@@ -6282,26 +6273,20 @@ function buildClient({
6282
6273
  };
6283
6274
  const nodeClientOptions = {
6284
6275
  ...baseClientOptions,
6285
- runtimeNameJs: getNodeRuntimeName(clientEngineType),
6286
- runtimeNameTs: `${getNodeRuntimeName(clientEngineType)}.js`
6276
+ runtimeName: getNodeRuntimeName(clientEngineType)
6287
6277
  };
6288
6278
  const nodeClient = new TSClient(nodeClientOptions);
6289
6279
  const defaultClient = new TSClient({
6290
- ...nodeClientOptions,
6291
- reusedTs: "index",
6292
- reusedJs: "."
6280
+ ...nodeClientOptions
6293
6281
  });
6294
6282
  const edgeClient = new TSClient({
6295
6283
  ...baseClientOptions,
6296
- runtimeNameJs: "edge",
6297
- runtimeNameTs: "library.js",
6298
- reusedTs: "default",
6284
+ runtimeName: "edge",
6299
6285
  edge: true
6300
6286
  });
6301
6287
  const rnTsClient = new TSClient({
6302
6288
  ...baseClientOptions,
6303
- runtimeNameJs: "react-native",
6304
- runtimeNameTs: "react-native",
6289
+ runtimeName: "react-native",
6305
6290
  edge: true
6306
6291
  });
6307
6292
  const fileMap = {};
@@ -6330,9 +6315,7 @@ function buildClient({
6330
6315
  }
6331
6316
  const wasmClient = new TSClient({
6332
6317
  ...baseClientOptions,
6333
- runtimeNameJs: "wasm",
6334
- runtimeNameTs: "library.js",
6335
- reusedTs: "default",
6318
+ runtimeName: "wasm",
6336
6319
  edge: true,
6337
6320
  wasm: true
6338
6321
  });
@@ -6346,8 +6329,7 @@ function buildClient({
6346
6329
  const denoEdgeClient = new TSClient({
6347
6330
  ...baseClientOptions,
6348
6331
  runtimeBase: `../${runtimeBase}`,
6349
- runtimeNameJs: "edge-esm",
6350
- runtimeNameTs: "library.d.ts",
6332
+ runtimeName: "edge",
6351
6333
  deno: true,
6352
6334
  edge: true
6353
6335
  });
@@ -6620,7 +6602,7 @@ import { ClientEngineType as ClientEngineType4, getClientEngineType as getClient
6620
6602
  import { match } from "ts-pattern";
6621
6603
 
6622
6604
  // package.json
6623
- var version = "6.6.0-dev.92";
6605
+ var version = "6.6.0-dev.94";
6624
6606
 
6625
6607
  // src/generator.ts
6626
6608
  var debug = Debug("prisma:client:generator");
@@ -6681,8 +6663,7 @@ function dmmfToTypes(dmmf) {
6681
6663
  clientVersion: "",
6682
6664
  engineVersion: "",
6683
6665
  runtimeBase: "@prisma/client",
6684
- runtimeNameJs: "library",
6685
- runtimeNameTs: "library",
6666
+ runtimeName: "library",
6686
6667
  schemaPath: "",
6687
6668
  outputDir: "",
6688
6669
  activeProvider: "",
@@ -13,4 +13,4 @@ import { TSClientOptions } from '../TSClient/TSClient';
13
13
  * @param datamodel
14
14
  * @returns
15
15
  */
16
- export declare function buildRuntimeDataModel(datamodel: DMMF.Datamodel, runtimeNameJs: TSClientOptions['runtimeNameJs']): string;
16
+ export declare function buildRuntimeDataModel(datamodel: DMMF.Datamodel, runtimeName: TSClientOptions['runtimeName']): string;
@@ -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(wasm: boolean, copyCompiler: boolean, runtimeNameJs: TSClientOptions['runtimeNameJs']): "config.compilerWasm = {\n getRuntime: () => require('./query_compiler_bg.js'),\n getQueryCompilerWasmModule: async () => {\n const queryCompilerWasmFilePath = require('path').join(config.dirname, 'query_compiler_bg.wasm')\n const queryCompilerWasmFileBytes = require('fs').readFileSync(queryCompilerWasmFilePath)\n \n return new WebAssembly.Module(queryCompilerWasmFileBytes)\n }\n }" | "config.compilerWasm = {\n getRuntime: () => 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(wasm: boolean, copyCompiler: boolean, runtimeName: TSClientOptions['runtimeName']): "config.compilerWasm = {\n getRuntime: () => require('./query_compiler_bg.js'),\n getQueryCompilerWasmModule: async () => {\n const queryCompilerWasmFilePath = require('path').join(config.dirname, 'query_compiler_bg.wasm')\n const queryCompilerWasmFileBytes = require('fs').readFileSync(queryCompilerWasmFilePath)\n\n return new WebAssembly.Module(queryCompilerWasmFileBytes)\n }\n }" | "config.compilerWasm = {\n getRuntime: () => 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";
@@ -3,4 +3,4 @@ import { TSClientOptions } from '../TSClient/TSClient';
3
3
  * Builds the necessary glue code to load the query engine wasm module.
4
4
  * @returns
5
5
  */
6
- export declare function buildQueryEngineWasmModule(wasm: boolean, copyEngine: boolean, runtimeNameJs: TSClientOptions['runtimeNameJs']): "config.engineWasm = {\n getRuntime: () => require('./query_engine_bg.js'),\n getQueryEngineWasmModule: async () => {\n const queryEngineWasmFilePath = require('path').join(config.dirname, 'query_engine_bg.wasm')\n const queryEngineWasmFileBytes = require('fs').readFileSync(queryEngineWasmFilePath)\n \n return new WebAssembly.Module(queryEngineWasmFileBytes)\n }\n }" | "config.engineWasm = {\n getRuntime: () => require('./query_engine_bg.js'),\n getQueryEngineWasmModule: async () => {\n const loader = (await import('#wasm-engine-loader')).default\n const engine = (await loader).default\n return engine \n }\n}" | "config.engineWasm = undefined";
6
+ export declare function buildQueryEngineWasmModule(wasm: boolean, copyEngine: boolean, runtimeName: TSClientOptions['runtimeName']): "config.engineWasm = {\n getRuntime: () => require('./query_engine_bg.js'),\n getQueryEngineWasmModule: async () => {\n const queryEngineWasmFilePath = require('path').join(config.dirname, 'query_engine_bg.wasm')\n const queryEngineWasmFileBytes = require('fs').readFileSync(queryEngineWasmFilePath)\n\n return new WebAssembly.Module(queryEngineWasmFileBytes)\n }\n }" | "config.engineWasm = {\n getRuntime: () => require('./query_engine_bg.js'),\n getQueryEngineWasmModule: async () => {\n const loader = (await import('#wasm-engine-loader')).default\n const engine = (await loader).default\n return engine\n }\n}" | "config.engineWasm = undefined";
@@ -2,9 +2,5 @@ import { TSClientOptions } from '../TSClient/TSClient';
2
2
  /**
3
3
  * Builds the necessary bits so that our users can get a helpful warning during
4
4
  * "generate" in case of conflicts between their environment & their env files.
5
- * @param edge
6
- * @param runtimeBase
7
- * @param runtimeNameJs
8
- * @returns
9
5
  */
10
- export declare function buildWarnEnvConflicts(edge: boolean, runtimeBase: string, runtimeNameJs: TSClientOptions['runtimeNameJs']): string;
6
+ export declare function buildWarnEnvConflicts(edge: boolean, runtimeBase: string, runtimeName: TSClientOptions['runtimeName']): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-generator-ts",
3
- "version": "6.6.0-dev.92",
3
+ "version": "6.6.0-dev.94",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -34,14 +34,14 @@
34
34
  "pkg-up": "3.1.0",
35
35
  "pluralize": "8.0.0",
36
36
  "ts-pattern": "5.6.2",
37
- "@prisma/client-common": "6.6.0-dev.92",
38
- "@prisma/debug": "6.6.0-dev.92",
39
- "@prisma/dmmf": "6.6.0-dev.92",
40
- "@prisma/fetch-engine": "6.6.0-dev.92",
41
- "@prisma/generator": "6.6.0-dev.92",
42
- "@prisma/get-platform": "6.6.0-dev.92",
43
- "@prisma/ts-builders": "6.6.0-dev.92",
44
- "@prisma/internals": "6.6.0-dev.92"
37
+ "@prisma/client-common": "6.6.0-dev.94",
38
+ "@prisma/dmmf": "6.6.0-dev.94",
39
+ "@prisma/debug": "6.6.0-dev.94",
40
+ "@prisma/fetch-engine": "6.6.0-dev.94",
41
+ "@prisma/generator": "6.6.0-dev.94",
42
+ "@prisma/get-platform": "6.6.0-dev.94",
43
+ "@prisma/internals": "6.6.0-dev.94",
44
+ "@prisma/ts-builders": "6.6.0-dev.94"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/pluralize": "0.0.33",