@itwin/ecschema-editing 5.3.2 → 5.3.4

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 (183) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/lib/cjs/Differencing/Errors.js.map +1 -1
  3. package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
  4. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
  5. package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
  6. package/lib/cjs/Differencing/SchemaDifferenceValidator.js.map +1 -1
  7. package/lib/cjs/Differencing/SchemaDifferenceVisitor.js.map +1 -1
  8. package/lib/cjs/Differencing/Utils.js.map +1 -1
  9. package/lib/cjs/Editing/Constants.js.map +1 -1
  10. package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
  11. package/lib/cjs/Editing/ECClasses.js.map +1 -1
  12. package/lib/cjs/Editing/Editor.js.map +1 -1
  13. package/lib/cjs/Editing/Entities.js.map +1 -1
  14. package/lib/cjs/Editing/Enumerations.js.map +1 -1
  15. package/lib/cjs/Editing/Exception.js.map +1 -1
  16. package/lib/cjs/Editing/Formats.js.map +1 -1
  17. package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
  18. package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
  19. package/lib/cjs/Editing/Mixins.js.map +1 -1
  20. package/lib/cjs/Editing/Mutable/MutableArrayProperty.js.map +1 -1
  21. package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
  22. package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
  23. package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
  24. package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
  25. package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
  26. package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
  27. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
  28. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
  29. package/lib/cjs/Editing/Mutable/MutableMixin.js.map +1 -1
  30. package/lib/cjs/Editing/Mutable/MutableNavigationProperty.js.map +1 -1
  31. package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
  32. package/lib/cjs/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -1
  33. package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
  34. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
  35. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
  36. package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
  37. package/lib/cjs/Editing/Mutable/MutableSchemaItem.js.map +1 -1
  38. package/lib/cjs/Editing/Mutable/MutableStructProperty.js.map +1 -1
  39. package/lib/cjs/Editing/Mutable/MutableUnit.js.map +1 -1
  40. package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
  41. package/lib/cjs/Editing/Phenomena.js.map +1 -1
  42. package/lib/cjs/Editing/Properties.js.map +1 -1
  43. package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
  44. package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
  45. package/lib/cjs/Editing/SchemaItems.js.map +1 -1
  46. package/lib/cjs/Editing/Structs.js.map +1 -1
  47. package/lib/cjs/Editing/UnitSystems.js.map +1 -1
  48. package/lib/cjs/Editing/Units.js.map +1 -1
  49. package/lib/cjs/Merging/ClassMerger.js.map +1 -1
  50. package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
  51. package/lib/cjs/Merging/CustomAttributeClassMerger.js.map +1 -1
  52. package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
  53. package/lib/cjs/Merging/Edits/NameMapping.js.map +1 -1
  54. package/lib/cjs/Merging/Edits/RenameEditHandler.js.map +1 -1
  55. package/lib/cjs/Merging/Edits/SchemaEdits.js.map +1 -1
  56. package/lib/cjs/Merging/Edits/SkipEditHandler.js.map +1 -1
  57. package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
  58. package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
  59. package/lib/cjs/Merging/EnumeratorMerger.js.map +1 -1
  60. package/lib/cjs/Merging/FormatMerger.js.map +1 -1
  61. package/lib/cjs/Merging/InvertedUnitMerger.js.map +1 -1
  62. package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
  63. package/lib/cjs/Merging/MixinMerger.js.map +1 -1
  64. package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
  65. package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -1
  66. package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
  67. package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
  68. package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
  69. package/lib/cjs/Merging/SchemaMergingVisitor.js.map +1 -1
  70. package/lib/cjs/Merging/SchemaMergingWalker.js.map +1 -1
  71. package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
  72. package/lib/cjs/Merging/StructClassMerger.js.map +1 -1
  73. package/lib/cjs/Merging/UnitMerger.js.map +1 -1
  74. package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -1
  75. package/lib/cjs/Merging/Utils.js.map +1 -1
  76. package/lib/cjs/Validation/Diagnostic.js.map +1 -1
  77. package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
  78. package/lib/cjs/Validation/ECRules.js.map +1 -1
  79. package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
  80. package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
  81. package/lib/cjs/Validation/Rules.js.map +1 -1
  82. package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
  83. package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
  84. package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
  85. package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
  86. package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
  87. package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
  88. package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
  89. package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
  90. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  91. package/lib/cjs/ecschema-editing.js.map +1 -1
  92. package/lib/esm/Differencing/Errors.js.map +1 -1
  93. package/lib/esm/Differencing/SchemaConflicts.js.map +1 -1
  94. package/lib/esm/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
  95. package/lib/esm/Differencing/SchemaDifference.js.map +1 -1
  96. package/lib/esm/Differencing/SchemaDifferenceValidator.js.map +1 -1
  97. package/lib/esm/Differencing/SchemaDifferenceVisitor.js.map +1 -1
  98. package/lib/esm/Differencing/Utils.js.map +1 -1
  99. package/lib/esm/Editing/Constants.js.map +1 -1
  100. package/lib/esm/Editing/CustomAttributes.js.map +1 -1
  101. package/lib/esm/Editing/ECClasses.js.map +1 -1
  102. package/lib/esm/Editing/Editor.js.map +1 -1
  103. package/lib/esm/Editing/Entities.js.map +1 -1
  104. package/lib/esm/Editing/Enumerations.js.map +1 -1
  105. package/lib/esm/Editing/Exception.js.map +1 -1
  106. package/lib/esm/Editing/Formats.js.map +1 -1
  107. package/lib/esm/Editing/InvertedUnits.js.map +1 -1
  108. package/lib/esm/Editing/KindOfQuantities.js.map +1 -1
  109. package/lib/esm/Editing/Mixins.js.map +1 -1
  110. package/lib/esm/Editing/Mutable/MutableArrayProperty.js.map +1 -1
  111. package/lib/esm/Editing/Mutable/MutableCAClass.js.map +1 -1
  112. package/lib/esm/Editing/Mutable/MutableClass.js.map +1 -1
  113. package/lib/esm/Editing/Mutable/MutableConstant.js.map +1 -1
  114. package/lib/esm/Editing/Mutable/MutableEntityClass.js.map +1 -1
  115. package/lib/esm/Editing/Mutable/MutableEnumeration.js.map +1 -1
  116. package/lib/esm/Editing/Mutable/MutableFormat.js.map +1 -1
  117. package/lib/esm/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
  118. package/lib/esm/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
  119. package/lib/esm/Editing/Mutable/MutableMixin.js.map +1 -1
  120. package/lib/esm/Editing/Mutable/MutableNavigationProperty.js.map +1 -1
  121. package/lib/esm/Editing/Mutable/MutablePhenomenon.js.map +1 -1
  122. package/lib/esm/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -1
  123. package/lib/esm/Editing/Mutable/MutableProperty.js.map +1 -1
  124. package/lib/esm/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
  125. package/lib/esm/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
  126. package/lib/esm/Editing/Mutable/MutableSchema.js.map +1 -1
  127. package/lib/esm/Editing/Mutable/MutableSchemaItem.js.map +1 -1
  128. package/lib/esm/Editing/Mutable/MutableStructProperty.js.map +1 -1
  129. package/lib/esm/Editing/Mutable/MutableUnit.js.map +1 -1
  130. package/lib/esm/Editing/Mutable/MutableUnitSystem.js.map +1 -1
  131. package/lib/esm/Editing/Phenomena.js.map +1 -1
  132. package/lib/esm/Editing/Properties.js.map +1 -1
  133. package/lib/esm/Editing/PropertyCategories.js.map +1 -1
  134. package/lib/esm/Editing/RelationshipClasses.js.map +1 -1
  135. package/lib/esm/Editing/SchemaItems.js.map +1 -1
  136. package/lib/esm/Editing/Structs.js.map +1 -1
  137. package/lib/esm/Editing/UnitSystems.js.map +1 -1
  138. package/lib/esm/Editing/Units.js.map +1 -1
  139. package/lib/esm/Merging/ClassMerger.js.map +1 -1
  140. package/lib/esm/Merging/ConstantMerger.js.map +1 -1
  141. package/lib/esm/Merging/CustomAttributeClassMerger.js.map +1 -1
  142. package/lib/esm/Merging/CustomAttributeMerger.js.map +1 -1
  143. package/lib/esm/Merging/Edits/NameMapping.js.map +1 -1
  144. package/lib/esm/Merging/Edits/RenameEditHandler.js.map +1 -1
  145. package/lib/esm/Merging/Edits/SchemaEdits.js.map +1 -1
  146. package/lib/esm/Merging/Edits/SkipEditHandler.js.map +1 -1
  147. package/lib/esm/Merging/EntityClassMerger.js.map +1 -1
  148. package/lib/esm/Merging/EnumerationMerger.js.map +1 -1
  149. package/lib/esm/Merging/EnumeratorMerger.js.map +1 -1
  150. package/lib/esm/Merging/FormatMerger.js.map +1 -1
  151. package/lib/esm/Merging/InvertedUnitMerger.js.map +1 -1
  152. package/lib/esm/Merging/KindOfQuantityMerger.js.map +1 -1
  153. package/lib/esm/Merging/MixinMerger.js.map +1 -1
  154. package/lib/esm/Merging/PhenomenonMerger.js.map +1 -1
  155. package/lib/esm/Merging/PropertyCategoryMerger.js.map +1 -1
  156. package/lib/esm/Merging/PropertyMerger.js.map +1 -1
  157. package/lib/esm/Merging/RelationshipClassMerger.js.map +1 -1
  158. package/lib/esm/Merging/SchemaMerger.js.map +1 -1
  159. package/lib/esm/Merging/SchemaMergingVisitor.js.map +1 -1
  160. package/lib/esm/Merging/SchemaMergingWalker.js.map +1 -1
  161. package/lib/esm/Merging/SchemaReferenceMerger.js.map +1 -1
  162. package/lib/esm/Merging/StructClassMerger.js.map +1 -1
  163. package/lib/esm/Merging/UnitMerger.js.map +1 -1
  164. package/lib/esm/Merging/UnitSystemMerger.js.map +1 -1
  165. package/lib/esm/Merging/Utils.js.map +1 -1
  166. package/lib/esm/Validation/Diagnostic.js.map +1 -1
  167. package/lib/esm/Validation/DiagnosticReporter.js.map +1 -1
  168. package/lib/esm/Validation/ECRules.js.map +1 -1
  169. package/lib/esm/Validation/LoggingDiagnosticReporter.js.map +1 -1
  170. package/lib/esm/Validation/RuleSuppressionSet.js.map +1 -1
  171. package/lib/esm/Validation/Rules.js.map +1 -1
  172. package/lib/esm/Validation/SchemaChanges.js.map +1 -1
  173. package/lib/esm/Validation/SchemaCompareDiagnostics.js.map +1 -1
  174. package/lib/esm/Validation/SchemaCompareReporter.js.map +1 -1
  175. package/lib/esm/Validation/SchemaCompareResultDelegate.js.map +1 -1
  176. package/lib/esm/Validation/SchemaCompareVisitor.js.map +1 -1
  177. package/lib/esm/Validation/SchemaComparer.js.map +1 -1
  178. package/lib/esm/Validation/SchemaValidater.js.map +1 -1
  179. package/lib/esm/Validation/SchemaValidationVisitor.js.map +1 -1
  180. package/lib/esm/Validation/SchemaWalker.js.map +1 -1
  181. package/lib/esm/ecschema-editing.js.map +1 -1
  182. package/package.json +9 -9
  183. package/public/locales/en/ECSchemaEditing.json +26 -26
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaDifferenceValidator.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifferenceValidator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,eAAe,EAAe,WAAW,EAAU,YAAY,EAAE,cAAc,EAA+B,kBAAkB,EAAE,qBAAqB,EAAY,oBAAoB,EAAsB,aAAa,EAAa,eAAe,EAAQ,MAAM,0BAA0B,CAAC;AAExU,OAAO,EAA+B,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAA2B,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAC5F,OAAO,EAAe,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAExE;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,WAAkC,EAAE,YAAoB,EAAE,YAAoB,EAAE,YAAyB;IACjJ,MAAM,OAAO,GAAG,IAAI,iCAAiC,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IAChG,MAAM,MAAM,GAAG,IAAI,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAEnD,MAAM,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAEnC,OAAO,OAAO,CAAC,SAAS,CAAC;AAC3B,CAAC;AAED;;;GAGG;AACH,MAAM,iCAAiC;IAErB,SAAS,CAAqC;IAC7C,aAAa,CAAS;IACtB,aAAa,CAAS;IACtB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tE,OAAO,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC;AACnC,CAAC;AAED;;;;GAIG;AACH,SAAS,uBAAuB,CAAC,QAAkB;IACjD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACpE,IAAI,QAAQ,CAAC,aAAa,EAAE;QAC1B,OAAO,GAAG,MAAM,GAAG,uBAAuB,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,MAAM,EAAE,CAAC;IAC9E,IAAI,QAAQ,CAAC,WAAW,EAAE;QACxB,OAAO,GAAG,MAAM,GAAG,qBAAqB,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAG,MAAM,EAAE,CAAC;IAC9E,IAAI,QAAQ,CAAC,QAAQ,EAAE;QACrB,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,QAAQ,GAAG,MAAM,EAAE,CAAC;IAC9D,IAAI,QAAQ,CAAC,YAAY,EAAE;QACzB,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,GAAG,MAAM,EAAE,CAAC;IACpE,OAAO,oBAAoB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,SAAS,aAAa,CAAC,aAAwB,EAAE,cAAyB;IACxE,OAAO,aAAa,CAAC,OAAO,CAAC,cAAc,EAAE,eAAe,CAAC,qBAAqB,CAAC;WAC5E,cAAc,CAAC,OAAO,CAAC,aAAa,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;AACtF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Differencing\n */\n\nimport { classModifierToString, ECClass, ECClassModifier, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, LazyLoadedSchemaItem, Mixin, parseClassModifier, primitiveTypeToString, Property, propertyTypeToString, Schema, SchemaItem, SchemaItemKey, SchemaKey, SchemaMatchType, Unit } from \"@itwin/ecschema-metadata\";\nimport { AnyClassItemDifference, AnySchemaDifference, AnySchemaItemDifference, ClassPropertyDifference, ConstantDifference, CustomAttributeClassDifference, CustomAttributeDifference, EntityClassDifference, EntityClassMixinDifference, EnumerationDifference, EnumeratorDifference, FormatDifference, FormatUnitDifference, FormatUnitLabelDifference, InvertedUnitDifference, KindOfQuantityDifference, KindOfQuantityPresentationFormatDifference, MixinClassDifference, PhenomenonDifference, PropertyCategoryDifference, RelationshipClassDifference, RelationshipConstraintClassDifference, RelationshipConstraintDifference, SchemaDifference, SchemaReferenceDifference, StructClassDifference, UnitDifference, UnitSystemDifference } from \"./SchemaDifference\";\nimport { AnySchemaDifferenceConflict, ConflictCode } from \"./SchemaConflicts\";\nimport { SchemaDifferenceVisitor, SchemaDifferenceWalker } from \"./SchemaDifferenceVisitor\";\nimport { NameMapping, PropertyKey } from \"../Merging/Edits/NameMapping\";\n\n/**\n * Validates the given array of schema differences and returns a list of conflicts if the\n * validation finds violation against rules.\n * @param differences An array of schema differences.\n * @param targetSchema The target schema reference.\n * @param sourceSchema The source schema reference.\n * @returns An array of conflicts found when validating the difference.\n * @internal\n */\nexport async function validateDifferences(differences: AnySchemaDifference[], targetSchema: Schema, sourceSchema: Schema, nameMappings: NameMapping) {\n const visitor = new SchemaDifferenceValidationVisitor(targetSchema, sourceSchema, nameMappings);\n const walker = new SchemaDifferenceWalker(visitor);\n\n await walker.traverse(differences);\n\n return visitor.conflicts;\n}\n\n/**\n * The SchemaDifferenceValidationVisitor class is an implementation of ISchemaDifferenceVisitor and\n * validates the given SchemaDifferences if the violate against some EC Rules.\n */\nclass SchemaDifferenceValidationVisitor implements SchemaDifferenceVisitor {\n\n public readonly conflicts: Array<AnySchemaDifferenceConflict>;\n private readonly _sourceSchema: Schema;\n private readonly _targetSchema: Schema;\n private readonly _nameMappings: NameMapping;\n\n /** Initializes a new instance of SchemaDifferenceValidationVisitor class. */\n constructor(targetSchema: Schema, sourceSchema: Schema, nameMappings: NameMapping) {\n this.conflicts = [];\n this._targetSchema = targetSchema;\n this._sourceSchema = sourceSchema;\n this._nameMappings = nameMappings;\n }\n\n private addConflict(conflict: AnySchemaDifferenceConflict) {\n this.conflicts.push(conflict);\n }\n\n private async getTargetSchemaItem(name: string): Promise<SchemaItem | undefined> {\n const itemKey = new SchemaItemKey(name, this._sourceSchema.schemaKey);\n const mappedKey = this._nameMappings.resolveItemKey(itemKey);\n return this._targetSchema.getItem(mappedKey.name);\n }\n\n private getTargetProperty(itemName: string, propertyName: string): PropertyKey {\n const classKey = new SchemaItemKey(itemName, this._sourceSchema.schemaKey);\n const propertyKey = new PropertyKey(propertyName, classKey);\n return this._nameMappings.resolvePropertyKey(propertyKey);\n }\n\n /**\n * Visitor implementation for handling SchemaDifference.\n * @internal\n */\n public async visitSchemaDifference(_entry: SchemaDifference) {\n }\n\n /**\n * Visitor implementation for handling SchemaReferenceDifference.\n * @internal\n */\n public async visitSchemaReferenceDifference(entry: SchemaReferenceDifference) {\n const sourceSchemaReference = await this._sourceSchema.getReference(entry.difference.name) as Schema;\n const targetSchemaReferenceName = this._targetSchema.getReferenceNameByAlias(sourceSchemaReference.alias);\n if (targetSchemaReferenceName && targetSchemaReferenceName !== sourceSchemaReference.name) {\n return this.addConflict({\n code: ConflictCode.ConflictingReferenceAlias,\n difference: entry,\n source: entry.difference.name,\n target: targetSchemaReferenceName,\n description: \"Target schema already references a different schema with this alias.\",\n });\n }\n\n // The targetSchemaReference can be undefined, if the reference will be added by the source schema.\n // In this case further validation is not needed.\n const targetSchemaReference = await this._targetSchema.getReference(entry.difference.name);\n if(targetSchemaReference === undefined) {\n return;\n }\n\n const sourceSchemaKey = sourceSchemaReference.schemaKey;\n const targetSchemaKey = targetSchemaReference.schemaKey;\n\n if(targetSchemaReference.isDynamic !== sourceSchemaReference.isDynamic) {\n return this.addConflict({\n code: ConflictCode.ConflictingReferenceDynamic,\n difference: entry,\n description: \"Cannot update a schema reference to or from a dynamic schema.\",\n source: sourceSchemaKey.toString(),\n target: targetSchemaKey.toString(),\n });\n }\n\n if(entry.changeType === \"modify\" && !targetSchemaReference.isDynamic && !areCompatible(sourceSchemaKey, targetSchemaKey)) {\n return this.addConflict({\n code: ConflictCode.ConflictingReferenceVersion,\n difference: entry,\n description: \"Schema reference cannot be updated, incompatible versions\",\n source: sourceSchemaKey.toString(),\n target: targetSchemaKey.toString(),\n });\n }\n }\n\n /**\n * Shared schema item validation for all types of AnySchemaItemDifference union.\n */\n private async visitSchemaItemDifference(entry: AnySchemaItemDifference, targetSchemaItem: SchemaItem | undefined) {\n // If the item shall be added, but the target schema already has an item with this name,\n // will produce an ConflictingItemName conflict.\n if (entry.changeType === \"add\" && targetSchemaItem !== undefined) {\n this.addConflict({\n code: ConflictCode.ConflictingItemName,\n difference: entry,\n source: entry.schemaType,\n target: targetSchemaItem.schemaItemType,\n description: \"Target schema already contains a schema item with the name but different type.\",\n });\n return false;\n }\n\n return true;\n }\n\n /**\n * Shared base-class validation for all types of ClassItemDifference union.\n */\n private async visitBaseClassDifference(entry: AnyClassItemDifference, targetClassItem: ECClass) {\n if (\"baseClass\" in entry.difference && entry.difference.baseClass === undefined && targetClassItem.baseClass !== undefined) {\n return this.addConflict({\n code: ConflictCode.RemovingBaseClass,\n difference: entry,\n source: null,\n target: resolveLazyItemFullName(targetClassItem.baseClass),\n description: \"BaseClass cannot be removed, if there has been a baseClass before.\",\n });\n }\n\n if (entry.difference.baseClass === undefined) {\n return;\n }\n\n const sourceBaseClass = await this._sourceSchema.lookupItem(entry.difference.baseClass) as ECClass;\n if (sourceBaseClass.modifier === ECClassModifier.Sealed) {\n return this.addConflict({\n code: ConflictCode.SealedBaseClass,\n difference: entry,\n source: sourceBaseClass.fullName,\n target: resolveLazyItemFullName(targetClassItem.baseClass) || null,\n description: \"BaseClass is sealed.\",\n });\n }\n\n if (targetClassItem.baseClass && !await this.derivedFrom(sourceBaseClass, targetClassItem.baseClass)) {\n return this.addConflict({\n code: ConflictCode.ConflictingBaseClass,\n difference: entry,\n source: sourceBaseClass.fullName,\n target: resolveLazyItemFullName(targetClassItem.baseClass),\n description: \"BaseClass is not valid, source class must derive from target.\",\n });\n }\n }\n\n /**\n * Shared validation for all types of ClassItemDifference union.\n */\n private async visitClassDifference(entry: AnyClassItemDifference) {\n const targetClassItem = await this.getTargetSchemaItem(entry.itemName);\n if (!await this.visitSchemaItemDifference(entry, targetClassItem)) {\n return;\n }\n\n if (entry.changeType === \"modify\" && ECClass.isECClass(targetClassItem)) {\n await this.visitClassModifierDifference(entry, targetClassItem);\n await this.visitBaseClassDifference(entry, targetClassItem);\n }\n }\n\n /**\n * Validation the modifiers of all types of ClassItemDifference union.\n */\n private async visitClassModifierDifference(entry: AnyClassItemDifference, targetClass: ECClass) {\n if (entry.difference.modifier) {\n const changedModifier = parseClassModifier(entry.difference.modifier);\n if (changedModifier !== undefined && changedModifier !== ECClassModifier.None) {\n this.addConflict({\n code: ConflictCode.ConflictingClassModifier,\n difference: entry,\n source: entry.difference.modifier,\n target: classModifierToString(targetClass.modifier),\n description: \"Class has conflicting modifiers.\",\n });\n }\n }\n }\n\n /**\n * Visitor implementation for handling ConstantDifference.\n * @internal\n */\n public async visitConstantDifference(entry: ConstantDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling CustomAttributeClassDifference.\n * @internal\n */\n public async visitCustomAttributeClassDifference(entry: CustomAttributeClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling CustomAttributeDifference.\n * @internal\n */\n public async visitCustomAttributeInstanceDifference(_entry: CustomAttributeDifference) {\n }\n\n /**\n * Visitor implementation for handling EntityClassDifference.\n * @internal\n */\n public async visitEntityClassDifference(entry: EntityClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling EntityClassMixinDifference.\n * @internal\n */\n public async visitEntityClassMixinDifference(entry: EntityClassMixinDifference) {\n for (const addedMixin of entry.difference) {\n // To validate the added mixins, the instance from the source schema it fetched,\n // otherwise validation gets too complicated as the mixin must not be existing in\n // the current target schema, it could also be added to the schema.\n const sourceMixin = await this._sourceSchema.lookupItem(addedMixin) as Mixin;\n const sourceSchemaItem = await this._sourceSchema.getItem(entry.itemName) as EntityClass;\n if (sourceMixin.appliesTo && !await sourceSchemaItem.is(await sourceMixin.appliesTo)) {\n this.addConflict({\n code: ConflictCode.MixinAppliedMustDeriveFromConstraint,\n difference: entry,\n source: addedMixin,\n target: undefined,\n description: \"Mixin cannot applied to this class.\",\n });\n }\n }\n }\n\n /**\n * Visitor implementation for handling EnumerationDifference.\n * @internal\n */\n public async visitEnumerationDifference(entry: EnumerationDifference) {\n const enumeration = await this.getTargetSchemaItem(entry.itemName);\n if (!await this.visitSchemaItemDifference(entry, enumeration)) {\n return;\n }\n\n if (entry.changeType === \"modify\" && Enumeration.isEnumeration(enumeration) && enumeration.type !== undefined) {\n if (entry.difference.type) {\n this.addConflict({\n code: ConflictCode.ConflictingEnumerationType,\n difference: entry,\n source: entry.difference.type,\n target: primitiveTypeToString(enumeration.type),\n description: \"Enumeration has a different primitive type.\",\n });\n }\n }\n }\n\n /**\n * Visitor implementation for handling EnumeratorDifference.\n * @internal\n */\n public async visitEnumeratorDifference(entry: EnumeratorDifference) {\n if (entry.changeType !== \"modify\") {\n return;\n }\n\n const enumeration = await this.getTargetSchemaItem(entry.itemName) as Enumeration;\n const enumerator = enumeration.getEnumeratorByName(entry.path);\n if (!enumerator) {\n return;\n }\n\n if (entry.difference.value) {\n this.addConflict({\n code: ConflictCode.ConflictingEnumeratorValue,\n difference: entry,\n source: entry.difference.value,\n target: enumerator.value,\n description: \"Enumerators must have unique values.\",\n });\n }\n }\n\n /**\n * Visitor implementation for handling FormatDifference.\n * @internal\n */\n public async visitFormatDifference(entry: FormatDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling InvertedUnitDifference.\n * @internal\n */\n public async visitInvertedUnitDifference(entry: InvertedUnitDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling KindOfQuantityDifference.\n * @internal\n */\n public async visitKindOfQuantityDifference(entry: KindOfQuantityDifference) {\n const kindOfQuantity = await this.getTargetSchemaItem(entry.itemName);\n if (!await this.visitSchemaItemDifference(entry, kindOfQuantity)) {\n return;\n }\n\n if (entry.changeType === \"modify\" && KindOfQuantity.isKindOfQuantity(kindOfQuantity)) {\n if (entry.difference.persistenceUnit) {\n this.addConflict({\n code: ConflictCode.ConflictingPersistenceUnit,\n difference: entry,\n source: entry.difference.persistenceUnit,\n target: resolveLazyItemFullName(kindOfQuantity.persistenceUnit),\n description: \"Kind of Quantity has a different persistence unit.\",\n });\n }\n }\n }\n\n /**\n * Visitor implementation for handling MixinClassDifference.\n * @internal\n */\n public async visitMixinDifference(entry: MixinClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling PhenomenonDifference.\n * @internal\n */\n public async visitPhenomenonDifference(entry: PhenomenonDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling ClassPropertyDifference.\n * @internal\n */\n public async visitPropertyDifference(entry: ClassPropertyDifference) {\n const targetClass = await this.getTargetSchemaItem(entry.itemName) as ECClass;\n const propertyKey = this.getTargetProperty(entry.itemName, entry.path);\n const targetProperty = await targetClass.getProperty(propertyKey.propertyName);\n\n const sourceClass = await this._sourceSchema.getItem(entry.itemName) as ECClass;\n const sourceProperty = await sourceClass.getProperty(entry.path) as Property;\n\n // If property shall be added but there is already a property with this name\n // in target, a ConflictingPropertyName is issued.\n if (entry.changeType === \"add\" && targetProperty !== undefined) {\n return this.addConflict({\n code: ConflictCode.ConflictingPropertyName,\n difference: entry,\n source: resolvePropertyTypeName(sourceProperty),\n target: resolvePropertyTypeName(targetProperty),\n description: \"Target class already contains a property with a different type.\",\n });\n }\n\n if (entry.changeType === \"modify\" && targetProperty !== undefined) {\n if (\"kindOfQuantity\" in entry.difference) {\n const sourceKoQ = await sourceProperty.kindOfQuantity;\n const targetKoQ = await targetProperty.kindOfQuantity;\n if(!targetKoQ) {\n return this.addConflict({\n code: ConflictCode.ConflictingPropertyKindOfQuantity,\n difference: entry,\n source: entry.difference.kindOfQuantity,\n target: null,\n description: \"The kind of quantity cannot be assiged if the property did not have a kind of quantities before.\",\n });\n }\n\n if(!sourceKoQ) {\n return this.addConflict({\n code: ConflictCode.ConflictingPropertyKindOfQuantity,\n difference: entry,\n source: null,\n target: resolveLazyItemFullName(targetProperty.kindOfQuantity),\n description: \"The kind of quantity cannot be undefined if the property had a kind of quantities before.\",\n });\n }\n\n if (resolveLazyItemName(sourceKoQ.persistenceUnit) !== resolveLazyItemName(targetKoQ.persistenceUnit)) {\n this.addConflict({\n code: ConflictCode.ConflictingPropertyKindOfQuantityUnit,\n difference: entry,\n source: entry.difference.kindOfQuantity,\n target: resolveLazyItemFullName(targetProperty.kindOfQuantity),\n description: \"The property has different kind of quantities with conflicting units.\",\n });\n }\n }\n }\n }\n\n /**\n * Visitor implementation for handling PropertyCategoryDifference.\n * @internal\n */\n public async visitPropertyCategoryDifference(entry: PropertyCategoryDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling RelationshipClassDifference.\n * @internal\n */\n public async visitRelationshipClassDifference(entry: RelationshipClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling RelationshipConstraintDifference.\n * @internal\n */\n public async visitRelationshipConstraintDifference(_entry: RelationshipConstraintDifference) {\n }\n\n /**\n * Visitor implementation for handling RelationshipConstraintClassDifference.\n * @internal\n */\n public async visitRelationshipConstraintClassDifference(_entry: RelationshipConstraintClassDifference) {\n }\n\n /**\n * Visitor implementation for handling StructClassDifference.\n * @internal\n */\n public async visitStructClassDifference(entry: StructClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling UnitDifference.\n * @internal\n */\n public async visitUnitDifference(entry: UnitDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling UnitSystemDifference.\n * @internal\n */\n public async visitUnitSystemDifference(entry: UnitSystemDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling KindOfQuantityPresentationFormatDifference.\n * @internal\n */\n public async visitKindOfQuantityPresentationFormatDifference(_entry: KindOfQuantityPresentationFormatDifference) {\n }\n\n /**\n * Visitor implementation for handling FormatUnitDifference.\n * @internal\n */\n public async visitFormatUnitDifference(entry: FormatUnitDifference) {\n const targetFormat = await this.getTargetSchemaItem(entry.itemName) as Format;\n\n if (targetFormat.units === undefined) {\n return this.addConflict({\n code: ConflictCode.ConflictingFormatUnit,\n difference: entry,\n source: entry.difference[0].name,\n target: null,\n description: \"The unit cannot be assiged if the format did not have a unit before.\",\n });\n };\n\n const targetUnit = await targetFormat.units[0][0];\n const targetPhenomenon = InvertedUnit.isInvertedUnit(targetUnit)\n ? (await targetUnit.invertsUnit)?.phenomenon\n : targetUnit.phenomenon;\n\n const sourceUnit = await this._sourceSchema.lookupItem(entry.difference[0].name) as Unit | InvertedUnit;\n const sourcePhenomenon = InvertedUnit.isInvertedUnit(sourceUnit)\n ? (await sourceUnit.invertsUnit)?.phenomenon\n : sourceUnit.phenomenon;\n\n if (resolveLazyItemName(targetPhenomenon) !== resolveLazyItemName(sourcePhenomenon)) {\n return this.addConflict({\n code: ConflictCode.ConflictingFormatUnitPhenomenon,\n difference: entry,\n source: entry.difference[0].name,\n target: targetUnit.fullName,\n description: \"Format units has a different phenomenon.\",\n });\n };\n };\n\n /**\n * Visitor implementation for handling FormatUnitLabelDifference.\n * @internal\n */\n public async visitFormatUnitLabelDifference(_entry: FormatUnitLabelDifference) {\n }\n\n /**\n * Recursive synchronous function to figure whether a given class derived from\n * a class with the given baseClass name.\n */\n private async derivedFrom(ecClass: ECClass | undefined, baseClassKey: Readonly<SchemaItemKey>): Promise<boolean> {\n if (ecClass === undefined) {\n return false;\n }\n\n // First check for name which must be same in any case...\n if (ecClass.name === baseClassKey.name) {\n // ... then check if the class is in the same schema as the expected base class...\n if(ecClass.schema.name === baseClassKey.schemaName)\n return true;\n // ... if not, whether it's in the source schema, but then we expect the baseclass\n // to be in the target schema.\n if(ecClass.schema.name === this._sourceSchema.name && baseClassKey.schemaName === this._targetSchema.name)\n return true;\n }\n return this.derivedFrom(await ecClass.baseClass, baseClassKey);\n }\n}\n\n/**\n * Helper method to resolve the schema item name from lazy loaded schema items.\n * @param lazyItem LazyLoaded item\n * @returns The full name of the item or undefined item was not set.\n */\nfunction resolveLazyItemFullName(lazyItem?: LazyLoadedSchemaItem<SchemaItem>) {\n return lazyItem && lazyItem.fullName;\n}\n\n/**\n * Helper method to resolve the schema item name from lazy loaded schema items.\n * @param lazyItem LazyLoaded item\n * @returns The full name of the item or undefined item was not set.\n */\nfunction resolveLazyItemName(lazyItem?: LazyLoadedSchemaItem<SchemaItem>) {\n return lazyItem && lazyItem.name;\n}\n\n/**\n * Helper method to resolve the type name of a property.\n * @param property The property which's type shall be resolved.\n * @returns The (full) name of the properties type.\n */\nfunction resolvePropertyTypeName(property: Property) {\n const [prefix, suffix] = property.isArray() ? [\"[\", \"]\"] : [\"\", \"\"];\n if (property.isEnumeration())\n return `${prefix}${resolveLazyItemFullName(property.enumeration)}${suffix}`;\n if (property.isPrimitive())\n return `${prefix}${primitiveTypeToString(property.primitiveType)}${suffix}`;\n if (property.isStruct())\n return `${prefix}${property.structClass.fullName}${suffix}`;\n if (property.isNavigation())\n return `${prefix}${property.relationshipClass.fullName}${suffix}`;\n return propertyTypeToString(property.propertyType);\n}\n\n/**\n * Checks if the two schemas are compatible. Since the merger will eventually take the most\n * recent schema version, it is sufficient to check if they are write compatible in one direction.\n */\nfunction areCompatible(leftSchemaKey: SchemaKey, rightSchemaKey: SchemaKey): boolean {\n return leftSchemaKey.matches(rightSchemaKey, SchemaMatchType.LatestWriteCompatible)\n || rightSchemaKey.matches(leftSchemaKey, SchemaMatchType.LatestWriteCompatible);\n}\n"]}
1
+ {"version":3,"file":"SchemaDifferenceValidator.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifferenceValidator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,eAAe,EAAe,WAAW,EAAU,YAAY,EAAE,cAAc,EAA+B,kBAAkB,EAAE,qBAAqB,EAAY,oBAAoB,EAAsB,aAAa,EAAa,eAAe,EAAQ,MAAM,0BAA0B,CAAC;AAExU,OAAO,EAA+B,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAA2B,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAC5F,OAAO,EAAe,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAExE;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,WAAkC,EAAE,YAAoB,EAAE,YAAoB,EAAE,YAAyB;IACjJ,MAAM,OAAO,GAAG,IAAI,iCAAiC,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IAChG,MAAM,MAAM,GAAG,IAAI,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAEnD,MAAM,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAEnC,OAAO,OAAO,CAAC,SAAS,CAAC;AAC3B,CAAC;AAED;;;GAGG;AACH,MAAM,iCAAiC;I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ACvC,CAAC;AAED;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,QAA2C;IACtE,OAAO,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC;AACnC,CAAC;AAED;;;;GAIG;AACH,SAAS,uBAAuB,CAAC,QAAkB;IACjD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACpE,IAAI,QAAQ,CAAC,aAAa,EAAE;QAC1B,OAAO,GAAG,MAAM,GAAG,uBAAuB,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,MAAM,EAAE,CAAC;IAC9E,IAAI,QAAQ,CAAC,WAAW,EAAE;QACxB,OAAO,GAAG,MAAM,GAAG,qBAAqB,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAG,MAAM,EAAE,CAAC;IAC9E,IAAI,QAAQ,CAAC,QAAQ,EAAE;QACrB,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,QAAQ,GAAG,MAAM,EAAE,CAAC;IAC9D,IAAI,QAAQ,CAAC,YAAY,EAAE;QACzB,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,GAAG,MAAM,EAAE,CAAC;IACpE,OAAO,oBAAoB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,SAAS,aAAa,CAAC,aAAwB,EAAE,cAAyB;IACxE,OAAO,aAAa,CAAC,OAAO,CAAC,cAAc,EAAE,eAAe,CAAC,qBAAqB,CAAC;WAC5E,cAAc,CAAC,OAAO,CAAC,aAAa,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;AACtF,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 Differencing\r\n */\r\n\r\nimport { classModifierToString, ECClass, ECClassModifier, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, LazyLoadedSchemaItem, Mixin, parseClassModifier, primitiveTypeToString, Property, propertyTypeToString, Schema, SchemaItem, SchemaItemKey, SchemaKey, SchemaMatchType, Unit } from \"@itwin/ecschema-metadata\";\r\nimport { AnyClassItemDifference, AnySchemaDifference, AnySchemaItemDifference, ClassPropertyDifference, ConstantDifference, CustomAttributeClassDifference, CustomAttributeDifference, EntityClassDifference, EntityClassMixinDifference, EnumerationDifference, EnumeratorDifference, FormatDifference, FormatUnitDifference, FormatUnitLabelDifference, InvertedUnitDifference, KindOfQuantityDifference, KindOfQuantityPresentationFormatDifference, MixinClassDifference, PhenomenonDifference, PropertyCategoryDifference, RelationshipClassDifference, RelationshipConstraintClassDifference, RelationshipConstraintDifference, SchemaDifference, SchemaReferenceDifference, StructClassDifference, UnitDifference, UnitSystemDifference } from \"./SchemaDifference\";\r\nimport { AnySchemaDifferenceConflict, ConflictCode } from \"./SchemaConflicts\";\r\nimport { SchemaDifferenceVisitor, SchemaDifferenceWalker } from \"./SchemaDifferenceVisitor\";\r\nimport { NameMapping, PropertyKey } from \"../Merging/Edits/NameMapping\";\r\n\r\n/**\r\n * Validates the given array of schema differences and returns a list of conflicts if the\r\n * validation finds violation against rules.\r\n * @param differences An array of schema differences.\r\n * @param targetSchema The target schema reference.\r\n * @param sourceSchema The source schema reference.\r\n * @returns An array of conflicts found when validating the difference.\r\n * @internal\r\n */\r\nexport async function validateDifferences(differences: AnySchemaDifference[], targetSchema: Schema, sourceSchema: Schema, nameMappings: NameMapping) {\r\n const visitor = new SchemaDifferenceValidationVisitor(targetSchema, sourceSchema, nameMappings);\r\n const walker = new SchemaDifferenceWalker(visitor);\r\n\r\n await walker.traverse(differences);\r\n\r\n return visitor.conflicts;\r\n}\r\n\r\n/**\r\n * The SchemaDifferenceValidationVisitor class is an implementation of ISchemaDifferenceVisitor and\r\n * validates the given SchemaDifferences if the violate against some EC Rules.\r\n */\r\nclass SchemaDifferenceValidationVisitor implements SchemaDifferenceVisitor {\r\n\r\n public readonly conflicts: Array<AnySchemaDifferenceConflict>;\r\n private readonly _sourceSchema: Schema;\r\n private readonly _targetSchema: Schema;\r\n private readonly _nameMappings: NameMapping;\r\n\r\n /** Initializes a new instance of SchemaDifferenceValidationVisitor class. */\r\n constructor(targetSchema: Schema, sourceSchema: Schema, nameMappings: NameMapping) {\r\n this.conflicts = [];\r\n this._targetSchema = targetSchema;\r\n this._sourceSchema = sourceSchema;\r\n this._nameMappings = nameMappings;\r\n }\r\n\r\n private addConflict(conflict: AnySchemaDifferenceConflict) {\r\n this.conflicts.push(conflict);\r\n }\r\n\r\n private async getTargetSchemaItem(name: string): Promise<SchemaItem | undefined> {\r\n const itemKey = new SchemaItemKey(name, this._sourceSchema.schemaKey);\r\n const mappedKey = this._nameMappings.resolveItemKey(itemKey);\r\n return this._targetSchema.getItem(mappedKey.name);\r\n }\r\n\r\n private getTargetProperty(itemName: string, propertyName: string): PropertyKey {\r\n const classKey = new SchemaItemKey(itemName, this._sourceSchema.schemaKey);\r\n const propertyKey = new PropertyKey(propertyName, classKey);\r\n return this._nameMappings.resolvePropertyKey(propertyKey);\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling SchemaDifference.\r\n * @internal\r\n */\r\n public async visitSchemaDifference(_entry: SchemaDifference) {\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling SchemaReferenceDifference.\r\n * @internal\r\n */\r\n public async visitSchemaReferenceDifference(entry: SchemaReferenceDifference) {\r\n const sourceSchemaReference = await this._sourceSchema.getReference(entry.difference.name) as Schema;\r\n const targetSchemaReferenceName = this._targetSchema.getReferenceNameByAlias(sourceSchemaReference.alias);\r\n if (targetSchemaReferenceName && targetSchemaReferenceName !== sourceSchemaReference.name) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingReferenceAlias,\r\n difference: entry,\r\n source: entry.difference.name,\r\n target: targetSchemaReferenceName,\r\n description: \"Target schema already references a different schema with this alias.\",\r\n });\r\n }\r\n\r\n // The targetSchemaReference can be undefined, if the reference will be added by the source schema.\r\n // In this case further validation is not needed.\r\n const targetSchemaReference = await this._targetSchema.getReference(entry.difference.name);\r\n if(targetSchemaReference === undefined) {\r\n return;\r\n }\r\n\r\n const sourceSchemaKey = sourceSchemaReference.schemaKey;\r\n const targetSchemaKey = targetSchemaReference.schemaKey;\r\n\r\n if(targetSchemaReference.isDynamic !== sourceSchemaReference.isDynamic) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingReferenceDynamic,\r\n difference: entry,\r\n description: \"Cannot update a schema reference to or from a dynamic schema.\",\r\n source: sourceSchemaKey.toString(),\r\n target: targetSchemaKey.toString(),\r\n });\r\n }\r\n\r\n if(entry.changeType === \"modify\" && !targetSchemaReference.isDynamic && !areCompatible(sourceSchemaKey, targetSchemaKey)) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingReferenceVersion,\r\n difference: entry,\r\n description: \"Schema reference cannot be updated, incompatible versions\",\r\n source: sourceSchemaKey.toString(),\r\n target: targetSchemaKey.toString(),\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Shared schema item validation for all types of AnySchemaItemDifference union.\r\n */\r\n private async visitSchemaItemDifference(entry: AnySchemaItemDifference, targetSchemaItem: SchemaItem | undefined) {\r\n // If the item shall be added, but the target schema already has an item with this name,\r\n // will produce an ConflictingItemName conflict.\r\n if (entry.changeType === \"add\" && targetSchemaItem !== undefined) {\r\n this.addConflict({\r\n code: ConflictCode.ConflictingItemName,\r\n difference: entry,\r\n source: entry.schemaType,\r\n target: targetSchemaItem.schemaItemType,\r\n description: \"Target schema already contains a schema item with the name but different type.\",\r\n });\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Shared base-class validation for all types of ClassItemDifference union.\r\n */\r\n private async visitBaseClassDifference(entry: AnyClassItemDifference, targetClassItem: ECClass) {\r\n if (\"baseClass\" in entry.difference && entry.difference.baseClass === undefined && targetClassItem.baseClass !== undefined) {\r\n return this.addConflict({\r\n code: ConflictCode.RemovingBaseClass,\r\n difference: entry,\r\n source: null,\r\n target: resolveLazyItemFullName(targetClassItem.baseClass),\r\n description: \"BaseClass cannot be removed, if there has been a baseClass before.\",\r\n });\r\n }\r\n\r\n if (entry.difference.baseClass === undefined) {\r\n return;\r\n }\r\n\r\n const sourceBaseClass = await this._sourceSchema.lookupItem(entry.difference.baseClass) as ECClass;\r\n if (sourceBaseClass.modifier === ECClassModifier.Sealed) {\r\n return this.addConflict({\r\n code: ConflictCode.SealedBaseClass,\r\n difference: entry,\r\n source: sourceBaseClass.fullName,\r\n target: resolveLazyItemFullName(targetClassItem.baseClass) || null,\r\n description: \"BaseClass is sealed.\",\r\n });\r\n }\r\n\r\n if (targetClassItem.baseClass && !await this.derivedFrom(sourceBaseClass, targetClassItem.baseClass)) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingBaseClass,\r\n difference: entry,\r\n source: sourceBaseClass.fullName,\r\n target: resolveLazyItemFullName(targetClassItem.baseClass),\r\n description: \"BaseClass is not valid, source class must derive from target.\",\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Shared validation for all types of ClassItemDifference union.\r\n */\r\n private async visitClassDifference(entry: AnyClassItemDifference) {\r\n const targetClassItem = await this.getTargetSchemaItem(entry.itemName);\r\n if (!await this.visitSchemaItemDifference(entry, targetClassItem)) {\r\n return;\r\n }\r\n\r\n if (entry.changeType === \"modify\" && ECClass.isECClass(targetClassItem)) {\r\n await this.visitClassModifierDifference(entry, targetClassItem);\r\n await this.visitBaseClassDifference(entry, targetClassItem);\r\n }\r\n }\r\n\r\n /**\r\n * Validation the modifiers of all types of ClassItemDifference union.\r\n */\r\n private async visitClassModifierDifference(entry: AnyClassItemDifference, targetClass: ECClass) {\r\n if (entry.difference.modifier) {\r\n const changedModifier = parseClassModifier(entry.difference.modifier);\r\n if (changedModifier !== undefined && changedModifier !== ECClassModifier.None) {\r\n this.addConflict({\r\n code: ConflictCode.ConflictingClassModifier,\r\n difference: entry,\r\n source: entry.difference.modifier,\r\n target: classModifierToString(targetClass.modifier),\r\n description: \"Class has conflicting modifiers.\",\r\n });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling ConstantDifference.\r\n * @internal\r\n */\r\n public async visitConstantDifference(entry: ConstantDifference) {\r\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling CustomAttributeClassDifference.\r\n * @internal\r\n */\r\n public async visitCustomAttributeClassDifference(entry: CustomAttributeClassDifference) {\r\n await this.visitClassDifference(entry);\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling CustomAttributeDifference.\r\n * @internal\r\n */\r\n public async visitCustomAttributeInstanceDifference(_entry: CustomAttributeDifference) {\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling EntityClassDifference.\r\n * @internal\r\n */\r\n public async visitEntityClassDifference(entry: EntityClassDifference) {\r\n await this.visitClassDifference(entry);\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling EntityClassMixinDifference.\r\n * @internal\r\n */\r\n public async visitEntityClassMixinDifference(entry: EntityClassMixinDifference) {\r\n for (const addedMixin of entry.difference) {\r\n // To validate the added mixins, the instance from the source schema it fetched,\r\n // otherwise validation gets too complicated as the mixin must not be existing in\r\n // the current target schema, it could also be added to the schema.\r\n const sourceMixin = await this._sourceSchema.lookupItem(addedMixin) as Mixin;\r\n const sourceSchemaItem = await this._sourceSchema.getItem(entry.itemName) as EntityClass;\r\n if (sourceMixin.appliesTo && !await sourceSchemaItem.is(await sourceMixin.appliesTo)) {\r\n this.addConflict({\r\n code: ConflictCode.MixinAppliedMustDeriveFromConstraint,\r\n difference: entry,\r\n source: addedMixin,\r\n target: undefined,\r\n description: \"Mixin cannot applied to this class.\",\r\n });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling EnumerationDifference.\r\n * @internal\r\n */\r\n public async visitEnumerationDifference(entry: EnumerationDifference) {\r\n const enumeration = await this.getTargetSchemaItem(entry.itemName);\r\n if (!await this.visitSchemaItemDifference(entry, enumeration)) {\r\n return;\r\n }\r\n\r\n if (entry.changeType === \"modify\" && Enumeration.isEnumeration(enumeration) && enumeration.type !== undefined) {\r\n if (entry.difference.type) {\r\n this.addConflict({\r\n code: ConflictCode.ConflictingEnumerationType,\r\n difference: entry,\r\n source: entry.difference.type,\r\n target: primitiveTypeToString(enumeration.type),\r\n description: \"Enumeration has a different primitive type.\",\r\n });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling EnumeratorDifference.\r\n * @internal\r\n */\r\n public async visitEnumeratorDifference(entry: EnumeratorDifference) {\r\n if (entry.changeType !== \"modify\") {\r\n return;\r\n }\r\n\r\n const enumeration = await this.getTargetSchemaItem(entry.itemName) as Enumeration;\r\n const enumerator = enumeration.getEnumeratorByName(entry.path);\r\n if (!enumerator) {\r\n return;\r\n }\r\n\r\n if (entry.difference.value) {\r\n this.addConflict({\r\n code: ConflictCode.ConflictingEnumeratorValue,\r\n difference: entry,\r\n source: entry.difference.value,\r\n target: enumerator.value,\r\n description: \"Enumerators must have unique values.\",\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling FormatDifference.\r\n * @internal\r\n */\r\n public async visitFormatDifference(entry: FormatDifference) {\r\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling InvertedUnitDifference.\r\n * @internal\r\n */\r\n public async visitInvertedUnitDifference(entry: InvertedUnitDifference) {\r\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling KindOfQuantityDifference.\r\n * @internal\r\n */\r\n public async visitKindOfQuantityDifference(entry: KindOfQuantityDifference) {\r\n const kindOfQuantity = await this.getTargetSchemaItem(entry.itemName);\r\n if (!await this.visitSchemaItemDifference(entry, kindOfQuantity)) {\r\n return;\r\n }\r\n\r\n if (entry.changeType === \"modify\" && KindOfQuantity.isKindOfQuantity(kindOfQuantity)) {\r\n if (entry.difference.persistenceUnit) {\r\n this.addConflict({\r\n code: ConflictCode.ConflictingPersistenceUnit,\r\n difference: entry,\r\n source: entry.difference.persistenceUnit,\r\n target: resolveLazyItemFullName(kindOfQuantity.persistenceUnit),\r\n description: \"Kind of Quantity has a different persistence unit.\",\r\n });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling MixinClassDifference.\r\n * @internal\r\n */\r\n public async visitMixinDifference(entry: MixinClassDifference) {\r\n await this.visitClassDifference(entry);\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling PhenomenonDifference.\r\n * @internal\r\n */\r\n public async visitPhenomenonDifference(entry: PhenomenonDifference) {\r\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling ClassPropertyDifference.\r\n * @internal\r\n */\r\n public async visitPropertyDifference(entry: ClassPropertyDifference) {\r\n const targetClass = await this.getTargetSchemaItem(entry.itemName) as ECClass;\r\n const propertyKey = this.getTargetProperty(entry.itemName, entry.path);\r\n const targetProperty = await targetClass.getProperty(propertyKey.propertyName);\r\n\r\n const sourceClass = await this._sourceSchema.getItem(entry.itemName) as ECClass;\r\n const sourceProperty = await sourceClass.getProperty(entry.path) as Property;\r\n\r\n // If property shall be added but there is already a property with this name\r\n // in target, a ConflictingPropertyName is issued.\r\n if (entry.changeType === \"add\" && targetProperty !== undefined) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingPropertyName,\r\n difference: entry,\r\n source: resolvePropertyTypeName(sourceProperty),\r\n target: resolvePropertyTypeName(targetProperty),\r\n description: \"Target class already contains a property with a different type.\",\r\n });\r\n }\r\n\r\n if (entry.changeType === \"modify\" && targetProperty !== undefined) {\r\n if (\"kindOfQuantity\" in entry.difference) {\r\n const sourceKoQ = await sourceProperty.kindOfQuantity;\r\n const targetKoQ = await targetProperty.kindOfQuantity;\r\n if(!targetKoQ) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingPropertyKindOfQuantity,\r\n difference: entry,\r\n source: entry.difference.kindOfQuantity,\r\n target: null,\r\n description: \"The kind of quantity cannot be assiged if the property did not have a kind of quantities before.\",\r\n });\r\n }\r\n\r\n if(!sourceKoQ) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingPropertyKindOfQuantity,\r\n difference: entry,\r\n source: null,\r\n target: resolveLazyItemFullName(targetProperty.kindOfQuantity),\r\n description: \"The kind of quantity cannot be undefined if the property had a kind of quantities before.\",\r\n });\r\n }\r\n\r\n if (resolveLazyItemName(sourceKoQ.persistenceUnit) !== resolveLazyItemName(targetKoQ.persistenceUnit)) {\r\n this.addConflict({\r\n code: ConflictCode.ConflictingPropertyKindOfQuantityUnit,\r\n difference: entry,\r\n source: entry.difference.kindOfQuantity,\r\n target: resolveLazyItemFullName(targetProperty.kindOfQuantity),\r\n description: \"The property has different kind of quantities with conflicting units.\",\r\n });\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling PropertyCategoryDifference.\r\n * @internal\r\n */\r\n public async visitPropertyCategoryDifference(entry: PropertyCategoryDifference) {\r\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling RelationshipClassDifference.\r\n * @internal\r\n */\r\n public async visitRelationshipClassDifference(entry: RelationshipClassDifference) {\r\n await this.visitClassDifference(entry);\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling RelationshipConstraintDifference.\r\n * @internal\r\n */\r\n public async visitRelationshipConstraintDifference(_entry: RelationshipConstraintDifference) {\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling RelationshipConstraintClassDifference.\r\n * @internal\r\n */\r\n public async visitRelationshipConstraintClassDifference(_entry: RelationshipConstraintClassDifference) {\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling StructClassDifference.\r\n * @internal\r\n */\r\n public async visitStructClassDifference(entry: StructClassDifference) {\r\n await this.visitClassDifference(entry);\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling UnitDifference.\r\n * @internal\r\n */\r\n public async visitUnitDifference(entry: UnitDifference) {\r\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling UnitSystemDifference.\r\n * @internal\r\n */\r\n public async visitUnitSystemDifference(entry: UnitSystemDifference) {\r\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling KindOfQuantityPresentationFormatDifference.\r\n * @internal\r\n */\r\n public async visitKindOfQuantityPresentationFormatDifference(_entry: KindOfQuantityPresentationFormatDifference) {\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling FormatUnitDifference.\r\n * @internal\r\n */\r\n public async visitFormatUnitDifference(entry: FormatUnitDifference) {\r\n const targetFormat = await this.getTargetSchemaItem(entry.itemName) as Format;\r\n\r\n if (targetFormat.units === undefined) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingFormatUnit,\r\n difference: entry,\r\n source: entry.difference[0].name,\r\n target: null,\r\n description: \"The unit cannot be assiged if the format did not have a unit before.\",\r\n });\r\n };\r\n\r\n const targetUnit = await targetFormat.units[0][0];\r\n const targetPhenomenon = InvertedUnit.isInvertedUnit(targetUnit)\r\n ? (await targetUnit.invertsUnit)?.phenomenon\r\n : targetUnit.phenomenon;\r\n\r\n const sourceUnit = await this._sourceSchema.lookupItem(entry.difference[0].name) as Unit | InvertedUnit;\r\n const sourcePhenomenon = InvertedUnit.isInvertedUnit(sourceUnit)\r\n ? (await sourceUnit.invertsUnit)?.phenomenon\r\n : sourceUnit.phenomenon;\r\n\r\n if (resolveLazyItemName(targetPhenomenon) !== resolveLazyItemName(sourcePhenomenon)) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingFormatUnitPhenomenon,\r\n difference: entry,\r\n source: entry.difference[0].name,\r\n target: targetUnit.fullName,\r\n description: \"Format units has a different phenomenon.\",\r\n });\r\n };\r\n };\r\n\r\n /**\r\n * Visitor implementation for handling FormatUnitLabelDifference.\r\n * @internal\r\n */\r\n public async visitFormatUnitLabelDifference(_entry: FormatUnitLabelDifference) {\r\n }\r\n\r\n /**\r\n * Recursive synchronous function to figure whether a given class derived from\r\n * a class with the given baseClass name.\r\n */\r\n private async derivedFrom(ecClass: ECClass | undefined, baseClassKey: Readonly<SchemaItemKey>): Promise<boolean> {\r\n if (ecClass === undefined) {\r\n return false;\r\n }\r\n\r\n // First check for name which must be same in any case...\r\n if (ecClass.name === baseClassKey.name) {\r\n // ... then check if the class is in the same schema as the expected base class...\r\n if(ecClass.schema.name === baseClassKey.schemaName)\r\n return true;\r\n // ... if not, whether it's in the source schema, but then we expect the baseclass\r\n // to be in the target schema.\r\n if(ecClass.schema.name === this._sourceSchema.name && baseClassKey.schemaName === this._targetSchema.name)\r\n return true;\r\n }\r\n return this.derivedFrom(await ecClass.baseClass, baseClassKey);\r\n }\r\n}\r\n\r\n/**\r\n * Helper method to resolve the schema item name from lazy loaded schema items.\r\n * @param lazyItem LazyLoaded item\r\n * @returns The full name of the item or undefined item was not set.\r\n */\r\nfunction resolveLazyItemFullName(lazyItem?: LazyLoadedSchemaItem<SchemaItem>) {\r\n return lazyItem && lazyItem.fullName;\r\n}\r\n\r\n/**\r\n * Helper method to resolve the schema item name from lazy loaded schema items.\r\n * @param lazyItem LazyLoaded item\r\n * @returns The full name of the item or undefined item was not set.\r\n */\r\nfunction resolveLazyItemName(lazyItem?: LazyLoadedSchemaItem<SchemaItem>) {\r\n return lazyItem && lazyItem.name;\r\n}\r\n\r\n/**\r\n * Helper method to resolve the type name of a property.\r\n * @param property The property which's type shall be resolved.\r\n * @returns The (full) name of the properties type.\r\n */\r\nfunction resolvePropertyTypeName(property: Property) {\r\n const [prefix, suffix] = property.isArray() ? [\"[\", \"]\"] : [\"\", \"\"];\r\n if (property.isEnumeration())\r\n return `${prefix}${resolveLazyItemFullName(property.enumeration)}${suffix}`;\r\n if (property.isPrimitive())\r\n return `${prefix}${primitiveTypeToString(property.primitiveType)}${suffix}`;\r\n if (property.isStruct())\r\n return `${prefix}${property.structClass.fullName}${suffix}`;\r\n if (property.isNavigation())\r\n return `${prefix}${property.relationshipClass.fullName}${suffix}`;\r\n return propertyTypeToString(property.propertyType);\r\n}\r\n\r\n/**\r\n * Checks if the two schemas are compatible. Since the merger will eventually take the most\r\n * recent schema version, it is sufficient to check if they are write compatible in one direction.\r\n */\r\nfunction areCompatible(leftSchemaKey: SchemaKey, rightSchemaKey: SchemaKey): boolean {\r\n return leftSchemaKey.matches(rightSchemaKey, SchemaMatchType.LatestWriteCompatible)\r\n || rightSchemaKey.matches(leftSchemaKey, SchemaMatchType.LatestWriteCompatible);\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaDifferenceVisitor.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifferenceVisitor.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAA4B,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAWhF;;;;GAIG;AACH,MAAM,OAAO,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,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AK,EAAE,KAAK,CAAC,CAAC;YACzE,KAAK,cAAc,CAAC,gBAAgB;gBAClC,OAAO,IAAI,CAAC,QAAQ,CAAC,+BAA+B,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACjF,KAAK,cAAc,CAAC,iBAAiB;gBACnC,OAAO,IAAI,CAAC,QAAQ,CAAC,gCAAgC,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAClF,KAAK,gBAAgB,CAAC,sBAAsB;gBAC1C,OAAO,IAAI,CAAC,QAAQ,CAAC,qCAAqC,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACvF,KAAK,gBAAgB,CAAC,2BAA2B;gBAC/C,OAAO,IAAI,CAAC,QAAQ,CAAC,0CAA0C,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC5F,KAAK,cAAc,CAAC,WAAW;gBAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,0BAA0B,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC5E,KAAK,cAAc,CAAC,IAAI;gBACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACrE,KAAK,cAAc,CAAC,UAAU;gBAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,yBAAyB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Differencing\n */\n\nimport { SchemaItemType } from \"@itwin/ecschema-metadata\";\nimport { type AnySchemaDifference, SchemaOtherTypes } from \"./SchemaDifference\";\n\n/**\n * Defines the interface for a visitor that can be used to traverse schema differences.\n * It dynamically creates a method for each schema difference type.\n * @internal\n */\nexport type SchemaDifferenceVisitor = {\n [Difference in AnySchemaDifference as `visit${Difference[\"schemaType\"]}Difference`]: (entry: Difference, index: number, array: AnySchemaDifference[]) => Promise<void>;\n};\n\n/**\n * Implementation of a walker that traverses schema differences and calls the appropriate\n * method on the visitor.\n * @internal\n */\nexport class SchemaDifferenceWalker {\n\n private readonly _visitor: SchemaDifferenceVisitor;\n\n /** Initializes a new instance of SchemaDifferenceWalker class. */\n constructor(visitor: SchemaDifferenceVisitor) {\n this._visitor = visitor;\n }\n\n /**\n * Traverses the schema differences and calls the appropriate method on the visitor.\n * @param differences The differences to traverse.\n */\n public async traverse(differences: Array<AnySchemaDifference>): Promise<void> {\n for (const [index, entry] of differences.entries()) {\n await this.visit(entry, index, differences);\n }\n }\n\n /**\n * Calls the appropriate method on the visitor based on the schema difference type.\n */\n private async visit(difference: AnySchemaDifference, index: number, array: AnySchemaDifference[]) {\n switch (difference.schemaType) {\n case SchemaOtherTypes.Schema:\n return this._visitor.visitSchemaDifference(difference, index, array);\n case SchemaOtherTypes.SchemaReference:\n return this._visitor.visitSchemaReferenceDifference(difference, index, array);\n case SchemaItemType.Constant:\n return this._visitor.visitConstantDifference(difference, index, array);\n case SchemaItemType.CustomAttributeClass:\n return this._visitor.visitCustomAttributeClassDifference(difference, index, array);\n case SchemaOtherTypes.CustomAttributeInstance:\n return this._visitor.visitCustomAttributeInstanceDifference(difference, index, array);\n case SchemaItemType.EntityClass:\n return this._visitor.visitEntityClassDifference(difference, index, array);\n case SchemaOtherTypes.EntityClassMixin:\n return this._visitor.visitEntityClassMixinDifference(difference, index, array);\n case SchemaItemType.Enumeration:\n return this._visitor.visitEnumerationDifference(difference, index, array);\n case SchemaOtherTypes.Enumerator:\n return this._visitor.visitEnumeratorDifference(difference, index, array);\n case SchemaItemType.Format:\n return this._visitor.visitFormatDifference(difference, index, array);\n case SchemaOtherTypes.FormatUnit:\n return this._visitor.visitFormatUnitDifference(difference, index, array);\n case SchemaOtherTypes.FormatUnitLabel:\n return this._visitor.visitFormatUnitLabelDifference(difference, index, array);\n case SchemaItemType.InvertedUnit:\n return this._visitor.visitInvertedUnitDifference(difference, index, array);\n case SchemaItemType.KindOfQuantity:\n return this._visitor.visitKindOfQuantityDifference(difference, index, array);\n case SchemaOtherTypes.KindOfQuantityPresentationFormat:\n return this._visitor.visitKindOfQuantityPresentationFormatDifference(difference, index, array);\n case SchemaItemType.Mixin:\n return this._visitor.visitMixinDifference(difference, index, array);\n case SchemaItemType.Phenomenon:\n return this._visitor.visitPhenomenonDifference(difference, index, array);\n case SchemaOtherTypes.Property:\n return this._visitor.visitPropertyDifference(difference, index, array);\n case SchemaItemType.PropertyCategory:\n return this._visitor.visitPropertyCategoryDifference(difference, index, array);\n case SchemaItemType.RelationshipClass:\n return this._visitor.visitRelationshipClassDifference(difference, index, array);\n case SchemaOtherTypes.RelationshipConstraint:\n return this._visitor.visitRelationshipConstraintDifference(difference, index, array);\n case SchemaOtherTypes.RelationshipConstraintClass:\n return this._visitor.visitRelationshipConstraintClassDifference(difference, index, array);\n case SchemaItemType.StructClass:\n return this._visitor.visitStructClassDifference(difference, index, array);\n case SchemaItemType.Unit:\n return this._visitor.visitUnitDifference(difference, index, array);\n case SchemaItemType.UnitSystem:\n return this._visitor.visitUnitSystemDifference(difference, index, array);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"SchemaDifferenceVisitor.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifferenceVisitor.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAA4B,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAWhF;;;;GAIG;AACH,MAAM,OAAO,sBAAsB;IAEhB,QAAQ,CAA0B;IAEnD,kEAAkE;IAClE,YAAY,OAAgC;QAC1C,IAAI,CAAC,QAAQ,GAAG,OAAO,C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C5B,OAAO,IAAI,CAAC,QAAQ,CAAC,yBAAyB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC3E,KAAK,gBAAgB,CAAC,QAAQ;gBAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACzE,KAAK,cAAc,CAAC,gBAAgB;gBAClC,OAAO,IAAI,CAAC,QAAQ,CAAC,+BAA+B,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACjF,KAAK,cAAc,CAAC,iBAAiB;gBACnC,OAAO,IAAI,CAAC,QAAQ,CAAC,gCAAgC,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAClF,KAAK,gBAAgB,CAAC,sBAAsB;gBAC1C,OAAO,IAAI,CAAC,QAAQ,CAAC,qCAAqC,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACvF,KAAK,gBAAgB,CAAC,2BAA2B;gBAC/C,OAAO,IAAI,CAAC,QAAQ,CAAC,0CAA0C,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC5F,KAAK,cAAc,CAAC,WAAW;gBAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,0BAA0B,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC5E,KAAK,cAAc,CAAC,IAAI;gBACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACrE,KAAK,cAAc,CAAC,UAAU;gBAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,yBAAyB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;CACF","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 +1 @@
1
- {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/Differencing/Utils.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAoBL,gBAAgB,GAIjB,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAA+B;IAClE,OAAO,UAAU,CAAC,UAAU,KAAK,cAAc,CAAC,QAAQ,CAAC;AAC3D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,UAA+B;IACvE,OAAO,UAAU,CAAC,UAAU,KAAK,gBAAgB,CAAC,QAAQ,CAAC;AAC7D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAAC,UAA+B;IAC9E,OAAO,UAAU,CAAC,UAAU,KAAK,cAAc,CAAC,oBAAoB,CAAC;AACvE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,UAA+B;IACzE,OAAO,UAAU,CAAC,UAAU,KAAK,gBAAgB,CAAC,uBAAuB,CAAC;AAC5E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,UAA+B;IACrE,OAAO,UAAU,CAAC,UAAU,KAAK,cAAc,CAAC,WAAW,CAAC;AAC9D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAAC,UAA+B;IAC1E,OAAO,UAAU,CAAC,UAAU,KAAK,gBAAgB,CAAC,gBAAgB,CAAC;AACrE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,UAA+B;IACrE,OAAO,UAAU,CAAC,UAAU,KAAK,cAAc,CAAC,WAAW,CAAC;AAC9D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC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H,MAAM,UAAU,kCAAkC,CAAC,UAA+B;IAChF,OAAO,UAAU,CAAC,UAAU,KAAK,gBAAgB,CAAC,sBAAsB,CAAC;AAC3E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uCAAuC,CAAC,UAA+B;IACrF,OAAO,UAAU,CAAC,UAAU,KAAK,gBAAgB,CAAC,2BAA2B,CAAC;AAChF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAA+B;IACpE,OAAO,UAAU,CAAC,UAAU,IAAI,cAAc,CAAC;AACjD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAA+B;IAC/D,OAAO,uBAAuB,CAAC,UAAU,CAAC;WACrC,gCAAgC,CAAC,UAAU,CAAC;WAC5C,uBAAuB,CAAC,UAAU,CAAC;WACnC,sBAAsB,CAAC,UAAU,CAAC;WAClC,6BAA6B,CAAC,UAAU,CAAC,CAAC;AACjD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Differencing\n */\n\nimport { SchemaItemType } from \"@itwin/ecschema-metadata\";\nimport {\n type AnyClassItemDifference,\n type AnySchemaDifference,\n type AnySchemaItemDifference,\n type ClassPropertyDifference,\n type ConstantDifference,\n type CustomAttributeClassDifference,\n type CustomAttributeDifference,\n type EntityClassDifference,\n type EntityClassMixinDifference,\n type EnumerationDifference,\n type EnumeratorDifference,\n type KindOfQuantityDifference,\n type MixinClassDifference,\n type PhenomenonDifference,\n type PropertyCategoryDifference,\n type RelationshipClassDifference,\n type RelationshipConstraintClassDifference,\n type RelationshipConstraintDifference,\n type SchemaDifference,\n SchemaOtherTypes,\n type SchemaReferenceDifference,\n type StructClassDifference,\n type UnitSystemDifference,\n} from \"./SchemaDifference\";\n\n/**\n * Indicates whether the given difference is type of ConstantDifference.\n * @alpha\n */\nexport function isConstantDifference(difference: AnySchemaDifference): difference is ConstantDifference {\n return difference.schemaType === SchemaItemType.Constant;\n}\n\n/**\n * Indicates whether the given difference is type of ClassPropertyDifference.\n * @alpha\n */\nexport function isClassPropertyDifference(difference: AnySchemaDifference): difference is ClassPropertyDifference {\n return difference.schemaType === SchemaOtherTypes.Property;\n}\n\n/**\n * Indicates whether the given difference is type of CustomAttributeClassDifference.\n * @alpha\n */\nexport function isCustomAttributeClassDifference(difference: AnySchemaDifference): difference is CustomAttributeClassDifference {\n return difference.schemaType === SchemaItemType.CustomAttributeClass;\n}\n\n/**\n * Indicates whether the given difference is type of CustomAttributeDifference.\n * @alpha\n */\nexport function isCustomAttributeDifference(difference: AnySchemaDifference): difference is CustomAttributeDifference {\n return difference.schemaType === SchemaOtherTypes.CustomAttributeInstance;\n}\n\n/**\n * Indicates whether the given difference is type of EntityClassDifference.\n * @alpha\n */\nexport function isEntityClassDifference(difference: AnySchemaDifference): difference is EntityClassDifference {\n return difference.schemaType === SchemaItemType.EntityClass;\n}\n\n/**\n * Indicates whether the given difference is type of EntityClassMixinDifference.\n * @alpha\n */\nexport function isEntityClassMixinDifference(difference: AnySchemaDifference): difference is EntityClassMixinDifference {\n return difference.schemaType === SchemaOtherTypes.EntityClassMixin;\n}\n\n/**\n * Indicates whether the given difference is type of EnumerationDifference.\n * @alpha\n */\nexport function isEnumerationDifference(difference: AnySchemaDifference): difference is EnumerationDifference {\n return difference.schemaType === SchemaItemType.Enumeration;\n}\n\n/**\n * Indicates whether the given difference is type of EnumeratorDifference.\n * @alpha\n */\nexport function isEnumeratorDifference(difference: AnySchemaDifference): difference is EnumeratorDifference {\n return difference.schemaType === SchemaOtherTypes.Enumerator;\n}\n\n/**\n * Indicates whether the given difference is type of KindOfQuantityDifference.\n * @alpha\n */\nexport function isKindOfQuantityDifference(difference: AnySchemaDifference): difference is KindOfQuantityDifference {\n return difference.schemaType === SchemaItemType.KindOfQuantity;\n}\n\n/**\n * Indicates whether the given difference is type of MixinClassDifference.\n * @alpha\n */\nexport function isMixinClassDifference(difference: AnySchemaDifference): difference is MixinClassDifference {\n return difference.schemaType === SchemaItemType.Mixin;\n}\n\n/**\n * Indicates whether the given difference is type of PhenomenonDifference.\n * @alpha\n */\nexport function isPhenomenonDifference(difference: AnySchemaDifference): difference is PhenomenonDifference {\n return difference.schemaType === SchemaItemType.Phenomenon;\n}\n\n/**\n * Indicates whether the given difference is type of PropertyCategoryDifference.\n * @alpha\n */\nexport function isPropertyCategoryDifference(difference: AnySchemaDifference): difference is PropertyCategoryDifference {\n return difference.schemaType === SchemaItemType.PropertyCategory;\n}\n\n/**\n * Indicates whether the given difference is type of SchemaDifference.\n * @alpha\n */\nexport function isSchemaDifference(difference: AnySchemaDifference): difference is SchemaDifference {\n return difference.schemaType === SchemaOtherTypes.Schema;\n}\n\n/**\n * Indicates whether the given difference is type of SchemaReferenceDifference.\n * @alpha\n */\nexport function isSchemaReferenceDifference(difference: AnySchemaDifference): difference is SchemaReferenceDifference {\n return difference.schemaType === SchemaOtherTypes.SchemaReference;\n}\n\n/**\n * Indicates whether the given difference is type of CustomAttributeDifference.\n * @alpha\n */\nexport function isStructClassDifference(difference: AnySchemaDifference): difference is StructClassDifference {\n return difference.schemaType === SchemaItemType.StructClass;\n}\n\n/**\n * Indicates whether the given difference is type of UnitSystemDifference.\n * @alpha\n */\nexport function isUnitSystemDifference(difference: AnySchemaDifference): difference is UnitSystemDifference {\n return difference.schemaType === SchemaItemType.UnitSystem;\n}\n\n/**\n * Indicates whether the given difference is type of RelationshipClassDifference.\n * @alpha\n */\nexport function isRelationshipClassDifference(difference: AnySchemaDifference): difference is RelationshipClassDifference {\n return difference.schemaType === SchemaItemType.RelationshipClass;\n}\n\n/**\n * Indicates whether the given difference is type of RelationshipConstraintDifference.\n * @alpha\n */\nexport function isRelationshipConstraintDifference(difference: AnySchemaDifference): difference is RelationshipConstraintDifference {\n return difference.schemaType === SchemaOtherTypes.RelationshipConstraint;\n}\n\n/**\n * Indicates whether the given difference is type of RelationshipConstraintClassDifference.\n * @alpha\n */\nexport function isRelationshipConstraintClassDifference(difference: AnySchemaDifference): difference is RelationshipConstraintClassDifference {\n return difference.schemaType === SchemaOtherTypes.RelationshipConstraintClass;\n}\n\n/**\n * Indicates whether the given difference is type of AnySchemaItemDifference.\n * @alpha\n */\nexport function isSchemaItemDifference(difference: AnySchemaDifference): difference is AnySchemaItemDifference {\n return difference.schemaType in SchemaItemType;\n}\n\n/**\n * Indicates whether the given difference is type of ClassItemDifference.\n * @alpha\n */\nexport function isClassDifference(difference: AnySchemaDifference): difference is AnyClassItemDifference {\n return isStructClassDifference(difference)\n || isCustomAttributeClassDifference(difference)\n || isEntityClassDifference(difference)\n || isMixinClassDifference(difference)\n || isRelationshipClassDifference(difference);\n}\n"]}
1
+ {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/Differencing/Utils.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAoBL,gBAAgB,GAIjB,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAA+B;IAClE,OAAO,UAAU,CAAC,UAAU,KAAK,cAAc,CAAC,QAAQ,CAAC;AAC3D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,UAA+B;IACvE,OAAO,UAAU,CAAC,UAAU,KAAK,gBAAgB,CAAC,QAAQ,CAAC;AAC7D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAAC,UAA+B;IAC9E,OAAO,UAAU,CAAC,UAAU,KAAK,cAAc,CAAC,oBAAoB,CAAC;AACvE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,UAA+B;IACzE,OAAO,UAAU,CAAC,UAAU,KAAK,gBAAgB,CAAC,uBAAuB,CAAC;AAC5E,CAAC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,CAAC,eAAe,CAAC;AACpE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,UAA+B;IACrE,OAAO,UAAU,CAAC,UAAU,KAAK,cAAc,CAAC,WAAW,CAAC;AAC9D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAA+B;IACpE,OAAO,UAAU,CAAC,UAAU,KAAK,cAAc,CAAC,UAAU,CAAC;AAC7D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAAC,UAA+B;IAC3E,OAAO,UAAU,CAAC,UAAU,KAAK,cAAc,CAAC,iBAAiB,CAAC;AACpE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kCAAkC,CAAC,UAA+B;IAChF,OAAO,UAAU,CAAC,UAAU,KAAK,gBAAgB,CAAC,sBAAsB,CAAC;AAC3E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uCAAuC,CAAC,UAA+B;IACrF,OAAO,UAAU,CAAC,UAAU,KAAK,gBAAgB,CAAC,2BAA2B,CAAC;AAChF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAA+B;IACpE,OAAO,UAAU,CAAC,UAAU,IAAI,cAAc,CAAC;AACjD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAA+B;IAC/D,OAAO,uBAAuB,CAAC,UAAU,CAAC;WACrC,gCAAgC,CAAC,UAAU,CAAC;WAC5C,uBAAuB,CAAC,UAAU,CAAC;WACnC,sBAAsB,CAAC,UAAU,CAAC;WAClC,6BAA6B,CAAC,UAAU,CAAC,CAAC;AACjD,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 Differencing\r\n */\r\n\r\nimport { SchemaItemType } from \"@itwin/ecschema-metadata\";\r\nimport {\r\n type AnyClassItemDifference,\r\n type AnySchemaDifference,\r\n type AnySchemaItemDifference,\r\n type ClassPropertyDifference,\r\n type ConstantDifference,\r\n type CustomAttributeClassDifference,\r\n type CustomAttributeDifference,\r\n type EntityClassDifference,\r\n type EntityClassMixinDifference,\r\n type EnumerationDifference,\r\n type EnumeratorDifference,\r\n type KindOfQuantityDifference,\r\n type MixinClassDifference,\r\n type PhenomenonDifference,\r\n type PropertyCategoryDifference,\r\n type RelationshipClassDifference,\r\n type RelationshipConstraintClassDifference,\r\n type RelationshipConstraintDifference,\r\n type SchemaDifference,\r\n SchemaOtherTypes,\r\n type SchemaReferenceDifference,\r\n type StructClassDifference,\r\n type UnitSystemDifference,\r\n} from \"./SchemaDifference\";\r\n\r\n/**\r\n * Indicates whether the given difference is type of ConstantDifference.\r\n * @alpha\r\n */\r\nexport function isConstantDifference(difference: AnySchemaDifference): difference is ConstantDifference {\r\n return difference.schemaType === SchemaItemType.Constant;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of ClassPropertyDifference.\r\n * @alpha\r\n */\r\nexport function isClassPropertyDifference(difference: AnySchemaDifference): difference is ClassPropertyDifference {\r\n return difference.schemaType === SchemaOtherTypes.Property;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of CustomAttributeClassDifference.\r\n * @alpha\r\n */\r\nexport function isCustomAttributeClassDifference(difference: AnySchemaDifference): difference is CustomAttributeClassDifference {\r\n return difference.schemaType === SchemaItemType.CustomAttributeClass;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of CustomAttributeDifference.\r\n * @alpha\r\n */\r\nexport function isCustomAttributeDifference(difference: AnySchemaDifference): difference is CustomAttributeDifference {\r\n return difference.schemaType === SchemaOtherTypes.CustomAttributeInstance;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of EntityClassDifference.\r\n * @alpha\r\n */\r\nexport function isEntityClassDifference(difference: AnySchemaDifference): difference is EntityClassDifference {\r\n return difference.schemaType === SchemaItemType.EntityClass;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of EntityClassMixinDifference.\r\n * @alpha\r\n */\r\nexport function isEntityClassMixinDifference(difference: AnySchemaDifference): difference is EntityClassMixinDifference {\r\n return difference.schemaType === SchemaOtherTypes.EntityClassMixin;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of EnumerationDifference.\r\n * @alpha\r\n */\r\nexport function isEnumerationDifference(difference: AnySchemaDifference): difference is EnumerationDifference {\r\n return difference.schemaType === SchemaItemType.Enumeration;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of EnumeratorDifference.\r\n * @alpha\r\n */\r\nexport function isEnumeratorDifference(difference: AnySchemaDifference): difference is EnumeratorDifference {\r\n return difference.schemaType === SchemaOtherTypes.Enumerator;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of KindOfQuantityDifference.\r\n * @alpha\r\n */\r\nexport function isKindOfQuantityDifference(difference: AnySchemaDifference): difference is KindOfQuantityDifference {\r\n return difference.schemaType === SchemaItemType.KindOfQuantity;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of MixinClassDifference.\r\n * @alpha\r\n */\r\nexport function isMixinClassDifference(difference: AnySchemaDifference): difference is MixinClassDifference {\r\n return difference.schemaType === SchemaItemType.Mixin;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of PhenomenonDifference.\r\n * @alpha\r\n */\r\nexport function isPhenomenonDifference(difference: AnySchemaDifference): difference is PhenomenonDifference {\r\n return difference.schemaType === SchemaItemType.Phenomenon;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of PropertyCategoryDifference.\r\n * @alpha\r\n */\r\nexport function isPropertyCategoryDifference(difference: AnySchemaDifference): difference is PropertyCategoryDifference {\r\n return difference.schemaType === SchemaItemType.PropertyCategory;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of SchemaDifference.\r\n * @alpha\r\n */\r\nexport function isSchemaDifference(difference: AnySchemaDifference): difference is SchemaDifference {\r\n return difference.schemaType === SchemaOtherTypes.Schema;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of SchemaReferenceDifference.\r\n * @alpha\r\n */\r\nexport function isSchemaReferenceDifference(difference: AnySchemaDifference): difference is SchemaReferenceDifference {\r\n return difference.schemaType === SchemaOtherTypes.SchemaReference;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of CustomAttributeDifference.\r\n * @alpha\r\n */\r\nexport function isStructClassDifference(difference: AnySchemaDifference): difference is StructClassDifference {\r\n return difference.schemaType === SchemaItemType.StructClass;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of UnitSystemDifference.\r\n * @alpha\r\n */\r\nexport function isUnitSystemDifference(difference: AnySchemaDifference): difference is UnitSystemDifference {\r\n return difference.schemaType === SchemaItemType.UnitSystem;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of RelationshipClassDifference.\r\n * @alpha\r\n */\r\nexport function isRelationshipClassDifference(difference: AnySchemaDifference): difference is RelationshipClassDifference {\r\n return difference.schemaType === SchemaItemType.RelationshipClass;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of RelationshipConstraintDifference.\r\n * @alpha\r\n */\r\nexport function isRelationshipConstraintDifference(difference: AnySchemaDifference): difference is RelationshipConstraintDifference {\r\n return difference.schemaType === SchemaOtherTypes.RelationshipConstraint;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of RelationshipConstraintClassDifference.\r\n * @alpha\r\n */\r\nexport function isRelationshipConstraintClassDifference(difference: AnySchemaDifference): difference is RelationshipConstraintClassDifference {\r\n return difference.schemaType === SchemaOtherTypes.RelationshipConstraintClass;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of AnySchemaItemDifference.\r\n * @alpha\r\n */\r\nexport function isSchemaItemDifference(difference: AnySchemaDifference): difference is AnySchemaItemDifference {\r\n return difference.schemaType in SchemaItemType;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of ClassItemDifference.\r\n * @alpha\r\n */\r\nexport function isClassDifference(difference: AnySchemaDifference): difference is AnyClassItemDifference {\r\n return isStructClassDifference(difference)\r\n || isCustomAttributeClassDifference(difference)\r\n || isEntityClassDifference(difference)\r\n || isMixinClassDifference(difference)\r\n || isRelationshipClassDifference(difference);\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../src/Editing/Constants.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAiB,uBAAuB,EAAE,UAAU,EAAiB,cAAc,EAAa,MAAM,0BAA0B,CAAC;AAGlJ,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,MAAM,OAAO,SAAU,SAAQ,WAAW;IACxC,IAAuB,aAAa;QAClC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,YAAmB,YAAiC;QAClD,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAC/C,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,UAAyB,EAAE,UAAkB,EAAE,YAAqB,EAAE,SAAkB,EAAE,WAAoB;QACpK,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAW,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAoB,CAAC;YAEnK,MAAM,aAAa,GAAG,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;YACzE,WAAW,CAAC,aAAa,CAAC,IAAI,uBAAuB,CAA4B,aAAa,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;YAEhI,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAEtC,IAAI,SAAS;gBACX,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;YAEtC,IAAI,WAAW;gBACb,WAAW,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;YAE1C,IAAI,YAAY;gBACd,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YAE5C,OAAO,WAAW,CAAC,GAAG,CAAC;QACzB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,sBAAsB,EAAE,IAAI,YAAY,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,kBAAkB,CAAC,eAAe,CAAC,yBAAyB,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACpJ,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { Constant, ConstantProps, DelayedPromiseWithProps, Phenomenon, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport { MutableConstant } from \"./Mutable/MutableConstant\";\nimport { ECEditingStatus, SchemaEditingError, SchemaItemId } from \"./Exception\";\nimport { SchemaItems } from \"./SchemaItems\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type Constant.\n */\nexport class Constants extends SchemaItems {\n protected override get itemTypeClass(): typeof Constant {\n return Constant;\n }\n\n public constructor(schemaEditor: SchemaContextEditor) {\n super(SchemaItemType.Constant, schemaEditor);\n }\n\n public async create(schemaKey: SchemaKey, name: string, phenomenon: SchemaItemKey, definition: string, displayLabel?: string, numerator?: number, denominator?: number): Promise<SchemaItemKey> {\n try {\n const newConstant = await this.createSchemaItem<Constant>(schemaKey, this.schemaItemType, (schema) => schema.createConstant.bind(schema), name) as MutableConstant;\n\n const newPhenomenon = (await this.getSchemaItem(phenomenon, Phenomenon));\n newConstant.setPhenomenon(new DelayedPromiseWithProps<SchemaItemKey, Phenomenon>(newPhenomenon.key, async () => newPhenomenon));\n\n newConstant.setDefinition(definition);\n\n if (numerator)\n newConstant.setNumerator(numerator);\n\n if (denominator)\n newConstant.setDenominator(denominator);\n\n if (displayLabel)\n newConstant.setDisplayLabel(displayLabel);\n\n return newConstant.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);\n }\n }\n\n /**\n * Creates a Constant through a ConstantProps.\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\n * @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.\n */\n public async createFromProps(schemaKey: SchemaKey, constantProps: ConstantProps): Promise<SchemaItemKey> {\n try {\n const newConstant = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createConstant.bind(schema), constantProps);\n return newConstant.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, constantProps.name!, schemaKey), e);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../src/Editing/Constants.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAiB,uBAAuB,EAAE,UAAU,EAAiB,cAAc,EAAa,MAAM,0BAA0B,CAAC;AAGlJ,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,MAAM,OAAO,SAAU,SAAQ,WAAW;IACxC,IAAuB,aAAa;QAClC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,YAAmB,YAAiC;QAClD,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAC/C,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,UAAyB,EAAE,UAAkB,EAAE,YAAqB,EAAE,SAAkB,EAAE,WAAoB;QACpK,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAW,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAoB,CAAC;YAEnK,MAAM,aAAa,GAAG,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;YACzE,WAAW,CAAC,aAAa,CAAC,IAAI,uBAAuB,CAA4B,aAAa,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;YAEhI,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAEtC,IAAI,SAAS;gBACX,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;YAEtC,IAAI,WAAW;gBACb,WAAW,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;YAE1C,IAAI,YAAY;gBACd,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YAE5C,OAAO,WAAW,CAAC,GAAG,CAAC;QACzB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,sBAAsB,EAAE,IAAI,YAAY,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,kBAAkB,CAAC,eAAe,CAAC,yBAAyB,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACpJ,CAAC;IACH,CAAC;CACF","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 +1 @@
1
- {"version":3,"file":"CustomAttributes.js","sourceRoot":"","sources":["../../../src/Editing/CustomAttributes.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EACL,oBAAoB,EAEL,cAAc,GAC9B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE3E;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAC7C,YAAmB,YAAiC;QAClD,KAAK,CAAC,cAAc,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC;IAC3D,CAAC;IAED,IAAuB,aAAa;QAClC,OAAO,oBAAoB,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,kBAAkB,CAAC,eAAe,CAAC,sBAAsB,EAAE,IAAI,OAAO,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,kBAAkB,CAAC,eAAe,CAAC,yBAAyB,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACzI,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport {\n CustomAttributeClass,\n CustomAttributeClassProps, CustomAttributeContainerType,\n SchemaItemKey, SchemaItemType, SchemaKey,\n} from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport { ECClasses } from \"./ECClasses\";\nimport { MutableCAClass } from \"./Mutable/MutableCAClass\";\nimport { ClassId, ECEditingStatus, SchemaEditingError } from \"./Exception\";\n\n/**\n * @alpha\n * A class extending ECClasses allowing you to create schema items of type CustomAttributeClass.\n */\nexport class CustomAttributes extends ECClasses {\n public constructor(schemaEditor: SchemaContextEditor) {\n super(SchemaItemType.CustomAttributeClass, schemaEditor);\n }\n\n protected override get itemTypeClass(): typeof CustomAttributeClass {\n return CustomAttributeClass;\n }\n\n public async create(schemaKey: SchemaKey, name: string, appliesTo: CustomAttributeContainerType, displayLabel?: string, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey> {\n try {\n const newClass = await this.createClass<CustomAttributeClass>(schemaKey, this.schemaItemType, (schema) => schema.createCustomAttributeClass.bind(schema), name, baseClassKey) as MutableCAClass;\n\n if (displayLabel)\n newClass.setDisplayLabel(displayLabel);\n\n newClass.setAppliesTo(appliesTo);\n return newClass.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new ClassId(this.schemaItemType, name, schemaKey), e);\n }\n }\n\n /**\n * Creates a CustomAttributeClass through a CustomAttributeClassProps.\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\n * @param caProps a json object that will be used to populate the new CustomAttributeClass. Needs a name value passed in.\n */\n public async createFromProps(schemaKey: SchemaKey, caProps: CustomAttributeClassProps): Promise<SchemaItemKey> {\n try {\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createCustomAttributeClass.bind(schema), caProps);\n return newClass.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, caProps.name!, schemaKey), e);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"CustomAttributes.js","sourceRoot":"","sources":["../../../src/Editing/CustomAttributes.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EACL,oBAAoB,EAEL,cAAc,GAC9B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE3E;;;GAGG;AACH,MAAM,OAAO,gBAAiB,S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I,kBAAkB,CAAC,eAAe,CAAC,yBAAyB,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACzI,CAAC;IACH,CAAC;CACF","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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ECClasses.js","sourceRoot":"","sources":["../../../src/Editing/ECClasses.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAGL,uBAAuB,EACvB,OAAO,EACiB,aAAa,EAA6B,cAAc,GAEjF,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,KAAK,KAAK,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACzH,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAElI,OAAO,EAAoB,WAAW,EAAE,MAAM,eAAe,CAAC;AAI9D;;;GAGG;AACH,MAAM,OAAO,SAAU,SAAQ,WAAW;IAExC,YAAsB,cAAkC,EAAE,YAAiC;QACzF,KAAK,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QACpC,IAAI,CAAC,cAAc,GAAG,cAAc,CAA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;AAED,SAAS,cAAc,CAAC,UAAsB;IAC5C,OAAO,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport {\n CustomAttribute,\n CustomAttributeContainerProps,\n DelayedPromiseWithProps,\n ECClass, Enumeration, EnumerationPropertyProps, PrimitiveArrayPropertyProps,\n PrimitivePropertyProps, PrimitiveType, SchemaItem, SchemaItemKey, SchemaItemType, SchemaKey, StructArrayPropertyProps,\n StructClass, StructPropertyProps,\n} from \"@itwin/ecschema-metadata\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport { MutableClass } from \"./Mutable/MutableClass\";\nimport * as Rules from \"../Validation/ECRules\";\nimport { ArrayProperties, EnumerationProperties, PrimitiveProperties, Properties, StructProperties } from \"./Properties\";\nimport { ClassId, CustomAttributeId, ECEditingStatus, PropertyId, SchemaEditingError, SchemaId, SchemaItemId } from \"./Exception\";\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\nimport { CreateSchemaItem, SchemaItems } from \"./SchemaItems\";\n\nexport type ECClassSchemaItems = SchemaItemType.EntityClass | SchemaItemType.StructClass | SchemaItemType.RelationshipClass | SchemaItemType.Mixin | SchemaItemType.CustomAttributeClass;\n\n/**\n * @alpha\n * Acts as a base class for schema class creation. Enables property creation.\n */\nexport class ECClasses extends SchemaItems{\n\n protected constructor(schemaItemType: ECClassSchemaItems, schemaEditor: SchemaContextEditor) {\n super(schemaItemType, schemaEditor);\n this.schemaItemType = schemaItemType;\n this.properties = new Properties(this.schemaItemType, this.schemaEditor);\n this.arrayProperties = new ArrayProperties(this.schemaItemType, this.schemaEditor);\n this.primitiveProperties = new PrimitiveProperties(this.schemaItemType, this.schemaEditor);\n this.enumerationProperties = new EnumerationProperties(this.schemaItemType, this.schemaEditor);\n this.structProperties = new StructProperties(this.schemaItemType, this.schemaEditor);\n }\n\n protected override schemaItemType: ECClassSchemaItems;\n\n /**\n * Allows access for the editors itemType class instance.\n * It returns ECClass here, but editors for subclasses will override this to return the\n * appropriate subclass.\n */\n protected override get itemTypeClass(): typeof ECClass {\n return ECClass;\n }\n\n /**\n * Allows access for editing of base Property attributes.\n */\n public readonly properties: Properties;\n /**\n * Allows access for editing of ArrayProperty attributes.\n */\n public readonly arrayProperties: ArrayProperties;\n /**\n * Allows access for editing of PrimitiveProperty attributes.\n */\n public readonly primitiveProperties: PrimitiveProperties;\n /**\n * Allows access for editing of EnumerationProperty attributes.\n */\n public readonly enumerationProperties: EnumerationProperties;\n /**\n * Allows access for editing of StructProperty attributes.\n */\n public readonly structProperties: StructProperties;\n\n public async createClass<T extends ECClass>(schemaKey: SchemaKey, type: SchemaItemType, create: CreateSchemaItem<T>, name: string, baseClassKey?: SchemaItemKey, ...args: any[]): Promise<T> {\n const newClass = await this.createSchemaItem(schemaKey, type, create, name, ...args);\n\n if (baseClassKey !== undefined) {\n if(!await this.schemaEditor.schemaContext.getSchema(baseClassKey.schemaKey)) {\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(baseClassKey.schemaKey));\n }\n\n const baseClassItem = await this.getSchemaItem(baseClassKey, this.itemTypeClass);\n await (newClass as ECClass as MutableClass).setBaseClass(new DelayedPromiseWithProps<SchemaItemKey, T>(baseClassKey, async () => baseClassItem as T));\n }\n\n return newClass;\n }\n\n /**\n * Creates a property on class identified by the given SchemaItemKey. This method restricts the\n * property type to primitives of type Double, String, DateTime and Integer.\n * @param classKey The SchemaItemKey of the class.\n * @param name The name of the new property.\n * @param type The PrimitiveType assigned to the new property.\n */\n public async createProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType, prefix: string): Promise<void> {\n if (type !== PrimitiveType.Double && type !== PrimitiveType.String && type !== PrimitiveType.DateTime\n && type !== PrimitiveType.Integer)\n throw new Error (\"Property creation is restricted to type Double, String, DateTime, and Integer.\");\n\n if (\"\" === prefix)\n throw new Error(\"The specified property name prefix is invalid\");\n\n const prefixedName = `${prefix}_${name}`;\n\n const mutableClass = await this.getClass(classKey);\n\n await mutableClass.createPrimitiveProperty(prefixedName, type);\n }\n\n /**\n * Create a primitive property on class identified by the given SchemaItemKey.\n * @param classKey The SchemaItemKey of the class.\n * @param name The name of the new property.\n * @param type The PrimitiveType assigned to the new property.\n */\n public async createPrimitiveProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType): Promise<void> {\n try {\n const mutableClass = await this.getClass(classKey);\n await mutableClass.createPrimitiveProperty(name, type);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreatePrimitiveProperty, new PropertyId(this.schemaItemType, classKey, name), e);\n }\n }\n\n public async createPrimitivePropertyFromProps(classKey: SchemaItemKey, name: string, type: PrimitiveType, primitiveProps: PrimitivePropertyProps): Promise<void> {\n try {\n const mutableClass = await this.getClass(classKey);\n const newProperty = await mutableClass.createPrimitiveProperty(name, type);\n await newProperty.fromJSON(primitiveProps);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreatePrimitivePropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\n }\n }\n\n public async createEnumerationProperty(classKey: SchemaItemKey, name: string, type: Enumeration): Promise<void> {\n try {\n const mutableClass = await this.getClass(classKey);\n const enumSchemaItemKey = mutableClass.schema.getSchemaItemKey(type.fullName);\n if (enumSchemaItemKey === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new SchemaItemId(SchemaItemType.Enumeration, type.name, mutableClass.schema.schemaKey));\n\n await mutableClass.createPrimitiveProperty(name, type);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateEnumerationProperty, new PropertyId(this.schemaItemType, classKey, name), e);\n }\n }\n\n public async createEnumerationPropertyFromProps(classKey: SchemaItemKey, name: string, type: Enumeration, enumProps: EnumerationPropertyProps): Promise<void> {\n try {\n const mutableClass = await this.getClass(classKey);\n const newProperty = await mutableClass.createPrimitiveProperty(name, type);\n await newProperty.fromJSON(enumProps);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateEnumerationArrayPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\n }\n }\n\n public async createPrimitiveArrayProperty(classKey: SchemaItemKey, name: string, type: PrimitiveType): Promise<void> {\n try {\n const mutableClass = await this.getClass(classKey);\n await mutableClass.createPrimitiveArrayProperty(name, type);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreatePrimitiveArrayProperty, new PropertyId(this.schemaItemType, classKey, name), e);\n }\n }\n\n public async createPrimitiveArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: PrimitiveType, primitiveProps: PrimitiveArrayPropertyProps): Promise<void> {\n try {\n const mutableClass = await this.getClass(classKey);\n const newProperty = await mutableClass.createPrimitiveArrayProperty(name, type);\n await newProperty.fromJSON(primitiveProps);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreatePrimitiveArrayPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\n }\n }\n\n public async createEnumerationArrayProperty(classKey: SchemaItemKey, name: string, type: Enumeration): Promise<void> {\n try {\n const mutableClass = await this.getClass(classKey);\n await mutableClass.createPrimitiveArrayProperty(name, type);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateEnumerationArrayProperty, new PropertyId(this.schemaItemType, classKey, name), e);\n }\n }\n\n public async createEnumerationArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: Enumeration, props: PrimitiveArrayPropertyProps): Promise<void> {\n try {\n const mutableClass = await this.getClass(classKey);\n const newProperty = await mutableClass.createPrimitiveArrayProperty(name, type);\n await newProperty.fromJSON(props);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateEnumerationArrayPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\n }\n }\n\n public async createStructProperty(classKey: SchemaItemKey, name: string, type: StructClass): Promise<void> {\n try {\n const mutableClass = await this.getClass(classKey);\n await mutableClass.createStructProperty(name, type);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateStructProperty, new PropertyId(this.schemaItemType, classKey, name), e);\n }\n }\n\n public async createStructPropertyFromProps(classKey: SchemaItemKey, name: string, type: StructClass, structProps: StructPropertyProps): Promise<void> {\n try {\n const mutableClass = await this.getClass(classKey);\n const newProperty = await mutableClass.createStructProperty(name, type);\n await newProperty.fromJSON(structProps);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateStructPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\n }\n }\n\n public async createStructArrayProperty(classKey: SchemaItemKey, name: string, type: StructClass): Promise<void> {\n try {\n const mutableClass = await this.getClass(classKey);\n await mutableClass.createStructArrayProperty(name, type);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateStructArrayProperty, new PropertyId(this.schemaItemType, classKey, name), e);\n }\n }\n\n public async createStructArrayPropertyFromProps(classKey: SchemaItemKey, name: string, type: StructClass, structProps: StructArrayPropertyProps): Promise<void> {\n try {\n const mutableClass = await this.getClass(classKey);\n const newProperty = await mutableClass.createStructArrayProperty(name, type);\n await newProperty.fromJSON(structProps);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateStructArrayPropertyFromProps, new PropertyId(this.schemaItemType, classKey, name), e);\n }\n }\n\n public async deleteProperty(classKey: SchemaItemKey, name: string): Promise<void> {\n try {\n const mutableClass = await this.getClass(classKey);\n await mutableClass.deleteProperty(name);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.DeleteProperty, new PropertyId(this.schemaItemType, classKey, name), e);\n }\n }\n\n public async delete(classKey: SchemaItemKey): Promise<void> {\n try {\n const schema = await this.getSchema(classKey.schemaKey);\n const ecClass = await schema.getItem(classKey.name, this.itemTypeClass);\n if (ecClass === undefined)\n return;\n\n await schema.deleteClass(ecClass.name);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.DeleteClass, new ClassId(this.schemaItemType, classKey), e);\n }\n }\n\n /**\n * Adds a CustomAttribute instance to the Class identified by the given SchemaItemKey\n * @param classKey The SchemaItemKey identifying the schema.\n * @param customAttribute The CustomAttribute instance to add.\n */\n public async addCustomAttribute(classKey: SchemaItemKey, customAttribute: CustomAttribute): Promise<void> {\n try {\n const mutableClass = await this.getClass(classKey);\n mutableClass.addCustomAttribute(customAttribute);\n\n const diagnosticIterable = Rules.validateCustomAttributeInstance(mutableClass, customAttribute);\n\n const diagnostics: AnyDiagnostic[] = [];\n for await (const diagnostic of diagnosticIterable) {\n diagnostics.push(diagnostic);\n }\n\n if (diagnostics.length > 0) {\n this.removeCustomAttribute(mutableClass, customAttribute);\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, mutableClass), undefined, diagnostics);\n }\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToClass, new ClassId(this.schemaItemType, classKey), e);\n }\n }\n\n /**\n * Sets the base class of a SchemaItem.\n * @param itemKey The SchemaItemKey of the Item.\n * @param baseClassKey The SchemaItemKey of the base class. Specifying 'undefined' removes the base class.\n */\n public async setBaseClass(itemKey: SchemaItemKey, baseClassKey?: SchemaItemKey): Promise<void> {\n try {\n const classItem = await this.getSchemaItem(itemKey, this.itemTypeClass);\n if (!baseClassKey) {\n await (classItem as MutableClass).setBaseClass(undefined);\n return;\n }\n\n if(!await this.schemaEditor.schemaContext.getSchema(baseClassKey.schemaKey)) {\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(baseClassKey.schemaKey));\n }\n\n const baseClassItem = await this.getSchemaItem(baseClassKey, this.itemTypeClass);\n if (classItem.baseClass !== undefined && !await baseClassItem.is(await classItem.baseClass))\n throw new SchemaEditingError(ECEditingStatus.InvalidBaseClass, new ClassId(this.schemaItemType, baseClassKey), undefined, undefined, `Base class ${baseClassKey.fullName} must derive from ${(await classItem.baseClass).fullName}.`);\n\n await (classItem as MutableClass).setBaseClass(new DelayedPromiseWithProps<SchemaItemKey, ECClass>(baseClassKey, async () => baseClassItem));\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.SetBaseClass, new ClassId(this.schemaItemType, itemKey), e);\n }\n }\n\n private async getClass(classKey: SchemaItemKey): Promise<MutableClass> {\n const schema = await this.getSchema(classKey.schemaKey);\n\n const ecClass = await schema.getItem(classKey.name);\n if (ecClass === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new ClassId(this.schemaItemType, classKey));\n\n if(!isMutableClass(ecClass))\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new ClassId(this.schemaItemType, classKey));\n\n return ecClass;\n }\n\n protected removeCustomAttribute(container: CustomAttributeContainerProps, customAttribute: CustomAttribute) {\n assert(container.customAttributes !== undefined);\n const map = container.customAttributes as Map<string, CustomAttribute>;\n map.delete(customAttribute.className);\n }\n}\n\nfunction isMutableClass(schemaItem: SchemaItem): schemaItem is MutableClass {\n return ECClass.isECClass(schemaItem);\n}\n"]}
1
+ {"version":3,"file":"ECClasses.js","sourceRoot":"","sources":["../../../src/Editing/ECClasses.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAGL,uBAAuB,EACvB,OAAO,EACiB,aAAa,EAA6B,cAAc,GAEjF,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,KAAK,KAAK,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACzH,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA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AqB,CAAC,SAAwC,EAAE,eAAgC;QACxG,MAAM,CAAC,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;CACF;AAED,SAAS,cAAc,CAAC,UAAsB;IAC5C,OAAO,OAAO,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\r\nfunction isMutableClass(schemaItem: SchemaItem): schemaItem is MutableClass {\r\n return ECClass.isECClass(schemaItem);\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.js","sourceRoot":"","sources":["../../../src/Editing/Editor.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAmB,aAAa,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,EAA4C,cAAc,EAAa,eAAe,EAA2B,MAAM,0BAA0B,CAAC;AAE5O,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACl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AAe,CAAC,wBAAwB,EAAE,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,aAAa,CAAC,IAAI,4BAA4B,KAAK,IAAI,CAAC,CAAC;YAC7L,CAAC;YACD,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,IAAI,CAAC,YAAY,aAAa,IAAI,CAAC,CAAC,WAAW,KAAK,cAAc,CAAC,aAAa,EAAE,CAAC;gBACjF,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,cAAc,EAAE,IAAI,QAAQ,CAAC,SAAS,CAAC,EAClF,IAAI,kBAAkB,CAAC,eAAe,CAAC,kBAAkB,EAAE,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YACzF,CAAC;YAED,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,cAAc,EAAG,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;CACF;AAED,SAAS,gBAAgB,CAAC,IAA6B;IACrD,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,IAAsB,CAAC,CAAC;AACxE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport * as Rules from \"../Validation/ECRules\";\nimport { CustomAttribute, ECSchemaError, ECSchemaStatus, isSupportedSchemaItemType, Schema, SchemaContext, SchemaItem, SchemaItemKey, SchemaItemType, SchemaKey, SchemaMatchType, SupportedSchemaItemType } from \"@itwin/ecschema-metadata\";\nimport { MutableSchema } from \"./Mutable/MutableSchema\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { Constants } from \"./Constants\";\nimport { CustomAttributes } from \"./CustomAttributes\";\nimport { Entities } from \"./Entities\";\nimport { Enumerations } from \"./Enumerations\";\nimport { Formats } from \"./Formats\";\nimport { InvertedUnits } from \"./InvertedUnits\";\nimport { KindOfQuantities } from \"./KindOfQuantities\";\nimport { Mixins } from \"./Mixins\";\nimport { Phenomena } from \"./Phenomena\";\nimport { PropertyCategories } from \"./PropertyCategories\";\nimport { RelationshipClasses } from \"./RelationshipClasses\";\nimport { Structs } from \"./Structs\";\nimport { Units } from \"./Units\";\nimport { UnitSystems } from \"./UnitSystems\";\nimport { CustomAttributeId, ECEditingStatus, SchemaEditingError, SchemaId, SchemaItemId } from \"./Exception\";\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\n\n/**\n * A class that allows you to edit and create schemas, classes, and items from the SchemaContext level.\n * @alpha\n */\nexport class SchemaContextEditor {\n private _schemaContext: SchemaContext;\n public readonly entities = new Entities(this);\n public readonly mixins = new Mixins(this);\n public readonly structs = new Structs(this);\n public readonly customAttributes = new CustomAttributes(this);\n public readonly relationships = new RelationshipClasses(this);\n public readonly constants = new Constants(this);\n public readonly enumerations = new Enumerations(this);\n public readonly formats = new Formats(this);\n public readonly kindOfQuantities = new KindOfQuantities(this);\n public readonly units = new Units(this);\n public readonly phenomenons = new Phenomena(this);\n public readonly unitSystems = new UnitSystems(this);\n public readonly propertyCategories = new PropertyCategories(this);\n public readonly invertedUnits = new InvertedUnits(this);\n\n /**\n * Creates a new SchemaContextEditor instance.\n * @param schemaContext The SchemaContext the Editor will use to edit in.\n */\n constructor(schemaContext: SchemaContext) {\n // TODO: Make copy\n this._schemaContext = schemaContext;\n }\n\n /** Allows you to get schema classes and items through regular SchemaContext methods. */\n public get schemaContext(): SchemaContext {\n return this._schemaContext;\n }\n\n public async finish(): Promise<SchemaContext> {\n return this._schemaContext;\n }\n\n /**\n * Helper method for retrieving a schema, previously added, from the SchemaContext.\n * @param schemaKey The SchemaKey identifying the schema.\n * @internal\n */\n public async getSchema(schemaKey: SchemaKey): Promise<MutableSchema> {\n const schema = await this.schemaContext.getCachedSchema(schemaKey, SchemaMatchType.Latest);\n if (schema === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));\n\n return schema as MutableSchema;\n }\n\n /**\n * Creates a Schema with the given properties and adds it to the current schema context.\n * @param name The name given to the new schema.\n * @param alias The alias of the new schema.\n * @param readVersion The read version number of the schema.\n * @param writeVersion The write version number of the schema.\n * @param minorVersion The minor version number of the schema.\n * @returns Resolves to the SchemaKey of created schema.\n */\n public async createSchema(name: string, alias: string, readVersion: number, writeVersion: number, minorVersion: number): Promise<SchemaKey> {\n const newSchema = new Schema(this._schemaContext, name, alias, readVersion, writeVersion, minorVersion);\n await this._schemaContext.addSchema(newSchema);\n return newSchema.schemaKey;\n }\n\n /**\n * Adds a referenced schema to the schema identified by the given SchemaKey.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param refSchema The referenced schema to add.\n */\n public async addSchemaReference(schemaKey: SchemaKey, refSchema: Schema): Promise<void> {\n try {\n const schema = await this.lookupSchema(schemaKey, SchemaMatchType.Exact);\n await schema.addReference(refSchema);\n\n const diagnostics: AnyDiagnostic[] = [];\n for await (const diagnostic of Rules.validateSchemaReferences(schema)) {\n diagnostics.push(diagnostic);\n }\n\n if (diagnostics.length > 0) {\n this.removeReference(schema, refSchema);\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new SchemaId(schemaKey), undefined, diagnostics);\n }\n\n if (!await this.schemaContext.getCachedSchema(refSchema.schemaKey)) {\n await this.schemaContext.addSchema(refSchema);\n }\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.AddSchemaReference, new SchemaId(schemaKey), e);\n }\n }\n\n /**\n * Adds a CustomAttribute instance to the schema identified by the given SchemaKey\n * @param schemaKey The SchemaKey identifying the schema.\n * @param customAttribute The CustomAttribute instance to add.\n */\n public async addCustomAttribute(schemaKey: SchemaKey, customAttribute: CustomAttribute): Promise<void> {\n try {\n const schema = await this.lookupSchema(schemaKey);\n schema.addCustomAttribute(customAttribute);\n\n const diagnostics: AnyDiagnostic[] = [];\n for await (const diagnostic of Rules.validateCustomAttributeInstance(schema, customAttribute)) {\n diagnostics.push(diagnostic);\n }\n\n if (diagnostics.length > 0) {\n this.removeCustomAttribute(schema, customAttribute);\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, schema), undefined, diagnostics);\n }\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToClass, new SchemaId(schemaKey), e);\n }\n }\n\n /**\n * Sets the schema version.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param readVersion The read version of the schema. If not specified, the existing read version will be maintained.\n * @param writeVersion The write version of the schema. If not specified, the existing write version will be maintained.\n * @param minorVersion The minor version of the schema. If not specified, the existing minor version will be maintained.\n * @returns Resolves to the new SchemaKey containing version updates.\n */\n public async setVersion(schemaKey: SchemaKey, readVersion?: number, writeVersion?: number, minorVersion?: number): Promise<SchemaKey> {\n try {\n const schema = await this.lookupSchema(schemaKey);\n schema.setVersion(readVersion || schema.readVersion, writeVersion || schema.writeVersion, minorVersion || schema.minorVersion);\n\n return schema.schemaKey;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.SetSchemaVersion, new SchemaId(schemaKey), e);\n }\n }\n\n /**\n * Increments the minor version of a schema.\n * @param schemaKey The SchemaKey identifying the schema.\n * @returns Resolves to the new SchemaKey containing version updates.\n */\n public async incrementMinorVersion(schemaKey: SchemaKey): Promise<SchemaKey> {\n try {\n const schema = await this.lookupSchema(schemaKey);\n schema.setVersion(schema.readVersion, schema.writeVersion, schema.minorVersion + 1);\n\n return schema.schemaKey;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.IncrementSchemaMinorVersion, new SchemaId(schemaKey), e);\n }\n }\n\n /** @internal */\n public async lookupSchemaItem(schemaOrKey: Schema | SchemaKey, schemaItemKey: SchemaItemKey, schemaItemType: SchemaItemType): Promise<SchemaItem> {\n if(Schema.isSchema(schemaOrKey)) {\n schemaOrKey = schemaOrKey.schemaKey;\n }\n\n const schemaItem = await this.schemaContext.getSchemaItem(schemaItemKey);\n if (schemaItem === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new SchemaItemId(schemaItemType, schemaItemKey));\n\n if (schemaItemType !== schemaItem.schemaItemType)\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType, schemaItemKey));\n\n return schemaItem;\n }\n\n /** @internal */\n public async getSchemaItem<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): Promise<InstanceType<T>> {\n const schemaItem = await this.schemaContext.getSchemaItem(schemaItemKey);\n const schemaItemType = itemConstructor.schemaItemType;\n if(!isSchemaItemType(schemaItemType)) {\n // This block should never be hit, as the editor components always pass in the itemConstructor with a valid schemaItemType.\n throw new Error(`Invalid schema item lookup for: ${schemaItemType}`);\n }\n\n if (!schemaItem) {\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFoundInContext, new SchemaItemId(schemaItemType, schemaItemKey));\n }\n\n if (!isSupportedSchemaItemType(schemaItem.schemaItemType, itemConstructor.schemaItemType))\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType, schemaItemKey));\n\n return schemaItem as InstanceType<T>;\n }\n\n private removeReference(schema: Schema, refSchema: Schema) {\n const index: number = schema.references.indexOf(refSchema);\n if (index !== -1) {\n schema.references.splice(index, 1);\n }\n }\n\n private removeCustomAttribute(schema: Schema, customAttribute: CustomAttribute) {\n assert(schema.customAttributes !== undefined);\n const map = schema.customAttributes as Map<string, CustomAttribute>;\n map.delete(customAttribute.className);\n }\n\n private async lookupSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<MutableSchema> {\n const schema = await this.schemaContext.getCachedSchema(schemaKey, matchType);\n if (schema === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));\n\n return schema as MutableSchema;\n }\n\n /**\n * Sets the Schemas description.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param description The new description to set.\n */\n public async setDescription(schemaKey: SchemaKey, description: string) {\n const schema = await this.lookupSchema(schemaKey)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetDescription, new SchemaId(schemaKey), e);\n });\n schema.setDescription(description);\n }\n\n /**\n * Sets the Schemas display label.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param label The new label to set.\n */\n public async setDisplayLabel(schemaKey: SchemaKey, label: string) {\n const schema = await this.lookupSchema(schemaKey)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetLabel, new SchemaId(schemaKey), e);\n });\n schema.setDisplayLabel(label);\n }\n\n /**\n * Sets the Schemas alias.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param alias The new alias to set.\n */\n public async setAlias(schemaKey: SchemaKey, alias: string) {\n const schema = await this.lookupSchema(schemaKey)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey), e);\n });\n\n try {\n for (const currentSchema of this.schemaContext.getKnownSchemas()) {\n if (currentSchema.schemaKey.matches(schemaKey))\n continue;\n\n if (currentSchema.alias.toLowerCase() === alias.toLowerCase())\n throw new SchemaEditingError(ECEditingStatus.SchemaAliasAlreadyExists, new SchemaId(schemaKey), undefined, undefined, `Schema ${currentSchema.name} already uses the alias '${alias}'.`);\n }\n schema.setAlias(alias);\n } catch(e: any) {\n if (e instanceof ECSchemaError && e.errorNumber === ECSchemaStatus.InvalidECName) {\n throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey),\n new SchemaEditingError(ECEditingStatus.InvalidSchemaAlias, new SchemaId(schemaKey)));\n }\n\n throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey), e);\n }\n }\n}\n\nfunction isSchemaItemType(type: SupportedSchemaItemType): type is SchemaItemType {\n return Object.values(SchemaItemType).includes(type as SchemaItemType);\n}"]}
1
+ {"version":3,"file":"Editor.js","sourceRoot":"","sources":["../../../src/Editing/Editor.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAmB,aAAa,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,EAA4C,cAAc,EAAa,eAAe,EAA2B,MAAM,0BAA0B,CAAC;AAE5O,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,kBAAkB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG7G;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IACtB,cAAc,CA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,CAAC,kBAAkB,EAAE,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YACzF,CAAC;YAED,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,cAAc,EAAG,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;CACF;AAED,SAAS,gBAAgB,CAAC,IAA6B;IACrD,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,IAAsB,CAAC,CAAC;AACxE,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 * as Rules from \"../Validation/ECRules\";\r\nimport { CustomAttribute, ECSchemaError, ECSchemaStatus, isSupportedSchemaItemType, Schema, SchemaContext, SchemaItem, SchemaItemKey, SchemaItemType, SchemaKey, SchemaMatchType, SupportedSchemaItemType } from \"@itwin/ecschema-metadata\";\r\nimport { MutableSchema } from \"./Mutable/MutableSchema\";\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Constants } from \"./Constants\";\r\nimport { CustomAttributes } from \"./CustomAttributes\";\r\nimport { Entities } from \"./Entities\";\r\nimport { Enumerations } from \"./Enumerations\";\r\nimport { Formats } from \"./Formats\";\r\nimport { InvertedUnits } from \"./InvertedUnits\";\r\nimport { KindOfQuantities } from \"./KindOfQuantities\";\r\nimport { Mixins } from \"./Mixins\";\r\nimport { Phenomena } from \"./Phenomena\";\r\nimport { PropertyCategories } from \"./PropertyCategories\";\r\nimport { RelationshipClasses } from \"./RelationshipClasses\";\r\nimport { Structs } from \"./Structs\";\r\nimport { Units } from \"./Units\";\r\nimport { UnitSystems } from \"./UnitSystems\";\r\nimport { CustomAttributeId, ECEditingStatus, SchemaEditingError, SchemaId, SchemaItemId } from \"./Exception\";\r\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\n\r\n/**\r\n * A class that allows you to edit and create schemas, classes, and items from the SchemaContext level.\r\n * @alpha\r\n */\r\nexport class SchemaContextEditor {\r\n private _schemaContext: SchemaContext;\r\n public readonly entities = new Entities(this);\r\n public readonly mixins = new Mixins(this);\r\n public readonly structs = new Structs(this);\r\n public readonly customAttributes = new CustomAttributes(this);\r\n public readonly relationships = new RelationshipClasses(this);\r\n public readonly constants = new Constants(this);\r\n public readonly enumerations = new Enumerations(this);\r\n public readonly formats = new Formats(this);\r\n public readonly kindOfQuantities = new KindOfQuantities(this);\r\n public readonly units = new Units(this);\r\n public readonly phenomenons = new Phenomena(this);\r\n public readonly unitSystems = new UnitSystems(this);\r\n public readonly propertyCategories = new PropertyCategories(this);\r\n public readonly invertedUnits = new InvertedUnits(this);\r\n\r\n /**\r\n * Creates a new SchemaContextEditor instance.\r\n * @param schemaContext The SchemaContext the Editor will use to edit in.\r\n */\r\n constructor(schemaContext: SchemaContext) {\r\n // TODO: Make copy\r\n this._schemaContext = schemaContext;\r\n }\r\n\r\n /** Allows you to get schema classes and items through regular SchemaContext methods. */\r\n public get schemaContext(): SchemaContext {\r\n return this._schemaContext;\r\n }\r\n\r\n public async finish(): Promise<SchemaContext> {\r\n return this._schemaContext;\r\n }\r\n\r\n /**\r\n * Helper method for retrieving a schema, previously added, from the SchemaContext.\r\n * @param schemaKey The SchemaKey identifying the schema.\r\n * @internal\r\n */\r\n public async getSchema(schemaKey: SchemaKey): Promise<MutableSchema> {\r\n const schema = await this.schemaContext.getCachedSchema(schemaKey, SchemaMatchType.Latest);\r\n if (schema === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));\r\n\r\n return schema as MutableSchema;\r\n }\r\n\r\n /**\r\n * Creates a Schema with the given properties and adds it to the current schema context.\r\n * @param name The name given to the new schema.\r\n * @param alias The alias of the new schema.\r\n * @param readVersion The read version number of the schema.\r\n * @param writeVersion The write version number of the schema.\r\n * @param minorVersion The minor version number of the schema.\r\n * @returns Resolves to the SchemaKey of created schema.\r\n */\r\n public async createSchema(name: string, alias: string, readVersion: number, writeVersion: number, minorVersion: number): Promise<SchemaKey> {\r\n const newSchema = new Schema(this._schemaContext, name, alias, readVersion, writeVersion, minorVersion);\r\n await this._schemaContext.addSchema(newSchema);\r\n return newSchema.schemaKey;\r\n }\r\n\r\n /**\r\n * Adds a referenced schema to the schema identified by the given SchemaKey.\r\n * @param schemaKey The SchemaKey identifying the schema.\r\n * @param refSchema The referenced schema to add.\r\n */\r\n public async addSchemaReference(schemaKey: SchemaKey, refSchema: Schema): Promise<void> {\r\n try {\r\n const schema = await this.lookupSchema(schemaKey, SchemaMatchType.Exact);\r\n await schema.addReference(refSchema);\r\n\r\n const diagnostics: AnyDiagnostic[] = [];\r\n for await (const diagnostic of Rules.validateSchemaReferences(schema)) {\r\n diagnostics.push(diagnostic);\r\n }\r\n\r\n if (diagnostics.length > 0) {\r\n this.removeReference(schema, refSchema);\r\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new SchemaId(schemaKey), undefined, diagnostics);\r\n }\r\n\r\n if (!await this.schemaContext.getCachedSchema(refSchema.schemaKey)) {\r\n await this.schemaContext.addSchema(refSchema);\r\n }\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.AddSchemaReference, new SchemaId(schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Adds a CustomAttribute instance to the schema identified by the given SchemaKey\r\n * @param schemaKey The SchemaKey identifying the schema.\r\n * @param customAttribute The CustomAttribute instance to add.\r\n */\r\n public async addCustomAttribute(schemaKey: SchemaKey, customAttribute: CustomAttribute): Promise<void> {\r\n try {\r\n const schema = await this.lookupSchema(schemaKey);\r\n schema.addCustomAttribute(customAttribute);\r\n\r\n const diagnostics: AnyDiagnostic[] = [];\r\n for await (const diagnostic of Rules.validateCustomAttributeInstance(schema, customAttribute)) {\r\n diagnostics.push(diagnostic);\r\n }\r\n\r\n if (diagnostics.length > 0) {\r\n this.removeCustomAttribute(schema, customAttribute);\r\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, schema), undefined, diagnostics);\r\n }\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToClass, new SchemaId(schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Sets the schema version.\r\n * @param schemaKey The SchemaKey identifying the schema.\r\n * @param readVersion The read version of the schema. If not specified, the existing read version will be maintained.\r\n * @param writeVersion The write version of the schema. If not specified, the existing write version will be maintained.\r\n * @param minorVersion The minor version of the schema. If not specified, the existing minor version will be maintained.\r\n * @returns Resolves to the new SchemaKey containing version updates.\r\n */\r\n public async setVersion(schemaKey: SchemaKey, readVersion?: number, writeVersion?: number, minorVersion?: number): Promise<SchemaKey> {\r\n try {\r\n const schema = await this.lookupSchema(schemaKey);\r\n schema.setVersion(readVersion || schema.readVersion, writeVersion || schema.writeVersion, minorVersion || schema.minorVersion);\r\n\r\n return schema.schemaKey;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.SetSchemaVersion, new SchemaId(schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Increments the minor version of a schema.\r\n * @param schemaKey The SchemaKey identifying the schema.\r\n * @returns Resolves to the new SchemaKey containing version updates.\r\n */\r\n public async incrementMinorVersion(schemaKey: SchemaKey): Promise<SchemaKey> {\r\n try {\r\n const schema = await this.lookupSchema(schemaKey);\r\n schema.setVersion(schema.readVersion, schema.writeVersion, schema.minorVersion + 1);\r\n\r\n return schema.schemaKey;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.IncrementSchemaMinorVersion, new SchemaId(schemaKey), e);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public async lookupSchemaItem(schemaOrKey: Schema | SchemaKey, schemaItemKey: SchemaItemKey, schemaItemType: SchemaItemType): Promise<SchemaItem> {\r\n if(Schema.isSchema(schemaOrKey)) {\r\n schemaOrKey = schemaOrKey.schemaKey;\r\n }\r\n\r\n const schemaItem = await this.schemaContext.getSchemaItem(schemaItemKey);\r\n if (schemaItem === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new SchemaItemId(schemaItemType, schemaItemKey));\r\n\r\n if (schemaItemType !== schemaItem.schemaItemType)\r\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType, schemaItemKey));\r\n\r\n return schemaItem;\r\n }\r\n\r\n /** @internal */\r\n public async getSchemaItem<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): Promise<InstanceType<T>> {\r\n const schemaItem = await this.schemaContext.getSchemaItem(schemaItemKey);\r\n const schemaItemType = itemConstructor.schemaItemType;\r\n if(!isSchemaItemType(schemaItemType)) {\r\n // This block should never be hit, as the editor components always pass in the itemConstructor with a valid schemaItemType.\r\n throw new Error(`Invalid schema item lookup for: ${schemaItemType}`);\r\n }\r\n\r\n if (!schemaItem) {\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFoundInContext, new SchemaItemId(schemaItemType, schemaItemKey));\r\n }\r\n\r\n if (!isSupportedSchemaItemType(schemaItem.schemaItemType, itemConstructor.schemaItemType))\r\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType, schemaItemKey));\r\n\r\n return schemaItem as InstanceType<T>;\r\n }\r\n\r\n private removeReference(schema: Schema, refSchema: Schema) {\r\n const index: number = schema.references.indexOf(refSchema);\r\n if (index !== -1) {\r\n schema.references.splice(index, 1);\r\n }\r\n }\r\n\r\n private removeCustomAttribute(schema: Schema, customAttribute: CustomAttribute) {\r\n assert(schema.customAttributes !== undefined);\r\n const map = schema.customAttributes as Map<string, CustomAttribute>;\r\n map.delete(customAttribute.className);\r\n }\r\n\r\n private async lookupSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<MutableSchema> {\r\n const schema = await this.schemaContext.getCachedSchema(schemaKey, matchType);\r\n if (schema === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));\r\n\r\n return schema as MutableSchema;\r\n }\r\n\r\n /**\r\n * Sets the Schemas description.\r\n * @param schemaKey The SchemaKey identifying the schema.\r\n * @param description The new description to set.\r\n */\r\n public async setDescription(schemaKey: SchemaKey, description: string) {\r\n const schema = await this.lookupSchema(schemaKey)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetDescription, new SchemaId(schemaKey), e);\r\n });\r\n schema.setDescription(description);\r\n }\r\n\r\n /**\r\n * Sets the Schemas display label.\r\n * @param schemaKey The SchemaKey identifying the schema.\r\n * @param label The new label to set.\r\n */\r\n public async setDisplayLabel(schemaKey: SchemaKey, label: string) {\r\n const schema = await this.lookupSchema(schemaKey)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetLabel, new SchemaId(schemaKey), e);\r\n });\r\n schema.setDisplayLabel(label);\r\n }\r\n\r\n /**\r\n * Sets the Schemas alias.\r\n * @param schemaKey The SchemaKey identifying the schema.\r\n * @param alias The new alias to set.\r\n */\r\n public async setAlias(schemaKey: SchemaKey, alias: string) {\r\n const schema = await this.lookupSchema(schemaKey)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey), e);\r\n });\r\n\r\n try {\r\n for (const currentSchema of this.schemaContext.getKnownSchemas()) {\r\n if (currentSchema.schemaKey.matches(schemaKey))\r\n continue;\r\n\r\n if (currentSchema.alias.toLowerCase() === alias.toLowerCase())\r\n throw new SchemaEditingError(ECEditingStatus.SchemaAliasAlreadyExists, new SchemaId(schemaKey), undefined, undefined, `Schema ${currentSchema.name} already uses the alias '${alias}'.`);\r\n }\r\n schema.setAlias(alias);\r\n } catch(e: any) {\r\n if (e instanceof ECSchemaError && e.errorNumber === ECSchemaStatus.InvalidECName) {\r\n throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey),\r\n new SchemaEditingError(ECEditingStatus.InvalidSchemaAlias, new SchemaId(schemaKey)));\r\n }\r\n\r\n throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey), e);\r\n }\r\n }\r\n}\r\n\r\nfunction isSchemaItemType(type: SupportedSchemaItemType): type is SchemaItemType {\r\n return Object.values(SchemaItemType).includes(type as SchemaItemType);\r\n}"]}