@itwin/ecschema-editing 5.0.0-dev.99 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -1
- package/lib/cjs/Differencing/SchemaDifferenceValidator.js +1 -1
- package/lib/cjs/Differencing/SchemaDifferenceValidator.js.map +1 -1
- package/lib/cjs/Editing/Editor.d.ts.map +1 -1
- package/lib/cjs/Editing/Editor.js +1 -1
- package/lib/cjs/Editing/Editor.js.map +1 -1
- package/lib/cjs/Editing/Formats.d.ts.map +1 -1
- package/lib/cjs/Editing/Formats.js +7 -2
- package/lib/cjs/Editing/Formats.js.map +1 -1
- package/lib/cjs/Editing/KindOfQuantities.d.ts +2 -2
- package/lib/cjs/Editing/KindOfQuantities.d.ts.map +1 -1
- package/lib/cjs/Editing/KindOfQuantities.js +3 -3
- package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableFormat.d.ts +3 -3
- package/lib/cjs/Editing/Mutable/MutableFormat.d.ts.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.d.ts +4 -4
- package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.d.ts.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableRelationshipClass.d.ts +7 -7
- package/lib/cjs/Editing/Mutable/MutableRelationshipClass.d.ts.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
- package/lib/cjs/Editing/Properties.js +6 -6
- package/lib/cjs/Editing/Properties.js.map +1 -1
- package/lib/cjs/Editing/RelationshipClasses.js +12 -12
- package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
- package/lib/cjs/Editing/SchemaItems.d.ts +1 -1
- package/lib/cjs/Editing/SchemaItems.d.ts.map +1 -1
- package/lib/cjs/Editing/SchemaItems.js +3 -3
- package/lib/cjs/Editing/SchemaItems.js.map +1 -1
- package/lib/cjs/Merging/ConstantMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/ConstantMerger.js +3 -3
- package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
- package/lib/cjs/Merging/FormatMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/FormatMerger.js +6 -4
- package/lib/cjs/Merging/FormatMerger.js.map +1 -1
- package/lib/cjs/Merging/KindOfQuantityMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/KindOfQuantityMerger.js +4 -1
- package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
- package/lib/cjs/Merging/PhenomenonMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/PhenomenonMerger.js +1 -1
- package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
- package/lib/cjs/Merging/RelationshipClassMerger.js +1 -1
- package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
- package/lib/cjs/Merging/Utils.d.ts.map +1 -1
- package/lib/cjs/Merging/Utils.js +1 -1
- package/lib/cjs/Merging/Utils.js.map +1 -1
- package/lib/cjs/Validation/ECRules.js +4 -4
- package/lib/cjs/Validation/ECRules.js.map +1 -1
- package/lib/cjs/Validation/SchemaChanges.js +2 -2
- package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
- package/lib/cjs/Validation/SchemaComparer.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaComparer.js +19 -8
- package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
- package/lib/esm/Differencing/SchemaDifferenceValidator.js +1 -1
- package/lib/esm/Differencing/SchemaDifferenceValidator.js.map +1 -1
- package/lib/esm/Editing/Editor.d.ts.map +1 -1
- package/lib/esm/Editing/Editor.js +2 -2
- package/lib/esm/Editing/Editor.js.map +1 -1
- package/lib/esm/Editing/Formats.d.ts.map +1 -1
- package/lib/esm/Editing/Formats.js +8 -3
- package/lib/esm/Editing/Formats.js.map +1 -1
- package/lib/esm/Editing/KindOfQuantities.d.ts +2 -2
- package/lib/esm/Editing/KindOfQuantities.d.ts.map +1 -1
- package/lib/esm/Editing/KindOfQuantities.js +3 -3
- package/lib/esm/Editing/KindOfQuantities.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableFormat.d.ts +3 -3
- package/lib/esm/Editing/Mutable/MutableFormat.d.ts.map +1 -1
- package/lib/esm/Editing/Mutable/MutableFormat.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableKindOfQuantity.d.ts +4 -4
- package/lib/esm/Editing/Mutable/MutableKindOfQuantity.d.ts.map +1 -1
- package/lib/esm/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
- package/lib/esm/Editing/Mutable/MutableRelationshipClass.d.ts +7 -7
- package/lib/esm/Editing/Mutable/MutableRelationshipClass.d.ts.map +1 -1
- package/lib/esm/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
- package/lib/esm/Editing/Properties.js +6 -6
- package/lib/esm/Editing/Properties.js.map +1 -1
- package/lib/esm/Editing/RelationshipClasses.js +12 -12
- package/lib/esm/Editing/RelationshipClasses.js.map +1 -1
- package/lib/esm/Editing/SchemaItems.d.ts +1 -1
- package/lib/esm/Editing/SchemaItems.d.ts.map +1 -1
- package/lib/esm/Editing/SchemaItems.js +4 -4
- package/lib/esm/Editing/SchemaItems.js.map +1 -1
- package/lib/esm/Merging/ConstantMerger.d.ts.map +1 -1
- package/lib/esm/Merging/ConstantMerger.js +4 -4
- package/lib/esm/Merging/ConstantMerger.js.map +1 -1
- package/lib/esm/Merging/FormatMerger.d.ts.map +1 -1
- package/lib/esm/Merging/FormatMerger.js +7 -5
- package/lib/esm/Merging/FormatMerger.js.map +1 -1
- package/lib/esm/Merging/KindOfQuantityMerger.d.ts.map +1 -1
- package/lib/esm/Merging/KindOfQuantityMerger.js +5 -2
- package/lib/esm/Merging/KindOfQuantityMerger.js.map +1 -1
- package/lib/esm/Merging/PhenomenonMerger.d.ts.map +1 -1
- package/lib/esm/Merging/PhenomenonMerger.js +2 -2
- package/lib/esm/Merging/PhenomenonMerger.js.map +1 -1
- package/lib/esm/Merging/RelationshipClassMerger.js +1 -1
- package/lib/esm/Merging/RelationshipClassMerger.js.map +1 -1
- package/lib/esm/Merging/Utils.d.ts.map +1 -1
- package/lib/esm/Merging/Utils.js +2 -2
- package/lib/esm/Merging/Utils.js.map +1 -1
- package/lib/esm/Validation/ECRules.js +4 -4
- package/lib/esm/Validation/ECRules.js.map +1 -1
- package/lib/esm/Validation/SchemaChanges.js +3 -3
- package/lib/esm/Validation/SchemaChanges.js.map +1 -1
- package/lib/esm/Validation/SchemaComparer.d.ts.map +1 -1
- package/lib/esm/Validation/SchemaComparer.js +19 -8
- package/lib/esm/Validation/SchemaComparer.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
# Change Log - @itwin/ecschema-editing
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 17 Jun 2025 18:33:52 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.0.1
|
|
6
|
+
Tue, 17 Jun 2025 18:33:52 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 5.0.0
|
|
11
|
+
Fri, 13 Jun 2025 20:25:38 GMT
|
|
12
|
+
|
|
13
|
+
### Updates
|
|
14
|
+
|
|
15
|
+
- Replaced ECClass.baseClass setter with setBaseClass method due to underlying changes in the ecschema-metadata package.
|
|
16
|
+
- Changed Class.getProperty method to include inherited properties by default. This affected numerous call in the editing package.
|
|
17
|
+
- Upgrade compile target to ES2023 and module to ES2022
|
|
18
|
+
- Dropped support for Node 18
|
|
19
|
+
- Added ESM support
|
|
20
|
+
- Updated getSchemaItem methods from MergingSchemaContext to reflect changes made to methods from the base class SchemaContext.
|
|
21
|
+
- Added format merging
|
|
22
|
+
- Allows to re-apply stored conflict resolutions
|
|
23
|
+
- Added ability to merge Unit and InvertedUnit Schema Items
|
|
24
|
+
- applied changes in ecschema-metadatas SchemaLocater interface
|
|
25
|
+
- Change core peer dependencies to strict version.
|
|
26
|
+
|
|
27
|
+
## 4.11.6
|
|
28
|
+
Mon, 16 Jun 2025 15:00:15 GMT
|
|
29
|
+
|
|
30
|
+
_Version update only_
|
|
31
|
+
|
|
32
|
+
## 4.11.5
|
|
33
|
+
Fri, 06 Jun 2025 13:41:18 GMT
|
|
34
|
+
|
|
35
|
+
_Version update only_
|
|
36
|
+
|
|
37
|
+
## 4.11.4
|
|
38
|
+
Tue, 03 Jun 2025 16:15:19 GMT
|
|
39
|
+
|
|
40
|
+
_Version update only_
|
|
41
|
+
|
|
42
|
+
## 4.11.3
|
|
43
|
+
Wed, 28 May 2025 13:56:23 GMT
|
|
44
|
+
|
|
45
|
+
_Version update only_
|
|
46
|
+
|
|
47
|
+
## 4.11.2
|
|
48
|
+
Tue, 20 May 2025 20:14:46 GMT
|
|
49
|
+
|
|
50
|
+
_Version update only_
|
|
51
|
+
|
|
52
|
+
## 4.11.1
|
|
53
|
+
Wed, 30 Apr 2025 13:13:21 GMT
|
|
54
|
+
|
|
55
|
+
_Version update only_
|
|
56
|
+
|
|
57
|
+
## 4.11.0
|
|
58
|
+
Wed, 16 Apr 2025 15:50:28 GMT
|
|
59
|
+
|
|
60
|
+
_Version update only_
|
|
61
|
+
|
|
62
|
+
## 4.10.13
|
|
63
|
+
Thu, 10 Apr 2025 17:47:21 GMT
|
|
64
|
+
|
|
65
|
+
_Version update only_
|
|
4
66
|
|
|
5
67
|
## 4.10.12
|
|
6
68
|
Wed, 02 Apr 2025 19:35:47 GMT
|
|
@@ -441,7 +441,7 @@ class SchemaDifferenceValidationVisitor {
|
|
|
441
441
|
});
|
|
442
442
|
}
|
|
443
443
|
;
|
|
444
|
-
const targetUnit = targetFormat.units[0][0];
|
|
444
|
+
const targetUnit = await targetFormat.units[0][0];
|
|
445
445
|
const targetPhenomenon = ecschema_metadata_1.InvertedUnit.isInvertedUnit(targetUnit)
|
|
446
446
|
? (await targetUnit.invertsUnit)?.phenomenon
|
|
447
447
|
: targetUnit.phenomenon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaDifferenceValidator.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifferenceValidator.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAiBH,kDAOC;AAtBD,gEAA6T;AAE7T,uDAA8E;AAC9E,uEAA4F;AAC5F,8DAAwE;AAExE;;;;;;;;GAQG;AACI,KAAK,UAAU,mBAAmB,CAAC,WAAkC,EAAE,YAAoB,EAAE,YAAoB,EAAE,YAAyB;IACjJ,MAAM,OAAO,GAAG,IAAI,iCAAiC,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IAChG,MAAM,MAAM,GAAG,IAAI,gDAAsB,CAAC,OAAO,CAAC,CAAC;IAEnD,MAAM,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAEnC,OAAO,OAAO,CAAC,SAAS,CAAC;AAC3B,CAAC;AAED;;;GAGG;AACH,MAAM,iCAAiC;IAErB,SAAS,CAAqC;IAC7C,aAAa,CAAS;IACtB,aAAa,CAAS;IACtB,aAAa,CAAc;IAE5C,6EAA6E;IAC7E,YAAY,YAAoB,EAAE,YAAoB,EAAE,YAAyB;QAC/E,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACpC,CAAC;IAEO,WAAW,CAAC,QAAqC;QACvD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAEO,KAAK,CAAC,mBAAmB,CAAC,IAAY;QAC5C,MAAM,OAAO,GAAG,IAAI,iCAAa,CAAC,IAAI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M,EAAE,CAAC;IACpE,OAAO,IAAA,wCAAoB,EAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Differencing\n */\n\nimport { classModifierToString, ECClass, ECClassModifier, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, LazyLoadedSchemaItem, Mixin, parseClassModifier, primitiveTypeToString, Property, propertyTypeToString, Schema, SchemaItem, SchemaItemKey, SchemaMatchType, Unit } from \"@itwin/ecschema-metadata\";\nimport { AnyClassItemDifference, AnySchemaDifference, AnySchemaItemDifference, ClassPropertyDifference, ConstantDifference, CustomAttributeClassDifference, CustomAttributeDifference, EntityClassDifference, EntityClassMixinDifference, EnumerationDifference, EnumeratorDifference, FormatDifference, FormatUnitDifference, FormatUnitLabelDifference, InvertedUnitDifference, KindOfQuantityDifference, KindOfQuantityPresentationFormatDifference, MixinClassDifference, PhenomenonDifference, PropertyCategoryDifference, RelationshipClassDifference, RelationshipConstraintClassDifference, RelationshipConstraintDifference, SchemaDifference, SchemaReferenceDifference, StructClassDifference, UnitDifference, UnitSystemDifference } from \"./SchemaDifference\";\nimport { AnySchemaDifferenceConflict, ConflictCode } from \"./SchemaConflicts\";\nimport { SchemaDifferenceVisitor, SchemaDifferenceWalker } from \"./SchemaDifferenceVisitor\";\nimport { NameMapping, PropertyKey } from \"../Merging/Edits/NameMapping\";\n\n/**\n * Validates the given array of schema differences and returns a list of conflicts if the\n * validation finds violation against rules.\n * @param differences An array of schema differences.\n * @param targetSchema The target schema reference.\n * @param sourceSchema The source schema reference.\n * @returns An array of conflicts found when validating the difference.\n * @internal\n */\nexport async function validateDifferences(differences: AnySchemaDifference[], targetSchema: Schema, sourceSchema: Schema, nameMappings: NameMapping) {\n const visitor = new SchemaDifferenceValidationVisitor(targetSchema, sourceSchema, nameMappings);\n const walker = new SchemaDifferenceWalker(visitor);\n\n await walker.traverse(differences);\n\n return visitor.conflicts;\n}\n\n/**\n * The SchemaDifferenceValidationVisitor class is an implementation of ISchemaDifferenceVisitor and\n * validates the given SchemaDifferences if the violate against some EC Rules.\n */\nclass SchemaDifferenceValidationVisitor implements SchemaDifferenceVisitor {\n\n public readonly conflicts: Array<AnySchemaDifferenceConflict>;\n private readonly _sourceSchema: Schema;\n private readonly _targetSchema: Schema;\n private readonly _nameMappings: NameMapping;\n\n /** Initializes a new instance of SchemaDifferenceValidationVisitor class. */\n constructor(targetSchema: Schema, sourceSchema: Schema, nameMappings: NameMapping) {\n this.conflicts = [];\n this._targetSchema = targetSchema;\n this._sourceSchema = sourceSchema;\n this._nameMappings = nameMappings;\n }\n\n private addConflict(conflict: AnySchemaDifferenceConflict) {\n this.conflicts.push(conflict);\n }\n\n private async getTargetSchemaItem(name: string): Promise<SchemaItem | undefined> {\n const itemKey = new SchemaItemKey(name, this._sourceSchema.schemaKey);\n const mappedKey = this._nameMappings.resolveItemKey(itemKey);\n return this._targetSchema.getItem(mappedKey.name);\n }\n\n private getTargetProperty(itemName: string, propertyName: string): PropertyKey {\n const classKey = new SchemaItemKey(itemName, this._sourceSchema.schemaKey);\n const propertyKey = new PropertyKey(propertyName, classKey);\n return this._nameMappings.resolvePropertyKey(propertyKey);\n }\n\n /**\n * Visitor implementation for handling SchemaDifference.\n * @internal\n */\n public async visitSchemaDifference(_entry: SchemaDifference) {\n }\n\n /**\n * Visitor implementation for handling SchemaReferenceDifference.\n * @internal\n */\n public async visitSchemaReferenceDifference(entry: SchemaReferenceDifference) {\n const sourceSchemaReference = await this._sourceSchema.getReference(entry.difference.name) as Schema;\n const targetSchemaReferenceName = this._targetSchema.getReferenceNameByAlias(sourceSchemaReference.alias);\n if (targetSchemaReferenceName && targetSchemaReferenceName !== sourceSchemaReference.name) {\n this.addConflict({\n code: ConflictCode.ConflictingReferenceAlias,\n difference: entry,\n source: entry.difference.name,\n target: targetSchemaReferenceName,\n description: \"Target schema already references a different schema with this alias.\",\n });\n }\n\n const sourceSchemaKey = sourceSchemaReference.schemaKey;\n const targetSchemaKey = await this._targetSchema.getReference(entry.difference.name)\n .then((schema) => schema?.schemaKey);\n\n if(entry.changeType === \"modify\" && targetSchemaKey && !sourceSchemaKey.matches(targetSchemaKey, SchemaMatchType.LatestWriteCompatible)) {\n return this.addConflict({\n code: ConflictCode.ConflictingReferenceVersion,\n difference: entry,\n description: \"Schema reference cannot be updated, incompatible versions\",\n source: sourceSchemaKey.toString(),\n target: targetSchemaKey.toString(),\n });\n }\n }\n\n /**\n * Shared schema item validation for all types of AnySchemaItemDifference union.\n */\n private async visitSchemaItemDifference(entry: AnySchemaItemDifference, targetSchemaItem: SchemaItem | undefined) {\n // If the item shall be added, but the target schema already has an item with this name,\n // will produce an ConflictingItemName conflict.\n if (entry.changeType === \"add\" && targetSchemaItem !== undefined) {\n this.addConflict({\n code: ConflictCode.ConflictingItemName,\n difference: entry,\n source: entry.schemaType,\n target: targetSchemaItem.schemaItemType,\n description: \"Target schema already contains a schema item with the name but different type.\",\n });\n return false;\n }\n\n return true;\n }\n\n /**\n * Shared base-class validation for all types of ClassItemDifference union.\n */\n private async visitBaseClassDifference(entry: AnyClassItemDifference, targetClassItem: ECClass) {\n if (\"baseClass\" in entry.difference && entry.difference.baseClass === undefined && targetClassItem.baseClass !== undefined) {\n return this.addConflict({\n code: ConflictCode.RemovingBaseClass,\n difference: entry,\n source: null,\n target: resolveLazyItemFullName(targetClassItem.baseClass),\n description: \"BaseClass cannot be removed, if there has been a baseClass before.\",\n });\n }\n\n if (entry.difference.baseClass === undefined) {\n return;\n }\n\n const sourceBaseClass = await this._sourceSchema.lookupItem(entry.difference.baseClass) as ECClass;\n if (sourceBaseClass.modifier === ECClassModifier.Sealed) {\n return this.addConflict({\n code: ConflictCode.SealedBaseClass,\n difference: entry,\n source: sourceBaseClass.fullName,\n target: resolveLazyItemFullName(targetClassItem.baseClass) || null,\n description: \"BaseClass is sealed.\",\n });\n }\n\n if (targetClassItem.baseClass && !await this.derivedFrom(sourceBaseClass, targetClassItem.baseClass)) {\n return this.addConflict({\n code: ConflictCode.ConflictingBaseClass,\n difference: entry,\n source: sourceBaseClass.fullName,\n target: resolveLazyItemFullName(targetClassItem.baseClass),\n description: \"BaseClass is not valid, source class must derive from target.\",\n });\n }\n }\n\n /**\n * Shared validation for all types of ClassItemDifference union.\n */\n private async visitClassDifference(entry: AnyClassItemDifference) {\n const targetClassItem = await this.getTargetSchemaItem(entry.itemName);\n if (!await this.visitSchemaItemDifference(entry, targetClassItem)) {\n return;\n }\n\n if (entry.changeType === \"modify\" && ECClass.isECClass(targetClassItem)) {\n await this.visitClassModifierDifference(entry, targetClassItem);\n await this.visitBaseClassDifference(entry, targetClassItem);\n }\n }\n\n /**\n * Validation the modifiers of all types of ClassItemDifference union.\n */\n private async visitClassModifierDifference(entry: AnyClassItemDifference, targetClass: ECClass) {\n if (entry.difference.modifier) {\n const changedModifier = parseClassModifier(entry.difference.modifier);\n if (changedModifier !== undefined && changedModifier !== ECClassModifier.None) {\n this.addConflict({\n code: ConflictCode.ConflictingClassModifier,\n difference: entry,\n source: entry.difference.modifier,\n target: classModifierToString(targetClass.modifier),\n description: \"Class has conflicting modifiers.\",\n });\n }\n }\n }\n\n /**\n * Visitor implementation for handling ConstantDifference.\n * @internal\n */\n public async visitConstantDifference(entry: ConstantDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling CustomAttributeClassDifference.\n * @internal\n */\n public async visitCustomAttributeClassDifference(entry: CustomAttributeClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling CustomAttributeDifference.\n * @internal\n */\n public async visitCustomAttributeInstanceDifference(_entry: CustomAttributeDifference) {\n }\n\n /**\n * Visitor implementation for handling EntityClassDifference.\n * @internal\n */\n public async visitEntityClassDifference(entry: EntityClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling EntityClassMixinDifference.\n * @internal\n */\n public async visitEntityClassMixinDifference(entry: EntityClassMixinDifference) {\n for (const addedMixin of entry.difference) {\n // To validate the added mixins, the instance from the source schema it fetched,\n // otherwise validation gets too complicated as the mixin must not be existing in\n // the current target schema, it could also be added to the schema.\n const sourceMixin = await this._sourceSchema.lookupItem(addedMixin) as Mixin;\n const sourceSchemaItem = await this._sourceSchema.getItem(entry.itemName) as EntityClass;\n if (sourceMixin.appliesTo && !await sourceSchemaItem.is(await sourceMixin.appliesTo)) {\n this.addConflict({\n code: ConflictCode.MixinAppliedMustDeriveFromConstraint,\n difference: entry,\n source: addedMixin,\n target: undefined,\n description: \"Mixin cannot applied to this class.\",\n });\n }\n }\n }\n\n /**\n * Visitor implementation for handling EnumerationDifference.\n * @internal\n */\n public async visitEnumerationDifference(entry: EnumerationDifference) {\n const enumeration = await this.getTargetSchemaItem(entry.itemName);\n if (!await this.visitSchemaItemDifference(entry, enumeration)) {\n return;\n }\n\n if (entry.changeType === \"modify\" && Enumeration.isEnumeration(enumeration) && enumeration.type !== undefined) {\n if (entry.difference.type) {\n this.addConflict({\n code: ConflictCode.ConflictingEnumerationType,\n difference: entry,\n source: entry.difference.type,\n target: primitiveTypeToString(enumeration.type),\n description: \"Enumeration has a different primitive type.\",\n });\n }\n }\n }\n\n /**\n * Visitor implementation for handling EnumeratorDifference.\n * @internal\n */\n public async visitEnumeratorDifference(entry: EnumeratorDifference) {\n if (entry.changeType !== \"modify\") {\n return;\n }\n\n const enumeration = await this.getTargetSchemaItem(entry.itemName) as Enumeration;\n const enumerator = enumeration.getEnumeratorByName(entry.path);\n if (!enumerator) {\n return;\n }\n\n if (entry.difference.value) {\n this.addConflict({\n code: ConflictCode.ConflictingEnumeratorValue,\n difference: entry,\n source: entry.difference.value,\n target: enumerator.value,\n description: \"Enumerators must have unique values.\",\n });\n }\n }\n\n /**\n * Visitor implementation for handling FormatDifference.\n * @internal\n */\n public async visitFormatDifference(entry: FormatDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling InvertedUnitDifference.\n * @internal\n */\n public async visitInvertedUnitDifference(entry: InvertedUnitDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling KindOfQuantityDifference.\n * @internal\n */\n public async visitKindOfQuantityDifference(entry: KindOfQuantityDifference) {\n const kindOfQuantity = await this.getTargetSchemaItem(entry.itemName);\n if (!await this.visitSchemaItemDifference(entry, kindOfQuantity)) {\n return;\n }\n\n if (entry.changeType === \"modify\" && KindOfQuantity.isKindOfQuantity(kindOfQuantity)) {\n if (entry.difference.persistenceUnit) {\n this.addConflict({\n code: ConflictCode.ConflictingPersistenceUnit,\n difference: entry,\n source: entry.difference.persistenceUnit,\n target: resolveLazyItemFullName(kindOfQuantity.persistenceUnit),\n description: \"Kind of Quantity has a different persistence unit.\",\n });\n }\n }\n }\n\n /**\n * Visitor implementation for handling MixinClassDifference.\n * @internal\n */\n public async visitMixinDifference(entry: MixinClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling PhenomenonDifference.\n * @internal\n */\n public async visitPhenomenonDifference(entry: PhenomenonDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling ClassPropertyDifference.\n * @internal\n */\n public async visitPropertyDifference(entry: ClassPropertyDifference) {\n const targetClass = await this.getTargetSchemaItem(entry.itemName) as ECClass;\n const propertyKey = this.getTargetProperty(entry.itemName, entry.path);\n const targetProperty = await targetClass.getProperty(propertyKey.propertyName);\n\n const sourceClass = await this._sourceSchema.getItem(entry.itemName) as ECClass;\n const sourceProperty = await sourceClass.getProperty(entry.path) as Property;\n\n // If property shall be added but there is already a property with this name\n // in target, a ConflictingPropertyName is issued.\n if (entry.changeType === \"add\" && targetProperty !== undefined) {\n return this.addConflict({\n code: ConflictCode.ConflictingPropertyName,\n difference: entry,\n source: resolvePropertyTypeName(sourceProperty),\n target: resolvePropertyTypeName(targetProperty),\n description: \"Target class already contains a property with a different type.\",\n });\n }\n\n if (entry.changeType === \"modify\" && targetProperty !== undefined) {\n if (\"kindOfQuantity\" in entry.difference) {\n const sourceKoQ = await sourceProperty.kindOfQuantity;\n const targetKoQ = await targetProperty.kindOfQuantity;\n if(!targetKoQ) {\n return this.addConflict({\n code: ConflictCode.ConflictingPropertyKindOfQuantity,\n difference: entry,\n source: entry.difference.kindOfQuantity,\n target: null,\n description: \"The kind of quantity cannot be assiged if the property did not have a kind of quantities before.\",\n });\n }\n\n if(!sourceKoQ) {\n return this.addConflict({\n code: ConflictCode.ConflictingPropertyKindOfQuantity,\n difference: entry,\n source: null,\n target: resolveLazyItemFullName(targetProperty.kindOfQuantity),\n description: \"The kind of quantity cannot be undefined if the property had a kind of quantities before.\",\n });\n }\n\n if (resolveLazyItemName(sourceKoQ.persistenceUnit) !== resolveLazyItemName(targetKoQ.persistenceUnit)) {\n this.addConflict({\n code: ConflictCode.ConflictingPropertyKindOfQuantityUnit,\n difference: entry,\n source: entry.difference.kindOfQuantity,\n target: resolveLazyItemFullName(targetProperty.kindOfQuantity),\n description: \"The property has different kind of quantities with conflicting units.\",\n });\n }\n }\n }\n }\n\n /**\n * Visitor implementation for handling PropertyCategoryDifference.\n * @internal\n */\n public async visitPropertyCategoryDifference(entry: PropertyCategoryDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling RelationshipClassDifference.\n * @internal\n */\n public async visitRelationshipClassDifference(entry: RelationshipClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling RelationshipConstraintDifference.\n * @internal\n */\n public async visitRelationshipConstraintDifference(_entry: RelationshipConstraintDifference) {\n }\n\n /**\n * Visitor implementation for handling RelationshipConstraintClassDifference.\n * @internal\n */\n public async visitRelationshipConstraintClassDifference(_entry: RelationshipConstraintClassDifference) {\n }\n\n /**\n * Visitor implementation for handling StructClassDifference.\n * @internal\n */\n public async visitStructClassDifference(entry: StructClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling UnitDifference.\n * @internal\n */\n public async visitUnitDifference(entry: UnitDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling UnitSystemDifference.\n * @internal\n */\n public async visitUnitSystemDifference(entry: UnitSystemDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling KindOfQuantityPresentationFormatDifference.\n * @internal\n */\n public async visitKindOfQuantityPresentationFormatDifference(_entry: KindOfQuantityPresentationFormatDifference) {\n }\n\n /**\n * Visitor implementation for handling FormatUnitDifference.\n * @internal\n */\n public async visitFormatUnitDifference(entry: FormatUnitDifference) {\n const targetFormat = await this.getTargetSchemaItem(entry.itemName) as Format;\n\n if (targetFormat.units === undefined) {\n return this.addConflict({\n code: ConflictCode.ConflictingFormatUnit,\n difference: entry,\n source: entry.difference[0].name,\n target: null,\n description: \"The unit cannot be assiged if the format did not have a unit before.\",\n });\n };\n\n const targetUnit = targetFormat.units[0][0];\n const targetPhenomenon = InvertedUnit.isInvertedUnit(targetUnit)\n ? (await targetUnit.invertsUnit)?.phenomenon\n : targetUnit.phenomenon;\n\n const sourceUnit = await this._sourceSchema.lookupItem(entry.difference[0].name) as Unit | InvertedUnit;\n const sourcePhenomenon = InvertedUnit.isInvertedUnit(sourceUnit)\n ? (await sourceUnit.invertsUnit)?.phenomenon\n : sourceUnit.phenomenon;\n\n if (resolveLazyItemName(targetPhenomenon) !== resolveLazyItemName(sourcePhenomenon)) {\n return this.addConflict({\n code: ConflictCode.ConflictingFormatUnitPhenomenon,\n difference: entry,\n source: entry.difference[0].name,\n target: targetUnit.fullName,\n description: \"Format units has a different phenomenon.\",\n });\n };\n };\n\n /**\n * Visitor implementation for handling FormatUnitLabelDifference.\n * @internal\n */\n public async visitFormatUnitLabelDifference(_entry: FormatUnitLabelDifference) {\n }\n\n /**\n * Recursive synchronous function to figure whether a given class derived from\n * a class with the given baseClass name.\n */\n private async derivedFrom(ecClass: ECClass | undefined, baseClassKey: Readonly<SchemaItemKey>): Promise<boolean> {\n if (ecClass === undefined) {\n return false;\n }\n\n // First check for name which must be same in any case...\n if (ecClass.name === baseClassKey.name) {\n // ... then check if the class is in the same schema as the expected base class...\n if(ecClass.schema.name === baseClassKey.schemaName)\n return true;\n // ... if not, whether it's in the source schema, but then we expect the baseclass\n // to be in the target schema.\n if(ecClass.schema.name === this._sourceSchema.name && baseClassKey.schemaName === this._targetSchema.name)\n return true;\n }\n return this.derivedFrom(await ecClass.baseClass, baseClassKey);\n }\n}\n\n/**\n * Helper method to resolve the schema item name from lazy loaded schema items.\n * @param lazyItem LazyLoaded item\n * @returns The full name of the item or undefined item was not set.\n */\nfunction resolveLazyItemFullName(lazyItem?: LazyLoadedSchemaItem<SchemaItem>) {\n return lazyItem && lazyItem.fullName;\n}\n\n/**\n * Helper method to resolve the schema item name from lazy loaded schema items.\n * @param lazyItem LazyLoaded item\n * @returns The full name of the item or undefined item was not set.\n */\nfunction resolveLazyItemName(lazyItem?: LazyLoadedSchemaItem<SchemaItem>) {\n return lazyItem && lazyItem.name;\n}\n\n/**\n * Helper method to resolve the type name of a property.\n * @param property The property which's type shall be resolved.\n * @returns The (full) name of the properties type.\n */\nfunction resolvePropertyTypeName(property: Property) {\n const [prefix, suffix] = property.isArray() ? [\"[\", \"]\"] : [\"\", \"\"];\n if (property.isEnumeration())\n return `${prefix}${resolveLazyItemFullName(property.enumeration)}${suffix}`;\n if (property.isPrimitive())\n return `${prefix}${primitiveTypeToString(property.primitiveType)}${suffix}`;\n if (property.isStruct())\n return `${prefix}${property.structClass.fullName}${suffix}`;\n if (property.isNavigation())\n return `${prefix}${property.relationshipClass.fullName}${suffix}`;\n return propertyTypeToString(property.propertyType);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaDifferenceValidator.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifferenceValidator.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAiBH,kDAOC;AAtBD,gEAA6T;AAE7T,uDAA8E;AAC9E,uEAA4F;AAC5F,8DAAwE;AAExE;;;;;;;;GAQG;AACI,KAAK,UAAU,mBAAmB,CAAC,WAAkC,EAAE,YAAoB,EAAE,YAAoB,EAAE,YAAyB;IACjJ,MAAM,OAAO,GAAG,IAAI,iCAAiC,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IAChG,MAAM,MAAM,GAAG,IAAI,gDAAsB,CAAC,OAAO,CAAC,CAAC;IAEnD,MAAM,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAEnC,OAAO,OAAO,CAAC,SAAS,CAAC;AAC3B,CAAC;AAED;;;GAGG;AACH,MAAM,iCAAiC;IAErB,SAAS,CAAqC;IAC7C,aAAa,CAAS;IACtB,aAAa,CAAS;IACtB,aAAa,CAAc;IAE5C,6EAA6E;IAC7E,YAAY,YAAoB,EAAE,YAAoB,EAAE,YAAyB;QAC/E,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACpC,CAAC;IAEO,WAAW,CAAC,QAAqC;QACvD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAEO,KAAK,CAAC,mBAAmB,CAAC,IAAY;QAC5C,MAAM,OAAO,GAAG,IAAI,iCAAa,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QACtE,MA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,CAAC,YAAY,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Differencing\n */\n\nimport { classModifierToString, ECClass, ECClassModifier, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, LazyLoadedSchemaItem, Mixin, parseClassModifier, primitiveTypeToString, Property, propertyTypeToString, Schema, SchemaItem, SchemaItemKey, SchemaMatchType, Unit } from \"@itwin/ecschema-metadata\";\nimport { AnyClassItemDifference, AnySchemaDifference, AnySchemaItemDifference, ClassPropertyDifference, ConstantDifference, CustomAttributeClassDifference, CustomAttributeDifference, EntityClassDifference, EntityClassMixinDifference, EnumerationDifference, EnumeratorDifference, FormatDifference, FormatUnitDifference, FormatUnitLabelDifference, InvertedUnitDifference, KindOfQuantityDifference, KindOfQuantityPresentationFormatDifference, MixinClassDifference, PhenomenonDifference, PropertyCategoryDifference, RelationshipClassDifference, RelationshipConstraintClassDifference, RelationshipConstraintDifference, SchemaDifference, SchemaReferenceDifference, StructClassDifference, UnitDifference, UnitSystemDifference } from \"./SchemaDifference\";\nimport { AnySchemaDifferenceConflict, ConflictCode } from \"./SchemaConflicts\";\nimport { SchemaDifferenceVisitor, SchemaDifferenceWalker } from \"./SchemaDifferenceVisitor\";\nimport { NameMapping, PropertyKey } from \"../Merging/Edits/NameMapping\";\n\n/**\n * Validates the given array of schema differences and returns a list of conflicts if the\n * validation finds violation against rules.\n * @param differences An array of schema differences.\n * @param targetSchema The target schema reference.\n * @param sourceSchema The source schema reference.\n * @returns An array of conflicts found when validating the difference.\n * @internal\n */\nexport async function validateDifferences(differences: AnySchemaDifference[], targetSchema: Schema, sourceSchema: Schema, nameMappings: NameMapping) {\n const visitor = new SchemaDifferenceValidationVisitor(targetSchema, sourceSchema, nameMappings);\n const walker = new SchemaDifferenceWalker(visitor);\n\n await walker.traverse(differences);\n\n return visitor.conflicts;\n}\n\n/**\n * The SchemaDifferenceValidationVisitor class is an implementation of ISchemaDifferenceVisitor and\n * validates the given SchemaDifferences if the violate against some EC Rules.\n */\nclass SchemaDifferenceValidationVisitor implements SchemaDifferenceVisitor {\n\n public readonly conflicts: Array<AnySchemaDifferenceConflict>;\n private readonly _sourceSchema: Schema;\n private readonly _targetSchema: Schema;\n private readonly _nameMappings: NameMapping;\n\n /** Initializes a new instance of SchemaDifferenceValidationVisitor class. */\n constructor(targetSchema: Schema, sourceSchema: Schema, nameMappings: NameMapping) {\n this.conflicts = [];\n this._targetSchema = targetSchema;\n this._sourceSchema = sourceSchema;\n this._nameMappings = nameMappings;\n }\n\n private addConflict(conflict: AnySchemaDifferenceConflict) {\n this.conflicts.push(conflict);\n }\n\n private async getTargetSchemaItem(name: string): Promise<SchemaItem | undefined> {\n const itemKey = new SchemaItemKey(name, this._sourceSchema.schemaKey);\n const mappedKey = this._nameMappings.resolveItemKey(itemKey);\n return this._targetSchema.getItem(mappedKey.name);\n }\n\n private getTargetProperty(itemName: string, propertyName: string): PropertyKey {\n const classKey = new SchemaItemKey(itemName, this._sourceSchema.schemaKey);\n const propertyKey = new PropertyKey(propertyName, classKey);\n return this._nameMappings.resolvePropertyKey(propertyKey);\n }\n\n /**\n * Visitor implementation for handling SchemaDifference.\n * @internal\n */\n public async visitSchemaDifference(_entry: SchemaDifference) {\n }\n\n /**\n * Visitor implementation for handling SchemaReferenceDifference.\n * @internal\n */\n public async visitSchemaReferenceDifference(entry: SchemaReferenceDifference) {\n const sourceSchemaReference = await this._sourceSchema.getReference(entry.difference.name) as Schema;\n const targetSchemaReferenceName = this._targetSchema.getReferenceNameByAlias(sourceSchemaReference.alias);\n if (targetSchemaReferenceName && targetSchemaReferenceName !== sourceSchemaReference.name) {\n this.addConflict({\n code: ConflictCode.ConflictingReferenceAlias,\n difference: entry,\n source: entry.difference.name,\n target: targetSchemaReferenceName,\n description: \"Target schema already references a different schema with this alias.\",\n });\n }\n\n const sourceSchemaKey = sourceSchemaReference.schemaKey;\n const targetSchemaKey = await this._targetSchema.getReference(entry.difference.name)\n .then((schema) => schema?.schemaKey);\n\n if(entry.changeType === \"modify\" && targetSchemaKey && !sourceSchemaKey.matches(targetSchemaKey, SchemaMatchType.LatestWriteCompatible)) {\n return this.addConflict({\n code: ConflictCode.ConflictingReferenceVersion,\n difference: entry,\n description: \"Schema reference cannot be updated, incompatible versions\",\n source: sourceSchemaKey.toString(),\n target: targetSchemaKey.toString(),\n });\n }\n }\n\n /**\n * Shared schema item validation for all types of AnySchemaItemDifference union.\n */\n private async visitSchemaItemDifference(entry: AnySchemaItemDifference, targetSchemaItem: SchemaItem | undefined) {\n // If the item shall be added, but the target schema already has an item with this name,\n // will produce an ConflictingItemName conflict.\n if (entry.changeType === \"add\" && targetSchemaItem !== undefined) {\n this.addConflict({\n code: ConflictCode.ConflictingItemName,\n difference: entry,\n source: entry.schemaType,\n target: targetSchemaItem.schemaItemType,\n description: \"Target schema already contains a schema item with the name but different type.\",\n });\n return false;\n }\n\n return true;\n }\n\n /**\n * Shared base-class validation for all types of ClassItemDifference union.\n */\n private async visitBaseClassDifference(entry: AnyClassItemDifference, targetClassItem: ECClass) {\n if (\"baseClass\" in entry.difference && entry.difference.baseClass === undefined && targetClassItem.baseClass !== undefined) {\n return this.addConflict({\n code: ConflictCode.RemovingBaseClass,\n difference: entry,\n source: null,\n target: resolveLazyItemFullName(targetClassItem.baseClass),\n description: \"BaseClass cannot be removed, if there has been a baseClass before.\",\n });\n }\n\n if (entry.difference.baseClass === undefined) {\n return;\n }\n\n const sourceBaseClass = await this._sourceSchema.lookupItem(entry.difference.baseClass) as ECClass;\n if (sourceBaseClass.modifier === ECClassModifier.Sealed) {\n return this.addConflict({\n code: ConflictCode.SealedBaseClass,\n difference: entry,\n source: sourceBaseClass.fullName,\n target: resolveLazyItemFullName(targetClassItem.baseClass) || null,\n description: \"BaseClass is sealed.\",\n });\n }\n\n if (targetClassItem.baseClass && !await this.derivedFrom(sourceBaseClass, targetClassItem.baseClass)) {\n return this.addConflict({\n code: ConflictCode.ConflictingBaseClass,\n difference: entry,\n source: sourceBaseClass.fullName,\n target: resolveLazyItemFullName(targetClassItem.baseClass),\n description: \"BaseClass is not valid, source class must derive from target.\",\n });\n }\n }\n\n /**\n * Shared validation for all types of ClassItemDifference union.\n */\n private async visitClassDifference(entry: AnyClassItemDifference) {\n const targetClassItem = await this.getTargetSchemaItem(entry.itemName);\n if (!await this.visitSchemaItemDifference(entry, targetClassItem)) {\n return;\n }\n\n if (entry.changeType === \"modify\" && ECClass.isECClass(targetClassItem)) {\n await this.visitClassModifierDifference(entry, targetClassItem);\n await this.visitBaseClassDifference(entry, targetClassItem);\n }\n }\n\n /**\n * Validation the modifiers of all types of ClassItemDifference union.\n */\n private async visitClassModifierDifference(entry: AnyClassItemDifference, targetClass: ECClass) {\n if (entry.difference.modifier) {\n const changedModifier = parseClassModifier(entry.difference.modifier);\n if (changedModifier !== undefined && changedModifier !== ECClassModifier.None) {\n this.addConflict({\n code: ConflictCode.ConflictingClassModifier,\n difference: entry,\n source: entry.difference.modifier,\n target: classModifierToString(targetClass.modifier),\n description: \"Class has conflicting modifiers.\",\n });\n }\n }\n }\n\n /**\n * Visitor implementation for handling ConstantDifference.\n * @internal\n */\n public async visitConstantDifference(entry: ConstantDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling CustomAttributeClassDifference.\n * @internal\n */\n public async visitCustomAttributeClassDifference(entry: CustomAttributeClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling CustomAttributeDifference.\n * @internal\n */\n public async visitCustomAttributeInstanceDifference(_entry: CustomAttributeDifference) {\n }\n\n /**\n * Visitor implementation for handling EntityClassDifference.\n * @internal\n */\n public async visitEntityClassDifference(entry: EntityClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling EntityClassMixinDifference.\n * @internal\n */\n public async visitEntityClassMixinDifference(entry: EntityClassMixinDifference) {\n for (const addedMixin of entry.difference) {\n // To validate the added mixins, the instance from the source schema it fetched,\n // otherwise validation gets too complicated as the mixin must not be existing in\n // the current target schema, it could also be added to the schema.\n const sourceMixin = await this._sourceSchema.lookupItem(addedMixin) as Mixin;\n const sourceSchemaItem = await this._sourceSchema.getItem(entry.itemName) as EntityClass;\n if (sourceMixin.appliesTo && !await sourceSchemaItem.is(await sourceMixin.appliesTo)) {\n this.addConflict({\n code: ConflictCode.MixinAppliedMustDeriveFromConstraint,\n difference: entry,\n source: addedMixin,\n target: undefined,\n description: \"Mixin cannot applied to this class.\",\n });\n }\n }\n }\n\n /**\n * Visitor implementation for handling EnumerationDifference.\n * @internal\n */\n public async visitEnumerationDifference(entry: EnumerationDifference) {\n const enumeration = await this.getTargetSchemaItem(entry.itemName);\n if (!await this.visitSchemaItemDifference(entry, enumeration)) {\n return;\n }\n\n if (entry.changeType === \"modify\" && Enumeration.isEnumeration(enumeration) && enumeration.type !== undefined) {\n if (entry.difference.type) {\n this.addConflict({\n code: ConflictCode.ConflictingEnumerationType,\n difference: entry,\n source: entry.difference.type,\n target: primitiveTypeToString(enumeration.type),\n description: \"Enumeration has a different primitive type.\",\n });\n }\n }\n }\n\n /**\n * Visitor implementation for handling EnumeratorDifference.\n * @internal\n */\n public async visitEnumeratorDifference(entry: EnumeratorDifference) {\n if (entry.changeType !== \"modify\") {\n return;\n }\n\n const enumeration = await this.getTargetSchemaItem(entry.itemName) as Enumeration;\n const enumerator = enumeration.getEnumeratorByName(entry.path);\n if (!enumerator) {\n return;\n }\n\n if (entry.difference.value) {\n this.addConflict({\n code: ConflictCode.ConflictingEnumeratorValue,\n difference: entry,\n source: entry.difference.value,\n target: enumerator.value,\n description: \"Enumerators must have unique values.\",\n });\n }\n }\n\n /**\n * Visitor implementation for handling FormatDifference.\n * @internal\n */\n public async visitFormatDifference(entry: FormatDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling InvertedUnitDifference.\n * @internal\n */\n public async visitInvertedUnitDifference(entry: InvertedUnitDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling KindOfQuantityDifference.\n * @internal\n */\n public async visitKindOfQuantityDifference(entry: KindOfQuantityDifference) {\n const kindOfQuantity = await this.getTargetSchemaItem(entry.itemName);\n if (!await this.visitSchemaItemDifference(entry, kindOfQuantity)) {\n return;\n }\n\n if (entry.changeType === \"modify\" && KindOfQuantity.isKindOfQuantity(kindOfQuantity)) {\n if (entry.difference.persistenceUnit) {\n this.addConflict({\n code: ConflictCode.ConflictingPersistenceUnit,\n difference: entry,\n source: entry.difference.persistenceUnit,\n target: resolveLazyItemFullName(kindOfQuantity.persistenceUnit),\n description: \"Kind of Quantity has a different persistence unit.\",\n });\n }\n }\n }\n\n /**\n * Visitor implementation for handling MixinClassDifference.\n * @internal\n */\n public async visitMixinDifference(entry: MixinClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling PhenomenonDifference.\n * @internal\n */\n public async visitPhenomenonDifference(entry: PhenomenonDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling ClassPropertyDifference.\n * @internal\n */\n public async visitPropertyDifference(entry: ClassPropertyDifference) {\n const targetClass = await this.getTargetSchemaItem(entry.itemName) as ECClass;\n const propertyKey = this.getTargetProperty(entry.itemName, entry.path);\n const targetProperty = await targetClass.getProperty(propertyKey.propertyName);\n\n const sourceClass = await this._sourceSchema.getItem(entry.itemName) as ECClass;\n const sourceProperty = await sourceClass.getProperty(entry.path) as Property;\n\n // If property shall be added but there is already a property with this name\n // in target, a ConflictingPropertyName is issued.\n if (entry.changeType === \"add\" && targetProperty !== undefined) {\n return this.addConflict({\n code: ConflictCode.ConflictingPropertyName,\n difference: entry,\n source: resolvePropertyTypeName(sourceProperty),\n target: resolvePropertyTypeName(targetProperty),\n description: \"Target class already contains a property with a different type.\",\n });\n }\n\n if (entry.changeType === \"modify\" && targetProperty !== undefined) {\n if (\"kindOfQuantity\" in entry.difference) {\n const sourceKoQ = await sourceProperty.kindOfQuantity;\n const targetKoQ = await targetProperty.kindOfQuantity;\n if(!targetKoQ) {\n return this.addConflict({\n code: ConflictCode.ConflictingPropertyKindOfQuantity,\n difference: entry,\n source: entry.difference.kindOfQuantity,\n target: null,\n description: \"The kind of quantity cannot be assiged if the property did not have a kind of quantities before.\",\n });\n }\n\n if(!sourceKoQ) {\n return this.addConflict({\n code: ConflictCode.ConflictingPropertyKindOfQuantity,\n difference: entry,\n source: null,\n target: resolveLazyItemFullName(targetProperty.kindOfQuantity),\n description: \"The kind of quantity cannot be undefined if the property had a kind of quantities before.\",\n });\n }\n\n if (resolveLazyItemName(sourceKoQ.persistenceUnit) !== resolveLazyItemName(targetKoQ.persistenceUnit)) {\n this.addConflict({\n code: ConflictCode.ConflictingPropertyKindOfQuantityUnit,\n difference: entry,\n source: entry.difference.kindOfQuantity,\n target: resolveLazyItemFullName(targetProperty.kindOfQuantity),\n description: \"The property has different kind of quantities with conflicting units.\",\n });\n }\n }\n }\n }\n\n /**\n * Visitor implementation for handling PropertyCategoryDifference.\n * @internal\n */\n public async visitPropertyCategoryDifference(entry: PropertyCategoryDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling RelationshipClassDifference.\n * @internal\n */\n public async visitRelationshipClassDifference(entry: RelationshipClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling RelationshipConstraintDifference.\n * @internal\n */\n public async visitRelationshipConstraintDifference(_entry: RelationshipConstraintDifference) {\n }\n\n /**\n * Visitor implementation for handling RelationshipConstraintClassDifference.\n * @internal\n */\n public async visitRelationshipConstraintClassDifference(_entry: RelationshipConstraintClassDifference) {\n }\n\n /**\n * Visitor implementation for handling StructClassDifference.\n * @internal\n */\n public async visitStructClassDifference(entry: StructClassDifference) {\n await this.visitClassDifference(entry);\n }\n\n /**\n * Visitor implementation for handling UnitDifference.\n * @internal\n */\n public async visitUnitDifference(entry: UnitDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling UnitSystemDifference.\n * @internal\n */\n public async visitUnitSystemDifference(entry: UnitSystemDifference) {\n await this.visitSchemaItemDifference(entry, await this.getTargetSchemaItem(entry.itemName));\n }\n\n /**\n * Visitor implementation for handling KindOfQuantityPresentationFormatDifference.\n * @internal\n */\n public async visitKindOfQuantityPresentationFormatDifference(_entry: KindOfQuantityPresentationFormatDifference) {\n }\n\n /**\n * Visitor implementation for handling FormatUnitDifference.\n * @internal\n */\n public async visitFormatUnitDifference(entry: FormatUnitDifference) {\n const targetFormat = await this.getTargetSchemaItem(entry.itemName) as Format;\n\n if (targetFormat.units === undefined) {\n return this.addConflict({\n code: ConflictCode.ConflictingFormatUnit,\n difference: entry,\n source: entry.difference[0].name,\n target: null,\n description: \"The unit cannot be assiged if the format did not have a unit before.\",\n });\n };\n\n const targetUnit = await targetFormat.units[0][0];\n const targetPhenomenon = InvertedUnit.isInvertedUnit(targetUnit)\n ? (await targetUnit.invertsUnit)?.phenomenon\n : targetUnit.phenomenon;\n\n const sourceUnit = await this._sourceSchema.lookupItem(entry.difference[0].name) as Unit | InvertedUnit;\n const sourcePhenomenon = InvertedUnit.isInvertedUnit(sourceUnit)\n ? (await sourceUnit.invertsUnit)?.phenomenon\n : sourceUnit.phenomenon;\n\n if (resolveLazyItemName(targetPhenomenon) !== resolveLazyItemName(sourcePhenomenon)) {\n return this.addConflict({\n code: ConflictCode.ConflictingFormatUnitPhenomenon,\n difference: entry,\n source: entry.difference[0].name,\n target: targetUnit.fullName,\n description: \"Format units has a different phenomenon.\",\n });\n };\n };\n\n /**\n * Visitor implementation for handling FormatUnitLabelDifference.\n * @internal\n */\n public async visitFormatUnitLabelDifference(_entry: FormatUnitLabelDifference) {\n }\n\n /**\n * Recursive synchronous function to figure whether a given class derived from\n * a class with the given baseClass name.\n */\n private async derivedFrom(ecClass: ECClass | undefined, baseClassKey: Readonly<SchemaItemKey>): Promise<boolean> {\n if (ecClass === undefined) {\n return false;\n }\n\n // First check for name which must be same in any case...\n if (ecClass.name === baseClassKey.name) {\n // ... then check if the class is in the same schema as the expected base class...\n if(ecClass.schema.name === baseClassKey.schemaName)\n return true;\n // ... if not, whether it's in the source schema, but then we expect the baseclass\n // to be in the target schema.\n if(ecClass.schema.name === this._sourceSchema.name && baseClassKey.schemaName === this._targetSchema.name)\n return true;\n }\n return this.derivedFrom(await ecClass.baseClass, baseClassKey);\n }\n}\n\n/**\n * Helper method to resolve the schema item name from lazy loaded schema items.\n * @param lazyItem LazyLoaded item\n * @returns The full name of the item or undefined item was not set.\n */\nfunction resolveLazyItemFullName(lazyItem?: LazyLoadedSchemaItem<SchemaItem>) {\n return lazyItem && lazyItem.fullName;\n}\n\n/**\n * Helper method to resolve the schema item name from lazy loaded schema items.\n * @param lazyItem LazyLoaded item\n * @returns The full name of the item or undefined item was not set.\n */\nfunction resolveLazyItemName(lazyItem?: LazyLoadedSchemaItem<SchemaItem>) {\n return lazyItem && lazyItem.name;\n}\n\n/**\n * Helper method to resolve the type name of a property.\n * @param property The property which's type shall be resolved.\n * @returns The (full) name of the properties type.\n */\nfunction resolvePropertyTypeName(property: Property) {\n const [prefix, suffix] = property.isArray() ? [\"[\", \"]\"] : [\"\", \"\"];\n if (property.isEnumeration())\n return `${prefix}${resolveLazyItemFullName(property.enumeration)}${suffix}`;\n if (property.isPrimitive())\n return `${prefix}${primitiveTypeToString(property.primitiveType)}${suffix}`;\n if (property.isStruct())\n return `${prefix}${property.structClass.fullName}${suffix}`;\n if (property.isNavigation())\n return `${prefix}${property.relationshipClass.fullName}${suffix}`;\n return propertyTypeToString(property.propertyType);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../src/Editing/Editor.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../src/Editing/Editor.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,eAAe,EAA4D,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAA4C,MAAM,0BAA0B,CAAC;AAC5O,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,cAAc,CAAgB;IACtC,SAAgB,QAAQ,WAAsB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AAS,CAAC;IAW5E,gBAAgB;IACH,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IAejJ,gBAAgB;IACH,aAAa,CAAC,CAAC,SAAS,OAAO,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAkBnI,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,qBAAqB;YAMf,YAAY;IAQ1B;;;;OAIG;IACU,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM;IAQrE;;;;OAIG;IACU,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM;IAQhE;;;;OAIG;IACU,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM;CAwB1D"}
|
|
@@ -254,7 +254,7 @@ class SchemaContextEditor {
|
|
|
254
254
|
schema.setAlias(alias);
|
|
255
255
|
}
|
|
256
256
|
catch (e) {
|
|
257
|
-
if (e instanceof ecschema_metadata_1.
|
|
257
|
+
if (e instanceof ecschema_metadata_1.ECSchemaError && e.errorNumber === ecschema_metadata_1.ECSchemaStatus.InvalidECName) {
|
|
258
258
|
throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SetSchemaAlias, new Exception_1.SchemaId(schemaKey), new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.InvalidSchemaAlias, new Exception_1.SchemaId(schemaKey)));
|
|
259
259
|
}
|
|
260
260
|
throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SetSchemaAlias, new Exception_1.SchemaId(schemaKey), e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.js","sourceRoot":"","sources":["../../../src/Editing/Editor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/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E,SAAS,EAAE,SAAS,EAAE,UAAU,aAAa,CAAC,IAAI,4BAA4B,KAAK,IAAI,CAAC,CAAC;YAC7L,CAAC;YACD,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,IAAI,CAAC,YAAY,kCAAc,IAAI,CAAC,CAAC,WAAW,KAAK,mCAAe,CAAC,aAAa,EAAE,CAAC;gBACnF,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,cAAc,EAAE,IAAI,oBAAQ,CAAC,SAAS,CAAC,EAClF,IAAI,8BAAkB,CAAC,2BAAe,CAAC,kBAAkB,EAAE,IAAI,oBAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YACzF,CAAC;YAED,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,cAAc,EAAG,IAAI,oBAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;CACF;AArQD,kDAqQC;AAED,SAAS,gBAAgB,CAAC,IAA6B;IACrD,OAAO,MAAM,CAAC,MAAM,CAAC,kCAAc,CAAC,CAAC,QAAQ,CAAC,IAAsB,CAAC,CAAC;AACxE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport * as Rules from \"../Validation/ECRules\";\nimport { CustomAttribute, ECObjectsError, ECObjectsStatus, isSupportedSchemaItemType, Schema, SchemaContext, SchemaItem, SchemaItemKey, SchemaItemType, SchemaKey, SchemaMatchType, SupportedSchemaItemType } from \"@itwin/ecschema-metadata\";\nimport { MutableSchema } from \"./Mutable/MutableSchema\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { Constants } from \"./Constants\";\nimport { CustomAttributes } from \"./CustomAttributes\";\nimport { Entities } from \"./Entities\";\nimport { Enumerations } from \"./Enumerations\";\nimport { Formats } from \"./Formats\";\nimport { InvertedUnits } from \"./InvertedUnits\";\nimport { KindOfQuantities } from \"./KindOfQuantities\";\nimport { Mixins } from \"./Mixins\";\nimport { Phenomena } from \"./Phenomena\";\nimport { PropertyCategories } from \"./PropertyCategories\";\nimport { RelationshipClasses } from \"./RelationshipClasses\";\nimport { Structs } from \"./Structs\";\nimport { Units } from \"./Units\";\nimport { UnitSystems } from \"./UnitSystems\";\nimport { CustomAttributeId, ECEditingStatus, SchemaEditingError, SchemaId, SchemaItemId } from \"./Exception\";\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\n\n/**\n * A class that allows you to edit and create schemas, classes, and items from the SchemaContext level.\n * @alpha\n */\nexport class SchemaContextEditor {\n private _schemaContext: SchemaContext;\n public readonly entities = new Entities(this);\n public readonly mixins = new Mixins(this);\n public readonly structs = new Structs(this);\n public readonly customAttributes = new CustomAttributes(this);\n public readonly relationships = new RelationshipClasses(this);\n public readonly constants = new Constants(this);\n public readonly enumerations = new Enumerations(this);\n public readonly formats = new Formats(this);\n public readonly kindOfQuantities = new KindOfQuantities(this);\n public readonly units = new Units(this);\n public readonly phenomenons = new Phenomena(this);\n public readonly unitSystems = new UnitSystems(this);\n public readonly propertyCategories = new PropertyCategories(this);\n public readonly invertedUnits = new InvertedUnits(this);\n\n /**\n * Creates a new SchemaContextEditor instance.\n * @param schemaContext The SchemaContext the Editor will use to edit in.\n */\n constructor(schemaContext: SchemaContext) {\n // TODO: Make copy\n this._schemaContext = schemaContext;\n }\n\n /** Allows you to get schema classes and items through regular SchemaContext methods. */\n public get schemaContext(): SchemaContext {\n return this._schemaContext;\n }\n\n public async finish(): Promise<SchemaContext> {\n return this._schemaContext;\n }\n\n /**\n * Helper method for retrieving a schema, previously added, from the SchemaContext.\n * @param schemaKey The SchemaKey identifying the schema.\n * @internal\n */\n public async getSchema(schemaKey: SchemaKey): Promise<MutableSchema> {\n const schema = await this.schemaContext.getCachedSchema(schemaKey, SchemaMatchType.Latest);\n if (schema === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));\n\n return schema as MutableSchema;\n }\n\n /**\n * Creates a Schema with the given properties and adds it to the current schema context.\n * @param name The name given to the new schema.\n * @param alias The alias of the new schema.\n * @param readVersion The read version number of the schema.\n * @param writeVersion The write version number of the schema.\n * @param minorVersion The minor version number of the schema.\n * @returns Resolves to the SchemaKey of created schema.\n */\n public async createSchema(name: string, alias: string, readVersion: number, writeVersion: number, minorVersion: number): Promise<SchemaKey> {\n const newSchema = new Schema(this._schemaContext, name, alias, readVersion, writeVersion, minorVersion);\n await this._schemaContext.addSchema(newSchema);\n return newSchema.schemaKey;\n }\n\n /**\n * Adds a referenced schema to the schema identified by the given SchemaKey.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param refSchema The referenced schema to add.\n */\n public async addSchemaReference(schemaKey: SchemaKey, refSchema: Schema): Promise<void> {\n try {\n const schema = await this.lookupSchema(schemaKey, SchemaMatchType.Exact);\n await schema.addReference(refSchema);\n\n const diagnostics: AnyDiagnostic[] = [];\n for await (const diagnostic of Rules.validateSchemaReferences(schema)) {\n diagnostics.push(diagnostic);\n }\n\n if (diagnostics.length > 0) {\n this.removeReference(schema, refSchema);\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new SchemaId(schemaKey), undefined, diagnostics);\n }\n\n if (!await this.schemaContext.getCachedSchema(refSchema.schemaKey)) {\n await this.schemaContext.addSchema(refSchema);\n }\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.AddSchemaReference, new SchemaId(schemaKey), e);\n }\n }\n\n /**\n * Adds a CustomAttribute instance to the schema identified by the given SchemaKey\n * @param schemaKey The SchemaKey identifying the schema.\n * @param customAttribute The CustomAttribute instance to add.\n */\n public async addCustomAttribute(schemaKey: SchemaKey, customAttribute: CustomAttribute): Promise<void> {\n try {\n const schema = await this.lookupSchema(schemaKey);\n schema.addCustomAttribute(customAttribute);\n\n const diagnostics: AnyDiagnostic[] = [];\n for await (const diagnostic of Rules.validateCustomAttributeInstance(schema, customAttribute)) {\n diagnostics.push(diagnostic);\n }\n\n if (diagnostics.length > 0) {\n this.removeCustomAttribute(schema, customAttribute);\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, schema), undefined, diagnostics);\n }\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToClass, new SchemaId(schemaKey), e);\n }\n }\n\n /**\n * Sets the schema version.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param readVersion The read version of the schema. If not specified, the existing read version will be maintained.\n * @param writeVersion The write version of the schema. If not specified, the existing write version will be maintained.\n * @param minorVersion The minor version of the schema. If not specified, the existing minor version will be maintained.\n * @returns Resolves to the new SchemaKey containing version updates.\n */\n public async setVersion(schemaKey: SchemaKey, readVersion?: number, writeVersion?: number, minorVersion?: number): Promise<SchemaKey> {\n try {\n const schema = await this.lookupSchema(schemaKey);\n schema.setVersion(readVersion || schema.readVersion, writeVersion || schema.writeVersion, minorVersion || schema.minorVersion);\n\n return schema.schemaKey;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.SetSchemaVersion, new SchemaId(schemaKey), e);\n }\n }\n\n /**\n * Increments the minor version of a schema.\n * @param schemaKey The SchemaKey identifying the schema.\n * @returns Resolves to the new SchemaKey containing version updates.\n */\n public async incrementMinorVersion(schemaKey: SchemaKey): Promise<SchemaKey> {\n try {\n const schema = await this.lookupSchema(schemaKey);\n schema.setVersion(schema.readVersion, schema.writeVersion, schema.minorVersion + 1);\n\n return schema.schemaKey;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.IncrementSchemaMinorVersion, new SchemaId(schemaKey), e);\n }\n }\n\n /** @internal */\n public async lookupSchemaItem(schemaOrKey: Schema | SchemaKey, schemaItemKey: SchemaItemKey, schemaItemType: SchemaItemType): Promise<SchemaItem> {\n if(Schema.isSchema(schemaOrKey)) {\n schemaOrKey = schemaOrKey.schemaKey;\n }\n\n const schemaItem = await this.schemaContext.getSchemaItem(schemaItemKey);\n if (schemaItem === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new SchemaItemId(schemaItemType, schemaItemKey));\n\n if (schemaItemType !== schemaItem.schemaItemType)\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType, schemaItemKey));\n\n return schemaItem;\n }\n\n /** @internal */\n public async getSchemaItem<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): Promise<InstanceType<T>> {\n const schemaItem = await this.schemaContext.getSchemaItem(schemaItemKey);\n const schemaItemType = itemConstructor.schemaItemType;\n if(!isSchemaItemType(schemaItemType)) {\n // This block should never be hit, as the editor components always pass in the itemConstructor with a valid schemaItemType.\n throw new Error(`Invalid schema item lookup for: ${schemaItemType}`);\n }\n\n if (!schemaItem) {\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFoundInContext, new SchemaItemId(schemaItemType, schemaItemKey));\n }\n\n if (!isSupportedSchemaItemType(schemaItem.schemaItemType, itemConstructor.schemaItemType))\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType, schemaItemKey));\n\n return schemaItem as InstanceType<T>;\n }\n\n private removeReference(schema: Schema, refSchema: Schema) {\n const index: number = schema.references.indexOf(refSchema);\n if (index !== -1) {\n schema.references.splice(index, 1);\n }\n }\n\n private removeCustomAttribute(schema: Schema, customAttribute: CustomAttribute) {\n assert(schema.customAttributes !== undefined);\n const map = schema.customAttributes as Map<string, CustomAttribute>;\n map.delete(customAttribute.className);\n }\n\n private async lookupSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<MutableSchema> {\n const schema = await this.schemaContext.getCachedSchema(schemaKey, matchType);\n if (schema === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));\n\n return schema as MutableSchema;\n }\n\n /**\n * Sets the Schemas description.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param description The new description to set.\n */\n public async setDescription(schemaKey: SchemaKey, description: string) {\n const schema = await this.lookupSchema(schemaKey)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetDescription, new SchemaId(schemaKey), e);\n });\n schema.setDescription(description);\n }\n\n /**\n * Sets the Schemas display label.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param label The new label to set.\n */\n public async setDisplayLabel(schemaKey: SchemaKey, label: string) {\n const schema = await this.lookupSchema(schemaKey)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetLabel, new SchemaId(schemaKey), e);\n });\n schema.setDisplayLabel(label);\n }\n\n /**\n * Sets the Schemas alias.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param alias The new alias to set.\n */\n public async setAlias(schemaKey: SchemaKey, alias: string) {\n const schema = await this.lookupSchema(schemaKey)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey), e);\n });\n\n try {\n for (const currentSchema of this.schemaContext.getKnownSchemas()) {\n if (currentSchema.schemaKey.matches(schemaKey))\n continue;\n\n if (currentSchema.alias.toLowerCase() === alias.toLowerCase())\n throw new SchemaEditingError(ECEditingStatus.SchemaAliasAlreadyExists, new SchemaId(schemaKey), undefined, undefined, `Schema ${currentSchema.name} already uses the alias '${alias}'.`);\n }\n schema.setAlias(alias);\n } catch(e: any) {\n if (e instanceof ECObjectsError && e.errorNumber === ECObjectsStatus.InvalidECName) {\n throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey),\n new SchemaEditingError(ECEditingStatus.InvalidSchemaAlias, new SchemaId(schemaKey)));\n }\n\n throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey), e);\n }\n }\n}\n\nfunction isSchemaItemType(type: SupportedSchemaItemType): type is SchemaItemType {\n return Object.values(SchemaItemType).includes(type as Sch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,CAAC,WAAW,EAAE;oBAC3D,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,wBAAwB,EAAE,IAAI,oBAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,aAAa,CAAC,IAAI,4BAA4B,KAAK,IAAI,CAAC,CAAC;YAC7L,CAAC;YACD,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,IAAI,CAAC,YAAY,iCAAa,IAAI,CAAC,CAAC,WAAW,KAAK,kCAAc,CAAC,aAAa,EAAE,CAAC;gBACjF,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,cAAc,EAAE,IAAI,oBAAQ,CAAC,SAAS,CAAC,EAClF,IAAI,8BAAkB,CAAC,2BAAe,CAAC,kBAAkB,EAAE,IAAI,oBAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YACzF,CAAC;YAED,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,cAAc,EAAG,IAAI,oBAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;CACF;AArQD,kDAqQC;AAED,SAAS,gBAAgB,CAAC,IAA6B;IACrD,OAAO,MAAM,CAAC,MAAM,CAAC,kCAAc,CAAC,CAAC,QAAQ,CAAC,IAAsB,CAAC,CAAC;AACxE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport * as Rules from \"../Validation/ECRules\";\nimport { CustomAttribute, ECSchemaError, ECSchemaStatus, isSupportedSchemaItemType, Schema, SchemaContext, SchemaItem, SchemaItemKey, SchemaItemType, SchemaKey, SchemaMatchType, SupportedSchemaItemType } from \"@itwin/ecschema-metadata\";\nimport { MutableSchema } from \"./Mutable/MutableSchema\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { Constants } from \"./Constants\";\nimport { CustomAttributes } from \"./CustomAttributes\";\nimport { Entities } from \"./Entities\";\nimport { Enumerations } from \"./Enumerations\";\nimport { Formats } from \"./Formats\";\nimport { InvertedUnits } from \"./InvertedUnits\";\nimport { KindOfQuantities } from \"./KindOfQuantities\";\nimport { Mixins } from \"./Mixins\";\nimport { Phenomena } from \"./Phenomena\";\nimport { PropertyCategories } from \"./PropertyCategories\";\nimport { RelationshipClasses } from \"./RelationshipClasses\";\nimport { Structs } from \"./Structs\";\nimport { Units } from \"./Units\";\nimport { UnitSystems } from \"./UnitSystems\";\nimport { CustomAttributeId, ECEditingStatus, SchemaEditingError, SchemaId, SchemaItemId } from \"./Exception\";\nimport { AnyDiagnostic } from \"../Validation/Diagnostic\";\n\n/**\n * A class that allows you to edit and create schemas, classes, and items from the SchemaContext level.\n * @alpha\n */\nexport class SchemaContextEditor {\n private _schemaContext: SchemaContext;\n public readonly entities = new Entities(this);\n public readonly mixins = new Mixins(this);\n public readonly structs = new Structs(this);\n public readonly customAttributes = new CustomAttributes(this);\n public readonly relationships = new RelationshipClasses(this);\n public readonly constants = new Constants(this);\n public readonly enumerations = new Enumerations(this);\n public readonly formats = new Formats(this);\n public readonly kindOfQuantities = new KindOfQuantities(this);\n public readonly units = new Units(this);\n public readonly phenomenons = new Phenomena(this);\n public readonly unitSystems = new UnitSystems(this);\n public readonly propertyCategories = new PropertyCategories(this);\n public readonly invertedUnits = new InvertedUnits(this);\n\n /**\n * Creates a new SchemaContextEditor instance.\n * @param schemaContext The SchemaContext the Editor will use to edit in.\n */\n constructor(schemaContext: SchemaContext) {\n // TODO: Make copy\n this._schemaContext = schemaContext;\n }\n\n /** Allows you to get schema classes and items through regular SchemaContext methods. */\n public get schemaContext(): SchemaContext {\n return this._schemaContext;\n }\n\n public async finish(): Promise<SchemaContext> {\n return this._schemaContext;\n }\n\n /**\n * Helper method for retrieving a schema, previously added, from the SchemaContext.\n * @param schemaKey The SchemaKey identifying the schema.\n * @internal\n */\n public async getSchema(schemaKey: SchemaKey): Promise<MutableSchema> {\n const schema = await this.schemaContext.getCachedSchema(schemaKey, SchemaMatchType.Latest);\n if (schema === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));\n\n return schema as MutableSchema;\n }\n\n /**\n * Creates a Schema with the given properties and adds it to the current schema context.\n * @param name The name given to the new schema.\n * @param alias The alias of the new schema.\n * @param readVersion The read version number of the schema.\n * @param writeVersion The write version number of the schema.\n * @param minorVersion The minor version number of the schema.\n * @returns Resolves to the SchemaKey of created schema.\n */\n public async createSchema(name: string, alias: string, readVersion: number, writeVersion: number, minorVersion: number): Promise<SchemaKey> {\n const newSchema = new Schema(this._schemaContext, name, alias, readVersion, writeVersion, minorVersion);\n await this._schemaContext.addSchema(newSchema);\n return newSchema.schemaKey;\n }\n\n /**\n * Adds a referenced schema to the schema identified by the given SchemaKey.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param refSchema The referenced schema to add.\n */\n public async addSchemaReference(schemaKey: SchemaKey, refSchema: Schema): Promise<void> {\n try {\n const schema = await this.lookupSchema(schemaKey, SchemaMatchType.Exact);\n await schema.addReference(refSchema);\n\n const diagnostics: AnyDiagnostic[] = [];\n for await (const diagnostic of Rules.validateSchemaReferences(schema)) {\n diagnostics.push(diagnostic);\n }\n\n if (diagnostics.length > 0) {\n this.removeReference(schema, refSchema);\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new SchemaId(schemaKey), undefined, diagnostics);\n }\n\n if (!await this.schemaContext.getCachedSchema(refSchema.schemaKey)) {\n await this.schemaContext.addSchema(refSchema);\n }\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.AddSchemaReference, new SchemaId(schemaKey), e);\n }\n }\n\n /**\n * Adds a CustomAttribute instance to the schema identified by the given SchemaKey\n * @param schemaKey The SchemaKey identifying the schema.\n * @param customAttribute The CustomAttribute instance to add.\n */\n public async addCustomAttribute(schemaKey: SchemaKey, customAttribute: CustomAttribute): Promise<void> {\n try {\n const schema = await this.lookupSchema(schemaKey);\n schema.addCustomAttribute(customAttribute);\n\n const diagnostics: AnyDiagnostic[] = [];\n for await (const diagnostic of Rules.validateCustomAttributeInstance(schema, customAttribute)) {\n diagnostics.push(diagnostic);\n }\n\n if (diagnostics.length > 0) {\n this.removeCustomAttribute(schema, customAttribute);\n throw new SchemaEditingError(ECEditingStatus.RuleViolation, new CustomAttributeId(customAttribute.className, schema), undefined, diagnostics);\n }\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.AddCustomAttributeToClass, new SchemaId(schemaKey), e);\n }\n }\n\n /**\n * Sets the schema version.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param readVersion The read version of the schema. If not specified, the existing read version will be maintained.\n * @param writeVersion The write version of the schema. If not specified, the existing write version will be maintained.\n * @param minorVersion The minor version of the schema. If not specified, the existing minor version will be maintained.\n * @returns Resolves to the new SchemaKey containing version updates.\n */\n public async setVersion(schemaKey: SchemaKey, readVersion?: number, writeVersion?: number, minorVersion?: number): Promise<SchemaKey> {\n try {\n const schema = await this.lookupSchema(schemaKey);\n schema.setVersion(readVersion || schema.readVersion, writeVersion || schema.writeVersion, minorVersion || schema.minorVersion);\n\n return schema.schemaKey;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.SetSchemaVersion, new SchemaId(schemaKey), e);\n }\n }\n\n /**\n * Increments the minor version of a schema.\n * @param schemaKey The SchemaKey identifying the schema.\n * @returns Resolves to the new SchemaKey containing version updates.\n */\n public async incrementMinorVersion(schemaKey: SchemaKey): Promise<SchemaKey> {\n try {\n const schema = await this.lookupSchema(schemaKey);\n schema.setVersion(schema.readVersion, schema.writeVersion, schema.minorVersion + 1);\n\n return schema.schemaKey;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.IncrementSchemaMinorVersion, new SchemaId(schemaKey), e);\n }\n }\n\n /** @internal */\n public async lookupSchemaItem(schemaOrKey: Schema | SchemaKey, schemaItemKey: SchemaItemKey, schemaItemType: SchemaItemType): Promise<SchemaItem> {\n if(Schema.isSchema(schemaOrKey)) {\n schemaOrKey = schemaOrKey.schemaKey;\n }\n\n const schemaItem = await this.schemaContext.getSchemaItem(schemaItemKey);\n if (schemaItem === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new SchemaItemId(schemaItemType, schemaItemKey));\n\n if (schemaItemType !== schemaItem.schemaItemType)\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType, schemaItemKey));\n\n return schemaItem;\n }\n\n /** @internal */\n public async getSchemaItem<T extends typeof SchemaItem>(schemaItemKey: SchemaItemKey, itemConstructor: T): Promise<InstanceType<T>> {\n const schemaItem = await this.schemaContext.getSchemaItem(schemaItemKey);\n const schemaItemType = itemConstructor.schemaItemType;\n if(!isSchemaItemType(schemaItemType)) {\n // This block should never be hit, as the editor components always pass in the itemConstructor with a valid schemaItemType.\n throw new Error(`Invalid schema item lookup for: ${schemaItemType}`);\n }\n\n if (!schemaItem) {\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFoundInContext, new SchemaItemId(schemaItemType, schemaItemKey));\n }\n\n if (!isSupportedSchemaItemType(schemaItem.schemaItemType, itemConstructor.schemaItemType))\n throw new SchemaEditingError(ECEditingStatus.InvalidSchemaItemType, new SchemaItemId(schemaItemType, schemaItemKey));\n\n return schemaItem as InstanceType<T>;\n }\n\n private removeReference(schema: Schema, refSchema: Schema) {\n const index: number = schema.references.indexOf(refSchema);\n if (index !== -1) {\n schema.references.splice(index, 1);\n }\n }\n\n private removeCustomAttribute(schema: Schema, customAttribute: CustomAttribute) {\n assert(schema.customAttributes !== undefined);\n const map = schema.customAttributes as Map<string, CustomAttribute>;\n map.delete(customAttribute.className);\n }\n\n private async lookupSchema(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<MutableSchema> {\n const schema = await this.schemaContext.getCachedSchema(schemaKey, matchType);\n if (schema === undefined)\n throw new SchemaEditingError(ECEditingStatus.SchemaNotFound, new SchemaId(schemaKey));\n\n return schema as MutableSchema;\n }\n\n /**\n * Sets the Schemas description.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param description The new description to set.\n */\n public async setDescription(schemaKey: SchemaKey, description: string) {\n const schema = await this.lookupSchema(schemaKey)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetDescription, new SchemaId(schemaKey), e);\n });\n schema.setDescription(description);\n }\n\n /**\n * Sets the Schemas display label.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param label The new label to set.\n */\n public async setDisplayLabel(schemaKey: SchemaKey, label: string) {\n const schema = await this.lookupSchema(schemaKey)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetLabel, new SchemaId(schemaKey), e);\n });\n schema.setDisplayLabel(label);\n }\n\n /**\n * Sets the Schemas alias.\n * @param schemaKey The SchemaKey identifying the schema.\n * @param alias The new alias to set.\n */\n public async setAlias(schemaKey: SchemaKey, alias: string) {\n const schema = await this.lookupSchema(schemaKey)\n .catch((e: any) => {\n throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey), e);\n });\n\n try {\n for (const currentSchema of this.schemaContext.getKnownSchemas()) {\n if (currentSchema.schemaKey.matches(schemaKey))\n continue;\n\n if (currentSchema.alias.toLowerCase() === alias.toLowerCase())\n throw new SchemaEditingError(ECEditingStatus.SchemaAliasAlreadyExists, new SchemaId(schemaKey), undefined, undefined, `Schema ${currentSchema.name} already uses the alias '${alias}'.`);\n }\n schema.setAlias(alias);\n } catch(e: any) {\n if (e instanceof ECSchemaError && e.errorNumber === ECSchemaStatus.InvalidECName) {\n throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey),\n new SchemaEditingError(ECEditingStatus.InvalidSchemaAlias, new SchemaId(schemaKey)));\n }\n\n throw new SchemaEditingError(ECEditingStatus.SetSchemaAlias, new SchemaId(schemaKey), e);\n }\n }\n}\n\nfunction isSchemaItemType(type: SupportedSchemaItemType): type is SchemaItemType {\n return Object.values(SchemaItemType).includes(type as SchemaItemType);\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Formats.d.ts","sourceRoot":"","sources":["../../../src/Editing/Formats.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"Formats.d.ts","sourceRoot":"","sources":["../../../src/Editing/Formats.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAA2B,MAAM,EAAgB,qBAAqB,EAAE,aAAa,EAAkB,SAAS,EAAQ,MAAM,0BAA0B,CAAC;AAChK,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,qBAAa,OAAQ,SAAQ,WAAW;IACtC,cAAuB,aAAa,IAAI,OAAO,MAAM,CAEpD;gBAEkB,YAAY,EAAE,mBAAmB;IAIvC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IAgCvJ;;;;OAIG;IACU,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC;CAQ/G"}
|
|
@@ -31,10 +31,15 @@ class Formats extends SchemaItems_1.SchemaItems {
|
|
|
31
31
|
if (!unitItem) {
|
|
32
32
|
throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SchemaItemNotFoundInContext, new Exception_1.SchemaItemId(ecschema_metadata_1.SchemaItemType.Unit, unit));
|
|
33
33
|
}
|
|
34
|
-
if (
|
|
34
|
+
if (ecschema_metadata_1.Unit.isUnit(unitItem)) {
|
|
35
|
+
newFormat.addUnit(new ecschema_metadata_1.DelayedPromiseWithProps(unitItem.key, async () => unitItem));
|
|
36
|
+
}
|
|
37
|
+
else if (ecschema_metadata_1.InvertedUnit.isInvertedUnit(unitItem)) {
|
|
38
|
+
newFormat.addUnit(new ecschema_metadata_1.DelayedPromiseWithProps(unitItem.key, async () => unitItem));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
35
41
|
throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.InvalidFormatUnitsSpecified, new Exception_1.SchemaItemId(unitItem.schemaItemType, unitItem.key));
|
|
36
42
|
}
|
|
37
|
-
newFormat.addUnit(unitItem);
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
45
|
if (displayLabel)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Formats.js","sourceRoot":"","sources":["../../../src/Editing/Formats.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"Formats.js","sourceRoot":"","sources":["../../../src/Editing/Formats.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAgK;AAIhK,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,OAAQ,SAAQ,yBAAW;IACtC,IAAuB,aAAa;QAClC,OAAO,0BAAM,CAAC;IAChB,CAAC;IAED,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,UAAsB,EAAE,YAAqB,EAAE,KAAuB;QAC5H,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAS,SAAS,EAAE,IAAI,CAAC,cAAc,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,GAAG,CAAC;QACvB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,sBAAsB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAClI,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,WAAkC;QACnF,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC;YAClJ,OAAO,SAAS,CAAC,GAAG,CAAC;QACvB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAClJ,CAAC;IACH,CAAC;CACF;AAtDD,0BAsDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport { DelayedPromiseWithProps, Format, InvertedUnit, SchemaItemFormatProps, SchemaItemKey, SchemaItemType, SchemaKey, Unit } from \"@itwin/ecschema-metadata\";\nimport { FormatType } from \"@itwin/core-quantity\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport { MutableFormat } from \"./Mutable/MutableFormat\";\nimport { ECEditingStatus, SchemaEditingError, SchemaItemId } from \"./Exception\";\nimport { SchemaItems } from \"./SchemaItems\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type Format.\n */\nexport class Formats extends SchemaItems {\n protected override get itemTypeClass(): typeof Format {\n return Format;\n }\n\n public constructor(schemaEditor: SchemaContextEditor) {\n super(SchemaItemType.Format, schemaEditor);\n }\n\n public async create(schemaKey: SchemaKey, name: string, formatType: FormatType, displayLabel?: string, units?: SchemaItemKey[]): Promise<SchemaItemKey> {\n try {\n const newFormat = await this.createSchemaItem<Format>(schemaKey, this.schemaItemType, (schema) => schema.createFormat.bind(schema), name) as MutableFormat;\n\n if (units !== undefined) {\n for (const unit of units) {\n const unitItem = await this.schemaEditor.schemaContext.getSchemaItem(unit);\n if (!unitItem) {\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFoundInContext, new SchemaItemId(SchemaItemType.Unit, unit));\n }\n\n if (Unit.isUnit(unitItem) ) {\n newFormat.addUnit(new DelayedPromiseWithProps(unitItem.key, async () => unitItem));\n } else if (InvertedUnit.isInvertedUnit(unitItem) ) {\n newFormat.addUnit(new DelayedPromiseWithProps(unitItem.key, async () => unitItem));\n } else {\n throw new SchemaEditingError(ECEditingStatus.InvalidFormatUnitsSpecified, new SchemaItemId(unitItem.schemaItemType, unitItem.key));\n }\n }\n }\n\n if (displayLabel)\n newFormat.setDisplayLabel(displayLabel);\n\n // TODO: Handle the setting of format traits, separators, etc....\n newFormat.setFormatType(formatType);\n return newFormat.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);\n }\n }\n\n /**\n * Creates a format through a SchemaItemFormatProps.\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\n * @param relationshipProps a json object that will be used to populate the new RelationshipClass. Needs a name value passed in.\n */\n public async createFromProps(schemaKey: SchemaKey, formatProps: SchemaItemFormatProps): Promise<SchemaItemKey> {\n try {\n const newFormat = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createFormat.bind(schema), formatProps);\n return newFormat.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, formatProps.name!, schemaKey), e);\n }\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Editing
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { KindOfQuantity, KindOfQuantityProps, LazyLoadedInvertedUnit, LazyLoadedUnit, OverrideFormat, SchemaItemKey, SchemaKey } from "@itwin/ecschema-metadata";
|
|
5
5
|
import { SchemaContextEditor } from "./Editor";
|
|
6
6
|
import { SchemaItems } from "./SchemaItems";
|
|
7
7
|
/**
|
|
@@ -25,6 +25,6 @@ export declare class KindOfQuantities extends SchemaItems {
|
|
|
25
25
|
* @param parent A SchemaItemKey of the parent Format.
|
|
26
26
|
* @param unitLabelOverrides The list of Unit (or InvertedUnit) and label overrides. The length of list should be equal to the number of units in the parent Format.
|
|
27
27
|
*/
|
|
28
|
-
createFormatOverride(parent: SchemaItemKey, precision?: number, unitLabelOverrides?: Array<[
|
|
28
|
+
createFormatOverride(parent: SchemaItemKey, precision?: number, unitLabelOverrides?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): Promise<OverrideFormat>;
|
|
29
29
|
}
|
|
30
30
|
//# sourceMappingURL=KindOfQuantities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KindOfQuantities.d.ts","sourceRoot":"","sources":["../../../src/Editing/KindOfQuantities.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"KindOfQuantities.d.ts","sourceRoot":"","sources":["../../../src/Editing/KindOfQuantities.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAEiB,cAAc,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,cAAc,EAAE,cAAc,EACjH,aAAa,EAAkB,SAAS,EACzC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,cAAuB,aAAa,IAAI,OAAO,cAAc,CAE5D;gBACkB,YAAY,EAAE,mBAAmB;IAIvC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,kBAAkB,EAAE,aAAa,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAyB5H,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,aAAa,CAAC;IASzG;;;;;OAKG;IACU,qBAAqB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAU9G,6BAA6B,CAAC,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAS5I;;;OAGG;IACU,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,KAAK,CAAC,CAAC,cAAc,GAAG,sBAAsB,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC;CAQjM"}
|
|
@@ -30,10 +30,10 @@ class KindOfQuantities extends SchemaItems_1.SchemaItems {
|
|
|
30
30
|
if (persistenceUnit === undefined || (!ecschema_metadata_1.Unit.isUnit(persistenceUnit) && !ecschema_metadata_1.InvertedUnit.isInvertedUnit(persistenceUnit)))
|
|
31
31
|
throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.SchemaItemNotFound, new Exception_1.SchemaItemId(ecschema_metadata_1.SchemaItemType.Unit, persistenceUnitKey));
|
|
32
32
|
if (ecschema_metadata_1.Unit.isUnit(persistenceUnit)) {
|
|
33
|
-
koqItem.
|
|
33
|
+
koqItem.setPersistenceUnit(new ecschema_metadata_1.DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit));
|
|
34
34
|
}
|
|
35
35
|
if (ecschema_metadata_1.InvertedUnit.isInvertedUnit(persistenceUnit)) {
|
|
36
|
-
koqItem.
|
|
36
|
+
koqItem.setPersistenceUnit(new ecschema_metadata_1.DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit));
|
|
37
37
|
}
|
|
38
38
|
if (displayLabel !== undefined) {
|
|
39
39
|
koqItem.setDisplayLabel(displayLabel);
|
|
@@ -63,7 +63,7 @@ class KindOfQuantities extends SchemaItems_1.SchemaItems {
|
|
|
63
63
|
try {
|
|
64
64
|
const kindOfQuantity = await this.getSchemaItem(koqKey, MutableKindOfQuantity_1.MutableKindOfQuantity);
|
|
65
65
|
const presentationFormat = await this.getSchemaItem(format, ecschema_metadata_1.Format);
|
|
66
|
-
kindOfQuantity.addPresentationFormat(presentationFormat, isDefault);
|
|
66
|
+
kindOfQuantity.addPresentationFormat(new ecschema_metadata_1.DelayedPromiseWithProps(presentationFormat.key, async () => presentationFormat), isDefault);
|
|
67
67
|
}
|
|
68
68
|
catch (e) {
|
|
69
69
|
throw new Exception_1.SchemaEditingError(Exception_1.ECEditingStatus.AddPresentationUnit, new Exception_1.SchemaItemId(this.schemaItemType, koqKey), e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KindOfQuantities.js","sourceRoot":"","sources":["../../../src/Editing/KindOfQuantities.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAIkC;AAElC,2EAAwE;AACxE,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,yBAAW;IAC/C,IAAuB,aAAa;QAClC,OAAO,kCAAc,CAAC;IACxB,CAAC;IAC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CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QACtH,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,6BAA6B,CAAC,MAAqB,EAAE,cAA8B,EAAE,YAAqB,KAAK;QAC1H,IAAI,CAAC;YACH,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,6CAAqB,CAAC,CAAC;YAC/E,cAAc,CAAC,qBAAqB,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;QAClE,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,uBAAuB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1H,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,oBAAoB,CAAC,MAAqB,EAAE,SAAkB,EAAE,kBAAyF;QACpK,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,0BAAM,CAAC,CAAC;YAC9D,OAAO,IAAI,kCAAc,CAAC,YAAY,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAAC;QACzE,CAAC;QAAC,OAAM,CAAM,EAAE,CAAC;YACf,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,oBAAoB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QACvH,CAAC;IACH,CAAC;CACF;AA/ED,4CA+EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Editing\n */\n\nimport {\n DelayedPromiseWithProps,\n Format, InvertedUnit, KindOfQuantity, KindOfQuantityProps, LazyLoadedInvertedUnit, LazyLoadedUnit, OverrideFormat,\n SchemaItemKey, SchemaItemType, SchemaKey, Unit,\n} from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport { MutableKindOfQuantity } from \"./Mutable/MutableKindOfQuantity\";\nimport { ECEditingStatus, SchemaEditingError, SchemaItemId } from \"./Exception\";\nimport { SchemaItems } from \"./SchemaItems\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type KindOfQuantity.\n */\nexport class KindOfQuantities extends SchemaItems {\n protected override get itemTypeClass(): typeof KindOfQuantity {\n return KindOfQuantity;\n }\n public constructor(schemaEditor: SchemaContextEditor) {\n super(SchemaItemType.KindOfQuantity, schemaEditor);\n }\n\n public async create(schemaKey: SchemaKey, name: string, persistenceUnitKey: SchemaItemKey, displayLabel?: string): Promise<SchemaItemKey> {\n try {\n const koqItem = await this.createSchemaItem<KindOfQuantity>(schemaKey, this.schemaItemType, (schema) => schema.createKindOfQuantity.bind(schema), name) as MutableKindOfQuantity;\n const persistenceUnit = await koqItem.schema.lookupItem(persistenceUnitKey);\n if (persistenceUnit === undefined || (!Unit.isUnit(persistenceUnit) && !InvertedUnit.isInvertedUnit(persistenceUnit)))\n throw new SchemaEditingError(ECEditingStatus.SchemaItemNotFound, new SchemaItemId(SchemaItemType.Unit, persistenceUnitKey));\n\n if (Unit.isUnit(persistenceUnit)) {\n koqItem.setPersistenceUnit(new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit));\n }\n\n if (InvertedUnit.isInvertedUnit(persistenceUnit)) {\n koqItem.setPersistenceUnit(new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit));\n }\n\n if (displayLabel !== undefined) {\n koqItem.setDisplayLabel(displayLabel);\n }\n\n return koqItem.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);\n }\n }\n\n public async createFromProps(schemaKey: SchemaKey, koqProps: KindOfQuantityProps): Promise<SchemaItemKey> {\n try {\n const koqItem = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createKindOfQuantity.bind(schema), koqProps);\n return koqItem.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, koqProps.name!, schemaKey), e);\n }\n }\n\n /**\n *\n * @param koqKey A schemaItemKey of the editing KindOfQuantity.\n * @param format A schemaItemKey of a Format.\n * @param isDefault .is set to false when not explicitly passed.\n */\n public async addPresentationFormat(koqKey: SchemaItemKey, format: SchemaItemKey, isDefault: boolean = false): Promise<void> {\n try {\n const kindOfQuantity = await this.getSchemaItem(koqKey, MutableKindOfQuantity);\n const presentationFormat = await this.getSchemaItem(format, Format);\n kindOfQuantity.addPresentationFormat(new DelayedPromiseWithProps(presentationFormat.key, async () => presentationFormat), isDefault);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.AddPresentationUnit, new SchemaItemId(this.schemaItemType, koqKey), e);\n }\n }\n\n public async addPresentationOverrideFormat(koqKey: SchemaItemKey, overrideFormat: OverrideFormat, isDefault: boolean = false): Promise<void> {\n try {\n const kindOfQuantity = await this.getSchemaItem(koqKey, MutableKindOfQuantity);\n kindOfQuantity.addPresentationFormat(overrideFormat, isDefault);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.AddPresentationOverride, new SchemaItemId(this.schemaItemType, koqKey), e);\n }\n }\n\n /**\n * @param parent A SchemaItemKey of the parent Format.\n * @param unitLabelOverrides The list of Unit (or InvertedUnit) and label overrides. The length of list should be equal to the number of units in the parent Format.\n */\n public async createFormatOverride(parent: SchemaItemKey, precision?: number, unitLabelOverrides?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): Promise<OverrideFormat> {\n try {\n const parentFormat = await this.getSchemaItem(parent, Format);\n return new OverrideFormat(parentFormat, precision, unitLabelOverrides);\n } catch(e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateFormatOverride, new SchemaItemId(this.schemaItemType, parent), e);\n }\n }\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Format,
|
|
1
|
+
import { Format, LazyLoadedInvertedUnit, LazyLoadedUnit } from "@itwin/ecschema-metadata";
|
|
2
2
|
import { FormatTraits, FormatType, ScientificType, ShowSignOption } from "@itwin/core-quantity";
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
* An abstract class used for schema editing.
|
|
6
6
|
*/
|
|
7
7
|
export declare abstract class MutableFormat extends Format {
|
|
8
|
-
abstract addUnit(unit:
|
|
8
|
+
abstract addUnit(unit: LazyLoadedUnit | LazyLoadedInvertedUnit, label?: string): void;
|
|
9
9
|
abstract setPrecision(precision: number): void;
|
|
10
10
|
abstract setFormatType(formatType: FormatType): void;
|
|
11
11
|
abstract setRoundFactor(roundFactor: number): void;
|
|
@@ -20,7 +20,7 @@ export declare abstract class MutableFormat extends Format {
|
|
|
20
20
|
abstract setSpacer(spacer: string): void;
|
|
21
21
|
abstract setIncludeZero(includeZero: boolean): void;
|
|
22
22
|
abstract setFormatTraits(formatTraits: FormatTraits): void;
|
|
23
|
-
abstract setUnits(units: Array<[
|
|
23
|
+
abstract setUnits(units: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): void;
|
|
24
24
|
abstract setDisplayLabel(displayLabel: string): void;
|
|
25
25
|
}
|
|
26
26
|
//# sourceMappingURL=MutableFormat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutableFormat.d.ts","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableFormat.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"MutableFormat.d.ts","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableFormat.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,cAAc,EA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"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,
|
|
1
|
+
{"version":3,"file":"MutableFormat.js","sourceRoot":"","sources":["../../../../src/Editing/Mutable/MutableFormat.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAA0F;AAG1F;;;GAGG;AACH,MAAsB,aAAc,SAAQ,0BAAM;CAkBjD;AAlBD,sCAkBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { Format, LazyLoadedInvertedUnit, LazyLoadedUnit } from \"@itwin/ecschema-metadata\";\nimport { FormatTraits, FormatType, ScientificType, ShowSignOption } from \"@itwin/core-quantity\";\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableFormat extends Format {\n public abstract override addUnit(unit: LazyLoadedUnit | LazyLoadedInvertedUnit, label?: string): void;\n public abstract override setPrecision(precision: number): void;\n public abstract override setFormatType(formatType: FormatType): void;\n public abstract override setRoundFactor(roundFactor: number): void;\n public abstract override setShowSignOption(signOption: ShowSignOption): void;\n public abstract override setDecimalSeparator(separator: string): void;\n public abstract override setThousandSeparator(separator: string): void;\n public abstract override setUomSeparator(separator: string): void;\n public abstract override setStationSeparator(separator: string): void;\n public abstract override setMinWidth(minWidth: number): void;\n public abstract override setStationOffsetSize(stationOffsetSize: number): void;\n public abstract override setScientificType(scientificType: ScientificType): void;\n public abstract override setSpacer(spacer: string): void;\n public abstract override setIncludeZero(includeZero: boolean): void;\n public abstract override setFormatTraits(formatTraits: FormatTraits): void;\n public abstract override setUnits(units: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): void;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n"]}
|