@itwin/ecschema-editing 4.6.0-dev.8 → 4.6.0-dev.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
- package/lib/cjs/Editing/Constants.js.map +1 -1
- package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
- package/lib/cjs/Editing/ECClasses.js.map +1 -1
- package/lib/cjs/Editing/Editor.js.map +1 -1
- package/lib/cjs/Editing/Entities.js.map +1 -1
- package/lib/cjs/Editing/Enumerations.js.map +1 -1
- package/lib/cjs/Editing/Formats.js.map +1 -1
- package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
- package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
- package/lib/cjs/Editing/Mixins.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableArrayProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableMixin.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableUnit.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
- package/lib/cjs/Editing/Phenomena.js.map +1 -1
- package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
- package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
- package/lib/cjs/Editing/SchemaItems.js.map +1 -1
- package/lib/cjs/Editing/Structs.js.map +1 -1
- package/lib/cjs/Editing/UnitSystems.js.map +1 -1
- package/lib/cjs/Editing/Units.js.map +1 -1
- package/lib/cjs/Merging/CAClassMerger.js.map +1 -1
- package/lib/cjs/Merging/ClassMerger.js.map +1 -1
- package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
- package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
- package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
- package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
- package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
- package/lib/cjs/Merging/MixinMerger.js.map +1 -1
- package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
- package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -1
- package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
- package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaItemMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
- package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -1
- package/lib/cjs/Validation/Diagnostic.js.map +1 -1
- package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
- package/lib/cjs/Validation/ECRules.d.ts +23 -23
- package/lib/cjs/Validation/ECRules.d.ts.map +1 -1
- package/lib/cjs/Validation/ECRules.js.map +1 -1
- package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
- package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
- package/lib/cjs/Validation/Rules.js.map +1 -1
- package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
- package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
- package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
- package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-editing.js.map +1 -1
- package/package.json +9 -9
- package/public/locales/en/ECSchemaEditing.json +26 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiagnosticReporter.js","sourceRoot":"","sources":["../../../src/Validation/DiagnosticReporter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAKH,iCAAkC;AAElC,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAChD,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAC9C,MAAM,kBAAkB,GAAG,GAAG,oBAAoB,IAAI,uBAAuB,EAAE,CAAC;AAwBhF;;;;;GAKG;AACH,MAAsB,6BAA6B;IAGjD;;;OAGG;IACH,YAAY,YAAoC;QAC9C,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,UAAyB;QACrC,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;YA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,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;AApED,4DAoEC","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 assert = require(\"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+F;AAC/F;;GAEG;;;AAKH,iCAAkC;AAElC,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAChD,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAC9C,MAAM,kBAAkB,GAAG,GAAG,oBAAoB,IAAI,uBAAuB,EAAE,CAA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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;AApED,4DAoEC","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 assert = require(\"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"]}
|
|
@@ -64,7 +64,7 @@ export declare const Diagnostics: {
|
|
|
64
64
|
readonly schema: Schema;
|
|
65
65
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
66
66
|
ecDefinition: Schema;
|
|
67
|
-
messageArgs?: [string, string] | undefined;
|
|
67
|
+
messageArgs?: [string, string] | undefined;
|
|
68
68
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
69
69
|
};
|
|
70
70
|
code: string;
|
|
@@ -78,7 +78,7 @@ export declare const Diagnostics: {
|
|
|
78
78
|
readonly schema: Schema;
|
|
79
79
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
80
80
|
ecDefinition: Schema;
|
|
81
|
-
messageArgs?: [string, string, string, string] | undefined;
|
|
81
|
+
messageArgs?: [string, string, string, string] | undefined;
|
|
82
82
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
83
83
|
};
|
|
84
84
|
code: string;
|
|
@@ -92,7 +92,7 @@ export declare const Diagnostics: {
|
|
|
92
92
|
readonly schema: Schema;
|
|
93
93
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
94
94
|
ecDefinition: Schema;
|
|
95
|
-
messageArgs?: [string, string] | undefined;
|
|
95
|
+
messageArgs?: [string, string] | undefined;
|
|
96
96
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
97
97
|
};
|
|
98
98
|
code: string;
|
|
@@ -106,7 +106,7 @@ export declare const Diagnostics: {
|
|
|
106
106
|
readonly schema: Schema;
|
|
107
107
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
108
108
|
ecDefinition: AnyClass;
|
|
109
|
-
messageArgs?: [string, string] | undefined;
|
|
109
|
+
messageArgs?: [string, string] | undefined;
|
|
110
110
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
111
111
|
};
|
|
112
112
|
diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
@@ -119,7 +119,7 @@ export declare const Diagnostics: {
|
|
|
119
119
|
readonly schema: Schema;
|
|
120
120
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
121
121
|
ecDefinition: AnyClass;
|
|
122
|
-
messageArgs?: [string, string, string] | undefined;
|
|
122
|
+
messageArgs?: [string, string, string] | undefined;
|
|
123
123
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
124
124
|
};
|
|
125
125
|
diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
@@ -132,7 +132,7 @@ export declare const Diagnostics: {
|
|
|
132
132
|
readonly schema: Schema;
|
|
133
133
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
134
134
|
ecDefinition: AnyClass;
|
|
135
|
-
messageArgs?: [string, string] | undefined;
|
|
135
|
+
messageArgs?: [string, string] | undefined;
|
|
136
136
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
137
137
|
};
|
|
138
138
|
diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
@@ -145,7 +145,7 @@ export declare const Diagnostics: {
|
|
|
145
145
|
readonly schema: Schema;
|
|
146
146
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
147
147
|
ecDefinition: CustomAttributeContainerProps;
|
|
148
|
-
messageArgs?: [string, string] | undefined;
|
|
148
|
+
messageArgs?: [string, string] | undefined;
|
|
149
149
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
150
150
|
};
|
|
151
151
|
};
|
|
@@ -157,7 +157,7 @@ export declare const Diagnostics: {
|
|
|
157
157
|
readonly schema: Schema;
|
|
158
158
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
159
159
|
ecDefinition: CustomAttributeContainerProps;
|
|
160
|
-
messageArgs?: [string, string] | undefined;
|
|
160
|
+
messageArgs?: [string, string] | undefined;
|
|
161
161
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
162
162
|
};
|
|
163
163
|
};
|
|
@@ -169,7 +169,7 @@ export declare const Diagnostics: {
|
|
|
169
169
|
readonly schema: Schema;
|
|
170
170
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
171
171
|
ecDefinition: CustomAttributeContainerProps;
|
|
172
|
-
messageArgs?: [string, string] | undefined;
|
|
172
|
+
messageArgs?: [string, string] | undefined;
|
|
173
173
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
174
174
|
};
|
|
175
175
|
};
|
|
@@ -181,7 +181,7 @@ export declare const Diagnostics: {
|
|
|
181
181
|
readonly schema: Schema;
|
|
182
182
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
183
183
|
ecDefinition: Enumeration;
|
|
184
|
-
messageArgs?: [string] | undefined;
|
|
184
|
+
messageArgs?: [string] | undefined;
|
|
185
185
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
186
186
|
};
|
|
187
187
|
diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
@@ -194,7 +194,7 @@ export declare const Diagnostics: {
|
|
|
194
194
|
readonly schema: Schema;
|
|
195
195
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
196
196
|
ecDefinition: EntityClass;
|
|
197
|
-
messageArgs?: [string, string, string] | undefined;
|
|
197
|
+
messageArgs?: [string, string, string] | undefined;
|
|
198
198
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
199
199
|
};
|
|
200
200
|
diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
@@ -207,7 +207,7 @@ export declare const Diagnostics: {
|
|
|
207
207
|
readonly schema: Schema;
|
|
208
208
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
209
209
|
ecDefinition: AnyProperty;
|
|
210
|
-
messageArgs?: [string, string, string, string, string] | undefined;
|
|
210
|
+
messageArgs?: [string, string, string, string, string] | undefined;
|
|
211
211
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
212
212
|
};
|
|
213
213
|
code: string;
|
|
@@ -220,7 +220,7 @@ export declare const Diagnostics: {
|
|
|
220
220
|
readonly schema: Schema;
|
|
221
221
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
222
222
|
ecDefinition: AnyProperty;
|
|
223
|
-
messageArgs?: [string, string, string, string, string] | undefined;
|
|
223
|
+
messageArgs?: [string, string, string, string, string] | undefined;
|
|
224
224
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
225
225
|
};
|
|
226
226
|
code: string;
|
|
@@ -233,7 +233,7 @@ export declare const Diagnostics: {
|
|
|
233
233
|
readonly schema: Schema;
|
|
234
234
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
235
235
|
ecDefinition: AnyProperty;
|
|
236
|
-
messageArgs?: [string, string, string, string, string, string, string] | undefined;
|
|
236
|
+
messageArgs?: [string, string, string, string, string, string, string] | undefined;
|
|
237
237
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
238
238
|
};
|
|
239
239
|
code: string;
|
|
@@ -246,7 +246,7 @@ export declare const Diagnostics: {
|
|
|
246
246
|
readonly schema: Schema;
|
|
247
247
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
248
248
|
ecDefinition: AnyProperty;
|
|
249
|
-
messageArgs?: [string, string] | undefined;
|
|
249
|
+
messageArgs?: [string, string] | undefined;
|
|
250
250
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
251
251
|
};
|
|
252
252
|
code: string;
|
|
@@ -259,7 +259,7 @@ export declare const Diagnostics: {
|
|
|
259
259
|
readonly schema: Schema;
|
|
260
260
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
261
261
|
ecDefinition: AnyProperty;
|
|
262
|
-
messageArgs?: [string, string, string] | undefined;
|
|
262
|
+
messageArgs?: [string, string, string] | undefined;
|
|
263
263
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
264
264
|
};
|
|
265
265
|
code: string;
|
|
@@ -272,7 +272,7 @@ export declare const Diagnostics: {
|
|
|
272
272
|
readonly schema: Schema;
|
|
273
273
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
274
274
|
ecDefinition: AnyProperty;
|
|
275
|
-
messageArgs?: [string, string] | undefined;
|
|
275
|
+
messageArgs?: [string, string] | undefined;
|
|
276
276
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
277
277
|
};
|
|
278
278
|
code: string;
|
|
@@ -285,7 +285,7 @@ export declare const Diagnostics: {
|
|
|
285
285
|
readonly schema: Schema;
|
|
286
286
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
287
287
|
ecDefinition: AnyProperty;
|
|
288
|
-
messageArgs?: [string, string, string, string] | undefined;
|
|
288
|
+
messageArgs?: [string, string, string, string] | undefined;
|
|
289
289
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
290
290
|
};
|
|
291
291
|
code: string;
|
|
@@ -298,7 +298,7 @@ export declare const Diagnostics: {
|
|
|
298
298
|
readonly schema: Schema;
|
|
299
299
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
300
300
|
ecDefinition: RelationshipClass;
|
|
301
|
-
messageArgs?: [string, string, string, string] | undefined;
|
|
301
|
+
messageArgs?: [string, string, string, string] | undefined;
|
|
302
302
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
303
303
|
};
|
|
304
304
|
diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
@@ -311,7 +311,7 @@ export declare const Diagnostics: {
|
|
|
311
311
|
readonly schema: Schema;
|
|
312
312
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
313
313
|
ecDefinition: RelationshipClass;
|
|
314
|
-
messageArgs?: [string, string, string, string] | undefined;
|
|
314
|
+
messageArgs?: [string, string, string, string] | undefined;
|
|
315
315
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
316
316
|
};
|
|
317
317
|
diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
@@ -324,7 +324,7 @@ export declare const Diagnostics: {
|
|
|
324
324
|
readonly schema: Schema;
|
|
325
325
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
326
326
|
ecDefinition: RelationshipClass;
|
|
327
|
-
messageArgs?: [string, string, string, string] | undefined;
|
|
327
|
+
messageArgs?: [string, string, string, string] | undefined;
|
|
328
328
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
329
329
|
};
|
|
330
330
|
diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
@@ -337,7 +337,7 @@ export declare const Diagnostics: {
|
|
|
337
337
|
readonly schema: Schema;
|
|
338
338
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
339
339
|
ecDefinition: RelationshipConstraint;
|
|
340
|
-
messageArgs?: [string, string] | undefined;
|
|
340
|
+
messageArgs?: [string, string] | undefined;
|
|
341
341
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
342
342
|
};
|
|
343
343
|
};
|
|
@@ -349,7 +349,7 @@ export declare const Diagnostics: {
|
|
|
349
349
|
readonly schema: Schema;
|
|
350
350
|
readonly diagnosticType: import("./Diagnostic").DiagnosticType;
|
|
351
351
|
ecDefinition: RelationshipConstraint;
|
|
352
|
-
messageArgs?: [string, string] | undefined;
|
|
352
|
+
messageArgs?: [string, string] | undefined;
|
|
353
353
|
category: import("./Diagnostic").DiagnosticCategory;
|
|
354
354
|
};
|
|
355
355
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ECRules.d.ts","sourceRoot":"","sources":["../../../src/Validation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cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,qCAAiB,CAAC,uBAAuB,CAAC,CAAC,CAAC,qCAAiB,CAAC,uBAAuB,CAAC;YACnI,OAAO,IAAI,mBAAW,CAAC,6CAA6C,CAAC,OAAO,EAAE,CAAC,eAAe,CAAC,QAAQ,EAAE,cAAc,EAAE,UAAU,CAAC,iBAAiB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;SAC/L;KACF;IAED,OAAO;AACT,CAAC;AAED,KAAK,UAAU,qBAAqB,CAAC,UAAkC;IACrE,MAAM,kBAAkB,GAAG,MAAM,UAAU,CAAC,kBAAkB,CAAC;IAC/D,IAAI,kBAAkB;QACpB,OAAO,kBAAkB,CAAC;IAE5B,MAAM,gBAAgB,GAAG,MAAM,UAAU,CAAC,iBAAiB,CAAC,SAA8B,CAAC;IAC3F,IAAI,CAAC,gBAAgB;QACnB,OAAO;IAET,MAAM,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC;IAE/F,OAAO,qBAAqB,CAAC,cAAc,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Validation\n */\n\nimport {\n AnyClass, AnyProperty, CustomAttribute, CustomAttributeContainerProps, ECClass, ECClassModifier,\n ECStringConstants, EntityClass, Enumeration, 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 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);\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);\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);\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))\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 (constraintClass.schemaItemType === SchemaItemType.Mixin && abstractConstraint.schemaItemType === SchemaItemType.EntityClass) {\n if (!await (constraintClass).applicableTo(abstractConstraint as EntityClass)) {\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,gEAKkC;AAClC,6CAIsB;AAGtB,MAAM,WAAW,GAAG,WAAW,CAAC;AAEhC,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,GAAG,WAAW,IAAI,IAAI,EAAE,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,yDAAyD;AAC5C,QAAA,eAAe,GAAG;IAC7B,6BAA6B;IAC7B,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC;IAC/B,wBAAwB,EAAE,OAAO,CAAC,GAAG,CAAC;IACtC,uEAAuE;IACvE,gCAAgC,EAAE,OAAO,CAAC,GAAG,CAAC;IAE9C,oCAAoC;IACpC,iCAAiC,EAAE,OAAO,CAAC,GAAG,CAAC;IAC/C,qCAAqC,EAAE,OAAO,CAAC,GAAG,CAAC;IACnD,4BAA4B,EAAE,OAAO,CAAC,GAAG,CAAC;IAE1C,mCAAmC;IACnC,0BAA0B,EAAE,OAAO,CAAC,GAAG,CAAC;IAExC,+BAA+B;IAC/B,2CAA2C,EAAE,OAAO,CAAC,IAAI,CAAC;IAE1D,kCAAkC;IAClC,qCAAqC,EAAE,OAAO,CAAC,IAAI,CAAC;IACpD,gCAAgC,EAAE,OAAO,CAAC,IAAI,CAAC;IAC/C,gCAAgC,EAAE,OAAO,CAAC,IAAI,CAAC;IAE/C,sCAAsC;IACtC,2CAA2C,EAAE,OAAO,CAAC,IAAI,CAAC;IAC1D,2CAA2C,EAAE,OAA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AAED,KAAK,UAAU,qBAAqB,CAAC,UAAkC;IACrE,MAAM,kBAAkB,GAAG,MAAM,UAAU,CAAC,kBAAkB,CAAC;IAC/D,IAAI,kBAAkB;QACpB,OAAO,kBAAkB,CAAC;IAE5B,MAAM,gBAAgB,GAAG,MAAM,UAAU,CAAC,iBAAiB,CAAC,SAA8B,CAAC;IAC3F,IAAI,CAAC,gBAAgB;QACnB,OAAO;IAET,MAAM,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,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, 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 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);\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);\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);\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))\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 (constraintClass.schemaItemType === SchemaItemType.Mixin && abstractConstraint.schemaItemType === SchemaItemType.EntityClass) {\r\n if (!await (constraintClass).applicableTo(abstractConstraint as EntityClass)) {\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,sDAA6C;AAC7C,6CAAiE;AACjE,6DAAgE;AAEhE,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAE5C;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,6CAAwB;IAC9D,gBAAgB,CAAC,UAAyB,EAAE,WAAmB;QACpE,QAAQ,UAAU,CAAC,QAAQ,EAAE;YAC3B,KAAK,+BAAkB,CAAC,KAAK;gBAC3B,qBAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;gBACrF,OAAO;YACT,KAAK,+BAAkB,CAAC,OAAO;gBAC7B,qBAAM,CAAC,UAAU,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;gBACvF,OAAO;YACT,KAAK,+BAAkB,CAAC,OAAO,CAAC;YAChC,KAAK,+BAAkB,CAAC,UAAU;gBAChC,qBAAM,CAAC,OAAO,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;gBACpF,OAAO;YACT;gBACE,qBAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;SACxF;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;AArBD,8DAqBC","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 }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"LoggingDiagnosticReporter.js","sourceRoot":"","sources":["../../../src/Validation/LoggingDiagnosticReporter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,6CAAiE;AACjE,6DAAgE;AAEhE,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAE5C;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,6CAAwB;IAC9D,gBAAgB,CAAC,UAAyB,EAAE,WAAmB;QACpE,QAAQ,UAAU,CAAC,QAAQ,EAAE;YAC3B,KAAK,+BAAkB,CAAC,KAAK;gBAC3B,qBAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;gBACrF,OAAO;YACT,KAAK,+BAAkB,CAAC,OAAO;gBAC7B,qBAAM,CAAC,UAAU,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;gBACvF,OAAO;YACT,KAAK,+BAAkB,CAAC,OAAO,CAAC;YAChC,KAAK,+BAAkB,CAAC,UAAU;gBAChC,qBAAM,CAAC,OAAO,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;gBACpF,OAAO;YACT;gBACE,qBAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;SACxF;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;AArBD,8DAqBC","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 = {}> = (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 = {}> {\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 = {}> = (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 = {}> {\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 = {}> = (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 = {}> = (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"]}
|