@itwin/ecschema-editing 5.0.0-dev.90 → 5.0.0-dev.93

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 (363) hide show
  1. package/lib/cjs/Validation/DiagnosticReporter.js +1 -1
  2. package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
  3. package/lib/esm/Differencing/Errors.d.ts +19 -0
  4. package/lib/esm/Differencing/Errors.d.ts.map +1 -0
  5. package/lib/esm/Differencing/Errors.js +26 -0
  6. package/lib/esm/Differencing/Errors.js.map +1 -0
  7. package/lib/esm/Differencing/SchemaConflicts.d.ts +84 -0
  8. package/lib/esm/Differencing/SchemaConflicts.d.ts.map +1 -0
  9. package/lib/esm/Differencing/SchemaConflicts.js +60 -0
  10. package/lib/esm/Differencing/SchemaConflicts.js.map +1 -0
  11. package/lib/esm/Differencing/SchemaDiagnosticVisitor.d.ts +41 -0
  12. package/lib/esm/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -0
  13. package/lib/esm/Differencing/SchemaDiagnosticVisitor.js +443 -0
  14. package/lib/esm/Differencing/SchemaDiagnosticVisitor.js.map +1 -0
  15. package/lib/esm/Differencing/SchemaDifference.d.ts +357 -0
  16. package/lib/esm/Differencing/SchemaDifference.d.ts.map +1 -0
  17. package/lib/esm/Differencing/SchemaDifference.js +106 -0
  18. package/lib/esm/Differencing/SchemaDifference.js.map +1 -0
  19. package/lib/esm/Differencing/SchemaDifferenceValidator.d.ts +18 -0
  20. package/lib/esm/Differencing/SchemaDifferenceValidator.d.ts.map +1 -0
  21. package/lib/esm/Differencing/SchemaDifferenceValidator.js +521 -0
  22. package/lib/esm/Differencing/SchemaDifferenceValidator.js.map +1 -0
  23. package/lib/esm/Differencing/SchemaDifferenceVisitor.d.ts +32 -0
  24. package/lib/esm/Differencing/SchemaDifferenceVisitor.d.ts.map +1 -0
  25. package/lib/esm/Differencing/SchemaDifferenceVisitor.js +88 -0
  26. package/lib/esm/Differencing/SchemaDifferenceVisitor.js.map +1 -0
  27. package/lib/esm/Differencing/Utils.d.ts +110 -0
  28. package/lib/esm/Differencing/Utils.d.ts.map +1 -0
  29. package/lib/esm/Differencing/Utils.js +161 -0
  30. package/lib/esm/Differencing/Utils.js.map +1 -0
  31. package/lib/esm/Editing/Constants.d.ts +22 -0
  32. package/lib/esm/Editing/Constants.d.ts.map +1 -0
  33. package/lib/esm/Editing/Constants.js +55 -0
  34. package/lib/esm/Editing/Constants.js.map +1 -0
  35. package/lib/esm/Editing/CustomAttributes.d.ts +22 -0
  36. package/lib/esm/Editing/CustomAttributes.d.ts.map +1 -0
  37. package/lib/esm/Editing/CustomAttributes.js +49 -0
  38. package/lib/esm/Editing/CustomAttributes.js.map +1 -0
  39. package/lib/esm/Editing/ECClasses.d.ts +86 -0
  40. package/lib/esm/Editing/ECClasses.d.ts.map +1 -0
  41. package/lib/esm/Editing/ECClasses.js +294 -0
  42. package/lib/esm/Editing/ECClasses.js.map +1 -0
  43. package/lib/esm/Editing/Editor.d.ts +117 -0
  44. package/lib/esm/Editing/Editor.d.ts.map +1 -0
  45. package/lib/esm/Editing/Editor.js +264 -0
  46. package/lib/esm/Editing/Editor.js.map +1 -0
  47. package/lib/esm/Editing/Entities.d.ts +38 -0
  48. package/lib/esm/Editing/Entities.d.ts.map +1 -0
  49. package/lib/esm/Editing/Entities.js +126 -0
  50. package/lib/esm/Editing/Entities.js.map +1 -0
  51. package/lib/esm/Editing/Enumerations.d.ts +25 -0
  52. package/lib/esm/Editing/Enumerations.d.ts.map +1 -0
  53. package/lib/esm/Editing/Enumerations.js +90 -0
  54. package/lib/esm/Editing/Enumerations.js.map +1 -0
  55. package/lib/esm/Editing/Exception.d.ts +358 -0
  56. package/lib/esm/Editing/Exception.d.ts.map +1 -0
  57. package/lib/esm/Editing/Exception.js +471 -0
  58. package/lib/esm/Editing/Exception.js.map +1 -0
  59. package/lib/esm/Editing/Formats.d.ts +23 -0
  60. package/lib/esm/Editing/Formats.d.ts.map +1 -0
  61. package/lib/esm/Editing/Formats.js +62 -0
  62. package/lib/esm/Editing/Formats.js.map +1 -0
  63. package/lib/esm/Editing/InvertedUnits.d.ts +19 -0
  64. package/lib/esm/Editing/InvertedUnits.d.ts.map +1 -0
  65. package/lib/esm/Editing/InvertedUnits.js +68 -0
  66. package/lib/esm/Editing/InvertedUnits.js.map +1 -0
  67. package/lib/esm/Editing/KindOfQuantities.d.ts +30 -0
  68. package/lib/esm/Editing/KindOfQuantities.d.ts.map +1 -0
  69. package/lib/esm/Editing/KindOfQuantities.js +92 -0
  70. package/lib/esm/Editing/KindOfQuantities.js.map +1 -0
  71. package/lib/esm/Editing/Mixins.d.ts +35 -0
  72. package/lib/esm/Editing/Mixins.d.ts.map +1 -0
  73. package/lib/esm/Editing/Mixins.js +90 -0
  74. package/lib/esm/Editing/Mixins.js.map +1 -0
  75. package/lib/esm/Editing/Mutable/MutableArrayProperty.d.ts +10 -0
  76. package/lib/esm/Editing/Mutable/MutableArrayProperty.d.ts.map +1 -0
  77. package/lib/esm/Editing/Mutable/MutableArrayProperty.js +12 -0
  78. package/lib/esm/Editing/Mutable/MutableArrayProperty.js.map +1 -0
  79. package/lib/esm/Editing/Mutable/MutableCAClass.d.ts +10 -0
  80. package/lib/esm/Editing/Mutable/MutableCAClass.d.ts.map +1 -0
  81. package/lib/esm/Editing/Mutable/MutableCAClass.js +12 -0
  82. package/lib/esm/Editing/Mutable/MutableCAClass.js.map +1 -0
  83. package/lib/esm/Editing/Mutable/MutableClass.d.ts +39 -0
  84. package/lib/esm/Editing/Mutable/MutableClass.d.ts.map +1 -0
  85. package/lib/esm/Editing/Mutable/MutableClass.js +18 -0
  86. package/lib/esm/Editing/Mutable/MutableClass.js.map +1 -0
  87. package/lib/esm/Editing/Mutable/MutableConstant.d.ts +14 -0
  88. package/lib/esm/Editing/Mutable/MutableConstant.d.ts.map +1 -0
  89. package/lib/esm/Editing/Mutable/MutableConstant.js +12 -0
  90. package/lib/esm/Editing/Mutable/MutableConstant.js.map +1 -0
  91. package/lib/esm/Editing/Mutable/MutableEntityClass.d.ts +12 -0
  92. package/lib/esm/Editing/Mutable/MutableEntityClass.d.ts.map +1 -0
  93. package/lib/esm/Editing/Mutable/MutableEntityClass.js +12 -0
  94. package/lib/esm/Editing/Mutable/MutableEntityClass.js.map +1 -0
  95. package/lib/esm/Editing/Mutable/MutableEnumeration.d.ts +11 -0
  96. package/lib/esm/Editing/Mutable/MutableEnumeration.d.ts.map +1 -0
  97. package/lib/esm/Editing/Mutable/MutableEnumeration.js +11 -0
  98. package/lib/esm/Editing/Mutable/MutableEnumeration.js.map +1 -0
  99. package/lib/esm/Editing/Mutable/MutableFormat.d.ts +26 -0
  100. package/lib/esm/Editing/Mutable/MutableFormat.d.ts.map +1 -0
  101. package/lib/esm/Editing/Mutable/MutableFormat.js +12 -0
  102. package/lib/esm/Editing/Mutable/MutableFormat.js.map +1 -0
  103. package/lib/esm/Editing/Mutable/MutableInvertedUnit.d.ts +11 -0
  104. package/lib/esm/Editing/Mutable/MutableInvertedUnit.d.ts.map +1 -0
  105. package/lib/esm/Editing/Mutable/MutableInvertedUnit.js +12 -0
  106. package/lib/esm/Editing/Mutable/MutableInvertedUnit.js.map +1 -0
  107. package/lib/esm/Editing/Mutable/MutableKindOfQuantity.d.ts +14 -0
  108. package/lib/esm/Editing/Mutable/MutableKindOfQuantity.d.ts.map +1 -0
  109. package/lib/esm/Editing/Mutable/MutableKindOfQuantity.js +12 -0
  110. package/lib/esm/Editing/Mutable/MutableKindOfQuantity.js.map +1 -0
  111. package/lib/esm/Editing/Mutable/MutableMixin.d.ts +12 -0
  112. package/lib/esm/Editing/Mutable/MutableMixin.d.ts.map +1 -0
  113. package/lib/esm/Editing/Mutable/MutableMixin.js +12 -0
  114. package/lib/esm/Editing/Mutable/MutableMixin.js.map +1 -0
  115. package/lib/esm/Editing/Mutable/MutableNavigationProperty.d.ts +8 -0
  116. package/lib/esm/Editing/Mutable/MutableNavigationProperty.d.ts.map +1 -0
  117. package/lib/esm/Editing/Mutable/MutableNavigationProperty.js +12 -0
  118. package/lib/esm/Editing/Mutable/MutableNavigationProperty.js.map +1 -0
  119. package/lib/esm/Editing/Mutable/MutablePhenomenon.d.ts +11 -0
  120. package/lib/esm/Editing/Mutable/MutablePhenomenon.d.ts.map +1 -0
  121. package/lib/esm/Editing/Mutable/MutablePhenomenon.js +12 -0
  122. package/lib/esm/Editing/Mutable/MutablePhenomenon.js.map +1 -0
  123. package/lib/esm/Editing/Mutable/MutablePrimitiveOrEnumProperty.d.ts +13 -0
  124. package/lib/esm/Editing/Mutable/MutablePrimitiveOrEnumProperty.d.ts.map +1 -0
  125. package/lib/esm/Editing/Mutable/MutablePrimitiveOrEnumProperty.js +12 -0
  126. package/lib/esm/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -0
  127. package/lib/esm/Editing/Mutable/MutableProperty.d.ts +16 -0
  128. package/lib/esm/Editing/Mutable/MutableProperty.d.ts.map +1 -0
  129. package/lib/esm/Editing/Mutable/MutableProperty.js +12 -0
  130. package/lib/esm/Editing/Mutable/MutableProperty.js.map +1 -0
  131. package/lib/esm/Editing/Mutable/MutablePropertyCategory.d.ts +11 -0
  132. package/lib/esm/Editing/Mutable/MutablePropertyCategory.d.ts.map +1 -0
  133. package/lib/esm/Editing/Mutable/MutablePropertyCategory.js +12 -0
  134. package/lib/esm/Editing/Mutable/MutablePropertyCategory.js.map +1 -0
  135. package/lib/esm/Editing/Mutable/MutableRelationshipClass.d.ts +30 -0
  136. package/lib/esm/Editing/Mutable/MutableRelationshipClass.d.ts.map +1 -0
  137. package/lib/esm/Editing/Mutable/MutableRelationshipClass.js +20 -0
  138. package/lib/esm/Editing/Mutable/MutableRelationshipClass.js.map +1 -0
  139. package/lib/esm/Editing/Mutable/MutableSchema.d.ts +51 -0
  140. package/lib/esm/Editing/Mutable/MutableSchema.d.ts.map +1 -0
  141. package/lib/esm/Editing/Mutable/MutableSchema.js +14 -0
  142. package/lib/esm/Editing/Mutable/MutableSchema.js.map +1 -0
  143. package/lib/esm/Editing/Mutable/MutableSchemaItem.d.ts +11 -0
  144. package/lib/esm/Editing/Mutable/MutableSchemaItem.d.ts.map +1 -0
  145. package/lib/esm/Editing/Mutable/MutableSchemaItem.js +12 -0
  146. package/lib/esm/Editing/Mutable/MutableSchemaItem.js.map +1 -0
  147. package/lib/esm/Editing/Mutable/MutableStructProperty.d.ts +8 -0
  148. package/lib/esm/Editing/Mutable/MutableStructProperty.d.ts.map +1 -0
  149. package/lib/esm/Editing/Mutable/MutableStructProperty.js +12 -0
  150. package/lib/esm/Editing/Mutable/MutableStructProperty.js.map +1 -0
  151. package/lib/esm/Editing/Mutable/MutableUnit.d.ts +12 -0
  152. package/lib/esm/Editing/Mutable/MutableUnit.d.ts.map +1 -0
  153. package/lib/esm/Editing/Mutable/MutableUnit.js +12 -0
  154. package/lib/esm/Editing/Mutable/MutableUnit.js.map +1 -0
  155. package/lib/esm/Editing/Mutable/MutableUnitSystem.d.ts +10 -0
  156. package/lib/esm/Editing/Mutable/MutableUnitSystem.d.ts.map +1 -0
  157. package/lib/esm/Editing/Mutable/MutableUnitSystem.js +12 -0
  158. package/lib/esm/Editing/Mutable/MutableUnitSystem.js.map +1 -0
  159. package/lib/esm/Editing/Phenomena.d.ts +17 -0
  160. package/lib/esm/Editing/Phenomena.d.ts.map +1 -0
  161. package/lib/esm/Editing/Phenomena.js +44 -0
  162. package/lib/esm/Editing/Phenomena.js.map +1 -0
  163. package/lib/esm/Editing/Properties.d.ts +206 -0
  164. package/lib/esm/Editing/Properties.d.ts.map +1 -0
  165. package/lib/esm/Editing/Properties.js +415 -0
  166. package/lib/esm/Editing/Properties.js.map +1 -0
  167. package/lib/esm/Editing/PropertyCategories.d.ts +18 -0
  168. package/lib/esm/Editing/PropertyCategories.d.ts.map +1 -0
  169. package/lib/esm/Editing/PropertyCategories.js +54 -0
  170. package/lib/esm/Editing/PropertyCategories.js.map +1 -0
  171. package/lib/esm/Editing/RelationshipClasses.d.ts +69 -0
  172. package/lib/esm/Editing/RelationshipClasses.d.ts.map +1 -0
  173. package/lib/esm/Editing/RelationshipClasses.js +236 -0
  174. package/lib/esm/Editing/RelationshipClasses.js.map +1 -0
  175. package/lib/esm/Editing/SchemaItems.d.ts +42 -0
  176. package/lib/esm/Editing/SchemaItems.d.ts.map +1 -0
  177. package/lib/esm/Editing/SchemaItems.js +104 -0
  178. package/lib/esm/Editing/SchemaItems.js.map +1 -0
  179. package/lib/esm/Editing/Structs.d.ts +21 -0
  180. package/lib/esm/Editing/Structs.d.ts.map +1 -0
  181. package/lib/esm/Editing/Structs.js +47 -0
  182. package/lib/esm/Editing/Structs.js.map +1 -0
  183. package/lib/esm/Editing/UnitSystems.d.ts +17 -0
  184. package/lib/esm/Editing/UnitSystems.d.ts.map +1 -0
  185. package/lib/esm/Editing/UnitSystems.js +43 -0
  186. package/lib/esm/Editing/UnitSystems.js.map +1 -0
  187. package/lib/esm/Editing/Units.d.ts +17 -0
  188. package/lib/esm/Editing/Units.d.ts.map +1 -0
  189. package/lib/esm/Editing/Units.js +49 -0
  190. package/lib/esm/Editing/Units.js.map +1 -0
  191. package/lib/esm/Merging/ClassMerger.d.ts +9 -0
  192. package/lib/esm/Merging/ClassMerger.d.ts.map +1 -0
  193. package/lib/esm/Merging/ClassMerger.js +66 -0
  194. package/lib/esm/Merging/ClassMerger.js.map +1 -0
  195. package/lib/esm/Merging/ConstantMerger.d.ts +14 -0
  196. package/lib/esm/Merging/ConstantMerger.d.ts.map +1 -0
  197. package/lib/esm/Merging/ConstantMerger.js +64 -0
  198. package/lib/esm/Merging/ConstantMerger.js.map +1 -0
  199. package/lib/esm/Merging/CustomAttributeClassMerger.d.ts +14 -0
  200. package/lib/esm/Merging/CustomAttributeClassMerger.d.ts.map +1 -0
  201. package/lib/esm/Merging/CustomAttributeClassMerger.js +36 -0
  202. package/lib/esm/Merging/CustomAttributeClassMerger.js.map +1 -0
  203. package/lib/esm/Merging/CustomAttributeMerger.d.ts +19 -0
  204. package/lib/esm/Merging/CustomAttributeMerger.d.ts.map +1 -0
  205. package/lib/esm/Merging/CustomAttributeMerger.js +66 -0
  206. package/lib/esm/Merging/CustomAttributeMerger.js.map +1 -0
  207. package/lib/esm/Merging/Edits/NameMapping.d.ts +22 -0
  208. package/lib/esm/Merging/Edits/NameMapping.d.ts.map +1 -0
  209. package/lib/esm/Merging/Edits/NameMapping.js +49 -0
  210. package/lib/esm/Merging/Edits/NameMapping.js.map +1 -0
  211. package/lib/esm/Merging/Edits/RenameEditHandler.d.ts +14 -0
  212. package/lib/esm/Merging/Edits/RenameEditHandler.d.ts.map +1 -0
  213. package/lib/esm/Merging/Edits/RenameEditHandler.js +62 -0
  214. package/lib/esm/Merging/Edits/RenameEditHandler.js.map +1 -0
  215. package/lib/esm/Merging/Edits/SchemaEdits.d.ts +81 -0
  216. package/lib/esm/Merging/Edits/SchemaEdits.d.ts.map +1 -0
  217. package/lib/esm/Merging/Edits/SchemaEdits.js +112 -0
  218. package/lib/esm/Merging/Edits/SchemaEdits.js.map +1 -0
  219. package/lib/esm/Merging/Edits/SkipEditHandler.d.ts +14 -0
  220. package/lib/esm/Merging/Edits/SkipEditHandler.d.ts.map +1 -0
  221. package/lib/esm/Merging/Edits/SkipEditHandler.js +60 -0
  222. package/lib/esm/Merging/Edits/SkipEditHandler.js.map +1 -0
  223. package/lib/esm/Merging/EntityClassMerger.d.ts +19 -0
  224. package/lib/esm/Merging/EntityClassMerger.d.ts.map +1 -0
  225. package/lib/esm/Merging/EntityClassMerger.js +39 -0
  226. package/lib/esm/Merging/EntityClassMerger.js.map +1 -0
  227. package/lib/esm/Merging/EnumerationMerger.d.ts +14 -0
  228. package/lib/esm/Merging/EnumerationMerger.d.ts.map +1 -0
  229. package/lib/esm/Merging/EnumerationMerger.js +48 -0
  230. package/lib/esm/Merging/EnumerationMerger.js.map +1 -0
  231. package/lib/esm/Merging/EnumeratorMerger.d.ts +14 -0
  232. package/lib/esm/Merging/EnumeratorMerger.d.ts.map +1 -0
  233. package/lib/esm/Merging/EnumeratorMerger.js +36 -0
  234. package/lib/esm/Merging/EnumeratorMerger.js.map +1 -0
  235. package/lib/esm/Merging/FormatMerger.d.ts +24 -0
  236. package/lib/esm/Merging/FormatMerger.d.ts.map +1 -0
  237. package/lib/esm/Merging/FormatMerger.js +137 -0
  238. package/lib/esm/Merging/FormatMerger.js.map +1 -0
  239. package/lib/esm/Merging/InvertedUnitMerger.d.ts +14 -0
  240. package/lib/esm/Merging/InvertedUnitMerger.d.ts.map +1 -0
  241. package/lib/esm/Merging/InvertedUnitMerger.js +41 -0
  242. package/lib/esm/Merging/InvertedUnitMerger.js.map +1 -0
  243. package/lib/esm/Merging/KindOfQuantityMerger.d.ts +19 -0
  244. package/lib/esm/Merging/KindOfQuantityMerger.d.ts.map +1 -0
  245. package/lib/esm/Merging/KindOfQuantityMerger.js +89 -0
  246. package/lib/esm/Merging/KindOfQuantityMerger.js.map +1 -0
  247. package/lib/esm/Merging/MixinMerger.d.ts +14 -0
  248. package/lib/esm/Merging/MixinMerger.d.ts.map +1 -0
  249. package/lib/esm/Merging/MixinMerger.js +33 -0
  250. package/lib/esm/Merging/MixinMerger.js.map +1 -0
  251. package/lib/esm/Merging/PhenomenonMerger.d.ts +14 -0
  252. package/lib/esm/Merging/PhenomenonMerger.d.ts.map +1 -0
  253. package/lib/esm/Merging/PhenomenonMerger.js +36 -0
  254. package/lib/esm/Merging/PhenomenonMerger.js.map +1 -0
  255. package/lib/esm/Merging/PropertyCategoryMerger.d.ts +14 -0
  256. package/lib/esm/Merging/PropertyCategoryMerger.d.ts.map +1 -0
  257. package/lib/esm/Merging/PropertyCategoryMerger.js +31 -0
  258. package/lib/esm/Merging/PropertyCategoryMerger.js.map +1 -0
  259. package/lib/esm/Merging/PropertyMerger.d.ts +12 -0
  260. package/lib/esm/Merging/PropertyMerger.d.ts.map +1 -0
  261. package/lib/esm/Merging/PropertyMerger.js +228 -0
  262. package/lib/esm/Merging/PropertyMerger.js.map +1 -0
  263. package/lib/esm/Merging/RelationshipClassMerger.d.ts +27 -0
  264. package/lib/esm/Merging/RelationshipClassMerger.d.ts.map +1 -0
  265. package/lib/esm/Merging/RelationshipClassMerger.js +136 -0
  266. package/lib/esm/Merging/RelationshipClassMerger.js.map +1 -0
  267. package/lib/esm/Merging/SchemaMerger.d.ts +49 -0
  268. package/lib/esm/Merging/SchemaMerger.d.ts.map +1 -0
  269. package/lib/esm/Merging/SchemaMerger.js +117 -0
  270. package/lib/esm/Merging/SchemaMerger.js.map +1 -0
  271. package/lib/esm/Merging/SchemaMergingVisitor.d.ts +149 -0
  272. package/lib/esm/Merging/SchemaMergingVisitor.d.ts.map +1 -0
  273. package/lib/esm/Merging/SchemaMergingVisitor.js +339 -0
  274. package/lib/esm/Merging/SchemaMergingVisitor.js.map +1 -0
  275. package/lib/esm/Merging/SchemaMergingWalker.d.ts +19 -0
  276. package/lib/esm/Merging/SchemaMergingWalker.d.ts.map +1 -0
  277. package/lib/esm/Merging/SchemaMergingWalker.js +61 -0
  278. package/lib/esm/Merging/SchemaMergingWalker.js.map +1 -0
  279. package/lib/esm/Merging/SchemaReferenceMerger.d.ts +13 -0
  280. package/lib/esm/Merging/SchemaReferenceMerger.d.ts.map +1 -0
  281. package/lib/esm/Merging/SchemaReferenceMerger.js +57 -0
  282. package/lib/esm/Merging/SchemaReferenceMerger.js.map +1 -0
  283. package/lib/esm/Merging/StructClassMerger.d.ts +14 -0
  284. package/lib/esm/Merging/StructClassMerger.d.ts.map +1 -0
  285. package/lib/esm/Merging/StructClassMerger.js +20 -0
  286. package/lib/esm/Merging/StructClassMerger.js.map +1 -0
  287. package/lib/esm/Merging/UnitMerger.d.ts +14 -0
  288. package/lib/esm/Merging/UnitMerger.d.ts.map +1 -0
  289. package/lib/esm/Merging/UnitMerger.js +58 -0
  290. package/lib/esm/Merging/UnitMerger.js.map +1 -0
  291. package/lib/esm/Merging/UnitSystemMerger.d.ts +14 -0
  292. package/lib/esm/Merging/UnitSystemMerger.d.ts.map +1 -0
  293. package/lib/esm/Merging/UnitSystemMerger.js +24 -0
  294. package/lib/esm/Merging/UnitSystemMerger.js.map +1 -0
  295. package/lib/esm/Merging/Utils.d.ts +34 -0
  296. package/lib/esm/Merging/Utils.d.ts.map +1 -0
  297. package/lib/esm/Merging/Utils.js +90 -0
  298. package/lib/esm/Merging/Utils.js.map +1 -0
  299. package/lib/esm/Validation/Diagnostic.d.ts +322 -0
  300. package/lib/esm/Validation/Diagnostic.d.ts.map +1 -0
  301. package/lib/esm/Validation/Diagnostic.js +295 -0
  302. package/lib/esm/Validation/Diagnostic.js.map +1 -0
  303. package/lib/esm/Validation/DiagnosticReporter.d.ts +97 -0
  304. package/lib/esm/Validation/DiagnosticReporter.d.ts.map +1 -0
  305. package/lib/esm/Validation/DiagnosticReporter.js +105 -0
  306. package/lib/esm/Validation/DiagnosticReporter.js.map +1 -0
  307. package/lib/esm/Validation/ECRules.d.ts +454 -0
  308. package/lib/esm/Validation/ECRules.d.ts.map +1 -0
  309. package/lib/esm/Validation/ECRules.js +578 -0
  310. package/lib/esm/Validation/ECRules.js.map +1 -0
  311. package/lib/esm/Validation/LoggingDiagnosticReporter.d.ts +14 -0
  312. package/lib/esm/Validation/LoggingDiagnosticReporter.d.ts.map +1 -0
  313. package/lib/esm/Validation/LoggingDiagnosticReporter.js +37 -0
  314. package/lib/esm/Validation/LoggingDiagnosticReporter.js.map +1 -0
  315. package/lib/esm/Validation/RuleSuppressionSet.d.ts +60 -0
  316. package/lib/esm/Validation/RuleSuppressionSet.d.ts.map +1 -0
  317. package/lib/esm/Validation/RuleSuppressionSet.js +9 -0
  318. package/lib/esm/Validation/RuleSuppressionSet.js.map +1 -0
  319. package/lib/esm/Validation/Rules.d.ts +65 -0
  320. package/lib/esm/Validation/Rules.d.ts.map +1 -0
  321. package/lib/esm/Validation/Rules.js +9 -0
  322. package/lib/esm/Validation/Rules.js.map +1 -0
  323. package/lib/esm/Validation/SchemaChanges.d.ts +640 -0
  324. package/lib/esm/Validation/SchemaChanges.d.ts.map +1 -0
  325. package/lib/esm/Validation/SchemaChanges.js +1141 -0
  326. package/lib/esm/Validation/SchemaChanges.js.map +1 -0
  327. package/lib/esm/Validation/SchemaCompareDiagnostics.d.ts +423 -0
  328. package/lib/esm/Validation/SchemaCompareDiagnostics.d.ts.map +1 -0
  329. package/lib/esm/Validation/SchemaCompareDiagnostics.js +109 -0
  330. package/lib/esm/Validation/SchemaCompareDiagnostics.js.map +1 -0
  331. package/lib/esm/Validation/SchemaCompareReporter.d.ts +12 -0
  332. package/lib/esm/Validation/SchemaCompareReporter.d.ts.map +1 -0
  333. package/lib/esm/Validation/SchemaCompareReporter.js +9 -0
  334. package/lib/esm/Validation/SchemaCompareReporter.js.map +1 -0
  335. package/lib/esm/Validation/SchemaCompareResultDelegate.d.ts +237 -0
  336. package/lib/esm/Validation/SchemaCompareResultDelegate.d.ts.map +1 -0
  337. package/lib/esm/Validation/SchemaCompareResultDelegate.js +346 -0
  338. package/lib/esm/Validation/SchemaCompareResultDelegate.js.map +1 -0
  339. package/lib/esm/Validation/SchemaCompareVisitor.d.ts +120 -0
  340. package/lib/esm/Validation/SchemaCompareVisitor.d.ts.map +1 -0
  341. package/lib/esm/Validation/SchemaCompareVisitor.js +222 -0
  342. package/lib/esm/Validation/SchemaCompareVisitor.js.map +1 -0
  343. package/lib/esm/Validation/SchemaComparer.d.ts +211 -0
  344. package/lib/esm/Validation/SchemaComparer.d.ts.map +1 -0
  345. package/lib/esm/Validation/SchemaComparer.js +770 -0
  346. package/lib/esm/Validation/SchemaComparer.js.map +1 -0
  347. package/lib/esm/Validation/SchemaValidater.d.ts +20 -0
  348. package/lib/esm/Validation/SchemaValidater.d.ts.map +1 -0
  349. package/lib/esm/Validation/SchemaValidater.js +55 -0
  350. package/lib/esm/Validation/SchemaValidater.js.map +1 -0
  351. package/lib/esm/Validation/SchemaValidationVisitor.d.ts +171 -0
  352. package/lib/esm/Validation/SchemaValidationVisitor.d.ts.map +1 -0
  353. package/lib/esm/Validation/SchemaValidationVisitor.js +488 -0
  354. package/lib/esm/Validation/SchemaValidationVisitor.js.map +1 -0
  355. package/lib/esm/Validation/SchemaWalker.d.ts +23 -0
  356. package/lib/esm/Validation/SchemaWalker.d.ts.map +1 -0
  357. package/lib/esm/Validation/SchemaWalker.js +50 -0
  358. package/lib/esm/Validation/SchemaWalker.js.map +1 -0
  359. package/lib/esm/ecschema-editing.d.ts +49 -0
  360. package/lib/esm/ecschema-editing.d.ts.map +1 -0
  361. package/lib/esm/ecschema-editing.js +52 -0
  362. package/lib/esm/ecschema-editing.js.map +1 -0
  363. package/package.json +12 -10
@@ -0,0 +1,578 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module Validation
7
+ */
8
+ import { ECClassModifier, ECStringConstants, EntityClass, Mixin, PrimitiveType, primitiveTypeToString, RelationshipMultiplicity, SchemaGraph, SchemaItemType, StrengthDirection, strengthDirectionToString, } from "@itwin/ecschema-metadata";
9
+ import { createClassDiagnosticClass, createCustomAttributeContainerDiagnosticClass, createPropertyDiagnosticClass, createRelationshipConstraintDiagnosticClass, createSchemaDiagnosticClass, createSchemaItemDiagnosticClass, } from "./Diagnostic";
10
+ const ruleSetName = "ECObjects";
11
+ function getCode(code) {
12
+ return `${ruleSetName}-${code}`;
13
+ }
14
+ /**
15
+ * The unique diagnostic codes for ECObjects rules.
16
+ *
17
+ * To provide meaning to code values, with anticipation
18
+ * of future rules for all current EC Types, the following
19
+ * value ranges should be used:
20
+ *
21
+ * - Schema: 000-099
22
+ * - Class: 100-199
23
+ * - Constant: 200-299
24
+ * - CustomAttribute 300-399
25
+ * - CustomAttributeClass: 400-499
26
+ * - CustomAttributeContainer: 500-599
27
+ * - EntityClass: 600-699
28
+ * - Enumeration: 700-799
29
+ * - Format: 800-899
30
+ * - InvertedUnit: 900-999
31
+ * - KindOfQuantity: 1000-1099
32
+ * - Mixin: 1100-1199
33
+ * - Phenomenon: 1200-1299
34
+ * - Property: 1300-1399
35
+ * - PropertyCategory: 1400-1499
36
+ * - RelationshipClass: 1500-1599
37
+ * - RelationshipConstraint: 1600-1699
38
+ * - StructClass: 1700-1799
39
+ * - Unit: 1800-1899
40
+ * - UnitSystem: 1900-1999
41
+ * @beta
42
+ */
43
+ /* eslint-disable @typescript-eslint/naming-convention */
44
+ export const DiagnosticCodes = {
45
+ // Class Rule Codes (100-199)
46
+ BaseClassIsSealed: getCode(100),
47
+ BaseClassOfDifferentType: getCode(101),
48
+ // EC-102 has been deprecated. Leaving the code here to prevent re-use.
49
+ AbstractClassWithNonAbstractBase: getCode(102),
50
+ // CA Container Rule Codes (500-599)
51
+ CustomAttributeNotOfConcreteClass: getCode(500),
52
+ CustomAttributeSchemaMustBeReferenced: getCode(501),
53
+ CustomAttributeClassNotFound: getCode(502),
54
+ // Enumeration Rule Codes (700-799)
55
+ EnumerationTypeUnsupported: getCode(700),
56
+ // Mixin Rule Codes (1100-1199)
57
+ MixinAppliedToClassMustDeriveFromConstraint: getCode(1100),
58
+ // Property Rule Codes (1300-1399)
59
+ IncompatibleValueTypePropertyOverride: getCode(1300),
60
+ IncompatibleTypePropertyOverride: getCode(1301),
61
+ IncompatibleUnitPropertyOverride: getCode(1302),
62
+ // Relationship Rule Codes (1500-1599)
63
+ AbstractConstraintMustNarrowBaseConstraints: getCode(1500),
64
+ DerivedConstraintsMustNarrowBaseConstraints: getCode(1501),
65
+ ConstraintClassesDeriveFromAbstractConstraint: getCode(1502),
66
+ // Relationship Constraint Rule Codes (1600-1699)
67
+ AtLeastOneConstraintClassDefined: getCode(1600),
68
+ AbstractConstraintMustExistWithMultipleConstraints: getCode(1601),
69
+ };
70
+ /**
71
+ * The list of [[IDiagnostic]] implementation classes used by the EC rule implementations.
72
+ * @beta
73
+ */
74
+ export const Diagnostics = {
75
+ /** EC-001: Required message parameters: schema name, referenced schema name */
76
+ SupplementalSchemasCannotBeReferenced: createSchemaDiagnosticClass(getCode(1), "Referenced schema '{1}' of schema '{0}' is a supplemental schema. Supplemental schemas are not allowed to be referenced."),
77
+ /** EC-002: Required message parameters: schema name, reference schema alias, first schema reference name, second schema reference name. */
78
+ SchemaRefAliasMustBeUnique: createSchemaDiagnosticClass(getCode(2), "Schema '{0}' has multiple schema references ({2}, {3}) with the same alias '{1}', which is not allowed."),
79
+ /** EC-003: Required message parameters: schema name, cycle text */
80
+ ReferenceCyclesNotAllowed: createSchemaDiagnosticClass(getCode(3), "Schema '{0}' has reference cycles: {1}"),
81
+ /** EC-100: Required message parameters: childClass.FullName, baseClass.FullName */
82
+ BaseClassIsSealed: createClassDiagnosticClass(DiagnosticCodes.BaseClassIsSealed, "Class '{0}' cannot derive from sealed base class '{1}'."),
83
+ /** EC-101: Required message parameters: childClass.FullName, baseClass.FullName, baseClass.schemaItemType */
84
+ BaseClassIsOfDifferentType: createClassDiagnosticClass(DiagnosticCodes.BaseClassOfDifferentType, "Class '{0}' cannot derive from base class '{1}' of type '{2}'."),
85
+ /** **DEPRECATED** EC-102: Required message parameters: childClass.FullName, baseClass.FullName */
86
+ AbstractClassWithNonAbstractBase: createClassDiagnosticClass(DiagnosticCodes.AbstractClassWithNonAbstractBase, "Abstract Class '{0}' cannot derive from base class '{1}' because it is not an abstract class."),
87
+ /** EC-500: Required message parameters: CustomAttribute container name and CustomAttributeClass name. */
88
+ CustomAttributeNotOfConcreteClass: createCustomAttributeContainerDiagnosticClass(DiagnosticCodes.CustomAttributeNotOfConcreteClass, "The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' which is not a concrete class."),
89
+ /** EC-501: Required message parameters: CustomAttribute container name, CustomAttributeClass name, CustomAttributeClass Schema name. */
90
+ CustomAttributeSchemaMustBeReferenced: createCustomAttributeContainerDiagnosticClass(DiagnosticCodes.CustomAttributeSchemaMustBeReferenced, "The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' whose schema is not referenced by the container's Schema."),
91
+ /** EC-502: Required message parameters: CustomAttribute container name and CustomAttributeClass name. */
92
+ CustomAttributeClassNotFound: createCustomAttributeContainerDiagnosticClass(DiagnosticCodes.CustomAttributeClassNotFound, "The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' which cannot be found."),
93
+ /** EC-700: Required message parameters: Enumeration name */
94
+ EnumerationTypeUnsupported: createSchemaItemDiagnosticClass(DiagnosticCodes.EnumerationTypeUnsupported, "Enumeration '{0}' has invalid primitive type."),
95
+ /** EC-1100: Required message parameters: mixin class fullName, class fullName, applies to constraint class fullName */
96
+ MixinAppliedToClassMustDeriveFromConstraint: createSchemaItemDiagnosticClass(DiagnosticCodes.MixinAppliedToClassMustDeriveFromConstraint, "Mixin '{0}' cannot be applied to the class '{1}' because it does not satisfy the applies to constraint '{2}'."),
97
+ /** EC-1300: Required message parameters: childClass.FullName, property name, baseClass.FullName, base value type, child value type */
98
+ IncompatibleValueTypePropertyOverride: createPropertyDiagnosticClass(DiagnosticCodes.IncompatibleValueTypePropertyOverride, "The ECProperty '{0}.{1}' has a base property '{2}.{1}' with a value type of {3} which is incompatible with the value type of {4}."),
99
+ /** EC-1301: Required message parameters: childClass.FullName, property name, baseClass.FullName, base property type, child property type */
100
+ IncompatibleTypePropertyOverride: createPropertyDiagnosticClass(DiagnosticCodes.IncompatibleTypePropertyOverride, "The ECProperty '{0}.{1}' has a base property '{2}.{1}' with a type of {3} which is incompatible with the type of {4}."),
101
+ /** EC-1302: Required message parameters: childClass.Name, property name, baseClass.Name, baseClass Koq name, baseClass Koq persistence unit name, child class Koq persistence unit name, child class Koq name */
102
+ IncompatibleUnitPropertyOverride: createPropertyDiagnosticClass(DiagnosticCodes.IncompatibleUnitPropertyOverride, "The ECProperty '{0}.{1}' has a base property '{2}.{1}' with KindOfQuantity '{3}' with persistence unit '{4}' which is not the same as the persistence unit '{5}' of the provided KindOfQuantity '{6}'."),
103
+ /** EC-1303: Required message parameters: property.fullName, navigation relationship.fullName */
104
+ NavigationRelationshipMustBeRoot: createPropertyDiagnosticClass(getCode(1303), "The referenced relationship '{1}', used in NavigationProperty '{0}' is not the root relationship."),
105
+ /** EC-1304: Required message parameters: property.fullName, navigation relationship.fullName */
106
+ NavigationTargetMustHaveSingularMultiplicity: createPropertyDiagnosticClass(getCode(1304), "NavigationProperty '{0}' uses the relationship '{1}' that cannot be traversed in the '{2}' direction due to a max multiplicity greater than 1."),
107
+ /** EC-1305: Required message parameters: property.fullName, navigation relationship.fullName */
108
+ NavigationRelationshipAbstractConstraintEntityOrMixin: createPropertyDiagnosticClass(getCode(1305), "The NavigationProperty '{0}', using the relationship '{1}', points to a RelationshipClass, which is not allowed. NavigationProperties must point to an EntityClass or Mixin."),
109
+ /** EC-1306: Required message parameters: class name, property name, navigation relationship.fullName */
110
+ NavigationClassMustBeAConstraintClassOfRelationship: createPropertyDiagnosticClass(getCode(1306), "The class '{0}' of NavigationProperty '{1}' is not supported by the {3} constraint of the referenced relationship '{2}'."),
111
+ /** EC-1500: Required message parameters: abstract constraint class name, relationship end (source/target), relationship name, base relationship name */
112
+ AbstractConstraintMustNarrowBaseConstraints: createSchemaItemDiagnosticClass(DiagnosticCodes.AbstractConstraintMustNarrowBaseConstraints, "The abstract constraint class '{0}' on the {1}-Constraint of '{2}' is not supported by the base class constraint in '{3}'."),
113
+ /** EC-1501: Required message parameters: constraint class name, relationship end (source/target), relationship name, base relationship name */
114
+ DerivedConstraintsMustNarrowBaseConstraints: createSchemaItemDiagnosticClass(DiagnosticCodes.DerivedConstraintsMustNarrowBaseConstraints, "The constraint class '{0}' on the {1}-Constraint of '{2}' is not supported by the base class constraint in '{3}'."),
115
+ /** EC-1502: Required message parameters: constraint class name, relationship end (source/target), relationship name, abstract constraint class name */
116
+ ConstraintClassesDeriveFromAbstractConstraint: createSchemaItemDiagnosticClass(DiagnosticCodes.ConstraintClassesDeriveFromAbstractConstraint, "The constraint class '{0}' on the {1}-Constraint of '{2}' is not derived from the abstract constraint class '{3}'."),
117
+ /** EC-1600: Required message parameters: relationship end (source/target), relationship name */
118
+ AtLeastOneConstraintClassDefined: createRelationshipConstraintDiagnosticClass(DiagnosticCodes.AtLeastOneConstraintClassDefined, "The {0}-Constraint of '{1}' does not contain any constraint classes."),
119
+ /** EC-1601: Required message parameters: relationship end (source/target), relationship name */
120
+ AbstractConstraintMustExistWithMultipleConstraints: createRelationshipConstraintDiagnosticClass(DiagnosticCodes.AbstractConstraintMustExistWithMultipleConstraints, "The {0}-Constraint of '{1}' has multiple constraint classes which requires an abstract constraint to be defined."),
121
+ };
122
+ /**
123
+ * All schema validation rules that fall under the category of ECObjects.
124
+ * @beta
125
+ */
126
+ export const ECRuleSet = {
127
+ name: ruleSetName,
128
+ schemaRules: [
129
+ validateSchemaReferences,
130
+ ],
131
+ classRules: [
132
+ baseClassIsSealed,
133
+ baseClassIsOfDifferentType,
134
+ ],
135
+ propertyRules: [
136
+ incompatibleValueTypePropertyOverride,
137
+ incompatibleTypePropertyOverride,
138
+ incompatibleUnitPropertyOverride,
139
+ validateNavigationProperty,
140
+ ],
141
+ relationshipRules: [
142
+ abstractConstraintMustNarrowBaseConstraints,
143
+ constraintClassesDeriveFromAbstractConstraint,
144
+ derivedConstraintsMustNarrowBaseConstraints,
145
+ ],
146
+ relationshipConstraintRules: [
147
+ atLeastOneConstraintClassDefined,
148
+ abstractConstraintMustExistWithMultipleConstraints,
149
+ ],
150
+ enumerationRules: [
151
+ enumerationTypeUnsupported,
152
+ ],
153
+ entityClassRules: [
154
+ mixinAppliedToClassMustDeriveFromConstraint,
155
+ ],
156
+ customAttributeInstanceRules: [
157
+ validateCustomAttributeInstance,
158
+ ],
159
+ };
160
+ /* eslint-enable @typescript-eslint/naming-convention */
161
+ /**
162
+ * Validates schema references against multiple EC rules.
163
+ * @param schema The schema to validate.
164
+ * @internal
165
+ */
166
+ export async function* validateSchemaReferences(schema) {
167
+ yield* validateSchemaReferencesSync(schema);
168
+ }
169
+ /**
170
+ * Validates schema references against multiple EC rules.
171
+ * @param schema The schema to validate.
172
+ * @internal
173
+ */
174
+ export function* validateSchemaReferencesSync(schema) {
175
+ const aliases = new Map();
176
+ for (const schemaRef of schema.references) {
177
+ if (schemaRef.customAttributes && schemaRef.customAttributes.has("CoreCustomAttributes.SupplementalSchema"))
178
+ yield new Diagnostics.SupplementalSchemasCannotBeReferenced(schema, [schema.name, schemaRef.name]);
179
+ if (schema.schemaKey.matches(schemaRef.schemaKey))
180
+ yield new Diagnostics.ReferenceCyclesNotAllowed(schema, [schema.name, `${schema.name} --> ${schemaRef.name}`]);
181
+ if (aliases.has(schemaRef.alias)) {
182
+ const currentRef = aliases.get(schemaRef.alias);
183
+ yield new Diagnostics.SchemaRefAliasMustBeUnique(schema, [schema.name, schemaRef.alias, currentRef.name, schemaRef.name]);
184
+ }
185
+ else {
186
+ aliases.set(schemaRef.alias, schemaRef);
187
+ }
188
+ }
189
+ const graph = SchemaGraph.generateGraphSync(schema);
190
+ const cycles = graph.detectCycles();
191
+ if (cycles) {
192
+ const result = cycles.map((cycle) => `${cycle.schema.schemaKey.name} --> ${cycle.refSchema.schemaKey.name}`).join(", ");
193
+ yield new Diagnostics.ReferenceCyclesNotAllowed(schema, [schema.name, result]);
194
+ }
195
+ }
196
+ /**
197
+ * EC Rule: Sealed classes cannot be a base class.
198
+ * @internal
199
+ */
200
+ export async function* baseClassIsSealed(ecClass) {
201
+ if (!ecClass.baseClass)
202
+ return;
203
+ const baseClass = await ecClass.baseClass;
204
+ // return if rule passed
205
+ if (baseClass.modifier !== ECClassModifier.Sealed)
206
+ return;
207
+ yield new Diagnostics.BaseClassIsSealed(ecClass, [ecClass.fullName, baseClass.fullName]);
208
+ }
209
+ /**
210
+ * EC Rule: Base and child class must be of the same type (i.e. Entity, Mixin, Relationship, etc.)
211
+ * @internal
212
+ */
213
+ export async function* baseClassIsOfDifferentType(ecClass) {
214
+ if (!ecClass.baseClass)
215
+ return;
216
+ const baseClass = await ecClass.baseClass;
217
+ // return if rule passed
218
+ if (baseClass.schemaItemType === ecClass.schemaItemType)
219
+ return;
220
+ const itemType = baseClass.schemaItemType;
221
+ yield new Diagnostics.BaseClassIsOfDifferentType(ecClass, [ecClass.fullName, baseClass.fullName, itemType]);
222
+ }
223
+ /**
224
+ * EC Rule: When overriding a class primitive property, the child and base property must be of the same type (string, number, etc...).
225
+ * @internal
226
+ */
227
+ export async function* incompatibleValueTypePropertyOverride(property) {
228
+ if (!property.class.baseClass)
229
+ return;
230
+ const primitiveType = getPrimitiveType(property);
231
+ if (!primitiveType)
232
+ return;
233
+ async function callback(baseClass) {
234
+ const baseProperty = await baseClass.getProperty(property.name);
235
+ if (!baseProperty)
236
+ return;
237
+ // Other rules will catch this if false, but we need to make sure
238
+ // types match for this rule to be valid.
239
+ if (!propertyTypesMatch(property, baseProperty))
240
+ return;
241
+ const baseType = getPrimitiveType(baseProperty);
242
+ // Return if rule passed
243
+ if (!baseType || primitiveType === baseType)
244
+ return;
245
+ return new Diagnostics.IncompatibleValueTypePropertyOverride(property, [property.class.fullName, property.name, baseClass.fullName, primitiveTypeToString(baseType), primitiveTypeToString(primitiveType)]);
246
+ }
247
+ for await (const baseClass of property.class.getAllBaseClasses()) {
248
+ const result = await callback(baseClass);
249
+ if (result)
250
+ yield result;
251
+ }
252
+ }
253
+ /**
254
+ * EC Rule: When overriding a class property, the child and base property must be of the same property type (primitive, struct, enumeration, etc...).
255
+ * @internal
256
+ */
257
+ export async function* incompatibleTypePropertyOverride(property) {
258
+ if (!property.class.baseClass)
259
+ return;
260
+ async function callback(baseClass) {
261
+ const baseProperty = await baseClass.getProperty(property.name);
262
+ if (!baseProperty)
263
+ return;
264
+ // Return if rule passed
265
+ if (propertyTypesMatch(property, baseProperty))
266
+ return;
267
+ return new Diagnostics.IncompatibleTypePropertyOverride(property, [property.class.fullName, property.name, baseClass.fullName, baseProperty.constructor.name, property.constructor.name]);
268
+ }
269
+ for await (const baseClass of property.class.getAllBaseClasses()) {
270
+ const result = await callback(baseClass);
271
+ if (result)
272
+ yield result;
273
+ }
274
+ }
275
+ /**
276
+ * EC Rule: When overriding a kindOfQuantity property, the child and base property units must be the same.
277
+ * @internal
278
+ */
279
+ export async function* incompatibleUnitPropertyOverride(property) {
280
+ if (!property.kindOfQuantity || !property.class.baseClass)
281
+ return;
282
+ async function callback(baseClass) {
283
+ const baseProperty = await baseClass.getProperty(property.name);
284
+ if (!baseProperty || !baseProperty.kindOfQuantity)
285
+ return;
286
+ // Other rules will catch this if false, but we need to make sure
287
+ // types match for this rule to be valid.
288
+ if (!propertyTypesMatch(property, baseProperty))
289
+ return;
290
+ const koq = await property.kindOfQuantity;
291
+ const baseKoq = await baseProperty.kindOfQuantity;
292
+ if (!koq || !baseKoq)
293
+ return;
294
+ const unit = await koq.persistenceUnit;
295
+ const baseUnit = await baseKoq.persistenceUnit;
296
+ if (!unit || !baseUnit)
297
+ return;
298
+ // return if rule passed
299
+ if (unit.key.matches(baseUnit.key))
300
+ return;
301
+ return new Diagnostics.IncompatibleUnitPropertyOverride(property, [
302
+ property.class.fullName,
303
+ property.name,
304
+ baseClass.fullName,
305
+ baseKoq.fullName,
306
+ baseUnit.fullName,
307
+ unit.fullName,
308
+ koq.fullName,
309
+ ]);
310
+ }
311
+ for await (const baseClass of property.class.getAllBaseClasses()) {
312
+ const result = await callback(baseClass);
313
+ if (result)
314
+ yield result;
315
+ }
316
+ }
317
+ /**
318
+ * Validates Navigation Properties. EC Rules: 1303, 1304
319
+ * @internal
320
+ */
321
+ export async function* validateNavigationProperty(property) {
322
+ if (!property.isNavigation())
323
+ return;
324
+ const navProp = property;
325
+ const relationship = await navProp.relationshipClass;
326
+ if (relationship.baseClass)
327
+ yield new Diagnostics.NavigationRelationshipMustBeRoot(property, [property.fullName, relationship.fullName]);
328
+ let thisConstraint;
329
+ let thatConstraint;
330
+ let navigationClassSide;
331
+ if (navProp.direction === StrengthDirection.Forward) {
332
+ thisConstraint = relationship.source;
333
+ thatConstraint = relationship.target;
334
+ navigationClassSide = "source";
335
+ }
336
+ else {
337
+ thisConstraint = relationship.target;
338
+ thatConstraint = relationship.source;
339
+ navigationClassSide = "target";
340
+ }
341
+ const thatAbstractConstraint = await thatConstraint.abstractConstraint;
342
+ if (thatAbstractConstraint && thatAbstractConstraint.schemaItemType === SchemaItemType.RelationshipClass) {
343
+ yield new Diagnostics.NavigationRelationshipAbstractConstraintEntityOrMixin(property, [property.fullName, relationship.fullName]);
344
+ }
345
+ const isClassSupported = async (ecClass, propertyName, constraintName) => {
346
+ if (constraintName === ecClass.fullName && undefined !== await ecClass.getProperty(propertyName))
347
+ return true;
348
+ const inheritedProp = await ecClass.getInheritedProperty(propertyName);
349
+ if (inheritedProp && constraintName === inheritedProp.class.fullName)
350
+ return true;
351
+ const baseClass = await ecClass.baseClass;
352
+ if (!baseClass)
353
+ return false;
354
+ return isClassSupported(baseClass, propertyName, constraintName);
355
+ };
356
+ let classSupported = false;
357
+ if (thisConstraint.constraintClasses) {
358
+ for (const constraintClass of thisConstraint.constraintClasses) {
359
+ classSupported = await isClassSupported(property.class, property.name, constraintClass.fullName);
360
+ if (classSupported)
361
+ break;
362
+ }
363
+ }
364
+ if (!classSupported)
365
+ yield new Diagnostics.NavigationClassMustBeAConstraintClassOfRelationship(property, [property.class.name, property.name, relationship.fullName, navigationClassSide]);
366
+ if (thatConstraint.multiplicity === RelationshipMultiplicity.oneMany || thatConstraint.multiplicity === RelationshipMultiplicity.zeroMany) {
367
+ const direction = strengthDirectionToString(navProp.direction);
368
+ yield new Diagnostics.NavigationTargetMustHaveSingularMultiplicity(property, [property.fullName, relationship.fullName, direction]);
369
+ }
370
+ return;
371
+ }
372
+ /**
373
+ * Validates a Relationship class and yields EC-1500, EC-1501, and EC-1502 rule violations.
374
+ * @internal
375
+ */
376
+ export async function* validateRelationship(ecClass) {
377
+ yield* abstractConstraintMustNarrowBaseConstraints(ecClass);
378
+ yield* derivedConstraintsMustNarrowBaseConstraints(ecClass);
379
+ yield* constraintClassesDeriveFromAbstractConstraint(ecClass);
380
+ }
381
+ /**
382
+ * EC Rule: When overriding a RelationshipClass, the derived abstract constraint must narrow the base constraint classes.
383
+ * @internal
384
+ */
385
+ export async function* abstractConstraintMustNarrowBaseConstraints(ecClass) {
386
+ if (!ecClass.baseClass)
387
+ return;
388
+ const baseRelationship = await ecClass.baseClass;
389
+ const sourceResult = await applyAbstractConstraintMustNarrowBaseConstraints(ecClass, ecClass.source, baseRelationship);
390
+ if (sourceResult)
391
+ yield sourceResult;
392
+ const targetResult = await applyAbstractConstraintMustNarrowBaseConstraints(ecClass, ecClass.target, baseRelationship);
393
+ if (targetResult)
394
+ yield targetResult;
395
+ }
396
+ /**
397
+ * EC Rule: When overriding a RelationshipClass, derived constraint classes must narrow base constraint classes.
398
+ * @internal
399
+ */
400
+ export async function* derivedConstraintsMustNarrowBaseConstraints(ecClass) {
401
+ if (!ecClass.baseClass)
402
+ return;
403
+ const baseRelationship = await ecClass.baseClass;
404
+ const sourceResult = await applyDerivedConstraintsMustNarrowBaseConstraints(ecClass, ecClass.source, baseRelationship);
405
+ if (sourceResult)
406
+ yield sourceResult;
407
+ const targetResult = await applyDerivedConstraintsMustNarrowBaseConstraints(ecClass, ecClass.target, baseRelationship);
408
+ if (targetResult)
409
+ yield targetResult;
410
+ }
411
+ /**
412
+ * EC Rule: All constraint classes must have a common base class specified in the abstract constraint.
413
+ * @internal
414
+ */
415
+ export async function* constraintClassesDeriveFromAbstractConstraint(ecClass) {
416
+ const sourceResult = await applyConstraintClassesDeriveFromAbstractConstraint(ecClass, ecClass.source);
417
+ if (sourceResult)
418
+ yield sourceResult;
419
+ const targetResult = await applyConstraintClassesDeriveFromAbstractConstraint(ecClass, ecClass.target);
420
+ if (targetResult)
421
+ yield targetResult;
422
+ }
423
+ /**
424
+ * Validates a RelationshipConstraint and yields EC-1600 and EC-1601 rule violations.
425
+ * @internal
426
+ */
427
+ export async function* validateRelationshipConstraint(constraint) {
428
+ yield* atLeastOneConstraintClassDefined(constraint);
429
+ yield* abstractConstraintMustExistWithMultipleConstraints(constraint);
430
+ }
431
+ /**
432
+ * EC Rule: At least on concrete constraint class must be defined in the list of constraint classes.
433
+ * @internal
434
+ */
435
+ export async function* atLeastOneConstraintClassDefined(constraint) {
436
+ if (!constraint.constraintClasses || constraint.constraintClasses.length === 0) {
437
+ const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;
438
+ yield new Diagnostics.AtLeastOneConstraintClassDefined(constraint, [constraintType, constraint.relationshipClass.fullName]);
439
+ }
440
+ }
441
+ /**
442
+ * EC Rule: If multiple constraints exist, an abstract constraint must be defined.
443
+ * @internal
444
+ */
445
+ export async function* abstractConstraintMustExistWithMultipleConstraints(constraint) {
446
+ if (!constraint.constraintClasses || constraint.constraintClasses.length <= 1) {
447
+ return;
448
+ }
449
+ const abstractConstraint = await getAbstractConstraint(constraint);
450
+ if (abstractConstraint)
451
+ return;
452
+ const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;
453
+ yield new Diagnostics.AbstractConstraintMustExistWithMultipleConstraints(constraint, [constraintType, constraint.relationshipClass.fullName]);
454
+ }
455
+ function propertyTypesMatch(propertyA, propertyB) {
456
+ return propertyA.constructor.name === propertyB.constructor.name;
457
+ }
458
+ function getPrimitiveType(property) {
459
+ if (property.isPrimitive())
460
+ return property.primitiveType;
461
+ return undefined;
462
+ }
463
+ /**
464
+ * EC Rule: Enumeration type must be a string or integer
465
+ * @internal
466
+ */
467
+ export async function* enumerationTypeUnsupported(enumeration) {
468
+ const type = enumeration.type;
469
+ if (type === PrimitiveType.Integer || type === PrimitiveType.String)
470
+ return;
471
+ yield new Diagnostics.EnumerationTypeUnsupported(enumeration, [enumeration.fullName]);
472
+ }
473
+ /**
474
+ * EC Rule: Mixin applied to class must derived from the Mixin appliesTo constraint.
475
+ * @internal
476
+ */
477
+ export async function* mixinAppliedToClassMustDeriveFromConstraint(entityClass) {
478
+ for (const lazyMixin of entityClass.mixins) {
479
+ const mixin = await lazyMixin;
480
+ if (!mixin.appliesTo)
481
+ continue;
482
+ if (!await entityClass.is(await mixin.appliesTo))
483
+ yield new Diagnostics.MixinAppliedToClassMustDeriveFromConstraint(entityClass, [mixin.fullName, entityClass.fullName, mixin.appliesTo.fullName]);
484
+ }
485
+ return;
486
+ }
487
+ /**
488
+ * Validates a custom attribute instance and yields EC-500, EC-501, and EC-502 rule violations.
489
+ * @internal
490
+ */
491
+ export async function* validateCustomAttributeInstance(container, customAttribute) {
492
+ yield* customAttributeNotOfConcreteClass(container, customAttribute);
493
+ yield* customAttributeSchemaMustBeReferenced(container, customAttribute);
494
+ yield* customAttributeClassMustExist(container, customAttribute);
495
+ }
496
+ /** EC Rule: CustomAttribute instance must be of a concrete CustomAttributeClass. */
497
+ async function* customAttributeNotOfConcreteClass(container, customAttribute) {
498
+ const schema = container.schema;
499
+ const caClass = await schema.lookupItem(customAttribute.className);
500
+ if (!caClass)
501
+ return;
502
+ if (caClass.modifier !== ECClassModifier.Abstract)
503
+ return;
504
+ yield new Diagnostics.CustomAttributeNotOfConcreteClass(container, [container.fullName, caClass.fullName]);
505
+ }
506
+ /** EC Rule: CustomAttribute Schema must be referenced by the container's Schema. */
507
+ async function* customAttributeSchemaMustBeReferenced(container, customAttribute) {
508
+ const schema = container.schema;
509
+ const nameParts = customAttribute.className.split(".");
510
+ if (nameParts.length === 1 || nameParts[0] === schema.name)
511
+ return;
512
+ if (schema.references.some((s) => s.name === nameParts[0]))
513
+ return;
514
+ yield new Diagnostics.CustomAttributeSchemaMustBeReferenced(container, [container.fullName, customAttribute.className]);
515
+ }
516
+ /** EC Rule: CustomAttribute instance class must exist. */
517
+ async function* customAttributeClassMustExist(container, customAttribute) {
518
+ const schema = container.schema;
519
+ const caClass = await schema.lookupItem(customAttribute.className);
520
+ if (!caClass)
521
+ yield new Diagnostics.CustomAttributeClassNotFound(container, [container.fullName, customAttribute.className]);
522
+ }
523
+ async function applyAbstractConstraintMustNarrowBaseConstraints(ecClass, constraint, baseRelationship) {
524
+ const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;
525
+ const abstractConstraint = await constraint.abstractConstraint;
526
+ if (!abstractConstraint)
527
+ return;
528
+ if (await baseConstraint.supportsClass(abstractConstraint))
529
+ return;
530
+ const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;
531
+ return new Diagnostics.AbstractConstraintMustNarrowBaseConstraints(ecClass, [abstractConstraint.fullName, constraintType, constraint.relationshipClass.fullName, baseRelationship.fullName]);
532
+ }
533
+ async function applyDerivedConstraintsMustNarrowBaseConstraints(ecClass, constraint, baseRelationship) {
534
+ const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;
535
+ if (!constraint.constraintClasses)
536
+ return;
537
+ for (const classPromise of constraint.constraintClasses) {
538
+ const constraintClass = await classPromise;
539
+ if (await baseConstraint.supportsClass(constraintClass))
540
+ continue;
541
+ const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;
542
+ return new Diagnostics.DerivedConstraintsMustNarrowBaseConstraints(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, baseRelationship.fullName]);
543
+ }
544
+ return;
545
+ }
546
+ async function applyConstraintClassesDeriveFromAbstractConstraint(ecClass, constraint) {
547
+ const abstractConstraint = await getAbstractConstraint(constraint);
548
+ if (!abstractConstraint)
549
+ return;
550
+ if (!constraint.constraintClasses)
551
+ return;
552
+ for (const classPromise of constraint.constraintClasses) {
553
+ const constraintClass = await classPromise;
554
+ if (Mixin.isMixin(constraintClass) && EntityClass.isEntityClass(abstractConstraint)) {
555
+ if (!await (constraintClass).applicableTo(abstractConstraint)) {
556
+ const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;
557
+ return new Diagnostics.ConstraintClassesDeriveFromAbstractConstraint(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, abstractConstraint.fullName]);
558
+ }
559
+ continue;
560
+ }
561
+ if (!await constraintClass.is(abstractConstraint)) {
562
+ const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;
563
+ return new Diagnostics.ConstraintClassesDeriveFromAbstractConstraint(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, abstractConstraint.fullName]);
564
+ }
565
+ }
566
+ return;
567
+ }
568
+ async function getAbstractConstraint(constraint) {
569
+ const abstractConstraint = await constraint.abstractConstraint;
570
+ if (abstractConstraint)
571
+ return abstractConstraint;
572
+ const baseRelationship = await constraint.relationshipClass.baseClass;
573
+ if (!baseRelationship)
574
+ return;
575
+ const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;
576
+ return getAbstractConstraint(baseConstraint);
577
+ }
578
+ //# sourceMappingURL=ECRules.js.map