@itwin/ecschema-editing 3.0.0-dev.72

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 (197) hide show
  1. package/CHANGELOG.md +109 -0
  2. package/LICENSE.md +9 -0
  3. package/README.md +11 -0
  4. package/lib/Editing/Constants.d.ts +21 -0
  5. package/lib/Editing/Constants.d.ts.map +1 -0
  6. package/lib/Editing/Constants.js +65 -0
  7. package/lib/Editing/Constants.js.map +1 -0
  8. package/lib/Editing/CustomAttributes.d.ts +21 -0
  9. package/lib/Editing/CustomAttributes.d.ts.map +1 -0
  10. package/lib/Editing/CustomAttributes.js +59 -0
  11. package/lib/Editing/CustomAttributes.js.map +1 -0
  12. package/lib/Editing/ECClasses.d.ts +33 -0
  13. package/lib/Editing/ECClasses.d.ts.map +1 -0
  14. package/lib/Editing/ECClasses.js +186 -0
  15. package/lib/Editing/ECClasses.js.map +1 -0
  16. package/lib/Editing/Editor.d.ts +105 -0
  17. package/lib/Editing/Editor.d.ts.map +1 -0
  18. package/lib/Editing/Editor.js +175 -0
  19. package/lib/Editing/Editor.js.map +1 -0
  20. package/lib/Editing/Entities.d.ts +23 -0
  21. package/lib/Editing/Entities.d.ts.map +1 -0
  22. package/lib/Editing/Entities.js +89 -0
  23. package/lib/Editing/Entities.js.map +1 -0
  24. package/lib/Editing/Enumerations.d.ts +22 -0
  25. package/lib/Editing/Enumerations.d.ts.map +1 -0
  26. package/lib/Editing/Enumerations.js +71 -0
  27. package/lib/Editing/Enumerations.js.map +1 -0
  28. package/lib/Editing/Formats.d.ts +21 -0
  29. package/lib/Editing/Formats.d.ts.map +1 -0
  30. package/lib/Editing/Formats.js +61 -0
  31. package/lib/Editing/Formats.js.map +1 -0
  32. package/lib/Editing/InvertedUnits.d.ts +18 -0
  33. package/lib/Editing/InvertedUnits.d.ts.map +1 -0
  34. package/lib/Editing/InvertedUnits.js +86 -0
  35. package/lib/Editing/InvertedUnits.js.map +1 -0
  36. package/lib/Editing/KindOfQuantities.d.ts +29 -0
  37. package/lib/Editing/KindOfQuantities.d.ts.map +1 -0
  38. package/lib/Editing/KindOfQuantities.js +80 -0
  39. package/lib/Editing/KindOfQuantities.js.map +1 -0
  40. package/lib/Editing/Mixins.d.ts +23 -0
  41. package/lib/Editing/Mixins.d.ts.map +1 -0
  42. package/lib/Editing/Mixins.js +89 -0
  43. package/lib/Editing/Mixins.js.map +1 -0
  44. package/lib/Editing/Mutable/MutableCAClass.d.ts +10 -0
  45. package/lib/Editing/Mutable/MutableCAClass.d.ts.map +1 -0
  46. package/lib/Editing/Mutable/MutableCAClass.js +16 -0
  47. package/lib/Editing/Mutable/MutableCAClass.js.map +1 -0
  48. package/lib/Editing/Mutable/MutableClass.d.ts +35 -0
  49. package/lib/Editing/Mutable/MutableClass.d.ts.map +1 -0
  50. package/lib/Editing/Mutable/MutableClass.js +23 -0
  51. package/lib/Editing/Mutable/MutableClass.js.map +1 -0
  52. package/lib/Editing/Mutable/MutableConstant.d.ts +13 -0
  53. package/lib/Editing/Mutable/MutableConstant.d.ts.map +1 -0
  54. package/lib/Editing/Mutable/MutableConstant.js +16 -0
  55. package/lib/Editing/Mutable/MutableConstant.js.map +1 -0
  56. package/lib/Editing/Mutable/MutableEntityClass.d.ts +16 -0
  57. package/lib/Editing/Mutable/MutableEntityClass.d.ts.map +1 -0
  58. package/lib/Editing/Mutable/MutableEntityClass.js +60 -0
  59. package/lib/Editing/Mutable/MutableEntityClass.js.map +1 -0
  60. package/lib/Editing/Mutable/MutableEnumeration.d.ts +10 -0
  61. package/lib/Editing/Mutable/MutableEnumeration.d.ts.map +1 -0
  62. package/lib/Editing/Mutable/MutableEnumeration.js +15 -0
  63. package/lib/Editing/Mutable/MutableEnumeration.js.map +1 -0
  64. package/lib/Editing/Mutable/MutableFormat.d.ts +18 -0
  65. package/lib/Editing/Mutable/MutableFormat.d.ts.map +1 -0
  66. package/lib/Editing/Mutable/MutableFormat.js +16 -0
  67. package/lib/Editing/Mutable/MutableFormat.js.map +1 -0
  68. package/lib/Editing/Mutable/MutableInvertedUnit.d.ts +11 -0
  69. package/lib/Editing/Mutable/MutableInvertedUnit.d.ts.map +1 -0
  70. package/lib/Editing/Mutable/MutableInvertedUnit.js +16 -0
  71. package/lib/Editing/Mutable/MutableInvertedUnit.js.map +1 -0
  72. package/lib/Editing/Mutable/MutableKindOfQuantity.d.ts +11 -0
  73. package/lib/Editing/Mutable/MutableKindOfQuantity.d.ts.map +1 -0
  74. package/lib/Editing/Mutable/MutableKindOfQuantity.js +16 -0
  75. package/lib/Editing/Mutable/MutableKindOfQuantity.js.map +1 -0
  76. package/lib/Editing/Mutable/MutableMixin.d.ts +12 -0
  77. package/lib/Editing/Mutable/MutableMixin.d.ts.map +1 -0
  78. package/lib/Editing/Mutable/MutableMixin.js +16 -0
  79. package/lib/Editing/Mutable/MutableMixin.js.map +1 -0
  80. package/lib/Editing/Mutable/MutablePhenomenon.d.ts +10 -0
  81. package/lib/Editing/Mutable/MutablePhenomenon.d.ts.map +1 -0
  82. package/lib/Editing/Mutable/MutablePhenomenon.js +16 -0
  83. package/lib/Editing/Mutable/MutablePhenomenon.js.map +1 -0
  84. package/lib/Editing/Mutable/MutableProperty.d.ts +9 -0
  85. package/lib/Editing/Mutable/MutableProperty.d.ts.map +1 -0
  86. package/lib/Editing/Mutable/MutableProperty.js +16 -0
  87. package/lib/Editing/Mutable/MutableProperty.js.map +1 -0
  88. package/lib/Editing/Mutable/MutablePropertyCategory.d.ts +10 -0
  89. package/lib/Editing/Mutable/MutablePropertyCategory.d.ts.map +1 -0
  90. package/lib/Editing/Mutable/MutablePropertyCategory.js +16 -0
  91. package/lib/Editing/Mutable/MutablePropertyCategory.js.map +1 -0
  92. package/lib/Editing/Mutable/MutableRelationshipClass.d.ts +22 -0
  93. package/lib/Editing/Mutable/MutableRelationshipClass.d.ts.map +1 -0
  94. package/lib/Editing/Mutable/MutableRelationshipClass.js +25 -0
  95. package/lib/Editing/Mutable/MutableRelationshipClass.js.map +1 -0
  96. package/lib/Editing/Mutable/MutableSchema.d.ts +46 -0
  97. package/lib/Editing/Mutable/MutableSchema.d.ts.map +1 -0
  98. package/lib/Editing/Mutable/MutableSchema.js +18 -0
  99. package/lib/Editing/Mutable/MutableSchema.js.map +1 -0
  100. package/lib/Editing/Mutable/MutableUnit.d.ts +12 -0
  101. package/lib/Editing/Mutable/MutableUnit.d.ts.map +1 -0
  102. package/lib/Editing/Mutable/MutableUnit.js +16 -0
  103. package/lib/Editing/Mutable/MutableUnit.js.map +1 -0
  104. package/lib/Editing/Mutable/MutableUnitSystem.d.ts +9 -0
  105. package/lib/Editing/Mutable/MutableUnitSystem.d.ts.map +1 -0
  106. package/lib/Editing/Mutable/MutableUnitSystem.js +16 -0
  107. package/lib/Editing/Mutable/MutableUnitSystem.js.map +1 -0
  108. package/lib/Editing/Phenomena.d.ts +16 -0
  109. package/lib/Editing/Phenomena.d.ts.map +1 -0
  110. package/lib/Editing/Phenomena.js +48 -0
  111. package/lib/Editing/Phenomena.js.map +1 -0
  112. package/lib/Editing/PropertyCategories.d.ts +17 -0
  113. package/lib/Editing/PropertyCategories.d.ts.map +1 -0
  114. package/lib/Editing/PropertyCategories.js +54 -0
  115. package/lib/Editing/PropertyCategories.js.map +1 -0
  116. package/lib/Editing/RelationshipClasses.d.ts +22 -0
  117. package/lib/Editing/RelationshipClasses.d.ts.map +1 -0
  118. package/lib/Editing/RelationshipClasses.js +70 -0
  119. package/lib/Editing/RelationshipClasses.js.map +1 -0
  120. package/lib/Editing/Structs.d.ts +20 -0
  121. package/lib/Editing/Structs.d.ts.map +1 -0
  122. package/lib/Editing/Structs.js +57 -0
  123. package/lib/Editing/Structs.js.map +1 -0
  124. package/lib/Editing/UnitSystems.d.ts +16 -0
  125. package/lib/Editing/UnitSystems.d.ts.map +1 -0
  126. package/lib/Editing/UnitSystems.js +44 -0
  127. package/lib/Editing/UnitSystems.js.map +1 -0
  128. package/lib/Editing/Units.d.ts +16 -0
  129. package/lib/Editing/Units.d.ts.map +1 -0
  130. package/lib/Editing/Units.js +62 -0
  131. package/lib/Editing/Units.js.map +1 -0
  132. package/lib/Validation/Diagnostic.d.ts +322 -0
  133. package/lib/Validation/Diagnostic.d.ts.map +1 -0
  134. package/lib/Validation/Diagnostic.js +311 -0
  135. package/lib/Validation/Diagnostic.js.map +1 -0
  136. package/lib/Validation/DiagnosticReporter.d.ts +97 -0
  137. package/lib/Validation/DiagnosticReporter.d.ts.map +1 -0
  138. package/lib/Validation/DiagnosticReporter.js +107 -0
  139. package/lib/Validation/DiagnosticReporter.js.map +1 -0
  140. package/lib/Validation/ECRules.d.ts +439 -0
  141. package/lib/Validation/ECRules.d.ts.map +1 -0
  142. package/lib/Validation/ECRules.js +679 -0
  143. package/lib/Validation/ECRules.js.map +1 -0
  144. package/lib/Validation/LoggingDiagnosticReporter.d.ts +14 -0
  145. package/lib/Validation/LoggingDiagnosticReporter.d.ts.map +1 -0
  146. package/lib/Validation/LoggingDiagnosticReporter.js +41 -0
  147. package/lib/Validation/LoggingDiagnosticReporter.js.map +1 -0
  148. package/lib/Validation/RuleSuppressionSet.d.ts +59 -0
  149. package/lib/Validation/RuleSuppressionSet.d.ts.map +1 -0
  150. package/lib/Validation/RuleSuppressionSet.js +10 -0
  151. package/lib/Validation/RuleSuppressionSet.js.map +1 -0
  152. package/lib/Validation/Rules.d.ts +65 -0
  153. package/lib/Validation/Rules.d.ts.map +1 -0
  154. package/lib/Validation/Rules.js +10 -0
  155. package/lib/Validation/Rules.js.map +1 -0
  156. package/lib/Validation/SchemaChanges.d.ts +608 -0
  157. package/lib/Validation/SchemaChanges.d.ts.map +1 -0
  158. package/lib/Validation/SchemaChanges.js +1136 -0
  159. package/lib/Validation/SchemaChanges.js.map +1 -0
  160. package/lib/Validation/SchemaCompareDiagnostics.d.ts +423 -0
  161. package/lib/Validation/SchemaCompareDiagnostics.d.ts.map +1 -0
  162. package/lib/Validation/SchemaCompareDiagnostics.js +112 -0
  163. package/lib/Validation/SchemaCompareDiagnostics.js.map +1 -0
  164. package/lib/Validation/SchemaCompareReporter.d.ts +12 -0
  165. package/lib/Validation/SchemaCompareReporter.d.ts.map +1 -0
  166. package/lib/Validation/SchemaCompareReporter.js +10 -0
  167. package/lib/Validation/SchemaCompareReporter.js.map +1 -0
  168. package/lib/Validation/SchemaCompareResultDelegate.d.ts +237 -0
  169. package/lib/Validation/SchemaCompareResultDelegate.d.ts.map +1 -0
  170. package/lib/Validation/SchemaCompareResultDelegate.js +349 -0
  171. package/lib/Validation/SchemaCompareResultDelegate.js.map +1 -0
  172. package/lib/Validation/SchemaCompareVisitor.d.ts +120 -0
  173. package/lib/Validation/SchemaCompareVisitor.d.ts.map +1 -0
  174. package/lib/Validation/SchemaCompareVisitor.js +207 -0
  175. package/lib/Validation/SchemaCompareVisitor.js.map +1 -0
  176. package/lib/Validation/SchemaComparer.d.ts +172 -0
  177. package/lib/Validation/SchemaComparer.d.ts.map +1 -0
  178. package/lib/Validation/SchemaComparer.js +666 -0
  179. package/lib/Validation/SchemaComparer.js.map +1 -0
  180. package/lib/Validation/SchemaValidater.d.ts +20 -0
  181. package/lib/Validation/SchemaValidater.d.ts.map +1 -0
  182. package/lib/Validation/SchemaValidater.js +62 -0
  183. package/lib/Validation/SchemaValidater.js.map +1 -0
  184. package/lib/Validation/SchemaValidationVisitor.d.ts +171 -0
  185. package/lib/Validation/SchemaValidationVisitor.d.ts.map +1 -0
  186. package/lib/Validation/SchemaValidationVisitor.js +729 -0
  187. package/lib/Validation/SchemaValidationVisitor.js.map +1 -0
  188. package/lib/Validation/SchemaWalker.d.ts +23 -0
  189. package/lib/Validation/SchemaWalker.d.ts.map +1 -0
  190. package/lib/Validation/SchemaWalker.js +52 -0
  191. package/lib/Validation/SchemaWalker.js.map +1 -0
  192. package/lib/ecschema-editing.d.ts +34 -0
  193. package/lib/ecschema-editing.d.ts.map +1 -0
  194. package/lib/ecschema-editing.js +55 -0
  195. package/lib/ecschema-editing.js.map +1 -0
  196. package/package.json +85 -0
  197. package/public/locales/en/ECSchemaEditing.json +27 -0
@@ -0,0 +1,729 @@
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
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
10
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
11
+ var m = o[Symbol.asyncIterator], i;
12
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
13
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
14
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.SchemaValidationVisitor = void 0;
18
+ const Diagnostic_1 = require("./Diagnostic");
19
+ /**
20
+ * A SchemaWalkerVisitor interface implementation that is used to validate ECObjects schemas using
21
+ * [[IRuleSet]] objects registered with the instance. Also allows for reporting of [[IDiagnostic]]
22
+ * objects returned from failing rules using [[IDiagnosticReporter]] implementations registered
23
+ * with an instance of this class.
24
+ * @beta
25
+ */
26
+ class SchemaValidationVisitor {
27
+ constructor() {
28
+ this._reporters = [];
29
+ this._ruleSets = {};
30
+ }
31
+ /** Gets the IRule<AnyClass> objects registered with the visitor. */
32
+ get ruleSets() {
33
+ return this._ruleSets;
34
+ }
35
+ get suppressionSet() {
36
+ return this._ruleSuppressionSet;
37
+ }
38
+ /** Gets the IDiagnosticReporter objects registered with the visitor. */
39
+ get diagnosticReporters() {
40
+ return this._reporters;
41
+ }
42
+ /**
43
+ * Registers a [[IDiagnosticReporter]] allowing the reporter to be
44
+ * notified when a [[IDiagnostic]] is created due to a rule violation.
45
+ * @param reporter The [[DiagnosticReporter]] to register.
46
+ */
47
+ registerReporter(...reporters) {
48
+ for (const reporter of reporters)
49
+ this._reporters.push(reporter);
50
+ }
51
+ /**
52
+ * Registers a [[IRuleSet]] that will applied during schema traversal.
53
+ * @param ruleSet The [[IRuleSet]] to register.
54
+ */
55
+ registerRuleSet(ruleSet) {
56
+ if (undefined !== this.ruleSets[ruleSet.name])
57
+ throw new Error(`A RuleSet with the name '${ruleSet.name}' has already been registered.`);
58
+ this.ruleSets[ruleSet.name] = ruleSet;
59
+ }
60
+ /**
61
+ * Registers a [[IRuleSuppressionSet]] that will be applied during schema traversal.
62
+ * @param ruleSet The [[IRuleSuppressionSet]] to register.
63
+ * Only supports one Rule Suppression Set, if you call it twice it will overwrite the
64
+ * previous suppression set
65
+ */
66
+ registerRuleSuppressionSet(suppressionSet) {
67
+ this._ruleSuppressionSet = suppressionSet;
68
+ }
69
+ /**
70
+ * Called before schema traversal.
71
+ * @param schema a Schema object.
72
+ */
73
+ async visitFullSchema(schema) {
74
+ for (const index of Object.keys(this._ruleSets))
75
+ await this.applySchemaRules(schema, this._ruleSets[index]);
76
+ }
77
+ /**
78
+ * Called for each [[SchemaItem]] instance found during schema traversal.
79
+ * @param schemaItem a SchemaItem object.
80
+ */
81
+ async visitSchemaItem(schemaItem) {
82
+ for (const index of Object.keys(this._ruleSets))
83
+ await this.applySchemaItemRules(schemaItem, this._ruleSets[index]);
84
+ }
85
+ /**
86
+ * Called for each [AnyClass]($ecschema-metadata) instance found during schema traversal.
87
+ * @param ecClass an ECClass object.
88
+ */
89
+ async visitClass(ecClass) {
90
+ for (const index of Object.keys(this._ruleSets))
91
+ await this.applyClassRules(ecClass, this._ruleSets[index]);
92
+ }
93
+ /**
94
+ * Called for each [AnyProperty]($ecschema-metadata) instance of an ECClass.
95
+ * @param property an AnyProperty object.
96
+ */
97
+ async visitProperty(property) {
98
+ for (const index of Object.keys(this._ruleSets))
99
+ await this.applyPropertyRules(property, this._ruleSets[index]);
100
+ }
101
+ /**
102
+ * Called for each [EntityClass]($ecschema-metadata) instance found during schema traversal.
103
+ * @param entityClass an EntityClass object.
104
+ */
105
+ async visitEntityClass(entity) {
106
+ for (const index of Object.keys(this._ruleSets))
107
+ await this.applyEntityRules(entity, this._ruleSets[index]);
108
+ }
109
+ /**
110
+ * Called for each [StructClass]($ecschema-metadata) instance found during schema traversal.
111
+ * @param structClass a StructClass object.
112
+ */
113
+ async visitStructClass(struct) {
114
+ for (const index of Object.keys(this._ruleSets))
115
+ await this.applyStructRules(struct, this._ruleSets[index]);
116
+ }
117
+ /**
118
+ * Called for each [Mixin]($ecschema-metadata) instance found during schema traversal.
119
+ * @param mixin a Mixin object.
120
+ */
121
+ async visitMixin(mixin) {
122
+ for (const index of Object.keys(this._ruleSets))
123
+ await this.applyMixinRules(mixin, this._ruleSets[index]);
124
+ }
125
+ /**
126
+ * Called for each [RelationshipClass]($ecschema-metadata) instance found during schema traversal.
127
+ * @param relationshipClass a RelationshipClass object.
128
+ */
129
+ async visitRelationshipClass(relationship) {
130
+ for (const index of Object.keys(this._ruleSets))
131
+ await this.applyRelationshipRules(relationship, this._ruleSets[index]);
132
+ }
133
+ /**
134
+ * Called for each [RelationshipConstraint]($ecschema-metadata) of each RelationshipClass found during schema traversal.
135
+ * @param relationshipConstraint a RelationshipConstraint object.
136
+ */
137
+ async visitRelationshipConstraint(constraint) {
138
+ for (const index of Object.keys(this._ruleSets))
139
+ await this.applyRelationshipConstraintRules(constraint, this._ruleSets[index]);
140
+ }
141
+ /**
142
+ * Called for each [CustomAttributeClass]($ecschema-metadata) instance found during schema traversal.
143
+ * @param customAttributeClass a CustomAttributeClass object.
144
+ */
145
+ async visitCustomAttributeClass(customAttribute) {
146
+ for (const index of Object.keys(this._ruleSets))
147
+ await this.applyCustomAttributeRules(customAttribute, this._ruleSets[index]);
148
+ }
149
+ /**
150
+ * Called for each [CustomAttribute]($ecschema-metadata) container in the schema.
151
+ * @param customAttributeContainer a [[CustomAttributeContainerProps]] object.
152
+ */
153
+ async visitCustomAttributeContainer(container) {
154
+ for (const index of Object.keys(this._ruleSets))
155
+ await this.applyCustomAttributeContainerRules(container, this._ruleSets[index]);
156
+ if (undefined === container.customAttributes)
157
+ return;
158
+ for (const [, customAttribute] of container.customAttributes) {
159
+ for (const index of Object.keys(this._ruleSets)) {
160
+ await this.applyCustomAttributeInstanceRules(container, customAttribute, this._ruleSets[index]);
161
+ }
162
+ }
163
+ }
164
+ /**
165
+ * Called for each [Enumeration]($ecschema-metadata) instance found during schema traversal.
166
+ * @param enumeration an Enumeration object.
167
+ */
168
+ async visitEnumeration(enumeration) {
169
+ for (const index of Object.keys(this._ruleSets))
170
+ await this.applyEnumerationRules(enumeration, this._ruleSets[index]);
171
+ }
172
+ /**
173
+ * Called for each [KindOfQuantity]($ecschema-metadata) instance found during schema traversal.
174
+ * @param koq a KindOfQuantity object.
175
+ */
176
+ async visitKindOfQuantity(koq) {
177
+ for (const index of Object.keys(this._ruleSets))
178
+ await this.applyKindOfQuantityRules(koq, this._ruleSets[index]);
179
+ }
180
+ /**
181
+ * Called for each [PropertyCategory]($ecschema-metadata) instance found during schema traversal.
182
+ * @param category a PropertyCategory object.
183
+ */
184
+ async visitPropertyCategory(category) {
185
+ for (const index of Object.keys(this._ruleSets))
186
+ await this.applyPropertyCategoryRules(category, this._ruleSets[index]);
187
+ }
188
+ /**
189
+ * Called for each [Format]($ecschema-metadata) instance found during schema traversal.
190
+ * @param format a Format object.
191
+ */
192
+ async visitFormat(format) {
193
+ for (const index of Object.keys(this._ruleSets))
194
+ await this.applyFormatRules(format, this._ruleSets[index]);
195
+ }
196
+ /**
197
+ * Called for each [Unit]($ecschema-metadata) instance found during schema traversal.
198
+ * @param unit a Unit object.
199
+ */
200
+ async visitUnit(unit) {
201
+ for (const index of Object.keys(this._ruleSets))
202
+ await this.applyUnitRules(unit, this._ruleSets[index]);
203
+ }
204
+ /**
205
+ * Called for each [InvertedUnit]($ecschema-metadata) instance found during schema traversal.
206
+ * @param invertedUnit an InvertedUnit object.
207
+ */
208
+ async visitInvertedUnit(invertedUnit) {
209
+ for (const index of Object.keys(this._ruleSets))
210
+ await this.applyInvertedUnitRules(invertedUnit, this._ruleSets[index]);
211
+ }
212
+ /**
213
+ * Called for each [UnitSystem]($ecschema-metadata) instance found during schema traversal.
214
+ * @param unitSystem a UnitSystem object.
215
+ */
216
+ async visitUnitSystem(unitSystem) {
217
+ for (const index of Object.keys(this._ruleSets))
218
+ await this.applyUnitSystemRules(unitSystem, this._ruleSets[index]);
219
+ }
220
+ /**
221
+ * Called for each [Phenomenon]($ecschema-metadata) instance found during schema traversal.
222
+ * @param phenomena a Phenomenon object.
223
+ */
224
+ async visitPhenomenon(phenomenon) {
225
+ for (const index of Object.keys(this._ruleSets))
226
+ await this.applyPhenomenonRules(phenomenon, this._ruleSets[index]);
227
+ }
228
+ /**
229
+ * Called for each [Constant]($ecschema-metadata) instance found during schema traversal.
230
+ * @param constant a Constant object.
231
+ */
232
+ async visitConstant(constant) {
233
+ for (const index of Object.keys(this._ruleSets))
234
+ await this.applyConstantRules(constant, this._ruleSets[index]);
235
+ }
236
+ async applySchemaRules(schema, ruleSet) {
237
+ var e_1, _a;
238
+ if (!ruleSet.schemaRules || this.excludeSchemaFromRuleSet(schema, ruleSet))
239
+ return;
240
+ for (const rule of ruleSet.schemaRules) {
241
+ const result = rule(schema);
242
+ try {
243
+ for (var result_1 = (e_1 = void 0, __asyncValues(result)), result_1_1; result_1_1 = await result_1.next(), !result_1_1.done;) {
244
+ const diagnostic = result_1_1.value;
245
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.schemaRuleSuppressions : undefined;
246
+ await this.reportDiagnostics(diagnostic, schema, suppressions);
247
+ }
248
+ }
249
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
250
+ finally {
251
+ try {
252
+ if (result_1_1 && !result_1_1.done && (_a = result_1.return)) await _a.call(result_1);
253
+ }
254
+ finally { if (e_1) throw e_1.error; }
255
+ }
256
+ }
257
+ }
258
+ async applySchemaItemRules(schemaItem, ruleSet) {
259
+ var e_2, _a;
260
+ if (!ruleSet.schemaItemRules || this.excludeSchemaFromRuleSet(schemaItem.schema, ruleSet))
261
+ return;
262
+ for (const rule of ruleSet.schemaItemRules) {
263
+ const result = rule(schemaItem);
264
+ try {
265
+ for (var result_2 = (e_2 = void 0, __asyncValues(result)), result_2_1; result_2_1 = await result_2.next(), !result_2_1.done;) {
266
+ const diagnostic = result_2_1.value;
267
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.schemaItemRuleSuppressions : undefined;
268
+ await this.reportDiagnostics(diagnostic, schemaItem, suppressions);
269
+ }
270
+ }
271
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
272
+ finally {
273
+ try {
274
+ if (result_2_1 && !result_2_1.done && (_a = result_2.return)) await _a.call(result_2);
275
+ }
276
+ finally { if (e_2) throw e_2.error; }
277
+ }
278
+ }
279
+ }
280
+ async applyClassRules(ecClass, ruleSet) {
281
+ var e_3, _a;
282
+ if (!ruleSet.classRules || this.excludeSchemaFromRuleSet(ecClass.schema, ruleSet))
283
+ return;
284
+ for (const rule of ruleSet.classRules) {
285
+ const result = rule(ecClass);
286
+ try {
287
+ for (var result_3 = (e_3 = void 0, __asyncValues(result)), result_3_1; result_3_1 = await result_3.next(), !result_3_1.done;) {
288
+ const diagnostic = result_3_1.value;
289
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.classRuleSuppressions : undefined;
290
+ await this.reportDiagnostics(diagnostic, ecClass, suppressions);
291
+ }
292
+ }
293
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
294
+ finally {
295
+ try {
296
+ if (result_3_1 && !result_3_1.done && (_a = result_3.return)) await _a.call(result_3);
297
+ }
298
+ finally { if (e_3) throw e_3.error; }
299
+ }
300
+ }
301
+ }
302
+ async applyPropertyRules(property, ruleSet) {
303
+ var e_4, _a;
304
+ if (!ruleSet.propertyRules || this.excludeSchemaFromRuleSet(property.schema, ruleSet))
305
+ return;
306
+ for (const rule of ruleSet.propertyRules) {
307
+ const result = rule(property);
308
+ try {
309
+ for (var result_4 = (e_4 = void 0, __asyncValues(result)), result_4_1; result_4_1 = await result_4.next(), !result_4_1.done;) {
310
+ const diagnostic = result_4_1.value;
311
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.propertyRuleSuppressions : undefined;
312
+ await this.reportDiagnostics(diagnostic, property, suppressions);
313
+ }
314
+ }
315
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
316
+ finally {
317
+ try {
318
+ if (result_4_1 && !result_4_1.done && (_a = result_4.return)) await _a.call(result_4);
319
+ }
320
+ finally { if (e_4) throw e_4.error; }
321
+ }
322
+ }
323
+ }
324
+ async applyEntityRules(entityClass, ruleSet) {
325
+ var e_5, _a;
326
+ if (!ruleSet.entityClassRules || this.excludeSchemaFromRuleSet(entityClass.schema, ruleSet))
327
+ return;
328
+ for (const rule of ruleSet.entityClassRules) {
329
+ const result = rule(entityClass);
330
+ try {
331
+ for (var result_5 = (e_5 = void 0, __asyncValues(result)), result_5_1; result_5_1 = await result_5.next(), !result_5_1.done;) {
332
+ const diagnostic = result_5_1.value;
333
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.entityRuleSuppressions : undefined;
334
+ await this.reportDiagnostics(diagnostic, entityClass, suppressions);
335
+ }
336
+ }
337
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
338
+ finally {
339
+ try {
340
+ if (result_5_1 && !result_5_1.done && (_a = result_5.return)) await _a.call(result_5);
341
+ }
342
+ finally { if (e_5) throw e_5.error; }
343
+ }
344
+ }
345
+ }
346
+ async applyStructRules(structClass, ruleSet) {
347
+ var e_6, _a;
348
+ if (!ruleSet.structClassRules || this.excludeSchemaFromRuleSet(structClass.schema, ruleSet))
349
+ return;
350
+ for (const rule of ruleSet.structClassRules) {
351
+ const result = rule(structClass);
352
+ try {
353
+ for (var result_6 = (e_6 = void 0, __asyncValues(result)), result_6_1; result_6_1 = await result_6.next(), !result_6_1.done;) {
354
+ const diagnostic = result_6_1.value;
355
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.structRuleSuppressions : undefined;
356
+ await this.reportDiagnostics(diagnostic, structClass, suppressions);
357
+ }
358
+ }
359
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
360
+ finally {
361
+ try {
362
+ if (result_6_1 && !result_6_1.done && (_a = result_6.return)) await _a.call(result_6);
363
+ }
364
+ finally { if (e_6) throw e_6.error; }
365
+ }
366
+ }
367
+ }
368
+ async applyMixinRules(mixin, ruleSet) {
369
+ var e_7, _a;
370
+ if (!ruleSet.mixinRules || this.excludeSchemaFromRuleSet(mixin.schema, ruleSet))
371
+ return;
372
+ for (const rule of ruleSet.mixinRules) {
373
+ const result = rule(mixin);
374
+ try {
375
+ for (var result_7 = (e_7 = void 0, __asyncValues(result)), result_7_1; result_7_1 = await result_7.next(), !result_7_1.done;) {
376
+ const diagnostic = result_7_1.value;
377
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.mixinRuleSuppressions : undefined;
378
+ await this.reportDiagnostics(diagnostic, mixin, suppressions);
379
+ }
380
+ }
381
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
382
+ finally {
383
+ try {
384
+ if (result_7_1 && !result_7_1.done && (_a = result_7.return)) await _a.call(result_7);
385
+ }
386
+ finally { if (e_7) throw e_7.error; }
387
+ }
388
+ }
389
+ }
390
+ async applyRelationshipRules(relationship, ruleSet) {
391
+ var e_8, _a;
392
+ if (!ruleSet.relationshipRules || this.excludeSchemaFromRuleSet(relationship.schema, ruleSet))
393
+ return;
394
+ for (const rule of ruleSet.relationshipRules) {
395
+ const result = rule(relationship);
396
+ try {
397
+ for (var result_8 = (e_8 = void 0, __asyncValues(result)), result_8_1; result_8_1 = await result_8.next(), !result_8_1.done;) {
398
+ const diagnostic = result_8_1.value;
399
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.relationshipRuleSuppressions : undefined;
400
+ await this.reportDiagnostics(diagnostic, relationship, suppressions);
401
+ }
402
+ }
403
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
404
+ finally {
405
+ try {
406
+ if (result_8_1 && !result_8_1.done && (_a = result_8.return)) await _a.call(result_8);
407
+ }
408
+ finally { if (e_8) throw e_8.error; }
409
+ }
410
+ }
411
+ }
412
+ async applyRelationshipConstraintRules(constraint, ruleSet) {
413
+ var e_9, _a;
414
+ if (!ruleSet.relationshipConstraintRules || this.excludeSchemaFromRuleSet(constraint.schema, ruleSet))
415
+ return;
416
+ for (const rule of ruleSet.relationshipConstraintRules) {
417
+ const result = rule(constraint);
418
+ try {
419
+ for (var result_9 = (e_9 = void 0, __asyncValues(result)), result_9_1; result_9_1 = await result_9.next(), !result_9_1.done;) {
420
+ const diagnostic = result_9_1.value;
421
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.relationshipConstraintRuleSuppressions : undefined;
422
+ await this.reportDiagnostics(diagnostic, constraint, suppressions);
423
+ }
424
+ }
425
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
426
+ finally {
427
+ try {
428
+ if (result_9_1 && !result_9_1.done && (_a = result_9.return)) await _a.call(result_9);
429
+ }
430
+ finally { if (e_9) throw e_9.error; }
431
+ }
432
+ }
433
+ }
434
+ async applyCustomAttributeRules(customAttribute, ruleSet) {
435
+ var e_10, _a;
436
+ if (!ruleSet.customAttributeClassRules || this.excludeSchemaFromRuleSet(customAttribute.schema, ruleSet))
437
+ return;
438
+ for (const rule of ruleSet.customAttributeClassRules) {
439
+ const result = rule(customAttribute);
440
+ try {
441
+ for (var result_10 = (e_10 = void 0, __asyncValues(result)), result_10_1; result_10_1 = await result_10.next(), !result_10_1.done;) {
442
+ const diagnostic = result_10_1.value;
443
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.customAttributeRuleSuppressions : undefined;
444
+ await this.reportDiagnostics(diagnostic, customAttribute, suppressions);
445
+ }
446
+ }
447
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
448
+ finally {
449
+ try {
450
+ if (result_10_1 && !result_10_1.done && (_a = result_10.return)) await _a.call(result_10);
451
+ }
452
+ finally { if (e_10) throw e_10.error; }
453
+ }
454
+ }
455
+ }
456
+ async applyCustomAttributeContainerRules(container, ruleSet) {
457
+ var e_11, _a;
458
+ if (!ruleSet.customAttributeContainerRules || this.excludeSchemaFromRuleSet(container.schema, ruleSet))
459
+ return;
460
+ for (const rule of ruleSet.customAttributeContainerRules) {
461
+ const result = rule(container);
462
+ try {
463
+ for (var result_11 = (e_11 = void 0, __asyncValues(result)), result_11_1; result_11_1 = await result_11.next(), !result_11_1.done;) {
464
+ const diagnostic = result_11_1.value;
465
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.customAttributeContainerSuppressions : undefined;
466
+ await this.reportDiagnostics(diagnostic, container, suppressions);
467
+ }
468
+ }
469
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
470
+ finally {
471
+ try {
472
+ if (result_11_1 && !result_11_1.done && (_a = result_11.return)) await _a.call(result_11);
473
+ }
474
+ finally { if (e_11) throw e_11.error; }
475
+ }
476
+ }
477
+ }
478
+ async applyCustomAttributeInstanceRules(container, customAttribute, ruleSet) {
479
+ var e_12, _a;
480
+ if (!ruleSet.customAttributeInstanceRules || this.excludeSchemaFromRuleSet(container.schema, ruleSet))
481
+ return;
482
+ for (const rule of ruleSet.customAttributeInstanceRules) {
483
+ const result = rule(container, customAttribute);
484
+ try {
485
+ for (var result_12 = (e_12 = void 0, __asyncValues(result)), result_12_1; result_12_1 = await result_12.next(), !result_12_1.done;) {
486
+ const diagnostic = result_12_1.value;
487
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.customAttributeInstanceSuppressions : undefined;
488
+ await this.reportDiagnostics(diagnostic, container, suppressions);
489
+ }
490
+ }
491
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
492
+ finally {
493
+ try {
494
+ if (result_12_1 && !result_12_1.done && (_a = result_12.return)) await _a.call(result_12);
495
+ }
496
+ finally { if (e_12) throw e_12.error; }
497
+ }
498
+ }
499
+ }
500
+ async applyEnumerationRules(enumeration, ruleSet) {
501
+ var e_13, _a;
502
+ if (!ruleSet.enumerationRules || this.excludeSchemaFromRuleSet(enumeration.schema, ruleSet))
503
+ return;
504
+ for (const rule of ruleSet.enumerationRules) {
505
+ const result = rule(enumeration);
506
+ try {
507
+ for (var result_13 = (e_13 = void 0, __asyncValues(result)), result_13_1; result_13_1 = await result_13.next(), !result_13_1.done;) {
508
+ const diagnostic = result_13_1.value;
509
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.enumerationRuleSuppressions : undefined;
510
+ await this.reportDiagnostics(diagnostic, enumeration, suppressions);
511
+ }
512
+ }
513
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
514
+ finally {
515
+ try {
516
+ if (result_13_1 && !result_13_1.done && (_a = result_13.return)) await _a.call(result_13);
517
+ }
518
+ finally { if (e_13) throw e_13.error; }
519
+ }
520
+ }
521
+ }
522
+ async applyKindOfQuantityRules(kindOfQuantity, ruleSet) {
523
+ var e_14, _a;
524
+ if (!ruleSet.kindOfQuantityRules || this.excludeSchemaFromRuleSet(kindOfQuantity.schema, ruleSet))
525
+ return;
526
+ for (const rule of ruleSet.kindOfQuantityRules) {
527
+ const result = rule(kindOfQuantity);
528
+ try {
529
+ for (var result_14 = (e_14 = void 0, __asyncValues(result)), result_14_1; result_14_1 = await result_14.next(), !result_14_1.done;) {
530
+ const diagnostic = result_14_1.value;
531
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.koqRuleSuppressions : undefined;
532
+ await this.reportDiagnostics(diagnostic, kindOfQuantity, suppressions);
533
+ }
534
+ }
535
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
536
+ finally {
537
+ try {
538
+ if (result_14_1 && !result_14_1.done && (_a = result_14.return)) await _a.call(result_14);
539
+ }
540
+ finally { if (e_14) throw e_14.error; }
541
+ }
542
+ }
543
+ }
544
+ async applyPropertyCategoryRules(propertyCategory, ruleSet) {
545
+ var e_15, _a;
546
+ if (!ruleSet.propertyCategoryRules || this.excludeSchemaFromRuleSet(propertyCategory.schema, ruleSet))
547
+ return;
548
+ for (const rule of ruleSet.propertyCategoryRules) {
549
+ const result = rule(propertyCategory);
550
+ try {
551
+ for (var result_15 = (e_15 = void 0, __asyncValues(result)), result_15_1; result_15_1 = await result_15.next(), !result_15_1.done;) {
552
+ const diagnostic = result_15_1.value;
553
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.propertyCategoryRuleSuppressions : undefined;
554
+ await this.reportDiagnostics(diagnostic, propertyCategory, suppressions);
555
+ }
556
+ }
557
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
558
+ finally {
559
+ try {
560
+ if (result_15_1 && !result_15_1.done && (_a = result_15.return)) await _a.call(result_15);
561
+ }
562
+ finally { if (e_15) throw e_15.error; }
563
+ }
564
+ }
565
+ }
566
+ async applyFormatRules(format, ruleSet) {
567
+ var e_16, _a;
568
+ if (!ruleSet.formatRules || this.excludeSchemaFromRuleSet(format.schema, ruleSet))
569
+ return;
570
+ for (const rule of ruleSet.formatRules) {
571
+ const result = rule(format);
572
+ try {
573
+ for (var result_16 = (e_16 = void 0, __asyncValues(result)), result_16_1; result_16_1 = await result_16.next(), !result_16_1.done;) {
574
+ const diagnostic = result_16_1.value;
575
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.formatRuleSuppressions : undefined;
576
+ await this.reportDiagnostics(diagnostic, format, suppressions);
577
+ }
578
+ }
579
+ catch (e_16_1) { e_16 = { error: e_16_1 }; }
580
+ finally {
581
+ try {
582
+ if (result_16_1 && !result_16_1.done && (_a = result_16.return)) await _a.call(result_16);
583
+ }
584
+ finally { if (e_16) throw e_16.error; }
585
+ }
586
+ }
587
+ }
588
+ async applyUnitRules(unit, ruleSet) {
589
+ var e_17, _a;
590
+ if (!ruleSet.unitRules || this.excludeSchemaFromRuleSet(unit.schema, ruleSet))
591
+ return;
592
+ for (const rule of ruleSet.unitRules) {
593
+ const result = rule(unit);
594
+ try {
595
+ for (var result_17 = (e_17 = void 0, __asyncValues(result)), result_17_1; result_17_1 = await result_17.next(), !result_17_1.done;) {
596
+ const diagnostic = result_17_1.value;
597
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.unitRuleSuppressions : undefined;
598
+ await this.reportDiagnostics(diagnostic, unit, suppressions);
599
+ }
600
+ }
601
+ catch (e_17_1) { e_17 = { error: e_17_1 }; }
602
+ finally {
603
+ try {
604
+ if (result_17_1 && !result_17_1.done && (_a = result_17.return)) await _a.call(result_17);
605
+ }
606
+ finally { if (e_17) throw e_17.error; }
607
+ }
608
+ }
609
+ }
610
+ async applyInvertedUnitRules(invertedUnit, ruleSet) {
611
+ var e_18, _a;
612
+ if (!ruleSet.invertedUnitRules || this.excludeSchemaFromRuleSet(invertedUnit.schema, ruleSet))
613
+ return;
614
+ for (const rule of ruleSet.invertedUnitRules) {
615
+ const result = rule(invertedUnit);
616
+ try {
617
+ for (var result_18 = (e_18 = void 0, __asyncValues(result)), result_18_1; result_18_1 = await result_18.next(), !result_18_1.done;) {
618
+ const diagnostic = result_18_1.value;
619
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.invertedUnitRuleSuppressions : undefined;
620
+ await this.reportDiagnostics(diagnostic, invertedUnit, suppressions);
621
+ }
622
+ }
623
+ catch (e_18_1) { e_18 = { error: e_18_1 }; }
624
+ finally {
625
+ try {
626
+ if (result_18_1 && !result_18_1.done && (_a = result_18.return)) await _a.call(result_18);
627
+ }
628
+ finally { if (e_18) throw e_18.error; }
629
+ }
630
+ }
631
+ }
632
+ async applyUnitSystemRules(unitSystem, ruleSet) {
633
+ var e_19, _a;
634
+ if (!ruleSet.unitSystemRules || this.excludeSchemaFromRuleSet(unitSystem.schema, ruleSet))
635
+ return;
636
+ for (const rule of ruleSet.unitSystemRules) {
637
+ const result = rule(unitSystem);
638
+ try {
639
+ for (var result_19 = (e_19 = void 0, __asyncValues(result)), result_19_1; result_19_1 = await result_19.next(), !result_19_1.done;) {
640
+ const diagnostic = result_19_1.value;
641
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.unitSystemRuleSuppressions : undefined;
642
+ await this.reportDiagnostics(diagnostic, unitSystem, suppressions);
643
+ }
644
+ }
645
+ catch (e_19_1) { e_19 = { error: e_19_1 }; }
646
+ finally {
647
+ try {
648
+ if (result_19_1 && !result_19_1.done && (_a = result_19.return)) await _a.call(result_19);
649
+ }
650
+ finally { if (e_19) throw e_19.error; }
651
+ }
652
+ }
653
+ }
654
+ async applyPhenomenonRules(phenomenon, ruleSet) {
655
+ var e_20, _a;
656
+ if (!ruleSet.phenomenonRules || this.excludeSchemaFromRuleSet(phenomenon.schema, ruleSet))
657
+ return;
658
+ for (const rule of ruleSet.phenomenonRules) {
659
+ const result = rule(phenomenon);
660
+ try {
661
+ for (var result_20 = (e_20 = void 0, __asyncValues(result)), result_20_1; result_20_1 = await result_20.next(), !result_20_1.done;) {
662
+ const diagnostic = result_20_1.value;
663
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.phenomenonRuleSuppressions : undefined;
664
+ await this.reportDiagnostics(diagnostic, phenomenon, suppressions);
665
+ }
666
+ }
667
+ catch (e_20_1) { e_20 = { error: e_20_1 }; }
668
+ finally {
669
+ try {
670
+ if (result_20_1 && !result_20_1.done && (_a = result_20.return)) await _a.call(result_20);
671
+ }
672
+ finally { if (e_20) throw e_20.error; }
673
+ }
674
+ }
675
+ }
676
+ async applyConstantRules(constant, ruleSet) {
677
+ var e_21, _a;
678
+ if (!ruleSet.constantRules || this.excludeSchemaFromRuleSet(constant.schema, ruleSet))
679
+ return;
680
+ for (const rule of ruleSet.constantRules) {
681
+ const result = rule(constant);
682
+ try {
683
+ for (var result_21 = (e_21 = void 0, __asyncValues(result)), result_21_1; result_21_1 = await result_21.next(), !result_21_1.done;) {
684
+ const diagnostic = result_21_1.value;
685
+ const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.constantRuleSuppressions : undefined;
686
+ await this.reportDiagnostics(diagnostic, constant, suppressions);
687
+ }
688
+ }
689
+ catch (e_21_1) { e_21 = { error: e_21_1 }; }
690
+ finally {
691
+ try {
692
+ if (result_21_1 && !result_21_1.done && (_a = result_21.return)) await _a.call(result_21);
693
+ }
694
+ finally { if (e_21) throw e_21.error; }
695
+ }
696
+ }
697
+ }
698
+ findSuppressionRule(suppressionSet, code) {
699
+ if (!suppressionSet)
700
+ return;
701
+ for (const suppression of suppressionSet) {
702
+ if (suppression.ruleCode === code) {
703
+ return suppression.rule;
704
+ }
705
+ }
706
+ return;
707
+ }
708
+ excludeSchemaFromRuleSet(schema, ruleSet) {
709
+ if (!ruleSet.schemaExclusionSet)
710
+ return false;
711
+ return ruleSet.schemaExclusionSet.includes(schema.name);
712
+ }
713
+ async reportDiagnostics(diagnostic, ecType, suppressionMap) {
714
+ if (!diagnostic)
715
+ return;
716
+ if (suppressionMap) {
717
+ const suppressRule = this.findSuppressionRule(suppressionMap, diagnostic.code);
718
+ if (suppressRule) {
719
+ const ecSuppression = await suppressRule(diagnostic, ecType);
720
+ if (ecSuppression) {
721
+ diagnostic.category = Diagnostic_1.DiagnosticCategory.Warning;
722
+ }
723
+ }
724
+ }
725
+ this._reporters.forEach((reporter) => { reporter.report(diagnostic); });
726
+ }
727
+ }
728
+ exports.SchemaValidationVisitor = SchemaValidationVisitor;
729
+ //# sourceMappingURL=SchemaValidationVisitor.js.map