@itwin/ecschema-editing 4.10.0-dev.32 → 4.10.0-dev.34
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/Editing/Properties.js +2 -2
- package/lib/cjs/Editing/Properties.js.map +1 -1
- package/lib/cjs/Validation/Diagnostic.d.ts +2 -2
- package/lib/cjs/Validation/Diagnostic.d.ts.map +1 -1
- package/lib/cjs/Validation/Diagnostic.js.map +1 -1
- package/lib/cjs/Validation/DiagnosticReporter.js +1 -1
- package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
- package/lib/cjs/Validation/RuleSuppressionSet.d.ts +2 -2
- package/lib/cjs/Validation/RuleSuppressionSet.d.ts.map +1 -1
- package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
- package/lib/cjs/Validation/Rules.d.ts +1 -1
- package/lib/cjs/Validation/Rules.d.ts.map +1 -1
- package/lib/cjs/Validation/Rules.js.map +1 -1
- package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
- package/lib/cjs/ecschema-editing.d.ts.map +1 -1
- package/lib/cjs/ecschema-editing.js +0 -1
- package/lib/cjs/ecschema-editing.js.map +1 -1
- package/package.json +12 -12
|
@@ -19,7 +19,7 @@ class Properties {
|
|
|
19
19
|
try {
|
|
20
20
|
newName = new ecschema_metadata_1.ECName(newPropertyName);
|
|
21
21
|
}
|
|
22
|
-
catch
|
|
22
|
+
catch {
|
|
23
23
|
throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SetPropertyName, new Exception_1.PropertyId(this.ecClassType, classKey, propertyName), new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.InvalidECName, new Exception_1.PropertyId(this.ecClassType, classKey, newPropertyName)));
|
|
24
24
|
}
|
|
25
25
|
const existingProperty = await this.getProperty(classKey, propertyName)
|
|
@@ -185,7 +185,7 @@ class Properties {
|
|
|
185
185
|
}
|
|
186
186
|
async findDerivedClasses(mutableClass) {
|
|
187
187
|
const derivedClasses = [];
|
|
188
|
-
for
|
|
188
|
+
for (const schemaItem of this._schemaEditor.schemaContext.getSchemaItems()) {
|
|
189
189
|
if (ecschema_metadata_1.ECClass.isECClass(schemaItem) && await schemaItem.is(mutableClass)) {
|
|
190
190
|
if (!mutableClass.key.matches(schemaItem.key)) {
|
|
191
191
|
derivedClasses.push(schemaItem);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Properties.js","sourceRoot":"","sources":["../../../src/Editing/Properties.ts"],"names":[],"mappings":";;;AAAA,gEAEoG;AACpG,sDAA6C;AAE7C,+CAA+C;AAQ/C,2CAAsI;AAKtI;;;GAGG;AACH,MAAa,UAAU;IACrB,YAA6B,WAA+B,EAAY,aAAkC;QAA7E,gBAAW,GAAX,WAAW,CAAoB;QAAY,kBAAa,GAAb,aAAa,CAAqB;IAC1G,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,QAAuB,EAAE,YAAoB,EAAE,eAAuB;QACzF,IAAI,OAAe,CAAC;QACpB,IAAI,CAAC;YACH,OAAO,GAAG,IAAI,0BAAM,CAAC,eAAe,CAAC,CAAC;QACxC,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,eAAe,EAAE,IAAI,sBAAU,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,YAAY,CAAC,EACpH,IAAI,8BAAkB,CAAC,2BAAe,CAAC,aAAa,EAAE,IAAI,sBAAU,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;QACxH,CAAC;QAED,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,WAAW,CAAkB,QAAQ,EAAE,YAAY,CAAC;aACrF,KAAK,CAAC,CAAC,CAAM,EAAE,EAAE;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,eAAe,EAAE,IAAI,sBAAU,CAAC,IAAI,CAAC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QACpF,KAAK,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACgB,KAAK,CAAC,WAAW,CAAgC,QAAuB,EAAE,YAAoB;QAC/G,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,WAAW,CAA4B,QAAQ,EAAE,YAAY,CAAM,CAAC;QACjG,IAAI,CAAC,CAAC,QAAQ,YAAY,sCAAkB,CAAC,EAAC,CAAC;YAC7C,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,mBAAmB,EAAE,IAAI,sBAAU,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,4BAAgB,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACnK,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAjBD,oDAiBC;AAED;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,UAAU;IAC9C,YAAmB,WAA+B,EAAE,aAAkC;QACpF,KAAK,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACgB,KAAK,CAAC,WAAW,CAAgC,QAAuB,EAAE,YAAoB;QAC/G,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,WAAW,CAAwB,QAAQ,EAAE,YAAY,CAAM,CAAC;QAC7F,IAAI,CAAC,CAAC,QAAQ,YAAY,kCAAc,CAAC,EAAC,CAAC;YACzC,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,mBAAmB,EAAE,IAAI,sBAAU,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,4BAAgB,CAAC,cAAc,CAAC,CAAC,CAAC;QAC/J,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAjBD,4CAiBC","sourcesContent":["import { CustomAttribute, CustomAttributeContainerProps, DelayedPromiseWithProps, ECClass, ECName,\r\n EnumerationProperty, KindOfQuantity, NavigationProperty, PrimitiveProperty,\r\n PropertyCategory, SchemaItemKey, SchemaItemType, StructProperty } from \"@itwin/ecschema-metadata\";\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport * as Rules from \"../Validation/ECRules\";\r\nimport { MutableArrayProperty } from \"./Mutable/MutableArrayProperty\";\r\nimport { MutableProperty } from \"./Mutable/MutableProperty\";\r\nimport { MutablePrimitiveOrEnumPropertyBase } from \"./Mutable/MutablePrimitiveOrEnumProperty\";\r\nimport { MutableClass } from \"./Mutable/MutableClass\";\r\nimport { MutableStructProperty } from \"./Mutable/MutableStructProperty\";\r\nimport { MutableNavigationProperty } from \"./Mutable/MutableNavigationProperty\";\r\nimport { ECClassSchemaItems } from \"./ECClasses\";\r\nimport { ClassId, CustomAttributeId, ECEditingStatus, PropertyId, PropertyTypeName, SchemaEditingError, SchemaId } from \"./Exception\";\r\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\n\r\ntype MutablePropertyType = MutableProperty | MutableArrayProperty | MutablePrimitiveOrEnumPropertyBase | MutableNavigationProperty | MutableStructProperty;\r\n\r\n/**\r\n * @alpha\r\n * A class allowing editing of attributes of the base Property class.\r\n */\r\nexport class Properties {\r\n public constructor(protected ecClassType: ECClassSchemaItems, protected _schemaEditor: SchemaContextEditor) {\r\n }\r\n\r\n public async setName(classKey: SchemaItemKey, propertyName: string, newPropertyName: string) {\r\n let newName: ECName;\r\n try {\r\n newName = new ECName(newPropertyName);\r\n } catch(e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.SetPropertyName, new PropertyId(this.ecClassType, classKey, propertyName),\r\n new SchemaEditingError(ECEditingStatus.InvalidECName, new PropertyId(this.ecClassType, classKey, newPropertyName)));\r\n }\r\n\r\n const existingProperty = await this.getProperty<MutableProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetPropertyName, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n\r\n const baseProperty = await existingProperty.class.getProperty(newPropertyName, true) as MutableProperty;\r\n if (baseProperty) {\r\n throw new SchemaEditingError(ECEditingStatus.SetPropertyName, new PropertyId(this.ecClassType, classKey, propertyName),\r\n new SchemaEditingError(ECEditingStatus.PropertyAlreadyExists, new PropertyId(this.ecClassType, baseProperty.class.key, newPropertyName)));\r\n }\r\n\r\n // Handle derived classes\r\n const derivedProperties: Array<MutableProperty> = [];\r\n const derivedClasses = await this.findDerivedClasses(existingProperty.class as MutableClass);\r\n for (const derivedClass of derivedClasses) {\r\n if (await derivedClass.getProperty(newPropertyName)) {\r\n throw new SchemaEditingError(ECEditingStatus.SetPropertyName, new PropertyId(this.ecClassType, classKey, propertyName),\r\n new SchemaEditingError(ECEditingStatus.PropertyAlreadyExists, new PropertyId(this.ecClassType, derivedClass.key, newPropertyName)));\r\n }\r\n\r\n const propertyOverride = await derivedClass.getProperty(propertyName) as MutableProperty;\r\n // If found the property is overridden in the derived class.\r\n if (propertyOverride)\r\n derivedProperties.push(propertyOverride);\r\n }\r\n\r\n // Re-name the overridden property in all derived classes\r\n derivedProperties.forEach((prop: MutableProperty) => {\r\n prop.setName(newName);\r\n });\r\n\r\n existingProperty.setName(newName);\r\n }\r\n\r\n /**\r\n * Sets the property description.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param description The new description to set.\r\n */\r\n public async setDescription(classKey: SchemaItemKey, propertyName: string, description: string) {\r\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetDescription, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setDescription(description);\r\n }\r\n\r\n /**\r\n * Sets the property label.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param label The new label to set.\r\n */\r\n public async setLabel(classKey: SchemaItemKey, propertyName: string, label: string) {\r\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetLabel, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setLabel(label);\r\n }\r\n\r\n /**\r\n * Sets the property isReadOnly attribute.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param isReadOnly The new isReadOnly value.\r\n */\r\n public async setIsReadOnly(classKey: SchemaItemKey, propertyName: string, isReadOnly: boolean) {\r\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetIsReadOnly, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setIsReadOnly(isReadOnly);\r\n }\r\n\r\n /**\r\n * Sets the property priority.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param priority The new priority.\r\n */\r\n public async setPriority(classKey: SchemaItemKey, propertyName: string, priority: number) {\r\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetPriority, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setPriority(priority);\r\n }\r\n\r\n /**\r\n * Sets the property category.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param categoryKey The SchemaItemKey of the property category.\r\n */\r\n public async setCategory(classKey: SchemaItemKey, propertyName: string, categoryKey: SchemaItemKey) {\r\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetCategory, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n\r\n const category = await this._schemaEditor.lookupSchemaItem<PropertyCategory>(property.class.schema, categoryKey, SchemaItemType.PropertyCategory)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetCategory, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n\r\n property.setCategory(new DelayedPromiseWithProps<SchemaItemKey, PropertyCategory>(categoryKey, async () => category));\r\n }\r\n\r\n /**\r\n * Sets the KindOfQuantity of a property.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param kindOfQuantityKey The SchemaItemKey of the KindOfQuantity.\r\n */\r\n public async setKindOfQuantity(classKey: SchemaItemKey, propertyName: string, kindOfQuantityKey: SchemaItemKey) {\r\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetKindOfQuantity, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n\r\n const koq = await this._schemaEditor.lookupSchemaItem<KindOfQuantity>(property.class.schema, kindOfQuantityKey, SchemaItemType.KindOfQuantity)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetKindOfQuantity, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n\r\n const currentKoq = await property.kindOfQuantity;\r\n if(currentKoq && currentKoq.persistenceUnit && koq.persistenceUnit && !currentKoq.persistenceUnit.matchesFullName(koq.persistenceUnit.fullName)) {\r\n throw new SchemaEditingError(ECEditingStatus.SetKindOfQuantity, new PropertyId(this.ecClassType, classKey, propertyName), undefined, undefined, \"KindOfQuantity can only be changed if it has the same persistence unit as the property.\");\r\n }\r\n\r\n property.setKindOfQuantity(new DelayedPromiseWithProps<SchemaItemKey, KindOfQuantity>(kindOfQuantityKey, async () => koq));\r\n }\r\n\r\n /**\r\n * Adds a CustomAttribute instance to the Property identified by the given SchemaItemKey and property name.\r\n * @param classKey The SchemaItemKey identifying the class.\r\n * @param propertyName The name of the property.\r\n * @param customAttribute The CustomAttribute instance to add.\r\n */\r\n public async addCustomAttribute(classKey: SchemaItemKey, propertyName: string, customAttribute: CustomAttribute) {\r\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToProperty, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n\r\n property.addCustomAttribute(customAttribute);\r\n\r\n const diagnosticsIterable = Rules.validateCustomAttributeInstance(property, customAttribute);\r\n\r\n const diagnostics: AnyDiagnostic[] = [];\r\n for await (const diagnostic of diagnosticsIterable) {\r\n diagnostics.push(diagnostic);\r\n }\r\n\r\n if (diagnostics.length > 0) {\r\n this.removeCustomAttribute(property, customAttribute);\r\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToProperty, new PropertyId(this.ecClassType, classKey, propertyName),\r\n new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, property)));\r\n }\r\n }\r\n\r\n /**\r\n * Removes a CustomAttribute from a property.\r\n * @param container\r\n * @param customAttribute\r\n */\r\n protected removeCustomAttribute(container: CustomAttributeContainerProps, customAttribute: CustomAttribute) {\r\n assert(container.customAttributes !== undefined);\r\n const map = container.customAttributes as Map<string, CustomAttribute>;\r\n map.delete(customAttribute.className);\r\n }\r\n\r\n /**\r\n * Gets the property with the specified name from the class identified by the given key.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property to retrieve.\r\n */\r\n protected async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\r\n const mutableClass = await this.getClass(classKey);\r\n\r\n const property = await mutableClass.getProperty(propertyName) as T;\r\n if (property === undefined) {\r\n throw new SchemaEditingError(ECEditingStatus.PropertyNotFound, new PropertyId(mutableClass.schemaItemType as ECClassSchemaItems, classKey, propertyName));\r\n }\r\n\r\n return property;\r\n }\r\n\r\n private async findDerivedClasses(mutableClass: MutableClass): Promise<Array<MutableClass>>{\r\n const derivedClasses: Array<MutableClass> = [];\r\n\r\n for await (const schemaItem of this._schemaEditor.schemaContext.getSchemaItems()) {\r\n if(ECClass.isECClass(schemaItem) && await schemaItem.is(mutableClass)) {\r\n if (!mutableClass.key.matches(schemaItem.key)) {\r\n derivedClasses.push(schemaItem as MutableClass);\r\n }\r\n }\r\n }\r\n\r\n return derivedClasses;\r\n }\r\n\r\n private async getClass(classKey: SchemaItemKey): Promise<MutableClass> {\r\n const schema = await this._schemaEditor.getSchema(classKey.schemaKey);\r\n if (schema === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(classKey.schemaKey));\r\n\r\n const ecClass = await schema.getItem(classKey.name);\r\n if (ecClass === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new ClassId(this.ecClassType, classKey));\r\n\r\n if (ecClass.schemaItemType !== this.ecClassType){\r\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new ClassId(this.ecClassType, classKey));\r\n }\r\n\r\n return ecClass as MutableClass;\r\n }\r\n}\r\n\r\n/**\r\n * @alpha\r\n * A class extending Properties allowing editing of attributes of PrimitiveArrayProperty,\r\n * EnumerationArrayProperty and StructArrayProperty.\r\n */\r\nexport class ArrayProperties extends Properties {\r\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\r\n super(ecClassType, _schemaEditor);\r\n }\r\n\r\n /**\r\n * Sets the array property minOccurs attribute.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param minOccurs The new minOccurs value.\r\n */\r\n public async setMinOccurs(classKey: SchemaItemKey, propertyName: string, minOccurs: number) {\r\n const property = await this.getProperty<MutableArrayProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetMinOccurs, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setMinOccurs(minOccurs);\r\n }\r\n\r\n /**\r\n * Sets the array property maxOccurs attribute.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param maxOccurs The new maxOccurs value.\r\n */\r\n public async setMaxOccurs(classKey: SchemaItemKey, propertyName: string, maxOccurs: number) {\r\n const property = await this.getProperty<MutableArrayProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetMaxOccurs, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setMaxOccurs(maxOccurs);\r\n }\r\n\r\n /**\r\n * Override to validate that the found property is an ArrayProperty.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n */\r\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\r\n const property = await super.getProperty<MutableArrayProperty>(classKey, propertyName) as T;\r\n if (!property.isArray()){\r\n throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.ArrayProperty));\r\n }\r\n return property;\r\n }\r\n}\r\n\r\n/**\r\n * @alpha\r\n * A class extending Properties allowing editing of attributes of PrimitiveProperty and EnumerationProperty.\r\n */\r\nclass PrimitiveOrEnumProperties extends Properties {\r\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\r\n super(ecClassType, _schemaEditor);\r\n }\r\n\r\n /**\r\n * Sets the extendTypeName attribute value.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param extendTypeName The extended type name of the property.\r\n */\r\n public async setExtendedTypeName(classKey: SchemaItemKey, propertyName: string, extendedTypeName: string) {\r\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetExtendedTypeName, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setExtendedTypeName(extendedTypeName);\r\n }\r\n\r\n /**\r\n * Sets the minLength attribute value.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param minLength The minimum length of the property.\r\n */\r\n public async setMinLength(classKey: SchemaItemKey, propertyName: string, minLength: number) {\r\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetMinLength, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setMinLength(minLength);\r\n }\r\n\r\n /**\r\n * Sets the maxLength attribute value.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param maxLength The maximum length of the property.\r\n */\r\n public async setMaxLength(classKey: SchemaItemKey, propertyName: string, maxLength: number) {\r\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetMaxLength, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setMaxLength(maxLength);\r\n }\r\n\r\n /**\r\n * Sets the minValue attribute value.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param minValue The minimum value of the property.\r\n */\r\n public async setMinValue(classKey: SchemaItemKey, propertyName: string, minValue: number) {\r\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetMinValue, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setMinValue(minValue);\r\n }\r\n\r\n /**\r\n * Sets the maxValue attribute value.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param maxValue The maximum value of the property.\r\n */\r\n public async setMaxValue(classKey: SchemaItemKey, propertyName: string, maxValue: number) {\r\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetMaxValue, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setMaxValue(maxValue);\r\n }\r\n}\r\n\r\n/**\r\n * @alpha\r\n * A class extending Properties allowing editing of PrimitiveProperty attributes.\r\n */\r\nexport class PrimitiveProperties extends PrimitiveOrEnumProperties {\r\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\r\n super(ecClassType, _schemaEditor);\r\n }\r\n\r\n /**\r\n * Override to validate that the found property is a PrimitiveProperty.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n */\r\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\r\n const property = await super.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName) as T;\r\n if (!(property instanceof PrimitiveProperty)){\r\n throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.PrimitiveProperty));\r\n }\r\n return property;\r\n }\r\n}\r\n\r\n/**\r\n * @alpha\r\n * A class extending Properties allowing editing of EnumerationProperty attributes.\r\n */\r\nexport class EnumerationProperties extends PrimitiveOrEnumProperties {\r\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\r\n super(ecClassType, _schemaEditor);\r\n }\r\n\r\n /**\r\n * Override to validate that the found property is a EnumerationProperty.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n */\r\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\r\n const property = await super.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName) as T;\r\n if (!(property instanceof EnumerationProperty)){\r\n throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.EnumerationProperty));\r\n }\r\n return property;\r\n }\r\n}\r\n\r\n/**\r\n * @alpha\r\n * A class extending Properties allowing editing of NavigationProperties attributes.\r\n */\r\nexport class NavigationProperties extends Properties {\r\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\r\n super(ecClassType, _schemaEditor);\r\n }\r\n\r\n /**\r\n * Override to validate that the found property is a NavigationProperty.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n */\r\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\r\n const property = await super.getProperty<MutableNavigationProperty>(classKey, propertyName) as T;\r\n if (!(property instanceof NavigationProperty)){\r\n throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.NavigationProperty));\r\n }\r\n return property;\r\n }\r\n}\r\n\r\n/**\r\n * @alpha\r\n * A class extending Properties allowing editing of StructProperty attributes.\r\n */\r\nexport class StructProperties extends Properties {\r\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\r\n super(ecClassType, _schemaEditor);\r\n }\r\n\r\n /**\r\n * Override to validate that the found property is a StructProperty.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n */\r\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\r\n const property = await super.getProperty<MutableStructProperty>(classKey, propertyName) as T;\r\n if (!(property instanceof StructProperty)){\r\n throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.StructProperty));\r\n }\r\n return property;\r\n }\r\n}\r\n\r\n"]}
|
|
1
|
+
{"version":3,"file":"Properties.js","sourceRoot":"","sources":["../../../src/Editing/Properties.ts"],"names":[],"mappings":";;;AAAA,gEAEoG;AACpG,sDAA6C;AAE7C,+CAA+C;AAQ/C,2CAAsI;AAKtI;;;GAGG;AACH,MAAa,UAAU;IACrB,YAA6B,WAA+B,EAAY,aAAkC;QAA7E,gBAAW,GAAX,WAAW,CAAoB;QAAY,kBAAa,GAAb,aAAa,CAAqB;IAC1G,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,QAAuB,EAAE,YAAoB,EAAE,eAAuB;QACzF,IAAI,OAAe,CAAC;QACpB,IAAI,CAAC;YACH,OAAO,GAAG,IAAI,0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W,CAAgC,QAAuB,EAAE,YAAoB;QAC/G,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,WAAW,CAAwB,QAAQ,EAAE,YAAY,CAAM,CAAC;QAC7F,IAAI,CAAC,CAAC,QAAQ,YAAY,kCAAc,CAAC,EAAC,CAAC;YACzC,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,mBAAmB,EAAE,IAAI,sBAAU,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,4BAAgB,CAAC,cAAc,CAAC,CAAC,CAAC;QAC/J,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAjBD,4CAiBC","sourcesContent":["import { CustomAttribute, CustomAttributeContainerProps, DelayedPromiseWithProps, ECClass, ECName,\r\n EnumerationProperty, KindOfQuantity, NavigationProperty, PrimitiveProperty,\r\n PropertyCategory, SchemaItemKey, SchemaItemType, StructProperty } from \"@itwin/ecschema-metadata\";\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport * as Rules from \"../Validation/ECRules\";\r\nimport { MutableArrayProperty } from \"./Mutable/MutableArrayProperty\";\r\nimport { MutableProperty } from \"./Mutable/MutableProperty\";\r\nimport { MutablePrimitiveOrEnumPropertyBase } from \"./Mutable/MutablePrimitiveOrEnumProperty\";\r\nimport { MutableClass } from \"./Mutable/MutableClass\";\r\nimport { MutableStructProperty } from \"./Mutable/MutableStructProperty\";\r\nimport { MutableNavigationProperty } from \"./Mutable/MutableNavigationProperty\";\r\nimport { ECClassSchemaItems } from \"./ECClasses\";\r\nimport { ClassId, CustomAttributeId, ECEditingStatus, PropertyId, PropertyTypeName, SchemaEditingError, SchemaId } from \"./Exception\";\r\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\n\r\ntype MutablePropertyType = MutableProperty | MutableArrayProperty | MutablePrimitiveOrEnumPropertyBase | MutableNavigationProperty | MutableStructProperty;\r\n\r\n/**\r\n * @alpha\r\n * A class allowing editing of attributes of the base Property class.\r\n */\r\nexport class Properties {\r\n public constructor(protected ecClassType: ECClassSchemaItems, protected _schemaEditor: SchemaContextEditor) {\r\n }\r\n\r\n public async setName(classKey: SchemaItemKey, propertyName: string, newPropertyName: string) {\r\n let newName: ECName;\r\n try {\r\n newName = new ECName(newPropertyName);\r\n } catch {\r\n throw new SchemaEditingError(ECEditingStatus.SetPropertyName, new PropertyId(this.ecClassType, classKey, propertyName),\r\n new SchemaEditingError(ECEditingStatus.InvalidECName, new PropertyId(this.ecClassType, classKey, newPropertyName)));\r\n }\r\n\r\n const existingProperty = await this.getProperty<MutableProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetPropertyName, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n\r\n const baseProperty = await existingProperty.class.getProperty(newPropertyName, true) as MutableProperty;\r\n if (baseProperty) {\r\n throw new SchemaEditingError(ECEditingStatus.SetPropertyName, new PropertyId(this.ecClassType, classKey, propertyName),\r\n new SchemaEditingError(ECEditingStatus.PropertyAlreadyExists, new PropertyId(this.ecClassType, baseProperty.class.key, newPropertyName)));\r\n }\r\n\r\n // Handle derived classes\r\n const derivedProperties: Array<MutableProperty> = [];\r\n const derivedClasses = await this.findDerivedClasses(existingProperty.class as MutableClass);\r\n for (const derivedClass of derivedClasses) {\r\n if (await derivedClass.getProperty(newPropertyName)) {\r\n throw new SchemaEditingError(ECEditingStatus.SetPropertyName, new PropertyId(this.ecClassType, classKey, propertyName),\r\n new SchemaEditingError(ECEditingStatus.PropertyAlreadyExists, new PropertyId(this.ecClassType, derivedClass.key, newPropertyName)));\r\n }\r\n\r\n const propertyOverride = await derivedClass.getProperty(propertyName) as MutableProperty;\r\n // If found the property is overridden in the derived class.\r\n if (propertyOverride)\r\n derivedProperties.push(propertyOverride);\r\n }\r\n\r\n // Re-name the overridden property in all derived classes\r\n derivedProperties.forEach((prop: MutableProperty) => {\r\n prop.setName(newName);\r\n });\r\n\r\n existingProperty.setName(newName);\r\n }\r\n\r\n /**\r\n * Sets the property description.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param description The new description to set.\r\n */\r\n public async setDescription(classKey: SchemaItemKey, propertyName: string, description: string) {\r\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetDescription, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setDescription(description);\r\n }\r\n\r\n /**\r\n * Sets the property label.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param label The new label to set.\r\n */\r\n public async setLabel(classKey: SchemaItemKey, propertyName: string, label: string) {\r\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetLabel, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setLabel(label);\r\n }\r\n\r\n /**\r\n * Sets the property isReadOnly attribute.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param isReadOnly The new isReadOnly value.\r\n */\r\n public async setIsReadOnly(classKey: SchemaItemKey, propertyName: string, isReadOnly: boolean) {\r\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetIsReadOnly, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setIsReadOnly(isReadOnly);\r\n }\r\n\r\n /**\r\n * Sets the property priority.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param priority The new priority.\r\n */\r\n public async setPriority(classKey: SchemaItemKey, propertyName: string, priority: number) {\r\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetPriority, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setPriority(priority);\r\n }\r\n\r\n /**\r\n * Sets the property category.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param categoryKey The SchemaItemKey of the property category.\r\n */\r\n public async setCategory(classKey: SchemaItemKey, propertyName: string, categoryKey: SchemaItemKey) {\r\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetCategory, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n\r\n const category = await this._schemaEditor.lookupSchemaItem<PropertyCategory>(property.class.schema, categoryKey, SchemaItemType.PropertyCategory)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetCategory, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n\r\n property.setCategory(new DelayedPromiseWithProps<SchemaItemKey, PropertyCategory>(categoryKey, async () => category));\r\n }\r\n\r\n /**\r\n * Sets the KindOfQuantity of a property.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param kindOfQuantityKey The SchemaItemKey of the KindOfQuantity.\r\n */\r\n public async setKindOfQuantity(classKey: SchemaItemKey, propertyName: string, kindOfQuantityKey: SchemaItemKey) {\r\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetKindOfQuantity, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n\r\n const koq = await this._schemaEditor.lookupSchemaItem<KindOfQuantity>(property.class.schema, kindOfQuantityKey, SchemaItemType.KindOfQuantity)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetKindOfQuantity, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n\r\n const currentKoq = await property.kindOfQuantity;\r\n if(currentKoq && currentKoq.persistenceUnit && koq.persistenceUnit && !currentKoq.persistenceUnit.matchesFullName(koq.persistenceUnit.fullName)) {\r\n throw new SchemaEditingError(ECEditingStatus.SetKindOfQuantity, new PropertyId(this.ecClassType, classKey, propertyName), undefined, undefined, \"KindOfQuantity can only be changed if it has the same persistence unit as the property.\");\r\n }\r\n\r\n property.setKindOfQuantity(new DelayedPromiseWithProps<SchemaItemKey, KindOfQuantity>(kindOfQuantityKey, async () => koq));\r\n }\r\n\r\n /**\r\n * Adds a CustomAttribute instance to the Property identified by the given SchemaItemKey and property name.\r\n * @param classKey The SchemaItemKey identifying the class.\r\n * @param propertyName The name of the property.\r\n * @param customAttribute The CustomAttribute instance to add.\r\n */\r\n public async addCustomAttribute(classKey: SchemaItemKey, propertyName: string, customAttribute: CustomAttribute) {\r\n const property = await this.getProperty<MutableProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToProperty, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n\r\n property.addCustomAttribute(customAttribute);\r\n\r\n const diagnosticsIterable = Rules.validateCustomAttributeInstance(property, customAttribute);\r\n\r\n const diagnostics: AnyDiagnostic[] = [];\r\n for await (const diagnostic of diagnosticsIterable) {\r\n diagnostics.push(diagnostic);\r\n }\r\n\r\n if (diagnostics.length > 0) {\r\n this.removeCustomAttribute(property, customAttribute);\r\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToProperty, new PropertyId(this.ecClassType, classKey, propertyName),\r\n new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, property)));\r\n }\r\n }\r\n\r\n /**\r\n * Removes a CustomAttribute from a property.\r\n * @param container\r\n * @param customAttribute\r\n */\r\n protected removeCustomAttribute(container: CustomAttributeContainerProps, customAttribute: CustomAttribute) {\r\n assert(container.customAttributes !== undefined);\r\n const map = container.customAttributes as Map<string, CustomAttribute>;\r\n map.delete(customAttribute.className);\r\n }\r\n\r\n /**\r\n * Gets the property with the specified name from the class identified by the given key.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property to retrieve.\r\n */\r\n protected async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\r\n const mutableClass = await this.getClass(classKey);\r\n\r\n const property = await mutableClass.getProperty(propertyName) as T;\r\n if (property === undefined) {\r\n throw new SchemaEditingError(ECEditingStatus.PropertyNotFound, new PropertyId(mutableClass.schemaItemType as ECClassSchemaItems, classKey, propertyName));\r\n }\r\n\r\n return property;\r\n }\r\n\r\n private async findDerivedClasses(mutableClass: MutableClass): Promise<Array<MutableClass>>{\r\n const derivedClasses: Array<MutableClass> = [];\r\n\r\n for (const schemaItem of this._schemaEditor.schemaContext.getSchemaItems()) {\r\n if(ECClass.isECClass(schemaItem) && await schemaItem.is(mutableClass)) {\r\n if (!mutableClass.key.matches(schemaItem.key)) {\r\n derivedClasses.push(schemaItem as MutableClass);\r\n }\r\n }\r\n }\r\n\r\n return derivedClasses;\r\n }\r\n\r\n private async getClass(classKey: SchemaItemKey): Promise<MutableClass> {\r\n const schema = await this._schemaEditor.getSchema(classKey.schemaKey);\r\n if (schema === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(classKey.schemaKey));\r\n\r\n const ecClass = await schema.getItem(classKey.name);\r\n if (ecClass === undefined)\r\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new ClassId(this.ecClassType, classKey));\r\n\r\n if (ecClass.schemaItemType !== this.ecClassType){\r\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new ClassId(this.ecClassType, classKey));\r\n }\r\n\r\n return ecClass as MutableClass;\r\n }\r\n}\r\n\r\n/**\r\n * @alpha\r\n * A class extending Properties allowing editing of attributes of PrimitiveArrayProperty,\r\n * EnumerationArrayProperty and StructArrayProperty.\r\n */\r\nexport class ArrayProperties extends Properties {\r\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\r\n super(ecClassType, _schemaEditor);\r\n }\r\n\r\n /**\r\n * Sets the array property minOccurs attribute.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param minOccurs The new minOccurs value.\r\n */\r\n public async setMinOccurs(classKey: SchemaItemKey, propertyName: string, minOccurs: number) {\r\n const property = await this.getProperty<MutableArrayProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetMinOccurs, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setMinOccurs(minOccurs);\r\n }\r\n\r\n /**\r\n * Sets the array property maxOccurs attribute.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param maxOccurs The new maxOccurs value.\r\n */\r\n public async setMaxOccurs(classKey: SchemaItemKey, propertyName: string, maxOccurs: number) {\r\n const property = await this.getProperty<MutableArrayProperty>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetMaxOccurs, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setMaxOccurs(maxOccurs);\r\n }\r\n\r\n /**\r\n * Override to validate that the found property is an ArrayProperty.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n */\r\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\r\n const property = await super.getProperty<MutableArrayProperty>(classKey, propertyName) as T;\r\n if (!property.isArray()){\r\n throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.ArrayProperty));\r\n }\r\n return property;\r\n }\r\n}\r\n\r\n/**\r\n * @alpha\r\n * A class extending Properties allowing editing of attributes of PrimitiveProperty and EnumerationProperty.\r\n */\r\nclass PrimitiveOrEnumProperties extends Properties {\r\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\r\n super(ecClassType, _schemaEditor);\r\n }\r\n\r\n /**\r\n * Sets the extendTypeName attribute value.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param extendTypeName The extended type name of the property.\r\n */\r\n public async setExtendedTypeName(classKey: SchemaItemKey, propertyName: string, extendedTypeName: string) {\r\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetExtendedTypeName, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setExtendedTypeName(extendedTypeName);\r\n }\r\n\r\n /**\r\n * Sets the minLength attribute value.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param minLength The minimum length of the property.\r\n */\r\n public async setMinLength(classKey: SchemaItemKey, propertyName: string, minLength: number) {\r\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetMinLength, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setMinLength(minLength);\r\n }\r\n\r\n /**\r\n * Sets the maxLength attribute value.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param maxLength The maximum length of the property.\r\n */\r\n public async setMaxLength(classKey: SchemaItemKey, propertyName: string, maxLength: number) {\r\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetMaxLength, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setMaxLength(maxLength);\r\n }\r\n\r\n /**\r\n * Sets the minValue attribute value.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param minValue The minimum value of the property.\r\n */\r\n public async setMinValue(classKey: SchemaItemKey, propertyName: string, minValue: number) {\r\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetMinValue, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setMinValue(minValue);\r\n }\r\n\r\n /**\r\n * Sets the maxValue attribute value.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n * @param maxValue The maximum value of the property.\r\n */\r\n public async setMaxValue(classKey: SchemaItemKey, propertyName: string, maxValue: number) {\r\n const property = await this.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName)\r\n .catch((e: any) => {\r\n throw new SchemaEditingError(ECEditingStatus.SetMaxValue, new PropertyId(this.ecClassType, classKey, propertyName), e);\r\n });\r\n property.setMaxValue(maxValue);\r\n }\r\n}\r\n\r\n/**\r\n * @alpha\r\n * A class extending Properties allowing editing of PrimitiveProperty attributes.\r\n */\r\nexport class PrimitiveProperties extends PrimitiveOrEnumProperties {\r\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\r\n super(ecClassType, _schemaEditor);\r\n }\r\n\r\n /**\r\n * Override to validate that the found property is a PrimitiveProperty.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n */\r\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\r\n const property = await super.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName) as T;\r\n if (!(property instanceof PrimitiveProperty)){\r\n throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.PrimitiveProperty));\r\n }\r\n return property;\r\n }\r\n}\r\n\r\n/**\r\n * @alpha\r\n * A class extending Properties allowing editing of EnumerationProperty attributes.\r\n */\r\nexport class EnumerationProperties extends PrimitiveOrEnumProperties {\r\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\r\n super(ecClassType, _schemaEditor);\r\n }\r\n\r\n /**\r\n * Override to validate that the found property is a EnumerationProperty.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n */\r\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\r\n const property = await super.getProperty<MutablePrimitiveOrEnumPropertyBase>(classKey, propertyName) as T;\r\n if (!(property instanceof EnumerationProperty)){\r\n throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.EnumerationProperty));\r\n }\r\n return property;\r\n }\r\n}\r\n\r\n/**\r\n * @alpha\r\n * A class extending Properties allowing editing of NavigationProperties attributes.\r\n */\r\nexport class NavigationProperties extends Properties {\r\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\r\n super(ecClassType, _schemaEditor);\r\n }\r\n\r\n /**\r\n * Override to validate that the found property is a NavigationProperty.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n */\r\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\r\n const property = await super.getProperty<MutableNavigationProperty>(classKey, propertyName) as T;\r\n if (!(property instanceof NavigationProperty)){\r\n throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.NavigationProperty));\r\n }\r\n return property;\r\n }\r\n}\r\n\r\n/**\r\n * @alpha\r\n * A class extending Properties allowing editing of StructProperty attributes.\r\n */\r\nexport class StructProperties extends Properties {\r\n public constructor(ecClassType: ECClassSchemaItems, _schemaEditor: SchemaContextEditor) {\r\n super(ecClassType, _schemaEditor);\r\n }\r\n\r\n /**\r\n * Override to validate that the found property is a StructProperty.\r\n * @param classKey The SchemaItemKey of the class.\r\n * @param propertyName The name of the property.\r\n */\r\n protected override async getProperty<T extends MutablePropertyType>(classKey: SchemaItemKey, propertyName: string): Promise<T> {\r\n const property = await super.getProperty<MutableStructProperty>(classKey, propertyName) as T;\r\n if (!(property instanceof StructProperty)){\r\n throw new SchemaEditingError(ECEditingStatus.InvalidPropertyType, new PropertyId(this.ecClassType, classKey, propertyName, PropertyTypeName.StructProperty));\r\n }\r\n return property;\r\n }\r\n}\r\n\r\n"]}
|
|
@@ -8,8 +8,8 @@ import { AnyClass, AnyECType, AnyProperty, CustomAttributeContainerProps, Relati
|
|
|
8
8
|
*/
|
|
9
9
|
export declare enum DiagnosticType {
|
|
10
10
|
None = 0,
|
|
11
|
-
Schema = 1
|
|
12
|
-
SchemaItem = 2
|
|
11
|
+
Schema = 1,
|
|
12
|
+
SchemaItem = 2,
|
|
13
13
|
Property = 3,
|
|
14
14
|
CustomAttributeContainer = 4,
|
|
15
15
|
RelationshipConstraint = 5
|
|
@@ -1 +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
|
|
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;CAC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O;YAC7B,OAAO,SAAS,CAAC;QACnB,KAAK,kBAAkB,CAAC,UAAU;YAChC,OAAO,YAAY,CAAC;IACxB,CAAC;AACH,CAAC;AAED,YAAY;AACZ,SAAgB,sBAAsB,CAAC,IAAoB;IACzD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,cAAc,CAAC,wBAAwB;YAC1C,OAAO,0BAA0B,CAAC;QACpC,KAAK,cAAc,CAAC,IAAI;YACtB,OAAO,MAAM,CAAC;QAChB,KAAK,cAAc,CAAC,QAAQ;YAC1B,OAAO,UAAU,CAAC;QACpB,KAAK,cAAc,CAAC,sBAAsB;YACxC,OAAO,wBAAwB,CAAC;QAClC,KAAK,cAAc,CAAC,MAAM;YACxB,OAAO,QAAQ,CAAC;QAClB,KAAK,cAAc,CAAC,UAAU;YAC5B,OAAO,YAAY,CAAC;IACxB,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,MAAM,GAAG,GAAG,mBAAmB,IAAI,0DAA0D,CAAC;IAC9F,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;IAEvB,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Diagnostic\r\n */\r\n\r\nimport { AnyClass, AnyECType, AnyProperty, CustomAttributeContainerProps, RelationshipConstraint, Schema, SchemaItem } from \"@itwin/ecschema-metadata\";\r\n\r\n/* eslint-disable @typescript-eslint/no-shadow */\r\n\r\nconst formatString = (format: string, ...args: string[]) => {\r\n return format.replace(/{(\\d+)}/g, (match, theNumber) => {\r\n return typeof args[theNumber] !== \"undefined\"\r\n ? args[theNumber]\r\n : match;\r\n });\r\n};\r\n\r\n/**\r\n * Defines the possible diagnostic types.\r\n * @beta\r\n */\r\nexport enum DiagnosticType {\r\n None,\r\n Schema, // eslint-disable-line @typescript-eslint/no-shadow\r\n SchemaItem, // eslint-disable-line @typescript-eslint/no-shadow\r\n Property,\r\n CustomAttributeContainer,\r\n RelationshipConstraint, // eslint-disable-line @typescript-eslint/no-shadow\r\n}\r\n\r\n/**\r\n * Defines the possible diagnostic categories.\r\n * @beta\r\n */\r\nexport enum DiagnosticCategory {\r\n Warning,\r\n Error,\r\n Suggestion,\r\n Message,\r\n}\r\n\r\n/**\r\n * The interface implemented by all diagnostics used during schema validation.\r\n * @beta\r\n */\r\nexport interface IDiagnostic<TYPE extends AnyECType, ARGS extends any[]> {\r\n /** The diagnostic category (error, warning, etc...). Value is static across all instances. */\r\n category: DiagnosticCategory;\r\n /** The unique string identifier of the diagnostic in the format '<ruleSetName>:<number>. Value is static across all instances. */\r\n code: string;\r\n /** The context type of diagnostic (schema, schema item, property, etc...). Value is static across all instances. */\r\n diagnosticType: DiagnosticType;\r\n /** The unformatted message text associated with the diagnostic. Value is static across all instances. */\r\n messageText: string;\r\n /** The arguments used when formatted the diagnostic instance's message. */\r\n messageArgs?: ARGS;\r\n /** The EC object associated with the diagnostic instance. */\r\n ecDefinition: TYPE;\r\n /** The schema where the diagnostic originated. */\r\n schema: Schema;\r\n}\r\n\r\n/**\r\n * Type which encapsulates all possible diagnostics.\r\n * @beta\r\n */\r\nexport type AnyDiagnostic = IDiagnostic<AnyECType, any[]>;\r\n\r\n/**\r\n * The abstract base class for all [[IDiagnostic]] implementations.\r\n * @beta\r\n */\r\nexport abstract class BaseDiagnostic<TYPE extends AnyECType, ARGS extends any[]> implements IDiagnostic<TYPE, ARGS> {\r\n /**\r\n * Initializes a new BaseDiagnostic.\r\n * @param ecDefinition The EC object to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(ecDefinition: TYPE, messageArgs?: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n this.ecDefinition = ecDefinition;\r\n this.messageArgs = messageArgs;\r\n this.category = category;\r\n }\r\n\r\n /** Gets the unique string identifier for the diagnostic in the format '<ruleSetName>:<number>'. */\r\n public abstract get code(): string;\r\n /** Gets the context type of the diagnostic (schema, schema item, property, etc...) */\r\n public abstract get diagnosticType(): DiagnosticType;\r\n /** Gets the message associated with the diagnostic. */\r\n public abstract get messageText(): string;\r\n /** Gets the schema where the diagnostic originated. */\r\n public abstract get schema(): Schema;\r\n\r\n /** The EC object to associate with the diagnostic. */\r\n public ecDefinition: TYPE;\r\n /** The arguments used when formatting the diagnostic message. */\r\n public messageArgs?: ARGS;\r\n /** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */\r\n public category: DiagnosticCategory;\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[Schema]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class SchemaDiagnostic<ARGS extends any[]> extends BaseDiagnostic<Schema, ARGS> {\r\n public static diagnosticType = DiagnosticType.SchemaItem;\r\n\r\n /**\r\n * Initializes a new SchemaDiagnostic.\r\n * @param ecDefinition The EC object to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(schema: Schema, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(schema, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.Schema; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[SchemaItem]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class SchemaItemDiagnostic<TYPE extends SchemaItem, ARGS extends any[]> extends BaseDiagnostic<TYPE, ARGS> {\r\n public static diagnosticType = DiagnosticType.SchemaItem;\r\n /**\r\n * Initializes a new SchemaItemDiagnostic.\r\n * @param ecDefinition The EC object to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(ecDefinition: SchemaItem, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(ecDefinition as TYPE, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition.schema; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.SchemaItem; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[ECClass]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class ClassDiagnostic<ARGS extends any[]> extends SchemaItemDiagnostic<AnyClass, ARGS> {\r\n /**\r\n * Initializes a new ClassDiagnostic.\r\n * @param ecClass The class to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(ecClass: AnyClass, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(ecClass, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public override get schema(): Schema { return this.ecDefinition.schema; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[Property]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class PropertyDiagnostic<ARGS extends any[]> extends BaseDiagnostic<AnyProperty, ARGS> {\r\n /**\r\n * Initializes a new PropertyDiagnostic.\r\n * @param property The property to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(property: AnyProperty, messageArgs?: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(property, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition.schema; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.Property; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[RelationshipConstraint]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class RelationshipConstraintDiagnostic<ARGS extends any[]> extends BaseDiagnostic<RelationshipConstraint, ARGS> {\r\n /**\r\n * Initializes a new RelationshipConstraintDiagnostic.\r\n * @param constraint The Relationship Constraint to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(constraint: RelationshipConstraint, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(constraint, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition.schema; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.RelationshipConstraint; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[CustomAttributeContainerProps]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class CustomAttributeContainerDiagnostic<ARGS extends any[]> extends BaseDiagnostic<CustomAttributeContainerProps, ARGS> {\r\n /**\r\n * Initializes a new CustomAttributeContainerDiagnostic.\r\n * @param constraint The Custom Attribute Container to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(container: CustomAttributeContainerProps, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(container, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition.schema; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.CustomAttributeContainer; }\r\n}\r\n\r\n/**\r\n * Helper method for creating [[SchemaDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createSchemaDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends SchemaDiagnostic<ARGS> {\r\n public static code = code;\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[SchemaItemDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createSchemaItemDiagnosticClass<ITEM extends SchemaItem, ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends SchemaItemDiagnostic<ITEM, ARGS> {\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[ClassDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createClassDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends ClassDiagnostic<ARGS> {\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[PropertyDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createPropertyDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends PropertyDiagnostic<ARGS> {\r\n public static code = code;\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[RelationshipConstraintDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the type of diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createRelationshipConstraintDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends RelationshipConstraintDiagnostic<ARGS> {\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[CustomAttributeContainerDiagnostic]] child classes.\r\n * @param code The that uniquely identifies the type of diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createCustomAttributeContainerDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends CustomAttributeContainerDiagnostic<ARGS> {\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/** @beta */\r\nexport function diagnosticCategoryToString(category: DiagnosticCategory) {\r\n switch (category) {\r\n case DiagnosticCategory.Error:\r\n return \"Error\";\r\n case DiagnosticCategory.Warning:\r\n return \"Warning\";\r\n case DiagnosticCategory.Message:\r\n return \"Message\";\r\n case DiagnosticCategory.Suggestion:\r\n return \"Suggestion\";\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport function diagnosticTypeToString(type: DiagnosticType) {\r\n switch (type) {\r\n case DiagnosticType.CustomAttributeContainer:\r\n return \"CustomAttributeContainer\";\r\n case DiagnosticType.None:\r\n return \"None\";\r\n case DiagnosticType.Property:\r\n return \"Property\";\r\n case DiagnosticType.RelationshipConstraint:\r\n return \"RelationshipConstraint\";\r\n case DiagnosticType.Schema:\r\n return \"Schema\";\r\n case DiagnosticType.SchemaItem:\r\n return \"SchemaItem\";\r\n }\r\n}\r\n\r\nfunction validateCode(code: string) {\r\n const msg = `Diagnostic code ${code} is invalid. Expected the format <ruleSetName>-<number>.`;\r\n const parts = code.split(\"-\");\r\n if (parts.length !== 2)\r\n throw new Error(msg);\r\n\r\n if (isNaN(Number(parts[1])))\r\n throw new Error(msg);\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Diagnostic.js","sourceRoot":"","sources":["../../../src/Validation/Diagnostic.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA6OH,kEAOC;AAQD,0EAMC;AAQD,gEAMC;AAQD,sEAOC;AAQD,kGAMC;AAQD,sGAMC;AAGD,gEAWC;AAGD,wDAeC;AAvVD,iDAAiD;AAEjD,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,GAAG,IAAc,EAAE,EAAE;IACzD,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;QACrD,OAAO,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,WAAW;YAC3C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;YACjB,CAAC,CAAC,KAAK,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;GAGG;AACH,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,mDAAI,CAAA;IACJ,uDAA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AS,YAAY,CAAC,IAAY;IAChC,MAAM,GAAG,GAAG,mBAAmB,IAAI,0DAA0D,CAAC;IAC9F,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;IAEvB,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Diagnostic\r\n */\r\n\r\nimport { AnyClass, AnyECType, AnyProperty, CustomAttributeContainerProps, RelationshipConstraint, Schema, SchemaItem } from \"@itwin/ecschema-metadata\";\r\n\r\n/* eslint-disable @typescript-eslint/no-shadow */\r\n\r\nconst formatString = (format: string, ...args: string[]) => {\r\n return format.replace(/{(\\d+)}/g, (match, theNumber) => {\r\n return typeof args[theNumber] !== \"undefined\"\r\n ? args[theNumber]\r\n : match;\r\n });\r\n};\r\n\r\n/**\r\n * Defines the possible diagnostic types.\r\n * @beta\r\n */\r\nexport enum DiagnosticType {\r\n None,\r\n Schema,\r\n SchemaItem,\r\n Property,\r\n CustomAttributeContainer,\r\n RelationshipConstraint,\r\n}\r\n\r\n/**\r\n * Defines the possible diagnostic categories.\r\n * @beta\r\n */\r\nexport enum DiagnosticCategory {\r\n Warning,\r\n Error,\r\n Suggestion,\r\n Message,\r\n}\r\n\r\n/**\r\n * The interface implemented by all diagnostics used during schema validation.\r\n * @beta\r\n */\r\nexport interface IDiagnostic<TYPE extends AnyECType, ARGS extends any[]> {\r\n /** The diagnostic category (error, warning, etc...). Value is static across all instances. */\r\n category: DiagnosticCategory;\r\n /** The unique string identifier of the diagnostic in the format '<ruleSetName>:<number>. Value is static across all instances. */\r\n code: string;\r\n /** The context type of diagnostic (schema, schema item, property, etc...). Value is static across all instances. */\r\n diagnosticType: DiagnosticType;\r\n /** The unformatted message text associated with the diagnostic. Value is static across all instances. */\r\n messageText: string;\r\n /** The arguments used when formatted the diagnostic instance's message. */\r\n messageArgs?: ARGS;\r\n /** The EC object associated with the diagnostic instance. */\r\n ecDefinition: TYPE;\r\n /** The schema where the diagnostic originated. */\r\n schema: Schema;\r\n}\r\n\r\n/**\r\n * Type which encapsulates all possible diagnostics.\r\n * @beta\r\n */\r\nexport type AnyDiagnostic = IDiagnostic<AnyECType, any[]>;\r\n\r\n/**\r\n * The abstract base class for all [[IDiagnostic]] implementations.\r\n * @beta\r\n */\r\nexport abstract class BaseDiagnostic<TYPE extends AnyECType, ARGS extends any[]> implements IDiagnostic<TYPE, ARGS> {\r\n /**\r\n * Initializes a new BaseDiagnostic.\r\n * @param ecDefinition The EC object to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(ecDefinition: TYPE, messageArgs?: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n this.ecDefinition = ecDefinition;\r\n this.messageArgs = messageArgs;\r\n this.category = category;\r\n }\r\n\r\n /** Gets the unique string identifier for the diagnostic in the format '<ruleSetName>:<number>'. */\r\n public abstract get code(): string;\r\n /** Gets the context type of the diagnostic (schema, schema item, property, etc...) */\r\n public abstract get diagnosticType(): DiagnosticType;\r\n /** Gets the message associated with the diagnostic. */\r\n public abstract get messageText(): string;\r\n /** Gets the schema where the diagnostic originated. */\r\n public abstract get schema(): Schema;\r\n\r\n /** The EC object to associate with the diagnostic. */\r\n public ecDefinition: TYPE;\r\n /** The arguments used when formatting the diagnostic message. */\r\n public messageArgs?: ARGS;\r\n /** The diagnostic category is of the type DiagnosticCategory; which is defined as an enumeration above. */\r\n public category: DiagnosticCategory;\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[Schema]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class SchemaDiagnostic<ARGS extends any[]> extends BaseDiagnostic<Schema, ARGS> {\r\n public static diagnosticType = DiagnosticType.SchemaItem;\r\n\r\n /**\r\n * Initializes a new SchemaDiagnostic.\r\n * @param ecDefinition The EC object to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(schema: Schema, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(schema, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.Schema; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[SchemaItem]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class SchemaItemDiagnostic<TYPE extends SchemaItem, ARGS extends any[]> extends BaseDiagnostic<TYPE, ARGS> {\r\n public static diagnosticType = DiagnosticType.SchemaItem;\r\n /**\r\n * Initializes a new SchemaItemDiagnostic.\r\n * @param ecDefinition The EC object to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(ecDefinition: SchemaItem, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(ecDefinition as TYPE, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition.schema; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.SchemaItem; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[ECClass]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class ClassDiagnostic<ARGS extends any[]> extends SchemaItemDiagnostic<AnyClass, ARGS> {\r\n /**\r\n * Initializes a new ClassDiagnostic.\r\n * @param ecClass The class to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(ecClass: AnyClass, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(ecClass, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public override get schema(): Schema { return this.ecDefinition.schema; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[Property]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class PropertyDiagnostic<ARGS extends any[]> extends BaseDiagnostic<AnyProperty, ARGS> {\r\n /**\r\n * Initializes a new PropertyDiagnostic.\r\n * @param property The property to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(property: AnyProperty, messageArgs?: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(property, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition.schema; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.Property; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[RelationshipConstraint]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class RelationshipConstraintDiagnostic<ARGS extends any[]> extends BaseDiagnostic<RelationshipConstraint, ARGS> {\r\n /**\r\n * Initializes a new RelationshipConstraintDiagnostic.\r\n * @param constraint The Relationship Constraint to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(constraint: RelationshipConstraint, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(constraint, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition.schema; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.RelationshipConstraint; }\r\n}\r\n\r\n/**\r\n * An [[IDiagnostic]] implementation used for [[CustomAttributeContainerProps]] diagnostics.\r\n * @beta\r\n */\r\nexport abstract class CustomAttributeContainerDiagnostic<ARGS extends any[]> extends BaseDiagnostic<CustomAttributeContainerProps, ARGS> {\r\n /**\r\n * Initializes a new CustomAttributeContainerDiagnostic.\r\n * @param constraint The Custom Attribute Container to associate with the diagnostic.\r\n * @param messageArgs The arguments used when formatting the diagnostic message.\r\n * @param category The [[DiagnosticCategory]] to associate with the diagnostic, Error by default.\r\n */\r\n constructor(container: CustomAttributeContainerProps, messageArgs: ARGS, category: DiagnosticCategory = DiagnosticCategory.Error) {\r\n super(container, messageArgs, category);\r\n }\r\n\r\n /** Gets the schema where the diagnostic originated. */\r\n public get schema(): Schema { return this.ecDefinition.schema; }\r\n\r\n /** Gets the DiagnosticType. */\r\n public get diagnosticType(): DiagnosticType { return DiagnosticType.CustomAttributeContainer; }\r\n}\r\n\r\n/**\r\n * Helper method for creating [[SchemaDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createSchemaDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends SchemaDiagnostic<ARGS> {\r\n public static code = code;\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[SchemaItemDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createSchemaItemDiagnosticClass<ITEM extends SchemaItem, ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends SchemaItemDiagnostic<ITEM, ARGS> {\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[ClassDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createClassDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends ClassDiagnostic<ARGS> {\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[PropertyDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createPropertyDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends PropertyDiagnostic<ARGS> {\r\n public static code = code;\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[RelationshipConstraintDiagnostic]] child classes.\r\n * @param code The string that uniquely identifies the type of diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createRelationshipConstraintDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends RelationshipConstraintDiagnostic<ARGS> {\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/**\r\n * Helper method for creating [[CustomAttributeContainerDiagnostic]] child classes.\r\n * @param code The that uniquely identifies the type of diagnostic in the format '<ruleSetName>:<number>'.\r\n * @param messageText The message to associate with the diagnostic class.\r\n * @beta\r\n */\r\nexport function createCustomAttributeContainerDiagnosticClass<ARGS extends any[]>(code: string, messageText: string) {\r\n validateCode(code);\r\n return class extends CustomAttributeContainerDiagnostic<ARGS> {\r\n public get code(): string { return code; }\r\n public get messageText(): string { return undefined === this.messageArgs ? messageText : formatString(messageText, ...this.messageArgs); }\r\n };\r\n}\r\n\r\n/** @beta */\r\nexport function diagnosticCategoryToString(category: DiagnosticCategory) {\r\n switch (category) {\r\n case DiagnosticCategory.Error:\r\n return \"Error\";\r\n case DiagnosticCategory.Warning:\r\n return \"Warning\";\r\n case DiagnosticCategory.Message:\r\n return \"Message\";\r\n case DiagnosticCategory.Suggestion:\r\n return \"Suggestion\";\r\n }\r\n}\r\n\r\n/** @beta */\r\nexport function diagnosticTypeToString(type: DiagnosticType) {\r\n switch (type) {\r\n case DiagnosticType.CustomAttributeContainer:\r\n return \"CustomAttributeContainer\";\r\n case DiagnosticType.None:\r\n return \"None\";\r\n case DiagnosticType.Property:\r\n return \"Property\";\r\n case DiagnosticType.RelationshipConstraint:\r\n return \"RelationshipConstraint\";\r\n case DiagnosticType.Schema:\r\n return \"Schema\";\r\n case DiagnosticType.SchemaItem:\r\n return \"SchemaItem\";\r\n }\r\n}\r\n\r\nfunction validateCode(code: string) {\r\n const msg = `Diagnostic code ${code} is invalid. Expected the format <ruleSetName>-<number>.`;\r\n const parts = code.split(\"-\");\r\n if (parts.length !== 2)\r\n throw new Error(msg);\r\n\r\n if (isNaN(Number(parts[1])))\r\n throw new Error(msg);\r\n}\r\n"]}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.FormatDiagnosticReporter = exports.SuppressionDiagnosticReporter = void 0;
|
|
11
|
-
const assert = require("assert");
|
|
11
|
+
const assert = require("assert"); // eslint-disable-line @typescript-eslint/no-require-imports
|
|
12
12
|
const translationNamespace = "ECSchemaMetaData";
|
|
13
13
|
const subTranslationNamespace = "Diagnostics";
|
|
14
14
|
const baseTranslationKey = `${translationNamespace}:${subTranslationNamespace}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiagnosticReporter.js","sourceRoot":"","sources":["../../../src/Validation/DiagnosticReporter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAKH,iCAAkC;
|
|
1
|
+
{"version":3,"file":"DiagnosticReporter.js","sourceRoot":"","sources":["../../../src/Validation/DiagnosticReporter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAKH,iCAAkC,CAAC,4DAA4D;AAE/F,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,CAAC;YAC7E,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,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C;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\"); // eslint-disable-line @typescript-eslint/no-require-imports\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"]}
|
|
@@ -8,7 +8,7 @@ import { AnyDiagnostic } from "./Diagnostic";
|
|
|
8
8
|
* Just telling us whether a rule is suppressed or not.
|
|
9
9
|
* @beta
|
|
10
10
|
*/
|
|
11
|
-
export type ISuppressionRule<T extends AnyECType, U =
|
|
11
|
+
export type ISuppressionRule<T extends AnyECType, U = object> = (diagnostic: AnyDiagnostic, ecDefinition: T, ...args: U[]) => Promise<boolean>;
|
|
12
12
|
/** @beta */
|
|
13
13
|
export type BaseSuppressionRule<T extends AnyECType, U extends AnyECType> = ISuppressionRule<T, U>;
|
|
14
14
|
/** @internal */
|
|
@@ -17,7 +17,7 @@ export type AnyRuleSuppressionMap = IRuleSuppressionMap<AnyECType>;
|
|
|
17
17
|
* Interface used to represent elements of a rule suppression
|
|
18
18
|
* @beta
|
|
19
19
|
*/
|
|
20
|
-
export interface IRuleSuppressionMap<T extends AnyECType, U =
|
|
20
|
+
export interface IRuleSuppressionMap<T extends AnyECType, U = object> {
|
|
21
21
|
ruleCode: string;
|
|
22
22
|
rule: ISuppressionRule<T, U>;
|
|
23
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuleSuppressionSet.d.ts","sourceRoot":"","sources":["../../../src/Validation/RuleSuppressionSet.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,oBAAoB,EACxF,6BAA6B,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,UAAU,EAChH,gBAAgB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAClG,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C;;;;G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AC;IACtE,mBAAmB,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC,CAAC;IACjE,gCAAgC,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAChF,sBAAsB,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5D,oBAAoB,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;IACxD,4BAA4B,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC;IACxE,0BAA0B,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC;IACpE,0BAA0B,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC;IACpE,wBAAwB,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC;CACjE"}
|
|
@@ -1 +1 @@
|
|
|
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 =
|
|
1
|
+
{"version":3,"file":"RuleSuppressionSet.js","sourceRoot":"","sources":["../../../src/Validation/RuleSuppressionSet.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Validation\r\n */\r\n\r\nimport { AnyClass, AnyECType, AnyProperty, Constant, CustomAttribute, CustomAttributeClass,\r\n CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, Phenomenon,\r\n PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, StructClass, Unit,\r\n UnitSystem } from \"@itwin/ecschema-metadata\";\r\nimport { AnyDiagnostic } from \"./Diagnostic\";\r\n\r\n/**\r\n * Interface used for all rule suppressions used during schema validation.\r\n * Just telling us whether a rule is suppressed or not.\r\n * @beta\r\n */\r\nexport type ISuppressionRule<T extends AnyECType, U = object> = (diagnostic: AnyDiagnostic, ecDefinition: T, ...args: U[]) => Promise<boolean>;\r\n\r\n/** @beta */\r\nexport type BaseSuppressionRule<T extends AnyECType, U extends AnyECType> = ISuppressionRule<T, U>;\r\n\r\n/** @internal */\r\nexport type AnyRuleSuppressionMap = IRuleSuppressionMap<AnyECType>;\r\n\r\n/**\r\n * Interface used to represent elements of a rule suppression\r\n * @beta\r\n */\r\nexport interface IRuleSuppressionMap<T extends AnyECType, U = object> {\r\n ruleCode: string;\r\n rule: ISuppressionRule<T, U>;\r\n}\r\n\r\n/**\r\n * Interface used to represent elements of a rule suppression\r\n * @beta\r\n */\r\nexport interface BaseRuleSuppressionMap<T extends AnyECType, U extends AnyECType> {\r\n ruleCode: string;\r\n rule: BaseSuppressionRule<T, U>;\r\n}\r\n\r\n/**\r\n * Interface used to represent logical collection of [[ISuppressionRule]] instances.\r\n * @beta\r\n */\r\nexport interface IRuleSuppressionSet {\r\n name: string;\r\n schemaRuleSuppressions?: Array<IRuleSuppressionMap<Schema>>;\r\n schemaItemRuleSuppressions?: Array<IRuleSuppressionMap<SchemaItem>>;\r\n classRuleSuppressions?: Array<IRuleSuppressionMap<AnyClass>>;\r\n propertyRuleSuppressions?: Array<IRuleSuppressionMap<AnyProperty>>;\r\n entityRuleSuppressions?: Array<IRuleSuppressionMap<EntityClass>>;\r\n structRuleSuppressions?: Array<IRuleSuppressionMap<StructClass>>;\r\n mixinRuleSuppressions?: Array<IRuleSuppressionMap<Mixin>>;\r\n relationshipRuleSuppressions?: Array<IRuleSuppressionMap<RelationshipClass>>;\r\n relationshipConstraintRuleSuppressions?: Array<IRuleSuppressionMap<RelationshipConstraint>>;\r\n customAttributeRuleSuppressions?: Array<IRuleSuppressionMap<CustomAttributeClass>>;\r\n customAttributeContainerSuppressions?: Array<IRuleSuppressionMap<CustomAttributeContainerProps>>;\r\n customAttributeInstanceSuppressions?: Array<BaseRuleSuppressionMap<CustomAttributeContainerProps, CustomAttribute>>;\r\n enumerationRuleSuppressions?: Array<IRuleSuppressionMap<Enumeration>>;\r\n koqRuleSuppressions?: Array<IRuleSuppressionMap<KindOfQuantity>>;\r\n propertyCategoryRuleSuppressions?: Array<IRuleSuppressionMap<PropertyCategory>>;\r\n formatRuleSuppressions?: Array<IRuleSuppressionMap<Format>>;\r\n unitRuleSuppressions?: Array<IRuleSuppressionMap<Unit>>;\r\n invertedUnitRuleSuppressions?: Array<IRuleSuppressionMap<InvertedUnit>>;\r\n unitSystemRuleSuppressions?: Array<IRuleSuppressionMap<UnitSystem>>;\r\n phenomenonRuleSuppressions?: Array<IRuleSuppressionMap<Phenomenon>>;\r\n constantRuleSuppressions?: Array<IRuleSuppressionMap<Constant>>;\r\n}\r\n"]}
|
|
@@ -7,7 +7,7 @@ import { BaseDiagnostic } from "./Diagnostic";
|
|
|
7
7
|
* Interface used for all rule implementations used during schema validation.
|
|
8
8
|
* @beta
|
|
9
9
|
*/
|
|
10
|
-
export type IRule<T extends AnyECType, U =
|
|
10
|
+
export type IRule<T extends AnyECType, U = object> = (ecDefinition: T, ...args: U[]) => AsyncIterable<BaseDiagnostic<T, any[]>>;
|
|
11
11
|
/** @beta */
|
|
12
12
|
export type BaseRule<T extends AnyECType, U extends AnyECType> = IRule<T, U>;
|
|
13
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rules.d.ts","sourceRoot":"","sources":["../../../src/Validation/Rules.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,oBAAoB,EACxF,6BAA6B,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,UAAU,EAChH,gBAAgB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAClG,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;;GAGG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"Rules.d.ts","sourceRoot":"","sources":["../../../src/Validation/Rules.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,oBAAoB,EACxF,6BAA6B,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,UAAU,EAChH,gBAAgB,EAAE,iBAAiB,EAAE,sBAA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sE;IACtE,aAAa,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;CACxC"}
|
|
@@ -1 +1 @@
|
|
|
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 =
|
|
1
|
+
{"version":3,"file":"Rules.js","sourceRoot":"","sources":["../../../src/Validation/Rules.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Validation\r\n */\r\n\r\nimport { AnyClass, AnyECType, AnyProperty, Constant, CustomAttribute, CustomAttributeClass,\r\n CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, Phenomenon,\r\n PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, StructClass, Unit,\r\n UnitSystem } from \"@itwin/ecschema-metadata\";\r\nimport { BaseDiagnostic } from \"./Diagnostic\";\r\n\r\n/**\r\n * Interface used for all rule implementations used during schema validation.\r\n * @beta\r\n */\r\nexport type IRule<T extends AnyECType, U = object> = (ecDefinition: T, ...args: U[]) => AsyncIterable<BaseDiagnostic<T, any[]>>;\r\n\r\n/** @beta */\r\nexport type BaseRule<T extends AnyECType, U extends AnyECType> = IRule<T, U>;\r\n\r\n/**\r\n * Interface used to represent logical collection of [IRule]($ecschema-editing) instances.\r\n * @beta\r\n */\r\nexport interface IRuleSet {\r\n /** The name of the rule set. */\r\n name: string;\r\n\r\n /** A collection of schema names that should be excluded from adhering to the rules defined in this rule set. */\r\n schemaExclusionSet?: string[];\r\n\r\n /** The rules that apply to [Schema]($ecschema-metadata) objects. */\r\n schemaRules?: Array<IRule<Schema>>;\r\n /** The rules that apply to [SchemaItem]($ecschema-metadata) objects. */\r\n schemaItemRules?: Array<IRule<SchemaItem>>;\r\n /** The rules that apply to [ECClass]($ecschema-metadata) objects. */\r\n classRules?: Array<IRule<AnyClass>>;\r\n /** The rules that apply to [Property]($ecschema-metadata) objects. */\r\n propertyRules?: Array<IRule<AnyProperty>>;\r\n /** The rules that apply to [EntityClass]($ecschema-metadata) objects. */\r\n entityClassRules?: Array<IRule<EntityClass>>;\r\n /** The rules that apply to [StructClass]($ecschema-metadata) objects. */\r\n structClassRules?: Array<IRule<StructClass>>;\r\n /** The rules that apply to [Mixin]($ecschema-metadata) objects. */\r\n mixinRules?: Array<IRule<Mixin>>;\r\n /** The rules that apply to [RelationshipClass]($ecschema-metadata) objects. */\r\n relationshipRules?: Array<IRule<RelationshipClass>>;\r\n /** The rules that apply to [RelationshipConstraint]($ecschema-metadata) objects. */\r\n relationshipConstraintRules?: Array<IRule<RelationshipConstraint>>;\r\n /** The rules that apply to [CustomAttributeClass]($ecschema-metadata) objects. */\r\n customAttributeClassRules?: Array<IRule<CustomAttributeClass>>;\r\n /** The rules that apply to [CustomAttributeContainerProps]($ecschema-metadata) objects. */\r\n customAttributeContainerRules?: Array<IRule<CustomAttributeContainerProps>>;\r\n /** The rules that apply to [CustomAttribute]($ecschema-metadata) objects. */\r\n customAttributeInstanceRules?: Array<BaseRule<CustomAttributeContainerProps, CustomAttribute>>;\r\n /** The rules that apply to [Enumeration]($ecschema-metadata) objects. */\r\n enumerationRules?: Array<IRule<Enumeration>>;\r\n /** The rules that apply to [KindOfQuantity]($ecschema-metadata) objects. */\r\n kindOfQuantityRules?: Array<IRule<KindOfQuantity>>;\r\n /** The rules that apply to [PropertyCategory]($ecschema-metadata) objects. */\r\n propertyCategoryRules?: Array<IRule<PropertyCategory>>;\r\n /** The rules that apply to [Format]($ecschema-metadata) objects. */\r\n formatRules?: Array<IRule<Format>>;\r\n /** The rules that apply to [Unit]($ecschema-metadata) objects. */\r\n unitRules?: Array<IRule<Unit>>;\r\n /** The rules that apply to [InvertedUnit]($ecschema-metadata) objects. */\r\n invertedUnitRules?: Array<IRule<InvertedUnit>>;\r\n /** The rules that apply to [UnitSystem]($ecschema-metadata) objects. */\r\n unitSystemRules?: Array<IRule<UnitSystem>>;\r\n /** The rules that apply to [Phenomenon]($ecschema-metadata) objects. */\r\n phenomenonRules?: Array<IRule<Phenomenon>>;\r\n /** The rules that apply to [Constant]($ecschema-metadata) objects. */\r\n constantRules?: Array<IRule<Constant>>;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaValidationVisitor.js","sourceRoot":"","sources":["../../../src/Validation/SchemaValidationVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAQH,6CAAiE;AASjE;;;;;;GAMG;AACH,MAAa,uBAAuB;IAApC;QACU,eAAU,GAA0B,EAAE,CAAC;QACvC,cAAS,GAAiB,EAAE,CAAC;IAoiBvC,CAAC;IAjiBC,oEAAoE;IACpE,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAW,c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I,EAAE,CAAC;gBAClC,OAAO,WAAW,CAAC,IAAI,CAAC;YAC1B,CAAC;QACH,CAAC;QAED,OAAO;IACT,CAAC;IAEO,wBAAwB,CAAC,MAAc,EAAE,OAAiB;QAChE,IAAI,CAAC,OAAO,CAAC,kBAAkB;YAC7B,OAAO,KAAK,CAAC;QAEf,OAAO,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;IAEO,KAAK,CAAC,iBAAiB,CAA8B,UAAyB,EAAE,MAAS,EAAE,cAA4D;QAC7J,IAAI,CAAC,UAAU;YACb,OAAO;QAET,IAAI,cAAc,EAAE,CAAC;YACnB,MAAM,YAAY,GAAG,IAAI,CAAC,mBAAmB,CAAC,cAAc,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;YAC/E,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,aAAa,GAAG,MAAM,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;gBAC7D,IAAI,aAAa,EAAE,CAAC;oBAClB,UAAU,CAAC,QAAQ,GAAG,+BAAkB,CAAC,OAAO,CAAC;gBACnD,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACnC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtiBD,0DAsiBC","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, CustomAttributeContainerProps,\r\n EntityClass, Enumeration, Format, InvertedUnit, ISchemaPartVisitor, KindOfQuantity, Mixin,\r\n Phenomenon, PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem,\r\n StructClass, Unit, UnitSystem,\r\n} from \"@itwin/ecschema-metadata\";\r\n\r\nimport { AnyDiagnostic, DiagnosticCategory } from \"./Diagnostic\";\r\nimport { IDiagnosticReporter } from \"./DiagnosticReporter\";\r\nimport { IRuleSet } from \"./Rules\";\r\nimport { IRuleSuppressionMap, IRuleSuppressionSet, ISuppressionRule } from \"./RuleSuppressionSet\";\r\n\r\ninterface RuleSetArray {\r\n [name: string]: IRuleSet;\r\n}\r\n\r\n/**\r\n * A SchemaWalkerVisitor interface implementation that is used to validate ECObjects schemas using\r\n * [[IRuleSet]] objects registered with the instance. Also allows for reporting of [[IDiagnostic]]\r\n * objects returned from failing rules using [[IDiagnosticReporter]] implementations registered\r\n * with an instance of this class.\r\n * @beta\r\n */\r\nexport class SchemaValidationVisitor implements ISchemaPartVisitor {\r\n private _reporters: IDiagnosticReporter[] = [];\r\n private _ruleSets: RuleSetArray = {};\r\n private _ruleSuppressionSet?: IRuleSuppressionSet;\r\n\r\n /** Gets the IRule<AnyClass> objects registered with the visitor. */\r\n public get ruleSets(): RuleSetArray {\r\n return this._ruleSets;\r\n }\r\n\r\n public get suppressionSet(): IRuleSuppressionSet | undefined {\r\n return this._ruleSuppressionSet;\r\n }\r\n\r\n /** Gets the IDiagnosticReporter objects registered with the visitor. */\r\n public get diagnosticReporters(): IDiagnosticReporter[] {\r\n return this._reporters;\r\n }\r\n\r\n /**\r\n * Registers a [[IDiagnosticReporter]] allowing the reporter to be\r\n * notified when a [[IDiagnostic]] is created due to a rule violation.\r\n * @param reporter The [[DiagnosticReporter]] to register.\r\n */\r\n public registerReporter(...reporters: IDiagnosticReporter[]) {\r\n for (const reporter of reporters)\r\n this._reporters.push(reporter);\r\n }\r\n\r\n /**\r\n * Registers a [[IRuleSet]] that will applied during schema traversal.\r\n * @param ruleSet The [[IRuleSet]] to register.\r\n */\r\n public registerRuleSet(ruleSet: IRuleSet) {\r\n if (undefined !== this.ruleSets[ruleSet.name])\r\n throw new Error(`A RuleSet with the name '${ruleSet.name}' has already been registered.`);\r\n\r\n this.ruleSets[ruleSet.name] = ruleSet;\r\n }\r\n\r\n /**\r\n * Registers a [[IRuleSuppressionSet]] that will be applied during schema traversal.\r\n * @param ruleSet The [[IRuleSuppressionSet]] to register.\r\n * Only supports one Rule Suppression Set, if you call it twice it will overwrite the\r\n * previous suppression set\r\n */\r\n public registerRuleSuppressionSet(suppressionSet: IRuleSuppressionSet) {\r\n this._ruleSuppressionSet = suppressionSet;\r\n }\r\n\r\n /**\r\n * Called before schema traversal.\r\n * @param schema a Schema object.\r\n */\r\n public async visitFullSchema(schema: Schema) {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applySchemaRules(schema, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [[SchemaItem]] instance found during schema traversal.\r\n * @param schemaItem a SchemaItem object.\r\n */\r\n public async visitSchemaItem(schemaItem: SchemaItem) {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applySchemaItemRules(schemaItem, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [AnyClass]($ecschema-metadata) instance found during schema traversal.\r\n * @param ecClass an ECClass object.\r\n */\r\n public async visitClass(ecClass: AnyClass): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyClassRules(ecClass, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [AnyProperty]($ecschema-metadata) instance of an ECClass.\r\n * @param property an AnyProperty object.\r\n */\r\n public async visitProperty(property: AnyProperty): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyPropertyRules(property, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [EntityClass]($ecschema-metadata) instance found during schema traversal.\r\n * @param entityClass an EntityClass object.\r\n */\r\n public async visitEntityClass(entity: EntityClass): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyEntityRules(entity, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [StructClass]($ecschema-metadata) instance found during schema traversal.\r\n * @param structClass a StructClass object.\r\n */\r\n public async visitStructClass(struct: StructClass): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyStructRules(struct, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [Mixin]($ecschema-metadata) instance found during schema traversal.\r\n * @param mixin a Mixin object.\r\n */\r\n public async visitMixin(mixin: Mixin): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyMixinRules(mixin, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [RelationshipClass]($ecschema-metadata) instance found during schema traversal.\r\n * @param relationshipClass a RelationshipClass object.\r\n */\r\n public async visitRelationshipClass(relationship: RelationshipClass): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyRelationshipRules(relationship, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [RelationshipConstraint]($ecschema-metadata) of each RelationshipClass found during schema traversal.\r\n * @param relationshipConstraint a RelationshipConstraint object.\r\n */\r\n public async visitRelationshipConstraint(constraint: RelationshipConstraint): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyRelationshipConstraintRules(constraint, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [CustomAttributeClass]($ecschema-metadata) instance found during schema traversal.\r\n * @param customAttributeClass a CustomAttributeClass object.\r\n */\r\n public async visitCustomAttributeClass(customAttribute: CustomAttributeClass): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyCustomAttributeRules(customAttribute, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [CustomAttribute]($ecschema-metadata) container in the schema.\r\n * @param customAttributeContainer a [[CustomAttributeContainerProps]] object.\r\n */\r\n public async visitCustomAttributeContainer(container: CustomAttributeContainerProps): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyCustomAttributeContainerRules(container, this._ruleSets[index]);\r\n\r\n if (undefined === container.customAttributes)\r\n return;\r\n\r\n for (const [, customAttribute] of container.customAttributes) {\r\n for (const index of Object.keys(this._ruleSets)) {\r\n await this.applyCustomAttributeInstanceRules(container, customAttribute, this._ruleSets[index]);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Called for each [Enumeration]($ecschema-metadata) instance found during schema traversal.\r\n * @param enumeration an Enumeration object.\r\n */\r\n public async visitEnumeration(enumeration: Enumeration) {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyEnumerationRules(enumeration, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [KindOfQuantity]($ecschema-metadata) instance found during schema traversal.\r\n * @param koq a KindOfQuantity object.\r\n */\r\n public async visitKindOfQuantity(koq: KindOfQuantity) {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyKindOfQuantityRules(koq, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [PropertyCategory]($ecschema-metadata) instance found during schema traversal.\r\n * @param category a PropertyCategory object.\r\n */\r\n public async visitPropertyCategory(category: PropertyCategory) {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyPropertyCategoryRules(category, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [Format]($ecschema-metadata) instance found during schema traversal.\r\n * @param format a Format object.\r\n */\r\n public async visitFormat(format: Format): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyFormatRules(format, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [Unit]($ecschema-metadata) instance found during schema traversal.\r\n * @param unit a Unit object.\r\n */\r\n public async visitUnit(unit: Unit): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyUnitRules(unit, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [InvertedUnit]($ecschema-metadata) instance found during schema traversal.\r\n * @param invertedUnit an InvertedUnit object.\r\n */\r\n public async visitInvertedUnit(invertedUnit: InvertedUnit): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyInvertedUnitRules(invertedUnit, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [UnitSystem]($ecschema-metadata) instance found during schema traversal.\r\n * @param unitSystem a UnitSystem object.\r\n */\r\n public async visitUnitSystem(unitSystem: UnitSystem): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyUnitSystemRules(unitSystem, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [Phenomenon]($ecschema-metadata) instance found during schema traversal.\r\n * @param phenomena a Phenomenon object.\r\n */\r\n public async visitPhenomenon(phenomenon: Phenomenon): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyPhenomenonRules(phenomenon, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [Constant]($ecschema-metadata) instance found during schema traversal.\r\n * @param constant a Constant object.\r\n */\r\n public async visitConstant(constant: Constant): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyConstantRules(constant, this._ruleSets[index]);\r\n }\r\n\r\n public async applySchemaRules(schema: Schema, ruleSet: IRuleSet) {\r\n if (!ruleSet.schemaRules || this.excludeSchemaFromRuleSet(schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.schemaRules) {\r\n const result = rule(schema);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.schemaRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, schema, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applySchemaItemRules(schemaItem: SchemaItem, ruleSet: IRuleSet) {\r\n if (!ruleSet.schemaItemRules || this.excludeSchemaFromRuleSet(schemaItem.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.schemaItemRules) {\r\n const result = rule(schemaItem);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.schemaItemRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, schemaItem, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyClassRules(ecClass: AnyClass, ruleSet: IRuleSet) {\r\n if (!ruleSet.classRules || this.excludeSchemaFromRuleSet(ecClass.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.classRules) {\r\n const result = rule(ecClass);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.classRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, ecClass, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyPropertyRules(property: AnyProperty, ruleSet: IRuleSet) {\r\n if (!ruleSet.propertyRules || this.excludeSchemaFromRuleSet(property.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.propertyRules) {\r\n const result = rule(property);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.propertyRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, property, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyEntityRules(entityClass: EntityClass, ruleSet: IRuleSet) {\r\n if (!ruleSet.entityClassRules || this.excludeSchemaFromRuleSet(entityClass.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.entityClassRules) {\r\n const result = rule(entityClass);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.entityRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, entityClass, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyStructRules(structClass: StructClass, ruleSet: IRuleSet) {\r\n if (!ruleSet.structClassRules || this.excludeSchemaFromRuleSet(structClass.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.structClassRules) {\r\n const result = rule(structClass);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.structRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, structClass, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyMixinRules(mixin: Mixin, ruleSet: IRuleSet) {\r\n if (!ruleSet.mixinRules || this.excludeSchemaFromRuleSet(mixin.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.mixinRules) {\r\n const result = rule(mixin);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.mixinRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, mixin, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyRelationshipRules(relationship: RelationshipClass, ruleSet: IRuleSet) {\r\n if (!ruleSet.relationshipRules || this.excludeSchemaFromRuleSet(relationship.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.relationshipRules) {\r\n const result = rule(relationship);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.relationshipRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, relationship, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyRelationshipConstraintRules(constraint: RelationshipConstraint, ruleSet: IRuleSet) {\r\n if (!ruleSet.relationshipConstraintRules || this.excludeSchemaFromRuleSet(constraint.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.relationshipConstraintRules) {\r\n const result = rule(constraint);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.relationshipConstraintRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, constraint, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyCustomAttributeRules(customAttribute: CustomAttributeClass, ruleSet: IRuleSet) {\r\n if (!ruleSet.customAttributeClassRules || this.excludeSchemaFromRuleSet(customAttribute.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.customAttributeClassRules) {\r\n const result = rule(customAttribute);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.customAttributeRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, customAttribute, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyCustomAttributeContainerRules(container: CustomAttributeContainerProps, ruleSet: IRuleSet) {\r\n if (!ruleSet.customAttributeContainerRules || this.excludeSchemaFromRuleSet(container.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.customAttributeContainerRules) {\r\n const result = rule(container);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.customAttributeContainerSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, container, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyCustomAttributeInstanceRules(container: CustomAttributeContainerProps, customAttribute: CustomAttribute, ruleSet: IRuleSet) {\r\n if (!ruleSet.customAttributeInstanceRules || this.excludeSchemaFromRuleSet(container.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.customAttributeInstanceRules) {\r\n const result = rule(container, customAttribute);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.customAttributeInstanceSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, container, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyEnumerationRules(enumeration: Enumeration, ruleSet: IRuleSet) {\r\n if (!ruleSet.enumerationRules || this.excludeSchemaFromRuleSet(enumeration.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.enumerationRules) {\r\n const result = rule(enumeration);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.enumerationRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, enumeration, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyKindOfQuantityRules(kindOfQuantity: KindOfQuantity, ruleSet: IRuleSet) {\r\n if (!ruleSet.kindOfQuantityRules || this.excludeSchemaFromRuleSet(kindOfQuantity.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.kindOfQuantityRules) {\r\n const result = rule(kindOfQuantity);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.koqRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, kindOfQuantity, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyPropertyCategoryRules(propertyCategory: PropertyCategory, ruleSet: IRuleSet) {\r\n if (!ruleSet.propertyCategoryRules || this.excludeSchemaFromRuleSet(propertyCategory.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.propertyCategoryRules) {\r\n const result = rule(propertyCategory);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.propertyCategoryRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, propertyCategory, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyFormatRules(format: Format, ruleSet: IRuleSet) {\r\n if (!ruleSet.formatRules || this.excludeSchemaFromRuleSet(format.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.formatRules) {\r\n const result = rule(format);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.formatRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, format, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyUnitRules(unit: Unit, ruleSet: IRuleSet) {\r\n if (!ruleSet.unitRules || this.excludeSchemaFromRuleSet(unit.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.unitRules) {\r\n const result = rule(unit);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.unitRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, unit, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyInvertedUnitRules(invertedUnit: InvertedUnit, ruleSet: IRuleSet) {\r\n if (!ruleSet.invertedUnitRules || this.excludeSchemaFromRuleSet(invertedUnit.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.invertedUnitRules) {\r\n const result = rule(invertedUnit);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.invertedUnitRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, invertedUnit, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyUnitSystemRules(unitSystem: UnitSystem, ruleSet: IRuleSet) {\r\n if (!ruleSet.unitSystemRules || this.excludeSchemaFromRuleSet(unitSystem.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.unitSystemRules) {\r\n const result = rule(unitSystem);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.unitSystemRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, unitSystem, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyPhenomenonRules(phenomenon: Phenomenon, ruleSet: IRuleSet) {\r\n if (!ruleSet.phenomenonRules || this.excludeSchemaFromRuleSet(phenomenon.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.phenomenonRules) {\r\n const result = rule(phenomenon);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.phenomenonRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, phenomenon, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyConstantRules(constant: Constant, ruleSet: IRuleSet) {\r\n if (!ruleSet.constantRules || this.excludeSchemaFromRuleSet(constant.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.constantRules) {\r\n const result = rule(constant);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.constantRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, constant, suppressions);\r\n }\r\n }\r\n }\r\n\r\n private findSuppressionRule<T extends AnyECType, U = {}>(suppressionSet: Array<IRuleSuppressionMap<T, U>>, code: string): ISuppressionRule<T, U> | undefined {\r\n if (!suppressionSet)\r\n return;\r\n\r\n for (const suppression of suppressionSet) {\r\n if (suppression.ruleCode === code) {\r\n return suppression.rule;\r\n }\r\n }\r\n\r\n return;\r\n }\r\n\r\n private excludeSchemaFromRuleSet(schema: Schema, ruleSet: IRuleSet): boolean {\r\n if (!ruleSet.schemaExclusionSet)\r\n return false;\r\n\r\n return ruleSet.schemaExclusionSet.includes(schema.name);\r\n }\r\n\r\n private async reportDiagnostics<T extends AnyECType, U = {}>(diagnostic: AnyDiagnostic, ecType: T, suppressionMap: Array<IRuleSuppressionMap<T, U>> | undefined) {\r\n if (!diagnostic)\r\n return;\r\n\r\n if (suppressionMap) {\r\n const suppressRule = this.findSuppressionRule(suppressionMap, diagnostic.code);\r\n if (suppressRule) {\r\n const ecSuppression = await suppressRule(diagnostic, ecType);\r\n if (ecSuppression) {\r\n diagnostic.category = DiagnosticCategory.Warning;\r\n }\r\n }\r\n }\r\n\r\n this._reporters.forEach((reporter) => {\r\n reporter.report(diagnostic);\r\n });\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaValidationVisitor.js","sourceRoot":"","sources":["../../../src/Validation/SchemaValidationVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAQH,6CAAiE;AASjE;;;;;;GAMG;AACH,MAAa,uBAAuB;IAApC;QACU,eAAU,GAA0B,EAAE,CAAC;QACvC,cAAS,GAAiB,EAAE,CAAC;IAoiBvC,CAAC;IAjiBC,oEAAoE;IACpE,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IAED,wEAAwE;IACxE,IAAW,mBAAmB;QAC5B,OAAO,IAAI,CAAC,UAAU,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Ac,EAAE,OAAiB;QAChE,IAAI,CAAC,OAAO,CAAC,kBAAkB;YAC7B,OAAO,KAAK,CAAC;QAEf,OAAO,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;IAEO,KAAK,CAAC,iBAAiB,CAAkC,UAAyB,EAAE,MAAS,EAAE,cAA4D;QACjK,IAAI,CAAC,UAAU;YACb,OAAO;QAET,IAAI,cAAc,EAAE,CAAC;YACnB,MAAM,YAAY,GAAG,IAAI,CAAC,mBAAmB,CAAC,cAAc,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;YAC/E,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,aAAa,GAAG,MAAM,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;gBAC7D,IAAI,aAAa,EAAE,CAAC;oBAClB,UAAU,CAAC,QAAQ,GAAG,+BAAkB,CAAC,OAAO,CAAC;gBACnD,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACnC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtiBD,0DAsiBC","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, CustomAttributeContainerProps,\r\n EntityClass, Enumeration, Format, InvertedUnit, ISchemaPartVisitor, KindOfQuantity, Mixin,\r\n Phenomenon, PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem,\r\n StructClass, Unit, UnitSystem,\r\n} from \"@itwin/ecschema-metadata\";\r\n\r\nimport { AnyDiagnostic, DiagnosticCategory } from \"./Diagnostic\";\r\nimport { IDiagnosticReporter } from \"./DiagnosticReporter\";\r\nimport { IRuleSet } from \"./Rules\";\r\nimport { IRuleSuppressionMap, IRuleSuppressionSet, ISuppressionRule } from \"./RuleSuppressionSet\";\r\n\r\ninterface RuleSetArray {\r\n [name: string]: IRuleSet;\r\n}\r\n\r\n/**\r\n * A SchemaWalkerVisitor interface implementation that is used to validate ECObjects schemas using\r\n * [[IRuleSet]] objects registered with the instance. Also allows for reporting of [[IDiagnostic]]\r\n * objects returned from failing rules using [[IDiagnosticReporter]] implementations registered\r\n * with an instance of this class.\r\n * @beta\r\n */\r\nexport class SchemaValidationVisitor implements ISchemaPartVisitor {\r\n private _reporters: IDiagnosticReporter[] = [];\r\n private _ruleSets: RuleSetArray = {};\r\n private _ruleSuppressionSet?: IRuleSuppressionSet;\r\n\r\n /** Gets the IRule<AnyClass> objects registered with the visitor. */\r\n public get ruleSets(): RuleSetArray {\r\n return this._ruleSets;\r\n }\r\n\r\n public get suppressionSet(): IRuleSuppressionSet | undefined {\r\n return this._ruleSuppressionSet;\r\n }\r\n\r\n /** Gets the IDiagnosticReporter objects registered with the visitor. */\r\n public get diagnosticReporters(): IDiagnosticReporter[] {\r\n return this._reporters;\r\n }\r\n\r\n /**\r\n * Registers a [[IDiagnosticReporter]] allowing the reporter to be\r\n * notified when a [[IDiagnostic]] is created due to a rule violation.\r\n * @param reporter The [[DiagnosticReporter]] to register.\r\n */\r\n public registerReporter(...reporters: IDiagnosticReporter[]) {\r\n for (const reporter of reporters)\r\n this._reporters.push(reporter);\r\n }\r\n\r\n /**\r\n * Registers a [[IRuleSet]] that will applied during schema traversal.\r\n * @param ruleSet The [[IRuleSet]] to register.\r\n */\r\n public registerRuleSet(ruleSet: IRuleSet) {\r\n if (undefined !== this.ruleSets[ruleSet.name])\r\n throw new Error(`A RuleSet with the name '${ruleSet.name}' has already been registered.`);\r\n\r\n this.ruleSets[ruleSet.name] = ruleSet;\r\n }\r\n\r\n /**\r\n * Registers a [[IRuleSuppressionSet]] that will be applied during schema traversal.\r\n * @param ruleSet The [[IRuleSuppressionSet]] to register.\r\n * Only supports one Rule Suppression Set, if you call it twice it will overwrite the\r\n * previous suppression set\r\n */\r\n public registerRuleSuppressionSet(suppressionSet: IRuleSuppressionSet) {\r\n this._ruleSuppressionSet = suppressionSet;\r\n }\r\n\r\n /**\r\n * Called before schema traversal.\r\n * @param schema a Schema object.\r\n */\r\n public async visitFullSchema(schema: Schema) {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applySchemaRules(schema, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [[SchemaItem]] instance found during schema traversal.\r\n * @param schemaItem a SchemaItem object.\r\n */\r\n public async visitSchemaItem(schemaItem: SchemaItem) {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applySchemaItemRules(schemaItem, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [AnyClass]($ecschema-metadata) instance found during schema traversal.\r\n * @param ecClass an ECClass object.\r\n */\r\n public async visitClass(ecClass: AnyClass): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyClassRules(ecClass, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [AnyProperty]($ecschema-metadata) instance of an ECClass.\r\n * @param property an AnyProperty object.\r\n */\r\n public async visitProperty(property: AnyProperty): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyPropertyRules(property, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [EntityClass]($ecschema-metadata) instance found during schema traversal.\r\n * @param entityClass an EntityClass object.\r\n */\r\n public async visitEntityClass(entity: EntityClass): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyEntityRules(entity, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [StructClass]($ecschema-metadata) instance found during schema traversal.\r\n * @param structClass a StructClass object.\r\n */\r\n public async visitStructClass(struct: StructClass): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyStructRules(struct, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [Mixin]($ecschema-metadata) instance found during schema traversal.\r\n * @param mixin a Mixin object.\r\n */\r\n public async visitMixin(mixin: Mixin): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyMixinRules(mixin, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [RelationshipClass]($ecschema-metadata) instance found during schema traversal.\r\n * @param relationshipClass a RelationshipClass object.\r\n */\r\n public async visitRelationshipClass(relationship: RelationshipClass): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyRelationshipRules(relationship, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [RelationshipConstraint]($ecschema-metadata) of each RelationshipClass found during schema traversal.\r\n * @param relationshipConstraint a RelationshipConstraint object.\r\n */\r\n public async visitRelationshipConstraint(constraint: RelationshipConstraint): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyRelationshipConstraintRules(constraint, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [CustomAttributeClass]($ecschema-metadata) instance found during schema traversal.\r\n * @param customAttributeClass a CustomAttributeClass object.\r\n */\r\n public async visitCustomAttributeClass(customAttribute: CustomAttributeClass): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyCustomAttributeRules(customAttribute, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [CustomAttribute]($ecschema-metadata) container in the schema.\r\n * @param customAttributeContainer a [[CustomAttributeContainerProps]] object.\r\n */\r\n public async visitCustomAttributeContainer(container: CustomAttributeContainerProps): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyCustomAttributeContainerRules(container, this._ruleSets[index]);\r\n\r\n if (undefined === container.customAttributes)\r\n return;\r\n\r\n for (const [, customAttribute] of container.customAttributes) {\r\n for (const index of Object.keys(this._ruleSets)) {\r\n await this.applyCustomAttributeInstanceRules(container, customAttribute, this._ruleSets[index]);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Called for each [Enumeration]($ecschema-metadata) instance found during schema traversal.\r\n * @param enumeration an Enumeration object.\r\n */\r\n public async visitEnumeration(enumeration: Enumeration) {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyEnumerationRules(enumeration, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [KindOfQuantity]($ecschema-metadata) instance found during schema traversal.\r\n * @param koq a KindOfQuantity object.\r\n */\r\n public async visitKindOfQuantity(koq: KindOfQuantity) {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyKindOfQuantityRules(koq, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [PropertyCategory]($ecschema-metadata) instance found during schema traversal.\r\n * @param category a PropertyCategory object.\r\n */\r\n public async visitPropertyCategory(category: PropertyCategory) {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyPropertyCategoryRules(category, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [Format]($ecschema-metadata) instance found during schema traversal.\r\n * @param format a Format object.\r\n */\r\n public async visitFormat(format: Format): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyFormatRules(format, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [Unit]($ecschema-metadata) instance found during schema traversal.\r\n * @param unit a Unit object.\r\n */\r\n public async visitUnit(unit: Unit): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyUnitRules(unit, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [InvertedUnit]($ecschema-metadata) instance found during schema traversal.\r\n * @param invertedUnit an InvertedUnit object.\r\n */\r\n public async visitInvertedUnit(invertedUnit: InvertedUnit): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyInvertedUnitRules(invertedUnit, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [UnitSystem]($ecschema-metadata) instance found during schema traversal.\r\n * @param unitSystem a UnitSystem object.\r\n */\r\n public async visitUnitSystem(unitSystem: UnitSystem): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyUnitSystemRules(unitSystem, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [Phenomenon]($ecschema-metadata) instance found during schema traversal.\r\n * @param phenomena a Phenomenon object.\r\n */\r\n public async visitPhenomenon(phenomenon: Phenomenon): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyPhenomenonRules(phenomenon, this._ruleSets[index]);\r\n }\r\n\r\n /**\r\n * Called for each [Constant]($ecschema-metadata) instance found during schema traversal.\r\n * @param constant a Constant object.\r\n */\r\n public async visitConstant(constant: Constant): Promise<void> {\r\n for (const index of Object.keys(this._ruleSets))\r\n await this.applyConstantRules(constant, this._ruleSets[index]);\r\n }\r\n\r\n public async applySchemaRules(schema: Schema, ruleSet: IRuleSet) {\r\n if (!ruleSet.schemaRules || this.excludeSchemaFromRuleSet(schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.schemaRules) {\r\n const result = rule(schema);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.schemaRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, schema, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applySchemaItemRules(schemaItem: SchemaItem, ruleSet: IRuleSet) {\r\n if (!ruleSet.schemaItemRules || this.excludeSchemaFromRuleSet(schemaItem.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.schemaItemRules) {\r\n const result = rule(schemaItem);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.schemaItemRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, schemaItem, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyClassRules(ecClass: AnyClass, ruleSet: IRuleSet) {\r\n if (!ruleSet.classRules || this.excludeSchemaFromRuleSet(ecClass.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.classRules) {\r\n const result = rule(ecClass);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.classRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, ecClass, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyPropertyRules(property: AnyProperty, ruleSet: IRuleSet) {\r\n if (!ruleSet.propertyRules || this.excludeSchemaFromRuleSet(property.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.propertyRules) {\r\n const result = rule(property);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.propertyRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, property, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyEntityRules(entityClass: EntityClass, ruleSet: IRuleSet) {\r\n if (!ruleSet.entityClassRules || this.excludeSchemaFromRuleSet(entityClass.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.entityClassRules) {\r\n const result = rule(entityClass);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.entityRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, entityClass, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyStructRules(structClass: StructClass, ruleSet: IRuleSet) {\r\n if (!ruleSet.structClassRules || this.excludeSchemaFromRuleSet(structClass.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.structClassRules) {\r\n const result = rule(structClass);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.structRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, structClass, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyMixinRules(mixin: Mixin, ruleSet: IRuleSet) {\r\n if (!ruleSet.mixinRules || this.excludeSchemaFromRuleSet(mixin.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.mixinRules) {\r\n const result = rule(mixin);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.mixinRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, mixin, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyRelationshipRules(relationship: RelationshipClass, ruleSet: IRuleSet) {\r\n if (!ruleSet.relationshipRules || this.excludeSchemaFromRuleSet(relationship.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.relationshipRules) {\r\n const result = rule(relationship);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.relationshipRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, relationship, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyRelationshipConstraintRules(constraint: RelationshipConstraint, ruleSet: IRuleSet) {\r\n if (!ruleSet.relationshipConstraintRules || this.excludeSchemaFromRuleSet(constraint.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.relationshipConstraintRules) {\r\n const result = rule(constraint);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.relationshipConstraintRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, constraint, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyCustomAttributeRules(customAttribute: CustomAttributeClass, ruleSet: IRuleSet) {\r\n if (!ruleSet.customAttributeClassRules || this.excludeSchemaFromRuleSet(customAttribute.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.customAttributeClassRules) {\r\n const result = rule(customAttribute);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.customAttributeRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, customAttribute, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyCustomAttributeContainerRules(container: CustomAttributeContainerProps, ruleSet: IRuleSet) {\r\n if (!ruleSet.customAttributeContainerRules || this.excludeSchemaFromRuleSet(container.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.customAttributeContainerRules) {\r\n const result = rule(container);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.customAttributeContainerSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, container, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyCustomAttributeInstanceRules(container: CustomAttributeContainerProps, customAttribute: CustomAttribute, ruleSet: IRuleSet) {\r\n if (!ruleSet.customAttributeInstanceRules || this.excludeSchemaFromRuleSet(container.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.customAttributeInstanceRules) {\r\n const result = rule(container, customAttribute);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.customAttributeInstanceSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, container, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyEnumerationRules(enumeration: Enumeration, ruleSet: IRuleSet) {\r\n if (!ruleSet.enumerationRules || this.excludeSchemaFromRuleSet(enumeration.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.enumerationRules) {\r\n const result = rule(enumeration);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.enumerationRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, enumeration, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyKindOfQuantityRules(kindOfQuantity: KindOfQuantity, ruleSet: IRuleSet) {\r\n if (!ruleSet.kindOfQuantityRules || this.excludeSchemaFromRuleSet(kindOfQuantity.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.kindOfQuantityRules) {\r\n const result = rule(kindOfQuantity);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.koqRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, kindOfQuantity, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyPropertyCategoryRules(propertyCategory: PropertyCategory, ruleSet: IRuleSet) {\r\n if (!ruleSet.propertyCategoryRules || this.excludeSchemaFromRuleSet(propertyCategory.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.propertyCategoryRules) {\r\n const result = rule(propertyCategory);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.propertyCategoryRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, propertyCategory, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyFormatRules(format: Format, ruleSet: IRuleSet) {\r\n if (!ruleSet.formatRules || this.excludeSchemaFromRuleSet(format.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.formatRules) {\r\n const result = rule(format);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.formatRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, format, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyUnitRules(unit: Unit, ruleSet: IRuleSet) {\r\n if (!ruleSet.unitRules || this.excludeSchemaFromRuleSet(unit.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.unitRules) {\r\n const result = rule(unit);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.unitRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, unit, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyInvertedUnitRules(invertedUnit: InvertedUnit, ruleSet: IRuleSet) {\r\n if (!ruleSet.invertedUnitRules || this.excludeSchemaFromRuleSet(invertedUnit.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.invertedUnitRules) {\r\n const result = rule(invertedUnit);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.invertedUnitRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, invertedUnit, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyUnitSystemRules(unitSystem: UnitSystem, ruleSet: IRuleSet) {\r\n if (!ruleSet.unitSystemRules || this.excludeSchemaFromRuleSet(unitSystem.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.unitSystemRules) {\r\n const result = rule(unitSystem);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.unitSystemRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, unitSystem, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyPhenomenonRules(phenomenon: Phenomenon, ruleSet: IRuleSet) {\r\n if (!ruleSet.phenomenonRules || this.excludeSchemaFromRuleSet(phenomenon.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.phenomenonRules) {\r\n const result = rule(phenomenon);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.phenomenonRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, phenomenon, suppressions);\r\n }\r\n }\r\n }\r\n\r\n public async applyConstantRules(constant: Constant, ruleSet: IRuleSet) {\r\n if (!ruleSet.constantRules || this.excludeSchemaFromRuleSet(constant.schema, ruleSet))\r\n return;\r\n\r\n for (const rule of ruleSet.constantRules) {\r\n const result = rule(constant);\r\n for await (const diagnostic of result) {\r\n const suppressions = this._ruleSuppressionSet ? this._ruleSuppressionSet.constantRuleSuppressions : undefined;\r\n await this.reportDiagnostics(diagnostic, constant, suppressions);\r\n }\r\n }\r\n }\r\n\r\n private findSuppressionRule<T extends AnyECType, U = object>(suppressionSet: Array<IRuleSuppressionMap<T, U>>, code: string): ISuppressionRule<T, U> | undefined {\r\n if (!suppressionSet)\r\n return;\r\n\r\n for (const suppression of suppressionSet) {\r\n if (suppression.ruleCode === code) {\r\n return suppression.rule;\r\n }\r\n }\r\n\r\n return;\r\n }\r\n\r\n private excludeSchemaFromRuleSet(schema: Schema, ruleSet: IRuleSet): boolean {\r\n if (!ruleSet.schemaExclusionSet)\r\n return false;\r\n\r\n return ruleSet.schemaExclusionSet.includes(schema.name);\r\n }\r\n\r\n private async reportDiagnostics<T extends AnyECType, U = object>(diagnostic: AnyDiagnostic, ecType: T, suppressionMap: Array<IRuleSuppressionMap<T, U>> | undefined) {\r\n if (!diagnostic)\r\n return;\r\n\r\n if (suppressionMap) {\r\n const suppressRule = this.findSuppressionRule(suppressionMap, diagnostic.code);\r\n if (suppressRule) {\r\n const ecSuppression = await suppressRule(diagnostic, ecType);\r\n if (ecSuppression) {\r\n diagnostic.category = DiagnosticCategory.Warning;\r\n }\r\n }\r\n }\r\n\r\n this._reporters.forEach((reporter) => {\r\n reporter.report(diagnostic);\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecschema-editing.d.ts","sourceRoot":"","sources":["../../src/ecschema-editing.ts"],"names":[],"mappings":"AAKA,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"ecschema-editing.d.ts","sourceRoot":"","sources":["../../src/ecschema-editing.ts"],"names":[],"mappings":"AAKA,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC/E,cAAc,wCAAwC,CAAC;AACvD,cAAc,oBAAoB,CAAC;AACnC,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uCAAuC,CAAC;AACtD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC7G,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,cAAc,6BAA6B,CAAC;AAE5C;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
|
|
@@ -21,7 +21,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
exports.SchemaMerger = exports.SchemaValidater = exports.ECRuleSet = exports.Diagnostics = exports.DiagnosticCodes = void 0;
|
|
22
22
|
__exportStar(require("./Validation/Diagnostic"), exports);
|
|
23
23
|
__exportStar(require("./Validation/DiagnosticReporter"), exports);
|
|
24
|
-
/* eslint-disable-next-line deprecation/deprecation */
|
|
25
24
|
var ECRules_1 = require("./Validation/ECRules");
|
|
26
25
|
Object.defineProperty(exports, "DiagnosticCodes", { enumerable: true, get: function () { return ECRules_1.DiagnosticCodes; } });
|
|
27
26
|
Object.defineProperty(exports, "Diagnostics", { enumerable: true, get: function () { return ECRules_1.Diagnostics; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecschema-editing.js","sourceRoot":"","sources":["../../src/ecschema-editing.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;AAE/F,0DAAwC;AACxC,kEAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"ecschema-editing.js","sourceRoot":"","sources":["../../src/ecschema-editing.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;AAE/F,0DAAwC;AACxC,kEAAgD;AAChD,gDAA+E;AAAtE,0GAAA,eAAe,OAAA;AAAE,sGAAA,WAAW,OAAA;AAAE,oGAAA,SAAS,OAAA;AAChD,yEAAuD;AACvD,qDAAmC;AACnC,uEAAqD;AACrD,4DAA0C;AAC1C,wEAAsD;AACtD,6DAA2C;AAC3C,8DAA4C;AAC5C,qEAAmD;AACnD,mDAAiC;AACjC,sDAAoC;AAEpC,gEAA+D;AAAtD,kHAAA,eAAe,OAAA;AACxB,kEAAgD;AAChD,iEAA+C;AAC/C,wDAAsC;AACtC,uDAAqC;AACrC,uDAAsD;AAA7C,4GAAA,YAAY,OAAA;AACrB,8DAA4C;AAE5C;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","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\r\nexport * from \"./Validation/Diagnostic\";\r\nexport * from \"./Validation/DiagnosticReporter\";\r\nexport { DiagnosticCodes, Diagnostics, ECRuleSet } from \"./Validation/ECRules\";\r\nexport * from \"./Validation/LoggingDiagnosticReporter\";\r\nexport * from \"./Validation/Rules\";\r\nexport * from \"./Validation/SchemaValidationVisitor\";\r\nexport * from \"./Validation/SchemaWalker\";\r\nexport * from \"./Validation/SchemaCompareDiagnostics\";\r\nexport * from \"./Validation/SchemaChanges\";\r\nexport * from \"./Validation/SchemaComparer\";\r\nexport * from \"./Validation/SchemaCompareReporter\";\r\nexport * from \"./Editing/Editor\";\r\nexport * from \"./Editing/Exception\";\r\nexport { ISuppressionRule, IRuleSuppressionSet, IRuleSuppressionMap } from \"./Validation/RuleSuppressionSet\";\r\nexport { SchemaValidater } from \"./Validation/SchemaValidater\";\r\nexport * from \"./Differencing/SchemaDifference\";\r\nexport * from \"./Differencing/SchemaConflicts\";\r\nexport * from \"./Differencing/Errors\";\r\nexport * from \"./Differencing/Utils\";\r\nexport { SchemaMerger } from \"./Merging/SchemaMerger\";\r\nexport * from \"./Merging/Edits/SchemaEdits\";\r\n\r\n/** @docs-package-description\r\n * The ecschema-editing package contains classes for validating, and editing ECSchemas that can be used in both [frontend]($docs/learning/frontend/index.md) and [backend]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Editing\r\n * Set of classes used to perform editing of ECSchemas.\r\n */\r\n/**\r\n * @docs-group-description Diagnostic\r\n * Set of classes to categorize and manage ECSchema validation results.\r\n */\r\n/**\r\n * @docs-group-description Validation\r\n * Set of classes used to perform validation on ECSchemas.\r\n */\r\n/**\r\n * @docs-group-description Comparison\r\n * Set of classes to enable comparison of ECSchemas.\r\n */\r\n/**\r\n * @docs-group-description Merging\r\n * Set of classes used to merge schemas.\r\n */\r\n/**\r\n * @docs-group-description Differencing\r\n * Set of classes used to perform differences between ECSchemas.\r\n */\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/ecschema-editing",
|
|
3
|
-
"version": "4.10.0-dev.
|
|
3
|
+
"version": "4.10.0-dev.34",
|
|
4
4
|
"description": "ECSchema editing and validation API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/cjs/ecschema-editing.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@bentley/units-schema": "^1.0.8",
|
|
26
|
-
"@itwin/eslint-plugin": "
|
|
26
|
+
"@itwin/eslint-plugin": "5.0.0-dev.1",
|
|
27
27
|
"@types/benchmark": "^2.1.0",
|
|
28
28
|
"@types/chai": "4.3.1",
|
|
29
29
|
"@types/chai-as-promised": "^7",
|
|
@@ -35,22 +35,22 @@
|
|
|
35
35
|
"chai": "^4.3.10",
|
|
36
36
|
"chai-as-promised": "^7.1.1",
|
|
37
37
|
"cpx2": "^3.0.0",
|
|
38
|
-
"eslint": "^
|
|
38
|
+
"eslint": "^9.13.0",
|
|
39
39
|
"mocha": "^10.2.0",
|
|
40
40
|
"nyc": "^15.1.0",
|
|
41
41
|
"rimraf": "^3.0.2",
|
|
42
42
|
"sinon": "^17.0.2",
|
|
43
43
|
"typescript": "~5.6.2",
|
|
44
|
-
"@itwin/build-tools": "4.10.0-dev.
|
|
45
|
-
"@itwin/core-bentley": "4.10.0-dev.
|
|
46
|
-
"@itwin/core-
|
|
47
|
-
"@itwin/core-
|
|
48
|
-
"@itwin/ecschema-metadata": "4.10.0-dev.
|
|
44
|
+
"@itwin/build-tools": "4.10.0-dev.34",
|
|
45
|
+
"@itwin/core-bentley": "4.10.0-dev.34",
|
|
46
|
+
"@itwin/core-quantity": "4.10.0-dev.34",
|
|
47
|
+
"@itwin/core-common": "4.10.0-dev.34",
|
|
48
|
+
"@itwin/ecschema-metadata": "4.10.0-dev.34"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@itwin/core-bentley": "^4.10.0-dev.
|
|
52
|
-
"@itwin/core-quantity": "^4.10.0-dev.
|
|
53
|
-
"@itwin/ecschema-metadata": "^4.10.0-dev.
|
|
51
|
+
"@itwin/core-bentley": "^4.10.0-dev.34",
|
|
52
|
+
"@itwin/core-quantity": "^4.10.0-dev.34",
|
|
53
|
+
"@itwin/ecschema-metadata": "^4.10.0-dev.34"
|
|
54
54
|
},
|
|
55
55
|
"nyc": {
|
|
56
56
|
"extends": "./node_modules/@itwin/build-tools/.nycrc"
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"clean": "rimraf lib .rush/temp/package-deps*.json",
|
|
62
62
|
"copy:test-assets": "cpx \"./src/test/assets/**/*\" ./lib/cjs/test/assets",
|
|
63
63
|
"extract-api": "betools extract-api --entry=ecschema-editing",
|
|
64
|
-
"lint": "eslint
|
|
64
|
+
"lint": "eslint \"./src/**/*.ts\" 1>&2",
|
|
65
65
|
"test": "mocha",
|
|
66
66
|
"docs": "betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/ecschema-editing/file.json --tsIndexFile=./ecschema-editing.ts --onlyJson",
|
|
67
67
|
"cover": "nyc npm -s test",
|