@prisma/client-generator-ts 6.7.0-dev.17 → 6.7.0-dev.19

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.
@@ -2,14 +2,12 @@ import { GeneratorConfig } from '@prisma/generator';
2
2
  import { DMMFHelper } from '../dmmf';
3
3
  import { FileNameMapper } from '../file-extensions';
4
4
  import { GenericArgsInfo } from '../GenericsArgsInfo';
5
- import { ModuleFormat } from '../module-format';
6
5
  export interface GenerateContextOptions {
7
6
  dmmf: DMMFHelper;
8
7
  genericArgsInfo: GenericArgsInfo;
9
8
  runtimeImport: string;
10
9
  outputFileName: FileNameMapper;
11
10
  importFileName: FileNameMapper;
12
- moduleFormat: ModuleFormat;
13
11
  generator?: GeneratorConfig;
14
12
  }
15
13
  export declare class GenerateContext implements GenerateContextOptions {
@@ -18,8 +16,7 @@ export declare class GenerateContext implements GenerateContextOptions {
18
16
  runtimeImport: string;
19
17
  outputFileName: FileNameMapper;
20
18
  importFileName: FileNameMapper;
21
- moduleFormat: ModuleFormat;
22
19
  generator?: GeneratorConfig;
23
- constructor({ dmmf, genericArgsInfo, runtimeImport, outputFileName, importFileName, moduleFormat, generator, }: GenerateContextOptions);
20
+ constructor({ dmmf, genericArgsInfo, runtimeImport, outputFileName, importFileName, generator, }: GenerateContextOptions);
24
21
  isPreviewFeatureOn(previewFeature: string): boolean;
25
22
  }
@@ -1,5 +1,7 @@
1
+ import * as ts from '@prisma/ts-builders';
1
2
  import { GenerateContext } from './GenerateContext';
2
3
  import { TSClientOptions } from './TSClient';
4
+ export declare function getPrismaClientClassDocComment({ dmmf }: GenerateContext): ts.DocComment;
3
5
  export declare class PrismaClientClass {
4
6
  private readonly context;
5
7
  private readonly runtimeName;
package/dist/index.js CHANGED
@@ -2951,17 +2951,6 @@ function buildDebugInitialization(edge) {
2951
2951
  `;
2952
2952
  }
2953
2953
 
2954
- // src/utils/buildDirname.ts
2955
- function buildDirname(edge, moduleFormat) {
2956
- if (edge === true) {
2957
- return `config.dirname = '/'`;
2958
- }
2959
- if (moduleFormat === "esm") {
2960
- return `config.dirname = path.dirname(fileURLToPath(import.meta.url))`;
2961
- }
2962
- return `config.dirname = __dirname`;
2963
- }
2964
-
2965
2954
  // src/utils/buildDMMF.ts
2966
2955
  var import_client_common9 = require("@prisma/client-common");
2967
2956
 
@@ -3689,43 +3678,48 @@ function eventRegistrationMethodDeclaration(runtimeName) {
3689
3678
  return `$on<V extends U>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;`;
3690
3679
  }
3691
3680
  }
3681
+ function getPrismaClientClassDocComment({ dmmf }) {
3682
+ let example;
3683
+ if (dmmf.mappings.modelOperations.length) {
3684
+ example = dmmf.mappings.modelOperations[0];
3685
+ } else {
3686
+ example = {
3687
+ model: "User",
3688
+ plural: "users"
3689
+ };
3690
+ }
3691
+ return ts4.docComment`
3692
+ ## Prisma Client
3693
+
3694
+ Type-safe database client for TypeScript
3695
+ @example
3696
+ \`\`\`
3697
+ const prisma = new PrismaClient()
3698
+ // Fetch zero or more ${capitalize3(example.plural)}
3699
+ const ${(0, import_client_common11.lowerCase)(example.plural)} = await prisma.${(0, import_client_common11.lowerCase)(example.model)}.findMany()
3700
+ \`\`\`
3701
+
3702
+ Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
3703
+ `;
3704
+ }
3692
3705
  var PrismaClientClass = class {
3693
3706
  constructor(context, runtimeName) {
3694
3707
  this.context = context;
3695
3708
  this.runtimeName = runtimeName;
3696
3709
  }
3697
3710
  get jsDoc() {
3698
- const { dmmf } = this.context;
3699
- let example;
3700
- if (dmmf.mappings.modelOperations.length) {
3701
- example = dmmf.mappings.modelOperations[0];
3702
- } else {
3703
- example = {
3704
- model: "User",
3705
- plural: "users"
3706
- };
3707
- }
3708
- return `/**
3709
- * ## Prisma Client
3710
- *
3711
- * Type-safe database client for TypeScript
3712
- * @example
3713
- * \`\`\`
3714
- * const prisma = new PrismaClient()
3715
- * // Fetch zero or more ${capitalize3(example.plural)}
3716
- * const ${(0, import_client_common11.lowerCase)(example.plural)} = await prisma.${(0, import_client_common11.lowerCase)(example.model)}.findMany()
3717
- * \`\`\`
3718
- *
3719
- * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
3720
- */`;
3711
+ return ts4.stringify(getPrismaClientClassDocComment(this.context));
3721
3712
  }
3722
3713
  toTS() {
3723
3714
  const { dmmf } = this.context;
3724
- return `interface PrismaClientConstructor {
3715
+ return `export type LogOptions<ClientOptions extends Prisma.PrismaClientOptions> =
3716
+ 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never
3717
+
3718
+ export interface PrismaClientConstructor {
3725
3719
  ${(0, import_indent_string3.default)(this.jsDoc, TAB_SIZE)}
3726
3720
  new <
3727
3721
  ClientOptions extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,
3728
- U = 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never,
3722
+ U = LogOptions<ClientOptions>,
3729
3723
  ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs
3730
3724
  >(options?: Prisma.Subset<ClientOptions, Prisma.PrismaClientOptions>): PrismaClient<ClientOptions, U, ExtArgs>
3731
3725
  }
@@ -3733,7 +3727,7 @@ var PrismaClientClass = class {
3733
3727
  ${this.jsDoc}
3734
3728
  export interface PrismaClient<
3735
3729
  ClientOptions extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,
3736
- U = 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never,
3730
+ U = LogOptions<ClientOptions>,
3737
3731
  ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs
3738
3732
  > {
3739
3733
  [K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
@@ -3788,10 +3782,7 @@ get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
3788
3782
  }).join("\n\n"),
3789
3783
  2
3790
3784
  )}
3791
- }
3792
-
3793
- export const PrismaClient = runtime.getPrismaClient(config) as unknown as PrismaClientConstructor
3794
- `;
3785
+ }`;
3795
3786
  }
3796
3787
  applyPendingMigrationsDefinition() {
3797
3788
  if (this.runtimeName !== "react-native") {
@@ -3818,10 +3809,6 @@ function createClassFile(context, options) {
3818
3809
  ts5.moduleImport(context.runtimeImport).asNamespace("runtime"),
3819
3810
  ts5.moduleImport(context.importFileName(`./prismaNamespace`)).asNamespace("Prisma").typeOnly()
3820
3811
  ];
3821
- if (context.moduleFormat === "esm") {
3822
- imports.unshift(ts5.moduleImport("node:url").named("fileURLToPath"));
3823
- imports.unshift(ts5.moduleImport("node:path").asNamespace("path"));
3824
- }
3825
3812
  const stringifiedImports = imports.map((i) => ts5.stringify(i));
3826
3813
  const prismaClientClass = new PrismaClientClass(context, options.runtimeName);
3827
3814
  return `${jsDocHeader}
@@ -3830,6 +3817,11 @@ ${stringifiedImports.join("\n")}
3830
3817
  ${clientConfig(context, options)}
3831
3818
 
3832
3819
  ${prismaClientClass.toTS()}
3820
+
3821
+ export function getPrismaClientClass(dirname: string): PrismaClientConstructor {
3822
+ config.dirname = dirname
3823
+ return runtime.getPrismaClient(config) as unknown as PrismaClientConstructor
3824
+ }
3833
3825
  `;
3834
3826
  }
3835
3827
  function clientConfig(context, options) {
@@ -3870,7 +3862,6 @@ function clientConfig(context, options) {
3870
3862
  };
3871
3863
  return `
3872
3864
  const config: runtime.GetPrismaClientConfig = ${JSON.stringify(config, null, 2)}
3873
- ${buildDirname(edge, context.moduleFormat)}
3874
3865
  ${buildRuntimeDataModel(context.dmmf.datamodel, runtimeName)}
3875
3866
  ${buildGetWasmModule({ component: "engine", runtimeBase, runtimeName, target, activeProvider, moduleFormat })}
3876
3867
  ${buildGetWasmModule({ component: "compiler", runtimeBase, runtimeName, target, activeProvider, moduleFormat })}
@@ -3938,12 +3929,28 @@ function createClientFile(context, options) {
3938
3929
  const clientEngineType = (0, import_internals5.getClientEngineType)(options.generator);
3939
3930
  options.generator.config.engineType = clientEngineType;
3940
3931
  const imports = [
3941
- ts6.moduleImport(context.importFileName(`./enums`)).asNamespace("$Enums"),
3942
- ts6.moduleImport(context.importFileName(`./internal/prismaNamespace`)).asNamespace("Prisma")
3932
+ ts6.moduleImport(context.runtimeImport).asNamespace("runtime"),
3933
+ ts6.moduleImport(context.importFileName("./enums")).asNamespace("$Enums"),
3934
+ ts6.moduleImport(context.importFileName("./internal/class")).asNamespace("$Class"),
3935
+ ts6.moduleImport(context.importFileName("./internal/prismaNamespace")).asNamespace("Prisma")
3943
3936
  ].map((i) => ts6.stringify(i));
3944
3937
  const exports2 = [
3945
3938
  ts6.moduleExportFrom(context.importFileName("./enums")).asNamespace("$Enums"),
3946
- ts6.moduleExportFrom(context.importFileName("./internal/class")).named("PrismaClient")
3939
+ ts6.moduleExport(
3940
+ ts6.constDeclaration("PrismaClient").setValue(ts6.functionCall("$Class.getPrismaClientClass", [ts6.namedValue("__dirname")]))
3941
+ ).setDocComment(getPrismaClientClassDocComment(context)),
3942
+ ts6.moduleExport(
3943
+ ts6.typeDeclaration(
3944
+ "PrismaClient",
3945
+ ts6.namedType("$Class.PrismaClient").addGenericArgument(ts6.namedType("ClientOptions")).addGenericArgument(ts6.namedType("Log")).addGenericArgument(ts6.namedType("ExtArgs"))
3946
+ ).addGenericParameter(
3947
+ ts6.genericParameter("ClientOptions").extends(ts6.namedType("Prisma.PrismaClientOptions")).default(ts6.namedType("Prisma.PrismaClientOptions"))
3948
+ ).addGenericParameter(
3949
+ ts6.genericParameter("Log").default(ts6.namedType("$Class.LogOptions").addGenericArgument(ts6.namedType("ClientOptions")))
3950
+ ).addGenericParameter(
3951
+ ts6.genericParameter("ExtArgs").extends(ts6.namedType("runtime.Types.Extensions.InternalArgs")).default(ts6.namedType("runtime.Types.Extensions.DefaultArgs"))
3952
+ )
3953
+ )
3947
3954
  ].map((e) => ts6.stringify(e));
3948
3955
  const modelExports = Object.values(context.dmmf.typeAndModelMap).filter((model) => context.dmmf.outputTypeMap.model[model.name]).map((model) => {
3949
3956
  const docLines = model.documentation ?? "";
@@ -3983,7 +3990,8 @@ ${modelEnumsAliases.length > 0 ? `${modelEnumsAliases.join("\n\n")}` : ""}
3983
3990
  }
3984
3991
  function buildPreamble(edge, moduleFormat) {
3985
3992
  if (edge) {
3986
- return "";
3993
+ return `const __dirname = '/'
3994
+ `;
3987
3995
  }
3988
3996
  let preamble = `import * as process from 'node:process'
3989
3997
  import * as path from 'node:path'
@@ -5808,7 +5816,6 @@ var GenerateContext = class {
5808
5816
  runtimeImport;
5809
5817
  outputFileName;
5810
5818
  importFileName;
5811
- moduleFormat;
5812
5819
  generator;
5813
5820
  constructor({
5814
5821
  dmmf,
@@ -5816,7 +5823,6 @@ var GenerateContext = class {
5816
5823
  runtimeImport: runtimeImport2,
5817
5824
  outputFileName,
5818
5825
  importFileName,
5819
- moduleFormat,
5820
5826
  generator
5821
5827
  }) {
5822
5828
  this.dmmf = dmmf;
@@ -5824,7 +5830,6 @@ var GenerateContext = class {
5824
5830
  this.runtimeImport = runtimeImport2;
5825
5831
  this.outputFileName = outputFileName;
5826
5832
  this.importFileName = importFileName;
5827
- this.moduleFormat = moduleFormat;
5828
5833
  this.generator = generator;
5829
5834
  }
5830
5835
  isPreviewFeatureOn(previewFeature) {
@@ -5848,7 +5853,6 @@ var TSClient = class {
5848
5853
  runtimeImport: `${this.options.runtimeBase}/${this.options.runtimeName}`,
5849
5854
  outputFileName: generatedFileNameMapper(this.options.generatedFileExtension),
5850
5855
  importFileName: importFileNameMapper(this.options.importFileExtension),
5851
- moduleFormat: this.options.moduleFormat,
5852
5856
  generator: this.options.generator
5853
5857
  });
5854
5858
  const modelNames = Object.values(context.dmmf.typeAndModelMap).filter((model) => context.dmmf.outputTypeMap.model[model.name]).map((model) => model.name);
@@ -6437,7 +6441,7 @@ var import_get_tsconfig = require("get-tsconfig");
6437
6441
  var import_ts_pattern2 = require("ts-pattern");
6438
6442
 
6439
6443
  // package.json
6440
- var version = "6.7.0-dev.17";
6444
+ var version = "6.7.0-dev.19";
6441
6445
 
6442
6446
  // src/module-format.ts
6443
6447
  function parseModuleFormat(format) {
package/dist/index.mjs CHANGED
@@ -2947,17 +2947,6 @@ function buildDebugInitialization(edge) {
2947
2947
  `;
2948
2948
  }
2949
2949
 
2950
- // src/utils/buildDirname.ts
2951
- function buildDirname(edge, moduleFormat) {
2952
- if (edge === true) {
2953
- return `config.dirname = '/'`;
2954
- }
2955
- if (moduleFormat === "esm") {
2956
- return `config.dirname = path.dirname(fileURLToPath(import.meta.url))`;
2957
- }
2958
- return `config.dirname = __dirname`;
2959
- }
2960
-
2961
2950
  // src/utils/buildDMMF.ts
2962
2951
  import {
2963
2952
  dmmfToRuntimeDataModel,
@@ -3688,43 +3677,48 @@ function eventRegistrationMethodDeclaration(runtimeName) {
3688
3677
  return `$on<V extends U>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;`;
3689
3678
  }
3690
3679
  }
3680
+ function getPrismaClientClassDocComment({ dmmf }) {
3681
+ let example;
3682
+ if (dmmf.mappings.modelOperations.length) {
3683
+ example = dmmf.mappings.modelOperations[0];
3684
+ } else {
3685
+ example = {
3686
+ model: "User",
3687
+ plural: "users"
3688
+ };
3689
+ }
3690
+ return ts4.docComment`
3691
+ ## Prisma Client
3692
+
3693
+ Type-safe database client for TypeScript
3694
+ @example
3695
+ \`\`\`
3696
+ const prisma = new PrismaClient()
3697
+ // Fetch zero or more ${capitalize3(example.plural)}
3698
+ const ${lowerCase4(example.plural)} = await prisma.${lowerCase4(example.model)}.findMany()
3699
+ \`\`\`
3700
+
3701
+ Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
3702
+ `;
3703
+ }
3691
3704
  var PrismaClientClass = class {
3692
3705
  constructor(context, runtimeName) {
3693
3706
  this.context = context;
3694
3707
  this.runtimeName = runtimeName;
3695
3708
  }
3696
3709
  get jsDoc() {
3697
- const { dmmf } = this.context;
3698
- let example;
3699
- if (dmmf.mappings.modelOperations.length) {
3700
- example = dmmf.mappings.modelOperations[0];
3701
- } else {
3702
- example = {
3703
- model: "User",
3704
- plural: "users"
3705
- };
3706
- }
3707
- return `/**
3708
- * ## Prisma Client
3709
- *
3710
- * Type-safe database client for TypeScript
3711
- * @example
3712
- * \`\`\`
3713
- * const prisma = new PrismaClient()
3714
- * // Fetch zero or more ${capitalize3(example.plural)}
3715
- * const ${lowerCase4(example.plural)} = await prisma.${lowerCase4(example.model)}.findMany()
3716
- * \`\`\`
3717
- *
3718
- * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
3719
- */`;
3710
+ return ts4.stringify(getPrismaClientClassDocComment(this.context));
3720
3711
  }
3721
3712
  toTS() {
3722
3713
  const { dmmf } = this.context;
3723
- return `interface PrismaClientConstructor {
3714
+ return `export type LogOptions<ClientOptions extends Prisma.PrismaClientOptions> =
3715
+ 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never
3716
+
3717
+ export interface PrismaClientConstructor {
3724
3718
  ${indent3(this.jsDoc, TAB_SIZE)}
3725
3719
  new <
3726
3720
  ClientOptions extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,
3727
- U = 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never,
3721
+ U = LogOptions<ClientOptions>,
3728
3722
  ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs
3729
3723
  >(options?: Prisma.Subset<ClientOptions, Prisma.PrismaClientOptions>): PrismaClient<ClientOptions, U, ExtArgs>
3730
3724
  }
@@ -3732,7 +3726,7 @@ var PrismaClientClass = class {
3732
3726
  ${this.jsDoc}
3733
3727
  export interface PrismaClient<
3734
3728
  ClientOptions extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,
3735
- U = 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never,
3729
+ U = LogOptions<ClientOptions>,
3736
3730
  ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs
3737
3731
  > {
3738
3732
  [K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
@@ -3787,10 +3781,7 @@ get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
3787
3781
  }).join("\n\n"),
3788
3782
  2
3789
3783
  )}
3790
- }
3791
-
3792
- export const PrismaClient = runtime.getPrismaClient(config) as unknown as PrismaClientConstructor
3793
- `;
3784
+ }`;
3794
3785
  }
3795
3786
  applyPendingMigrationsDefinition() {
3796
3787
  if (this.runtimeName !== "react-native") {
@@ -3817,10 +3808,6 @@ function createClassFile(context, options) {
3817
3808
  ts5.moduleImport(context.runtimeImport).asNamespace("runtime"),
3818
3809
  ts5.moduleImport(context.importFileName(`./prismaNamespace`)).asNamespace("Prisma").typeOnly()
3819
3810
  ];
3820
- if (context.moduleFormat === "esm") {
3821
- imports.unshift(ts5.moduleImport("node:url").named("fileURLToPath"));
3822
- imports.unshift(ts5.moduleImport("node:path").asNamespace("path"));
3823
- }
3824
3811
  const stringifiedImports = imports.map((i) => ts5.stringify(i));
3825
3812
  const prismaClientClass = new PrismaClientClass(context, options.runtimeName);
3826
3813
  return `${jsDocHeader}
@@ -3829,6 +3816,11 @@ ${stringifiedImports.join("\n")}
3829
3816
  ${clientConfig(context, options)}
3830
3817
 
3831
3818
  ${prismaClientClass.toTS()}
3819
+
3820
+ export function getPrismaClientClass(dirname: string): PrismaClientConstructor {
3821
+ config.dirname = dirname
3822
+ return runtime.getPrismaClient(config) as unknown as PrismaClientConstructor
3823
+ }
3832
3824
  `;
3833
3825
  }
3834
3826
  function clientConfig(context, options) {
@@ -3869,7 +3861,6 @@ function clientConfig(context, options) {
3869
3861
  };
3870
3862
  return `
3871
3863
  const config: runtime.GetPrismaClientConfig = ${JSON.stringify(config, null, 2)}
3872
- ${buildDirname(edge, context.moduleFormat)}
3873
3864
  ${buildRuntimeDataModel(context.dmmf.datamodel, runtimeName)}
3874
3865
  ${buildGetWasmModule({ component: "engine", runtimeBase, runtimeName, target, activeProvider, moduleFormat })}
3875
3866
  ${buildGetWasmModule({ component: "compiler", runtimeBase, runtimeName, target, activeProvider, moduleFormat })}
@@ -3937,12 +3928,28 @@ function createClientFile(context, options) {
3937
3928
  const clientEngineType = getClientEngineType2(options.generator);
3938
3929
  options.generator.config.engineType = clientEngineType;
3939
3930
  const imports = [
3940
- ts6.moduleImport(context.importFileName(`./enums`)).asNamespace("$Enums"),
3941
- ts6.moduleImport(context.importFileName(`./internal/prismaNamespace`)).asNamespace("Prisma")
3931
+ ts6.moduleImport(context.runtimeImport).asNamespace("runtime"),
3932
+ ts6.moduleImport(context.importFileName("./enums")).asNamespace("$Enums"),
3933
+ ts6.moduleImport(context.importFileName("./internal/class")).asNamespace("$Class"),
3934
+ ts6.moduleImport(context.importFileName("./internal/prismaNamespace")).asNamespace("Prisma")
3942
3935
  ].map((i) => ts6.stringify(i));
3943
3936
  const exports = [
3944
3937
  ts6.moduleExportFrom(context.importFileName("./enums")).asNamespace("$Enums"),
3945
- ts6.moduleExportFrom(context.importFileName("./internal/class")).named("PrismaClient")
3938
+ ts6.moduleExport(
3939
+ ts6.constDeclaration("PrismaClient").setValue(ts6.functionCall("$Class.getPrismaClientClass", [ts6.namedValue("__dirname")]))
3940
+ ).setDocComment(getPrismaClientClassDocComment(context)),
3941
+ ts6.moduleExport(
3942
+ ts6.typeDeclaration(
3943
+ "PrismaClient",
3944
+ ts6.namedType("$Class.PrismaClient").addGenericArgument(ts6.namedType("ClientOptions")).addGenericArgument(ts6.namedType("Log")).addGenericArgument(ts6.namedType("ExtArgs"))
3945
+ ).addGenericParameter(
3946
+ ts6.genericParameter("ClientOptions").extends(ts6.namedType("Prisma.PrismaClientOptions")).default(ts6.namedType("Prisma.PrismaClientOptions"))
3947
+ ).addGenericParameter(
3948
+ ts6.genericParameter("Log").default(ts6.namedType("$Class.LogOptions").addGenericArgument(ts6.namedType("ClientOptions")))
3949
+ ).addGenericParameter(
3950
+ ts6.genericParameter("ExtArgs").extends(ts6.namedType("runtime.Types.Extensions.InternalArgs")).default(ts6.namedType("runtime.Types.Extensions.DefaultArgs"))
3951
+ )
3952
+ )
3946
3953
  ].map((e) => ts6.stringify(e));
3947
3954
  const modelExports = Object.values(context.dmmf.typeAndModelMap).filter((model) => context.dmmf.outputTypeMap.model[model.name]).map((model) => {
3948
3955
  const docLines = model.documentation ?? "";
@@ -3982,7 +3989,8 @@ ${modelEnumsAliases.length > 0 ? `${modelEnumsAliases.join("\n\n")}` : ""}
3982
3989
  }
3983
3990
  function buildPreamble(edge, moduleFormat) {
3984
3991
  if (edge) {
3985
- return "";
3992
+ return `const __dirname = '/'
3993
+ `;
3986
3994
  }
3987
3995
  let preamble = `import * as process from 'node:process'
3988
3996
  import * as path from 'node:path'
@@ -5807,7 +5815,6 @@ var GenerateContext = class {
5807
5815
  runtimeImport;
5808
5816
  outputFileName;
5809
5817
  importFileName;
5810
- moduleFormat;
5811
5818
  generator;
5812
5819
  constructor({
5813
5820
  dmmf,
@@ -5815,7 +5822,6 @@ var GenerateContext = class {
5815
5822
  runtimeImport: runtimeImport2,
5816
5823
  outputFileName,
5817
5824
  importFileName,
5818
- moduleFormat,
5819
5825
  generator
5820
5826
  }) {
5821
5827
  this.dmmf = dmmf;
@@ -5823,7 +5829,6 @@ var GenerateContext = class {
5823
5829
  this.runtimeImport = runtimeImport2;
5824
5830
  this.outputFileName = outputFileName;
5825
5831
  this.importFileName = importFileName;
5826
- this.moduleFormat = moduleFormat;
5827
5832
  this.generator = generator;
5828
5833
  }
5829
5834
  isPreviewFeatureOn(previewFeature) {
@@ -5847,7 +5852,6 @@ var TSClient = class {
5847
5852
  runtimeImport: `${this.options.runtimeBase}/${this.options.runtimeName}`,
5848
5853
  outputFileName: generatedFileNameMapper(this.options.generatedFileExtension),
5849
5854
  importFileName: importFileNameMapper(this.options.importFileExtension),
5850
- moduleFormat: this.options.moduleFormat,
5851
5855
  generator: this.options.generator
5852
5856
  });
5853
5857
  const modelNames = Object.values(context.dmmf.typeAndModelMap).filter((model) => context.dmmf.outputTypeMap.model[model.name]).map((model) => model.name);
@@ -6436,7 +6440,7 @@ import { getTsconfig } from "get-tsconfig";
6436
6440
  import { match as match2 } from "ts-pattern";
6437
6441
 
6438
6442
  // package.json
6439
- var version = "6.7.0-dev.17";
6443
+ var version = "6.7.0-dev.19";
6440
6444
 
6441
6445
  // src/module-format.ts
6442
6446
  function parseModuleFormat(format) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-generator-ts",
3
- "version": "6.7.0-dev.17",
3
+ "version": "6.7.0-dev.19",
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.7.0-dev.17",
38
- "@prisma/dmmf": "6.7.0-dev.17",
39
- "@prisma/fetch-engine": "6.7.0-dev.17",
40
- "@prisma/debug": "6.7.0-dev.17",
41
- "@prisma/generator": "6.7.0-dev.17",
42
- "@prisma/internals": "6.7.0-dev.17",
43
- "@prisma/ts-builders": "6.7.0-dev.17",
44
- "@prisma/get-platform": "6.7.0-dev.17"
37
+ "@prisma/debug": "6.7.0-dev.19",
38
+ "@prisma/client-common": "6.7.0-dev.19",
39
+ "@prisma/dmmf": "6.7.0-dev.19",
40
+ "@prisma/fetch-engine": "6.7.0-dev.19",
41
+ "@prisma/get-platform": "6.7.0-dev.19",
42
+ "@prisma/internals": "6.7.0-dev.19",
43
+ "@prisma/generator": "6.7.0-dev.19",
44
+ "@prisma/ts-builders": "6.7.0-dev.19"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/pluralize": "0.0.33",
@@ -1,5 +0,0 @@
1
- import { ModuleFormat } from '../module-format';
2
- /**
3
- * Builds a `dirname` variable that holds the location of the generated client.
4
- */
5
- export declare function buildDirname(edge: boolean, moduleFormat: ModuleFormat): "config.dirname = '/'" | "config.dirname = path.dirname(fileURLToPath(import.meta.url))" | "config.dirname = __dirname";