@@ -67,9 +67,10 @@ function extractSchemaProperties(schema) {
6767 * @param  mixinTypeName - Name of the mixin type 
6868 * @param  entityTypeName - Name of the entity type 
6969 * @param  skipFields - Array of field names to skip 
70+  * @param  from - Import path for the schema type (default: "@mat3ra/esse/dist/js/types") 
7071 * @returns  - Generated TypeScript code 
7172 */ 
72- function  generateMixinFunction ( schema ,  schemaName ,  mixinTypeName ,  entityTypeName ,  skipFields  =  [ ] )  { 
73+ function  generateMixinFunction ( schema ,  schemaName ,  mixinTypeName ,  entityTypeName ,  skipFields  =  [ ] ,   from   =   "@mat3ra/esse/dist/js/types" )  { 
7374    // Convert mixin type name to camelCase for function name 
7475    const  functionName  =  mixinTypeName . charAt ( 0 ) . toLowerCase ( )  +  mixinTypeName . slice ( 1 ) ; 
7576    // Extract properties, handling allOf if present 
@@ -80,7 +81,7 @@ function generateMixinFunction(schema, schemaName, mixinTypeName, entityTypeName
8081    // Filter out skip fields 
8182    const  propertyEntries  =  Object . entries ( properties ) . filter ( ( [ propertyName ] )  =>  ! skipFields . includes ( propertyName ) ) ; 
8283    let  code  =  `import type { InMemoryEntity } from "@mat3ra/code/dist/js/entity";\n` ; 
83-     code  +=  `import type { ${ schemaName }   } from "@mat3ra/esse/dist/js/types ";\n\n` ; 
84+     code  +=  `import type { ${ schemaName }   } from "${ from }  ";\n\n` ; 
8485    // Generate the mixin type using Omit utility 
8586    const  skipFieldNames  =  skipFields . map ( ( field )  =>  `"${ field }  "` ) . join ( " | " ) ; 
8687    code  +=  `export type ${ mixinTypeName }   = Omit<${ schemaName }  , ${ skipFieldNames }  >;\n\n` ; 
@@ -115,9 +116,10 @@ function generateMixinFunction(schema, schemaName, mixinTypeName, entityTypeName
115116 * @param  schemaId - The schema ID (e.g., "property/holder") 
116117 * @param  outputPath - The output file path 
117118 * @param  skipFields - Array of field names to skip 
119+  * @param  from - Import path for the schema type (default: "@mat3ra/esse/dist/js/types") 
118120 * @returns  - Generated TypeScript code 
119121 */ 
120- function  generateMixinFromSchemaId ( schemaId ,  outputPath ,  skipFields  =  [ ] )  { 
122+ function  generateMixinFromSchemaId ( schemaId ,  outputPath ,  skipFields  =  [ ] ,   from   =   "@mat3ra/esse/dist/js/types" )  { 
121123    var  _a ,  _b ; 
122124    // Get the resolved schema by ID 
123125    const  schema  =  JSONSchemasInterface_1 . default . getSchemaById ( schemaId ) ; 
@@ -149,7 +151,7 @@ function generateMixinFromSchemaId(schemaId, outputPath, skipFields = []) {
149151    const  mixinTypeName  =  fileName ; 
150152    const  entityTypeName  =  fileName . replace ( "SchemaMixin" ,  "InMemoryEntity" ) ; 
151153    // Generate the complete mixin function 
152-     return  generateMixinFunction ( schema ,  schemaName ,  mixinTypeName ,  entityTypeName ,  skipFields ) ; 
154+     return  generateMixinFunction ( schema ,  schemaName ,  mixinTypeName ,  entityTypeName ,  skipFields ,   from ) ; 
153155} 
154156/** 
155157 * Runs ESLint autofix on generated files 
@@ -174,9 +176,10 @@ function runESLintAutofix(filePaths) {
174176 * @param  schemas - Array of JSON schemas to use for generation 
175177 * @param  outputPaths - Object mapping schema IDs to output file paths 
176178 * @param  skipFields - Array of field names to skip during generation 
179+  * @param  from - Import path for the schema type (default: "@mat3ra/esse/dist/js/types") 
177180 * @returns  - Object with success and error counts 
178181 */ 
179- function  generateShemaMixin ( schemas ,  outputPaths ,  skipFields  =  [ ] )  { 
182+ function  generateShemaMixin ( schemas ,  outputPaths ,  skipFields  =  [ ] ,   from   =   "@mat3ra/esse/dist/js/types" )  { 
180183    // Setup schemas 
181184    JSONSchemasInterface_1 . default . setSchemas ( schemas ) ; 
182185    console . log ( "Generating mixin properties for all schemas..." ) ; 
@@ -191,7 +194,7 @@ function generateShemaMixin(schemas, outputPaths, skipFields = []) {
191194            if  ( ! outputPath )  { 
192195                throw  new  Error ( `No output path defined for schema: ${ schemaId }  ` ) ; 
193196            } 
194-             const  generatedCode  =  generateMixinFromSchemaId ( schemaId ,  outputPath ,  skipFields ) ; 
197+             const  generatedCode  =  generateMixinFromSchemaId ( schemaId ,  outputPath ,  skipFields ,   from ) ; 
195198            // Ensure the directory exists 
196199            const  dir  =  outputPath . substring ( 0 ,  outputPath . lastIndexOf ( "/" ) ) ; 
197200            if  ( ! fs_1 . default . existsSync ( dir ) )  { 
0 commit comments