@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.
Files changed (104) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/lib/cjs/Editing/Constants.d.ts +20 -20
  3. package/lib/cjs/Editing/Constants.js +60 -60
  4. package/lib/cjs/Editing/CustomAttributes.d.ts +20 -20
  5. package/lib/cjs/Editing/CustomAttributes.js +59 -59
  6. package/lib/cjs/Editing/ECClasses.d.ts +54 -54
  7. package/lib/cjs/Editing/ECClasses.js +269 -269
  8. package/lib/cjs/Editing/Editor.d.ts +112 -112
  9. package/lib/cjs/Editing/Editor.js +166 -166
  10. package/lib/cjs/Editing/Entities.d.ts +25 -25
  11. package/lib/cjs/Editing/Entities.js +116 -116
  12. package/lib/cjs/Editing/Entities.js.map +1 -1
  13. package/lib/cjs/Editing/Enumerations.d.ts +21 -21
  14. package/lib/cjs/Editing/Enumerations.js +66 -66
  15. package/lib/cjs/Editing/Formats.d.ts +21 -21
  16. package/lib/cjs/Editing/Formats.js +61 -61
  17. package/lib/cjs/Editing/InvertedUnits.d.ts +17 -17
  18. package/lib/cjs/Editing/InvertedUnits.js +82 -82
  19. package/lib/cjs/Editing/KindOfQuantities.d.ts +28 -28
  20. package/lib/cjs/Editing/KindOfQuantities.js +78 -78
  21. package/lib/cjs/Editing/Mixins.d.ts +22 -22
  22. package/lib/cjs/Editing/Mixins.js +84 -84
  23. package/lib/cjs/Editing/Mutable/MutableCAClass.d.ts +9 -9
  24. package/lib/cjs/Editing/Mutable/MutableCAClass.js +15 -15
  25. package/lib/cjs/Editing/Mutable/MutableClass.d.ts +34 -34
  26. package/lib/cjs/Editing/Mutable/MutableClass.js +22 -22
  27. package/lib/cjs/Editing/Mutable/MutableConstant.d.ts +12 -12
  28. package/lib/cjs/Editing/Mutable/MutableConstant.js +15 -15
  29. package/lib/cjs/Editing/Mutable/MutableEntityClass.d.ts +15 -15
  30. package/lib/cjs/Editing/Mutable/MutableEntityClass.js +59 -59
  31. package/lib/cjs/Editing/Mutable/MutableEnumeration.d.ts +9 -9
  32. package/lib/cjs/Editing/Mutable/MutableEnumeration.js +14 -14
  33. package/lib/cjs/Editing/Mutable/MutableFormat.d.ts +18 -18
  34. package/lib/cjs/Editing/Mutable/MutableFormat.js +15 -15
  35. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.d.ts +10 -10
  36. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js +15 -15
  37. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.d.ts +10 -10
  38. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js +15 -15
  39. package/lib/cjs/Editing/Mutable/MutableMixin.d.ts +11 -11
  40. package/lib/cjs/Editing/Mutable/MutableMixin.js +15 -15
  41. package/lib/cjs/Editing/Mutable/MutablePhenomenon.d.ts +9 -9
  42. package/lib/cjs/Editing/Mutable/MutablePhenomenon.js +15 -15
  43. package/lib/cjs/Editing/Mutable/MutableProperty.d.ts +8 -8
  44. package/lib/cjs/Editing/Mutable/MutableProperty.js +15 -15
  45. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.d.ts +9 -9
  46. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js +15 -15
  47. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.d.ts +21 -21
  48. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js +24 -24
  49. package/lib/cjs/Editing/Mutable/MutableSchema.d.ts +45 -45
  50. package/lib/cjs/Editing/Mutable/MutableSchema.js +17 -17
  51. package/lib/cjs/Editing/Mutable/MutableUnit.d.ts +11 -11
  52. package/lib/cjs/Editing/Mutable/MutableUnit.js +15 -15
  53. package/lib/cjs/Editing/Mutable/MutableUnitSystem.d.ts +8 -8
  54. package/lib/cjs/Editing/Mutable/MutableUnitSystem.js +15 -15
  55. package/lib/cjs/Editing/Phenomena.d.ts +15 -15
  56. package/lib/cjs/Editing/Phenomena.js +44 -44
  57. package/lib/cjs/Editing/PropertyCategories.d.ts +16 -16
  58. package/lib/cjs/Editing/PropertyCategories.js +51 -51
  59. package/lib/cjs/Editing/RelationshipClasses.d.ts +21 -21
  60. package/lib/cjs/Editing/RelationshipClasses.js +68 -68
  61. package/lib/cjs/Editing/Structs.d.ts +19 -19
  62. package/lib/cjs/Editing/Structs.js +57 -57
  63. package/lib/cjs/Editing/UnitSystems.d.ts +15 -15
  64. package/lib/cjs/Editing/UnitSystems.js +41 -41
  65. package/lib/cjs/Editing/Units.d.ts +15 -15
  66. package/lib/cjs/Editing/Units.js +58 -58
  67. package/lib/cjs/Validation/Diagnostic.d.ts +321 -321
  68. package/lib/cjs/Validation/Diagnostic.d.ts.map +1 -1
  69. package/lib/cjs/Validation/Diagnostic.js +310 -310
  70. package/lib/cjs/Validation/Diagnostic.js.map +1 -1
  71. package/lib/cjs/Validation/DiagnosticReporter.d.ts +96 -96
  72. package/lib/cjs/Validation/DiagnosticReporter.js +106 -106
  73. package/lib/cjs/Validation/ECRules.d.ts +448 -448
  74. package/lib/cjs/Validation/ECRules.js +593 -593
  75. package/lib/cjs/Validation/LoggingDiagnosticReporter.d.ts +13 -13
  76. package/lib/cjs/Validation/LoggingDiagnosticReporter.js +40 -40
  77. package/lib/cjs/Validation/RuleSuppressionSet.d.ts +59 -59
  78. package/lib/cjs/Validation/RuleSuppressionSet.d.ts.map +1 -1
  79. package/lib/cjs/Validation/RuleSuppressionSet.js +9 -9
  80. package/lib/cjs/Validation/Rules.d.ts +64 -64
  81. package/lib/cjs/Validation/Rules.d.ts.map +1 -1
  82. package/lib/cjs/Validation/Rules.js +9 -9
  83. package/lib/cjs/Validation/SchemaChanges.d.ts +607 -607
  84. package/lib/cjs/Validation/SchemaChanges.js +1135 -1135
  85. package/lib/cjs/Validation/SchemaCompareDiagnostics.d.ts +422 -422
  86. package/lib/cjs/Validation/SchemaCompareDiagnostics.js +111 -111
  87. package/lib/cjs/Validation/SchemaCompareReporter.d.ts +11 -11
  88. package/lib/cjs/Validation/SchemaCompareReporter.js +9 -9
  89. package/lib/cjs/Validation/SchemaCompareResultDelegate.d.ts +236 -236
  90. package/lib/cjs/Validation/SchemaCompareResultDelegate.js +348 -348
  91. package/lib/cjs/Validation/SchemaCompareVisitor.d.ts +119 -119
  92. package/lib/cjs/Validation/SchemaCompareVisitor.js +206 -206
  93. package/lib/cjs/Validation/SchemaComparer.d.ts +171 -171
  94. package/lib/cjs/Validation/SchemaComparer.js +666 -666
  95. package/lib/cjs/Validation/SchemaValidater.d.ts +19 -19
  96. package/lib/cjs/Validation/SchemaValidater.js +61 -61
  97. package/lib/cjs/Validation/SchemaValidationVisitor.d.ts +170 -170
  98. package/lib/cjs/Validation/SchemaValidationVisitor.js +492 -492
  99. package/lib/cjs/Validation/SchemaWalker.d.ts +22 -22
  100. package/lib/cjs/Validation/SchemaWalker.js +51 -51
  101. package/lib/cjs/ecschema-editing.d.ts +33 -33
  102. package/lib/cjs/ecschema-editing.js +58 -54
  103. package/lib/cjs/ecschema-editing.js.map +1 -1
  104. package/package.json +12 -12
@@ -1,120 +1,120 @@
1
- /** @packageDocumentation
2
- * @module Comparison
3
- */
4
- import { AnyClass, AnyProperty, Constant, CustomAttributeClass, CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, ISchemaPartVisitor, KindOfQuantity, Mixin, Phenomenon, PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, StructClass, Unit, UnitSystem } from "@itwin/ecschema-metadata";
5
- import { ISchemaComparer } from "./SchemaComparer";
6
- /**
7
- * An ISchemaPartVisitor interface implementation that is used to compare to Schemas.
8
- * @internal
9
- */
10
- export declare class SchemaCompareVisitor implements ISchemaPartVisitor {
11
- private _schemaB;
12
- private _schemaComparer;
13
- /**
14
- * Initializes a new SchemaCompareVisitor instance.
15
- * @param schemaComparer The [[SchemaComparer]] to use to compare each item of the schema.
16
- * @param schemaToCompare The second or 'B' schema to compare against the schema being traversed (Schema A).
17
- */
18
- constructor(schemaComparer: ISchemaComparer, schemaToCompare: Schema);
19
- /**
20
- * Called before schema traversal.
21
- * @param schema a Schema object.
22
- */
23
- visitFullSchema(schemaA: Schema): Promise<void>;
24
- /**
25
- * Called for each [[SchemaItem]] instance found during schema traversal.
26
- * @param schemaItem a SchemaItem object.
27
- */
28
- visitSchemaItem(schemaItemA: SchemaItem): Promise<void>;
29
- /**
30
- * Called for each [[AnyClass]] instance found during schema traversal.
31
- * @param ecClass an ECClass object.
32
- */
33
- visitClass(classA: AnyClass): Promise<void>;
34
- /**
35
- * Called for each [[AnyProperty]] instance of an ECClass.
36
- * @param property an AnyProperty object.
37
- */
38
- visitProperty(propertyA: AnyProperty): Promise<void>;
39
- /**
40
- * Called for each [[EntityClass]] instance found during schema traversal.
41
- * @param entityClass an EntityClass object.
42
- */
43
- visitEntityClass(entityA: EntityClass): Promise<void>;
44
- /**
45
- * Called for each [[StructClass]] instance found during schema traversal.
46
- * @param structClass a StructClass object.
47
- */
48
- visitStructClass(_structA: StructClass): Promise<void>;
49
- /**
50
- * Called for each [[Mixin]] instance found during schema traversal.
51
- * @param mixin a Mixin object.
52
- */
53
- visitMixin(mixinA: Mixin): Promise<void>;
54
- /**
55
- * Called for each [[RelationshipClass]] instance found during schema traversal.
56
- * @param relationshipClass a RelationshipClass object.
57
- */
58
- visitRelationshipClass(relationshipA: RelationshipClass): Promise<void>;
59
- /**
60
- * Called for each [[RelationshipConstraint]] of each RelationshipClass found during schema traversal.
61
- * @param relationshipConstraint a RelationshipConstraint object.
62
- */
63
- visitRelationshipConstraint(constraintA: RelationshipConstraint): Promise<void>;
64
- /**
65
- * Called for each [[CustomAttributeClass]] instance found during schema traversal.
66
- * @param customAttributeClass a CustomAttributeClass object.
67
- */
68
- visitCustomAttributeClass(customAttributeA: CustomAttributeClass): Promise<void>;
69
- /**
70
- * Called for each [[CustomAttribute]] container in the schema.
71
- * @param customAttributeContainer a [[CustomAttributeContainerProps]] object.
72
- */
73
- visitCustomAttributeContainer(containerA: CustomAttributeContainerProps): Promise<void>;
74
- /**
75
- * Called for each [[Enumeration]] instance found during schema traversal.
76
- * @param enumeration an Enumeration object.
77
- */
78
- visitEnumeration(enumA: Enumeration): Promise<void>;
79
- /**
80
- * Called for each [[KindOfQuantity]] instance found during schema traversal.
81
- * @param koq a KindOfQuantity object.
82
- */
83
- visitKindOfQuantity(koqA: KindOfQuantity): Promise<void>;
84
- /**
85
- * Called for each [[PropertyCategory]] instance found during schema traversal.
86
- * @param category a PropertyCategory object.
87
- */
88
- visitPropertyCategory(categoryA: PropertyCategory): Promise<void>;
89
- /**
90
- * Called for each [[Format]] instance found during schema traversal.
91
- * @param format a Format object.
92
- */
93
- visitFormat(formatA: Format): Promise<void>;
94
- /**
95
- * Called for each [[Unit]] instance found during schema traversal.
96
- * @param unit a Unit object.
97
- */
98
- visitUnit(unitA: Unit): Promise<void>;
99
- /**
100
- * Called for each [[InvertedUnit]] instance found during schema traversal.
101
- * @param invertedUnit an InvertedUnit object.
102
- */
103
- visitInvertedUnit(invertedUnitA: InvertedUnit): Promise<void>;
104
- /**
105
- * Called for each [[UnitSystem]] instance found during schema traversal.
106
- * @param unitSystem a UnitSystem object.
107
- */
108
- visitUnitSystem(_unitSystemA: UnitSystem): Promise<void>;
109
- /**
110
- * Called for each [[Phenomenon]] instance found during schema traversal.
111
- * @param phenomena a Phenomenon object.
112
- */
113
- visitPhenomenon(phenomenonA: Phenomenon): Promise<void>;
114
- /**
115
- * Called for each [[Constant]] instance found during schema traversal.
116
- * @param constant a Constant object.
117
- */
118
- visitConstant(constantA: Constant): Promise<void>;
119
- }
1
+ /** @packageDocumentation
2
+ * @module Comparison
3
+ */
4
+ import { AnyClass, AnyProperty, Constant, CustomAttributeClass, CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, ISchemaPartVisitor, KindOfQuantity, Mixin, Phenomenon, PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, StructClass, Unit, UnitSystem } from "@itwin/ecschema-metadata";
5
+ import { ISchemaComparer } from "./SchemaComparer";
6
+ /**
7
+ * An ISchemaPartVisitor interface implementation that is used to compare to Schemas.
8
+ * @internal
9
+ */
10
+ export declare class SchemaCompareVisitor implements ISchemaPartVisitor {
11
+ private _schemaB;
12
+ private _schemaComparer;
13
+ /**
14
+ * Initializes a new SchemaCompareVisitor instance.
15
+ * @param schemaComparer The [[SchemaComparer]] to use to compare each item of the schema.
16
+ * @param schemaToCompare The second or 'B' schema to compare against the schema being traversed (Schema A).
17
+ */
18
+ constructor(schemaComparer: ISchemaComparer, schemaToCompare: Schema);
19
+ /**
20
+ * Called before schema traversal.
21
+ * @param schema a Schema object.
22
+ */
23
+ visitFullSchema(schemaA: Schema): Promise<void>;
24
+ /**
25
+ * Called for each [[SchemaItem]] instance found during schema traversal.
26
+ * @param schemaItem a SchemaItem object.
27
+ */
28
+ visitSchemaItem(schemaItemA: SchemaItem): Promise<void>;
29
+ /**
30
+ * Called for each [[AnyClass]] instance found during schema traversal.
31
+ * @param ecClass an ECClass object.
32
+ */
33
+ visitClass(classA: AnyClass): Promise<void>;
34
+ /**
35
+ * Called for each [[AnyProperty]] instance of an ECClass.
36
+ * @param property an AnyProperty object.
37
+ */
38
+ visitProperty(propertyA: AnyProperty): Promise<void>;
39
+ /**
40
+ * Called for each [[EntityClass]] instance found during schema traversal.
41
+ * @param entityClass an EntityClass object.
42
+ */
43
+ visitEntityClass(entityA: EntityClass): Promise<void>;
44
+ /**
45
+ * Called for each [[StructClass]] instance found during schema traversal.
46
+ * @param structClass a StructClass object.
47
+ */
48
+ visitStructClass(_structA: StructClass): Promise<void>;
49
+ /**
50
+ * Called for each [[Mixin]] instance found during schema traversal.
51
+ * @param mixin a Mixin object.
52
+ */
53
+ visitMixin(mixinA: Mixin): Promise<void>;
54
+ /**
55
+ * Called for each [[RelationshipClass]] instance found during schema traversal.
56
+ * @param relationshipClass a RelationshipClass object.
57
+ */
58
+ visitRelationshipClass(relationshipA: RelationshipClass): Promise<void>;
59
+ /**
60
+ * Called for each [[RelationshipConstraint]] of each RelationshipClass found during schema traversal.
61
+ * @param relationshipConstraint a RelationshipConstraint object.
62
+ */
63
+ visitRelationshipConstraint(constraintA: RelationshipConstraint): Promise<void>;
64
+ /**
65
+ * Called for each [[CustomAttributeClass]] instance found during schema traversal.
66
+ * @param customAttributeClass a CustomAttributeClass object.
67
+ */
68
+ visitCustomAttributeClass(customAttributeA: CustomAttributeClass): Promise<void>;
69
+ /**
70
+ * Called for each [[CustomAttribute]] container in the schema.
71
+ * @param customAttributeContainer a [[CustomAttributeContainerProps]] object.
72
+ */
73
+ visitCustomAttributeContainer(containerA: CustomAttributeContainerProps): Promise<void>;
74
+ /**
75
+ * Called for each [[Enumeration]] instance found during schema traversal.
76
+ * @param enumeration an Enumeration object.
77
+ */
78
+ visitEnumeration(enumA: Enumeration): Promise<void>;
79
+ /**
80
+ * Called for each [[KindOfQuantity]] instance found during schema traversal.
81
+ * @param koq a KindOfQuantity object.
82
+ */
83
+ visitKindOfQuantity(koqA: KindOfQuantity): Promise<void>;
84
+ /**
85
+ * Called for each [[PropertyCategory]] instance found during schema traversal.
86
+ * @param category a PropertyCategory object.
87
+ */
88
+ visitPropertyCategory(categoryA: PropertyCategory): Promise<void>;
89
+ /**
90
+ * Called for each [[Format]] instance found during schema traversal.
91
+ * @param format a Format object.
92
+ */
93
+ visitFormat(formatA: Format): Promise<void>;
94
+ /**
95
+ * Called for each [[Unit]] instance found during schema traversal.
96
+ * @param unit a Unit object.
97
+ */
98
+ visitUnit(unitA: Unit): Promise<void>;
99
+ /**
100
+ * Called for each [[InvertedUnit]] instance found during schema traversal.
101
+ * @param invertedUnit an InvertedUnit object.
102
+ */
103
+ visitInvertedUnit(invertedUnitA: InvertedUnit): Promise<void>;
104
+ /**
105
+ * Called for each [[UnitSystem]] instance found during schema traversal.
106
+ * @param unitSystem a UnitSystem object.
107
+ */
108
+ visitUnitSystem(_unitSystemA: UnitSystem): Promise<void>;
109
+ /**
110
+ * Called for each [[Phenomenon]] instance found during schema traversal.
111
+ * @param phenomena a Phenomenon object.
112
+ */
113
+ visitPhenomenon(phenomenonA: Phenomenon): Promise<void>;
114
+ /**
115
+ * Called for each [[Constant]] instance found during schema traversal.
116
+ * @param constant a Constant object.
117
+ */
118
+ visitConstant(constantA: Constant): Promise<void>;
119
+ }
120
120
  //# sourceMappingURL=SchemaCompareVisitor.d.ts.map
@@ -1,207 +1,207 @@
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 Comparison
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.SchemaCompareVisitor = void 0;
11
- const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
12
- /**
13
- * An ISchemaPartVisitor interface implementation that is used to compare to Schemas.
14
- * @internal
15
- */
16
- class SchemaCompareVisitor {
17
- /**
18
- * Initializes a new SchemaCompareVisitor instance.
19
- * @param schemaComparer The [[SchemaComparer]] to use to compare each item of the schema.
20
- * @param schemaToCompare The second or 'B' schema to compare against the schema being traversed (Schema A).
21
- */
22
- constructor(schemaComparer, schemaToCompare) {
23
- this._schemaComparer = schemaComparer;
24
- this._schemaB = schemaToCompare;
25
- }
26
- /**
27
- * Called before schema traversal.
28
- * @param schema a Schema object.
29
- */
30
- async visitFullSchema(schemaA) {
31
- this._schemaComparer.compareSchemaProps(schemaA, this._schemaB);
32
- }
33
- /**
34
- * Called for each [[SchemaItem]] instance found during schema traversal.
35
- * @param schemaItem a SchemaItem object.
36
- */
37
- async visitSchemaItem(schemaItemA) {
38
- const schemaItemB = await this._schemaB.lookupItem(schemaItemA.key);
39
- this._schemaComparer.compareSchemaItems(schemaItemA, schemaItemB);
40
- }
41
- /**
42
- * Called for each [[AnyClass]] instance found during schema traversal.
43
- * @param ecClass an ECClass object.
44
- */
45
- async visitClass(classA) {
46
- const classB = await this._schemaB.lookupItem(classA.key);
47
- this._schemaComparer.compareClasses(classA, classB);
48
- }
49
- /**
50
- * Called for each [[AnyProperty]] instance of an ECClass.
51
- * @param property an AnyProperty object.
52
- */
53
- async visitProperty(propertyA) {
54
- let propertyB;
55
- const classB = await this._schemaB.lookupItem(propertyA.class.key);
56
- if (classB)
57
- propertyB = await classB.getProperty(propertyA.name);
58
- this._schemaComparer.compareProperties(propertyA, propertyB);
59
- }
60
- /**
61
- * Called for each [[EntityClass]] instance found during schema traversal.
62
- * @param entityClass an EntityClass object.
63
- */
64
- async visitEntityClass(entityA) {
65
- const entityB = await this._schemaB.lookupItem(entityA.key);
66
- this._schemaComparer.compareEntityClasses(entityA, entityB);
67
- }
68
- /**
69
- * Called for each [[StructClass]] instance found during schema traversal.
70
- * @param structClass a StructClass object.
71
- */
72
- async visitStructClass(_structA) {
73
- // No comparison to make specifically on StructClasses
74
- }
75
- /**
76
- * Called for each [[Mixin]] instance found during schema traversal.
77
- * @param mixin a Mixin object.
78
- */
79
- async visitMixin(mixinA) {
80
- const mixinB = await this._schemaB.lookupItem(mixinA.key);
81
- this._schemaComparer.compareMixins(mixinA, mixinB);
82
- }
83
- /**
84
- * Called for each [[RelationshipClass]] instance found during schema traversal.
85
- * @param relationshipClass a RelationshipClass object.
86
- */
87
- async visitRelationshipClass(relationshipA) {
88
- const relationshipB = await this._schemaB.lookupItem(relationshipA.key);
89
- this._schemaComparer.compareRelationshipClasses(relationshipA, relationshipB);
90
- }
91
- /**
92
- * Called for each [[RelationshipConstraint]] of each RelationshipClass found during schema traversal.
93
- * @param relationshipConstraint a RelationshipConstraint object.
94
- */
95
- async visitRelationshipConstraint(constraintA) {
96
- let constraintB;
97
- const relationshipB = await this._schemaB.lookupItem(constraintA.relationshipClass.key);
98
- if (relationshipB)
99
- constraintB = constraintA.isSource ? relationshipB.source : relationshipB.target;
100
- this._schemaComparer.compareRelationshipConstraints(constraintA, constraintB);
101
- }
102
- /**
103
- * Called for each [[CustomAttributeClass]] instance found during schema traversal.
104
- * @param customAttributeClass a CustomAttributeClass object.
105
- */
106
- async visitCustomAttributeClass(customAttributeA) {
107
- const customAttributeB = await this._schemaB.lookupItem(customAttributeA.key);
108
- this._schemaComparer.compareCustomAttributeClasses(customAttributeA, customAttributeB);
109
- }
110
- /**
111
- * Called for each [[CustomAttribute]] container in the schema.
112
- * @param customAttributeContainer a [[CustomAttributeContainerProps]] object.
113
- */
114
- async visitCustomAttributeContainer(containerA) {
115
- const nameParts = containerA.fullName.split(".");
116
- const shortName = nameParts.length === 1 ? nameParts[0] : nameParts[1];
117
- let containerB;
118
- if (ecschema_metadata_1.Schema.isSchema(containerA)) {
119
- containerB = this._schemaB;
120
- }
121
- else if (ecschema_metadata_1.ECClass.isECClass(containerA)) {
122
- containerB = await this._schemaB.lookupItem(shortName);
123
- }
124
- else if (ecschema_metadata_1.Property.isProperty(containerA)) {
125
- const parent = await this._schemaB.lookupItem(containerA.class.key);
126
- containerB = parent ? await parent.getProperty(shortName) : undefined;
127
- }
128
- else if (ecschema_metadata_1.RelationshipConstraint.isRelationshipConstraint(containerA)) {
129
- const parent = await this._schemaB.lookupItem(containerA.relationshipClass.key);
130
- containerB = parent ? await parent.getProperty(shortName) : undefined;
131
- }
132
- this._schemaComparer.compareCustomAttributeContainers(containerA, containerB);
133
- }
134
- /**
135
- * Called for each [[Enumeration]] instance found during schema traversal.
136
- * @param enumeration an Enumeration object.
137
- */
138
- async visitEnumeration(enumA) {
139
- const enumB = await this._schemaB.lookupItem(enumA.key);
140
- this._schemaComparer.compareEnumerations(enumA, enumB);
141
- }
142
- /**
143
- * Called for each [[KindOfQuantity]] instance found during schema traversal.
144
- * @param koq a KindOfQuantity object.
145
- */
146
- async visitKindOfQuantity(koqA) {
147
- const koqB = await this._schemaB.lookupItem(koqA.key);
148
- this._schemaComparer.compareKindOfQuantities(koqA, koqB);
149
- }
150
- /**
151
- * Called for each [[PropertyCategory]] instance found during schema traversal.
152
- * @param category a PropertyCategory object.
153
- */
154
- async visitPropertyCategory(categoryA) {
155
- const categoryB = await this._schemaB.lookupItem(categoryA.key);
156
- this._schemaComparer.comparePropertyCategories(categoryA, categoryB);
157
- }
158
- /**
159
- * Called for each [[Format]] instance found during schema traversal.
160
- * @param format a Format object.
161
- */
162
- async visitFormat(formatA) {
163
- const formatB = await this._schemaB.lookupItem(formatA.key);
164
- this._schemaComparer.compareFormats(formatA, formatB);
165
- }
166
- /**
167
- * Called for each [[Unit]] instance found during schema traversal.
168
- * @param unit a Unit object.
169
- */
170
- async visitUnit(unitA) {
171
- const unitB = await this._schemaB.lookupItem(unitA.key);
172
- this._schemaComparer.compareUnits(unitA, unitB);
173
- }
174
- /**
175
- * Called for each [[InvertedUnit]] instance found during schema traversal.
176
- * @param invertedUnit an InvertedUnit object.
177
- */
178
- async visitInvertedUnit(invertedUnitA) {
179
- const invertedUnitB = await this._schemaB.lookupItem(invertedUnitA.key);
180
- this._schemaComparer.compareInvertedUnits(invertedUnitA, invertedUnitB);
181
- }
182
- /**
183
- * Called for each [[UnitSystem]] instance found during schema traversal.
184
- * @param unitSystem a UnitSystem object.
185
- */
186
- async visitUnitSystem(_unitSystemA) {
187
- // No comparison to make specifically on unitSystem
188
- }
189
- /**
190
- * Called for each [[Phenomenon]] instance found during schema traversal.
191
- * @param phenomena a Phenomenon object.
192
- */
193
- async visitPhenomenon(phenomenonA) {
194
- const phenomenonB = await this._schemaB.lookupItem(phenomenonA.key);
195
- this._schemaComparer.comparePhenomenons(phenomenonA, phenomenonB);
196
- }
197
- /**
198
- * Called for each [[Constant]] instance found during schema traversal.
199
- * @param constant a Constant object.
200
- */
201
- async visitConstant(constantA) {
202
- const constantB = await this._schemaB.lookupItem(constantA.key);
203
- this._schemaComparer.compareConstants(constantA, constantB);
204
- }
205
- }
206
- exports.SchemaCompareVisitor = SchemaCompareVisitor;
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 Comparison
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.SchemaCompareVisitor = void 0;
11
+ const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
12
+ /**
13
+ * An ISchemaPartVisitor interface implementation that is used to compare to Schemas.
14
+ * @internal
15
+ */
16
+ class SchemaCompareVisitor {
17
+ /**
18
+ * Initializes a new SchemaCompareVisitor instance.
19
+ * @param schemaComparer The [[SchemaComparer]] to use to compare each item of the schema.
20
+ * @param schemaToCompare The second or 'B' schema to compare against the schema being traversed (Schema A).
21
+ */
22
+ constructor(schemaComparer, schemaToCompare) {
23
+ this._schemaComparer = schemaComparer;
24
+ this._schemaB = schemaToCompare;
25
+ }
26
+ /**
27
+ * Called before schema traversal.
28
+ * @param schema a Schema object.
29
+ */
30
+ async visitFullSchema(schemaA) {
31
+ this._schemaComparer.compareSchemaProps(schemaA, this._schemaB);
32
+ }
33
+ /**
34
+ * Called for each [[SchemaItem]] instance found during schema traversal.
35
+ * @param schemaItem a SchemaItem object.
36
+ */
37
+ async visitSchemaItem(schemaItemA) {
38
+ const schemaItemB = await this._schemaB.lookupItem(schemaItemA.key);
39
+ this._schemaComparer.compareSchemaItems(schemaItemA, schemaItemB);
40
+ }
41
+ /**
42
+ * Called for each [[AnyClass]] instance found during schema traversal.
43
+ * @param ecClass an ECClass object.
44
+ */
45
+ async visitClass(classA) {
46
+ const classB = await this._schemaB.lookupItem(classA.key);
47
+ this._schemaComparer.compareClasses(classA, classB);
48
+ }
49
+ /**
50
+ * Called for each [[AnyProperty]] instance of an ECClass.
51
+ * @param property an AnyProperty object.
52
+ */
53
+ async visitProperty(propertyA) {
54
+ let propertyB;
55
+ const classB = await this._schemaB.lookupItem(propertyA.class.key);
56
+ if (classB)
57
+ propertyB = await classB.getProperty(propertyA.name);
58
+ this._schemaComparer.compareProperties(propertyA, propertyB);
59
+ }
60
+ /**
61
+ * Called for each [[EntityClass]] instance found during schema traversal.
62
+ * @param entityClass an EntityClass object.
63
+ */
64
+ async visitEntityClass(entityA) {
65
+ const entityB = await this._schemaB.lookupItem(entityA.key);
66
+ this._schemaComparer.compareEntityClasses(entityA, entityB);
67
+ }
68
+ /**
69
+ * Called for each [[StructClass]] instance found during schema traversal.
70
+ * @param structClass a StructClass object.
71
+ */
72
+ async visitStructClass(_structA) {
73
+ // No comparison to make specifically on StructClasses
74
+ }
75
+ /**
76
+ * Called for each [[Mixin]] instance found during schema traversal.
77
+ * @param mixin a Mixin object.
78
+ */
79
+ async visitMixin(mixinA) {
80
+ const mixinB = await this._schemaB.lookupItem(mixinA.key);
81
+ this._schemaComparer.compareMixins(mixinA, mixinB);
82
+ }
83
+ /**
84
+ * Called for each [[RelationshipClass]] instance found during schema traversal.
85
+ * @param relationshipClass a RelationshipClass object.
86
+ */
87
+ async visitRelationshipClass(relationshipA) {
88
+ const relationshipB = await this._schemaB.lookupItem(relationshipA.key);
89
+ this._schemaComparer.compareRelationshipClasses(relationshipA, relationshipB);
90
+ }
91
+ /**
92
+ * Called for each [[RelationshipConstraint]] of each RelationshipClass found during schema traversal.
93
+ * @param relationshipConstraint a RelationshipConstraint object.
94
+ */
95
+ async visitRelationshipConstraint(constraintA) {
96
+ let constraintB;
97
+ const relationshipB = await this._schemaB.lookupItem(constraintA.relationshipClass.key);
98
+ if (relationshipB)
99
+ constraintB = constraintA.isSource ? relationshipB.source : relationshipB.target;
100
+ this._schemaComparer.compareRelationshipConstraints(constraintA, constraintB);
101
+ }
102
+ /**
103
+ * Called for each [[CustomAttributeClass]] instance found during schema traversal.
104
+ * @param customAttributeClass a CustomAttributeClass object.
105
+ */
106
+ async visitCustomAttributeClass(customAttributeA) {
107
+ const customAttributeB = await this._schemaB.lookupItem(customAttributeA.key);
108
+ this._schemaComparer.compareCustomAttributeClasses(customAttributeA, customAttributeB);
109
+ }
110
+ /**
111
+ * Called for each [[CustomAttribute]] container in the schema.
112
+ * @param customAttributeContainer a [[CustomAttributeContainerProps]] object.
113
+ */
114
+ async visitCustomAttributeContainer(containerA) {
115
+ const nameParts = containerA.fullName.split(".");
116
+ const shortName = nameParts.length === 1 ? nameParts[0] : nameParts[1];
117
+ let containerB;
118
+ if (ecschema_metadata_1.Schema.isSchema(containerA)) {
119
+ containerB = this._schemaB;
120
+ }
121
+ else if (ecschema_metadata_1.ECClass.isECClass(containerA)) {
122
+ containerB = await this._schemaB.lookupItem(shortName);
123
+ }
124
+ else if (ecschema_metadata_1.Property.isProperty(containerA)) {
125
+ const parent = await this._schemaB.lookupItem(containerA.class.key);
126
+ containerB = parent ? await parent.getProperty(shortName) : undefined;
127
+ }
128
+ else if (ecschema_metadata_1.RelationshipConstraint.isRelationshipConstraint(containerA)) {
129
+ const parent = await this._schemaB.lookupItem(containerA.relationshipClass.key);
130
+ containerB = parent ? await parent.getProperty(shortName) : undefined;
131
+ }
132
+ this._schemaComparer.compareCustomAttributeContainers(containerA, containerB);
133
+ }
134
+ /**
135
+ * Called for each [[Enumeration]] instance found during schema traversal.
136
+ * @param enumeration an Enumeration object.
137
+ */
138
+ async visitEnumeration(enumA) {
139
+ const enumB = await this._schemaB.lookupItem(enumA.key);
140
+ this._schemaComparer.compareEnumerations(enumA, enumB);
141
+ }
142
+ /**
143
+ * Called for each [[KindOfQuantity]] instance found during schema traversal.
144
+ * @param koq a KindOfQuantity object.
145
+ */
146
+ async visitKindOfQuantity(koqA) {
147
+ const koqB = await this._schemaB.lookupItem(koqA.key);
148
+ this._schemaComparer.compareKindOfQuantities(koqA, koqB);
149
+ }
150
+ /**
151
+ * Called for each [[PropertyCategory]] instance found during schema traversal.
152
+ * @param category a PropertyCategory object.
153
+ */
154
+ async visitPropertyCategory(categoryA) {
155
+ const categoryB = await this._schemaB.lookupItem(categoryA.key);
156
+ this._schemaComparer.comparePropertyCategories(categoryA, categoryB);
157
+ }
158
+ /**
159
+ * Called for each [[Format]] instance found during schema traversal.
160
+ * @param format a Format object.
161
+ */
162
+ async visitFormat(formatA) {
163
+ const formatB = await this._schemaB.lookupItem(formatA.key);
164
+ this._schemaComparer.compareFormats(formatA, formatB);
165
+ }
166
+ /**
167
+ * Called for each [[Unit]] instance found during schema traversal.
168
+ * @param unit a Unit object.
169
+ */
170
+ async visitUnit(unitA) {
171
+ const unitB = await this._schemaB.lookupItem(unitA.key);
172
+ this._schemaComparer.compareUnits(unitA, unitB);
173
+ }
174
+ /**
175
+ * Called for each [[InvertedUnit]] instance found during schema traversal.
176
+ * @param invertedUnit an InvertedUnit object.
177
+ */
178
+ async visitInvertedUnit(invertedUnitA) {
179
+ const invertedUnitB = await this._schemaB.lookupItem(invertedUnitA.key);
180
+ this._schemaComparer.compareInvertedUnits(invertedUnitA, invertedUnitB);
181
+ }
182
+ /**
183
+ * Called for each [[UnitSystem]] instance found during schema traversal.
184
+ * @param unitSystem a UnitSystem object.
185
+ */
186
+ async visitUnitSystem(_unitSystemA) {
187
+ // No comparison to make specifically on unitSystem
188
+ }
189
+ /**
190
+ * Called for each [[Phenomenon]] instance found during schema traversal.
191
+ * @param phenomena a Phenomenon object.
192
+ */
193
+ async visitPhenomenon(phenomenonA) {
194
+ const phenomenonB = await this._schemaB.lookupItem(phenomenonA.key);
195
+ this._schemaComparer.comparePhenomenons(phenomenonA, phenomenonB);
196
+ }
197
+ /**
198
+ * Called for each [[Constant]] instance found during schema traversal.
199
+ * @param constant a Constant object.
200
+ */
201
+ async visitConstant(constantA) {
202
+ const constantB = await this._schemaB.lookupItem(constantA.key);
203
+ this._schemaComparer.compareConstants(constantA, constantB);
204
+ }
205
+ }
206
+ exports.SchemaCompareVisitor = SchemaCompareVisitor;
207
207
  //# sourceMappingURL=SchemaCompareVisitor.js.map