@ifc-lite/ids 3.3.4 → 3.3.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/bridge/properties.d.ts +12 -2
- package/dist/bridge/properties.d.ts.map +1 -1
- package/dist/bridge/properties.js +146 -45
- package/dist/bridge/properties.js.map +1 -1
- package/dist/bridge/property-overlay-resolver.d.ts +4 -1
- package/dist/bridge/property-overlay-resolver.d.ts.map +1 -1
- package/dist/bridge/property-overlay-resolver.js +26 -10
- package/dist/bridge/property-overlay-resolver.js.map +1 -1
- package/dist/constraints/comparators.d.ts +9 -6
- package/dist/constraints/comparators.d.ts.map +1 -1
- package/dist/constraints/comparators.js +14 -9
- package/dist/constraints/comparators.js.map +1 -1
- package/dist/constraints/xsd-cast.d.ts +2 -0
- package/dist/constraints/xsd-cast.d.ts.map +1 -1
- package/dist/constraints/xsd-cast.js +19 -1
- package/dist/constraints/xsd-cast.js.map +1 -1
- package/dist/constraints/xsd-lexical.d.ts.map +1 -1
- package/dist/constraints/xsd-lexical.js +7 -2
- package/dist/constraints/xsd-lexical.js.map +1 -1
- package/package.json +3 -3
|
@@ -11,13 +11,23 @@ import type { PropertySetInfo } from '../types.js';
|
|
|
11
11
|
* 2. Predefined property sets (IfcDoorPanelProperties etc.) where
|
|
12
12
|
* the entity's schema-defined attributes act as property names.
|
|
13
13
|
* 3. Inherited property sets from `IfcRelDefinesByType`, predefined
|
|
14
|
-
* ones on the type included.
|
|
14
|
+
* ones and quantity sets on the type included.
|
|
15
15
|
*
|
|
16
16
|
* Measure-typed properties are converted to base SI units per the
|
|
17
17
|
* ENTITY'S OWN OWNING `IFCPROJECT`'s declared units — see
|
|
18
18
|
* `resolveEntityMeasureScales` — so IDS literals (always metre / m² / m³)
|
|
19
19
|
* compare correctly even for an entity belonging to a later `IFCPROJECT`
|
|
20
20
|
* in a multi-project (federated-merge) file.
|
|
21
|
+
*
|
|
22
|
+
* `writtenWithoutUnit`, when given, receives by identity each entry that a
|
|
23
|
+
* correction cannot edit in place (#7542, see property-overlay-resolver.ts).
|
|
24
|
+
* The viewer writes a correction through `MutablePropertyView.setProperty`.
|
|
25
|
+
* It edits a property that the entity's own property sets hold in place, and
|
|
26
|
+
* keeps its `Unit`. For any other entry the view has nothing to edit, so the
|
|
27
|
+
* correction becomes a new property with no unit. Such an entry is read and
|
|
28
|
+
* written in the entity's project unit, whatever its own `Unit`. These are
|
|
29
|
+
* every quantity (the entity's own, and a type object's own) and every entry
|
|
30
|
+
* the entity inherits through `IfcRelDefinesByType`.
|
|
21
31
|
*/
|
|
22
|
-
export declare function collectAllPropertySets(store: IfcDataStore, expressId: number): PropertySetInfo[];
|
|
32
|
+
export declare function collectAllPropertySets(store: IfcDataStore, expressId: number, writtenWithoutUnit?: Set<object>): PropertySetInfo[];
|
|
23
33
|
//# sourceMappingURL=properties.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/bridge/properties.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/bridge/properties.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,YAAY,EASlB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAMnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,kBAAkB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAC/B,eAAe,EAAE,CAqBnB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
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
|
-
import { extractPropertiesOnDemand, extractQuantitiesOnDemand, extractTypePropertiesOnDemand, extractTypeEntityOwnProperties, extractMaterialPropertiesForMaterialId, mergeInheritedPropertySets, } from '@ifc-lite/parser';
|
|
4
|
+
import { extractPropertiesOnDemand, extractQuantitiesOnDemand, extractTypePropertiesOnDemand, extractTypeEntityOwnProperties, extractTypeEntityOwnQuantities, extractMaterialPropertiesForMaterialId, getInheritanceChainAcrossSchemas, mergeInheritedPropertySets, } from '@ifc-lite/parser';
|
|
5
5
|
import { RelationshipType, exactTypeName } from '@ifc-lite/data';
|
|
6
6
|
import { idsDataTypeForQuantity } from './data-types.js';
|
|
7
7
|
import { appendPredefinedPropertySets, typePredefinedPropertySets } from './predefined-property-sets.js';
|
|
@@ -18,28 +18,50 @@ import { resolveEntityMeasureScales } from './units.js';
|
|
|
18
18
|
* 2. Predefined property sets (IfcDoorPanelProperties etc.) where
|
|
19
19
|
* the entity's schema-defined attributes act as property names.
|
|
20
20
|
* 3. Inherited property sets from `IfcRelDefinesByType`, predefined
|
|
21
|
-
* ones on the type included.
|
|
21
|
+
* ones and quantity sets on the type included.
|
|
22
22
|
*
|
|
23
23
|
* Measure-typed properties are converted to base SI units per the
|
|
24
24
|
* ENTITY'S OWN OWNING `IFCPROJECT`'s declared units — see
|
|
25
25
|
* `resolveEntityMeasureScales` — so IDS literals (always metre / m² / m³)
|
|
26
26
|
* compare correctly even for an entity belonging to a later `IFCPROJECT`
|
|
27
27
|
* in a multi-project (federated-merge) file.
|
|
28
|
+
*
|
|
29
|
+
* `writtenWithoutUnit`, when given, receives by identity each entry that a
|
|
30
|
+
* correction cannot edit in place (#7542, see property-overlay-resolver.ts).
|
|
31
|
+
* The viewer writes a correction through `MutablePropertyView.setProperty`.
|
|
32
|
+
* It edits a property that the entity's own property sets hold in place, and
|
|
33
|
+
* keeps its `Unit`. For any other entry the view has nothing to edit, so the
|
|
34
|
+
* correction becomes a new property with no unit. Such an entry is read and
|
|
35
|
+
* written in the entity's project unit, whatever its own `Unit`. These are
|
|
36
|
+
* every quantity (the entity's own, and a type object's own) and every entry
|
|
37
|
+
* the entity inherits through `IfcRelDefinesByType`.
|
|
28
38
|
*/
|
|
29
|
-
export function collectAllPropertySets(store, expressId) {
|
|
39
|
+
export function collectAllPropertySets(store, expressId, writtenWithoutUnit) {
|
|
30
40
|
const own = [];
|
|
31
41
|
const scales = resolveEntityMeasureScales(store, expressId);
|
|
32
42
|
appendInstancePropertySets(store, expressId, scales, own);
|
|
43
|
+
const firstQuantitySet = own.length;
|
|
33
44
|
appendQuantitySets(store, expressId, scales, own);
|
|
45
|
+
addEntries(own, writtenWithoutUnit, firstQuantitySet);
|
|
34
46
|
appendPredefinedPropertySets(store, expressId, scales, own);
|
|
35
|
-
|
|
47
|
+
const typeName = resolveEntityTypeName(store, expressId);
|
|
48
|
+
appendMaterialOwnPropertySets(store, expressId, typeName, scales, own);
|
|
49
|
+
const inherited = inheritedPropertySets(store, expressId, scales);
|
|
50
|
+
addEntries(inherited, writtenWithoutUnit);
|
|
36
51
|
// Merged per property, not per set — see `mergeInheritedPropertySets`.
|
|
37
|
-
const out = mergeInheritedPropertySets(own,
|
|
52
|
+
const out = mergeInheritedPropertySets(own, inherited);
|
|
38
53
|
if (out.length === 0) {
|
|
39
|
-
|
|
54
|
+
return typeEntityOwnSets(store, expressId, typeName, scales, writtenWithoutUnit);
|
|
40
55
|
}
|
|
41
56
|
return out;
|
|
42
57
|
}
|
|
58
|
+
/** Adds the entries of `sets[from..]` to `into`, when given. */
|
|
59
|
+
function addEntries(sets, into, from = 0) {
|
|
60
|
+
if (into)
|
|
61
|
+
for (let i = from; i < sets.length; i++)
|
|
62
|
+
for (const p of sets[i].properties)
|
|
63
|
+
into.add(p);
|
|
64
|
+
}
|
|
43
65
|
function appendInstancePropertySets(store, expressId, scales, out) {
|
|
44
66
|
let props = store.properties?.getForEntity?.(expressId);
|
|
45
67
|
if (!props || props.length === 0) {
|
|
@@ -71,18 +93,21 @@ function appendQuantitySets(store, expressId, scales, out) {
|
|
|
71
93
|
}
|
|
72
94
|
if (!quantities || quantities.length === 0)
|
|
73
95
|
return;
|
|
74
|
-
for (const qset of quantities)
|
|
75
|
-
out.push(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
96
|
+
for (const qset of quantities)
|
|
97
|
+
out.push(quantitySetInfo(qset, scales));
|
|
98
|
+
}
|
|
99
|
+
/** One `IfcElementQuantity` as a property set, its values in base SI. */
|
|
100
|
+
function quantitySetInfo(qset, scales) {
|
|
101
|
+
return {
|
|
102
|
+
name: qset.name,
|
|
103
|
+
properties: (qset.quantities || []).map((q) => projectProperty({
|
|
104
|
+
name: q.name,
|
|
105
|
+
value: q.value,
|
|
106
|
+
type: undefined,
|
|
107
|
+
dataType: idsDataTypeForQuantity(q.type),
|
|
108
|
+
...quantityOwnUnit(q),
|
|
109
|
+
}, scales)),
|
|
110
|
+
};
|
|
86
111
|
}
|
|
87
112
|
/**
|
|
88
113
|
* A quantity's own `Unit`, in the `unit`/`unitSiScale` shape property records
|
|
@@ -112,8 +137,8 @@ function quantityOwnUnit(quantity) {
|
|
|
112
137
|
* common "element that has a material" shape; that path goes through
|
|
113
138
|
* the material facet, not this one.
|
|
114
139
|
*/
|
|
115
|
-
function appendMaterialOwnPropertySets(store, expressId, scales, out) {
|
|
116
|
-
if (
|
|
140
|
+
function appendMaterialOwnPropertySets(store, expressId, typeName, scales, out) {
|
|
141
|
+
if (typeName?.toUpperCase() !== 'IFCMATERIAL')
|
|
117
142
|
return;
|
|
118
143
|
const groups = extractMaterialPropertiesForMaterialId(store, expressId);
|
|
119
144
|
for (const group of groups) {
|
|
@@ -133,13 +158,14 @@ function appendMaterialOwnPropertySets(store, expressId, scales, out) {
|
|
|
133
158
|
* -level entities like `IfcMaterial` resolve to `'Unknown'` there) to
|
|
134
159
|
* `entityIndex.byId`. Mirrors `createDataAccessor`'s `getEntityType`;
|
|
135
160
|
* duplicated rather than threaded through as a parameter because only
|
|
136
|
-
*
|
|
161
|
+
* `collectAllPropertySets` needs a raw type check ahead of the accessor
|
|
162
|
+
* existing. It reads it once, for the material and the type-object checks.
|
|
137
163
|
*/
|
|
138
164
|
function resolveEntityTypeName(store, expressId) {
|
|
139
165
|
const fromTable = store.entities ? exactTypeName(store.entities, expressId) : undefined;
|
|
140
166
|
if (fromTable && fromTable !== 'Unknown')
|
|
141
167
|
return fromTable;
|
|
142
|
-
// @raw-entity-enumeration-ok point lookup for one source record to guard the parsed material-owned-property
|
|
168
|
+
// @raw-entity-enumeration-ok point lookup for one source record to guard the parsed material-owned-property and type-object quantity projections; this helper projects source property sets and is not a live candidate/type enumeration
|
|
143
169
|
const entry = store.entityIndex?.byId?.get(expressId);
|
|
144
170
|
if (!entry)
|
|
145
171
|
return undefined;
|
|
@@ -152,10 +178,20 @@ function inheritedPropertySets(store, expressId, scales) {
|
|
|
152
178
|
// #1787), mirroring the Lists adapter's server-path type fallback.
|
|
153
179
|
const inheritedPsets = extractTypePropertiesOnDemand(store, expressId)?.properties ??
|
|
154
180
|
typePropertySetsFromTable(store, expressId);
|
|
155
|
-
|
|
181
|
+
// The type's quantity sets are inherited like its property sets (#7542):
|
|
182
|
+
// `IfcTypeObject.HasPropertySets` holds both. Same two parse paths. The type
|
|
183
|
+
// is resolved here and read once per type (`typeOwnQuantitySets`), so a
|
|
184
|
+
// typed element whose type holds no quantity set adds next to no work.
|
|
185
|
+
const sourceTypeId = store.source?.length
|
|
186
|
+
? store.relationships?.getRelated?.(expressId, RelationshipType.DefinesByType, 'inverse')?.[0]
|
|
187
|
+
: undefined;
|
|
188
|
+
const inheritedQsets = sourceTypeId !== undefined
|
|
189
|
+
? typeOwnQuantitySets(store, sourceTypeId)
|
|
190
|
+
: typeQuantitySetsFromTable(store, expressId);
|
|
191
|
+
const inherited = typeObjectSets(inheritedPsets.map((pset) => ({
|
|
156
192
|
name: pset.name,
|
|
157
193
|
properties: (pset.properties || []).map((p) => projectProperty(p, scales)),
|
|
158
|
-
}));
|
|
194
|
+
})), inheritedQsets.map((qset) => quantitySetInfo(qset, scales)));
|
|
159
195
|
// The type's predefined property sets (IfcDoorLiningProperties, ...) are
|
|
160
196
|
// inherited the same way (#7395). One sharing a name with an ordinary type
|
|
161
197
|
// set adds the properties that set lacks, rather than being dropped.
|
|
@@ -172,31 +208,96 @@ function inheritedPropertySets(store, expressId, scales) {
|
|
|
172
208
|
}
|
|
173
209
|
return inherited;
|
|
174
210
|
}
|
|
175
|
-
/**
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
211
|
+
/**
|
|
212
|
+
* A type object's property sets and quantity sets as one list (#7542). A
|
|
213
|
+
* quantity set named like one of the type's property sets adds the quantities
|
|
214
|
+
* that set lacks, and the property set keeps a same-named item: the per-item
|
|
215
|
+
* rule `mergeInheritedPropertySets` applies between an occurrence and its type.
|
|
216
|
+
* Listed separately, the property set would fail every requirement on the
|
|
217
|
+
* quantity set's items and the other way round, since IDS requires every set
|
|
218
|
+
* matching the facet's `propertySet` to satisfy it. A quantity set with no such
|
|
219
|
+
* property set is kept as its own set, so two same-named quantity sets stay two.
|
|
220
|
+
*/
|
|
221
|
+
function typeObjectSets(psets, qsets) {
|
|
222
|
+
return mergeInheritedPropertySets(psets, qsets);
|
|
223
|
+
}
|
|
224
|
+
/** Server-parsed stores (no `source`) only: the element's IfcTypeProduct, via
|
|
225
|
+
* IfcRelDefinesByType, whose sets the server materialises in the prebuilt
|
|
226
|
+
* tables under the type's own id (serverDataModel's TYPEHASPROPERTYSETS
|
|
227
|
+
* merge). Undefined for WASM stores, whose type sets the source-backed
|
|
228
|
+
* extractors already resolved, so the table fallbacks never run there. */
|
|
229
|
+
function serverTypeId(store, expressId) {
|
|
184
230
|
if (store.source && store.source.length > 0)
|
|
231
|
+
return undefined;
|
|
232
|
+
return store.relationships?.getRelated?.(expressId, RelationshipType.DefinesByType, 'inverse')?.[0];
|
|
233
|
+
}
|
|
234
|
+
/** Type-inherited property sets for server-parsed stores (#1787): the prebuilt
|
|
235
|
+
* property table for the type id. [] for WASM stores. */
|
|
236
|
+
function typePropertySetsFromTable(store, expressId) {
|
|
237
|
+
const typeId = serverTypeId(store, expressId);
|
|
238
|
+
if (typeId === undefined)
|
|
185
239
|
return [];
|
|
186
|
-
const
|
|
187
|
-
if (typeIds.length === 0)
|
|
188
|
-
return [];
|
|
189
|
-
const psets = store.properties?.getForEntity?.(typeIds[0]);
|
|
240
|
+
const psets = store.properties?.getForEntity?.(typeId);
|
|
190
241
|
return (psets ?? []);
|
|
191
242
|
}
|
|
192
|
-
/**
|
|
193
|
-
*
|
|
194
|
-
function
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
243
|
+
/** Type-inherited quantity sets for server-parsed stores (#7542): the prebuilt
|
|
244
|
+
* quantity table for the type id. [] for WASM stores. */
|
|
245
|
+
function typeQuantitySetsFromTable(store, expressId) {
|
|
246
|
+
const typeId = serverTypeId(store, expressId);
|
|
247
|
+
if (typeId === undefined)
|
|
248
|
+
return [];
|
|
249
|
+
return store.quantities?.getForEntity?.(typeId) ?? [];
|
|
250
|
+
}
|
|
251
|
+
/** A type object's own `HasPropertySets`, property and quantity sets
|
|
252
|
+
* (#7542), converted to SI like any other property set (#7395). Every entity
|
|
253
|
+
* without a set of its own reaches this, mostly geometry, so the quantity
|
|
254
|
+
* sets are read only for a type object (`isTypeObjectClass`) and without the
|
|
255
|
+
* memo below. The quantities go to `writtenWithoutUnit`, as every quantity
|
|
256
|
+
* does: see `collectAllPropertySets`. */
|
|
257
|
+
function typeEntityOwnSets(store, expressId, typeName, scales, writtenWithoutUnit) {
|
|
258
|
+
const psets = extractTypeEntityOwnProperties(store, expressId).map((pset) => ({
|
|
259
|
+
name: pset.name,
|
|
260
|
+
properties: (pset.properties || []).map((p) => projectProperty(p, scales)),
|
|
261
|
+
}));
|
|
262
|
+
if (!isTypeObjectClass(typeName))
|
|
263
|
+
return psets;
|
|
264
|
+
const qsets = extractTypeEntityOwnQuantities(store, expressId).map((qset) => quantitySetInfo(qset, scales));
|
|
265
|
+
addEntries(qsets, writtenWithoutUnit);
|
|
266
|
+
return typeObjectSets(psets, qsets);
|
|
267
|
+
}
|
|
268
|
+
const typeObjectByClass = new Map();
|
|
269
|
+
/** Whether a class is an `IfcTypeObject`: the check
|
|
270
|
+
* `extractTypeEntityOwnQuantities` makes, kept per class name. */
|
|
271
|
+
function isTypeObjectClass(typeName) {
|
|
272
|
+
if (!typeName)
|
|
273
|
+
return false;
|
|
274
|
+
let known = typeObjectByClass.get(typeName);
|
|
275
|
+
if (known === undefined) {
|
|
276
|
+
known = getInheritanceChainAcrossSchemas(typeName).includes('IfcTypeObject');
|
|
277
|
+
typeObjectByClass.set(typeName, known);
|
|
278
|
+
}
|
|
279
|
+
return known;
|
|
280
|
+
}
|
|
281
|
+
const typeOwnQuantityCache = new WeakMap();
|
|
282
|
+
/**
|
|
283
|
+
* The quantity sets an occurrence inherits from its type, read from the source
|
|
284
|
+
* once per store and type (#7542). Every occurrence of the type asks, so
|
|
285
|
+
* without the memo each one would decode the type entity again, also when the
|
|
286
|
+
* type holds no quantity set. Only a type reached through `IfcRelDefinesByType`
|
|
287
|
+
* gets an entry. Safe to share: the reader derives only from the immutable
|
|
288
|
+
* source and entity index, and `quantitySetInfo` copies what it projects.
|
|
289
|
+
*/
|
|
290
|
+
function typeOwnQuantitySets(store, typeId) {
|
|
291
|
+
let byType = typeOwnQuantityCache.get(store);
|
|
292
|
+
if (!byType) {
|
|
293
|
+
byType = new Map();
|
|
294
|
+
typeOwnQuantityCache.set(store, byType);
|
|
295
|
+
}
|
|
296
|
+
let sets = byType.get(typeId);
|
|
297
|
+
if (!sets) {
|
|
298
|
+
sets = extractTypeEntityOwnQuantities(store, typeId);
|
|
299
|
+
byType.set(typeId, sets);
|
|
200
300
|
}
|
|
301
|
+
return sets;
|
|
201
302
|
}
|
|
202
303
|
//# sourceMappingURL=properties.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../src/bridge/properties.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAEL,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC7B,8BAA8B,EAC9B,sCAAsC,EACtC,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AACzG,OAAO,EAAE,eAAe,EAAgB,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAA4B,MAAM,YAAY,CAAC;AAElF
|
|
1
|
+
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../src/bridge/properties.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAEL,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC7B,8BAA8B,EAC9B,8BAA8B,EAC9B,sCAAsC,EACtC,gCAAgC,EAChC,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AACzG,OAAO,EAAE,eAAe,EAAgB,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAA4B,MAAM,YAAY,CAAC;AAElF;;;;;;;;;;;;;;;;;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AC,CAAC;IAC5C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,KAAK,GAAG,gCAAgC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC7E,iBAAiB,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAGD,MAAM,oBAAoB,GAAG,IAAI,OAAO,EAAkD,CAAC;AAE3F;;;;;;;GAOG;AACH,SAAS,mBAAmB,CAAC,KAAmB,EAAE,MAAc;IAC9D,IAAI,MAAM,GAAG,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;QACnB,oBAAoB,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IACD,IAAI,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,IAAI,GAAG,8BAA8B,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrD,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -74,7 +74,10 @@ export declare function resolveEffectivePropertySets(store: IfcDataStore, expres
|
|
|
74
74
|
* stored in — the property's own `Unit` when it declares one, else the
|
|
75
75
|
* project unit for `dataType` (or, when omitted, the property's own
|
|
76
76
|
* dataType). A property the entity does not carry yet takes the project
|
|
77
|
-
* unit, matching how a created override is read back.
|
|
77
|
+
* unit, matching how a created override is read back. So does an entry a
|
|
78
|
+
* correction cannot edit in place (#7542): every quantity, and every entry
|
|
79
|
+
* the entity inherits from its type. The viewer writes that correction as a
|
|
80
|
+
* new property with no unit (see `collectAllPropertySets`).
|
|
78
81
|
*/
|
|
79
82
|
export declare function propertyValueToRaw(store: IfcDataStore, expressId: number, psetName: string, propName: string, dataType: string | undefined, value: string | number | boolean): string | number | boolean;
|
|
80
83
|
//# sourceMappingURL=property-overlay-resolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-overlay-resolver.d.ts","sourceRoot":"","sources":["../../src/bridge/property-overlay-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAanD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACxC,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,gBAAgB,EAAE,GAAG,SAAS,CAAC;AAE5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,uBAAuB,GAAG,SAAS,GACnD,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"property-overlay-resolver.d.ts","sourceRoot":"","sources":["../../src/bridge/property-overlay-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAanD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACxC,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,gBAAgB,EAAE,GAAG,SAAS,CAAC;AAE5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,uBAAuB,GAAG,SAAS,GACnD,eAAe,EAAE,CAwInB;AAwBD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAC/B,MAAM,GAAG,MAAM,GAAG,OAAO,CAiB3B"}
|
|
@@ -39,10 +39,13 @@ import { ownUnitConversionFor, resolveEntityMeasureScales, toBaseSI, toRaw, } fr
|
|
|
39
39
|
* consumes it in agreement.
|
|
40
40
|
*/
|
|
41
41
|
export function resolveEffectivePropertySets(store, expressId, propertyOverlay) {
|
|
42
|
-
const base = collectAllPropertySets(store, expressId);
|
|
43
42
|
const overrides = propertyOverlay?.(expressId);
|
|
44
43
|
if (!overrides || overrides.length === 0)
|
|
45
|
-
return
|
|
44
|
+
return collectAllPropertySets(store, expressId);
|
|
45
|
+
// The entries a correction writes with no unit, and below their copies: an
|
|
46
|
+
// override of one is read in the project unit (#7542, `existingToBaseSI`).
|
|
47
|
+
const writtenWithoutUnit = new Set();
|
|
48
|
+
const base = collectAllPropertySets(store, expressId, writtenWithoutUnit);
|
|
46
49
|
// Deep-clone only what we might mutate (psets/properties arrays), so the
|
|
47
50
|
// base projection's cached/shared objects are never touched.
|
|
48
51
|
const result = base.map((pset) => ({
|
|
@@ -50,6 +53,8 @@ export function resolveEffectivePropertySets(store, expressId, propertyOverlay)
|
|
|
50
53
|
properties: pset.properties.map((p) => {
|
|
51
54
|
const copy = { ...p };
|
|
52
55
|
copyOwnUnit(p, copy);
|
|
56
|
+
if (writtenWithoutUnit.has(p))
|
|
57
|
+
writtenWithoutUnit.add(copy);
|
|
53
58
|
return copy;
|
|
54
59
|
}),
|
|
55
60
|
}));
|
|
@@ -107,13 +112,16 @@ export function resolveEffectivePropertySets(store, expressId, propertyOverlay)
|
|
|
107
112
|
// scale: a non-measure property (IFCLABEL, boolean, identifier)
|
|
108
113
|
// has no scale and passes through untouched.
|
|
109
114
|
const existing = targetSet.properties[idx];
|
|
115
|
+
const withoutUnit = writtenWithoutUnit.has(existing);
|
|
110
116
|
const replacement = {
|
|
111
117
|
...existing,
|
|
112
|
-
value: existingToBaseSI(existing, override.value, scales),
|
|
118
|
+
value: existingToBaseSI(existing, withoutUnit, override.value, scales),
|
|
113
119
|
};
|
|
114
120
|
// Keep its own Unit so a later override of the same property in this
|
|
115
|
-
// array converts in that unit too.
|
|
116
|
-
|
|
121
|
+
// array converts in that unit too. An entry written with no unit now
|
|
122
|
+
// holds such a value, so a later override reads in the project unit.
|
|
123
|
+
if (!withoutUnit)
|
|
124
|
+
copyOwnUnit(existing, replacement);
|
|
117
125
|
targetSet.properties[idx] = replacement;
|
|
118
126
|
}
|
|
119
127
|
else if (matchingSets.length > 0) {
|
|
@@ -166,9 +174,13 @@ export function resolveEffectivePropertySets(store, expressId, propertyOverlay)
|
|
|
166
174
|
/**
|
|
167
175
|
* An override of an EXISTING property is written in that property's raw
|
|
168
176
|
* frame: its own `Unit` when it declares one (#7395), else the project's.
|
|
177
|
+
* An entry a correction cannot edit in place (`withoutUnit`) takes the
|
|
178
|
+
* project's (#7542): every quantity, and every entry inherited from the
|
|
179
|
+
* type. The viewer writes its correction as a new property with no unit
|
|
180
|
+
* (see `collectAllPropertySets`).
|
|
169
181
|
*/
|
|
170
|
-
function existingToBaseSI(existing, value, scales) {
|
|
171
|
-
const own = ownUnitOf(existing);
|
|
182
|
+
function existingToBaseSI(existing, withoutUnit, value, scales) {
|
|
183
|
+
const own = withoutUnit ? undefined : ownUnitOf(existing);
|
|
172
184
|
if (!own)
|
|
173
185
|
return toBaseSI(value, existing.dataType, scales);
|
|
174
186
|
const c = ownUnitConversionFor(existing.dataType, own.siScale, own.symbol, own.siOffset);
|
|
@@ -181,13 +193,17 @@ function existingToBaseSI(existing, value, scales) {
|
|
|
181
193
|
* stored in — the property's own `Unit` when it declares one, else the
|
|
182
194
|
* project unit for `dataType` (or, when omitted, the property's own
|
|
183
195
|
* dataType). A property the entity does not carry yet takes the project
|
|
184
|
-
* unit, matching how a created override is read back.
|
|
196
|
+
* unit, matching how a created override is read back. So does an entry a
|
|
197
|
+
* correction cannot edit in place (#7542): every quantity, and every entry
|
|
198
|
+
* the entity inherits from its type. The viewer writes that correction as a
|
|
199
|
+
* new property with no unit (see `collectAllPropertySets`).
|
|
185
200
|
*/
|
|
186
201
|
export function propertyValueToRaw(store, expressId, psetName, propName, dataType, value) {
|
|
187
202
|
const psetLower = psetName.toLowerCase();
|
|
188
203
|
const propLower = propName.toLowerCase();
|
|
204
|
+
const writtenWithoutUnit = new Set();
|
|
189
205
|
let existing;
|
|
190
|
-
for (const pset of collectAllPropertySets(store, expressId)) {
|
|
206
|
+
for (const pset of collectAllPropertySets(store, expressId, writtenWithoutUnit)) {
|
|
191
207
|
if (pset.name.toLowerCase() !== psetLower)
|
|
192
208
|
continue;
|
|
193
209
|
existing = pset.properties.find((p) => p.name.toLowerCase() === propLower);
|
|
@@ -195,7 +211,7 @@ export function propertyValueToRaw(store, expressId, psetName, propName, dataTyp
|
|
|
195
211
|
break;
|
|
196
212
|
}
|
|
197
213
|
const effectiveType = dataType ?? existing?.dataType;
|
|
198
|
-
const own = existing && ownUnitOf(existing);
|
|
214
|
+
const own = existing && !writtenWithoutUnit.has(existing) ? ownUnitOf(existing) : undefined;
|
|
199
215
|
if (own) {
|
|
200
216
|
const c = ownUnitConversionFor(effectiveType, own.siScale, own.symbol, own.siOffset);
|
|
201
217
|
return typeof value === 'number' && !isIdentity(c) ? fromSi(value, c) : value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-overlay-resolver.js","sourceRoot":"","sources":["../../src/bridge/property-overlay-resolver.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAM/D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,QAAQ,EACR,KAAK,GAEN,MAAM,YAAY,CAAC;AAqCpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,4BAA4B,CAC1C,KAAmB,EACnB,SAAiB,EACjB,eAAoD;IAEpD,MAAM,
|
|
1
|
+
{"version":3,"file":"property-overlay-resolver.js","sourceRoot":"","sources":["../../src/bridge/property-overlay-resolver.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAM/D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;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AAa,EAAE,0BAA0B,CAAC,KAAK,EAAE,SAAS,CAAC,CAA8B,CAAC;AAChH,CAAC"}
|
|
@@ -39,14 +39,17 @@ export declare function compareNumeric(expected: string, actual: string | number
|
|
|
39
39
|
/** IDS 1.1 PREVIEW (#418) rule from the constraint; unset is the IDS 1.0 comparison. */
|
|
40
40
|
toleranceRule?: IDS11ToleranceRule): boolean | undefined;
|
|
41
41
|
/**
|
|
42
|
-
* Compare an IDS boolean literal to a stored value.
|
|
43
|
-
* the
|
|
44
|
-
*
|
|
42
|
+
* Compare an IDS boolean literal to a stored value. The literal is read
|
|
43
|
+
* in the xs:boolean lexical space, `true` / `false` / `1` / `0`
|
|
44
|
+
* (`xsdBooleanValue`); uppercase forms (`TRUE`) are not in it and never
|
|
45
|
+
* match. The numeric forms name a boolean only against a stored boolean:
|
|
46
|
+
* a text value that reads `true` is compared as text, so `1` does not
|
|
47
|
+
* match it (#7543).
|
|
45
48
|
*
|
|
46
49
|
* Returns:
|
|
47
|
-
* - `true` / `false` when
|
|
48
|
-
* - `undefined` when
|
|
49
|
-
*
|
|
50
|
+
* - `true` / `false` when the literal is an xs:boolean, OR
|
|
51
|
+
* - `undefined` when it is not, so the caller falls through to the
|
|
52
|
+
* other comparators.
|
|
50
53
|
*/
|
|
51
54
|
export declare function compareBoolean(expected: string, actual: string | number | boolean): boolean | undefined;
|
|
52
55
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comparators.d.ts","sourceRoot":"","sources":["../../src/constraints/comparators.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"comparators.d.ts","sourceRoot":"","sources":["../../src/constraints/comparators.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAI9D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED,wEAAwE;AACxE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEvD;AAWD,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CASzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO;AACjC,wFAAwF;AACxF,aAAa,CAAC,EAAE,kBAAkB,GACjC,OAAO,GAAG,SAAS,CAarB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAChC,OAAO,GAAG,SAAS,CAiBrB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,EACjC,eAAe,EAAE,OAAO,GACvB,OAAO,GAAG,SAAS,CAOrB"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { isWhollyNumeric } from '@ifc-lite/encoding';
|
|
13
13
|
import { equalsWithIds11Tolerance } from '../preview/tolerance.js';
|
|
14
|
+
import { xsdBooleanValue } from './xsd-cast.js';
|
|
14
15
|
/**
|
|
15
16
|
* Whether an IDS literal could ever match through `compareNumeric` —
|
|
16
17
|
* i.e. it is a strict numeric literal: optional sign, digits, optional
|
|
@@ -36,7 +37,7 @@ export function isStrictNumericLiteral(value) {
|
|
|
36
37
|
}
|
|
37
38
|
/** Whether an IDS literal could ever match through `compareBoolean`. */
|
|
38
39
|
export function isBooleanLiteral(value) {
|
|
39
|
-
return value
|
|
40
|
+
return xsdBooleanValue(value) !== undefined;
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
42
43
|
* Numeric tolerance for floating-point comparisons.
|
|
@@ -81,22 +82,26 @@ toleranceRule) {
|
|
|
81
82
|
return Math.abs(expectedNum - actualNum) <= numericEpsilon(expectedNum, actualNum);
|
|
82
83
|
}
|
|
83
84
|
/**
|
|
84
|
-
* Compare an IDS boolean literal to a stored value.
|
|
85
|
-
* the
|
|
86
|
-
*
|
|
85
|
+
* Compare an IDS boolean literal to a stored value. The literal is read
|
|
86
|
+
* in the xs:boolean lexical space, `true` / `false` / `1` / `0`
|
|
87
|
+
* (`xsdBooleanValue`); uppercase forms (`TRUE`) are not in it and never
|
|
88
|
+
* match. The numeric forms name a boolean only against a stored boolean:
|
|
89
|
+
* a text value that reads `true` is compared as text, so `1` does not
|
|
90
|
+
* match it (#7543).
|
|
87
91
|
*
|
|
88
92
|
* Returns:
|
|
89
|
-
* - `true` / `false` when
|
|
90
|
-
* - `undefined` when
|
|
91
|
-
*
|
|
93
|
+
* - `true` / `false` when the literal is an xs:boolean, OR
|
|
94
|
+
* - `undefined` when it is not, so the caller falls through to the
|
|
95
|
+
* other comparators.
|
|
92
96
|
*/
|
|
93
97
|
export function compareBoolean(expected, actual) {
|
|
94
|
-
|
|
98
|
+
const expectedValue = xsdBooleanValue(expected);
|
|
99
|
+
if (expectedValue === undefined) {
|
|
95
100
|
// Expected isn't a valid boolean literal — caller falls through.
|
|
96
101
|
return undefined;
|
|
97
102
|
}
|
|
98
103
|
if (typeof actual === 'boolean') {
|
|
99
|
-
return
|
|
104
|
+
return actual === expectedValue;
|
|
100
105
|
}
|
|
101
106
|
if (actual === 'true' || actual === 'false') {
|
|
102
107
|
return actual === expected;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comparators.js","sourceRoot":"","sources":["../../src/constraints/comparators.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAy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MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI,SAAS,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACxC,IAAI,eAAe,IAAI,SAAS,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;QAC1E,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* `Infinity` because it appears in neither upstream nor XSD.
|
|
9
9
|
*/
|
|
10
10
|
export declare const XSD_NUMERIC_SPECIALS: Set<string>;
|
|
11
|
+
/** The boolean an xs:boolean literal names, or `undefined` when it is not one. */
|
|
12
|
+
export declare function xsdBooleanValue(literal: string): boolean | undefined;
|
|
11
13
|
/**
|
|
12
14
|
* Returns true iff the IDS literal `value` casts successfully under at
|
|
13
15
|
* least one of `xsdTypes`. Empty / undefined `xsdTypes` returns `true`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xsd-cast.d.ts","sourceRoot":"","sources":["../../src/constraints/xsd-cast.ts"],"names":[],"mappings":"AAiCA;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,aAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"xsd-cast.d.ts","sourceRoot":"","sources":["../../src/constraints/xsd-cast.ts"],"names":[],"mappings":"AAiCA;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,aAAmC,CAAC;AAiBrE,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAEpE;AAMD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACtC,OAAO,CAGT;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAoCzE;AA4CD,uEAAuE;AACvE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAElE;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAElE;AA6BD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,GACjC,SAAS,MAAM,EAAE,CAkDnB"}
|
|
@@ -34,6 +34,24 @@ import { isValidXsdDateTimeLiteral, isXsdDateTimeBase, } from './xsd-datetime.js
|
|
|
34
34
|
* `Infinity` because it appears in neither upstream nor XSD.
|
|
35
35
|
*/
|
|
36
36
|
export const XSD_NUMERIC_SPECIALS = new Set(['NaN', '+INF', '-INF']);
|
|
37
|
+
/**
|
|
38
|
+
* The xs:boolean lexical space and the value each literal names. XML Schema
|
|
39
|
+
* Part 2 (3.2.2.1) defines it as {true, false, 1, 0}, with 1 and 0 meaning
|
|
40
|
+
* true and false. The audit (`xsd-lexical.ts`, upstream `XmlRegex` parity)
|
|
41
|
+
* already accepted all four; the audit, the cast gate and `compareBoolean`
|
|
42
|
+
* now all read them from here (#7543). `TRUE` / `False` are not
|
|
43
|
+
* in it (buildingSMART corpus: invalid-booleans_must_be_specified_as_lowercase_strings).
|
|
44
|
+
*/
|
|
45
|
+
const XSD_BOOLEAN_LITERALS = new Map([
|
|
46
|
+
['true', true],
|
|
47
|
+
['false', false],
|
|
48
|
+
['1', true],
|
|
49
|
+
['0', false],
|
|
50
|
+
]);
|
|
51
|
+
/** The boolean an xs:boolean literal names, or `undefined` when it is not one. */
|
|
52
|
+
export function xsdBooleanValue(literal) {
|
|
53
|
+
return XSD_BOOLEAN_LITERALS.get(literal);
|
|
54
|
+
}
|
|
37
55
|
const INTEGER_RE = /^[+-]?\d+$/;
|
|
38
56
|
const DURATION_RE = /^-?P(?:\d+Y)?(?:\d+M)?(?:\d+D)?(?:T(?:\d+H)?(?:\d+M)?(?:\d+(?:\.\d+)?S)?)?$/;
|
|
39
57
|
/**
|
|
@@ -75,7 +93,7 @@ export function literalCastsUnder(value, xsdType) {
|
|
|
75
93
|
// xsd-cast-specials.test.ts, which are representatives.
|
|
76
94
|
return isWhollyNumeric(value) || XSD_NUMERIC_SPECIALS.has(value);
|
|
77
95
|
case 'xs:boolean':
|
|
78
|
-
return value
|
|
96
|
+
return xsdBooleanValue(value) !== undefined;
|
|
79
97
|
case 'xs:duration':
|
|
80
98
|
return DURATION_RE.test(value);
|
|
81
99
|
case 'xs:string':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xsd-cast.js","sourceRoot":"","sources":["../../src/constraints/xsd-cast.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAErE,MAAM,UAAU,GAAG,YAAY,CAAC;AAChC,MAAM,WAAW,GACf,6EAA6E,CAAC;AAEhF;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,KAAa,EACb,QAAuC;IAEvC,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACpD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,OAAe;IAC9D,2EAA2E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,YAAY,EAAE,aAAa,CAAC,CAAC;QACtE,OAAO,aAAa,CAAC,WAAW,EAAE,KAAK,QAAQ;YAC7C,CAAC,CAAC,CAAC,YAAY,CAAC;YAChB,CAAC,CAAC,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;IACpC,CAAC;IACD,gEAAgE;IAChE,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACpE,OAAO,CAAC,WAAW,CAAC,CAAC;IACvB,CAAC;IACD,yDAAyD;IACzD,IACE,CAAC,KAAK,UAAU;QAChB,CAAC,KAAK,SAAS;QACf,CAAC,KAAK,eAAe;QACrB,CAAC,KAAK,WAAW,EACjB,CAAC;QACD,OAAO,CAAC,WAAW,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xsd-lexical.d.ts","sourceRoot":"","sources":["../../src/constraints/xsd-lexical.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xsd-lexical.d.ts","sourceRoot":"","sources":["../../src/constraints/xsd-lexical.ts"],"names":[],"mappings":"AAmCA,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAiB5E"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* the parser may not import from `audit/`. One answer, two callers, so an
|
|
10
10
|
* enumeration value and a bound under the same base cannot disagree.
|
|
11
11
|
*/
|
|
12
|
-
import { XSD_NUMERIC_SPECIALS } from './xsd-cast.js';
|
|
12
|
+
import { XSD_NUMERIC_SPECIALS, xsdBooleanValue } from './xsd-cast.js';
|
|
13
13
|
import { isValidXsdDateTimeLiteral, isXsdDateTimeBase } from './xsd-datetime.js';
|
|
14
14
|
/**
|
|
15
15
|
* Validate that `value` matches the lexical space of the supplied XSD
|
|
@@ -25,7 +25,6 @@ const XS_VALUE_REGEX = {
|
|
|
25
25
|
'xs:double': /^([-+]?[0-9]*(?:\.[0-9]*)?([eE][-+]?[0-9]+)?|NaN|\+INF|-INF)$/,
|
|
26
26
|
'xs:float': /^([-+]?[0-9]*(?:\.[0-9]*)?([eE][-+]?[0-9]+)?|NaN|\+INF|-INF)$/,
|
|
27
27
|
'xs:decimal': /^([-+]?[0-9]*(?:\.[0-9]*)?([eE][-+]?[0-9]+)?|NaN|\+INF|-INF)$/,
|
|
28
|
-
'xs:boolean': /^(true|false|0|1)$/,
|
|
29
28
|
// The date family is absent on purpose: its value space is a calendar, not a
|
|
30
29
|
// digit-run shape, so it goes through `isValidXsdDateTimeLiteral` (#3721).
|
|
31
30
|
'xs:duration': /^[-+]?P(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$/,
|
|
@@ -33,6 +32,12 @@ const XS_VALUE_REGEX = {
|
|
|
33
32
|
export function isValidLexicalForXsType(value, base) {
|
|
34
33
|
if (isXsdDateTimeBase(base))
|
|
35
34
|
return isValidXsdDateTimeLiteral(value, base);
|
|
35
|
+
// One xs:boolean table for the audit, the cast gate and `compareBoolean` (#7543).
|
|
36
|
+
// `String(value)`: the regex this replaces read the value as text, as the other
|
|
37
|
+
// bases' regexes still do, so a value that is not a string (a number 1 that a
|
|
38
|
+
// caller put into a parsed document) keeps the answer it had.
|
|
39
|
+
if (base === 'xs:boolean')
|
|
40
|
+
return xsdBooleanValue(String(value)) !== undefined;
|
|
36
41
|
const rx = XS_VALUE_REGEX[base];
|
|
37
42
|
if (!rx)
|
|
38
43
|
return true; // base we don't recognise → don't fabricate errors
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xsd-lexical.js","sourceRoot":"","sources":["../../src/constraints/xsd-lexical.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;GAOG;AAEH,OAAO,EAAE,oBAAoB,EAAE,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AAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IAClE,CAAC;IACD,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ifc-lite/ids",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.5",
|
|
4
4
|
"description": "IDS (Information Delivery Specification) support for IFC-Lite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"@xmldom/xmldom": "^0.9.12",
|
|
21
21
|
"@ifc-lite/codegen": "1.18.1",
|
|
22
22
|
"@ifc-lite/data": "6.2.0",
|
|
23
|
-
"@ifc-lite/encoding": "2.3.0",
|
|
24
23
|
"@ifc-lite/parser": "9.5.0",
|
|
25
|
-
"@ifc-lite/regex-guard": "0.3.0"
|
|
24
|
+
"@ifc-lite/regex-guard": "0.3.0",
|
|
25
|
+
"@ifc-lite/encoding": "2.3.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"happy-dom": "^20.14.6",
|