@@ -17,6 +17,7 @@ enum Inserts {
17
17
CLASSES = '{{4}}' ,
18
18
PROP_TYPE_MAPPING = '{{7}}' ,
19
19
PROP_SUBJECT_TO_NAME_MAPPING = '{{8}}' ,
20
+ TYPE_IMPORTS = '{{9}}' ,
20
21
}
21
22
22
23
const TEMPLATE = `
@@ -25,7 +26,7 @@ const TEMPLATE = `
25
26
* For more info on how to use ontologies: https://github.com/atomicdata-dev/atomic-server/blob/develop/browser/cli/readme.md
26
27
* -------------------------------- */
27
28
28
- import type { OntologyBaseObject, BaseProps } from '${ Inserts . MODULE_ALIAS } '
29
+ import type { ${ Inserts . TYPE_IMPORTS } } from '${ Inserts . MODULE_ALIAS } '
29
30
30
31
${ Inserts . BASE_OBJECT }
31
32
@@ -57,14 +58,21 @@ export const generateOntology = async (
57
58
58
59
const [ baseObjStr , reverseMapping ] = await generateBaseObject ( ontology ) ;
59
60
const classesStr = generateClasses ( ontology , reverseMapping , propertyRecord ) ;
60
- const propertiesStr = generatePropTypeMapping ( ontology , reverseMapping ) ;
61
+ const [ propertiesStr , propertiesImports ] = generatePropTypeMapping (
62
+ ontology ,
63
+ reverseMapping ,
64
+ ) ;
61
65
const subToNameStr = generateSubjectToNameMapping ( ontology , reverseMapping ) ;
62
66
const classExportsStr = generateClassExports ( ontology , reverseMapping ) ;
63
67
64
68
const content = TEMPLATE . replaceAll (
65
69
Inserts . MODULE_ALIAS ,
66
70
atomicConfig . moduleAlias ?? '@tomic/lib' ,
67
71
)
72
+ . replace (
73
+ Inserts . TYPE_IMPORTS ,
74
+ [ 'OntologyBaseObject' , 'BaseProps' , ...propertiesImports ] . join ( ', ' ) ,
75
+ )
68
76
. replace ( Inserts . BASE_OBJECT , baseObjStr )
69
77
. replace ( Inserts . CLASS_EXPORTS , classExportsStr )
70
78
. replace ( Inserts . CLASSES , classesStr )
0 commit comments