@itwin/ecschema-editing 4.4.0-dev.2 → 4.4.0-dev.21
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 +21 -1
- package/lib/cjs/Editing/ECClasses.d.ts +2 -0
- package/lib/cjs/Editing/ECClasses.d.ts.map +1 -1
- package/lib/cjs/Editing/ECClasses.js +23 -0
- package/lib/cjs/Editing/ECClasses.js.map +1 -1
- package/lib/cjs/Editing/KindOfQuantities.d.ts +1 -0
- package/lib/cjs/Editing/KindOfQuantities.d.ts.map +1 -1
- package/lib/cjs/Editing/KindOfQuantities.js +20 -0
- package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableArrayProperty.d.ts +10 -0
- package/lib/cjs/Editing/Mutable/MutableArrayProperty.d.ts.map +1 -0
- package/lib/cjs/Editing/Mutable/MutableArrayProperty.js +16 -0
- package/lib/cjs/Editing/Mutable/MutableArrayProperty.js.map +1 -0
- package/lib/cjs/Editing/Mutable/MutableClass.d.ts +2 -0
- package/lib/cjs/Editing/Mutable/MutableClass.d.ts.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.d.ts +2 -1
- 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/MutablePrimitiveOrEnumProperty.d.ts +13 -0
- package/lib/cjs/Editing/Mutable/MutablePrimitiveOrEnumProperty.d.ts.map +1 -0
- package/lib/cjs/Editing/Mutable/MutablePrimitiveOrEnumProperty.js +16 -0
- package/lib/cjs/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -0
- package/lib/cjs/Editing/Mutable/MutableProperty.d.ts +6 -1
- package/lib/cjs/Editing/Mutable/MutableProperty.d.ts.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
- package/lib/cjs/Merging/AnyPropertyMerger.d.ts +15 -0
- package/lib/cjs/Merging/AnyPropertyMerger.d.ts.map +1 -0
- package/lib/cjs/Merging/AnyPropertyMerger.js +71 -0
- package/lib/cjs/Merging/AnyPropertyMerger.js.map +1 -0
- package/lib/cjs/Merging/ArrayPropertyMerger.d.ts +32 -0
- package/lib/cjs/Merging/ArrayPropertyMerger.d.ts.map +1 -0
- package/lib/cjs/Merging/ArrayPropertyMerger.js +143 -0
- package/lib/cjs/Merging/ArrayPropertyMerger.js.map +1 -0
- package/lib/cjs/Merging/CAClassMerger.d.ts +6 -8
- package/lib/cjs/Merging/CAClassMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/CAClassMerger.js +27 -10
- package/lib/cjs/Merging/CAClassMerger.js.map +1 -1
- package/lib/cjs/Merging/ClassMerger.d.ts +14 -6
- package/lib/cjs/Merging/ClassMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/ClassMerger.js +133 -35
- package/lib/cjs/Merging/ClassMerger.js.map +1 -1
- package/lib/cjs/Merging/ClassPropertyMerger.d.ts +16 -0
- package/lib/cjs/Merging/ClassPropertyMerger.d.ts.map +1 -0
- package/lib/cjs/Merging/ClassPropertyMerger.js +90 -0
- package/lib/cjs/Merging/ClassPropertyMerger.js.map +1 -0
- package/lib/cjs/Merging/CustomAttributeMerger.d.ts +21 -0
- package/lib/cjs/Merging/CustomAttributeMerger.d.ts.map +1 -0
- package/lib/cjs/Merging/CustomAttributeMerger.js +51 -0
- package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -0
- package/lib/cjs/Merging/EntityClassMerger.d.ts +11 -0
- package/lib/cjs/Merging/EntityClassMerger.d.ts.map +1 -0
- package/lib/cjs/Merging/EntityClassMerger.js +26 -0
- package/lib/cjs/Merging/EntityClassMerger.js.map +1 -0
- package/lib/cjs/Merging/KindOfQuantityMerger.d.ts +15 -0
- package/lib/cjs/Merging/KindOfQuantityMerger.d.ts.map +1 -0
- package/lib/cjs/Merging/KindOfQuantityMerger.js +66 -0
- package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -0
- package/lib/cjs/Merging/MixinMerger.d.ts +11 -0
- package/lib/cjs/Merging/MixinMerger.d.ts.map +1 -0
- package/lib/cjs/Merging/MixinMerger.js +38 -0
- package/lib/cjs/Merging/MixinMerger.js.map +1 -0
- package/lib/cjs/Merging/PrimitiveOrEnumPropertyMerger.d.ts +24 -0
- package/lib/cjs/Merging/PrimitiveOrEnumPropertyMerger.d.ts.map +1 -0
- package/lib/cjs/Merging/PrimitiveOrEnumPropertyMerger.js +106 -0
- package/lib/cjs/Merging/PrimitiveOrEnumPropertyMerger.js.map +1 -0
- package/lib/cjs/Merging/SchemaItemFactory.d.ts.map +1 -1
- package/lib/cjs/Merging/SchemaItemFactory.js +10 -0
- package/lib/cjs/Merging/SchemaItemFactory.js.map +1 -1
- package/lib/cjs/Merging/SchemaItemMerger.d.ts +2 -1
- package/lib/cjs/Merging/SchemaItemMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/SchemaItemMerger.js +11 -4
- package/lib/cjs/Merging/SchemaItemMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/SchemaMerger.js +16 -3
- package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
- package/lib/cjs/Merging/StructClassMerger.d.ts +10 -0
- package/lib/cjs/Merging/StructClassMerger.d.ts.map +1 -0
- package/lib/cjs/Merging/StructClassMerger.js +13 -0
- package/lib/cjs/Merging/StructClassMerger.js.map +1 -0
- package/lib/cjs/Merging/StructPropertyMerger.d.ts +11 -0
- package/lib/cjs/Merging/StructPropertyMerger.d.ts.map +1 -0
- package/lib/cjs/Merging/StructPropertyMerger.js +47 -0
- package/lib/cjs/Merging/StructPropertyMerger.js.map +1 -0
- package/lib/cjs/Validation/SchemaCompareResultDelegate.d.ts +1 -1
- package/lib/cjs/Validation/SchemaCompareResultDelegate.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaCompareResultDelegate.js +2 -4
- package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
- package/package.json +15 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaItemFactory.js","sourceRoot":"","sources":["../../../src/Merging/SchemaItemFactory.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,
|
|
1
|
+
{"version":3,"file":"SchemaItemFactory.js","sourceRoot":"","sources":["../../../src/Merging/SchemaItemFactory.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAgO;AAIhO;;GAEG;AACH,IAAiB,iBAAiB,CAwEjC;AAxED,WAAiB,iBAAiB;IAEhC;;;;;OAKG;IACI,KAAK,UAAU,MAAM,CAAC,OAA2B,EAAE,QAAoB;QAC5E,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC1F,IAAG,MAAM,CAAC,YAAY,EAAE;YACtB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;SACtC;QACD,OAAO,MAAM,CAAC,OAAQ,CAAC;IACzB,CAAC;IANqB,wBAAM,SAM3B,CAAA;IAED;;;;;;OAMG;IACH,KAAK,UAAU,UAAU,CAAC,MAA2B,EAAE,eAA0B,EAAE,QAAoB;QACrG,IAAI,EAAE,CAAC,QAAQ,EAAE,+BAAW,CAAC;YAC3B,OAAO,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,eAAe,EAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,iCAAa,CAAC,OAAO,CAAC,CAAC,CAAC,iCAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACtK,IAAI,EAAE,CAAC,QAAQ,EAAE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ley 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 { Constant, CustomAttributeClass, EntityClass, Enumeration, KindOfQuantity, Phenomenon, PrimitiveType, PropertyCategory, SchemaItem, SchemaItemKey, SchemaKey, StructClass, UnitSystem } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor, SchemaItemEditResults } from \"../Editing/Editor\";\r\nimport { SchemaMergeContext } from \"./SchemaMerger\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport namespace SchemaItemFactory {\r\n\r\n /**\r\n * Creates a new Schema Item based on the given template instance.\r\n * @param context The current merging context.\r\n * @param template The Schema Items Template\r\n * @returns The SchemaItemKey of the created item.\r\n */\r\n export async function create(context: SchemaMergeContext, template: SchemaItem): Promise<SchemaItemKey> {\r\n const result = await createItem(context.editor, context.targetSchema.schemaKey, template);\r\n if(result.errorMessage) {\r\n throw new Error(result.errorMessage);\r\n }\r\n return result.itemKey!;\r\n }\r\n\r\n /**\r\n * Creates a new Schema Item in the SchemaContextEditor.\r\n * @param editor The SchemaContextEditor\r\n * @param targetSchemaKey The key of the target schema the item shall be created in.\r\n * @param template The Schema Items Template\r\n * @returns A SchemaItemEditResults with a schema key if the item could be created.\r\n */\r\n async function createItem(editor: SchemaContextEditor, targetSchemaKey: SchemaKey, template: SchemaItem): Promise<SchemaItemEditResults> {\r\n if (is(template, Enumeration))\r\n return editor.enumerations.create(targetSchemaKey, template.name, template.isInt ? PrimitiveType.Integer : PrimitiveType.String, template.label, template.isStrict);\r\n if (is(template, EntityClass))\r\n return editor.entities.create(targetSchemaKey, template.name, template.modifier);\r\n if (is(template, StructClass))\r\n return editor.structs.create(targetSchemaKey, template.name);\r\n if (is(template, CustomAttributeClass))\r\n return editor.customAttributes.create(targetSchemaKey, template.name, template.containerType);\r\n if(is(template, PropertyCategory))\r\n return editor.propertyCategories.create(targetSchemaKey, template.name, template.priority);\r\n if (is(template, Phenomenon))\r\n return editor.phenomenons.create(targetSchemaKey, template.name, template.definition);\r\n if (is(template, Constant)) {\r\n if(template.phenomenon === undefined) {\r\n throw new Error(`Invalid Constant ${template.name} has no phenomenon defined`);\r\n }\r\n const phenomenon = await template.phenomenon;\r\n const itemKey = phenomenon.key.schemaKey.matches(template.key.schemaKey)\r\n ? new SchemaItemKey(phenomenon.name, targetSchemaKey)\r\n : phenomenon.key;\r\n\r\n return editor.constants.create(targetSchemaKey, template.name, itemKey, template.definition);\r\n }\r\n if (is(template, KindOfQuantity)) {\r\n if(template.persistenceUnit === undefined) {\r\n throw new Error(`Invalid KindOfQuantity ${template.name} has no persistenceUnit defined`);\r\n }\r\n const persistenceUnit = await template.persistenceUnit;\r\n const itemKey = persistenceUnit.key.schemaKey.matches(template.key.schemaKey)\r\n ? new SchemaItemKey(persistenceUnit.name, targetSchemaKey)\r\n : persistenceUnit.key;\r\n return editor.kindOfQuantities.create(targetSchemaKey, template.name, itemKey);\r\n }\r\n if (is(template, UnitSystem))\r\n return editor.unitSystems.create(targetSchemaKey, template.name);\r\n\r\n throw new Error(`Unsupported Schema Item Type: ${template.constructor.name}`);\r\n }\r\n\r\n /**\r\n * Type Guard to \"cast\" a given schema item into an implementation\r\n * @param item Item to be checked\r\n * @param type The desired implementation.\r\n * @returns true if the item could be casted, otherwise false.\r\n */\r\n function is<T extends SchemaItem>(item: SchemaItem, type: new (...args: any) => T ): item is T {\r\n return item instanceof type;\r\n }\r\n}\r\n"]}
|
|
@@ -6,7 +6,7 @@ import { SchemaMergeContext } from "./SchemaMerger";
|
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
export type PropertyValueResolver<T extends SchemaItem, TProps = MutableSchemaItemProps<T>> = {
|
|
9
|
-
[P in keyof TProps]?: (
|
|
9
|
+
[P in keyof TProps]?: (newValue: any, item: SchemaItemKey, oldValue?: any) => any;
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
12
|
* Defines a Mutable Schema Props interface.
|
|
@@ -43,6 +43,7 @@ export declare class SchemaItemMerger<TItem extends SchemaItem> {
|
|
|
43
43
|
* @param _change The schema item change to be applied.
|
|
44
44
|
*/
|
|
45
45
|
protected merge(_itemKey: SchemaItemKey, _source: TItem, _change: SchemaItemChanges): Promise<void>;
|
|
46
|
+
protected lookup<T extends SchemaItem>(schemaItem: T): Promise<T | undefined>;
|
|
46
47
|
/**
|
|
47
48
|
* Merges the given schema item changes in the current context.
|
|
48
49
|
* @param context The merging context
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaItemMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/SchemaItemMerger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAmC,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,UAAU,EAAE,MAAM,GAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI;KACzF,CAAC,IAAI,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"SchemaItemMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/SchemaItemMerger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAmC,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,UAAU,EAAE,MAAM,GAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI;KACzF,CAAC,IAAI,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,GAAG,KAAK,GAAG;CAClF,CAAC;AAEF;;GAEG;AACH,KAAK,sBAAsB,CAAC,CAAC,SAAS,UAAU,IAAI;IAClD,CAAC,UAAU,GAAG,IAAI,MAAM,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC;CAC/E,CAAC;AAEF;;;;;;GAMG;AACH,qBAAa,gBAAgB,CAAC,KAAK,SAAS,UAAU;IAEpD,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IAE/C;;;;OAIG;gBACS,OAAO,EAAE,kBAAkB;IAIvC;;;;;OAKG;cACa,2BAA2B,IAAI,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAKpF;;;;;OAKG;cACa,KAAK,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,iBAAiB;cAIzE,MAAM,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAQnF;;;;OAIG;WACiB,YAAY,CAAC,OAAO,SAAS,iBAAiB,EAAE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,QAAQ,CAAC,OAAO,CAAC;IAyBrI;;;;OAIG;YACW,uBAAuB;CAoBtC"}
|
|
@@ -43,6 +43,12 @@ class SchemaItemMerger {
|
|
|
43
43
|
async merge(_itemKey, _source, _change) {
|
|
44
44
|
// Can be overriden for complex merging
|
|
45
45
|
}
|
|
46
|
+
async lookup(schemaItem) {
|
|
47
|
+
const itemKey = new ecschema_metadata_1.SchemaItemKey(schemaItem.name, this.context.sourceSchema.schemaKey.matches(schemaItem.schema.schemaKey)
|
|
48
|
+
? this.context.targetSchema.schemaKey
|
|
49
|
+
: schemaItem.schema.schemaKey);
|
|
50
|
+
return this.context.targetSchema.lookupItem(itemKey);
|
|
51
|
+
}
|
|
46
52
|
/**
|
|
47
53
|
* Merges the given schema item changes in the current context.
|
|
48
54
|
* @param context The merging context
|
|
@@ -79,14 +85,15 @@ class SchemaItemMerger {
|
|
|
79
85
|
if (changes.length === 0) {
|
|
80
86
|
return;
|
|
81
87
|
}
|
|
82
|
-
const
|
|
88
|
+
const targetItem = (await this.context.targetSchema.lookupItem(targetItemKey));
|
|
89
|
+
const jsonProps = (targetItem?.toJSON() ?? {});
|
|
83
90
|
const propertyResolver = await this.createPropertyValueResolver();
|
|
84
91
|
for (const change of changes) {
|
|
85
|
-
const [propertyName,
|
|
92
|
+
const [propertyName, propertyNewValue, propertyOldValue] = change.diagnostic.messageArgs;
|
|
86
93
|
const resolver = propertyResolver[propertyName];
|
|
87
94
|
jsonProps[propertyName] = resolver !== undefined
|
|
88
|
-
? resolver(
|
|
89
|
-
:
|
|
95
|
+
? resolver(propertyNewValue, targetItemKey, propertyOldValue)
|
|
96
|
+
: propertyNewValue;
|
|
90
97
|
}
|
|
91
98
|
await this.context.editor.schemaItems.applyProps(targetItemKey, jsonProps);
|
|
92
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaItemMerger.js","sourceRoot":"","sources":["../../../src/Merging/SchemaItemMerger.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAqE;AACrE,+DAAiG;AACjG,2DAAwD;AAkBxD;;;;;;GAMG;AACH,MAAa,gBAAgB;IAI3B;;;;OAIG;IACH,YAAY,OAA2B;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,2BAA2B;QACzC,sDAAsD;QACtD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,KAAK,CAAC,QAAuB,EAAE,OAAc,EAAE,OAA0B;QACvF,uCAAuC;IACzC,CAAC;IAED;;;;OAI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AG,gBAAgB,CAAC,YAAY,CAAC,CAAC;YAChD,SAAS,CAAC,YAAY,CAAC,GAAG,QAAQ,KAAK,SAAS;gBAC9C,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,CAAC;gBAC7D,CAAC,CAAC,gBAAgB,CAAC;SACtB;QAED,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IAC7E,CAAC;CACF;AAjGD,4CAiGC","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 { SchemaItem, SchemaItemKey } from \"@itwin/ecschema-metadata\";\r\nimport { ChangeType, PropertyValueChange, SchemaItemChanges } from \"../Validation/SchemaChanges\";\r\nimport { SchemaItemFactory } from \"./SchemaItemFactory\";\r\nimport { SchemaMergeContext } from \"./SchemaMerger\";\r\n\r\n/**\r\n * Defines a type-safe interface of Property Value resolver.\r\n * @internal\r\n */\r\nexport type PropertyValueResolver<T extends SchemaItem, TProps=MutableSchemaItemProps<T>> = {\r\n [P in keyof TProps]?: (newValue: any, item: SchemaItemKey, oldValue?: any) => any;\r\n};\r\n\r\n/**\r\n * Defines a Mutable Schema Props interface.\r\n */\r\ntype MutableSchemaItemProps<T extends SchemaItem> = {\r\n -readonly [key in keyof ReturnType<T[\"toJSON\"]>]: ReturnType<T[\"toJSON\"]>[key];\r\n};\r\n\r\n/**\r\n * The SchemaItemMerger is an base class for several other mergers with the actual logic\r\n * to perform merging for a certain schema item type. The class provides the shared logics\r\n * that is shared for all schema item mergers and custom logic can be applied by overriding\r\n * the protected class members.\r\n * @internal\r\n */\r\nexport class SchemaItemMerger<TItem extends SchemaItem> {\r\n\r\n protected readonly context: SchemaMergeContext;\r\n\r\n /**\r\n * Constructor of the SchemaItemMerger class. This should not be overriden or extended\r\n * by sub-implementations.\r\n * @param context The current merging context.\r\n */\r\n constructor(context: SchemaMergeContext) {\r\n this.context = context;\r\n }\r\n\r\n /**\r\n * This overridable method allows to create a property value resolver that gets defines\r\n * a handler function for every possible property change. This allows adding complex handing\r\n * if a property value requires complicated merging.\r\n * @returns A resolver map with resolvers for the property.\r\n */\r\n protected async createPropertyValueResolver(): Promise<PropertyValueResolver<TItem>> {\r\n // Can be overriden for complex property value merging\r\n return {};\r\n }\r\n\r\n /**\r\n * This overridable method gets called for more complex merging.\r\n * @param _itemKey The key of the current schema item.\r\n * @param _source The source item that shall gets merged into.\r\n * @param _change The schema item change to be applied.\r\n */\r\n protected async merge(_itemKey: SchemaItemKey, _source: TItem, _change: SchemaItemChanges) {\r\n // Can be overriden for complex merging\r\n }\r\n\r\n protected async lookup<T extends SchemaItem>(schemaItem: T): Promise<T | undefined>{\r\n const itemKey = new SchemaItemKey(schemaItem.name, this.context.sourceSchema.schemaKey.matches(schemaItem.schema.schemaKey)\r\n ? this.context.targetSchema.schemaKey\r\n : schemaItem.schema.schemaKey,\r\n );\r\n return this.context.targetSchema.lookupItem<T>(itemKey);\r\n }\r\n\r\n /**\r\n * Merges the given schema item changes in the current context.\r\n * @param context The merging context\r\n * @param schemaItemChanges An iterable of item changes.\r\n */\r\n public static async mergeChanges<TChange extends SchemaItemChanges>(context: SchemaMergeContext, schemaItemChanges: Iterable<TChange>) {\r\n const merger = new this(context);\r\n for(const change of schemaItemChanges) {\r\n\r\n // Gets the source and the target item. The target item could be undefined at that point.\r\n const sourceItem = (await context.sourceSchema.getItem<SchemaItem>(change.ecTypeName))!;\r\n let targetItemKey = new SchemaItemKey(change.ecTypeName, context.targetSchema.schemaKey);\r\n\r\n // In case the schema item does not exists in the target schema, an instance for\r\n // this schema item is created. It's properties get set by the merger then.\r\n if(change.schemaItemMissing?.changeType === ChangeType.Missing) {\r\n // Check for name to make sure there is no collision for items with the same name\r\n // but different type.\r\n if(await context.targetSchema.lookupItem(targetItemKey) !== undefined) {\r\n throw new Error(`Schema ${context.targetSchema.name} already contains a Schema Item ${change.ecTypeName}.`);\r\n }\r\n\r\n // TODO: Think about renaming the Schema Item. This could be controlled though a flag.\r\n targetItemKey = await SchemaItemFactory.create(context, sourceItem);\r\n }\r\n\r\n await merger.mergeItemPropertyValues(targetItemKey, change.propertyValueChanges);\r\n await merger.merge(targetItemKey, sourceItem, change);\r\n }\r\n }\r\n /**\r\n * Merges the property values.\r\n * @param targetItem The current schema item\r\n * @param changes The property changes.\r\n */\r\n private async mergeItemPropertyValues(targetItemKey: SchemaItemKey, changes: PropertyValueChange[]) {\r\n // No need to process anything if no properties differ.\r\n if(changes.length === 0) {\r\n return;\r\n }\r\n\r\n const targetItem = (await this.context.targetSchema.lookupItem<SchemaItem>(targetItemKey));\r\n const jsonProps = (targetItem?.toJSON() ?? {}) as MutableSchemaItemProps<TItem>;\r\n const propertyResolver = await this.createPropertyValueResolver();\r\n\r\n for(const change of changes) {\r\n const [propertyName, propertyNewValue, propertyOldValue] = change.diagnostic.messageArgs! as [keyof typeof jsonProps, any, any];\r\n const resolver = propertyResolver[propertyName];\r\n jsonProps[propertyName] = resolver !== undefined\r\n ? resolver(propertyNewValue, targetItemKey, propertyOldValue)\r\n : propertyNewValue;\r\n }\r\n\r\n await this.context.editor.schemaItems.applyProps(targetItemKey, jsonProps);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/SchemaMerger.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAkB,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"SchemaMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/SchemaMerger.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAkB,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAaxD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;CACtC;AAED;;;;GAIG;AACH,qBAAa,YAAY;IACvB;;;;;;;OAOG;YACW,gBAAgB;IAW9B;;;;;OAKG;IACU,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAkChF"}
|
|
@@ -13,10 +13,14 @@ const SchemaComparer_1 = require("../Validation/SchemaComparer");
|
|
|
13
13
|
const Editor_1 = require("../Editing/Editor");
|
|
14
14
|
const SchemaItemMerger_1 = require("./SchemaItemMerger");
|
|
15
15
|
const SchemaReferenceMerger_1 = require("./SchemaReferenceMerger");
|
|
16
|
-
const ClassMerger_1 = require("./ClassMerger");
|
|
17
16
|
const CAClassMerger_1 = require("./CAClassMerger");
|
|
18
17
|
const EnumerationMerger_1 = require("./EnumerationMerger");
|
|
19
18
|
const ConstantMerger_1 = require("./ConstantMerger");
|
|
19
|
+
const EntityClassMerger_1 = require("./EntityClassMerger");
|
|
20
|
+
const StructClassMerger_1 = require("./StructClassMerger");
|
|
21
|
+
const MixinMerger_1 = require("./MixinMerger");
|
|
22
|
+
const CustomAttributeMerger_1 = require("./CustomAttributeMerger");
|
|
23
|
+
const KindOfQuantityMerger_1 = require("./KindOfQuantityMerger");
|
|
20
24
|
/**
|
|
21
25
|
* Class to merge two schemas together.
|
|
22
26
|
* @see [[merge]] to merge the schemas.
|
|
@@ -59,10 +63,16 @@ class SchemaMerger {
|
|
|
59
63
|
await SchemaItemMerger_1.SchemaItemMerger.mergeChanges(mergeContext, itemChanges.unitSystems);
|
|
60
64
|
await SchemaItemMerger_1.SchemaItemMerger.mergeChanges(mergeContext, itemChanges.phenomenons);
|
|
61
65
|
await ConstantMerger_1.default.mergeChanges(mergeContext, itemChanges.constants);
|
|
66
|
+
await KindOfQuantityMerger_1.default.mergeChanges(mergeContext, itemChanges.kindOfQuantities);
|
|
62
67
|
// TODO: For now we just do simple copy and merging of properties and classes. For more complex types
|
|
63
68
|
// with bases classes or relationships, this might need to get extended.
|
|
64
69
|
await CAClassMerger_1.default.mergeChanges(mergeContext, itemChanges.customAttributeClasses);
|
|
65
|
-
await
|
|
70
|
+
await StructClassMerger_1.default.mergeChanges(mergeContext, itemChanges.structClasses);
|
|
71
|
+
await EntityClassMerger_1.default.mergeChanges(mergeContext, itemChanges.entityClasses);
|
|
72
|
+
await MixinMerger_1.default.mergeChanges(mergeContext, itemChanges.mixins);
|
|
73
|
+
await (0, CustomAttributeMerger_1.mergeCustomAttributes)(mergeContext, schemaChanges.customAttributeChanges.values(), async (ca) => {
|
|
74
|
+
return mergeContext.editor.addCustomAttribute(mergeContext.targetSchema.schemaKey, ca);
|
|
75
|
+
});
|
|
66
76
|
// TODO: For now we directly manipulate the target schema. For error handing purposes, we should first
|
|
67
77
|
// merge into a temporary schema and eventually swap that with the given instance.
|
|
68
78
|
return targetSchema;
|
|
@@ -75,13 +85,16 @@ exports.SchemaMerger = SchemaMerger;
|
|
|
75
85
|
*/
|
|
76
86
|
function getSchemaItemChanges(schemaChanges) {
|
|
77
87
|
return {
|
|
78
|
-
get
|
|
88
|
+
get entityClasses() { return filterChangesByItemType(schemaChanges.classChanges, ecschema_metadata_1.SchemaItemType.EntityClass); },
|
|
79
89
|
get constants() { return filterChangesByItemType(schemaChanges.schemaItemChanges, ecschema_metadata_1.SchemaItemType.Constant); },
|
|
80
90
|
get customAttributeClasses() { return filterChangesByItemType(schemaChanges.classChanges, ecschema_metadata_1.SchemaItemType.CustomAttributeClass); },
|
|
81
91
|
get enumeratations() { return schemaChanges.enumerationChanges.values(); },
|
|
92
|
+
get kindOfQuantities() { return schemaChanges.kindOfQuantityChanges.values(); },
|
|
82
93
|
get phenomenons() { return filterChangesByItemType(schemaChanges.schemaItemChanges, ecschema_metadata_1.SchemaItemType.Phenomenon); },
|
|
83
94
|
get propertyCategories() { return filterChangesByItemType(schemaChanges.schemaItemChanges, ecschema_metadata_1.SchemaItemType.PropertyCategory); },
|
|
84
95
|
get unitSystems() { return filterChangesByItemType(schemaChanges.schemaItemChanges, ecschema_metadata_1.SchemaItemType.UnitSystem); },
|
|
96
|
+
get structClasses() { return filterChangesByItemType(schemaChanges.classChanges, ecschema_metadata_1.SchemaItemType.StructClass); },
|
|
97
|
+
get mixins() { return filterChangesByItemType(schemaChanges.classChanges, ecschema_metadata_1.SchemaItemType.Mixin); },
|
|
85
98
|
};
|
|
86
99
|
}
|
|
87
100
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaMerger.js","sourceRoot":"","sources":["../../../src/Merging/SchemaMerger.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAkE;AAElE,iEAA8D;AAC9D,8CAAwD;AACxD,yDAAsD;AAEtD,mEAA4D;AAC5D,+CAAwC;AACxC,mDAA4C;AAC5C,2DAAoD;AACpD,qDAA+C;AAY/C;;;;GAIG;AACH,MAAa,YAAY;IACvB;;;;;;;OAOG;IACK,KAAK,CAAC,gBAAgB,CAAC,YAAoB,EAAE,YAAoB;QACvE,MAAM,WAAW,GAAoB,EAAE,CAAC;QACxC,MAAM,cAAc,GAAG,IAAI,+BAAc,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAE1F,kFAAkF;QAClF,mEAAmE;QACnE,MAAM,cAAc,CAAC,cAAc,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAEhE,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACI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AAC,CAAC,CAAC,CAAC;QACrI,IAAI,SAAS,KAAK,OAAO,uBAAuB,CAAC,aAAa,CAAC,iBAAiB,EAAE,kCAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC7G,IAAI,sBAAsB,KAAK,OAAO,uBAAuB,CAAC,aAAa,CAAC,YAAY,EAAE,kCAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;QACjI,IAAI,cAAc,KAAK,OAAO,aAAa,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC1E,IAAI,WAAW,KAAK,OAAO,uBAAuB,CAAC,aAAa,CAAC,iBAAiB,EAAE,kCAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACjH,IAAI,kBAAkB,KAAK,OAAO,uBAAuB,CAAC,aAAa,CAAC,iBAAiB,EAAE,kCAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAC9H,IAAI,WAAW,KAAK,OAAO,uBAAuB,CAAC,aAAa,CAAC,iBAAiB,EAAE,kCAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KAClH,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,QAAS,CAAC,CAAC,uBAAuB,CAAoC,OAA6B,EAAE,GAAG,KAAuB;IAC7H,KAAI,MAAM,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE;QACpC,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE;YACzC,MAAM,MAAM,CAAC;SACd;KACF;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\n/** @packageDocumentation\r\n * @module Merging\r\n */\r\n\r\nimport { Schema, SchemaItemType } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaChanges, SchemaItemChanges } from \"../Validation/SchemaChanges\";\r\nimport { SchemaComparer } from \"../Validation/SchemaComparer\";\r\nimport { SchemaContextEditor } from \"../Editing/Editor\";\r\nimport { SchemaItemMerger } from \"./SchemaItemMerger\";\r\n\r\nimport mergeSchemaReferences from \"./SchemaReferenceMerger\";\r\nimport ClassMerger from \"./ClassMerger\";\r\nimport CAClassMerger from \"./CAClassMerger\";\r\nimport EnumerationMerger from \"./EnumerationMerger\";\r\nimport ConstantsMerger from \"./ConstantMerger\";\r\n\r\n/**\r\n * Defines the context of a Schema merging run.\r\n * @beta\r\n */\r\nexport interface SchemaMergeContext {\r\n readonly targetSchema: Schema;\r\n readonly sourceSchema: Schema;\r\n readonly editor: SchemaContextEditor;\r\n}\r\n\r\n/**\r\n * Class to merge two schemas together.\r\n * @see [[merge]] to merge the schemas.\r\n * @beta\r\n */\r\nexport class SchemaMerger {\r\n /**\r\n * Gets the @see SchemaChanges between the two given Schemas from perspective of the source\r\n * to the target schema. For example if source contains a class which does not exists in the\r\n * target one, it would be listed as missing.\r\n * @param targetSchema The schema the differences gets merged into.\r\n * @param sourceSchema The schema to compare.\r\n * @returns An instance of @see SchemaChanges between the two schemas.\r\n */\r\n private async getSchemaChanges(targetSchema: Schema, sourceSchema: Schema): Promise<SchemaChanges> {\r\n const changesList: SchemaChanges[] = [];\r\n const schemaComparer = new SchemaComparer({ report: changesList.push.bind(changesList) });\r\n\r\n // It is important to compare the schema items by name, not full name as otherwise\r\n // we'd often see differences when comparing two different schemas.\r\n await schemaComparer.compareSchemas(sourceSchema, targetSchema);\r\n\r\n return changesList[0];\r\n }\r\n\r\n /**\r\n * Copy the SchemaItems of the source schemas to the target schema.\r\n * @param targetSchema The schema the SchemaItems gets merged to.\r\n * @param sourceSchema The schema the SchemaItems gets copied from.\r\n * @returns The merged target schema.\r\n */\r\n public async merge(targetSchema: Schema, sourceSchema: Schema): Promise<Schema> {\r\n const schemaChanges = await this.getSchemaChanges(targetSchema, sourceSchema);\r\n const mergeContext: SchemaMergeContext = {\r\n editor: new SchemaContextEditor(targetSchema.context),\r\n targetSchema,\r\n sourceSchema,\r\n };\r\n\r\n await mergeSchemaReferences(mergeContext, schemaChanges);\r\n\r\n const itemChanges = getSchemaItemChanges(schemaChanges);\r\n await EnumerationMerger.mergeChanges(mergeContext, itemChanges.enumeratations);\r\n await SchemaItemMerger.mergeChanges(mergeContext, itemChanges.propertyCategories);\r\n\r\n await SchemaItemMerger.mergeChanges(mergeContext, itemChanges.unitSystems);\r\n await SchemaItemMerger.mergeChanges(mergeContext, itemChanges.phenomenons);\r\n await ConstantsMerger.mergeChanges(mergeContext, itemChanges.constants);\r\n\r\n // TODO: For now we just do simple copy and merging of properties and classes. For more complex types\r\n // with bases classes or relationships, this might need to get extended.\r\n await CAClassMerger.mergeChanges(mergeContext, itemChanges.customAttributeClasses);\r\n await ClassMerger.mergeChanges(mergeContext, itemChanges.classes);\r\n\r\n // TODO: For now we directly manipulate the target schema. For error handing purposes, we should first\r\n // merge into a temporary schema and eventually swap that with the given instance.\r\n return targetSchema;\r\n }\r\n}\r\n\r\n/**\r\n * This helper method composes the different schema change objects to a single easier\r\n * to use object that should improve readability when the methods get called.\r\n */\r\nfunction getSchemaItemChanges(schemaChanges: SchemaChanges) {\r\n return {\r\n get classes() { return filterChangesByItemType(schemaChanges.classChanges, SchemaItemType.EntityClass, SchemaItemType.StructClass); },\r\n get constants() { return filterChangesByItemType(schemaChanges.schemaItemChanges, SchemaItemType.Constant); },\r\n get customAttributeClasses() { return filterChangesByItemType(schemaChanges.classChanges, SchemaItemType.CustomAttributeClass); },\r\n get enumeratations() { return schemaChanges.enumerationChanges.values(); },\r\n get phenomenons() { return filterChangesByItemType(schemaChanges.schemaItemChanges, SchemaItemType.Phenomenon); },\r\n get propertyCategories() { return filterChangesByItemType(schemaChanges.schemaItemChanges, SchemaItemType.PropertyCategory); },\r\n get unitSystems() { return filterChangesByItemType(schemaChanges.schemaItemChanges, SchemaItemType.UnitSystem); },\r\n };\r\n}\r\n\r\n/**\r\n * Filters and returns the changed items by its schema item type.\r\n * @param changes A map of changed schema items.\r\n * @param types A list of schema item types to filter.\r\n * @returns An Iterable with the filtered schema items.\r\n */\r\nfunction * filterChangesByItemType<TChange extends SchemaItemChanges>(changes: Map<string, TChange>, ...types: SchemaItemType[]): Iterable<TChange> {\r\n for(const change of changes.values()) {\r\n if (types.includes(change.schemaItemType)) {\r\n yield change;\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaMerger.js","sourceRoot":"","sources":["../../../src/Merging/SchemaMerger.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAkE;AAElE,iEAA8D;AAC9D,8CAAwD;AACxD,yDAAsD;AAEtD,mEAA4D;AAC5D,mDAA4C;AAC5C,2DAAoD;AACpD,qDAA+C;AAC/C,2DAAoD;AACpD,2DAAoD;AACpD,+CAAwC;AACxC,mEAAgE;AAChE,iEAA0D;AAY1D;;;;GAIG;AACH,MAAa,YAAY;IACvB;;;;;;;OAOG;IACK,KAAK,CAAC,gBAAgB,CAAC,YAAoB,EAAE,YAAoB;QACvE,MAAM,WAAW,GAAoB,EAAE,CAAC;QACxC,MAAM,cAAc,GAAG,IAAI,+BAAc,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAE1F,kFAAkF;QAClF,mEAAmE;QACnE,MAAM,cAAc,CAAC,cAAc,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAEhE,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,KAAK,CAAC,YAAoB,EAAE,YAAoB;QAC3D,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAC9E,MAAM,YAAY,GAAuB;YACvC,MAAM,EAAE,IAAI,4BAAmB,CAAC,YAAY,CAA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CAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACnG,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,QAAS,CAAC,CAAC,uBAAuB,CAAoC,OAA6B,EAAE,GAAG,KAAuB;IAC7H,KAAI,MAAM,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE;QACpC,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE;YACzC,MAAM,MAAM,CAAC;SACd;KACF;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\n/** @packageDocumentation\r\n * @module Merging\r\n */\r\n\r\nimport { Schema, SchemaItemType } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaChanges, SchemaItemChanges } from \"../Validation/SchemaChanges\";\r\nimport { SchemaComparer } from \"../Validation/SchemaComparer\";\r\nimport { SchemaContextEditor } from \"../Editing/Editor\";\r\nimport { SchemaItemMerger } from \"./SchemaItemMerger\";\r\n\r\nimport mergeSchemaReferences from \"./SchemaReferenceMerger\";\r\nimport CAClassMerger from \"./CAClassMerger\";\r\nimport EnumerationMerger from \"./EnumerationMerger\";\r\nimport ConstantsMerger from \"./ConstantMerger\";\r\nimport EntityClassMerger from \"./EntityClassMerger\";\r\nimport StructClassMerger from \"./StructClassMerger\";\r\nimport MixinMerger from \"./MixinMerger\";\r\nimport { mergeCustomAttributes } from \"./CustomAttributeMerger\";\r\nimport KindOfQuantityMerger from \"./KindOfQuantityMerger\";\r\n\r\n/**\r\n * Defines the context of a Schema merging run.\r\n * @beta\r\n */\r\nexport interface SchemaMergeContext {\r\n readonly targetSchema: Schema;\r\n readonly sourceSchema: Schema;\r\n readonly editor: SchemaContextEditor;\r\n}\r\n\r\n/**\r\n * Class to merge two schemas together.\r\n * @see [[merge]] to merge the schemas.\r\n * @beta\r\n */\r\nexport class SchemaMerger {\r\n /**\r\n * Gets the @see SchemaChanges between the two given Schemas from perspective of the source\r\n * to the target schema. For example if source contains a class which does not exists in the\r\n * target one, it would be listed as missing.\r\n * @param targetSchema The schema the differences gets merged into.\r\n * @param sourceSchema The schema to compare.\r\n * @returns An instance of @see SchemaChanges between the two schemas.\r\n */\r\n private async getSchemaChanges(targetSchema: Schema, sourceSchema: Schema): Promise<SchemaChanges> {\r\n const changesList: SchemaChanges[] = [];\r\n const schemaComparer = new SchemaComparer({ report: changesList.push.bind(changesList) });\r\n\r\n // It is important to compare the schema items by name, not full name as otherwise\r\n // we'd often see differences when comparing two different schemas.\r\n await schemaComparer.compareSchemas(sourceSchema, targetSchema);\r\n\r\n return changesList[0];\r\n }\r\n\r\n /**\r\n * Copy the SchemaItems of the source schemas to the target schema.\r\n * @param targetSchema The schema the SchemaItems gets merged to.\r\n * @param sourceSchema The schema the SchemaItems gets copied from.\r\n * @returns The merged target schema.\r\n */\r\n public async merge(targetSchema: Schema, sourceSchema: Schema): Promise<Schema> {\r\n const schemaChanges = await this.getSchemaChanges(targetSchema, sourceSchema);\r\n const mergeContext: SchemaMergeContext = {\r\n editor: new SchemaContextEditor(targetSchema.context),\r\n targetSchema,\r\n sourceSchema,\r\n };\r\n\r\n await mergeSchemaReferences(mergeContext, schemaChanges);\r\n\r\n const itemChanges = getSchemaItemChanges(schemaChanges);\r\n await EnumerationMerger.mergeChanges(mergeContext, itemChanges.enumeratations);\r\n await SchemaItemMerger.mergeChanges(mergeContext, itemChanges.propertyCategories);\r\n\r\n await SchemaItemMerger.mergeChanges(mergeContext, itemChanges.unitSystems);\r\n await SchemaItemMerger.mergeChanges(mergeContext, itemChanges.phenomenons);\r\n await ConstantsMerger.mergeChanges(mergeContext, itemChanges.constants);\r\n await KindOfQuantityMerger.mergeChanges(mergeContext, itemChanges.kindOfQuantities);\r\n\r\n // TODO: For now we just do simple copy and merging of properties and classes. For more complex types\r\n // with bases classes or relationships, this might need to get extended.\r\n await CAClassMerger.mergeChanges(mergeContext, itemChanges.customAttributeClasses);\r\n await StructClassMerger.mergeChanges(mergeContext, itemChanges.structClasses);\r\n await EntityClassMerger.mergeChanges(mergeContext, itemChanges.entityClasses);\r\n await MixinMerger.mergeChanges(mergeContext, itemChanges.mixins);\r\n\r\n await mergeCustomAttributes(mergeContext, schemaChanges.customAttributeChanges.values(), async (ca) => {\r\n return mergeContext.editor.addCustomAttribute(mergeContext.targetSchema.schemaKey, ca);\r\n });\r\n\r\n // TODO: For now we directly manipulate the target schema. For error handing purposes, we should first\r\n // merge into a temporary schema and eventually swap that with the given instance.\r\n return targetSchema;\r\n }\r\n}\r\n\r\n/**\r\n * This helper method composes the different schema change objects to a single easier\r\n * to use object that should improve readability when the methods get called.\r\n */\r\nfunction getSchemaItemChanges(schemaChanges: SchemaChanges) {\r\n return {\r\n get entityClasses() { return filterChangesByItemType(schemaChanges.classChanges, SchemaItemType.EntityClass); },\r\n get constants() { return filterChangesByItemType(schemaChanges.schemaItemChanges, SchemaItemType.Constant); },\r\n get customAttributeClasses() { return filterChangesByItemType(schemaChanges.classChanges, SchemaItemType.CustomAttributeClass); },\r\n get enumeratations() { return schemaChanges.enumerationChanges.values(); },\r\n get kindOfQuantities() { return schemaChanges.kindOfQuantityChanges.values(); },\r\n get phenomenons() { return filterChangesByItemType(schemaChanges.schemaItemChanges, SchemaItemType.Phenomenon); },\r\n get propertyCategories() { return filterChangesByItemType(schemaChanges.schemaItemChanges, SchemaItemType.PropertyCategory); },\r\n get unitSystems() { return filterChangesByItemType(schemaChanges.schemaItemChanges, SchemaItemType.UnitSystem); },\r\n get structClasses() { return filterChangesByItemType(schemaChanges.classChanges, SchemaItemType.StructClass); },\r\n get mixins() { return filterChangesByItemType(schemaChanges.classChanges, SchemaItemType.Mixin); },\r\n };\r\n}\r\n\r\n/**\r\n * Filters and returns the changed items by its schema item type.\r\n * @param changes A map of changed schema items.\r\n * @param types A list of schema item types to filter.\r\n * @returns An Iterable with the filtered schema items.\r\n */\r\nfunction * filterChangesByItemType<TChange extends SchemaItemChanges>(changes: Map<string, TChange>, ...types: SchemaItemType[]): Iterable<TChange> {\r\n for(const change of changes.values()) {\r\n if (types.includes(change.schemaItemType)) {\r\n yield change;\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SchemaKey, StructClass } from "@itwin/ecschema-metadata";
|
|
2
|
+
import { ClassMerger } from "./ClassMerger";
|
|
3
|
+
import { SchemaItemEditResults } from "../Editing/Editor";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export default class StructClassMerger extends ClassMerger<StructClass> {
|
|
8
|
+
protected create(schemaKey: SchemaKey, ecClass: StructClass): Promise<SchemaItemEditResults>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=StructClassMerger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StructClassMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/StructClassMerger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,WAAW,CAAC,WAAW,CAAC;cAE5C,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAG5G"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ClassMerger_1 = require("./ClassMerger");
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
class StructClassMerger extends ClassMerger_1.ClassMerger {
|
|
8
|
+
async create(schemaKey, ecClass) {
|
|
9
|
+
return this.context.editor.structs.create(schemaKey, ecClass.name);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.default = StructClassMerger;
|
|
13
|
+
//# sourceMappingURL=StructClassMerger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StructClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/StructClassMerger.ts"],"names":[],"mappings":";;AAKA,+CAA4C;AAG5C;;GAEG;AACH,MAAqB,iBAAkB,SAAQ,yBAAwB;IAElD,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,OAAoB;QACxE,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,CAAC;CACF;AALD,oCAKC","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 { SchemaKey, StructClass } from \"@itwin/ecschema-metadata\";\r\nimport { ClassMerger } from \"./ClassMerger\";\r\nimport { SchemaItemEditResults } from \"../Editing/Editor\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport default class StructClassMerger extends ClassMerger<StructClass> {\r\n\r\n protected override async create(schemaKey: SchemaKey, ecClass: StructClass): Promise<SchemaItemEditResults> {\r\n return this.context.editor.structs.create(schemaKey, ecClass.name);\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SchemaItemKey, StructProperty } from "@itwin/ecschema-metadata";
|
|
2
|
+
import { AnyPropertyMerger } from "./AnyPropertyMerger";
|
|
3
|
+
import { PropertyEditResults } from "../Editing/Editor";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare class StructPropertyMerger extends AnyPropertyMerger<StructProperty> {
|
|
8
|
+
mergeAttributes(property: StructProperty, attributeName: string, attributeNewValue: any, attributeOldValue: any): Promise<PropertyEditResults | boolean>;
|
|
9
|
+
createFromProps(classKey: SchemaItemKey, property: StructProperty): Promise<PropertyEditResults>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=StructPropertyMerger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StructPropertyMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/StructPropertyMerger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAe,cAAc,EAAuB,MAAM,0BAA0B,CAAC;AAC3G,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,iBAAiB,CAAC,cAAc,CAAC;IACnD,eAAe,CAAC,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,EAAE,iBAAiB,EAAE,GAAG,GAAG,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC;IAcxJ,eAAe,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAsBvH"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StructPropertyMerger = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
9
|
+
const AnyPropertyMerger_1 = require("./AnyPropertyMerger");
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
class StructPropertyMerger extends AnyPropertyMerger_1.AnyPropertyMerger {
|
|
14
|
+
async mergeAttributes(property, attributeName, attributeNewValue, attributeOldValue) {
|
|
15
|
+
const results = await super.mergeAttributes(property, attributeName, attributeNewValue, attributeOldValue);
|
|
16
|
+
if (results === true || this.isPropertyEditResults(results) && results.errorMessage !== undefined) {
|
|
17
|
+
return results;
|
|
18
|
+
}
|
|
19
|
+
switch (attributeName) {
|
|
20
|
+
case "structClass": {
|
|
21
|
+
return { errorMessage: `Changing the property '${property.name}' structClass is not supported.` };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
async createFromProps(classKey, property) {
|
|
27
|
+
const results = await super.getPropertyProps(property);
|
|
28
|
+
if (this.isPropertyEditResults(results) && results.errorMessage !== undefined) {
|
|
29
|
+
return results;
|
|
30
|
+
}
|
|
31
|
+
const itemKey = new ecschema_metadata_1.SchemaItemKey(property.structClass.name, this.context.sourceSchema.schemaKey.matches(property.structClass.schema.schemaKey)
|
|
32
|
+
? this.context.targetSchema.schemaKey
|
|
33
|
+
: property.structClass.schema.schemaKey);
|
|
34
|
+
const type = await this.context.targetSchema.lookupItem(itemKey);
|
|
35
|
+
if (type === undefined) {
|
|
36
|
+
return { errorMessage: `Unable to locate the struct class ${property.structClass.name} in the merged schema.` };
|
|
37
|
+
}
|
|
38
|
+
const props = {
|
|
39
|
+
...property.toJSON(),
|
|
40
|
+
...results,
|
|
41
|
+
typeName: type.fullName,
|
|
42
|
+
};
|
|
43
|
+
return this.context.editor.entities.createStructPropertyFromProps(classKey, property.name, type, props);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.StructPropertyMerger = StructPropertyMerger;
|
|
47
|
+
//# sourceMappingURL=StructPropertyMerger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StructProperty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,CAAC,SAAS,CACxC,CAAC;QACF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAc,OAAO,CAAC,CAAC;QAC9E,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,OAAO,EAAE,YAAY,EAAE,qCAAqC,QAAQ,CAAC,WAAW,CAAC,IAAI,wBAAwB,EAAE,CAAC;SACjH;QAED,MAAM,KAAK,GAAwB;YACjC,GAAG,QAAQ,CAAC,MAAM,EAAE;YACpB,GAAG,OAAO;YACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;QACF,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,6BAA6B,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1G,CAAC;CACF;AArCD,oDAqCC","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 { SchemaItemKey, StructClass, StructProperty, StructPropertyProps } from \"@itwin/ecschema-metadata\";\r\nimport { AnyPropertyMerger } from \"./AnyPropertyMerger\";\r\nimport { PropertyEditResults } from \"../Editing/Editor\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class StructPropertyMerger extends AnyPropertyMerger<StructProperty> {\r\n public override async mergeAttributes(property: StructProperty, attributeName: string, attributeNewValue: any, attributeOldValue: any): Promise<PropertyEditResults | boolean> {\r\n const results = await super.mergeAttributes(property, attributeName, attributeNewValue, attributeOldValue);\r\n if (results === true || this.isPropertyEditResults(results) && results.errorMessage !== undefined) {\r\n return results;\r\n }\r\n\r\n switch (attributeName) {\r\n case \"structClass\": {\r\n return { errorMessage: `Changing the property '${property.name}' structClass is not supported.` };\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n public override async createFromProps(classKey: SchemaItemKey, property: StructProperty): Promise<PropertyEditResults> {\r\n const results = await super.getPropertyProps(property);\r\n if (this.isPropertyEditResults(results) && results.errorMessage !== undefined) {\r\n return results;\r\n }\r\n\r\n const itemKey = new SchemaItemKey(property.structClass.name, this.context.sourceSchema.schemaKey.matches(property.structClass.schema.schemaKey)\r\n ? this.context.targetSchema.schemaKey\r\n : property.structClass.schema.schemaKey,\r\n );\r\n const type = await this.context.targetSchema.lookupItem<StructClass>(itemKey);\r\n if (type === undefined) {\r\n return { errorMessage: `Unable to locate the struct class ${property.structClass.name} in the merged schema.` };\r\n }\r\n\r\n const props: StructPropertyProps = {\r\n ...property.toJSON(),\r\n ...results,\r\n typeName: type.fullName,\r\n };\r\n return this.context.editor.entities.createStructPropertyFromProps(classKey, property.name, type, props);\r\n }\r\n}\r\n"]}
|
|
@@ -11,7 +11,7 @@ import { ISchemaCompareReporter } from "./SchemaCompareReporter";
|
|
|
11
11
|
export declare class SchemaCompareResultDelegate {
|
|
12
12
|
private _schemaChangeReporters;
|
|
13
13
|
private _schemaAChanges;
|
|
14
|
-
private _schemaBChanges
|
|
14
|
+
private _schemaBChanges;
|
|
15
15
|
/**
|
|
16
16
|
* Initializes a new SchemaCompareResultDelegate instance.
|
|
17
17
|
* @param reporters The [[ISchemaCompareReporter]] objects to use to report schema differences.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaCompareResultDelegate.d.ts","sourceRoot":"","sources":["../../../src/Validation/SchemaCompareResultDelegate.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EACtE,oBAAoB,EAAE,6BAA6B,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EACnH,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,sBAAsB,EAC9F,MAAM,EAAE,UAAU,EAAE,I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AAG,OAAO,CAAC,IAAI,CAAC;YAKjJ,gBAAgB;CAU/B"}
|
|
@@ -21,10 +21,8 @@ class SchemaCompareResultDelegate {
|
|
|
21
21
|
*/
|
|
22
22
|
constructor(schemaA, schemaB, ...reporters) {
|
|
23
23
|
this._schemaChangeReporters = reporters;
|
|
24
|
-
const keyMismatch = !schemaA.schemaKey.matches(schemaB.schemaKey);
|
|
25
24
|
this._schemaAChanges = new SchemaChanges_1.SchemaChanges(schemaA);
|
|
26
|
-
|
|
27
|
-
this._schemaBChanges = new SchemaChanges_1.SchemaChanges(schemaB);
|
|
25
|
+
this._schemaBChanges = new SchemaChanges_1.SchemaChanges(schemaB);
|
|
28
26
|
}
|
|
29
27
|
get schemaChangeReporters() {
|
|
30
28
|
return this._schemaChangeReporters;
|
|
@@ -335,7 +333,7 @@ class SchemaCompareResultDelegate {
|
|
|
335
333
|
await this.reportDiagnostic(diag);
|
|
336
334
|
}
|
|
337
335
|
async reportDiagnostic(diagnostic) {
|
|
338
|
-
if (
|
|
336
|
+
if (this._schemaAChanges.schema === diagnostic.schema) {
|
|
339
337
|
this._schemaAChanges.addDiagnostic(diagnostic);
|
|
340
338
|
return;
|
|
341
339
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaCompareResultDelegate.js","sourceRoot":"","sources":["../../../src/Validation/SchemaCompareResultDelegate.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAQH,mDAAgD;AAChD,yEAAsE;AAItE;;;GAGG;AACH,MAAa,2BAA2B;IAKtC;;;OAGG;IACH,YAAY,OAAe,EAAE,OAAe,EAAE,GAAG,SAAmC;QAClF,IAAI,CAAC,sBAAsB,GAAG,SAAS,CAAC;QACxC,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAClE,IAAI,CAAC,eAAe,GAAG,IAAI,6BAAa,CAAC,OAAO,CAAC,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AE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QACnG,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAAC,UAAyB;QACtD,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,EAAE;YAC9E,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAC/C,OAAO;SACR;QACD,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,EAAE;YACrD,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAC/C,OAAO;SACR;IACH,CAAC;CACF;AA9WD,kEA8WC","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, AnyEnumerator, AnyProperty, Constant, CustomAttribute,\r\n CustomAttributeClass, CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity,\r\n Mixin, OverrideFormat, Phenomenon, PropertyCategory, RelationshipClass, RelationshipConstraint,\r\n Schema, SchemaItem, Unit,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { AnyDiagnostic } from \"./Diagnostic\";\r\nimport { SchemaChanges } from \"./SchemaChanges\";\r\nimport { SchemaCompareDiagnostics } from \"./SchemaCompareDiagnostics\";\r\nimport { SchemaCompareDirection } from \"./SchemaComparer\";\r\nimport { ISchemaCompareReporter } from \"./SchemaCompareReporter\";\r\n\r\n/**\r\n * Used by the [[SchemaComparer]] to report differences found during schema comparison.\r\n * @internal\r\n */\r\nexport class SchemaCompareResultDelegate {\r\n private _schemaChangeReporters: ISchemaCompareReporter[];\r\n private _schemaAChanges: SchemaChanges;\r\n private _schemaBChanges?: SchemaChanges;\r\n\r\n /**\r\n * Initializes a new SchemaCompareResultDelegate instance.\r\n * @param reporters The [[ISchemaCompareReporter]] objects to use to report schema differences.\r\n */\r\n constructor(schemaA: Schema, schemaB: Schema, ...reporters: ISchemaCompareReporter[]) {\r\n this._schemaChangeReporters = reporters;\r\n const keyMismatch = !schemaA.schemaKey.matches(schemaB.schemaKey);\r\n this._schemaAChanges = new SchemaChanges(schemaA);\r\n if (keyMismatch)\r\n this._schemaBChanges = new SchemaChanges(schemaB);\r\n }\r\n\r\n public get schemaChangeReporters(): ISchemaCompareReporter[] {\r\n return this._schemaChangeReporters;\r\n }\r\n\r\n /**\r\n * Called by the SchemaComparer when the comparison is complete.\r\n */\r\n public compareComplete() {\r\n this.schemaChangeReporters.forEach((r) => r.report(this._schemaAChanges));\r\n if (this._schemaBChanges)\r\n this.schemaChangeReporters.forEach((r) => r.report(this._schemaBChanges!));\r\n }\r\n\r\n /**\r\n * Reports differences between Schema properties.\r\n * @param schemaA The first Schema supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first Schema.\r\n * @param valueB The value from the second Schema.\r\n */\r\n public async reportSchemaDelta(schemaA: Schema, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.SchemaDelta(schemaA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences in the schema reference collection of two schemas.\r\n * @param schemaA The first Schema supplied for comparison.\r\n * @param referenceSchema The missing schema reference.\r\n */\r\n public async reportSchemaReferenceMissing(schemaA: Schema, referenceSchema: Schema, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.SchemaReferenceMissing(schemaA, [referenceSchema]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences in the schema reference collection of two schemas where the reference version differs.\r\n * @param schemaA The first Schema supplied for comparison.\r\n * @param referenceSchema The missing schema reference.\r\n */\r\n public async reportSchemaReferenceDelta(schemaA: Schema, referenceSchema: Schema, versionA: string, versionB: string, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.SchemaReferenceDelta(schemaA, [referenceSchema, versionA, versionB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports that a given SchemaItem could not be found in the second Schema.\r\n * @param schemaItemA The SchemaItem from the first Schema.\r\n */\r\n public async reportSchemaItemMissing(schemaItemA: SchemaItem, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.SchemaItemMissing(schemaItemA, []);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between SchemaItem properties.\r\n * @param schemaItemA The first SchemaItem supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first SchemaItem.\r\n * @param valueB The value from the second SchemaItem.\r\n */\r\n public async reportSchemaItemDelta(schemaItemA: SchemaItem, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.SchemaItemDelta(schemaItemA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between ECClass properties.\r\n * @param classA The first ECClass supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first ECClass.\r\n * @param valueB The value from the second ECClass.\r\n */\r\n public async reportClassDelta(classA: AnyClass, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.ClassDelta(classA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences of the base class defined between two ECClass objects.\r\n * @param classA The first ECClass supplied for comparison.\r\n * @param baseClassA The base class of the first ECClass.\r\n * @param baseClassB The base class of the second ECClass.\r\n */\r\n public async reportBaseClassDelta(classA: AnyClass, baseClassA: AnyClass | undefined, baseClassB: AnyClass | undefined, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.BaseClassDelta(classA, [baseClassA, baseClassB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between ECProperty properties.\r\n * @param propertyA The first ECProperty supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first ECProperty.\r\n * @param valueB The value from the second ECProperty.\r\n */\r\n public async reportPropertyDelta(propertyA: AnyProperty, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.PropertyDelta(propertyA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports that an ECProperty found in the first ECClass could not be found in the second.\r\n * @param propertyA The ECProperty supplied for comparison.\r\n */\r\n public async reportPropertyMissing(propertyA: AnyProperty, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.PropertyMissing(propertyA, []);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports that a Mixin found in the first EntityClass could not be found in the second.\r\n * @param entityClassA The first EntityClass that is missing the Mixin.\r\n * @param mixinA The Mixin from the first EntityClass.\r\n */\r\n public async reportEntityMixinMissing(entityClassA: EntityClass, mixinA: Mixin, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.EntityMixinMissing(entityClassA, [mixinA]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between Mixin properties.\r\n * @param mixinA The first Mixin supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first Mixin.\r\n * @param valueB The value from the second Mixin.\r\n */\r\n public async reportMixinDelta(mixinA: Mixin, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.MixinDelta(mixinA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between RelationshipClass properties.\r\n * @param relationshipClassA The first RelationshipClass supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first RelationshipClass.\r\n * @param valueB The value from the second RelationshipClass.\r\n */\r\n public async reportRelationshipClassDelta(relationshipClassA: RelationshipClass, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.RelationshipDelta(relationshipClassA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between RelationshipConstraint properties.\r\n * @param constraintA The first RelationshipConstraint supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first RelationshipConstraint.\r\n * @param valueB The value from the second RelationshipConstraint.\r\n */\r\n public async reportRelationshipConstraintDelta(constraintA: RelationshipConstraint, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.RelationshipConstraintDelta(constraintA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports that a constraint class found in the first RelationshipConstraint could not be found in the second.\r\n * @param constraintA The first RelationshipConstraint that is missing the class constraint.\r\n * @param constraintClass The constraint ECClass from the first RelationshipConstraint.\r\n */\r\n public async reportRelationshipConstraintClassMissing(constraintA: RelationshipConstraint, constraintClass: EntityClass | Mixin | RelationshipClass, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.RelationshipConstraintClassMissing(constraintA, [constraintClass]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between CustomAttributeClass properties.\r\n * @param customAttributeA The first CustomAttributeClass supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first CustomAttributeClass.\r\n * @param valueB The value from the second CustomAttributeClass.\r\n */\r\n public async reportCustomAttributeClassDelta(customAttributeA: CustomAttributeClass, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.CustomAttributeClassDelta(customAttributeA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports that a CustomAttribute instance found in the first CustomAttribute container could not be found in the second.\r\n * @param customAttributeContainerA The first CustomAttribute container that is missing the CustomAttribute instance.\r\n * @param customAttribute The CustomAttribute missing.\r\n */\r\n public async reportCustomAttributeInstanceClassMissing(customAttributeContainerA: CustomAttributeContainerProps, customAttribute: CustomAttribute, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.CustomAttributeInstanceClassMissing(customAttributeContainerA, [customAttribute]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between Enumeration properties.\r\n * @param enumerationA The first Enumeration supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first Enumeration.\r\n * @param valueB The value from the second Enumeration.\r\n */\r\n public async reportEnumerationDelta(enumerationA: Enumeration, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.EnumerationDelta(enumerationA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports that a enumerator found in the first Enumeration could not be found in the second.\r\n * @param enumerationA The first Enumeration that is missing the enumerator.\r\n * @param enumerator The enumerator missing from the second schema.\r\n */\r\n public async reportEnumeratorMissing(enumerationA: Enumeration, enumerator: AnyEnumerator, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.EnumeratorMissing(enumerationA, [enumerator]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between enumerator properties within a given Enumeration.\r\n * @param enumerationA The first Enumeration supplied for comparison.\r\n * @param enumerator The enumerator containing differing property values.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first enumerator.\r\n * @param valueB The value from the second enumerator.\r\n */\r\n public async reportEnumeratorDelta(enumerationA: Enumeration, enumerator: AnyEnumerator, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.EnumeratorDelta(enumerationA, [enumerator, propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between KindOfQuantity properties.\r\n * @param koqA The first KindOfQuantity supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first KindOfQuantity.\r\n * @param valueB The value from the second KindOfQuantity.\r\n */\r\n public async reportKoqDelta(koqA: KindOfQuantity, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.KoqDelta(koqA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports that a presentation unit found in the first KindOfQuantity could not be found in the second.\r\n * @param koqA The first KindOfQuantity that is missing the presentation unit.\r\n * @param unit The Format or OverrideFormat presentation unit missing from the second schema.\r\n */\r\n public async reportPresentationUnitMissing(koqA: KindOfQuantity, unit: Format | OverrideFormat, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.PresentationUnitMissing(koqA, [unit]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between PropertyCategory properties.\r\n * @param categoryA The first PropertyCategory supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first PropertyCategory.\r\n * @param valueB The value from the second PropertyCategory.\r\n */\r\n public async reportPropertyCategoryDelta(categoryA: PropertyCategory, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.PropertyCategoryDelta(categoryA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between Format properties.\r\n * @param formatA The first Format supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first Format.\r\n * @param valueB The value from the second Format.\r\n */\r\n public async reportFormatDelta(formatA: Format, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.FormatDelta(formatA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports that a unit found in the first Format could not be found in the second.\r\n * @param formatA The first Format that is missing the unit.\r\n * @param unit The Unit or InvertedUnit missing from the second schema.\r\n */\r\n public async reportFormatUnitMissing(formatA: Format, unit: Unit | InvertedUnit, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.FormatUnitMissing(formatA, [unit]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between overridden labels within the Units of a given Format.\r\n * @param formatA The first Format supplied for comparison.\r\n * @param unit The Unit or InvertedUnit with differing label overrides.\r\n * @param labelA The value from the first label.\r\n * @param labelB The value from the second label.\r\n */\r\n public async reportUnitLabelOverrideDelta(formatA: Format, unit: Unit | InvertedUnit, labelA: string | undefined, labelB: string | undefined, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.UnitLabelOverrideDelta(formatA, [unit, labelA, labelB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between Unit properties.\r\n * @param unitA The first Unit supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first Unit.\r\n * @param valueB The value from the second Unit.\r\n */\r\n public async reportUnitDelta(unitA: Unit, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.UnitDelta(unitA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between InvertedUnit properties.\r\n * @param invertedUnitA The first InvertedUnit supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first InvertedUnit.\r\n * @param valueB The value from the second InvertedUnit.\r\n */\r\n public async reportInvertedUnitDelta(invertedUnitA: InvertedUnit, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.InvertedUnitDelta(invertedUnitA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between Phenomenon properties.\r\n * @param phenomenonA The first Phenomenon supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first Phenomenon.\r\n * @param valueB The value from the second Phenomenon.\r\n */\r\n public async reportPhenomenonDelta(phenomenonA: Phenomenon, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.PhenomenonDelta(phenomenonA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between Constant properties.\r\n * @param constantA The first Constant supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first Constant.\r\n * @param valueB The value from the second Constant.\r\n */\r\n public async reportConstantDelta(constantA: Constant, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.ConstantDelta(constantA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n private async reportDiagnostic(diagnostic: AnyDiagnostic): Promise<void> {\r\n if (!this._schemaBChanges || this._schemaAChanges.schema === diagnostic.schema) {\r\n this._schemaAChanges.addDiagnostic(diagnostic);\r\n return;\r\n }\r\n if (this._schemaBChanges.schema === diagnostic.schema) {\r\n this._schemaBChanges.addDiagnostic(diagnostic);\r\n return;\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaCompareResultDelegate.js","sourceRoot":"","sources":["../../../src/Validation/SchemaCompareResultDelegate.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAQH,mDAAgD;AAChD,yEAAsE;AAItE;;;GAGG;AACH,MAAa,2BAA2B;IAKtC;;;OAGG;IACH,YAAY,OAAe,EAAE,OAAe,EAAE,GAAG,SAAmC;QAClF,IAAI,CAAC,sBAAsB,GAAG,SAAS,CAAC;QACxC,IAAI,CAAC,eAAe,GAAG,IAAI,6BAAa,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,eAAe,GAAG,IAAI,6BAAa,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,IAAW,qBAAqB;QAC9B,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,eAAe;QACpB,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;QAC1E,IAAI,IAAI,CAAC,eAAe;YACtB,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,iBAAiB,CAAC,OAAe,EAAE,YAAoB,EAAE,MAAW,EAAE,MAAW,EAAE,iBAAyC;QACvI,MAAM,IAAI,GAAG,IAAI,mDAAwB,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QAC/F,MAA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;OAMG;IACI,KAAK,CAAC,qBAAqB,CAAC,WAAuB,EAAE,YAAoB,EAAE,MAAW,EAAE,MAAW,EAAE,iBAAyC;QACnJ,MAAM,IAAI,GAAG,IAAI,mDAAwB,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QACvG,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,mBAAmB,CAAC,SAAmB,EAAE,YAAoB,EAAE,MAAW,EAAE,MAAW,EAAE,iBAAyC;QAC7I,MAAM,IAAI,GAAG,IAAI,mDAAwB,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QACnG,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAAC,UAAyB;QACtD,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,EAAE;YACrD,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAC/C,OAAO;SACR;QACD,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,EAAE;YACrD,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAC/C,OAAO;SACR;IACH,CAAC;CACF;AA5WD,kEA4WC","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, AnyEnumerator, AnyProperty, Constant, CustomAttribute,\r\n CustomAttributeClass, CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity,\r\n Mixin, OverrideFormat, Phenomenon, PropertyCategory, RelationshipClass, RelationshipConstraint,\r\n Schema, SchemaItem, Unit,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport { AnyDiagnostic } from \"./Diagnostic\";\r\nimport { SchemaChanges } from \"./SchemaChanges\";\r\nimport { SchemaCompareDiagnostics } from \"./SchemaCompareDiagnostics\";\r\nimport { SchemaCompareDirection } from \"./SchemaComparer\";\r\nimport { ISchemaCompareReporter } from \"./SchemaCompareReporter\";\r\n\r\n/**\r\n * Used by the [[SchemaComparer]] to report differences found during schema comparison.\r\n * @internal\r\n */\r\nexport class SchemaCompareResultDelegate {\r\n private _schemaChangeReporters: ISchemaCompareReporter[];\r\n private _schemaAChanges: SchemaChanges;\r\n private _schemaBChanges: SchemaChanges;\r\n\r\n /**\r\n * Initializes a new SchemaCompareResultDelegate instance.\r\n * @param reporters The [[ISchemaCompareReporter]] objects to use to report schema differences.\r\n */\r\n constructor(schemaA: Schema, schemaB: Schema, ...reporters: ISchemaCompareReporter[]) {\r\n this._schemaChangeReporters = reporters;\r\n this._schemaAChanges = new SchemaChanges(schemaA);\r\n this._schemaBChanges = new SchemaChanges(schemaB);\r\n }\r\n\r\n public get schemaChangeReporters(): ISchemaCompareReporter[] {\r\n return this._schemaChangeReporters;\r\n }\r\n\r\n /**\r\n * Called by the SchemaComparer when the comparison is complete.\r\n */\r\n public compareComplete() {\r\n this.schemaChangeReporters.forEach((r) => r.report(this._schemaAChanges));\r\n if (this._schemaBChanges)\r\n this.schemaChangeReporters.forEach((r) => r.report(this._schemaBChanges));\r\n }\r\n\r\n /**\r\n * Reports differences between Schema properties.\r\n * @param schemaA The first Schema supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first Schema.\r\n * @param valueB The value from the second Schema.\r\n */\r\n public async reportSchemaDelta(schemaA: Schema, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.SchemaDelta(schemaA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences in the schema reference collection of two schemas.\r\n * @param schemaA The first Schema supplied for comparison.\r\n * @param referenceSchema The missing schema reference.\r\n */\r\n public async reportSchemaReferenceMissing(schemaA: Schema, referenceSchema: Schema, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.SchemaReferenceMissing(schemaA, [referenceSchema]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences in the schema reference collection of two schemas where the reference version differs.\r\n * @param schemaA The first Schema supplied for comparison.\r\n * @param referenceSchema The missing schema reference.\r\n */\r\n public async reportSchemaReferenceDelta(schemaA: Schema, referenceSchema: Schema, versionA: string, versionB: string, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.SchemaReferenceDelta(schemaA, [referenceSchema, versionA, versionB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports that a given SchemaItem could not be found in the second Schema.\r\n * @param schemaItemA The SchemaItem from the first Schema.\r\n */\r\n public async reportSchemaItemMissing(schemaItemA: SchemaItem, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.SchemaItemMissing(schemaItemA, []);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between SchemaItem properties.\r\n * @param schemaItemA The first SchemaItem supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first SchemaItem.\r\n * @param valueB The value from the second SchemaItem.\r\n */\r\n public async reportSchemaItemDelta(schemaItemA: SchemaItem, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.SchemaItemDelta(schemaItemA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between ECClass properties.\r\n * @param classA The first ECClass supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first ECClass.\r\n * @param valueB The value from the second ECClass.\r\n */\r\n public async reportClassDelta(classA: AnyClass, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.ClassDelta(classA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences of the base class defined between two ECClass objects.\r\n * @param classA The first ECClass supplied for comparison.\r\n * @param baseClassA The base class of the first ECClass.\r\n * @param baseClassB The base class of the second ECClass.\r\n */\r\n public async reportBaseClassDelta(classA: AnyClass, baseClassA: AnyClass | undefined, baseClassB: AnyClass | undefined, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.BaseClassDelta(classA, [baseClassA, baseClassB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between ECProperty properties.\r\n * @param propertyA The first ECProperty supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first ECProperty.\r\n * @param valueB The value from the second ECProperty.\r\n */\r\n public async reportPropertyDelta(propertyA: AnyProperty, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.PropertyDelta(propertyA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports that an ECProperty found in the first ECClass could not be found in the second.\r\n * @param propertyA The ECProperty supplied for comparison.\r\n */\r\n public async reportPropertyMissing(propertyA: AnyProperty, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.PropertyMissing(propertyA, []);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports that a Mixin found in the first EntityClass could not be found in the second.\r\n * @param entityClassA The first EntityClass that is missing the Mixin.\r\n * @param mixinA The Mixin from the first EntityClass.\r\n */\r\n public async reportEntityMixinMissing(entityClassA: EntityClass, mixinA: Mixin, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.EntityMixinMissing(entityClassA, [mixinA]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between Mixin properties.\r\n * @param mixinA The first Mixin supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first Mixin.\r\n * @param valueB The value from the second Mixin.\r\n */\r\n public async reportMixinDelta(mixinA: Mixin, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.MixinDelta(mixinA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between RelationshipClass properties.\r\n * @param relationshipClassA The first RelationshipClass supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first RelationshipClass.\r\n * @param valueB The value from the second RelationshipClass.\r\n */\r\n public async reportRelationshipClassDelta(relationshipClassA: RelationshipClass, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.RelationshipDelta(relationshipClassA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between RelationshipConstraint properties.\r\n * @param constraintA The first RelationshipConstraint supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first RelationshipConstraint.\r\n * @param valueB The value from the second RelationshipConstraint.\r\n */\r\n public async reportRelationshipConstraintDelta(constraintA: RelationshipConstraint, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.RelationshipConstraintDelta(constraintA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports that a constraint class found in the first RelationshipConstraint could not be found in the second.\r\n * @param constraintA The first RelationshipConstraint that is missing the class constraint.\r\n * @param constraintClass The constraint ECClass from the first RelationshipConstraint.\r\n */\r\n public async reportRelationshipConstraintClassMissing(constraintA: RelationshipConstraint, constraintClass: EntityClass | Mixin | RelationshipClass, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.RelationshipConstraintClassMissing(constraintA, [constraintClass]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between CustomAttributeClass properties.\r\n * @param customAttributeA The first CustomAttributeClass supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first CustomAttributeClass.\r\n * @param valueB The value from the second CustomAttributeClass.\r\n */\r\n public async reportCustomAttributeClassDelta(customAttributeA: CustomAttributeClass, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.CustomAttributeClassDelta(customAttributeA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports that a CustomAttribute instance found in the first CustomAttribute container could not be found in the second.\r\n * @param customAttributeContainerA The first CustomAttribute container that is missing the CustomAttribute instance.\r\n * @param customAttribute The CustomAttribute missing.\r\n */\r\n public async reportCustomAttributeInstanceClassMissing(customAttributeContainerA: CustomAttributeContainerProps, customAttribute: CustomAttribute, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.CustomAttributeInstanceClassMissing(customAttributeContainerA, [customAttribute]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between Enumeration properties.\r\n * @param enumerationA The first Enumeration supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first Enumeration.\r\n * @param valueB The value from the second Enumeration.\r\n */\r\n public async reportEnumerationDelta(enumerationA: Enumeration, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.EnumerationDelta(enumerationA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports that a enumerator found in the first Enumeration could not be found in the second.\r\n * @param enumerationA The first Enumeration that is missing the enumerator.\r\n * @param enumerator The enumerator missing from the second schema.\r\n */\r\n public async reportEnumeratorMissing(enumerationA: Enumeration, enumerator: AnyEnumerator, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.EnumeratorMissing(enumerationA, [enumerator]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between enumerator properties within a given Enumeration.\r\n * @param enumerationA The first Enumeration supplied for comparison.\r\n * @param enumerator The enumerator containing differing property values.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first enumerator.\r\n * @param valueB The value from the second enumerator.\r\n */\r\n public async reportEnumeratorDelta(enumerationA: Enumeration, enumerator: AnyEnumerator, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.EnumeratorDelta(enumerationA, [enumerator, propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between KindOfQuantity properties.\r\n * @param koqA The first KindOfQuantity supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first KindOfQuantity.\r\n * @param valueB The value from the second KindOfQuantity.\r\n */\r\n public async reportKoqDelta(koqA: KindOfQuantity, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.KoqDelta(koqA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports that a presentation unit found in the first KindOfQuantity could not be found in the second.\r\n * @param koqA The first KindOfQuantity that is missing the presentation unit.\r\n * @param unit The Format or OverrideFormat presentation unit missing from the second schema.\r\n */\r\n public async reportPresentationUnitMissing(koqA: KindOfQuantity, unit: Format | OverrideFormat, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.PresentationUnitMissing(koqA, [unit]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between PropertyCategory properties.\r\n * @param categoryA The first PropertyCategory supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first PropertyCategory.\r\n * @param valueB The value from the second PropertyCategory.\r\n */\r\n public async reportPropertyCategoryDelta(categoryA: PropertyCategory, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.PropertyCategoryDelta(categoryA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between Format properties.\r\n * @param formatA The first Format supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first Format.\r\n * @param valueB The value from the second Format.\r\n */\r\n public async reportFormatDelta(formatA: Format, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.FormatDelta(formatA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports that a unit found in the first Format could not be found in the second.\r\n * @param formatA The first Format that is missing the unit.\r\n * @param unit The Unit or InvertedUnit missing from the second schema.\r\n */\r\n public async reportFormatUnitMissing(formatA: Format, unit: Unit | InvertedUnit, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.FormatUnitMissing(formatA, [unit]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between overridden labels within the Units of a given Format.\r\n * @param formatA The first Format supplied for comparison.\r\n * @param unit The Unit or InvertedUnit with differing label overrides.\r\n * @param labelA The value from the first label.\r\n * @param labelB The value from the second label.\r\n */\r\n public async reportUnitLabelOverrideDelta(formatA: Format, unit: Unit | InvertedUnit, labelA: string | undefined, labelB: string | undefined, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.UnitLabelOverrideDelta(formatA, [unit, labelA, labelB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between Unit properties.\r\n * @param unitA The first Unit supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first Unit.\r\n * @param valueB The value from the second Unit.\r\n */\r\n public async reportUnitDelta(unitA: Unit, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.UnitDelta(unitA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between InvertedUnit properties.\r\n * @param invertedUnitA The first InvertedUnit supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first InvertedUnit.\r\n * @param valueB The value from the second InvertedUnit.\r\n */\r\n public async reportInvertedUnitDelta(invertedUnitA: InvertedUnit, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.InvertedUnitDelta(invertedUnitA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between Phenomenon properties.\r\n * @param phenomenonA The first Phenomenon supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first Phenomenon.\r\n * @param valueB The value from the second Phenomenon.\r\n */\r\n public async reportPhenomenonDelta(phenomenonA: Phenomenon, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.PhenomenonDelta(phenomenonA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n /**\r\n * Reports differences between Constant properties.\r\n * @param constantA The first Constant supplied for comparison.\r\n * @param propertyName The name of the property.\r\n * @param valueA The value from the first Constant.\r\n * @param valueB The value from the second Constant.\r\n */\r\n public async reportConstantDelta(constantA: Constant, propertyName: string, valueA: any, valueB: any, _compareDirection: SchemaCompareDirection): Promise<void> {\r\n const diag = new SchemaCompareDiagnostics.ConstantDelta(constantA, [propertyName, valueA, valueB]);\r\n await this.reportDiagnostic(diag);\r\n }\r\n\r\n private async reportDiagnostic(diagnostic: AnyDiagnostic): Promise<void> {\r\n if (this._schemaAChanges.schema === diagnostic.schema) {\r\n this._schemaAChanges.addDiagnostic(diagnostic);\r\n return;\r\n }\r\n if (this._schemaBChanges.schema === diagnostic.schema) {\r\n this._schemaBChanges.addDiagnostic(diagnostic);\r\n return;\r\n }\r\n }\r\n}\r\n"]}
|