@itwin/ecschema-editing 4.8.0-dev.8 → 4.8.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 (46) hide show
  1. package/lib/cjs/Differencing/SchemaDifference.d.ts +10 -119
  2. package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
  3. package/lib/cjs/Differencing/SchemaDifference.js +28 -198
  4. package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
  5. package/lib/cjs/Differencing/Utils.d.ts +100 -0
  6. package/lib/cjs/Differencing/Utils.d.ts.map +1 -0
  7. package/lib/cjs/Differencing/Utils.js +165 -0
  8. package/lib/cjs/Differencing/Utils.js.map +1 -0
  9. package/lib/cjs/Editing/Editor.d.ts +7 -2
  10. package/lib/cjs/Editing/Editor.d.ts.map +1 -1
  11. package/lib/cjs/Editing/Editor.js +24 -1
  12. package/lib/cjs/Editing/Editor.js.map +1 -1
  13. package/lib/cjs/Editing/Exception.d.ts +0 -1
  14. package/lib/cjs/Editing/Exception.d.ts.map +1 -1
  15. package/lib/cjs/Editing/Exception.js +0 -1
  16. package/lib/cjs/Editing/Exception.js.map +1 -1
  17. package/lib/cjs/Editing/Formats.d.ts.map +1 -1
  18. package/lib/cjs/Editing/Formats.js +4 -1
  19. package/lib/cjs/Editing/Formats.js.map +1 -1
  20. package/lib/cjs/Editing/KindOfQuantities.d.ts.map +1 -1
  21. package/lib/cjs/Editing/KindOfQuantities.js +3 -1
  22. package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
  23. package/lib/cjs/Editing/Properties.d.ts +1 -4
  24. package/lib/cjs/Editing/Properties.d.ts.map +1 -1
  25. package/lib/cjs/Editing/Properties.js +4 -5
  26. package/lib/cjs/Editing/Properties.js.map +1 -1
  27. package/lib/cjs/Editing/SchemaItems.d.ts +2 -2
  28. package/lib/cjs/Editing/SchemaItems.d.ts.map +1 -1
  29. package/lib/cjs/Editing/SchemaItems.js +4 -24
  30. package/lib/cjs/Editing/SchemaItems.js.map +1 -1
  31. package/lib/cjs/Merging/ClassMerger.d.ts.map +1 -1
  32. package/lib/cjs/Merging/ClassMerger.js +10 -10
  33. package/lib/cjs/Merging/ClassMerger.js.map +1 -1
  34. package/lib/cjs/Merging/SchemaItemMerger.d.ts +4 -4
  35. package/lib/cjs/Merging/SchemaItemMerger.d.ts.map +1 -1
  36. package/lib/cjs/Merging/SchemaItemMerger.js +18 -18
  37. package/lib/cjs/Merging/SchemaItemMerger.js.map +1 -1
  38. package/lib/cjs/Merging/SchemaMerger.d.ts +7 -7
  39. package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
  40. package/lib/cjs/Merging/SchemaMerger.js +32 -31
  41. package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
  42. package/lib/cjs/ecschema-editing.d.ts +2 -1
  43. package/lib/cjs/ecschema-editing.d.ts.map +1 -1
  44. package/lib/cjs/ecschema-editing.js +3 -2
  45. package/lib/cjs/ecschema-editing.js.map +1 -1
  46. package/package.json +9 -9
@@ -1,7 +1,6 @@
1
1
  /** @packageDocumentation
2
2
  * @module Differencing
3
3
  */
4
- import { SchemaChanges } from "../Validation/SchemaChanges";
5
4
  import { SchemaDifferenceConflict } from "./SchemaConflicts";
6
5
  import { AnyEnumerator, AnyPropertyProps, ConstantProps, CustomAttribute, CustomAttributeClassProps, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps, MixinProps, PhenomenonProps, PropertyCategoryProps, RelationshipClassProps, RelationshipConstraintProps, type Schema, SchemaItemFormatProps, SchemaItemProps, SchemaItemType, SchemaItemUnitProps, SchemaReferenceProps, StructClassProps, UnitSystemProps } from "@itwin/ecschema-metadata";
7
6
  /** Utility-Type to remove possible readonly flags on the given type. */
@@ -41,126 +40,10 @@ export declare enum SchemaOtherTypes {
41
40
  */
42
41
  export type SchemaType = SchemaOtherTypes | SchemaItemType;
43
42
  /**
43
+ * Definition of the difference result between two Schemas.
44
44
  * @alpha
45
45
  */
46
- export declare namespace SchemaDifference {
47
- /**
48
- * Creates a [[SchemaDifference]] for two given schemas.
49
- * @param targetSchema The schema the differences gets merged into.
50
- * @param sourceSchema The schema to get merged in the target.
51
- * @returns An [[SchemaDifference]] object.
52
- * @alpha
53
- */
54
- function fromSchemas(targetSchema: Schema, sourceSchema: Schema): Promise<SchemaDifferences>;
55
- /**
56
- * Creates a [[SchemaDifference]] for a given [[SchemaChanges]] report.
57
- * @param targetSchema
58
- * @param schemaChanges A changes report of two schemas.
59
- * @returns An [[SchemaDifference]] object.
60
- * @internal
61
- */
62
- function fromSchemaChanges(targetSchema: Schema, schemaChanges: SchemaChanges): Promise<SchemaDifferences>;
63
- /**
64
- * Indicates whether the given difference is type of ConstantDifference.
65
- * @alpha
66
- */
67
- function isConstantDifference(difference: AnySchemaDifference): difference is ConstantDifference;
68
- /**
69
- * Indicates whether the given difference is type of ClassPropertyDifference.
70
- * @alpha
71
- */
72
- function isClassPropertyDifference(difference: AnySchemaDifference): difference is ClassPropertyDifference;
73
- /**
74
- * Indicates whether the given difference is type of CustomAttributeClassDifference.
75
- * @alpha
76
- */
77
- function isCustomAttributeClassDifference(difference: AnySchemaDifference): difference is CustomAttributeClassDifference;
78
- /**
79
- * Indicates whether the given difference is type of CustomAttributeDifference.
80
- * @alpha
81
- */
82
- function isCustomAttributeDifference(difference: AnySchemaDifference): difference is CustomAttributeDifference;
83
- /**
84
- * Indicates whether the given difference is type of EntityClassDifference.
85
- * @alpha
86
- */
87
- function isEntityClassDifference(difference: AnySchemaDifference): difference is EntityClassDifference;
88
- /**
89
- * Indicates whether the given difference is type of EntityClassMixinDifference.
90
- * @alpha
91
- */
92
- function isEntityClassMixinDifference(difference: AnySchemaDifference): difference is EntityClassMixinDifference;
93
- /**
94
- * Indicates whether the given difference is type of EnumerationDifference.
95
- * @alpha
96
- */
97
- function isEnumerationDifference(difference: AnySchemaDifference): difference is EnumerationDifference;
98
- /**
99
- * Indicates whether the given difference is type of EnumeratorDifference.
100
- * @alpha
101
- */
102
- function isEnumeratorDifference(difference: AnySchemaDifference): difference is EnumeratorDifference;
103
- /**
104
- * Indicates whether the given difference is type of KindOfQuantityDifference.
105
- * @alpha
106
- */
107
- function isKindOfQuantityDifference(difference: AnySchemaDifference): difference is KindOfQuantityDifference;
108
- /**
109
- * Indicates whether the given difference is type of MixinClassDifference.
110
- * @alpha
111
- */
112
- function isMixinClassDifference(difference: AnySchemaDifference): difference is MixinClassDifference;
113
- /**
114
- * Indicates whether the given difference is type of PhenomenonDifference.
115
- * @alpha
116
- */
117
- function isPhenomenonDifference(difference: AnySchemaDifference): difference is PhenomenonDifference;
118
- /**
119
- * Indicates whether the given difference is type of PropertyCategoryDifference.
120
- * @alpha
121
- */
122
- function isPropertyCategoryDifference(difference: AnySchemaDifference): difference is PropertyCategoryDifference;
123
- /**
124
- * Indicates whether the given difference is type of SchemaDifference.
125
- * @alpha
126
- */
127
- function isSchemaDifference(difference: AnySchemaDifference): difference is SchemaDifference;
128
- /**
129
- * Indicates whether the given difference is type of SchemaReferenceDifference.
130
- * @alpha
131
- */
132
- function isSchemaReferenceDifference(difference: AnySchemaDifference): difference is SchemaReferenceDifference;
133
- /**
134
- * Indicates whether the given difference is type of CustomAttributeDifference.
135
- * @alpha
136
- */
137
- function isStructClassDifference(difference: AnySchemaDifference): difference is StructClassDifference;
138
- /**
139
- * Indicates whether the given difference is type of UnitSystemDifference.
140
- * @alpha
141
- */
142
- function isUnitSystemDifference(difference: AnySchemaDifference): difference is UnitSystemDifference;
143
- /**
144
- * Indicates whether the given difference is type of RelationshipClassDifference.
145
- * @alpha
146
- */
147
- function isRelationshipClassDifference(difference: AnySchemaDifference): difference is RelationshipClassDifference;
148
- /**
149
- * Indicates whether the given difference is type of RelationshipConstraintDifference.
150
- * @alpha
151
- */
152
- function isRelationshipConstraintDifference(difference: AnySchemaDifference): difference is RelationshipConstraintDifference;
153
- /**
154
- * Indicates whether the given difference is type of RelationshipConstraintClassDifference.
155
- * @alpha
156
- */
157
- function isRelationshipConstraintClassDifference(difference: AnySchemaDifference): difference is RelationshipConstraintClassDifference;
158
- }
159
- /**
160
- * Definition of the differences between two Schemas.
161
- * @alpha
162
- */
163
- export interface SchemaDifferences {
46
+ export interface SchemaDifferenceResult {
164
47
  /** Full name of the source schema */
165
48
  readonly sourceSchemaName: string;
166
49
  /** Full name of the target schema */
@@ -422,5 +305,13 @@ export interface RelationshipConstraintClassDifference {
422
305
  readonly path: "$source" | "$target";
423
306
  readonly difference: string[];
424
307
  }
308
+ /**
309
+ * Creates a [[SchemaDifferenceResult]] for two given schemas.
310
+ * @param targetSchema The schema the differences gets merged into.
311
+ * @param sourceSchema The schema to get merged in the target.
312
+ * @returns An [[SchemaDifferenceResult]] object.
313
+ * @alpha
314
+ */
315
+ export declare function getSchemaDifferences(targetSchema: Schema, sourceSchema: Schema): Promise<SchemaDifferenceResult>;
425
316
  export {};
426
317
  //# sourceMappingURL=SchemaDifference.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaDifference.d.ts","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifference.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EACL,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,EAC/D,yBAAyB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EACrG,UAAU,EAAE,eAAe,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,2BAA2B,EACvG,KAAK,MAAM,EAAE,qBAAqB,EAAE,eAAe,EAAE,cAAc,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,eAAe,EAClJ,MAAM,0BAA0B,CAAC;AAElC,wEAAwE;AACxE,KAAK,eAAe,CAAC,CAAC,IAAI;IACxB,CAAC,UAAU,CAAC,IAAI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tB,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;CACrD;AAED;;;GAGG;AACH,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC,sBAAsB,CAAC;IAC7D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC,IAAI,CAAC,2BAA2B,EAAE,mBAAmB,CAAC,CAAC,CAAC;CAC9F;AAED;;;GAGG;AACH,MAAM,WAAW,qCAAqC;IACpD,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC,2BAA2B,CAAC;IAClE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAuBtH"}
@@ -7,10 +7,9 @@
7
7
  * @module Differencing
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.SchemaDifference = exports.SchemaOtherTypes = void 0;
11
- const SchemaComparer_1 = require("../Validation/SchemaComparer");
10
+ exports.getSchemaDifferences = exports.SchemaOtherTypes = void 0;
12
11
  const SchemaDiagnosticVisitor_1 = require("./SchemaDiagnosticVisitor");
13
- const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
12
+ const SchemaComparer_1 = require("../Validation/SchemaComparer");
14
13
  /**
15
14
  * Defines the SchemaTypes that are not SchemaItems.
16
15
  * @alpha
@@ -27,201 +26,32 @@ var SchemaOtherTypes;
27
26
  SchemaOtherTypes["EntityClassMixin"] = "EntityClassMixin";
28
27
  })(SchemaOtherTypes || (exports.SchemaOtherTypes = SchemaOtherTypes = {}));
29
28
  /**
29
+ * Creates a [[SchemaDifferenceResult]] for two given schemas.
30
+ * @param targetSchema The schema the differences gets merged into.
31
+ * @param sourceSchema The schema to get merged in the target.
32
+ * @returns An [[SchemaDifferenceResult]] object.
30
33
  * @alpha
31
34
  */
32
- var SchemaDifference;
33
- (function (SchemaDifference) {
34
- /**
35
- * Creates a [[SchemaDifference]] for two given schemas.
36
- * @param targetSchema The schema the differences gets merged into.
37
- * @param sourceSchema The schema to get merged in the target.
38
- * @returns An [[SchemaDifference]] object.
39
- * @alpha
40
- */
41
- async function fromSchemas(targetSchema, sourceSchema) {
42
- const changesList = [];
43
- const schemaComparer = new SchemaComparer_1.SchemaComparer({ report: changesList.push.bind(changesList) });
44
- await schemaComparer.compareSchemas(sourceSchema, targetSchema);
45
- return fromSchemaChanges(targetSchema, changesList[0]);
46
- }
47
- SchemaDifference.fromSchemas = fromSchemas;
48
- /**
49
- * Creates a [[SchemaDifference]] for a given [[SchemaChanges]] report.
50
- * @param targetSchema
51
- * @param schemaChanges A changes report of two schemas.
52
- * @returns An [[SchemaDifference]] object.
53
- * @internal
54
- */
55
- async function fromSchemaChanges(targetSchema, schemaChanges) {
56
- const visitor = new SchemaDiagnosticVisitor_1.SchemaDiagnosticVisitor();
57
- for (const diagnostic of schemaChanges.allDiagnostics) {
58
- visitor.visit(diagnostic);
59
- }
60
- const differences = [
61
- ...visitor.schemaDifferences,
62
- ...visitor.schemaItemDifferences,
63
- ...visitor.schemaItemPathDifferences,
64
- ...visitor.customAttributeDifferences,
65
- ];
66
- return {
67
- sourceSchemaName: schemaChanges.schema.schemaKey.toString(),
68
- targetSchemaName: targetSchema.schemaKey.toString(),
69
- conflicts: visitor.conflicts.length > 0 ? visitor.conflicts : undefined,
70
- differences,
71
- };
72
- }
73
- SchemaDifference.fromSchemaChanges = fromSchemaChanges;
74
- /**
75
- * Indicates whether the given difference is type of ConstantDifference.
76
- * @alpha
77
- */
78
- function isConstantDifference(difference) {
79
- return difference.schemaType === ecschema_metadata_1.SchemaItemType.Constant;
80
- }
81
- SchemaDifference.isConstantDifference = isConstantDifference;
82
- /**
83
- * Indicates whether the given difference is type of ClassPropertyDifference.
84
- * @alpha
85
- */
86
- function isClassPropertyDifference(difference) {
87
- return difference.schemaType === SchemaOtherTypes.Property;
88
- }
89
- SchemaDifference.isClassPropertyDifference = isClassPropertyDifference;
90
- /**
91
- * Indicates whether the given difference is type of CustomAttributeClassDifference.
92
- * @alpha
93
- */
94
- function isCustomAttributeClassDifference(difference) {
95
- return difference.schemaType === ecschema_metadata_1.SchemaItemType.CustomAttributeClass;
96
- }
97
- SchemaDifference.isCustomAttributeClassDifference = isCustomAttributeClassDifference;
98
- /**
99
- * Indicates whether the given difference is type of CustomAttributeDifference.
100
- * @alpha
101
- */
102
- function isCustomAttributeDifference(difference) {
103
- return difference.schemaType === SchemaOtherTypes.CustomAttributeInstance;
104
- }
105
- SchemaDifference.isCustomAttributeDifference = isCustomAttributeDifference;
106
- /**
107
- * Indicates whether the given difference is type of EntityClassDifference.
108
- * @alpha
109
- */
110
- function isEntityClassDifference(difference) {
111
- return difference.schemaType === ecschema_metadata_1.SchemaItemType.EntityClass;
112
- }
113
- SchemaDifference.isEntityClassDifference = isEntityClassDifference;
114
- /**
115
- * Indicates whether the given difference is type of EntityClassMixinDifference.
116
- * @alpha
117
- */
118
- function isEntityClassMixinDifference(difference) {
119
- return difference.schemaType === SchemaOtherTypes.EntityClassMixin;
120
- }
121
- SchemaDifference.isEntityClassMixinDifference = isEntityClassMixinDifference;
122
- /**
123
- * Indicates whether the given difference is type of EnumerationDifference.
124
- * @alpha
125
- */
126
- function isEnumerationDifference(difference) {
127
- return difference.schemaType === ecschema_metadata_1.SchemaItemType.Enumeration;
128
- }
129
- SchemaDifference.isEnumerationDifference = isEnumerationDifference;
130
- /**
131
- * Indicates whether the given difference is type of EnumeratorDifference.
132
- * @alpha
133
- */
134
- function isEnumeratorDifference(difference) {
135
- return difference.schemaType === SchemaOtherTypes.Enumerator;
136
- }
137
- SchemaDifference.isEnumeratorDifference = isEnumeratorDifference;
138
- /**
139
- * Indicates whether the given difference is type of KindOfQuantityDifference.
140
- * @alpha
141
- */
142
- function isKindOfQuantityDifference(difference) {
143
- return difference.schemaType === ecschema_metadata_1.SchemaItemType.KindOfQuantity;
144
- }
145
- SchemaDifference.isKindOfQuantityDifference = isKindOfQuantityDifference;
146
- /**
147
- * Indicates whether the given difference is type of MixinClassDifference.
148
- * @alpha
149
- */
150
- function isMixinClassDifference(difference) {
151
- return difference.schemaType === ecschema_metadata_1.SchemaItemType.Mixin;
152
- }
153
- SchemaDifference.isMixinClassDifference = isMixinClassDifference;
154
- /**
155
- * Indicates whether the given difference is type of PhenomenonDifference.
156
- * @alpha
157
- */
158
- function isPhenomenonDifference(difference) {
159
- return difference.schemaType === ecschema_metadata_1.SchemaItemType.Phenomenon;
160
- }
161
- SchemaDifference.isPhenomenonDifference = isPhenomenonDifference;
162
- /**
163
- * Indicates whether the given difference is type of PropertyCategoryDifference.
164
- * @alpha
165
- */
166
- function isPropertyCategoryDifference(difference) {
167
- return difference.schemaType === ecschema_metadata_1.SchemaItemType.PropertyCategory;
168
- }
169
- SchemaDifference.isPropertyCategoryDifference = isPropertyCategoryDifference;
170
- /**
171
- * Indicates whether the given difference is type of SchemaDifference.
172
- * @alpha
173
- */
174
- function isSchemaDifference(difference) {
175
- return difference.schemaType === SchemaOtherTypes.Schema;
176
- }
177
- SchemaDifference.isSchemaDifference = isSchemaDifference;
178
- /**
179
- * Indicates whether the given difference is type of SchemaReferenceDifference.
180
- * @alpha
181
- */
182
- function isSchemaReferenceDifference(difference) {
183
- return difference.schemaType === SchemaOtherTypes.SchemaReference;
184
- }
185
- SchemaDifference.isSchemaReferenceDifference = isSchemaReferenceDifference;
186
- /**
187
- * Indicates whether the given difference is type of CustomAttributeDifference.
188
- * @alpha
189
- */
190
- function isStructClassDifference(difference) {
191
- return difference.schemaType === ecschema_metadata_1.SchemaItemType.StructClass;
192
- }
193
- SchemaDifference.isStructClassDifference = isStructClassDifference;
194
- /**
195
- * Indicates whether the given difference is type of UnitSystemDifference.
196
- * @alpha
197
- */
198
- function isUnitSystemDifference(difference) {
199
- return difference.schemaType === ecschema_metadata_1.SchemaItemType.UnitSystem;
200
- }
201
- SchemaDifference.isUnitSystemDifference = isUnitSystemDifference;
202
- /**
203
- * Indicates whether the given difference is type of RelationshipClassDifference.
204
- * @alpha
205
- */
206
- function isRelationshipClassDifference(difference) {
207
- return difference.schemaType === ecschema_metadata_1.SchemaItemType.RelationshipClass;
208
- }
209
- SchemaDifference.isRelationshipClassDifference = isRelationshipClassDifference;
210
- /**
211
- * Indicates whether the given difference is type of RelationshipConstraintDifference.
212
- * @alpha
213
- */
214
- function isRelationshipConstraintDifference(difference) {
215
- return difference.schemaType === SchemaOtherTypes.RelationshipConstraint;
216
- }
217
- SchemaDifference.isRelationshipConstraintDifference = isRelationshipConstraintDifference;
218
- /**
219
- * Indicates whether the given difference is type of RelationshipConstraintClassDifference.
220
- * @alpha
221
- */
222
- function isRelationshipConstraintClassDifference(difference) {
223
- return difference.schemaType === SchemaOtherTypes.RelationshipConstraintClass;
224
- }
225
- SchemaDifference.isRelationshipConstraintClassDifference = isRelationshipConstraintClassDifference;
226
- })(SchemaDifference || (exports.SchemaDifference = SchemaDifference = {}));
35
+ async function getSchemaDifferences(targetSchema, sourceSchema) {
36
+ const changesList = [];
37
+ const schemaComparer = new SchemaComparer_1.SchemaComparer({ report: changesList.push.bind(changesList) });
38
+ await schemaComparer.compareSchemas(sourceSchema, targetSchema);
39
+ const visitor = new SchemaDiagnosticVisitor_1.SchemaDiagnosticVisitor();
40
+ for (const diagnostic of changesList[0].allDiagnostics) {
41
+ visitor.visit(diagnostic);
42
+ }
43
+ const differences = [
44
+ ...visitor.schemaDifferences,
45
+ ...visitor.schemaItemDifferences,
46
+ ...visitor.schemaItemPathDifferences,
47
+ ...visitor.customAttributeDifferences,
48
+ ];
49
+ return {
50
+ sourceSchemaName: sourceSchema.schemaKey.toString(),
51
+ targetSchemaName: targetSchema.schemaKey.toString(),
52
+ conflicts: visitor.conflicts.length > 0 ? visitor.conflicts : undefined,
53
+ differences,
54
+ };
55
+ }
56
+ exports.getSchemaDifferences = getSchemaDifferences;
227
57
  //# sourceMappingURL=SchemaDifference.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaDifference.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifference.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,iEAA8D;AAE9D,uEAAoE;AACpE,gEAKkC;AAsBlC;;;GAGG;AACH,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,uDAAmC,CAAA;IACnC,yCAAqB,CAAA;IACrB,6CAAyB,CAAA;IACzB,uEAAmD,CAAA;IACnD,qEAAiD,CAAA;IACjD,+EAA2D,CAAA;IAC3D,yDAAqC,CAAA;AACvC,CAAC,EATW,gBAAgB,gCAAhB,gBAAgB,QAS3B;AAQD;;GAEG;AACH,IAAiB,gBAAgB,CAmMhC;AAnMD,WAAiB,gBAAgB;IAC/B;;;;;;OAMG;IACI,KAAK,UAAU,WAAW,CAAC,YAAoB,EAAE,YAAoB;QAC1E,MAAM,WAAW,GAAoB,EAAE,CAAC;QACxC,MAAM,cAAc,GAAG,IAAI,+BAAc,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC1F,MAAM,cAAc,CAAC,cAAc,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAEhE,OAAO,iBAAiB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC;IANqB,4BAAW,c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------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Differencing\n */\n\nimport { SchemaChanges } from \"../Validation/SchemaChanges\";\nimport { SchemaComparer } from \"../Validation/SchemaComparer\";\nimport { SchemaDifferenceConflict } from \"./SchemaConflicts\";\nimport { SchemaDiagnosticVisitor } from \"./SchemaDiagnosticVisitor\";\nimport {\n AnyEnumerator, AnyPropertyProps, ConstantProps, CustomAttribute,\n CustomAttributeClassProps, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps,\n MixinProps, PhenomenonProps, PropertyCategoryProps, RelationshipClassProps, RelationshipConstraintProps,\n type Schema, SchemaItemFormatProps, SchemaItemProps, SchemaItemType, SchemaItemUnitProps, SchemaReferenceProps, StructClassProps, UnitSystemProps,\n} from \"@itwin/ecschema-metadata\";\n\n/** Utility-Type to remove possible readonly flags on the given type. */\ntype PartialEditable<T> = {\n -readonly [P in keyof T]?: T[P];\n};\n\n/**\n * Utility-Type to simplify the expected SchemaItem props by omitting the base properties\n * that are not needed for the schema differencing. Also all properties are made mutable\n * by removing the readonly flag if present.\n */\ntype SchemaItemProperties<T extends SchemaItemProps> = {\n [P in keyof PartialEditable<Omit<T, keyof Omit<SchemaItemProps, \"label\" | \"description\" | \"customAttributes\">>>]: T[P]\n};\n\n/**\n * Defines the type of the difference operation.\n * @alpha\n */\nexport type DifferenceType = \"add\" | \"modify\";\n\n/**\n * Defines the SchemaTypes that are not SchemaItems.\n * @alpha\n */\nexport enum SchemaOtherTypes {\n Schema = \"Schema\",\n SchemaReference = \"SchemaReference\",\n Property = \"Property\",\n Enumerator = \"Enumerator\",\n CustomAttributeInstance = \"CustomAttributeInstance\",\n RelationshipConstraint = \"RelationshipConstraint\",\n RelationshipConstraintClass = \"RelationshipConstraintClass\",\n EntityClassMixin = \"EntityClassMixin\",\n}\n\n/**\n * Defines the possible values SchemaTypes that can occur in SchemaDifferences or Conflicts.\n * @alpha\n */\nexport type SchemaType = SchemaOtherTypes | SchemaItemType;\n\n/**\n * @alpha\n */\nexport namespace SchemaDifference {\n /**\n * Creates a [[SchemaDifference]] for two given schemas.\n * @param targetSchema The schema the differences gets merged into.\n * @param sourceSchema The schema to get merged in the target.\n * @returns An [[SchemaDifference]] object.\n * @alpha\n */\n export async function fromSchemas(targetSchema: Schema, sourceSchema: Schema): Promise<SchemaDifferences> {\n const changesList: SchemaChanges[] = [];\n const schemaComparer = new SchemaComparer({ report: changesList.push.bind(changesList) });\n await schemaComparer.compareSchemas(sourceSchema, targetSchema);\n\n return fromSchemaChanges(targetSchema, changesList[0]);\n }\n\n /**\n * Creates a [[SchemaDifference]] for a given [[SchemaChanges]] report.\n * @param targetSchema\n * @param schemaChanges A changes report of two schemas.\n * @returns An [[SchemaDifference]] object.\n * @internal\n */\n export async function fromSchemaChanges(targetSchema: Schema, schemaChanges: SchemaChanges): Promise<SchemaDifferences> {\n const visitor = new SchemaDiagnosticVisitor();\n for (const diagnostic of schemaChanges.allDiagnostics) {\n visitor.visit(diagnostic);\n }\n\n const differences: AnySchemaDifference[] = [\n ...visitor.schemaDifferences,\n ...visitor.schemaItemDifferences,\n ...visitor.schemaItemPathDifferences,\n ...visitor.customAttributeDifferences,\n ];\n\n return {\n sourceSchemaName: schemaChanges.schema.schemaKey.toString(),\n targetSchemaName: targetSchema.schemaKey.toString(),\n conflicts: visitor.conflicts.length > 0 ? visitor.conflicts : undefined,\n differences,\n };\n }\n\n /**\n * Indicates whether the given difference is type of ConstantDifference.\n * @alpha\n */\n export function isConstantDifference(difference: AnySchemaDifference): difference is ConstantDifference {\n return difference.schemaType === SchemaItemType.Constant;\n }\n\n /**\n * Indicates whether the given difference is type of ClassPropertyDifference.\n * @alpha\n */\n export function isClassPropertyDifference(difference: AnySchemaDifference): difference is ClassPropertyDifference {\n return difference.schemaType === SchemaOtherTypes.Property;\n }\n\n /**\n * Indicates whether the given difference is type of CustomAttributeClassDifference.\n * @alpha\n */\n export function isCustomAttributeClassDifference(difference: AnySchemaDifference): difference is CustomAttributeClassDifference {\n return difference.schemaType === SchemaItemType.CustomAttributeClass;\n }\n\n /**\n * Indicates whether the given difference is type of CustomAttributeDifference.\n * @alpha\n */\n export function isCustomAttributeDifference(difference: AnySchemaDifference): difference is CustomAttributeDifference {\n return difference.schemaType === SchemaOtherTypes.CustomAttributeInstance;\n }\n\n /**\n * Indicates whether the given difference is type of EntityClassDifference.\n * @alpha\n */\n export function isEntityClassDifference(difference: AnySchemaDifference): difference is EntityClassDifference {\n return difference.schemaType === SchemaItemType.EntityClass;\n }\n\n /**\n * Indicates whether the given difference is type of EntityClassMixinDifference.\n * @alpha\n */\n export function isEntityClassMixinDifference(difference: AnySchemaDifference): difference is EntityClassMixinDifference {\n return difference.schemaType === SchemaOtherTypes.EntityClassMixin;\n }\n\n /**\n * Indicates whether the given difference is type of EnumerationDifference.\n * @alpha\n */\n export function isEnumerationDifference(difference: AnySchemaDifference): difference is EnumerationDifference {\n return difference.schemaType === SchemaItemType.Enumeration;\n }\n\n /**\n * Indicates whether the given difference is type of EnumeratorDifference.\n * @alpha\n */\n export function isEnumeratorDifference(difference: AnySchemaDifference): difference is EnumeratorDifference {\n return difference.schemaType === SchemaOtherTypes.Enumerator;\n }\n\n /**\n * Indicates whether the given difference is type of KindOfQuantityDifference.\n * @alpha\n */\n export function isKindOfQuantityDifference(difference: AnySchemaDifference): difference is KindOfQuantityDifference {\n return difference.schemaType === SchemaItemType.KindOfQuantity;\n }\n\n /**\n * Indicates whether the given difference is type of MixinClassDifference.\n * @alpha\n */\n export function isMixinClassDifference(difference: AnySchemaDifference): difference is MixinClassDifference {\n return difference.schemaType === SchemaItemType.Mixin;\n }\n\n /**\n * Indicates whether the given difference is type of PhenomenonDifference.\n * @alpha\n */\n export function isPhenomenonDifference(difference: AnySchemaDifference): difference is PhenomenonDifference {\n return difference.schemaType === SchemaItemType.Phenomenon;\n }\n\n /**\n * Indicates whether the given difference is type of PropertyCategoryDifference.\n * @alpha\n */\n export function isPropertyCategoryDifference(difference: AnySchemaDifference): difference is PropertyCategoryDifference {\n return difference.schemaType === SchemaItemType.PropertyCategory;\n }\n\n /**\n * Indicates whether the given difference is type of SchemaDifference.\n * @alpha\n */\n export function isSchemaDifference(difference: AnySchemaDifference): difference is SchemaDifference {\n return difference.schemaType === SchemaOtherTypes.Schema;\n }\n\n /**\n * Indicates whether the given difference is type of SchemaReferenceDifference.\n * @alpha\n */\n export function isSchemaReferenceDifference(difference: AnySchemaDifference): difference is SchemaReferenceDifference {\n return difference.schemaType === SchemaOtherTypes.SchemaReference;\n }\n\n /**\n * Indicates whether the given difference is type of CustomAttributeDifference.\n * @alpha\n */\n export function isStructClassDifference(difference: AnySchemaDifference): difference is StructClassDifference {\n return difference.schemaType === SchemaItemType.StructClass;\n }\n\n /**\n * Indicates whether the given difference is type of UnitSystemDifference.\n * @alpha\n */\n export function isUnitSystemDifference(difference: AnySchemaDifference): difference is UnitSystemDifference {\n return difference.schemaType === SchemaItemType.UnitSystem;\n }\n\n /**\n * Indicates whether the given difference is type of RelationshipClassDifference.\n * @alpha\n */\n export function isRelationshipClassDifference(difference: AnySchemaDifference): difference is RelationshipClassDifference {\n return difference.schemaType === SchemaItemType.RelationshipClass;\n }\n\n /**\n * Indicates whether the given difference is type of RelationshipConstraintDifference.\n * @alpha\n */\n export function isRelationshipConstraintDifference(difference: AnySchemaDifference): difference is RelationshipConstraintDifference {\n return difference.schemaType === SchemaOtherTypes.RelationshipConstraint;\n }\n\n /**\n * Indicates whether the given difference is type of RelationshipConstraintClassDifference.\n * @alpha\n */\n export function isRelationshipConstraintClassDifference(difference: AnySchemaDifference): difference is RelationshipConstraintClassDifference {\n return difference.schemaType === SchemaOtherTypes.RelationshipConstraintClass;\n }\n}\n\n/**\n * Definition of the differences between two Schemas.\n * @alpha\n */\nexport interface SchemaDifferences {\n /** Full name of the source schema */\n readonly sourceSchemaName: string;\n /** Full name of the target schema */\n readonly targetSchemaName: string;\n\n /** List of differences between the compared schemas. */\n readonly differences: AnySchemaDifference[];\n\n /** List of conflicts found while comparing the schemas. */\n readonly conflicts?: SchemaDifferenceConflict[];\n}\n\n/**\n * Union of all supported schema differencing types.\n * @alpha\n */\nexport type AnySchemaDifference =\n SchemaDifference |\n SchemaReferenceDifference |\n AnySchemaItemDifference |\n AnySchemaItemPathDifference |\n CustomAttributeDifference;\n\n/**\n * Differencing entry for changes on a Schema.\n * @alpha\n */\nexport interface SchemaDifference {\n readonly changeType: \"modify\";\n readonly schemaType: SchemaOtherTypes.Schema;\n readonly difference: {\n label?: string;\n description?: string;\n };\n}\n\n/**\n * Differencing entry for added or changed Schema References of a Schema.\n * @alpha\n */\nexport interface SchemaReferenceDifference {\n readonly changeType: \"add\" | \"modify\";\n readonly schemaType: SchemaOtherTypes.SchemaReference;\n readonly difference: SchemaReferenceProps;\n}\n\n/**\n * Union of all supported schema item differencing types.\n * @alpha\n */\nexport type AnySchemaItemDifference =\n ClassItemDifference |\n ConstantDifference |\n EnumerationDifference |\n EntityClassMixinDifference |\n FormatDifference |\n KindOfQuantityDifference |\n InvertedUnitDifference |\n PhenomenonDifference |\n PropertyCategoryDifference |\n UnitDifference |\n UnitSystemDifference;\n\n/**\n * Union for supported class Schema Items.\n * @alpha\n */\nexport type ClassItemDifference =\n EntityClassDifference |\n MixinClassDifference |\n StructClassDifference |\n CustomAttributeClassDifference |\n RelationshipClassDifference;\n\n/**\n * Union of all differences that have a path pointing inside a schema item.\n * @alpha\n */\nexport type AnySchemaItemPathDifference =\n RelationshipConstraintDifference |\n RelationshipConstraintClassDifference |\n CustomAttributePropertyDifference |\n EnumeratorDifference |\n ClassPropertyDifference;\n\n/**\n * Internal base class for all Schema Item differencing entries.\n * @alpha\n */\ninterface SchemaItemDifference<T extends SchemaItemProps> {\n readonly changeType: \"add\" | \"modify\";\n readonly itemName: string;\n readonly difference: SchemaItemProperties<T>;\n}\n\n/**\n * Differencing entry for Constant Schema Items.\n * @alpha\n */\nexport interface ConstantDifference extends SchemaItemDifference<ConstantProps> {\n readonly schemaType: SchemaItemType.Constant;\n}\n\n/**\n * Differencing entry for Custom Attribute Class Schema Items.\n * @alpha\n */\nexport interface CustomAttributeClassDifference extends SchemaItemDifference<CustomAttributeClassProps> {\n readonly schemaType: SchemaItemType.CustomAttributeClass;\n}\n\n/**\n * Differencing entry for Entity Class Schema Items.\n * @alpha\n */\nexport interface EntityClassDifference extends SchemaItemDifference<EntityClassProps> {\n readonly schemaType: SchemaItemType.EntityClass;\n}\n\n/**\n * Differencing entry for Enumerator Schema Items.\n * @alpha\n */\nexport interface EnumerationDifference extends SchemaItemDifference<EnumerationProps> {\n readonly schemaType: SchemaItemType.Enumeration;\n}\n\n/**\n * Differencing entry for Kind-Of-Quantities Schema Items.\n * @alpha\n */\nexport interface KindOfQuantityDifference extends SchemaItemDifference<KindOfQuantityProps> {\n readonly schemaType: SchemaItemType.KindOfQuantity;\n}\n\n/**\n * Differencing entry for Mixin Class Schema Items.\n * @alpha\n */\nexport interface MixinClassDifference extends SchemaItemDifference<MixinProps> {\n readonly schemaType: SchemaItemType.Mixin;\n}\n\n/**\n * Differencing entry for Phenomenon Schema Items.\n * @alpha\n */\nexport interface PhenomenonDifference extends SchemaItemDifference<PhenomenonProps> {\n readonly schemaType: SchemaItemType.Phenomenon;\n}\n\n/**\n * Differencing entry for Property Category Schema Items.\n * @alpha\n */\nexport interface PropertyCategoryDifference extends SchemaItemDifference<PropertyCategoryProps> {\n readonly schemaType: SchemaItemType.PropertyCategory;\n}\n\n/**\n * Differencing entry for Relationship Class Schema Items.\n * @alpha\n */\nexport interface RelationshipClassDifference extends SchemaItemDifference<RelationshipClassProps> {\n readonly schemaType: SchemaItemType.RelationshipClass;\n}\n\n/**\n * Differencing entry for Struct Class Schema Items.\n * @alpha\n */\nexport interface StructClassDifference extends SchemaItemDifference<StructClassProps> {\n readonly schemaType: SchemaItemType.StructClass;\n}\n\n/**\n * Differencing entry for Unit System Schema Items.\n * @alpha\n */\nexport interface UnitSystemDifference extends SchemaItemDifference<UnitSystemProps> {\n readonly schemaType: SchemaItemType.UnitSystem;\n}\n\n/**\n * Differencing entry for Unit Schema Items.\n * @alpha\n */\nexport interface UnitDifference extends SchemaItemDifference<SchemaItemUnitProps> {\n readonly schemaType: SchemaItemType.Unit;\n}\n\n/**\n * Differencing entry for Inverted Unit Schema Items.\n * @alpha\n */\nexport interface InvertedUnitDifference extends SchemaItemDifference<InvertedUnitProps> {\n readonly schemaType: SchemaItemType.InvertedUnit;\n}\n/**\n * Differencing entry for Format Schema Items.\n * @alpha\n */\nexport interface FormatDifference extends SchemaItemDifference<SchemaItemFormatProps> {\n readonly schemaType: SchemaItemType.Format;\n}\n\n/**\n * Differencing entry for added or changed Properties.\n * @alpha\n */\nexport interface ClassPropertyDifference {\n readonly changeType: \"add\" | \"modify\";\n readonly schemaType: SchemaOtherTypes.Property;\n readonly itemName: string;\n readonly path: string;\n readonly difference: PartialEditable<AnyPropertyProps>;\n}\n\n/**\n * Union of supported Custom Attribute Differences.\n * @alpha\n */\nexport type CustomAttributeDifference =\n CustomAttributeSchemaDifference |\n CustomAttributeSchemaItemDifference |\n CustomAttributePropertyDifference |\n CustomAttributeRelationshipConstraintDifference;\n\n/**\n * Differencing entry for Custom Attributes on Schema.\n * @alpha\n */\nexport interface CustomAttributeSchemaDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.CustomAttributeInstance;\n readonly appliedTo: \"Schema\";\n readonly difference: PartialEditable<CustomAttribute>;\n}\n\n/**\n * Differencing entry for Custom Attributes on Schema Items.\n * @alpha\n */\nexport interface CustomAttributeSchemaItemDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.CustomAttributeInstance;\n readonly appliedTo: \"SchemaItem\";\n readonly itemName: string;\n readonly difference: PartialEditable<CustomAttribute>;\n}\n\n/**\n * Differencing entry for Custom Attributes on Properties.\n * @alpha\n */\nexport interface CustomAttributePropertyDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.CustomAttributeInstance;\n readonly appliedTo: \"Property\";\n readonly itemName: string;\n readonly path: string;\n readonly difference: PartialEditable<CustomAttribute>;\n}\n\n/**\n * Differencing entry for Custom Attributes on Relationship Constraints.\n * @alpha\n */\nexport interface CustomAttributeRelationshipConstraintDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.CustomAttributeInstance;\n readonly appliedTo: \"RelationshipConstraint\";\n readonly itemName: string;\n readonly path: \"$source\" | \"$target\";\n readonly difference: PartialEditable<CustomAttribute>;\n}\n\n/**\n * Differencing entry for changed mixins on EntityClasses.\n * @alpha\n */\nexport interface EntityClassMixinDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.EntityClassMixin;\n readonly itemName: string;\n readonly difference: string[];\n}\n\n/**\n * Differencing entry for changed Enumerators on Enumerable Schema Items.\n * @alpha\n */\nexport interface EnumeratorDifference {\n readonly changeType: \"add\" | \"modify\";\n readonly schemaType: SchemaOtherTypes.Enumerator;\n readonly itemName: string;\n readonly path: string;\n readonly difference: PartialEditable<AnyEnumerator>;\n}\n\n/**\n * Differencing entry for Relationship Constraints.\n * @alpha\n */\nexport interface RelationshipConstraintDifference {\n readonly changeType: \"modify\";\n readonly schemaType: SchemaOtherTypes.RelationshipConstraint;\n readonly itemName: string;\n readonly path: \"$source\" | \"$target\";\n readonly difference: PartialEditable<Omit<RelationshipConstraintProps, \"constraintClasses\">>;\n}\n\n/**\n * Differencing entry for constraint classes added to Relationship Constrains.\n * @alpha\n */\nexport interface RelationshipConstraintClassDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.RelationshipConstraintClass;\n readonly itemName: string;\n readonly path: \"$source\" | \"$target\";\n readonly difference: string[];\n}\n"]}
1
+ {"version":3,"file":"SchemaDifference.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifference.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;A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AW;KACZ,CAAC;AACJ,CAAC;AAvBD,oDAuBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Differencing\n */\n\nimport { SchemaDifferenceConflict } from \"./SchemaConflicts\";\nimport { SchemaDiagnosticVisitor } from \"./SchemaDiagnosticVisitor\";\nimport { SchemaChanges } from \"../Validation/SchemaChanges\";\nimport { SchemaComparer } from \"../Validation/SchemaComparer\";\nimport {\n AnyEnumerator, AnyPropertyProps, ConstantProps, CustomAttribute,\n CustomAttributeClassProps, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps,\n MixinProps, PhenomenonProps, PropertyCategoryProps, RelationshipClassProps, RelationshipConstraintProps,\n type Schema, SchemaItemFormatProps, SchemaItemProps, SchemaItemType, SchemaItemUnitProps, SchemaReferenceProps, StructClassProps, UnitSystemProps,\n} from \"@itwin/ecschema-metadata\";\n\n/** Utility-Type to remove possible readonly flags on the given type. */\ntype PartialEditable<T> = {\n -readonly [P in keyof T]?: T[P];\n};\n\n/**\n * Utility-Type to simplify the expected SchemaItem props by omitting the base properties\n * that are not needed for the schema differencing. Also all properties are made mutable\n * by removing the readonly flag if present.\n */\ntype SchemaItemProperties<T extends SchemaItemProps> = {\n [P in keyof PartialEditable<Omit<T, keyof Omit<SchemaItemProps, \"label\" | \"description\" | \"customAttributes\">>>]: T[P]\n};\n\n/**\n * Defines the type of the difference operation.\n * @alpha\n */\nexport type DifferenceType = \"add\" | \"modify\";\n\n/**\n * Defines the SchemaTypes that are not SchemaItems.\n * @alpha\n */\nexport enum SchemaOtherTypes {\n Schema = \"Schema\",\n SchemaReference = \"SchemaReference\",\n Property = \"Property\",\n Enumerator = \"Enumerator\",\n CustomAttributeInstance = \"CustomAttributeInstance\",\n RelationshipConstraint = \"RelationshipConstraint\",\n RelationshipConstraintClass = \"RelationshipConstraintClass\",\n EntityClassMixin = \"EntityClassMixin\",\n}\n\n/**\n * Defines the possible values SchemaTypes that can occur in SchemaDifferences or Conflicts.\n * @alpha\n */\nexport type SchemaType = SchemaOtherTypes | SchemaItemType;\n\n/**\n * Definition of the difference result between two Schemas.\n * @alpha\n */\nexport interface SchemaDifferenceResult {\n /** Full name of the source schema */\n readonly sourceSchemaName: string;\n /** Full name of the target schema */\n readonly targetSchemaName: string;\n\n /** List of differences between the compared schemas. */\n readonly differences: AnySchemaDifference[];\n\n /** List of conflicts found while comparing the schemas. */\n readonly conflicts?: SchemaDifferenceConflict[];\n}\n\n/**\n * Union of all supported schema differencing types.\n * @alpha\n */\nexport type AnySchemaDifference =\n SchemaDifference |\n SchemaReferenceDifference |\n AnySchemaItemDifference |\n AnySchemaItemPathDifference |\n CustomAttributeDifference;\n\n/**\n * Differencing entry for changes on a Schema.\n * @alpha\n */\nexport interface SchemaDifference {\n readonly changeType: \"modify\";\n readonly schemaType: SchemaOtherTypes.Schema;\n readonly difference: {\n label?: string;\n description?: string;\n };\n}\n\n/**\n * Differencing entry for added or changed Schema References of a Schema.\n * @alpha\n */\nexport interface SchemaReferenceDifference {\n readonly changeType: \"add\" | \"modify\";\n readonly schemaType: SchemaOtherTypes.SchemaReference;\n readonly difference: SchemaReferenceProps;\n}\n\n/**\n * Union of all supported schema item differencing types.\n * @alpha\n */\nexport type AnySchemaItemDifference =\n ClassItemDifference |\n ConstantDifference |\n EnumerationDifference |\n EntityClassMixinDifference |\n FormatDifference |\n KindOfQuantityDifference |\n InvertedUnitDifference |\n PhenomenonDifference |\n PropertyCategoryDifference |\n UnitDifference |\n UnitSystemDifference;\n\n/**\n * Union for supported class Schema Items.\n * @alpha\n */\nexport type ClassItemDifference =\n EntityClassDifference |\n MixinClassDifference |\n StructClassDifference |\n CustomAttributeClassDifference |\n RelationshipClassDifference;\n\n/**\n * Union of all differences that have a path pointing inside a schema item.\n * @alpha\n */\nexport type AnySchemaItemPathDifference =\n RelationshipConstraintDifference |\n RelationshipConstraintClassDifference |\n CustomAttributePropertyDifference |\n EnumeratorDifference |\n ClassPropertyDifference;\n\n/**\n * Internal base class for all Schema Item differencing entries.\n * @alpha\n */\ninterface SchemaItemDifference<T extends SchemaItemProps> {\n readonly changeType: \"add\" | \"modify\";\n readonly itemName: string;\n readonly difference: SchemaItemProperties<T>;\n}\n\n/**\n * Differencing entry for Constant Schema Items.\n * @alpha\n */\nexport interface ConstantDifference extends SchemaItemDifference<ConstantProps> {\n readonly schemaType: SchemaItemType.Constant;\n}\n\n/**\n * Differencing entry for Custom Attribute Class Schema Items.\n * @alpha\n */\nexport interface CustomAttributeClassDifference extends SchemaItemDifference<CustomAttributeClassProps> {\n readonly schemaType: SchemaItemType.CustomAttributeClass;\n}\n\n/**\n * Differencing entry for Entity Class Schema Items.\n * @alpha\n */\nexport interface EntityClassDifference extends SchemaItemDifference<EntityClassProps> {\n readonly schemaType: SchemaItemType.EntityClass;\n}\n\n/**\n * Differencing entry for Enumerator Schema Items.\n * @alpha\n */\nexport interface EnumerationDifference extends SchemaItemDifference<EnumerationProps> {\n readonly schemaType: SchemaItemType.Enumeration;\n}\n\n/**\n * Differencing entry for Kind-Of-Quantities Schema Items.\n * @alpha\n */\nexport interface KindOfQuantityDifference extends SchemaItemDifference<KindOfQuantityProps> {\n readonly schemaType: SchemaItemType.KindOfQuantity;\n}\n\n/**\n * Differencing entry for Mixin Class Schema Items.\n * @alpha\n */\nexport interface MixinClassDifference extends SchemaItemDifference<MixinProps> {\n readonly schemaType: SchemaItemType.Mixin;\n}\n\n/**\n * Differencing entry for Phenomenon Schema Items.\n * @alpha\n */\nexport interface PhenomenonDifference extends SchemaItemDifference<PhenomenonProps> {\n readonly schemaType: SchemaItemType.Phenomenon;\n}\n\n/**\n * Differencing entry for Property Category Schema Items.\n * @alpha\n */\nexport interface PropertyCategoryDifference extends SchemaItemDifference<PropertyCategoryProps> {\n readonly schemaType: SchemaItemType.PropertyCategory;\n}\n\n/**\n * Differencing entry for Relationship Class Schema Items.\n * @alpha\n */\nexport interface RelationshipClassDifference extends SchemaItemDifference<RelationshipClassProps> {\n readonly schemaType: SchemaItemType.RelationshipClass;\n}\n\n/**\n * Differencing entry for Struct Class Schema Items.\n * @alpha\n */\nexport interface StructClassDifference extends SchemaItemDifference<StructClassProps> {\n readonly schemaType: SchemaItemType.StructClass;\n}\n\n/**\n * Differencing entry for Unit System Schema Items.\n * @alpha\n */\nexport interface UnitSystemDifference extends SchemaItemDifference<UnitSystemProps> {\n readonly schemaType: SchemaItemType.UnitSystem;\n}\n\n/**\n * Differencing entry for Unit Schema Items.\n * @alpha\n */\nexport interface UnitDifference extends SchemaItemDifference<SchemaItemUnitProps> {\n readonly schemaType: SchemaItemType.Unit;\n}\n\n/**\n * Differencing entry for Inverted Unit Schema Items.\n * @alpha\n */\nexport interface InvertedUnitDifference extends SchemaItemDifference<InvertedUnitProps> {\n readonly schemaType: SchemaItemType.InvertedUnit;\n}\n/**\n * Differencing entry for Format Schema Items.\n * @alpha\n */\nexport interface FormatDifference extends SchemaItemDifference<SchemaItemFormatProps> {\n readonly schemaType: SchemaItemType.Format;\n}\n\n/**\n * Differencing entry for added or changed Properties.\n * @alpha\n */\nexport interface ClassPropertyDifference {\n readonly changeType: \"add\" | \"modify\";\n readonly schemaType: SchemaOtherTypes.Property;\n readonly itemName: string;\n readonly path: string;\n readonly difference: PartialEditable<AnyPropertyProps>;\n}\n\n/**\n * Union of supported Custom Attribute Differences.\n * @alpha\n */\nexport type CustomAttributeDifference =\n CustomAttributeSchemaDifference |\n CustomAttributeSchemaItemDifference |\n CustomAttributePropertyDifference |\n CustomAttributeRelationshipConstraintDifference;\n\n/**\n * Differencing entry for Custom Attributes on Schema.\n * @alpha\n */\nexport interface CustomAttributeSchemaDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.CustomAttributeInstance;\n readonly appliedTo: \"Schema\";\n readonly difference: PartialEditable<CustomAttribute>;\n}\n\n/**\n * Differencing entry for Custom Attributes on Schema Items.\n * @alpha\n */\nexport interface CustomAttributeSchemaItemDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.CustomAttributeInstance;\n readonly appliedTo: \"SchemaItem\";\n readonly itemName: string;\n readonly difference: PartialEditable<CustomAttribute>;\n}\n\n/**\n * Differencing entry for Custom Attributes on Properties.\n * @alpha\n */\nexport interface CustomAttributePropertyDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.CustomAttributeInstance;\n readonly appliedTo: \"Property\";\n readonly itemName: string;\n readonly path: string;\n readonly difference: PartialEditable<CustomAttribute>;\n}\n\n/**\n * Differencing entry for Custom Attributes on Relationship Constraints.\n * @alpha\n */\nexport interface CustomAttributeRelationshipConstraintDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.CustomAttributeInstance;\n readonly appliedTo: \"RelationshipConstraint\";\n readonly itemName: string;\n readonly path: \"$source\" | \"$target\";\n readonly difference: PartialEditable<CustomAttribute>;\n}\n\n/**\n * Differencing entry for changed mixins on EntityClasses.\n * @alpha\n */\nexport interface EntityClassMixinDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.EntityClassMixin;\n readonly itemName: string;\n readonly difference: string[];\n}\n\n/**\n * Differencing entry for changed Enumerators on Enumerable Schema Items.\n * @alpha\n */\nexport interface EnumeratorDifference {\n readonly changeType: \"add\" | \"modify\";\n readonly schemaType: SchemaOtherTypes.Enumerator;\n readonly itemName: string;\n readonly path: string;\n readonly difference: PartialEditable<AnyEnumerator>;\n}\n\n/**\n * Differencing entry for Relationship Constraints.\n * @alpha\n */\nexport interface RelationshipConstraintDifference {\n readonly changeType: \"modify\";\n readonly schemaType: SchemaOtherTypes.RelationshipConstraint;\n readonly itemName: string;\n readonly path: \"$source\" | \"$target\";\n readonly difference: PartialEditable<Omit<RelationshipConstraintProps, \"constraintClasses\">>;\n}\n\n/**\n * Differencing entry for constraint classes added to Relationship Constrains.\n * @alpha\n */\nexport interface RelationshipConstraintClassDifference {\n readonly changeType: \"add\";\n readonly schemaType: SchemaOtherTypes.RelationshipConstraintClass;\n readonly itemName: string;\n readonly path: \"$source\" | \"$target\";\n readonly difference: string[];\n}\n\n/**\n * Creates a [[SchemaDifferenceResult]] for two given schemas.\n * @param targetSchema The schema the differences gets merged into.\n * @param sourceSchema The schema to get merged in the target.\n * @returns An [[SchemaDifferenceResult]] object.\n * @alpha\n */\nexport async function getSchemaDifferences(targetSchema: Schema, sourceSchema: Schema): Promise<SchemaDifferenceResult> {\n const changesList: SchemaChanges[] = [];\n const schemaComparer = new SchemaComparer({ report: changesList.push.bind(changesList) });\n await schemaComparer.compareSchemas(sourceSchema, targetSchema);\n\n const visitor = new SchemaDiagnosticVisitor();\n for (const diagnostic of changesList[0].allDiagnostics) {\n visitor.visit(diagnostic);\n }\n\n const differences: AnySchemaDifference[] = [\n ...visitor.schemaDifferences,\n ...visitor.schemaItemDifferences,\n ...visitor.schemaItemPathDifferences,\n ...visitor.customAttributeDifferences,\n ];\n\n return {\n sourceSchemaName: sourceSchema.schemaKey.toString(),\n targetSchemaName: targetSchema.schemaKey.toString(),\n conflicts: visitor.conflicts.length > 0 ? visitor.conflicts : undefined,\n differences,\n };\n}\n"]}
@@ -0,0 +1,100 @@
1
+ /** @packageDocumentation
2
+ * @module Differencing
3
+ */
4
+ import { type AnySchemaDifference, type ClassPropertyDifference, type ConstantDifference, type CustomAttributeClassDifference, type CustomAttributeDifference, type EntityClassDifference, type EntityClassMixinDifference, type EnumerationDifference, type EnumeratorDifference, type KindOfQuantityDifference, type MixinClassDifference, type PhenomenonDifference, type PropertyCategoryDifference, type RelationshipClassDifference, type RelationshipConstraintClassDifference, type RelationshipConstraintDifference, type SchemaDifference, type SchemaReferenceDifference, type StructClassDifference, type UnitSystemDifference } from "./SchemaDifference";
5
+ /**
6
+ * Indicates whether the given difference is type of ConstantDifference.
7
+ * @alpha
8
+ */
9
+ export declare function isConstantDifference(difference: AnySchemaDifference): difference is ConstantDifference;
10
+ /**
11
+ * Indicates whether the given difference is type of ClassPropertyDifference.
12
+ * @alpha
13
+ */
14
+ export declare function isClassPropertyDifference(difference: AnySchemaDifference): difference is ClassPropertyDifference;
15
+ /**
16
+ * Indicates whether the given difference is type of CustomAttributeClassDifference.
17
+ * @alpha
18
+ */
19
+ export declare function isCustomAttributeClassDifference(difference: AnySchemaDifference): difference is CustomAttributeClassDifference;
20
+ /**
21
+ * Indicates whether the given difference is type of CustomAttributeDifference.
22
+ * @alpha
23
+ */
24
+ export declare function isCustomAttributeDifference(difference: AnySchemaDifference): difference is CustomAttributeDifference;
25
+ /**
26
+ * Indicates whether the given difference is type of EntityClassDifference.
27
+ * @alpha
28
+ */
29
+ export declare function isEntityClassDifference(difference: AnySchemaDifference): difference is EntityClassDifference;
30
+ /**
31
+ * Indicates whether the given difference is type of EntityClassMixinDifference.
32
+ * @alpha
33
+ */
34
+ export declare function isEntityClassMixinDifference(difference: AnySchemaDifference): difference is EntityClassMixinDifference;
35
+ /**
36
+ * Indicates whether the given difference is type of EnumerationDifference.
37
+ * @alpha
38
+ */
39
+ export declare function isEnumerationDifference(difference: AnySchemaDifference): difference is EnumerationDifference;
40
+ /**
41
+ * Indicates whether the given difference is type of EnumeratorDifference.
42
+ * @alpha
43
+ */
44
+ export declare function isEnumeratorDifference(difference: AnySchemaDifference): difference is EnumeratorDifference;
45
+ /**
46
+ * Indicates whether the given difference is type of KindOfQuantityDifference.
47
+ * @alpha
48
+ */
49
+ export declare function isKindOfQuantityDifference(difference: AnySchemaDifference): difference is KindOfQuantityDifference;
50
+ /**
51
+ * Indicates whether the given difference is type of MixinClassDifference.
52
+ * @alpha
53
+ */
54
+ export declare function isMixinClassDifference(difference: AnySchemaDifference): difference is MixinClassDifference;
55
+ /**
56
+ * Indicates whether the given difference is type of PhenomenonDifference.
57
+ * @alpha
58
+ */
59
+ export declare function isPhenomenonDifference(difference: AnySchemaDifference): difference is PhenomenonDifference;
60
+ /**
61
+ * Indicates whether the given difference is type of PropertyCategoryDifference.
62
+ * @alpha
63
+ */
64
+ export declare function isPropertyCategoryDifference(difference: AnySchemaDifference): difference is PropertyCategoryDifference;
65
+ /**
66
+ * Indicates whether the given difference is type of SchemaDifference.
67
+ * @alpha
68
+ */
69
+ export declare function isSchemaDifference(difference: AnySchemaDifference): difference is SchemaDifference;
70
+ /**
71
+ * Indicates whether the given difference is type of SchemaReferenceDifference.
72
+ * @alpha
73
+ */
74
+ export declare function isSchemaReferenceDifference(difference: AnySchemaDifference): difference is SchemaReferenceDifference;
75
+ /**
76
+ * Indicates whether the given difference is type of CustomAttributeDifference.
77
+ * @alpha
78
+ */
79
+ export declare function isStructClassDifference(difference: AnySchemaDifference): difference is StructClassDifference;
80
+ /**
81
+ * Indicates whether the given difference is type of UnitSystemDifference.
82
+ * @alpha
83
+ */
84
+ export declare function isUnitSystemDifference(difference: AnySchemaDifference): difference is UnitSystemDifference;
85
+ /**
86
+ * Indicates whether the given difference is type of RelationshipClassDifference.
87
+ * @alpha
88
+ */
89
+ export declare function isRelationshipClassDifference(difference: AnySchemaDifference): difference is RelationshipClassDifference;
90
+ /**
91
+ * Indicates whether the given difference is type of RelationshipConstraintDifference.
92
+ * @alpha
93
+ */
94
+ export declare function isRelationshipConstraintDifference(difference: AnySchemaDifference): difference is RelationshipConstraintDifference;
95
+ /**
96
+ * Indicates whether the given difference is type of RelationshipConstraintClassDifference.
97
+ * @alpha
98
+ */
99
+ export declare function isRelationshipConstraintClassDifference(difference: AnySchemaDifference): difference is RelationshipConstraintClassDifference;
100
+ //# sourceMappingURL=Utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/Differencing/Utils.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB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