@itwin/ecschema-editing 4.7.0-dev.8 → 4.8.0-dev.0

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 (187) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/Differencing/Errors.d.ts +19 -0
  3. package/lib/cjs/Differencing/Errors.d.ts.map +1 -0
  4. package/lib/cjs/Differencing/Errors.js +24 -0
  5. package/lib/cjs/Differencing/Errors.js.map +1 -0
  6. package/lib/cjs/Differencing/SchemaConflicts.d.ts +0 -14
  7. package/lib/cjs/Differencing/SchemaConflicts.d.ts.map +1 -1
  8. package/lib/cjs/Differencing/SchemaConflicts.js +1 -14
  9. package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
  10. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts +4 -4
  11. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
  12. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +31 -31
  13. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
  14. package/lib/cjs/Differencing/SchemaDifference.d.ts +1 -1
  15. package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
  16. package/lib/cjs/Differencing/SchemaDifference.js +6 -6
  17. package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
  18. package/lib/cjs/Editing/Constants.d.ts +6 -6
  19. package/lib/cjs/Editing/Constants.d.ts.map +1 -1
  20. package/lib/cjs/Editing/Constants.js +26 -31
  21. package/lib/cjs/Editing/Constants.js.map +1 -1
  22. package/lib/cjs/Editing/CustomAttributes.d.ts +3 -3
  23. package/lib/cjs/Editing/CustomAttributes.d.ts.map +1 -1
  24. package/lib/cjs/Editing/CustomAttributes.js +18 -28
  25. package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
  26. package/lib/cjs/Editing/ECClasses.d.ts +24 -23
  27. package/lib/cjs/Editing/ECClasses.d.ts.map +1 -1
  28. package/lib/cjs/Editing/ECClasses.js +126 -156
  29. package/lib/cjs/Editing/ECClasses.js.map +1 -1
  30. package/lib/cjs/Editing/Editor.d.ts +10 -31
  31. package/lib/cjs/Editing/Editor.d.ts.map +1 -1
  32. package/lib/cjs/Editing/Editor.js +59 -43
  33. package/lib/cjs/Editing/Editor.js.map +1 -1
  34. package/lib/cjs/Editing/Entities.d.ts +9 -9
  35. package/lib/cjs/Editing/Entities.d.ts.map +1 -1
  36. package/lib/cjs/Editing/Entities.js +65 -85
  37. package/lib/cjs/Editing/Entities.js.map +1 -1
  38. package/lib/cjs/Editing/Enumerations.d.ts +6 -6
  39. package/lib/cjs/Editing/Enumerations.d.ts.map +1 -1
  40. package/lib/cjs/Editing/Enumerations.js +57 -55
  41. package/lib/cjs/Editing/Enumerations.js.map +1 -1
  42. package/lib/cjs/Editing/Exception.d.ts +257 -0
  43. package/lib/cjs/Editing/Exception.d.ts.map +1 -0
  44. package/lib/cjs/Editing/Exception.js +426 -0
  45. package/lib/cjs/Editing/Exception.js.map +1 -0
  46. package/lib/cjs/Editing/Formats.d.ts +6 -6
  47. package/lib/cjs/Editing/Formats.d.ts.map +1 -1
  48. package/lib/cjs/Editing/Formats.js +28 -33
  49. package/lib/cjs/Editing/Formats.js.map +1 -1
  50. package/lib/cjs/Editing/InvertedUnits.d.ts +6 -6
  51. package/lib/cjs/Editing/InvertedUnits.d.ts.map +1 -1
  52. package/lib/cjs/Editing/InvertedUnits.js +41 -56
  53. package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
  54. package/lib/cjs/Editing/KindOfQuantities.d.ts +6 -6
  55. package/lib/cjs/Editing/KindOfQuantities.d.ts.map +1 -1
  56. package/lib/cjs/Editing/KindOfQuantities.js +50 -57
  57. package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
  58. package/lib/cjs/Editing/Mixins.d.ts +5 -5
  59. package/lib/cjs/Editing/Mixins.d.ts.map +1 -1
  60. package/lib/cjs/Editing/Mixins.js +43 -58
  61. package/lib/cjs/Editing/Mixins.js.map +1 -1
  62. package/lib/cjs/Editing/Mutable/MutableArrayProperty.js.map +1 -1
  63. package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
  64. package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
  65. package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
  66. package/lib/cjs/Editing/Mutable/MutableEntityClass.d.ts +1 -5
  67. package/lib/cjs/Editing/Mutable/MutableEntityClass.d.ts.map +1 -1
  68. package/lib/cjs/Editing/Mutable/MutableEntityClass.js +1 -45
  69. package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
  70. package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
  71. package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
  72. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
  73. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
  74. package/lib/cjs/Editing/Mutable/MutableMixin.js.map +1 -1
  75. package/lib/cjs/Editing/Mutable/MutableNavigationProperty.js.map +1 -1
  76. package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
  77. package/lib/cjs/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -1
  78. package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
  79. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
  80. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
  81. package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
  82. package/lib/cjs/Editing/Mutable/MutableStructProperty.js.map +1 -1
  83. package/lib/cjs/Editing/Mutable/MutableUnit.js.map +1 -1
  84. package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
  85. package/lib/cjs/Editing/Phenomena.d.ts +7 -7
  86. package/lib/cjs/Editing/Phenomena.d.ts.map +1 -1
  87. package/lib/cjs/Editing/Phenomena.js +23 -23
  88. package/lib/cjs/Editing/Phenomena.js.map +1 -1
  89. package/lib/cjs/Editing/Properties.d.ts +7 -6
  90. package/lib/cjs/Editing/Properties.d.ts.map +1 -1
  91. package/lib/cjs/Editing/Properties.js +99 -46
  92. package/lib/cjs/Editing/Properties.js.map +1 -1
  93. package/lib/cjs/Editing/PropertyCategories.d.ts +6 -6
  94. package/lib/cjs/Editing/PropertyCategories.d.ts.map +1 -1
  95. package/lib/cjs/Editing/PropertyCategories.js +29 -27
  96. package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
  97. package/lib/cjs/Editing/RelationshipClasses.d.ts +15 -17
  98. package/lib/cjs/Editing/RelationshipClasses.d.ts.map +1 -1
  99. package/lib/cjs/Editing/RelationshipClasses.js +97 -101
  100. package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
  101. package/lib/cjs/Editing/SchemaItems.d.ts +13 -5
  102. package/lib/cjs/Editing/SchemaItems.d.ts.map +1 -1
  103. package/lib/cjs/Editing/SchemaItems.js +58 -6
  104. package/lib/cjs/Editing/SchemaItems.js.map +1 -1
  105. package/lib/cjs/Editing/Structs.d.ts +3 -3
  106. package/lib/cjs/Editing/Structs.d.ts.map +1 -1
  107. package/lib/cjs/Editing/Structs.js +17 -27
  108. package/lib/cjs/Editing/Structs.js.map +1 -1
  109. package/lib/cjs/Editing/UnitSystems.d.ts +7 -7
  110. package/lib/cjs/Editing/UnitSystems.d.ts.map +1 -1
  111. package/lib/cjs/Editing/UnitSystems.js +22 -20
  112. package/lib/cjs/Editing/UnitSystems.js.map +1 -1
  113. package/lib/cjs/Editing/Units.d.ts +6 -6
  114. package/lib/cjs/Editing/Units.d.ts.map +1 -1
  115. package/lib/cjs/Editing/Units.js +26 -35
  116. package/lib/cjs/Editing/Units.js.map +1 -1
  117. package/lib/cjs/Merging/CAClassMerger.js +2 -2
  118. package/lib/cjs/Merging/CAClassMerger.js.map +1 -1
  119. package/lib/cjs/Merging/ClassMerger.d.ts +1 -2
  120. package/lib/cjs/Merging/ClassMerger.d.ts.map +1 -1
  121. package/lib/cjs/Merging/ClassMerger.js +15 -39
  122. package/lib/cjs/Merging/ClassMerger.js.map +1 -1
  123. package/lib/cjs/Merging/ConstantMerger.d.ts.map +1 -1
  124. package/lib/cjs/Merging/ConstantMerger.js +2 -3
  125. package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
  126. package/lib/cjs/Merging/CustomAttributeMerger.d.ts +4 -5
  127. package/lib/cjs/Merging/CustomAttributeMerger.d.ts.map +1 -1
  128. package/lib/cjs/Merging/CustomAttributeMerger.js +8 -18
  129. package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
  130. package/lib/cjs/Merging/EntityClassMerger.d.ts +1 -2
  131. package/lib/cjs/Merging/EntityClassMerger.d.ts.map +1 -1
  132. package/lib/cjs/Merging/EntityClassMerger.js +3 -10
  133. package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
  134. package/lib/cjs/Merging/EnumerationMerger.d.ts.map +1 -1
  135. package/lib/cjs/Merging/EnumerationMerger.js +8 -10
  136. package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
  137. package/lib/cjs/Merging/KindOfQuantityMerger.d.ts.map +1 -1
  138. package/lib/cjs/Merging/KindOfQuantityMerger.js +2 -3
  139. package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
  140. package/lib/cjs/Merging/MixinMerger.js +2 -2
  141. package/lib/cjs/Merging/MixinMerger.js.map +1 -1
  142. package/lib/cjs/Merging/PhenomenonMerger.d.ts.map +1 -1
  143. package/lib/cjs/Merging/PhenomenonMerger.js +1 -2
  144. package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
  145. package/lib/cjs/Merging/PropertyCategoryMerger.d.ts.map +1 -1
  146. package/lib/cjs/Merging/PropertyCategoryMerger.js +1 -2
  147. package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -1
  148. package/lib/cjs/Merging/PropertyMerger.d.ts +2 -3
  149. package/lib/cjs/Merging/PropertyMerger.d.ts.map +1 -1
  150. package/lib/cjs/Merging/PropertyMerger.js +21 -42
  151. package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
  152. package/lib/cjs/Merging/RelationshipClassMerger.d.ts +5 -3
  153. package/lib/cjs/Merging/RelationshipClassMerger.d.ts.map +1 -1
  154. package/lib/cjs/Merging/RelationshipClassMerger.js +35 -33
  155. package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
  156. package/lib/cjs/Merging/SchemaItemMerger.d.ts +3 -4
  157. package/lib/cjs/Merging/SchemaItemMerger.d.ts.map +1 -1
  158. package/lib/cjs/Merging/SchemaItemMerger.js +3 -2
  159. package/lib/cjs/Merging/SchemaItemMerger.js.map +1 -1
  160. package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
  161. package/lib/cjs/Merging/SchemaMerger.js +8 -14
  162. package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
  163. package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
  164. package/lib/cjs/Merging/UnitSystemMerger.d.ts.map +1 -1
  165. package/lib/cjs/Merging/UnitSystemMerger.js +1 -2
  166. package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -1
  167. package/lib/cjs/Validation/Diagnostic.js.map +1 -1
  168. package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
  169. package/lib/cjs/Validation/ECRules.js.map +1 -1
  170. package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
  171. package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
  172. package/lib/cjs/Validation/Rules.js.map +1 -1
  173. package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
  174. package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
  175. package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
  176. package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
  177. package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
  178. package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
  179. package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
  180. package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
  181. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  182. package/lib/cjs/ecschema-editing.d.ts +1 -0
  183. package/lib/cjs/ecschema-editing.d.ts.map +1 -1
  184. package/lib/cjs/ecschema-editing.js +1 -0
  185. package/lib/cjs/ecschema-editing.js.map +1 -1
  186. package/package.json +9 -9
  187. package/public/locales/en/ECSchemaEditing.json +26 -26
@@ -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;AAE/C,6CAAoD;AAEpD;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,qBAAS;IAChD,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;QAGxD;;WAEG;QACa,yBAAoB,GAAG,IAAI,iCAAoB,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IALzG,CAAC;IAOD;;;;;;;;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,CAAC;YACzB,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QACzF,CAAC;QAED,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,uBAAuB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAA6B,CAAC;QACpG,IAAI,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AAW,EAAE,CAAC,CAAC;QACtE,CAAC;QAED,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,OAAO,EAAE,YAAY,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACtD,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AA1QD,kDA0QC","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\";\nimport { NavigationProperties } from \"./Properties\";\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(SchemaItemType.RelationshipClass, schemaEditor);\n }\n\n /**\n * Allows access for editing of NavigationProperty attributes.\n */\n public readonly navigationProperties = new NavigationProperties(this.schemaItemType, this._schemaEditor);\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 /**\n * Sets the base class of a RelationshipClass.\n * @param relationshipKey The SchemaItemKey of the RelationshipClass.\n * @param baseClassKey The SchemaItemKey of the base class. Specifying 'undefined' removes the base class.\n */\n public override async setBaseClass(itemKey: SchemaItemKey, baseClassKey?: SchemaItemKey): Promise<SchemaItemEditResults> {\n const relClass = await this._schemaEditor.schemaContext.getSchemaItem<RelationshipClass>(itemKey);\n const baseClass = relClass?.baseClass;\n\n const setResult = await super.setBaseClass(itemKey, baseClassKey);\n if (setResult.errorMessage === undefined) {\n const result = await this.validate(relClass!);\n if (result.errorMessage !== undefined) {\n relClass!.baseClass = baseClass;\n return { itemKey, errorMessage: result.errorMessage };\n }\n }\n return setResult;\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
+ {"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;AAE/C,6CAAoD;AACpD,2CAAwH;AAExH;;;GAGG;AACH,MAAa,m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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 { SchemaContextEditor } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableRelationshipClass, MutableRelationshipConstraint } from \"./Mutable/MutableRelationshipClass\";\r\nimport * as Rules from \"../Validation/ECRules\";\r\nimport { AnyDiagnostic, RelationshipConstraintDiagnostic, SchemaItemDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { NavigationProperties } from \"./Properties\";\r\nimport { ClassId, CustomAttributeId, ECEditingStatus, RelationshipConstraintId, SchemaEditingError } from \"./Exception\";\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(SchemaItemType.RelationshipClass, schemaEditor);\r\n }\r\n\r\n /**\r\n * Allows access for editing of NavigationProperty attributes.\r\n */\r\n public readonly navigationProperties = new NavigationProperties(this.schemaItemType, this.schemaEditor);\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<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createClass<RelationshipClass>(schemaKey, this.schemaItemType, (schema) => schema.createRelationshipClass.bind(schema), name, baseClassKey, modifier) as MutableRelationshipClass;\r\n\r\n newClass.setStrength(strength);\r\n newClass.setStrengthDirection(direction);\r\n\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new ClassId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * 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 */\r\n public async setSourceConstraint(relationshipKey: SchemaItemKey, source: RelationshipConstraint): Promise<void> {\r\n const relationship = await this.getSchemaItem<MutableRelationshipClass>(relationshipKey)\r\n .catch((e) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetSourceConstraint, new ClassId(this.schemaItemType, relationshipKey), e);\r\n });\r\n\r\n relationship.setSourceConstraint(source);\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 */\r\n public async setTargetConstraint(relationshipKey: SchemaItemKey, target: RelationshipConstraint): Promise<void> {\r\n const relationship = await this.getSchemaItem<MutableRelationshipClass>(relationshipKey)\r\n .catch((e) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetTargetConstraint, new ClassId(this.schemaItemType, relationshipKey), e);\r\n });\r\n\r\n relationship.setTargetConstraint(target);\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<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createRelationshipClass.bind(schema), relationshipProps);\r\n\r\n await newClass.source.fromJSON(relationshipProps.source);\r\n await newClass.target.fromJSON(relationshipProps.target);\r\n\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, relationshipProps.name!, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Sets the base class of a RelationshipClass.\r\n * @param relationshipKey The SchemaItemKey of the RelationshipClass.\r\n * @param baseClassKey The SchemaItemKey of the base class. Specifying 'undefined' removes the base class.\r\n */\r\n public override async setBaseClass(itemKey: SchemaItemKey, baseClassKey?: SchemaItemKey): Promise<void> {\r\n const relClass = await this.schemaEditor.schemaContext.getSchemaItem<RelationshipClass>(itemKey);\r\n const baseClass = relClass?.baseClass;\r\n\r\n await super.setBaseClass(itemKey, baseClassKey);\r\n\r\n try {\r\n await this.validate(relClass!);\r\n } catch(e: any) {\r\n relClass!.baseClass = baseClass;\r\n throw new SchemaEditingError(ECEditingStatus.SetBaseClass, new ClassId(SchemaItemType.RelationshipClass, itemKey), e);\r\n }\r\n }\r\n\r\n public async createNavigationProperty(relationshipKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<void> {\r\n try {\r\n const relationshipClass = await this.getSchemaItem<MutableRelationshipClass>(relationshipKey);\r\n await relationshipClass.createNavigationProperty(name, relationship, direction);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateNavigationProperty, new ClassId(SchemaItemType.RelationshipClass, relationshipKey), e);\r\n }\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<void> {\r\n try {\r\n const relationshipClass = await this.getSchemaItem<MutableRelationshipClass>(relationshipKey);\r\n const property = await relationshipClass.createNavigationProperty(navigationProps.name, navigationProps.relationshipName, navigationProps.direction);\r\n await property.fromJSON(navigationProps);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateNavigationPropertyFromProps, new ClassId(SchemaItemType.RelationshipClass, relationshipKey), e);\r\n }\r\n }\r\n\r\n public async setConstraintMultiplicity(constraint: RelationshipConstraint, multiplicity: RelationshipMultiplicity): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.multiplicity = multiplicity;\r\n }\r\n\r\n public async setConstraintPolymorphic(constraint: RelationshipConstraint, polymorphic: boolean): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.polymorphic = polymorphic;\r\n }\r\n\r\n public async setConstraintRelationshipEnd(constraint: RelationshipConstraint, relationshipEnd: RelationshipEnd): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.relationshipEnd = relationshipEnd;\r\n }\r\n\r\n public async setAbstractConstraint(constraint: RelationshipConstraint, abstractConstraint?: EntityClass | Mixin | RelationshipClass): Promise<void> {\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 try {\r\n await this.validate(constraint.relationshipClass);\r\n } catch(e: any){\r\n mutableConstraint.abstractConstraint = existing;\r\n throw new SchemaEditingError(ECEditingStatus.SetAbstractConstraint, new RelationshipConstraintId(constraint), e);\r\n }\r\n\r\n try {\r\n await this.validate(constraint);\r\n } catch(e: any){\r\n mutableConstraint.abstractConstraint = existing;\r\n throw new SchemaEditingError(ECEditingStatus.SetAbstractConstraint, new RelationshipConstraintId(constraint), e);\r\n }\r\n }\r\n\r\n public async addConstraintClass(constraint: RelationshipConstraint, ecClass: EntityClass | Mixin | RelationshipClass): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.addClass(ecClass);\r\n\r\n try {\r\n await this.validate(constraint.relationshipClass);\r\n } catch(e: any){\r\n mutableConstraint.removeClass(ecClass);\r\n throw new SchemaEditingError(ECEditingStatus.AddConstraintClass, new RelationshipConstraintId(constraint), e);\r\n }\r\n\r\n try {\r\n await this.validate(constraint);\r\n } catch(e: any){\r\n mutableConstraint.removeClass(ecClass);\r\n throw new SchemaEditingError(ECEditingStatus.AddConstraintClass, new RelationshipConstraintId(constraint), e);\r\n }\r\n }\r\n\r\n public async removeConstraintClass(constraint: RelationshipConstraint, ecClass: EntityClass | Mixin | RelationshipClass): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.removeClass(ecClass);\r\n\r\n try{\r\n await this.validate(constraint);\r\n } catch(e: any) {\r\n mutableConstraint.addClass(ecClass);\r\n throw new SchemaEditingError(ECEditingStatus.RemoveConstraintClass, new RelationshipConstraintId(constraint), e);\r\n }\r\n }\r\n\r\n public async addCustomAttributeToConstraint(constraint: RelationshipConstraint, customAttribute: CustomAttribute): Promise<void> {\r\n const mutableConstraint = constraint as MutableRelationshipConstraint;\r\n mutableConstraint.addCustomAttribute(customAttribute);\r\n\r\n const diagnosticIterable = Rules.validateCustomAttributeInstance(constraint, customAttribute);\r\n\r\n const diagnostics: AnyDiagnostic[] = [];\r\n for await (const diagnostic of diagnosticIterable) {\r\n diagnostics.push(diagnostic);\r\n }\r\n\r\n if (diagnostics.length > 0) {\r\n this.removeCustomAttribute(constraint, customAttribute);\r\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToConstraint, new RelationshipConstraintId(constraint),\r\n new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, constraint), undefined, diagnostics));\r\n }\r\n }\r\n\r\n private async validate(relationshipOrConstraint: RelationshipClass | RelationshipConstraint): Promise<void> {\r\n let diagnosticIterable: AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> | AsyncIterable<RelationshipConstraintDiagnostic<any[]>>;\r\n let relationshipKey: SchemaItemKey | string;\r\n\r\n if (relationshipOrConstraint instanceof RelationshipClass) {\r\n diagnosticIterable = Rules.validateRelationship(relationshipOrConstraint);\r\n relationshipKey = relationshipOrConstraint.key;\r\n } else {\r\n diagnosticIterable = Rules.validateRelationshipConstraint(relationshipOrConstraint);\r\n relationshipKey = relationshipOrConstraint.relationshipClass.key;\r\n }\r\n\r\n const diagnostics: AnyDiagnostic[] = [];\r\n for await (const diagnostic of diagnosticIterable) {\r\n diagnostics.push(diagnostic);\r\n }\r\n\r\n if (diagnostics.length > 0) {\r\n if (relationshipOrConstraint instanceof RelationshipClass) {\r\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new ClassId(SchemaItemType.RelationshipClass, relationshipKey), undefined, diagnostics);\r\n } else {\r\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new RelationshipConstraintId(relationshipOrConstraint), undefined, diagnostics);\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -1,15 +1,23 @@
1
1
  /** @packageDocumentation
2
2
  * @module Editing
3
3
  */
4
- import { SchemaItemKey, SchemaItemProps } from "@itwin/ecschema-metadata";
4
+ import { SchemaItem, SchemaItemKey, SchemaItemProps, SchemaItemType, SchemaKey } from "@itwin/ecschema-metadata";
5
5
  import { SchemaContextEditor } from "./Editor";
6
+ import { MutableSchema } from "./Mutable/MutableSchema";
7
+ export type CreateSchemaItem<T extends SchemaItem> = (schema: MutableSchema) => (name: string, ...args: any[]) => Promise<T>;
8
+ export type CreateSchemaItemFromProps<T extends SchemaItem> = (props: SchemaItemProps, ...args: any[]) => Promise<T>;
6
9
  /**
7
10
  * @internal
8
11
  * A class allowing you to edit the schema item base class.
9
12
  */
10
- export declare class SchemaItems {
11
- protected _schemaEditor: SchemaContextEditor;
12
- constructor(_schemaEditor: SchemaContextEditor);
13
- applyProps(schemaItemKey: SchemaItemKey, schemItemProps: SchemaItemProps): Promise<void>;
13
+ export declare abstract class SchemaItems {
14
+ protected schemaItemType: SchemaItemType;
15
+ protected schemaEditor: SchemaContextEditor;
16
+ constructor(schemaItemType: SchemaItemType, schemaEditor: SchemaContextEditor);
17
+ protected getSchema(schemaKey: SchemaKey): Promise<MutableSchema>;
18
+ protected getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey, schemaItemType?: SchemaItemType | null): Promise<T>;
19
+ protected lookupSchemaItem<T extends SchemaItem>(schemaOrKey: MutableSchema | SchemaKey, schemaItemKey: SchemaItemKey, schemaItemType?: SchemaItemType | null): Promise<T>;
20
+ protected createSchemaItem<T extends SchemaItem>(schemaKey: SchemaKey, type: SchemaItemType, create: CreateSchemaItem<T>, name: string, ...args: any[]): Promise<T>;
21
+ protected createSchemaItemFromProps<T extends SchemaItem>(schemaKey: SchemaKey, type: SchemaItemType, create: CreateSchemaItem<T>, props: SchemaItemProps): Promise<T>;
14
22
  }
15
23
  //# sourceMappingURL=SchemaItems.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaItems.d.ts","sourceRoot":"","sources":["../../../src/Editing/SchemaItems.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAmC,aAAa,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C;;;GAGG;AACH,qBAAa,WAAW;IACH,SAAS,CAAC,aAAa,EAAE,mBAAmB;gBAAlC,aAAa,EAAE,mBAAmB;IAClD,UAAU,CAAC,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAQtG"}
1
+ {"version":3,"file":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,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;cAczJ,yBAAyB,CAAC,CAAC,SAAS,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,CAAC,CAAC;CAS7K"}
@@ -9,19 +9,71 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.SchemaItems = void 0;
11
11
  const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
12
+ const Exception_1 = require("./Exception");
12
13
  /**
13
14
  * @internal
14
15
  * A class allowing you to edit the schema item base class.
15
16
  */
16
17
  class SchemaItems {
17
- constructor(_schemaEditor) {
18
- this._schemaEditor = _schemaEditor;
18
+ constructor(schemaItemType, schemaEditor) {
19
+ this.schemaItemType = schemaItemType;
20
+ this.schemaEditor = schemaEditor;
19
21
  }
20
- async applyProps(schemaItemKey, schemItemProps) {
21
- const schemaItem = await this._schemaEditor.schemaContext.getSchemaItem(schemaItemKey);
22
+ async getSchema(schemaKey) {
23
+ const schema = await this.schemaEditor.getSchema(schemaKey);
24
+ if (schema === undefined)
25
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SchemaNotFound, new Exception_1.SchemaId(schemaKey));
26
+ return schema;
27
+ }
28
+ async getSchemaItem(schemaItemKey, schemaItemType) {
29
+ const schemaItem = await this.schemaEditor.schemaContext.getSchemaItem(schemaItemKey);
30
+ schemaItemType = schemaItemType === null ? undefined : schemaItemType ?? this.schemaItemType;
31
+ if (!schemaItem) {
32
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SchemaItemNotFoundInContext, new Exception_1.SchemaItemId(schemaItemType ?? this.schemaItemType, schemaItemKey));
33
+ }
34
+ if (schemaItemType && schemaItemType !== schemaItem.schemaItemType) {
35
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.InvalidSchemaItemType, new Exception_1.SchemaItemId(schemaItemType ?? this.schemaItemType, schemaItemKey));
36
+ }
37
+ return schemaItem;
38
+ }
39
+ async lookupSchemaItem(schemaOrKey, schemaItemKey, schemaItemType) {
40
+ schemaItemType = schemaItemType === null ? undefined : schemaItemType ?? this.schemaItemType;
41
+ let schema;
42
+ if (schemaOrKey instanceof ecschema_metadata_1.SchemaKey) {
43
+ schema = await this.getSchema(schemaOrKey);
44
+ }
45
+ else {
46
+ schema = schemaOrKey;
47
+ }
48
+ const schemaItem = await schema.lookupItem(schemaItemKey);
22
49
  if (schemaItem === undefined)
23
- throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `Schema Item ${schemaItemKey.fullName} not found in schema context.`);
24
- await schemaItem.fromJSON(schemItemProps);
50
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SchemaItemNotFound, new Exception_1.SchemaItemId(schemaItemType ?? this.schemaItemType, schemaItemKey));
51
+ if (schemaItemType && schemaItemType !== schemaItem.schemaItemType) {
52
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.InvalidSchemaItemType, new Exception_1.SchemaItemId(schemaItemType ?? this.schemaItemType, schemaItemKey));
53
+ }
54
+ return schemaItem;
55
+ }
56
+ async createSchemaItem(schemaKey, type, create, name, ...args) {
57
+ const schema = await this.getSchema(schemaKey);
58
+ try {
59
+ const boundCreate = create(schema);
60
+ return await boundCreate(name, ...args);
61
+ }
62
+ catch (e) {
63
+ if (e instanceof ecschema_metadata_1.ECObjectsError && e.errorNumber === ecschema_metadata_1.ECObjectsStatus.DuplicateItem) {
64
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SchemaItemNameAlreadyExists, new Exception_1.SchemaItemId(type, name, schema.schemaKey));
65
+ }
66
+ else {
67
+ throw new Error(`Failed to create class ${name} in schema ${schema.fullName}.`);
68
+ }
69
+ }
70
+ }
71
+ async createSchemaItemFromProps(schemaKey, type, create, props) {
72
+ if (props.name === undefined)
73
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SchemaItemNameNotSpecified, new Exception_1.SchemaItemId(type, "", schemaKey));
74
+ const newItem = await this.createSchemaItem(schemaKey, type, create, props.name);
75
+ await newItem.fromJSON(props);
76
+ return newItem;
25
77
  }
26
78
  }
27
79
  exports.SchemaItems = SchemaItems;
@@ -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":["/*---------------------------------------------------------------------------------------------\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
+ {"version":3,"file":"SchemaItems.js","sourceRoot":"","sources":["../../../src/Editing/SchemaItems.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA0J;AAE1J,2CAA0F;AAM1F;;;GAGG;AACH,MAAsB,WAAW;IAI/B,YAAmB,cAA8B,EAAE,YAAiC;QAClF,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAES,KAAK,CAAC,SAAS,CAAC,SAAoB;QAC5C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC5D,IAAI,MAAM,KAAK,SAAS;YACtB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,cAAc,EAAE,IAAI,oBAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;QAExF,OAAO,MAAM,CAAC;IAChB,CAAC;IAES,KAAK,CAAC,aAAa,CAAuB,aAA4B,EAAE,cAAsC;QACtH,MAAM,UAAU,GAAI,MAAM,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,aAAa,CAAI,aAAa,CAAC,CAAC;QAC1F,cAAc,GAAG,cAAc,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC;QAE7F,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,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5ED,kCA4EC","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, Schema, SchemaItem, SchemaItemKey, SchemaItemProps, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { ECEditingStatus, SchemaEditingError, SchemaId, SchemaItemId } from \"./Exception\";\r\nimport { MutableSchema } from \"./Mutable/MutableSchema\";\r\n\r\nexport type CreateSchemaItem<T extends SchemaItem> = (schema: MutableSchema) => (name: string, ...args: any[]) => Promise<T>;\r\nexport type CreateSchemaItemFromProps<T extends SchemaItem> = (props: SchemaItemProps, ...args: any[]) => Promise<T>;\r\n\r\n/**\r\n * @internal\r\n * A class allowing you to edit the schema item base class.\r\n */\r\nexport abstract class SchemaItems {\r\n protected schemaItemType: SchemaItemType;\r\n protected schemaEditor: SchemaContextEditor;\r\n\r\n public constructor(schemaItemType: SchemaItemType, schemaEditor: SchemaContextEditor) {\r\n this.schemaItemType = schemaItemType;\r\n this.schemaEditor = schemaEditor;\r\n }\r\n\r\n protected async getSchema(schemaKey: SchemaKey): Promise<MutableSchema> {\r\n const schema = await this.schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));\r\n\r\n return schema;\r\n }\r\n\r\n protected async getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey, schemaItemType?: SchemaItemType | null): Promise<T>{\r\n const schemaItem = await this.schemaEditor.schemaContext.getSchemaItem<T>(schemaItemKey);\r\n schemaItemType = schemaItemType === null ? undefined : schemaItemType ?? this.schemaItemType;\r\n\r\n if (!schemaItem) {\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFoundInContext, new SchemaItemId(schemaItemType ?? this.schemaItemType, schemaItemKey));\r\n }\r\n\r\n if (schemaItemType && schemaItemType !== schemaItem.schemaItemType) {\r\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType ?? this.schemaItemType, schemaItemKey));\r\n }\r\n\r\n return schemaItem;\r\n }\r\n\r\n protected async lookupSchemaItem<T extends SchemaItem>(schemaOrKey: MutableSchema | SchemaKey, schemaItemKey: SchemaItemKey, schemaItemType?: SchemaItemType | null): Promise<T>{\r\n schemaItemType = schemaItemType === null ? undefined : schemaItemType ?? this.schemaItemType;\r\n\r\n let schema: Schema;\r\n if (schemaOrKey instanceof SchemaKey) {\r\n schema = await this.getSchema(schemaOrKey);\r\n } else {\r\n schema = schemaOrKey;\r\n }\r\n\r\n const schemaItem = await schema.lookupItem<T>(schemaItemKey);\r\n if (schemaItem === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new SchemaItemId(schemaItemType ?? this.schemaItemType, schemaItemKey));\r\n\r\n if (schemaItemType && schemaItemType !== schemaItem.schemaItemType) {\r\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType ?? this.schemaItemType, schemaItemKey));\r\n }\r\n\r\n return schemaItem;\r\n }\r\n\r\n protected async createSchemaItem<T extends SchemaItem>(schemaKey: SchemaKey, type: SchemaItemType, create: CreateSchemaItem<T>, name: string, ...args: any[]): Promise<T> {\r\n const schema = await this.getSchema(schemaKey);\r\n try {\r\n const boundCreate = create(schema);\r\n return await boundCreate(name, ...args);\r\n } catch (e) {\r\n if (e instanceof ECObjectsError && e.errorNumber === ECObjectsStatus.DuplicateItem) {\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNameAlreadyExists, new SchemaItemId(type, name, schema.schemaKey));\r\n } else {\r\n throw new Error(`Failed to create class ${name} in schema ${schema.fullName}.`);\r\n }\r\n }\r\n }\r\n\r\n protected async createSchemaItemFromProps<T extends SchemaItem>(schemaKey: SchemaKey, type: SchemaItemType, create: CreateSchemaItem<T>, props: SchemaItemProps): Promise<T> {\r\n if (props.name === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNameNotSpecified, new SchemaItemId(type, \"\", schemaKey));\r\n\r\n const newItem = await this.createSchemaItem<T>(schemaKey, type, create, props.name);\r\n await newItem.fromJSON(props);\r\n\r\n return newItem;\r\n }\r\n}\r\n"]}
@@ -2,19 +2,19 @@
2
2
  * @module Editing
3
3
  */
4
4
  import { SchemaItemKey, SchemaKey, StructClassProps } from "@itwin/ecschema-metadata";
5
- import { SchemaContextEditor, SchemaItemEditResults } from "./Editor";
5
+ import { SchemaContextEditor } from "./Editor";
6
6
  import { ECClasses } from "./ECClasses";
7
7
  /**
8
8
  * @alpha A class extending ECClasses allowing you to create schema items of type StructClass.
9
9
  */
10
10
  export declare class Structs extends ECClasses {
11
11
  constructor(schemaEditor: SchemaContextEditor);
12
- create(schemaKey: SchemaKey, name: string, displayLabel?: string, baseClass?: SchemaItemKey): Promise<SchemaItemEditResults>;
12
+ create(schemaKey: SchemaKey, name: string, displayLabel?: string, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey>;
13
13
  /**
14
14
  * Creates a StructClass through a StructClassProps.
15
15
  * @param schemaKey a SchemaKey of the Schema that will house the new object.
16
16
  * @param structProps a json object that will be used to populate the new StructClass. Needs a name value passed in.
17
17
  */
18
- createFromProps(schemaKey: SchemaKey, structProps: StructClassProps): Promise<SchemaItemEditResults>;
18
+ createFromProps(schemaKey: SchemaKey, structProps: StructClassProps): Promise<SchemaItemKey>;
19
19
  }
20
20
  //# sourceMappingURL=Structs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Structs.d.ts","sourceRoot":"","sources":["../../../src/Editing/Structs.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAoC,aAAa,EAAkB,SAAS,EAAe,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACrJ,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC;;GAEG;AACH,qBAAa,OAAQ,SAAQ,SAAS;gBACjB,YAAY,EAAE,mBAAmB;IAIvC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA0BzI;;;;OAIG;IACU,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAelH"}
1
+ {"version":3,"file":"Structs.d.ts","sourceRoot":"","sources":["../../../src/Editing/Structs.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAkB,SAAS,EAAe,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACnH,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC;;GAEG;AACH,qBAAa,OAAQ,SAAQ,SAAS;gBACjB,YAAY,EAAE,mBAAmB;IAIvC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAapI;;;;OAIG;IACU,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;CAQ1G"}
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.Structs = void 0;
11
11
  const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
12
12
  const ECClasses_1 = require("./ECClasses");
13
+ const Exception_1 = require("./Exception");
13
14
  /**
14
15
  * @alpha A class extending ECClasses allowing you to create schema items of type StructClass.
15
16
  */
@@ -17,24 +18,16 @@ class Structs extends ECClasses_1.ECClasses {
17
18
  constructor(schemaEditor) {
18
19
  super(ecschema_metadata_1.SchemaItemType.StructClass, schemaEditor);
19
20
  }
20
- async create(schemaKey, name, displayLabel, baseClass) {
21
- const schema = await this._schemaEditor.getSchema(schemaKey);
22
- if (schema === undefined)
23
- return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
24
- const newClass = (await schema.createStructClass(name));
25
- if (newClass === undefined)
26
- return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };
27
- if (baseClass !== undefined) {
28
- const baseClassItem = await schema.lookupItem(baseClass);
29
- if (baseClassItem === undefined)
30
- return { errorMessage: `Unable to locate base class ${baseClass.fullName} in schema ${schema.fullName}.` };
31
- if (baseClassItem.schemaItemType !== ecschema_metadata_1.SchemaItemType.StructClass)
32
- return { errorMessage: `${baseClassItem.fullName} is not of type Struct Class.` };
33
- newClass.baseClass = new ecschema_metadata_1.DelayedPromiseWithProps(baseClass, async () => baseClassItem);
21
+ async create(schemaKey, name, displayLabel, baseClassKey) {
22
+ try {
23
+ const newClass = await this.createClass(schemaKey, this.schemaItemType, (schema) => schema.createStructClass.bind(schema), name, baseClassKey);
24
+ if (displayLabel)
25
+ newClass.setDisplayLabel(displayLabel);
26
+ return newClass.key;
27
+ }
28
+ catch (e) {
29
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFailed, new Exception_1.ClassId(this.schemaItemType, name, schemaKey), e);
34
30
  }
35
- if (displayLabel)
36
- newClass.setDisplayLabel(displayLabel);
37
- return { itemKey: newClass.key };
38
31
  }
39
32
  /**
40
33
  * Creates a StructClass through a StructClassProps.
@@ -42,16 +35,13 @@ class Structs extends ECClasses_1.ECClasses {
42
35
  * @param structProps a json object that will be used to populate the new StructClass. Needs a name value passed in.
43
36
  */
44
37
  async createFromProps(schemaKey, structProps) {
45
- const schema = await this._schemaEditor.getSchema(schemaKey);
46
- if (schema === undefined)
47
- return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
48
- if (structProps.name === undefined)
49
- return { errorMessage: `No name was supplied within props.` };
50
- const newClass = (await schema.createStructClass(structProps.name));
51
- if (newClass === undefined)
52
- return { errorMessage: `Failed to create class ${structProps.name} in schema ${schemaKey.toString(true)}.` };
53
- await newClass.fromJSON(structProps);
54
- return { itemKey: newClass.key };
38
+ try {
39
+ const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createStructClass.bind(schema), structProps);
40
+ return newClass.key;
41
+ }
42
+ catch (e) {
43
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.ClassId(this.schemaItemType, structProps.name, schemaKey), e);
44
+ }
55
45
  }
56
46
  }
57
47
  exports.Structs = Structs;
@@ -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,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAClD,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,YAAqB,EAAE,SAAyB;QACtG,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,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAuB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AC,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(SchemaItemType.StructClass, 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
+ {"version":3,"file":"Structs.js","sourceRoot":"","sources":["../../../src/Editing/Structs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAmH;AAEnH,2CAAwC;AAExC,2CAA2E;AAE3E;;GAEG;AACH,MAAa,OAAQ,SAAQ,qBAAS;IACpC,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAClD,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,YAAqB,EAAE,YAA4B;QACzG,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAc,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,YAAY,CAAuB,CAAC;YAElL,IAAI,YAAY;gBACd,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YAEzC,OAAO,QAAQ,CAAC,GAAG,CAAC;QACtB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,sBAAsB,EAAE,IAAI,mBAAO,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7H,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,WAA6B;QAC9E,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC;YACtJ,OAAO,QAAQ,CAAC,GAAG,CAAC;QACtB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,mBAAO,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7I,CAAC;IACH,CAAC;CACF;AA/BD,0BA+BC","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 { SchemaItemKey, SchemaItemType, SchemaKey, StructClass, StructClassProps } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableStructClass } from \"./Mutable/MutableClass\";\r\nimport { ClassId, ECEditingStatus, SchemaEditingError } from \"./Exception\";\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(SchemaItemType.StructClass, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, displayLabel?: string, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createClass<StructClass>(schemaKey, this.schemaItemType, (schema) => schema.createStructClass.bind(schema), name, baseClassKey) as MutableStructClass;\r\n\r\n if (displayLabel)\r\n newClass.setDisplayLabel(displayLabel);\r\n\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new ClassId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a 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<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createStructClass.bind(schema), structProps);\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, structProps.name!, schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -1,16 +1,16 @@
1
1
  /** @packageDocumentation
2
2
  * @module Editing
3
3
  */
4
- import { SchemaKey, UnitSystemProps } from "@itwin/ecschema-metadata";
5
- import { SchemaContextEditor, SchemaItemEditResults } from "./Editor";
4
+ import { SchemaItemKey, SchemaKey, UnitSystemProps } from "@itwin/ecschema-metadata";
5
+ import { SchemaContextEditor } from "./Editor";
6
+ import { SchemaItems } from "./SchemaItems";
6
7
  /**
7
8
  * @alpha
8
9
  * A class allowing you to create schema items of type UnitSystems.
9
10
  */
10
- export declare class UnitSystems {
11
- protected _schemaEditor: SchemaContextEditor;
12
- constructor(_schemaEditor: SchemaContextEditor);
13
- create(schemaKey: SchemaKey, name: string, displayLabel?: string): Promise<SchemaItemEditResults>;
14
- createFromProps(schemaKey: SchemaKey, unitSystemProps: UnitSystemProps): Promise<SchemaItemEditResults>;
11
+ export declare class UnitSystems extends SchemaItems {
12
+ constructor(schemaEditor: SchemaContextEditor);
13
+ create(schemaKey: SchemaKey, name: string, displayLabel?: string): Promise<SchemaItemKey>;
14
+ createFromProps(schemaKey: SchemaKey, unitSystemProps: UnitSystemProps): Promise<SchemaItemKey>;
15
15
  }
16
16
  //# sourceMappingURL=UnitSystems.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnitSystems.d.ts","sourceRoot":"","sources":["../../../src/Editing/UnitSystems.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGtE;;;GAGG;AACH,qBAAa,WAAW;IACH,SAAS,CAAC,aAAa,EAAE,mBAAmB;gBAAlC,aAAa,EAAE,mBAAmB;IAClD,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAYjG,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAerH"}
1
+ {"version":3,"file":"UnitSystems.d.ts","sourceRoot":"","sources":["../../../src/Editing/UnitSystems.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAkB,SAAS,EAAc,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACjH,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,qBAAa,WAAY,SAAQ,WAAW;gBACvB,YAAY,EAAE,mBAAmB;IAIvC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAczF,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;CAQ7G"}
@@ -8,34 +8,36 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.UnitSystems = void 0;
11
+ const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
12
+ const Exception_1 = require("./Exception");
13
+ const SchemaItems_1 = require("./SchemaItems");
11
14
  /**
12
15
  * @alpha
13
16
  * A class allowing you to create schema items of type UnitSystems.
14
17
  */
15
- class UnitSystems {
16
- constructor(_schemaEditor) {
17
- this._schemaEditor = _schemaEditor;
18
+ class UnitSystems extends SchemaItems_1.SchemaItems {
19
+ constructor(schemaEditor) {
20
+ super(ecschema_metadata_1.SchemaItemType.UnitSystem, schemaEditor);
18
21
  }
19
22
  async create(schemaKey, name, displayLabel) {
20
- const schema = await this._schemaEditor.getSchema(schemaKey);
21
- if (schema === undefined)
22
- return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
23
- const newUnitSystem = (await schema.createUnitSystem(name));
24
- if (displayLabel)
25
- newUnitSystem.setDisplayLabel(displayLabel);
26
- return { itemKey: newUnitSystem.key };
23
+ try {
24
+ const newUnitSystem = await this.createSchemaItem(schemaKey, this.schemaItemType, (schema) => schema.createUnitSystem.bind(schema), name);
25
+ if (displayLabel)
26
+ newUnitSystem.setDisplayLabel(displayLabel);
27
+ return newUnitSystem.key;
28
+ }
29
+ catch (e) {
30
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFailed, new Exception_1.SchemaItemId(this.schemaItemType, name, schemaKey), e);
31
+ }
27
32
  }
28
33
  async createFromProps(schemaKey, unitSystemProps) {
29
- const schema = await this._schemaEditor.getSchema(schemaKey);
30
- if (schema === undefined)
31
- return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };
32
- if (unitSystemProps.name === undefined)
33
- return { errorMessage: `No name was supplied within props.` };
34
- const newUnitSystem = (await schema.createUnitSystem(unitSystemProps.name));
35
- if (newUnitSystem === undefined)
36
- return { errorMessage: `Failed to create class ${unitSystemProps.name} in schema ${schemaKey.toString(true)}.` };
37
- await newUnitSystem.fromJSON(unitSystemProps);
38
- return { itemKey: newUnitSystem.key };
34
+ try {
35
+ const newUnitSystem = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createUnitSystem.bind(schema), unitSystemProps);
36
+ return newUnitSystem.key;
37
+ }
38
+ catch (e) {
39
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.CreateSchemaItemFromProps, new Exception_1.SchemaItemId(this.schemaItemType, unitSystemProps.name, schemaKey), e);
40
+ }
39
41
  }
40
42
  }
41
43
  exports.UnitSystems = UnitSystems;
@@ -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":["/*---------------------------------------------------------------------------------------------\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
+ {"version":3,"file":"UnitSystems.js","sourceRoot":"","sources":["../../../src/Editing/UnitSystems.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAiH;AAGjH,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,WAAY,SAAQ,yBAAW;IAC1C,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,YAAqB;QAE3E,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAa,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAsB,CAAC;YAE3K,IAAI,YAAY;gBACd,aAAa,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YAE9C,OAAO,aAAa,CAAC,GAAG,CAAC;QAC3B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,sBAAsB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAClI,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,eAAgC;QACjF,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC,CAAC;YAC9J,OAAO,aAAa,CAAC,GAAG,CAAC;QAC3B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACtJ,CAAC;IACH,CAAC;CACF;AA3BD,kCA2BC","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 { SchemaItemKey, SchemaItemType, SchemaKey, UnitSystem, UnitSystemProps } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableUnitSystem } from \"./Mutable/MutableUnitSystem\";\r\nimport { ECEditingStatus, SchemaEditingError, SchemaItemId } from \"./Exception\";\r\nimport { SchemaItems } from \"./SchemaItems\";\r\n\r\n/**\r\n * @alpha\r\n * A class allowing you to create schema items of type UnitSystems.\r\n */\r\nexport class UnitSystems extends SchemaItems {\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.UnitSystem, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, displayLabel?: string): Promise<SchemaItemKey> {\r\n\r\n try {\r\n const newUnitSystem = await this.createSchemaItem<UnitSystem>(schemaKey, this.schemaItemType, (schema) => schema.createUnitSystem.bind(schema), name) as MutableUnitSystem;\r\n\r\n if (displayLabel)\r\n newUnitSystem.setDisplayLabel(displayLabel);\r\n\r\n return newUnitSystem.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n public async createFromProps(schemaKey: SchemaKey, unitSystemProps: UnitSystemProps): Promise<SchemaItemKey> {\r\n try {\r\n const newUnitSystem = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createUnitSystem.bind(schema), unitSystemProps);\r\n return newUnitSystem.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, unitSystemProps.name!, schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -2,15 +2,15 @@
2
2
  * @module Editing
3
3
  */
4
4
  import { SchemaItemKey, SchemaItemUnitProps, SchemaKey } from "@itwin/ecschema-metadata";
5
- import { SchemaContextEditor, SchemaItemEditResults } from "./Editor";
5
+ import { SchemaContextEditor } from "./Editor";
6
+ import { SchemaItems } from "./SchemaItems";
6
7
  /**
7
8
  * @alpha
8
9
  * A class allowing you to create schema items of type Unit.
9
10
  */
10
- export declare class Units {
11
- protected _schemaEditor: SchemaContextEditor;
12
- constructor(_schemaEditor: SchemaContextEditor);
13
- create(schemaKey: SchemaKey, name: string, definition: string, phenomenon: SchemaItemKey, unitSystem: SchemaItemKey, displayLabel?: string): Promise<SchemaItemEditResults>;
14
- createFromProps(schemaKey: SchemaKey, unitProps: SchemaItemUnitProps): Promise<SchemaItemEditResults>;
11
+ export declare class Units extends SchemaItems {
12
+ constructor(schemaEditor: SchemaContextEditor);
13
+ create(schemaKey: SchemaKey, name: string, definition: string, phenomenon: SchemaItemKey, unitSystem: SchemaItemKey, displayLabel?: string): Promise<SchemaItemKey>;
14
+ createFromProps(schemaKey: SchemaKey, unitProps: SchemaItemUnitProps): Promise<SchemaItemKey>;
15
15
  }
16
16
  //# sourceMappingURL=Units.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Units.d.ts","sourceRoot":"","sources":["../../../src/Editing/Units.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAuC,aAAa,EAAkB,mBAAmB,EAAE,SAAS,EAAc,MAAM,0BAA0B,CAAC;AAC1J,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGtE;;;GAGG;AACH,qBAAa,KAAK;IAEG,SAAS,CAAC,aAAa,EAAE,mBAAmB;gBAAlC,aAAa,EAAE,mBAAmB;IAElD,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAmC3K,eAAe,CAAC,SAAS,EAAE,S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