brepjs-bim 0.15.2 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brepjs-bim.cjs +10670 -461
- package/dist/brepjs-bim.js +10669 -460
- package/dist/ids/idsEngine.d.ts +10 -0
- package/dist/ids/idsParser.d.ts +11 -10
- package/dist/ids/idsSchema.generated.d.ts +1 -0
- package/dist/ids/idsTypes.d.ts +45 -29
- package/dist/ids/index.d.ts +1 -1
- package/dist/import/spfReader.d.ts +2 -0
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/ids/idsCheck.d.ts +0 -22
- package/dist/ids/idsFacets.d.ts +0 -21
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Result } from 'brepjs';
|
|
2
|
+
import { BimError } from '../errors/bimError.js';
|
|
3
|
+
import { IdsCheckReport, IdsDocument } from './idsTypes.js';
|
|
4
|
+
/**
|
|
5
|
+
* Checks IFC file bytes against an IDS document, evaluating every entity
|
|
6
|
+
* instance in the file against each specification. This is the
|
|
7
|
+
* conformance-grade checker validated against the official buildingSMART IDS
|
|
8
|
+
* test suite; see `scripts/idsConformance.ts`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function checkIdsData(bytes: Uint8Array, ids: IdsDocument): Promise<Result<IdsCheckReport, BimError>>;
|
package/dist/ids/idsParser.d.ts
CHANGED
|
@@ -4,17 +4,18 @@ import { IdsDocument } from './idsTypes.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* Parses an IDS 1.0 XML document string into a typed {@link IdsDocument}.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `
|
|
11
|
-
*
|
|
12
|
-
* `<xs:pattern>` children.
|
|
7
|
+
* Value fields accept a `<simpleValue>` or an `<xs:restriction>` carrying any
|
|
8
|
+
* combination of `xs:enumeration`, `xs:pattern`, numeric bounds
|
|
9
|
+
* (`xs:minInclusive` / `xs:maxInclusive` / `xs:minExclusive` /
|
|
10
|
+
* `xs:maxExclusive`), and length constraints (`xs:length` / `xs:minLength` /
|
|
11
|
+
* `xs:maxLength`).
|
|
13
12
|
*
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
16
|
-
* `
|
|
13
|
+
* Specification cardinality reads the applicability's `minOccurs`/`maxOccurs`:
|
|
14
|
+
* `prohibited` when `maxOccurs="0"`, `optional` when `minOccurs="0"`, else
|
|
15
|
+
* `required`. Requirement facets carry their own `cardinality` attribute.
|
|
16
|
+
* A prohibited specification with requirement facets is rejected as invalid,
|
|
17
|
+
* matching the official audit tool.
|
|
17
18
|
*
|
|
18
|
-
* Never throws — malformed XML or
|
|
19
|
+
* Never throws — malformed XML or an invalid structure returns `err(...)`.
|
|
19
20
|
*/
|
|
20
21
|
export declare function parseIdsXml(xml: string): Result<IdsDocument, BimError>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const IFC_ENTITY_ATTRIBUTES: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
package/dist/ids/idsTypes.d.ts
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import { ValidationIssue } from '../validation/severity.js';
|
|
2
2
|
/**
|
|
3
|
-
* A value constraint on an IDS facet field
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* and are reported as unsupported by the checker.
|
|
3
|
+
* A value constraint on an IDS facet field: a literal `<simpleValue>` or an
|
|
4
|
+
* `<xs:restriction>` carrying any combination of enumeration, pattern, numeric
|
|
5
|
+
* bounds, and length constraints. `base` is the xs type the restriction
|
|
6
|
+
* declares (e.g. `xs:double`), which drives typed comparison.
|
|
8
7
|
*/
|
|
8
|
+
export interface IdsRestrictionConstraints {
|
|
9
|
+
readonly base: string | undefined;
|
|
10
|
+
readonly values?: readonly string[] | undefined;
|
|
11
|
+
readonly pattern?: readonly string[] | undefined;
|
|
12
|
+
readonly minInclusive?: number | undefined;
|
|
13
|
+
readonly maxInclusive?: number | undefined;
|
|
14
|
+
readonly minExclusive?: number | undefined;
|
|
15
|
+
readonly maxExclusive?: number | undefined;
|
|
16
|
+
readonly length?: number | undefined;
|
|
17
|
+
readonly minLength?: number | undefined;
|
|
18
|
+
readonly maxLength?: number | undefined;
|
|
19
|
+
}
|
|
9
20
|
export type IdsRestriction = {
|
|
10
21
|
readonly kind: 'simple';
|
|
11
22
|
readonly value: string;
|
|
12
|
-
} | {
|
|
13
|
-
readonly kind: '
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* The IDS facet kinds this subset understands. `PartOf` is parsed but always
|
|
21
|
-
* reported as unsupported by the checker (spatial-tree resolution is out of
|
|
22
|
-
* scope); every other kind is fully evaluated.
|
|
23
|
-
*/
|
|
23
|
+
} | ({
|
|
24
|
+
readonly kind: 'restriction';
|
|
25
|
+
} & IdsRestrictionConstraints);
|
|
26
|
+
/** Cardinality of a specification or of an individual requirement facet. */
|
|
27
|
+
export type IdsCardinality = 'required' | 'optional' | 'prohibited';
|
|
28
|
+
export type IdsPartOfRelation = 'IFCRELAGGREGATES' | 'IFCRELASSIGNSTOGROUP' | 'IFCRELCONTAINEDINSPATIALSTRUCTURE' | 'IFCRELNESTS';
|
|
24
29
|
export type IdsFacet = {
|
|
25
30
|
readonly kind: 'Entity';
|
|
26
31
|
readonly name: IdsRestriction;
|
|
@@ -29,32 +34,43 @@ export type IdsFacet = {
|
|
|
29
34
|
readonly kind: 'Attribute';
|
|
30
35
|
readonly name: IdsRestriction;
|
|
31
36
|
readonly value?: IdsRestriction | undefined;
|
|
37
|
+
readonly cardinality: IdsCardinality;
|
|
32
38
|
} | {
|
|
33
39
|
readonly kind: 'Property';
|
|
34
40
|
readonly psetName: IdsRestriction;
|
|
35
41
|
readonly baseName: IdsRestriction;
|
|
36
42
|
readonly value?: IdsRestriction | undefined;
|
|
43
|
+
readonly dataType?: string | undefined;
|
|
44
|
+
readonly cardinality: IdsCardinality;
|
|
37
45
|
} | {
|
|
38
46
|
readonly kind: 'Classification';
|
|
39
47
|
readonly system?: IdsRestriction | undefined;
|
|
40
48
|
readonly value?: IdsRestriction | undefined;
|
|
49
|
+
readonly cardinality: IdsCardinality;
|
|
41
50
|
} | {
|
|
42
51
|
readonly kind: 'Material';
|
|
43
52
|
readonly value?: IdsRestriction | undefined;
|
|
53
|
+
readonly cardinality: IdsCardinality;
|
|
44
54
|
} | {
|
|
45
55
|
readonly kind: 'PartOf';
|
|
46
|
-
readonly
|
|
56
|
+
readonly entity?: {
|
|
57
|
+
readonly name: IdsRestriction;
|
|
58
|
+
readonly predefinedType?: IdsRestriction | undefined;
|
|
59
|
+
} | undefined;
|
|
60
|
+
readonly relation?: IdsPartOfRelation | undefined;
|
|
61
|
+
readonly cardinality: IdsCardinality;
|
|
47
62
|
};
|
|
48
|
-
export type IdsCardinality = 'required' | 'optional' | 'prohibited';
|
|
49
63
|
export interface IdsSpecification {
|
|
50
64
|
readonly name: string;
|
|
65
|
+
/** Declared schema versions. Purely metadata: never filters checking. */
|
|
51
66
|
readonly ifcVersion: readonly string[];
|
|
52
67
|
/**
|
|
53
|
-
* Cardinality of the
|
|
54
|
-
* - `required` —
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
68
|
+
* Cardinality of the applicability set:
|
|
69
|
+
* - `required` — at least one element must be applicable, and every
|
|
70
|
+
* applicable element must satisfy the requirements.
|
|
71
|
+
* - `optional` — applicable elements must satisfy the requirements, but an
|
|
72
|
+
* empty applicability set still passes.
|
|
73
|
+
* - `prohibited` — no element may match the applicability at all.
|
|
58
74
|
*/
|
|
59
75
|
readonly cardinality: IdsCardinality;
|
|
60
76
|
readonly applicability: readonly IdsFacet[];
|
|
@@ -67,11 +83,11 @@ export interface IdsDocument {
|
|
|
67
83
|
export interface IdsCheckResult {
|
|
68
84
|
readonly specificationName: string;
|
|
69
85
|
readonly pass: boolean;
|
|
70
|
-
/** Number of model
|
|
86
|
+
/** Number of model entity instances matched by the applicability facets. */
|
|
71
87
|
readonly applicableCount: number;
|
|
72
|
-
/** Applicable
|
|
88
|
+
/** Applicable instances that satisfied every requirement. */
|
|
73
89
|
readonly passedCount: number;
|
|
74
|
-
/** Applicable
|
|
90
|
+
/** Applicable instances that violated at least one requirement. */
|
|
75
91
|
readonly failedCount: number;
|
|
76
92
|
readonly issues: readonly ValidationIssue[];
|
|
77
93
|
}
|
|
@@ -80,8 +96,8 @@ export interface IdsCheckReport {
|
|
|
80
96
|
readonly results: readonly IdsCheckResult[];
|
|
81
97
|
/**
|
|
82
98
|
* Human-readable identifiers of facet features that were encountered but not
|
|
83
|
-
* evaluated
|
|
84
|
-
*
|
|
99
|
+
* evaluated. Their presence never aborts the check; the affected requirement
|
|
100
|
+
* is skipped with a warning.
|
|
85
101
|
*/
|
|
86
102
|
readonly unsupportedFacets: readonly string[];
|
|
87
103
|
}
|
package/dist/ids/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { parseIdsXml } from './idsParser.js';
|
|
2
|
-
export {
|
|
2
|
+
export { checkIdsData } from './idsEngine.js';
|
|
3
3
|
export type { IdsDocument, IdsSpecification, IdsFacet, IdsRestriction, IdsCardinality, IdsCheckReport, IdsCheckResult, } from './idsTypes.js';
|
|
@@ -30,6 +30,8 @@ export declare class SpfReader {
|
|
|
30
30
|
/** Express ids of every line in the model. */
|
|
31
31
|
getAllLines(): number[];
|
|
32
32
|
/** IFC type code for an express id. */
|
|
33
|
+
/** Uppercased IFC entity name of the instance (e.g. `IFCWALL`). */
|
|
34
|
+
typeNameOf(expressId: number): string;
|
|
33
35
|
getLineType(expressId: number): number;
|
|
34
36
|
/** Builds web-ifc's internal GUID→expressId index; call before guid lookups. */
|
|
35
37
|
buildGuidMap(): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -91,7 +91,7 @@ export type { IfcSchema } from './ifc-writer/schemaVersion.js';
|
|
|
91
91
|
export type { OwnerHistoryAuthor, OwnerHistoryMeta } from './ifc-writer/ownerHistoryWriter.js';
|
|
92
92
|
export { deriveCobieModel, deriveCobieModel as exportCobie, serializeCobieToCsv, serializeCobieToJson, } from './cobie/index.js';
|
|
93
93
|
export type { CobieModel, CobieJson, CobieExportMeta, CobieContactMeta, CobieContactRow, CobieFacilityRow, CobieFloorRow, CobieSpaceRow, CobieZoneRow, CobieTypeRow, CobieComponentRow, CobieSystemRow, CobieAttributeRow, } from './cobie/index.js';
|
|
94
|
-
export { parseIdsXml,
|
|
94
|
+
export { parseIdsXml, checkIdsData, checkIdsData as checkIds } from './ids/index.js';
|
|
95
95
|
export type { IdsDocument, IdsSpecification, IdsFacet, IdsRestriction, IdsCardinality, IdsCheckReport, IdsCheckResult, } from './ids/index.js';
|
|
96
96
|
export { serializeBcfFiles, parseBcfFiles } from './bcf/index.js';
|
|
97
97
|
export type { BcfColoring, BcfComment, BcfComponent, BcfComponents, BcfContainerData, BcfFiles, BcfProject, BcfTopic, BcfVersion, BcfViewpoint, BcfVisibility, } from './bcf/index.js';
|
package/package.json
CHANGED
package/dist/ids/idsCheck.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ImportedModel } from '../import/importedModel.js';
|
|
2
|
-
import { IdsCheckReport, IdsDocument } from './idsTypes.js';
|
|
3
|
-
/**
|
|
4
|
-
* Checks an imported model against an IDS document, returning a per-specification
|
|
5
|
-
* pass/fail report keyed by the specification name. The check is synchronous,
|
|
6
|
-
* never throws, and surfaces all problems as {@link ValidationIssue}s.
|
|
7
|
-
*
|
|
8
|
-
* For each specification the applicability facets select the matching elements,
|
|
9
|
-
* then the requirement facets are evaluated against each applicable element per
|
|
10
|
-
* the spec's cardinality:
|
|
11
|
-
* - `required` — every applicable element must satisfy all requirements
|
|
12
|
-
* (a failure is an `error`).
|
|
13
|
-
* - `optional` — requirement failures are reported as `info` and never fail.
|
|
14
|
-
* - `prohibited` — an applicable element that *does* satisfy the requirements is
|
|
15
|
-
* a violation (`error`).
|
|
16
|
-
*
|
|
17
|
-
* Unsupported facet features (the `PartOf` facet, numeric-bound restrictions,
|
|
18
|
-
* and invalid `xs:pattern` dialects) are recorded in
|
|
19
|
-
* {@link IdsCheckReport.unsupportedFacets} and the affected requirement is
|
|
20
|
-
* skipped rather than failing the element.
|
|
21
|
-
*/
|
|
22
|
-
export declare function checkModelAgainstIds(model: ImportedModel, ids: IdsDocument): IdsCheckReport;
|
package/dist/ids/idsFacets.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ImportedElement, ImportedElementCategory } from '../import/importedModel.js';
|
|
2
|
-
import { IdsRestriction } from './idsTypes.js';
|
|
3
|
-
/** Returns the categories an entity-name restriction can resolve to. */
|
|
4
|
-
export declare function categoriesForRestriction(name: IdsRestriction): ReadonlySet<ImportedElementCategory>;
|
|
5
|
-
/** Tests whether a candidate string satisfies an IDS value restriction. */
|
|
6
|
-
export declare function matchesRestriction(candidate: string, restriction: IdsRestriction): boolean;
|
|
7
|
-
export declare function isValidPattern(pattern: string): boolean;
|
|
8
|
-
/** True when the element's category matches the entity name (and predefined type). */
|
|
9
|
-
export declare function evalEntityFacet(element: ImportedElement, name: IdsRestriction, predefinedType: IdsRestriction | undefined): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* True when the element exposes the named property in the named pset, optionally
|
|
12
|
-
* with a value matching `value`. Reads from both IfcPropertySet-derived psets and
|
|
13
|
-
* IfcElementQuantity-derived ones.
|
|
14
|
-
*/
|
|
15
|
-
export declare function evalPropertyFacet(element: ImportedElement, psetName: IdsRestriction, baseName: IdsRestriction, value: IdsRestriction | undefined): boolean;
|
|
16
|
-
/** True when an element attribute (Name/PredefinedType) matches the facet. */
|
|
17
|
-
export declare function evalAttributeFacet(element: ImportedElement, name: IdsRestriction, value: IdsRestriction | undefined): boolean;
|
|
18
|
-
/** True when the element's classification system/value match the facet. */
|
|
19
|
-
export declare function evalClassificationFacet(element: ImportedElement, system: IdsRestriction | undefined, value: IdsRestriction | undefined): boolean;
|
|
20
|
-
/** True when the element's material name matches the facet value. */
|
|
21
|
-
export declare function evalMaterialFacet(element: ImportedElement, value: IdsRestriction | undefined): boolean;
|