@ifc-lite/ids 1.14.10 → 1.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -44
- package/dist/audit/coherence/index.d.ts +12 -0
- package/dist/audit/coherence/index.d.ts.map +1 -0
- package/dist/audit/coherence/index.js +392 -0
- package/dist/audit/coherence/index.js.map +1 -0
- package/dist/audit/coherence/regex.d.ts +57 -0
- package/dist/audit/coherence/regex.d.ts.map +1 -0
- package/dist/audit/coherence/regex.js +111 -0
- package/dist/audit/coherence/regex.js.map +1 -0
- package/dist/audit/ifc-schema/index.d.ts +4 -0
- package/dist/audit/ifc-schema/index.d.ts.map +1 -0
- package/dist/audit/ifc-schema/index.js +637 -0
- package/dist/audit/ifc-schema/index.js.map +1 -0
- package/dist/audit/index.d.ts +37 -0
- package/dist/audit/index.d.ts.map +1 -0
- package/dist/audit/index.js +60 -0
- package/dist/audit/index.js.map +1 -0
- package/dist/audit/parser-shim.d.ts +13 -0
- package/dist/audit/parser-shim.d.ts.map +1 -0
- package/dist/audit/parser-shim.js +66 -0
- package/dist/audit/parser-shim.js.map +1 -0
- package/dist/audit/structural/index.d.ts +22 -0
- package/dist/audit/structural/index.d.ts.map +1 -0
- package/dist/audit/structural/index.js +441 -0
- package/dist/audit/structural/index.js.map +1 -0
- package/dist/audit/types.d.ts +91 -0
- package/dist/audit/types.d.ts.map +1 -0
- package/dist/audit/types.js +5 -0
- package/dist/audit/types.js.map +1 -0
- package/dist/audit/xsd/index.d.ts +13 -0
- package/dist/audit/xsd/index.d.ts.map +1 -0
- package/dist/audit/xsd/index.js +203 -0
- package/dist/audit/xsd/index.js.map +1 -0
- package/dist/bridge/classifications.d.ts +15 -0
- package/dist/bridge/classifications.d.ts.map +1 -0
- package/dist/bridge/classifications.js +114 -0
- package/dist/bridge/classifications.js.map +1 -0
- package/dist/bridge/data-accessor.d.ts +16 -0
- package/dist/bridge/data-accessor.d.ts.map +1 -0
- package/dist/bridge/data-accessor.js +205 -0
- package/dist/bridge/data-accessor.js.map +1 -0
- package/dist/bridge/data-types.d.ts +11 -0
- package/dist/bridge/data-types.d.ts.map +1 -0
- package/dist/bridge/data-types.js +47 -0
- package/dist/bridge/data-types.js.map +1 -0
- package/dist/bridge/index.d.ts +17 -0
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/index.js +20 -0
- package/dist/bridge/index.js.map +1 -0
- package/dist/bridge/materials.d.ts +11 -0
- package/dist/bridge/materials.d.ts.map +1 -0
- package/dist/bridge/materials.js +68 -0
- package/dist/bridge/materials.js.map +1 -0
- package/dist/bridge/predefined-types.d.ts +19 -0
- package/dist/bridge/predefined-types.d.ts.map +1 -0
- package/dist/bridge/predefined-types.js +84 -0
- package/dist/bridge/predefined-types.js.map +1 -0
- package/dist/bridge/properties.d.ts +20 -0
- package/dist/bridge/properties.d.ts.map +1 -0
- package/dist/bridge/properties.js +168 -0
- package/dist/bridge/properties.js.map +1 -0
- package/dist/bridge/schema-version.d.ts +10 -0
- package/dist/bridge/schema-version.d.ts.map +1 -0
- package/dist/bridge/schema-version.js +25 -0
- package/dist/bridge/schema-version.js.map +1 -0
- package/dist/bridge/units.d.ts +18 -0
- package/dist/bridge/units.d.ts.map +1 -0
- package/dist/bridge/units.js +55 -0
- package/dist/bridge/units.js.map +1 -0
- package/dist/constraints/comparators.d.ts +32 -0
- package/dist/constraints/comparators.d.ts.map +1 -0
- package/dist/constraints/comparators.js +94 -0
- package/dist/constraints/comparators.js.map +1 -0
- package/dist/constraints/index.d.ts +11 -1
- package/dist/constraints/index.d.ts.map +1 -1
- package/dist/constraints/index.js +74 -58
- package/dist/constraints/index.js.map +1 -1
- package/dist/constraints/xsd-cast.d.ts +20 -0
- package/dist/constraints/xsd-cast.d.ts.map +1 -0
- package/dist/constraints/xsd-cast.js +89 -0
- package/dist/constraints/xsd-cast.js.map +1 -0
- package/dist/facets/attribute-facet.d.ts.map +1 -1
- package/dist/facets/attribute-facet.js +80 -12
- package/dist/facets/attribute-facet.js.map +1 -1
- package/dist/facets/classification-facet.d.ts.map +1 -1
- package/dist/facets/classification-facet.js +21 -2
- package/dist/facets/classification-facet.js.map +1 -1
- package/dist/facets/entity-facet.d.ts.map +1 -1
- package/dist/facets/entity-facet.js +59 -7
- package/dist/facets/entity-facet.js.map +1 -1
- package/dist/facets/partof-facet.d.ts.map +1 -1
- package/dist/facets/partof-facet.js +40 -8
- package/dist/facets/partof-facet.js.map +1 -1
- package/dist/facets/property-facet.d.ts.map +1 -1
- package/dist/facets/property-facet.js +171 -55
- package/dist/facets/property-facet.js.map +1 -1
- package/dist/facets/test-helpers.d.ts +42 -0
- package/dist/facets/test-helpers.d.ts.map +1 -0
- package/dist/facets/test-helpers.js +106 -0
- package/dist/facets/test-helpers.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/parser/xml-parser.d.ts.map +1 -1
- package/dist/parser/xml-parser.js +198 -68
- package/dist/parser/xml-parser.js.map +1 -1
- package/dist/translation/locales/de.d.ts +1 -0
- package/dist/translation/locales/de.d.ts.map +1 -1
- package/dist/translation/locales/de.js +1 -0
- package/dist/translation/locales/de.js.map +1 -1
- package/dist/translation/locales/en.d.ts +1 -0
- package/dist/translation/locales/en.d.ts.map +1 -1
- package/dist/translation/locales/en.js +1 -0
- package/dist/translation/locales/en.js.map +1 -1
- package/dist/translation/locales/fr.d.ts +1 -0
- package/dist/translation/locales/fr.d.ts.map +1 -1
- package/dist/translation/locales/fr.js +1 -0
- package/dist/translation/locales/fr.js.map +1 -1
- package/dist/types.d.ts +116 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/validation/validator.js +49 -3
- package/dist/validation/validator.js.map +1 -1
- package/package.json +10 -3
|
@@ -0,0 +1,205 @@
|
|
|
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 { extractAllEntityAttributes, extractMaterialsOnDemand, } from '@ifc-lite/parser';
|
|
5
|
+
import { RelationshipType, getAttributeXsdTypes } from '@ifc-lite/data';
|
|
6
|
+
import { flattenMaterials } from './materials.js';
|
|
7
|
+
import { resolveClassifications } from './classifications.js';
|
|
8
|
+
import { collectAllPropertySets } from './properties.js';
|
|
9
|
+
import { resolveObjectType, resolveRawPredefinedType, } from './predefined-types.js';
|
|
10
|
+
import { narrowSchemaVersion } from './schema-version.js';
|
|
11
|
+
// Map IDS PartOf relations to the numeric RelationshipType enum the
|
|
12
|
+
// graph keys on. Passing strings here was a long-standing silent bug:
|
|
13
|
+
// `getRelated` matched nothing → every partOf check looked like
|
|
14
|
+
// "no parent" → fail-when-required, pass-when-prohibited.
|
|
15
|
+
const PARTOF_REL_MAP = {
|
|
16
|
+
IfcRelAggregates: RelationshipType.Aggregates,
|
|
17
|
+
IfcRelAssignsToGroup: RelationshipType.AssignsToGroup,
|
|
18
|
+
IfcRelContainedInSpatialStructure: RelationshipType.ContainsElements,
|
|
19
|
+
IfcRelNests: RelationshipType.Aggregates,
|
|
20
|
+
IfcRelVoidsElement: RelationshipType.VoidsElement,
|
|
21
|
+
IfcRelFillsElement: RelationshipType.FillsElement,
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Bridge an `IfcDataStore` (produced by `@ifc-lite/parser`) into the
|
|
25
|
+
* abstract `IFCDataAccessor` the IDS validator consumes. The single
|
|
26
|
+
* canonical translation — viewer, MCP server, and the corpus-parity
|
|
27
|
+
* harness all use this rather than re-implementing the projection.
|
|
28
|
+
*
|
|
29
|
+
* Mirrors upstream `IfcOpenShell/ifctester` semantics: classification
|
|
30
|
+
* sub-reference walking, IfcExternalReferenceRelationship for
|
|
31
|
+
* non-rooted resources, length unit conversion, predefined property-set
|
|
32
|
+
* unwrapping, schema-driven attribute XSD types, USERDEFINED predicate
|
|
33
|
+
* substitution, partOf transitivity, etc.
|
|
34
|
+
*/
|
|
35
|
+
export function createDataAccessor(store) {
|
|
36
|
+
function findAttributeValue(expressId, attributeName) {
|
|
37
|
+
const lower = attributeName.toLowerCase();
|
|
38
|
+
const all = extractAllEntityAttributes(store, expressId);
|
|
39
|
+
for (const a of all) {
|
|
40
|
+
if (a.name.toLowerCase() === lower)
|
|
41
|
+
return a.value;
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
const accessor = {
|
|
46
|
+
getEntityType(expressId) {
|
|
47
|
+
// The columnar entity table only summarises "interesting"
|
|
48
|
+
// entities (spatial, building elements, etc.); resource-level
|
|
49
|
+
// types resolve to `'Unknown'` there. Fall back to the raw
|
|
50
|
+
// type name from `entityIndex.byId` so applicability checks
|
|
51
|
+
// for those types still match.
|
|
52
|
+
const entityType = store.entities?.getTypeName?.(expressId);
|
|
53
|
+
if (entityType && entityType !== 'Unknown')
|
|
54
|
+
return entityType;
|
|
55
|
+
const byId = store.entityIndex?.byId;
|
|
56
|
+
if (!byId)
|
|
57
|
+
return undefined;
|
|
58
|
+
const entry = byId.get(expressId);
|
|
59
|
+
if (!entry)
|
|
60
|
+
return undefined;
|
|
61
|
+
return typeof entry === 'object' && 'type' in entry
|
|
62
|
+
? String(entry.type)
|
|
63
|
+
: undefined;
|
|
64
|
+
},
|
|
65
|
+
getEntityName(expressId) {
|
|
66
|
+
// Distinguish "slot truly absent" (`undefined`) from "slot
|
|
67
|
+
// explicitly empty" (`''`) — the IDS optional-attribute fixtures
|
|
68
|
+
// hinge on it. The columnar `entities.getName` shim returns `''`
|
|
69
|
+
// for either case, so we round-trip through the attribute
|
|
70
|
+
// extractor first to preserve the explicit empty string.
|
|
71
|
+
const fromAttr = findAttributeValue(expressId, 'Name');
|
|
72
|
+
if (fromAttr !== undefined && typeof fromAttr === 'string')
|
|
73
|
+
return fromAttr;
|
|
74
|
+
const n = store.entities?.getName?.(expressId);
|
|
75
|
+
return n || undefined;
|
|
76
|
+
},
|
|
77
|
+
getGlobalId(expressId) {
|
|
78
|
+
const fromAttr = findAttributeValue(expressId, 'GlobalId');
|
|
79
|
+
if (fromAttr !== undefined && typeof fromAttr === 'string')
|
|
80
|
+
return fromAttr;
|
|
81
|
+
const g = store.entities?.getGlobalId?.(expressId);
|
|
82
|
+
return g || undefined;
|
|
83
|
+
},
|
|
84
|
+
getDescription(expressId) {
|
|
85
|
+
const fromAttr = findAttributeValue(expressId, 'Description');
|
|
86
|
+
if (fromAttr !== undefined && typeof fromAttr === 'string')
|
|
87
|
+
return fromAttr;
|
|
88
|
+
const d = store.entities?.getDescription?.(expressId);
|
|
89
|
+
return d || undefined;
|
|
90
|
+
},
|
|
91
|
+
getAttributeNames(expressId) {
|
|
92
|
+
return extractAllEntityAttributes(store, expressId).map((a) => a.name);
|
|
93
|
+
},
|
|
94
|
+
getAttributeXsdTypes(expressId, attrName) {
|
|
95
|
+
// Resolve the entity's IFC type so the schema lookup scopes to
|
|
96
|
+
// the correct slot — the same attribute can carry different XSD
|
|
97
|
+
// types on different entities.
|
|
98
|
+
const entityType = accessor.getEntityType(expressId);
|
|
99
|
+
if (!entityType)
|
|
100
|
+
return undefined;
|
|
101
|
+
return getAttributeXsdTypes(narrowSchemaVersion(store.schemaVersion), entityType, attrName);
|
|
102
|
+
},
|
|
103
|
+
getPredefinedTypeRaw(expressId) {
|
|
104
|
+
return resolveRawPredefinedType(store, expressId);
|
|
105
|
+
},
|
|
106
|
+
getObjectType(expressId) {
|
|
107
|
+
return resolveObjectType(store, expressId, () => store.entities?.getObjectType?.(expressId));
|
|
108
|
+
},
|
|
109
|
+
getEntitiesByType(typeName) {
|
|
110
|
+
const ids = store.entityIndex?.byType?.get(typeName.toUpperCase());
|
|
111
|
+
return ids ? Array.from(ids) : [];
|
|
112
|
+
},
|
|
113
|
+
getAllEntityIds() {
|
|
114
|
+
const byId = store.entityIndex?.byId;
|
|
115
|
+
return byId ? Array.from(byId.keys()) : [];
|
|
116
|
+
},
|
|
117
|
+
getPropertyValue(expressId, propertySetName, propertyName) {
|
|
118
|
+
const psetLower = propertySetName.toLowerCase();
|
|
119
|
+
const propLower = propertyName.toLowerCase();
|
|
120
|
+
const all = collectAllPropertySets(store, expressId);
|
|
121
|
+
for (const pset of all) {
|
|
122
|
+
if (pset.name.toLowerCase() !== psetLower)
|
|
123
|
+
continue;
|
|
124
|
+
for (const prop of pset.properties || []) {
|
|
125
|
+
if (prop.name.toLowerCase() !== propLower)
|
|
126
|
+
continue;
|
|
127
|
+
return {
|
|
128
|
+
value: prop.value,
|
|
129
|
+
dataType: prop.dataType,
|
|
130
|
+
propertySetName: pset.name,
|
|
131
|
+
propertyName: prop.name,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return undefined;
|
|
136
|
+
},
|
|
137
|
+
getPropertySets(expressId) {
|
|
138
|
+
return collectAllPropertySets(store, expressId);
|
|
139
|
+
},
|
|
140
|
+
getClassifications(expressId) {
|
|
141
|
+
return resolveClassifications(store, expressId);
|
|
142
|
+
},
|
|
143
|
+
getMaterials(expressId) {
|
|
144
|
+
return flattenMaterials(extractMaterialsOnDemand(store, expressId));
|
|
145
|
+
},
|
|
146
|
+
getParent(expressId, relationType) {
|
|
147
|
+
const all = accessor.getAncestors(expressId, relationType);
|
|
148
|
+
return all.length > 0 ? all[0] : undefined;
|
|
149
|
+
},
|
|
150
|
+
getAncestors(expressId, relationType) {
|
|
151
|
+
const relationships = store.relationships;
|
|
152
|
+
if (!relationships?.getRelated)
|
|
153
|
+
return [];
|
|
154
|
+
const relType = PARTOF_REL_MAP[relationType];
|
|
155
|
+
if (relType === undefined)
|
|
156
|
+
return [];
|
|
157
|
+
// BFS up the graph — IDS partOf is transitive, so any reachable
|
|
158
|
+
// ancestor counts.
|
|
159
|
+
const out = [];
|
|
160
|
+
const seen = new Set([expressId]);
|
|
161
|
+
const queue = [expressId];
|
|
162
|
+
while (queue.length > 0) {
|
|
163
|
+
const id = queue.shift();
|
|
164
|
+
const parents = relationships.getRelated(id, relType, 'inverse');
|
|
165
|
+
for (const parentId of parents || []) {
|
|
166
|
+
if (seen.has(parentId))
|
|
167
|
+
continue;
|
|
168
|
+
seen.add(parentId);
|
|
169
|
+
out.push({
|
|
170
|
+
expressId: parentId,
|
|
171
|
+
entityType: accessor.getEntityType(parentId) || 'Unknown',
|
|
172
|
+
predefinedType: accessor.getObjectType(parentId),
|
|
173
|
+
});
|
|
174
|
+
queue.push(parentId);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return out;
|
|
178
|
+
},
|
|
179
|
+
getAttribute(expressId, attributeName) {
|
|
180
|
+
const lowerName = attributeName.toLowerCase();
|
|
181
|
+
switch (lowerName) {
|
|
182
|
+
case 'name':
|
|
183
|
+
return accessor.getEntityName(expressId);
|
|
184
|
+
case 'description':
|
|
185
|
+
return accessor.getDescription(expressId);
|
|
186
|
+
case 'globalid':
|
|
187
|
+
return accessor.getGlobalId(expressId);
|
|
188
|
+
case 'objecttype':
|
|
189
|
+
case 'predefinedtype':
|
|
190
|
+
return accessor.getObjectType(expressId);
|
|
191
|
+
default: {
|
|
192
|
+
const fromExtract = findAttributeValue(expressId, attributeName);
|
|
193
|
+
if (fromExtract !== undefined)
|
|
194
|
+
return fromExtract;
|
|
195
|
+
const entities = store.entities;
|
|
196
|
+
return entities?.getAttribute
|
|
197
|
+
? entities.getAttribute(expressId, attributeName)
|
|
198
|
+
: undefined;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
return accessor;
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=data-accessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-accessor.js","sourceRoot":"","sources":["../../src/bridge/data-accessor.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAEL,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,kBAAkB,CA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|
|
2
|
+
* Map the parser's `PropertyValueType` enum (or string-tagged variant)
|
|
3
|
+
* to the IDS-side `IFC*` data-type token consumers compare against.
|
|
4
|
+
* IDS expects names like `IFCLABEL` / `IFCREAL` / `IFCBOOLEAN`; the
|
|
5
|
+
* parser surfaces shape-only enum values plus the underlying IFC
|
|
6
|
+
* measure name on the property record.
|
|
7
|
+
*/
|
|
8
|
+
export declare function idsDataTypeForProperty(type: number | string | undefined): string;
|
|
9
|
+
/** QuantityType enum → IDS measure name. */
|
|
10
|
+
export declare function idsDataTypeForQuantity(type: number): string;
|
|
11
|
+
//# sourceMappingURL=data-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-types.d.ts","sourceRoot":"","sources":["../../src/bridge/data-types.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAsBhF;AAED,4CAA4C;AAC5C,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAU3D"}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
* Map the parser's `PropertyValueType` enum (or string-tagged variant)
|
|
6
|
+
* to the IDS-side `IFC*` data-type token consumers compare against.
|
|
7
|
+
* IDS expects names like `IFCLABEL` / `IFCREAL` / `IFCBOOLEAN`; the
|
|
8
|
+
* parser surfaces shape-only enum values plus the underlying IFC
|
|
9
|
+
* measure name on the property record.
|
|
10
|
+
*/
|
|
11
|
+
export function idsDataTypeForProperty(type) {
|
|
12
|
+
if (typeof type === 'string') {
|
|
13
|
+
if (type.startsWith('IFC') || type.startsWith('Ifc'))
|
|
14
|
+
return type.toUpperCase();
|
|
15
|
+
return 'IFCLABEL';
|
|
16
|
+
}
|
|
17
|
+
// PropertyValueType enum from @ifc-lite/data:
|
|
18
|
+
// 0 String, 1 Real, 2 Integer, 3 Boolean, 4 Logical,
|
|
19
|
+
// 5 Label, 6 Identifier, 7 Text, 8 Enum, 9 Reference, 10 List.
|
|
20
|
+
switch (type) {
|
|
21
|
+
case 0: return 'IFCLABEL';
|
|
22
|
+
case 1: return 'IFCREAL';
|
|
23
|
+
case 2: return 'IFCINTEGER';
|
|
24
|
+
case 3: return 'IFCBOOLEAN';
|
|
25
|
+
case 4: return 'IFCLOGICAL';
|
|
26
|
+
case 5: return 'IFCLABEL';
|
|
27
|
+
case 6: return 'IFCIDENTIFIER';
|
|
28
|
+
case 7: return 'IFCTEXT';
|
|
29
|
+
case 8: return 'IFCLABEL';
|
|
30
|
+
case 9: return 'IFCIDENTIFIER';
|
|
31
|
+
case 10: return 'IFCLABEL';
|
|
32
|
+
default: return 'IFCLABEL';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** QuantityType enum → IDS measure name. */
|
|
36
|
+
export function idsDataTypeForQuantity(type) {
|
|
37
|
+
switch (type) {
|
|
38
|
+
case 0: return 'IFCLENGTHMEASURE';
|
|
39
|
+
case 1: return 'IFCAREAMEASURE';
|
|
40
|
+
case 2: return 'IFCVOLUMEMEASURE';
|
|
41
|
+
case 3: return 'IFCCOUNTMEASURE';
|
|
42
|
+
case 4: return 'IFCMASSMEASURE';
|
|
43
|
+
case 5: return 'IFCTIMEMEASURE';
|
|
44
|
+
default: return 'IFCLABEL';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=data-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-types.js","sourceRoot":"","sources":["../../src/bridge/data-types.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAiC;IACtE,IA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KAAK,CAAC,CAAC,CAAC,OAAO,gBAAgB,CAAC;QAChC,OAAO,CAAC,CAAC,OAAO,UAAU,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IDS data-store bridge.
|
|
3
|
+
*
|
|
4
|
+
* Builds an `IFCDataAccessor` (the abstract interface the IDS validator
|
|
5
|
+
* consumes) from an `IfcDataStore` produced by `@ifc-lite/parser`. This
|
|
6
|
+
* is the single canonical translation — viewer, MCP server, and the
|
|
7
|
+
* corpus-parity harness all consume it instead of re-implementing the
|
|
8
|
+
* same projection.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors upstream `IfcOpenShell/ifctester` semantics: classification
|
|
11
|
+
* sub-reference walking, IfcExternalReferenceRelationship for
|
|
12
|
+
* non-rooted resources, length unit conversion, predefined property-set
|
|
13
|
+
* unwrapping, schema-driven attribute XSD types, etc.
|
|
14
|
+
*/
|
|
15
|
+
export { createDataAccessor } from './data-accessor.js';
|
|
16
|
+
export { narrowSchemaVersion } from './schema-version.js';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bridge/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
* IDS data-store bridge.
|
|
6
|
+
*
|
|
7
|
+
* Builds an `IFCDataAccessor` (the abstract interface the IDS validator
|
|
8
|
+
* consumes) from an `IfcDataStore` produced by `@ifc-lite/parser`. This
|
|
9
|
+
* is the single canonical translation — viewer, MCP server, and the
|
|
10
|
+
* corpus-parity harness all consume it instead of re-implementing the
|
|
11
|
+
* same projection.
|
|
12
|
+
*
|
|
13
|
+
* Mirrors upstream `IfcOpenShell/ifctester` semantics: classification
|
|
14
|
+
* sub-reference walking, IfcExternalReferenceRelationship for
|
|
15
|
+
* non-rooted resources, length unit conversion, predefined property-set
|
|
16
|
+
* unwrapping, schema-driven attribute XSD types, etc.
|
|
17
|
+
*/
|
|
18
|
+
export { createDataAccessor } from './data-accessor.js';
|
|
19
|
+
export { narrowSchemaVersion } from './schema-version.js';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bridge/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { extractMaterialsOnDemand } from '@ifc-lite/parser';
|
|
2
|
+
import type { MaterialInfo } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Flatten the parser's hierarchical material graph into the flat
|
|
5
|
+
* `{name, category}[]` array the IDS validator consumes. Surfaces
|
|
6
|
+
* every name AND category as a candidate match — IDS material
|
|
7
|
+
* `<value>` fixtures pass when ANY surface matches the constraint, so
|
|
8
|
+
* we proactively duplicate categories under their own entries.
|
|
9
|
+
*/
|
|
10
|
+
export declare function flattenMaterials(matInfo: ReturnType<typeof extractMaterialsOnDemand>): MaterialInfo[];
|
|
11
|
+
//# sourceMappingURL=materials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materials.d.ts","sourceRoot":"","sources":["../../src/bridge/materials.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,GACnD,YAAY,EAAE,CAwDhB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
* Flatten the parser's hierarchical material graph into the flat
|
|
6
|
+
* `{name, category}[]` array the IDS validator consumes. Surfaces
|
|
7
|
+
* every name AND category as a candidate match — IDS material
|
|
8
|
+
* `<value>` fixtures pass when ANY surface matches the constraint, so
|
|
9
|
+
* we proactively duplicate categories under their own entries.
|
|
10
|
+
*/
|
|
11
|
+
export function flattenMaterials(matInfo) {
|
|
12
|
+
if (!matInfo)
|
|
13
|
+
return [];
|
|
14
|
+
const out = [];
|
|
15
|
+
const push = (name, category) => {
|
|
16
|
+
if (!name)
|
|
17
|
+
return;
|
|
18
|
+
out.push({ name, category });
|
|
19
|
+
};
|
|
20
|
+
switch (matInfo.type) {
|
|
21
|
+
case 'Material':
|
|
22
|
+
push(matInfo.name, matInfo.category);
|
|
23
|
+
if (matInfo.category)
|
|
24
|
+
push(matInfo.category, matInfo.category);
|
|
25
|
+
break;
|
|
26
|
+
case 'MaterialList':
|
|
27
|
+
for (const m of matInfo.materials || []) {
|
|
28
|
+
if (typeof m === 'string') {
|
|
29
|
+
push(m);
|
|
30
|
+
}
|
|
31
|
+
else if (m && typeof m === 'object') {
|
|
32
|
+
push(m.name, m.category);
|
|
33
|
+
if (m.category)
|
|
34
|
+
push(m.category, m.category);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
break;
|
|
38
|
+
case 'MaterialLayerSet':
|
|
39
|
+
push(matInfo.name);
|
|
40
|
+
for (const layer of matInfo.layers || []) {
|
|
41
|
+
push(layer.materialName, layer.category);
|
|
42
|
+
push(layer.name, layer.category);
|
|
43
|
+
if (layer.materialCategory)
|
|
44
|
+
push(layer.materialCategory, layer.materialCategory);
|
|
45
|
+
}
|
|
46
|
+
break;
|
|
47
|
+
case 'MaterialConstituentSet':
|
|
48
|
+
push(matInfo.name);
|
|
49
|
+
for (const c of matInfo.constituents || []) {
|
|
50
|
+
push(c.materialName, c.category);
|
|
51
|
+
push(c.name, c.category);
|
|
52
|
+
if (c.materialCategory)
|
|
53
|
+
push(c.materialCategory, c.materialCategory);
|
|
54
|
+
}
|
|
55
|
+
break;
|
|
56
|
+
case 'MaterialProfileSet':
|
|
57
|
+
push(matInfo.name);
|
|
58
|
+
for (const p of matInfo.profiles || []) {
|
|
59
|
+
push(p.materialName, p.category);
|
|
60
|
+
push(p.name, p.category);
|
|
61
|
+
if (p.materialCategory)
|
|
62
|
+
push(p.materialCategory, p.materialCategory);
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=materials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materials.js","sourceRoot":"","sources":["../../src/bridge/materials.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAK/D;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAoD;IAEpD,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,MAAM,GAAG,GAAmB,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,CAAC,IAAa,EAAE,QAAiB,EAAQ,EAAE;QACtD,IAAI,CAAC,IAAI;YAAE,OAAO;QAClB,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC/B,CA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,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC;gBAC3C,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;gBACjC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;gBACzB,IAAI,CAAC,CAAC,gBAAgB;oBACpB,IAAI,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,gBAAgB,CAAC,CAAC;YACjD,CAAC;YACD,MAAM;QAER,KAAK,oBAAoB;YACvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACnB,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;gBACvC,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;gBACjC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;gBACzB,IAAI,CAAC,CAAC,gBAAgB;oBACpB,IAAI,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,gBAAgB,CAAC,CAAC;YACjD,CAAC;YACD,MAAM;IACV,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type IfcDataStore } from '@ifc-lite/parser';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the raw `PredefinedType` enum token (e.g. `USERDEFINED`,
|
|
4
|
+
* `NOTDEFINED`, `BEAM`) for an entity, walking through
|
|
5
|
+
* `IfcRelDefinesByType` if the instance has none of its own.
|
|
6
|
+
*
|
|
7
|
+
* Returns `undefined` when neither the instance nor its defining type
|
|
8
|
+
* carry a predefined-type slot.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveRawPredefinedType(store: IfcDataStore, expressId: number): string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Resolve the IDS-side "object type" — either the predefined enum
|
|
13
|
+
* value, or (when `USERDEFINED`) the user-defined name from the
|
|
14
|
+
* adjacent `ElementType` / `ObjectType` / `ProcessType` /
|
|
15
|
+
* `ResourceType` slot. Walks `IfcRelDefinesByType` if the instance
|
|
16
|
+
* carries neither.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveObjectType(store: IfcDataStore, expressId: number, fallbackObjectType: () => string | undefined): string | undefined;
|
|
19
|
+
//# sourceMappingURL=predefined-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predefined-types.d.ts","sourceRoot":"","sources":["../../src/bridge/predefined-types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAA8B,MAAM,kBAAkB,CAAC;AAGjF;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAwBpB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,MAAM,MAAM,GAAG,SAAS,GAC3C,MAAM,GAAG,SAAS,CA2DpB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
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 { extractAllEntityAttributes } from '@ifc-lite/parser';
|
|
5
|
+
import { RelationshipType } from '@ifc-lite/data';
|
|
6
|
+
/**
|
|
7
|
+
* Resolve the raw `PredefinedType` enum token (e.g. `USERDEFINED`,
|
|
8
|
+
* `NOTDEFINED`, `BEAM`) for an entity, walking through
|
|
9
|
+
* `IfcRelDefinesByType` if the instance has none of its own.
|
|
10
|
+
*
|
|
11
|
+
* Returns `undefined` when neither the instance nor its defining type
|
|
12
|
+
* carry a predefined-type slot.
|
|
13
|
+
*/
|
|
14
|
+
export function resolveRawPredefinedType(store, expressId) {
|
|
15
|
+
const allAttrs = extractAllEntityAttributes(store, expressId);
|
|
16
|
+
const pdt = allAttrs.find((a) => a.name === 'PredefinedType');
|
|
17
|
+
const pdtValue = typeof pdt?.value === 'string' && pdt.value ? pdt.value : undefined;
|
|
18
|
+
if (pdtValue && pdtValue !== 'NOTDEFINED')
|
|
19
|
+
return pdtValue;
|
|
20
|
+
// Inherit from the defining type (IfcRelDefinesByType).
|
|
21
|
+
const typeIds = store.relationships?.getRelated?.(expressId, RelationshipType.DefinesByType, 'inverse') || [];
|
|
22
|
+
for (const typeId of typeIds) {
|
|
23
|
+
const typeAttrs = extractAllEntityAttributes(store, typeId);
|
|
24
|
+
const typePdt = typeAttrs.find((a) => a.name === 'PredefinedType');
|
|
25
|
+
const typeVal = typeof typePdt?.value === 'string' && typePdt.value
|
|
26
|
+
? typePdt.value
|
|
27
|
+
: undefined;
|
|
28
|
+
if (typeVal && typeVal !== 'NOTDEFINED')
|
|
29
|
+
return typeVal;
|
|
30
|
+
}
|
|
31
|
+
return pdtValue;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolve the IDS-side "object type" — either the predefined enum
|
|
35
|
+
* value, or (when `USERDEFINED`) the user-defined name from the
|
|
36
|
+
* adjacent `ElementType` / `ObjectType` / `ProcessType` /
|
|
37
|
+
* `ResourceType` slot. Walks `IfcRelDefinesByType` if the instance
|
|
38
|
+
* carries neither.
|
|
39
|
+
*/
|
|
40
|
+
export function resolveObjectType(store, expressId, fallbackObjectType) {
|
|
41
|
+
const allAttrs = extractAllEntityAttributes(store, expressId);
|
|
42
|
+
const pdt = allAttrs.find((a) => a.name === 'PredefinedType');
|
|
43
|
+
const pdtValue = pdt?.value;
|
|
44
|
+
if (typeof pdtValue === 'string' &&
|
|
45
|
+
pdtValue &&
|
|
46
|
+
pdtValue !== 'NOTDEFINED' &&
|
|
47
|
+
pdtValue !== 'USERDEFINED') {
|
|
48
|
+
return pdtValue;
|
|
49
|
+
}
|
|
50
|
+
const userSlot = allAttrs.find((a) => a.name === 'ElementType') ||
|
|
51
|
+
allAttrs.find((a) => a.name === 'ObjectType') ||
|
|
52
|
+
allAttrs.find((a) => a.name === 'ProcessType') ||
|
|
53
|
+
allAttrs.find((a) => a.name === 'ResourceType');
|
|
54
|
+
if (userSlot && typeof userSlot.value === 'string' && userSlot.value) {
|
|
55
|
+
return userSlot.value;
|
|
56
|
+
}
|
|
57
|
+
// Inherit from defining type when the instance has neither.
|
|
58
|
+
const typeIds = store.relationships?.getRelated?.(expressId, RelationshipType.DefinesByType, 'inverse') || [];
|
|
59
|
+
for (const typeId of typeIds) {
|
|
60
|
+
const typeAttrs = extractAllEntityAttributes(store, typeId);
|
|
61
|
+
const typePdt = typeAttrs.find((a) => a.name === 'PredefinedType');
|
|
62
|
+
const typePdtValue = typePdt?.value;
|
|
63
|
+
if (typeof typePdtValue === 'string' &&
|
|
64
|
+
typePdtValue &&
|
|
65
|
+
typePdtValue !== 'NOTDEFINED' &&
|
|
66
|
+
typePdtValue !== 'USERDEFINED') {
|
|
67
|
+
return typePdtValue;
|
|
68
|
+
}
|
|
69
|
+
const typeUserSlot = typeAttrs.find((a) => a.name === 'ElementType') ||
|
|
70
|
+
typeAttrs.find((a) => a.name === 'ObjectType') ||
|
|
71
|
+
typeAttrs.find((a) => a.name === 'ProcessType') ||
|
|
72
|
+
typeAttrs.find((a) => a.name === 'ResourceType');
|
|
73
|
+
if (typeUserSlot &&
|
|
74
|
+
typeof typeUserSlot.value === 'string' &&
|
|
75
|
+
typeUserSlot.value) {
|
|
76
|
+
return typeUserSlot.value;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const fallback = fallbackObjectType();
|
|
80
|
+
if (fallback)
|
|
81
|
+
return fallback;
|
|
82
|
+
return typeof pdtValue === 'string' && pdtValue ? pdtValue : undefined;
|
|
83
|
+
}
|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CAAC;IAC9B,OAAO,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type IfcDataStore } from '@ifc-lite/parser';
|
|
2
|
+
import type { PropertySetInfo } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* IDS treats `IfcElementQuantity` (Qto_*) and `IfcPropertySet` (Pset_*)
|
|
5
|
+
* uniformly — both surface as "property sets" with named values. The
|
|
6
|
+
* parser stores them in separate columnar tables, so we merge here.
|
|
7
|
+
*
|
|
8
|
+
* Surfaces three sources:
|
|
9
|
+
* 1. The instance's own property sets (IfcPropertySet via
|
|
10
|
+
* IfcRelDefinesByProperties).
|
|
11
|
+
* 2. Predefined property sets (IfcDoorPanelProperties etc.) where
|
|
12
|
+
* the entity's schema-defined attributes act as property names.
|
|
13
|
+
* 3. Inherited property sets from `IfcRelDefinesByType`.
|
|
14
|
+
*
|
|
15
|
+
* Length-typed properties are converted to base SI units per the
|
|
16
|
+
* project's `lengthUnitScale` so IDS literals (always in metres)
|
|
17
|
+
* compare correctly.
|
|
18
|
+
*/
|
|
19
|
+
export declare function collectAllPropertySets(store: IfcDataStore, expressId: number): PropertySetInfo[];
|
|
20
|
+
//# sourceMappingURL=properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/bridge/properties.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,YAAY,EAMlB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAYnD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,GAChB,eAAe,EAAE,CAanB"}
|