@itwin/ecschema-editing 5.5.0-dev.1 → 5.5.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Differencing/Errors.js.map +1 -1
- package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifferenceValidator.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifferenceVisitor.js.map +1 -1
- package/lib/cjs/Differencing/Utils.js.map +1 -1
- package/lib/cjs/Editing/Constants.js.map +1 -1
- package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
- package/lib/cjs/Editing/ECClasses.js.map +1 -1
- package/lib/cjs/Editing/Editor.js.map +1 -1
- package/lib/cjs/Editing/Entities.js.map +1 -1
- package/lib/cjs/Editing/Enumerations.js.map +1 -1
- package/lib/cjs/Editing/Exception.js.map +1 -1
- package/lib/cjs/Editing/Formats.js.map +1 -1
- package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
- package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
- 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.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.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.js.map +1 -1
- package/lib/cjs/Editing/Properties.js.map +1 -1
- package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
- package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
- package/lib/cjs/Editing/SchemaItems.js.map +1 -1
- package/lib/cjs/Editing/Structs.js.map +1 -1
- package/lib/cjs/Editing/UnitSystems.js.map +1 -1
- package/lib/cjs/Editing/Units.js.map +1 -1
- package/lib/cjs/Merging/ClassMerger.js.map +1 -1
- package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
- package/lib/cjs/Merging/CustomAttributeClassMerger.js.map +1 -1
- package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
- package/lib/cjs/Merging/Edits/NameMapping.js.map +1 -1
- package/lib/cjs/Merging/Edits/RenameEditHandler.js.map +1 -1
- 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.map +1 -1
- package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
- package/lib/cjs/Merging/EnumeratorMerger.js.map +1 -1
- package/lib/cjs/Merging/FormatMerger.js.map +1 -1
- package/lib/cjs/Merging/InvertedUnitMerger.js.map +1 -1
- package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
- package/lib/cjs/Merging/MixinMerger.js.map +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.map +1 -1
- package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaMergingVisitor.js.map +1 -1
- 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.js.map +1 -1
- package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -1
- package/lib/cjs/Merging/Utils.js.map +1 -1
- package/lib/cjs/Validation/Diagnostic.js.map +1 -1
- package/lib/cjs/Validation/DiagnosticReporter.js.map +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.map +1 -1
- package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
- package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
- package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
- package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-editing.js.map +1 -1
- package/lib/esm/Differencing/Errors.js.map +1 -1
- package/lib/esm/Differencing/SchemaConflicts.js.map +1 -1
- package/lib/esm/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
- package/lib/esm/Differencing/SchemaDifference.js.map +1 -1
- package/lib/esm/Differencing/SchemaDifferenceValidator.js.map +1 -1
- package/lib/esm/Differencing/SchemaDifferenceVisitor.js.map +1 -1
- package/lib/esm/Differencing/Utils.js.map +1 -1
- package/lib/esm/Editing/Constants.js.map +1 -1
- package/lib/esm/Editing/CustomAttributes.js.map +1 -1
- package/lib/esm/Editing/ECClasses.js.map +1 -1
- package/lib/esm/Editing/Editor.js.map +1 -1
- package/lib/esm/Editing/Entities.js.map +1 -1
- package/lib/esm/Editing/Enumerations.js.map +1 -1
- package/lib/esm/Editing/Exception.js.map +1 -1
- package/lib/esm/Editing/Formats.js.map +1 -1
- package/lib/esm/Editing/InvertedUnits.js.map +1 -1
- package/lib/esm/Editing/KindOfQuantities.js.map +1 -1
- package/lib/esm/Editing/Mixins.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableArrayProperty.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableCAClass.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableClass.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableConstant.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableEntityClass.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableEnumeration.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableFormat.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableMixin.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableNavigationProperty.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutablePhenomenon.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableProperty.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableSchema.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableSchemaItem.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableStructProperty.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableUnit.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableUnitSystem.js.map +1 -1
- package/lib/esm/Editing/Phenomena.js.map +1 -1
- package/lib/esm/Editing/Properties.js.map +1 -1
- package/lib/esm/Editing/PropertyCategories.js.map +1 -1
- package/lib/esm/Editing/RelationshipClasses.js.map +1 -1
- package/lib/esm/Editing/SchemaItems.js.map +1 -1
- package/lib/esm/Editing/Structs.js.map +1 -1
- package/lib/esm/Editing/UnitSystems.js.map +1 -1
- package/lib/esm/Editing/Units.js.map +1 -1
- package/lib/esm/Merging/ClassMerger.js.map +1 -1
- package/lib/esm/Merging/ConstantMerger.js.map +1 -1
- package/lib/esm/Merging/CustomAttributeClassMerger.js.map +1 -1
- package/lib/esm/Merging/CustomAttributeMerger.js.map +1 -1
- package/lib/esm/Merging/Edits/NameMapping.js.map +1 -1
- package/lib/esm/Merging/Edits/RenameEditHandler.js.map +1 -1
- package/lib/esm/Merging/Edits/SchemaEdits.js.map +1 -1
- package/lib/esm/Merging/Edits/SkipEditHandler.js.map +1 -1
- package/lib/esm/Merging/EntityClassMerger.js.map +1 -1
- package/lib/esm/Merging/EnumerationMerger.js.map +1 -1
- package/lib/esm/Merging/EnumeratorMerger.js.map +1 -1
- package/lib/esm/Merging/FormatMerger.js.map +1 -1
- package/lib/esm/Merging/InvertedUnitMerger.js.map +1 -1
- package/lib/esm/Merging/KindOfQuantityMerger.js.map +1 -1
- package/lib/esm/Merging/MixinMerger.js.map +1 -1
- package/lib/esm/Merging/PhenomenonMerger.js.map +1 -1
- package/lib/esm/Merging/PropertyCategoryMerger.js.map +1 -1
- package/lib/esm/Merging/PropertyMerger.js.map +1 -1
- package/lib/esm/Merging/RelationshipClassMerger.js.map +1 -1
- package/lib/esm/Merging/SchemaMerger.js.map +1 -1
- package/lib/esm/Merging/SchemaMergingVisitor.js.map +1 -1
- package/lib/esm/Merging/SchemaMergingWalker.js.map +1 -1
- package/lib/esm/Merging/SchemaReferenceMerger.js.map +1 -1
- package/lib/esm/Merging/StructClassMerger.js.map +1 -1
- package/lib/esm/Merging/UnitMerger.js.map +1 -1
- package/lib/esm/Merging/UnitSystemMerger.js.map +1 -1
- package/lib/esm/Merging/Utils.js.map +1 -1
- package/lib/esm/Validation/Diagnostic.js.map +1 -1
- package/lib/esm/Validation/DiagnosticReporter.js.map +1 -1
- package/lib/esm/Validation/ECRules.js.map +1 -1
- package/lib/esm/Validation/LoggingDiagnosticReporter.js.map +1 -1
- package/lib/esm/Validation/RuleSuppressionSet.js.map +1 -1
- package/lib/esm/Validation/Rules.js.map +1 -1
- package/lib/esm/Validation/SchemaChanges.js.map +1 -1
- package/lib/esm/Validation/SchemaCompareDiagnostics.js.map +1 -1
- package/lib/esm/Validation/SchemaCompareReporter.js.map +1 -1
- package/lib/esm/Validation/SchemaCompareResultDelegate.js.map +1 -1
- package/lib/esm/Validation/SchemaCompareVisitor.js.map +1 -1
- package/lib/esm/Validation/SchemaComparer.js.map +1 -1
- package/lib/esm/Validation/SchemaValidater.js.map +1 -1
- package/lib/esm/Validation/SchemaValidationVisitor.js.map +1 -1
- package/lib/esm/Validation/SchemaWalker.js.map +1 -1
- package/lib/esm/ecschema-editing.js.map +1 -1
- package/package.json +9 -9
- package/public/locales/en/ECSchemaEditing.json +26 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Errors.js","sourceRoot":"","sources":["../../../src/Differencing/Errors.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAKH;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,KAAK;IAC7C,sDAAsD;IACtC,SAAS,CAA6C;IACtE,0CAA0C;IAC1B,YAAY,CAAY;IACxC,0CAA0C;IAC1B,YAAY,CAAY;IAExC,YAAY,OAAe,EAAE,SAAwC,EAAE,YAAuB,EAAE,YAAuB;QACrH,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAfD,oDAeC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"Errors.js","sourceRoot":"","sources":["../../../src/Differencing/Errors.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAKH;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,KAAK;IAC7C,sDAAsD;IACtC,SAAS,CAA6C;IACtE,0CAA0C;IAC1B,YAAY,CAAY;IACxC,0CAA0C;IAC1B,YAAY,CAAY;IAExC,YAAY,OAAe,EAAE,SAAwC,EAAE,YAAuB,EAAE,YAAuB;QACrH,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAfD,oDAeC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Differencing\n */\n\nimport type { SchemaKey } from \"@itwin/ecschema-metadata\";\nimport type { AnySchemaDifferenceConflict } from \"./SchemaConflicts\";\n\n/**\n * Error class that contains conflicts when differencing two schemas.\n * @alpha\n */\nexport class SchemaConflictsError extends Error {\n /** Gets an array of conflicts between two schemas. */\n public readonly conflicts: ReadonlyArray<AnySchemaDifferenceConflict>;\n /** Gets the name of the source schema. */\n public readonly sourceSchema: SchemaKey;\n /** Gets the name of the target schema. */\n public readonly targetSchema: SchemaKey;\n\n constructor(message: string, conflicts: AnySchemaDifferenceConflict[], sourceSchema: SchemaKey, targetSchema: SchemaKey) {\n super(message);\n\n this.sourceSchema = sourceSchema;\n this.targetSchema = targetSchema;\n this.conflicts = conflicts;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaConflicts.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaConflicts.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAKH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,IAAY,YA4BX;AA5BD,WAAY,YAAY;IAEtB,6CAA6B,CAAA;IAC7B,mDAAmC,CAAA;IACnC,qDAAqC,CAAA;IACrC,qDAAqC,CAAA;IAErC,8CAA8B,CAAA;IAC9B,2CAA2B,CAAA;IAC3B,yCAAyB,CAAA;IACzB,kDAAkC,CAAA;IAElC,oDAAoC,CAAA;IACpC,oDAAoC,CAAA;IAEpC,+CAA+B,CAAA;IAC/B,yDAAyC,CAAA;IAEzC,qDAAqC,CAAA;IACrC,+DAA+C,CAAA;IAE/C,kDAAkC,CAAA;IAClC,4DAA4C,CAAA;IAC5C,gEAAgD,CAAA;IAEhD,sEAAsD,CAAA;IACtD,sEAAsD,CAAA;IACtD,wEAAwD,CAAA;AAC1D,CAAC,EA5BW,YAAY,4BAAZ,YAAY,QA4BvB","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"SchemaConflicts.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaConflicts.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAKH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,IAAY,YA4BX;AA5BD,WAAY,YAAY;IAEtB,6CAA6B,CAAA;IAC7B,mDAAmC,CAAA;IACnC,qDAAqC,CAAA;IACrC,qDAAqC,CAAA;IAErC,8CAA8B,CAAA;IAC9B,2CAA2B,CAAA;IAC3B,yCAAyB,CAAA;IACzB,kDAAkC,CAAA;IAElC,oDAAoC,CAAA;IACpC,oDAAoC,CAAA;IAEpC,+CAA+B,CAAA;IAC/B,yDAAyC,CAAA;IAEzC,qDAAqC,CAAA;IACrC,+DAA+C,CAAA;IAE/C,kDAAkC,CAAA;IAClC,4DAA4C,CAAA;IAC5C,gEAAgD,CAAA;IAEhD,sEAAsD,CAAA;IACtD,sEAAsD,CAAA;IACtD,wEAAwD,CAAA;AAC1D,CAAC,EA5BW,YAAY,4BAAZ,YAAY,QA4BvB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Differencing\n */\n\nimport type { SchemaItemType } from \"@itwin/ecschema-metadata\";\nimport type { AnySchemaDifference, SchemaOtherTypes, SchemaType } from \"./SchemaDifference\";\n\n/**\n * The unique conflicts codes for Schema differencing.\n *\n * To provide meaning to code values, with anticipation\n * of future rules for all current EC Types, the following\n * value ranges should be used:\n *\n * - Schema: 000-099\n * - Class: 100-199\n * - Constant: 200-299\n * - CustomAttribute 300-399\n * - CustomAttributeClass: 400-499\n * - CustomAttributeContainer: 500-599\n * - EntityClass: 600-699\n * - Enumeration: 700-799\n * - Format: 800-899\n * - InvertedUnit: 900-999\n * - KindOfQuantity: 1000-1099\n * - Mixin: 1100-1199\n * - Phenomenon: 1200-1299\n * - Property: 1300-1399\n * - PropertyCategory: 1400-1499\n * - RelationshipClass: 1500-1599\n * - RelationshipConstraint: 1600-1699\n * - StructClass: 1700-1799\n * - Unit: 1800-1899\n * - UnitSystem: 1900-1999\n *\n * @alpha\n */\nexport enum ConflictCode {\n\n ConflictingItemName = \"C-001\",\n ConflictingReferenceAlias = \"C-002\",\n ConflictingReferenceVersion = \"C-003\",\n ConflictingReferenceDynamic = \"C-004\",\n\n ConflictingBaseClass = \"C-100\",\n RemovingBaseClass = \"C-101\",\n SealedBaseClass = \"C-102\",\n ConflictingClassModifier = \"C-103\",\n\n ConflictingEnumerationType = \"C-700\",\n ConflictingEnumeratorValue = \"C-701\",\n\n ConflictingFormatUnit = \"C-800\",\n ConflictingFormatUnitPhenomenon = \"C-801\",\n\n ConflictingPersistenceUnit = \"C-1010\",\n MixinAppliedMustDeriveFromConstraint = \"C-1100\",\n\n ConflictingPropertyName = \"C-1300\",\n ConflictingPropertyKindOfQuantity = \"C-1301\",\n ConflictingPropertyKindOfQuantityUnit = \"C-1302\",\n\n AbstractConstraintMustNarrowBaseConstraints = \"C-1500\",\n DerivedConstraintsMustNarrowBaseConstraints = \"C-1501\",\n ConstraintClassesDeriveFromAbstractConstraint = \"C-1502\",\n}\n\n/**\n * Defines the interface for a conflict during Schema Differencing. Conflicts were discovered\n * while comparing the changed elements. Conflicts in the whole schema context are not found\n * on that level.\n */\ninterface SchemaDifferenceConflict<TCode extends ConflictCode, TType extends SchemaType, TDifference = Extract<AnySchemaDifference, { schemaType: TType }>> {\n /** The associated schema difference instance */\n readonly difference: TDifference;\n\n /** The unique conflicting code. */\n readonly code: TCode;\n\n /** A description of the conflict. */\n readonly description: string;\n\n /** The value in the source schema. */\n readonly source: unknown;\n\n /** The value in the target schema. */\n readonly target: unknown;\n}\n\n/** Union type of class types */\ntype EcClassTypes = SchemaItemType.CustomAttributeClass | SchemaItemType.EntityClass | SchemaItemType.StructClass | SchemaItemType.Mixin | SchemaItemType.RelationshipClass;\n\n/**\n * Union of all supported schema differencing conflict types.\n * @alpha\n */\nexport type AnySchemaDifferenceConflict =\n SchemaDifferenceConflict<ConflictCode.ConflictingItemName, SchemaItemType> |\n SchemaDifferenceConflict<ConflictCode.ConflictingReferenceAlias, SchemaOtherTypes.SchemaReference> |\n SchemaDifferenceConflict<ConflictCode.ConflictingReferenceVersion, SchemaOtherTypes.SchemaReference> |\n SchemaDifferenceConflict<ConflictCode.ConflictingReferenceDynamic, SchemaOtherTypes.SchemaReference> |\n SchemaDifferenceConflict<ConflictCode.ConflictingBaseClass, EcClassTypes> |\n SchemaDifferenceConflict<ConflictCode.RemovingBaseClass, EcClassTypes> |\n SchemaDifferenceConflict<ConflictCode.SealedBaseClass, EcClassTypes> |\n SchemaDifferenceConflict<ConflictCode.ConflictingClassModifier, EcClassTypes> |\n SchemaDifferenceConflict<ConflictCode.ConflictingEnumerationType, SchemaItemType.Enumeration> |\n SchemaDifferenceConflict<ConflictCode.ConflictingEnumeratorValue, SchemaOtherTypes.Enumerator> |\n SchemaDifferenceConflict<ConflictCode.ConflictingPersistenceUnit, SchemaItemType.KindOfQuantity> |\n SchemaDifferenceConflict<ConflictCode.MixinAppliedMustDeriveFromConstraint, SchemaOtherTypes.EntityClassMixin> |\n SchemaDifferenceConflict<ConflictCode.ConflictingPropertyName, SchemaOtherTypes.Property> |\n SchemaDifferenceConflict<ConflictCode.ConflictingPropertyKindOfQuantity, SchemaOtherTypes.Property> |\n SchemaDifferenceConflict<ConflictCode.ConflictingPropertyKindOfQuantityUnit, SchemaOtherTypes.Property> |\n SchemaDifferenceConflict<ConflictCode.ConflictingFormatUnit, SchemaOtherTypes.FormatUnit> |\n SchemaDifferenceConflict<ConflictCode.ConflictingFormatUnitPhenomenon, SchemaOtherTypes.FormatUnit> |\n SchemaDifferenceConflict<ConflictCode.AbstractConstraintMustNarrowBaseConstraints, SchemaOtherTypes.RelationshipConstraint> |\n SchemaDifferenceConflict<ConflictCode.DerivedConstraintsMustNarrowBaseConstraints, SchemaOtherTypes.RelationshipConstraint> |\n SchemaDifferenceConflict<ConflictCode.ConstraintClassesDeriveFromAbstractConstraint, SchemaOtherTypes.RelationshipConstraint>\n;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaDiagnos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K,eAAe,CAAC;QAC5D,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,YAAY,KAAK,aAAa,CAAC;QACvD,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,YAAY,KAAK,mBAAmB,CAAC,CAAC;AACtE,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\n/** @packageDocumentation\r\n * @module Differencing\r\n */\r\n\r\nimport type { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { SchemaCompareCodes } from \"../Validation/SchemaCompareDiagnostics\";\r\nimport {\r\n AnyEnumerator, AnyPropertyProps, AnySchemaItem, CustomAttribute, ECClass,\r\n Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, OverrideFormat, Property, PropertyProps,\r\n RelationshipConstraint, RelationshipConstraintProps, Schema, SchemaItem, Unit,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport {\r\n type AnyClassItemDifference,\r\n type AnySchemaItemDifference,\r\n type AnySchemaItemPathDifference,\r\n type ClassPropertyDifference,\r\n type CustomAttributeDifference,\r\n type DifferenceType,\r\n type EntityClassMixinDifference,\r\n type EnumeratorDifference,\r\n type FormatUnitDifference,\r\n type KindOfQuantityPresentationFormatDifference,\r\n type RelationshipConstraintClassDifference,\r\n type RelationshipConstraintDifference,\r\n type SchemaDifference,\r\n SchemaOtherTypes,\r\n type SchemaReferenceDifference,\r\n} from \"./SchemaDifference\";\r\n\r\n/**\r\n * The SchemaDiagnosticVisitor is a visitor implementation for diagnostic entries\r\n * from the schema comparer api. Depending on the diagnostic code, the difference\r\n * result is build together.\r\n * @internal\r\n */\r\nexport class SchemaDiagnosticVisitor {\r\n\r\n public readonly schemaDifferences: Array<SchemaDifference | SchemaReferenceDifference>;\r\n public readonly schemaItemDifferences: Array<AnySchemaItemDifference\r\n | EntityClassMixinDifference\r\n | KindOfQuantityPresentationFormatDifference\r\n | FormatUnitDifference>;\r\n public readonly schemaItemPathDifferences: Array<AnySchemaItemPathDifference>;\r\n public readonly customAttributeDifferences: Array<CustomAttributeDifference>;\r\n\r\n constructor() {\r\n this.schemaDifferences = [];\r\n this.schemaItemDifferences = [];\r\n this.schemaItemPathDifferences = [];\r\n this.customAttributeDifferences = [];\r\n }\r\n\r\n /**\r\n * Visitor function to process the schema change diagnostic object.\r\n * @internal\r\n */\r\n public visit(diagnostic: AnyDiagnostic) {\r\n switch (diagnostic.code) {\r\n case SchemaCompareCodes.SchemaDelta:\r\n return this.visitChangedSchemaProperties(diagnostic);\r\n\r\n case SchemaCompareCodes.SchemaReferenceMissing:\r\n return this.visitSchemaReference(diagnostic, \"add\");\r\n case SchemaCompareCodes.SchemaReferenceDelta:\r\n return this.visitSchemaReference(diagnostic, \"modify\");\r\n\r\n case SchemaCompareCodes.SchemaItemMissing:\r\n return this.visitMissingSchemaItem(diagnostic);\r\n\r\n case SchemaCompareCodes.SchemaItemDelta:\r\n case SchemaCompareCodes.ClassDelta:\r\n case SchemaCompareCodes.ConstantDelta:\r\n case SchemaCompareCodes.CustomAttributeClassDelta:\r\n case SchemaCompareCodes.FormatDelta:\r\n case SchemaCompareCodes.InvertedUnitDelta:\r\n case SchemaCompareCodes.KoqDelta:\r\n case SchemaCompareCodes.MixinDelta:\r\n case SchemaCompareCodes.PhenomenonDelta:\r\n case SchemaCompareCodes.PropertyCategoryDelta:\r\n case SchemaCompareCodes.RelationshipDelta:\r\n case SchemaCompareCodes.UnitDelta:\r\n case SchemaCompareCodes.EnumerationDelta:\r\n return this.visitChangedSchemaItem(diagnostic);\r\n\r\n case SchemaCompareCodes.EnumeratorDelta:\r\n return this.visitChangedEnumerator(diagnostic);\r\n case SchemaCompareCodes.EnumeratorMissing:\r\n return this.visitMissingEnumerator(diagnostic);\r\n\r\n case SchemaCompareCodes.BaseClassDelta:\r\n return this.visitMissingBaseClass(diagnostic);\r\n case SchemaCompareCodes.EntityMixinMissing:\r\n return this.visitMissingMixinOnClass(diagnostic);\r\n case SchemaCompareCodes.PropertyDelta:\r\n return this.visitChangedProperty(diagnostic);\r\n case SchemaCompareCodes.PropertyMissing:\r\n return this.visitMissingProperty(diagnostic);\r\n\r\n case SchemaCompareCodes.RelationshipConstraintClassMissing:\r\n return this.visitMissingRelationshipConstraintClass(diagnostic);\r\n case SchemaCompareCodes.RelationshipConstraintDelta:\r\n return this.visitChangedRelationshipConstraint(diagnostic);\r\n\r\n case SchemaCompareCodes.CustomAttributeInstanceClassMissing:\r\n return this.visitMissingCustomAttributeInstance(diagnostic);\r\n\r\n case SchemaCompareCodes.PresentationUnitMissing:\r\n return this.visitMissingPresentationUnit(diagnostic);\r\n\r\n case SchemaCompareCodes.FormatUnitMissing:\r\n return this.visitMissingFormatUnit(diagnostic);\r\n case SchemaCompareCodes.UnitLabelOverrideDelta:\r\n return this.visitChangedFormatUnitLabel(diagnostic);\r\n }\r\n return;\r\n }\r\n\r\n private visitChangedSchemaProperties(diagnostic: AnyDiagnostic) {\r\n let modifyEntry = this.schemaDifferences.find((entry): entry is SchemaDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Schema;\r\n });\r\n\r\n let hasChanges = false;\r\n let addEntry = false;\r\n if (modifyEntry === undefined) {\r\n addEntry = true;\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.Schema,\r\n difference: {},\r\n };\r\n }\r\n\r\n // Only label and description are taken from the source schema. If the schema name or alias\r\n // differs, those are ignored for now.\r\n const [propertyName, propertyValue] = diagnostic.messageArgs as [string, any];\r\n if (propertyName === \"label\") {\r\n modifyEntry.difference.label = propertyValue;\r\n hasChanges = true;\r\n }\r\n if (propertyName === \"description\") {\r\n modifyEntry.difference.description = propertyValue;\r\n hasChanges = true;\r\n }\r\n\r\n if (addEntry && hasChanges) {\r\n this.schemaDifferences.push(modifyEntry);\r\n }\r\n }\r\n\r\n private visitMissingSchemaItem(diagnostic: AnyDiagnostic) {\r\n const schemaItem = diagnostic.ecDefinition as AnySchemaItem;\r\n\r\n this.schemaItemDifferences.push({\r\n changeType: \"add\",\r\n schemaType: schemaItem.schemaItemType,\r\n itemName: schemaItem.name,\r\n difference: schemaItem.toJSON(),\r\n });\r\n }\r\n\r\n private visitChangedSchemaItem(diagnostic: AnyDiagnostic) {\r\n const schemaItem = diagnostic.ecDefinition as AnySchemaItem;\r\n const [propertyName, sourceValue, _targetValue] = diagnostic.messageArgs as [string, unknown, unknown];\r\n if (propertyName === \"schemaItemType\") {\r\n // If the schema item type is different, the whole item is added as \"new\" item. The\r\n // difference validator will then figure whether there is a conflict with items of\r\n // of the same name.\r\n return this.visitMissingSchemaItem(diagnostic);\r\n }\r\n\r\n if (sourceValue === undefined) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is AnySchemaItemDifference => {\r\n return entry.changeType === \"modify\" && entry.itemName === schemaItem.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: schemaItem.schemaItemType,\r\n itemName: schemaItem.name,\r\n difference: {},\r\n } as AnySchemaItemDifference;\r\n this.schemaItemDifferences.push(modifyEntry);\r\n }\r\n\r\n // TODO: Since propertyName is type of string, the compiler complains about accepting\r\n // an unspecific string as property indexer. Casted to any as short term fix but that\r\n // needs to be handled better in future.\r\n (modifyEntry.difference as any)[propertyName] = sourceValue;\r\n }\r\n\r\n private visitMissingEnumerator(diagnostic: AnyDiagnostic) {\r\n const enumeration = diagnostic.ecDefinition as Enumeration;\r\n const [enumerator] = diagnostic.messageArgs as [AnyEnumerator];\r\n this.schemaItemPathDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.Enumerator,\r\n itemName: enumeration.name,\r\n path: \"$enumerators\",\r\n difference: enumerator,\r\n });\r\n }\r\n\r\n private lookupEnumeratorEntry(changeType: DifferenceType, item: string, enumeratorName: string) {\r\n return this.schemaItemPathDifferences.find((change) => {\r\n return change.changeType === changeType\r\n && change.schemaType === SchemaOtherTypes.Enumerator\r\n && change.itemName === item\r\n && change.path === \"$enumerators\"\r\n && change.difference.name === enumeratorName;\r\n });\r\n }\r\n\r\n private visitChangedEnumerator(diagnostic: AnyDiagnostic) {\r\n const enumeration = diagnostic.ecDefinition as Enumeration;\r\n const [enumerator, propertyName, sourceValue] = diagnostic.messageArgs as [AnyEnumerator, keyof AnyEnumerator, any];\r\n if (this.lookupEnumeratorEntry(\"add\", enumeration.name, enumerator.name)) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is EnumeratorDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Enumerator && entry.itemName === enumeration.name && entry.path === enumerator.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.Enumerator,\r\n itemName: enumeration.name,\r\n path: enumerator.name,\r\n difference: {},\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n if (sourceValue !== undefined) {\r\n modifyEntry.difference[propertyName] = sourceValue;\r\n }\r\n }\r\n\r\n private visitMissingProperty(diagnostic: AnyDiagnostic) {\r\n const property = diagnostic.ecDefinition as Property;\r\n this.schemaItemPathDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.Property,\r\n itemName: property.class.name,\r\n path: property.name,\r\n difference: property.toJSON() as AnyPropertyProps,\r\n });\r\n }\r\n\r\n private visitChangedProperty(diagnostic: AnyDiagnostic) {\r\n const property = diagnostic.ecDefinition as Property;\r\n const [propertyName, sourceValue] = diagnostic.messageArgs as [keyof PropertyProps, any, any];\r\n\r\n if (isPropertyTypeName(property, propertyName)) {\r\n return this.visitMissingProperty(diagnostic);\r\n }\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is ClassPropertyDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Property && entry.itemName === property.class.name && entry.path === property.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.Property,\r\n itemName: property.class.name,\r\n path: property.name,\r\n difference: {},\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n if (propertyName !== \"name\") {\r\n modifyEntry.difference[propertyName] = sourceValue;\r\n }\r\n }\r\n\r\n private visitMissingBaseClass(diagnostic: AnyDiagnostic) {\r\n const ecClass = diagnostic.ecDefinition as ECClass;\r\n const [sourceBaseClass] = diagnostic.messageArgs as [ECClass, ECClass];\r\n\r\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is AnyClassItemDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === ecClass.schemaItemType && entry.itemName === ecClass.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: ecClass.schemaItemType,\r\n itemName: ecClass.name,\r\n difference: {},\r\n } as AnyClassItemDifference;\r\n this.schemaItemDifferences.push(modifyEntry);\r\n }\r\n\r\n modifyEntry.difference.baseClass = sourceBaseClass !== undefined ? sourceBaseClass.fullName : undefined;\r\n }\r\n\r\n private visitMissingMixinOnClass(diagnostic: AnyDiagnostic) {\r\n const ecClass = diagnostic.ecDefinition as ECClass;\r\n const [mixin] = diagnostic.messageArgs as [Mixin];\r\n\r\n let addEntry = this.schemaItemDifferences.find((entry): entry is EntityClassMixinDifference => {\r\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.EntityClassMixin && entry.itemName === ecClass.name;\r\n });\r\n\r\n if (addEntry === undefined) {\r\n addEntry = {\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.EntityClassMixin,\r\n itemName: ecClass.name,\r\n difference: [],\r\n };\r\n this.schemaItemDifferences.push(addEntry);\r\n }\r\n addEntry.difference.push(mixin.fullName);\r\n }\r\n\r\n private visitMissingRelationshipConstraintClass(diagnostic: AnyDiagnostic) {\r\n const constraint = diagnostic.ecDefinition as RelationshipConstraint;\r\n const className = constraint.relationshipClass.name;\r\n const constraintPath = constraint.isSource ? \"$source\" : \"$target\";\r\n\r\n let addEntry = this.schemaItemPathDifferences.find((entry): entry is RelationshipConstraintClassDifference => {\r\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.RelationshipConstraintClass, entry.itemName === className && entry.path === constraintPath;\r\n });\r\n\r\n if (!addEntry) {\r\n addEntry = {\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.RelationshipConstraintClass,\r\n itemName: className,\r\n path: constraintPath,\r\n difference: [],\r\n };\r\n this.schemaItemPathDifferences.push(addEntry);\r\n }\r\n\r\n const [constraintClass] = diagnostic.messageArgs as [ECClass];\r\n addEntry.difference.push(constraintClass.fullName);\r\n }\r\n\r\n private visitChangedRelationshipConstraint(diagnostic: AnyDiagnostic) {\r\n const constraint = diagnostic.ecDefinition as RelationshipConstraint;\r\n const className = constraint.relationshipClass.name;\r\n const constraintPath = constraint.isSource ? \"$source\" : \"$target\";\r\n if (this.schemaItemDifferences.find((entry) => entry.changeType === \"add\" && entry.itemName === className)) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is RelationshipConstraintDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.RelationshipConstraint && entry.itemName === className && entry.path === constraintPath;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.RelationshipConstraint,\r\n itemName: className,\r\n path: constraintPath,\r\n difference: {},\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n const [propertyName, propertyValue] = diagnostic.messageArgs as [keyof RelationshipConstraintProps, any];\r\n if (propertyName === \"abstractConstraint\" && propertyValue !== undefined) {\r\n modifyEntry.difference.abstractConstraint = propertyValue;\r\n }\r\n if (propertyName === \"multiplicity\" && propertyValue !== undefined) {\r\n modifyEntry.difference.multiplicity = propertyValue;\r\n }\r\n if (propertyName === \"polymorphic\" && propertyValue !== undefined) {\r\n modifyEntry.difference.polymorphic = propertyValue;\r\n }\r\n if (propertyName === \"roleLabel\" && propertyValue !== undefined) {\r\n modifyEntry.difference.roleLabel = propertyValue;\r\n }\r\n }\r\n\r\n private visitSchemaReference(diagnostic: AnyDiagnostic, changeType: DifferenceType) {\r\n const [referencedSchema] = diagnostic.messageArgs as [Schema];\r\n this.schemaDifferences.push({\r\n changeType,\r\n schemaType: SchemaOtherTypes.SchemaReference,\r\n difference: {\r\n name: referencedSchema.name,\r\n version: referencedSchema.schemaKey.version.toString(),\r\n },\r\n });\r\n }\r\n\r\n private visitMissingCustomAttributeInstance(diagnostic: AnyDiagnostic) {\r\n const [customAttribute] = diagnostic.messageArgs as [CustomAttribute];\r\n const ecType = diagnostic.ecDefinition;\r\n if (Schema.isSchema(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"Schema\",\r\n difference: customAttribute,\r\n });\r\n }\r\n\r\n if (SchemaItem.isSchemaItem(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"SchemaItem\",\r\n itemName: ecType.name,\r\n difference: customAttribute,\r\n });\r\n }\r\n\r\n if (Property.isProperty(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"Property\",\r\n itemName: ecType.class.name,\r\n path: ecType.name,\r\n difference: customAttribute,\r\n });\r\n }\r\n\r\n if (RelationshipConstraint.isRelationshipConstraint(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"RelationshipConstraint\",\r\n itemName: ecType.relationshipClass.name,\r\n path: ecType.isSource ? \"$source\" : \"$target\",\r\n difference: customAttribute,\r\n });\r\n }\r\n return;\r\n }\r\n\r\n private visitMissingPresentationUnit(diagnostic: AnyDiagnostic) {\r\n const koq = diagnostic.ecDefinition as KindOfQuantity;\r\n const [presentationFormat] = diagnostic.messageArgs as [Format | OverrideFormat];\r\n\r\n let addEntry = this.schemaItemDifferences.find((entry): entry is KindOfQuantityPresentationFormatDifference => {\r\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.KindOfQuantityPresentationFormat\r\n && entry.itemName === koq.name;\r\n });\r\n\r\n if (addEntry === undefined) {\r\n addEntry = {\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.KindOfQuantityPresentationFormat,\r\n itemName: koq.name,\r\n difference: [],\r\n };\r\n this.schemaItemDifferences.push(addEntry);\r\n }\r\n addEntry.difference.push(presentationFormat.fullName);\r\n }\r\n\r\n private visitMissingFormatUnit(diagnostic: AnyDiagnostic) {\r\n const format = diagnostic.ecDefinition as Format;\r\n\r\n for (let index = this.schemaItemPathDifferences.length-1; index>=0; index--) {\r\n const entry = this.schemaItemPathDifferences[index];\r\n if (entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.FormatUnitLabel && entry.itemName === format.name) {\r\n this.schemaItemPathDifferences.splice(index, 1);\r\n }\r\n }\r\n\r\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is FormatUnitDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.FormatUnit\r\n && entry.itemName === format.name;\r\n });\r\n\r\n if (modifyEntry === undefined && format.units) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.FormatUnit,\r\n itemName: format.name,\r\n difference: [],\r\n };\r\n\r\n for (const [unit, label] of format.units) {\r\n modifyEntry.difference.push({\r\n name: unit.fullName,\r\n label,\r\n });\r\n };\r\n\r\n this.schemaItemDifferences.push(modifyEntry);\r\n }\r\n }\r\n\r\n private visitChangedFormatUnitLabel(diagnostic: AnyDiagnostic) {\r\n const format = diagnostic.ecDefinition as Format;\r\n\r\n if (this.schemaItemDifferences.find((entry): entry is FormatUnitDifference => { return entry.changeType === \"modify\"\r\n && entry.schemaType === SchemaOtherTypes.FormatUnit && entry.itemName === format.name})) {\r\n return;\r\n }\r\n\r\n const [unit, label] = diagnostic.messageArgs as [Unit | InvertedUnit, string | undefined];\r\n this.schemaItemPathDifferences.push({\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.FormatUnitLabel,\r\n itemName: format.name,\r\n path: unit.fullName,\r\n difference: {\r\n label,\r\n },\r\n });\r\n };\r\n};\r\n\r\nfunction isPropertyTypeName(property: Property, propertyName: string) {\r\n return (propertyName === \"type\") ||\r\n (property.isEnumeration() && propertyName === \"enumeration\") ||\r\n (property.isPrimitive() && propertyName === \"primitiveType\") ||\r\n (property.isStruct() && propertyName === \"structClass\") ||\r\n (property.isNavigation() && propertyName === \"relationshipClass\");\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaDiagnosticVisitor.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDiagnosticVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,qFAA4E;AAC5E,gEAIkC;AAClC,yDAgB4B;AAE5B;;;;;GAKG;AACH,MAAa,uBAAuB;IAElB,iBAAiB,CAAsD;IACvE,qBAAqB,CAGX;IACV,yBAAyB,CAAqC;IAC9D,0BAA0B,CAAmC;IAE7E;QACE,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,yBAAyB,GAAG,EAAE,CAAC;QACpC,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC;IACvC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,UAAyB;QACpC,QAAQ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AAK,mCAAgB,CAAC,UAAU,IAAI,KAAK,CAAC,QAAQ,KAAK,MAAM,CAAC,IAAI,CAAA;QAAA,CAAC,CAAC,EAAE,CAAC;YAC5F,OAAO;QACT,CAAC;QAED,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,UAAU,CAAC,WAAwD,CAAC;QAC1F,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC;YAClC,UAAU,EAAE,QAAQ;YACpB,UAAU,EAAE,mCAAgB,CAAC,eAAe;YAC5C,QAAQ,EAAE,MAAM,CAAC,IAAI;YACrB,IAAI,EAAE,IAAI,CAAC,QAAQ;YACnB,UAAU,EAAE;gBACV,KAAK;aACN;SACF,CAAC,CAAC;IACL,CAAC;IAAA,CAAC;CACH;AAneD,0DAmeC;AAAA,CAAC;AAEF,SAAS,kBAAkB,CAAC,QAAkB,EAAE,YAAoB;IAClE,OAAO,CAAC,YAAY,KAAK,MAAM,CAAC;QAC9B,CAAC,QAAQ,CAAC,aAAa,EAAE,IAAI,YAAY,KAAK,aAAa,CAAC;QAC5D,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,YAAY,KAAK,eAAe,CAAC;QAC5D,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,YAAY,KAAK,aAAa,CAAC;QACvD,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,YAAY,KAAK,mBAAmB,CAAC,CAAC;AACtE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Differencing\n */\n\nimport type { AnyDiagnostic } from \"../Validation/Diagnostic\";\nimport { SchemaCompareCodes } from \"../Validation/SchemaCompareDiagnostics\";\nimport {\n AnyEnumerator, AnyPropertyProps, AnySchemaItem, CustomAttribute, ECClass,\n Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, OverrideFormat, Property, PropertyProps,\n RelationshipConstraint, RelationshipConstraintProps, Schema, SchemaItem, Unit,\n} from \"@itwin/ecschema-metadata\";\nimport {\n type AnyClassItemDifference,\n type AnySchemaItemDifference,\n type AnySchemaItemPathDifference,\n type ClassPropertyDifference,\n type CustomAttributeDifference,\n type DifferenceType,\n type EntityClassMixinDifference,\n type EnumeratorDifference,\n type FormatUnitDifference,\n type KindOfQuantityPresentationFormatDifference,\n type RelationshipConstraintClassDifference,\n type RelationshipConstraintDifference,\n type SchemaDifference,\n SchemaOtherTypes,\n type SchemaReferenceDifference,\n} from \"./SchemaDifference\";\n\n/**\n * The SchemaDiagnosticVisitor is a visitor implementation for diagnostic entries\n * from the schema comparer api. Depending on the diagnostic code, the difference\n * result is build together.\n * @internal\n */\nexport class SchemaDiagnosticVisitor {\n\n public readonly schemaDifferences: Array<SchemaDifference | SchemaReferenceDifference>;\n public readonly schemaItemDifferences: Array<AnySchemaItemDifference\n | EntityClassMixinDifference\n | KindOfQuantityPresentationFormatDifference\n | FormatUnitDifference>;\n public readonly schemaItemPathDifferences: Array<AnySchemaItemPathDifference>;\n public readonly customAttributeDifferences: Array<CustomAttributeDifference>;\n\n constructor() {\n this.schemaDifferences = [];\n this.schemaItemDifferences = [];\n this.schemaItemPathDifferences = [];\n this.customAttributeDifferences = [];\n }\n\n /**\n * Visitor function to process the schema change diagnostic object.\n * @internal\n */\n public visit(diagnostic: AnyDiagnostic) {\n switch (diagnostic.code) {\n case SchemaCompareCodes.SchemaDelta:\n return this.visitChangedSchemaProperties(diagnostic);\n\n case SchemaCompareCodes.SchemaReferenceMissing:\n return this.visitSchemaReference(diagnostic, \"add\");\n case SchemaCompareCodes.SchemaReferenceDelta:\n return this.visitSchemaReference(diagnostic, \"modify\");\n\n case SchemaCompareCodes.SchemaItemMissing:\n return this.visitMissingSchemaItem(diagnostic);\n\n case SchemaCompareCodes.SchemaItemDelta:\n case SchemaCompareCodes.ClassDelta:\n case SchemaCompareCodes.ConstantDelta:\n case SchemaCompareCodes.CustomAttributeClassDelta:\n case SchemaCompareCodes.FormatDelta:\n case SchemaCompareCodes.InvertedUnitDelta:\n case SchemaCompareCodes.KoqDelta:\n case SchemaCompareCodes.MixinDelta:\n case SchemaCompareCodes.PhenomenonDelta:\n case SchemaCompareCodes.PropertyCategoryDelta:\n case SchemaCompareCodes.RelationshipDelta:\n case SchemaCompareCodes.UnitDelta:\n case SchemaCompareCodes.EnumerationDelta:\n return this.visitChangedSchemaItem(diagnostic);\n\n case SchemaCompareCodes.EnumeratorDelta:\n return this.visitChangedEnumerator(diagnostic);\n case SchemaCompareCodes.EnumeratorMissing:\n return this.visitMissingEnumerator(diagnostic);\n\n case SchemaCompareCodes.BaseClassDelta:\n return this.visitMissingBaseClass(diagnostic);\n case SchemaCompareCodes.EntityMixinMissing:\n return this.visitMissingMixinOnClass(diagnostic);\n case SchemaCompareCodes.PropertyDelta:\n return this.visitChangedProperty(diagnostic);\n case SchemaCompareCodes.PropertyMissing:\n return this.visitMissingProperty(diagnostic);\n\n case SchemaCompareCodes.RelationshipConstraintClassMissing:\n return this.visitMissingRelationshipConstraintClass(diagnostic);\n case SchemaCompareCodes.RelationshipConstraintDelta:\n return this.visitChangedRelationshipConstraint(diagnostic);\n\n case SchemaCompareCodes.CustomAttributeInstanceClassMissing:\n return this.visitMissingCustomAttributeInstance(diagnostic);\n\n case SchemaCompareCodes.PresentationUnitMissing:\n return this.visitMissingPresentationUnit(diagnostic);\n\n case SchemaCompareCodes.FormatUnitMissing:\n return this.visitMissingFormatUnit(diagnostic);\n case SchemaCompareCodes.UnitLabelOverrideDelta:\n return this.visitChangedFormatUnitLabel(diagnostic);\n }\n return;\n }\n\n private visitChangedSchemaProperties(diagnostic: AnyDiagnostic) {\n let modifyEntry = this.schemaDifferences.find((entry): entry is SchemaDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Schema;\n });\n\n let hasChanges = false;\n let addEntry = false;\n if (modifyEntry === undefined) {\n addEntry = true;\n modifyEntry = {\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.Schema,\n difference: {},\n };\n }\n\n // Only label and description are taken from the source schema. If the schema name or alias\n // differs, those are ignored for now.\n const [propertyName, propertyValue] = diagnostic.messageArgs as [string, any];\n if (propertyName === \"label\") {\n modifyEntry.difference.label = propertyValue;\n hasChanges = true;\n }\n if (propertyName === \"description\") {\n modifyEntry.difference.description = propertyValue;\n hasChanges = true;\n }\n\n if (addEntry && hasChanges) {\n this.schemaDifferences.push(modifyEntry);\n }\n }\n\n private visitMissingSchemaItem(diagnostic: AnyDiagnostic) {\n const schemaItem = diagnostic.ecDefinition as AnySchemaItem;\n\n this.schemaItemDifferences.push({\n changeType: \"add\",\n schemaType: schemaItem.schemaItemType,\n itemName: schemaItem.name,\n difference: schemaItem.toJSON(),\n });\n }\n\n private visitChangedSchemaItem(diagnostic: AnyDiagnostic) {\n const schemaItem = diagnostic.ecDefinition as AnySchemaItem;\n const [propertyName, sourceValue, _targetValue] = diagnostic.messageArgs as [string, unknown, unknown];\n if (propertyName === \"schemaItemType\") {\n // If the schema item type is different, the whole item is added as \"new\" item. The\n // difference validator will then figure whether there is a conflict with items of\n // of the same name.\n return this.visitMissingSchemaItem(diagnostic);\n }\n\n if (sourceValue === undefined) {\n return;\n }\n\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is AnySchemaItemDifference => {\n return entry.changeType === \"modify\" && entry.itemName === schemaItem.name;\n });\n\n if (modifyEntry === undefined) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: schemaItem.schemaItemType,\n itemName: schemaItem.name,\n difference: {},\n } as AnySchemaItemDifference;\n this.schemaItemDifferences.push(modifyEntry);\n }\n\n // TODO: Since propertyName is type of string, the compiler complains about accepting\n // an unspecific string as property indexer. Casted to any as short term fix but that\n // needs to be handled better in future.\n (modifyEntry.difference as any)[propertyName] = sourceValue;\n }\n\n private visitMissingEnumerator(diagnostic: AnyDiagnostic) {\n const enumeration = diagnostic.ecDefinition as Enumeration;\n const [enumerator] = diagnostic.messageArgs as [AnyEnumerator];\n this.schemaItemPathDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.Enumerator,\n itemName: enumeration.name,\n path: \"$enumerators\",\n difference: enumerator,\n });\n }\n\n private lookupEnumeratorEntry(changeType: DifferenceType, item: string, enumeratorName: string) {\n return this.schemaItemPathDifferences.find((change) => {\n return change.changeType === changeType\n && change.schemaType === SchemaOtherTypes.Enumerator\n && change.itemName === item\n && change.path === \"$enumerators\"\n && change.difference.name === enumeratorName;\n });\n }\n\n private visitChangedEnumerator(diagnostic: AnyDiagnostic) {\n const enumeration = diagnostic.ecDefinition as Enumeration;\n const [enumerator, propertyName, sourceValue] = diagnostic.messageArgs as [AnyEnumerator, keyof AnyEnumerator, any];\n if (this.lookupEnumeratorEntry(\"add\", enumeration.name, enumerator.name)) {\n return;\n }\n\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is EnumeratorDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Enumerator && entry.itemName === enumeration.name && entry.path === enumerator.name;\n });\n\n if (modifyEntry === undefined) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.Enumerator,\n itemName: enumeration.name,\n path: enumerator.name,\n difference: {},\n };\n this.schemaItemPathDifferences.push(modifyEntry);\n }\n\n if (sourceValue !== undefined) {\n modifyEntry.difference[propertyName] = sourceValue;\n }\n }\n\n private visitMissingProperty(diagnostic: AnyDiagnostic) {\n const property = diagnostic.ecDefinition as Property;\n this.schemaItemPathDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.Property,\n itemName: property.class.name,\n path: property.name,\n difference: property.toJSON() as AnyPropertyProps,\n });\n }\n\n private visitChangedProperty(diagnostic: AnyDiagnostic) {\n const property = diagnostic.ecDefinition as Property;\n const [propertyName, sourceValue] = diagnostic.messageArgs as [keyof PropertyProps, any, any];\n\n if (isPropertyTypeName(property, propertyName)) {\n return this.visitMissingProperty(diagnostic);\n }\n\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is ClassPropertyDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Property && entry.itemName === property.class.name && entry.path === property.name;\n });\n\n if (modifyEntry === undefined) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.Property,\n itemName: property.class.name,\n path: property.name,\n difference: {},\n };\n this.schemaItemPathDifferences.push(modifyEntry);\n }\n\n if (propertyName !== \"name\") {\n modifyEntry.difference[propertyName] = sourceValue;\n }\n }\n\n private visitMissingBaseClass(diagnostic: AnyDiagnostic) {\n const ecClass = diagnostic.ecDefinition as ECClass;\n const [sourceBaseClass] = diagnostic.messageArgs as [ECClass, ECClass];\n\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is AnyClassItemDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === ecClass.schemaItemType && entry.itemName === ecClass.name;\n });\n\n if (modifyEntry === undefined) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: ecClass.schemaItemType,\n itemName: ecClass.name,\n difference: {},\n } as AnyClassItemDifference;\n this.schemaItemDifferences.push(modifyEntry);\n }\n\n modifyEntry.difference.baseClass = sourceBaseClass !== undefined ? sourceBaseClass.fullName : undefined;\n }\n\n private visitMissingMixinOnClass(diagnostic: AnyDiagnostic) {\n const ecClass = diagnostic.ecDefinition as ECClass;\n const [mixin] = diagnostic.messageArgs as [Mixin];\n\n let addEntry = this.schemaItemDifferences.find((entry): entry is EntityClassMixinDifference => {\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.EntityClassMixin && entry.itemName === ecClass.name;\n });\n\n if (addEntry === undefined) {\n addEntry = {\n changeType: \"add\",\n schemaType: SchemaOtherTypes.EntityClassMixin,\n itemName: ecClass.name,\n difference: [],\n };\n this.schemaItemDifferences.push(addEntry);\n }\n addEntry.difference.push(mixin.fullName);\n }\n\n private visitMissingRelationshipConstraintClass(diagnostic: AnyDiagnostic) {\n const constraint = diagnostic.ecDefinition as RelationshipConstraint;\n const className = constraint.relationshipClass.name;\n const constraintPath = constraint.isSource ? \"$source\" : \"$target\";\n\n let addEntry = this.schemaItemPathDifferences.find((entry): entry is RelationshipConstraintClassDifference => {\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.RelationshipConstraintClass, entry.itemName === className && entry.path === constraintPath;\n });\n\n if (!addEntry) {\n addEntry = {\n changeType: \"add\",\n schemaType: SchemaOtherTypes.RelationshipConstraintClass,\n itemName: className,\n path: constraintPath,\n difference: [],\n };\n this.schemaItemPathDifferences.push(addEntry);\n }\n\n const [constraintClass] = diagnostic.messageArgs as [ECClass];\n addEntry.difference.push(constraintClass.fullName);\n }\n\n private visitChangedRelationshipConstraint(diagnostic: AnyDiagnostic) {\n const constraint = diagnostic.ecDefinition as RelationshipConstraint;\n const className = constraint.relationshipClass.name;\n const constraintPath = constraint.isSource ? \"$source\" : \"$target\";\n if (this.schemaItemDifferences.find((entry) => entry.changeType === \"add\" && entry.itemName === className)) {\n return;\n }\n\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is RelationshipConstraintDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.RelationshipConstraint && entry.itemName === className && entry.path === constraintPath;\n });\n\n if (modifyEntry === undefined) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.RelationshipConstraint,\n itemName: className,\n path: constraintPath,\n difference: {},\n };\n this.schemaItemPathDifferences.push(modifyEntry);\n }\n\n const [propertyName, propertyValue] = diagnostic.messageArgs as [keyof RelationshipConstraintProps, any];\n if (propertyName === \"abstractConstraint\" && propertyValue !== undefined) {\n modifyEntry.difference.abstractConstraint = propertyValue;\n }\n if (propertyName === \"multiplicity\" && propertyValue !== undefined) {\n modifyEntry.difference.multiplicity = propertyValue;\n }\n if (propertyName === \"polymorphic\" && propertyValue !== undefined) {\n modifyEntry.difference.polymorphic = propertyValue;\n }\n if (propertyName === \"roleLabel\" && propertyValue !== undefined) {\n modifyEntry.difference.roleLabel = propertyValue;\n }\n }\n\n private visitSchemaReference(diagnostic: AnyDiagnostic, changeType: DifferenceType) {\n const [referencedSchema] = diagnostic.messageArgs as [Schema];\n this.schemaDifferences.push({\n changeType,\n schemaType: SchemaOtherTypes.SchemaReference,\n difference: {\n name: referencedSchema.name,\n version: referencedSchema.schemaKey.version.toString(),\n },\n });\n }\n\n private visitMissingCustomAttributeInstance(diagnostic: AnyDiagnostic) {\n const [customAttribute] = diagnostic.messageArgs as [CustomAttribute];\n const ecType = diagnostic.ecDefinition;\n if (Schema.isSchema(ecType)) {\n return this.customAttributeDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\n appliedTo: \"Schema\",\n difference: customAttribute,\n });\n }\n\n if (SchemaItem.isSchemaItem(ecType)) {\n return this.customAttributeDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\n appliedTo: \"SchemaItem\",\n itemName: ecType.name,\n difference: customAttribute,\n });\n }\n\n if (Property.isProperty(ecType)) {\n return this.customAttributeDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\n appliedTo: \"Property\",\n itemName: ecType.class.name,\n path: ecType.name,\n difference: customAttribute,\n });\n }\n\n if (RelationshipConstraint.isRelationshipConstraint(ecType)) {\n return this.customAttributeDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\n appliedTo: \"RelationshipConstraint\",\n itemName: ecType.relationshipClass.name,\n path: ecType.isSource ? \"$source\" : \"$target\",\n difference: customAttribute,\n });\n }\n return;\n }\n\n private visitMissingPresentationUnit(diagnostic: AnyDiagnostic) {\n const koq = diagnostic.ecDefinition as KindOfQuantity;\n const [presentationFormat] = diagnostic.messageArgs as [Format | OverrideFormat];\n\n let addEntry = this.schemaItemDifferences.find((entry): entry is KindOfQuantityPresentationFormatDifference => {\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.KindOfQuantityPresentationFormat\n && entry.itemName === koq.name;\n });\n\n if (addEntry === undefined) {\n addEntry = {\n changeType: \"add\",\n schemaType: SchemaOtherTypes.KindOfQuantityPresentationFormat,\n itemName: koq.name,\n difference: [],\n };\n this.schemaItemDifferences.push(addEntry);\n }\n addEntry.difference.push(presentationFormat.fullName);\n }\n\n private visitMissingFormatUnit(diagnostic: AnyDiagnostic) {\n const format = diagnostic.ecDefinition as Format;\n\n for (let index = this.schemaItemPathDifferences.length-1; index>=0; index--) {\n const entry = this.schemaItemPathDifferences[index];\n if (entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.FormatUnitLabel && entry.itemName === format.name) {\n this.schemaItemPathDifferences.splice(index, 1);\n }\n }\n\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is FormatUnitDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.FormatUnit\n && entry.itemName === format.name;\n });\n\n if (modifyEntry === undefined && format.units) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.FormatUnit,\n itemName: format.name,\n difference: [],\n };\n\n for (const [unit, label] of format.units) {\n modifyEntry.difference.push({\n name: unit.fullName,\n label,\n });\n };\n\n this.schemaItemDifferences.push(modifyEntry);\n }\n }\n\n private visitChangedFormatUnitLabel(diagnostic: AnyDiagnostic) {\n const format = diagnostic.ecDefinition as Format;\n\n if (this.schemaItemDifferences.find((entry): entry is FormatUnitDifference => { return entry.changeType === \"modify\"\n && entry.schemaType === SchemaOtherTypes.FormatUnit && entry.itemName === format.name})) {\n return;\n }\n\n const [unit, label] = diagnostic.messageArgs as [Unit | InvertedUnit, string | undefined];\n this.schemaItemPathDifferences.push({\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.FormatUnitLabel,\n itemName: format.name,\n path: unit.fullName,\n difference: {\n label,\n },\n });\n };\n};\n\nfunction isPropertyTypeName(property: Property, propertyName: string) {\n return (propertyName === \"type\") ||\n (property.isEnumeration() && propertyName === \"enumeration\") ||\n (property.isPrimitive() && propertyName === \"primitiveType\") ||\n (property.isStruct() && propertyName === \"structClass\") ||\n (property.isNavigation() && propertyName === \"relationshipClass\");\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaDifference.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifference.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAsbH,oDAmCC;AAtdD,8DAA8E;AAC9E,uEAAoE;AAEpE,iEAA8D;AAC9D,gEAIkC;AAClC,2EAAkE;AAElE,8DAAwE;AAsBxE;;;GAGG;AACH,IAAY,gBAYX;AAZD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,uDAAmC,CAAA;IACnC,yCAAqB,CAAA;IACrB,6CAAyB,CAAA;IACzB,uEAAmD,CAAA;IACnD,qEAAiD,CAAA;IACjD,+EAA2D,CAAA;IAC3D,yDAAqC,CAAA;IACrC,yFAAqE,CAAA;IACrE,6CAAyB,CAAA;IACzB,uDAAmC,CAAA;AACrC,CAAC,EAZW,gBAAgB,gCAAhB,gBAAgB,QAY3B;AA2XD;;;;;;GAMG;AACI,KAAK,UAAU,oBAAoB,CAAC,YAAoB,EAAE,YAAoB,EAAE,WAAsC;IAC3H,MAAM,cAAc,GAAG,IAAI,wBAAwB,EAAE,CAAC;IACtD,IAAG,WAAW,EAAE,CAAC;QACf,KAAI,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;YAC9B,IAAG,IAAI,CAAC,IAAI,KAAK,4BAAc,CAAC,gBAAgB,EAAE,CAAC;gBACjD,cAAc,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YACnE,CAAC;YACD,IAAG,IAAI,CAAC,IAAI,KAAK,4BAAc,CAAC,cAAc,EAAE,CAAC;gBAC/C,cAAc,CAAC,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,C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,GAAG,IAAI,yBAAW,EAAE,CAAC;IACxC,CAAC;IAEe,KAAK,CAAC,WAAW,CAAkC,IAAgB,EAAE,YAAoB,EAAE,eAAsB;QAC/H,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5D,OAAO,YAAY,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IACjE,CAAC;IAEe,KAAK,CAAC,eAAe,CAAC,SAAsB,EAAE,OAAgB;QAC5E,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,IAAI,yBAAW,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/G,OAAO,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,YAAY,CAAqC,CAAC;IAC3F,CAAC;IAEe,cAAc,CAAC,QAA+C,EAAE,QAA+C;QAC7H,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,8BAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACtC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC;YAC1B,CAAC;YACD,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QACxD,CAAC;QACD,OAAO,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAClD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Differencing\r\n */\r\n\r\nimport { AnySchemaDifferenceConflict } from \"./SchemaConflicts\";\r\nimport { AnySchemaEdits, SchemaEditType } from \"../Merging/Edits/SchemaEdits\";\r\nimport { SchemaDiagnosticVisitor } from \"./SchemaDiagnosticVisitor\";\r\nimport { SchemaChanges } from \"../Validation/SchemaChanges\";\r\nimport { SchemaComparer } from \"../Validation/SchemaComparer\";\r\nimport { AnyEnumerator, AnyProperty, AnyPropertyProps, ConstantProps, CustomAttribute,\r\n CustomAttributeClassProps, ECClass, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps,\r\n MixinProps, PhenomenonProps, PropertyCategoryProps, RelationshipClassProps, RelationshipConstraintProps,\r\n type Schema, SchemaItem, SchemaItemFormatProps, SchemaItemKey, SchemaItemProps, SchemaItemType, SchemaItemUnitProps, SchemaReferenceProps, StructClassProps, UnitSystemProps,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { validateDifferences } from \"./SchemaDifferenceValidator\";\r\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { NameMapping, PropertyKey } from \"../Merging/Edits/NameMapping\";\r\n\r\n/** Utility-Type to remove possible readonly flags on the given type. */\r\ntype PartialEditable<T> = {\r\n -readonly [P in keyof T]?: T[P];\r\n};\r\n\r\n/**\r\n * Utility-Type to simplify the expected SchemaItem props by omitting the base properties\r\n * that are not needed for the schema differencing. Also all properties are made mutable\r\n * by removing the readonly flag if present.\r\n */\r\ntype SchemaItemProperties<T extends SchemaItemProps> = {\r\n [P in keyof PartialEditable<Omit<T, keyof Omit<SchemaItemProps, \"label\" | \"description\" | \"customAttributes\">>>]: T[P]\r\n};\r\n\r\n/**\r\n * Defines the type of the difference operation.\r\n * @alpha\r\n */\r\nexport type DifferenceType = \"add\" | \"modify\";\r\n\r\n/**\r\n * Defines the SchemaTypes that are not SchemaItems.\r\n * @alpha\r\n */\r\nexport enum SchemaOtherTypes {\r\n Schema = \"Schema\",\r\n SchemaReference = \"SchemaReference\",\r\n Property = \"Property\",\r\n Enumerator = \"Enumerator\",\r\n CustomAttributeInstance = \"CustomAttributeInstance\",\r\n RelationshipConstraint = \"RelationshipConstraint\",\r\n RelationshipConstraintClass = \"RelationshipConstraintClass\",\r\n EntityClassMixin = \"EntityClassMixin\",\r\n KindOfQuantityPresentationFormat = \"KindOfQuantityPresentationFormat\",\r\n FormatUnit = \"FormatUnit\",\r\n FormatUnitLabel = \"FormatUnitLabel\",\r\n}\r\n\r\n/**\r\n * Defines the possible values SchemaTypes that can occur in SchemaDifferences or Conflicts.\r\n * @alpha\r\n */\r\nexport type SchemaType = SchemaOtherTypes | SchemaItemType;\r\n\r\n/**\r\n * Definition of the difference result between two Schemas.\r\n * @alpha\r\n */\r\nexport interface SchemaDifferenceResult {\r\n /** Full name of the source schema */\r\n readonly sourceSchemaName: string;\r\n /** Full name of the target schema */\r\n readonly targetSchemaName: string;\r\n\r\n /** List of differences between the compared schemas. */\r\n readonly differences: AnySchemaDifference[];\r\n\r\n /** List of conflicts found while comparing the schemas. */\r\n readonly conflicts?: AnySchemaDifferenceConflict[];\r\n}\r\n\r\n/**\r\n * Union of all supported schema differencing types.\r\n * @alpha\r\n */\r\nexport type AnySchemaDifference =\r\n SchemaDifference |\r\n SchemaReferenceDifference |\r\n AnySchemaItemDifference |\r\n AnySchemaItemPathDifference |\r\n EntityClassMixinDifference |\r\n CustomAttributeDifference |\r\n KindOfQuantityPresentationFormatDifference |\r\n FormatUnitDifference;\r\n\r\n/**\r\n * Differencing entry for changes on a Schema.\r\n * @alpha\r\n */\r\nexport interface SchemaDifference {\r\n readonly changeType: \"modify\";\r\n readonly schemaType: SchemaOtherTypes.Schema;\r\n readonly difference: {\r\n label?: string;\r\n description?: string;\r\n };\r\n}\r\n\r\n/**\r\n * Differencing entry for added or changed Schema References of a Schema.\r\n * @alpha\r\n */\r\nexport interface SchemaReferenceDifference {\r\n readonly changeType: \"add\" | \"modify\";\r\n readonly schemaType: SchemaOtherTypes.SchemaReference;\r\n readonly difference: SchemaReferenceProps;\r\n}\r\n\r\n/**\r\n * Union of all supported schema item differencing types.\r\n * @alpha\r\n */\r\nexport type AnySchemaItemDifference =\r\n AnyClassItemDifference |\r\n ConstantDifference |\r\n EnumerationDifference |\r\n FormatDifference |\r\n KindOfQuantityDifference |\r\n InvertedUnitDifference |\r\n PhenomenonDifference |\r\n PropertyCategoryDifference |\r\n UnitDifference |\r\n UnitSystemDifference;\r\n\r\n/**\r\n * Union for supported class Schema Items.\r\n * @alpha\r\n */\r\nexport type AnyClassItemDifference =\r\n EntityClassDifference |\r\n MixinClassDifference |\r\n StructClassDifference |\r\n CustomAttributeClassDifference |\r\n RelationshipClassDifference;\r\n\r\n/**\r\n * Union of all differences that have a path pointing inside a schema item.\r\n * @alpha\r\n */\r\nexport type AnySchemaItemPathDifference =\r\n RelationshipConstraintDifference |\r\n RelationshipConstraintClassDifference |\r\n CustomAttributePropertyDifference |\r\n EnumeratorDifference |\r\n ClassPropertyDifference |\r\n FormatUnitLabelDifference;\r\n\r\n/**\r\n * Internal base class for all Schema Item differencing entries.\r\n * @alpha\r\n */\r\ninterface SchemaItemDifference<T extends SchemaItemProps> {\r\n readonly changeType: \"add\" | \"modify\";\r\n readonly itemName: string;\r\n readonly difference: SchemaItemProperties<T>;\r\n}\r\n\r\n/**\r\n * Differencing entry for Constant Schema Items.\r\n * @alpha\r\n */\r\nexport interface ConstantDifference extends SchemaItemDifference<ConstantProps> {\r\n readonly schemaType: SchemaItemType.Constant;\r\n}\r\n\r\n/**\r\n * Differencing entry for Custom Attribute Class Schema Items.\r\n * @alpha\r\n */\r\nexport interface CustomAttributeClassDifference extends SchemaItemDifference<CustomAttributeClassProps> {\r\n readonly schemaType: SchemaItemType.CustomAttributeClass;\r\n}\r\n\r\n/**\r\n * Differencing entry for Entity Class Schema Items.\r\n * @alpha\r\n */\r\nexport interface EntityClassDifference extends SchemaItemDifference<EntityClassProps> {\r\n readonly schemaType: SchemaItemType.EntityClass;\r\n}\r\n\r\n/**\r\n * Differencing entry for Enumerator Schema Items.\r\n * @alpha\r\n */\r\nexport interface EnumerationDifference extends SchemaItemDifference<EnumerationProps> {\r\n readonly schemaType: SchemaItemType.Enumeration;\r\n}\r\n\r\n/**\r\n * Differencing entry for Kind-Of-Quantities Schema Items.\r\n * @alpha\r\n */\r\nexport interface KindOfQuantityDifference extends SchemaItemDifference<KindOfQuantityProps> {\r\n readonly schemaType: SchemaItemType.KindOfQuantity;\r\n}\r\n\r\n/**\r\n * Differencing entry for Mixin Class Schema Items.\r\n * @alpha\r\n */\r\nexport interface MixinClassDifference extends SchemaItemDifference<MixinProps> {\r\n readonly schemaType: SchemaItemType.Mixin;\r\n}\r\n\r\n/**\r\n * Differencing entry for Phenomenon Schema Items.\r\n * @alpha\r\n */\r\nexport interface PhenomenonDifference extends SchemaItemDifference<PhenomenonProps> {\r\n readonly schemaType: SchemaItemType.Phenomenon;\r\n}\r\n\r\n/**\r\n * Differencing entry for Property Category Schema Items.\r\n * @alpha\r\n */\r\nexport interface PropertyCategoryDifference extends SchemaItemDifference<PropertyCategoryProps> {\r\n readonly schemaType: SchemaItemType.PropertyCategory;\r\n}\r\n\r\n/**\r\n * Differencing entry for Relationship Class Schema Items.\r\n * @alpha\r\n */\r\nexport interface RelationshipClassDifference extends SchemaItemDifference<RelationshipClassProps> {\r\n readonly schemaType: SchemaItemType.RelationshipClass;\r\n}\r\n\r\n/**\r\n * Differencing entry for Struct Class Schema Items.\r\n * @alpha\r\n */\r\nexport interface StructClassDifference extends SchemaItemDifference<StructClassProps> {\r\n readonly schemaType: SchemaItemType.StructClass;\r\n}\r\n\r\n/**\r\n * Differencing entry for Unit System Schema Items.\r\n * @alpha\r\n */\r\nexport interface UnitSystemDifference extends SchemaItemDifference<UnitSystemProps> {\r\n readonly schemaType: SchemaItemType.UnitSystem;\r\n}\r\n\r\n/**\r\n * Differencing entry for Unit Schema Items.\r\n * @alpha\r\n */\r\nexport interface UnitDifference extends SchemaItemDifference<SchemaItemUnitProps> {\r\n readonly schemaType: SchemaItemType.Unit;\r\n}\r\n\r\n/**\r\n * Differencing entry for Inverted Unit Schema Items.\r\n * @alpha\r\n */\r\nexport interface InvertedUnitDifference extends SchemaItemDifference<InvertedUnitProps> {\r\n readonly schemaType: SchemaItemType.InvertedUnit;\r\n}\r\n/**\r\n * Differencing entry for Format Schema Items.\r\n * @alpha\r\n */\r\nexport interface FormatDifference extends SchemaItemDifference<SchemaItemFormatProps> {\r\n readonly schemaType: SchemaItemType.Format;\r\n}\r\n\r\n/**\r\n * Differencing entry for added or changed Properties.\r\n * @alpha\r\n */\r\nexport interface ClassPropertyDifference {\r\n readonly changeType: \"add\" | \"modify\";\r\n readonly schemaType: SchemaOtherTypes.Property;\r\n readonly itemName: string;\r\n readonly path: string;\r\n readonly difference: PartialEditable<AnyPropertyProps>;\r\n}\r\n\r\n/**\r\n * Union of supported Custom Attribute Differences.\r\n * @alpha\r\n */\r\nexport type CustomAttributeDifference =\r\n CustomAttributeSchemaDifference |\r\n CustomAttributeSchemaItemDifference |\r\n CustomAttributePropertyDifference |\r\n CustomAttributeRelationshipConstraintDifference;\r\n\r\n/**\r\n * Differencing entry for Custom Attributes on Schema.\r\n * @alpha\r\n */\r\nexport interface CustomAttributeSchemaDifference {\r\n readonly changeType: \"add\";\r\n readonly schemaType: SchemaOtherTypes.CustomAttributeInstance;\r\n readonly appliedTo: \"Schema\";\r\n readonly difference: PartialEditable<CustomAttribute>;\r\n}\r\n\r\n/**\r\n * Differencing entry for Custom Attributes on Schema Items.\r\n * @alpha\r\n */\r\nexport interface CustomAttributeSchemaItemDifference {\r\n readonly changeType: \"add\";\r\n readonly schemaType: SchemaOtherTypes.CustomAttributeInstance;\r\n readonly appliedTo: \"SchemaItem\";\r\n readonly itemName: string;\r\n readonly difference: PartialEditable<CustomAttribute>;\r\n}\r\n\r\n/**\r\n * Differencing entry for Custom Attributes on Properties.\r\n * @alpha\r\n */\r\nexport interface CustomAttributePropertyDifference {\r\n readonly changeType: \"add\";\r\n readonly schemaType: SchemaOtherTypes.CustomAttributeInstance;\r\n readonly appliedTo: \"Property\";\r\n readonly itemName: string;\r\n readonly path: string;\r\n readonly difference: PartialEditable<CustomAttribute>;\r\n}\r\n\r\n/**\r\n * Differencing entry for Custom Attributes on Relationship Constraints.\r\n * @alpha\r\n */\r\nexport interface CustomAttributeRelationshipConstraintDifference {\r\n readonly changeType: \"add\";\r\n readonly schemaType: SchemaOtherTypes.CustomAttributeInstance;\r\n readonly appliedTo: \"RelationshipConstraint\";\r\n readonly itemName: string;\r\n readonly path: \"$source\" | \"$target\";\r\n readonly difference: PartialEditable<CustomAttribute>;\r\n}\r\n\r\n/**\r\n * Differencing entry for changed mixins on EntityClasses.\r\n * @alpha\r\n */\r\nexport interface EntityClassMixinDifference {\r\n readonly changeType: \"add\";\r\n readonly schemaType: SchemaOtherTypes.EntityClassMixin;\r\n readonly itemName: string;\r\n readonly difference: string[];\r\n}\r\n\r\n/**\r\n * Differencing entry for changed Enumerators on Enumerable Schema Items.\r\n * @alpha\r\n */\r\nexport interface EnumeratorDifference {\r\n readonly changeType: \"add\" | \"modify\";\r\n readonly schemaType: SchemaOtherTypes.Enumerator;\r\n readonly itemName: string;\r\n readonly path: string;\r\n readonly difference: PartialEditable<AnyEnumerator>;\r\n}\r\n\r\n/**\r\n * Differencing entry for Relationship Constraints.\r\n * @alpha\r\n */\r\nexport interface RelationshipConstraintDifference {\r\n readonly changeType: \"modify\";\r\n readonly schemaType: SchemaOtherTypes.RelationshipConstraint;\r\n readonly itemName: string;\r\n readonly path: \"$source\" | \"$target\";\r\n readonly difference: PartialEditable<Omit<RelationshipConstraintProps, \"constraintClasses\">>;\r\n}\r\n\r\n/**\r\n * Differencing entry for constraint classes added to Relationship Constrains.\r\n * @alpha\r\n */\r\nexport interface RelationshipConstraintClassDifference {\r\n readonly changeType: \"add\";\r\n readonly schemaType: SchemaOtherTypes.RelationshipConstraintClass;\r\n readonly itemName: string;\r\n readonly path: \"$source\" | \"$target\";\r\n readonly difference: string[];\r\n}\r\n\r\n/**\r\n * Differencing entry for presentation formats added to KindOfQuantities.\r\n * @alpha\r\n */\r\nexport interface KindOfQuantityPresentationFormatDifference {\r\n readonly changeType: \"add\";\r\n readonly schemaType: SchemaOtherTypes.KindOfQuantityPresentationFormat;\r\n readonly itemName: string;\r\n readonly difference: string[];\r\n}\r\n\r\n/**\r\n * Differencing entry for changed Units on Formats.\r\n * @alpha\r\n */\r\nexport interface FormatUnitDifference {\r\n readonly changeType: \"modify\";\r\n readonly schemaType: SchemaOtherTypes.FormatUnit;\r\n readonly itemName: string;\r\n readonly difference: {\r\n name: string;\r\n label?: string;\r\n }[];\r\n}\r\n\r\n/**\r\n * Differencing entry for changed labels on Format Units.\r\n * @alpha\r\n */\r\nexport interface FormatUnitLabelDifference {\r\n readonly changeType: \"modify\";\r\n readonly schemaType: SchemaOtherTypes.FormatUnitLabel;\r\n readonly itemName: string;\r\n readonly path: string;\r\n readonly difference: {\r\n label?: string;\r\n };\r\n}\r\n\r\n/**\r\n * Creates a [[SchemaDifferenceResult]] for two given schemas.\r\n * @param targetSchema The schema the differences gets merged into.\r\n * @param sourceSchema The schema to get merged in the target.\r\n * @returns An [[SchemaDifferenceResult]] object.\r\n * @alpha\r\n */\r\nexport async function getSchemaDifferences(targetSchema: Schema, sourceSchema: Schema, schemaEdits?: Iterable<AnySchemaEdits>): Promise<SchemaDifferenceResult> {\r\n const schemaComparer = new DifferenceSchemaComparer();\r\n if(schemaEdits) {\r\n for(const edit of schemaEdits) {\r\n if(edit.type === SchemaEditType.RenameSchemaItem) {\r\n schemaComparer.nameMappings.addItemMapping(edit.key, edit.value);\r\n }\r\n if(edit.type === SchemaEditType.RenameProperty) {\r\n schemaComparer.nameMappings.addPropertyMapping(edit.key, edit.value);\r\n }\r\n }\r\n }\r\n\r\n await schemaComparer.compareSchemas(sourceSchema, targetSchema);\r\n\r\n const visitor = new SchemaDiagnosticVisitor();\r\n for (const diagnostic of schemaComparer.diagnostics) {\r\n visitor.visit(diagnostic);\r\n }\r\n\r\n const differences: AnySchemaDifference[] = [\r\n ...visitor.schemaDifferences,\r\n ...visitor.schemaItemDifferences,\r\n ...visitor.schemaItemPathDifferences,\r\n ...visitor.customAttributeDifferences,\r\n ];\r\n\r\n const conflicts = await validateDifferences(differences, targetSchema, sourceSchema, schemaComparer.nameMappings);\r\n\r\n return {\r\n sourceSchemaName: sourceSchema.schemaKey.toString(),\r\n targetSchemaName: targetSchema.schemaKey.toString(),\r\n conflicts: conflicts.length > 0 ? conflicts : undefined,\r\n differences,\r\n };\r\n}\r\n\r\n/**\r\n * Implementation of a SchemaComparer that is used in the schema differencing process.\r\n * It extends the SchemaComparer base class with additional functionality to store the\r\n * name mappings of renamed schema items and properties.\r\n *\r\n * @internal\r\n */\r\nclass DifferenceSchemaComparer extends SchemaComparer {\r\n public readonly nameMappings: NameMapping;\r\n private readonly _changes: Array<SchemaChanges>;\r\n\r\n public get diagnostics(): Iterable<AnyDiagnostic> {\r\n return this._changes[0].allDiagnostics;\r\n }\r\n\r\n constructor() {\r\n super({ report: (changes) => this._changes.push(changes as SchemaChanges) });\r\n\r\n this._changes = [];\r\n this.nameMappings = new NameMapping();\r\n }\r\n\r\n public override async resolveItem<TItem extends typeof SchemaItem>(item: SchemaItem, lookupSchema: Schema, itemConstructor: TItem): Promise<InstanceType<TItem> | undefined> {\r\n const classKey = this.nameMappings.resolveItemKey(item.key);\r\n return lookupSchema.lookupItem(classKey.name, itemConstructor);\r\n }\r\n\r\n public override async resolveProperty(propertyA: AnyProperty, ecClass: ECClass): Promise<AnyProperty | undefined> {\r\n const propertyKey = this.nameMappings.resolvePropertyKey(new PropertyKey(propertyA.name, propertyA.class.key));\r\n return ecClass.getProperty(propertyKey.propertyName) as Promise<AnyProperty | undefined>;\r\n }\r\n\r\n public override areEqualByName(itemKeyA?: Readonly<SchemaItemKey> | SchemaItem, itemKeyB?: Readonly<SchemaItemKey> | SchemaItem): boolean {\r\n if (itemKeyA) {\r\n if (SchemaItem.isSchemaItem(itemKeyA)) {\r\n itemKeyA = itemKeyA.key;\r\n }\r\n itemKeyA = this.nameMappings.resolveItemKey(itemKeyA);\r\n }\r\n return super.areEqualByName(itemKeyA, itemKeyB);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaDifference.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifference.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAsbH,oDAmCC;AAtdD,8DAA8E;AAC9E,uEAAoE;AAEpE,iEAA8D;AAC9D,gEAIkC;AAClC,2EAAkE;AAElE,8DAAwE;AAsBxE;;;GAGG;AACH,IAAY,gBAYX;AAZD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,uDAAmC,CAAA;IACnC,yCAAqB,CAAA;IACrB,6CAAyB,CAAA;IACzB,uEAAmD,CAAA;IACnD,qEAAiD,CAAA;IACjD,+EAA2D,CAAA;IAC3D,yDAAqC,CAAA;IACrC,yFAAqE,CAAA;IACrE,6CAAyB,CAAA;IACzB,uDAAmC,CAAA;AACrC,CAAC,EAZW,gBAAgB,gCAAhB,gBAAgB,QAY3B;AA2XD;;;;;;GAMG;AACI,KAAK,UAAU,oBAAoB,CAAC,YAAoB,EAAE,YAAoB,EAAE,WAAsC;IAC3H,MAAM,cAAc,GAAG,IAAI,wBAAwB,EAAE,CAAC;IACtD,IAAG,WAAW,EAAE,CAAC;QACf,KAAI,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;YAC9B,IAAG,IAAI,CAAC,IAAI,KAAK,4BAAc,CAAC,gBAAgB,EAAE,CAAC;gBACjD,cAAc,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YACnE,CAAC;YACD,IAAG,IAAI,CAAC,IAAI,KAAK,4BAAc,CAAC,cAAc,EAAE,CAAC;gBAC/C,cAAc,CAAC,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,cAAc,CAAC,cAAc,CAAC,YAAY,E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AE,eAAsB;QAC/H,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5D,OAAO,YAAY,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IACjE,CAAC;IAEe,KAAK,CAAC,eAAe,CAAC,SAAsB,EAAE,OAAgB;QAC5E,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,IAAI,yBAAW,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/G,OAAO,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,YAAY,CAAqC,CAAC;IAC3F,CAAC;IAEe,cAAc,CAAC,QAA+C,EAAE,QAA+C;QAC7H,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,8BAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACtC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC;YAC1B,CAAC;YACD,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QACxD,CAAC;QACD,OAAO,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAClD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Differencing\n */\n\nimport { AnySchemaDifferenceConflict } from \"./SchemaConflicts\";\nimport { AnySchemaEdits, SchemaEditType } from \"../Merging/Edits/SchemaEdits\";\nimport { SchemaDiagnosticVisitor } from \"./SchemaDiagnosticVisitor\";\nimport { SchemaChanges } from \"../Validation/SchemaChanges\";\nimport { SchemaComparer } from \"../Validation/SchemaComparer\";\nimport { AnyEnumerator, AnyProperty, AnyPropertyProps, ConstantProps, CustomAttribute,\n CustomAttributeClassProps, ECClass, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps,\n MixinProps, PhenomenonProps, PropertyCategoryProps, RelationshipClassProps, RelationshipConstraintProps,\n type Schema, SchemaItem, SchemaItemFormatProps, SchemaItemKey, SchemaItemProps, SchemaItemType, SchemaItemUnitProps, SchemaReferenceProps, StructClassProps, UnitSystemProps,\n} from \"@itwin/ecschema-metadata\";\nimport { validateDifferences } from \"./SchemaDifferenceValidator\";\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\nimport { NameMapping, PropertyKey } from \"../Merging/Edits/NameMapping\";\n\n/** Utility-Type to remove possible readonly flags on the given type. */\ntype PartialEditable<T> = {\n -readonly [P in keyof T]?: T[P];\n};\n\n/**\n * Utility-Type to simplify the expected SchemaItem props by omitting the base properties\n * that are not needed for the schema differencing. Also all properties are made mutable\n * by removing the readonly flag if present.\n */\ntype SchemaItemProperties<T extends SchemaItemProps> = {\n [P in keyof PartialEditable<Omit<T, keyof Omit<SchemaItemProps, \"label\" | \"description\" | \"customAttributes\">>>]: T[P]\n};\n\n/**\n * Defines the type of the difference operation.\n * @alpha\n */\nexport type DifferenceType = \"add\" | \"modify\";\n\n/**\n * Defines the SchemaTypes that are not SchemaItems.\n * @alpha\n */\nexport enum SchemaOtherTypes {\n Schema = \"Schema\",\n SchemaReference = \"SchemaReference\",\n Property = \"Property\",\n Enumerator = \"Enumerator\",\n CustomAttributeInstance = \"CustomAttributeInstance\",\n RelationshipConstraint = \"RelationshipConstraint\",\n RelationshipConstraintClass = \"RelationshipConstraintClass\",\n EntityClassMixin = \"EntityClassMixin\",\n KindOfQuantityPresentationFormat = \"KindOfQuantityPresentationFormat\",\n FormatUnit = \"FormatUnit\",\n FormatUnitLabel = \"FormatUnitLabel\",\n}\n\n/**\n * Defines the possible values SchemaTypes that can occur in SchemaDifferences or Conflicts.\n * @alpha\n */\nexport type SchemaType = SchemaOtherTypes | SchemaItemType;\n\n/**\n * Definition of the difference result between two Schemas.\n * @alpha\n */\nexport interface SchemaDifferenceResult {\n /** Full name of the source schema */\n readonly sourceSchemaName: string;\n /** Full name of the target schema */\n readonly targetSchemaName: string;\n\n /** List of differences between the compared schemas. */\n readonly differences: AnySchemaDifference[];\n\n /** List of conflicts found while comparing the schemas. */\n readonly conflicts?: AnySchemaDifferenceConflict[];\n}\n\n/**\n * Union of all supported schema differencing types.\n * @alpha\n */\nexport type AnySchemaDifference =\n SchemaDifference |\n SchemaReferenceDifference |\n AnySchemaItemDifference |\n AnySchemaItemPathDifference |\n EntityClassMixinDifference |\n CustomAttributeDifference |\n KindOfQuantityPresentationFormatDifference |\n FormatUnitDifference;\n\n/**\n * Differencing entry for changes on a Schema.\n * @alpha\n */\nexport interface SchemaDifference {\n readonly changeType: \"modify\";\n readonly schemaType: SchemaOtherTypes.Schema;\n readonly difference: {\n label?: string;\n description?: string;\n };\n}\n\n/**\n * Differencing entry for added or changed Schema References of a Schema.\n * @alpha\n */\nexport interface SchemaReferenceDifference {\n readonly changeType: \"add\" | \"modify\";\n readonly schemaType: SchemaOtherTypes.SchemaReference;\n readonly difference: SchemaReferenceProps;\n}\n\n/**\n * Union of all supported schema item differencing types.\n * @alpha\n */\nexport type AnySchemaItemDifference =\n AnyClassItemDifference |\n ConstantDifference |\n EnumerationDifference |\n FormatDifference |\n KindOfQuantityDifference |\n InvertedUnitDifference |\n PhenomenonDifference |\n PropertyCategoryDifference |\n UnitDifference |\n UnitSystemDifference;\n\n/**\n * Union for supported class Schema Items.\n * @alpha\n */\nexport type AnyClassItemDifference =\n EntityClassDifference |\n MixinClassDifference |\n StructClassDifference |\n CustomAttributeClassDifference |\n RelationshipClassDifference;\n\n/**\n * Union of all differences that have a path pointing inside a schema item.\n * @alpha\n */\nexport type AnySchemaItemPathDifference =\n RelationshipConstraintDifference |\n RelationshipConstraintClassDifference |\n CustomAttributePropertyDifference |\n EnumeratorDifference |\n ClassPropertyDifference |\n FormatUnitLabelDifference;\n\n/**\n * Internal base class for all Schema Item differencing entries.\n * @alpha\n */\ninterface SchemaItemDifference<T extends SchemaItemProps> {\n readonly changeType: \"add\" | \"modify\";\n readonly itemName: string;\n readonly difference: SchemaItemProperties<T>;\n}\n\n/**\n * Differencing entry for Constant Schema Items.\n * @alpha\n */\nexport interface ConstantDifference extends SchemaItemDifference<ConstantProps> {\n readonly schemaType: SchemaItemType.Constant;\n}\n\n/**\n * Differencing entry for Custom Attribute Class Schema Items.\n * @alpha\n */\nexport interface CustomAttributeClassDifference extends SchemaItemDifference<CustomAttributeClassProps> {\n readonly schemaType: SchemaItemType.CustomAttributeClass;\n}\n\n/**\n * Differencing entry for Entity Class Schema Items.\n * @alpha\n */\nexport interface EntityClassDifference extends SchemaItemDifference<EntityClassProps> {\n readonly schemaType: SchemaItemType.EntityClass;\n}\n\n/**\n * Differencing entry for Enumerator Schema Items.\n * @alpha\n */\nexport interface EnumerationDifference extends SchemaItemDifference<EnumerationProps> {\n readonly schemaType: SchemaItemType.Enumeration;\n}\n\n/**\n * Differencing entry for Kind-Of-Quantities Schema Items.\n * @alpha\n */\nexport interface KindOfQuantityDifference extends SchemaItemDifference<KindOfQuantityProps> {\n readonly schemaType: SchemaItemType.KindOfQuantity;\n}\n\n/**\n * Differencing entry for Mixin Class Schema Items.\n * @alpha\n */\nexport interface MixinClassDifference extends SchemaItemDifference<MixinProps> {\n readonly schemaType: SchemaItemType.Mixin;\n}\n\n/**\n * Differencing entry for Phenomenon Schema Items.\n * @alpha\n */\nexport interface PhenomenonDifference extends SchemaItemDifference<PhenomenonProps> {\n readonly schemaType: SchemaItemType.Phenomenon;\n}\n\n/**\n * Differencing entry for Property Category Schema Items.\n * @alpha\n */\nexport interface PropertyCategoryDifference extends SchemaItemDifference<PropertyCategoryProps> {\n readonly schemaType: SchemaItemType.PropertyCategory;\n}\n\n/**\n * Differencing entry for Relationship Class Schema Items.\n * @alpha\n */\nexport interface RelationshipClassDifference extends SchemaItemDifference<RelationshipClassProps> {\n readonly schemaType: SchemaItemType.RelationshipClass;\n}\n\n/**\n * Differencing entry for Struct Class Schema Items.\n * @alpha\n */\nexport interface StructClassDifference extends SchemaItemDifference<StructClassProps> {\n readonly schemaType: SchemaItemType.StructClass;\n}\n\n/**\n * Differencing entry for Unit System Schema Items.\n * @alpha\n */\nexport interface UnitSystemDifference extends SchemaItemDifference<UnitSystemProps> {\n readonly schemaType: SchemaItemType.UnitSystem;\n}\n\n/**\n * Differencing entry for Unit Schema Items.\n * @alpha\n */\nexport interface UnitDifference extends SchemaItemDifference<SchemaItemUnitProps> {\n readonly schemaType: SchemaItemType.Unit;\n}\n\n/**\n * Differencing entry for Inverted Unit Schema Items.\n * @alpha\n */\nexport interface InvertedUnitDifference extends SchemaItemDifference<InvertedUnitProps> {\n readonly schemaType: SchemaItemType.InvertedUnit;\n}\n/**\n * Differencing entry for Format Schema Items.\n * @alpha\n */\nexport interface FormatDifference extends SchemaItemDifference<SchemaItemFormatProps> {\n readonly schemaType: SchemaItemType.Format;\n}\n\n/**\n * Differencing entry for added or changed Properties.\n * @alpha\n */\nexport interface ClassPropertyDifference {\n readonly changeType: \"add\" | \"modify\";\n readonly schemaType: SchemaOtherTypes.Property;\n readonly itemName: string;\n readonly path: string;\n readonly difference: PartialEditable<AnyPropertyProps>;\n}\n\n/**\n * Union of supported Custom Attribute Differences.\n * @alpha\n */\nexport type CustomAttributeDifference =\n CustomAttributeSchemaDifference |\n CustomAttributeSchemaItemDifference |\n CustomAttributePropertyDifference |\n CustomAttributeRelationshipConstraintDifference;\n\n/**\n * Differencing entry for Custom Attributes on Schema.\n * @alpha\n */\nexport interface CustomAttributeSchemaDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.CustomAttributeInstance;\n readonly appliedTo: \"Schema\";\n readonly difference: PartialEditable<CustomAttribute>;\n}\n\n/**\n * Differencing entry for Custom Attributes on Schema Items.\n * @alpha\n */\nexport interface CustomAttributeSchemaItemDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.CustomAttributeInstance;\n readonly appliedTo: \"SchemaItem\";\n readonly itemName: string;\n readonly difference: PartialEditable<CustomAttribute>;\n}\n\n/**\n * Differencing entry for Custom Attributes on Properties.\n * @alpha\n */\nexport interface CustomAttributePropertyDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.CustomAttributeInstance;\n readonly appliedTo: \"Property\";\n readonly itemName: string;\n readonly path: string;\n readonly difference: PartialEditable<CustomAttribute>;\n}\n\n/**\n * Differencing entry for Custom Attributes on Relationship Constraints.\n * @alpha\n */\nexport interface CustomAttributeRelationshipConstraintDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.CustomAttributeInstance;\n readonly appliedTo: \"RelationshipConstraint\";\n readonly itemName: string;\n readonly path: \"$source\" | \"$target\";\n readonly difference: PartialEditable<CustomAttribute>;\n}\n\n/**\n * Differencing entry for changed mixins on EntityClasses.\n * @alpha\n */\nexport interface EntityClassMixinDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.EntityClassMixin;\n readonly itemName: string;\n readonly difference: string[];\n}\n\n/**\n * Differencing entry for changed Enumerators on Enumerable Schema Items.\n * @alpha\n */\nexport interface EnumeratorDifference {\n readonly changeType: \"add\" | \"modify\";\n readonly schemaType: SchemaOtherTypes.Enumerator;\n readonly itemName: string;\n readonly path: string;\n readonly difference: PartialEditable<AnyEnumerator>;\n}\n\n/**\n * Differencing entry for Relationship Constraints.\n * @alpha\n */\nexport interface RelationshipConstraintDifference {\n readonly changeType: \"modify\";\n readonly schemaType: SchemaOtherTypes.RelationshipConstraint;\n readonly itemName: string;\n readonly path: \"$source\" | \"$target\";\n readonly difference: PartialEditable<Omit<RelationshipConstraintProps, \"constraintClasses\">>;\n}\n\n/**\n * Differencing entry for constraint classes added to Relationship Constrains.\n * @alpha\n */\nexport interface RelationshipConstraintClassDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.RelationshipConstraintClass;\n readonly itemName: string;\n readonly path: \"$source\" | \"$target\";\n readonly difference: string[];\n}\n\n/**\n * Differencing entry for presentation formats added to KindOfQuantities.\n * @alpha\n */\nexport interface KindOfQuantityPresentationFormatDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.KindOfQuantityPresentationFormat;\n readonly itemName: string;\n readonly difference: string[];\n}\n\n/**\n * Differencing entry for changed Units on Formats.\n * @alpha\n */\nexport interface FormatUnitDifference {\n readonly changeType: \"modify\";\n readonly schemaType: SchemaOtherTypes.FormatUnit;\n readonly itemName: string;\n readonly difference: {\n name: string;\n label?: string;\n }[];\n}\n\n/**\n * Differencing entry for changed labels on Format Units.\n * @alpha\n */\nexport interface FormatUnitLabelDifference {\n readonly changeType: \"modify\";\n readonly schemaType: SchemaOtherTypes.FormatUnitLabel;\n readonly itemName: string;\n readonly path: string;\n readonly difference: {\n label?: string;\n };\n}\n\n/**\n * Creates a [[SchemaDifferenceResult]] for two given schemas.\n * @param targetSchema The schema the differences gets merged into.\n * @param sourceSchema The schema to get merged in the target.\n * @returns An [[SchemaDifferenceResult]] object.\n * @alpha\n */\nexport async function getSchemaDifferences(targetSchema: Schema, sourceSchema: Schema, schemaEdits?: Iterable<AnySchemaEdits>): Promise<SchemaDifferenceResult> {\n const schemaComparer = new DifferenceSchemaComparer();\n if(schemaEdits) {\n for(const edit of schemaEdits) {\n if(edit.type === SchemaEditType.RenameSchemaItem) {\n schemaComparer.nameMappings.addItemMapping(edit.key, edit.value);\n }\n if(edit.type === SchemaEditType.RenameProperty) {\n schemaComparer.nameMappings.addPropertyMapping(edit.key, edit.value);\n }\n }\n }\n\n await schemaComparer.compareSchemas(sourceSchema, targetSchema);\n\n const visitor = new SchemaDiagnosticVisitor();\n for (const diagnostic of schemaComparer.diagnostics) {\n visitor.visit(diagnostic);\n }\n\n const differences: AnySchemaDifference[] = [\n ...visitor.schemaDifferences,\n ...visitor.schemaItemDifferences,\n ...visitor.schemaItemPathDifferences,\n ...visitor.customAttributeDifferences,\n ];\n\n const conflicts = await validateDifferences(differences, targetSchema, sourceSchema, schemaComparer.nameMappings);\n\n return {\n sourceSchemaName: sourceSchema.schemaKey.toString(),\n targetSchemaName: targetSchema.schemaKey.toString(),\n conflicts: conflicts.length > 0 ? conflicts : undefined,\n differences,\n };\n}\n\n/**\n * Implementation of a SchemaComparer that is used in the schema differencing process.\n * It extends the SchemaComparer base class with additional functionality to store the\n * name mappings of renamed schema items and properties.\n *\n * @internal\n */\nclass DifferenceSchemaComparer extends SchemaComparer {\n public readonly nameMappings: NameMapping;\n private readonly _changes: Array<SchemaChanges>;\n\n public get diagnostics(): Iterable<AnyDiagnostic> {\n return this._changes[0].allDiagnostics;\n }\n\n constructor() {\n super({ report: (changes) => this._changes.push(changes as SchemaChanges) });\n\n this._changes = [];\n this.nameMappings = new NameMapping();\n }\n\n public override async resolveItem<TItem extends typeof SchemaItem>(item: SchemaItem, lookupSchema: Schema, itemConstructor: TItem): Promise<InstanceType<TItem> | undefined> {\n const classKey = this.nameMappings.resolveItemKey(item.key);\n return lookupSchema.lookupItem(classKey.name, itemConstructor);\n }\n\n public override async resolveProperty(propertyA: AnyProperty, ecClass: ECClass): Promise<AnyProperty | undefined> {\n const propertyKey = this.nameMappings.resolvePropertyKey(new PropertyKey(propertyA.name, propertyA.class.key));\n return ecClass.getProperty(propertyKey.propertyName) as Promise<AnyProperty | undefined>;\n }\n\n public override areEqualByName(itemKeyA?: Readonly<SchemaItemKey> | SchemaItem, itemKeyB?: Readonly<SchemaItemKey> | SchemaItem): boolean {\n if (itemKeyA) {\n if (SchemaItem.isSchemaItem(itemKeyA)) {\n itemKeyA = itemKeyA.key;\n }\n itemKeyA = this.nameMappings.resolveItemKey(itemKeyA);\n }\n return super.areEqualByName(itemKeyA, itemKeyB);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaDifferenceValidator.js","sourceRoot":"","sources":["../../../src/Differencing/Schem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;QACrB,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,QAAQ,GAAG,MAAM,EAAE,CAAC;IAC9D,IAAI,QAAQ,CAAC,YAAY,EAAE;QACzB,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,GAAG,MAAM,EAAE,CAAC;IACpE,OAAO,IAAA,wCAAoB,EAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,SAAS,aAAa,CAAC,aAAwB,EAAE,cAAyB;IACxE,OAAO,aAAa,CAAC,OAAO,CAAC,cAAc,EAAE,mCAAe,CAAC,qBAAqB,CAAC;WAC5E,cAAc,CAAC,OAAO,CAAC,aAAa,EAAE,mCAAe,CAAC,qBAAqB,CAAC,CAAC;AACtF,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\n/** @packageDocumentation\r\n * @module Differencing\r\n */\r\n\r\nimport { classModifierToString, ECClass, ECClassModifier, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, LazyLoadedSchemaItem, Mixin, parseClassModifier, primitiveTypeToString, Property, propertyTypeToString, Schema, SchemaItem, SchemaItemKey, SchemaKey, SchemaMatchType, Unit } from \"@itwin/ecschema-metadata\";\r\nimport { AnyClassItemDifference, AnySchemaDifference, AnySchemaItemDifference, ClassPropertyDifference, ConstantDifference, CustomAttributeClassDifference, CustomAttributeDifference, EntityClassDifference, EntityClassMixinDifference, EnumerationDifference, EnumeratorDifference, FormatDifference, FormatUnitDifference, FormatUnitLabelDifference, InvertedUnitDifference, KindOfQuantityDifference, KindOfQuantityPresentationFormatDifference, MixinClassDifference, PhenomenonDifference, PropertyCategoryDifference, RelationshipClassDifference, RelationshipConstraintClassDifference, RelationshipConstraintDifference, SchemaDifference, SchemaReferenceDifference, StructClassDifference, UnitDifference, UnitSystemDifference } from \"./SchemaDifference\";\r\nimport { AnySchemaDifferenceConflict, ConflictCode } from \"./SchemaConflicts\";\r\nimport { SchemaDifferenceVisitor, SchemaDifferenceWalker } from \"./SchemaDifferenceVisitor\";\r\nimport { NameMapping, PropertyKey } from \"../Merging/Edits/NameMapping\";\r\n\r\n/**\r\n * Validates the given array of schema differences and returns a list of conflicts if the\r\n * validation finds violation against rules.\r\n * @param differences An array of schema differences.\r\n * @param targetSchema The target schema reference.\r\n * @param sourceSchema The source schema reference.\r\n * @returns An array of conflicts found when validating the difference.\r\n * @internal\r\n */\r\nexport async function validateDifferences(differences: AnySchemaDifference[], targetSchema: Schema, sourceSchema: Schema, nameMappings: NameMapping) {\r\n const visitor = new SchemaDifferenceValidationVisitor(targetSchema, sourceSchema, nameMappings);\r\n const walker = new SchemaDifferenceWalker(visitor);\r\n\r\n await walker.traverse(differences);\r\n\r\n return visitor.conflicts;\r\n}\r\n\r\n/**\r\n * The SchemaDifferenceValidationVisitor class is an implementation of ISchemaDifferenceVisitor and\r\n * validates the given SchemaDifferences if the violate against some EC Rules.\r\n */\r\nclass SchemaDifferenceValidationVisitor implements SchemaDifferenceVisitor {\r\n\r\n public readonly conflicts: Array<AnySchemaDifferenceConflict>;\r\n private readonly _sourceSchema: Schema;\r\n private readonly _targetSchema: Schema;\r\n private readonly _nameMappings: NameMapping;\r\n\r\n /** Initializes a new instance of SchemaDifferenceValidationVisitor class. */\r\n constructor(targetSchema: Schema, sourceSchema: Schema, nameMappings: NameMapping) {\r\n this.conflicts = [];\r\n this._targetSchema = targetSchema;\r\n this._sourceSchema = sourceSchema;\r\n this._nameMappings = nameMappings;\r\n }\r\n\r\n private addConflict(conflict: AnySchemaDifferenceConflict) {\r\n this.conflicts.push(conflict);\r\n }\r\n\r\n private async getTargetSchemaItem(name: string): Promise<SchemaItem | undefined> {\r\n const itemKey = new SchemaItemKey(name, this._sourceSchema.schemaKey);\r\n const mappedKey = this._nameMappings.resolveItemKey(itemKey);\r\n return this._targetSchema.getItem(mappedKey.name);\r\n }\r\n\r\n private getTargetProperty(itemName: string, propertyName: string): PropertyKey {\r\n const classKey = new SchemaItemKey(itemName, this._sourceSchema.schemaKey);\r\n const propertyKey = new PropertyKey(propertyName, classKey);\r\n return this._nameMappings.resolvePropertyKey(propertyKey);\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling SchemaDifference.\r\n * @internal\r\n */\r\n public async visitSchemaDifference(_entry: SchemaDifference) {\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) {\r\n const sourceSchemaReference = await this._sourceSchema.getReference(entry.difference.name) as Schema;\r\n const targetSchemaReferenceName = this._targetSchema.getReferenceNameByAlias(sourceSchemaReference.alias);\r\n if (targetSchemaReferenceName && targetSchemaReferenceName !== sourceSchemaReference.name) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingReferenceAlias,\r\n difference: entry,\r\n source: entry.difference.name,\r\n target: targetSchemaReferenceName,\r\n description: \"Target schema already references a different schema with this alias.\",\r\n });\r\n }\r\n\r\n // The targetSchemaReference can be undefined, if the reference will be added by the source schema.\r\n // In this case further validation is not needed.\r\n const targetSchemaReference = await this._targetSchema.getReference(entry.difference.name);\r\n if(targetSchemaReference === undefined) {\r\n return;\r\n }\r\n\r\n const sourceSchemaKey = sourceSchemaReference.schemaKey;\r\n const targetSchemaKey = targetSchemaReference.schemaKey;\r\n\r\n if(targetSchemaReference.isDynamic !== sourceSchemaReference.isDynamic) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingReferenceDynamic,\r\n difference: entry,\r\n description: \"Cannot update a schema reference to or from a dynamic schema.\",\r\n source: sourceSchemaKey.toString(),\r\n target: targetSchemaKey.toString(),\r\n });\r\n }\r\n\r\n if(entry.changeType === \"modify\" && !targetSchemaReference.isDynamic && !areCompatible(sourceSchemaKey, targetSchemaKey)) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingReferenceVersion,\r\n difference: entry,\r\n description: \"Schema reference cannot be updated, incompatible versions\",\r\n source: sourceSchemaKey.toString(),\r\n target: targetSchemaKey.toString(),\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Shared schema item validation for all types of AnySchemaItemDifference union.\r\n */\r\n private async visitSchemaItemDifference(entry: AnySchemaItemDifference, targetSchemaItem: SchemaItem | undefined) {\r\n // If the item shall be added, but the target schema already has an item with this name,\r\n // will produce an ConflictingItemName conflict.\r\n if (entry.changeType === \"add\" && targetSchemaItem !== undefined) {\r\n this.addConflict({\r\n code: ConflictCode.ConflictingItemName,\r\n difference: entry,\r\n source: entry.schemaType,\r\n target: targetSchemaItem.schemaItemType,\r\n description: \"Target schema already contains a schema item with the name but different type.\",\r\n });\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Shared base-class validation for all types of ClassItemDifference union.\r\n */\r\n private async visitBaseClassDifference(entry: AnyClassItemDifference, targetClassItem: ECClass) {\r\n if (\"baseClass\" in entry.difference && entry.difference.baseClass === undefined && targetClassItem.baseClass !== undefined) {\r\n return this.addConflict({\r\n code: ConflictCode.RemovingBaseClass,\r\n difference: entry,\r\n source: null,\r\n target: resolveLazyItemFullName(targetClassItem.baseClass),\r\n description: \"BaseClass cannot be removed, if there has been a baseClass before.\",\r\n });\r\n }\r\n\r\n if (entry.difference.baseClass === undefined) {\r\n return;\r\n }\r\n\r\n const sourceBaseClass = await this._sourceSchema.lookupItem(entry.difference.baseClass) as ECClass;\r\n if (sourceBaseClass.modifier === ECClassModifier.Sealed) {\r\n return this.addConflict({\r\n code: ConflictCode.SealedBaseClass,\r\n difference: entry,\r\n source: sourceBaseClass.fullName,\r\n target: resolveLazyItemFullName(targetClassItem.baseClass) || null,\r\n description: \"BaseClass is sealed.\",\r\n });\r\n }\r\n\r\n if (targetClassItem.baseClass && !await this.derivedFrom(sourceBaseClass, targetClassItem.baseClass)) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingBaseClass,\r\n difference: entry,\r\n source: sourceBaseClass.fullName,\r\n target: resolveLazyItemFullName(targetClassItem.baseClass),\r\n description: \"BaseClass is not valid, source class must derive from target.\",\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Shared validation for all types of ClassItemDifference union.\r\n */\r\n private async visitClassDifference(entry: AnyClassItemDifference) {\r\n const targetClassItem = await this.getTargetSchemaItem(entry.itemName);\r\n if (!await this.visitSchemaItemDifference(entry, targetClassItem)) {\r\n return;\r\n }\r\n\r\n if (entry.changeType === \"modify\" && ECClass.isECClass(targetClassItem)) {\r\n await this.visitClassModifierDifference(entry, targetClassItem);\r\n await this.visitBaseClassDifference(entry, targetClassItem);\r\n }\r\n }\r\n\r\n /**\r\n * Validation the modifiers of all types of ClassItemDifference union.\r\n */\r\n private async visitClassModifierDifference(entry: AnyClassItemDifference, targetClass: ECClass) {\r\n if (entry.difference.modifier) {\r\n const changedModifier = parseClassModifier(entry.difference.modifier);\r\n if (changedModifier !== undefined && changedModifier !== ECClassModifier.None) {\r\n this.addConflict({\r\n code: ConflictCode.ConflictingClassModifier,\r\n difference: entry,\r\n source: entry.difference.modifier,\r\n target: classModifierToString(targetClass.modifier),\r\n description: \"Class has conflicting modifiers.\",\r\n });\r\n }\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) {\r\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\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) {\r\n await this.visitClassDifference(entry);\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) {\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) {\r\n await this.visitClassDifference(entry);\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) {\r\n for (const addedMixin of entry.difference) {\r\n // To validate the added mixins, the instance from the source schema it fetched,\r\n // otherwise validation gets too complicated as the mixin must not be existing in\r\n // the current target schema, it could also be added to the schema.\r\n const sourceMixin = await this._sourceSchema.lookupItem(addedMixin) as Mixin;\r\n const sourceSchemaItem = await this._sourceSchema.getItem(entry.itemName) as EntityClass;\r\n if (sourceMixin.appliesTo && !await sourceSchemaItem.is(await sourceMixin.appliesTo)) {\r\n this.addConflict({\r\n code: ConflictCode.MixinAppliedMustDeriveFromConstraint,\r\n difference: entry,\r\n source: addedMixin,\r\n target: undefined,\r\n description: \"Mixin cannot applied to this class.\",\r\n });\r\n }\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) {\r\n const enumeration = await this.getTargetSchemaItem(entry.itemName);\r\n if (!await this.visitSchemaItemDifference(entry, enumeration)) {\r\n return;\r\n }\r\n\r\n if (entry.changeType === \"modify\" && Enumeration.isEnumeration(enumeration) && enumeration.type !== undefined) {\r\n if (entry.difference.type) {\r\n this.addConflict({\r\n code: ConflictCode.ConflictingEnumerationType,\r\n difference: entry,\r\n source: entry.difference.type,\r\n target: primitiveTypeToString(enumeration.type),\r\n description: \"Enumeration has a different primitive type.\",\r\n });\r\n }\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) {\r\n if (entry.changeType !== \"modify\") {\r\n return;\r\n }\r\n\r\n const enumeration = await this.getTargetSchemaItem(entry.itemName) as Enumeration;\r\n const enumerator = enumeration.getEnumeratorByName(entry.path);\r\n if (!enumerator) {\r\n return;\r\n }\r\n\r\n if (entry.difference.value) {\r\n this.addConflict({\r\n code: ConflictCode.ConflictingEnumeratorValue,\r\n difference: entry,\r\n source: entry.difference.value,\r\n target: enumerator.value,\r\n description: \"Enumerators must have unique values.\",\r\n });\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) {\r\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\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) {\r\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\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) {\r\n const kindOfQuantity = await this.getTargetSchemaItem(entry.itemName);\r\n if (!await this.visitSchemaItemDifference(entry, kindOfQuantity)) {\r\n return;\r\n }\r\n\r\n if (entry.changeType === \"modify\" && KindOfQuantity.isKindOfQuantity(kindOfQuantity)) {\r\n if (entry.difference.persistenceUnit) {\r\n this.addConflict({\r\n code: ConflictCode.ConflictingPersistenceUnit,\r\n difference: entry,\r\n source: entry.difference.persistenceUnit,\r\n target: resolveLazyItemFullName(kindOfQuantity.persistenceUnit),\r\n description: \"Kind of Quantity has a different persistence unit.\",\r\n });\r\n }\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) {\r\n await this.visitClassDifference(entry);\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) {\r\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\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) {\r\n const targetClass = await this.getTargetSchemaItem(entry.itemName) as ECClass;\r\n const propertyKey = this.getTargetProperty(entry.itemName, entry.path);\r\n const targetProperty = await targetClass.getProperty(propertyKey.propertyName);\r\n\r\n const sourceClass = await this._sourceSchema.getItem(entry.itemName) as ECClass;\r\n const sourceProperty = await sourceClass.getProperty(entry.path) as Property;\r\n\r\n // If property shall be added but there is already a property with this name\r\n // in target, a ConflictingPropertyName is issued.\r\n if (entry.changeType === \"add\" && targetProperty !== undefined) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingPropertyName,\r\n difference: entry,\r\n source: resolvePropertyTypeName(sourceProperty),\r\n target: resolvePropertyTypeName(targetProperty),\r\n description: \"Target class already contains a property with a different type.\",\r\n });\r\n }\r\n\r\n if (entry.changeType === \"modify\" && targetProperty !== undefined) {\r\n if (\"kindOfQuantity\" in entry.difference) {\r\n const sourceKoQ = await sourceProperty.kindOfQuantity;\r\n const targetKoQ = await targetProperty.kindOfQuantity;\r\n if(!targetKoQ) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingPropertyKindOfQuantity,\r\n difference: entry,\r\n source: entry.difference.kindOfQuantity,\r\n target: null,\r\n description: \"The kind of quantity cannot be assiged if the property did not have a kind of quantities before.\",\r\n });\r\n }\r\n\r\n if(!sourceKoQ) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingPropertyKindOfQuantity,\r\n difference: entry,\r\n source: null,\r\n target: resolveLazyItemFullName(targetProperty.kindOfQuantity),\r\n description: \"The kind of quantity cannot be undefined if the property had a kind of quantities before.\",\r\n });\r\n }\r\n\r\n if (resolveLazyItemName(sourceKoQ.persistenceUnit) !== resolveLazyItemName(targetKoQ.persistenceUnit)) {\r\n this.addConflict({\r\n code: ConflictCode.ConflictingPropertyKindOfQuantityUnit,\r\n difference: entry,\r\n source: entry.difference.kindOfQuantity,\r\n target: resolveLazyItemFullName(targetProperty.kindOfQuantity),\r\n description: \"The property has different kind of quantities with conflicting units.\",\r\n });\r\n }\r\n }\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) {\r\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\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) {\r\n await this.visitClassDifference(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) {\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) {\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) {\r\n await this.visitClassDifference(entry);\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) {\r\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\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) {\r\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\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) {\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling FormatUnitDifference.\r\n * @internal\r\n */\r\n public async visitFormatUnitDifference(entry: FormatUnitDifference) {\r\n const targetFormat = await this.getTargetSchemaItem(entry.itemName) as Format;\r\n\r\n if (targetFormat.units === undefined) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingFormatUnit,\r\n difference: entry,\r\n source: entry.difference[0].name,\r\n target: null,\r\n description: \"The unit cannot be assiged if the format did not have a unit before.\",\r\n });\r\n };\r\n\r\n const targetUnit = await targetFormat.units[0][0];\r\n const targetPhenomenon = InvertedUnit.isInvertedUnit(targetUnit)\r\n ? (await targetUnit.invertsUnit)?.phenomenon\r\n : targetUnit.phenomenon;\r\n\r\n const sourceUnit = await this._sourceSchema.lookupItem(entry.difference[0].name) as Unit | InvertedUnit;\r\n const sourcePhenomenon = InvertedUnit.isInvertedUnit(sourceUnit)\r\n ? (await sourceUnit.invertsUnit)?.phenomenon\r\n : sourceUnit.phenomenon;\r\n\r\n if (resolveLazyItemName(targetPhenomenon) !== resolveLazyItemName(sourcePhenomenon)) {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingFormatUnitPhenomenon,\r\n difference: entry,\r\n source: entry.difference[0].name,\r\n target: targetUnit.fullName,\r\n description: \"Format units has a different phenomenon.\",\r\n });\r\n };\r\n };\r\n\r\n /**\r\n * Visitor implementation for handling FormatUnitLabelDifference.\r\n * @internal\r\n */\r\n public async visitFormatUnitLabelDifference(_entry: FormatUnitLabelDifference) {\r\n }\r\n\r\n /**\r\n * Recursive synchronous function to figure whether a given class derived from\r\n * a class with the given baseClass name.\r\n */\r\n private async derivedFrom(ecClass: ECClass | undefined, baseClassKey: Readonly<SchemaItemKey>): Promise<boolean> {\r\n if (ecClass === undefined) {\r\n return false;\r\n }\r\n\r\n // First check for name which must be same in any case...\r\n if (ecClass.name === baseClassKey.name) {\r\n // ... then check if the class is in the same schema as the expected base class...\r\n if(ecClass.schema.name === baseClassKey.schemaName)\r\n return true;\r\n // ... if not, whether it's in the source schema, but then we expect the baseclass\r\n // to be in the target schema.\r\n if(ecClass.schema.name === this._sourceSchema.name && baseClassKey.schemaName === this._targetSchema.name)\r\n return true;\r\n }\r\n return this.derivedFrom(await ecClass.baseClass, baseClassKey);\r\n }\r\n}\r\n\r\n/**\r\n * Helper method to resolve the schema item name from lazy loaded schema items.\r\n * @param lazyItem LazyLoaded item\r\n * @returns The full name of the item or undefined item was not set.\r\n */\r\nfunction resolveLazyItemFullName(lazyItem?: LazyLoadedSchemaItem<SchemaItem>) {\r\n return lazyItem && lazyItem.fullName;\r\n}\r\n\r\n/**\r\n * Helper method to resolve the schema item name from lazy loaded schema items.\r\n * @param lazyItem LazyLoaded item\r\n * @returns The full name of the item or undefined item was not set.\r\n */\r\nfunction resolveLazyItemName(lazyItem?: LazyLoadedSchemaItem<SchemaItem>) {\r\n return lazyItem && lazyItem.name;\r\n}\r\n\r\n/**\r\n * Helper method to resolve the type name of a property.\r\n * @param property The property which's type shall be resolved.\r\n * @returns The (full) name of the properties type.\r\n */\r\nfunction resolvePropertyTypeName(property: Property) {\r\n const [prefix, suffix] = property.isArray() ? [\"[\", \"]\"] : [\"\", \"\"];\r\n if (property.isEnumeration())\r\n return `${prefix}${resolveLazyItemFullName(property.enumeration)}${suffix}`;\r\n if (property.isPrimitive())\r\n return `${prefix}${primitiveTypeToString(property.primitiveType)}${suffix}`;\r\n if (property.isStruct())\r\n return `${prefix}${property.structClass.fullName}${suffix}`;\r\n if (property.isNavigation())\r\n return `${prefix}${property.relationshipClass.fullName}${suffix}`;\r\n return propertyTypeToString(property.propertyType);\r\n}\r\n\r\n/**\r\n * Checks if the two schemas are compatible. Since the merger will eventually take the most\r\n * recent schema version, it is sufficient to check if they are write compatible in one direction.\r\n */\r\nfunction areCompatible(leftSchemaKey: SchemaKey, rightSchemaKey: SchemaKey): boolean {\r\n return leftSchemaKey.matches(rightSchemaKey, SchemaMatchType.LatestWriteCompatible)\r\n || rightSchemaKey.matches(leftSchemaKey, SchemaMatchType.LatestWriteCompatible);\r\n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Q,CAAC,aAAa,CAAC,GAAG,MAAM,EAAE,CAAC;IAC9E,IAAI,QAAQ,CAAC,QAAQ,EAAE;QACrB,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,QAAQ,GAAG,MAAM,EAAE,CAAC;IAC9D,IAAI,QAAQ,CAAC,YAAY,EAAE;QACzB,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,GAAG,MAAM,EAAE,CAAC;IACpE,OAAO,IAAA,wCAAoB,EAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,SAAS,aAAa,CAAC,aAAwB,EAAE,cAAyB;IACxE,OAAO,aAAa,CAAC,OAAO,CAAC,cAAc,EAAE,mCAAe,CAAC,qBAAqB,CAAC;WAC5E,cAAc,CAAC,OAAO,CAAC,aAAa,EAAE,mCAAe,CAAC,qBAAqB,CAAC,CAAC;AACtF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Differencing\n */\n\nimport { classModifierToString, ECClass, ECClassModifier, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, LazyLoadedSchemaItem, Mixin, parseClassModifier, primitiveTypeToString, Property, propertyTypeToString, Schema, SchemaItem, SchemaItemKey, SchemaKey, SchemaMatchType, Unit } from \"@itwin/ecschema-metadata\";\nimport { AnyClassItemDifference, AnySchemaDifference, AnySchemaItemDifference, ClassPropertyDifference, ConstantDifference, CustomAttributeClassDifference, CustomAttributeDifference, EntityClassDifference, EntityClassMixinDifference, EnumerationDifference, EnumeratorDifference, FormatDifference, FormatUnitDifference, FormatUnitLabelDifference, InvertedUnitDifference, KindOfQuantityDifference, KindOfQuantityPresentationFormatDifference, MixinClassDifference, PhenomenonDifference, PropertyCategoryDifference, RelationshipClassDifference, RelationshipConstraintClassDifference, RelationshipConstraintDifference, SchemaDifference, SchemaReferenceDifference, StructClassDifference, UnitDifference, UnitSystemDifference } from \"./SchemaDifference\";\nimport { AnySchemaDifferenceConflict, ConflictCode } from \"./SchemaConflicts\";\nimport { SchemaDifferenceVisitor, SchemaDifferenceWalker } from \"./SchemaDifferenceVisitor\";\nimport { NameMapping, PropertyKey } from \"../Merging/Edits/NameMapping\";\n\n/**\n * Validates the given array of schema differences and returns a list of conflicts if the\n * validation finds violation against rules.\n * @param differences An array of schema differences.\n * @param targetSchema The target schema reference.\n * @param sourceSchema The source schema reference.\n * @returns An array of conflicts found when validating the difference.\n * @internal\n */\nexport async function validateDifferences(differences: AnySchemaDifference[], targetSchema: Schema, sourceSchema: Schema, nameMappings: NameMapping) {\n const visitor = new SchemaDifferenceValidationVisitor(targetSchema, sourceSchema, nameMappings);\n const walker = new SchemaDifferenceWalker(visitor);\n\n await walker.traverse(differences);\n\n return visitor.conflicts;\n}\n\n/**\n * The SchemaDifferenceValidationVisitor class is an implementation of ISchemaDifferenceVisitor and\n * validates the given SchemaDifferences if the violate against some EC Rules.\n */\nclass SchemaDifferenceValidationVisitor implements SchemaDifferenceVisitor {\n\n public readonly conflicts: Array<AnySchemaDifferenceConflict>;\n private readonly _sourceSchema: Schema;\n private readonly _targetSchema: Schema;\n private readonly _nameMappings: NameMapping;\n\n /** Initializes a new instance of SchemaDifferenceValidationVisitor class. */\n constructor(targetSchema: Schema, sourceSchema: Schema, nameMappings: NameMapping) {\n this.conflicts = [];\n this._targetSchema = targetSchema;\n this._sourceSchema = sourceSchema;\n this._nameMappings = nameMappings;\n }\n\n private addConflict(conflict: AnySchemaDifferenceConflict) {\n this.conflicts.push(conflict);\n }\n\n private async getTargetSchemaItem(name: string): Promise<SchemaItem | undefined> {\n const itemKey = new SchemaItemKey(name, this._sourceSchema.schemaKey);\n const mappedKey = this._nameMappings.resolveItemKey(itemKey);\n return this._targetSchema.getItem(mappedKey.name);\n }\n\n private getTargetProperty(itemName: string, propertyName: string): PropertyKey {\n const classKey = new SchemaItemKey(itemName, this._sourceSchema.schemaKey);\n const propertyKey = new PropertyKey(propertyName, classKey);\n return this._nameMappings.resolvePropertyKey(propertyKey);\n }\n\n /**\n * Visitor implementation for handling SchemaDifference.\n * @internal\n */\n public async visitSchemaDifference(_entry: SchemaDifference) {\n }\n\n /**\n * Visitor implementation for handling SchemaReferenceDifference.\n * @internal\n */\n public async visitSchemaReferenceDifference(entry: SchemaReferenceDifference) {\n const sourceSchemaReference = await this._sourceSchema.getReference(entry.difference.name) as Schema;\n const targetSchemaReferenceName = this._targetSchema.getReferenceNameByAlias(sourceSchemaReference.alias);\n if (targetSchemaReferenceName && targetSchemaReferenceName !== sourceSchemaReference.name) {\n return this.addConflict({\n code: ConflictCode.ConflictingReferenceAlias,\n difference: entry,\n source: entry.difference.name,\n target: targetSchemaReferenceName,\n description: \"Target schema already references a different schema with this alias.\",\n });\n }\n\n // The targetSchemaReference can be undefined, if the reference will be added by the source schema.\n // In this case further validation is not needed.\n const targetSchemaReference = await this._targetSchema.getReference(entry.difference.name);\n if(targetSchemaReference === undefined) {\n return;\n }\n\n const sourceSchemaKey = sourceSchemaReference.schemaKey;\n const targetSchemaKey = targetSchemaReference.schemaKey;\n\n if(targetSchemaReference.isDynamic !== sourceSchemaReference.isDynamic) {\n return this.addConflict({\n code: ConflictCode.ConflictingReferenceDynamic,\n difference: entry,\n description: \"Cannot update a schema reference to or from a dynamic schema.\",\n source: sourceSchemaKey.toString(),\n target: targetSchemaKey.toString(),\n });\n }\n\n if(entry.changeType === \"modify\" && !targetSchemaReference.isDynamic && !areCompatible(sourceSchemaKey, targetSchemaKey)) {\n return this.addConflict({\n code: ConflictCode.ConflictingReferenceVersion,\n difference: entry,\n description: \"Schema reference cannot be updated, incompatible versions\",\n source: sourceSchemaKey.toString(),\n target: targetSchemaKey.toString(),\n });\n }\n }\n\n /**\n * Shared schema item validation for all types of AnySchemaItemDifference union.\n */\n private async visitSchemaItemDifference(entry: AnySchemaItemDifference, targetSchemaItem: SchemaItem | undefined) {\n // If the item shall be added, but the target schema already has an item with this name,\n // will produce an ConflictingItemName conflict.\n if (entry.changeType === \"add\" && targetSchemaItem !== undefined) {\n this.addConflict({\n code: ConflictCode.ConflictingItemName,\n difference: entry,\n source: entry.schemaType,\n target: targetSchemaItem.schemaItemType,\n description: \"Target schema already contains a schema item with the name but different type.\",\n });\n return false;\n }\n\n return true;\n }\n\n /**\n * Shared base-class validation for all types of ClassItemDifference union.\n */\n private async visitBaseClassDifference(entry: AnyClassItemDifference, targetClassItem: ECClass) {\n if (\"baseClass\" in entry.difference && entry.difference.baseClass === undefined && targetClassItem.baseClass !== undefined) {\n return this.addConflict({\n code: ConflictCode.RemovingBaseClass,\n difference: entry,\n source: null,\n target: resolveLazyItemFullName(targetClassItem.baseClass),\n description: \"BaseClass cannot be removed, if there has been a baseClass before.\",\n });\n }\n\n if (entry.difference.baseClass === undefined) {\n return;\n }\n\n const sourceBaseClass = await this._sourceSchema.lookupItem(entry.difference.baseClass) as ECClass;\n if (sourceBaseClass.modifier === ECClassModifier.Sealed) {\n return this.addConflict({\n code: ConflictCode.SealedBaseClass,\n difference: entry,\n source: sourceBaseClass.fullName,\n target: resolveLazyItemFullName(targetClassItem.baseClass) || null,\n description: \"BaseClass is sealed.\",\n });\n }\n\n if (targetClassItem.baseClass && !await this.derivedFrom(sourceBaseClass, targetClassItem.baseClass)) {\n return this.addConflict({\n code: ConflictCode.ConflictingBaseClass,\n difference: entry,\n source: sourceBaseClass.fullName,\n target: resolveLazyItemFullName(targetClassItem.baseClass),\n description: \"BaseClass is not valid, source class must derive from target.\",\n });\n }\n }\n\n /**\n * Shared validation for all types of ClassItemDifference union.\n */\n private async visitClassDifference(entry: AnyClassItemDifference) {\n const targetClassItem = await this.getTargetSchemaItem(entry.itemName);\n if (!await this.visitSchemaItemDifference(entry, targetClassItem)) {\n return;\n }\n\n if (entry.changeType === \"modify\" && ECClass.isECClass(targetClassItem)) {\n await this.visitClassModifierDifference(entry, targetClassItem);\n await this.visitBaseClassDifference(entry, targetClassItem);\n }\n }\n\n /**\n * Validation the modifiers of all types of ClassItemDifference union.\n */\n private async visitClassModifierDifference(entry: AnyClassItemDifference, targetClass: ECClass) {\n if (entry.difference.modifier) {\n const changedModifier = parseClassModifier(entry.difference.modifier);\n if (changedModifier !== undefined && changedModifier !== ECClassModifier.None) {\n this.addConflict({\n code: ConflictCode.ConflictingClassModifier,\n difference: entry,\n source: entry.difference.modifier,\n target: classModifierToString(targetClass.modifier),\n description: \"Class has conflicting modifiers.\",\n });\n }\n }\n }\n\n /**\n * Visitor implementation for handling ConstantDifference.\n * @internal\n */\n public async visitConstantDifference(entry: ConstantDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling CustomAttributeClassDifference.\n * @internal\n */\n public async visitCustomAttributeClassDifference(entry: CustomAttributeClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling CustomAttributeDifference.\n * @internal\n */\n public async visitCustomAttributeInstanceDifference(_entry: CustomAttributeDifference) {\n }\n\n /**\n * Visitor implementation for handling EntityClassDifference.\n * @internal\n */\n public async visitEntityClassDifference(entry: EntityClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling EntityClassMixinDifference.\n * @internal\n */\n public async visitEntityClassMixinDifference(entry: EntityClassMixinDifference) {\n for (const addedMixin of entry.difference) {\n // To validate the added mixins, the instance from the source schema it fetched,\n // otherwise validation gets too complicated as the mixin must not be existing in\n // the current target schema, it could also be added to the schema.\n const sourceMixin = await this._sourceSchema.lookupItem(addedMixin) as Mixin;\n const sourceSchemaItem = await this._sourceSchema.getItem(entry.itemName) as EntityClass;\n if (sourceMixin.appliesTo && !await sourceSchemaItem.is(await sourceMixin.appliesTo)) {\n this.addConflict({\n code: ConflictCode.MixinAppliedMustDeriveFromConstraint,\n difference: entry,\n source: addedMixin,\n target: undefined,\n description: \"Mixin cannot applied to this class.\",\n });\n }\n }\n }\n\n /**\n * Visitor implementation for handling EnumerationDifference.\n * @internal\n */\n public async visitEnumerationDifference(entry: EnumerationDifference) {\n const enumeration = await this.getTargetSchemaItem(entry.itemName);\n if (!await this.visitSchemaItemDifference(entry, enumeration)) {\n return;\n }\n\n if (entry.changeType === \"modify\" && Enumeration.isEnumeration(enumeration) && enumeration.type !== undefined) {\n if (entry.difference.type) {\n this.addConflict({\n code: ConflictCode.ConflictingEnumerationType,\n difference: entry,\n source: entry.difference.type,\n target: primitiveTypeToString(enumeration.type),\n description: \"Enumeration has a different primitive type.\",\n });\n }\n }\n }\n\n /**\n * Visitor implementation for handling EnumeratorDifference.\n * @internal\n */\n public async visitEnumeratorDifference(entry: EnumeratorDifference) {\n if (entry.changeType !== \"modify\") {\n return;\n }\n\n const enumeration = await this.getTargetSchemaItem(entry.itemName) as Enumeration;\n const enumerator = enumeration.getEnumeratorByName(entry.path);\n if (!enumerator) {\n return;\n }\n\n if (entry.difference.value) {\n this.addConflict({\n code: ConflictCode.ConflictingEnumeratorValue,\n difference: entry,\n source: entry.difference.value,\n target: enumerator.value,\n description: \"Enumerators must have unique values.\",\n });\n }\n }\n\n /**\n * Visitor implementation for handling FormatDifference.\n * @internal\n */\n public async visitFormatDifference(entry: FormatDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling InvertedUnitDifference.\n * @internal\n */\n public async visitInvertedUnitDifference(entry: InvertedUnitDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling KindOfQuantityDifference.\n * @internal\n */\n public async visitKindOfQuantityDifference(entry: KindOfQuantityDifference) {\n const kindOfQuantity = await this.getTargetSchemaItem(entry.itemName);\n if (!await this.visitSchemaItemDifference(entry, kindOfQuantity)) {\n return;\n }\n\n if (entry.changeType === \"modify\" && KindOfQuantity.isKindOfQuantity(kindOfQuantity)) {\n if (entry.difference.persistenceUnit) {\n this.addConflict({\n code: ConflictCode.ConflictingPersistenceUnit,\n difference: entry,\n source: entry.difference.persistenceUnit,\n target: resolveLazyItemFullName(kindOfQuantity.persistenceUnit),\n description: \"Kind of Quantity has a different persistence unit.\",\n });\n }\n }\n }\n\n /**\n * Visitor implementation for handling MixinClassDifference.\n * @internal\n */\n public async visitMixinDifference(entry: MixinClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling PhenomenonDifference.\n * @internal\n */\n public async visitPhenomenonDifference(entry: PhenomenonDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling ClassPropertyDifference.\n * @internal\n */\n public async visitPropertyDifference(entry: ClassPropertyDifference) {\n const targetClass = await this.getTargetSchemaItem(entry.itemName) as ECClass;\n const propertyKey = this.getTargetProperty(entry.itemName, entry.path);\n const targetProperty = await targetClass.getProperty(propertyKey.propertyName);\n\n const sourceClass = await this._sourceSchema.getItem(entry.itemName) as ECClass;\n const sourceProperty = await sourceClass.getProperty(entry.path) as Property;\n\n // If property shall be added but there is already a property with this name\n // in target, a ConflictingPropertyName is issued.\n if (entry.changeType === \"add\" && targetProperty !== undefined) {\n return this.addConflict({\n code: ConflictCode.ConflictingPropertyName,\n difference: entry,\n source: resolvePropertyTypeName(sourceProperty),\n target: resolvePropertyTypeName(targetProperty),\n description: \"Target class already contains a property with a different type.\",\n });\n }\n\n if (entry.changeType === \"modify\" && targetProperty !== undefined) {\n if (\"kindOfQuantity\" in entry.difference) {\n const sourceKoQ = await sourceProperty.kindOfQuantity;\n const targetKoQ = await targetProperty.kindOfQuantity;\n if(!targetKoQ) {\n return this.addConflict({\n code: ConflictCode.ConflictingPropertyKindOfQuantity,\n difference: entry,\n source: entry.difference.kindOfQuantity,\n target: null,\n description: \"The kind of quantity cannot be assiged if the property did not have a kind of quantities before.\",\n });\n }\n\n if(!sourceKoQ) {\n return this.addConflict({\n code: ConflictCode.ConflictingPropertyKindOfQuantity,\n difference: entry,\n source: null,\n target: resolveLazyItemFullName(targetProperty.kindOfQuantity),\n description: \"The kind of quantity cannot be undefined if the property had a kind of quantities before.\",\n });\n }\n\n if (resolveLazyItemName(sourceKoQ.persistenceUnit) !== resolveLazyItemName(targetKoQ.persistenceUnit)) {\n this.addConflict({\n code: ConflictCode.ConflictingPropertyKindOfQuantityUnit,\n difference: entry,\n source: entry.difference.kindOfQuantity,\n target: resolveLazyItemFullName(targetProperty.kindOfQuantity),\n description: \"The property has different kind of quantities with conflicting units.\",\n });\n }\n }\n }\n }\n\n /**\n * Visitor implementation for handling PropertyCategoryDifference.\n * @internal\n */\n public async visitPropertyCategoryDifference(entry: PropertyCategoryDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling RelationshipClassDifference.\n * @internal\n */\n public async visitRelationshipClassDifference(entry: RelationshipClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling RelationshipConstraintDifference.\n * @internal\n */\n public async visitRelationshipConstraintDifference(_entry: RelationshipConstraintDifference) {\n }\n\n /**\n * Visitor implementation for handling RelationshipConstraintClassDifference.\n * @internal\n */\n public async visitRelationshipConstraintClassDifference(_entry: RelationshipConstraintClassDifference) {\n }\n\n /**\n * Visitor implementation for handling StructClassDifference.\n * @internal\n */\n public async visitStructClassDifference(entry: StructClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling UnitDifference.\n * @internal\n */\n public async visitUnitDifference(entry: UnitDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling UnitSystemDifference.\n * @internal\n */\n public async visitUnitSystemDifference(entry: UnitSystemDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling KindOfQuantityPresentationFormatDifference.\n * @internal\n */\n public async visitKindOfQuantityPresentationFormatDifference(_entry: KindOfQuantityPresentationFormatDifference) {\n }\n\n /**\n * Visitor implementation for handling FormatUnitDifference.\n * @internal\n */\n public async visitFormatUnitDifference(entry: FormatUnitDifference) {\n const targetFormat = await this.getTargetSchemaItem(entry.itemName) as Format;\n\n if (targetFormat.units === undefined) {\n return this.addConflict({\n code: ConflictCode.ConflictingFormatUnit,\n difference: entry,\n source: entry.difference[0].name,\n target: null,\n description: \"The unit cannot be assiged if the format did not have a unit before.\",\n });\n };\n\n const targetUnit = await targetFormat.units[0][0];\n const targetPhenomenon = InvertedUnit.isInvertedUnit(targetUnit)\n ? (await targetUnit.invertsUnit)?.phenomenon\n : targetUnit.phenomenon;\n\n const sourceUnit = await this._sourceSchema.lookupItem(entry.difference[0].name) as Unit | InvertedUnit;\n const sourcePhenomenon = InvertedUnit.isInvertedUnit(sourceUnit)\n ? (await sourceUnit.invertsUnit)?.phenomenon\n : sourceUnit.phenomenon;\n\n if (resolveLazyItemName(targetPhenomenon) !== resolveLazyItemName(sourcePhenomenon)) {\n return this.addConflict({\n code: ConflictCode.ConflictingFormatUnitPhenomenon,\n difference: entry,\n source: entry.difference[0].name,\n target: targetUnit.fullName,\n description: \"Format units has a different phenomenon.\",\n });\n };\n };\n\n /**\n * Visitor implementation for handling FormatUnitLabelDifference.\n * @internal\n */\n public async visitFormatUnitLabelDifference(_entry: FormatUnitLabelDifference) {\n }\n\n /**\n * Recursive synchronous function to figure whether a given class derived from\n * a class with the given baseClass name.\n */\n private async derivedFrom(ecClass: ECClass | undefined, baseClassKey: Readonly<SchemaItemKey>): Promise<boolean> {\n if (ecClass === undefined) {\n return false;\n }\n\n // First check for name which must be same in any case...\n if (ecClass.name === baseClassKey.name) {\n // ... then check if the class is in the same schema as the expected base class...\n if(ecClass.schema.name === baseClassKey.schemaName)\n return true;\n // ... if not, whether it's in the source schema, but then we expect the baseclass\n // to be in the target schema.\n if(ecClass.schema.name === this._sourceSchema.name && baseClassKey.schemaName === this._targetSchema.name)\n return true;\n }\n return this.derivedFrom(await ecClass.baseClass, baseClassKey);\n }\n}\n\n/**\n * Helper method to resolve the schema item name from lazy loaded schema items.\n * @param lazyItem LazyLoaded item\n * @returns The full name of the item or undefined item was not set.\n */\nfunction resolveLazyItemFullName(lazyItem?: LazyLoadedSchemaItem<SchemaItem>) {\n return lazyItem && lazyItem.fullName;\n}\n\n/**\n * Helper method to resolve the schema item name from lazy loaded schema items.\n * @param lazyItem LazyLoaded item\n * @returns The full name of the item or undefined item was not set.\n */\nfunction resolveLazyItemName(lazyItem?: LazyLoadedSchemaItem<SchemaItem>) {\n return lazyItem && lazyItem.name;\n}\n\n/**\n * Helper method to resolve the type name of a property.\n * @param property The property which's type shall be resolved.\n * @returns The (full) name of the properties type.\n */\nfunction resolvePropertyTypeName(property: Property) {\n const [prefix, suffix] = property.isArray() ? [\"[\", \"]\"] : [\"\", \"\"];\n if (property.isEnumeration())\n return `${prefix}${resolveLazyItemFullName(property.enumeration)}${suffix}`;\n if (property.isPrimitive())\n return `${prefix}${primitiveTypeToString(property.primitiveType)}${suffix}`;\n if (property.isStruct())\n return `${prefix}${property.structClass.fullName}${suffix}`;\n if (property.isNavigation())\n return `${prefix}${property.relationshipClass.fullName}${suffix}`;\n return propertyTypeToString(property.propertyType);\n}\n\n/**\n * Checks if the two schemas are compatible. Since the merger will eventually take the most\n * recent schema version, it is sufficient to check if they are write compatible in one direction.\n */\nfunction areCompatible(leftSchemaKey: SchemaKey, rightSchemaKey: SchemaKey): boolean {\n return leftSchemaKey.matches(rightSchemaKey, SchemaMatchType.LatestWriteCompatible)\n || rightSchemaKey.matches(leftSchemaKey, SchemaMatchType.LatestWriteCompatible);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaDifferenceVisitor.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifferenceVisitor.ts"],"names":[],"mappings":";AAAA;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gBAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,yBAAyB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;CACF;AA5ED,wDA4EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"SchemaDifferenceVisitor.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifferenceVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA0D;AAC1D,yDAAgF;AAWhF;;;;GAIG;AACH,MAAa,sBAAsB;IAEhB,QAAQ,CAA0B;IAEnD,kEAAkE;IAClE,YAAY,OAAgC;QAC1C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,QAAQ,CAAC,WAAuC;QAC3D,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;YACnD,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,KAAK,CAAC,UAA+B,EAAE,KAAa,EAAE,KAA4B;QAC9F,QAAQ,UAAU,CAAC,UAAU,EAAE,CAAC;YAC9B,KAAK,mCAAgB,CAAC,MAAM;gBAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACvE,KAAK,mCAAgB,CAAC,eAAe;gBACnC,OAAO,IAAI,CAAC,QAAQ,CAAC,8BAA8B,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAChF,KAAK,kCAAc,CAAC,QAAQ;gBAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,C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AC5F,KAAK,kCAAc,CAAC,WAAW;gBAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,0BAA0B,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC5E,KAAK,kCAAc,CAAC,IAAI;gBACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACrE,KAAK,kCAAc,CAAC,UAAU;gBAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,yBAAyB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;CACF;AA5ED,wDA4EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Differencing\n */\n\nimport { SchemaItemType } from \"@itwin/ecschema-metadata\";\nimport { type AnySchemaDifference, SchemaOtherTypes } from \"./SchemaDifference\";\n\n/**\n * Defines the interface for a visitor that can be used to traverse schema differences.\n * It dynamically creates a method for each schema difference type.\n * @internal\n */\nexport type SchemaDifferenceVisitor = {\n [Difference in AnySchemaDifference as `visit${Difference[\"schemaType\"]}Difference`]: (entry: Difference, index: number, array: AnySchemaDifference[]) => Promise<void>;\n};\n\n/**\n * Implementation of a walker that traverses schema differences and calls the appropriate\n * method on the visitor.\n * @internal\n */\nexport class SchemaDifferenceWalker {\n\n private readonly _visitor: SchemaDifferenceVisitor;\n\n /** Initializes a new instance of SchemaDifferenceWalker class. */\n constructor(visitor: SchemaDifferenceVisitor) {\n this._visitor = visitor;\n }\n\n /**\n * Traverses the schema differences and calls the appropriate method on the visitor.\n * @param differences The differences to traverse.\n */\n public async traverse(differences: Array<AnySchemaDifference>): Promise<void> {\n for (const [index, entry] of differences.entries()) {\n await this.visit(entry, index, differences);\n }\n }\n\n /**\n * Calls the appropriate method on the visitor based on the schema difference type.\n */\n private async visit(difference: AnySchemaDifference, index: number, array: AnySchemaDifference[]) {\n switch (difference.schemaType) {\n case SchemaOtherTypes.Schema:\n return this._visitor.visitSchemaDifference(difference, index, array);\n case SchemaOtherTypes.SchemaReference:\n return this._visitor.visitSchemaReferenceDifference(difference, index, array);\n case SchemaItemType.Constant:\n return this._visitor.visitConstantDifference(difference, index, array);\n case SchemaItemType.CustomAttributeClass:\n return this._visitor.visitCustomAttributeClassDifference(difference, index, array);\n case SchemaOtherTypes.CustomAttributeInstance:\n return this._visitor.visitCustomAttributeInstanceDifference(difference, index, array);\n case SchemaItemType.EntityClass:\n return this._visitor.visitEntityClassDifference(difference, index, array);\n case SchemaOtherTypes.EntityClassMixin:\n return this._visitor.visitEntityClassMixinDifference(difference, index, array);\n case SchemaItemType.Enumeration:\n return this._visitor.visitEnumerationDifference(difference, index, array);\n case SchemaOtherTypes.Enumerator:\n return this._visitor.visitEnumeratorDifference(difference, index, array);\n case SchemaItemType.Format:\n return this._visitor.visitFormatDifference(difference, index, array);\n case SchemaOtherTypes.FormatUnit:\n return this._visitor.visitFormatUnitDifference(difference, index, array);\n case SchemaOtherTypes.FormatUnitLabel:\n return this._visitor.visitFormatUnitLabelDifference(difference, index, array);\n case SchemaItemType.InvertedUnit:\n return this._visitor.visitInvertedUnitDifference(difference, index, array);\n case SchemaItemType.KindOfQuantity:\n return this._visitor.visitKindOfQuantityDifference(difference, index, array);\n case SchemaOtherTypes.KindOfQuantityPresentationFormat:\n return this._visitor.visitKindOfQuantityPresentationFormatDifference(difference, index, array);\n case SchemaItemType.Mixin:\n return this._visitor.visitMixinDifference(difference, index, array);\n case SchemaItemType.Phenomenon:\n return this._visitor.visitPhenomenonDifference(difference, index, array);\n case SchemaOtherTypes.Property:\n return this._visitor.visitPropertyDifference(difference, index, array);\n case SchemaItemType.PropertyCategory:\n return this._visitor.visitPropertyCategoryDifference(difference, index, array);\n case SchemaItemType.RelationshipClass:\n return this._visitor.visitRelationshipClassDifference(difference, index, array);\n case SchemaOtherTypes.RelationshipConstraint:\n return this._visitor.visitRelationshipConstraintDifference(difference, index, array);\n case SchemaOtherTypes.RelationshipConstraintClass:\n return this._visitor.visitRelationshipConstraintClassDifference(difference, index, array);\n case SchemaItemType.StructClass:\n return this._visitor.visitStructClassDifference(difference, index, array);\n case SchemaItemType.Unit:\n return this._visitor.visitUnitDifference(difference, index, array);\n case SchemaItemType.UnitSystem:\n return this._visitor.visitUnitSystemDifference(difference, index, array);\n }\n }\n}\n"]}
|