@ifc-lite/ifcx 1.2.1 → 1.6.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.
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Path Resolver for Federated IFCX
3
+ *
4
+ * Handles resolution of IFCX paths including:
5
+ * - Direct UUID references: "93791d5d-5beb-437b-b8ec-2f1f0ba4bf3b"
6
+ * - Hierarchical paths: "uuid/ChildName/GrandchildName"
7
+ */
8
+ import type { ComposedNode } from './types.js';
9
+ import type { IfcxLayer } from './layer-stack.js';
10
+ /**
11
+ * Parsed path components.
12
+ */
13
+ export interface ParsedPath {
14
+ /** Root UUID or path segment */
15
+ root: string;
16
+ /** Child path segments (empty for direct UUID) */
17
+ segments: string[];
18
+ /** Whether root looks like a UUID */
19
+ isUuid: boolean;
20
+ }
21
+ /**
22
+ * Entry in the path index.
23
+ */
24
+ export interface PathEntry {
25
+ /** Canonical UUID for this path */
26
+ uuid: string;
27
+ /** All known hierarchical paths to this node */
28
+ hierarchicalPaths: string[];
29
+ /** Layer IDs where this path is defined */
30
+ definedInLayers: string[];
31
+ /** Strongest (lowest index) layer ID */
32
+ primaryLayer: string;
33
+ }
34
+ /**
35
+ * Index for fast path lookups across layers.
36
+ */
37
+ export declare class PathIndex {
38
+ /** Direct UUID lookup */
39
+ private byUuid;
40
+ /** Hierarchical path string lookup */
41
+ private byHierarchy;
42
+ /** Parent UUID -> (child name -> child UUID) */
43
+ private childNameIndex;
44
+ /**
45
+ * Build index from layers.
46
+ */
47
+ buildIndex(layers: IfcxLayer[]): void;
48
+ /**
49
+ * Build hierarchical path index by walking children relationships.
50
+ */
51
+ private buildHierarchicalIndex;
52
+ /**
53
+ * Recursively index hierarchical paths for a node.
54
+ */
55
+ private indexHierarchicalPaths;
56
+ /**
57
+ * Resolve a path to its canonical UUID.
58
+ * Accepts both direct UUIDs and hierarchical paths.
59
+ */
60
+ resolvePath(path: string): string | null;
61
+ /**
62
+ * Walk a path through children relationships.
63
+ */
64
+ private walkPath;
65
+ /**
66
+ * Get entry for a UUID.
67
+ */
68
+ getEntry(uuid: string): PathEntry | undefined;
69
+ /**
70
+ * Get all UUIDs in the index.
71
+ */
72
+ getAllUuids(): string[];
73
+ /**
74
+ * Get children of a node.
75
+ */
76
+ getChildren(uuid: string): Map<string, string> | undefined;
77
+ /**
78
+ * Check if a path exists.
79
+ */
80
+ hasPath(path: string): boolean;
81
+ /**
82
+ * Clear the index.
83
+ */
84
+ clear(): void;
85
+ /**
86
+ * Get index statistics.
87
+ */
88
+ getStats(): {
89
+ uuidCount: number;
90
+ hierarchicalCount: number;
91
+ childRelationships: number;
92
+ };
93
+ }
94
+ /**
95
+ * Parse an IFCX path into components.
96
+ *
97
+ * Examples:
98
+ * "93791d5d-5beb-437b-b8ec-2f1f0ba4bf3b"
99
+ * -> { root: "93791d5d-...", segments: [], isUuid: true }
100
+ *
101
+ * "93791d5d-5beb-437b-b8ec-2f1f0ba4bf3b/My_Wall/Window"
102
+ * -> { root: "93791d5d-...", segments: ["My_Wall", "Window"], isUuid: true }
103
+ */
104
+ export declare function parsePath(path: string): ParsedPath;
105
+ /**
106
+ * Walk a path through composed nodes.
107
+ */
108
+ export declare function walkComposedPath(root: ComposedNode, segments: string[]): ComposedNode | null;
109
+ /**
110
+ * Create a new path index.
111
+ */
112
+ export declare function createPathIndex(): PathIndex;
113
+ //# sourceMappingURL=path-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-resolver.d.ts","sourceRoot":"","sources":["../src/path-resolver.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAY,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,QAAQ,EAAE,MAAM,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AAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAalD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,MAAM,EAAE,GACjB,YAAY,GAAG,IAAI,CAUrB;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,SAAS,CAE3C"}
@@ -0,0 +1,211 @@
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
+ * Index for fast path lookups across layers.
6
+ */
7
+ export class PathIndex {
8
+ /** Direct UUID lookup */
9
+ byUuid = new Map();
10
+ /** Hierarchical path string lookup */
11
+ byHierarchy = new Map(); // hierarchical path -> uuid
12
+ /** Parent UUID -> (child name -> child UUID) */
13
+ childNameIndex = new Map();
14
+ /**
15
+ * Build index from layers.
16
+ */
17
+ buildIndex(layers) {
18
+ this.clear();
19
+ // First pass: collect all direct path definitions
20
+ for (const layer of layers) {
21
+ for (const [path, nodes] of layer.nodesByPath) {
22
+ // Skip non-UUID paths for now (they're hierarchical references)
23
+ if (path.includes('/'))
24
+ continue;
25
+ let entry = this.byUuid.get(path);
26
+ if (!entry) {
27
+ entry = {
28
+ uuid: path,
29
+ hierarchicalPaths: [],
30
+ definedInLayers: [],
31
+ primaryLayer: layer.id,
32
+ };
33
+ this.byUuid.set(path, entry);
34
+ }
35
+ entry.definedInLayers.push(layer.id);
36
+ // Collect children for building hierarchical index
37
+ for (const node of nodes) {
38
+ if (node.children) {
39
+ let childMap = this.childNameIndex.get(path);
40
+ if (!childMap) {
41
+ childMap = new Map();
42
+ this.childNameIndex.set(path, childMap);
43
+ }
44
+ for (const [childName, childPath] of Object.entries(node.children)) {
45
+ if (childPath && typeof childPath === 'string') {
46
+ childMap.set(childName, childPath);
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ // Second pass: build hierarchical path index
54
+ this.buildHierarchicalIndex();
55
+ }
56
+ /**
57
+ * Build hierarchical path index by walking children relationships.
58
+ */
59
+ buildHierarchicalIndex() {
60
+ // For each root node, build full hierarchical paths
61
+ for (const [uuid, entry] of this.byUuid) {
62
+ this.indexHierarchicalPaths(uuid, uuid, []);
63
+ }
64
+ }
65
+ /**
66
+ * Recursively index hierarchical paths for a node.
67
+ */
68
+ indexHierarchicalPaths(rootUuid, currentUuid, pathSegments) {
69
+ const children = this.childNameIndex.get(currentUuid);
70
+ if (!children)
71
+ return;
72
+ for (const [childName, childUuid] of children) {
73
+ const newSegments = [...pathSegments, childName];
74
+ const hierarchicalPath = `${rootUuid}/${newSegments.join('/')}`;
75
+ // Map hierarchical path to UUID
76
+ this.byHierarchy.set(hierarchicalPath, childUuid);
77
+ // Add to entry's hierarchical paths
78
+ const entry = this.byUuid.get(childUuid);
79
+ if (entry) {
80
+ entry.hierarchicalPaths.push(hierarchicalPath);
81
+ }
82
+ // Recurse
83
+ this.indexHierarchicalPaths(rootUuid, childUuid, newSegments);
84
+ }
85
+ }
86
+ /**
87
+ * Resolve a path to its canonical UUID.
88
+ * Accepts both direct UUIDs and hierarchical paths.
89
+ */
90
+ resolvePath(path) {
91
+ // Try direct UUID first
92
+ if (this.byUuid.has(path)) {
93
+ return path;
94
+ }
95
+ // Try hierarchical path
96
+ const resolved = this.byHierarchy.get(path);
97
+ if (resolved) {
98
+ return resolved;
99
+ }
100
+ // Try parsing and walking
101
+ const parsed = parsePath(path);
102
+ if (parsed.segments.length > 0) {
103
+ return this.walkPath(parsed.root, parsed.segments);
104
+ }
105
+ return null;
106
+ }
107
+ /**
108
+ * Walk a path through children relationships.
109
+ */
110
+ walkPath(root, segments) {
111
+ let current = root;
112
+ for (const segment of segments) {
113
+ const children = this.childNameIndex.get(current);
114
+ if (!children)
115
+ return null;
116
+ const next = children.get(segment);
117
+ if (!next)
118
+ return null;
119
+ current = next;
120
+ }
121
+ return current;
122
+ }
123
+ /**
124
+ * Get entry for a UUID.
125
+ */
126
+ getEntry(uuid) {
127
+ return this.byUuid.get(uuid);
128
+ }
129
+ /**
130
+ * Get all UUIDs in the index.
131
+ */
132
+ getAllUuids() {
133
+ return Array.from(this.byUuid.keys());
134
+ }
135
+ /**
136
+ * Get children of a node.
137
+ */
138
+ getChildren(uuid) {
139
+ return this.childNameIndex.get(uuid);
140
+ }
141
+ /**
142
+ * Check if a path exists.
143
+ */
144
+ hasPath(path) {
145
+ return this.resolvePath(path) !== null;
146
+ }
147
+ /**
148
+ * Clear the index.
149
+ */
150
+ clear() {
151
+ this.byUuid.clear();
152
+ this.byHierarchy.clear();
153
+ this.childNameIndex.clear();
154
+ }
155
+ /**
156
+ * Get index statistics.
157
+ */
158
+ getStats() {
159
+ let childRelationships = 0;
160
+ for (const children of this.childNameIndex.values()) {
161
+ childRelationships += children.size;
162
+ }
163
+ return {
164
+ uuidCount: this.byUuid.size,
165
+ hierarchicalCount: this.byHierarchy.size,
166
+ childRelationships,
167
+ };
168
+ }
169
+ }
170
+ /**
171
+ * Parse an IFCX path into components.
172
+ *
173
+ * Examples:
174
+ * "93791d5d-5beb-437b-b8ec-2f1f0ba4bf3b"
175
+ * -> { root: "93791d5d-...", segments: [], isUuid: true }
176
+ *
177
+ * "93791d5d-5beb-437b-b8ec-2f1f0ba4bf3b/My_Wall/Window"
178
+ * -> { root: "93791d5d-...", segments: ["My_Wall", "Window"], isUuid: true }
179
+ */
180
+ export function parsePath(path) {
181
+ const parts = path.split('/');
182
+ const root = parts[0];
183
+ const segments = parts.slice(1).filter((s) => s.length > 0);
184
+ // UUID pattern (simplified - 8-4-4-4-12 hex)
185
+ const isUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(root);
186
+ return {
187
+ root,
188
+ segments,
189
+ isUuid,
190
+ };
191
+ }
192
+ /**
193
+ * Walk a path through composed nodes.
194
+ */
195
+ export function walkComposedPath(root, segments) {
196
+ let current = root;
197
+ for (const segment of segments) {
198
+ const child = current.children.get(segment);
199
+ if (!child)
200
+ return null;
201
+ current = child;
202
+ }
203
+ return current;
204
+ }
205
+ /**
206
+ * Create a new path index.
207
+ */
208
+ export function createPathIndex() {
209
+ return new PathIndex();
210
+ }
211
+ //# sourceMappingURL=path-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-resolver.js","sourceRoot":"","sources":["../src/path-resolver.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAuC/D;;GAEG;AACH,MAAM,OAAO,SAAS;IACpB,yBAAyB;IACjB,MAAM,GAAG,IAAI,GAAG,EAAqB,CAAC;IAE9C,sCAAsC;IAC9B,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC,CAAC,4BAA4B;IAE7E,gDAAgD;IACxC,cAAc,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEhE;;OAEG;IACH,UAAU,CAAC,MAAmB;QAC5B,IAAI,CAAC,KAAK,EAAE,CAAC;QAEb,kDAAkD;QAClD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;gBAC9C,gEAAgE;gBAChE,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;oBAAE,SAAS;gBAEjC,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAClC,IAAI,CAAC,KAAK,EAAE,CAAC;oBACX,KAAK,GAAG;wBACN,IAAI,EAAE,IAAI;wBACV,iBAAiB,EAAE,EAAE;wBACrB,eAAe,EAAE,EAAE;wBACnB,YAAY,EAAE,KAAK,CAAC,EAAE;qBACvB,CAAC;oBACF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBAC/B,CAAC;gBACD,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAA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,CAAC;QAED,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;YAC3B,iBAAiB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI;YACxC,kBAAkB;SACnB,CAAC;IACJ,CAAC;CACF;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACtB,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE5D,6CAA6C;IAC7C,MAAM,MAAM,GAAG,iEAAiE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE5F,OAAO;QACL,IAAI;QACJ,QAAQ;QACR,MAAM;KACP,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAkB,EAClB,QAAkB;IAElB,IAAI,OAAO,GAAiB,IAAI,CAAC;IAEjC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QACxB,OAAO,GAAG,KAAK,CAAC;IAClB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,IAAI,SAAS,EAAE,CAAC;AACzB,CAAC"}
@@ -0,0 +1,99 @@
1
+ import type { EntityTable, PropertyTable, SpatialHierarchy } from '@ifc-lite/data';
2
+ import type { MutablePropertyView } from '@ifc-lite/mutations';
3
+ /**
4
+ * Options for IFCX export
5
+ */
6
+ export interface IfcxExportOptions {
7
+ /** Author name */
8
+ author?: string;
9
+ /** Data version identifier */
10
+ dataVersion?: string;
11
+ /** Include properties (default: true) */
12
+ includeProperties?: boolean;
13
+ /** Include geometry (default: false - geometry export not yet supported) */
14
+ includeGeometry?: boolean;
15
+ /** Pretty print JSON (default: true) */
16
+ prettyPrint?: boolean;
17
+ /** Apply mutations (default: true if mutation view provided) */
18
+ applyMutations?: boolean;
19
+ }
20
+ /**
21
+ * Data sources for IFCX export
22
+ */
23
+ export interface IfcxExportData {
24
+ /** Entity table */
25
+ entities: EntityTable;
26
+ /** Property table (optional if using mutation view) */
27
+ properties?: PropertyTable;
28
+ /** Spatial hierarchy */
29
+ spatialHierarchy?: SpatialHierarchy;
30
+ /** String table for lookups */
31
+ strings?: {
32
+ get(idx: number): string;
33
+ };
34
+ /** Optional mutation view for property changes */
35
+ mutationView?: MutablePropertyView;
36
+ /** ID to path mapping (for round-trip scenarios) */
37
+ idToPath?: Map<number, string>;
38
+ }
39
+ /**
40
+ * Result of IFCX export
41
+ */
42
+ export interface IfcxExportResult {
43
+ /** JSON string content */
44
+ content: string;
45
+ /** Statistics */
46
+ stats: {
47
+ nodeCount: number;
48
+ propertyCount: number;
49
+ fileSize: number;
50
+ };
51
+ }
52
+ /**
53
+ * IFCX file writer
54
+ */
55
+ export declare class IfcxWriter {
56
+ private data;
57
+ constructor(data: IfcxExportData);
58
+ /**
59
+ * Export to IFCX format
60
+ */
61
+ export(options?: IfcxExportOptions): IfcxExportResult;
62
+ /**
63
+ * Create IFCX header
64
+ */
65
+ private createHeader;
66
+ /**
67
+ * Collect all nodes for export
68
+ */
69
+ private collectNodes;
70
+ /**
71
+ * Get properties for an entity
72
+ */
73
+ private getPropertiesForEntity;
74
+ /**
75
+ * Get children relationships for an entity
76
+ */
77
+ private getChildrenForEntity;
78
+ /**
79
+ * Get string from string table
80
+ */
81
+ private getString;
82
+ /**
83
+ * Get type name from enum
84
+ */
85
+ private getTypeName;
86
+ /**
87
+ * Generate path for an entity
88
+ */
89
+ private generatePath;
90
+ /**
91
+ * Generate unique ID
92
+ */
93
+ private generateId;
94
+ }
95
+ /**
96
+ * Quick export function for simple use cases
97
+ */
98
+ export declare function exportToIfcx(data: IfcxExportData, options?: IfcxExportOptions): string;
99
+ //# sourceMappingURL=writer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../src/writer.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAe,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,4EAA4E;IAC5E,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wCAAwC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,mBAAmB;IACnB,QAAQ,EAAE,WAAW,CAAC;IACtB,uDAAuD;IACvD,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,wBAAwB;IACxB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,+BAA+B;IAC/B,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACvC,kDAAkD;IAClD,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC,oDAAoD;IACpD,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,KAAK,EAAE;QACL,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;QACtB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,IAAI,CAAiB;gBAEjB,IAAI,EAAE,cAAc;IAIhC;;OAEG;IACH,MAAM,CAAC,OAAO,GAAE,iBAAsB,GAAG,gBAAgB;IAgCzD;;OAEG;IACH,OAAO,CAAC,YAAY;IAUpB;;OAEG;IACH,OAAO,CAAC,YAAY;IA+DpB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA8B9B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAyB5B;;OAEG;IACH,OAAO,CAAC,SAAS;IAKjB;;OAEG;IACH,OAAO,CAAC,WAAW;IAkCnB;;OAEG;IACH,OAAO,CAAC,YAAY;IAKpB;;OAEG;IACH,OAAO,CAAC,UAAU;CAGnB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,cAAc,EACpB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,MAAM,CAIR"}
package/dist/writer.js ADDED
@@ -0,0 +1,220 @@
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
+ * IFCX file writer
6
+ */
7
+ export class IfcxWriter {
8
+ data;
9
+ constructor(data) {
10
+ this.data = data;
11
+ }
12
+ /**
13
+ * Export to IFCX format
14
+ */
15
+ export(options = {}) {
16
+ const header = this.createHeader(options);
17
+ const nodes = this.collectNodes(options);
18
+ const file = {
19
+ header,
20
+ imports: [],
21
+ schemas: {},
22
+ data: nodes,
23
+ };
24
+ const content = options.prettyPrint !== false
25
+ ? JSON.stringify(file, null, 2)
26
+ : JSON.stringify(file);
27
+ let propertyCount = 0;
28
+ for (const node of nodes) {
29
+ if (node.attributes) {
30
+ propertyCount += Object.keys(node.attributes).length;
31
+ }
32
+ }
33
+ return {
34
+ content,
35
+ stats: {
36
+ nodeCount: nodes.length,
37
+ propertyCount,
38
+ fileSize: new TextEncoder().encode(content).length,
39
+ },
40
+ };
41
+ }
42
+ /**
43
+ * Create IFCX header
44
+ */
45
+ createHeader(options) {
46
+ return {
47
+ id: this.generateId(),
48
+ ifcxVersion: 'IFCX-1.0',
49
+ dataVersion: options.dataVersion || '1.0.0',
50
+ author: options.author || 'ifc-lite',
51
+ timestamp: new Date().toISOString(),
52
+ };
53
+ }
54
+ /**
55
+ * Collect all nodes for export
56
+ */
57
+ collectNodes(options) {
58
+ const nodes = [];
59
+ const { entities, spatialHierarchy, mutationView, idToPath } = this.data;
60
+ // Process entities from table
61
+ for (let i = 0; i < entities.count; i++) {
62
+ const expressId = entities.expressId[i];
63
+ const typeEnum = entities.typeEnum[i];
64
+ // Get or generate path
65
+ const path = idToPath?.get(expressId) || this.generatePath(expressId, typeEnum);
66
+ // Get entity name
67
+ const name = this.getString(entities.name[i]);
68
+ const globalId = this.getString(entities.globalId[i]);
69
+ // Build attributes
70
+ const attributes = {};
71
+ // Add IFC class
72
+ const typeName = this.getTypeName(typeEnum);
73
+ if (typeName) {
74
+ attributes['bsi::ifc::class'] = { code: typeName };
75
+ }
76
+ // Add basic attributes
77
+ if (globalId) {
78
+ attributes['bsi::ifc::globalId'] = globalId;
79
+ }
80
+ if (name) {
81
+ attributes['bsi::ifc::name'] = name;
82
+ }
83
+ const description = this.getString(entities.description[i]);
84
+ if (description) {
85
+ attributes['bsi::ifc::description'] = description;
86
+ }
87
+ // Add properties if requested
88
+ if (options.includeProperties !== false) {
89
+ const props = this.getPropertiesForEntity(expressId, options);
90
+ for (const [key, value] of Object.entries(props)) {
91
+ attributes[key] = value;
92
+ }
93
+ }
94
+ const node = {
95
+ path,
96
+ attributes: Object.keys(attributes).length > 0 ? attributes : undefined,
97
+ };
98
+ // Add children based on spatial hierarchy
99
+ const children = this.getChildrenForEntity(expressId, spatialHierarchy, idToPath);
100
+ if (Object.keys(children).length > 0) {
101
+ node.children = children;
102
+ }
103
+ nodes.push(node);
104
+ }
105
+ return nodes;
106
+ }
107
+ /**
108
+ * Get properties for an entity
109
+ */
110
+ getPropertiesForEntity(entityId, options) {
111
+ const result = {};
112
+ const { mutationView, properties } = this.data;
113
+ // Get properties from mutation view if available and applying mutations
114
+ if (mutationView && options.applyMutations !== false) {
115
+ const psets = mutationView.getForEntity(entityId);
116
+ for (const pset of psets) {
117
+ for (const prop of pset.properties) {
118
+ const key = `user::${pset.name}::${prop.name}`;
119
+ result[key] = prop.value;
120
+ }
121
+ }
122
+ }
123
+ else if (properties) {
124
+ // Get properties from table
125
+ const psets = properties.getForEntity(entityId);
126
+ for (const pset of psets) {
127
+ for (const prop of pset.properties) {
128
+ const key = `user::${pset.name}::${prop.name}`;
129
+ result[key] = prop.value;
130
+ }
131
+ }
132
+ }
133
+ return result;
134
+ }
135
+ /**
136
+ * Get children relationships for an entity
137
+ */
138
+ getChildrenForEntity(entityId, spatialHierarchy, idToPath) {
139
+ const children = {};
140
+ if (!spatialHierarchy)
141
+ return children;
142
+ // Check if this entity has contained elements
143
+ const containedElements = spatialHierarchy.byStorey.get(entityId) ||
144
+ spatialHierarchy.byBuilding.get(entityId) ||
145
+ spatialHierarchy.bySite.get(entityId) ||
146
+ spatialHierarchy.bySpace.get(entityId);
147
+ if (containedElements) {
148
+ for (const childId of containedElements) {
149
+ const childPath = idToPath?.get(childId) || `element:${childId}`;
150
+ children[childPath] = null; // null means direct child
151
+ }
152
+ }
153
+ return children;
154
+ }
155
+ /**
156
+ * Get string from string table
157
+ */
158
+ getString(idx) {
159
+ if (idx === 0 || !this.data.strings)
160
+ return '';
161
+ return this.data.strings.get(idx) || '';
162
+ }
163
+ /**
164
+ * Get type name from enum
165
+ */
166
+ getTypeName(typeEnum) {
167
+ // Map common type enums to IFC class names
168
+ const typeMap = {
169
+ 1: 'IfcProject',
170
+ 2: 'IfcSite',
171
+ 3: 'IfcBuilding',
172
+ 4: 'IfcBuildingStorey',
173
+ 5: 'IfcSpace',
174
+ 10: 'IfcWall',
175
+ 11: 'IfcWallStandardCase',
176
+ 12: 'IfcDoor',
177
+ 13: 'IfcWindow',
178
+ 14: 'IfcSlab',
179
+ 15: 'IfcColumn',
180
+ 16: 'IfcBeam',
181
+ 17: 'IfcRoof',
182
+ 18: 'IfcStair',
183
+ 19: 'IfcRailing',
184
+ 20: 'IfcCurtainWall',
185
+ 21: 'IfcCovering',
186
+ 22: 'IfcPlate',
187
+ 23: 'IfcMember',
188
+ 24: 'IfcPile',
189
+ 25: 'IfcFooting',
190
+ 30: 'IfcFurnishingElement',
191
+ 31: 'IfcSystemFurnitureElement',
192
+ 32: 'IfcDistributionElement',
193
+ 33: 'IfcBuildingElementProxy',
194
+ 40: 'IfcOpeningElement',
195
+ };
196
+ return typeMap[typeEnum] || `IfcElement_${typeEnum}`;
197
+ }
198
+ /**
199
+ * Generate path for an entity
200
+ */
201
+ generatePath(expressId, typeEnum) {
202
+ const typeName = this.getTypeName(typeEnum);
203
+ return `ifc:${typeName}.${expressId}`;
204
+ }
205
+ /**
206
+ * Generate unique ID
207
+ */
208
+ generateId() {
209
+ return `ifcx_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
210
+ }
211
+ }
212
+ /**
213
+ * Quick export function for simple use cases
214
+ */
215
+ export function exportToIfcx(data, options) {
216
+ const writer = new IfcxWriter(data);
217
+ const result = writer.export(options);
218
+ return result.content;
219
+ }
220
+ //# sourceMappingURL=writer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writer.js","sourceRoot":"","sources":["../src/writer.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA8D/D;;GAEG;AACH,MAAM,OAAO,UAAU;IACb,IAAI,CAAiB;IAE7B,YAAY,IAAoB;QAC9B,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