@itwin/ecschema-editing 3.0.0-dev.72
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/CHANGELOG.md +109 -0
- package/LICENSE.md +9 -0
- package/README.md +11 -0
- package/lib/Editing/Constants.d.ts +21 -0
- package/lib/Editing/Constants.d.ts.map +1 -0
- package/lib/Editing/Constants.js +65 -0
- package/lib/Editing/Constants.js.map +1 -0
- package/lib/Editing/CustomAttributes.d.ts +21 -0
- package/lib/Editing/CustomAttributes.d.ts.map +1 -0
- package/lib/Editing/CustomAttributes.js +59 -0
- package/lib/Editing/CustomAttributes.js.map +1 -0
- package/lib/Editing/ECClasses.d.ts +33 -0
- package/lib/Editing/ECClasses.d.ts.map +1 -0
- package/lib/Editing/ECClasses.js +186 -0
- package/lib/Editing/ECClasses.js.map +1 -0
- package/lib/Editing/Editor.d.ts +105 -0
- package/lib/Editing/Editor.d.ts.map +1 -0
- package/lib/Editing/Editor.js +175 -0
- package/lib/Editing/Editor.js.map +1 -0
- package/lib/Editing/Entities.d.ts +23 -0
- package/lib/Editing/Entities.d.ts.map +1 -0
- package/lib/Editing/Entities.js +89 -0
- package/lib/Editing/Entities.js.map +1 -0
- package/lib/Editing/Enumerations.d.ts +22 -0
- package/lib/Editing/Enumerations.d.ts.map +1 -0
- package/lib/Editing/Enumerations.js +71 -0
- package/lib/Editing/Enumerations.js.map +1 -0
- package/lib/Editing/Formats.d.ts +21 -0
- package/lib/Editing/Formats.d.ts.map +1 -0
- package/lib/Editing/Formats.js +61 -0
- package/lib/Editing/Formats.js.map +1 -0
- package/lib/Editing/InvertedUnits.d.ts +18 -0
- package/lib/Editing/InvertedUnits.d.ts.map +1 -0
- package/lib/Editing/InvertedUnits.js +86 -0
- package/lib/Editing/InvertedUnits.js.map +1 -0
- package/lib/Editing/KindOfQuantities.d.ts +29 -0
- package/lib/Editing/KindOfQuantities.d.ts.map +1 -0
- package/lib/Editing/KindOfQuantities.js +80 -0
- package/lib/Editing/KindOfQuantities.js.map +1 -0
- package/lib/Editing/Mixins.d.ts +23 -0
- package/lib/Editing/Mixins.d.ts.map +1 -0
- package/lib/Editing/Mixins.js +89 -0
- package/lib/Editing/Mixins.js.map +1 -0
- package/lib/Editing/Mutable/MutableCAClass.d.ts +10 -0
- package/lib/Editing/Mutable/MutableCAClass.d.ts.map +1 -0
- package/lib/Editing/Mutable/MutableCAClass.js +16 -0
- package/lib/Editing/Mutable/MutableCAClass.js.map +1 -0
- package/lib/Editing/Mutable/MutableClass.d.ts +35 -0
- package/lib/Editing/Mutable/MutableClass.d.ts.map +1 -0
- package/lib/Editing/Mutable/MutableClass.js +23 -0
- package/lib/Editing/Mutable/MutableClass.js.map +1 -0
- package/lib/Editing/Mutable/MutableConstant.d.ts +13 -0
- package/lib/Editing/Mutable/MutableConstant.d.ts.map +1 -0
- package/lib/Editing/Mutable/MutableConstant.js +16 -0
- package/lib/Editing/Mutable/MutableConstant.js.map +1 -0
- package/lib/Editing/Mutable/MutableEntityClass.d.ts +16 -0
- package/lib/Editing/Mutable/MutableEntityClass.d.ts.map +1 -0
- package/lib/Editing/Mutable/MutableEntityClass.js +60 -0
- package/lib/Editing/Mutable/MutableEntityClass.js.map +1 -0
- package/lib/Editing/Mutable/MutableEnumeration.d.ts +10 -0
- package/lib/Editing/Mutable/MutableEnumeration.d.ts.map +1 -0
- package/lib/Editing/Mutable/MutableEnumeration.js +15 -0
- package/lib/Editing/Mutable/MutableEnumeration.js.map +1 -0
- package/lib/Editing/Mutable/MutableFormat.d.ts +18 -0
- package/lib/Editing/Mutable/MutableFormat.d.ts.map +1 -0
- package/lib/Editing/Mutable/MutableFormat.js +16 -0
- package/lib/Editing/Mutable/MutableFormat.js.map +1 -0
- package/lib/Editing/Mutable/MutableInvertedUnit.d.ts +11 -0
- package/lib/Editing/Mutable/MutableInvertedUnit.d.ts.map +1 -0
- package/lib/Editing/Mutable/MutableInvertedUnit.js +16 -0
- package/lib/Editing/Mutable/MutableInvertedUnit.js.map +1 -0
- package/lib/Editing/Mutable/MutableKindOfQuantity.d.ts +11 -0
- package/lib/Editing/Mutable/MutableKindOfQuantity.d.ts.map +1 -0
- package/lib/Editing/Mutable/MutableKindOfQuantity.js +16 -0
- package/lib/Editing/Mutable/MutableKindOfQuantity.js.map +1 -0
- package/lib/Editing/Mutable/MutableMixin.d.ts +12 -0
- package/lib/Editing/Mutable/MutableMixin.d.ts.map +1 -0
- package/lib/Editing/Mutable/MutableMixin.js +16 -0
- package/lib/Editing/Mutable/MutableMixin.js.map +1 -0
- package/lib/Editing/Mutable/MutablePhenomenon.d.ts +10 -0
- package/lib/Editing/Mutable/MutablePhenomenon.d.ts.map +1 -0
- package/lib/Editing/Mutable/MutablePhenomenon.js +16 -0
- package/lib/Editing/Mutable/MutablePhenomenon.js.map +1 -0
- package/lib/Editing/Mutable/MutableProperty.d.ts +9 -0
- package/lib/Editing/Mutable/MutableProperty.d.ts.map +1 -0
- package/lib/Editing/Mutable/MutableProperty.js +16 -0
- package/lib/Editing/Mutable/MutableProperty.js.map +1 -0
- package/lib/Editing/Mutable/MutablePropertyCategory.d.ts +10 -0
- package/lib/Editing/Mutable/MutablePropertyCategory.d.ts.map +1 -0
- package/lib/Editing/Mutable/MutablePropertyCategory.js +16 -0
- package/lib/Editing/Mutable/MutablePropertyCategory.js.map +1 -0
- package/lib/Editing/Mutable/MutableRelationshipClass.d.ts +22 -0
- package/lib/Editing/Mutable/MutableRelationshipClass.d.ts.map +1 -0
- package/lib/Editing/Mutable/MutableRelationshipClass.js +25 -0
- package/lib/Editing/Mutable/MutableRelationshipClass.js.map +1 -0
- package/lib/Editing/Mutable/MutableSchema.d.ts +46 -0
- package/lib/Editing/Mutable/MutableSchema.d.ts.map +1 -0
- package/lib/Editing/Mutable/MutableSchema.js +18 -0
- package/lib/Editing/Mutable/MutableSchema.js.map +1 -0
- package/lib/Editing/Mutable/MutableUnit.d.ts +12 -0
- package/lib/Editing/Mutable/MutableUnit.d.ts.map +1 -0
- package/lib/Editing/Mutable/MutableUnit.js +16 -0
- package/lib/Editing/Mutable/MutableUnit.js.map +1 -0
- package/lib/Editing/Mutable/MutableUnitSystem.d.ts +9 -0
- package/lib/Editing/Mutable/MutableUnitSystem.d.ts.map +1 -0
- package/lib/Editing/Mutable/MutableUnitSystem.js +16 -0
- package/lib/Editing/Mutable/MutableUnitSystem.js.map +1 -0
- package/lib/Editing/Phenomena.d.ts +16 -0
- package/lib/Editing/Phenomena.d.ts.map +1 -0
- package/lib/Editing/Phenomena.js +48 -0
- package/lib/Editing/Phenomena.js.map +1 -0
- package/lib/Editing/PropertyCategories.d.ts +17 -0
- package/lib/Editing/PropertyCategories.d.ts.map +1 -0
- package/lib/Editing/PropertyCategories.js +54 -0
- package/lib/Editing/PropertyCategories.js.map +1 -0
- package/lib/Editing/RelationshipClasses.d.ts +22 -0
- package/lib/Editing/RelationshipClasses.d.ts.map +1 -0
- package/lib/Editing/RelationshipClasses.js +70 -0
- package/lib/Editing/RelationshipClasses.js.map +1 -0
- package/lib/Editing/Structs.d.ts +20 -0
- package/lib/Editing/Structs.d.ts.map +1 -0
- package/lib/Editing/Structs.js +57 -0
- package/lib/Editing/Structs.js.map +1 -0
- package/lib/Editing/UnitSystems.d.ts +16 -0
- package/lib/Editing/UnitSystems.d.ts.map +1 -0
- package/lib/Editing/UnitSystems.js +44 -0
- package/lib/Editing/UnitSystems.js.map +1 -0
- package/lib/Editing/Units.d.ts +16 -0
- package/lib/Editing/Units.d.ts.map +1 -0
- package/lib/Editing/Units.js +62 -0
- package/lib/Editing/Units.js.map +1 -0
- package/lib/Validation/Diagnostic.d.ts +322 -0
- package/lib/Validation/Diagnostic.d.ts.map +1 -0
- package/lib/Validation/Diagnostic.js +311 -0
- package/lib/Validation/Diagnostic.js.map +1 -0
- package/lib/Validation/DiagnosticReporter.d.ts +97 -0
- package/lib/Validation/DiagnosticReporter.d.ts.map +1 -0
- package/lib/Validation/DiagnosticReporter.js +107 -0
- package/lib/Validation/DiagnosticReporter.js.map +1 -0
- package/lib/Validation/ECRules.d.ts +439 -0
- package/lib/Validation/ECRules.d.ts.map +1 -0
- package/lib/Validation/ECRules.js +679 -0
- package/lib/Validation/ECRules.js.map +1 -0
- package/lib/Validation/LoggingDiagnosticReporter.d.ts +14 -0
- package/lib/Validation/LoggingDiagnosticReporter.d.ts.map +1 -0
- package/lib/Validation/LoggingDiagnosticReporter.js +41 -0
- package/lib/Validation/LoggingDiagnosticReporter.js.map +1 -0
- package/lib/Validation/RuleSuppressionSet.d.ts +59 -0
- package/lib/Validation/RuleSuppressionSet.d.ts.map +1 -0
- package/lib/Validation/RuleSuppressionSet.js +10 -0
- package/lib/Validation/RuleSuppressionSet.js.map +1 -0
- package/lib/Validation/Rules.d.ts +65 -0
- package/lib/Validation/Rules.d.ts.map +1 -0
- package/lib/Validation/Rules.js +10 -0
- package/lib/Validation/Rules.js.map +1 -0
- package/lib/Validation/SchemaChanges.d.ts +608 -0
- package/lib/Validation/SchemaChanges.d.ts.map +1 -0
- package/lib/Validation/SchemaChanges.js +1136 -0
- package/lib/Validation/SchemaChanges.js.map +1 -0
- package/lib/Validation/SchemaCompareDiagnostics.d.ts +423 -0
- package/lib/Validation/SchemaCompareDiagnostics.d.ts.map +1 -0
- package/lib/Validation/SchemaCompareDiagnostics.js +112 -0
- package/lib/Validation/SchemaCompareDiagnostics.js.map +1 -0
- package/lib/Validation/SchemaCompareReporter.d.ts +12 -0
- package/lib/Validation/SchemaCompareReporter.d.ts.map +1 -0
- package/lib/Validation/SchemaCompareReporter.js +10 -0
- package/lib/Validation/SchemaCompareReporter.js.map +1 -0
- package/lib/Validation/SchemaCompareResultDelegate.d.ts +237 -0
- package/lib/Validation/SchemaCompareResultDelegate.d.ts.map +1 -0
- package/lib/Validation/SchemaCompareResultDelegate.js +349 -0
- package/lib/Validation/SchemaCompareResultDelegate.js.map +1 -0
- package/lib/Validation/SchemaCompareVisitor.d.ts +120 -0
- package/lib/Validation/SchemaCompareVisitor.d.ts.map +1 -0
- package/lib/Validation/SchemaCompareVisitor.js +207 -0
- package/lib/Validation/SchemaCompareVisitor.js.map +1 -0
- package/lib/Validation/SchemaComparer.d.ts +172 -0
- package/lib/Validation/SchemaComparer.d.ts.map +1 -0
- package/lib/Validation/SchemaComparer.js +666 -0
- package/lib/Validation/SchemaComparer.js.map +1 -0
- package/lib/Validation/SchemaValidater.d.ts +20 -0
- package/lib/Validation/SchemaValidater.d.ts.map +1 -0
- package/lib/Validation/SchemaValidater.js +62 -0
- package/lib/Validation/SchemaValidater.js.map +1 -0
- package/lib/Validation/SchemaValidationVisitor.d.ts +171 -0
- package/lib/Validation/SchemaValidationVisitor.d.ts.map +1 -0
- package/lib/Validation/SchemaValidationVisitor.js +729 -0
- package/lib/Validation/SchemaValidationVisitor.js.map +1 -0
- package/lib/Validation/SchemaWalker.d.ts +23 -0
- package/lib/Validation/SchemaWalker.d.ts.map +1 -0
- package/lib/Validation/SchemaWalker.js +52 -0
- package/lib/Validation/SchemaWalker.js.map +1 -0
- package/lib/ecschema-editing.d.ts +34 -0
- package/lib/ecschema-editing.d.ts.map +1 -0
- package/lib/ecschema-editing.js +55 -0
- package/lib/ecschema-editing.js.map +1 -0
- package/package.json +85 -0
- package/public/locales/en/ECSchemaEditing.json +27 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Units.js","sourceRoot":"","sources":["../../src/Editing/Units.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAgJ;AAIhJ;;;GAGG;AACH,MAAa,KAAK;IAChB,6CAA6C;IAC7C,YAA6B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAAI,CAAC;IAE7D,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,UAAkB,EAAE,UAAyB,EAAE,UAAyB,EAAE,YAAqB;QACrJ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS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AE,KAAK,IAAI,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QAE5H,MAAM,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAExC,IAAI,YAAY,EAAE;YAAE,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;SAAE;QAE5D,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;IAClC,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,SAAoB;QACrE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,EAAE,YAAY,EAAE,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAEjH,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS;YAAE,OAAO,EAAE,YAAY,EAAE,oCAAoC,EAAE,CAAC;QAChG,MAAM,OAAO,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1D,IAAI,OAAO,KAAK,SAAS,EAAE;YACzB,OAAO,EAAE,YAAY,EAAE,0BAA0B,SAAS,CAAC,IAAI,cAAc,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;SAC5G;QAED,MAAM,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAClC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;IAClC,CAAC;CACF;AA3CD,sBA2CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { DelayedPromiseWithProps, Phenomenon, SchemaItemKey, SchemaItemType, SchemaKey, UnitProps, UnitSystem } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor, SchemaItemEditResults } from \"./Editor\";\nimport { MutableUnit } from \"./Mutable/MutableUnit\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type Unit.\n */\nexport class Units {\n // TODO: Add more setters for all attributes.\n public constructor(protected _schemaEditor: SchemaContextEditor) { }\n\n public async create(schemaKey: SchemaKey, name: string, definition: string, phenomenon: SchemaItemKey, unitSystem: SchemaItemKey, displayLabel?: string): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined) return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n const newUnit = (await schema.createUnit(name)) as MutableUnit;\n if (newUnit === undefined) {\n return { errorMessage: `Failed to create class ${name} in schema ${schemaKey.toString(true)}.` };\n }\n\n const phenomenonItem = await schema.lookupItem(phenomenon) as Phenomenon;\n if (phenomenonItem === undefined) return { errorMessage: `Unable to locate phenomenon ${phenomenon.fullName} in schema ${schema.fullName}.` };\n if (phenomenonItem.schemaItemType !== SchemaItemType.Phenomenon) return { errorMessage: `${phenomenon.fullName} is not of type Phenomenon.` };\n await newUnit.setPhenomenon(new DelayedPromiseWithProps<SchemaItemKey, Phenomenon>(phenomenon, async () => phenomenonItem));\n\n const unitSystemItem = await schema.lookupItem(unitSystem) as UnitSystem;\n if (unitSystemItem === undefined) return { errorMessage: `Unable to locate unit system ${unitSystem.fullName} in schema ${schema.fullName}.` };\n if (unitSystemItem.schemaItemType !== SchemaItemType.UnitSystem) return { errorMessage: `${unitSystem.fullName} is not of type UnitSystem.` };\n await newUnit.setUnitSystem(new DelayedPromiseWithProps<SchemaItemKey, UnitSystem>(unitSystem, async () => unitSystemItem));\n\n await newUnit.setDefinition(definition);\n\n if (displayLabel) { newUnit.setDisplayLabel(displayLabel); }\n\n return { itemKey: newUnit.key };\n }\n\n public async createFromProps(schemaKey: SchemaKey, unitProps: UnitProps): Promise<SchemaItemEditResults> {\n const schema = await this._schemaEditor.getSchema(schemaKey);\n if (schema === undefined) return { errorMessage: `Schema Key ${schemaKey.toString(true)} not found in context` };\n\n if (unitProps.name === undefined) return { errorMessage: `No name was supplied within props.` };\n const newUnit = (await schema.createUnit(unitProps.name));\n if (newUnit === undefined) {\n return { errorMessage: `Failed to create class ${unitProps.name} in schema ${schemaKey.toString(true)}.` };\n }\n\n await newUnit.fromJSON(unitProps);\n return { itemKey: newUnit.key };\n }\n}\n"]}
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Diagnostic
|
|
3
|
+
*/
|
|
4
|
+
import { AnyClass, AnyECType, AnyProperty, CustomAttributeContainerProps, RelationshipConstraint, Schema, SchemaItem } from "@itwin/ecschema-metadata";
|
|
5
|
+
/**
|
|
6
|
+
* Defines the possible diagnostic types.
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
export declare enum DiagnosticType {
|
|
10
|
+
None = 0,
|
|
11
|
+
Schema = 1,
|
|
12
|
+
SchemaItem = 2,
|
|
13
|
+
Property = 3,
|
|
14
|
+
CustomAttributeContainer = 4,
|
|
15
|
+
RelationshipConstraint = 5
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Defines the possible diagnostic categories.
|
|
19
|
+
* @beta
|
|
20
|
+
*/
|
|
21
|
+
export declare enum DiagnosticCategory {
|
|
22
|
+
Warning = 0,
|
|
23
|
+
Error = 1,
|
|
24
|
+
Suggestion = 2,
|
|
25
|
+
Message = 3
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The interface implemented by all diagnostics used during schema validation.
|
|
29
|
+
* @beta
|
|
30
|
+
*/
|
|
31
|
+
export interface IDiagnostic<TYPE extends AnyECType, ARGS extends any[]> {
|
|
32
|
+
/** The diagnostic category (error, warning, etc...). Value is static across all instances. */
|
|
33
|
+
category: DiagnosticCategory;
|
|
34
|
+
/** The unique string identifier of the diagnostic in the format '<ruleSetName>:<number>. Value is static across all instances. */
|
|
35
|
+
code: string;
|
|
36
|
+
/** The context type of diagnostic (schema, schema item, property, etc...). Value is static across all instances. */
|
|
37
|
+
diagnosticType: DiagnosticType;
|
|
38
|
+
/** The unformatted message text associated with the diagnostic. Value is static across all instances. */
|
|
39
|
+
messageText: string;
|
|
40
|
+
/** The arguments used when formatted the diagnostic instance's message. */
|
|
41
|
+
messageArgs?: ARGS;
|
|
42
|
+
/** The EC object associated with the diagnostic instance. */
|
|
43
|
+
ecDefinition: TYPE;
|
|
44
|
+
/** The schema where the diagnostic originated. */
|
|
45
|
+
schema: Schema;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Type which encapsulates all possible diagnostics.
|
|
49
|
+
* @beta
|
|
50
|
+
*/
|
|
51
|
+
export declare type AnyDiagnostic = IDiagnostic<AnyECType, any[]>;
|
|
52
|
+
/**
|
|
53
|
+
* The abstract base class for all [[IDiagnostic]] implementations.
|
|
54
|
+
* @beta
|
|
55
|
+
*/
|
|
56
|
+
export declare abstract class BaseDiagnostic<TYPE extends AnyECType, ARGS extends any[]> implements IDiagnostic<TYPE, ARGS> {
|
|
57
|
+
/**
|
|
58
|
+
* Initializes a new BaseDiagnostic.
|
|
59
|
+
* @param ecDefinition The EC object to associate with the diagnostic.
|
|
60
|
+
* @param messageArgs The arguments used when formatting the diagnostic message.
|
|
61
|
+
* @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.
|
|
62
|
+
*/
|
|
63
|
+
constructor(ecDefinition: TYPE, messageArgs?: ARGS, category?: DiagnosticCategory);
|
|
64
|
+
/** Gets the unique string identifier for the diagnostic in the format '<ruleSetName>:<number>'. */
|
|
65
|
+
abstract get code(): string;
|
|
66
|
+
/** Gets the context type of the diagnostic (schema, schema item, property, etc...) */
|
|
67
|
+
abstract get diagnosticType(): DiagnosticType;
|
|
68
|
+
/** Gets the message associated with the diagnostic. */
|
|
69
|
+
abstract get messageText(): string;
|
|
70
|
+
/** Gets the schema where the diagnostic originated. */
|
|
71
|
+
abstract get schema(): Schema;
|
|
72
|
+
/** The EC object to associate with the diagnostic. */
|
|
73
|
+
ecDefinition: TYPE;
|
|
74
|
+
/** The arguments used when formatting the diagnostic message. */
|
|
75
|
+
messageArgs?: ARGS;
|
|
76
|
+
/** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */
|
|
77
|
+
category: DiagnosticCategory;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* An [[IDiagnostic]] implementation used for [[Schema]] diagnostics.
|
|
81
|
+
* @beta
|
|
82
|
+
*/
|
|
83
|
+
export declare abstract class SchemaDiagnostic<ARGS extends any[]> extends BaseDiagnostic<Schema, ARGS> {
|
|
84
|
+
static diagnosticType: DiagnosticType;
|
|
85
|
+
/**
|
|
86
|
+
* Initializes a new SchemaDiagnostic.
|
|
87
|
+
* @param ecDefinition The EC object to associate with the diagnostic.
|
|
88
|
+
* @param messageArgs The arguments used when formatting the diagnostic message.
|
|
89
|
+
* @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.
|
|
90
|
+
*/
|
|
91
|
+
constructor(schema: Schema, messageArgs: ARGS, category?: DiagnosticCategory);
|
|
92
|
+
/** Gets the schema where the diagnostic originated. */
|
|
93
|
+
get schema(): Schema;
|
|
94
|
+
/** Gets the DiagnosticType. */
|
|
95
|
+
get diagnosticType(): DiagnosticType;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* An [[IDiagnostic]] implementation used for [[SchemaItem]] diagnostics.
|
|
99
|
+
* @beta
|
|
100
|
+
*/
|
|
101
|
+
export declare abstract class SchemaItemDiagnostic<TYPE extends SchemaItem, ARGS extends any[]> extends BaseDiagnostic<TYPE, ARGS> {
|
|
102
|
+
static diagnosticType: DiagnosticType;
|
|
103
|
+
/**
|
|
104
|
+
* Initializes a new SchemaItemDiagnostic.
|
|
105
|
+
* @param ecDefinition The EC object to associate with the diagnostic.
|
|
106
|
+
* @param messageArgs The arguments used when formatting the diagnostic message.
|
|
107
|
+
* @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.
|
|
108
|
+
*/
|
|
109
|
+
constructor(ecDefinition: SchemaItem, messageArgs: ARGS, category?: DiagnosticCategory);
|
|
110
|
+
/** Gets the schema where the diagnostic originated. */
|
|
111
|
+
get schema(): Schema;
|
|
112
|
+
/** Gets the DiagnosticType. */
|
|
113
|
+
get diagnosticType(): DiagnosticType;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* An [[IDiagnostic]] implementation used for [[ECClass]] diagnostics.
|
|
117
|
+
* @beta
|
|
118
|
+
*/
|
|
119
|
+
export declare abstract class ClassDiagnostic<ARGS extends any[]> extends SchemaItemDiagnostic<AnyClass, ARGS> {
|
|
120
|
+
/**
|
|
121
|
+
* Initializes a new ClassDiagnostic.
|
|
122
|
+
* @param ecClass The class to associate with the diagnostic.
|
|
123
|
+
* @param messageArgs The arguments used when formatting the diagnostic message.
|
|
124
|
+
* @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.
|
|
125
|
+
*/
|
|
126
|
+
constructor(ecClass: AnyClass, messageArgs: ARGS, category?: DiagnosticCategory);
|
|
127
|
+
/** Gets the schema where the diagnostic originated. */
|
|
128
|
+
get schema(): Schema;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* An [[IDiagnostic]] implementation used for [[Property]] diagnostics.
|
|
132
|
+
* @beta
|
|
133
|
+
*/
|
|
134
|
+
export declare abstract class PropertyDiagnostic<ARGS extends any[]> extends BaseDiagnostic<AnyProperty, ARGS> {
|
|
135
|
+
/**
|
|
136
|
+
* Initializes a new PropertyDiagnostic.
|
|
137
|
+
* @param property The property to associate with the diagnostic.
|
|
138
|
+
* @param messageArgs The arguments used when formatting the diagnostic message.
|
|
139
|
+
* @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.
|
|
140
|
+
*/
|
|
141
|
+
constructor(property: AnyProperty, messageArgs?: ARGS, category?: DiagnosticCategory);
|
|
142
|
+
/** Gets the schema where the diagnostic originated. */
|
|
143
|
+
get schema(): Schema;
|
|
144
|
+
/** Gets the DiagnosticType. */
|
|
145
|
+
get diagnosticType(): DiagnosticType;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* An [[IDiagnostic]] implementation used for [[RelationshipConstraint]] diagnostics.
|
|
149
|
+
* @beta
|
|
150
|
+
*/
|
|
151
|
+
export declare abstract class RelationshipConstraintDiagnostic<ARGS extends any[]> extends BaseDiagnostic<RelationshipConstraint, ARGS> {
|
|
152
|
+
/**
|
|
153
|
+
* Initializes a new RelationshipConstraintDiagnostic.
|
|
154
|
+
* @param constraint The Relationship Constraint to associate with the diagnostic.
|
|
155
|
+
* @param messageArgs The arguments used when formatting the diagnostic message.
|
|
156
|
+
* @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.
|
|
157
|
+
*/
|
|
158
|
+
constructor(constraint: RelationshipConstraint, messageArgs: ARGS, category?: DiagnosticCategory);
|
|
159
|
+
/** Gets the schema where the diagnostic originated. */
|
|
160
|
+
get schema(): Schema;
|
|
161
|
+
/** Gets the DiagnosticType. */
|
|
162
|
+
get diagnosticType(): DiagnosticType;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* An [[IDiagnostic]] implementation used for [[CustomAttributeContainerProps]] diagnostics.
|
|
166
|
+
* @beta
|
|
167
|
+
*/
|
|
168
|
+
export declare abstract class CustomAttributeContainerDiagnostic<ARGS extends any[]> extends BaseDiagnostic<CustomAttributeContainerProps, ARGS> {
|
|
169
|
+
/**
|
|
170
|
+
* Initializes a new CustomAttributeContainerDiagnostic.
|
|
171
|
+
* @param constraint The Custom Attribute Container to associate with the diagnostic.
|
|
172
|
+
* @param messageArgs The arguments used when formatting the diagnostic message.
|
|
173
|
+
* @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.
|
|
174
|
+
*/
|
|
175
|
+
constructor(container: CustomAttributeContainerProps, messageArgs: ARGS, category?: DiagnosticCategory);
|
|
176
|
+
/** Gets the schema where the diagnostic originated. */
|
|
177
|
+
get schema(): Schema;
|
|
178
|
+
/** Gets the DiagnosticType. */
|
|
179
|
+
get diagnosticType(): DiagnosticType;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Helper method for creating [[SchemaDiagnostic]] child classes.
|
|
183
|
+
* @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.
|
|
184
|
+
* @param messageText The message to associate with the diagnostic class.
|
|
185
|
+
* @beta
|
|
186
|
+
*/
|
|
187
|
+
export declare function createSchemaDiagnosticClass<ARGS extends any[]>(code: string, messageText: string): {
|
|
188
|
+
new (schema: Schema, messageArgs: ARGS, category?: DiagnosticCategory): {
|
|
189
|
+
readonly code: string;
|
|
190
|
+
readonly messageText: string;
|
|
191
|
+
/** Gets the schema where the diagnostic originated. */
|
|
192
|
+
readonly schema: Schema;
|
|
193
|
+
/** Gets the DiagnosticType. */
|
|
194
|
+
readonly diagnosticType: DiagnosticType;
|
|
195
|
+
/** The EC object to associate with the diagnostic. */
|
|
196
|
+
ecDefinition: Schema;
|
|
197
|
+
/** The arguments used when formatting the diagnostic message. */
|
|
198
|
+
messageArgs?: ARGS | undefined;
|
|
199
|
+
/** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */
|
|
200
|
+
category: DiagnosticCategory;
|
|
201
|
+
};
|
|
202
|
+
code: string;
|
|
203
|
+
diagnosticType: DiagnosticType;
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Helper method for creating [[SchemaItemDiagnostic]] child classes.
|
|
207
|
+
* @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.
|
|
208
|
+
* @param messageText The message to associate with the diagnostic class.
|
|
209
|
+
* @beta
|
|
210
|
+
*/
|
|
211
|
+
export declare function createSchemaItemDiagnosticClass<ITEM extends SchemaItem, ARGS extends any[]>(code: string, messageText: string): {
|
|
212
|
+
new (ecDefinition: SchemaItem, messageArgs: ARGS, category?: DiagnosticCategory): {
|
|
213
|
+
readonly code: string;
|
|
214
|
+
readonly messageText: string;
|
|
215
|
+
/** Gets the schema where the diagnostic originated. */
|
|
216
|
+
readonly schema: Schema;
|
|
217
|
+
/** Gets the DiagnosticType. */
|
|
218
|
+
readonly diagnosticType: DiagnosticType;
|
|
219
|
+
/** The EC object to associate with the diagnostic. */
|
|
220
|
+
ecDefinition: ITEM;
|
|
221
|
+
/** The arguments used when formatting the diagnostic message. */
|
|
222
|
+
messageArgs?: ARGS | undefined;
|
|
223
|
+
/** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */
|
|
224
|
+
category: DiagnosticCategory;
|
|
225
|
+
};
|
|
226
|
+
diagnosticType: DiagnosticType;
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Helper method for creating [[ClassDiagnostic]] child classes.
|
|
230
|
+
* @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.
|
|
231
|
+
* @param messageText The message to associate with the diagnostic class.
|
|
232
|
+
* @beta
|
|
233
|
+
*/
|
|
234
|
+
export declare function createClassDiagnosticClass<ARGS extends any[]>(code: string, messageText: string): {
|
|
235
|
+
new (ecClass: AnyClass, messageArgs: ARGS, category?: DiagnosticCategory): {
|
|
236
|
+
readonly code: string;
|
|
237
|
+
readonly messageText: string;
|
|
238
|
+
/** Gets the schema where the diagnostic originated. */
|
|
239
|
+
readonly schema: Schema;
|
|
240
|
+
/** Gets the DiagnosticType. */
|
|
241
|
+
readonly diagnosticType: DiagnosticType;
|
|
242
|
+
/** The EC object to associate with the diagnostic. */
|
|
243
|
+
ecDefinition: AnyClass;
|
|
244
|
+
/** The arguments used when formatting the diagnostic message. */
|
|
245
|
+
messageArgs?: ARGS | undefined;
|
|
246
|
+
/** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */
|
|
247
|
+
category: DiagnosticCategory;
|
|
248
|
+
};
|
|
249
|
+
diagnosticType: DiagnosticType;
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Helper method for creating [[PropertyDiagnostic]] child classes.
|
|
253
|
+
* @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.
|
|
254
|
+
* @param messageText The message to associate with the diagnostic class.
|
|
255
|
+
* @beta
|
|
256
|
+
*/
|
|
257
|
+
export declare function createPropertyDiagnosticClass<ARGS extends any[]>(code: string, messageText: string): {
|
|
258
|
+
new (property: AnyProperty, messageArgs?: ARGS | undefined, category?: DiagnosticCategory): {
|
|
259
|
+
readonly code: string;
|
|
260
|
+
readonly messageText: string;
|
|
261
|
+
/** Gets the schema where the diagnostic originated. */
|
|
262
|
+
readonly schema: Schema;
|
|
263
|
+
/** Gets the DiagnosticType. */
|
|
264
|
+
readonly diagnosticType: DiagnosticType;
|
|
265
|
+
/** The EC object to associate with the diagnostic. */
|
|
266
|
+
ecDefinition: AnyProperty;
|
|
267
|
+
/** The arguments used when formatting the diagnostic message. */
|
|
268
|
+
messageArgs?: ARGS | undefined;
|
|
269
|
+
/** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */
|
|
270
|
+
category: DiagnosticCategory;
|
|
271
|
+
};
|
|
272
|
+
code: string;
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* Helper method for creating [[RelationshipConstraintDiagnostic]] child classes.
|
|
276
|
+
* @param code The string that uniquely identifies the type of diagnostic in the format '<ruleSetName>:<number>'.
|
|
277
|
+
* @param messageText The message to associate with the diagnostic class.
|
|
278
|
+
* @beta
|
|
279
|
+
*/
|
|
280
|
+
export declare function createRelationshipConstraintDiagnosticClass<ARGS extends any[]>(code: string, messageText: string): {
|
|
281
|
+
new (constraint: RelationshipConstraint, messageArgs: ARGS, category?: DiagnosticCategory): {
|
|
282
|
+
readonly code: string;
|
|
283
|
+
readonly messageText: string;
|
|
284
|
+
/** Gets the schema where the diagnostic originated. */
|
|
285
|
+
readonly schema: Schema;
|
|
286
|
+
/** Gets the DiagnosticType. */
|
|
287
|
+
readonly diagnosticType: DiagnosticType;
|
|
288
|
+
/** The EC object to associate with the diagnostic. */
|
|
289
|
+
ecDefinition: RelationshipConstraint;
|
|
290
|
+
/** The arguments used when formatting the diagnostic message. */
|
|
291
|
+
messageArgs?: ARGS | undefined;
|
|
292
|
+
/** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */
|
|
293
|
+
category: DiagnosticCategory;
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* Helper method for creating [[CustomAttributeContainerDiagnostic]] child classes.
|
|
298
|
+
* @param code The that uniquely identifies the type of diagnostic in the format '<ruleSetName>:<number>'.
|
|
299
|
+
* @param messageText The message to associate with the diagnostic class.
|
|
300
|
+
* @beta
|
|
301
|
+
*/
|
|
302
|
+
export declare function createCustomAttributeContainerDiagnosticClass<ARGS extends any[]>(code: string, messageText: string): {
|
|
303
|
+
new (container: CustomAttributeContainerProps, messageArgs: ARGS, category?: DiagnosticCategory): {
|
|
304
|
+
readonly code: string;
|
|
305
|
+
readonly messageText: string;
|
|
306
|
+
/** Gets the schema where the diagnostic originated. */
|
|
307
|
+
readonly schema: Schema;
|
|
308
|
+
/** Gets the DiagnosticType. */
|
|
309
|
+
readonly diagnosticType: DiagnosticType;
|
|
310
|
+
/** The EC object to associate with the diagnostic. */
|
|
311
|
+
ecDefinition: CustomAttributeContainerProps;
|
|
312
|
+
/** The arguments used when formatting the diagnostic message. */
|
|
313
|
+
messageArgs?: ARGS | undefined;
|
|
314
|
+
/** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */
|
|
315
|
+
category: DiagnosticCategory;
|
|
316
|
+
};
|
|
317
|
+
};
|
|
318
|
+
/** @beta */
|
|
319
|
+
export declare function diagnosticCategoryToString(category: DiagnosticCategory): "Error" | "Warning" | "Message" | "Suggestion";
|
|
320
|
+
/** @beta */
|
|
321
|
+
export declare function diagnosticTypeToString(type: DiagnosticType): "CustomAttributeContainer" | "None" | "Property" | "RelationshipConstraint" | "Schema" | "SchemaItem";
|
|
322
|
+
//# sourceMappingURL=Diagnostic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Diagnostic.d.ts","sourceRoot":"","sources":["../../src/Validation/Diagnostic.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAYvJ;;;GAGG;AACH,oBAAY,cAAc;IACxB,IAAI,IAAA;IACJ,MAAM,IAAA;IACN,UAAU,IAAA;IACV,QAAQ,IAAA;IACR,wBAAwB,IAAA;IACxB,sBAAsB,IAAA;CACvB;AAED;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B,OAAO,IAAA;IACP,KAAK,IAAA;IACL,UAAU,IAAA;IACV,OAAO,IAAA;CACR;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW,CAAC,IAAI,SAAS,SAAS,EAAE,IAAI,SAAS,GAAG,EAAE;IACrE,8FAA8F;IAC9F,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,kIAAkI;IAClI,IAAI,EAAE,MAAM,CAAC;IACb,oHAAoH;IACpH,cAAc,EAAE,cAAc,CAAC;IAC/B,yGAAyG;IACzG,WAAW,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,6DAA6D;IAC7D,YAAY,EAAE,IAAI,CAAC;IACnB,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,oBAAY,aAAa,GAAG,WAAW,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;AAE1D;;;GAGG;AACH,8BAAsB,cAAc,CAAC,IAAI,SAAS,SAAS,EAAE,IAAI,SAAS,GAAG,EAAE,CAAE,YAAW,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC;IACjH;;;;;OAKG;gBACS,YAAY,EAAE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AA4G;;;EA4N7G;AAED,YAAY;AACZ,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,kBAAkB,kDAWtE;AAED,YAAY;AACZ,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,cAAc,yGAe1D"}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Diagnostic
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.diagnosticTypeToString = exports.diagnosticCategoryToString = exports.createCustomAttributeContainerDiagnosticClass = exports.createRelationshipConstraintDiagnosticClass = exports.createPropertyDiagnosticClass = exports.createClassDiagnosticClass = exports.createSchemaItemDiagnosticClass = exports.createSchemaDiagnosticClass = exports.CustomAttributeContainerDiagnostic = exports.RelationshipConstraintDiagnostic = exports.PropertyDiagnostic = exports.ClassDiagnostic = exports.SchemaItemDiagnostic = exports.SchemaDiagnostic = exports.BaseDiagnostic = exports.DiagnosticCategory = exports.DiagnosticType = void 0;
|
|
11
|
+
/* eslint-disable @typescript-eslint/no-shadow */
|
|
12
|
+
const formatString = (format, ...args) => {
|
|
13
|
+
return format.replace(/{(\d+)}/g, (match, theNumber) => {
|
|
14
|
+
return typeof args[theNumber] !== "undefined"
|
|
15
|
+
? args[theNumber]
|
|
16
|
+
: match;
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Defines the possible diagnostic types.
|
|
21
|
+
* @beta
|
|
22
|
+
*/
|
|
23
|
+
var DiagnosticType;
|
|
24
|
+
(function (DiagnosticType) {
|
|
25
|
+
DiagnosticType[DiagnosticType["None"] = 0] = "None";
|
|
26
|
+
DiagnosticType[DiagnosticType["Schema"] = 1] = "Schema";
|
|
27
|
+
DiagnosticType[DiagnosticType["SchemaItem"] = 2] = "SchemaItem";
|
|
28
|
+
DiagnosticType[DiagnosticType["Property"] = 3] = "Property";
|
|
29
|
+
DiagnosticType[DiagnosticType["CustomAttributeContainer"] = 4] = "CustomAttributeContainer";
|
|
30
|
+
DiagnosticType[DiagnosticType["RelationshipConstraint"] = 5] = "RelationshipConstraint";
|
|
31
|
+
})(DiagnosticType = exports.DiagnosticType || (exports.DiagnosticType = {}));
|
|
32
|
+
/**
|
|
33
|
+
* Defines the possible diagnostic categories.
|
|
34
|
+
* @beta
|
|
35
|
+
*/
|
|
36
|
+
var DiagnosticCategory;
|
|
37
|
+
(function (DiagnosticCategory) {
|
|
38
|
+
DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning";
|
|
39
|
+
DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
|
|
40
|
+
DiagnosticCategory[DiagnosticCategory["Suggestion"] = 2] = "Suggestion";
|
|
41
|
+
DiagnosticCategory[DiagnosticCategory["Message"] = 3] = "Message";
|
|
42
|
+
})(DiagnosticCategory = exports.DiagnosticCategory || (exports.DiagnosticCategory = {}));
|
|
43
|
+
/**
|
|
44
|
+
* The abstract base class for all [[IDiagnostic]] implementations.
|
|
45
|
+
* @beta
|
|
46
|
+
*/
|
|
47
|
+
class BaseDiagnostic {
|
|
48
|
+
/**
|
|
49
|
+
* Initializes a new BaseDiagnostic.
|
|
50
|
+
* @param ecDefinition The EC object to associate with the diagnostic.
|
|
51
|
+
* @param messageArgs The arguments used when formatting the diagnostic message.
|
|
52
|
+
* @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.
|
|
53
|
+
*/
|
|
54
|
+
constructor(ecDefinition, messageArgs, category = DiagnosticCategory.Error) {
|
|
55
|
+
this.ecDefinition = ecDefinition;
|
|
56
|
+
this.messageArgs = messageArgs;
|
|
57
|
+
this.category = category;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.BaseDiagnostic = BaseDiagnostic;
|
|
61
|
+
/**
|
|
62
|
+
* An [[IDiagnostic]] implementation used for [[Schema]] diagnostics.
|
|
63
|
+
* @beta
|
|
64
|
+
*/
|
|
65
|
+
class SchemaDiagnostic extends BaseDiagnostic {
|
|
66
|
+
/**
|
|
67
|
+
* Initializes a new SchemaDiagnostic.
|
|
68
|
+
* @param ecDefinition The EC object to associate with the diagnostic.
|
|
69
|
+
* @param messageArgs The arguments used when formatting the diagnostic message.
|
|
70
|
+
* @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.
|
|
71
|
+
*/
|
|
72
|
+
constructor(schema, messageArgs, category = DiagnosticCategory.Error) {
|
|
73
|
+
super(schema, messageArgs, category);
|
|
74
|
+
}
|
|
75
|
+
/** Gets the schema where the diagnostic originated. */
|
|
76
|
+
get schema() { return this.ecDefinition; }
|
|
77
|
+
/** Gets the DiagnosticType. */
|
|
78
|
+
get diagnosticType() { return DiagnosticType.Schema; }
|
|
79
|
+
}
|
|
80
|
+
exports.SchemaDiagnostic = SchemaDiagnostic;
|
|
81
|
+
SchemaDiagnostic.diagnosticType = DiagnosticType.SchemaItem;
|
|
82
|
+
/**
|
|
83
|
+
* An [[IDiagnostic]] implementation used for [[SchemaItem]] diagnostics.
|
|
84
|
+
* @beta
|
|
85
|
+
*/
|
|
86
|
+
class SchemaItemDiagnostic extends BaseDiagnostic {
|
|
87
|
+
/**
|
|
88
|
+
* Initializes a new SchemaItemDiagnostic.
|
|
89
|
+
* @param ecDefinition The EC object to associate with the diagnostic.
|
|
90
|
+
* @param messageArgs The arguments used when formatting the diagnostic message.
|
|
91
|
+
* @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.
|
|
92
|
+
*/
|
|
93
|
+
constructor(ecDefinition, messageArgs, category = DiagnosticCategory.Error) {
|
|
94
|
+
super(ecDefinition, messageArgs, category);
|
|
95
|
+
}
|
|
96
|
+
/** Gets the schema where the diagnostic originated. */
|
|
97
|
+
get schema() { return this.ecDefinition.schema; }
|
|
98
|
+
/** Gets the DiagnosticType. */
|
|
99
|
+
get diagnosticType() { return DiagnosticType.SchemaItem; }
|
|
100
|
+
}
|
|
101
|
+
exports.SchemaItemDiagnostic = SchemaItemDiagnostic;
|
|
102
|
+
SchemaItemDiagnostic.diagnosticType = DiagnosticType.SchemaItem;
|
|
103
|
+
/**
|
|
104
|
+
* An [[IDiagnostic]] implementation used for [[ECClass]] diagnostics.
|
|
105
|
+
* @beta
|
|
106
|
+
*/
|
|
107
|
+
class ClassDiagnostic extends SchemaItemDiagnostic {
|
|
108
|
+
/**
|
|
109
|
+
* Initializes a new ClassDiagnostic.
|
|
110
|
+
* @param ecClass The class to associate with the diagnostic.
|
|
111
|
+
* @param messageArgs The arguments used when formatting the diagnostic message.
|
|
112
|
+
* @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.
|
|
113
|
+
*/
|
|
114
|
+
constructor(ecClass, messageArgs, category = DiagnosticCategory.Error) {
|
|
115
|
+
super(ecClass, messageArgs, category);
|
|
116
|
+
}
|
|
117
|
+
/** Gets the schema where the diagnostic originated. */
|
|
118
|
+
get schema() { return this.ecDefinition.schema; }
|
|
119
|
+
}
|
|
120
|
+
exports.ClassDiagnostic = ClassDiagnostic;
|
|
121
|
+
/**
|
|
122
|
+
* An [[IDiagnostic]] implementation used for [[Property]] diagnostics.
|
|
123
|
+
* @beta
|
|
124
|
+
*/
|
|
125
|
+
class PropertyDiagnostic extends BaseDiagnostic {
|
|
126
|
+
/**
|
|
127
|
+
* Initializes a new PropertyDiagnostic.
|
|
128
|
+
* @param property The property to associate with the diagnostic.
|
|
129
|
+
* @param messageArgs The arguments used when formatting the diagnostic message.
|
|
130
|
+
* @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.
|
|
131
|
+
*/
|
|
132
|
+
constructor(property, messageArgs, category = DiagnosticCategory.Error) {
|
|
133
|
+
super(property, messageArgs, category);
|
|
134
|
+
}
|
|
135
|
+
/** Gets the schema where the diagnostic originated. */
|
|
136
|
+
get schema() { return this.ecDefinition.schema; }
|
|
137
|
+
/** Gets the DiagnosticType. */
|
|
138
|
+
get diagnosticType() { return DiagnosticType.Property; }
|
|
139
|
+
}
|
|
140
|
+
exports.PropertyDiagnostic = PropertyDiagnostic;
|
|
141
|
+
/**
|
|
142
|
+
* An [[IDiagnostic]] implementation used for [[RelationshipConstraint]] diagnostics.
|
|
143
|
+
* @beta
|
|
144
|
+
*/
|
|
145
|
+
class RelationshipConstraintDiagnostic extends BaseDiagnostic {
|
|
146
|
+
/**
|
|
147
|
+
* Initializes a new RelationshipConstraintDiagnostic.
|
|
148
|
+
* @param constraint The Relationship Constraint to associate with the diagnostic.
|
|
149
|
+
* @param messageArgs The arguments used when formatting the diagnostic message.
|
|
150
|
+
* @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.
|
|
151
|
+
*/
|
|
152
|
+
constructor(constraint, messageArgs, category = DiagnosticCategory.Error) {
|
|
153
|
+
super(constraint, messageArgs, category);
|
|
154
|
+
}
|
|
155
|
+
/** Gets the schema where the diagnostic originated. */
|
|
156
|
+
get schema() { return this.ecDefinition.schema; }
|
|
157
|
+
/** Gets the DiagnosticType. */
|
|
158
|
+
get diagnosticType() { return DiagnosticType.RelationshipConstraint; }
|
|
159
|
+
}
|
|
160
|
+
exports.RelationshipConstraintDiagnostic = RelationshipConstraintDiagnostic;
|
|
161
|
+
/**
|
|
162
|
+
* An [[IDiagnostic]] implementation used for [[CustomAttributeContainerProps]] diagnostics.
|
|
163
|
+
* @beta
|
|
164
|
+
*/
|
|
165
|
+
class CustomAttributeContainerDiagnostic extends BaseDiagnostic {
|
|
166
|
+
/**
|
|
167
|
+
* Initializes a new CustomAttributeContainerDiagnostic.
|
|
168
|
+
* @param constraint The Custom Attribute Container to associate with the diagnostic.
|
|
169
|
+
* @param messageArgs The arguments used when formatting the diagnostic message.
|
|
170
|
+
* @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.
|
|
171
|
+
*/
|
|
172
|
+
constructor(container, messageArgs, category = DiagnosticCategory.Error) {
|
|
173
|
+
super(container, messageArgs, category);
|
|
174
|
+
}
|
|
175
|
+
/** Gets the schema where the diagnostic originated. */
|
|
176
|
+
get schema() { return this.ecDefinition.schema; }
|
|
177
|
+
/** Gets the DiagnosticType. */
|
|
178
|
+
get diagnosticType() { return DiagnosticType.CustomAttributeContainer; }
|
|
179
|
+
}
|
|
180
|
+
exports.CustomAttributeContainerDiagnostic = CustomAttributeContainerDiagnostic;
|
|
181
|
+
/**
|
|
182
|
+
* Helper method for creating [[SchemaDiagnostic]] child classes.
|
|
183
|
+
* @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.
|
|
184
|
+
* @param messageText The message to associate with the diagnostic class.
|
|
185
|
+
* @beta
|
|
186
|
+
*/
|
|
187
|
+
function createSchemaDiagnosticClass(code, messageText) {
|
|
188
|
+
var _a;
|
|
189
|
+
validateCode(code);
|
|
190
|
+
return _a = class extends SchemaDiagnostic {
|
|
191
|
+
get code() { return code; }
|
|
192
|
+
get messageText() { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }
|
|
193
|
+
},
|
|
194
|
+
_a.code = code,
|
|
195
|
+
_a;
|
|
196
|
+
}
|
|
197
|
+
exports.createSchemaDiagnosticClass = createSchemaDiagnosticClass;
|
|
198
|
+
/**
|
|
199
|
+
* Helper method for creating [[SchemaItemDiagnostic]] child classes.
|
|
200
|
+
* @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.
|
|
201
|
+
* @param messageText The message to associate with the diagnostic class.
|
|
202
|
+
* @beta
|
|
203
|
+
*/
|
|
204
|
+
function createSchemaItemDiagnosticClass(code, messageText) {
|
|
205
|
+
validateCode(code);
|
|
206
|
+
return class extends SchemaItemDiagnostic {
|
|
207
|
+
get code() { return code; }
|
|
208
|
+
get messageText() { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
exports.createSchemaItemDiagnosticClass = createSchemaItemDiagnosticClass;
|
|
212
|
+
/**
|
|
213
|
+
* Helper method for creating [[ClassDiagnostic]] child classes.
|
|
214
|
+
* @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.
|
|
215
|
+
* @param messageText The message to associate with the diagnostic class.
|
|
216
|
+
* @beta
|
|
217
|
+
*/
|
|
218
|
+
function createClassDiagnosticClass(code, messageText) {
|
|
219
|
+
validateCode(code);
|
|
220
|
+
return class extends ClassDiagnostic {
|
|
221
|
+
get code() { return code; }
|
|
222
|
+
get messageText() { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
exports.createClassDiagnosticClass = createClassDiagnosticClass;
|
|
226
|
+
/**
|
|
227
|
+
* Helper method for creating [[PropertyDiagnostic]] child classes.
|
|
228
|
+
* @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.
|
|
229
|
+
* @param messageText The message to associate with the diagnostic class.
|
|
230
|
+
* @beta
|
|
231
|
+
*/
|
|
232
|
+
function createPropertyDiagnosticClass(code, messageText) {
|
|
233
|
+
var _a;
|
|
234
|
+
validateCode(code);
|
|
235
|
+
return _a = class extends PropertyDiagnostic {
|
|
236
|
+
get code() { return code; }
|
|
237
|
+
get messageText() { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }
|
|
238
|
+
},
|
|
239
|
+
_a.code = code,
|
|
240
|
+
_a;
|
|
241
|
+
}
|
|
242
|
+
exports.createPropertyDiagnosticClass = createPropertyDiagnosticClass;
|
|
243
|
+
/**
|
|
244
|
+
* Helper method for creating [[RelationshipConstraintDiagnostic]] child classes.
|
|
245
|
+
* @param code The string that uniquely identifies the type of diagnostic in the format '<ruleSetName>:<number>'.
|
|
246
|
+
* @param messageText The message to associate with the diagnostic class.
|
|
247
|
+
* @beta
|
|
248
|
+
*/
|
|
249
|
+
function createRelationshipConstraintDiagnosticClass(code, messageText) {
|
|
250
|
+
validateCode(code);
|
|
251
|
+
return class extends RelationshipConstraintDiagnostic {
|
|
252
|
+
get code() { return code; }
|
|
253
|
+
get messageText() { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
exports.createRelationshipConstraintDiagnosticClass = createRelationshipConstraintDiagnosticClass;
|
|
257
|
+
/**
|
|
258
|
+
* Helper method for creating [[CustomAttributeContainerDiagnostic]] child classes.
|
|
259
|
+
* @param code The that uniquely identifies the type of diagnostic in the format '<ruleSetName>:<number>'.
|
|
260
|
+
* @param messageText The message to associate with the diagnostic class.
|
|
261
|
+
* @beta
|
|
262
|
+
*/
|
|
263
|
+
function createCustomAttributeContainerDiagnosticClass(code, messageText) {
|
|
264
|
+
validateCode(code);
|
|
265
|
+
return class extends CustomAttributeContainerDiagnostic {
|
|
266
|
+
get code() { return code; }
|
|
267
|
+
get messageText() { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
exports.createCustomAttributeContainerDiagnosticClass = createCustomAttributeContainerDiagnosticClass;
|
|
271
|
+
/** @beta */
|
|
272
|
+
function diagnosticCategoryToString(category) {
|
|
273
|
+
switch (category) {
|
|
274
|
+
case DiagnosticCategory.Error:
|
|
275
|
+
return "Error";
|
|
276
|
+
case DiagnosticCategory.Warning:
|
|
277
|
+
return "Warning";
|
|
278
|
+
case DiagnosticCategory.Message:
|
|
279
|
+
return "Message";
|
|
280
|
+
case DiagnosticCategory.Suggestion:
|
|
281
|
+
return "Suggestion";
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
exports.diagnosticCategoryToString = diagnosticCategoryToString;
|
|
285
|
+
/** @beta */
|
|
286
|
+
function diagnosticTypeToString(type) {
|
|
287
|
+
switch (type) {
|
|
288
|
+
case DiagnosticType.CustomAttributeContainer:
|
|
289
|
+
return "CustomAttributeContainer";
|
|
290
|
+
case DiagnosticType.None:
|
|
291
|
+
return "None";
|
|
292
|
+
case DiagnosticType.Property:
|
|
293
|
+
return "Property";
|
|
294
|
+
case DiagnosticType.RelationshipConstraint:
|
|
295
|
+
return "RelationshipConstraint";
|
|
296
|
+
case DiagnosticType.Schema:
|
|
297
|
+
return "Schema";
|
|
298
|
+
case DiagnosticType.SchemaItem:
|
|
299
|
+
return "SchemaItem";
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
exports.diagnosticTypeToString = diagnosticTypeToString;
|
|
303
|
+
function validateCode(code) {
|
|
304
|
+
const msg = `Diagnostic code ${code} is invalid. Expected the format <ruleSetName>-<number>.`;
|
|
305
|
+
const parts = code.split("-");
|
|
306
|
+
if (parts.length !== 2)
|
|
307
|
+
throw new Error(msg);
|
|
308
|
+
if (isNaN(Number(parts[1])))
|
|
309
|
+
throw new Error(msg);
|
|
310
|
+
}
|
|
311
|
+
//# sourceMappingURL=Diagnostic.js.map
|