@ifc-lite/cli 0.41.0 → 0.42.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 +12 -1
- package/dist/commands/diff-engine.d.ts.map +1 -1
- package/dist/commands/diff-engine.js +9 -3
- package/dist/commands/diff-engine.js.map +1 -1
- package/dist/commands/doctor.d.ts +3 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +24 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/export-rust-formats.d.ts.map +1 -1
- package/dist/commands/export-rust-formats.js +37 -41
- package/dist/commands/export-rust-formats.js.map +1 -1
- package/dist/commands/extract-entities.d.ts.map +1 -1
- package/dist/commands/extract-entities.js +7 -11
- package/dist/commands/extract-entities.js.map +1 -1
- package/dist/commands/gym.d.ts.map +1 -1
- package/dist/commands/gym.js +2 -10
- package/dist/commands/gym.js.map +1 -1
- package/dist/commands/mutate.d.ts +6 -0
- package/dist/commands/mutate.d.ts.map +1 -1
- package/dist/commands/mutate.js +16 -19
- package/dist/commands/mutate.js.map +1 -1
- package/dist/commands/mutation-base.d.ts +4 -0
- package/dist/commands/mutation-base.d.ts.map +1 -0
- package/dist/commands/mutation-base.js +11 -0
- package/dist/commands/mutation-base.js.map +1 -0
- package/dist/commands/step-args.d.ts +0 -119
- package/dist/commands/step-args.d.ts.map +1 -1
- package/dist/commands/step-args.js +54 -49
- package/dist/commands/step-args.js.map +1 -1
- package/dist/commands/storey-selection.d.ts.map +1 -1
- package/dist/commands/storey-selection.js +16 -9
- package/dist/commands/storey-selection.js.map +1 -1
- package/dist/commands/subset-relations.d.ts +0 -76
- package/dist/commands/subset-relations.d.ts.map +1 -1
- package/dist/commands/subset-relations.js +88 -24
- package/dist/commands/subset-relations.js.map +1 -1
- package/dist/commands/test-fixtures/type-mutation.d.ts +18 -0
- package/dist/commands/test-fixtures/type-mutation.d.ts.map +1 -0
- package/dist/commands/test-fixtures/type-mutation.js +45 -0
- package/dist/commands/test-fixtures/type-mutation.js.map +1 -0
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +6 -0
- package/dist/commands/validate.js.map +1 -1
- package/dist/diagnostics.d.ts +33 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +113 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/headless-backend.d.ts +29 -77
- package/dist/headless-backend.d.ts.map +1 -1
- package/dist/headless-backend.js +54 -536
- package/dist/headless-backend.js.map +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +1 -0
- package/dist/help.js.map +1 -1
- package/dist/index.js +51 -82
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +7 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +34 -50
- package/dist/loader.js.map +1 -1
- package/package.json +21 -20
- package/dist/query-overlay-relations.d.ts +0 -9
- package/dist/query-overlay-relations.d.ts.map +0 -1
- package/dist/query-overlay-relations.js +0 -78
- package/dist/query-overlay-relations.js.map +0 -1
- package/dist/query-overlay.d.ts +0 -46
- package/dist/query-overlay.d.ts.map +0 -1
- package/dist/query-overlay.js +0 -141
- package/dist/query-overlay.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-overlay-relations.d.ts","sourceRoot":"","sources":["../src/query-overlay-relations.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAcpF;gEACgE;AAChE,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,mBAAmB,EACzB,MAAM,EAAE,uBAAuB,EAC/B,GAAG,EAAE,SAAS,EACd,UAAU,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,UAAU,GAAG,IAAI,GAChD,uBAAuB,CA8CzB;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,SAAS,EAAE,MAAM,GAChB,MAAM,EAAE,CAIV;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,mBAAmB,GAAG,WAAW,CAAC,MAAM,CAAC,CAE7G"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
-
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
-
import { effectiveRelationshipEdges, resolveEffectiveRelationshipOverlay, } from '@ifc-lite/parser';
|
|
5
|
-
import { effectiveEntityType } from './query-overlay.js';
|
|
6
|
-
function effective(store, view) {
|
|
7
|
-
return resolveEffectiveRelationshipOverlay(store, {
|
|
8
|
-
createdEntities: () => view.getNewEntities(),
|
|
9
|
-
mutatedEntityIds: () => view.getEffectiveChanges().map(change => change.entityId),
|
|
10
|
-
namedAttributes: id => view.getAttributeMutationsForEntity(id).map(({ name, value }) => [name, value]),
|
|
11
|
-
positionalAttributes: id => view.getPositionalMutationsForEntity(id) ?? [],
|
|
12
|
-
entityType: id => view.getEntityTypeMutation(id)?.newType,
|
|
13
|
-
isDeleted: id => view.isDeleted(id),
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
/** Apply queued relationship creates, endpoint edits and deletes to every
|
|
17
|
-
* relationship projection exposed by the public CLI backend. */
|
|
18
|
-
export function foldQueuedRelationshipData(store, view, result, ref, entityData) {
|
|
19
|
-
if (view.isDeleted(ref.expressId)) {
|
|
20
|
-
return { voids: [], fills: [], groups: [], connections: [], relations: [] };
|
|
21
|
-
}
|
|
22
|
-
const overlay = effective(store, view);
|
|
23
|
-
const seen = new Set();
|
|
24
|
-
const relations = (result.relations ?? []).flatMap((edge) => {
|
|
25
|
-
if (view.isDeleted(edge.relationshipId) || overlay.supersededSourceIds.has(edge.relationshipId)
|
|
26
|
-
|| view.isDeleted(edge.entity.id))
|
|
27
|
-
return [];
|
|
28
|
-
const target = entityData({ modelId: ref.modelId, expressId: edge.entity.id });
|
|
29
|
-
if (!target)
|
|
30
|
-
return [];
|
|
31
|
-
const key = `${edge.direction}:${edge.relationshipId}:${edge.entity.id}`;
|
|
32
|
-
if (seen.has(key))
|
|
33
|
-
return [];
|
|
34
|
-
seen.add(key);
|
|
35
|
-
// Parsed rows carry the exact subtype (IfcDoorStandardCase); only a queued retype replaces it.
|
|
36
|
-
const type = effectiveEntityType(view, edge.entity.id) ?? edge.entity.type;
|
|
37
|
-
return [{ ...edge, entity: { id: edge.entity.id, name: target.name || undefined, type } }];
|
|
38
|
-
});
|
|
39
|
-
for (const edge of effectiveRelationshipEdges(overlay, id => view.isDeleted(id), ref.expressId)) {
|
|
40
|
-
const key = `${edge.direction}:${edge.relationshipId}:${edge.targetId}`;
|
|
41
|
-
if (seen.has(key))
|
|
42
|
-
continue;
|
|
43
|
-
const target = entityData({ modelId: ref.modelId, expressId: edge.targetId });
|
|
44
|
-
if (!target)
|
|
45
|
-
continue;
|
|
46
|
-
seen.add(key);
|
|
47
|
-
relations.push({
|
|
48
|
-
relationshipId: edge.relationshipId,
|
|
49
|
-
relationshipType: edge.relationshipType,
|
|
50
|
-
direction: edge.direction,
|
|
51
|
-
entity: { id: edge.targetId, name: target.name || undefined, type: target.type },
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
const entities = (types, directions) => relations
|
|
55
|
-
.filter(edge => types.includes(edge.relationshipType.toUpperCase()) && directions.includes(edge.direction))
|
|
56
|
-
.map(edge => edge.entity);
|
|
57
|
-
return {
|
|
58
|
-
voids: entities(['IFCRELVOIDSELEMENT'], ['forward'])
|
|
59
|
-
.filter((entity, index, all) => all.findIndex(other => other.id === entity.id) === index),
|
|
60
|
-
fills: entities(['IFCRELFILLSELEMENT'], ['inverse'])
|
|
61
|
-
.filter((entity, index, all) => all.findIndex(other => other.id === entity.id) === index),
|
|
62
|
-
groups: entities(['IFCRELASSIGNSTOGROUP', 'IFCRELASSIGNSTOGROUPBYFACTOR'], ['inverse'])
|
|
63
|
-
.filter((entity, index, all) => all.findIndex(other => other.id === entity.id) === index),
|
|
64
|
-
connections: entities(['IFCRELCONNECTSPATHELEMENTS'], ['forward', 'inverse'])
|
|
65
|
-
.filter((entity, index, all) => entity.id !== ref.expressId
|
|
66
|
-
&& all.findIndex(other => other.id === entity.id) === index),
|
|
67
|
-
relations,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
export function foldQueuedRelated(store, view, relType, direction, expressId) {
|
|
71
|
-
return effectiveRelationshipEdges(effective(store, view), id => view.isDeleted(id), expressId, relType)
|
|
72
|
-
.filter(edge => edge.direction === direction)
|
|
73
|
-
.map(edge => edge.targetId);
|
|
74
|
-
}
|
|
75
|
-
export function supersededRelationshipIds(store, view) {
|
|
76
|
-
return effective(store, view).supersededSourceIds;
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=query-overlay-relations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-overlay-relations.js","sourceRoot":"","sources":["../src/query-overlay-relations.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAG/D,OAAO,EACL,0BAA0B,EAC1B,mCAAmC,GAEpC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,SAAS,SAAS,CAAC,KAAmB,EAAE,IAAyB;IAC/D,OAAO,mCAAmC,CAAC,KAAK,EAAE;QAChD,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE;QAC5C,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC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AED,MAAM,UAAU,yBAAyB,CAAC,KAAmB,EAAE,IAAyB;IACtF,OAAO,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,mBAAmB,CAAC;AACpD,CAAC"}
|
package/dist/query-overlay.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Overlay-visibility helpers for `HeadlessBackend.query` (headless-backend.ts).
|
|
3
|
-
*
|
|
4
|
-
* `StoreEditor.addEntity`/`removeEntity` never touch `store.entityIndex` (the
|
|
5
|
-
* parsed file's immutable index) — writes live only in the
|
|
6
|
-
* `MutablePropertyView` overlay. Without folding that in, a
|
|
7
|
-
* `bim.store.addEntity`/`removeEntity` followed by `bim.query()` in the same
|
|
8
|
-
* session answered about the file as parsed, not as the session had just
|
|
9
|
-
* changed it. `@ifc-lite/mcp`'s parallel backend already folds its overlay
|
|
10
|
-
* into every read (#2004, #2014); this ports the entity add/remove
|
|
11
|
-
* visibility half of that to the CLI via the overlay's own public
|
|
12
|
-
* `getNewEntities()`/`isDeleted()`.
|
|
13
|
-
*/
|
|
14
|
-
import type { EntityData, EntityRef, PropertySetData, QuantitySetData } from '@ifc-lite/sdk';
|
|
15
|
-
import type { MutablePropertyView } from '@ifc-lite/mutations';
|
|
16
|
-
/** The class a queued `setEntityType` gives the entity, in `IfcWall` spelling. */
|
|
17
|
-
export declare function effectiveEntityType(view: MutablePropertyView, expressId: number): string | null;
|
|
18
|
-
/** Apply the export's named-then-positional precedence to parsed root fields. */
|
|
19
|
-
export declare function applyParsedEntityOverrides(view: MutablePropertyView | null, expressId: number, type: string, schemaVersion: string, data: EntityData): EntityData;
|
|
20
|
-
/**
|
|
21
|
-
* `getEntityData(ref)`'s overlay half: `null` means deleted this session,
|
|
22
|
-
* `undefined` means "not in the overlay, fall through to the parsed store".
|
|
23
|
-
*/
|
|
24
|
-
export declare function overlayEntityData(view: MutablePropertyView | null, ref: EntityRef, schemaVersion: string): EntityData | null | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* `getProperties`/`getQuantities`'s overlay half. Unlike {@link overlayEntityData},
|
|
27
|
-
* this has no per-entity "not in the overlay" case to fall through on:
|
|
28
|
-
* `MutablePropertyView.getForEntity`/`getQuantitiesForEntity` already merge the
|
|
29
|
-
* wired on-demand extractor's base data with any SET/DELETE mutations (the same
|
|
30
|
-
* merge `StepExporter` reads for `bim.export.ifc()`), so once a session has a
|
|
31
|
-
* mutation view at all, it is the whole answer for every entity — mutated or
|
|
32
|
-
* not. `undefined` here means only "no mutation view exists yet" (a read-only
|
|
33
|
-
* session), the one case that still falls through to the parsed store.
|
|
34
|
-
*
|
|
35
|
-
* Before this, `getProperties`/`getQuantities` read `EntityNode` directly and
|
|
36
|
-
* never consulted the overlay at all: `bim.mutate.setProperty(...)` followed by
|
|
37
|
-
* `bim.properties(ref)` (or `bim.quantities`, or anything built on them —
|
|
38
|
-
* `export --format csv|json`, `props`, `query --where`) silently returned the
|
|
39
|
-
* pre-edit value in the same process, even though `bim.export.ifc()` on that
|
|
40
|
-
* same session already reflected the edit. #3498 folded the overlay into
|
|
41
|
-
* entity add/remove visibility and explicitly left this half out of scope.
|
|
42
|
-
*/
|
|
43
|
-
export declare function overlayProperties(view: MutablePropertyView | null, ref: EntityRef): PropertySetData[] | undefined;
|
|
44
|
-
/** `getQuantities`'s overlay half — see {@link overlayProperties}. */
|
|
45
|
-
export declare function overlayQuantities(view: MutablePropertyView | null, ref: EntityRef): QuantitySetData[] | undefined;
|
|
46
|
-
//# sourceMappingURL=query-overlay.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-overlay.d.ts","sourceRoot":"","sources":["../src/query-overlay.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,KAAK,EAAE,mBAAmB,EAAa,MAAM,qBAAqB,CAAC;AA2C1E,kFAAkF;AAClF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG/F;AAED,iFAAiF;AACjF,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,mBAAmB,GAAG,IAAI,EAChC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,UAAU,GACf,UAAU,CAwBZ;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,mBAAmB,GAAG,IAAI,EAChC,GAAG,EAAE,SAAS,EACd,aAAa,EAAE,MAAM,GACpB,UAAU,GAAG,IAAI,GAAG,SAAS,CAM/B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,EAAE,GAAG,EAAE,SAAS,GAAG,eAAe,EAAE,GAAG,SAAS,CAYjH;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,EAAE,GAAG,EAAE,SAAS,GAAG,eAAe,EAAE,GAAG,SAAS,CAOjH"}
|
package/dist/query-overlay.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
-
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
-
import { getAttributeNamesForSchema, normalizeIfcTypeName, resolveEffectiveEntityRecord } from '@ifc-lite/parser';
|
|
5
|
-
function scalarAttr(value) {
|
|
6
|
-
if (typeof value !== 'string')
|
|
7
|
-
return '';
|
|
8
|
-
const trimmed = value.trim();
|
|
9
|
-
if (trimmed === '' || trimmed === '$' || trimmed === '*')
|
|
10
|
-
return '';
|
|
11
|
-
if (trimmed.length >= 2 && trimmed.startsWith("'") && trimmed.endsWith("'")) {
|
|
12
|
-
return trimmed.slice(1, -1).replace(/''/g, "'");
|
|
13
|
-
}
|
|
14
|
-
return trimmed;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Slots 0/2/3 are GlobalId/Name/Description on every IfcRoot subtype (the
|
|
18
|
-
* only classes this backend queries). Slot 4 differs by class (ObjectType vs
|
|
19
|
-
* ApplicableOccurrence), so it's left blank rather than misread.
|
|
20
|
-
*/
|
|
21
|
-
function createdEntityData(entity, modelId) {
|
|
22
|
-
return {
|
|
23
|
-
ref: { modelId, expressId: entity.expressId },
|
|
24
|
-
globalId: scalarAttr(entity.attributes[0]),
|
|
25
|
-
name: scalarAttr(entity.attributes[2]),
|
|
26
|
-
type: entity.type,
|
|
27
|
-
description: scalarAttr(entity.attributes[3]),
|
|
28
|
-
objectType: '',
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
/** The created entity as export writes it: effective class, name-relaid attributes, edits applied. */
|
|
32
|
-
function effectiveCreatedEntity(view, entity, schemaVersion) {
|
|
33
|
-
const record = resolveEffectiveEntityRecord(entity, {
|
|
34
|
-
retype: view.getEntityTypeMutation(entity.expressId)?.newType,
|
|
35
|
-
named: view.getAttributeMutationsForEntity(entity.expressId).map(({ name, value }) => [name, value]),
|
|
36
|
-
positional: view.getPositionalMutationsForEntity(entity.expressId) ?? [],
|
|
37
|
-
}, schemaVersion);
|
|
38
|
-
return { ...entity, type: record.type, attributes: record.attributes };
|
|
39
|
-
}
|
|
40
|
-
/** The class a queued `setEntityType` gives the entity, in `IfcWall` spelling. */
|
|
41
|
-
export function effectiveEntityType(view, expressId) {
|
|
42
|
-
const retype = view.getEntityTypeMutation(expressId)?.newType;
|
|
43
|
-
return retype ? normalizeIfcTypeName(retype) : null;
|
|
44
|
-
}
|
|
45
|
-
/** Apply the export's named-then-positional precedence to parsed root fields. */
|
|
46
|
-
export function applyParsedEntityOverrides(view, expressId, type, schemaVersion, data) {
|
|
47
|
-
if (!view)
|
|
48
|
-
return data;
|
|
49
|
-
const effectiveType = effectiveEntityType(view, expressId);
|
|
50
|
-
// Positional slots are named by the effective class, as export lays them out.
|
|
51
|
-
const names = getAttributeNamesForSchema(effectiveType ?? type, schemaVersion);
|
|
52
|
-
const next = { ...data, type: effectiveType ?? data.type };
|
|
53
|
-
// A retype re-lays the record out by name: a header slot the effective
|
|
54
|
-
// class does not declare is gone from the saved file, so it is gone here.
|
|
55
|
-
if (effectiveType && names.length > 0 && !names.includes('ObjectType'))
|
|
56
|
-
next.objectType = '';
|
|
57
|
-
const apply = (name, value) => {
|
|
58
|
-
const text = scalarAttr(value);
|
|
59
|
-
switch (name) {
|
|
60
|
-
case 'GlobalId':
|
|
61
|
-
next.globalId = text;
|
|
62
|
-
break;
|
|
63
|
-
case 'Name':
|
|
64
|
-
next.name = text;
|
|
65
|
-
break;
|
|
66
|
-
case 'Description':
|
|
67
|
-
next.description = text;
|
|
68
|
-
break;
|
|
69
|
-
case 'ObjectType':
|
|
70
|
-
next.objectType = text;
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
for (const { name, value } of view.getAttributeMutationsForEntity(expressId))
|
|
75
|
-
apply(name, value);
|
|
76
|
-
for (const [index, value] of view.getPositionalMutationsForEntity(expressId) ?? []) {
|
|
77
|
-
const name = names[index];
|
|
78
|
-
if (name)
|
|
79
|
-
apply(name, value);
|
|
80
|
-
}
|
|
81
|
-
return next;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* `getEntityData(ref)`'s overlay half: `null` means deleted this session,
|
|
85
|
-
* `undefined` means "not in the overlay, fall through to the parsed store".
|
|
86
|
-
*/
|
|
87
|
-
export function overlayEntityData(view, ref, schemaVersion) {
|
|
88
|
-
if (!view)
|
|
89
|
-
return undefined;
|
|
90
|
-
if (view.isDeleted(ref.expressId))
|
|
91
|
-
return null;
|
|
92
|
-
const created = view.getNewEntity(ref.expressId);
|
|
93
|
-
if (!created)
|
|
94
|
-
return undefined;
|
|
95
|
-
return createdEntityData(effectiveCreatedEntity(view, created, schemaVersion), ref.modelId);
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* `getProperties`/`getQuantities`'s overlay half. Unlike {@link overlayEntityData},
|
|
99
|
-
* this has no per-entity "not in the overlay" case to fall through on:
|
|
100
|
-
* `MutablePropertyView.getForEntity`/`getQuantitiesForEntity` already merge the
|
|
101
|
-
* wired on-demand extractor's base data with any SET/DELETE mutations (the same
|
|
102
|
-
* merge `StepExporter` reads for `bim.export.ifc()`), so once a session has a
|
|
103
|
-
* mutation view at all, it is the whole answer for every entity — mutated or
|
|
104
|
-
* not. `undefined` here means only "no mutation view exists yet" (a read-only
|
|
105
|
-
* session), the one case that still falls through to the parsed store.
|
|
106
|
-
*
|
|
107
|
-
* Before this, `getProperties`/`getQuantities` read `EntityNode` directly and
|
|
108
|
-
* never consulted the overlay at all: `bim.mutate.setProperty(...)` followed by
|
|
109
|
-
* `bim.properties(ref)` (or `bim.quantities`, or anything built on them —
|
|
110
|
-
* `export --format csv|json`, `props`, `query --where`) silently returned the
|
|
111
|
-
* pre-edit value in the same process, even though `bim.export.ifc()` on that
|
|
112
|
-
* same session already reflected the edit. #3498 folded the overlay into
|
|
113
|
-
* entity add/remove visibility and explicitly left this half out of scope.
|
|
114
|
-
*/
|
|
115
|
-
export function overlayProperties(view, ref) {
|
|
116
|
-
if (!view)
|
|
117
|
-
return undefined;
|
|
118
|
-
if (view.isDeleted(ref.expressId))
|
|
119
|
-
return [];
|
|
120
|
-
return view.getForEntity(ref.expressId).map((pset) => ({
|
|
121
|
-
name: pset.name,
|
|
122
|
-
globalId: pset.globalId,
|
|
123
|
-
properties: pset.properties.map((p) => ({
|
|
124
|
-
name: p.name,
|
|
125
|
-
type: p.type,
|
|
126
|
-
value: p.value,
|
|
127
|
-
})),
|
|
128
|
-
}));
|
|
129
|
-
}
|
|
130
|
-
/** `getQuantities`'s overlay half — see {@link overlayProperties}. */
|
|
131
|
-
export function overlayQuantities(view, ref) {
|
|
132
|
-
if (!view)
|
|
133
|
-
return undefined;
|
|
134
|
-
if (view.isDeleted(ref.expressId))
|
|
135
|
-
return [];
|
|
136
|
-
return view.getQuantitiesForEntity(ref.expressId).map((qset) => ({
|
|
137
|
-
name: qset.name,
|
|
138
|
-
quantities: qset.quantities.map((q) => ({ name: q.name, type: q.type, value: q.value })),
|
|
139
|
-
}));
|
|
140
|
-
}
|
|
141
|
-
//# sourceMappingURL=query-overlay.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-overlay.js","sourceRoot":"","sources":["../src/query-overlay.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAkB/D,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAElH,SAAS,UAAU,CAAC,KAAc;IAChC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IACzC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,OAAO,KAAK,EAAE,IAAI,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,GAAG;QAAE,OAAO,EAAE,CAAC;IACpE,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5E,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,MAA4D,EAAE,OAAe;IACtG,OAAO;QACL,GAAG,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE;QAC7C,QAAQ,EAAE,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