@itwin/ecschema-editing 5.0.0-dev.90 → 5.0.0-dev.93
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.
- package/lib/cjs/Validation/DiagnosticReporter.js +1 -1
- package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
- package/lib/esm/Differencing/Errors.d.ts +19 -0
- package/lib/esm/Differencing/Errors.d.ts.map +1 -0
- package/lib/esm/Differencing/Errors.js +26 -0
- package/lib/esm/Differencing/Errors.js.map +1 -0
- package/lib/esm/Differencing/SchemaConflicts.d.ts +84 -0
- package/lib/esm/Differencing/SchemaConflicts.d.ts.map +1 -0
- package/lib/esm/Differencing/SchemaConflicts.js +60 -0
- package/lib/esm/Differencing/SchemaConflicts.js.map +1 -0
- package/lib/esm/Differencing/SchemaDiagnosticVisitor.d.ts +41 -0
- package/lib/esm/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -0
- package/lib/esm/Differencing/SchemaDiagnosticVisitor.js +443 -0
- package/lib/esm/Differencing/SchemaDiagnosticVisitor.js.map +1 -0
- package/lib/esm/Differencing/SchemaDifference.d.ts +357 -0
- package/lib/esm/Differencing/SchemaDifference.d.ts.map +1 -0
- package/lib/esm/Differencing/SchemaDifference.js +106 -0
- package/lib/esm/Differencing/SchemaDifference.js.map +1 -0
- package/lib/esm/Differencing/SchemaDifferenceValidator.d.ts +18 -0
- package/lib/esm/Differencing/SchemaDifferenceValidator.d.ts.map +1 -0
- package/lib/esm/Differencing/SchemaDifferenceValidator.js +521 -0
- package/lib/esm/Differencing/SchemaDifferenceValidator.js.map +1 -0
- package/lib/esm/Differencing/SchemaDifferenceVisitor.d.ts +32 -0
- package/lib/esm/Differencing/SchemaDifferenceVisitor.d.ts.map +1 -0
- package/lib/esm/Differencing/SchemaDifferenceVisitor.js +88 -0
- package/lib/esm/Differencing/SchemaDifferenceVisitor.js.map +1 -0
- package/lib/esm/Differencing/Utils.d.ts +110 -0
- package/lib/esm/Differencing/Utils.d.ts.map +1 -0
- package/lib/esm/Differencing/Utils.js +161 -0
- package/lib/esm/Differencing/Utils.js.map +1 -0
- package/lib/esm/Editing/Constants.d.ts +22 -0
- package/lib/esm/Editing/Constants.d.ts.map +1 -0
- package/lib/esm/Editing/Constants.js +55 -0
- package/lib/esm/Editing/Constants.js.map +1 -0
- package/lib/esm/Editing/CustomAttributes.d.ts +22 -0
- package/lib/esm/Editing/CustomAttributes.d.ts.map +1 -0
- package/lib/esm/Editing/CustomAttributes.js +49 -0
- package/lib/esm/Editing/CustomAttributes.js.map +1 -0
- package/lib/esm/Editing/ECClasses.d.ts +86 -0
- package/lib/esm/Editing/ECClasses.d.ts.map +1 -0
- package/lib/esm/Editing/ECClasses.js +294 -0
- package/lib/esm/Editing/ECClasses.js.map +1 -0
- package/lib/esm/Editing/Editor.d.ts +117 -0
- package/lib/esm/Editing/Editor.d.ts.map +1 -0
- package/lib/esm/Editing/Editor.js +264 -0
- package/lib/esm/Editing/Editor.js.map +1 -0
- package/lib/esm/Editing/Entities.d.ts +38 -0
- package/lib/esm/Editing/Entities.d.ts.map +1 -0
- package/lib/esm/Editing/Entities.js +126 -0
- package/lib/esm/Editing/Entities.js.map +1 -0
- package/lib/esm/Editing/Enumerations.d.ts +25 -0
- package/lib/esm/Editing/Enumerations.d.ts.map +1 -0
- package/lib/esm/Editing/Enumerations.js +90 -0
- package/lib/esm/Editing/Enumerations.js.map +1 -0
- package/lib/esm/Editing/Exception.d.ts +358 -0
- package/lib/esm/Editing/Exception.d.ts.map +1 -0
- package/lib/esm/Editing/Exception.js +471 -0
- package/lib/esm/Editing/Exception.js.map +1 -0
- package/lib/esm/Editing/Formats.d.ts +23 -0
- package/lib/esm/Editing/Formats.d.ts.map +1 -0
- package/lib/esm/Editing/Formats.js +62 -0
- package/lib/esm/Editing/Formats.js.map +1 -0
- package/lib/esm/Editing/InvertedUnits.d.ts +19 -0
- package/lib/esm/Editing/InvertedUnits.d.ts.map +1 -0
- package/lib/esm/Editing/InvertedUnits.js +68 -0
- package/lib/esm/Editing/InvertedUnits.js.map +1 -0
- package/lib/esm/Editing/KindOfQuantities.d.ts +30 -0
- package/lib/esm/Editing/KindOfQuantities.d.ts.map +1 -0
- package/lib/esm/Editing/KindOfQuantities.js +92 -0
- package/lib/esm/Editing/KindOfQuantities.js.map +1 -0
- package/lib/esm/Editing/Mixins.d.ts +35 -0
- package/lib/esm/Editing/Mixins.d.ts.map +1 -0
- package/lib/esm/Editing/Mixins.js +90 -0
- package/lib/esm/Editing/Mixins.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableArrayProperty.d.ts +10 -0
- package/lib/esm/Editing/Mutable/MutableArrayProperty.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableArrayProperty.js +12 -0
- package/lib/esm/Editing/Mutable/MutableArrayProperty.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableCAClass.d.ts +10 -0
- package/lib/esm/Editing/Mutable/MutableCAClass.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableCAClass.js +12 -0
- package/lib/esm/Editing/Mutable/MutableCAClass.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableClass.d.ts +39 -0
- package/lib/esm/Editing/Mutable/MutableClass.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableClass.js +18 -0
- package/lib/esm/Editing/Mutable/MutableClass.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableConstant.d.ts +14 -0
- package/lib/esm/Editing/Mutable/MutableConstant.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableConstant.js +12 -0
- package/lib/esm/Editing/Mutable/MutableConstant.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableEntityClass.d.ts +12 -0
- package/lib/esm/Editing/Mutable/MutableEntityClass.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableEntityClass.js +12 -0
- package/lib/esm/Editing/Mutable/MutableEntityClass.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableEnumeration.d.ts +11 -0
- package/lib/esm/Editing/Mutable/MutableEnumeration.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableEnumeration.js +11 -0
- package/lib/esm/Editing/Mutable/MutableEnumeration.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableFormat.d.ts +26 -0
- package/lib/esm/Editing/Mutable/MutableFormat.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableFormat.js +12 -0
- package/lib/esm/Editing/Mutable/MutableFormat.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableInvertedUnit.d.ts +11 -0
- package/lib/esm/Editing/Mutable/MutableInvertedUnit.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableInvertedUnit.js +12 -0
- package/lib/esm/Editing/Mutable/MutableInvertedUnit.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableKindOfQuantity.d.ts +14 -0
- package/lib/esm/Editing/Mutable/MutableKindOfQuantity.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableKindOfQuantity.js +12 -0
- package/lib/esm/Editing/Mutable/MutableKindOfQuantity.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableMixin.d.ts +12 -0
- package/lib/esm/Editing/Mutable/MutableMixin.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableMixin.js +12 -0
- package/lib/esm/Editing/Mutable/MutableMixin.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableNavigationProperty.d.ts +8 -0
- package/lib/esm/Editing/Mutable/MutableNavigationProperty.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableNavigationProperty.js +12 -0
- package/lib/esm/Editing/Mutable/MutableNavigationProperty.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutablePhenomenon.d.ts +11 -0
- package/lib/esm/Editing/Mutable/MutablePhenomenon.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutablePhenomenon.js +12 -0
- package/lib/esm/Editing/Mutable/MutablePhenomenon.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutablePrimitiveOrEnumProperty.d.ts +13 -0
- package/lib/esm/Editing/Mutable/MutablePrimitiveOrEnumProperty.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutablePrimitiveOrEnumProperty.js +12 -0
- package/lib/esm/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableProperty.d.ts +16 -0
- package/lib/esm/Editing/Mutable/MutableProperty.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableProperty.js +12 -0
- package/lib/esm/Editing/Mutable/MutableProperty.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutablePropertyCategory.d.ts +11 -0
- package/lib/esm/Editing/Mutable/MutablePropertyCategory.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutablePropertyCategory.js +12 -0
- package/lib/esm/Editing/Mutable/MutablePropertyCategory.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableRelationshipClass.d.ts +30 -0
- package/lib/esm/Editing/Mutable/MutableRelationshipClass.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableRelationshipClass.js +20 -0
- package/lib/esm/Editing/Mutable/MutableRelationshipClass.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableSchema.d.ts +51 -0
- package/lib/esm/Editing/Mutable/MutableSchema.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableSchema.js +14 -0
- package/lib/esm/Editing/Mutable/MutableSchema.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableSchemaItem.d.ts +11 -0
- package/lib/esm/Editing/Mutable/MutableSchemaItem.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableSchemaItem.js +12 -0
- package/lib/esm/Editing/Mutable/MutableSchemaItem.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableStructProperty.d.ts +8 -0
- package/lib/esm/Editing/Mutable/MutableStructProperty.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableStructProperty.js +12 -0
- package/lib/esm/Editing/Mutable/MutableStructProperty.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableUnit.d.ts +12 -0
- package/lib/esm/Editing/Mutable/MutableUnit.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableUnit.js +12 -0
- package/lib/esm/Editing/Mutable/MutableUnit.js.map +1 -0
- package/lib/esm/Editing/Mutable/MutableUnitSystem.d.ts +10 -0
- package/lib/esm/Editing/Mutable/MutableUnitSystem.d.ts.map +1 -0
- package/lib/esm/Editing/Mutable/MutableUnitSystem.js +12 -0
- package/lib/esm/Editing/Mutable/MutableUnitSystem.js.map +1 -0
- package/lib/esm/Editing/Phenomena.d.ts +17 -0
- package/lib/esm/Editing/Phenomena.d.ts.map +1 -0
- package/lib/esm/Editing/Phenomena.js +44 -0
- package/lib/esm/Editing/Phenomena.js.map +1 -0
- package/lib/esm/Editing/Properties.d.ts +206 -0
- package/lib/esm/Editing/Properties.d.ts.map +1 -0
- package/lib/esm/Editing/Properties.js +415 -0
- package/lib/esm/Editing/Properties.js.map +1 -0
- package/lib/esm/Editing/PropertyCategories.d.ts +18 -0
- package/lib/esm/Editing/PropertyCategories.d.ts.map +1 -0
- package/lib/esm/Editing/PropertyCategories.js +54 -0
- package/lib/esm/Editing/PropertyCategories.js.map +1 -0
- package/lib/esm/Editing/RelationshipClasses.d.ts +69 -0
- package/lib/esm/Editing/RelationshipClasses.d.ts.map +1 -0
- package/lib/esm/Editing/RelationshipClasses.js +236 -0
- package/lib/esm/Editing/RelationshipClasses.js.map +1 -0
- package/lib/esm/Editing/SchemaItems.d.ts +42 -0
- package/lib/esm/Editing/SchemaItems.d.ts.map +1 -0
- package/lib/esm/Editing/SchemaItems.js +104 -0
- package/lib/esm/Editing/SchemaItems.js.map +1 -0
- package/lib/esm/Editing/Structs.d.ts +21 -0
- package/lib/esm/Editing/Structs.d.ts.map +1 -0
- package/lib/esm/Editing/Structs.js +47 -0
- package/lib/esm/Editing/Structs.js.map +1 -0
- package/lib/esm/Editing/UnitSystems.d.ts +17 -0
- package/lib/esm/Editing/UnitSystems.d.ts.map +1 -0
- package/lib/esm/Editing/UnitSystems.js +43 -0
- package/lib/esm/Editing/UnitSystems.js.map +1 -0
- package/lib/esm/Editing/Units.d.ts +17 -0
- package/lib/esm/Editing/Units.d.ts.map +1 -0
- package/lib/esm/Editing/Units.js +49 -0
- package/lib/esm/Editing/Units.js.map +1 -0
- package/lib/esm/Merging/ClassMerger.d.ts +9 -0
- package/lib/esm/Merging/ClassMerger.d.ts.map +1 -0
- package/lib/esm/Merging/ClassMerger.js +66 -0
- package/lib/esm/Merging/ClassMerger.js.map +1 -0
- package/lib/esm/Merging/ConstantMerger.d.ts +14 -0
- package/lib/esm/Merging/ConstantMerger.d.ts.map +1 -0
- package/lib/esm/Merging/ConstantMerger.js +64 -0
- package/lib/esm/Merging/ConstantMerger.js.map +1 -0
- package/lib/esm/Merging/CustomAttributeClassMerger.d.ts +14 -0
- package/lib/esm/Merging/CustomAttributeClassMerger.d.ts.map +1 -0
- package/lib/esm/Merging/CustomAttributeClassMerger.js +36 -0
- package/lib/esm/Merging/CustomAttributeClassMerger.js.map +1 -0
- package/lib/esm/Merging/CustomAttributeMerger.d.ts +19 -0
- package/lib/esm/Merging/CustomAttributeMerger.d.ts.map +1 -0
- package/lib/esm/Merging/CustomAttributeMerger.js +66 -0
- package/lib/esm/Merging/CustomAttributeMerger.js.map +1 -0
- package/lib/esm/Merging/Edits/NameMapping.d.ts +22 -0
- package/lib/esm/Merging/Edits/NameMapping.d.ts.map +1 -0
- package/lib/esm/Merging/Edits/NameMapping.js +49 -0
- package/lib/esm/Merging/Edits/NameMapping.js.map +1 -0
- package/lib/esm/Merging/Edits/RenameEditHandler.d.ts +14 -0
- package/lib/esm/Merging/Edits/RenameEditHandler.d.ts.map +1 -0
- package/lib/esm/Merging/Edits/RenameEditHandler.js +62 -0
- package/lib/esm/Merging/Edits/RenameEditHandler.js.map +1 -0
- package/lib/esm/Merging/Edits/SchemaEdits.d.ts +81 -0
- package/lib/esm/Merging/Edits/SchemaEdits.d.ts.map +1 -0
- package/lib/esm/Merging/Edits/SchemaEdits.js +112 -0
- package/lib/esm/Merging/Edits/SchemaEdits.js.map +1 -0
- package/lib/esm/Merging/Edits/SkipEditHandler.d.ts +14 -0
- package/lib/esm/Merging/Edits/SkipEditHandler.d.ts.map +1 -0
- package/lib/esm/Merging/Edits/SkipEditHandler.js +60 -0
- package/lib/esm/Merging/Edits/SkipEditHandler.js.map +1 -0
- package/lib/esm/Merging/EntityClassMerger.d.ts +19 -0
- package/lib/esm/Merging/EntityClassMerger.d.ts.map +1 -0
- package/lib/esm/Merging/EntityClassMerger.js +39 -0
- package/lib/esm/Merging/EntityClassMerger.js.map +1 -0
- package/lib/esm/Merging/EnumerationMerger.d.ts +14 -0
- package/lib/esm/Merging/EnumerationMerger.d.ts.map +1 -0
- package/lib/esm/Merging/EnumerationMerger.js +48 -0
- package/lib/esm/Merging/EnumerationMerger.js.map +1 -0
- package/lib/esm/Merging/EnumeratorMerger.d.ts +14 -0
- package/lib/esm/Merging/EnumeratorMerger.d.ts.map +1 -0
- package/lib/esm/Merging/EnumeratorMerger.js +36 -0
- package/lib/esm/Merging/EnumeratorMerger.js.map +1 -0
- package/lib/esm/Merging/FormatMerger.d.ts +24 -0
- package/lib/esm/Merging/FormatMerger.d.ts.map +1 -0
- package/lib/esm/Merging/FormatMerger.js +137 -0
- package/lib/esm/Merging/FormatMerger.js.map +1 -0
- package/lib/esm/Merging/InvertedUnitMerger.d.ts +14 -0
- package/lib/esm/Merging/InvertedUnitMerger.d.ts.map +1 -0
- package/lib/esm/Merging/InvertedUnitMerger.js +41 -0
- package/lib/esm/Merging/InvertedUnitMerger.js.map +1 -0
- package/lib/esm/Merging/KindOfQuantityMerger.d.ts +19 -0
- package/lib/esm/Merging/KindOfQuantityMerger.d.ts.map +1 -0
- package/lib/esm/Merging/KindOfQuantityMerger.js +89 -0
- package/lib/esm/Merging/KindOfQuantityMerger.js.map +1 -0
- package/lib/esm/Merging/MixinMerger.d.ts +14 -0
- package/lib/esm/Merging/MixinMerger.d.ts.map +1 -0
- package/lib/esm/Merging/MixinMerger.js +33 -0
- package/lib/esm/Merging/MixinMerger.js.map +1 -0
- package/lib/esm/Merging/PhenomenonMerger.d.ts +14 -0
- package/lib/esm/Merging/PhenomenonMerger.d.ts.map +1 -0
- package/lib/esm/Merging/PhenomenonMerger.js +36 -0
- package/lib/esm/Merging/PhenomenonMerger.js.map +1 -0
- package/lib/esm/Merging/PropertyCategoryMerger.d.ts +14 -0
- package/lib/esm/Merging/PropertyCategoryMerger.d.ts.map +1 -0
- package/lib/esm/Merging/PropertyCategoryMerger.js +31 -0
- package/lib/esm/Merging/PropertyCategoryMerger.js.map +1 -0
- package/lib/esm/Merging/PropertyMerger.d.ts +12 -0
- package/lib/esm/Merging/PropertyMerger.d.ts.map +1 -0
- package/lib/esm/Merging/PropertyMerger.js +228 -0
- package/lib/esm/Merging/PropertyMerger.js.map +1 -0
- package/lib/esm/Merging/RelationshipClassMerger.d.ts +27 -0
- package/lib/esm/Merging/RelationshipClassMerger.d.ts.map +1 -0
- package/lib/esm/Merging/RelationshipClassMerger.js +136 -0
- package/lib/esm/Merging/RelationshipClassMerger.js.map +1 -0
- package/lib/esm/Merging/SchemaMerger.d.ts +49 -0
- package/lib/esm/Merging/SchemaMerger.d.ts.map +1 -0
- package/lib/esm/Merging/SchemaMerger.js +117 -0
- package/lib/esm/Merging/SchemaMerger.js.map +1 -0
- package/lib/esm/Merging/SchemaMergingVisitor.d.ts +149 -0
- package/lib/esm/Merging/SchemaMergingVisitor.d.ts.map +1 -0
- package/lib/esm/Merging/SchemaMergingVisitor.js +339 -0
- package/lib/esm/Merging/SchemaMergingVisitor.js.map +1 -0
- package/lib/esm/Merging/SchemaMergingWalker.d.ts +19 -0
- package/lib/esm/Merging/SchemaMergingWalker.d.ts.map +1 -0
- package/lib/esm/Merging/SchemaMergingWalker.js +61 -0
- package/lib/esm/Merging/SchemaMergingWalker.js.map +1 -0
- package/lib/esm/Merging/SchemaReferenceMerger.d.ts +13 -0
- package/lib/esm/Merging/SchemaReferenceMerger.d.ts.map +1 -0
- package/lib/esm/Merging/SchemaReferenceMerger.js +57 -0
- package/lib/esm/Merging/SchemaReferenceMerger.js.map +1 -0
- package/lib/esm/Merging/StructClassMerger.d.ts +14 -0
- package/lib/esm/Merging/StructClassMerger.d.ts.map +1 -0
- package/lib/esm/Merging/StructClassMerger.js +20 -0
- package/lib/esm/Merging/StructClassMerger.js.map +1 -0
- package/lib/esm/Merging/UnitMerger.d.ts +14 -0
- package/lib/esm/Merging/UnitMerger.d.ts.map +1 -0
- package/lib/esm/Merging/UnitMerger.js +58 -0
- package/lib/esm/Merging/UnitMerger.js.map +1 -0
- package/lib/esm/Merging/UnitSystemMerger.d.ts +14 -0
- package/lib/esm/Merging/UnitSystemMerger.d.ts.map +1 -0
- package/lib/esm/Merging/UnitSystemMerger.js +24 -0
- package/lib/esm/Merging/UnitSystemMerger.js.map +1 -0
- package/lib/esm/Merging/Utils.d.ts +34 -0
- package/lib/esm/Merging/Utils.d.ts.map +1 -0
- package/lib/esm/Merging/Utils.js +90 -0
- package/lib/esm/Merging/Utils.js.map +1 -0
- package/lib/esm/Validation/Diagnostic.d.ts +322 -0
- package/lib/esm/Validation/Diagnostic.d.ts.map +1 -0
- package/lib/esm/Validation/Diagnostic.js +295 -0
- package/lib/esm/Validation/Diagnostic.js.map +1 -0
- package/lib/esm/Validation/DiagnosticReporter.d.ts +97 -0
- package/lib/esm/Validation/DiagnosticReporter.d.ts.map +1 -0
- package/lib/esm/Validation/DiagnosticReporter.js +105 -0
- package/lib/esm/Validation/DiagnosticReporter.js.map +1 -0
- package/lib/esm/Validation/ECRules.d.ts +454 -0
- package/lib/esm/Validation/ECRules.d.ts.map +1 -0
- package/lib/esm/Validation/ECRules.js +578 -0
- package/lib/esm/Validation/ECRules.js.map +1 -0
- package/lib/esm/Validation/LoggingDiagnosticReporter.d.ts +14 -0
- package/lib/esm/Validation/LoggingDiagnosticReporter.d.ts.map +1 -0
- package/lib/esm/Validation/LoggingDiagnosticReporter.js +37 -0
- package/lib/esm/Validation/LoggingDiagnosticReporter.js.map +1 -0
- package/lib/esm/Validation/RuleSuppressionSet.d.ts +60 -0
- package/lib/esm/Validation/RuleSuppressionSet.d.ts.map +1 -0
- package/lib/esm/Validation/RuleSuppressionSet.js +9 -0
- package/lib/esm/Validation/RuleSuppressionSet.js.map +1 -0
- package/lib/esm/Validation/Rules.d.ts +65 -0
- package/lib/esm/Validation/Rules.d.ts.map +1 -0
- package/lib/esm/Validation/Rules.js +9 -0
- package/lib/esm/Validation/Rules.js.map +1 -0
- package/lib/esm/Validation/SchemaChanges.d.ts +640 -0
- package/lib/esm/Validation/SchemaChanges.d.ts.map +1 -0
- package/lib/esm/Validation/SchemaChanges.js +1141 -0
- package/lib/esm/Validation/SchemaChanges.js.map +1 -0
- package/lib/esm/Validation/SchemaCompareDiagnostics.d.ts +423 -0
- package/lib/esm/Validation/SchemaCompareDiagnostics.d.ts.map +1 -0
- package/lib/esm/Validation/SchemaCompareDiagnostics.js +109 -0
- package/lib/esm/Validation/SchemaCompareDiagnostics.js.map +1 -0
- package/lib/esm/Validation/SchemaCompareReporter.d.ts +12 -0
- package/lib/esm/Validation/SchemaCompareReporter.d.ts.map +1 -0
- package/lib/esm/Validation/SchemaCompareReporter.js +9 -0
- package/lib/esm/Validation/SchemaCompareReporter.js.map +1 -0
- package/lib/esm/Validation/SchemaCompareResultDelegate.d.ts +237 -0
- package/lib/esm/Validation/SchemaCompareResultDelegate.d.ts.map +1 -0
- package/lib/esm/Validation/SchemaCompareResultDelegate.js +346 -0
- package/lib/esm/Validation/SchemaCompareResultDelegate.js.map +1 -0
- package/lib/esm/Validation/SchemaCompareVisitor.d.ts +120 -0
- package/lib/esm/Validation/SchemaCompareVisitor.d.ts.map +1 -0
- package/lib/esm/Validation/SchemaCompareVisitor.js +222 -0
- package/lib/esm/Validation/SchemaCompareVisitor.js.map +1 -0
- package/lib/esm/Validation/SchemaComparer.d.ts +211 -0
- package/lib/esm/Validation/SchemaComparer.d.ts.map +1 -0
- package/lib/esm/Validation/SchemaComparer.js +770 -0
- package/lib/esm/Validation/SchemaComparer.js.map +1 -0
- package/lib/esm/Validation/SchemaValidater.d.ts +20 -0
- package/lib/esm/Validation/SchemaValidater.d.ts.map +1 -0
- package/lib/esm/Validation/SchemaValidater.js +55 -0
- package/lib/esm/Validation/SchemaValidater.js.map +1 -0
- package/lib/esm/Validation/SchemaValidationVisitor.d.ts +171 -0
- package/lib/esm/Validation/SchemaValidationVisitor.d.ts.map +1 -0
- package/lib/esm/Validation/SchemaValidationVisitor.js +488 -0
- package/lib/esm/Validation/SchemaValidationVisitor.js.map +1 -0
- package/lib/esm/Validation/SchemaWalker.d.ts +23 -0
- package/lib/esm/Validation/SchemaWalker.d.ts.map +1 -0
- package/lib/esm/Validation/SchemaWalker.js +50 -0
- package/lib/esm/Validation/SchemaWalker.js.map +1 -0
- package/lib/esm/ecschema-editing.d.ts +49 -0
- package/lib/esm/ecschema-editing.d.ts.map +1 -0
- package/lib/esm/ecschema-editing.js +52 -0
- package/lib/esm/ecschema-editing.js.map +1 -0
- package/package.json +12 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelationshipClasses.d.ts","sourceRoot":"","sources":["../../../src/Editing/RelationshipClasses.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,eAAe,EAAoC,eAAe,EAAE,WAAW,EAAyC,KAAK,EAAE,uBAAuB,EACtJ,iBAAiB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,eAAe,EAAE,wBAAwB,EAAE,aAAa,EAC3H,SAAS,EAAE,iBAAiB,EAAE,YAAY,EAC3C,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,OAAO,EAAE,oBAAo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AC;IAKpH,wBAAwB,CAAC,UAAU,EAAE,sBAAsB,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjG,4BAA4B,CAAC,UAAU,EAAE,sBAAsB,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjH,qBAAqB,CAAC,UAAU,EAAE,sBAAsB,EAAE,kBAAkB,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAyBtI,kBAAkB,CAAC,UAAU,EAAE,sBAAsB,EAAE,OAAO,EAAE,WAAW,GAAG,KAAK,GAAG,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBvH,qBAAqB,CAAC,UAAU,EAAE,sBAAsB,EAAE,OAAO,EAAE,WAAW,GAAG,KAAK,GAAG,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAY1H,8BAA8B,CAAC,UAAU,EAAE,sBAAsB,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;YAkBlH,QAAQ;CAyBvB"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Editing
|
|
7
|
+
*/
|
|
8
|
+
import { DelayedPromiseWithProps, RelationshipClass, SchemaItemType, } from "@itwin/ecschema-metadata";
|
|
9
|
+
import { ECClasses } from "./ECClasses";
|
|
10
|
+
import { MutableRelationshipClass } from "./Mutable/MutableRelationshipClass";
|
|
11
|
+
import * as Rules from "../Validation/ECRules";
|
|
12
|
+
import { NavigationProperties } from "./Properties";
|
|
13
|
+
import { ClassId, CustomAttributeId, ECEditingStatus, RelationshipConstraintId, SchemaEditingError } from "./Exception";
|
|
14
|
+
/**
|
|
15
|
+
* @alpha
|
|
16
|
+
* A class extending ECClasses allowing you to create schema items of type RelationshipClass.
|
|
17
|
+
*/
|
|
18
|
+
export class RelationshipClasses extends ECClasses {
|
|
19
|
+
get itemTypeClass() {
|
|
20
|
+
return RelationshipClass;
|
|
21
|
+
}
|
|
22
|
+
constructor(schemaEditor) {
|
|
23
|
+
super(SchemaItemType.RelationshipClass, schemaEditor);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Allows access for editing of NavigationProperty attributes.
|
|
27
|
+
*/
|
|
28
|
+
navigationProperties = new NavigationProperties(this.schemaItemType, this.schemaEditor);
|
|
29
|
+
/**
|
|
30
|
+
* Creates a RelationshipClass.
|
|
31
|
+
* @param schemaKey a SchemaKey of the Schema that will house the new object.
|
|
32
|
+
* @param name The name of the new class.
|
|
33
|
+
* @param modifier The ECClassModifier of the new class.
|
|
34
|
+
* @param strength The relationship StrengthType of the class.
|
|
35
|
+
* @param StrengthDirection The relationship StrengthDirection of the class.
|
|
36
|
+
* @param baseClassKey An optional SchemaItemKey that specifies the base relationship class.
|
|
37
|
+
*/
|
|
38
|
+
async create(schemaKey, name, modifier, strength, direction, baseClassKey) {
|
|
39
|
+
try {
|
|
40
|
+
const newClass = await this.createClass(schemaKey, this.schemaItemType, (schema) => schema.createRelationshipClass.bind(schema), name, baseClassKey, modifier);
|
|
41
|
+
newClass.setStrength(strength);
|
|
42
|
+
newClass.setStrengthDirection(direction);
|
|
43
|
+
return newClass.key;
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new ClassId(this.schemaItemType, name, schemaKey), e);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Sets the source RelationshipConstraint on the relationship.
|
|
51
|
+
* @param relationshipKey The SchemaItemKey for the relationship.
|
|
52
|
+
* @param source The RelationshipConstraint to add.
|
|
53
|
+
*/
|
|
54
|
+
async setSourceConstraint(relationshipKey, source) {
|
|
55
|
+
const relationship = await this.getSchemaItem(relationshipKey, MutableRelationshipClass)
|
|
56
|
+
.catch((e) => {
|
|
57
|
+
throw new SchemaEditingError(ECEditingStatus.SetSourceConstraint, new ClassId(this.schemaItemType, relationshipKey), e);
|
|
58
|
+
});
|
|
59
|
+
relationship.setSourceConstraint(source);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Sets the target RelationshipConstraint on the relationship.
|
|
63
|
+
* @param relationshipKey The SchemaItemKey for the relationship.
|
|
64
|
+
* @param target The RelationshipConstraint to add.
|
|
65
|
+
*/
|
|
66
|
+
async setTargetConstraint(relationshipKey, target) {
|
|
67
|
+
const relationship = await this.getSchemaItem(relationshipKey, MutableRelationshipClass)
|
|
68
|
+
.catch((e) => {
|
|
69
|
+
throw new SchemaEditingError(ECEditingStatus.SetTargetConstraint, new ClassId(this.schemaItemType, relationshipKey), e);
|
|
70
|
+
});
|
|
71
|
+
relationship.setTargetConstraint(target);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Creates a RelationshipClass through a RelationshipClassProps.
|
|
75
|
+
* @param schemaKey a SchemaKey of the Schema that will house the new object.
|
|
76
|
+
* @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.
|
|
77
|
+
*/
|
|
78
|
+
async createFromProps(schemaKey, relationshipProps) {
|
|
79
|
+
try {
|
|
80
|
+
const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createRelationshipClass.bind(schema), relationshipProps);
|
|
81
|
+
await newClass.source.fromJSON(relationshipProps.source);
|
|
82
|
+
await newClass.target.fromJSON(relationshipProps.target);
|
|
83
|
+
return newClass.key;
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, relationshipProps.name, schemaKey), e);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Sets the base class of a RelationshipClass.
|
|
91
|
+
* @param relationshipKey The SchemaItemKey of the RelationshipClass.
|
|
92
|
+
* @param baseClassKey The SchemaItemKey of the base class. Specifying 'undefined' removes the base class.
|
|
93
|
+
*/
|
|
94
|
+
async setBaseClass(itemKey, baseClassKey) {
|
|
95
|
+
const relClass = await this.schemaEditor.schemaContext.getSchemaItem(itemKey, RelationshipClass)
|
|
96
|
+
.catch((e) => {
|
|
97
|
+
throw new SchemaEditingError(ECEditingStatus.SetBaseClass, new ClassId(this.schemaItemType, itemKey), e);
|
|
98
|
+
});
|
|
99
|
+
const baseClass = relClass?.baseClass;
|
|
100
|
+
await super.setBaseClass(itemKey, baseClassKey);
|
|
101
|
+
try {
|
|
102
|
+
await this.validate(relClass);
|
|
103
|
+
}
|
|
104
|
+
catch (e) {
|
|
105
|
+
await relClass.setBaseClass(baseClass);
|
|
106
|
+
throw new SchemaEditingError(ECEditingStatus.SetBaseClass, new ClassId(SchemaItemType.RelationshipClass, itemKey), e);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
async createNavigationProperty(relationshipKey, name, relationship, direction) {
|
|
110
|
+
try {
|
|
111
|
+
const relationshipClass = await this.getSchemaItem(relationshipKey, MutableRelationshipClass);
|
|
112
|
+
await relationshipClass.createNavigationProperty(name, relationship, direction);
|
|
113
|
+
}
|
|
114
|
+
catch (e) {
|
|
115
|
+
throw new SchemaEditingError(ECEditingStatus.CreateNavigationProperty, new ClassId(SchemaItemType.RelationshipClass, relationshipKey), e);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Creates a Navigation Property through a NavigationPropertyProps.
|
|
120
|
+
* @param classKey a SchemaItemKey of the Relationship Class that will house the new property.
|
|
121
|
+
* @param navigationProps a json object that will be used to populate the new Navigation Property.
|
|
122
|
+
*/
|
|
123
|
+
async createNavigationPropertyFromProps(relationshipKey, navigationProps) {
|
|
124
|
+
try {
|
|
125
|
+
const relationshipClass = await this.getSchemaItem(relationshipKey, MutableRelationshipClass);
|
|
126
|
+
const property = await relationshipClass.createNavigationProperty(navigationProps.name, navigationProps.relationshipName, navigationProps.direction);
|
|
127
|
+
await property.fromJSON(navigationProps);
|
|
128
|
+
}
|
|
129
|
+
catch (e) {
|
|
130
|
+
throw new SchemaEditingError(ECEditingStatus.CreateNavigationPropertyFromProps, new ClassId(SchemaItemType.RelationshipClass, relationshipKey), e);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async setConstraintMultiplicity(constraint, multiplicity) {
|
|
134
|
+
const mutableConstraint = constraint;
|
|
135
|
+
mutableConstraint.multiplicity = multiplicity;
|
|
136
|
+
}
|
|
137
|
+
async setConstraintPolymorphic(constraint, polymorphic) {
|
|
138
|
+
const mutableConstraint = constraint;
|
|
139
|
+
mutableConstraint.polymorphic = polymorphic;
|
|
140
|
+
}
|
|
141
|
+
async setConstraintRelationshipEnd(constraint, relationshipEnd) {
|
|
142
|
+
const mutableConstraint = constraint;
|
|
143
|
+
mutableConstraint.relationshipEnd = relationshipEnd;
|
|
144
|
+
}
|
|
145
|
+
async setAbstractConstraint(constraint, abstractConstraint) {
|
|
146
|
+
const existing = constraint.abstractConstraint;
|
|
147
|
+
const mutableConstraint = constraint;
|
|
148
|
+
if (undefined === abstractConstraint) {
|
|
149
|
+
mutableConstraint.abstractConstraint = undefined;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
mutableConstraint.abstractConstraint = new DelayedPromiseWithProps(abstractConstraint.key, async () => abstractConstraint);
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
await this.validate(constraint.relationshipClass);
|
|
156
|
+
}
|
|
157
|
+
catch (e) {
|
|
158
|
+
mutableConstraint.abstractConstraint = existing;
|
|
159
|
+
throw new SchemaEditingError(ECEditingStatus.SetAbstractConstraint, new RelationshipConstraintId(constraint), e);
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
await this.validate(constraint);
|
|
163
|
+
}
|
|
164
|
+
catch (e) {
|
|
165
|
+
mutableConstraint.abstractConstraint = existing;
|
|
166
|
+
throw new SchemaEditingError(ECEditingStatus.SetAbstractConstraint, new RelationshipConstraintId(constraint), e);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async addConstraintClass(constraint, ecClass) {
|
|
170
|
+
const mutableConstraint = constraint;
|
|
171
|
+
mutableConstraint.addClass(ecClass);
|
|
172
|
+
try {
|
|
173
|
+
await this.validate(constraint.relationshipClass);
|
|
174
|
+
}
|
|
175
|
+
catch (e) {
|
|
176
|
+
mutableConstraint.removeClass(ecClass);
|
|
177
|
+
throw new SchemaEditingError(ECEditingStatus.AddConstraintClass, new RelationshipConstraintId(constraint), e);
|
|
178
|
+
}
|
|
179
|
+
try {
|
|
180
|
+
await this.validate(constraint);
|
|
181
|
+
}
|
|
182
|
+
catch (e) {
|
|
183
|
+
mutableConstraint.removeClass(ecClass);
|
|
184
|
+
throw new SchemaEditingError(ECEditingStatus.AddConstraintClass, new RelationshipConstraintId(constraint), e);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
async removeConstraintClass(constraint, ecClass) {
|
|
188
|
+
const mutableConstraint = constraint;
|
|
189
|
+
mutableConstraint.removeClass(ecClass);
|
|
190
|
+
try {
|
|
191
|
+
await this.validate(constraint);
|
|
192
|
+
}
|
|
193
|
+
catch (e) {
|
|
194
|
+
mutableConstraint.addClass(ecClass);
|
|
195
|
+
throw new SchemaEditingError(ECEditingStatus.RemoveConstraintClass, new RelationshipConstraintId(constraint), e);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
async addCustomAttributeToConstraint(constraint, customAttribute) {
|
|
199
|
+
const mutableConstraint = constraint;
|
|
200
|
+
mutableConstraint.addCustomAttribute(customAttribute);
|
|
201
|
+
const diagnosticIterable = Rules.validateCustomAttributeInstance(constraint, customAttribute);
|
|
202
|
+
const diagnostics = [];
|
|
203
|
+
for await (const diagnostic of diagnosticIterable) {
|
|
204
|
+
diagnostics.push(diagnostic);
|
|
205
|
+
}
|
|
206
|
+
if (diagnostics.length > 0) {
|
|
207
|
+
this.removeCustomAttribute(constraint, customAttribute);
|
|
208
|
+
throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToConstraint, new RelationshipConstraintId(constraint), new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, constraint), undefined, diagnostics));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
async validate(relationshipOrConstraint) {
|
|
212
|
+
let diagnosticIterable;
|
|
213
|
+
let relationshipKey;
|
|
214
|
+
if (relationshipOrConstraint instanceof RelationshipClass) {
|
|
215
|
+
diagnosticIterable = Rules.validateRelationship(relationshipOrConstraint);
|
|
216
|
+
relationshipKey = relationshipOrConstraint.key;
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
diagnosticIterable = Rules.validateRelationshipConstraint(relationshipOrConstraint);
|
|
220
|
+
relationshipKey = relationshipOrConstraint.relationshipClass.key;
|
|
221
|
+
}
|
|
222
|
+
const diagnostics = [];
|
|
223
|
+
for await (const diagnostic of diagnosticIterable) {
|
|
224
|
+
diagnostics.push(diagnostic);
|
|
225
|
+
}
|
|
226
|
+
if (diagnostics.length > 0) {
|
|
227
|
+
if (relationshipOrConstraint instanceof RelationshipClass) {
|
|
228
|
+
throw new SchemaEditingError(ECEditingStatus.RuleViolation, new ClassId(SchemaItemType.RelationshipClass, relationshipKey), undefined, diagnostics);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
throw new SchemaEditingError(ECEditingStatus.RuleViolation, new RelationshipConstraintId(relationshipOrConstraint), undefined, diagnostics);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=RelationshipClasses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelationshipClasses.js","sourceRoot":"","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AAkB,GAAG,KAAK,CAAC,8BAA8B,CAAC,wBAAwB,CAAC,CAAC;YACpF,eAAe,GAAG,wBAAwB,CAAC,iBAAiB,CAAC,GAAG,CAAC;QACnE,CAAC;QAED,MAAM,WAAW,GAAoB,EAAE,CAAC;QACxC,IAAI,KAAK,EAAE,MAAM,UAAU,IAAI,kBAAkB,EAAE,CAAC;YAClD,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/B,CAAC;QAED,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,IAAI,wBAAwB,YAAY,iBAAiB,EAAE,CAAC;gBAC1D,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,aAAa,EAAE,IAAI,OAAO,CAAC,cAAc,CAAC,iBAAiB,EAAE,eAAe,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;YACtJ,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,aAAa,EAAE,IAAI,wBAAwB,CAAC,wBAAwB,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;YAC9I,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport {\n CustomAttribute, DelayedPromiseWithProps, ECClass, ECClassModifier, EntityClass, LazyLoadedRelationshipConstraintClass, Mixin, NavigationPropertyProps,\n RelationshipClass, RelationshipClassProps, RelationshipConstraint, RelationshipEnd, RelationshipMultiplicity, SchemaItemKey, SchemaItemType,\n SchemaKey, StrengthDirection, StrengthType,\n} from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport { ECClasses } from \"./ECClasses\";\nimport { MutableRelationshipClass, MutableRelationshipConstraint } from \"./Mutable/MutableRelationshipClass\";\nimport * as Rules from \"../Validation/ECRules\";\nimport { AnyDiagnostic, RelationshipConstraintDiagnostic, SchemaItemDiagnostic } from \"../Validation/Diagnostic\";\nimport { NavigationProperties } from \"./Properties\";\nimport { ClassId, CustomAttributeId, ECEditingStatus, RelationshipConstraintId, SchemaEditingError } from \"./Exception\";\nimport { MutableClass } from \"./Mutable/MutableClass\";\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 protected override get itemTypeClass(): typeof RelationshipClass {\n return RelationshipClass;\n }\n\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<SchemaItemKey> {\n try {\n const newClass = await this.createClass<RelationshipClass>(schemaKey, this.schemaItemType, (schema) => schema.createRelationshipClass.bind(schema), name, baseClassKey, modifier) as MutableRelationshipClass;\n\n newClass.setStrength(strength);\n newClass.setStrengthDirection(direction);\n\n return newClass.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new ClassId(this.schemaItemType, name, schemaKey), e);\n }\n }\n\n /**\n * Sets the source RelationshipConstraint on the relationship.\n * @param relationshipKey The SchemaItemKey for the relationship.\n * @param source The RelationshipConstraint to add.\n */\n public async setSourceConstraint(relationshipKey: SchemaItemKey, source: RelationshipConstraint): Promise<void> {\n const relationship = await this.getSchemaItem(relationshipKey, MutableRelationshipClass)\n .catch((e) => {\n throw new SchemaEditingError(ECEditingStatus.SetSourceConstraint, new ClassId(this.schemaItemType, relationshipKey), e);\n });\n\n relationship.setSourceConstraint(source);\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 */\n public async setTargetConstraint(relationshipKey: SchemaItemKey, target: RelationshipConstraint): Promise<void> {\n const relationship = await this.getSchemaItem(relationshipKey, MutableRelationshipClass)\n .catch((e) => {\n throw new SchemaEditingError(ECEditingStatus.SetTargetConstraint, new ClassId(this.schemaItemType, relationshipKey), e);\n });\n\n relationship.setTargetConstraint(target);\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<SchemaItemKey> {\n try {\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createRelationshipClass.bind(schema), relationshipProps);\n\n await newClass.source.fromJSON(relationshipProps.source);\n await newClass.target.fromJSON(relationshipProps.target);\n\n return newClass.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, relationshipProps.name!, schemaKey), e);\n }\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<void> {\n const relClass = await this.schemaEditor.schemaContext.getSchemaItem(itemKey, RelationshipClass)\n .catch((e) => {\n throw new SchemaEditingError(ECEditingStatus.SetBaseClass, new ClassId(this.schemaItemType, itemKey), e);\n });\n const baseClass = relClass?.baseClass;\n\n await super.setBaseClass(itemKey, baseClassKey);\n\n try {\n await this.validate(relClass!);\n } catch(e: any) {\n await (relClass! as ECClass as MutableClass).setBaseClass(baseClass);\n throw new SchemaEditingError(ECEditingStatus.SetBaseClass, new ClassId(SchemaItemType.RelationshipClass, itemKey), e);\n }\n }\n\n public async createNavigationProperty(relationshipKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<void> {\n try {\n const relationshipClass = await this.getSchemaItem(relationshipKey, MutableRelationshipClass);\n await relationshipClass.createNavigationProperty(name, relationship, direction);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateNavigationProperty, new ClassId(SchemaItemType.RelationshipClass, relationshipKey), e);\n }\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<void> {\n try {\n const relationshipClass = await this.getSchemaItem(relationshipKey, MutableRelationshipClass);\n const property = await relationshipClass.createNavigationProperty(navigationProps.name, navigationProps.relationshipName, navigationProps.direction);\n await property.fromJSON(navigationProps);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateNavigationPropertyFromProps, new ClassId(SchemaItemType.RelationshipClass, relationshipKey), e);\n }\n }\n\n public async setConstraintMultiplicity(constraint: RelationshipConstraint, multiplicity: RelationshipMultiplicity): Promise<void> {\n const mutableConstraint = constraint as MutableRelationshipConstraint;\n mutableConstraint.multiplicity = multiplicity;\n }\n\n public async setConstraintPolymorphic(constraint: RelationshipConstraint, polymorphic: boolean): Promise<void> {\n const mutableConstraint = constraint as MutableRelationshipConstraint;\n mutableConstraint.polymorphic = polymorphic;\n }\n\n public async setConstraintRelationshipEnd(constraint: RelationshipConstraint, relationshipEnd: RelationshipEnd): Promise<void> {\n const mutableConstraint = constraint as MutableRelationshipConstraint;\n mutableConstraint.relationshipEnd = relationshipEnd;\n }\n\n public async setAbstractConstraint(constraint: RelationshipConstraint, abstractConstraint?: EntityClass | Mixin | RelationshipClass): Promise<void> {\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 try {\n await this.validate(constraint.relationshipClass);\n } catch(e: any){\n mutableConstraint.abstractConstraint = existing;\n throw new SchemaEditingError(ECEditingStatus.SetAbstractConstraint, new RelationshipConstraintId(constraint), e);\n }\n\n try {\n await this.validate(constraint);\n } catch(e: any){\n mutableConstraint.abstractConstraint = existing;\n throw new SchemaEditingError(ECEditingStatus.SetAbstractConstraint, new RelationshipConstraintId(constraint), e);\n }\n }\n\n public async addConstraintClass(constraint: RelationshipConstraint, ecClass: EntityClass | Mixin | RelationshipClass): Promise<void> {\n const mutableConstraint = constraint as MutableRelationshipConstraint;\n mutableConstraint.addClass(ecClass);\n\n try {\n await this.validate(constraint.relationshipClass);\n } catch(e: any){\n mutableConstraint.removeClass(ecClass);\n throw new SchemaEditingError(ECEditingStatus.AddConstraintClass, new RelationshipConstraintId(constraint), e);\n }\n\n try {\n await this.validate(constraint);\n } catch(e: any){\n mutableConstraint.removeClass(ecClass);\n throw new SchemaEditingError(ECEditingStatus.AddConstraintClass, new RelationshipConstraintId(constraint), e);\n }\n }\n\n public async removeConstraintClass(constraint: RelationshipConstraint, ecClass: EntityClass | Mixin | RelationshipClass): Promise<void> {\n const mutableConstraint = constraint as MutableRelationshipConstraint;\n mutableConstraint.removeClass(ecClass);\n\n try{\n await this.validate(constraint);\n } catch(e: any) {\n mutableConstraint.addClass(ecClass);\n throw new SchemaEditingError(ECEditingStatus.RemoveConstraintClass, new RelationshipConstraintId(constraint), e);\n }\n }\n\n public async addCustomAttributeToConstraint(constraint: RelationshipConstraint, customAttribute: CustomAttribute): Promise<void> {\n const mutableConstraint = constraint as MutableRelationshipConstraint;\n mutableConstraint.addCustomAttribute(customAttribute);\n\n const diagnosticIterable = Rules.validateCustomAttributeInstance(constraint, customAttribute);\n\n const diagnostics: AnyDiagnostic[] = [];\n for await (const diagnostic of diagnosticIterable) {\n diagnostics.push(diagnostic);\n }\n\n if (diagnostics.length > 0) {\n this.removeCustomAttribute(constraint, customAttribute);\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToConstraint, new RelationshipConstraintId(constraint),\n new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, constraint), undefined, diagnostics));\n }\n }\n\n private async validate(relationshipOrConstraint: RelationshipClass | RelationshipConstraint): Promise<void> {\n let diagnosticIterable: AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> | AsyncIterable<RelationshipConstraintDiagnostic<any[]>>;\n let relationshipKey: SchemaItemKey | string;\n\n if (relationshipOrConstraint instanceof RelationshipClass) {\n diagnosticIterable = Rules.validateRelationship(relationshipOrConstraint);\n relationshipKey = relationshipOrConstraint.key;\n } else {\n diagnosticIterable = Rules.validateRelationshipConstraint(relationshipOrConstraint);\n relationshipKey = relationshipOrConstraint.relationshipClass.key;\n }\n\n const diagnostics: AnyDiagnostic[] = [];\n for await (const diagnostic of diagnosticIterable) {\n diagnostics.push(diagnostic);\n }\n\n if (diagnostics.length > 0) {\n if (relationshipOrConstraint instanceof RelationshipClass) {\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new ClassId(SchemaItemType.RelationshipClass, relationshipKey), undefined, diagnostics);\n } else {\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new RelationshipConstraintId(relationshipOrConstraint), undefined, diagnostics);\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Editing
|
|
3
|
+
*/
|
|
4
|
+
import { SchemaItem, SchemaItemKey, SchemaItemProps, SchemaItemType, SchemaKey } from "@itwin/ecschema-metadata";
|
|
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>;
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
* A class allowing you to edit the schema item base class.
|
|
12
|
+
*/
|
|
13
|
+
export declare abstract class SchemaItems {
|
|
14
|
+
protected schemaItemType: SchemaItemType;
|
|
15
|
+
protected schemaEditor: SchemaContextEditor;
|
|
16
|
+
protected abstract get itemTypeClass(): typeof SchemaItem;
|
|
17
|
+
constructor(schemaItemType: SchemaItemType, schemaEditor: SchemaContextEditor);
|
|
18
|
+
/**
|
|
19
|
+
* Sets the name of the SchemaItem.
|
|
20
|
+
* @param itemKey The SchemaItemKey of the SchemaItem.
|
|
21
|
+
* @param name The new name of the SchemaItem.
|
|
22
|
+
* @throws ECObjectsError if `name` does not meet the criteria for a valid EC name
|
|
23
|
+
*/
|
|
24
|
+
setName(itemKey: SchemaItemKey, name: string): Promise<SchemaItemKey>;
|
|
25
|
+
/**
|
|
26
|
+
* Sets the SchemaItem description.
|
|
27
|
+
* @param schemaItemKey The SchemaItemKey of the SchemaItem
|
|
28
|
+
* @param description The new description to set.
|
|
29
|
+
*/
|
|
30
|
+
setDescription(schemaItemKey: SchemaItemKey, description: string): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Sets the SchemaItem display label.
|
|
33
|
+
* @param schemaItemKey The SchemaItemKey of the SchemaItem
|
|
34
|
+
* @param label The new label to set.
|
|
35
|
+
*/
|
|
36
|
+
setDisplayLabel(schemaItemKey: SchemaItemKey, label: string): Promise<void>;
|
|
37
|
+
protected getSchema(schemaKey: SchemaKey): Promise<MutableSchema>;
|
|
38
|
+
protected getSchemaItem<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): Promise<InstanceType<T>>;
|
|
39
|
+
protected createSchemaItem<T extends SchemaItem>(schemaKey: SchemaKey, type: SchemaItemType, create: CreateSchemaItem<T>, name: string, ...args: any[]): Promise<T>;
|
|
40
|
+
protected createSchemaItemFromProps<T extends SchemaItem>(schemaKey: SchemaKey, type: SchemaItemType, create: CreateSchemaItem<T>, props: SchemaItemProps): Promise<T>;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=SchemaItems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaItems.d.ts","sourceRoot":"","sources":["../../../src/Editing/SchemaItems.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAmC,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAClJ,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,MAAM,EAAE,aAAa,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAC7H,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAErH;;;GAGG;AACH,8BAAsB,WAAW;IAC/B,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;IACzC,SAAS,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAE5C,SAAS,CAAC,QAAQ,KAAK,aAAa,IAAI,OAAO,UAAU,CAAC;gBAEvC,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,mBAAmB;IAKpF;;;;;OAKG;IACU,OAAO,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IA0BlF;;;;OAIG;IACU,cAAc,CAAC,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM;IAQ7E;;;;OAIG;IACU,eAAe,CAAC,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM;cAQxD,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC;cAQvD,aAAa,CAAC,CAAC,SAAS,OAAO,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;cAItH,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,SAAS,EAAE,SAAS,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"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Editing
|
|
7
|
+
*/
|
|
8
|
+
import { ECObjectsError, ECObjectsStatus } from "@itwin/ecschema-metadata";
|
|
9
|
+
import { ECEditingStatus, SchemaEditingError, SchemaId, SchemaItemId } from "./Exception";
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
* A class allowing you to edit the schema item base class.
|
|
13
|
+
*/
|
|
14
|
+
export class SchemaItems {
|
|
15
|
+
schemaItemType;
|
|
16
|
+
schemaEditor;
|
|
17
|
+
constructor(schemaItemType, schemaEditor) {
|
|
18
|
+
this.schemaItemType = schemaItemType;
|
|
19
|
+
this.schemaEditor = schemaEditor;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Sets the name of the SchemaItem.
|
|
23
|
+
* @param itemKey The SchemaItemKey of the SchemaItem.
|
|
24
|
+
* @param name The new name of the SchemaItem.
|
|
25
|
+
* @throws ECObjectsError if `name` does not meet the criteria for a valid EC name
|
|
26
|
+
*/
|
|
27
|
+
async setName(itemKey, name) {
|
|
28
|
+
try {
|
|
29
|
+
const schema = await this.getSchema(itemKey.schemaKey);
|
|
30
|
+
const ecClass = await schema.getItem(name, this.itemTypeClass);
|
|
31
|
+
if (ecClass !== undefined)
|
|
32
|
+
throw new SchemaEditingError(ECEditingStatus.SchemaItemNameAlreadyExists, new SchemaItemId(this.schemaItemType, name, schema.schemaKey));
|
|
33
|
+
const mutableItem = await this.getSchemaItem(itemKey, this.itemTypeClass);
|
|
34
|
+
const existingName = itemKey.name;
|
|
35
|
+
mutableItem.setName(name);
|
|
36
|
+
// Must reset in schema item map
|
|
37
|
+
await schema.deleteSchemaItem(existingName);
|
|
38
|
+
schema.addItem(mutableItem);
|
|
39
|
+
return mutableItem.key;
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
if (e instanceof ECObjectsError && e.errorNumber === ECObjectsStatus.InvalidECName) {
|
|
43
|
+
throw new SchemaEditingError(ECEditingStatus.SetClassName, new SchemaItemId(this.schemaItemType, itemKey), new SchemaEditingError(ECEditingStatus.InvalidECName, new SchemaItemId(this.schemaItemType, itemKey)));
|
|
44
|
+
}
|
|
45
|
+
throw new SchemaEditingError(ECEditingStatus.SetClassName, new SchemaItemId(this.schemaItemType, itemKey), e);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Sets the SchemaItem description.
|
|
50
|
+
* @param schemaItemKey The SchemaItemKey of the SchemaItem
|
|
51
|
+
* @param description The new description to set.
|
|
52
|
+
*/
|
|
53
|
+
async setDescription(schemaItemKey, description) {
|
|
54
|
+
const item = await this.getSchemaItem(schemaItemKey, this.itemTypeClass)
|
|
55
|
+
.catch((e) => {
|
|
56
|
+
throw new SchemaEditingError(ECEditingStatus.SetDescription, new SchemaItemId(this.schemaItemType, schemaItemKey), e);
|
|
57
|
+
});
|
|
58
|
+
item.setDescription(description);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Sets the SchemaItem display label.
|
|
62
|
+
* @param schemaItemKey The SchemaItemKey of the SchemaItem
|
|
63
|
+
* @param label The new label to set.
|
|
64
|
+
*/
|
|
65
|
+
async setDisplayLabel(schemaItemKey, label) {
|
|
66
|
+
const item = await this.getSchemaItem(schemaItemKey, this.itemTypeClass)
|
|
67
|
+
.catch((e) => {
|
|
68
|
+
throw new SchemaEditingError(ECEditingStatus.SetLabel, new SchemaItemId(this.schemaItemType, schemaItemKey), e);
|
|
69
|
+
});
|
|
70
|
+
item.setDisplayLabel(label);
|
|
71
|
+
}
|
|
72
|
+
async getSchema(schemaKey) {
|
|
73
|
+
const schema = await this.schemaEditor.getSchema(schemaKey);
|
|
74
|
+
if (schema === undefined)
|
|
75
|
+
throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));
|
|
76
|
+
return schema;
|
|
77
|
+
}
|
|
78
|
+
async getSchemaItem(schemaItemKey, itemConstructor) {
|
|
79
|
+
return this.schemaEditor.getSchemaItem(schemaItemKey, itemConstructor);
|
|
80
|
+
}
|
|
81
|
+
async createSchemaItem(schemaKey, type, create, name, ...args) {
|
|
82
|
+
const schema = await this.getSchema(schemaKey);
|
|
83
|
+
try {
|
|
84
|
+
const boundCreate = create(schema);
|
|
85
|
+
return await boundCreate(name, ...args);
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
if (e instanceof ECObjectsError && e.errorNumber === ECObjectsStatus.DuplicateItem) {
|
|
89
|
+
throw new SchemaEditingError(ECEditingStatus.SchemaItemNameAlreadyExists, new SchemaItemId(type, name, schema.schemaKey));
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
throw new Error(`Failed to create class ${name} in schema ${schema.fullName}.`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async createSchemaItemFromProps(schemaKey, type, create, props) {
|
|
97
|
+
if (props.name === undefined)
|
|
98
|
+
throw new SchemaEditingError(ECEditingStatus.SchemaItemNameNotSpecified, new SchemaItemId(type, "", schemaKey));
|
|
99
|
+
const newItem = await this.createSchemaItem(schemaKey, type, create, props.name);
|
|
100
|
+
await newItem.fromJSON(props);
|
|
101
|
+
return newItem;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=SchemaItems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaItems.js","sourceRoot":"","sources":["../../../src/Editing/SchemaItems.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAyE,MAAM,0BAA0B,CAAC;AAElJ,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAO1F;;;GAGG;AACH,MAAM,OAAgB,WAAW;IACrB,cAAc,CAAiB;IAC/B,YAAY,CAAsB;IAI5C,YAAmB,cAA8B,EAAE,YAAiC;QAClF,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,YAAY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,IAAI,CAAC,CAAC;QACpF,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAE9B,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { ECObjectsError, ECObjectsStatus, SchemaItem, SchemaItemKey, SchemaItemProps, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport { ECEditingStatus, SchemaEditingError, SchemaId, SchemaItemId } from \"./Exception\";\nimport { MutableSchema } from \"./Mutable/MutableSchema\";\nimport { MutableSchemaItem } from \"./Mutable/MutableSchemaItem\";\n\nexport type CreateSchemaItem<T extends SchemaItem> = (schema: MutableSchema) => (name: string, ...args: any[]) => Promise<T>;\nexport type CreateSchemaItemFromProps<T extends SchemaItem> = (props: SchemaItemProps, ...args: any[]) => Promise<T>;\n\n/**\n * @internal\n * A class allowing you to edit the schema item base class.\n */\nexport abstract class SchemaItems {\n protected schemaItemType: SchemaItemType;\n protected schemaEditor: SchemaContextEditor;\n\n protected abstract get itemTypeClass(): typeof SchemaItem;\n\n public constructor(schemaItemType: SchemaItemType, schemaEditor: SchemaContextEditor) {\n this.schemaItemType = schemaItemType;\n this.schemaEditor = schemaEditor;\n }\n\n /**\n * Sets the name of the SchemaItem.\n * @param itemKey The SchemaItemKey of the SchemaItem.\n * @param name The new name of the SchemaItem.\n * @throws ECObjectsError if `name` does not meet the criteria for a valid EC name\n */\n public async setName(itemKey: SchemaItemKey, name: string): Promise<SchemaItemKey> {\n try {\n const schema = await this.getSchema(itemKey.schemaKey);\n const ecClass = await schema.getItem(name, this.itemTypeClass);\n if (ecClass !== undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNameAlreadyExists, new SchemaItemId(this.schemaItemType, name, schema.schemaKey));\n\n const mutableItem = await this.getSchemaItem(itemKey, this.itemTypeClass) as MutableSchemaItem;\n\n const existingName = itemKey.name;\n mutableItem.setName(name);\n\n // Must reset in schema item map\n await schema.deleteSchemaItem(existingName);\n schema.addItem(mutableItem);\n return mutableItem.key;\n } catch(e: any) {\n if (e instanceof ECObjectsError && e.errorNumber === ECObjectsStatus.InvalidECName) {\n throw new SchemaEditingError(ECEditingStatus.SetClassName, new SchemaItemId(this.schemaItemType, itemKey),\n new SchemaEditingError(ECEditingStatus.InvalidECName, new SchemaItemId(this.schemaItemType, itemKey)));\n }\n\n throw new SchemaEditingError(ECEditingStatus.SetClassName, new SchemaItemId(this.schemaItemType, itemKey), e);\n }\n }\n\n /**\n * Sets the SchemaItem description.\n * @param schemaItemKey The SchemaItemKey of the SchemaItem\n * @param description The new description to set.\n */\n public async setDescription(schemaItemKey: SchemaItemKey, description: string) {\n const item = await this.getSchemaItem(schemaItemKey, this.itemTypeClass)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetDescription, new SchemaItemId(this.schemaItemType, schemaItemKey), e);\n });\n (item as MutableSchemaItem).setDescription(description);\n }\n\n /**\n * Sets the SchemaItem display label.\n * @param schemaItemKey The SchemaItemKey of the SchemaItem\n * @param label The new label to set.\n */\n public async setDisplayLabel(schemaItemKey: SchemaItemKey, label: string) {\n const item = await this.getSchemaItem(schemaItemKey, this.itemTypeClass)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetLabel, new SchemaItemId(this.schemaItemType, schemaItemKey), e);\n });\n (item as MutableSchemaItem).setDisplayLabel(label);\n }\n\n protected async getSchema(schemaKey: SchemaKey): Promise<MutableSchema> {\n const schema = await this.schemaEditor.getSchema(schemaKey);\n if (schema === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));\n\n return schema;\n }\n\n protected async getSchemaItem<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): Promise<InstanceType<T>> {\n return this.schemaEditor.getSchemaItem(schemaItemKey, itemConstructor);\n }\n\n protected async createSchemaItem<T extends SchemaItem>(schemaKey: SchemaKey, type: SchemaItemType, create: CreateSchemaItem<T>, name: string, ...args: any[]): Promise<T> {\n const schema = await this.getSchema(schemaKey);\n try {\n const boundCreate = create(schema);\n return await boundCreate(name, ...args);\n } catch (e) {\n if (e instanceof ECObjectsError && e.errorNumber === ECObjectsStatus.DuplicateItem) {\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNameAlreadyExists, new SchemaItemId(type, name, schema.schemaKey));\n } else {\n throw new Error(`Failed to create class ${name} in schema ${schema.fullName}.`);\n }\n }\n }\n\n protected async createSchemaItemFromProps<T extends SchemaItem>(schemaKey: SchemaKey, type: SchemaItemType, create: CreateSchemaItem<T>, props: SchemaItemProps): Promise<T> {\n if (props.name === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNameNotSpecified, new SchemaItemId(type, \"\", schemaKey));\n\n const newItem = await this.createSchemaItem<T>(schemaKey, type, create, props.name);\n await newItem.fromJSON(props);\n\n return newItem;\n }\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Editing
|
|
3
|
+
*/
|
|
4
|
+
import { SchemaItemKey, SchemaKey, StructClass, StructClassProps } from "@itwin/ecschema-metadata";
|
|
5
|
+
import { SchemaContextEditor } from "./Editor";
|
|
6
|
+
import { ECClasses } from "./ECClasses";
|
|
7
|
+
/**
|
|
8
|
+
* @alpha A class extending ECClasses allowing you to create schema items of type StructClass.
|
|
9
|
+
*/
|
|
10
|
+
export declare class Structs extends ECClasses {
|
|
11
|
+
protected get itemTypeClass(): typeof StructClass;
|
|
12
|
+
constructor(schemaEditor: SchemaContextEditor);
|
|
13
|
+
create(schemaKey: SchemaKey, name: string, displayLabel?: string, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey>;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a StructClass through a StructClassProps.
|
|
16
|
+
* @param schemaKey a SchemaKey of the Schema that will house the new object.
|
|
17
|
+
* @param structProps a json object that will be used to populate the new StructClass. Needs a name value passed in.
|
|
18
|
+
*/
|
|
19
|
+
createFromProps(schemaKey: SchemaKey, structProps: StructClassProps): Promise<SchemaItemKey>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=Structs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Structs.d.ts","sourceRoot":"","sources":["../../../src/Editing/Structs.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAkB,SAAS,EAAE,WAAW,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;IACpC,cAAuB,aAAa,IAAI,OAAO,WAAW,CAEzD;gBAEkB,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"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Editing
|
|
7
|
+
*/
|
|
8
|
+
import { SchemaItemType, StructClass } from "@itwin/ecschema-metadata";
|
|
9
|
+
import { ECClasses } from "./ECClasses";
|
|
10
|
+
import { ClassId, ECEditingStatus, SchemaEditingError } from "./Exception";
|
|
11
|
+
/**
|
|
12
|
+
* @alpha A class extending ECClasses allowing you to create schema items of type StructClass.
|
|
13
|
+
*/
|
|
14
|
+
export class Structs extends ECClasses {
|
|
15
|
+
get itemTypeClass() {
|
|
16
|
+
return StructClass;
|
|
17
|
+
}
|
|
18
|
+
constructor(schemaEditor) {
|
|
19
|
+
super(SchemaItemType.StructClass, schemaEditor);
|
|
20
|
+
}
|
|
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 SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new ClassId(this.schemaItemType, name, schemaKey), e);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Creates a StructClass through a StructClassProps.
|
|
34
|
+
* @param schemaKey a SchemaKey of the Schema that will house the new object.
|
|
35
|
+
* @param structProps a json object that will be used to populate the new StructClass. Needs a name value passed in.
|
|
36
|
+
*/
|
|
37
|
+
async createFromProps(schemaKey, structProps) {
|
|
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 SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, structProps.name, schemaKey), e);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# s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C9E,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,kBAAkB,CAAC,eAAe,CAAC,yBAAyB,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7I,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { SchemaItemKey, SchemaItemType, SchemaKey, StructClass, StructClassProps } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport { ECClasses } from \"./ECClasses\";\nimport { MutableStructClass } from \"./Mutable/MutableClass\";\nimport { ClassId, ECEditingStatus, SchemaEditingError } from \"./Exception\";\n\n/**\n * @alpha A class extending ECClasses allowing you to create schema items of type StructClass.\n */\nexport class Structs extends ECClasses {\n protected override get itemTypeClass(): typeof StructClass {\n return StructClass;\n }\n\n public constructor(schemaEditor: SchemaContextEditor) {\n super(SchemaItemType.StructClass, schemaEditor);\n }\n\n public async create(schemaKey: SchemaKey, name: string, displayLabel?: string, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey> {\n try {\n const newClass = await this.createClass<StructClass>(schemaKey, this.schemaItemType, (schema) => schema.createStructClass.bind(schema), name, baseClassKey) as MutableStructClass;\n\n if (displayLabel)\n newClass.setDisplayLabel(displayLabel);\n\n return newClass.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new ClassId(this.schemaItemType, name, schemaKey), e);\n }\n }\n\n /**\n * Creates a 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<SchemaItemKey> {\n try {\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createStructClass.bind(schema), structProps);\n return newClass.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, structProps.name!, schemaKey), e);\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Editing
|
|
3
|
+
*/
|
|
4
|
+
import { SchemaItemKey, SchemaKey, UnitSystem, UnitSystemProps } from "@itwin/ecschema-metadata";
|
|
5
|
+
import { SchemaContextEditor } from "./Editor";
|
|
6
|
+
import { SchemaItems } from "./SchemaItems";
|
|
7
|
+
/**
|
|
8
|
+
* @alpha
|
|
9
|
+
* A class allowing you to create schema items of type UnitSystems.
|
|
10
|
+
*/
|
|
11
|
+
export declare class UnitSystems extends SchemaItems {
|
|
12
|
+
protected get itemTypeClass(): typeof UnitSystem;
|
|
13
|
+
constructor(schemaEditor: SchemaContextEditor);
|
|
14
|
+
create(schemaKey: SchemaKey, name: string, displayLabel?: string): Promise<SchemaItemKey>;
|
|
15
|
+
createFromProps(schemaKey: SchemaKey, unitSystemProps: UnitSystemProps): Promise<SchemaItemKey>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=UnitSystems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnitSystems.d.ts","sourceRoot":"","sources":["../../../src/Editing/UnitSystems.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAkB,SAAS,EAAE,UAAU,EAAE,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;IAC1C,cAAuB,aAAa,IAAI,OAAO,UAAU,CAExD;gBAEkB,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"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Editing
|
|
7
|
+
*/
|
|
8
|
+
import { SchemaItemType, UnitSystem } from "@itwin/ecschema-metadata";
|
|
9
|
+
import { ECEditingStatus, SchemaEditingError, SchemaItemId } from "./Exception";
|
|
10
|
+
import { SchemaItems } from "./SchemaItems";
|
|
11
|
+
/**
|
|
12
|
+
* @alpha
|
|
13
|
+
* A class allowing you to create schema items of type UnitSystems.
|
|
14
|
+
*/
|
|
15
|
+
export class UnitSystems extends SchemaItems {
|
|
16
|
+
get itemTypeClass() {
|
|
17
|
+
return UnitSystem;
|
|
18
|
+
}
|
|
19
|
+
constructor(schemaEditor) {
|
|
20
|
+
super(SchemaItemType.UnitSystem, schemaEditor);
|
|
21
|
+
}
|
|
22
|
+
async create(schemaKey, name, displayLabel) {
|
|
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 SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async createFromProps(schemaKey, unitSystemProps) {
|
|
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 SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, unitSystemProps.name, schemaKey), e);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=UnitSystems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnitSystems.js","sourceRoot":"","sources":["../../../src/Editing/UnitSystems.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAiB,cAAc,EAAa,UAAU,EAAmB,MAAM,0BAA0B,CAAC;AAGjH,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C,IAAuB,aAAa;QAClC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,YAAmB,YAAiC;QAClD,KAAK,CAAC,cAAc,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,kBAAkB,CAAC,eAAe,CAAC,sBAAsB,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAClI,CAAC;IACH,CAAC;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,kBAAkB,CAAC,eAAe,CAAC,yBAAyB,EAAE,IAAI,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACtJ,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { SchemaItemKey, SchemaItemType, SchemaKey, UnitSystem, UnitSystemProps } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport { MutableUnitSystem } from \"./Mutable/MutableUnitSystem\";\nimport { ECEditingStatus, SchemaEditingError, SchemaItemId } from \"./Exception\";\nimport { SchemaItems } from \"./SchemaItems\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type UnitSystems.\n */\nexport class UnitSystems extends SchemaItems {\n protected override get itemTypeClass(): typeof UnitSystem {\n return UnitSystem;\n }\n\n public constructor(schemaEditor: SchemaContextEditor) {\n super(SchemaItemType.UnitSystem, schemaEditor);\n }\n\n public async create(schemaKey: SchemaKey, name: string, displayLabel?: string): Promise<SchemaItemKey> {\n\n try {\n const newUnitSystem = await this.createSchemaItem<UnitSystem>(schemaKey, this.schemaItemType, (schema) => schema.createUnitSystem.bind(schema), name) as MutableUnitSystem;\n\n if (displayLabel)\n newUnitSystem.setDisplayLabel(displayLabel);\n\n return newUnitSystem.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);\n }\n }\n\n public async createFromProps(schemaKey: SchemaKey, unitSystemProps: UnitSystemProps): Promise<SchemaItemKey> {\n try {\n const newUnitSystem = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createUnitSystem.bind(schema), unitSystemProps);\n return newUnitSystem.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, unitSystemProps.name!, schemaKey), e);\n }\n }\n}\n"]}
|