@ifc-lite/ids 2.0.0 → 3.0.3
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 +24 -1
- package/dist/bridge/classifications.d.ts.map +1 -1
- package/dist/bridge/classifications.js +95 -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 +68 -0
- package/dist/bridge/entity-visibility.d.ts.map +1 -0
- package/dist/bridge/entity-visibility.js +161 -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 +4 -4
|
@@ -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,26 @@ 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
|
+
/**
|
|
72
|
+
* Valid for ONE validation run: the relationship list and created records are
|
|
73
|
+
* snapshotted when built. Callers build a fresh accessor per run.
|
|
74
|
+
*/
|
|
75
|
+
export declare function createExternalReferenceContext(store: IfcDataStore, overlay: EntityVisibilityView | undefined): ExternalReferenceContext;
|
|
76
|
+
export {};
|
|
54
77
|
//# 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,EAAsB,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAWvF;;;;;;;;;;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;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,oBAAoB,GAAG,SAAS,GACxC,wBAAwB,CA6B1B"}
|
|
@@ -5,6 +5,8 @@ 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';
|
|
9
|
+
import { typedAuthoredValue } from './entity-visibility.js';
|
|
8
10
|
/**
|
|
9
11
|
* Resolve every classification associated with `expressId`, including
|
|
10
12
|
* 1. the standard `IfcRelAssociatesClassification` path (handled by
|
|
@@ -16,11 +18,11 @@ import * as IFC4X3_SCHEMA from '@ifc-lite/codegen/ifc4x3';
|
|
|
16
18
|
* entries — one per parent reference in the chain — so a requirement
|
|
17
19
|
* for `EF_25_10` matches an actual leaf of `EF_25_10_25`.
|
|
18
20
|
*/
|
|
19
|
-
export function resolveClassifications(store, expressId) {
|
|
21
|
+
export function resolveClassifications(store, expressId, externalReferences) {
|
|
20
22
|
const list = [
|
|
21
23
|
...(extractClassificationsOnDemand(store, expressId) || []),
|
|
22
24
|
];
|
|
23
|
-
appendExternalReferenceClassifications(store, expressId, list);
|
|
25
|
+
appendExternalReferenceClassifications(store, expressId, list, externalReferences ?? createExternalReferenceContext(store, undefined));
|
|
24
26
|
const out = [];
|
|
25
27
|
for (const c of list) {
|
|
26
28
|
const system = c.system || '';
|
|
@@ -65,7 +67,7 @@ export function resolveClassifications(store, expressId) {
|
|
|
65
67
|
* relationship-graph fallback at all for this one (#3954): presence cannot
|
|
66
68
|
* be proven OR disproven without source bytes.
|
|
67
69
|
*/
|
|
68
|
-
function appendExternalReferenceClassifications(store, expressId, list) {
|
|
70
|
+
function appendExternalReferenceClassifications(store, expressId, list, context) {
|
|
69
71
|
if (!store.source?.length) {
|
|
70
72
|
// Only fall back to "cannot determine" when:
|
|
71
73
|
// 1. the IfcRelAssociatesClassification path (already applied to `list`
|
|
@@ -88,15 +90,9 @@ function appendExternalReferenceClassifications(store, expressId, list) {
|
|
|
88
90
|
}
|
|
89
91
|
return;
|
|
90
92
|
}
|
|
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);
|
|
93
|
+
const { read, relationshipIds: erIds } = context;
|
|
94
|
+
for (const erId of erIds) {
|
|
95
|
+
const erEntity = read(erId);
|
|
100
96
|
if (!erEntity)
|
|
101
97
|
continue;
|
|
102
98
|
// [Name, Description, RelatingReference, RelatedResourceObjects]
|
|
@@ -108,10 +104,7 @@ function appendExternalReferenceClassifications(store, expressId, list) {
|
|
|
108
104
|
continue;
|
|
109
105
|
if (!related.includes(expressId))
|
|
110
106
|
continue;
|
|
111
|
-
const
|
|
112
|
-
if (!refRef)
|
|
113
|
-
continue;
|
|
114
|
-
const refEntity = ex.extractEntity(refRef);
|
|
107
|
+
const refEntity = read(relating);
|
|
115
108
|
if (!refEntity)
|
|
116
109
|
continue;
|
|
117
110
|
if (refEntity.type.toUpperCase() !== 'IFCCLASSIFICATIONREFERENCE')
|
|
@@ -124,14 +117,27 @@ function appendExternalReferenceClassifications(store, expressId, list) {
|
|
|
124
117
|
};
|
|
125
118
|
let cursor = typeof a[3] === 'number' ? a[3] : undefined;
|
|
126
119
|
const seen = new Set();
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
120
|
+
// #5290: this walk is the `IfcExternalReferenceRelationship` twin of
|
|
121
|
+
// `@ifc-lite/parser`'s `walkClassificationChain` — same chain, same
|
|
122
|
+
// break-without-reporting defect. A dangling `cursor`, an unreadable
|
|
123
|
+
// entity, an unexpected type, or a cycle back to an already-seen id all
|
|
124
|
+
// mean "this data cannot say whether a system exists", distinct from
|
|
125
|
+
// `cursor` legitimately becoming `undefined` (`ReferencedSource`
|
|
126
|
+
// omitted — schema-legal). `info.system` is `undefined` either way, so
|
|
127
|
+
// `info.unresolved` is the only signal `resolveClassifications`'
|
|
128
|
+
// caller has to tell the two apart; without it, `c.system || ''`
|
|
129
|
+
// flattens a broken chain into a confident empty system.
|
|
130
|
+
while (cursor !== undefined) {
|
|
131
|
+
if (seen.has(cursor)) {
|
|
132
|
+
info.unresolved = true;
|
|
131
133
|
break;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
}
|
|
135
|
+
seen.add(cursor);
|
|
136
|
+
const e = read(cursor);
|
|
137
|
+
if (!e) {
|
|
138
|
+
info.unresolved = true;
|
|
134
139
|
break;
|
|
140
|
+
}
|
|
135
141
|
const cu = e.type.toUpperCase();
|
|
136
142
|
const ca = e.attributes || [];
|
|
137
143
|
if (cu === 'IFCCLASSIFICATION') {
|
|
@@ -149,6 +155,7 @@ function appendExternalReferenceClassifications(store, expressId, list) {
|
|
|
149
155
|
cursor = typeof ca[3] === 'number' ? ca[3] : undefined;
|
|
150
156
|
continue;
|
|
151
157
|
}
|
|
158
|
+
info.unresolved = true;
|
|
152
159
|
break;
|
|
153
160
|
}
|
|
154
161
|
list.push(info);
|
|
@@ -216,9 +223,75 @@ export function isNonRootedClassifiableResourceType(upperType) {
|
|
|
216
223
|
* nothing on a server-parsed store.
|
|
217
224
|
*/
|
|
218
225
|
function isNonRootedClassifiableResource(store, expressId) {
|
|
226
|
+
// @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
227
|
const type = store.entityIndex?.byId?.get?.(expressId)?.type;
|
|
220
228
|
if (typeof type !== 'string')
|
|
221
229
|
return false;
|
|
222
230
|
return isNonRootedClassifiableResourceType(type.toUpperCase());
|
|
223
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Valid for ONE validation run: the relationship list and created records are
|
|
234
|
+
* snapshotted when built. Callers build a fresh accessor per run.
|
|
235
|
+
*/
|
|
236
|
+
export function createExternalReferenceContext(store, overlay) {
|
|
237
|
+
if (!store.entityIndex)
|
|
238
|
+
return { relationshipIds: [], read: () => undefined };
|
|
239
|
+
const ex = new EntityExtractor(store.source);
|
|
240
|
+
const created = new Map();
|
|
241
|
+
for (const entity of overlay?.getNewEntities() ?? []) {
|
|
242
|
+
created.set(entity.expressId, { type: entity.type, attributes: entity.attributes ?? [] });
|
|
243
|
+
}
|
|
244
|
+
const retypes = overlay?.getTypeMutations?.();
|
|
245
|
+
const relationshipIds = Array.from(iterateEffectiveEntities(store, overlay, ['IFCEXTERNALREFERENCERELATIONSHIP']), (e) => e.expressId);
|
|
246
|
+
return {
|
|
247
|
+
relationshipIds,
|
|
248
|
+
read(id) {
|
|
249
|
+
if (overlay?.isDeleted(id))
|
|
250
|
+
return undefined;
|
|
251
|
+
const retype = retypes?.get(id)?.newType;
|
|
252
|
+
const authored = created.get(id);
|
|
253
|
+
if (authored) {
|
|
254
|
+
return { type: retype ?? authored.type, attributes: authored.attributes.map(authoredValue) };
|
|
255
|
+
}
|
|
256
|
+
// @raw-entity-enumeration-ok point read of one source record, after the overlay answered for deleted and created ids
|
|
257
|
+
const ref = store.entityIndex.byId.get(id);
|
|
258
|
+
if (!ref)
|
|
259
|
+
return undefined;
|
|
260
|
+
const entity = ex.extractEntity(ref);
|
|
261
|
+
if (!entity)
|
|
262
|
+
return undefined;
|
|
263
|
+
return { type: retype ?? entity.type, attributes: entity.attributes ?? [] };
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* An authored attribute in the shape `EntityExtractor` yields for a parsed
|
|
269
|
+
* one: a `#id` reference as a number, `$`/`*` as absent, a typed wrapper or a
|
|
270
|
+
* `{ real }` number unwrapped. A plain string is the literal value. The STEP
|
|
271
|
+
* serializer (`serializeStepValue`) writes it quoted, so it is never
|
|
272
|
+
* pre-quoted here, and quote characters are kept as data.
|
|
273
|
+
*/
|
|
274
|
+
function authoredValue(value) {
|
|
275
|
+
if (Array.isArray(value))
|
|
276
|
+
return value.map(authoredValue);
|
|
277
|
+
if (value && typeof value === 'object') {
|
|
278
|
+
if ('real' in value && typeof value.real === 'number')
|
|
279
|
+
return value.real;
|
|
280
|
+
// A typed value is converted by its base type, as the writer does; a
|
|
281
|
+
// typed label whose text is '#12' or '$' stays that text.
|
|
282
|
+
if ('typed' in value && value.typed && typeof value.typed === 'object' && 'value' in value.typed) {
|
|
283
|
+
return typedAuthoredValue(value.typed);
|
|
284
|
+
}
|
|
285
|
+
return value;
|
|
286
|
+
}
|
|
287
|
+
if (typeof value !== 'string')
|
|
288
|
+
return value;
|
|
289
|
+
const token = value.trim();
|
|
290
|
+
const ref = /^#(\d+)$/.exec(token);
|
|
291
|
+
if (ref)
|
|
292
|
+
return Number(ref[1]);
|
|
293
|
+
if (token === '$' || token === '*')
|
|
294
|
+
return undefined;
|
|
295
|
+
return value;
|
|
296
|
+
}
|
|
224
297
|
//# 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;AAE1D,OAAO,EAAE,kBAAkB,EAA6B,MAAM,wBAA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AAI,OAAO,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YACjG,OAAO,kBAAkB,CAAC,KAAK,CAAC,KAA2C,CAAC,CAAC;QAC/E,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC3B,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,GAAG;QAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;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"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAEL,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AAYxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,8BAA8B,EAAE,sBAAsB,EAAiC,MAAM,sBAAsB,CAAC;AAC7H,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EACL,4BAA4B,GAG7B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAA6B,MAAM,wBAAwB,CAAC;AAMxF,0EAA0E;AAC1E,2EAA2E;AAC3E,oEAAoE;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAmB,EACnB,eAAy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AC,CAAC,SAAS,CAAC;gBAChB,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
/**
|
|
56
|
+
* The value of an authored `{ typed: { type, value } }` marker as the STEP
|
|
57
|
+
* writer emits it (#5249), converted by the type's EXPRESS base exactly as
|
|
58
|
+
* `serializeInnerByBase` does: REAL/NUMBER as a number, INTEGER truncated,
|
|
59
|
+
* BOOLEAN as a boolean (unrecognised reads `false`), LOGICAL tri-state (unknown
|
|
60
|
+
* is absent), STRING/BINARY as literal text, so a typed label reading `#22` is
|
|
61
|
+
* that text, never a reference. An unknown type infers from the JS value.
|
|
62
|
+
*/
|
|
63
|
+
export declare function typedAuthoredValue(typed: {
|
|
64
|
+
type?: unknown;
|
|
65
|
+
value: unknown;
|
|
66
|
+
}): AttributeValue | undefined;
|
|
67
|
+
export {};
|
|
68
|
+
//# 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;AA8DD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,cAAc,GAAG,SAAS,CAwBxG"}
|