@@ -122,7 +122,7 @@ export class EnhancerGenerator {
122122
123123 // reexport PrismaClient types (original or fixed)
124124 const modelsTsContent = `export * from '${ resultPrismaTypeImport } ';${
125- this . isNewPrismaClientGenerator ? "\nexport * from './json-fields ';" : ''
125+ this . isNewPrismaClientGenerator ? "\nexport * from './json-types ';" : ''
126126 } `;
127127
128128 const modelsTs = this . project . createSourceFile ( path . join ( this . outDir , 'models.ts' ) , modelsTsContent , {
@@ -243,7 +243,7 @@ export function enhance<DbClient extends object>(prisma: DbClient, context?: Enh
243243 private createLogicalPrismaImports ( prismaImport : string , prismaClientImport : string , target : string ) {
244244 const prismaTargetImport = target === 'edge' ? `${ prismaImport } /edge` : prismaImport ;
245245 return `import { Prisma as _Prisma, PrismaClient as _PrismaClient } from '${ prismaTargetImport } ';
246- import type { InternalArgs, DynamicClientExtensionThis } from '${ prismaImport } /runtime/library';
246+ import type { InternalArgs, DynamicClientExtensionThis } from '@prisma/client /runtime/library';
247247import type * as _P from '${ prismaClientImport } ';
248248import type { Prisma, PrismaClient } from '${ prismaClientImport } ';
249249export type { PrismaClient };
@@ -493,12 +493,12 @@ export type Enhanced<Client> =
493493 const project = new Project ( ) ;
494494
495495 // Create a shared file for all JSON fields type definitions
496- const jsonFieldsFile = project . createSourceFile ( path . join ( this . outDir , 'json-fields .ts' ) , undefined , {
496+ const jsonFieldsFile = project . createSourceFile ( path . join ( this . outDir , 'json-types .ts' ) , undefined , {
497497 overwrite : true ,
498498 } ) ;
499499
500- await this . generateExtraTypes ( jsonFieldsFile ) ;
501- await jsonFieldsFile . save ( ) ;
500+ this . generateExtraTypes ( jsonFieldsFile ) ;
501+ await saveSourceFile ( jsonFieldsFile ) ;
502502
503503 for ( const d of this . model . declarations . filter ( isDataModel ) ) {
504504 const fileName = `${ prismaClientDir } /models/${ d . name } .ts` ;
@@ -514,7 +514,7 @@ export type Enhanced<Client> =
514514
515515 sfNew . addStatements ( 'import $Types = runtime.Types;' ) ;
516516
517- // Add import for json-fields if this model has JSON type fields
517+ // Add import for json-types if this model has JSON type fields
518518 const modelWithJsonFields = this . modelsWithJsonTypeFields . find ( ( m ) => m . name === d . name ) ;
519519 if ( modelWithJsonFields ) {
520520 // Get the specific types that are used in this model
@@ -525,7 +525,7 @@ export type Enhanced<Client> =
525525 const typeNames = [ ...new Set ( jsonFieldTypes . map ( ( field ) => field . type . reference ! . $refText ) ) ] ;
526526
527527 if ( typeNames . length > 0 ) {
528- sfNew . addStatements ( `import type { ${ typeNames . join ( ', ' ) } } from "../../json-fields ";` ) ;
528+ sfNew . addStatements ( `import type { ${ typeNames . join ( ', ' ) } } from "../../json-types ";` ) ;
529529 }
530530 }
531531
@@ -940,7 +940,7 @@ export type Enhanced<Client> =
940940 return source ;
941941 }
942942
943- private async generateExtraTypes ( sf : SourceFile ) {
943+ private generateExtraTypes ( sf : SourceFile ) {
944944 for ( const decl of this . model . declarations ) {
945945 if ( isTypeDef ( decl ) ) {
946946 generateTypeDefType ( sf , decl ) ;
0 commit comments