@itwin/ecschema-editing 4.8.0-dev.3 → 4.8.0-dev.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/Editing/Exception.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAmD;AAEnD,gEAAwM;AAExM,aAAa;AACb,IAAY,eAgFX;AAhFD,WAAY,eAAe;IACzB,4FAA+B,CAAA;IAC/B,2DAAW,CAAA;IACX,4EAAyC,CAAA;IACzC,8EAAc,CAAA;IACd,sFAAkB,CAAA;IAClB,wGAA2B,CAAA;IAC3B,4FAAqB,CAAA;IACrB,kFAAgB,CAAA;IAChB,wFAAmB,CAAA;IACnB,4FAAqB,CAAA;IACrB,oHAAiC,CAAA;IACjC,kHAAgC,CAAA;IAChC,sGAA0B,CAAA;IAC1B,4FAAqB,CAAA;IACrB,wGAA2B,CAAA;IAC3B,4FAAqB,CAAA;IACrB,kFAAgB,CAAA;IAChB,8FAAsB,CAAA;IACtB,kGAAwB,CAAA;IACxB,4EAAa,CAAA;IACb,wGAA2B,CAAA;IAC3B,eAAe;IACf,8FAAsB,CAAA;IACtB,oGAAyB,CAAA;IACzB,4EAAa,CAAA;IACb,oGAAyB,CAAA;IACzB,kGAAwB,CAAA;IACxB,0EAAY,CAAA;IACZ,wFAAmB,CAAA;IACnB,wFAAmB,CAAA;IACnB,sFAAkB,CAAA;IAClB,4FAAqB,CAAA;IACrB,4FAAqB,CAAA;IACrB,8GAA8B,CAAA;IAC9B,0GAA4B,CAAA;IAC5B,oGAAyB,CAAA;IACzB,kGAAwB,CAAA;IACxB,oHAAiC,CAAA;IACjC,8EAAc,CAAA;IACd,4EAAa,CAAA;IACb,8EAAc,CAAA;IACd,kEAAQ,CAAA;IACR,4EAAa,CAAA;IACb,wEAAW,CAAA;IACX,wEAAW,CAAA;IACX,0EAAY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BAA0B,IAAI,CAAC,YAAY,CAAC,IAAI,oDAAoD,CAAC;gBACpH,OAAO;QACX,CAAC;IACH,CAAC;IAEO,uBAAuB;QAC7B,IAAI,CAAC,IAAI,CAAC,eAAe;YACvB,OAAO,EAAE,CAAC;QAEZ,IAAI,UAAU,GAAG,EAAE,CAAC;QACpB,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YAC9C,UAAU,IAAI,GAAG,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,WAAW,MAAM,CAAC;QACpE,CAAC;QAED,IAAI,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC;YACrC,OAAO,wCAAwC,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAErF,IAAI,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC;YACzC,OAAO,iCAAiC,IAAI,CAAC,YAAY,CAAC,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAE5G,IAAI,2BAA2B,CAAC,IAAI,CAAC,UAAU,CAAC;YAC9C,OAAO,iDAAiD,IAAI,CAAC,iBAAiB,CAAC,IAAI,eAAe,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;QAE9J,IAAI,kCAAkC,CAAC,IAAI,CAAC,UAAU,CAAC;YACrD,OAAO,4CAA4C,IAAI,CAAC,wBAAwB,CAAC,IAAI,yBAAyB,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;QAExL,MAAM,IAAI,KAAK,CAAE,sEAAsE,CAAC,CAAC;IAC3F,CAAC;CACF;AA9LD,gDA8LC","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 Editing\r\n */\r\n\r\nimport { BentleyError } from \"@itwin/core-bentley\";\r\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { AnyEnumerator, CustomAttributeContainerProps, Enumeration, primitiveTypeToString, Property, RelationshipConstraint, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\n\r\n/** @alpha */\r\nexport enum ECEditingStatus {\r\n EC_EDITING_ERROR_BASE = 0x30000,\r\n Unknown = 0,\r\n RuleViolation = EC_EDITING_ERROR_BASE + 1,\r\n SchemaNotFound,\r\n SchemaItemNotFound,\r\n SchemaItemNotFoundInContext,\r\n PropertyAlreadyExists,\r\n PropertyNotFound,\r\n InvalidPropertyType,\r\n BaseClassIsNotElement,\r\n BaseClassIsNotElementUniqueAspect,\r\n BaseClassIsNotElementMultiAspect,\r\n SchemaItemNameNotSpecified,\r\n InvalidSchemaItemType,\r\n SchemaItemNameAlreadyExists,\r\n InvalidEnumeratorType,\r\n InvalidBaseClass,\r\n EnumeratorDoesNotExist,\r\n InvalidStrengthDirection,\r\n InvalidECName,\r\n InvalidFormatUnitsSpecified,\r\n // Outer Errors\r\n CreateSchemaItemFailed,\r\n CreateSchemaItemFromProps,\r\n CreateElement,\r\n CreateElementUniqueAspect,\r\n CreateElementMultiAspect,\r\n SetBaseClass,\r\n SetSourceConstraint,\r\n SetTargetConstraint,\r\n AddConstraintClass,\r\n RemoveConstraintClass,\r\n SetAbstractConstraint,\r\n AddCustomAttributeToConstraint,\r\n AddCustomAttributeToProperty,\r\n AddCustomAttributeToClass,\r\n CreateNavigationProperty,\r\n CreateNavigationPropertyFromProps,\r\n SetInvertsUnit,\r\n SetUnitSystem,\r\n SetDescription,\r\n SetLabel,\r\n SetIsReadOnly,\r\n SetPriority,\r\n SetCategory,\r\n SetMinOccurs,\r\n SetMaxOccurs,\r\n SetExtendedTypeName,\r\n SetMinLength,\r\n SetMaxLength,\r\n SetMinValue,\r\n SetMaxValue,\r\n SetPropertyName,\r\n AddMixin,\r\n AddEnumerator,\r\n SetEnumeratorLabel,\r\n SetEnumeratorDescription,\r\n AddPresentationUnit,\r\n AddPresentationOverride,\r\n CreateFormatOverride,\r\n SetPropertyCategoryPriority,\r\n CreatePrimitiveProperty,\r\n CreatePrimitivePropertyFromProps,\r\n CreateEnumerationProperty,\r\n CreateEnumerationPropertyFromProps,\r\n CreatePrimitiveArrayProperty,\r\n CreatePrimitiveArrayPropertyFromProps,\r\n CreateEnumerationArrayProperty,\r\n CreateEnumerationArrayPropertyFromProps,\r\n CreateStructProperty,\r\n CreateStructPropertyFromProps,\r\n CreateStructArrayProperty,\r\n CreateStructArrayPropertyFromProps,\r\n DeleteProperty,\r\n DeleteClass,\r\n SetClassName,\r\n AddSchemaReference,\r\n SetSchemaVersion,\r\n IncrementSchemaMinorVersion,\r\n}\r\n\r\nexport type AnyEditingError = SchemaEditingError | Error;\r\n\r\nexport enum TaskType {\r\n Add,\r\n Create,\r\n Update,\r\n Change,\r\n Delete\r\n}\r\n\r\nexport enum PropertyTypeName {\r\n ArrayProperty = \"ArrayProperty\",\r\n PrimitiveProperty = \"PrimitiveProperty\",\r\n EnumerationProperty = \"EnumerationProperty\",\r\n NavigationProperty = \"NavigationProperty\",\r\n StructProperty = \"StructProperty\"\r\n}\r\n\r\ntype ECClassSchemaItems = SchemaItemType.EntityClass | SchemaItemType.StructClass | SchemaItemType.RelationshipClass | SchemaItemType.Mixin | SchemaItemType.CustomAttributeClass;\r\n\r\nexport interface SchemaTypeIdentifier {\r\n name: string;\r\n}\r\n\r\nexport class SchemaId implements SchemaTypeIdentifier {\r\n public readonly name: string;\r\n public readonly schemaKey: SchemaKey;\r\n constructor(schemaKey: SchemaKey) {\r\n this.name = schemaKey.name;\r\n this.schemaKey = schemaKey;\r\n }\r\n}\r\n\r\nexport class SchemaItemId implements SchemaTypeIdentifier {\r\n public readonly name: string;\r\n public readonly type: SchemaItemType;\r\n public readonly schemaKey: SchemaKey;\r\n public readonly schemaItemKey: SchemaItemKey;\r\n constructor(schemaItemType: SchemaItemType, schemaItemKeyOrName: SchemaItemKey | string, schemaKey?: SchemaKey) {\r\n if (typeof(schemaItemKeyOrName) === \"string\") {\r\n if (!schemaKey)\r\n throw new Error(\"schemaKey if required if the specified schemaItem the name of the schema item.\");\r\n\r\n this.schemaKey = schemaKey!;\r\n this.schemaItemKey = new SchemaItemKey(schemaItemKeyOrName, schemaKey);\r\n } else {\r\n this.schemaKey = schemaItemKeyOrName.schemaKey;\r\n this.schemaItemKey = schemaItemKeyOrName;\r\n }\r\n\r\n this.type = schemaItemType;\r\n this.name = this.schemaItemKey.fullName;\r\n }\r\n}\r\n\r\nexport class ClassId extends SchemaItemId {\r\n constructor(schemaItemType: ECClassSchemaItems, schemaItemKeyOrName: SchemaItemKey | string, schemaKey?: SchemaKey) {\r\n super(schemaItemType, schemaItemKeyOrName, schemaKey);\r\n }\r\n}\r\n\r\nexport class PropertyId implements SchemaTypeIdentifier {\r\n public readonly name: string;\r\n public readonly fullName: string;\r\n public readonly ecClass: ClassId;\r\n public readonly schemaKey: SchemaKey;\r\n public readonly typeName?: PropertyTypeName;\r\n\r\n constructor(schemaItemType: ECClassSchemaItems, classKey: SchemaItemKey, property: Property | string, typeName?: PropertyTypeName) {\r\n this.name = property instanceof Property ? property.name : property;\r\n this.fullName = property instanceof Property ? property.fullName : `${classKey.name}.${property}`;\r\n this.ecClass = new ClassId(schemaItemType, classKey);\r\n this.schemaKey = classKey.schemaKey;\r\n this.typeName = typeName;\r\n }\r\n}\r\n\r\nexport class EnumerationId extends SchemaItemId {\r\n public readonly enumerationType: string;\r\n public readonly enumeratorName: string;\r\n public readonly enumeratorType: string;\r\n constructor(enumeration: Enumeration, enumerator: AnyEnumerator | string) {\r\n super(SchemaItemType.Enumeration, enumeration.key);\r\n this.enumerationType = enumeration.type ? primitiveTypeToString(enumeration.type) : \"string\";\r\n this.enumeratorName = typeof(enumerator) === \"string\" ? enumerator : enumerator.name;\r\n this.enumeratorType = this.getEnumeratorType(enumeration, enumerator);\r\n }\r\n\r\n private getEnumeratorType(enumeration: Enumeration, enumerator: AnyEnumerator | string) {\r\n if (typeof(enumerator) === \"string\")\r\n return enumeration.isString ? \"string\" : \"int\";\r\n\r\n return typeof(enumerator.value) === \"string\" ? \"string\" : \"int\";\r\n }\r\n}\r\n\r\nexport class CustomAttributeId implements SchemaTypeIdentifier {\r\n public readonly name: string;\r\n public readonly schemaKey: SchemaKey;\r\n public readonly containerFullName: string;\r\n constructor(name: string, container: CustomAttributeContainerProps) {\r\n this.name = name;\r\n this.schemaKey = container.schema.schemaKey;\r\n this.containerFullName = container.fullName;\r\n }\r\n}\r\n\r\nexport class RelationshipConstraintId implements SchemaTypeIdentifier {\r\n public readonly name: string;\r\n public readonly relationshipKey: SchemaItemKey;\r\n public readonly schemaKey: SchemaKey;\r\n constructor(constraint: RelationshipConstraint) {\r\n this.name = constraint.fullName;\r\n this.relationshipKey = constraint.relationshipClass.key;\r\n this.schemaKey = this.relationshipKey.schemaKey;\r\n }\r\n}\r\n\r\ntype AnyIdentifier = SchemaId | PropertyId | CustomAttributeId | RelationshipConstraintId | EnumerationId;\r\n\r\n/**\r\n * Indicates if the given identifier is a SchemaId instance.\r\n * @param identifier The identifier to check.\r\n * @returns true if the identifier is the correct type.\r\n */\r\nexport function isSchemaIdentifier(identifier: AnyIdentifier): identifier is SchemaId {\r\n return identifier instanceof SchemaId;\r\n}\r\n\r\n/**\r\n * Indicates if the given identifier is a SchemaId instance.\r\n * @param identifier The identifier to check.\r\n * @returns true if the identifier is the correct type.\r\n */\r\nexport function isSchemaItemIdentifier(identifier: AnyIdentifier): identifier is SchemaItemId {\r\n return identifier instanceof SchemaItemId;\r\n}\r\n\r\n/**\r\n * Indicates if the given identifier is a ClassId instance.\r\n * @param identifier The identifier to check.\r\n * @returns true if the identifier is the correct type.\r\n */\r\nexport function isClassIdentifier(identifier: AnyIdentifier): identifier is ClassId {\r\n return identifier instanceof ClassId;\r\n}\r\n\r\n/**\r\n * Indicates if the given identifier is a PropertyId instance.\r\n * @param identifier The identifier to check.\r\n * @returns true if the identifier is the correct type.\r\n */\r\nexport function isPropertyIdentifier(identifier: AnyIdentifier): identifier is PropertyId {\r\n return identifier instanceof PropertyId;\r\n}\r\n\r\n/**\r\n * Indicates if the given identifier is a EnumerationId instance.\r\n * @param identifier The identifier to check.\r\n * @returns true if the identifier is the correct type.\r\n */\r\nexport function isEnumerationIdentifier(identifier: AnyIdentifier): identifier is EnumerationId {\r\n return identifier instanceof EnumerationId;\r\n}\r\n\r\n/**\r\n * Indicates if the given identifier is a CustomAttributeId instance.\r\n * @param identifier The identifier to check.\r\n * @returns true if the identifier is the correct type.\r\n */\r\nexport function isCustomAttributeIdentifier(identifier: AnyIdentifier): identifier is CustomAttributeId {\r\n return identifier instanceof CustomAttributeId;\r\n}\r\n\r\n/**\r\n * Indicates if the given identifier is a RelationshipConstraintId instance.\r\n * @param identifier The identifier to check.\r\n * @returns true if the identifier is the correct type.\r\n */\r\nexport function isRelationshipConstraintIdentifier(identifier: AnyIdentifier): identifier is RelationshipConstraintId {\r\n return identifier instanceof RelationshipConstraintId;\r\n}\r\n\r\n/**\r\n * @internal\r\n * An exception class for the ecschema-editing API. Contains identifiers for schema types involved in the\r\n * exception. An example being SchemaItemId which contains the name of the SchemaItem, SchemaItemKey, SchemaItemType, etc.\r\n * Typically will contain an innerError of type SchemaEditingError containing the identifier of the schema item that\r\n * caused the exception. The containing error instance will identify the method called (identified by the errorNumber)\r\n * and the identifier of the schema item being modified/created.\r\n */\r\nexport class SchemaEditingError extends BentleyError {\r\n private _ruleViolations?: AnyDiagnostic[];\r\n private _schemaKey: SchemaKey;\r\n\r\n /**\r\n * Constructs a new SchemaEditingError instance.\r\n * @param errorNumber The unique ECEditingStatus code identifying the error.\r\n * @param identifier The identifier instance containing information about the EC object involved with the exception.\r\n * @param innerError The SchemaEditingError containing the identifier of the EC object that caused the initial exception.\r\n * @param ruleViolations Will contain EC rule violations of type [[AnyDiagnostic]] for exceptions with the error code ECEditingStatus.RuleViolation.\r\n * @param message Optional error message. Most messages on automatically generated by this class based on the ECEditingStatus code.\r\n */\r\n public constructor(public override readonly errorNumber: number, public readonly identifier: AnyIdentifier, public readonly innerError?: AnyEditingError, ruleViolations?: AnyDiagnostic[], message?: string) {\r\n super(errorNumber, message);\r\n this._ruleViolations = ruleViolations;\r\n this._schemaKey = identifier.schemaKey,\r\n this.generateMessage();\r\n }\r\n\r\n /**\r\n * Gets the SchemaId instance.\r\n * @throws Error if the identifier is not an instance of SchemaId.\r\n */\r\n public get schemaId(): SchemaId {\r\n if (!isSchemaIdentifier(this.identifier))\r\n throw new Error(\"identifier is not a SchemaId.\");\r\n return this.identifier as SchemaItemId;\r\n }\r\n\r\n /**\r\n * Gets the SchemaItemId instance.\r\n * @throws Error if the identifier is not an instance of SchemaItemId.\r\n */\r\n public get schemaItemId(): SchemaItemId {\r\n if (!isSchemaItemIdentifier(this.identifier))\r\n throw new Error(\"identifier is not a SchemaItemId.\");\r\n return this.identifier as SchemaItemId;\r\n }\r\n\r\n /**\r\n * Gets the ClassId instance.\r\n * @throws Error if the identifier is not an instance of ClassId.\r\n */\r\n public get classId(): ClassId {\r\n if (!isClassIdentifier(this.identifier))\r\n throw new Error(\"identifier is not a ClassId.\");\r\n return this.identifier;\r\n }\r\n\r\n /**\r\n * Gets the PropertyId instance.\r\n * @throws Error if the identifier is not an instance of PropertyId.\r\n */\r\n public get propertyId(): PropertyId {\r\n if (!isPropertyIdentifier(this.identifier))\r\n throw new Error(\"identifier is not a PropertyId.\");\r\n return this.identifier;\r\n }\r\n\r\n /**\r\n * Gets the EnumerationId instance.\r\n * @throws Error if the identifier is not an instance of EnumerationId.\r\n */\r\n public get enumerationId(): EnumerationId {\r\n if (!isEnumerationIdentifier(this.identifier))\r\n throw new Error(\"identifier is not a EnumerationId.\");\r\n return this.identifier;\r\n }\r\n\r\n /**\r\n * Gets the CustomAttributeId instance.\r\n * @throws Error if the identifier is not an instance of CustomAttributeId.\r\n */\r\n public get customAttributeId(): CustomAttributeId {\r\n if (!isCustomAttributeIdentifier(this.identifier))\r\n throw new Error(\"identifier is not a CustomAttributeId.\");\r\n return this.identifier;\r\n }\r\n\r\n /**\r\n * Gets the RelationshipConstraintId instance.\r\n * @throws Error if the identifier is not an instance of RelationshipConstraintId.\r\n */\r\n public get relationshipConstraintId(): RelationshipConstraintId {\r\n if (!isRelationshipConstraintIdentifier(this.identifier))\r\n throw new Error(\"identifier is not a RelationshipConstraintId.\");\r\n return this.identifier;\r\n }\r\n\r\n public get ruleViolations(): AnyDiagnostic[] | undefined {\r\n return this._ruleViolations;\r\n }\r\n\r\n public toDebugString(): string {\r\n let innerMessage = \"\";\r\n if (this.innerError) {\r\n if (this.innerError instanceof SchemaEditingError)\r\n innerMessage = `: Inner error: ${this.innerError.toDebugString()}`;\r\n else\r\n innerMessage = `: Inner error: ${this.innerError.message}`;\r\n }\r\n return this._appendMessage(`ECEditingStatus.${ECEditingStatus[this.errorNumber]}`) + innerMessage;\r\n }\r\n\r\n private _appendMessage(e: string) {\r\n return this.message ? `${e}: ${this.message}` : e;\r\n }\r\n\r\n private generateMessage() {\r\n if (this.message)\r\n return;\r\n\r\n switch(this.errorNumber) {\r\n case ECEditingStatus.SchemaNotFound:\r\n this.message = `Schema Key ${this._schemaKey.toString(true)} could not be found in the context.`;\r\n return;\r\n case ECEditingStatus.SchemaItemNotFound:\r\n this.message = `${this.schemaItemId.type} ${this.schemaItemId.name} could not be found in the schema ${this._schemaKey.name}.`;\r\n return;\r\n case ECEditingStatus.SchemaItemNotFoundInContext:\r\n this.message = `${this.schemaItemId.type} ${this.schemaItemId.name} could not be found in the schema context.`;\r\n return;\r\n case ECEditingStatus.InvalidSchemaItemType:\r\n this.message = `Expected ${this.schemaItemId.name} to be of type ${this.schemaItemId.type}.`;\r\n return;\r\n case ECEditingStatus.SchemaItemNameNotSpecified:\r\n this.message = `Could not create a new ${this.schemaItemId.type} in schema ${this._schemaKey.name}. No name was supplied within props.`;\r\n return;\r\n case ECEditingStatus.SchemaItemNameAlreadyExists:\r\n this.message = `${this.schemaItemId.type} ${this.schemaItemId.name} already exists in the schema ${this._schemaKey.name}.`;\r\n return;\r\n case ECEditingStatus.RuleViolation:\r\n this.message = this.getRuleViolationMessage();\r\n return;\r\n case ECEditingStatus.PropertyNotFound:\r\n this.message = `An ECProperty with the name ${this.propertyId.name} could not be found in the class ${this.propertyId.ecClass.name}.`;\r\n return;\r\n case ECEditingStatus.PropertyAlreadyExists:\r\n this.message = `An ECProperty with the name ${this.propertyId.name} already exists in the class ${this.propertyId.ecClass.name}.`;\r\n return;\r\n case ECEditingStatus.InvalidPropertyType:\r\n this.message = `Expected property ${this.propertyId.name} to be of type ${this.propertyId.typeName}.`;\r\n return;\r\n case ECEditingStatus.BaseClassIsNotElement:\r\n this.message = `Expected base class ${this.schemaItemId.name} to derive from BisCore.Element.`;\r\n return;\r\n case ECEditingStatus.BaseClassIsNotElementUniqueAspect:\r\n this.message = `Expected base class ${this.schemaItemId.name} to derive from BisCore.ElementUniqueAspect.`;\r\n return;\r\n case ECEditingStatus.BaseClassIsNotElementMultiAspect:\r\n this.message = `Expected base class ${this.schemaItemId.name} to derive from BisCore.ElementMultiAspect.`;\r\n return;\r\n case ECEditingStatus.InvalidFormatUnitsSpecified:\r\n this.message = `The specified Format unit ${this.schemaItemId.name} is not of type Unit or InvertedUnit`;\r\n return;\r\n case ECEditingStatus.InvalidEnumeratorType:\r\n this.message = `The Enumeration ${this.enumerationId.name} has type ${this.enumerationId.enumerationType}, while Enumerator ${this.enumerationId.enumeratorName} has type ${this.enumerationId.enumeratorType}.`;\r\n return;\r\n case ECEditingStatus.EnumeratorDoesNotExist:\r\n this.message = `Enumerator ${this.enumerationId.enumeratorName} does not exists in Enumeration ${this.enumerationId.name}.`;\r\n return;\r\n case ECEditingStatus.InvalidECName:\r\n this.message = `Could not rename class ${this.schemaItemId.name} because the specified name is not a valid ECName.`;\r\n return;\r\n }\r\n }\r\n\r\n private getRuleViolationMessage(): string {\r\n if (!this._ruleViolations)\r\n return \"\";\r\n\r\n let violations = \"\";\r\n for (const diagnostic of this._ruleViolations) {\r\n violations += `${diagnostic.code}: ${diagnostic.messageText}\\r\\n`;\r\n }\r\n\r\n if (isSchemaIdentifier(this.identifier))\r\n return `Rule violations occurred from Schema ${this.schemaId.name}: ${violations}`;\r\n\r\n if (isSchemaItemIdentifier(this.identifier))\r\n return `Rule violations occurred from ${this.schemaItemId.type} ${this.schemaItemId.name}: ${violations}`;\r\n\r\n if (isCustomAttributeIdentifier(this.identifier))\r\n return `Rule violations occurred from CustomAttribute ${this.customAttributeId.name}, container ${this.customAttributeId.containerFullName}: ${violations}`;\r\n\r\n if (isRelationshipConstraintIdentifier(this.identifier))\r\n return `Rule violations occurred from constraint ${this.relationshipConstraintId.name} of RelationshipClass ${this.relationshipConstraintId.relationshipKey.fullName}: ${violations}`;\r\n\r\n throw new Error (\"Could not generate rule violation message due to invalid identifier.\");\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/Editing/Exception.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,gEAAuN;AAEvN,aAAa;AACb,IAAY,eA+EX;AA/ED,WAAY,eAAe;IACzB,4FAA+B,CAAA;IAC/B,2DAAW,CAAA;IACX,4EAAyC,CAAA;IACzC,8EAAc,CAAA;IACd,sFAAkB,CAAA;IAClB,wGAA2B,CAAA;IAC3B,4FAAqB,CAAA;IACrB,kFAAgB,CAAA;IAChB,wFAAmB,CAAA;IACnB,4FAAqB,CAAA;IACrB,oHAAiC,CAAA;IACjC,kHAAgC,CAAA;IAChC,sGAA0B,CAAA;IAC1B,4FAAqB,CAAA;IACrB,wGAA2B,CAAA;IAC3B,4FAAqB,CAAA;IACrB,kFAAgB,CAAA;IAChB,8FAAsB,CAAA;IACtB,4EAAa,CAAA;IACb,wGAA2B,CAAA;IAC3B,eAAe;IACf,8FAAsB,CAA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AM,CAAC,UAAU,CAAC,KAAK,QAAQ,EAAE,CAAC;QACpC,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,yCAAqB,EAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC/E,CAAC;IAED,OAAO,OAAM,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;AAClE,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 Editing\r\n */\r\n\r\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { AnyEnumerator, CustomAttributeContainerProps, Enumeration, PrimitiveType, primitiveTypeToString, Property, RelationshipConstraint, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\n\r\n/** @alpha */\r\nexport enum ECEditingStatus {\r\n EC_EDITING_ERROR_BASE = 0x30000,\r\n Unknown = 0,\r\n RuleViolation = EC_EDITING_ERROR_BASE + 1,\r\n SchemaNotFound,\r\n SchemaItemNotFound,\r\n SchemaItemNotFoundInContext,\r\n PropertyAlreadyExists,\r\n PropertyNotFound,\r\n InvalidPropertyType,\r\n BaseClassIsNotElement,\r\n BaseClassIsNotElementUniqueAspect,\r\n BaseClassIsNotElementMultiAspect,\r\n SchemaItemNameNotSpecified,\r\n InvalidSchemaItemType,\r\n SchemaItemNameAlreadyExists,\r\n InvalidEnumeratorType,\r\n InvalidBaseClass,\r\n EnumeratorDoesNotExist,\r\n InvalidECName,\r\n InvalidFormatUnitsSpecified,\r\n // Outer Errors\r\n CreateSchemaItemFailed,\r\n CreateSchemaItemFromProps,\r\n CreateElement,\r\n CreateElementUniqueAspect,\r\n CreateElementMultiAspect,\r\n SetBaseClass,\r\n SetSourceConstraint,\r\n SetTargetConstraint,\r\n AddConstraintClass,\r\n RemoveConstraintClass,\r\n SetAbstractConstraint,\r\n AddCustomAttributeToConstraint,\r\n AddCustomAttributeToProperty,\r\n AddCustomAttributeToClass,\r\n CreateNavigationProperty,\r\n CreateNavigationPropertyFromProps,\r\n SetInvertsUnit,\r\n SetUnitSystem,\r\n SetDescription,\r\n SetLabel,\r\n SetIsReadOnly,\r\n SetPriority,\r\n SetCategory,\r\n SetMinOccurs,\r\n SetMaxOccurs,\r\n SetExtendedTypeName,\r\n SetMinLength,\r\n SetMaxLength,\r\n SetMinValue,\r\n SetMaxValue,\r\n SetPropertyName,\r\n AddMixin,\r\n AddEnumerator,\r\n SetEnumeratorLabel,\r\n SetEnumeratorDescription,\r\n AddPresentationUnit,\r\n AddPresentationOverride,\r\n CreateFormatOverride,\r\n SetPropertyCategoryPriority,\r\n CreatePrimitiveProperty,\r\n CreatePrimitivePropertyFromProps,\r\n CreateEnumerationProperty,\r\n CreateEnumerationPropertyFromProps,\r\n CreatePrimitiveArrayProperty,\r\n CreatePrimitiveArrayPropertyFromProps,\r\n CreateEnumerationArrayProperty,\r\n CreateEnumerationArrayPropertyFromProps,\r\n CreateStructProperty,\r\n CreateStructPropertyFromProps,\r\n CreateStructArrayProperty,\r\n CreateStructArrayPropertyFromProps,\r\n DeleteProperty,\r\n DeleteClass,\r\n SetClassName,\r\n AddSchemaReference,\r\n SetSchemaVersion,\r\n IncrementSchemaMinorVersion,\r\n}\r\n\r\n/**\r\n * A type that constrains the possible error types handled by SchemaEditingError\r\n * @alpha\r\n */\r\nexport type AnyEditingError = SchemaEditingError | Error;\r\n\r\n/**\r\n * Defines the possible property type names.\r\n * @alpha\r\n */\r\nexport enum PropertyTypeName {\r\n ArrayProperty = \"ArrayProperty\",\r\n PrimitiveProperty = \"PrimitiveProperty\",\r\n EnumerationProperty = \"EnumerationProperty\",\r\n NavigationProperty = \"NavigationProperty\",\r\n StructProperty = \"StructProperty\"\r\n}\r\n\r\n/**\r\n * Defines the possible schema type identifiers.\r\n * @alpha\r\n */\r\nexport enum SchemaTypeIdentifiers {\r\n SchemaIdentifier = \"Schema\",\r\n SchemaItemIdentifier = \"SchemaItem\",\r\n ClassIdentifier = \"Class\",\r\n PropertyIdentifier = \"Property\",\r\n EnumerationIdentifier = \"Enumeration\",\r\n EnumeratorIdentifier = \"Enumerator\",\r\n CustomAttributeIdentifier = \"CustomAttribute\",\r\n RelationshipConstraintIdentifier = \"RelationshipConstraint\"\r\n}\r\n\r\n/**\r\n * Type that constrains SchemaItemType enum to those used by EC Class types.\r\n * @alpha\r\n */\r\nexport type ECClassSchemaItems = SchemaItemType.EntityClass | SchemaItemType.StructClass | SchemaItemType.RelationshipClass | SchemaItemType.Mixin | SchemaItemType.CustomAttributeClass;\r\n\r\n/**\r\n * Type that defines the possible SchemaTypeIdentifiers for SchemaItemId classes.\r\n * @alpha\r\n */\r\nexport type AnySchemaItemTypeIdentifier = SchemaTypeIdentifiers.SchemaItemIdentifier | SchemaTypeIdentifiers.ClassIdentifier;\r\n\r\n/**\r\n * Type that encompasses all ISchemaTypeIdentifier interfaces\r\n * @alpha\r\n */\r\nexport type AnyIdentifier = ISchemaIdentifier | ISchemaItemIdentifier | IClassIdentifier | IPropertyIdentifier | ICustomAttributeIdentifier | IRelationshipConstraintIdentifier | IEnumeratorIdentifier;\r\n\r\n/**\r\n * A base interface that defines what is needed to identity any schema type.\r\n * @alpha\r\n */\r\nexport interface ISchemaTypeIdentifier {\r\n readonly name: string;\r\n readonly schemaKey: SchemaKey;\r\n readonly typeIdentifier: SchemaTypeIdentifiers;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify a Schema.\r\n * @alpha\r\n */\r\nexport interface ISchemaIdentifier extends ISchemaTypeIdentifier {\r\n readonly typeIdentifier: SchemaTypeIdentifiers.SchemaIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify a SchemaItem.\r\n * @alpha\r\n */\r\nexport interface ISchemaItemIdentifier extends ISchemaTypeIdentifier {\r\n readonly schemaItemType: SchemaItemType;\r\n readonly schemaItemKey: SchemaItemKey;\r\n readonly typeIdentifier: AnySchemaItemTypeIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify an EC Class.\r\n * @alpha\r\n */\r\nexport interface IClassIdentifier extends ISchemaTypeIdentifier {\r\n readonly schemaItemType: ECClassSchemaItems;\r\n readonly schemaItemKey: SchemaItemKey;\r\n readonly typeIdentifier: SchemaTypeIdentifiers.ClassIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify an EC Property.\r\n * @alpha\r\n */\r\nexport interface IPropertyIdentifier extends ISchemaTypeIdentifier {\r\n readonly fullName: string;\r\n readonly ecClass: ClassId;\r\n readonly typeName?: PropertyTypeName;\r\n readonly typeIdentifier: SchemaTypeIdentifiers.PropertyIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify an Enumerator.\r\n * @alpha\r\n */\r\ninterface IEnumeratorIdentifier extends ISchemaTypeIdentifier {\r\n readonly enumeratorType: string;\r\n readonly enumeration: SchemaItemKey;\r\n readonly enumerationType: string;\r\n readonly typeIdentifier: SchemaTypeIdentifiers.EnumeratorIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify a CustomAttribute.\r\n * @alpha\r\n */\r\nexport interface ICustomAttributeIdentifier extends ISchemaTypeIdentifier {\r\n readonly containerFullName: string;\r\n readonly typeIdentifier: SchemaTypeIdentifiers.CustomAttributeIdentifier;\r\n}\r\n\r\n/**\r\n * Interface that defines the data needed to identify a RelationshipConstraint.\r\n * @alpha\r\n */\r\nexport interface IRelationshipConstraintIdentifier extends ISchemaTypeIdentifier {\r\n readonly relationshipKey: SchemaItemKey;\r\n readonly typeIdentifier: SchemaTypeIdentifiers.RelationshipConstraintIdentifier;\r\n}\r\n\r\n/**\r\n * An ISchemaIdentifier implementation to identify Schemas\r\n * @alpha\r\n */\r\nexport class SchemaId implements ISchemaIdentifier {\r\n public readonly typeIdentifier = SchemaTypeIdentifiers.SchemaIdentifier;\r\n public readonly name: string;\r\n public readonly schemaKey: SchemaKey;\r\n constructor(schemaKey: SchemaKey) {\r\n this.name = schemaKey.name;\r\n this.schemaKey = schemaKey;\r\n }\r\n}\r\n\r\n/**\r\n * An ISchemItemIdentifier implementation to identify SchemaItems\r\n * @alpha\r\n */\r\nexport class SchemaItemId implements ISchemaItemIdentifier {\r\n public readonly typeIdentifier: AnySchemaItemTypeIdentifier;\r\n public readonly name: string;\r\n public readonly schemaKey: SchemaKey;\r\n public readonly schemaItemType: SchemaItemType;\r\n public readonly schemaItemKey: SchemaItemKey;\r\n\r\n constructor(schemaItemType: SchemaItemType, schemaItemKeyOrName: SchemaItemKey | string, schemaKey?: SchemaKey) {\r\n if (typeof(schemaItemKeyOrName) === \"string\") {\r\n if (!schemaKey)\r\n throw new Error(\"schemaKey if required if the specified schemaItem the name of the schema item.\");\r\n\r\n this.schemaKey = schemaKey!;\r\n this.schemaItemKey = new SchemaItemKey(schemaItemKeyOrName, schemaKey);\r\n } else {\r\n this.schemaKey = schemaItemKeyOrName.schemaKey;\r\n this.schemaItemKey = schemaItemKeyOrName;\r\n }\r\n\r\n this.schemaItemType = schemaItemType;\r\n this.name = this.schemaItemKey.fullName;\r\n this.typeIdentifier = SchemaTypeIdentifiers.SchemaItemIdentifier;\r\n }\r\n}\r\n\r\n/**\r\n * An IClassIdentifier implementation to identify Class instances.\r\n * @alpha\r\n */\r\nexport class ClassId extends SchemaItemId implements IClassIdentifier {\r\n public override readonly typeIdentifier = SchemaTypeIdentifiers.ClassIdentifier;\r\n public override readonly schemaItemType: ECClassSchemaItems;\r\n constructor(schemaItemType: ECClassSchemaItems, schemaItemKeyOrName: SchemaItemKey | string, schemaKey?: SchemaKey) {\r\n super(schemaItemType, schemaItemKeyOrName, schemaKey);\r\n this.schemaItemType = schemaItemType;\r\n }\r\n}\r\n\r\n/**\r\n * An IPropertyIdentifier implementation to identify Property instances.\r\n * @alpha\r\n */\r\nexport class PropertyId implements IPropertyIdentifier {\r\n public readonly typeIdentifier = SchemaTypeIdentifiers.PropertyIdentifier;\r\n public readonly name: string;\r\n public readonly fullName: string;\r\n public readonly ecClass: ClassId;\r\n public readonly schemaKey: SchemaKey;\r\n public readonly typeName?: PropertyTypeName;\r\n\r\n constructor(schemaItemType: ECClassSchemaItems, classKey: SchemaItemKey, property: Property | string, typeName?: PropertyTypeName) {\r\n this.name = property instanceof Property ? property.name : property;\r\n this.fullName = property instanceof Property ? property.fullName : `${classKey.name}.${property}`;\r\n this.ecClass = new ClassId(schemaItemType, classKey);\r\n this.schemaKey = classKey.schemaKey;\r\n this.typeName = typeName;\r\n }\r\n}\r\n\r\n/**\r\n * An IEnumeratorIdentifier implementation to identify Enumerator instances.\r\n * @alpha\r\n */\r\nexport class EnumeratorId implements IEnumeratorIdentifier{\r\n public readonly typeIdentifier = SchemaTypeIdentifiers.EnumeratorIdentifier;\r\n public readonly enumeration: SchemaItemKey;\r\n public readonly enumerationType: string;\r\n public readonly enumeratorType: string;\r\n public readonly name: string;\r\n public readonly schemaKey: SchemaKey;\r\n\r\n constructor(enumerator: AnyEnumerator | string, enumeration: Enumeration) {\r\n this.enumeration = enumeration.key;\r\n this.enumerationType = enumeration.type ? primitiveTypeToString(enumeration.type): \"string\";\r\n this.enumeratorType = getEnumeratorType(enumeration ?? PrimitiveType.String, enumerator);\r\n this.name = typeof(enumerator) === \"string\" ? enumerator : enumerator.name;\r\n this.schemaKey = enumeration.schema.schemaKey;\r\n }\r\n}\r\n\r\n/**\r\n * An ICustomAttributeIdentifier implementation to identify CustomAttribute instances.\r\n * @alpha\r\n */\r\nexport class CustomAttributeId implements ICustomAttributeIdentifier {\r\n public readonly typeIdentifier = SchemaTypeIdentifiers.CustomAttributeIdentifier;\r\n public readonly name: string;\r\n public readonly schemaKey: SchemaKey;\r\n public readonly containerFullName: string;\r\n constructor(name: string, container: CustomAttributeContainerProps) {\r\n this.name = name;\r\n this.schemaKey = container.schema.schemaKey;\r\n this.containerFullName = container.fullName;\r\n }\r\n}\r\n\r\n/**\r\n * An IRelationshipConstraintIdentifier implementation to identify RelationshipConstraints.\r\n * @alpha\r\n */\r\nexport class RelationshipConstraintId implements IRelationshipConstraintIdentifier {\r\n public readonly typeIdentifier = SchemaTypeIdentifiers.RelationshipConstraintIdentifier;\r\n public readonly name: string;\r\n public readonly relationshipKey: SchemaItemKey;\r\n public readonly schemaKey: SchemaKey;\r\n constructor(constraint: RelationshipConstraint) {\r\n this.name = constraint.isSource ? \"Source\" : \"Target\";\r\n this.relationshipKey = constraint.relationshipClass.key;\r\n this.schemaKey = this.relationshipKey.schemaKey;\r\n }\r\n}\r\n\r\n/**\r\n * An exception class for the ecschema-editing API. Contains identifiers for schema types involved in the\r\n * exception. An example being SchemaItemId which contains the name of the SchemaItem, SchemaItemKey, SchemaItemType, etc.\r\n * Typically will contain an innerError of type SchemaEditingError containing the identifier of the schema item that\r\n * caused the exception. The containing error instance will identify the method called (identified by the errorNumber)\r\n * and the identifier of the schema item being modified/created.\r\n * @alpha\r\n */\r\nexport class SchemaEditingError extends Error {\r\n private _ruleViolations?: AnyDiagnostic[];\r\n private _schemaKey: SchemaKey;\r\n\r\n /**\r\n * Constructs a new SchemaEditingError instance.\r\n * @param errorNumber The unique ECEditingStatus code identifying the error.\r\n * @param identifier The identifier instance containing information about the EC object involved with the exception.\r\n * @param innerError The SchemaEditingError containing the identifier of the EC object that caused the initial exception.\r\n * @param ruleViolations Will contain EC rule violations of type [[AnyDiagnostic]] for exceptions with the error code ECEditingStatus.RuleViolation.\r\n * @param message Optional error message. Most messages on automatically generated by this class based on the ECEditingStatus code.\r\n */\r\n public constructor(public readonly errorNumber: ECEditingStatus, public readonly identifier: AnyIdentifier, public readonly innerError?: AnyEditingError, ruleViolations?: AnyDiagnostic[], message?: string) {\r\n super(message);\r\n this._ruleViolations = ruleViolations;\r\n this._schemaKey = identifier.schemaKey,\r\n this.generateMessage();\r\n }\r\n\r\n /**\r\n * Gets the SchemaId instance.\r\n * @throws Error if the identifier is not an instance of SchemaId.\r\n */\r\n private get _schemaId(): SchemaId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.SchemaIdentifier)\r\n throw new Error(\"identifier is not a SchemaId.\");\r\n return this.identifier as SchemaId;\r\n }\r\n\r\n /**\r\n * Gets the SchemaItemId instance.\r\n * @throws Error if the identifier is not an instance of SchemaItemId.\r\n */\r\n private get _schemaItemId(): SchemaItemId {\r\n if (this.isSchemaItemIdentifier(this.identifier))\r\n throw new Error(\"identifier is not a SchemaItemId.\");\r\n return this.identifier as SchemaItemId;\r\n }\r\n\r\n /**\r\n * Gets the ClassId instance.\r\n * @throws Error if the identifier is not an instance of ClassId.\r\n */\r\n private get _classId(): ClassId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.ClassIdentifier)\r\n throw new Error(\"identifier is not a ClassId.\");\r\n return this.identifier as ClassId;\r\n }\r\n\r\n /**\r\n * Gets the PropertyId instance.\r\n * @throws Error if the identifier is not an instance of PropertyId.\r\n */\r\n private get _propertyId(): PropertyId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.PropertyIdentifier)\r\n throw new Error(\"identifier is not a PropertyId.\");\r\n return this.identifier;\r\n }\r\n\r\n /**\r\n * Gets the EnumeratorId instance.\r\n * @throws Error if the identifier is not an instance of EnumeratorId.\r\n */\r\n private get _enumeratorId(): EnumeratorId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.EnumeratorIdentifier)\r\n throw new Error(\"identifier is not a EnumerationId.\");\r\n return this.identifier as EnumeratorId;\r\n }\r\n\r\n /**\r\n * Gets the CustomAttributeId instance.\r\n * @throws Error if the identifier is not an instance of CustomAttributeId.\r\n */\r\n private get _customAttributeId(): CustomAttributeId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.CustomAttributeIdentifier)\r\n throw new Error(\"identifier is not a CustomAttributeId.\");\r\n return this.identifier;\r\n }\r\n\r\n /**\r\n * Gets the RelationshipConstraintId instance.\r\n * @throws Error if the identifier is not an instance of RelationshipConstraintId.\r\n */\r\n private get _relationshipConstraintId(): RelationshipConstraintId {\r\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.RelationshipConstraintIdentifier)\r\n throw new Error(\"identifier is not a RelationshipConstraintId.\");\r\n return this.identifier;\r\n }\r\n\r\n /** Gets rule violations that were reported during validation. Returns an array of [[AnyDiagnostic]] if\r\n * the errorNumber is ECEditingStatus.RuleViolation, otherwise undefined.\r\n */\r\n public get ruleViolations(): AnyDiagnostic[] | undefined {\r\n return this._ruleViolations;\r\n }\r\n\r\n /**\r\n * Returns a readable string containing the ECEditingStatus along with the error message. Any\r\n * innerError will also be appended.\r\n * @returns\r\n */\r\n public toDebugString(): string {\r\n let innerMessage = \"\";\r\n if (this.innerError) {\r\n if (this.innerError instanceof SchemaEditingError)\r\n innerMessage = ` Inner error: ${this.innerError.toDebugString()}`;\r\n else\r\n innerMessage = ` Inner error: ${this.innerError.message}`;\r\n }\r\n return this._appendMessage(`ECEditingStatus.${ECEditingStatus[this.errorNumber]}`) + innerMessage;\r\n }\r\n\r\n private generateMessage() {\r\n if (this.message)\r\n return;\r\n\r\n switch(this.errorNumber) {\r\n case ECEditingStatus.SchemaNotFound:\r\n this.message = `Schema Key ${this._schemaKey.toString(true)} could not be found in the context.`;\r\n return;\r\n case ECEditingStatus.SchemaItemNotFound:\r\n this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} could not be found in the schema ${this._schemaKey.name}.`;\r\n return;\r\n case ECEditingStatus.SchemaItemNotFoundInContext:\r\n this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} could not be found in the schema context.`;\r\n return;\r\n case ECEditingStatus.InvalidSchemaItemType:\r\n this.message = `Expected ${this._schemaItemId.name} to be of type ${this._schemaItemId.schemaItemType}.`;\r\n return;\r\n case ECEditingStatus.SchemaItemNameNotSpecified:\r\n this.message = `Could not create a new ${this._schemaItemId.schemaItemType} in schema ${this._schemaKey.name}. No name was supplied within props.`;\r\n return;\r\n case ECEditingStatus.SchemaItemNameAlreadyExists:\r\n this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} already exists in the schema ${this._schemaKey.name}.`;\r\n return;\r\n case ECEditingStatus.RuleViolation:\r\n this.message = this._getRuleViolationMessage();\r\n return;\r\n case ECEditingStatus.PropertyNotFound:\r\n this.message = `An ECProperty with the name ${this._propertyId.name} could not be found in the class ${this._propertyId.ecClass.name}.`;\r\n return;\r\n case ECEditingStatus.PropertyAlreadyExists:\r\n this.message = `An ECProperty with the name ${this._propertyId.name} already exists in the class ${this._propertyId.ecClass.name}.`;\r\n return;\r\n case ECEditingStatus.InvalidPropertyType:\r\n this.message = `Expected property ${this._propertyId.name} to be of type ${this._propertyId.typeName}.`;\r\n return;\r\n case ECEditingStatus.BaseClassIsNotElement:\r\n this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.Element.`;\r\n return;\r\n case ECEditingStatus.BaseClassIsNotElementUniqueAspect:\r\n this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.ElementUniqueAspect.`;\r\n return;\r\n case ECEditingStatus.BaseClassIsNotElementMultiAspect:\r\n this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.ElementMultiAspect.`;\r\n return;\r\n case ECEditingStatus.InvalidFormatUnitsSpecified:\r\n this.message = `The specified Format unit ${this._schemaItemId.name} is not of type Unit or InvertedUnit`;\r\n return;\r\n case ECEditingStatus.InvalidEnumeratorType:\r\n this.message = `The Enumeration ${this._enumeratorId.enumeration.fullName} has type ${this._enumeratorId.enumerationType}, while Enumerator ${this._enumeratorId.name} has type ${this._enumeratorId.enumeratorType}.`;\r\n return;\r\n case ECEditingStatus.EnumeratorDoesNotExist:\r\n this.message = `Enumerator ${this._enumeratorId.name} does not exists in Enumeration ${this._enumeratorId.enumeration.name}.`;\r\n return;\r\n case ECEditingStatus.InvalidECName:\r\n this.message = `Could not rename class ${this._schemaItemId.name} because the specified name is not a valid ECName.`;\r\n return;\r\n default:\r\n this.message = this._createTaskErrorMessage();\r\n }\r\n }\r\n\r\n private _appendMessage(e: string) {\r\n return this.message ? `${e}: ${this.message}` : e;\r\n }\r\n\r\n private _getRuleViolationMessage(): string {\r\n if (!this._ruleViolations)\r\n return \"\";\r\n\r\n let violations = \"\";\r\n for (const diagnostic of this._ruleViolations) {\r\n violations += `${diagnostic.code}: ${diagnostic.messageText}\\r\\n`;\r\n }\r\n\r\n switch (this.identifier.typeIdentifier) {\r\n case SchemaTypeIdentifiers.SchemaIdentifier:\r\n return `Rule violations occurred from Schema ${this._schemaId.name}: ${violations}`;\r\n case SchemaTypeIdentifiers.SchemaItemIdentifier:\r\n return `Rule violations occurred from ${this._schemaItemId.schemaItemType} ${this._schemaItemId.name}: ${violations}`;\r\n case SchemaTypeIdentifiers.ClassIdentifier:\r\n return `Rule violations occurred from ${this._schemaItemId.schemaItemType} ${this._schemaItemId.name}: ${violations}`;\r\n case SchemaTypeIdentifiers.CustomAttributeIdentifier:\r\n return `Rule violations occurred from CustomAttribute ${this._customAttributeId.name}, container ${this._customAttributeId.containerFullName}: ${violations}`;\r\n case SchemaTypeIdentifiers.RelationshipConstraintIdentifier:\r\n return `Rule violations occurred from ${this._relationshipConstraintId.name} constraint of RelationshipClass ${this._relationshipConstraintId.relationshipKey.fullName}: ${violations}`;\r\n default:\r\n throw new Error (\"Invalid identifier.\");\r\n }\r\n }\r\n\r\n private _createTaskErrorMessage() {\r\n // Make sure we have an inner error or else it is not a task error\r\n if (!this.innerError)\r\n return \"\";\r\n\r\n switch (this.identifier.typeIdentifier) {\r\n case SchemaTypeIdentifiers.SchemaIdentifier:\r\n case SchemaTypeIdentifiers.SchemaItemIdentifier:\r\n case SchemaTypeIdentifiers.ClassIdentifier:\r\n case SchemaTypeIdentifiers.RelationshipConstraintIdentifier:\r\n return `While performing task '${ECEditingStatus[this.errorNumber]}' an error occurred editing ${this.identifier.typeIdentifier} ${this.identifier.name}.`;\r\n case SchemaTypeIdentifiers.PropertyIdentifier:\r\n return `While performing task '${ECEditingStatus[this.errorNumber]}' an error occurred editing ${this.identifier.typeIdentifier} ${this.identifier.fullName}.`;\r\n default:\r\n throw new Error (\"Invalid identifier.\");\r\n }\r\n }\r\n\r\n private isSchemaItemIdentifier(identifier: AnyIdentifier) {\r\n if (identifier.typeIdentifier !== SchemaTypeIdentifiers.SchemaItemIdentifier &&\r\n identifier.typeIdentifier !== SchemaTypeIdentifiers.ClassIdentifier)\r\n return true;\r\n\r\n return false;\r\n }\r\n}\r\n\r\nfunction getEnumeratorType(enumeration: Enumeration, enumerator: AnyEnumerator | string) {\r\n if (typeof(enumerator) === \"string\") {\r\n return enumeration.type ? primitiveTypeToString(enumeration.type) : \"string\";\r\n }\r\n\r\n return typeof(enumerator.value) === \"string\" ? \"string\" : \"int\";\r\n}\r\n"]}
@@ -0,0 +1,10 @@
1
+ import { SchemaItem } from "@itwin/ecschema-metadata";
2
+ /**
3
+ * Hackish approach that works like a "friend class" so we can access protected members without making them public.
4
+ * @internal
5
+ */
6
+ export declare abstract class MutableSchemaItem extends SchemaItem {
7
+ abstract setDescription(description: string): void;
8
+ abstract setDisplayLabel(displayLabel: string): void;
9
+ }
10
+ //# sourceMappingURL=MutableSchemaItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MutableSchemaItem.d.ts","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableSchemaItem.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAEpD;;;GAGG;AACH,8BAAsB,iBAAkB,SAAQ,UAAU;aAC/B,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;aACzC,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;CACrE"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MutableSchemaItem = void 0;
4
+ /*---------------------------------------------------------------------------------------------
5
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
+ * See LICENSE.md in the project root for license terms and full copyright notice.
7
+ *--------------------------------------------------------------------------------------------*/
8
+ const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
9
+ /**
10
+ * Hackish approach that works like a "friend class" so we can access protected members without making them public.
11
+ * @internal
12
+ */
13
+ class MutableSchemaItem extends ecschema_metadata_1.SchemaItem {
14
+ }
15
+ exports.MutableSchemaItem = MutableSchemaItem;
16
+ //# sourceMappingURL=MutableSchemaItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MutableSchemaItem.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableSchemaItem.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAoD;AAEpD;;;GAGG;AACH,MAAsB,iBAAkB,SAAQ,8BAAU;CAGzD;AAHD,8CAGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport {SchemaItem} from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\n * @internal\r\n */\r\nexport abstract class MutableSchemaItem extends SchemaItem {\r\n public abstract override setDescription(description: string): void;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
@@ -14,6 +14,18 @@ export declare abstract class SchemaItems {
14
14
  protected schemaItemType: SchemaItemType;
15
15
  protected schemaEditor: SchemaContextEditor;
16
16
  constructor(schemaItemType: SchemaItemType, schemaEditor: SchemaContextEditor);
17
+ /**
18
+ * Sets the SchemaItem description.
19
+ * @param schemaItemKey The SchemaItemKey of the SchemaItem
20
+ * @param description The new description to set.
21
+ */
22
+ setDescription(schemaItemKey: SchemaItemKey, description: string): Promise<void>;
23
+ /**
24
+ * Sets the SchemaItem display label.
25
+ * @param schemaItemKey The SchemaItemKey of the SchemaItem
26
+ * @param label The new label to set.
27
+ */
28
+ setDisplayLabel(schemaItemKey: SchemaItemKey, label: string): Promise<void>;
17
29
  protected getSchema(schemaKey: SchemaKey): Promise<MutableSchema>;
18
30
  protected getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey, schemaItemType?: SchemaItemType | null): Promise<T>;
19
31
  protected lookupSchemaItem<T extends SchemaItem>(schemaOrKey: MutableSchema | SchemaKey, schemaItemKey: SchemaItemKey, schemaItemType?: SchemaItemType | null): Promise<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaItems.d.ts","sourceRoot":"","sources":["../../../src/Editing/SchemaItems.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAA2C,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1J,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,MAAM,EAAE,aAAa,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAC7H,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAErH;;;GAGG;AACH,8BAAsB,WAAW;IAC/B,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;IACzC,SAAS,CAAC,YAAY,EAAE,mBAAmB,CAAC;gBAEzB,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,mBAAmB;cAKpE,SAAS,CAAC,SAAS,EAAE,SAAS,GA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eAAe,GAAG,OAAO,CAAC,CAAC,CAAC;CAS7K"}
@@ -19,6 +19,30 @@ class SchemaItems {
19
19
  this.schemaItemType = schemaItemType;
20
20
  this.schemaEditor = schemaEditor;
21
21
  }
22
+ /**
23
+ * Sets the SchemaItem description.
24
+ * @param schemaItemKey The SchemaItemKey of the SchemaItem
25
+ * @param description The new description to set.
26
+ */
27
+ async setDescription(schemaItemKey, description) {
28
+ const item = await this.getSchemaItem(schemaItemKey)
29
+ .catch((e) => {
30
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SetDescription, new Exception_1.SchemaItemId(this.schemaItemType, schemaItemKey), e);
31
+ });
32
+ item.setDescription(description);
33
+ }
34
+ /**
35
+ * Sets the SchemaItem display label.
36
+ * @param schemaItemKey The SchemaItemKey of the SchemaItem
37
+ * @param label The new label to set.
38
+ */
39
+ async setDisplayLabel(schemaItemKey, label) {
40
+ const item = await this.getSchemaItem(schemaItemKey)
41
+ .catch((e) => {
42
+ throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SetLabel, new Exception_1.SchemaItemId(this.schemaItemType, schemaItemKey), e);
43
+ });
44
+ item.setDisplayLabel(label);
45
+ }
22
46
  async getSchema(schemaKey) {
23
47
  const schema = await this.schemaEditor.getSchema(schemaKey);
24
48
  if (schema === undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaItems.js","sourceRoot":"","sources":["../../../src/Editing/SchemaItems.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA0J;AAE1J,2CAA0F;AAM1F;;;GAGG;AACH,MAAsB,WAAW;IAI/B,YAAmB,cAA8B,EAAE,YAAiC;QAClF,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAES,KAAK,CAAC,SAAS,CAAC,SAAoB;QAC5C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS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,CAAC,CAAC;YAClF,CAAC;QACH,CAAC;IACH,CAAC;IAES,KAAK,CAAC,yBAAyB,CAAuB,SAAoB,EAAE,IAAoB,EAAE,MAA2B,EAAE,KAAsB;QAC7J,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;YAC1B,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,0BAA0B,EAAE,IAAI,wBAAY,CAAC,IAAI,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC;QAElH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAI,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACpF,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAE9B,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA5ED,kCA4EC","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 Editing\r\n */\r\n\r\nimport { ECObjectsError, ECObjectsStatus, Schema, SchemaItem, SchemaItemKey, SchemaItemProps, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { ECEditingStatus, SchemaEditingError, SchemaId, SchemaItemId } from \"./Exception\";\r\nimport { MutableSchema } from \"./Mutable/MutableSchema\";\r\n\r\nexport type CreateSchemaItem<T extends SchemaItem> = (schema: MutableSchema) => (name: string, ...args: any[]) => Promise<T>;\r\nexport type CreateSchemaItemFromProps<T extends SchemaItem> = (props: SchemaItemProps, ...args: any[]) => Promise<T>;\r\n\r\n/**\r\n * @internal\r\n * A class allowing you to edit the schema item base class.\r\n */\r\nexport abstract class SchemaItems {\r\n protected schemaItemType: SchemaItemType;\r\n protected schemaEditor: SchemaContextEditor;\r\n\r\n public constructor(schemaItemType: SchemaItemType, schemaEditor: SchemaContextEditor) {\r\n this.schemaItemType = schemaItemType;\r\n this.schemaEditor = schemaEditor;\r\n }\r\n\r\n protected async getSchema(schemaKey: SchemaKey): Promise<MutableSchema> {\r\n const schema = await this.schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));\r\n\r\n return schema;\r\n }\r\n\r\n protected async getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey, schemaItemType?: SchemaItemType | null): Promise<T>{\r\n const schemaItem = await this.schemaEditor.schemaContext.getSchemaItem<T>(schemaItemKey);\r\n schemaItemType = schemaItemType === null ? undefined : schemaItemType ?? this.schemaItemType;\r\n\r\n if (!schemaItem) {\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFoundInContext, new SchemaItemId(schemaItemType ?? this.schemaItemType, schemaItemKey));\r\n }\r\n\r\n if (schemaItemType && schemaItemType !== schemaItem.schemaItemType) {\r\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType ?? this.schemaItemType, schemaItemKey));\r\n }\r\n\r\n return schemaItem;\r\n }\r\n\r\n protected async lookupSchemaItem<T extends SchemaItem>(schemaOrKey: MutableSchema | SchemaKey, schemaItemKey: SchemaItemKey, schemaItemType?: SchemaItemType | null): Promise<T>{\r\n schemaItemType = schemaItemType === null ? undefined : schemaItemType ?? this.schemaItemType;\r\n\r\n let schema: Schema;\r\n if (schemaOrKey instanceof SchemaKey) {\r\n schema = await this.getSchema(schemaOrKey);\r\n } else {\r\n schema = schemaOrKey;\r\n }\r\n\r\n const schemaItem = await schema.lookupItem<T>(schemaItemKey);\r\n if (schemaItem === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new SchemaItemId(schemaItemType ?? this.schemaItemType, schemaItemKey));\r\n\r\n if (schemaItemType && schemaItemType !== schemaItem.schemaItemType) {\r\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType ?? this.schemaItemType, schemaItemKey));\r\n }\r\n\r\n return schemaItem;\r\n }\r\n\r\n protected async createSchemaItem<T extends SchemaItem>(schemaKey: SchemaKey, type: SchemaItemType, create: CreateSchemaItem<T>, name: string, ...args: any[]): Promise<T> {\r\n const schema = await this.getSchema(schemaKey);\r\n try {\r\n const boundCreate = create(schema);\r\n return await boundCreate(name, ...args);\r\n } catch (e) {\r\n if (e instanceof ECObjectsError && e.errorNumber === ECObjectsStatus.DuplicateItem) {\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNameAlreadyExists, new SchemaItemId(type, name, schema.schemaKey));\r\n } else {\r\n throw new Error(`Failed to create class ${name} in schema ${schema.fullName}.`);\r\n }\r\n }\r\n }\r\n\r\n protected async createSchemaItemFromProps<T extends SchemaItem>(schemaKey: SchemaKey, type: SchemaItemType, create: CreateSchemaItem<T>, props: SchemaItemProps): Promise<T> {\r\n if (props.name === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNameNotSpecified, new SchemaItemId(type, \"\", schemaKey));\r\n\r\n const newItem = await this.createSchemaItem<T>(schemaKey, type, create, props.name);\r\n await newItem.fromJSON(props);\r\n\r\n return newItem;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SchemaItems.js","sourceRoot":"","sources":["../../../src/Editing/SchemaItems.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA0J;AAE1J,2CAA0F;AAO1F;;;GAGG;AACH,MAAsB,WAAW;IAI/B,YAAmB,cAA8B,EAAE,YAAiC;QAClF,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,cAAc,CAAC,aAA4B,EAAE,WAAmB;QAC3E,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CAAoB,aA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,CAAC;QAE9B,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAtGD,kCAsGC","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 Editing\r\n */\r\n\r\nimport { ECObjectsError, ECObjectsStatus, Schema, SchemaItem, SchemaItemKey, SchemaItemProps, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { ECEditingStatus, SchemaEditingError, SchemaId, SchemaItemId } from \"./Exception\";\r\nimport { MutableSchema } from \"./Mutable/MutableSchema\";\r\nimport { MutableSchemaItem } from \"./Mutable/MutableSchemaItem\";\r\n\r\nexport type CreateSchemaItem<T extends SchemaItem> = (schema: MutableSchema) => (name: string, ...args: any[]) => Promise<T>;\r\nexport type CreateSchemaItemFromProps<T extends SchemaItem> = (props: SchemaItemProps, ...args: any[]) => Promise<T>;\r\n\r\n/**\r\n * @internal\r\n * A class allowing you to edit the schema item base class.\r\n */\r\nexport abstract class SchemaItems {\r\n protected schemaItemType: SchemaItemType;\r\n protected schemaEditor: SchemaContextEditor;\r\n\r\n public constructor(schemaItemType: SchemaItemType, schemaEditor: SchemaContextEditor) {\r\n this.schemaItemType = schemaItemType;\r\n this.schemaEditor = schemaEditor;\r\n }\r\n\r\n /**\r\n * Sets the SchemaItem description.\r\n * @param schemaItemKey The SchemaItemKey of the SchemaItem\r\n * @param description The new description to set.\r\n */\r\n public async setDescription(schemaItemKey: SchemaItemKey, description: string) {\r\n const item = await this.getSchemaItem<MutableSchemaItem>(schemaItemKey)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetDescription, new SchemaItemId(this.schemaItemType, schemaItemKey), e);\r\n });\r\n item.setDescription(description);\r\n }\r\n\r\n /**\r\n * Sets the SchemaItem display label.\r\n * @param schemaItemKey The SchemaItemKey of the SchemaItem\r\n * @param label The new label to set.\r\n */\r\n public async setDisplayLabel(schemaItemKey: SchemaItemKey, label: string) {\r\n const item = await this.getSchemaItem<MutableSchemaItem>(schemaItemKey)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetLabel, new SchemaItemId(this.schemaItemType, schemaItemKey), e);\r\n });\r\n item.setDisplayLabel(label);\r\n }\r\n\r\n protected async getSchema(schemaKey: SchemaKey): Promise<MutableSchema> {\r\n const schema = await this.schemaEditor.getSchema(schemaKey);\r\n if (schema === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));\r\n\r\n return schema;\r\n }\r\n\r\n protected async getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey, schemaItemType?: SchemaItemType | null): Promise<T>{\r\n const schemaItem = await this.schemaEditor.schemaContext.getSchemaItem<T>(schemaItemKey);\r\n schemaItemType = schemaItemType === null ? undefined : schemaItemType ?? this.schemaItemType;\r\n\r\n if (!schemaItem) {\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFoundInContext, new SchemaItemId(schemaItemType ?? this.schemaItemType, schemaItemKey));\r\n }\r\n\r\n if (schemaItemType && schemaItemType !== schemaItem.schemaItemType) {\r\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType ?? this.schemaItemType, schemaItemKey));\r\n }\r\n\r\n return schemaItem;\r\n }\r\n\r\n protected async lookupSchemaItem<T extends SchemaItem>(schemaOrKey: MutableSchema | SchemaKey, schemaItemKey: SchemaItemKey, schemaItemType?: SchemaItemType | null): Promise<T>{\r\n schemaItemType = schemaItemType === null ? undefined : schemaItemType ?? this.schemaItemType;\r\n\r\n let schema: Schema;\r\n if (schemaOrKey instanceof SchemaKey) {\r\n schema = await this.getSchema(schemaOrKey);\r\n } else {\r\n schema = schemaOrKey;\r\n }\r\n\r\n const schemaItem = await schema.lookupItem<T>(schemaItemKey);\r\n if (schemaItem === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new SchemaItemId(schemaItemType ?? this.schemaItemType, schemaItemKey));\r\n\r\n if (schemaItemType && schemaItemType !== schemaItem.schemaItemType) {\r\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType ?? this.schemaItemType, schemaItemKey));\r\n }\r\n\r\n return schemaItem;\r\n }\r\n\r\n protected async createSchemaItem<T extends SchemaItem>(schemaKey: SchemaKey, type: SchemaItemType, create: CreateSchemaItem<T>, name: string, ...args: any[]): Promise<T> {\r\n const schema = await this.getSchema(schemaKey);\r\n try {\r\n const boundCreate = create(schema);\r\n return await boundCreate(name, ...args);\r\n } catch (e) {\r\n if (e instanceof ECObjectsError && e.errorNumber === ECObjectsStatus.DuplicateItem) {\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNameAlreadyExists, new SchemaItemId(type, name, schema.schemaKey));\r\n } else {\r\n throw new Error(`Failed to create class ${name} in schema ${schema.fullName}.`);\r\n }\r\n }\r\n }\r\n\r\n protected async createSchemaItemFromProps<T extends SchemaItem>(schemaKey: SchemaKey, type: SchemaItemType, create: CreateSchemaItem<T>, props: SchemaItemProps): Promise<T> {\r\n if (props.name === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNameNotSpecified, new SchemaItemId(type, \"\", schemaKey));\r\n\r\n const newItem = await this.createSchemaItem<T>(schemaKey, type, create, props.name);\r\n await newItem.fromJSON(props);\r\n\r\n return newItem;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaCompareVisitor.d.ts","sourceRoot":"","sources":["../../../src/Validation/SchemaCompareVisitor.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,oBAAoB,EAAE,6BAA6B,EAClF,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,kBAA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AAK,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAMlD;;;OAGG;IACU,iBAAiB,CAAC,aAAa,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAM1E;;;OAGG;IACU,eAAe,CAAC,YAAY,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrE;;;OAGG;IACU,eAAe,CAAC,WAAW,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAMpE;;;OAGG;IACU,aAAa,CAAC,SAAS,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAK/D"}
@@ -53,7 +53,7 @@ class SchemaCompareVisitor {
53
53
  async visitProperty(propertyA) {
54
54
  let propertyB;
55
55
  const classB = await this._schemaB.lookupItem(propertyA.class.name);
56
- if (classB) {
56
+ if (classB && ecschema_metadata_1.ECClass.isECClass(classB)) {
57
57
  propertyB = await classB.getProperty(propertyA.name);
58
58
  this._schemaComparer.compareProperties(propertyA, propertyB);
59
59
  }
@@ -79,7 +79,8 @@ class SchemaCompareVisitor {
79
79
  */
80
80
  async visitMixin(mixinA) {
81
81
  const mixinB = await this._schemaB.lookupItem(mixinA.name);
82
- this._schemaComparer.compareMixins(mixinA, mixinB);
82
+ if (!mixinB || mixinB.schemaItemType === ecschema_metadata_1.SchemaItemType.Mixin)
83
+ this._schemaComparer.compareMixins(mixinA, mixinB);
83
84
  }
84
85
  /**
85
86
  * Called for each [[RelationshipClass]] instance found during schema traversal.
@@ -87,7 +88,8 @@ class SchemaCompareVisitor {
87
88
  */
88
89
  async visitRelationshipClass(relationshipA) {
89
90
  const relationshipB = await this._schemaB.lookupItem(relationshipA.name);
90
- this._schemaComparer.compareRelationshipClasses(relationshipA, relationshipB);
91
+ if (!relationshipB || relationshipB.schemaItemType === ecschema_metadata_1.SchemaItemType.RelationshipClass)
92
+ this._schemaComparer.compareRelationshipClasses(relationshipA, relationshipB);
91
93
  }
92
94
  /**
93
95
  * Called for each [[RelationshipConstraint]] of each RelationshipClass found during schema traversal.
@@ -96,7 +98,7 @@ class SchemaCompareVisitor {
96
98
  async visitRelationshipConstraint(constraintA) {
97
99
  let constraintB;
98
100
  const relationshipB = await this._schemaB.lookupItem(constraintA.relationshipClass.name);
99
- if (relationshipB)
101
+ if (relationshipB && relationshipB.schemaItemType === ecschema_metadata_1.SchemaItemType.RelationshipClass)
100
102
  constraintB = constraintA.isSource ? relationshipB.source : relationshipB.target;
101
103
  this._schemaComparer.compareRelationshipConstraints(constraintA, constraintB);
102
104
  }
@@ -106,7 +108,8 @@ class SchemaCompareVisitor {
106
108
  */
107
109
  async visitCustomAttributeClass(customAttributeA) {
108
110
  const customAttributeB = await this._schemaB.lookupItem(customAttributeA.name);
109
- this._schemaComparer.compareCustomAttributeClasses(customAttributeA, customAttributeB);
111
+ if (!customAttributeB || customAttributeB.schemaItemType === ecschema_metadata_1.SchemaItemType.CustomAttributeClass)
112
+ this._schemaComparer.compareCustomAttributeClasses(customAttributeA, customAttributeB);
110
113
  }
111
114
  /**
112
115
  * Called for each [[CustomAttribute]] container in the schema.
@@ -124,7 +127,7 @@ class SchemaCompareVisitor {
124
127
  }
125
128
  else if (ecschema_metadata_1.Property.isProperty(containerA)) {
126
129
  const parent = await this._schemaB.lookupItem(containerA.class.name);
127
- containerB = parent ? await parent.getProperty(shortName) : undefined;
130
+ containerB = parent && ecschema_metadata_1.ECClass.isECClass(parent) ? await parent.getProperty(shortName) : undefined;
128
131
  }
129
132
  else if (ecschema_metadata_1.RelationshipConstraint.isRelationshipConstraint(containerA)) {
130
133
  const parent = await this._schemaB.lookupItem(containerA.relationshipClass.name);
@@ -138,7 +141,8 @@ class SchemaCompareVisitor {
138
141
  */
139
142
  async visitEnumeration(enumA) {
140
143
  const enumB = await this._schemaB.lookupItem(enumA.name);
141
- this._schemaComparer.compareEnumerations(enumA, enumB);
144
+ if (!enumB || enumB.schemaItemType === ecschema_metadata_1.SchemaItemType.Enumeration)
145
+ this._schemaComparer.compareEnumerations(enumA, enumB);
142
146
  }
143
147
  /**
144
148
  * Called for each [[KindOfQuantity]] instance found during schema traversal.
@@ -146,7 +150,8 @@ class SchemaCompareVisitor {
146
150
  */
147
151
  async visitKindOfQuantity(koqA) {
148
152
  const koqB = await this._schemaB.lookupItem(koqA.name);
149
- this._schemaComparer.compareKindOfQuantities(koqA, koqB);
153
+ if (!koqB || koqB.schemaItemType === ecschema_metadata_1.SchemaItemType.KindOfQuantity)
154
+ this._schemaComparer.compareKindOfQuantities(koqA, koqB);
150
155
  }
151
156
  /**
152
157
  * Called for each [[PropertyCategory]] instance found during schema traversal.
@@ -154,7 +159,8 @@ class SchemaCompareVisitor {
154
159
  */
155
160
  async visitPropertyCategory(categoryA) {
156
161
  const categoryB = await this._schemaB.lookupItem(categoryA.name);
157
- this._schemaComparer.comparePropertyCategories(categoryA, categoryB);
162
+ if (!categoryB || categoryB.schemaItemType === ecschema_metadata_1.SchemaItemType.PropertyCategory)
163
+ this._schemaComparer.comparePropertyCategories(categoryA, categoryB);
158
164
  }
159
165
  /**
160
166
  * Called for each [[Format]] instance found during schema traversal.
@@ -162,7 +168,8 @@ class SchemaCompareVisitor {
162
168
  */
163
169
  async visitFormat(formatA) {
164
170
  const formatB = await this._schemaB.lookupItem(formatA.name);
165
- this._schemaComparer.compareFormats(formatA, formatB);
171
+ if (!formatB || formatB.schemaItemType === ecschema_metadata_1.SchemaItemType.Format)
172
+ this._schemaComparer.compareFormats(formatA, formatB);
166
173
  }
167
174
  /**
168
175
  * Called for each [[Unit]] instance found during schema traversal.
@@ -170,7 +177,8 @@ class SchemaCompareVisitor {
170
177
  */
171
178
  async visitUnit(unitA) {
172
179
  const unitB = await this._schemaB.lookupItem(unitA.name);
173
- this._schemaComparer.compareUnits(unitA, unitB);
180
+ if (!unitB || ecschema_metadata_1.Unit.isUnit(unitB))
181
+ this._schemaComparer.compareUnits(unitA, unitB);
174
182
  }
175
183
  /**
176
184
  * Called for each [[InvertedUnit]] instance found during schema traversal.
@@ -178,7 +186,8 @@ class SchemaCompareVisitor {
178
186
  */
179
187
  async visitInvertedUnit(invertedUnitA) {
180
188
  const invertedUnitB = await this._schemaB.lookupItem(invertedUnitA.name);
181
- this._schemaComparer.compareInvertedUnits(invertedUnitA, invertedUnitB);
189
+ if (!invertedUnitB || invertedUnitB.schemaItemType === ecschema_metadata_1.SchemaItemType.InvertedUnit)
190
+ this._schemaComparer.compareInvertedUnits(invertedUnitA, invertedUnitB);
182
191
  }
183
192
  /**
184
193
  * Called for each [[UnitSystem]] instance found during schema traversal.
@@ -193,7 +202,8 @@ class SchemaCompareVisitor {
193
202
  */
194
203
  async visitPhenomenon(phenomenonA) {
195
204
  const phenomenonB = await this._schemaB.lookupItem(phenomenonA.name);
196
- this._schemaComparer.comparePhenomenons(phenomenonA, phenomenonB);
205
+ if (!phenomenonB || phenomenonB.schemaItemType === ecschema_metadata_1.SchemaItemType.Phenomenon)
206
+ this._schemaComparer.comparePhenomenons(phenomenonA, phenomenonB);
197
207
  }
198
208
  /**
199
209
  * Called for each [[Constant]] instance found during schema traversal.
@@ -201,7 +211,8 @@ class SchemaCompareVisitor {
201
211
  */
202
212
  async visitConstant(constantA) {
203
213
  const constantB = await this._schemaB.lookupItem(constantA.name);
204
- this._schemaComparer.compareConstants(constantA, constantB);
214
+ if (!constantB || constantB.schemaItemType === ecschema_metadata_1.SchemaItemType.Constant)
215
+ this._schemaComparer.compareConstants(constantA, constantB);
205
216
  }
206
217
  }
207
218
  exports.SchemaCompareVisitor = SchemaCompareVisitor;
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaCompareVisitor.js","sourceRoot":"","sources":["../../../src/Validation/SchemaCompareVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAIkC;AAGlC;;;GAGG;AACH,MAAa,oBAAoB;IAI/B;;;;OAIG;IACH,YAAY,cAA+B,EAAE,eAAuB;QAClE,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI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CAAC,eAAe,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,iBAAiB,CAAC,aAA2B;QACxD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAe,aAAa,CAAC,IAAI,CAAC,CAAC;QACvF,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;IAC1E,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,eAAe,CAAC,YAAwB;QACnD,mDAAmD;IACrD,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,eAAe,CAAC,WAAuB;QAClD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAa,WAAW,CAAC,IAAI,CAAC,CAAC;QACjF,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACpE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,aAAa,CAAC,SAAmB;QAC5C,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAW,SAAS,CAAC,IAAI,CAAC,CAAC;QAC3E,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAC9D,CAAC;CACF;AArND,oDAqNC","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 Comparison\r\n */\r\n\r\nimport { AnyClass, AnyProperty, Constant, CustomAttributeClass, CustomAttributeContainerProps,\r\n ECClass, EntityClass, Enumeration, Format, InvertedUnit, ISchemaPartVisitor, KindOfQuantity, Mixin,\r\n Phenomenon, Property, PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem,\r\n StructClass, Unit, UnitSystem,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { ISchemaComparer } from \"./SchemaComparer\";\r\n\r\n/**\r\n * An ISchemaPartVisitor interface implementation that is used to compare to Schemas.\r\n * @internal\r\n */\r\nexport class SchemaCompareVisitor implements ISchemaPartVisitor {\r\n private _schemaB: Schema;\r\n private _schemaComparer: ISchemaComparer;\r\n\r\n /**\r\n * Initializes a new SchemaCompareVisitor instance.\r\n * @param schemaComparer The [[SchemaComparer]] to use to compare each item of the schema.\r\n * @param schemaToCompare The second or 'B' schema to compare against the schema being traversed (Schema A).\r\n */\r\n constructor(schemaComparer: ISchemaComparer, schemaToCompare: Schema) {\r\n this._schemaComparer = schemaComparer;\r\n this._schemaB = schemaToCompare;\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(schemaA: Schema) {\r\n this._schemaComparer.compareSchemaProps(schemaA, this._schemaB);\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(schemaItemA: SchemaItem) {\r\n const schemaItemB = await this._schemaB.lookupItem(schemaItemA.name);\r\n this._schemaComparer.compareSchemaItems(schemaItemA, schemaItemB);\r\n }\r\n\r\n /**\r\n * Called for each [[AnyClass]] instance found during schema traversal.\r\n * @param ecClass an ECClass object.\r\n */\r\n public async visitClass(classA: AnyClass): Promise<void> {\r\n const classB = await this._schemaB.lookupItem<AnyClass>(classA.name);\r\n this._schemaComparer.compareClasses(classA, classB);\r\n }\r\n\r\n /**\r\n * Called for each [[AnyProperty]] instance of an ECClass.\r\n * @param property an AnyProperty object.\r\n */\r\n public async visitProperty(propertyA: AnyProperty): Promise<void> {\r\n let propertyB: AnyProperty | undefined;\r\n\r\n const classB = await this._schemaB.lookupItem<ECClass>(propertyA.class.name);\r\n if (classB) {\r\n propertyB = await classB.getProperty(propertyA.name) as AnyProperty;\r\n this._schemaComparer.compareProperties(propertyA, propertyB);\r\n }\r\n }\r\n\r\n /**\r\n * Called for each [[EntityClass]] instance found during schema traversal.\r\n * @param entityClass an EntityClass object.\r\n */\r\n public async visitEntityClass(entityA: EntityClass): Promise<void> {\r\n const entityB = await this._schemaB.lookupItem<EntityClass>(entityA.name);\r\n this._schemaComparer.compareEntityClasses(entityA, entityB);\r\n }\r\n\r\n /**\r\n * Called for each [[StructClass]] instance found during schema traversal.\r\n * @param structClass a StructClass object.\r\n */\r\n public async visitStructClass(_structA: StructClass): Promise<void> {\r\n // No comparison to make specifically on StructClasses\r\n }\r\n\r\n /**\r\n * Called for each [[Mixin]] instance found during schema traversal.\r\n * @param mixin a Mixin object.\r\n */\r\n public async visitMixin(mixinA: Mixin): Promise<void> {\r\n const mixinB = await this._schemaB.lookupItem<Mixin>(mixinA.name);\r\n this._schemaComparer.compareMixins(mixinA, mixinB);\r\n }\r\n\r\n /**\r\n * Called for each [[RelationshipClass]] instance found during schema traversal.\r\n * @param relationshipClass a RelationshipClass object.\r\n */\r\n public async visitRelationshipClass(relationshipA: RelationshipClass): Promise<void> {\r\n const relationshipB = await this._schemaB.lookupItem<RelationshipClass>(relationshipA.name);\r\n this._schemaComparer.compareRelationshipClasses(relationshipA, relationshipB);\r\n }\r\n\r\n /**\r\n * Called for each [[RelationshipConstraint]] of each RelationshipClass found during schema traversal.\r\n * @param relationshipConstraint a RelationshipConstraint object.\r\n */\r\n public async visitRelationshipConstraint(constraintA: RelationshipConstraint): Promise<void> {\r\n let constraintB: RelationshipConstraint | undefined;\r\n const relationshipB = await this._schemaB.lookupItem<RelationshipClass>(constraintA.relationshipClass.name);\r\n if (relationshipB)\r\n constraintB = constraintA.isSource ? relationshipB.source : relationshipB.target;\r\n this._schemaComparer.compareRelationshipConstraints(constraintA, constraintB);\r\n }\r\n\r\n /**\r\n * Called for each [[CustomAttributeClass]] instance found during schema traversal.\r\n * @param customAttributeClass a CustomAttributeClass object.\r\n */\r\n public async visitCustomAttributeClass(customAttributeA: CustomAttributeClass): Promise<void> {\r\n const customAttributeB = await this._schemaB.lookupItem<CustomAttributeClass>(customAttributeA.name);\r\n this._schemaComparer.compareCustomAttributeClasses(customAttributeA, customAttributeB);\r\n }\r\n\r\n /**\r\n * Called for each [[CustomAttribute]] container in the schema.\r\n * @param customAttributeContainer a [[CustomAttributeContainerProps]] object.\r\n */\r\n public async visitCustomAttributeContainer(containerA: CustomAttributeContainerProps): Promise<void> {\r\n const nameParts = containerA.fullName.split(\".\");\r\n const shortName = nameParts.length === 1 ? nameParts[0] : nameParts[1];\r\n let containerB: CustomAttributeContainerProps | undefined;\r\n\r\n if (Schema.isSchema(containerA)) {\r\n containerB = this._schemaB;\r\n } else if (ECClass.isECClass(containerA)) {\r\n containerB = await this._schemaB.lookupItem(containerA.name);\r\n } else if (Property.isProperty(containerA)) {\r\n const parent = await this._schemaB.lookupItem<ECClass>(containerA.class.name);\r\n containerB = parent ? await parent.getProperty(shortName) : undefined;\r\n } else if (RelationshipConstraint.isRelationshipConstraint(containerA)) {\r\n const parent = await this._schemaB.lookupItem<RelationshipClass>(containerA.relationshipClass.name);\r\n containerB = parent ? containerA.isSource ? parent.source : parent.target : undefined;\r\n }\r\n\r\n this._schemaComparer.compareCustomAttributeContainers(containerA, containerB);\r\n }\r\n\r\n /**\r\n * Called for each [[Enumeration]] instance found during schema traversal.\r\n * @param enumeration an Enumeration object.\r\n */\r\n public async visitEnumeration(enumA: Enumeration) {\r\n const enumB = await this._schemaB.lookupItem<Enumeration>(enumA.name);\r\n this._schemaComparer.compareEnumerations(enumA, enumB);\r\n }\r\n\r\n /**\r\n * Called for each [[KindOfQuantity]] instance found during schema traversal.\r\n * @param koq a KindOfQuantity object.\r\n */\r\n public async visitKindOfQuantity(koqA: KindOfQuantity) {\r\n const koqB = await this._schemaB.lookupItem<KindOfQuantity>(koqA.name);\r\n this._schemaComparer.compareKindOfQuantities(koqA, koqB);\r\n }\r\n\r\n /**\r\n * Called for each [[PropertyCategory]] instance found during schema traversal.\r\n * @param category a PropertyCategory object.\r\n */\r\n public async visitPropertyCategory(categoryA: PropertyCategory) {\r\n const categoryB = await this._schemaB.lookupItem<PropertyCategory>(categoryA.name);\r\n this._schemaComparer.comparePropertyCategories(categoryA, categoryB);\r\n }\r\n\r\n /**\r\n * Called for each [[Format]] instance found during schema traversal.\r\n * @param format a Format object.\r\n */\r\n public async visitFormat(formatA: Format): Promise<void> {\r\n const formatB = await this._schemaB.lookupItem<Format>(formatA.name);\r\n this._schemaComparer.compareFormats(formatA, formatB);\r\n }\r\n\r\n /**\r\n * Called for each [[Unit]] instance found during schema traversal.\r\n * @param unit a Unit object.\r\n */\r\n public async visitUnit(unitA: Unit): Promise<void> {\r\n const unitB = await this._schemaB.lookupItem<Unit>(unitA.name);\r\n this._schemaComparer.compareUnits(unitA, unitB);\r\n }\r\n\r\n /**\r\n * Called for each [[InvertedUnit]] instance found during schema traversal.\r\n * @param invertedUnit an InvertedUnit object.\r\n */\r\n public async visitInvertedUnit(invertedUnitA: InvertedUnit): Promise<void> {\r\n const invertedUnitB = await this._schemaB.lookupItem<InvertedUnit>(invertedUnitA.name);\r\n this._schemaComparer.compareInvertedUnits(invertedUnitA, invertedUnitB);\r\n }\r\n\r\n /**\r\n * Called for each [[UnitSystem]] instance found during schema traversal.\r\n * @param unitSystem a UnitSystem object.\r\n */\r\n public async visitUnitSystem(_unitSystemA: UnitSystem): Promise<void> {\r\n // No comparison to make specifically on unitSystem\r\n }\r\n\r\n /**\r\n * Called for each [[Phenomenon]] instance found during schema traversal.\r\n * @param phenomena a Phenomenon object.\r\n */\r\n public async visitPhenomenon(phenomenonA: Phenomenon): Promise<void> {\r\n const phenomenonB = await this._schemaB.lookupItem<Phenomenon>(phenomenonA.name);\r\n this._schemaComparer.comparePhenomenons(phenomenonA, phenomenonB);\r\n }\r\n\r\n /**\r\n * Called for each [[Constant]] instance found during schema traversal.\r\n * @param constant a Constant object.\r\n */\r\n public async visitConstant(constantA: Constant): Promise<void> {\r\n const constantB = await this._schemaB.lookupItem<Constant>(constantA.name);\r\n this._schemaComparer.compareConstants(constantA, constantB);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SchemaCompareVisitor.js","sourceRoot":"","sources":["../../../src/Validation/SchemaCompareVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAIkC;AAGlC;;;GAGG;AACH,MAAa,oBAAoB;IAI/B;;;;OAIG;IACH,YAAY,cAA+B,EAAE,eAAuB;QAClE,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,eAAe,CAAC;IAClC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,eAAe,CAAC,OAAe;QAC1C,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,eAAe,CAAC,WAAuB;QAClD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACrE,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACpE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,UAAU,CAAC,MAAgB;QACtC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAW,MAAM,CAAC,IAAI,CAAC,CAAC;QACrE,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,aAAa,CAAC,SAAsB;QAC/C,IAAI,SAAkC,CAAC;QAEvC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAU,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7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AAiB,CAAC,aAA2B;QACxD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAe,aAAa,CAAC,IAAI,CAAC,CAAC;QACvF,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,cAAc,KAAK,kCAAc,CAAC,YAAY;YAChF,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;IAC5E,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,eAAe,CAAC,YAAwB;QACnD,mDAAmD;IACrD,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,eAAe,CAAC,WAAuB;QAClD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAa,WAAW,CAAC,IAAI,CAAC,CAAC;QACjF,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,cAAc,KAAK,kCAAc,CAAC,UAAU;YAC1E,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,aAAa,CAAC,SAAmB;QAC5C,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAW,SAAS,CAAC,IAAI,CAAC,CAAC;QAC3E,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,cAAc,KAAK,kCAAc,CAAC,QAAQ;YACpE,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAChE,CAAC;CACF;AAhOD,oDAgOC","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 Comparison\r\n */\r\n\r\nimport { AnyClass, AnyProperty, Constant, CustomAttributeClass, CustomAttributeContainerProps,\r\n ECClass, EntityClass, Enumeration, Format, InvertedUnit, ISchemaPartVisitor, KindOfQuantity, Mixin,\r\n Phenomenon, Property, PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem,\r\n SchemaItemType, StructClass, Unit, UnitSystem,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { ISchemaComparer } from \"./SchemaComparer\";\r\n\r\n/**\r\n * An ISchemaPartVisitor interface implementation that is used to compare to Schemas.\r\n * @internal\r\n */\r\nexport class SchemaCompareVisitor implements ISchemaPartVisitor {\r\n private _schemaB: Schema;\r\n private _schemaComparer: ISchemaComparer;\r\n\r\n /**\r\n * Initializes a new SchemaCompareVisitor instance.\r\n * @param schemaComparer The [[SchemaComparer]] to use to compare each item of the schema.\r\n * @param schemaToCompare The second or 'B' schema to compare against the schema being traversed (Schema A).\r\n */\r\n constructor(schemaComparer: ISchemaComparer, schemaToCompare: Schema) {\r\n this._schemaComparer = schemaComparer;\r\n this._schemaB = schemaToCompare;\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(schemaA: Schema) {\r\n this._schemaComparer.compareSchemaProps(schemaA, this._schemaB);\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(schemaItemA: SchemaItem) {\r\n const schemaItemB = await this._schemaB.lookupItem(schemaItemA.name);\r\n this._schemaComparer.compareSchemaItems(schemaItemA, schemaItemB);\r\n }\r\n\r\n /**\r\n * Called for each [[AnyClass]] instance found during schema traversal.\r\n * @param ecClass an ECClass object.\r\n */\r\n public async visitClass(classA: AnyClass): Promise<void> {\r\n const classB = await this._schemaB.lookupItem<AnyClass>(classA.name);\r\n this._schemaComparer.compareClasses(classA, classB);\r\n }\r\n\r\n /**\r\n * Called for each [[AnyProperty]] instance of an ECClass.\r\n * @param property an AnyProperty object.\r\n */\r\n public async visitProperty(propertyA: AnyProperty): Promise<void> {\r\n let propertyB: AnyProperty | undefined;\r\n\r\n const classB = await this._schemaB.lookupItem<ECClass>(propertyA.class.name);\r\n if (classB && ECClass.isECClass(classB)) {\r\n propertyB = await classB.getProperty(propertyA.name) as AnyProperty;\r\n this._schemaComparer.compareProperties(propertyA, propertyB);\r\n }\r\n }\r\n\r\n /**\r\n * Called for each [[EntityClass]] instance found during schema traversal.\r\n * @param entityClass an EntityClass object.\r\n */\r\n public async visitEntityClass(entityA: EntityClass): Promise<void> {\r\n const entityB = await this._schemaB.lookupItem<EntityClass>(entityA.name);\r\n this._schemaComparer.compareEntityClasses(entityA, entityB);\r\n }\r\n\r\n /**\r\n * Called for each [[StructClass]] instance found during schema traversal.\r\n * @param structClass a StructClass object.\r\n */\r\n public async visitStructClass(_structA: StructClass): Promise<void> {\r\n // No comparison to make specifically on StructClasses\r\n }\r\n\r\n /**\r\n * Called for each [[Mixin]] instance found during schema traversal.\r\n * @param mixin a Mixin object.\r\n */\r\n public async visitMixin(mixinA: Mixin): Promise<void> {\r\n const mixinB = await this._schemaB.lookupItem<Mixin>(mixinA.name);\r\n if (!mixinB || mixinB.schemaItemType === SchemaItemType.Mixin)\r\n this._schemaComparer.compareMixins(mixinA, mixinB);\r\n }\r\n\r\n /**\r\n * Called for each [[RelationshipClass]] instance found during schema traversal.\r\n * @param relationshipClass a RelationshipClass object.\r\n */\r\n public async visitRelationshipClass(relationshipA: RelationshipClass): Promise<void> {\r\n const relationshipB = await this._schemaB.lookupItem<RelationshipClass>(relationshipA.name);\r\n if (!relationshipB || relationshipB.schemaItemType === SchemaItemType.RelationshipClass)\r\n this._schemaComparer.compareRelationshipClasses(relationshipA, relationshipB);\r\n }\r\n\r\n /**\r\n * Called for each [[RelationshipConstraint]] of each RelationshipClass found during schema traversal.\r\n * @param relationshipConstraint a RelationshipConstraint object.\r\n */\r\n public async visitRelationshipConstraint(constraintA: RelationshipConstraint): Promise<void> {\r\n let constraintB: RelationshipConstraint | undefined;\r\n const relationshipB = await this._schemaB.lookupItem<RelationshipClass>(constraintA.relationshipClass.name);\r\n if (relationshipB && relationshipB.schemaItemType === SchemaItemType.RelationshipClass)\r\n constraintB = constraintA.isSource ? relationshipB.source : relationshipB.target;\r\n this._schemaComparer.compareRelationshipConstraints(constraintA, constraintB);\r\n }\r\n\r\n /**\r\n * Called for each [[CustomAttributeClass]] instance found during schema traversal.\r\n * @param customAttributeClass a CustomAttributeClass object.\r\n */\r\n public async visitCustomAttributeClass(customAttributeA: CustomAttributeClass): Promise<void> {\r\n const customAttributeB = await this._schemaB.lookupItem<CustomAttributeClass>(customAttributeA.name);\r\n if (!customAttributeB || customAttributeB.schemaItemType === SchemaItemType.CustomAttributeClass)\r\n this._schemaComparer.compareCustomAttributeClasses(customAttributeA, customAttributeB);\r\n }\r\n\r\n /**\r\n * Called for each [[CustomAttribute]] container in the schema.\r\n * @param customAttributeContainer a [[CustomAttributeContainerProps]] object.\r\n */\r\n public async visitCustomAttributeContainer(containerA: CustomAttributeContainerProps): Promise<void> {\r\n const nameParts = containerA.fullName.split(\".\");\r\n const shortName = nameParts.length === 1 ? nameParts[0] : nameParts[1];\r\n let containerB: CustomAttributeContainerProps | undefined;\r\n\r\n if (Schema.isSchema(containerA)) {\r\n containerB = this._schemaB;\r\n } else if (ECClass.isECClass(containerA)) {\r\n containerB = await this._schemaB.lookupItem(containerA.name);\r\n } else if (Property.isProperty(containerA)) {\r\n const parent = await this._schemaB.lookupItem<ECClass>(containerA.class.name);\r\n containerB = parent && ECClass.isECClass(parent) ? await parent.getProperty(shortName) : undefined;\r\n } else if (RelationshipConstraint.isRelationshipConstraint(containerA)) {\r\n const parent = await this._schemaB.lookupItem<RelationshipClass>(containerA.relationshipClass.name);\r\n containerB = parent ? containerA.isSource ? parent.source : parent.target : undefined;\r\n }\r\n\r\n this._schemaComparer.compareCustomAttributeContainers(containerA, containerB);\r\n }\r\n\r\n /**\r\n * Called for each [[Enumeration]] instance found during schema traversal.\r\n * @param enumeration an Enumeration object.\r\n */\r\n public async visitEnumeration(enumA: Enumeration) {\r\n const enumB = await this._schemaB.lookupItem<Enumeration>(enumA.name);\r\n if (!enumB || enumB.schemaItemType === SchemaItemType.Enumeration)\r\n this._schemaComparer.compareEnumerations(enumA, enumB);\r\n }\r\n\r\n /**\r\n * Called for each [[KindOfQuantity]] instance found during schema traversal.\r\n * @param koq a KindOfQuantity object.\r\n */\r\n public async visitKindOfQuantity(koqA: KindOfQuantity) {\r\n const koqB = await this._schemaB.lookupItem<KindOfQuantity>(koqA.name);\r\n if (!koqB || koqB.schemaItemType === SchemaItemType.KindOfQuantity)\r\n this._schemaComparer.compareKindOfQuantities(koqA, koqB);\r\n }\r\n\r\n /**\r\n * Called for each [[PropertyCategory]] instance found during schema traversal.\r\n * @param category a PropertyCategory object.\r\n */\r\n public async visitPropertyCategory(categoryA: PropertyCategory) {\r\n const categoryB = await this._schemaB.lookupItem<PropertyCategory>(categoryA.name);\r\n if (!categoryB || categoryB.schemaItemType === SchemaItemType.PropertyCategory)\r\n this._schemaComparer.comparePropertyCategories(categoryA, categoryB);\r\n }\r\n\r\n /**\r\n * Called for each [[Format]] instance found during schema traversal.\r\n * @param format a Format object.\r\n */\r\n public async visitFormat(formatA: Format): Promise<void> {\r\n const formatB = await this._schemaB.lookupItem<Format>(formatA.name);\r\n if (!formatB || formatB.schemaItemType === SchemaItemType.Format)\r\n this._schemaComparer.compareFormats(formatA, formatB);\r\n }\r\n\r\n /**\r\n * Called for each [[Unit]] instance found during schema traversal.\r\n * @param unit a Unit object.\r\n */\r\n public async visitUnit(unitA: Unit): Promise<void> {\r\n const unitB = await this._schemaB.lookupItem<Unit>(unitA.name);\r\n if (!unitB || Unit.isUnit(unitB))\r\n this._schemaComparer.compareUnits(unitA, unitB);\r\n }\r\n\r\n /**\r\n * Called for each [[InvertedUnit]] instance found during schema traversal.\r\n * @param invertedUnit an InvertedUnit object.\r\n */\r\n public async visitInvertedUnit(invertedUnitA: InvertedUnit): Promise<void> {\r\n const invertedUnitB = await this._schemaB.lookupItem<InvertedUnit>(invertedUnitA.name);\r\n if (!invertedUnitB || invertedUnitB.schemaItemType === SchemaItemType.InvertedUnit)\r\n this._schemaComparer.compareInvertedUnits(invertedUnitA, invertedUnitB);\r\n }\r\n\r\n /**\r\n * Called for each [[UnitSystem]] instance found during schema traversal.\r\n * @param unitSystem a UnitSystem object.\r\n */\r\n public async visitUnitSystem(_unitSystemA: UnitSystem): Promise<void> {\r\n // No comparison to make specifically on unitSystem\r\n }\r\n\r\n /**\r\n * Called for each [[Phenomenon]] instance found during schema traversal.\r\n * @param phenomena a Phenomenon object.\r\n */\r\n public async visitPhenomenon(phenomenonA: Phenomenon): Promise<void> {\r\n const phenomenonB = await this._schemaB.lookupItem<Phenomenon>(phenomenonA.name);\r\n if (!phenomenonB || phenomenonB.schemaItemType === SchemaItemType.Phenomenon)\r\n this._schemaComparer.comparePhenomenons(phenomenonA, phenomenonB);\r\n }\r\n\r\n /**\r\n * Called for each [[Constant]] instance found during schema traversal.\r\n * @param constant a Constant object.\r\n */\r\n public async visitConstant(constantA: Constant): Promise<void> {\r\n const constantB = await this._schemaB.lookupItem<Constant>(constantA.name);\r\n if (!constantB || constantB.schemaItemType === SchemaItemType.Constant)\r\n this._schemaComparer.compareConstants(constantA, constantB);\r\n }\r\n}\r\n"]}
@@ -10,6 +10,7 @@ export * from "./Validation/SchemaChanges";
10
10
  export * from "./Validation/SchemaComparer";
11
11
  export * from "./Validation/SchemaCompareReporter";
12
12
  export * from "./Editing/Editor";
13
+ export * from "./Editing/Exception";
13
14
  export { ISuppressionRule, IRuleSuppressionSet, IRuleSuppressionMap } from "./Validation/RuleSuppressionSet";
14
15
  export { SchemaValidater } from "./Validation/SchemaValidater";
15
16
  export { SchemaMerger } from "./Merging/SchemaMerger";
@@ -1 +1 @@
1
- {"version":3,"file":"ecschema-editing.d.ts","sourceRoot":"","sources":["../../src/ecschema-editing.ts"],"names":[],"mappings":"AAKA,cAAc,yBAAyB,CAAC;AACxC,cAAc,i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E,MAAM,iCAAiC,CAAC;AAC7G,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AAEtC;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
@@ -35,6 +35,7 @@ __exportStar(require("./Validation/SchemaChanges"), exports);
35
35
  __exportStar(require("./Validation/SchemaComparer"), exports);
36
36
  __exportStar(require("./Validation/SchemaCompareReporter"), exports);
37
37
  __exportStar(require("./Editing/Editor"), exports);
38
+ __exportStar(require("./Editing/Exception"), exports);
38
39
  var SchemaValidater_1 = require("./Validation/SchemaValidater");
39
40
  Object.defineProperty(exports, "SchemaValidater", { enumerable: true, get: function () { return SchemaValidater_1.SchemaValidater; } });
40
41
  var SchemaMerger_1 = require("./Merging/SchemaMerger");
@@ -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,sDAAsD;AACtD,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;AAEjC,gEAA+D;AAAtD,kHAAA,eAAe,OAAA;AACxB,uDAAsD;AAA7C,4GAAA,YAAY,OAAA;AACrB,kEAAgD;AAChD,iEAA+C;AAC/C,wDAAsC;AAEtC;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","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\r\nexport * from \"./Validation/Diagnostic\";\r\nexport * from \"./Validation/DiagnosticReporter\";\r\n/* eslint-disable-next-line deprecation/deprecation */\r\nexport { DiagnosticCodes, Diagnostics, ECRuleSet } from \"./Validation/ECRules\";\r\nexport * from \"./Validation/LoggingDiagnosticReporter\";\r\nexport * from \"./Validation/Rules\";\r\nexport * from \"./Validation/SchemaValidationVisitor\";\r\nexport * from \"./Validation/SchemaWalker\";\r\nexport * from \"./Validation/SchemaCompareDiagnostics\";\r\nexport * from \"./Validation/SchemaChanges\";\r\nexport * from \"./Validation/SchemaComparer\";\r\nexport * from \"./Validation/SchemaCompareReporter\";\r\nexport * from \"./Editing/Editor\";\r\nexport { ISuppressionRule, IRuleSuppressionSet, IRuleSuppressionMap } from \"./Validation/RuleSuppressionSet\";\r\nexport { SchemaValidater } from \"./Validation/SchemaValidater\";\r\nexport { SchemaMerger } from \"./Merging/SchemaMerger\";\r\nexport * from \"./Differencing/SchemaDifference\";\r\nexport * from \"./Differencing/SchemaConflicts\";\r\nexport * from \"./Differencing/Errors\";\r\n\r\n/** @docs-package-description\r\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).\r\n */\r\n/**\r\n * @docs-group-description Editing\r\n * Set of classes used to perform editing of ECSchemas.\r\n */\r\n/**\r\n * @docs-group-description Diagnostic\r\n * Set of classes to categorize and manage ECSchema validation results.\r\n */\r\n/**\r\n * @docs-group-description Validation\r\n * Set of classes used to perform validation on ECSchemas.\r\n */\r\n/**\r\n * @docs-group-description Comparison\r\n * Set of classes to enable comparison of ECSchemas.\r\n */\r\n/**\r\n * @docs-group-description Merging\r\n * Set of classes used to merge schemas.\r\n */\r\n/**\r\n * @docs-group-description Differencing\r\n * Set of classes used to perform differences between ECSchemas.\r\n */\r\n"]}
1
+ {"version":3,"file":"ecschema-editing.js","sourceRoot":"","sources":["../../src/ecschema-editing.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;AAE/F,0DAAwC;AACxC,kEAAgD;AAChD,sDAAsD;AACtD,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,uDAAsD;AAA7C,4GAAA,YAAY,OAAA;AACrB,kEAAgD;AAChD,iEAA+C;AAC/C,wDAAsC;AAEtC;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","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\r\nexport * from \"./Validation/Diagnostic\";\r\nexport * from \"./Validation/DiagnosticReporter\";\r\n/* eslint-disable-next-line deprecation/deprecation */\r\nexport { DiagnosticCodes, Diagnostics, ECRuleSet } from \"./Validation/ECRules\";\r\nexport * from \"./Validation/LoggingDiagnosticReporter\";\r\nexport * from \"./Validation/Rules\";\r\nexport * from \"./Validation/SchemaValidationVisitor\";\r\nexport * from \"./Validation/SchemaWalker\";\r\nexport * from \"./Validation/SchemaCompareDiagnostics\";\r\nexport * from \"./Validation/SchemaChanges\";\r\nexport * from \"./Validation/SchemaComparer\";\r\nexport * from \"./Validation/SchemaCompareReporter\";\r\nexport * from \"./Editing/Editor\";\r\nexport * from \"./Editing/Exception\";\r\nexport { ISuppressionRule, IRuleSuppressionSet, IRuleSuppressionMap } from \"./Validation/RuleSuppressionSet\";\r\nexport { SchemaValidater } from \"./Validation/SchemaValidater\";\r\nexport { SchemaMerger } from \"./Merging/SchemaMerger\";\r\nexport * from \"./Differencing/SchemaDifference\";\r\nexport * from \"./Differencing/SchemaConflicts\";\r\nexport * from \"./Differencing/Errors\";\r\n\r\n/** @docs-package-description\r\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).\r\n */\r\n/**\r\n * @docs-group-description Editing\r\n * Set of classes used to perform editing of ECSchemas.\r\n */\r\n/**\r\n * @docs-group-description Diagnostic\r\n * Set of classes to categorize and manage ECSchema validation results.\r\n */\r\n/**\r\n * @docs-group-description Validation\r\n * Set of classes used to perform validation on ECSchemas.\r\n */\r\n/**\r\n * @docs-group-description Comparison\r\n * Set of classes to enable comparison of ECSchemas.\r\n */\r\n/**\r\n * @docs-group-description Merging\r\n * Set of classes used to merge schemas.\r\n */\r\n/**\r\n * @docs-group-description Differencing\r\n * Set of classes used to perform differences between ECSchemas.\r\n */\r\n"]}