@ifc-lite/codegen 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INTEGRATION.md +354 -0
- package/LICENSE +373 -0
- package/README.md +101 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +35 -0
- package/dist/cli.js.map +1 -0
- package/dist/express-parser.d.ts +75 -0
- package/dist/express-parser.d.ts.map +1 -0
- package/dist/express-parser.js +318 -0
- package/dist/express-parser.js.map +1 -0
- package/dist/generator.d.ts +10 -0
- package/dist/generator.d.ts.map +1 -0
- package/dist/generator.js +64 -0
- package/dist/generator.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/typescript-generator.d.ts +28 -0
- package/dist/typescript-generator.d.ts.map +1 -0
- package/dist/typescript-generator.js +400 -0
- package/dist/typescript-generator.js.map +1 -0
- package/generated/ifc4/entities.ts +6978 -0
- package/generated/ifc4/enums.ts +2471 -0
- package/generated/ifc4/index.ts +15 -0
- package/generated/ifc4/schema-registry.ts +60726 -0
- package/generated/ifc4/selects.ts +191 -0
- package/generated/ifc4/test-compile.ts +37 -0
- package/generated/ifc4/types.ts +3104 -0
- package/generated/ifc4x3/entities.ts +7836 -0
- package/generated/ifc4x3/enums.ts +3100 -0
- package/generated/ifc4x3/index.ts +15 -0
- package/generated/ifc4x3/schema-registry.ts +71023 -0
- package/generated/ifc4x3/selects.ts +194 -0
- package/generated/ifc4x3/types.ts +3707 -0
- package/package.json +32 -0
- package/schemas/IFC4X3.exp +13984 -0
- package/schemas/IFC4_ADD2_TC1.exp +12399 -0
- package/src/cli.ts +41 -0
- package/src/express-parser.ts +441 -0
- package/src/generator.ts +81 -0
- package/src/index.ts +31 -0
- package/src/typescript-generator.ts +496 -0
- package/test/express-parser.test.ts +363 -0
- package/test/integration.test.ts +246 -0
- package/test/typescript-generator.test.ts +348 -0
- package/tsconfig.json +20 -0
- package/vitest.config.ts +18 -0
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* Parse an EXPRESS schema file
|
|
6
|
+
*/
|
|
7
|
+
export function parseExpressSchema(content) {
|
|
8
|
+
// Remove comments
|
|
9
|
+
content = removeComments(content);
|
|
10
|
+
// Extract schema name
|
|
11
|
+
const schemaMatch = content.match(/SCHEMA\s+(\w+)\s*;/);
|
|
12
|
+
const schemaName = schemaMatch ? schemaMatch[1] : 'UNKNOWN';
|
|
13
|
+
// Parse different constructs
|
|
14
|
+
const entities = parseEntities(content);
|
|
15
|
+
const types = parseTypes(content);
|
|
16
|
+
const enums = parseEnums(content);
|
|
17
|
+
const selects = parseSelects(content);
|
|
18
|
+
return {
|
|
19
|
+
name: schemaName,
|
|
20
|
+
entities,
|
|
21
|
+
types,
|
|
22
|
+
enums,
|
|
23
|
+
selects,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Remove (* ... *) comments from EXPRESS
|
|
28
|
+
*/
|
|
29
|
+
function removeComments(content) {
|
|
30
|
+
// Remove multi-line comments (* ... *)
|
|
31
|
+
return content.replace(/\(\*[\s\S]*?\*\)/g, '');
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Parse ENTITY definitions
|
|
35
|
+
*/
|
|
36
|
+
function parseEntities(content) {
|
|
37
|
+
const entities = [];
|
|
38
|
+
// Match ENTITY ... END_ENTITY blocks
|
|
39
|
+
const entityRegex = /ENTITY\s+(\w+)([\s\S]*?)END_ENTITY\s*;/g;
|
|
40
|
+
let match;
|
|
41
|
+
while ((match = entityRegex.exec(content)) !== null) {
|
|
42
|
+
const entityName = match[1];
|
|
43
|
+
const entityBody = match[2];
|
|
44
|
+
entities.push(parseEntity(entityName, entityBody));
|
|
45
|
+
}
|
|
46
|
+
return entities;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Parse a single ENTITY definition
|
|
50
|
+
*/
|
|
51
|
+
function parseEntity(name, body) {
|
|
52
|
+
const entity = {
|
|
53
|
+
name,
|
|
54
|
+
isAbstract: false,
|
|
55
|
+
attributes: [],
|
|
56
|
+
};
|
|
57
|
+
// Check if abstract
|
|
58
|
+
if (body.includes('ABSTRACT')) {
|
|
59
|
+
entity.isAbstract = true;
|
|
60
|
+
}
|
|
61
|
+
// Parse SUBTYPE OF
|
|
62
|
+
const subtypeMatch = body.match(/SUBTYPE\s+OF\s+\((\w+)\)/);
|
|
63
|
+
if (subtypeMatch) {
|
|
64
|
+
entity.supertype = subtypeMatch[1];
|
|
65
|
+
}
|
|
66
|
+
// Parse SUPERTYPE OF (list of subtypes)
|
|
67
|
+
const supertypeMatch = body.match(/SUPERTYPE\s+OF\s+\(ONEOF\s*\(([\s\S]*?)\)\)/);
|
|
68
|
+
if (supertypeMatch) {
|
|
69
|
+
entity.supertypeOf = supertypeMatch[1]
|
|
70
|
+
.split(',')
|
|
71
|
+
.map(s => s.trim())
|
|
72
|
+
.filter(s => s.length > 0);
|
|
73
|
+
}
|
|
74
|
+
// Extract just the attributes section (before WHERE, DERIVE, INVERSE, UNIQUE)
|
|
75
|
+
let attributesSection = body;
|
|
76
|
+
// Find where attributes section ends
|
|
77
|
+
const sectionMatches = [
|
|
78
|
+
body.match(/\bWHERE\b/),
|
|
79
|
+
body.match(/\bDERIVE\b/),
|
|
80
|
+
body.match(/\bINVERSE\b/),
|
|
81
|
+
body.match(/\bUNIQUE\b/),
|
|
82
|
+
].filter(m => m !== null);
|
|
83
|
+
if (sectionMatches.length > 0) {
|
|
84
|
+
// Find the earliest match
|
|
85
|
+
const earliestIndex = Math.min(...sectionMatches.map(m => m.index));
|
|
86
|
+
attributesSection = body.substring(0, earliestIndex);
|
|
87
|
+
}
|
|
88
|
+
// Parse attributes (lines with : between name and type)
|
|
89
|
+
// Format: AttributeName : [OPTIONAL] Type;
|
|
90
|
+
const attributeRegex = /^\s*(\w+)\s*:\s*(OPTIONAL\s+)?([\s\S]*?);/gm;
|
|
91
|
+
let attrMatch;
|
|
92
|
+
while ((attrMatch = attributeRegex.exec(attributesSection)) !== null) {
|
|
93
|
+
const attrName = attrMatch[1];
|
|
94
|
+
const optional = !!attrMatch[2];
|
|
95
|
+
const typeStr = attrMatch[3].trim();
|
|
96
|
+
entity.attributes.push(parseAttribute(attrName, typeStr, optional));
|
|
97
|
+
}
|
|
98
|
+
// Parse WHERE rules
|
|
99
|
+
const whereMatch = body.match(/WHERE([\s\S]*?)(?:UNIQUE|DERIVE|INVERSE|END_ENTITY|$)/);
|
|
100
|
+
if (whereMatch) {
|
|
101
|
+
entity.whereRules = whereMatch[1]
|
|
102
|
+
.split(';')
|
|
103
|
+
.map(s => s.trim())
|
|
104
|
+
.filter(s => s.length > 0);
|
|
105
|
+
}
|
|
106
|
+
// Parse UNIQUE rules
|
|
107
|
+
const uniqueMatch = body.match(/UNIQUE([\s\S]*?)(?:WHERE|DERIVE|INVERSE|END_ENTITY|$)/);
|
|
108
|
+
if (uniqueMatch) {
|
|
109
|
+
entity.uniqueRules = uniqueMatch[1]
|
|
110
|
+
.split(';')
|
|
111
|
+
.map(s => s.trim())
|
|
112
|
+
.filter(s => s.length > 0);
|
|
113
|
+
}
|
|
114
|
+
return entity;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Parse an attribute definition
|
|
118
|
+
*/
|
|
119
|
+
function parseAttribute(name, typeStr, optional) {
|
|
120
|
+
const attr = {
|
|
121
|
+
name,
|
|
122
|
+
type: '',
|
|
123
|
+
optional,
|
|
124
|
+
isArray: false,
|
|
125
|
+
isList: false,
|
|
126
|
+
isSet: false,
|
|
127
|
+
};
|
|
128
|
+
// Check for aggregation types: LIST, ARRAY, SET
|
|
129
|
+
// Match patterns like: LIST [1:?] OF Type, ARRAY [1:3] OF REAL, SET [0:?] OF Label
|
|
130
|
+
// Also handle nested collections: LIST [2:?] OF LIST [2:?] OF IfcCartesianPoint
|
|
131
|
+
if (typeStr.includes('LIST')) {
|
|
132
|
+
attr.isList = true;
|
|
133
|
+
const listMatch = typeStr.match(/LIST\s+\[(\d+|\?):(\d+|\?)\]\s+OF\s+(.*)/);
|
|
134
|
+
if (listMatch) {
|
|
135
|
+
attr.arrayBounds = [
|
|
136
|
+
listMatch[1] === '?' ? Infinity : parseInt(listMatch[1]),
|
|
137
|
+
listMatch[2] === '?' ? Infinity : parseInt(listMatch[2])
|
|
138
|
+
];
|
|
139
|
+
const innerType = listMatch[3].trim();
|
|
140
|
+
// Recursively parse nested collection
|
|
141
|
+
attr.type = parseNestedCollection(innerType);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
// Fallback if regex doesn't match
|
|
145
|
+
attr.type = typeStr.replace(/LIST\s+\[.*?\]\s+OF\s+/, '').trim();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else if (typeStr.includes('ARRAY')) {
|
|
149
|
+
attr.isArray = true;
|
|
150
|
+
const arrayMatch = typeStr.match(/ARRAY\s+\[(\d+|\?):(\d+|\?)\]\s+OF\s+(.*)/);
|
|
151
|
+
if (arrayMatch) {
|
|
152
|
+
attr.arrayBounds = [
|
|
153
|
+
arrayMatch[1] === '?' ? Infinity : parseInt(arrayMatch[1]),
|
|
154
|
+
arrayMatch[2] === '?' ? Infinity : parseInt(arrayMatch[2])
|
|
155
|
+
];
|
|
156
|
+
const innerType = arrayMatch[3].trim();
|
|
157
|
+
// Recursively parse nested collection
|
|
158
|
+
attr.type = parseNestedCollection(innerType);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
// Fallback if regex doesn't match
|
|
162
|
+
attr.type = typeStr.replace(/ARRAY\s+\[.*?\]\s+OF\s+/, '').trim();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
else if (typeStr.includes('SET')) {
|
|
166
|
+
attr.isSet = true;
|
|
167
|
+
const setMatch = typeStr.match(/SET\s+\[(\d+|\?):(\d+|\?)\]\s+OF\s+(.*)/);
|
|
168
|
+
if (setMatch) {
|
|
169
|
+
attr.arrayBounds = [
|
|
170
|
+
setMatch[1] === '?' ? Infinity : parseInt(setMatch[1]),
|
|
171
|
+
setMatch[2] === '?' ? Infinity : parseInt(setMatch[2])
|
|
172
|
+
];
|
|
173
|
+
const innerType = setMatch[3].trim();
|
|
174
|
+
// Recursively parse nested collection
|
|
175
|
+
attr.type = parseNestedCollection(innerType);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
// Fallback if regex doesn't match
|
|
179
|
+
attr.type = typeStr.replace(/SET\s+\[.*?\]\s+OF\s+/, '').trim();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
attr.type = typeStr;
|
|
184
|
+
}
|
|
185
|
+
return attr;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Parse nested collection types
|
|
189
|
+
* e.g., "LIST [2:?] OF IfcCartesianPoint" -> "IfcCartesianPoint[]"
|
|
190
|
+
*/
|
|
191
|
+
function parseNestedCollection(typeStr) {
|
|
192
|
+
// Check if this is another collection
|
|
193
|
+
if (typeStr.match(/^(LIST|ARRAY|SET)\s+\[/)) {
|
|
194
|
+
// Match: LIST|ARRAY|SET [min:max] OF <innerType>
|
|
195
|
+
const match = typeStr.match(/^(?:LIST|ARRAY|SET)\s+\[(?:\d+|\?):(?:\d+|\?)\]\s+OF\s+(.*)/);
|
|
196
|
+
if (match) {
|
|
197
|
+
const innerType = match[1].trim();
|
|
198
|
+
// Recursively parse and wrap in array
|
|
199
|
+
return `${parseNestedCollection(innerType)}[]`;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// Base case: return the type as-is
|
|
203
|
+
return typeStr;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Parse TYPE definitions (non-enum, non-select)
|
|
207
|
+
*/
|
|
208
|
+
function parseTypes(content) {
|
|
209
|
+
const types = [];
|
|
210
|
+
// Match TYPE ... END_TYPE blocks (exclude ENUMERATION and SELECT)
|
|
211
|
+
const typeRegex = /TYPE\s+(\w+)\s*=\s*(?!ENUMERATION|SELECT)([\s\S]*?)END_TYPE\s*;/g;
|
|
212
|
+
let match;
|
|
213
|
+
while ((match = typeRegex.exec(content)) !== null) {
|
|
214
|
+
const typeName = match[1];
|
|
215
|
+
const typeBody = match[2].trim();
|
|
216
|
+
// Extract underlying type (first word before semicolon or WHERE)
|
|
217
|
+
const underlyingMatch = typeBody.match(/^([^;]*?)(?:;|WHERE|$)/);
|
|
218
|
+
const underlyingType = underlyingMatch ? underlyingMatch[1].trim() : 'STRING';
|
|
219
|
+
// Parse WHERE rules if present
|
|
220
|
+
const whereMatch = typeBody.match(/WHERE([\s\S]*?)$/);
|
|
221
|
+
const whereRules = whereMatch
|
|
222
|
+
? whereMatch[1]
|
|
223
|
+
.split(';')
|
|
224
|
+
.map(s => s.trim())
|
|
225
|
+
.filter(s => s.length > 0)
|
|
226
|
+
: undefined;
|
|
227
|
+
types.push({
|
|
228
|
+
name: typeName,
|
|
229
|
+
underlyingType,
|
|
230
|
+
whereRules,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
return types;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Parse ENUMERATION types
|
|
237
|
+
*/
|
|
238
|
+
function parseEnums(content) {
|
|
239
|
+
const enums = [];
|
|
240
|
+
// Match TYPE ... = ENUMERATION OF (...) blocks
|
|
241
|
+
const enumRegex = /TYPE\s+(\w+)\s*=\s*ENUMERATION\s+OF\s*\(([\s\S]*?)\)\s*;[\s\S]*?END_TYPE\s*;/g;
|
|
242
|
+
let match;
|
|
243
|
+
while ((match = enumRegex.exec(content)) !== null) {
|
|
244
|
+
const enumName = match[1];
|
|
245
|
+
const valuesStr = match[2];
|
|
246
|
+
// Parse enum values (comma-separated, may have line breaks)
|
|
247
|
+
const values = valuesStr
|
|
248
|
+
.split(',')
|
|
249
|
+
.map(s => s.trim())
|
|
250
|
+
.filter(s => s.length > 0);
|
|
251
|
+
enums.push({
|
|
252
|
+
name: enumName,
|
|
253
|
+
values,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
return enums;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Parse SELECT types (union types)
|
|
260
|
+
*/
|
|
261
|
+
function parseSelects(content) {
|
|
262
|
+
const selects = [];
|
|
263
|
+
// Match TYPE ... = SELECT (...) blocks
|
|
264
|
+
const selectRegex = /TYPE\s+(\w+)\s*=\s*SELECT\s*\(([\s\S]*?)\)\s*;[\s\S]*?END_TYPE\s*;/g;
|
|
265
|
+
let match;
|
|
266
|
+
while ((match = selectRegex.exec(content)) !== null) {
|
|
267
|
+
const selectName = match[1];
|
|
268
|
+
const typesStr = match[2];
|
|
269
|
+
// Parse select types (comma-separated, may have line breaks)
|
|
270
|
+
const types = typesStr
|
|
271
|
+
.split(',')
|
|
272
|
+
.map(s => s.trim())
|
|
273
|
+
.filter(s => s.length > 0);
|
|
274
|
+
selects.push({
|
|
275
|
+
name: selectName,
|
|
276
|
+
types,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
return selects;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Get all attributes for an entity including inherited attributes
|
|
283
|
+
*/
|
|
284
|
+
export function getAllAttributes(entity, schema) {
|
|
285
|
+
const attributes = [];
|
|
286
|
+
// Walk up the inheritance chain
|
|
287
|
+
let current = entity;
|
|
288
|
+
while (current) {
|
|
289
|
+
// Add attributes from this level
|
|
290
|
+
attributes.push(...current.attributes);
|
|
291
|
+
// Move to parent
|
|
292
|
+
if (current.supertype) {
|
|
293
|
+
current = schema.entities.find(e => e.name === current.supertype);
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
current = undefined;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return attributes;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Get inheritance chain for an entity (from root to entity)
|
|
303
|
+
*/
|
|
304
|
+
export function getInheritanceChain(entity, schema) {
|
|
305
|
+
const chain = [];
|
|
306
|
+
let current = entity;
|
|
307
|
+
while (current) {
|
|
308
|
+
chain.unshift(current.name); // Add to front
|
|
309
|
+
if (current.supertype) {
|
|
310
|
+
current = schema.entities.find(e => e.name === current.supertype);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
current = undefined;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return chain;
|
|
317
|
+
}
|
|
318
|
+
//# sourceMappingURL=express-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express-parser.js","sourceRoot":"","sources":["../src/express-parser.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAyE/D;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,kBAAkB;IAClB,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAElC,sBAAsB;IACtB,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxD,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE5D,6BAA6B;IAC7B,MAAM,QAAQ,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAEtC,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,QAAQ;QACR,KAAK;QACL,KAAK;QACL,OAAO;KACR,CAAC;AACJ,CAAC;AAED;;GAEG;AAC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I,OAAO,GAAiC,MAAM,CAAC;IACnD,OAAO,OAAO,EAAE,CAAC;QACf,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAE,eAAe;QAE7C,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAQ,CAAC,SAAS,CAAC,CAAC;QACrE,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,SAAS,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type GeneratedCode } from './typescript-generator.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generate TypeScript code from an EXPRESS schema file
|
|
4
|
+
*/
|
|
5
|
+
export declare function generateFromFile(schemaPath: string, outputDir: string): GeneratedCode;
|
|
6
|
+
/**
|
|
7
|
+
* Generate TypeScript code from EXPRESS schema content
|
|
8
|
+
*/
|
|
9
|
+
export declare function generateFromSchema(schemaContent: string, outputDir: string): GeneratedCode;
|
|
10
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAWA,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAEnF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,CAMrF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,CAqD1F"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* High-level generator functions
|
|
6
|
+
*/
|
|
7
|
+
import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
8
|
+
import { parseExpressSchema } from './express-parser.js';
|
|
9
|
+
import { generateTypeScript } from './typescript-generator.js';
|
|
10
|
+
/**
|
|
11
|
+
* Generate TypeScript code from an EXPRESS schema file
|
|
12
|
+
*/
|
|
13
|
+
export function generateFromFile(schemaPath, outputDir) {
|
|
14
|
+
// Read schema file
|
|
15
|
+
const content = readFileSync(schemaPath, 'utf-8');
|
|
16
|
+
// Generate code
|
|
17
|
+
return generateFromSchema(content, outputDir);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Generate TypeScript code from EXPRESS schema content
|
|
21
|
+
*/
|
|
22
|
+
export function generateFromSchema(schemaContent, outputDir) {
|
|
23
|
+
console.log('š Parsing EXPRESS schema...');
|
|
24
|
+
const schema = parseExpressSchema(schemaContent);
|
|
25
|
+
console.log(`ā Parsed ${schema.name}`);
|
|
26
|
+
console.log(` - ${schema.entities.length} entities`);
|
|
27
|
+
console.log(` - ${schema.types.length} types`);
|
|
28
|
+
console.log(` - ${schema.enums.length} enums`);
|
|
29
|
+
console.log(` - ${schema.selects.length} selects`);
|
|
30
|
+
console.log('\nšØ Generating TypeScript code...');
|
|
31
|
+
const code = generateTypeScript(schema);
|
|
32
|
+
console.log('š¾ Writing generated files...');
|
|
33
|
+
// Create output directory
|
|
34
|
+
mkdirSync(outputDir, { recursive: true });
|
|
35
|
+
// Write files
|
|
36
|
+
writeFileSync(`${outputDir}/entities.ts`, code.entities);
|
|
37
|
+
console.log(` ā ${outputDir}/entities.ts`);
|
|
38
|
+
writeFileSync(`${outputDir}/types.ts`, code.types);
|
|
39
|
+
console.log(` ā ${outputDir}/types.ts`);
|
|
40
|
+
writeFileSync(`${outputDir}/enums.ts`, code.enums);
|
|
41
|
+
console.log(` ā ${outputDir}/enums.ts`);
|
|
42
|
+
writeFileSync(`${outputDir}/selects.ts`, code.selects);
|
|
43
|
+
console.log(` ā ${outputDir}/selects.ts`);
|
|
44
|
+
writeFileSync(`${outputDir}/schema-registry.ts`, code.schemaRegistry);
|
|
45
|
+
console.log(` ā ${outputDir}/schema-registry.ts`);
|
|
46
|
+
// Write index file
|
|
47
|
+
const indexContent = `/**
|
|
48
|
+
* Generated IFC Schema
|
|
49
|
+
*
|
|
50
|
+
* DO NOT EDIT - This file is auto-generated
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
export * from './entities.js';
|
|
54
|
+
export * from './types.js';
|
|
55
|
+
export * from './enums.js';
|
|
56
|
+
export * from './selects.js';
|
|
57
|
+
export * from './schema-registry.js';
|
|
58
|
+
`;
|
|
59
|
+
writeFileSync(`${outputDir}/index.ts`, indexContent);
|
|
60
|
+
console.log(` ā ${outputDir}/index.ts`);
|
|
61
|
+
console.log('\n⨠Code generation complete!');
|
|
62
|
+
return code;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAsB,MAAM,2BAA2B,CAAC;AAEnF;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAkB,EAAE,SAAiB;IACpE,mBAAmB;IACnB,MAAM,OAAO,GAAG,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAElD,gBAAgB;IAChB,OAAO,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAChD,CAAC;AAED;;G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,CAAC;IAEzC,aAAa,CAAC,GAAG,SAAS,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,OAAO,SAAS,aAAa,CAAC,CAAC;IAE3C,aAAa,CAAC,GAAG,SAAS,qBAAqB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACtE,OAAO,CAAC,GAAG,CAAC,OAAO,SAAS,qBAAqB,CAAC,CAAC;IAEnD,mBAAmB;IACnB,MAAM,YAAY,GAAG;;;;;;;;;;;CAWtB,CAAC;IACA,aAAa,CAAC,GAAG,SAAS,WAAW,EAAE,YAAY,CAAC,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,OAAO,SAAS,WAAW,CAAC,CAAC;IAEzC,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;IAE7C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ifc-lite/codegen
|
|
3
|
+
*
|
|
4
|
+
* TypeScript code generator from IFC EXPRESS schemas
|
|
5
|
+
*/
|
|
6
|
+
export { parseExpressSchema, getAllAttributes, getInheritanceChain, type ExpressSchema, type EntityDefinition, type AttributeDefinition, type TypeDefinition, type EnumDefinition, type SelectDefinition, type DerivedAttribute, type InverseAttribute, } from './express-parser.js';
|
|
7
|
+
export { generateTypeScript, writeGeneratedFiles, type GeneratedCode, } from './typescript-generator.js';
|
|
8
|
+
export { generateFromFile, generateFromSchema } from './generator.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,aAAa,GACnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* @ifc-lite/codegen
|
|
6
|
+
*
|
|
7
|
+
* TypeScript code generator from IFC EXPRESS schemas
|
|
8
|
+
*/
|
|
9
|
+
export { parseExpressSchema, getAllAttributes, getInheritanceChain, } from './express-parser.js';
|
|
10
|
+
export { generateTypeScript, writeGeneratedFiles, } from './typescript-generator.js';
|
|
11
|
+
export { generateFromFile, generateFromSchema } from './generator.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;GAIG;AAEH,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GASpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GAEpB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript Code Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates TypeScript interfaces, types, and schema registry from parsed EXPRESS schemas.
|
|
5
|
+
*/
|
|
6
|
+
import type { ExpressSchema } from './express-parser.js';
|
|
7
|
+
export interface GeneratedCode {
|
|
8
|
+
entities: string;
|
|
9
|
+
types: string;
|
|
10
|
+
enums: string;
|
|
11
|
+
selects: string;
|
|
12
|
+
schemaRegistry: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Generate all TypeScript code from EXPRESS schema
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateTypeScript(schema: ExpressSchema): GeneratedCode;
|
|
18
|
+
/**
|
|
19
|
+
* Write generated code to files
|
|
20
|
+
*/
|
|
21
|
+
export declare function writeGeneratedFiles(code: GeneratedCode, outputDir: string): {
|
|
22
|
+
entities: string;
|
|
23
|
+
types: string;
|
|
24
|
+
enums: string;
|
|
25
|
+
selects: string;
|
|
26
|
+
schema: string;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=typescript-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript-generator.d.ts","sourceRoot":"","sources":["../src/typescript-generator.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH,OAAO,KAAK,EACV,aAAa,EAMd,MAAM,qBAAqB,CAAC;AAG7B,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAQvE;AA0bD;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,aAAa,EACnB,SAAS,EAAE,MAAM,GAChB;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAQrF"}
|