@ifc-lite/export 4.7.2 → 4.8.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 (96) hide show
  1. package/dist/entity-subgraph.d.ts +56 -0
  2. package/dist/entity-subgraph.d.ts.map +1 -0
  3. package/dist/entity-subgraph.js +138 -0
  4. package/dist/entity-subgraph.js.map +1 -0
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +7 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/lod0-generator.d.ts.map +1 -1
  10. package/dist/lod0-generator.js +4 -1
  11. package/dist/lod0-generator.js.map +1 -1
  12. package/dist/merged-empty-containers-refs.d.ts +24 -0
  13. package/dist/merged-empty-containers-refs.d.ts.map +1 -0
  14. package/dist/merged-empty-containers-refs.js +126 -0
  15. package/dist/merged-empty-containers-refs.js.map +1 -0
  16. package/dist/merged-empty-containers.d.ts +36 -1
  17. package/dist/merged-empty-containers.d.ts.map +1 -1
  18. package/dist/merged-empty-containers.js +21 -126
  19. package/dist/merged-empty-containers.js.map +1 -1
  20. package/dist/merged-exporter.d.ts +4 -1
  21. package/dist/merged-exporter.d.ts.map +1 -1
  22. package/dist/merged-exporter.js +42 -39
  23. package/dist/merged-exporter.js.map +1 -1
  24. package/dist/merged-guid.d.ts +4 -0
  25. package/dist/merged-guid.d.ts.map +1 -1
  26. package/dist/merged-guid.js +14 -0
  27. package/dist/merged-guid.js.map +1 -1
  28. package/dist/merged-inverse-claims.d.ts +154 -0
  29. package/dist/merged-inverse-claims.d.ts.map +1 -0
  30. package/dist/merged-inverse-claims.js +306 -0
  31. package/dist/merged-inverse-claims.js.map +1 -0
  32. package/dist/merged-planner-guids.d.ts +32 -0
  33. package/dist/merged-planner-guids.d.ts.map +1 -0
  34. package/dist/merged-planner-guids.js +79 -0
  35. package/dist/merged-planner-guids.js.map +1 -0
  36. package/dist/merged-subcontext.d.ts.map +1 -1
  37. package/dist/merged-subcontext.js +1 -0
  38. package/dist/merged-subcontext.js.map +1 -1
  39. package/dist/parquet-exporter.d.ts.map +1 -1
  40. package/dist/parquet-exporter.js +25 -23
  41. package/dist/parquet-exporter.js.map +1 -1
  42. package/dist/parquet-spatial-rows.d.ts +14 -0
  43. package/dist/parquet-spatial-rows.d.ts.map +1 -0
  44. package/dist/parquet-spatial-rows.js +57 -0
  45. package/dist/parquet-spatial-rows.js.map +1 -0
  46. package/dist/property-value-serialization.d.ts.map +1 -1
  47. package/dist/property-value-serialization.js +2 -1
  48. package/dist/property-value-serialization.js.map +1 -1
  49. package/dist/reference-collector.js +3 -0
  50. package/dist/reference-collector.js.map +1 -1
  51. package/dist/related-entities.d.ts.map +1 -1
  52. package/dist/related-entities.js +6 -0
  53. package/dist/related-entities.js.map +1 -1
  54. package/dist/remesh-context-roots.d.ts +36 -0
  55. package/dist/remesh-context-roots.d.ts.map +1 -0
  56. package/dist/remesh-context-roots.js +126 -0
  57. package/dist/remesh-context-roots.js.map +1 -0
  58. package/dist/step-collection.js +1 -1
  59. package/dist/step-collection.js.map +1 -1
  60. package/dist/step-export-types.d.ts +2 -0
  61. package/dist/step-export-types.d.ts.map +1 -1
  62. package/dist/step-omission-predicates.d.ts +8 -0
  63. package/dist/step-omission-predicates.d.ts.map +1 -1
  64. package/dist/step-omission-predicates.js +11 -1
  65. package/dist/step-omission-predicates.js.map +1 -1
  66. package/dist/step-overlay-entities.d.ts.map +1 -1
  67. package/dist/step-overlay-entities.js +23 -1
  68. package/dist/step-overlay-entities.js.map +1 -1
  69. package/dist/step-pass-builder.d.ts.map +1 -1
  70. package/dist/step-pass-builder.js +1 -0
  71. package/dist/step-pass-builder.js.map +1 -1
  72. package/dist/step-property-set-collection.d.ts +2 -0
  73. package/dist/step-property-set-collection.d.ts.map +1 -1
  74. package/dist/step-property-set-collection.js +42 -21
  75. package/dist/step-property-set-collection.js.map +1 -1
  76. package/dist/step-property-set-generators.d.ts +1 -1
  77. package/dist/step-property-set-generators.d.ts.map +1 -1
  78. package/dist/step-property-set-generators.js +19 -2
  79. package/dist/step-property-set-generators.js.map +1 -1
  80. package/dist/step-property-set-index.js +5 -2
  81. package/dist/step-property-set-index.js.map +1 -1
  82. package/dist/step-property-sets.d.ts.map +1 -1
  83. package/dist/step-property-sets.js +5 -2
  84. package/dist/step-property-sets.js.map +1 -1
  85. package/dist/step-pset-copy-on-write.d.ts +75 -0
  86. package/dist/step-pset-copy-on-write.d.ts.map +1 -0
  87. package/dist/step-pset-copy-on-write.js +146 -0
  88. package/dist/step-pset-copy-on-write.js.map +1 -0
  89. package/dist/step-source-iteration.d.ts.map +1 -1
  90. package/dist/step-source-iteration.js +7 -0
  91. package/dist/step-source-iteration.js.map +1 -1
  92. package/package.json +11 -10
  93. package/dist/merged-rel-aggregates.d.ts +0 -63
  94. package/dist/merged-rel-aggregates.d.ts.map +0 -1
  95. package/dist/merged-rel-aggregates.js +0 -122
  96. package/dist/merged-rel-aggregates.js.map +0 -1
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Copy-on-write for property and quantity sets an edit reaches through a
3
+ * SHARED `IfcRelDefinesByProperties` (#5794).
4
+ *
5
+ * Authoring tools routinely relate one `IfcPropertySet` to many elements
6
+ * through one relation. The viewer edits ONE element's properties, so the
7
+ * export must change that element only: it gets its own regenerated set and
8
+ * its own relation (the generators already write both), it leaves the shared
9
+ * relation's `RelatedObjects`, and every other element keeps the original
10
+ * set, byte for byte. The relation and the set are withheld only when no
11
+ * surviving element is left on them.
12
+ *
13
+ * A type object's own set (`HasPropertySets`) follows the same rule: another
14
+ * type object naming the same set keeps it.
15
+ *
16
+ * The regenerated copy references the source member atom of every property
17
+ * the session did not edit instead of re-serializing it as a single value, so
18
+ * list, enumerated, bounded, table, reference and complex members keep their
19
+ * IFC class. IFC allows the sharing: `IfcProperty.PartOfPset` is
20
+ * `SET [0:?]` in IFC4/IFC4X3, and IFC2X3 declares no such inverse.
21
+ */
22
+ import type { MutablePropertyView } from '@ifc-lite/mutations';
23
+ import type { ExportPass } from './step-export-types.js';
24
+ import { type PropertySetContext } from './step-property-set-readers.js';
25
+ /** What `settle` reads to tell whether anything else still names a set. */
26
+ export interface RelationIndex {
27
+ /** Every effective IfcRelDefinesByProperties → its RelatedObjects. */
28
+ readonly relatedByRel: ReadonlyMap<number, readonly number[]>;
29
+ /** Element → the relations (and their set) that relate it. */
30
+ readonly relDefinesByEntity: ReadonlyMap<number, ReadonlyArray<{
31
+ relId: number;
32
+ psetId: number;
33
+ }>>;
34
+ }
35
+ /**
36
+ * The shared sets one collection pass has taken an edited owner off: a
37
+ * relation's related element, or a type object's `HasPropertySets` entry.
38
+ */
39
+ export declare class SharedSetDetachments {
40
+ private readonly byRel;
41
+ /** Type-owned set id → the type objects whose own copy replaces it. */
42
+ private readonly typeOwned;
43
+ /** `entityId` gets its own copy of the set `relId` relates it to. */
44
+ detach(relId: number, setId: number, entityId: number): void;
45
+ /** Type object `typeId` drops `setId` from its `HasPropertySets`. */
46
+ withholdTypeOwned(setId: number, typeId: number): void;
47
+ /**
48
+ * Decide, once every edit is collected, what each touched set becomes. A
49
+ * relation that still relates an element this export writes is narrowed at write time
50
+ * (`pass.detachedRelatedObjects`) and keeps its set and members; so does a
51
+ * type-owned set another type object or a surviving relation still names.
52
+ * Anything left with nobody is withheld with its member atoms, as before
53
+ * #5794; `retainSharedAtoms` still rescues an atom another set names.
54
+ */
55
+ settle(pass: ExportPass, ctx: PropertySetContext, index: RelationIndex): void;
56
+ }
57
+ /**
58
+ * Property name → source member atom id, for every member of `setId` whose
59
+ * property the session left unedited on `entityId`. The first member wins a
60
+ * duplicated name, matching what the base property read shows.
61
+ */
62
+ export declare function unmodifiedSourceMembers(ctx: PropertySetContext, view: MutablePropertyView, entityId: number, setName: string, setId: number): Map<string, number>;
63
+ /**
64
+ * Keep every member atom a regenerated copy references. Runs after all skip
65
+ * decisions: an atom deduplicated across sets can be withheld by a different
66
+ * edit, and the copy would then name a line nobody wrote.
67
+ */
68
+ export declare function retainReusedSourceMembers(pass: ExportPass): void;
69
+ /**
70
+ * Take the elements that got their own copy out of a shared relation's
71
+ * `RelatedObjects`. `null` when nothing would remain, which `settle` rules out
72
+ * for the effective relation; the caller withholds the line in that case.
73
+ */
74
+ export declare function detachRelatedObjects(pass: ExportPass, relId: number, line: string): string | null;
75
+ //# sourceMappingURL=step-pset-copy-on-write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-pset-copy-on-write.d.ts","sourceRoot":"","sources":["../src/step-pset-copy-on-write.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EACL,KAAK,kBAAkB,EAGxB,MAAM,gCAAgC,CAAC;AAIxC,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;IAC9D,8DAA8D;IAC9D,QAAQ,CAAC,kBAAkB,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;CACpG;AAED;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA+D;IACrF,uEAAuE;IACvE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkC;IAE5D,qEAAqE;IACrE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAS5D,qEAAqE;IACrE,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAStD;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,kBAAkB,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI;CA+C9E;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,kBAAkB,EACvB,IAAI,EAAE,mBAAmB,EACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAcrB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAMhE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIjG"}
@@ -0,0 +1,146 @@
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
+ import { filterHiddenRefsFromRelationshipLine } from './reference-collector.js';
5
+ import { getPropertyIdsInSet, getTypeOwnedHasPropertySetIds, } from './step-property-set-readers.js';
6
+ import { isTypeClass } from './type-owned-psets.js';
7
+ import { isOmittedFromPassOutput } from './step-omission-predicates.js';
8
+ /**
9
+ * The shared sets one collection pass has taken an edited owner off: a
10
+ * relation's related element, or a type object's `HasPropertySets` entry.
11
+ */
12
+ export class SharedSetDetachments {
13
+ byRel = new Map();
14
+ /** Type-owned set id → the type objects whose own copy replaces it. */
15
+ typeOwned = new Map();
16
+ /** `entityId` gets its own copy of the set `relId` relates it to. */
17
+ detach(relId, setId, entityId) {
18
+ let entry = this.byRel.get(relId);
19
+ if (!entry) {
20
+ entry = { setId, detached: new Set() };
21
+ this.byRel.set(relId, entry);
22
+ }
23
+ entry.detached.add(entityId);
24
+ }
25
+ /** Type object `typeId` drops `setId` from its `HasPropertySets`. */
26
+ withholdTypeOwned(setId, typeId) {
27
+ let owners = this.typeOwned.get(setId);
28
+ if (!owners) {
29
+ owners = new Set();
30
+ this.typeOwned.set(setId, owners);
31
+ }
32
+ owners.add(typeId);
33
+ }
34
+ /**
35
+ * Decide, once every edit is collected, what each touched set becomes. A
36
+ * relation that still relates an element this export writes is narrowed at write time
37
+ * (`pass.detachedRelatedObjects`) and keeps its set and members; so does a
38
+ * type-owned set another type object or a surviving relation still names.
39
+ * Anything left with nobody is withheld with its member atoms, as before
40
+ * #5794; `retainSharedAtoms` still rescues an atom another set names.
41
+ */
42
+ settle(pass, ctx, index) {
43
+ // The export filter's own predicate: an owner that is deleted, hidden or
44
+ // unwritable keeps nothing, or a kept set's relation would be narrowed to
45
+ // nobody at write time and the set shipped as an orphan.
46
+ const survives = (id) => !isOmittedFromPassOutput(pass, id);
47
+ const withhold = (setId) => {
48
+ pass.skipPropertySetIds.add(setId);
49
+ for (const memberId of getPropertyIdsInSet(ctx, setId))
50
+ pass.skipPropertySetIds.add(memberId);
51
+ };
52
+ const keptByRelation = new Set();
53
+ const touchedSetByRel = new Map();
54
+ for (const [relId, { setId, detached }] of this.byRel) {
55
+ touchedSetByRel.set(relId, setId);
56
+ const related = index.relatedByRel.get(relId) ?? [];
57
+ if (related.some((id) => !detached.has(id) && survives(id))) {
58
+ pass.detachedRelatedObjects.set(relId, detached);
59
+ keptByRelation.add(setId);
60
+ continue;
61
+ }
62
+ pass.skipRelationshipIds.add(relId);
63
+ withhold(setId);
64
+ }
65
+ if (this.typeOwned.size === 0)
66
+ return;
67
+ // Only paid for when a type object's own set was edited: every other
68
+ // owner of those sets, among live type objects and live relations.
69
+ const stillNamed = new Set(keptByRelation);
70
+ for (const [entityId, rels] of index.relDefinesByEntity) {
71
+ if (!survives(entityId))
72
+ continue;
73
+ for (const { relId, psetId } of rels) {
74
+ if (touchedSetByRel.has(relId) || !this.typeOwned.has(psetId))
75
+ continue;
76
+ if (!pass.skipRelationshipIds.has(relId))
77
+ stillNamed.add(psetId);
78
+ }
79
+ }
80
+ for (const [type, ids] of pass.effective.byType) {
81
+ if (!isTypeClass(type.toUpperCase()))
82
+ continue;
83
+ for (const typeId of ids) {
84
+ if (!survives(typeId))
85
+ continue;
86
+ for (const setId of getTypeOwnedHasPropertySetIds(ctx, typeId, pass.effective)) {
87
+ if (this.typeOwned.get(setId)?.has(typeId) === false)
88
+ stillNamed.add(setId);
89
+ }
90
+ }
91
+ }
92
+ for (const setId of this.typeOwned.keys()) {
93
+ if (!stillNamed.has(setId))
94
+ withhold(setId);
95
+ }
96
+ }
97
+ }
98
+ /**
99
+ * Property name → source member atom id, for every member of `setId` whose
100
+ * property the session left unedited on `entityId`. The first member wins a
101
+ * duplicated name, matching what the base property read shows.
102
+ */
103
+ export function unmodifiedSourceMembers(ctx, view, entityId, setName, setId) {
104
+ const members = new Map();
105
+ const extractor = ctx.entityExtractor;
106
+ if (!extractor || typeof view.getPropertyMutation !== 'function')
107
+ return members;
108
+ for (const memberId of getPropertyIdsInSet(ctx, setId)) {
109
+ // @raw-entity-enumeration-ok point lookup for a source member's decoded Name
110
+ const ref = ctx.dataStore.entityIndex.byId.get(memberId);
111
+ if (!ref || !ctx.isReadableSourceRef(ref))
112
+ continue;
113
+ const name = extractor.extractEntity(ref)?.attributes[0];
114
+ if (typeof name !== 'string' || members.has(name))
115
+ continue;
116
+ if (view.getPropertyMutation(entityId, setName, name) !== undefined)
117
+ continue;
118
+ members.set(name, memberId);
119
+ }
120
+ return members;
121
+ }
122
+ /**
123
+ * Keep every member atom a regenerated copy references. Runs after all skip
124
+ * decisions: an atom deduplicated across sets can be withheld by a different
125
+ * edit, and the copy would then name a line nobody wrote.
126
+ */
127
+ export function retainReusedSourceMembers(pass) {
128
+ for (const { sourceMembers } of pass.newPropertySets) {
129
+ for (const members of sourceMembers?.values() ?? []) {
130
+ for (const memberId of members.values())
131
+ pass.skipPropertySetIds.delete(memberId);
132
+ }
133
+ }
134
+ }
135
+ /**
136
+ * Take the elements that got their own copy out of a shared relation's
137
+ * `RelatedObjects`. `null` when nothing would remain, which `settle` rules out
138
+ * for the effective relation; the caller withholds the line in that case.
139
+ */
140
+ export function detachRelatedObjects(pass, relId, line) {
141
+ const detached = pass.detachedRelatedObjects.get(relId);
142
+ if (!detached)
143
+ return line;
144
+ return filterHiddenRefsFromRelationshipLine(line, (id) => detached.has(id));
145
+ }
146
+ //# sourceMappingURL=step-pset-copy-on-write.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-pset-copy-on-write.js","sourceRoot":"","sources":["../src/step-pset-copy-on-write.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA0B/D,OAAO,EAAE,oCAAoC,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAEL,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAUxE;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IACd,KAAK,GAAG,IAAI,GAAG,EAAoD,CAAC;IACrF,uEAAuE;IACtD,SAAS,GAAG,IAAI,GAAG,EAAuB,CAAC;IAE5D,qEAAqE;IACrE,MAAM,CAAC,KAAa,EAAE,KAAa,EAAE,QAAgB;QACnD,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,KAAK,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;YACvC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC/B,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED,qEAAqE;IACrE,iBAAiB,CAAC,KAA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BAAsB,GAC1B,IAAI,CA4NN"}
@@ -11,6 +11,7 @@ import { convertStepLine } from './schema-converter.js';
11
11
  import { nominateDeliveredInPlaceEdits } from './in-place-nomination.js';
12
12
  import { decodeRange } from './source-ref-bounds.js';
13
13
  import { retainSharedAtoms } from './step-shared-atom-retention.js';
14
+ import { detachRelatedObjects } from './step-pset-copy-on-write.js';
14
15
  import { IFC_ENTITY_NAMES } from '@ifc-lite/data';
15
16
  /**
16
17
  * Write every source-backed record this export keeps, into `pass.entities`.
@@ -108,6 +109,12 @@ export function writeSourceEntityLines(pass, options, mayNameOmittedRefs, isOmit
108
109
  const mutationWarnings = [];
109
110
  const mutated = applySourceLineMutationsReported(ctx.applySourceLineMutations, mutationWarnings, expressId, entityText, entityRef.type, pass.modifiedAttributes.get(expressId), pass.sourceSchema, pass.overlayActive);
110
111
  let nextEntityText = mutated.text;
112
+ // A shared IfcRelDefinesByProperties loses the elements that got their
113
+ // own copy of its set this export; the rest keep the original (#5794).
114
+ const narrowed = detachRelatedObjects(pass, expressId, nextEntityText);
115
+ if (narrowed === null)
116
+ continue;
117
+ nextEntityText = narrowed;
111
118
  // A hidden PRODUCT's own line is already out of the export via
112
119
  // `allowedEntityIds`, and a TOMBSTONED entity's via `effective` — this
113
120
  // is the relationship that NAMED either one. `IFCREL*` is an
@@ -1 +1 @@
1
- {"version":3,"file":"step-source-iteration.js","sourceRoot":"","sources":["../src/step-source-iteration.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAqD/D,OAAO,EAAE,oCAAoC,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,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,IAAI,CAAC,KAAK,CAAC,CAAC;gBACtK,IAAI,SAAS,KAAK,IAAI;oBAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACxD,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ifc-lite/export",
3
- "version": "4.7.2",
3
+ "version": "4.8.0",
4
4
  "description": "Export formats for IFC-Lite",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,18 +15,19 @@
15
15
  "dependencies": {
16
16
  "parquet-wasm": "^0.8.0",
17
17
  "apache-arrow": "^21.2.0",
18
- "jszip": "^3.10.2",
19
- "@ifc-lite/geometry": "^7.5.1",
20
- "@ifc-lite/codegen": "^1.18.0",
21
- "@ifc-lite/data": "^5.3.0",
22
- "@ifc-lite/encoding": "^2.2.0",
23
- "@ifc-lite/parser": "^8.2.0",
24
- "@ifc-lite/ifcx": "^4.2.0",
25
- "@ifc-lite/mutations": "^2.7.0"
18
+ "fflate": "^0.8.3",
19
+ "@ifc-lite/geometry": "^7.6.0",
20
+ "@ifc-lite/codegen": "^1.18.1",
21
+ "@ifc-lite/data": "^6.1.0",
22
+ "@ifc-lite/encoding": "^2.3.0",
23
+ "@ifc-lite/parser": "^9.1.0",
24
+ "@ifc-lite/mutations": "^3.0.0",
25
+ "@ifc-lite/ifcx": "^4.3.0"
26
26
  },
27
27
  "devDependencies": {
28
+ "jszip": "^3.10.2",
28
29
  "typescript": "^6.0.3",
29
- "vitest": "^5.0.1"
30
+ "vitest": "^5.0.2"
30
31
  },
31
32
  "license": "MPL-2.0",
32
33
  "author": "Louis True",
@@ -1,63 +0,0 @@
1
- /**
2
- * Partial-redundancy bookkeeping for IFCRELAGGREGATES during a merge.
3
- *
4
- * Split out of {@link ../merged-exporter.ts} (kept under its module-size
5
- * budget) rather than duplicated: `findEntitiesByType`/`extractStepAttribute`
6
- * stay the single source of truth in `MergedExporter` and are passed in here,
7
- * so this file has no data-model logic of its own to drift from it.
8
- */
9
- import type { IfcDataStore } from '@ifc-lite/parser';
10
- /**
11
- * Skip IfcRelAggregates that become fully redundant after spatial
12
- * unification, and mark the individually-redundant members of ones only
13
- * PARTIALLY so for stripping.
14
- *
15
- * When Model2's `IfcRelAggregates(Project, (Site))` gets remapped to
16
- * `IfcRelAggregates(FirstProject, (FirstSite))`, it duplicates Model1's
17
- * existing relationship, causing viewers to show Site multiple times.
18
- *
19
- * An IfcRelAggregates is fully redundant (skipped entirely) when its
20
- * RelatingObject (attr 4) AND ALL its RelatedObjects (attr 5) remap to an
21
- * edge the primary model already declares. When only the RelatingObject and
22
- * SOME (not all) of its RelatedObjects have such a primary edge — e.g. Model2's Building
23
- * unifies with Model1's, and one of its two Storeys matches Model1's by
24
- * name while the other is new — the rel is genuinely needed for its new
25
- * member(s), but Model1's own relationship already lists the remapped
26
- * one(s) under the same (now-shared) RelatingObject: emitting them again
27
- * here would duplicate that membership. Those specific ids are recorded in
28
- * `relAggregateStrip` so {@link applyRelAggregateStrip} drops them from the
29
- * emitted RelatedObjects list, keeping only the genuinely new members.
30
- */
31
- export declare function skipRedundantRelAggregates(dataStore: IfcDataStore, sharedRemap: Map<number, number>, skipEntityIds: Set<number>, relAggregateStrip: Map<number, Set<number>>, primaryAggregatePairs: ReadonlySet<string>, findEntitiesByType: (dataStore: IfcDataStore, typeUpper: string) => number[], extractStepAttribute: (expressId: number, dataStore: IfcDataStore, attrIndex: number) => string | null): void;
32
- /** Encode one `RelatingObject → RelatedObject` aggregation edge for set lookup. */
33
- export declare function aggregatePairKey(relatingObjectId: number, relatedObjectId: number): string;
34
- /**
35
- * Collect the aggregation edges actually declared by the primary model.
36
- *
37
- * A later model may unify both endpoint entities without the primary model
38
- * declaring their relationship. Callers use this set to distinguish a truly
39
- * duplicate edge from the only surviving statement of parentage.
40
- */
41
- export declare function collectRelAggregatePairs(dataStore: IfcDataStore, findEntitiesByType: (dataStore: IfcDataStore, typeUpper: string) => number[], extractStepAttribute: (expressId: number, dataStore: IfcDataStore, attrIndex: number) => string | null, idOffset: number): Set<string>;
42
- /**
43
- * Render-time counterpart of {@link skipRedundantRelAggregates}: drop
44
- * RelatedObjects members a partially redundant IFCRELAGGREGATES already
45
- * shares with the first model's OWN relationship to the same (now-unified)
46
- * RelatingObject. Reuses the same list/scalar-aware ref filter the
47
- * `visibleOnly`/deletion dangling-ref path uses. Must run in LOCAL id
48
- * space, before any id offset/remap — `localId` and the ids inside
49
- * `relAggregateStrip` are both local to the model being rendered.
50
- *
51
- * Returns `entityText` unchanged when `localId` has no strip entry, and
52
- * `null` when the filter would withhold the whole line — a strip set built
53
- * by {@link skipRedundantRelAggregates} is a strict subset of the
54
- * RelatedObjects list, so for well-formed input the filter only narrows,
55
- * but a degenerate file (a stripped member id that also appears as a
56
- * single-valued ref, e.g. self-aggregation) can null the line. The caller
57
- * must withhold it, like every other user of the filter: every edge the
58
- * line declared is already declared by the primary model, and emitting the
59
- * unfiltered bytes instead would reintroduce the duplicate membership this
60
- * module exists to remove.
61
- */
62
- export declare function applyRelAggregateStrip(entityText: string, localId: number, relAggregateStrip: ReadonlyMap<number, ReadonlySet<number>>): string | null;
63
- //# sourceMappingURL=merged-rel-aggregates.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"merged-rel-aggregates.d.ts","sourceRoot":"","sources":["../src/merged-rel-aggregates.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,YAAY,EACvB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,EAC1B,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,EAC3C,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAAC,EAC1C,kBAAkB,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,EAAE,EAC5E,oBAAoB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GACrG,IAAI,CAoCN;AAED,mFAAmF;AACnF,wBAAgB,gBAAgB,CAAC,gBAAgB,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAE1F;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,YAAY,EACvB,kBAAkB,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,EAAE,EAC5E,oBAAoB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,EACtG,QAAQ,EAAE,MAAM,GACf,GAAG,CAAC,MAAM,CAAC,CAgBb;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,GAC1D,MAAM,GAAG,IAAI,CAIf"}
@@ -1,122 +0,0 @@
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
- import { filterHiddenRefsFromRelationshipLine } from './reference-collector.js';
5
- /**
6
- * Skip IfcRelAggregates that become fully redundant after spatial
7
- * unification, and mark the individually-redundant members of ones only
8
- * PARTIALLY so for stripping.
9
- *
10
- * When Model2's `IfcRelAggregates(Project, (Site))` gets remapped to
11
- * `IfcRelAggregates(FirstProject, (FirstSite))`, it duplicates Model1's
12
- * existing relationship, causing viewers to show Site multiple times.
13
- *
14
- * An IfcRelAggregates is fully redundant (skipped entirely) when its
15
- * RelatingObject (attr 4) AND ALL its RelatedObjects (attr 5) remap to an
16
- * edge the primary model already declares. When only the RelatingObject and
17
- * SOME (not all) of its RelatedObjects have such a primary edge — e.g. Model2's Building
18
- * unifies with Model1's, and one of its two Storeys matches Model1's by
19
- * name while the other is new — the rel is genuinely needed for its new
20
- * member(s), but Model1's own relationship already lists the remapped
21
- * one(s) under the same (now-shared) RelatingObject: emitting them again
22
- * here would duplicate that membership. Those specific ids are recorded in
23
- * `relAggregateStrip` so {@link applyRelAggregateStrip} drops them from the
24
- * emitted RelatedObjects list, keeping only the genuinely new members.
25
- */
26
- export function skipRedundantRelAggregates(dataStore, sharedRemap, skipEntityIds, relAggregateStrip, primaryAggregatePairs, findEntitiesByType, extractStepAttribute) {
27
- for (const relId of findEntitiesByType(dataStore, 'IFCRELAGGREGATES')) {
28
- // RelatingObject is attr 4 — single #ref
29
- const relatingAttr = extractStepAttribute(relId, dataStore, 4);
30
- if (!relatingAttr)
31
- continue;
32
- const relatingRef = relatingAttr.match(/^#(\d+)$/);
33
- if (!relatingRef || !sharedRemap.has(parseInt(relatingRef[1], 10)))
34
- continue;
35
- // RelatedObjects is attr 5 — list of #refs like (#2,#3)
36
- const relatedAttr = extractStepAttribute(relId, dataStore, 5);
37
- if (!relatedAttr)
38
- continue;
39
- const refs = [];
40
- const refRegex = /#(\d+)/g;
41
- let m;
42
- while ((m = refRegex.exec(relatedAttr)) !== null) {
43
- refs.push(parseInt(m[1], 10));
44
- }
45
- if (refs.length === 0)
46
- continue;
47
- const remappedRelatingObject = sharedRemap.get(parseInt(relatingRef[1], 10));
48
- // An object identity match alone does not prove that the primary model
49
- // already owns this aggregation edge. Preserve a matched member when this
50
- // is the only relationship that establishes its parentage (#3550).
51
- const redundantRefs = refs.filter(ref => {
52
- const remappedRef = sharedRemap.get(ref);
53
- return remappedRef !== undefined && primaryAggregatePairs.has(aggregatePairKey(remappedRelatingObject, remappedRef));
54
- });
55
- if (redundantRefs.length === refs.length) {
56
- // Every edge already exists in the primary model — this rel is fully redundant.
57
- skipEntityIds.add(relId);
58
- }
59
- else if (redundantRefs.length > 0) {
60
- // Some, not all — keep the rel for its new member(s), but drop the
61
- // ones Model1's own relationship already aggregates.
62
- relAggregateStrip.set(relId, new Set(redundantRefs));
63
- }
64
- }
65
- }
66
- /** Encode one `RelatingObject → RelatedObject` aggregation edge for set lookup. */
67
- export function aggregatePairKey(relatingObjectId, relatedObjectId) {
68
- return `${relatingObjectId}:${relatedObjectId}`;
69
- }
70
- /**
71
- * Collect the aggregation edges actually declared by the primary model.
72
- *
73
- * A later model may unify both endpoint entities without the primary model
74
- * declaring their relationship. Callers use this set to distinguish a truly
75
- * duplicate edge from the only surviving statement of parentage.
76
- */
77
- export function collectRelAggregatePairs(dataStore, findEntitiesByType, extractStepAttribute, idOffset) {
78
- const pairs = new Set();
79
- for (const relId of findEntitiesByType(dataStore, 'IFCRELAGGREGATES')) {
80
- const relatingAttr = extractStepAttribute(relId, dataStore, 4);
81
- const relatingRef = relatingAttr?.match(/^#(\d+)$/);
82
- if (!relatingRef)
83
- continue;
84
- const relatedAttr = extractStepAttribute(relId, dataStore, 5);
85
- if (!relatedAttr)
86
- continue;
87
- const relatingId = parseInt(relatingRef[1], 10) + idOffset;
88
- const refRegex = /#(\d+)/g;
89
- let match;
90
- while ((match = refRegex.exec(relatedAttr)) !== null) {
91
- pairs.add(aggregatePairKey(relatingId, parseInt(match[1], 10) + idOffset));
92
- }
93
- }
94
- return pairs;
95
- }
96
- /**
97
- * Render-time counterpart of {@link skipRedundantRelAggregates}: drop
98
- * RelatedObjects members a partially redundant IFCRELAGGREGATES already
99
- * shares with the first model's OWN relationship to the same (now-unified)
100
- * RelatingObject. Reuses the same list/scalar-aware ref filter the
101
- * `visibleOnly`/deletion dangling-ref path uses. Must run in LOCAL id
102
- * space, before any id offset/remap — `localId` and the ids inside
103
- * `relAggregateStrip` are both local to the model being rendered.
104
- *
105
- * Returns `entityText` unchanged when `localId` has no strip entry, and
106
- * `null` when the filter would withhold the whole line — a strip set built
107
- * by {@link skipRedundantRelAggregates} is a strict subset of the
108
- * RelatedObjects list, so for well-formed input the filter only narrows,
109
- * but a degenerate file (a stripped member id that also appears as a
110
- * single-valued ref, e.g. self-aggregation) can null the line. The caller
111
- * must withhold it, like every other user of the filter: every edge the
112
- * line declared is already declared by the primary model, and emitting the
113
- * unfiltered bytes instead would reintroduce the duplicate membership this
114
- * module exists to remove.
115
- */
116
- export function applyRelAggregateStrip(entityText, localId, relAggregateStrip) {
117
- const toStrip = relAggregateStrip.get(localId);
118
- if (toStrip === undefined)
119
- return entityText;
120
- return filterHiddenRefsFromRelationshipLine(entityText, id => toStrip.has(id));
121
- }
122
- //# sourceMappingURL=merged-rel-aggregates.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"merged-rel-aggregates.js","sourceRoot":"","sources":["../src/merged-rel-aggregates.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAY/D,OAAO,EAAE,oCAAoC,EAAE,MAAM,0BAA0B,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,0BAA0B,CACxC,SAAuB,EACvB,WAAgC,EAChC,aAA0B,EAC1B,iBAA2C,EAC3C,qBAA0C,EAC1C,kBAA4E,EAC5E,oBAAsG;IAEtG,KAAK,MAAM,KAAK,IAAI,kBAAkB,CAAC,SAAS,EAAE,kBAAkB,CAAC,EAAE,CAAC;QACtE,yCAAyC;QACzC,MAAM,YAAY,GAAG,oBAAoB,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;QAC/D,IAAI,CAAC,YAAY;YAAE,SAAS;QAC5B,MAAM,WAAW,GAAG,Y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