@@ -109,28 +109,36 @@ export class EnhancerGenerator {
109109
110110 const prismaImport = getPrismaClientImportSpec ( this . outDir , this . options ) ;
111111 let prismaTypesFixed = false ;
112- let resultPrismaTypeImport = prismaImport ;
112+ let resultPrismaBaseImport = prismaImport ;
113113
114114 if ( this . needsLogicalClient ) {
115115 prismaTypesFixed = true ;
116- resultPrismaTypeImport = LOGICAL_CLIENT_GENERATION_PATH ;
117- if ( this . isNewPrismaClientGenerator ) {
118- resultPrismaTypeImport += '/client' ;
119- }
116+ resultPrismaBaseImport = LOGICAL_CLIENT_GENERATION_PATH ;
120117 const result = await this . generateLogicalPrisma ( ) ;
121118 dmmf = result . dmmf ;
122119 }
123120
124- // reexport PrismaClient types (original or fixed)
125- const modelsTsContent = `export * from '${ resultPrismaTypeImport } ';${
126- this . isNewPrismaClientGenerator ? "\nexport * from './json-types';" : ''
127- } `;
121+ const modelsTsContent = this . isNewPrismaClientGenerator
122+ ? `export * from '${ resultPrismaBaseImport } /models';\nexport * from './json-types';`
123+ : `export * from '${ resultPrismaBaseImport } ';` ;
128124
129125 const modelsTs = this . project . createSourceFile ( path . join ( this . outDir , 'models.ts' ) , modelsTsContent , {
130126 overwrite : true ,
131127 } ) ;
132128 this . saveSourceFile ( modelsTs ) ;
133129
130+ if ( this . isNewPrismaClientGenerator ) {
131+ const enumsTs = this . project . createSourceFile ( path . join ( this . outDir , 'enums.ts' ) , `export * from '${ resultPrismaBaseImport } /enums';` , {
132+ overwrite : true ,
133+ } ) ;
134+ this . saveSourceFile ( enumsTs ) ;
135+
136+ const clientTs = this . project . createSourceFile ( path . join ( this . outDir , 'client.ts' ) , `export * from '${ resultPrismaBaseImport } /client';` , {
137+ overwrite : true ,
138+ } ) ;
139+ this . saveSourceFile ( clientTs ) ;
140+ }
141+
134142 const authDecl = getAuthDecl ( getDataModelAndTypeDefs ( this . model ) ) ;
135143 const authTypes = authDecl ? generateAuthType ( this . model , authDecl ) : '' ;
136144 const authTypeParam = authDecl ? `auth.${ authDecl . name } ` : 'AuthUser' ;
0 commit comments