@itwin/ecschema-editing 5.0.0-dev.9 → 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/CHANGELOG.md +51 -1
- package/lib/cjs/Differencing/Errors.js +6 -0
- package/lib/cjs/Differencing/Errors.js.map +1 -1
- package/lib/cjs/Differencing/SchemaConflicts.d.ts +3 -1
- package/lib/cjs/Differencing/SchemaConflicts.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaConflicts.js +2 -0
- package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts +4 -3
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +57 -11
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifference.d.ts +33 -4
- package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDifference.js +55 -5
- package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifferenceValidator.d.ts +2 -1
- package/lib/cjs/Differencing/SchemaDifferenceValidator.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDifferenceValidator.js +78 -19
- package/lib/cjs/Differencing/SchemaDifferenceValidator.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifferenceVisitor.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDifferenceVisitor.js +5 -0
- package/lib/cjs/Differencing/SchemaDifferenceVisitor.js.map +1 -1
- package/lib/cjs/Differencing/Utils.js.map +1 -1
- package/lib/cjs/Editing/Constants.d.ts +2 -1
- package/lib/cjs/Editing/Constants.d.ts.map +1 -1
- package/lib/cjs/Editing/Constants.js +4 -1
- package/lib/cjs/Editing/Constants.js.map +1 -1
- package/lib/cjs/Editing/CustomAttributes.d.ts +2 -1
- package/lib/cjs/Editing/CustomAttributes.d.ts.map +1 -1
- package/lib/cjs/Editing/CustomAttributes.js +3 -0
- package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
- package/lib/cjs/Editing/ECClasses.d.ts +6 -1
- package/lib/cjs/Editing/ECClasses.d.ts.map +1 -1
- package/lib/cjs/Editing/ECClasses.js +48 -49
- package/lib/cjs/Editing/ECClasses.js.map +1 -1
- package/lib/cjs/Editing/Editor.d.ts +2 -2
- package/lib/cjs/Editing/Editor.d.ts.map +1 -1
- package/lib/cjs/Editing/Editor.js +32 -21
- package/lib/cjs/Editing/Editor.js.map +1 -1
- package/lib/cjs/Editing/Entities.d.ts +2 -1
- package/lib/cjs/Editing/Entities.d.ts.map +1 -1
- package/lib/cjs/Editing/Entities.js +18 -14
- package/lib/cjs/Editing/Entities.js.map +1 -1
- package/lib/cjs/Editing/Enumerations.d.ts +2 -1
- package/lib/cjs/Editing/Enumerations.d.ts.map +1 -1
- package/lib/cjs/Editing/Enumerations.js +6 -3
- package/lib/cjs/Editing/Enumerations.js.map +1 -1
- package/lib/cjs/Editing/Exception.js +35 -6
- package/lib/cjs/Editing/Exception.js.map +1 -1
- package/lib/cjs/Editing/Formats.d.ts +2 -1
- package/lib/cjs/Editing/Formats.d.ts.map +1 -1
- package/lib/cjs/Editing/Formats.js +5 -1
- package/lib/cjs/Editing/Formats.js.map +1 -1
- package/lib/cjs/Editing/InvertedUnits.d.ts +2 -1
- package/lib/cjs/Editing/InvertedUnits.d.ts.map +1 -1
- package/lib/cjs/Editing/InvertedUnits.js +10 -6
- package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
- package/lib/cjs/Editing/KindOfQuantities.d.ts +2 -1
- package/lib/cjs/Editing/KindOfQuantities.d.ts.map +1 -1
- package/lib/cjs/Editing/KindOfQuantities.js +11 -7
- package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
- package/lib/cjs/Editing/Mixins.d.ts +2 -1
- package/lib/cjs/Editing/Mixins.d.ts.map +1 -1
- package/lib/cjs/Editing/Mixins.js +13 -9
- package/lib/cjs/Editing/Mixins.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableArrayProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableClass.d.ts +2 -1
- package/lib/cjs/Editing/Mutable/MutableClass.d.ts.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableFormat.d.ts +8 -1
- package/lib/cjs/Editing/Mutable/MutableFormat.d.ts.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableMixin.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableNavigationProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableSchemaItem.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableStructProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableUnit.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
- package/lib/cjs/Editing/Phenomena.d.ts +2 -1
- package/lib/cjs/Editing/Phenomena.d.ts.map +1 -1
- package/lib/cjs/Editing/Phenomena.js +3 -0
- package/lib/cjs/Editing/Phenomena.js.map +1 -1
- package/lib/cjs/Editing/Properties.d.ts +2 -2
- package/lib/cjs/Editing/Properties.d.ts.map +1 -1
- package/lib/cjs/Editing/Properties.js +6 -4
- package/lib/cjs/Editing/Properties.js.map +1 -1
- package/lib/cjs/Editing/PropertyCategories.d.ts +2 -1
- package/lib/cjs/Editing/PropertyCategories.d.ts.map +1 -1
- package/lib/cjs/Editing/PropertyCategories.js +5 -1
- package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
- package/lib/cjs/Editing/RelationshipClasses.d.ts +1 -0
- package/lib/cjs/Editing/RelationshipClasses.d.ts.map +1 -1
- package/lib/cjs/Editing/RelationshipClasses.js +17 -10
- package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
- package/lib/cjs/Editing/SchemaItems.d.ts +2 -2
- package/lib/cjs/Editing/SchemaItems.d.ts.map +1 -1
- package/lib/cjs/Editing/SchemaItems.js +8 -11
- package/lib/cjs/Editing/SchemaItems.js.map +1 -1
- package/lib/cjs/Editing/Structs.d.ts +2 -1
- package/lib/cjs/Editing/Structs.d.ts.map +1 -1
- package/lib/cjs/Editing/Structs.js +3 -0
- package/lib/cjs/Editing/Structs.js.map +1 -1
- package/lib/cjs/Editing/UnitSystems.d.ts +2 -1
- package/lib/cjs/Editing/UnitSystems.d.ts.map +1 -1
- package/lib/cjs/Editing/UnitSystems.js +3 -0
- package/lib/cjs/Editing/UnitSystems.js.map +1 -1
- package/lib/cjs/Editing/Units.d.ts +2 -1
- package/lib/cjs/Editing/Units.d.ts.map +1 -1
- package/lib/cjs/Editing/Units.js +5 -2
- package/lib/cjs/Editing/Units.js.map +1 -1
- package/lib/cjs/Merging/ClassMerger.js.map +1 -1
- package/lib/cjs/Merging/ConstantMerger.js +4 -4
- package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
- package/lib/cjs/Merging/CustomAttributeClassMerger.js.map +1 -1
- package/lib/cjs/Merging/CustomAttributeMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/CustomAttributeMerger.js +7 -6
- package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
- package/lib/cjs/Merging/Edits/NameMapping.d.ts +22 -0
- package/lib/cjs/Merging/Edits/NameMapping.d.ts.map +1 -0
- package/lib/cjs/Merging/Edits/NameMapping.js +54 -0
- package/lib/cjs/Merging/Edits/NameMapping.js.map +1 -0
- package/lib/cjs/Merging/Edits/RenameEditHandler.d.ts +1 -1
- package/lib/cjs/Merging/Edits/RenameEditHandler.d.ts.map +1 -1
- package/lib/cjs/Merging/Edits/RenameEditHandler.js +1 -260
- package/lib/cjs/Merging/Edits/RenameEditHandler.js.map +1 -1
- package/lib/cjs/Merging/Edits/SchemaEdits.d.ts +9 -6
- package/lib/cjs/Merging/Edits/SchemaEdits.d.ts.map +1 -1
- package/lib/cjs/Merging/Edits/SchemaEdits.js +19 -14
- package/lib/cjs/Merging/Edits/SchemaEdits.js.map +1 -1
- package/lib/cjs/Merging/Edits/SkipEditHandler.js.map +1 -1
- package/lib/cjs/Merging/EntityClassMerger.js +1 -2
- package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
- package/lib/cjs/Merging/EnumerationMerger.js +1 -1
- package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
- package/lib/cjs/Merging/EnumeratorMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/EnumeratorMerger.js +2 -2
- package/lib/cjs/Merging/EnumeratorMerger.js.map +1 -1
- package/lib/cjs/Merging/FormatMerger.d.ts +24 -0
- package/lib/cjs/Merging/FormatMerger.d.ts.map +1 -0
- package/lib/cjs/Merging/FormatMerger.js +143 -0
- package/lib/cjs/Merging/FormatMerger.js.map +1 -0
- package/lib/cjs/Merging/InvertedUnitMerger.d.ts +14 -0
- package/lib/cjs/Merging/InvertedUnitMerger.d.ts.map +1 -0
- package/lib/cjs/Merging/InvertedUnitMerger.js +45 -0
- package/lib/cjs/Merging/InvertedUnitMerger.js.map +1 -0
- package/lib/cjs/Merging/KindOfQuantityMerger.d.ts +1 -1
- package/lib/cjs/Merging/KindOfQuantityMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/KindOfQuantityMerger.js +4 -5
- package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
- package/lib/cjs/Merging/MixinMerger.js +1 -1
- package/lib/cjs/Merging/MixinMerger.js.map +1 -1
- package/lib/cjs/Merging/PhenomenonMerger.js +1 -1
- package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
- package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -1
- package/lib/cjs/Merging/PropertyMerger.js +28 -26
- package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
- package/lib/cjs/Merging/RelationshipClassMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/RelationshipClassMerger.js +4 -4
- package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaMerger.d.ts +5 -3
- package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/SchemaMerger.js +45 -5
- package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaMergingVisitor.d.ts +14 -8
- package/lib/cjs/Merging/SchemaMergingVisitor.d.ts.map +1 -1
- package/lib/cjs/Merging/SchemaMergingVisitor.js +42 -17
- package/lib/cjs/Merging/SchemaMergingVisitor.js.map +1 -1
- package/lib/cjs/Merging/SchemaMergingWalker.d.ts.map +1 -1
- package/lib/cjs/Merging/SchemaMergingWalker.js +2 -0
- package/lib/cjs/Merging/SchemaMergingWalker.js.map +1 -1
- package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
- package/lib/cjs/Merging/StructClassMerger.js.map +1 -1
- package/lib/cjs/Merging/UnitMerger.d.ts +14 -0
- package/lib/cjs/Merging/UnitMerger.d.ts.map +1 -0
- package/lib/cjs/Merging/UnitMerger.js +62 -0
- package/lib/cjs/Merging/UnitMerger.js.map +1 -0
- package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -1
- package/lib/cjs/Merging/Utils.d.ts +11 -0
- package/lib/cjs/Merging/Utils.d.ts.map +1 -1
- package/lib/cjs/Merging/Utils.js +23 -3
- package/lib/cjs/Merging/Utils.js.map +1 -1
- package/lib/cjs/Validation/Diagnostic.js +18 -16
- package/lib/cjs/Validation/Diagnostic.js.map +1 -1
- package/lib/cjs/Validation/DiagnosticReporter.js +4 -1
- package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
- package/lib/cjs/Validation/ECRules.js +1 -1
- package/lib/cjs/Validation/ECRules.js.map +1 -1
- package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
- package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
- package/lib/cjs/Validation/Rules.js.map +1 -1
- package/lib/cjs/Validation/SchemaChanges.js +39 -69
- package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareDiagnostics.d.ts +2 -2
- package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareResultDelegate.d.ts +1 -1
- package/lib/cjs/Validation/SchemaCompareResultDelegate.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaCompareResultDelegate.js +4 -1
- package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareVisitor.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaCompareVisitor.js +23 -23
- package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
- package/lib/cjs/Validation/SchemaComparer.d.ts +22 -1
- package/lib/cjs/Validation/SchemaComparer.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaComparer.js +30 -5
- package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
- package/lib/cjs/Validation/SchemaValidater.js +1 -4
- package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
- package/lib/cjs/Validation/SchemaValidationVisitor.js +3 -4
- package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.d.ts +1 -1
- package/lib/cjs/Validation/SchemaWalker.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js +6 -4
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-editing.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 +19 -17
- package/public/locales/en/ECSchemaEditing.json +26 -26
|
@@ -17,25 +17,23 @@ const StructClassMerger_1 = require("./StructClassMerger");
|
|
|
17
17
|
const UnitSystemMerger_1 = require("./UnitSystemMerger");
|
|
18
18
|
const PropertyMerger_1 = require("./PropertyMerger");
|
|
19
19
|
const Utils_1 = require("../Differencing/Utils");
|
|
20
|
-
const
|
|
20
|
+
const Utils_2 = require("./Utils");
|
|
21
|
+
const UnitMerger_1 = require("./UnitMerger");
|
|
22
|
+
const InvertedUnitMerger_1 = require("./InvertedUnitMerger");
|
|
23
|
+
const FormatMerger_1 = require("./FormatMerger");
|
|
21
24
|
/**
|
|
22
25
|
* Implementation of ISchemaDifferenceVisitor that can be used to traverse schema
|
|
23
26
|
* differences to call the appropriated merger methods.
|
|
24
27
|
* @internal
|
|
25
28
|
*/
|
|
26
29
|
class SchemaMergingVisitor {
|
|
30
|
+
_context;
|
|
27
31
|
/**
|
|
28
32
|
* Initializes a new instance of SchemaMergingVisitor class.
|
|
29
33
|
*/
|
|
30
34
|
constructor(context) {
|
|
31
35
|
this._context = context;
|
|
32
36
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Gets a SchemaItemKey for the given item name.
|
|
35
|
-
*/
|
|
36
|
-
toItemKey(itemName) {
|
|
37
|
-
return new ecschema_metadata_1.SchemaItemKey(itemName, this._context.targetSchemaKey);
|
|
38
|
-
}
|
|
39
37
|
/**
|
|
40
38
|
* Shared merging logic for all types of ClassItemDifference union.
|
|
41
39
|
*/
|
|
@@ -65,7 +63,7 @@ class SchemaMergingVisitor {
|
|
|
65
63
|
}
|
|
66
64
|
// Now both a modification change or the second add iteration is a modification of an existing class.
|
|
67
65
|
// So, regardless of the actual change type, modify is called.
|
|
68
|
-
return handler.modify(this._context, entry,
|
|
66
|
+
return handler.modify(this._context, entry, (0, Utils_2.toItemKey)(this._context, entry.itemName));
|
|
69
67
|
},
|
|
70
68
|
modify: handler.modify,
|
|
71
69
|
});
|
|
@@ -135,22 +133,46 @@ class SchemaMergingVisitor {
|
|
|
135
133
|
async visitEnumeratorDifference(entry) {
|
|
136
134
|
switch (entry.changeType) {
|
|
137
135
|
case "add": return (0, EnumeratorMerger_1.addEnumerator)(this._context, entry);
|
|
138
|
-
case "modify": return (0, EnumeratorMerger_1.modifyEnumerator)(this._context, entry,
|
|
136
|
+
case "modify": return (0, EnumeratorMerger_1.modifyEnumerator)(this._context, entry, (0, Utils_2.toItemKey)(this._context, entry.itemName));
|
|
139
137
|
}
|
|
140
138
|
}
|
|
141
139
|
/**
|
|
142
140
|
* Visitor implementation for handling FormatDifference.
|
|
143
141
|
* @internal
|
|
144
142
|
*/
|
|
145
|
-
async visitFormatDifference(
|
|
146
|
-
|
|
143
|
+
async visitFormatDifference(entry) {
|
|
144
|
+
return this.visitSchemaItemDifference(entry, {
|
|
145
|
+
add: FormatMerger_1.addFormat,
|
|
146
|
+
modify: FormatMerger_1.modifyFormat,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Visitor implementation for handling FormatUnitDifference.
|
|
151
|
+
* @internal
|
|
152
|
+
*/
|
|
153
|
+
async visitFormatUnitDifference(entry) {
|
|
154
|
+
switch (entry.changeType) {
|
|
155
|
+
case "modify": return (0, FormatMerger_1.modifyFormatUnit)(this._context, entry, (0, Utils_2.toItemKey)(this._context, entry.itemName));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Visitor implementation for handling FormatUnitLabelDifference.
|
|
160
|
+
* @internal
|
|
161
|
+
*/
|
|
162
|
+
async visitFormatUnitLabelDifference(entry) {
|
|
163
|
+
switch (entry.changeType) {
|
|
164
|
+
case "modify": return (0, FormatMerger_1.modifyFormatUnitLabel)(this._context, entry, (0, Utils_2.toItemKey)(this._context, entry.itemName));
|
|
165
|
+
}
|
|
147
166
|
}
|
|
148
167
|
/**
|
|
149
168
|
* Visitor implementation for handling InvertedUnitDifference.
|
|
150
169
|
* @internal
|
|
151
170
|
*/
|
|
152
|
-
async visitInvertedUnitDifference(
|
|
153
|
-
|
|
171
|
+
async visitInvertedUnitDifference(entry) {
|
|
172
|
+
return this.visitSchemaItemDifference(entry, {
|
|
173
|
+
add: InvertedUnitMerger_1.addInvertedUnit,
|
|
174
|
+
modify: InvertedUnitMerger_1.modifyInvertedUnit,
|
|
175
|
+
});
|
|
154
176
|
}
|
|
155
177
|
/**
|
|
156
178
|
* Visitor implementation for handling KindOfQuantityDifference.
|
|
@@ -248,7 +270,7 @@ class SchemaMergingVisitor {
|
|
|
248
270
|
if ("schemaItemType" in entry.difference && entry.difference.schemaItemType !== entry.schemaType) {
|
|
249
271
|
throw new Error(`Changing the type of item '${entry.itemName}' not supported.`);
|
|
250
272
|
}
|
|
251
|
-
return handler.modify(this._context, entry,
|
|
273
|
+
return handler.modify(this._context, entry, (0, Utils_2.toItemKey)(this._context, entry.itemName));
|
|
252
274
|
}
|
|
253
275
|
;
|
|
254
276
|
}
|
|
@@ -277,8 +299,11 @@ class SchemaMergingVisitor {
|
|
|
277
299
|
* Visitor implementation for handling UnitDifference.
|
|
278
300
|
* @internal
|
|
279
301
|
*/
|
|
280
|
-
async visitUnitDifference(
|
|
281
|
-
|
|
302
|
+
async visitUnitDifference(entry) {
|
|
303
|
+
return this.visitSchemaItemDifference(entry, {
|
|
304
|
+
add: UnitMerger_1.addUnit,
|
|
305
|
+
modify: UnitMerger_1.modifyUnit,
|
|
306
|
+
});
|
|
282
307
|
}
|
|
283
308
|
/**
|
|
284
309
|
* Visitor implementation for handling UnitSystemDifference.
|
|
@@ -296,7 +321,7 @@ class SchemaMergingVisitor {
|
|
|
296
321
|
*/
|
|
297
322
|
async visitKindOfQuantityPresentationFormatDifference(entry) {
|
|
298
323
|
switch (entry.changeType) {
|
|
299
|
-
case "add": return (0, KindOfQuantityMerger_1.addPresentationFormat)(this._context, entry);
|
|
324
|
+
case "add": return (0, KindOfQuantityMerger_1.addPresentationFormat)(this._context, entry, (0, Utils_2.toItemKey)(this._context, entry.itemName));
|
|
300
325
|
}
|
|
301
326
|
}
|
|
302
327
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaMergingVisitor.js","sourceRoot":"","sources":["../../../src/Merging/SchemaMergingVisitor.ts"],"names":[],"mappings":";;;AAKA,qDAA+D;AAC/D,mEAA6D;AAC7D,6EAAmG;AACnG,2DAAwF;AACxF,2DAAwE;AACxE,yDAAqE;AACrE,iEAAwG;AACxG,+CAAgE;AAChE,yDAAqE;AACrE,qEAAuF;AACvF,uEAAyJ;AACzJ,mEAAsF;AACtF,2DAAwE;AACx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EAAE,KAAK,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,0BAA0B,CAAC,KAA4B,EAAE,KAAa,EAAE,KAA4B;QAC/G,OAAO,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;YACpD,GAAG,EAAE,kCAAc;YACnB,MAAM,EAAE,qCAAiB;SAC1B,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,mBAAmB,CAAC,MAAsB;QACrD,8BAA8B;IAChC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,yBAAyB,CAAC,KAA2B;QAChE,OAAO,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE;YAC3C,GAAG,EAAE,gCAAa;YAClB,MAAM,EAAE,mCAAgB;SACzB,CAAC,CAAC;IACL,CAAC;IAED;;;MAGE;IACK,KAAK,CAAC,+CAA+C,CAAC,KAAiD;QAC5G,QAAO,KAAK,CAAC,UAAU,EAAE,CAAC;YACxB,KAAK,KAAK,CAAC,CAAC,OAAO,IAAA,4CAAqB,EAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;CACF;AAnTD,oDAmTC;AAED;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,KAA4B,EAAE,SAAkD,EAAE,SAAiB;IACtH,KAAK,IAAI,CAAC,GAAG,SAAS,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9C,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACrB,OAAO,CAAC,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { AnyClassItemDifference, AnySchemaDifference, AnySchemaItemDifference, ClassPropertyDifference, ConstantDifference, CustomAttributeClassDifference, CustomAttributeDifference, EntityClassDifference, EntityClassMixinDifference, EnumerationDifference, EnumeratorDifference, FormatDifference, InvertedUnitDifference, KindOfQuantityDifference, KindOfQuantityPresentationFormatDifference, MixinClassDifference, PhenomenonDifference, PropertyCategoryDifference, RelationshipClassDifference, RelationshipConstraintClassDifference, RelationshipConstraintDifference, SchemaDifference, SchemaReferenceDifference, StructClassDifference, UnitDifference, UnitSystemDifference } from \"../Differencing/SchemaDifference\";\r\nimport { addConstant, modifyConstant } from \"./ConstantMerger\";\r\nimport { addCustomAttribute } from \"./CustomAttributeMerger\";\r\nimport { addCustomAttributeClass, modifyCustomAttributeClass } from \"./CustomAttributeClassMerger\";\r\nimport { addClassMixins, addEntityClass, modifyEntityClass } from \"./EntityClassMerger\";\r\nimport { addEnumeration, modifyEnumeration } from \"./EnumerationMerger\";\r\nimport { addEnumerator, modifyEnumerator } from \"./EnumeratorMerger\";\r\nimport { addKindOfQuantity, addPresentationFormat, modifyKindOfQuantity } from \"./KindOfQuantityMerger\";\r\nimport { addMixinClass, modifyMixinClass } from \"./MixinMerger\";\r\nimport { addPhenomenon, modifyPhenomenon } from \"./PhenomenonMerger\";\r\nimport { addPropertyCategory, modifyPropertyCategory } from \"./PropertyCategoryMerger\";\r\nimport { addRelationshipClass, mergeRelationshipClassConstraint, mergeRelationshipConstraint, modifyRelationshipClass } from \"./RelationshipClassMerger\";\r\nimport { addSchemaReferences, modifySchemaReferences } from \"./SchemaReferenceMerger\";\r\nimport { addStructClass, modifyStructClass } from \"./StructClassMerger\";\r\nimport { addUnitSystem, modifyUnitSystem } from \"./UnitSystemMerger\";\r\nimport { mergePropertyDifference } from \"./PropertyMerger\";\r\nimport { isClassDifference } from \"../Differencing/Utils\";\r\nimport { SchemaDifferenceVisitor } from \"../Differencing/SchemaDifferenceVisitor\";\r\nimport { SchemaItemKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaMergeContext } from \"./SchemaMerger\";\r\n\r\n/** Definition of schema items change type handler array. */\r\ninterface ItemChangeTypeHandler<T extends AnySchemaDifference> {\r\n add: (context: SchemaMergeContext, entry: T) => Promise<void>;\r\n modify: (context: SchemaMergeContext, entry: T, key: SchemaItemKey) => Promise<void>;\r\n}\r\n\r\n/**\r\n * Implementation of ISchemaDifferenceVisitor that can be used to traverse schema\r\n * differences to call the appropriated merger methods.\r\n * @internal\r\n */\r\nexport class SchemaMergingVisitor implements SchemaDifferenceVisitor {\r\n\r\n private readonly _context: SchemaMergeContext;\r\n\r\n /**\r\n * Initializes a new instance of SchemaMergingVisitor class.\r\n */\r\n constructor(context: SchemaMergeContext) {\r\n this._context = context;\r\n }\r\n\r\n /**\r\n * Gets a SchemaItemKey for the given item name.\r\n */\r\n private toItemKey(itemName: string): SchemaItemKey {\r\n return new SchemaItemKey(itemName, this._context.targetSchemaKey);\r\n }\r\n\r\n /**\r\n * Shared merging logic for all types of ClassItemDifference union.\r\n */\r\n private async visitClassDifference<T extends AnyClassItemDifference>(entry: T, index: number, array: AnySchemaDifference[], handler: ItemChangeTypeHandler<T>) {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: async (context) => {\r\n // To add classes a slightly different approach is done. In fact the class entries gets processed\r\n // two times. The first time, a stub with the bare minimum is added to the schema. The second time,\r\n // the class gets completed with all properties, mixins, etc...\r\n if(entry.changeType === \"add\" && !await context.targetSchema.getItem(entry.itemName)) {\r\n await handler.add(this._context, {\r\n ...entry,\r\n difference: {\r\n ...entry.difference,\r\n // Remove everything we want to validate before setting, this is done in the second iteration.\r\n baseClass: undefined,\r\n mixins: undefined,\r\n properties: undefined,\r\n customAttributes: undefined,\r\n },\r\n });\r\n\r\n // Searches for the last class difference and adds the entry after it. That way,\r\n // the class is completed before class related entries get processed.\r\n const insertIndex = findIndexOf(array, (e) => !isClassDifference(e), index) || array.length;\r\n array.splice(insertIndex, 0, entry);\r\n\r\n return;\r\n }\r\n\r\n // Now both a modification change or the second add iteration is a modification of an existing class.\r\n // So, regardless of the actual change type, modify is called.\r\n return handler.modify(this._context, entry, this.toItemKey(entry.itemName));\r\n },\r\n modify: handler.modify,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling ConstantDifference.\r\n * @internal\r\n */\r\n public async visitConstantDifference(entry: ConstantDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addConstant,\r\n modify: modifyConstant,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling CustomAttributeClassDifference.\r\n * @internal\r\n */\r\n public async visitCustomAttributeClassDifference(entry: CustomAttributeClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\r\n return this.visitClassDifference(entry, index, array, {\r\n add: addCustomAttributeClass,\r\n modify: modifyCustomAttributeClass,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling CustomAttributeDifference.\r\n * @internal\r\n */\r\n public async visitCustomAttributeInstanceDifference(entry: CustomAttributeDifference): Promise<void> {\r\n switch(entry.changeType) {\r\n case \"add\": return addCustomAttribute(this._context, entry);\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling EntityClassDifference.\r\n * @internal\r\n */\r\n public async visitEntityClassDifference(entry: EntityClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\r\n return this.visitClassDifference(entry, index, array, {\r\n add: addEntityClass,\r\n modify: modifyEntityClass,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling EntityClassMixinDifference.\r\n * @internal\r\n */\r\n public async visitEntityClassMixinDifference(entry: EntityClassMixinDifference): Promise<void> {\r\n switch(entry.changeType) {\r\n case \"add\": return addClassMixins(this._context, entry);\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling EnumerationDifference.\r\n * @internal\r\n */\r\n public async visitEnumerationDifference(entry: EnumerationDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addEnumeration,\r\n modify: modifyEnumeration,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling EnumeratorDifference.\r\n * @internal\r\n */\r\n public async visitEnumeratorDifference(entry: EnumeratorDifference): Promise<void> {\r\n switch(entry.changeType) {\r\n case \"add\": return addEnumerator(this._context, entry);\r\n case \"modify\": return modifyEnumerator(this._context, entry, this.toItemKey(entry.itemName));\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling FormatDifference.\r\n * @internal\r\n */\r\n public async visitFormatDifference(_entry: FormatDifference): Promise<void> {\r\n // TODO: Add merger handler...\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling InvertedUnitDifference.\r\n * @internal\r\n */\r\n public async visitInvertedUnitDifference(_entry: InvertedUnitDifference): Promise<void> {\r\n // TODO: Add merger handler...\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling KindOfQuantityDifference.\r\n * @internal\r\n */\r\n public async visitKindOfQuantityDifference(entry: KindOfQuantityDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addKindOfQuantity,\r\n modify: modifyKindOfQuantity,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling MixinClassDifference.\r\n * @internal\r\n */\r\n public async visitMixinDifference(entry: MixinClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\r\n return this.visitClassDifference(entry, index, array, {\r\n add: addMixinClass,\r\n modify: modifyMixinClass,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling PhenomenonDifference.\r\n * @internal\r\n */\r\n public async visitPhenomenonDifference(entry: PhenomenonDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addPhenomenon,\r\n modify: modifyPhenomenon,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling PropertyCategoryDifference.\r\n * @internal\r\n */\r\n public async visitPropertyCategoryDifference(entry: PropertyCategoryDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addPropertyCategory,\r\n modify: modifyPropertyCategory,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling ClassPropertyDifference.\r\n * @internal\r\n */\r\n public async visitPropertyDifference(entry: ClassPropertyDifference): Promise<void> {\r\n await mergePropertyDifference(this._context, entry);\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling RelationshipClassDifference.\r\n * @internal\r\n */\r\n public async visitRelationshipClassDifference(entry: RelationshipClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\r\n return this.visitClassDifference(entry, index, array, {\r\n add: addRelationshipClass,\r\n modify: modifyRelationshipClass,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling RelationshipConstraintClassDifference.\r\n * @internal\r\n */\r\n public async visitRelationshipConstraintClassDifference(entry: RelationshipConstraintClassDifference): Promise<void> {\r\n await mergeRelationshipClassConstraint(this._context, entry);\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling RelationshipConstraintDifference.\r\n * @internal\r\n */\r\n public async visitRelationshipConstraintDifference(entry: RelationshipConstraintDifference): Promise<void> {\r\n await mergeRelationshipConstraint(this._context, entry);\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling SchemaDifference.\r\n * @internal\r\n */\r\n public async visitSchemaDifference({ difference }: SchemaDifference): Promise<void> {\r\n if (difference.label !== undefined) {\r\n await this._context.editor.setDisplayLabel(this._context.targetSchemaKey, difference.label);\r\n }\r\n if (difference.description !== undefined) {\r\n await this._context.editor.setDescription(this._context.targetSchemaKey, difference.description);\r\n }\r\n }\r\n\r\n /**\r\n * Shared merging logic for all types of AnySchemaItemDifference union.\r\n */\r\n private async visitSchemaItemDifference<T extends AnySchemaItemDifference>(entry: T, handler: ItemChangeTypeHandler<T>) {\r\n switch(entry.changeType) {\r\n case \"add\": {\r\n return handler.add(this._context, entry);\r\n }\r\n case \"modify\": {\r\n if(\"schemaItemType\" in entry.difference && entry.difference.schemaItemType !== entry.schemaType) {\r\n throw new Error(`Changing the type of item '${entry.itemName}' not supported.`);\r\n }\r\n\r\n return handler.modify(this._context, entry, this.toItemKey(entry.itemName));\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling SchemaReferenceDifference.\r\n * @internal\r\n */\r\n public async visitSchemaReferenceDifference(entry: SchemaReferenceDifference): Promise<void> {\r\n switch(entry.changeType) {\r\n case \"add\": return addSchemaReferences(this._context, entry);\r\n case \"modify\": return modifySchemaReferences(this._context, entry);\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling StructClassDifference.\r\n * @internal\r\n */\r\n public async visitStructClassDifference(entry: StructClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\r\n return this.visitClassDifference(entry, index, array, {\r\n add: addStructClass,\r\n modify: modifyStructClass,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling UnitDifference.\r\n * @internal\r\n */\r\n public async visitUnitDifference(_entry: UnitDifference): Promise<void> {\r\n // TODO: Add merger handler...\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling UnitSystemDifference.\r\n * @internal\r\n */\r\n public async visitUnitSystemDifference(entry: UnitSystemDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addUnitSystem,\r\n modify: modifyUnitSystem,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling KindOfQuantityPresentationFormatDifference.\r\n * @internal\r\n */\r\n public async visitKindOfQuantityPresentationFormatDifference(entry: KindOfQuantityPresentationFormatDifference): Promise<void> {\r\n switch(entry.changeType) {\r\n case \"add\": return addPresentationFormat(this._context, entry);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Helper method to get the index of the first element in the array that satisfies the provided testing function.\r\n * @param array Array to search.\r\n * @param predicate Function to execute on each value in the array.\r\n * @param fromIndex The index to start the search at.\r\n * @returns An index in the array if an element passes the test; otherwise, false.\r\n */\r\nfunction findIndexOf(array: AnySchemaDifference[], predicate: (entry: AnySchemaDifference) => boolean, fromIndex: number) {\r\n for (let i = fromIndex; i < array.length; i++) {\r\n if (predicate(array[i]))\r\n return i;\r\n }\r\n return false;\r\n}\r\n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I,CAAC,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;YACpD,GAAG,EAAE,kCAAc;YACnB,MAAM,EAAE,qCAAiB;SAC1B,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,mBAAmB,CAAC,KAAqB;QACpD,OAAO,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE;YAC3C,GAAG,EAAE,oBAAO;YACZ,MAAM,EAAE,uBAAU;SACnB,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,yBAAyB,CAAC,KAA2B;QAChE,OAAO,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE;YAC3C,GAAG,EAAE,gCAAa;YAClB,MAAM,EAAE,mCAAgB;SACzB,CAAC,CAAC;IACL,CAAC;IAED;;;MAGE;IACK,KAAK,CAAC,+CAA+C,CAAC,KAAiD;QAC5G,QAAO,KAAK,CAAC,UAAU,EAAE,CAAC;YACxB,KAAK,KAAK,CAAC,CAAC,OAAO,IAAA,4CAAqB,EAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAA,iBAAS,EAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC3G,CAAC;IACH,CAAC;CACF;AAzUD,oDAyUC;AAED;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,KAA4B,EAAE,SAAkD,EAAE,SAAiB;IACtH,KAAK,IAAI,CAAC,GAAG,SAAS,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9C,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACrB,OAAO,CAAC,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACf,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 { AnyClassItemDifference, AnySchemaDifference, AnySchemaItemDifference, ClassPropertyDifference, \n ConstantDifference, CustomAttributeClassDifference, CustomAttributeDifference, EntityClassDifference, \n EntityClassMixinDifference, EnumerationDifference, EnumeratorDifference, FormatDifference, FormatUnitDifference, \n FormatUnitLabelDifference, InvertedUnitDifference, KindOfQuantityDifference, KindOfQuantityPresentationFormatDifference, \n MixinClassDifference, PhenomenonDifference, PropertyCategoryDifference, RelationshipClassDifference, \n RelationshipConstraintClassDifference, RelationshipConstraintDifference, SchemaDifference, SchemaReferenceDifference, \n StructClassDifference, UnitDifference, UnitSystemDifference } from \"../Differencing/SchemaDifference\";\nimport { addConstant, modifyConstant } from \"./ConstantMerger\";\nimport { addCustomAttribute } from \"./CustomAttributeMerger\";\nimport { addCustomAttributeClass, modifyCustomAttributeClass } from \"./CustomAttributeClassMerger\";\nimport { addClassMixins, addEntityClass, modifyEntityClass } from \"./EntityClassMerger\";\nimport { addEnumeration, modifyEnumeration } from \"./EnumerationMerger\";\nimport { addEnumerator, modifyEnumerator } from \"./EnumeratorMerger\";\nimport { addKindOfQuantity, addPresentationFormat, modifyKindOfQuantity } from \"./KindOfQuantityMerger\";\nimport { addMixinClass, modifyMixinClass } from \"./MixinMerger\";\nimport { addPhenomenon, modifyPhenomenon } from \"./PhenomenonMerger\";\nimport { addPropertyCategory, modifyPropertyCategory } from \"./PropertyCategoryMerger\";\nimport { addRelationshipClass, mergeRelationshipClassConstraint, mergeRelationshipConstraint, modifyRelationshipClass } from \"./RelationshipClassMerger\";\nimport { addSchemaReferences, modifySchemaReferences } from \"./SchemaReferenceMerger\";\nimport { addStructClass, modifyStructClass } from \"./StructClassMerger\";\nimport { addUnitSystem, modifyUnitSystem } from \"./UnitSystemMerger\";\nimport { mergePropertyDifference } from \"./PropertyMerger\";\nimport { isClassDifference } from \"../Differencing/Utils\";\nimport { SchemaDifferenceVisitor } from \"../Differencing/SchemaDifferenceVisitor\";\nimport { SchemaItemKey } from \"@itwin/ecschema-metadata\";\nimport { SchemaMergeContext } from \"./SchemaMerger\";\nimport { toItemKey } from \"./Utils\";\nimport { addUnit, modifyUnit } from \"./UnitMerger\";\nimport { addInvertedUnit, modifyInvertedUnit } from \"./InvertedUnitMerger\";\nimport { addFormat, modifyFormat, modifyFormatUnit, modifyFormatUnitLabel } from \"./FormatMerger\";\n\n/** Definition of schema items change type handler array. */\ninterface ItemChangeTypeHandler<T extends AnySchemaDifference> {\n add: (context: SchemaMergeContext, entry: T) => Promise<void>;\n modify: (context: SchemaMergeContext, entry: T, key: SchemaItemKey) => Promise<void>;\n}\n\n/**\n * Implementation of ISchemaDifferenceVisitor that can be used to traverse schema\n * differences to call the appropriated merger methods.\n * @internal\n */\nexport class SchemaMergingVisitor implements SchemaDifferenceVisitor {\n\n private readonly _context: SchemaMergeContext;\n\n /**\n * Initializes a new instance of SchemaMergingVisitor class.\n */\n constructor(context: SchemaMergeContext) {\n this._context = context;\n }\n\n /**\n * Shared merging logic for all types of ClassItemDifference union.\n */\n private async visitClassDifference<T extends AnyClassItemDifference>(entry: T, index: number, array: AnySchemaDifference[], handler: ItemChangeTypeHandler<T>) {\n return this.visitSchemaItemDifference(entry, {\n add: async (context) => {\n // To add classes a slightly different approach is done. In fact the class entries gets processed\n // two times. The first time, a stub with the bare minimum is added to the schema. The second time,\n // the class gets completed with all properties, mixins, etc...\n if(entry.changeType === \"add\" && !await context.targetSchema.getItem(entry.itemName)) {\n await handler.add(this._context, {\n ...entry,\n difference: {\n ...entry.difference,\n // Remove everything we want to validate before setting, this is done in the second iteration.\n baseClass: undefined,\n mixins: undefined,\n properties: undefined,\n customAttributes: undefined,\n },\n });\n\n // Searches for the last class difference and adds the entry after it. That way,\n // the class is completed before class related entries get processed.\n const insertIndex = findIndexOf(array, (e) => !isClassDifference(e), index) || array.length;\n array.splice(insertIndex, 0, entry);\n\n return;\n }\n\n // Now both a modification change or the second add iteration is a modification of an existing class.\n // So, regardless of the actual change type, modify is called.\n return handler.modify(this._context, entry, toItemKey(this._context, entry.itemName));\n },\n modify: handler.modify,\n });\n }\n\n /**\n * Visitor implementation for handling ConstantDifference.\n * @internal\n */\n public async visitConstantDifference(entry: ConstantDifference): Promise<void> {\n return this.visitSchemaItemDifference(entry, {\n add: addConstant,\n modify: modifyConstant,\n });\n }\n\n /**\n * Visitor implementation for handling CustomAttributeClassDifference.\n * @internal\n */\n public async visitCustomAttributeClassDifference(entry: CustomAttributeClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\n return this.visitClassDifference(entry, index, array, {\n add: addCustomAttributeClass,\n modify: modifyCustomAttributeClass,\n });\n }\n\n /**\n * Visitor implementation for handling CustomAttributeDifference.\n * @internal\n */\n public async visitCustomAttributeInstanceDifference(entry: CustomAttributeDifference): Promise<void> {\n switch(entry.changeType) {\n case \"add\": return addCustomAttribute(this._context, entry);\n }\n }\n\n /**\n * Visitor implementation for handling EntityClassDifference.\n * @internal\n */\n public async visitEntityClassDifference(entry: EntityClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\n return this.visitClassDifference(entry, index, array, {\n add: addEntityClass,\n modify: modifyEntityClass,\n });\n }\n\n /**\n * Visitor implementation for handling EntityClassMixinDifference.\n * @internal\n */\n public async visitEntityClassMixinDifference(entry: EntityClassMixinDifference): Promise<void> {\n switch(entry.changeType) {\n case \"add\": return addClassMixins(this._context, entry);\n }\n }\n\n /**\n * Visitor implementation for handling EnumerationDifference.\n * @internal\n */\n public async visitEnumerationDifference(entry: EnumerationDifference): Promise<void> {\n return this.visitSchemaItemDifference(entry, {\n add: addEnumeration,\n modify: modifyEnumeration,\n });\n }\n\n /**\n * Visitor implementation for handling EnumeratorDifference.\n * @internal\n */\n public async visitEnumeratorDifference(entry: EnumeratorDifference): Promise<void> {\n switch(entry.changeType) {\n case \"add\": return addEnumerator(this._context, entry);\n case \"modify\": return modifyEnumerator(this._context, entry, toItemKey(this._context, entry.itemName));\n }\n }\n\n /**\n * Visitor implementation for handling FormatDifference.\n * @internal\n */\n public async visitFormatDifference(entry: FormatDifference): Promise<void> {\n return this.visitSchemaItemDifference(entry, {\n add: addFormat,\n modify: modifyFormat,\n });\n }\n\n /**\n * Visitor implementation for handling FormatUnitDifference.\n * @internal\n */\n public async visitFormatUnitDifference(entry: FormatUnitDifference): Promise<void> {\n switch(entry.changeType) {\n case \"modify\": return modifyFormatUnit(this._context, entry, toItemKey(this._context, entry.itemName));\n }\n }\n\n /**\n * Visitor implementation for handling FormatUnitLabelDifference.\n * @internal\n */\n public async visitFormatUnitLabelDifference(entry: FormatUnitLabelDifference): Promise<void> {\n switch(entry.changeType) {\n case \"modify\": return modifyFormatUnitLabel(this._context, entry, toItemKey(this._context, entry.itemName));\n }\n }\n\n /**\n * Visitor implementation for handling InvertedUnitDifference.\n * @internal\n */\n public async visitInvertedUnitDifference(entry: InvertedUnitDifference): Promise<void> {\n return this.visitSchemaItemDifference(entry, {\n add: addInvertedUnit,\n modify: modifyInvertedUnit,\n });\n }\n\n /**\n * Visitor implementation for handling KindOfQuantityDifference.\n * @internal\n */\n public async visitKindOfQuantityDifference(entry: KindOfQuantityDifference): Promise<void> {\n return this.visitSchemaItemDifference(entry, {\n add: addKindOfQuantity,\n modify: modifyKindOfQuantity,\n });\n }\n\n /**\n * Visitor implementation for handling MixinClassDifference.\n * @internal\n */\n public async visitMixinDifference(entry: MixinClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\n return this.visitClassDifference(entry, index, array, {\n add: addMixinClass,\n modify: modifyMixinClass,\n });\n }\n\n /**\n * Visitor implementation for handling PhenomenonDifference.\n * @internal\n */\n public async visitPhenomenonDifference(entry: PhenomenonDifference): Promise<void> {\n return this.visitSchemaItemDifference(entry, {\n add: addPhenomenon,\n modify: modifyPhenomenon,\n });\n }\n\n /**\n * Visitor implementation for handling PropertyCategoryDifference.\n * @internal\n */\n public async visitPropertyCategoryDifference(entry: PropertyCategoryDifference): Promise<void> {\n return this.visitSchemaItemDifference(entry, {\n add: addPropertyCategory,\n modify: modifyPropertyCategory,\n });\n }\n\n /**\n * Visitor implementation for handling ClassPropertyDifference.\n * @internal\n */\n public async visitPropertyDifference(entry: ClassPropertyDifference): Promise<void> {\n await mergePropertyDifference(this._context, entry);\n }\n\n /**\n * Visitor implementation for handling RelationshipClassDifference.\n * @internal\n */\n public async visitRelationshipClassDifference(entry: RelationshipClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\n return this.visitClassDifference(entry, index, array, {\n add: addRelationshipClass,\n modify: modifyRelationshipClass,\n });\n }\n\n /**\n * Visitor implementation for handling RelationshipConstraintClassDifference.\n * @internal\n */\n public async visitRelationshipConstraintClassDifference(entry: RelationshipConstraintClassDifference): Promise<void> {\n await mergeRelationshipClassConstraint(this._context, entry);\n }\n\n /**\n * Visitor implementation for handling RelationshipConstraintDifference.\n * @internal\n */\n public async visitRelationshipConstraintDifference(entry: RelationshipConstraintDifference): Promise<void> {\n await mergeRelationshipConstraint(this._context, entry);\n }\n\n /**\n * Visitor implementation for handling SchemaDifference.\n * @internal\n */\n public async visitSchemaDifference({ difference }: SchemaDifference): Promise<void> {\n if (difference.label !== undefined) {\n await this._context.editor.setDisplayLabel(this._context.targetSchemaKey, difference.label);\n }\n if (difference.description !== undefined) {\n await this._context.editor.setDescription(this._context.targetSchemaKey, difference.description);\n }\n }\n\n /**\n * Shared merging logic for all types of AnySchemaItemDifference union.\n */\n private async visitSchemaItemDifference<T extends AnySchemaItemDifference>(entry: T, handler: ItemChangeTypeHandler<T>) {\n switch(entry.changeType) {\n case \"add\": {\n return handler.add(this._context, entry);\n }\n case \"modify\": {\n if(\"schemaItemType\" in entry.difference && entry.difference.schemaItemType !== entry.schemaType) {\n throw new Error(`Changing the type of item '${entry.itemName}' not supported.`);\n }\n\n return handler.modify(this._context, entry, toItemKey(this._context, entry.itemName));\n };\n }\n }\n\n /**\n * Visitor implementation for handling SchemaReferenceDifference.\n * @internal\n */\n public async visitSchemaReferenceDifference(entry: SchemaReferenceDifference): Promise<void> {\n switch(entry.changeType) {\n case \"add\": return addSchemaReferences(this._context, entry);\n case \"modify\": return modifySchemaReferences(this._context, entry);\n }\n }\n\n /**\n * Visitor implementation for handling StructClassDifference.\n * @internal\n */\n public async visitStructClassDifference(entry: StructClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\n return this.visitClassDifference(entry, index, array, {\n add: addStructClass,\n modify: modifyStructClass,\n });\n }\n\n /**\n * Visitor implementation for handling UnitDifference.\n * @internal\n */\n public async visitUnitDifference(entry: UnitDifference): Promise<void> {\n return this.visitSchemaItemDifference(entry, {\n add: addUnit,\n modify: modifyUnit,\n });\n }\n\n /**\n * Visitor implementation for handling UnitSystemDifference.\n * @internal\n */\n public async visitUnitSystemDifference(entry: UnitSystemDifference): Promise<void> {\n return this.visitSchemaItemDifference(entry, {\n add: addUnitSystem,\n modify: modifyUnitSystem,\n });\n }\n\n /**\n * Visitor implementation for handling KindOfQuantityPresentationFormatDifference.\n * @internal\n */\n public async visitKindOfQuantityPresentationFormatDifference(entry: KindOfQuantityPresentationFormatDifference): Promise<void> {\n switch(entry.changeType) {\n case \"add\": return addPresentationFormat(this._context, entry, toItemKey(this._context, entry.itemName));\n }\n }\n}\n\n/**\n * Helper method to get the index of the first element in the array that satisfies the provided testing function.\n * @param array Array to search.\n * @param predicate Function to execute on each value in the array.\n * @param fromIndex The index to start the search at.\n * @returns An index in the array if an element passes the test; otherwise, false.\n */\nfunction findIndexOf(array: AnySchemaDifference[], predicate: (entry: AnySchemaDifference) => boolean, fromIndex: number) {\n for (let i = fromIndex; i < array.length; i++) {\n if (predicate(array[i]))\n return i;\n }\n return false;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaMergingWalker.d.ts","sourceRoot":"","sources":["../../../src/Merging/SchemaMergingWalker.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAgC,MAAM,kCAAkC,CAAC;AAErH;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,sBAAsB;IAE7D;;;;;;;OAOG;IACmB,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,mBAAmB,CAAC,EAAE,UAAU,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"SchemaMergingWalker.d.ts","sourceRoot":"","sources":["../../../src/Merging/SchemaMergingWalker.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAgC,MAAM,kCAAkC,CAAC;AAErH;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,sBAAsB;IAE7D;;;;;;;OAOG;IACmB,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,mBAAmB,CAAC,EAAE,UAAU,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CA2CpH"}
|
|
@@ -41,6 +41,8 @@ class SchemaMergingWalker extends SchemaDifferenceVisitor_1.SchemaDifferenceWalk
|
|
|
41
41
|
...differences.filter(filterByType(ecschema_metadata_1.SchemaItemType.Unit)),
|
|
42
42
|
...differences.filter(filterByType(ecschema_metadata_1.SchemaItemType.InvertedUnit)),
|
|
43
43
|
...differences.filter(filterByType(ecschema_metadata_1.SchemaItemType.Format)),
|
|
44
|
+
...differences.filter(filterByType(SchemaDifference_1.SchemaOtherTypes.FormatUnit)),
|
|
45
|
+
...differences.filter(filterByType(SchemaDifference_1.SchemaOtherTypes.FormatUnitLabel)),
|
|
44
46
|
...differences.filter(filterByType(ecschema_metadata_1.SchemaItemType.KindOfQuantity)),
|
|
45
47
|
...differences.filter(filterByType(ecschema_metadata_1.SchemaItemType.Constant)),
|
|
46
48
|
...differences.filter(filterByType(SchemaDifference_1.SchemaOtherTypes.KindOfQuantityPresentationFormat)),
|
|
@@ -1 +1 @@
|
|
|
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,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,mCAAgB,CAAC,2BAA2B,CAAC,CAAC;YACjF,GAAG,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,mCAAgB,CAAC,QAAQ,CAAC,CAAC;YAE9D,kCAAkC;YAClC,GAAG,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,mCAAgB,CAAC,uBAAuB,CAAC,CAAC;SAC9E,CAAC,CAAC;IACL,CAAC;CACF;AArDD,kDAqDC","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 { SchemaItemType } from \"@itwin/ecschema-metadata\";\nimport { SchemaDifferenceWalker } from \"../Differencing/SchemaDifferenceVisitor\";\nimport { AnySchemaDifference, DifferenceType, SchemaOtherTypes, SchemaType } from \"../Differencing/SchemaDifference\";\n\n/**\n * A walker that traverses the schema differences in a certain oder and invokes the appropriate\n * visitor method for each kind of schema difference.\n * @internal\n */\nexport class SchemaMergingWalker extends SchemaDifferenceWalker {\n\n /**\n * Traverses the schema differences and calls the appropriate method on the visitor.\n * This method overrides the derived class method to apply some ordering how the\n * differences are traversed.\n *\n * @param differences The differences to traverse.\n * @param changeType Optional type of change to filter by.\n */\n public override async traverse(differences: Array<AnySchemaDifference>, changeType?: DifferenceType): Promise<void> {\n\n const filterByType = (schemaType: SchemaType) => {\n return (entry: AnySchemaDifference) => {\n return entry.schemaType === schemaType && (!changeType || entry.changeType === changeType);\n };\n };\n\n return super.traverse([\n // First the schema related differences are traversed...\n ...differences.filter(filterByType(SchemaOtherTypes.Schema)),\n ...differences.filter(filterByType(SchemaOtherTypes.SchemaReference)),\n\n // Then the schema items (excluding classes)...\n ...differences.filter(filterByType(SchemaItemType.UnitSystem)),\n ...differences.filter(filterByType(SchemaItemType.PropertyCategory)),\n ...differences.filter(filterByType(SchemaItemType.Enumeration)),\n ...differences.filter(filterByType(SchemaOtherTypes.Enumerator)),\n ...differences.filter(filterByType(SchemaItemType.Phenomenon)),\n ...differences.filter(filterByType(SchemaItemType.Unit)),\n ...differences.filter(filterByType(SchemaItemType.InvertedUnit)),\n ...differences.filter(filterByType(SchemaItemType.Format)),\n ...differences.filter(filterByType(SchemaOtherTypes.FormatUnit)),\n ...differences.filter(filterByType(SchemaOtherTypes.FormatUnitLabel)),\n ...differences.filter(filterByType(SchemaItemType.KindOfQuantity)),\n ...differences.filter(filterByType(SchemaItemType.Constant)),\n ...differences.filter(filterByType(SchemaOtherTypes.KindOfQuantityPresentationFormat)),\n\n // Followed by classes and class related differences...\n ...differences.filter(filterByType(SchemaItemType.CustomAttributeClass)),\n ...differences.filter(filterByType(SchemaItemType.Mixin)),\n ...differences.filter(filterByType(SchemaItemType.StructClass)),\n ...differences.filter(filterByType(SchemaItemType.EntityClass)),\n ...differences.filter(filterByType(SchemaItemType.RelationshipClass)),\n ...differences.filter(filterByType(SchemaOtherTypes.EntityClassMixin)),\n ...differences.filter(filterByType(SchemaOtherTypes.RelationshipConstraint)),\n ...differences.filter(filterByType(SchemaOtherTypes.RelationshipConstraintClass)),\n ...differences.filter(filterByType(SchemaOtherTypes.Property)),\n\n // And then the custom attributes.\n ...differences.filter(filterByType(SchemaOtherTypes.CustomAttributeInstance)),\n ]);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaReferenceMerger.js","sourceRoot":"","sources":["../../../src/Merging/SchemaReferenceMerger.ts"],"names":[],"mappings":";;AAaA,kDAGC;AAMD,wDAgBC;AA/BD,gEAAyF;AAEzF;;;GAGG;AACI,KAAK,UAAU,mBAAmB,CAAC,OAA2B,EAAE,MAAiC;IACtG,MAAM,gBAAgB,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC/G,MAAM,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AC,YAAY,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;AAC5F,CAAC;AAED;;;;;;GAMG;AACH,KAAK,UAAU,YAAY,CAAC,MAA2B,EAAE,UAAmB,EAAE,OAAgB;IAC5F,IAAG,UAAU,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,6BAAS,CAAC,UAAU,EAAE,6BAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,EAAE,mCAAe,CAAC,qBAAqB,CAAC,CAAC;IACtG,IAAG,MAAM,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,qBAAqB,SAAS,CAAC,QAAQ,EAAE,uCAAuC,CAAC,CAAC;IACpG,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,IAAe,EAAE,KAAgB;IACpD,OAAO,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC;QACrC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC;QACf,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACpB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"SchemaReferenceMerger.js","sourceRoot":"","sources":["../../../src/Merging/SchemaReferenceMerger.ts"],"names":[],"mappings":";;AAaA,kDAGC;AAMD,wDAgBC;AA/BD,gEAAyF;AAEzF;;;GAGG;AACI,KAAK,UAAU,mBAAmB,CAAC,OAA2B,EAAE,MAAiC;IACtG,MAAM,gBAAgB,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,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,CAAC;IAC/G,MAAM,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;AAC5F,CAAC;AAED;;;;;;GAMG;AACH,KAAK,UAAU,YAAY,CAAC,MAA2B,EAAE,UAAmB,EAAE,OAAgB;IAC5F,IAAG,UAAU,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,6BAAS,CAAC,UAAU,EAAE,6BAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,EAAE,mCAAe,CAAC,qBAAqB,CAAC,CAAC;IACtG,IAAG,MAAM,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,qBAAqB,SAAS,CAAC,QAAQ,EAAE,uCAAuC,CAAC,CAAC;IACpG,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,IAAe,EAAE,KAAgB;IACpD,OAAO,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC;QACrC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC;QACf,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACpB,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 { SchemaReferenceDifference } from \"../Differencing/SchemaDifference\";\nimport type { SchemaContextEditor } from \"../Editing/Editor\";\nimport { ECVersion, Schema, SchemaKey, SchemaMatchType } from \"@itwin/ecschema-metadata\";\n\n/**\n * Merges a new reference to an external schema into the target schema.\n * @internal\n */\nexport async function addSchemaReferences(context: SchemaMergeContext, change: SchemaReferenceDifference) {\n const referencedSchema = await locateSchema(context.editor, change.difference.name, change.difference.version);\n await context.editor.addSchemaReference(context.targetSchemaKey, referencedSchema);\n}\n\n/**\n * Merges differences to an existing schema references in the target schema.\n * @internal\n */\nexport async function modifySchemaReferences(context: SchemaMergeContext, change: SchemaReferenceDifference) {\n const existingSchema = await context.targetSchema.getReference(change.difference.name) as Schema;\n const [older, latest] = sortSchemas(existingSchema.schemaKey, new SchemaKey(change.difference.name, ECVersion.fromString(change.difference.version)));\n if(latest === existingSchema.schemaKey) {\n return;\n }\n\n if(!latest.matches(older, SchemaMatchType.LatestWriteCompatible)) {\n throw new Error(`Schemas references of ${change.difference.name} have incompatible versions: ${older.version} and ${latest.version}`);\n }\n\n const index = context.targetSchema.references.findIndex((reference) => reference === existingSchema);\n context.targetSchema.references.splice(index, 1);\n\n const referencedSchema = await locateSchema(context.editor, change.difference.name, change.difference.version);\n await context.editor.addSchemaReference(context.targetSchema.schemaKey, referencedSchema);\n}\n\n/**\n * Tries to locate the Schema in the current Context\n * @param editor Current editor context.\n * @param schemaName The schema name to be looked up.\n * @param version The schemas version to beo looked up.\n * @returns The schema found in the context.\n */\nasync function locateSchema(editor: SchemaContextEditor, schemaName?: string, version?: string): Promise<Schema> {\n if(schemaName === undefined || version === undefined) {\n throw new Error(\"Schema name and version must not be undefined.\");\n }\n\n const schemaKey = new SchemaKey(schemaName, ECVersion.fromString(version));\n const schema = await editor.schemaContext.getSchema(schemaKey, SchemaMatchType.LatestWriteCompatible);\n if(schema === undefined) {\n throw new Error(`Referenced schema ${schemaKey.toString()} could not be found in target context`);\n }\n return schema;\n}\n\n/**\n * Sorts the schemas and return them in order of their versions [older, latest].\n * @param left The first schema key to be added.\n * @param right The second schema key to be added.\n * @returns The schemas in order.\n */\nfunction sortSchemas(left: SchemaKey, right: SchemaKey): [SchemaKey, SchemaKey] {\n return left.compareByVersion(right) < 0\n ? [left, right]\n : [right, left];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StructClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/StructClassMerger.ts"],"names":[],"mappings":";;AAcA,wCAKC;AAMD,8CAGC;AApBD,+CAA4C;AAE5C;;;GAGG;AACI,KAAK,UAAU,cAAc,CAAC,OAA2B,EAAE,MAA6B;IAC7F,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE;QACpE,IAAI,EAAE,MAAM,CAAC,QAAQ;QACrB,GAAG,MAAM,CAAC,UAAU;KACrB,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,iBAAiB,CAAC,OAA2B,EAAE,MAA6B,EAAE,OAAsB;IACxH,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAiB,CAAC;IAC5E,OAAO,IAAA,yBAAW,EAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"StructClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/StructClassMerger.ts"],"names":[],"mappings":";;AAcA,wCAKC;AAMD,8CAGC;AApBD,+CAA4C;AAE5C;;;GAGG;AACI,KAAK,UAAU,cAAc,CAAC,OAA2B,EAAE,MAA6B;IAC7F,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE;QACpE,IAAI,EAAE,MAAM,CAAC,QAAQ;QACrB,GAAG,MAAM,CAAC,UAAU;KACrB,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,iBAAiB,CAAC,OAA2B,EAAE,MAA6B,EAAE,OAAsB;IACxH,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAiB,CAAC;IAC5E,OAAO,IAAA,yBAAW,EAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACrD,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 { StructClassDifference } from \"../Differencing/SchemaDifference\";\nimport type { MutableClass } from \"../Editing/Mutable/MutableClass\";\nimport type { SchemaMergeContext } from \"./SchemaMerger\";\nimport type { SchemaItemKey } from \"@itwin/ecschema-metadata\";\nimport { modifyClass } from \"./ClassMerger\";\n\n/**\n * Merges a new StructClass into the target schema.\n * @internal\n */\nexport async function addStructClass(context: SchemaMergeContext, change: StructClassDifference) {\n await context.editor.structs.createFromProps(context.targetSchemaKey, {\n name: change.itemName,\n ...change.difference,\n });\n}\n\n/**\n * Merges differences to an existing StructClass in the target schema.\n * @internal\n */\nexport async function modifyStructClass(context: SchemaMergeContext, change: StructClassDifference, itemKey: SchemaItemKey) {\n const item = await context.targetSchema.lookupItem(itemKey) as MutableClass;\n return modifyClass(context, change, itemKey, item);\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SchemaItemKey } from "@itwin/ecschema-metadata";
|
|
2
|
+
import { UnitDifference } from "../Differencing/SchemaDifference";
|
|
3
|
+
import { SchemaMergeContext } from "./SchemaMerger";
|
|
4
|
+
/**
|
|
5
|
+
* Merges a new Unit into the target schema.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare function addUnit(context: SchemaMergeContext, change: UnitDifference): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Merges differences to an existing Unit in the target schema.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function modifyUnit(context: SchemaMergeContext, change: UnitDifference, itemKey: SchemaItemKey): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=UnitMerger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnitMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/UnitMerger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGpD;;;GAGG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,cAAc,iBAsBhF;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,iBA2B3G"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addUnit = addUnit;
|
|
4
|
+
exports.modifyUnit = modifyUnit;
|
|
5
|
+
const Utils_1 = require("./Utils");
|
|
6
|
+
/**
|
|
7
|
+
* Merges a new Unit into the target schema.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
async function addUnit(context, change) {
|
|
11
|
+
if (change.difference.phenomenon === undefined) {
|
|
12
|
+
throw new Error("Unit must define phenomenon");
|
|
13
|
+
}
|
|
14
|
+
if (change.difference.unitSystem === undefined) {
|
|
15
|
+
throw new Error("Unit must define unitSystem");
|
|
16
|
+
}
|
|
17
|
+
if (change.difference.definition === undefined) {
|
|
18
|
+
throw new Error("Unit must define definition");
|
|
19
|
+
}
|
|
20
|
+
change.difference.phenomenon = await (0, Utils_1.updateSchemaItemFullName)(context, change.difference.phenomenon);
|
|
21
|
+
change.difference.unitSystem = await (0, Utils_1.updateSchemaItemFullName)(context, change.difference.unitSystem);
|
|
22
|
+
await context.editor.units.createFromProps(context.targetSchemaKey, {
|
|
23
|
+
...change.difference,
|
|
24
|
+
name: change.itemName,
|
|
25
|
+
schemaItemType: change.schemaType,
|
|
26
|
+
phenomenon: change.difference.phenomenon,
|
|
27
|
+
unitSystem: change.difference.unitSystem,
|
|
28
|
+
definition: change.difference.definition,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Merges differences to an existing Unit in the target schema.
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
async function modifyUnit(context, change, itemKey) {
|
|
36
|
+
if (change.difference.unitSystem !== undefined) {
|
|
37
|
+
throw new Error(`Changing the unit '${change.itemName}' unitSystem is not supported.`);
|
|
38
|
+
}
|
|
39
|
+
if (change.difference.phenomenon !== undefined) {
|
|
40
|
+
throw new Error(`Changing the unit '${change.itemName}' phenomenon is not supported.`);
|
|
41
|
+
}
|
|
42
|
+
if (change.difference.definition !== undefined) {
|
|
43
|
+
throw new Error(`Changing the unit '${change.itemName}' definition is not supported.`);
|
|
44
|
+
}
|
|
45
|
+
// we have consider later should we allow to change these values on merging
|
|
46
|
+
if (change.difference.denominator !== undefined) {
|
|
47
|
+
throw new Error(`Changing the unit '${change.itemName}' denominator is not supported.`);
|
|
48
|
+
}
|
|
49
|
+
if (change.difference.numerator !== undefined) {
|
|
50
|
+
throw new Error(`Changing the unit '${change.itemName}' numerator is not supported.`);
|
|
51
|
+
}
|
|
52
|
+
if (change.difference.offset !== undefined) {
|
|
53
|
+
throw new Error(`Changing the unit '${change.itemName}' offset is not supported.`);
|
|
54
|
+
}
|
|
55
|
+
if (change.difference.label !== undefined) {
|
|
56
|
+
await context.editor.units.setDisplayLabel(itemKey, change.difference.label);
|
|
57
|
+
}
|
|
58
|
+
if (change.difference.description !== undefined) {
|
|
59
|
+
await context.editor.units.setDescription(itemKey, change.difference.description);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=U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,MAAM,CAAC,UAAU,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QAChD,MAAM,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IACpF,CAAC;AACH,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 { SchemaItemKey } from \"@itwin/ecschema-metadata\";\nimport { UnitDifference } from \"../Differencing/SchemaDifference\";\nimport { SchemaMergeContext } from \"./SchemaMerger\";\nimport { updateSchemaItemFullName } from \"./Utils\";\n\n/**\n * Merges a new Unit into the target schema.\n * @internal\n */\nexport async function addUnit(context: SchemaMergeContext, change: UnitDifference) {\n if (change.difference.phenomenon === undefined) {\n throw new Error(\"Unit must define phenomenon\");\n }\n if (change.difference.unitSystem === undefined) {\n throw new Error(\"Unit must define unitSystem\");\n }\n if (change.difference.definition === undefined) {\n throw new Error(\"Unit must define definition\");\n }\n\n change.difference.phenomenon = await updateSchemaItemFullName(context, change.difference.phenomenon);\n change.difference.unitSystem = await updateSchemaItemFullName(context, change.difference.unitSystem);\n\n await context.editor.units.createFromProps(context.targetSchemaKey, {\n ...change.difference,\n name: change.itemName,\n schemaItemType: change.schemaType,\n phenomenon: change.difference.phenomenon,\n unitSystem: change.difference.unitSystem,\n definition: change.difference.definition,\n });\n}\n\n/**\n * Merges differences to an existing Unit in the target schema.\n * @internal\n */\nexport async function modifyUnit(context: SchemaMergeContext, change: UnitDifference, itemKey: SchemaItemKey) {\n if (change.difference.unitSystem !== undefined) {\n throw new Error(`Changing the unit '${change.itemName}' unitSystem is not supported.`);\n }\n if (change.difference.phenomenon !== undefined) {\n throw new Error(`Changing the unit '${change.itemName}' phenomenon is not supported.`);\n }\n if (change.difference.definition !== undefined) {\n throw new Error(`Changing the unit '${change.itemName}' definition is not supported.`);\n }\n // we have consider later should we allow to change these values on merging\n if (change.difference.denominator !== undefined) {\n throw new Error(`Changing the unit '${change.itemName}' denominator is not supported.`);\n }\n if (change.difference.numerator !== undefined) {\n throw new Error(`Changing the unit '${change.itemName}' numerator is not supported.`);\n }\n if (change.difference.offset !== undefined) {\n throw new Error(`Changing the unit '${change.itemName}' offset is not supported.`);\n }\n\n if (change.difference.label !== undefined) {\n await context.editor.units.setDisplayLabel(itemKey, change.difference.label);\n }\n if (change.difference.description !== undefined) {\n await context.editor.units.setDescription(itemKey, change.difference.description);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnitSystemMerger.js","sourceRoot":"","sources":["../../../src/Merging/UnitSystemMerger.ts"],"names":[],"mappings":";;AAYA,sCAMC;AAMD,4CAOC;AAvBD;;;GAGG;AACI,KAAK,UAAU,aAAa,CAAC,OAA2B,EAAE,MAA4B;IAC3F,MAAM,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE;QACxE,GAAG,MAAM,CAAC,UAAU;QACpB,IAAI,EAAE,MAAM,CAAC,QAAQ;QACrB,cAAc,EAAE,MAAM,CAAC,UAAU;KAClC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,gBAAgB,CAAC,OAA2B,EAAE,MAA4B,EAAE,OAAsB;IACtH,IAAG,MAAM,CAAC,UAAU,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QACzC,MAAM,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACrF,CAAC;IACD,IAAG,MAAM,CAAC,UAAU,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QAC/C,MAAM,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"UnitSystemMerger.js","sourceRoot":"","sources":["../../../src/Merging/UnitSystemMerger.ts"],"names":[],"mappings":";;AAYA,sCAMC;AAMD,4CAOC;AAvBD;;;GAGG;AACI,KAAK,UAAU,aAAa,CAAC,OAA2B,EAAE,MAA4B;IAC3F,MAAM,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE;QACxE,GAAG,MAAM,CAAC,UAAU;QACpB,IAAI,EAAE,MAAM,CAAC,QAAQ;QACrB,cAAc,EAAE,MAAM,CAAC,UAAU;KAClC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,gBAAgB,CAAC,OAA2B,EAAE,MAA4B,EAAE,OAAsB;IACtH,IAAG,MAAM,CAAC,UAAU,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QACzC,MAAM,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACrF,CAAC;IACD,IAAG,MAAM,CAAC,UAAU,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QAC/C,MAAM,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC1F,CAAC;AACH,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 { UnitSystemDifference } from \"../Differencing/SchemaDifference\";\nimport type { SchemaMergeContext } from \"./SchemaMerger\";\nimport type { SchemaItemKey } from \"@itwin/ecschema-metadata\";\n\n/**\n * Merges a new UnitSystem into the target schema.\n * @internal\n */\nexport async function addUnitSystem(context: SchemaMergeContext, change: UnitSystemDifference) {\n await context.editor.unitSystems.createFromProps(context.targetSchemaKey, {\n ...change.difference,\n name: change.itemName,\n schemaItemType: change.schemaType,\n });\n}\n\n/**\n * Merges differences to an existing UnitSystem in the target schema.\n * @internal\n */\nexport async function modifyUnitSystem(context: SchemaMergeContext, change: UnitSystemDifference, itemKey: SchemaItemKey) {\n if(change.difference.label !== undefined) {\n await context.editor.unitSystems.setDisplayLabel(itemKey, change.difference.label);\n }\n if(change.difference.description !== undefined) {\n await context.editor.unitSystems.setDescription(itemKey, change.difference.description);\n }\n}\n"]}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { ECClasses } from "../Editing/ECClasses";
|
|
2
|
+
import { PropertyKey } from "./Edits/NameMapping";
|
|
2
3
|
import type { SchemaMergeContext } from "./SchemaMerger";
|
|
3
4
|
import { ECClass, SchemaItem, SchemaItemKey } from "@itwin/ecschema-metadata";
|
|
5
|
+
/**
|
|
6
|
+
* Resolves a SchemaItemKey for the given item name.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare function toItemKey(context: SchemaMergeContext, itemName: string): SchemaItemKey;
|
|
10
|
+
/**
|
|
11
|
+
* Resolves a SchemaItemKey for the given class property name.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare function toPropertyKey(context: SchemaMergeContext, itemName: string, propertyName: string): PropertyKey;
|
|
4
15
|
/**
|
|
5
16
|
* Convenience-method around updateSchemaItemKey that returns the full name instead of a SchemaItemKey.
|
|
6
17
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/Merging/Utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAk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package/lib/cjs/Merging/Utils.js
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toItemKey = toItemKey;
|
|
4
|
+
exports.toPropertyKey = toPropertyKey;
|
|
3
5
|
exports.updateSchemaItemFullName = updateSchemaItemFullName;
|
|
4
6
|
exports.updateSchemaItemKey = updateSchemaItemKey;
|
|
5
7
|
exports.locateSchemaItem = locateSchemaItem;
|
|
6
8
|
exports.getClassEditor = getClassEditor;
|
|
9
|
+
const NameMapping_1 = require("./Edits/NameMapping");
|
|
7
10
|
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
11
|
+
/**
|
|
12
|
+
* Resolves a SchemaItemKey for the given item name.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
function toItemKey(context, itemName) {
|
|
16
|
+
const classKey = context.nameMapping.resolveItemKey(new ecschema_metadata_1.SchemaItemKey(itemName, context.sourceSchemaKey));
|
|
17
|
+
return new ecschema_metadata_1.SchemaItemKey(classKey.name, context.targetSchemaKey);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolves a SchemaItemKey for the given class property name.
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
function toPropertyKey(context, itemName, propertyName) {
|
|
24
|
+
const classKey = new ecschema_metadata_1.SchemaItemKey(itemName, context.sourceSchemaKey);
|
|
25
|
+
return context.nameMapping.resolvePropertyKey(new NameMapping_1.PropertyKey(propertyName, classKey));
|
|
26
|
+
}
|
|
8
27
|
/**
|
|
9
28
|
* Convenience-method around updateSchemaItemKey that returns the full name instead of a SchemaItemKey.
|
|
10
29
|
* @internal
|
|
@@ -21,7 +40,8 @@ async function updateSchemaItemFullName(context, reference) {
|
|
|
21
40
|
async function updateSchemaItemKey(context, reference) {
|
|
22
41
|
const [schemaName, itemName] = ecschema_metadata_1.SchemaItem.parseFullName(reference);
|
|
23
42
|
if (context.sourceSchemaKey.compareByName(schemaName)) {
|
|
24
|
-
|
|
43
|
+
const schemaItemKey = toItemKey(context, itemName);
|
|
44
|
+
return resolveSchemaItemKey(context.editor.schemaContext, schemaItemKey);
|
|
25
45
|
}
|
|
26
46
|
const referencedSchema = await context.targetSchema.getReference(schemaName);
|
|
27
47
|
if (referencedSchema !== undefined) {
|
|
@@ -46,7 +66,7 @@ async function resolveSchemaItemKey(schemaContext, itemKey) {
|
|
|
46
66
|
* @internal
|
|
47
67
|
*/
|
|
48
68
|
async function locateSchemaItem(context, itemName, schemaType) {
|
|
49
|
-
const schemaItemKey =
|
|
69
|
+
const schemaItemKey = toItemKey(context, itemName);
|
|
50
70
|
const schemaItem = await context.editor.schemaContext.getSchemaItem(schemaItemKey);
|
|
51
71
|
if (schemaItem === undefined) {
|
|
52
72
|
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `${schemaType} ${schemaItemKey.fullName} not found in schema context.`);
|
|
@@ -59,7 +79,7 @@ async function locateSchemaItem(context, itemName, schemaType) {
|
|
|
59
79
|
async function getClassEditor(context, ecClass) {
|
|
60
80
|
const schemaItemType = ecschema_metadata_1.ECClass.isECClass(ecClass)
|
|
61
81
|
? ecClass.schemaItemType
|
|
62
|
-
: (await context.editor.schemaContext.getSchemaItem(ecClass))?.schemaItemType;
|
|
82
|
+
: (await context.editor.schemaContext.getSchemaItem(ecClass, ecschema_metadata_1.ECClass))?.schemaItemType;
|
|
63
83
|
switch (schemaItemType) {
|
|
64
84
|
case ecschema_metadata_1.SchemaItemType.EntityClass:
|
|
65
85
|
return context.editor.entities;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/Merging/Utils.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/Merging/Utils.ts"],"names":[],"mappings":";;AAaA,8BAGC;AAMD,sCAGC;AAMD,4D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B,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,OAAO,EAAE,2BAAO,CAAC,CAAC,EAAE,cAAc,CAAC;IAEzF,QAAO,cAAc,EAAE,CAAC;QACtB,KAAK,kCAAc,CAAC,WAAW;YAC7B,OAAO,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;QACjC,KAAK,kCAAc,CAAC,KAAK;YACvB,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;QAC/B,KAAK,kCAAc,CAAC,WAAW;YAC7B,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;QAChC,KAAK,kCAAc,CAAC,oBAAoB;YACtC,OAAO,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC;QACzC,KAAK,kCAAc,CAAC,iBAAiB;YACnC,OAAO,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC;QACtC;YACE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACpD,CAAC;AACH,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 { ECClasses } from \"../Editing/ECClasses\";\nimport { PropertyKey } from \"./Edits/NameMapping\";\nimport type { SchemaMergeContext } from \"./SchemaMerger\";\nimport { ECClass, ECObjectsError, ECObjectsStatus, SchemaContext, SchemaItem, SchemaItemKey, SchemaItemType } from \"@itwin/ecschema-metadata\";\n\n/**\n * Resolves a SchemaItemKey for the given item name.\n * @internal\n */\nexport function toItemKey(context: SchemaMergeContext, itemName: string): SchemaItemKey {\n const classKey = context.nameMapping.resolveItemKey(new SchemaItemKey(itemName, context.sourceSchemaKey));\n return new SchemaItemKey(classKey.name, context.targetSchemaKey);\n}\n\n/**\n * Resolves a SchemaItemKey for the given class property name.\n * @internal\n */\nexport function toPropertyKey(context: SchemaMergeContext, itemName: string, propertyName: string): PropertyKey {\n const classKey = new SchemaItemKey(itemName, context.sourceSchemaKey);\n return context.nameMapping.resolvePropertyKey(new PropertyKey(propertyName, classKey));\n}\n\n/**\n * Convenience-method around updateSchemaItemKey that returns the full name instead of a SchemaItemKey.\n * @internal\n */\nexport async function updateSchemaItemFullName(context: SchemaMergeContext, reference: string) {\n const schemaItemKey = await updateSchemaItemKey(context, reference);\n return schemaItemKey.fullName;\n}\n\n/**\n * Updates the given reference if it refers to a SchemaItem in the source Schema and\n * returns a SchemaItemKey. If any other schema is referred the reference is not change.\n * @internal\n */\nexport async function updateSchemaItemKey(context: SchemaMergeContext, reference: string) {\n const [schemaName, itemName] = SchemaItem.parseFullName(reference);\n if (context.sourceSchemaKey.compareByName(schemaName)) {\n const schemaItemKey = toItemKey(context, itemName);\n return resolveSchemaItemKey(context.editor.schemaContext, schemaItemKey);\n }\n\n const referencedSchema = await context.targetSchema.getReference(schemaName);\n if (referencedSchema !== undefined) {\n return resolveSchemaItemKey(context.editor.schemaContext, new SchemaItemKey(itemName, referencedSchema.schemaKey));\n }\n\n throw new Error(`Cannot locate referenced schema item ${reference}`);\n}\n\n/**\n * To support case insensitivity for schema items, the given key is checked if there\n * exists an item for it.\n * @internal\n */\nasync function resolveSchemaItemKey(schemaContext: SchemaContext, itemKey: SchemaItemKey): Promise<SchemaItemKey> {\n const item = await schemaContext.getSchemaItem(itemKey);\n if (item === undefined) {\n // If the schema item hasn't been created yet, we have to trust the given key is correctly spelled.\n return itemKey;\n }\n return item.key;\n}\n\n/**\n * @internal\n */\nexport async function locateSchemaItem(context: SchemaMergeContext, itemName: string, schemaType: string) {\n const schemaItemKey = toItemKey(context, itemName);\n const schemaItem = await context.editor.schemaContext.getSchemaItem(schemaItemKey);\n if (schemaItem === undefined) {\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `${schemaType} ${schemaItemKey.fullName} not found in schema context.`);\n }\n\n return schemaItem;\n}\n\n/**\n * @internal\n */\nexport async function getClassEditor(context: SchemaMergeContext, ecClass: ECClass | SchemaItemKey): Promise<ECClasses> {\n const schemaItemType = ECClass.isECClass(ecClass)\n ? ecClass.schemaItemType\n : (await context.editor.schemaContext.getSchemaItem(ecClass, ECClass))?.schemaItemType;\n\n switch(schemaItemType) {\n case SchemaItemType.EntityClass:\n return context.editor.entities;\n case SchemaItemType.Mixin:\n return context.editor.mixins;\n case SchemaItemType.StructClass:\n return context.editor.structs;\n case SchemaItemType.CustomAttributeClass:\n return context.editor.customAttributes;\n case SchemaItemType.RelationshipClass:\n return context.editor.relationships;\n default:\n throw new Error(\"SchemaItemType not supported\");\n }\n}\n"]}
|