@itwin/ecschema-editing 4.6.0-dev.7 → 4.6.0-dev.9

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 (112) hide show
  1. package/lib/cjs/Differencing/SchemaConflicts.d.ts +2 -2
  2. package/lib/cjs/Differencing/SchemaConflicts.js +1 -1
  3. package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
  4. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts +9 -6
  5. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
  6. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +213 -161
  7. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
  8. package/lib/cjs/Differencing/SchemaDifference.d.ts +354 -78
  9. package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
  10. package/lib/cjs/Differencing/SchemaDifference.js +184 -11
  11. package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
  12. package/lib/cjs/Editing/Mutable/MutableConstant.d.ts +1 -0
  13. package/lib/cjs/Editing/Mutable/MutableConstant.d.ts.map +1 -1
  14. package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
  15. package/lib/cjs/Editing/Mutable/MutableEnumeration.d.ts +1 -0
  16. package/lib/cjs/Editing/Mutable/MutableEnumeration.d.ts.map +1 -1
  17. package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
  18. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.d.ts +2 -0
  19. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.d.ts.map +1 -1
  20. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
  21. package/lib/cjs/Editing/Mutable/MutablePhenomenon.d.ts +1 -0
  22. package/lib/cjs/Editing/Mutable/MutablePhenomenon.d.ts.map +1 -1
  23. package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
  24. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.d.ts +1 -0
  25. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.d.ts.map +1 -1
  26. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
  27. package/lib/cjs/Editing/Mutable/MutableSchema.d.ts +2 -0
  28. package/lib/cjs/Editing/Mutable/MutableSchema.d.ts.map +1 -1
  29. package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
  30. package/lib/cjs/Editing/Mutable/MutableUnitSystem.d.ts +1 -0
  31. package/lib/cjs/Editing/Mutable/MutableUnitSystem.d.ts.map +1 -1
  32. package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
  33. package/lib/cjs/Merging/CAClassMerger.d.ts +4 -7
  34. package/lib/cjs/Merging/CAClassMerger.d.ts.map +1 -1
  35. package/lib/cjs/Merging/CAClassMerger.js +26 -23
  36. package/lib/cjs/Merging/CAClassMerger.js.map +1 -1
  37. package/lib/cjs/Merging/ClassMerger.d.ts +10 -18
  38. package/lib/cjs/Merging/ClassMerger.d.ts.map +1 -1
  39. package/lib/cjs/Merging/ClassMerger.js +148 -155
  40. package/lib/cjs/Merging/ClassMerger.js.map +1 -1
  41. package/lib/cjs/Merging/ConstantMerger.d.ts +4 -8
  42. package/lib/cjs/Merging/ConstantMerger.d.ts.map +1 -1
  43. package/lib/cjs/Merging/ConstantMerger.js +59 -40
  44. package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
  45. package/lib/cjs/Merging/CustomAttributeMerger.d.ts +16 -13
  46. package/lib/cjs/Merging/CustomAttributeMerger.d.ts.map +1 -1
  47. package/lib/cjs/Merging/CustomAttributeMerger.js +66 -34
  48. package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
  49. package/lib/cjs/Merging/EntityClassMerger.d.ts +10 -7
  50. package/lib/cjs/Merging/EntityClassMerger.d.ts.map +1 -1
  51. package/lib/cjs/Merging/EntityClassMerger.js +41 -29
  52. package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
  53. package/lib/cjs/Merging/EnumerationMerger.d.ts +9 -9
  54. package/lib/cjs/Merging/EnumerationMerger.d.ts.map +1 -1
  55. package/lib/cjs/Merging/EnumerationMerger.js +77 -48
  56. package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
  57. package/lib/cjs/Merging/KindOfQuantityMerger.d.ts +4 -11
  58. package/lib/cjs/Merging/KindOfQuantityMerger.d.ts.map +1 -1
  59. package/lib/cjs/Merging/KindOfQuantityMerger.js +57 -53
  60. package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
  61. package/lib/cjs/Merging/MixinMerger.d.ts +4 -7
  62. package/lib/cjs/Merging/MixinMerger.d.ts.map +1 -1
  63. package/lib/cjs/Merging/MixinMerger.js +24 -25
  64. package/lib/cjs/Merging/MixinMerger.js.map +1 -1
  65. package/lib/cjs/Merging/PhenomenonMerger.d.ts +8 -0
  66. package/lib/cjs/Merging/PhenomenonMerger.d.ts.map +1 -0
  67. package/lib/cjs/Merging/PhenomenonMerger.js +37 -0
  68. package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -0
  69. package/lib/cjs/Merging/PropertyCategoryMerger.d.ts +8 -0
  70. package/lib/cjs/Merging/PropertyCategoryMerger.d.ts.map +1 -0
  71. package/lib/cjs/Merging/PropertyCategoryMerger.js +34 -0
  72. package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -0
  73. package/lib/cjs/Merging/PropertyMerger.d.ts +6 -14
  74. package/lib/cjs/Merging/PropertyMerger.d.ts.map +1 -1
  75. package/lib/cjs/Merging/PropertyMerger.js +212 -287
  76. package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
  77. package/lib/cjs/Merging/RelationshipClassMerger.d.ts +16 -10
  78. package/lib/cjs/Merging/RelationshipClassMerger.d.ts.map +1 -1
  79. package/lib/cjs/Merging/RelationshipClassMerger.js +121 -112
  80. package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
  81. package/lib/cjs/Merging/SchemaItemMerger.d.ts +26 -51
  82. package/lib/cjs/Merging/SchemaItemMerger.d.ts.map +1 -1
  83. package/lib/cjs/Merging/SchemaItemMerger.js +106 -88
  84. package/lib/cjs/Merging/SchemaItemMerger.js.map +1 -1
  85. package/lib/cjs/Merging/SchemaMerger.d.ts +21 -9
  86. package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
  87. package/lib/cjs/Merging/SchemaMerger.js +74 -88
  88. package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
  89. package/lib/cjs/Merging/SchemaReferenceMerger.d.ts +5 -5
  90. package/lib/cjs/Merging/SchemaReferenceMerger.d.ts.map +1 -1
  91. package/lib/cjs/Merging/SchemaReferenceMerger.js +33 -15
  92. package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
  93. package/lib/cjs/Merging/UnitSystemMerger.d.ts +8 -0
  94. package/lib/cjs/Merging/UnitSystemMerger.d.ts.map +1 -0
  95. package/lib/cjs/Merging/UnitSystemMerger.js +26 -0
  96. package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -0
  97. package/lib/cjs/Validation/ECRules.js +1 -1
  98. package/lib/cjs/Validation/ECRules.js.map +1 -1
  99. package/lib/cjs/Validation/SchemaChanges.js +1 -1
  100. package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
  101. package/lib/cjs/Validation/SchemaComparer.d.ts.map +1 -1
  102. package/lib/cjs/Validation/SchemaComparer.js +3 -3
  103. package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
  104. package/package.json +9 -9
  105. package/lib/cjs/Merging/SchemaItemFactory.d.ts +0 -15
  106. package/lib/cjs/Merging/SchemaItemFactory.d.ts.map +0 -1
  107. package/lib/cjs/Merging/SchemaItemFactory.js +0 -82
  108. package/lib/cjs/Merging/SchemaItemFactory.js.map +0 -1
  109. package/lib/cjs/Merging/StructClassMerger.d.ts +0 -10
  110. package/lib/cjs/Merging/StructClassMerger.d.ts.map +0 -1
  111. package/lib/cjs/Merging/StructClassMerger.js +0 -13
  112. package/lib/cjs/Merging/StructClassMerger.js.map +0 -1
@@ -1,15 +1,21 @@
1
- import { RelationshipClass, SchemaItemKey, SchemaKey } from "@itwin/ecschema-metadata";
2
- import { ClassMerger } from "./ClassMerger";
1
+ import { type RelationshipClassDifference, type RelationshipConstraintClassDifference, type RelationshipConstraintDifference } from "../Differencing/SchemaDifference";
2
+ import { type SchemaItemMergerHandler } from "./SchemaItemMerger";
3
+ import { SchemaMergeContext } from "./SchemaMerger";
3
4
  import { SchemaItemEditResults } from "../Editing/Editor";
4
- import { ClassChanges } from "../Validation/SchemaChanges";
5
5
  /**
6
+ * Defines a merge handler to merge RelationshipClass schema items.
6
7
  * @internal
7
8
  */
8
- export default class RelationshipClassMerger extends ClassMerger<RelationshipClass> {
9
- protected create(schemaKey: SchemaKey, ecClass: RelationshipClass): Promise<SchemaItemEditResults>;
10
- protected mergeAttributes(ecClass: RelationshipClass, attributeName: string, attributeNewValue: any, attributeOldValue: any): Promise<SchemaItemEditResults | boolean>;
11
- private mergeConstraintAttributes;
12
- private mergeConstraintChanges;
13
- protected merge(itemKey: SchemaItemKey, changes: ClassChanges): Promise<SchemaItemEditResults>;
14
- }
9
+ export declare const relationshipClassMerger: SchemaItemMergerHandler<RelationshipClassDifference>;
10
+ /**
11
+ * Merges differences of a Relationship constraint.
12
+ * This only supports modify as the RelationshipConstraints are always set on the Relationship classes.
13
+ * @internal
14
+ */
15
+ export declare function mergeRelationshipConstraint(context: SchemaMergeContext, change: RelationshipConstraintDifference): Promise<SchemaItemEditResults>;
16
+ /**
17
+ * Merges differences of a Relationship constraint classes.
18
+ * @internal
19
+ */
20
+ export declare function mergeRelationshipClassConstraint(context: SchemaMergeContext, change: RelationshipConstraintClassDifference): Promise<SchemaItemEditResults>;
15
21
  //# sourceMappingURL=RelationshipClassMerger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipClassMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/RelationshipClassMerger.ts"],"names":[],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kB,EAAE,MAAM,EAAE,gCAAgC,kCAsCtH;AAED;;;GAGG;AACH,wBAAsB,gCAAgC,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,qCAAqC,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAmBjK"}
@@ -1,132 +1,141 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- /*---------------------------------------------------------------------------------------------
4
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
5
- * See LICENSE.md in the project root for license terms and full copyright notice.
6
- *--------------------------------------------------------------------------------------------*/
7
- const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
3
+ exports.mergeRelationshipClassConstraint = exports.mergeRelationshipConstraint = exports.relationshipClassMerger = void 0;
4
+ const SchemaItemMerger_1 = require("./SchemaItemMerger");
8
5
  const ClassMerger_1 = require("./ClassMerger");
9
- const CustomAttributeMerger_1 = require("./CustomAttributeMerger");
6
+ const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
10
7
  /**
8
+ * Defines a merge handler to merge RelationshipClass schema items.
11
9
  * @internal
12
10
  */
13
- class RelationshipClassMerger extends ClassMerger_1.ClassMerger {
14
- async create(schemaKey, ecClass) {
15
- return this.context.editor.relationships.create(schemaKey, ecClass.name, ecClass.modifier, ecClass.strength, ecClass.strengthDirection);
16
- }
17
- async mergeAttributes(ecClass, attributeName, attributeNewValue, attributeOldValue) {
18
- const mutableRelationship = ecClass;
19
- switch (attributeName) {
20
- case "strength":
21
- if (attributeOldValue === undefined) {
22
- const strength = (0, ecschema_metadata_1.parseStrength)(attributeNewValue);
23
- if (strength === undefined) {
24
- return { itemKey: ecClass.key, errorMessage: `An invalid relationship class strength value '${attributeNewValue}' has been provided.` };
25
- }
26
- mutableRelationship.setStrength(strength);
27
- return true;
28
- }
29
- return { errorMessage: `Changing the relationship '${ecClass.name}' strength is not supported.` };
30
- case "strengthDirection":
31
- if (attributeOldValue === undefined) {
32
- const strengthDirection = (0, ecschema_metadata_1.parseStrengthDirection)(attributeNewValue);
33
- if (strengthDirection === undefined) {
34
- return { itemKey: ecClass.key, errorMessage: `An invalid relationship class strengthDirection value '${attributeNewValue}' has been provided.` };
35
- }
36
- mutableRelationship.setStrengthDirection(strengthDirection);
37
- return true;
38
- }
39
- return { errorMessage: `Changing the relationship '${ecClass.name}' strengthDirection is not supported.` };
11
+ exports.relationshipClassMerger = {
12
+ async add(context, change) {
13
+ if (change.difference.strength === undefined) {
14
+ return { errorMessage: "RelationshipClass must define strength" };
40
15
  }
41
- return super.mergeAttributes(ecClass, attributeName, attributeNewValue, attributeOldValue);
42
- }
43
- async mergeConstraintAttributes(constraint, attributeName, attributeNewValue, attributeOldValue) {
44
- switch (attributeName) {
45
- case "multiplicity":
46
- if (attributeOldValue === undefined) {
47
- const multiplicity = ecschema_metadata_1.RelationshipMultiplicity.fromString(attributeNewValue);
48
- if (multiplicity === undefined) {
49
- return { errorMessage: `An invalid relationship constraint multiplicity value '${attributeNewValue}' has been provided.` };
50
- }
51
- return this.context.editor.relationships.setConstraintMultiplicity(constraint, multiplicity);
52
- }
53
- return { errorMessage: `Changing the relationship constraint '${constraint.fullName}' multiplicity is not supported.` };
54
- case "polymorphic":
55
- if (attributeOldValue === undefined || attributeNewValue === true) {
56
- return this.context.editor.relationships.setConstraintPolymorphic(constraint, attributeNewValue);
57
- }
58
- return { errorMessage: `Changing the relationship constraint '${constraint.fullName}' polymorphic is not supported.` };
59
- case "roleLabel":
60
- constraint.roleLabel = attributeNewValue;
61
- return true;
62
- case "abstractConstraint":
63
- const [schemaName, itemName] = ecschema_metadata_1.SchemaItem.parseFullName(attributeNewValue);
64
- const itemKey = new ecschema_metadata_1.SchemaItemKey(itemName, this.context.sourceSchema.schemaKey.compareByName(schemaName)
65
- ? this.context.targetSchema.schemaKey
66
- : new ecschema_metadata_1.SchemaKey(schemaName));
67
- const abstractConstraint = await this.context.targetSchema.lookupItem(itemKey);
68
- if (abstractConstraint === undefined) {
69
- return { itemKey: constraint.relationshipClass.key, errorMessage: `Unable to locate the abstract constraint class ${attributeNewValue} in the context schema.` };
70
- }
71
- return this.context.editor.relationships.setAbstractConstraint(constraint, abstractConstraint);
16
+ if (change.difference.strengthDirection === undefined) {
17
+ return { errorMessage: "RelationshipClass must define strengthDirection" };
72
18
  }
73
- return false;
74
- }
75
- async mergeConstraintChanges(constraint, constraintChanges) {
76
- for (const change of constraintChanges) {
77
- for (const constraintClassChange of change.constraintClassChanges) {
78
- const ecClass = constraintClassChange.diagnostic.messageArgs[0];
79
- const itemKey = new ecschema_metadata_1.SchemaItemKey(ecClass.name, this.context.sourceSchema.schemaKey.matches(ecClass.schema.schemaKey)
80
- ? this.context.targetSchema.schemaKey
81
- : ecClass.schema.schemaKey);
82
- const constaintClass = await this.context.targetSchema.lookupItem(itemKey);
83
- if (constaintClass === undefined) {
84
- return { itemKey: constraint.relationshipClass.key, errorMessage: `Unable to locate the constraint class ${itemKey.fullName} in the context schema.` };
85
- }
86
- const results = await this.context.editor.relationships.addConstraintClass(constraint, constaintClass);
87
- if (results.errorMessage !== undefined) {
88
- return results;
89
- }
90
- }
91
- for (const propertyValueChange of change.propertyValueChanges) {
92
- const [attributeName, attributeNewValue, attributeOldValue] = propertyValueChange.diagnostic.messageArgs;
93
- const results = await this.mergeConstraintAttributes(constraint, attributeName, attributeNewValue, attributeOldValue);
94
- if (this.isSchemaItemEditResults(results) && results.errorMessage !== undefined) {
95
- return results;
19
+ if (change.difference.source === undefined) {
20
+ return { errorMessage: "RelationshipClass must define a source constraint" };
21
+ }
22
+ if (change.difference.target === undefined) {
23
+ return { errorMessage: "RelationshipClass must define a target constraint" };
24
+ }
25
+ return context.editor.relationships.createFromProps(context.targetSchemaKey, {
26
+ ...change.difference,
27
+ name: change.itemName,
28
+ schemaItemType: change.schemaType,
29
+ strength: change.difference.strength,
30
+ strengthDirection: change.difference.strengthDirection,
31
+ source: change.difference.source,
32
+ target: change.difference.target,
33
+ });
34
+ },
35
+ async modify(context, change, itemKey, item) {
36
+ return modifyRelationshipClass(context, change, itemKey, item);
37
+ },
38
+ };
39
+ async function modifyRelationshipClass(context, change, itemKey, item) {
40
+ // The following modifications will only be applied if the items gets modified
41
+ // and not the 2nd pass when adding a RelationshipClass.
42
+ if (change.changeType === "modify") {
43
+ if (change.difference.strength !== undefined) {
44
+ if (item.strength === undefined) {
45
+ const strength = (0, ecschema_metadata_1.parseStrength)(change.difference.strength);
46
+ if (strength === undefined) {
47
+ return { itemKey, errorMessage: `An invalid relationship class strength value '${change.difference.strength}' has been provided.` };
96
48
  }
49
+ item.setStrength(strength);
50
+ return { itemKey };
97
51
  }
98
- if (change.customAttributeChanges.size > 0) {
99
- const results = await (0, CustomAttributeMerger_1.mergeCustomAttributes)(this.context, change.customAttributeChanges.values(), async (ca) => {
100
- return this.context.editor.relationships.addCustomAttributeToConstraint(constraint, ca);
101
- });
102
- if (results.errorMessage !== undefined) {
103
- return results;
52
+ return { itemKey, errorMessage: `Changing the relationship '${itemKey.name}' strength is not supported.` };
53
+ }
54
+ if (change.difference.strengthDirection !== undefined) {
55
+ if (item.strengthDirection === undefined) {
56
+ const strengthDirection = (0, ecschema_metadata_1.parseStrengthDirection)(change.difference.strengthDirection);
57
+ if (strengthDirection === undefined) {
58
+ return { itemKey, errorMessage: `An invalid relationship class strengthDirection value '${change.difference.strengthDirection}' has been provided.` };
104
59
  }
60
+ item.setStrengthDirection(strengthDirection);
61
+ return { itemKey };
105
62
  }
63
+ return { itemKey, errorMessage: `Changing the relationship '${itemKey.name}' strengthDirection is not supported.` };
106
64
  }
107
- return { itemKey: constraint.relationshipClass.key };
108
65
  }
109
- async merge(itemKey, changes) {
110
- if (changes.sourceConstraintChanges.size > 0 || changes.targetConstraintChanges.size > 0) {
111
- const relationshipClass = await this.context.targetSchema.lookupItem(itemKey);
112
- if (relationshipClass === undefined) {
113
- return { itemKey, errorMessage: `Unable to locate the relationship class ${itemKey.name} in the context schema.` };
114
- }
115
- if (changes.sourceConstraintChanges.size > 0) {
116
- const result = await this.mergeConstraintChanges(relationshipClass.source, changes.sourceConstraintChanges.values());
117
- if (result.errorMessage !== undefined) {
118
- return result;
119
- }
66
+ return (0, ClassMerger_1.modifyClass)(context, change, itemKey, item);
67
+ }
68
+ /**
69
+ * Merges differences of a Relationship constraint.
70
+ * This only supports modify as the RelationshipConstraints are always set on the Relationship classes.
71
+ * @internal
72
+ */
73
+ async function mergeRelationshipConstraint(context, change) {
74
+ if (change.changeType !== "modify") {
75
+ return { errorMessage: "RelationshipConstraints can only be modified." };
76
+ }
77
+ const item = await (0, SchemaItemMerger_1.locateSchemaItem)(context, change.itemName, ecschema_metadata_1.SchemaItemType.RelationshipClass);
78
+ const constraint = item[parseConstraint(change.path)];
79
+ if (change.difference.roleLabel !== undefined) {
80
+ constraint.roleLabel = change.difference.roleLabel;
81
+ }
82
+ if (change.difference.polymorphic !== undefined) {
83
+ const result = await context.editor.relationships.setConstraintPolymorphic(constraint, change.difference.polymorphic);
84
+ if (result.errorMessage) {
85
+ return result;
86
+ }
87
+ }
88
+ if (change.difference.multiplicity !== undefined) {
89
+ if (constraint.multiplicity === undefined) {
90
+ const multiplicity = ecschema_metadata_1.RelationshipMultiplicity.fromString(change.difference.multiplicity);
91
+ if (multiplicity === undefined) {
92
+ return { errorMessage: `An invalid relationship constraint multiplicity value '${change.difference.multiplicity}' has been provided.` };
120
93
  }
121
- if (changes.targetConstraintChanges.size > 0) {
122
- const result = await this.mergeConstraintChanges(relationshipClass.target, changes.targetConstraintChanges.values());
123
- if (result.errorMessage !== undefined) {
124
- return result;
125
- }
94
+ const result = await context.editor.relationships.setConstraintMultiplicity(constraint, multiplicity);
95
+ if (result.errorMessage) {
96
+ return result;
126
97
  }
127
98
  }
128
- return { itemKey };
99
+ return { errorMessage: `Changing the relationship constraint '${constraint.fullName}' multiplicity is not supported.` };
100
+ }
101
+ if (change.difference.abstractConstraint !== undefined) {
102
+ const itemKey = await (0, SchemaItemMerger_1.updateSchemaItemKey)(context, change.difference.abstractConstraint);
103
+ const abstractConstraint = await context.editor.schemaContext.getSchemaItem(itemKey);
104
+ if (abstractConstraint === undefined) {
105
+ return { itemKey: constraint.relationshipClass.key, errorMessage: `Unable to locate the abstract constraint class ${change.difference.abstractConstraint} in the context schema.` };
106
+ }
107
+ return context.editor.relationships.setAbstractConstraint(constraint, abstractConstraint);
129
108
  }
109
+ return { itemKey: constraint.relationshipClass.key };
110
+ }
111
+ exports.mergeRelationshipConstraint = mergeRelationshipConstraint;
112
+ /**
113
+ * Merges differences of a Relationship constraint classes.
114
+ * @internal
115
+ */
116
+ async function mergeRelationshipClassConstraint(context, change) {
117
+ if (change.changeType !== "add") {
118
+ return { errorMessage: `Change type ${change.changeType} is not supported for Relationship constraint classes.` };
119
+ }
120
+ const item = await (0, SchemaItemMerger_1.locateSchemaItem)(context, change.itemName, ecschema_metadata_1.SchemaItemType.RelationshipClass);
121
+ const constraint = item[parseConstraint(change.path)];
122
+ for (const constraintName of change.difference) {
123
+ const constraintClassKey = await (0, SchemaItemMerger_1.updateSchemaItemKey)(context, constraintName);
124
+ const constraintClass = await context.editor.schemaContext.getSchemaItem(constraintClassKey);
125
+ if (constraintClass === undefined) {
126
+ return { errorMessage: `Could not locate relationship constraint class ${constraintClassKey.name}` };
127
+ }
128
+ const result = await context.editor.relationships.addConstraintClass(constraint, constraintClass);
129
+ if (result.errorMessage) {
130
+ return result;
131
+ }
132
+ }
133
+ return { itemKey: constraint.relationshipClass.key };
134
+ }
135
+ exports.mergeRelationshipClassConstraint = mergeRelationshipClassConstraint;
136
+ function parseConstraint(path) {
137
+ return path.startsWith("$source")
138
+ ? "source"
139
+ : "target";
130
140
  }
131
- exports.default = RelationshipClassMerger;
132
141
  //# sourceMappingURL=RelationshipClassMerger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/RelationshipClassMerger.ts"],"names":[],"mappings":";;AAAA;;;+FAG+F;AAC/F,gEAAgN;AAChN,+CAA4C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esContent":["/*---------------------------------------------------------------------------------------------\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 { EntityClass, Mixin, parseStrength, parseStrengthDirection, RelationshipClass, RelationshipConstraint, RelationshipMultiplicity, SchemaItem, SchemaItemKey, SchemaKey } from \"@itwin/ecschema-metadata\";\r\nimport { ClassMerger } from \"./ClassMerger\";\r\nimport { SchemaItemEditResults } from \"../Editing/Editor\";\r\nimport { ClassChanges, RelationshipConstraintChanges } from \"../Validation/SchemaChanges\";\r\nimport { MutableRelationshipClass } from \"@itwin/ecschema-metadata/src/Metadata/RelationshipClass\";\r\nimport { MutableRelationshipConstraint } from \"../Editing/Mutable/MutableRelationshipClass\";\r\nimport { mergeCustomAttributes } from \"./CustomAttributeMerger\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport default class RelationshipClassMerger extends ClassMerger<RelationshipClass> {\r\n\r\n protected override async create(schemaKey: SchemaKey, ecClass: RelationshipClass): Promise<SchemaItemEditResults> {\r\n return this.context.editor.relationships.create(schemaKey, ecClass.name, ecClass.modifier, ecClass.strength, ecClass.strengthDirection);\r\n }\r\n\r\n protected override async mergeAttributes(ecClass: RelationshipClass, attributeName: string, attributeNewValue: any, attributeOldValue: any): Promise<SchemaItemEditResults | boolean> {\r\n const mutableRelationship = ecClass as unknown as MutableRelationshipClass;\r\n switch(attributeName) {\r\n case \"strength\":\r\n if (attributeOldValue === undefined) {\r\n const strength = parseStrength(attributeNewValue);\r\n if (strength === undefined) {\r\n return { itemKey: ecClass.key, errorMessage: `An invalid relationship class strength value '${attributeNewValue}' has been provided.` };\r\n }\r\n mutableRelationship.setStrength(strength);\r\n return true;\r\n }\r\n return { errorMessage: `Changing the relationship '${ecClass.name}' strength is not supported.` };\r\n\r\n case \"strengthDirection\":\r\n if (attributeOldValue === undefined) {\r\n const strengthDirection = parseStrengthDirection(attributeNewValue);\r\n if (strengthDirection === undefined) {\r\n return { itemKey: ecClass.key, errorMessage: `An invalid relationship class strengthDirection value '${attributeNewValue}' has been provided.` };\r\n }\r\n mutableRelationship.setStrengthDirection(strengthDirection);\r\n return true;\r\n }\r\n return { errorMessage: `Changing the relationship '${ecClass.name}' strengthDirection is not supported.` };\r\n }\r\n return super.mergeAttributes(ecClass, attributeName, attributeNewValue, attributeOldValue);\r\n }\r\n\r\n private async mergeConstraintAttributes(constraint: RelationshipConstraint, attributeName: string, attributeNewValue: any, attributeOldValue: any): Promise<SchemaItemEditResults | boolean> {\r\n switch(attributeName) {\r\n case \"multiplicity\":\r\n if (attributeOldValue === undefined) {\r\n const multiplicity = RelationshipMultiplicity.fromString(attributeNewValue);\r\n if (multiplicity === undefined) {\r\n return { errorMessage: `An invalid relationship constraint multiplicity value '${attributeNewValue}' has been provided.` };\r\n }\r\n return this.context.editor.relationships.setConstraintMultiplicity(constraint, multiplicity);\r\n }\r\n return { errorMessage: `Changing the relationship constraint '${constraint.fullName}' multiplicity is not supported.` };\r\n\r\n case \"polymorphic\":\r\n if (attributeOldValue === undefined || attributeNewValue === true) {\r\n return this.context.editor.relationships.setConstraintPolymorphic(constraint, attributeNewValue);\r\n }\r\n return { errorMessage: `Changing the relationship constraint '${constraint.fullName}' polymorphic is not supported.` };\r\n\r\n case \"roleLabel\":\r\n (constraint as MutableRelationshipConstraint).roleLabel = attributeNewValue;\r\n return true;\r\n\r\n case \"abstractConstraint\":\r\n const [schemaName, itemName] = SchemaItem.parseFullName(attributeNewValue);\r\n const itemKey = new SchemaItemKey(itemName, this.context.sourceSchema.schemaKey.compareByName(schemaName)\r\n ? this.context.targetSchema.schemaKey\r\n : new SchemaKey(schemaName));\r\n\r\n const abstractConstraint = await this.context.targetSchema.lookupItem<Mixin | EntityClass | RelationshipClass>(itemKey);\r\n if (abstractConstraint === undefined) {\r\n return { itemKey: constraint.relationshipClass.key, errorMessage: `Unable to locate the abstract constraint class ${attributeNewValue} in the context schema.`};\r\n }\r\n return this.context.editor.relationships.setAbstractConstraint(constraint, abstractConstraint);\r\n }\r\n return false;\r\n }\r\n\r\n private async mergeConstraintChanges(constraint: RelationshipConstraint, constraintChanges: IterableIterator<RelationshipConstraintChanges>): Promise<SchemaItemEditResults> {\r\n for (const change of constraintChanges) {\r\n\r\n for (const constraintClassChange of change.constraintClassChanges) {\r\n const ecClass = constraintClassChange.diagnostic.messageArgs![0];\r\n const itemKey = new SchemaItemKey(ecClass.name, this.context.sourceSchema.schemaKey.matches(ecClass.schema.schemaKey)\r\n ? this.context.targetSchema.schemaKey\r\n : ecClass.schema.schemaKey);\r\n\r\n const constaintClass = await this.context.targetSchema.lookupItem<Mixin | EntityClass | RelationshipClass>(itemKey);\r\n if (constaintClass === undefined) {\r\n return { itemKey: constraint.relationshipClass.key, errorMessage: `Unable to locate the constraint class ${itemKey.fullName} in the context schema.` };\r\n }\r\n const results = await this.context.editor.relationships.addConstraintClass(constraint, constaintClass);\r\n if (results.errorMessage !== undefined) {\r\n return results;\r\n }\r\n }\r\n\r\n for (const propertyValueChange of change.propertyValueChanges) {\r\n const [attributeName, attributeNewValue, attributeOldValue] = propertyValueChange.diagnostic.messageArgs!;\r\n const results = await this.mergeConstraintAttributes(constraint, attributeName, attributeNewValue, attributeOldValue);\r\n if (this.isSchemaItemEditResults(results) && results.errorMessage !== undefined) {\r\n return results;\r\n }\r\n }\r\n\r\n if (change.customAttributeChanges.size > 0) {\r\n const results = await mergeCustomAttributes(this.context, change.customAttributeChanges.values(), async (ca) => {\r\n return this.context.editor.relationships.addCustomAttributeToConstraint(constraint, ca);\r\n });\r\n if (results.errorMessage !== undefined) {\r\n return results;\r\n }\r\n }\r\n }\r\n\r\n return { itemKey: constraint.relationshipClass.key };\r\n }\r\n\r\n protected override async merge(itemKey: SchemaItemKey, changes: ClassChanges): Promise<SchemaItemEditResults> {\r\n if (changes.sourceConstraintChanges.size > 0 || changes.targetConstraintChanges.size > 0) {\r\n\r\n const relationshipClass = await this.context.targetSchema.lookupItem<RelationshipClass>(itemKey);\r\n if (relationshipClass === undefined) {\r\n return { itemKey, errorMessage: `Unable to locate the relationship class ${itemKey.name} in the context schema.` };\r\n }\r\n\r\n if (changes.sourceConstraintChanges.size > 0) {\r\n const result = await this.mergeConstraintChanges(relationshipClass.source, changes.sourceConstraintChanges.values());\r\n if (result.errorMessage !== undefined) {\r\n return result;\r\n }\r\n }\r\n\r\n if (changes.targetConstraintChanges.size > 0) {\r\n const result = await this.mergeConstraintChanges(relationshipClass.target, changes.targetConstraintChanges.values());\r\n if (result.errorMessage !== undefined) {\r\n return result;\r\n }\r\n }\r\n }\r\n\r\n return { itemKey };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"RelationshipClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/RelationshipClassMerger.ts"],"names":[],"mappings":";;;AAMA,yDAAyG;AACzG,+CAA4C;AAE5C,gEAAiL;AAKjL;;;GAGG;AACU,QAAA,uBAAuB,GAAyD;IAC3F,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM;QACvB,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,KAAK,SAAS,EAAE;YAC5C,OAAO,EAAE,YAAY,EAAE,wCAAwC,EAAE,CAAC;SACnE;QACD,IAAI,MAAM,CAAC,UAAU,CAAC,iBAAiB,KAAK,SAAS,EAAE;YACrD,OAAO,EAAE,YAAY,EAAE,iDAAiD,EAAE,CAAC;SAC5E;QACD,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,KAAK,SAAS,EAAE;YAC1C,OAAO,EAAE,YAAY,EAAE,mDAAmD,EAAE,CAAC;SAC9E;QACD,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,KAAK,SAAS,EAAE;YAC1C,OAAO,EAAE,YAAY,EAAE,mDAAmD,EAAE,CAAC;SAC9E;QAED,OAAO,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE;YAC3E,GAAG,MAAM,CAAC,UAA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AC,IAAY;IACnC,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QAC/B,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,QAAQ,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { type RelationshipClassDifference, type RelationshipConstraintClassDifference, type RelationshipConstraintDifference } from \"../Differencing/SchemaDifference\";\r\nimport { type MutableRelationshipClass } from \"../Editing/Mutable/MutableRelationshipClass\";\r\nimport { locateSchemaItem, type SchemaItemMergerHandler, updateSchemaItemKey } from \"./SchemaItemMerger\";\r\nimport { modifyClass } from \"./ClassMerger\";\r\nimport { SchemaMergeContext } from \"./SchemaMerger\";\r\nimport { EntityClass, Mixin, parseStrength, parseStrengthDirection, RelationshipClass, RelationshipMultiplicity, SchemaItemKey, SchemaItemType } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaItemEditResults } from \"../Editing/Editor\";\r\n\r\ntype ConstraintClassTypes = EntityClass | Mixin | RelationshipClass;\r\n\r\n/**\r\n * Defines a merge handler to merge RelationshipClass schema items.\r\n * @internal\r\n */\r\nexport const relationshipClassMerger: SchemaItemMergerHandler<RelationshipClassDifference> = {\r\n async add(context, change) {\r\n if (change.difference.strength === undefined) {\r\n return { errorMessage: \"RelationshipClass must define strength\" };\r\n }\r\n if (change.difference.strengthDirection === undefined) {\r\n return { errorMessage: \"RelationshipClass must define strengthDirection\" };\r\n }\r\n if (change.difference.source === undefined) {\r\n return { errorMessage: \"RelationshipClass must define a source constraint\" };\r\n }\r\n if (change.difference.target === undefined) {\r\n return { errorMessage: \"RelationshipClass must define a target constraint\" };\r\n }\r\n\r\n return context.editor.relationships.createFromProps(context.targetSchemaKey, {\r\n ...change.difference,\r\n name: change.itemName,\r\n schemaItemType: change.schemaType,\r\n strength: change.difference.strength,\r\n strengthDirection: change.difference.strengthDirection,\r\n source: change.difference.source,\r\n target: change.difference.target,\r\n });\r\n },\r\n async modify(context, change, itemKey, item: MutableRelationshipClass) {\r\n return modifyRelationshipClass(context, change, itemKey, item);\r\n },\r\n};\r\n\r\nasync function modifyRelationshipClass(context: SchemaMergeContext, change: RelationshipClassDifference, itemKey: SchemaItemKey, item: MutableRelationshipClass) {\r\n // The following modifications will only be applied if the items gets modified\r\n // and not the 2nd pass when adding a RelationshipClass.\r\n if(change.changeType === \"modify\") {\r\n if(change.difference.strength !== undefined) {\r\n if (item.strength === undefined) {\r\n const strength = parseStrength(change.difference.strength);\r\n if (strength === undefined) {\r\n return { itemKey, errorMessage: `An invalid relationship class strength value '${change.difference.strength}' has been provided.` };\r\n }\r\n item.setStrength(strength);\r\n return { itemKey };\r\n }\r\n return { itemKey, errorMessage: `Changing the relationship '${itemKey.name}' strength is not supported.` };\r\n }\r\n if(change.difference.strengthDirection !== undefined) {\r\n if (item.strengthDirection === undefined) {\r\n const strengthDirection = parseStrengthDirection(change.difference.strengthDirection);\r\n if (strengthDirection === undefined) {\r\n return { itemKey, errorMessage: `An invalid relationship class strengthDirection value '${change.difference.strengthDirection}' has been provided.` };\r\n }\r\n item.setStrengthDirection(strengthDirection);\r\n return { itemKey };\r\n }\r\n return { itemKey, errorMessage: `Changing the relationship '${itemKey.name}' strengthDirection is not supported.` };\r\n }\r\n }\r\n return modifyClass(context, change, itemKey, item);\r\n}\r\n\r\n/**\r\n * Merges differences of a Relationship constraint.\r\n * This only supports modify as the RelationshipConstraints are always set on the Relationship classes.\r\n * @internal\r\n */\r\nexport async function mergeRelationshipConstraint(context: SchemaMergeContext, change: RelationshipConstraintDifference) {\r\n if(change.changeType !== \"modify\") {\r\n return { errorMessage: \"RelationshipConstraints can only be modified.\" };\r\n }\r\n\r\n const item = await locateSchemaItem(context, change.itemName, SchemaItemType.RelationshipClass) as MutableRelationshipClass;\r\n const constraint = item[parseConstraint(change.path)];\r\n if(change.difference.roleLabel !== undefined) {\r\n constraint.roleLabel = change.difference.roleLabel;\r\n }\r\n if(change.difference.polymorphic !== undefined) {\r\n const result = await context.editor.relationships.setConstraintPolymorphic(constraint, change.difference.polymorphic);\r\n if(result.errorMessage) {\r\n return result;\r\n }\r\n }\r\n if(change.difference.multiplicity !== undefined) {\r\n if (constraint.multiplicity === undefined) {\r\n const multiplicity = RelationshipMultiplicity.fromString(change.difference.multiplicity);\r\n if (multiplicity === undefined) {\r\n return { errorMessage: `An invalid relationship constraint multiplicity value '${change.difference.multiplicity}' has been provided.` };\r\n }\r\n const result = await context.editor.relationships.setConstraintMultiplicity(constraint, multiplicity);\r\n if(result.errorMessage) {\r\n return result;\r\n }\r\n }\r\n return { errorMessage: `Changing the relationship constraint '${constraint.fullName}' multiplicity is not supported.` };\r\n }\r\n if(change.difference.abstractConstraint !== undefined) {\r\n const itemKey = await updateSchemaItemKey(context, change.difference.abstractConstraint);\r\n const abstractConstraint = await context.editor.schemaContext.getSchemaItem<ConstraintClassTypes>(itemKey);\r\n if (abstractConstraint === undefined) {\r\n return { itemKey: constraint.relationshipClass.key, errorMessage: `Unable to locate the abstract constraint class ${change.difference.abstractConstraint} in the context schema.`};\r\n }\r\n return context.editor.relationships.setAbstractConstraint(constraint, abstractConstraint);\r\n }\r\n return { itemKey: constraint.relationshipClass.key };\r\n}\r\n\r\n/**\r\n * Merges differences of a Relationship constraint classes.\r\n * @internal\r\n */\r\nexport async function mergeRelationshipClassConstraint(context: SchemaMergeContext, change: RelationshipConstraintClassDifference): Promise<SchemaItemEditResults> {\r\n if(change.changeType !== \"add\") {\r\n return { errorMessage: `Change type ${change.changeType} is not supported for Relationship constraint classes.` };\r\n }\r\n\r\n const item = await locateSchemaItem(context, change.itemName, SchemaItemType.RelationshipClass) as MutableRelationshipClass;\r\n const constraint = item[parseConstraint(change.path)];\r\n for(const constraintName of change.difference) {\r\n const constraintClassKey = await updateSchemaItemKey(context, constraintName);\r\n const constraintClass = await context.editor.schemaContext.getSchemaItem<ConstraintClassTypes>(constraintClassKey);\r\n if(constraintClass === undefined) {\r\n return { errorMessage: `Could not locate relationship constraint class ${constraintClassKey.name}` };\r\n }\r\n const result = await context.editor.relationships.addConstraintClass(constraint, constraintClass);\r\n if(result.errorMessage) {\r\n return result;\r\n }\r\n }\r\n return { itemKey: constraint.relationshipClass.key };\r\n}\r\n\r\nfunction parseConstraint(path: string): \"source\" | \"target\" {\r\n return path.startsWith(\"$source\")\r\n ? \"source\"\r\n : \"target\";\r\n}\r\n"]}
@@ -1,61 +1,36 @@
1
+ import type { SchemaMergeContext } from "./SchemaMerger";
2
+ import type { SchemaEditResults, SchemaItemEditResults } from "../Editing/Editor";
3
+ import { AnySchemaDifference, AnySchemaItemDifference, AnySchemaItemPathDifference } from "../Differencing/SchemaDifference";
1
4
  import { SchemaItem, SchemaItemKey } from "@itwin/ecschema-metadata";
2
- import { SchemaItemChanges } from "../Validation/SchemaChanges";
3
- import { SchemaMergeContext } from "./SchemaMerger";
4
5
  /**
5
- * Defines a type-safe interface of Property Value resolver.
6
6
  * @internal
7
7
  */
8
- export type PropertyValueResolver<T extends SchemaItem, TProps = MutableSchemaItemProps<T>> = {
9
- [P in keyof TProps]?: (newValue: any, item: SchemaItemKey, oldValue?: any) => any;
10
- };
8
+ export interface SchemaItemMergerHandler<T extends AnySchemaItemDifference | AnySchemaItemPathDifference> {
9
+ add: (context: SchemaMergeContext, change: T) => Promise<SchemaItemEditResults>;
10
+ modify: (context: SchemaMergeContext, change: T, itemKey: SchemaItemKey, item: any) => Promise<SchemaItemEditResults>;
11
+ }
11
12
  /**
12
- * Defines a Mutable Schema Props interface.
13
+ * @internal
13
14
  */
14
- type MutableSchemaItemProps<T extends SchemaItem> = {
15
- -readonly [key in keyof ReturnType<T["toJSON"]>]: ReturnType<T["toJSON"]>[key];
16
- };
15
+ export declare function locateSchemaItem(context: SchemaMergeContext, itemName: string, schemaType: string): Promise<SchemaItem>;
17
16
  /**
18
- * The SchemaItemMerger is an base class for several other mergers with the actual logic
19
- * to perform merging for a certain schema item type. The class provides the shared logics
20
- * that is shared for all schema item mergers and custom logic can be applied by overriding
21
- * the protected class members.
17
+ * Merges the given set of schema items. As schema items may depend or relate with other
18
+ * schema items, the list gets filtered to ensure the items get merged in a certain order.
19
+ * @param context The current merging context.
20
+ * @param itemChanges Set of schema item that differed.
21
+ * @returns An async iterable with the merge result for each schema item.
22
22
  * @internal
23
23
  */
24
- export declare class SchemaItemMerger<TItem extends SchemaItem> {
25
- protected readonly context: SchemaMergeContext;
26
- /**
27
- * Constructor of the SchemaItemMerger class. This should not be overriden or extended
28
- * by sub-implementations.
29
- * @param context The current merging context.
30
- */
31
- constructor(context: SchemaMergeContext);
32
- /**
33
- * This overridable method allows to create a property value resolver that gets defines
34
- * a handler function for every possible property change. This allows adding complex handing
35
- * if a property value requires complicated merging.
36
- * @returns A resolver map with resolvers for the property.
37
- */
38
- protected createPropertyValueResolver(): Promise<PropertyValueResolver<TItem>>;
39
- /**
40
- * This overridable method gets called for more complex merging.
41
- * @param _itemKey The key of the current schema item.
42
- * @param _source The source item that shall gets merged into.
43
- * @param _change The schema item change to be applied.
44
- */
45
- protected merge(_itemKey: SchemaItemKey, _source: TItem, _change: SchemaItemChanges): Promise<void>;
46
- protected lookup<T extends SchemaItem>(schemaItem: T): Promise<T | undefined>;
47
- /**
48
- * Merges the given schema item changes in the current context.
49
- * @param context The merging context
50
- * @param schemaItemChanges An iterable of item changes.
51
- */
52
- static mergeChanges<TChange extends SchemaItemChanges>(context: SchemaMergeContext, schemaItemChanges: Iterable<TChange>): Promise<void>;
53
- /**
54
- * Merges the property values.
55
- * @param targetItem The current schema item
56
- * @param changes The property changes.
57
- */
58
- private mergeItemPropertyValues;
59
- }
60
- export {};
24
+ export declare function mergeSchemaItems(context: SchemaMergeContext, itemChanges: AnySchemaDifference[]): AsyncGenerator<SchemaEditResults, void, unknown>;
25
+ /**
26
+ * Convenience-method around updateSchemaItemKey that returns the full name instead of a SchemaItemKey.
27
+ * @internal
28
+ */
29
+ export declare function updateSchemaItemFullName(context: SchemaMergeContext, reference: string): Promise<string>;
30
+ /**
31
+ * Updates the given reference if it refers to a SchemaItem in the source Schema and
32
+ * returns a SchemaItemKey. If any other schema is referred the reference is not change.
33
+ * @internal
34
+ */
35
+ export declare function updateSchemaItemKey(context: SchemaMergeContext, reference: string): Promise<SchemaItemKey>;
61
36
  //# sourceMappingURL=SchemaItemMerger.d.ts.map
@@ -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,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,IAA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