@itwin/ecschema-editing 5.0.0-dev.11 → 5.0.0-dev.111

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 (594) hide show
  1. package/CHANGELOG.md +71 -1
  2. package/lib/cjs/Differencing/Errors.js +6 -0
  3. package/lib/cjs/Differencing/Errors.js.map +1 -1
  4. package/lib/cjs/Differencing/SchemaConflicts.d.ts +3 -1
  5. package/lib/cjs/Differencing/SchemaConflicts.d.ts.map +1 -1
  6. package/lib/cjs/Differencing/SchemaConflicts.js +2 -0
  7. package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
  8. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts +4 -2
  9. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
  10. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +56 -2
  11. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
  12. package/lib/cjs/Differencing/SchemaDifference.d.ts +33 -4
  13. package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
  14. package/lib/cjs/Differencing/SchemaDifference.js +55 -5
  15. package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
  16. package/lib/cjs/Differencing/SchemaDifferenceValidator.d.ts +2 -1
  17. package/lib/cjs/Differencing/SchemaDifferenceValidator.d.ts.map +1 -1
  18. package/lib/cjs/Differencing/SchemaDifferenceValidator.js +78 -19
  19. package/lib/cjs/Differencing/SchemaDifferenceValidator.js.map +1 -1
  20. package/lib/cjs/Differencing/SchemaDifferenceVisitor.d.ts.map +1 -1
  21. package/lib/cjs/Differencing/SchemaDifferenceVisitor.js +5 -0
  22. package/lib/cjs/Differencing/SchemaDifferenceVisitor.js.map +1 -1
  23. package/lib/cjs/Differencing/Utils.js.map +1 -1
  24. package/lib/cjs/Editing/Constants.d.ts +2 -1
  25. package/lib/cjs/Editing/Constants.d.ts.map +1 -1
  26. package/lib/cjs/Editing/Constants.js +4 -1
  27. package/lib/cjs/Editing/Constants.js.map +1 -1
  28. package/lib/cjs/Editing/CustomAttributes.d.ts +2 -1
  29. package/lib/cjs/Editing/CustomAttributes.d.ts.map +1 -1
  30. package/lib/cjs/Editing/CustomAttributes.js +3 -0
  31. package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
  32. package/lib/cjs/Editing/ECClasses.d.ts +6 -1
  33. package/lib/cjs/Editing/ECClasses.d.ts.map +1 -1
  34. package/lib/cjs/Editing/ECClasses.js +48 -49
  35. package/lib/cjs/Editing/ECClasses.js.map +1 -1
  36. package/lib/cjs/Editing/Editor.d.ts +2 -2
  37. package/lib/cjs/Editing/Editor.d.ts.map +1 -1
  38. package/lib/cjs/Editing/Editor.js +33 -22
  39. package/lib/cjs/Editing/Editor.js.map +1 -1
  40. package/lib/cjs/Editing/Entities.d.ts +2 -1
  41. package/lib/cjs/Editing/Entities.d.ts.map +1 -1
  42. package/lib/cjs/Editing/Entities.js +18 -14
  43. package/lib/cjs/Editing/Entities.js.map +1 -1
  44. package/lib/cjs/Editing/Enumerations.d.ts +2 -1
  45. package/lib/cjs/Editing/Enumerations.d.ts.map +1 -1
  46. package/lib/cjs/Editing/Enumerations.js +6 -3
  47. package/lib/cjs/Editing/Enumerations.js.map +1 -1
  48. package/lib/cjs/Editing/Exception.js +35 -6
  49. package/lib/cjs/Editing/Exception.js.map +1 -1
  50. package/lib/cjs/Editing/Formats.d.ts +2 -1
  51. package/lib/cjs/Editing/Formats.d.ts.map +1 -1
  52. package/lib/cjs/Editing/Formats.js +11 -2
  53. package/lib/cjs/Editing/Formats.js.map +1 -1
  54. package/lib/cjs/Editing/InvertedUnits.d.ts +2 -1
  55. package/lib/cjs/Editing/InvertedUnits.d.ts.map +1 -1
  56. package/lib/cjs/Editing/InvertedUnits.js +10 -6
  57. package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
  58. package/lib/cjs/Editing/KindOfQuantities.d.ts +3 -2
  59. package/lib/cjs/Editing/KindOfQuantities.d.ts.map +1 -1
  60. package/lib/cjs/Editing/KindOfQuantities.js +14 -10
  61. package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
  62. package/lib/cjs/Editing/Mixins.d.ts +2 -1
  63. package/lib/cjs/Editing/Mixins.d.ts.map +1 -1
  64. package/lib/cjs/Editing/Mixins.js +13 -9
  65. package/lib/cjs/Editing/Mixins.js.map +1 -1
  66. package/lib/cjs/Editing/Mutable/MutableArrayProperty.js.map +1 -1
  67. package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
  68. package/lib/cjs/Editing/Mutable/MutableClass.d.ts +2 -1
  69. package/lib/cjs/Editing/Mutable/MutableClass.d.ts.map +1 -1
  70. package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
  71. package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
  72. package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
  73. package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
  74. package/lib/cjs/Editing/Mutable/MutableFormat.d.ts +10 -3
  75. package/lib/cjs/Editing/Mutable/MutableFormat.d.ts.map +1 -1
  76. package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
  77. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
  78. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.d.ts +4 -4
  79. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.d.ts.map +1 -1
  80. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
  81. package/lib/cjs/Editing/Mutable/MutableMixin.js.map +1 -1
  82. package/lib/cjs/Editing/Mutable/MutableNavigationProperty.js.map +1 -1
  83. package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
  84. package/lib/cjs/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -1
  85. package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
  86. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
  87. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.d.ts +7 -7
  88. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.d.ts.map +1 -1
  89. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
  90. package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
  91. package/lib/cjs/Editing/Mutable/MutableSchemaItem.js.map +1 -1
  92. package/lib/cjs/Editing/Mutable/MutableStructProperty.js.map +1 -1
  93. package/lib/cjs/Editing/Mutable/MutableUnit.js.map +1 -1
  94. package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
  95. package/lib/cjs/Editing/Phenomena.d.ts +2 -1
  96. package/lib/cjs/Editing/Phenomena.d.ts.map +1 -1
  97. package/lib/cjs/Editing/Phenomena.js +3 -0
  98. package/lib/cjs/Editing/Phenomena.js.map +1 -1
  99. package/lib/cjs/Editing/Properties.d.ts.map +1 -1
  100. package/lib/cjs/Editing/Properties.js +10 -8
  101. package/lib/cjs/Editing/Properties.js.map +1 -1
  102. package/lib/cjs/Editing/PropertyCategories.d.ts +2 -1
  103. package/lib/cjs/Editing/PropertyCategories.d.ts.map +1 -1
  104. package/lib/cjs/Editing/PropertyCategories.js +5 -1
  105. package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
  106. package/lib/cjs/Editing/RelationshipClasses.d.ts +1 -0
  107. package/lib/cjs/Editing/RelationshipClasses.d.ts.map +1 -1
  108. package/lib/cjs/Editing/RelationshipClasses.js +29 -22
  109. package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
  110. package/lib/cjs/Editing/SchemaItems.d.ts +3 -3
  111. package/lib/cjs/Editing/SchemaItems.d.ts.map +1 -1
  112. package/lib/cjs/Editing/SchemaItems.js +11 -14
  113. package/lib/cjs/Editing/SchemaItems.js.map +1 -1
  114. package/lib/cjs/Editing/Structs.d.ts +2 -1
  115. package/lib/cjs/Editing/Structs.d.ts.map +1 -1
  116. package/lib/cjs/Editing/Structs.js +3 -0
  117. package/lib/cjs/Editing/Structs.js.map +1 -1
  118. package/lib/cjs/Editing/UnitSystems.d.ts +2 -1
  119. package/lib/cjs/Editing/UnitSystems.d.ts.map +1 -1
  120. package/lib/cjs/Editing/UnitSystems.js +3 -0
  121. package/lib/cjs/Editing/UnitSystems.js.map +1 -1
  122. package/lib/cjs/Editing/Units.d.ts +2 -1
  123. package/lib/cjs/Editing/Units.d.ts.map +1 -1
  124. package/lib/cjs/Editing/Units.js +5 -2
  125. package/lib/cjs/Editing/Units.js.map +1 -1
  126. package/lib/cjs/Merging/ClassMerger.js.map +1 -1
  127. package/lib/cjs/Merging/ConstantMerger.d.ts.map +1 -1
  128. package/lib/cjs/Merging/ConstantMerger.js +4 -4
  129. package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
  130. package/lib/cjs/Merging/CustomAttributeClassMerger.js.map +1 -1
  131. package/lib/cjs/Merging/CustomAttributeMerger.d.ts.map +1 -1
  132. package/lib/cjs/Merging/CustomAttributeMerger.js +7 -6
  133. package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
  134. package/lib/cjs/Merging/Edits/NameMapping.d.ts +22 -0
  135. package/lib/cjs/Merging/Edits/NameMapping.d.ts.map +1 -0
  136. package/lib/cjs/Merging/Edits/NameMapping.js +54 -0
  137. package/lib/cjs/Merging/Edits/NameMapping.js.map +1 -0
  138. package/lib/cjs/Merging/Edits/RenameEditHandler.d.ts +1 -1
  139. package/lib/cjs/Merging/Edits/RenameEditHandler.d.ts.map +1 -1
  140. package/lib/cjs/Merging/Edits/RenameEditHandler.js +1 -260
  141. package/lib/cjs/Merging/Edits/RenameEditHandler.js.map +1 -1
  142. package/lib/cjs/Merging/Edits/SchemaEdits.d.ts +9 -6
  143. package/lib/cjs/Merging/Edits/SchemaEdits.d.ts.map +1 -1
  144. package/lib/cjs/Merging/Edits/SchemaEdits.js +19 -14
  145. package/lib/cjs/Merging/Edits/SchemaEdits.js.map +1 -1
  146. package/lib/cjs/Merging/Edits/SkipEditHandler.js.map +1 -1
  147. package/lib/cjs/Merging/EntityClassMerger.js +1 -2
  148. package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
  149. package/lib/cjs/Merging/EnumerationMerger.js +1 -1
  150. package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
  151. package/lib/cjs/Merging/EnumeratorMerger.d.ts.map +1 -1
  152. package/lib/cjs/Merging/EnumeratorMerger.js +2 -2
  153. package/lib/cjs/Merging/EnumeratorMerger.js.map +1 -1
  154. package/lib/cjs/Merging/FormatMerger.d.ts +24 -0
  155. package/lib/cjs/Merging/FormatMerger.d.ts.map +1 -0
  156. package/lib/cjs/Merging/FormatMerger.js +145 -0
  157. package/lib/cjs/Merging/FormatMerger.js.map +1 -0
  158. package/lib/cjs/Merging/InvertedUnitMerger.d.ts +14 -0
  159. package/lib/cjs/Merging/InvertedUnitMerger.d.ts.map +1 -0
  160. package/lib/cjs/Merging/InvertedUnitMerger.js +45 -0
  161. package/lib/cjs/Merging/InvertedUnitMerger.js.map +1 -0
  162. package/lib/cjs/Merging/KindOfQuantityMerger.d.ts +1 -1
  163. package/lib/cjs/Merging/KindOfQuantityMerger.d.ts.map +1 -1
  164. package/lib/cjs/Merging/KindOfQuantityMerger.js +8 -6
  165. package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
  166. package/lib/cjs/Merging/MixinMerger.js +1 -1
  167. package/lib/cjs/Merging/MixinMerger.js.map +1 -1
  168. package/lib/cjs/Merging/PhenomenonMerger.d.ts.map +1 -1
  169. package/lib/cjs/Merging/PhenomenonMerger.js +1 -1
  170. package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
  171. package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -1
  172. package/lib/cjs/Merging/PropertyMerger.js +28 -26
  173. package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
  174. package/lib/cjs/Merging/RelationshipClassMerger.d.ts.map +1 -1
  175. package/lib/cjs/Merging/RelationshipClassMerger.js +5 -5
  176. package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
  177. package/lib/cjs/Merging/SchemaMerger.d.ts +5 -3
  178. package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
  179. package/lib/cjs/Merging/SchemaMerger.js +45 -5
  180. package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
  181. package/lib/cjs/Merging/SchemaMergingVisitor.d.ts +14 -8
  182. package/lib/cjs/Merging/SchemaMergingVisitor.d.ts.map +1 -1
  183. package/lib/cjs/Merging/SchemaMergingVisitor.js +42 -17
  184. package/lib/cjs/Merging/SchemaMergingVisitor.js.map +1 -1
  185. package/lib/cjs/Merging/SchemaMergingWalker.d.ts.map +1 -1
  186. package/lib/cjs/Merging/SchemaMergingWalker.js +2 -0
  187. package/lib/cjs/Merging/SchemaMergingWalker.js.map +1 -1
  188. package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
  189. package/lib/cjs/Merging/StructClassMerger.js.map +1 -1
  190. package/lib/cjs/Merging/UnitMerger.d.ts +14 -0
  191. package/lib/cjs/Merging/UnitMerger.d.ts.map +1 -0
  192. package/lib/cjs/Merging/UnitMerger.js +62 -0
  193. package/lib/cjs/Merging/UnitMerger.js.map +1 -0
  194. package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -1
  195. package/lib/cjs/Merging/Utils.d.ts +11 -0
  196. package/lib/cjs/Merging/Utils.d.ts.map +1 -1
  197. package/lib/cjs/Merging/Utils.js +24 -4
  198. package/lib/cjs/Merging/Utils.js.map +1 -1
  199. package/lib/cjs/Validation/Diagnostic.js +18 -16
  200. package/lib/cjs/Validation/Diagnostic.js.map +1 -1
  201. package/lib/cjs/Validation/DiagnosticReporter.js +4 -1
  202. package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
  203. package/lib/cjs/Validation/ECRules.js +5 -5
  204. package/lib/cjs/Validation/ECRules.js.map +1 -1
  205. package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
  206. package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
  207. package/lib/cjs/Validation/Rules.js.map +1 -1
  208. package/lib/cjs/Validation/SchemaChanges.js +41 -71
  209. package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
  210. package/lib/cjs/Validation/SchemaCompareDiagnostics.d.ts +2 -2
  211. package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
  212. package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
  213. package/lib/cjs/Validation/SchemaCompareResultDelegate.d.ts +1 -1
  214. package/lib/cjs/Validation/SchemaCompareResultDelegate.d.ts.map +1 -1
  215. package/lib/cjs/Validation/SchemaCompareResultDelegate.js +4 -1
  216. package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
  217. package/lib/cjs/Validation/SchemaCompareVisitor.d.ts.map +1 -1
  218. package/lib/cjs/Validation/SchemaCompareVisitor.js +23 -23
  219. package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
  220. package/lib/cjs/Validation/SchemaComparer.d.ts +22 -1
  221. package/lib/cjs/Validation/SchemaComparer.d.ts.map +1 -1
  222. package/lib/cjs/Validation/SchemaComparer.js +47 -11
  223. package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
  224. package/lib/cjs/Validation/SchemaValidater.js +1 -4
  225. package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
  226. package/lib/cjs/Validation/SchemaValidationVisitor.js +3 -4
  227. package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
  228. package/lib/cjs/Validation/SchemaWalker.d.ts +1 -1
  229. package/lib/cjs/Validation/SchemaWalker.d.ts.map +1 -1
  230. package/lib/cjs/Validation/SchemaWalker.js +6 -4
  231. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  232. package/lib/cjs/ecschema-editing.js.map +1 -1
  233. package/lib/esm/Differencing/Errors.d.ts +19 -0
  234. package/lib/esm/Differencing/Errors.d.ts.map +1 -0
  235. package/lib/esm/Differencing/Errors.js +26 -0
  236. package/lib/esm/Differencing/Errors.js.map +1 -0
  237. package/lib/esm/Differencing/SchemaConflicts.d.ts +84 -0
  238. package/lib/esm/Differencing/SchemaConflicts.d.ts.map +1 -0
  239. package/lib/esm/Differencing/SchemaConflicts.js +60 -0
  240. package/lib/esm/Differencing/SchemaConflicts.js.map +1 -0
  241. package/lib/esm/Differencing/SchemaDiagnosticVisitor.d.ts +41 -0
  242. package/lib/esm/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -0
  243. package/lib/esm/Differencing/SchemaDiagnosticVisitor.js +443 -0
  244. package/lib/esm/Differencing/SchemaDiagnosticVisitor.js.map +1 -0
  245. package/lib/esm/Differencing/SchemaDifference.d.ts +357 -0
  246. package/lib/esm/Differencing/SchemaDifference.d.ts.map +1 -0
  247. package/lib/esm/Differencing/SchemaDifference.js +106 -0
  248. package/lib/esm/Differencing/SchemaDifference.js.map +1 -0
  249. package/lib/esm/Differencing/SchemaDifferenceValidator.d.ts +18 -0
  250. package/lib/esm/Differencing/SchemaDifferenceValidator.d.ts.map +1 -0
  251. package/lib/esm/Differencing/SchemaDifferenceValidator.js +521 -0
  252. package/lib/esm/Differencing/SchemaDifferenceValidator.js.map +1 -0
  253. package/lib/esm/Differencing/SchemaDifferenceVisitor.d.ts +32 -0
  254. package/lib/esm/Differencing/SchemaDifferenceVisitor.d.ts.map +1 -0
  255. package/lib/esm/Differencing/SchemaDifferenceVisitor.js +88 -0
  256. package/lib/esm/Differencing/SchemaDifferenceVisitor.js.map +1 -0
  257. package/lib/esm/Differencing/Utils.d.ts +110 -0
  258. package/lib/esm/Differencing/Utils.d.ts.map +1 -0
  259. package/lib/esm/Differencing/Utils.js +161 -0
  260. package/lib/esm/Differencing/Utils.js.map +1 -0
  261. package/lib/esm/Editing/Constants.d.ts +22 -0
  262. package/lib/esm/Editing/Constants.d.ts.map +1 -0
  263. package/lib/esm/Editing/Constants.js +55 -0
  264. package/lib/esm/Editing/Constants.js.map +1 -0
  265. package/lib/esm/Editing/CustomAttributes.d.ts +22 -0
  266. package/lib/esm/Editing/CustomAttributes.d.ts.map +1 -0
  267. package/lib/esm/Editing/CustomAttributes.js +49 -0
  268. package/lib/esm/Editing/CustomAttributes.js.map +1 -0
  269. package/lib/esm/Editing/ECClasses.d.ts +86 -0
  270. package/lib/esm/Editing/ECClasses.d.ts.map +1 -0
  271. package/lib/esm/Editing/ECClasses.js +294 -0
  272. package/lib/esm/Editing/ECClasses.js.map +1 -0
  273. package/lib/esm/Editing/Editor.d.ts +117 -0
  274. package/lib/esm/Editing/Editor.d.ts.map +1 -0
  275. package/lib/esm/Editing/Editor.js +264 -0
  276. package/lib/esm/Editing/Editor.js.map +1 -0
  277. package/lib/esm/Editing/Entities.d.ts +38 -0
  278. package/lib/esm/Editing/Entities.d.ts.map +1 -0
  279. package/lib/esm/Editing/Entities.js +126 -0
  280. package/lib/esm/Editing/Entities.js.map +1 -0
  281. package/lib/esm/Editing/Enumerations.d.ts +25 -0
  282. package/lib/esm/Editing/Enumerations.d.ts.map +1 -0
  283. package/lib/esm/Editing/Enumerations.js +90 -0
  284. package/lib/esm/Editing/Enumerations.js.map +1 -0
  285. package/lib/esm/Editing/Exception.d.ts +358 -0
  286. package/lib/esm/Editing/Exception.d.ts.map +1 -0
  287. package/lib/esm/Editing/Exception.js +471 -0
  288. package/lib/esm/Editing/Exception.js.map +1 -0
  289. package/lib/esm/Editing/Formats.d.ts +23 -0
  290. package/lib/esm/Editing/Formats.d.ts.map +1 -0
  291. package/lib/esm/Editing/Formats.js +67 -0
  292. package/lib/esm/Editing/Formats.js.map +1 -0
  293. package/lib/esm/Editing/InvertedUnits.d.ts +19 -0
  294. package/lib/esm/Editing/InvertedUnits.d.ts.map +1 -0
  295. package/lib/esm/Editing/InvertedUnits.js +68 -0
  296. package/lib/esm/Editing/InvertedUnits.js.map +1 -0
  297. package/lib/esm/Editing/KindOfQuantities.d.ts +30 -0
  298. package/lib/esm/Editing/KindOfQuantities.d.ts.map +1 -0
  299. package/lib/esm/Editing/KindOfQuantities.js +92 -0
  300. package/lib/esm/Editing/KindOfQuantities.js.map +1 -0
  301. package/lib/esm/Editing/Mixins.d.ts +35 -0
  302. package/lib/esm/Editing/Mixins.d.ts.map +1 -0
  303. package/lib/esm/Editing/Mixins.js +90 -0
  304. package/lib/esm/Editing/Mixins.js.map +1 -0
  305. package/lib/esm/Editing/Mutable/MutableArrayProperty.d.ts +10 -0
  306. package/lib/esm/Editing/Mutable/MutableArrayProperty.d.ts.map +1 -0
  307. package/lib/esm/Editing/Mutable/MutableArrayProperty.js +12 -0
  308. package/lib/esm/Editing/Mutable/MutableArrayProperty.js.map +1 -0
  309. package/lib/esm/Editing/Mutable/MutableCAClass.d.ts +10 -0
  310. package/lib/esm/Editing/Mutable/MutableCAClass.d.ts.map +1 -0
  311. package/lib/esm/Editing/Mutable/MutableCAClass.js +12 -0
  312. package/lib/esm/Editing/Mutable/MutableCAClass.js.map +1 -0
  313. package/lib/esm/Editing/Mutable/MutableClass.d.ts +39 -0
  314. package/lib/esm/Editing/Mutable/MutableClass.d.ts.map +1 -0
  315. package/lib/esm/Editing/Mutable/MutableClass.js +18 -0
  316. package/lib/esm/Editing/Mutable/MutableClass.js.map +1 -0
  317. package/lib/esm/Editing/Mutable/MutableConstant.d.ts +14 -0
  318. package/lib/esm/Editing/Mutable/MutableConstant.d.ts.map +1 -0
  319. package/lib/esm/Editing/Mutable/MutableConstant.js +12 -0
  320. package/lib/esm/Editing/Mutable/MutableConstant.js.map +1 -0
  321. package/lib/esm/Editing/Mutable/MutableEntityClass.d.ts +12 -0
  322. package/lib/esm/Editing/Mutable/MutableEntityClass.d.ts.map +1 -0
  323. package/lib/esm/Editing/Mutable/MutableEntityClass.js +12 -0
  324. package/lib/esm/Editing/Mutable/MutableEntityClass.js.map +1 -0
  325. package/lib/esm/Editing/Mutable/MutableEnumeration.d.ts +11 -0
  326. package/lib/esm/Editing/Mutable/MutableEnumeration.d.ts.map +1 -0
  327. package/lib/esm/Editing/Mutable/MutableEnumeration.js +11 -0
  328. package/lib/esm/Editing/Mutable/MutableEnumeration.js.map +1 -0
  329. package/lib/esm/Editing/Mutable/MutableFormat.d.ts +26 -0
  330. package/lib/esm/Editing/Mutable/MutableFormat.d.ts.map +1 -0
  331. package/lib/esm/Editing/Mutable/MutableFormat.js +12 -0
  332. package/lib/esm/Editing/Mutable/MutableFormat.js.map +1 -0
  333. package/lib/esm/Editing/Mutable/MutableInvertedUnit.d.ts +11 -0
  334. package/lib/esm/Editing/Mutable/MutableInvertedUnit.d.ts.map +1 -0
  335. package/lib/esm/Editing/Mutable/MutableInvertedUnit.js +12 -0
  336. package/lib/esm/Editing/Mutable/MutableInvertedUnit.js.map +1 -0
  337. package/lib/esm/Editing/Mutable/MutableKindOfQuantity.d.ts +14 -0
  338. package/lib/esm/Editing/Mutable/MutableKindOfQuantity.d.ts.map +1 -0
  339. package/lib/esm/Editing/Mutable/MutableKindOfQuantity.js +12 -0
  340. package/lib/esm/Editing/Mutable/MutableKindOfQuantity.js.map +1 -0
  341. package/lib/esm/Editing/Mutable/MutableMixin.d.ts +12 -0
  342. package/lib/esm/Editing/Mutable/MutableMixin.d.ts.map +1 -0
  343. package/lib/esm/Editing/Mutable/MutableMixin.js +12 -0
  344. package/lib/esm/Editing/Mutable/MutableMixin.js.map +1 -0
  345. package/lib/esm/Editing/Mutable/MutableNavigationProperty.d.ts +8 -0
  346. package/lib/esm/Editing/Mutable/MutableNavigationProperty.d.ts.map +1 -0
  347. package/lib/esm/Editing/Mutable/MutableNavigationProperty.js +12 -0
  348. package/lib/esm/Editing/Mutable/MutableNavigationProperty.js.map +1 -0
  349. package/lib/esm/Editing/Mutable/MutablePhenomenon.d.ts +11 -0
  350. package/lib/esm/Editing/Mutable/MutablePhenomenon.d.ts.map +1 -0
  351. package/lib/esm/Editing/Mutable/MutablePhenomenon.js +12 -0
  352. package/lib/esm/Editing/Mutable/MutablePhenomenon.js.map +1 -0
  353. package/lib/esm/Editing/Mutable/MutablePrimitiveOrEnumProperty.d.ts +13 -0
  354. package/lib/esm/Editing/Mutable/MutablePrimitiveOrEnumProperty.d.ts.map +1 -0
  355. package/lib/esm/Editing/Mutable/MutablePrimitiveOrEnumProperty.js +12 -0
  356. package/lib/esm/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -0
  357. package/lib/esm/Editing/Mutable/MutableProperty.d.ts +16 -0
  358. package/lib/esm/Editing/Mutable/MutableProperty.d.ts.map +1 -0
  359. package/lib/esm/Editing/Mutable/MutableProperty.js +12 -0
  360. package/lib/esm/Editing/Mutable/MutableProperty.js.map +1 -0
  361. package/lib/esm/Editing/Mutable/MutablePropertyCategory.d.ts +11 -0
  362. package/lib/esm/Editing/Mutable/MutablePropertyCategory.d.ts.map +1 -0
  363. package/lib/esm/Editing/Mutable/MutablePropertyCategory.js +12 -0
  364. package/lib/esm/Editing/Mutable/MutablePropertyCategory.js.map +1 -0
  365. package/lib/esm/Editing/Mutable/MutableRelationshipClass.d.ts +30 -0
  366. package/lib/esm/Editing/Mutable/MutableRelationshipClass.d.ts.map +1 -0
  367. package/lib/esm/Editing/Mutable/MutableRelationshipClass.js +20 -0
  368. package/lib/esm/Editing/Mutable/MutableRelationshipClass.js.map +1 -0
  369. package/lib/esm/Editing/Mutable/MutableSchema.d.ts +51 -0
  370. package/lib/esm/Editing/Mutable/MutableSchema.d.ts.map +1 -0
  371. package/lib/esm/Editing/Mutable/MutableSchema.js +14 -0
  372. package/lib/esm/Editing/Mutable/MutableSchema.js.map +1 -0
  373. package/lib/esm/Editing/Mutable/MutableSchemaItem.d.ts +11 -0
  374. package/lib/esm/Editing/Mutable/MutableSchemaItem.d.ts.map +1 -0
  375. package/lib/esm/Editing/Mutable/MutableSchemaItem.js +12 -0
  376. package/lib/esm/Editing/Mutable/MutableSchemaItem.js.map +1 -0
  377. package/lib/esm/Editing/Mutable/MutableStructProperty.d.ts +8 -0
  378. package/lib/esm/Editing/Mutable/MutableStructProperty.d.ts.map +1 -0
  379. package/lib/esm/Editing/Mutable/MutableStructProperty.js +12 -0
  380. package/lib/esm/Editing/Mutable/MutableStructProperty.js.map +1 -0
  381. package/lib/esm/Editing/Mutable/MutableUnit.d.ts +12 -0
  382. package/lib/esm/Editing/Mutable/MutableUnit.d.ts.map +1 -0
  383. package/lib/esm/Editing/Mutable/MutableUnit.js +12 -0
  384. package/lib/esm/Editing/Mutable/MutableUnit.js.map +1 -0
  385. package/lib/esm/Editing/Mutable/MutableUnitSystem.d.ts +10 -0
  386. package/lib/esm/Editing/Mutable/MutableUnitSystem.d.ts.map +1 -0
  387. package/lib/esm/Editing/Mutable/MutableUnitSystem.js +12 -0
  388. package/lib/esm/Editing/Mutable/MutableUnitSystem.js.map +1 -0
  389. package/lib/esm/Editing/Phenomena.d.ts +17 -0
  390. package/lib/esm/Editing/Phenomena.d.ts.map +1 -0
  391. package/lib/esm/Editing/Phenomena.js +44 -0
  392. package/lib/esm/Editing/Phenomena.js.map +1 -0
  393. package/lib/esm/Editing/Properties.d.ts +206 -0
  394. package/lib/esm/Editing/Properties.d.ts.map +1 -0
  395. package/lib/esm/Editing/Properties.js +415 -0
  396. package/lib/esm/Editing/Properties.js.map +1 -0
  397. package/lib/esm/Editing/PropertyCategories.d.ts +18 -0
  398. package/lib/esm/Editing/PropertyCategories.d.ts.map +1 -0
  399. package/lib/esm/Editing/PropertyCategories.js +54 -0
  400. package/lib/esm/Editing/PropertyCategories.js.map +1 -0
  401. package/lib/esm/Editing/RelationshipClasses.d.ts +69 -0
  402. package/lib/esm/Editing/RelationshipClasses.d.ts.map +1 -0
  403. package/lib/esm/Editing/RelationshipClasses.js +236 -0
  404. package/lib/esm/Editing/RelationshipClasses.js.map +1 -0
  405. package/lib/esm/Editing/SchemaItems.d.ts +42 -0
  406. package/lib/esm/Editing/SchemaItems.d.ts.map +1 -0
  407. package/lib/esm/Editing/SchemaItems.js +104 -0
  408. package/lib/esm/Editing/SchemaItems.js.map +1 -0
  409. package/lib/esm/Editing/Structs.d.ts +21 -0
  410. package/lib/esm/Editing/Structs.d.ts.map +1 -0
  411. package/lib/esm/Editing/Structs.js +47 -0
  412. package/lib/esm/Editing/Structs.js.map +1 -0
  413. package/lib/esm/Editing/UnitSystems.d.ts +17 -0
  414. package/lib/esm/Editing/UnitSystems.d.ts.map +1 -0
  415. package/lib/esm/Editing/UnitSystems.js +43 -0
  416. package/lib/esm/Editing/UnitSystems.js.map +1 -0
  417. package/lib/esm/Editing/Units.d.ts +17 -0
  418. package/lib/esm/Editing/Units.d.ts.map +1 -0
  419. package/lib/esm/Editing/Units.js +49 -0
  420. package/lib/esm/Editing/Units.js.map +1 -0
  421. package/lib/esm/Merging/ClassMerger.d.ts +9 -0
  422. package/lib/esm/Merging/ClassMerger.d.ts.map +1 -0
  423. package/lib/esm/Merging/ClassMerger.js +66 -0
  424. package/lib/esm/Merging/ClassMerger.js.map +1 -0
  425. package/lib/esm/Merging/ConstantMerger.d.ts +14 -0
  426. package/lib/esm/Merging/ConstantMerger.d.ts.map +1 -0
  427. package/lib/esm/Merging/ConstantMerger.js +64 -0
  428. package/lib/esm/Merging/ConstantMerger.js.map +1 -0
  429. package/lib/esm/Merging/CustomAttributeClassMerger.d.ts +14 -0
  430. package/lib/esm/Merging/CustomAttributeClassMerger.d.ts.map +1 -0
  431. package/lib/esm/Merging/CustomAttributeClassMerger.js +36 -0
  432. package/lib/esm/Merging/CustomAttributeClassMerger.js.map +1 -0
  433. package/lib/esm/Merging/CustomAttributeMerger.d.ts +19 -0
  434. package/lib/esm/Merging/CustomAttributeMerger.d.ts.map +1 -0
  435. package/lib/esm/Merging/CustomAttributeMerger.js +66 -0
  436. package/lib/esm/Merging/CustomAttributeMerger.js.map +1 -0
  437. package/lib/esm/Merging/Edits/NameMapping.d.ts +22 -0
  438. package/lib/esm/Merging/Edits/NameMapping.d.ts.map +1 -0
  439. package/lib/esm/Merging/Edits/NameMapping.js +49 -0
  440. package/lib/esm/Merging/Edits/NameMapping.js.map +1 -0
  441. package/lib/esm/Merging/Edits/RenameEditHandler.d.ts +14 -0
  442. package/lib/esm/Merging/Edits/RenameEditHandler.d.ts.map +1 -0
  443. package/lib/esm/Merging/Edits/RenameEditHandler.js +62 -0
  444. package/lib/esm/Merging/Edits/RenameEditHandler.js.map +1 -0
  445. package/lib/esm/Merging/Edits/SchemaEdits.d.ts +81 -0
  446. package/lib/esm/Merging/Edits/SchemaEdits.d.ts.map +1 -0
  447. package/lib/esm/Merging/Edits/SchemaEdits.js +112 -0
  448. package/lib/esm/Merging/Edits/SchemaEdits.js.map +1 -0
  449. package/lib/esm/Merging/Edits/SkipEditHandler.d.ts +14 -0
  450. package/lib/esm/Merging/Edits/SkipEditHandler.d.ts.map +1 -0
  451. package/lib/esm/Merging/Edits/SkipEditHandler.js +60 -0
  452. package/lib/esm/Merging/Edits/SkipEditHandler.js.map +1 -0
  453. package/lib/esm/Merging/EntityClassMerger.d.ts +19 -0
  454. package/lib/esm/Merging/EntityClassMerger.d.ts.map +1 -0
  455. package/lib/esm/Merging/EntityClassMerger.js +39 -0
  456. package/lib/esm/Merging/EntityClassMerger.js.map +1 -0
  457. package/lib/esm/Merging/EnumerationMerger.d.ts +14 -0
  458. package/lib/esm/Merging/EnumerationMerger.d.ts.map +1 -0
  459. package/lib/esm/Merging/EnumerationMerger.js +48 -0
  460. package/lib/esm/Merging/EnumerationMerger.js.map +1 -0
  461. package/lib/esm/Merging/EnumeratorMerger.d.ts +14 -0
  462. package/lib/esm/Merging/EnumeratorMerger.d.ts.map +1 -0
  463. package/lib/esm/Merging/EnumeratorMerger.js +36 -0
  464. package/lib/esm/Merging/EnumeratorMerger.js.map +1 -0
  465. package/lib/esm/Merging/FormatMerger.d.ts +24 -0
  466. package/lib/esm/Merging/FormatMerger.d.ts.map +1 -0
  467. package/lib/esm/Merging/FormatMerger.js +139 -0
  468. package/lib/esm/Merging/FormatMerger.js.map +1 -0
  469. package/lib/esm/Merging/InvertedUnitMerger.d.ts +14 -0
  470. package/lib/esm/Merging/InvertedUnitMerger.d.ts.map +1 -0
  471. package/lib/esm/Merging/InvertedUnitMerger.js +41 -0
  472. package/lib/esm/Merging/InvertedUnitMerger.js.map +1 -0
  473. package/lib/esm/Merging/KindOfQuantityMerger.d.ts +19 -0
  474. package/lib/esm/Merging/KindOfQuantityMerger.d.ts.map +1 -0
  475. package/lib/esm/Merging/KindOfQuantityMerger.js +92 -0
  476. package/lib/esm/Merging/KindOfQuantityMerger.js.map +1 -0
  477. package/lib/esm/Merging/MixinMerger.d.ts +14 -0
  478. package/lib/esm/Merging/MixinMerger.d.ts.map +1 -0
  479. package/lib/esm/Merging/MixinMerger.js +33 -0
  480. package/lib/esm/Merging/MixinMerger.js.map +1 -0
  481. package/lib/esm/Merging/PhenomenonMerger.d.ts +14 -0
  482. package/lib/esm/Merging/PhenomenonMerger.d.ts.map +1 -0
  483. package/lib/esm/Merging/PhenomenonMerger.js +36 -0
  484. package/lib/esm/Merging/PhenomenonMerger.js.map +1 -0
  485. package/lib/esm/Merging/PropertyCategoryMerger.d.ts +14 -0
  486. package/lib/esm/Merging/PropertyCategoryMerger.d.ts.map +1 -0
  487. package/lib/esm/Merging/PropertyCategoryMerger.js +31 -0
  488. package/lib/esm/Merging/PropertyCategoryMerger.js.map +1 -0
  489. package/lib/esm/Merging/PropertyMerger.d.ts +12 -0
  490. package/lib/esm/Merging/PropertyMerger.d.ts.map +1 -0
  491. package/lib/esm/Merging/PropertyMerger.js +228 -0
  492. package/lib/esm/Merging/PropertyMerger.js.map +1 -0
  493. package/lib/esm/Merging/RelationshipClassMerger.d.ts +27 -0
  494. package/lib/esm/Merging/RelationshipClassMerger.d.ts.map +1 -0
  495. package/lib/esm/Merging/RelationshipClassMerger.js +136 -0
  496. package/lib/esm/Merging/RelationshipClassMerger.js.map +1 -0
  497. package/lib/esm/Merging/SchemaMerger.d.ts +49 -0
  498. package/lib/esm/Merging/SchemaMerger.d.ts.map +1 -0
  499. package/lib/esm/Merging/SchemaMerger.js +117 -0
  500. package/lib/esm/Merging/SchemaMerger.js.map +1 -0
  501. package/lib/esm/Merging/SchemaMergingVisitor.d.ts +149 -0
  502. package/lib/esm/Merging/SchemaMergingVisitor.d.ts.map +1 -0
  503. package/lib/esm/Merging/SchemaMergingVisitor.js +339 -0
  504. package/lib/esm/Merging/SchemaMergingVisitor.js.map +1 -0
  505. package/lib/esm/Merging/SchemaMergingWalker.d.ts +19 -0
  506. package/lib/esm/Merging/SchemaMergingWalker.d.ts.map +1 -0
  507. package/lib/esm/Merging/SchemaMergingWalker.js +61 -0
  508. package/lib/esm/Merging/SchemaMergingWalker.js.map +1 -0
  509. package/lib/esm/Merging/SchemaReferenceMerger.d.ts +13 -0
  510. package/lib/esm/Merging/SchemaReferenceMerger.d.ts.map +1 -0
  511. package/lib/esm/Merging/SchemaReferenceMerger.js +57 -0
  512. package/lib/esm/Merging/SchemaReferenceMerger.js.map +1 -0
  513. package/lib/esm/Merging/StructClassMerger.d.ts +14 -0
  514. package/lib/esm/Merging/StructClassMerger.d.ts.map +1 -0
  515. package/lib/esm/Merging/StructClassMerger.js +20 -0
  516. package/lib/esm/Merging/StructClassMerger.js.map +1 -0
  517. package/lib/esm/Merging/UnitMerger.d.ts +14 -0
  518. package/lib/esm/Merging/UnitMerger.d.ts.map +1 -0
  519. package/lib/esm/Merging/UnitMerger.js +58 -0
  520. package/lib/esm/Merging/UnitMerger.js.map +1 -0
  521. package/lib/esm/Merging/UnitSystemMerger.d.ts +14 -0
  522. package/lib/esm/Merging/UnitSystemMerger.d.ts.map +1 -0
  523. package/lib/esm/Merging/UnitSystemMerger.js +24 -0
  524. package/lib/esm/Merging/UnitSystemMerger.js.map +1 -0
  525. package/lib/esm/Merging/Utils.d.ts +34 -0
  526. package/lib/esm/Merging/Utils.d.ts.map +1 -0
  527. package/lib/esm/Merging/Utils.js +90 -0
  528. package/lib/esm/Merging/Utils.js.map +1 -0
  529. package/lib/esm/Validation/Diagnostic.d.ts +322 -0
  530. package/lib/esm/Validation/Diagnostic.d.ts.map +1 -0
  531. package/lib/esm/Validation/Diagnostic.js +295 -0
  532. package/lib/esm/Validation/Diagnostic.js.map +1 -0
  533. package/lib/esm/Validation/DiagnosticReporter.d.ts +97 -0
  534. package/lib/esm/Validation/DiagnosticReporter.d.ts.map +1 -0
  535. package/lib/esm/Validation/DiagnosticReporter.js +105 -0
  536. package/lib/esm/Validation/DiagnosticReporter.js.map +1 -0
  537. package/lib/esm/Validation/ECRules.d.ts +454 -0
  538. package/lib/esm/Validation/ECRules.d.ts.map +1 -0
  539. package/lib/esm/Validation/ECRules.js +578 -0
  540. package/lib/esm/Validation/ECRules.js.map +1 -0
  541. package/lib/esm/Validation/LoggingDiagnosticReporter.d.ts +14 -0
  542. package/lib/esm/Validation/LoggingDiagnosticReporter.d.ts.map +1 -0
  543. package/lib/esm/Validation/LoggingDiagnosticReporter.js +37 -0
  544. package/lib/esm/Validation/LoggingDiagnosticReporter.js.map +1 -0
  545. package/lib/esm/Validation/RuleSuppressionSet.d.ts +60 -0
  546. package/lib/esm/Validation/RuleSuppressionSet.d.ts.map +1 -0
  547. package/lib/esm/Validation/RuleSuppressionSet.js +9 -0
  548. package/lib/esm/Validation/RuleSuppressionSet.js.map +1 -0
  549. package/lib/esm/Validation/Rules.d.ts +65 -0
  550. package/lib/esm/Validation/Rules.d.ts.map +1 -0
  551. package/lib/esm/Validation/Rules.js +9 -0
  552. package/lib/esm/Validation/Rules.js.map +1 -0
  553. package/lib/esm/Validation/SchemaChanges.d.ts +640 -0
  554. package/lib/esm/Validation/SchemaChanges.d.ts.map +1 -0
  555. package/lib/esm/Validation/SchemaChanges.js +1141 -0
  556. package/lib/esm/Validation/SchemaChanges.js.map +1 -0
  557. package/lib/esm/Validation/SchemaCompareDiagnostics.d.ts +423 -0
  558. package/lib/esm/Validation/SchemaCompareDiagnostics.d.ts.map +1 -0
  559. package/lib/esm/Validation/SchemaCompareDiagnostics.js +109 -0
  560. package/lib/esm/Validation/SchemaCompareDiagnostics.js.map +1 -0
  561. package/lib/esm/Validation/SchemaCompareReporter.d.ts +12 -0
  562. package/lib/esm/Validation/SchemaCompareReporter.d.ts.map +1 -0
  563. package/lib/esm/Validation/SchemaCompareReporter.js +9 -0
  564. package/lib/esm/Validation/SchemaCompareReporter.js.map +1 -0
  565. package/lib/esm/Validation/SchemaCompareResultDelegate.d.ts +237 -0
  566. package/lib/esm/Validation/SchemaCompareResultDelegate.d.ts.map +1 -0
  567. package/lib/esm/Validation/SchemaCompareResultDelegate.js +346 -0
  568. package/lib/esm/Validation/SchemaCompareResultDelegate.js.map +1 -0
  569. package/lib/esm/Validation/SchemaCompareVisitor.d.ts +120 -0
  570. package/lib/esm/Validation/SchemaCompareVisitor.d.ts.map +1 -0
  571. package/lib/esm/Validation/SchemaCompareVisitor.js +222 -0
  572. package/lib/esm/Validation/SchemaCompareVisitor.js.map +1 -0
  573. package/lib/esm/Validation/SchemaComparer.d.ts +211 -0
  574. package/lib/esm/Validation/SchemaComparer.d.ts.map +1 -0
  575. package/lib/esm/Validation/SchemaComparer.js +781 -0
  576. package/lib/esm/Validation/SchemaComparer.js.map +1 -0
  577. package/lib/esm/Validation/SchemaValidater.d.ts +20 -0
  578. package/lib/esm/Validation/SchemaValidater.d.ts.map +1 -0
  579. package/lib/esm/Validation/SchemaValidater.js +55 -0
  580. package/lib/esm/Validation/SchemaValidater.js.map +1 -0
  581. package/lib/esm/Validation/SchemaValidationVisitor.d.ts +171 -0
  582. package/lib/esm/Validation/SchemaValidationVisitor.d.ts.map +1 -0
  583. package/lib/esm/Validation/SchemaValidationVisitor.js +488 -0
  584. package/lib/esm/Validation/SchemaValidationVisitor.js.map +1 -0
  585. package/lib/esm/Validation/SchemaWalker.d.ts +23 -0
  586. package/lib/esm/Validation/SchemaWalker.d.ts.map +1 -0
  587. package/lib/esm/Validation/SchemaWalker.js +50 -0
  588. package/lib/esm/Validation/SchemaWalker.js.map +1 -0
  589. package/lib/esm/ecschema-editing.d.ts +49 -0
  590. package/lib/esm/ecschema-editing.d.ts.map +1 -0
  591. package/lib/esm/ecschema-editing.js +52 -0
  592. package/lib/esm/ecschema-editing.js.map +1 -0
  593. package/package.json +19 -17
  594. package/public/locales/en/ECSchemaEditing.json +26 -26
@@ -1,10 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toItemKey = toItemKey;
4
+ exports.toPropertyKey = toPropertyKey;
3
5
  exports.updateSchemaItemFullName = updateSchemaItemFullName;
4
6
  exports.updateSchemaItemKey = updateSchemaItemKey;
5
7
  exports.locateSchemaItem = locateSchemaItem;
6
8
  exports.getClassEditor = getClassEditor;
9
+ const NameMapping_1 = require("./Edits/NameMapping");
7
10
  const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
11
+ /**
12
+ * Resolves a SchemaItemKey for the given item name.
13
+ * @internal
14
+ */
15
+ function toItemKey(context, itemName) {
16
+ const classKey = context.nameMapping.resolveItemKey(new ecschema_metadata_1.SchemaItemKey(itemName, context.sourceSchemaKey));
17
+ return new ecschema_metadata_1.SchemaItemKey(classKey.name, context.targetSchemaKey);
18
+ }
19
+ /**
20
+ * Resolves a SchemaItemKey for the given class property name.
21
+ * @internal
22
+ */
23
+ function toPropertyKey(context, itemName, propertyName) {
24
+ const classKey = new ecschema_metadata_1.SchemaItemKey(itemName, context.sourceSchemaKey);
25
+ return context.nameMapping.resolvePropertyKey(new NameMapping_1.PropertyKey(propertyName, classKey));
26
+ }
8
27
  /**
9
28
  * Convenience-method around updateSchemaItemKey that returns the full name instead of a SchemaItemKey.
10
29
  * @internal
@@ -21,7 +40,8 @@ async function updateSchemaItemFullName(context, reference) {
21
40
  async function updateSchemaItemKey(context, reference) {
22
41
  const [schemaName, itemName] = ecschema_metadata_1.SchemaItem.parseFullName(reference);
23
42
  if (context.sourceSchemaKey.compareByName(schemaName)) {
24
- return resolveSchemaItemKey(context.editor.schemaContext, new ecschema_metadata_1.SchemaItemKey(itemName, context.targetSchemaKey));
43
+ const schemaItemKey = toItemKey(context, itemName);
44
+ return resolveSchemaItemKey(context.editor.schemaContext, schemaItemKey);
25
45
  }
26
46
  const referencedSchema = await context.targetSchema.getReference(schemaName);
27
47
  if (referencedSchema !== undefined) {
@@ -46,10 +66,10 @@ async function resolveSchemaItemKey(schemaContext, itemKey) {
46
66
  * @internal
47
67
  */
48
68
  async function locateSchemaItem(context, itemName, schemaType) {
49
- const schemaItemKey = new ecschema_metadata_1.SchemaItemKey(itemName, context.targetSchemaKey);
69
+ const schemaItemKey = toItemKey(context, itemName);
50
70
  const schemaItem = await context.editor.schemaContext.getSchemaItem(schemaItemKey);
51
71
  if (schemaItem === undefined) {
52
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `${schemaType} ${schemaItemKey.fullName} not found in schema context.`);
72
+ throw new ecschema_metadata_1.ECSchemaError(ecschema_metadata_1.ECSchemaStatus.ClassNotFound, `${schemaType} ${schemaItemKey.fullName} not found in schema context.`);
53
73
  }
54
74
  return schemaItem;
55
75
  }
@@ -59,7 +79,7 @@ async function locateSchemaItem(context, itemName, schemaType) {
59
79
  async function getClassEditor(context, ecClass) {
60
80
  const schemaItemType = ecschema_metadata_1.ECClass.isECClass(ecClass)
61
81
  ? ecClass.schemaItemType
62
- : (await context.editor.schemaContext.getSchemaItem(ecClass))?.schemaItemType;
82
+ : (await context.editor.schemaContext.getSchemaItem(ecClass, ecschema_metadata_1.ECClass))?.schemaItemType;
63
83
  switch (schemaItemType) {
64
84
  case ecschema_metadata_1.SchemaItemType.EntityClass:
65
85
  return context.editor.entities;
@@ -1 +1 @@
1
- {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/Merging/Utils.ts"],"names":[],"mappings":";;AAYA,4DAGC;AAOD,kDAYC;AAmBD,4CAQC;AAKD,wCAmBC;AA/ED,gEAA8I;AAE9I;;;GAGG;AACI,KAAK,UAAU,wBAAwB,CAAC,OAA2B,EAAE,SAAiB;IAC3F,MAAM,aAAa,GAAG,MAAM,mBAAmB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C,eAAe,CAAC,CAAC;IAC3E,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;IACnF,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,aAAa,EAAE,GAAG,UAAU,IAAI,aAAa,CAAC,QAAQ,+BAA+B,CAAC,CAAC;IAClI,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,cAAc,CAAC,OAA2B,EAAE,OAAgC;IAChG,MAAM,cAAc,GAAG,2BAAO,CAAC,SAAS,CAAC,OAAO,CAAC;QAC/C,CAAC,CAAC,OAAO,CAAC,cAAc;QACxB,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,CAAU,OAAO,CAAC,CAAC,EAAE,cAAc,CAAC;IAEzF,QAAO,cAAc,EAAE,CAAC;QACtB,KAAK,kCAAc,CAAC,WAAW;YAC7B,OAAO,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;QACjC,KAAK,kCAAc,CAAC,KAAK;YACvB,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;QAC/B,KAAK,kCAAc,CAAC,WAAW;YAC7B,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;QAChC,KAAK,kCAAc,CAAC,oBAAoB;YACtC,OAAO,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC;QACzC,KAAK,kCAAc,CAAC,iBAAiB;YACnC,OAAO,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC;QACtC;YACE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACpD,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { ECClasses } from \"../Editing/ECClasses\";\r\nimport type { SchemaMergeContext } from \"./SchemaMerger\";\r\nimport { ECClass, ECObjectsError, ECObjectsStatus, SchemaContext, SchemaItem, SchemaItemKey, SchemaItemType } from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * Convenience-method around updateSchemaItemKey that returns the full name instead of a SchemaItemKey.\r\n * @internal\r\n */\r\nexport async function updateSchemaItemFullName(context: SchemaMergeContext, reference: string) {\r\n const schemaItemKey = await updateSchemaItemKey(context, reference);\r\n return schemaItemKey.fullName;\r\n}\r\n\r\n/**\r\n * Updates the given reference if it refers to a SchemaItem in the source Schema and\r\n * returns a SchemaItemKey. If any other schema is referred the reference is not change.\r\n * @internal\r\n */\r\nexport async function updateSchemaItemKey(context: SchemaMergeContext, reference: string) {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(reference);\r\n if (context.sourceSchemaKey.compareByName(schemaName)) {\r\n return resolveSchemaItemKey(context.editor.schemaContext, new SchemaItemKey(itemName, context.targetSchemaKey));\r\n }\r\n\r\n const referencedSchema = await context.targetSchema.getReference(schemaName);\r\n if (referencedSchema !== undefined) {\r\n return resolveSchemaItemKey(context.editor.schemaContext, new SchemaItemKey(itemName, referencedSchema.schemaKey));\r\n }\r\n\r\n throw new Error(`Cannot locate referenced schema item ${reference}`);\r\n}\r\n\r\n/**\r\n * To support case insensitivity for schema items, the given key is checked if there\r\n * exists an item for it.\r\n * @internal\r\n */\r\nasync function resolveSchemaItemKey(schemaContext: SchemaContext, itemKey: SchemaItemKey): Promise<SchemaItemKey> {\r\n const item = await schemaContext.getSchemaItem(itemKey);\r\n if (item === undefined) {\r\n // If the schema item hasn't been created yet, we have to trust the given key is correctly spelled.\r\n return itemKey;\r\n }\r\n return item.key;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport async function locateSchemaItem(context: SchemaMergeContext, itemName: string, schemaType: string) {\r\n const schemaItemKey = new SchemaItemKey(itemName, context.targetSchemaKey);\r\n const schemaItem = await context.editor.schemaContext.getSchemaItem(schemaItemKey);\r\n if (schemaItem === undefined) {\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `${schemaType} ${schemaItemKey.fullName} not found in schema context.`);\r\n }\r\n\r\n return schemaItem;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport async function getClassEditor(context: SchemaMergeContext, ecClass: ECClass | SchemaItemKey): Promise<ECClasses> {\r\n const schemaItemType = ECClass.isECClass(ecClass)\r\n ? ecClass.schemaItemType\r\n : (await context.editor.schemaContext.getSchemaItem<ECClass>(ecClass))?.schemaItemType;\r\n\r\n switch(schemaItemType) {\r\n case SchemaItemType.EntityClass:\r\n return context.editor.entities;\r\n case SchemaItemType.Mixin:\r\n return context.editor.mixins;\r\n case SchemaItemType.StructClass:\r\n return context.editor.structs;\r\n case SchemaItemType.CustomAttributeClass:\r\n return context.editor.customAttributes;\r\n case SchemaItemType.RelationshipClass:\r\n return context.editor.relationships;\r\n default:\r\n throw new Error(\"SchemaItemType not supported\");\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/Merging/Utils.ts"],"names":[],"mappings":";;AAaA,8BAGC;AAMD,sCAGC;AAMD,4DAGC;AAOD,kDAaC;AAmBD,4CAQC;AAKD,wCAmBC;AApGD,qDAAkD;AAElD,gEAA4I;AAE5I;;;GAGG;AACH,SAAgB,SAAS,CAAC,OAA2B,EAAE,QAAgB;IACrE,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,iCAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC;IAC1G,OAAO,IAAI,iCAAa,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;AACnE,CAAC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,OAA2B,EAAE,QAAgB,EAAE,YAAoB;IAC/F,MAAM,QAA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C,MAAM,CAAC,gBAAgB,CAAC;QACzC,KAAK,kCAAc,CAAC,iBAAiB;YACnC,OAAO,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC;QACtC;YACE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACpD,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { ECClasses } from \"../Editing/ECClasses\";\nimport { PropertyKey } from \"./Edits/NameMapping\";\nimport type { SchemaMergeContext } from \"./SchemaMerger\";\nimport { ECClass, ECSchemaError, ECSchemaStatus, SchemaContext, SchemaItem, SchemaItemKey, SchemaItemType } from \"@itwin/ecschema-metadata\";\n\n/**\n * Resolves a SchemaItemKey for the given item name.\n * @internal\n */\nexport function toItemKey(context: SchemaMergeContext, itemName: string): SchemaItemKey {\n const classKey = context.nameMapping.resolveItemKey(new SchemaItemKey(itemName, context.sourceSchemaKey));\n return new SchemaItemKey(classKey.name, context.targetSchemaKey);\n}\n\n/**\n * Resolves a SchemaItemKey for the given class property name.\n * @internal\n */\nexport function toPropertyKey(context: SchemaMergeContext, itemName: string, propertyName: string): PropertyKey {\n const classKey = new SchemaItemKey(itemName, context.sourceSchemaKey);\n return context.nameMapping.resolvePropertyKey(new PropertyKey(propertyName, classKey));\n}\n\n/**\n * Convenience-method around updateSchemaItemKey that returns the full name instead of a SchemaItemKey.\n * @internal\n */\nexport async function updateSchemaItemFullName(context: SchemaMergeContext, reference: string) {\n const schemaItemKey = await updateSchemaItemKey(context, reference);\n return schemaItemKey.fullName;\n}\n\n/**\n * Updates the given reference if it refers to a SchemaItem in the source Schema and\n * returns a SchemaItemKey. If any other schema is referred the reference is not change.\n * @internal\n */\nexport async function updateSchemaItemKey(context: SchemaMergeContext, reference: string) {\n const [schemaName, itemName] = SchemaItem.parseFullName(reference);\n if (context.sourceSchemaKey.compareByName(schemaName)) {\n const schemaItemKey = toItemKey(context, itemName);\n return resolveSchemaItemKey(context.editor.schemaContext, schemaItemKey);\n }\n\n const referencedSchema = await context.targetSchema.getReference(schemaName);\n if (referencedSchema !== undefined) {\n return resolveSchemaItemKey(context.editor.schemaContext, new SchemaItemKey(itemName, referencedSchema.schemaKey));\n }\n\n throw new Error(`Cannot locate referenced schema item ${reference}`);\n}\n\n/**\n * To support case insensitivity for schema items, the given key is checked if there\n * exists an item for it.\n * @internal\n */\nasync function resolveSchemaItemKey(schemaContext: SchemaContext, itemKey: SchemaItemKey): Promise<SchemaItemKey> {\n const item = await schemaContext.getSchemaItem(itemKey);\n if (item === undefined) {\n // If the schema item hasn't been created yet, we have to trust the given key is correctly spelled.\n return itemKey;\n }\n return item.key;\n}\n\n/**\n * @internal\n */\nexport async function locateSchemaItem(context: SchemaMergeContext, itemName: string, schemaType: string) {\n const schemaItemKey = toItemKey(context, itemName);\n const schemaItem = await context.editor.schemaContext.getSchemaItem(schemaItemKey);\n if (schemaItem === undefined) {\n throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `${schemaType} ${schemaItemKey.fullName} not found in schema context.`);\n }\n\n return schemaItem;\n}\n\n/**\n * @internal\n */\nexport async function getClassEditor(context: SchemaMergeContext, ecClass: ECClass | SchemaItemKey): Promise<ECClasses> {\n const schemaItemType = ECClass.isECClass(ecClass)\n ? ecClass.schemaItemType\n : (await context.editor.schemaContext.getSchemaItem(ecClass, ECClass))?.schemaItemType;\n\n switch(schemaItemType) {\n case SchemaItemType.EntityClass:\n return context.editor.entities;\n case SchemaItemType.Mixin:\n return context.editor.mixins;\n case SchemaItemType.StructClass:\n return context.editor.structs;\n case SchemaItemType.CustomAttributeClass:\n return context.editor.customAttributes;\n case SchemaItemType.RelationshipClass:\n return context.editor.relationships;\n default:\n throw new Error(\"SchemaItemType not supported\");\n }\n}\n"]}
@@ -64,6 +64,12 @@ class BaseDiagnostic {
64
64
  this.messageArgs = messageArgs;
65
65
  this.category = category;
66
66
  }
67
+ /** The EC object to associate with the diagnostic. */
68
+ ecDefinition;
69
+ /** The arguments used when formatting the diagnostic message. */
70
+ messageArgs;
71
+ /** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */
72
+ category;
67
73
  }
68
74
  exports.BaseDiagnostic = BaseDiagnostic;
69
75
  /**
@@ -71,6 +77,7 @@ exports.BaseDiagnostic = BaseDiagnostic;
71
77
  * @beta
72
78
  */
73
79
  class SchemaDiagnostic extends BaseDiagnostic {
80
+ static diagnosticType = DiagnosticType.SchemaItem;
74
81
  /**
75
82
  * Initializes a new SchemaDiagnostic.
76
83
  * @param ecDefinition The EC object to associate with the diagnostic.
@@ -86,12 +93,12 @@ class SchemaDiagnostic extends BaseDiagnostic {
86
93
  get diagnosticType() { return DiagnosticType.Schema; }
87
94
  }
88
95
  exports.SchemaDiagnostic = SchemaDiagnostic;
89
- SchemaDiagnostic.diagnosticType = DiagnosticType.SchemaItem;
90
96
  /**
91
97
  * An [[IDiagnostic]] implementation used for [[SchemaItem]] diagnostics.
92
98
  * @beta
93
99
  */
94
100
  class SchemaItemDiagnostic extends BaseDiagnostic {
101
+ static diagnosticType = DiagnosticType.SchemaItem;
95
102
  /**
96
103
  * Initializes a new SchemaItemDiagnostic.
97
104
  * @param ecDefinition The EC object to associate with the diagnostic.
@@ -107,7 +114,6 @@ class SchemaItemDiagnostic extends BaseDiagnostic {
107
114
  get diagnosticType() { return DiagnosticType.SchemaItem; }
108
115
  }
109
116
  exports.SchemaItemDiagnostic = SchemaItemDiagnostic;
110
- SchemaItemDiagnostic.diagnosticType = DiagnosticType.SchemaItem;
111
117
  /**
112
118
  * An [[IDiagnostic]] implementation used for [[ECClass]] diagnostics.
113
119
  * @beta
@@ -193,14 +199,12 @@ exports.CustomAttributeContainerDiagnostic = CustomAttributeContainerDiagnostic;
193
199
  * @beta
194
200
  */
195
201
  function createSchemaDiagnosticClass(code, messageText) {
196
- var _a;
197
202
  validateCode(code);
198
- return _a = class extends SchemaDiagnostic {
199
- get code() { return code; }
200
- get messageText() { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }
201
- },
202
- _a.code = code,
203
- _a;
203
+ return class extends SchemaDiagnostic {
204
+ static code = code;
205
+ get code() { return code; }
206
+ get messageText() { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }
207
+ };
204
208
  }
205
209
  /**
206
210
  * Helper method for creating [[SchemaItemDiagnostic]] child classes.
@@ -235,14 +239,12 @@ function createClassDiagnosticClass(code, messageText) {
235
239
  * @beta
236
240
  */
237
241
  function createPropertyDiagnosticClass(code, messageText) {
238
- var _a;
239
242
  validateCode(code);
240
- return _a = class extends PropertyDiagnostic {
241
- get code() { return code; }
242
- get messageText() { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }
243
- },
244
- _a.code = code,
245
- _a;
243
+ return class extends PropertyDiagnostic {
244
+ static code = code;
245
+ get code() { return code; }
246
+ get messageText() { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }
247
+ };
246
248
  }
247
249
  /**
248
250
  * Helper method for creating [[RelationshipConstraintDiagnostic]] child classes.
@@ -1 +1 @@
1
- {"version":3,"file":"Diagnostic.js","sourceRoot":"","sources":["../../../src/Validation/Diagnostic.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA6OH,kEAOC;AAQD,0EAMC;AAQD,gEAMC;AAQD,sEAOC;AAQD,kGAMC;AAQD,sGAMC;AAGD,gEAWC;AAGD,wDAeC;AAvVD,iDAAiD;AAEjD,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,GAAG,IAAc,EAAE,EAAE;IACzD,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;QACrD,OAAO,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,WAAW;YAC3C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;YACjB,CAAC,C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C,KAAK,cAAc,CAAC,MAAM;YACxB,OAAO,QAAQ,CAAC;QAClB,KAAK,cAAc,CAAC,UAAU;YAC5B,OAAO,YAAY,CAAC;IACxB,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,MAAM,GAAG,GAAG,mBAAmB,IAAI,0DAA0D,CAAC;IAC9F,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;IAEvB,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Diagnostic\r\n */\r\n\r\nimport { AnyClass, AnyECType, AnyProperty, CustomAttributeContainerProps, RelationshipConstraint, Schema, SchemaItem } from \"@itwin/ecschema-metadata\";\r\n\r\n/* eslint-disable @typescript-eslint/no-shadow */\r\n\r\nconst formatString = (format: string, ...args: string[]) => {\r\n return format.replace(/{(\\d+)}/g, (match, theNumber) => {\r\n return typeof args[theNumber] !== \"undefined\"\r\n ? args[theNumber]\r\n : match;\r\n });\r\n};\r\n\r\n/**\r\n * Defines the possible diagnostic types.\r\n * @beta\r\n */\r\nexport enum DiagnosticType {\r\n None,\r\n Schema,\r\n SchemaItem,\r\n Property,\r\n CustomAttributeContainer,\r\n RelationshipConstraint,\r\n}\r\n\r\n/**\r\n * Defines the possible diagnostic categories.\r\n * @beta\r\n */\r\nexport enum DiagnosticCategory {\r\n Warning,\r\n Error,\r\n Suggestion,\r\n Message,\r\n}\r\n\r\n/**\r\n * The interface implemented by all diagnostics used during schema validation.\r\n * @beta\r\n */\r\nexport interface IDiagnostic<TYPE extends AnyECType, ARGS extends any[]> {\r\n /** The diagnostic category (error, warning, etc...). Value is static across all instances. */\r\n category: DiagnosticCategory;\r\n /** The unique string identifier of the diagnostic in the format '<ruleSetName>:<number>. Value is static across all instances. */\r\n code: string;\r\n /** The context type of diagnostic (schema, schema item, property, etc...). Value is static across all instances. */\r\n diagnosticType: DiagnosticType;\r\n /** The unformatted message text associated with the diagnostic. Value is static across all instances. */\r\n messageText: string;\r\n /** The arguments used when formatted the diagnostic instance's message. */\r\n messageArgs?: ARGS;\r\n /** The EC object associated with the diagnostic instance. */\r\n ecDefinition: TYPE;\r\n /** The schema where the diagnostic originated. */\r\n schema: Schema;\r\n}\r\n\r\n/**\r\n * Type which encapsulates all possible diagnostics.\r\n * @beta\r\n */\r\nexport type AnyDiagnostic = IDiagnostic<AnyECType, any[]>;\r\n\r\n/**\r\n * The abstract base class for all [[IDiagnostic]] implementations.\r\n * @beta\r\n */\r\nexport abstract class BaseDiagnostic<TYPE extends AnyECType, ARGS extends any[]> implements IDiagnostic<TYPE, ARGS> {\r\n /**\r\n * Initializes a new BaseDiagnostic.\r\n * @param ecDefinition The EC object to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(ecDefinition: TYPE, messageArgs?: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n this.ecDefinition = ecDefinition;\r\n this.messageArgs = messageArgs;\r\n this.category = category;\r\n }\r\n\r\n /** Gets the unique string identifier for the diagnostic in the format '<ruleSetName>:<number>'. */\r\n public abstract get code(): string;\r\n /** Gets the context type of the diagnostic (schema, schema item, property, etc...) */\r\n public abstract get diagnosticType(): DiagnosticType;\r\n /** Gets the message associated with the diagnostic. */\r\n public abstract get messageText(): string;\r\n /** Gets the schema where the diagnostic originated. */\r\n public abstract get schema(): Schema;\r\n\r\n /** The EC object to associate with the diagnostic. */\r\n public ecDefinition: TYPE;\r\n /** The arguments used when formatting the diagnostic message. */\r\n public messageArgs?: ARGS;\r\n /** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */\r\n public category: DiagnosticCategory;\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[Schema]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class SchemaDiagnostic<ARGS extends any[]> extends BaseDiagnostic<Schema, ARGS> {\r\n public static diagnosticType = DiagnosticType.SchemaItem;\r\n\r\n /**\r\n * Initializes a new SchemaDiagnostic.\r\n * @param ecDefinition The EC object to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(schema: Schema, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(schema, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.Schema; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[SchemaItem]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class SchemaItemDiagnostic<TYPE extends SchemaItem, ARGS extends any[]> extends BaseDiagnostic<TYPE, ARGS> {\r\n public static diagnosticType = DiagnosticType.SchemaItem;\r\n /**\r\n * Initializes a new SchemaItemDiagnostic.\r\n * @param ecDefinition The EC object to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(ecDefinition: SchemaItem, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(ecDefinition as TYPE, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition.schema; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.SchemaItem; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[ECClass]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class ClassDiagnostic<ARGS extends any[]> extends SchemaItemDiagnostic<AnyClass, ARGS> {\r\n /**\r\n * Initializes a new ClassDiagnostic.\r\n * @param ecClass The class to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(ecClass: AnyClass, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(ecClass, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public override get schema(): Schema { return this.ecDefinition.schema; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[Property]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class PropertyDiagnostic<ARGS extends any[]> extends BaseDiagnostic<AnyProperty, ARGS> {\r\n /**\r\n * Initializes a new PropertyDiagnostic.\r\n * @param property The property to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(property: AnyProperty, messageArgs?: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(property, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition.schema; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.Property; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[RelationshipConstraint]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class RelationshipConstraintDiagnostic<ARGS extends any[]> extends BaseDiagnostic<RelationshipConstraint, ARGS> {\r\n /**\r\n * Initializes a new RelationshipConstraintDiagnostic.\r\n * @param constraint The Relationship Constraint to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(constraint: RelationshipConstraint, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(constraint, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition.schema; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.RelationshipConstraint; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[CustomAttributeContainerProps]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class CustomAttributeContainerDiagnostic<ARGS extends any[]> extends BaseDiagnostic<CustomAttributeContainerProps, ARGS> {\r\n /**\r\n * Initializes a new CustomAttributeContainerDiagnostic.\r\n * @param constraint The Custom Attribute Container to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(container: CustomAttributeContainerProps, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(container, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition.schema; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.CustomAttributeContainer; }\r\n}\r\n\r\n/**\r\n * Helper method for creating [[SchemaDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createSchemaDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends SchemaDiagnostic<ARGS> {\r\n public static code = code;\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[SchemaItemDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createSchemaItemDiagnosticClass<ITEM extends SchemaItem, ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends SchemaItemDiagnostic<ITEM, ARGS> {\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[ClassDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createClassDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends ClassDiagnostic<ARGS> {\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[PropertyDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createPropertyDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends PropertyDiagnostic<ARGS> {\r\n public static code = code;\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[RelationshipConstraintDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the type of diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createRelationshipConstraintDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends RelationshipConstraintDiagnostic<ARGS> {\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[CustomAttributeContainerDiagnostic]] child classes.\r\n * @param code The that uniquely identifies the type of diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createCustomAttributeContainerDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends CustomAttributeContainerDiagnostic<ARGS> {\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/** @beta */\r\nexport function diagnosticCategoryToString(category: DiagnosticCategory) {\r\n switch (category) {\r\n case DiagnosticCategory.Error:\r\n return \"Error\";\r\n case DiagnosticCategory.Warning:\r\n return \"Warning\";\r\n case DiagnosticCategory.Message:\r\n return \"Message\";\r\n case DiagnosticCategory.Suggestion:\r\n return \"Suggestion\";\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport function diagnosticTypeToString(type: DiagnosticType) {\r\n switch (type) {\r\n case DiagnosticType.CustomAttributeContainer:\r\n return \"CustomAttributeContainer\";\r\n case DiagnosticType.None:\r\n return \"None\";\r\n case DiagnosticType.Property:\r\n return \"Property\";\r\n case DiagnosticType.RelationshipConstraint:\r\n return \"RelationshipConstraint\";\r\n case DiagnosticType.Schema:\r\n return \"Schema\";\r\n case DiagnosticType.SchemaItem:\r\n return \"SchemaItem\";\r\n }\r\n}\r\n\r\nfunction validateCode(code: string) {\r\n const msg = `Diagnostic code ${code} is invalid. Expected the format <ruleSetName>-<number>.`;\r\n const parts = code.split(\"-\");\r\n if (parts.length !== 2)\r\n throw new Error(msg);\r\n\r\n if (isNaN(Number(parts[1])))\r\n throw new Error(msg);\r\n}\r\n"]}
1
+ {"version":3,"file":"Diagnostic.js","sourceRoot":"","sources":["../../../src/Validation/Diagnostic.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA6OH,kEAOC;AAQD,0EAMC;AAQD,gEAMC;AAQD,sEAOC;AAQD,kGAMC;AAQD,sGAMC;AAGD,gEAWC;AAGD,wDAeC;AAvVD,iDAAiD;AAEjD,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,GAAG,IAAc,EAAE,EAAE;IACzD,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;QACrD,OAAO,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,WAAW;YAC3C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;YACjB,CAAC,CAAC,KAAK,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;GAGG;AACH,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,mDAAI,CAAA;IACJ,uDAAM,CAAA;IACN,+DAAU,CAAA;IACV,2DAAQ,CAAA;IACR,2FAAwB,CAAA;IACxB,uFAAsB,CAAA;AACxB,CAAC,EAPW,cAAc,8BAAd,cAAc,QAOzB;AAED;;;GAGG;AACH,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,iEAAO,CAAA;IACP,6DAAK,CAAA;IACL,uEAAU,CAAA;IACV,iEAAO,CAAA;AACT,CAAC,EALW,kBAAkB,kCAAlB,kBAAkB,QAK7B;AA6BD;;;GAGG;AACH,MAAsB,cAAc;IAClC;;;;;OAKG;IACH,YAAY,YAAkB,EAAE,WAAkB,EAAE,WAA+B,kBAAkB,CAAC,KAAK;QACzG,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC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B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Diagnostic\n */\n\nimport { AnyClass, AnyECType, AnyProperty, CustomAttributeContainerProps, RelationshipConstraint, Schema, SchemaItem } from \"@itwin/ecschema-metadata\";\n\n/* eslint-disable @typescript-eslint/no-shadow */\n\nconst formatString = (format: string, ...args: string[]) => {\n return format.replace(/{(\\d+)}/g, (match, theNumber) => {\n return typeof args[theNumber] !== \"undefined\"\n ? args[theNumber]\n : match;\n });\n};\n\n/**\n * Defines the possible diagnostic types.\n * @beta\n */\nexport enum DiagnosticType {\n None,\n Schema,\n SchemaItem,\n Property,\n CustomAttributeContainer,\n RelationshipConstraint,\n}\n\n/**\n * Defines the possible diagnostic categories.\n * @beta\n */\nexport enum DiagnosticCategory {\n Warning,\n Error,\n Suggestion,\n Message,\n}\n\n/**\n * The interface implemented by all diagnostics used during schema validation.\n * @beta\n */\nexport interface IDiagnostic<TYPE extends AnyECType, ARGS extends any[]> {\n /** The diagnostic category (error, warning, etc...). Value is static across all instances. */\n category: DiagnosticCategory;\n /** The unique string identifier of the diagnostic in the format '<ruleSetName>:<number>. Value is static across all instances. */\n code: string;\n /** The context type of diagnostic (schema, schema item, property, etc...). Value is static across all instances. */\n diagnosticType: DiagnosticType;\n /** The unformatted message text associated with the diagnostic. Value is static across all instances. */\n messageText: string;\n /** The arguments used when formatted the diagnostic instance's message. */\n messageArgs?: ARGS;\n /** The EC object associated with the diagnostic instance. */\n ecDefinition: TYPE;\n /** The schema where the diagnostic originated. */\n schema: Schema;\n}\n\n/**\n * Type which encapsulates all possible diagnostics.\n * @beta\n */\nexport type AnyDiagnostic = IDiagnostic<AnyECType, any[]>;\n\n/**\n * The abstract base class for all [[IDiagnostic]] implementations.\n * @beta\n */\nexport abstract class BaseDiagnostic<TYPE extends AnyECType, ARGS extends any[]> implements IDiagnostic<TYPE, ARGS> {\n /**\n * Initializes a new BaseDiagnostic.\n * @param ecDefinition The EC object to associate with the diagnostic.\n * @param messageArgs The arguments used when formatting the diagnostic message.\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\n */\n constructor(ecDefinition: TYPE, messageArgs?: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\n this.ecDefinition = ecDefinition;\n this.messageArgs = messageArgs;\n this.category = category;\n }\n\n /** Gets the unique string identifier for the diagnostic in the format '<ruleSetName>:<number>'. */\n public abstract get code(): string;\n /** Gets the context type of the diagnostic (schema, schema item, property, etc...) */\n public abstract get diagnosticType(): DiagnosticType;\n /** Gets the message associated with the diagnostic. */\n public abstract get messageText(): string;\n /** Gets the schema where the diagnostic originated. */\n public abstract get schema(): Schema;\n\n /** The EC object to associate with the diagnostic. */\n public ecDefinition: TYPE;\n /** The arguments used when formatting the diagnostic message. */\n public messageArgs?: ARGS;\n /** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */\n public category: DiagnosticCategory;\n}\n\n/**\n * An [[IDiagnostic]] implementation used for [[Schema]] diagnostics.\n * @beta\n */\nexport abstract class SchemaDiagnostic<ARGS extends any[]> extends BaseDiagnostic<Schema, ARGS> {\n public static diagnosticType = DiagnosticType.SchemaItem;\n\n /**\n * Initializes a new SchemaDiagnostic.\n * @param ecDefinition The EC object to associate with the diagnostic.\n * @param messageArgs The arguments used when formatting the diagnostic message.\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\n */\n constructor(schema: Schema, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\n super(schema, messageArgs, category);\n }\n\n /** Gets the schema where the diagnostic originated. */\n public get schema(): Schema { return this.ecDefinition; }\n\n /** Gets the DiagnosticType. */\n public get diagnosticType(): DiagnosticType { return DiagnosticType.Schema; }\n}\n\n/**\n * An [[IDiagnostic]] implementation used for [[SchemaItem]] diagnostics.\n * @beta\n */\nexport abstract class SchemaItemDiagnostic<TYPE extends SchemaItem, ARGS extends any[]> extends BaseDiagnostic<TYPE, ARGS> {\n public static diagnosticType = DiagnosticType.SchemaItem;\n /**\n * Initializes a new SchemaItemDiagnostic.\n * @param ecDefinition The EC object to associate with the diagnostic.\n * @param messageArgs The arguments used when formatting the diagnostic message.\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\n */\n constructor(ecDefinition: SchemaItem, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\n super(ecDefinition as TYPE, messageArgs, category);\n }\n\n /** Gets the schema where the diagnostic originated. */\n public get schema(): Schema { return this.ecDefinition.schema; }\n\n /** Gets the DiagnosticType. */\n public get diagnosticType(): DiagnosticType { return DiagnosticType.SchemaItem; }\n}\n\n/**\n * An [[IDiagnostic]] implementation used for [[ECClass]] diagnostics.\n * @beta\n */\nexport abstract class ClassDiagnostic<ARGS extends any[]> extends SchemaItemDiagnostic<AnyClass, ARGS> {\n /**\n * Initializes a new ClassDiagnostic.\n * @param ecClass The class to associate with the diagnostic.\n * @param messageArgs The arguments used when formatting the diagnostic message.\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\n */\n constructor(ecClass: AnyClass, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\n super(ecClass, messageArgs, category);\n }\n\n /** Gets the schema where the diagnostic originated. */\n public override get schema(): Schema { return this.ecDefinition.schema; }\n}\n\n/**\n * An [[IDiagnostic]] implementation used for [[Property]] diagnostics.\n * @beta\n */\nexport abstract class PropertyDiagnostic<ARGS extends any[]> extends BaseDiagnostic<AnyProperty, ARGS> {\n /**\n * Initializes a new PropertyDiagnostic.\n * @param property The property to associate with the diagnostic.\n * @param messageArgs The arguments used when formatting the diagnostic message.\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\n */\n constructor(property: AnyProperty, messageArgs?: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\n super(property, messageArgs, category);\n }\n\n /** Gets the schema where the diagnostic originated. */\n public get schema(): Schema { return this.ecDefinition.schema; }\n\n /** Gets the DiagnosticType. */\n public get diagnosticType(): DiagnosticType { return DiagnosticType.Property; }\n}\n\n/**\n * An [[IDiagnostic]] implementation used for [[RelationshipConstraint]] diagnostics.\n * @beta\n */\nexport abstract class RelationshipConstraintDiagnostic<ARGS extends any[]> extends BaseDiagnostic<RelationshipConstraint, ARGS> {\n /**\n * Initializes a new RelationshipConstraintDiagnostic.\n * @param constraint The Relationship Constraint to associate with the diagnostic.\n * @param messageArgs The arguments used when formatting the diagnostic message.\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\n */\n constructor(constraint: RelationshipConstraint, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\n super(constraint, messageArgs, category);\n }\n\n /** Gets the schema where the diagnostic originated. */\n public get schema(): Schema { return this.ecDefinition.schema; }\n\n /** Gets the DiagnosticType. */\n public get diagnosticType(): DiagnosticType { return DiagnosticType.RelationshipConstraint; }\n}\n\n/**\n * An [[IDiagnostic]] implementation used for [[CustomAttributeContainerProps]] diagnostics.\n * @beta\n */\nexport abstract class CustomAttributeContainerDiagnostic<ARGS extends any[]> extends BaseDiagnostic<CustomAttributeContainerProps, ARGS> {\n /**\n * Initializes a new CustomAttributeContainerDiagnostic.\n * @param constraint The Custom Attribute Container to associate with the diagnostic.\n * @param messageArgs The arguments used when formatting the diagnostic message.\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\n */\n constructor(container: CustomAttributeContainerProps, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\n super(container, messageArgs, category);\n }\n\n /** Gets the schema where the diagnostic originated. */\n public get schema(): Schema { return this.ecDefinition.schema; }\n\n /** Gets the DiagnosticType. */\n public get diagnosticType(): DiagnosticType { return DiagnosticType.CustomAttributeContainer; }\n}\n\n/**\n * Helper method for creating [[SchemaDiagnostic]] child classes.\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\n * @param messageText The message to associate with the diagnostic class.\n * @beta\n */\nexport function createSchemaDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\n validateCode(code);\n return class extends SchemaDiagnostic<ARGS> {\n public static code = code;\n public get code(): string { return code; }\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\n };\n}\n\n/**\n * Helper method for creating [[SchemaItemDiagnostic]] child classes.\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\n * @param messageText The message to associate with the diagnostic class.\n * @beta\n */\nexport function createSchemaItemDiagnosticClass<ITEM extends SchemaItem, ARGS extends any[]>(code: string, messageText: string) {\n validateCode(code);\n return class extends SchemaItemDiagnostic<ITEM, ARGS> {\n public get code(): string { return code; }\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\n };\n}\n\n/**\n * Helper method for creating [[ClassDiagnostic]] child classes.\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\n * @param messageText The message to associate with the diagnostic class.\n * @beta\n */\nexport function createClassDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\n validateCode(code);\n return class extends ClassDiagnostic<ARGS> {\n public get code(): string { return code; }\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\n };\n}\n\n/**\n * Helper method for creating [[PropertyDiagnostic]] child classes.\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\n * @param messageText The message to associate with the diagnostic class.\n * @beta\n */\nexport function createPropertyDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\n validateCode(code);\n return class extends PropertyDiagnostic<ARGS> {\n public static code = code;\n public get code(): string { return code; }\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\n };\n}\n\n/**\n * Helper method for creating [[RelationshipConstraintDiagnostic]] child classes.\n * @param code The string that uniquely identifies the type of diagnostic in the format '<ruleSetName>:<number>'.\n * @param messageText The message to associate with the diagnostic class.\n * @beta\n */\nexport function createRelationshipConstraintDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\n validateCode(code);\n return class extends RelationshipConstraintDiagnostic<ARGS> {\n public get code(): string { return code; }\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\n };\n}\n\n/**\n * Helper method for creating [[CustomAttributeContainerDiagnostic]] child classes.\n * @param code The that uniquely identifies the type of diagnostic in the format '<ruleSetName>:<number>'.\n * @param messageText The message to associate with the diagnostic class.\n * @beta\n */\nexport function createCustomAttributeContainerDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\n validateCode(code);\n return class extends CustomAttributeContainerDiagnostic<ARGS> {\n public get code(): string { return code; }\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\n };\n}\n\n/** @beta */\nexport function diagnosticCategoryToString(category: DiagnosticCategory) {\n switch (category) {\n case DiagnosticCategory.Error:\n return \"Error\";\n case DiagnosticCategory.Warning:\n return \"Warning\";\n case DiagnosticCategory.Message:\n return \"Message\";\n case DiagnosticCategory.Suggestion:\n return \"Suggestion\";\n }\n}\n\n/** @beta */\nexport function diagnosticTypeToString(type: DiagnosticType) {\n switch (type) {\n case DiagnosticType.CustomAttributeContainer:\n return \"CustomAttributeContainer\";\n case DiagnosticType.None:\n return \"None\";\n case DiagnosticType.Property:\n return \"Property\";\n case DiagnosticType.RelationshipConstraint:\n return \"RelationshipConstraint\";\n case DiagnosticType.Schema:\n return \"Schema\";\n case DiagnosticType.SchemaItem:\n return \"SchemaItem\";\n }\n}\n\nfunction validateCode(code: string) {\n const msg = `Diagnostic code ${code} is invalid. Expected the format <ruleSetName>-<number>.`;\n const parts = code.split(\"-\");\n if (parts.length !== 2)\n throw new Error(msg);\n\n if (isNaN(Number(parts[1])))\n throw new Error(msg);\n}\n"]}
@@ -8,7 +8,7 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.FormatDiagnosticReporter = exports.SuppressionDiagnosticReporter = void 0;
11
- const assert = require("assert"); // eslint-disable-line @typescript-eslint/no-require-imports
11
+ const assert = require("assert");
12
12
  const translationNamespace = "ECSchemaMetaData";
13
13
  const subTranslationNamespace = "Diagnostics";
14
14
  const baseTranslationKey = `${translationNamespace}:${subTranslationNamespace}`;
@@ -19,6 +19,7 @@ const baseTranslationKey = `${translationNamespace}:${subTranslationNamespace}`;
19
19
  * @beta
20
20
  */
21
21
  class SuppressionDiagnosticReporter {
22
+ _suppressions;
22
23
  /**
23
24
  * Initializes a new SuppressionDiagnosticReporter
24
25
  * @param suppressions A Map where the key is a schema full name and the value is collection of diagnostic codes to suppress.
@@ -64,6 +65,8 @@ class FormatDiagnosticReporter extends SuppressionDiagnosticReporter {
64
65
  super(suppressions);
65
66
  this.localization = localization;
66
67
  }
68
+ /** The Localization object to use for message translation. If undefined, no translation will occur. */
69
+ localization;
67
70
  /**
68
71
  * Prior to reporting the [[IDiagnostic]], the diagnostic message is formatted (with translations)
69
72
  * base on arguments contained in the diagnostic. Calls reportDiagnostic after the message is formatted.
@@ -1 +1 @@
1
- {"version":3,"file":"DiagnosticReporter.js","sourceRoot":"","sources":["../../../src/Validation/DiagnosticReporter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAKH,iCAAkC,CAAC,4DAA4D;AAE/F,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAChD,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAC9C,MAAM,kBAAkB,GAAG,GAAG,oBAAoB,IAAI,uBAAuB,EAAE,CAAC;AAwBhF;;;;;GAKG;AACH,MAAsB,6BAA6B;IAGjD;;;OAGG;IACH,YAAY,YAAoC;QAC9C,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;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AAM,GAAG,CAAC;YAC7D,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;QAC3F,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAEO,gBAAgB,CAAC,UAAyB;QAChD,IAAI,CAAC,IAAI,CAAC,YAAY;YACpB,OAAO,UAAU,CAAC,WAAW,CAAC;QAEhC,OAAO,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC;IAClF,CAAC;IAEO,iBAAiB,CAAC,UAAyB;QACjD,OAAO,GAAG,kBAAkB,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC;IACpD,CAAC;IAEO,aAAa,CAAI,KAA2B,EAAE,OAAgB;QACpE,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;YACvC,OAAO,MAAM,CAAC,KAAK,EAAE,OAAO,CAAU,CAAC;QAEzC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AApED,4DAoEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Diagnostic\r\n */\r\n\r\nimport { Localization } from \"@itwin/core-common\";\r\nimport { AnyDiagnostic } from \"./Diagnostic\";\r\n\r\nimport assert = require(\"assert\"); // eslint-disable-line @typescript-eslint/no-require-imports\r\n\r\nconst translationNamespace = \"ECSchemaMetaData\";\r\nconst subTranslationNamespace = \"Diagnostics\";\r\nconst baseTranslationKey = `${translationNamespace}:${subTranslationNamespace}`;\r\n\r\n/**\r\n * Interface used to report [[IDiagnostic]] objects created during schema validation.\r\n * @beta\r\n */\r\nexport interface IDiagnosticReporter {\r\n /**\r\n * A map where the key is a schema full name and the value is a collection\r\n * of diagnostics codes identifying which rules violations to ignore during validation.\r\n */\r\n suppressions?: Map<string, string[]>;\r\n\r\n /** The localization object to use for message translation. */\r\n localization?: Localization;\r\n\r\n /**\r\n * Handles the given [[IDiagnostic]] based on the implementation requirements for a\r\n * given reporter.\r\n * @param diagnostic The diagnostic to report.\r\n */\r\n report(diagnostic: AnyDiagnostic): void;\r\n}\r\n\r\n/**\r\n * An abstract base class for [[IDiagnosticReporter]] implementation that used the\r\n * provided Map to suppress certain rule violations from being reported. The Map's key\r\n * a schema full name, and the Map's value is a collection of rule codes to suppress.\r\n * @beta\r\n */\r\nexport abstract class SuppressionDiagnosticReporter implements IDiagnosticReporter {\r\n private _suppressions?: Map<string, string[]>;\r\n\r\n /**\r\n * Initializes a new SuppressionDiagnosticReporter\r\n * @param suppressions A Map where the key is a schema full name and the value is collection of diagnostic codes to suppress.\r\n */\r\n constructor(suppressions?: Map<string, string[]>) {\r\n this._suppressions = suppressions;\r\n }\r\n\r\n /**\r\n * Gets the collection of ISchemaDiagnosticSuppression objects that identify\r\n * rules violations to ignore during validation.\r\n */\r\n public get suppressions(): Map<string, string[]> | undefined {\r\n return this._suppressions;\r\n }\r\n\r\n /**\r\n * Prior to reporting the [[IDiagnostic]], the diagnostic message is formatted (with translations)\r\n * base on arguments contained in the diagnostic. Calls reportDiagnostic after the message is formatted.\r\n * @param diagnostic The diagnostic to report.\r\n */\r\n public report(diagnostic: AnyDiagnostic) {\r\n if (this._suppressions && this._suppressions.has(diagnostic.schema.fullName)) {\r\n const suppressedCodes = this._suppressions.get(diagnostic.schema.fullName);\r\n if (suppressedCodes!.includes(diagnostic.code))\r\n return;\r\n }\r\n\r\n this.reportInternal(diagnostic);\r\n }\r\n\r\n /**\r\n * Handles the given [[IDiagnostic]] based on the implementation requirements for a\r\n * given reporter.\r\n * @param diagnostic The diagnostic to report.\r\n */\r\n protected abstract reportInternal(diagnostic: AnyDiagnostic): void;\r\n}\r\n\r\n/**\r\n * An abstract [[SuppressionDiagnosticReporter]] implementation that formats the\r\n * diagnostic message with the message args. If a Localization implementation is specified,\r\n * the message will also be translated.\r\n * @beta\r\n */\r\nexport abstract class FormatDiagnosticReporter extends SuppressionDiagnosticReporter {\r\n /**\r\n * Initializes a new FormatDiagnosticReporter\r\n * @param suppressions A Map where the key is a schema full name and the value is collection of diagnostic codes to suppress.\r\n * @param localization The Localization instance to use to translate validation messages.\r\n */\r\n constructor(suppressions?: Map<string, string[]>, localization?: Localization) {\r\n super(suppressions);\r\n this.localization = localization;\r\n }\r\n\r\n /** The Localization object to use for message translation. If undefined, no translation will occur. */\r\n public localization?: Localization;\r\n\r\n /**\r\n * Prior to reporting the [[IDiagnostic]], the diagnostic message is formatted (with translations)\r\n * base on arguments contained in the diagnostic. Calls reportDiagnostic after the message is formatted.\r\n * @param diagnostic The diagnostic to report.\r\n */\r\n public reportInternal(diagnostic: AnyDiagnostic) {\r\n const message = this.formatMessage(diagnostic);\r\n this.reportDiagnostic(diagnostic, message);\r\n }\r\n\r\n /**\r\n * Handles the given [[IDiagnostic]] based on the implementation requirements for a\r\n * given reporter.\r\n * @param diagnostic The diagnostic to report.\r\n * @param messageText The formatted message.\r\n */\r\n protected abstract reportDiagnostic(diagnostic: AnyDiagnostic, messageText: string): void;\r\n\r\n /**\r\n * Helper method that formats string with provided arguments where the place holders\r\n * are in the the format '{0}', '{1}', etc.\r\n * @param text The text to format.\r\n * @param args The arguments to place in the text.\r\n * @param baseIndex The base index for the args, used for validation (typically 0, which is the default).\r\n */\r\n protected formatStringFromArgs(text: string, args: ArrayLike<string>, baseIndex = 0): string {\r\n return text.replace(/{(\\d+)}/g, (_match, index: string) => this.assertDefined(args[+index + baseIndex]));\r\n }\r\n\r\n private formatMessage(diagnostic: AnyDiagnostic): string {\r\n let translatedMessage = this.translateMessage(diagnostic);\r\n\r\n if (diagnostic.messageArgs && diagnostic.messageArgs.length > 0)\r\n translatedMessage = this.formatStringFromArgs(translatedMessage, diagnostic.messageArgs);\r\n return translatedMessage;\r\n }\r\n\r\n private translateMessage(diagnostic: AnyDiagnostic): string {\r\n if (!this.localization)\r\n return diagnostic.messageText;\r\n\r\n return this.localization.getLocalizedString(this.getTranslationKey(diagnostic));\r\n }\r\n\r\n private getTranslationKey(diagnostic: AnyDiagnostic): string {\r\n return `${baseTranslationKey}.${diagnostic.code}`;\r\n }\r\n\r\n private assertDefined<T>(value: T | null | undefined, message?: string): T {\r\n if (value === undefined || value === null)\r\n return assert(false, message) as never;\r\n\r\n return value;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"DiagnosticReporter.js","sourceRoot":"","sources":["../../../src/Validation/DiagnosticReporter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAKH,iCAAiC;AAEjC,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAChD,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAC9C,MAAM,kBAAkB,GAAG,GAAG,oBAAoB,IAAI,uBAAuB,EAAE,CAAC;AAwBhF;;;;;GAKG;AACH,MAAsB,6BAA6B;IACzC,aAAa,CAAyB;IAE9C;;;OAGG;IACH,YAAY,YAAoC;QAC9C,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,UAAyB;QACrC,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7E,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC3E,IAAI,eAAgB,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC;gBAC5C,OAAO;QACX,CAAC;QAED,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;CAQF;AAxCD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AAyB;QACjD,OAAO,GAAG,kBAAkB,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC;IACpD,CAAC;IAEO,aAAa,CAAI,KAA2B,EAAE,OAAgB;QACpE,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;YACvC,OAAO,MAAM,CAAC,KAAK,EAAE,OAAO,CAAU,CAAC;QAEzC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AApED,4DAoEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Diagnostic\n */\n\nimport { Localization } from \"@itwin/core-common\";\nimport { AnyDiagnostic } from \"./Diagnostic\";\n\nimport * as assert from \"assert\";\n\nconst translationNamespace = \"ECSchemaMetaData\";\nconst subTranslationNamespace = \"Diagnostics\";\nconst baseTranslationKey = `${translationNamespace}:${subTranslationNamespace}`;\n\n/**\n * Interface used to report [[IDiagnostic]] objects created during schema validation.\n * @beta\n */\nexport interface IDiagnosticReporter {\n /**\n * A map where the key is a schema full name and the value is a collection\n * of diagnostics codes identifying which rules violations to ignore during validation.\n */\n suppressions?: Map<string, string[]>;\n\n /** The localization object to use for message translation. */\n localization?: Localization;\n\n /**\n * Handles the given [[IDiagnostic]] based on the implementation requirements for a\n * given reporter.\n * @param diagnostic The diagnostic to report.\n */\n report(diagnostic: AnyDiagnostic): void;\n}\n\n/**\n * An abstract base class for [[IDiagnosticReporter]] implementation that used the\n * provided Map to suppress certain rule violations from being reported. The Map's key\n * a schema full name, and the Map's value is a collection of rule codes to suppress.\n * @beta\n */\nexport abstract class SuppressionDiagnosticReporter implements IDiagnosticReporter {\n private _suppressions?: Map<string, string[]>;\n\n /**\n * Initializes a new SuppressionDiagnosticReporter\n * @param suppressions A Map where the key is a schema full name and the value is collection of diagnostic codes to suppress.\n */\n constructor(suppressions?: Map<string, string[]>) {\n this._suppressions = suppressions;\n }\n\n /**\n * Gets the collection of ISchemaDiagnosticSuppression objects that identify\n * rules violations to ignore during validation.\n */\n public get suppressions(): Map<string, string[]> | undefined {\n return this._suppressions;\n }\n\n /**\n * Prior to reporting the [[IDiagnostic]], the diagnostic message is formatted (with translations)\n * base on arguments contained in the diagnostic. Calls reportDiagnostic after the message is formatted.\n * @param diagnostic The diagnostic to report.\n */\n public report(diagnostic: AnyDiagnostic) {\n if (this._suppressions && this._suppressions.has(diagnostic.schema.fullName)) {\n const suppressedCodes = this._suppressions.get(diagnostic.schema.fullName);\n if (suppressedCodes!.includes(diagnostic.code))\n return;\n }\n\n this.reportInternal(diagnostic);\n }\n\n /**\n * Handles the given [[IDiagnostic]] based on the implementation requirements for a\n * given reporter.\n * @param diagnostic The diagnostic to report.\n */\n protected abstract reportInternal(diagnostic: AnyDiagnostic): void;\n}\n\n/**\n * An abstract [[SuppressionDiagnosticReporter]] implementation that formats the\n * diagnostic message with the message args. If a Localization implementation is specified,\n * the message will also be translated.\n * @beta\n */\nexport abstract class FormatDiagnosticReporter extends SuppressionDiagnosticReporter {\n /**\n * Initializes a new FormatDiagnosticReporter\n * @param suppressions A Map where the key is a schema full name and the value is collection of diagnostic codes to suppress.\n * @param localization The Localization instance to use to translate validation messages.\n */\n constructor(suppressions?: Map<string, string[]>, localization?: Localization) {\n super(suppressions);\n this.localization = localization;\n }\n\n /** The Localization object to use for message translation. If undefined, no translation will occur. */\n public localization?: Localization;\n\n /**\n * Prior to reporting the [[IDiagnostic]], the diagnostic message is formatted (with translations)\n * base on arguments contained in the diagnostic. Calls reportDiagnostic after the message is formatted.\n * @param diagnostic The diagnostic to report.\n */\n public reportInternal(diagnostic: AnyDiagnostic) {\n const message = this.formatMessage(diagnostic);\n this.reportDiagnostic(diagnostic, message);\n }\n\n /**\n * Handles the given [[IDiagnostic]] based on the implementation requirements for a\n * given reporter.\n * @param diagnostic The diagnostic to report.\n * @param messageText The formatted message.\n */\n protected abstract reportDiagnostic(diagnostic: AnyDiagnostic, messageText: string): void;\n\n /**\n * Helper method that formats string with provided arguments where the place holders\n * are in the the format '{0}', '{1}', etc.\n * @param text The text to format.\n * @param args The arguments to place in the text.\n * @param baseIndex The base index for the args, used for validation (typically 0, which is the default).\n */\n protected formatStringFromArgs(text: string, args: ArrayLike<string>, baseIndex = 0): string {\n return text.replace(/{(\\d+)}/g, (_match, index: string) => this.assertDefined(args[+index + baseIndex]));\n }\n\n private formatMessage(diagnostic: AnyDiagnostic): string {\n let translatedMessage = this.translateMessage(diagnostic);\n\n if (diagnostic.messageArgs && diagnostic.messageArgs.length > 0)\n translatedMessage = this.formatStringFromArgs(translatedMessage, diagnostic.messageArgs);\n return translatedMessage;\n }\n\n private translateMessage(diagnostic: AnyDiagnostic): string {\n if (!this.localization)\n return diagnostic.messageText;\n\n return this.localization.getLocalizedString(this.getTranslationKey(diagnostic));\n }\n\n private getTranslationKey(diagnostic: AnyDiagnostic): string {\n return `${baseTranslationKey}.${diagnostic.code}`;\n }\n\n private assertDefined<T>(value: T | null | undefined, message?: string): T {\n if (value === undefined || value === null)\n return assert(false, message) as never;\n\n return value;\n }\n}\n"]}
@@ -252,7 +252,7 @@ async function* incompatibleValueTypePropertyOverride(property) {
252
252
  if (!primitiveType)
253
253
  return;
254
254
  async function callback(baseClass) {
255
- const baseProperty = await baseClass.getProperty(property.name);
255
+ const baseProperty = await baseClass.getProperty(property.name, true);
256
256
  if (!baseProperty)
257
257
  return;
258
258
  // Other rules will catch this if false, but we need to make sure
@@ -279,7 +279,7 @@ async function* incompatibleTypePropertyOverride(property) {
279
279
  if (!property.class.baseClass)
280
280
  return;
281
281
  async function callback(baseClass) {
282
- const baseProperty = await baseClass.getProperty(property.name);
282
+ const baseProperty = await baseClass.getProperty(property.name, true);
283
283
  if (!baseProperty)
284
284
  return;
285
285
  // Return if rule passed
@@ -301,7 +301,7 @@ async function* incompatibleUnitPropertyOverride(property) {
301
301
  if (!property.kindOfQuantity || !property.class.baseClass)
302
302
  return;
303
303
  async function callback(baseClass) {
304
- const baseProperty = await baseClass.getProperty(property.name);
304
+ const baseProperty = await baseClass.getProperty(property.name, true);
305
305
  if (!baseProperty || !baseProperty.kindOfQuantity)
306
306
  return;
307
307
  // Other rules will catch this if false, but we need to make sure
@@ -364,7 +364,7 @@ async function* validateNavigationProperty(property) {
364
364
  yield new exports.Diagnostics.NavigationRelationshipAbstractConstraintEntityOrMixin(property, [property.fullName, relationship.fullName]);
365
365
  }
366
366
  const isClassSupported = async (ecClass, propertyName, constraintName) => {
367
- if (constraintName === ecClass.fullName && undefined !== await ecClass.getProperty(propertyName))
367
+ if (constraintName === ecClass.fullName && undefined !== await ecClass.getProperty(propertyName, true))
368
368
  return true;
369
369
  const inheritedProp = await ecClass.getInheritedProperty(propertyName);
370
370
  if (inheritedProp && constraintName === inheritedProp.class.fullName)
@@ -572,7 +572,7 @@ async function applyConstraintClassesDeriveFromAbstractConstraint(ecClass, const
572
572
  return;
573
573
  for (const classPromise of constraint.constraintClasses) {
574
574
  const constraintClass = await classPromise;
575
- if (constraintClass.schemaItemType === ecschema_metadata_1.SchemaItemType.Mixin && abstractConstraint.schemaItemType === ecschema_metadata_1.SchemaItemType.EntityClass) {
575
+ if (ecschema_metadata_1.Mixin.isMixin(constraintClass) && ecschema_metadata_1.EntityClass.isEntityClass(abstractConstraint)) {
576
576
  if (!await (constraintClass).applicableTo(abstractConstraint)) {
577
577
  const constraintType = constraint.isSource ? ecschema_metadata_1.ECStringConstants.RELATIONSHIP_END_SOURCE : ecschema_metadata_1.ECStringConstants.RELATIONSHIP_END_TARGET;
578
578
  return new exports.Diagnostics.ConstraintClassesDeriveFromAbstractConstraint(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, abstractConstraint.fullName]);