/** @packageDocumentation * @module Comparison */ import { Schema, SchemaItem, SchemaItemType } from "@itwin/ecschema-metadata"; import { AnyDiagnostic } from "./Diagnostic"; /** * Possible change types used to categorize ISchemaChange objects. * @alpha */ export declare enum ChangeType { Delta = 0, Missing = 1 } /** * Interface that represents any change reported * between two schemas. * @alpha */ export interface ISchemaChange { /** The diagnostic containing the data related to the change. */ diagnostic: AnyDiagnostic; /** The highest level SchemaItem that this change ultimately belong to. */ topLevelSchemaItem: SchemaItem | Schema; /** The ChangeType (Delta or Missing) for this change. */ changeType: ChangeType; /** Returns a string representation of the change. */ toString(): string; } /** * Interface that represents an object that manages * a related set of ISchemaChange objects. * @alpha */ export interface ISchemaChanges { schema: Schema; ecTypeName: string; addChange(change: ISchemaChange): void; } /** * Allows an ISchemaChanges implementation to be dynamically constructed in addChangeToMap. */ interface SchemaChangesConstructor { new (schema: Schema, ecTypeName: string): ISchemaChanges; } /** * An ISchemaChange implementation meant to be used as the base class * for all other ISchemaChange implementations. * @alpha */ export declare abstract class BaseSchemaChange implements ISchemaChange { private _diagnostic; private _changeType; /** * Initializes a new BaseSchemaChange instance. * @param diagnostic The diagnostic holding the change data. */ constructor(diagnostic: AnyDiagnostic); /** Gets the diagnostic holding the information about the schema change. */ get diagnostic(): AnyDiagnostic; /** * Returns the SchemaItem that this change ultimately belongs to. For example, * for a CustomAttributeInstanceClassMissing diagnostic reported on a RelationshipConstraint, * the top-level SchemaItem would be the Relationship. */ abstract get topLevelSchemaItem(): SchemaItem | Schema; /** * Gets the change type (Delta or Missing) for the change. If not previously * set, the defaultChangeType value will be returned. */ get changeType(): ChangeType; set changeType(changeType: ChangeType); /** The default ChangeType (Delta or Missing). */ abstract get defaultChangeType(): ChangeType; /** Gets a string representation of the schema change. */ abstract toString(): string; /** * Gets the name or fullName from an EC type that is in the args array at * the specified index. Performs validation based on the given parameters. * @param index The index in the args array to find the EC type. * @param args The collection of arguments received in the diagnostics. * @param allowUndefined Specifies that undefined values are allowed. * @param fullName Flag indicating that the fullName should be returned rather than the name. */ protected getNameFromArgument(index: number, allowUndefined?: boolean, fullName?: boolean): string; /** * Gets a string from the diagnostics arguments at the given index. If the value is undefined, * the string 'undefined' will be returned. * @param index The index in the args array to find the property value. */ protected getStringFromArgument(index: number): string; /** * Helper method to retrieve a value from the diagnostic arguments, performing validation. * @param index THe index in the diagnostic arguments array. */ protected getValueFromArgument(index: number): any; } /** * Base class for all ISchemaChanges implementations. * @alpha */ export declare abstract class BaseSchemaChanges implements ISchemaChanges { private _ecTypeName; private _schema; private _propertyValueChanges; /** * Initializes a new BaseSchemaChanges instance. * @param schema The schema containing the changes. * @param anyECTypeName The name of the EC type. */ constructor(schema: Schema, anyECTypeName: string); /** Gets the array of PropertyValueChange instances. */ get propertyValueChanges(): PropertyValueChange[]; /** Gets the name of the EC type associated with these schema changes. */ get ecTypeName(): string; /** Gets the schema to which these changes are associated. */ get schema(): Schema; /** * Adds a new ISchemaChange to a collection determined by the implementation. * @param change */ abstract addChange(change: ISchemaChange): void; /** * Helper method that adds a new ISchemaChange to a Map whose values are ISchemaChanges. The changesType will * be used to create a new ISchemaChanges instance if the changes collection does not exist in the Map. * @param changes The ISchemaChanges Map to which to add the ISchemaChange. * @param changesType The constructor of the ISchemaChanges. Called if the ISchemaChanges instance does not exist in the Map. * @param change The ISchemaChange to add. * @param changeKey The key used to identify the ISchemaChanges in the Map (typically the name of the EC type, ie. SchemaItem.name). */ protected addChangeToMap(changes: Map, changesType: SchemaChangesConstructor, change: ISchemaChange, changeKey: string): void; /** * Helper method to determine if the diagnostic is a property value change delta for this ISchemaChanges instance. * @param diagnostic The change diagnostic. * @param ecTypeName The name of the EC type as determined by the implementation. */ protected isPropertyValueChangeForThis(diagnostic: AnyDiagnostic, ecTypeName: string): boolean; /** * Helper method to determine if the diagnostic is a CustomAttributeInstance class change for this ISchemaChanges instance. * @param diagnostic The change diagnostic. * @param ecTypeName The name of the EC type as determined by the implementation. */ protected isCAContainerChangeForThis(diagnostic: AnyDiagnostic, ecTypeName: string | undefined): boolean; } /** * An ISchemaChanges implementation for managing schema comparison diagnostics at the Schema level. * @alpha */ export declare class SchemaChanges extends BaseSchemaChanges { private _diagnostics; private _missingSchemaReferences; private _schemaReferenceDeltas; private _customAttributeChanges; private _classChanges; private _entityClassChanges; private _relationshipClassChanges; private _schemaItemChanges; private _enumerationChanges; private _kindOfQuantityChanges; private _formatChanges; /** * Initializes a new SchemaChanges instance. * @param schema The schema containing the changes. */ constructor(schema: Schema); /** Gets the MissingSchemaReferences collection. */ get missingSchemaReferences(): SchemaReferenceMissing[]; /** Gets the SchemaReferenceChange collection. */ get schemaReferenceDeltas(): SchemaReferenceDelta[]; /** Gets the CustomAttributeContainerChanges Map. */ get customAttributeChanges(): Map; /** Gets the ClassChanges Map. */ get classChanges(): Map; /** Gets the EntityClassChanges Map. */ get entityClassChanges(): Map; /** Gets the RelationshipClassChanges Map. */ get relationshipClassChanges(): Map; /** Gets the SchemaItemChanges Map. */ get schemaItemChanges(): Map; /** Gets the EnumerationChanges Map. */ get enumerationChanges(): Map; /** Gets the KindOfQuantityChanges Map. */ get kindOfQuantityChanges(): Map; /** Gets the FormatChanges Map. */ get formatChanges(): Map; /** Gets all the change diagnostics that have been added to instance. */ get allDiagnostics(): AnyDiagnostic[]; /** * Adds a new change diagnostic for the schema. * @param diagnostic */ addDiagnostic(diagnostic: AnyDiagnostic): void; /** * Adds the change to the appropriate change collection at this level or adds the change * to a Map of child changes will which propagate the change to lower levels. Typically * any 'addChangeToMap' type method will then call addChange to add the ISchemaChange to * the ISchemaChanges instance at that level. * @param change The ISchemaChange to add. */ addChange(change: ISchemaChange): void; private getSchemaNameFromChange; /** This creates ISchemaChange instances based on the change diagnostic specified. */ private createChangeFromDiagnostic; private addChangeToSchemaItemMap; private addChangeToClassMap; private addChangeToEntityClassMap; private addChangeToRelationshipClassMap; private addChangeToEnumerationMap; private addChangeToKOQMap; private addChangeToFormatMap; } /** * An ISchemaChanges implementation for managing schema comparison diagnostics at the SchemaItem level. * @alpha */ export declare class SchemaItemChanges extends BaseSchemaChanges { private _schemaItemType; private _schemaItemMissing?; /** * Initializes a new SchemaItemChanges instance. * @param schema The Schema containing the change. * @param schemaItemName The name of the EC type associated with the change. * @param schemaItemType The SchemaItemType of the EC type. */ constructor(schema: Schema, schemaItemName: string, schemaItemType: SchemaItemType); /** Gets the SchemaItemType of the SchemaItem associated with the changes. */ get schemaItemType(): SchemaItemType; /** Gets the SchemaItemMissing change. Maybe undefined. */ get schemaItemMissing(): SchemaItemMissing | undefined; /** * Adds the change to the appropriate change collection at this level or adds the change * to a Map of child changes will which propagate the change to lower levels. * @param change The ISchemaChange to add. */ addChange(change: ISchemaChange): void; protected getSchemaItemNameFromChange(change: ISchemaChange): string | undefined; } /** * An ISchemaChanges implementation for managing schema comparison diagnostics at the Class level. * @alpha */ export declare class ClassChanges extends SchemaItemChanges { private _baseClassDelta?; private _propertyChanges; private _customAttributeChanges; /** Gets the BaseClassDelta change. Maybe undefined. */ get baseClassDelta(): BaseClassDelta | undefined; /** Gets the PropertyChanges Map. */ get propertyChanges(): Map; /** Gets the Map of CustomAttributeContainerChanges. */ get customAttributeChanges(): Map; /** * Adds the change to the appropriate change collection at this level or adds the change * to a Map of child changes will which propagate the change to lower levels. * @param change The ISchemaChange to add. */ addChange(change: ISchemaChange): void; } /** * An ISchemaChanges implementation for managing schema comparison diagnostics at the Class level. * @alpha */ export declare class EntityClassChanges extends ClassChanges { private _entityMixinChanges; /** Gets the EntityMixinChanges Map. */ get entityMixinChanges(): Map; /** * Adds the change to the appropriate change collection at this level or adds the change * to a Map of child changes will which propagate the change to lower levels. * @param change The ISchemaChange to add. */ addChange(change: ISchemaChange): void; } /** * An ISchemaChanges implementation for managing schema comparison diagnostics for RelationshipClasses. * @alpha */ export declare class RelationshipClassChanges extends ClassChanges { private _sourceConstraintChanges; private _targetConstraintChanges; /** Gets the source RelationshipConstraintChanges Map. */ get sourceConstraintChanges(): Map; /** Gets the target RelationshipConstraintChanges Map. */ get targetConstraintChanges(): Map; /** * Adds the change to the appropriate change collection at this level or adds the change * to a Map of child changes will which propagate the change to lower levels. * @param change The ISchemaChange to add. */ addChange(change: ISchemaChange): void; } /** * An ISchemaChanges implementation for managing schema comparison diagnostics at the Property level. * @alpha */ export declare class PropertyChanges extends BaseSchemaChanges { private _propertyMissing?; private _customAttributeChanges; /** Gets the PropertyMissing change. Maybe undefined. */ get propertyMissing(): PropertyMissing | undefined; /** Gets the CustomAttributeContainerChanges Map. */ get customAttributeChanges(): Map; /** * Adds the change to the appropriate change collection at this level or adds the change * to a Map of child changes will which propagate the change to lower levels. * @param change The ISchemaChange to add. */ addChange(change: ISchemaChange): void; private getPropertyNameFromChange; } /** * An ISchemaChanges implementation for managing schema comparison diagnostics for Enumerations. * @alpha */ export declare class EnumerationChanges extends SchemaItemChanges { private _enumeratorChanges; /** Gets the EnumeratorChanges map. */ get enumeratorChanges(): Map; /** * Adds the change to the appropriate change collection at this level or adds the change * to a Map of child changes will which propagate the change to lower levels. * @param change The ISchemaChange to add. */ addChange(change: ISchemaChange): void; } /** * An ISchemaChanges implementation for managing schema comparison diagnostics for CustomAttributeContainers. * @alpha */ export declare class CustomAttributeContainerChanges extends BaseSchemaChanges { private _customAttributeChanges; /** Gets the CustomAttributeContainerChange collection. */ get customAttributeChanges(): CustomAttributeContainerChange[]; /** * Adds the change to the appropriate change collection at this level. * @param change The ISchemaChange to add. */ addChange(change: ISchemaChange): void; } /** * An ISchemaChanges implementation for managing schema comparison diagnostics for RelationshipConstraints. * @alpha */ export declare class RelationshipConstraintChanges extends BaseSchemaChanges { private _constraintClassChanges; private _customAttributeChanges; /** Gets the RelationshipConstraintClassChange collection. */ get constraintClassChanges(): RelationshipConstraintClassChange[]; /** Gets the CustomAttributeContainerChanges Map. */ get customAttributeChanges(): Map; /** * Adds the change to the appropriate change collection at this level or adds the change * to a Map of child changes will which propagate the change to lower levels. * @param change The ISchemaChange to add. */ addChange(change: ISchemaChange): void; private getConstraintNameFromChange; } /** * An ISchemaChanges implementation for managing schema comparison diagnostics for Enumerators. * @alpha */ export declare class EnumeratorChanges extends BaseSchemaChanges { private _enumeratorDeltas; private _enumeratorMissing?; /** Gets the EnumeratorDelta collection. */ get enumeratorDeltas(): EnumeratorDelta[]; /** Gets the EnumeratorMissing change. Maybe undefined. */ get enumeratorMissing(): EnumeratorMissing | undefined; /** * Adds the change to the appropriate change collection. * @param change The ISchemaChange to add. */ addChange(change: ISchemaChange): void; } /** * An ISchemaChanges implementation for managing schema comparison diagnostics for EntityClass mixin changes. * @alpha */ export declare class EntityMixinChanges extends BaseSchemaChanges { private _entityMixinChange; /** Gets the EntityMixinChange collection. */ get entityMixinChange(): EntityMixinChange[]; /** * Adds the change to the appropriate change collection. * @param change The ISchemaChange to add. */ addChange(change: ISchemaChange): void; } /** * An ISchemaChanges implementation for managing schema comparison diagnostics for KindOfQuantities. * @alpha */ export declare class KindOfQuantityChanges extends SchemaItemChanges { private _presentationUnitChanges; /** Gets the EntityMixinChange Map. */ get presentationUnitChanges(): Map; /** * Adds the change to the appropriate change collection. * @param change The ISchemaChange to add. */ addChange(change: ISchemaChange): void; } /** * An ISchemaChanges implementation for managing schema comparison diagnostics for KindOfQuantity presentation units. * @alpha */ export declare class PresentationUnitChanges extends BaseSchemaChanges { private _presentationUnitChange; /** Gets the PresentationUnitChange collection. */ get presentationUnitChange(): PresentationUnitChange[]; /** * Adds the change to the appropriate change collection. * @param change The ISchemaChange to add. */ addChange(change: ISchemaChange): void; } /** * An ISchemaChanges implementation for managing schema comparison diagnostics for Formats. * @alpha */ export declare class FormatChanges extends SchemaItemChanges { private _formatUnitChanges; /** Gets the FormatUnitChanges collection. */ get formatUnitChanges(): Map; /** * Adds the change to the appropriate change collection. * @param change The ISchemaChange to add. */ addChange(change: ISchemaChange): void; } /** * An ISchemaChanges implementation for managing schema comparison diagnostics for Format units. * @alpha */ export declare class FormatUnitChanges extends BaseSchemaChanges { private _unitLabelOverrideDeltas; private _formatUnitChanges; /** Gets the UnitLabelOverrideDelta collection. */ get unitLabelOverrideDeltas(): UnitLabelOverrideDelta[]; /** Gets the FormatUnitChange collection. */ get formatUnitChanges(): FormatUnitChange[]; /** * Adds the change to the appropriate change collection. * @param change The ISchemaChange to add. */ addChange(change: ISchemaChange): void; } /** ISchemaChange Implementations */ /** * An ISchemaChange implementation to act as the base class for all changes * associated with SchemaItem instances. * @alpha */ export declare abstract class SchemaItemChange extends BaseSchemaChange { get topLevelSchemaItem(): Schema | SchemaItem; } /** * An ISchemaChange implementation for Schema reference changes. * @alpha */ export declare class SchemaReferenceMissing extends BaseSchemaChange { /** Gets the default ChangeType (Delta or Missing) for this change */ get defaultChangeType(): ChangeType; /** Gets the SchemaItem or Schema (if a schema change) that this change ultimately belongs to. */ get topLevelSchemaItem(): Schema | SchemaItem; /** Gets a string representation of the change. */ toString(): string; } /** * An ISchemaChange implementation differences of baseClasses between two ECClasses. * @alpha */ export declare class SchemaReferenceDelta extends BaseSchemaChange { /** Gets the default ChangeType (Delta or Missing) for this change */ get defaultChangeType(): ChangeType; /** Gets the SchemaItem or Schema (if a schema change) that this change ultimately belongs to. */ get topLevelSchemaItem(): Schema | SchemaItem; /** Gets a string representation of the change. */ toString(): string; } /** * An ISchemaChange implementation for missing SchemaItems. * @alpha */ export declare class SchemaItemMissing extends SchemaItemChange { /** Gets the default ChangeType (Delta or Missing) for this change */ get defaultChangeType(): ChangeType; /** Gets a string representation of the change. */ toString(): string; } /** * An ISchemaChange implementation for changes in property values of any EC type. * @alpha */ export declare class PropertyValueChange extends BaseSchemaChange { /** Gets the SchemaItem that this change ultimately belongs to. */ get topLevelSchemaItem(): Schema | SchemaItem; /** Gets the default ChangeType (Delta or Missing) for this change */ get defaultChangeType(): ChangeType; /** Gets a string representation of the change. */ toString(): string; } /** * An ISchemaChange implementation for missing CustomAttribute instances * for a given container. * @alpha */ export declare class CustomAttributeContainerChange extends BaseSchemaChange { /** Gets the default ChangeType (Delta or Missing) for this change */ get defaultChangeType(): ChangeType; /** Gets the SchemaItem that this change ultimately belongs to. */ get topLevelSchemaItem(): Schema | SchemaItem; /** Gets the key to use in a Map of this type of ISchemaChange. */ get changeKey(): string; /** Gets a string representation of the change. */ toString(): string; } /** * An ISchemaChange implementation differences of baseClasses between two ECClasses. * @alpha */ export declare class BaseClassDelta extends SchemaItemChange { /** Gets the default ChangeType (Delta or Missing) for this change */ get defaultChangeType(): ChangeType; /** Gets a string representation of the change. */ toString(): string; } /** * An ISchemaChange implementation for missing properties. * @alpha */ export declare class PropertyMissing extends BaseSchemaChange { /** Gets the SchemaItem that this change ultimately belongs to. */ get topLevelSchemaItem(): Schema | SchemaItem; /** Gets the default ChangeType (Delta or Missing) for this change */ get defaultChangeType(): ChangeType; /** Gets a string representation of the change. */ toString(): string; } /** * An ISchemaChange implementation for missing RelationshipConstraint classes. * @alpha */ export declare class RelationshipConstraintClassChange extends BaseSchemaChange { /** Gets the default ChangeType (Delta or Missing) for this change */ get defaultChangeType(): ChangeType; /** Gets the SchemaItem that this change ultimately belongs to. */ get topLevelSchemaItem(): Schema | SchemaItem; /** Gets a string representation of the change. */ toString(): string; } /** * An ISchemaChange implementation for differences of Enumerator properties. * @alpha */ export declare class EnumeratorDelta extends BaseSchemaChange { /** Gets the default ChangeType (Delta or Missing) for this change */ get defaultChangeType(): ChangeType; /** Gets the SchemaItem that this change ultimately belongs to. */ get topLevelSchemaItem(): Schema | SchemaItem; /** Gets the key to use in a Map of this type of ISchemaChange. */ get changeKey(): string; /** Gets a string representation of the change. */ toString(): string; } /** * An ISchemaChange implementation for missing Enumerators within an Enumeration. * @alpha */ export declare class EnumeratorMissing extends BaseSchemaChange { /** Gets the default ChangeType (Delta or Missing) for this change */ get defaultChangeType(): ChangeType; /** Gets the SchemaItem that this change ultimately belongs to. */ get topLevelSchemaItem(): Schema | SchemaItem; /** Gets the key to use in a Map of this type of ISchemaChange. */ get changeKey(): string; /** Gets a string representation of the change. */ toString(): string; } /** * An ISchemaChange implementation for missing mixins within an EntityClass. * @alpha */ export declare class EntityMixinChange extends BaseSchemaChange { /** Gets the default ChangeType (Delta or Missing) for this change */ get defaultChangeType(): ChangeType; /** Gets the SchemaItem that this change ultimately belongs to. */ get topLevelSchemaItem(): Schema | SchemaItem; /** Gets the key to use in a Map of this type of ISchemaChange. */ get changeKey(): string; /** Gets a string representation of the change. */ toString(): string; } /** * An ISchemaChange implementation for missing presentation Units within a KindOfQuantity. * @alpha */ export declare class PresentationUnitChange extends BaseSchemaChange { /** Gets the default ChangeType (Delta or Missing) for this change */ get defaultChangeType(): ChangeType; /** Gets the SchemaItem that this change ultimately belongs to. */ get topLevelSchemaItem(): Schema | SchemaItem; /** Gets the key to use in a Map of this type of ISchemaChange. */ get changeKey(): string; /** Gets a string representation of the change. */ toString(): string; private get _isOverrideFormat(); } /** * An ISchemaChange implementation for missing Units within a Format. * @alpha */ export declare class FormatUnitChange extends BaseSchemaChange { /** Gets the default ChangeType (Delta or Missing) for this change */ get defaultChangeType(): ChangeType; /** Gets the SchemaItem that this change ultimately belongs to. */ get topLevelSchemaItem(): Schema | SchemaItem; /** Gets the key to use in a Map of this type of ISchemaChange. */ get changeKey(): string; /** Gets a string representation of the change. */ toString(): string; private get _isInvertedUnit(); } /** * An ISchemaChange implementation for differences of Unit label overrides within a given Format. * @alpha */ export declare class UnitLabelOverrideDelta extends BaseSchemaChange { /** Gets the default ChangeType (Delta or Missing) for this change */ get defaultChangeType(): ChangeType; /** Gets the SchemaItem that this change ultimately belongs to. */ get topLevelSchemaItem(): Schema | SchemaItem; /** Gets the key to use in a Map of this type of ISchemaChange. */ get changeKey(): string; /** Gets a string representation of the change. */ toString(): string; private get _isInvertedUnit(); } export {}; //# sourceMappingURL=SchemaChanges.d.ts.map