@itwin/ecschema-editing 4.8.0-dev.4 → 4.8.0-dev.40

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.
Files changed (92) hide show
  1. package/CHANGELOG.md +48 -1
  2. package/lib/cjs/Differencing/SchemaConflicts.d.ts +2 -0
  3. package/lib/cjs/Differencing/SchemaConflicts.d.ts.map +1 -1
  4. package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
  5. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts +1 -0
  6. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
  7. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +25 -11
  8. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
  9. package/lib/cjs/Differencing/SchemaDifference.d.ts +10 -119
  10. package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
  11. package/lib/cjs/Differencing/SchemaDifference.js +28 -198
  12. package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
  13. package/lib/cjs/Differencing/Utils.d.ts +110 -0
  14. package/lib/cjs/Differencing/Utils.d.ts.map +1 -0
  15. package/lib/cjs/Differencing/Utils.js +185 -0
  16. package/lib/cjs/Differencing/Utils.js.map +1 -0
  17. package/lib/cjs/Editing/CustomAttributes.d.ts +1 -1
  18. package/lib/cjs/Editing/CustomAttributes.d.ts.map +1 -1
  19. package/lib/cjs/Editing/CustomAttributes.js +2 -2
  20. package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
  21. package/lib/cjs/Editing/ECClasses.d.ts +0 -7
  22. package/lib/cjs/Editing/ECClasses.d.ts.map +1 -1
  23. package/lib/cjs/Editing/ECClasses.js +0 -27
  24. package/lib/cjs/Editing/ECClasses.js.map +1 -1
  25. package/lib/cjs/Editing/Editor.d.ts +19 -3
  26. package/lib/cjs/Editing/Editor.d.ts.map +1 -1
  27. package/lib/cjs/Editing/Editor.js +48 -3
  28. package/lib/cjs/Editing/Editor.js.map +1 -1
  29. package/lib/cjs/Editing/Exception.d.ts +0 -1
  30. package/lib/cjs/Editing/Exception.d.ts.map +1 -1
  31. package/lib/cjs/Editing/Exception.js +0 -1
  32. package/lib/cjs/Editing/Exception.js.map +1 -1
  33. package/lib/cjs/Editing/Formats.d.ts.map +1 -1
  34. package/lib/cjs/Editing/Formats.js +4 -1
  35. package/lib/cjs/Editing/Formats.js.map +1 -1
  36. package/lib/cjs/Editing/KindOfQuantities.d.ts.map +1 -1
  37. package/lib/cjs/Editing/KindOfQuantities.js +3 -1
  38. package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
  39. package/lib/cjs/Editing/Mutable/MutableCAClass.d.ts +1 -1
  40. package/lib/cjs/Editing/Mutable/MutableCAClass.d.ts.map +1 -1
  41. package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
  42. package/lib/cjs/Editing/Mutable/MutableSchema.d.ts +2 -0
  43. package/lib/cjs/Editing/Mutable/MutableSchema.d.ts.map +1 -1
  44. package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
  45. package/lib/cjs/Editing/Mutable/MutableSchemaItem.d.ts +1 -0
  46. package/lib/cjs/Editing/Mutable/MutableSchemaItem.d.ts.map +1 -1
  47. package/lib/cjs/Editing/Mutable/MutableSchemaItem.js.map +1 -1
  48. package/lib/cjs/Editing/Properties.d.ts +1 -4
  49. package/lib/cjs/Editing/Properties.d.ts.map +1 -1
  50. package/lib/cjs/Editing/Properties.js +4 -5
  51. package/lib/cjs/Editing/Properties.js.map +1 -1
  52. package/lib/cjs/Editing/SchemaItems.d.ts +9 -2
  53. package/lib/cjs/Editing/SchemaItems.d.ts.map +1 -1
  54. package/lib/cjs/Editing/SchemaItems.js +31 -24
  55. package/lib/cjs/Editing/SchemaItems.js.map +1 -1
  56. package/lib/cjs/Merging/CAClassMerger.js +2 -2
  57. package/lib/cjs/Merging/CAClassMerger.js.map +1 -1
  58. package/lib/cjs/Merging/ClassMerger.d.ts.map +1 -1
  59. package/lib/cjs/Merging/ClassMerger.js +10 -10
  60. package/lib/cjs/Merging/ClassMerger.js.map +1 -1
  61. package/lib/cjs/Merging/Edits/RenameEditHandler.d.ts +14 -0
  62. package/lib/cjs/Merging/Edits/RenameEditHandler.d.ts.map +1 -0
  63. package/lib/cjs/Merging/Edits/RenameEditHandler.js +344 -0
  64. package/lib/cjs/Merging/Edits/RenameEditHandler.js.map +1 -0
  65. package/lib/cjs/Merging/Edits/SchemaEdits.d.ts +78 -0
  66. package/lib/cjs/Merging/Edits/SchemaEdits.d.ts.map +1 -0
  67. package/lib/cjs/Merging/Edits/SchemaEdits.js +111 -0
  68. package/lib/cjs/Merging/Edits/SchemaEdits.js.map +1 -0
  69. package/lib/cjs/Merging/Edits/SkipEditHandler.d.ts +14 -0
  70. package/lib/cjs/Merging/Edits/SkipEditHandler.d.ts.map +1 -0
  71. package/lib/cjs/Merging/Edits/SkipEditHandler.js +60 -0
  72. package/lib/cjs/Merging/Edits/SkipEditHandler.js.map +1 -0
  73. package/lib/cjs/Merging/SchemaItemMerger.d.ts +4 -4
  74. package/lib/cjs/Merging/SchemaItemMerger.d.ts.map +1 -1
  75. package/lib/cjs/Merging/SchemaItemMerger.js +18 -18
  76. package/lib/cjs/Merging/SchemaItemMerger.js.map +1 -1
  77. package/lib/cjs/Merging/SchemaMerger.d.ts +9 -12
  78. package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
  79. package/lib/cjs/Merging/SchemaMerger.js +52 -48
  80. package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
  81. package/lib/cjs/Validation/SchemaCompareVisitor.d.ts.map +1 -1
  82. package/lib/cjs/Validation/SchemaCompareVisitor.js +26 -19
  83. package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
  84. package/lib/cjs/Validation/SchemaComparer.d.ts +30 -30
  85. package/lib/cjs/Validation/SchemaComparer.d.ts.map +1 -1
  86. package/lib/cjs/Validation/SchemaComparer.js +76 -53
  87. package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
  88. package/lib/cjs/ecschema-editing.d.ts +3 -1
  89. package/lib/cjs/ecschema-editing.d.ts.map +1 -1
  90. package/lib/cjs/ecschema-editing.js +4 -2
  91. package/lib/cjs/ecschema-editing.js.map +1 -1
  92. package/package.json +9 -9
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Merging
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.applySkipEdit = void 0;
11
+ /**
12
+ * Applies a skip edit to the schema differences. It basically removes all entries that
13
+ * that are associated with the item to skip.
14
+ * @param result The result of a schema differencing run
15
+ * @param edit The skip edit to be applied.
16
+ * @internal
17
+ */
18
+ function applySkipEdit(result, edit) {
19
+ const [itemName, pathName] = edit.key.split(".");
20
+ const foundIndices = pathName !== undefined
21
+ ? findRelatedItemEntries(result, itemName, pathName)
22
+ : findItemEntries(result, itemName);
23
+ for (const index of foundIndices.reverse()) {
24
+ result.differences.splice(index, 1);
25
+ }
26
+ if (result.conflicts) {
27
+ removeRelatedConflicts(result.conflicts, itemName, pathName);
28
+ }
29
+ }
30
+ exports.applySkipEdit = applySkipEdit;
31
+ function removeRelatedConflicts(conflicts, itemName, path) {
32
+ const indices = [];
33
+ conflicts.forEach((conflict, index) => {
34
+ if (conflict.itemName === itemName && conflict.path === path) {
35
+ indices.push(index);
36
+ }
37
+ });
38
+ for (const index of indices.reverse()) {
39
+ conflicts.splice(index, 1);
40
+ }
41
+ }
42
+ function findItemEntries({ differences }, itemName) {
43
+ const found = [];
44
+ differences.forEach((difference, index) => {
45
+ if ("itemName" in difference && difference.itemName === itemName) {
46
+ found.push(index);
47
+ }
48
+ });
49
+ return found;
50
+ }
51
+ function findRelatedItemEntries({ differences }, itemName, pathName) {
52
+ const found = [];
53
+ differences.forEach((difference, index) => {
54
+ if ("itemName" in difference && difference.itemName === itemName && "path" in difference && difference.path === pathName) {
55
+ found.push(index);
56
+ }
57
+ });
58
+ return found;
59
+ }
60
+ //# sourceMappingURL=SkipEditHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SkipEditHandler.js","sourceRoot":"","sources":["../../../../src/Merging/Edits/SkipEditHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAMH;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,MAA8B,EAAE,IAAc;IAC1E,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAiC,CAAC;IACjF,MAAM,YAAY,GAAG,QAAQ,KAAK,SAAS;QACzC,CAAC,CAAC,sBAAsB,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC;QACpD,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEtC,KAAK,MAAM,KAAK,IAAI,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC;QAC3C,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,sBAAsB,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC;AAbD,sCAaC;AAED,SAAS,sBAAsB,CAAC,SAAqC,EAAE,QAAgB,EAAE,IAAa;IACpG,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;QACpC,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YAC7D,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;QACtC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,EAAE,WAAW,EAA0B,EAAE,QAAgB;IAChF,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE;QACxC,IAAI,UAAU,IAAI,UAAU,IAAI,UAAU,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACjE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,sBAAsB,CAAC,EAAE,WAAW,EAA0B,EAAE,QAAgB,EAAE,QAAgB;IACzG,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE;QACxC,IAAI,UAAU,IAAI,UAAU,IAAI,UAAU,CAAC,QAAQ,KAAK,QAAQ,IAAI,MAAM,IAAI,UAAU,IAAI,UAAU,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACzH,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Merging\r\n */\r\n\r\nimport type { SchemaDifferenceResult } from \"../../Differencing/SchemaDifference\";\r\nimport type { SchemaDifferenceConflict } from \"../../ecschema-editing\";\r\nimport type { SkipEdit } from \"./SchemaEdits\";\r\n\r\n/**\r\n * Applies a skip edit to the schema differences. It basically removes all entries that\r\n * that are associated with the item to skip.\r\n * @param result The result of a schema differencing run\r\n * @param edit The skip edit to be applied.\r\n * @internal\r\n */\r\nexport function applySkipEdit(result: SchemaDifferenceResult, edit: SkipEdit) {\r\n const [itemName, pathName] = edit.key.split(\".\") as [string, string | undefined];\r\n const foundIndices = pathName !== undefined\r\n ? findRelatedItemEntries(result, itemName, pathName)\r\n : findItemEntries(result, itemName);\r\n\r\n for (const index of foundIndices.reverse()) {\r\n result.differences.splice(index, 1);\r\n }\r\n\r\n if (result.conflicts) {\r\n removeRelatedConflicts(result.conflicts, itemName, pathName);\r\n }\r\n}\r\n\r\nfunction removeRelatedConflicts(conflicts: SchemaDifferenceConflict[], itemName: string, path?: string) {\r\n const indices: number[] = [];\r\n conflicts.forEach((conflict, index) => {\r\n if (conflict.itemName === itemName && conflict.path === path) {\r\n indices.push(index);\r\n }\r\n });\r\n\r\n for (const index of indices.reverse()) {\r\n conflicts.splice(index, 1);\r\n }\r\n}\r\n\r\nfunction findItemEntries({ differences }: SchemaDifferenceResult, itemName: string): number[] {\r\n const found: number[] = [];\r\n differences.forEach((difference, index) => {\r\n if (\"itemName\" in difference && difference.itemName === itemName) {\r\n found.push(index);\r\n }\r\n });\r\n return found;\r\n}\r\n\r\nfunction findRelatedItemEntries({ differences }: SchemaDifferenceResult, itemName: string, pathName: string): number[] {\r\n const found: number[] = [];\r\n differences.forEach((difference, index) => {\r\n if (\"itemName\" in difference && difference.itemName === itemName && \"path\" in difference && difference.path === pathName) {\r\n found.push(index);\r\n }\r\n });\r\n return found;\r\n}\r\n\r\n"]}
@@ -5,8 +5,8 @@ import { SchemaItem, SchemaItemKey } from "@itwin/ecschema-metadata";
5
5
  * @internal
6
6
  */
7
7
  export interface SchemaItemMergerHandler<T extends AnySchemaItemDifference | AnySchemaItemPathDifference> {
8
- add: (context: SchemaMergeContext, change: T) => Promise<SchemaItemKey>;
9
- modify: (context: SchemaMergeContext, change: T, itemKey: SchemaItemKey, item: any) => Promise<void>;
8
+ add: (context: SchemaMergeContext, difference: T) => Promise<SchemaItemKey>;
9
+ modify: (context: SchemaMergeContext, difference: T, itemKey: SchemaItemKey, item: any) => Promise<void>;
10
10
  }
11
11
  /**
12
12
  * @internal
@@ -16,11 +16,11 @@ export declare function locateSchemaItem(context: SchemaMergeContext, itemName:
16
16
  * Merges the given set of schema items. As schema items may depend or relate with other
17
17
  * schema items, the list gets filtered to ensure the items get merged in a certain order.
18
18
  * @param context The current merging context.
19
- * @param itemChanges Set of schema item that differed.
19
+ * @param differences Set of schema item that differed.
20
20
  * @returns An async iterable with the merge result for each schema item.
21
21
  * @internal
22
22
  */
23
- export declare function mergeSchemaItems(context: SchemaMergeContext, itemChanges: AnySchemaDifference[]): AsyncGenerator<void, void, unknown>;
23
+ export declare function mergeSchemaItems(context: SchemaMergeContext, differences: AnySchemaDifference[]): AsyncGenerator<void, void, unknown>;
24
24
  /**
25
25
  * Convenience-method around updateSchemaItemKey that returns the full name instead of a SchemaItemKey.
26
26
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaItemMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/SchemaItemMerger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,2BAA2B,EAAoB,MAAM,kCAAkC,CAAC;AAC/I,OAAO,EAAkD,UAAU,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AASrH;;GAEG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC,SAAS,uBAAuB,GAAG,2BAA2B;IACtG,GAAG,EAAK,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC,KAAK,OAAO,CAA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AAC;CAC1G;AAoBD;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,uBAQvG;AAED;;;;;;;GAOG;AACH,wBAAuB,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,mBAAmB,EAAE,uCAwCtG;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,mBAG5F;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,0BAYvF"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateSchemaItemKey = exports.updateSchemaItemFullName = exports.mergeSchemaItems = exports.locateSchemaItem = void 0;
4
- const SchemaDifference_1 = require("../Differencing/SchemaDifference");
5
4
  const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
6
5
  const EnumerationMerger_1 = require("./EnumerationMerger");
7
6
  const PhenomenonMerger_1 = require("./PhenomenonMerger");
@@ -10,20 +9,21 @@ const UnitSystemMerger_1 = require("./UnitSystemMerger");
10
9
  const KindOfQuantityMerger_1 = require("./KindOfQuantityMerger");
11
10
  const ConstantMerger_1 = require("./ConstantMerger");
12
11
  const ClassMerger_1 = require("./ClassMerger");
12
+ const Utils = require("../Differencing/Utils");
13
13
  /**
14
14
  * Handles the merging logic for everything that is same for all schema items such as labels or descriptions
15
15
  * @internal
16
16
  */
17
- async function mergeSchemaItem(context, change, merger) {
18
- if (change.changeType === "add") {
19
- await merger.add(context, change);
17
+ async function mergeSchemaItem(context, difference, merger) {
18
+ if (difference.changeType === "add") {
19
+ await merger.add(context, difference);
20
20
  return;
21
21
  }
22
- if (change.changeType === "modify") {
23
- const schemaItem = await locateSchemaItem(context, change.itemName, change.schemaType);
24
- return merger.modify(context, change, schemaItem.key, schemaItem);
22
+ if (difference.changeType === "modify") {
23
+ const schemaItem = await locateSchemaItem(context, difference.itemName, difference.schemaType);
24
+ return merger.modify(context, difference, schemaItem.key, schemaItem);
25
25
  }
26
- throw new Error(`The merger does not support ${change.changeType} of ${change.schemaType}.`);
26
+ throw new Error(`The merger does not support ${difference.changeType} of ${difference.schemaType}.`);
27
27
  }
28
28
  /**
29
29
  * @internal
@@ -41,24 +41,24 @@ exports.locateSchemaItem = locateSchemaItem;
41
41
  * Merges the given set of schema items. As schema items may depend or relate with other
42
42
  * schema items, the list gets filtered to ensure the items get merged in a certain order.
43
43
  * @param context The current merging context.
44
- * @param itemChanges Set of schema item that differed.
44
+ * @param differences Set of schema item that differed.
45
45
  * @returns An async iterable with the merge result for each schema item.
46
46
  * @internal
47
47
  */
48
- async function* mergeSchemaItems(context, itemChanges) {
49
- for (const difference of itemChanges.filter(SchemaDifference_1.SchemaDifference.isUnitSystemDifference)) {
48
+ async function* mergeSchemaItems(context, differences) {
49
+ for (const difference of differences.filter(Utils.isUnitSystemDifference)) {
50
50
  yield await mergeSchemaItem(context, difference, UnitSystemMerger_1.unitSystemMerger);
51
51
  }
52
- for (const difference of itemChanges.filter(SchemaDifference_1.SchemaDifference.isPropertyCategoryDifference)) {
52
+ for (const difference of differences.filter(Utils.isPropertyCategoryDifference)) {
53
53
  yield await mergeSchemaItem(context, difference, PropertyCategoryMerger_1.propertyCategoryMerger);
54
54
  }
55
- for (const difference of itemChanges.filter(SchemaDifference_1.SchemaDifference.isEnumerationDifference)) {
55
+ for (const difference of differences.filter(Utils.isEnumerationDifference)) {
56
56
  yield await mergeSchemaItem(context, difference, EnumerationMerger_1.enumerationMerger);
57
57
  }
58
- for (const difference of itemChanges.filter(SchemaDifference_1.SchemaDifference.isEnumeratorDifference)) {
58
+ for (const difference of differences.filter(Utils.isEnumeratorDifference)) {
59
59
  yield await mergeSchemaItem(context, difference, EnumerationMerger_1.enumeratorMerger);
60
60
  }
61
- for (const difference of itemChanges.filter(SchemaDifference_1.SchemaDifference.isPhenomenonDifference)) {
61
+ for (const difference of differences.filter(Utils.isPhenomenonDifference)) {
62
62
  yield await mergeSchemaItem(context, difference, PhenomenonMerger_1.phenomenonMerger);
63
63
  }
64
64
  // TODO:
@@ -66,15 +66,15 @@ async function* mergeSchemaItems(context, itemChanges) {
66
66
  // - Unit
67
67
  // - Inverted Unit
68
68
  // - Format
69
- for (const difference of itemChanges.filter(SchemaDifference_1.SchemaDifference.isKindOfQuantityDifference)) {
69
+ for (const difference of differences.filter(Utils.isKindOfQuantityDifference)) {
70
70
  yield await mergeSchemaItem(context, difference, KindOfQuantityMerger_1.kindOfQuantityMerger);
71
71
  }
72
- for (const difference of itemChanges.filter(SchemaDifference_1.SchemaDifference.isConstantDifference)) {
72
+ for (const difference of differences.filter(Utils.isConstantDifference)) {
73
73
  yield await mergeSchemaItem(context, difference, ConstantMerger_1.constantMerger);
74
74
  }
75
75
  // Classes are slightly differently merged, since they can refer each other the process
76
76
  // uses several stages to merge.
77
- for await (const classMergeResult of (0, ClassMerger_1.mergeClassItems)(context, itemChanges)) {
77
+ for await (const classMergeResult of (0, ClassMerger_1.mergeClassItems)(context, differences)) {
78
78
  yield classMergeResult;
79
79
  }
80
80
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaItemMerger.js","sourceRoot":"","sources":["../../../src/Merging/SchemaItemMerger.ts"],"names":[],"mappings":";;;AAKA,uEAA+I;AAC/I,gEAAqH;AACrH,2DAA0E;AAC1E,yDAAsD;AACtD,qEAAkE;AAClE,yDAAsD;AACtD,iEAA8D;AAC9D,qDAAkD;AAClD,+CAAgD;AAUhD;;;GAGG;AACH,KAAK,UAAU,eAAe,CAAgE,OAA2B,EAAE,MAAS,EAAE,MAAkC;IACtK,IAAG,MAAM,CAAC,UAAU,KAAK,KAAK,EAAE,CAAC;QAC/B,MAAM,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAClC,OAAO;IACT,C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","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 type { SchemaMergeContext } from \"./SchemaMerger\";\r\nimport { AnySchemaDifference, AnySchemaItemDifference, AnySchemaItemPathDifference, SchemaDifference } from \"../Differencing/SchemaDifference\";\r\nimport { ECObjectsError, ECObjectsStatus, SchemaContext, SchemaItem, SchemaItemKey } from \"@itwin/ecschema-metadata\";\r\nimport { enumerationMerger, enumeratorMerger } from \"./EnumerationMerger\";\r\nimport { phenomenonMerger } from \"./PhenomenonMerger\";\r\nimport { propertyCategoryMerger } from \"./PropertyCategoryMerger\";\r\nimport { unitSystemMerger } from \"./UnitSystemMerger\";\r\nimport { kindOfQuantityMerger } from \"./KindOfQuantityMerger\";\r\nimport { constantMerger } from \"./ConstantMerger\";\r\nimport { mergeClassItems } from \"./ClassMerger\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface SchemaItemMergerHandler<T extends AnySchemaItemDifference | AnySchemaItemPathDifference> {\r\n add: (context: SchemaMergeContext, change: T) => Promise<SchemaItemKey>;\r\n modify: (context: SchemaMergeContext, change: T, itemKey: SchemaItemKey, item: any) => Promise<void>;\r\n}\r\n\r\n/**\r\n * Handles the merging logic for everything that is same for all schema items such as labels or descriptions\r\n * @internal\r\n */\r\nasync function mergeSchemaItem<T extends AnySchemaItemDifference|AnySchemaItemPathDifference>(context: SchemaMergeContext, change: T, merger: SchemaItemMergerHandler<T>): Promise<void> {\r\n if(change.changeType === \"add\") {\r\n await merger.add(context, change);\r\n return;\r\n }\r\n\r\n if(change.changeType === \"modify\") {\r\n const schemaItem = await locateSchemaItem(context, change.itemName, change.schemaType);\r\n return merger.modify(context, change, schemaItem.key, schemaItem);\r\n }\r\n\r\n throw new Error(`The merger does not support ${change.changeType} of ${change.schemaType}.`);\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport async function locateSchemaItem(context: SchemaMergeContext, itemName: string, schemaType: string) {\r\n const schemaItemKey = new SchemaItemKey(itemName, context.targetSchemaKey);\r\n const schemaItem = await context.editor.schemaContext.getSchemaItem(schemaItemKey);\r\n if (schemaItem === undefined) {\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `${schemaType} ${schemaItemKey.fullName} not found in schema context.`);\r\n }\r\n\r\n return schemaItem;\r\n}\r\n\r\n/**\r\n * Merges the given set of schema items. As schema items may depend or relate with other\r\n * schema items, the list gets filtered to ensure the items get merged in a certain order.\r\n * @param context The current merging context.\r\n * @param itemChanges Set of schema item that differed.\r\n * @returns An async iterable with the merge result for each schema item.\r\n * @internal\r\n */\r\nexport async function* mergeSchemaItems(context: SchemaMergeContext, itemChanges: AnySchemaDifference[]) {\r\n for (const difference of itemChanges.filter(SchemaDifference.isUnitSystemDifference)) {\r\n yield await mergeSchemaItem(context, difference, unitSystemMerger);\r\n }\r\n\r\n for (const difference of itemChanges.filter(SchemaDifference.isPropertyCategoryDifference)) {\r\n yield await mergeSchemaItem(context, difference, propertyCategoryMerger);\r\n }\r\n\r\n for (const difference of itemChanges.filter(SchemaDifference.isEnumerationDifference)) {\r\n yield await mergeSchemaItem(context, difference, enumerationMerger);\r\n }\r\n\r\n for (const difference of itemChanges.filter(SchemaDifference.isEnumeratorDifference)) {\r\n yield await mergeSchemaItem(context, difference, enumeratorMerger);\r\n }\r\n\r\n for (const difference of itemChanges.filter(SchemaDifference.isPhenomenonDifference)) {\r\n yield await mergeSchemaItem(context, difference, phenomenonMerger);\r\n }\r\n\r\n // TODO:\r\n // The following schema items are not supported yet. Mentioned in the processing order:\r\n // - Unit\r\n // - Inverted Unit\r\n // - Format\r\n\r\n for (const difference of itemChanges.filter(SchemaDifference.isKindOfQuantityDifference)) {\r\n yield await mergeSchemaItem(context, difference, kindOfQuantityMerger);\r\n }\r\n\r\n for (const difference of itemChanges.filter(SchemaDifference.isConstantDifference)) {\r\n yield await mergeSchemaItem(context, difference, constantMerger);\r\n }\r\n\r\n // Classes are slightly differently merged, since they can refer each other the process\r\n // uses several stages to merge.\r\n for await (const classMergeResult of mergeClassItems(context, itemChanges)) {\r\n yield classMergeResult;\r\n }\r\n}\r\n\r\n/**\r\n * Convenience-method around updateSchemaItemKey that returns the full name instead of a SchemaItemKey.\r\n * @internal\r\n */\r\nexport async function updateSchemaItemFullName(context: SchemaMergeContext, reference: string) {\r\n const schemaItemKey = await updateSchemaItemKey(context, reference);\r\n return schemaItemKey.fullName;\r\n}\r\n\r\n/**\r\n * Updates the given reference if it refers to a SchemaItem in the source Schema and\r\n * returns a SchemaItemKey. If any other schema is referred the reference is not change.\r\n * @internal\r\n */\r\nexport async function updateSchemaItemKey(context: SchemaMergeContext, reference: string) {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(reference);\r\n if (context.sourceSchemaKey.compareByName(schemaName)) {\r\n return resolveSchemaItemKey(context.editor.schemaContext, new SchemaItemKey(itemName, context.targetSchemaKey));\r\n }\r\n\r\n const referencedSchema = await context.targetSchema.getReference(schemaName);\r\n if (referencedSchema !== undefined) {\r\n return resolveSchemaItemKey(context.editor.schemaContext, new SchemaItemKey(itemName, referencedSchema.schemaKey));\r\n }\r\n\r\n throw new Error(`Cannot locate referenced schema item ${reference}`);\r\n}\r\n\r\n/**\r\n * To support case insensitivity for schema items, the given key is checked if there\r\n * exists an item for it.\r\n * @internal\r\n */\r\nasync function resolveSchemaItemKey(schemaContext: SchemaContext, itemKey: SchemaItemKey): Promise<SchemaItemKey> {\r\n const item = await schemaContext.getSchemaItem(itemKey);\r\n if (item === undefined) {\r\n // If the schema item hasn't been created yet, we have to trust the given key is correctly spelled.\r\n return itemKey;\r\n }\r\n return item.key;\r\n}\r\n"]}
1
+ {"version":3,"file":"SchemaItemMerger.js","sourceRoot":"","sources":["../../../src/Merging/SchemaItemMerger.ts"],"names":[],"mappings":";;;AAMA,gEAAqH;AACrH,2DAA0E;AAC1E,yDAAsD;AACtD,qEAAkE;A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;AAED;;;;GAIG;AACH,KAAK,UAAU,oBAAoB,CAAC,aAA4B,EAAE,OAAsB;IACtF,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACxD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,mGAAmG;QACnG,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC;AAClB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport type { SchemaMergeContext } from \"./SchemaMerger\";\r\nimport { AnySchemaDifference, AnySchemaItemDifference, AnySchemaItemPathDifference } from \"../Differencing/SchemaDifference\";\r\nimport { ECObjectsError, ECObjectsStatus, SchemaContext, SchemaItem, SchemaItemKey } from \"@itwin/ecschema-metadata\";\r\nimport { enumerationMerger, enumeratorMerger } from \"./EnumerationMerger\";\r\nimport { phenomenonMerger } from \"./PhenomenonMerger\";\r\nimport { propertyCategoryMerger } from \"./PropertyCategoryMerger\";\r\nimport { unitSystemMerger } from \"./UnitSystemMerger\";\r\nimport { kindOfQuantityMerger } from \"./KindOfQuantityMerger\";\r\nimport { constantMerger } from \"./ConstantMerger\";\r\nimport { mergeClassItems } from \"./ClassMerger\";\r\nimport * as Utils from \"../Differencing/Utils\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport interface SchemaItemMergerHandler<T extends AnySchemaItemDifference | AnySchemaItemPathDifference> {\r\n add: (context: SchemaMergeContext, difference: T) => Promise<SchemaItemKey>;\r\n modify: (context: SchemaMergeContext, difference: T, itemKey: SchemaItemKey, item: any) => Promise<void>;\r\n}\r\n\r\n/**\r\n * Handles the merging logic for everything that is same for all schema items such as labels or descriptions\r\n * @internal\r\n */\r\nasync function mergeSchemaItem<T extends AnySchemaItemDifference | AnySchemaItemPathDifference>(context: SchemaMergeContext, difference: T, merger: SchemaItemMergerHandler<T>): Promise<void> {\r\n if (difference.changeType === \"add\") {\r\n await merger.add(context, difference);\r\n return;\r\n }\r\n\r\n if (difference.changeType === \"modify\") {\r\n const schemaItem = await locateSchemaItem(context, difference.itemName, difference.schemaType);\r\n return merger.modify(context, difference, schemaItem.key, schemaItem);\r\n }\r\n\r\n throw new Error(`The merger does not support ${difference.changeType} of ${difference.schemaType}.`);\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport async function locateSchemaItem(context: SchemaMergeContext, itemName: string, schemaType: string) {\r\n const schemaItemKey = new SchemaItemKey(itemName, context.targetSchemaKey);\r\n const schemaItem = await context.editor.schemaContext.getSchemaItem(schemaItemKey);\r\n if (schemaItem === undefined) {\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `${schemaType} ${schemaItemKey.fullName} not found in schema context.`);\r\n }\r\n\r\n return schemaItem;\r\n}\r\n\r\n/**\r\n * Merges the given set of schema items. As schema items may depend or relate with other\r\n * schema items, the list gets filtered to ensure the items get merged in a certain order.\r\n * @param context The current merging context.\r\n * @param differences Set of schema item that differed.\r\n * @returns An async iterable with the merge result for each schema item.\r\n * @internal\r\n */\r\nexport async function* mergeSchemaItems(context: SchemaMergeContext, differences: AnySchemaDifference[]) {\r\n for (const difference of differences.filter(Utils.isUnitSystemDifference)) {\r\n yield await mergeSchemaItem(context, difference, unitSystemMerger);\r\n }\r\n\r\n for (const difference of differences.filter(Utils.isPropertyCategoryDifference)) {\r\n yield await mergeSchemaItem(context, difference, propertyCategoryMerger);\r\n }\r\n\r\n for (const difference of differences.filter(Utils.isEnumerationDifference)) {\r\n yield await mergeSchemaItem(context, difference, enumerationMerger);\r\n }\r\n\r\n for (const difference of differences.filter(Utils.isEnumeratorDifference)) {\r\n yield await mergeSchemaItem(context, difference, enumeratorMerger);\r\n }\r\n\r\n for (const difference of differences.filter(Utils.isPhenomenonDifference)) {\r\n yield await mergeSchemaItem(context, difference, phenomenonMerger);\r\n }\r\n\r\n // TODO:\r\n // The following schema items are not supported yet. Mentioned in the processing order:\r\n // - Unit\r\n // - Inverted Unit\r\n // - Format\r\n\r\n for (const difference of differences.filter(Utils.isKindOfQuantityDifference)) {\r\n yield await mergeSchemaItem(context, difference, kindOfQuantityMerger);\r\n }\r\n\r\n for (const difference of differences.filter(Utils.isConstantDifference)) {\r\n yield await mergeSchemaItem(context, difference, constantMerger);\r\n }\r\n\r\n // Classes are slightly differently merged, since they can refer each other the process\r\n // uses several stages to merge.\r\n for await (const classMergeResult of mergeClassItems(context, differences)) {\r\n yield classMergeResult;\r\n }\r\n}\r\n\r\n/**\r\n * Convenience-method around updateSchemaItemKey that returns the full name instead of a SchemaItemKey.\r\n * @internal\r\n */\r\nexport async function updateSchemaItemFullName(context: SchemaMergeContext, reference: string) {\r\n const schemaItemKey = await updateSchemaItemKey(context, reference);\r\n return schemaItemKey.fullName;\r\n}\r\n\r\n/**\r\n * Updates the given reference if it refers to a SchemaItem in the source Schema and\r\n * returns a SchemaItemKey. If any other schema is referred the reference is not change.\r\n * @internal\r\n */\r\nexport async function updateSchemaItemKey(context: SchemaMergeContext, reference: string) {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(reference);\r\n if (context.sourceSchemaKey.compareByName(schemaName)) {\r\n return resolveSchemaItemKey(context.editor.schemaContext, new SchemaItemKey(itemName, context.targetSchemaKey));\r\n }\r\n\r\n const referencedSchema = await context.targetSchema.getReference(schemaName);\r\n if (referencedSchema !== undefined) {\r\n return resolveSchemaItemKey(context.editor.schemaContext, new SchemaItemKey(itemName, referencedSchema.schemaKey));\r\n }\r\n\r\n throw new Error(`Cannot locate referenced schema item ${reference}`);\r\n}\r\n\r\n/**\r\n * To support case insensitivity for schema items, the given key is checked if there\r\n * exists an item for it.\r\n * @internal\r\n */\r\nasync function resolveSchemaItemKey(schemaContext: SchemaContext, itemKey: SchemaItemKey): Promise<SchemaItemKey> {\r\n const item = await schemaContext.getSchemaItem(itemKey);\r\n if (item === undefined) {\r\n // If the schema item hasn't been created yet, we have to trust the given key is correctly spelled.\r\n return itemKey;\r\n }\r\n return item.key;\r\n}\r\n"]}
@@ -3,7 +3,8 @@
3
3
  */
4
4
  import { Schema, type SchemaContext, SchemaKey } from "@itwin/ecschema-metadata";
5
5
  import { SchemaContextEditor } from "../Editing/Editor";
6
- import { SchemaDifferences } from "../Differencing/SchemaDifference";
6
+ import { type SchemaDifferenceResult } from "../Differencing/SchemaDifference";
7
+ import { type SchemaEdits } from "./Edits/SchemaEdits";
7
8
  /**
8
9
  * Defines the context of a Schema merging run.
9
10
  * @internal
@@ -16,7 +17,7 @@ export interface SchemaMergeContext {
16
17
  }
17
18
  /**
18
19
  * Class to merge two schemas together.
19
- * @see [[merge]] to merge the schemas.
20
+ * @see [[merge]] or [[mergeSchemas]] to merge two schemas together.
20
21
  * @beta
21
22
  */
22
23
  export declare class SchemaMerger {
@@ -30,21 +31,17 @@ export declare class SchemaMerger {
30
31
  * Copy the SchemaItems of the source schemas to the target schema.
31
32
  * @param targetSchema The schema the SchemaItems gets merged to.
32
33
  * @param sourceSchema The schema the SchemaItems gets copied from.
34
+ * @param edits An optional instance of schema edits that shall be applied before the schemas get merged.
33
35
  * @returns The merged target schema.
36
+ * @alpha
34
37
  */
35
- merge(targetSchema: Schema, sourceSchema: Schema): Promise<Schema>;
38
+ mergeSchemas(targetSchema: Schema, sourceSchema: Schema, edits?: SchemaEdits): Promise<Schema>;
36
39
  /**
37
40
  * Merges the schema differences into the target schema context.
38
- * @param differences The changes that shall be applied to the target schema.
41
+ * @param differenceResult The differences that shall be applied to the target schema.
42
+ * @param edits An optional instance of schema edits that shall be applied before the schemas get merged.
39
43
  * @alpha
40
44
  */
41
- merge(differences: SchemaDifferences): Promise<Schema>;
42
- /**
43
- * Merges the schema differences in the target schema. The target schema is defined
44
- * in the given differences object.
45
- * @param differences The differences between a source schema and the target schema.
46
- * @returns The modified Schema.
47
- */
48
- private mergeSchemas;
45
+ merge(differenceResult: SchemaDifferenceResult, edits?: SchemaEdits): Promise<Schema>;
49
46
  }
50
47
  //# sourceMappingURL=SchemaMerger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/SchemaMerger.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAoB,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAKvF;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;CACtC;AAED;;;;GAIG;AACH,qBAAa,YAAY;IAEvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsB;IAE9C;;;OAGG;gBACS,cAAc,EAAE,aAAa;IAIzC;;;;;OAKG;IACI,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAEzE;;;;OAIG;IACI,KAAK,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAsB7D;;;;;OAKG;YACW,YAAY;CAmD3B"}
1
+ {"version":3,"file":"SchemaMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/SchemaMerger.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAyE,KAAK,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AACtJ,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAMvD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;CACtC;AAED;;;;GAIG;AACH,qBAAa,YAAY;IAEvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsB;IAE9C;;;OAGG;gBACS,cAAc,EAAE,aAAa;IAIzC;;;;;;;OAOG;IACU,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAI3G;;;;;OAKG;IACU,KAAK,CAAC,gBAAgB,EAAE,sBAAsB,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;CAmCnG"}
@@ -15,9 +15,10 @@ const SchemaDifference_1 = require("../Differencing/SchemaDifference");
15
15
  const CustomAttributeMerger_1 = require("./CustomAttributeMerger");
16
16
  const SchemaItemMerger_1 = require("./SchemaItemMerger");
17
17
  const SchemaReferenceMerger_1 = require("./SchemaReferenceMerger");
18
+ const Utils = require("../Differencing/Utils");
18
19
  /**
19
20
  * Class to merge two schemas together.
20
- * @see [[merge]] to merge the schemas.
21
+ * @see [[merge]] or [[mergeSchemas]] to merge two schemas together.
21
22
  * @beta
22
23
  */
23
24
  class SchemaMerger {
@@ -29,78 +30,81 @@ class SchemaMerger {
29
30
  this._editor = new Editor_1.SchemaContextEditor(editingContext);
30
31
  }
31
32
  /**
32
- * Merges the source and the target. If the target is a SchemaDifference, the
33
- * source parameter must not be set. If it's a schema, it'll internally call
34
- * the Differencing api and recall itself with the difference argument overload.
35
- * @param input The methods input either a schema or a SchemaDifferences
36
- * @param source A source schema.
37
- * @returns The merged schema.
33
+ * Copy the SchemaItems of the source schemas to the target schema.
34
+ * @param targetSchema The schema the SchemaItems gets merged to.
35
+ * @param sourceSchema The schema the SchemaItems gets copied from.
36
+ * @param edits An optional instance of schema edits that shall be applied before the schemas get merged.
37
+ * @returns The merged target schema.
38
38
  * @alpha
39
39
  */
40
- async merge(input, source) {
41
- if (ecschema_metadata_1.Schema.isSchema(input)) {
42
- if (source === undefined) {
43
- throw new Error("When merging two schemas, source must not be undefined.");
44
- }
45
- return this.merge(await SchemaDifference_1.SchemaDifference.fromSchemas(input, source));
46
- }
47
- return this.mergeSchemas(input);
40
+ async mergeSchemas(targetSchema, sourceSchema, edits) {
41
+ return this.merge(await (0, SchemaDifference_1.getSchemaDifferences)(targetSchema, sourceSchema), edits);
48
42
  }
49
43
  /**
50
- * Merges the schema differences in the target schema. The target schema is defined
51
- * in the given differences object.
52
- * @param differences The differences between a source schema and the target schema.
53
- * @returns The modified Schema.
44
+ * Merges the schema differences into the target schema context.
45
+ * @param differenceResult The differences that shall be applied to the target schema.
46
+ * @param edits An optional instance of schema edits that shall be applied before the schemas get merged.
47
+ * @alpha
54
48
  */
55
- async mergeSchemas(differences) {
56
- const targetSchemaKey = ecschema_metadata_1.SchemaKey.parseString(differences.targetSchemaName);
57
- const sourceSchemaKey = ecschema_metadata_1.SchemaKey.parseString(differences.sourceSchemaName);
58
- if (differences.conflicts && differences.conflicts.length > 0) {
59
- throw new Errors_1.SchemaConflictsError("Schema's can't be merged if there are unresolved conflicts.", differences.conflicts, sourceSchemaKey, targetSchemaKey);
49
+ async merge(differenceResult, edits) {
50
+ const targetSchemaKey = ecschema_metadata_1.SchemaKey.parseString(differenceResult.targetSchemaName);
51
+ const sourceSchemaKey = ecschema_metadata_1.SchemaKey.parseString(differenceResult.sourceSchemaName);
52
+ // If schema changes were provided, they'll get applied and a new SchemaDifferenceResult is returned
53
+ // to prevent altering the differenceResult the caller passed in.
54
+ if (edits) {
55
+ await edits.applyTo(differenceResult = { ...differenceResult });
56
+ }
57
+ if (differenceResult.conflicts && differenceResult.conflicts.length > 0) {
58
+ throw new Errors_1.SchemaConflictsError("Schema's can't be merged if there are unresolved conflicts.", differenceResult.conflicts, sourceSchemaKey, targetSchemaKey);
60
59
  }
61
60
  const schema = await this._editor.getSchema(targetSchemaKey);
62
61
  if (schema === undefined) {
63
62
  throw new Error(`The target schema '${targetSchemaKey.name}' could not be found in the editing context.`);
64
63
  }
65
- if (differences.differences === undefined || differences.differences.length === 0) {
66
- return schema;
67
- }
68
64
  const context = {
69
65
  editor: this._editor,
70
66
  targetSchema: schema,
71
67
  targetSchemaKey,
72
68
  sourceSchemaKey,
73
69
  };
74
- for (const referenceChange of differences.differences.filter(SchemaDifference_1.SchemaDifference.isSchemaReferenceDifference)) {
75
- await (0, SchemaReferenceMerger_1.mergeSchemaReferences)(context, referenceChange);
76
- }
77
- const schemaDifference = differences.differences.find(SchemaDifference_1.SchemaDifference.isSchemaDifference);
78
- if (schemaDifference !== undefined) {
79
- await mergeSchemaProperties(schema, schemaDifference);
80
- }
81
- // Filter a list of possible schema item changes. This list gets filtered and order in the
82
- // mergeSchemaItems method.
83
- for await (const _mergeResult of (0, SchemaItemMerger_1.mergeSchemaItems)(context, differences.differences)) {
84
- }
85
- // At last the custom attributes gets merged because it could be that the CustomAttributes
86
- // depend on classes that has to get merged in as items before.
87
- for (const customAttributeChange of differences.differences.filter(SchemaDifference_1.SchemaDifference.isCustomAttributeDifference)) {
88
- await (0, CustomAttributeMerger_1.mergeCustomAttribute)(context, customAttributeChange);
89
- }
70
+ await mergeSchemaDifferences(context, differenceResult.differences);
90
71
  return schema;
91
72
  }
92
73
  }
93
74
  exports.SchemaMerger = SchemaMerger;
75
+ /**
76
+ * Merges the schema differences in the target schema.
77
+ * @param context The current merging context.
78
+ * @param differences The differences between a source schema and the target schema.
79
+ * @internal
80
+ */
81
+ async function mergeSchemaDifferences(context, differences) {
82
+ for (const referenceDifference of differences.filter(Utils.isSchemaReferenceDifference)) {
83
+ await (0, SchemaReferenceMerger_1.mergeSchemaReferences)(context, referenceDifference);
84
+ }
85
+ for (const schemaDifference of differences.filter(Utils.isSchemaDifference)) {
86
+ await mergeSchemaProperties(context, schemaDifference);
87
+ }
88
+ // Filter a list of possible schema item changes. This list gets filtered and order in the
89
+ // mergeSchemaItems method.
90
+ for await (const _mergeResult of (0, SchemaItemMerger_1.mergeSchemaItems)(context, differences)) {
91
+ }
92
+ // At last the custom attributes gets merged because it could be that the CustomAttributes
93
+ // depend on classes that has to get merged in as items before.
94
+ for (const customAttributeDifference of differences.filter(Utils.isCustomAttributeDifference)) {
95
+ await (0, CustomAttributeMerger_1.mergeCustomAttribute)(context, customAttributeDifference);
96
+ }
97
+ }
94
98
  /**
95
99
  * Sets the editable properties of a Schema.
96
100
  * @internal
97
101
  */
98
- async function mergeSchemaProperties(schema, changes) {
99
- if (changes.difference.label !== undefined) {
100
- schema.setDisplayLabel(changes.difference.label);
102
+ async function mergeSchemaProperties(context, { difference }) {
103
+ if (difference.label !== undefined) {
104
+ await context.editor.setDisplayLabel(context.targetSchemaKey, difference.label);
101
105
  }
102
- if (changes.difference.description !== undefined) {
103
- schema.setDescription(changes.difference.description);
106
+ if (difference.description !== undefined) {
107
+ await context.editor.setDescription(context.targetSchemaKey, difference.description);
104
108
  }
105
109
  }
106
110
  //# sourceMappingURL=SchemaMerger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaMerger.js","sourceRoot":"","sources":["../../../src/Merging/SchemaMerger.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,gEAAiF;AACjF,8CAAwD;AACxD,mDAA8D;AAC9D,uEAAuF;AACvF,mEAA+D;AAC/D,yDAAsD;AACtD,mEAAgE;AAahE;;;;GAIG;AACH,MAAa,YAAY;IAIvB;;;OAGG;IACH,YAAY,cAA6B;QACvC,IAAI,CAAC,OAAO,GAAG,IAAI,4BAAmB,CAAC,c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AC,cAAc,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IACxD,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Merging\r\n */\r\n\r\nimport { MutableSchema } from \"../Editing/Mutable/MutableSchema\";\r\nimport { Schema, type SchemaContext, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"../Editing/Editor\";\r\nimport { SchemaConflictsError } from \"../Differencing/Errors\";\r\nimport { SchemaDifference, SchemaDifferences } from \"../Differencing/SchemaDifference\";\r\nimport { mergeCustomAttribute } from \"./CustomAttributeMerger\";\r\nimport { mergeSchemaItems } from \"./SchemaItemMerger\";\r\nimport { mergeSchemaReferences } from \"./SchemaReferenceMerger\";\r\n\r\n/**\r\n * Defines the context of a Schema merging run.\r\n * @internal\r\n */\r\nexport interface SchemaMergeContext {\r\n readonly targetSchema: Schema;\r\n readonly targetSchemaKey: SchemaKey;\r\n readonly sourceSchemaKey: SchemaKey;\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 private readonly _editor: SchemaContextEditor;\r\n\r\n /**\r\n * Constructs a new instance of the SchemaMerger object.\r\n * @param editingContext The schema contexts that holds the schema to be edited.\r\n */\r\n constructor(editingContext: SchemaContext) {\r\n this._editor = new SchemaContextEditor(editingContext);\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 merge(targetSchema: Schema, sourceSchema: Schema): Promise<Schema>;\r\n\r\n /**\r\n * Merges the schema differences into the target schema context.\r\n * @param differences The changes that shall be applied to the target schema.\r\n * @alpha\r\n */\r\n public merge(differences: SchemaDifferences): Promise<Schema>;\r\n\r\n /**\r\n * Merges the source and the target. If the target is a SchemaDifference, the\r\n * source parameter must not be set. If it's a schema, it'll internally call\r\n * the Differencing api and recall itself with the difference argument overload.\r\n * @param input The methods input either a schema or a SchemaDifferences\r\n * @param source A source schema.\r\n * @returns The merged schema.\r\n * @alpha\r\n */\r\n public async merge(input: SchemaDifferences | Schema, source?: Schema): Promise<Schema> {\r\n if(Schema.isSchema(input)) {\r\n if(source === undefined) {\r\n throw new Error(\"When merging two schemas, source must not be undefined.\");\r\n }\r\n return this.merge(await SchemaDifference.fromSchemas(input, source));\r\n }\r\n\r\n return this.mergeSchemas(input);\r\n }\r\n\r\n /**\r\n * Merges the schema differences in the target schema. The target schema is defined\r\n * in the given differences object.\r\n * @param differences The differences between a source schema and the target schema.\r\n * @returns The modified Schema.\r\n */\r\n private async mergeSchemas(differences: SchemaDifferences): Promise<Schema> {\r\n const targetSchemaKey = SchemaKey.parseString(differences.targetSchemaName);\r\n const sourceSchemaKey = SchemaKey.parseString(differences.sourceSchemaName);\r\n\r\n if(differences.conflicts && differences.conflicts.length > 0) {\r\n throw new SchemaConflictsError(\r\n \"Schema's can't be merged if there are unresolved conflicts.\",\r\n differences.conflicts,\r\n sourceSchemaKey,\r\n targetSchemaKey,\r\n );\r\n }\r\n\r\n const schema = await this._editor.getSchema(targetSchemaKey);\r\n if (schema === undefined) {\r\n throw new Error(`The target schema '${targetSchemaKey.name}' could not be found in the editing context.`);\r\n }\r\n\r\n if(differences.differences === undefined || differences.differences.length === 0) {\r\n return schema;\r\n }\r\n\r\n const context: SchemaMergeContext = {\r\n editor: this._editor,\r\n targetSchema: schema,\r\n targetSchemaKey,\r\n sourceSchemaKey,\r\n };\r\n\r\n for (const referenceChange of differences.differences.filter(SchemaDifference.isSchemaReferenceDifference)) {\r\n await mergeSchemaReferences(context, referenceChange);\r\n }\r\n\r\n const schemaDifference = differences.differences.find(SchemaDifference.isSchemaDifference);\r\n if(schemaDifference !== undefined) {\r\n await mergeSchemaProperties(schema, schemaDifference);\r\n }\r\n\r\n // Filter a list of possible schema item changes. This list gets filtered and order in the\r\n // mergeSchemaItems method.\r\n for await (const _mergeResult of mergeSchemaItems(context, differences.differences)) {\r\n }\r\n\r\n // At last the custom attributes gets merged because it could be that the CustomAttributes\r\n // depend on classes that has to get merged in as items before.\r\n for (const customAttributeChange of differences.differences.filter(SchemaDifference.isCustomAttributeDifference)) {\r\n await mergeCustomAttribute(context, customAttributeChange);\r\n }\r\n\r\n return schema;\r\n }\r\n}\r\n\r\n/**\r\n * Sets the editable properties of a Schema.\r\n * @internal\r\n */\r\nasync function mergeSchemaProperties(schema: MutableSchema, changes: SchemaDifference) {\r\n if(changes.difference.label !== undefined) {\r\n schema.setDisplayLabel(changes.difference.label);\r\n }\r\n if(changes.difference.description !== undefined) {\r\n schema.setDescription(changes.difference.description);\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,gEAAiF;AACjF,8CAAwD;AACxD,mDAA8D;AAC9D,uEAAsJ;AAEtJ,mEAA+D;AAC/D,yDAAsD;AACtD,mEAAgE;AAChE,+CAA+C;AAa/C;;;;GAIG;AACH,MAAa,YAAY;IAIvB;;;OAGG;IACH,YAAY,cAA6B;QACvC,IAAI,CAAC,OAAO,GAAG,IAAI,4BAAmB,CAAC,cAAc,CAAC,CAAC;IACzD,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,YAAY,CAAC,YAAoB,EAAE,YAAoB,EAAE,KAAmB;QACvF,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAA,uCAAoB,EAAC,YAAY,EAAE,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC;IACnF,CAAC;I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QACxF,MAAM,IAAA,6CAAqB,EAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,MAAM,gBAAgB,IAAI,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,EAAE,CAAC;QAC5E,MAAM,qBAAqB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IACzD,CAAC;IAED,0FAA0F;IAC1F,2BAA2B;IAC3B,IAAI,KAAK,EAAE,MAAM,YAAY,IAAI,IAAA,mCAAgB,EAAC,OAAO,EAAE,WAAW,CAAC,EAAE,CAAC;IAC1E,CAAC;IAED,0FAA0F;IAC1F,+DAA+D;IAC/D,KAAK,MAAM,yBAAyB,IAAI,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,CAAC,EAAE,CAAC;QAC9F,MAAM,IAAA,4CAAoB,EAAC,OAAO,EAAE,yBAAyB,CAAC,CAAC;IACjE,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,qBAAqB,CAAC,OAA2B,EAAE,EAAE,UAAU,EAAoB;IAChG,IAAI,UAAU,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAClF,CAAC;IACD,IAAI,UAAU,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACzC,MAAM,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IACvF,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Merging\r\n */\r\n\r\nimport { Schema, type SchemaContext, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"../Editing/Editor\";\r\nimport { SchemaConflictsError } from \"../Differencing/Errors\";\r\nimport { type AnySchemaDifference, getSchemaDifferences, type SchemaDifference, type SchemaDifferenceResult } from \"../Differencing/SchemaDifference\";\r\nimport { type SchemaEdits } from \"./Edits/SchemaEdits\";\r\nimport { mergeCustomAttribute } from \"./CustomAttributeMerger\";\r\nimport { mergeSchemaItems } from \"./SchemaItemMerger\";\r\nimport { mergeSchemaReferences } from \"./SchemaReferenceMerger\";\r\nimport * as Utils from \"../Differencing/Utils\";\r\n\r\n/**\r\n * Defines the context of a Schema merging run.\r\n * @internal\r\n */\r\nexport interface SchemaMergeContext {\r\n readonly targetSchema: Schema;\r\n readonly targetSchemaKey: SchemaKey;\r\n readonly sourceSchemaKey: SchemaKey;\r\n readonly editor: SchemaContextEditor;\r\n}\r\n\r\n/**\r\n * Class to merge two schemas together.\r\n * @see [[merge]] or [[mergeSchemas]] to merge two schemas together.\r\n * @beta\r\n */\r\nexport class SchemaMerger {\r\n\r\n private readonly _editor: SchemaContextEditor;\r\n\r\n /**\r\n * Constructs a new instance of the SchemaMerger object.\r\n * @param editingContext The schema contexts that holds the schema to be edited.\r\n */\r\n constructor(editingContext: SchemaContext) {\r\n this._editor = new SchemaContextEditor(editingContext);\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 * @param edits An optional instance of schema edits that shall be applied before the schemas get merged.\r\n * @returns The merged target schema.\r\n * @alpha\r\n */\r\n public async mergeSchemas(targetSchema: Schema, sourceSchema: Schema, edits?: SchemaEdits): Promise<Schema> {\r\n return this.merge(await getSchemaDifferences(targetSchema, sourceSchema), edits);\r\n }\r\n\r\n /**\r\n * Merges the schema differences into the target schema context.\r\n * @param differenceResult The differences that shall be applied to the target schema.\r\n * @param edits An optional instance of schema edits that shall be applied before the schemas get merged.\r\n * @alpha\r\n */\r\n public async merge(differenceResult: SchemaDifferenceResult, edits?: SchemaEdits): Promise<Schema> {\r\n const targetSchemaKey = SchemaKey.parseString(differenceResult.targetSchemaName);\r\n const sourceSchemaKey = SchemaKey.parseString(differenceResult.sourceSchemaName);\r\n\r\n // If schema changes were provided, they'll get applied and a new SchemaDifferenceResult is returned\r\n // to prevent altering the differenceResult the caller passed in.\r\n if (edits) {\r\n await edits.applyTo(differenceResult = { ...differenceResult });\r\n }\r\n\r\n if (differenceResult.conflicts && differenceResult.conflicts.length > 0) {\r\n throw new SchemaConflictsError(\r\n \"Schema's can't be merged if there are unresolved conflicts.\",\r\n differenceResult.conflicts,\r\n sourceSchemaKey,\r\n targetSchemaKey,\r\n );\r\n }\r\n\r\n const schema = await this._editor.getSchema(targetSchemaKey);\r\n if (schema === undefined) {\r\n throw new Error(`The target schema '${targetSchemaKey.name}' could not be found in the editing context.`);\r\n }\r\n\r\n const context: SchemaMergeContext = {\r\n editor: this._editor,\r\n targetSchema: schema,\r\n targetSchemaKey,\r\n sourceSchemaKey,\r\n };\r\n\r\n await mergeSchemaDifferences(context, differenceResult.differences);\r\n\r\n return schema;\r\n }\r\n}\r\n\r\n/**\r\n * Merges the schema differences in the target schema.\r\n * @param context The current merging context.\r\n * @param differences The differences between a source schema and the target schema.\r\n * @internal\r\n */\r\nasync function mergeSchemaDifferences(context: SchemaMergeContext, differences: AnySchemaDifference[]): Promise<void> {\r\n for (const referenceDifference of differences.filter(Utils.isSchemaReferenceDifference)) {\r\n await mergeSchemaReferences(context, referenceDifference);\r\n }\r\n\r\n for (const schemaDifference of differences.filter(Utils.isSchemaDifference)) {\r\n await mergeSchemaProperties(context, schemaDifference);\r\n }\r\n\r\n // Filter a list of possible schema item changes. This list gets filtered and order in the\r\n // mergeSchemaItems method.\r\n for await (const _mergeResult of mergeSchemaItems(context, differences)) {\r\n }\r\n\r\n // At last the custom attributes gets merged because it could be that the CustomAttributes\r\n // depend on classes that has to get merged in as items before.\r\n for (const customAttributeDifference of differences.filter(Utils.isCustomAttributeDifference)) {\r\n await mergeCustomAttribute(context, customAttributeDifference);\r\n }\r\n}\r\n\r\n/**\r\n * Sets the editable properties of a Schema.\r\n * @internal\r\n */\r\nasync function mergeSchemaProperties(context: SchemaMergeContext, { difference }: SchemaDifference) {\r\n if (difference.label !== undefined) {\r\n await context.editor.setDisplayLabel(context.targetSchemaKey, difference.label);\r\n }\r\n if (difference.description !== undefined) {\r\n await context.editor.setDescription(context.targetSchemaKey, difference.description);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaCompareVisitor.d.ts","sourceRoot":"","sources":["../../../src/Validation/SchemaCompareVisitor.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,oBAAoB,EAAE,6BAA6B,EAClF,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,KAAK,EAClG,UAAU,EAAY,gBAAgB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,EAAE,UAAU,EACrF,WAAW,EAAE,IAAI,EAAE,UAAU,EAC9C,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,kBAAkB;IAC7D,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,eAAe,CAAkB;IAEzC;;;;OAIG;gBACS,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM;IAKpE;;;OAGG;IACU,eAAe,CAAC,OAAO,EAAE,MAAM;IAI5C;;;OAGG;IACU,eAAe,CAAC,WAAW,EAAE,UAAU;IAKpD;;;OAGG;IACU,UAAU,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxD;;;OAGG;IACU,aAAa,CAAC,SAAS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