@ifc-lite/ids 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/README.md +76 -0
- package/dist/constraints/index.d.ts +17 -0
- package/dist/constraints/index.d.ts.map +1 -0
- package/dist/constraints/index.js +226 -0
- package/dist/constraints/index.js.map +1 -0
- package/dist/facets/attribute-facet.d.ts +10 -0
- package/dist/facets/attribute-facet.d.ts.map +1 -0
- package/dist/facets/attribute-facet.js +107 -0
- package/dist/facets/attribute-facet.js.map +1 -0
- package/dist/facets/classification-facet.d.ts +10 -0
- package/dist/facets/classification-facet.d.ts.map +1 -0
- package/dist/facets/classification-facet.js +98 -0
- package/dist/facets/classification-facet.js.map +1 -0
- package/dist/facets/entity-facet.d.ts +18 -0
- package/dist/facets/entity-facet.d.ts.map +1 -0
- package/dist/facets/entity-facet.js +116 -0
- package/dist/facets/entity-facet.js.map +1 -0
- package/dist/facets/index.d.ts +31 -0
- package/dist/facets/index.d.ts.map +1 -0
- package/dist/facets/index.js +57 -0
- package/dist/facets/index.js.map +1 -0
- package/dist/facets/material-facet.d.ts +10 -0
- package/dist/facets/material-facet.d.ts.map +1 -0
- package/dist/facets/material-facet.js +67 -0
- package/dist/facets/material-facet.js.map +1 -0
- package/dist/facets/partof-facet.d.ts +10 -0
- package/dist/facets/partof-facet.d.ts.map +1 -0
- package/dist/facets/partof-facet.js +112 -0
- package/dist/facets/partof-facet.js.map +1 -0
- package/dist/facets/property-facet.d.ts +10 -0
- package/dist/facets/property-facet.d.ts.map +1 -0
- package/dist/facets/property-facet.js +156 -0
- package/dist/facets/property-facet.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/xml-parser.d.ts +15 -0
- package/dist/parser/xml-parser.d.ts.map +1 -0
- package/dist/parser/xml-parser.js +486 -0
- package/dist/parser/xml-parser.js.map +1 -0
- package/dist/translation/index.d.ts +3 -0
- package/dist/translation/index.d.ts.map +1 -0
- package/dist/translation/index.js +6 -0
- package/dist/translation/index.js.map +1 -0
- package/dist/translation/locales/de.d.ts +189 -0
- package/dist/translation/locales/de.d.ts.map +1 -0
- package/dist/translation/locales/de.js +226 -0
- package/dist/translation/locales/de.js.map +1 -0
- package/dist/translation/locales/en.d.ts +190 -0
- package/dist/translation/locales/en.d.ts.map +1 -0
- package/dist/translation/locales/en.js +226 -0
- package/dist/translation/locales/en.js.map +1 -0
- package/dist/translation/locales/fr.d.ts +189 -0
- package/dist/translation/locales/fr.d.ts.map +1 -0
- package/dist/translation/locales/fr.js +226 -0
- package/dist/translation/locales/fr.js.map +1 -0
- package/dist/translation/locales/index.d.ts +4 -0
- package/dist/translation/locales/index.d.ts.map +1 -0
- package/dist/translation/locales/index.js +7 -0
- package/dist/translation/locales/index.js.map +1 -0
- package/dist/translation/service.d.ts +62 -0
- package/dist/translation/service.d.ts.map +1 -0
- package/dist/translation/service.js +569 -0
- package/dist/translation/service.js.map +1 -0
- package/dist/types.d.ts +407 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/validation/validator.d.ts +9 -0
- package/dist/validation/validator.d.ts.map +1 -0
- package/dist/validation/validator.js +431 -0
- package/dist/validation/validator.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,112 @@
|
|
|
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 { matchConstraint, formatConstraint } from '../constraints/index.js';
|
|
5
|
+
/** Human-readable relation names */
|
|
6
|
+
const RELATION_NAMES = {
|
|
7
|
+
IfcRelAggregates: 'aggregated in',
|
|
8
|
+
IfcRelContainedInSpatialStructure: 'contained in',
|
|
9
|
+
IfcRelNests: 'nested in',
|
|
10
|
+
IfcRelVoidsElement: 'voiding',
|
|
11
|
+
IfcRelFillsElement: 'filling',
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Check if an entity matches a partOf facet
|
|
15
|
+
*/
|
|
16
|
+
export function checkPartOfFacet(facet, expressId, accessor) {
|
|
17
|
+
// Get parent via the specified relationship
|
|
18
|
+
const parent = accessor.getParent(expressId, facet.relation);
|
|
19
|
+
if (!parent) {
|
|
20
|
+
const relationName = RELATION_NAMES[facet.relation] || facet.relation;
|
|
21
|
+
const expectedEntity = facet.entity
|
|
22
|
+
? formatConstraint(facet.entity.name)
|
|
23
|
+
: 'any entity';
|
|
24
|
+
return {
|
|
25
|
+
passed: false,
|
|
26
|
+
actualValue: '(no parent)',
|
|
27
|
+
expectedValue: `${relationName} ${expectedEntity}`,
|
|
28
|
+
failure: {
|
|
29
|
+
type: 'PARTOF_RELATION_MISSING',
|
|
30
|
+
field: facet.relation,
|
|
31
|
+
expected: `${relationName} ${expectedEntity}`,
|
|
32
|
+
context: {
|
|
33
|
+
relation: facet.relation,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
// If no entity constraint, just check if relationship exists
|
|
39
|
+
if (!facet.entity) {
|
|
40
|
+
const relationName = RELATION_NAMES[facet.relation] || facet.relation;
|
|
41
|
+
return {
|
|
42
|
+
passed: true,
|
|
43
|
+
actualValue: `${relationName} ${parent.entityType}`,
|
|
44
|
+
expectedValue: `${relationName} any entity`,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
// Check parent entity type
|
|
48
|
+
if (!matchConstraint(facet.entity.name, parent.entityType)) {
|
|
49
|
+
const relationName = RELATION_NAMES[facet.relation] || facet.relation;
|
|
50
|
+
return {
|
|
51
|
+
passed: false,
|
|
52
|
+
actualValue: `${relationName} ${parent.entityType}`,
|
|
53
|
+
expectedValue: `${relationName} ${formatConstraint(facet.entity.name)}`,
|
|
54
|
+
failure: {
|
|
55
|
+
type: 'PARTOF_ENTITY_MISMATCH',
|
|
56
|
+
field: 'entity',
|
|
57
|
+
actual: parent.entityType,
|
|
58
|
+
expected: formatConstraint(facet.entity.name),
|
|
59
|
+
context: {
|
|
60
|
+
relation: facet.relation,
|
|
61
|
+
parentId: String(parent.expressId),
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
// Check parent predefined type if specified
|
|
67
|
+
if (facet.entity.predefinedType) {
|
|
68
|
+
if (!parent.predefinedType) {
|
|
69
|
+
return {
|
|
70
|
+
passed: false,
|
|
71
|
+
actualValue: `${parent.entityType} (no predefinedType)`,
|
|
72
|
+
expectedValue: `${formatConstraint(facet.entity.name)} with predefinedType ${formatConstraint(facet.entity.predefinedType)}`,
|
|
73
|
+
failure: {
|
|
74
|
+
type: 'PARTOF_ENTITY_MISMATCH',
|
|
75
|
+
field: 'predefinedType',
|
|
76
|
+
expected: formatConstraint(facet.entity.predefinedType),
|
|
77
|
+
context: {
|
|
78
|
+
relation: facet.relation,
|
|
79
|
+
parentType: parent.entityType,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (!matchConstraint(facet.entity.predefinedType, parent.predefinedType)) {
|
|
85
|
+
return {
|
|
86
|
+
passed: false,
|
|
87
|
+
actualValue: `${parent.entityType}[${parent.predefinedType}]`,
|
|
88
|
+
expectedValue: `${formatConstraint(facet.entity.name)}[${formatConstraint(facet.entity.predefinedType)}]`,
|
|
89
|
+
failure: {
|
|
90
|
+
type: 'PARTOF_ENTITY_MISMATCH',
|
|
91
|
+
field: 'predefinedType',
|
|
92
|
+
actual: parent.predefinedType,
|
|
93
|
+
expected: formatConstraint(facet.entity.predefinedType),
|
|
94
|
+
context: {
|
|
95
|
+
relation: facet.relation,
|
|
96
|
+
parentType: parent.entityType,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const relationName = RELATION_NAMES[facet.relation] || facet.relation;
|
|
103
|
+
const parentDesc = parent.predefinedType
|
|
104
|
+
? `${parent.entityType}[${parent.predefinedType}]`
|
|
105
|
+
: parent.entityType;
|
|
106
|
+
return {
|
|
107
|
+
passed: true,
|
|
108
|
+
actualValue: `${relationName} ${parentDesc}`,
|
|
109
|
+
expectedValue: `${relationName} ${formatConstraint(facet.entity.name)}`,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=partof-facet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partof-facet.js","sourceRoot":"","sources":["../../src/facets/partof-facet.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAY/D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE5E,oCAAoC;AACpC,MAAM,cAAc,GAAmC;IACrD,gBAAgB,EAAE,eAAe;IACjC,iCAAiC,EAAE,cAAc;IACjD,WAAW,EAAE,WAAW;IACxB,kBAAkB,EAAE,SAAS;IAC7B,kBAAkB,EAAE,SAAS;CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAqB,EACrB,SAAiB,EACjB,QAAyB;IAEzB,4CAA4C;IAC5C,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAE7D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,YAAY,GAAG,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC;QACtE,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM;YACjC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;YACrC,CAAC,CAAC,YAAY,CAAC;QAEjB,OAAO;YACL,MAAM,EAAE,KAAK;YACb,WAAW,EAAE,aAAa;YAC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c,CAAC;oBACvD,OAAO,EAAE;wBACP,QAAQ,EAAE,KAAK,CAAC,QAAQ;wBACxB,UAAU,EAAE,MAAM,CAAC,UAAU;qBAC9B;iBACF;aACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,YAAY,GAAG,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC;IACtE,MAAM,UAAU,GAAG,MAAM,CAAC,cAAc;QACtC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,cAAc,GAAG;QAClD,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;IAEtB,OAAO;QACL,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,GAAG,YAAY,IAAI,UAAU,EAAE;QAC5C,aAAa,EAAE,GAAG,YAAY,IAAI,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;KACxE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Property facet checker
|
|
3
|
+
*/
|
|
4
|
+
import type { IDSPropertyFacet, IFCDataAccessor } from '../types.js';
|
|
5
|
+
import type { FacetCheckResult } from './index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Check if an entity matches a property facet
|
|
8
|
+
*/
|
|
9
|
+
export declare function checkPropertyFacet(facet: IDSPropertyFacet, expressId: number, accessor: IFCDataAccessor): FacetCheckResult;
|
|
10
|
+
//# sourceMappingURL=property-facet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-facet.d.ts","sourceRoot":"","sources":["../../src/facets/property-facet.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,gBAAgB,EACvB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,eAAe,GACxB,gBAAgB,CAiElB"}
|
|
@@ -0,0 +1,156 @@
|
|
|
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 { matchConstraint, formatConstraint } from '../constraints/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Check if an entity matches a property facet
|
|
7
|
+
*/
|
|
8
|
+
export function checkPropertyFacet(facet, expressId, accessor) {
|
|
9
|
+
// Get all property sets for the entity
|
|
10
|
+
const propertySets = accessor.getPropertySets(expressId);
|
|
11
|
+
if (propertySets.length === 0) {
|
|
12
|
+
return {
|
|
13
|
+
passed: false,
|
|
14
|
+
expectedValue: `property "${formatConstraint(facet.baseName)}" in "${formatConstraint(facet.propertySet)}"`,
|
|
15
|
+
failure: {
|
|
16
|
+
type: 'PSET_MISSING',
|
|
17
|
+
field: formatConstraint(facet.propertySet),
|
|
18
|
+
expected: formatConstraint(facet.propertySet),
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
// Find matching property sets
|
|
23
|
+
const matchingPsets = propertySets.filter((pset) => matchConstraint(facet.propertySet, pset.name));
|
|
24
|
+
if (matchingPsets.length === 0) {
|
|
25
|
+
const availablePsets = propertySets.map((p) => p.name).join(', ');
|
|
26
|
+
return {
|
|
27
|
+
passed: false,
|
|
28
|
+
actualValue: availablePsets || '(none)',
|
|
29
|
+
expectedValue: formatConstraint(facet.propertySet),
|
|
30
|
+
failure: {
|
|
31
|
+
type: 'PSET_MISSING',
|
|
32
|
+
field: 'propertySet',
|
|
33
|
+
actual: availablePsets,
|
|
34
|
+
expected: formatConstraint(facet.propertySet),
|
|
35
|
+
context: { availablePsets },
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
// Check each matching property set for the property
|
|
40
|
+
for (const pset of matchingPsets) {
|
|
41
|
+
const result = checkPropertyInPset(facet, pset);
|
|
42
|
+
if (result.passed) {
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// Property not found in any matching pset
|
|
47
|
+
const psetNames = matchingPsets.map((p) => p.name).join(', ');
|
|
48
|
+
const availableProps = matchingPsets
|
|
49
|
+
.flatMap((pset) => pset.properties.map((p) => `${pset.name}.${p.name}`))
|
|
50
|
+
.join(', ');
|
|
51
|
+
return {
|
|
52
|
+
passed: false,
|
|
53
|
+
actualValue: availableProps || '(none)',
|
|
54
|
+
expectedValue: `${formatConstraint(facet.propertySet)}.${formatConstraint(facet.baseName)}`,
|
|
55
|
+
failure: {
|
|
56
|
+
type: 'PROPERTY_MISSING',
|
|
57
|
+
field: formatConstraint(facet.baseName),
|
|
58
|
+
expected: formatConstraint(facet.baseName),
|
|
59
|
+
context: {
|
|
60
|
+
propertySet: psetNames,
|
|
61
|
+
availableProperties: availableProps,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Check a property within a specific property set
|
|
68
|
+
*/
|
|
69
|
+
function checkPropertyInPset(facet, pset) {
|
|
70
|
+
// Find matching properties
|
|
71
|
+
const matchingProps = pset.properties.filter((prop) => matchConstraint(facet.baseName, prop.name));
|
|
72
|
+
if (matchingProps.length === 0) {
|
|
73
|
+
return {
|
|
74
|
+
passed: false,
|
|
75
|
+
failure: {
|
|
76
|
+
type: 'PROPERTY_MISSING',
|
|
77
|
+
field: formatConstraint(facet.baseName),
|
|
78
|
+
expected: formatConstraint(facet.baseName),
|
|
79
|
+
context: {
|
|
80
|
+
propertySet: pset.name,
|
|
81
|
+
availableProperties: pset.properties.map((p) => p.name).join(', '),
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
// Check each matching property
|
|
87
|
+
for (const prop of matchingProps) {
|
|
88
|
+
// Check data type if specified
|
|
89
|
+
if (facet.dataType) {
|
|
90
|
+
if (!matchConstraint(facet.dataType, prop.dataType)) {
|
|
91
|
+
return {
|
|
92
|
+
passed: false,
|
|
93
|
+
actualValue: `${pset.name}.${prop.name} (${prop.dataType})`,
|
|
94
|
+
expectedValue: `dataType ${formatConstraint(facet.dataType)}`,
|
|
95
|
+
failure: {
|
|
96
|
+
type: 'PROPERTY_DATATYPE_MISMATCH',
|
|
97
|
+
field: `${pset.name}.${prop.name}`,
|
|
98
|
+
actual: prop.dataType,
|
|
99
|
+
expected: formatConstraint(facet.dataType),
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Check value if specified
|
|
105
|
+
if (facet.value) {
|
|
106
|
+
const propValue = prop.value;
|
|
107
|
+
if (propValue === null || propValue === undefined) {
|
|
108
|
+
return {
|
|
109
|
+
passed: false,
|
|
110
|
+
actualValue: '(empty)',
|
|
111
|
+
expectedValue: formatConstraint(facet.value),
|
|
112
|
+
failure: {
|
|
113
|
+
type: 'PROPERTY_VALUE_MISMATCH',
|
|
114
|
+
field: `${pset.name}.${prop.name}`,
|
|
115
|
+
actual: '(empty)',
|
|
116
|
+
expected: formatConstraint(facet.value),
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (!matchConstraint(facet.value, propValue)) {
|
|
121
|
+
// Check if it's a bounds violation
|
|
122
|
+
const failureType = facet.value.type === 'bounds'
|
|
123
|
+
? 'PROPERTY_OUT_OF_BOUNDS'
|
|
124
|
+
: 'PROPERTY_VALUE_MISMATCH';
|
|
125
|
+
return {
|
|
126
|
+
passed: false,
|
|
127
|
+
actualValue: String(propValue),
|
|
128
|
+
expectedValue: formatConstraint(facet.value),
|
|
129
|
+
failure: {
|
|
130
|
+
type: failureType,
|
|
131
|
+
field: `${pset.name}.${prop.name}`,
|
|
132
|
+
actual: String(propValue),
|
|
133
|
+
expected: formatConstraint(facet.value),
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Property passed all checks
|
|
139
|
+
return {
|
|
140
|
+
passed: true,
|
|
141
|
+
actualValue: `${pset.name}.${prop.name} = ${prop.value}`,
|
|
142
|
+
expectedValue: facet.value
|
|
143
|
+
? formatConstraint(facet.value)
|
|
144
|
+
: 'property exists',
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
// Should not reach here
|
|
148
|
+
return {
|
|
149
|
+
passed: false,
|
|
150
|
+
failure: {
|
|
151
|
+
type: 'PROPERTY_MISSING',
|
|
152
|
+
field: formatConstraint(facet.baseName),
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=property-facet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-facet.js","sourceRoot":"","sources":["../../src/facets/property-facet.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAY/D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE5E;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAuB,EACvB,SAAiB,EACjB,QAAyB;IAEzB,uCAAuC;IACvC,MAAM,YAAY,GAAG,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAEzD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO;YACL,MAAM,EAAE,KAAK;YACb,aAAa,EAAE,aAAa,gBAAgB,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,gBAAgB,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG;YAC3G,OAAO,EAAE;gBACP,IAAI,EAAE,cAAc;gBACpB,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,WAAW,CAAC;gBAC1C,QAAQ,EAAE,gBAAgB,CAAC,KAAK,CAAC,WAA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@ifc-lite/ids - IDS (Information Delivery Specification) support
|
|
3
|
+
*
|
|
4
|
+
* Full support for buildingSMART IDS 1.0 with:
|
|
5
|
+
* - IDS XML parsing
|
|
6
|
+
* - All facet types (Entity, Attribute, Property, Classification, Material, PartOf)
|
|
7
|
+
* - All constraint types (Simple, Pattern, Enumeration, Bounds)
|
|
8
|
+
* - Multi-language translation (EN, DE, FR)
|
|
9
|
+
* - Human-readable validation reports
|
|
10
|
+
*/
|
|
11
|
+
export type { IDSDocument, IDSInfo, IDSSpecification, IDSApplicability, IDSRequirement, IFCVersion, RequirementOptionality, IDSFacet, FacetType, IDSEntityFacet, IDSAttributeFacet, IDSPropertyFacet, IDSClassificationFacet, IDSMaterialFacet, IDSPartOfFacet, PartOfRelation, IDSConstraint, IDSSimpleValue, IDSPatternConstraint, IDSEnumerationConstraint, IDSBoundsConstraint, IDSValidationReport, IDSModelInfo, IDSValidationSummary, IDSSpecificationResult, IDSCardinalityResult, IDSEntityResult, IDSRequirementResult, IDSFailureDetail, FailureType, IFCDataAccessor, PropertyValueResult, PropertySetInfo, ClassificationInfo, MaterialInfo, ParentInfo, ValidatorOptions, ValidationProgress, SupportedLocale, TranslationService, } from './types.js';
|
|
12
|
+
export { parseIDS, IDSParseError } from './parser/xml-parser.js';
|
|
13
|
+
export { validateIDS } from './validation/validator.js';
|
|
14
|
+
export { checkFacet, filterByFacet, checkEntityFacet, filterByEntityFacet, checkAttributeFacet, checkPropertyFacet, checkClassificationFacet, checkMaterialFacet, checkPartOfFacet, type FacetCheckResult, } from './facets/index.js';
|
|
15
|
+
export { matchConstraint, formatConstraint, getConstraintMismatchReason, } from './constraints/index.js';
|
|
16
|
+
export { createTranslationService } from './translation/index.js';
|
|
17
|
+
export { en, de, fr } from './translation/locales/index.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAMH,YAAY,EAEV,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,sBAAsB,EAGtB,QAAQ,EACR,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,EACd,cAAc,EAGd,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EAGnB,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,EAGX,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,UAAU,EAGV,gBAAgB,EAChB,kBAAkB,EAGlB,eAAe,EACf,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAMjE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAMxD,OAAO,EACL,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,gBAAgB,GACtB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
// Parser
|
|
6
|
+
// ============================================================================
|
|
7
|
+
export { parseIDS, IDSParseError } from './parser/xml-parser.js';
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Validation
|
|
10
|
+
// ============================================================================
|
|
11
|
+
export { validateIDS } from './validation/validator.js';
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Facets
|
|
14
|
+
// ============================================================================
|
|
15
|
+
export { checkFacet, filterByFacet, checkEntityFacet, filterByEntityFacet, checkAttributeFacet, checkPropertyFacet, checkClassificationFacet, checkMaterialFacet, checkPartOfFacet, } from './facets/index.js';
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// Constraints
|
|
18
|
+
// ============================================================================
|
|
19
|
+
export { matchConstraint, formatConstraint, getConstraintMismatchReason, } from './constraints/index.js';
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// Translation
|
|
22
|
+
// ============================================================================
|
|
23
|
+
export { createTranslationService } from './translation/index.js';
|
|
24
|
+
// Re-export locale data for customization
|
|
25
|
+
export { en, de, fr } from './translation/locales/index.js';
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAyE/D,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEjE,+EAA+E;AAC/E,aAAa;AACb,+EAA+E;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EACL,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,GAEjB,MAAM,mBAAmB,CAAC;AAE3B,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAEhC,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,0CAA0C;AAC1C,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IDS XML Parser
|
|
3
|
+
* Parses buildingSMART IDS 1.0 XML files
|
|
4
|
+
*/
|
|
5
|
+
import type { IDSDocument } from '../types.js';
|
|
6
|
+
/** Error thrown when parsing invalid IDS XML */
|
|
7
|
+
export declare class IDSParseError extends Error {
|
|
8
|
+
details?: string | undefined;
|
|
9
|
+
constructor(message: string, details?: string | undefined);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Parse IDS XML content into an IDSDocument
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseIDS(xmlContent: string | ArrayBuffer): IDSDocument;
|
|
15
|
+
//# sourceMappingURL=xml-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-parser.d.ts","sourceRoot":"","sources":["../../src/parser/xml-parser.ts"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,OAAO,KAAK,EACV,WAAW,EAoBZ,MAAM,aAAa,CAAC;AAKrB,gDAAgD;AAChD,qBAAa,aAAc,SAAQ,KAAK;IAG7B,OAAO,CAAC,EAAE,MAAM;gBADvB,OAAO,EAAE,MAAM,EACR,OAAO,CAAC,EAAE,MAAM,YAAA;CAK1B;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,GAAG,WAAW,CA+BtE"}
|