/** @packageDocumentation * @module Editing */ import { AnyDiagnostic } from "../Validation/Diagnostic"; import { AnyEnumerator, CustomAttributeContainerProps, Enumeration, Property, RelationshipConstraint, SchemaItemKey, SchemaItemType, SchemaKey } from "@itwin/ecschema-metadata"; /** @alpha */ export declare enum ECEditingStatus { EC_EDITING_ERROR_BASE = 196608, Unknown = 0, RuleViolation = 196609, SchemaNotFound = 196610, SchemaItemNotFound = 196611, SchemaItemNotFoundInContext = 196612, PropertyAlreadyExists = 196613, PropertyNotFound = 196614, InvalidPropertyType = 196615, BaseClassIsNotElement = 196616, BaseClassIsNotElementUniqueAspect = 196617, BaseClassIsNotElementMultiAspect = 196618, SchemaItemNameNotSpecified = 196619, InvalidSchemaItemType = 196620, SchemaItemNameAlreadyExists = 196621, InvalidEnumeratorType = 196622, InvalidBaseClass = 196623, EnumeratorDoesNotExist = 196624, InvalidECName = 196625, InvalidSchemaAlias = 196626, InvalidFormatUnitsSpecified = 196627, SchemaAliasAlreadyExists = 196628, CreateSchemaItemFailed = 196629, CreateSchemaItemFromProps = 196630, CreateElement = 196631, CreateElementUniqueAspect = 196632, CreateElementMultiAspect = 196633, SetBaseClass = 196634, SetSourceConstraint = 196635, SetTargetConstraint = 196636, AddConstraintClass = 196637, RemoveConstraintClass = 196638, SetAbstractConstraint = 196639, AddCustomAttributeToConstraint = 196640, AddCustomAttributeToProperty = 196641, AddCustomAttributeToClass = 196642, CreateNavigationProperty = 196643, CreateNavigationPropertyFromProps = 196644, SetInvertsUnit = 196645, SetUnitSystem = 196646, SetDescription = 196647, SetLabel = 196648, SetIsReadOnly = 196649, SetPriority = 196650, SetCategory = 196651, SetKindOfQuantity = 196652, SetMinOccurs = 196653, SetMaxOccurs = 196654, SetExtendedTypeName = 196655, SetMinLength = 196656, SetMaxLength = 196657, SetMinValue = 196658, SetMaxValue = 196659, SetPropertyName = 196660, AddMixin = 196661, AddEnumerator = 196662, SetEnumeratorLabel = 196663, SetEnumeratorDescription = 196664, AddPresentationUnit = 196665, AddPresentationOverride = 196666, CreateFormatOverride = 196667, SetPropertyCategoryPriority = 196668, CreatePrimitiveProperty = 196669, CreatePrimitivePropertyFromProps = 196670, CreateEnumerationProperty = 196671, CreateEnumerationPropertyFromProps = 196672, CreatePrimitiveArrayProperty = 196673, CreatePrimitiveArrayPropertyFromProps = 196674, CreateEnumerationArrayProperty = 196675, CreateEnumerationArrayPropertyFromProps = 196676, CreateStructProperty = 196677, CreateStructPropertyFromProps = 196678, CreateStructArrayProperty = 196679, CreateStructArrayPropertyFromProps = 196680, DeleteProperty = 196681, DeleteClass = 196682, SetClassName = 196683, AddSchemaReference = 196684, SetSchemaVersion = 196685, IncrementSchemaMinorVersion = 196686, SetSchemaAlias = 196687 } /** * A type that constrains the possible error types handled by SchemaEditingError * @alpha */ export type AnyEditingError = SchemaEditingError | Error; /** * Defines the possible property type names. * @alpha */ export declare enum PropertyTypeName { ArrayProperty = "ArrayProperty", PrimitiveProperty = "PrimitiveProperty", EnumerationProperty = "EnumerationProperty", NavigationProperty = "NavigationProperty", StructProperty = "StructProperty" } /** * Defines the possible schema type identifiers. * @alpha */ export declare enum SchemaTypeIdentifiers { SchemaIdentifier = "Schema", SchemaItemIdentifier = "SchemaItem", ClassIdentifier = "Class", PropertyIdentifier = "Property", EnumeratorIdentifier = "Enumerator", CustomAttributeIdentifier = "CustomAttribute", RelationshipConstraintIdentifier = "RelationshipConstraint" } /** * Type that constrains SchemaItemType enum to those used by EC Class types. * @alpha */ export type ECClassSchemaItems = SchemaItemType.EntityClass | SchemaItemType.StructClass | SchemaItemType.RelationshipClass | SchemaItemType.Mixin | SchemaItemType.CustomAttributeClass; /** * Type that defines the possible SchemaTypeIdentifiers for SchemaItemId classes. * @alpha */ export type AnySchemaItemTypeIdentifier = SchemaTypeIdentifiers.SchemaItemIdentifier | SchemaTypeIdentifiers.ClassIdentifier; /** * Type that encompasses all ISchemaTypeIdentifier interfaces * @alpha */ export type AnyIdentifier = ISchemaIdentifier | ISchemaItemIdentifier | IClassIdentifier | IPropertyIdentifier | ICustomAttributeIdentifier | IRelationshipConstraintIdentifier | IEnumeratorIdentifier; /** * A base interface that defines what is needed to identity any schema type. * @alpha */ export interface ISchemaTypeIdentifier { readonly name: string; readonly schemaKey: SchemaKey; readonly typeIdentifier: SchemaTypeIdentifiers; } /** * Interface that defines the data needed to identify a Schema. * @alpha */ export interface ISchemaIdentifier extends ISchemaTypeIdentifier { readonly typeIdentifier: SchemaTypeIdentifiers.SchemaIdentifier; } /** * Interface that defines the data needed to identify a SchemaItem. * @alpha */ export interface ISchemaItemIdentifier extends ISchemaTypeIdentifier { readonly schemaItemType: SchemaItemType; readonly schemaItemKey: SchemaItemKey; readonly typeIdentifier: AnySchemaItemTypeIdentifier; } /** * Interface that defines the data needed to identify an EC Class. * @alpha */ export interface IClassIdentifier extends ISchemaTypeIdentifier { readonly schemaItemType: ECClassSchemaItems; readonly schemaItemKey: SchemaItemKey; readonly typeIdentifier: SchemaTypeIdentifiers.ClassIdentifier; } /** * Interface that defines the data needed to identify an EC Property. * @alpha */ export interface IPropertyIdentifier extends ISchemaTypeIdentifier { readonly fullName: string; readonly ecClass: ClassId; readonly typeName?: PropertyTypeName; readonly typeIdentifier: SchemaTypeIdentifiers.PropertyIdentifier; } /** * Interface that defines the data needed to identify an Enumerator. * @alpha */ interface IEnumeratorIdentifier extends ISchemaTypeIdentifier { readonly enumeratorType: string; readonly enumeration: SchemaItemKey; readonly enumerationType: string; readonly typeIdentifier: SchemaTypeIdentifiers.EnumeratorIdentifier; } /** * Interface that defines the data needed to identify a CustomAttribute. * @alpha */ export interface ICustomAttributeIdentifier extends ISchemaTypeIdentifier { readonly containerFullName: string; readonly typeIdentifier: SchemaTypeIdentifiers.CustomAttributeIdentifier; } /** * Interface that defines the data needed to identify a RelationshipConstraint. * @alpha */ export interface IRelationshipConstraintIdentifier extends ISchemaTypeIdentifier { readonly relationshipKey: SchemaItemKey; readonly typeIdentifier: SchemaTypeIdentifiers.RelationshipConstraintIdentifier; } /** * An ISchemaIdentifier implementation to identify Schemas * @alpha */ export declare class SchemaId implements ISchemaIdentifier { readonly typeIdentifier = SchemaTypeIdentifiers.SchemaIdentifier; readonly name: string; readonly schemaKey: SchemaKey; constructor(schemaKey: SchemaKey); } /** * An ISchemItemIdentifier implementation to identify SchemaItems * @alpha */ export declare class SchemaItemId implements ISchemaItemIdentifier { readonly typeIdentifier: AnySchemaItemTypeIdentifier; readonly name: string; readonly schemaKey: SchemaKey; readonly schemaItemType: SchemaItemType; readonly schemaItemKey: SchemaItemKey; constructor(schemaItemType: SchemaItemType, schemaItemKeyOrName: SchemaItemKey | string, schemaKey?: SchemaKey); } /** * An IClassIdentifier implementation to identify Class instances. * @alpha */ export declare class ClassId extends SchemaItemId implements IClassIdentifier { readonly typeIdentifier = SchemaTypeIdentifiers.ClassIdentifier; readonly schemaItemType: ECClassSchemaItems; constructor(schemaItemType: ECClassSchemaItems, schemaItemKeyOrName: SchemaItemKey | string, schemaKey?: SchemaKey); } /** * An IPropertyIdentifier implementation to identify Property instances. * @alpha */ export declare class PropertyId implements IPropertyIdentifier { readonly typeIdentifier = SchemaTypeIdentifiers.PropertyIdentifier; readonly name: string; readonly fullName: string; readonly ecClass: ClassId; readonly schemaKey: SchemaKey; readonly typeName?: PropertyTypeName; constructor(schemaItemType: ECClassSchemaItems, classKey: SchemaItemKey, property: Property | string, typeName?: PropertyTypeName); } /** * An IEnumeratorIdentifier implementation to identify Enumerator instances. * @alpha */ export declare class EnumeratorId implements IEnumeratorIdentifier { readonly typeIdentifier = SchemaTypeIdentifiers.EnumeratorIdentifier; readonly enumeration: SchemaItemKey; readonly enumerationType: string; readonly enumeratorType: string; readonly name: string; readonly schemaKey: SchemaKey; constructor(enumerator: AnyEnumerator | string, enumeration: Enumeration); } /** * An ICustomAttributeIdentifier implementation to identify CustomAttribute instances. * @alpha */ export declare class CustomAttributeId implements ICustomAttributeIdentifier { readonly typeIdentifier = SchemaTypeIdentifiers.CustomAttributeIdentifier; readonly name: string; readonly schemaKey: SchemaKey; readonly containerFullName: string; constructor(name: string, container: CustomAttributeContainerProps); } /** * An IRelationshipConstraintIdentifier implementation to identify RelationshipConstraints. * @alpha */ export declare class RelationshipConstraintId implements IRelationshipConstraintIdentifier { readonly typeIdentifier = SchemaTypeIdentifiers.RelationshipConstraintIdentifier; readonly name: string; readonly relationshipKey: SchemaItemKey; readonly schemaKey: SchemaKey; constructor(constraint: RelationshipConstraint); } /** * An exception class for the ecschema-editing API. Contains identifiers for schema types involved in the * exception. An example being SchemaItemId which contains the name of the SchemaItem, SchemaItemKey, SchemaItemType, etc. * Typically will contain an innerError of type SchemaEditingError containing the identifier of the schema item that * caused the exception. The containing error instance will identify the method called (identified by the errorNumber) * and the identifier of the schema item being modified/created. * @alpha */ export declare class SchemaEditingError extends Error { readonly errorNumber: ECEditingStatus; readonly identifier: AnyIdentifier; readonly innerError?: AnyEditingError | undefined; private _ruleViolations?; private _schemaKey; /** * Constructs a new SchemaEditingError instance. * @param errorNumber The unique ECEditingStatus code identifying the error. * @param identifier The identifier instance containing information about the EC object involved with the exception. * @param innerError The SchemaEditingError containing the identifier of the EC object that caused the initial exception. * @param ruleViolations Will contain EC rule violations of type [[AnyDiagnostic]] for exceptions with the error code ECEditingStatus.RuleViolation. * @param message Optional error message. Most messages on automatically generated by this class based on the ECEditingStatus code. */ constructor(errorNumber: ECEditingStatus, identifier: AnyIdentifier, innerError?: AnyEditingError | undefined, ruleViolations?: AnyDiagnostic[], message?: string); /** * Gets the SchemaId instance. * @throws Error if the identifier is not an instance of SchemaId. */ private get _schemaId(); /** * Gets the SchemaItemId instance. * @throws Error if the identifier is not an instance of SchemaItemId. */ private get _schemaItemId(); /** * Gets the ClassId instance. * @throws Error if the identifier is not an instance of ClassId. */ private get _classId(); /** * Gets the PropertyId instance. * @throws Error if the identifier is not an instance of PropertyId. */ private get _propertyId(); /** * Gets the EnumeratorId instance. * @throws Error if the identifier is not an instance of EnumeratorId. */ private get _enumeratorId(); /** * Gets the CustomAttributeId instance. * @throws Error if the identifier is not an instance of CustomAttributeId. */ private get _customAttributeId(); /** * Gets the RelationshipConstraintId instance. * @throws Error if the identifier is not an instance of RelationshipConstraintId. */ private get _relationshipConstraintId(); /** Gets rule violations that were reported during validation. Returns an array of [[AnyDiagnostic]] if * the errorNumber is ECEditingStatus.RuleViolation, otherwise undefined. */ get ruleViolations(): AnyDiagnostic[] | undefined; /** * Returns a readable string containing the ECEditingStatus along with the error message. Any * innerError will also be appended. * @returns */ toDebugString(): string; private generateMessage; private _appendMessage; private _getRuleViolationMessage; private _createTaskErrorMessage; private isSchemaItemIdentifier; } export {}; //# sourceMappingURL=Exception.d.ts.map