@itwin/ecschema-editing 5.0.0-dev.90 → 5.0.0-dev.92
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,264 @@
|
|
|
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 * as Rules from "../Validation/ECRules";
|
|
9
|
+
import { ECObjectsError, ECObjectsStatus, isSupportedSchemaItemType, Schema, SchemaItemType, SchemaMatchType } from "@itwin/ecschema-metadata";
|
|
10
|
+
import { assert } from "@itwin/core-bentley";
|
|
11
|
+
import { Constants } from "./Constants";
|
|
12
|
+
import { CustomAttributes } from "./CustomAttributes";
|
|
13
|
+
import { Entities } from "./Entities";
|
|
14
|
+
import { Enumerations } from "./Enumerations";
|
|
15
|
+
import { Formats } from "./Formats";
|
|
16
|
+
import { InvertedUnits } from "./InvertedUnits";
|
|
17
|
+
import { KindOfQuantities } from "./KindOfQuantities";
|
|
18
|
+
import { Mixins } from "./Mixins";
|
|
19
|
+
import { Phenomena } from "./Phenomena";
|
|
20
|
+
import { PropertyCategories } from "./PropertyCategories";
|
|
21
|
+
import { RelationshipClasses } from "./RelationshipClasses";
|
|
22
|
+
import { Structs } from "./Structs";
|
|
23
|
+
import { Units } from "./Units";
|
|
24
|
+
import { UnitSystems } from "./UnitSystems";
|
|
25
|
+
import { CustomAttributeId, ECEditingStatus, SchemaEditingError, SchemaId, SchemaItemId } from "./Exception";
|
|
26
|
+
/**
|
|
27
|
+
* A class that allows you to edit and create schemas, classes, and items from the SchemaContext level.
|
|
28
|
+
* @alpha
|
|
29
|
+
*/
|
|
30
|
+
export class SchemaContextEditor {
|
|
31
|
+
_schemaContext;
|
|
32
|
+
entities = new Entities(this);
|
|
33
|
+
mixins = new Mixins(this);
|
|
34
|
+
structs = new Structs(this);
|
|
35
|
+
customAttributes = new CustomAttributes(this);
|
|
36
|
+
relationships = new RelationshipClasses(this);
|
|
37
|
+
constants = new Constants(this);
|
|
38
|
+
enumerations = new Enumerations(this);
|
|
39
|
+
formats = new Formats(this);
|
|
40
|
+
kindOfQuantities = new KindOfQuantities(this);
|
|
41
|
+
units = new Units(this);
|
|
42
|
+
phenomenons = new Phenomena(this);
|
|
43
|
+
unitSystems = new UnitSystems(this);
|
|
44
|
+
propertyCategories = new PropertyCategories(this);
|
|
45
|
+
invertedUnits = new InvertedUnits(this);
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new SchemaContextEditor instance.
|
|
48
|
+
* @param schemaContext The SchemaContext the Editor will use to edit in.
|
|
49
|
+
*/
|
|
50
|
+
constructor(schemaContext) {
|
|
51
|
+
// TODO: Make copy
|
|
52
|
+
this._schemaContext = schemaContext;
|
|
53
|
+
}
|
|
54
|
+
/** Allows you to get schema classes and items through regular SchemaContext methods. */
|
|
55
|
+
get schemaContext() {
|
|
56
|
+
return this._schemaContext;
|
|
57
|
+
}
|
|
58
|
+
async finish() {
|
|
59
|
+
return this._schemaContext;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Helper method for retrieving a schema, previously added, from the SchemaContext.
|
|
63
|
+
* @param schemaKey The SchemaKey identifying the schema.
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
async getSchema(schemaKey) {
|
|
67
|
+
const schema = await this.schemaContext.getCachedSchema(schemaKey, SchemaMatchType.Latest);
|
|
68
|
+
if (schema === undefined)
|
|
69
|
+
throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));
|
|
70
|
+
return schema;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Creates a Schema with the given properties and adds it to the current schema context.
|
|
74
|
+
* @param name The name given to the new schema.
|
|
75
|
+
* @param alias The alias of the new schema.
|
|
76
|
+
* @param readVersion The read version number of the schema.
|
|
77
|
+
* @param writeVersion The write version number of the schema.
|
|
78
|
+
* @param minorVersion The minor version number of the schema.
|
|
79
|
+
* @returns Resolves to the SchemaKey of created schema.
|
|
80
|
+
*/
|
|
81
|
+
async createSchema(name, alias, readVersion, writeVersion, minorVersion) {
|
|
82
|
+
const newSchema = new Schema(this._schemaContext, name, alias, readVersion, writeVersion, minorVersion);
|
|
83
|
+
await this._schemaContext.addSchema(newSchema);
|
|
84
|
+
return newSchema.schemaKey;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Adds a referenced schema to the schema identified by the given SchemaKey.
|
|
88
|
+
* @param schemaKey The SchemaKey identifying the schema.
|
|
89
|
+
* @param refSchema The referenced schema to add.
|
|
90
|
+
*/
|
|
91
|
+
async addSchemaReference(schemaKey, refSchema) {
|
|
92
|
+
try {
|
|
93
|
+
const schema = await this.lookupSchema(schemaKey, SchemaMatchType.Exact);
|
|
94
|
+
await schema.addReference(refSchema);
|
|
95
|
+
const diagnostics = [];
|
|
96
|
+
for await (const diagnostic of Rules.validateSchemaReferences(schema)) {
|
|
97
|
+
diagnostics.push(diagnostic);
|
|
98
|
+
}
|
|
99
|
+
if (diagnostics.length > 0) {
|
|
100
|
+
this.removeReference(schema, refSchema);
|
|
101
|
+
throw new SchemaEditingError(ECEditingStatus.RuleViolation, new SchemaId(schemaKey), undefined, diagnostics);
|
|
102
|
+
}
|
|
103
|
+
if (!await this.schemaContext.getCachedSchema(refSchema.schemaKey)) {
|
|
104
|
+
await this.schemaContext.addSchema(refSchema);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
throw new SchemaEditingError(ECEditingStatus.AddSchemaReference, new SchemaId(schemaKey), e);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Adds a CustomAttribute instance to the schema identified by the given SchemaKey
|
|
113
|
+
* @param schemaKey The SchemaKey identifying the schema.
|
|
114
|
+
* @param customAttribute The CustomAttribute instance to add.
|
|
115
|
+
*/
|
|
116
|
+
async addCustomAttribute(schemaKey, customAttribute) {
|
|
117
|
+
try {
|
|
118
|
+
const schema = await this.lookupSchema(schemaKey);
|
|
119
|
+
schema.addCustomAttribute(customAttribute);
|
|
120
|
+
const diagnostics = [];
|
|
121
|
+
for await (const diagnostic of Rules.validateCustomAttributeInstance(schema, customAttribute)) {
|
|
122
|
+
diagnostics.push(diagnostic);
|
|
123
|
+
}
|
|
124
|
+
if (diagnostics.length > 0) {
|
|
125
|
+
this.removeCustomAttribute(schema, customAttribute);
|
|
126
|
+
throw new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, schema), undefined, diagnostics);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch (e) {
|
|
130
|
+
throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToClass, new SchemaId(schemaKey), e);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Sets the schema version.
|
|
135
|
+
* @param schemaKey The SchemaKey identifying the schema.
|
|
136
|
+
* @param readVersion The read version of the schema. If not specified, the existing read version will be maintained.
|
|
137
|
+
* @param writeVersion The write version of the schema. If not specified, the existing write version will be maintained.
|
|
138
|
+
* @param minorVersion The minor version of the schema. If not specified, the existing minor version will be maintained.
|
|
139
|
+
* @returns Resolves to the new SchemaKey containing version updates.
|
|
140
|
+
*/
|
|
141
|
+
async setVersion(schemaKey, readVersion, writeVersion, minorVersion) {
|
|
142
|
+
try {
|
|
143
|
+
const schema = await this.lookupSchema(schemaKey);
|
|
144
|
+
schema.setVersion(readVersion || schema.readVersion, writeVersion || schema.writeVersion, minorVersion || schema.minorVersion);
|
|
145
|
+
return schema.schemaKey;
|
|
146
|
+
}
|
|
147
|
+
catch (e) {
|
|
148
|
+
throw new SchemaEditingError(ECEditingStatus.SetSchemaVersion, new SchemaId(schemaKey), e);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Increments the minor version of a schema.
|
|
153
|
+
* @param schemaKey The SchemaKey identifying the schema.
|
|
154
|
+
* @returns Resolves to the new SchemaKey containing version updates.
|
|
155
|
+
*/
|
|
156
|
+
async incrementMinorVersion(schemaKey) {
|
|
157
|
+
try {
|
|
158
|
+
const schema = await this.lookupSchema(schemaKey);
|
|
159
|
+
schema.setVersion(schema.readVersion, schema.writeVersion, schema.minorVersion + 1);
|
|
160
|
+
return schema.schemaKey;
|
|
161
|
+
}
|
|
162
|
+
catch (e) {
|
|
163
|
+
throw new SchemaEditingError(ECEditingStatus.IncrementSchemaMinorVersion, new SchemaId(schemaKey), e);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/** @internal */
|
|
167
|
+
async lookupSchemaItem(schemaOrKey, schemaItemKey, schemaItemType) {
|
|
168
|
+
if (Schema.isSchema(schemaOrKey)) {
|
|
169
|
+
schemaOrKey = schemaOrKey.schemaKey;
|
|
170
|
+
}
|
|
171
|
+
const schemaItem = await this.schemaContext.getSchemaItem(schemaItemKey);
|
|
172
|
+
if (schemaItem === undefined)
|
|
173
|
+
throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new SchemaItemId(schemaItemType, schemaItemKey));
|
|
174
|
+
if (schemaItemType !== schemaItem.schemaItemType)
|
|
175
|
+
throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType, schemaItemKey));
|
|
176
|
+
return schemaItem;
|
|
177
|
+
}
|
|
178
|
+
/** @internal */
|
|
179
|
+
async getSchemaItem(schemaItemKey, itemConstructor) {
|
|
180
|
+
const schemaItem = await this.schemaContext.getSchemaItem(schemaItemKey);
|
|
181
|
+
const schemaItemType = itemConstructor.schemaItemType;
|
|
182
|
+
if (!isSchemaItemType(schemaItemType)) {
|
|
183
|
+
// This block should never be hit, as the editor components always pass in the itemConstructor with a valid schemaItemType.
|
|
184
|
+
throw new Error(`Invalid schema item lookup for: ${schemaItemType}`);
|
|
185
|
+
}
|
|
186
|
+
if (!schemaItem) {
|
|
187
|
+
throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFoundInContext, new SchemaItemId(schemaItemType, schemaItemKey));
|
|
188
|
+
}
|
|
189
|
+
if (!isSupportedSchemaItemType(schemaItem.schemaItemType, itemConstructor.schemaItemType))
|
|
190
|
+
throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType, schemaItemKey));
|
|
191
|
+
return schemaItem;
|
|
192
|
+
}
|
|
193
|
+
removeReference(schema, refSchema) {
|
|
194
|
+
const index = schema.references.indexOf(refSchema);
|
|
195
|
+
if (index !== -1) {
|
|
196
|
+
schema.references.splice(index, 1);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
removeCustomAttribute(schema, customAttribute) {
|
|
200
|
+
assert(schema.customAttributes !== undefined);
|
|
201
|
+
const map = schema.customAttributes;
|
|
202
|
+
map.delete(customAttribute.className);
|
|
203
|
+
}
|
|
204
|
+
async lookupSchema(schemaKey, matchType = SchemaMatchType.Latest) {
|
|
205
|
+
const schema = await this.schemaContext.getCachedSchema(schemaKey, matchType);
|
|
206
|
+
if (schema === undefined)
|
|
207
|
+
throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));
|
|
208
|
+
return schema;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Sets the Schemas description.
|
|
212
|
+
* @param schemaKey The SchemaKey identifying the schema.
|
|
213
|
+
* @param description The new description to set.
|
|
214
|
+
*/
|
|
215
|
+
async setDescription(schemaKey, description) {
|
|
216
|
+
const schema = await this.lookupSchema(schemaKey)
|
|
217
|
+
.catch((e) => {
|
|
218
|
+
throw new SchemaEditingError(ECEditingStatus.SetDescription, new SchemaId(schemaKey), e);
|
|
219
|
+
});
|
|
220
|
+
schema.setDescription(description);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Sets the Schemas display label.
|
|
224
|
+
* @param schemaKey The SchemaKey identifying the schema.
|
|
225
|
+
* @param label The new label to set.
|
|
226
|
+
*/
|
|
227
|
+
async setDisplayLabel(schemaKey, label) {
|
|
228
|
+
const schema = await this.lookupSchema(schemaKey)
|
|
229
|
+
.catch((e) => {
|
|
230
|
+
throw new SchemaEditingError(ECEditingStatus.SetLabel, new SchemaId(schemaKey), e);
|
|
231
|
+
});
|
|
232
|
+
schema.setDisplayLabel(label);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Sets the Schemas alias.
|
|
236
|
+
* @param schemaKey The SchemaKey identifying the schema.
|
|
237
|
+
* @param alias The new alias to set.
|
|
238
|
+
*/
|
|
239
|
+
async setAlias(schemaKey, alias) {
|
|
240
|
+
const schema = await this.lookupSchema(schemaKey)
|
|
241
|
+
.catch((e) => {
|
|
242
|
+
throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey), e);
|
|
243
|
+
});
|
|
244
|
+
try {
|
|
245
|
+
for (const currentSchema of this.schemaContext.getKnownSchemas()) {
|
|
246
|
+
if (currentSchema.schemaKey.matches(schemaKey))
|
|
247
|
+
continue;
|
|
248
|
+
if (currentSchema.alias.toLowerCase() === alias.toLowerCase())
|
|
249
|
+
throw new SchemaEditingError(ECEditingStatus.SchemaAliasAlreadyExists, new SchemaId(schemaKey), undefined, undefined, `Schema ${currentSchema.name} already uses the alias '${alias}'.`);
|
|
250
|
+
}
|
|
251
|
+
schema.setAlias(alias);
|
|
252
|
+
}
|
|
253
|
+
catch (e) {
|
|
254
|
+
if (e instanceof ECObjectsError && e.errorNumber === ECObjectsStatus.InvalidECName) {
|
|
255
|
+
throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey), new SchemaEditingError(ECEditingStatus.InvalidSchemaAlias, new SchemaId(schemaKey)));
|
|
256
|
+
}
|
|
257
|
+
throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey), e);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function isSchemaItemType(type) {
|
|
262
|
+
return Object.values(SchemaItemType).includes(type);
|
|
263
|
+
}
|
|
264
|
+
//# sourceMappingURL=Editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Editor.js","sourceRoot":"","sources":["../../../src/Editing/Editor.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAmB,cAAc,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,EAA4C,cAAc,EAAa,eAAe,EAA2B,MAAM,0BAA0B,CAAC;AAE9O,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,M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CAAC,CAAC;QAC3F,CAAC,CAAC,CAAC;QAEL,IAAI,CAAC;YACH,KAAK,MAAM,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,EAAE,CAAC;gBACjE,IAAI,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC;oBAC5C,SAAS;gBAEX,IAAI,aAAa,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,WAAW,EAAE;oBAC3D,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,wBAAwB,EAAE,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,aAAa,CAAC,IAAI,4BAA4B,KAAK,IAAI,CAAC,CAAC;YAC7L,CAAC;YACD,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,IAAI,CAAC,YAAY,cAAc,IAAI,CAAC,CAAC,WAAW,KAAK,eAAe,CAAC,aAAa,EAAE,CAAC;gBACnF,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,cAAc,EAAE,IAAI,QAAQ,CAAC,SAAS,CAAC,EAClF,IAAI,kBAAkB,CAAC,eAAe,CAAC,kBAAkB,EAAE,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YACzF,CAAC;YAED,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,cAAc,EAAG,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;CACF;AAED,SAAS,gBAAgB,CAAC,IAA6B;IACrD,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,IAAsB,CAAC,CAAC;AACxE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport * as Rules from \"../Validation/ECRules\";\nimport { CustomAttribute, ECObjectsError, ECObjectsStatus, isSupportedSchemaItemType, Schema, SchemaContext, SchemaItem, SchemaItemKey, SchemaItemType, SchemaKey, SchemaMatchType, SupportedSchemaItemType } from \"@itwin/ecschema-metadata\";\nimport { MutableSchema } from \"./Mutable/MutableSchema\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { Constants } from \"./Constants\";\nimport { CustomAttributes } from \"./CustomAttributes\";\nimport { Entities } from \"./Entities\";\nimport { Enumerations } from \"./Enumerations\";\nimport { Formats } from \"./Formats\";\nimport { InvertedUnits } from \"./InvertedUnits\";\nimport { KindOfQuantities } from \"./KindOfQuantities\";\nimport { Mixins } from \"./Mixins\";\nimport { Phenomena } from \"./Phenomena\";\nimport { PropertyCategories } from \"./PropertyCategories\";\nimport { RelationshipClasses } from \"./RelationshipClasses\";\nimport { Structs } from \"./Structs\";\nimport { Units } from \"./Units\";\nimport { UnitSystems } from \"./UnitSystems\";\nimport { CustomAttributeId, ECEditingStatus, SchemaEditingError, SchemaId, SchemaItemId } from \"./Exception\";\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\n\n/**\n * A class that allows you to edit and create schemas, classes, and items from the SchemaContext level.\n * @alpha\n */\nexport class SchemaContextEditor {\n private _schemaContext: SchemaContext;\n public readonly entities = new Entities(this);\n public readonly mixins = new Mixins(this);\n public readonly structs = new Structs(this);\n public readonly customAttributes = new CustomAttributes(this);\n public readonly relationships = new RelationshipClasses(this);\n public readonly constants = new Constants(this);\n public readonly enumerations = new Enumerations(this);\n public readonly formats = new Formats(this);\n public readonly kindOfQuantities = new KindOfQuantities(this);\n public readonly units = new Units(this);\n public readonly phenomenons = new Phenomena(this);\n public readonly unitSystems = new UnitSystems(this);\n public readonly propertyCategories = new PropertyCategories(this);\n public readonly invertedUnits = new InvertedUnits(this);\n\n /**\n * Creates a new SchemaContextEditor instance.\n * @param schemaContext The SchemaContext the Editor will use to edit in.\n */\n constructor(schemaContext: SchemaContext) {\n // TODO: Make copy\n this._schemaContext = schemaContext;\n }\n\n /** Allows you to get schema classes and items through regular SchemaContext methods. */\n public get schemaContext(): SchemaContext {\n return this._schemaContext;\n }\n\n public async finish(): Promise<SchemaContext> {\n return this._schemaContext;\n }\n\n /**\n * Helper method for retrieving a schema, previously added, from the SchemaContext.\n * @param schemaKey The SchemaKey identifying the schema.\n * @internal\n */\n public async getSchema(schemaKey: SchemaKey): Promise<MutableSchema> {\n const schema = await this.schemaContext.getCachedSchema(schemaKey, SchemaMatchType.Latest);\n if (schema === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));\n\n return schema as MutableSchema;\n }\n\n /**\n * Creates a Schema with the given properties and adds it to the current schema context.\n * @param name The name given to the new schema.\n * @param alias The alias of the new schema.\n * @param readVersion The read version number of the schema.\n * @param writeVersion The write version number of the schema.\n * @param minorVersion The minor version number of the schema.\n * @returns Resolves to the SchemaKey of created schema.\n */\n public async createSchema(name: string, alias: string, readVersion: number, writeVersion: number, minorVersion: number): Promise<SchemaKey> {\n const newSchema = new Schema(this._schemaContext, name, alias, readVersion, writeVersion, minorVersion);\n await this._schemaContext.addSchema(newSchema);\n return newSchema.schemaKey;\n }\n\n /**\n * Adds a referenced schema to the schema identified by the given SchemaKey.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param refSchema The referenced schema to add.\n */\n public async addSchemaReference(schemaKey: SchemaKey, refSchema: Schema): Promise<void> {\n try {\n const schema = await this.lookupSchema(schemaKey, SchemaMatchType.Exact);\n await schema.addReference(refSchema);\n\n const diagnostics: AnyDiagnostic[] = [];\n for await (const diagnostic of Rules.validateSchemaReferences(schema)) {\n diagnostics.push(diagnostic);\n }\n\n if (diagnostics.length > 0) {\n this.removeReference(schema, refSchema);\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new SchemaId(schemaKey), undefined, diagnostics);\n }\n\n if (!await this.schemaContext.getCachedSchema(refSchema.schemaKey)) {\n await this.schemaContext.addSchema(refSchema);\n }\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.AddSchemaReference, new SchemaId(schemaKey), e);\n }\n }\n\n /**\n * Adds a CustomAttribute instance to the schema identified by the given SchemaKey\n * @param schemaKey The SchemaKey identifying the schema.\n * @param customAttribute The CustomAttribute instance to add.\n */\n public async addCustomAttribute(schemaKey: SchemaKey, customAttribute: CustomAttribute): Promise<void> {\n try {\n const schema = await this.lookupSchema(schemaKey);\n schema.addCustomAttribute(customAttribute);\n\n const diagnostics: AnyDiagnostic[] = [];\n for await (const diagnostic of Rules.validateCustomAttributeInstance(schema, customAttribute)) {\n diagnostics.push(diagnostic);\n }\n\n if (diagnostics.length > 0) {\n this.removeCustomAttribute(schema, customAttribute);\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, schema), undefined, diagnostics);\n }\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToClass, new SchemaId(schemaKey), e);\n }\n }\n\n /**\n * Sets the schema version.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param readVersion The read version of the schema. If not specified, the existing read version will be maintained.\n * @param writeVersion The write version of the schema. If not specified, the existing write version will be maintained.\n * @param minorVersion The minor version of the schema. If not specified, the existing minor version will be maintained.\n * @returns Resolves to the new SchemaKey containing version updates.\n */\n public async setVersion(schemaKey: SchemaKey, readVersion?: number, writeVersion?: number, minorVersion?: number): Promise<SchemaKey> {\n try {\n const schema = await this.lookupSchema(schemaKey);\n schema.setVersion(readVersion || schema.readVersion, writeVersion || schema.writeVersion, minorVersion || schema.minorVersion);\n\n return schema.schemaKey;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.SetSchemaVersion, new SchemaId(schemaKey), e);\n }\n }\n\n /**\n * Increments the minor version of a schema.\n * @param schemaKey The SchemaKey identifying the schema.\n * @returns Resolves to the new SchemaKey containing version updates.\n */\n public async incrementMinorVersion(schemaKey: SchemaKey): Promise<SchemaKey> {\n try {\n const schema = await this.lookupSchema(schemaKey);\n schema.setVersion(schema.readVersion, schema.writeVersion, schema.minorVersion + 1);\n\n return schema.schemaKey;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.IncrementSchemaMinorVersion, new SchemaId(schemaKey), e);\n }\n }\n\n /** @internal */\n public async lookupSchemaItem(schemaOrKey: Schema | SchemaKey, schemaItemKey: SchemaItemKey, schemaItemType: SchemaItemType): Promise<SchemaItem> {\n if(Schema.isSchema(schemaOrKey)) {\n schemaOrKey = schemaOrKey.schemaKey;\n }\n\n const schemaItem = await this.schemaContext.getSchemaItem(schemaItemKey);\n if (schemaItem === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new SchemaItemId(schemaItemType, schemaItemKey));\n\n if (schemaItemType !== schemaItem.schemaItemType)\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType, schemaItemKey));\n\n return schemaItem;\n }\n\n /** @internal */\n public async getSchemaItem<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): Promise<InstanceType<T>> {\n const schemaItem = await this.schemaContext.getSchemaItem(schemaItemKey);\n const schemaItemType = itemConstructor.schemaItemType;\n if(!isSchemaItemType(schemaItemType)) {\n // This block should never be hit, as the editor components always pass in the itemConstructor with a valid schemaItemType.\n throw new Error(`Invalid schema item lookup for: ${schemaItemType}`);\n }\n\n if (!schemaItem) {\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFoundInContext, new SchemaItemId(schemaItemType, schemaItemKey));\n }\n\n if (!isSupportedSchemaItemType(schemaItem.schemaItemType, itemConstructor.schemaItemType))\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType, schemaItemKey));\n\n return schemaItem as InstanceType<T>;\n }\n\n private removeReference(schema: Schema, refSchema: Schema) {\n const index: number = schema.references.indexOf(refSchema);\n if (index !== -1) {\n schema.references.splice(index, 1);\n }\n }\n\n private removeCustomAttribute(schema: Schema, customAttribute: CustomAttribute) {\n assert(schema.customAttributes !== undefined);\n const map = schema.customAttributes as Map<string, CustomAttribute>;\n map.delete(customAttribute.className);\n }\n\n private async lookupSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<MutableSchema> {\n const schema = await this.schemaContext.getCachedSchema(schemaKey, matchType);\n if (schema === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));\n\n return schema as MutableSchema;\n }\n\n /**\n * Sets the Schemas description.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param description The new description to set.\n */\n public async setDescription(schemaKey: SchemaKey, description: string) {\n const schema = await this.lookupSchema(schemaKey)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetDescription, new SchemaId(schemaKey), e);\n });\n schema.setDescription(description);\n }\n\n /**\n * Sets the Schemas display label.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param label The new label to set.\n */\n public async setDisplayLabel(schemaKey: SchemaKey, label: string) {\n const schema = await this.lookupSchema(schemaKey)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetLabel, new SchemaId(schemaKey), e);\n });\n schema.setDisplayLabel(label);\n }\n\n /**\n * Sets the Schemas alias.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param alias The new alias to set.\n */\n public async setAlias(schemaKey: SchemaKey, alias: string) {\n const schema = await this.lookupSchema(schemaKey)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey), e);\n });\n\n try {\n for (const currentSchema of this.schemaContext.getKnownSchemas()) {\n if (currentSchema.schemaKey.matches(schemaKey))\n continue;\n\n if (currentSchema.alias.toLowerCase() === alias.toLowerCase())\n throw new SchemaEditingError(ECEditingStatus.SchemaAliasAlreadyExists, new SchemaId(schemaKey), undefined, undefined, `Schema ${currentSchema.name} already uses the alias '${alias}'.`);\n }\n schema.setAlias(alias);\n } catch(e: any) {\n if (e instanceof ECObjectsError && e.errorNumber === ECObjectsStatus.InvalidECName) {\n throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey),\n new SchemaEditingError(ECEditingStatus.InvalidSchemaAlias, new SchemaId(schemaKey)));\n }\n\n throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey), e);\n }\n }\n}\n\nfunction isSchemaItemType(type: SupportedSchemaItemType): type is SchemaItemType {\n return Object.values(SchemaItemType).includes(type as SchemaItemType);\n}"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Editing
|
|
3
|
+
*/
|
|
4
|
+
import { ECClassModifier, EntityClass, EntityClassProps, Mixin, NavigationPropertyProps, RelationshipClass, SchemaItemKey, SchemaKey, StrengthDirection } from "@itwin/ecschema-metadata";
|
|
5
|
+
import { SchemaContextEditor } from "./Editor";
|
|
6
|
+
import { ECClasses } from "./ECClasses";
|
|
7
|
+
import { NavigationProperties } from "./Properties";
|
|
8
|
+
/**
|
|
9
|
+
* @alpha
|
|
10
|
+
* A class extending ECClasses allowing you to create schema items of type EntityClass.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Entities extends ECClasses {
|
|
13
|
+
protected get itemTypeClass(): typeof EntityClass;
|
|
14
|
+
constructor(schemaEditor: SchemaContextEditor);
|
|
15
|
+
/**
|
|
16
|
+
* Allows access for editing of NavigationProperty attributes.
|
|
17
|
+
*/
|
|
18
|
+
readonly navigationProperties: NavigationProperties;
|
|
19
|
+
createElement(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, baseClassKey: SchemaItemKey, displayLabel?: string, mixins?: Mixin[]): Promise<SchemaItemKey>;
|
|
20
|
+
createElementUniqueAspect(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, baseClassKey: SchemaItemKey, displayLabel?: string, mixins?: Mixin[]): Promise<SchemaItemKey>;
|
|
21
|
+
createElementMultiAspect(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, baseClassKey: SchemaItemKey, displayLabel?: string, mixins?: Mixin[]): Promise<SchemaItemKey>;
|
|
22
|
+
create(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, displayLabel?: string, baseClassKey?: SchemaItemKey, mixins?: Mixin[]): Promise<SchemaItemKey>;
|
|
23
|
+
/**
|
|
24
|
+
* Creates an EntityClass through an EntityClassProps.
|
|
25
|
+
* @param schemaKey a SchemaKey of the Schema that will house the new object.
|
|
26
|
+
* @param entityProps a json object that will be used to populate the new EntityClass. Needs a name value passed in.
|
|
27
|
+
*/
|
|
28
|
+
createFromProps(schemaKey: SchemaKey, entityProps: EntityClassProps): Promise<SchemaItemKey>;
|
|
29
|
+
addMixin(entityKey: SchemaItemKey, mixinKey: SchemaItemKey): Promise<void>;
|
|
30
|
+
createNavigationProperty(entityKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a Navigation Property through a NavigationPropertyProps.
|
|
33
|
+
* @param classKey a SchemaItemKey of the Entity Class that will house the new property.
|
|
34
|
+
* @param navigationProps a json object that will be used to populate the new Navigation Property.
|
|
35
|
+
*/
|
|
36
|
+
createNavigationPropertyFromProps(classKey: SchemaItemKey, navigationProps: NavigationPropertyProps): Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=Entities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Entities.d.ts","sourceRoot":"","sources":["../../../src/Editing/Entities.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,eAAe,EAAE,WAAW,EAAE,gBAAgB,EAC9C,KAAK,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,aAAa,EAAkB,SAAS,EAAE,iBAAiB,EAC/G,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM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Q,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAU1E,wBAAwB,CAAC,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,iBAAiB,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAS7K;;;;OAIG;IACU,iCAAiC,CAAC,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;CASjI"}
|
|
@@ -0,0 +1,126 @@
|
|
|
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 { EntityClass, Mixin, SchemaItemType, } from "@itwin/ecschema-metadata";
|
|
9
|
+
import { ECClasses } from "./ECClasses";
|
|
10
|
+
import { MutableEntityClass } from "./Mutable/MutableEntityClass";
|
|
11
|
+
import { NavigationProperties } from "./Properties";
|
|
12
|
+
import { ClassId, ECEditingStatus, SchemaEditingError } from "./Exception";
|
|
13
|
+
/**
|
|
14
|
+
* @alpha
|
|
15
|
+
* A class extending ECClasses allowing you to create schema items of type EntityClass.
|
|
16
|
+
*/
|
|
17
|
+
export class Entities extends ECClasses {
|
|
18
|
+
get itemTypeClass() {
|
|
19
|
+
return EntityClass;
|
|
20
|
+
}
|
|
21
|
+
constructor(schemaEditor) {
|
|
22
|
+
super(SchemaItemType.EntityClass, schemaEditor);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Allows access for editing of NavigationProperty attributes.
|
|
26
|
+
*/
|
|
27
|
+
navigationProperties = new NavigationProperties(SchemaItemType.EntityClass, this.schemaEditor);
|
|
28
|
+
async createElement(schemaKey, name, modifier, baseClassKey, displayLabel, mixins) {
|
|
29
|
+
try {
|
|
30
|
+
const baseClass = await this.getSchemaItem(baseClassKey, EntityClass);
|
|
31
|
+
if (!(await (baseClass).is("Element", "BisCore"))) {
|
|
32
|
+
throw new SchemaEditingError(ECEditingStatus.BaseClassIsNotElement, new ClassId(this.schemaItemType, baseClassKey));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
throw new SchemaEditingError(ECEditingStatus.CreateElement, new ClassId(this.schemaItemType, name, schemaKey), e);
|
|
37
|
+
}
|
|
38
|
+
return this.create(schemaKey, name, modifier, displayLabel, baseClassKey, mixins);
|
|
39
|
+
}
|
|
40
|
+
async createElementUniqueAspect(schemaKey, name, modifier, baseClassKey, displayLabel, mixins) {
|
|
41
|
+
try {
|
|
42
|
+
const baseClass = await this.getSchemaItem(baseClassKey, EntityClass);
|
|
43
|
+
if (!(await (baseClass).is("ElementUniqueAspect", "BisCore"))) {
|
|
44
|
+
throw new SchemaEditingError(ECEditingStatus.BaseClassIsNotElementUniqueAspect, new ClassId(this.schemaItemType, baseClassKey));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
throw new SchemaEditingError(ECEditingStatus.CreateElement, new ClassId(this.schemaItemType, name, schemaKey), e);
|
|
49
|
+
}
|
|
50
|
+
return this.create(schemaKey, name, modifier, displayLabel, baseClassKey, mixins);
|
|
51
|
+
}
|
|
52
|
+
async createElementMultiAspect(schemaKey, name, modifier, baseClassKey, displayLabel, mixins) {
|
|
53
|
+
try {
|
|
54
|
+
const baseClass = await this.getSchemaItem(baseClassKey, EntityClass);
|
|
55
|
+
if (!(await (baseClass).is("ElementMultiAspect", "BisCore"))) {
|
|
56
|
+
throw new SchemaEditingError(ECEditingStatus.BaseClassIsNotElementMultiAspect, new ClassId(this.schemaItemType, baseClassKey));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
throw new SchemaEditingError(ECEditingStatus.CreateElement, new ClassId(this.schemaItemType, name, schemaKey), e);
|
|
61
|
+
}
|
|
62
|
+
return this.create(schemaKey, name, modifier, displayLabel, baseClassKey, mixins);
|
|
63
|
+
}
|
|
64
|
+
async create(schemaKey, name, modifier, displayLabel, baseClassKey, mixins) {
|
|
65
|
+
try {
|
|
66
|
+
const newClass = await this.createClass(schemaKey, this.schemaItemType, (schema) => schema.createEntityClass.bind(schema), name, baseClassKey, modifier);
|
|
67
|
+
if (mixins !== undefined)
|
|
68
|
+
mixins.forEach((m) => newClass.addMixin(m));
|
|
69
|
+
if (displayLabel)
|
|
70
|
+
newClass.setDisplayLabel(displayLabel);
|
|
71
|
+
return newClass.key;
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new ClassId(this.schemaItemType, name, schemaKey), e);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Creates an EntityClass through an EntityClassProps.
|
|
79
|
+
* @param schemaKey a SchemaKey of the Schema that will house the new object.
|
|
80
|
+
* @param entityProps a json object that will be used to populate the new EntityClass. Needs a name value passed in.
|
|
81
|
+
*/
|
|
82
|
+
async createFromProps(schemaKey, entityProps) {
|
|
83
|
+
try {
|
|
84
|
+
const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createEntityClass.bind(schema), entityProps);
|
|
85
|
+
return newClass.key;
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, entityProps.name, schemaKey), e);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async addMixin(entityKey, mixinKey) {
|
|
92
|
+
try {
|
|
93
|
+
const entity = await this.getSchemaItem(entityKey, MutableEntityClass);
|
|
94
|
+
const mixin = await this.getSchemaItem(mixinKey, Mixin);
|
|
95
|
+
entity.addMixin(mixin);
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
throw new SchemaEditingError(ECEditingStatus.AddMixin, new ClassId(SchemaItemType.EntityClass, entityKey), e);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async createNavigationProperty(entityKey, name, relationship, direction) {
|
|
102
|
+
try {
|
|
103
|
+
const entity = await this.getSchemaItem(entityKey, MutableEntityClass);
|
|
104
|
+
await entity.createNavigationProperty(name, relationship, direction);
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
throw new SchemaEditingError(ECEditingStatus.CreateNavigationProperty, new ClassId(SchemaItemType.RelationshipClass, entityKey), e);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Creates a Navigation Property through a NavigationPropertyProps.
|
|
112
|
+
* @param classKey a SchemaItemKey of the Entity Class that will house the new property.
|
|
113
|
+
* @param navigationProps a json object that will be used to populate the new Navigation Property.
|
|
114
|
+
*/
|
|
115
|
+
async createNavigationPropertyFromProps(classKey, navigationProps) {
|
|
116
|
+
try {
|
|
117
|
+
const entity = await this.getSchemaItem(classKey, MutableEntityClass);
|
|
118
|
+
const property = await entity.createNavigationProperty(navigationProps.name, navigationProps.relationshipName, navigationProps.direction);
|
|
119
|
+
await property.fromJSON(navigationProps);
|
|
120
|
+
}
|
|
121
|
+
catch (e) {
|
|
122
|
+
throw new SchemaEditingError(ECEditingStatus.CreateNavigationPropertyFromProps, new ClassId(SchemaItemType.EntityClass, classKey), e);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=Entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Entities.js","sourceRoot":"","sources":["../../../src/Editing/Entities.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EACY,WAA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E,kBAAkB,CAAC,CAAC;YACvE,MAAM,MAAM,CAAC,wBAAwB,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QACvE,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,wBAAwB,EAAE,IAAI,OAAO,CAAC,cAAc,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACtI,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,iCAAiC,CAAC,QAAuB,EAAE,eAAwC;QAC9G,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;YACtE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,gBAAgB,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;YAC1I,MAAM,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,MAAM,IAAI,kBAAkB,CAAC,eAAe,CAAC,iCAAiC,EAAE,IAAI,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QACxI,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 ECClassModifier, EntityClass, EntityClassProps,\n Mixin, NavigationPropertyProps, RelationshipClass, SchemaItemKey, SchemaItemType, SchemaKey, StrengthDirection,\n} from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport { ECClasses } from \"./ECClasses\";\nimport { MutableEntityClass } from \"./Mutable/MutableEntityClass\";\nimport { NavigationProperties } from \"./Properties\";\nimport { ClassId, ECEditingStatus, SchemaEditingError } from \"./Exception\";\n\n/**\n * @alpha\n * A class extending ECClasses allowing you to create schema items of type EntityClass.\n */\nexport class Entities extends ECClasses {\n protected override get itemTypeClass(): typeof EntityClass {\n return EntityClass;\n }\n\n public constructor(schemaEditor: SchemaContextEditor) {\n super(SchemaItemType.EntityClass, schemaEditor);\n }\n\n /**\n * Allows access for editing of NavigationProperty attributes.\n */\n public readonly navigationProperties = new NavigationProperties(SchemaItemType.EntityClass, this.schemaEditor);\n\n public async createElement(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, baseClassKey: SchemaItemKey, displayLabel?: string, mixins?: Mixin[]): Promise<SchemaItemKey> {\n try {\n const baseClass = await this.getSchemaItem(baseClassKey, EntityClass);\n if (!(await (baseClass).is(\"Element\", \"BisCore\"))) {\n throw new SchemaEditingError(ECEditingStatus.BaseClassIsNotElement, new ClassId(this.schemaItemType, baseClassKey));\n }\n } catch(e: any){\n throw new SchemaEditingError(ECEditingStatus.CreateElement, new ClassId(this.schemaItemType, name, schemaKey), e);\n }\n\n return this.create(schemaKey, name, modifier, displayLabel, baseClassKey, mixins);\n }\n\n public async createElementUniqueAspect(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, baseClassKey: SchemaItemKey, displayLabel?: string, mixins?: Mixin[]): Promise<SchemaItemKey> {\n try {\n const baseClass = await this.getSchemaItem(baseClassKey, EntityClass);\n if (!(await (baseClass).is(\"ElementUniqueAspect\", \"BisCore\"))) {\n throw new SchemaEditingError(ECEditingStatus.BaseClassIsNotElementUniqueAspect, new ClassId(this.schemaItemType, baseClassKey));\n }\n } catch(e: any){\n throw new SchemaEditingError(ECEditingStatus.CreateElement, new ClassId(this.schemaItemType, name, schemaKey), e);\n }\n\n return this.create(schemaKey, name, modifier, displayLabel, baseClassKey, mixins);\n }\n\n public async createElementMultiAspect(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, baseClassKey: SchemaItemKey, displayLabel?: string, mixins?: Mixin[]): Promise<SchemaItemKey> {\n try {\n const baseClass = await this.getSchemaItem(baseClassKey, EntityClass);\n if (!(await (baseClass).is(\"ElementMultiAspect\", \"BisCore\"))) {\n throw new SchemaEditingError(ECEditingStatus.BaseClassIsNotElementMultiAspect, new ClassId(this.schemaItemType, baseClassKey));\n }\n } catch(e: any){\n throw new SchemaEditingError(ECEditingStatus.CreateElement, new ClassId(this.schemaItemType, name, schemaKey), e);\n }\n\n return this.create(schemaKey, name, modifier, displayLabel, baseClassKey, mixins);\n }\n\n public async create(schemaKey: SchemaKey, name: string, modifier: ECClassModifier, displayLabel?: string, baseClassKey?: SchemaItemKey, mixins?: Mixin[]): Promise<SchemaItemKey> {\n try {\n const newClass = await this.createClass<EntityClass>(schemaKey, this.schemaItemType, (schema) => schema.createEntityClass.bind(schema), name, baseClassKey, modifier) as MutableEntityClass;\n\n if (mixins !== undefined)\n mixins.forEach((m) => newClass.addMixin(m));\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 an EntityClass through an EntityClassProps.\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\n * @param entityProps a json object that will be used to populate the new EntityClass. Needs a name value passed in.\n */\n public async createFromProps(schemaKey: SchemaKey, entityProps: EntityClassProps): Promise<SchemaItemKey> {\n try {\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createEntityClass.bind(schema), entityProps);\n return newClass.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, entityProps.name!, schemaKey), e);\n }\n }\n\n public async addMixin(entityKey: SchemaItemKey, mixinKey: SchemaItemKey): Promise<void> {\n try {\n const entity = await this.getSchemaItem(entityKey, MutableEntityClass);\n const mixin = await this.getSchemaItem(mixinKey, Mixin);\n entity.addMixin(mixin);\n } catch(e: any){\n throw new SchemaEditingError(ECEditingStatus.AddMixin, new ClassId(SchemaItemType.EntityClass, entityKey), e);\n }\n }\n\n public async createNavigationProperty(entityKey: SchemaItemKey, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<void> {\n try {\n const entity = await this.getSchemaItem(entityKey, MutableEntityClass);\n await entity.createNavigationProperty(name, relationship, direction);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateNavigationProperty, new ClassId(SchemaItemType.RelationshipClass, entityKey), e);\n }\n }\n\n /**\n * Creates a Navigation Property through a NavigationPropertyProps.\n * @param classKey a SchemaItemKey of the Entity 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(classKey: SchemaItemKey, navigationProps: NavigationPropertyProps): Promise<void> {\n try {\n const entity = await this.getSchemaItem(classKey, MutableEntityClass);\n const property = await entity.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.EntityClass, classKey), e);\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Editing
|
|
3
|
+
*/
|
|
4
|
+
import { AnyEnumerator, Enumeration, EnumerationProps, PrimitiveType, SchemaItemKey, SchemaKey } 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 Enumeration.
|
|
10
|
+
*/
|
|
11
|
+
export declare class Enumerations extends SchemaItems {
|
|
12
|
+
protected get itemTypeClass(): typeof Enumeration;
|
|
13
|
+
constructor(schemaEditor: SchemaContextEditor);
|
|
14
|
+
create(schemaKey: SchemaKey, name: string, type: PrimitiveType.Integer | PrimitiveType.String, displayLabel?: string, isStrict?: boolean, enumerators?: AnyEnumerator[]): Promise<SchemaItemKey>;
|
|
15
|
+
/**
|
|
16
|
+
* Creates an Enumeration through an EnumeratorProps.
|
|
17
|
+
* @param schemaKey a SchemaKey of the Schema that will house the new object.
|
|
18
|
+
* @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.
|
|
19
|
+
*/
|
|
20
|
+
createFromProps(schemaKey: SchemaKey, enumProps: EnumerationProps): Promise<SchemaItemKey>;
|
|
21
|
+
addEnumerator(enumerationKey: SchemaItemKey, enumerator: AnyEnumerator): Promise<void>;
|
|
22
|
+
setEnumeratorLabel(enumerationKey: SchemaItemKey, enumeratorName: string, label: string | undefined): Promise<void>;
|
|
23
|
+
setEnumeratorDescription(enumerationKey: SchemaItemKey, enumeratorName: string, description: string | undefined): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=Enumerations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Enumerations.d.ts","sourceRoot":"","sources":["../../../src/Editing/Enumerations.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAkB,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACjJ,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C;;;GAGG;AACH,qBAAa,YAAa,SAAQ,WAAW;IAC3C,cAAuB,aAAa,IAAI,OAAO,WAAW,CAEzD;gBAEkB,YAAY,EAAE,mBAAmB;IAIvC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,CAAC,OAAO,GAAG,aAAa,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IAoB7M;;;;OAIG;IACU,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAS1F,aAAa,CAAC,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBtF,kBAAkB,CAAC,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAcnH,wBAAwB,CAAC,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAa7I"}
|
|
@@ -0,0 +1,90 @@
|
|
|
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 { Enumeration, SchemaItemType } from "@itwin/ecschema-metadata";
|
|
9
|
+
import { ECEditingStatus, EnumeratorId, SchemaEditingError, SchemaItemId } from "./Exception";
|
|
10
|
+
import { SchemaItems } from "./SchemaItems";
|
|
11
|
+
/**
|
|
12
|
+
* @alpha
|
|
13
|
+
* A class allowing you to create schema items of type Enumeration.
|
|
14
|
+
*/
|
|
15
|
+
export class Enumerations extends SchemaItems {
|
|
16
|
+
get itemTypeClass() {
|
|
17
|
+
return Enumeration;
|
|
18
|
+
}
|
|
19
|
+
constructor(schemaEditor) {
|
|
20
|
+
super(SchemaItemType.Enumeration, schemaEditor);
|
|
21
|
+
}
|
|
22
|
+
async create(schemaKey, name, type, displayLabel, isStrict, enumerators) {
|
|
23
|
+
try {
|
|
24
|
+
const newEnum = await this.createSchemaItem(schemaKey, this.schemaItemType, (schema) => schema.createEnumeration.bind(schema), name, type);
|
|
25
|
+
if (undefined !== isStrict)
|
|
26
|
+
newEnum.setIsStrict(isStrict);
|
|
27
|
+
if (undefined !== enumerators)
|
|
28
|
+
for (const enumerator of enumerators)
|
|
29
|
+
await this.addEnumerator(newEnum.key, enumerator);
|
|
30
|
+
if (displayLabel)
|
|
31
|
+
newEnum.setDisplayLabel(displayLabel);
|
|
32
|
+
return newEnum.key;
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Creates an Enumeration through an EnumeratorProps.
|
|
40
|
+
* @param schemaKey a SchemaKey of the Schema that will house the new object.
|
|
41
|
+
* @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.
|
|
42
|
+
*/
|
|
43
|
+
async createFromProps(schemaKey, enumProps) {
|
|
44
|
+
try {
|
|
45
|
+
const newEnum = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createEnumeration.bind(schema), enumProps);
|
|
46
|
+
return newEnum.key;
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, enumProps.name, schemaKey), e);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async addEnumerator(enumerationKey, enumerator) {
|
|
53
|
+
try {
|
|
54
|
+
const enumeration = await this.getSchemaItem(enumerationKey, Enumeration);
|
|
55
|
+
if (enumeration.isInt && typeof (enumerator.value) !== "number")
|
|
56
|
+
throw new SchemaEditingError(ECEditingStatus.InvalidEnumeratorType, new EnumeratorId(enumerator, enumeration));
|
|
57
|
+
if (enumeration.isString && typeof (enumerator.value) !== "string")
|
|
58
|
+
throw new SchemaEditingError(ECEditingStatus.InvalidEnumeratorType, new EnumeratorId(enumerator, enumeration));
|
|
59
|
+
enumeration.addEnumerator(enumerator);
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
throw new SchemaEditingError(ECEditingStatus.AddEnumerator, new SchemaItemId(this.schemaItemType, enumerationKey), e);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async setEnumeratorLabel(enumerationKey, enumeratorName, label) {
|
|
66
|
+
try {
|
|
67
|
+
const enumeration = await this.getSchemaItem(enumerationKey, Enumeration);
|
|
68
|
+
const enumerator = enumeration.getEnumeratorByName(enumeratorName);
|
|
69
|
+
if (enumerator === undefined)
|
|
70
|
+
throw new SchemaEditingError(ECEditingStatus.EnumeratorDoesNotExist, new EnumeratorId(enumeratorName, enumeration));
|
|
71
|
+
enumerator.label = label;
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
throw new SchemaEditingError(ECEditingStatus.SetEnumeratorLabel, new SchemaItemId(this.schemaItemType, enumerationKey), e);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async setEnumeratorDescription(enumerationKey, enumeratorName, description) {
|
|
78
|
+
try {
|
|
79
|
+
const enumeration = await this.getSchemaItem(enumerationKey, Enumeration);
|
|
80
|
+
const enumerator = enumeration.getEnumeratorByName(enumeratorName);
|
|
81
|
+
if (enumerator === undefined)
|
|
82
|
+
throw new SchemaEditingError(ECEditingStatus.EnumeratorDoesNotExist, new EnumeratorId(enumeratorName, enumeration));
|
|
83
|
+
enumerator.description = description;
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
throw new SchemaEditingError(ECEditingStatus.SetEnumeratorLabel, new SchemaItemId(this.schemaItemType, enumerationKey), e);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=Enumerations.js.map
|