@itwin/ecschema-editing 5.3.1 → 5.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -1
- 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":"SchemaValidationVisitor.js","sourceRoot":"","sources":["../../../src/Validation/SchemaValidationVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAQH,6CAAiE;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,YAAY,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;IACH,CAAC;IAEO,mBAAmB,CAAkC,cAAgD,EAAE,IAAY;QACzH,IAAI,CAAC,cAAc;YACjB,OAAO;QAET,KAAK,MAAM,WAAW,IAAI,cAAc,EAAE,CAAC;YACzC,IAAI,WAAW,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;gBAClC,OAAO,WAAW,CAAC,IAAI,CAAC;YAC1B,CAAC;QACH,CAAC;QAED,OAAO;IACT,CAAC;IAEO,wBAAwB,CAAC,MAAc,EAAE,OAAiB;QAChE,IAAI,CAAC,OAAO,CAAC,kBAAkB;YAC7B,OAAO,KAAK,CAAC;QAEf,OAAO,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;IAEO,KAAK,CAAC,iBAAiB,CAAkC,UAAyB,EAAE,MAAS,EAAE,cAA4D;QACjK,IAAI,CAAC,UAAU;YACb,OAAO;QAET,IAAI,cAAc,EAAE,CAAC;YACnB,MAAM,YAAY,GAAG,IAAI,CAAC,mBAAmB,CAAC,cAAc,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;YAC/E,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,aAAa,GAAG,MAAM,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;gBAC7D,IAAI,aAAa,EAAE,CAAC;oBAClB,UAAU,CAAC,QAAQ,GAAG,+BAAkB,CAAC,OAAO,CAAC;gBACnD,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACnC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtiBD,0DAsiBC","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 Validation\r\n */\r\n\r\nimport { AnyClass, AnyECType, AnyProperty, Constant, CustomAttribute, CustomAttributeClass, CustomAttributeContainerProps,\r\n EntityClass, Enumeration, Format, InvertedUnit, ISchemaPartVisitor, KindOfQuantity, Mixin,\r\n Phenomenon, PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem,\r\n StructClass, Unit, UnitSystem,\r\n} from \"@itwin/ecschema-metadata\";\r\n\r\nimport { AnyDiagnostic, DiagnosticCategory } from \"./Diagnostic\";\r\nimport { IDiagnosticReporter } from \"./DiagnosticReporter\";\r\nimport { IRuleSet } from \"./Rules\";\r\nimport { IRuleSuppressionMap, IRuleSuppressionSet, ISuppressionRule } from \"./RuleSuppressionSet\";\r\n\r\ninterface RuleSetArray {\r\n [name: string]: IRuleSet;\r\n}\r\n\r\n/**\r\n * A SchemaWalkerVisitor interface implementation that is used to validate ECObjects schemas using\r\n * [[IRuleSet]] objects registered with the instance. Also allows for reporting of [[IDiagnostic]]\r\n * objects returned from failing rules using [[IDiagnosticReporter]] implementations registered\r\n * with an instance of this class.\r\n * @beta\r\n */\r\nexport class SchemaValidationVisitor implements ISchemaPartVisitor {\r\n private _reporters: IDiagnosticReporter[] = [];\r\n private _ruleSets: RuleSetArray = {};\r\n private _ruleSuppressionSet?: IRuleSuppressionSet;\r\n\r\n /** Gets the IRule<AnyClass> objects registered with the visitor. */\r\n public get ruleSets(): RuleSetArray {\r\n return this._ruleSets;\r\n }\r\n\r\n public get suppressionSet(): IRuleSuppressionSet | undefined {\r\n return this._ruleSuppressionSet;\r\n }\r\n\r\n /** Gets the IDiagnosticReporter objects registered with the visitor. */\r\n public get diagnosticReporters(): IDiagnosticReporter[] {\r\n return this._reporters;\r\n }\r\n\r\n /**\r\n * Registers a [[IDiagnosticReporter]] allowing the reporter to be\r\n * notified when a [[IDiagnostic]] is created due to a rule violation.\r\n * @param reporter The [[DiagnosticReporter]] to register.\r\n */\r\n public registerReporter(...reporters: IDiagnosticReporter[]) {\r\n for (const reporter of reporters)\r\n this._reporters.push(reporter);\r\n }\r\n\r\n /**\r\n * Registers a [[IRuleSet]] that will applied during schema traversal.\r\n * @param ruleSet The [[IRuleSet]] to register.\r\n */\r\n public registerRuleSet(ruleSet: IRuleSet) {\r\n if (undefined !== this.ruleSets[ruleSet.name])\r\n throw new Error(`A RuleSet with the name '${ruleSet.name}' has already been registered.`);\r\n\r\n this.ruleSets[ruleSet.name] = ruleSet;\r\n }\r\n\r\n /**\r\n * Registers a [[IRuleSuppressionSet]] that will be applied during schema traversal.\r\n * @param ruleSet The [[IRuleSuppressionSet]] to register.\r\n * Only supports one Rule Suppression Set, if you call it twice it will overwrite the\r\n * previous suppression set\r\n */\r\n public registerRuleSuppressionSet(suppressionSet: IRuleSuppressionSet) {\r\n this._ruleSuppressionSet = suppressionSet;\r\n }\r\n\r\n /**\r\n * Called before schema traversal.\r\n * @param schema a Schema object.\r\n */\r\n public async visitFullSchema(schema: Schema) {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applySchemaRules(schema, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [[SchemaItem]] instance found during schema traversal.\r\n * @param schemaItem a SchemaItem object.\r\n */\r\n public async visitSchemaItem(schemaItem: SchemaItem) {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applySchemaItemRules(schemaItem, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [AnyClass]($ecschema-metadata) instance found during schema traversal.\r\n * @param ecClass an ECClass object.\r\n */\r\n public async visitClass(ecClass: AnyClass): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyClassRules(ecClass, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [AnyProperty]($ecschema-metadata) instance of an ECClass.\r\n * @param property an AnyProperty object.\r\n */\r\n public async visitProperty(property: AnyProperty): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyPropertyRules(property, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [EntityClass]($ecschema-metadata) instance found during schema traversal.\r\n * @param entityClass an EntityClass object.\r\n */\r\n public async visitEntityClass(entity: EntityClass): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyEntityRules(entity, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [StructClass]($ecschema-metadata) instance found during schema traversal.\r\n * @param structClass a StructClass object.\r\n */\r\n public async visitStructClass(struct: StructClass): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyStructRules(struct, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [Mixin]($ecschema-metadata) instance found during schema traversal.\r\n * @param mixin a Mixin object.\r\n */\r\n public async visitMixin(mixin: Mixin): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyMixinRules(mixin, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [RelationshipClass]($ecschema-metadata) instance found during schema traversal.\r\n * @param relationshipClass a RelationshipClass object.\r\n */\r\n public async visitRelationshipClass(relationship: RelationshipClass): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyRelationshipRules(relationship, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [RelationshipConstraint]($ecschema-metadata) of each RelationshipClass found during schema traversal.\r\n * @param relationshipConstraint a RelationshipConstraint object.\r\n */\r\n public async visitRelationshipConstraint(constraint: RelationshipConstraint): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyRelationshipConstraintRules(constraint, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [CustomAttributeClass]($ecschema-metadata) instance found during schema traversal.\r\n * @param customAttributeClass a CustomAttributeClass object.\r\n */\r\n public async visitCustomAttributeClass(customAttribute: CustomAttributeClass): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyCustomAttributeRules(customAttribute, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [CustomAttribute]($ecschema-metadata) container in the schema.\r\n * @param customAttributeContainer a [[CustomAttributeContainerProps]] object.\r\n */\r\n public async visitCustomAttributeContainer(container: CustomAttributeContainerProps): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyCustomAttributeContainerRules(container, this._ruleSets[index]);\r\n\r\n if (undefined === container.customAttributes)\r\n return;\r\n\r\n for (const [, customAttribute] of container.customAttributes) {\r\n for (const index of Object.keys(this._ruleSets)) {\r\n await this.applyCustomAttributeInstanceRules(container, customAttribute, this._ruleSets[index]);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Called for each [Enumeration]($ecschema-metadata) instance found during schema traversal.\r\n * @param enumeration an Enumeration object.\r\n */\r\n public async visitEnumeration(enumeration: Enumeration) {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyEnumerationRules(enumeration, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [KindOfQuantity]($ecschema-metadata) instance found during schema traversal.\r\n * @param koq a KindOfQuantity object.\r\n */\r\n public async visitKindOfQuantity(koq: KindOfQuantity) {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyKindOfQuantityRules(koq, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [PropertyCategory]($ecschema-metadata) instance found during schema traversal.\r\n * @param category a PropertyCategory object.\r\n */\r\n public async visitPropertyCategory(category: PropertyCategory) {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyPropertyCategoryRules(category, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [Format]($ecschema-metadata) instance found during schema traversal.\r\n * @param format a Format object.\r\n */\r\n public async visitFormat(format: Format): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyFormatRules(format, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [Unit]($ecschema-metadata) instance found during schema traversal.\r\n * @param unit a Unit object.\r\n */\r\n public async visitUnit(unit: Unit): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyUnitRules(unit, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [InvertedUnit]($ecschema-metadata) instance found during schema traversal.\r\n * @param invertedUnit an InvertedUnit object.\r\n */\r\n public async visitInvertedUnit(invertedUnit: InvertedUnit): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyInvertedUnitRules(invertedUnit, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [UnitSystem]($ecschema-metadata) instance found during schema traversal.\r\n * @param unitSystem a UnitSystem object.\r\n */\r\n public async visitUnitSystem(unitSystem: UnitSystem): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyUnitSystemRules(unitSystem, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [Phenomenon]($ecschema-metadata) instance found during schema traversal.\r\n * @param phenomena a Phenomenon object.\r\n */\r\n public async visitPhenomenon(phenomenon: Phenomenon): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyPhenomenonRules(phenomenon, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [Constant]($ecschema-metadata) instance found during schema traversal.\r\n * @param constant a Constant object.\r\n */\r\n public async visitConstant(constant: Constant): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyConstantRules(constant, this._ruleSets[index]);\r\n }\r\n\r\n public async applySchemaRules(schema: Schema, ruleSet: IRuleSet) {\r\n if (!ruleSet.schemaRules || this.excludeSchemaFromRuleSet(schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.schemaRules) {\r\n const result = rule(schema);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.schemaRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, schema, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applySchemaItemRules(schemaItem: SchemaItem, ruleSet: IRuleSet) {\r\n if (!ruleSet.schemaItemRules || this.excludeSchemaFromRuleSet(schemaItem.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.schemaItemRules) {\r\n const result = rule(schemaItem);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.schemaItemRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, schemaItem, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyClassRules(ecClass: AnyClass, ruleSet: IRuleSet) {\r\n if (!ruleSet.classRules || this.excludeSchemaFromRuleSet(ecClass.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.classRules) {\r\n const result = rule(ecClass);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.classRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, ecClass, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyPropertyRules(property: AnyProperty, ruleSet: IRuleSet) {\r\n if (!ruleSet.propertyRules || this.excludeSchemaFromRuleSet(property.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.propertyRules) {\r\n const result = rule(property);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.propertyRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, property, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyEntityRules(entityClass: EntityClass, ruleSet: IRuleSet) {\r\n if (!ruleSet.entityClassRules || this.excludeSchemaFromRuleSet(entityClass.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.entityClassRules) {\r\n const result = rule(entityClass);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.entityRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, entityClass, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyStructRules(structClass: StructClass, ruleSet: IRuleSet) {\r\n if (!ruleSet.structClassRules || this.excludeSchemaFromRuleSet(structClass.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.structClassRules) {\r\n const result = rule(structClass);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.structRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, structClass, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyMixinRules(mixin: Mixin, ruleSet: IRuleSet) {\r\n if (!ruleSet.mixinRules || this.excludeSchemaFromRuleSet(mixin.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.mixinRules) {\r\n const result = rule(mixin);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.mixinRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, mixin, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyRelationshipRules(relationship: RelationshipClass, ruleSet: IRuleSet) {\r\n if (!ruleSet.relationshipRules || this.excludeSchemaFromRuleSet(relationship.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.relationshipRules) {\r\n const result = rule(relationship);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.relationshipRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, relationship, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyRelationshipConstraintRules(constraint: RelationshipConstraint, ruleSet: IRuleSet) {\r\n if (!ruleSet.relationshipConstraintRules || this.excludeSchemaFromRuleSet(constraint.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.relationshipConstraintRules) {\r\n const result = rule(constraint);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.relationshipConstraintRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, constraint, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyCustomAttributeRules(customAttribute: CustomAttributeClass, ruleSet: IRuleSet) {\r\n if (!ruleSet.customAttributeClassRules || this.excludeSchemaFromRuleSet(customAttribute.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.customAttributeClassRules) {\r\n const result = rule(customAttribute);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.customAttributeRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, customAttribute, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyCustomAttributeContainerRules(container: CustomAttributeContainerProps, ruleSet: IRuleSet) {\r\n if (!ruleSet.customAttributeContainerRules || this.excludeSchemaFromRuleSet(container.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.customAttributeContainerRules) {\r\n const result = rule(container);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.customAttributeContainerSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, container, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyCustomAttributeInstanceRules(container: CustomAttributeContainerProps, customAttribute: CustomAttribute, ruleSet: IRuleSet) {\r\n if (!ruleSet.customAttributeInstanceRules || this.excludeSchemaFromRuleSet(container.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.customAttributeInstanceRules) {\r\n const result = rule(container, customAttribute);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.customAttributeInstanceSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, container, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyEnumerationRules(enumeration: Enumeration, ruleSet: IRuleSet) {\r\n if (!ruleSet.enumerationRules || this.excludeSchemaFromRuleSet(enumeration.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.enumerationRules) {\r\n const result = rule(enumeration);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.enumerationRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, enumeration, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyKindOfQuantityRules(kindOfQuantity: KindOfQuantity, ruleSet: IRuleSet) {\r\n if (!ruleSet.kindOfQuantityRules || this.excludeSchemaFromRuleSet(kindOfQuantity.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.kindOfQuantityRules) {\r\n const result = rule(kindOfQuantity);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.koqRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, kindOfQuantity, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyPropertyCategoryRules(propertyCategory: PropertyCategory, ruleSet: IRuleSet) {\r\n if (!ruleSet.propertyCategoryRules || this.excludeSchemaFromRuleSet(propertyCategory.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.propertyCategoryRules) {\r\n const result = rule(propertyCategory);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.propertyCategoryRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, propertyCategory, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyFormatRules(format: Format, ruleSet: IRuleSet) {\r\n if (!ruleSet.formatRules || this.excludeSchemaFromRuleSet(format.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.formatRules) {\r\n const result = rule(format);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.formatRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, format, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyUnitRules(unit: Unit, ruleSet: IRuleSet) {\r\n if (!ruleSet.unitRules || this.excludeSchemaFromRuleSet(unit.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.unitRules) {\r\n const result = rule(unit);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.unitRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, unit, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyInvertedUnitRules(invertedUnit: InvertedUnit, ruleSet: IRuleSet) {\r\n if (!ruleSet.invertedUnitRules || this.excludeSchemaFromRuleSet(invertedUnit.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.invertedUnitRules) {\r\n const result = rule(invertedUnit);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.invertedUnitRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, invertedUnit, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyUnitSystemRules(unitSystem: UnitSystem, ruleSet: IRuleSet) {\r\n if (!ruleSet.unitSystemRules || this.excludeSchemaFromRuleSet(unitSystem.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.unitSystemRules) {\r\n const result = rule(unitSystem);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.unitSystemRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, unitSystem, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyPhenomenonRules(phenomenon: Phenomenon, ruleSet: IRuleSet) {\r\n if (!ruleSet.phenomenonRules || this.excludeSchemaFromRuleSet(phenomenon.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.phenomenonRules) {\r\n const result = rule(phenomenon);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.phenomenonRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, phenomenon, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyConstantRules(constant: Constant, ruleSet: IRuleSet) {\r\n if (!ruleSet.constantRules || this.excludeSchemaFromRuleSet(constant.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.constantRules) {\r\n const result = rule(constant);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.constantRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, constant, suppressions);\r\n }\r\n }\r\n }\r\n\r\n private findSuppressionRule<T extends AnyECType, U = object>(suppressionSet: Array<IRuleSuppressionMap<T, U>>, code: string): ISuppressionRule<T, U> | undefined {\r\n if (!suppressionSet)\r\n return;\r\n\r\n for (const suppression of suppressionSet) {\r\n if (suppression.ruleCode === code) {\r\n return suppression.rule;\r\n }\r\n }\r\n\r\n return;\r\n }\r\n\r\n private excludeSchemaFromRuleSet(schema: Schema, ruleSet: IRuleSet): boolean {\r\n if (!ruleSet.schemaExclusionSet)\r\n return false;\r\n\r\n return ruleSet.schemaExclusionSet.includes(schema.name);\r\n }\r\n\r\n private async reportDiagnostics<T extends AnyECType, U = object>(diagnostic: AnyDiagnostic, ecType: T, suppressionMap: Array<IRuleSuppressionMap<T, U>> | undefined) {\r\n if (!diagnostic)\r\n return;\r\n\r\n if (suppressionMap) {\r\n const suppressRule = this.findSuppressionRule(suppressionMap, diagnostic.code);\r\n if (suppressRule) {\r\n const ecSuppression = await suppressRule(diagnostic, ecType);\r\n if (ecSuppression) {\r\n diagnostic.category = DiagnosticCategory.Warning;\r\n }\r\n }\r\n }\r\n\r\n this._reporters.forEach((reporter) => {\r\n reporter.report(diagnostic);\r\n });\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaValidationVisitor.js","sourceRoot":"","sources":["../../../src/Validation/SchemaValidationVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAQH,6CAAiE;AASjE;;;;;;GAMG;AACH,MAAa,uBAAuB;IAC1B,UAAU,GAA0B,EAAE,CAAC;IACvC,SAAS,GAAiB,EAAE,CAAC;IAC7B,mBAAmB,CAAuB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,OAAO;QAET,KAAK,MAAM,WAAW,IAAI,cAAc,EAAE,CAAC;YACzC,IAAI,WAAW,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;gBAClC,OAAO,WAAW,CAAC,IAAI,CAAC;YAC1B,CAAC;QACH,CAAC;QAED,OAAO;IACT,CAAC;IAEO,wBAAwB,CAAC,MAAc,EAAE,OAAiB;QAChE,IAAI,CAAC,OAAO,CAAC,kBAAkB;YAC7B,OAAO,KAAK,CAAC;QAEf,OAAO,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;IAEO,KAAK,CAAC,iBAAiB,CAAkC,UAAyB,EAAE,MAAS,EAAE,cAA4D;QACjK,IAAI,CAAC,UAAU;YACb,OAAO;QAET,IAAI,cAAc,EAAE,CAAC;YACnB,MAAM,YAAY,GAAG,IAAI,CAAC,mBAAmB,CAAC,cAAc,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;YAC/E,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,aAAa,GAAG,MAAM,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;gBAC7D,IAAI,aAAa,EAAE,CAAC;oBAClB,UAAU,CAAC,QAAQ,GAAG,+BAAkB,CAAC,OAAO,CAAC;gBACnD,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACnC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtiBD,0DAsiBC","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 Validation\n */\n\nimport { AnyClass, AnyECType, AnyProperty, Constant, CustomAttribute, CustomAttributeClass, CustomAttributeContainerProps,\n EntityClass, Enumeration, Format, InvertedUnit, ISchemaPartVisitor, KindOfQuantity, Mixin,\n Phenomenon, PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem,\n StructClass, Unit, UnitSystem,\n} from \"@itwin/ecschema-metadata\";\n\nimport { AnyDiagnostic, DiagnosticCategory } from \"./Diagnostic\";\nimport { IDiagnosticReporter } from \"./DiagnosticReporter\";\nimport { IRuleSet } from \"./Rules\";\nimport { IRuleSuppressionMap, IRuleSuppressionSet, ISuppressionRule } from \"./RuleSuppressionSet\";\n\ninterface RuleSetArray {\n [name: string]: IRuleSet;\n}\n\n/**\n * A SchemaWalkerVisitor interface implementation that is used to validate ECObjects schemas using\n * [[IRuleSet]] objects registered with the instance. Also allows for reporting of [[IDiagnostic]]\n * objects returned from failing rules using [[IDiagnosticReporter]] implementations registered\n * with an instance of this class.\n * @beta\n */\nexport class SchemaValidationVisitor implements ISchemaPartVisitor {\n private _reporters: IDiagnosticReporter[] = [];\n private _ruleSets: RuleSetArray = {};\n private _ruleSuppressionSet?: IRuleSuppressionSet;\n\n /** Gets the IRule<AnyClass> objects registered with the visitor. */\n public get ruleSets(): RuleSetArray {\n return this._ruleSets;\n }\n\n public get suppressionSet(): IRuleSuppressionSet | undefined {\n return this._ruleSuppressionSet;\n }\n\n /** Gets the IDiagnosticReporter objects registered with the visitor. */\n public get diagnosticReporters(): IDiagnosticReporter[] {\n return this._reporters;\n }\n\n /**\n * Registers a [[IDiagnosticReporter]] allowing the reporter to be\n * notified when a [[IDiagnostic]] is created due to a rule violation.\n * @param reporter The [[DiagnosticReporter]] to register.\n */\n public registerReporter(...reporters: IDiagnosticReporter[]) {\n for (const reporter of reporters)\n this._reporters.push(reporter);\n }\n\n /**\n * Registers a [[IRuleSet]] that will applied during schema traversal.\n * @param ruleSet The [[IRuleSet]] to register.\n */\n public registerRuleSet(ruleSet: IRuleSet) {\n if (undefined !== this.ruleSets[ruleSet.name])\n throw new Error(`A RuleSet with the name '${ruleSet.name}' has already been registered.`);\n\n this.ruleSets[ruleSet.name] = ruleSet;\n }\n\n /**\n * Registers a [[IRuleSuppressionSet]] that will be applied during schema traversal.\n * @param ruleSet The [[IRuleSuppressionSet]] to register.\n * Only supports one Rule Suppression Set, if you call it twice it will overwrite the\n * previous suppression set\n */\n public registerRuleSuppressionSet(suppressionSet: IRuleSuppressionSet) {\n this._ruleSuppressionSet = suppressionSet;\n }\n\n /**\n * Called before schema traversal.\n * @param schema a Schema object.\n */\n public async visitFullSchema(schema: Schema) {\n for (const index of Object.keys(this._ruleSets))\n await this.applySchemaRules(schema, this._ruleSets[index]);\n }\n\n /**\n * Called for each [[SchemaItem]] instance found during schema traversal.\n * @param schemaItem a SchemaItem object.\n */\n public async visitSchemaItem(schemaItem: SchemaItem) {\n for (const index of Object.keys(this._ruleSets))\n await this.applySchemaItemRules(schemaItem, this._ruleSets[index]);\n }\n\n /**\n * Called for each [AnyClass]($ecschema-metadata) instance found during schema traversal.\n * @param ecClass an ECClass object.\n */\n public async visitClass(ecClass: AnyClass): Promise<void> {\n for (const index of Object.keys(this._ruleSets))\n await this.applyClassRules(ecClass, this._ruleSets[index]);\n }\n\n /**\n * Called for each [AnyProperty]($ecschema-metadata) instance of an ECClass.\n * @param property an AnyProperty object.\n */\n public async visitProperty(property: AnyProperty): Promise<void> {\n for (const index of Object.keys(this._ruleSets))\n await this.applyPropertyRules(property, this._ruleSets[index]);\n }\n\n /**\n * Called for each [EntityClass]($ecschema-metadata) instance found during schema traversal.\n * @param entityClass an EntityClass object.\n */\n public async visitEntityClass(entity: EntityClass): Promise<void> {\n for (const index of Object.keys(this._ruleSets))\n await this.applyEntityRules(entity, this._ruleSets[index]);\n }\n\n /**\n * Called for each [StructClass]($ecschema-metadata) instance found during schema traversal.\n * @param structClass a StructClass object.\n */\n public async visitStructClass(struct: StructClass): Promise<void> {\n for (const index of Object.keys(this._ruleSets))\n await this.applyStructRules(struct, this._ruleSets[index]);\n }\n\n /**\n * Called for each [Mixin]($ecschema-metadata) instance found during schema traversal.\n * @param mixin a Mixin object.\n */\n public async visitMixin(mixin: Mixin): Promise<void> {\n for (const index of Object.keys(this._ruleSets))\n await this.applyMixinRules(mixin, this._ruleSets[index]);\n }\n\n /**\n * Called for each [RelationshipClass]($ecschema-metadata) instance found during schema traversal.\n * @param relationshipClass a RelationshipClass object.\n */\n public async visitRelationshipClass(relationship: RelationshipClass): Promise<void> {\n for (const index of Object.keys(this._ruleSets))\n await this.applyRelationshipRules(relationship, this._ruleSets[index]);\n }\n\n /**\n * Called for each [RelationshipConstraint]($ecschema-metadata) of each RelationshipClass found during schema traversal.\n * @param relationshipConstraint a RelationshipConstraint object.\n */\n public async visitRelationshipConstraint(constraint: RelationshipConstraint): Promise<void> {\n for (const index of Object.keys(this._ruleSets))\n await this.applyRelationshipConstraintRules(constraint, this._ruleSets[index]);\n }\n\n /**\n * Called for each [CustomAttributeClass]($ecschema-metadata) instance found during schema traversal.\n * @param customAttributeClass a CustomAttributeClass object.\n */\n public async visitCustomAttributeClass(customAttribute: CustomAttributeClass): Promise<void> {\n for (const index of Object.keys(this._ruleSets))\n await this.applyCustomAttributeRules(customAttribute, this._ruleSets[index]);\n }\n\n /**\n * Called for each [CustomAttribute]($ecschema-metadata) container in the schema.\n * @param customAttributeContainer a [[CustomAttributeContainerProps]] object.\n */\n public async visitCustomAttributeContainer(container: CustomAttributeContainerProps): Promise<void> {\n for (const index of Object.keys(this._ruleSets))\n await this.applyCustomAttributeContainerRules(container, this._ruleSets[index]);\n\n if (undefined === container.customAttributes)\n return;\n\n for (const [, customAttribute] of container.customAttributes) {\n for (const index of Object.keys(this._ruleSets)) {\n await this.applyCustomAttributeInstanceRules(container, customAttribute, this._ruleSets[index]);\n }\n }\n }\n\n /**\n * Called for each [Enumeration]($ecschema-metadata) instance found during schema traversal.\n * @param enumeration an Enumeration object.\n */\n public async visitEnumeration(enumeration: Enumeration) {\n for (const index of Object.keys(this._ruleSets))\n await this.applyEnumerationRules(enumeration, this._ruleSets[index]);\n }\n\n /**\n * Called for each [KindOfQuantity]($ecschema-metadata) instance found during schema traversal.\n * @param koq a KindOfQuantity object.\n */\n public async visitKindOfQuantity(koq: KindOfQuantity) {\n for (const index of Object.keys(this._ruleSets))\n await this.applyKindOfQuantityRules(koq, this._ruleSets[index]);\n }\n\n /**\n * Called for each [PropertyCategory]($ecschema-metadata) instance found during schema traversal.\n * @param category a PropertyCategory object.\n */\n public async visitPropertyCategory(category: PropertyCategory) {\n for (const index of Object.keys(this._ruleSets))\n await this.applyPropertyCategoryRules(category, this._ruleSets[index]);\n }\n\n /**\n * Called for each [Format]($ecschema-metadata) instance found during schema traversal.\n * @param format a Format object.\n */\n public async visitFormat(format: Format): Promise<void> {\n for (const index of Object.keys(this._ruleSets))\n await this.applyFormatRules(format, this._ruleSets[index]);\n }\n\n /**\n * Called for each [Unit]($ecschema-metadata) instance found during schema traversal.\n * @param unit a Unit object.\n */\n public async visitUnit(unit: Unit): Promise<void> {\n for (const index of Object.keys(this._ruleSets))\n await this.applyUnitRules(unit, this._ruleSets[index]);\n }\n\n /**\n * Called for each [InvertedUnit]($ecschema-metadata) instance found during schema traversal.\n * @param invertedUnit an InvertedUnit object.\n */\n public async visitInvertedUnit(invertedUnit: InvertedUnit): Promise<void> {\n for (const index of Object.keys(this._ruleSets))\n await this.applyInvertedUnitRules(invertedUnit, this._ruleSets[index]);\n }\n\n /**\n * Called for each [UnitSystem]($ecschema-metadata) instance found during schema traversal.\n * @param unitSystem a UnitSystem object.\n */\n public async visitUnitSystem(unitSystem: UnitSystem): Promise<void> {\n for (const index of Object.keys(this._ruleSets))\n await this.applyUnitSystemRules(unitSystem, this._ruleSets[index]);\n }\n\n /**\n * Called for each [Phenomenon]($ecschema-metadata) instance found during schema traversal.\n * @param phenomena a Phenomenon object.\n */\n public async visitPhenomenon(phenomenon: Phenomenon): Promise<void> {\n for (const index of Object.keys(this._ruleSets))\n await this.applyPhenomenonRules(phenomenon, this._ruleSets[index]);\n }\n\n /**\n * Called for each [Constant]($ecschema-metadata) instance found during schema traversal.\n * @param constant a Constant object.\n */\n public async visitConstant(constant: Constant): Promise<void> {\n for (const index of Object.keys(this._ruleSets))\n await this.applyConstantRules(constant, this._ruleSets[index]);\n }\n\n public async applySchemaRules(schema: Schema, ruleSet: IRuleSet) {\n if (!ruleSet.schemaRules || this.excludeSchemaFromRuleSet(schema, ruleSet))\n return;\n\n for (const rule of ruleSet.schemaRules) {\n const result = rule(schema);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.schemaRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, schema, suppressions);\n }\n }\n }\n\n public async applySchemaItemRules(schemaItem: SchemaItem, ruleSet: IRuleSet) {\n if (!ruleSet.schemaItemRules || this.excludeSchemaFromRuleSet(schemaItem.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.schemaItemRules) {\n const result = rule(schemaItem);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.schemaItemRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, schemaItem, suppressions);\n }\n }\n }\n\n public async applyClassRules(ecClass: AnyClass, ruleSet: IRuleSet) {\n if (!ruleSet.classRules || this.excludeSchemaFromRuleSet(ecClass.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.classRules) {\n const result = rule(ecClass);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.classRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, ecClass, suppressions);\n }\n }\n }\n\n public async applyPropertyRules(property: AnyProperty, ruleSet: IRuleSet) {\n if (!ruleSet.propertyRules || this.excludeSchemaFromRuleSet(property.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.propertyRules) {\n const result = rule(property);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.propertyRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, property, suppressions);\n }\n }\n }\n\n public async applyEntityRules(entityClass: EntityClass, ruleSet: IRuleSet) {\n if (!ruleSet.entityClassRules || this.excludeSchemaFromRuleSet(entityClass.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.entityClassRules) {\n const result = rule(entityClass);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.entityRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, entityClass, suppressions);\n }\n }\n }\n\n public async applyStructRules(structClass: StructClass, ruleSet: IRuleSet) {\n if (!ruleSet.structClassRules || this.excludeSchemaFromRuleSet(structClass.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.structClassRules) {\n const result = rule(structClass);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.structRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, structClass, suppressions);\n }\n }\n }\n\n public async applyMixinRules(mixin: Mixin, ruleSet: IRuleSet) {\n if (!ruleSet.mixinRules || this.excludeSchemaFromRuleSet(mixin.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.mixinRules) {\n const result = rule(mixin);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.mixinRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, mixin, suppressions);\n }\n }\n }\n\n public async applyRelationshipRules(relationship: RelationshipClass, ruleSet: IRuleSet) {\n if (!ruleSet.relationshipRules || this.excludeSchemaFromRuleSet(relationship.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.relationshipRules) {\n const result = rule(relationship);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.relationshipRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, relationship, suppressions);\n }\n }\n }\n\n public async applyRelationshipConstraintRules(constraint: RelationshipConstraint, ruleSet: IRuleSet) {\n if (!ruleSet.relationshipConstraintRules || this.excludeSchemaFromRuleSet(constraint.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.relationshipConstraintRules) {\n const result = rule(constraint);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.relationshipConstraintRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, constraint, suppressions);\n }\n }\n }\n\n public async applyCustomAttributeRules(customAttribute: CustomAttributeClass, ruleSet: IRuleSet) {\n if (!ruleSet.customAttributeClassRules || this.excludeSchemaFromRuleSet(customAttribute.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.customAttributeClassRules) {\n const result = rule(customAttribute);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.customAttributeRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, customAttribute, suppressions);\n }\n }\n }\n\n public async applyCustomAttributeContainerRules(container: CustomAttributeContainerProps, ruleSet: IRuleSet) {\n if (!ruleSet.customAttributeContainerRules || this.excludeSchemaFromRuleSet(container.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.customAttributeContainerRules) {\n const result = rule(container);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.customAttributeContainerSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, container, suppressions);\n }\n }\n }\n\n public async applyCustomAttributeInstanceRules(container: CustomAttributeContainerProps, customAttribute: CustomAttribute, ruleSet: IRuleSet) {\n if (!ruleSet.customAttributeInstanceRules || this.excludeSchemaFromRuleSet(container.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.customAttributeInstanceRules) {\n const result = rule(container, customAttribute);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.customAttributeInstanceSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, container, suppressions);\n }\n }\n }\n\n public async applyEnumerationRules(enumeration: Enumeration, ruleSet: IRuleSet) {\n if (!ruleSet.enumerationRules || this.excludeSchemaFromRuleSet(enumeration.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.enumerationRules) {\n const result = rule(enumeration);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.enumerationRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, enumeration, suppressions);\n }\n }\n }\n\n public async applyKindOfQuantityRules(kindOfQuantity: KindOfQuantity, ruleSet: IRuleSet) {\n if (!ruleSet.kindOfQuantityRules || this.excludeSchemaFromRuleSet(kindOfQuantity.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.kindOfQuantityRules) {\n const result = rule(kindOfQuantity);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.koqRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, kindOfQuantity, suppressions);\n }\n }\n }\n\n public async applyPropertyCategoryRules(propertyCategory: PropertyCategory, ruleSet: IRuleSet) {\n if (!ruleSet.propertyCategoryRules || this.excludeSchemaFromRuleSet(propertyCategory.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.propertyCategoryRules) {\n const result = rule(propertyCategory);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.propertyCategoryRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, propertyCategory, suppressions);\n }\n }\n }\n\n public async applyFormatRules(format: Format, ruleSet: IRuleSet) {\n if (!ruleSet.formatRules || this.excludeSchemaFromRuleSet(format.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.formatRules) {\n const result = rule(format);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.formatRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, format, suppressions);\n }\n }\n }\n\n public async applyUnitRules(unit: Unit, ruleSet: IRuleSet) {\n if (!ruleSet.unitRules || this.excludeSchemaFromRuleSet(unit.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.unitRules) {\n const result = rule(unit);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.unitRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, unit, suppressions);\n }\n }\n }\n\n public async applyInvertedUnitRules(invertedUnit: InvertedUnit, ruleSet: IRuleSet) {\n if (!ruleSet.invertedUnitRules || this.excludeSchemaFromRuleSet(invertedUnit.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.invertedUnitRules) {\n const result = rule(invertedUnit);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.invertedUnitRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, invertedUnit, suppressions);\n }\n }\n }\n\n public async applyUnitSystemRules(unitSystem: UnitSystem, ruleSet: IRuleSet) {\n if (!ruleSet.unitSystemRules || this.excludeSchemaFromRuleSet(unitSystem.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.unitSystemRules) {\n const result = rule(unitSystem);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.unitSystemRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, unitSystem, suppressions);\n }\n }\n }\n\n public async applyPhenomenonRules(phenomenon: Phenomenon, ruleSet: IRuleSet) {\n if (!ruleSet.phenomenonRules || this.excludeSchemaFromRuleSet(phenomenon.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.phenomenonRules) {\n const result = rule(phenomenon);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.phenomenonRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, phenomenon, suppressions);\n }\n }\n }\n\n public async applyConstantRules(constant: Constant, ruleSet: IRuleSet) {\n if (!ruleSet.constantRules || this.excludeSchemaFromRuleSet(constant.schema, ruleSet))\n return;\n\n for (const rule of ruleSet.constantRules) {\n const result = rule(constant);\n for await (const diagnostic of result) {\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.constantRuleSuppressions : undefined;\n await this.reportDiagnostics(diagnostic, constant, suppressions);\n }\n }\n }\n\n private findSuppressionRule<T extends AnyECType, U = object>(suppressionSet: Array<IRuleSuppressionMap<T, U>>, code: string): ISuppressionRule<T, U> | undefined {\n if (!suppressionSet)\n return;\n\n for (const suppression of suppressionSet) {\n if (suppression.ruleCode === code) {\n return suppression.rule;\n }\n }\n\n return;\n }\n\n private excludeSchemaFromRuleSet(schema: Schema, ruleSet: IRuleSet): boolean {\n if (!ruleSet.schemaExclusionSet)\n return false;\n\n return ruleSet.schemaExclusionSet.includes(schema.name);\n }\n\n private async reportDiagnostics<T extends AnyECType, U = object>(diagnostic: AnyDiagnostic, ecType: T, suppressionMap: Array<IRuleSuppressionMap<T, U>> | undefined) {\n if (!diagnostic)\n return;\n\n if (suppressionMap) {\n const suppressRule = this.findSuppressionRule(suppressionMap, diagnostic.code);\n if (suppressRule) {\n const ecSuppression = await suppressRule(diagnostic, ecType);\n if (ecSuppression) {\n diagnostic.category = DiagnosticCategory.Warning;\n }\n }\n }\n\n this._reporters.forEach((reporter) => {\n reporter.report(diagnostic);\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaWalker.js","sourceRoot":"","sources":["../../../src/Validation/SchemaWalker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,gEAEkC;AAElC;;;;GAIG;AACH,MAAa,YAAY;IACf,cAAc,CAA4B;IAElD,2GAA2G;IAC3G,sEAAsE;IAC9D,OAAO,CAAU;IAEzB;;;OAGG;IACH,YAAY,OAA2B;QACrC,IAAI,CAAC,cAAc,GAAG,IAAI,6CAAyB,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,cAAc,CAAC,MAAc;QACxC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAEtB,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC9C,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAElD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YACxC,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAC,UAAsB;QACrD,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAEtD,IAAI,2BAAO,CAAC,SAAS,CAAC,UAAU,CAAC;YAC/B,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAEO,KAAK,CAAC,aAAa,CAAC,OAAgB;QAC1C,KAAK,MAAM,QAAQ,IAAI,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;YACzD,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QACtD,CAAC;QAED,IAAI,OAAO,CAAC,cAAc,KAAK,kCAAc,CAAC,iBAAiB,EAAE,CAAC;YAChE,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAE,OAA6B,CAAC,MAAM,CAAC,CAAC;YACjF,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAE,OAA6B,CAAC,MAAM,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;CACF;AA/CD,oCA+CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"SchemaWalker.js","sourceRoot":"","sources":["../../../src/Validation/SchemaWalker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,gEAEkC;AAElC;;;;GAIG;AACH,MAAa,YAAY;IACf,cAAc,CAA4B;IAElD,2GAA2G;IAC3G,sEAAsE;IAC9D,OAAO,CAAU;IAEzB;;;OAGG;IACH,YAAY,OAA2B;QACrC,IAAI,CAAC,cAAc,GAAG,IAAI,6CAAyB,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,cAAc,CAAC,MAAc;QACxC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAEtB,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC9C,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAElD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YACxC,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAC,UAAsB;QACrD,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAEtD,IAAI,2BAAO,CAAC,SAAS,CAAC,UAAU,CAAC;YAC/B,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAEO,KAAK,CAAC,aAAa,CAAC,OAAgB;QAC1C,KAAK,MAAM,QAAQ,IAAI,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;YACzD,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QACtD,CAAC;QAED,IAAI,OAAO,CAAC,cAAc,KAAK,kCAAc,CAAC,iBAAiB,EAAE,CAAC;YAChE,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAE,OAA6B,CAAC,MAAM,CAAC,CAAC;YACjF,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAE,OAA6B,CAAC,MAAM,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;CACF;AA/CD,oCA+CC","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\nimport { ECClass, ISchemaPartVisitor, RelationshipClass, Schema, SchemaItem,\n SchemaItemType, SchemaPartVisitorDelegate,\n} from \"@itwin/ecschema-metadata\";\n\n/**\n * The purpose of this class is to traverse a given schema, allowing clients to hook into\n * the traversal process via Visitors to allow for custom processing of the schema elements.\n * @internal\n */\nexport class SchemaWalker {\n private _visitorHelper: SchemaPartVisitorDelegate;\n\n // This is a cache of the schema we are traversing. The schema also exists within the _context but in order\n // to not have to go back to the context every time we use this cache.\n private _schema?: Schema;\n\n /**\n * Initializes a new SchemaWalker instance.\n * @param visitor An ISchemaWalkerVisitor implementation whose methods will be called during schema traversal.\n */\n constructor(visitor: ISchemaPartVisitor) {\n this._visitorHelper = new SchemaPartVisitorDelegate(visitor);\n }\n\n /**\n * Traverses the given Schema, calling ISchemaWalkerVisitor methods along the way.\n * @param schema The Schema to traverse.\n */\n public async traverseSchema(schema: Schema): Promise<Schema> {\n this._schema = schema;\n\n await this._visitorHelper.visitSchema(schema);\n await this._visitorHelper.visitSchemaPart(schema);\n\n for (const item of this._schema.getItems())\n await this.traverseSchemaItem(item);\n return schema;\n }\n\n private async traverseSchemaItem(schemaItem: SchemaItem): Promise<void> {\n await this._visitorHelper.visitSchemaPart(schemaItem);\n\n if (ECClass.isECClass(schemaItem))\n await this.traverseClass(schemaItem);\n }\n\n private async traverseClass(ecClass: ECClass): Promise<void> {\n for (const property of await ecClass.getProperties(true)) {\n await this._visitorHelper.visitSchemaPart(property);\n }\n\n if (ecClass.schemaItemType === SchemaItemType.RelationshipClass) {\n await this._visitorHelper.visitSchemaPart((ecClass as RelationshipClass).source);\n await this._visitorHelper.visitSchemaPart((ecClass as RelationshipClass).target);\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecschema-editing.js","sourceRoot":"","sources":["../../src/ecschema-editing.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;AAE/F,0DAAwC;AACxC,kEAAgD;AAChD,gDAA+E;AAAtE,0GAAA,eAAe,OAAA;AAAE,sGAAA,WAAW,OAAA;AAAE,oGAAA,SAAS,OAAA;AAChD,yEAAuD;AACvD,qDAAmC;AACnC,uEAAqD;AACrD,4DAA0C;AAC1C,wEAAsD;AACtD,6DAA2C;AAC3C,8DAA4C;AAC5C,qEAAmD;AACnD,mDAAiC;AACjC,sDAAoC;AAEpC,gEAA+D;AAAtD,kHAAA,eAAe,OAAA;AACxB,kEAAgD;AAChD,iEAA+C;AAC/C,wDAAsC;AACtC,uDAAqC;AACrC,uDAAsD;AAA7C,4GAAA,YAAY,OAAA;AACrB,8DAA4C;AAE5C;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"ecschema-editing.js","sourceRoot":"","sources":["../../src/ecschema-editing.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;AAE/F,0DAAwC;AACxC,kEAAgD;AAChD,gDAA+E;AAAtE,0GAAA,eAAe,OAAA;AAAE,sGAAA,WAAW,OAAA;AAAE,oGAAA,SAAS,OAAA;AAChD,yEAAuD;AACvD,qDAAmC;AACnC,uEAAqD;AACrD,4DAA0C;AAC1C,wEAAsD;AACtD,6DAA2C;AAC3C,8DAA4C;AAC5C,qEAAmD;AACnD,mDAAiC;AACjC,sDAAoC;AAEpC,gEAA+D;AAAtD,kHAAA,eAAe,OAAA;AACxB,kEAAgD;AAChD,iEAA+C;AAC/C,wDAAsC;AACtC,uDAAqC;AACrC,uDAAsD;AAA7C,4GAAA,YAAY,OAAA;AACrB,8DAA4C;AAE5C;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","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\nexport * from \"./Validation/Diagnostic\";\nexport * from \"./Validation/DiagnosticReporter\";\nexport { DiagnosticCodes, Diagnostics, ECRuleSet } from \"./Validation/ECRules\";\nexport * from \"./Validation/LoggingDiagnosticReporter\";\nexport * from \"./Validation/Rules\";\nexport * from \"./Validation/SchemaValidationVisitor\";\nexport * from \"./Validation/SchemaWalker\";\nexport * from \"./Validation/SchemaCompareDiagnostics\";\nexport * from \"./Validation/SchemaChanges\";\nexport * from \"./Validation/SchemaComparer\";\nexport * from \"./Validation/SchemaCompareReporter\";\nexport * from \"./Editing/Editor\";\nexport * from \"./Editing/Exception\";\nexport { ISuppressionRule, IRuleSuppressionSet, IRuleSuppressionMap } from \"./Validation/RuleSuppressionSet\";\nexport { SchemaValidater } from \"./Validation/SchemaValidater\";\nexport * from \"./Differencing/SchemaDifference\";\nexport * from \"./Differencing/SchemaConflicts\";\nexport * from \"./Differencing/Errors\";\nexport * from \"./Differencing/Utils\";\nexport { SchemaMerger } from \"./Merging/SchemaMerger\";\nexport * from \"./Merging/Edits/SchemaEdits\";\n\n/** @docs-package-description\n * The ecschema-editing package contains classes for validating, and editing ECSchemas that can be used in both [frontend]($docs/learning/frontend/index.md) and [backend]($docs/learning/backend/index.md).\n */\n/**\n * @docs-group-description Editing\n * Set of classes used to perform editing of ECSchemas.\n */\n/**\n * @docs-group-description Diagnostic\n * Set of classes to categorize and manage ECSchema validation results.\n */\n/**\n * @docs-group-description Validation\n * Set of classes used to perform validation on ECSchemas.\n */\n/**\n * @docs-group-description Comparison\n * Set of classes to enable comparison of ECSchemas.\n */\n/**\n * @docs-group-description Merging\n * Set of classes used to merge schemas.\n */\n/**\n * @docs-group-description Differencing\n * Set of classes used to perform differences between ECSchemas.\n */\n"]}
|
|
@@ -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,MAAM,OAAO,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","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"Errors.js","sourceRoot":"","sources":["../../../src/Differencing/Errors.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAKH;;;GAGG;AACH,MAAM,OAAO,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","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,MAAM,CAAN,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,KAAZ,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,MAAM,CAAN,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,KAAZ,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":"SchemaDiagnosticVisitor.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDiagnosticVisitor.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAEqE,QAAQ,EAClF,sBAAsB,EAA+B,MAAM,EAAE,UAAU,GACxE,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAcL,gBAAgB,GAEjB,MAAM,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,OAAO,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,UAAU,CAAC,IAAI,EAAE,CAAC;YACxB,KAAK,kBAAkB,CAAC,WAAW;gBACjC,OAAO,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,CAAC;YAEvD,KAAK,kBAAkB,CAAC,sBAAsB;gBAC5C,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YACtD,KAAK,kBAAkB,CAAC,oBAAoB;gBAC1C,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YAEzD,KAAK,kBAAkB,CAAC,iBAAiB;gBACvC,OAAO,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC;YAEjD,KAAK,kBAAkB,CAAC,eAAe,CAA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;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":["/*---------------------------------------------------------------------------------------------\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,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAEqE,QAAQ,EAClF,sBAAsB,EAA+B,MAAM,EAAE,UAAU,GACxE,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAcL,gBAAgB,GAEjB,MAAM,oBAAo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AC;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;AAGH,OAAO,EAAkB,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAGQ,UAAU,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAsBxE;;;GAGG;AACH,MAAM,CAAN,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,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,EAAE,CAAC;YACb,IAAI,UAAU,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;AAGH,OAAO,EAAkB,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAGQ,UAAU,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAsBxE;;;GAGG;AACH,MAAM,CAAN,IAAY,gBAYX;AAZD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,uDAAmC,CAAA;IACnC,yCAAqB,CAAA;IACrB,6CAAyB,CAAA;IACzB,uEAA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O,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,UAAU,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"]}
|