@ifc-lite/export 2.9.4 → 3.0.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/dist/csv-cell.d.ts +101 -0
- package/dist/csv-cell.d.ts.map +1 -0
- package/dist/csv-cell.js +90 -0
- package/dist/csv-cell.js.map +1 -0
- package/dist/demesh-session.d.ts.map +1 -1
- package/dist/demesh-session.js +2 -1
- package/dist/demesh-session.js.map +1 -1
- package/dist/effective-index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/lod1-generator.d.ts +0 -2
- package/dist/lod1-generator.d.ts.map +1 -1
- package/dist/lod1-generator.js +1 -1
- package/dist/lod1-generator.js.map +1 -1
- package/dist/merged-exporter.d.ts.map +1 -1
- package/dist/merged-exporter.js +23 -41
- package/dist/merged-exporter.js.map +1 -1
- package/dist/reference-collector.js +1 -1
- package/dist/step-attribute-mutations.d.ts +91 -0
- package/dist/step-attribute-mutations.d.ts.map +1 -0
- package/dist/step-attribute-mutations.js +302 -0
- package/dist/step-attribute-mutations.js.map +1 -0
- package/dist/step-collection.d.ts +55 -0
- package/dist/step-collection.d.ts.map +1 -0
- package/dist/step-collection.js +125 -0
- package/dist/step-collection.js.map +1 -0
- package/dist/step-export-contexts.d.ts +63 -0
- package/dist/step-export-contexts.d.ts.map +1 -0
- package/dist/step-export-contexts.js +51 -0
- package/dist/step-export-contexts.js.map +1 -0
- package/dist/step-export-types.d.ts +262 -0
- package/dist/step-export-types.d.ts.map +1 -0
- package/dist/step-export-types.js +22 -0
- package/dist/step-export-types.js.map +1 -0
- package/dist/step-exporter.d.ts +20 -351
- package/dist/step-exporter.d.ts.map +1 -1
- package/dist/step-exporter.js +73 -1257
- package/dist/step-exporter.js.map +1 -1
- package/dist/step-geometry-types.d.ts +19 -0
- package/dist/step-geometry-types.d.ts.map +1 -0
- package/dist/step-geometry-types.js +57 -0
- package/dist/step-geometry-types.js.map +1 -0
- package/dist/step-header.d.ts +43 -0
- package/dist/step-header.d.ts.map +1 -0
- package/dist/step-header.js +70 -0
- package/dist/step-header.js.map +1 -0
- package/dist/step-omission-predicates.d.ts +51 -0
- package/dist/step-omission-predicates.d.ts.map +1 -0
- package/dist/step-omission-predicates.js +268 -0
- package/dist/step-omission-predicates.js.map +1 -0
- package/dist/step-overlay-entities.d.ts +64 -0
- package/dist/step-overlay-entities.d.ts.map +1 -0
- package/dist/step-overlay-entities.js +119 -0
- package/dist/step-overlay-entities.js.map +1 -0
- package/dist/step-pass-builder.d.ts +44 -0
- package/dist/step-pass-builder.d.ts.map +1 -0
- package/dist/step-pass-builder.js +249 -0
- package/dist/step-pass-builder.js.map +1 -0
- package/dist/step-property-sets.d.ts +7 -5
- package/dist/step-property-sets.d.ts.map +1 -1
- package/dist/step-property-sets.js.map +1 -1
- package/dist/step-serialization.d.ts +16 -1
- package/dist/step-serialization.d.ts.map +1 -1
- package/dist/step-serialization.js +50 -3
- package/dist/step-serialization.js.map +1 -1
- package/dist/step-source-iteration.d.ts +95 -0
- package/dist/step-source-iteration.d.ts.map +1 -0
- package/dist/step-source-iteration.js +178 -0
- package/dist/step-source-iteration.js.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The overlay-created-entities phase of `StepExporter.export()` (#2475 step
|
|
3
|
+
* 2e): the pass that writes one line per entity the OVERLAY created
|
|
4
|
+
* (`store.addEntity` / `mutationView.createEntity`), as opposed to
|
|
5
|
+
* `step-source-iteration.ts`, which writes lines for records the SOURCE file
|
|
6
|
+
* already holds.
|
|
7
|
+
*
|
|
8
|
+
* It runs last among the four output passes — after georeferencing
|
|
9
|
+
* (`step-georeferencing.ts`), property/quantity-set generation
|
|
10
|
+
* (`step-property-sets.ts`) and source iteration — and reads what two of them
|
|
11
|
+
* wrote: `pass.modifiedAttributes` (attribute-collection phase, applied here
|
|
12
|
+
* as an overlay-created entity's post-create edits) and
|
|
13
|
+
* `pass.overlayTypeOwnedPsets` (`step-property-sets.ts`, a created TYPE
|
|
14
|
+
* object's generated pset ids, arriving as one more positional override).
|
|
15
|
+
* Nothing downstream of this phase reads anything it writes except the
|
|
16
|
+
* settle/assemble tail, so it moves cleanly.
|
|
17
|
+
*
|
|
18
|
+
* What is injected rather than read off the pass, and why: `isGeometryEntity`
|
|
19
|
+
* is shared with the setup closure and with `step-source-iteration.ts`.
|
|
20
|
+
* `relationshipWithheldWarning` is the same pure string formatter
|
|
21
|
+
* `step-source-iteration.ts` already injects, not duplicated here.
|
|
22
|
+
* `applyOverlayEntityOverrides` is injected as `OverlayEntitiesContext`'s
|
|
23
|
+
* field even though, since #2475's "remaining private helpers" step, it is
|
|
24
|
+
* an ordinary export of `step-attribute-mutations.ts` this file could import
|
|
25
|
+
* directly — kept as an injected field for symmetry with the other two and
|
|
26
|
+
* because `StepExporter.overlayEntitiesContext()` is still the one
|
|
27
|
+
* construction site for this context, exactly as before that step.
|
|
28
|
+
*
|
|
29
|
+
* `mutationView` is passed through as-is (not narrowed to an interface of the
|
|
30
|
+
* three optional methods this phase calls) because the original code guards
|
|
31
|
+
* every one of them with its own `typeof x === 'function'` check rather than
|
|
32
|
+
* assuming the shape — a real-store `MutablePropertyView` versus a bare mock
|
|
33
|
+
* used by some tests. Narrowing the type here would not remove those checks
|
|
34
|
+
* without also changing what a test double is allowed to omit.
|
|
35
|
+
*/
|
|
36
|
+
import type { IfcAttributeValue } from '@ifc-lite/parser';
|
|
37
|
+
import type { MutablePropertyView } from '@ifc-lite/mutations';
|
|
38
|
+
import type { ExportPass, StepExportOptions } from './step-exporter.js';
|
|
39
|
+
/**
|
|
40
|
+
* The exporter state this phase cannot read off the {@link ExportPass}.
|
|
41
|
+
*/
|
|
42
|
+
export interface OverlayEntitiesContext {
|
|
43
|
+
readonly mutationView: MutablePropertyView | null;
|
|
44
|
+
/** `step-attribute-mutations.ts`'s `applyOverlayEntityOverrides`: resolves
|
|
45
|
+
* named/positional overrides against the overlay-created entity's
|
|
46
|
+
* EFFECTIVE class. */
|
|
47
|
+
readonly applyOverlayEntityOverrides: (argsText: string, entityType: string, attributeOverrides: Map<string, string> | null, positionalOverrides: Map<number, IfcAttributeValue> | null, schemaVersion: ExportPass['sourceSchema'], onRejected?: (attrName: string, value: string) => void) => string;
|
|
48
|
+
/** `isGeometryEntity` (`step-geometry-types.ts`), also read by the setup closure and by
|
|
49
|
+
* `step-source-iteration.ts`. */
|
|
50
|
+
readonly isGeometryEntity: (type: string) => boolean;
|
|
51
|
+
/** The `relationshipWithheldWarning` message builder (`step-exporter.ts`):
|
|
52
|
+
* a pure string formatter with no pass dependency, injected here as it is
|
|
53
|
+
* into `step-source-iteration.ts`. */
|
|
54
|
+
readonly relationshipWithheldWarning: (expressId: number, type: string) => string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Add overlay-created entities (store.addEntity / mutationView.createEntity).
|
|
58
|
+
* Apply the same filters as the source-iteration pass so newly-created
|
|
59
|
+
* beams/slabs don't smuggle their geometry helpers (IfcCartesianPoint,
|
|
60
|
+
* IfcExtrudedAreaSolid, etc.) past `includeGeometry:false` /
|
|
61
|
+
* `exportPropertiesOnly()` modes.
|
|
62
|
+
*/
|
|
63
|
+
export declare function writeOverlayCreatedEntities(pass: ExportPass, options: StepExportOptions, excludeGeometry: boolean, applyMutations: boolean, mayNameOmittedRefs: boolean, isOmittedFromOutput: (id: number) => boolean, ctx: OverlayEntitiesContext): void;
|
|
64
|
+
//# sourceMappingURL=step-overlay-entities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-overlay-entities.d.ts","sourceRoot":"","sources":["../src/step-overlay-entities.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAM/D,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,YAAY,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAClD;;2BAEuB;IACvB,QAAQ,CAAC,2BAA2B,EAAE,CACpC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EAC9C,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,IAAI,EAC1D,aAAa,EAAE,UAAU,CAAC,cAAc,CAAC,EACzC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,KACnD,MAAM,CAAC;IACZ;sCACkC;IAClC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACrD;;2CAEuC;IACvC,QAAQ,CAAC,2BAA2B,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACnF;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,iBAAiB,EAC1B,eAAe,EAAE,OAAO,EACxB,cAAc,EAAE,OAAO,EACvB,kBAAkB,EAAE,OAAO,EAC3B,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,EAC5C,GAAG,EAAE,sBAAsB,GAC1B,IAAI,CA4HN"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { filterHiddenRefsFromRelationshipLine } from './reference-collector.js';
|
|
5
|
+
import { convertStepLine } from './schema-converter.js';
|
|
6
|
+
import { retypeArgTokens } from './retype.js';
|
|
7
|
+
import { HAS_PROPERTY_SETS_SLOT } from './type-owned-psets.js';
|
|
8
|
+
import { serializeEntityArgs, serializeAttributeSlot } from './attribute-real-slots.js';
|
|
9
|
+
/**
|
|
10
|
+
* Add overlay-created entities (store.addEntity / mutationView.createEntity).
|
|
11
|
+
* Apply the same filters as the source-iteration pass so newly-created
|
|
12
|
+
* beams/slabs don't smuggle their geometry helpers (IfcCartesianPoint,
|
|
13
|
+
* IfcExtrudedAreaSolid, etc.) past `includeGeometry:false` /
|
|
14
|
+
* `exportPropertiesOnly()` modes.
|
|
15
|
+
*/
|
|
16
|
+
export function writeOverlayCreatedEntities(pass, options, excludeGeometry, applyMutations, mayNameOmittedRefs, isOmittedFromOutput, ctx) {
|
|
17
|
+
if (!ctx.mutationView
|
|
18
|
+
|| !applyMutations
|
|
19
|
+
|| typeof ctx.mutationView.getNewEntities !== 'function') {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const getTypeMut = typeof ctx.mutationView.getEntityTypeMutation === 'function'
|
|
23
|
+
? ctx.mutationView.getEntityTypeMutation.bind(ctx.mutationView)
|
|
24
|
+
: null;
|
|
25
|
+
for (const entity of ctx.mutationView.getNewEntities()) {
|
|
26
|
+
// A retyped overlay entity keeps its AUTHORED type on `entity.type`
|
|
27
|
+
// (the overlay typeMutation is the source of truth for the effective
|
|
28
|
+
// class). Resolve the effective class, then re-lay-out the authored
|
|
29
|
+
// attributes from the authored layout up to it.
|
|
30
|
+
const typeMut = getTypeMut ? getTypeMut(entity.expressId) : null;
|
|
31
|
+
const effectiveType = typeMut?.newType ?? entity.type;
|
|
32
|
+
// STEP requires UPPERCASE entity type tokens; the upper-case happens
|
|
33
|
+
// here at the file-format boundary.
|
|
34
|
+
const upperType = effectiveType.toUpperCase();
|
|
35
|
+
if (excludeGeometry && ctx.isGeometryEntity(upperType)) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (pass.allowedEntityIds !== null && !pass.allowedEntityIds.has(entity.expressId)) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
// Re-lay-out by name against the effective class (identity for
|
|
42
|
+
// compatible layouts). Runs whenever a retype intent exists — even a
|
|
43
|
+
// same-class retype, which carries a PredefinedType override
|
|
44
|
+
// (e.g. setEntityType(id, 'IfcColumn', 'PILASTER')).
|
|
45
|
+
let argsText;
|
|
46
|
+
if (typeMut) {
|
|
47
|
+
// Serialize against the AUTHORED layout (`entity.type`); retypeArgTokens
|
|
48
|
+
// then re-lays the tokens out by name up to the effective class.
|
|
49
|
+
const srcTokens = entity.attributes.map((value, i) => serializeAttributeSlot(entity.type, i, value, pass.sourceSchema));
|
|
50
|
+
const { tokens } = retypeArgTokens(srcTokens, entity.type, effectiveType, typeMut.predefinedType ?? null, pass.sourceSchema);
|
|
51
|
+
argsText = tokens.join(',');
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
argsText = serializeEntityArgs(entity.type, entity.attributes, pass.sourceSchema);
|
|
55
|
+
}
|
|
56
|
+
// Edits made AFTER the create live in the overlay, never in the
|
|
57
|
+
// authored payload (#2006). The source-iteration pass applies them to
|
|
58
|
+
// source records via applyAttributeMutations / applyPositionalMutations;
|
|
59
|
+
// an overlay-created entity has no source record, so without this it was
|
|
60
|
+
// written from its creation payload alone and every later
|
|
61
|
+
// `setAttribute` / `setPositionalAttribute` was silently dropped on
|
|
62
|
+
// save — data loss with no error and no warning.
|
|
63
|
+
//
|
|
64
|
+
// Order mirrors the source pass: retype (above) -> named attributes ->
|
|
65
|
+
// positional overrides, all resolved against the EFFECTIVE class.
|
|
66
|
+
const attributeOverrides = pass.modifiedAttributes.get(entity.expressId) ?? null;
|
|
67
|
+
const queuedPositional = typeof ctx.mutationView.getPositionalMutationsForEntity === 'function'
|
|
68
|
+
? ctx.mutationView.getPositionalMutationsForEntity(entity.expressId)
|
|
69
|
+
: null;
|
|
70
|
+
// A created TYPE object owns its psets through HasPropertySets, and the
|
|
71
|
+
// ids of the psets this export generated are only known now — so they
|
|
72
|
+
// arrive as one more slot override rather than through the overlay.
|
|
73
|
+
// `has`, not `??`, for the same reason `overlaySlotValue` gives: the
|
|
74
|
+
// stored value is deliberately null when the resolved list is empty.
|
|
75
|
+
const positionalOverrides = pass.overlayTypeOwnedPsets.has(entity.expressId)
|
|
76
|
+
? new Map(queuedPositional).set(HAS_PROPERTY_SETS_SLOT, pass.overlayTypeOwnedPsets.get(entity.expressId) ?? null)
|
|
77
|
+
: queuedPositional;
|
|
78
|
+
if ((attributeOverrides && attributeOverrides.size > 0)
|
|
79
|
+
|| (positionalOverrides && positionalOverrides.size > 0)) {
|
|
80
|
+
argsText = ctx.applyOverlayEntityOverrides(argsText, upperType, attributeOverrides, positionalOverrides, pass.sourceSchema,
|
|
81
|
+
// Overlay-created entities report a rejected REAL edit exactly as
|
|
82
|
+
// source-backed ones do. Without this the slot was kept and NOTHING
|
|
83
|
+
// was said - the silent discard this whole change exists to
|
|
84
|
+
// prevent, surviving in the one path that had no test.
|
|
85
|
+
(attr, value) => pass.warnings.push(`entity #${entity.expressId}: attribute ${attr} not written - ` +
|
|
86
|
+
`${JSON.stringify(value)} is not a number and the slot is REAL-typed`));
|
|
87
|
+
}
|
|
88
|
+
let line = `#${entity.expressId}=${upperType}(${argsText});`;
|
|
89
|
+
// Same gap as the source-iteration pass, for an overlay-authored
|
|
90
|
+
// relationship instead of a parsed one (#2398).
|
|
91
|
+
//
|
|
92
|
+
// `mayNameOmittedRefs` is provably TRUE wherever this line executes:
|
|
93
|
+
// the block enclosing this pass requires `ctx.mutationView` and
|
|
94
|
+
// `applyMutations`, which is `pass.overlayActive`, which is one of the
|
|
95
|
+
// gate's own disjuncts. Spelled out anyway so both filter sites read the
|
|
96
|
+
// same — the previous gate's failure was one site's condition drifting
|
|
97
|
+
// from what the filter needed, and a pass reachable without an overlay
|
|
98
|
+
// would otherwise silently need the gate re-derived here.
|
|
99
|
+
if (mayNameOmittedRefs && upperType.startsWith('IFCREL')) {
|
|
100
|
+
line = filterHiddenRefsFromRelationshipLine(line, isOmittedFromOutput);
|
|
101
|
+
if (line === null) {
|
|
102
|
+
pass.warnings.push(ctx.relationshipWithheldWarning(entity.expressId, upperType));
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (pass.converting) {
|
|
107
|
+
const converted = convertStepLine(line, pass.sourceSchema, pass.schema, options.guidRandom);
|
|
108
|
+
if (converted !== null) {
|
|
109
|
+
pass.entities.push(converted);
|
|
110
|
+
pass.newEntityCount++;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
pass.entities.push(line);
|
|
115
|
+
pass.newEntityCount++;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=step-overlay-entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-overlay-entities.js","sourceRoot":"","sources":["../src/step-overlay-entities.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAwC/D,OAAO,EAAE,oCAAoC,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AA4BxF;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CACzC,IAAgB,EAChB,OAA0B,EAC1B,eAAwB,EACxB,cAAuB,EACvB,kBAA2B,EAC3B,mBAA4C,EAC5C,GAA2B;IAE3B,IACE,CAAC,GAAG,CAAC,YAAY;WACd,C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E,OAAO,CAAC,UAAU,CAAC,CAAC;YAC5F,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;gBACvB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBAC9B,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the `ExportPass` one `export()` call threads through its phases.
|
|
3
|
+
*
|
|
4
|
+
* Split out of `step-exporter.ts` for #2475. The literal moved verbatim; the
|
|
5
|
+
* only edits are that the three things it used to read off the exporter
|
|
6
|
+
* (`dataStore`, `mutationView`, `isGeometryEntity`) now arrive as fields of
|
|
7
|
+
* {@link PassBuildInput}.
|
|
8
|
+
*
|
|
9
|
+
* ONE RULE GOVERNS THIS FILE, and it is easy to break by tidying. The
|
|
10
|
+
* predicates below are closures over `pass` ITSELF, and `pass.allowedEntityIds`
|
|
11
|
+
* / `pass.hiddenProductIds` are still `null` when this function returns --
|
|
12
|
+
* `collectModifications` assigns them afterwards, on this very object. So this
|
|
13
|
+
* must `return pass` and nothing else. A spread, a `structuredClone`, an
|
|
14
|
+
* `Object.freeze`, or a caller that stores a copy detaches every predicate from
|
|
15
|
+
* the object that later gets written, and each one silently answers from a
|
|
16
|
+
* snapshot that never fills in. That is #2637, and the failure mode is a
|
|
17
|
+
* `visibleOnly` export shipping a structurally wrong file rather than throwing.
|
|
18
|
+
*/
|
|
19
|
+
import type { IfcDataStore, IfcSourceHeader } from '@ifc-lite/parser';
|
|
20
|
+
import type { MutablePropertyView } from '@ifc-lite/mutations';
|
|
21
|
+
import type { IfcSchemaVersion } from './schema-converter.js';
|
|
22
|
+
import type { ExportPass, StepExportOptions } from './step-export-types.js';
|
|
23
|
+
/**
|
|
24
|
+
* Everything the pass literal reads that is not its own field.
|
|
25
|
+
*
|
|
26
|
+
* The first three are the exporter's, injected rather than reached for.
|
|
27
|
+
* `isGeometryEntity` is passed as a bound callback for the same reason it is a
|
|
28
|
+
* method there: it closes over the exporter's own type set.
|
|
29
|
+
*/
|
|
30
|
+
export interface PassBuildInput {
|
|
31
|
+
readonly dataStore: IfcDataStore;
|
|
32
|
+
readonly mutationView: MutablePropertyView | null;
|
|
33
|
+
readonly isGeometryEntity: (type: string) => boolean;
|
|
34
|
+
readonly options: StepExportOptions;
|
|
35
|
+
readonly schema: IfcSchemaVersion;
|
|
36
|
+
readonly sourceSchema: IfcSchemaVersion;
|
|
37
|
+
readonly converting: boolean;
|
|
38
|
+
readonly applyMutations: boolean;
|
|
39
|
+
readonly excludeGeometry: boolean;
|
|
40
|
+
readonly sourceHeader: IfcSourceHeader | undefined;
|
|
41
|
+
readonly schemaToken: string;
|
|
42
|
+
}
|
|
43
|
+
export declare function buildExportPass(input: PassBuildInput): ExportPass;
|
|
44
|
+
//# sourceMappingURL=step-pass-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-pass-builder.d.ts","sourceRoot":"","sources":["../src/step-pass-builder.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAqB,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAM5E;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACrD,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,eAAe,GAAG,SAAS,CAAC;IACnD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,UAAU,CA2QjE"}
|
|
@@ -0,0 +1,249 @@
|
|
|
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 { getEffectiveEntityIndex } from './effective-index.js';
|
|
5
|
+
import { createModificationLedger } from './delta-modification-ledger.js';
|
|
6
|
+
import { createSourceRefReader } from './source-ref-bounds.js';
|
|
7
|
+
import { buildStepHeader } from './step-header.js';
|
|
8
|
+
export function buildExportPass(input) {
|
|
9
|
+
const { dataStore, mutationView, isGeometryEntity, options, schema, sourceSchema, converting, applyMutations, excludeGeometry, sourceHeader, schemaToken, } = input;
|
|
10
|
+
const pass = {
|
|
11
|
+
entities: [],
|
|
12
|
+
newEntityCount: 0,
|
|
13
|
+
schema,
|
|
14
|
+
sourceSchema,
|
|
15
|
+
converting,
|
|
16
|
+
sourceHeader,
|
|
17
|
+
schemaToken,
|
|
18
|
+
overlayActive: !!mutationView && applyMutations,
|
|
19
|
+
// Built once entity counts are known, so the provenance item can report the
|
|
20
|
+
// actual modification count. See the two call sites (empty delta + final).
|
|
21
|
+
// Body lives in `step-header.ts` (#2475 header/assembly tail): the
|
|
22
|
+
// closure still has to be built here, because it closes over this
|
|
23
|
+
// call's own `options`/`sourceHeader`/`schemaToken`, and both call
|
|
24
|
+
// sites still read it as `pass.buildHeader`.
|
|
25
|
+
buildHeader: (modifications) => buildStepHeader(options, sourceHeader, schemaToken, modifications),
|
|
26
|
+
// The one authority for exists / class / deleted, overlay first and source
|
|
27
|
+
// buffer second. Every pass below asks this instead of `dataStore`,
|
|
28
|
+
// which answers only for the file as parsed (#2012).
|
|
29
|
+
effective: getEffectiveEntityIndex(dataStore, mutationView, applyMutations),
|
|
30
|
+
// Does this id belong to an entity the OVERLAY created (`createEntity` /
|
|
31
|
+
// `store.addEntity`) rather than to a record in the source buffer? Such an
|
|
32
|
+
// entity has no source bytes, so the source-iteration pass below never sees
|
|
33
|
+
// it and the new-entities pass at the end owns its line entirely (#2006).
|
|
34
|
+
isOverlayCreated: (entityId) => pass.effective.isOverlayCreated(entityId),
|
|
35
|
+
// Does this record describe a line this export can actually READ out of the
|
|
36
|
+
// source? One predicate for every byte-range gate below, so they cannot
|
|
37
|
+
// disagree — see `source-ref-bounds.ts` for the corrupt file the weaker
|
|
38
|
+
// "is there a source / does the ref claim bytes" pair let through (#2491).
|
|
39
|
+
isReadableSourceRef: createSourceRefReader(dataStore.source),
|
|
40
|
+
// Build visible-only closure if requested. Classification, the closure walk
|
|
41
|
+
// and the style pass all run over the EFFECTIVE index: an overlay-created
|
|
42
|
+
// product becomes a root by the same type rules as a parsed one, the walk
|
|
43
|
+
// follows its authored references into the geometry it alone owns, and a
|
|
44
|
+
// tombstoned entity is simply not there. Run over the source buffer, a
|
|
45
|
+
// created wall could never be a root and nothing referenced it, so
|
|
46
|
+
// `visibleOnly` wrote a file without it and said nothing (#2012).
|
|
47
|
+
//
|
|
48
|
+
// Computed here, ahead of the modification-count passes below, because
|
|
49
|
+
// `hasEmittableHostBytes` needs it: a source-backed host EXCLUDED by
|
|
50
|
+
// `visibleOnly` never gets its line written by the source-iteration pass
|
|
51
|
+
// either, so counting it as "modified" would make the header claim a
|
|
52
|
+
// change the DATA section does not contain (CodeRabbit finding on #2414).
|
|
53
|
+
allowedEntityIds: null,
|
|
54
|
+
// Populated alongside `allowedEntityIds` below. `getVisibleEntityIds`
|
|
55
|
+
// excludes a hidden PRODUCT's own line from the closure, but `IFCREL*` is
|
|
56
|
+
// an unconditional root a few lines down and its bytes are copied verbatim
|
|
57
|
+
// by the source-iteration pass — nothing there filters a `#N` the closure
|
|
58
|
+
// just excluded out of the relationship's own attribute list. Kept because
|
|
59
|
+
// the closure walk's `isRefExcludedDuringClosureWalk` needs a notion of
|
|
60
|
+
// "hidden" that does not read `allowedEntityIds` — the set that walk is
|
|
61
|
+
// producing (#2398). The two OUTPUT passes no longer read this directly:
|
|
62
|
+
// they filter on `isOmittedFromOutput`, which subsumes it via
|
|
63
|
+
// `allowedEntityIds`.
|
|
64
|
+
hiddenProductIds: null,
|
|
65
|
+
// A relationship can name an excluded entity two ways that have nothing
|
|
66
|
+
// to do with each other: a `visibleOnly` hidden PRODUCT (`hiddenProductIds`,
|
|
67
|
+
// below), and a TOMBSTONED one — `editor.removeEntity` on a related object
|
|
68
|
+
// named by a relationship the deletion sweep below does not reach (that
|
|
69
|
+
// sweep only withholds an `IfcRelDefinesByProperties` when EVERY related
|
|
70
|
+
// object is gone, and only for that one relationship class). Left alone, a
|
|
71
|
+
// relationship still naming a deleted entity ships the identical `#N` with
|
|
72
|
+
// no `#N=` line, on a path with no `visibleOnly` involved at all (#2398).
|
|
73
|
+
// `effective.isDeleted` answers for every id, not just a precomputed set,
|
|
74
|
+
// so this predicate covers both sources without a second exclusion set.
|
|
75
|
+
//
|
|
76
|
+
// Declared here, ahead of the closure walk below, and passed into
|
|
77
|
+
// `collectReferencedEntityIds` as its `isRefExcluded` — rather than the
|
|
78
|
+
// walk inventing its own `!entityIndex.has` proxy for "deleted" that could
|
|
79
|
+
// disagree on an id that never existed in the file at all
|
|
80
|
+
// (maintainer-found regression on #2637: such an id blocked the bridge but
|
|
81
|
+
// did not stop the relationship's own line from shipping, dropping a
|
|
82
|
+
// VISIBLE sibling's pset while adding a fresh dangling ref). A closure over
|
|
83
|
+
// `pass.hiddenProductIds`, not a value snapshot — correct because nothing
|
|
84
|
+
// reads it before the closure walk assigns it just below.
|
|
85
|
+
//
|
|
86
|
+
// ## Why this is NOT the predicate the OUTPUT-line filter uses
|
|
87
|
+
//
|
|
88
|
+
// The name says walk, and only walk. The two passes that write a
|
|
89
|
+
// relationship's line ask `isOmittedFromOutput` (further below, derived
|
|
90
|
+
// from `pass.willBeEmitted`), which is strictly stronger — it also answers
|
|
91
|
+
// for the closure, for an unreadable source ref and for a geometry
|
|
92
|
+
// exclusion.
|
|
93
|
+
//
|
|
94
|
+
// This one CANNOT be `willBeEmitted`, and the difference is structural
|
|
95
|
+
// rather than stylistic: `willBeEmitted`'s first act is to consult
|
|
96
|
+
// `allowedEntityIds`, and `allowedEntityIds` is precisely what the call
|
|
97
|
+
// below is computing. Wiring it in here is circular: it would answer "not
|
|
98
|
+
// in the closure" as `false` while the closure is still being built and
|
|
99
|
+
// `true` for the same id afterwards.
|
|
100
|
+
//
|
|
101
|
+
// That is a genuine departure from the contract #2637 was closed on —
|
|
102
|
+
// `reference-collector.ts` still documents the bridge as taking the
|
|
103
|
+
// caller's OWN output predicate, "not two expressions that happened to
|
|
104
|
+
// agree". It has an OBSERVABLE consequence, not just a naming one: for an
|
|
105
|
+
// unreadable source ref this admits, the walk bridges through a
|
|
106
|
+
// relationship the output then withholds, leaving the relationship's other
|
|
107
|
+
// target in the closure with nothing naming it — an orphan, pinned by
|
|
108
|
+
// `unreadable-ref-dangling.test.ts` ("walk and output predicates diverge").
|
|
109
|
+
// The reverse direction is closed: every id this excludes,
|
|
110
|
+
// `isOmittedFromOutput` excludes too, so the #2548 leak cannot return.
|
|
111
|
+
isRefExcludedDuringClosureWalk: (id) => (pass.hiddenProductIds !== null && pass.hiddenProductIds.has(id))
|
|
112
|
+
|| pass.effective.isDeleted(id),
|
|
113
|
+
// Will THIS entity's own line ever land in the file? The same byte-range
|
|
114
|
+
// test `willBeEmitted` uses (defined further below) and the source-
|
|
115
|
+
// iteration pass's own skip at `entityRef.byteLength === 0` — a source
|
|
116
|
+
// entity with no bytes (a point-cloud / GLB "entity" from
|
|
117
|
+
// `createSyntheticDataStore`, not an overlay-created one) never gets a
|
|
118
|
+
// defining line written, source-iteration or otherwise, so a pset/attribute
|
|
119
|
+
// edit against it must not count as a modification either: the header
|
|
120
|
+
// would describe a change the file does not contain (out-of-scope finding
|
|
121
|
+
// in #2398). Also excludes a source-backed host the visible-only closure
|
|
122
|
+
// above drops — same reasoning, different reason the line never lands.
|
|
123
|
+
//
|
|
124
|
+
// And, like `willBeEmitted` below, excludes a geometry-classified SOURCE
|
|
125
|
+
// host under `includeGeometry: false`: the source-iteration pass's own
|
|
126
|
+
// `isGeometryEntity` skip (further below) drops that line too, so this
|
|
127
|
+
// predicate must agree or a geometry entity's attribute edit inflates the
|
|
128
|
+
// count over an omitted line (CodeRabbit finding on #2414). Guarded by
|
|
129
|
+
// `!deltaOnly` for the same reason `willBeEmitted` is: under `deltaOnly`
|
|
130
|
+
// the source-iteration pass — and its geometry skip — never runs at all,
|
|
131
|
+
// so a source entity's line is assumed to already exist in the file being
|
|
132
|
+
// patched, geometry or not.
|
|
133
|
+
isGeometryExcluded: (entityId, recordType) => excludeGeometry
|
|
134
|
+
&& isGeometryEntity(pass.effective.effectiveType(entityId, recordType)),
|
|
135
|
+
hasEmittableHostBytes: (entityId) => {
|
|
136
|
+
if (pass.allowedEntityIds !== null && !pass.allowedEntityIds.has(entityId))
|
|
137
|
+
return false;
|
|
138
|
+
const ref = pass.effective.get(entityId);
|
|
139
|
+
// The ref must be READABLE, not merely non-empty: a range this source
|
|
140
|
+
// cannot address decodes to the empty string, which used to be pushed
|
|
141
|
+
// into the file as a blank line while everything generated FOR the host
|
|
142
|
+
// still named it (#2491).
|
|
143
|
+
if (!ref || !pass.isReadableSourceRef(ref))
|
|
144
|
+
return false;
|
|
145
|
+
if (options.deltaOnly !== true && pass.isGeometryExcluded(entityId, ref.type))
|
|
146
|
+
return false;
|
|
147
|
+
return true;
|
|
148
|
+
},
|
|
149
|
+
/**
|
|
150
|
+
* Will this id have a defining STEP line in the output at all?
|
|
151
|
+
*
|
|
152
|
+
* The predicate is #2030's, and it is the right one: the pset, quantity and
|
|
153
|
+
* type-owned passes below are built from unfiltered mutation history, and
|
|
154
|
+
* what each of them needs to know before emitting an
|
|
155
|
+
* `IFCRELDEFINESBYPROPERTIES` is not "was this deleted" or "is this hidden"
|
|
156
|
+
* but the general question those are two answers to. A relation naming an
|
|
157
|
+
* expressId that never gets written is a dangling reference and an invalid
|
|
158
|
+
* file, whichever route dropped the line.
|
|
159
|
+
*
|
|
160
|
+
* #2030 had to reach for four things to answer it — a tombstone probe, a
|
|
161
|
+
* visibility set, a byte-range test on `completeIndex`, and a `getNewEntity`
|
|
162
|
+
* fallback whose stated purpose was that `deleteEntity` FORGOT an
|
|
163
|
+
* overlay-created entity instead of tombstoning it, so `isDeleted` could not
|
|
164
|
+
* answer for one. That fallback was documented on main as a workaround for
|
|
165
|
+
* exactly the model-level defect this branch fixes: `deleteEntity` now
|
|
166
|
+
* tombstones as well as forgets, so the effective index answers existence
|
|
167
|
+
* for source and overlay ids alike and the workaround collapses into it.
|
|
168
|
+
*
|
|
169
|
+
* The overlay branch does NOT disappear with it, and the distinction matters:
|
|
170
|
+
* `isOverlayCreated` is still load-bearing here, because a live
|
|
171
|
+
* overlay-created entity has no source bytes and would fail the byte-range
|
|
172
|
+
* test that a source record passes. What the tombstone fix removed is the
|
|
173
|
+
* need for that branch to double as a deletion detector.
|
|
174
|
+
*
|
|
175
|
+
* Deliberately unchanged from #2030 for source records under `deltaOnly` /
|
|
176
|
+
* `exportPropertiesOnly`: the source-iteration pass is skipped wholesale in
|
|
177
|
+
* those modes, yet a source entity still answers true here. A delta is a
|
|
178
|
+
* patch against a file that already has the line, not a standalone model.
|
|
179
|
+
*/
|
|
180
|
+
willBeEmitted: (entityId) => {
|
|
181
|
+
if (pass.allowedEntityIds !== null && !pass.allowedEntityIds.has(entityId))
|
|
182
|
+
return false;
|
|
183
|
+
// Undefined for a tombstoned id and for one neither the file nor the
|
|
184
|
+
// session ever had — a stale mutation must not conjure a relation either.
|
|
185
|
+
const ref = pass.effective.get(entityId);
|
|
186
|
+
if (!ref)
|
|
187
|
+
return false;
|
|
188
|
+
// An overlay-created record carries the placeholder byte range and is
|
|
189
|
+
// written by the new-entities pass; a source record needs real bytes.
|
|
190
|
+
if (pass.effective.isOverlayCreated(entityId)) {
|
|
191
|
+
// The overlay new-entities pass applies its OWN `isGeometryEntity`
|
|
192
|
+
// filter unconditionally — deltaOnly or not (see the comment at that
|
|
193
|
+
// loop, further below) — so this branch mirrors it without the
|
|
194
|
+
// deltaOnly carve-out the source branch gets.
|
|
195
|
+
return !pass.isGeometryExcluded(entityId, ref.type);
|
|
196
|
+
}
|
|
197
|
+
// Same readability test as `hasEmittableHostBytes`, and for the reason
|
|
198
|
+
// that predicate names: a ref this source cannot address is not a line
|
|
199
|
+
// this export can write, so nothing may be generated naming it (#2491).
|
|
200
|
+
if (!pass.isReadableSourceRef(ref))
|
|
201
|
+
return false;
|
|
202
|
+
// Mirrors `hasEmittableHostBytes`: under `deltaOnly` the source-
|
|
203
|
+
// iteration pass — and its geometry skip — never runs, so a source
|
|
204
|
+
// entity's line is assumed to already exist in the file being patched.
|
|
205
|
+
if (options.deltaOnly === true)
|
|
206
|
+
return true;
|
|
207
|
+
return !pass.isGeometryExcluded(entityId, ref.type);
|
|
208
|
+
},
|
|
209
|
+
// Under `deltaOnly` a nomination only becomes a count once some pass has
|
|
210
|
+
// actually written content that delivers THAT KIND of edit for the host —
|
|
211
|
+
// see `delta-modification-ledger.ts` for why the two are not the same event
|
|
212
|
+
// in that mode, and why the pair is (entity, kind) rather than the entity
|
|
213
|
+
// (#2462).
|
|
214
|
+
modifications: createModificationLedger(options.deltaOnly === true),
|
|
215
|
+
/**
|
|
216
|
+
* Hosts whose in-place named-attribute edits a FULL export may count, per
|
|
217
|
+
* kind. Filled by the collection passes below and read by the two passes
|
|
218
|
+
* that write a rewritten source line — see `in-place-nomination.ts` for why
|
|
219
|
+
* the nomination waits for the rewrite in this mode and not under
|
|
220
|
+
* `deltaOnly` (#2483).
|
|
221
|
+
*/
|
|
222
|
+
inPlaceNominees: {
|
|
223
|
+
attribute: new Set(),
|
|
224
|
+
georeferencing: new Set(),
|
|
225
|
+
},
|
|
226
|
+
// Collect entities that need to be modified or created
|
|
227
|
+
modifiedEntities: new Set(),
|
|
228
|
+
modifiedAttributes: new Map(),
|
|
229
|
+
newPropertySets: [],
|
|
230
|
+
newQuantitySets: [],
|
|
231
|
+
typeOwnedPsetNamesByEntity: new Map(),
|
|
232
|
+
typeOwnedPsetIdsByEntity: new Map(),
|
|
233
|
+
rewrittenEntityIds: new Set(),
|
|
234
|
+
rewrittenEntityLines: new Map(),
|
|
235
|
+
/** HasPropertySets slot value for an OVERLAY-CREATED type object, applied
|
|
236
|
+
* by the new-entities pass (there is no source line to rewrite). */
|
|
237
|
+
overlayTypeOwnedPsets: new Map(),
|
|
238
|
+
// Track property set IDs and relationship IDs to skip
|
|
239
|
+
skipPropertySetIds: new Set(),
|
|
240
|
+
skipRelationshipIds: new Set(),
|
|
241
|
+
// Written by the georeferencing pass and read again by the final
|
|
242
|
+
// assembly, which is why they are pass state and not phase locals.
|
|
243
|
+
newGeorefLines: [],
|
|
244
|
+
warnings: [],
|
|
245
|
+
};
|
|
246
|
+
// The same object, deliberately. See the file header.
|
|
247
|
+
return pass;
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=step-pass-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-pass-builder.js","sourceRoot":"","sources":["../src/step-pass-builder.ts"],"names":[],"mappings":"AAAA;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AAG,EAAuB;QAC1D,wBAAwB,EAAE,IAAI,GAAG,EAAoB;QACrD,kBAAkB,EAAE,IAAI,GAAG,EAAU;QACrC,oBAAoB,EAAE,IAAI,GAAG,EAAkB;QAC/C;6EACqE;QACrE,qBAAqB,EAAE,IAAI,GAAG,EAA6B;QAE3D,sDAAsD;QACtD,kBAAkB,EAAE,IAAI,GAAG,EAAU;QACrC,mBAAmB,EAAE,IAAI,GAAG,EAAU;QAEtC,iEAAiE;QACjE,mEAAmE;QACnE,cAAc,EAAE,EAAE;QAClB,QAAQ,EAAE,EAAE;KACb,CAAC;IACF,sDAAsD;IACtD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -29,8 +29,10 @@
|
|
|
29
29
|
* exported for the mirror-image reason: the collection loops consume its
|
|
30
30
|
* `byEntity` half, but `export()` reads `relatedByRel` for the deleted-host
|
|
31
31
|
* relationship sweep, which is neither phase's work.
|
|
32
|
-
* `
|
|
33
|
-
*
|
|
32
|
+
* `step-attribute-mutations.ts`'s `applySourceLineMutations` (moved off
|
|
33
|
+
* `StepExporter` by #2475's "remaining private helpers" step) is shared with
|
|
34
|
+
* the source-iteration pass, so it is injected on the context rather than
|
|
35
|
+
* imported directly.
|
|
34
36
|
*
|
|
35
37
|
* ## The state these phases cannot read off the pass
|
|
36
38
|
*
|
|
@@ -83,9 +85,9 @@ export interface PropertySetContext {
|
|
|
83
85
|
/** `() => this.nextExpressId++` on the exporter. */
|
|
84
86
|
readonly allocateExpressId: () => number;
|
|
85
87
|
readonly ownerHistory: OwnerHistoryCache;
|
|
86
|
-
/** `
|
|
87
|
-
* source-iteration pass and the type-object rewrite share, so
|
|
88
|
-
* neither phase and is injected
|
|
88
|
+
/** `step-attribute-mutations.ts`'s `applySourceLineMutations`: the ONE
|
|
89
|
+
* pipeline the source-iteration pass and the type-object rewrite share, so
|
|
90
|
+
* it belongs to neither phase and is injected. */
|
|
89
91
|
readonly applySourceLineMutations: (expressId: number, entityText: string, recordType: string, attributeMutations: Map<string, string> | undefined, sourceSchema: IfcSchemaVersion, overlayActive: boolean, onRejected?: (attrName: string, value: string) => void) => SourceLineMutations;
|
|
90
92
|
}
|
|
91
93
|
/** The mutation groupings `export()` builds before the collection phase runs. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-property-sets.d.ts","sourceRoot":"","sources":["../src/step-property-sets.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"step-property-sets.d.ts","sourceRoot":"","sources":["../src/step-property-sets.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAkD,MAAM,kBAAkB,CAAC;AACnG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAK/D,OAAO,EAAE,qBAAqB,EAAe,MAAM,wBAAwB,CAAC;AAY5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAqB7F;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC;kEAC8D;IAC9D,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;CAC/C;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,YAAY,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,mBAAmB,EAAE,UA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