@itwin/ecschema-editing 4.6.0-dev.6 → 4.6.0-dev.8

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 (156) hide show
  1. package/lib/cjs/Differencing/SchemaConflicts.d.ts +2 -2
  2. package/lib/cjs/Differencing/SchemaConflicts.js +1 -1
  3. package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
  4. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts +9 -6
  5. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
  6. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +213 -161
  7. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
  8. package/lib/cjs/Differencing/SchemaDifference.d.ts +354 -78
  9. package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
  10. package/lib/cjs/Differencing/SchemaDifference.js +184 -11
  11. package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
  12. package/lib/cjs/Editing/Constants.js.map +1 -1
  13. package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
  14. package/lib/cjs/Editing/ECClasses.js.map +1 -1
  15. package/lib/cjs/Editing/Editor.js.map +1 -1
  16. package/lib/cjs/Editing/Entities.js.map +1 -1
  17. package/lib/cjs/Editing/Enumerations.js.map +1 -1
  18. package/lib/cjs/Editing/Formats.js.map +1 -1
  19. package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
  20. package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
  21. package/lib/cjs/Editing/Mixins.js.map +1 -1
  22. package/lib/cjs/Editing/Mutable/MutableArrayProperty.js.map +1 -1
  23. package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
  24. package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
  25. package/lib/cjs/Editing/Mutable/MutableConstant.d.ts +1 -0
  26. package/lib/cjs/Editing/Mutable/MutableConstant.d.ts.map +1 -1
  27. package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
  28. package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
  29. package/lib/cjs/Editing/Mutable/MutableEnumeration.d.ts +1 -0
  30. package/lib/cjs/Editing/Mutable/MutableEnumeration.d.ts.map +1 -1
  31. package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
  32. package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
  33. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
  34. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.d.ts +2 -0
  35. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.d.ts.map +1 -1
  36. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
  37. package/lib/cjs/Editing/Mutable/MutableMixin.js.map +1 -1
  38. package/lib/cjs/Editing/Mutable/MutablePhenomenon.d.ts +1 -0
  39. package/lib/cjs/Editing/Mutable/MutablePhenomenon.d.ts.map +1 -1
  40. package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
  41. package/lib/cjs/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -1
  42. package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
  43. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.d.ts +1 -0
  44. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.d.ts.map +1 -1
  45. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
  46. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
  47. package/lib/cjs/Editing/Mutable/MutableSchema.d.ts +2 -0
  48. package/lib/cjs/Editing/Mutable/MutableSchema.d.ts.map +1 -1
  49. package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
  50. package/lib/cjs/Editing/Mutable/MutableUnit.js.map +1 -1
  51. package/lib/cjs/Editing/Mutable/MutableUnitSystem.d.ts +1 -0
  52. package/lib/cjs/Editing/Mutable/MutableUnitSystem.d.ts.map +1 -1
  53. package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
  54. package/lib/cjs/Editing/Phenomena.js.map +1 -1
  55. package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
  56. package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
  57. package/lib/cjs/Editing/SchemaItems.js.map +1 -1
  58. package/lib/cjs/Editing/Structs.js.map +1 -1
  59. package/lib/cjs/Editing/UnitSystems.js.map +1 -1
  60. package/lib/cjs/Editing/Units.js.map +1 -1
  61. package/lib/cjs/Merging/CAClassMerger.d.ts +4 -7
  62. package/lib/cjs/Merging/CAClassMerger.d.ts.map +1 -1
  63. package/lib/cjs/Merging/CAClassMerger.js +26 -23
  64. package/lib/cjs/Merging/CAClassMerger.js.map +1 -1
  65. package/lib/cjs/Merging/ClassMerger.d.ts +10 -18
  66. package/lib/cjs/Merging/ClassMerger.d.ts.map +1 -1
  67. package/lib/cjs/Merging/ClassMerger.js +148 -155
  68. package/lib/cjs/Merging/ClassMerger.js.map +1 -1
  69. package/lib/cjs/Merging/ConstantMerger.d.ts +4 -8
  70. package/lib/cjs/Merging/ConstantMerger.d.ts.map +1 -1
  71. package/lib/cjs/Merging/ConstantMerger.js +59 -40
  72. package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
  73. package/lib/cjs/Merging/CustomAttributeMerger.d.ts +16 -13
  74. package/lib/cjs/Merging/CustomAttributeMerger.d.ts.map +1 -1
  75. package/lib/cjs/Merging/CustomAttributeMerger.js +66 -34
  76. package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
  77. package/lib/cjs/Merging/EntityClassMerger.d.ts +10 -7
  78. package/lib/cjs/Merging/EntityClassMerger.d.ts.map +1 -1
  79. package/lib/cjs/Merging/EntityClassMerger.js +41 -29
  80. package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
  81. package/lib/cjs/Merging/EnumerationMerger.d.ts +9 -9
  82. package/lib/cjs/Merging/EnumerationMerger.d.ts.map +1 -1
  83. package/lib/cjs/Merging/EnumerationMerger.js +77 -48
  84. package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
  85. package/lib/cjs/Merging/KindOfQuantityMerger.d.ts +4 -11
  86. package/lib/cjs/Merging/KindOfQuantityMerger.d.ts.map +1 -1
  87. package/lib/cjs/Merging/KindOfQuantityMerger.js +57 -53
  88. package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
  89. package/lib/cjs/Merging/MixinMerger.d.ts +4 -7
  90. package/lib/cjs/Merging/MixinMerger.d.ts.map +1 -1
  91. package/lib/cjs/Merging/MixinMerger.js +24 -25
  92. package/lib/cjs/Merging/MixinMerger.js.map +1 -1
  93. package/lib/cjs/Merging/PhenomenonMerger.d.ts +8 -0
  94. package/lib/cjs/Merging/PhenomenonMerger.d.ts.map +1 -0
  95. package/lib/cjs/Merging/PhenomenonMerger.js +37 -0
  96. package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -0
  97. package/lib/cjs/Merging/PropertyCategoryMerger.d.ts +8 -0
  98. package/lib/cjs/Merging/PropertyCategoryMerger.d.ts.map +1 -0
  99. package/lib/cjs/Merging/PropertyCategoryMerger.js +34 -0
  100. package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -0
  101. package/lib/cjs/Merging/PropertyMerger.d.ts +6 -14
  102. package/lib/cjs/Merging/PropertyMerger.d.ts.map +1 -1
  103. package/lib/cjs/Merging/PropertyMerger.js +212 -287
  104. package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
  105. package/lib/cjs/Merging/RelationshipClassMerger.d.ts +16 -10
  106. package/lib/cjs/Merging/RelationshipClassMerger.d.ts.map +1 -1
  107. package/lib/cjs/Merging/RelationshipClassMerger.js +121 -112
  108. package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
  109. package/lib/cjs/Merging/SchemaItemMerger.d.ts +26 -51
  110. package/lib/cjs/Merging/SchemaItemMerger.d.ts.map +1 -1
  111. package/lib/cjs/Merging/SchemaItemMerger.js +106 -88
  112. package/lib/cjs/Merging/SchemaItemMerger.js.map +1 -1
  113. package/lib/cjs/Merging/SchemaMerger.d.ts +21 -9
  114. package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
  115. package/lib/cjs/Merging/SchemaMerger.js +74 -88
  116. package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
  117. package/lib/cjs/Merging/SchemaReferenceMerger.d.ts +5 -5
  118. package/lib/cjs/Merging/SchemaReferenceMerger.d.ts.map +1 -1
  119. package/lib/cjs/Merging/SchemaReferenceMerger.js +33 -15
  120. package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
  121. package/lib/cjs/Merging/UnitSystemMerger.d.ts +8 -0
  122. package/lib/cjs/Merging/UnitSystemMerger.d.ts.map +1 -0
  123. package/lib/cjs/Merging/UnitSystemMerger.js +26 -0
  124. package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -0
  125. package/lib/cjs/Validation/Diagnostic.js.map +1 -1
  126. package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
  127. package/lib/cjs/Validation/ECRules.d.ts +23 -23
  128. package/lib/cjs/Validation/ECRules.d.ts.map +1 -1
  129. package/lib/cjs/Validation/ECRules.js +1 -1
  130. package/lib/cjs/Validation/ECRules.js.map +1 -1
  131. package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
  132. package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
  133. package/lib/cjs/Validation/Rules.js.map +1 -1
  134. package/lib/cjs/Validation/SchemaChanges.js +1 -1
  135. package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
  136. package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
  137. package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
  138. package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
  139. package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
  140. package/lib/cjs/Validation/SchemaComparer.d.ts.map +1 -1
  141. package/lib/cjs/Validation/SchemaComparer.js +3 -3
  142. package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
  143. package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
  144. package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
  145. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  146. package/lib/cjs/ecschema-editing.js.map +1 -1
  147. package/package.json +9 -9
  148. package/public/locales/en/ECSchemaEditing.json +26 -26
  149. package/lib/cjs/Merging/SchemaItemFactory.d.ts +0 -15
  150. package/lib/cjs/Merging/SchemaItemFactory.d.ts.map +0 -1
  151. package/lib/cjs/Merging/SchemaItemFactory.js +0 -82
  152. package/lib/cjs/Merging/SchemaItemFactory.js.map +0 -1
  153. package/lib/cjs/Merging/StructClassMerger.d.ts +0 -10
  154. package/lib/cjs/Merging/StructClassMerger.d.ts.map +0 -1
  155. package/lib/cjs/Merging/StructClassMerger.js +0 -13
  156. package/lib/cjs/Merging/StructClassMerger.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MutableProperty.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableProperty.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAyG;AAEzG;;;GAGG;AACH,MAAsB,eAAgB,SAAQ,4BAAQ;CAQrD;AARD,0CAQC","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\nimport { CustomAttribute, ECName, LazyLoadedPropertyCategory, Property } from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableProperty extends Property {\r\n public abstract override setName(name: ECName): void;\r\n public abstract override setDescription(description: string): void;\r\n public abstract override setLabel(label: string): void;\r\n public abstract override setIsReadOnly(isReadOnly: boolean): void;\r\n public abstract override setPriority(priority: number): void;\r\n public abstract override setCategory(category: LazyLoadedPropertyCategory): void;\r\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"MutableProperty.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableProperty.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAyG;AAEzG;;;GAGG;AACH,MAAsB,eAAgB,SAAQ,4BAAQ;CAQrD;AARD,0CAQC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { CustomAttribute, ECName, LazyLoadedPropertyCategory, Property } from \"@itwin/ecschema-metadata\";\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableProperty extends Property {\n public abstract override setName(name: ECName): void;\n public abstract override setDescription(description: string): void;\n public abstract override setLabel(label: string): void;\n public abstract override setIsReadOnly(isReadOnly: boolean): void;\n public abstract override setPriority(priority: number): void;\n public abstract override setCategory(category: LazyLoadedPropertyCategory): void;\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\n}\n"]}
@@ -6,5 +6,6 @@ import { PropertyCategory } from "@itwin/ecschema-metadata";
6
6
  export declare abstract class MutablePropertyCategory extends PropertyCategory {
7
7
  abstract setPriority(priority: number): void;
8
8
  abstract setDisplayLabel(displayLabel: string): void;
9
+ abstract setDescription(description: string): void;
9
10
  }
10
11
  //# sourceMappingURL=MutablePropertyCategory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MutablePropertyCategory.d.ts","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutablePropertyCategory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;GAGG;AACH,8BAAsB,uBAAwB,SAAQ,gBAAgB;aAC3C,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;aACnC,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;CACrE"}
1
+ {"version":3,"file":"MutablePropertyCategory.d.ts","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutablePropertyCategory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;GAGG;AACH,8BAAsB,uBAAwB,SAAQ,gBAAgB;aAC3C,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;aACnC,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;aAC3C,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CACnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"MutablePropertyCategory.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutablePropertyCategory.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAA4D;AAE5D;;;GAGG;AACH,MAAsB,uBAAwB,SAAQ,oCAAgB;CAGrE;AAHD,0DAGC","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\nimport { PropertyCategory } from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutablePropertyCategory extends PropertyCategory {\r\n public abstract override setPriority(priority: number): void;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"MutablePropertyCategory.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutablePropertyCategory.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAA4D;AAE5D;;;GAGG;AACH,MAAsB,uBAAwB,SAAQ,oCAAgB;CAIrE;AAJD,0DAIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { PropertyCategory } from \"@itwin/ecschema-metadata\";\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutablePropertyCategory extends PropertyCategory {\n public abstract override setPriority(priority: number): void;\n public abstract override setDisplayLabel(displayLabel: string): void;\n public abstract override setDescription(description: string): void;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MutableRelationshipClass.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableRelationshipClass.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAiQ;AAEjQ;;;GAGG;AACH,MAAsB,6BAA8B,SAAQ,0CAAsB;CAQjF;AARD,sEAQC;AAED;;;GAGG;AACH,MAAsB,wBAAyB,SAAQ,qCAAiB;IACtE,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;IACtF,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;CAQvF;AAVD,4DAUC","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\nimport { CustomAttribute, EntityClass, LazyLoadedRelationshipConstraintClass, Mixin, NavigationProperty, RelationshipClass, RelationshipConstraint, RelationshipEnd, RelationshipMultiplicity, StrengthDirection, StrengthType } from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\n * @internal\r\n */\r\nexport abstract class MutableRelationshipConstraint extends RelationshipConstraint {\r\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\r\n public abstract override set multiplicity(multiplicity: RelationshipMultiplicity);\r\n public abstract override set polymorphic(polymorphic: boolean);\r\n public abstract override set roleLabel(roleLabel: string | undefined);\r\n public abstract override set relationshipEnd(relationshipEnd: RelationshipEnd) ;\r\n public abstract override set abstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined);\r\n public abstract override removeClass(constraint: EntityClass | Mixin | RelationshipClass): void;\r\n}\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableRelationshipClass extends RelationshipClass {\r\n public override get source() { return this._source as MutableRelationshipConstraint; }\r\n public override get target() { return this._target as MutableRelationshipConstraint; }\r\n public abstract override setStrength(strength: StrengthType): void;\r\n public abstract override setStrengthDirection(direction: StrengthDirection): void;\r\n public abstract override setSourceConstraint(source: RelationshipConstraint): void;\r\n public abstract override setTargetConstraint(target: RelationshipConstraint): void;\r\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\r\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"MutableRelationshipClass.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableRelationshipClass.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAiQ;AAEjQ;;;GAGG;AACH,MAAsB,6BAA8B,SAAQ,0CAAsB;CAQjF;AARD,sEAQC;AAED;;;GAGG;AACH,MAAsB,wBAAyB,SAAQ,qCAAiB;IACtE,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;IACtF,IAAoB,MAAM,KAAK,OAAO,IAAI,CAAC,OAAwC,CAAC,CAAC,CAAC;CAQvF;AAVD,4DAUC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { CustomAttribute, EntityClass, LazyLoadedRelationshipConstraintClass, Mixin, NavigationProperty, RelationshipClass, RelationshipConstraint, RelationshipEnd, RelationshipMultiplicity, StrengthDirection, StrengthType } from \"@itwin/ecschema-metadata\";\n\n/**\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\n * @internal\n */\nexport abstract class MutableRelationshipConstraint extends RelationshipConstraint {\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\n public abstract override set multiplicity(multiplicity: RelationshipMultiplicity);\n public abstract override set polymorphic(polymorphic: boolean);\n public abstract override set roleLabel(roleLabel: string | undefined);\n public abstract override set relationshipEnd(relationshipEnd: RelationshipEnd) ;\n public abstract override set abstractConstraint(abstractConstraint: LazyLoadedRelationshipConstraintClass | undefined);\n public abstract override removeClass(constraint: EntityClass | Mixin | RelationshipClass): void;\n}\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableRelationshipClass extends RelationshipClass {\n public override get source() { return this._source as MutableRelationshipConstraint; }\n public override get target() { return this._target as MutableRelationshipConstraint; }\n public abstract override setStrength(strength: StrengthType): void;\n public abstract override setStrengthDirection(direction: StrengthDirection): void;\n public abstract override setSourceConstraint(source: RelationshipConstraint): void;\n public abstract override setTargetConstraint(target: RelationshipConstraint): void;\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
@@ -42,5 +42,7 @@ export declare abstract class MutableSchema extends Schema {
42
42
  abstract setVersion(readVersion?: number, writeVersion?: number, minorVersion?: number): void;
43
43
  abstract deleteClass(name: string): Promise<void>;
44
44
  abstract deleteClassSync(name: string): void;
45
+ abstract setDisplayLabel(displayLabel: string): void;
46
+ abstract setDescription(displayLabel: string): void;
45
47
  }
46
48
  //# sourceMappingURL=MutableSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"M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
- {"version":3,"file":"MutableSchema.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableSchema.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAIkC;AAElC;;;;;GAKG;AACH,MAAsB,aAAc,SAAQ,0BAAM;CAqCjD;AArCD,sCAqCC","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\nimport {\r\n Constant, CustomAttribute, CustomAttributeClass, ECClassModifier, EntityClass, Enumeration,\r\n Format, InvertedUnit, KindOfQuantity, Mixin, Phenomenon, PrimitiveType, PropertyCategory,\r\n RelationshipClass, Schema, SchemaContext, SchemaItem, StructClass, Unit, UnitSystem,\r\n} from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\n * We cannot put this into Helper.ts and make it non-export, because we are importing Helper.ts from this file, and the circular import\r\n * would prevent this class from extending Schema.\r\n * @internal\r\n */\r\nexport abstract class MutableSchema extends Schema {\r\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\r\n public abstract override createEntityClass(name: string, modifier?: ECClassModifier): Promise<EntityClass>;\r\n public abstract override createEntityClassSync(name: string, modifier?: ECClassModifier): EntityClass;\r\n public abstract override createMixinClass(name: string): Promise<Mixin>;\r\n public abstract override createMixinClassSync(name: string): Mixin;\r\n public abstract override createStructClass(name: string, modifier?: ECClassModifier): Promise<StructClass>;\r\n public abstract override createStructClassSync(name: string, modifier?: ECClassModifier): StructClass;\r\n public abstract override createCustomAttributeClass(name: string, modifier?: ECClassModifier): Promise<CustomAttributeClass>;\r\n public abstract override createCustomAttributeClassSync(name: string, modifier?: ECClassModifier): CustomAttributeClass;\r\n public abstract override createRelationshipClass(name: string, modifier?: ECClassModifier): Promise<RelationshipClass>;\r\n public abstract override createRelationshipClassSync(name: string, modifier?: ECClassModifier): RelationshipClass;\r\n public abstract override createEnumeration(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Promise<Enumeration>;\r\n public abstract override createEnumerationSync(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Enumeration;\r\n public abstract override createKindOfQuantity(name: string): Promise<KindOfQuantity>;\r\n public abstract override createKindOfQuantitySync(name: string): KindOfQuantity;\r\n public abstract override createUnit(name: string): Promise<Unit>;\r\n public abstract override createUnitSync(name: string): Unit;\r\n public abstract override createConstant(name: string): Promise<Constant>;\r\n public abstract override createConstantSync(name: string): Constant;\r\n public abstract override createInvertedUnit(name: string): Promise<InvertedUnit>;\r\n public abstract override createInvertedUnitSync(name: string): InvertedUnit;\r\n public abstract override createPhenomenon(name: string): Promise<Phenomenon>;\r\n public abstract override createPhenomenonSync(name: string): Phenomenon;\r\n public abstract override createFormat(name: string): Promise<Format>;\r\n public abstract override createFormatSync(name: string): Format;\r\n public abstract override createUnitSystem(name: string): Promise<UnitSystem>;\r\n public abstract override createUnitSystemSync(name: string): UnitSystem;\r\n public abstract override createPropertyCategory(name: string): Promise<PropertyCategory>;\r\n public abstract override createPropertyCategorySync(name: string): PropertyCategory;\r\n public abstract override addItem<T extends SchemaItem>(item: T): void;\r\n public abstract override addReference(refSchema: Schema): Promise<void>;\r\n public abstract override addReferenceSync(refSchema: Schema): void;\r\n public abstract override setContext(schemaContext: SchemaContext): void;\r\n public abstract override setVersion(readVersion?: number, writeVersion?: number, minorVersion?: number): void;\r\n public abstract override deleteClass(name: string): Promise<void>;\r\n public abstract override deleteClassSync(name: string): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"MutableSchema.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableSchema.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAIkC;AAElC;;;;;GAKG;AACH,MAAsB,aAAc,SAAQ,0BAAM;CAuCjD;AAvCD,sCAuCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport {\n Constant, CustomAttribute, CustomAttributeClass, ECClassModifier, EntityClass, Enumeration,\n Format, InvertedUnit, KindOfQuantity, Mixin, Phenomenon, PrimitiveType, PropertyCategory,\n RelationshipClass, Schema, SchemaContext, SchemaItem, StructClass, Unit, UnitSystem,\n} from \"@itwin/ecschema-metadata\";\n\n/**\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\n * We cannot put this into Helper.ts and make it non-export, because we are importing Helper.ts from this file, and the circular import\n * would prevent this class from extending Schema.\n * @internal\n */\nexport abstract class MutableSchema extends Schema {\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\n public abstract override createEntityClass(name: string, modifier?: ECClassModifier): Promise<EntityClass>;\n public abstract override createEntityClassSync(name: string, modifier?: ECClassModifier): EntityClass;\n public abstract override createMixinClass(name: string): Promise<Mixin>;\n public abstract override createMixinClassSync(name: string): Mixin;\n public abstract override createStructClass(name: string, modifier?: ECClassModifier): Promise<StructClass>;\n public abstract override createStructClassSync(name: string, modifier?: ECClassModifier): StructClass;\n public abstract override createCustomAttributeClass(name: string, modifier?: ECClassModifier): Promise<CustomAttributeClass>;\n public abstract override createCustomAttributeClassSync(name: string, modifier?: ECClassModifier): CustomAttributeClass;\n public abstract override createRelationshipClass(name: string, modifier?: ECClassModifier): Promise<RelationshipClass>;\n public abstract override createRelationshipClassSync(name: string, modifier?: ECClassModifier): RelationshipClass;\n public abstract override createEnumeration(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Promise<Enumeration>;\n public abstract override createEnumerationSync(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Enumeration;\n public abstract override createKindOfQuantity(name: string): Promise<KindOfQuantity>;\n public abstract override createKindOfQuantitySync(name: string): KindOfQuantity;\n public abstract override createUnit(name: string): Promise<Unit>;\n public abstract override createUnitSync(name: string): Unit;\n public abstract override createConstant(name: string): Promise<Constant>;\n public abstract override createConstantSync(name: string): Constant;\n public abstract override createInvertedUnit(name: string): Promise<InvertedUnit>;\n public abstract override createInvertedUnitSync(name: string): InvertedUnit;\n public abstract override createPhenomenon(name: string): Promise<Phenomenon>;\n public abstract override createPhenomenonSync(name: string): Phenomenon;\n public abstract override createFormat(name: string): Promise<Format>;\n public abstract override createFormatSync(name: string): Format;\n public abstract override createUnitSystem(name: string): Promise<UnitSystem>;\n public abstract override createUnitSystemSync(name: string): UnitSystem;\n public abstract override createPropertyCategory(name: string): Promise<PropertyCategory>;\n public abstract override createPropertyCategorySync(name: string): PropertyCategory;\n public abstract override addItem<T extends SchemaItem>(item: T): void;\n public abstract override addReference(refSchema: Schema): Promise<void>;\n public abstract override addReferenceSync(refSchema: Schema): void;\n public abstract override setContext(schemaContext: SchemaContext): void;\n public abstract override setVersion(readVersion?: number, writeVersion?: number, minorVersion?: number): void;\n public abstract override deleteClass(name: string): Promise<void>;\n public abstract override deleteClassSync(name: string): void;\n public abstract override setDisplayLabel(displayLabel: string): void;\n public abstract override setDescription(displayLabel: string): void;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MutableUnit.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableUnit.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAA4F;AAE5F;;;GAGG;AACH,MAAsB,WAAY,SAAQ,wBAAI;CAK7C;AALD,kCAKC","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\nimport { LazyLoadedPhenomenon, LazyLoadedUnitSystem, Unit } from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableUnit extends Unit {\r\n public abstract override setPhenomenon(phenomenon: LazyLoadedPhenomenon): Promise<void>;\r\n public abstract override setUnitSystem(unitSystem: LazyLoadedUnitSystem): Promise<void>;\r\n public abstract override setDefinition(definition: string): Promise<void>;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"MutableUnit.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableUnit.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAA4F;AAE5F;;;GAGG;AACH,MAAsB,WAAY,SAAQ,wBAAI;CAK7C;AALD,kCAKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { LazyLoadedPhenomenon, LazyLoadedUnitSystem, Unit } from \"@itwin/ecschema-metadata\";\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableUnit extends Unit {\n public abstract override setPhenomenon(phenomenon: LazyLoadedPhenomenon): Promise<void>;\n public abstract override setUnitSystem(unitSystem: LazyLoadedUnitSystem): Promise<void>;\n public abstract override setDefinition(definition: string): Promise<void>;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
@@ -5,5 +5,6 @@ import { UnitSystem } from "@itwin/ecschema-metadata";
5
5
  */
6
6
  export declare abstract class MutableUnitSystem extends UnitSystem {
7
7
  abstract setDisplayLabel(displayLabel: string): void;
8
+ abstract setDescription(description: string): void;
8
9
  }
9
10
  //# sourceMappingURL=MutableUnitSystem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MutableUnitSystem.d.ts","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableUnitSystem.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD;;;GAGG;AACH,8BAAsB,iBAAkB,SAAQ,UAAU;aAC/B,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;CACrE"}
1
+ {"version":3,"file":"MutableUnitSystem.d.ts","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableUnitSystem.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD;;;GAGG;AACH,8BAAsB,iBAAkB,SAAQ,UAAU;aAC/B,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;aAC3C,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CACnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"MutableUnitSystem.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableUnitSystem.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAsD;AAEtD;;;GAGG;AACH,MAAsB,iBAAkB,SAAQ,8BAAU;CAEzD;AAFD,8CAEC","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\nimport { UnitSystem } from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * @internal\r\n * Used for schema editing.\r\n */\r\nexport abstract class MutableUnitSystem extends UnitSystem {\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"MutableUnitSystem.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableUnitSystem.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAsD;AAEtD;;;GAGG;AACH,MAAsB,iBAAkB,SAAQ,8BAAU;CAGzD;AAHD,8CAGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { UnitSystem } from \"@itwin/ecschema-metadata\";\n\n/**\n * @internal\n * Used for schema editing.\n */\nexport abstract class MutableUnitSystem extends UnitSystem {\n public abstract override setDisplayLabel(displayLabel: string): void;\n public abstract override setDescription(description: string): void;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Phenomena.js","sourceRoot":"","sources":["../../../src/Editing/Phenomena.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAMH;;;GAGG;AACH,MAAa,SAAS;IACpB,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAE7D,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,UAAkB,EAAE,YAAqB;QAC/F,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEzF,MAAM,aAAa,GAAG,CAAC,MAAM,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAsB,CAAC;QACjF,IAAI,aAAa,KAAK,SAAS;YAC7B,OAAO,EAAE,YAAY,EAAE,0BAA0B,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAEnG,IAAI,YAAY;YACd,aAAa,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QAE9C,MAAM,aAAa,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAE9C,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;IACxC,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,eAAgC;QACjF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEzF,IAAI,eAAe,CAAC,IAAI,KAAK,SAAS;YACpC,OAAO,EAAE,YAAY,EAAE,oCAAoC,EAAE,CAAC;QAEhE,MAAM,aAAa,GAAG,CAAC,MAAM,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5E,IAAI,aAAa,KAAK,SAAS;YAC7B,OAAO,EAAE,YAAY,EAAE,0BAA0B,eAAe,CAAC,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAEnH,MAAM,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC9C,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;IACxC,CAAC;CACF;AAnCD,8BAmCC","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 { PhenomenonProps, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\r\nimport { MutablePhenomenon } from \"./Mutable/MutablePhenomenon\";\r\n\r\n/**\r\n * @alpha\r\n * A class allowing you to create schema items of type Phenomenon.\r\n */\r\nexport class Phenomena {\r\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, definition: string, displayLabel?: string): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n const newPhenomenon = (await schema.createPhenomenon(name)) as MutablePhenomenon;\r\n if (newPhenomenon === undefined)\r\n return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };\r\n\r\n if (displayLabel)\r\n newPhenomenon.setDisplayLabel(displayLabel);\r\n\r\n await newPhenomenon.setDefinition(definition);\r\n\r\n return { itemKey: newPhenomenon.key };\r\n }\r\n\r\n public async createFromProps(schemaKey: SchemaKey, phenomenonProps: PhenomenonProps): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n if (phenomenonProps.name === undefined)\r\n return { errorMessage: `No name was supplied within props.` };\r\n\r\n const newPhenomenon = (await schema.createPhenomenon(phenomenonProps.name));\r\n if (newPhenomenon === undefined)\r\n return { errorMessage: `Failed to create class ${phenomenonProps.name} in schema ${schemaKey.toString(true)}.` };\r\n\r\n await newPhenomenon.fromJSON(phenomenonProps);\r\n return { itemKey: newPhenomenon.key };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Phenomena.js","sourceRoot":"","sources":["../../../src/Editing/Phenomena.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAMH;;;GAGG;AACH,MAAa,SAAS;IACpB,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAE7D,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,UAAkB,EAAE,YAAqB;QAC/F,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEzF,MAAM,aAAa,GAAG,CAAC,MAAM,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAsB,CAAC;QACjF,IAAI,aAAa,KAAK,SAAS;YAC7B,OAAO,EAAE,YAAY,EAAE,0BAA0B,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAEnG,IAAI,YAAY;YACd,aAAa,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QAE9C,MAAM,aAAa,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAE9C,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;IACxC,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,eAAgC;QACjF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEzF,IAAI,eAAe,CAAC,IAAI,KAAK,SAAS;YACpC,OAAO,EAAE,YAAY,EAAE,oCAAoC,EAAE,CAAC;QAEhE,MAAM,aAAa,GAAG,CAAC,MAAM,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5E,IAAI,aAAa,KAAK,SAAS;YAC7B,OAAO,EAAE,YAAY,EAAE,0BAA0B,eAAe,CAAC,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAEnH,MAAM,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC9C,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;IACxC,CAAC;CACF;AAnCD,8BAmCC","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 { PhenomenonProps, SchemaKey } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\nimport { MutablePhenomenon } from \"./Mutable/MutablePhenomenon\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type Phenomenon.\n */\nexport class Phenomena {\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\n\n public async create(schemaKey: SchemaKey, name: string, definition: string, displayLabel?: string): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n const newPhenomenon = (await schema.createPhenomenon(name)) as MutablePhenomenon;\n if (newPhenomenon === undefined)\n return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };\n\n if (displayLabel)\n newPhenomenon.setDisplayLabel(displayLabel);\n\n await newPhenomenon.setDefinition(definition);\n\n return { itemKey: newPhenomenon.key };\n }\n\n public async createFromProps(schemaKey: SchemaKey, phenomenonProps: PhenomenonProps): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n if (phenomenonProps.name === undefined)\n return { errorMessage: `No name was supplied within props.` };\n\n const newPhenomenon = (await schema.createPhenomenon(phenomenonProps.name));\n if (newPhenomenon === undefined)\n return { errorMessage: `Failed to create class ${phenomenonProps.name} in schema ${schemaKey.toString(true)}.` };\n\n await newPhenomenon.fromJSON(phenomenonProps);\n return { itemKey: newPhenomenon.key };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyCategories.js","sourceRoot":"","sources":["../../../src/Editing/PropertyCategories.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA4I;AAI5I;;;GAGG;AACH,MAAa,kBAAkB;IAC7B,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAC7D,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,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GAAG,EAAE,CAAC;IAC1C,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,eAA8B,EAAE,QAAgB;QACvE,MAAM,gBAAgB,GAAG,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,aAAa,CAA0B,eAAe,CAAC,CAAC,CAAC;QAE1H,IAAI,gBAAgB,KAAK,SAAS;YAChC,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,aAAa,EAAE,qBAAqB,eAAe,CAAC,QAAQ,+BAA+B,CAAC,CAAC;QAExI,IAAI,gBAAgB,CAAC,cAAc,KAAK,kCAAc,CAAC,gBAAgB;YACrE,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,qBAAqB,EAAE,YAAY,eAAe,CAAC,QAAQ,mCAAmC,CAAC,CAAC;QAE3I,gBAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;CACF;AA1CD,gDA0CC","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 { ECObjectsError, ECObjectsStatus, PropertyCategoryProps, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\r\nimport { MutablePropertyCategory } from \"./Mutable/MutablePropertyCategory\";\r\n\r\n/**\r\n * @alpha\r\n * A class allowing you to create schema items of type Property Category.\r\n */\r\nexport class PropertyCategories {\r\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\r\n public async create(schemaKey: SchemaKey, name: string, priority: number, displayLabel?: string): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n const newPropCategory = (await schema.createPropertyCategory(name)) as MutablePropertyCategory;\r\n newPropCategory.setPriority(priority);\r\n if (displayLabel)\r\n newPropCategory.setDisplayLabel(displayLabel);\r\n\r\n return { itemKey: newPropCategory.key };\r\n }\r\n\r\n public async createFromProps(schemaKey: SchemaKey, propertyCategoryProps: PropertyCategoryProps): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n if (propertyCategoryProps.name === undefined)\r\n return { errorMessage: `No name was supplied within props.` };\r\n\r\n const newPropCategory = (await schema.createPropertyCategory(propertyCategoryProps.name)) as MutablePropertyCategory;\r\n if (newPropCategory === undefined)\r\n return { errorMessage: `Failed to create class ${propertyCategoryProps.name} in schema ${schemaKey.toString(true)}.` };\r\n\r\n await newPropCategory.fromJSON(propertyCategoryProps);\r\n return { itemKey: newPropCategory.key };\r\n }\r\n\r\n public async setPriority(propCategoryKey: SchemaItemKey, priority: number): Promise<void> {\r\n const propertyCategory = (await this._schemaEditor.schemaContext.getSchemaItem<MutablePropertyCategory>(propCategoryKey));\r\n\r\n if (propertyCategory === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Property Category ${propCategoryKey.fullName} not found in schema context.`);\r\n\r\n if (propertyCategory.schemaItemType !== SchemaItemType.PropertyCategory)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${propCategoryKey.fullName} to be of type Property Category.`);\r\n\r\n propertyCategory.setPriority(priority);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"PropertyCategories.js","sourceRoot":"","sources":["../../../src/Editing/PropertyCategories.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA4I;AAI5I;;;GAGG;AACH,MAAa,kBAAkB;IAC7B,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAC7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AC;QACtD,OAAO,EAAE,OAAO,EAAE,eAAe,CAAC,GAAG,EAAE,CAAC;IAC1C,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,eAA8B,EAAE,QAAgB;QACvE,MAAM,gBAAgB,GAAG,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,aAAa,CAA0B,eAAe,CAAC,CAAC,CAAC;QAE1H,IAAI,gBAAgB,KAAK,SAAS;YAChC,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,aAAa,EAAE,qBAAqB,eAAe,CAAC,QAAQ,+BAA+B,CAAC,CAAC;QAExI,IAAI,gBAAgB,CAAC,cAAc,KAAK,kCAAc,CAAC,gBAAgB;YACrE,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,qBAAqB,EAAE,YAAY,eAAe,CAAC,QAAQ,mCAAmC,CAAC,CAAC;QAE3I,gBAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;CACF;AA1CD,gDA0CC","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 { ECObjectsError, ECObjectsStatus, PropertyCategoryProps, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\nimport { MutablePropertyCategory } from \"./Mutable/MutablePropertyCategory\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type Property Category.\n */\nexport class PropertyCategories {\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\n public async create(schemaKey: SchemaKey, name: string, priority: number, displayLabel?: string): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n const newPropCategory = (await schema.createPropertyCategory(name)) as MutablePropertyCategory;\n newPropCategory.setPriority(priority);\n if (displayLabel)\n newPropCategory.setDisplayLabel(displayLabel);\n\n return { itemKey: newPropCategory.key };\n }\n\n public async createFromProps(schemaKey: SchemaKey, propertyCategoryProps: PropertyCategoryProps): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n if (propertyCategoryProps.name === undefined)\n return { errorMessage: `No name was supplied within props.` };\n\n const newPropCategory = (await schema.createPropertyCategory(propertyCategoryProps.name)) as MutablePropertyCategory;\n if (newPropCategory === undefined)\n return { errorMessage: `Failed to create class ${propertyCategoryProps.name} in schema ${schemaKey.toString(true)}.` };\n\n await newPropCategory.fromJSON(propertyCategoryProps);\n return { itemKey: newPropCategory.key };\n }\n\n public async setPriority(propCategoryKey: SchemaItemKey, priority: number): Promise<void> {\n const propertyCategory = (await this._schemaEditor.schemaContext.getSchemaItem<MutablePropertyCategory>(propCategoryKey));\n\n if (propertyCategory === undefined)\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Property Category ${propCategoryKey.fullName} not found in schema context.`);\n\n if (propertyCategory.schemaItemType !== SchemaItemType.PropertyCategory)\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaItemType, `Expected ${propCategoryKey.fullName} to be of type Property Category.`);\n\n propertyCategory.setPriority(priority);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipClasses.js","sourceRoot":"","sources":["../../../src/Editing/RelationshipClasses.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAIkC;AAElC,2CAAwC;AAExC,+CAA+C;AAG/C;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,qBAAS;IAChD,YAAmB,aAAkC;QACnD,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,MAAM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,MAAM,GAA0B,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;QAC3D,IAAI,KAAK,EAAE,MAAM,UAAU,IAAI,WAAW,EAAE;YAC1C,MAAM,CAAC,YAAY,IAAI,GAAG,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,WAAW,MAAM,CAAC;SAC5E;QAED,IAAI,MAAM,CAAC,YAAY,EAAE;YACvB,IAAI,CAAC,qBAAqB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;YACxD,OAAO,MAAM,CAAC;SACf;QAED,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,iBAAiB,CAAC,GAAG,EAAE,CAAC;IACvD,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,wBAAoE;QACzF,IAAI,WAAmI,CAAC;QAExI,IAAI,wBAAwB,YAAY,qCAAiB,EAAE;YACzD,WAAW,GAAG,KAAK,CAAC,oBAAoB,CAAC,wBAAwB,CAAC,CAAC;SACpE;aAAM;YACL,WAAW,GAAG,KAAK,CAAC,8BAA8B,CAAC,wBAAwB,CAAC,CAAC;SAC9E;QAED,MAAM,aAAa,GAAG,EAAE,CAAC;QACzB,IAAI,KAAK,EAAE,MAAM,UAAU,IAAI,WAAW,EAAE;YAC1C,aAAa,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;SACrE;QAED,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,OAAO,EAAE,YAAY,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;SACrD;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAjPD,kDAiPC","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, DelayedPromiseWithProps, ECClassModifier, EntityClass, LazyLoadedRelationshipConstraintClass, Mixin, NavigationPropertyProps,\r\n RelationshipClass, RelationshipClassProps, RelationshipConstraint, RelationshipEnd, RelationshipMultiplicity, SchemaItemKey, SchemaItemType,\r\n SchemaKey, StrengthDirection, StrengthType,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { PropertyEditResults, SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableRelationshipClass, MutableRelationshipConstraint } from \"./Mutable/MutableRelationshipClass\";\r\nimport * as Rules from \"../Validation/ECRules\";\r\nimport { RelationshipConstraintDiagnostic, SchemaItemDiagnostic } from \"../Validation/Diagnostic\";\r\n\r\n/**\r\n * @alpha\r\n * A class extending ECClasses allowing you to create schema items of type RelationshipClass.\r\n */\r\nexport class RelationshipClasses extends ECClasses {\r\n public constructor(_schemaEditor: SchemaContextEditor) {\r\n super(_schemaEditor);\r\n }\r\n\r\n /**\r\n * Creates a RelationshipClass.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param name The name of the new class.\r\n * @param modifier The ECClassModifier of the new class.\r\n * @param strength The relationship StrengthType of the class.\r\n * @param StrengthDirection The relationship StrengthDirection of the class.\r\n * @param baseClassKey An optional SchemaItemKey that specifies the base relationship class.\r\n */\r\n public async create(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, strength: StrengthType, direction: StrengthDirection, baseClassKey?: SchemaItemKey): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined) {\r\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n }\r\n\r\n const newClass = (await schema.createRelationshipClass(name, modifier)) as MutableRelationshipClass;\r\n if (baseClassKey !== undefined) {\r\n const baseClassSchema = !baseClassKey.schemaKey.matches(schema.schemaKey) ? await this._schemaEditor.getSchema(baseClassKey.schemaKey) : schema;\r\n if (baseClassSchema === undefined) {\r\n return { errorMessage: `Schema Key ${baseClassKey.schemaKey.toString(true)} not found in context` };\r\n }\r\n\r\n const baseClassItem = await baseClassSchema.lookupItem<RelationshipClass>(baseClassKey);\r\n if (baseClassItem === undefined)\r\n return { errorMessage: `Unable to locate base class ${baseClassKey.fullName} in schema ${baseClassSchema.fullName}.` };\r\n\r\n if (baseClassItem.schemaItemType !== SchemaItemType.RelationshipClass)\r\n return { errorMessage: `${baseClassItem.fullName} is not of type Relationship Class.` };\r\n\r\n newClass.baseClass = new DelayedPromiseWithProps<SchemaItemKey, RelationshipClass>(baseClassKey, async () => baseClassItem);\r\n }\r\n\r\n newClass.setStrength(strength);\r\n newClass.setStrengthDirection(direction);\r\n\r\n return { itemKey: newClass.key };\r\n }\r\n\r\n /**\r\n * Sets the source RelationshipConstraint on the relationship.\r\n * @param relationshipKey The SchemaItemKey for the relationship.\r\n * @param source The RelationshipConstraint to add.\r\n * @returns A promise of type SchemaItemEditResults.\r\n */\r\n public async setSourceConstraint(relationshipKey: SchemaItemKey, source: RelationshipConstraint): Promise<SchemaItemEditResults> {\r\n const relationship = (await this._schemaEditor.schemaContext.getSchemaItem<MutableRelationshipClass>(relationshipKey));\r\n\r\n if (relationship === undefined)\r\n return { itemKey: relationshipKey, errorMessage: `Relationship Class ${relationshipKey.fullName} not found in schema context.` };\r\n\r\n relationship.setSourceConstraint(source);\r\n return { itemKey: relationshipKey };\r\n }\r\n\r\n /**\r\n * Sets the target RelationshipConstraint on the relationship.\r\n * @param relationshipKey The SchemaItemKey for the relationship.\r\n * @param target The RelationshipConstraint to add.\r\n * @returns A promise of type SchemaItemEditResults.\r\n */\r\n public async setTargetConstraint(relationshipKey: SchemaItemKey, target: RelationshipConstraint): Promise<SchemaItemEditResults> {\r\n const relationship = (await this._schemaEditor.schemaContext.getSchemaItem<MutableRelationshipClass>(relationshipKey));\r\n\r\n if (relationship === undefined)\r\n return { itemKey: relationshipKey, errorMessage: `Relationship Class ${relationshipKey.fullName} not found in schema context.` };\r\n\r\n relationship.setTargetConstraint(target);\r\n return { itemKey: relationshipKey };\r\n }\r\n\r\n /**\r\n * Creates a RelationshipClass through a RelationshipClassProps.\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, relationshipProps: RelationshipClassProps): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n if (relationshipProps.name === undefined)\r\n return { errorMessage: `No name was supplied within props.` };\r\n\r\n const newClass = (await schema.createRelationshipClass(relationshipProps.name)) as MutableRelationshipClass;\r\n await newClass.fromJSON(relationshipProps);\r\n await newClass.source.fromJSON(relationshipProps.source);\r\n await newClass.target.fromJSON(relationshipProps.target);\r\n\r\n return { itemKey: newClass.key };\r\n }\r\n\r\n public async createNavigationProperty(relationshipKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<PropertyEditResults> {\r\n const relationshipClass = (await this._schemaEditor.schemaContext.getSchemaItem<MutableRelationshipClass>(relationshipKey));\r\n\r\n if (relationshipClass === undefined)\r\n return { itemKey: relationshipKey, propertyName: name, errorMessage: `Relationship Class ${relationshipKey.fullName} not found in schema context.` };\r\n\r\n if (relationshipClass.schemaItemType !== SchemaItemType.RelationshipClass)\r\n return { itemKey: relationshipKey, propertyName: name, errorMessage: `Expected ${relationshipKey.fullName} to be of type Relationship Class.` };\r\n\r\n await relationshipClass.createNavigationProperty(name, relationship, direction);\r\n return { itemKey: relationshipKey, propertyName: name };\r\n }\r\n\r\n /**\r\n * Creates a Navigation Property through a NavigationPropertyProps.\r\n * @param classKey a SchemaItemKey of the Relationship Class that will house the new property.\r\n * @param navigationProps a json object that will be used to populate the new Navigation Property.\r\n */\r\n public async createNavigationPropertyFromProps(relationshipKey: SchemaItemKey, navigationProps: NavigationPropertyProps): Promise<PropertyEditResults> {\r\n const relationshipClass = await this._schemaEditor.schemaContext.getSchemaItem<MutableRelationshipClass>(relationshipKey);\r\n\r\n if (relationshipClass === undefined)\r\n return { itemKey: relationshipKey, propertyName: navigationProps.name, errorMessage: `Relationship Class ${relationshipKey.fullName} not found in schema context.` };\r\n\r\n if (relationshipClass.schemaItemType !== SchemaItemType.RelationshipClass)\r\n return { itemKey: relationshipKey, propertyName: navigationProps.name, errorMessage: `Expected ${relationshipKey.fullName} to be of type Relationship Class.` };\r\n\r\n const property = await relationshipClass.createNavigationProperty(navigationProps.name, navigationProps.relationshipName, navigationProps.direction);\r\n await property.fromJSON(navigationProps);\r\n return { itemKey: relationshipKey, propertyName: navigationProps.name };\r\n }\r\n\r\n public async setConstraintMultiplicity(constraint: RelationshipConstraint, multiplicity: RelationshipMultiplicity): Promise<SchemaItemEditResults> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.multiplicity = multiplicity;\r\n return { itemKey: constraint.relationshipClass.key };\r\n }\r\n\r\n public async setConstraintPolymorphic(constraint: RelationshipConstraint, polymorphic: boolean): Promise<SchemaItemEditResults> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.polymorphic = polymorphic;\r\n return { itemKey: constraint.relationshipClass.key };\r\n }\r\n\r\n public async setConstraintRelationshipEnd(constraint: RelationshipConstraint, relationshipEnd: RelationshipEnd): Promise<SchemaItemEditResults> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.relationshipEnd = relationshipEnd;\r\n return { itemKey: constraint.relationshipClass.key };\r\n }\r\n\r\n public async setAbstractConstraint(constraint: RelationshipConstraint, abstractConstraint?: EntityClass | Mixin | RelationshipClass): Promise<SchemaItemEditResults> {\r\n const existing: LazyLoadedRelationshipConstraintClass | undefined = constraint.abstractConstraint;\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n\r\n if (undefined === abstractConstraint) {\r\n mutableConstraint.abstractConstraint = undefined;\r\n } else {\r\n mutableConstraint.abstractConstraint = new DelayedPromiseWithProps(abstractConstraint.key, async () => abstractConstraint);\r\n }\r\n\r\n let result = await this.validate(constraint.relationshipClass);\r\n if (result.errorMessage) {\r\n mutableConstraint.abstractConstraint = existing;\r\n return result;\r\n }\r\n\r\n result = await this.validate(constraint);\r\n if (result.errorMessage) {\r\n mutableConstraint.abstractConstraint = existing;\r\n return result;\r\n }\r\n\r\n return { itemKey: constraint.relationshipClass.key };\r\n }\r\n\r\n public async addConstraintClass(constraint: RelationshipConstraint, ecClass: EntityClass | Mixin | RelationshipClass): Promise<SchemaItemEditResults> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.addClass(ecClass);\r\n\r\n let result = await this.validate(constraint.relationshipClass);\r\n if (result.errorMessage) {\r\n mutableConstraint.removeClass(ecClass);\r\n return result;\r\n }\r\n\r\n result = await this.validate(constraint);\r\n if (result.errorMessage) {\r\n mutableConstraint.removeClass(ecClass);\r\n return result;\r\n }\r\n\r\n return { itemKey: constraint.relationshipClass.key };\r\n }\r\n\r\n public async removeConstraintClass(constraint: RelationshipConstraint, ecClass: EntityClass | Mixin | RelationshipClass): Promise<SchemaItemEditResults> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.removeClass(ecClass);\r\n\r\n const result = await this.validate(constraint);\r\n if (result.errorMessage) {\r\n mutableConstraint.addClass(ecClass);\r\n return result;\r\n }\r\n\r\n return { itemKey: constraint.relationshipClass.key };\r\n }\r\n\r\n public async addCustomAttributeToConstraint(constraint: RelationshipConstraint, customAttribute: CustomAttribute): Promise<SchemaItemEditResults> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.addCustomAttribute(customAttribute);\r\n\r\n const diagnostics = Rules.validateCustomAttributeInstance(constraint, customAttribute);\r\n const result: SchemaItemEditResults = { errorMessage: \"\" };\r\n for await (const diagnostic of diagnostics) {\r\n result.errorMessage += `${diagnostic.code}: ${diagnostic.messageText}\\r\\n`;\r\n }\r\n\r\n if (result.errorMessage) {\r\n this.removeCustomAttribute(constraint, customAttribute);\r\n return result;\r\n }\r\n\r\n return { itemKey: constraint.relationshipClass.key };\r\n }\r\n\r\n private async validate(relationshipOrConstraint: RelationshipClass | RelationshipConstraint): Promise<SchemaItemEditResults> {\r\n let diagnostics: AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> | AsyncIterable<RelationshipConstraintDiagnostic<any[]>>;\r\n\r\n if (relationshipOrConstraint instanceof RelationshipClass) {\r\n diagnostics = Rules.validateRelationship(relationshipOrConstraint);\r\n } else {\r\n diagnostics = Rules.validateRelationshipConstraint(relationshipOrConstraint);\r\n }\r\n\r\n const errorMessages = [];\r\n for await (const diagnostic of diagnostics) {\r\n errorMessages.push(`${diagnostic.code}: ${diagnostic.messageText}`);\r\n }\r\n\r\n if (errorMessages.length > 0) {\r\n return { errorMessage: errorMessages.join(\"\\r\\n\") };\r\n }\r\n\r\n return {};\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"RelationshipClasses.js","sourceRoot":"","sources":["../../../src/Editing/RelationshipClasses.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAIkC;AAElC,2CAAwC;AAExC,+CAA+C;AAG/C;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,qBAAS;IAChD,YAAmB,aAAkC;QACnD,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,QAAyB,EAAE,QAAsB,EAAE,SAA4B,EAAE,YAA4B;QACnK,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,OAAO,EAAE,YAAY,EAAE,cAAc,S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;YACvB,IAAI,CAAC,qBAAqB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;YACxD,OAAO,MAAM,CAAC;SACf;QAED,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,iBAAiB,CAAC,GAAG,EAAE,CAAC;IACvD,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,wBAAoE;QACzF,IAAI,WAAmI,CAAC;QAExI,IAAI,wBAAwB,YAAY,qCAAiB,EAAE;YACzD,WAAW,GAAG,KAAK,CAAC,oBAAoB,CAAC,wBAAwB,CAAC,CAAC;SACpE;aAAM;YACL,WAAW,GAAG,KAAK,CAAC,8BAA8B,CAAC,wBAAwB,CAAC,CAAC;SAC9E;QAED,MAAM,aAAa,GAAG,EAAE,CAAC;QACzB,IAAI,KAAK,EAAE,MAAM,UAAU,IAAI,WAAW,EAAE;YAC1C,aAAa,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;SACrE;QAED,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,OAAO,EAAE,YAAY,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;SACrD;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAjPD,kDAiPC","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, DelayedPromiseWithProps, ECClassModifier, EntityClass, LazyLoadedRelationshipConstraintClass, Mixin, NavigationPropertyProps,\n RelationshipClass, RelationshipClassProps, RelationshipConstraint, RelationshipEnd, RelationshipMultiplicity, SchemaItemKey, SchemaItemType,\n SchemaKey, StrengthDirection, StrengthType,\n} from \"@itwin/ecschema-metadata\";\nimport { PropertyEditResults, SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\nimport { ECClasses } from \"./ECClasses\";\nimport { MutableRelationshipClass, MutableRelationshipConstraint } from \"./Mutable/MutableRelationshipClass\";\nimport * as Rules from \"../Validation/ECRules\";\nimport { RelationshipConstraintDiagnostic, SchemaItemDiagnostic } from \"../Validation/Diagnostic\";\n\n/**\n * @alpha\n * A class extending ECClasses allowing you to create schema items of type RelationshipClass.\n */\nexport class RelationshipClasses extends ECClasses {\n public constructor(_schemaEditor: SchemaContextEditor) {\n super(_schemaEditor);\n }\n\n /**\n * Creates a RelationshipClass.\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\n * @param name The name of the new class.\n * @param modifier The ECClassModifier of the new class.\n * @param strength The relationship StrengthType of the class.\n * @param StrengthDirection The relationship StrengthDirection of the class.\n * @param baseClassKey An optional SchemaItemKey that specifies the base relationship class.\n */\n public async create(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, strength: StrengthType, direction: StrengthDirection, baseClassKey?: SchemaItemKey): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined) {\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n }\n\n const newClass = (await schema.createRelationshipClass(name, modifier)) as MutableRelationshipClass;\n if (baseClassKey !== undefined) {\n const baseClassSchema = !baseClassKey.schemaKey.matches(schema.schemaKey) ? await this._schemaEditor.getSchema(baseClassKey.schemaKey) : schema;\n if (baseClassSchema === undefined) {\n return { errorMessage: `Schema Key ${baseClassKey.schemaKey.toString(true)} not found in context` };\n }\n\n const baseClassItem = await baseClassSchema.lookupItem<RelationshipClass>(baseClassKey);\n if (baseClassItem === undefined)\n return { errorMessage: `Unable to locate base class ${baseClassKey.fullName} in schema ${baseClassSchema.fullName}.` };\n\n if (baseClassItem.schemaItemType !== SchemaItemType.RelationshipClass)\n return { errorMessage: `${baseClassItem.fullName} is not of type Relationship Class.` };\n\n newClass.baseClass = new DelayedPromiseWithProps<SchemaItemKey, RelationshipClass>(baseClassKey, async () => baseClassItem);\n }\n\n newClass.setStrength(strength);\n newClass.setStrengthDirection(direction);\n\n return { itemKey: newClass.key };\n }\n\n /**\n * Sets the source RelationshipConstraint on the relationship.\n * @param relationshipKey The SchemaItemKey for the relationship.\n * @param source The RelationshipConstraint to add.\n * @returns A promise of type SchemaItemEditResults.\n */\n public async setSourceConstraint(relationshipKey: SchemaItemKey, source: RelationshipConstraint): Promise<SchemaItemEditResults> {\n const relationship = (await this._schemaEditor.schemaContext.getSchemaItem<MutableRelationshipClass>(relationshipKey));\n\n if (relationship === undefined)\n return { itemKey: relationshipKey, errorMessage: `Relationship Class ${relationshipKey.fullName} not found in schema context.` };\n\n relationship.setSourceConstraint(source);\n return { itemKey: relationshipKey };\n }\n\n /**\n * Sets the target RelationshipConstraint on the relationship.\n * @param relationshipKey The SchemaItemKey for the relationship.\n * @param target The RelationshipConstraint to add.\n * @returns A promise of type SchemaItemEditResults.\n */\n public async setTargetConstraint(relationshipKey: SchemaItemKey, target: RelationshipConstraint): Promise<SchemaItemEditResults> {\n const relationship = (await this._schemaEditor.schemaContext.getSchemaItem<MutableRelationshipClass>(relationshipKey));\n\n if (relationship === undefined)\n return { itemKey: relationshipKey, errorMessage: `Relationship Class ${relationshipKey.fullName} not found in schema context.` };\n\n relationship.setTargetConstraint(target);\n return { itemKey: relationshipKey };\n }\n\n /**\n * Creates a RelationshipClass through a RelationshipClassProps.\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, relationshipProps: RelationshipClassProps): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n if (relationshipProps.name === undefined)\n return { errorMessage: `No name was supplied within props.` };\n\n const newClass = (await schema.createRelationshipClass(relationshipProps.name)) as MutableRelationshipClass;\n await newClass.fromJSON(relationshipProps);\n await newClass.source.fromJSON(relationshipProps.source);\n await newClass.target.fromJSON(relationshipProps.target);\n\n return { itemKey: newClass.key };\n }\n\n public async createNavigationProperty(relationshipKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<PropertyEditResults> {\n const relationshipClass = (await this._schemaEditor.schemaContext.getSchemaItem<MutableRelationshipClass>(relationshipKey));\n\n if (relationshipClass === undefined)\n return { itemKey: relationshipKey, propertyName: name, errorMessage: `Relationship Class ${relationshipKey.fullName} not found in schema context.` };\n\n if (relationshipClass.schemaItemType !== SchemaItemType.RelationshipClass)\n return { itemKey: relationshipKey, propertyName: name, errorMessage: `Expected ${relationshipKey.fullName} to be of type Relationship Class.` };\n\n await relationshipClass.createNavigationProperty(name, relationship, direction);\n return { itemKey: relationshipKey, propertyName: name };\n }\n\n /**\n * Creates a Navigation Property through a NavigationPropertyProps.\n * @param classKey a SchemaItemKey of the Relationship Class that will house the new property.\n * @param navigationProps a json object that will be used to populate the new Navigation Property.\n */\n public async createNavigationPropertyFromProps(relationshipKey: SchemaItemKey, navigationProps: NavigationPropertyProps): Promise<PropertyEditResults> {\n const relationshipClass = await this._schemaEditor.schemaContext.getSchemaItem<MutableRelationshipClass>(relationshipKey);\n\n if (relationshipClass === undefined)\n return { itemKey: relationshipKey, propertyName: navigationProps.name, errorMessage: `Relationship Class ${relationshipKey.fullName} not found in schema context.` };\n\n if (relationshipClass.schemaItemType !== SchemaItemType.RelationshipClass)\n return { itemKey: relationshipKey, propertyName: navigationProps.name, errorMessage: `Expected ${relationshipKey.fullName} to be of type Relationship Class.` };\n\n const property = await relationshipClass.createNavigationProperty(navigationProps.name, navigationProps.relationshipName, navigationProps.direction);\n await property.fromJSON(navigationProps);\n return { itemKey: relationshipKey, propertyName: navigationProps.name };\n }\n\n public async setConstraintMultiplicity(constraint: RelationshipConstraint, multiplicity: RelationshipMultiplicity): Promise<SchemaItemEditResults> {\n const mutableConstraint = constraint as MutableRelationshipConstraint;\n mutableConstraint.multiplicity = multiplicity;\n return { itemKey: constraint.relationshipClass.key };\n }\n\n public async setConstraintPolymorphic(constraint: RelationshipConstraint, polymorphic: boolean): Promise<SchemaItemEditResults> {\n const mutableConstraint = constraint as MutableRelationshipConstraint;\n mutableConstraint.polymorphic = polymorphic;\n return { itemKey: constraint.relationshipClass.key };\n }\n\n public async setConstraintRelationshipEnd(constraint: RelationshipConstraint, relationshipEnd: RelationshipEnd): Promise<SchemaItemEditResults> {\n const mutableConstraint = constraint as MutableRelationshipConstraint;\n mutableConstraint.relationshipEnd = relationshipEnd;\n return { itemKey: constraint.relationshipClass.key };\n }\n\n public async setAbstractConstraint(constraint: RelationshipConstraint, abstractConstraint?: EntityClass | Mixin | RelationshipClass): Promise<SchemaItemEditResults> {\n const existing: LazyLoadedRelationshipConstraintClass | undefined = constraint.abstractConstraint;\n const mutableConstraint = constraint as MutableRelationshipConstraint;\n\n if (undefined === abstractConstraint) {\n mutableConstraint.abstractConstraint = undefined;\n } else {\n mutableConstraint.abstractConstraint = new DelayedPromiseWithProps(abstractConstraint.key, async () => abstractConstraint);\n }\n\n let result = await this.validate(constraint.relationshipClass);\n if (result.errorMessage) {\n mutableConstraint.abstractConstraint = existing;\n return result;\n }\n\n result = await this.validate(constraint);\n if (result.errorMessage) {\n mutableConstraint.abstractConstraint = existing;\n return result;\n }\n\n return { itemKey: constraint.relationshipClass.key };\n }\n\n public async addConstraintClass(constraint: RelationshipConstraint, ecClass: EntityClass | Mixin | RelationshipClass): Promise<SchemaItemEditResults> {\n const mutableConstraint = constraint as MutableRelationshipConstraint;\n mutableConstraint.addClass(ecClass);\n\n let result = await this.validate(constraint.relationshipClass);\n if (result.errorMessage) {\n mutableConstraint.removeClass(ecClass);\n return result;\n }\n\n result = await this.validate(constraint);\n if (result.errorMessage) {\n mutableConstraint.removeClass(ecClass);\n return result;\n }\n\n return { itemKey: constraint.relationshipClass.key };\n }\n\n public async removeConstraintClass(constraint: RelationshipConstraint, ecClass: EntityClass | Mixin | RelationshipClass): Promise<SchemaItemEditResults> {\n const mutableConstraint = constraint as MutableRelationshipConstraint;\n mutableConstraint.removeClass(ecClass);\n\n const result = await this.validate(constraint);\n if (result.errorMessage) {\n mutableConstraint.addClass(ecClass);\n return result;\n }\n\n return { itemKey: constraint.relationshipClass.key };\n }\n\n public async addCustomAttributeToConstraint(constraint: RelationshipConstraint, customAttribute: CustomAttribute): Promise<SchemaItemEditResults> {\n const mutableConstraint = constraint as MutableRelationshipConstraint;\n mutableConstraint.addCustomAttribute(customAttribute);\n\n const diagnostics = Rules.validateCustomAttributeInstance(constraint, customAttribute);\n const result: SchemaItemEditResults = { errorMessage: \"\" };\n for await (const diagnostic of diagnostics) {\n result.errorMessage += `${diagnostic.code}: ${diagnostic.messageText}\\r\\n`;\n }\n\n if (result.errorMessage) {\n this.removeCustomAttribute(constraint, customAttribute);\n return result;\n }\n\n return { itemKey: constraint.relationshipClass.key };\n }\n\n private async validate(relationshipOrConstraint: RelationshipClass | RelationshipConstraint): Promise<SchemaItemEditResults> {\n let diagnostics: AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> | AsyncIterable<RelationshipConstraintDiagnostic<any[]>>;\n\n if (relationshipOrConstraint instanceof RelationshipClass) {\n diagnostics = Rules.validateRelationship(relationshipOrConstraint);\n } else {\n diagnostics = Rules.validateRelationshipConstraint(relationshipOrConstraint);\n }\n\n const errorMessages = [];\n for await (const diagnostic of diagnostics) {\n errorMessages.push(`${diagnostic.code}: ${diagnostic.messageText}`);\n }\n\n if (errorMessages.length > 0) {\n return { errorMessage: errorMessages.join(\"\\r\\n\") };\n }\n\n return {};\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaItems.js","sourceRoot":"","sources":["../../../src/Editing/SchemaItems.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA2G;AAG3G;;;GAGG;AACH,MAAa,WAAW;IACtB,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAC7D,KAAK,CAAC,UAAU,CAAC,aAA4B,EAAE,cAA+B;QACnF,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QAEvF,IAAI,UAAU,KAAK,SAAS;YAC1B,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,aAAa,EAAE,eAAe,aAAa,CAAC,QAAQ,+BAA+B,CAAC,CAAC;QAEhI,MAAM,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IAC5C,CAAC;CACF;AAVD,kCAUC","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 { ECObjectsError, ECObjectsStatus, SchemaItemKey, SchemaItemProps } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\n\r\n/**\r\n * @internal\r\n * A class allowing you to edit the schema item base class.\r\n */\r\nexport class SchemaItems {\r\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\r\n public async applyProps(schemaItemKey: SchemaItemKey, schemItemProps: SchemaItemProps): Promise<void> {\r\n const schemaItem = await this._schemaEditor.schemaContext.getSchemaItem(schemaItemKey);\r\n\r\n if (schemaItem === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Schema Item ${schemaItemKey.fullName} not found in schema context.`);\r\n\r\n await schemaItem.fromJSON(schemItemProps);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SchemaItems.js","sourceRoot":"","sources":["../../../src/Editing/SchemaItems.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA2G;AAG3G;;;GAGG;AACH,MAAa,WAAW;IACtB,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAC7D,KAAK,CAAC,UAAU,CAAC,aAA4B,EAAE,cAA+B;QACnF,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QAEvF,IAAI,UAAU,KAAK,SAAS;YAC1B,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,aAAa,EAAE,eAAe,aAAa,CAAC,QAAQ,+BAA+B,CAAC,CAAC;QAEhI,MAAM,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IAC5C,CAAC;CACF;AAVD,kCAUC","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 { ECObjectsError, ECObjectsStatus, SchemaItemKey, SchemaItemProps } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor } from \"./Editor\";\n\n/**\n * @internal\n * A class allowing you to edit the schema item base class.\n */\nexport class SchemaItems {\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\n public async applyProps(schemaItemKey: SchemaItemKey, schemItemProps: SchemaItemProps): Promise<void> {\n const schemaItem = await this._schemaEditor.schemaContext.getSchemaItem(schemaItemKey);\n\n if (schemaItem === undefined)\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `Schema Item ${schemaItemKey.fullName} not found in schema context.`);\n\n await schemaItem.fromJSON(schemItemProps);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Structs.js","sourceRoot":"","sources":["../../../src/Editing/Structs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAqJ;AAErJ,2CAAwC;AAGxC;;GAEG;AACH,MAAa,OAAQ,SAAQ,qBAAS;IACpC,YAAmB,aAAk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e,CAAC,SAAoB,EAAE,WAA6B;QAC9E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEzF,IAAI,WAAW,CAAC,IAAI,KAAK,SAAS;YAChC,OAAO,EAAE,YAAY,EAAE,oCAAoC,EAAE,CAAC;QAEhE,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAiB,CAAC;QACpF,IAAI,QAAQ,KAAK,SAAS;YACxB,OAAO,EAAE,YAAY,EAAE,0BAA0B,WAAW,CAAC,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAE/G,MAAM,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACrC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;IACnC,CAAC;CACF;AAnDD,0BAmDC","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 { DelayedPromiseWithProps, ECClass, SchemaItemKey, SchemaItemType, SchemaKey, StructClass, StructClassProps } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableClass, MutableStructClass } from \"./Mutable/MutableClass\";\r\n\r\n/**\r\n * @alpha A class extending ECClasses allowing you to create schema items of type StructClass.\r\n */\r\nexport class Structs extends ECClasses {\r\n public constructor(_schemaEditor: SchemaContextEditor) {\r\n super(_schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, displayLabel?: string, baseClass?: SchemaItemKey): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n const newClass = (await schema.createStructClass(name)) as MutableStructClass;\r\n if (newClass === undefined)\r\n return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };\r\n\r\n if (baseClass !== undefined) {\r\n const baseClassItem = await schema.lookupItem<StructClass>(baseClass);\r\n if (baseClassItem === undefined)\r\n return { errorMessage: `Unable to locate base class ${baseClass.fullName} in schema ${schema.fullName}.` };\r\n\r\n if (baseClassItem.schemaItemType !== SchemaItemType.StructClass)\r\n return { errorMessage: `${baseClassItem.fullName} is not of type Struct Class.` };\r\n\r\n newClass.baseClass = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(baseClass, async () => baseClassItem);\r\n }\r\n\r\n if (displayLabel)\r\n newClass.setDisplayLabel(displayLabel);\r\n\r\n return { itemKey: newClass.key };\r\n }\r\n\r\n /**\r\n * Creates a StructClass through a StructClassProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param structProps a json object that will be used to populate the new StructClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, structProps: StructClassProps): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n if (structProps.name === undefined)\r\n return { errorMessage: `No name was supplied within props.` };\r\n\r\n const newClass = (await schema.createStructClass(structProps.name)) as MutableClass;\r\n if (newClass === undefined)\r\n return { errorMessage: `Failed to create class ${structProps.name} in schema ${schemaKey.toString(true)}.` };\r\n\r\n await newClass.fromJSON(structProps);\r\n return { itemKey: newClass.key };\r\n }\r\n}\r\n"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E,CAAC,aAAa,CAAC,CAAC;SAChH;QAED,IAAI,YAAY;YACd,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QAEzC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,WAA6B;QAC9E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEzF,IAAI,WAAW,CAAC,IAAI,KAAK,SAAS;YAChC,OAAO,EAAE,YAAY,EAAE,oCAAoC,EAAE,CAAC;QAEhE,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAiB,CAAC;QACpF,IAAI,QAAQ,KAAK,SAAS;YACxB,OAAO,EAAE,YAAY,EAAE,0BAA0B,WAAW,CAAC,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAE/G,MAAM,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACrC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;IACnC,CAAC;CACF;AAnDD,0BAmDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { DelayedPromiseWithProps, ECClass, SchemaItemKey, SchemaItemType, SchemaKey, StructClass, StructClassProps } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\nimport { ECClasses } from \"./ECClasses\";\nimport { MutableClass, MutableStructClass } from \"./Mutable/MutableClass\";\n\n/**\n * @alpha A class extending ECClasses allowing you to create schema items of type StructClass.\n */\nexport class Structs extends ECClasses {\n public constructor(_schemaEditor: SchemaContextEditor) {\n super(_schemaEditor);\n }\n\n public async create(schemaKey: SchemaKey, name: string, displayLabel?: string, baseClass?: SchemaItemKey): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n const newClass = (await schema.createStructClass(name)) as MutableStructClass;\n if (newClass === undefined)\n return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };\n\n if (baseClass !== undefined) {\n const baseClassItem = await schema.lookupItem<StructClass>(baseClass);\n if (baseClassItem === undefined)\n return { errorMessage: `Unable to locate base class ${baseClass.fullName} in schema ${schema.fullName}.` };\n\n if (baseClassItem.schemaItemType !== SchemaItemType.StructClass)\n return { errorMessage: `${baseClassItem.fullName} is not of type Struct Class.` };\n\n newClass.baseClass = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(baseClass, async () => baseClassItem);\n }\n\n if (displayLabel)\n newClass.setDisplayLabel(displayLabel);\n\n return { itemKey: newClass.key };\n }\n\n /**\n * Creates a StructClass through a StructClassProps.\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\n * @param structProps a json object that will be used to populate the new StructClass. Needs a name value passed in.\n */\n public async createFromProps(schemaKey: SchemaKey, structProps: StructClassProps): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n if (structProps.name === undefined)\n return { errorMessage: `No name was supplied within props.` };\n\n const newClass = (await schema.createStructClass(structProps.name)) as MutableClass;\n if (newClass === undefined)\n return { errorMessage: `Failed to create class ${structProps.name} in schema ${schemaKey.toString(true)}.` };\n\n await newClass.fromJSON(structProps);\n return { itemKey: newClass.key };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"UnitSystems.js","sourceRoot":"","sources":["../../../src/Editing/UnitSystems.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAMH;;;GAGG;AACH,MAAa,WAAW;IACtB,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAC7D,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,YAAqB;QAC3E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEzF,MAAM,aAAa,GAAG,CAAC,MAAM,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAsB,CAAC;QACjF,IAAI,YAAY;YACd,aAAa,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QAE9C,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;IACxC,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,eAAgC;QACjF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEzF,IAAI,eAAe,CAAC,IAAI,KAAK,SAAS;YACpC,OAAO,EAAE,YAAY,EAAE,oCAAoC,EAAE,CAAC;QAEhE,MAAM,aAAa,GAAG,CAAC,MAAM,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAsB,CAAC;QACjG,IAAI,aAAa,KAAK,SAAS;YAC7B,OAAO,EAAE,YAAY,EAAE,0BAA0B,eAAe,CAAC,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAEnH,MAAM,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC9C,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;IACxC,CAAC;CACF;AA7BD,kCA6BC","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 { SchemaKey, UnitSystemProps } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\r\nimport { MutableUnitSystem } from \"./Mutable/MutableUnitSystem\";\r\n\r\n/**\r\n * @alpha\r\n * A class allowing you to create schema items of type UnitSystems.\r\n */\r\nexport class UnitSystems {\r\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\r\n public async create(schemaKey: SchemaKey, name: string, displayLabel?: string): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n const newUnitSystem = (await schema.createUnitSystem(name)) as MutableUnitSystem;\r\n if (displayLabel)\r\n newUnitSystem.setDisplayLabel(displayLabel);\r\n\r\n return { itemKey: newUnitSystem.key };\r\n }\r\n\r\n public async createFromProps(schemaKey: SchemaKey, unitSystemProps: UnitSystemProps): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n if (unitSystemProps.name === undefined)\r\n return { errorMessage: `No name was supplied within props.` };\r\n\r\n const newUnitSystem = (await schema.createUnitSystem(unitSystemProps.name)) as MutableUnitSystem;\r\n if (newUnitSystem === undefined)\r\n return { errorMessage: `Failed to create class ${unitSystemProps.name} in schema ${schemaKey.toString(true)}.` };\r\n\r\n await newUnitSystem.fromJSON(unitSystemProps);\r\n return { itemKey: newUnitSystem.key };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"UnitSystems.js","sourceRoot":"","sources":["../../../src/Editing/UnitSystems.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAMH;;;GAGG;AACH,MAAa,WAAW;IACtB,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAC7D,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,YAAqB;QAC3E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEzF,MAAM,aAAa,GAAG,CAAC,MAAM,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAsB,CAAC;QACjF,IAAI,YAAY;YACd,aAAa,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QAE9C,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;IACxC,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,eAAgC;QACjF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEzF,IAAI,eAAe,CAAC,IAAI,KAAK,SAAS;YACpC,OAAO,EAAE,YAAY,EAAE,oCAAoC,EAAE,CAAC;QAEhE,MAAM,aAAa,GAAG,CAAC,MAAM,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAsB,CAAC;QACjG,IAAI,aAAa,KAAK,SAAS;YAC7B,OAAO,EAAE,YAAY,EAAE,0BAA0B,eAAe,CAAC,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAEnH,MAAM,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC9C,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,EAAE,CAAC;IACxC,CAAC;CACF;AA7BD,kCA6BC","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 { SchemaKey, UnitSystemProps } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\nimport { MutableUnitSystem } from \"./Mutable/MutableUnitSystem\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type UnitSystems.\n */\nexport class UnitSystems {\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\n public async create(schemaKey: SchemaKey, name: string, displayLabel?: string): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n const newUnitSystem = (await schema.createUnitSystem(name)) as MutableUnitSystem;\n if (displayLabel)\n newUnitSystem.setDisplayLabel(displayLabel);\n\n return { itemKey: newUnitSystem.key };\n }\n\n public async createFromProps(schemaKey: SchemaKey, unitSystemProps: UnitSystemProps): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n if (unitSystemProps.name === undefined)\n return { errorMessage: `No name was supplied within props.` };\n\n const newUnitSystem = (await schema.createUnitSystem(unitSystemProps.name)) as MutableUnitSystem;\n if (newUnitSystem === undefined)\n return { errorMessage: `Failed to create class ${unitSystemProps.name} in schema ${schemaKey.toString(true)}.` };\n\n await newUnitSystem.fromJSON(unitSystemProps);\n return { itemKey: newUnitSystem.key };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Units.js","sourceRoot":"","sources":["../../../src/Editing/Units.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA0J;AAI1J;;;GAGG;AACH,MAAa,KAAK;IAChB,6CAA6C;IAC7C,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAE7D,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,UAAkB,EAAE,UAAyB,EAAE,UAAyB,EAAE,YAAqB;QACrJ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEzF,MAAM,OAAO,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAgB,CAAC;QAC/D,IAAI,OAAO,KAAK,SAAS;YACvB,OAAO,EAAE,YAAY,EAAE,0BAA0B,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAEnG,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,UAAU,CAAa,UAAU,CAAC,CAAC;QACvE,IAAI,cAAc,KAAK,SAAS;YAC9B,OAAO,EAAE,YAAY,EAAE,+BAA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AEzF,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS;YAC9B,OAAO,EAAE,YAAY,EAAE,oCAAoC,EAAE,CAAC;QAEhE,MAAM,OAAO,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1D,IAAI,OAAO,KAAK,SAAS;YACvB,OAAO,EAAE,YAAY,EAAE,0BAA0B,SAAS,CAAC,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7G,MAAM,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAClC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;IAClC,CAAC;CACF;AAtDD,sBAsDC","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 { DelayedPromiseWithProps, Phenomenon, SchemaItemKey, SchemaItemType, SchemaItemUnitProps, SchemaKey, UnitSystem } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\r\nimport { MutableUnit } from \"./Mutable/MutableUnit\";\r\n\r\n/**\r\n * @alpha\r\n * A class allowing you to create schema items of type Unit.\r\n */\r\nexport class Units {\r\n // TODO: Add more setters for all attributes.\r\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, definition: string, phenomenon: SchemaItemKey, unitSystem: SchemaItemKey, displayLabel?: string): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n const newUnit = (await schema.createUnit(name)) as MutableUnit;\r\n if (newUnit === undefined)\r\n return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };\r\n\r\n const phenomenonItem = await schema.lookupItem<Phenomenon>(phenomenon);\r\n if (phenomenonItem === undefined)\r\n return { errorMessage: `Unable to locate phenomenon ${phenomenon.fullName} in schema ${schema.fullName}.` };\r\n\r\n if (phenomenonItem.schemaItemType !== SchemaItemType.Phenomenon)\r\n return { errorMessage: `${phenomenon.fullName} is not of type Phenomenon.` };\r\n\r\n await newUnit.setPhenomenon(new DelayedPromiseWithProps<SchemaItemKey, Phenomenon>(phenomenon, async () => phenomenonItem));\r\n\r\n const unitSystemItem = await schema.lookupItem<UnitSystem>(unitSystem);\r\n if (unitSystemItem === undefined)\r\n return { errorMessage: `Unable to locate unit system ${unitSystem.fullName} in schema ${schema.fullName}.` };\r\n\r\n if (unitSystemItem.schemaItemType !== SchemaItemType.UnitSystem)\r\n return { errorMessage: `${unitSystem.fullName} is not of type UnitSystem.` };\r\n\r\n await newUnit.setUnitSystem(new DelayedPromiseWithProps<SchemaItemKey, UnitSystem>(unitSystem, async () => unitSystemItem));\r\n\r\n await newUnit.setDefinition(definition);\r\n\r\n if (displayLabel)\r\n newUnit.setDisplayLabel(displayLabel);\r\n\r\n return { itemKey: newUnit.key };\r\n }\r\n\r\n public async createFromProps(schemaKey: SchemaKey, unitProps: SchemaItemUnitProps): Promise<SchemaItemEditResults> {\r\n const schema = await this._schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\r\n\r\n if (unitProps.name === undefined)\r\n return { errorMessage: `No name was supplied within props.` };\r\n\r\n const newUnit = (await schema.createUnit(unitProps.name));\r\n if (newUnit === undefined)\r\n return { errorMessage: `Failed to create class ${unitProps.name} in schema ${schemaKey.toString(true)}.` };\r\n\r\n await newUnit.fromJSON(unitProps);\r\n return { itemKey: newUnit.key };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Units.js","sourceRoot":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,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAClC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;IAClC,CAAC;CACF;AAtDD,sBAsDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { DelayedPromiseWithProps, Phenomenon, SchemaItemKey, SchemaItemType, SchemaItemUnitProps, SchemaKey, UnitSystem } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\nimport { MutableUnit } from \"./Mutable/MutableUnit\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type Unit.\n */\nexport class Units {\n // TODO: Add more setters for all attributes.\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\n\n public async create(schemaKey: SchemaKey, name: string, definition: string, phenomenon: SchemaItemKey, unitSystem: SchemaItemKey, displayLabel?: string): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n const newUnit = (await schema.createUnit(name)) as MutableUnit;\n if (newUnit === undefined)\n return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };\n\n const phenomenonItem = await schema.lookupItem<Phenomenon>(phenomenon);\n if (phenomenonItem === undefined)\n return { errorMessage: `Unable to locate phenomenon ${phenomenon.fullName} in schema ${schema.fullName}.` };\n\n if (phenomenonItem.schemaItemType !== SchemaItemType.Phenomenon)\n return { errorMessage: `${phenomenon.fullName} is not of type Phenomenon.` };\n\n await newUnit.setPhenomenon(new DelayedPromiseWithProps<SchemaItemKey, Phenomenon>(phenomenon, async () => phenomenonItem));\n\n const unitSystemItem = await schema.lookupItem<UnitSystem>(unitSystem);\n if (unitSystemItem === undefined)\n return { errorMessage: `Unable to locate unit system ${unitSystem.fullName} in schema ${schema.fullName}.` };\n\n if (unitSystemItem.schemaItemType !== SchemaItemType.UnitSystem)\n return { errorMessage: `${unitSystem.fullName} is not of type UnitSystem.` };\n\n await newUnit.setUnitSystem(new DelayedPromiseWithProps<SchemaItemKey, UnitSystem>(unitSystem, async () => unitSystemItem));\n\n await newUnit.setDefinition(definition);\n\n if (displayLabel)\n newUnit.setDisplayLabel(displayLabel);\n\n return { itemKey: newUnit.key };\n }\n\n public async createFromProps(schemaKey: SchemaKey, unitProps: SchemaItemUnitProps): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n if (unitProps.name === undefined)\n return { errorMessage: `No name was supplied within props.` };\n\n const newUnit = (await schema.createUnit(unitProps.name));\n if (newUnit === undefined)\n return { errorMessage: `Failed to create class ${unitProps.name} in schema ${schemaKey.toString(true)}.` };\n\n await newUnit.fromJSON(unitProps);\n return { itemKey: newUnit.key };\n }\n}\n"]}
@@ -1,11 +1,8 @@
1
- import { CustomAttributeClass, SchemaKey } from "@itwin/ecschema-metadata";
2
- import { ClassMerger } from "./ClassMerger";
3
- import { SchemaItemEditResults } from "../Editing/Editor";
1
+ import { type CustomAttributeClassDifference } from "../Differencing/SchemaDifference";
2
+ import { type SchemaItemMergerHandler } from "./SchemaItemMerger";
4
3
  /**
4
+ * Defines a merge handler to merge Custom Attribute Class schema items.
5
5
  * @internal
6
6
  */
7
- export default class CAClassMerger extends ClassMerger<CustomAttributeClass> {
8
- protected create(schemaKey: SchemaKey, ecClass: CustomAttributeClass): Promise<SchemaItemEditResults>;
9
- protected mergeAttributes(ecClass: CustomAttributeClass, attributeName: string, attributeNewValue: any, attributeOldValue: any): Promise<SchemaItemEditResults | boolean>;
10
- }
7
+ export declare const customAttributeClassMerger: SchemaItemMergerHandler<CustomAttributeClassDifference>;
11
8
  //# sourceMappingURL=CAClassMerger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CAClassMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/CAClassMerger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAqC,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC9G,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG1D;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW,CAAC,oBAAoB,CAAC;cAEjD,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;cAI3F,eAAe,CAAC,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,EAAE,iBAAiB,EAAE,GAAG,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC;CAezL"}
1
+ {"version":3,"file":"CAClassMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/CAClassMerger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AACvF,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAKlE;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,uBAAuB,CAAC,8BAA8B,CA0B9F,CAAC"}
@@ -1,33 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- /*---------------------------------------------------------------------------------------------
4
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
5
- * See LICENSE.md in the project root for license terms and full copyright notice.
6
- *--------------------------------------------------------------------------------------------*/
3
+ exports.customAttributeClassMerger = void 0;
7
4
  const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
8
5
  const ClassMerger_1 = require("./ClassMerger");
9
6
  /**
7
+ * Defines a merge handler to merge Custom Attribute Class schema items.
10
8
  * @internal
11
9
  */
12
- class CAClassMerger extends ClassMerger_1.ClassMerger {
13
- async create(schemaKey, ecClass) {
14
- return this.context.editor.customAttributes.create(schemaKey, ecClass.name, ecClass.containerType);
15
- }
16
- async mergeAttributes(ecClass, attributeName, attributeNewValue, attributeOldValue) {
17
- const mutableCAClass = ecClass;
18
- switch (attributeName) {
19
- case "appliesTo":
20
- if (attributeOldValue !== undefined && attributeOldValue !== attributeNewValue) {
21
- const containerType = (0, ecschema_metadata_1.parseCustomAttributeContainerType)(`${attributeOldValue}, ${attributeNewValue}`);
22
- if (containerType === undefined) {
23
- return { errorMessage: "An invalid custom attribute class containerType has been provided." };
24
- }
25
- mutableCAClass.setContainerType(containerType);
10
+ exports.customAttributeClassMerger = {
11
+ async add(context, change) {
12
+ if (change.difference.appliesTo === undefined) {
13
+ return { errorMessage: "appliesTo is a required property of a CustomAttributeClass but it is not set" };
14
+ }
15
+ return context.editor.customAttributes.createFromProps(context.targetSchemaKey, {
16
+ ...change.difference,
17
+ name: change.itemName,
18
+ schemaItemType: change.schemaType,
19
+ appliesTo: change.difference.appliesTo,
20
+ });
21
+ },
22
+ async modify(context, change, itemKey, item) {
23
+ if (change.difference.appliesTo !== undefined) {
24
+ const currentValue = (0, ecschema_metadata_1.containerTypeToString)(item.containerType);
25
+ if (currentValue !== "" && change.difference.appliesTo !== currentValue) {
26
+ const containerType = (0, ecschema_metadata_1.parseCustomAttributeContainerType)(`${currentValue}, ${change.difference.appliesTo}`);
27
+ if (containerType === undefined) {
28
+ return { errorMessage: "An invalid custom attribute class containerType has been provided." };
26
29
  }
27
- return true;
30
+ item.setContainerType(containerType);
31
+ }
28
32
  }
29
- return super.mergeAttributes(ecClass, attributeName, attributeNewValue, attributeOldValue);
30
- }
31
- }
32
- exports.default = CAClassMerger;
33
+ return (0, ClassMerger_1.modifyClass)(context, change, itemKey, item);
34
+ },
35
+ };
33
36
  //# sourceMappingURL=CAClassMerger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CAClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/CAClassMerger.ts"],"names":[],"mappings":";;AAAA;;;+FAG+F;AAC/F,gEAA8G;AAC9G,+CAA4C;AAI5C;;GAEG;AACH,MAAqB,aAAc,SAAQ,yBAAiC;IAEvD,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,OAA6B;QACjF,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACrG,CAAC;IAEkB,KAAK,CAAC,eAAe,CAAC,OAA6B,EAAE,aAAqB,EAAE,iBAAsB,EAAE,iBAAsB;QAC3I,MAAM,cAAc,GAAG,OAAoC,CAAC;QAC5D,QAAO,aAAa,EAAE;YACpB,KAAK,WAAW;gBACd,IAAI,iBAAiB,KAAK,SAAS,IAAI,iBAAiB,KAAK,iBAAiB,EAAE;oBAC9E,MAAM,aAAa,GAAG,IAAA,qDAAiC,EAAC,GAAG,iBAAiB,KAAK,iBAAiB,EAAE,CAAC,CAAC;oBACtG,IAAI,aAAa,KAAK,SAAS,EAAE;wBAC/B,OAAO,EAAE,YAAY,EAAE,oEAAoE,EAAC,CAAC;qBAC9F;oBACD,cAAc,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;iBAChD;gBACD,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC,eAAe,CAAC,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;IAC7F,CAAC;CACF;AArBD,gCAqBC","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\nimport { CustomAttributeClass, parseCustomAttributeContainerType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { ClassMerger } from \"./ClassMerger\";\r\nimport { SchemaItemEditResults } from \"../Editing/Editor\";\r\nimport { MutableCAClass } from \"../Editing/Mutable/MutableCAClass\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport default class CAClassMerger extends ClassMerger<CustomAttributeClass> {\r\n\r\n protected override async create(schemaKey: SchemaKey, ecClass: CustomAttributeClass): Promise<SchemaItemEditResults> {\r\n return this.context.editor.customAttributes.create(schemaKey, ecClass.name, ecClass.containerType);\r\n }\r\n\r\n protected override async mergeAttributes(ecClass: CustomAttributeClass, attributeName: string, attributeNewValue: any, attributeOldValue: any): Promise<SchemaItemEditResults | boolean> {\r\n const mutableCAClass = ecClass as unknown as MutableCAClass;\r\n switch(attributeName) {\r\n case \"appliesTo\":\r\n if (attributeOldValue !== undefined && attributeOldValue !== attributeNewValue) {\r\n const containerType = parseCustomAttributeContainerType(`${attributeOldValue}, ${attributeNewValue}`);\r\n if (containerType === undefined) {\r\n return { errorMessage: \"An invalid custom attribute class containerType has been provided.\"};\r\n }\r\n mutableCAClass.setContainerType(containerType);\r\n }\r\n return true;\r\n }\r\n return super.mergeAttributes(ecClass, attributeName, attributeNewValue, attributeOldValue);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"CAClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/CAClassMerger.ts"],"names":[],"mappings":";;;AAOA,gEAAoG;AACpG,+CAA4C;AAE5C;;;GAGG;AACU,QAAA,0BAA0B,GAA4D;IACjG,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM;QACvB,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE;YAC7C,OAAO,EAAE,YAAY,EAAE,8EAA8E,EAAE,CAAC;SACzG;QAED,OAAO,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE;YAC9E,GAAG,MAAM,CAAC,UAAU;YACpB,IAAI,EAAE,MAAM,CAAC,QAAQ;YACrB,cAAc,EAAE,MAAM,CAAC,UAAU;YACjC,SAAS,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS;SACvC,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAoB;QACzD,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE;YAC7C,MAAM,YAAY,GAAG,IAAA,yCAAqB,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC/D,IAAI,YAAY,KAAK,EAAE,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,YAAY,EAAE;gBACvE,MAAM,aAAa,GAAG,IAAA,qDAAiC,EAAC,GAAG,YAAY,KAAK,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBAC3G,IAAI,aAAa,KAAK,SAAS,EAAE;oBAC/B,OAAO,EAAE,YAAY,EAAE,oEAAoE,EAAE,CAAC;iBAC/F;gBACD,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;aACtC;SACF;QACD,OAAO,IAAA,yBAAW,EAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;CACF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { type CustomAttributeClassDifference } from \"../Differencing/SchemaDifference\";\nimport { type SchemaItemMergerHandler } from \"./SchemaItemMerger\";\nimport { type MutableCAClass } from \"../Editing/Mutable/MutableCAClass\";\nimport { containerTypeToString, parseCustomAttributeContainerType } from \"@itwin/ecschema-metadata\";\nimport { modifyClass } from \"./ClassMerger\";\n\n/**\n * Defines a merge handler to merge Custom Attribute Class schema items.\n * @internal\n */\nexport const customAttributeClassMerger: SchemaItemMergerHandler<CustomAttributeClassDifference> = {\n async add(context, change) {\n if (change.difference.appliesTo === undefined) {\n return { errorMessage: \"appliesTo is a required property of a CustomAttributeClass but it is not set\" };\n }\n\n return context.editor.customAttributes.createFromProps(context.targetSchemaKey, {\n ...change.difference,\n name: change.itemName,\n schemaItemType: change.schemaType,\n appliesTo: change.difference.appliesTo,\n });\n },\n async modify(context, change, itemKey, item: MutableCAClass) {\n if (change.difference.appliesTo !== undefined) {\n const currentValue = containerTypeToString(item.containerType);\n if (currentValue !== \"\" && change.difference.appliesTo !== currentValue) {\n const containerType = parseCustomAttributeContainerType(`${currentValue}, ${change.difference.appliesTo}`);\n if (containerType === undefined) {\n return { errorMessage: \"An invalid custom attribute class containerType has been provided.\" };\n }\n item.setContainerType(containerType);\n }\n }\n return modifyClass(context, change, itemKey, item);\n },\n};\n"]}
@@ -1,22 +1,14 @@
1
- import { ECClass, SchemaItemKey, SchemaKey } from "@itwin/ecschema-metadata";
2
- import { SchemaItemEditResults } from "../Editing/Editor";
3
- import { SchemaMergeContext } from "./SchemaMerger";
4
- import { ClassChanges } from "../Validation/SchemaChanges";
1
+ import { type SchemaMergeContext } from "./SchemaMerger";
2
+ import { AnySchemaDifference, ClassItemDifference } from "../Differencing/SchemaDifference";
3
+ import { ECClass, SchemaItemKey } from "@itwin/ecschema-metadata";
4
+ import { SchemaEditResults } from "../Editing/Editor";
5
5
  /**
6
6
  * @internal
7
7
  */
8
- export declare class ClassMerger<TClass extends ECClass> {
9
- protected readonly context: SchemaMergeContext;
10
- constructor(context: SchemaMergeContext);
11
- protected create(_schemaKey: SchemaKey, ecClass: TClass): Promise<SchemaItemEditResults>;
12
- protected merge(itemKey: SchemaItemKey, _change: ClassChanges): Promise<SchemaItemEditResults>;
13
- protected mergeAttributes(ecClass: TClass, attributeName: string, attributeNewValue: any, attributeOldValue: any): Promise<SchemaItemEditResults | boolean>;
14
- protected isSchemaItemEditResults(obj: any): obj is SchemaItemEditResults;
15
- private setBaseClass;
16
- private mergeAttributeValueChanges;
17
- private handleError;
18
- private mergePropertyChanges;
19
- static mergeItemStubChanges(context: SchemaMergeContext, classChanges: Iterable<ClassChanges>): Promise<void>;
20
- static mergeItemContentChanges(context: SchemaMergeContext, classChanges: Iterable<ClassChanges>): Promise<void>;
21
- }
8
+ export declare function mergeClassItems(context: SchemaMergeContext, classChanges: AnySchemaDifference[]): AsyncGenerator<never, void, unknown>;
9
+ /**
10
+ * Shared modify merger of all ECClass based items.
11
+ * @internal
12
+ */
13
+ export declare function modifyClass(context: SchemaMergeContext, change: ClassItemDifference, itemKey: SchemaItemKey, item: ECClass): Promise<SchemaEditResults>;
22
14
  //# sourceMappingURL=ClassMerger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClassMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/ClassMerger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAiD,aAAa,EAA0C,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACpK,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAA8B,YAAY,EAAwC,MAAM,6BAA6B,CAAC;AAI7H;;GAEG;AACH,qBAAa,WAAW,CAAC,MAAM,SAAS,OAAO;IAC7C,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;gBAEnC,OAAO,EAAE,kBAAkB;cAIvB,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;cAI9E,KAAK,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,qBAAqB,CAAC;cAIpF,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,EAAE,iBAAiB,EAAE,GAAG,GAAG,OAAO,CAAC,qBAAqB,G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