@@ -17,6 +17,7 @@ enum Inserts {
1717 CLASSES = '{{4}}' ,
1818 PROP_TYPE_MAPPING = '{{7}}' ,
1919 PROP_SUBJECT_TO_NAME_MAPPING = '{{8}}' ,
20+ TYPE_IMPORTS = '{{9}}' ,
2021}
2122
2223const TEMPLATE = `
@@ -25,7 +26,7 @@ const TEMPLATE = `
2526* For more info on how to use ontologies: https://github.com/atomicdata-dev/atomic-server/blob/develop/browser/cli/readme.md
2627* -------------------------------- */
2728
28- import type { OntologyBaseObject, BaseProps } from '${ Inserts . MODULE_ALIAS } '
29+ import type { ${ Inserts . TYPE_IMPORTS } } from '${ Inserts . MODULE_ALIAS } '
2930
3031${ Inserts . BASE_OBJECT }
3132
@@ -57,14 +58,21 @@ export const generateOntology = async (
5758
5859 const [ baseObjStr , reverseMapping ] = await generateBaseObject ( ontology ) ;
5960 const classesStr = generateClasses ( ontology , reverseMapping , propertyRecord ) ;
60- const propertiesStr = generatePropTypeMapping ( ontology , reverseMapping ) ;
61+ const [ propertiesStr , propertiesImports ] = generatePropTypeMapping (
62+ ontology ,
63+ reverseMapping ,
64+ ) ;
6165 const subToNameStr = generateSubjectToNameMapping ( ontology , reverseMapping ) ;
6266 const classExportsStr = generateClassExports ( ontology , reverseMapping ) ;
6367
6468 const content = TEMPLATE . replaceAll (
6569 Inserts . MODULE_ALIAS ,
6670 atomicConfig . moduleAlias ?? '@tomic/lib' ,
6771 )
72+ . replace (
73+ Inserts . TYPE_IMPORTS ,
74+ [ 'OntologyBaseObject' , 'BaseProps' , ...propertiesImports ] . join ( ', ' ) ,
75+ )
6876 . replace ( Inserts . BASE_OBJECT , baseObjStr )
6977 . replace ( Inserts . CLASS_EXPORTS , classExportsStr )
7078 . replace ( Inserts . CLASSES , classesStr )
0 commit comments