@itwin/ecschema-editing 5.0.0-dev.7 → 5.0.0-dev.72

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 (196) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/lib/cjs/Differencing/Errors.js +6 -0
  3. package/lib/cjs/Differencing/Errors.js.map +1 -1
  4. package/lib/cjs/Differencing/SchemaConflicts.d.ts +3 -1
  5. package/lib/cjs/Differencing/SchemaConflicts.d.ts.map +1 -1
  6. package/lib/cjs/Differencing/SchemaConflicts.js +2 -0
  7. package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
  8. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts +4 -3
  9. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
  10. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +57 -11
  11. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
  12. package/lib/cjs/Differencing/SchemaDifference.d.ts +33 -4
  13. package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
  14. package/lib/cjs/Differencing/SchemaDifference.js +55 -5
  15. package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
  16. package/lib/cjs/Differencing/SchemaDifferenceValidator.d.ts +2 -1
  17. package/lib/cjs/Differencing/SchemaDifferenceValidator.d.ts.map +1 -1
  18. package/lib/cjs/Differencing/SchemaDifferenceValidator.js +78 -19
  19. package/lib/cjs/Differencing/SchemaDifferenceValidator.js.map +1 -1
  20. package/lib/cjs/Differencing/SchemaDifferenceVisitor.d.ts.map +1 -1
  21. package/lib/cjs/Differencing/SchemaDifferenceVisitor.js +5 -0
  22. package/lib/cjs/Differencing/SchemaDifferenceVisitor.js.map +1 -1
  23. package/lib/cjs/Editing/Constants.d.ts +2 -1
  24. package/lib/cjs/Editing/Constants.d.ts.map +1 -1
  25. package/lib/cjs/Editing/Constants.js +4 -1
  26. package/lib/cjs/Editing/Constants.js.map +1 -1
  27. package/lib/cjs/Editing/CustomAttributes.d.ts +2 -1
  28. package/lib/cjs/Editing/CustomAttributes.d.ts.map +1 -1
  29. package/lib/cjs/Editing/CustomAttributes.js +3 -0
  30. package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
  31. package/lib/cjs/Editing/ECClasses.d.ts +6 -0
  32. package/lib/cjs/Editing/ECClasses.d.ts.map +1 -1
  33. package/lib/cjs/Editing/ECClasses.js +48 -35
  34. package/lib/cjs/Editing/ECClasses.js.map +1 -1
  35. package/lib/cjs/Editing/Editor.d.ts +2 -2
  36. package/lib/cjs/Editing/Editor.d.ts.map +1 -1
  37. package/lib/cjs/Editing/Editor.js +32 -21
  38. package/lib/cjs/Editing/Editor.js.map +1 -1
  39. package/lib/cjs/Editing/Entities.d.ts +2 -1
  40. package/lib/cjs/Editing/Entities.d.ts.map +1 -1
  41. package/lib/cjs/Editing/Entities.js +18 -14
  42. package/lib/cjs/Editing/Entities.js.map +1 -1
  43. package/lib/cjs/Editing/Enumerations.d.ts +2 -1
  44. package/lib/cjs/Editing/Enumerations.d.ts.map +1 -1
  45. package/lib/cjs/Editing/Enumerations.js +6 -3
  46. package/lib/cjs/Editing/Enumerations.js.map +1 -1
  47. package/lib/cjs/Editing/Exception.js +35 -6
  48. package/lib/cjs/Editing/Exception.js.map +1 -1
  49. package/lib/cjs/Editing/Formats.d.ts +2 -1
  50. package/lib/cjs/Editing/Formats.d.ts.map +1 -1
  51. package/lib/cjs/Editing/Formats.js +5 -1
  52. package/lib/cjs/Editing/Formats.js.map +1 -1
  53. package/lib/cjs/Editing/InvertedUnits.d.ts +2 -1
  54. package/lib/cjs/Editing/InvertedUnits.d.ts.map +1 -1
  55. package/lib/cjs/Editing/InvertedUnits.js +10 -6
  56. package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
  57. package/lib/cjs/Editing/KindOfQuantities.d.ts +2 -1
  58. package/lib/cjs/Editing/KindOfQuantities.d.ts.map +1 -1
  59. package/lib/cjs/Editing/KindOfQuantities.js +11 -7
  60. package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
  61. package/lib/cjs/Editing/Mixins.d.ts +2 -1
  62. package/lib/cjs/Editing/Mixins.d.ts.map +1 -1
  63. package/lib/cjs/Editing/Mixins.js +13 -9
  64. package/lib/cjs/Editing/Mixins.js.map +1 -1
  65. package/lib/cjs/Editing/Mutable/MutableClass.d.ts +2 -1
  66. package/lib/cjs/Editing/Mutable/MutableClass.d.ts.map +1 -1
  67. package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
  68. package/lib/cjs/Editing/Mutable/MutableFormat.d.ts +8 -1
  69. package/lib/cjs/Editing/Mutable/MutableFormat.d.ts.map +1 -1
  70. package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
  71. package/lib/cjs/Editing/Phenomena.d.ts +2 -1
  72. package/lib/cjs/Editing/Phenomena.d.ts.map +1 -1
  73. package/lib/cjs/Editing/Phenomena.js +3 -0
  74. package/lib/cjs/Editing/Phenomena.js.map +1 -1
  75. package/lib/cjs/Editing/Properties.d.ts +2 -2
  76. package/lib/cjs/Editing/Properties.d.ts.map +1 -1
  77. package/lib/cjs/Editing/Properties.js +6 -4
  78. package/lib/cjs/Editing/Properties.js.map +1 -1
  79. package/lib/cjs/Editing/PropertyCategories.d.ts +2 -1
  80. package/lib/cjs/Editing/PropertyCategories.d.ts.map +1 -1
  81. package/lib/cjs/Editing/PropertyCategories.js +5 -1
  82. package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
  83. package/lib/cjs/Editing/RelationshipClasses.d.ts +1 -0
  84. package/lib/cjs/Editing/RelationshipClasses.d.ts.map +1 -1
  85. package/lib/cjs/Editing/RelationshipClasses.js +17 -10
  86. package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
  87. package/lib/cjs/Editing/SchemaItems.d.ts +2 -2
  88. package/lib/cjs/Editing/SchemaItems.d.ts.map +1 -1
  89. package/lib/cjs/Editing/SchemaItems.js +8 -11
  90. package/lib/cjs/Editing/SchemaItems.js.map +1 -1
  91. package/lib/cjs/Editing/Structs.d.ts +2 -1
  92. package/lib/cjs/Editing/Structs.d.ts.map +1 -1
  93. package/lib/cjs/Editing/Structs.js +3 -0
  94. package/lib/cjs/Editing/Structs.js.map +1 -1
  95. package/lib/cjs/Editing/UnitSystems.d.ts +2 -1
  96. package/lib/cjs/Editing/UnitSystems.d.ts.map +1 -1
  97. package/lib/cjs/Editing/UnitSystems.js +3 -0
  98. package/lib/cjs/Editing/UnitSystems.js.map +1 -1
  99. package/lib/cjs/Editing/Units.d.ts +2 -1
  100. package/lib/cjs/Editing/Units.d.ts.map +1 -1
  101. package/lib/cjs/Editing/Units.js +5 -2
  102. package/lib/cjs/Editing/Units.js.map +1 -1
  103. package/lib/cjs/Merging/ConstantMerger.js +4 -4
  104. package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
  105. package/lib/cjs/Merging/CustomAttributeMerger.d.ts.map +1 -1
  106. package/lib/cjs/Merging/CustomAttributeMerger.js +7 -6
  107. package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
  108. package/lib/cjs/Merging/Edits/NameMapping.d.ts +22 -0
  109. package/lib/cjs/Merging/Edits/NameMapping.d.ts.map +1 -0
  110. package/lib/cjs/Merging/Edits/NameMapping.js +54 -0
  111. package/lib/cjs/Merging/Edits/NameMapping.js.map +1 -0
  112. package/lib/cjs/Merging/Edits/RenameEditHandler.d.ts +1 -1
  113. package/lib/cjs/Merging/Edits/RenameEditHandler.d.ts.map +1 -1
  114. package/lib/cjs/Merging/Edits/RenameEditHandler.js +1 -260
  115. package/lib/cjs/Merging/Edits/RenameEditHandler.js.map +1 -1
  116. package/lib/cjs/Merging/Edits/SchemaEdits.d.ts +9 -6
  117. package/lib/cjs/Merging/Edits/SchemaEdits.d.ts.map +1 -1
  118. package/lib/cjs/Merging/Edits/SchemaEdits.js +19 -14
  119. package/lib/cjs/Merging/Edits/SchemaEdits.js.map +1 -1
  120. package/lib/cjs/Merging/EntityClassMerger.js +1 -2
  121. package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
  122. package/lib/cjs/Merging/EnumerationMerger.js +1 -1
  123. package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
  124. package/lib/cjs/Merging/EnumeratorMerger.d.ts.map +1 -1
  125. package/lib/cjs/Merging/EnumeratorMerger.js +2 -2
  126. package/lib/cjs/Merging/EnumeratorMerger.js.map +1 -1
  127. package/lib/cjs/Merging/FormatMerger.d.ts +24 -0
  128. package/lib/cjs/Merging/FormatMerger.d.ts.map +1 -0
  129. package/lib/cjs/Merging/FormatMerger.js +143 -0
  130. package/lib/cjs/Merging/FormatMerger.js.map +1 -0
  131. package/lib/cjs/Merging/InvertedUnitMerger.d.ts +14 -0
  132. package/lib/cjs/Merging/InvertedUnitMerger.d.ts.map +1 -0
  133. package/lib/cjs/Merging/InvertedUnitMerger.js +45 -0
  134. package/lib/cjs/Merging/InvertedUnitMerger.js.map +1 -0
  135. package/lib/cjs/Merging/KindOfQuantityMerger.d.ts +1 -1
  136. package/lib/cjs/Merging/KindOfQuantityMerger.d.ts.map +1 -1
  137. package/lib/cjs/Merging/KindOfQuantityMerger.js +4 -5
  138. package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
  139. package/lib/cjs/Merging/MixinMerger.js +1 -1
  140. package/lib/cjs/Merging/MixinMerger.js.map +1 -1
  141. package/lib/cjs/Merging/PhenomenonMerger.js +1 -1
  142. package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
  143. package/lib/cjs/Merging/PropertyMerger.js +28 -26
  144. package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
  145. package/lib/cjs/Merging/RelationshipClassMerger.d.ts.map +1 -1
  146. package/lib/cjs/Merging/RelationshipClassMerger.js +4 -4
  147. package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
  148. package/lib/cjs/Merging/SchemaMerger.d.ts +5 -3
  149. package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
  150. package/lib/cjs/Merging/SchemaMerger.js +40 -5
  151. package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
  152. package/lib/cjs/Merging/SchemaMergingVisitor.d.ts +14 -8
  153. package/lib/cjs/Merging/SchemaMergingVisitor.d.ts.map +1 -1
  154. package/lib/cjs/Merging/SchemaMergingVisitor.js +42 -17
  155. package/lib/cjs/Merging/SchemaMergingVisitor.js.map +1 -1
  156. package/lib/cjs/Merging/SchemaMergingWalker.d.ts.map +1 -1
  157. package/lib/cjs/Merging/SchemaMergingWalker.js +2 -0
  158. package/lib/cjs/Merging/SchemaMergingWalker.js.map +1 -1
  159. package/lib/cjs/Merging/UnitMerger.d.ts +14 -0
  160. package/lib/cjs/Merging/UnitMerger.d.ts.map +1 -0
  161. package/lib/cjs/Merging/UnitMerger.js +62 -0
  162. package/lib/cjs/Merging/UnitMerger.js.map +1 -0
  163. package/lib/cjs/Merging/Utils.d.ts +11 -0
  164. package/lib/cjs/Merging/Utils.d.ts.map +1 -1
  165. package/lib/cjs/Merging/Utils.js +23 -3
  166. package/lib/cjs/Merging/Utils.js.map +1 -1
  167. package/lib/cjs/Validation/Diagnostic.js +18 -16
  168. package/lib/cjs/Validation/Diagnostic.js.map +1 -1
  169. package/lib/cjs/Validation/DiagnosticReporter.js +3 -0
  170. package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
  171. package/lib/cjs/Validation/ECRules.js +1 -1
  172. package/lib/cjs/Validation/ECRules.js.map +1 -1
  173. package/lib/cjs/Validation/SchemaChanges.js +39 -69
  174. package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
  175. package/lib/cjs/Validation/SchemaCompareDiagnostics.d.ts +2 -2
  176. package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
  177. package/lib/cjs/Validation/SchemaCompareResultDelegate.d.ts +1 -1
  178. package/lib/cjs/Validation/SchemaCompareResultDelegate.d.ts.map +1 -1
  179. package/lib/cjs/Validation/SchemaCompareResultDelegate.js +4 -1
  180. package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
  181. package/lib/cjs/Validation/SchemaCompareVisitor.d.ts.map +1 -1
  182. package/lib/cjs/Validation/SchemaCompareVisitor.js +23 -23
  183. package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
  184. package/lib/cjs/Validation/SchemaComparer.d.ts +22 -1
  185. package/lib/cjs/Validation/SchemaComparer.d.ts.map +1 -1
  186. package/lib/cjs/Validation/SchemaComparer.js +30 -5
  187. package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
  188. package/lib/cjs/Validation/SchemaValidater.js +1 -4
  189. package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
  190. package/lib/cjs/Validation/SchemaValidationVisitor.js +3 -4
  191. package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
  192. package/lib/cjs/Validation/SchemaWalker.d.ts +1 -1
  193. package/lib/cjs/Validation/SchemaWalker.d.ts.map +1 -1
  194. package/lib/cjs/Validation/SchemaWalker.js +4 -0
  195. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  196. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaDifferenceVisitor.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifferenceVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA0D;AAC1D,yDAAgF;AAWhF;;;;GAIG;AACH,MAAa,sBAAsB;IAIjC,kEAAkE;IAClE,YAAY,OAAgC;QAC1C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,QAAQ,CAAC,WAAuC;QAC3D,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;YACnD,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAED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sB;gBAC1C,OAAO,IAAI,CAAC,QAAQ,CAAC,qCAAqC,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACvF,KAAK,mCAAgB,CAAC,2BAA2B;gBAC/C,OAAO,IAAI,CAAC,QAAQ,CAAC,0CAA0C,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC5F,KAAK,kCAAc,CAAC,WAAW;gBAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,0BAA0B,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC5E,KAAK,kCAAc,CAAC,IAAI;gBACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACrE,KAAK,kCAAc,CAAC,UAAU;gBAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,yBAAyB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;CACF;AAxED,wDAwEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Differencing\r\n */\r\n\r\nimport { SchemaItemType } from \"@itwin/ecschema-metadata\";\r\nimport { type AnySchemaDifference, SchemaOtherTypes } from \"./SchemaDifference\";\r\n\r\n/**\r\n * Defines the interface for a visitor that can be used to traverse schema differences.\r\n * It dynamically creates a method for each schema difference type.\r\n * @internal\r\n */\r\nexport type SchemaDifferenceVisitor = {\r\n [Difference in AnySchemaDifference as `visit${Difference[\"schemaType\"]}Difference`]: (entry: Difference, index: number, array: AnySchemaDifference[]) => Promise<void>;\r\n};\r\n\r\n/**\r\n * Implementation of a walker that traverses schema differences and calls the appropriate\r\n * method on the visitor.\r\n * @internal\r\n */\r\nexport class SchemaDifferenceWalker {\r\n\r\n private readonly _visitor: SchemaDifferenceVisitor;\r\n\r\n /** Initializes a new instance of SchemaDifferenceWalker class. */\r\n constructor(visitor: SchemaDifferenceVisitor) {\r\n this._visitor = visitor;\r\n }\r\n\r\n /**\r\n * Traverses the schema differences and calls the appropriate method on the visitor.\r\n * @param differences The differences to traverse.\r\n */\r\n public async traverse(differences: Array<AnySchemaDifference>): Promise<void> {\r\n for (const [index, entry] of differences.entries()) {\r\n await this.visit(entry, index, differences);\r\n }\r\n }\r\n\r\n /**\r\n * Calls the appropriate method on the visitor based on the schema difference type.\r\n */\r\n private async visit(difference: AnySchemaDifference, index: number, array: AnySchemaDifference[]) {\r\n switch (difference.schemaType) {\r\n case SchemaOtherTypes.Schema:\r\n return this._visitor.visitSchemaDifference(difference, index, array);\r\n case SchemaOtherTypes.SchemaReference:\r\n return this._visitor.visitSchemaReferenceDifference(difference, index, array);\r\n case SchemaItemType.Constant:\r\n return this._visitor.visitConstantDifference(difference, index, array);\r\n case SchemaItemType.CustomAttributeClass:\r\n return this._visitor.visitCustomAttributeClassDifference(difference, index, array);\r\n case SchemaOtherTypes.CustomAttributeInstance:\r\n return this._visitor.visitCustomAttributeInstanceDifference(difference, index, array);\r\n case SchemaItemType.EntityClass:\r\n return this._visitor.visitEntityClassDifference(difference, index, array);\r\n case SchemaOtherTypes.EntityClassMixin:\r\n return this._visitor.visitEntityClassMixinDifference(difference, index, array);\r\n case SchemaItemType.Enumeration:\r\n return this._visitor.visitEnumerationDifference(difference, index, array);\r\n case SchemaOtherTypes.Enumerator:\r\n return this._visitor.visitEnumeratorDifference(difference, index, array);\r\n case SchemaItemType.Format:\r\n return this._visitor.visitFormatDifference(difference, index, array);\r\n case SchemaItemType.InvertedUnit:\r\n return this._visitor.visitInvertedUnitDifference(difference, index, array);\r\n case SchemaItemType.KindOfQuantity:\r\n return this._visitor.visitKindOfQuantityDifference(difference, index, array);\r\n case SchemaOtherTypes.KindOfQuantityPresentationFormat:\r\n return this._visitor.visitKindOfQuantityPresentationFormatDifference(difference, index, array);\r\n case SchemaItemType.Mixin:\r\n return this._visitor.visitMixinDifference(difference, index, array);\r\n case SchemaItemType.Phenomenon:\r\n return this._visitor.visitPhenomenonDifference(difference, index, array);\r\n case SchemaOtherTypes.Property:\r\n return this._visitor.visitPropertyDifference(difference, index, array);\r\n case SchemaItemType.PropertyCategory:\r\n return this._visitor.visitPropertyCategoryDifference(difference, index, array);\r\n case SchemaItemType.RelationshipClass:\r\n return this._visitor.visitRelationshipClassDifference(difference, index, array);\r\n case SchemaOtherTypes.RelationshipConstraint:\r\n return this._visitor.visitRelationshipConstraintDifference(difference, index, array);\r\n case SchemaOtherTypes.RelationshipConstraintClass:\r\n return this._visitor.visitRelationshipConstraintClassDifference(difference, index, array);\r\n case SchemaItemType.StructClass:\r\n return this._visitor.visitStructClassDifference(difference, index, array);\r\n case SchemaItemType.Unit:\r\n return this._visitor.visitUnitDifference(difference, index, array);\r\n case SchemaItemType.UnitSystem:\r\n return this._visitor.visitUnitSystemDifference(difference, index, array);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SchemaDifferenceVisitor.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifferenceVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA0D;AAC1D,yDAAgF;AAWhF;;;;GAIG;AACH,MAAa,sBAAsB;IAEhB,QAAQ,CAA0B;IAEnD,kEAAkE;IAClE,YAAY,OAAgC;QAC1C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,QAAQ,CAAC,WAAuC;QAC3D,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;YACnD,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IA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gB;gBAClC,OAAO,IAAI,CAAC,QAAQ,CAAC,+BAA+B,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACjF,KAAK,kCAAc,CAAC,iBAAiB;gBACnC,OAAO,IAAI,CAAC,QAAQ,CAAC,gCAAgC,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAClF,KAAK,mCAAgB,CAAC,sBAAsB;gBAC1C,OAAO,IAAI,CAAC,QAAQ,CAAC,qCAAqC,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACvF,KAAK,mCAAgB,CAAC,2BAA2B;gBAC/C,OAAO,IAAI,CAAC,QAAQ,CAAC,0CAA0C,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC5F,KAAK,kCAAc,CAAC,WAAW;gBAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,0BAA0B,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC5E,KAAK,kCAAc,CAAC,IAAI;gBACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACrE,KAAK,kCAAc,CAAC,UAAU;gBAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,yBAAyB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;CACF;AA5ED,wDA4EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Differencing\r\n */\r\n\r\nimport { SchemaItemType } from \"@itwin/ecschema-metadata\";\r\nimport { type AnySchemaDifference, SchemaOtherTypes } from \"./SchemaDifference\";\r\n\r\n/**\r\n * Defines the interface for a visitor that can be used to traverse schema differences.\r\n * It dynamically creates a method for each schema difference type.\r\n * @internal\r\n */\r\nexport type SchemaDifferenceVisitor = {\r\n [Difference in AnySchemaDifference as `visit${Difference[\"schemaType\"]}Difference`]: (entry: Difference, index: number, array: AnySchemaDifference[]) => Promise<void>;\r\n};\r\n\r\n/**\r\n * Implementation of a walker that traverses schema differences and calls the appropriate\r\n * method on the visitor.\r\n * @internal\r\n */\r\nexport class SchemaDifferenceWalker {\r\n\r\n private readonly _visitor: SchemaDifferenceVisitor;\r\n\r\n /** Initializes a new instance of SchemaDifferenceWalker class. */\r\n constructor(visitor: SchemaDifferenceVisitor) {\r\n this._visitor = visitor;\r\n }\r\n\r\n /**\r\n * Traverses the schema differences and calls the appropriate method on the visitor.\r\n * @param differences The differences to traverse.\r\n */\r\n public async traverse(differences: Array<AnySchemaDifference>): Promise<void> {\r\n for (const [index, entry] of differences.entries()) {\r\n await this.visit(entry, index, differences);\r\n }\r\n }\r\n\r\n /**\r\n * Calls the appropriate method on the visitor based on the schema difference type.\r\n */\r\n private async visit(difference: AnySchemaDifference, index: number, array: AnySchemaDifference[]) {\r\n switch (difference.schemaType) {\r\n case SchemaOtherTypes.Schema:\r\n return this._visitor.visitSchemaDifference(difference, index, array);\r\n case SchemaOtherTypes.SchemaReference:\r\n return this._visitor.visitSchemaReferenceDifference(difference, index, array);\r\n case SchemaItemType.Constant:\r\n return this._visitor.visitConstantDifference(difference, index, array);\r\n case SchemaItemType.CustomAttributeClass:\r\n return this._visitor.visitCustomAttributeClassDifference(difference, index, array);\r\n case SchemaOtherTypes.CustomAttributeInstance:\r\n return this._visitor.visitCustomAttributeInstanceDifference(difference, index, array);\r\n case SchemaItemType.EntityClass:\r\n return this._visitor.visitEntityClassDifference(difference, index, array);\r\n case SchemaOtherTypes.EntityClassMixin:\r\n return this._visitor.visitEntityClassMixinDifference(difference, index, array);\r\n case SchemaItemType.Enumeration:\r\n return this._visitor.visitEnumerationDifference(difference, index, array);\r\n case SchemaOtherTypes.Enumerator:\r\n return this._visitor.visitEnumeratorDifference(difference, index, array);\r\n case SchemaItemType.Format:\r\n return this._visitor.visitFormatDifference(difference, index, array);\r\n case SchemaOtherTypes.FormatUnit:\r\n return this._visitor.visitFormatUnitDifference(difference, index, array);\r\n case SchemaOtherTypes.FormatUnitLabel:\r\n return this._visitor.visitFormatUnitLabelDifference(difference, index, array);\r\n case SchemaItemType.InvertedUnit:\r\n return this._visitor.visitInvertedUnitDifference(difference, index, array);\r\n case SchemaItemType.KindOfQuantity:\r\n return this._visitor.visitKindOfQuantityDifference(difference, index, array);\r\n case SchemaOtherTypes.KindOfQuantityPresentationFormat:\r\n return this._visitor.visitKindOfQuantityPresentationFormatDifference(difference, index, array);\r\n case SchemaItemType.Mixin:\r\n return this._visitor.visitMixinDifference(difference, index, array);\r\n case SchemaItemType.Phenomenon:\r\n return this._visitor.visitPhenomenonDifference(difference, index, array);\r\n case SchemaOtherTypes.Property:\r\n return this._visitor.visitPropertyDifference(difference, index, array);\r\n case SchemaItemType.PropertyCategory:\r\n return this._visitor.visitPropertyCategoryDifference(difference, index, array);\r\n case SchemaItemType.RelationshipClass:\r\n return this._visitor.visitRelationshipClassDifference(difference, index, array);\r\n case SchemaOtherTypes.RelationshipConstraint:\r\n return this._visitor.visitRelationshipConstraintDifference(difference, index, array);\r\n case SchemaOtherTypes.RelationshipConstraintClass:\r\n return this._visitor.visitRelationshipConstraintClassDifference(difference, index, array);\r\n case SchemaItemType.StructClass:\r\n return this._visitor.visitStructClassDifference(difference, index, array);\r\n case SchemaItemType.Unit:\r\n return this._visitor.visitUnitDifference(difference, index, array);\r\n case SchemaItemType.UnitSystem:\r\n return this._visitor.visitUnitSystemDifference(difference, index, array);\r\n }\r\n }\r\n}\r\n"]}
@@ -1,7 +1,7 @@
1
1
  /** @packageDocumentation
2
2
  * @module Editing
3
3
  */
4
- import { ConstantProps, SchemaItemKey, SchemaKey } from "@itwin/ecschema-metadata";
4
+ import { Constant, ConstantProps, SchemaItemKey, SchemaKey } from "@itwin/ecschema-metadata";
5
5
  import { SchemaContextEditor } from "./Editor";
6
6
  import { SchemaItems } from "./SchemaItems";
7
7
  /**
@@ -9,6 +9,7 @@ import { SchemaItems } from "./SchemaItems";
9
9
  * A class allowing you to create schema items of type Constant.
10
10
  */
11
11
  export declare class Constants extends SchemaItems {
12
+ protected get itemTypeClass(): typeof Constant;
12
13
  constructor(schemaEditor: SchemaContextEditor);
13
14
  create(schemaKey: SchemaKey, name: string, phenomenon: SchemaItemKey, definition: string, displayLabel?: string, numerator?: number, denominator?: number): Promise<SchemaItemKey>;
14
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../../src/Editing/Constants.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAY,aAAa,EAAuC,aAAa,EAAkB,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAClJ,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,qBAAa,SAAU,SAAQ,WAAW;gBACrB,YAAY,EAAE,mBAAmB;IAIvC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAwB/L;;;;OAIG;IACU,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;CAQzG"}
1
+ {"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../../src/Editing/Constants.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAuC,aAAa,EAAkB,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAClJ,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,qBAAa,SAAU,SAAQ,WAAW;IACxC,cAAuB,aAAa,IAAI,OAAO,QAAQ,CAEtD;gBAEkB,YAAY,EAAE,mBAAmB;IAIvC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAwB/L;;;;OAIG;IACU,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;CAQzG"}
@@ -16,13 +16,16 @@ const SchemaItems_1 = require("./SchemaItems");
16
16
  * A class allowing you to create schema items of type Constant.
17
17
  */
18
18
  class Constants extends SchemaItems_1.SchemaItems {
19
+ get itemTypeClass() {
20
+ return ecschema_metadata_1.Constant;
21
+ }
19
22
  constructor(schemaEditor) {
20
23
  super(ecschema_metadata_1.SchemaItemType.Constant, schemaEditor);
21
24
  }
22
25
  async create(schemaKey, name, phenomenon, definition, displayLabel, numerator, denominator) {
23
26
  try {
24
27
  const newConstant = await this.createSchemaItem(schemaKey, this.schemaItemType, (schema) => schema.createConstant.bind(schema), name);
25
- const newPhenomenon = (await this.getSchemaItem(phenomenon, ecschema_metadata_1.SchemaItemType.Phenomenon));
28
+ const newPhenomenon = (await this.getSchemaItem(phenomenon, ecschema_metadata_1.Phenomenon));
26
29
  newConstant.setPhenomenon(new ecschema_metadata_1.DelayedPromiseWithProps(newPhenomenon.key, async () => newPhenomenon));
27
30
  newConstant.setDefinition(definition);
28
31
  if (numerator)
@@ -1 +1 @@
1
- {"version":3,"file":"Constants.js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I,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAClI,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,aAA4B;QAC7E,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,CAAC;YACxJ,OAAO,WAAW,CAAC,GAAG,CAAC;QACzB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACpJ,CAAC;IACH,CAAC;CACF;AA1CD,8BA0CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Editing\r\n */\r\n\r\nimport { Constant, ConstantProps, DelayedPromiseWithProps, Phenomenon, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableConstant } from \"./Mutable/MutableConstant\";\r\nimport { ECEditingStatus, SchemaEditingError, SchemaItemId } from \"./Exception\";\r\nimport { SchemaItems } from \"./SchemaItems\";\r\n\r\n/**\r\n * @alpha\r\n * A class allowing you to create schema items of type Constant.\r\n */\r\nexport class Constants extends SchemaItems {\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.Constant, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, phenomenon: SchemaItemKey, definition: string, displayLabel?: string, numerator?: number, denominator?: number): Promise<SchemaItemKey> {\r\n try {\r\n const newConstant = await this.createSchemaItem<Constant>(schemaKey, this.schemaItemType, (schema) => schema.createConstant.bind(schema), name) as MutableConstant;\r\n\r\n const newPhenomenon = (await this.getSchemaItem<Phenomenon>(phenomenon, SchemaItemType.Phenomenon));\r\n newConstant.setPhenomenon(new DelayedPromiseWithProps<SchemaItemKey, Phenomenon>(newPhenomenon.key, async () => newPhenomenon));\r\n\r\n newConstant.setDefinition(definition);\r\n\r\n if (numerator)\r\n newConstant.setNumerator(numerator);\r\n\r\n if (denominator)\r\n newConstant.setDenominator(denominator);\r\n\r\n if (displayLabel)\r\n newConstant.setDisplayLabel(displayLabel);\r\n\r\n return newConstant.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a Constant through a ConstantProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, constantProps: ConstantProps): Promise<SchemaItemKey> {\r\n try {\r\n const newConstant = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createConstant.bind(schema), constantProps);\r\n return newConstant.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, constantProps.name!, schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../src/Editing/Constants.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAkJ;AAGlJ,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;A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,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,aAA4B;QAC7E,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,CAAC;YACxJ,OAAO,WAAW,CAAC,GAAG,CAAC;QACzB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACpJ,CAAC;IACH,CAAC;CACF;AA9CD,8BA8CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Editing\r\n */\r\n\r\nimport { Constant, ConstantProps, DelayedPromiseWithProps, Phenomenon, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableConstant } from \"./Mutable/MutableConstant\";\r\nimport { ECEditingStatus, SchemaEditingError, SchemaItemId } from \"./Exception\";\r\nimport { SchemaItems } from \"./SchemaItems\";\r\n\r\n/**\r\n * @alpha\r\n * A class allowing you to create schema items of type Constant.\r\n */\r\nexport class Constants extends SchemaItems {\r\n protected override get itemTypeClass(): typeof Constant {\r\n return Constant;\r\n }\r\n\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.Constant, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, phenomenon: SchemaItemKey, definition: string, displayLabel?: string, numerator?: number, denominator?: number): Promise<SchemaItemKey> {\r\n try {\r\n const newConstant = await this.createSchemaItem<Constant>(schemaKey, this.schemaItemType, (schema) => schema.createConstant.bind(schema), name) as MutableConstant;\r\n\r\n const newPhenomenon = (await this.getSchemaItem(phenomenon, Phenomenon));\r\n newConstant.setPhenomenon(new DelayedPromiseWithProps<SchemaItemKey, Phenomenon>(newPhenomenon.key, async () => newPhenomenon));\r\n\r\n newConstant.setDefinition(definition);\r\n\r\n if (numerator)\r\n newConstant.setNumerator(numerator);\r\n\r\n if (denominator)\r\n newConstant.setDenominator(denominator);\r\n\r\n if (displayLabel)\r\n newConstant.setDisplayLabel(displayLabel);\r\n\r\n return newConstant.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a Constant through a ConstantProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, constantProps: ConstantProps): Promise<SchemaItemKey> {\r\n try {\r\n const newConstant = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createConstant.bind(schema), constantProps);\r\n return newConstant.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, constantProps.name!, schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -1,7 +1,7 @@
1
1
  /** @packageDocumentation
2
2
  * @module Editing
3
3
  */
4
- import { CustomAttributeClassProps, CustomAttributeContainerType, SchemaItemKey, SchemaKey } from "@itwin/ecschema-metadata";
4
+ import { CustomAttributeClass, CustomAttributeClassProps, CustomAttributeContainerType, SchemaItemKey, SchemaKey } from "@itwin/ecschema-metadata";
5
5
  import { SchemaContextEditor } from "./Editor";
6
6
  import { ECClasses } from "./ECClasses";
7
7
  /**
@@ -10,6 +10,7 @@ import { ECClasses } from "./ECClasses";
10
10
  */
11
11
  export declare class CustomAttributes extends ECClasses {
12
12
  constructor(schemaEditor: SchemaContextEditor);
13
+ protected get itemTypeClass(): typeof CustomAttributeClass;
13
14
  create(schemaKey: SchemaKey, name: string, appliesTo: CustomAttributeContainerType, displayLabel?: string, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey>;
14
15
  /**
15
16
  * Creates a CustomAttributeClass through a CustomAttributeClassProps.
@@ -1 +1 @@
1
- {"version":3,"file":"CustomAttributes.d.ts","sourceRoot":"","sources":["../../../src/Editing/CustomAttributes.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAEL,yBAAyB,EAAE,4BAA4B,EACvD,aAAa,EAAkB,SAAS,EACzC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;gBAC1B,YAAY,EAAE,mBAAmB;IAIvC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,4BAA4B,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAc7K;;;;OAIG;IACU,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAC;CAQ/G"}
1
+ {"version":3,"file":"CustomAttributes.d.ts","sourceRoot":"","sources":["../../../src/Editing/CustomAttributes.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EAAE,4BAA4B,EACvD,aAAa,EAAkB,SAAS,EACzC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;gBAC1B,YAAY,EAAE,mBAAmB;IAIpD,cAAuB,aAAa,IAAI,OAAO,oBAAoB,CAElE;IAEY,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,4BAA4B,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAc7K;;;;OAIG;IACU,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAC;CAQ/G"}
@@ -19,6 +19,9 @@ class CustomAttributes extends ECClasses_1.ECClasses {
19
19
  constructor(schemaEditor) {
20
20
  super(ecschema_metadata_1.SchemaItemType.CustomAttributeClass, schemaEditor);
21
21
  }
22
+ get itemTypeClass() {
23
+ return ecschema_metadata_1.CustomAttributeClass;
24
+ }
22
25
  async create(schemaKey, name, appliesTo, displayLabel, baseClassKey) {
23
26
  try {
24
27
  const newClass = await this.createClass(schemaKey, this.schemaItemType, (schema) => schema.createCustomAttributeClass.bind(schema), name, baseClassKey);
@@ -1 +1 @@
1
- {"version":3,"file":"CustomAttributes.js","sourceRoot":"","sources":["../../../src/Editing/CustomAttributes.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAIkC;AAElC,2CAAwC;AAExC,2CAA2E;AAE3E;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,qBAAS;IAC7C,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC;IAC3D,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,SAAuC,E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Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Editing\r\n */\r\n\r\nimport {\r\n CustomAttributeClass,\r\n CustomAttributeClassProps, CustomAttributeContainerType,\r\n SchemaItemKey, SchemaItemType, SchemaKey,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableCAClass } from \"./Mutable/MutableCAClass\";\r\nimport { ClassId, ECEditingStatus, SchemaEditingError } from \"./Exception\";\r\n\r\n/**\r\n * @alpha\r\n * A class extending ECClasses allowing you to create schema items of type CustomAttributeClass.\r\n */\r\nexport class CustomAttributes extends ECClasses {\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.CustomAttributeClass, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, appliesTo: CustomAttributeContainerType, displayLabel?: string, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createClass<CustomAttributeClass>(schemaKey, this.schemaItemType, (schema) => schema.createCustomAttributeClass.bind(schema), name, baseClassKey) as MutableCAClass;\r\n\r\n if (displayLabel)\r\n newClass.setDisplayLabel(displayLabel);\r\n\r\n newClass.setAppliesTo(appliesTo);\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new ClassId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a CustomAttributeClass through a CustomAttributeClassProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param caProps a json object that will be used to populate the new CustomAttributeClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, caProps: CustomAttributeClassProps): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createCustomAttributeClass.bind(schema), caProps);\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, caProps.name!, schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"CustomAttributes.js","sourceRoot":"","sources":["../../../src/Editing/CustomAttributes.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAIkC;AAElC,2CAAwC;AAExC,2CAA2E;AAE3E;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,qBAAS;IAC7C,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC;IAC3D,CAAC;IAED,IAAuB,aAAa;QAClC,OAAO,wCAAoB,CAAC;IAC9B,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,SAAuC,EAAE,YAAqB,EAAE,YAA4B;QAClJ,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAuB,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,YAAY,CAAmB,CAAC;YAEhM,IAAI,YAAY;gBACd,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YAEzC,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;YACjC,OAAO,QAAQ,CAAC,GAAG,CAAC;QACtB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,sBAAsB,EAAE,IAAI,mBAAO,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7H,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,OAAkC;QACnF,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;YAC3J,OAAO,QAAQ,CAAC,GAAG,CAAC;QACtB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,mBAAO,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACzI,CAAC;IACH,CAAC;CACF;AApCD,4CAoCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Editing\r\n */\r\n\r\nimport {\r\n CustomAttributeClass,\r\n CustomAttributeClassProps, CustomAttributeContainerType,\r\n SchemaItemKey, SchemaItemType, SchemaKey,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableCAClass } from \"./Mutable/MutableCAClass\";\r\nimport { ClassId, ECEditingStatus, SchemaEditingError } from \"./Exception\";\r\n\r\n/**\r\n * @alpha\r\n * A class extending ECClasses allowing you to create schema items of type CustomAttributeClass.\r\n */\r\nexport class CustomAttributes extends ECClasses {\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.CustomAttributeClass, schemaEditor);\r\n }\r\n\r\n protected override get itemTypeClass(): typeof CustomAttributeClass {\r\n return CustomAttributeClass;\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, appliesTo: CustomAttributeContainerType, displayLabel?: string, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createClass<CustomAttributeClass>(schemaKey, this.schemaItemType, (schema) => schema.createCustomAttributeClass.bind(schema), name, baseClassKey) as MutableCAClass;\r\n\r\n if (displayLabel)\r\n newClass.setDisplayLabel(displayLabel);\r\n\r\n newClass.setAppliesTo(appliesTo);\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new ClassId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a CustomAttributeClass through a CustomAttributeClassProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param caProps a json object that will be used to populate the new CustomAttributeClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, caProps: CustomAttributeClassProps): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createCustomAttributeClass.bind(schema), caProps);\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, caProps.name!, schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -13,6 +13,12 @@ export type ECClassSchemaItems = SchemaItemType.EntityClass | SchemaItemType.Str
13
13
  export declare class ECClasses extends SchemaItems {
14
14
  protected constructor(schemaItemType: ECClassSchemaItems, schemaEditor: SchemaContextEditor);
15
15
  protected schemaItemType: ECClassSchemaItems;
16
+ /**
17
+ * Allows access for the editors itemType class instance.
18
+ * It returns ECClass here, but editors for subclasses will override this to return the
19
+ * appropriate subclass.
20
+ */
21
+ protected get itemTypeClass(): typeof ECClass;
16
22
  /**
17
23
  * Allows access for editing of base Property attributes.
18
24
  */
@@ -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AW,EAAE,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;IAUpJ,oBAAoB,CAAC,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAS7F,6BAA6B,CAAC,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAUxI,yBAAyB,CAAC,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IASlG,kCAAkC,CAAC,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;IAUlJ,cAAc,CAAC,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASpE,MAAM,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAa3D;;;;OAIG;IACU,kBAAkB,CAAC,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBzG;;;;OAIG;IACU,YAAY,CAAC,OAAO,EAAE,aAAa,EAAE,YAAY,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;YAsBhF,QAAQ;IAatB,SAAS,CAAC,qBAAqB,CAAC,SAAS,EAAE,6BAA6B,EAAE,eAAe,EAAE,eAAe;YAM5F,kBAAkB;CAejC"}
@@ -21,34 +21,50 @@ const SchemaItems_1 = require("./SchemaItems");
21
21
  class ECClasses extends SchemaItems_1.SchemaItems {
22
22
  constructor(schemaItemType, schemaEditor) {
23
23
  super(schemaItemType, schemaEditor);
24
- /**
25
- * Allows access for editing of base Property attributes.
26
- */
24
+ this.schemaItemType = schemaItemType;
27
25
  this.properties = new Properties_1.Properties(this.schemaItemType, this.schemaEditor);
28
- /**
29
- * Allows access for editing of ArrayProperty attributes.
30
- */
31
26
  this.arrayProperties = new Properties_1.ArrayProperties(this.schemaItemType, this.schemaEditor);
32
- /**
33
- * Allows access for editing of PrimitiveProperty attributes.
34
- */
35
27
  this.primitiveProperties = new Properties_1.PrimitiveProperties(this.schemaItemType, this.schemaEditor);
36
- /**
37
- * Allows access for editing of EnumerationProperty attributes.
38
- */
39
28
  this.enumerationProperties = new Properties_1.EnumerationProperties(this.schemaItemType, this.schemaEditor);
40
- /**
41
- * Allows access for editing of StructProperty attributes.
42
- */
43
29
  this.structProperties = new Properties_1.StructProperties(this.schemaItemType, this.schemaEditor);
44
- this.schemaItemType = schemaItemType;
45
30
  }
31
+ schemaItemType;
32
+ /**
33
+ * Allows access for the editors itemType class instance.
34
+ * It returns ECClass here, but editors for subclasses will override this to return the
35
+ * appropriate subclass.
36
+ */
37
+ get itemTypeClass() {
38
+ return ecschema_metadata_1.ECClass;
39
+ }
40
+ /**
41
+ * Allows access for editing of base Property attributes.
42
+ */
43
+ properties;
44
+ /**
45
+ * Allows access for editing of ArrayProperty attributes.
46
+ */
47
+ arrayProperties;
48
+ /**
49
+ * Allows access for editing of PrimitiveProperty attributes.
50
+ */
51
+ primitiveProperties;
52
+ /**
53
+ * Allows access for editing of EnumerationProperty attributes.
54
+ */
55
+ enumerationProperties;
56
+ /**
57
+ * Allows access for editing of StructProperty attributes.
58
+ */
59
+ structProperties;
46
60
  async createClass(schemaKey, type, create, name, baseClassKey, ...args) {
47
61
  const newClass = await this.createSchemaItem(schemaKey, type, create, name, ...args);
48
62
  if (baseClassKey !== undefined) {
49
- const baseClassSchema = !baseClassKey.schemaKey.matches(newClass.schema.schemaKey) ? await this.getSchema(baseClassKey.schemaKey) : newClass.schema;
50
- const baseClassItem = await this.lookupSchemaItem(baseClassSchema, baseClassKey);
51
- newClass.baseClass = new ecschema_metadata_1.DelayedPromiseWithProps(baseClassKey, async () => baseClassItem);
63
+ if (!await this.schemaEditor.schemaContext.getSchema(baseClassKey.schemaKey)) {
64
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SchemaNotFound, new Exception_1.SchemaId(baseClassKey.schemaKey));
65
+ }
66
+ const baseClassItem = await this.getSchemaItem(baseClassKey, this.itemTypeClass);
67
+ await newClass.setBaseClass(new ecschema_metadata_1.DelayedPromiseWithProps(baseClassKey, async () => baseClassItem));
52
68
  }
53
69
  return newClass;
54
70
  }
@@ -204,7 +220,7 @@ class ECClasses extends SchemaItems_1.SchemaItems {
204
220
  async delete(classKey) {
205
221
  try {
206
222
  const schema = await this.getSchema(classKey.schemaKey);
207
- const ecClass = await schema.getItem(classKey.name);
223
+ const ecClass = await schema.getItem(classKey.name, this.itemTypeClass);
208
224
  if (ecClass === undefined)
209
225
  return;
210
226
  await schema.deleteClass(ecClass.name);
@@ -243,16 +259,18 @@ class ECClasses extends SchemaItems_1.SchemaItems {
243
259
  */
244
260
  async setBaseClass(itemKey, baseClassKey) {
245
261
  try {
246
- const classItem = await this.getSchemaItem(itemKey);
262
+ const classItem = await this.getSchemaItem(itemKey, this.itemTypeClass);
247
263
  if (!baseClassKey) {
248
- classItem.baseClass = undefined;
264
+ await classItem.setBaseClass(undefined);
249
265
  return;
250
266
  }
251
- const baseClassSchema = !baseClassKey.schemaKey.matches(itemKey.schemaKey) ? await this.getSchema(baseClassKey.schemaKey) : classItem.schema;
252
- const baseClassItem = await this.lookupSchemaItem(baseClassSchema, baseClassKey);
267
+ if (!await this.schemaEditor.schemaContext.getSchema(baseClassKey.schemaKey)) {
268
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SchemaNotFound, new Exception_1.SchemaId(baseClassKey.schemaKey));
269
+ }
270
+ const baseClassItem = await this.getSchemaItem(baseClassKey, this.itemTypeClass);
253
271
  if (classItem.baseClass !== undefined && !await baseClassItem.is(await classItem.baseClass))
254
272
  throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.InvalidBaseClass, new Exception_1.ClassId(this.schemaItemType, baseClassKey), undefined, undefined, `Base class ${baseClassKey.fullName} must derive from ${(await classItem.baseClass).fullName}.`);
255
- classItem.baseClass = new ecschema_metadata_1.DelayedPromiseWithProps(baseClassKey, async () => baseClassItem);
273
+ await classItem.setBaseClass(new ecschema_metadata_1.DelayedPromiseWithProps(baseClassKey, async () => baseClassItem));
256
274
  }
257
275
  catch (e) {
258
276
  throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SetBaseClass, new Exception_1.ClassId(this.schemaItemType, itemKey), e);
@@ -263,16 +281,8 @@ class ECClasses extends SchemaItems_1.SchemaItems {
263
281
  const ecClass = await schema.getItem(classKey.name);
264
282
  if (ecClass === undefined)
265
283
  throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SchemaItemNotFound, new Exception_1.ClassId(this.schemaItemType, classKey));
266
- switch (ecClass.schemaItemType) {
267
- case ecschema_metadata_1.SchemaItemType.EntityClass:
268
- case ecschema_metadata_1.SchemaItemType.Mixin:
269
- case ecschema_metadata_1.SchemaItemType.StructClass:
270
- case ecschema_metadata_1.SchemaItemType.CustomAttributeClass:
271
- case ecschema_metadata_1.SchemaItemType.RelationshipClass:
272
- break;
273
- default:
274
- throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.InvalidSchemaItemType, new Exception_1.ClassId(this.schemaItemType, classKey));
275
- }
284
+ if (!isMutableClass(ecClass))
285
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.InvalidSchemaItemType, new Exception_1.ClassId(this.schemaItemType, classKey));
276
286
  return ecClass;
277
287
  }
278
288
  removeCustomAttribute(container, customAttribute) {
@@ -296,4 +306,7 @@ class ECClasses extends SchemaItems_1.SchemaItems {
296
306
  }
297
307
  }
298
308
  exports.ECClasses = ECClasses;
309
+ function isMutableClass(schemaItem) {
310
+ return ecschema_metadata_1.ECClass.isECClass(schemaItem);
311
+ }
299
312
  //# sourceMappingURL=ECClasses.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ECClasses.js","sourceRoot":"","sources":["../../../src/Editing/ECClasses.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAOkC;AAClC,sDAA6C;AAG7C,+CAA+C;AAC/C,6CAAyH;AACzH,2CAAwH;AAExH,+CAA8D;AAK9D;;;GAGG;AACH,MAAa,SAAU,SAAQ,yBAAW;IAExC,YAAsB,cAAkC,EAAE,YAAiC;QACzF,KAAK,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QAMtC;;WAEG;QACa,eAAU,GAAG,IAAI,uBAAU,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACpF;;WAEG;QACa,oBAAe,GAAG,IAAI,4BAAe,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC9F;;WAEG;QACa,wBAAmB,GAAG,IAAI,gCAAmB,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACtG;;WAEG;QACa,0BAAqB,GAAG,IAAI,kCAAqB,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC1G;;WAEG;QACa,qBAAgB,GAAG,IAAI,6BAAgB,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAxB9F,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAyBM,KAAK,CAAC,WAAW,CAAoB,SAAoB,EAAE,IAAoB,EAAE,MAA2B,EAAE,IAAY,EAAE,YAA4B,EAAE,GAAG,IAAW;QAC7K,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,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AAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;QACpH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAES,qBAAqB,CAAC,SAAwC,EAAE,eAAgC;QACxG,IAAA,qBAAM,EAAC,SAAS,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC;QACjD,MAAM,GAAG,GAAG,SAAS,CAAC,gBAAgD,CAAC;QACvE,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAC,YAA0B;QACzD,MAAM,cAAc,GAAwB,EAAE,CAAC;QAC/C,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;QACrE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;QACzC,OAAO,CAAC,IAAI,EAAE,CAAC;YACb,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC;gBACjC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;oBACzC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAC7B,CAAC;YACH,CAAC;YACD,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QACzC,CAAC;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;CACF;AA9SD,8BA8SC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Editing\r\n */\r\n\r\nimport {\r\n CustomAttribute,\r\n CustomAttributeContainerProps,\r\n DelayedPromiseWithProps,\r\n ECClass, Enumeration, EnumerationPropertyProps, PrimitiveArrayPropertyProps,\r\n PrimitivePropertyProps, PrimitiveType, SchemaItemKey, SchemaItemType, SchemaKey, StructArrayPropertyProps,\r\n StructClass, StructPropertyProps,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableClass } from \"./Mutable/MutableClass\";\r\nimport * as Rules from \"../Validation/ECRules\";\r\nimport { ArrayProperties, EnumerationProperties, PrimitiveProperties, Properties, StructProperties } from \"./Properties\";\r\nimport { ClassId, CustomAttributeId, ECEditingStatus, PropertyId, SchemaEditingError, SchemaItemId } from \"./Exception\";\r\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { CreateSchemaItem, SchemaItems } from \"./SchemaItems\";\r\nimport { MutableSchema } from \"./Mutable/MutableSchema\";\r\n\r\nexport type ECClassSchemaItems = SchemaItemType.EntityClass | SchemaItemType.StructClass | SchemaItemType.RelationshipClass | SchemaItemType.Mixin | SchemaItemType.CustomAttributeClass;\r\n\r\n/**\r\n * @alpha\r\n * Acts as a base class for schema class creation. Enables property creation.\r\n */\r\nexport class ECClasses extends SchemaItems{\r\n\r\n protected constructor(schemaItemType: ECClassSchemaItems, schemaEditor: SchemaContextEditor) {\r\n super(schemaItemType, schemaEditor);\r\n this.schemaItemType = schemaItemType;\r\n }\r\n\r\n protected override schemaItemType: ECClassSchemaItems;\r\n\r\n /**\r\n * Allows access for editing of base Property attributes.\r\n */\r\n public readonly properties = new Properties(this.schemaItemType, this.schemaEditor);\r\n /**\r\n * Allows access for editing of ArrayProperty attributes.\r\n */\r\n public readonly arrayProperties = new ArrayProperties(this.schemaItemType, this.schemaEditor);\r\n /**\r\n * Allows access for editing of PrimitiveProperty attributes.\r\n */\r\n public readonly primitiveProperties = new PrimitiveProperties(this.schemaItemType, this.schemaEditor);\r\n /**\r\n * Allows access for editing of EnumerationProperty attributes.\r\n */\r\n public readonly enumerationProperties = new EnumerationProperties(this.schemaItemType, this.schemaEditor);\r\n /**\r\n * Allows access for editing of StructProperty attributes.\r\n */\r\n public readonly structProperties = new StructProperties(this.schemaItemType, this.schemaEditor);\r\n\r\n public async createClass<T extends ECClass>(schemaKey: SchemaKey, type: SchemaItemType, create: CreateSchemaItem<T>, name: string, baseClassKey?: SchemaItemKey, ...args: any[]): Promise<T> {\r\n const newClass = await this.createSchemaItem(schemaKey, type, create, name, ...args);\r\n\r\n if (baseClassKey !== undefined) {\r\n const baseClassSchema = !baseClassKey.schemaKey.matches(newClass.schema.schemaKey) ? await this.getSchema(baseClassKey.schemaKey) : newClass.schema as MutableSchema;\r\n const baseClassItem = await this.lookupSchemaItem<ECClass>(baseClassSchema, baseClassKey);\r\n newClass.baseClass = new DelayedPromiseWithProps<SchemaItemKey, T>(baseClassKey, async () => baseClassItem as T);\r\n }\r\n\r\n return newClass;\r\n }\r\n\r\n /**\r\n * Creates a property on class identified by the given SchemaItemKey. This method restricts the\r\n * property type to primitives of type Double, String, DateTime and Integer.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param name The name of the new property.\r\n * @param type The PrimitiveType assigned to the new property.\r\n */\r\n public async createProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType, prefix: string): Promise<void> {\r\n if (type !== PrimitiveType.Double && type !== PrimitiveType.String && type !== PrimitiveType.DateTime\r\n && type !== PrimitiveType.Integer)\r\n throw new Error (\"Property creation is restricted to type Double, String, DateTime, and Integer.\");\r\n\r\n if (\"\" === prefix)\r\n throw new Error(\"The specified property name prefix is invalid\");\r\n\r\n const prefixedName = `${prefix}_${name}`;\r\n\r\n const mutableClass = await this.getClass(classKey);\r\n\r\n await mutableClass.createPrimitiveProperty(prefixedName, type);\r\n }\r\n\r\n /**\r\n * Create a primitive property on class identified by the given SchemaItemKey.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param name The name of the new property.\r\n * @param type The PrimitiveType assigned to the new property.\r\n */\r\n public async createPrimitiveProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.createPrimitiveProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreatePrimitiveProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createPrimitivePropertyFromProps(classKey: SchemaItemKey, name: string, type: PrimitiveType, primitiveProps: PrimitivePropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createPrimitiveProperty(name, type);\r\n await newProperty.fromJSON(primitiveProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreatePrimitivePropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createEnumerationProperty(classKey: SchemaItemKey, name: string, type: Enumeration): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const enumSchemaItemKey = mutableClass.schema.getSchemaItemKey(type.fullName);\r\n if (enumSchemaItemKey === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new SchemaItemId(SchemaItemType.Enumeration, type.name, mutableClass.schema.schemaKey));\r\n\r\n await mutableClass.createPrimitiveProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateEnumerationProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createEnumerationPropertyFromProps(classKey: SchemaItemKey, name: string, type: Enumeration, enumProps: EnumerationPropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createPrimitiveProperty(name, type);\r\n await newProperty.fromJSON(enumProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateEnumerationArrayPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createPrimitiveArrayProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.createPrimitiveArrayProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreatePrimitiveArrayProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createPrimitiveArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: PrimitiveType, primitiveProps: PrimitiveArrayPropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createPrimitiveArrayProperty(name, type);\r\n await newProperty.fromJSON(primitiveProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreatePrimitiveArrayPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createEnumerationArrayProperty(classKey: SchemaItemKey, name: string, type: Enumeration): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.createPrimitiveArrayProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateEnumerationArrayProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createEnumerationArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: Enumeration, props: PrimitiveArrayPropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createPrimitiveArrayProperty(name, type);\r\n await newProperty.fromJSON(props);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateEnumerationArrayPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createStructProperty(classKey: SchemaItemKey, name: string, type: StructClass): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.createStructProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateStructProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createStructPropertyFromProps(classKey: SchemaItemKey, name: string, type: StructClass, structProps: StructPropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createStructProperty(name, type);\r\n await newProperty.fromJSON(structProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateStructPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createStructArrayProperty(classKey: SchemaItemKey, name: string, type: StructClass): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.createStructArrayProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateStructArrayProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createStructArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: StructClass, structProps: StructArrayPropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createStructArrayProperty(name, type);\r\n await newProperty.fromJSON(structProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateStructArrayPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async deleteProperty(classKey: SchemaItemKey, name: string): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.deleteProperty(name);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.DeleteProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async delete(classKey: SchemaItemKey): Promise<void> {\r\n try {\r\n const schema = await this.getSchema(classKey.schemaKey);\r\n const ecClass = await schema.getItem<ECClass>(classKey.name);\r\n if (ecClass === undefined)\r\n return;\r\n\r\n await schema.deleteClass(ecClass.name);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.DeleteClass, new ClassId(this.schemaItemType, classKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Adds a CustomAttribute instance to the Class identified by the given SchemaItemKey\r\n * @param classKey The SchemaItemKey identifying the schema.\r\n * @param customAttribute The CustomAttribute instance to add.\r\n */\r\n public async addCustomAttribute(classKey: SchemaItemKey, customAttribute: CustomAttribute): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n mutableClass.addCustomAttribute(customAttribute);\r\n\r\n const diagnosticIterable = Rules.validateCustomAttributeInstance(mutableClass, customAttribute);\r\n\r\n const diagnostics: AnyDiagnostic[] = [];\r\n for await (const diagnostic of diagnosticIterable) {\r\n diagnostics.push(diagnostic);\r\n }\r\n\r\n if (diagnostics.length > 0) {\r\n this.removeCustomAttribute(mutableClass, customAttribute);\r\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, mutableClass), undefined, diagnostics);\r\n }\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToClass, new ClassId(this.schemaItemType, classKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Sets the base class of a SchemaItem.\r\n * @param itemKey The SchemaItemKey of the Item.\r\n * @param baseClassKey The SchemaItemKey of the base class. Specifying 'undefined' removes the base class.\r\n */\r\n public async setBaseClass(itemKey: SchemaItemKey, baseClassKey?: SchemaItemKey): Promise<void> {\r\n try {\r\n const classItem = await this.getSchemaItem<ECClass>(itemKey);\r\n if (!baseClassKey) {\r\n classItem.baseClass = undefined;\r\n return;\r\n }\r\n\r\n const baseClassSchema = !baseClassKey.schemaKey.matches(itemKey.schemaKey) ? await this.getSchema(baseClassKey.schemaKey) : classItem.schema as MutableSchema;\r\n const baseClassItem = await this.lookupSchemaItem<ECClass>(baseClassSchema, baseClassKey);\r\n if (classItem.baseClass !== undefined && !await baseClassItem.is(await classItem.baseClass))\r\n throw new SchemaEditingError(ECEditingStatus.InvalidBaseClass, new ClassId(this.schemaItemType, baseClassKey), undefined, undefined, `Base class ${baseClassKey.fullName} must derive from ${(await classItem.baseClass).fullName}.`);\r\n\r\n classItem.baseClass = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(baseClassKey, async () => baseClassItem);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.SetBaseClass, new ClassId(this.schemaItemType, itemKey), e);\r\n }\r\n }\r\n\r\n private async getClass(classKey: SchemaItemKey): Promise<MutableClass> {\r\n const schema = await this.getSchema(classKey.schemaKey);\r\n\r\n const ecClass = await schema.getItem<MutableClass>(classKey.name);\r\n if (ecClass === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new ClassId(this.schemaItemType, classKey));\r\n\r\n switch (ecClass.schemaItemType) {\r\n case SchemaItemType.EntityClass:\r\n case SchemaItemType.Mixin:\r\n case SchemaItemType.StructClass:\r\n case SchemaItemType.CustomAttributeClass:\r\n case SchemaItemType.RelationshipClass:\r\n break;\r\n default:\r\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new ClassId(this.schemaItemType, classKey));\r\n }\r\n\r\n return ecClass;\r\n }\r\n\r\n protected removeCustomAttribute(container: CustomAttributeContainerProps, customAttribute: CustomAttribute) {\r\n assert(container.customAttributes !== undefined);\r\n const map = container.customAttributes as Map<string, CustomAttribute>;\r\n map.delete(customAttribute.className);\r\n }\r\n\r\n private async findDerivedClasses(mutableClass: MutableClass): Promise<Array<MutableClass>>{\r\n const derivedClasses: Array<MutableClass> = [];\r\n const schemaItems = this.schemaEditor.schemaContext.getSchemaItems();\r\n let { value, done } = schemaItems.next();\r\n while (!done) {\r\n if (await value.is(mutableClass)) {\r\n if (!mutableClass.key.matches(value.key)) {\r\n derivedClasses.push(value);\r\n }\r\n }\r\n ({ value, done } = schemaItems.next());\r\n }\r\n\r\n return derivedClasses;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ECClasses.js","sourceRoot":"","sources":["../../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,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,qBAAqB,EAAE,IAAI,mBAAO,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;QAElH,OAAO,OAAO,CAAC;IACjB,CAAC;IAES,qBAAqB,CAAC,SAAwC,EAAE,eAAgC;QACxG,IAAA,qBAAM,EAAC,SAAS,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC;QACjD,MAAM,GAAG,GAAG,SAAS,CAAC,gBAAgD,CAAC;QACvE,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAC,YAA0B;QACzD,MAAM,cAAc,GAAwB,EAAE,CAAC;QAC/C,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;QACrE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;QACzC,OAAO,CAAC,IAAI,EAAE,CAAC;YACb,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC;gBACjC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;oBACzC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAC7B,CAAC;YACH,CAAC;YACD,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QACzC,CAAC;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;CACF;AA1TD,8BA0TC;AAED,SAAS,cAAc,CAAC,UAAsB;IAC5C,OAAO,2BAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Editing\r\n */\r\n\r\nimport {\r\n CustomAttribute,\r\n CustomAttributeContainerProps,\r\n DelayedPromiseWithProps,\r\n ECClass, Enumeration, EnumerationPropertyProps, PrimitiveArrayPropertyProps,\r\n PrimitivePropertyProps, PrimitiveType, SchemaItem, SchemaItemKey, SchemaItemType, SchemaKey, StructArrayPropertyProps,\r\n StructClass, StructPropertyProps,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableClass } from \"./Mutable/MutableClass\";\r\nimport * as Rules from \"../Validation/ECRules\";\r\nimport { ArrayProperties, EnumerationProperties, PrimitiveProperties, Properties, StructProperties } from \"./Properties\";\r\nimport { ClassId, CustomAttributeId, ECEditingStatus, PropertyId, SchemaEditingError, SchemaId, SchemaItemId } from \"./Exception\";\r\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { CreateSchemaItem, SchemaItems } from \"./SchemaItems\";\r\n\r\nexport type ECClassSchemaItems = SchemaItemType.EntityClass | SchemaItemType.StructClass | SchemaItemType.RelationshipClass | SchemaItemType.Mixin | SchemaItemType.CustomAttributeClass;\r\n\r\n/**\r\n * @alpha\r\n * Acts as a base class for schema class creation. Enables property creation.\r\n */\r\nexport class ECClasses extends SchemaItems{\r\n\r\n protected constructor(schemaItemType: ECClassSchemaItems, schemaEditor: SchemaContextEditor) {\r\n super(schemaItemType, schemaEditor);\r\n this.schemaItemType = schemaItemType;\r\n this.properties = new Properties(this.schemaItemType, this.schemaEditor);\r\n this.arrayProperties = new ArrayProperties(this.schemaItemType, this.schemaEditor);\r\n this.primitiveProperties = new PrimitiveProperties(this.schemaItemType, this.schemaEditor);\r\n this.enumerationProperties = new EnumerationProperties(this.schemaItemType, this.schemaEditor);\r\n this.structProperties = new StructProperties(this.schemaItemType, this.schemaEditor);\r\n }\r\n\r\n protected override schemaItemType: ECClassSchemaItems;\r\n\r\n /**\r\n * Allows access for the editors itemType class instance.\r\n * It returns ECClass here, but editors for subclasses will override this to return the\r\n * appropriate subclass.\r\n */\r\n protected override get itemTypeClass(): typeof ECClass {\r\n return ECClass;\r\n }\r\n\r\n /**\r\n * Allows access for editing of base Property attributes.\r\n */\r\n public readonly properties: Properties;\r\n /**\r\n * Allows access for editing of ArrayProperty attributes.\r\n */\r\n public readonly arrayProperties: ArrayProperties;\r\n /**\r\n * Allows access for editing of PrimitiveProperty attributes.\r\n */\r\n public readonly primitiveProperties: PrimitiveProperties;\r\n /**\r\n * Allows access for editing of EnumerationProperty attributes.\r\n */\r\n public readonly enumerationProperties: EnumerationProperties;\r\n /**\r\n * Allows access for editing of StructProperty attributes.\r\n */\r\n public readonly structProperties: StructProperties;\r\n\r\n public async createClass<T extends ECClass>(schemaKey: SchemaKey, type: SchemaItemType, create: CreateSchemaItem<T>, name: string, baseClassKey?: SchemaItemKey, ...args: any[]): Promise<T> {\r\n const newClass = await this.createSchemaItem(schemaKey, type, create, name, ...args);\r\n\r\n if (baseClassKey !== undefined) {\r\n if(!await this.schemaEditor.schemaContext.getSchema(baseClassKey.schemaKey)) {\r\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(baseClassKey.schemaKey));\r\n }\r\n\r\n const baseClassItem = await this.getSchemaItem(baseClassKey, this.itemTypeClass);\r\n await (newClass as ECClass as MutableClass).setBaseClass(new DelayedPromiseWithProps<SchemaItemKey, T>(baseClassKey, async () => baseClassItem as T));\r\n }\r\n\r\n return newClass;\r\n }\r\n\r\n /**\r\n * Creates a property on class identified by the given SchemaItemKey. This method restricts the\r\n * property type to primitives of type Double, String, DateTime and Integer.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param name The name of the new property.\r\n * @param type The PrimitiveType assigned to the new property.\r\n */\r\n public async createProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType, prefix: string): Promise<void> {\r\n if (type !== PrimitiveType.Double && type !== PrimitiveType.String && type !== PrimitiveType.DateTime\r\n && type !== PrimitiveType.Integer)\r\n throw new Error (\"Property creation is restricted to type Double, String, DateTime, and Integer.\");\r\n\r\n if (\"\" === prefix)\r\n throw new Error(\"The specified property name prefix is invalid\");\r\n\r\n const prefixedName = `${prefix}_${name}`;\r\n\r\n const mutableClass = await this.getClass(classKey);\r\n\r\n await mutableClass.createPrimitiveProperty(prefixedName, type);\r\n }\r\n\r\n /**\r\n * Create a primitive property on class identified by the given SchemaItemKey.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param name The name of the new property.\r\n * @param type The PrimitiveType assigned to the new property.\r\n */\r\n public async createPrimitiveProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.createPrimitiveProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreatePrimitiveProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createPrimitivePropertyFromProps(classKey: SchemaItemKey, name: string, type: PrimitiveType, primitiveProps: PrimitivePropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createPrimitiveProperty(name, type);\r\n await newProperty.fromJSON(primitiveProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreatePrimitivePropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createEnumerationProperty(classKey: SchemaItemKey, name: string, type: Enumeration): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const enumSchemaItemKey = mutableClass.schema.getSchemaItemKey(type.fullName);\r\n if (enumSchemaItemKey === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new SchemaItemId(SchemaItemType.Enumeration, type.name, mutableClass.schema.schemaKey));\r\n\r\n await mutableClass.createPrimitiveProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateEnumerationProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createEnumerationPropertyFromProps(classKey: SchemaItemKey, name: string, type: Enumeration, enumProps: EnumerationPropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createPrimitiveProperty(name, type);\r\n await newProperty.fromJSON(enumProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateEnumerationArrayPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createPrimitiveArrayProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.createPrimitiveArrayProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreatePrimitiveArrayProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createPrimitiveArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: PrimitiveType, primitiveProps: PrimitiveArrayPropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createPrimitiveArrayProperty(name, type);\r\n await newProperty.fromJSON(primitiveProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreatePrimitiveArrayPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createEnumerationArrayProperty(classKey: SchemaItemKey, name: string, type: Enumeration): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.createPrimitiveArrayProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateEnumerationArrayProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createEnumerationArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: Enumeration, props: PrimitiveArrayPropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createPrimitiveArrayProperty(name, type);\r\n await newProperty.fromJSON(props);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateEnumerationArrayPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createStructProperty(classKey: SchemaItemKey, name: string, type: StructClass): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.createStructProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateStructProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createStructPropertyFromProps(classKey: SchemaItemKey, name: string, type: StructClass, structProps: StructPropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createStructProperty(name, type);\r\n await newProperty.fromJSON(structProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateStructPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createStructArrayProperty(classKey: SchemaItemKey, name: string, type: StructClass): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.createStructArrayProperty(name, type);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateStructArrayProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async createStructArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: StructClass, structProps: StructArrayPropertyProps): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n const newProperty = await mutableClass.createStructArrayProperty(name, type);\r\n await newProperty.fromJSON(structProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateStructArrayPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async deleteProperty(classKey: SchemaItemKey, name: string): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n await mutableClass.deleteProperty(name);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.DeleteProperty, new PropertyId(this.schemaItemType, classKey, name), e);\r\n }\r\n }\r\n\r\n public async delete(classKey: SchemaItemKey): Promise<void> {\r\n try {\r\n const schema = await this.getSchema(classKey.schemaKey);\r\n const ecClass = await schema.getItem(classKey.name, this.itemTypeClass);\r\n if (ecClass === undefined)\r\n return;\r\n\r\n await schema.deleteClass(ecClass.name);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.DeleteClass, new ClassId(this.schemaItemType, classKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Adds a CustomAttribute instance to the Class identified by the given SchemaItemKey\r\n * @param classKey The SchemaItemKey identifying the schema.\r\n * @param customAttribute The CustomAttribute instance to add.\r\n */\r\n public async addCustomAttribute(classKey: SchemaItemKey, customAttribute: CustomAttribute): Promise<void> {\r\n try {\r\n const mutableClass = await this.getClass(classKey);\r\n mutableClass.addCustomAttribute(customAttribute);\r\n\r\n const diagnosticIterable = Rules.validateCustomAttributeInstance(mutableClass, customAttribute);\r\n\r\n const diagnostics: AnyDiagnostic[] = [];\r\n for await (const diagnostic of diagnosticIterable) {\r\n diagnostics.push(diagnostic);\r\n }\r\n\r\n if (diagnostics.length > 0) {\r\n this.removeCustomAttribute(mutableClass, customAttribute);\r\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, mutableClass), undefined, diagnostics);\r\n }\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToClass, new ClassId(this.schemaItemType, classKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Sets the base class of a SchemaItem.\r\n * @param itemKey The SchemaItemKey of the Item.\r\n * @param baseClassKey The SchemaItemKey of the base class. Specifying 'undefined' removes the base class.\r\n */\r\n public async setBaseClass(itemKey: SchemaItemKey, baseClassKey?: SchemaItemKey): Promise<void> {\r\n try {\r\n const classItem = await this.getSchemaItem(itemKey, this.itemTypeClass);\r\n if (!baseClassKey) {\r\n await (classItem as MutableClass).setBaseClass(undefined);\r\n return;\r\n }\r\n\r\n if(!await this.schemaEditor.schemaContext.getSchema(baseClassKey.schemaKey)) {\r\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(baseClassKey.schemaKey));\r\n }\r\n\r\n const baseClassItem = await this.getSchemaItem(baseClassKey, this.itemTypeClass);\r\n if (classItem.baseClass !== undefined && !await baseClassItem.is(await classItem.baseClass))\r\n throw new SchemaEditingError(ECEditingStatus.InvalidBaseClass, new ClassId(this.schemaItemType, baseClassKey), undefined, undefined, `Base class ${baseClassKey.fullName} must derive from ${(await classItem.baseClass).fullName}.`);\r\n\r\n await (classItem as MutableClass).setBaseClass(new DelayedPromiseWithProps<SchemaItemKey, ECClass>(baseClassKey, async () => baseClassItem));\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.SetBaseClass, new ClassId(this.schemaItemType, itemKey), e);\r\n }\r\n }\r\n\r\n private async getClass(classKey: SchemaItemKey): Promise<MutableClass> {\r\n const schema = await this.getSchema(classKey.schemaKey);\r\n\r\n const ecClass = await schema.getItem(classKey.name);\r\n if (ecClass === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new ClassId(this.schemaItemType, classKey));\r\n\r\n if(!isMutableClass(ecClass))\r\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new ClassId(this.schemaItemType, classKey));\r\n\r\n return ecClass;\r\n }\r\n\r\n protected removeCustomAttribute(container: CustomAttributeContainerProps, customAttribute: CustomAttribute) {\r\n assert(container.customAttributes !== undefined);\r\n const map = container.customAttributes as Map<string, CustomAttribute>;\r\n map.delete(customAttribute.className);\r\n }\r\n\r\n private async findDerivedClasses(mutableClass: MutableClass): Promise<Array<MutableClass>>{\r\n const derivedClasses: Array<MutableClass> = [];\r\n const schemaItems = this.schemaEditor.schemaContext.getSchemaItems();\r\n let { value, done } = schemaItems.next();\r\n while (!done) {\r\n if (await value.is(mutableClass)) {\r\n if (!mutableClass.key.matches(value.key)) {\r\n derivedClasses.push(value);\r\n }\r\n }\r\n ({ value, done } = schemaItems.next());\r\n }\r\n\r\n return derivedClasses;\r\n }\r\n}\r\n\r\nfunction isMutableClass(schemaItem: SchemaItem): schemaItem is MutableClass {\r\n return ECClass.isECClass(schemaItem);\r\n}\r\n"]}
@@ -89,9 +89,9 @@ export declare class SchemaContextEditor {
89
89
  */
90
90
  incrementMinorVersion(schemaKey: SchemaKey): Promise<SchemaKey>;
91
91
  /** @internal */
92
- lookupSchemaItem<T extends SchemaItem>(schemaOrKey: Schema | SchemaKey, schemaItemKey: SchemaItemKey, schemaItemType: SchemaItemType): Promise<T>;
92
+ lookupSchemaItem(schemaOrKey: Schema | SchemaKey, schemaItemKey: SchemaItemKey, schemaItemType: SchemaItemType): Promise<SchemaItem>;
93
93
  /** @internal */
94
- getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey, schemaItemType: SchemaItemType): Promise<T>;
94
+ getSchemaItem<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): Promise<InstanceType<T>>;
95
95
  private removeReference;
96
96
  private removeCustomAttribute;
97
97
  private lookupSchema;
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../src/Editing/Editor.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,eAAe,EAAmC,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAmB,MAAM,0BAA0B,CAAC;AAC1L,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CA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gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IAejJ,gBAAgB;IACH,aAAa,CAAC,CAAC,SAAS,OAAO,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAkBnI,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,qBAAqB;YAMf,YAAY;IAQ1B;;;;OAIG;IACU,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM;IAQrE;;;;OAIG;IACU,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM;IAQhE;;;;OAIG;IACU,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM;CAwB1D"}
@@ -31,30 +31,33 @@ const Exception_1 = require("./Exception");
31
31
  * @alpha
32
32
  */
33
33
  class SchemaContextEditor {
34
+ _schemaContext;
35
+ entities = new Entities_1.Entities(this);
36
+ mixins = new Mixins_1.Mixins(this);
37
+ structs = new Structs_1.Structs(this);
38
+ customAttributes = new CustomAttributes_1.CustomAttributes(this);
39
+ relationships = new RelationshipClasses_1.RelationshipClasses(this);
40
+ constants = new Constants_1.Constants(this);
41
+ enumerations = new Enumerations_1.Enumerations(this);
42
+ formats = new Formats_1.Formats(this);
43
+ kindOfQuantities = new KindOfQuantities_1.KindOfQuantities(this);
44
+ units = new Units_1.Units(this);
45
+ phenomenons = new Phenomena_1.Phenomena(this);
46
+ unitSystems = new UnitSystems_1.UnitSystems(this);
47
+ propertyCategories = new PropertyCategories_1.PropertyCategories(this);
48
+ invertedUnits = new InvertedUnits_1.InvertedUnits(this);
34
49
  /**
35
50
  * Creates a new SchemaContextEditor instance.
36
51
  * @param schemaContext The SchemaContext the Editor will use to edit in.
37
52
  */
38
53
  constructor(schemaContext) {
39
- this.entities = new Entities_1.Entities(this);
40
- this.mixins = new Mixins_1.Mixins(this);
41
- this.structs = new Structs_1.Structs(this);
42
- this.customAttributes = new CustomAttributes_1.CustomAttributes(this);
43
- this.relationships = new RelationshipClasses_1.RelationshipClasses(this);
44
- this.constants = new Constants_1.Constants(this);
45
- this.enumerations = new Enumerations_1.Enumerations(this);
46
- this.formats = new Formats_1.Formats(this);
47
- this.kindOfQuantities = new KindOfQuantities_1.KindOfQuantities(this);
48
- this.units = new Units_1.Units(this);
49
- this.phenomenons = new Phenomena_1.Phenomena(this);
50
- this.unitSystems = new UnitSystems_1.UnitSystems(this);
51
- this.propertyCategories = new PropertyCategories_1.PropertyCategories(this);
52
- this.invertedUnits = new InvertedUnits_1.InvertedUnits(this);
53
54
  // TODO: Make copy
54
55
  this._schemaContext = schemaContext;
55
56
  }
56
57
  /** Allows you to get schema classes and items through regular SchemaContext methods. */
57
- get schemaContext() { return this._schemaContext; }
58
+ get schemaContext() {
59
+ return this._schemaContext;
60
+ }
58
61
  async finish() {
59
62
  return this._schemaContext;
60
63
  }
@@ -165,10 +168,10 @@ class SchemaContextEditor {
165
168
  }
166
169
  /** @internal */
167
170
  async lookupSchemaItem(schemaOrKey, schemaItemKey, schemaItemType) {
168
- const schema = ecschema_metadata_1.Schema.isSchema(schemaOrKey)
169
- ? schemaOrKey
170
- : await this.getSchema(schemaOrKey);
171
- const schemaItem = await schema.lookupItem(schemaItemKey);
171
+ if (ecschema_metadata_1.Schema.isSchema(schemaOrKey)) {
172
+ schemaOrKey = schemaOrKey.schemaKey;
173
+ }
174
+ const schemaItem = await this.schemaContext.getSchemaItem(schemaItemKey);
172
175
  if (schemaItem === undefined)
173
176
  throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SchemaItemNotFound, new Exception_1.SchemaItemId(schemaItemType, schemaItemKey));
174
177
  if (schemaItemType !== schemaItem.schemaItemType)
@@ -176,12 +179,17 @@ class SchemaContextEditor {
176
179
  return schemaItem;
177
180
  }
178
181
  /** @internal */
179
- async getSchemaItem(schemaItemKey, schemaItemType) {
182
+ async getSchemaItem(schemaItemKey, itemConstructor) {
180
183
  const schemaItem = await this.schemaContext.getSchemaItem(schemaItemKey);
184
+ const schemaItemType = itemConstructor.schemaItemType;
185
+ if (!isSchemaItemType(schemaItemType)) {
186
+ // This block should never be hit, as the editor components always pass in the itemConstructor with a valid schemaItemType.
187
+ throw new Error(`Invalid schema item lookup for: ${schemaItemType}`);
188
+ }
181
189
  if (!schemaItem) {
182
190
  throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SchemaItemNotFoundInContext, new Exception_1.SchemaItemId(schemaItemType, schemaItemKey));
183
191
  }
184
- if (schemaItemType !== schemaItem.schemaItemType)
192
+ if (!(0, ecschema_metadata_1.isSupportedSchemaItemType)(schemaItem.schemaItemType, itemConstructor.schemaItemType))
185
193
  throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.InvalidSchemaItemType, new Exception_1.SchemaItemId(schemaItemType, schemaItemKey));
186
194
  return schemaItem;
187
195
  }
@@ -254,4 +262,7 @@ class SchemaContextEditor {
254
262
  }
255
263
  }
256
264
  exports.SchemaContextEditor = SchemaContextEditor;
265
+ function isSchemaItemType(type) {
266
+ return Object.values(ecschema_metadata_1.SchemaItemType).includes(type);
267
+ }
257
268
  //# sourceMappingURL=Editor.js.map