@itwin/ecschema-editing 4.0.0-dev.6 → 4.0.0-dev.61
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/CHANGELOG.md +11 -1
- package/lib/cjs/Editing/Constants.d.ts +20 -20
- package/lib/cjs/Editing/Constants.js +60 -60
- package/lib/cjs/Editing/CustomAttributes.d.ts +20 -20
- package/lib/cjs/Editing/CustomAttributes.js +59 -59
- package/lib/cjs/Editing/ECClasses.d.ts +54 -54
- package/lib/cjs/Editing/ECClasses.js +269 -269
- package/lib/cjs/Editing/Editor.d.ts +112 -112
- package/lib/cjs/Editing/Editor.js +166 -166
- package/lib/cjs/Editing/Entities.d.ts +25 -25
- package/lib/cjs/Editing/Entities.js +116 -116
- package/lib/cjs/Editing/Entities.js.map +1 -1
- package/lib/cjs/Editing/Enumerations.d.ts +21 -21
- package/lib/cjs/Editing/Enumerations.js +66 -66
- package/lib/cjs/Editing/Formats.d.ts +21 -21
- package/lib/cjs/Editing/Formats.js +61 -61
- package/lib/cjs/Editing/InvertedUnits.d.ts +17 -17
- package/lib/cjs/Editing/InvertedUnits.js +82 -82
- package/lib/cjs/Editing/KindOfQuantities.d.ts +28 -28
- package/lib/cjs/Editing/KindOfQuantities.js +78 -78
- package/lib/cjs/Editing/Mixins.d.ts +22 -22
- package/lib/cjs/Editing/Mixins.js +84 -84
- package/lib/cjs/Editing/Mutable/MutableCAClass.d.ts +9 -9
- package/lib/cjs/Editing/Mutable/MutableCAClass.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableClass.d.ts +34 -34
- package/lib/cjs/Editing/Mutable/MutableClass.js +22 -22
- package/lib/cjs/Editing/Mutable/MutableConstant.d.ts +12 -12
- package/lib/cjs/Editing/Mutable/MutableConstant.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableEntityClass.d.ts +15 -15
- package/lib/cjs/Editing/Mutable/MutableEntityClass.js +59 -59
- package/lib/cjs/Editing/Mutable/MutableEnumeration.d.ts +9 -9
- package/lib/cjs/Editing/Mutable/MutableEnumeration.js +14 -14
- package/lib/cjs/Editing/Mutable/MutableFormat.d.ts +18 -18
- package/lib/cjs/Editing/Mutable/MutableFormat.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableInvertedUnit.d.ts +10 -10
- package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.d.ts +10 -10
- package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableMixin.d.ts +11 -11
- package/lib/cjs/Editing/Mutable/MutableMixin.js +15 -15
- package/lib/cjs/Editing/Mutable/MutablePhenomenon.d.ts +9 -9
- package/lib/cjs/Editing/Mutable/MutablePhenomenon.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableProperty.d.ts +8 -8
- package/lib/cjs/Editing/Mutable/MutableProperty.js +15 -15
- package/lib/cjs/Editing/Mutable/MutablePropertyCategory.d.ts +9 -9
- package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableRelationshipClass.d.ts +21 -21
- package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js +24 -24
- package/lib/cjs/Editing/Mutable/MutableSchema.d.ts +45 -45
- package/lib/cjs/Editing/Mutable/MutableSchema.js +17 -17
- package/lib/cjs/Editing/Mutable/MutableUnit.d.ts +11 -11
- package/lib/cjs/Editing/Mutable/MutableUnit.js +15 -15
- package/lib/cjs/Editing/Mutable/MutableUnitSystem.d.ts +8 -8
- package/lib/cjs/Editing/Mutable/MutableUnitSystem.js +15 -15
- package/lib/cjs/Editing/Phenomena.d.ts +15 -15
- package/lib/cjs/Editing/Phenomena.js +44 -44
- package/lib/cjs/Editing/PropertyCategories.d.ts +16 -16
- package/lib/cjs/Editing/PropertyCategories.js +51 -51
- package/lib/cjs/Editing/RelationshipClasses.d.ts +21 -21
- package/lib/cjs/Editing/RelationshipClasses.js +68 -68
- package/lib/cjs/Editing/Structs.d.ts +19 -19
- package/lib/cjs/Editing/Structs.js +57 -57
- package/lib/cjs/Editing/UnitSystems.d.ts +15 -15
- package/lib/cjs/Editing/UnitSystems.js +41 -41
- package/lib/cjs/Editing/Units.d.ts +15 -15
- package/lib/cjs/Editing/Units.js +58 -58
- package/lib/cjs/Validation/Diagnostic.d.ts +321 -321
- package/lib/cjs/Validation/Diagnostic.d.ts.map +1 -1
- package/lib/cjs/Validation/Diagnostic.js +310 -310
- package/lib/cjs/Validation/Diagnostic.js.map +1 -1
- package/lib/cjs/Validation/DiagnosticReporter.d.ts +96 -96
- package/lib/cjs/Validation/DiagnosticReporter.js +106 -106
- package/lib/cjs/Validation/ECRules.d.ts +448 -448
- package/lib/cjs/Validation/ECRules.js +593 -593
- package/lib/cjs/Validation/LoggingDiagnosticReporter.d.ts +13 -13
- package/lib/cjs/Validation/LoggingDiagnosticReporter.js +40 -40
- package/lib/cjs/Validation/RuleSuppressionSet.d.ts +59 -59
- package/lib/cjs/Validation/RuleSuppressionSet.d.ts.map +1 -1
- package/lib/cjs/Validation/RuleSuppressionSet.js +9 -9
- package/lib/cjs/Validation/Rules.d.ts +64 -64
- package/lib/cjs/Validation/Rules.d.ts.map +1 -1
- package/lib/cjs/Validation/Rules.js +9 -9
- package/lib/cjs/Validation/SchemaChanges.d.ts +607 -607
- package/lib/cjs/Validation/SchemaChanges.js +1135 -1135
- package/lib/cjs/Validation/SchemaCompareDiagnostics.d.ts +422 -422
- package/lib/cjs/Validation/SchemaCompareDiagnostics.js +111 -111
- package/lib/cjs/Validation/SchemaCompareReporter.d.ts +11 -11
- package/lib/cjs/Validation/SchemaCompareReporter.js +9 -9
- package/lib/cjs/Validation/SchemaCompareResultDelegate.d.ts +236 -236
- package/lib/cjs/Validation/SchemaCompareResultDelegate.js +348 -348
- package/lib/cjs/Validation/SchemaCompareVisitor.d.ts +119 -119
- package/lib/cjs/Validation/SchemaCompareVisitor.js +206 -206
- package/lib/cjs/Validation/SchemaComparer.d.ts +171 -171
- package/lib/cjs/Validation/SchemaComparer.js +666 -666
- package/lib/cjs/Validation/SchemaValidater.d.ts +19 -19
- package/lib/cjs/Validation/SchemaValidater.js +61 -61
- package/lib/cjs/Validation/SchemaValidationVisitor.d.ts +170 -170
- package/lib/cjs/Validation/SchemaValidationVisitor.js +492 -492
- package/lib/cjs/Validation/SchemaWalker.d.ts +22 -22
- package/lib/cjs/Validation/SchemaWalker.js +51 -51
- package/lib/cjs/ecschema-editing.d.ts +33 -33
- package/lib/cjs/ecschema-editing.js +58 -54
- package/lib/cjs/ecschema-editing.js.map +1 -1
- package/package.json +12 -12
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module Validation
|
|
3
|
-
*/
|
|
4
|
-
import { Schema } from "@itwin/ecschema-metadata";
|
|
5
|
-
import { IRuleSet } from "./Rules";
|
|
6
|
-
import { AnyDiagnostic } from "./Diagnostic";
|
|
7
|
-
/**
|
|
8
|
-
* Applies EC Rules, see [[ECRuleSet]], to a given Schema and reports any violations.
|
|
9
|
-
* @beta
|
|
10
|
-
*/
|
|
11
|
-
export declare class SchemaValidater {
|
|
12
|
-
/**
|
|
13
|
-
* Validates a schema against the [[ECRuleSet]].
|
|
14
|
-
* @param schema The schema to validate.
|
|
15
|
-
* @param validaterRuleSet Optional IRuleSet to be applied to the schema in addition to the default EC rules.
|
|
16
|
-
*/
|
|
17
|
-
static validateSchema(schema: Schema, validaterRuleSet?: IRuleSet): Promise<AnyDiagnostic[]>;
|
|
18
|
-
private static createNewVisitor;
|
|
19
|
-
}
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Validation
|
|
3
|
+
*/
|
|
4
|
+
import { Schema } from "@itwin/ecschema-metadata";
|
|
5
|
+
import { IRuleSet } from "./Rules";
|
|
6
|
+
import { AnyDiagnostic } from "./Diagnostic";
|
|
7
|
+
/**
|
|
8
|
+
* Applies EC Rules, see [[ECRuleSet]], to a given Schema and reports any violations.
|
|
9
|
+
* @beta
|
|
10
|
+
*/
|
|
11
|
+
export declare class SchemaValidater {
|
|
12
|
+
/**
|
|
13
|
+
* Validates a schema against the [[ECRuleSet]].
|
|
14
|
+
* @param schema The schema to validate.
|
|
15
|
+
* @param validaterRuleSet Optional IRuleSet to be applied to the schema in addition to the default EC rules.
|
|
16
|
+
*/
|
|
17
|
+
static validateSchema(schema: Schema, validaterRuleSet?: IRuleSet): Promise<AnyDiagnostic[]>;
|
|
18
|
+
private static createNewVisitor;
|
|
19
|
+
}
|
|
20
20
|
//# sourceMappingURL=SchemaValidater.d.ts.map
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module Validation
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.SchemaValidater = void 0;
|
|
11
|
-
const SchemaValidationVisitor_1 = require("./SchemaValidationVisitor");
|
|
12
|
-
const DiagnosticReporter_1 = require("./DiagnosticReporter");
|
|
13
|
-
const SchemaWalker_1 = require("./SchemaWalker");
|
|
14
|
-
const ECRules_1 = require("./ECRules");
|
|
15
|
-
class CollectionReporter extends DiagnosticReporter_1.SuppressionDiagnosticReporter {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this._diagnostics = [];
|
|
19
|
-
}
|
|
20
|
-
/** Gets the collection of diagnostic message. */
|
|
21
|
-
get diagnostics() {
|
|
22
|
-
return this._diagnostics;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Handles the given [[IDiagnostic]] based on the implementation requirements for a
|
|
26
|
-
* given reporter.
|
|
27
|
-
* @param diagnostic The diagnostic to report.
|
|
28
|
-
*/
|
|
29
|
-
reportInternal(diagnostic) {
|
|
30
|
-
this._diagnostics.push(diagnostic);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Applies EC Rules, see [[ECRuleSet]], to a given Schema and reports any violations.
|
|
35
|
-
* @beta
|
|
36
|
-
*/
|
|
37
|
-
class SchemaValidater {
|
|
38
|
-
/**
|
|
39
|
-
* Validates a schema against the [[ECRuleSet]].
|
|
40
|
-
* @param schema The schema to validate.
|
|
41
|
-
* @param validaterRuleSet Optional IRuleSet to be applied to the schema in addition to the default EC rules.
|
|
42
|
-
*/
|
|
43
|
-
static async validateSchema(schema, validaterRuleSet) {
|
|
44
|
-
const collectionReporter = new CollectionReporter();
|
|
45
|
-
const reporters = [collectionReporter];
|
|
46
|
-
const ruleSets = [ECRules_1.ECRuleSet];
|
|
47
|
-
if (validaterRuleSet)
|
|
48
|
-
ruleSets.push(validaterRuleSet);
|
|
49
|
-
const visitor = this.createNewVisitor(ruleSets, reporters);
|
|
50
|
-
const reader = new SchemaWalker_1.SchemaWalker(visitor);
|
|
51
|
-
await reader.traverseSchema(schema);
|
|
52
|
-
return collectionReporter.diagnostics;
|
|
53
|
-
}
|
|
54
|
-
static createNewVisitor(ruleSets, reporters) {
|
|
55
|
-
const visitor = new SchemaValidationVisitor_1.SchemaValidationVisitor();
|
|
56
|
-
ruleSets.forEach((set) => visitor.registerRuleSet(set));
|
|
57
|
-
reporters.forEach((reporter) => visitor.registerReporter(reporter));
|
|
58
|
-
return visitor;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.SchemaValidater = SchemaValidater;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Validation
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.SchemaValidater = void 0;
|
|
11
|
+
const SchemaValidationVisitor_1 = require("./SchemaValidationVisitor");
|
|
12
|
+
const DiagnosticReporter_1 = require("./DiagnosticReporter");
|
|
13
|
+
const SchemaWalker_1 = require("./SchemaWalker");
|
|
14
|
+
const ECRules_1 = require("./ECRules");
|
|
15
|
+
class CollectionReporter extends DiagnosticReporter_1.SuppressionDiagnosticReporter {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this._diagnostics = [];
|
|
19
|
+
}
|
|
20
|
+
/** Gets the collection of diagnostic message. */
|
|
21
|
+
get diagnostics() {
|
|
22
|
+
return this._diagnostics;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Handles the given [[IDiagnostic]] based on the implementation requirements for a
|
|
26
|
+
* given reporter.
|
|
27
|
+
* @param diagnostic The diagnostic to report.
|
|
28
|
+
*/
|
|
29
|
+
reportInternal(diagnostic) {
|
|
30
|
+
this._diagnostics.push(diagnostic);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Applies EC Rules, see [[ECRuleSet]], to a given Schema and reports any violations.
|
|
35
|
+
* @beta
|
|
36
|
+
*/
|
|
37
|
+
class SchemaValidater {
|
|
38
|
+
/**
|
|
39
|
+
* Validates a schema against the [[ECRuleSet]].
|
|
40
|
+
* @param schema The schema to validate.
|
|
41
|
+
* @param validaterRuleSet Optional IRuleSet to be applied to the schema in addition to the default EC rules.
|
|
42
|
+
*/
|
|
43
|
+
static async validateSchema(schema, validaterRuleSet) {
|
|
44
|
+
const collectionReporter = new CollectionReporter();
|
|
45
|
+
const reporters = [collectionReporter];
|
|
46
|
+
const ruleSets = [ECRules_1.ECRuleSet];
|
|
47
|
+
if (validaterRuleSet)
|
|
48
|
+
ruleSets.push(validaterRuleSet);
|
|
49
|
+
const visitor = this.createNewVisitor(ruleSets, reporters);
|
|
50
|
+
const reader = new SchemaWalker_1.SchemaWalker(visitor);
|
|
51
|
+
await reader.traverseSchema(schema);
|
|
52
|
+
return collectionReporter.diagnostics;
|
|
53
|
+
}
|
|
54
|
+
static createNewVisitor(ruleSets, reporters) {
|
|
55
|
+
const visitor = new SchemaValidationVisitor_1.SchemaValidationVisitor();
|
|
56
|
+
ruleSets.forEach((set) => visitor.registerRuleSet(set));
|
|
57
|
+
reporters.forEach((reporter) => visitor.registerReporter(reporter));
|
|
58
|
+
return visitor;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.SchemaValidater = SchemaValidater;
|
|
62
62
|
//# sourceMappingURL=SchemaValidater.js.map
|
|
@@ -1,171 +1,171 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module Validation
|
|
3
|
-
*/
|
|
4
|
-
import { AnyClass, AnyProperty, Constant, CustomAttribute, CustomAttributeClass, CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, ISchemaPartVisitor, KindOfQuantity, Mixin, Phenomenon, PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, StructClass, Unit, UnitSystem } from "@itwin/ecschema-metadata";
|
|
5
|
-
import { IDiagnosticReporter } from "./DiagnosticReporter";
|
|
6
|
-
import { IRuleSet } from "./Rules";
|
|
7
|
-
import { IRuleSuppressionSet } from "./RuleSuppressionSet";
|
|
8
|
-
interface RuleSetArray {
|
|
9
|
-
[name: string]: IRuleSet;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* A SchemaWalkerVisitor interface implementation that is used to validate ECObjects schemas using
|
|
13
|
-
* [[IRuleSet]] objects registered with the instance. Also allows for reporting of [[IDiagnostic]]
|
|
14
|
-
* objects returned from failing rules using [[IDiagnosticReporter]] implementations registered
|
|
15
|
-
* with an instance of this class.
|
|
16
|
-
* @beta
|
|
17
|
-
*/
|
|
18
|
-
export declare class SchemaValidationVisitor implements ISchemaPartVisitor {
|
|
19
|
-
private _reporters;
|
|
20
|
-
private _ruleSets;
|
|
21
|
-
private _ruleSuppressionSet?;
|
|
22
|
-
/** Gets the IRule<AnyClass> objects registered with the visitor. */
|
|
23
|
-
get ruleSets(): RuleSetArray;
|
|
24
|
-
get suppressionSet(): IRuleSuppressionSet | undefined;
|
|
25
|
-
/** Gets the IDiagnosticReporter objects registered with the visitor. */
|
|
26
|
-
get diagnosticReporters(): IDiagnosticReporter[];
|
|
27
|
-
/**
|
|
28
|
-
* Registers a [[IDiagnosticReporter]] allowing the reporter to be
|
|
29
|
-
* notified when a [[IDiagnostic]] is created due to a rule violation.
|
|
30
|
-
* @param reporter The [[DiagnosticReporter]] to register.
|
|
31
|
-
*/
|
|
32
|
-
registerReporter(...reporters: IDiagnosticReporter[]): void;
|
|
33
|
-
/**
|
|
34
|
-
* Registers a [[IRuleSet]] that will applied during schema traversal.
|
|
35
|
-
* @param ruleSet The [[IRuleSet]] to register.
|
|
36
|
-
*/
|
|
37
|
-
registerRuleSet(ruleSet: IRuleSet): void;
|
|
38
|
-
/**
|
|
39
|
-
* Registers a [[IRuleSuppressionSet]] that will be applied during schema traversal.
|
|
40
|
-
* @param ruleSet The [[IRuleSuppressionSet]] to register.
|
|
41
|
-
* Only supports one Rule Suppression Set, if you call it twice it will overwrite the
|
|
42
|
-
* previous suppression set
|
|
43
|
-
*/
|
|
44
|
-
registerRuleSuppressionSet(suppressionSet: IRuleSuppressionSet): void;
|
|
45
|
-
/**
|
|
46
|
-
* Called before schema traversal.
|
|
47
|
-
* @param schema a Schema object.
|
|
48
|
-
*/
|
|
49
|
-
visitFullSchema(schema: Schema): Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
* Called for each [[SchemaItem]] instance found during schema traversal.
|
|
52
|
-
* @param schemaItem a SchemaItem object.
|
|
53
|
-
*/
|
|
54
|
-
visitSchemaItem(schemaItem: SchemaItem): Promise<void>;
|
|
55
|
-
/**
|
|
56
|
-
* Called for each [AnyClass]($ecschema-metadata) instance found during schema traversal.
|
|
57
|
-
* @param ecClass an ECClass object.
|
|
58
|
-
*/
|
|
59
|
-
visitClass(ecClass: AnyClass): Promise<void>;
|
|
60
|
-
/**
|
|
61
|
-
* Called for each [AnyProperty]($ecschema-metadata) instance of an ECClass.
|
|
62
|
-
* @param property an AnyProperty object.
|
|
63
|
-
*/
|
|
64
|
-
visitProperty(property: AnyProperty): Promise<void>;
|
|
65
|
-
/**
|
|
66
|
-
* Called for each [EntityClass]($ecschema-metadata) instance found during schema traversal.
|
|
67
|
-
* @param entityClass an EntityClass object.
|
|
68
|
-
*/
|
|
69
|
-
visitEntityClass(entity: EntityClass): Promise<void>;
|
|
70
|
-
/**
|
|
71
|
-
* Called for each [StructClass]($ecschema-metadata) instance found during schema traversal.
|
|
72
|
-
* @param structClass a StructClass object.
|
|
73
|
-
*/
|
|
74
|
-
visitStructClass(struct: StructClass): Promise<void>;
|
|
75
|
-
/**
|
|
76
|
-
* Called for each [Mixin]($ecschema-metadata) instance found during schema traversal.
|
|
77
|
-
* @param mixin a Mixin object.
|
|
78
|
-
*/
|
|
79
|
-
visitMixin(mixin: Mixin): Promise<void>;
|
|
80
|
-
/**
|
|
81
|
-
* Called for each [RelationshipClass]($ecschema-metadata) instance found during schema traversal.
|
|
82
|
-
* @param relationshipClass a RelationshipClass object.
|
|
83
|
-
*/
|
|
84
|
-
visitRelationshipClass(relationship: RelationshipClass): Promise<void>;
|
|
85
|
-
/**
|
|
86
|
-
* Called for each [RelationshipConstraint]($ecschema-metadata) of each RelationshipClass found during schema traversal.
|
|
87
|
-
* @param relationshipConstraint a RelationshipConstraint object.
|
|
88
|
-
*/
|
|
89
|
-
visitRelationshipConstraint(constraint: RelationshipConstraint): Promise<void>;
|
|
90
|
-
/**
|
|
91
|
-
* Called for each [CustomAttributeClass]($ecschema-metadata) instance found during schema traversal.
|
|
92
|
-
* @param customAttributeClass a CustomAttributeClass object.
|
|
93
|
-
*/
|
|
94
|
-
visitCustomAttributeClass(customAttribute: CustomAttributeClass): Promise<void>;
|
|
95
|
-
/**
|
|
96
|
-
* Called for each [CustomAttribute]($ecschema-metadata) container in the schema.
|
|
97
|
-
* @param customAttributeContainer a [[CustomAttributeContainerProps]] object.
|
|
98
|
-
*/
|
|
99
|
-
visitCustomAttributeContainer(container: CustomAttributeContainerProps): Promise<void>;
|
|
100
|
-
/**
|
|
101
|
-
* Called for each [Enumeration]($ecschema-metadata) instance found during schema traversal.
|
|
102
|
-
* @param enumeration an Enumeration object.
|
|
103
|
-
*/
|
|
104
|
-
visitEnumeration(enumeration: Enumeration): Promise<void>;
|
|
105
|
-
/**
|
|
106
|
-
* Called for each [KindOfQuantity]($ecschema-metadata) instance found during schema traversal.
|
|
107
|
-
* @param koq a KindOfQuantity object.
|
|
108
|
-
*/
|
|
109
|
-
visitKindOfQuantity(koq: KindOfQuantity): Promise<void>;
|
|
110
|
-
/**
|
|
111
|
-
* Called for each [PropertyCategory]($ecschema-metadata) instance found during schema traversal.
|
|
112
|
-
* @param category a PropertyCategory object.
|
|
113
|
-
*/
|
|
114
|
-
visitPropertyCategory(category: PropertyCategory): Promise<void>;
|
|
115
|
-
/**
|
|
116
|
-
* Called for each [Format]($ecschema-metadata) instance found during schema traversal.
|
|
117
|
-
* @param format a Format object.
|
|
118
|
-
*/
|
|
119
|
-
visitFormat(format: Format): Promise<void>;
|
|
120
|
-
/**
|
|
121
|
-
* Called for each [Unit]($ecschema-metadata) instance found during schema traversal.
|
|
122
|
-
* @param unit a Unit object.
|
|
123
|
-
*/
|
|
124
|
-
visitUnit(unit: Unit): Promise<void>;
|
|
125
|
-
/**
|
|
126
|
-
* Called for each [InvertedUnit]($ecschema-metadata) instance found during schema traversal.
|
|
127
|
-
* @param invertedUnit an InvertedUnit object.
|
|
128
|
-
*/
|
|
129
|
-
visitInvertedUnit(invertedUnit: InvertedUnit): Promise<void>;
|
|
130
|
-
/**
|
|
131
|
-
* Called for each [UnitSystem]($ecschema-metadata) instance found during schema traversal.
|
|
132
|
-
* @param unitSystem a UnitSystem object.
|
|
133
|
-
*/
|
|
134
|
-
visitUnitSystem(unitSystem: UnitSystem): Promise<void>;
|
|
135
|
-
/**
|
|
136
|
-
* Called for each [Phenomenon]($ecschema-metadata) instance found during schema traversal.
|
|
137
|
-
* @param phenomena a Phenomenon object.
|
|
138
|
-
*/
|
|
139
|
-
visitPhenomenon(phenomenon: Phenomenon): Promise<void>;
|
|
140
|
-
/**
|
|
141
|
-
* Called for each [Constant]($ecschema-metadata) instance found during schema traversal.
|
|
142
|
-
* @param constant a Constant object.
|
|
143
|
-
*/
|
|
144
|
-
visitConstant(constant: Constant): Promise<void>;
|
|
145
|
-
applySchemaRules(schema: Schema, ruleSet: IRuleSet): Promise<void>;
|
|
146
|
-
applySchemaItemRules(schemaItem: SchemaItem, ruleSet: IRuleSet): Promise<void>;
|
|
147
|
-
applyClassRules(ecClass: AnyClass, ruleSet: IRuleSet): Promise<void>;
|
|
148
|
-
applyPropertyRules(property: AnyProperty, ruleSet: IRuleSet): Promise<void>;
|
|
149
|
-
applyEntityRules(entityClass: EntityClass, ruleSet: IRuleSet): Promise<void>;
|
|
150
|
-
applyStructRules(structClass: StructClass, ruleSet: IRuleSet): Promise<void>;
|
|
151
|
-
applyMixinRules(mixin: Mixin, ruleSet: IRuleSet): Promise<void>;
|
|
152
|
-
applyRelationshipRules(relationship: RelationshipClass, ruleSet: IRuleSet): Promise<void>;
|
|
153
|
-
applyRelationshipConstraintRules(constraint: RelationshipConstraint, ruleSet: IRuleSet): Promise<void>;
|
|
154
|
-
applyCustomAttributeRules(customAttribute: CustomAttributeClass, ruleSet: IRuleSet): Promise<void>;
|
|
155
|
-
applyCustomAttributeContainerRules(container: CustomAttributeContainerProps, ruleSet: IRuleSet): Promise<void>;
|
|
156
|
-
applyCustomAttributeInstanceRules(container: CustomAttributeContainerProps, customAttribute: CustomAttribute, ruleSet: IRuleSet): Promise<void>;
|
|
157
|
-
applyEnumerationRules(enumeration: Enumeration, ruleSet: IRuleSet): Promise<void>;
|
|
158
|
-
applyKindOfQuantityRules(kindOfQuantity: KindOfQuantity, ruleSet: IRuleSet): Promise<void>;
|
|
159
|
-
applyPropertyCategoryRules(propertyCategory: PropertyCategory, ruleSet: IRuleSet): Promise<void>;
|
|
160
|
-
applyFormatRules(format: Format, ruleSet: IRuleSet): Promise<void>;
|
|
161
|
-
applyUnitRules(unit: Unit, ruleSet: IRuleSet): Promise<void>;
|
|
162
|
-
applyInvertedUnitRules(invertedUnit: InvertedUnit, ruleSet: IRuleSet): Promise<void>;
|
|
163
|
-
applyUnitSystemRules(unitSystem: UnitSystem, ruleSet: IRuleSet): Promise<void>;
|
|
164
|
-
applyPhenomenonRules(phenomenon: Phenomenon, ruleSet: IRuleSet): Promise<void>;
|
|
165
|
-
applyConstantRules(constant: Constant, ruleSet: IRuleSet): Promise<void>;
|
|
166
|
-
private findSuppressionRule;
|
|
167
|
-
private excludeSchemaFromRuleSet;
|
|
168
|
-
private reportDiagnostics;
|
|
169
|
-
}
|
|
170
|
-
export {};
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Validation
|
|
3
|
+
*/
|
|
4
|
+
import { AnyClass, AnyProperty, Constant, CustomAttribute, CustomAttributeClass, CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, ISchemaPartVisitor, KindOfQuantity, Mixin, Phenomenon, PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, StructClass, Unit, UnitSystem } from "@itwin/ecschema-metadata";
|
|
5
|
+
import { IDiagnosticReporter } from "./DiagnosticReporter";
|
|
6
|
+
import { IRuleSet } from "./Rules";
|
|
7
|
+
import { IRuleSuppressionSet } from "./RuleSuppressionSet";
|
|
8
|
+
interface RuleSetArray {
|
|
9
|
+
[name: string]: IRuleSet;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A SchemaWalkerVisitor interface implementation that is used to validate ECObjects schemas using
|
|
13
|
+
* [[IRuleSet]] objects registered with the instance. Also allows for reporting of [[IDiagnostic]]
|
|
14
|
+
* objects returned from failing rules using [[IDiagnosticReporter]] implementations registered
|
|
15
|
+
* with an instance of this class.
|
|
16
|
+
* @beta
|
|
17
|
+
*/
|
|
18
|
+
export declare class SchemaValidationVisitor implements ISchemaPartVisitor {
|
|
19
|
+
private _reporters;
|
|
20
|
+
private _ruleSets;
|
|
21
|
+
private _ruleSuppressionSet?;
|
|
22
|
+
/** Gets the IRule<AnyClass> objects registered with the visitor. */
|
|
23
|
+
get ruleSets(): RuleSetArray;
|
|
24
|
+
get suppressionSet(): IRuleSuppressionSet | undefined;
|
|
25
|
+
/** Gets the IDiagnosticReporter objects registered with the visitor. */
|
|
26
|
+
get diagnosticReporters(): IDiagnosticReporter[];
|
|
27
|
+
/**
|
|
28
|
+
* Registers a [[IDiagnosticReporter]] allowing the reporter to be
|
|
29
|
+
* notified when a [[IDiagnostic]] is created due to a rule violation.
|
|
30
|
+
* @param reporter The [[DiagnosticReporter]] to register.
|
|
31
|
+
*/
|
|
32
|
+
registerReporter(...reporters: IDiagnosticReporter[]): void;
|
|
33
|
+
/**
|
|
34
|
+
* Registers a [[IRuleSet]] that will applied during schema traversal.
|
|
35
|
+
* @param ruleSet The [[IRuleSet]] to register.
|
|
36
|
+
*/
|
|
37
|
+
registerRuleSet(ruleSet: IRuleSet): void;
|
|
38
|
+
/**
|
|
39
|
+
* Registers a [[IRuleSuppressionSet]] that will be applied during schema traversal.
|
|
40
|
+
* @param ruleSet The [[IRuleSuppressionSet]] to register.
|
|
41
|
+
* Only supports one Rule Suppression Set, if you call it twice it will overwrite the
|
|
42
|
+
* previous suppression set
|
|
43
|
+
*/
|
|
44
|
+
registerRuleSuppressionSet(suppressionSet: IRuleSuppressionSet): void;
|
|
45
|
+
/**
|
|
46
|
+
* Called before schema traversal.
|
|
47
|
+
* @param schema a Schema object.
|
|
48
|
+
*/
|
|
49
|
+
visitFullSchema(schema: Schema): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Called for each [[SchemaItem]] instance found during schema traversal.
|
|
52
|
+
* @param schemaItem a SchemaItem object.
|
|
53
|
+
*/
|
|
54
|
+
visitSchemaItem(schemaItem: SchemaItem): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Called for each [AnyClass]($ecschema-metadata) instance found during schema traversal.
|
|
57
|
+
* @param ecClass an ECClass object.
|
|
58
|
+
*/
|
|
59
|
+
visitClass(ecClass: AnyClass): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Called for each [AnyProperty]($ecschema-metadata) instance of an ECClass.
|
|
62
|
+
* @param property an AnyProperty object.
|
|
63
|
+
*/
|
|
64
|
+
visitProperty(property: AnyProperty): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Called for each [EntityClass]($ecschema-metadata) instance found during schema traversal.
|
|
67
|
+
* @param entityClass an EntityClass object.
|
|
68
|
+
*/
|
|
69
|
+
visitEntityClass(entity: EntityClass): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Called for each [StructClass]($ecschema-metadata) instance found during schema traversal.
|
|
72
|
+
* @param structClass a StructClass object.
|
|
73
|
+
*/
|
|
74
|
+
visitStructClass(struct: StructClass): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Called for each [Mixin]($ecschema-metadata) instance found during schema traversal.
|
|
77
|
+
* @param mixin a Mixin object.
|
|
78
|
+
*/
|
|
79
|
+
visitMixin(mixin: Mixin): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Called for each [RelationshipClass]($ecschema-metadata) instance found during schema traversal.
|
|
82
|
+
* @param relationshipClass a RelationshipClass object.
|
|
83
|
+
*/
|
|
84
|
+
visitRelationshipClass(relationship: RelationshipClass): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Called for each [RelationshipConstraint]($ecschema-metadata) of each RelationshipClass found during schema traversal.
|
|
87
|
+
* @param relationshipConstraint a RelationshipConstraint object.
|
|
88
|
+
*/
|
|
89
|
+
visitRelationshipConstraint(constraint: RelationshipConstraint): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Called for each [CustomAttributeClass]($ecschema-metadata) instance found during schema traversal.
|
|
92
|
+
* @param customAttributeClass a CustomAttributeClass object.
|
|
93
|
+
*/
|
|
94
|
+
visitCustomAttributeClass(customAttribute: CustomAttributeClass): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Called for each [CustomAttribute]($ecschema-metadata) container in the schema.
|
|
97
|
+
* @param customAttributeContainer a [[CustomAttributeContainerProps]] object.
|
|
98
|
+
*/
|
|
99
|
+
visitCustomAttributeContainer(container: CustomAttributeContainerProps): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Called for each [Enumeration]($ecschema-metadata) instance found during schema traversal.
|
|
102
|
+
* @param enumeration an Enumeration object.
|
|
103
|
+
*/
|
|
104
|
+
visitEnumeration(enumeration: Enumeration): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Called for each [KindOfQuantity]($ecschema-metadata) instance found during schema traversal.
|
|
107
|
+
* @param koq a KindOfQuantity object.
|
|
108
|
+
*/
|
|
109
|
+
visitKindOfQuantity(koq: KindOfQuantity): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Called for each [PropertyCategory]($ecschema-metadata) instance found during schema traversal.
|
|
112
|
+
* @param category a PropertyCategory object.
|
|
113
|
+
*/
|
|
114
|
+
visitPropertyCategory(category: PropertyCategory): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Called for each [Format]($ecschema-metadata) instance found during schema traversal.
|
|
117
|
+
* @param format a Format object.
|
|
118
|
+
*/
|
|
119
|
+
visitFormat(format: Format): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Called for each [Unit]($ecschema-metadata) instance found during schema traversal.
|
|
122
|
+
* @param unit a Unit object.
|
|
123
|
+
*/
|
|
124
|
+
visitUnit(unit: Unit): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* Called for each [InvertedUnit]($ecschema-metadata) instance found during schema traversal.
|
|
127
|
+
* @param invertedUnit an InvertedUnit object.
|
|
128
|
+
*/
|
|
129
|
+
visitInvertedUnit(invertedUnit: InvertedUnit): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Called for each [UnitSystem]($ecschema-metadata) instance found during schema traversal.
|
|
132
|
+
* @param unitSystem a UnitSystem object.
|
|
133
|
+
*/
|
|
134
|
+
visitUnitSystem(unitSystem: UnitSystem): Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* Called for each [Phenomenon]($ecschema-metadata) instance found during schema traversal.
|
|
137
|
+
* @param phenomena a Phenomenon object.
|
|
138
|
+
*/
|
|
139
|
+
visitPhenomenon(phenomenon: Phenomenon): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Called for each [Constant]($ecschema-metadata) instance found during schema traversal.
|
|
142
|
+
* @param constant a Constant object.
|
|
143
|
+
*/
|
|
144
|
+
visitConstant(constant: Constant): Promise<void>;
|
|
145
|
+
applySchemaRules(schema: Schema, ruleSet: IRuleSet): Promise<void>;
|
|
146
|
+
applySchemaItemRules(schemaItem: SchemaItem, ruleSet: IRuleSet): Promise<void>;
|
|
147
|
+
applyClassRules(ecClass: AnyClass, ruleSet: IRuleSet): Promise<void>;
|
|
148
|
+
applyPropertyRules(property: AnyProperty, ruleSet: IRuleSet): Promise<void>;
|
|
149
|
+
applyEntityRules(entityClass: EntityClass, ruleSet: IRuleSet): Promise<void>;
|
|
150
|
+
applyStructRules(structClass: StructClass, ruleSet: IRuleSet): Promise<void>;
|
|
151
|
+
applyMixinRules(mixin: Mixin, ruleSet: IRuleSet): Promise<void>;
|
|
152
|
+
applyRelationshipRules(relationship: RelationshipClass, ruleSet: IRuleSet): Promise<void>;
|
|
153
|
+
applyRelationshipConstraintRules(constraint: RelationshipConstraint, ruleSet: IRuleSet): Promise<void>;
|
|
154
|
+
applyCustomAttributeRules(customAttribute: CustomAttributeClass, ruleSet: IRuleSet): Promise<void>;
|
|
155
|
+
applyCustomAttributeContainerRules(container: CustomAttributeContainerProps, ruleSet: IRuleSet): Promise<void>;
|
|
156
|
+
applyCustomAttributeInstanceRules(container: CustomAttributeContainerProps, customAttribute: CustomAttribute, ruleSet: IRuleSet): Promise<void>;
|
|
157
|
+
applyEnumerationRules(enumeration: Enumeration, ruleSet: IRuleSet): Promise<void>;
|
|
158
|
+
applyKindOfQuantityRules(kindOfQuantity: KindOfQuantity, ruleSet: IRuleSet): Promise<void>;
|
|
159
|
+
applyPropertyCategoryRules(propertyCategory: PropertyCategory, ruleSet: IRuleSet): Promise<void>;
|
|
160
|
+
applyFormatRules(format: Format, ruleSet: IRuleSet): Promise<void>;
|
|
161
|
+
applyUnitRules(unit: Unit, ruleSet: IRuleSet): Promise<void>;
|
|
162
|
+
applyInvertedUnitRules(invertedUnit: InvertedUnit, ruleSet: IRuleSet): Promise<void>;
|
|
163
|
+
applyUnitSystemRules(unitSystem: UnitSystem, ruleSet: IRuleSet): Promise<void>;
|
|
164
|
+
applyPhenomenonRules(phenomenon: Phenomenon, ruleSet: IRuleSet): Promise<void>;
|
|
165
|
+
applyConstantRules(constant: Constant, ruleSet: IRuleSet): Promise<void>;
|
|
166
|
+
private findSuppressionRule;
|
|
167
|
+
private excludeSchemaFromRuleSet;
|
|
168
|
+
private reportDiagnostics;
|
|
169
|
+
}
|
|
170
|
+
export {};
|
|
171
171
|
//# sourceMappingURL=SchemaValidationVisitor.d.ts.map
|