@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.
Files changed (49) hide show
  1. package/INTEGRATION.md +354 -0
  2. package/LICENSE +373 -0
  3. package/README.md +101 -0
  4. package/dist/cli.d.ts +3 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +35 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/express-parser.d.ts +75 -0
  9. package/dist/express-parser.d.ts.map +1 -0
  10. package/dist/express-parser.js +318 -0
  11. package/dist/express-parser.js.map +1 -0
  12. package/dist/generator.d.ts +10 -0
  13. package/dist/generator.d.ts.map +1 -0
  14. package/dist/generator.js +64 -0
  15. package/dist/generator.js.map +1 -0
  16. package/dist/index.d.ts +9 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +12 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/typescript-generator.d.ts +28 -0
  21. package/dist/typescript-generator.d.ts.map +1 -0
  22. package/dist/typescript-generator.js +400 -0
  23. package/dist/typescript-generator.js.map +1 -0
  24. package/generated/ifc4/entities.ts +6978 -0
  25. package/generated/ifc4/enums.ts +2471 -0
  26. package/generated/ifc4/index.ts +15 -0
  27. package/generated/ifc4/schema-registry.ts +60726 -0
  28. package/generated/ifc4/selects.ts +191 -0
  29. package/generated/ifc4/test-compile.ts +37 -0
  30. package/generated/ifc4/types.ts +3104 -0
  31. package/generated/ifc4x3/entities.ts +7836 -0
  32. package/generated/ifc4x3/enums.ts +3100 -0
  33. package/generated/ifc4x3/index.ts +15 -0
  34. package/generated/ifc4x3/schema-registry.ts +71023 -0
  35. package/generated/ifc4x3/selects.ts +194 -0
  36. package/generated/ifc4x3/types.ts +3707 -0
  37. package/package.json +32 -0
  38. package/schemas/IFC4X3.exp +13984 -0
  39. package/schemas/IFC4_ADD2_TC1.exp +12399 -0
  40. package/src/cli.ts +41 -0
  41. package/src/express-parser.ts +441 -0
  42. package/src/generator.ts +81 -0
  43. package/src/index.ts +31 -0
  44. package/src/typescript-generator.ts +496 -0
  45. package/test/express-parser.test.ts +363 -0
  46. package/test/integration.test.ts +246 -0
  47. package/test/typescript-generator.test.ts +348 -0
  48. package/tsconfig.json +20 -0
  49. package/vitest.config.ts +18 -0
package/src/cli.ts ADDED
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ /* This Source Code Form is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
5
+
6
+ /**
7
+ * CLI for IFC code generation
8
+ */
9
+
10
+ import { Command } from 'commander';
11
+ import { generateFromFile } from './generator.js';
12
+
13
+ const program = new Command();
14
+
15
+ program
16
+ .name('ifc-codegen')
17
+ .description('Generate TypeScript code from IFC EXPRESS schemas')
18
+ .version('0.1.0');
19
+
20
+ program
21
+ .argument('<schema>', 'Path to EXPRESS schema file (.exp)')
22
+ .option('-o, --output <dir>', 'Output directory', './generated')
23
+ .option('-v, --verbose', 'Verbose output', false)
24
+ .action((schemaPath: string, options: { output: string; verbose: boolean }) => {
25
+ try {
26
+ console.log('šŸš€ IFC TypeScript Code Generator\n');
27
+ console.log(`Schema: ${schemaPath}`);
28
+ console.log(`Output: ${options.output}\n`);
29
+
30
+ const start = Date.now();
31
+ generateFromFile(schemaPath, options.output);
32
+ const elapsed = Date.now() - start;
33
+
34
+ console.log(`\nā±ļø Completed in ${elapsed}ms`);
35
+ } catch (error) {
36
+ console.error('\nāŒ Error:', error instanceof Error ? error.message : error);
37
+ process.exit(1);
38
+ }
39
+ });
40
+
41
+ program.parse();
@@ -0,0 +1,441 @@
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
+ /**
6
+ * EXPRESS Schema Parser
7
+ *
8
+ * Parses IFC EXPRESS schemas (.exp files) into an AST for code generation.
9
+ *
10
+ * EXPRESS is a data modeling language (ISO 10303-11) used to define IFC schemas.
11
+ * We parse the subset needed for TypeScript code generation:
12
+ * - ENTITY definitions (with attributes, inheritance, WHERE clauses)
13
+ * - TYPE definitions (simple types, enumerations, selects)
14
+ * - Comments
15
+ */
16
+
17
+ export interface ExpressSchema {
18
+ name: string;
19
+ entities: EntityDefinition[];
20
+ types: TypeDefinition[];
21
+ enums: EnumDefinition[];
22
+ selects: SelectDefinition[];
23
+ }
24
+
25
+ export interface EntityDefinition {
26
+ name: string;
27
+ isAbstract: boolean;
28
+ supertype?: string; // SUBTYPE OF
29
+ supertypeOf?: string[]; // SUPERTYPE OF (subtypes)
30
+ attributes: AttributeDefinition[];
31
+ derived?: DerivedAttribute[];
32
+ inverse?: InverseAttribute[];
33
+ whereRules?: string[];
34
+ uniqueRules?: string[];
35
+ }
36
+
37
+ export interface AttributeDefinition {
38
+ name: string;
39
+ type: string;
40
+ optional: boolean;
41
+ isArray: boolean;
42
+ isList: boolean;
43
+ isSet: boolean;
44
+ arrayBounds?: [number, number]; // [min, max] or [exact, exact]
45
+ }
46
+
47
+ export interface DerivedAttribute {
48
+ name: string;
49
+ type: string;
50
+ expression: string;
51
+ }
52
+
53
+ export interface InverseAttribute {
54
+ name: string;
55
+ type: string;
56
+ reference: string;
57
+ for: string;
58
+ }
59
+
60
+ export interface TypeDefinition {
61
+ name: string;
62
+ underlyingType: string; // e.g., "REAL", "STRING", "INTEGER"
63
+ whereRules?: string[];
64
+ }
65
+
66
+ export interface EnumDefinition {
67
+ name: string;
68
+ values: string[];
69
+ }
70
+
71
+ export interface SelectDefinition {
72
+ name: string;
73
+ types: string[]; // Union of types
74
+ }
75
+
76
+ /**
77
+ * Parse an EXPRESS schema file
78
+ */
79
+ export function parseExpressSchema(content: string): ExpressSchema {
80
+ // Remove comments
81
+ content = removeComments(content);
82
+
83
+ // Extract schema name
84
+ const schemaMatch = content.match(/SCHEMA\s+(\w+)\s*;/);
85
+ const schemaName = schemaMatch ? schemaMatch[1] : 'UNKNOWN';
86
+
87
+ // Parse different constructs
88
+ const entities = parseEntities(content);
89
+ const types = parseTypes(content);
90
+ const enums = parseEnums(content);
91
+ const selects = parseSelects(content);
92
+
93
+ return {
94
+ name: schemaName,
95
+ entities,
96
+ types,
97
+ enums,
98
+ selects,
99
+ };
100
+ }
101
+
102
+ /**
103
+ * Remove (* ... *) comments from EXPRESS
104
+ */
105
+ function removeComments(content: string): string {
106
+ // Remove multi-line comments (* ... *)
107
+ return content.replace(/\(\*[\s\S]*?\*\)/g, '');
108
+ }
109
+
110
+ /**
111
+ * Parse ENTITY definitions
112
+ */
113
+ function parseEntities(content: string): EntityDefinition[] {
114
+ const entities: EntityDefinition[] = [];
115
+
116
+ // Match ENTITY ... END_ENTITY blocks
117
+ const entityRegex = /ENTITY\s+(\w+)([\s\S]*?)END_ENTITY\s*;/g;
118
+
119
+ let match;
120
+ while ((match = entityRegex.exec(content)) !== null) {
121
+ const entityName = match[1];
122
+ const entityBody = match[2];
123
+
124
+ entities.push(parseEntity(entityName, entityBody));
125
+ }
126
+
127
+ return entities;
128
+ }
129
+
130
+ /**
131
+ * Parse a single ENTITY definition
132
+ */
133
+ function parseEntity(name: string, body: string): EntityDefinition {
134
+ const entity: EntityDefinition = {
135
+ name,
136
+ isAbstract: false,
137
+ attributes: [],
138
+ };
139
+
140
+ // Check if abstract
141
+ if (body.includes('ABSTRACT')) {
142
+ entity.isAbstract = true;
143
+ }
144
+
145
+ // Parse SUBTYPE OF
146
+ const subtypeMatch = body.match(/SUBTYPE\s+OF\s+\((\w+)\)/);
147
+ if (subtypeMatch) {
148
+ entity.supertype = subtypeMatch[1];
149
+ }
150
+
151
+ // Parse SUPERTYPE OF (list of subtypes)
152
+ const supertypeMatch = body.match(/SUPERTYPE\s+OF\s+\(ONEOF\s*\(([\s\S]*?)\)\)/);
153
+ if (supertypeMatch) {
154
+ entity.supertypeOf = supertypeMatch[1]
155
+ .split(',')
156
+ .map(s => s.trim())
157
+ .filter(s => s.length > 0);
158
+ }
159
+
160
+ // Extract just the attributes section (before WHERE, DERIVE, INVERSE, UNIQUE)
161
+ let attributesSection = body;
162
+
163
+ // Find where attributes section ends
164
+ const sectionMatches = [
165
+ body.match(/\bWHERE\b/),
166
+ body.match(/\bDERIVE\b/),
167
+ body.match(/\bINVERSE\b/),
168
+ body.match(/\bUNIQUE\b/),
169
+ ].filter(m => m !== null) as RegExpMatchArray[];
170
+
171
+ if (sectionMatches.length > 0) {
172
+ // Find the earliest match
173
+ const earliestIndex = Math.min(...sectionMatches.map(m => m.index!));
174
+ attributesSection = body.substring(0, earliestIndex);
175
+ }
176
+
177
+ // Parse attributes (lines with : between name and type)
178
+ // Format: AttributeName : [OPTIONAL] Type;
179
+ const attributeRegex = /^\s*(\w+)\s*:\s*(OPTIONAL\s+)?([\s\S]*?);/gm;
180
+
181
+ let attrMatch;
182
+ while ((attrMatch = attributeRegex.exec(attributesSection)) !== null) {
183
+ const attrName = attrMatch[1];
184
+ const optional = !!attrMatch[2];
185
+ const typeStr = attrMatch[3].trim();
186
+
187
+ entity.attributes.push(parseAttribute(attrName, typeStr, optional));
188
+ }
189
+
190
+ // Parse WHERE rules
191
+ const whereMatch = body.match(/WHERE([\s\S]*?)(?:UNIQUE|DERIVE|INVERSE|END_ENTITY|$)/);
192
+ if (whereMatch) {
193
+ entity.whereRules = whereMatch[1]
194
+ .split(';')
195
+ .map(s => s.trim())
196
+ .filter(s => s.length > 0);
197
+ }
198
+
199
+ // Parse UNIQUE rules
200
+ const uniqueMatch = body.match(/UNIQUE([\s\S]*?)(?:WHERE|DERIVE|INVERSE|END_ENTITY|$)/);
201
+ if (uniqueMatch) {
202
+ entity.uniqueRules = uniqueMatch[1]
203
+ .split(';')
204
+ .map(s => s.trim())
205
+ .filter(s => s.length > 0);
206
+ }
207
+
208
+ return entity;
209
+ }
210
+
211
+ /**
212
+ * Parse an attribute definition
213
+ */
214
+ function parseAttribute(name: string, typeStr: string, optional: boolean): AttributeDefinition {
215
+ const attr: AttributeDefinition = {
216
+ name,
217
+ type: '',
218
+ optional,
219
+ isArray: false,
220
+ isList: false,
221
+ isSet: false,
222
+ };
223
+
224
+ // Check for aggregation types: LIST, ARRAY, SET
225
+ // Match patterns like: LIST [1:?] OF Type, ARRAY [1:3] OF REAL, SET [0:?] OF Label
226
+ // Also handle nested collections: LIST [2:?] OF LIST [2:?] OF IfcCartesianPoint
227
+ if (typeStr.includes('LIST')) {
228
+ attr.isList = true;
229
+ const listMatch = typeStr.match(/LIST\s+\[(\d+|\?):(\d+|\?)\]\s+OF\s+(.*)/);
230
+ if (listMatch) {
231
+ attr.arrayBounds = [
232
+ listMatch[1] === '?' ? Infinity : parseInt(listMatch[1]),
233
+ listMatch[2] === '?' ? Infinity : parseInt(listMatch[2])
234
+ ];
235
+ const innerType = listMatch[3].trim();
236
+ // Recursively parse nested collection
237
+ attr.type = parseNestedCollection(innerType);
238
+ } else {
239
+ // Fallback if regex doesn't match
240
+ attr.type = typeStr.replace(/LIST\s+\[.*?\]\s+OF\s+/, '').trim();
241
+ }
242
+ } else if (typeStr.includes('ARRAY')) {
243
+ attr.isArray = true;
244
+ const arrayMatch = typeStr.match(/ARRAY\s+\[(\d+|\?):(\d+|\?)\]\s+OF\s+(.*)/);
245
+ if (arrayMatch) {
246
+ attr.arrayBounds = [
247
+ arrayMatch[1] === '?' ? Infinity : parseInt(arrayMatch[1]),
248
+ arrayMatch[2] === '?' ? Infinity : parseInt(arrayMatch[2])
249
+ ];
250
+ const innerType = arrayMatch[3].trim();
251
+ // Recursively parse nested collection
252
+ attr.type = parseNestedCollection(innerType);
253
+ } else {
254
+ // Fallback if regex doesn't match
255
+ attr.type = typeStr.replace(/ARRAY\s+\[.*?\]\s+OF\s+/, '').trim();
256
+ }
257
+ } else if (typeStr.includes('SET')) {
258
+ attr.isSet = true;
259
+ const setMatch = typeStr.match(/SET\s+\[(\d+|\?):(\d+|\?)\]\s+OF\s+(.*)/);
260
+ if (setMatch) {
261
+ attr.arrayBounds = [
262
+ setMatch[1] === '?' ? Infinity : parseInt(setMatch[1]),
263
+ setMatch[2] === '?' ? Infinity : parseInt(setMatch[2])
264
+ ];
265
+ const innerType = setMatch[3].trim();
266
+ // Recursively parse nested collection
267
+ attr.type = parseNestedCollection(innerType);
268
+ } else {
269
+ // Fallback if regex doesn't match
270
+ attr.type = typeStr.replace(/SET\s+\[.*?\]\s+OF\s+/, '').trim();
271
+ }
272
+ } else {
273
+ attr.type = typeStr;
274
+ }
275
+
276
+ return attr;
277
+ }
278
+
279
+ /**
280
+ * Parse nested collection types
281
+ * e.g., "LIST [2:?] OF IfcCartesianPoint" -> "IfcCartesianPoint[]"
282
+ */
283
+ function parseNestedCollection(typeStr: string): string {
284
+ // Check if this is another collection
285
+ if (typeStr.match(/^(LIST|ARRAY|SET)\s+\[/)) {
286
+ // Match: LIST|ARRAY|SET [min:max] OF <innerType>
287
+ const match = typeStr.match(/^(?:LIST|ARRAY|SET)\s+\[(?:\d+|\?):(?:\d+|\?)\]\s+OF\s+(.*)/);
288
+ if (match) {
289
+ const innerType = match[1].trim();
290
+ // Recursively parse and wrap in array
291
+ return `${parseNestedCollection(innerType)}[]`;
292
+ }
293
+ }
294
+
295
+ // Base case: return the type as-is
296
+ return typeStr;
297
+ }
298
+
299
+ /**
300
+ * Parse TYPE definitions (non-enum, non-select)
301
+ */
302
+ function parseTypes(content: string): TypeDefinition[] {
303
+ const types: TypeDefinition[] = [];
304
+
305
+ // Match TYPE ... END_TYPE blocks (exclude ENUMERATION and SELECT)
306
+ const typeRegex = /TYPE\s+(\w+)\s*=\s*(?!ENUMERATION|SELECT)([\s\S]*?)END_TYPE\s*;/g;
307
+
308
+ let match;
309
+ while ((match = typeRegex.exec(content)) !== null) {
310
+ const typeName = match[1];
311
+ const typeBody = match[2].trim();
312
+
313
+ // Extract underlying type (first word before semicolon or WHERE)
314
+ const underlyingMatch = typeBody.match(/^([^;]*?)(?:;|WHERE|$)/);
315
+ const underlyingType = underlyingMatch ? underlyingMatch[1].trim() : 'STRING';
316
+
317
+ // Parse WHERE rules if present
318
+ const whereMatch = typeBody.match(/WHERE([\s\S]*?)$/);
319
+ const whereRules = whereMatch
320
+ ? whereMatch[1]
321
+ .split(';')
322
+ .map(s => s.trim())
323
+ .filter(s => s.length > 0)
324
+ : undefined;
325
+
326
+ types.push({
327
+ name: typeName,
328
+ underlyingType,
329
+ whereRules,
330
+ });
331
+ }
332
+
333
+ return types;
334
+ }
335
+
336
+ /**
337
+ * Parse ENUMERATION types
338
+ */
339
+ function parseEnums(content: string): EnumDefinition[] {
340
+ const enums: EnumDefinition[] = [];
341
+
342
+ // Match TYPE ... = ENUMERATION OF (...) blocks
343
+ const enumRegex = /TYPE\s+(\w+)\s*=\s*ENUMERATION\s+OF\s*\(([\s\S]*?)\)\s*;[\s\S]*?END_TYPE\s*;/g;
344
+
345
+ let match;
346
+ while ((match = enumRegex.exec(content)) !== null) {
347
+ const enumName = match[1];
348
+ const valuesStr = match[2];
349
+
350
+ // Parse enum values (comma-separated, may have line breaks)
351
+ const values = valuesStr
352
+ .split(',')
353
+ .map(s => s.trim())
354
+ .filter(s => s.length > 0);
355
+
356
+ enums.push({
357
+ name: enumName,
358
+ values,
359
+ });
360
+ }
361
+
362
+ return enums;
363
+ }
364
+
365
+ /**
366
+ * Parse SELECT types (union types)
367
+ */
368
+ function parseSelects(content: string): SelectDefinition[] {
369
+ const selects: SelectDefinition[] = [];
370
+
371
+ // Match TYPE ... = SELECT (...) blocks
372
+ const selectRegex = /TYPE\s+(\w+)\s*=\s*SELECT\s*\(([\s\S]*?)\)\s*;[\s\S]*?END_TYPE\s*;/g;
373
+
374
+ let match;
375
+ while ((match = selectRegex.exec(content)) !== null) {
376
+ const selectName = match[1];
377
+ const typesStr = match[2];
378
+
379
+ // Parse select types (comma-separated, may have line breaks)
380
+ const types = typesStr
381
+ .split(',')
382
+ .map(s => s.trim())
383
+ .filter(s => s.length > 0);
384
+
385
+ selects.push({
386
+ name: selectName,
387
+ types,
388
+ });
389
+ }
390
+
391
+ return selects;
392
+ }
393
+
394
+ /**
395
+ * Get all attributes for an entity including inherited attributes
396
+ */
397
+ export function getAllAttributes(
398
+ entity: EntityDefinition,
399
+ schema: ExpressSchema
400
+ ): AttributeDefinition[] {
401
+ const attributes: AttributeDefinition[] = [];
402
+
403
+ // Walk up the inheritance chain
404
+ let current: EntityDefinition | undefined = entity;
405
+ while (current) {
406
+ // Add attributes from this level
407
+ attributes.push(...current.attributes);
408
+
409
+ // Move to parent
410
+ if (current.supertype) {
411
+ current = schema.entities.find(e => e.name === current!.supertype);
412
+ } else {
413
+ current = undefined;
414
+ }
415
+ }
416
+
417
+ return attributes;
418
+ }
419
+
420
+ /**
421
+ * Get inheritance chain for an entity (from root to entity)
422
+ */
423
+ export function getInheritanceChain(
424
+ entity: EntityDefinition,
425
+ schema: ExpressSchema
426
+ ): string[] {
427
+ const chain: string[] = [];
428
+
429
+ let current: EntityDefinition | undefined = entity;
430
+ while (current) {
431
+ chain.unshift(current.name); // Add to front
432
+
433
+ if (current.supertype) {
434
+ current = schema.entities.find(e => e.name === current!.supertype);
435
+ } else {
436
+ current = undefined;
437
+ }
438
+ }
439
+
440
+ return chain;
441
+ }
@@ -0,0 +1,81 @@
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
+ /**
6
+ * High-level generator functions
7
+ */
8
+
9
+ import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
10
+ import { dirname } from 'node:path';
11
+ import { parseExpressSchema } from './express-parser.js';
12
+ import { generateTypeScript, type GeneratedCode } from './typescript-generator.js';
13
+
14
+ /**
15
+ * Generate TypeScript code from an EXPRESS schema file
16
+ */
17
+ export function generateFromFile(schemaPath: string, outputDir: string): GeneratedCode {
18
+ // Read schema file
19
+ const content = readFileSync(schemaPath, 'utf-8');
20
+
21
+ // Generate code
22
+ return generateFromSchema(content, outputDir);
23
+ }
24
+
25
+ /**
26
+ * Generate TypeScript code from EXPRESS schema content
27
+ */
28
+ export function generateFromSchema(schemaContent: string, outputDir: string): GeneratedCode {
29
+ console.log('šŸ“– Parsing EXPRESS schema...');
30
+ const schema = parseExpressSchema(schemaContent);
31
+
32
+ console.log(`āœ“ Parsed ${schema.name}`);
33
+ console.log(` - ${schema.entities.length} entities`);
34
+ console.log(` - ${schema.types.length} types`);
35
+ console.log(` - ${schema.enums.length} enums`);
36
+ console.log(` - ${schema.selects.length} selects`);
37
+
38
+ console.log('\nšŸ”Ø Generating TypeScript code...');
39
+ const code = generateTypeScript(schema);
40
+
41
+ console.log('šŸ’¾ Writing generated files...');
42
+
43
+ // Create output directory
44
+ mkdirSync(outputDir, { recursive: true });
45
+
46
+ // Write files
47
+ writeFileSync(`${outputDir}/entities.ts`, code.entities);
48
+ console.log(` āœ“ ${outputDir}/entities.ts`);
49
+
50
+ writeFileSync(`${outputDir}/types.ts`, code.types);
51
+ console.log(` āœ“ ${outputDir}/types.ts`);
52
+
53
+ writeFileSync(`${outputDir}/enums.ts`, code.enums);
54
+ console.log(` āœ“ ${outputDir}/enums.ts`);
55
+
56
+ writeFileSync(`${outputDir}/selects.ts`, code.selects);
57
+ console.log(` āœ“ ${outputDir}/selects.ts`);
58
+
59
+ writeFileSync(`${outputDir}/schema-registry.ts`, code.schemaRegistry);
60
+ console.log(` āœ“ ${outputDir}/schema-registry.ts`);
61
+
62
+ // Write index file
63
+ const indexContent = `/**
64
+ * Generated IFC Schema
65
+ *
66
+ * DO NOT EDIT - This file is auto-generated
67
+ */
68
+
69
+ export * from './entities.js';
70
+ export * from './types.js';
71
+ export * from './enums.js';
72
+ export * from './selects.js';
73
+ export * from './schema-registry.js';
74
+ `;
75
+ writeFileSync(`${outputDir}/index.ts`, indexContent);
76
+ console.log(` āœ“ ${outputDir}/index.ts`);
77
+
78
+ console.log('\n✨ Code generation complete!');
79
+
80
+ return code;
81
+ }
package/src/index.ts ADDED
@@ -0,0 +1,31 @@
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
+ /**
6
+ * @ifc-lite/codegen
7
+ *
8
+ * TypeScript code generator from IFC EXPRESS schemas
9
+ */
10
+
11
+ export {
12
+ parseExpressSchema,
13
+ getAllAttributes,
14
+ getInheritanceChain,
15
+ type ExpressSchema,
16
+ type EntityDefinition,
17
+ type AttributeDefinition,
18
+ type TypeDefinition,
19
+ type EnumDefinition,
20
+ type SelectDefinition,
21
+ type DerivedAttribute,
22
+ type InverseAttribute,
23
+ } from './express-parser.js';
24
+
25
+ export {
26
+ generateTypeScript,
27
+ writeGeneratedFiles,
28
+ type GeneratedCode,
29
+ } from './typescript-generator.js';
30
+
31
+ export { generateFromFile, generateFromSchema } from './generator.js';