@itwin/ecschema-editing 5.9.0-dev.15 → 5.9.0-dev.16
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":"ECRules.js","sourceRoot":"","sources":["../../../src/Validation/ECRules.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAsOH,4DAEC;AAOD,oEAuBC;AAKD,8CAUC;AAMD,gEAWC;AAMD,sFAkCC;AAMD,4EAqBC;AAMD,4EA6CC;AAMD,gEA6DC;AAMD,oDAIC;AAMD,kGAYC;AAMD,kGAYC;AAMD,sGAOC;AAMD,wEAGC;AAMD,4EAKC;AAMD,gHAWC;AAiBD,gEAMC;AAMD,kGAWC;AAMD,0EAIC;AA/mBD,gEAKkC;AAClC,6CAKsB;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;AAC5C,QAAA,eAA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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;;;AAsOH,4DAEC;AAOD,oEAuBC;AAKD,8CAUC;AAMD,gEAWC;AAMD,sFAkCC;AAMD,4EAqBC;AAMD,4EA6CC;AAMD,gEA6DC;AAMD,oDAIC;AAMD,kGAYC;AAMD,kGAYC;AAMD,sGAOC;AAMD,wEAGC;AAMD,4EAKC;AAMD,gHAWC;AAiBD,gEAMC;AAMD,kGAWC;AAMD,0EAIC;AA/mBD,gEAKkC;AAClC,6CAKsB;AAGtB,MAAM,WAAW,GAAG,WAAW,CAAC;AAEhC,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,GAAG,WAAW,IAAI,IAAI,EAAE,CAAC;AAClC,CA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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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaDiagnosticVisitor.d.ts","sourceRoot":"","sources":["../../../src/Differencing/SchemaDiagnosticVisitor.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAO9D,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAEhC,KAAK,yBAAyB,EAE9B,KAAK,0BAA0B,EAE/B,KAAK,oBAAoB,EACzB,KAAK,0CAA0C,EAG/C,KAAK,gBAAgB,EAErB,KAAK,yBAAyB,EAC/B,MAAM,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,qBAAa,uBAAuB;IAElC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AAO,CAAC,4BAA4B;IAiCpC,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,sBAAsB;IAmC9B,OAAO,CAAC,sBAAsB;IAY9B,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,sBAAsB;IA2B9B,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,oBAAoB;IA4B5B,OAAO,CAAC,qBAAqB;IAqB7B,OAAO,CAAC,wBAAwB;IAoBhC,OAAO,CAAC,uCAAuC;IAwB/C,OAAO,CAAC,kCAAkC;IAsC1C,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,mCAAmC;IA8C3C,OAAO,CAAC,4BAA4B;IAqBpC,OAAO,CAAC,sBAAsB;IAkC9B,OAAO,CAAC,2BAA2B;CAmBpC"}
|
|
@@ -134,6 +134,7 @@ export class SchemaDiagnosticVisitor {
|
|
|
134
134
|
return entry.changeType === "modify" && entry.itemName === schemaItem.name;
|
|
135
135
|
});
|
|
136
136
|
if (modifyEntry === undefined) {
|
|
137
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
137
138
|
modifyEntry = {
|
|
138
139
|
changeType: "modify",
|
|
139
140
|
schemaType: schemaItem.schemaItemType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaDiagnosticVisitor.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDiagnosticVisitor.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAEqE,QAAQ,EAClF,sBAAsB,EAA+B,MAAM,EAAE,UAAU,GACxE,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAcL,gBAAgB,GAEjB,MAAM,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,OAAO,uBAAuB;IAElB,iBAAiB,CAAsD;IACvE,qBAAqB,CAGX;IACV,yBAAyB,CAAqC;IAC9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AAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAEO,2BAA2B,CAAC,UAAyB;QAC3D,MAAM,MAAM,GAAG,UAAU,CAAC,YAAsB,CAAC;QAEjD,IAAI,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAiC,EAAE;YAAG,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ;mBAC7G,KAAK,CAAC,UAAU,KAAK,gBAAgB,CAAC,UAAU,IAAI,KAAK,CAAC,QAAQ,KAAK,MAAM,CAAC,IAAI,CAAA;QAAA,CAAC,CAAC,EAAE,CAAC;YAC5F,OAAO;QACT,CAAC;QAED,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,UAAU,CAAC,WAAwD,CAAC;QAC1F,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC;YAClC,UAAU,EAAE,QAAQ;YACpB,UAAU,EAAE,gBAAgB,CAAC,eAAe;YAC5C,QAAQ,EAAE,MAAM,CAAC,IAAI;YACrB,IAAI,EAAE,IAAI,CAAC,QAAQ;YACnB,UAAU,EAAE;gBACV,KAAK;aACN;SACF,CAAC,CAAC;IACL,CAAC;IAAA,CAAC;CACH;AAAA,CAAC;AAEF,SAAS,kBAAkB,CAAC,QAAkB,EAAE,YAAoB;IAClE,OAAO,CAAC,YAAY,KAAK,MAAM,CAAC;QAC9B,CAAC,QAAQ,CAAC,aAAa,EAAE,IAAI,YAAY,KAAK,aAAa,CAAC;QAC5D,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,YAAY,KAAK,eAAe,CAAC;QAC5D,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,YAAY,KAAK,aAAa,CAAC;QACvD,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,YAAY,KAAK,mBAAmB,CAAC,CAAC;AACtE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Differencing\n */\n\nimport type { AnyDiagnostic } from \"../Validation/Diagnostic\";\nimport { SchemaCompareCodes } from \"../Validation/SchemaCompareDiagnostics\";\nimport {\n AnyEnumerator, AnyPropertyProps, AnySchemaItem, CustomAttribute, ECClass,\n Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, OverrideFormat, Property, PropertyProps,\n RelationshipConstraint, RelationshipConstraintProps, Schema, SchemaItem, Unit,\n} from \"@itwin/ecschema-metadata\";\nimport {\n type AnyClassItemDifference,\n type AnySchemaItemDifference,\n type AnySchemaItemPathDifference,\n type ClassPropertyDifference,\n type CustomAttributeDifference,\n type DifferenceType,\n type EntityClassMixinDifference,\n type EnumeratorDifference,\n type FormatUnitDifference,\n type KindOfQuantityPresentationFormatDifference,\n type RelationshipConstraintClassDifference,\n type RelationshipConstraintDifference,\n type SchemaDifference,\n SchemaOtherTypes,\n type SchemaReferenceDifference,\n} from \"./SchemaDifference\";\n\n/**\n * The SchemaDiagnosticVisitor is a visitor implementation for diagnostic entries\n * from the schema comparer api. Depending on the diagnostic code, the difference\n * result is build together.\n * @internal\n */\nexport class SchemaDiagnosticVisitor {\n\n public readonly schemaDifferences: Array<SchemaDifference | SchemaReferenceDifference>;\n public readonly schemaItemDifferences: Array<AnySchemaItemDifference\n | EntityClassMixinDifference\n | KindOfQuantityPresentationFormatDifference\n | FormatUnitDifference>;\n public readonly schemaItemPathDifferences: Array<AnySchemaItemPathDifference>;\n public readonly customAttributeDifferences: Array<CustomAttributeDifference>;\n\n constructor() {\n this.schemaDifferences = [];\n this.schemaItemDifferences = [];\n this.schemaItemPathDifferences = [];\n this.customAttributeDifferences = [];\n }\n\n /**\n * Visitor function to process the schema change diagnostic object.\n * @internal\n */\n public visit(diagnostic: AnyDiagnostic) {\n switch (diagnostic.code) {\n case SchemaCompareCodes.SchemaDelta:\n return this.visitChangedSchemaProperties(diagnostic);\n\n case SchemaCompareCodes.SchemaReferenceMissing:\n return this.visitSchemaReference(diagnostic, \"add\");\n case SchemaCompareCodes.SchemaReferenceDelta:\n return this.visitSchemaReference(diagnostic, \"modify\");\n\n case SchemaCompareCodes.SchemaItemMissing:\n return this.visitMissingSchemaItem(diagnostic);\n\n case SchemaCompareCodes.SchemaItemDelta:\n case SchemaCompareCodes.ClassDelta:\n case SchemaCompareCodes.ConstantDelta:\n case SchemaCompareCodes.CustomAttributeClassDelta:\n case SchemaCompareCodes.FormatDelta:\n case SchemaCompareCodes.InvertedUnitDelta:\n case SchemaCompareCodes.KoqDelta:\n case SchemaCompareCodes.MixinDelta:\n case SchemaCompareCodes.PhenomenonDelta:\n case SchemaCompareCodes.PropertyCategoryDelta:\n case SchemaCompareCodes.RelationshipDelta:\n case SchemaCompareCodes.UnitDelta:\n case SchemaCompareCodes.EnumerationDelta:\n return this.visitChangedSchemaItem(diagnostic);\n\n case SchemaCompareCodes.EnumeratorDelta:\n return this.visitChangedEnumerator(diagnostic);\n case SchemaCompareCodes.EnumeratorMissing:\n return this.visitMissingEnumerator(diagnostic);\n\n case SchemaCompareCodes.BaseClassDelta:\n return this.visitMissingBaseClass(diagnostic);\n case SchemaCompareCodes.EntityMixinMissing:\n return this.visitMissingMixinOnClass(diagnostic);\n case SchemaCompareCodes.PropertyDelta:\n return this.visitChangedProperty(diagnostic);\n case SchemaCompareCodes.PropertyMissing:\n return this.visitMissingProperty(diagnostic);\n\n case SchemaCompareCodes.RelationshipConstraintClassMissing:\n return this.visitMissingRelationshipConstraintClass(diagnostic);\n case SchemaCompareCodes.RelationshipConstraintDelta:\n return this.visitChangedRelationshipConstraint(diagnostic);\n\n case SchemaCompareCodes.CustomAttributeInstanceClassMissing:\n return this.visitMissingCustomAttributeInstance(diagnostic);\n\n case SchemaCompareCodes.PresentationUnitMissing:\n return this.visitMissingPresentationUnit(diagnostic);\n\n case SchemaCompareCodes.FormatUnitMissing:\n return this.visitMissingFormatUnit(diagnostic);\n case SchemaCompareCodes.UnitLabelOverrideDelta:\n return this.visitChangedFormatUnitLabel(diagnostic);\n }\n return;\n }\n\n private visitChangedSchemaProperties(diagnostic: AnyDiagnostic) {\n let modifyEntry = this.schemaDifferences.find((entry): entry is SchemaDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Schema;\n });\n\n let hasChanges = false;\n let addEntry = false;\n if (modifyEntry === undefined) {\n addEntry = true;\n modifyEntry = {\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.Schema,\n difference: {},\n };\n }\n\n // Only label and description are taken from the source schema. If the schema name or alias\n // differs, those are ignored for now.\n const [propertyName, propertyValue] = diagnostic.messageArgs as [string, any];\n if (propertyName === \"label\") {\n modifyEntry.difference.label = propertyValue;\n hasChanges = true;\n }\n if (propertyName === \"description\") {\n modifyEntry.difference.description = propertyValue;\n hasChanges = true;\n }\n\n if (addEntry && hasChanges) {\n this.schemaDifferences.push(modifyEntry);\n }\n }\n\n private visitMissingSchemaItem(diagnostic: AnyDiagnostic) {\n const schemaItem = diagnostic.ecDefinition as AnySchemaItem;\n\n this.schemaItemDifferences.push({\n changeType: \"add\",\n schemaType: schemaItem.schemaItemType,\n itemName: schemaItem.name,\n difference: schemaItem.toJSON(),\n });\n }\n\n private visitChangedSchemaItem(diagnostic: AnyDiagnostic) {\n const schemaItem = diagnostic.ecDefinition as AnySchemaItem;\n const [propertyName, sourceValue, _targetValue] = diagnostic.messageArgs as [string, unknown, unknown];\n if (propertyName === \"schemaItemType\") {\n // If the schema item type is different, the whole item is added as \"new\" item. The\n // difference validator will then figure whether there is a conflict with items of\n // of the same name.\n return this.visitMissingSchemaItem(diagnostic);\n }\n\n if (sourceValue === undefined) {\n return;\n }\n\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is AnySchemaItemDifference => {\n return entry.changeType === \"modify\" && entry.itemName === schemaItem.name;\n });\n\n if (modifyEntry === undefined) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: schemaItem.schemaItemType,\n itemName: schemaItem.name,\n difference: {},\n } as AnySchemaItemDifference;\n this.schemaItemDifferences.push(modifyEntry);\n }\n\n // TODO: Since propertyName is type of string, the compiler complains about accepting\n // an unspecific string as property indexer. Casted to any as short term fix but that\n // needs to be handled better in future.\n (modifyEntry.difference as any)[propertyName] = sourceValue;\n }\n\n private visitMissingEnumerator(diagnostic: AnyDiagnostic) {\n const enumeration = diagnostic.ecDefinition as Enumeration;\n const [enumerator] = diagnostic.messageArgs as [AnyEnumerator];\n this.schemaItemPathDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.Enumerator,\n itemName: enumeration.name,\n path: \"$enumerators\",\n difference: enumerator,\n });\n }\n\n private lookupEnumeratorEntry(changeType: DifferenceType, item: string, enumeratorName: string) {\n return this.schemaItemPathDifferences.find((change) => {\n return change.changeType === changeType\n && change.schemaType === SchemaOtherTypes.Enumerator\n && change.itemName === item\n && change.path === \"$enumerators\"\n && change.difference.name === enumeratorName;\n });\n }\n\n private visitChangedEnumerator(diagnostic: AnyDiagnostic) {\n const enumeration = diagnostic.ecDefinition as Enumeration;\n const [enumerator, propertyName, sourceValue] = diagnostic.messageArgs as [AnyEnumerator, keyof AnyEnumerator, any];\n if (this.lookupEnumeratorEntry(\"add\", enumeration.name, enumerator.name)) {\n return;\n }\n\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is EnumeratorDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Enumerator && entry.itemName === enumeration.name && entry.path === enumerator.name;\n });\n\n if (modifyEntry === undefined) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.Enumerator,\n itemName: enumeration.name,\n path: enumerator.name,\n difference: {},\n };\n this.schemaItemPathDifferences.push(modifyEntry);\n }\n\n if (sourceValue !== undefined) {\n modifyEntry.difference[propertyName] = sourceValue;\n }\n }\n\n private visitMissingProperty(diagnostic: AnyDiagnostic) {\n const property = diagnostic.ecDefinition as Property;\n this.schemaItemPathDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.Property,\n itemName: property.class.name,\n path: property.name,\n difference: property.toJSON() as AnyPropertyProps,\n });\n }\n\n private visitChangedProperty(diagnostic: AnyDiagnostic) {\n const property = diagnostic.ecDefinition as Property;\n const [propertyName, sourceValue] = diagnostic.messageArgs as [keyof PropertyProps, any, any];\n\n if (isPropertyTypeName(property, propertyName)) {\n return this.visitMissingProperty(diagnostic);\n }\n\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is ClassPropertyDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Property && entry.itemName === property.class.name && entry.path === property.name;\n });\n\n if (modifyEntry === undefined) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.Property,\n itemName: property.class.name,\n path: property.name,\n difference: {},\n };\n this.schemaItemPathDifferences.push(modifyEntry);\n }\n\n if (propertyName !== \"name\") {\n modifyEntry.difference[propertyName] = sourceValue;\n }\n }\n\n private visitMissingBaseClass(diagnostic: AnyDiagnostic) {\n const ecClass = diagnostic.ecDefinition as ECClass;\n const [sourceBaseClass] = diagnostic.messageArgs as [ECClass, ECClass];\n\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is AnyClassItemDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === ecClass.schemaItemType && entry.itemName === ecClass.name;\n });\n\n if (modifyEntry === undefined) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: ecClass.schemaItemType,\n itemName: ecClass.name,\n difference: {},\n } as AnyClassItemDifference;\n this.schemaItemDifferences.push(modifyEntry);\n }\n\n modifyEntry.difference.baseClass = sourceBaseClass !== undefined ? sourceBaseClass.fullName : undefined;\n }\n\n private visitMissingMixinOnClass(diagnostic: AnyDiagnostic) {\n const ecClass = diagnostic.ecDefinition as ECClass;\n const [mixin] = diagnostic.messageArgs as [Mixin];\n\n let addEntry = this.schemaItemDifferences.find((entry): entry is EntityClassMixinDifference => {\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.EntityClassMixin && entry.itemName === ecClass.name;\n });\n\n if (addEntry === undefined) {\n addEntry = {\n changeType: \"add\",\n schemaType: SchemaOtherTypes.EntityClassMixin,\n itemName: ecClass.name,\n difference: [],\n };\n this.schemaItemDifferences.push(addEntry);\n }\n addEntry.difference.push(mixin.fullName);\n }\n\n private visitMissingRelationshipConstraintClass(diagnostic: AnyDiagnostic) {\n const constraint = diagnostic.ecDefinition as RelationshipConstraint;\n const className = constraint.relationshipClass.name;\n const constraintPath = constraint.isSource ? \"$source\" : \"$target\";\n\n let addEntry = this.schemaItemPathDifferences.find((entry): entry is RelationshipConstraintClassDifference => {\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.RelationshipConstraintClass, entry.itemName === className && entry.path === constraintPath;\n });\n\n if (!addEntry) {\n addEntry = {\n changeType: \"add\",\n schemaType: SchemaOtherTypes.RelationshipConstraintClass,\n itemName: className,\n path: constraintPath,\n difference: [],\n };\n this.schemaItemPathDifferences.push(addEntry);\n }\n\n const [constraintClass] = diagnostic.messageArgs as [ECClass];\n addEntry.difference.push(constraintClass.fullName);\n }\n\n private visitChangedRelationshipConstraint(diagnostic: AnyDiagnostic) {\n const constraint = diagnostic.ecDefinition as RelationshipConstraint;\n const className = constraint.relationshipClass.name;\n const constraintPath = constraint.isSource ? \"$source\" : \"$target\";\n if (this.schemaItemDifferences.find((entry) => entry.changeType === \"add\" && entry.itemName === className)) {\n return;\n }\n\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is RelationshipConstraintDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.RelationshipConstraint && entry.itemName === className && entry.path === constraintPath;\n });\n\n if (modifyEntry === undefined) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.RelationshipConstraint,\n itemName: className,\n path: constraintPath,\n difference: {},\n };\n this.schemaItemPathDifferences.push(modifyEntry);\n }\n\n const [propertyName, propertyValue] = diagnostic.messageArgs as [keyof RelationshipConstraintProps, any];\n if (propertyName === \"abstractConstraint\" && propertyValue !== undefined) {\n modifyEntry.difference.abstractConstraint = propertyValue;\n }\n if (propertyName === \"multiplicity\" && propertyValue !== undefined) {\n modifyEntry.difference.multiplicity = propertyValue;\n }\n if (propertyName === \"polymorphic\" && propertyValue !== undefined) {\n modifyEntry.difference.polymorphic = propertyValue;\n }\n if (propertyName === \"roleLabel\" && propertyValue !== undefined) {\n modifyEntry.difference.roleLabel = propertyValue;\n }\n }\n\n private visitSchemaReference(diagnostic: AnyDiagnostic, changeType: DifferenceType) {\n const [referencedSchema] = diagnostic.messageArgs as [Schema];\n this.schemaDifferences.push({\n changeType,\n schemaType: SchemaOtherTypes.SchemaReference,\n difference: {\n name: referencedSchema.name,\n version: referencedSchema.schemaKey.version.toString(),\n },\n });\n }\n\n private visitMissingCustomAttributeInstance(diagnostic: AnyDiagnostic) {\n const [customAttribute] = diagnostic.messageArgs as [CustomAttribute];\n const ecType = diagnostic.ecDefinition;\n if (Schema.isSchema(ecType)) {\n return this.customAttributeDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\n appliedTo: \"Schema\",\n difference: customAttribute,\n });\n }\n\n if (SchemaItem.isSchemaItem(ecType)) {\n return this.customAttributeDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\n appliedTo: \"SchemaItem\",\n itemName: ecType.name,\n difference: customAttribute,\n });\n }\n\n if (Property.isProperty(ecType)) {\n return this.customAttributeDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\n appliedTo: \"Property\",\n itemName: ecType.class.name,\n path: ecType.name,\n difference: customAttribute,\n });\n }\n\n if (RelationshipConstraint.isRelationshipConstraint(ecType)) {\n return this.customAttributeDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\n appliedTo: \"RelationshipConstraint\",\n itemName: ecType.relationshipClass.name,\n path: ecType.isSource ? \"$source\" : \"$target\",\n difference: customAttribute,\n });\n }\n return;\n }\n\n private visitMissingPresentationUnit(diagnostic: AnyDiagnostic) {\n const koq = diagnostic.ecDefinition as KindOfQuantity;\n const [presentationFormat] = diagnostic.messageArgs as [Format | OverrideFormat];\n\n let addEntry = this.schemaItemDifferences.find((entry): entry is KindOfQuantityPresentationFormatDifference => {\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.KindOfQuantityPresentationFormat\n && entry.itemName === koq.name;\n });\n\n if (addEntry === undefined) {\n addEntry = {\n changeType: \"add\",\n schemaType: SchemaOtherTypes.KindOfQuantityPresentationFormat,\n itemName: koq.name,\n difference: [],\n };\n this.schemaItemDifferences.push(addEntry);\n }\n addEntry.difference.push(presentationFormat.fullName);\n }\n\n private visitMissingFormatUnit(diagnostic: AnyDiagnostic) {\n const format = diagnostic.ecDefinition as Format;\n\n for (let index = this.schemaItemPathDifferences.length-1; index>=0; index--) {\n const entry = this.schemaItemPathDifferences[index];\n if (entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.FormatUnitLabel && entry.itemName === format.name) {\n this.schemaItemPathDifferences.splice(index, 1);\n }\n }\n\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is FormatUnitDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.FormatUnit\n && entry.itemName === format.name;\n });\n\n if (modifyEntry === undefined && format.units) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.FormatUnit,\n itemName: format.name,\n difference: [],\n };\n\n for (const [unit, label] of format.units) {\n modifyEntry.difference.push({\n name: unit.fullName,\n label,\n });\n };\n\n this.schemaItemDifferences.push(modifyEntry);\n }\n }\n\n private visitChangedFormatUnitLabel(diagnostic: AnyDiagnostic) {\n const format = diagnostic.ecDefinition as Format;\n\n if (this.schemaItemDifferences.find((entry): entry is FormatUnitDifference => { return entry.changeType === \"modify\"\n && entry.schemaType === SchemaOtherTypes.FormatUnit && entry.itemName === format.name})) {\n return;\n }\n\n const [unit, label] = diagnostic.messageArgs as [Unit | InvertedUnit, string | undefined];\n this.schemaItemPathDifferences.push({\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.FormatUnitLabel,\n itemName: format.name,\n path: unit.fullName,\n difference: {\n label,\n },\n });\n };\n};\n\nfunction isPropertyTypeName(property: Property, propertyName: string) {\n return (propertyName === \"type\") ||\n (property.isEnumeration() && propertyName === \"enumeration\") ||\n (property.isPrimitive() && propertyName === \"primitiveType\") ||\n (property.isStruct() && propertyName === \"structClass\") ||\n (property.isNavigation() && propertyName === \"relationshipClass\");\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaDiagnosticVisitor.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDiagnosticVisitor.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAEqE,QAAQ,EAClF,sBAAsB,EAA+B,MAAM,EAAE,UAAU,GACxE,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAcL,gBAAgB,GAEjB,MAAM,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,OAAO,uBAAuB;IAElB,iBAAiB,CAAsD;IACvE,qBAAqB,CAGX;IACV,yBAAyB,CAAqC;IAC9D,0BAA0B,CAAmC;IAE7E;QACE,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,yBAAyB,GAAG,EAAE,CAAC;QACpC,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC;IACvC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,UAAyB;QACpC,QAAQ,UAAU,CAAC,IAAI,EAAE,CAAC;YACxB,KAAK,kBAAkB,CAAC,WAAW;gBACjC,OAAO,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,CAAC;YAEvD,KAAK,kBAAkB,CAAC,sBAAsB;gBAC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,IAAI,EAAE,KAAK,CAAC,GAAG,UAAU,CAAC,WAAwD,CAAC;QAC1F,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC;YAClC,UAAU,EAAE,QAAQ;YACpB,UAAU,EAAE,gBAAgB,CAAC,eAAe;YAC5C,QAAQ,EAAE,MAAM,CAAC,IAAI;YACrB,IAAI,EAAE,IAAI,CAAC,QAAQ;YACnB,UAAU,EAAE;gBACV,KAAK;aACN;SACF,CAAC,CAAC;IACL,CAAC;IAAA,CAAC;CACH;AAAA,CAAC;AAEF,SAAS,kBAAkB,CAAC,QAAkB,EAAE,YAAoB;IAClE,OAAO,CAAC,YAAY,KAAK,MAAM,CAAC;QAC9B,CAAC,QAAQ,CAAC,aAAa,EAAE,IAAI,YAAY,KAAK,aAAa,CAAC;QAC5D,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,YAAY,KAAK,eAAe,CAAC;QAC5D,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,YAAY,KAAK,aAAa,CAAC;QACvD,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,YAAY,KAAK,mBAAmB,CAAC,CAAC;AACtE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Differencing\n */\n\nimport type { AnyDiagnostic } from \"../Validation/Diagnostic\";\nimport { SchemaCompareCodes } from \"../Validation/SchemaCompareDiagnostics\";\nimport {\n AnyEnumerator, AnyPropertyProps, AnySchemaItem, CustomAttribute, ECClass,\n Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, OverrideFormat, Property, PropertyProps,\n RelationshipConstraint, RelationshipConstraintProps, Schema, SchemaItem, Unit,\n} from \"@itwin/ecschema-metadata\";\nimport {\n type AnyClassItemDifference,\n type AnySchemaItemDifference,\n type AnySchemaItemPathDifference,\n type ClassPropertyDifference,\n type CustomAttributeDifference,\n type DifferenceType,\n type EntityClassMixinDifference,\n type EnumeratorDifference,\n type FormatUnitDifference,\n type KindOfQuantityPresentationFormatDifference,\n type RelationshipConstraintClassDifference,\n type RelationshipConstraintDifference,\n type SchemaDifference,\n SchemaOtherTypes,\n type SchemaReferenceDifference,\n} from \"./SchemaDifference\";\n\n/**\n * The SchemaDiagnosticVisitor is a visitor implementation for diagnostic entries\n * from the schema comparer api. Depending on the diagnostic code, the difference\n * result is build together.\n * @internal\n */\nexport class SchemaDiagnosticVisitor {\n\n public readonly schemaDifferences: Array<SchemaDifference | SchemaReferenceDifference>;\n public readonly schemaItemDifferences: Array<AnySchemaItemDifference\n | EntityClassMixinDifference\n | KindOfQuantityPresentationFormatDifference\n | FormatUnitDifference>;\n public readonly schemaItemPathDifferences: Array<AnySchemaItemPathDifference>;\n public readonly customAttributeDifferences: Array<CustomAttributeDifference>;\n\n constructor() {\n this.schemaDifferences = [];\n this.schemaItemDifferences = [];\n this.schemaItemPathDifferences = [];\n this.customAttributeDifferences = [];\n }\n\n /**\n * Visitor function to process the schema change diagnostic object.\n * @internal\n */\n public visit(diagnostic: AnyDiagnostic) {\n switch (diagnostic.code) {\n case SchemaCompareCodes.SchemaDelta:\n return this.visitChangedSchemaProperties(diagnostic);\n\n case SchemaCompareCodes.SchemaReferenceMissing:\n return this.visitSchemaReference(diagnostic, \"add\");\n case SchemaCompareCodes.SchemaReferenceDelta:\n return this.visitSchemaReference(diagnostic, \"modify\");\n\n case SchemaCompareCodes.SchemaItemMissing:\n return this.visitMissingSchemaItem(diagnostic);\n\n case SchemaCompareCodes.SchemaItemDelta:\n case SchemaCompareCodes.ClassDelta:\n case SchemaCompareCodes.ConstantDelta:\n case SchemaCompareCodes.CustomAttributeClassDelta:\n case SchemaCompareCodes.FormatDelta:\n case SchemaCompareCodes.InvertedUnitDelta:\n case SchemaCompareCodes.KoqDelta:\n case SchemaCompareCodes.MixinDelta:\n case SchemaCompareCodes.PhenomenonDelta:\n case SchemaCompareCodes.PropertyCategoryDelta:\n case SchemaCompareCodes.RelationshipDelta:\n case SchemaCompareCodes.UnitDelta:\n case SchemaCompareCodes.EnumerationDelta:\n return this.visitChangedSchemaItem(diagnostic);\n\n case SchemaCompareCodes.EnumeratorDelta:\n return this.visitChangedEnumerator(diagnostic);\n case SchemaCompareCodes.EnumeratorMissing:\n return this.visitMissingEnumerator(diagnostic);\n\n case SchemaCompareCodes.BaseClassDelta:\n return this.visitMissingBaseClass(diagnostic);\n case SchemaCompareCodes.EntityMixinMissing:\n return this.visitMissingMixinOnClass(diagnostic);\n case SchemaCompareCodes.PropertyDelta:\n return this.visitChangedProperty(diagnostic);\n case SchemaCompareCodes.PropertyMissing:\n return this.visitMissingProperty(diagnostic);\n\n case SchemaCompareCodes.RelationshipConstraintClassMissing:\n return this.visitMissingRelationshipConstraintClass(diagnostic);\n case SchemaCompareCodes.RelationshipConstraintDelta:\n return this.visitChangedRelationshipConstraint(diagnostic);\n\n case SchemaCompareCodes.CustomAttributeInstanceClassMissing:\n return this.visitMissingCustomAttributeInstance(diagnostic);\n\n case SchemaCompareCodes.PresentationUnitMissing:\n return this.visitMissingPresentationUnit(diagnostic);\n\n case SchemaCompareCodes.FormatUnitMissing:\n return this.visitMissingFormatUnit(diagnostic);\n case SchemaCompareCodes.UnitLabelOverrideDelta:\n return this.visitChangedFormatUnitLabel(diagnostic);\n }\n return;\n }\n\n private visitChangedSchemaProperties(diagnostic: AnyDiagnostic) {\n let modifyEntry = this.schemaDifferences.find((entry): entry is SchemaDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Schema;\n });\n\n let hasChanges = false;\n let addEntry = false;\n if (modifyEntry === undefined) {\n addEntry = true;\n modifyEntry = {\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.Schema,\n difference: {},\n };\n }\n\n // Only label and description are taken from the source schema. If the schema name or alias\n // differs, those are ignored for now.\n const [propertyName, propertyValue] = diagnostic.messageArgs as [string, any];\n if (propertyName === \"label\") {\n modifyEntry.difference.label = propertyValue;\n hasChanges = true;\n }\n if (propertyName === \"description\") {\n modifyEntry.difference.description = propertyValue;\n hasChanges = true;\n }\n\n if (addEntry && hasChanges) {\n this.schemaDifferences.push(modifyEntry);\n }\n }\n\n private visitMissingSchemaItem(diagnostic: AnyDiagnostic) {\n const schemaItem = diagnostic.ecDefinition as AnySchemaItem;\n\n this.schemaItemDifferences.push({\n changeType: \"add\",\n schemaType: schemaItem.schemaItemType,\n itemName: schemaItem.name,\n difference: schemaItem.toJSON(),\n });\n }\n\n private visitChangedSchemaItem(diagnostic: AnyDiagnostic) {\n const schemaItem = diagnostic.ecDefinition as AnySchemaItem;\n const [propertyName, sourceValue, _targetValue] = diagnostic.messageArgs as [string, unknown, unknown];\n if (propertyName === \"schemaItemType\") {\n // If the schema item type is different, the whole item is added as \"new\" item. The\n // difference validator will then figure whether there is a conflict with items of\n // of the same name.\n return this.visitMissingSchemaItem(diagnostic);\n }\n\n if (sourceValue === undefined) {\n return;\n }\n\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is AnySchemaItemDifference => {\n return entry.changeType === \"modify\" && entry.itemName === schemaItem.name;\n });\n\n if (modifyEntry === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n modifyEntry = {\n changeType: \"modify\",\n schemaType: schemaItem.schemaItemType,\n itemName: schemaItem.name,\n difference: {},\n } as AnySchemaItemDifference;\n this.schemaItemDifferences.push(modifyEntry);\n }\n\n // TODO: Since propertyName is type of string, the compiler complains about accepting\n // an unspecific string as property indexer. Casted to any as short term fix but that\n // needs to be handled better in future.\n (modifyEntry.difference as any)[propertyName] = sourceValue;\n }\n\n private visitMissingEnumerator(diagnostic: AnyDiagnostic) {\n const enumeration = diagnostic.ecDefinition as Enumeration;\n const [enumerator] = diagnostic.messageArgs as [AnyEnumerator];\n this.schemaItemPathDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.Enumerator,\n itemName: enumeration.name,\n path: \"$enumerators\",\n difference: enumerator,\n });\n }\n\n private lookupEnumeratorEntry(changeType: DifferenceType, item: string, enumeratorName: string) {\n return this.schemaItemPathDifferences.find((change) => {\n return change.changeType === changeType\n && change.schemaType === SchemaOtherTypes.Enumerator\n && change.itemName === item\n && change.path === \"$enumerators\"\n && change.difference.name === enumeratorName;\n });\n }\n\n private visitChangedEnumerator(diagnostic: AnyDiagnostic) {\n const enumeration = diagnostic.ecDefinition as Enumeration;\n const [enumerator, propertyName, sourceValue] = diagnostic.messageArgs as [AnyEnumerator, keyof AnyEnumerator, any];\n if (this.lookupEnumeratorEntry(\"add\", enumeration.name, enumerator.name)) {\n return;\n }\n\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is EnumeratorDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Enumerator && entry.itemName === enumeration.name && entry.path === enumerator.name;\n });\n\n if (modifyEntry === undefined) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.Enumerator,\n itemName: enumeration.name,\n path: enumerator.name,\n difference: {},\n };\n this.schemaItemPathDifferences.push(modifyEntry);\n }\n\n if (sourceValue !== undefined) {\n modifyEntry.difference[propertyName] = sourceValue;\n }\n }\n\n private visitMissingProperty(diagnostic: AnyDiagnostic) {\n const property = diagnostic.ecDefinition as Property;\n this.schemaItemPathDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.Property,\n itemName: property.class.name,\n path: property.name,\n difference: property.toJSON() as AnyPropertyProps,\n });\n }\n\n private visitChangedProperty(diagnostic: AnyDiagnostic) {\n const property = diagnostic.ecDefinition as Property;\n const [propertyName, sourceValue] = diagnostic.messageArgs as [keyof PropertyProps, any, any];\n\n if (isPropertyTypeName(property, propertyName)) {\n return this.visitMissingProperty(diagnostic);\n }\n\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is ClassPropertyDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Property && entry.itemName === property.class.name && entry.path === property.name;\n });\n\n if (modifyEntry === undefined) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.Property,\n itemName: property.class.name,\n path: property.name,\n difference: {},\n };\n this.schemaItemPathDifferences.push(modifyEntry);\n }\n\n if (propertyName !== \"name\") {\n modifyEntry.difference[propertyName] = sourceValue;\n }\n }\n\n private visitMissingBaseClass(diagnostic: AnyDiagnostic) {\n const ecClass = diagnostic.ecDefinition as ECClass;\n const [sourceBaseClass] = diagnostic.messageArgs as [ECClass, ECClass];\n\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is AnyClassItemDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === ecClass.schemaItemType && entry.itemName === ecClass.name;\n });\n\n if (modifyEntry === undefined) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: ecClass.schemaItemType,\n itemName: ecClass.name,\n difference: {},\n } as AnyClassItemDifference;\n this.schemaItemDifferences.push(modifyEntry);\n }\n\n modifyEntry.difference.baseClass = sourceBaseClass !== undefined ? sourceBaseClass.fullName : undefined;\n }\n\n private visitMissingMixinOnClass(diagnostic: AnyDiagnostic) {\n const ecClass = diagnostic.ecDefinition as ECClass;\n const [mixin] = diagnostic.messageArgs as [Mixin];\n\n let addEntry = this.schemaItemDifferences.find((entry): entry is EntityClassMixinDifference => {\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.EntityClassMixin && entry.itemName === ecClass.name;\n });\n\n if (addEntry === undefined) {\n addEntry = {\n changeType: \"add\",\n schemaType: SchemaOtherTypes.EntityClassMixin,\n itemName: ecClass.name,\n difference: [],\n };\n this.schemaItemDifferences.push(addEntry);\n }\n addEntry.difference.push(mixin.fullName);\n }\n\n private visitMissingRelationshipConstraintClass(diagnostic: AnyDiagnostic) {\n const constraint = diagnostic.ecDefinition as RelationshipConstraint;\n const className = constraint.relationshipClass.name;\n const constraintPath = constraint.isSource ? \"$source\" : \"$target\";\n\n let addEntry = this.schemaItemPathDifferences.find((entry): entry is RelationshipConstraintClassDifference => {\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.RelationshipConstraintClass, entry.itemName === className && entry.path === constraintPath;\n });\n\n if (!addEntry) {\n addEntry = {\n changeType: \"add\",\n schemaType: SchemaOtherTypes.RelationshipConstraintClass,\n itemName: className,\n path: constraintPath,\n difference: [],\n };\n this.schemaItemPathDifferences.push(addEntry);\n }\n\n const [constraintClass] = diagnostic.messageArgs as [ECClass];\n addEntry.difference.push(constraintClass.fullName);\n }\n\n private visitChangedRelationshipConstraint(diagnostic: AnyDiagnostic) {\n const constraint = diagnostic.ecDefinition as RelationshipConstraint;\n const className = constraint.relationshipClass.name;\n const constraintPath = constraint.isSource ? \"$source\" : \"$target\";\n if (this.schemaItemDifferences.find((entry) => entry.changeType === \"add\" && entry.itemName === className)) {\n return;\n }\n\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is RelationshipConstraintDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.RelationshipConstraint && entry.itemName === className && entry.path === constraintPath;\n });\n\n if (modifyEntry === undefined) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.RelationshipConstraint,\n itemName: className,\n path: constraintPath,\n difference: {},\n };\n this.schemaItemPathDifferences.push(modifyEntry);\n }\n\n const [propertyName, propertyValue] = diagnostic.messageArgs as [keyof RelationshipConstraintProps, any];\n if (propertyName === \"abstractConstraint\" && propertyValue !== undefined) {\n modifyEntry.difference.abstractConstraint = propertyValue;\n }\n if (propertyName === \"multiplicity\" && propertyValue !== undefined) {\n modifyEntry.difference.multiplicity = propertyValue;\n }\n if (propertyName === \"polymorphic\" && propertyValue !== undefined) {\n modifyEntry.difference.polymorphic = propertyValue;\n }\n if (propertyName === \"roleLabel\" && propertyValue !== undefined) {\n modifyEntry.difference.roleLabel = propertyValue;\n }\n }\n\n private visitSchemaReference(diagnostic: AnyDiagnostic, changeType: DifferenceType) {\n const [referencedSchema] = diagnostic.messageArgs as [Schema];\n this.schemaDifferences.push({\n changeType,\n schemaType: SchemaOtherTypes.SchemaReference,\n difference: {\n name: referencedSchema.name,\n version: referencedSchema.schemaKey.version.toString(),\n },\n });\n }\n\n private visitMissingCustomAttributeInstance(diagnostic: AnyDiagnostic) {\n const [customAttribute] = diagnostic.messageArgs as [CustomAttribute];\n const ecType = diagnostic.ecDefinition;\n if (Schema.isSchema(ecType)) {\n return this.customAttributeDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\n appliedTo: \"Schema\",\n difference: customAttribute,\n });\n }\n\n if (SchemaItem.isSchemaItem(ecType)) {\n return this.customAttributeDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\n appliedTo: \"SchemaItem\",\n itemName: ecType.name,\n difference: customAttribute,\n });\n }\n\n if (Property.isProperty(ecType)) {\n return this.customAttributeDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\n appliedTo: \"Property\",\n itemName: ecType.class.name,\n path: ecType.name,\n difference: customAttribute,\n });\n }\n\n if (RelationshipConstraint.isRelationshipConstraint(ecType)) {\n return this.customAttributeDifferences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\n appliedTo: \"RelationshipConstraint\",\n itemName: ecType.relationshipClass.name,\n path: ecType.isSource ? \"$source\" : \"$target\",\n difference: customAttribute,\n });\n }\n return;\n }\n\n private visitMissingPresentationUnit(diagnostic: AnyDiagnostic) {\n const koq = diagnostic.ecDefinition as KindOfQuantity;\n const [presentationFormat] = diagnostic.messageArgs as [Format | OverrideFormat];\n\n let addEntry = this.schemaItemDifferences.find((entry): entry is KindOfQuantityPresentationFormatDifference => {\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.KindOfQuantityPresentationFormat\n && entry.itemName === koq.name;\n });\n\n if (addEntry === undefined) {\n addEntry = {\n changeType: \"add\",\n schemaType: SchemaOtherTypes.KindOfQuantityPresentationFormat,\n itemName: koq.name,\n difference: [],\n };\n this.schemaItemDifferences.push(addEntry);\n }\n addEntry.difference.push(presentationFormat.fullName);\n }\n\n private visitMissingFormatUnit(diagnostic: AnyDiagnostic) {\n const format = diagnostic.ecDefinition as Format;\n\n for (let index = this.schemaItemPathDifferences.length-1; index>=0; index--) {\n const entry = this.schemaItemPathDifferences[index];\n if (entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.FormatUnitLabel && entry.itemName === format.name) {\n this.schemaItemPathDifferences.splice(index, 1);\n }\n }\n\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is FormatUnitDifference => {\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.FormatUnit\n && entry.itemName === format.name;\n });\n\n if (modifyEntry === undefined && format.units) {\n modifyEntry = {\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.FormatUnit,\n itemName: format.name,\n difference: [],\n };\n\n for (const [unit, label] of format.units) {\n modifyEntry.difference.push({\n name: unit.fullName,\n label,\n });\n };\n\n this.schemaItemDifferences.push(modifyEntry);\n }\n }\n\n private visitChangedFormatUnitLabel(diagnostic: AnyDiagnostic) {\n const format = diagnostic.ecDefinition as Format;\n\n if (this.schemaItemDifferences.find((entry): entry is FormatUnitDifference => { return entry.changeType === \"modify\"\n && entry.schemaType === SchemaOtherTypes.FormatUnit && entry.itemName === format.name})) {\n return;\n }\n\n const [unit, label] = diagnostic.messageArgs as [Unit | InvertedUnit, string | undefined];\n this.schemaItemPathDifferences.push({\n changeType: \"modify\",\n schemaType: SchemaOtherTypes.FormatUnitLabel,\n itemName: format.name,\n path: unit.fullName,\n difference: {\n label,\n },\n });\n };\n};\n\nfunction isPropertyTypeName(property: Property, propertyName: string) {\n return (propertyName === \"type\") ||\n (property.isEnumeration() && propertyName === \"enumeration\") ||\n (property.isPrimitive() && propertyName === \"primitiveType\") ||\n (property.isStruct() && propertyName === \"structClass\") ||\n (property.isNavigation() && propertyName === \"relationshipClass\");\n}\n"]}
|