@itwin/ecschema-editing 5.5.0-dev.2 → 5.5.0-dev.4

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.
Files changed (183) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/Differencing/Errors.js.map +1 -1
  3. package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
  4. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
  5. package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
  6. package/lib/cjs/Differencing/SchemaDifferenceValidator.js.map +1 -1
  7. package/lib/cjs/Differencing/SchemaDifferenceVisitor.js.map +1 -1
  8. package/lib/cjs/Differencing/Utils.js.map +1 -1
  9. package/lib/cjs/Editing/Constants.js.map +1 -1
  10. package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
  11. package/lib/cjs/Editing/ECClasses.js.map +1 -1
  12. package/lib/cjs/Editing/Editor.js.map +1 -1
  13. package/lib/cjs/Editing/Entities.js.map +1 -1
  14. package/lib/cjs/Editing/Enumerations.js.map +1 -1
  15. package/lib/cjs/Editing/Exception.js.map +1 -1
  16. package/lib/cjs/Editing/Formats.js.map +1 -1
  17. package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
  18. package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
  19. package/lib/cjs/Editing/Mixins.js.map +1 -1
  20. package/lib/cjs/Editing/Mutable/MutableArrayProperty.js.map +1 -1
  21. package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
  22. package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
  23. package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
  24. package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
  25. package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
  26. package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
  27. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
  28. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
  29. package/lib/cjs/Editing/Mutable/MutableMixin.js.map +1 -1
  30. package/lib/cjs/Editing/Mutable/MutableNavigationProperty.js.map +1 -1
  31. package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
  32. package/lib/cjs/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -1
  33. package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
  34. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
  35. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
  36. package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
  37. package/lib/cjs/Editing/Mutable/MutableSchemaItem.js.map +1 -1
  38. package/lib/cjs/Editing/Mutable/MutableStructProperty.js.map +1 -1
  39. package/lib/cjs/Editing/Mutable/MutableUnit.js.map +1 -1
  40. package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
  41. package/lib/cjs/Editing/Phenomena.js.map +1 -1
  42. package/lib/cjs/Editing/Properties.js.map +1 -1
  43. package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
  44. package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
  45. package/lib/cjs/Editing/SchemaItems.js.map +1 -1
  46. package/lib/cjs/Editing/Structs.js.map +1 -1
  47. package/lib/cjs/Editing/UnitSystems.js.map +1 -1
  48. package/lib/cjs/Editing/Units.js.map +1 -1
  49. package/lib/cjs/Merging/ClassMerger.js.map +1 -1
  50. package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
  51. package/lib/cjs/Merging/CustomAttributeClassMerger.js.map +1 -1
  52. package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
  53. package/lib/cjs/Merging/Edits/NameMapping.js.map +1 -1
  54. package/lib/cjs/Merging/Edits/RenameEditHandler.js.map +1 -1
  55. package/lib/cjs/Merging/Edits/SchemaEdits.js.map +1 -1
  56. package/lib/cjs/Merging/Edits/SkipEditHandler.js.map +1 -1
  57. package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
  58. package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
  59. package/lib/cjs/Merging/EnumeratorMerger.js.map +1 -1
  60. package/lib/cjs/Merging/FormatMerger.js.map +1 -1
  61. package/lib/cjs/Merging/InvertedUnitMerger.js.map +1 -1
  62. package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
  63. package/lib/cjs/Merging/MixinMerger.js.map +1 -1
  64. package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
  65. package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -1
  66. package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
  67. package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
  68. package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
  69. package/lib/cjs/Merging/SchemaMergingVisitor.js.map +1 -1
  70. package/lib/cjs/Merging/SchemaMergingWalker.js.map +1 -1
  71. package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
  72. package/lib/cjs/Merging/StructClassMerger.js.map +1 -1
  73. package/lib/cjs/Merging/UnitMerger.js.map +1 -1
  74. package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -1
  75. package/lib/cjs/Merging/Utils.js.map +1 -1
  76. package/lib/cjs/Validation/Diagnostic.js.map +1 -1
  77. package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
  78. package/lib/cjs/Validation/ECRules.js.map +1 -1
  79. package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
  80. package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
  81. package/lib/cjs/Validation/Rules.js.map +1 -1
  82. package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
  83. package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
  84. package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
  85. package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
  86. package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
  87. package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
  88. package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
  89. package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
  90. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  91. package/lib/cjs/ecschema-editing.js.map +1 -1
  92. package/lib/esm/Differencing/Errors.js.map +1 -1
  93. package/lib/esm/Differencing/SchemaConflicts.js.map +1 -1
  94. package/lib/esm/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
  95. package/lib/esm/Differencing/SchemaDifference.js.map +1 -1
  96. package/lib/esm/Differencing/SchemaDifferenceValidator.js.map +1 -1
  97. package/lib/esm/Differencing/SchemaDifferenceVisitor.js.map +1 -1
  98. package/lib/esm/Differencing/Utils.js.map +1 -1
  99. package/lib/esm/Editing/Constants.js.map +1 -1
  100. package/lib/esm/Editing/CustomAttributes.js.map +1 -1
  101. package/lib/esm/Editing/ECClasses.js.map +1 -1
  102. package/lib/esm/Editing/Editor.js.map +1 -1
  103. package/lib/esm/Editing/Entities.js.map +1 -1
  104. package/lib/esm/Editing/Enumerations.js.map +1 -1
  105. package/lib/esm/Editing/Exception.js.map +1 -1
  106. package/lib/esm/Editing/Formats.js.map +1 -1
  107. package/lib/esm/Editing/InvertedUnits.js.map +1 -1
  108. package/lib/esm/Editing/KindOfQuantities.js.map +1 -1
  109. package/lib/esm/Editing/Mixins.js.map +1 -1
  110. package/lib/esm/Editing/Mutable/MutableArrayProperty.js.map +1 -1
  111. package/lib/esm/Editing/Mutable/MutableCAClass.js.map +1 -1
  112. package/lib/esm/Editing/Mutable/MutableClass.js.map +1 -1
  113. package/lib/esm/Editing/Mutable/MutableConstant.js.map +1 -1
  114. package/lib/esm/Editing/Mutable/MutableEntityClass.js.map +1 -1
  115. package/lib/esm/Editing/Mutable/MutableEnumeration.js.map +1 -1
  116. package/lib/esm/Editing/Mutable/MutableFormat.js.map +1 -1
  117. package/lib/esm/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
  118. package/lib/esm/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
  119. package/lib/esm/Editing/Mutable/MutableMixin.js.map +1 -1
  120. package/lib/esm/Editing/Mutable/MutableNavigationProperty.js.map +1 -1
  121. package/lib/esm/Editing/Mutable/MutablePhenomenon.js.map +1 -1
  122. package/lib/esm/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -1
  123. package/lib/esm/Editing/Mutable/MutableProperty.js.map +1 -1
  124. package/lib/esm/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
  125. package/lib/esm/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
  126. package/lib/esm/Editing/Mutable/MutableSchema.js.map +1 -1
  127. package/lib/esm/Editing/Mutable/MutableSchemaItem.js.map +1 -1
  128. package/lib/esm/Editing/Mutable/MutableStructProperty.js.map +1 -1
  129. package/lib/esm/Editing/Mutable/MutableUnit.js.map +1 -1
  130. package/lib/esm/Editing/Mutable/MutableUnitSystem.js.map +1 -1
  131. package/lib/esm/Editing/Phenomena.js.map +1 -1
  132. package/lib/esm/Editing/Properties.js.map +1 -1
  133. package/lib/esm/Editing/PropertyCategories.js.map +1 -1
  134. package/lib/esm/Editing/RelationshipClasses.js.map +1 -1
  135. package/lib/esm/Editing/SchemaItems.js.map +1 -1
  136. package/lib/esm/Editing/Structs.js.map +1 -1
  137. package/lib/esm/Editing/UnitSystems.js.map +1 -1
  138. package/lib/esm/Editing/Units.js.map +1 -1
  139. package/lib/esm/Merging/ClassMerger.js.map +1 -1
  140. package/lib/esm/Merging/ConstantMerger.js.map +1 -1
  141. package/lib/esm/Merging/CustomAttributeClassMerger.js.map +1 -1
  142. package/lib/esm/Merging/CustomAttributeMerger.js.map +1 -1
  143. package/lib/esm/Merging/Edits/NameMapping.js.map +1 -1
  144. package/lib/esm/Merging/Edits/RenameEditHandler.js.map +1 -1
  145. package/lib/esm/Merging/Edits/SchemaEdits.js.map +1 -1
  146. package/lib/esm/Merging/Edits/SkipEditHandler.js.map +1 -1
  147. package/lib/esm/Merging/EntityClassMerger.js.map +1 -1
  148. package/lib/esm/Merging/EnumerationMerger.js.map +1 -1
  149. package/lib/esm/Merging/EnumeratorMerger.js.map +1 -1
  150. package/lib/esm/Merging/FormatMerger.js.map +1 -1
  151. package/lib/esm/Merging/InvertedUnitMerger.js.map +1 -1
  152. package/lib/esm/Merging/KindOfQuantityMerger.js.map +1 -1
  153. package/lib/esm/Merging/MixinMerger.js.map +1 -1
  154. package/lib/esm/Merging/PhenomenonMerger.js.map +1 -1
  155. package/lib/esm/Merging/PropertyCategoryMerger.js.map +1 -1
  156. package/lib/esm/Merging/PropertyMerger.js.map +1 -1
  157. package/lib/esm/Merging/RelationshipClassMerger.js.map +1 -1
  158. package/lib/esm/Merging/SchemaMerger.js.map +1 -1
  159. package/lib/esm/Merging/SchemaMergingVisitor.js.map +1 -1
  160. package/lib/esm/Merging/SchemaMergingWalker.js.map +1 -1
  161. package/lib/esm/Merging/SchemaReferenceMerger.js.map +1 -1
  162. package/lib/esm/Merging/StructClassMerger.js.map +1 -1
  163. package/lib/esm/Merging/UnitMerger.js.map +1 -1
  164. package/lib/esm/Merging/UnitSystemMerger.js.map +1 -1
  165. package/lib/esm/Merging/Utils.js.map +1 -1
  166. package/lib/esm/Validation/Diagnostic.js.map +1 -1
  167. package/lib/esm/Validation/DiagnosticReporter.js.map +1 -1
  168. package/lib/esm/Validation/ECRules.js.map +1 -1
  169. package/lib/esm/Validation/LoggingDiagnosticReporter.js.map +1 -1
  170. package/lib/esm/Validation/RuleSuppressionSet.js.map +1 -1
  171. package/lib/esm/Validation/Rules.js.map +1 -1
  172. package/lib/esm/Validation/SchemaChanges.js.map +1 -1
  173. package/lib/esm/Validation/SchemaCompareDiagnostics.js.map +1 -1
  174. package/lib/esm/Validation/SchemaCompareReporter.js.map +1 -1
  175. package/lib/esm/Validation/SchemaCompareResultDelegate.js.map +1 -1
  176. package/lib/esm/Validation/SchemaCompareVisitor.js.map +1 -1
  177. package/lib/esm/Validation/SchemaComparer.js.map +1 -1
  178. package/lib/esm/Validation/SchemaValidater.js.map +1 -1
  179. package/lib/esm/Validation/SchemaValidationVisitor.js.map +1 -1
  180. package/lib/esm/Validation/SchemaWalker.js.map +1 -1
  181. package/lib/esm/ecschema-editing.js.map +1 -1
  182. package/package.json +9 -9
  183. package/public/locales/en/ECSchemaEditing.json +26 -26
@@ -1 +1 @@
1
- {"version":3,"file":"Diagnostic.js","sourceRoot":"","sources":["../../../src/Validation/Diagnostic.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH,iDAAiD;AAEjD,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,GAAG,IAAc,EAAE,EAAE;IACzD,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;QACrD,OAAO,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,WAAW;YAC3C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;YACjB,CAAC,CAAC,KAAK,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAN,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,mDAAI,CAAA;IACJ,uDAAM,CAAA;IACN,+DAAU,CAAA;IACV,2DAAQ,CAAA;IACR,2FAAwB,CAAA;IACxB,uFAAsB,CAAA;AACxB,CAAC,EAPW,cAAc,KAAd,cAAc,QAOzB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,iEAAO,CAAA;IACP,6DAAK,CAAA;IACL,uEAAU,CAAA;IACV,iEAAO,CAAA;AACT,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AA6BD;;;GAGG;AACH,MAAM,OAAgB,cAAc;IAClC;;;;;OAKG;IACH,YAAY,YA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AK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACzB,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 Diagnostic\n */\n\nimport { AnyClass, AnyECType, AnyProperty, CustomAttributeContainerProps, RelationshipConstraint, Schema, SchemaItem } from \"@itwin/ecschema-metadata\";\n\n/* eslint-disable @typescript-eslint/no-shadow */\n\nconst formatString = (format: string, ...args: string[]) => {\n return format.replace(/{(\\d+)}/g, (match, theNumber) => {\n return typeof args[theNumber] !== \"undefined\"\n ? args[theNumber]\n : match;\n });\n};\n\n/**\n * Defines the possible diagnostic types.\n * @beta\n */\nexport enum DiagnosticType {\n None,\n Schema,\n SchemaItem,\n Property,\n CustomAttributeContainer,\n RelationshipConstraint,\n}\n\n/**\n * Defines the possible diagnostic categories.\n * @beta\n */\nexport enum DiagnosticCategory {\n Warning,\n Error,\n Suggestion,\n Message,\n}\n\n/**\n * The interface implemented by all diagnostics used during schema validation.\n * @beta\n */\nexport interface IDiagnostic<TYPE extends AnyECType, ARGS extends any[]> {\n /** The diagnostic category (error, warning, etc...). Value is static across all instances. */\n category: DiagnosticCategory;\n /** The unique string identifier of the diagnostic in the format '<ruleSetName>:<number>. Value is static across all instances. */\n code: string;\n /** The context type of diagnostic (schema, schema item, property, etc...). Value is static across all instances. */\n diagnosticType: DiagnosticType;\n /** The unformatted message text associated with the diagnostic. Value is static across all instances. */\n messageText: string;\n /** The arguments used when formatted the diagnostic instance's message. */\n messageArgs?: ARGS;\n /** The EC object associated with the diagnostic instance. */\n ecDefinition: TYPE;\n /** The schema where the diagnostic originated. */\n schema: Schema;\n}\n\n/**\n * Type which encapsulates all possible diagnostics.\n * @beta\n */\nexport type AnyDiagnostic = IDiagnostic<AnyECType, any[]>;\n\n/**\n * The abstract base class for all [[IDiagnostic]] implementations.\n * @beta\n */\nexport abstract class BaseDiagnostic<TYPE extends AnyECType, ARGS extends any[]> implements IDiagnostic<TYPE, ARGS> {\n /**\n * Initializes a new BaseDiagnostic.\n * @param ecDefinition The EC object to associate with the diagnostic.\n * @param messageArgs The arguments used when formatting the diagnostic message.\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\n */\n constructor(ecDefinition: TYPE, messageArgs?: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\n this.ecDefinition = ecDefinition;\n this.messageArgs = messageArgs;\n this.category = category;\n }\n\n /** Gets the unique string identifier for the diagnostic in the format '<ruleSetName>:<number>'. */\n public abstract get code(): string;\n /** Gets the context type of the diagnostic (schema, schema item, property, etc...) */\n public abstract get diagnosticType(): DiagnosticType;\n /** Gets the message associated with the diagnostic. */\n public abstract get messageText(): string;\n /** Gets the schema where the diagnostic originated. */\n public abstract get schema(): Schema;\n\n /** The EC object to associate with the diagnostic. */\n public ecDefinition: TYPE;\n /** The arguments used when formatting the diagnostic message. */\n public messageArgs?: ARGS;\n /** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */\n public category: DiagnosticCategory;\n}\n\n/**\n * An [[IDiagnostic]] implementation used for [[Schema]] diagnostics.\n * @beta\n */\nexport abstract class SchemaDiagnostic<ARGS extends any[]> extends BaseDiagnostic<Schema, ARGS> {\n public static diagnosticType = DiagnosticType.SchemaItem;\n\n /**\n * Initializes a new SchemaDiagnostic.\n * @param ecDefinition The EC object to associate with the diagnostic.\n * @param messageArgs The arguments used when formatting the diagnostic message.\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\n */\n constructor(schema: Schema, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\n super(schema, messageArgs, category);\n }\n\n /** Gets the schema where the diagnostic originated. */\n public get schema(): Schema { return this.ecDefinition; }\n\n /** Gets the DiagnosticType. */\n public get diagnosticType(): DiagnosticType { return DiagnosticType.Schema; }\n}\n\n/**\n * An [[IDiagnostic]] implementation used for [[SchemaItem]] diagnostics.\n * @beta\n */\nexport abstract class SchemaItemDiagnostic<TYPE extends SchemaItem, ARGS extends any[]> extends BaseDiagnostic<TYPE, ARGS> {\n public static diagnosticType = DiagnosticType.SchemaItem;\n /**\n * Initializes a new SchemaItemDiagnostic.\n * @param ecDefinition The EC object to associate with the diagnostic.\n * @param messageArgs The arguments used when formatting the diagnostic message.\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\n */\n constructor(ecDefinition: SchemaItem, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\n super(ecDefinition as TYPE, messageArgs, category);\n }\n\n /** Gets the schema where the diagnostic originated. */\n public get schema(): Schema { return this.ecDefinition.schema; }\n\n /** Gets the DiagnosticType. */\n public get diagnosticType(): DiagnosticType { return DiagnosticType.SchemaItem; }\n}\n\n/**\n * An [[IDiagnostic]] implementation used for [[ECClass]] diagnostics.\n * @beta\n */\nexport abstract class ClassDiagnostic<ARGS extends any[]> extends SchemaItemDiagnostic<AnyClass, ARGS> {\n /**\n * Initializes a new ClassDiagnostic.\n * @param ecClass The class to associate with the diagnostic.\n * @param messageArgs The arguments used when formatting the diagnostic message.\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\n */\n constructor(ecClass: AnyClass, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\n super(ecClass, messageArgs, category);\n }\n\n /** Gets the schema where the diagnostic originated. */\n public override get schema(): Schema { return this.ecDefinition.schema; }\n}\n\n/**\n * An [[IDiagnostic]] implementation used for [[Property]] diagnostics.\n * @beta\n */\nexport abstract class PropertyDiagnostic<ARGS extends any[]> extends BaseDiagnostic<AnyProperty, ARGS> {\n /**\n * Initializes a new PropertyDiagnostic.\n * @param property The property to associate with the diagnostic.\n * @param messageArgs The arguments used when formatting the diagnostic message.\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\n */\n constructor(property: AnyProperty, messageArgs?: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\n super(property, messageArgs, category);\n }\n\n /** Gets the schema where the diagnostic originated. */\n public get schema(): Schema { return this.ecDefinition.schema; }\n\n /** Gets the DiagnosticType. */\n public get diagnosticType(): DiagnosticType { return DiagnosticType.Property; }\n}\n\n/**\n * An [[IDiagnostic]] implementation used for [[RelationshipConstraint]] diagnostics.\n * @beta\n */\nexport abstract class RelationshipConstraintDiagnostic<ARGS extends any[]> extends BaseDiagnostic<RelationshipConstraint, ARGS> {\n /**\n * Initializes a new RelationshipConstraintDiagnostic.\n * @param constraint The Relationship Constraint to associate with the diagnostic.\n * @param messageArgs The arguments used when formatting the diagnostic message.\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\n */\n constructor(constraint: RelationshipConstraint, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\n super(constraint, messageArgs, category);\n }\n\n /** Gets the schema where the diagnostic originated. */\n public get schema(): Schema { return this.ecDefinition.schema; }\n\n /** Gets the DiagnosticType. */\n public get diagnosticType(): DiagnosticType { return DiagnosticType.RelationshipConstraint; }\n}\n\n/**\n * An [[IDiagnostic]] implementation used for [[CustomAttributeContainerProps]] diagnostics.\n * @beta\n */\nexport abstract class CustomAttributeContainerDiagnostic<ARGS extends any[]> extends BaseDiagnostic<CustomAttributeContainerProps, ARGS> {\n /**\n * Initializes a new CustomAttributeContainerDiagnostic.\n * @param constraint The Custom Attribute Container to associate with the diagnostic.\n * @param messageArgs The arguments used when formatting the diagnostic message.\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\n */\n constructor(container: CustomAttributeContainerProps, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\n super(container, messageArgs, category);\n }\n\n /** Gets the schema where the diagnostic originated. */\n public get schema(): Schema { return this.ecDefinition.schema; }\n\n /** Gets the DiagnosticType. */\n public get diagnosticType(): DiagnosticType { return DiagnosticType.CustomAttributeContainer; }\n}\n\n/**\n * Helper method for creating [[SchemaDiagnostic]] child classes.\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\n * @param messageText The message to associate with the diagnostic class.\n * @beta\n */\nexport function createSchemaDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\n validateCode(code);\n return class extends SchemaDiagnostic<ARGS> {\n public static code = code;\n public get code(): string { return code; }\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\n };\n}\n\n/**\n * Helper method for creating [[SchemaItemDiagnostic]] child classes.\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\n * @param messageText The message to associate with the diagnostic class.\n * @beta\n */\nexport function createSchemaItemDiagnosticClass<ITEM extends SchemaItem, ARGS extends any[]>(code: string, messageText: string) {\n validateCode(code);\n return class extends SchemaItemDiagnostic<ITEM, ARGS> {\n public get code(): string { return code; }\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\n };\n}\n\n/**\n * Helper method for creating [[ClassDiagnostic]] child classes.\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\n * @param messageText The message to associate with the diagnostic class.\n * @beta\n */\nexport function createClassDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\n validateCode(code);\n return class extends ClassDiagnostic<ARGS> {\n public get code(): string { return code; }\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\n };\n}\n\n/**\n * Helper method for creating [[PropertyDiagnostic]] child classes.\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\n * @param messageText The message to associate with the diagnostic class.\n * @beta\n */\nexport function createPropertyDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\n validateCode(code);\n return class extends PropertyDiagnostic<ARGS> {\n public static code = code;\n public get code(): string { return code; }\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\n };\n}\n\n/**\n * Helper method for creating [[RelationshipConstraintDiagnostic]] child classes.\n * @param code The string that uniquely identifies the type of diagnostic in the format '<ruleSetName>:<number>'.\n * @param messageText The message to associate with the diagnostic class.\n * @beta\n */\nexport function createRelationshipConstraintDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\n validateCode(code);\n return class extends RelationshipConstraintDiagnostic<ARGS> {\n public get code(): string { return code; }\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\n };\n}\n\n/**\n * Helper method for creating [[CustomAttributeContainerDiagnostic]] child classes.\n * @param code The that uniquely identifies the type of diagnostic in the format '<ruleSetName>:<number>'.\n * @param messageText The message to associate with the diagnostic class.\n * @beta\n */\nexport function createCustomAttributeContainerDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\n validateCode(code);\n return class extends CustomAttributeContainerDiagnostic<ARGS> {\n public get code(): string { return code; }\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\n };\n}\n\n/** @beta */\nexport function diagnosticCategoryToString(category: DiagnosticCategory) {\n switch (category) {\n case DiagnosticCategory.Error:\n return \"Error\";\n case DiagnosticCategory.Warning:\n return \"Warning\";\n case DiagnosticCategory.Message:\n return \"Message\";\n case DiagnosticCategory.Suggestion:\n return \"Suggestion\";\n }\n}\n\n/** @beta */\nexport function diagnosticTypeToString(type: DiagnosticType) {\n switch (type) {\n case DiagnosticType.CustomAttributeContainer:\n return \"CustomAttributeContainer\";\n case DiagnosticType.None:\n return \"None\";\n case DiagnosticType.Property:\n return \"Property\";\n case DiagnosticType.RelationshipConstraint:\n return \"RelationshipConstraint\";\n case DiagnosticType.Schema:\n return \"Schema\";\n case DiagnosticType.SchemaItem:\n return \"SchemaItem\";\n }\n}\n\nfunction validateCode(code: string) {\n const msg = `Diagnostic code ${code} is invalid. Expected the format <ruleSetName>-<number>.`;\n const parts = code.split(\"-\");\n if (parts.length !== 2)\n throw new Error(msg);\n\n if (isNaN(Number(parts[1])))\n throw new Error(msg);\n}\n"]}
1
+ {"version":3,"file":"Diagnostic.js","sourceRoot":"","sources":["../../../src/Validation/Diagnostic.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH,iDAAiD;AAEjD,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,GAAG,IAAc,EAAE,EAAE;IACzD,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;QACrD,OAAO,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,WAAW;YAC3C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;YACjB,CAAC,CAAC,KAAK,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAN,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,mDAAI,CAAA;IACJ,uDAAM,CAAA;IACN,+DAAU,CAAA;IACV,2DAAQ,CAAA;IACR,2FAAwB,CAAA;IACxB,uFAAsB,CAAA;AACxB,CAAC,EAPW,cAAc,KAAd,cAAc,QAOzB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,iEAAO,CAAA;IACP,6DAAK,CAAA;IACL,uEAAU,CAAA;IACV,iEAAO,CAAA;AACT,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AA6BD;;;GAGG;AACH,MAAM,OAAgB,cAAc;IAClC;;;;;OAKG;IACH,YAAY,YAAkB,EAAE,WAAkB,EAAE,WAA+B,kBAAkB,CAAC,KAAK;QACzG,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAWD,sDAAsD;IAC/C,YAAY,CAAO;IAC1B,kEAAkE;IAC3D,W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QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,kBAAkB,CAAC,KAAK;YAC3B,OAAO,OAAO,CAAC;QACjB,KAAK,kBAAkB,CAAC,OAAO;YAC7B,OAAO,SAAS,CAAC;QACnB,KAAK,kBAAkB,CAAC,OAAO;YAC7B,OAAO,SAAS,CAAC;QACnB,KAAK,kBAAkB,CAAC,UAAU;YAChC,OAAO,YAAY,CAAC;IACxB,CAAC;AACH,CAAC;AAED,YAAY;AACZ,MAAM,UAAU,sBAAsB,CAAC,IAAoB;IACzD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,cAAc,CAAC,wBAAwB;YAC1C,OAAO,0BAA0B,CAAC;QACpC,KAAK,cAAc,CAAC,IAAI;YACtB,OAAO,MAAM,CAAC;QAChB,KAAK,cAAc,CAAC,QAAQ;YAC1B,OAAO,UAAU,CAAC;QACpB,KAAK,cAAc,CAAC,sBAAsB;YACxC,OAAO,wBAAwB,CAAC;QAClC,KAAK,cAAc,CAAC,MAAM;YACxB,OAAO,QAAQ,CAAC;QAClB,KAAK,cAAc,CAAC,UAAU;YAC5B,OAAO,YAAY,CAAC;IACxB,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,MAAM,GAAG,GAAG,mBAAmB,IAAI,0DAA0D,CAAC;IAC9F,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;IAEvB,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Diagnostic\r\n */\r\n\r\nimport { AnyClass, AnyECType, AnyProperty, CustomAttributeContainerProps, RelationshipConstraint, Schema, SchemaItem } from \"@itwin/ecschema-metadata\";\r\n\r\n/* eslint-disable @typescript-eslint/no-shadow */\r\n\r\nconst formatString = (format: string, ...args: string[]) => {\r\n return format.replace(/{(\\d+)}/g, (match, theNumber) => {\r\n return typeof args[theNumber] !== \"undefined\"\r\n ? args[theNumber]\r\n : match;\r\n });\r\n};\r\n\r\n/**\r\n * Defines the possible diagnostic types.\r\n * @beta\r\n */\r\nexport enum DiagnosticType {\r\n None,\r\n Schema,\r\n SchemaItem,\r\n Property,\r\n CustomAttributeContainer,\r\n RelationshipConstraint,\r\n}\r\n\r\n/**\r\n * Defines the possible diagnostic categories.\r\n * @beta\r\n */\r\nexport enum DiagnosticCategory {\r\n Warning,\r\n Error,\r\n Suggestion,\r\n Message,\r\n}\r\n\r\n/**\r\n * The interface implemented by all diagnostics used during schema validation.\r\n * @beta\r\n */\r\nexport interface IDiagnostic<TYPE extends AnyECType, ARGS extends any[]> {\r\n /** The diagnostic category (error, warning, etc...). Value is static across all instances. */\r\n category: DiagnosticCategory;\r\n /** The unique string identifier of the diagnostic in the format '<ruleSetName>:<number>. Value is static across all instances. */\r\n code: string;\r\n /** The context type of diagnostic (schema, schema item, property, etc...). Value is static across all instances. */\r\n diagnosticType: DiagnosticType;\r\n /** The unformatted message text associated with the diagnostic. Value is static across all instances. */\r\n messageText: string;\r\n /** The arguments used when formatted the diagnostic instance's message. */\r\n messageArgs?: ARGS;\r\n /** The EC object associated with the diagnostic instance. */\r\n ecDefinition: TYPE;\r\n /** The schema where the diagnostic originated. */\r\n schema: Schema;\r\n}\r\n\r\n/**\r\n * Type which encapsulates all possible diagnostics.\r\n * @beta\r\n */\r\nexport type AnyDiagnostic = IDiagnostic<AnyECType, any[]>;\r\n\r\n/**\r\n * The abstract base class for all [[IDiagnostic]] implementations.\r\n * @beta\r\n */\r\nexport abstract class BaseDiagnostic<TYPE extends AnyECType, ARGS extends any[]> implements IDiagnostic<TYPE, ARGS> {\r\n /**\r\n * Initializes a new BaseDiagnostic.\r\n * @param ecDefinition The EC object to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(ecDefinition: TYPE, messageArgs?: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n this.ecDefinition = ecDefinition;\r\n this.messageArgs = messageArgs;\r\n this.category = category;\r\n }\r\n\r\n /** Gets the unique string identifier for the diagnostic in the format '<ruleSetName>:<number>'. */\r\n public abstract get code(): string;\r\n /** Gets the context type of the diagnostic (schema, schema item, property, etc...) */\r\n public abstract get diagnosticType(): DiagnosticType;\r\n /** Gets the message associated with the diagnostic. */\r\n public abstract get messageText(): string;\r\n /** Gets the schema where the diagnostic originated. */\r\n public abstract get schema(): Schema;\r\n\r\n /** The EC object to associate with the diagnostic. */\r\n public ecDefinition: TYPE;\r\n /** The arguments used when formatting the diagnostic message. */\r\n public messageArgs?: ARGS;\r\n /** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */\r\n public category: DiagnosticCategory;\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[Schema]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class SchemaDiagnostic<ARGS extends any[]> extends BaseDiagnostic<Schema, ARGS> {\r\n public static diagnosticType = DiagnosticType.SchemaItem;\r\n\r\n /**\r\n * Initializes a new SchemaDiagnostic.\r\n * @param ecDefinition The EC object to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(schema: Schema, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(schema, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.Schema; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[SchemaItem]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class SchemaItemDiagnostic<TYPE extends SchemaItem, ARGS extends any[]> extends BaseDiagnostic<TYPE, ARGS> {\r\n public static diagnosticType = DiagnosticType.SchemaItem;\r\n /**\r\n * Initializes a new SchemaItemDiagnostic.\r\n * @param ecDefinition The EC object to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(ecDefinition: SchemaItem, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(ecDefinition as TYPE, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition.schema; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.SchemaItem; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[ECClass]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class ClassDiagnostic<ARGS extends any[]> extends SchemaItemDiagnostic<AnyClass, ARGS> {\r\n /**\r\n * Initializes a new ClassDiagnostic.\r\n * @param ecClass The class to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(ecClass: AnyClass, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(ecClass, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public override get schema(): Schema { return this.ecDefinition.schema; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[Property]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class PropertyDiagnostic<ARGS extends any[]> extends BaseDiagnostic<AnyProperty, ARGS> {\r\n /**\r\n * Initializes a new PropertyDiagnostic.\r\n * @param property The property to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(property: AnyProperty, messageArgs?: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(property, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition.schema; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.Property; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[RelationshipConstraint]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class RelationshipConstraintDiagnostic<ARGS extends any[]> extends BaseDiagnostic<RelationshipConstraint, ARGS> {\r\n /**\r\n * Initializes a new RelationshipConstraintDiagnostic.\r\n * @param constraint The Relationship Constraint to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(constraint: RelationshipConstraint, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(constraint, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition.schema; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.RelationshipConstraint; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[CustomAttributeContainerProps]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class CustomAttributeContainerDiagnostic<ARGS extends any[]> extends BaseDiagnostic<CustomAttributeContainerProps, ARGS> {\r\n /**\r\n * Initializes a new CustomAttributeContainerDiagnostic.\r\n * @param constraint The Custom Attribute Container to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(container: CustomAttributeContainerProps, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(container, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition.schema; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.CustomAttributeContainer; }\r\n}\r\n\r\n/**\r\n * Helper method for creating [[SchemaDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createSchemaDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends SchemaDiagnostic<ARGS> {\r\n public static code = code;\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[SchemaItemDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createSchemaItemDiagnosticClass<ITEM extends SchemaItem, ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends SchemaItemDiagnostic<ITEM, ARGS> {\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[ClassDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createClassDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends ClassDiagnostic<ARGS> {\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[PropertyDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createPropertyDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends PropertyDiagnostic<ARGS> {\r\n public static code = code;\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[RelationshipConstraintDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the type of diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createRelationshipConstraintDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends RelationshipConstraintDiagnostic<ARGS> {\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[CustomAttributeContainerDiagnostic]] child classes.\r\n * @param code The that uniquely identifies the type of diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createCustomAttributeContainerDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends CustomAttributeContainerDiagnostic<ARGS> {\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/** @beta */\r\nexport function diagnosticCategoryToString(category: DiagnosticCategory) {\r\n switch (category) {\r\n case DiagnosticCategory.Error:\r\n return \"Error\";\r\n case DiagnosticCategory.Warning:\r\n return \"Warning\";\r\n case DiagnosticCategory.Message:\r\n return \"Message\";\r\n case DiagnosticCategory.Suggestion:\r\n return \"Suggestion\";\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport function diagnosticTypeToString(type: DiagnosticType) {\r\n switch (type) {\r\n case DiagnosticType.CustomAttributeContainer:\r\n return \"CustomAttributeContainer\";\r\n case DiagnosticType.None:\r\n return \"None\";\r\n case DiagnosticType.Property:\r\n return \"Property\";\r\n case DiagnosticType.RelationshipConstraint:\r\n return \"RelationshipConstraint\";\r\n case DiagnosticType.Schema:\r\n return \"Schema\";\r\n case DiagnosticType.SchemaItem:\r\n return \"SchemaItem\";\r\n }\r\n}\r\n\r\nfunction validateCode(code: string) {\r\n const msg = `Diagnostic code ${code} is invalid. Expected the format <ruleSetName>-<number>.`;\r\n const parts = code.split(\"-\");\r\n if (parts.length !== 2)\r\n throw new Error(msg);\r\n\r\n if (isNaN(Number(parts[1])))\r\n throw new Error(msg);\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DiagnosticReporter.js","sourceRoot":"","sources":["../../../src/Validation/DiagnosticReporter.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAKH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAChD,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAC9C,MAAM,kBAAkB,GAAG,GAAG,oBAAoB,IAAI,uBAAuB,EAAE,CAAC;AAwBhF;;;;;GAKG;AACH,MAAM,OAAgB,6BAA6B;IACzC,aAAa,CAAyB;IAE9C;;;OAGG;IACH,YAAY,YAAoC;QAC9C,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5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WAAW,IAAI,UAAU,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;YAC7D,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;QAC3F,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAEO,gBAAgB,CAAC,UAAyB;QAChD,IAAI,CAAC,IAAI,CAAC,YAAY;YACpB,OAAO,UAAU,CAAC,WAAW,CAAC;QAEhC,OAAO,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC;IAClF,CAAC;IAEO,iBAAiB,CAAC,UAAyB;QACjD,OAAO,GAAG,kBAAkB,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC;IACpD,CAAC;IAEO,aAAa,CAAI,KAA2B,EAAE,OAAgB;QACpE,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;YACvC,OAAO,MAAM,CAAC,KAAK,EAAE,OAAO,CAAU,CAAC;QAEzC,OAAO,KAAK,CAAC;IACf,CAAC;CACF","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 Diagnostic\n */\n\nimport { Localization } from \"@itwin/core-common\";\nimport { AnyDiagnostic } from \"./Diagnostic\";\n\nimport * as assert from \"assert\";\n\nconst translationNamespace = \"ECSchemaMetaData\";\nconst subTranslationNamespace = \"Diagnostics\";\nconst baseTranslationKey = `${translationNamespace}:${subTranslationNamespace}`;\n\n/**\n * Interface used to report [[IDiagnostic]] objects created during schema validation.\n * @beta\n */\nexport interface IDiagnosticReporter {\n /**\n * A map where the key is a schema full name and the value is a collection\n * of diagnostics codes identifying which rules violations to ignore during validation.\n */\n suppressions?: Map<string, string[]>;\n\n /** The localization object to use for message translation. */\n localization?: Localization;\n\n /**\n * Handles the given [[IDiagnostic]] based on the implementation requirements for a\n * given reporter.\n * @param diagnostic The diagnostic to report.\n */\n report(diagnostic: AnyDiagnostic): void;\n}\n\n/**\n * An abstract base class for [[IDiagnosticReporter]] implementation that used the\n * provided Map to suppress certain rule violations from being reported. The Map's key\n * a schema full name, and the Map's value is a collection of rule codes to suppress.\n * @beta\n */\nexport abstract class SuppressionDiagnosticReporter implements IDiagnosticReporter {\n private _suppressions?: Map<string, string[]>;\n\n /**\n * Initializes a new SuppressionDiagnosticReporter\n * @param suppressions A Map where the key is a schema full name and the value is collection of diagnostic codes to suppress.\n */\n constructor(suppressions?: Map<string, string[]>) {\n this._suppressions = suppressions;\n }\n\n /**\n * Gets the collection of ISchemaDiagnosticSuppression objects that identify\n * rules violations to ignore during validation.\n */\n public get suppressions(): Map<string, string[]> | undefined {\n return this._suppressions;\n }\n\n /**\n * Prior to reporting the [[IDiagnostic]], the diagnostic message is formatted (with translations)\n * base on arguments contained in the diagnostic. Calls reportDiagnostic after the message is formatted.\n * @param diagnostic The diagnostic to report.\n */\n public report(diagnostic: AnyDiagnostic) {\n if (this._suppressions && this._suppressions.has(diagnostic.schema.fullName)) {\n const suppressedCodes = this._suppressions.get(diagnostic.schema.fullName);\n if (suppressedCodes!.includes(diagnostic.code))\n return;\n }\n\n this.reportInternal(diagnostic);\n }\n\n /**\n * Handles the given [[IDiagnostic]] based on the implementation requirements for a\n * given reporter.\n * @param diagnostic The diagnostic to report.\n */\n protected abstract reportInternal(diagnostic: AnyDiagnostic): void;\n}\n\n/**\n * An abstract [[SuppressionDiagnosticReporter]] implementation that formats the\n * diagnostic message with the message args. If a Localization implementation is specified,\n * the message will also be translated.\n * @beta\n */\nexport abstract class FormatDiagnosticReporter extends SuppressionDiagnosticReporter {\n /**\n * Initializes a new FormatDiagnosticReporter\n * @param suppressions A Map where the key is a schema full name and the value is collection of diagnostic codes to suppress.\n * @param localization The Localization instance to use to translate validation messages.\n */\n constructor(suppressions?: Map<string, string[]>, localization?: Localization) {\n super(suppressions);\n this.localization = localization;\n }\n\n /** The Localization object to use for message translation. If undefined, no translation will occur. */\n public localization?: Localization;\n\n /**\n * Prior to reporting the [[IDiagnostic]], the diagnostic message is formatted (with translations)\n * base on arguments contained in the diagnostic. Calls reportDiagnostic after the message is formatted.\n * @param diagnostic The diagnostic to report.\n */\n public reportInternal(diagnostic: AnyDiagnostic) {\n const message = this.formatMessage(diagnostic);\n this.reportDiagnostic(diagnostic, message);\n }\n\n /**\n * Handles the given [[IDiagnostic]] based on the implementation requirements for a\n * given reporter.\n * @param diagnostic The diagnostic to report.\n * @param messageText The formatted message.\n */\n protected abstract reportDiagnostic(diagnostic: AnyDiagnostic, messageText: string): void;\n\n /**\n * Helper method that formats string with provided arguments where the place holders\n * are in the the format '{0}', '{1}', etc.\n * @param text The text to format.\n * @param args The arguments to place in the text.\n * @param baseIndex The base index for the args, used for validation (typically 0, which is the default).\n */\n protected formatStringFromArgs(text: string, args: ArrayLike<string>, baseIndex = 0): string {\n return text.replace(/{(\\d+)}/g, (_match, index: string) => this.assertDefined(args[+index + baseIndex]));\n }\n\n private formatMessage(diagnostic: AnyDiagnostic): string {\n let translatedMessage = this.translateMessage(diagnostic);\n\n if (diagnostic.messageArgs && diagnostic.messageArgs.length > 0)\n translatedMessage = this.formatStringFromArgs(translatedMessage, diagnostic.messageArgs);\n return translatedMessage;\n }\n\n private translateMessage(diagnostic: AnyDiagnostic): string {\n if (!this.localization)\n return diagnostic.messageText;\n\n return this.localization.getLocalizedString(this.getTranslationKey(diagnostic));\n }\n\n private getTranslationKey(diagnostic: AnyDiagnostic): string {\n return `${baseTranslationKey}.${diagnostic.code}`;\n }\n\n private assertDefined<T>(value: T | null | undefined, message?: string): T {\n if (value === undefined || value === null)\n return assert(false, message) as never;\n\n return value;\n }\n}\n"]}
1
+ {"version":3,"file":"DiagnosticReporter.js","sourceRoot":"","sources":["../../../src/Validation/DiagnosticReporter.ts"],"names":[],"mappings":"AAAA;;;+FAG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,UAAU,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IAUD;;;;;;OAMG;IACO,oBAAoB,CAAC,IAAY,EAAE,IAAuB,EAAE,SAAS,GAAG,CAAC;QACjF,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,KAAa,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC3G,CAAC;IAEO,aAAa,CAAC,UAAyB;QAC7C,IAAI,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAE1D,IAAI,UAAU,CAAC,WAAW,IAAI,UAAU,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;YAC7D,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;QAC3F,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAEO,gBAAgB,CAAC,UAAyB;QAChD,IAAI,CAAC,IAAI,CAAC,YAAY;YACpB,OAAO,UAAU,CAAC,WAAW,CAAC;QAEhC,OAAO,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC;IAClF,CAAC;IAEO,iBAAiB,CAAC,UAAyB;QACjD,OAAO,GAAG,kBAAkB,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC;IACpD,CAAC;IAEO,aAAa,CAAI,KAA2B,EAAE,OAAgB;QACpE,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;YACvC,OAAO,MAAM,CAAC,KAAK,EAAE,OAAO,CAAU,CAAC;QAEzC,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Diagnostic\r\n */\r\n\r\nimport { Localization } from \"@itwin/core-common\";\r\nimport { AnyDiagnostic } from \"./Diagnostic\";\r\n\r\nimport * as assert from \"assert\";\r\n\r\nconst translationNamespace = \"ECSchemaMetaData\";\r\nconst subTranslationNamespace = \"Diagnostics\";\r\nconst baseTranslationKey = `${translationNamespace}:${subTranslationNamespace}`;\r\n\r\n/**\r\n * Interface used to report [[IDiagnostic]] objects created during schema validation.\r\n * @beta\r\n */\r\nexport interface IDiagnosticReporter {\r\n /**\r\n * A map where the key is a schema full name and the value is a collection\r\n * of diagnostics codes identifying which rules violations to ignore during validation.\r\n */\r\n suppressions?: Map<string, string[]>;\r\n\r\n /** The localization object to use for message translation. */\r\n localization?: Localization;\r\n\r\n /**\r\n * Handles the given [[IDiagnostic]] based on the implementation requirements for a\r\n * given reporter.\r\n * @param diagnostic The diagnostic to report.\r\n */\r\n report(diagnostic: AnyDiagnostic): void;\r\n}\r\n\r\n/**\r\n * An abstract base class for [[IDiagnosticReporter]] implementation that used the\r\n * provided Map to suppress certain rule violations from being reported. The Map's key\r\n * a schema full name, and the Map's value is a collection of rule codes to suppress.\r\n * @beta\r\n */\r\nexport abstract class SuppressionDiagnosticReporter implements IDiagnosticReporter {\r\n private _suppressions?: Map<string, string[]>;\r\n\r\n /**\r\n * Initializes a new SuppressionDiagnosticReporter\r\n * @param suppressions A Map where the key is a schema full name and the value is collection of diagnostic codes to suppress.\r\n */\r\n constructor(suppressions?: Map<string, string[]>) {\r\n this._suppressions = suppressions;\r\n }\r\n\r\n /**\r\n * Gets the collection of ISchemaDiagnosticSuppression objects that identify\r\n * rules violations to ignore during validation.\r\n */\r\n public get suppressions(): Map<string, string[]> | undefined {\r\n return this._suppressions;\r\n }\r\n\r\n /**\r\n * Prior to reporting the [[IDiagnostic]], the diagnostic message is formatted (with translations)\r\n * base on arguments contained in the diagnostic. Calls reportDiagnostic after the message is formatted.\r\n * @param diagnostic The diagnostic to report.\r\n */\r\n public report(diagnostic: AnyDiagnostic) {\r\n if (this._suppressions && this._suppressions.has(diagnostic.schema.fullName)) {\r\n const suppressedCodes = this._suppressions.get(diagnostic.schema.fullName);\r\n if (suppressedCodes!.includes(diagnostic.code))\r\n return;\r\n }\r\n\r\n this.reportInternal(diagnostic);\r\n }\r\n\r\n /**\r\n * Handles the given [[IDiagnostic]] based on the implementation requirements for a\r\n * given reporter.\r\n * @param diagnostic The diagnostic to report.\r\n */\r\n protected abstract reportInternal(diagnostic: AnyDiagnostic): void;\r\n}\r\n\r\n/**\r\n * An abstract [[SuppressionDiagnosticReporter]] implementation that formats the\r\n * diagnostic message with the message args. If a Localization implementation is specified,\r\n * the message will also be translated.\r\n * @beta\r\n */\r\nexport abstract class FormatDiagnosticReporter extends SuppressionDiagnosticReporter {\r\n /**\r\n * Initializes a new FormatDiagnosticReporter\r\n * @param suppressions A Map where the key is a schema full name and the value is collection of diagnostic codes to suppress.\r\n * @param localization The Localization instance to use to translate validation messages.\r\n */\r\n constructor(suppressions?: Map<string, string[]>, localization?: Localization) {\r\n super(suppressions);\r\n this.localization = localization;\r\n }\r\n\r\n /** The Localization object to use for message translation. If undefined, no translation will occur. */\r\n public localization?: Localization;\r\n\r\n /**\r\n * Prior to reporting the [[IDiagnostic]], the diagnostic message is formatted (with translations)\r\n * base on arguments contained in the diagnostic. Calls reportDiagnostic after the message is formatted.\r\n * @param diagnostic The diagnostic to report.\r\n */\r\n public reportInternal(diagnostic: AnyDiagnostic) {\r\n const message = this.formatMessage(diagnostic);\r\n this.reportDiagnostic(diagnostic, message);\r\n }\r\n\r\n /**\r\n * Handles the given [[IDiagnostic]] based on the implementation requirements for a\r\n * given reporter.\r\n * @param diagnostic The diagnostic to report.\r\n * @param messageText The formatted message.\r\n */\r\n protected abstract reportDiagnostic(diagnostic: AnyDiagnostic, messageText: string): void;\r\n\r\n /**\r\n * Helper method that formats string with provided arguments where the place holders\r\n * are in the the format '{0}', '{1}', etc.\r\n * @param text The text to format.\r\n * @param args The arguments to place in the text.\r\n * @param baseIndex The base index for the args, used for validation (typically 0, which is the default).\r\n */\r\n protected formatStringFromArgs(text: string, args: ArrayLike<string>, baseIndex = 0): string {\r\n return text.replace(/{(\\d+)}/g, (_match, index: string) => this.assertDefined(args[+index + baseIndex]));\r\n }\r\n\r\n private formatMessage(diagnostic: AnyDiagnostic): string {\r\n let translatedMessage = this.translateMessage(diagnostic);\r\n\r\n if (diagnostic.messageArgs && diagnostic.messageArgs.length > 0)\r\n translatedMessage = this.formatStringFromArgs(translatedMessage, diagnostic.messageArgs);\r\n return translatedMessage;\r\n }\r\n\r\n private translateMessage(diagnostic: AnyDiagnostic): string {\r\n if (!this.localization)\r\n return diagnostic.messageText;\r\n\r\n return this.localization.getLocalizedString(this.getTranslationKey(diagnostic));\r\n }\r\n\r\n private getTranslationKey(diagnostic: AnyDiagnostic): string {\r\n return `${baseTranslationKey}.${diagnostic.code}`;\r\n }\r\n\r\n private assertDefined<T>(value: T | null | undefined, message?: string): T {\r\n if (value === undefined || value === null)\r\n return assert(false, message) as never;\r\n\r\n return value;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ECRules.js","sourceRoot":"","sources":["../../../src/Validation/ECRules.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAC2E,eAAe,EAC/F,iBAAiB,EAAE,WAAW,EAAe,KAAK,EAAqB,aAAa,EAAE,qBAAqB,EACtD,wBAAwB,EAAU,WAAW,EAAE,cAAc,EAClH,iBAAiB,EAAE,yBAAyB,GAC7C,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACY,0BAA0B,EAAE,6CAA6C,EAAE,6BAA6B,EACzH,2CAA2C,EAAE,2BAA2B,EAAE,+BAA+B,GAG1G,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,GAAG,WAAW,CAAC;AAEhC,SAAS,OAAO,CAAC,IAAY;IAC3B,O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CAAC,gBAAgB,CAAC,MAAM,CAAC;IAE/F,OAAO,qBAAqB,CAAC,cAAc,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Validation\n */\n\nimport {\n AnyClass, AnyProperty, CustomAttribute, CustomAttributeContainerProps, ECClass, ECClassModifier,\n ECStringConstants, EntityClass, Enumeration, Mixin, 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 primitiveType = getPrimitiveType(property);\n if (!primitiveType)\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 // Other rules will catch this if false, but we need to make sure\n // types match for this rule to be valid.\n if (!propertyTypesMatch(property, baseProperty))\n return;\n\n const baseType = getPrimitiveType(baseProperty);\n\n // Return if rule passed\n if (!baseType || primitiveType === baseType)\n return;\n\n return new Diagnostics.IncompatibleValueTypePropertyOverride(property, [property.class.fullName, property.name, baseClass.fullName, primitiveTypeToString(baseType), primitiveTypeToString(primitiveType!)]);\n }\n\n for await (const baseClass of property.class.getAllBaseClasses()) {\n const result = await callback(baseClass);\n if (result)\n yield result;\n }\n}\n\n/**\n * EC Rule: When overriding a class property, the child and base property must be of the same property type (primitive, struct, enumeration, etc...).\n * @internal\n */\nexport async function* incompatibleTypePropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\n if (!property.class.baseClass)\n return;\n\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\n const baseProperty = await baseClass.getProperty(property.name, true);\n if (!baseProperty)\n return;\n\n // Return if rule passed\n if (propertyTypesMatch(property, baseProperty))\n return;\n\n return new Diagnostics.IncompatibleTypePropertyOverride(property, [property.class.fullName, property.name, baseClass.fullName, baseProperty.constructor.name, property.constructor.name]);\n }\n\n for await (const baseClass of property.class.getAllBaseClasses()) {\n const result = await callback(baseClass);\n if (result)\n yield result;\n }\n}\n\n/**\n * EC Rule: When overriding a kindOfQuantity property, the child and base property units must be the same.\n * @internal\n */\nexport async function* incompatibleUnitPropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\n if (!property.kindOfQuantity || !property.class.baseClass)\n return;\n\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\n const baseProperty = await baseClass.getProperty(property.name, true);\n if (!baseProperty || !baseProperty.kindOfQuantity)\n return;\n\n // Other rules will catch this if false, but we need to make sure\n // types match for this rule to be valid.\n if (!propertyTypesMatch(property, baseProperty))\n return;\n\n const koq = await property.kindOfQuantity;\n const baseKoq = await baseProperty.kindOfQuantity;\n if (!koq || !baseKoq)\n return;\n\n const unit = await koq.persistenceUnit;\n const baseUnit = await baseKoq.persistenceUnit;\n\n if (!unit || !baseUnit)\n return;\n\n // return if rule passed\n if (unit.key.matches(baseUnit.key))\n return;\n\n return new Diagnostics.IncompatibleUnitPropertyOverride(property, [\n property.class.fullName,\n property.name,\n baseClass.fullName,\n baseKoq.fullName,\n baseUnit.fullName,\n unit.fullName,\n koq.fullName,\n ]);\n }\n\n for await (const baseClass of property.class.getAllBaseClasses()) {\n const result = await callback(baseClass);\n if (result)\n yield result;\n }\n}\n\n/**\n * Validates Navigation Properties. EC Rules: 1303, 1304\n * @internal\n */\nexport async function* validateNavigationProperty(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\n if (!property.isNavigation())\n return;\n\n const navProp = property;\n const relationship = await navProp.relationshipClass;\n\n if (relationship.baseClass)\n yield new Diagnostics.NavigationRelationshipMustBeRoot(property, [property.fullName, relationship.fullName]);\n\n let thisConstraint: RelationshipConstraint;\n let thatConstraint: RelationshipConstraint;\n let navigationClassSide: string;\n if (navProp.direction === StrengthDirection.Forward) {\n thisConstraint = relationship.source;\n thatConstraint = relationship.target;\n navigationClassSide = \"source\";\n } else {\n thisConstraint = relationship.target;\n thatConstraint = relationship.source;\n navigationClassSide = \"target\";\n }\n\n const thatAbstractConstraint = await thatConstraint.abstractConstraint;\n if (thatAbstractConstraint && thatAbstractConstraint.schemaItemType === SchemaItemType.RelationshipClass) {\n yield new Diagnostics.NavigationRelationshipAbstractConstraintEntityOrMixin(property, [property.fullName, relationship.fullName]);\n }\n\n const isClassSupported = async (ecClass: ECClass, propertyName: string, constraintName: string): Promise<boolean> => {\n if (constraintName === ecClass.fullName && undefined !== await ecClass.getProperty(propertyName, true))\n return true;\n\n const inheritedProp = await ecClass.getInheritedProperty(propertyName);\n if (inheritedProp && constraintName === inheritedProp.class.fullName)\n return true;\n\n const baseClass = await ecClass.baseClass;\n if (!baseClass)\n return false;\n\n return isClassSupported(baseClass, propertyName, constraintName);\n };\n\n let classSupported = false;\n if (thisConstraint.constraintClasses) {\n for (const constraintClass of thisConstraint.constraintClasses) {\n classSupported = await isClassSupported(property.class, property.name, constraintClass.fullName);\n if (classSupported)\n break;\n }\n }\n\n if (!classSupported)\n yield new Diagnostics.NavigationClassMustBeAConstraintClassOfRelationship(property, [property.class.name, property.name, relationship.fullName, navigationClassSide]);\n\n if (thatConstraint.multiplicity === RelationshipMultiplicity.oneMany || thatConstraint.multiplicity === RelationshipMultiplicity.zeroMany) {\n const direction = strengthDirectionToString(navProp.direction);\n yield new Diagnostics.NavigationTargetMustHaveSingularMultiplicity(property, [property.fullName, relationship.fullName, direction]);\n }\n\n return;\n}\n\n/**\n * Validates a Relationship class and yields EC-1500, EC-1501, and EC-1502 rule violations.\n * @internal\n */\nexport async function* validateRelationship(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\n yield* abstractConstraintMustNarrowBaseConstraints(ecClass);\n yield* derivedConstraintsMustNarrowBaseConstraints(ecClass);\n yield* constraintClassesDeriveFromAbstractConstraint(ecClass);\n}\n\n/**\n * EC Rule: When overriding a RelationshipClass, the derived abstract constraint must narrow the base constraint classes.\n * @internal\n */\nexport async function* abstractConstraintMustNarrowBaseConstraints(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\n if (!ecClass.baseClass)\n return;\n\n const baseRelationship = await ecClass.baseClass as RelationshipClass;\n\n const sourceResult = await applyAbstractConstraintMustNarrowBaseConstraints(ecClass, ecClass.source, baseRelationship);\n if (sourceResult)\n yield sourceResult;\n const targetResult = await applyAbstractConstraintMustNarrowBaseConstraints(ecClass, ecClass.target, baseRelationship);\n if (targetResult)\n yield targetResult;\n}\n\n/**\n * EC Rule: When overriding a RelationshipClass, derived constraint classes must narrow base constraint classes.\n * @internal\n */\nexport async function* derivedConstraintsMustNarrowBaseConstraints(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\n if (!ecClass.baseClass)\n return;\n\n const baseRelationship = await ecClass.baseClass as RelationshipClass;\n\n const sourceResult = await applyDerivedConstraintsMustNarrowBaseConstraints(ecClass, ecClass.source, baseRelationship);\n if (sourceResult)\n yield sourceResult;\n const targetResult = await applyDerivedConstraintsMustNarrowBaseConstraints(ecClass, ecClass.target, baseRelationship);\n if (targetResult)\n yield targetResult;\n}\n\n/**\n * EC Rule: All constraint classes must have a common base class specified in the abstract constraint.\n * @internal\n */\nexport async function* constraintClassesDeriveFromAbstractConstraint(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\n const sourceResult = await applyConstraintClassesDeriveFromAbstractConstraint(ecClass, ecClass.source);\n if (sourceResult)\n yield sourceResult;\n const targetResult = await applyConstraintClassesDeriveFromAbstractConstraint(ecClass, ecClass.target);\n if (targetResult)\n yield targetResult;\n}\n\n/**\n * Validates a RelationshipConstraint and yields EC-1600 and EC-1601 rule violations.\n * @internal\n */\nexport async function* validateRelationshipConstraint(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\n yield* atLeastOneConstraintClassDefined(constraint);\n yield* abstractConstraintMustExistWithMultipleConstraints(constraint);\n}\n\n/**\n * EC Rule: At least on concrete constraint class must be defined in the list of constraint classes.\n * @internal\n */\nexport async function* atLeastOneConstraintClassDefined(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\n if (!constraint.constraintClasses || constraint.constraintClasses.length === 0) {\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n yield new Diagnostics.AtLeastOneConstraintClassDefined(constraint, [constraintType, constraint.relationshipClass.fullName]);\n }\n}\n\n/**\n * EC Rule: If multiple constraints exist, an abstract constraint must be defined.\n * @internal\n */\nexport async function* abstractConstraintMustExistWithMultipleConstraints(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\n if (!constraint.constraintClasses || constraint.constraintClasses.length <= 1) {\n return;\n }\n\n const abstractConstraint = await getAbstractConstraint(constraint);\n if (abstractConstraint)\n return;\n\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n yield new Diagnostics.AbstractConstraintMustExistWithMultipleConstraints(constraint, [constraintType, constraint.relationshipClass.fullName]);\n}\n\nfunction propertyTypesMatch(propertyA: Property, propertyB: Property) {\n return propertyA.constructor.name === propertyB.constructor.name;\n}\n\nfunction getPrimitiveType(property: Property): PrimitiveType | undefined {\n if (property.isPrimitive())\n return (property as PrimitiveProperty).primitiveType;\n\n return undefined;\n}\n\n/**\n * EC Rule: Enumeration type must be a string or integer\n * @internal\n */\nexport async function* enumerationTypeUnsupported(enumeration: Enumeration): AsyncIterable<SchemaItemDiagnostic<Enumeration, any[]>> {\n const type = enumeration.type;\n if (type === PrimitiveType.Integer || type === PrimitiveType.String)\n return;\n\n yield new Diagnostics.EnumerationTypeUnsupported(enumeration, [enumeration.fullName]);\n}\n\n/**\n * EC Rule: Mixin applied to class must derived from the Mixin appliesTo constraint.\n * @internal\n */\nexport async function* mixinAppliedToClassMustDeriveFromConstraint(entityClass: EntityClass): AsyncIterable<SchemaItemDiagnostic<EntityClass, any[]>> {\n for (const lazyMixin of entityClass.mixins) {\n const mixin = await lazyMixin;\n if (!mixin.appliesTo)\n continue;\n\n if (!await entityClass.is(await mixin.appliesTo))\n yield new Diagnostics.MixinAppliedToClassMustDeriveFromConstraint(entityClass, [mixin.fullName, entityClass.fullName, mixin.appliesTo.fullName]);\n }\n\n return;\n}\n\n/**\n * Validates a custom attribute instance and yields EC-500, EC-501, and EC-502 rule violations.\n * @internal\n */\nexport async function* validateCustomAttributeInstance(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\n yield* customAttributeNotOfConcreteClass(container, customAttribute);\n yield* customAttributeSchemaMustBeReferenced(container, customAttribute);\n yield* customAttributeClassMustExist(container, customAttribute);\n}\n\n/** EC Rule: CustomAttribute instance must be of a concrete CustomAttributeClass. */\nasync function* customAttributeNotOfConcreteClass(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\n const schema = container.schema;\n const caClass = await schema.lookupItem(customAttribute.className) as ECClass;\n if (!caClass)\n return;\n\n if (caClass.modifier !== ECClassModifier.Abstract)\n return;\n\n yield new Diagnostics.CustomAttributeNotOfConcreteClass(container, [container.fullName, caClass.fullName]);\n}\n\n/** EC Rule: CustomAttribute Schema must be referenced by the container's Schema. */\nasync function* customAttributeSchemaMustBeReferenced(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\n const schema = container.schema;\n const nameParts = customAttribute.className.split(\".\");\n if (nameParts.length === 1 || nameParts[0] === schema.name)\n return;\n\n if (schema.references.some((s) => s.name === nameParts[0]))\n return;\n\n yield new Diagnostics.CustomAttributeSchemaMustBeReferenced(container, [container.fullName, customAttribute.className]);\n}\n\n/** EC Rule: CustomAttribute instance class must exist. */\nasync function* customAttributeClassMustExist(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\n const schema = container.schema;\n const caClass = await schema.lookupItem(customAttribute.className) as ECClass;\n if (!caClass)\n yield new Diagnostics.CustomAttributeClassNotFound(container, [container.fullName, customAttribute.className]);\n}\n\nasync function applyAbstractConstraintMustNarrowBaseConstraints(ecClass: RelationshipClass, constraint: RelationshipConstraint, baseRelationship: RelationshipClass): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\n const abstractConstraint = await constraint.abstractConstraint;\n if (!abstractConstraint)\n return;\n\n if (await baseConstraint.supportsClass(abstractConstraint))\n return;\n\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n return new Diagnostics.AbstractConstraintMustNarrowBaseConstraints(ecClass, [abstractConstraint.fullName, constraintType, constraint.relationshipClass.fullName, baseRelationship.fullName]);\n}\n\nasync function applyDerivedConstraintsMustNarrowBaseConstraints(ecClass: RelationshipClass, constraint: RelationshipConstraint, baseRelationship: RelationshipClass): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\n\n if (!constraint.constraintClasses)\n return;\n\n for (const classPromise of constraint.constraintClasses) {\n const constraintClass = await classPromise;\n\n if (await baseConstraint.supportsClass(constraintClass))\n continue;\n\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n return new Diagnostics.DerivedConstraintsMustNarrowBaseConstraints(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, baseRelationship.fullName]);\n }\n\n return;\n}\n\nasync function applyConstraintClassesDeriveFromAbstractConstraint(ecClass: RelationshipClass, constraint: RelationshipConstraint): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\n const abstractConstraint = await getAbstractConstraint(constraint);\n if (!abstractConstraint)\n return;\n\n if (!constraint.constraintClasses)\n return;\n\n for (const classPromise of constraint.constraintClasses) {\n const constraintClass = await classPromise;\n\n if (Mixin.isMixin(constraintClass) && EntityClass.isEntityClass(abstractConstraint)) {\n if (!await (constraintClass).applicableTo(abstractConstraint)) {\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n return new Diagnostics.ConstraintClassesDeriveFromAbstractConstraint(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, abstractConstraint.fullName]);\n }\n continue;\n }\n\n if (!await constraintClass.is(abstractConstraint)) {\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\n return new Diagnostics.ConstraintClassesDeriveFromAbstractConstraint(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, abstractConstraint.fullName]);\n }\n }\n\n return;\n}\n\nasync function getAbstractConstraint(constraint: RelationshipConstraint): Promise<ECClass | undefined> {\n const abstractConstraint = await constraint.abstractConstraint;\n if (abstractConstraint)\n return abstractConstraint;\n\n const baseRelationship = await constraint.relationshipClass.baseClass as RelationshipClass;\n if (!baseRelationship)\n return;\n\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\n\n return getAbstractConstraint(baseConstraint);\n}\n"]}
1
+ {"version":3,"file":"ECRules.js","sourceRoot":"","sources":["../../../src/Validation/ECRules.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAC2E,eAAe,EAC/F,iBAAiB,EAAE,WAAW,EAAe,KAAK,EAAqB,aAAa,EAAE,qBAAqB,EACtD,wBAAwB,EAAU,WAAW,EAAE,cAAc,EAClH,iBAAiB,EAAE,yBAAyB,GAC7C,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACY,0BAA0B,EAAE,6CAA6C,EAAE,6BAA6B,EACzH,2CAA2C,EAAE,2BAA2B,EAAE,+BAA+B,GAG1G,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,GAAG,WAAW,C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CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC;IAE/F,OAAO,qBAAqB,CAAC,cAAc,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Validation\r\n */\r\n\r\nimport {\r\n AnyClass, AnyProperty, CustomAttribute, CustomAttributeContainerProps, ECClass, ECClassModifier,\r\n ECStringConstants, EntityClass, Enumeration, Mixin, PrimitiveProperty, PrimitiveType, primitiveTypeToString,\r\n Property, RelationshipClass, RelationshipConstraint, RelationshipMultiplicity, Schema, SchemaGraph, SchemaItemType,\r\n StrengthDirection, strengthDirectionToString,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport {\r\n ClassDiagnostic, createClassDiagnosticClass, createCustomAttributeContainerDiagnosticClass, createPropertyDiagnosticClass,\r\n createRelationshipConstraintDiagnosticClass, createSchemaDiagnosticClass, createSchemaItemDiagnosticClass, CustomAttributeContainerDiagnostic,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n DiagnosticType, PropertyDiagnostic, RelationshipConstraintDiagnostic, SchemaDiagnostic, SchemaItemDiagnostic,\r\n} from \"./Diagnostic\";\r\nimport { IRuleSet } from \"./Rules\";\r\n\r\nconst ruleSetName = \"ECObjects\";\r\n\r\nfunction getCode(code: number): string {\r\n return `${ruleSetName}-${code}`;\r\n}\r\n\r\n/**\r\n * The unique diagnostic codes for ECObjects rules.\r\n *\r\n * To provide meaning to code values, with anticipation\r\n * of future rules for all current EC Types, the following\r\n * value ranges should be used:\r\n *\r\n * - Schema: 000-099\r\n * - Class: 100-199\r\n * - Constant: 200-299\r\n * - CustomAttribute 300-399\r\n * - CustomAttributeClass: 400-499\r\n * - CustomAttributeContainer: 500-599\r\n * - EntityClass: 600-699\r\n * - Enumeration: 700-799\r\n * - Format: 800-899\r\n * - InvertedUnit: 900-999\r\n * - KindOfQuantity: 1000-1099\r\n * - Mixin: 1100-1199\r\n * - Phenomenon: 1200-1299\r\n * - Property: 1300-1399\r\n * - PropertyCategory: 1400-1499\r\n * - RelationshipClass: 1500-1599\r\n * - RelationshipConstraint: 1600-1699\r\n * - StructClass: 1700-1799\r\n * - Unit: 1800-1899\r\n * - UnitSystem: 1900-1999\r\n * @beta\r\n */\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\nexport const DiagnosticCodes = {\r\n // Class Rule Codes (100-199)\r\n BaseClassIsSealed: getCode(100),\r\n BaseClassOfDifferentType: getCode(101),\r\n // EC-102 has been deprecated. Leaving the code here to prevent re-use.\r\n AbstractClassWithNonAbstractBase: getCode(102),\r\n\r\n // CA Container Rule Codes (500-599)\r\n CustomAttributeNotOfConcreteClass: getCode(500),\r\n CustomAttributeSchemaMustBeReferenced: getCode(501),\r\n CustomAttributeClassNotFound: getCode(502),\r\n\r\n // Enumeration Rule Codes (700-799)\r\n EnumerationTypeUnsupported: getCode(700),\r\n\r\n // Mixin Rule Codes (1100-1199)\r\n MixinAppliedToClassMustDeriveFromConstraint: getCode(1100),\r\n\r\n // Property Rule Codes (1300-1399)\r\n IncompatibleValueTypePropertyOverride: getCode(1300),\r\n IncompatibleTypePropertyOverride: getCode(1301),\r\n IncompatibleUnitPropertyOverride: getCode(1302),\r\n\r\n // Relationship Rule Codes (1500-1599)\r\n AbstractConstraintMustNarrowBaseConstraints: getCode(1500),\r\n DerivedConstraintsMustNarrowBaseConstraints: getCode(1501),\r\n ConstraintClassesDeriveFromAbstractConstraint: getCode(1502),\r\n\r\n // Relationship Constraint Rule Codes (1600-1699)\r\n AtLeastOneConstraintClassDefined: getCode(1600),\r\n AbstractConstraintMustExistWithMultipleConstraints: getCode(1601),\r\n};\r\n\r\n/**\r\n * The list of [[IDiagnostic]] implementation classes used by the EC rule implementations.\r\n * @beta\r\n */\r\nexport const Diagnostics = {\r\n /** EC-001: Required message parameters: schema name, referenced schema name */\r\n SupplementalSchemasCannotBeReferenced: createSchemaDiagnosticClass<[string, string]>(getCode(1),\r\n \"Referenced schema '{1}' of schema '{0}' is a supplemental schema. Supplemental schemas are not allowed to be referenced.\"),\r\n\r\n /** EC-002: Required message parameters: schema name, reference schema alias, first schema reference name, second schema reference name. */\r\n SchemaRefAliasMustBeUnique: createSchemaDiagnosticClass<[string, string, string, string]>(getCode(2),\r\n \"Schema '{0}' has multiple schema references ({2}, {3}) with the same alias '{1}', which is not allowed.\"),\r\n\r\n /** EC-003: Required message parameters: schema name, cycle text */\r\n ReferenceCyclesNotAllowed: createSchemaDiagnosticClass<[string, string]>(getCode(3),\r\n \"Schema '{0}' has reference cycles: {1}\"),\r\n\r\n /** EC-100: Required message parameters: childClass.FullName, baseClass.FullName */\r\n BaseClassIsSealed: createClassDiagnosticClass<[string, string]>(DiagnosticCodes.BaseClassIsSealed,\r\n \"Class '{0}' cannot derive from sealed base class '{1}'.\"),\r\n\r\n /** EC-101: Required message parameters: childClass.FullName, baseClass.FullName, baseClass.schemaItemType */\r\n BaseClassIsOfDifferentType: createClassDiagnosticClass<[string, string, string]>(DiagnosticCodes.BaseClassOfDifferentType,\r\n \"Class '{0}' cannot derive from base class '{1}' of type '{2}'.\"),\r\n\r\n /** **DEPRECATED** EC-102: Required message parameters: childClass.FullName, baseClass.FullName */\r\n AbstractClassWithNonAbstractBase: createClassDiagnosticClass<[string, string]>(DiagnosticCodes.AbstractClassWithNonAbstractBase,\r\n \"Abstract Class '{0}' cannot derive from base class '{1}' because it is not an abstract class.\"),\r\n\r\n /** EC-500: Required message parameters: CustomAttribute container name and CustomAttributeClass name. */\r\n CustomAttributeNotOfConcreteClass: createCustomAttributeContainerDiagnosticClass<[string, string]>(DiagnosticCodes.CustomAttributeNotOfConcreteClass,\r\n \"The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' which is not a concrete class.\"),\r\n\r\n /** EC-501: Required message parameters: CustomAttribute container name, CustomAttributeClass name, CustomAttributeClass Schema name. */\r\n CustomAttributeSchemaMustBeReferenced: createCustomAttributeContainerDiagnosticClass<[string, string]>(DiagnosticCodes.CustomAttributeSchemaMustBeReferenced,\r\n \"The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' whose schema is not referenced by the container's Schema.\"),\r\n\r\n /** EC-502: Required message parameters: CustomAttribute container name and CustomAttributeClass name. */\r\n CustomAttributeClassNotFound: createCustomAttributeContainerDiagnosticClass<[string, string]>(DiagnosticCodes.CustomAttributeClassNotFound,\r\n \"The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' which cannot be found.\"),\r\n\r\n /** EC-700: Required message parameters: Enumeration name */\r\n EnumerationTypeUnsupported: createSchemaItemDiagnosticClass<Enumeration, [string]>(DiagnosticCodes.EnumerationTypeUnsupported,\r\n \"Enumeration '{0}' has invalid primitive type.\"),\r\n\r\n /** EC-1100: Required message parameters: mixin class fullName, class fullName, applies to constraint class fullName */\r\n MixinAppliedToClassMustDeriveFromConstraint: createSchemaItemDiagnosticClass<EntityClass, [string, string, string]>(DiagnosticCodes.MixinAppliedToClassMustDeriveFromConstraint,\r\n \"Mixin '{0}' cannot be applied to the class '{1}' because it does not satisfy the applies to constraint '{2}'.\"),\r\n\r\n /** EC-1300: Required message parameters: childClass.FullName, property name, baseClass.FullName, base value type, child value type */\r\n IncompatibleValueTypePropertyOverride: createPropertyDiagnosticClass<[string, string, string, string, string]>(DiagnosticCodes.IncompatibleValueTypePropertyOverride,\r\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}.\"),\r\n\r\n /** EC-1301: Required message parameters: childClass.FullName, property name, baseClass.FullName, base property type, child property type */\r\n IncompatibleTypePropertyOverride: createPropertyDiagnosticClass<[string, string, string, string, string]>(DiagnosticCodes.IncompatibleTypePropertyOverride,\r\n \"The ECProperty '{0}.{1}' has a base property '{2}.{1}' with a type of {3} which is incompatible with the type of {4}.\"),\r\n\r\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 */\r\n IncompatibleUnitPropertyOverride: createPropertyDiagnosticClass<[string, string, string, string, string, string, string]>(DiagnosticCodes.IncompatibleUnitPropertyOverride,\r\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}'.\"),\r\n\r\n /** EC-1303: Required message parameters: property.fullName, navigation relationship.fullName */\r\n NavigationRelationshipMustBeRoot: createPropertyDiagnosticClass<[string, string]>(getCode(1303),\r\n \"The referenced relationship '{1}', used in NavigationProperty '{0}' is not the root relationship.\"),\r\n\r\n /** EC-1304: Required message parameters: property.fullName, navigation relationship.fullName */\r\n NavigationTargetMustHaveSingularMultiplicity: createPropertyDiagnosticClass<[string, string, string]>(getCode(1304),\r\n \"NavigationProperty '{0}' uses the relationship '{1}' that cannot be traversed in the '{2}' direction due to a max multiplicity greater than 1.\"),\r\n\r\n /** EC-1305: Required message parameters: property.fullName, navigation relationship.fullName */\r\n NavigationRelationshipAbstractConstraintEntityOrMixin: createPropertyDiagnosticClass<[string, string]>(getCode(1305),\r\n \"The NavigationProperty '{0}', using the relationship '{1}', points to a RelationshipClass, which is not allowed. NavigationProperties must point to an EntityClass or Mixin.\"),\r\n\r\n /** EC-1306: Required message parameters: class name, property name, navigation relationship.fullName */\r\n NavigationClassMustBeAConstraintClassOfRelationship: createPropertyDiagnosticClass<[string, string, string, string]>(getCode(1306),\r\n \"The class '{0}' of NavigationProperty '{1}' is not supported by the {3} constraint of the referenced relationship '{2}'.\"),\r\n\r\n /** EC-1500: Required message parameters: abstract constraint class name, relationship end (source/target), relationship name, base relationship name */\r\n AbstractConstraintMustNarrowBaseConstraints: createSchemaItemDiagnosticClass<RelationshipClass, [string, string, string, string]>(DiagnosticCodes.AbstractConstraintMustNarrowBaseConstraints,\r\n \"The abstract constraint class '{0}' on the {1}-Constraint of '{2}' is not supported by the base class constraint in '{3}'.\"),\r\n\r\n /** EC-1501: Required message parameters: constraint class name, relationship end (source/target), relationship name, base relationship name */\r\n DerivedConstraintsMustNarrowBaseConstraints: createSchemaItemDiagnosticClass<RelationshipClass, [string, string, string, string]>(DiagnosticCodes.DerivedConstraintsMustNarrowBaseConstraints,\r\n \"The constraint class '{0}' on the {1}-Constraint of '{2}' is not supported by the base class constraint in '{3}'.\"),\r\n\r\n /** EC-1502: Required message parameters: constraint class name, relationship end (source/target), relationship name, abstract constraint class name */\r\n ConstraintClassesDeriveFromAbstractConstraint: createSchemaItemDiagnosticClass<RelationshipClass, [string, string, string, string]>(DiagnosticCodes.ConstraintClassesDeriveFromAbstractConstraint,\r\n \"The constraint class '{0}' on the {1}-Constraint of '{2}' is not derived from the abstract constraint class '{3}'.\"),\r\n\r\n /** EC-1600: Required message parameters: relationship end (source/target), relationship name */\r\n AtLeastOneConstraintClassDefined: createRelationshipConstraintDiagnosticClass<[string, string]>(DiagnosticCodes.AtLeastOneConstraintClassDefined,\r\n \"The {0}-Constraint of '{1}' does not contain any constraint classes.\"),\r\n\r\n /** EC-1601: Required message parameters: relationship end (source/target), relationship name */\r\n AbstractConstraintMustExistWithMultipleConstraints: createRelationshipConstraintDiagnosticClass<[string, string]>(DiagnosticCodes.AbstractConstraintMustExistWithMultipleConstraints,\r\n \"The {0}-Constraint of '{1}' has multiple constraint classes which requires an abstract constraint to be defined.\"),\r\n};\r\n\r\n/**\r\n * All schema validation rules that fall under the category of ECObjects.\r\n * @beta\r\n */\r\nexport const ECRuleSet: IRuleSet = {\r\n name: ruleSetName,\r\n\r\n schemaRules: [\r\n validateSchemaReferences,\r\n ],\r\n classRules: [\r\n baseClassIsSealed,\r\n baseClassIsOfDifferentType,\r\n ],\r\n propertyRules: [\r\n incompatibleValueTypePropertyOverride,\r\n incompatibleTypePropertyOverride,\r\n incompatibleUnitPropertyOverride,\r\n validateNavigationProperty,\r\n ],\r\n relationshipRules: [\r\n abstractConstraintMustNarrowBaseConstraints,\r\n constraintClassesDeriveFromAbstractConstraint,\r\n derivedConstraintsMustNarrowBaseConstraints,\r\n ],\r\n relationshipConstraintRules: [\r\n atLeastOneConstraintClassDefined,\r\n abstractConstraintMustExistWithMultipleConstraints,\r\n ],\r\n enumerationRules: [\r\n enumerationTypeUnsupported,\r\n ],\r\n entityClassRules: [\r\n mixinAppliedToClassMustDeriveFromConstraint,\r\n ],\r\n customAttributeInstanceRules: [\r\n validateCustomAttributeInstance,\r\n ],\r\n};\r\n\r\n/* eslint-enable @typescript-eslint/naming-convention */\r\n\r\n/**\r\n * Validates schema references against multiple EC rules.\r\n * @param schema The schema to validate.\r\n * @internal\r\n */\r\nexport async function* validateSchemaReferences(schema: Schema): AsyncIterable<SchemaDiagnostic<any[]>> {\r\n yield* validateSchemaReferencesSync(schema);\r\n}\r\n\r\n/**\r\n * Validates schema references against multiple EC rules.\r\n * @param schema The schema to validate.\r\n * @internal\r\n */\r\nexport function* validateSchemaReferencesSync(schema: Schema): Iterable<SchemaDiagnostic<any[]>> {\r\n const aliases = new Map();\r\n for (const schemaRef of schema.references) {\r\n if (schemaRef.customAttributes && schemaRef.customAttributes.has(\"CoreCustomAttributes.SupplementalSchema\"))\r\n yield new Diagnostics.SupplementalSchemasCannotBeReferenced(schema, [schema.name, schemaRef.name]);\r\n\r\n if (schema.schemaKey.matches(schemaRef.schemaKey))\r\n yield new Diagnostics.ReferenceCyclesNotAllowed(schema, [schema.name, `${schema.name} --> ${schemaRef.name}`]);\r\n\r\n if (aliases.has(schemaRef.alias)) {\r\n const currentRef = aliases.get(schemaRef.alias);\r\n yield new Diagnostics.SchemaRefAliasMustBeUnique(schema, [schema.name, schemaRef.alias, currentRef.name, schemaRef.name]);\r\n } else {\r\n aliases.set(schemaRef.alias, schemaRef);\r\n }\r\n }\r\n\r\n const graph = SchemaGraph.generateGraphSync(schema);\r\n const cycles = graph.detectCycles();\r\n if (cycles) {\r\n const result = cycles.map((cycle) => `${cycle.schema.schemaKey.name} --> ${cycle.refSchema.schemaKey.name}`).join(\", \");\r\n yield new Diagnostics.ReferenceCyclesNotAllowed(schema, [schema.name, result]);\r\n }\r\n}\r\n/**\r\n * EC Rule: Sealed classes cannot be a base class.\r\n * @internal\r\n */\r\nexport async function* baseClassIsSealed(ecClass: AnyClass): AsyncIterable<ClassDiagnostic<any[]>> {\r\n if (!ecClass.baseClass)\r\n return;\r\n\r\n const baseClass = await ecClass.baseClass;\r\n // return if rule passed\r\n if (baseClass.modifier !== ECClassModifier.Sealed)\r\n return;\r\n\r\n yield new Diagnostics.BaseClassIsSealed(ecClass, [ecClass.fullName, baseClass.fullName]);\r\n}\r\n\r\n/**\r\n * EC Rule: Base and child class must be of the same type (i.e. Entity, Mixin, Relationship, etc.)\r\n * @internal\r\n */\r\nexport async function* baseClassIsOfDifferentType(ecClass: AnyClass): AsyncIterable<ClassDiagnostic<any[]>> {\r\n if (!ecClass.baseClass)\r\n return;\r\n\r\n const baseClass = await ecClass.baseClass;\r\n // return if rule passed\r\n if (baseClass.schemaItemType === ecClass.schemaItemType)\r\n return;\r\n\r\n const itemType = baseClass.schemaItemType;\r\n yield new Diagnostics.BaseClassIsOfDifferentType(ecClass, [ecClass.fullName, baseClass.fullName, itemType]);\r\n}\r\n\r\n/**\r\n * EC Rule: When overriding a class primitive property, the child and base property must be of the same type (string, number, etc...).\r\n * @internal\r\n*/\r\nexport async function* incompatibleValueTypePropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\r\n if (!property.class.baseClass)\r\n return;\r\n\r\n const primitiveType = getPrimitiveType(property);\r\n if (!primitiveType)\r\n return;\r\n\r\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\r\n const baseProperty = await baseClass.getProperty(property.name, true);\r\n if (!baseProperty)\r\n return;\r\n\r\n // Other rules will catch this if false, but we need to make sure\r\n // types match for this rule to be valid.\r\n if (!propertyTypesMatch(property, baseProperty))\r\n return;\r\n\r\n const baseType = getPrimitiveType(baseProperty);\r\n\r\n // Return if rule passed\r\n if (!baseType || primitiveType === baseType)\r\n return;\r\n\r\n return new Diagnostics.IncompatibleValueTypePropertyOverride(property, [property.class.fullName, property.name, baseClass.fullName, primitiveTypeToString(baseType), primitiveTypeToString(primitiveType!)]);\r\n }\r\n\r\n for await (const baseClass of property.class.getAllBaseClasses()) {\r\n const result = await callback(baseClass);\r\n if (result)\r\n yield result;\r\n }\r\n}\r\n\r\n/**\r\n * EC Rule: When overriding a class property, the child and base property must be of the same property type (primitive, struct, enumeration, etc...).\r\n * @internal\r\n */\r\nexport async function* incompatibleTypePropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\r\n if (!property.class.baseClass)\r\n return;\r\n\r\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\r\n const baseProperty = await baseClass.getProperty(property.name, true);\r\n if (!baseProperty)\r\n return;\r\n\r\n // Return if rule passed\r\n if (propertyTypesMatch(property, baseProperty))\r\n return;\r\n\r\n return new Diagnostics.IncompatibleTypePropertyOverride(property, [property.class.fullName, property.name, baseClass.fullName, baseProperty.constructor.name, property.constructor.name]);\r\n }\r\n\r\n for await (const baseClass of property.class.getAllBaseClasses()) {\r\n const result = await callback(baseClass);\r\n if (result)\r\n yield result;\r\n }\r\n}\r\n\r\n/**\r\n * EC Rule: When overriding a kindOfQuantity property, the child and base property units must be the same.\r\n * @internal\r\n */\r\nexport async function* incompatibleUnitPropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\r\n if (!property.kindOfQuantity || !property.class.baseClass)\r\n return;\r\n\r\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\r\n const baseProperty = await baseClass.getProperty(property.name, true);\r\n if (!baseProperty || !baseProperty.kindOfQuantity)\r\n return;\r\n\r\n // Other rules will catch this if false, but we need to make sure\r\n // types match for this rule to be valid.\r\n if (!propertyTypesMatch(property, baseProperty))\r\n return;\r\n\r\n const koq = await property.kindOfQuantity;\r\n const baseKoq = await baseProperty.kindOfQuantity;\r\n if (!koq || !baseKoq)\r\n return;\r\n\r\n const unit = await koq.persistenceUnit;\r\n const baseUnit = await baseKoq.persistenceUnit;\r\n\r\n if (!unit || !baseUnit)\r\n return;\r\n\r\n // return if rule passed\r\n if (unit.key.matches(baseUnit.key))\r\n return;\r\n\r\n return new Diagnostics.IncompatibleUnitPropertyOverride(property, [\r\n property.class.fullName,\r\n property.name,\r\n baseClass.fullName,\r\n baseKoq.fullName,\r\n baseUnit.fullName,\r\n unit.fullName,\r\n koq.fullName,\r\n ]);\r\n }\r\n\r\n for await (const baseClass of property.class.getAllBaseClasses()) {\r\n const result = await callback(baseClass);\r\n if (result)\r\n yield result;\r\n }\r\n}\r\n\r\n/**\r\n * Validates Navigation Properties. EC Rules: 1303, 1304\r\n * @internal\r\n */\r\nexport async function* validateNavigationProperty(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\r\n if (!property.isNavigation())\r\n return;\r\n\r\n const navProp = property;\r\n const relationship = await navProp.relationshipClass;\r\n\r\n if (relationship.baseClass)\r\n yield new Diagnostics.NavigationRelationshipMustBeRoot(property, [property.fullName, relationship.fullName]);\r\n\r\n let thisConstraint: RelationshipConstraint;\r\n let thatConstraint: RelationshipConstraint;\r\n let navigationClassSide: string;\r\n if (navProp.direction === StrengthDirection.Forward) {\r\n thisConstraint = relationship.source;\r\n thatConstraint = relationship.target;\r\n navigationClassSide = \"source\";\r\n } else {\r\n thisConstraint = relationship.target;\r\n thatConstraint = relationship.source;\r\n navigationClassSide = \"target\";\r\n }\r\n\r\n const thatAbstractConstraint = await thatConstraint.abstractConstraint;\r\n if (thatAbstractConstraint && thatAbstractConstraint.schemaItemType === SchemaItemType.RelationshipClass) {\r\n yield new Diagnostics.NavigationRelationshipAbstractConstraintEntityOrMixin(property, [property.fullName, relationship.fullName]);\r\n }\r\n\r\n const isClassSupported = async (ecClass: ECClass, propertyName: string, constraintName: string): Promise<boolean> => {\r\n if (constraintName === ecClass.fullName && undefined !== await ecClass.getProperty(propertyName, true))\r\n return true;\r\n\r\n const inheritedProp = await ecClass.getInheritedProperty(propertyName);\r\n if (inheritedProp && constraintName === inheritedProp.class.fullName)\r\n return true;\r\n\r\n const baseClass = await ecClass.baseClass;\r\n if (!baseClass)\r\n return false;\r\n\r\n return isClassSupported(baseClass, propertyName, constraintName);\r\n };\r\n\r\n let classSupported = false;\r\n if (thisConstraint.constraintClasses) {\r\n for (const constraintClass of thisConstraint.constraintClasses) {\r\n classSupported = await isClassSupported(property.class, property.name, constraintClass.fullName);\r\n if (classSupported)\r\n break;\r\n }\r\n }\r\n\r\n if (!classSupported)\r\n yield new Diagnostics.NavigationClassMustBeAConstraintClassOfRelationship(property, [property.class.name, property.name, relationship.fullName, navigationClassSide]);\r\n\r\n if (thatConstraint.multiplicity === RelationshipMultiplicity.oneMany || thatConstraint.multiplicity === RelationshipMultiplicity.zeroMany) {\r\n const direction = strengthDirectionToString(navProp.direction);\r\n yield new Diagnostics.NavigationTargetMustHaveSingularMultiplicity(property, [property.fullName, relationship.fullName, direction]);\r\n }\r\n\r\n return;\r\n}\r\n\r\n/**\r\n * Validates a Relationship class and yields EC-1500, EC-1501, and EC-1502 rule violations.\r\n * @internal\r\n */\r\nexport async function* validateRelationship(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\r\n yield* abstractConstraintMustNarrowBaseConstraints(ecClass);\r\n yield* derivedConstraintsMustNarrowBaseConstraints(ecClass);\r\n yield* constraintClassesDeriveFromAbstractConstraint(ecClass);\r\n}\r\n\r\n/**\r\n * EC Rule: When overriding a RelationshipClass, the derived abstract constraint must narrow the base constraint classes.\r\n * @internal\r\n */\r\nexport async function* abstractConstraintMustNarrowBaseConstraints(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\r\n if (!ecClass.baseClass)\r\n return;\r\n\r\n const baseRelationship = await ecClass.baseClass as RelationshipClass;\r\n\r\n const sourceResult = await applyAbstractConstraintMustNarrowBaseConstraints(ecClass, ecClass.source, baseRelationship);\r\n if (sourceResult)\r\n yield sourceResult;\r\n const targetResult = await applyAbstractConstraintMustNarrowBaseConstraints(ecClass, ecClass.target, baseRelationship);\r\n if (targetResult)\r\n yield targetResult;\r\n}\r\n\r\n/**\r\n * EC Rule: When overriding a RelationshipClass, derived constraint classes must narrow base constraint classes.\r\n * @internal\r\n */\r\nexport async function* derivedConstraintsMustNarrowBaseConstraints(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\r\n if (!ecClass.baseClass)\r\n return;\r\n\r\n const baseRelationship = await ecClass.baseClass as RelationshipClass;\r\n\r\n const sourceResult = await applyDerivedConstraintsMustNarrowBaseConstraints(ecClass, ecClass.source, baseRelationship);\r\n if (sourceResult)\r\n yield sourceResult;\r\n const targetResult = await applyDerivedConstraintsMustNarrowBaseConstraints(ecClass, ecClass.target, baseRelationship);\r\n if (targetResult)\r\n yield targetResult;\r\n}\r\n\r\n/**\r\n * EC Rule: All constraint classes must have a common base class specified in the abstract constraint.\r\n * @internal\r\n */\r\nexport async function* constraintClassesDeriveFromAbstractConstraint(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\r\n const sourceResult = await applyConstraintClassesDeriveFromAbstractConstraint(ecClass, ecClass.source);\r\n if (sourceResult)\r\n yield sourceResult;\r\n const targetResult = await applyConstraintClassesDeriveFromAbstractConstraint(ecClass, ecClass.target);\r\n if (targetResult)\r\n yield targetResult;\r\n}\r\n\r\n/**\r\n * Validates a RelationshipConstraint and yields EC-1600 and EC-1601 rule violations.\r\n * @internal\r\n */\r\nexport async function* validateRelationshipConstraint(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\r\n yield* atLeastOneConstraintClassDefined(constraint);\r\n yield* abstractConstraintMustExistWithMultipleConstraints(constraint);\r\n}\r\n\r\n/**\r\n * EC Rule: At least on concrete constraint class must be defined in the list of constraint classes.\r\n * @internal\r\n */\r\nexport async function* atLeastOneConstraintClassDefined(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\r\n if (!constraint.constraintClasses || constraint.constraintClasses.length === 0) {\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n yield new Diagnostics.AtLeastOneConstraintClassDefined(constraint, [constraintType, constraint.relationshipClass.fullName]);\r\n }\r\n}\r\n\r\n/**\r\n * EC Rule: If multiple constraints exist, an abstract constraint must be defined.\r\n * @internal\r\n */\r\nexport async function* abstractConstraintMustExistWithMultipleConstraints(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\r\n if (!constraint.constraintClasses || constraint.constraintClasses.length <= 1) {\r\n return;\r\n }\r\n\r\n const abstractConstraint = await getAbstractConstraint(constraint);\r\n if (abstractConstraint)\r\n return;\r\n\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n yield new Diagnostics.AbstractConstraintMustExistWithMultipleConstraints(constraint, [constraintType, constraint.relationshipClass.fullName]);\r\n}\r\n\r\nfunction propertyTypesMatch(propertyA: Property, propertyB: Property) {\r\n return propertyA.constructor.name === propertyB.constructor.name;\r\n}\r\n\r\nfunction getPrimitiveType(property: Property): PrimitiveType | undefined {\r\n if (property.isPrimitive())\r\n return (property as PrimitiveProperty).primitiveType;\r\n\r\n return undefined;\r\n}\r\n\r\n/**\r\n * EC Rule: Enumeration type must be a string or integer\r\n * @internal\r\n */\r\nexport async function* enumerationTypeUnsupported(enumeration: Enumeration): AsyncIterable<SchemaItemDiagnostic<Enumeration, any[]>> {\r\n const type = enumeration.type;\r\n if (type === PrimitiveType.Integer || type === PrimitiveType.String)\r\n return;\r\n\r\n yield new Diagnostics.EnumerationTypeUnsupported(enumeration, [enumeration.fullName]);\r\n}\r\n\r\n/**\r\n * EC Rule: Mixin applied to class must derived from the Mixin appliesTo constraint.\r\n * @internal\r\n */\r\nexport async function* mixinAppliedToClassMustDeriveFromConstraint(entityClass: EntityClass): AsyncIterable<SchemaItemDiagnostic<EntityClass, any[]>> {\r\n for (const lazyMixin of entityClass.mixins) {\r\n const mixin = await lazyMixin;\r\n if (!mixin.appliesTo)\r\n continue;\r\n\r\n if (!await entityClass.is(await mixin.appliesTo))\r\n yield new Diagnostics.MixinAppliedToClassMustDeriveFromConstraint(entityClass, [mixin.fullName, entityClass.fullName, mixin.appliesTo.fullName]);\r\n }\r\n\r\n return;\r\n}\r\n\r\n/**\r\n * Validates a custom attribute instance and yields EC-500, EC-501, and EC-502 rule violations.\r\n * @internal\r\n */\r\nexport async function* validateCustomAttributeInstance(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\r\n yield* customAttributeNotOfConcreteClass(container, customAttribute);\r\n yield* customAttributeSchemaMustBeReferenced(container, customAttribute);\r\n yield* customAttributeClassMustExist(container, customAttribute);\r\n}\r\n\r\n/** EC Rule: CustomAttribute instance must be of a concrete CustomAttributeClass. */\r\nasync function* customAttributeNotOfConcreteClass(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\r\n const schema = container.schema;\r\n const caClass = await schema.lookupItem(customAttribute.className) as ECClass;\r\n if (!caClass)\r\n return;\r\n\r\n if (caClass.modifier !== ECClassModifier.Abstract)\r\n return;\r\n\r\n yield new Diagnostics.CustomAttributeNotOfConcreteClass(container, [container.fullName, caClass.fullName]);\r\n}\r\n\r\n/** EC Rule: CustomAttribute Schema must be referenced by the container's Schema. */\r\nasync function* customAttributeSchemaMustBeReferenced(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\r\n const schema = container.schema;\r\n const nameParts = customAttribute.className.split(\".\");\r\n if (nameParts.length === 1 || nameParts[0] === schema.name)\r\n return;\r\n\r\n if (schema.references.some((s) => s.name === nameParts[0]))\r\n return;\r\n\r\n yield new Diagnostics.CustomAttributeSchemaMustBeReferenced(container, [container.fullName, customAttribute.className]);\r\n}\r\n\r\n/** EC Rule: CustomAttribute instance class must exist. */\r\nasync function* customAttributeClassMustExist(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\r\n const schema = container.schema;\r\n const caClass = await schema.lookupItem(customAttribute.className) as ECClass;\r\n if (!caClass)\r\n yield new Diagnostics.CustomAttributeClassNotFound(container, [container.fullName, customAttribute.className]);\r\n}\r\n\r\nasync function applyAbstractConstraintMustNarrowBaseConstraints(ecClass: RelationshipClass, constraint: RelationshipConstraint, baseRelationship: RelationshipClass): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\r\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\r\n const abstractConstraint = await constraint.abstractConstraint;\r\n if (!abstractConstraint)\r\n return;\r\n\r\n if (await baseConstraint.supportsClass(abstractConstraint))\r\n return;\r\n\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n return new Diagnostics.AbstractConstraintMustNarrowBaseConstraints(ecClass, [abstractConstraint.fullName, constraintType, constraint.relationshipClass.fullName, baseRelationship.fullName]);\r\n}\r\n\r\nasync function applyDerivedConstraintsMustNarrowBaseConstraints(ecClass: RelationshipClass, constraint: RelationshipConstraint, baseRelationship: RelationshipClass): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\r\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\r\n\r\n if (!constraint.constraintClasses)\r\n return;\r\n\r\n for (const classPromise of constraint.constraintClasses) {\r\n const constraintClass = await classPromise;\r\n\r\n if (await baseConstraint.supportsClass(constraintClass))\r\n continue;\r\n\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n return new Diagnostics.DerivedConstraintsMustNarrowBaseConstraints(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, baseRelationship.fullName]);\r\n }\r\n\r\n return;\r\n}\r\n\r\nasync function applyConstraintClassesDeriveFromAbstractConstraint(ecClass: RelationshipClass, constraint: RelationshipConstraint): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\r\n const abstractConstraint = await getAbstractConstraint(constraint);\r\n if (!abstractConstraint)\r\n return;\r\n\r\n if (!constraint.constraintClasses)\r\n return;\r\n\r\n for (const classPromise of constraint.constraintClasses) {\r\n const constraintClass = await classPromise;\r\n\r\n if (Mixin.isMixin(constraintClass) && EntityClass.isEntityClass(abstractConstraint)) {\r\n if (!await (constraintClass).applicableTo(abstractConstraint)) {\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n return new Diagnostics.ConstraintClassesDeriveFromAbstractConstraint(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, abstractConstraint.fullName]);\r\n }\r\n continue;\r\n }\r\n\r\n if (!await constraintClass.is(abstractConstraint)) {\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n return new Diagnostics.ConstraintClassesDeriveFromAbstractConstraint(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, abstractConstraint.fullName]);\r\n }\r\n }\r\n\r\n return;\r\n}\r\n\r\nasync function getAbstractConstraint(constraint: RelationshipConstraint): Promise<ECClass | undefined> {\r\n const abstractConstraint = await constraint.abstractConstraint;\r\n if (abstractConstraint)\r\n return abstractConstraint;\r\n\r\n const baseRelationship = await constraint.relationshipClass.baseClass as RelationshipClass;\r\n if (!baseRelationship)\r\n return;\r\n\r\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\r\n\r\n return getAbstractConstraint(baseConstraint);\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"LoggingDiagnosticReporter.js","sourceRoot":"","sources":["../../../src/Validation/LoggingDiagnosticReporter.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAiB,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAE5C;;;GAGG;AACH,MAAM,OAAO,yBAA0B,SAAQ,wBAAwB;IAC9D,gBAAgB,CAAC,UAAyB,EAAE,WAAmB;QACpE,QAAQ,UAAU,CAAC,QAAQ,EAAE,CAAC;YAC5B,KAAK,kBAAkB,CAAC,KAAK;gBAC3B,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;gBACrF,OAAO;YACT,KAAK,kBAAkB,CAAC,OAAO;gBAC7B,MAAM,CAAC,UAAU,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;gBACvF,OAAO;YACT,KAAK,kBAAkB,CAAC,OAAO,CAAC;YAChC,KAAK,kBAAkB,CAAC,UAAU;gBAChC,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;gBACpF,OAAO;YACT;gBACE,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;IAEO,cAAc,CAAC,UAAyB;QAC9C,OAAO,EAAE,GAAG,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,CAAC,QAAQ,EAAE,cAAc,EAAE,UAAU,CAAC,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC;IACnL,CAAC;CACF","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 Diagnostic\n */\n\nimport { Logger } from \"@itwin/core-bentley\";\nimport { AnyDiagnostic, DiagnosticCategory } from \"./Diagnostic\";\nimport { FormatDiagnosticReporter } from \"./DiagnosticReporter\";\n\nconst loggingCategory = \"ecschema-metadata\";\n\n/**\n * An [[IDiagnosticReporter]] for logging [[IDiagnostic]] objects.\n * @beta\n */\nexport class LoggingDiagnosticReporter extends FormatDiagnosticReporter {\n public reportDiagnostic(diagnostic: AnyDiagnostic, messageText: string) {\n switch (diagnostic.category) {\n case DiagnosticCategory.Error:\n Logger.logError(loggingCategory, messageText, () => this.getLogMetaData(diagnostic));\n return;\n case DiagnosticCategory.Warning:\n Logger.logWarning(loggingCategory, messageText, () => this.getLogMetaData(diagnostic));\n return;\n case DiagnosticCategory.Message:\n case DiagnosticCategory.Suggestion:\n Logger.logInfo(loggingCategory, messageText, () => this.getLogMetaData(diagnostic));\n return;\n default:\n Logger.logTrace(loggingCategory, messageText, () => this.getLogMetaData(diagnostic));\n }\n }\n\n private getLogMetaData(diagnostic: AnyDiagnostic) {\n return { ...diagnostic, ...{ code: diagnostic.code, category: diagnostic.category, diagnosticType: diagnostic.diagnosticType, messageText: undefined, messageArgs: undefined } };\n }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,GAAG,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,CAAC,QAAQ,EAAE,cAAc,EAAE,UAAU,CAAC,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC;IACnL,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Diagnostic\r\n */\r\n\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { AnyDiagnostic, DiagnosticCategory } from \"./Diagnostic\";\r\nimport { FormatDiagnosticReporter } from \"./DiagnosticReporter\";\r\n\r\nconst loggingCategory = \"ecschema-metadata\";\r\n\r\n/**\r\n * An [[IDiagnosticReporter]] for logging [[IDiagnostic]] objects.\r\n * @beta\r\n */\r\nexport class LoggingDiagnosticReporter extends FormatDiagnosticReporter {\r\n public reportDiagnostic(diagnostic: AnyDiagnostic, messageText: string) {\r\n switch (diagnostic.category) {\r\n case DiagnosticCategory.Error:\r\n Logger.logError(loggingCategory, messageText, () => this.getLogMetaData(diagnostic));\r\n return;\r\n case DiagnosticCategory.Warning:\r\n Logger.logWarning(loggingCategory, messageText, () => this.getLogMetaData(diagnostic));\r\n return;\r\n case DiagnosticCategory.Message:\r\n case DiagnosticCategory.Suggestion:\r\n Logger.logInfo(loggingCategory, messageText, () => this.getLogMetaData(diagnostic));\r\n return;\r\n default:\r\n Logger.logTrace(loggingCategory, messageText, () => this.getLogMetaData(diagnostic));\r\n }\r\n }\r\n\r\n private getLogMetaData(diagnostic: AnyDiagnostic) {\r\n return { ...diagnostic, ...{ code: diagnostic.code, category: diagnostic.category, diagnosticType: diagnostic.diagnosticType, messageText: undefined, messageArgs: undefined } };\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RuleSuppressionSet.js","sourceRoot":"","sources":["../../../src/Validation/RuleSuppressionSet.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG","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 { AnyClass, AnyECType, AnyProperty, Constant, CustomAttribute, CustomAttributeClass,\n CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, Phenomenon,\n PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, StructClass, Unit,\n UnitSystem } from \"@itwin/ecschema-metadata\";\nimport { AnyDiagnostic } from \"./Diagnostic\";\n\n/**\n * Interface used for all rule suppressions used during schema validation.\n * Just telling us whether a rule is suppressed or not.\n * @beta\n */\nexport type ISuppressionRule<T extends AnyECType, U = object> = (diagnostic: AnyDiagnostic, ecDefinition: T, ...args: U[]) => Promise<boolean>;\n\n/** @beta */\nexport type BaseSuppressionRule<T extends AnyECType, U extends AnyECType> = ISuppressionRule<T, U>;\n\n/** @internal */\nexport type AnyRuleSuppressionMap = IRuleSuppressionMap<AnyECType>;\n\n/**\n * Interface used to represent elements of a rule suppression\n * @beta\n */\nexport interface IRuleSuppressionMap<T extends AnyECType, U = object> {\n ruleCode: string;\n rule: ISuppressionRule<T, U>;\n}\n\n/**\n * Interface used to represent elements of a rule suppression\n * @beta\n */\nexport interface BaseRuleSuppressionMap<T extends AnyECType, U extends AnyECType> {\n ruleCode: string;\n rule: BaseSuppressionRule<T, U>;\n}\n\n/**\n * Interface used to represent logical collection of [[ISuppressionRule]] instances.\n * @beta\n */\nexport interface IRuleSuppressionSet {\n name: string;\n schemaRuleSuppressions?: Array<IRuleSuppressionMap<Schema>>;\n schemaItemRuleSuppressions?: Array<IRuleSuppressionMap<SchemaItem>>;\n classRuleSuppressions?: Array<IRuleSuppressionMap<AnyClass>>;\n propertyRuleSuppressions?: Array<IRuleSuppressionMap<AnyProperty>>;\n entityRuleSuppressions?: Array<IRuleSuppressionMap<EntityClass>>;\n structRuleSuppressions?: Array<IRuleSuppressionMap<StructClass>>;\n mixinRuleSuppressions?: Array<IRuleSuppressionMap<Mixin>>;\n relationshipRuleSuppressions?: Array<IRuleSuppressionMap<RelationshipClass>>;\n relationshipConstraintRuleSuppressions?: Array<IRuleSuppressionMap<RelationshipConstraint>>;\n customAttributeRuleSuppressions?: Array<IRuleSuppressionMap<CustomAttributeClass>>;\n customAttributeContainerSuppressions?: Array<IRuleSuppressionMap<CustomAttributeContainerProps>>;\n customAttributeInstanceSuppressions?: Array<BaseRuleSuppressionMap<CustomAttributeContainerProps, CustomAttribute>>;\n enumerationRuleSuppressions?: Array<IRuleSuppressionMap<Enumeration>>;\n koqRuleSuppressions?: Array<IRuleSuppressionMap<KindOfQuantity>>;\n propertyCategoryRuleSuppressions?: Array<IRuleSuppressionMap<PropertyCategory>>;\n formatRuleSuppressions?: Array<IRuleSuppressionMap<Format>>;\n unitRuleSuppressions?: Array<IRuleSuppressionMap<Unit>>;\n invertedUnitRuleSuppressions?: Array<IRuleSuppressionMap<InvertedUnit>>;\n unitSystemRuleSuppressions?: Array<IRuleSuppressionMap<UnitSystem>>;\n phenomenonRuleSuppressions?: Array<IRuleSuppressionMap<Phenomenon>>;\n constantRuleSuppressions?: Array<IRuleSuppressionMap<Constant>>;\n}\n"]}
1
+ {"version":3,"file":"RuleSuppressionSet.js","sourceRoot":"","sources":["../../../src/Validation/RuleSuppressionSet.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Validation\r\n */\r\n\r\nimport { AnyClass, AnyECType, AnyProperty, Constant, CustomAttribute, CustomAttributeClass,\r\n CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, Phenomenon,\r\n PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, StructClass, Unit,\r\n UnitSystem } from \"@itwin/ecschema-metadata\";\r\nimport { AnyDiagnostic } from \"./Diagnostic\";\r\n\r\n/**\r\n * Interface used for all rule suppressions used during schema validation.\r\n * Just telling us whether a rule is suppressed or not.\r\n * @beta\r\n */\r\nexport type ISuppressionRule<T extends AnyECType, U = object> = (diagnostic: AnyDiagnostic, ecDefinition: T, ...args: U[]) => Promise<boolean>;\r\n\r\n/** @beta */\r\nexport type BaseSuppressionRule<T extends AnyECType, U extends AnyECType> = ISuppressionRule<T, U>;\r\n\r\n/** @internal */\r\nexport type AnyRuleSuppressionMap = IRuleSuppressionMap<AnyECType>;\r\n\r\n/**\r\n * Interface used to represent elements of a rule suppression\r\n * @beta\r\n */\r\nexport interface IRuleSuppressionMap<T extends AnyECType, U = object> {\r\n ruleCode: string;\r\n rule: ISuppressionRule<T, U>;\r\n}\r\n\r\n/**\r\n * Interface used to represent elements of a rule suppression\r\n * @beta\r\n */\r\nexport interface BaseRuleSuppressionMap<T extends AnyECType, U extends AnyECType> {\r\n ruleCode: string;\r\n rule: BaseSuppressionRule<T, U>;\r\n}\r\n\r\n/**\r\n * Interface used to represent logical collection of [[ISuppressionRule]] instances.\r\n * @beta\r\n */\r\nexport interface IRuleSuppressionSet {\r\n name: string;\r\n schemaRuleSuppressions?: Array<IRuleSuppressionMap<Schema>>;\r\n schemaItemRuleSuppressions?: Array<IRuleSuppressionMap<SchemaItem>>;\r\n classRuleSuppressions?: Array<IRuleSuppressionMap<AnyClass>>;\r\n propertyRuleSuppressions?: Array<IRuleSuppressionMap<AnyProperty>>;\r\n entityRuleSuppressions?: Array<IRuleSuppressionMap<EntityClass>>;\r\n structRuleSuppressions?: Array<IRuleSuppressionMap<StructClass>>;\r\n mixinRuleSuppressions?: Array<IRuleSuppressionMap<Mixin>>;\r\n relationshipRuleSuppressions?: Array<IRuleSuppressionMap<RelationshipClass>>;\r\n relationshipConstraintRuleSuppressions?: Array<IRuleSuppressionMap<RelationshipConstraint>>;\r\n customAttributeRuleSuppressions?: Array<IRuleSuppressionMap<CustomAttributeClass>>;\r\n customAttributeContainerSuppressions?: Array<IRuleSuppressionMap<CustomAttributeContainerProps>>;\r\n customAttributeInstanceSuppressions?: Array<BaseRuleSuppressionMap<CustomAttributeContainerProps, CustomAttribute>>;\r\n enumerationRuleSuppressions?: Array<IRuleSuppressionMap<Enumeration>>;\r\n koqRuleSuppressions?: Array<IRuleSuppressionMap<KindOfQuantity>>;\r\n propertyCategoryRuleSuppressions?: Array<IRuleSuppressionMap<PropertyCategory>>;\r\n formatRuleSuppressions?: Array<IRuleSuppressionMap<Format>>;\r\n unitRuleSuppressions?: Array<IRuleSuppressionMap<Unit>>;\r\n invertedUnitRuleSuppressions?: Array<IRuleSuppressionMap<InvertedUnit>>;\r\n unitSystemRuleSuppressions?: Array<IRuleSuppressionMap<UnitSystem>>;\r\n phenomenonRuleSuppressions?: Array<IRuleSuppressionMap<Phenomenon>>;\r\n constantRuleSuppressions?: Array<IRuleSuppressionMap<Constant>>;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Rules.js","sourceRoot":"","sources":["../../../src/Validation/Rules.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG","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 { AnyClass, AnyECType, AnyProperty, Constant, CustomAttribute, CustomAttributeClass,\n CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, Phenomenon,\n PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, StructClass, Unit,\n UnitSystem } from \"@itwin/ecschema-metadata\";\nimport { BaseDiagnostic } from \"./Diagnostic\";\n\n/**\n * Interface used for all rule implementations used during schema validation.\n * @beta\n */\nexport type IRule<T extends AnyECType, U = object> = (ecDefinition: T, ...args: U[]) => AsyncIterable<BaseDiagnostic<T, any[]>>;\n\n/** @beta */\nexport type BaseRule<T extends AnyECType, U extends AnyECType> = IRule<T, U>;\n\n/**\n * Interface used to represent logical collection of [IRule]($ecschema-editing) instances.\n * @beta\n */\nexport interface IRuleSet {\n /** The name of the rule set. */\n name: string;\n\n /** A collection of schema names that should be excluded from adhering to the rules defined in this rule set. */\n schemaExclusionSet?: string[];\n\n /** The rules that apply to [Schema]($ecschema-metadata) objects. */\n schemaRules?: Array<IRule<Schema>>;\n /** The rules that apply to [SchemaItem]($ecschema-metadata) objects. */\n schemaItemRules?: Array<IRule<SchemaItem>>;\n /** The rules that apply to [ECClass]($ecschema-metadata) objects. */\n classRules?: Array<IRule<AnyClass>>;\n /** The rules that apply to [Property]($ecschema-metadata) objects. */\n propertyRules?: Array<IRule<AnyProperty>>;\n /** The rules that apply to [EntityClass]($ecschema-metadata) objects. */\n entityClassRules?: Array<IRule<EntityClass>>;\n /** The rules that apply to [StructClass]($ecschema-metadata) objects. */\n structClassRules?: Array<IRule<StructClass>>;\n /** The rules that apply to [Mixin]($ecschema-metadata) objects. */\n mixinRules?: Array<IRule<Mixin>>;\n /** The rules that apply to [RelationshipClass]($ecschema-metadata) objects. */\n relationshipRules?: Array<IRule<RelationshipClass>>;\n /** The rules that apply to [RelationshipConstraint]($ecschema-metadata) objects. */\n relationshipConstraintRules?: Array<IRule<RelationshipConstraint>>;\n /** The rules that apply to [CustomAttributeClass]($ecschema-metadata) objects. */\n customAttributeClassRules?: Array<IRule<CustomAttributeClass>>;\n /** The rules that apply to [CustomAttributeContainerProps]($ecschema-metadata) objects. */\n customAttributeContainerRules?: Array<IRule<CustomAttributeContainerProps>>;\n /** The rules that apply to [CustomAttribute]($ecschema-metadata) objects. */\n customAttributeInstanceRules?: Array<BaseRule<CustomAttributeContainerProps, CustomAttribute>>;\n /** The rules that apply to [Enumeration]($ecschema-metadata) objects. */\n enumerationRules?: Array<IRule<Enumeration>>;\n /** The rules that apply to [KindOfQuantity]($ecschema-metadata) objects. */\n kindOfQuantityRules?: Array<IRule<KindOfQuantity>>;\n /** The rules that apply to [PropertyCategory]($ecschema-metadata) objects. */\n propertyCategoryRules?: Array<IRule<PropertyCategory>>;\n /** The rules that apply to [Format]($ecschema-metadata) objects. */\n formatRules?: Array<IRule<Format>>;\n /** The rules that apply to [Unit]($ecschema-metadata) objects. */\n unitRules?: Array<IRule<Unit>>;\n /** The rules that apply to [InvertedUnit]($ecschema-metadata) objects. */\n invertedUnitRules?: Array<IRule<InvertedUnit>>;\n /** The rules that apply to [UnitSystem]($ecschema-metadata) objects. */\n unitSystemRules?: Array<IRule<UnitSystem>>;\n /** The rules that apply to [Phenomenon]($ecschema-metadata) objects. */\n phenomenonRules?: Array<IRule<Phenomenon>>;\n /** The rules that apply to [Constant]($ecschema-metadata) objects. */\n constantRules?: Array<IRule<Constant>>;\n}\n"]}
1
+ {"version":3,"file":"Rules.js","sourceRoot":"","sources":["../../../src/Validation/Rules.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Validation\r\n */\r\n\r\nimport { AnyClass, AnyECType, AnyProperty, Constant, CustomAttribute, CustomAttributeClass,\r\n CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, Phenomenon,\r\n PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, StructClass, Unit,\r\n UnitSystem } from \"@itwin/ecschema-metadata\";\r\nimport { BaseDiagnostic } from \"./Diagnostic\";\r\n\r\n/**\r\n * Interface used for all rule implementations used during schema validation.\r\n * @beta\r\n */\r\nexport type IRule<T extends AnyECType, U = object> = (ecDefinition: T, ...args: U[]) => AsyncIterable<BaseDiagnostic<T, any[]>>;\r\n\r\n/** @beta */\r\nexport type BaseRule<T extends AnyECType, U extends AnyECType> = IRule<T, U>;\r\n\r\n/**\r\n * Interface used to represent logical collection of [IRule]($ecschema-editing) instances.\r\n * @beta\r\n */\r\nexport interface IRuleSet {\r\n /** The name of the rule set. */\r\n name: string;\r\n\r\n /** A collection of schema names that should be excluded from adhering to the rules defined in this rule set. */\r\n schemaExclusionSet?: string[];\r\n\r\n /** The rules that apply to [Schema]($ecschema-metadata) objects. */\r\n schemaRules?: Array<IRule<Schema>>;\r\n /** The rules that apply to [SchemaItem]($ecschema-metadata) objects. */\r\n schemaItemRules?: Array<IRule<SchemaItem>>;\r\n /** The rules that apply to [ECClass]($ecschema-metadata) objects. */\r\n classRules?: Array<IRule<AnyClass>>;\r\n /** The rules that apply to [Property]($ecschema-metadata) objects. */\r\n propertyRules?: Array<IRule<AnyProperty>>;\r\n /** The rules that apply to [EntityClass]($ecschema-metadata) objects. */\r\n entityClassRules?: Array<IRule<EntityClass>>;\r\n /** The rules that apply to [StructClass]($ecschema-metadata) objects. */\r\n structClassRules?: Array<IRule<StructClass>>;\r\n /** The rules that apply to [Mixin]($ecschema-metadata) objects. */\r\n mixinRules?: Array<IRule<Mixin>>;\r\n /** The rules that apply to [RelationshipClass]($ecschema-metadata) objects. */\r\n relationshipRules?: Array<IRule<RelationshipClass>>;\r\n /** The rules that apply to [RelationshipConstraint]($ecschema-metadata) objects. */\r\n relationshipConstraintRules?: Array<IRule<RelationshipConstraint>>;\r\n /** The rules that apply to [CustomAttributeClass]($ecschema-metadata) objects. */\r\n customAttributeClassRules?: Array<IRule<CustomAttributeClass>>;\r\n /** The rules that apply to [CustomAttributeContainerProps]($ecschema-metadata) objects. */\r\n customAttributeContainerRules?: Array<IRule<CustomAttributeContainerProps>>;\r\n /** The rules that apply to [CustomAttribute]($ecschema-metadata) objects. */\r\n customAttributeInstanceRules?: Array<BaseRule<CustomAttributeContainerProps, CustomAttribute>>;\r\n /** The rules that apply to [Enumeration]($ecschema-metadata) objects. */\r\n enumerationRules?: Array<IRule<Enumeration>>;\r\n /** The rules that apply to [KindOfQuantity]($ecschema-metadata) objects. */\r\n kindOfQuantityRules?: Array<IRule<KindOfQuantity>>;\r\n /** The rules that apply to [PropertyCategory]($ecschema-metadata) objects. */\r\n propertyCategoryRules?: Array<IRule<PropertyCategory>>;\r\n /** The rules that apply to [Format]($ecschema-metadata) objects. */\r\n formatRules?: Array<IRule<Format>>;\r\n /** The rules that apply to [Unit]($ecschema-metadata) objects. */\r\n unitRules?: Array<IRule<Unit>>;\r\n /** The rules that apply to [InvertedUnit]($ecschema-metadata) objects. */\r\n invertedUnitRules?: Array<IRule<InvertedUnit>>;\r\n /** The rules that apply to [UnitSystem]($ecschema-metadata) objects. */\r\n unitSystemRules?: Array<IRule<UnitSystem>>;\r\n /** The rules that apply to [Phenomenon]($ecschema-metadata) objects. */\r\n phenomenonRules?: Array<IRule<Phenomenon>>;\r\n /** The rules that apply to [Constant]($ecschema-metadata) objects. */\r\n constantRules?: Array<IRule<Constant>>;\r\n}\r\n"]}