@ifc-lite/export 4.3.2 → 4.3.4

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 (39) hide show
  1. package/dist/generated/ifc2x3-required-slots.d.ts +23 -0
  2. package/dist/generated/ifc2x3-required-slots.d.ts.map +1 -0
  3. package/dist/generated/ifc2x3-required-slots.js +527 -0
  4. package/dist/generated/ifc2x3-required-slots.js.map +1 -0
  5. package/dist/ifc5-exporter.d.ts +1 -6
  6. package/dist/ifc5-exporter.d.ts.map +1 -1
  7. package/dist/ifc5-exporter.js +13 -66
  8. package/dist/ifc5-exporter.js.map +1 -1
  9. package/dist/ifc5-tree-scope.d.ts +12 -0
  10. package/dist/ifc5-tree-scope.d.ts.map +1 -0
  11. package/dist/ifc5-tree-scope.js +361 -0
  12. package/dist/ifc5-tree-scope.js.map +1 -0
  13. package/dist/merged-exporter.js +11 -11
  14. package/dist/merged-exporter.js.map +1 -1
  15. package/dist/schema-converter-attr-remap.d.ts +16 -7
  16. package/dist/schema-converter-attr-remap.d.ts.map +1 -1
  17. package/dist/schema-converter-attr-remap.js +17 -29
  18. package/dist/schema-converter-attr-remap.js.map +1 -1
  19. package/dist/schema-converter-ifc2x3-slots.d.ts +60 -0
  20. package/dist/schema-converter-ifc2x3-slots.d.ts.map +1 -0
  21. package/dist/schema-converter-ifc2x3-slots.js +104 -0
  22. package/dist/schema-converter-ifc2x3-slots.js.map +1 -0
  23. package/dist/schema-converter.d.ts +6 -6
  24. package/dist/schema-converter.d.ts.map +1 -1
  25. package/dist/schema-converter.js +8 -7
  26. package/dist/schema-converter.js.map +1 -1
  27. package/dist/step-export-types.d.ts +6 -5
  28. package/dist/step-export-types.d.ts.map +1 -1
  29. package/dist/step-exporter.js +1 -1
  30. package/dist/step-exporter.js.map +1 -1
  31. package/dist/step-header.js +1 -1
  32. package/dist/step-header.js.map +1 -1
  33. package/dist/step-overlay-entities.js +1 -1
  34. package/dist/step-overlay-entities.js.map +1 -1
  35. package/dist/step-pass-builder.js +2 -2
  36. package/dist/step-pass-builder.js.map +1 -1
  37. package/dist/step-source-iteration.js +1 -1
  38. package/dist/step-source-iteration.js.map +1 -1
  39. package/package.json +5 -5
@@ -0,0 +1,361 @@
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
+ /** Effective IFC5 tree membership and parent selection (#4841). */
5
+ import { RelationshipType, createLogger, flattenRelationshipEdges } from '@ifc-lite/data';
6
+ import { EntityExtractor } from '@ifc-lite/parser';
7
+ import { authoredEntityRefs } from './effective-index.js';
8
+ const CYCLE_CHECK_VISIT_BUDGET = 2_000_000;
9
+ const log = createLogger('Ifc5TreeScope');
10
+ function newEdges() {
11
+ return { childrenByParent: new Map(), parentsByChild: new Map(), parentSetsByChild: new Map() };
12
+ }
13
+ function parsedSingleRef(value) {
14
+ return typeof value === 'number' && Number.isInteger(value) && value > 0 ? value : undefined;
15
+ }
16
+ function parsedRefs(value) {
17
+ if (Array.isArray(value))
18
+ return value.flatMap(parsedRefs);
19
+ const id = parsedSingleRef(value);
20
+ return id === undefined ? [] : [id];
21
+ }
22
+ function authoredKnownRefs(value) {
23
+ const found = [];
24
+ const pending = [value];
25
+ const seen = new WeakSet();
26
+ while (pending.length > 0) {
27
+ const current = pending.pop();
28
+ if (Array.isArray(current)) {
29
+ if (seen.has(current))
30
+ continue;
31
+ seen.add(current);
32
+ for (let i = current.length - 1; i >= 0; i--)
33
+ pending.push(current[i]);
34
+ continue;
35
+ }
36
+ const numeric = parsedSingleRef(current);
37
+ found.push(...(numeric === undefined
38
+ ? authoredEntityRefs(current)
39
+ : [numeric]));
40
+ }
41
+ return found;
42
+ }
43
+ function refs(value, authored) {
44
+ return authored ? authoredKnownRefs(value) : parsedRefs(value);
45
+ }
46
+ function appendChild(edges, parentId, childId) {
47
+ if (parentId === childId)
48
+ return;
49
+ const children = edges.childrenByParent.get(parentId) ?? [];
50
+ children.push(childId); // duplicates are harmless to the visited-set closure
51
+ edges.childrenByParent.set(parentId, children);
52
+ }
53
+ function appendCandidate(edges, childId, parentId) {
54
+ if (parentId === childId)
55
+ return;
56
+ const seen = edges.parentSetsByChild.get(childId) ?? new Set();
57
+ if (seen.has(parentId))
58
+ return;
59
+ seen.add(parentId);
60
+ edges.parentSetsByChild.set(childId, seen);
61
+ const parents = edges.parentsByChild.get(childId) ?? [];
62
+ parents.push(parentId);
63
+ edges.parentsByChild.set(childId, parents);
64
+ }
65
+ function addEdge(edges, parentId, childId) {
66
+ appendChild(edges, parentId, childId);
67
+ appendCandidate(edges, childId, parentId);
68
+ }
69
+ const existsOrWasDeleted = (effective, id) => effective.has(id) || effective.isDeleted(id);
70
+ function effectiveAttributes(id, sourceAttributes, created, view) {
71
+ const attributes = created ? [...created.attributes] : sourceAttributes?.slice();
72
+ if (!attributes || !view)
73
+ return attributes;
74
+ for (const [index, value] of view.getPositionalMutationsForEntity(id) ?? [])
75
+ attributes[index] = value;
76
+ const slots = new Map([
77
+ ['RelatingObject', 4], ['RelatedObjects', 5],
78
+ ['RelatedElements', 4], ['RelatingStructure', 5],
79
+ ]);
80
+ for (const { name, value } of view.getAttributeMutationsForEntity(id)) {
81
+ const index = slots.get(name);
82
+ if (index !== undefined)
83
+ attributes[index] = value;
84
+ }
85
+ return attributes;
86
+ }
87
+ function slotIsAuthored(id, index, name, created, view) {
88
+ return created !== undefined
89
+ || view?.getPositionalMutationsForEntity(id)?.has(index) === true
90
+ || view?.getAttributeMutationsForEntity(id).some((change) => change.name === name) === true;
91
+ }
92
+ function addRawEdges(dataStore, graph, effective, view) {
93
+ const relationships = dataStore.relationships;
94
+ if (!relationships)
95
+ return;
96
+ const relations = new Map();
97
+ for (const row of flattenRelationshipEdges(relationships.forward)) {
98
+ const relation = relations.get(row.relationshipId)
99
+ ?? { type: row.type, parent: row.sourceId, children: [] };
100
+ relation.children.push(row.targetId);
101
+ relations.set(row.relationshipId, relation);
102
+ }
103
+ const declarationOrder = new Map();
104
+ for (const row of flattenRelationshipEdges(relationships.inverse)) {
105
+ if (!declarationOrder.has(row.relationshipId))
106
+ declarationOrder.set(row.relationshipId, declarationOrder.size);
107
+ }
108
+ const created = new Map((view?.getNewEntities() ?? []).map((entity) => [entity.expressId, entity]));
109
+ const orderedRelations = [...relations].sort(([left], [right]) => (declarationOrder.get(left) ?? 0) - (declarationOrder.get(right) ?? 0));
110
+ for (const [id, relation] of orderedRelations) {
111
+ const rawDecomposition = relation.type === RelationshipType.Aggregates || relation.type === RelationshipType.Nests;
112
+ const rawContainment = relation.type === RelationshipType.ContainsElements;
113
+ const rawType = relation.type === RelationshipType.Nests ? 'IFCRELNESTS'
114
+ : rawDecomposition ? 'IFCRELAGGREGATES' : rawContainment
115
+ ? 'IFCRELCONTAINEDINSPATIALSTRUCTURE' : dataStore.entityIndex.byId.get(id)?.type ?? '';
116
+ const effectiveType = effective.typeOf(id);
117
+ const type = effectiveType ?? rawType;
118
+ const isDecomposition = type === 'IFCRELAGGREGATES' || type === 'IFCRELNESTS';
119
+ const isContainment = type === 'IFCRELCONTAINEDINSPATIALSTRUCTURE';
120
+ if (!rawDecomposition && !rawContainment && !isDecomposition && !isContainment)
121
+ continue;
122
+ const typeChanged = effectiveType !== undefined && effectiveType !== rawType;
123
+ const parentIndex = isDecomposition ? 4 : 5;
124
+ const childrenIndex = isDecomposition ? 5 : 4;
125
+ const endpointsAuthored = slotIsAuthored(id, parentIndex, isDecomposition ? 'RelatingObject' : 'RelatingStructure', undefined, view) || slotIsAuthored(id, childrenIndex, isDecomposition ? 'RelatedObjects' : 'RelatedElements', undefined, view);
126
+ const modified = effective.isDeleted(id) || typeChanged || endpointsAuthored;
127
+ if (rawDecomposition && modified)
128
+ graph.decompositionModified = true;
129
+ if (rawContainment && modified)
130
+ graph.containmentModified = true;
131
+ if (isDecomposition && (typeChanged || endpointsAuthored))
132
+ graph.decompositionModified = true;
133
+ if (isContainment && (typeChanged || endpointsAuthored))
134
+ graph.containmentModified = true;
135
+ if (effective.isDeleted(id))
136
+ continue;
137
+ if (!isDecomposition && !isContainment)
138
+ continue;
139
+ const source = rawDecomposition && isDecomposition
140
+ ? [null, null, null, null, relation.parent, relation.children]
141
+ : rawContainment && isContainment
142
+ ? [null, null, null, null, relation.children, relation.parent]
143
+ : new Array(6).fill(null);
144
+ const attributes = effectiveAttributes(id, source, undefined, view);
145
+ const parentId = refs(attributes[isDecomposition ? 4 : 5], modified)[0];
146
+ const edges = isDecomposition ? graph.decomposition : graph.containment;
147
+ if (parentId === undefined || !existsOrWasDeleted(effective, parentId))
148
+ continue;
149
+ for (const childId of refs(attributes[isDecomposition ? 5 : 4], modified)) {
150
+ if (existsOrWasDeleted(effective, childId))
151
+ addEdge(edges, parentId, childId);
152
+ }
153
+ }
154
+ for (const entity of created.values()) {
155
+ const type = effective.typeOf(entity.expressId);
156
+ const decomposition = type === 'IFCRELAGGREGATES' || type === 'IFCRELNESTS';
157
+ const containment = type === 'IFCRELCONTAINEDINSPATIALSTRUCTURE';
158
+ if (!decomposition && !containment)
159
+ continue;
160
+ if (decomposition)
161
+ graph.decompositionModified = true;
162
+ else
163
+ graph.containmentModified = true;
164
+ const attributes = effectiveAttributes(entity.expressId, undefined, entity, view);
165
+ const parentId = refs(attributes[decomposition ? 4 : 5], true)[0];
166
+ if (parentId === undefined || !existsOrWasDeleted(effective, parentId))
167
+ continue;
168
+ const edges = decomposition ? graph.decomposition : graph.containment;
169
+ for (const childId of refs(attributes[decomposition ? 5 : 4], true)) {
170
+ if (existsOrWasDeleted(effective, childId))
171
+ addEdge(edges, parentId, childId);
172
+ }
173
+ }
174
+ }
175
+ function buildEffectiveTreeGraph(dataStore, effective, view) {
176
+ const sourceTypes = dataStore.entityIndex.byType;
177
+ const graph = {
178
+ decomposition: newEdges(), containment: newEdges(),
179
+ // Source records still establish authority after an overlay tombstones
180
+ // every one of them; otherwise an empty effective graph would resurrect
181
+ // their stale parsed hierarchy through the synthetic-store fallback.
182
+ hasDecompositionRecords: (sourceTypes.get('IFCRELAGGREGATES')?.length ?? 0) > 0
183
+ || (sourceTypes.get('IFCRELNESTS')?.length ?? 0) > 0,
184
+ hasContainmentRecords: (sourceTypes.get('IFCRELCONTAINEDINSPATIALSTRUCTURE')?.length ?? 0) > 0,
185
+ decompositionModified: false,
186
+ containmentModified: false,
187
+ };
188
+ // Server/synthetic stores retain a truthy zero-byte source object. In that
189
+ // state the parsed RelationshipGraph is the only relationship authority.
190
+ if (dataStore.source.byteLength === 0) {
191
+ addRawEdges(dataStore, graph, effective, view);
192
+ return graph;
193
+ }
194
+ const extractor = new EntityExtractor(dataStore.source);
195
+ const created = new Map();
196
+ for (const entity of view?.getNewEntities() ?? [])
197
+ created.set(entity.expressId, entity);
198
+ // Effective iteration preserves declaration order and appends creations.
199
+ for (const [id, record] of effective) {
200
+ const type = effective.effectiveType(id, record.type);
201
+ const decomposition = type === 'IFCRELAGGREGATES' || type === 'IFCRELNESTS';
202
+ const containment = type === 'IFCRELCONTAINEDINSPATIALSTRUCTURE';
203
+ if (!decomposition && !containment)
204
+ continue;
205
+ if (decomposition)
206
+ graph.hasDecompositionRecords = true;
207
+ if (containment)
208
+ graph.hasContainmentRecords = true;
209
+ const createdEntity = created.get(id);
210
+ const sourceRef = createdEntity ? undefined : dataStore.entityIndex.byId.get(id);
211
+ const sourceEntity = sourceRef ? extractor.extractEntity(sourceRef) : null;
212
+ const attributes = effectiveAttributes(id, sourceEntity?.attributes, createdEntity, view);
213
+ if (!attributes)
214
+ continue;
215
+ const parentIndex = decomposition ? 4 : 5;
216
+ const childrenIndex = decomposition ? 5 : 4;
217
+ const parentName = decomposition ? 'RelatingObject' : 'RelatingStructure';
218
+ const childrenName = decomposition ? 'RelatedObjects' : 'RelatedElements';
219
+ const parentId = refs(attributes[parentIndex], slotIsAuthored(id, parentIndex, parentName, createdEntity, view))[0];
220
+ if (parentId === undefined || !existsOrWasDeleted(effective, parentId))
221
+ continue;
222
+ const edges = decomposition ? graph.decomposition : graph.containment;
223
+ for (const childId of refs(attributes[childrenIndex], slotIsAuthored(id, childrenIndex, childrenName, createdEntity, view))) {
224
+ if (existsOrWasDeleted(effective, childId))
225
+ addEdge(edges, parentId, childId);
226
+ }
227
+ }
228
+ return graph;
229
+ }
230
+ function seedProjectAndNames(dataStore, treeIds, names) {
231
+ const project = dataStore.spatialHierarchy?.project;
232
+ if (!project)
233
+ return false;
234
+ treeIds.add(project.expressId);
235
+ const stack = [project];
236
+ while (stack.length > 0) {
237
+ const node = stack.pop();
238
+ if (node.name)
239
+ names.set(node.expressId, node.name);
240
+ stack.push(...node.children);
241
+ }
242
+ return true;
243
+ }
244
+ function seedSourcelessSpatialFallback(dataStore, treeIds, parentOf, names, includeDecomposition, includeContainment) {
245
+ const hierarchy = dataStore.spatialHierarchy;
246
+ if (hierarchy?.project) {
247
+ const stack = [hierarchy.project];
248
+ while (stack.length > 0) {
249
+ const node = stack.pop();
250
+ if (includeDecomposition || node === hierarchy.project)
251
+ treeIds.add(node.expressId);
252
+ if (node.name)
253
+ names.set(node.expressId, node.name);
254
+ for (const child of node.children) {
255
+ if (includeDecomposition)
256
+ parentOf.set(child.expressId, node.expressId);
257
+ stack.push(child);
258
+ }
259
+ }
260
+ }
261
+ if (hierarchy && includeContainment) {
262
+ for (const map of [hierarchy.bySite, hierarchy.byBuilding, hierarchy.byStorey, hierarchy.bySpace]) {
263
+ for (const [parentId, children] of map ?? []) {
264
+ for (const childId of children ?? []) {
265
+ treeIds.add(childId);
266
+ parentOf.set(childId, parentId);
267
+ }
268
+ }
269
+ }
270
+ }
271
+ return hierarchy?.project !== undefined;
272
+ }
273
+ function closeTree(treeIds, graph) {
274
+ const pending = [...treeIds];
275
+ while (pending.length > 0) {
276
+ const id = pending.pop();
277
+ const children = [
278
+ ...(graph.decomposition.childrenByParent.get(id) ?? []),
279
+ ...(graph.containment.childrenByParent.get(id) ?? []),
280
+ ];
281
+ for (const childId of children) {
282
+ if (treeIds.has(childId))
283
+ continue;
284
+ treeIds.add(childId);
285
+ pending.push(childId);
286
+ }
287
+ }
288
+ }
289
+ function descendants(childId, edges, budget) {
290
+ const visited = new Set([childId]);
291
+ const pending = [childId];
292
+ while (pending.length > 0) {
293
+ for (const kid of edges.childrenByParent.get(pending.pop()) ?? []) {
294
+ if (--budget.visits < 0)
295
+ return null;
296
+ if (!visited.has(kid)) {
297
+ visited.add(kid);
298
+ pending.push(kid);
299
+ }
300
+ }
301
+ }
302
+ return visited;
303
+ }
304
+ function addParents(graph, treeIds, parentOf) {
305
+ // Containment remains authoritative where a file declares both mechanisms.
306
+ for (const [childId, parents] of graph.containment.parentsByChild) {
307
+ // A zero-byte/synthetic store has no record stream from which to rebuild
308
+ // effective relations; its pre-digested spatial hierarchy is canonical.
309
+ if (parentOf.has(childId))
310
+ continue;
311
+ const winner = parents.find((parent) => treeIds.has(parent)) ?? parents[0];
312
+ if (winner !== undefined)
313
+ parentOf.set(childId, winner);
314
+ }
315
+ const budget = { visits: CYCLE_CHECK_VISIT_BUDGET };
316
+ let exhausted = false;
317
+ for (const [childId, candidates] of graph.decomposition.parentsByChild) {
318
+ if (parentOf.has(childId) || candidates.length === 0)
319
+ continue;
320
+ let usable = candidates;
321
+ if (candidates.length > 1 && !exhausted) {
322
+ const below = descendants(childId, graph.decomposition, budget);
323
+ if (below === null) {
324
+ exhausted = true;
325
+ log.warn(`Aggregation cycle checks stopped after ${CYCLE_CHECK_VISIT_BUDGET} graph visits`);
326
+ }
327
+ else {
328
+ const nonCyclic = candidates.filter((candidate) => !below.has(candidate));
329
+ if (nonCyclic.length > 0)
330
+ usable = nonCyclic;
331
+ }
332
+ }
333
+ parentOf.set(childId, usable.find((parent) => treeIds.has(parent)) ?? usable[0]);
334
+ }
335
+ }
336
+ /** Build membership and hierarchy from the same effective relationship graph. */
337
+ export function buildIfc5TreeScope(dataStore, effective, view) {
338
+ const treeIds = new Set();
339
+ const parentOf = new Map();
340
+ const spatialNodeNames = new Map();
341
+ const graph = buildEffectiveTreeGraph(dataStore, effective, view);
342
+ const sourceless = dataStore.source.byteLength === 0;
343
+ const useRawDecomposition = sourceless
344
+ ? !graph.decompositionModified
345
+ : !graph.hasDecompositionRecords;
346
+ const useRawContainment = sourceless
347
+ ? !graph.containmentModified
348
+ : !graph.hasContainmentRecords;
349
+ const hasProject = useRawDecomposition || useRawContainment
350
+ ? seedSourcelessSpatialFallback(dataStore, treeIds, parentOf, spatialNodeNames, useRawDecomposition, useRawContainment)
351
+ : seedProjectAndNames(dataStore, treeIds, spatialNodeNames);
352
+ // Preserve the old malformed/no-project fallback: contained occurrences are
353
+ // still exported at the document root rather than filtering everything.
354
+ if (!hasProject)
355
+ for (const childId of graph.containment.parentsByChild.keys())
356
+ treeIds.add(childId);
357
+ closeTree(treeIds, graph);
358
+ addParents(graph, treeIds, parentOf);
359
+ return { treeIds, parentOf, spatialNodeNames };
360
+ }
361
+ //# sourceMappingURL=ifc5-tree-scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifc5-tree-scope.js","sourceRoot":"","sources":["../src/ifc5-tree-scope.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,mEAAmE;AAEnE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAqB,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,kBAAkB,EAA6B,MAAM,sBAAsB,CAAC;AACrF,MAAM,wBAAwB,GAAG,SAAS,CAAC;AAC3C,MAAM,GAAG,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC;AAsB1C,SAAS,QAAQ;IACf,OAAO,EAAE,gBAAgB,EAAE,IAAI,GAAG,EAAE,EAAE,cAAc,EAAE,IAAI,GAAG,EAAE,EAAE,iBAAiB,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;AAClG,CAAC;AAED,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO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,CAAC,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC;IACnC,MAAM,iBAAiB,GAAG,UAAU;QAClC,CAAC,CAAC,CAAC,KAAK,CAAC,mBAAmB;QAC5B,CAAC,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC;IACjC,MAAM,UAAU,GAAG,mBAAmB,IAAI,iBAAiB;QACzD,CAAC,CAAC,6BAA6B,CAC7B,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,iBAAiB,CACvF;QACD,CAAC,CAAC,mBAAmB,CAAC,SAAS,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;IAC9D,4EAA4E;IAC5E,wEAAwE;IACxE,IAAI,CAAC,UAAU;QAAE,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,EAAE;YAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrG,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC1B,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACrC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;AACjD,CAAC"}
@@ -7,7 +7,7 @@ import { collectReferencedEntityIds, getVisibleEntityIds, filterHiddenRefsFromRe
7
7
  import { collectStyleEntities, STYLE_RESCUE_TYPES } from './style-closure.js';
8
8
  import { collectGeoreferencingEntities } from './georef-closure.js';
9
9
  import { convertStepLine, needsConversion } from './schema-converter.js';
10
- import { firstWrittenOwnerHistoryRef, OwnerHistoryFill } from './schema-converter-owner-history.js';
10
+ import { firstWrittenOwnerHistoryRef, Ifc2x3SlotFill } from './schema-converter-ifc2x3-slots.js';
11
11
  import { assembleStepBytes, assembleStepBlob } from './step-file-assembly.js';
12
12
  import { getCompleteEntityIndex, getMaxExpressId } from './entity-iteration.js';
13
13
  import { StepExporter } from './step-exporter.js';
@@ -149,7 +149,7 @@ export class MergedExporter {
149
149
  let federatedModelCount = 0;
150
150
  let normalizedModelCount = 0;
151
151
  const normalizeWarnings = new Set();
152
- const ownerHistory = new OwnerHistoryFill(); // IFC2X3 `$` OwnerHistory slots (#4686)
152
+ const slotFill = new Ifc2x3SlotFill(); // slots IFC2X3 requires (#4686, #4714)
153
153
  for (const model of models) {
154
154
  const offset = setup.modelOffsets.get(model.id);
155
155
  const source = model.dataStore.source;
@@ -170,18 +170,18 @@ export class MergedExporter {
170
170
  this.applyContainerDrops(plan, containerDrops?.byModel.get(model.id));
171
171
  const written = (id) => (visibility === null || visibility.included.has(id)) && !plan.skipEntityIds.has(id);
172
172
  if (schema === 'IFC2X3')
173
- ownerHistory.prefer(firstWrittenOwnerHistoryRef(model.dataStore.entityIndex.byType.get('IFCOWNERHISTORY'), written, offset));
173
+ slotFill.prefer(firstWrittenOwnerHistoryRef(model.dataStore.entityIndex.byType.get('IFCOWNERHISTORY'), written, offset));
174
174
  const sourceSchema = model.dataStore.schemaVersion || 'IFC4';
175
175
  for (const [expressId, entityRef] of completeIndex) {
176
176
  if (!written(expressId))
177
177
  continue;
178
- const line = this.renderEntity(expressId, entityRef, source, offset, plan, sourceSchema, schema, guidToFinalId, mode, visibility?.hiddenProductIds ?? null, completeIndex, visibility?.included ?? null, ownerHistory);
178
+ const line = this.renderEntity(expressId, entityRef, source, offset, plan, sourceSchema, schema, guidToFinalId, mode, visibility?.hiddenProductIds ?? null, completeIndex, visibility?.included ?? null, slotFill);
179
179
  if (line !== null)
180
180
  allEntityLines.push(line);
181
181
  }
182
182
  isFirstModel = false;
183
183
  }
184
- for (const warning of ownerHistory.unfilledWarnings())
184
+ for (const warning of slotFill.warnings())
185
185
  normalizeWarnings.add(warning);
186
186
  // Assemble final file as Uint8Array chunks to avoid V8 string length limit
187
187
  if (onProgress)
@@ -263,7 +263,7 @@ export class MergedExporter {
263
263
  let normalizedModelCount = 0;
264
264
  const normalizeWarnings = new Set();
265
265
  const YIELD_INTERVAL = 2000;
266
- const ownerHistory = new OwnerHistoryFill(); // IFC2X3 `$` OwnerHistory slots (#4686)
266
+ const slotFill = new Ifc2x3SlotFill(); // slots IFC2X3 requires (#4686, #4714)
267
267
  if (onProgress)
268
268
  onProgress({ phase: 'preparing', percent: 0, entitiesProcessed: 0, entitiesTotal: totalEntities });
269
269
  for (const model of models) {
@@ -293,13 +293,13 @@ export class MergedExporter {
293
293
  this.applyContainerDrops(plan, containerDrops?.byModel.get(model.id));
294
294
  const written = (id) => (visibility === null || visibility.included.has(id)) && !plan.skipEntityIds.has(id);
295
295
  if (schema === 'IFC2X3')
296
- ownerHistory.prefer(firstWrittenOwnerHistoryRef(model.dataStore.entityIndex.byType.get('IFCOWNERHISTORY'), written, offset));
296
+ slotFill.prefer(firstWrittenOwnerHistoryRef(model.dataStore.entityIndex.byType.get('IFCOWNERHISTORY'), written, offset));
297
297
  const sourceSchema = model.dataStore.schemaVersion || 'IFC4';
298
298
  let entityCount = 0;
299
299
  for (const [expressId, entityRef] of completeIndex) {
300
300
  if (!written(expressId))
301
301
  continue;
302
- const line = this.renderEntity(expressId, entityRef, source, offset, plan, sourceSchema, schema, guidToFinalId, mode, visibility?.hiddenProductIds ?? null, completeIndex, visibility?.included ?? null, ownerHistory);
302
+ const line = this.renderEntity(expressId, entityRef, source, offset, plan, sourceSchema, schema, guidToFinalId, mode, visibility?.hiddenProductIds ?? null, completeIndex, visibility?.included ?? null, slotFill);
303
303
  if (line !== null)
304
304
  allEntityLines.push(line);
305
305
  entityCount++;
@@ -320,7 +320,7 @@ export class MergedExporter {
320
320
  }
321
321
  isFirstModel = false;
322
322
  }
323
- for (const warning of ownerHistory.unfilledWarnings())
323
+ for (const warning of slotFill.warnings())
324
324
  normalizeWarnings.add(warning);
325
325
  // Assembly phase
326
326
  if (onProgress) {
@@ -745,7 +745,7 @@ export class MergedExporter {
745
745
  * every named subject was hidden (below). Schema conversion never drops an
746
746
  * entity: an untranslatable one becomes an IFCPROXY or throws.
747
747
  */
748
- renderEntity(localId, entityRef, source, offset, plan, sourceSchema, targetSchema, guidToFinalId, mode, hiddenProductIds, completeIndex, includedIds, ownerHistory) {
748
+ renderEntity(localId, entityRef, source, offset, plan, sourceSchema, targetSchema, guidToFinalId, mode, hiddenProductIds, completeIndex, includedIds, slotFill) {
749
749
  let entityText = decodeRange(source, entityRef.byteOffset, entityRef.byteOffset + entityRef.byteLength);
750
750
  // A `visibleOnly` export must narrow — or entirely withhold — a
751
751
  // relationship's (and, below, a rescued style/layer entity's) own OUTPUT
@@ -817,7 +817,7 @@ export class MergedExporter {
817
817
  finalText = rescaleEntityLengths(finalText, entityRef.type.toUpperCase(), mode.lengthFactor, mode.areaFactor, mode.volumeFactor);
818
818
  }
819
819
  if (needsConversion(sourceSchema, targetSchema))
820
- finalText = convertStepLine(finalText, sourceSchema, targetSchema, undefined, ownerHistory);
820
+ finalText = convertStepLine(finalText, sourceSchema, targetSchema, undefined, slotFill);
821
821
  // Record the emitted GlobalId → final express id + unit scale, for rooted
822
822
  // entities only. Read it from the FINAL line, not the source: schema
823
823
  // conversion can replace an unsupported rooted type with an IFCPROXY that