@itwin/ecschema-editing 5.9.0-dev.15 → 5.9.0-dev.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +1 -0
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
- package/lib/cjs/Editing/Exception.js.map +1 -1
- package/lib/cjs/Validation/ECRules.js +1 -1
- package/lib/cjs/Validation/ECRules.js.map +1 -1
- package/lib/esm/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
- package/lib/esm/Differencing/SchemaDiagnosticVisitor.js +1 -0
- package/lib/esm/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
- package/lib/esm/Editing/Exception.js.map +1 -1
- package/lib/esm/Validation/ECRules.js +1 -1
- package/lib/esm/Validation/ECRules.js.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/Editing/Exception.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAA6D,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAA0B,aAAa,EAA6B,MAAM,0BAA0B,CAAC;AAEvN,aAAa;AACb,MAAM,CAAN,IAAY,eAmFX;AAnFD,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;IACr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BAAqB,CAAC,eAAe,CAAC;YAC3C,KAAK,qBAAqB,CAAC,gCAAgC;gBACzD,OAAO,0BAA0B,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,+BAA+B,IAAI,CAAC,UAAU,CAAC,cAAc,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC;YAC7J,KAAK,qBAAqB,CAAC,kBAAkB;gBAC3C,OAAO,0BAA0B,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,+BAA+B,IAAI,CAAC,UAAU,CAAC,cAAc,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,CAAC;YACjK;gBACE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAEO,sBAAsB,CAAC,UAAyB;QACtD,IAAI,UAAU,CAAC,cAAc,KAAK,qBAAqB,CAAC,oBAAoB;YAC1E,UAAU,CAAC,cAAc,KAAK,qBAAqB,CAAC,eAAe;YACnE,OAAO,IAAI,CAAC;QAEd,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,SAAS,iBAAiB,CAAC,WAAwB,EAAE,UAAkC;IACrF,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK,QAAQ,EAAE,CAAC;QACrC,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC/E,CAAC;IAED,OAAO,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;AACnE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\nimport { AnyEnumerator, CustomAttributeContainerProps, Enumeration, PrimitiveType, primitiveTypeToString, Property, RelationshipConstraint, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\n\n/** @alpha */\nexport enum ECEditingStatus {\n EC_EDITING_ERROR_BASE = 0x30000,\n Unknown = 0,\n RuleViolation = EC_EDITING_ERROR_BASE + 1,\n SchemaNotFound,\n SchemaItemNotFound,\n SchemaItemNotFoundInContext,\n PropertyAlreadyExists,\n PropertyNotFound,\n InvalidPropertyType,\n BaseClassIsNotElement,\n BaseClassIsNotElementUniqueAspect,\n BaseClassIsNotElementMultiAspect,\n SchemaItemNameNotSpecified,\n InvalidSchemaItemType,\n SchemaItemNameAlreadyExists,\n InvalidEnumeratorType,\n InvalidBaseClass,\n EnumeratorDoesNotExist,\n InvalidECName,\n InvalidSchemaAlias,\n InvalidFormatUnitsSpecified,\n SchemaAliasAlreadyExists,\n // Outer Errors\n CreateSchemaItemFailed,\n CreateSchemaItemFromProps,\n CreateElement,\n CreateElementUniqueAspect,\n CreateElementMultiAspect,\n SetBaseClass,\n SetSourceConstraint,\n SetTargetConstraint,\n AddConstraintClass,\n RemoveConstraintClass,\n SetAbstractConstraint,\n AddCustomAttributeToConstraint,\n AddCustomAttributeToProperty,\n AddCustomAttributeToClass,\n CreateNavigationProperty,\n CreateNavigationPropertyFromProps,\n SetInvertsUnit,\n SetUnitSystem,\n SetDescription,\n SetLabel,\n SetIsReadOnly,\n SetPriority,\n SetCategory,\n SetKindOfQuantity,\n SetMinOccurs,\n SetMaxOccurs,\n SetExtendedTypeName,\n SetMinLength,\n SetMaxLength,\n SetMinValue,\n SetMaxValue,\n SetPropertyName,\n AddMixin,\n AddEnumerator,\n SetEnumeratorLabel,\n SetEnumeratorDescription,\n AddPresentationUnit,\n AddPresentationOverride,\n CreateFormatOverride,\n SetPropertyCategoryPriority,\n CreatePrimitiveProperty,\n CreatePrimitivePropertyFromProps,\n CreateEnumerationProperty,\n CreateEnumerationPropertyFromProps,\n CreatePrimitiveArrayProperty,\n CreatePrimitiveArrayPropertyFromProps,\n CreateEnumerationArrayProperty,\n CreateEnumerationArrayPropertyFromProps,\n CreateStructProperty,\n CreateStructPropertyFromProps,\n CreateStructArrayProperty,\n CreateStructArrayPropertyFromProps,\n DeleteProperty,\n DeleteClass,\n SetClassName,\n AddSchemaReference,\n SetSchemaVersion,\n IncrementSchemaMinorVersion,\n SetSchemaAlias\n}\n\n/**\n * A type that constrains the possible error types handled by SchemaEditingError\n * @alpha\n */\nexport type AnyEditingError = SchemaEditingError | Error;\n\n/**\n * Defines the possible property type names.\n * @alpha\n */\nexport enum PropertyTypeName {\n ArrayProperty = \"ArrayProperty\",\n PrimitiveProperty = \"PrimitiveProperty\",\n EnumerationProperty = \"EnumerationProperty\",\n NavigationProperty = \"NavigationProperty\",\n StructProperty = \"StructProperty\"\n}\n\n/**\n * Defines the possible schema type identifiers.\n * @alpha\n */\nexport enum SchemaTypeIdentifiers {\n SchemaIdentifier = \"Schema\",\n SchemaItemIdentifier = \"SchemaItem\",\n ClassIdentifier = \"Class\",\n PropertyIdentifier = \"Property\",\n EnumeratorIdentifier = \"Enumerator\",\n CustomAttributeIdentifier = \"CustomAttribute\",\n RelationshipConstraintIdentifier = \"RelationshipConstraint\"\n}\n\n/**\n * Type that constrains SchemaItemType enum to those used by EC Class types.\n * @alpha\n */\nexport type ECClassSchemaItems = SchemaItemType.EntityClass | SchemaItemType.StructClass | SchemaItemType.RelationshipClass | SchemaItemType.Mixin | SchemaItemType.CustomAttributeClass;\n\n/**\n * Type that defines the possible SchemaTypeIdentifiers for SchemaItemId classes.\n * @alpha\n */\nexport type AnySchemaItemTypeIdentifier = SchemaTypeIdentifiers.SchemaItemIdentifier | SchemaTypeIdentifiers.ClassIdentifier;\n\n/**\n * Type that encompasses all ISchemaTypeIdentifier interfaces\n * @alpha\n */\nexport type AnyIdentifier = ISchemaIdentifier | ISchemaItemIdentifier | IClassIdentifier | IPropertyIdentifier | ICustomAttributeIdentifier | IRelationshipConstraintIdentifier | IEnumeratorIdentifier;\n\n/**\n * A base interface that defines what is needed to identity any schema type.\n * @alpha\n */\nexport interface ISchemaTypeIdentifier {\n readonly name: string;\n readonly schemaKey: SchemaKey;\n readonly typeIdentifier: SchemaTypeIdentifiers;\n}\n\n/**\n * Interface that defines the data needed to identify a Schema.\n * @alpha\n */\nexport interface ISchemaIdentifier extends ISchemaTypeIdentifier {\n readonly typeIdentifier: SchemaTypeIdentifiers.SchemaIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify a SchemaItem.\n * @alpha\n */\nexport interface ISchemaItemIdentifier extends ISchemaTypeIdentifier {\n readonly schemaItemType: SchemaItemType;\n readonly schemaItemKey: SchemaItemKey;\n readonly typeIdentifier: AnySchemaItemTypeIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify an EC Class.\n * @alpha\n */\nexport interface IClassIdentifier extends ISchemaTypeIdentifier {\n readonly schemaItemType: ECClassSchemaItems;\n readonly schemaItemKey: SchemaItemKey;\n readonly typeIdentifier: SchemaTypeIdentifiers.ClassIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify an EC Property.\n * @alpha\n */\nexport interface IPropertyIdentifier extends ISchemaTypeIdentifier {\n readonly fullName: string;\n readonly ecClass: ClassId;\n readonly typeName?: PropertyTypeName;\n readonly typeIdentifier: SchemaTypeIdentifiers.PropertyIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify an Enumerator.\n * @alpha\n */\ninterface IEnumeratorIdentifier extends ISchemaTypeIdentifier {\n readonly enumeratorType: string;\n readonly enumeration: SchemaItemKey;\n readonly enumerationType: string;\n readonly typeIdentifier: SchemaTypeIdentifiers.EnumeratorIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify a CustomAttribute.\n * @alpha\n */\nexport interface ICustomAttributeIdentifier extends ISchemaTypeIdentifier {\n readonly containerFullName: string;\n readonly typeIdentifier: SchemaTypeIdentifiers.CustomAttributeIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify a RelationshipConstraint.\n * @alpha\n */\nexport interface IRelationshipConstraintIdentifier extends ISchemaTypeIdentifier {\n readonly relationshipKey: SchemaItemKey;\n readonly typeIdentifier: SchemaTypeIdentifiers.RelationshipConstraintIdentifier;\n}\n\n/**\n * An ISchemaIdentifier implementation to identify Schemas\n * @alpha\n */\nexport class SchemaId implements ISchemaIdentifier {\n public readonly typeIdentifier = SchemaTypeIdentifiers.SchemaIdentifier;\n public readonly name: string;\n public readonly schemaKey: SchemaKey;\n constructor(schemaKey: SchemaKey) {\n this.name = schemaKey.name;\n this.schemaKey = schemaKey;\n }\n}\n\n/**\n * An ISchemItemIdentifier implementation to identify SchemaItems\n * @alpha\n */\nexport class SchemaItemId implements ISchemaItemIdentifier {\n public readonly typeIdentifier: AnySchemaItemTypeIdentifier;\n public readonly name: string;\n public readonly schemaKey: SchemaKey;\n public readonly schemaItemType: SchemaItemType;\n public readonly schemaItemKey: SchemaItemKey;\n\n constructor(schemaItemType: SchemaItemType, schemaItemKeyOrName: SchemaItemKey | string, schemaKey?: SchemaKey) {\n if (typeof (schemaItemKeyOrName) === \"string\") {\n if (!schemaKey)\n throw new Error(\"schemaKey if required if the specified schemaItem the name of the schema item.\");\n\n this.schemaKey = schemaKey;\n this.schemaItemKey = new SchemaItemKey(schemaItemKeyOrName, schemaKey);\n } else {\n this.schemaKey = schemaItemKeyOrName.schemaKey;\n this.schemaItemKey = schemaItemKeyOrName;\n }\n\n this.schemaItemType = schemaItemType;\n this.name = this.schemaItemKey.fullName;\n this.typeIdentifier = SchemaTypeIdentifiers.SchemaItemIdentifier;\n }\n}\n\n/**\n * An IClassIdentifier implementation to identify Class instances.\n * @alpha\n */\nexport class ClassId extends SchemaItemId implements IClassIdentifier {\n public override readonly typeIdentifier = SchemaTypeIdentifiers.ClassIdentifier;\n public override readonly schemaItemType: ECClassSchemaItems;\n constructor(schemaItemType: ECClassSchemaItems, schemaItemKeyOrName: SchemaItemKey | string, schemaKey?: SchemaKey) {\n super(schemaItemType, schemaItemKeyOrName, schemaKey);\n this.schemaItemType = schemaItemType;\n }\n}\n\n/**\n * An IPropertyIdentifier implementation to identify Property instances.\n * @alpha\n */\nexport class PropertyId implements IPropertyIdentifier {\n public readonly typeIdentifier = SchemaTypeIdentifiers.PropertyIdentifier;\n public readonly name: string;\n public readonly fullName: string;\n public readonly ecClass: ClassId;\n public readonly schemaKey: SchemaKey;\n public readonly typeName?: PropertyTypeName;\n\n constructor(schemaItemType: ECClassSchemaItems, classKey: SchemaItemKey, property: Property | string, typeName?: PropertyTypeName) {\n this.name = property instanceof Property ? property.name : property;\n this.fullName = property instanceof Property ? property.fullName : `${classKey.name}.${property}`;\n this.ecClass = new ClassId(schemaItemType, classKey);\n this.schemaKey = classKey.schemaKey;\n this.typeName = typeName;\n }\n}\n\n/**\n * An IEnumeratorIdentifier implementation to identify Enumerator instances.\n * @alpha\n */\nexport class EnumeratorId implements IEnumeratorIdentifier {\n public readonly typeIdentifier = SchemaTypeIdentifiers.EnumeratorIdentifier;\n public readonly enumeration: SchemaItemKey;\n public readonly enumerationType: string;\n public readonly enumeratorType: string;\n public readonly name: string;\n public readonly schemaKey: SchemaKey;\n\n constructor(enumerator: AnyEnumerator | string, enumeration: Enumeration) {\n this.enumeration = enumeration.key;\n this.enumerationType = enumeration.type ? primitiveTypeToString(enumeration.type) : \"string\";\n this.enumeratorType = getEnumeratorType(enumeration ?? PrimitiveType.String, enumerator);\n this.name = typeof (enumerator) === \"string\" ? enumerator : enumerator.name;\n this.schemaKey = enumeration.schema.schemaKey;\n }\n}\n\n/**\n * An ICustomAttributeIdentifier implementation to identify CustomAttribute instances.\n * @alpha\n */\nexport class CustomAttributeId implements ICustomAttributeIdentifier {\n public readonly typeIdentifier = SchemaTypeIdentifiers.CustomAttributeIdentifier;\n public readonly name: string;\n public readonly schemaKey: SchemaKey;\n public readonly containerFullName: string;\n constructor(name: string, container: CustomAttributeContainerProps) {\n this.name = name;\n this.schemaKey = container.schema.schemaKey;\n this.containerFullName = container.fullName;\n }\n}\n\n/**\n * An IRelationshipConstraintIdentifier implementation to identify RelationshipConstraints.\n * @alpha\n */\nexport class RelationshipConstraintId implements IRelationshipConstraintIdentifier {\n public readonly typeIdentifier = SchemaTypeIdentifiers.RelationshipConstraintIdentifier;\n public readonly name: string;\n public readonly relationshipKey: SchemaItemKey;\n public readonly schemaKey: SchemaKey;\n constructor(constraint: RelationshipConstraint) {\n this.name = constraint.isSource ? \"Source\" : \"Target\";\n this.relationshipKey = constraint.relationshipClass.key;\n this.schemaKey = this.relationshipKey.schemaKey;\n }\n}\n\n/**\n * An exception class for the ecschema-editing API. Contains identifiers for schema types involved in the\n * exception. An example being SchemaItemId which contains the name of the SchemaItem, SchemaItemKey, SchemaItemType, etc.\n * Typically will contain an innerError of type SchemaEditingError containing the identifier of the schema item that\n * caused the exception. The containing error instance will identify the method called (identified by the errorNumber)\n * and the identifier of the schema item being modified/created.\n * @alpha\n */\nexport class SchemaEditingError extends Error {\n private _ruleViolations?: AnyDiagnostic[];\n private _schemaKey: SchemaKey;\n\n /**\n * Constructs a new SchemaEditingError instance.\n * @param errorNumber The unique ECEditingStatus code identifying the error.\n * @param identifier The identifier instance containing information about the EC object involved with the exception.\n * @param innerError The SchemaEditingError containing the identifier of the EC object that caused the initial exception.\n * @param ruleViolations Will contain EC rule violations of type [[AnyDiagnostic]] for exceptions with the error code ECEditingStatus.RuleViolation.\n * @param message Optional error message. Most messages on automatically generated by this class based on the ECEditingStatus code.\n */\n public constructor(public readonly errorNumber: ECEditingStatus, public readonly identifier: AnyIdentifier, public readonly innerError?: AnyEditingError, ruleViolations?: AnyDiagnostic[], message?: string) {\n super(message);\n this._ruleViolations = ruleViolations;\n this._schemaKey = identifier.schemaKey;\n this.generateMessage();\n }\n\n /**\n * Gets the SchemaId instance.\n * @throws Error if the identifier is not an instance of SchemaId.\n */\n private get _schemaId(): SchemaId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.SchemaIdentifier)\n throw new Error(\"identifier is not a SchemaId.\");\n return this.identifier as SchemaId;\n }\n\n /**\n * Gets the SchemaItemId instance.\n * @throws Error if the identifier is not an instance of SchemaItemId.\n */\n private get _schemaItemId(): SchemaItemId {\n if (this.isSchemaItemIdentifier(this.identifier))\n throw new Error(\"identifier is not a SchemaItemId.\");\n return this.identifier as SchemaItemId;\n }\n\n /**\n * Gets the ClassId instance.\n * @throws Error if the identifier is not an instance of ClassId.\n */\n private get _classId(): ClassId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.ClassIdentifier)\n throw new Error(\"identifier is not a ClassId.\");\n return this.identifier as ClassId;\n }\n\n /**\n * Gets the PropertyId instance.\n * @throws Error if the identifier is not an instance of PropertyId.\n */\n private get _propertyId(): PropertyId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.PropertyIdentifier)\n throw new Error(\"identifier is not a PropertyId.\");\n return this.identifier;\n }\n\n /**\n * Gets the EnumeratorId instance.\n * @throws Error if the identifier is not an instance of EnumeratorId.\n */\n private get _enumeratorId(): EnumeratorId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.EnumeratorIdentifier)\n throw new Error(\"identifier is not a EnumerationId.\");\n return this.identifier as EnumeratorId;\n }\n\n /**\n * Gets the CustomAttributeId instance.\n * @throws Error if the identifier is not an instance of CustomAttributeId.\n */\n private get _customAttributeId(): CustomAttributeId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.CustomAttributeIdentifier)\n throw new Error(\"identifier is not a CustomAttributeId.\");\n return this.identifier;\n }\n\n /**\n * Gets the RelationshipConstraintId instance.\n * @throws Error if the identifier is not an instance of RelationshipConstraintId.\n */\n private get _relationshipConstraintId(): RelationshipConstraintId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.RelationshipConstraintIdentifier)\n throw new Error(\"identifier is not a RelationshipConstraintId.\");\n return this.identifier;\n }\n\n /** Gets rule violations that were reported during validation. Returns an array of [[AnyDiagnostic]] if\n * the errorNumber is ECEditingStatus.RuleViolation, otherwise undefined.\n */\n public get ruleViolations(): AnyDiagnostic[] | undefined {\n return this._ruleViolations;\n }\n\n /**\n * Returns a readable string containing the ECEditingStatus along with the error message. Any\n * innerError will also be appended.\n * @returns\n */\n public toDebugString(): string {\n let innerMessage = \"\";\n if (this.innerError) {\n if (this.innerError instanceof SchemaEditingError)\n innerMessage = ` Inner error: ${this.innerError.toDebugString()}`;\n else\n innerMessage = ` Inner error: ${this.innerError.message}`;\n }\n return this._appendMessage(`ECEditingStatus.${ECEditingStatus[this.errorNumber]}`) + innerMessage;\n }\n\n private generateMessage() {\n if (this.message)\n return;\n\n switch (this.errorNumber) {\n case ECEditingStatus.SchemaNotFound:\n this.message = `Schema Key ${this._schemaKey.toString(true)} could not be found in the context.`;\n return;\n case ECEditingStatus.SchemaItemNotFound:\n this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} could not be found in the schema ${this._schemaKey.name}.`;\n return;\n case ECEditingStatus.SchemaItemNotFoundInContext:\n this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} could not be found in the schema context.`;\n return;\n case ECEditingStatus.InvalidSchemaItemType:\n this.message = `Expected ${this._schemaItemId.name} to be of type ${this._schemaItemId.schemaItemType}.`;\n return;\n case ECEditingStatus.SchemaItemNameNotSpecified:\n this.message = `Could not create a new ${this._schemaItemId.schemaItemType} in schema ${this._schemaKey.name}. No name was supplied within props.`;\n return;\n case ECEditingStatus.SchemaItemNameAlreadyExists:\n this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} already exists in the schema ${this._schemaKey.name}.`;\n return;\n case ECEditingStatus.RuleViolation:\n this.message = this._getRuleViolationMessage();\n return;\n case ECEditingStatus.PropertyNotFound:\n this.message = `An ECProperty with the name ${this._propertyId.name} could not be found in the class ${this._propertyId.ecClass.name}.`;\n return;\n case ECEditingStatus.PropertyAlreadyExists:\n this.message = `An ECProperty with the name ${this._propertyId.name} already exists in the class ${this._propertyId.ecClass.name}.`;\n return;\n case ECEditingStatus.InvalidPropertyType:\n this.message = `Expected property ${this._propertyId.name} to be of type ${this._propertyId.typeName}.`;\n return;\n case ECEditingStatus.BaseClassIsNotElement:\n this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.Element.`;\n return;\n case ECEditingStatus.BaseClassIsNotElementUniqueAspect:\n this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.ElementUniqueAspect.`;\n return;\n case ECEditingStatus.BaseClassIsNotElementMultiAspect:\n this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.ElementMultiAspect.`;\n return;\n case ECEditingStatus.InvalidFormatUnitsSpecified:\n this.message = `The specified Format unit ${this._schemaItemId.name} is not of type Unit or InvertedUnit`;\n return;\n case ECEditingStatus.InvalidEnumeratorType:\n this.message = `The Enumeration ${this._enumeratorId.enumeration.fullName} has type ${this._enumeratorId.enumerationType}, while Enumerator ${this._enumeratorId.name} has type ${this._enumeratorId.enumeratorType}.`;\n return;\n case ECEditingStatus.EnumeratorDoesNotExist:\n this.message = `Enumerator ${this._enumeratorId.name} does not exists in Enumeration ${this._enumeratorId.enumeration.name}.`;\n return;\n case ECEditingStatus.InvalidECName:\n this.message = `Could not rename class ${this._schemaItemId.name} because the specified name is not a valid ECName.`;\n return;\n case ECEditingStatus.InvalidSchemaAlias:\n this.message = `Could not set the alias for schema ${this._schemaKey.name} because the specified alias is not a valid ECName.`;\n return;\n default:\n this.message = this._createTaskErrorMessage();\n }\n }\n\n private _appendMessage(e: string) {\n return this.message ? `${e}: ${this.message}` : e;\n }\n\n private _getRuleViolationMessage(): string {\n if (!this._ruleViolations)\n return \"\";\n\n let violations = \"\";\n for (const diagnostic of this._ruleViolations) {\n violations += `${diagnostic.code}: ${diagnostic.messageText}\\r\\n`;\n }\n\n switch (this.identifier.typeIdentifier) {\n case SchemaTypeIdentifiers.SchemaIdentifier:\n return `Rule violations occurred from Schema ${this._schemaId.name}: ${violations}`;\n case SchemaTypeIdentifiers.SchemaItemIdentifier:\n return `Rule violations occurred from ${this._schemaItemId.schemaItemType} ${this._schemaItemId.name}: ${violations}`;\n case SchemaTypeIdentifiers.ClassIdentifier:\n return `Rule violations occurred from ${this._schemaItemId.schemaItemType} ${this._schemaItemId.name}: ${violations}`;\n case SchemaTypeIdentifiers.CustomAttributeIdentifier:\n return `Rule violations occurred from CustomAttribute ${this._customAttributeId.name}, container ${this._customAttributeId.containerFullName}: ${violations}`;\n case SchemaTypeIdentifiers.RelationshipConstraintIdentifier:\n return `Rule violations occurred from ${this._relationshipConstraintId.name} constraint of RelationshipClass ${this._relationshipConstraintId.relationshipKey.fullName}: ${violations}`;\n default:\n throw new Error(\"Invalid identifier.\");\n }\n }\n\n private _createTaskErrorMessage() {\n // Make sure we have an inner error or else it is not a task error\n if (!this.innerError)\n return \"\";\n\n switch (this.identifier.typeIdentifier) {\n case SchemaTypeIdentifiers.SchemaIdentifier:\n case SchemaTypeIdentifiers.SchemaItemIdentifier:\n case SchemaTypeIdentifiers.ClassIdentifier:\n case SchemaTypeIdentifiers.RelationshipConstraintIdentifier:\n return `While performing task '${ECEditingStatus[this.errorNumber]}' an error occurred editing ${this.identifier.typeIdentifier} ${this.identifier.name}.`;\n case SchemaTypeIdentifiers.PropertyIdentifier:\n return `While performing task '${ECEditingStatus[this.errorNumber]}' an error occurred editing ${this.identifier.typeIdentifier} ${this.identifier.fullName}.`;\n default:\n throw new Error(\"Invalid identifier.\");\n }\n }\n\n private isSchemaItemIdentifier(identifier: AnyIdentifier) {\n if (identifier.typeIdentifier !== SchemaTypeIdentifiers.SchemaItemIdentifier &&\n identifier.typeIdentifier !== SchemaTypeIdentifiers.ClassIdentifier)\n return true;\n\n return false;\n }\n}\n\nfunction getEnumeratorType(enumeration: Enumeration, enumerator: AnyEnumerator | string) {\n if (typeof (enumerator) === \"string\") {\n return enumeration.type ? primitiveTypeToString(enumeration.type) : \"string\";\n }\n\n return typeof (enumerator.value) === \"string\" ? \"string\" : \"int\";\n}\n"]}
|
|
1
|
+
{"version":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AC;IACf,CAAC;CACF;AAED,SAAS,iBAAiB,CAAC,WAAwB,EAAE,UAAkC;IACrF,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK,QAAQ,EAAE,CAAC;QACrC,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC/E,CAAC;IAED,OAAO,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;AACnE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\nimport { AnyEnumerator, CustomAttributeContainerProps, Enumeration, PrimitiveType, primitiveTypeToString, Property, RelationshipConstraint, SchemaItemKey, SchemaItemType, SchemaKey } from \"@itwin/ecschema-metadata\";\n\n/** @alpha */\nexport enum ECEditingStatus {\n EC_EDITING_ERROR_BASE = 0x30000,\n Unknown = 0,\n RuleViolation = EC_EDITING_ERROR_BASE + 1,\n SchemaNotFound,\n SchemaItemNotFound,\n SchemaItemNotFoundInContext,\n PropertyAlreadyExists,\n PropertyNotFound,\n InvalidPropertyType,\n BaseClassIsNotElement,\n BaseClassIsNotElementUniqueAspect,\n BaseClassIsNotElementMultiAspect,\n SchemaItemNameNotSpecified,\n InvalidSchemaItemType,\n SchemaItemNameAlreadyExists,\n InvalidEnumeratorType,\n InvalidBaseClass,\n EnumeratorDoesNotExist,\n InvalidECName,\n InvalidSchemaAlias,\n InvalidFormatUnitsSpecified,\n SchemaAliasAlreadyExists,\n // Outer Errors\n CreateSchemaItemFailed,\n CreateSchemaItemFromProps,\n CreateElement,\n CreateElementUniqueAspect,\n CreateElementMultiAspect,\n SetBaseClass,\n SetSourceConstraint,\n SetTargetConstraint,\n AddConstraintClass,\n RemoveConstraintClass,\n SetAbstractConstraint,\n AddCustomAttributeToConstraint,\n AddCustomAttributeToProperty,\n AddCustomAttributeToClass,\n CreateNavigationProperty,\n CreateNavigationPropertyFromProps,\n SetInvertsUnit,\n SetUnitSystem,\n SetDescription,\n SetLabel,\n SetIsReadOnly,\n SetPriority,\n SetCategory,\n SetKindOfQuantity,\n SetMinOccurs,\n SetMaxOccurs,\n SetExtendedTypeName,\n SetMinLength,\n SetMaxLength,\n SetMinValue,\n SetMaxValue,\n SetPropertyName,\n AddMixin,\n AddEnumerator,\n SetEnumeratorLabel,\n SetEnumeratorDescription,\n AddPresentationUnit,\n AddPresentationOverride,\n CreateFormatOverride,\n SetPropertyCategoryPriority,\n CreatePrimitiveProperty,\n CreatePrimitivePropertyFromProps,\n CreateEnumerationProperty,\n CreateEnumerationPropertyFromProps,\n CreatePrimitiveArrayProperty,\n CreatePrimitiveArrayPropertyFromProps,\n CreateEnumerationArrayProperty,\n CreateEnumerationArrayPropertyFromProps,\n CreateStructProperty,\n CreateStructPropertyFromProps,\n CreateStructArrayProperty,\n CreateStructArrayPropertyFromProps,\n DeleteProperty,\n DeleteClass,\n SetClassName,\n AddSchemaReference,\n SetSchemaVersion,\n IncrementSchemaMinorVersion,\n SetSchemaAlias\n}\n\n/**\n * A type that constrains the possible error types handled by SchemaEditingError\n * @alpha\n */\nexport type AnyEditingError = SchemaEditingError | Error;\n\n/**\n * Defines the possible property type names.\n * @alpha\n */\nexport enum PropertyTypeName {\n ArrayProperty = \"ArrayProperty\",\n PrimitiveProperty = \"PrimitiveProperty\",\n EnumerationProperty = \"EnumerationProperty\",\n NavigationProperty = \"NavigationProperty\",\n StructProperty = \"StructProperty\"\n}\n\n/**\n * Defines the possible schema type identifiers.\n * @alpha\n */\nexport enum SchemaTypeIdentifiers {\n SchemaIdentifier = \"Schema\",\n SchemaItemIdentifier = \"SchemaItem\",\n ClassIdentifier = \"Class\",\n PropertyIdentifier = \"Property\",\n EnumeratorIdentifier = \"Enumerator\",\n CustomAttributeIdentifier = \"CustomAttribute\",\n RelationshipConstraintIdentifier = \"RelationshipConstraint\"\n}\n\n/**\n * Type that constrains SchemaItemType enum to those used by EC Class types.\n * @alpha\n */\nexport type ECClassSchemaItems = SchemaItemType.EntityClass | SchemaItemType.StructClass | SchemaItemType.RelationshipClass | SchemaItemType.Mixin | SchemaItemType.CustomAttributeClass;\n\n/**\n * Type that defines the possible SchemaTypeIdentifiers for SchemaItemId classes.\n * @alpha\n */\nexport type AnySchemaItemTypeIdentifier = SchemaTypeIdentifiers.SchemaItemIdentifier | SchemaTypeIdentifiers.ClassIdentifier;\n\n/**\n * Type that encompasses all ISchemaTypeIdentifier interfaces\n * @alpha\n */\nexport type AnyIdentifier = ISchemaIdentifier | ISchemaItemIdentifier | IClassIdentifier | IPropertyIdentifier | ICustomAttributeIdentifier | IRelationshipConstraintIdentifier | IEnumeratorIdentifier;\n\n/**\n * A base interface that defines what is needed to identity any schema type.\n * @alpha\n */\nexport interface ISchemaTypeIdentifier {\n readonly name: string;\n readonly schemaKey: SchemaKey;\n readonly typeIdentifier: SchemaTypeIdentifiers;\n}\n\n/**\n * Interface that defines the data needed to identify a Schema.\n * @alpha\n */\nexport interface ISchemaIdentifier extends ISchemaTypeIdentifier {\n readonly typeIdentifier: SchemaTypeIdentifiers.SchemaIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify a SchemaItem.\n * @alpha\n */\nexport interface ISchemaItemIdentifier extends ISchemaTypeIdentifier {\n readonly schemaItemType: SchemaItemType;\n readonly schemaItemKey: SchemaItemKey;\n readonly typeIdentifier: AnySchemaItemTypeIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify an EC Class.\n * @alpha\n */\nexport interface IClassIdentifier extends ISchemaTypeIdentifier {\n readonly schemaItemType: ECClassSchemaItems;\n readonly schemaItemKey: SchemaItemKey;\n readonly typeIdentifier: SchemaTypeIdentifiers.ClassIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify an EC Property.\n * @alpha\n */\nexport interface IPropertyIdentifier extends ISchemaTypeIdentifier {\n readonly fullName: string;\n readonly ecClass: ClassId;\n readonly typeName?: PropertyTypeName;\n readonly typeIdentifier: SchemaTypeIdentifiers.PropertyIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify an Enumerator.\n * @alpha\n */\ninterface IEnumeratorIdentifier extends ISchemaTypeIdentifier {\n readonly enumeratorType: string;\n readonly enumeration: SchemaItemKey;\n readonly enumerationType: string;\n readonly typeIdentifier: SchemaTypeIdentifiers.EnumeratorIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify a CustomAttribute.\n * @alpha\n */\nexport interface ICustomAttributeIdentifier extends ISchemaTypeIdentifier {\n readonly containerFullName: string;\n readonly typeIdentifier: SchemaTypeIdentifiers.CustomAttributeIdentifier;\n}\n\n/**\n * Interface that defines the data needed to identify a RelationshipConstraint.\n * @alpha\n */\nexport interface IRelationshipConstraintIdentifier extends ISchemaTypeIdentifier {\n readonly relationshipKey: SchemaItemKey;\n readonly typeIdentifier: SchemaTypeIdentifiers.RelationshipConstraintIdentifier;\n}\n\n/**\n * An ISchemaIdentifier implementation to identify Schemas\n * @alpha\n */\nexport class SchemaId implements ISchemaIdentifier {\n public readonly typeIdentifier = SchemaTypeIdentifiers.SchemaIdentifier;\n public readonly name: string;\n public readonly schemaKey: SchemaKey;\n constructor(schemaKey: SchemaKey) {\n this.name = schemaKey.name;\n this.schemaKey = schemaKey;\n }\n}\n\n/**\n * An ISchemItemIdentifier implementation to identify SchemaItems\n * @alpha\n */\nexport class SchemaItemId implements ISchemaItemIdentifier {\n public readonly typeIdentifier: AnySchemaItemTypeIdentifier;\n public readonly name: string;\n public readonly schemaKey: SchemaKey;\n public readonly schemaItemType: SchemaItemType;\n public readonly schemaItemKey: SchemaItemKey;\n\n constructor(schemaItemType: SchemaItemType, schemaItemKeyOrName: SchemaItemKey | string, schemaKey?: SchemaKey) {\n if (typeof (schemaItemKeyOrName) === \"string\") {\n if (!schemaKey)\n throw new Error(\"schemaKey if required if the specified schemaItem the name of the schema item.\");\n\n this.schemaKey = schemaKey;\n this.schemaItemKey = new SchemaItemKey(schemaItemKeyOrName, schemaKey);\n } else {\n this.schemaKey = schemaItemKeyOrName.schemaKey;\n this.schemaItemKey = schemaItemKeyOrName;\n }\n\n this.schemaItemType = schemaItemType;\n this.name = this.schemaItemKey.fullName;\n this.typeIdentifier = SchemaTypeIdentifiers.SchemaItemIdentifier;\n }\n}\n\n/**\n * An IClassIdentifier implementation to identify Class instances.\n * @alpha\n */\nexport class ClassId extends SchemaItemId implements IClassIdentifier {\n public override readonly typeIdentifier = SchemaTypeIdentifiers.ClassIdentifier;\n public override readonly schemaItemType: ECClassSchemaItems;\n constructor(schemaItemType: ECClassSchemaItems, schemaItemKeyOrName: SchemaItemKey | string, schemaKey?: SchemaKey) {\n super(schemaItemType, schemaItemKeyOrName, schemaKey);\n this.schemaItemType = schemaItemType;\n }\n}\n\n/**\n * An IPropertyIdentifier implementation to identify Property instances.\n * @alpha\n */\nexport class PropertyId implements IPropertyIdentifier {\n public readonly typeIdentifier = SchemaTypeIdentifiers.PropertyIdentifier;\n public readonly name: string;\n public readonly fullName: string;\n public readonly ecClass: ClassId;\n public readonly schemaKey: SchemaKey;\n public readonly typeName?: PropertyTypeName;\n\n constructor(schemaItemType: ECClassSchemaItems, classKey: SchemaItemKey, property: Property | string, typeName?: PropertyTypeName) {\n this.name = property instanceof Property ? property.name : property;\n this.fullName = property instanceof Property ? property.fullName : `${classKey.name}.${property}`;\n this.ecClass = new ClassId(schemaItemType, classKey);\n this.schemaKey = classKey.schemaKey;\n this.typeName = typeName;\n }\n}\n\n/**\n * An IEnumeratorIdentifier implementation to identify Enumerator instances.\n * @alpha\n */\nexport class EnumeratorId implements IEnumeratorIdentifier {\n public readonly typeIdentifier = SchemaTypeIdentifiers.EnumeratorIdentifier;\n public readonly enumeration: SchemaItemKey;\n public readonly enumerationType: string;\n public readonly enumeratorType: string;\n public readonly name: string;\n public readonly schemaKey: SchemaKey;\n\n constructor(enumerator: AnyEnumerator | string, enumeration: Enumeration) {\n this.enumeration = enumeration.key;\n this.enumerationType = enumeration.type ? primitiveTypeToString(enumeration.type) : \"string\";\n this.enumeratorType = getEnumeratorType(enumeration ?? PrimitiveType.String, enumerator);\n this.name = typeof (enumerator) === \"string\" ? enumerator : enumerator.name;\n this.schemaKey = enumeration.schema.schemaKey;\n }\n}\n\n/**\n * An ICustomAttributeIdentifier implementation to identify CustomAttribute instances.\n * @alpha\n */\nexport class CustomAttributeId implements ICustomAttributeIdentifier {\n public readonly typeIdentifier = SchemaTypeIdentifiers.CustomAttributeIdentifier;\n public readonly name: string;\n public readonly schemaKey: SchemaKey;\n public readonly containerFullName: string;\n constructor(name: string, container: CustomAttributeContainerProps) {\n this.name = name;\n this.schemaKey = container.schema.schemaKey;\n this.containerFullName = container.fullName;\n }\n}\n\n/**\n * An IRelationshipConstraintIdentifier implementation to identify RelationshipConstraints.\n * @alpha\n */\nexport class RelationshipConstraintId implements IRelationshipConstraintIdentifier {\n public readonly typeIdentifier = SchemaTypeIdentifiers.RelationshipConstraintIdentifier;\n public readonly name: string;\n public readonly relationshipKey: SchemaItemKey;\n public readonly schemaKey: SchemaKey;\n constructor(constraint: RelationshipConstraint) {\n this.name = constraint.isSource ? \"Source\" : \"Target\";\n this.relationshipKey = constraint.relationshipClass.key;\n this.schemaKey = this.relationshipKey.schemaKey;\n }\n}\n\n/**\n * An exception class for the ecschema-editing API. Contains identifiers for schema types involved in the\n * exception. An example being SchemaItemId which contains the name of the SchemaItem, SchemaItemKey, SchemaItemType, etc.\n * Typically will contain an innerError of type SchemaEditingError containing the identifier of the schema item that\n * caused the exception. The containing error instance will identify the method called (identified by the errorNumber)\n * and the identifier of the schema item being modified/created.\n * @alpha\n */\nexport class SchemaEditingError extends Error {\n private _ruleViolations?: AnyDiagnostic[];\n private _schemaKey: SchemaKey;\n\n /**\n * Constructs a new SchemaEditingError instance.\n * @param errorNumber The unique ECEditingStatus code identifying the error.\n * @param identifier The identifier instance containing information about the EC object involved with the exception.\n * @param innerError The SchemaEditingError containing the identifier of the EC object that caused the initial exception.\n * @param ruleViolations Will contain EC rule violations of type [[AnyDiagnostic]] for exceptions with the error code ECEditingStatus.RuleViolation.\n * @param message Optional error message. Most messages on automatically generated by this class based on the ECEditingStatus code.\n */\n public constructor(public readonly errorNumber: ECEditingStatus, public readonly identifier: AnyIdentifier, public readonly innerError?: AnyEditingError, ruleViolations?: AnyDiagnostic[], message?: string) {\n super(message);\n this._ruleViolations = ruleViolations;\n this._schemaKey = identifier.schemaKey;\n this.generateMessage();\n }\n\n /**\n * Gets the SchemaId instance.\n * @throws Error if the identifier is not an instance of SchemaId.\n */\n private get _schemaId(): SchemaId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.SchemaIdentifier)\n throw new Error(\"identifier is not a SchemaId.\");\n return this.identifier;\n }\n\n /**\n * Gets the SchemaItemId instance.\n * @throws Error if the identifier is not an instance of SchemaItemId.\n */\n private get _schemaItemId(): SchemaItemId {\n if (this.isSchemaItemIdentifier(this.identifier))\n throw new Error(\"identifier is not a SchemaItemId.\");\n return this.identifier as SchemaItemId;\n }\n\n /**\n * Gets the ClassId instance.\n * @throws Error if the identifier is not an instance of ClassId.\n */\n private get _classId(): ClassId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.ClassIdentifier)\n throw new Error(\"identifier is not a ClassId.\");\n return this.identifier as ClassId;\n }\n\n /**\n * Gets the PropertyId instance.\n * @throws Error if the identifier is not an instance of PropertyId.\n */\n private get _propertyId(): PropertyId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.PropertyIdentifier)\n throw new Error(\"identifier is not a PropertyId.\");\n return this.identifier;\n }\n\n /**\n * Gets the EnumeratorId instance.\n * @throws Error if the identifier is not an instance of EnumeratorId.\n */\n private get _enumeratorId(): EnumeratorId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.EnumeratorIdentifier)\n throw new Error(\"identifier is not a EnumerationId.\");\n return this.identifier;\n }\n\n /**\n * Gets the CustomAttributeId instance.\n * @throws Error if the identifier is not an instance of CustomAttributeId.\n */\n private get _customAttributeId(): CustomAttributeId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.CustomAttributeIdentifier)\n throw new Error(\"identifier is not a CustomAttributeId.\");\n return this.identifier;\n }\n\n /**\n * Gets the RelationshipConstraintId instance.\n * @throws Error if the identifier is not an instance of RelationshipConstraintId.\n */\n private get _relationshipConstraintId(): RelationshipConstraintId {\n if (this.identifier.typeIdentifier !== SchemaTypeIdentifiers.RelationshipConstraintIdentifier)\n throw new Error(\"identifier is not a RelationshipConstraintId.\");\n return this.identifier;\n }\n\n /** Gets rule violations that were reported during validation. Returns an array of [[AnyDiagnostic]] if\n * the errorNumber is ECEditingStatus.RuleViolation, otherwise undefined.\n */\n public get ruleViolations(): AnyDiagnostic[] | undefined {\n return this._ruleViolations;\n }\n\n /**\n * Returns a readable string containing the ECEditingStatus along with the error message. Any\n * innerError will also be appended.\n * @returns\n */\n public toDebugString(): string {\n let innerMessage = \"\";\n if (this.innerError) {\n if (this.innerError instanceof SchemaEditingError)\n innerMessage = ` Inner error: ${this.innerError.toDebugString()}`;\n else\n innerMessage = ` Inner error: ${this.innerError.message}`;\n }\n return this._appendMessage(`ECEditingStatus.${ECEditingStatus[this.errorNumber]}`) + innerMessage;\n }\n\n private generateMessage() {\n if (this.message)\n return;\n\n switch (this.errorNumber) {\n case ECEditingStatus.SchemaNotFound:\n this.message = `Schema Key ${this._schemaKey.toString(true)} could not be found in the context.`;\n return;\n case ECEditingStatus.SchemaItemNotFound:\n this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} could not be found in the schema ${this._schemaKey.name}.`;\n return;\n case ECEditingStatus.SchemaItemNotFoundInContext:\n this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} could not be found in the schema context.`;\n return;\n case ECEditingStatus.InvalidSchemaItemType:\n this.message = `Expected ${this._schemaItemId.name} to be of type ${this._schemaItemId.schemaItemType}.`;\n return;\n case ECEditingStatus.SchemaItemNameNotSpecified:\n this.message = `Could not create a new ${this._schemaItemId.schemaItemType} in schema ${this._schemaKey.name}. No name was supplied within props.`;\n return;\n case ECEditingStatus.SchemaItemNameAlreadyExists:\n this.message = `${this._schemaItemId.schemaItemType} ${this._schemaItemId.name} already exists in the schema ${this._schemaKey.name}.`;\n return;\n case ECEditingStatus.RuleViolation:\n this.message = this._getRuleViolationMessage();\n return;\n case ECEditingStatus.PropertyNotFound:\n this.message = `An ECProperty with the name ${this._propertyId.name} could not be found in the class ${this._propertyId.ecClass.name}.`;\n return;\n case ECEditingStatus.PropertyAlreadyExists:\n this.message = `An ECProperty with the name ${this._propertyId.name} already exists in the class ${this._propertyId.ecClass.name}.`;\n return;\n case ECEditingStatus.InvalidPropertyType:\n this.message = `Expected property ${this._propertyId.name} to be of type ${this._propertyId.typeName}.`;\n return;\n case ECEditingStatus.BaseClassIsNotElement:\n this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.Element.`;\n return;\n case ECEditingStatus.BaseClassIsNotElementUniqueAspect:\n this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.ElementUniqueAspect.`;\n return;\n case ECEditingStatus.BaseClassIsNotElementMultiAspect:\n this.message = `Expected base class ${this._schemaItemId.name} to derive from BisCore.ElementMultiAspect.`;\n return;\n case ECEditingStatus.InvalidFormatUnitsSpecified:\n this.message = `The specified Format unit ${this._schemaItemId.name} is not of type Unit or InvertedUnit`;\n return;\n case ECEditingStatus.InvalidEnumeratorType:\n this.message = `The Enumeration ${this._enumeratorId.enumeration.fullName} has type ${this._enumeratorId.enumerationType}, while Enumerator ${this._enumeratorId.name} has type ${this._enumeratorId.enumeratorType}.`;\n return;\n case ECEditingStatus.EnumeratorDoesNotExist:\n this.message = `Enumerator ${this._enumeratorId.name} does not exists in Enumeration ${this._enumeratorId.enumeration.name}.`;\n return;\n case ECEditingStatus.InvalidECName:\n this.message = `Could not rename class ${this._schemaItemId.name} because the specified name is not a valid ECName.`;\n return;\n case ECEditingStatus.InvalidSchemaAlias:\n this.message = `Could not set the alias for schema ${this._schemaKey.name} because the specified alias is not a valid ECName.`;\n return;\n default:\n this.message = this._createTaskErrorMessage();\n }\n }\n\n private _appendMessage(e: string) {\n return this.message ? `${e}: ${this.message}` : e;\n }\n\n private _getRuleViolationMessage(): string {\n if (!this._ruleViolations)\n return \"\";\n\n let violations = \"\";\n for (const diagnostic of this._ruleViolations) {\n violations += `${diagnostic.code}: ${diagnostic.messageText}\\r\\n`;\n }\n\n switch (this.identifier.typeIdentifier) {\n case SchemaTypeIdentifiers.SchemaIdentifier:\n return `Rule violations occurred from Schema ${this._schemaId.name}: ${violations}`;\n case SchemaTypeIdentifiers.SchemaItemIdentifier:\n return `Rule violations occurred from ${this._schemaItemId.schemaItemType} ${this._schemaItemId.name}: ${violations}`;\n case SchemaTypeIdentifiers.ClassIdentifier:\n return `Rule violations occurred from ${this._schemaItemId.schemaItemType} ${this._schemaItemId.name}: ${violations}`;\n case SchemaTypeIdentifiers.CustomAttributeIdentifier:\n return `Rule violations occurred from CustomAttribute ${this._customAttributeId.name}, container ${this._customAttributeId.containerFullName}: ${violations}`;\n case SchemaTypeIdentifiers.RelationshipConstraintIdentifier:\n return `Rule violations occurred from ${this._relationshipConstraintId.name} constraint of RelationshipClass ${this._relationshipConstraintId.relationshipKey.fullName}: ${violations}`;\n default:\n throw new Error(\"Invalid identifier.\");\n }\n }\n\n private _createTaskErrorMessage() {\n // Make sure we have an inner error or else it is not a task error\n if (!this.innerError)\n return \"\";\n\n switch (this.identifier.typeIdentifier) {\n case SchemaTypeIdentifiers.SchemaIdentifier:\n case SchemaTypeIdentifiers.SchemaItemIdentifier:\n case SchemaTypeIdentifiers.ClassIdentifier:\n case SchemaTypeIdentifiers.RelationshipConstraintIdentifier:\n return `While performing task '${ECEditingStatus[this.errorNumber]}' an error occurred editing ${this.identifier.typeIdentifier} ${this.identifier.name}.`;\n case SchemaTypeIdentifiers.PropertyIdentifier:\n return `While performing task '${ECEditingStatus[this.errorNumber]}' an error occurred editing ${this.identifier.typeIdentifier} ${this.identifier.fullName}.`;\n default:\n throw new Error(\"Invalid identifier.\");\n }\n }\n\n private isSchemaItemIdentifier(identifier: AnyIdentifier) {\n if (identifier.typeIdentifier !== SchemaTypeIdentifiers.SchemaItemIdentifier &&\n identifier.typeIdentifier !== SchemaTypeIdentifiers.ClassIdentifier)\n return true;\n\n return false;\n }\n}\n\nfunction getEnumeratorType(enumeration: Enumeration, enumerator: AnyEnumerator | string) {\n if (typeof (enumerator) === \"string\") {\n return enumeration.type ? primitiveTypeToString(enumeration.type) : \"string\";\n }\n\n return typeof (enumerator.value) === \"string\" ? \"string\" : \"int\";\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ECRules.js","sourceRoot":"","sources":["../../../src/Validation/ECRules.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAC2E,eAAe,EAC/F,iBAAiB,EAAE,WAAW,EAAe,KAAK,EAAqB,aAAa,EAAE,qBAAqB,EACtD,wBAAwB,EAAU,WAAW,EAAE,cAAc,EAClH,iBAAiB,EAAE,yBAAyB,GAC7C,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACY,0BAA0B,EAAE,6CAA6C,EAAE,6BAA6B,EACzH,2CAA2C,EAAE,2BAA2B,EAAE,+BAA+B,GAG1G,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,GAAG,WAAW,CAAC;AAEhC,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,GAAG,WAAW,IAAI,IAAI,EAAE,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,yDAAyD;AACzD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,6BAA6B;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------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Validation\n */\n\nimport {\n AnyClass, AnyProperty, CustomAttribute, CustomAttributeContainerProps, ECClass, ECClassModifier,\n ECStringConstants, EntityClass, Enumeration, Mixin, PrimitiveProperty, PrimitiveType, primitiveTypeToString,\n Property, RelationshipClass, RelationshipConstraint, RelationshipMultiplicity, Schema, SchemaGraph, SchemaItemType,\n StrengthDirection, strengthDirectionToString,\n} from \"@itwin/ecschema-metadata\";\nimport {\n ClassDiagnostic, createClassDiagnosticClass, createCustomAttributeContainerDiagnosticClass, createPropertyDiagnosticClass,\n createRelationshipConstraintDiagnosticClass, createSchemaDiagnosticClass, createSchemaItemDiagnosticClass, CustomAttributeContainerDiagnostic,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n DiagnosticType, PropertyDiagnostic, RelationshipConstraintDiagnostic, SchemaDiagnostic, SchemaItemDiagnostic,\n} from \"./Diagnostic\";\nimport { IRuleSet } from \"./Rules\";\n\nconst ruleSetName = \"ECObjects\";\n\nfunction getCode(code: number): string {\n return `${ruleSetName}-${code}`;\n}\n\n/**\n * The unique diagnostic codes for ECObjects rules.\n *\n * To provide meaning to code values, with anticipation\n * of future rules for all current EC Types, the following\n * value ranges should be used:\n *\n * - Schema: 000-099\n * - Class: 100-199\n * - Constant: 200-299\n * - CustomAttribute 300-399\n * - CustomAttributeClass: 400-499\n * - CustomAttributeContainer: 500-599\n * - EntityClass: 600-699\n * - Enumeration: 700-799\n * - Format: 800-899\n * - InvertedUnit: 900-999\n * - KindOfQuantity: 1000-1099\n * - Mixin: 1100-1199\n * - Phenomenon: 1200-1299\n * - Property: 1300-1399\n * - PropertyCategory: 1400-1499\n * - RelationshipClass: 1500-1599\n * - RelationshipConstraint: 1600-1699\n * - StructClass: 1700-1799\n * - Unit: 1800-1899\n * - UnitSystem: 1900-1999\n * @beta\n */\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const DiagnosticCodes = {\n // Class Rule Codes (100-199)\n BaseClassIsSealed: getCode(100),\n BaseClassOfDifferentType: getCode(101),\n // EC-102 has been deprecated. Leaving the code here to prevent re-use.\n AbstractClassWithNonAbstractBase: getCode(102),\n\n // CA Container Rule Codes (500-599)\n CustomAttributeNotOfConcreteClass: getCode(500),\n CustomAttributeSchemaMustBeReferenced: getCode(501),\n CustomAttributeClassNotFound: getCode(502),\n\n // Enumeration Rule Codes (700-799)\n EnumerationTypeUnsupported: getCode(700),\n\n // Mixin Rule Codes (1100-1199)\n MixinAppliedToClassMustDeriveFromConstraint: getCode(1100),\n\n // Property Rule Codes (1300-1399)\n IncompatibleValueTypePropertyOverride: getCode(1300),\n IncompatibleTypePropertyOverride: getCode(1301),\n IncompatibleUnitPropertyOverride: getCode(1302),\n\n // Relationship Rule Codes (1500-1599)\n AbstractConstraintMustNarrowBaseConstraints: getCode(1500),\n DerivedConstraintsMustNarrowBaseConstraints: getCode(1501),\n ConstraintClassesDeriveFromAbstractConstraint: getCode(1502),\n\n // Relationship Constraint Rule Codes (1600-1699)\n AtLeastOneConstraintClassDefined: getCode(1600),\n AbstractConstraintMustExistWithMultipleConstraints: getCode(1601),\n};\n\n/**\n * The list of [[IDiagnostic]] implementation classes used by the EC rule implementations.\n * @beta\n */\nexport const Diagnostics = {\n /** EC-001: Required message parameters: schema name, referenced schema name */\n SupplementalSchemasCannotBeReferenced: createSchemaDiagnosticClass<[string, string]>(getCode(1),\n \"Referenced schema '{1}' of schema '{0}' is a supplemental schema. Supplemental schemas are not allowed to be referenced.\"),\n\n /** EC-002: Required message parameters: schema name, reference schema alias, first schema reference name, second schema reference name. */\n SchemaRefAliasMustBeUnique: createSchemaDiagnosticClass<[string, string, string, string]>(getCode(2),\n \"Schema '{0}' has multiple schema references ({2}, {3}) with the same alias '{1}', which is not allowed.\"),\n\n /** EC-003: Required message parameters: schema name, cycle text */\n ReferenceCyclesNotAllowed: createSchemaDiagnosticClass<[string, string]>(getCode(3),\n \"Schema '{0}' has reference cycles: {1}\"),\n\n /** EC-100: Required message parameters: childClass.FullName, baseClass.FullName */\n BaseClassIsSealed: createClassDiagnosticClass<[string, string]>(DiagnosticCodes.BaseClassIsSealed,\n \"Class '{0}' cannot derive from sealed base class '{1}'.\"),\n\n /** EC-101: Required message parameters: childClass.FullName, baseClass.FullName, baseClass.schemaItemType */\n BaseClassIsOfDifferentType: createClassDiagnosticClass<[string, string, string]>(DiagnosticCodes.BaseClassOfDifferentType,\n \"Class '{0}' cannot derive from base class '{1}' of type '{2}'.\"),\n\n /** **DEPRECATED** EC-102: Required message parameters: childClass.FullName, baseClass.FullName */\n AbstractClassWithNonAbstractBase: createClassDiagnosticClass<[string, string]>(DiagnosticCodes.AbstractClassWithNonAbstractBase,\n \"Abstract Class '{0}' cannot derive from base class '{1}' because it is not an abstract class.\"),\n\n /** EC-500: Required message parameters: CustomAttribute container name and CustomAttributeClass name. */\n CustomAttributeNotOfConcreteClass: createCustomAttributeContainerDiagnosticClass<[string, string]>(DiagnosticCodes.CustomAttributeNotOfConcreteClass,\n \"The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' which is not a concrete class.\"),\n\n /** EC-501: Required message parameters: CustomAttribute container name, CustomAttributeClass name, CustomAttributeClass Schema name. */\n CustomAttributeSchemaMustBeReferenced: createCustomAttributeContainerDiagnosticClass<[string, string]>(DiagnosticCodes.CustomAttributeSchemaMustBeReferenced,\n \"The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' whose schema is not referenced by the container's Schema.\"),\n\n /** EC-502: Required message parameters: CustomAttribute container name and CustomAttributeClass name. */\n CustomAttributeClassNotFound: createCustomAttributeContainerDiagnosticClass<[string, string]>(DiagnosticCodes.CustomAttributeClassNotFound,\n \"The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' which cannot be found.\"),\n\n /** EC-700: Required message parameters: Enumeration name */\n EnumerationTypeUnsupported: createSchemaItemDiagnosticClass<Enumeration, [string]>(DiagnosticCodes.EnumerationTypeUnsupported,\n \"Enumeration '{0}' has invalid primitive type.\"),\n\n /** EC-1100: Required message parameters: mixin class fullName, class fullName, applies to constraint class fullName */\n MixinAppliedToClassMustDeriveFromConstraint: createSchemaItemDiagnosticClass<EntityClass, [string, string, string]>(DiagnosticCodes.MixinAppliedToClassMustDeriveFromConstraint,\n \"Mixin '{0}' cannot be applied to the class '{1}' because it does not satisfy the applies to constraint '{2}'.\"),\n\n /** EC-1300: Required message parameters: childClass.FullName, property name, baseClass.FullName, base value type, child value type */\n IncompatibleValueTypePropertyOverride: createPropertyDiagnosticClass<[string, string, string, string, string]>(DiagnosticCodes.IncompatibleValueTypePropertyOverride,\n \"The ECProperty '{0}.{1}' has a base property '{2}.{1}' with a value type of {3} which is incompatible with the value type of {4}.\"),\n\n /** EC-1301: Required message parameters: childClass.FullName, property name, baseClass.FullName, base property type, child property type */\n IncompatibleTypePropertyOverride: createPropertyDiagnosticClass<[string, string, string, string, string]>(DiagnosticCodes.IncompatibleTypePropertyOverride,\n \"The ECProperty '{0}.{1}' has a base property '{2}.{1}' with a type of {3} which is incompatible with the type of {4}.\"),\n\n /** EC-1302: Required message parameters: childClass.Name, property name, baseClass.Name, baseClass Koq name, baseClass Koq persistence unit name, child class Koq persistence unit name, child class Koq name */\n IncompatibleUnitPropertyOverride: createPropertyDiagnosticClass<[string, string, string, string, string, string, string]>(DiagnosticCodes.IncompatibleUnitPropertyOverride,\n \"The ECProperty '{0}.{1}' has a base property '{2}.{1}' with KindOfQuantity '{3}' with persistence unit '{4}' which is not the same as the persistence unit '{5}' of the provided KindOfQuantity '{6}'.\"),\n\n /** EC-1303: Required message parameters: property.fullName, navigation relationship.fullName */\n NavigationRelationshipMustBeRoot: createPropertyDiagnosticClass<[string, string]>(getCode(1303),\n \"The referenced relationship '{1}', used in NavigationProperty '{0}' is not the root relationship.\"),\n\n /** EC-1304: Required message parameters: property.fullName, navigation relationship.fullName */\n NavigationTargetMustHaveSingularMultiplicity: createPropertyDiagnosticClass<[string, string, string]>(getCode(1304),\n \"NavigationProperty '{0}' uses the relationship '{1}' that cannot be traversed in the '{2}' direction due to a max multiplicity greater than 1.\"),\n\n /** EC-1305: Required message parameters: property.fullName, navigation relationship.fullName */\n NavigationRelationshipAbstractConstraintEntityOrMixin: createPropertyDiagnosticClass<[string, string]>(getCode(1305),\n \"The NavigationProperty '{0}', using the relationship '{1}', points to a RelationshipClass, which is not allowed. NavigationProperties must point to an EntityClass or Mixin.\"),\n\n /** EC-1306: Required message parameters: class name, property name, navigation relationship.fullName */\n NavigationClassMustBeAConstraintClassOfRelationship: createPropertyDiagnosticClass<[string, string, string, string]>(getCode(1306),\n \"The class '{0}' of NavigationProperty '{1}' is not supported by the {3} constraint of the referenced relationship '{2}'.\"),\n\n /** EC-1500: Required message parameters: abstract constraint class name, relationship end (source/target), relationship name, base relationship name */\n AbstractConstraintMustNarrowBaseConstraints: createSchemaItemDiagnosticClass<RelationshipClass, [string, string, string, string]>(DiagnosticCodes.AbstractConstraintMustNarrowBaseConstraints,\n \"The abstract constraint class '{0}' on the {1}-Constraint of '{2}' is not supported by the base class constraint in '{3}'.\"),\n\n /** EC-1501: Required message parameters: constraint class name, relationship end (source/target), relationship name, base relationship name */\n DerivedConstraintsMustNarrowBaseConstraints: createSchemaItemDiagnosticClass<RelationshipClass, [string, string, string, string]>(DiagnosticCodes.DerivedConstraintsMustNarrowBaseConstraints,\n \"The constraint class '{0}' on the {1}-Constraint of '{2}' is not supported by the base class constraint in '{3}'.\"),\n\n /** EC-1502: Required message parameters: constraint class name, relationship end (source/target), relationship name, abstract constraint class name */\n ConstraintClassesDeriveFromAbstractConstraint: createSchemaItemDiagnosticClass<RelationshipClass, [string, string, string, string]>(DiagnosticCodes.ConstraintClassesDeriveFromAbstractConstraint,\n \"The constraint class '{0}' on the {1}-Constraint of '{2}' is not derived from the abstract constraint class '{3}'.\"),\n\n /** EC-1600: Required message parameters: relationship end (source/target), relationship name */\n AtLeastOneConstraintClassDefined: createRelationshipConstraintDiagnosticClass<[string, string]>(DiagnosticCodes.AtLeastOneConstraintClassDefined,\n \"The {0}-Constraint of '{1}' does not contain any constraint classes.\"),\n\n /** EC-1601: Required message parameters: relationship end (source/target), relationship name */\n AbstractConstraintMustExistWithMultipleConstraints: createRelationshipConstraintDiagnosticClass<[string, string]>(DiagnosticCodes.AbstractConstraintMustExistWithMultipleConstraints,\n \"The {0}-Constraint of '{1}' has multiple constraint classes which requires an abstract constraint to be defined.\"),\n};\n\n/**\n * All schema validation rules that fall under the category of ECObjects.\n * @beta\n */\nexport const ECRuleSet: IRuleSet = {\n name: ruleSetName,\n\n schemaRules: [\n validateSchemaReferences,\n ],\n classRules: [\n baseClassIsSealed,\n baseClassIsOfDifferentType,\n ],\n propertyRules: [\n incompatibleValueTypePropertyOverride,\n incompatibleTypePropertyOverride,\n incompatibleUnitPropertyOverride,\n validateNavigationProperty,\n ],\n relationshipRules: [\n abstractConstraintMustNarrowBaseConstraints,\n constraintClassesDeriveFromAbstractConstraint,\n derivedConstraintsMustNarrowBaseConstraints,\n ],\n relationshipConstraintRules: [\n atLeastOneConstraintClassDefined,\n abstractConstraintMustExistWithMultipleConstraints,\n ],\n enumerationRules: [\n enumerationTypeUnsupported,\n ],\n entityClassRules: [\n mixinAppliedToClassMustDeriveFromConstraint,\n ],\n customAttributeInstanceRules: [\n validateCustomAttributeInstance,\n ],\n};\n\n/* eslint-enable @typescript-eslint/naming-convention */\n\n/**\n * Validates schema references against multiple EC rules.\n * @param schema The schema to validate.\n * @internal\n */\nexport async function* validateSchemaReferences(schema: Schema): AsyncIterable<SchemaDiagnostic<any[]>> {\n yield* validateSchemaReferencesSync(schema);\n}\n\n/**\n * Validates schema references against multiple EC rules.\n * @param schema The schema to validate.\n * @internal\n */\nexport function* validateSchemaReferencesSync(schema: Schema): Iterable<SchemaDiagnostic<any[]>> {\n const aliases = new Map();\n for (const schemaRef of schema.references) {\n if (schemaRef.customAttributes && schemaRef.customAttributes.has(\"CoreCustomAttributes.SupplementalSchema\"))\n yield new Diagnostics.SupplementalSchemasCannotBeReferenced(schema, [schema.name, schemaRef.name]);\n\n if (schema.schemaKey.matches(schemaRef.schemaKey))\n yield new Diagnostics.ReferenceCyclesNotAllowed(schema, [schema.name, `${schema.name} --> ${schemaRef.name}`]);\n\n if (aliases.has(schemaRef.alias)) {\n const currentRef = aliases.get(schemaRef.alias);\n yield new Diagnostics.SchemaRefAliasMustBeUnique(schema, [schema.name, schemaRef.alias, currentRef.name, schemaRef.name]);\n } else {\n aliases.set(schemaRef.alias, schemaRef);\n }\n }\n\n const graph = SchemaGraph.generateGraphSync(schema);\n const cycles = graph.detectCycles();\n if (cycles) {\n const result = cycles.map((cycle) => `${cycle.schema.schemaKey.name} --> ${cycle.refSchema.schemaKey.name}`).join(\", \");\n yield new Diagnostics.ReferenceCyclesNotAllowed(schema, [schema.name, result]);\n }\n}\n/**\n * EC Rule: Sealed classes cannot be a base class.\n * @internal\n */\nexport async function* baseClassIsSealed(ecClass: AnyClass): AsyncIterable<ClassDiagnostic<any[]>> {\n if (!ecClass.baseClass)\n return;\n\n const baseClass = await ecClass.baseClass;\n // return if rule passed\n if (baseClass.modifier !== ECClassModifier.Sealed)\n return;\n\n yield new Diagnostics.BaseClassIsSealed(ecClass, [ecClass.fullName, baseClass.fullName]);\n}\n\n/**\n * EC Rule: Base and child class must be of the same type (i.e. Entity, Mixin, Relationship, etc.)\n * @internal\n */\nexport async function* baseClassIsOfDifferentType(ecClass: AnyClass): AsyncIterable<ClassDiagnostic<any[]>> {\n if (!ecClass.baseClass)\n return;\n\n const baseClass = await ecClass.baseClass;\n // return if rule passed\n if (baseClass.schemaItemType === ecClass.schemaItemType)\n return;\n\n const itemType = baseClass.schemaItemType;\n yield new Diagnostics.BaseClassIsOfDifferentType(ecClass, [ecClass.fullName, baseClass.fullName, itemType]);\n}\n\n/**\n * EC Rule: When overriding a class primitive property, the child and base property must be of the same type (string, number, etc...).\n * @internal\n*/\nexport async function* incompatibleValueTypePropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\n if (!property.class.baseClass)\n return;\n\n const maybePrimitiveType = getPrimitiveType(property);\n if (!maybePrimitiveType)\n return;\n\n const primitiveType: PrimitiveType = maybePrimitiveType;\n\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\n const baseProperty = await baseClass.getProperty(property.name, true);\n if (!baseProperty)\n return;\n\n // Other rules will catch this if false, but we need to make sure\n // types match for this rule to be valid.\n if (!propertyTypesMatch(property, baseProperty))\n return;\n\n const baseType = getPrimitiveType(baseProperty);\n\n // Return if rule passed\n if (!baseType || primitiveType === baseType)\n return;\n\n return new Diagnostics.IncompatibleValueTypePropertyOverride(property, [property.class.fullName, property.name, baseClass.fullName, primitiveTypeToString(baseType), primitiveTypeToString(primitiveType)]);\n }\n\n for await (const baseClass of property.class.getAllBaseClasses()) {\n const result = await callback(baseClass);\n if (result)\n yield result;\n }\n}\n\n/**\n * EC Rule: When overriding a class property, the child and base property must be of the same property type (primitive, struct, enumeration, etc...).\n * @internal\n */\nexport async function* incompatibleTypePropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\n if (!property.class.baseClass)\n return;\n\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\n const baseProperty = await baseClass.getProperty(property.name, true);\n if (!baseProperty)\n return;\n\n // Return if rule passed\n if (propertyTypesMatch(property, baseProperty))\n return;\n\n return new Diagnostics.IncompatibleTypePropertyOverride(property, [property.class.fullName, property.name, baseClass.fullName, baseProperty.constructor.name, property.constructor.name]);\n }\n\n for await (const baseClass of property.class.getAllBaseClasses()) {\n const result = await callback(baseClass);\n if (result)\n yield result;\n }\n}\n\n/**\n * EC Rule: When overriding a kindOfQuantity property, the child and base property units must be the same.\n * @internal\n */\nexport async function* incompatibleUnitPropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\n if (!property.kindOfQuantity || !property.class.baseClass)\n return;\n\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\n const baseProperty = await baseClass.getProperty(property.name, true);\n if (!baseProperty || !baseProperty.kindOfQuantity)\n return;\n\n // Other rules will catch this if false, but we need to make sure\n // types match for this rule to be valid.\n if (!propertyTypesMatch(property, baseProperty))\n return;\n\n const koq = await property.kindOfQuantity;\n const baseKoq = await baseProperty.kindOfQuantity;\n if (!koq || !baseKoq)\n return;\n\n const unit = await koq.persistenceUnit;\n const baseUnit = await baseKoq.persistenceUnit;\n\n if (!unit || !baseUnit)\n return;\n\n // return if rule passed\n if (unit.key.matches(baseUnit.key))\n return;\n\n return new Diagnostics.IncompatibleUnitPropertyOverride(property, [\n property.class.fullName,\n property.name,\n baseClass.fullName,\n baseKoq.fullName,\n baseUnit.fullName,\n unit.fullName,\n koq.fullName,\n ]);\n }\n\n for await (const baseClass of property.class.getAllBaseClasses()) {\n const result = await callback(baseClass);\n if (result)\n yield result;\n }\n}\n\n/**\n * Validates Navigation Properties. EC Rules: 1303, 1304\n * @internal\n */\nexport async function* validateNavigationProperty(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\n if (!property.isNavigation())\n return;\n\n const navProp = property;\n const relationship = await navProp.relationshipClass;\n\n if (relationship.baseClass)\n yield new Diagnostics.NavigationRelationshipMustBeRoot(property, [property.fullName, relationship.fullName]);\n\n let thisConstraint: RelationshipConstraint;\n let thatConstraint: RelationshipConstraint;\n let navigationClassSide: string;\n if (navProp.direction === StrengthDirection.Forward) {\n thisConstraint = relationship.source;\n thatConstraint = relationship.target;\n navigationClassSide = \"source\";\n } else {\n thisConstraint = relationship.target;\n thatConstraint = relationship.source;\n navigationClassSide = \"target\";\n }\n\n const thatAbstractConstraint = await thatConstraint.abstractConstraint;\n if (thatAbstractConstraint && thatAbstractConstraint.schemaItemType === SchemaItemType.RelationshipClass) {\n yield new Diagnostics.NavigationRelationshipAbstractConstraintEntityOrMixin(property, [property.fullName, relationship.fullName]);\n }\n\n const isClassSupported = async (ecClass: ECClass, propertyName: string, constraintName: string): Promise<boolean> => {\n if (constraintName === ecClass.fullName && undefined !== await ecClass.getProperty(propertyName, true))\n return true;\n\n const inheritedProp = await ecClass.getInheritedProperty(propertyName);\n if (inheritedProp && constraintName === inheritedProp.class.fullName)\n return true;\n\n const baseClass = await ecClass.baseClass;\n if (!baseClass)\n return false;\n\n return isClassSupported(baseClass, propertyName, constraintName);\n };\n\n let classSupported = false;\n if (thisConstraint.constraintClasses) {\n for (const constraintClass of thisConstraint.constraintClasses) {\n classSupported = await isClassSupported(property.class, property.name, constraintClass.fullName);\n if (classSupported)\n break;\n }\n }\n\n if (!classSupported)\n yield new Diagnostics.NavigationClassMustBeAConstraintClassOfRelationship(property, [property.class.name, property.name, relationship.fullName, navigationClassSide]);\n\n if (thatConstraint.multiplicity === RelationshipMultiplicity.oneMany || thatConstraint.multiplicity === RelationshipMultiplicity.zeroMany) {\n const direction = strengthDirectionToString(navProp.direction);\n yield new Diagnostics.NavigationTargetMustHaveSingularMultiplicity(property, [property.fullName, relationship.fullName, direction]);\n }\n\n return;\n}\n\n/**\n * Validates a Relationship class and yields EC-1500, EC-1501, and EC-1502 rule violations.\n * @internal\n */\nexport async function* validateRelationship(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\n yield* abstractConstraintMustNarrowBaseConstraints(ecClass);\n yield* derivedConstraintsMustNarrowBaseConstraints(ecClass);\n yield* constraintClassesDeriveFromAbstractConstraint(ecClass);\n}\n\n/**\n * EC Rule: When overriding a RelationshipClass, the derived abstract constraint must narrow the base constraint classes.\n * @internal\n */\nexport async function* abstractConstraintMustNarrowBaseConstraints(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\n if (!ecClass.baseClass)\n return;\n\n const baseRelationship = await ecClass.baseClass as RelationshipClass;\n\n const sourceResult = await applyAbstractConstraintMustNarrowBaseConstraints(ecClass, ecClass.source, baseRelationship);\n if (sourceResult)\n yield sourceResult;\n const targetResult = await applyAbstractConstraintMustNarrowBaseConstraints(ecClass, ecClass.target, baseRelationship);\n if (targetResult)\n yield targetResult;\n}\n\n/**\n * EC Rule: When overriding a RelationshipClass, derived constraint classes must narrow base constraint classes.\n * @internal\n */\nexport async function* derivedConstraintsMustNarrowBaseConstraints(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\n if (!ecClass.baseClass)\n return;\n\n const baseRelationship = await ecClass.baseClass as RelationshipClass;\n\n const sourceResult = await applyDerivedConstraintsMustNarrowBaseConstraints(ecClass, ecClass.source, baseRelationship);\n if (sourceResult)\n yield sourceResult;\n const targetResult = await applyDerivedConstraintsMustNarrowBaseConstraints(ecClass, ecClass.target, baseRelationship);\n if (targetResult)\n yield targetResult;\n}\n\n/**\n * EC Rule: All constraint classes must have a common base class specified in the abstract constraint.\n * @internal\n */\nexport async function* constraintClassesDeriveFromAbstractConstraint(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\n const sourceResult = await applyConstraintClassesDeriveFromAbstractConstraint(ecClass, ecClass.source);\n if (sourceResult)\n yield sourceResult;\n const targetResult = await applyConstraintClassesDeriveFromAbstractConstraint(ecClass, ecClass.target);\n if (targetResult)\n yield targetResult;\n}\n\n/**\n * Validates a RelationshipConstraint and yields EC-1600 and EC-1601 rule violations.\n * @internal\n */\nexport async function* validateRelationshipConstraint(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\n yield* atLeastOneConstraintClassDefined(constraint);\n yield* abstractConstraintMustExistWithMultipleConstraints(constraint);\n}\n\n/**\n * EC Rule: At least on concrete constraint class must be defined in the list of constraint classes.\n * @internal\n */\nexport async function* atLeastOneConstraintClassDefined(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\n if (!constraint.constraintClasses || constraint.constraintClasses.length === 0) {\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n yield new Diagnostics.AtLeastOneConstraintClassDefined(constraint, [constraintType, constraint.relationshipClass.fullName]);\n }\n}\n\n/**\n * EC Rule: If multiple constraints exist, an abstract constraint must be defined.\n * @internal\n */\nexport async function* abstractConstraintMustExistWithMultipleConstraints(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\n if (!constraint.constraintClasses || constraint.constraintClasses.length <= 1) {\n return;\n }\n\n const abstractConstraint = await getAbstractConstraint(constraint);\n if (abstractConstraint)\n return;\n\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n yield new Diagnostics.AbstractConstraintMustExistWithMultipleConstraints(constraint, [constraintType, constraint.relationshipClass.fullName]);\n}\n\nfunction propertyTypesMatch(propertyA: Property, propertyB: Property) {\n return propertyA.constructor.name === propertyB.constructor.name;\n}\n\nfunction getPrimitiveType(property: Property): PrimitiveType | undefined {\n if (property.isPrimitive())\n return (property as PrimitiveProperty).primitiveType;\n\n return undefined;\n}\n\n/**\n * EC Rule: Enumeration type must be a string or integer\n * @internal\n */\nexport async function* enumerationTypeUnsupported(enumeration: Enumeration): AsyncIterable<SchemaItemDiagnostic<Enumeration, any[]>> {\n const type = enumeration.type;\n if (type === PrimitiveType.Integer || type === PrimitiveType.String)\n return;\n\n yield new Diagnostics.EnumerationTypeUnsupported(enumeration, [enumeration.fullName]);\n}\n\n/**\n * EC Rule: Mixin applied to class must derived from the Mixin appliesTo constraint.\n * @internal\n */\nexport async function* mixinAppliedToClassMustDeriveFromConstraint(entityClass: EntityClass): AsyncIterable<SchemaItemDiagnostic<EntityClass, any[]>> {\n for (const lazyMixin of entityClass.mixins) {\n const mixin = await lazyMixin;\n if (!mixin.appliesTo)\n continue;\n\n if (!await entityClass.is(await mixin.appliesTo))\n yield new Diagnostics.MixinAppliedToClassMustDeriveFromConstraint(entityClass, [mixin.fullName, entityClass.fullName, mixin.appliesTo.fullName]);\n }\n\n return;\n}\n\n/**\n * Validates a custom attribute instance and yields EC-500, EC-501, and EC-502 rule violations.\n * @internal\n */\nexport async function* validateCustomAttributeInstance(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\n yield* customAttributeNotOfConcreteClass(container, customAttribute);\n yield* customAttributeSchemaMustBeReferenced(container, customAttribute);\n yield* customAttributeClassMustExist(container, customAttribute);\n}\n\n/** EC Rule: CustomAttribute instance must be of a concrete CustomAttributeClass. */\nasync function* customAttributeNotOfConcreteClass(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\n const schema = container.schema;\n const caClass = await schema.lookupItem(customAttribute.className) as ECClass;\n if (!caClass)\n return;\n\n if (caClass.modifier !== ECClassModifier.Abstract)\n return;\n\n yield new Diagnostics.CustomAttributeNotOfConcreteClass(container, [container.fullName, caClass.fullName]);\n}\n\n/** EC Rule: CustomAttribute Schema must be referenced by the container's Schema. */\nasync function* customAttributeSchemaMustBeReferenced(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\n const schema = container.schema;\n const nameParts = customAttribute.className.split(\".\");\n if (nameParts.length === 1 || nameParts[0] === schema.name)\n return;\n\n if (schema.references.some((s) => s.name === nameParts[0]))\n return;\n\n yield new Diagnostics.CustomAttributeSchemaMustBeReferenced(container, [container.fullName, customAttribute.className]);\n}\n\n/** EC Rule: CustomAttribute instance class must exist. */\nasync function* customAttributeClassMustExist(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\n const schema = container.schema;\n const caClass = await schema.lookupItem(customAttribute.className) as ECClass;\n if (!caClass)\n yield new Diagnostics.CustomAttributeClassNotFound(container, [container.fullName, customAttribute.className]);\n}\n\nasync function applyAbstractConstraintMustNarrowBaseConstraints(ecClass: RelationshipClass, constraint: RelationshipConstraint, baseRelationship: RelationshipClass): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\n const abstractConstraint = await constraint.abstractConstraint;\n if (!abstractConstraint)\n return;\n\n if (await baseConstraint.supportsClass(abstractConstraint))\n return;\n\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n return new Diagnostics.AbstractConstraintMustNarrowBaseConstraints(ecClass, [abstractConstraint.fullName, constraintType, constraint.relationshipClass.fullName, baseRelationship.fullName]);\n}\n\nasync function applyDerivedConstraintsMustNarrowBaseConstraints(ecClass: RelationshipClass, constraint: RelationshipConstraint, baseRelationship: RelationshipClass): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\n\n if (!constraint.constraintClasses)\n return;\n\n for (const classPromise of constraint.constraintClasses) {\n const constraintClass = await classPromise;\n\n if (await baseConstraint.supportsClass(constraintClass))\n continue;\n\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n return new Diagnostics.DerivedConstraintsMustNarrowBaseConstraints(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, baseRelationship.fullName]);\n }\n\n return;\n}\n\nasync function applyConstraintClassesDeriveFromAbstractConstraint(ecClass: RelationshipClass, constraint: RelationshipConstraint): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\n const abstractConstraint = await getAbstractConstraint(constraint);\n if (!abstractConstraint)\n return;\n\n if (!constraint.constraintClasses)\n return;\n\n for (const classPromise of constraint.constraintClasses) {\n const constraintClass = await classPromise;\n\n if (Mixin.isMixin(constraintClass) && EntityClass.isEntityClass(abstractConstraint)) {\n if (!await (constraintClass).applicableTo(abstractConstraint)) {\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n return new Diagnostics.ConstraintClassesDeriveFromAbstractConstraint(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, abstractConstraint.fullName]);\n }\n continue;\n }\n\n if (!await constraintClass.is(abstractConstraint)) {\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n return new Diagnostics.ConstraintClassesDeriveFromAbstractConstraint(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, abstractConstraint.fullName]);\n }\n }\n\n return;\n}\n\nasync function getAbstractConstraint(constraint: RelationshipConstraint): Promise<ECClass | undefined> {\n const abstractConstraint = await constraint.abstractConstraint;\n if (abstractConstraint)\n return abstractConstraint;\n\n const baseRelationship = await constraint.relationshipClass.baseClass as RelationshipClass;\n if (!baseRelationship)\n return;\n\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\n\n return getAbstractConstraint(baseConstraint);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ECRules.js","sourceRoot":"","sources":["../../../src/Validation/ECRules.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAC2E,eAAe,EAC/F,iBAAiB,EAAE,WAAW,EAAe,KAAK,EAAE,aAAa,EAAE,qBAAqB,EACnC,wBAAwB,EAAU,WAAW,EAAE,cAAc,EAClH,iBAAiB,EAAE,yBAAyB,GAC7C,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACY,0BAA0B,EAAE,6CAA6C,EAAE,6BAA6B,EACzH,2CAA2C,EAAE,2BAA2B,EAAE,+BAA+B,GAG1G,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,GAAG,WAAW,CAAC;AAEhC,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,GAAG,WAAW,IAAI,I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AAgB,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC;IAE/F,OAAO,qBAAqB,CAAC,cAAc,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Validation\n */\n\nimport {\n AnyClass, AnyProperty, CustomAttribute, CustomAttributeContainerProps, ECClass, ECClassModifier,\n ECStringConstants, EntityClass, Enumeration, Mixin, PrimitiveType, primitiveTypeToString,\n Property, RelationshipClass, RelationshipConstraint, RelationshipMultiplicity, Schema, SchemaGraph, SchemaItemType,\n StrengthDirection, strengthDirectionToString,\n} from \"@itwin/ecschema-metadata\";\nimport {\n ClassDiagnostic, createClassDiagnosticClass, createCustomAttributeContainerDiagnosticClass, createPropertyDiagnosticClass,\n createRelationshipConstraintDiagnosticClass, createSchemaDiagnosticClass, createSchemaItemDiagnosticClass, CustomAttributeContainerDiagnostic,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n DiagnosticType, PropertyDiagnostic, RelationshipConstraintDiagnostic, SchemaDiagnostic, SchemaItemDiagnostic,\n} from \"./Diagnostic\";\nimport { IRuleSet } from \"./Rules\";\n\nconst ruleSetName = \"ECObjects\";\n\nfunction getCode(code: number): string {\n return `${ruleSetName}-${code}`;\n}\n\n/**\n * The unique diagnostic codes for ECObjects rules.\n *\n * To provide meaning to code values, with anticipation\n * of future rules for all current EC Types, the following\n * value ranges should be used:\n *\n * - Schema: 000-099\n * - Class: 100-199\n * - Constant: 200-299\n * - CustomAttribute 300-399\n * - CustomAttributeClass: 400-499\n * - CustomAttributeContainer: 500-599\n * - EntityClass: 600-699\n * - Enumeration: 700-799\n * - Format: 800-899\n * - InvertedUnit: 900-999\n * - KindOfQuantity: 1000-1099\n * - Mixin: 1100-1199\n * - Phenomenon: 1200-1299\n * - Property: 1300-1399\n * - PropertyCategory: 1400-1499\n * - RelationshipClass: 1500-1599\n * - RelationshipConstraint: 1600-1699\n * - StructClass: 1700-1799\n * - Unit: 1800-1899\n * - UnitSystem: 1900-1999\n * @beta\n */\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const DiagnosticCodes = {\n // Class Rule Codes (100-199)\n BaseClassIsSealed: getCode(100),\n BaseClassOfDifferentType: getCode(101),\n // EC-102 has been deprecated. Leaving the code here to prevent re-use.\n AbstractClassWithNonAbstractBase: getCode(102),\n\n // CA Container Rule Codes (500-599)\n CustomAttributeNotOfConcreteClass: getCode(500),\n CustomAttributeSchemaMustBeReferenced: getCode(501),\n CustomAttributeClassNotFound: getCode(502),\n\n // Enumeration Rule Codes (700-799)\n EnumerationTypeUnsupported: getCode(700),\n\n // Mixin Rule Codes (1100-1199)\n MixinAppliedToClassMustDeriveFromConstraint: getCode(1100),\n\n // Property Rule Codes (1300-1399)\n IncompatibleValueTypePropertyOverride: getCode(1300),\n IncompatibleTypePropertyOverride: getCode(1301),\n IncompatibleUnitPropertyOverride: getCode(1302),\n\n // Relationship Rule Codes (1500-1599)\n AbstractConstraintMustNarrowBaseConstraints: getCode(1500),\n DerivedConstraintsMustNarrowBaseConstraints: getCode(1501),\n ConstraintClassesDeriveFromAbstractConstraint: getCode(1502),\n\n // Relationship Constraint Rule Codes (1600-1699)\n AtLeastOneConstraintClassDefined: getCode(1600),\n AbstractConstraintMustExistWithMultipleConstraints: getCode(1601),\n};\n\n/**\n * The list of [[IDiagnostic]] implementation classes used by the EC rule implementations.\n * @beta\n */\nexport const Diagnostics = {\n /** EC-001: Required message parameters: schema name, referenced schema name */\n SupplementalSchemasCannotBeReferenced: createSchemaDiagnosticClass<[string, string]>(getCode(1),\n \"Referenced schema '{1}' of schema '{0}' is a supplemental schema. Supplemental schemas are not allowed to be referenced.\"),\n\n /** EC-002: Required message parameters: schema name, reference schema alias, first schema reference name, second schema reference name. */\n SchemaRefAliasMustBeUnique: createSchemaDiagnosticClass<[string, string, string, string]>(getCode(2),\n \"Schema '{0}' has multiple schema references ({2}, {3}) with the same alias '{1}', which is not allowed.\"),\n\n /** EC-003: Required message parameters: schema name, cycle text */\n ReferenceCyclesNotAllowed: createSchemaDiagnosticClass<[string, string]>(getCode(3),\n \"Schema '{0}' has reference cycles: {1}\"),\n\n /** EC-100: Required message parameters: childClass.FullName, baseClass.FullName */\n BaseClassIsSealed: createClassDiagnosticClass<[string, string]>(DiagnosticCodes.BaseClassIsSealed,\n \"Class '{0}' cannot derive from sealed base class '{1}'.\"),\n\n /** EC-101: Required message parameters: childClass.FullName, baseClass.FullName, baseClass.schemaItemType */\n BaseClassIsOfDifferentType: createClassDiagnosticClass<[string, string, string]>(DiagnosticCodes.BaseClassOfDifferentType,\n \"Class '{0}' cannot derive from base class '{1}' of type '{2}'.\"),\n\n /** **DEPRECATED** EC-102: Required message parameters: childClass.FullName, baseClass.FullName */\n AbstractClassWithNonAbstractBase: createClassDiagnosticClass<[string, string]>(DiagnosticCodes.AbstractClassWithNonAbstractBase,\n \"Abstract Class '{0}' cannot derive from base class '{1}' because it is not an abstract class.\"),\n\n /** EC-500: Required message parameters: CustomAttribute container name and CustomAttributeClass name. */\n CustomAttributeNotOfConcreteClass: createCustomAttributeContainerDiagnosticClass<[string, string]>(DiagnosticCodes.CustomAttributeNotOfConcreteClass,\n \"The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' which is not a concrete class.\"),\n\n /** EC-501: Required message parameters: CustomAttribute container name, CustomAttributeClass name, CustomAttributeClass Schema name. */\n CustomAttributeSchemaMustBeReferenced: createCustomAttributeContainerDiagnosticClass<[string, string]>(DiagnosticCodes.CustomAttributeSchemaMustBeReferenced,\n \"The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' whose schema is not referenced by the container's Schema.\"),\n\n /** EC-502: Required message parameters: CustomAttribute container name and CustomAttributeClass name. */\n CustomAttributeClassNotFound: createCustomAttributeContainerDiagnosticClass<[string, string]>(DiagnosticCodes.CustomAttributeClassNotFound,\n \"The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' which cannot be found.\"),\n\n /** EC-700: Required message parameters: Enumeration name */\n EnumerationTypeUnsupported: createSchemaItemDiagnosticClass<Enumeration, [string]>(DiagnosticCodes.EnumerationTypeUnsupported,\n \"Enumeration '{0}' has invalid primitive type.\"),\n\n /** EC-1100: Required message parameters: mixin class fullName, class fullName, applies to constraint class fullName */\n MixinAppliedToClassMustDeriveFromConstraint: createSchemaItemDiagnosticClass<EntityClass, [string, string, string]>(DiagnosticCodes.MixinAppliedToClassMustDeriveFromConstraint,\n \"Mixin '{0}' cannot be applied to the class '{1}' because it does not satisfy the applies to constraint '{2}'.\"),\n\n /** EC-1300: Required message parameters: childClass.FullName, property name, baseClass.FullName, base value type, child value type */\n IncompatibleValueTypePropertyOverride: createPropertyDiagnosticClass<[string, string, string, string, string]>(DiagnosticCodes.IncompatibleValueTypePropertyOverride,\n \"The ECProperty '{0}.{1}' has a base property '{2}.{1}' with a value type of {3} which is incompatible with the value type of {4}.\"),\n\n /** EC-1301: Required message parameters: childClass.FullName, property name, baseClass.FullName, base property type, child property type */\n IncompatibleTypePropertyOverride: createPropertyDiagnosticClass<[string, string, string, string, string]>(DiagnosticCodes.IncompatibleTypePropertyOverride,\n \"The ECProperty '{0}.{1}' has a base property '{2}.{1}' with a type of {3} which is incompatible with the type of {4}.\"),\n\n /** EC-1302: Required message parameters: childClass.Name, property name, baseClass.Name, baseClass Koq name, baseClass Koq persistence unit name, child class Koq persistence unit name, child class Koq name */\n IncompatibleUnitPropertyOverride: createPropertyDiagnosticClass<[string, string, string, string, string, string, string]>(DiagnosticCodes.IncompatibleUnitPropertyOverride,\n \"The ECProperty '{0}.{1}' has a base property '{2}.{1}' with KindOfQuantity '{3}' with persistence unit '{4}' which is not the same as the persistence unit '{5}' of the provided KindOfQuantity '{6}'.\"),\n\n /** EC-1303: Required message parameters: property.fullName, navigation relationship.fullName */\n NavigationRelationshipMustBeRoot: createPropertyDiagnosticClass<[string, string]>(getCode(1303),\n \"The referenced relationship '{1}', used in NavigationProperty '{0}' is not the root relationship.\"),\n\n /** EC-1304: Required message parameters: property.fullName, navigation relationship.fullName */\n NavigationTargetMustHaveSingularMultiplicity: createPropertyDiagnosticClass<[string, string, string]>(getCode(1304),\n \"NavigationProperty '{0}' uses the relationship '{1}' that cannot be traversed in the '{2}' direction due to a max multiplicity greater than 1.\"),\n\n /** EC-1305: Required message parameters: property.fullName, navigation relationship.fullName */\n NavigationRelationshipAbstractConstraintEntityOrMixin: createPropertyDiagnosticClass<[string, string]>(getCode(1305),\n \"The NavigationProperty '{0}', using the relationship '{1}', points to a RelationshipClass, which is not allowed. NavigationProperties must point to an EntityClass or Mixin.\"),\n\n /** EC-1306: Required message parameters: class name, property name, navigation relationship.fullName */\n NavigationClassMustBeAConstraintClassOfRelationship: createPropertyDiagnosticClass<[string, string, string, string]>(getCode(1306),\n \"The class '{0}' of NavigationProperty '{1}' is not supported by the {3} constraint of the referenced relationship '{2}'.\"),\n\n /** EC-1500: Required message parameters: abstract constraint class name, relationship end (source/target), relationship name, base relationship name */\n AbstractConstraintMustNarrowBaseConstraints: createSchemaItemDiagnosticClass<RelationshipClass, [string, string, string, string]>(DiagnosticCodes.AbstractConstraintMustNarrowBaseConstraints,\n \"The abstract constraint class '{0}' on the {1}-Constraint of '{2}' is not supported by the base class constraint in '{3}'.\"),\n\n /** EC-1501: Required message parameters: constraint class name, relationship end (source/target), relationship name, base relationship name */\n DerivedConstraintsMustNarrowBaseConstraints: createSchemaItemDiagnosticClass<RelationshipClass, [string, string, string, string]>(DiagnosticCodes.DerivedConstraintsMustNarrowBaseConstraints,\n \"The constraint class '{0}' on the {1}-Constraint of '{2}' is not supported by the base class constraint in '{3}'.\"),\n\n /** EC-1502: Required message parameters: constraint class name, relationship end (source/target), relationship name, abstract constraint class name */\n ConstraintClassesDeriveFromAbstractConstraint: createSchemaItemDiagnosticClass<RelationshipClass, [string, string, string, string]>(DiagnosticCodes.ConstraintClassesDeriveFromAbstractConstraint,\n \"The constraint class '{0}' on the {1}-Constraint of '{2}' is not derived from the abstract constraint class '{3}'.\"),\n\n /** EC-1600: Required message parameters: relationship end (source/target), relationship name */\n AtLeastOneConstraintClassDefined: createRelationshipConstraintDiagnosticClass<[string, string]>(DiagnosticCodes.AtLeastOneConstraintClassDefined,\n \"The {0}-Constraint of '{1}' does not contain any constraint classes.\"),\n\n /** EC-1601: Required message parameters: relationship end (source/target), relationship name */\n AbstractConstraintMustExistWithMultipleConstraints: createRelationshipConstraintDiagnosticClass<[string, string]>(DiagnosticCodes.AbstractConstraintMustExistWithMultipleConstraints,\n \"The {0}-Constraint of '{1}' has multiple constraint classes which requires an abstract constraint to be defined.\"),\n};\n\n/**\n * All schema validation rules that fall under the category of ECObjects.\n * @beta\n */\nexport const ECRuleSet: IRuleSet = {\n name: ruleSetName,\n\n schemaRules: [\n validateSchemaReferences,\n ],\n classRules: [\n baseClassIsSealed,\n baseClassIsOfDifferentType,\n ],\n propertyRules: [\n incompatibleValueTypePropertyOverride,\n incompatibleTypePropertyOverride,\n incompatibleUnitPropertyOverride,\n validateNavigationProperty,\n ],\n relationshipRules: [\n abstractConstraintMustNarrowBaseConstraints,\n constraintClassesDeriveFromAbstractConstraint,\n derivedConstraintsMustNarrowBaseConstraints,\n ],\n relationshipConstraintRules: [\n atLeastOneConstraintClassDefined,\n abstractConstraintMustExistWithMultipleConstraints,\n ],\n enumerationRules: [\n enumerationTypeUnsupported,\n ],\n entityClassRules: [\n mixinAppliedToClassMustDeriveFromConstraint,\n ],\n customAttributeInstanceRules: [\n validateCustomAttributeInstance,\n ],\n};\n\n/* eslint-enable @typescript-eslint/naming-convention */\n\n/**\n * Validates schema references against multiple EC rules.\n * @param schema The schema to validate.\n * @internal\n */\nexport async function* validateSchemaReferences(schema: Schema): AsyncIterable<SchemaDiagnostic<any[]>> {\n yield* validateSchemaReferencesSync(schema);\n}\n\n/**\n * Validates schema references against multiple EC rules.\n * @param schema The schema to validate.\n * @internal\n */\nexport function* validateSchemaReferencesSync(schema: Schema): Iterable<SchemaDiagnostic<any[]>> {\n const aliases = new Map();\n for (const schemaRef of schema.references) {\n if (schemaRef.customAttributes && schemaRef.customAttributes.has(\"CoreCustomAttributes.SupplementalSchema\"))\n yield new Diagnostics.SupplementalSchemasCannotBeReferenced(schema, [schema.name, schemaRef.name]);\n\n if (schema.schemaKey.matches(schemaRef.schemaKey))\n yield new Diagnostics.ReferenceCyclesNotAllowed(schema, [schema.name, `${schema.name} --> ${schemaRef.name}`]);\n\n if (aliases.has(schemaRef.alias)) {\n const currentRef = aliases.get(schemaRef.alias);\n yield new Diagnostics.SchemaRefAliasMustBeUnique(schema, [schema.name, schemaRef.alias, currentRef.name, schemaRef.name]);\n } else {\n aliases.set(schemaRef.alias, schemaRef);\n }\n }\n\n const graph = SchemaGraph.generateGraphSync(schema);\n const cycles = graph.detectCycles();\n if (cycles) {\n const result = cycles.map((cycle) => `${cycle.schema.schemaKey.name} --> ${cycle.refSchema.schemaKey.name}`).join(\", \");\n yield new Diagnostics.ReferenceCyclesNotAllowed(schema, [schema.name, result]);\n }\n}\n/**\n * EC Rule: Sealed classes cannot be a base class.\n * @internal\n */\nexport async function* baseClassIsSealed(ecClass: AnyClass): AsyncIterable<ClassDiagnostic<any[]>> {\n if (!ecClass.baseClass)\n return;\n\n const baseClass = await ecClass.baseClass;\n // return if rule passed\n if (baseClass.modifier !== ECClassModifier.Sealed)\n return;\n\n yield new Diagnostics.BaseClassIsSealed(ecClass, [ecClass.fullName, baseClass.fullName]);\n}\n\n/**\n * EC Rule: Base and child class must be of the same type (i.e. Entity, Mixin, Relationship, etc.)\n * @internal\n */\nexport async function* baseClassIsOfDifferentType(ecClass: AnyClass): AsyncIterable<ClassDiagnostic<any[]>> {\n if (!ecClass.baseClass)\n return;\n\n const baseClass = await ecClass.baseClass;\n // return if rule passed\n if (baseClass.schemaItemType === ecClass.schemaItemType)\n return;\n\n const itemType = baseClass.schemaItemType;\n yield new Diagnostics.BaseClassIsOfDifferentType(ecClass, [ecClass.fullName, baseClass.fullName, itemType]);\n}\n\n/**\n * EC Rule: When overriding a class primitive property, the child and base property must be of the same type (string, number, etc...).\n * @internal\n*/\nexport async function* incompatibleValueTypePropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\n if (!property.class.baseClass)\n return;\n\n const maybePrimitiveType = getPrimitiveType(property);\n if (!maybePrimitiveType)\n return;\n\n const primitiveType: PrimitiveType = maybePrimitiveType;\n\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\n const baseProperty = await baseClass.getProperty(property.name, true);\n if (!baseProperty)\n return;\n\n // Other rules will catch this if false, but we need to make sure\n // types match for this rule to be valid.\n if (!propertyTypesMatch(property, baseProperty))\n return;\n\n const baseType = getPrimitiveType(baseProperty);\n\n // Return if rule passed\n if (!baseType || primitiveType === baseType)\n return;\n\n return new Diagnostics.IncompatibleValueTypePropertyOverride(property, [property.class.fullName, property.name, baseClass.fullName, primitiveTypeToString(baseType), primitiveTypeToString(primitiveType)]);\n }\n\n for await (const baseClass of property.class.getAllBaseClasses()) {\n const result = await callback(baseClass);\n if (result)\n yield result;\n }\n}\n\n/**\n * EC Rule: When overriding a class property, the child and base property must be of the same property type (primitive, struct, enumeration, etc...).\n * @internal\n */\nexport async function* incompatibleTypePropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\n if (!property.class.baseClass)\n return;\n\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\n const baseProperty = await baseClass.getProperty(property.name, true);\n if (!baseProperty)\n return;\n\n // Return if rule passed\n if (propertyTypesMatch(property, baseProperty))\n return;\n\n return new Diagnostics.IncompatibleTypePropertyOverride(property, [property.class.fullName, property.name, baseClass.fullName, baseProperty.constructor.name, property.constructor.name]);\n }\n\n for await (const baseClass of property.class.getAllBaseClasses()) {\n const result = await callback(baseClass);\n if (result)\n yield result;\n }\n}\n\n/**\n * EC Rule: When overriding a kindOfQuantity property, the child and base property units must be the same.\n * @internal\n */\nexport async function* incompatibleUnitPropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\n if (!property.kindOfQuantity || !property.class.baseClass)\n return;\n\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\n const baseProperty = await baseClass.getProperty(property.name, true);\n if (!baseProperty || !baseProperty.kindOfQuantity)\n return;\n\n // Other rules will catch this if false, but we need to make sure\n // types match for this rule to be valid.\n if (!propertyTypesMatch(property, baseProperty))\n return;\n\n const koq = await property.kindOfQuantity;\n const baseKoq = await baseProperty.kindOfQuantity;\n if (!koq || !baseKoq)\n return;\n\n const unit = await koq.persistenceUnit;\n const baseUnit = await baseKoq.persistenceUnit;\n\n if (!unit || !baseUnit)\n return;\n\n // return if rule passed\n if (unit.key.matches(baseUnit.key))\n return;\n\n return new Diagnostics.IncompatibleUnitPropertyOverride(property, [\n property.class.fullName,\n property.name,\n baseClass.fullName,\n baseKoq.fullName,\n baseUnit.fullName,\n unit.fullName,\n koq.fullName,\n ]);\n }\n\n for await (const baseClass of property.class.getAllBaseClasses()) {\n const result = await callback(baseClass);\n if (result)\n yield result;\n }\n}\n\n/**\n * Validates Navigation Properties. EC Rules: 1303, 1304\n * @internal\n */\nexport async function* validateNavigationProperty(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\n if (!property.isNavigation())\n return;\n\n const navProp = property;\n const relationship = await navProp.relationshipClass;\n\n if (relationship.baseClass)\n yield new Diagnostics.NavigationRelationshipMustBeRoot(property, [property.fullName, relationship.fullName]);\n\n let thisConstraint: RelationshipConstraint;\n let thatConstraint: RelationshipConstraint;\n let navigationClassSide: string;\n if (navProp.direction === StrengthDirection.Forward) {\n thisConstraint = relationship.source;\n thatConstraint = relationship.target;\n navigationClassSide = \"source\";\n } else {\n thisConstraint = relationship.target;\n thatConstraint = relationship.source;\n navigationClassSide = \"target\";\n }\n\n const thatAbstractConstraint = await thatConstraint.abstractConstraint;\n if (thatAbstractConstraint && thatAbstractConstraint.schemaItemType === SchemaItemType.RelationshipClass) {\n yield new Diagnostics.NavigationRelationshipAbstractConstraintEntityOrMixin(property, [property.fullName, relationship.fullName]);\n }\n\n const isClassSupported = async (ecClass: ECClass, propertyName: string, constraintName: string): Promise<boolean> => {\n if (constraintName === ecClass.fullName && undefined !== await ecClass.getProperty(propertyName, true))\n return true;\n\n const inheritedProp = await ecClass.getInheritedProperty(propertyName);\n if (inheritedProp && constraintName === inheritedProp.class.fullName)\n return true;\n\n const baseClass = await ecClass.baseClass;\n if (!baseClass)\n return false;\n\n return isClassSupported(baseClass, propertyName, constraintName);\n };\n\n let classSupported = false;\n if (thisConstraint.constraintClasses) {\n for (const constraintClass of thisConstraint.constraintClasses) {\n classSupported = await isClassSupported(property.class, property.name, constraintClass.fullName);\n if (classSupported)\n break;\n }\n }\n\n if (!classSupported)\n yield new Diagnostics.NavigationClassMustBeAConstraintClassOfRelationship(property, [property.class.name, property.name, relationship.fullName, navigationClassSide]);\n\n if (thatConstraint.multiplicity === RelationshipMultiplicity.oneMany || thatConstraint.multiplicity === RelationshipMultiplicity.zeroMany) {\n const direction = strengthDirectionToString(navProp.direction);\n yield new Diagnostics.NavigationTargetMustHaveSingularMultiplicity(property, [property.fullName, relationship.fullName, direction]);\n }\n\n return;\n}\n\n/**\n * Validates a Relationship class and yields EC-1500, EC-1501, and EC-1502 rule violations.\n * @internal\n */\nexport async function* validateRelationship(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\n yield* abstractConstraintMustNarrowBaseConstraints(ecClass);\n yield* derivedConstraintsMustNarrowBaseConstraints(ecClass);\n yield* constraintClassesDeriveFromAbstractConstraint(ecClass);\n}\n\n/**\n * EC Rule: When overriding a RelationshipClass, the derived abstract constraint must narrow the base constraint classes.\n * @internal\n */\nexport async function* abstractConstraintMustNarrowBaseConstraints(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\n if (!ecClass.baseClass)\n return;\n\n const baseRelationship = await ecClass.baseClass as RelationshipClass;\n\n const sourceResult = await applyAbstractConstraintMustNarrowBaseConstraints(ecClass, ecClass.source, baseRelationship);\n if (sourceResult)\n yield sourceResult;\n const targetResult = await applyAbstractConstraintMustNarrowBaseConstraints(ecClass, ecClass.target, baseRelationship);\n if (targetResult)\n yield targetResult;\n}\n\n/**\n * EC Rule: When overriding a RelationshipClass, derived constraint classes must narrow base constraint classes.\n * @internal\n */\nexport async function* derivedConstraintsMustNarrowBaseConstraints(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\n if (!ecClass.baseClass)\n return;\n\n const baseRelationship = await ecClass.baseClass as RelationshipClass;\n\n const sourceResult = await applyDerivedConstraintsMustNarrowBaseConstraints(ecClass, ecClass.source, baseRelationship);\n if (sourceResult)\n yield sourceResult;\n const targetResult = await applyDerivedConstraintsMustNarrowBaseConstraints(ecClass, ecClass.target, baseRelationship);\n if (targetResult)\n yield targetResult;\n}\n\n/**\n * EC Rule: All constraint classes must have a common base class specified in the abstract constraint.\n * @internal\n */\nexport async function* constraintClassesDeriveFromAbstractConstraint(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\n const sourceResult = await applyConstraintClassesDeriveFromAbstractConstraint(ecClass, ecClass.source);\n if (sourceResult)\n yield sourceResult;\n const targetResult = await applyConstraintClassesDeriveFromAbstractConstraint(ecClass, ecClass.target);\n if (targetResult)\n yield targetResult;\n}\n\n/**\n * Validates a RelationshipConstraint and yields EC-1600 and EC-1601 rule violations.\n * @internal\n */\nexport async function* validateRelationshipConstraint(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\n yield* atLeastOneConstraintClassDefined(constraint);\n yield* abstractConstraintMustExistWithMultipleConstraints(constraint);\n}\n\n/**\n * EC Rule: At least on concrete constraint class must be defined in the list of constraint classes.\n * @internal\n */\nexport async function* atLeastOneConstraintClassDefined(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\n if (!constraint.constraintClasses || constraint.constraintClasses.length === 0) {\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n yield new Diagnostics.AtLeastOneConstraintClassDefined(constraint, [constraintType, constraint.relationshipClass.fullName]);\n }\n}\n\n/**\n * EC Rule: If multiple constraints exist, an abstract constraint must be defined.\n * @internal\n */\nexport async function* abstractConstraintMustExistWithMultipleConstraints(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\n if (!constraint.constraintClasses || constraint.constraintClasses.length <= 1) {\n return;\n }\n\n const abstractConstraint = await getAbstractConstraint(constraint);\n if (abstractConstraint)\n return;\n\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n yield new Diagnostics.AbstractConstraintMustExistWithMultipleConstraints(constraint, [constraintType, constraint.relationshipClass.fullName]);\n}\n\nfunction propertyTypesMatch(propertyA: Property, propertyB: Property) {\n return propertyA.constructor.name === propertyB.constructor.name;\n}\n\nfunction getPrimitiveType(property: Property): PrimitiveType | undefined {\n if (property.isPrimitive())\n return (property).primitiveType;\n\n return undefined;\n}\n\n/**\n * EC Rule: Enumeration type must be a string or integer\n * @internal\n */\nexport async function* enumerationTypeUnsupported(enumeration: Enumeration): AsyncIterable<SchemaItemDiagnostic<Enumeration, any[]>> {\n const type = enumeration.type;\n if (type === PrimitiveType.Integer || type === PrimitiveType.String)\n return;\n\n yield new Diagnostics.EnumerationTypeUnsupported(enumeration, [enumeration.fullName]);\n}\n\n/**\n * EC Rule: Mixin applied to class must derived from the Mixin appliesTo constraint.\n * @internal\n */\nexport async function* mixinAppliedToClassMustDeriveFromConstraint(entityClass: EntityClass): AsyncIterable<SchemaItemDiagnostic<EntityClass, any[]>> {\n for (const lazyMixin of entityClass.mixins) {\n const mixin = await lazyMixin;\n if (!mixin.appliesTo)\n continue;\n\n if (!await entityClass.is(await mixin.appliesTo))\n yield new Diagnostics.MixinAppliedToClassMustDeriveFromConstraint(entityClass, [mixin.fullName, entityClass.fullName, mixin.appliesTo.fullName]);\n }\n\n return;\n}\n\n/**\n * Validates a custom attribute instance and yields EC-500, EC-501, and EC-502 rule violations.\n * @internal\n */\nexport async function* validateCustomAttributeInstance(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\n yield* customAttributeNotOfConcreteClass(container, customAttribute);\n yield* customAttributeSchemaMustBeReferenced(container, customAttribute);\n yield* customAttributeClassMustExist(container, customAttribute);\n}\n\n/** EC Rule: CustomAttribute instance must be of a concrete CustomAttributeClass. */\nasync function* customAttributeNotOfConcreteClass(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\n const schema = container.schema;\n const caClass = await schema.lookupItem(customAttribute.className) as ECClass;\n if (!caClass)\n return;\n\n if (caClass.modifier !== ECClassModifier.Abstract)\n return;\n\n yield new Diagnostics.CustomAttributeNotOfConcreteClass(container, [container.fullName, caClass.fullName]);\n}\n\n/** EC Rule: CustomAttribute Schema must be referenced by the container's Schema. */\nasync function* customAttributeSchemaMustBeReferenced(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\n const schema = container.schema;\n const nameParts = customAttribute.className.split(\".\");\n if (nameParts.length === 1 || nameParts[0] === schema.name)\n return;\n\n if (schema.references.some((s) => s.name === nameParts[0]))\n return;\n\n yield new Diagnostics.CustomAttributeSchemaMustBeReferenced(container, [container.fullName, customAttribute.className]);\n}\n\n/** EC Rule: CustomAttribute instance class must exist. */\nasync function* customAttributeClassMustExist(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\n const schema = container.schema;\n const caClass = await schema.lookupItem(customAttribute.className) as ECClass;\n if (!caClass)\n yield new Diagnostics.CustomAttributeClassNotFound(container, [container.fullName, customAttribute.className]);\n}\n\nasync function applyAbstractConstraintMustNarrowBaseConstraints(ecClass: RelationshipClass, constraint: RelationshipConstraint, baseRelationship: RelationshipClass): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\n const abstractConstraint = await constraint.abstractConstraint;\n if (!abstractConstraint)\n return;\n\n if (await baseConstraint.supportsClass(abstractConstraint))\n return;\n\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n return new Diagnostics.AbstractConstraintMustNarrowBaseConstraints(ecClass, [abstractConstraint.fullName, constraintType, constraint.relationshipClass.fullName, baseRelationship.fullName]);\n}\n\nasync function applyDerivedConstraintsMustNarrowBaseConstraints(ecClass: RelationshipClass, constraint: RelationshipConstraint, baseRelationship: RelationshipClass): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\n\n if (!constraint.constraintClasses)\n return;\n\n for (const classPromise of constraint.constraintClasses) {\n const constraintClass = await classPromise;\n\n if (await baseConstraint.supportsClass(constraintClass))\n continue;\n\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n return new Diagnostics.DerivedConstraintsMustNarrowBaseConstraints(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, baseRelationship.fullName]);\n }\n\n return;\n}\n\nasync function applyConstraintClassesDeriveFromAbstractConstraint(ecClass: RelationshipClass, constraint: RelationshipConstraint): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\n const abstractConstraint = await getAbstractConstraint(constraint);\n if (!abstractConstraint)\n return;\n\n if (!constraint.constraintClasses)\n return;\n\n for (const classPromise of constraint.constraintClasses) {\n const constraintClass = await classPromise;\n\n if (Mixin.isMixin(constraintClass) && EntityClass.isEntityClass(abstractConstraint)) {\n if (!await (constraintClass).applicableTo(abstractConstraint)) {\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n return new Diagnostics.ConstraintClassesDeriveFromAbstractConstraint(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, abstractConstraint.fullName]);\n }\n continue;\n }\n\n if (!await constraintClass.is(abstractConstraint)) {\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n return new Diagnostics.ConstraintClassesDeriveFromAbstractConstraint(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, abstractConstraint.fullName]);\n }\n }\n\n return;\n}\n\nasync function getAbstractConstraint(constraint: RelationshipConstraint): Promise<ECClass | undefined> {\n const abstractConstraint = await constraint.abstractConstraint;\n if (abstractConstraint)\n return abstractConstraint;\n\n const baseRelationship = await constraint.relationshipClass.baseClass as RelationshipClass;\n if (!baseRelationship)\n return;\n\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\n\n return getAbstractConstraint(baseConstraint);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/ecschema-editing",
|
|
3
|
-
"version": "5.9.0-dev.
|
|
3
|
+
"version": "5.9.0-dev.17",
|
|
4
4
|
"description": "ECSchema editing and validation API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/cjs/ecschema-editing.js",
|
|
@@ -42,16 +42,16 @@
|
|
|
42
42
|
"rimraf": "^6.0.1",
|
|
43
43
|
"sinon": "^17.0.2",
|
|
44
44
|
"typescript": "~5.6.2",
|
|
45
|
-
"@itwin/build-tools": "5.9.0-dev.
|
|
46
|
-
"@itwin/core-
|
|
47
|
-
"@itwin/core-
|
|
48
|
-
"@itwin/core-
|
|
49
|
-
"@itwin/ecschema-metadata": "5.9.0-dev.
|
|
45
|
+
"@itwin/build-tools": "5.9.0-dev.17",
|
|
46
|
+
"@itwin/core-bentley": "5.9.0-dev.17",
|
|
47
|
+
"@itwin/core-common": "5.9.0-dev.17",
|
|
48
|
+
"@itwin/core-quantity": "5.9.0-dev.17",
|
|
49
|
+
"@itwin/ecschema-metadata": "5.9.0-dev.17"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@itwin/core-bentley": "5.9.0-dev.
|
|
53
|
-
"@itwin/core-quantity": "5.9.0-dev.
|
|
54
|
-
"@itwin/ecschema-metadata": "5.9.0-dev.
|
|
52
|
+
"@itwin/core-bentley": "5.9.0-dev.17",
|
|
53
|
+
"@itwin/core-quantity": "5.9.0-dev.17",
|
|
54
|
+
"@itwin/ecschema-metadata": "5.9.0-dev.17"
|
|
55
55
|
},
|
|
56
56
|
"nyc": {
|
|
57
57
|
"extends": "./node_modules/@itwin/build-tools/.nycrc"
|