@ifc-lite/ids 2.0.0 → 3.0.2
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/dist/audit/coherence/index.js +3 -3
- package/dist/audit/coherence/regex.d.ts +2 -1
- package/dist/audit/coherence/regex.d.ts.map +1 -1
- package/dist/audit/coherence/regex.js +2 -1
- package/dist/audit/coherence/regex.js.map +1 -1
- package/dist/bridge/classifications.d.ts +20 -1
- package/dist/bridge/classifications.d.ts.map +1 -1
- package/dist/bridge/classifications.js +87 -22
- package/dist/bridge/classifications.js.map +1 -1
- package/dist/bridge/data-accessor.d.ts +14 -1
- package/dist/bridge/data-accessor.d.ts.map +1 -1
- package/dist/bridge/data-accessor.js +34 -9
- package/dist/bridge/data-accessor.js.map +1 -1
- package/dist/bridge/entity-visibility.d.ts +56 -0
- package/dist/bridge/entity-visibility.d.ts.map +1 -0
- package/dist/bridge/entity-visibility.js +89 -0
- package/dist/bridge/entity-visibility.js.map +1 -0
- package/dist/bridge/index.d.ts +1 -1
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/index.js.map +1 -1
- package/dist/bridge/materials.d.ts.map +1 -1
- package/dist/bridge/materials.js +10 -0
- package/dist/bridge/materials.js.map +1 -1
- package/dist/bridge/properties.d.ts.map +1 -1
- package/dist/bridge/properties.js +21 -12
- package/dist/bridge/properties.js.map +1 -1
- package/dist/bridge/property-overlay-resolver.d.ts.map +1 -1
- package/dist/bridge/property-overlay-resolver.js +10 -2
- package/dist/bridge/property-overlay-resolver.js.map +1 -1
- package/dist/constraints/describe.d.ts.map +1 -1
- package/dist/constraints/describe.js +2 -4
- package/dist/constraints/describe.js.map +1 -1
- package/dist/constraints/digit-facets.d.ts +19 -21
- package/dist/constraints/digit-facets.d.ts.map +1 -1
- package/dist/constraints/digit-facets.js +42 -55
- package/dist/constraints/digit-facets.js.map +1 -1
- package/dist/constraints/match-family.js +16 -7
- package/dist/constraints/match-family.js.map +1 -1
- package/dist/constraints/xsd-regex.d.ts +11 -1
- package/dist/constraints/xsd-regex.d.ts.map +1 -1
- package/dist/constraints/xsd-regex.js +65 -4
- package/dist/constraints/xsd-regex.js.map +1 -1
- package/dist/facets/material-facet.d.ts.map +1 -1
- package/dist/facets/material-facet.js +39 -4
- package/dist/facets/material-facet.js.map +1 -1
- package/dist/facets/property-datatype.d.ts +21 -0
- package/dist/facets/property-datatype.d.ts.map +1 -0
- package/dist/facets/property-datatype.js +33 -0
- package/dist/facets/property-datatype.js.map +1 -0
- package/dist/facets/property-facet.d.ts.map +1 -1
- package/dist/facets/property-facet.js +6 -26
- package/dist/facets/property-facet.js.map +1 -1
- package/dist/facets/test-helpers.d.ts +3 -0
- package/dist/facets/test-helpers.d.ts.map +1 -1
- package/dist/facets/test-helpers.js +3 -2
- package/dist/facets/test-helpers.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/translation/locales/de.d.ts +2 -0
- package/dist/translation/locales/de.d.ts.map +1 -1
- package/dist/translation/locales/de.js +2 -0
- package/dist/translation/locales/de.js.map +1 -1
- package/dist/translation/locales/en.d.ts +2 -0
- package/dist/translation/locales/en.d.ts.map +1 -1
- package/dist/translation/locales/en.js +2 -0
- package/dist/translation/locales/en.js.map +1 -1
- package/dist/translation/locales/fr.d.ts +2 -0
- package/dist/translation/locales/fr.d.ts.map +1 -1
- package/dist/translation/locales/fr.js +2 -0
- package/dist/translation/locales/fr.js.map +1 -1
- package/dist/translation/service.d.ts.map +1 -1
- package/dist/translation/service.js +4 -0
- package/dist/translation/service.js.map +1 -1
- package/dist/types.d.ts +10 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/validation/format-failure-reason.d.ts.map +1 -1
- package/dist/validation/format-failure-reason.js +4 -0
- package/dist/validation/format-failure-reason.js.map +1 -1
- package/dist/validation/validator.d.ts.map +1 -1
- package/dist/validation/validator.js +33 -4
- package/dist/validation/validator.js.map +1 -1
- package/package.json +3 -3
|
@@ -236,9 +236,9 @@ function checkBounds(c, path, issues, facetType) {
|
|
|
236
236
|
* escape codes to JS regex equivalents (cf. upstream `XmlRegex.cs`).
|
|
237
237
|
*
|
|
238
238
|
* Translation handles `\i`/`\c`/`\d`/`\w` and their negations via
|
|
239
|
-
* Unicode property escapes (compiled with the `u` flag)
|
|
240
|
-
* subtraction (`[a-z-[aeiou]]`)
|
|
241
|
-
* `W_REGEX_UNVERIFIED`. Any remaining syntactic errors are real
|
|
239
|
+
* Unicode property escapes (compiled with the `u` flag), and char-class
|
|
240
|
+
* subtraction (`[a-z-[aeiou]]`) as a negative lookahead. A construct that
|
|
241
|
+
* can only be approximated surfaces as `W_REGEX_UNVERIFIED`. Any remaining syntactic errors are real
|
|
242
242
|
* authoring mistakes and surface as `E_RESTRICTION_EMPTY` (upstream
|
|
243
243
|
* Report 109).
|
|
244
244
|
*/
|
|
@@ -13,7 +13,8 @@ export { translateXsdRegex, type TranslateResult };
|
|
|
13
13
|
* - `{ ok: false, severity: 'error', reason }` for syntactic errors
|
|
14
14
|
* that JS *and* XSD agree on (e.g. unclosed `[`).
|
|
15
15
|
* - `{ ok: false, severity: 'warning', reason }` when the pattern uses
|
|
16
|
-
* XSD-only syntax we can
|
|
16
|
+
* XSD-only syntax we can only approximate (a `\p{Is…}` block escape,
|
|
17
|
+
* an undelimitable char-class subtraction).
|
|
17
18
|
*/
|
|
18
19
|
export declare function compileXsdRegex(pattern: string): {
|
|
19
20
|
ok: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regex.d.ts","sourceRoot":"","sources":["../../../src/audit/coherence/regex.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH,OAAO,EACL,iBAAiB,EACjB,KAAK,eAAe,EACrB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,KAAK,eAAe,EAAE,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"regex.d.ts","sourceRoot":"","sources":["../../../src/audit/coherence/regex.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH,OAAO,EACL,iBAAiB,EACjB,KAAK,eAAe,EACrB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,KAAK,eAAe,EAAE,CAAC;AAEnD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,GAEb;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAkB/D"}
|
|
@@ -16,7 +16,8 @@ export { translateXsdRegex };
|
|
|
16
16
|
* - `{ ok: false, severity: 'error', reason }` for syntactic errors
|
|
17
17
|
* that JS *and* XSD agree on (e.g. unclosed `[`).
|
|
18
18
|
* - `{ ok: false, severity: 'warning', reason }` when the pattern uses
|
|
19
|
-
* XSD-only syntax we can
|
|
19
|
+
* XSD-only syntax we can only approximate (a `\p{Is…}` block escape,
|
|
20
|
+
* an undelimitable char-class subtraction).
|
|
20
21
|
*/
|
|
21
22
|
export function compileXsdRegex(pattern) {
|
|
22
23
|
if (pattern === '') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regex.js","sourceRoot":"","sources":["../../../src/audit/coherence/regex.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;GAMG;AAEH,OAAO,EACL,iBAAiB,GAElB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAwB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"regex.js","sourceRoot":"","sources":["../../../src/audit/coherence/regex.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;GAMG;AAEH,OAAO,EACL,iBAAiB,GAElB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAwB,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAe;IAIf,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;QACnB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;IACtE,CAAC;IACD,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC9C,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;QAC1B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC;IACvE,CAAC;IACD,IAAI,CAAC;QACH,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QACpC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC;IACrD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,EAAE,EAAE,KAAK;YACT,QAAQ,EAAE,OAAO;YACjB,MAAM,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;SACzD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type IfcDataStore } from '@ifc-lite/parser';
|
|
2
2
|
import type { ClassificationInfo } from '../types.js';
|
|
3
|
+
import type { EntityVisibilityView } from './entity-visibility.js';
|
|
3
4
|
/**
|
|
4
5
|
* Resolve every classification associated with `expressId`, including
|
|
5
6
|
* 1. the standard `IfcRelAssociatesClassification` path (handled by
|
|
@@ -11,7 +12,7 @@ import type { ClassificationInfo } from '../types.js';
|
|
|
11
12
|
* entries — one per parent reference in the chain — so a requirement
|
|
12
13
|
* for `EF_25_10` matches an actual leaf of `EF_25_10_25`.
|
|
13
14
|
*/
|
|
14
|
-
export declare function resolveClassifications(store: IfcDataStore, expressId: number): ClassificationInfo[];
|
|
15
|
+
export declare function resolveClassifications(store: IfcDataStore, expressId: number, externalReferences?: ExternalReferenceContext): ClassificationInfo[];
|
|
15
16
|
/**
|
|
16
17
|
* Could an entity of this upper-cased type name be a `RelatedResourceObjects`
|
|
17
18
|
* target of an `IfcExternalReferenceRelationship`? The IFC schema restricts
|
|
@@ -51,4 +52,22 @@ export declare function resolveClassifications(store: IfcDataStore, expressId: n
|
|
|
51
52
|
* in both schemas, without building a store for each one.
|
|
52
53
|
*/
|
|
53
54
|
export declare function isNonRootedClassifiableResourceType(upperType: string): boolean;
|
|
55
|
+
interface RecordRead {
|
|
56
|
+
type: string;
|
|
57
|
+
attributes: unknown[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The session's external-reference relationships and a reader for the records
|
|
61
|
+
* they point at, built ONCE per accessor (#5249). `getClassifications` runs once
|
|
62
|
+
* per candidate, and `getNewEntities()` copies on every call, so rebuilding this
|
|
63
|
+
* per call would be O(candidates x created entities).
|
|
64
|
+
*/
|
|
65
|
+
export interface ExternalReferenceContext {
|
|
66
|
+
/** Effective `IfcExternalReferenceRelationship` ids: deleted out, created in. */
|
|
67
|
+
readonly relationshipIds: readonly number[];
|
|
68
|
+
/** One effective record, or `undefined` when absent or deleted. */
|
|
69
|
+
read(id: number): RecordRead | undefined;
|
|
70
|
+
}
|
|
71
|
+
export declare function createExternalReferenceContext(store: IfcDataStore, overlay: EntityVisibilityView | undefined): ExternalReferenceContext;
|
|
72
|
+
export {};
|
|
54
73
|
//# sourceMappingURL=classifications.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classifications.d.ts","sourceRoot":"","sources":["../../src/bridge/classifications.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"classifications.d.ts","sourceRoot":"","sources":["../../src/bridge/classifications.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,kBAAkB,CAAC;AAK1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAWnE;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,kBAAkB,CAAC,EAAE,wBAAwB,GAC5C,kBAAkB,EAAE,CAiCtB;AAmID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,mCAAmC,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAK9E;AAoBD,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,EAAE,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,iFAAiF;IACjF,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,mEAAmE;IACnE,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;CAC1C;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,oBAAoB,GAAG,SAAS,GACxC,wBAAwB,CA6B1B"}
|
|
@@ -5,6 +5,7 @@ import { EntityExtractor, extractClassificationsOnDemand, } from '@ifc-lite/pars
|
|
|
5
5
|
import { isProperSubtypeOfAny } from '@ifc-lite/codegen/schema-hierarchy';
|
|
6
6
|
import * as IFC4_SCHEMA from '@ifc-lite/codegen/ifc4';
|
|
7
7
|
import * as IFC4X3_SCHEMA from '@ifc-lite/codegen/ifc4x3';
|
|
8
|
+
import { iterateEffectiveEntities } from '@ifc-lite/data';
|
|
8
9
|
/**
|
|
9
10
|
* Resolve every classification associated with `expressId`, including
|
|
10
11
|
* 1. the standard `IfcRelAssociatesClassification` path (handled by
|
|
@@ -16,11 +17,11 @@ import * as IFC4X3_SCHEMA from '@ifc-lite/codegen/ifc4x3';
|
|
|
16
17
|
* entries — one per parent reference in the chain — so a requirement
|
|
17
18
|
* for `EF_25_10` matches an actual leaf of `EF_25_10_25`.
|
|
18
19
|
*/
|
|
19
|
-
export function resolveClassifications(store, expressId) {
|
|
20
|
+
export function resolveClassifications(store, expressId, externalReferences) {
|
|
20
21
|
const list = [
|
|
21
22
|
...(extractClassificationsOnDemand(store, expressId) || []),
|
|
22
23
|
];
|
|
23
|
-
appendExternalReferenceClassifications(store, expressId, list);
|
|
24
|
+
appendExternalReferenceClassifications(store, expressId, list, externalReferences ?? createExternalReferenceContext(store, undefined));
|
|
24
25
|
const out = [];
|
|
25
26
|
for (const c of list) {
|
|
26
27
|
const system = c.system || '';
|
|
@@ -65,7 +66,7 @@ export function resolveClassifications(store, expressId) {
|
|
|
65
66
|
* relationship-graph fallback at all for this one (#3954): presence cannot
|
|
66
67
|
* be proven OR disproven without source bytes.
|
|
67
68
|
*/
|
|
68
|
-
function appendExternalReferenceClassifications(store, expressId, list) {
|
|
69
|
+
function appendExternalReferenceClassifications(store, expressId, list, context) {
|
|
69
70
|
if (!store.source?.length) {
|
|
70
71
|
// Only fall back to "cannot determine" when:
|
|
71
72
|
// 1. the IfcRelAssociatesClassification path (already applied to `list`
|
|
@@ -88,15 +89,9 @@ function appendExternalReferenceClassifications(store, expressId, list) {
|
|
|
88
89
|
}
|
|
89
90
|
return;
|
|
90
91
|
}
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const ex = new EntityExtractor(store.source);
|
|
95
|
-
for (const erId of erRefs) {
|
|
96
|
-
const erRef = store.entityIndex.byId.get(erId);
|
|
97
|
-
if (!erRef)
|
|
98
|
-
continue;
|
|
99
|
-
const erEntity = ex.extractEntity(erRef);
|
|
92
|
+
const { read, relationshipIds: erIds } = context;
|
|
93
|
+
for (const erId of erIds) {
|
|
94
|
+
const erEntity = read(erId);
|
|
100
95
|
if (!erEntity)
|
|
101
96
|
continue;
|
|
102
97
|
// [Name, Description, RelatingReference, RelatedResourceObjects]
|
|
@@ -108,10 +103,7 @@ function appendExternalReferenceClassifications(store, expressId, list) {
|
|
|
108
103
|
continue;
|
|
109
104
|
if (!related.includes(expressId))
|
|
110
105
|
continue;
|
|
111
|
-
const
|
|
112
|
-
if (!refRef)
|
|
113
|
-
continue;
|
|
114
|
-
const refEntity = ex.extractEntity(refRef);
|
|
106
|
+
const refEntity = read(relating);
|
|
115
107
|
if (!refEntity)
|
|
116
108
|
continue;
|
|
117
109
|
if (refEntity.type.toUpperCase() !== 'IFCCLASSIFICATIONREFERENCE')
|
|
@@ -124,14 +116,27 @@ function appendExternalReferenceClassifications(store, expressId, list) {
|
|
|
124
116
|
};
|
|
125
117
|
let cursor = typeof a[3] === 'number' ? a[3] : undefined;
|
|
126
118
|
const seen = new Set();
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
119
|
+
// #5290: this walk is the `IfcExternalReferenceRelationship` twin of
|
|
120
|
+
// `@ifc-lite/parser`'s `walkClassificationChain` — same chain, same
|
|
121
|
+
// break-without-reporting defect. A dangling `cursor`, an unreadable
|
|
122
|
+
// entity, an unexpected type, or a cycle back to an already-seen id all
|
|
123
|
+
// mean "this data cannot say whether a system exists", distinct from
|
|
124
|
+
// `cursor` legitimately becoming `undefined` (`ReferencedSource`
|
|
125
|
+
// omitted — schema-legal). `info.system` is `undefined` either way, so
|
|
126
|
+
// `info.unresolved` is the only signal `resolveClassifications`'
|
|
127
|
+
// caller has to tell the two apart; without it, `c.system || ''`
|
|
128
|
+
// flattens a broken chain into a confident empty system.
|
|
129
|
+
while (cursor !== undefined) {
|
|
130
|
+
if (seen.has(cursor)) {
|
|
131
|
+
info.unresolved = true;
|
|
131
132
|
break;
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
}
|
|
134
|
+
seen.add(cursor);
|
|
135
|
+
const e = read(cursor);
|
|
136
|
+
if (!e) {
|
|
137
|
+
info.unresolved = true;
|
|
134
138
|
break;
|
|
139
|
+
}
|
|
135
140
|
const cu = e.type.toUpperCase();
|
|
136
141
|
const ca = e.attributes || [];
|
|
137
142
|
if (cu === 'IFCCLASSIFICATION') {
|
|
@@ -149,6 +154,7 @@ function appendExternalReferenceClassifications(store, expressId, list) {
|
|
|
149
154
|
cursor = typeof ca[3] === 'number' ? ca[3] : undefined;
|
|
150
155
|
continue;
|
|
151
156
|
}
|
|
157
|
+
info.unresolved = true;
|
|
152
158
|
break;
|
|
153
159
|
}
|
|
154
160
|
list.push(info);
|
|
@@ -216,9 +222,68 @@ export function isNonRootedClassifiableResourceType(upperType) {
|
|
|
216
222
|
* nothing on a server-parsed store.
|
|
217
223
|
*/
|
|
218
224
|
function isNonRootedClassifiableResource(store, expressId) {
|
|
225
|
+
// @raw-entity-enumeration-ok point read of the queried resource's parsed class, only on a server-parsed store where no source bytes exist to extend
|
|
219
226
|
const type = store.entityIndex?.byId?.get?.(expressId)?.type;
|
|
220
227
|
if (typeof type !== 'string')
|
|
221
228
|
return false;
|
|
222
229
|
return isNonRootedClassifiableResourceType(type.toUpperCase());
|
|
223
230
|
}
|
|
231
|
+
export function createExternalReferenceContext(store, overlay) {
|
|
232
|
+
if (!store.entityIndex)
|
|
233
|
+
return { relationshipIds: [], read: () => undefined };
|
|
234
|
+
const ex = new EntityExtractor(store.source);
|
|
235
|
+
const created = new Map();
|
|
236
|
+
for (const entity of overlay?.getNewEntities() ?? []) {
|
|
237
|
+
created.set(entity.expressId, { type: entity.type, attributes: entity.attributes ?? [] });
|
|
238
|
+
}
|
|
239
|
+
const retypes = overlay?.getTypeMutations?.();
|
|
240
|
+
const relationshipIds = Array.from(iterateEffectiveEntities(store, overlay, ['IFCEXTERNALREFERENCERELATIONSHIP']), (e) => e.expressId);
|
|
241
|
+
return {
|
|
242
|
+
relationshipIds,
|
|
243
|
+
read(id) {
|
|
244
|
+
if (overlay?.isDeleted(id))
|
|
245
|
+
return undefined;
|
|
246
|
+
const retype = retypes?.get(id)?.newType;
|
|
247
|
+
const authored = created.get(id);
|
|
248
|
+
if (authored) {
|
|
249
|
+
return { type: retype ?? authored.type, attributes: authored.attributes.map(authoredValue) };
|
|
250
|
+
}
|
|
251
|
+
// @raw-entity-enumeration-ok point read of one source record, after the overlay answered for deleted and created ids
|
|
252
|
+
const ref = store.entityIndex.byId.get(id);
|
|
253
|
+
if (!ref)
|
|
254
|
+
return undefined;
|
|
255
|
+
const entity = ex.extractEntity(ref);
|
|
256
|
+
if (!entity)
|
|
257
|
+
return undefined;
|
|
258
|
+
return { type: retype ?? entity.type, attributes: entity.attributes ?? [] };
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* An authored attribute in the shape `EntityExtractor` yields for a parsed
|
|
264
|
+
* one: a `#id` reference as a number, `$`/`*` as absent, a typed wrapper or a
|
|
265
|
+
* `{ real }` number unwrapped. A plain string is the literal value. The STEP
|
|
266
|
+
* serializer (`serializeStepValue`) writes it quoted, so it is never
|
|
267
|
+
* pre-quoted here, and quote characters are kept as data.
|
|
268
|
+
*/
|
|
269
|
+
function authoredValue(value) {
|
|
270
|
+
if (Array.isArray(value))
|
|
271
|
+
return value.map(authoredValue);
|
|
272
|
+
if (value && typeof value === 'object') {
|
|
273
|
+
if ('real' in value && typeof value.real === 'number')
|
|
274
|
+
return value.real;
|
|
275
|
+
if ('typed' in value && value.typed && typeof value.typed === 'object' && 'value' in value.typed) {
|
|
276
|
+
return authoredValue(value.typed.value);
|
|
277
|
+
}
|
|
278
|
+
return value;
|
|
279
|
+
}
|
|
280
|
+
if (typeof value !== 'string')
|
|
281
|
+
return value;
|
|
282
|
+
const ref = /^#(\d+)$/.exec(value.trim());
|
|
283
|
+
if (ref)
|
|
284
|
+
return Number(ref[1]);
|
|
285
|
+
if (value === '$' || value === '*')
|
|
286
|
+
return undefined;
|
|
287
|
+
return value;
|
|
288
|
+
}
|
|
224
289
|
//# sourceMappingURL=classifications.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classifications.js","sourceRoot":"","sources":["../../src/bridge/classifications.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAEL,eAAe,EACf,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAA0B,MAAM,oCAAoC,CAAC;AAClG,OAAO,KAAK,WAAW,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"classifications.js","sourceRoot":"","sources":["../../src/bridge/classifications.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAEL,eAAe,EACf,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAA0B,MAAM,oCAAoC,CAAC;AAClG,OAAO,KAAK,WAAW,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAa1D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAmB,EACnB,SAAiB,EACjB,kBAA6C;IAE7C,MAAM,IAAI,GAAkB;QAC1B,GAAG,CAAC,8BAA8B,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;KAC5D,CAAC;IAEF,sCAAsC,CACpC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,kBAAkB,IAAI,8BAA8B,CAAC,KAAK,EAAE,SAAS,CAAC,CAC/F,CAAC;IAEF,MAAM,GAAG,GAAyB,EAAE,CAAC;IACrC,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,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AC;IAC/B,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,GAAG;QAAE,OAAO,SAAS,CAAC;IACrD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type IfcDataStore } from '@ifc-lite/parser';
|
|
2
2
|
import type { IFCDataAccessor } from '../types.js';
|
|
3
3
|
import { type PropertyOverride, type PropertyOverlayResolver } from './property-overlay-resolver.js';
|
|
4
|
+
import { type EntityVisibilityView } from './entity-visibility.js';
|
|
4
5
|
export type { PropertyOverride, PropertyOverlayResolver };
|
|
6
|
+
export type { EntityVisibilityView };
|
|
5
7
|
/**
|
|
6
8
|
* Bridge an `IfcDataStore` (produced by `@ifc-lite/parser`) into the
|
|
7
9
|
* abstract `IFCDataAccessor` the IDS validator consumes. The single
|
|
@@ -21,6 +23,17 @@ export type { PropertyOverride, PropertyOverlayResolver };
|
|
|
21
23
|
* `getPropertyValue`/`getPropertySets` immediately, without re-parsing the
|
|
22
24
|
* store. Every other read (attributes, classifications, materials, partOf)
|
|
23
25
|
* is unaffected — only the two property-reading methods below consult it.
|
|
26
|
+
*
|
|
27
|
+
* `entityVisibility` is optional and, when supplied, makes the accessor
|
|
28
|
+
* answer for the session's EFFECTIVE model (#5184, #5249). `getAllEntityIds`
|
|
29
|
+
* and `getEntitiesByType` enumerate through the shared effective-entity
|
|
30
|
+
* accessor: tombstoned entities are excluded, overlay-created entities are
|
|
31
|
+
* included under their class, and a retyped entity is listed under its new
|
|
32
|
+
* class. `getEntityType` answers the same effective class, because the
|
|
33
|
+
* validator confirms every candidate through it. A created entity's
|
|
34
|
+
* attributes are read from its authored payload (see `./entity-visibility.ts`).
|
|
35
|
+
* Omitting `entityVisibility` leaves both enumerations reading the parsed
|
|
36
|
+
* index unchanged.
|
|
24
37
|
*/
|
|
25
|
-
export declare function createDataAccessor(store: IfcDataStore, propertyOverlay?: PropertyOverlayResolver): IFCDataAccessor;
|
|
38
|
+
export declare function createDataAccessor(store: IfcDataStore, propertyOverlay?: PropertyOverlayResolver, entityVisibility?: EntityVisibilityView): IFCDataAccessor;
|
|
26
39
|
//# sourceMappingURL=data-accessor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-accessor.d.ts","sourceRoot":"","sources":["../../src/bridge/data-accessor.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"data-accessor.d.ts","sourceRoot":"","sources":["../../src/bridge/data-accessor.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,kBAAkB,CAAC;AAO1B,OAAO,KAAK,EACV,eAAe,EAOhB,MAAM,aAAa,CAAC;AAKrB,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC7B,MAAM,gCAAgC,CAAC;AAMxC,OAAO,EAAuB,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAExF,YAAY,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,CAAC;AAE1D,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAMrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,EACnB,eAAe,CAAC,EAAE,uBAAuB,EACzC,gBAAgB,CAAC,EAAE,oBAAoB,GACtC,eAAe,CA2PjB"}
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
4
|
import { extractAllEntityAttributes, extractAllMaterialsOnDemand, } from '@ifc-lite/parser';
|
|
5
|
-
import { RelationshipType, getAttributeXsdTypes } from '@ifc-lite/data';
|
|
5
|
+
import { RelationshipType, getAttributeXsdTypes, iterateEffectiveEntities, } from '@ifc-lite/data';
|
|
6
6
|
import { flattenMaterials } from './materials.js';
|
|
7
|
-
import { resolveClassifications } from './classifications.js';
|
|
7
|
+
import { createExternalReferenceContext, resolveClassifications } from './classifications.js';
|
|
8
8
|
import { resolvePartOfAncestors } from './ancestors.js';
|
|
9
9
|
import { resolveEffectivePropertySets, } from './property-overlay-resolver.js';
|
|
10
10
|
import { resolveObjectType, resolveRawPredefinedType, } from './predefined-types.js';
|
|
11
11
|
import { narrowSchemaVersion } from './schema-version.js';
|
|
12
|
+
import { overlayEntityLookup } from './entity-visibility.js';
|
|
12
13
|
// `PropertyOverride`/`PropertyOverlayResolver` are re-exported above from
|
|
13
14
|
// ./property-overlay-resolver.js; the PartOf relation map and ancestor BFS
|
|
14
15
|
// walk live in ./ancestors.js — see `resolvePartOfAncestors` below.
|
|
@@ -31,8 +32,22 @@ import { narrowSchemaVersion } from './schema-version.js';
|
|
|
31
32
|
* `getPropertyValue`/`getPropertySets` immediately, without re-parsing the
|
|
32
33
|
* store. Every other read (attributes, classifications, materials, partOf)
|
|
33
34
|
* is unaffected — only the two property-reading methods below consult it.
|
|
35
|
+
*
|
|
36
|
+
* `entityVisibility` is optional and, when supplied, makes the accessor
|
|
37
|
+
* answer for the session's EFFECTIVE model (#5184, #5249). `getAllEntityIds`
|
|
38
|
+
* and `getEntitiesByType` enumerate through the shared effective-entity
|
|
39
|
+
* accessor: tombstoned entities are excluded, overlay-created entities are
|
|
40
|
+
* included under their class, and a retyped entity is listed under its new
|
|
41
|
+
* class. `getEntityType` answers the same effective class, because the
|
|
42
|
+
* validator confirms every candidate through it. A created entity's
|
|
43
|
+
* attributes are read from its authored payload (see `./entity-visibility.ts`).
|
|
44
|
+
* Omitting `entityVisibility` leaves both enumerations reading the parsed
|
|
45
|
+
* index unchanged.
|
|
34
46
|
*/
|
|
35
|
-
export function createDataAccessor(store, propertyOverlay) {
|
|
47
|
+
export function createDataAccessor(store, propertyOverlay, entityVisibility) {
|
|
48
|
+
const overlay = entityVisibility ? overlayEntityLookup(entityVisibility) : null;
|
|
49
|
+
// Built on first classification read, once per accessor (#5249).
|
|
50
|
+
let externalReferences;
|
|
36
51
|
// Memoize per-entity attribute extraction. extractAllEntityAttributes
|
|
37
52
|
// re-parses the entity from the raw source buffer on every call, and the
|
|
38
53
|
// validator hits Name/GlobalId/Description/getAttribute(Names) for the same
|
|
@@ -42,7 +57,7 @@ export function createDataAccessor(store, propertyOverlay) {
|
|
|
42
57
|
function getEntityAttributes(expressId) {
|
|
43
58
|
let all = attrCache.get(expressId);
|
|
44
59
|
if (!all) {
|
|
45
|
-
all = extractAllEntityAttributes(store, expressId);
|
|
60
|
+
all = overlay?.createdAttributes(expressId) ?? extractAllEntityAttributes(store, expressId);
|
|
46
61
|
attrCache.set(expressId, all);
|
|
47
62
|
}
|
|
48
63
|
return all;
|
|
@@ -67,6 +82,9 @@ export function createDataAccessor(store, propertyOverlay) {
|
|
|
67
82
|
}
|
|
68
83
|
const accessor = {
|
|
69
84
|
getEntityType(expressId) {
|
|
85
|
+
const overlaid = overlay?.typeOf(expressId);
|
|
86
|
+
if (overlaid)
|
|
87
|
+
return overlaid;
|
|
70
88
|
// The columnar entity table only summarises "interesting"
|
|
71
89
|
// entities (spatial, building elements, etc.); resource-level
|
|
72
90
|
// types resolve to `'Unknown'` there. Fall back to the raw
|
|
@@ -75,6 +93,7 @@ export function createDataAccessor(store, propertyOverlay) {
|
|
|
75
93
|
const entityType = store.entities?.getTypeName?.(expressId);
|
|
76
94
|
if (entityType && entityType !== 'Unknown')
|
|
77
95
|
return entityType;
|
|
96
|
+
// @raw-entity-enumeration-ok point lookup of one source record's parsed class; created and retyped ids were answered from the overlay above
|
|
78
97
|
const byId = store.entityIndex?.byId;
|
|
79
98
|
if (!byId)
|
|
80
99
|
return undefined;
|
|
@@ -98,6 +117,9 @@ export function createDataAccessor(store, propertyOverlay) {
|
|
|
98
117
|
return n || undefined;
|
|
99
118
|
},
|
|
100
119
|
getGlobalId(expressId) {
|
|
120
|
+
const created = overlay?.globalIdOf(expressId);
|
|
121
|
+
if (created)
|
|
122
|
+
return created;
|
|
101
123
|
const fromAttr = findAttributeValue(expressId, 'GlobalId');
|
|
102
124
|
if (fromAttr !== undefined && typeof fromAttr === 'string')
|
|
103
125
|
return fromAttr;
|
|
@@ -142,12 +164,14 @@ export function createDataAccessor(store, propertyOverlay) {
|
|
|
142
164
|
return undefined;
|
|
143
165
|
},
|
|
144
166
|
getEntitiesByType(typeName) {
|
|
145
|
-
|
|
146
|
-
|
|
167
|
+
if (!store.entityIndex)
|
|
168
|
+
return [];
|
|
169
|
+
return Array.from(iterateEffectiveEntities(store, entityVisibility, [typeName]), (e) => e.expressId);
|
|
147
170
|
},
|
|
148
171
|
getAllEntityIds() {
|
|
149
|
-
|
|
150
|
-
|
|
172
|
+
if (!store.entityIndex)
|
|
173
|
+
return [];
|
|
174
|
+
return Array.from(iterateEffectiveEntities(store, entityVisibility), (e) => e.expressId);
|
|
151
175
|
},
|
|
152
176
|
getPropertyValue(expressId, propertySetName, propertyName) {
|
|
153
177
|
const psetLower = propertySetName.toLowerCase();
|
|
@@ -173,7 +197,8 @@ export function createDataAccessor(store, propertyOverlay) {
|
|
|
173
197
|
return getEffectivePropertySets(expressId);
|
|
174
198
|
},
|
|
175
199
|
getClassifications(expressId) {
|
|
176
|
-
|
|
200
|
+
externalReferences ??= createExternalReferenceContext(store, entityVisibility);
|
|
201
|
+
return resolveClassifications(store, expressId, externalReferences);
|
|
177
202
|
},
|
|
178
203
|
getMaterials(expressId) {
|
|
179
204
|
// ALL associations — an IDS material requirement satisfied only by the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-accessor.js","sourceRoot":"","sources":["../../src/bridge/data-accessor.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAEL,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"data-accessor.js","sourceRoot":"","sources":["../../src/bridge/data-accessor.ts"],"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KAAK,MAAM;oBACT,OAAO,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;gBAC3C,KAAK,aAAa;oBAChB,OAAO,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;gBAC5C,KAAK,UAAU;oBACb,OAAO,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;gBACzC,iDAAiD;gBACjD,iEAAiE;gBACjE,4DAA4D;gBAC5D,6DAA6D;gBAC7D,0DAA0D;gBAC1D,uDAAuD;gBACvD,iEAAiE;gBACjE,KAAK,gBAAgB;oBACnB,OAAO,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;gBAC3C,OAAO,CAAC,CAAC,CAAC;oBACR,MAAM,WAAW,GAAG,kBAAkB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;oBACjE,IAAI,WAAW,KAAK,SAAS;wBAAE,OAAO,WAAW,CAAC;oBAClD,MAAM,QAAQ,GAAG,KAAK,CAAC,QAEtB,CAAC;oBACF,OAAO,QAAQ,EAAE,YAAY;wBAC3B,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,SAAS,EAAE,aAAa,CAAC;wBACjD,CAAC,CAAC,SAAS,CAAC;gBAChB,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The live-session overlay as the IDS bridge sees it (#5184, #5249).
|
|
3
|
+
*
|
|
4
|
+
* Enumeration (`getAllEntityIds`, `getEntitiesByType`) goes through the shared
|
|
5
|
+
* `iterateEffectiveEntities` in `@ifc-lite/data`, so a tombstoned entity is not
|
|
6
|
+
* validated and an overlay-created one is. An enumerated entity is only
|
|
7
|
+
* validated if the point reads agree with the enumeration. The validator
|
|
8
|
+
* confirms every candidate through `getEntityType`, so an overlay-created
|
|
9
|
+
* entity with no type answer would be listed and then silently dropped. This
|
|
10
|
+
* module answers those reads for overlay-created and retyped entities:
|
|
11
|
+
*
|
|
12
|
+
* - `typeOf`: the effective class (retype applied) of a created or retyped
|
|
13
|
+
* entity, `undefined` for anything else, so the store answers as before;
|
|
14
|
+
* - `createdAttributes`: a created entity's authored attributes, named from
|
|
15
|
+
* the schema. It has no source bytes for `extractAllEntityAttributes`.
|
|
16
|
+
*
|
|
17
|
+
* Attribute EDITS (`setAttribute`) on source or created entities are still not
|
|
18
|
+
* reflected. The bridge has never consulted them for source entities either,
|
|
19
|
+
* and that gap is separate from enumeration.
|
|
20
|
+
*/
|
|
21
|
+
import type { EffectiveEntityOverlay } from '@ifc-lite/data';
|
|
22
|
+
/**
|
|
23
|
+
* Overlay entity visibility, decoupled from `@ifc-lite/mutations` in the same
|
|
24
|
+
* way `PropertyOverlayResolver` is: this package does not depend on it. A live
|
|
25
|
+
* `MutablePropertyView` satisfies this shape as-is. A caller that only has a
|
|
26
|
+
* structured-clone snapshot (the IDS worker) hands in a plain object instead.
|
|
27
|
+
*/
|
|
28
|
+
export interface EntityVisibilityView extends EffectiveEntityOverlay {
|
|
29
|
+
/**
|
|
30
|
+
* Overlay-created entities still alive, with their authored class and
|
|
31
|
+
* positional attributes (`MutablePropertyView.getNewEntities()`).
|
|
32
|
+
*/
|
|
33
|
+
getNewEntities(): ReadonlyArray<{
|
|
34
|
+
readonly expressId: number;
|
|
35
|
+
readonly type: string;
|
|
36
|
+
readonly attributes?: ReadonlyArray<unknown>;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
type AttributeValue = string | number | boolean;
|
|
40
|
+
export interface OverlayEntityLookup {
|
|
41
|
+
typeOf(expressId: number): string | undefined;
|
|
42
|
+
createdAttributes(expressId: number): Array<{
|
|
43
|
+
name: string;
|
|
44
|
+
value: AttributeValue;
|
|
45
|
+
}> | undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Index the overlay's created and retyped entities once per accessor. The
|
|
49
|
+
* validator's `getEntityType` is hot (once per candidate), and
|
|
50
|
+
* `getNewEntities()` copies on every call.
|
|
51
|
+
*/
|
|
52
|
+
export declare function overlayEntityLookup(view: EntityVisibilityView): OverlayEntityLookup & {
|
|
53
|
+
globalIdOf(expressId: number): string | undefined;
|
|
54
|
+
};
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=entity-visibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-visibility.d.ts","sourceRoot":"","sources":["../../src/bridge/entity-visibility.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAG7D;;;;;GAKG;AACH,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB;IAClE;;;OAGG;IACH,cAAc,IAAI,aAAa,CAAC;QAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;KAC9C,CAAC,CAAC;CACJ;AAED,KAAK,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEhD,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC9C,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,cAAc,CAAA;KAAE,CAAC,GAAG,SAAS,CAAC;CAClG;AAWD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,GAAG,mBAAmB,GAAG;IACrF,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnD,CAuCA"}
|
|
@@ -0,0 +1,89 @@
|
|
|
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 } from '@ifc-lite/parser';
|
|
5
|
+
/**
|
|
6
|
+
* Attributes the parser's `extractAllEntityAttributes` omits
|
|
7
|
+
* (`SKIP_DISPLAY_ATTRS`). A created entity reports the same attribute names a
|
|
8
|
+
* parsed one does. Its GlobalId is still answered through `globalIdOf`.
|
|
9
|
+
*/
|
|
10
|
+
const SKIPPED_ATTRIBUTES = new Set([
|
|
11
|
+
'GlobalId', 'OwnerHistory', 'ObjectPlacement', 'Representation', 'HasPropertySets', 'RepresentationMaps',
|
|
12
|
+
]);
|
|
13
|
+
/**
|
|
14
|
+
* Index the overlay's created and retyped entities once per accessor. The
|
|
15
|
+
* validator's `getEntityType` is hot (once per candidate), and
|
|
16
|
+
* `getNewEntities()` copies on every call.
|
|
17
|
+
*/
|
|
18
|
+
export function overlayEntityLookup(view) {
|
|
19
|
+
const created = new Map();
|
|
20
|
+
for (const entity of view.getNewEntities()) {
|
|
21
|
+
created.set(entity.expressId, { type: entity.type, attributes: entity.attributes ?? [] });
|
|
22
|
+
}
|
|
23
|
+
const retypes = view.getTypeMutations?.() ?? new Map();
|
|
24
|
+
const attributeCache = new Map();
|
|
25
|
+
function namedAttributes(expressId) {
|
|
26
|
+
const entity = created.get(expressId);
|
|
27
|
+
if (!entity)
|
|
28
|
+
return undefined;
|
|
29
|
+
let named = attributeCache.get(expressId);
|
|
30
|
+
if (!named) {
|
|
31
|
+
named = [];
|
|
32
|
+
const names = getAttributeNamesAcrossSchemas(entity.type);
|
|
33
|
+
const len = Math.min(names.length, entity.attributes.length);
|
|
34
|
+
for (let i = 0; i < len; i++) {
|
|
35
|
+
const value = scalarAttributeValue(entity.attributes[i]);
|
|
36
|
+
if (value !== undefined)
|
|
37
|
+
named.push({ name: names[i], value });
|
|
38
|
+
}
|
|
39
|
+
attributeCache.set(expressId, named);
|
|
40
|
+
}
|
|
41
|
+
return named;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
typeOf(expressId) {
|
|
45
|
+
const retype = retypes.get(expressId);
|
|
46
|
+
if (retype)
|
|
47
|
+
return retype.newType;
|
|
48
|
+
return created.get(expressId)?.type;
|
|
49
|
+
},
|
|
50
|
+
createdAttributes(expressId) {
|
|
51
|
+
return namedAttributes(expressId)?.filter((a) => !SKIPPED_ATTRIBUTES.has(a.name));
|
|
52
|
+
},
|
|
53
|
+
globalIdOf(expressId) {
|
|
54
|
+
const value = namedAttributes(expressId)?.find((a) => a.name === 'GlobalId')?.value;
|
|
55
|
+
return typeof value === 'string' && value ? value : undefined;
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The scalar an authored attribute holds, normalised the way
|
|
61
|
+
* `extractAllEntityAttributes` normalises a parsed one: `.ENUM.` markers
|
|
62
|
+
* stripped, `.T.`/`.F.` as booleans, logical-unknown and unset as absent,
|
|
63
|
+
* typed wrappers unwrapped. References and aggregates are not attribute
|
|
64
|
+
* values the IDS attribute facet compares, so they are absent.
|
|
65
|
+
*/
|
|
66
|
+
function scalarAttributeValue(raw) {
|
|
67
|
+
if (typeof raw === 'number' || typeof raw === 'boolean')
|
|
68
|
+
return raw;
|
|
69
|
+
if (typeof raw === 'string') {
|
|
70
|
+
if (raw === '.U.' || raw === '.X.')
|
|
71
|
+
return undefined;
|
|
72
|
+
if (raw === '.T.')
|
|
73
|
+
return true;
|
|
74
|
+
if (raw === '.F.')
|
|
75
|
+
return false;
|
|
76
|
+
if (/^#\d+$/.test(raw))
|
|
77
|
+
return undefined;
|
|
78
|
+
return raw.length > 1 && raw.startsWith('.') && raw.endsWith('.') ? raw.slice(1, -1) : raw;
|
|
79
|
+
}
|
|
80
|
+
if (raw && typeof raw === 'object' && !Array.isArray(raw)) {
|
|
81
|
+
if ('real' in raw && typeof raw.real === 'number')
|
|
82
|
+
return raw.real;
|
|
83
|
+
if ('typed' in raw && raw.typed && typeof raw.typed === 'object' && 'value' in raw.typed) {
|
|
84
|
+
return scalarAttributeValue(raw.typed.value);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=entity-visibility.js.map
|