@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,415 @@
1
+ import { DelayedPromiseWithProps, ECClass, ECName, EnumerationProperty, KindOfQuantity, NavigationProperty, PrimitiveProperty, PropertyCategory, StructProperty } from "@itwin/ecschema-metadata";
2
+ import { assert } from "@itwin/core-bentley";
3
+ import * as Rules from "../Validation/ECRules";
4
+ import { ClassId, CustomAttributeId, ECEditingStatus, PropertyId, PropertyTypeName, SchemaEditingError, SchemaId } from "./Exception";
5
+ /**
6
+ * @alpha
7
+ * A class allowing editing of attributes of the base Property class.
8
+ */
9
+ export class Properties {
10
+ ecClassType;
11
+ _schemaEditor;
12
+ constructor(ecClassType, _schemaEditor) {
13
+ this.ecClassType = ecClassType;
14
+ this._schemaEditor = _schemaEditor;
15
+ }
16
+ async setName(classKey, propertyName, newPropertyName) {
17
+ let newName;
18
+ try {
19
+ newName = new ECName(newPropertyName);
20
+ }
21
+ catch {
22
+ throw new SchemaEditingError(ECEditingStatus.SetPropertyName, new PropertyId(this.ecClassType, classKey, propertyName), new SchemaEditingError(ECEditingStatus.InvalidECName, new PropertyId(this.ecClassType, classKey, newPropertyName)));
23
+ }
24
+ const existingProperty = await this.getProperty(classKey, propertyName)
25
+ .catch((e) => {
26
+ throw new SchemaEditingError(ECEditingStatus.SetPropertyName, new PropertyId(this.ecClassType, classKey, propertyName), e);
27
+ });
28
+ const baseProperty = await existingProperty.class.getProperty(newPropertyName, true);
29
+ if (baseProperty) {
30
+ throw new SchemaEditingError(ECEditingStatus.SetPropertyName, new PropertyId(this.ecClassType, classKey, propertyName), new SchemaEditingError(ECEditingStatus.PropertyAlreadyExists, new PropertyId(this.ecClassType, baseProperty.class.key, newPropertyName)));
31
+ }
32
+ // Handle derived classes
33
+ const derivedProperties = [];
34
+ const derivedClasses = await this.findDerivedClasses(existingProperty.class);
35
+ for (const derivedClass of derivedClasses) {
36
+ if (await derivedClass.getProperty(newPropertyName)) {
37
+ throw new SchemaEditingError(ECEditingStatus.SetPropertyName, new PropertyId(this.ecClassType, classKey, propertyName), new SchemaEditingError(ECEditingStatus.PropertyAlreadyExists, new PropertyId(this.ecClassType, derivedClass.key, newPropertyName)));
38
+ }
39
+ const propertyOverride = await derivedClass.getProperty(propertyName);
40
+ // If found the property is overridden in the derived class.
41
+ if (propertyOverride)
42
+ derivedProperties.push(propertyOverride);
43
+ }
44
+ // Re-name the overridden property in all derived classes
45
+ derivedProperties.forEach((prop) => {
46
+ prop.setName(newName);
47
+ });
48
+ existingProperty.setName(newName);
49
+ }
50
+ /**
51
+ * Sets the property description.
52
+ * @param classKey The SchemaItemKey of the class.
53
+ * @param propertyName The name of the property.
54
+ * @param description The new description to set.
55
+ */
56
+ async setDescription(classKey, propertyName, description) {
57
+ const property = await this.getProperty(classKey, propertyName)
58
+ .catch((e) => {
59
+ throw new SchemaEditingError(ECEditingStatus.SetDescription, new PropertyId(this.ecClassType, classKey, propertyName), e);
60
+ });
61
+ property.setDescription(description);
62
+ }
63
+ /**
64
+ * Sets the property label.
65
+ * @param classKey The SchemaItemKey of the class.
66
+ * @param propertyName The name of the property.
67
+ * @param label The new label to set.
68
+ */
69
+ async setLabel(classKey, propertyName, label) {
70
+ const property = await this.getProperty(classKey, propertyName)
71
+ .catch((e) => {
72
+ throw new SchemaEditingError(ECEditingStatus.SetLabel, new PropertyId(this.ecClassType, classKey, propertyName), e);
73
+ });
74
+ property.setLabel(label);
75
+ }
76
+ /**
77
+ * Sets the property isReadOnly attribute.
78
+ * @param classKey The SchemaItemKey of the class.
79
+ * @param propertyName The name of the property.
80
+ * @param isReadOnly The new isReadOnly value.
81
+ */
82
+ async setIsReadOnly(classKey, propertyName, isReadOnly) {
83
+ const property = await this.getProperty(classKey, propertyName)
84
+ .catch((e) => {
85
+ throw new SchemaEditingError(ECEditingStatus.SetIsReadOnly, new PropertyId(this.ecClassType, classKey, propertyName), e);
86
+ });
87
+ property.setIsReadOnly(isReadOnly);
88
+ }
89
+ /**
90
+ * Sets the property priority.
91
+ * @param classKey The SchemaItemKey of the class.
92
+ * @param propertyName The name of the property.
93
+ * @param priority The new priority.
94
+ */
95
+ async setPriority(classKey, propertyName, priority) {
96
+ const property = await this.getProperty(classKey, propertyName)
97
+ .catch((e) => {
98
+ throw new SchemaEditingError(ECEditingStatus.SetPriority, new PropertyId(this.ecClassType, classKey, propertyName), e);
99
+ });
100
+ property.setPriority(priority);
101
+ }
102
+ /**
103
+ * Sets the property category.
104
+ * @param classKey The SchemaItemKey of the class.
105
+ * @param propertyName The name of the property.
106
+ * @param categoryKey The SchemaItemKey of the property category.
107
+ */
108
+ async setCategory(classKey, propertyName, categoryKey) {
109
+ const property = await this.getProperty(classKey, propertyName)
110
+ .catch((e) => {
111
+ throw new SchemaEditingError(ECEditingStatus.SetCategory, new PropertyId(this.ecClassType, classKey, propertyName), e);
112
+ });
113
+ const category = await this._schemaEditor.getSchemaItem(categoryKey, PropertyCategory)
114
+ .catch((e) => {
115
+ throw new SchemaEditingError(ECEditingStatus.SetCategory, new PropertyId(this.ecClassType, classKey, propertyName), e);
116
+ });
117
+ property.setCategory(new DelayedPromiseWithProps(categoryKey, async () => category));
118
+ }
119
+ /**
120
+ * Sets the KindOfQuantity of a property.
121
+ * @param classKey The SchemaItemKey of the class.
122
+ * @param propertyName The name of the property.
123
+ * @param kindOfQuantityKey The SchemaItemKey of the KindOfQuantity.
124
+ */
125
+ async setKindOfQuantity(classKey, propertyName, kindOfQuantityKey) {
126
+ const property = await this.getProperty(classKey, propertyName)
127
+ .catch((e) => {
128
+ throw new SchemaEditingError(ECEditingStatus.SetKindOfQuantity, new PropertyId(this.ecClassType, classKey, propertyName), e);
129
+ });
130
+ const koq = await this._schemaEditor.getSchemaItem(kindOfQuantityKey, KindOfQuantity)
131
+ .catch((e) => {
132
+ throw new SchemaEditingError(ECEditingStatus.SetKindOfQuantity, new PropertyId(this.ecClassType, classKey, propertyName), e);
133
+ });
134
+ const currentKoq = await property.kindOfQuantity;
135
+ if (currentKoq && currentKoq.persistenceUnit && koq.persistenceUnit && !currentKoq.persistenceUnit.matchesFullName(koq.persistenceUnit.fullName)) {
136
+ throw new SchemaEditingError(ECEditingStatus.SetKindOfQuantity, new PropertyId(this.ecClassType, classKey, propertyName), undefined, undefined, "KindOfQuantity can only be changed if it has the same persistence unit as the property.");
137
+ }
138
+ property.setKindOfQuantity(new DelayedPromiseWithProps(kindOfQuantityKey, async () => koq));
139
+ }
140
+ /**
141
+ * Adds a CustomAttribute instance to the Property identified by the given SchemaItemKey and property name.
142
+ * @param classKey The SchemaItemKey identifying the class.
143
+ * @param propertyName The name of the property.
144
+ * @param customAttribute The CustomAttribute instance to add.
145
+ */
146
+ async addCustomAttribute(classKey, propertyName, customAttribute) {
147
+ const property = await this.getProperty(classKey, propertyName)
148
+ .catch((e) => {
149
+ throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToProperty, new PropertyId(this.ecClassType, classKey, propertyName), e);
150
+ });
151
+ property.addCustomAttribute(customAttribute);
152
+ const diagnosticsIterable = Rules.validateCustomAttributeInstance(property, customAttribute);
153
+ const diagnostics = [];
154
+ for await (const diagnostic of diagnosticsIterable) {
155
+ diagnostics.push(diagnostic);
156
+ }
157
+ if (diagnostics.length > 0) {
158
+ this.removeCustomAttribute(property, customAttribute);
159
+ throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToProperty, new PropertyId(this.ecClassType, classKey, propertyName), new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, property)));
160
+ }
161
+ }
162
+ /**
163
+ * Removes a CustomAttribute from a property.
164
+ * @param container
165
+ * @param customAttribute
166
+ */
167
+ removeCustomAttribute(container, customAttribute) {
168
+ assert(container.customAttributes !== undefined);
169
+ const map = container.customAttributes;
170
+ map.delete(customAttribute.className);
171
+ }
172
+ /**
173
+ * Gets the property with the specified name from the class identified by the given key.
174
+ * @param classKey The SchemaItemKey of the class.
175
+ * @param propertyName The name of the property to retrieve.
176
+ */
177
+ async getProperty(classKey, propertyName) {
178
+ const mutableClass = await this.getClass(classKey);
179
+ const property = await mutableClass.getProperty(propertyName);
180
+ if (property === undefined) {
181
+ throw new SchemaEditingError(ECEditingStatus.PropertyNotFound, new PropertyId(mutableClass.schemaItemType, classKey, propertyName));
182
+ }
183
+ return property;
184
+ }
185
+ async findDerivedClasses(mutableClass) {
186
+ const derivedClasses = [];
187
+ for (const schemaItem of this._schemaEditor.schemaContext.getSchemaItems()) {
188
+ if (ECClass.isECClass(schemaItem) && await schemaItem.is(mutableClass)) {
189
+ if (!mutableClass.key.matches(schemaItem.key)) {
190
+ derivedClasses.push(schemaItem);
191
+ }
192
+ }
193
+ }
194
+ return derivedClasses;
195
+ }
196
+ async getClass(classKey) {
197
+ const schema = await this._schemaEditor.getSchema(classKey.schemaKey);
198
+ if (schema === undefined)
199
+ throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(classKey.schemaKey));
200
+ const ecClass = await schema.getItem(classKey.name);
201
+ if (ecClass === undefined)
202
+ throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new ClassId(this.ecClassType, classKey));
203
+ if (ecClass.schemaItemType !== this.ecClassType) {
204
+ throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new ClassId(this.ecClassType, classKey));
205
+ }
206
+ return ecClass;
207
+ }
208
+ }
209
+ /**
210
+ * @alpha
211
+ * A class extending Properties allowing editing of attributes of PrimitiveArrayProperty,
212
+ * EnumerationArrayProperty and StructArrayProperty.
213
+ */
214
+ export class ArrayProperties extends Properties {
215
+ constructor(ecClassType, _schemaEditor) {
216
+ super(ecClassType, _schemaEditor);
217
+ }
218
+ /**
219
+ * Sets the array property minOccurs attribute.
220
+ * @param classKey The SchemaItemKey of the class.
221
+ * @param propertyName The name of the property.
222
+ * @param minOccurs The new minOccurs value.
223
+ */
224
+ async setMinOccurs(classKey, propertyName, minOccurs) {
225
+ const property = await this.getProperty(classKey, propertyName)
226
+ .catch((e) => {
227
+ throw new SchemaEditingError(ECEditingStatus.SetMinOccurs, new PropertyId(this.ecClassType, classKey, propertyName), e);
228
+ });
229
+ property.setMinOccurs(minOccurs);
230
+ }
231
+ /**
232
+ * Sets the array property maxOccurs attribute.
233
+ * @param classKey The SchemaItemKey of the class.
234
+ * @param propertyName The name of the property.
235
+ * @param maxOccurs The new maxOccurs value.
236
+ */
237
+ async setMaxOccurs(classKey, propertyName, maxOccurs) {
238
+ const property = await this.getProperty(classKey, propertyName)
239
+ .catch((e) => {
240
+ throw new SchemaEditingError(ECEditingStatus.SetMaxOccurs, new PropertyId(this.ecClassType, classKey, propertyName), e);
241
+ });
242
+ property.setMaxOccurs(maxOccurs);
243
+ }
244
+ /**
245
+ * Override to validate that the found property is an ArrayProperty.
246
+ * @param classKey The SchemaItemKey of the class.
247
+ * @param propertyName The name of the property.
248
+ */
249
+ async getProperty(classKey, propertyName) {
250
+ const property = await super.getProperty(classKey, propertyName);
251
+ if (!property.isArray()) {
252
+ throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.ArrayProperty));
253
+ }
254
+ return property;
255
+ }
256
+ }
257
+ /**
258
+ * @alpha
259
+ * A class extending Properties allowing editing of attributes of PrimitiveProperty and EnumerationProperty.
260
+ */
261
+ class PrimitiveOrEnumProperties extends Properties {
262
+ constructor(ecClassType, _schemaEditor) {
263
+ super(ecClassType, _schemaEditor);
264
+ }
265
+ /**
266
+ * Sets the extendedTypeName attribute value.
267
+ * @param classKey The SchemaItemKey of the class.
268
+ * @param propertyName The name of the property.
269
+ * @param extendedTypeName The extended type name of the property.
270
+ */
271
+ async setExtendedTypeName(classKey, propertyName, extendedTypeName) {
272
+ const property = await this.getProperty(classKey, propertyName)
273
+ .catch((e) => {
274
+ throw new SchemaEditingError(ECEditingStatus.SetExtendedTypeName, new PropertyId(this.ecClassType, classKey, propertyName), e);
275
+ });
276
+ property.setExtendedTypeName(extendedTypeName);
277
+ }
278
+ /**
279
+ * Sets the minLength attribute value.
280
+ * @param classKey The SchemaItemKey of the class.
281
+ * @param propertyName The name of the property.
282
+ * @param minLength The minimum length of the property.
283
+ */
284
+ async setMinLength(classKey, propertyName, minLength) {
285
+ const property = await this.getProperty(classKey, propertyName)
286
+ .catch((e) => {
287
+ throw new SchemaEditingError(ECEditingStatus.SetMinLength, new PropertyId(this.ecClassType, classKey, propertyName), e);
288
+ });
289
+ property.setMinLength(minLength);
290
+ }
291
+ /**
292
+ * Sets the maxLength attribute value.
293
+ * @param classKey The SchemaItemKey of the class.
294
+ * @param propertyName The name of the property.
295
+ * @param maxLength The maximum length of the property.
296
+ */
297
+ async setMaxLength(classKey, propertyName, maxLength) {
298
+ const property = await this.getProperty(classKey, propertyName)
299
+ .catch((e) => {
300
+ throw new SchemaEditingError(ECEditingStatus.SetMaxLength, new PropertyId(this.ecClassType, classKey, propertyName), e);
301
+ });
302
+ property.setMaxLength(maxLength);
303
+ }
304
+ /**
305
+ * Sets the minValue attribute value.
306
+ * @param classKey The SchemaItemKey of the class.
307
+ * @param propertyName The name of the property.
308
+ * @param minValue The minimum value of the property.
309
+ */
310
+ async setMinValue(classKey, propertyName, minValue) {
311
+ const property = await this.getProperty(classKey, propertyName)
312
+ .catch((e) => {
313
+ throw new SchemaEditingError(ECEditingStatus.SetMinValue, new PropertyId(this.ecClassType, classKey, propertyName), e);
314
+ });
315
+ property.setMinValue(minValue);
316
+ }
317
+ /**
318
+ * Sets the maxValue attribute value.
319
+ * @param classKey The SchemaItemKey of the class.
320
+ * @param propertyName The name of the property.
321
+ * @param maxValue The maximum value of the property.
322
+ */
323
+ async setMaxValue(classKey, propertyName, maxValue) {
324
+ const property = await this.getProperty(classKey, propertyName)
325
+ .catch((e) => {
326
+ throw new SchemaEditingError(ECEditingStatus.SetMaxValue, new PropertyId(this.ecClassType, classKey, propertyName), e);
327
+ });
328
+ property.setMaxValue(maxValue);
329
+ }
330
+ }
331
+ /**
332
+ * @alpha
333
+ * A class extending Properties allowing editing of PrimitiveProperty attributes.
334
+ */
335
+ export class PrimitiveProperties extends PrimitiveOrEnumProperties {
336
+ constructor(ecClassType, _schemaEditor) {
337
+ super(ecClassType, _schemaEditor);
338
+ }
339
+ /**
340
+ * Override to validate that the found property is a PrimitiveProperty.
341
+ * @param classKey The SchemaItemKey of the class.
342
+ * @param propertyName The name of the property.
343
+ */
344
+ async getProperty(classKey, propertyName) {
345
+ const property = await super.getProperty(classKey, propertyName);
346
+ if (!(property instanceof PrimitiveProperty)) {
347
+ throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.PrimitiveProperty));
348
+ }
349
+ return property;
350
+ }
351
+ }
352
+ /**
353
+ * @alpha
354
+ * A class extending Properties allowing editing of EnumerationProperty attributes.
355
+ */
356
+ export class EnumerationProperties extends PrimitiveOrEnumProperties {
357
+ constructor(ecClassType, _schemaEditor) {
358
+ super(ecClassType, _schemaEditor);
359
+ }
360
+ /**
361
+ * Override to validate that the found property is a EnumerationProperty.
362
+ * @param classKey The SchemaItemKey of the class.
363
+ * @param propertyName The name of the property.
364
+ */
365
+ async getProperty(classKey, propertyName) {
366
+ const property = await super.getProperty(classKey, propertyName);
367
+ if (!(property instanceof EnumerationProperty)) {
368
+ throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.EnumerationProperty));
369
+ }
370
+ return property;
371
+ }
372
+ }
373
+ /**
374
+ * @alpha
375
+ * A class extending Properties allowing editing of NavigationProperties attributes.
376
+ */
377
+ export class NavigationProperties extends Properties {
378
+ constructor(ecClassType, _schemaEditor) {
379
+ super(ecClassType, _schemaEditor);
380
+ }
381
+ /**
382
+ * Override to validate that the found property is a NavigationProperty.
383
+ * @param classKey The SchemaItemKey of the class.
384
+ * @param propertyName The name of the property.
385
+ */
386
+ async getProperty(classKey, propertyName) {
387
+ const property = await super.getProperty(classKey, propertyName);
388
+ if (!(property instanceof NavigationProperty)) {
389
+ throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.NavigationProperty));
390
+ }
391
+ return property;
392
+ }
393
+ }
394
+ /**
395
+ * @alpha
396
+ * A class extending Properties allowing editing of StructProperty attributes.
397
+ */
398
+ export class StructProperties extends Properties {
399
+ constructor(ecClassType, _schemaEditor) {
400
+ super(ecClassType, _schemaEditor);
401
+ }
402
+ /**
403
+ * Override to validate that the found property is a StructProperty.
404
+ * @param classKey The SchemaItemKey of the class.
405
+ * @param propertyName The name of the property.
406
+ */
407
+ async getProperty(classKey, propertyName) {
408
+ const property = await super.getProperty(classKey, propertyName);
409
+ if (!(property instanceof StructProperty)) {
410
+ throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.StructProperty));
411
+ }
412
+ return property;
413
+ }
414
+ }
415
+ //# sourceMappingURL=Properties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Properties.js","sourceRoot":"","sources":["../../../src/Editing/Properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,uBAAuB,EAAE,OAAO,EAAE,MAAM,EAC/F,mBAAmB,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAC1E,gBAAgB,EAAiB,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,qB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QACnK,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IAC9C,YAAmB,WAA+B,EAAE,aAAkC;QACpF,KAAK,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACgB,KAAK,CAAC,WAAW,CAAgC,QAAuB,EAAE,YAAoB;QAC/G,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,WAAW,CAAwB,QAAQ,EAAE,YAAY,CAAM,CAAC;QAC7F,IAAI,CAAC,CAAC,QAAQ,YAAY,cAAc,CAAC,EAAC,CAAC;YACzC,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,mBAAmB,EAAE,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC,CAAC;QAC/J,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF","sourcesContent":["import { CustomAttribute, CustomAttributeContainerProps, DelayedPromiseWithProps, ECClass, ECName,\n EnumerationProperty, KindOfQuantity, NavigationProperty, PrimitiveProperty,\n PropertyCategory, SchemaItemKey, StructProperty } from \"@itwin/ecschema-metadata\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport * as Rules from \"../Validation/ECRules\";\nimport { MutableArrayProperty } from \"./Mutable/MutableArrayProperty\";\nimport { MutableProperty } from \"./Mutable/MutableProperty\";\nimport { MutablePrimitiveOrEnumPropertyBase } from \"./Mutable/MutablePrimitiveOrEnumProperty\";\nimport { MutableClass } from \"./Mutable/MutableClass\";\nimport { MutableStructProperty } from \"./Mutable/MutableStructProperty\";\nimport { MutableNavigationProperty } from \"./Mutable/MutableNavigationProperty\";\nimport { ECClassSchemaItems } from \"./ECClasses\";\nimport { ClassId, CustomAttributeId, ECEditingStatus, PropertyId, PropertyTypeName, SchemaEditingError, SchemaId } from \"./Exception\";\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\n\ntype MutablePropertyType = MutableProperty | MutableArrayProperty | MutablePrimitiveOrEnumPropertyBase | MutableNavigationProperty | MutableStructProperty;\n\n/**\n * @alpha\n * A class allowing editing of attributes of the base Property class.\n */\nexport class Properties {\n public constructor(protected ecClassType: ECClassSchemaItems, protected _schemaEditor: SchemaContextEditor) {\n }\n\n public async setName(classKey: SchemaItemKey, propertyName: string, newPropertyName: string) {\n let newName: ECName;\n try {\n newName = new ECName(newPropertyName);\n } catch {\n throw new SchemaEditingError(ECEditingStatus.SetPropertyName, new PropertyId(this.ecClassType, classKey, propertyName),\n new SchemaEditingError(ECEditingStatus.InvalidECName, new PropertyId(this.ecClassType, classKey, newPropertyName)));\n }\n\n const existingProperty = await this.getProperty<MutableProperty>(classKey, propertyName)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetPropertyName, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n\n const baseProperty = await existingProperty.class.getProperty(newPropertyName, true) as MutableProperty;\n if (baseProperty) {\n throw new SchemaEditingError(ECEditingStatus.SetPropertyName, new PropertyId(this.ecClassType, classKey, propertyName),\n new SchemaEditingError(ECEditingStatus.PropertyAlreadyExists, new PropertyId(this.ecClassType, baseProperty.class.key, newPropertyName)));\n }\n\n // Handle derived classes\n const derivedProperties: Array<MutableProperty> = [];\n const derivedClasses = await this.findDerivedClasses(existingProperty.class as MutableClass);\n for (const derivedClass of derivedClasses) {\n if (await derivedClass.getProperty(newPropertyName)) {\n throw new SchemaEditingError(ECEditingStatus.SetPropertyName, new PropertyId(this.ecClassType, classKey, propertyName),\n new SchemaEditingError(ECEditingStatus.PropertyAlreadyExists, new PropertyId(this.ecClassType, derivedClass.key, newPropertyName)));\n }\n\n const propertyOverride = await derivedClass.getProperty(propertyName) as MutableProperty;\n // If found the property is overridden in the derived class.\n if (propertyOverride)\n derivedProperties.push(propertyOverride);\n }\n\n // Re-name the overridden property in all derived classes\n derivedProperties.forEach((prop: MutableProperty) => {\n prop.setName(newName);\n });\n\n existingProperty.setName(newName);\n }\n\n /**\n * Sets the property description.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param description The new description to set.\n */\n public async setDescription(classKey: SchemaItemKey, propertyName: string, description: string) {\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetDescription, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n property.setDescription(description);\n }\n\n /**\n * Sets the property label.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param label The new label to set.\n */\n public async setLabel(classKey: SchemaItemKey, propertyName: string, label: string) {\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetLabel, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n property.setLabel(label);\n }\n\n /**\n * Sets the property isReadOnly attribute.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param isReadOnly The new isReadOnly value.\n */\n public async setIsReadOnly(classKey: SchemaItemKey, propertyName: string, isReadOnly: boolean) {\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetIsReadOnly, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n property.setIsReadOnly(isReadOnly);\n }\n\n /**\n * Sets the property priority.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param priority The new priority.\n */\n public async setPriority(classKey: SchemaItemKey, propertyName: string, priority: number) {\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetPriority, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n property.setPriority(priority);\n }\n\n /**\n * Sets the property category.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param categoryKey The SchemaItemKey of the property category.\n */\n public async setCategory(classKey: SchemaItemKey, propertyName: string, categoryKey: SchemaItemKey) {\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetCategory, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n\n const category = await this._schemaEditor.getSchemaItem(categoryKey, PropertyCategory)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetCategory, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n\n property.setCategory(new DelayedPromiseWithProps<SchemaItemKey, PropertyCategory>(categoryKey, async () => category));\n }\n\n /**\n * Sets the KindOfQuantity of a property.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param kindOfQuantityKey The SchemaItemKey of the KindOfQuantity.\n */\n public async setKindOfQuantity(classKey: SchemaItemKey, propertyName: string, kindOfQuantityKey: SchemaItemKey) {\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetKindOfQuantity, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n\n const koq = await this._schemaEditor.getSchemaItem(kindOfQuantityKey, KindOfQuantity)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetKindOfQuantity, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n\n const currentKoq = await property.kindOfQuantity;\n if(currentKoq && currentKoq.persistenceUnit && koq.persistenceUnit && !currentKoq.persistenceUnit.matchesFullName(koq.persistenceUnit.fullName)) {\n throw new SchemaEditingError(ECEditingStatus.SetKindOfQuantity, new PropertyId(this.ecClassType, classKey, propertyName), undefined, undefined, \"KindOfQuantity can only be changed if it has the same persistence unit as the property.\");\n }\n\n property.setKindOfQuantity(new DelayedPromiseWithProps<SchemaItemKey, KindOfQuantity>(kindOfQuantityKey, async () => koq));\n }\n\n /**\n * Adds a CustomAttribute instance to the Property identified by the given SchemaItemKey and property name.\n * @param classKey The SchemaItemKey identifying the class.\n * @param propertyName The name of the property.\n * @param customAttribute The CustomAttribute instance to add.\n */\n public async addCustomAttribute(classKey: SchemaItemKey, propertyName: string, customAttribute: CustomAttribute) {\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToProperty, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n\n property.addCustomAttribute(customAttribute);\n\n const diagnosticsIterable = Rules.validateCustomAttributeInstance(property, customAttribute);\n\n const diagnostics: AnyDiagnostic[] = [];\n for await (const diagnostic of diagnosticsIterable) {\n diagnostics.push(diagnostic);\n }\n\n if (diagnostics.length > 0) {\n this.removeCustomAttribute(property, customAttribute);\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToProperty, new PropertyId(this.ecClassType, classKey, propertyName),\n new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, property)));\n }\n }\n\n /**\n * Removes a CustomAttribute from a property.\n * @param container\n * @param customAttribute\n */\n protected removeCustomAttribute(container: CustomAttributeContainerProps, customAttribute: CustomAttribute) {\n assert(container.customAttributes !== undefined);\n const map = container.customAttributes as Map<string, CustomAttribute>;\n map.delete(customAttribute.className);\n }\n\n /**\n * Gets the property with the specified name from the class identified by the given key.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property to retrieve.\n */\n protected async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\n const mutableClass = await this.getClass(classKey);\n\n const property = await mutableClass.getProperty(propertyName) as T;\n if (property === undefined) {\n throw new SchemaEditingError(ECEditingStatus.PropertyNotFound, new PropertyId(mutableClass.schemaItemType as ECClassSchemaItems, classKey, propertyName));\n }\n\n return property;\n }\n\n private async findDerivedClasses(mutableClass: MutableClass): Promise<Array<MutableClass>>{\n const derivedClasses: Array<MutableClass> = [];\n\n for (const schemaItem of this._schemaEditor.schemaContext.getSchemaItems()) {\n if(ECClass.isECClass(schemaItem) && await schemaItem.is(mutableClass)) {\n if (!mutableClass.key.matches(schemaItem.key)) {\n derivedClasses.push(schemaItem as MutableClass);\n }\n }\n }\n\n return derivedClasses;\n }\n\n private async getClass(classKey: SchemaItemKey): Promise<MutableClass> {\n const schema = await this._schemaEditor.getSchema(classKey.schemaKey);\n if (schema === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(classKey.schemaKey));\n\n const ecClass = await schema.getItem(classKey.name);\n if (ecClass === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new ClassId(this.ecClassType, classKey));\n\n if (ecClass.schemaItemType !== this.ecClassType){\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new ClassId(this.ecClassType, classKey));\n }\n\n return ecClass as MutableClass;\n }\n}\n\n/**\n * @alpha\n * A class extending Properties allowing editing of attributes of PrimitiveArrayProperty,\n * EnumerationArrayProperty and StructArrayProperty.\n */\nexport class ArrayProperties extends Properties {\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\n super(ecClassType, _schemaEditor);\n }\n\n /**\n * Sets the array property minOccurs attribute.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param minOccurs The new minOccurs value.\n */\n public async setMinOccurs(classKey: SchemaItemKey, propertyName: string, minOccurs: number) {\n const property = await this.getProperty<MutableArrayProperty>(classKey, propertyName)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetMinOccurs, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n property.setMinOccurs(minOccurs);\n }\n\n /**\n * Sets the array property maxOccurs attribute.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param maxOccurs The new maxOccurs value.\n */\n public async setMaxOccurs(classKey: SchemaItemKey, propertyName: string, maxOccurs: number) {\n const property = await this.getProperty<MutableArrayProperty>(classKey, propertyName)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetMaxOccurs, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n property.setMaxOccurs(maxOccurs);\n }\n\n /**\n * Override to validate that the found property is an ArrayProperty.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n */\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\n const property = await super.getProperty<MutableArrayProperty>(classKey, propertyName) as T;\n if (!property.isArray()){\n throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.ArrayProperty));\n }\n return property;\n }\n}\n\n/**\n * @alpha\n * A class extending Properties allowing editing of attributes of PrimitiveProperty and EnumerationProperty.\n */\nclass PrimitiveOrEnumProperties extends Properties {\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\n super(ecClassType, _schemaEditor);\n }\n\n /**\n * Sets the extendedTypeName attribute value.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param extendedTypeName The extended type name of the property.\n */\n public async setExtendedTypeName(classKey: SchemaItemKey, propertyName: string, extendedTypeName: string) {\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetExtendedTypeName, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n property.setExtendedTypeName(extendedTypeName);\n }\n\n /**\n * Sets the minLength attribute value.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param minLength The minimum length of the property.\n */\n public async setMinLength(classKey: SchemaItemKey, propertyName: string, minLength: number) {\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetMinLength, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n property.setMinLength(minLength);\n }\n\n /**\n * Sets the maxLength attribute value.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param maxLength The maximum length of the property.\n */\n public async setMaxLength(classKey: SchemaItemKey, propertyName: string, maxLength: number) {\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetMaxLength, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n property.setMaxLength(maxLength);\n }\n\n /**\n * Sets the minValue attribute value.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param minValue The minimum value of the property.\n */\n public async setMinValue(classKey: SchemaItemKey, propertyName: string, minValue: number) {\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetMinValue, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n property.setMinValue(minValue);\n }\n\n /**\n * Sets the maxValue attribute value.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n * @param maxValue The maximum value of the property.\n */\n public async setMaxValue(classKey: SchemaItemKey, propertyName: string, maxValue: number) {\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetMaxValue, new PropertyId(this.ecClassType, classKey, propertyName), e);\n });\n property.setMaxValue(maxValue);\n }\n}\n\n/**\n * @alpha\n * A class extending Properties allowing editing of PrimitiveProperty attributes.\n */\nexport class PrimitiveProperties extends PrimitiveOrEnumProperties {\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\n super(ecClassType, _schemaEditor);\n }\n\n /**\n * Override to validate that the found property is a PrimitiveProperty.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n */\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\n const property = await super.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName) as T;\n if (!(property instanceof PrimitiveProperty)){\n throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.PrimitiveProperty));\n }\n return property;\n }\n}\n\n/**\n * @alpha\n * A class extending Properties allowing editing of EnumerationProperty attributes.\n */\nexport class EnumerationProperties extends PrimitiveOrEnumProperties {\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\n super(ecClassType, _schemaEditor);\n }\n\n /**\n * Override to validate that the found property is a EnumerationProperty.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n */\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\n const property = await super.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName) as T;\n if (!(property instanceof EnumerationProperty)){\n throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.EnumerationProperty));\n }\n return property;\n }\n}\n\n/**\n * @alpha\n * A class extending Properties allowing editing of NavigationProperties attributes.\n */\nexport class NavigationProperties extends Properties {\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\n super(ecClassType, _schemaEditor);\n }\n\n /**\n * Override to validate that the found property is a NavigationProperty.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n */\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\n const property = await super.getProperty<MutableNavigationProperty>(classKey, propertyName) as T;\n if (!(property instanceof NavigationProperty)){\n throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.NavigationProperty));\n }\n return property;\n }\n}\n\n/**\n * @alpha\n * A class extending Properties allowing editing of StructProperty attributes.\n */\nexport class StructProperties extends Properties {\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\n super(ecClassType, _schemaEditor);\n }\n\n /**\n * Override to validate that the found property is a StructProperty.\n * @param classKey The SchemaItemKey of the class.\n * @param propertyName The name of the property.\n */\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\n const property = await super.getProperty<MutableStructProperty>(classKey, propertyName) as T;\n if (!(property instanceof StructProperty)){\n throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.StructProperty));\n }\n return property;\n }\n}\n\n"]}
@@ -0,0 +1,18 @@
1
+ /** @packageDocumentation
2
+ * @module Editing
3
+ */
4
+ import { PropertyCategory, PropertyCategoryProps, SchemaItemKey, SchemaKey } from "@itwin/ecschema-metadata";
5
+ import { SchemaContextEditor } from "./Editor";
6
+ import { SchemaItems } from "./SchemaItems";
7
+ /**
8
+ * @alpha
9
+ * A class allowing you to create schema items of type Property Category.
10
+ */
11
+ export declare class PropertyCategories extends SchemaItems {
12
+ protected get itemTypeClass(): typeof PropertyCategory;
13
+ constructor(schemaEditor: SchemaContextEditor);
14
+ create(schemaKey: SchemaKey, name: string, priority: number, displayLabel?: string): Promise<SchemaItemKey>;
15
+ createFromProps(schemaKey: SchemaKey, propertyCategoryProps: PropertyCategoryProps): Promise<SchemaItemKey>;
16
+ setPriority(propCategoryKey: SchemaItemKey, priority: number): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=PropertyCategories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertyCategories.d.ts","sourceRoot":"","sources":["../../../src/Editing/PropertyCategories.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,aAAa,EAAkB,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC7H,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,WAAW;IACjD,cAAuB,aAAa,IAAI,OAAO,gBAAgB,CAE9D;gBAEkB,YAAY,EAAE,mBAAmB;IAIvC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAa3G,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,qBAAqB,EAAE,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC;IAS3G,WAAW,CAAC,eAAe,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAQ1F"}
@@ -0,0 +1,54 @@
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 { PropertyCategory, SchemaItemType } from "@itwin/ecschema-metadata";
9
+ import { MutablePropertyCategory } from "./Mutable/MutablePropertyCategory";
10
+ import { ECEditingStatus, SchemaEditingError, SchemaItemId } from "./Exception";
11
+ import { SchemaItems } from "./SchemaItems";
12
+ /**
13
+ * @alpha
14
+ * A class allowing you to create schema items of type Property Category.
15
+ */
16
+ export class PropertyCategories extends SchemaItems {
17
+ get itemTypeClass() {
18
+ return PropertyCategory;
19
+ }
20
+ constructor(schemaEditor) {
21
+ super(SchemaItemType.PropertyCategory, schemaEditor);
22
+ }
23
+ async create(schemaKey, name, priority, displayLabel) {
24
+ try {
25
+ const newPropCategory = await this.createSchemaItem(schemaKey, this.schemaItemType, (schema) => schema.createPropertyCategory.bind(schema), name);
26
+ newPropCategory.setPriority(priority);
27
+ if (displayLabel)
28
+ newPropCategory.setDisplayLabel(displayLabel);
29
+ return newPropCategory.key;
30
+ }
31
+ catch (e) {
32
+ throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);
33
+ }
34
+ }
35
+ async createFromProps(schemaKey, propertyCategoryProps) {
36
+ try {
37
+ const newPropCategory = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createPropertyCategory.bind(schema), propertyCategoryProps);
38
+ return newPropCategory.key;
39
+ }
40
+ catch (e) {
41
+ throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, propertyCategoryProps.name, schemaKey), e);
42
+ }
43
+ }
44
+ async setPriority(propCategoryKey, priority) {
45
+ try {
46
+ const propertyCategory = await this.getSchemaItem(propCategoryKey, MutablePropertyCategory);
47
+ propertyCategory.setPriority(priority);
48
+ }
49
+ catch (e) {
50
+ throw new SchemaEditingError(ECEditingStatus.SetPropertyCategoryPriority, new SchemaItemId(this.schemaItemType, propCategoryKey), e);
51
+ }
52
+ }
53
+ }
54
+ //# sourceMappingURL=PropertyCategories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertyCategories.js","sourceRoot":"","sources":["../../../src/Editing/PropertyCategories.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAwC,cAAc,EAAa,MAAM,0BAA0B,CAAC;AAE7H,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,WAAW;IACjD,IAAuB,aAAa;QAClC,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,YAAmB,YAAiC;QAClD,KAAK,CAAC,cAAc,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC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B;QACvE,IAAI,CAAC;YACH,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC;YAC5F,gBAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,2BAA2B,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;QACvI,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { PropertyCategory, PropertyCategoryProps, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport { MutablePropertyCategory } from \"./Mutable/MutablePropertyCategory\";\nimport { ECEditingStatus, SchemaEditingError, SchemaItemId } from \"./Exception\";\nimport { SchemaItems } from \"./SchemaItems\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type Property Category.\n */\nexport class PropertyCategories extends SchemaItems {\n protected override get itemTypeClass(): typeof PropertyCategory {\n return PropertyCategory;\n }\n\n public constructor(schemaEditor: SchemaContextEditor) {\n super(SchemaItemType.PropertyCategory, schemaEditor);\n }\n\n public async create(schemaKey: SchemaKey, name: string, priority: number, displayLabel?: string): Promise<SchemaItemKey> {\n try {\n const newPropCategory = await this.createSchemaItem<PropertyCategory>(schemaKey, this.schemaItemType, (schema) => schema.createPropertyCategory.bind(schema), name) as MutablePropertyCategory;\n newPropCategory.setPriority(priority);\n if (displayLabel)\n newPropCategory.setDisplayLabel(displayLabel);\n\n return newPropCategory.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);\n }\n }\n\n public async createFromProps(schemaKey: SchemaKey, propertyCategoryProps: PropertyCategoryProps): Promise<SchemaItemKey> {\n try {\n const newPropCategory = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createPropertyCategory.bind(schema), propertyCategoryProps);\n return newPropCategory.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, propertyCategoryProps.name!, schemaKey), e);\n }\n }\n\n public async setPriority(propCategoryKey: SchemaItemKey, priority: number): Promise<void> {\n try {\n const propertyCategory = await this.getSchemaItem(propCategoryKey, MutablePropertyCategory);\n propertyCategory.setPriority(priority);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.SetPropertyCategoryPriority, new SchemaItemId(this.schemaItemType, propCategoryKey), e);\n }\n }\n}\n"]}
@@ -0,0 +1,69 @@
1
+ /** @packageDocumentation
2
+ * @module Editing
3
+ */
4
+ import { CustomAttribute, ECClassModifier, EntityClass, Mixin, NavigationPropertyProps, RelationshipClass, RelationshipClassProps, RelationshipConstraint, RelationshipEnd, RelationshipMultiplicity, SchemaItemKey, SchemaKey, StrengthDirection, StrengthType } from "@itwin/ecschema-metadata";
5
+ import { SchemaContextEditor } from "./Editor";
6
+ import { ECClasses } from "./ECClasses";
7
+ import { NavigationProperties } from "./Properties";
8
+ /**
9
+ * @alpha
10
+ * A class extending ECClasses allowing you to create schema items of type RelationshipClass.
11
+ */
12
+ export declare class RelationshipClasses extends ECClasses {
13
+ protected get itemTypeClass(): typeof RelationshipClass;
14
+ constructor(schemaEditor: SchemaContextEditor);
15
+ /**
16
+ * Allows access for editing of NavigationProperty attributes.
17
+ */
18
+ readonly navigationProperties: NavigationProperties;
19
+ /**
20
+ * Creates a RelationshipClass.
21
+ * @param schemaKey a SchemaKey of the Schema that will house the new object.
22
+ * @param name The name of the new class.
23
+ * @param modifier The ECClassModifier of the new class.
24
+ * @param strength The relationship StrengthType of the class.
25
+ * @param StrengthDirection The relationship StrengthDirection of the class.
26
+ * @param baseClassKey An optional SchemaItemKey that specifies the base relationship class.
27
+ */
28
+ create(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, strength: StrengthType, direction: StrengthDirection, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey>;
29
+ /**
30
+ * Sets the source RelationshipConstraint on the relationship.
31
+ * @param relationshipKey The SchemaItemKey for the relationship.
32
+ * @param source The RelationshipConstraint to add.
33
+ */
34
+ setSourceConstraint(relationshipKey: SchemaItemKey, source: RelationshipConstraint): Promise<void>;
35
+ /**
36
+ * Sets the target RelationshipConstraint on the relationship.
37
+ * @param relationshipKey The SchemaItemKey for the relationship.
38
+ * @param target The RelationshipConstraint to add.
39
+ */
40
+ setTargetConstraint(relationshipKey: SchemaItemKey, target: RelationshipConstraint): Promise<void>;
41
+ /**
42
+ * Creates a RelationshipClass through a RelationshipClassProps.
43
+ * @param schemaKey a SchemaKey of the Schema that will house the new object.
44
+ * @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.
45
+ */
46
+ createFromProps(schemaKey: SchemaKey, relationshipProps: RelationshipClassProps): Promise<SchemaItemKey>;
47
+ /**
48
+ * Sets the base class of a RelationshipClass.
49
+ * @param relationshipKey The SchemaItemKey of the RelationshipClass.
50
+ * @param baseClassKey The SchemaItemKey of the base class. Specifying 'undefined' removes the base class.
51
+ */
52
+ setBaseClass(itemKey: SchemaItemKey, baseClassKey?: SchemaItemKey): Promise<void>;
53
+ createNavigationProperty(relationshipKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<void>;
54
+ /**
55
+ * Creates a Navigation Property through a NavigationPropertyProps.
56
+ * @param classKey a SchemaItemKey of the Relationship Class that will house the new property.
57
+ * @param navigationProps a json object that will be used to populate the new Navigation Property.
58
+ */
59
+ createNavigationPropertyFromProps(relationshipKey: SchemaItemKey, navigationProps: NavigationPropertyProps): Promise<void>;
60
+ setConstraintMultiplicity(constraint: RelationshipConstraint, multiplicity: RelationshipMultiplicity): Promise<void>;
61
+ setConstraintPolymorphic(constraint: RelationshipConstraint, polymorphic: boolean): Promise<void>;
62
+ setConstraintRelationshipEnd(constraint: RelationshipConstraint, relationshipEnd: RelationshipEnd): Promise<void>;
63
+ setAbstractConstraint(constraint: RelationshipConstraint, abstractConstraint?: EntityClass | Mixin | RelationshipClass): Promise<void>;
64
+ addConstraintClass(constraint: RelationshipConstraint, ecClass: EntityClass | Mixin | RelationshipClass): Promise<void>;
65
+ removeConstraintClass(constraint: RelationshipConstraint, ecClass: EntityClass | Mixin | RelationshipClass): Promise<void>;
66
+ addCustomAttributeToConstraint(constraint: RelationshipConstraint, customAttribute: CustomAttribute): Promise<void>;
67
+ private validate;
68
+ }
69
+ //# sourceMappingURL=RelationshipClasses.d.ts.map