@itwin/ecschema-editing 5.0.0-dev.2 → 5.0.0-dev.20
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 +16 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts +0 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +1 -9
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifference.d.ts +2 -1
- package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDifference.js +51 -5
- package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifferenceValidator.d.ts +2 -1
- package/lib/cjs/Differencing/SchemaDifferenceValidator.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDifferenceValidator.js +29 -16
- package/lib/cjs/Differencing/SchemaDifferenceValidator.js.map +1 -1
- package/lib/cjs/Editing/Editor.js +4 -4
- package/lib/cjs/Editing/Editor.js.map +1 -1
- package/lib/cjs/Editing/Properties.d.ts +2 -2
- package/lib/cjs/Editing/Properties.js +2 -2
- package/lib/cjs/Editing/Properties.js.map +1 -1
- package/lib/cjs/Merging/ConstantMerger.js +3 -3
- package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
- package/lib/cjs/Merging/CustomAttributeMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/CustomAttributeMerger.js +5 -9
- package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
- package/lib/cjs/Merging/Edits/NameMapping.d.ts +22 -0
- package/lib/cjs/Merging/Edits/NameMapping.d.ts.map +1 -0
- package/lib/cjs/Merging/Edits/NameMapping.js +51 -0
- package/lib/cjs/Merging/Edits/NameMapping.js.map +1 -0
- package/lib/cjs/Merging/Edits/RenameEditHandler.d.ts +1 -1
- package/lib/cjs/Merging/Edits/RenameEditHandler.d.ts.map +1 -1
- package/lib/cjs/Merging/Edits/RenameEditHandler.js +1 -260
- package/lib/cjs/Merging/Edits/RenameEditHandler.js.map +1 -1
- package/lib/cjs/Merging/Edits/SchemaEdits.d.ts +9 -6
- package/lib/cjs/Merging/Edits/SchemaEdits.d.ts.map +1 -1
- package/lib/cjs/Merging/Edits/SchemaEdits.js +15 -14
- package/lib/cjs/Merging/Edits/SchemaEdits.js.map +1 -1
- package/lib/cjs/Merging/EntityClassMerger.js +1 -2
- package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
- package/lib/cjs/Merging/EnumerationMerger.js +1 -1
- package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
- package/lib/cjs/Merging/EnumeratorMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/EnumeratorMerger.js +2 -2
- package/lib/cjs/Merging/EnumeratorMerger.js.map +1 -1
- package/lib/cjs/Merging/KindOfQuantityMerger.js +2 -2
- package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
- package/lib/cjs/Merging/MixinMerger.js +1 -1
- package/lib/cjs/Merging/MixinMerger.js.map +1 -1
- package/lib/cjs/Merging/PhenomenonMerger.js +1 -1
- package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
- package/lib/cjs/Merging/PropertyMerger.js +25 -23
- package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaMerger.d.ts +5 -3
- package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/SchemaMerger.js +35 -5
- package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaMergingVisitor.d.ts +0 -4
- package/lib/cjs/Merging/SchemaMergingVisitor.d.ts.map +1 -1
- package/lib/cjs/Merging/SchemaMergingVisitor.js +4 -10
- package/lib/cjs/Merging/SchemaMergingVisitor.js.map +1 -1
- package/lib/cjs/Merging/Utils.d.ts +11 -0
- package/lib/cjs/Merging/Utils.d.ts.map +1 -1
- package/lib/cjs/Merging/Utils.js +22 -2
- package/lib/cjs/Merging/Utils.js.map +1 -1
- package/lib/cjs/Validation/SchemaCompareVisitor.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaCompareVisitor.js +21 -23
- package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
- package/lib/cjs/Validation/SchemaComparer.d.ts +22 -1
- package/lib/cjs/Validation/SchemaComparer.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaComparer.js +25 -3
- package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
- package/package.json +11 -11
|
@@ -17,7 +17,7 @@ const StructClassMerger_1 = require("./StructClassMerger");
|
|
|
17
17
|
const UnitSystemMerger_1 = require("./UnitSystemMerger");
|
|
18
18
|
const PropertyMerger_1 = require("./PropertyMerger");
|
|
19
19
|
const Utils_1 = require("../Differencing/Utils");
|
|
20
|
-
const
|
|
20
|
+
const Utils_2 = require("./Utils");
|
|
21
21
|
/**
|
|
22
22
|
* Implementation of ISchemaDifferenceVisitor that can be used to traverse schema
|
|
23
23
|
* differences to call the appropriated merger methods.
|
|
@@ -30,12 +30,6 @@ class SchemaMergingVisitor {
|
|
|
30
30
|
constructor(context) {
|
|
31
31
|
this._context = context;
|
|
32
32
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Gets a SchemaItemKey for the given item name.
|
|
35
|
-
*/
|
|
36
|
-
toItemKey(itemName) {
|
|
37
|
-
return new ecschema_metadata_1.SchemaItemKey(itemName, this._context.targetSchemaKey);
|
|
38
|
-
}
|
|
39
33
|
/**
|
|
40
34
|
* Shared merging logic for all types of ClassItemDifference union.
|
|
41
35
|
*/
|
|
@@ -65,7 +59,7 @@ class SchemaMergingVisitor {
|
|
|
65
59
|
}
|
|
66
60
|
// Now both a modification change or the second add iteration is a modification of an existing class.
|
|
67
61
|
// So, regardless of the actual change type, modify is called.
|
|
68
|
-
return handler.modify(this._context, entry,
|
|
62
|
+
return handler.modify(this._context, entry, (0, Utils_2.toItemKey)(this._context, entry.itemName));
|
|
69
63
|
},
|
|
70
64
|
modify: handler.modify,
|
|
71
65
|
});
|
|
@@ -135,7 +129,7 @@ class SchemaMergingVisitor {
|
|
|
135
129
|
async visitEnumeratorDifference(entry) {
|
|
136
130
|
switch (entry.changeType) {
|
|
137
131
|
case "add": return (0, EnumeratorMerger_1.addEnumerator)(this._context, entry);
|
|
138
|
-
case "modify": return (0, EnumeratorMerger_1.modifyEnumerator)(this._context, entry,
|
|
132
|
+
case "modify": return (0, EnumeratorMerger_1.modifyEnumerator)(this._context, entry, (0, Utils_2.toItemKey)(this._context, entry.itemName));
|
|
139
133
|
}
|
|
140
134
|
}
|
|
141
135
|
/**
|
|
@@ -248,7 +242,7 @@ class SchemaMergingVisitor {
|
|
|
248
242
|
if ("schemaItemType" in entry.difference && entry.difference.schemaItemType !== entry.schemaType) {
|
|
249
243
|
throw new Error(`Changing the type of item '${entry.itemName}' not supported.`);
|
|
250
244
|
}
|
|
251
|
-
return handler.modify(this._context, entry,
|
|
245
|
+
return handler.modify(this._context, entry, (0, Utils_2.toItemKey)(this._context, entry.itemName));
|
|
252
246
|
}
|
|
253
247
|
;
|
|
254
248
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaMergingVisitor.js","sourceRoot":"","sources":["../../../src/Merging/SchemaMergingVisitor.ts"],"names":[],"mappings":";;;AAKA,qDAA+D;AAC/D,mEAA6D;AAC7D,6EAAmG;AACnG,2DAAwF;AACxF,2DAAwE;AACxE,yDAAqE;AACrE,iEAAwG;AACxG,+CAAgE;AAChE,yDAAqE;AACrE,qEAAuF;AACvF,uEAAyJ;AACzJ,mEAAsF;AACtF,2DAAwE;AACxE,yDAAqE;AACrE,qDAA2D;AAC3D,iDAA0D;AAE1D,gEAAyD;AASzD;;;;GAIG;AACH,MAAa,oBAAoB;IAI/B;;OAEG;IACH,YAAY,OAA2B;QACrC,IAAI,CAAC,QAAQ,GAA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AoB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;YACpD,GAAG,EAAE,kCAAc;YACnB,MAAM,EAAE,qCAAiB;SAC1B,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,mBAAmB,CAAC,MAAsB;QACrD,8BAA8B;IAChC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,yBAAyB,CAAC,KAA2B;QAChE,OAAO,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE;YAC3C,GAAG,EAAE,gCAAa;YAClB,MAAM,EAAE,mCAAgB;SACzB,CAAC,CAAC;IACL,CAAC;IAED;;;MAGE;IACK,KAAK,CAAC,+CAA+C,CAAC,KAAiD;QAC5G,QAAO,KAAK,CAAC,UAAU,EAAE,CAAC;YACxB,KAAK,KAAK,CAAC,CAAC,OAAO,IAAA,4CAAqB,EAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;CACF;AAnTD,oDAmTC;AAED;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,KAA4B,EAAE,SAAkD,EAAE,SAAiB;IACtH,KAAK,IAAI,CAAC,GAAG,SAAS,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9C,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACrB,OAAO,CAAC,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { AnyClassItemDifference, AnySchemaDifference, AnySchemaItemDifference, ClassPropertyDifference, ConstantDifference, CustomAttributeClassDifference, CustomAttributeDifference, EntityClassDifference, EntityClassMixinDifference, EnumerationDifference, EnumeratorDifference, FormatDifference, InvertedUnitDifference, KindOfQuantityDifference, KindOfQuantityPresentationFormatDifference, MixinClassDifference, PhenomenonDifference, PropertyCategoryDifference, RelationshipClassDifference, RelationshipConstraintClassDifference, RelationshipConstraintDifference, SchemaDifference, SchemaReferenceDifference, StructClassDifference, UnitDifference, UnitSystemDifference } from \"../Differencing/SchemaDifference\";\r\nimport { addConstant, modifyConstant } from \"./ConstantMerger\";\r\nimport { addCustomAttribute } from \"./CustomAttributeMerger\";\r\nimport { addCustomAttributeClass, modifyCustomAttributeClass } from \"./CustomAttributeClassMerger\";\r\nimport { addClassMixins, addEntityClass, modifyEntityClass } from \"./EntityClassMerger\";\r\nimport { addEnumeration, modifyEnumeration } from \"./EnumerationMerger\";\r\nimport { addEnumerator, modifyEnumerator } from \"./EnumeratorMerger\";\r\nimport { addKindOfQuantity, addPresentationFormat, modifyKindOfQuantity } from \"./KindOfQuantityMerger\";\r\nimport { addMixinClass, modifyMixinClass } from \"./MixinMerger\";\r\nimport { addPhenomenon, modifyPhenomenon } from \"./PhenomenonMerger\";\r\nimport { addPropertyCategory, modifyPropertyCategory } from \"./PropertyCategoryMerger\";\r\nimport { addRelationshipClass, mergeRelationshipClassConstraint, mergeRelationshipConstraint, modifyRelationshipClass } from \"./RelationshipClassMerger\";\r\nimport { addSchemaReferences, modifySchemaReferences } from \"./SchemaReferenceMerger\";\r\nimport { addStructClass, modifyStructClass } from \"./StructClassMerger\";\r\nimport { addUnitSystem, modifyUnitSystem } from \"./UnitSystemMerger\";\r\nimport { mergePropertyDifference } from \"./PropertyMerger\";\r\nimport { isClassDifference } from \"../Differencing/Utils\";\r\nimport { SchemaDifferenceVisitor } from \"../Differencing/SchemaDifferenceVisitor\";\r\nimport { SchemaItemKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaMergeContext } from \"./SchemaMerger\";\r\n\r\n/** Definition of schema items change type handler array. */\r\ninterface ItemChangeTypeHandler<T extends AnySchemaDifference> {\r\n add: (context: SchemaMergeContext, entry: T) => Promise<void>;\r\n modify: (context: SchemaMergeContext, entry: T, key: SchemaItemKey) => Promise<void>;\r\n}\r\n\r\n/**\r\n * Implementation of ISchemaDifferenceVisitor that can be used to traverse schema\r\n * differences to call the appropriated merger methods.\r\n * @internal\r\n */\r\nexport class SchemaMergingVisitor implements SchemaDifferenceVisitor {\r\n\r\n private readonly _context: SchemaMergeContext;\r\n\r\n /**\r\n * Initializes a new instance of SchemaMergingVisitor class.\r\n */\r\n constructor(context: SchemaMergeContext) {\r\n this._context = context;\r\n }\r\n\r\n /**\r\n * Gets a SchemaItemKey for the given item name.\r\n */\r\n private toItemKey(itemName: string): SchemaItemKey {\r\n return new SchemaItemKey(itemName, this._context.targetSchemaKey);\r\n }\r\n\r\n /**\r\n * Shared merging logic for all types of ClassItemDifference union.\r\n */\r\n private async visitClassDifference<T extends AnyClassItemDifference>(entry: T, index: number, array: AnySchemaDifference[], handler: ItemChangeTypeHandler<T>) {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: async (context) => {\r\n // To add classes a slightly different approach is done. In fact the class entries gets processed\r\n // two times. The first time, a stub with the bare minimum is added to the schema. The second time,\r\n // the class gets completed with all properties, mixins, etc...\r\n if(entry.changeType === \"add\" && !await context.targetSchema.getItem(entry.itemName)) {\r\n await handler.add(this._context, {\r\n ...entry,\r\n difference: {\r\n ...entry.difference,\r\n // Remove everything we want to validate before setting, this is done in the second iteration.\r\n baseClass: undefined,\r\n mixins: undefined,\r\n properties: undefined,\r\n customAttributes: undefined,\r\n },\r\n });\r\n\r\n // Searches for the last class difference and adds the entry after it. That way,\r\n // the class is completed before class related entries get processed.\r\n const insertIndex = findIndexOf(array, (e) => !isClassDifference(e), index) || array.length;\r\n array.splice(insertIndex, 0, entry);\r\n\r\n return;\r\n }\r\n\r\n // Now both a modification change or the second add iteration is a modification of an existing class.\r\n // So, regardless of the actual change type, modify is called.\r\n return handler.modify(this._context, entry, this.toItemKey(entry.itemName));\r\n },\r\n modify: handler.modify,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling ConstantDifference.\r\n * @internal\r\n */\r\n public async visitConstantDifference(entry: ConstantDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addConstant,\r\n modify: modifyConstant,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling CustomAttributeClassDifference.\r\n * @internal\r\n */\r\n public async visitCustomAttributeClassDifference(entry: CustomAttributeClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\r\n return this.visitClassDifference(entry, index, array, {\r\n add: addCustomAttributeClass,\r\n modify: modifyCustomAttributeClass,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling CustomAttributeDifference.\r\n * @internal\r\n */\r\n public async visitCustomAttributeInstanceDifference(entry: CustomAttributeDifference): Promise<void> {\r\n switch(entry.changeType) {\r\n case \"add\": return addCustomAttribute(this._context, entry);\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling EntityClassDifference.\r\n * @internal\r\n */\r\n public async visitEntityClassDifference(entry: EntityClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\r\n return this.visitClassDifference(entry, index, array, {\r\n add: addEntityClass,\r\n modify: modifyEntityClass,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling EntityClassMixinDifference.\r\n * @internal\r\n */\r\n public async visitEntityClassMixinDifference(entry: EntityClassMixinDifference): Promise<void> {\r\n switch(entry.changeType) {\r\n case \"add\": return addClassMixins(this._context, entry);\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling EnumerationDifference.\r\n * @internal\r\n */\r\n public async visitEnumerationDifference(entry: EnumerationDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addEnumeration,\r\n modify: modifyEnumeration,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling EnumeratorDifference.\r\n * @internal\r\n */\r\n public async visitEnumeratorDifference(entry: EnumeratorDifference): Promise<void> {\r\n switch(entry.changeType) {\r\n case \"add\": return addEnumerator(this._context, entry);\r\n case \"modify\": return modifyEnumerator(this._context, entry, this.toItemKey(entry.itemName));\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling FormatDifference.\r\n * @internal\r\n */\r\n public async visitFormatDifference(_entry: FormatDifference): Promise<void> {\r\n // TODO: Add merger handler...\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling InvertedUnitDifference.\r\n * @internal\r\n */\r\n public async visitInvertedUnitDifference(_entry: InvertedUnitDifference): Promise<void> {\r\n // TODO: Add merger handler...\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling KindOfQuantityDifference.\r\n * @internal\r\n */\r\n public async visitKindOfQuantityDifference(entry: KindOfQuantityDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addKindOfQuantity,\r\n modify: modifyKindOfQuantity,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling MixinClassDifference.\r\n * @internal\r\n */\r\n public async visitMixinDifference(entry: MixinClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\r\n return this.visitClassDifference(entry, index, array, {\r\n add: addMixinClass,\r\n modify: modifyMixinClass,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling PhenomenonDifference.\r\n * @internal\r\n */\r\n public async visitPhenomenonDifference(entry: PhenomenonDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addPhenomenon,\r\n modify: modifyPhenomenon,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling PropertyCategoryDifference.\r\n * @internal\r\n */\r\n public async visitPropertyCategoryDifference(entry: PropertyCategoryDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addPropertyCategory,\r\n modify: modifyPropertyCategory,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling ClassPropertyDifference.\r\n * @internal\r\n */\r\n public async visitPropertyDifference(entry: ClassPropertyDifference): Promise<void> {\r\n await mergePropertyDifference(this._context, entry);\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling RelationshipClassDifference.\r\n * @internal\r\n */\r\n public async visitRelationshipClassDifference(entry: RelationshipClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\r\n return this.visitClassDifference(entry, index, array, {\r\n add: addRelationshipClass,\r\n modify: modifyRelationshipClass,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling RelationshipConstraintClassDifference.\r\n * @internal\r\n */\r\n public async visitRelationshipConstraintClassDifference(entry: RelationshipConstraintClassDifference): Promise<void> {\r\n await mergeRelationshipClassConstraint(this._context, entry);\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling RelationshipConstraintDifference.\r\n * @internal\r\n */\r\n public async visitRelationshipConstraintDifference(entry: RelationshipConstraintDifference): Promise<void> {\r\n await mergeRelationshipConstraint(this._context, entry);\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling SchemaDifference.\r\n * @internal\r\n */\r\n public async visitSchemaDifference({ difference }: SchemaDifference): Promise<void> {\r\n if (difference.label !== undefined) {\r\n await this._context.editor.setDisplayLabel(this._context.targetSchemaKey, difference.label);\r\n }\r\n if (difference.description !== undefined) {\r\n await this._context.editor.setDescription(this._context.targetSchemaKey, difference.description);\r\n }\r\n }\r\n\r\n /**\r\n * Shared merging logic for all types of AnySchemaItemDifference union.\r\n */\r\n private async visitSchemaItemDifference<T extends AnySchemaItemDifference>(entry: T, handler: ItemChangeTypeHandler<T>) {\r\n switch(entry.changeType) {\r\n case \"add\": {\r\n return handler.add(this._context, entry);\r\n }\r\n case \"modify\": {\r\n if(\"schemaItemType\" in entry.difference && entry.difference.schemaItemType !== entry.schemaType) {\r\n throw new Error(`Changing the type of item '${entry.itemName}' not supported.`);\r\n }\r\n\r\n return handler.modify(this._context, entry, this.toItemKey(entry.itemName));\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling SchemaReferenceDifference.\r\n * @internal\r\n */\r\n public async visitSchemaReferenceDifference(entry: SchemaReferenceDifference): Promise<void> {\r\n switch(entry.changeType) {\r\n case \"add\": return addSchemaReferences(this._context, entry);\r\n case \"modify\": return modifySchemaReferences(this._context, entry);\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling StructClassDifference.\r\n * @internal\r\n */\r\n public async visitStructClassDifference(entry: StructClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\r\n return this.visitClassDifference(entry, index, array, {\r\n add: addStructClass,\r\n modify: modifyStructClass,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling UnitDifference.\r\n * @internal\r\n */\r\n public async visitUnitDifference(_entry: UnitDifference): Promise<void> {\r\n // TODO: Add merger handler...\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling UnitSystemDifference.\r\n * @internal\r\n */\r\n public async visitUnitSystemDifference(entry: UnitSystemDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addUnitSystem,\r\n modify: modifyUnitSystem,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling KindOfQuantityPresentationFormatDifference.\r\n * @internal\r\n */\r\n public async visitKindOfQuantityPresentationFormatDifference(entry: KindOfQuantityPresentationFormatDifference): Promise<void> {\r\n switch(entry.changeType) {\r\n case \"add\": return addPresentationFormat(this._context, entry);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Helper method to get the index of the first element in the array that satisfies the provided testing function.\r\n * @param array Array to search.\r\n * @param predicate Function to execute on each value in the array.\r\n * @param fromIndex The index to start the search at.\r\n * @returns An index in the array if an element passes the test; otherwise, false.\r\n */\r\nfunction findIndexOf(array: AnySchemaDifference[], predicate: (entry: AnySchemaDifference) => boolean, fromIndex: number) {\r\n for (let i = fromIndex; i < array.length; i++) {\r\n if (predicate(array[i]))\r\n return i;\r\n }\r\n return false;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaMergingVisitor.js","sourceRoot":"","sources":["../../../src/Merging/SchemaMergingVisitor.ts"],"names":[],"mappings":";;;AAKA,qDAA+D;AAC/D,mEAA6D;AAC7D,6EAAmG;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D,KAAK,QAAQ,CAAC,CAAC,OAAO,IAAA,8CAAsB,EAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,0BAA0B,CAAC,KAA4B,EAAE,KAAa,EAAE,KAA4B;QAC/G,OAAO,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;YACpD,GAAG,EAAE,kCAAc;YACnB,MAAM,EAAE,qCAAiB;SAC1B,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,mBAAmB,CAAC,MAAsB;QACrD,8BAA8B;IAChC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,yBAAyB,CAAC,KAA2B;QAChE,OAAO,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE;YAC3C,GAAG,EAAE,gCAAa;YAClB,MAAM,EAAE,mCAAgB;SACzB,CAAC,CAAC;IACL,CAAC;IAED;;;MAGE;IACK,KAAK,CAAC,+CAA+C,CAAC,KAAiD;QAC5G,QAAO,KAAK,CAAC,UAAU,EAAE,CAAC;YACxB,KAAK,KAAK,CAAC,CAAC,OAAO,IAAA,4CAAqB,EAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;CACF;AA5SD,oDA4SC;AAED;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,KAA4B,EAAE,SAAkD,EAAE,SAAiB;IACtH,KAAK,IAAI,CAAC,GAAG,SAAS,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9C,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACrB,OAAO,CAAC,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { AnyClassItemDifference, AnySchemaDifference, AnySchemaItemDifference, ClassPropertyDifference, ConstantDifference, CustomAttributeClassDifference, CustomAttributeDifference, EntityClassDifference, EntityClassMixinDifference, EnumerationDifference, EnumeratorDifference, FormatDifference, InvertedUnitDifference, KindOfQuantityDifference, KindOfQuantityPresentationFormatDifference, MixinClassDifference, PhenomenonDifference, PropertyCategoryDifference, RelationshipClassDifference, RelationshipConstraintClassDifference, RelationshipConstraintDifference, SchemaDifference, SchemaReferenceDifference, StructClassDifference, UnitDifference, UnitSystemDifference } from \"../Differencing/SchemaDifference\";\r\nimport { addConstant, modifyConstant } from \"./ConstantMerger\";\r\nimport { addCustomAttribute } from \"./CustomAttributeMerger\";\r\nimport { addCustomAttributeClass, modifyCustomAttributeClass } from \"./CustomAttributeClassMerger\";\r\nimport { addClassMixins, addEntityClass, modifyEntityClass } from \"./EntityClassMerger\";\r\nimport { addEnumeration, modifyEnumeration } from \"./EnumerationMerger\";\r\nimport { addEnumerator, modifyEnumerator } from \"./EnumeratorMerger\";\r\nimport { addKindOfQuantity, addPresentationFormat, modifyKindOfQuantity } from \"./KindOfQuantityMerger\";\r\nimport { addMixinClass, modifyMixinClass } from \"./MixinMerger\";\r\nimport { addPhenomenon, modifyPhenomenon } from \"./PhenomenonMerger\";\r\nimport { addPropertyCategory, modifyPropertyCategory } from \"./PropertyCategoryMerger\";\r\nimport { addRelationshipClass, mergeRelationshipClassConstraint, mergeRelationshipConstraint, modifyRelationshipClass } from \"./RelationshipClassMerger\";\r\nimport { addSchemaReferences, modifySchemaReferences } from \"./SchemaReferenceMerger\";\r\nimport { addStructClass, modifyStructClass } from \"./StructClassMerger\";\r\nimport { addUnitSystem, modifyUnitSystem } from \"./UnitSystemMerger\";\r\nimport { mergePropertyDifference } from \"./PropertyMerger\";\r\nimport { isClassDifference } from \"../Differencing/Utils\";\r\nimport { SchemaDifferenceVisitor } from \"../Differencing/SchemaDifferenceVisitor\";\r\nimport { SchemaItemKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaMergeContext } from \"./SchemaMerger\";\r\nimport { toItemKey } from \"./Utils\";\r\n\r\n/** Definition of schema items change type handler array. */\r\ninterface ItemChangeTypeHandler<T extends AnySchemaDifference> {\r\n add: (context: SchemaMergeContext, entry: T) => Promise<void>;\r\n modify: (context: SchemaMergeContext, entry: T, key: SchemaItemKey) => Promise<void>;\r\n}\r\n\r\n/**\r\n * Implementation of ISchemaDifferenceVisitor that can be used to traverse schema\r\n * differences to call the appropriated merger methods.\r\n * @internal\r\n */\r\nexport class SchemaMergingVisitor implements SchemaDifferenceVisitor {\r\n\r\n private readonly _context: SchemaMergeContext;\r\n\r\n /**\r\n * Initializes a new instance of SchemaMergingVisitor class.\r\n */\r\n constructor(context: SchemaMergeContext) {\r\n this._context = context;\r\n }\r\n\r\n /**\r\n * Shared merging logic for all types of ClassItemDifference union.\r\n */\r\n private async visitClassDifference<T extends AnyClassItemDifference>(entry: T, index: number, array: AnySchemaDifference[], handler: ItemChangeTypeHandler<T>) {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: async (context) => {\r\n // To add classes a slightly different approach is done. In fact the class entries gets processed\r\n // two times. The first time, a stub with the bare minimum is added to the schema. The second time,\r\n // the class gets completed with all properties, mixins, etc...\r\n if(entry.changeType === \"add\" && !await context.targetSchema.getItem(entry.itemName)) {\r\n await handler.add(this._context, {\r\n ...entry,\r\n difference: {\r\n ...entry.difference,\r\n // Remove everything we want to validate before setting, this is done in the second iteration.\r\n baseClass: undefined,\r\n mixins: undefined,\r\n properties: undefined,\r\n customAttributes: undefined,\r\n },\r\n });\r\n\r\n // Searches for the last class difference and adds the entry after it. That way,\r\n // the class is completed before class related entries get processed.\r\n const insertIndex = findIndexOf(array, (e) => !isClassDifference(e), index) || array.length;\r\n array.splice(insertIndex, 0, entry);\r\n\r\n return;\r\n }\r\n\r\n // Now both a modification change or the second add iteration is a modification of an existing class.\r\n // So, regardless of the actual change type, modify is called.\r\n return handler.modify(this._context, entry, toItemKey(this._context, entry.itemName));\r\n },\r\n modify: handler.modify,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling ConstantDifference.\r\n * @internal\r\n */\r\n public async visitConstantDifference(entry: ConstantDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addConstant,\r\n modify: modifyConstant,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling CustomAttributeClassDifference.\r\n * @internal\r\n */\r\n public async visitCustomAttributeClassDifference(entry: CustomAttributeClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\r\n return this.visitClassDifference(entry, index, array, {\r\n add: addCustomAttributeClass,\r\n modify: modifyCustomAttributeClass,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling CustomAttributeDifference.\r\n * @internal\r\n */\r\n public async visitCustomAttributeInstanceDifference(entry: CustomAttributeDifference): Promise<void> {\r\n switch(entry.changeType) {\r\n case \"add\": return addCustomAttribute(this._context, entry);\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling EntityClassDifference.\r\n * @internal\r\n */\r\n public async visitEntityClassDifference(entry: EntityClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\r\n return this.visitClassDifference(entry, index, array, {\r\n add: addEntityClass,\r\n modify: modifyEntityClass,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling EntityClassMixinDifference.\r\n * @internal\r\n */\r\n public async visitEntityClassMixinDifference(entry: EntityClassMixinDifference): Promise<void> {\r\n switch(entry.changeType) {\r\n case \"add\": return addClassMixins(this._context, entry);\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling EnumerationDifference.\r\n * @internal\r\n */\r\n public async visitEnumerationDifference(entry: EnumerationDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addEnumeration,\r\n modify: modifyEnumeration,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling EnumeratorDifference.\r\n * @internal\r\n */\r\n public async visitEnumeratorDifference(entry: EnumeratorDifference): Promise<void> {\r\n switch(entry.changeType) {\r\n case \"add\": return addEnumerator(this._context, entry);\r\n case \"modify\": return modifyEnumerator(this._context, entry, toItemKey(this._context, entry.itemName));\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling FormatDifference.\r\n * @internal\r\n */\r\n public async visitFormatDifference(_entry: FormatDifference): Promise<void> {\r\n // TODO: Add merger handler...\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling InvertedUnitDifference.\r\n * @internal\r\n */\r\n public async visitInvertedUnitDifference(_entry: InvertedUnitDifference): Promise<void> {\r\n // TODO: Add merger handler...\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling KindOfQuantityDifference.\r\n * @internal\r\n */\r\n public async visitKindOfQuantityDifference(entry: KindOfQuantityDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addKindOfQuantity,\r\n modify: modifyKindOfQuantity,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling MixinClassDifference.\r\n * @internal\r\n */\r\n public async visitMixinDifference(entry: MixinClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\r\n return this.visitClassDifference(entry, index, array, {\r\n add: addMixinClass,\r\n modify: modifyMixinClass,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling PhenomenonDifference.\r\n * @internal\r\n */\r\n public async visitPhenomenonDifference(entry: PhenomenonDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addPhenomenon,\r\n modify: modifyPhenomenon,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling PropertyCategoryDifference.\r\n * @internal\r\n */\r\n public async visitPropertyCategoryDifference(entry: PropertyCategoryDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addPropertyCategory,\r\n modify: modifyPropertyCategory,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling ClassPropertyDifference.\r\n * @internal\r\n */\r\n public async visitPropertyDifference(entry: ClassPropertyDifference): Promise<void> {\r\n await mergePropertyDifference(this._context, entry);\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling RelationshipClassDifference.\r\n * @internal\r\n */\r\n public async visitRelationshipClassDifference(entry: RelationshipClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\r\n return this.visitClassDifference(entry, index, array, {\r\n add: addRelationshipClass,\r\n modify: modifyRelationshipClass,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling RelationshipConstraintClassDifference.\r\n * @internal\r\n */\r\n public async visitRelationshipConstraintClassDifference(entry: RelationshipConstraintClassDifference): Promise<void> {\r\n await mergeRelationshipClassConstraint(this._context, entry);\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling RelationshipConstraintDifference.\r\n * @internal\r\n */\r\n public async visitRelationshipConstraintDifference(entry: RelationshipConstraintDifference): Promise<void> {\r\n await mergeRelationshipConstraint(this._context, entry);\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling SchemaDifference.\r\n * @internal\r\n */\r\n public async visitSchemaDifference({ difference }: SchemaDifference): Promise<void> {\r\n if (difference.label !== undefined) {\r\n await this._context.editor.setDisplayLabel(this._context.targetSchemaKey, difference.label);\r\n }\r\n if (difference.description !== undefined) {\r\n await this._context.editor.setDescription(this._context.targetSchemaKey, difference.description);\r\n }\r\n }\r\n\r\n /**\r\n * Shared merging logic for all types of AnySchemaItemDifference union.\r\n */\r\n private async visitSchemaItemDifference<T extends AnySchemaItemDifference>(entry: T, handler: ItemChangeTypeHandler<T>) {\r\n switch(entry.changeType) {\r\n case \"add\": {\r\n return handler.add(this._context, entry);\r\n }\r\n case \"modify\": {\r\n if(\"schemaItemType\" in entry.difference && entry.difference.schemaItemType !== entry.schemaType) {\r\n throw new Error(`Changing the type of item '${entry.itemName}' not supported.`);\r\n }\r\n\r\n return handler.modify(this._context, entry, toItemKey(this._context, entry.itemName));\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling SchemaReferenceDifference.\r\n * @internal\r\n */\r\n public async visitSchemaReferenceDifference(entry: SchemaReferenceDifference): Promise<void> {\r\n switch(entry.changeType) {\r\n case \"add\": return addSchemaReferences(this._context, entry);\r\n case \"modify\": return modifySchemaReferences(this._context, entry);\r\n }\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling StructClassDifference.\r\n * @internal\r\n */\r\n public async visitStructClassDifference(entry: StructClassDifference, index: number, array: AnySchemaDifference[]): Promise<void> {\r\n return this.visitClassDifference(entry, index, array, {\r\n add: addStructClass,\r\n modify: modifyStructClass,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling UnitDifference.\r\n * @internal\r\n */\r\n public async visitUnitDifference(_entry: UnitDifference): Promise<void> {\r\n // TODO: Add merger handler...\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling UnitSystemDifference.\r\n * @internal\r\n */\r\n public async visitUnitSystemDifference(entry: UnitSystemDifference): Promise<void> {\r\n return this.visitSchemaItemDifference(entry, {\r\n add: addUnitSystem,\r\n modify: modifyUnitSystem,\r\n });\r\n }\r\n\r\n /**\r\n * Visitor implementation for handling KindOfQuantityPresentationFormatDifference.\r\n * @internal\r\n */\r\n public async visitKindOfQuantityPresentationFormatDifference(entry: KindOfQuantityPresentationFormatDifference): Promise<void> {\r\n switch(entry.changeType) {\r\n case \"add\": return addPresentationFormat(this._context, entry);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Helper method to get the index of the first element in the array that satisfies the provided testing function.\r\n * @param array Array to search.\r\n * @param predicate Function to execute on each value in the array.\r\n * @param fromIndex The index to start the search at.\r\n * @returns An index in the array if an element passes the test; otherwise, false.\r\n */\r\nfunction findIndexOf(array: AnySchemaDifference[], predicate: (entry: AnySchemaDifference) => boolean, fromIndex: number) {\r\n for (let i = fromIndex; i < array.length; i++) {\r\n if (predicate(array[i]))\r\n return i;\r\n }\r\n return false;\r\n}\r\n"]}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { ECClasses } from "../Editing/ECClasses";
|
|
2
|
+
import { PropertyKey } from "./Edits/NameMapping";
|
|
2
3
|
import type { SchemaMergeContext } from "./SchemaMerger";
|
|
3
4
|
import { ECClass, SchemaItem, SchemaItemKey } from "@itwin/ecschema-metadata";
|
|
5
|
+
/**
|
|
6
|
+
* Resolves a SchemaItemKey for the given item name.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare function toItemKey(context: SchemaMergeContext, itemName: string): SchemaItemKey;
|
|
10
|
+
/**
|
|
11
|
+
* Resolves a SchemaItemKey for the given class property name.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare function toPropertyKey(context: SchemaMergeContext, itemName: string, propertyName: string): PropertyKey;
|
|
4
15
|
/**
|
|
5
16
|
* Convenience-method around updateSchemaItemKey that returns the full name instead of a SchemaItemKey.
|
|
6
17
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/Merging/Utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAkD,UAAU,EAAE,aAAa,EAAkB,MAAM,0BAA0B,CAAC;AAE9I;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,mBAG5F;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/Merging/Utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAkD,UAAU,EAAE,aAAa,EAAkB,MAAM,0BAA0B,CAAC;AAE9I;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,GAAG,aAAa,CAGtF;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,WAAW,CAG9G;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,mBAG5F;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,0BAavF;AAgBD;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,uBAQvG;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,OAAO,GAAG,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC,CAmBtH"}
|
package/lib/cjs/Merging/Utils.js
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toItemKey = toItemKey;
|
|
4
|
+
exports.toPropertyKey = toPropertyKey;
|
|
3
5
|
exports.updateSchemaItemFullName = updateSchemaItemFullName;
|
|
4
6
|
exports.updateSchemaItemKey = updateSchemaItemKey;
|
|
5
7
|
exports.locateSchemaItem = locateSchemaItem;
|
|
6
8
|
exports.getClassEditor = getClassEditor;
|
|
9
|
+
const NameMapping_1 = require("./Edits/NameMapping");
|
|
7
10
|
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
11
|
+
/**
|
|
12
|
+
* Resolves a SchemaItemKey for the given item name.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
function toItemKey(context, itemName) {
|
|
16
|
+
const classKey = context.nameMapping.resolveItemKey(new ecschema_metadata_1.SchemaItemKey(itemName, context.sourceSchemaKey));
|
|
17
|
+
return new ecschema_metadata_1.SchemaItemKey(classKey.name, context.targetSchemaKey);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolves a SchemaItemKey for the given class property name.
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
function toPropertyKey(context, itemName, propertyName) {
|
|
24
|
+
const classKey = new ecschema_metadata_1.SchemaItemKey(itemName, context.sourceSchemaKey);
|
|
25
|
+
return context.nameMapping.resolvePropertyKey(new NameMapping_1.PropertyKey(propertyName, classKey));
|
|
26
|
+
}
|
|
8
27
|
/**
|
|
9
28
|
* Convenience-method around updateSchemaItemKey that returns the full name instead of a SchemaItemKey.
|
|
10
29
|
* @internal
|
|
@@ -21,7 +40,8 @@ async function updateSchemaItemFullName(context, reference) {
|
|
|
21
40
|
async function updateSchemaItemKey(context, reference) {
|
|
22
41
|
const [schemaName, itemName] = ecschema_metadata_1.SchemaItem.parseFullName(reference);
|
|
23
42
|
if (context.sourceSchemaKey.compareByName(schemaName)) {
|
|
24
|
-
|
|
43
|
+
const schemaItemKey = toItemKey(context, itemName);
|
|
44
|
+
return resolveSchemaItemKey(context.editor.schemaContext, schemaItemKey);
|
|
25
45
|
}
|
|
26
46
|
const referencedSchema = await context.targetSchema.getReference(schemaName);
|
|
27
47
|
if (referencedSchema !== undefined) {
|
|
@@ -46,7 +66,7 @@ async function resolveSchemaItemKey(schemaContext, itemKey) {
|
|
|
46
66
|
* @internal
|
|
47
67
|
*/
|
|
48
68
|
async function locateSchemaItem(context, itemName, schemaType) {
|
|
49
|
-
const schemaItemKey =
|
|
69
|
+
const schemaItemKey = toItemKey(context, itemName);
|
|
50
70
|
const schemaItem = await context.editor.schemaContext.getSchemaItem(schemaItemKey);
|
|
51
71
|
if (schemaItem === undefined) {
|
|
52
72
|
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.ClassNotFound, `${schemaType} ${schemaItemKey.fullName} not found in schema context.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/Merging/Utils.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/Merging/Utils.ts"],"names":[],"mappings":";;AAaA,8BAGC;AAMD,sCAGC;AAMD,4DAGC;AAOD,kDAaC;AAmBD,4CAQC;AAKD,wCAmBC;AApGD,qDAAkD;AAElD,gEAA8I;AAE9I;;;GAGG;AACH,SAAgB,SAAS,CAAC,OAA2B,EAAE,QAAgB;IACrE,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,iCAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC;IAC1G,OAAO,IAAI,iCAAa,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;AACnE,CAAC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,OAA2B,EAAE,QAAgB,EAAE,YAAoB;IAC/F,MAAM,QAAQ,GAAG,IAAI,iCAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACtE,OAAO,OAAO,CAAC,WAAW,CAAC,kBAAkB,CAAC,IAAI,yBAAW,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzF,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,wBAAwB,CAAC,OAA2B,EAAE,SAAiB;IAC3F,MAAM,aAAa,GAAG,MAAM,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACpE,OAAO,a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AAO,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;IACnF,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,aAAa,EAAE,GAAG,UAAU,IAAI,aAAa,CAAC,QAAQ,+BAA+B,CAAC,CAAC;IAClI,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,cAAc,CAAC,OAA2B,EAAE,OAAgC;IAChG,MAAM,cAAc,GAAG,2BAAO,CAAC,SAAS,CAAC,OAAO,CAAC;QAC/C,CAAC,CAAC,OAAO,CAAC,cAAc;QACxB,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,CAAU,OAAO,CAAC,CAAC,EAAE,cAAc,CAAC;IAEzF,QAAO,cAAc,EAAE,CAAC;QACtB,KAAK,kCAAc,CAAC,WAAW;YAC7B,OAAO,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;QACjC,KAAK,kCAAc,CAAC,KAAK;YACvB,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;QAC/B,KAAK,kCAAc,CAAC,WAAW;YAC7B,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;QAChC,KAAK,kCAAc,CAAC,oBAAoB;YACtC,OAAO,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC;QACzC,KAAK,kCAAc,CAAC,iBAAiB;YACnC,OAAO,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC;QACtC;YACE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACpD,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { ECClasses } from \"../Editing/ECClasses\";\r\nimport { PropertyKey } from \"./Edits/NameMapping\";\r\nimport type { SchemaMergeContext } from \"./SchemaMerger\";\r\nimport { ECClass, ECObjectsError, ECObjectsStatus, SchemaContext, SchemaItem, SchemaItemKey, SchemaItemType } from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * Resolves a SchemaItemKey for the given item name.\r\n * @internal\r\n */\r\nexport function toItemKey(context: SchemaMergeContext, itemName: string): SchemaItemKey {\r\n const classKey = context.nameMapping.resolveItemKey(new SchemaItemKey(itemName, context.sourceSchemaKey));\r\n return new SchemaItemKey(classKey.name, context.targetSchemaKey);\r\n}\r\n\r\n/**\r\n * Resolves a SchemaItemKey for the given class property name.\r\n * @internal\r\n */\r\nexport function toPropertyKey(context: SchemaMergeContext, itemName: string, propertyName: string): PropertyKey {\r\n const classKey = new SchemaItemKey(itemName, context.sourceSchemaKey);\r\n return context.nameMapping.resolvePropertyKey(new PropertyKey(propertyName, classKey));\r\n}\r\n\r\n/**\r\n * Convenience-method around updateSchemaItemKey that returns the full name instead of a SchemaItemKey.\r\n * @internal\r\n */\r\nexport async function updateSchemaItemFullName(context: SchemaMergeContext, reference: string) {\r\n const schemaItemKey = await updateSchemaItemKey(context, reference);\r\n return schemaItemKey.fullName;\r\n}\r\n\r\n/**\r\n * Updates the given reference if it refers to a SchemaItem in the source Schema and\r\n * returns a SchemaItemKey. If any other schema is referred the reference is not change.\r\n * @internal\r\n */\r\nexport async function updateSchemaItemKey(context: SchemaMergeContext, reference: string) {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(reference);\r\n if (context.sourceSchemaKey.compareByName(schemaName)) {\r\n const schemaItemKey = toItemKey(context, itemName);\r\n return resolveSchemaItemKey(context.editor.schemaContext, schemaItemKey);\r\n }\r\n\r\n const referencedSchema = await context.targetSchema.getReference(schemaName);\r\n if (referencedSchema !== undefined) {\r\n return resolveSchemaItemKey(context.editor.schemaContext, new SchemaItemKey(itemName, referencedSchema.schemaKey));\r\n }\r\n\r\n throw new Error(`Cannot locate referenced schema item ${reference}`);\r\n}\r\n\r\n/**\r\n * To support case insensitivity for schema items, the given key is checked if there\r\n * exists an item for it.\r\n * @internal\r\n */\r\nasync function resolveSchemaItemKey(schemaContext: SchemaContext, itemKey: SchemaItemKey): Promise<SchemaItemKey> {\r\n const item = await schemaContext.getSchemaItem(itemKey);\r\n if (item === undefined) {\r\n // If the schema item hasn't been created yet, we have to trust the given key is correctly spelled.\r\n return itemKey;\r\n }\r\n return item.key;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport async function locateSchemaItem(context: SchemaMergeContext, itemName: string, schemaType: string) {\r\n const schemaItemKey = toItemKey(context, itemName);\r\n const schemaItem = await context.editor.schemaContext.getSchemaItem(schemaItemKey);\r\n if (schemaItem === undefined) {\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `${schemaType} ${schemaItemKey.fullName} not found in schema context.`);\r\n }\r\n\r\n return schemaItem;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport async function getClassEditor(context: SchemaMergeContext, ecClass: ECClass | SchemaItemKey): Promise<ECClasses> {\r\n const schemaItemType = ECClass.isECClass(ecClass)\r\n ? ecClass.schemaItemType\r\n : (await context.editor.schemaContext.getSchemaItem<ECClass>(ecClass))?.schemaItemType;\r\n\r\n switch(schemaItemType) {\r\n case SchemaItemType.EntityClass:\r\n return context.editor.entities;\r\n case SchemaItemType.Mixin:\r\n return context.editor.mixins;\r\n case SchemaItemType.StructClass:\r\n return context.editor.structs;\r\n case SchemaItemType.CustomAttributeClass:\r\n return context.editor.customAttributes;\r\n case SchemaItemType.RelationshipClass:\r\n return context.editor.relationships;\r\n default:\r\n throw new Error(\"SchemaItemType not supported\");\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaCompareVisitor.d.ts","sourceRoot":"","sources":["../../../src/Validation/SchemaCompareVisitor.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EA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
|
+
const schemaItemB = await this._schemaComparer.resolveItem(schemaItemA, this._schemaB);
|
|
39
39
|
this._schemaComparer.compareSchemaItems(schemaItemA, schemaItemB);
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
@@ -43,7 +43,7 @@ class SchemaCompareVisitor {
|
|
|
43
43
|
* @param ecClass an ECClass object.
|
|
44
44
|
*/
|
|
45
45
|
async visitClass(classA) {
|
|
46
|
-
const classB = await this.
|
|
46
|
+
const classB = await this._schemaComparer.resolveItem(classA, this._schemaB);
|
|
47
47
|
if (classB && classA.schemaItemType === classB.schemaItemType)
|
|
48
48
|
this._schemaComparer.compareClasses(classA, classB);
|
|
49
49
|
}
|
|
@@ -53,9 +53,9 @@ class SchemaCompareVisitor {
|
|
|
53
53
|
*/
|
|
54
54
|
async visitProperty(propertyA) {
|
|
55
55
|
let propertyB;
|
|
56
|
-
const classB = await this.
|
|
56
|
+
const classB = await this._schemaComparer.resolveItem(propertyA.class, this._schemaB);
|
|
57
57
|
if (classB && propertyA.class.schemaItemType === classB.schemaItemType) {
|
|
58
|
-
propertyB = await
|
|
58
|
+
propertyB = await this._schemaComparer.resolveProperty(propertyA, classB);
|
|
59
59
|
this._schemaComparer.compareProperties(propertyA, propertyB);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -64,7 +64,7 @@ class SchemaCompareVisitor {
|
|
|
64
64
|
* @param entityClass an EntityClass object.
|
|
65
65
|
*/
|
|
66
66
|
async visitEntityClass(entityA) {
|
|
67
|
-
const entityB = await this.
|
|
67
|
+
const entityB = await this._schemaComparer.resolveItem(entityA, this._schemaB);
|
|
68
68
|
if (entityB && entityB.schemaItemType === ecschema_metadata_1.SchemaItemType.EntityClass)
|
|
69
69
|
this._schemaComparer.compareEntityClasses(entityA, entityB);
|
|
70
70
|
}
|
|
@@ -80,7 +80,7 @@ class SchemaCompareVisitor {
|
|
|
80
80
|
* @param mixin a Mixin object.
|
|
81
81
|
*/
|
|
82
82
|
async visitMixin(mixinA) {
|
|
83
|
-
const mixinB = await this.
|
|
83
|
+
const mixinB = await this._schemaComparer.resolveItem(mixinA, this._schemaB);
|
|
84
84
|
if (mixinB && mixinB.schemaItemType === ecschema_metadata_1.SchemaItemType.Mixin)
|
|
85
85
|
this._schemaComparer.compareMixins(mixinA, mixinB);
|
|
86
86
|
}
|
|
@@ -89,7 +89,7 @@ class SchemaCompareVisitor {
|
|
|
89
89
|
* @param relationshipClass a RelationshipClass object.
|
|
90
90
|
*/
|
|
91
91
|
async visitRelationshipClass(relationshipA) {
|
|
92
|
-
const relationshipB = await this.
|
|
92
|
+
const relationshipB = await this._schemaComparer.resolveItem(relationshipA, this._schemaB);
|
|
93
93
|
if (relationshipB && relationshipB.schemaItemType === ecschema_metadata_1.SchemaItemType.RelationshipClass)
|
|
94
94
|
this._schemaComparer.compareRelationshipClasses(relationshipA, relationshipB);
|
|
95
95
|
}
|
|
@@ -99,7 +99,7 @@ class SchemaCompareVisitor {
|
|
|
99
99
|
*/
|
|
100
100
|
async visitRelationshipConstraint(constraintA) {
|
|
101
101
|
let constraintB;
|
|
102
|
-
const relationshipB = await this.
|
|
102
|
+
const relationshipB = await this._schemaComparer.resolveItem(constraintA.relationshipClass, this._schemaB);
|
|
103
103
|
if (relationshipB && relationshipB.schemaItemType === ecschema_metadata_1.SchemaItemType.RelationshipClass) {
|
|
104
104
|
constraintB = constraintA.isSource ? relationshipB.source : relationshipB.target;
|
|
105
105
|
if (constraintB) {
|
|
@@ -112,7 +112,7 @@ class SchemaCompareVisitor {
|
|
|
112
112
|
* @param customAttributeClass a CustomAttributeClass object.
|
|
113
113
|
*/
|
|
114
114
|
async visitCustomAttributeClass(customAttributeA) {
|
|
115
|
-
const customAttributeB = await this.
|
|
115
|
+
const customAttributeB = await this._schemaComparer.resolveItem(customAttributeA, this._schemaB);
|
|
116
116
|
if (customAttributeB && customAttributeB.schemaItemType === ecschema_metadata_1.SchemaItemType.CustomAttributeClass)
|
|
117
117
|
this._schemaComparer.compareCustomAttributeClasses(customAttributeA, customAttributeB);
|
|
118
118
|
}
|
|
@@ -121,22 +121,20 @@ class SchemaCompareVisitor {
|
|
|
121
121
|
* @param customAttributeContainer a [[CustomAttributeContainerProps]] object.
|
|
122
122
|
*/
|
|
123
123
|
async visitCustomAttributeContainer(containerA) {
|
|
124
|
-
const nameParts = containerA.fullName.split(".");
|
|
125
|
-
const shortName = nameParts.length === 1 ? nameParts[0] : nameParts[1];
|
|
126
124
|
let containerB;
|
|
127
125
|
if (ecschema_metadata_1.Schema.isSchema(containerA)) {
|
|
128
126
|
containerB = this._schemaB;
|
|
129
127
|
}
|
|
130
128
|
else if (ecschema_metadata_1.ECClass.isECClass(containerA)) {
|
|
131
|
-
const parent = await this.
|
|
129
|
+
const parent = await this._schemaComparer.resolveItem(containerA, this._schemaB);
|
|
132
130
|
containerB = parent && parent.schemaItemType === containerA.schemaItemType ? parent : undefined;
|
|
133
131
|
}
|
|
134
132
|
else if (ecschema_metadata_1.Property.isProperty(containerA)) {
|
|
135
|
-
const parent = await this.
|
|
136
|
-
containerB = parent && parent.schemaItemType === containerA.class.schemaItemType ? await
|
|
133
|
+
const parent = await this._schemaComparer.resolveItem(containerA.class, this._schemaB);
|
|
134
|
+
containerB = parent && parent.schemaItemType === containerA.class.schemaItemType ? await this._schemaComparer.resolveProperty(containerA, parent) : undefined;
|
|
137
135
|
}
|
|
138
136
|
else if (ecschema_metadata_1.RelationshipConstraint.isRelationshipConstraint(containerA)) {
|
|
139
|
-
const parent = await this.
|
|
137
|
+
const parent = await this._schemaComparer.resolveItem(containerA.relationshipClass, this._schemaB);
|
|
140
138
|
containerB = parent ? containerA.isSource ? parent.source : parent.target : undefined;
|
|
141
139
|
}
|
|
142
140
|
if (containerB)
|
|
@@ -147,7 +145,7 @@ class SchemaCompareVisitor {
|
|
|
147
145
|
* @param enumeration an Enumeration object.
|
|
148
146
|
*/
|
|
149
147
|
async visitEnumeration(enumA) {
|
|
150
|
-
const enumB = await this.
|
|
148
|
+
const enumB = await this._schemaComparer.resolveItem(enumA, this._schemaB);
|
|
151
149
|
if (enumB && enumB.schemaItemType === ecschema_metadata_1.SchemaItemType.Enumeration)
|
|
152
150
|
this._schemaComparer.compareEnumerations(enumA, enumB);
|
|
153
151
|
}
|
|
@@ -156,7 +154,7 @@ class SchemaCompareVisitor {
|
|
|
156
154
|
* @param koq a KindOfQuantity object.
|
|
157
155
|
*/
|
|
158
156
|
async visitKindOfQuantity(koqA) {
|
|
159
|
-
const koqB = await this.
|
|
157
|
+
const koqB = await this._schemaComparer.resolveItem(koqA, this._schemaB);
|
|
160
158
|
if (koqB && koqB.schemaItemType === ecschema_metadata_1.SchemaItemType.KindOfQuantity)
|
|
161
159
|
this._schemaComparer.compareKindOfQuantities(koqA, koqB);
|
|
162
160
|
}
|
|
@@ -165,7 +163,7 @@ class SchemaCompareVisitor {
|
|
|
165
163
|
* @param category a PropertyCategory object.
|
|
166
164
|
*/
|
|
167
165
|
async visitPropertyCategory(categoryA) {
|
|
168
|
-
const categoryB = await this.
|
|
166
|
+
const categoryB = await this._schemaComparer.resolveItem(categoryA, this._schemaB);
|
|
169
167
|
if (categoryB && categoryB.schemaItemType === ecschema_metadata_1.SchemaItemType.PropertyCategory)
|
|
170
168
|
this._schemaComparer.comparePropertyCategories(categoryA, categoryB);
|
|
171
169
|
}
|
|
@@ -174,7 +172,7 @@ class SchemaCompareVisitor {
|
|
|
174
172
|
* @param format a Format object.
|
|
175
173
|
*/
|
|
176
174
|
async visitFormat(formatA) {
|
|
177
|
-
const formatB = await this.
|
|
175
|
+
const formatB = await this._schemaComparer.resolveItem(formatA, this._schemaB);
|
|
178
176
|
if (formatB && formatB.schemaItemType === ecschema_metadata_1.SchemaItemType.Format)
|
|
179
177
|
this._schemaComparer.compareFormats(formatA, formatB);
|
|
180
178
|
}
|
|
@@ -183,7 +181,7 @@ class SchemaCompareVisitor {
|
|
|
183
181
|
* @param unit a Unit object.
|
|
184
182
|
*/
|
|
185
183
|
async visitUnit(unitA) {
|
|
186
|
-
const unitB = await this.
|
|
184
|
+
const unitB = await this._schemaComparer.resolveItem(unitA, this._schemaB);
|
|
187
185
|
if (unitB && ecschema_metadata_1.Unit.isUnit(unitB))
|
|
188
186
|
this._schemaComparer.compareUnits(unitA, unitB);
|
|
189
187
|
}
|
|
@@ -192,7 +190,7 @@ class SchemaCompareVisitor {
|
|
|
192
190
|
* @param invertedUnit an InvertedUnit object.
|
|
193
191
|
*/
|
|
194
192
|
async visitInvertedUnit(invertedUnitA) {
|
|
195
|
-
const invertedUnitB = await this.
|
|
193
|
+
const invertedUnitB = await this._schemaComparer.resolveItem(invertedUnitA, this._schemaB);
|
|
196
194
|
if (invertedUnitB && invertedUnitB.schemaItemType === ecschema_metadata_1.SchemaItemType.InvertedUnit)
|
|
197
195
|
this._schemaComparer.compareInvertedUnits(invertedUnitA, invertedUnitB);
|
|
198
196
|
}
|
|
@@ -208,7 +206,7 @@ class SchemaCompareVisitor {
|
|
|
208
206
|
* @param phenomena a Phenomenon object.
|
|
209
207
|
*/
|
|
210
208
|
async visitPhenomenon(phenomenonA) {
|
|
211
|
-
const phenomenonB = await this.
|
|
209
|
+
const phenomenonB = await this._schemaComparer.resolveItem(phenomenonA, this._schemaB);
|
|
212
210
|
if (phenomenonB && phenomenonB.schemaItemType === ecschema_metadata_1.SchemaItemType.Phenomenon)
|
|
213
211
|
this._schemaComparer.comparePhenomenons(phenomenonA, phenomenonB);
|
|
214
212
|
}
|
|
@@ -217,7 +215,7 @@ class SchemaCompareVisitor {
|
|
|
217
215
|
* @param constant a Constant object.
|
|
218
216
|
*/
|
|
219
217
|
async visitConstant(constantA) {
|
|
220
|
-
const constantB = await this.
|
|
218
|
+
const constantB = await this._schemaComparer.resolveItem(constantA, this._schemaB);
|
|
221
219
|
if (constantB && constantB.schemaItemType === ecschema_metadata_1.SchemaItemType.Constant)
|
|
222
220
|
this._schemaComparer.compareConstants(constantA, constantB);
|
|
223
221
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,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CAAO,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/D,IAAI,KAAK,IAAI,wBAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YAC7B,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,iBAAiB,CAAC,aAA2B;QACxD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAe,aAAa,CAAC,IAAI,CAAC,CAAC;QACvF,IAAI,aAAa,IAAI,aAAa,CAAC,cAAc,KAAK,kCAAc,CAAC,YAAY;YAC/E,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;IAC5E,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,eAAe,CAAC,YAAwB;QACnD,mDAAmD;IACrD,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,eAAe,CAAC,WAAuB;QAClD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAa,WAAW,CAAC,IAAI,CAAC,CAAC;QACjF,IAAI,WAAW,IAAI,WAAW,CAAC,cAAc,KAAK,kCAAc,CAAC,UAAU;YACzE,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,aAAa,CAAC,SAAmB;QAC5C,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAW,SAAS,CAAC,IAAI,CAAC,CAAC;QAC3E,IAAI,SAAS,IAAI,SAAS,CAAC,cAAc,KAAK,kCAAc,CAAC,QAAQ;YACnE,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAChE,CAAC;CACF;AAvOD,oDAuOC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Comparison\r\n */\r\n\r\nimport { AnyClass, AnyProperty, Constant, CustomAttributeClass, CustomAttributeContainerProps,\r\n ECClass, EntityClass, Enumeration, Format, InvertedUnit, ISchemaPartVisitor, KindOfQuantity, Mixin,\r\n Phenomenon, Property, PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem,\r\n SchemaItemType, StructClass, Unit, UnitSystem,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { ISchemaComparer } from \"./SchemaComparer\";\r\n\r\n/**\r\n * An ISchemaPartVisitor interface implementation that is used to compare to Schemas.\r\n * @internal\r\n */\r\nexport class SchemaCompareVisitor implements ISchemaPartVisitor {\r\n private _schemaB: Schema;\r\n private _schemaComparer: ISchemaComparer;\r\n\r\n /**\r\n * Initializes a new SchemaCompareVisitor instance.\r\n * @param schemaComparer The [[SchemaComparer]] to use to compare each item of the schema.\r\n * @param schemaToCompare The second or 'B' schema to compare against the schema being traversed (Schema A).\r\n */\r\n constructor(schemaComparer: ISchemaComparer, schemaToCompare: Schema) {\r\n this._schemaComparer = schemaComparer;\r\n this._schemaB = schemaToCompare;\r\n }\r\n\r\n /**\r\n * Called before schema traversal.\r\n * @param schema a Schema object.\r\n */\r\n public async visitFullSchema(schemaA: Schema) {\r\n this._schemaComparer.compareSchemaProps(schemaA, this._schemaB);\r\n }\r\n\r\n /**\r\n * Called for each [[SchemaItem]] instance found during schema traversal.\r\n * @param schemaItem a SchemaItem object.\r\n */\r\n public async visitSchemaItem(schemaItemA: SchemaItem) {\r\n const schemaItemB = await this._schemaB.lookupItem(schemaItemA.name);\r\n this._schemaComparer.compareSchemaItems(schemaItemA, schemaItemB);\r\n }\r\n\r\n /**\r\n * Called for each [[AnyClass]] instance found during schema traversal.\r\n * @param ecClass an ECClass object.\r\n */\r\n public async visitClass(classA: AnyClass): Promise<void> {\r\n const classB = await this._schemaB.lookupItem<AnyClass>(classA.name);\r\n if (classB && classA.schemaItemType === classB.schemaItemType)\r\n this._schemaComparer.compareClasses(classA, classB);\r\n }\r\n\r\n /**\r\n * Called for each [[AnyProperty]] instance of an ECClass.\r\n * @param property an AnyProperty object.\r\n */\r\n public async visitProperty(propertyA: AnyProperty): Promise<void> {\r\n let propertyB: AnyProperty | undefined;\r\n\r\n const classB = await this._schemaB.lookupItem<ECClass>(propertyA.class.name);\r\n if (classB && propertyA.class.schemaItemType === classB.schemaItemType){\r\n propertyB = await classB.getProperty(propertyA.name) as AnyProperty;\r\n this._schemaComparer.compareProperties(propertyA, propertyB);\r\n }\r\n }\r\n\r\n /**\r\n * Called for each [[EntityClass]] instance found during schema traversal.\r\n * @param entityClass an EntityClass object.\r\n */\r\n public async visitEntityClass(entityA: EntityClass): Promise<void> {\r\n const entityB = await this._schemaB.lookupItem<EntityClass>(entityA.name);\r\n if (entityB && entityB.schemaItemType === SchemaItemType.EntityClass)\r\n this._schemaComparer.compareEntityClasses(entityA, entityB);\r\n }\r\n\r\n /**\r\n * Called for each [[StructClass]] instance found during schema traversal.\r\n * @param structClass a StructClass object.\r\n */\r\n public async visitStructClass(_structA: StructClass): Promise<void> {\r\n // No comparison to make specifically on StructClasses\r\n }\r\n\r\n /**\r\n * Called for each [[Mixin]] instance found during schema traversal.\r\n * @param mixin a Mixin object.\r\n */\r\n public async visitMixin(mixinA: Mixin): Promise<void> {\r\n const mixinB = await this._schemaB.lookupItem<Mixin>(mixinA.name);\r\n if (mixinB && mixinB.schemaItemType === SchemaItemType.Mixin)\r\n this._schemaComparer.compareMixins(mixinA, mixinB);\r\n }\r\n\r\n /**\r\n * Called for each [[RelationshipClass]] instance found during schema traversal.\r\n * @param relationshipClass a RelationshipClass object.\r\n */\r\n public async visitRelationshipClass(relationshipA: RelationshipClass): Promise<void> {\r\n const relationshipB = await this._schemaB.lookupItem<RelationshipClass>(relationshipA.name);\r\n if (relationshipB && relationshipB.schemaItemType === SchemaItemType.RelationshipClass)\r\n this._schemaComparer.compareRelationshipClasses(relationshipA, relationshipB);\r\n }\r\n\r\n /**\r\n * Called for each [[RelationshipConstraint]] of each RelationshipClass found during schema traversal.\r\n * @param relationshipConstraint a RelationshipConstraint object.\r\n */\r\n public async visitRelationshipConstraint(constraintA: RelationshipConstraint): Promise<void> {\r\n let constraintB: RelationshipConstraint | undefined;\r\n const relationshipB = await this._schemaB.lookupItem<RelationshipClass>(constraintA.relationshipClass.name);\r\n if (relationshipB && relationshipB.schemaItemType === SchemaItemType.RelationshipClass) {\r\n constraintB = constraintA.isSource ? relationshipB.source : relationshipB.target;\r\n if (constraintB) {\r\n this._schemaComparer.compareRelationshipConstraints(constraintA, constraintB);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Called for each [[CustomAttributeClass]] instance found during schema traversal.\r\n * @param customAttributeClass a CustomAttributeClass object.\r\n */\r\n public async visitCustomAttributeClass(customAttributeA: CustomAttributeClass): Promise<void> {\r\n const customAttributeB = await this._schemaB.lookupItem<CustomAttributeClass>(customAttributeA.name);\r\n if (customAttributeB && customAttributeB.schemaItemType === SchemaItemType.CustomAttributeClass)\r\n this._schemaComparer.compareCustomAttributeClasses(customAttributeA, customAttributeB);\r\n }\r\n\r\n /**\r\n * Called for each [[CustomAttribute]] container in the schema.\r\n * @param customAttributeContainer a [[CustomAttributeContainerProps]] object.\r\n */\r\n public async visitCustomAttributeContainer(containerA: CustomAttributeContainerProps): Promise<void> {\r\n const nameParts = containerA.fullName.split(\".\");\r\n const shortName = nameParts.length === 1 ? nameParts[0] : nameParts[1];\r\n let containerB: CustomAttributeContainerProps | undefined;\r\n\r\n if (Schema.isSchema(containerA)) {\r\n containerB = this._schemaB;\r\n } else if (ECClass.isECClass(containerA)) {\r\n const parent = await this._schemaB.lookupItem<ECClass>(containerA.name);\r\n containerB = parent && parent.schemaItemType === containerA.schemaItemType ? parent : undefined;\r\n } else if (Property.isProperty(containerA)) {\r\n const parent = await this._schemaB.lookupItem<ECClass>(containerA.class.name);\r\n containerB = parent && parent.schemaItemType === containerA.class.schemaItemType ? await parent.getProperty(shortName) : undefined;\r\n } else if (RelationshipConstraint.isRelationshipConstraint(containerA)) {\r\n const parent = await this._schemaB.lookupItem<RelationshipClass>(containerA.relationshipClass.name);\r\n containerB = parent ? containerA.isSource ? parent.source : parent.target : undefined;\r\n }\r\n\r\n if (containerB)\r\n this._schemaComparer.compareCustomAttributeContainers(containerA, containerB);\r\n }\r\n\r\n /**\r\n * Called for each [[Enumeration]] instance found during schema traversal.\r\n * @param enumeration an Enumeration object.\r\n */\r\n public async visitEnumeration(enumA: Enumeration) {\r\n const enumB = await this._schemaB.lookupItem<Enumeration>(enumA.name);\r\n if (enumB && enumB.schemaItemType === SchemaItemType.Enumeration)\r\n this._schemaComparer.compareEnumerations(enumA, enumB);\r\n }\r\n\r\n /**\r\n * Called for each [[KindOfQuantity]] instance found during schema traversal.\r\n * @param koq a KindOfQuantity object.\r\n */\r\n public async visitKindOfQuantity(koqA: KindOfQuantity) {\r\n const koqB = await this._schemaB.lookupItem<KindOfQuantity>(koqA.name);\r\n if (koqB && koqB.schemaItemType === SchemaItemType.KindOfQuantity)\r\n this._schemaComparer.compareKindOfQuantities(koqA, koqB);\r\n }\r\n\r\n /**\r\n * Called for each [[PropertyCategory]] instance found during schema traversal.\r\n * @param category a PropertyCategory object.\r\n */\r\n public async visitPropertyCategory(categoryA: PropertyCategory) {\r\n const categoryB = await this._schemaB.lookupItem<PropertyCategory>(categoryA.name);\r\n if (categoryB && categoryB.schemaItemType === SchemaItemType.PropertyCategory)\r\n this._schemaComparer.comparePropertyCategories(categoryA, categoryB);\r\n }\r\n\r\n /**\r\n * Called for each [[Format]] instance found during schema traversal.\r\n * @param format a Format object.\r\n */\r\n public async visitFormat(formatA: Format): Promise<void> {\r\n const formatB = await this._schemaB.lookupItem<Format>(formatA.name);\r\n if (formatB && formatB.schemaItemType === SchemaItemType.Format)\r\n this._schemaComparer.compareFormats(formatA, formatB);\r\n }\r\n\r\n /**\r\n * Called for each [[Unit]] instance found during schema traversal.\r\n * @param unit a Unit object.\r\n */\r\n public async visitUnit(unitA: Unit): Promise<void> {\r\n const unitB = await this._schemaB.lookupItem<Unit>(unitA.name);\r\n if (unitB && Unit.isUnit(unitB))\r\n this._schemaComparer.compareUnits(unitA, unitB);\r\n }\r\n\r\n /**\r\n * Called for each [[InvertedUnit]] instance found during schema traversal.\r\n * @param invertedUnit an InvertedUnit object.\r\n */\r\n public async visitInvertedUnit(invertedUnitA: InvertedUnit): Promise<void> {\r\n const invertedUnitB = await this._schemaB.lookupItem<InvertedUnit>(invertedUnitA.name);\r\n if (invertedUnitB && invertedUnitB.schemaItemType === SchemaItemType.InvertedUnit)\r\n this._schemaComparer.compareInvertedUnits(invertedUnitA, invertedUnitB);\r\n }\r\n\r\n /**\r\n * Called for each [[UnitSystem]] instance found during schema traversal.\r\n * @param unitSystem a UnitSystem object.\r\n */\r\n public async visitUnitSystem(_unitSystemA: UnitSystem): Promise<void> {\r\n // No comparison to make specifically on unitSystem\r\n }\r\n\r\n /**\r\n * Called for each [[Phenomenon]] instance found during schema traversal.\r\n * @param phenomena a Phenomenon object.\r\n */\r\n public async visitPhenomenon(phenomenonA: Phenomenon): Promise<void> {\r\n const phenomenonB = await this._schemaB.lookupItem<Phenomenon>(phenomenonA.name);\r\n if (phenomenonB && phenomenonB.schemaItemType === SchemaItemType.Phenomenon)\r\n this._schemaComparer.comparePhenomenons(phenomenonA, phenomenonB);\r\n }\r\n\r\n /**\r\n * Called for each [[Constant]] instance found during schema traversal.\r\n * @param constant a Constant object.\r\n */\r\n public async visitConstant(constantA: Constant): Promise<void> {\r\n const constantB = await this._schemaB.lookupItem<Constant>(constantA.name);\r\n if (constantB && constantB.schemaItemType === SchemaItemType.Constant)\r\n this._schemaComparer.compareConstants(constantA, constantB);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaCompareVisitor.js","source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------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Comparison\r\n */\r\n\r\nimport { AnyClass, AnyProperty, Constant, CustomAttributeClass, CustomAttributeContainerProps,\r\n ECClass, EntityClass, Enumeration, Format, InvertedUnit, ISchemaPartVisitor, KindOfQuantity, Mixin,\r\n Phenomenon, Property, PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem,\r\n SchemaItemType, StructClass, Unit, UnitSystem,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { ISchemaComparer } from \"./SchemaComparer\";\r\n\r\n/**\r\n * An ISchemaPartVisitor interface implementation that is used to compare to Schemas.\r\n * @internal\r\n */\r\nexport class SchemaCompareVisitor implements ISchemaPartVisitor {\r\n private _schemaB: Schema;\r\n private _schemaComparer: ISchemaComparer;\r\n\r\n /**\r\n * Initializes a new SchemaCompareVisitor instance.\r\n * @param schemaComparer The [[SchemaComparer]] to use to compare each item of the schema.\r\n * @param schemaToCompare The second or 'B' schema to compare against the schema being traversed (Schema A).\r\n */\r\n constructor(schemaComparer: ISchemaComparer, schemaToCompare: Schema) {\r\n this._schemaComparer = schemaComparer;\r\n this._schemaB = schemaToCompare;\r\n }\r\n\r\n /**\r\n * Called before schema traversal.\r\n * @param schema a Schema object.\r\n */\r\n public async visitFullSchema(schemaA: Schema) {\r\n this._schemaComparer.compareSchemaProps(schemaA, this._schemaB);\r\n }\r\n\r\n /**\r\n * Called for each [[SchemaItem]] instance found during schema traversal.\r\n * @param schemaItem a SchemaItem object.\r\n */\r\n public async visitSchemaItem(schemaItemA: SchemaItem) {\r\n const schemaItemB = await this._schemaComparer.resolveItem(schemaItemA, this._schemaB);\r\n this._schemaComparer.compareSchemaItems(schemaItemA, schemaItemB);\r\n }\r\n\r\n /**\r\n * Called for each [[AnyClass]] instance found during schema traversal.\r\n * @param ecClass an ECClass object.\r\n */\r\n public async visitClass(classA: AnyClass): Promise<void> {\r\n const classB = await this._schemaComparer.resolveItem<AnyClass>(classA, this._schemaB);\r\n if (classB && classA.schemaItemType === classB.schemaItemType)\r\n this._schemaComparer.compareClasses(classA, classB);\r\n }\r\n\r\n /**\r\n * Called for each [[AnyProperty]] instance of an ECClass.\r\n * @param property an AnyProperty object.\r\n */\r\n public async visitProperty(propertyA: AnyProperty): Promise<void> {\r\n let propertyB: AnyProperty | undefined;\r\n\r\n const classB = await this._schemaComparer.resolveItem<ECClass>(propertyA.class, this._schemaB);\r\n if (classB && propertyA.class.schemaItemType === classB.schemaItemType){\r\n propertyB = await this._schemaComparer.resolveProperty(propertyA, classB);\r\n this._schemaComparer.compareProperties(propertyA, propertyB);\r\n }\r\n }\r\n\r\n /**\r\n * Called for each [[EntityClass]] instance found during schema traversal.\r\n * @param entityClass an EntityClass object.\r\n */\r\n public async visitEntityClass(entityA: EntityClass): Promise<void> {\r\n const entityB = await this._schemaComparer.resolveItem<EntityClass>(entityA, this._schemaB);\r\n if (entityB && entityB.schemaItemType === SchemaItemType.EntityClass)\r\n this._schemaComparer.compareEntityClasses(entityA, entityB);\r\n }\r\n\r\n /**\r\n * Called for each [[StructClass]] instance found during schema traversal.\r\n * @param structClass a StructClass object.\r\n */\r\n public async visitStructClass(_structA: StructClass): Promise<void> {\r\n // No comparison to make specifically on StructClasses\r\n }\r\n\r\n /**\r\n * Called for each [[Mixin]] instance found during schema traversal.\r\n * @param mixin a Mixin object.\r\n */\r\n public async visitMixin(mixinA: Mixin): Promise<void> {\r\n const mixinB = await this._schemaComparer.resolveItem<Mixin>(mixinA, this._schemaB);\r\n if (mixinB && mixinB.schemaItemType === SchemaItemType.Mixin)\r\n this._schemaComparer.compareMixins(mixinA, mixinB);\r\n }\r\n\r\n /**\r\n * Called for each [[RelationshipClass]] instance found during schema traversal.\r\n * @param relationshipClass a RelationshipClass object.\r\n */\r\n public async visitRelationshipClass(relationshipA: RelationshipClass): Promise<void> {\r\n const relationshipB = await this._schemaComparer.resolveItem<RelationshipClass>(relationshipA, this._schemaB);\r\n if (relationshipB && relationshipB.schemaItemType === SchemaItemType.RelationshipClass)\r\n this._schemaComparer.compareRelationshipClasses(relationshipA, relationshipB);\r\n }\r\n\r\n /**\r\n * Called for each [[RelationshipConstraint]] of each RelationshipClass found during schema traversal.\r\n * @param relationshipConstraint a RelationshipConstraint object.\r\n */\r\n public async visitRelationshipConstraint(constraintA: RelationshipConstraint): Promise<void> {\r\n let constraintB: RelationshipConstraint | undefined;\r\n const relationshipB = await this._schemaComparer.resolveItem<RelationshipClass>(constraintA.relationshipClass, this._schemaB);\r\n if (relationshipB && relationshipB.schemaItemType === SchemaItemType.RelationshipClass) {\r\n constraintB = constraintA.isSource ? relationshipB.source : relationshipB.target;\r\n if (constraintB) {\r\n this._schemaComparer.compareRelationshipConstraints(constraintA, constraintB);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Called for each [[CustomAttributeClass]] instance found during schema traversal.\r\n * @param customAttributeClass a CustomAttributeClass object.\r\n */\r\n public async visitCustomAttributeClass(customAttributeA: CustomAttributeClass): Promise<void> {\r\n const customAttributeB = await this._schemaComparer.resolveItem<CustomAttributeClass>(customAttributeA, this._schemaB);\r\n if (customAttributeB && customAttributeB.schemaItemType === SchemaItemType.CustomAttributeClass)\r\n this._schemaComparer.compareCustomAttributeClasses(customAttributeA, customAttributeB);\r\n }\r\n\r\n /**\r\n * Called for each [[CustomAttribute]] container in the schema.\r\n * @param customAttributeContainer a [[CustomAttributeContainerProps]] object.\r\n */\r\n public async visitCustomAttributeContainer(containerA: CustomAttributeContainerProps): Promise<void> {\r\n let containerB: CustomAttributeContainerProps | undefined;\r\n\r\n if (Schema.isSchema(containerA)) {\r\n containerB = this._schemaB;\r\n } else if (ECClass.isECClass(containerA)) {\r\n const parent = await this._schemaComparer.resolveItem<ECClass>(containerA, this._schemaB);\r\n containerB = parent && parent.schemaItemType === containerA.schemaItemType ? parent : undefined;\r\n } else if (Property.isProperty(containerA)) {\r\n const parent = await this._schemaComparer.resolveItem<ECClass>(containerA.class, this._schemaB);\r\n containerB = parent && parent.schemaItemType === containerA.class.schemaItemType ? await this._schemaComparer.resolveProperty(containerA, parent) : undefined;\r\n } else if (RelationshipConstraint.isRelationshipConstraint(containerA)) {\r\n const parent = await this._schemaComparer.resolveItem<RelationshipClass>(containerA.relationshipClass, this._schemaB);\r\n containerB = parent ? containerA.isSource ? parent.source : parent.target : undefined;\r\n }\r\n\r\n if (containerB)\r\n this._schemaComparer.compareCustomAttributeContainers(containerA, containerB);\r\n }\r\n\r\n /**\r\n * Called for each [[Enumeration]] instance found during schema traversal.\r\n * @param enumeration an Enumeration object.\r\n */\r\n public async visitEnumeration(enumA: Enumeration) {\r\n const enumB = await this._schemaComparer.resolveItem<Enumeration>(enumA, this._schemaB);\r\n if (enumB && enumB.schemaItemType === SchemaItemType.Enumeration)\r\n this._schemaComparer.compareEnumerations(enumA, enumB);\r\n }\r\n\r\n /**\r\n * Called for each [[KindOfQuantity]] instance found during schema traversal.\r\n * @param koq a KindOfQuantity object.\r\n */\r\n public async visitKindOfQuantity(koqA: KindOfQuantity) {\r\n const koqB = await this._schemaComparer.resolveItem<KindOfQuantity>(koqA, this._schemaB);\r\n if (koqB && koqB.schemaItemType === SchemaItemType.KindOfQuantity)\r\n this._schemaComparer.compareKindOfQuantities(koqA, koqB);\r\n }\r\n\r\n /**\r\n * Called for each [[PropertyCategory]] instance found during schema traversal.\r\n * @param category a PropertyCategory object.\r\n */\r\n public async visitPropertyCategory(categoryA: PropertyCategory) {\r\n const categoryB = await this._schemaComparer.resolveItem<PropertyCategory>(categoryA, this._schemaB);\r\n if (categoryB && categoryB.schemaItemType === SchemaItemType.PropertyCategory)\r\n this._schemaComparer.comparePropertyCategories(categoryA, categoryB);\r\n }\r\n\r\n /**\r\n * Called for each [[Format]] instance found during schema traversal.\r\n * @param format a Format object.\r\n */\r\n public async visitFormat(formatA: Format): Promise<void> {\r\n const formatB = await this._schemaComparer.resolveItem<Format>(formatA, this._schemaB);\r\n if (formatB && formatB.schemaItemType === SchemaItemType.Format)\r\n this._schemaComparer.compareFormats(formatA, formatB);\r\n }\r\n\r\n /**\r\n * Called for each [[Unit]] instance found during schema traversal.\r\n * @param unit a Unit object.\r\n */\r\n public async visitUnit(unitA: Unit): Promise<void> {\r\n const unitB = await this._schemaComparer.resolveItem<Unit>(unitA, this._schemaB);\r\n if (unitB && Unit.isUnit(unitB))\r\n this._schemaComparer.compareUnits(unitA, unitB);\r\n }\r\n\r\n /**\r\n * Called for each [[InvertedUnit]] instance found during schema traversal.\r\n * @param invertedUnit an InvertedUnit object.\r\n */\r\n public async visitInvertedUnit(invertedUnitA: InvertedUnit): Promise<void> {\r\n const invertedUnitB = await this._schemaComparer.resolveItem<InvertedUnit>(invertedUnitA, this._schemaB);\r\n if (invertedUnitB && invertedUnitB.schemaItemType === SchemaItemType.InvertedUnit)\r\n this._schemaComparer.compareInvertedUnits(invertedUnitA, invertedUnitB);\r\n }\r\n\r\n /**\r\n * Called for each [[UnitSystem]] instance found during schema traversal.\r\n * @param unitSystem a UnitSystem object.\r\n */\r\n public async visitUnitSystem(_unitSystemA: UnitSystem): Promise<void> {\r\n // No comparison to make specifically on unitSystem\r\n }\r\n\r\n /**\r\n * Called for each [[Phenomenon]] instance found during schema traversal.\r\n * @param phenomena a Phenomenon object.\r\n */\r\n public async visitPhenomenon(phenomenonA: Phenomenon): Promise<void> {\r\n const phenomenonB = await this._schemaComparer.resolveItem<Phenomenon>(phenomenonA, this._schemaB);\r\n if (phenomenonB && phenomenonB.schemaItemType === SchemaItemType.Phenomenon)\r\n this._schemaComparer.comparePhenomenons(phenomenonA, phenomenonB);\r\n }\r\n\r\n /**\r\n * Called for each [[Constant]] instance found during schema traversal.\r\n * @param constant a Constant object.\r\n */\r\n public async visitConstant(constantA: Constant): Promise<void> {\r\n const constantB = await this._schemaComparer.resolveItem<Constant>(constantA, this._schemaB);\r\n if (constantB && constantB.schemaItemType === SchemaItemType.Constant)\r\n this._schemaComparer.compareConstants(constantA, constantB);\r\n }\r\n}\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Comparison
|
|
3
3
|
*/
|
|
4
|
-
import { AnyClass, AnyProperty, Constant, CustomAttributeClass, CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, Phenomenon, PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, Unit } from "@itwin/ecschema-metadata";
|
|
4
|
+
import { AnyClass, AnyProperty, Constant, CustomAttributeClass, CustomAttributeContainerProps, ECClass, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, Phenomenon, PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, SchemaItemKey, Unit } from "@itwin/ecschema-metadata";
|
|
5
5
|
import { ISchemaCompareReporter } from "./SchemaCompareReporter";
|
|
6
6
|
/**
|
|
7
7
|
* Enum that identifies if Schema A is being iterated (Forward) or
|
|
@@ -36,6 +36,12 @@ export interface ISchemaComparer {
|
|
|
36
36
|
compareInvertedUnits(invertedUnitA: InvertedUnit, invertedUnitB: InvertedUnit): void;
|
|
37
37
|
comparePhenomenons(phenomenonA: Phenomenon, phenomenonB: Phenomenon): void;
|
|
38
38
|
compareConstants(constantA: Constant, constantB: Constant): void;
|
|
39
|
+
/** @internal */
|
|
40
|
+
resolveItem<TItem extends SchemaItem>(item: SchemaItem, lookupSchema: Schema): Promise<TItem | undefined>;
|
|
41
|
+
/** @internal */
|
|
42
|
+
resolveProperty(propertyA: AnyProperty, ecClass: ECClass): Promise<AnyProperty | undefined>;
|
|
43
|
+
/** @internal */
|
|
44
|
+
areEqualByName(itemKeyA?: Readonly<SchemaItemKey> | SchemaItem, itemKeyB?: Readonly<SchemaItemKey> | SchemaItem): boolean;
|
|
39
45
|
}
|
|
40
46
|
/**
|
|
41
47
|
* Compares EC Schemas and reports differences using the [[IDiagnosticReporter]] objects
|
|
@@ -51,6 +57,21 @@ export declare class SchemaComparer {
|
|
|
51
57
|
* @param reporters The [[IDiagnosticReporter]] object(s) to use to report the results.
|
|
52
58
|
*/
|
|
53
59
|
constructor(...reporters: ISchemaCompareReporter[]);
|
|
60
|
+
/**
|
|
61
|
+
* Resolves a schema Item from the given lookup schema.
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
resolveItem<TItem extends SchemaItem>(item: SchemaItem, lookupSchema: Schema): Promise<TItem | undefined>;
|
|
65
|
+
/**
|
|
66
|
+
* Resolves a property from a class.
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
resolveProperty(propertyA: AnyProperty, ecClass: ECClass): Promise<AnyProperty | undefined>;
|
|
70
|
+
/**
|
|
71
|
+
* Compares two schema items to determine if they are the same by name.
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
areEqualByName(itemKeyA?: Readonly<SchemaItemKey> | SchemaItem, itemKeyB?: Readonly<SchemaItemKey> | SchemaItem): boolean;
|
|
54
75
|
/**
|
|
55
76
|
* Compares two schemas to identify differences.
|
|
56
77
|
* @param schemaA The first Schema.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaComparer.d.ts","sourceRoot":"","sources":["../../../src/Validation/SchemaComparer.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAAiB,WAAW,EAAyB,QAAQ,EAA0C,oBAAoB,EACnI,6BAA6B,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAkB,UAAU,
|
|
1
|
+
{"version":3,"file":"SchemaComparer.d.ts","sourceRoot":"","sources":["../../../src/Validation/SchemaComparer.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAAiB,WAAW,EAAyB,QAAQ,EAA0C,oBAAoB,EACnI,6BAA6B,EAAE,OAAO,EAA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