@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,471 @@
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 Editing
7
+ */
8
+ import { PrimitiveType, primitiveTypeToString, Property, SchemaItemKey } from "@itwin/ecschema-metadata";
9
+ /** @alpha */
10
+ export var ECEditingStatus;
11
+ (function (ECEditingStatus) {
12
+ ECEditingStatus[ECEditingStatus["EC_EDITING_ERROR_BASE"] = 196608] = "EC_EDITING_ERROR_BASE";
13
+ ECEditingStatus[ECEditingStatus["Unknown"] = 0] = "Unknown";
14
+ ECEditingStatus[ECEditingStatus["RuleViolation"] = 196609] = "RuleViolation";
15
+ ECEditingStatus[ECEditingStatus["SchemaNotFound"] = 196610] = "SchemaNotFound";
16
+ ECEditingStatus[ECEditingStatus["SchemaItemNotFound"] = 196611] = "SchemaItemNotFound";
17
+ ECEditingStatus[ECEditingStatus["SchemaItemNotFoundInContext"] = 196612] = "SchemaItemNotFoundInContext";
18
+ ECEditingStatus[ECEditingStatus["PropertyAlreadyExists"] = 196613] = "PropertyAlreadyExists";
19
+ ECEditingStatus[ECEditingStatus["PropertyNotFound"] = 196614] = "PropertyNotFound";
20
+ ECEditingStatus[ECEditingStatus["InvalidPropertyType"] = 196615] = "InvalidPropertyType";
21
+ ECEditingStatus[ECEditingStatus["BaseClassIsNotElement"] = 196616] = "BaseClassIsNotElement";
22
+ ECEditingStatus[ECEditingStatus["BaseClassIsNotElementUniqueAspect"] = 196617] = "BaseClassIsNotElementUniqueAspect";
23
+ ECEditingStatus[ECEditingStatus["BaseClassIsNotElementMultiAspect"] = 196618] = "BaseClassIsNotElementMultiAspect";
24
+ ECEditingStatus[ECEditingStatus["SchemaItemNameNotSpecified"] = 196619] = "SchemaItemNameNotSpecified";
25
+ ECEditingStatus[ECEditingStatus["InvalidSchemaItemType"] = 196620] = "InvalidSchemaItemType";
26
+ ECEditingStatus[ECEditingStatus["SchemaItemNameAlreadyExists"] = 196621] = "SchemaItemNameAlreadyExists";
27
+ ECEditingStatus[ECEditingStatus["InvalidEnumeratorType"] = 196622] = "InvalidEnumeratorType";
28
+ ECEditingStatus[ECEditingStatus["InvalidBaseClass"] = 196623] = "InvalidBaseClass";
29
+ ECEditingStatus[ECEditingStatus["EnumeratorDoesNotExist"] = 196624] = "EnumeratorDoesNotExist";
30
+ ECEditingStatus[ECEditingStatus["InvalidECName"] = 196625] = "InvalidECName";
31
+ ECEditingStatus[ECEditingStatus["InvalidSchemaAlias"] = 196626] = "InvalidSchemaAlias";
32
+ ECEditingStatus[ECEditingStatus["InvalidFormatUnitsSpecified"] = 196627] = "InvalidFormatUnitsSpecified";
33
+ ECEditingStatus[ECEditingStatus["SchemaAliasAlreadyExists"] = 196628] = "SchemaAliasAlreadyExists";
34
+ // Outer Errors
35
+ ECEditingStatus[ECEditingStatus["CreateSchemaItemFailed"] = 196629] = "CreateSchemaItemFailed";
36
+ ECEditingStatus[ECEditingStatus["CreateSchemaItemFromProps"] = 196630] = "CreateSchemaItemFromProps";
37
+ ECEditingStatus[ECEditingStatus["CreateElement"] = 196631] = "CreateElement";
38
+ ECEditingStatus[ECEditingStatus["CreateElementUniqueAspect"] = 196632] = "CreateElementUniqueAspect";
39
+ ECEditingStatus[ECEditingStatus["CreateElementMultiAspect"] = 196633] = "CreateElementMultiAspect";
40
+ ECEditingStatus[ECEditingStatus["SetBaseClass"] = 196634] = "SetBaseClass";
41
+ ECEditingStatus[ECEditingStatus["SetSourceConstraint"] = 196635] = "SetSourceConstraint";
42
+ ECEditingStatus[ECEditingStatus["SetTargetConstraint"] = 196636] = "SetTargetConstraint";
43
+ ECEditingStatus[ECEditingStatus["AddConstraintClass"] = 196637] = "AddConstraintClass";
44
+ ECEditingStatus[ECEditingStatus["RemoveConstraintClass"] = 196638] = "RemoveConstraintClass";
45
+ ECEditingStatus[ECEditingStatus["SetAbstractConstraint"] = 196639] = "SetAbstractConstraint";
46
+ ECEditingStatus[ECEditingStatus["AddCustomAttributeToConstraint"] = 196640] = "AddCustomAttributeToConstraint";
47
+ ECEditingStatus[ECEditingStatus["AddCustomAttributeToProperty"] = 196641] = "AddCustomAttributeToProperty";
48
+ ECEditingStatus[ECEditingStatus["AddCustomAttributeToClass"] = 196642] = "AddCustomAttributeToClass";
49
+ ECEditingStatus[ECEditingStatus["CreateNavigationProperty"] = 196643] = "CreateNavigationProperty";
50
+ ECEditingStatus[ECEditingStatus["CreateNavigationPropertyFromProps"] = 196644] = "CreateNavigationPropertyFromProps";
51
+ ECEditingStatus[ECEditingStatus["SetInvertsUnit"] = 196645] = "SetInvertsUnit";
52
+ ECEditingStatus[ECEditingStatus["SetUnitSystem"] = 196646] = "SetUnitSystem";
53
+ ECEditingStatus[ECEditingStatus["SetDescription"] = 196647] = "SetDescription";
54
+ ECEditingStatus[ECEditingStatus["SetLabel"] = 196648] = "SetLabel";
55
+ ECEditingStatus[ECEditingStatus["SetIsReadOnly"] = 196649] = "SetIsReadOnly";
56
+ ECEditingStatus[ECEditingStatus["SetPriority"] = 196650] = "SetPriority";
57
+ ECEditingStatus[ECEditingStatus["SetCategory"] = 196651] = "SetCategory";
58
+ ECEditingStatus[ECEditingStatus["SetKindOfQuantity"] = 196652] = "SetKindOfQuantity";
59
+ ECEditingStatus[ECEditingStatus["SetMinOccurs"] = 196653] = "SetMinOccurs";
60
+ ECEditingStatus[ECEditingStatus["SetMaxOccurs"] = 196654] = "SetMaxOccurs";
61
+ ECEditingStatus[ECEditingStatus["SetExtendedTypeName"] = 196655] = "SetExtendedTypeName";
62
+ ECEditingStatus[ECEditingStatus["SetMinLength"] = 196656] = "SetMinLength";
63
+ ECEditingStatus[ECEditingStatus["SetMaxLength"] = 196657] = "SetMaxLength";
64
+ ECEditingStatus[ECEditingStatus["SetMinValue"] = 196658] = "SetMinValue";
65
+ ECEditingStatus[ECEditingStatus["SetMaxValue"] = 196659] = "SetMaxValue";
66
+ ECEditingStatus[ECEditingStatus["SetPropertyName"] = 196660] = "SetPropertyName";
67
+ ECEditingStatus[ECEditingStatus["AddMixin"] = 196661] = "AddMixin";
68
+ ECEditingStatus[ECEditingStatus["AddEnumerator"] = 196662] = "AddEnumerator";
69
+ ECEditingStatus[ECEditingStatus["SetEnumeratorLabel"] = 196663] = "SetEnumeratorLabel";
70
+ ECEditingStatus[ECEditingStatus["SetEnumeratorDescription"] = 196664] = "SetEnumeratorDescription";
71
+ ECEditingStatus[ECEditingStatus["AddPresentationUnit"] = 196665] = "AddPresentationUnit";
72
+ ECEditingStatus[ECEditingStatus["AddPresentationOverride"] = 196666] = "AddPresentationOverride";
73
+ ECEditingStatus[ECEditingStatus["CreateFormatOverride"] = 196667] = "CreateFormatOverride";
74
+ ECEditingStatus[ECEditingStatus["SetPropertyCategoryPriority"] = 196668] = "SetPropertyCategoryPriority";
75
+ ECEditingStatus[ECEditingStatus["CreatePrimitiveProperty"] = 196669] = "CreatePrimitiveProperty";
76
+ ECEditingStatus[ECEditingStatus["CreatePrimitivePropertyFromProps"] = 196670] = "CreatePrimitivePropertyFromProps";
77
+ ECEditingStatus[ECEditingStatus["CreateEnumerationProperty"] = 196671] = "CreateEnumerationProperty";
78
+ ECEditingStatus[ECEditingStatus["CreateEnumerationPropertyFromProps"] = 196672] = "CreateEnumerationPropertyFromProps";
79
+ ECEditingStatus[ECEditingStatus["CreatePrimitiveArrayProperty"] = 196673] = "CreatePrimitiveArrayProperty";
80
+ ECEditingStatus[ECEditingStatus["CreatePrimitiveArrayPropertyFromProps"] = 196674] = "CreatePrimitiveArrayPropertyFromProps";
81
+ ECEditingStatus[ECEditingStatus["CreateEnumerationArrayProperty"] = 196675] = "CreateEnumerationArrayProperty";
82
+ ECEditingStatus[ECEditingStatus["CreateEnumerationArrayPropertyFromProps"] = 196676] = "CreateEnumerationArrayPropertyFromProps";
83
+ ECEditingStatus[ECEditingStatus["CreateStructProperty"] = 196677] = "CreateStructProperty";
84
+ ECEditingStatus[ECEditingStatus["CreateStructPropertyFromProps"] = 196678] = "CreateStructPropertyFromProps";
85
+ ECEditingStatus[ECEditingStatus["CreateStructArrayProperty"] = 196679] = "CreateStructArrayProperty";
86
+ ECEditingStatus[ECEditingStatus["CreateStructArrayPropertyFromProps"] = 196680] = "CreateStructArrayPropertyFromProps";
87
+ ECEditingStatus[ECEditingStatus["DeleteProperty"] = 196681] = "DeleteProperty";
88
+ ECEditingStatus[ECEditingStatus["DeleteClass"] = 196682] = "DeleteClass";
89
+ ECEditingStatus[ECEditingStatus["SetClassName"] = 196683] = "SetClassName";
90
+ ECEditingStatus[ECEditingStatus["AddSchemaReference"] = 196684] = "AddSchemaReference";
91
+ ECEditingStatus[ECEditingStatus["SetSchemaVersion"] = 196685] = "SetSchemaVersion";
92
+ ECEditingStatus[ECEditingStatus["IncrementSchemaMinorVersion"] = 196686] = "IncrementSchemaMinorVersion";
93
+ ECEditingStatus[ECEditingStatus["SetSchemaAlias"] = 196687] = "SetSchemaAlias";
94
+ })(ECEditingStatus || (ECEditingStatus = {}));
95
+ /**
96
+ * Defines the possible property type names.
97
+ * @alpha
98
+ */
99
+ export var PropertyTypeName;
100
+ (function (PropertyTypeName) {
101
+ PropertyTypeName["ArrayProperty"] = "ArrayProperty";
102
+ PropertyTypeName["PrimitiveProperty"] = "PrimitiveProperty";
103
+ PropertyTypeName["EnumerationProperty"] = "EnumerationProperty";
104
+ PropertyTypeName["NavigationProperty"] = "NavigationProperty";
105
+ PropertyTypeName["StructProperty"] = "StructProperty";
106
+ })(PropertyTypeName || (PropertyTypeName = {}));
107
+ /**
108
+ * Defines the possible schema type identifiers.
109
+ * @alpha
110
+ */
111
+ export var SchemaTypeIdentifiers;
112
+ (function (SchemaTypeIdentifiers) {
113
+ SchemaTypeIdentifiers["SchemaIdentifier"] = "Schema";
114
+ SchemaTypeIdentifiers["SchemaItemIdentifier"] = "SchemaItem";
115
+ SchemaTypeIdentifiers["ClassIdentifier"] = "Class";
116
+ SchemaTypeIdentifiers["PropertyIdentifier"] = "Property";
117
+ SchemaTypeIdentifiers["EnumeratorIdentifier"] = "Enumerator";
118
+ SchemaTypeIdentifiers["CustomAttributeIdentifier"] = "CustomAttribute";
119
+ SchemaTypeIdentifiers["RelationshipConstraintIdentifier"] = "RelationshipConstraint";
120
+ })(SchemaTypeIdentifiers || (SchemaTypeIdentifiers = {}));
121
+ /**
122
+ * An ISchemaIdentifier implementation to identify Schemas
123
+ * @alpha
124
+ */
125
+ export class SchemaId {
126
+ typeIdentifier = SchemaTypeIdentifiers.SchemaIdentifier;
127
+ name;
128
+ schemaKey;
129
+ constructor(schemaKey) {
130
+ this.name = schemaKey.name;
131
+ this.schemaKey = schemaKey;
132
+ }
133
+ }
134
+ /**
135
+ * An ISchemItemIdentifier implementation to identify SchemaItems
136
+ * @alpha
137
+ */
138
+ export class SchemaItemId {
139
+ typeIdentifier;
140
+ name;
141
+ schemaKey;
142
+ schemaItemType;
143
+ schemaItemKey;
144
+ constructor(schemaItemType, schemaItemKeyOrName, schemaKey) {
145
+ if (typeof (schemaItemKeyOrName) === "string") {
146
+ if (!schemaKey)
147
+ throw new Error("schemaKey if required if the specified schemaItem the name of the schema item.");
148
+ this.schemaKey = schemaKey;
149
+ this.schemaItemKey = new SchemaItemKey(schemaItemKeyOrName, schemaKey);
150
+ }
151
+ else {
152
+ this.schemaKey = schemaItemKeyOrName.schemaKey;
153
+ this.schemaItemKey = schemaItemKeyOrName;
154
+ }
155
+ this.schemaItemType = schemaItemType;
156
+ this.name = this.schemaItemKey.fullName;
157
+ this.typeIdentifier = SchemaTypeIdentifiers.SchemaItemIdentifier;
158
+ }
159
+ }
160
+ /**
161
+ * An IClassIdentifier implementation to identify Class instances.
162
+ * @alpha
163
+ */
164
+ export class ClassId extends SchemaItemId {
165
+ typeIdentifier = SchemaTypeIdentifiers.ClassIdentifier;
166
+ schemaItemType;
167
+ constructor(schemaItemType, schemaItemKeyOrName, schemaKey) {
168
+ super(schemaItemType, schemaItemKeyOrName, schemaKey);
169
+ this.schemaItemType = schemaItemType;
170
+ }
171
+ }
172
+ /**
173
+ * An IPropertyIdentifier implementation to identify Property instances.
174
+ * @alpha
175
+ */
176
+ export class PropertyId {
177
+ typeIdentifier = SchemaTypeIdentifiers.PropertyIdentifier;
178
+ name;
179
+ fullName;
180
+ ecClass;
181
+ schemaKey;
182
+ typeName;
183
+ constructor(schemaItemType, classKey, property, typeName) {
184
+ this.name = property instanceof Property ? property.name : property;
185
+ this.fullName = property instanceof Property ? property.fullName : `${classKey.name}.${property}`;
186
+ this.ecClass = new ClassId(schemaItemType, classKey);
187
+ this.schemaKey = classKey.schemaKey;
188
+ this.typeName = typeName;
189
+ }
190
+ }
191
+ /**
192
+ * An IEnumeratorIdentifier implementation to identify Enumerator instances.
193
+ * @alpha
194
+ */
195
+ export class EnumeratorId {
196
+ typeIdentifier = SchemaTypeIdentifiers.EnumeratorIdentifier;
197
+ enumeration;
198
+ enumerationType;
199
+ enumeratorType;
200
+ name;
201
+ schemaKey;
202
+ constructor(enumerator, enumeration) {
203
+ this.enumeration = enumeration.key;
204
+ this.enumerationType = enumeration.type ? primitiveTypeToString(enumeration.type) : "string";
205
+ this.enumeratorType = getEnumeratorType(enumeration ?? PrimitiveType.String, enumerator);
206
+ this.name = typeof (enumerator) === "string" ? enumerator : enumerator.name;
207
+ this.schemaKey = enumeration.schema.schemaKey;
208
+ }
209
+ }
210
+ /**
211
+ * An ICustomAttributeIdentifier implementation to identify CustomAttribute instances.
212
+ * @alpha
213
+ */
214
+ export class CustomAttributeId {
215
+ typeIdentifier = SchemaTypeIdentifiers.CustomAttributeIdentifier;
216
+ name;
217
+ schemaKey;
218
+ containerFullName;
219
+ constructor(name, container) {
220
+ this.name = name;
221
+ this.schemaKey = container.schema.schemaKey;
222
+ this.containerFullName = container.fullName;
223
+ }
224
+ }
225
+ /**
226
+ * An IRelationshipConstraintIdentifier implementation to identify RelationshipConstraints.
227
+ * @alpha
228
+ */
229
+ export class RelationshipConstraintId {
230
+ typeIdentifier = SchemaTypeIdentifiers.RelationshipConstraintIdentifier;
231
+ name;
232
+ relationshipKey;
233
+ schemaKey;
234
+ constructor(constraint) {
235
+ this.name = constraint.isSource ? "Source" : "Target";
236
+ this.relationshipKey = constraint.relationshipClass.key;
237
+ this.schemaKey = this.relationshipKey.schemaKey;
238
+ }
239
+ }
240
+ /**
241
+ * An exception class for the ecschema-editing API. Contains identifiers for schema types involved in the
242
+ * exception. An example being SchemaItemId which contains the name of the SchemaItem, SchemaItemKey, SchemaItemType, etc.
243
+ * Typically will contain an innerError of type SchemaEditingError containing the identifier of the schema item that
244
+ * caused the exception. The containing error instance will identify the method called (identified by the errorNumber)
245
+ * and the identifier of the schema item being modified/created.
246
+ * @alpha
247
+ */
248
+ export class SchemaEditingError extends Error {
249
+ errorNumber;
250
+ identifier;
251
+ innerError;
252
+ _ruleViolations;
253
+ _schemaKey;
254
+ /**
255
+ * Constructs a new SchemaEditingError instance.
256
+ * @param errorNumber The unique ECEditingStatus code identifying the error.
257
+ * @param identifier The identifier instance containing information about the EC object involved with the exception.
258
+ * @param innerError The SchemaEditingError containing the identifier of the EC object that caused the initial exception.
259
+ * @param ruleViolations Will contain EC rule violations of type [[AnyDiagnostic]] for exceptions with the error code ECEditingStatus.RuleViolation.
260
+ * @param message Optional error message. Most messages on automatically generated by this class based on the ECEditingStatus code.
261
+ */
262
+ constructor(errorNumber, identifier, innerError, ruleViolations, message) {
263
+ super(message);
264
+ this.errorNumber = errorNumber;
265
+ this.identifier = identifier;
266
+ this.innerError = innerError;
267
+ this._ruleViolations = ruleViolations;
268
+ this._schemaKey = identifier.schemaKey,
269
+ this.generateMessage();
270
+ }
271
+ /**
272
+ * Gets the SchemaId instance.
273
+ * @throws Error if the identifier is not an instance of SchemaId.
274
+ */
275
+ get _schemaId() {
276
+ if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.SchemaIdentifier)
277
+ throw new Error("identifier is not a SchemaId.");
278
+ return this.identifier;
279
+ }
280
+ /**
281
+ * Gets the SchemaItemId instance.
282
+ * @throws Error if the identifier is not an instance of SchemaItemId.
283
+ */
284
+ get _schemaItemId() {
285
+ if (this.isSchemaItemIdentifier(this.identifier))
286
+ throw new Error("identifier is not a SchemaItemId.");
287
+ return this.identifier;
288
+ }
289
+ /**
290
+ * Gets the ClassId instance.
291
+ * @throws Error if the identifier is not an instance of ClassId.
292
+ */
293
+ get _classId() {
294
+ if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.ClassIdentifier)
295
+ throw new Error("identifier is not a ClassId.");
296
+ return this.identifier;
297
+ }
298
+ /**
299
+ * Gets the PropertyId instance.
300
+ * @throws Error if the identifier is not an instance of PropertyId.
301
+ */
302
+ get _propertyId() {
303
+ if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.PropertyIdentifier)
304
+ throw new Error("identifier is not a PropertyId.");
305
+ return this.identifier;
306
+ }
307
+ /**
308
+ * Gets the EnumeratorId instance.
309
+ * @throws Error if the identifier is not an instance of EnumeratorId.
310
+ */
311
+ get _enumeratorId() {
312
+ if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.EnumeratorIdentifier)
313
+ throw new Error("identifier is not a EnumerationId.");
314
+ return this.identifier;
315
+ }
316
+ /**
317
+ * Gets the CustomAttributeId instance.
318
+ * @throws Error if the identifier is not an instance of CustomAttributeId.
319
+ */
320
+ get _customAttributeId() {
321
+ if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.CustomAttributeIdentifier)
322
+ throw new Error("identifier is not a CustomAttributeId.");
323
+ return this.identifier;
324
+ }
325
+ /**
326
+ * Gets the RelationshipConstraintId instance.
327
+ * @throws Error if the identifier is not an instance of RelationshipConstraintId.
328
+ */
329
+ get _relationshipConstraintId() {
330
+ if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.RelationshipConstraintIdentifier)
331
+ throw new Error("identifier is not a RelationshipConstraintId.");
332
+ return this.identifier;
333
+ }
334
+ /** Gets rule violations that were reported during validation. Returns an array of [[AnyDiagnostic]] if
335
+ * the errorNumber is ECEditingStatus.RuleViolation, otherwise undefined.
336
+ */
337
+ get ruleViolations() {
338
+ return this._ruleViolations;
339
+ }
340
+ /**
341
+ * Returns a readable string containing the ECEditingStatus along with the error message. Any
342
+ * innerError will also be appended.
343
+ * @returns
344
+ */
345
+ toDebugString() {
346
+ let innerMessage = "";
347
+ if (this.innerError) {
348
+ if (this.innerError instanceof SchemaEditingError)
349
+ innerMessage = ` Inner error: ${this.innerError.toDebugString()}`;
350
+ else
351
+ innerMessage = ` Inner error: ${this.innerError.message}`;
352
+ }
353
+ return this._appendMessage(`ECEditingStatus.${ECEditingStatus[this.errorNumber]}`) + innerMessage;
354
+ }
355
+ generateMessage() {
356
+ if (this.message)
357
+ return;
358
+ switch (this.errorNumber) {
359
+ case ECEditingStatus.SchemaNotFound:
360
+ this.message = `Schema Key ${this._schemaKey.toString(true)} could not be found in the context.`;
361
+ return;
362
+ case ECEditingStatus.SchemaItemNotFound:
363
+ this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} could not be found in the schema ${this._schemaKey.name}.`;
364
+ return;
365
+ case ECEditingStatus.SchemaItemNotFoundInContext:
366
+ this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} could not be found in the schema context.`;
367
+ return;
368
+ case ECEditingStatus.InvalidSchemaItemType:
369
+ this.message = `Expected ${this._schemaItemId.name} to be of type ${this._schemaItemId.schemaItemType}.`;
370
+ return;
371
+ case ECEditingStatus.SchemaItemNameNotSpecified:
372
+ this.message = `Could not create a new ${this._schemaItemId.schemaItemType} in schema ${this._schemaKey.name}. No name was supplied within props.`;
373
+ return;
374
+ case ECEditingStatus.SchemaItemNameAlreadyExists:
375
+ this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} already exists in the schema ${this._schemaKey.name}.`;
376
+ return;
377
+ case ECEditingStatus.RuleViolation:
378
+ this.message = this._getRuleViolationMessage();
379
+ return;
380
+ case ECEditingStatus.PropertyNotFound:
381
+ this.message = `An ECProperty with the name ${this._propertyId.name} could not be found in the class ${this._propertyId.ecClass.name}.`;
382
+ return;
383
+ case ECEditingStatus.PropertyAlreadyExists:
384
+ this.message = `An ECProperty with the name ${this._propertyId.name} already exists in the class ${this._propertyId.ecClass.name}.`;
385
+ return;
386
+ case ECEditingStatus.InvalidPropertyType:
387
+ this.message = `Expected property ${this._propertyId.name} to be of type ${this._propertyId.typeName}.`;
388
+ return;
389
+ case ECEditingStatus.BaseClassIsNotElement:
390
+ this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.Element.`;
391
+ return;
392
+ case ECEditingStatus.BaseClassIsNotElementUniqueAspect:
393
+ this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.ElementUniqueAspect.`;
394
+ return;
395
+ case ECEditingStatus.BaseClassIsNotElementMultiAspect:
396
+ this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.ElementMultiAspect.`;
397
+ return;
398
+ case ECEditingStatus.InvalidFormatUnitsSpecified:
399
+ this.message = `The specified Format unit ${this._schemaItemId.name} is not of type Unit or InvertedUnit`;
400
+ return;
401
+ case ECEditingStatus.InvalidEnumeratorType:
402
+ this.message = `The Enumeration ${this._enumeratorId.enumeration.fullName} has type ${this._enumeratorId.enumerationType}, while Enumerator ${this._enumeratorId.name} has type ${this._enumeratorId.enumeratorType}.`;
403
+ return;
404
+ case ECEditingStatus.EnumeratorDoesNotExist:
405
+ this.message = `Enumerator ${this._enumeratorId.name} does not exists in Enumeration ${this._enumeratorId.enumeration.name}.`;
406
+ return;
407
+ case ECEditingStatus.InvalidECName:
408
+ this.message = `Could not rename class ${this._schemaItemId.name} because the specified name is not a valid ECName.`;
409
+ return;
410
+ case ECEditingStatus.InvalidSchemaAlias:
411
+ this.message = `Could not set the alias for schema ${this._schemaKey.name} because the specified alias is not a valid ECName.`;
412
+ return;
413
+ default:
414
+ this.message = this._createTaskErrorMessage();
415
+ }
416
+ }
417
+ _appendMessage(e) {
418
+ return this.message ? `${e}: ${this.message}` : e;
419
+ }
420
+ _getRuleViolationMessage() {
421
+ if (!this._ruleViolations)
422
+ return "";
423
+ let violations = "";
424
+ for (const diagnostic of this._ruleViolations) {
425
+ violations += `${diagnostic.code}: ${diagnostic.messageText}\r\n`;
426
+ }
427
+ switch (this.identifier.typeIdentifier) {
428
+ case SchemaTypeIdentifiers.SchemaIdentifier:
429
+ return `Rule violations occurred from Schema ${this._schemaId.name}: ${violations}`;
430
+ case SchemaTypeIdentifiers.SchemaItemIdentifier:
431
+ return `Rule violations occurred from ${this._schemaItemId.schemaItemType} ${this._schemaItemId.name}: ${violations}`;
432
+ case SchemaTypeIdentifiers.ClassIdentifier:
433
+ return `Rule violations occurred from ${this._schemaItemId.schemaItemType} ${this._schemaItemId.name}: ${violations}`;
434
+ case SchemaTypeIdentifiers.CustomAttributeIdentifier:
435
+ return `Rule violations occurred from CustomAttribute ${this._customAttributeId.name}, container ${this._customAttributeId.containerFullName}: ${violations}`;
436
+ case SchemaTypeIdentifiers.RelationshipConstraintIdentifier:
437
+ return `Rule violations occurred from ${this._relationshipConstraintId.name} constraint of RelationshipClass ${this._relationshipConstraintId.relationshipKey.fullName}: ${violations}`;
438
+ default:
439
+ throw new Error("Invalid identifier.");
440
+ }
441
+ }
442
+ _createTaskErrorMessage() {
443
+ // Make sure we have an inner error or else it is not a task error
444
+ if (!this.innerError)
445
+ return "";
446
+ switch (this.identifier.typeIdentifier) {
447
+ case SchemaTypeIdentifiers.SchemaIdentifier:
448
+ case SchemaTypeIdentifiers.SchemaItemIdentifier:
449
+ case SchemaTypeIdentifiers.ClassIdentifier:
450
+ case SchemaTypeIdentifiers.RelationshipConstraintIdentifier:
451
+ return `While performing task '${ECEditingStatus[this.errorNumber]}' an error occurred editing ${this.identifier.typeIdentifier} ${this.identifier.name}.`;
452
+ case SchemaTypeIdentifiers.PropertyIdentifier:
453
+ return `While performing task '${ECEditingStatus[this.errorNumber]}' an error occurred editing ${this.identifier.typeIdentifier} ${this.identifier.fullName}.`;
454
+ default:
455
+ throw new Error("Invalid identifier.");
456
+ }
457
+ }
458
+ isSchemaItemIdentifier(identifier) {
459
+ if (identifier.typeIdentifier !== SchemaTypeIdentifiers.SchemaItemIdentifier &&
460
+ identifier.typeIdentifier !== SchemaTypeIdentifiers.ClassIdentifier)
461
+ return true;
462
+ return false;
463
+ }
464
+ }
465
+ function getEnumeratorType(enumeration, enumerator) {
466
+ if (typeof (enumerator) === "string") {
467
+ return enumeration.type ? primitiveTypeToString(enumeration.type) : "string";
468
+ }
469
+ return typeof (enumerator.value) === "string" ? "string" : "int";
470
+ }
471
+ //# sourceMappingURL=Exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/Editing/Exception.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAA6D,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAA0B,aAAa,EAA6B,MAAM,0BAA0B,CAAC;AAEvN,aAAa;AACb,MAAM,CAAN,IAAY,eAmFX;AAnFD,WAAY,eAAe;IACzB,4FAA+B,CAAA;IAC/B,2DAAW,CAAA;IACX,4EAAyC,CAAA;IACzC,8EAAc,CAAA;IACd,sFAAkB,CAAA;IAClB,wGAA2B,CAAA;IAC3B,4FAAqB,CAAA;IACrB,kFAAgB,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------------------------\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 Editing\n */\n\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\nimport { AnyEnumerator, CustomAttributeContainerProps, Enumeration, PrimitiveType, primitiveTypeToString, Property, RelationshipConstraint, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\n\n/** @alpha */\nexport enum ECEditingStatus {\n EC_EDITING_ERROR_BASE = 0x30000,\n Unknown = 0,\n RuleViolation = EC_EDITING_ERROR_BASE + 1,\n SchemaNotFound,\n SchemaItemNotFound,\n SchemaItemNotFoundInContext,\n PropertyAlreadyExists,\n PropertyNotFound,\n InvalidPropertyType,\n BaseClassIsNotElement,\n BaseClassIsNotElementUniqueAspect,\n BaseClassIsNotElementMultiAspect,\n SchemaItemNameNotSpecified,\n InvalidSchemaItemType,\n SchemaItemNameAlreadyExists,\n InvalidEnumeratorType,\n InvalidBaseClass,\n EnumeratorDoesNotExist,\n InvalidECName,\n InvalidSchemaAlias,\n InvalidFormatUnitsSpecified,\n SchemaAliasAlreadyExists,\n // Outer Errors\n CreateSchemaItemFailed,\n CreateSchemaItemFromProps,\n CreateElement,\n CreateElementUniqueAspect,\n CreateElementMultiAspect,\n SetBaseClass,\n SetSourceConstraint,\n SetTargetConstraint,\n AddConstraintClass,\n RemoveConstraintClass,\n SetAbstractConstraint,\n AddCustomAttributeToConstraint,\n AddCustomAttributeToProperty,\n AddCustomAttributeToClass,\n CreateNavigationProperty,\n CreateNavigationPropertyFromProps,\n SetInvertsUnit,\n SetUnitSystem,\n SetDescription,\n SetLabel,\n SetIsReadOnly,\n SetPriority,\n SetCategory,\n SetKindOfQuantity,\n SetMinOccurs,\n SetMaxOccurs,\n SetExtendedTypeName,\n SetMinLength,\n SetMaxLength,\n SetMinValue,\n SetMaxValue,\n SetPropertyName,\n AddMixin,\n AddEnumerator,\n SetEnumeratorLabel,\n SetEnumeratorDescription,\n AddPresentationUnit,\n AddPresentationOverride,\n CreateFormatOverride,\n SetPropertyCategoryPriority,\n CreatePrimitiveProperty,\n CreatePrimitivePropertyFromProps,\n CreateEnumerationProperty,\n CreateEnumerationPropertyFromProps,\n CreatePrimitiveArrayProperty,\n CreatePrimitiveArrayPropertyFromProps,\n CreateEnumerationArrayProperty,\n CreateEnumerationArrayPropertyFromProps,\n CreateStructProperty,\n CreateStructPropertyFromProps,\n CreateStructArrayProperty,\n CreateStructArrayPropertyFromProps,\n DeleteProperty,\n DeleteClass,\n SetClassName,\n AddSchemaReference,\n SetSchemaVersion,\n IncrementSchemaMinorVersion,\n SetSchemaAlias\n}\n\n/**\n * A type that constrains the possible error types handled by SchemaEditingError\n * @alpha\n */\nexport type AnyEditingError = SchemaEditingError | Error;\n\n/**\n * Defines the possible property type names.\n * @alpha\n */\nexport enum PropertyTypeName {\n ArrayProperty = \"ArrayProperty\",\n PrimitiveProperty = \"PrimitiveProperty\",\n EnumerationProperty = \"EnumerationProperty\",\n NavigationProperty = \"NavigationProperty\",\n StructProperty = \"StructProperty\"\n}\n\n/**\n * Defines the possible schema type identifiers.\n * @alpha\n */\nexport enum SchemaTypeIdentifiers {\n SchemaIdentifier = \"Schema\",\n SchemaItemIdentifier = \"SchemaItem\",\n ClassIdentifier = \"Class\",\n PropertyIdentifier = \"Property\",\n EnumeratorIdentifier = \"Enumerator\",\n CustomAttributeIdentifier = \"CustomAttribute\",\n RelationshipConstraintIdentifier = \"RelationshipConstraint\"\n}\n\n/**\n * Type that constrains SchemaItemType enum to those used by EC Class types.\n * @alpha\n */\nexport type ECClassSchemaItems = SchemaItemType.EntityClass | SchemaItemType.StructClass | SchemaItemType.RelationshipClass | SchemaItemType.Mixin | SchemaItemType.CustomAttributeClass;\n\n/**\n * Type that defines the possible SchemaTypeIdentifiers for SchemaItemId classes.\n * @alpha\n */\nexport type AnySchemaItemTypeIdentifier = SchemaTypeIdentifiers.SchemaItemIdentifier | SchemaTypeIdentifiers.ClassIdentifier;\n\n/**\n * Type that encompasses all ISchemaTypeIdentifier interfaces\n * @alpha\n */\nexport type AnyIdentifier = ISchemaIdentifier | ISchemaItemIdentifier | IClassIdentifier | IPropertyIdentifier | ICustomAttributeIdentifier | IRelationshipConstraintIdentifier | IEnumeratorIdentifier;\n\n/**\n * A base interface that defines what is needed to identity any schema type.\n * @alpha\n */\nexport interface ISchemaTypeIdentifier {\n readonly name: string;\n readonly schemaKey: SchemaKey;\n readonly typeIdentifier: SchemaTypeIdentifiers;\n}\n\n/**\n * Interface that defines the data needed to identify a Schema.\n * @alpha\n */\nexport interface ISchemaIdentifier extends ISchemaTypeIdentifier {\n readonly typeIdentifier: SchemaTypeIdentifiers.SchemaIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify a SchemaItem.\n * @alpha\n */\nexport interface ISchemaItemIdentifier extends ISchemaTypeIdentifier {\n readonly schemaItemType: SchemaItemType;\n readonly schemaItemKey: SchemaItemKey;\n readonly typeIdentifier: AnySchemaItemTypeIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify an EC Class.\n * @alpha\n */\nexport interface IClassIdentifier extends ISchemaTypeIdentifier {\n readonly schemaItemType: ECClassSchemaItems;\n readonly schemaItemKey: SchemaItemKey;\n readonly typeIdentifier: SchemaTypeIdentifiers.ClassIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify an EC Property.\n * @alpha\n */\nexport interface IPropertyIdentifier extends ISchemaTypeIdentifier {\n readonly fullName: string;\n readonly ecClass: ClassId;\n readonly typeName?: PropertyTypeName;\n readonly typeIdentifier: SchemaTypeIdentifiers.PropertyIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify an Enumerator.\n * @alpha\n */\ninterface IEnumeratorIdentifier extends ISchemaTypeIdentifier {\n readonly enumeratorType: string;\n readonly enumeration: SchemaItemKey;\n readonly enumerationType: string;\n readonly typeIdentifier: SchemaTypeIdentifiers.EnumeratorIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify a CustomAttribute.\n * @alpha\n */\nexport interface ICustomAttributeIdentifier extends ISchemaTypeIdentifier {\n readonly containerFullName: string;\n readonly typeIdentifier: SchemaTypeIdentifiers.CustomAttributeIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify a RelationshipConstraint.\n * @alpha\n */\nexport interface IRelationshipConstraintIdentifier extends ISchemaTypeIdentifier {\n readonly relationshipKey: SchemaItemKey;\n readonly typeIdentifier: SchemaTypeIdentifiers.RelationshipConstraintIdentifier;\n}\n\n/**\n * An ISchemaIdentifier implementation to identify Schemas\n * @alpha\n */\nexport class SchemaId implements ISchemaIdentifier {\n public readonly typeIdentifier = SchemaTypeIdentifiers.SchemaIdentifier;\n public readonly name: string;\n public readonly schemaKey: SchemaKey;\n constructor(schemaKey: SchemaKey) {\n this.name = schemaKey.name;\n this.schemaKey = schemaKey;\n }\n}\n\n/**\n * An ISchemItemIdentifier implementation to identify SchemaItems\n * @alpha\n */\nexport class SchemaItemId implements ISchemaItemIdentifier {\n public readonly typeIdentifier: AnySchemaItemTypeIdentifier;\n public readonly name: string;\n public readonly schemaKey: SchemaKey;\n public readonly schemaItemType: SchemaItemType;\n public readonly schemaItemKey: SchemaItemKey;\n\n constructor(schemaItemType: SchemaItemType, schemaItemKeyOrName: SchemaItemKey | string, schemaKey?: SchemaKey) {\n if (typeof(schemaItemKeyOrName) === \"string\") {\n if (!schemaKey)\n throw new Error(\"schemaKey if required if the specified schemaItem the name of the schema item.\");\n\n this.schemaKey = schemaKey!;\n this.schemaItemKey = new SchemaItemKey(schemaItemKeyOrName, schemaKey);\n } else {\n this.schemaKey = schemaItemKeyOrName.schemaKey;\n this.schemaItemKey = schemaItemKeyOrName;\n }\n\n this.schemaItemType = schemaItemType;\n this.name = this.schemaItemKey.fullName;\n this.typeIdentifier = SchemaTypeIdentifiers.SchemaItemIdentifier;\n }\n}\n\n/**\n * An IClassIdentifier implementation to identify Class instances.\n * @alpha\n */\nexport class ClassId extends SchemaItemId implements IClassIdentifier {\n public override readonly typeIdentifier = SchemaTypeIdentifiers.ClassIdentifier;\n public override readonly schemaItemType: ECClassSchemaItems;\n constructor(schemaItemType: ECClassSchemaItems, schemaItemKeyOrName: SchemaItemKey | string, schemaKey?: SchemaKey) {\n super(schemaItemType, schemaItemKeyOrName, schemaKey);\n this.schemaItemType = schemaItemType;\n }\n}\n\n/**\n * An IPropertyIdentifier implementation to identify Property instances.\n * @alpha\n */\nexport class PropertyId implements IPropertyIdentifier {\n public readonly typeIdentifier = SchemaTypeIdentifiers.PropertyIdentifier;\n public readonly name: string;\n public readonly fullName: string;\n public readonly ecClass: ClassId;\n public readonly schemaKey: SchemaKey;\n public readonly typeName?: PropertyTypeName;\n\n constructor(schemaItemType: ECClassSchemaItems, classKey: SchemaItemKey, property: Property | string, typeName?: PropertyTypeName) {\n this.name = property instanceof Property ? property.name : property;\n this.fullName = property instanceof Property ? property.fullName : `${classKey.name}.${property}`;\n this.ecClass = new ClassId(schemaItemType, classKey);\n this.schemaKey = classKey.schemaKey;\n this.typeName = typeName;\n }\n}\n\n/**\n * An IEnumeratorIdentifier implementation to identify Enumerator instances.\n * @alpha\n */\nexport class EnumeratorId implements IEnumeratorIdentifier{\n public readonly typeIdentifier = SchemaTypeIdentifiers.EnumeratorIdentifier;\n public readonly enumeration: SchemaItemKey;\n public readonly enumerationType: string;\n public readonly enumeratorType: string;\n public readonly name: string;\n public readonly schemaKey: SchemaKey;\n\n constructor(enumerator: AnyEnumerator | string, enumeration: Enumeration) {\n this.enumeration = enumeration.key;\n this.enumerationType = enumeration.type ? primitiveTypeToString(enumeration.type): \"string\";\n this.enumeratorType = getEnumeratorType(enumeration ?? PrimitiveType.String, enumerator);\n this.name = typeof(enumerator) === \"string\" ? enumerator : enumerator.name;\n this.schemaKey = enumeration.schema.schemaKey;\n }\n}\n\n/**\n * An ICustomAttributeIdentifier implementation to identify CustomAttribute instances.\n * @alpha\n */\nexport class CustomAttributeId implements ICustomAttributeIdentifier {\n public readonly typeIdentifier = SchemaTypeIdentifiers.CustomAttributeIdentifier;\n public readonly name: string;\n public readonly schemaKey: SchemaKey;\n public readonly containerFullName: string;\n constructor(name: string, container: CustomAttributeContainerProps) {\n this.name = name;\n this.schemaKey = container.schema.schemaKey;\n this.containerFullName = container.fullName;\n }\n}\n\n/**\n * An IRelationshipConstraintIdentifier implementation to identify RelationshipConstraints.\n * @alpha\n */\nexport class RelationshipConstraintId implements IRelationshipConstraintIdentifier {\n public readonly typeIdentifier = SchemaTypeIdentifiers.RelationshipConstraintIdentifier;\n public readonly name: string;\n public readonly relationshipKey: SchemaItemKey;\n public readonly schemaKey: SchemaKey;\n constructor(constraint: RelationshipConstraint) {\n this.name = constraint.isSource ? \"Source\" : \"Target\";\n this.relationshipKey = constraint.relationshipClass.key;\n this.schemaKey = this.relationshipKey.schemaKey;\n }\n}\n\n/**\n * An exception class for the ecschema-editing API. Contains identifiers for schema types involved in the\n * exception. An example being SchemaItemId which contains the name of the SchemaItem, SchemaItemKey, SchemaItemType, etc.\n * Typically will contain an innerError of type SchemaEditingError containing the identifier of the schema item that\n * caused the exception. The containing error instance will identify the method called (identified by the errorNumber)\n * and the identifier of the schema item being modified/created.\n * @alpha\n */\nexport class SchemaEditingError extends Error {\n private _ruleViolations?: AnyDiagnostic[];\n private _schemaKey: SchemaKey;\n\n /**\n * Constructs a new SchemaEditingError instance.\n * @param errorNumber The unique ECEditingStatus code identifying the error.\n * @param identifier The identifier instance containing information about the EC object involved with the exception.\n * @param innerError The SchemaEditingError containing the identifier of the EC object that caused the initial exception.\n * @param ruleViolations Will contain EC rule violations of type [[AnyDiagnostic]] for exceptions with the error code ECEditingStatus.RuleViolation.\n * @param message Optional error message. Most messages on automatically generated by this class based on the ECEditingStatus code.\n */\n public constructor(public readonly errorNumber: ECEditingStatus, public readonly identifier: AnyIdentifier, public readonly innerError?: AnyEditingError, ruleViolations?: AnyDiagnostic[], message?: string) {\n super(message);\n this._ruleViolations = ruleViolations;\n this._schemaKey = identifier.schemaKey,\n this.generateMessage();\n }\n\n /**\n * Gets the SchemaId instance.\n * @throws Error if the identifier is not an instance of SchemaId.\n */\n private get _schemaId(): SchemaId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.SchemaIdentifier)\n throw new Error(\"identifier is not a SchemaId.\");\n return this.identifier as SchemaId;\n }\n\n /**\n * Gets the SchemaItemId instance.\n * @throws Error if the identifier is not an instance of SchemaItemId.\n */\n private get _schemaItemId(): SchemaItemId {\n if (this.isSchemaItemIdentifier(this.identifier))\n throw new Error(\"identifier is not a SchemaItemId.\");\n return this.identifier as SchemaItemId;\n }\n\n /**\n * Gets the ClassId instance.\n * @throws Error if the identifier is not an instance of ClassId.\n */\n private get _classId(): ClassId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.ClassIdentifier)\n throw new Error(\"identifier is not a ClassId.\");\n return this.identifier as ClassId;\n }\n\n /**\n * Gets the PropertyId instance.\n * @throws Error if the identifier is not an instance of PropertyId.\n */\n private get _propertyId(): PropertyId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.PropertyIdentifier)\n throw new Error(\"identifier is not a PropertyId.\");\n return this.identifier;\n }\n\n /**\n * Gets the EnumeratorId instance.\n * @throws Error if the identifier is not an instance of EnumeratorId.\n */\n private get _enumeratorId(): EnumeratorId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.EnumeratorIdentifier)\n throw new Error(\"identifier is not a EnumerationId.\");\n return this.identifier as EnumeratorId;\n }\n\n /**\n * Gets the CustomAttributeId instance.\n * @throws Error if the identifier is not an instance of CustomAttributeId.\n */\n private get _customAttributeId(): CustomAttributeId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.CustomAttributeIdentifier)\n throw new Error(\"identifier is not a CustomAttributeId.\");\n return this.identifier;\n }\n\n /**\n * Gets the RelationshipConstraintId instance.\n * @throws Error if the identifier is not an instance of RelationshipConstraintId.\n */\n private get _relationshipConstraintId(): RelationshipConstraintId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.RelationshipConstraintIdentifier)\n throw new Error(\"identifier is not a RelationshipConstraintId.\");\n return this.identifier;\n }\n\n /** Gets rule violations that were reported during validation. Returns an array of [[AnyDiagnostic]] if\n * the errorNumber is ECEditingStatus.RuleViolation, otherwise undefined.\n */\n public get ruleViolations(): AnyDiagnostic[] | undefined {\n return this._ruleViolations;\n }\n\n /**\n * Returns a readable string containing the ECEditingStatus along with the error message. Any\n * innerError will also be appended.\n * @returns\n */\n public toDebugString(): string {\n let innerMessage = \"\";\n if (this.innerError) {\n if (this.innerError instanceof SchemaEditingError)\n innerMessage = ` Inner error: ${this.innerError.toDebugString()}`;\n else\n innerMessage = ` Inner error: ${this.innerError.message}`;\n }\n return this._appendMessage(`ECEditingStatus.${ECEditingStatus[this.errorNumber]}`) + innerMessage;\n }\n\n private generateMessage() {\n if (this.message)\n return;\n\n switch(this.errorNumber) {\n case ECEditingStatus.SchemaNotFound:\n this.message = `Schema Key ${this._schemaKey.toString(true)} could not be found in the context.`;\n return;\n case ECEditingStatus.SchemaItemNotFound:\n this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} could not be found in the schema ${this._schemaKey.name}.`;\n return;\n case ECEditingStatus.SchemaItemNotFoundInContext:\n this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} could not be found in the schema context.`;\n return;\n case ECEditingStatus.InvalidSchemaItemType:\n this.message = `Expected ${this._schemaItemId.name} to be of type ${this._schemaItemId.schemaItemType}.`;\n return;\n case ECEditingStatus.SchemaItemNameNotSpecified:\n this.message = `Could not create a new ${this._schemaItemId.schemaItemType} in schema ${this._schemaKey.name}. No name was supplied within props.`;\n return;\n case ECEditingStatus.SchemaItemNameAlreadyExists:\n this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} already exists in the schema ${this._schemaKey.name}.`;\n return;\n case ECEditingStatus.RuleViolation:\n this.message = this._getRuleViolationMessage();\n return;\n case ECEditingStatus.PropertyNotFound:\n this.message = `An ECProperty with the name ${this._propertyId.name} could not be found in the class ${this._propertyId.ecClass.name}.`;\n return;\n case ECEditingStatus.PropertyAlreadyExists:\n this.message = `An ECProperty with the name ${this._propertyId.name} already exists in the class ${this._propertyId.ecClass.name}.`;\n return;\n case ECEditingStatus.InvalidPropertyType:\n this.message = `Expected property ${this._propertyId.name} to be of type ${this._propertyId.typeName}.`;\n return;\n case ECEditingStatus.BaseClassIsNotElement:\n this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.Element.`;\n return;\n case ECEditingStatus.BaseClassIsNotElementUniqueAspect:\n this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.ElementUniqueAspect.`;\n return;\n case ECEditingStatus.BaseClassIsNotElementMultiAspect:\n this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.ElementMultiAspect.`;\n return;\n case ECEditingStatus.InvalidFormatUnitsSpecified:\n this.message = `The specified Format unit ${this._schemaItemId.name} is not of type Unit or InvertedUnit`;\n return;\n case ECEditingStatus.InvalidEnumeratorType:\n this.message = `The Enumeration ${this._enumeratorId.enumeration.fullName} has type ${this._enumeratorId.enumerationType}, while Enumerator ${this._enumeratorId.name} has type ${this._enumeratorId.enumeratorType}.`;\n return;\n case ECEditingStatus.EnumeratorDoesNotExist:\n this.message = `Enumerator ${this._enumeratorId.name} does not exists in Enumeration ${this._enumeratorId.enumeration.name}.`;\n return;\n case ECEditingStatus.InvalidECName:\n this.message = `Could not rename class ${this._schemaItemId.name} because the specified name is not a valid ECName.`;\n return;\n case ECEditingStatus.InvalidSchemaAlias:\n this.message = `Could not set the alias for schema ${this._schemaKey.name} because the specified alias is not a valid ECName.`;\n return;\n default:\n this.message = this._createTaskErrorMessage();\n }\n }\n\n private _appendMessage(e: string) {\n return this.message ? `${e}: ${this.message}` : e;\n }\n\n private _getRuleViolationMessage(): string {\n if (!this._ruleViolations)\n return \"\";\n\n let violations = \"\";\n for (const diagnostic of this._ruleViolations) {\n violations += `${diagnostic.code}: ${diagnostic.messageText}\\r\\n`;\n }\n\n switch (this.identifier.typeIdentifier) {\n case SchemaTypeIdentifiers.SchemaIdentifier:\n return `Rule violations occurred from Schema ${this._schemaId.name}: ${violations}`;\n case SchemaTypeIdentifiers.SchemaItemIdentifier:\n return `Rule violations occurred from ${this._schemaItemId.schemaItemType} ${this._schemaItemId.name}: ${violations}`;\n case SchemaTypeIdentifiers.ClassIdentifier:\n return `Rule violations occurred from ${this._schemaItemId.schemaItemType} ${this._schemaItemId.name}: ${violations}`;\n case SchemaTypeIdentifiers.CustomAttributeIdentifier:\n return `Rule violations occurred from CustomAttribute ${this._customAttributeId.name}, container ${this._customAttributeId.containerFullName}: ${violations}`;\n case SchemaTypeIdentifiers.RelationshipConstraintIdentifier:\n return `Rule violations occurred from ${this._relationshipConstraintId.name} constraint of RelationshipClass ${this._relationshipConstraintId.relationshipKey.fullName}: ${violations}`;\n default:\n throw new Error (\"Invalid identifier.\");\n }\n }\n\n private _createTaskErrorMessage() {\n // Make sure we have an inner error or else it is not a task error\n if (!this.innerError)\n return \"\";\n\n switch (this.identifier.typeIdentifier) {\n case SchemaTypeIdentifiers.SchemaIdentifier:\n case SchemaTypeIdentifiers.SchemaItemIdentifier:\n case SchemaTypeIdentifiers.ClassIdentifier:\n case SchemaTypeIdentifiers.RelationshipConstraintIdentifier:\n return `While performing task '${ECEditingStatus[this.errorNumber]}' an error occurred editing ${this.identifier.typeIdentifier} ${this.identifier.name}.`;\n case SchemaTypeIdentifiers.PropertyIdentifier:\n return `While performing task '${ECEditingStatus[this.errorNumber]}' an error occurred editing ${this.identifier.typeIdentifier} ${this.identifier.fullName}.`;\n default:\n throw new Error (\"Invalid identifier.\");\n }\n }\n\n private isSchemaItemIdentifier(identifier: AnyIdentifier) {\n if (identifier.typeIdentifier !== SchemaTypeIdentifiers.SchemaItemIdentifier &&\n identifier.typeIdentifier !== SchemaTypeIdentifiers.ClassIdentifier)\n return true;\n\n return false;\n }\n}\n\nfunction getEnumeratorType(enumeration: Enumeration, enumerator: AnyEnumerator | string) {\n if (typeof(enumerator) === \"string\") {\n return enumeration.type ? primitiveTypeToString(enumeration.type) : \"string\";\n }\n\n return typeof(enumerator.value) === \"string\" ? \"string\" : \"int\";\n}\n"]}
@@ -0,0 +1,23 @@
1
+ /** @packageDocumentation
2
+ * @module Editing
3
+ */
4
+ import { Format, SchemaItemFormatProps, SchemaItemKey, SchemaKey } from "@itwin/ecschema-metadata";
5
+ import { FormatType } from "@itwin/core-quantity";
6
+ import { SchemaContextEditor } from "./Editor";
7
+ import { SchemaItems } from "./SchemaItems";
8
+ /**
9
+ * @alpha
10
+ * A class allowing you to create schema items of type Format.
11
+ */
12
+ export declare class Formats extends SchemaItems {
13
+ protected get itemTypeClass(): typeof Format;
14
+ constructor(schemaEditor: SchemaContextEditor);
15
+ create(schemaKey: SchemaKey, name: string, formatType: FormatType, displayLabel?: string, units?: SchemaItemKey[]): Promise<SchemaItemKey>;
16
+ /**
17
+ * Creates a format through a SchemaItemFormatProps.
18
+ * @param schemaKey a SchemaKey of the Schema that will house the new object.
19
+ * @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.
20
+ */
21
+ createFromProps(schemaKey: SchemaKey, formatProps: SchemaItemFormatProps): Promise<SchemaItemKey>;
22
+ }
23
+ //# sourceMappingURL=Formats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Formats.d.ts","sourceRoot":"","sources":["../../../src/Editing/Formats.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAgB,qBAAqB,EAAE,aAAa,EAAkB,SAAS,EAAQ,MAAM,0BAA0B,CAAC;AACvI,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,qBAAa,OAAQ,SAAQ,WAAW;IACtC,cAAuB,aAAa,IAAI,OAAO,MAAM,CAEpD;gBAEkB,YAAY,EAAE,mBAAmB;IAIvC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IA8BvJ;;;;OAIG;IACU,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC;CAQ/G"}
@@ -0,0 +1,62 @@
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 Editing
7
+ */
8
+ import { Format, InvertedUnit, SchemaItemType, Unit } from "@itwin/ecschema-metadata";
9
+ import { ECEditingStatus, SchemaEditingError, SchemaItemId } from "./Exception";
10
+ import { SchemaItems } from "./SchemaItems";
11
+ /**
12
+ * @alpha
13
+ * A class allowing you to create schema items of type Format.
14
+ */
15
+ export class Formats extends SchemaItems {
16
+ get itemTypeClass() {
17
+ return Format;
18
+ }
19
+ constructor(schemaEditor) {
20
+ super(SchemaItemType.Format, schemaEditor);
21
+ }
22
+ async create(schemaKey, name, formatType, displayLabel, units) {
23
+ try {
24
+ const newFormat = await this.createSchemaItem(schemaKey, this.schemaItemType, (schema) => schema.createFormat.bind(schema), name);
25
+ if (units !== undefined) {
26
+ for (const unit of units) {
27
+ const unitItem = await this.schemaEditor.schemaContext.getSchemaItem(unit);
28
+ if (!unitItem) {
29
+ throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFoundInContext, new SchemaItemId(SchemaItemType.Unit, unit));
30
+ }
31
+ if (!Unit.isUnit(unitItem) && !InvertedUnit.isInvertedUnit(unitItem)) {
32
+ throw new SchemaEditingError(ECEditingStatus.InvalidFormatUnitsSpecified, new SchemaItemId(unitItem.schemaItemType, unitItem.key));
33
+ }
34
+ newFormat.addUnit(unitItem);
35
+ }
36
+ }
37
+ if (displayLabel)
38
+ newFormat.setDisplayLabel(displayLabel);
39
+ // TODO: Handle the setting of format traits, separators, etc....
40
+ newFormat.setFormatType(formatType);
41
+ return newFormat.key;
42
+ }
43
+ catch (e) {
44
+ throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);
45
+ }
46
+ }
47
+ /**
48
+ * Creates a format through a SchemaItemFormatProps.
49
+ * @param schemaKey a SchemaKey of the Schema that will house the new object.
50
+ * @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.
51
+ */
52
+ async createFromProps(schemaKey, formatProps) {
53
+ try {
54
+ const newFormat = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createFormat.bind(schema), formatProps);
55
+ return newFormat.key;
56
+ }
57
+ catch (e) {
58
+ throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, formatProps.name, schemaKey), e);
59
+ }
60
+ }
61
+ }
62
+ //# sourceMappingURL=Formats.js.map