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

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,17 @@
1
+ /** @packageDocumentation
2
+ * @module Editing
3
+ */
4
+ import { SchemaItemKey, SchemaItemUnitProps, SchemaKey, Unit } 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 Unit.
10
+ */
11
+ export declare class Units extends SchemaItems {
12
+ protected get itemTypeClass(): typeof Unit;
13
+ constructor(schemaEditor: SchemaContextEditor);
14
+ create(schemaKey: SchemaKey, name: string, definition: string, phenomenon: SchemaItemKey, unitSystem: SchemaItemKey, displayLabel?: string): Promise<SchemaItemKey>;
15
+ createFromProps(schemaKey: SchemaKey, unitProps: SchemaItemUnitProps): Promise<SchemaItemKey>;
16
+ }
17
+ //# sourceMappingURL=Units.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Units.d.ts","sourceRoot":"","sources":["../../../src/Editing/Units.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAuC,aAAa,EAAkB,mBAAmB,EAAE,SAAS,EAAE,IAAI,EAAc,MAAM,0BAA0B,CAAC;AAChK,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,qBAAa,KAAM,SAAQ,WAAW;IACpC,cAAuB,aAAa,IAAI,OAAO,IAAI,CAElD;gBAGkB,YAAY,EAAE,mBAAmB;IAIvC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAqBnK,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,mBAAmB,GAAG,OAAO,CAAC,aAAa,CAAC;CAQ3G"}
@@ -0,0 +1,49 @@
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 { DelayedPromiseWithProps, Phenomenon, SchemaItemType, Unit, UnitSystem } 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 Unit.
14
+ */
15
+ export class Units extends SchemaItems {
16
+ get itemTypeClass() {
17
+ return Unit;
18
+ }
19
+ // TODO: Add more setters for all attributes.
20
+ constructor(schemaEditor) {
21
+ super(SchemaItemType.Unit, schemaEditor);
22
+ }
23
+ async create(schemaKey, name, definition, phenomenon, unitSystem, displayLabel) {
24
+ try {
25
+ const newUnit = await this.createSchemaItem(schemaKey, this.schemaItemType, (schema) => schema.createUnit.bind(schema), name);
26
+ const phenomenonItem = await this.getSchemaItem(phenomenon, Phenomenon);
27
+ await newUnit.setPhenomenon(new DelayedPromiseWithProps(phenomenon, async () => phenomenonItem));
28
+ const unitSystemItem = await this.getSchemaItem(unitSystem, UnitSystem);
29
+ await newUnit.setUnitSystem(new DelayedPromiseWithProps(unitSystem, async () => unitSystemItem));
30
+ await newUnit.setDefinition(definition);
31
+ if (displayLabel)
32
+ newUnit.setDisplayLabel(displayLabel);
33
+ return newUnit.key;
34
+ }
35
+ catch (e) {
36
+ throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);
37
+ }
38
+ }
39
+ async createFromProps(schemaKey, unitProps) {
40
+ try {
41
+ const newUnit = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createUnit.bind(schema), unitProps);
42
+ return newUnit.key;
43
+ }
44
+ catch (e) {
45
+ throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, unitProps.name, schemaKey), e);
46
+ }
47
+ }
48
+ }
49
+ //# sourceMappingURL=Units.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Units.js","sourceRoot":"","sources":["../../../src/Editing/Units.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAiB,cAAc,EAAkC,IAAI,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGhK,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC,IAAuB,aAAa;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,6CAA6C;IAC7C,YAAmB,YAAiC;QAClD,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAC3C,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,UAAkB,EAAE,UAAyB,EAAE,UAAyB,EAAE,YAAqB;QACrJ,IAAI,CAAC;YACH,M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YAC5I,OAAO,OAAO,CAAC,GAAG,CAAC;QACrB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,yBAAyB,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAChJ,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 { DelayedPromiseWithProps, Phenomenon, SchemaItemKey, SchemaItemType, SchemaItemUnitProps, SchemaKey, Unit, UnitSystem } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport { MutableUnit } from \"./Mutable/MutableUnit\";\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 Unit.\n */\nexport class Units extends SchemaItems {\n protected override get itemTypeClass(): typeof Unit {\n return Unit;\n }\n\n // TODO: Add more setters for all attributes.\n public constructor(schemaEditor: SchemaContextEditor) {\n super(SchemaItemType.Unit, schemaEditor);\n }\n\n public async create(schemaKey: SchemaKey, name: string, definition: string, phenomenon: SchemaItemKey, unitSystem: SchemaItemKey, displayLabel?: string): Promise<SchemaItemKey> {\n try {\n const newUnit = await this.createSchemaItem<Unit>(schemaKey, this.schemaItemType, (schema) => schema.createUnit.bind(schema), name) as MutableUnit;\n\n const phenomenonItem = await this.getSchemaItem(phenomenon, Phenomenon);\n await newUnit.setPhenomenon(new DelayedPromiseWithProps<SchemaItemKey, Phenomenon>(phenomenon, async () => phenomenonItem));\n\n const unitSystemItem = await this.getSchemaItem(unitSystem, UnitSystem);\n await newUnit.setUnitSystem(new DelayedPromiseWithProps<SchemaItemKey, UnitSystem>(unitSystem, async () => unitSystemItem));\n\n await newUnit.setDefinition(definition);\n\n if (displayLabel)\n newUnit.setDisplayLabel(displayLabel);\n\n return newUnit.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, unitProps: SchemaItemUnitProps): Promise<SchemaItemKey> {\n try {\n const newUnit = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createUnit.bind(schema), unitProps);\n return newUnit.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, unitProps.name!, schemaKey), e);\n }\n }\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { type SchemaMergeContext } from "./SchemaMerger";
2
+ import { AnyClassItemDifference } from "../Differencing/SchemaDifference";
3
+ import { ECClass, SchemaItemKey } from "@itwin/ecschema-metadata";
4
+ /**
5
+ * Shared modify merger of all ECClass based items.
6
+ * @internal
7
+ */
8
+ export declare function modifyClass(context: SchemaMergeContext, change: AnyClassItemDifference, itemKey: SchemaItemKey, item: ECClass): Promise<void>;
9
+ //# sourceMappingURL=ClassMerger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClassMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/ClassMerger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAG1E,OAAO,EAAmB,OAAO,EAAuC,aAAa,EAAkB,MAAM,0BAA0B,CAAC;AAIxI;;;GAGG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,sBAAsB,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BnJ"}
@@ -0,0 +1,66 @@
1
+ import { updateSchemaItemKey } from "./Utils";
2
+ import { ECClassModifier, parseClassModifier, SchemaItemType } from "@itwin/ecschema-metadata";
3
+ import { mergeClassProperties } from "./PropertyMerger";
4
+ import { applyCustomAttributes } from "./CustomAttributeMerger";
5
+ /**
6
+ * Shared modify merger of all ECClass based items.
7
+ * @internal
8
+ */
9
+ export async function modifyClass(context, change, itemKey, item) {
10
+ const mutableClass = item;
11
+ if (change.difference.label !== undefined) {
12
+ mutableClass.setDisplayLabel(change.difference.label);
13
+ }
14
+ if (change.difference.description !== undefined) {
15
+ mutableClass.setDescription(change.difference.description);
16
+ }
17
+ if (change.difference.hasOwnProperty("baseClass")) {
18
+ // If the entry difference have a property baseClass and it is explicitly set to undefined,
19
+ // it is expected to remove the base class, which is not allowed in this case.
20
+ // TODO: We should consider using null for this case.
21
+ if (change.difference.baseClass === undefined) {
22
+ throw new Error(`Changing the class '${item.key.name}' baseClass is not supported.`);
23
+ }
24
+ await setBaseClass(context, item, change.difference.baseClass, change.changeType === "add");
25
+ }
26
+ if (change.difference.modifier !== undefined) {
27
+ await setClassModifier(mutableClass, change.difference.modifier);
28
+ }
29
+ if (change.difference.customAttributes !== undefined) {
30
+ await applyCustomAttributes(context, change.difference.customAttributes, async (ca) => {
31
+ await context.editor.entities.addCustomAttribute(itemKey, ca);
32
+ });
33
+ }
34
+ return mergeClassProperties(context, change, itemKey);
35
+ }
36
+ async function setBaseClass(context, item, baseClass, isInitial) {
37
+ if (!isInitial && (item.baseClass === undefined))
38
+ throw new Error(`Changing the class '${item.key.name}' baseClass is not supported.`);
39
+ const baseClassKey = await updateSchemaItemKey(context, baseClass);
40
+ const baseClassSetter = getBaseClassSetter(context, item);
41
+ await baseClassSetter(item.key, baseClassKey);
42
+ }
43
+ async function setClassModifier(item, modifierValue) {
44
+ const modifier = parseClassModifier(modifierValue);
45
+ if (modifier === undefined) {
46
+ throw new Error("An invalid class modifier has been provided.");
47
+ }
48
+ if (item.modifier === undefined || item.modifier === modifier || modifier === ECClassModifier.None) {
49
+ item.setModifier(modifier);
50
+ return;
51
+ }
52
+ throw new Error(`Changing the class '${item.name}' modifier is not supported.`);
53
+ }
54
+ function getBaseClassSetter(context, item) {
55
+ return async (itemKey, baseClassKey) => {
56
+ switch (item.schemaItemType) {
57
+ case SchemaItemType.CustomAttributeClass: return context.editor.customAttributes.setBaseClass(itemKey, baseClassKey);
58
+ case SchemaItemType.EntityClass: return context.editor.entities.setBaseClass(itemKey, baseClassKey);
59
+ case SchemaItemType.Mixin: return context.editor.mixins.setBaseClass(itemKey, baseClassKey);
60
+ case SchemaItemType.RelationshipClass: return context.editor.relationships.setBaseClass(itemKey, baseClassKey);
61
+ case SchemaItemType.StructClass: return context.editor.structs.setBaseClass(itemKey, baseClassKey);
62
+ }
63
+ throw new Error(`Changing the base class '${item.name}' is not supported.`);
64
+ };
65
+ }
66
+ //# sourceMappingURL=ClassMerger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/ClassMerger.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EAA4B,eAAe,EAAE,kBAAkB,EAAiB,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACxI,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAA2B,EAAE,MAA8B,EAAE,OAAsB,EAAE,IAAa;IAClI,MAAM,YAAY,GAAG,IAAoB,CAAC;IAC1C,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC1C,YAAY,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,C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,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YACpG,KAAK,cAAc,CAAC,KAAK,CAAC,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAC5F,KAAK,cAAc,CAAC,iBAAiB,CAAC,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAC/G,KAAK,cAAc,CAAC,WAAW,CAAC,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACrG,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,4BAA4B,IAAI,CAAC,IAAI,qBAAqB,CAAC,CAAC;IAC9E,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { type SchemaMergeContext } from \"./SchemaMerger\";\nimport { AnyClassItemDifference } from \"../Differencing/SchemaDifference\";\nimport { updateSchemaItemKey } from \"./Utils\";\nimport { type MutableClass } from \"../Editing/Mutable/MutableClass\";\nimport { CustomAttribute, ECClass, ECClassModifier, parseClassModifier, SchemaItemKey, SchemaItemType } from \"@itwin/ecschema-metadata\";\nimport { mergeClassProperties } from \"./PropertyMerger\";\nimport { applyCustomAttributes } from \"./CustomAttributeMerger\";\n\n/**\n * Shared modify merger of all ECClass based items.\n * @internal\n */\nexport async function modifyClass(context: SchemaMergeContext, change: AnyClassItemDifference, itemKey: SchemaItemKey, item: ECClass): Promise<void> {\n const mutableClass = item as MutableClass;\n if (change.difference.label !== undefined) {\n mutableClass.setDisplayLabel(change.difference.label);\n }\n\n if (change.difference.description !== undefined) {\n mutableClass.setDescription(change.difference.description);\n }\n\n if (change.difference.hasOwnProperty(\"baseClass\")) {\n // If the entry difference have a property baseClass and it is explicitly set to undefined,\n // it is expected to remove the base class, which is not allowed in this case.\n // TODO: We should consider using null for this case.\n if(change.difference.baseClass === undefined) {\n throw new Error(`Changing the class '${item.key.name}' baseClass is not supported.`);\n }\n await setBaseClass(context, item, change.difference.baseClass, change.changeType === \"add\");\n }\n\n if (change.difference.modifier !== undefined) {\n await setClassModifier(mutableClass, change.difference.modifier);\n }\n\n if (change.difference.customAttributes !== undefined) {\n await applyCustomAttributes(context, change.difference.customAttributes as CustomAttribute[], async (ca) => {\n await context.editor.entities.addCustomAttribute(itemKey, ca);\n });\n }\n\n return mergeClassProperties(context, change, itemKey);\n}\n\nasync function setBaseClass(context: SchemaMergeContext, item: ECClass, baseClass: string, isInitial: boolean): Promise<void> {\n if (!isInitial && (item.baseClass === undefined))\n throw new Error(`Changing the class '${item.key.name}' baseClass is not supported.`);\n\n const baseClassKey = await updateSchemaItemKey(context, baseClass);\n const baseClassSetter = getBaseClassSetter(context, item);\n\n await baseClassSetter(item.key, baseClassKey);\n}\n\nasync function setClassModifier(item: MutableClass, modifierValue: string): Promise<void> {\n const modifier = parseClassModifier(modifierValue);\n if (modifier === undefined) {\n throw new Error(\"An invalid class modifier has been provided.\");\n }\n if (item.modifier === undefined || item.modifier === modifier || modifier === ECClassModifier.None) {\n item.setModifier(modifier);\n return;\n }\n throw new Error(`Changing the class '${item.name}' modifier is not supported.`);\n}\n\nfunction getBaseClassSetter(context: SchemaMergeContext, item: ECClass) {\n return async (itemKey: SchemaItemKey, baseClassKey: SchemaItemKey) => {\n switch (item.schemaItemType) {\n case SchemaItemType.CustomAttributeClass: return context.editor.customAttributes.setBaseClass(itemKey, baseClassKey);\n case SchemaItemType.EntityClass: return context.editor.entities.setBaseClass(itemKey, baseClassKey);\n case SchemaItemType.Mixin: return context.editor.mixins.setBaseClass(itemKey, baseClassKey);\n case SchemaItemType.RelationshipClass: return context.editor.relationships.setBaseClass(itemKey, baseClassKey);\n case SchemaItemType.StructClass: return context.editor.structs.setBaseClass(itemKey, baseClassKey);\n }\n throw new Error(`Changing the base class '${item.name}' is not supported.`);\n };\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import type { ConstantDifference } from "../Differencing/SchemaDifference";
2
+ import type { SchemaMergeContext } from "./SchemaMerger";
3
+ import { SchemaItemKey } from "@itwin/ecschema-metadata";
4
+ /**
5
+ * Merges a new Constant into the target schema.
6
+ * @internal
7
+ */
8
+ export declare function addConstant(context: SchemaMergeContext, change: ConstantDifference): Promise<void>;
9
+ /**
10
+ * Merges differences to an existing Constant in the target schema.
11
+ * @internal
12
+ */
13
+ export declare function modifyConstant(context: SchemaMergeContext, change: ConstantDifference, itemKey: SchemaItemKey): Promise<void>;
14
+ //# sourceMappingURL=ConstantMerger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConstantMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/ConstantMerger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAwE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG/H;;;GAGG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,iBAkBxF;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,EAAE,OAAO,EAAE,aAAa,iBAqCnH"}
@@ -0,0 +1,64 @@
1
+ import { DelayedPromiseWithProps, ECObjectsError, ECObjectsStatus, Phenomenon } from "@itwin/ecschema-metadata";
2
+ import { updateSchemaItemFullName, updateSchemaItemKey } from "./Utils";
3
+ /**
4
+ * Merges a new Constant into the target schema.
5
+ * @internal
6
+ */
7
+ export async function addConstant(context, change) {
8
+ if (change.difference.phenomenon === undefined) {
9
+ throw new Error("Constant must define phenomenon");
10
+ }
11
+ if (change.difference.definition === undefined) {
12
+ throw new Error("Constant must define definition");
13
+ }
14
+ // Needs to update the reference from source to target schema.
15
+ change.difference.phenomenon = await updateSchemaItemFullName(context, change.difference.phenomenon);
16
+ await context.editor.constants.createFromProps(context.targetSchemaKey, {
17
+ ...change.difference,
18
+ name: change.itemName,
19
+ schemaItemType: change.schemaType,
20
+ phenomenon: change.difference.phenomenon,
21
+ definition: change.difference.definition,
22
+ });
23
+ }
24
+ /**
25
+ * Merges differences to an existing Constant in the target schema.
26
+ * @internal
27
+ */
28
+ export async function modifyConstant(context, change, itemKey) {
29
+ const constant = await context.targetSchema.lookupItem(itemKey);
30
+ if (change.difference.label !== undefined) {
31
+ await context.editor.constants.setDisplayLabel(itemKey, change.difference.label);
32
+ }
33
+ if (change.difference.description !== undefined) {
34
+ await context.editor.constants.setDescription(itemKey, change.difference.description);
35
+ }
36
+ // Note: There are no editor methods to modify a constant.
37
+ if (change.difference.definition !== undefined) {
38
+ if (change.difference.definition !== "" && constant.definition.toLowerCase() !== change.difference.definition.toLowerCase()) {
39
+ throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Constant ${change.itemName} has an invalid 'definition' attribute.`);
40
+ }
41
+ constant.setDefinition(change.difference.definition);
42
+ }
43
+ if (change.difference.denominator !== undefined) {
44
+ if (constant.hasDenominator && constant.denominator !== change.difference.denominator) {
45
+ throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Constant ${change.itemName} has an invalid 'denominator' attribute.`);
46
+ }
47
+ constant.setDenominator(change.difference.denominator);
48
+ }
49
+ if (change.difference.numerator !== undefined) {
50
+ if (constant.hasNumerator && constant.numerator !== change.difference.numerator) {
51
+ throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Constant ${change.itemName} has an invalid 'numerator' attribute.`);
52
+ }
53
+ constant.setNumerator(change.difference.numerator);
54
+ }
55
+ if (change.difference.phenomenon !== undefined) {
56
+ const lookupKey = await updateSchemaItemKey(context, change.difference.phenomenon);
57
+ const phenomenon = await context.editor.schemaContext.getSchemaItem(lookupKey, Phenomenon);
58
+ if (phenomenon === undefined) {
59
+ throw new Error(`Could not find phenomenon ${lookupKey.fullName} in the current context`);
60
+ }
61
+ constant.setPhenomenon(new DelayedPromiseWithProps(phenomenon.key, async () => phenomenon));
62
+ }
63
+ }
64
+ //# sourceMappingURL=ConstantMerger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConstantMerger.js","sourceRoot":"","sources":["../../../src/Merging/ConstantMerger.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,eAAe,EAAE,UAAU,EAAiB,MAAM,0BAA0B,CAAC;AAC/H,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAExE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAA2B,EAAE,MAA0B;IACvF,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IAED,8DAA8D;IAC9D,MAAM,CAAC,UAAU,CAAC,UAAU,GAAG,MAAM,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAErG,MAAM,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE;QACtE,GAAG,MAAM,CAAC,UAAU;QACpB,IAAI,EAAE,MAAM,CAAC,QAAQ;QACrB,cAAc,EAAE,MAAM,CAAC,UAAU;QACjC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU;QACxC,UAAU,EAA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AC;YACtF,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,aAAa,EAAE,gBAAgB,MAAM,CAAC,QAAQ,0CAA0C,CAAC,CAAC;QACrI,CAAC;QACD,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IACzD,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QAC9C,IAAI,QAAQ,CAAC,YAAY,IAAI,QAAQ,CAAC,SAAS,KAAK,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;YAChF,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,aAAa,EAAE,gBAAgB,MAAM,CAAC,QAAQ,wCAAwC,CAAC,CAAC;QACnI,CAAC;QACD,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QAC/C,MAAM,SAAS,GAAG,MAAM,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACnF,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC3F,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,6BAA6B,SAAS,CAAC,QAAQ,yBAAyB,CAAC,CAAC;QAC5F,CAAC;QAED,QAAQ,CAAC,aAAa,CAAC,IAAI,uBAAuB,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9F,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { ConstantDifference } from \"../Differencing/SchemaDifference\";\nimport type{ MutableConstant } from \"../Editing/Mutable/MutableConstant\";\nimport type { SchemaMergeContext } from \"./SchemaMerger\";\nimport { DelayedPromiseWithProps, ECObjectsError, ECObjectsStatus, Phenomenon, SchemaItemKey } from \"@itwin/ecschema-metadata\";\nimport { updateSchemaItemFullName, updateSchemaItemKey } from \"./Utils\";\n\n/**\n * Merges a new Constant into the target schema.\n * @internal\n */\nexport async function addConstant(context: SchemaMergeContext, change: ConstantDifference) {\n if (change.difference.phenomenon === undefined) {\n throw new Error(\"Constant must define phenomenon\");\n }\n if (change.difference.definition === undefined) {\n throw new Error(\"Constant must define definition\");\n }\n\n // Needs to update the reference from source to target schema.\n change.difference.phenomenon = await updateSchemaItemFullName(context, change.difference.phenomenon);\n\n await context.editor.constants.createFromProps(context.targetSchemaKey, {\n ...change.difference,\n name: change.itemName,\n schemaItemType: change.schemaType,\n phenomenon: change.difference.phenomenon,\n definition: change.difference.definition,\n });\n}\n\n/**\n * Merges differences to an existing Constant in the target schema.\n * @internal\n */\nexport async function modifyConstant(context: SchemaMergeContext, change: ConstantDifference, itemKey: SchemaItemKey) {\n const constant = await context.targetSchema.lookupItem(itemKey) as MutableConstant;\n if (change.difference.label !== undefined) {\n await context.editor.constants.setDisplayLabel(itemKey, change.difference.label);\n }\n if (change.difference.description !== undefined) {\n await context.editor.constants.setDescription(itemKey, change.difference.description);\n }\n\n // Note: There are no editor methods to modify a constant.\n if (change.difference.definition !== undefined) {\n if (change.difference.definition !== \"\" && constant.definition.toLowerCase() !== change.difference.definition.toLowerCase()) {\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Constant ${change.itemName} has an invalid 'definition' attribute.`);\n }\n constant.setDefinition(change.difference.definition);\n }\n if (change.difference.denominator !== undefined) {\n if (constant.hasDenominator && constant.denominator !== change.difference.denominator) {\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Constant ${change.itemName} has an invalid 'denominator' attribute.`);\n }\n constant.setDenominator(change.difference.denominator);\n }\n if (change.difference.numerator !== undefined) {\n if (constant.hasNumerator && constant.numerator !== change.difference.numerator) {\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Constant ${change.itemName} has an invalid 'numerator' attribute.`);\n }\n constant.setNumerator(change.difference.numerator);\n }\n if (change.difference.phenomenon !== undefined) {\n const lookupKey = await updateSchemaItemKey(context, change.difference.phenomenon);\n const phenomenon = await context.editor.schemaContext.getSchemaItem(lookupKey, Phenomenon);\n if (phenomenon === undefined) {\n throw new Error(`Could not find phenomenon ${lookupKey.fullName} in the current context`);\n }\n\n constant.setPhenomenon(new DelayedPromiseWithProps(phenomenon.key, async () => phenomenon));\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import type { CustomAttributeClassDifference } from "../Differencing/SchemaDifference";
2
+ import type { SchemaMergeContext } from "./SchemaMerger";
3
+ import { SchemaItemKey } from "@itwin/ecschema-metadata";
4
+ /**
5
+ * Merges a new CustomAttribute into the target schema.
6
+ * @internal
7
+ */
8
+ export declare function addCustomAttributeClass(context: SchemaMergeContext, change: CustomAttributeClassDifference): Promise<void>;
9
+ /**
10
+ * Merges differences to an existing CustomAttribute in the target schema.
11
+ * @internal
12
+ */
13
+ export declare function modifyCustomAttributeClass(context: SchemaMergeContext, change: CustomAttributeClassDifference, itemKey: SchemaItemKey): Promise<void>;
14
+ //# sourceMappingURL=CustomAttributeClassMerger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomAttributeClassMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/CustomAttributeClassMerger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAEvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAA4D,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGnH;;;GAGG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,8BAA8B,iBAWhH;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,8BAA8B,EAAE,OAAO,EAAE,aAAa,iBAa3I"}
@@ -0,0 +1,36 @@
1
+ import { containerTypeToString, parseCustomAttributeContainerType } from "@itwin/ecschema-metadata";
2
+ import { modifyClass } from "./ClassMerger";
3
+ /**
4
+ * Merges a new CustomAttribute into the target schema.
5
+ * @internal
6
+ */
7
+ export async function addCustomAttributeClass(context, change) {
8
+ if (change.difference.appliesTo === undefined) {
9
+ throw new Error("appliesTo is a required property of a CustomAttributeClass but it is not set");
10
+ }
11
+ await context.editor.customAttributes.createFromProps(context.targetSchemaKey, {
12
+ ...change.difference,
13
+ name: change.itemName,
14
+ schemaItemType: change.schemaType,
15
+ appliesTo: change.difference.appliesTo,
16
+ });
17
+ }
18
+ /**
19
+ * Merges differences to an existing CustomAttribute in the target schema.
20
+ * @internal
21
+ */
22
+ export async function modifyCustomAttributeClass(context, change, itemKey) {
23
+ const item = await context.targetSchema.lookupItem(itemKey);
24
+ if (change.difference.appliesTo !== undefined) {
25
+ const currentValue = containerTypeToString(item.appliesTo);
26
+ if (currentValue !== "" && change.difference.appliesTo !== currentValue) {
27
+ const containerType = parseCustomAttributeContainerType(`${currentValue}, ${change.difference.appliesTo}`);
28
+ if (containerType === undefined) {
29
+ throw new Error("An invalid custom attribute class containerType has been provided.");
30
+ }
31
+ item.setAppliesTo(containerType);
32
+ }
33
+ }
34
+ return modifyClass(context, change, itemKey, item);
35
+ }
36
+ //# sourceMappingURL=CustomAttributeClassMerger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomAttributeClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/CustomAttributeClassMerger.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,qBAAqB,EAAE,iCAAiC,EAAiB,MAAM,0BAA0B,CAAC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AAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { CustomAttributeClassDifference } from \"../Differencing/SchemaDifference\";\nimport type { MutableCAClass } from \"../Editing/Mutable/MutableCAClass\";\nimport type { SchemaMergeContext } from \"./SchemaMerger\";\nimport { containerTypeToString, parseCustomAttributeContainerType, SchemaItemKey } from \"@itwin/ecschema-metadata\";\nimport { modifyClass } from \"./ClassMerger\";\n\n/**\n * Merges a new CustomAttribute into the target schema.\n * @internal\n */\nexport async function addCustomAttributeClass(context: SchemaMergeContext, change: CustomAttributeClassDifference) {\n if (change.difference.appliesTo === undefined) {\n throw new Error(\"appliesTo is a required property of a CustomAttributeClass but it is not set\");\n }\n\n await context.editor.customAttributes.createFromProps(context.targetSchemaKey, {\n ...change.difference,\n name: change.itemName,\n schemaItemType: change.schemaType,\n appliesTo: change.difference.appliesTo,\n });\n}\n\n/**\n * Merges differences to an existing CustomAttribute in the target schema.\n * @internal\n */\nexport async function modifyCustomAttributeClass(context: SchemaMergeContext, change: CustomAttributeClassDifference, itemKey: SchemaItemKey) {\n const item = await context.targetSchema.lookupItem(itemKey) as MutableCAClass;\n if (change.difference.appliesTo !== undefined) {\n const currentValue = containerTypeToString(item.appliesTo);\n if (currentValue !== \"\" && change.difference.appliesTo !== currentValue) {\n const containerType = parseCustomAttributeContainerType(`${currentValue}, ${change.difference.appliesTo}`);\n if (containerType === undefined) {\n throw new Error(\"An invalid custom attribute class containerType has been provided.\");\n }\n item.setAppliesTo(containerType);\n }\n }\n return modifyClass(context, change, itemKey, item);\n}\n"]}
@@ -0,0 +1,19 @@
1
+ import { CustomAttribute } from "@itwin/ecschema-metadata";
2
+ import { type SchemaMergeContext } from "./SchemaMerger";
3
+ import { type CustomAttributeDifference } from "../Differencing/SchemaDifference";
4
+ type CustomAttributeSetter = (customAttribute: CustomAttribute) => Promise<void>;
5
+ /**
6
+ * Merges a new CustomAttributes from Schema, items or properties into the target schema.
7
+ * @internal
8
+ */
9
+ export declare function addCustomAttribute(context: SchemaMergeContext, change: CustomAttributeDifference): Promise<void>;
10
+ /**
11
+ * @internal
12
+ */
13
+ export declare function applyCustomAttributes(context: SchemaMergeContext, customAttributes: CustomAttribute[], handler: CustomAttributeSetter): Promise<void>;
14
+ /**
15
+ * @internal
16
+ */
17
+ export declare function applyCustomAttribute(context: SchemaMergeContext, customAttribute: CustomAttribute, handler: CustomAttributeSetter): Promise<void>;
18
+ export {};
19
+ //# sourceMappingURL=CustomAttributeMerger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomAttributeMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/CustomAttributeMerger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAA2C,MAAM,0BAA0B,CAAC;AACpG,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAGlF,KAAK,qBAAqB,GAAG,CAAC,eAAe,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEjF;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2CtH;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAI3J;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvJ"}
@@ -0,0 +1,66 @@
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
+ import { CustomAttributeClass, RelationshipClass } from "@itwin/ecschema-metadata";
6
+ import { getClassEditor, toItemKey, toPropertyKey, updateSchemaItemFullName, updateSchemaItemKey } from "./Utils";
7
+ /**
8
+ * Merges a new CustomAttributes from Schema, items or properties into the target schema.
9
+ * @internal
10
+ */
11
+ export async function addCustomAttribute(context, change) {
12
+ if (change.difference.className === undefined) {
13
+ throw new Error("CustomAttribute instance must specify className");
14
+ }
15
+ const schemaItemKey = await updateSchemaItemKey(context, change.difference.className);
16
+ const targetCustomAttributeClass = await context.targetSchema.lookupItem(schemaItemKey, CustomAttributeClass);
17
+ if (targetCustomAttributeClass === undefined) {
18
+ throw new Error(`Unable to locate the custom attribute class ${schemaItemKey.name} in the merged schema.`);
19
+ }
20
+ const caInstance = {
21
+ ...change.difference,
22
+ className: schemaItemKey.fullName,
23
+ };
24
+ if (change.appliedTo === "Schema") {
25
+ await context.editor.addCustomAttribute(context.targetSchemaKey, caInstance);
26
+ }
27
+ if (change.appliedTo === "SchemaItem") {
28
+ const itemKey = toItemKey(context, change.itemName);
29
+ const editor = await getClassEditor(context, itemKey);
30
+ await editor.addCustomAttribute(itemKey, caInstance);
31
+ }
32
+ if (change.appliedTo === "Property") {
33
+ const itemKey = toItemKey(context, change.itemName);
34
+ const [propertyName] = change.path.split(".");
35
+ const propertyKey = toPropertyKey(context, change.itemName, propertyName);
36
+ const editor = await getClassEditor(context, itemKey);
37
+ await editor.properties.addCustomAttribute(itemKey, propertyKey.propertyName, caInstance);
38
+ }
39
+ if (change.appliedTo === "RelationshipConstraint") {
40
+ const itemKey = toItemKey(context, change.itemName);
41
+ const relationshipClass = await context.targetSchema.lookupItem(itemKey, RelationshipClass);
42
+ if (relationshipClass === undefined) {
43
+ throw new Error(`Unable to locate the relationship class ${itemKey.name} in the merged schema.`);
44
+ }
45
+ const constraint = change.path === "$source"
46
+ ? relationshipClass.source
47
+ : relationshipClass.target;
48
+ return context.editor.relationships.addCustomAttributeToConstraint(constraint, caInstance);
49
+ }
50
+ }
51
+ /**
52
+ * @internal
53
+ */
54
+ export async function applyCustomAttributes(context, customAttributes, handler) {
55
+ for (const customAttribute of customAttributes) {
56
+ await applyCustomAttribute(context, customAttribute, handler);
57
+ }
58
+ }
59
+ /**
60
+ * @internal
61
+ */
62
+ export async function applyCustomAttribute(context, customAttribute, handler) {
63
+ customAttribute.className = await updateSchemaItemFullName(context, customAttribute.className);
64
+ return handler(customAttribute);
65
+ }
66
+ //# sourceMappingURL=CustomAttributeMerger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomAttributeMerger.js","sourceRoot":"","sources":["../../../src/Merging/CustomAttributeMerger.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAmB,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGpG,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAIlH;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAA2B,EAAE,MAAiC;IACrG,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,MAAM,aAAa,GAAG,MAAM,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAEtF,MAAM,0BAA0B,GAAG,MAAM,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAAC;IAC9G,IAAI,0BAA0B,KAAK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M,OAAO,GAAG,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QACpD,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAC5F,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,2CAA2C,OAAO,CAAC,IAAI,wBAAwB,CAAC,CAAC;QACnG,CAAC;QACD,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,KAAK,SAAS;YAC1C,CAAC,CAAC,iBAAiB,CAAC,MAAM;YAC1B,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC;QAE7B,OAAO,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,8BAA8B,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC7F,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAA2B,EAAE,gBAAmC,EAAE,OAA8B;IAC1I,KAAK,MAAM,eAAe,IAAI,gBAAgB,EAAE,CAAC;QAC/C,MAAM,oBAAoB,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAA2B,EAAE,eAAgC,EAAE,OAA8B;IACtI,eAAe,CAAC,SAAS,GAAG,MAAM,wBAAwB,CAAC,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAC/F,OAAO,OAAO,CAAC,eAAe,CAAC,CAAC;AAClC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { CustomAttribute, CustomAttributeClass, RelationshipClass } from \"@itwin/ecschema-metadata\";\nimport { type SchemaMergeContext } from \"./SchemaMerger\";\nimport { type CustomAttributeDifference } from \"../Differencing/SchemaDifference\";\nimport { getClassEditor, toItemKey, toPropertyKey, updateSchemaItemFullName, updateSchemaItemKey } from \"./Utils\";\n\ntype CustomAttributeSetter = (customAttribute: CustomAttribute) => Promise<void>;\n\n/**\n * Merges a new CustomAttributes from Schema, items or properties into the target schema.\n * @internal\n */\nexport async function addCustomAttribute(context: SchemaMergeContext, change: CustomAttributeDifference): Promise<void> {\n if (change.difference.className === undefined) {\n throw new Error(\"CustomAttribute instance must specify className\");\n }\n const schemaItemKey = await updateSchemaItemKey(context, change.difference.className);\n\n const targetCustomAttributeClass = await context.targetSchema.lookupItem(schemaItemKey, CustomAttributeClass);\n if (targetCustomAttributeClass === undefined) {\n throw new Error(`Unable to locate the custom attribute class ${schemaItemKey.name} in the merged schema.`);\n }\n\n const caInstance: CustomAttribute = {\n ...change.difference,\n className: schemaItemKey.fullName,\n };\n\n if (change.appliedTo === \"Schema\") {\n await context.editor.addCustomAttribute(context.targetSchemaKey, caInstance);\n }\n if (change.appliedTo === \"SchemaItem\") {\n const itemKey = toItemKey(context, change.itemName);\n const editor = await getClassEditor(context, itemKey);\n await editor.addCustomAttribute(itemKey, caInstance);\n }\n if (change.appliedTo === \"Property\") {\n const itemKey = toItemKey(context, change.itemName);\n const [propertyName] = change.path.split(\".\");\n const propertyKey = toPropertyKey(context, change.itemName, propertyName);\n const editor = await getClassEditor(context, itemKey);\n await editor.properties.addCustomAttribute(itemKey, propertyKey.propertyName, caInstance);\n }\n if (change.appliedTo === \"RelationshipConstraint\") {\n const itemKey = toItemKey(context, change.itemName);\n const relationshipClass = await context.targetSchema.lookupItem(itemKey, RelationshipClass);\n if (relationshipClass === undefined) {\n throw new Error(`Unable to locate the relationship class ${itemKey.name} in the merged schema.`);\n }\n const constraint = change.path === \"$source\"\n ? relationshipClass.source\n : relationshipClass.target;\n\n return context.editor.relationships.addCustomAttributeToConstraint(constraint, caInstance);\n }\n}\n\n/**\n * @internal\n */\nexport async function applyCustomAttributes(context: SchemaMergeContext, customAttributes: CustomAttribute[], handler: CustomAttributeSetter): Promise<void> {\n for (const customAttribute of customAttributes) {\n await applyCustomAttribute(context, customAttribute, handler);\n }\n}\n\n/**\n * @internal\n */\nexport async function applyCustomAttribute(context: SchemaMergeContext, customAttribute: CustomAttribute, handler: CustomAttributeSetter): Promise<void> {\n customAttribute.className = await updateSchemaItemFullName(context, customAttribute.className);\n return handler(customAttribute);\n}\n"]}
@@ -0,0 +1,22 @@
1
+ /** @packageDocumentation
2
+ * @module Merging
3
+ */
4
+ import { SchemaItemKey } from "@itwin/ecschema-metadata";
5
+ export declare class PropertyKey {
6
+ readonly propertyName: string;
7
+ readonly classKey: SchemaItemKey;
8
+ get fullName(): string;
9
+ constructor(propertyName: string, classKey: SchemaItemKey);
10
+ }
11
+ /**
12
+ * @internal
13
+ */
14
+ export declare class NameMapping {
15
+ private readonly _map;
16
+ constructor();
17
+ addItemMapping(itemKey: string, newName: string): void;
18
+ addPropertyMapping(propertyKey: string, newName: string): void;
19
+ resolveItemKey(itemKey: Readonly<SchemaItemKey>): Readonly<SchemaItemKey>;
20
+ resolvePropertyKey(propertyKey: Readonly<PropertyKey>): Readonly<PropertyKey>;
21
+ }
22
+ //# sourceMappingURL=NameMapping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NameMapping.d.ts","sourceRoot":"","sources":["../../../../src/Merging/Edits/NameMapping.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAMzD,qBAAa,WAAW;IACtB,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,QAAQ,EAAE,aAAa,CAAC;IAExC,IAAW,QAAQ,IAAI,MAAM,CAE5B;gBAEW,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa;CAI1D;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA4B;;IAM1C,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAI/C,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAIvD,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC;IASzE,kBAAkB,CAAC,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC;CAQrF"}
@@ -0,0 +1,49 @@
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 Merging
7
+ */
8
+ import { SchemaItemKey } from "@itwin/ecschema-metadata";
9
+ export class PropertyKey {
10
+ propertyName;
11
+ classKey;
12
+ get fullName() {
13
+ return `${this.classKey.fullName}.${this.propertyName}`;
14
+ }
15
+ constructor(propertyName, classKey) {
16
+ this.propertyName = propertyName;
17
+ this.classKey = classKey;
18
+ }
19
+ }
20
+ /**
21
+ * @internal
22
+ */
23
+ export class NameMapping {
24
+ _map;
25
+ constructor() {
26
+ this._map = new Map();
27
+ }
28
+ addItemMapping(itemKey, newName) {
29
+ this._map.set(itemKey, { newName });
30
+ }
31
+ addPropertyMapping(propertyKey, newName) {
32
+ this._map.set(propertyKey, { newName });
33
+ }
34
+ resolveItemKey(itemKey) {
35
+ const entry = this._map.get(itemKey.fullName);
36
+ if (entry === undefined) {
37
+ return itemKey;
38
+ }
39
+ return new SchemaItemKey(entry.newName, itemKey.schemaKey);
40
+ }
41
+ resolvePropertyKey(propertyKey) {
42
+ const entry = this._map.get(propertyKey.fullName);
43
+ if (entry === undefined) {
44
+ return propertyKey;
45
+ }
46
+ return new PropertyKey(entry.newName, propertyKey.classKey);
47
+ }
48
+ }
49
+ //# sourceMappingURL=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C1D,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAG,KAAK,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,WAAW,CAAC;QACrB,CAAC;QAED,OAAO,IAAI,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC9D,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 Merging\n */\nimport { SchemaItemKey } from \"@itwin/ecschema-metadata\";\n\ninterface MappingEntry {\n readonly newName: string;\n}\n\nexport class PropertyKey {\n public readonly propertyName: string;\n public readonly classKey: SchemaItemKey;\n\n public get fullName(): string {\n return `${this.classKey.fullName}.${this.propertyName}`;\n }\n\n constructor(propertyName: string, classKey: SchemaItemKey) {\n this.propertyName = propertyName;\n this.classKey = classKey;\n }\n}\n\n/**\n * @internal\n */\nexport class NameMapping {\n private readonly _map: Map<string, MappingEntry>;\n\n constructor() {\n this._map = new Map<string, MappingEntry>();\n }\n\n public addItemMapping(itemKey: string, newName: string) {\n this._map.set(itemKey, { newName });\n }\n\n public addPropertyMapping(propertyKey: string, newName: string) {\n this._map.set(propertyKey, { newName });\n }\n\n public resolveItemKey(itemKey: Readonly<SchemaItemKey>): Readonly<SchemaItemKey> {\n const entry = this._map.get(itemKey.fullName);\n if(entry === undefined) {\n return itemKey;\n }\n\n return new SchemaItemKey(entry.newName, itemKey.schemaKey);\n }\n\n public resolvePropertyKey(propertyKey: Readonly<PropertyKey>): Readonly<PropertyKey> {\n const entry = this._map.get(propertyKey.fullName);\n if(entry === undefined) {\n return propertyKey;\n }\n\n return new PropertyKey(entry.newName, propertyKey.classKey);\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ /** @packageDocumentation
2
+ * @module Merging
3
+ */
4
+ import type { RenamePropertyEdit, RenameSchemaItemEdit } from "./SchemaEdits";
5
+ import { SchemaDifferenceResult } from "../../Differencing/SchemaDifference";
6
+ /**
7
+ * @internal
8
+ */
9
+ export declare function applyRenamePropertyEdit(result: SchemaDifferenceResult, edit: RenamePropertyEdit): void;
10
+ /**
11
+ * @internal
12
+ */
13
+ export declare function applyRenameSchemaItemEdit(result: SchemaDifferenceResult, edit: RenameSchemaItemEdit): void;
14
+ //# sourceMappingURL=RenameEditHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenameEditHandler.d.ts","sourceRoot":"","sources":["../../../../src/Merging/Edits/RenameEditHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAmD,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAQ9H;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,sBAAsB,EAAE,IAAI,EAAE,kBAAkB,QAuB/F;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,sBAAsB,EAAE,IAAI,EAAE,oBAAoB,QAuBnG"}
@@ -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 Merging
7
+ */
8
+ import { SchemaItem } from "@itwin/ecschema-metadata";
9
+ import * as Utils from "../../Differencing/Utils";
10
+ /**
11
+ * @internal
12
+ */
13
+ export function applyRenamePropertyEdit(result, edit) {
14
+ const [schemaName, itemName, path] = edit.key.split(".");
15
+ if (!result.sourceSchemaName.startsWith(schemaName)) {
16
+ return;
17
+ }
18
+ const difference = result.differences.find((entry) => {
19
+ return Utils.isClassPropertyDifference(entry) && entry.changeType === "add" && entry.itemName === itemName && entry.path === path;
20
+ });
21
+ const propertyDifference = difference;
22
+ if (propertyDifference === undefined) {
23
+ return;
24
+ }
25
+ propertyDifference.path = edit.value;
26
+ if (result.conflicts) {
27
+ const conflictIndex = result.conflicts.findIndex((entry) => entry.difference === propertyDifference);
28
+ if (conflictIndex > -1) {
29
+ result.conflicts.splice(conflictIndex, 1);
30
+ }
31
+ }
32
+ }
33
+ /**
34
+ * @internal
35
+ */
36
+ export function applyRenameSchemaItemEdit(result, edit) {
37
+ const [schemaName, itemName] = SchemaItem.parseFullName(edit.key);
38
+ if (!result.sourceSchemaName.startsWith(schemaName)) {
39
+ return;
40
+ }
41
+ const difference = result.differences.find((entry) => {
42
+ return Utils.isSchemaItemDifference(entry) && entry.changeType === "add" && entry.itemName === itemName;
43
+ });
44
+ const itemDifference = difference;
45
+ if (itemDifference === undefined) {
46
+ return;
47
+ }
48
+ renameName(itemDifference, itemName, edit.value);
49
+ if (result.conflicts) {
50
+ const conflictIndex = result.conflicts.findIndex((entry) => entry.difference === itemDifference);
51
+ if (conflictIndex > -1) {
52
+ result.conflicts.splice(conflictIndex, 1);
53
+ }
54
+ }
55
+ }
56
+ function renameName(change, oldName, newName) {
57
+ if (change.itemName === oldName) {
58
+ const schemaItemDifference = change;
59
+ schemaItemDifference.itemName = newName;
60
+ }
61
+ }
62
+ //# sourceMappingURL=RenameEditHandler.js.map