@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,228 @@
|
|
|
1
|
+
import { Enumeration, parsePrimitiveType, RelationshipClass, SchemaItemKey, SchemaItemType, StructClass } from "@itwin/ecschema-metadata";
|
|
2
|
+
import { getClassEditor, toItemKey, toPropertyKey, updateSchemaItemFullName, updateSchemaItemKey } from "./Utils";
|
|
3
|
+
import { applyCustomAttributes } from "./CustomAttributeMerger";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export async function mergePropertyDifference(context, change) {
|
|
8
|
+
const classKey = new SchemaItemKey(change.itemName, context.targetSchemaKey);
|
|
9
|
+
return mergeClassProperty(context, change, classKey, {
|
|
10
|
+
...change.difference,
|
|
11
|
+
name: change.path,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export async function mergeClassProperties(context, change, itemKey) {
|
|
18
|
+
for (const property of change.difference.properties || []) {
|
|
19
|
+
await mergeClassProperty(context, change, itemKey, property);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async function mergeClassProperty(context, change, itemKey, property) {
|
|
23
|
+
return change.changeType === "add"
|
|
24
|
+
? addClassProperty(context, itemKey, property)
|
|
25
|
+
: modifyClassProperty(context, itemKey, property);
|
|
26
|
+
}
|
|
27
|
+
async function addClassProperty(context, itemKey, property) {
|
|
28
|
+
const ecClass = await context.targetSchema.lookupItem(toItemKey(context, itemKey.name));
|
|
29
|
+
if (property.category !== undefined) {
|
|
30
|
+
property.category = await updateSchemaItemFullName(context, property.category);
|
|
31
|
+
}
|
|
32
|
+
if (property.kindOfQuantity !== undefined) {
|
|
33
|
+
property.kindOfQuantity = await updateSchemaItemFullName(context, property.kindOfQuantity);
|
|
34
|
+
}
|
|
35
|
+
await createProperty(context, ecClass.key, property);
|
|
36
|
+
if (property.customAttributes !== undefined) {
|
|
37
|
+
await applyCustomAttributes(context, property.customAttributes, async (ca) => {
|
|
38
|
+
const classEditor = await getClassEditor(context, ecClass.key);
|
|
39
|
+
await classEditor.properties.addCustomAttribute(ecClass.key, property.name, ca);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function createProperty(context, itemKey, property) {
|
|
44
|
+
if (enumerationProperty.is(property)) {
|
|
45
|
+
return enumerationProperty.add(context, itemKey, property);
|
|
46
|
+
}
|
|
47
|
+
if (navigationProperty.is(property)) {
|
|
48
|
+
return navigationProperty.add(context, itemKey, property);
|
|
49
|
+
}
|
|
50
|
+
if (primitiveProperty.is(property)) {
|
|
51
|
+
return primitiveProperty.add(context, itemKey, property);
|
|
52
|
+
}
|
|
53
|
+
if (structProperty.is(property)) {
|
|
54
|
+
return structProperty.add(context, itemKey, property);
|
|
55
|
+
}
|
|
56
|
+
return {};
|
|
57
|
+
}
|
|
58
|
+
async function modifyClassProperty(context, itemKey, propertyProps) {
|
|
59
|
+
const ecClass = await context.targetSchema.lookupItem(toItemKey(context, itemKey.name));
|
|
60
|
+
const propertyKey = toPropertyKey(context, itemKey.name, propertyProps.name);
|
|
61
|
+
const property = await ecClass.getProperty(propertyKey.propertyName);
|
|
62
|
+
if (property === undefined) {
|
|
63
|
+
throw new Error(`Couldn't find property ${propertyKey.propertyName} on class ${ecClass.key.name}`);
|
|
64
|
+
}
|
|
65
|
+
if (propertyProps.type !== undefined) {
|
|
66
|
+
throw new Error(`Changing the property '${property.fullName}' type is not supported.`);
|
|
67
|
+
}
|
|
68
|
+
const classEditor = await getClassEditor(context, ecClass);
|
|
69
|
+
if (propertyProps.description !== undefined) {
|
|
70
|
+
await classEditor.properties.setDescription(ecClass.key, property.name, propertyProps.description);
|
|
71
|
+
}
|
|
72
|
+
if (propertyProps.label !== undefined) {
|
|
73
|
+
await classEditor.properties.setLabel(ecClass.key, property.name, propertyProps.label);
|
|
74
|
+
}
|
|
75
|
+
if (propertyProps.isReadOnly !== undefined) {
|
|
76
|
+
await classEditor.properties.setIsReadOnly(ecClass.key, property.name, propertyProps.isReadOnly);
|
|
77
|
+
}
|
|
78
|
+
if (propertyProps.priority !== undefined) {
|
|
79
|
+
await classEditor.properties.setPriority(ecClass.key, property.name, propertyProps.priority);
|
|
80
|
+
}
|
|
81
|
+
if (propertyProps.kindOfQuantity !== undefined) {
|
|
82
|
+
await classEditor.properties.setKindOfQuantity(ecClass.key, property.name, await updateSchemaItemKey(context, propertyProps.kindOfQuantity));
|
|
83
|
+
}
|
|
84
|
+
if (property.isArray()) {
|
|
85
|
+
await arrayProperty.merge(context, ecClass.key, property.name, propertyProps);
|
|
86
|
+
}
|
|
87
|
+
if (propertyProps.category !== undefined) {
|
|
88
|
+
const categoryKey = await updateSchemaItemKey(context, propertyProps.category);
|
|
89
|
+
await classEditor.properties.setCategory(ecClass.key, property.name, categoryKey);
|
|
90
|
+
}
|
|
91
|
+
if (property.isEnumeration()) {
|
|
92
|
+
return enumerationProperty.merge(context, ecClass.key, property, propertyProps);
|
|
93
|
+
}
|
|
94
|
+
if (property.isNavigation()) {
|
|
95
|
+
return navigationProperty.merge(context, ecClass.key, property, propertyProps);
|
|
96
|
+
}
|
|
97
|
+
if (property.isPrimitive()) {
|
|
98
|
+
return primitiveProperty.merge(context, ecClass.key, property, propertyProps);
|
|
99
|
+
}
|
|
100
|
+
if (property.isStruct()) {
|
|
101
|
+
return structProperty.merge(context, ecClass.key, property, propertyProps);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const arrayProperty = {
|
|
105
|
+
is(property) {
|
|
106
|
+
return "minOccurs" in property && "maxOccurs" in property;
|
|
107
|
+
},
|
|
108
|
+
async merge(context, itemKey, propertyName, props) {
|
|
109
|
+
const classEditor = await getClassEditor(context, itemKey);
|
|
110
|
+
if (props.minOccurs !== undefined) {
|
|
111
|
+
await classEditor.arrayProperties.setMinOccurs(itemKey, propertyName, props.minOccurs);
|
|
112
|
+
}
|
|
113
|
+
if (props.maxOccurs !== undefined) {
|
|
114
|
+
await classEditor.arrayProperties.setMaxOccurs(itemKey, propertyName, props.maxOccurs);
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
const enumerationProperty = {
|
|
119
|
+
is(property) {
|
|
120
|
+
return primitiveProperty.is(property) && property.typeName.includes(".");
|
|
121
|
+
},
|
|
122
|
+
async add(context, itemKey, property) {
|
|
123
|
+
const enumerationKey = await updateSchemaItemKey(context, property.typeName);
|
|
124
|
+
const enumerationType = await context.editor.schemaContext.getSchemaItem(enumerationKey, Enumeration);
|
|
125
|
+
if (enumerationType === undefined) {
|
|
126
|
+
throw new Error(`Unable to locate the enumeration class ${enumerationKey.name} in the context schema.`);
|
|
127
|
+
}
|
|
128
|
+
property.typeName = enumerationType.fullName;
|
|
129
|
+
const classEditor = await getClassEditor(context, itemKey);
|
|
130
|
+
arrayProperty.is(property)
|
|
131
|
+
? await classEditor.createEnumerationArrayPropertyFromProps(itemKey, property.name, enumerationType, property)
|
|
132
|
+
: await classEditor.createEnumerationPropertyFromProps(itemKey, property.name, enumerationType, property);
|
|
133
|
+
},
|
|
134
|
+
async merge(context, itemKey, property, props) {
|
|
135
|
+
if ("enumeration" in props && props.enumeration !== undefined) {
|
|
136
|
+
throw new Error(`Changing the property '${property.fullName}' enumeration is not supported.`);
|
|
137
|
+
}
|
|
138
|
+
return primitiveProperty.merge(context, itemKey, property, props);
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
const navigationProperty = {
|
|
142
|
+
is(property) {
|
|
143
|
+
return property.type === "NavigationProperty";
|
|
144
|
+
},
|
|
145
|
+
async add(context, itemKey, property) {
|
|
146
|
+
const relationshipKey = await updateSchemaItemKey(context, property.relationshipName);
|
|
147
|
+
const relationshipType = await context.editor.schemaContext.getSchemaItem(relationshipKey, RelationshipClass);
|
|
148
|
+
if (relationshipType === undefined) {
|
|
149
|
+
throw new Error(`Unable to locate the relationship class ${relationshipKey.name} in the context schema.`);
|
|
150
|
+
}
|
|
151
|
+
property.relationshipName = relationshipType.fullName;
|
|
152
|
+
const ecClass = await context.editor.schemaContext.getSchemaItem(itemKey);
|
|
153
|
+
if (ecClass.schemaItemType === SchemaItemType.EntityClass)
|
|
154
|
+
return context.editor.entities.createNavigationPropertyFromProps(ecClass.key, property);
|
|
155
|
+
if (ecClass.schemaItemType === SchemaItemType.Mixin)
|
|
156
|
+
return context.editor.mixins.createNavigationPropertyFromProps(ecClass.key, property);
|
|
157
|
+
if (ecClass.schemaItemType === SchemaItemType.RelationshipClass)
|
|
158
|
+
return context.editor.relationships.createNavigationPropertyFromProps(ecClass.key, property);
|
|
159
|
+
throw new Error(`Navigation property can't be added to ${ecClass.schemaItemType}.`);
|
|
160
|
+
},
|
|
161
|
+
async merge(_context, _itemKey, property, props) {
|
|
162
|
+
if (props.direction !== undefined) {
|
|
163
|
+
throw new Error(`Changing the property '${property.fullName}' direction is not supported.`);
|
|
164
|
+
}
|
|
165
|
+
if ("relationshipClass" in props && props.relationshipClass !== undefined) {
|
|
166
|
+
throw new Error(`Changing the property '${property.fullName}' relationship class is not supported.`);
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
const primitiveProperty = {
|
|
171
|
+
is(property) {
|
|
172
|
+
return property.type === "PrimitiveProperty" || property.type === "PrimitiveArrayProperty";
|
|
173
|
+
},
|
|
174
|
+
async add(context, itemKey, property) {
|
|
175
|
+
const propertyType = parsePrimitiveType(property.typeName);
|
|
176
|
+
if (propertyType === undefined) {
|
|
177
|
+
throw new Error(`Invalid property type ${property.typeName} on property ${property.name}`);
|
|
178
|
+
}
|
|
179
|
+
const classEditor = await getClassEditor(context, itemKey);
|
|
180
|
+
return arrayProperty.is(property)
|
|
181
|
+
? classEditor.createPrimitiveArrayPropertyFromProps(itemKey, property.name, propertyType, property)
|
|
182
|
+
: classEditor.createPrimitivePropertyFromProps(itemKey, property.name, propertyType, property);
|
|
183
|
+
},
|
|
184
|
+
async merge(context, itemKey, property, props) {
|
|
185
|
+
if (props.typeName) {
|
|
186
|
+
throw new Error(`Changing the property '${property.fullName}' primitiveType is not supported.`);
|
|
187
|
+
}
|
|
188
|
+
const classEditor = await getClassEditor(context, itemKey);
|
|
189
|
+
if (props.extendedTypeName !== undefined) {
|
|
190
|
+
await classEditor.primitiveProperties.setExtendedTypeName(itemKey, property.name, props.extendedTypeName);
|
|
191
|
+
}
|
|
192
|
+
if (props.minLength !== undefined) {
|
|
193
|
+
await classEditor.primitiveProperties.setMinLength(itemKey, property.name, props.minLength);
|
|
194
|
+
}
|
|
195
|
+
if (props.maxLength !== undefined) {
|
|
196
|
+
await classEditor.primitiveProperties.setMaxLength(itemKey, property.name, props.maxLength);
|
|
197
|
+
}
|
|
198
|
+
if (props.minValue !== undefined) {
|
|
199
|
+
await classEditor.primitiveProperties.setMinValue(itemKey, property.name, props.minValue);
|
|
200
|
+
}
|
|
201
|
+
if (props.maxValue !== undefined) {
|
|
202
|
+
await classEditor.primitiveProperties.setMaxValue(itemKey, property.name, props.maxValue);
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
const structProperty = {
|
|
207
|
+
is(property) {
|
|
208
|
+
return property.type === "StructProperty" || property.type === "StructArrayProperty";
|
|
209
|
+
},
|
|
210
|
+
async add(context, itemKey, property) {
|
|
211
|
+
const structKey = await updateSchemaItemKey(context, property.typeName);
|
|
212
|
+
const structType = await context.editor.schemaContext.getSchemaItem(structKey, StructClass);
|
|
213
|
+
if (structType === undefined) {
|
|
214
|
+
throw new Error(`Unable to locate the struct ${structKey.name} in the context schema.`);
|
|
215
|
+
}
|
|
216
|
+
property.typeName = structType.fullName;
|
|
217
|
+
const classEditor = await getClassEditor(context, itemKey);
|
|
218
|
+
return arrayProperty.is(property)
|
|
219
|
+
? classEditor.createStructArrayPropertyFromProps(itemKey, property.name, structType, property)
|
|
220
|
+
: classEditor.createStructPropertyFromProps(itemKey, property.name, structType, property);
|
|
221
|
+
},
|
|
222
|
+
async merge(_context, _itemKey, property, props) {
|
|
223
|
+
if ("structClass" in props && props.structClass !== undefined) {
|
|
224
|
+
throw new Error(`Changing the property '${property.fullName}' structClass is not supported.`);
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
//# sourceMappingURL=PropertyMerger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyMerger.js","sourceRoot":"","sources":["../../../src/Merging/PropertyMerger.ts"],"names":[],"mappings":"AAMA,OAAO,EAA+E,WAAW,EAAqD,kBAAkB,EAA0B,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAuB,MAAM,0BAA0B,CAAC;AACvT,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAElH,OAA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,aAAa,IAAI,KAAK,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9D,MAAM,IAAI,KAAK,CAAC,0BAA0B,QAAQ,CAAC,QAAQ,iCAAiC,CAAC,CAAC;QAChG,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { SchemaMergeContext } from \"./SchemaMerger\";\nimport type { AnyClassItemDifference, ClassPropertyDifference, DifferenceType } from \"../Differencing/SchemaDifference\";\nimport { AnyProperty, AnyPropertyProps, ArrayPropertyProps, CustomAttribute, ECClass, Enumeration, EnumerationPropertyProps, NavigationPropertyProps, parsePrimitiveType, PrimitivePropertyProps, RelationshipClass, SchemaItemKey, SchemaItemType, StructClass, StructPropertyProps } from \"@itwin/ecschema-metadata\";\nimport { getClassEditor, toItemKey, toPropertyKey, updateSchemaItemFullName, updateSchemaItemKey } from \"./Utils\";\nimport { MutableProperty } from \"../Editing/Mutable/MutableProperty\";\nimport { applyCustomAttributes } from \"./CustomAttributeMerger\";\n\ntype PartialEditable<T> = {\n -readonly [P in keyof T]: T[P];\n};\n\ninterface PropertyMerger<T extends AnyPropertyProps> {\n is(property: AnyPropertyProps): property is T;\n add(context: SchemaMergeContext, itemKey: SchemaItemKey, props: PartialEditable<T>): Promise<void>;\n merge(context: SchemaMergeContext, itemKey: SchemaItemKey, property: AnyProperty, props: T): Promise<void>;\n}\n\n/**\n * @internal\n */\nexport async function mergePropertyDifference(context: SchemaMergeContext, change: ClassPropertyDifference): Promise<void> {\n const classKey = new SchemaItemKey(change.itemName, context.targetSchemaKey);\n return mergeClassProperty(context, change, classKey, {\n ...change.difference,\n name: change.path,\n } as AnyPropertyProps);\n}\n\n/**\n * @internal\n */\nexport async function mergeClassProperties(context: SchemaMergeContext, change: AnyClassItemDifference, itemKey: SchemaItemKey): Promise<void> {\n for (const property of change.difference.properties || []) {\n await mergeClassProperty(context, change, itemKey, property);\n }\n}\n\nasync function mergeClassProperty(context: SchemaMergeContext, change: { changeType: DifferenceType }, itemKey: SchemaItemKey, property: AnyPropertyProps) {\n return change.changeType === \"add\"\n ? addClassProperty(context, itemKey, property)\n : modifyClassProperty(context, itemKey, property);\n}\n\nasync function addClassProperty(context: SchemaMergeContext, itemKey: SchemaItemKey, property: PartialEditable<AnyPropertyProps>): Promise<void> {\n const ecClass = await context.targetSchema.lookupItem(toItemKey(context, itemKey.name)) as ECClass;\n\n if (property.category !== undefined) {\n property.category = await updateSchemaItemFullName(context, property.category);\n }\n\n if (property.kindOfQuantity !== undefined) {\n property.kindOfQuantity = await updateSchemaItemFullName(context, property.kindOfQuantity);\n }\n\n await createProperty(context, ecClass.key, property);\n\n if (property.customAttributes !== undefined) {\n await applyCustomAttributes(context, property.customAttributes as CustomAttribute[], async (ca) => {\n const classEditor = await getClassEditor(context, ecClass.key);\n await classEditor.properties.addCustomAttribute(ecClass.key, property.name, ca);\n });\n }\n}\n\nasync function createProperty(context: SchemaMergeContext, itemKey: SchemaItemKey, property: PartialEditable<AnyPropertyProps>) {\n if (enumerationProperty.is(property)) {\n return enumerationProperty.add(context, itemKey, property);\n }\n if (navigationProperty.is(property)) {\n return navigationProperty.add(context, itemKey, property);\n }\n if (primitiveProperty.is(property)) {\n return primitiveProperty.add(context, itemKey, property);\n }\n if (structProperty.is(property)) {\n return structProperty.add(context, itemKey, property);\n }\n return {};\n}\n\nasync function modifyClassProperty(context: SchemaMergeContext, itemKey: SchemaItemKey, propertyProps: AnyPropertyProps): Promise<void> {\n const ecClass = await context.targetSchema.lookupItem(toItemKey(context, itemKey.name)) as ECClass;\n const propertyKey = toPropertyKey(context, itemKey.name, propertyProps.name);\n const property = await ecClass.getProperty(propertyKey.propertyName) as MutableProperty;\n\n if (property === undefined) {\n throw new Error(`Couldn't find property ${propertyKey.propertyName} on class ${ecClass.key.name}`);\n }\n\n if (propertyProps.type !== undefined) {\n throw new Error(`Changing the property '${property.fullName}' type is not supported.`);\n }\n\n const classEditor = await getClassEditor(context, ecClass);\n\n if (propertyProps.description !== undefined) {\n await classEditor.properties.setDescription(ecClass.key, property.name, propertyProps.description);\n }\n if (propertyProps.label !== undefined) {\n await classEditor.properties.setLabel(ecClass.key, property.name, propertyProps.label);\n }\n if (propertyProps.isReadOnly !== undefined) {\n await classEditor.properties.setIsReadOnly(ecClass.key, property.name, propertyProps.isReadOnly);\n }\n if (propertyProps.priority !== undefined) {\n await classEditor.properties.setPriority(ecClass.key, property.name, propertyProps.priority);\n }\n if (propertyProps.kindOfQuantity !== undefined) {\n await classEditor.properties.setKindOfQuantity(ecClass.key, property.name, await updateSchemaItemKey(context, propertyProps.kindOfQuantity));\n }\n\n if (property.isArray()) {\n await arrayProperty.merge(context, ecClass.key, property.name, propertyProps);\n }\n\n if (propertyProps.category !== undefined) {\n const categoryKey = await updateSchemaItemKey(context, propertyProps.category);\n await classEditor.properties.setCategory(ecClass.key, property.name, categoryKey);\n }\n\n if (property.isEnumeration()) {\n return enumerationProperty.merge(context, ecClass.key, property, propertyProps as any);\n }\n if (property.isNavigation()) {\n return navigationProperty.merge(context, ecClass.key, property, propertyProps as any);\n }\n if (property.isPrimitive()) {\n return primitiveProperty.merge(context, ecClass.key, property, propertyProps as any);\n }\n if (property.isStruct()) {\n return structProperty.merge(context, ecClass.key, property, propertyProps as any);\n }\n}\n\nconst arrayProperty = {\n is(property: AnyPropertyProps): boolean {\n return \"minOccurs\" in property && \"maxOccurs\" in property;\n },\n async merge(context: SchemaMergeContext, itemKey: SchemaItemKey, propertyName: string, props: ArrayPropertyProps) {\n const classEditor = await getClassEditor(context, itemKey);\n if (props.minOccurs !== undefined) {\n await classEditor.arrayProperties.setMinOccurs(itemKey, propertyName, props.minOccurs);\n }\n if (props.maxOccurs !== undefined) {\n await classEditor.arrayProperties.setMaxOccurs(itemKey, propertyName, props.maxOccurs);\n }\n },\n};\n\nconst enumerationProperty: PropertyMerger<EnumerationPropertyProps> = {\n is(property): property is EnumerationPropertyProps {\n return primitiveProperty.is(property) && property.typeName.includes(\".\");\n },\n async add(context, itemKey, property): Promise<void> {\n const enumerationKey = await updateSchemaItemKey(context, property.typeName);\n const enumerationType = await context.editor.schemaContext.getSchemaItem(enumerationKey, Enumeration);\n if (enumerationType === undefined) {\n throw new Error(`Unable to locate the enumeration class ${enumerationKey.name} in the context schema.`);\n }\n\n property.typeName = enumerationType.fullName;\n\n const classEditor = await getClassEditor(context, itemKey);\n\n arrayProperty.is(property)\n ? await classEditor.createEnumerationArrayPropertyFromProps(itemKey, property.name, enumerationType, property)\n : await classEditor.createEnumerationPropertyFromProps(itemKey, property.name, enumerationType, property);\n },\n async merge(context, itemKey, property, props) {\n if (\"enumeration\" in props && props.enumeration !== undefined) {\n throw new Error(`Changing the property '${property.fullName}' enumeration is not supported.`);\n }\n return primitiveProperty.merge(context, itemKey, property, props);\n },\n};\n\nconst navigationProperty: PropertyMerger<NavigationPropertyProps> = {\n is(property): property is NavigationPropertyProps {\n return property.type === \"NavigationProperty\";\n },\n async add(context, itemKey, property): Promise<void> {\n const relationshipKey = await updateSchemaItemKey(context, property.relationshipName);\n const relationshipType = await context.editor.schemaContext.getSchemaItem(relationshipKey, RelationshipClass);\n if (relationshipType === undefined) {\n throw new Error(`Unable to locate the relationship class ${relationshipKey.name} in the context schema.`);\n }\n\n property.relationshipName = relationshipType.fullName;\n\n const ecClass = await context.editor.schemaContext.getSchemaItem(itemKey) as ECClass;\n if (ecClass.schemaItemType === SchemaItemType.EntityClass)\n return context.editor.entities.createNavigationPropertyFromProps(ecClass.key, property);\n if (ecClass.schemaItemType === SchemaItemType.Mixin)\n return context.editor.mixins.createNavigationPropertyFromProps(ecClass.key, property);\n if (ecClass.schemaItemType === SchemaItemType.RelationshipClass)\n return context.editor.relationships.createNavigationPropertyFromProps(ecClass.key, property);\n throw new Error(`Navigation property can't be added to ${ecClass.schemaItemType}.`);\n },\n async merge(_context, _itemKey, property, props) {\n if (props.direction !== undefined) {\n throw new Error(`Changing the property '${property.fullName}' direction is not supported.`);\n }\n if (\"relationshipClass\" in props && props.relationshipClass !== undefined) {\n throw new Error(`Changing the property '${property.fullName}' relationship class is not supported.`);\n }\n },\n};\n\nconst primitiveProperty: PropertyMerger<PrimitivePropertyProps> = {\n is(property): property is PrimitivePropertyProps {\n return property.type === \"PrimitiveProperty\" || property.type === \"PrimitiveArrayProperty\";\n },\n async add(context, itemKey, property): Promise<void> {\n const propertyType = parsePrimitiveType(property.typeName);\n if (propertyType === undefined) {\n throw new Error(`Invalid property type ${property.typeName} on property ${property.name}`);\n }\n\n const classEditor = await getClassEditor(context, itemKey);\n return arrayProperty.is(property)\n ? classEditor.createPrimitiveArrayPropertyFromProps(itemKey, property.name, propertyType, property)\n : classEditor.createPrimitivePropertyFromProps(itemKey, property.name, propertyType, property);\n },\n async merge(context, itemKey, property, props) {\n if (props.typeName) {\n throw new Error(`Changing the property '${property.fullName}' primitiveType is not supported.`);\n }\n\n const classEditor = await getClassEditor(context, itemKey);\n if (props.extendedTypeName !== undefined) {\n await classEditor.primitiveProperties.setExtendedTypeName(itemKey, property.name, props.extendedTypeName);\n }\n if (props.minLength !== undefined) {\n await classEditor.primitiveProperties.setMinLength(itemKey, property.name, props.minLength);\n }\n if (props.maxLength !== undefined) {\n await classEditor.primitiveProperties.setMaxLength(itemKey, property.name, props.maxLength);\n }\n if (props.minValue !== undefined) {\n await classEditor.primitiveProperties.setMinValue(itemKey, property.name, props.minValue);\n }\n if (props.maxValue !== undefined) {\n await classEditor.primitiveProperties.setMaxValue(itemKey, property.name, props.maxValue);\n }\n },\n};\n\nconst structProperty: PropertyMerger<StructPropertyProps> = {\n is(property): property is StructPropertyProps {\n return property.type === \"StructProperty\" || property.type === \"StructArrayProperty\";\n },\n async add(context, itemKey, property): Promise<void> {\n const structKey = await updateSchemaItemKey(context, property.typeName);\n const structType = await context.editor.schemaContext.getSchemaItem(structKey, StructClass);\n if (structType === undefined) {\n throw new Error(`Unable to locate the struct ${structKey.name} in the context schema.`);\n }\n\n property.typeName = structType.fullName;\n\n const classEditor = await getClassEditor(context, itemKey);\n return arrayProperty.is(property)\n ? classEditor.createStructArrayPropertyFromProps(itemKey, property.name, structType, property)\n : classEditor.createStructPropertyFromProps(itemKey, property.name, structType, property);\n },\n async merge(_context, _itemKey, property, props) {\n if (\"structClass\" in props && props.structClass !== undefined) {\n throw new Error(`Changing the property '${property.fullName}' structClass is not supported.`);\n }\n },\n};\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { RelationshipClassDifference, RelationshipConstraintClassDifference, RelationshipConstraintDifference } from "../Differencing/SchemaDifference";
|
|
2
|
+
import { SchemaMergeContext } from "./SchemaMerger";
|
|
3
|
+
import { SchemaItemKey } from "@itwin/ecschema-metadata";
|
|
4
|
+
/**
|
|
5
|
+
* Merges a new RelationshipClass into the target schema.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare function addRelationshipClass(context: SchemaMergeContext, change: RelationshipClassDifference): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Merges differences to an existing RelationshipClass in the target schema.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function modifyRelationshipClass(context: SchemaMergeContext, change: RelationshipClassDifference, itemKey: SchemaItemKey): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Merges differences of a Relationship constraint.
|
|
16
|
+
* This only supports modify as the RelationshipConstraints are always set on the Relationship classes.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare function mergeRelationshipConstraint(context: SchemaMergeContext, change: RelationshipConstraintDifference): Promise<void | {
|
|
20
|
+
itemKey: SchemaItemKey;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Merges differences of a Relationship constraint classes.
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare function mergeRelationshipClassConstraint(context: SchemaMergeContext, change: RelationshipConstraintClassDifference): Promise<void>;
|
|
27
|
+
//# sourceMappingURL=RelationshipClassMerger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelationshipClassMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/RelationshipClassMerger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,2BAA2B,EAAE,qCAAqC,EAAE,gCAAgC,EAAE,MAAM,kCAAkC,CAAC;AAI7J,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAgJ,aAAa,EAAkB,MAAM,0BAA0B,CAAC;AAEvN;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,2BAA2B,iBAuB1G;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,2BAA2B,EAAE,OAAO,EAAE,aAAa,iBAyBrI;AAED;;;;GAIG;AACH,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,gCAAgC;;GAgCtH;AAED;;;GAGG;AACH,wBAAsB,gCAAgC,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,qCAAqC,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBhJ"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { locateSchemaItem, updateSchemaItemFullName, updateSchemaItemKey } from "./Utils";
|
|
2
|
+
import { modifyClass } from "./ClassMerger";
|
|
3
|
+
import { ECClass, EntityClass, Mixin, parseStrength, parseStrengthDirection, RelationshipClass, RelationshipMultiplicity, SchemaItemType } from "@itwin/ecschema-metadata";
|
|
4
|
+
/**
|
|
5
|
+
* Merges a new RelationshipClass into the target schema.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export async function addRelationshipClass(context, change) {
|
|
9
|
+
if (change.difference.strength === undefined) {
|
|
10
|
+
throw new Error("RelationshipClass must define strength");
|
|
11
|
+
}
|
|
12
|
+
if (change.difference.strengthDirection === undefined) {
|
|
13
|
+
throw new Error("RelationshipClass must define strengthDirection");
|
|
14
|
+
}
|
|
15
|
+
if (change.difference.source === undefined) {
|
|
16
|
+
throw new Error("RelationshipClass must define a source constraint");
|
|
17
|
+
}
|
|
18
|
+
if (change.difference.target === undefined) {
|
|
19
|
+
throw new Error("RelationshipClass must define a target constraint");
|
|
20
|
+
}
|
|
21
|
+
await context.editor.relationships.createFromProps(context.targetSchemaKey, {
|
|
22
|
+
...change.difference,
|
|
23
|
+
name: change.itemName,
|
|
24
|
+
schemaItemType: change.schemaType,
|
|
25
|
+
strength: change.difference.strength,
|
|
26
|
+
strengthDirection: change.difference.strengthDirection,
|
|
27
|
+
source: await updateRelationshipConstraintKey(context, change.difference.source),
|
|
28
|
+
target: await updateRelationshipConstraintKey(context, change.difference.target),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Merges differences to an existing RelationshipClass in the target schema.
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
export async function modifyRelationshipClass(context, change, itemKey) {
|
|
36
|
+
const item = await context.targetSchema.lookupItem(itemKey);
|
|
37
|
+
if (change.changeType === "modify") {
|
|
38
|
+
if (change.difference.strength !== undefined) {
|
|
39
|
+
if (item.strength === undefined) {
|
|
40
|
+
const strength = parseStrength(change.difference.strength);
|
|
41
|
+
if (strength === undefined) {
|
|
42
|
+
throw new Error(`An invalid relationship class strength value '${change.difference.strength}' has been provided.`);
|
|
43
|
+
}
|
|
44
|
+
item.setStrength(strength);
|
|
45
|
+
}
|
|
46
|
+
throw new Error(`Changing the relationship '${itemKey.name}' strength is not supported.`);
|
|
47
|
+
}
|
|
48
|
+
if (change.difference.strengthDirection !== undefined) {
|
|
49
|
+
if (item.strengthDirection === undefined) {
|
|
50
|
+
const strengthDirection = parseStrengthDirection(change.difference.strengthDirection);
|
|
51
|
+
if (strengthDirection === undefined) {
|
|
52
|
+
throw new Error(`An invalid relationship class strengthDirection value '${change.difference.strengthDirection}' has been provided.`);
|
|
53
|
+
}
|
|
54
|
+
item.setStrengthDirection(strengthDirection);
|
|
55
|
+
}
|
|
56
|
+
throw new Error(`Changing the relationship '${itemKey.name}' strengthDirection is not supported.`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
await modifyClass(context, change, itemKey, item);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Merges differences of a Relationship constraint.
|
|
63
|
+
* This only supports modify as the RelationshipConstraints are always set on the Relationship classes.
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export async function mergeRelationshipConstraint(context, change) {
|
|
67
|
+
if (change.changeType !== "modify") {
|
|
68
|
+
throw new Error("RelationshipConstraints can only be modified.");
|
|
69
|
+
}
|
|
70
|
+
const item = await locateSchemaItem(context, change.itemName, SchemaItemType.RelationshipClass);
|
|
71
|
+
const constraint = item[parseConstraint(change.path)];
|
|
72
|
+
if (change.difference.roleLabel !== undefined) {
|
|
73
|
+
constraint.roleLabel = change.difference.roleLabel;
|
|
74
|
+
}
|
|
75
|
+
if (change.difference.polymorphic !== undefined) {
|
|
76
|
+
await context.editor.relationships.setConstraintPolymorphic(constraint, change.difference.polymorphic);
|
|
77
|
+
}
|
|
78
|
+
if (change.difference.multiplicity !== undefined) {
|
|
79
|
+
if (constraint.multiplicity === undefined) {
|
|
80
|
+
const multiplicity = RelationshipMultiplicity.fromString(change.difference.multiplicity);
|
|
81
|
+
if (multiplicity === undefined) {
|
|
82
|
+
throw new Error(`An invalid relationship constraint multiplicity value '${change.difference.multiplicity}' has been provided.`);
|
|
83
|
+
}
|
|
84
|
+
await context.editor.relationships.setConstraintMultiplicity(constraint, multiplicity);
|
|
85
|
+
}
|
|
86
|
+
throw new Error(`Changing the relationship constraint '${constraint.fullName}' multiplicity is not supported.`);
|
|
87
|
+
}
|
|
88
|
+
if (change.difference.abstractConstraint !== undefined) {
|
|
89
|
+
const itemKey = await updateSchemaItemKey(context, change.difference.abstractConstraint);
|
|
90
|
+
const abstractConstraint = await context.editor.schemaContext.getSchemaItem(itemKey, ECClass);
|
|
91
|
+
if (abstractConstraint === undefined || (!EntityClass.isEntityClass(abstractConstraint) && !Mixin.isMixin(abstractConstraint) && !RelationshipClass.isRelationshipClass(abstractConstraint))) {
|
|
92
|
+
throw new Error(`Unable to locate the abstract constraint class ${change.difference.abstractConstraint} in the context schema.`);
|
|
93
|
+
}
|
|
94
|
+
return context.editor.relationships.setAbstractConstraint(constraint, abstractConstraint);
|
|
95
|
+
}
|
|
96
|
+
return { itemKey: constraint.relationshipClass.key };
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Merges differences of a Relationship constraint classes.
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
102
|
+
export async function mergeRelationshipClassConstraint(context, change) {
|
|
103
|
+
if (change.changeType !== "add") {
|
|
104
|
+
throw new Error(`Change type ${change.changeType} is not supported for Relationship constraint classes.`);
|
|
105
|
+
}
|
|
106
|
+
const item = await locateSchemaItem(context, change.itemName, SchemaItemType.RelationshipClass);
|
|
107
|
+
const constraint = item[parseConstraint(change.path)];
|
|
108
|
+
for (const constraintName of change.difference) {
|
|
109
|
+
const constraintClassKey = await updateSchemaItemKey(context, constraintName);
|
|
110
|
+
const constraintClass = await context.editor.schemaContext.getSchemaItem(constraintClassKey, ECClass);
|
|
111
|
+
if (constraintClass === undefined || (!EntityClass.isEntityClass(constraintClass) && !Mixin.isMixin(constraintClass) && !RelationshipClass.isRelationshipClass(constraintClass))) {
|
|
112
|
+
throw new Error(`Could not locate relationship constraint class ${constraintClassKey.name}`);
|
|
113
|
+
}
|
|
114
|
+
await context.editor.relationships.addConstraintClass(constraint, constraintClass);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function parseConstraint(path) {
|
|
118
|
+
return path.startsWith("$source")
|
|
119
|
+
? "source"
|
|
120
|
+
: "target";
|
|
121
|
+
}
|
|
122
|
+
async function updateRelationshipConstraintKey(context, props) {
|
|
123
|
+
let abstractConstraint = props.abstractConstraint;
|
|
124
|
+
if (abstractConstraint !== undefined)
|
|
125
|
+
abstractConstraint = await updateSchemaItemFullName(context, abstractConstraint);
|
|
126
|
+
const constraintClasses = [];
|
|
127
|
+
for (const ecClass of props.constraintClasses) {
|
|
128
|
+
constraintClasses.push(await updateSchemaItemFullName(context, ecClass));
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
...props,
|
|
132
|
+
abstractConstraint,
|
|
133
|
+
constraintClasses,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=RelationshipClassMerger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelationshipClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/RelationshipClassMerger.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,iBAAiB,EAA+B,wBAAwB,EAAiB,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEvN;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAA2B,EAAE,MAAmC;IACzG,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;QACtD,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,CAA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AC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC;YAChL,MAAM,IAAI,KAAK,CAAC,kDAAkD,kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAC;QAC/F,CAAC;QAED,MAAM,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,kBAAkB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IACrF,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,IAAY;IACnC,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QAC/B,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,QAAQ,CAAC;AACf,CAAC;AAED,KAAK,UAAU,+BAA+B,CAAC,OAA2B,EAAE,KAAkC;IAC5G,IAAI,kBAAkB,GAAG,KAAK,CAAC,kBAAkB,CAAC;IAClD,IAAI,kBAAkB,KAAK,SAAS;QAClC,kBAAkB,GAAG,MAAM,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;IAEnF,MAAM,iBAAiB,GAAa,EAAE,CAAC;IACvC,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC9C,iBAAiB,CAAC,IAAI,CAAC,MAAM,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO;QACL,GAAG,KAAK;QACR,kBAAkB;QAClB,iBAAiB;KAClB,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { RelationshipClassDifference, RelationshipConstraintClassDifference, RelationshipConstraintDifference } from \"../Differencing/SchemaDifference\";\nimport type { MutableRelationshipClass } from \"../Editing/Mutable/MutableRelationshipClass\";\nimport { locateSchemaItem, updateSchemaItemFullName, updateSchemaItemKey } from \"./Utils\";\nimport { modifyClass } from \"./ClassMerger\";\nimport { SchemaMergeContext } from \"./SchemaMerger\";\nimport { ECClass, EntityClass, Mixin, parseStrength, parseStrengthDirection, RelationshipClass, RelationshipConstraintProps, RelationshipMultiplicity, SchemaItemKey, SchemaItemType } from \"@itwin/ecschema-metadata\";\n\n/**\n * Merges a new RelationshipClass into the target schema.\n * @internal\n */\nexport async function addRelationshipClass(context: SchemaMergeContext, change: RelationshipClassDifference) {\n if (change.difference.strength === undefined) {\n throw new Error(\"RelationshipClass must define strength\");\n }\n if (change.difference.strengthDirection === undefined) {\n throw new Error(\"RelationshipClass must define strengthDirection\");\n }\n if (change.difference.source === undefined) {\n throw new Error(\"RelationshipClass must define a source constraint\");\n }\n if (change.difference.target === undefined) {\n throw new Error(\"RelationshipClass must define a target constraint\");\n }\n\n await context.editor.relationships.createFromProps(context.targetSchemaKey, {\n ...change.difference,\n name: change.itemName,\n schemaItemType: change.schemaType,\n strength: change.difference.strength,\n strengthDirection: change.difference.strengthDirection,\n source: await updateRelationshipConstraintKey(context, change.difference.source),\n target: await updateRelationshipConstraintKey(context, change.difference.target),\n });\n}\n\n/**\n * Merges differences to an existing RelationshipClass in the target schema.\n * @internal\n */\nexport async function modifyRelationshipClass(context: SchemaMergeContext, change: RelationshipClassDifference, itemKey: SchemaItemKey) {\n const item = await context.targetSchema.lookupItem(itemKey) as MutableRelationshipClass;\n if(change.changeType === \"modify\") {\n if(change.difference.strength !== undefined) {\n if (item.strength === undefined) {\n const strength = parseStrength(change.difference.strength);\n if (strength === undefined) {\n throw new Error(`An invalid relationship class strength value '${change.difference.strength}' has been provided.`);\n }\n item.setStrength(strength);\n }\n throw new Error(`Changing the relationship '${itemKey.name}' strength is not supported.`);\n }\n if(change.difference.strengthDirection !== undefined) {\n if (item.strengthDirection === undefined) {\n const strengthDirection = parseStrengthDirection(change.difference.strengthDirection);\n if (strengthDirection === undefined) {\n throw new Error(`An invalid relationship class strengthDirection value '${change.difference.strengthDirection}' has been provided.`);\n }\n item.setStrengthDirection(strengthDirection);\n }\n throw new Error(`Changing the relationship '${itemKey.name}' strengthDirection is not supported.`);\n }\n }\n await modifyClass(context, change, itemKey, item);\n}\n\n/**\n * Merges differences of a Relationship constraint.\n * This only supports modify as the RelationshipConstraints are always set on the Relationship classes.\n * @internal\n */\nexport async function mergeRelationshipConstraint(context: SchemaMergeContext, change: RelationshipConstraintDifference) {\n if(change.changeType !== \"modify\") {\n throw new Error(\"RelationshipConstraints can only be modified.\");\n }\n\n const item = await locateSchemaItem(context, change.itemName, SchemaItemType.RelationshipClass) as MutableRelationshipClass;\n const constraint = item[parseConstraint(change.path)];\n if(change.difference.roleLabel !== undefined) {\n constraint.roleLabel = change.difference.roleLabel;\n }\n if(change.difference.polymorphic !== undefined) {\n await context.editor.relationships.setConstraintPolymorphic(constraint, change.difference.polymorphic);\n }\n if(change.difference.multiplicity !== undefined) {\n if (constraint.multiplicity === undefined) {\n const multiplicity = RelationshipMultiplicity.fromString(change.difference.multiplicity);\n if (multiplicity === undefined) {\n throw new Error(`An invalid relationship constraint multiplicity value '${change.difference.multiplicity}' has been provided.`);\n }\n await context.editor.relationships.setConstraintMultiplicity(constraint, multiplicity);\n }\n throw new Error(`Changing the relationship constraint '${constraint.fullName}' multiplicity is not supported.`);\n }\n if(change.difference.abstractConstraint !== undefined) {\n const itemKey = await updateSchemaItemKey(context, change.difference.abstractConstraint);\n const abstractConstraint = await context.editor.schemaContext.getSchemaItem(itemKey, ECClass);\n if (abstractConstraint === undefined || (!EntityClass.isEntityClass(abstractConstraint) && !Mixin.isMixin(abstractConstraint) && !RelationshipClass.isRelationshipClass(abstractConstraint))) {\n throw new Error(`Unable to locate the abstract constraint class ${change.difference.abstractConstraint} in the context schema.`);\n }\n return context.editor.relationships.setAbstractConstraint(constraint, abstractConstraint);\n }\n return { itemKey: constraint.relationshipClass.key };\n}\n\n/**\n * Merges differences of a Relationship constraint classes.\n * @internal\n */\nexport async function mergeRelationshipClassConstraint(context: SchemaMergeContext, change: RelationshipConstraintClassDifference): Promise<void> {\n if(change.changeType !== \"add\") {\n throw new Error(`Change type ${change.changeType} is not supported for Relationship constraint classes.`);\n }\n\n const item = await locateSchemaItem(context, change.itemName, SchemaItemType.RelationshipClass) as MutableRelationshipClass;\n const constraint = item[parseConstraint(change.path)];\n for(const constraintName of change.difference) {\n const constraintClassKey = await updateSchemaItemKey(context, constraintName);\n const constraintClass = await context.editor.schemaContext.getSchemaItem(constraintClassKey, ECClass);\n if(constraintClass === undefined || (!EntityClass.isEntityClass(constraintClass) && !Mixin.isMixin(constraintClass) && !RelationshipClass.isRelationshipClass(constraintClass))) {\n throw new Error(`Could not locate relationship constraint class ${constraintClassKey.name}`);\n }\n\n await context.editor.relationships.addConstraintClass(constraint, constraintClass);\n }\n}\n\nfunction parseConstraint(path: string): \"source\" | \"target\" {\n return path.startsWith(\"$source\")\n ? \"source\"\n : \"target\";\n}\n\nasync function updateRelationshipConstraintKey(context: SchemaMergeContext, props: RelationshipConstraintProps): Promise<RelationshipConstraintProps> {\n let abstractConstraint = props.abstractConstraint;\n if (abstractConstraint !== undefined)\n abstractConstraint = await updateSchemaItemFullName(context, abstractConstraint);\n\n const constraintClasses: string[] = [];\n for (const ecClass of props.constraintClasses) {\n constraintClasses.push(await updateSchemaItemFullName(context, ecClass));\n }\n\n return {\n ...props,\n abstractConstraint,\n constraintClasses,\n };\n}\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Merging
|
|
3
|
+
*/
|
|
4
|
+
import { Schema, SchemaContext, SchemaKey } from "@itwin/ecschema-metadata";
|
|
5
|
+
import { SchemaContextEditor } from "../Editing/Editor";
|
|
6
|
+
import { type SchemaDifferenceResult } from "../Differencing/SchemaDifference";
|
|
7
|
+
import { SchemaEdits } from "./Edits/SchemaEdits";
|
|
8
|
+
import { NameMapping } from "./Edits/NameMapping";
|
|
9
|
+
/**
|
|
10
|
+
* Defines the context of a Schema merging run.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export interface SchemaMergeContext {
|
|
14
|
+
readonly targetSchema: Schema;
|
|
15
|
+
readonly targetSchemaKey: SchemaKey;
|
|
16
|
+
readonly sourceSchemaKey: SchemaKey;
|
|
17
|
+
readonly editor: SchemaContextEditor;
|
|
18
|
+
readonly nameMapping: NameMapping;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Class to merge two schemas together.
|
|
22
|
+
* @see [[merge]] or [[mergeSchemas]] to merge two schemas together.
|
|
23
|
+
* @beta
|
|
24
|
+
*/
|
|
25
|
+
export declare class SchemaMerger {
|
|
26
|
+
private readonly _editingContext;
|
|
27
|
+
/**
|
|
28
|
+
* Constructs a new instance of the SchemaMerger object.
|
|
29
|
+
* @param editingContext The schema contexts that holds the schema to be edited.
|
|
30
|
+
*/
|
|
31
|
+
constructor(editingContext: SchemaContext);
|
|
32
|
+
/**
|
|
33
|
+
* Copy the SchemaItems of the source schemas to the target schema.
|
|
34
|
+
* @param targetSchema The schema the SchemaItems gets merged to.
|
|
35
|
+
* @param sourceSchema The schema the SchemaItems gets copied from.
|
|
36
|
+
* @param edits An optional instance of schema edits that shall be applied before the schemas get merged.
|
|
37
|
+
* @returns The merged target schema.
|
|
38
|
+
* @alpha
|
|
39
|
+
*/
|
|
40
|
+
mergeSchemas(targetSchema: Schema, sourceSchema: Schema, edits?: SchemaEdits): Promise<Schema>;
|
|
41
|
+
/**
|
|
42
|
+
* Merges the schema differences into the target schema context.
|
|
43
|
+
* @param differenceResult The differences that shall be applied to the target schema.
|
|
44
|
+
* @param edits An optional instance of schema edits that shall be applied before the schemas get merged.
|
|
45
|
+
* @alpha
|
|
46
|
+
*/
|
|
47
|
+
merge(differenceResult: SchemaDifferenceResult, edits?: SchemaEdits): Promise<Schema>;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=SchemaMerger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/SchemaMerger.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,aAAa,EAA6B,SAAS,EAAmB,MAAM,0BAA0B,CAAC;AACxH,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAwB,KAAK,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAGrG,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;CACnC;AAED;;;;GAIG;AACH,qBAAa,YAAY;IAEvB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgB;IAEhD;;;OAGG;gBACS,cAAc,EAAE,aAAa;IAIzC;;;;;;;OAOG;IACU,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAI3G;;;;;OAKG;IACU,KAAK,CAAC,gBAAgB,EAAE,sBAAsB,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;CA+CnG"}
|