@ifc-lite/export 2.8.3 → 2.8.5
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/declared-property-type.d.ts +107 -0
- package/dist/declared-property-type.d.ts.map +1 -0
- package/dist/declared-property-type.js +236 -0
- package/dist/declared-property-type.js.map +1 -0
- package/dist/delta-modification-ledger.d.ts +148 -0
- package/dist/delta-modification-ledger.d.ts.map +1 -0
- package/dist/delta-modification-ledger.js +194 -0
- package/dist/delta-modification-ledger.js.map +1 -0
- package/dist/demesh-session.d.ts.map +1 -1
- package/dist/demesh-session.js +7 -0
- package/dist/demesh-session.js.map +1 -1
- package/dist/in-place-nomination.d.ts +65 -0
- package/dist/in-place-nomination.d.ts.map +1 -0
- package/dist/in-place-nomination.js +27 -0
- package/dist/in-place-nomination.js.map +1 -0
- package/dist/merged-exporter.js +1 -1
- package/dist/retype.d.ts.map +1 -1
- package/dist/retype.js +2 -1
- package/dist/retype.js.map +1 -1
- package/dist/select-qualification.d.ts +12 -0
- package/dist/select-qualification.d.ts.map +1 -1
- package/dist/select-qualification.js +12 -1
- package/dist/select-qualification.js.map +1 -1
- package/dist/source-ref-bounds.d.ts +53 -0
- package/dist/source-ref-bounds.d.ts.map +1 -0
- package/dist/source-ref-bounds.js +25 -0
- package/dist/source-ref-bounds.js.map +1 -0
- package/dist/step-argument-parser.d.ts +90 -0
- package/dist/step-argument-parser.d.ts.map +1 -0
- package/dist/step-argument-parser.js +207 -0
- package/dist/step-argument-parser.js.map +1 -0
- package/dist/step-exporter.d.ts +45 -4
- package/dist/step-exporter.d.ts.map +1 -1
- package/dist/step-exporter.js +465 -84
- package/dist/step-exporter.js.map +1 -1
- package/dist/step-file-assembly.d.ts +35 -0
- package/dist/step-file-assembly.d.ts.map +1 -0
- package/dist/step-file-assembly.js +102 -0
- package/dist/step-file-assembly.js.map +1 -0
- package/dist/step-serialization.d.ts +48 -48
- package/dist/step-serialization.d.ts.map +1 -1
- package/dist/step-serialization.js +90 -182
- package/dist/step-serialization.js.map +1 -1
- package/dist/type-owned-psets.d.ts +36 -0
- package/dist/type-owned-psets.d.ts.map +1 -1
- package/dist/type-owned-psets.js +41 -0
- package/dist/type-owned-psets.js.map +1 -1
- package/dist/unit-normalize.d.ts.map +1 -1
- package/dist/unit-normalize.js +13 -1
- package/dist/unit-normalize.js.map +1 -1
- package/package.json +7 -6
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The STEP argument parser and rewriter: reading a record's top-level argument
|
|
3
|
+
* list out of its text, and writing one slot back.
|
|
4
|
+
*
|
|
5
|
+
* This is the one text layer that goes the other way from the rest of the
|
|
6
|
+
* export path — everything in `step-serialization.ts` turns a value INTO a
|
|
7
|
+
* token, while these three read tokens back OUT of a line someone else wrote
|
|
8
|
+
* (or that an earlier pass rewrote) and hand them to a caller that edits by
|
|
9
|
+
* slot index. Nothing here depends on exporter state; the input is a string and
|
|
10
|
+
* the output is parts or a rewritten string.
|
|
11
|
+
*
|
|
12
|
+
* They live together because they share one set of rules — quote state,
|
|
13
|
+
* doubled-quote escapes, paren depth, what counts as a slot — and those rules
|
|
14
|
+
* are what a caller has to be able to find when a line comes out wrong. The
|
|
15
|
+
* failure they exist to prevent is silent: a mis-scanned list still produces
|
|
16
|
+
* parts, and writing a slot by index into those parts lands on the wrong
|
|
17
|
+
* argument while reporting success (LTplus-AG/ifc-lite#2470).
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Split a STEP argument list on top-level commas, respecting nested
|
|
21
|
+
* parentheses and quoted strings. Used by `applyAttributeMutations`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function splitTopLevelArgs(text: string): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Replace ONE top-level argument of a STEP record, by zero-based slot, leaving
|
|
26
|
+
* every other token — and the record's class keyword and id — byte-identical.
|
|
27
|
+
*
|
|
28
|
+
* Takes the LINE, not an expressId: the caller may hold a line that is no
|
|
29
|
+
* longer what the source buffer says. The type-object `HasPropertySets`
|
|
30
|
+
* rewrite is exactly that case — it hands in a line the retype / attribute /
|
|
31
|
+
* positional pipeline has already rewritten, and re-reading the buffer here
|
|
32
|
+
* would throw all of that away (which is how that path used to drop every
|
|
33
|
+
* edit but the pset repoint).
|
|
34
|
+
*
|
|
35
|
+
* Returns null when the text is not a parseable single STEP record or the slot
|
|
36
|
+
* is past the end of the argument list; a null must not be treated as "no
|
|
37
|
+
* change", since the intended replacement did not happen.
|
|
38
|
+
*
|
|
39
|
+
* The regex only pins the two ENDS of the record — `#N=CLASS(` and `);`. Text
|
|
40
|
+
* malformed BETWEEN them is caught by {@link splitTopLevelStepArguments}, which
|
|
41
|
+
* rejects an argument list it could not scan cleanly rather than handing back
|
|
42
|
+
* whatever it accumulated: those parts are not the record's slots, so writing
|
|
43
|
+
* one lands on the wrong argument and reports a success that did not happen
|
|
44
|
+
* (#2470). Silently corrupted output instead of a dropped entity, same class.
|
|
45
|
+
*/
|
|
46
|
+
export declare function replaceStepArgument(entityText: string, attrIndex: number, replacement: string): string | null;
|
|
47
|
+
/**
|
|
48
|
+
* Split a STEP argument list on top-level commas while preserving nested syntax,
|
|
49
|
+
* or null when the text is not a well-formed argument list.
|
|
50
|
+
*
|
|
51
|
+
* Similar to `splitTopLevelArgs` but uses a slightly different accumulation style
|
|
52
|
+
* suited for the {@link replaceStepArgument} call-site.
|
|
53
|
+
*
|
|
54
|
+
* ## Why it validates
|
|
55
|
+
*
|
|
56
|
+
* The scan already tracks quote state and paren depth to know where a top-level
|
|
57
|
+
* comma is. It used to ignore the final state, so text that never left a string
|
|
58
|
+
* or never closed a list still produced parts — parts whose boundaries are
|
|
59
|
+
* wherever the scanner happened to be, not the record's slots. Both callers then
|
|
60
|
+
* acted on them: `replaceStepArgument` wrote a slot by index and reported
|
|
61
|
+
* success, and the unit rescale multiplied numbers in whatever argument the
|
|
62
|
+
* mis-split had put them in. Neither could tell, because a broken split looks
|
|
63
|
+
* exactly like a good one.
|
|
64
|
+
*
|
|
65
|
+
* Rejected, because after either of these the parts are no longer the record's
|
|
66
|
+
* arguments — commas were swallowed and everything past them shifted:
|
|
67
|
+
* - a quote left open at the end (unterminated string);
|
|
68
|
+
* - a paren depth that does not return to zero, or that ever goes below it
|
|
69
|
+
* (unbalanced or stray-closing nested list). Both ends matter: a depth that
|
|
70
|
+
* dips negative and climbs back looks balanced at the end while every comma
|
|
71
|
+
* in between was read as nested.
|
|
72
|
+
*
|
|
73
|
+
* An EMPTY top-level slot (`a,,b`, or a trailing comma) is deliberately NOT
|
|
74
|
+
* rejected, though it is invalid STEP. It costs no alignment: an empty argument
|
|
75
|
+
* is ONE part, exactly as the entity parser counts it, so every index still
|
|
76
|
+
* names the attribute it is meant to and the replacement lands where it should.
|
|
77
|
+
* Rejecting it made things strictly worse, and measurably: the parser resolves
|
|
78
|
+
* `HasPropertySets` on such a line, so a session deleting that type object's
|
|
79
|
+
* property set has already had the pset's lines WITHHELD by the time the repoint
|
|
80
|
+
* runs — refuse the repoint and the record keeps a `#id` pointing at a property
|
|
81
|
+
* set the export just dropped. A dangling reference is worse than a
|
|
82
|
+
* still-invalid-but-unchanged empty slot.
|
|
83
|
+
*
|
|
84
|
+
* An empty INPUT is not an empty slot: `#1=IFCFOO();` is a record with no
|
|
85
|
+
* arguments, so it splits to `[]` and any slot request then fails the bounds
|
|
86
|
+
* check in {@link replaceStepArgument} — which is the right answer for a record
|
|
87
|
+
* that has no slots.
|
|
88
|
+
*/
|
|
89
|
+
export declare function splitTopLevelStepArguments(input: string): string[] | null;
|
|
90
|
+
//# sourceMappingURL=step-argument-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-argument-parser.d.ts","sourceRoot":"","sources":["../src/step-argument-parser.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAsDxD;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,MAAM,GAAG,IAAI,CAyBf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CA0CzE"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* The STEP argument parser and rewriter: reading a record's top-level argument
|
|
6
|
+
* list out of its text, and writing one slot back.
|
|
7
|
+
*
|
|
8
|
+
* This is the one text layer that goes the other way from the rest of the
|
|
9
|
+
* export path — everything in `step-serialization.ts` turns a value INTO a
|
|
10
|
+
* token, while these three read tokens back OUT of a line someone else wrote
|
|
11
|
+
* (or that an earlier pass rewrote) and hand them to a caller that edits by
|
|
12
|
+
* slot index. Nothing here depends on exporter state; the input is a string and
|
|
13
|
+
* the output is parts or a rewritten string.
|
|
14
|
+
*
|
|
15
|
+
* They live together because they share one set of rules — quote state,
|
|
16
|
+
* doubled-quote escapes, paren depth, what counts as a slot — and those rules
|
|
17
|
+
* are what a caller has to be able to find when a line comes out wrong. The
|
|
18
|
+
* failure they exist to prevent is silent: a mis-scanned list still produces
|
|
19
|
+
* parts, and writing a slot by index into those parts lands on the wrong
|
|
20
|
+
* argument while reporting success (LTplus-AG/ifc-lite#2470).
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Split a STEP argument list on top-level commas, respecting nested
|
|
24
|
+
* parentheses and quoted strings. Used by `applyAttributeMutations`.
|
|
25
|
+
*/
|
|
26
|
+
export function splitTopLevelArgs(text) {
|
|
27
|
+
const parts = [];
|
|
28
|
+
let current = '';
|
|
29
|
+
let depth = 0;
|
|
30
|
+
let inString = false;
|
|
31
|
+
for (let i = 0; i < text.length; i++) {
|
|
32
|
+
const char = text[i];
|
|
33
|
+
current += char;
|
|
34
|
+
if (inString) {
|
|
35
|
+
if (char === '\'') {
|
|
36
|
+
if (text[i + 1] === '\'') {
|
|
37
|
+
current += text[i + 1];
|
|
38
|
+
i++;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
inString = false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (char === '\'') {
|
|
47
|
+
inString = true;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (char === '(') {
|
|
51
|
+
depth++;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (char === ')') {
|
|
55
|
+
depth--;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (char === ',' && depth === 0) {
|
|
59
|
+
parts.push(current.slice(0, -1).trim());
|
|
60
|
+
current = '';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Trailing tokens: only push if there's actual content. The previous
|
|
64
|
+
// `text.endsWith(',')` check pushed an empty trailing token for inputs
|
|
65
|
+
// like `"a,"`, producing `['a', '']` — STEP doesn't allow trailing
|
|
66
|
+
// commas, so the right answer is just `['a']`. Empty interior args
|
|
67
|
+
// (e.g. `"a,,b"` → `['a', '', 'b']`) are still produced because the
|
|
68
|
+
// comma branch above handles them.
|
|
69
|
+
if (current.trim()) {
|
|
70
|
+
parts.push(current.trim());
|
|
71
|
+
}
|
|
72
|
+
return parts;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Replace ONE top-level argument of a STEP record, by zero-based slot, leaving
|
|
76
|
+
* every other token — and the record's class keyword and id — byte-identical.
|
|
77
|
+
*
|
|
78
|
+
* Takes the LINE, not an expressId: the caller may hold a line that is no
|
|
79
|
+
* longer what the source buffer says. The type-object `HasPropertySets`
|
|
80
|
+
* rewrite is exactly that case — it hands in a line the retype / attribute /
|
|
81
|
+
* positional pipeline has already rewritten, and re-reading the buffer here
|
|
82
|
+
* would throw all of that away (which is how that path used to drop every
|
|
83
|
+
* edit but the pset repoint).
|
|
84
|
+
*
|
|
85
|
+
* Returns null when the text is not a parseable single STEP record or the slot
|
|
86
|
+
* is past the end of the argument list; a null must not be treated as "no
|
|
87
|
+
* change", since the intended replacement did not happen.
|
|
88
|
+
*
|
|
89
|
+
* The regex only pins the two ENDS of the record — `#N=CLASS(` and `);`. Text
|
|
90
|
+
* malformed BETWEEN them is caught by {@link splitTopLevelStepArguments}, which
|
|
91
|
+
* rejects an argument list it could not scan cleanly rather than handing back
|
|
92
|
+
* whatever it accumulated: those parts are not the record's slots, so writing
|
|
93
|
+
* one lands on the wrong argument and reports a success that did not happen
|
|
94
|
+
* (#2470). Silently corrupted output instead of a dropped entity, same class.
|
|
95
|
+
*/
|
|
96
|
+
export function replaceStepArgument(entityText, attrIndex, replacement) {
|
|
97
|
+
const match = entityText.match(/^(#\d+\s*=\s*\w+\()([\s\S]*)(\)\s*;)\s*$/);
|
|
98
|
+
if (!match)
|
|
99
|
+
return null;
|
|
100
|
+
const [, prefix, attrsText, suffix] = match;
|
|
101
|
+
const attrs = splitTopLevelStepArguments(attrsText);
|
|
102
|
+
// Load-bearing, and covered: the bounds check below READS `attrs.length`, so a
|
|
103
|
+
// null reaches it as a TypeError rather than falling through to a rejection.
|
|
104
|
+
// Deleting this line fails exactly the three malformed-input cases in
|
|
105
|
+
// `step-argument-parser.test.ts` — unterminated string, unbalanced list, stray
|
|
106
|
+
// closing paren — which throw instead of returning null. Kept as its own line,
|
|
107
|
+
// not folded into that check, because "could not scan it" and "that slot is
|
|
108
|
+
// past the end" are different facts about the input.
|
|
109
|
+
if (attrs === null)
|
|
110
|
+
return null;
|
|
111
|
+
// A negative or fractional slot must not reach the assignment below: it would
|
|
112
|
+
// set a NAMED PROPERTY on the array rather than an element, `join` would skip
|
|
113
|
+
// it, and this would hand back the line unchanged — but non-null, which the
|
|
114
|
+
// contract above says means the replacement happened. `rewriteTypeOwnedPsetLine`
|
|
115
|
+
// reads that as `repointed: true` and would report a repoint that never
|
|
116
|
+
// occurred. Unreachable today (the only slot is a constant), guarded because
|
|
117
|
+
// the function is exported and the non-null contract is load-bearing.
|
|
118
|
+
if (!Number.isInteger(attrIndex) || attrIndex < 0 || attrIndex >= attrs.length)
|
|
119
|
+
return null;
|
|
120
|
+
attrs[attrIndex] = replacement;
|
|
121
|
+
return `${prefix}${attrs.join(',')}${suffix}`;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Split a STEP argument list on top-level commas while preserving nested syntax,
|
|
125
|
+
* or null when the text is not a well-formed argument list.
|
|
126
|
+
*
|
|
127
|
+
* Similar to `splitTopLevelArgs` but uses a slightly different accumulation style
|
|
128
|
+
* suited for the {@link replaceStepArgument} call-site.
|
|
129
|
+
*
|
|
130
|
+
* ## Why it validates
|
|
131
|
+
*
|
|
132
|
+
* The scan already tracks quote state and paren depth to know where a top-level
|
|
133
|
+
* comma is. It used to ignore the final state, so text that never left a string
|
|
134
|
+
* or never closed a list still produced parts — parts whose boundaries are
|
|
135
|
+
* wherever the scanner happened to be, not the record's slots. Both callers then
|
|
136
|
+
* acted on them: `replaceStepArgument` wrote a slot by index and reported
|
|
137
|
+
* success, and the unit rescale multiplied numbers in whatever argument the
|
|
138
|
+
* mis-split had put them in. Neither could tell, because a broken split looks
|
|
139
|
+
* exactly like a good one.
|
|
140
|
+
*
|
|
141
|
+
* Rejected, because after either of these the parts are no longer the record's
|
|
142
|
+
* arguments — commas were swallowed and everything past them shifted:
|
|
143
|
+
* - a quote left open at the end (unterminated string);
|
|
144
|
+
* - a paren depth that does not return to zero, or that ever goes below it
|
|
145
|
+
* (unbalanced or stray-closing nested list). Both ends matter: a depth that
|
|
146
|
+
* dips negative and climbs back looks balanced at the end while every comma
|
|
147
|
+
* in between was read as nested.
|
|
148
|
+
*
|
|
149
|
+
* An EMPTY top-level slot (`a,,b`, or a trailing comma) is deliberately NOT
|
|
150
|
+
* rejected, though it is invalid STEP. It costs no alignment: an empty argument
|
|
151
|
+
* is ONE part, exactly as the entity parser counts it, so every index still
|
|
152
|
+
* names the attribute it is meant to and the replacement lands where it should.
|
|
153
|
+
* Rejecting it made things strictly worse, and measurably: the parser resolves
|
|
154
|
+
* `HasPropertySets` on such a line, so a session deleting that type object's
|
|
155
|
+
* property set has already had the pset's lines WITHHELD by the time the repoint
|
|
156
|
+
* runs — refuse the repoint and the record keeps a `#id` pointing at a property
|
|
157
|
+
* set the export just dropped. A dangling reference is worse than a
|
|
158
|
+
* still-invalid-but-unchanged empty slot.
|
|
159
|
+
*
|
|
160
|
+
* An empty INPUT is not an empty slot: `#1=IFCFOO();` is a record with no
|
|
161
|
+
* arguments, so it splits to `[]` and any slot request then fails the bounds
|
|
162
|
+
* check in {@link replaceStepArgument} — which is the right answer for a record
|
|
163
|
+
* that has no slots.
|
|
164
|
+
*/
|
|
165
|
+
export function splitTopLevelStepArguments(input) {
|
|
166
|
+
if (input.trim() === '')
|
|
167
|
+
return [];
|
|
168
|
+
const parts = [];
|
|
169
|
+
let current = '';
|
|
170
|
+
let depth = 0;
|
|
171
|
+
let inString = false;
|
|
172
|
+
for (let i = 0; i < input.length; i++) {
|
|
173
|
+
const char = input[i];
|
|
174
|
+
if (char === "'") {
|
|
175
|
+
current += char;
|
|
176
|
+
if (inString && i + 1 < input.length && input[i + 1] === "'") {
|
|
177
|
+
current += input[i + 1];
|
|
178
|
+
i++;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
inString = !inString;
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
if (!inString) {
|
|
185
|
+
if (char === '(')
|
|
186
|
+
depth++;
|
|
187
|
+
else if (char === ')') {
|
|
188
|
+
depth--;
|
|
189
|
+
// Already past the record's own closing paren: every comma from here
|
|
190
|
+
// would be read as nested and the split is meaningless.
|
|
191
|
+
if (depth < 0)
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
else if (char === ',' && depth === 0) {
|
|
195
|
+
parts.push(current);
|
|
196
|
+
current = '';
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
current += char;
|
|
201
|
+
}
|
|
202
|
+
if (inString || depth !== 0)
|
|
203
|
+
return null;
|
|
204
|
+
parts.push(current);
|
|
205
|
+
return parts;
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=step-argument-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-argument-parser.js","sourceRoot":"","sources":["../src/step-argument-parser.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,IAAI,CAAC;QAEhB,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;gBAClB,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;oBACzB,OAAO,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;oBACvB,CAAC,EAAE,CAAC;gBACN,CAAC;qBAAM,CAAC;oBACN,QAAQ,GAAG,KAAK,CAAC;gBAC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CAAC;gBACJ,SAAS;YACX,CAAC;YACD,QAAQ,GAAG,CAAC,QAAQ,CAAC;YACrB,SAAS;QACX,CAAC;QAED,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,IAAI,IAAI,KAAK,GAAG;gBAAE,KAAK,EAAE,CAAC;iBACrB,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;gBACtB,KAAK,EAAE,CAAC;gBACR,qEAAqE;gBACrE,wDAAwD;gBACxD,IAAI,KAAK,GAAG,CAAC;oBAAE,OAAO,IAAI,CAAC;YAC7B,CAAC;iBAAM,IAAI,IAAI,KAAK,GAAG,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;gBACvC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACpB,OAAO,GAAG,EAAE,CAAC;gBACb,SAAS;YACX,CAAC;QACH,CAAC;QAED,OAAO,IAAI,IAAI,CAAC;IAClB,CAAC;IAED,IAAI,QAAQ,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpB,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/step-exporter.d.ts
CHANGED
|
@@ -189,6 +189,51 @@ export declare class StepExporter {
|
|
|
189
189
|
* Generate STEP entities for quantity sets (IfcElementQuantity)
|
|
190
190
|
*/
|
|
191
191
|
private generateQuantitySetEntities;
|
|
192
|
+
/**
|
|
193
|
+
* THE mutation pipeline for a line read out of the source buffer: retype,
|
|
194
|
+
* then named attribute edits, then positional edits.
|
|
195
|
+
*
|
|
196
|
+
* **One implementation, two call sites**, and that is the whole point. Two
|
|
197
|
+
* passes can write the defining line of a source entity — the
|
|
198
|
+
* source-iteration pass, and the type-object `HasPropertySets` rewrite that
|
|
199
|
+
* REPLACES it (`rewrittenEntityIds` makes the source pass skip those ids).
|
|
200
|
+
* The rewrite used to do its own thing (replace slot 5, nothing else), so
|
|
201
|
+
* every other edit to a type object with a type-owned pset edit was dropped
|
|
202
|
+
* in silence: first the renames (#2462 follow-up), and after those were
|
|
203
|
+
* special-cased here, still the retypes and the positional edits. Whatever
|
|
204
|
+
* the source pass applies, the rewrite has to apply too, or the next edit
|
|
205
|
+
* kind added to one site goes missing at the other.
|
|
206
|
+
*
|
|
207
|
+
* The order is load-bearing:
|
|
208
|
+
*
|
|
209
|
+
* - the retype runs FIRST so named attribute edits resolve against the
|
|
210
|
+
* TARGET class's attribute names, and so positional slots are indexed
|
|
211
|
+
* into the retyped argument list;
|
|
212
|
+
* - the `HasPropertySets` replacement (rewrite path only) runs LAST, on
|
|
213
|
+
* the text this returns. Run it first and a positional edit to slot 5 —
|
|
214
|
+
* or a retype's argument-list rebuild — overwrites the resolved pset
|
|
215
|
+
* list with the stale one, which is the same silent drop one slot over.
|
|
216
|
+
*
|
|
217
|
+
* The expressId is unchanged by all of this, so geometry / placement /
|
|
218
|
+
* representation and every IfcRel* reference (keyed by #id) carry over.
|
|
219
|
+
*
|
|
220
|
+
* All three flags report EFFECT, not intent — each is the answer to "did this
|
|
221
|
+
* operation change the line", measured across that operation alone. The count
|
|
222
|
+
* and the ledger are claims about the FILE, so an edit that resolves to the
|
|
223
|
+
* text already there has delivered nothing and must not be reported: retyping
|
|
224
|
+
* an entity to the class it already is, or writing a positional slot the token
|
|
225
|
+
* it already holds, used to count as a modification and reach the ledger as a
|
|
226
|
+
* landed edit, over a byte-identical line. Discarded edits read the same way:
|
|
227
|
+
* `applyAttributeMutations` drops a name its class has no slot for and
|
|
228
|
+
* `retypeStepLine` returns an unparseable line untouched, and neither is a
|
|
229
|
+
* modification of anything.
|
|
230
|
+
*
|
|
231
|
+
* `retyped` / `positional` matter most in a FULL export, which is where the
|
|
232
|
+
* two are nominated (their edits have no earlier nomination site); named
|
|
233
|
+
* attribute edits are nominated by the collection pass and `attributed` only
|
|
234
|
+
* settles their delivery.
|
|
235
|
+
*/
|
|
236
|
+
private applySourceLineMutations;
|
|
192
237
|
/**
|
|
193
238
|
* Rewrite root IFC attributes directly on the original STEP entity line.
|
|
194
239
|
*/
|
|
@@ -347,10 +392,6 @@ export declare class StepExporter {
|
|
|
347
392
|
* relation instead (#2012).
|
|
348
393
|
*/
|
|
349
394
|
private getTypeOwnedHasPropertySetIds;
|
|
350
|
-
/**
|
|
351
|
-
* Replace a single top-level STEP attribute in an entity line.
|
|
352
|
-
*/
|
|
353
|
-
private replaceEntityAttribute;
|
|
354
395
|
}
|
|
355
396
|
/**
|
|
356
397
|
* Quick export function for simple use cases.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-exporter.d.ts","sourceRoot":"","sources":["../src/step-exporter.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAsD,MAAM,kBAAkB,CAAC;AACzG,OAAO,
|
|
1
|
+
{"version":3,"file":"step-exporter.d.ts","sourceRoot":"","sources":["../src/step-exporter.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAsD,MAAM,kBAAkB,CAAC;AACzG,OAAO,EASL,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAsExE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC9C,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,MAAM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