@ifc-lite/export 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/dist/anonymize-export.d.ts +60 -0
- package/dist/anonymize-export.d.ts.map +1 -0
- package/dist/anonymize-export.js +117 -0
- package/dist/anonymize-export.js.map +1 -0
- package/dist/anonymize-placement.d.ts +71 -0
- package/dist/anonymize-placement.d.ts.map +1 -0
- package/dist/anonymize-placement.js +266 -0
- package/dist/anonymize-placement.js.map +1 -0
- package/dist/anonymize-scrub.d.ts +64 -0
- package/dist/anonymize-scrub.d.ts.map +1 -0
- package/dist/anonymize-scrub.js +312 -0
- package/dist/anonymize-scrub.js.map +1 -0
- package/dist/anonymize-types.d.ts +212 -0
- package/dist/anonymize-types.d.ts.map +1 -0
- package/dist/anonymize-types.js +5 -0
- package/dist/anonymize-types.js.map +1 -0
- package/dist/declared-property-type.d.ts +19 -8
- package/dist/declared-property-type.d.ts.map +1 -1
- package/dist/declared-property-type.js +31 -9
- package/dist/declared-property-type.js.map +1 -1
- package/dist/entity-type-sets.d.ts +47 -0
- package/dist/entity-type-sets.d.ts.map +1 -0
- package/dist/entity-type-sets.js +91 -0
- package/dist/entity-type-sets.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/merged-exporter.d.ts +19 -0
- package/dist/merged-exporter.d.ts.map +1 -1
- package/dist/merged-exporter.js +1 -1
- package/dist/merged-exporter.js.map +1 -1
- package/dist/parquet-exporter.d.ts +1 -3
- package/dist/parquet-exporter.d.ts.map +1 -1
- package/dist/parquet-exporter.js +11 -10
- package/dist/parquet-exporter.js.map +1 -1
- package/dist/property-value-serialization.d.ts +54 -0
- package/dist/property-value-serialization.d.ts.map +1 -0
- package/dist/property-value-serialization.js +134 -0
- package/dist/property-value-serialization.js.map +1 -0
- package/dist/reference-collector.d.ts +47 -0
- package/dist/reference-collector.d.ts.map +1 -1
- package/dist/reference-collector.js +88 -156
- package/dist/reference-collector.js.map +1 -1
- package/dist/related-entities.d.ts +10 -0
- package/dist/related-entities.d.ts.map +1 -0
- package/dist/related-entities.js +259 -0
- package/dist/related-entities.js.map +1 -0
- package/dist/schema-converter.d.ts.map +1 -1
- package/dist/schema-converter.js +46 -96
- package/dist/schema-converter.js.map +1 -1
- package/dist/source-ref-bounds.d.ts +3 -3
- package/dist/source-ref-bounds.js +3 -3
- package/dist/step-attribute-mutations.d.ts +0 -42
- package/dist/step-attribute-mutations.d.ts.map +1 -1
- package/dist/step-attribute-mutations.js +17 -147
- package/dist/step-attribute-mutations.js.map +1 -1
- package/dist/step-attribute-serializers.d.ts +41 -0
- package/dist/step-attribute-serializers.d.ts.map +1 -0
- package/dist/step-attribute-serializers.js +74 -0
- package/dist/step-attribute-serializers.js.map +1 -0
- package/dist/step-collection.d.ts +2 -2
- package/dist/step-collection.d.ts.map +1 -1
- package/dist/step-collection.js +38 -8
- package/dist/step-collection.js.map +1 -1
- package/dist/step-export-contexts.d.ts +5 -7
- package/dist/step-export-contexts.d.ts.map +1 -1
- package/dist/step-export-contexts.js +6 -7
- package/dist/step-export-contexts.js.map +1 -1
- package/dist/step-export-types.d.ts +27 -0
- package/dist/step-export-types.d.ts.map +1 -1
- package/dist/step-export-types.js.map +1 -1
- package/dist/step-exporter.d.ts +3 -3
- package/dist/step-exporter.js +4 -4
- package/dist/step-exporter.js.map +1 -1
- package/dist/step-geometry-types.d.ts +1 -17
- package/dist/step-geometry-types.d.ts.map +1 -1
- package/dist/step-geometry-types.js +51 -35
- package/dist/step-geometry-types.js.map +1 -1
- package/dist/step-georeferencing.d.ts +0 -10
- package/dist/step-georeferencing.d.ts.map +1 -1
- package/dist/step-georeferencing.js +46 -94
- package/dist/step-georeferencing.js.map +1 -1
- package/dist/step-header.d.ts +11 -1
- package/dist/step-header.d.ts.map +1 -1
- package/dist/step-header.js +2 -9
- package/dist/step-header.js.map +1 -1
- package/dist/step-map-unit.d.ts +90 -0
- package/dist/step-map-unit.d.ts.map +1 -0
- package/dist/step-map-unit.js +277 -0
- package/dist/step-map-unit.js.map +1 -0
- package/dist/step-overlay-attribute-overrides.d.ts +32 -0
- package/dist/step-overlay-attribute-overrides.d.ts.map +1 -0
- package/dist/step-overlay-attribute-overrides.js +83 -0
- package/dist/step-overlay-attribute-overrides.js.map +1 -0
- package/dist/step-overlay-entities.d.ts +3 -3
- package/dist/step-pass-builder.d.ts +4 -3
- package/dist/step-pass-builder.d.ts.map +1 -1
- package/dist/step-pass-builder.js.map +1 -1
- package/dist/step-property-set-collection.d.ts +24 -0
- package/dist/step-property-set-collection.d.ts.map +1 -0
- package/dist/step-property-set-collection.js +286 -0
- package/dist/step-property-set-collection.js.map +1 -0
- package/dist/step-property-set-generators.d.ts +20 -0
- package/dist/step-property-set-generators.d.ts.map +1 -0
- package/dist/step-property-set-generators.js +98 -0
- package/dist/step-property-set-generators.js.map +1 -0
- package/dist/step-property-set-index.d.ts +25 -0
- package/dist/step-property-set-index.d.ts.map +1 -0
- package/dist/step-property-set-index.js +69 -0
- package/dist/step-property-set-index.js.map +1 -0
- package/dist/step-property-set-readers.d.ts +158 -0
- package/dist/step-property-set-readers.d.ts.map +1 -0
- package/dist/step-property-set-readers.js +251 -0
- package/dist/step-property-set-readers.js.map +1 -0
- package/dist/step-property-sets.d.ts +2 -186
- package/dist/step-property-sets.d.ts.map +1 -1
- package/dist/step-property-sets.js +22 -674
- package/dist/step-property-sets.js.map +1 -1
- package/dist/step-serialization.d.ts +17 -51
- package/dist/step-serialization.d.ts.map +1 -1
- package/dist/step-serialization.js +19 -128
- package/dist/step-serialization.js.map +1 -1
- package/dist/step-source-iteration.d.ts +7 -5
- package/dist/step-source-iteration.d.ts.map +1 -1
- package/dist/step-source-iteration.js +3 -3
- package/dist/step-source-iteration.js.map +1 -1
- package/dist/subset-entity-reader.d.ts +103 -0
- package/dist/subset-entity-reader.d.ts.map +1 -0
- package/dist/subset-entity-reader.js +102 -0
- package/dist/subset-entity-reader.js.map +1 -0
- package/dist/subset-roots.d.ts +58 -0
- package/dist/subset-roots.d.ts.map +1 -0
- package/dist/subset-roots.js +103 -0
- package/dist/subset-roots.js.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,102 @@
|
|
|
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 { getAttributeNamesAcrossSchemas, resolveEntityNameAlias } from '@ifc-lite/parser';
|
|
5
|
+
import { ENTITIES_IFC2X3, ENTITIES_IFC4, ENTITIES_IFC4X3 } from '@ifc-lite/data';
|
|
6
|
+
import { createSourceRefReader, decodeRange } from './source-ref-bounds.js';
|
|
7
|
+
import { splitTopLevelArgs } from './step-argument-parser.js';
|
|
8
|
+
/**
|
|
9
|
+
* Read entity `id`'s STEP record out of `store`'s source and split it into
|
|
10
|
+
* its type token and top-level argument list. Returns `null` when the id has
|
|
11
|
+
* no entry in `index`, or when `index`'s byte range cannot actually be read
|
|
12
|
+
* out of `store.source` (`createSourceRefReader` — the same gate
|
|
13
|
+
* `step-pass-builder.ts`'s `isReadableSourceRef` applies), or when the bytes
|
|
14
|
+
* at that range do not parse as a single `#N=TYPE(...);` record.
|
|
15
|
+
*
|
|
16
|
+
* Only reads SOURCE-backed records. An overlay-created entity (no bytes to
|
|
17
|
+
* decode) is out of scope for this module: `anonymize-placement.ts` and
|
|
18
|
+
* `anonymize-scrub.ts` only ever walk/mutate the entities a freshly-parsed
|
|
19
|
+
* source model contains, never ones the private `MutablePropertyView` they
|
|
20
|
+
* build has itself just created.
|
|
21
|
+
*/
|
|
22
|
+
export function readEntityArgs(store, index, id) {
|
|
23
|
+
const ref = index.get(id);
|
|
24
|
+
if (!ref)
|
|
25
|
+
return null;
|
|
26
|
+
const isReadable = createSourceRefReader(store.source);
|
|
27
|
+
if (!isReadable(ref))
|
|
28
|
+
return null;
|
|
29
|
+
const line = decodeRange(store.source, ref.byteOffset, ref.byteOffset + ref.byteLength);
|
|
30
|
+
const match = line.match(/^#\d+\s*=\s*(\w+)\(([\s\S]*)\)\s*;\s*$/);
|
|
31
|
+
if (!match)
|
|
32
|
+
return null;
|
|
33
|
+
const [, type, argsText] = match;
|
|
34
|
+
return { type: type.toUpperCase(), args: splitTopLevelArgs(argsText) };
|
|
35
|
+
}
|
|
36
|
+
const ATTRIBUTE_NAMES_BY_SCHEMA = {
|
|
37
|
+
IFC2X3: attributeTableByUpperName(ENTITIES_IFC2X3),
|
|
38
|
+
IFC4: attributeTableByUpperName(ENTITIES_IFC4),
|
|
39
|
+
IFC4X3: attributeTableByUpperName(ENTITIES_IFC4X3),
|
|
40
|
+
};
|
|
41
|
+
function attributeTableByUpperName(table) {
|
|
42
|
+
const map = new Map();
|
|
43
|
+
for (const entity of table)
|
|
44
|
+
map.set(entity.name.toUpperCase(), entity.attributes);
|
|
45
|
+
return map;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Narrow an `IfcDataStore.schemaVersion` to a {@link SourceStepSchema}
|
|
49
|
+
* `attrIndex` can resolve against, or `undefined` for anything that isn't
|
|
50
|
+
* one of the three bundled STEP schemas (`IFC5`, or an absent/unrecognized
|
|
51
|
+
* value) — callers pass that straight through to `attrIndex`, which then
|
|
52
|
+
* falls back to the pinned-first cross-schema union exactly as it always did.
|
|
53
|
+
*/
|
|
54
|
+
export function stepSourceSchema(schemaVersion) {
|
|
55
|
+
return schemaVersion === 'IFC2X3' || schemaVersion === 'IFC4' || schemaVersion === 'IFC4X3'
|
|
56
|
+
? schemaVersion
|
|
57
|
+
: undefined;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Zero-based positional index of attribute `name` on `type`, or `-1` when
|
|
61
|
+
* `type` declares no such attribute (an unknown type, or a genuine typo).
|
|
62
|
+
*
|
|
63
|
+
* When `schema` is given (the exported model's OWN schema, via
|
|
64
|
+
* {@link stepSourceSchema}), resolves against THAT schema's table first: the
|
|
65
|
+
* three bundled schemas do not always agree on a class's attribute order —
|
|
66
|
+
* e.g. IFC2X3's `IfcApprovalRelationship` puts `Name` at slot 3, IFC4 puts it
|
|
67
|
+
* at slot 0 — so a caller walking an arbitrary, non-fixed type (anything
|
|
68
|
+
* `pseudonymizeAllNames` reaches in `anonymize-scrub.ts`) has to resolve
|
|
69
|
+
* against the source model's actual schema or it silently reads/writes the
|
|
70
|
+
* wrong slot on every class the schemas disagree about. Falls back to
|
|
71
|
+
* `getAttributeNamesAcrossSchemas` — the pinned-IFC4-first cross-schema
|
|
72
|
+
* union this function always used before schema-aware resolution existed —
|
|
73
|
+
* when `schema` is omitted, or when `schema`'s own table doesn't know `type`
|
|
74
|
+
* (e.g. an IFC4X3-only class read out of an `IFC4` store).
|
|
75
|
+
*
|
|
76
|
+
* A caller that resolves a slot declared on a FIXED, verified-stable type —
|
|
77
|
+
* `IfcRoot.GlobalId` (slot 0 on every bundled schema), or a literal type
|
|
78
|
+
* token whose declared order was checked directly against all three
|
|
79
|
+
* `ENTITIES_*` tables — may omit `schema`: the union answers identically to
|
|
80
|
+
* a schema-specific lookup for those, and several call sites in
|
|
81
|
+
* `anonymize-placement.ts` and `anonymize-scrub.ts` do exactly that, each
|
|
82
|
+
* noting at the call site why its type is fixed rather than caller-supplied.
|
|
83
|
+
*
|
|
84
|
+
* WRITE-SIDE PITFALL a caller resolving a slot via this function must not
|
|
85
|
+
* fall into: `MutablePropertyView.setAttribute(id, name, value)` re-resolves
|
|
86
|
+
* `name` to a slot by ITS OWN lookup at STEP-serialize time
|
|
87
|
+
* (`step-attribute-mutations.ts`'s `applyAttributeMutations`), which is not
|
|
88
|
+
* schema-aware — so an edit queued that way can still land on the wrong slot
|
|
89
|
+
* even after reading the right one here. Write with
|
|
90
|
+
* `MutablePropertyView.setPositionalAttribute(id, index, value)` and this
|
|
91
|
+
* function's resolved `index` instead; `anonymize-scrub.ts` does exactly
|
|
92
|
+
* that for every slot it resolves through a `schema` argument (#3309).
|
|
93
|
+
*/
|
|
94
|
+
export function attrIndex(type, name, schema) {
|
|
95
|
+
if (schema) {
|
|
96
|
+
const names = ATTRIBUTE_NAMES_BY_SCHEMA[schema].get(resolveEntityNameAlias(type).toUpperCase());
|
|
97
|
+
if (names)
|
|
98
|
+
return names.indexOf(name);
|
|
99
|
+
}
|
|
100
|
+
return getAttributeNamesAcrossSchemas(type).indexOf(name);
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=subset-entity-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subset-entity-reader.js","sourceRoot":"","sources":["../src/subset-entity-reader.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAmB/D,OAAO,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAsB,MAAM,gBAAgB,CAAC;AACrG,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAiB9D;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,cAAc,CAC5B,KAA0C,EAC1C,KAA2B,EAC3B,EAAU;IAEV,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC1B,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,MAAM,UAAU,GAAG,qBAAqB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACvD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAElC,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC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,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,8BAA8B,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { EffectiveEntityIndex } from './effective-index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Every `IfcRoot` descendant across the three bundled schemas (IFC2X3, IFC4,
|
|
4
|
+
* IFC4X3), UPPERCASE — the set of types a subset export ever needs to
|
|
5
|
+
* classify as "included" or "excluded". `IfcRoot` itself is abstract and
|
|
6
|
+
* never instantiated, so it is not a member (same convention as
|
|
7
|
+
* `PRODUCT_TYPES` not containing `IFCPRODUCT`).
|
|
8
|
+
*
|
|
9
|
+
* Derived from the generated schema tables via `collectDescendantNames`
|
|
10
|
+
* rather than hand-listed, for the same reason `PRODUCT_TYPES` is: a
|
|
11
|
+
* hand-written list silently stops matching the schema the day it changes,
|
|
12
|
+
* and a subset export that fails to classify a genuinely-rooted entity type
|
|
13
|
+
* would either leak it (never excluded) or drop it (never includable) with
|
|
14
|
+
* no error.
|
|
15
|
+
*/
|
|
16
|
+
export declare const IFC_ROOT_TYPES: ReadonlySet<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Entity types that identify the SOURCE model or its authoring context
|
|
19
|
+
* rather than the geometry a bug reproduction needs — addresses and
|
|
20
|
+
* georeferencing. None of these are `IfcRoot` descendants (they carry no
|
|
21
|
+
* `GlobalId`), so `IFC_ROOT_TYPES` alone would never exclude them; a subset
|
|
22
|
+
* export must name them separately or a caller's included wall still drags
|
|
23
|
+
* its `IfcSite`'s `IfcPostalAddress` / `IfcMapConversion` chain along for the
|
|
24
|
+
* ride purely because nothing else in the closure competes for that #id.
|
|
25
|
+
*
|
|
26
|
+
* `IFCACTORROLE` is here for the same reason, one level removed: it hangs
|
|
27
|
+
* off `IfcPerson`/`IfcOrganization` (owner history), not off a spatial
|
|
28
|
+
* entity, but it is exactly as identifying — a role like "Structural
|
|
29
|
+
* Engineer, ACME Consulting" — and equally unreachable through
|
|
30
|
+
* `IFC_ROOT_TYPES`.
|
|
31
|
+
*/
|
|
32
|
+
export declare const IDENTIFYING_TYPES: ReadonlySet<string>;
|
|
33
|
+
/** What a `subsetEntityIds` export needs from `step-collection.ts`'s closure tail. */
|
|
34
|
+
export interface SubsetEntityIds {
|
|
35
|
+
/** Seed set for `collectReferencedEntityIds`: infrastructure plus every
|
|
36
|
+
* caller-included id that actually exists in `index`. */
|
|
37
|
+
readonly roots: Set<number>;
|
|
38
|
+
/** Every `IfcRoot`/`IDENTIFYING_TYPES` id NOT in `includedIds` — passed as
|
|
39
|
+
* `pass.hiddenProductIds` so the existing `visibleOnly` dangling-ref
|
|
40
|
+
* protection (`evaluateOmissionPredicates` +
|
|
41
|
+
* `filterHiddenRefsFromRelationshipLine`) covers a subset export too. */
|
|
42
|
+
readonly excludedIds: Set<number>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Classify every entity in `index` for a `subsetEntityIds` export: a root
|
|
46
|
+
* (infrastructure, always; or a caller-included id), an excluded id (an
|
|
47
|
+
* `IfcRoot`/identifying-type id the caller did NOT include), or neither (left
|
|
48
|
+
* to the forward closure walk to decide, same as `visibleOnly`'s "all other
|
|
49
|
+
* entity types" fallthrough).
|
|
50
|
+
*
|
|
51
|
+
* Runs over the EFFECTIVE index — `pass.effective`, not `dataStore` — for the
|
|
52
|
+
* same reason `getVisibleEntityIds` does: an overlay-created entity has no
|
|
53
|
+
* source record for a dataStore-only scan to find, a retyped entity must be
|
|
54
|
+
* classified by its new class, and a tombstoned one must not appear at all
|
|
55
|
+
* (`EffectiveEntityIndex` iteration already skips it).
|
|
56
|
+
*/
|
|
57
|
+
export declare function getSubsetEntityIds(index: EffectiveEntityIndex, includedIds: ReadonlySet<number>): SubsetEntityIds;
|
|
58
|
+
//# sourceMappingURL=subset-roots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subset-roots.d.ts","sourceRoot":"","sources":["../src/subset-roots.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAGjE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,MAAM,CAAoB,CAAC;AAUpE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAQhD,CAAC;AAEH,sFAAsF;AACtF,MAAM,WAAW,eAAe;IAC9B;8DAC0D;IAC1D,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B;;;8EAG0E;IAC1E,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACnC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,oBAAoB,EAC3B,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GAC/B,eAAe,CA2BjB"}
|
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
* The root classification for a `subsetEntityIds` STEP export (#2934, the
|
|
6
|
+
* "anonymized isolated export" feature): which entities the caller's
|
|
7
|
+
* `includedIds` selection may legally seed, and which entities must be
|
|
8
|
+
* excluded outright regardless of whether the closure walk would otherwise
|
|
9
|
+
* reach them.
|
|
10
|
+
*
|
|
11
|
+
* Mirrors `reference-collector.ts`'s `getVisibleEntityIds` in shape — both
|
|
12
|
+
* produce a `{ roots, excludeIds }` pair `step-collection.ts` feeds to the
|
|
13
|
+
* same `collectReferencedEntityIds` + `collectStyleEntities` tail — but the
|
|
14
|
+
* classification rule is the opposite of `visibleOnly`'s. `visibleOnly`
|
|
15
|
+
* starts from "everything is a root unless hidden"; a subset export starts
|
|
16
|
+
* from "nothing is a root unless named", because the caller is picking a
|
|
17
|
+
* handful of entities out of a whole model, not hiding a handful out of it.
|
|
18
|
+
*/
|
|
19
|
+
import { ENTITIES_IFC2X3, ENTITIES_IFC4, ENTITIES_IFC4X3, } from '@ifc-lite/data';
|
|
20
|
+
import { INFRASTRUCTURE_TYPES, collectDescendantNames } from './reference-collector.js';
|
|
21
|
+
/**
|
|
22
|
+
* Every `IfcRoot` descendant across the three bundled schemas (IFC2X3, IFC4,
|
|
23
|
+
* IFC4X3), UPPERCASE — the set of types a subset export ever needs to
|
|
24
|
+
* classify as "included" or "excluded". `IfcRoot` itself is abstract and
|
|
25
|
+
* never instantiated, so it is not a member (same convention as
|
|
26
|
+
* `PRODUCT_TYPES` not containing `IFCPRODUCT`).
|
|
27
|
+
*
|
|
28
|
+
* Derived from the generated schema tables via `collectDescendantNames`
|
|
29
|
+
* rather than hand-listed, for the same reason `PRODUCT_TYPES` is: a
|
|
30
|
+
* hand-written list silently stops matching the schema the day it changes,
|
|
31
|
+
* and a subset export that fails to classify a genuinely-rooted entity type
|
|
32
|
+
* would either leak it (never excluded) or drop it (never includable) with
|
|
33
|
+
* no error.
|
|
34
|
+
*/
|
|
35
|
+
export const IFC_ROOT_TYPES = buildRootTypes();
|
|
36
|
+
function buildRootTypes() {
|
|
37
|
+
const roots = new Set();
|
|
38
|
+
for (const table of [ENTITIES_IFC2X3, ENTITIES_IFC4, ENTITIES_IFC4X3]) {
|
|
39
|
+
collectDescendantNames(table, 'IfcRoot', roots);
|
|
40
|
+
}
|
|
41
|
+
return roots;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Entity types that identify the SOURCE model or its authoring context
|
|
45
|
+
* rather than the geometry a bug reproduction needs — addresses and
|
|
46
|
+
* georeferencing. None of these are `IfcRoot` descendants (they carry no
|
|
47
|
+
* `GlobalId`), so `IFC_ROOT_TYPES` alone would never exclude them; a subset
|
|
48
|
+
* export must name them separately or a caller's included wall still drags
|
|
49
|
+
* its `IfcSite`'s `IfcPostalAddress` / `IfcMapConversion` chain along for the
|
|
50
|
+
* ride purely because nothing else in the closure competes for that #id.
|
|
51
|
+
*
|
|
52
|
+
* `IFCACTORROLE` is here for the same reason, one level removed: it hangs
|
|
53
|
+
* off `IfcPerson`/`IfcOrganization` (owner history), not off a spatial
|
|
54
|
+
* entity, but it is exactly as identifying — a role like "Structural
|
|
55
|
+
* Engineer, ACME Consulting" — and equally unreachable through
|
|
56
|
+
* `IFC_ROOT_TYPES`.
|
|
57
|
+
*/
|
|
58
|
+
export const IDENTIFYING_TYPES = new Set([
|
|
59
|
+
'IFCPOSTALADDRESS',
|
|
60
|
+
'IFCTELECOMADDRESS',
|
|
61
|
+
'IFCMAPCONVERSION',
|
|
62
|
+
'IFCMAPCONVERSIONSCALED',
|
|
63
|
+
'IFCPROJECTEDCRS',
|
|
64
|
+
'IFCGEOGRAPHICCRS',
|
|
65
|
+
'IFCACTORROLE',
|
|
66
|
+
]);
|
|
67
|
+
/**
|
|
68
|
+
* Classify every entity in `index` for a `subsetEntityIds` export: a root
|
|
69
|
+
* (infrastructure, always; or a caller-included id), an excluded id (an
|
|
70
|
+
* `IfcRoot`/identifying-type id the caller did NOT include), or neither (left
|
|
71
|
+
* to the forward closure walk to decide, same as `visibleOnly`'s "all other
|
|
72
|
+
* entity types" fallthrough).
|
|
73
|
+
*
|
|
74
|
+
* Runs over the EFFECTIVE index — `pass.effective`, not `dataStore` — for the
|
|
75
|
+
* same reason `getVisibleEntityIds` does: an overlay-created entity has no
|
|
76
|
+
* source record for a dataStore-only scan to find, a retyped entity must be
|
|
77
|
+
* classified by its new class, and a tombstoned one must not appear at all
|
|
78
|
+
* (`EffectiveEntityIndex` iteration already skips it).
|
|
79
|
+
*/
|
|
80
|
+
export function getSubsetEntityIds(index, includedIds) {
|
|
81
|
+
const roots = new Set();
|
|
82
|
+
const excludedIds = new Set();
|
|
83
|
+
for (const [expressId, entityRef] of index) {
|
|
84
|
+
const typeUpper = index.effectiveType(expressId, entityRef.type);
|
|
85
|
+
if (INFRASTRUCTURE_TYPES.has(typeUpper)) {
|
|
86
|
+
roots.add(expressId);
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (includedIds.has(expressId)) {
|
|
90
|
+
roots.add(expressId);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (IFC_ROOT_TYPES.has(typeUpper) || IDENTIFYING_TYPES.has(typeUpper)) {
|
|
94
|
+
excludedIds.add(expressId);
|
|
95
|
+
}
|
|
96
|
+
// Everything else (geometry, relationships, property atoms, materials,
|
|
97
|
+
// …) is neither a root nor excluded here — the forward closure walk from
|
|
98
|
+
// `roots` decides whether it survives, exactly as `visibleOnly`'s
|
|
99
|
+
// fallthrough does.
|
|
100
|
+
}
|
|
101
|
+
return { roots, excludedIds };
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=subset-roots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subset-roots.js","sourceRoot":"","sources":["../src/subset-roots.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,eAAe,EACf,aAAa,EACb,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAExF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,cAAc,GAAwB,cAAc,EAAE,CAAC;AAEpE,SAAS,cAAc;IACrB,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,KAAK,MAAM,KAAK,IAAI,CAAC,eAAe,EAAE,aAAa,EAAE,eAAe,CAAC,EAAE,CAAC;QACtE,sBAAsB,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAClD,C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|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Export formats for IFC-Lite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"parquet-wasm": "^0.7.2",
|
|
17
17
|
"apache-arrow": "^21.2.0",
|
|
18
18
|
"jszip": "^3.10.0",
|
|
19
|
-
"@ifc-lite/geometry": "^4.
|
|
20
|
-
"@ifc-lite/data": "^3.4.1",
|
|
19
|
+
"@ifc-lite/geometry": "^4.1.0",
|
|
21
20
|
"@ifc-lite/encoding": "^2.1.0",
|
|
22
|
-
"@ifc-lite/parser": "^4.3.
|
|
23
|
-
"@ifc-lite/mutations": "^1.27.0"
|
|
21
|
+
"@ifc-lite/parser": "^4.3.2",
|
|
22
|
+
"@ifc-lite/mutations": "^1.27.0",
|
|
23
|
+
"@ifc-lite/data": "^3.5.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"typescript": "^6.0.3",
|
|
27
|
-
"vitest": "^4.1.
|
|
28
|
-
"@ifc-lite/ifcx": "^3.0.
|
|
27
|
+
"vitest": "^4.1.11",
|
|
28
|
+
"@ifc-lite/ifcx": "^3.0.1"
|
|
29
29
|
},
|
|
30
30
|
"license": "MPL-2.0",
|
|
31
31
|
"author": "Louis True",
|