@itwin/ecschema-editing 4.9.0-dev.9 → 4.10.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -1
- package/lib/cjs/Differencing/SchemaConflicts.d.ts +3 -2
- package/lib/cjs/Differencing/SchemaConflicts.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaConflicts.js +3 -0
- package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts +0 -8
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +18 -151
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDifference.js +3 -1
- package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifferenceValidator.d.ts +17 -0
- package/lib/cjs/Differencing/SchemaDifferenceValidator.d.ts.map +1 -0
- package/lib/cjs/Differencing/SchemaDifferenceValidator.js +450 -0
- package/lib/cjs/Differencing/SchemaDifferenceValidator.js.map +1 -0
- package/lib/cjs/Differencing/SchemaDifferenceVisitor.d.ts +29 -0
- package/lib/cjs/Differencing/SchemaDifferenceVisitor.d.ts.map +1 -0
- package/lib/cjs/Differencing/SchemaDifferenceVisitor.js +82 -0
- package/lib/cjs/Differencing/SchemaDifferenceVisitor.js.map +1 -0
- package/lib/cjs/Editing/Editor.d.ts +6 -0
- package/lib/cjs/Editing/Editor.d.ts.map +1 -1
- package/lib/cjs/Editing/Editor.js +26 -0
- package/lib/cjs/Editing/Editor.js.map +1 -1
- package/lib/cjs/Editing/Exception.d.ts +62 -58
- package/lib/cjs/Editing/Exception.d.ts.map +1 -1
- package/lib/cjs/Editing/Exception.js +65 -58
- package/lib/cjs/Editing/Exception.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableProperty.d.ts +2 -1
- package/lib/cjs/Editing/Mutable/MutableProperty.d.ts.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableSchema.d.ts +1 -0
- package/lib/cjs/Editing/Mutable/MutableSchema.d.ts.map +1 -1
- package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
- package/lib/cjs/Editing/Properties.d.ts +7 -0
- package/lib/cjs/Editing/Properties.d.ts.map +1 -1
- package/lib/cjs/Editing/Properties.js +17 -0
- package/lib/cjs/Editing/Properties.js.map +1 -1
- package/lib/cjs/Merging/Edits/RenameEditHandler.d.ts.map +1 -1
- package/lib/cjs/Merging/Edits/RenameEditHandler.js +27 -45
- package/lib/cjs/Merging/Edits/RenameEditHandler.js.map +1 -1
- package/lib/cjs/Merging/Edits/SchemaEdits.d.ts +4 -4
- package/lib/cjs/Merging/Edits/SchemaEdits.d.ts.map +1 -1
- package/lib/cjs/Merging/Edits/SchemaEdits.js +8 -8
- package/lib/cjs/Merging/Edits/SchemaEdits.js.map +1 -1
- package/lib/cjs/Merging/Edits/SkipEditHandler.d.ts.map +1 -1
- package/lib/cjs/Merging/Edits/SkipEditHandler.js +4 -1
- package/lib/cjs/Merging/Edits/SkipEditHandler.js.map +1 -1
- package/package.json +10 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
# Change Log - @itwin/ecschema-editing
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 13 Sep 2024 15:12:41 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 4.8.7
|
|
6
|
+
Fri, 13 Sep 2024 15:11:17 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 4.8.6
|
|
11
|
+
Fri, 06 Sep 2024 05:06:49 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
14
|
+
|
|
15
|
+
## 4.8.5
|
|
16
|
+
Wed, 28 Aug 2024 17:27:23 GMT
|
|
17
|
+
|
|
18
|
+
### Updates
|
|
19
|
+
|
|
20
|
+
- Added support for editing a Properties KindOfQuantity.
|
|
21
|
+
|
|
22
|
+
## 4.8.4
|
|
23
|
+
Thu, 22 Aug 2024 17:37:06 GMT
|
|
24
|
+
|
|
25
|
+
_Version update only_
|
|
26
|
+
|
|
27
|
+
## 4.8.3
|
|
28
|
+
Fri, 16 Aug 2024 18:18:14 GMT
|
|
29
|
+
|
|
30
|
+
_Version update only_
|
|
4
31
|
|
|
5
32
|
## 4.8.2
|
|
6
33
|
Thu, 15 Aug 2024 15:33:49 GMT
|
|
@@ -38,10 +38,13 @@ export declare enum ConflictCode {
|
|
|
38
38
|
ConflictingBaseClass = "C-100",
|
|
39
39
|
RemovingBaseClass = "C-101",
|
|
40
40
|
SealedBaseClass = "C-102",
|
|
41
|
+
ConflictingClassModifier = "C-103",
|
|
41
42
|
ConflictingEnumerationType = "C-700",
|
|
42
43
|
ConflictingEnumeratorValue = "C-701",
|
|
44
|
+
ConflictingPersistenceUnit = "C-1010",
|
|
43
45
|
MixinAppliedMustDeriveFromConstraint = "C-1100",
|
|
44
46
|
ConflictingPropertyName = "C-1300",
|
|
47
|
+
ConflictingPropertyKindOfQuantity = "C-1301",
|
|
45
48
|
AbstractConstraintMustNarrowBaseConstraints = "C-1500",
|
|
46
49
|
DerivedConstraintsMustNarrowBaseConstraints = "C-1501",
|
|
47
50
|
ConstraintClassesDeriveFromAbstractConstraint = "C-1502"
|
|
@@ -72,7 +75,5 @@ export interface SchemaDifferenceConflict {
|
|
|
72
75
|
readonly source: unknown;
|
|
73
76
|
/** The value in the target schema. */
|
|
74
77
|
readonly target: unknown;
|
|
75
|
-
/** The conflicting difference */
|
|
76
|
-
readonly difference?: unknown;
|
|
77
78
|
}
|
|
78
79
|
//# sourceMappingURL=SchemaConflicts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaConflicts.d.ts","sourceRoot":"","sources":["../../../src/Differencing/SchemaConflicts.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,oBAAY,YAAY;IAEtB,mBAAmB,UAAU;IAC7B,yBAAyB,UAAU;IAEnC,oBAAoB,UAAU;IAC9B,iBAAiB,UAAU;IAC3B,eAAe,UAAU;
|
|
1
|
+
{"version":3,"file":"SchemaConflicts.d.ts","sourceRoot":"","sources":["../../../src/Differencing/SchemaConflicts.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,oBAAY,YAAY;IAEtB,mBAAmB,UAAU;IAC7B,yBAAyB,UAAU;IAEnC,oBAAoB,UAAU;IAC9B,iBAAiB,UAAU;IAC3B,eAAe,UAAU;IACzB,wBAAwB,UAAU;IAElC,0BAA0B,UAAU;IACpC,0BAA0B,UAAU;IAEpC,0BAA0B,WAAW;IACrC,oCAAoC,WAAW;IAE/C,uBAAuB,WAAW;IAClC,iCAAiC,WAAW;IAE5C,2CAA2C,WAAW;IACtD,2CAA2C,WAAW;IACtD,6CAA6C,WAAW;CACzD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAEhC,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE3B,sDAAsD;IACtD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB,mCAAmC;IACnC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAE5B,qCAAqC;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,sCAAsC;IACtC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEzB,sCAAsC;IACtC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B"}
|
|
@@ -45,10 +45,13 @@ var ConflictCode;
|
|
|
45
45
|
ConflictCode["ConflictingBaseClass"] = "C-100";
|
|
46
46
|
ConflictCode["RemovingBaseClass"] = "C-101";
|
|
47
47
|
ConflictCode["SealedBaseClass"] = "C-102";
|
|
48
|
+
ConflictCode["ConflictingClassModifier"] = "C-103";
|
|
48
49
|
ConflictCode["ConflictingEnumerationType"] = "C-700";
|
|
49
50
|
ConflictCode["ConflictingEnumeratorValue"] = "C-701";
|
|
51
|
+
ConflictCode["ConflictingPersistenceUnit"] = "C-1010";
|
|
50
52
|
ConflictCode["MixinAppliedMustDeriveFromConstraint"] = "C-1100";
|
|
51
53
|
ConflictCode["ConflictingPropertyName"] = "C-1300";
|
|
54
|
+
ConflictCode["ConflictingPropertyKindOfQuantity"] = "C-1301";
|
|
52
55
|
ConflictCode["AbstractConstraintMustNarrowBaseConstraints"] = "C-1500";
|
|
53
56
|
ConflictCode["DerivedConstraintsMustNarrowBaseConstraints"] = "C-1501";
|
|
54
57
|
ConflictCode["ConstraintClassesDeriveFromAbstractConstraint"] = "C-1502";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaConflicts.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaConflicts.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,IAAY,
|
|
1
|
+
{"version":3,"file":"SchemaConflicts.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaConflicts.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,IAAY,YAsBX;AAtBD,WAAY,YAAY;IAEtB,6CAA6B,CAAA;IAC7B,mDAAmC,CAAA;IAEnC,8CAA8B,CAAA;IAC9B,2CAA2B,CAAA;IAC3B,yCAAyB,CAAA;IACzB,kDAAkC,CAAA;IAElC,oDAAoC,CAAA;IACpC,oDAAoC,CAAA;IAEpC,qDAAqC,CAAA;IACrC,+DAA+C,CAAA;IAE/C,kDAAkC,CAAA;IAClC,4DAA4C,CAAA;IAE5C,sEAAsD,CAAA;IACtD,sEAAsD,CAAA;IACtD,wEAAwD,CAAA;AAC1D,CAAC,EAtBW,YAAY,4BAAZ,YAAY,QAsBvB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Differencing\r\n */\r\n\r\nimport type { SchemaType } from \"./SchemaDifference\";\r\n\r\n/**\r\n * The unique conflicts codes for Schema differencing.\r\n *\r\n * To provide meaning to code values, with anticipation\r\n * of future rules for all current EC Types, the following\r\n * value ranges should be used:\r\n *\r\n * - Schema: 000-099\r\n * - Class: 100-199\r\n * - Constant: 200-299\r\n * - CustomAttribute 300-399\r\n * - CustomAttributeClass: 400-499\r\n * - CustomAttributeContainer: 500-599\r\n * - EntityClass: 600-699\r\n * - Enumeration: 700-799\r\n * - Format: 800-899\r\n * - InvertedUnit: 900-999\r\n * - KindOfQuantity: 1000-1099\r\n * - Mixin: 1100-1199\r\n * - Phenomenon: 1200-1299\r\n * - Property: 1300-1399\r\n * - PropertyCategory: 1400-1499\r\n * - RelationshipClass: 1500-1599\r\n * - RelationshipConstraint: 1600-1699\r\n * - StructClass: 1700-1799\r\n * - Unit: 1800-1899\r\n * - UnitSystem: 1900-1999\r\n *\r\n * @alpha\r\n */\r\nexport enum ConflictCode {\r\n\r\n ConflictingItemName = \"C-001\",\r\n ConflictingReferenceAlias = \"C-002\",\r\n\r\n ConflictingBaseClass = \"C-100\",\r\n RemovingBaseClass = \"C-101\",\r\n SealedBaseClass = \"C-102\",\r\n ConflictingClassModifier = \"C-103\",\r\n\r\n ConflictingEnumerationType = \"C-700\",\r\n ConflictingEnumeratorValue = \"C-701\",\r\n\r\n ConflictingPersistenceUnit = \"C-1010\",\r\n MixinAppliedMustDeriveFromConstraint = \"C-1100\",\r\n\r\n ConflictingPropertyName = \"C-1300\",\r\n ConflictingPropertyKindOfQuantity = \"C-1301\",\r\n\r\n AbstractConstraintMustNarrowBaseConstraints = \"C-1500\",\r\n DerivedConstraintsMustNarrowBaseConstraints = \"C-1501\",\r\n ConstraintClassesDeriveFromAbstractConstraint = \"C-1502\",\r\n}\r\n\r\n/**\r\n * Defines the interface for a conflict during Schema Differencing. Conflicts were discovered\r\n * while comparing the changed elements. Conflicts in the whole schema context are not found\r\n * on that level.\r\n *\r\n * @alpha\r\n */\r\nexport interface SchemaDifferenceConflict {\r\n /**\r\n * The name of the schema type which is \"Schema\" for a conflict on the schema, on schema items\r\n * or objects that are related to schema items (properties, relationship constraints) it is the\r\n * name of the related schema item.\r\n */\r\n readonly schemaType: SchemaType;\r\n\r\n /** The name of the schema item the conflict appears on. */\r\n readonly itemName?: string;\r\n\r\n /** Optional path what on the item was conflicting. */\r\n readonly path?: string;\r\n\r\n /** The unique conflicting code. */\r\n readonly code: ConflictCode;\r\n\r\n /** A description of the conflict. */\r\n readonly description: string;\r\n\r\n /** The value in the source schema. */\r\n readonly source: unknown;\r\n\r\n /** The value in the target schema. */\r\n readonly target: unknown;\r\n}\r\n"]}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { AnyDiagnostic } from "../Validation/Diagnostic";
|
|
5
5
|
import { type AnySchemaItemDifference, type AnySchemaItemPathDifference, type CustomAttributeDifference, type SchemaDifference, type SchemaReferenceDifference } from "./SchemaDifference";
|
|
6
|
-
import { SchemaDifferenceConflict } from "./SchemaConflicts";
|
|
7
6
|
/**
|
|
8
7
|
* The SchemaDiagnosticVisitor is a visitor implementation for diagnostic entries
|
|
9
8
|
* from the schema comparer api. Depending on the diagnostic code, the difference
|
|
@@ -15,9 +14,7 @@ export declare class SchemaDiagnosticVisitor {
|
|
|
15
14
|
readonly schemaItemDifferences: Array<AnySchemaItemDifference>;
|
|
16
15
|
readonly schemaItemPathDifferences: Array<AnySchemaItemPathDifference>;
|
|
17
16
|
readonly customAttributeDifferences: Array<CustomAttributeDifference>;
|
|
18
|
-
readonly conflicts: Array<SchemaDifferenceConflict>;
|
|
19
17
|
constructor();
|
|
20
|
-
private addConflict;
|
|
21
18
|
/**
|
|
22
19
|
* Visitor function to process the schema change diagnostic object.
|
|
23
20
|
* @internal
|
|
@@ -29,16 +26,11 @@ export declare class SchemaDiagnosticVisitor {
|
|
|
29
26
|
private visitChangedEnumeration;
|
|
30
27
|
private visitMissingEnumerator;
|
|
31
28
|
private lookupEnumeratorEntry;
|
|
32
|
-
private lookupConflictEntry;
|
|
33
29
|
private visitChangedEnumerator;
|
|
34
|
-
private validateEnumerator;
|
|
35
30
|
private visitMissingProperty;
|
|
36
31
|
private visitChangedProperty;
|
|
37
|
-
private validatePropertyChange;
|
|
38
32
|
private visitMissingBaseClass;
|
|
39
|
-
private validateBaseClassChange;
|
|
40
33
|
private visitMissingMixinOnClass;
|
|
41
|
-
private validateMixin;
|
|
42
34
|
private visitMissingRelationshipConstraintClass;
|
|
43
35
|
private visitChangedRelationshipConstraint;
|
|
44
36
|
private visitSchemaReference;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaDiagnosticVisitor.d.ts","sourceRoot":"","sources":["../../../src/Differencing/SchemaDiagnosticVisitor.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAO9D,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAGhC,KAAK,yBAAyB,EAM9B,KAAK,gBAAgB,EAErB,KAAK,yBAAyB,
|
|
1
|
+
{"version":3,"file":"SchemaDiagnosticVisitor.d.ts","sourceRoot":"","sources":["../../../src/Differencing/SchemaDiagnosticVisitor.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAO9D,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAGhC,KAAK,yBAAyB,EAM9B,KAAK,gBAAgB,EAErB,KAAK,yBAAyB,EAC/B,MAAM,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,qBAAa,uBAAuB;IAElC,SAAgB,iBAAiB,EAAE,KAAK,CAAC,gBAAgB,GAAG,yBAAyB,CAAC,CAAC;IACvF,SAAgB,qBAAqB,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACtE,SAAgB,yBAAyB,EAAE,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC9E,SAAgB,0BAA0B,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAC;;IAS7E;;;OAGG;IACI,KAAK,CAAC,UAAU,EAAE,aAAa;IA6DtC,OAAO,CAAC,4BAA4B;IAiCpC,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,sBAAsB;IAkC9B,OAAO,CAAC,uBAAuB;IAS/B,OAAO,CAAC,sBAAsB;IAY9B,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,sBAAsB;IA2B9B,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,oBAAoB;IA4B5B,OAAO,CAAC,qBAAqB;IAqB7B,OAAO,CAAC,wBAAwB;IAoBhC,OAAO,CAAC,uCAAuC;IAwB/C,OAAO,CAAC,kCAAkC;IAsC1C,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,mCAAmC;CA6C5C"}
|
|
@@ -11,20 +11,6 @@ exports.SchemaDiagnosticVisitor = void 0;
|
|
|
11
11
|
const SchemaCompareDiagnostics_1 = require("../Validation/SchemaCompareDiagnostics");
|
|
12
12
|
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
13
13
|
const SchemaDifference_1 = require("./SchemaDifference");
|
|
14
|
-
const SchemaConflicts_1 = require("./SchemaConflicts");
|
|
15
|
-
/**
|
|
16
|
-
* Recursive synchronous function to figure whether a given class derived from
|
|
17
|
-
* a class with the given baseClassName.
|
|
18
|
-
*/
|
|
19
|
-
function derivedFrom(ecClass, baseClassName) {
|
|
20
|
-
if (ecClass === undefined) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
if (ecClass && ecClass.name === baseClassName) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
return derivedFrom(ecClass.getBaseClassSync(), baseClassName);
|
|
27
|
-
}
|
|
28
14
|
/**
|
|
29
15
|
* The SchemaDiagnosticVisitor is a visitor implementation for diagnostic entries
|
|
30
16
|
* from the schema comparer api. Depending on the diagnostic code, the difference
|
|
@@ -37,10 +23,6 @@ class SchemaDiagnosticVisitor {
|
|
|
37
23
|
this.schemaItemDifferences = [];
|
|
38
24
|
this.schemaItemPathDifferences = [];
|
|
39
25
|
this.customAttributeDifferences = [];
|
|
40
|
-
this.conflicts = [];
|
|
41
|
-
}
|
|
42
|
-
addConflict(conflict) {
|
|
43
|
-
this.conflicts.push(conflict);
|
|
44
26
|
}
|
|
45
27
|
/**
|
|
46
28
|
* Visitor function to process the schema change diagnostic object.
|
|
@@ -137,17 +119,12 @@ class SchemaDiagnosticVisitor {
|
|
|
137
119
|
}
|
|
138
120
|
visitChangedSchemaItem(diagnostic) {
|
|
139
121
|
const schemaItem = diagnostic.ecDefinition;
|
|
140
|
-
const [propertyName, sourceValue,
|
|
122
|
+
const [propertyName, sourceValue, _targetValue] = diagnostic.messageArgs;
|
|
141
123
|
if (propertyName === "schemaItemType") {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
source: sourceValue,
|
|
147
|
-
target: targetValue,
|
|
148
|
-
description: "Target schema already contains a schema item with the name but different type.",
|
|
149
|
-
difference: schemaItem.toJSON(),
|
|
150
|
-
});
|
|
124
|
+
// If the schema item type is different, the whole item is added as "new" item. The
|
|
125
|
+
// difference validator will then figure whether there is a conflict with items of
|
|
126
|
+
// of the same name.
|
|
127
|
+
return this.visitMissingSchemaItem(diagnostic);
|
|
151
128
|
}
|
|
152
129
|
if (sourceValue === undefined) {
|
|
153
130
|
return;
|
|
@@ -174,17 +151,6 @@ class SchemaDiagnosticVisitor {
|
|
|
174
151
|
if (this.schemaItemPathDifferences.find((entry) => entry.changeType === "add" && entry.itemName === enumeration.name)) {
|
|
175
152
|
return;
|
|
176
153
|
}
|
|
177
|
-
const [propertyName, sourceValue, targetValue] = diagnostic.messageArgs;
|
|
178
|
-
if (propertyName === "type") {
|
|
179
|
-
return this.addConflict({
|
|
180
|
-
code: SchemaConflicts_1.ConflictCode.ConflictingEnumerationType,
|
|
181
|
-
schemaType: ecschema_metadata_1.SchemaItemType.Enumeration,
|
|
182
|
-
itemName: enumeration.name,
|
|
183
|
-
source: sourceValue,
|
|
184
|
-
target: targetValue,
|
|
185
|
-
description: "Enumeration has a different primitive type.",
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
154
|
return this.visitChangedSchemaItem(diagnostic);
|
|
189
155
|
}
|
|
190
156
|
visitMissingEnumerator(diagnostic) {
|
|
@@ -207,23 +173,12 @@ class SchemaDiagnosticVisitor {
|
|
|
207
173
|
&& change.difference.name === enumeratorName;
|
|
208
174
|
});
|
|
209
175
|
}
|
|
210
|
-
lookupConflictEntry(code, schemaType, itemName, path) {
|
|
211
|
-
return this.conflicts.find((change) => {
|
|
212
|
-
return change.code === code
|
|
213
|
-
&& change.schemaType === schemaType
|
|
214
|
-
&& change.itemName === itemName
|
|
215
|
-
&& change.path === path;
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
176
|
visitChangedEnumerator(diagnostic) {
|
|
219
177
|
const enumeration = diagnostic.ecDefinition;
|
|
220
|
-
const [enumerator, propertyName, sourceValue
|
|
178
|
+
const [enumerator, propertyName, sourceValue] = diagnostic.messageArgs;
|
|
221
179
|
if (this.lookupEnumeratorEntry("add", enumeration.name, enumerator.name)) {
|
|
222
180
|
return;
|
|
223
181
|
}
|
|
224
|
-
if (!this.validateEnumerator(enumeration, enumerator, propertyName, sourceValue, targetValue)) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
182
|
let modifyEntry = this.schemaItemPathDifferences.find((entry) => {
|
|
228
183
|
return entry.changeType === "modify" && entry.schemaType === SchemaDifference_1.SchemaOtherTypes.Enumerator && entry.itemName === enumeration.name && entry.path === enumerator.name;
|
|
229
184
|
});
|
|
@@ -241,21 +196,6 @@ class SchemaDiagnosticVisitor {
|
|
|
241
196
|
modifyEntry.difference[propertyName] = sourceValue;
|
|
242
197
|
}
|
|
243
198
|
}
|
|
244
|
-
validateEnumerator(enumeration, enumerator, propertyName, sourceValue, targetValue) {
|
|
245
|
-
if (propertyName === "value") {
|
|
246
|
-
this.addConflict({
|
|
247
|
-
code: SchemaConflicts_1.ConflictCode.ConflictingEnumeratorValue,
|
|
248
|
-
schemaType: ecschema_metadata_1.SchemaItemType.Enumeration,
|
|
249
|
-
itemName: enumeration.name,
|
|
250
|
-
path: enumerator.name,
|
|
251
|
-
source: sourceValue,
|
|
252
|
-
target: targetValue,
|
|
253
|
-
description: "Enumerator values must not differ.",
|
|
254
|
-
});
|
|
255
|
-
return false;
|
|
256
|
-
}
|
|
257
|
-
return true;
|
|
258
|
-
}
|
|
259
199
|
visitMissingProperty(diagnostic) {
|
|
260
200
|
const property = diagnostic.ecDefinition;
|
|
261
201
|
this.schemaItemPathDifferences.push({
|
|
@@ -268,9 +208,9 @@ class SchemaDiagnosticVisitor {
|
|
|
268
208
|
}
|
|
269
209
|
visitChangedProperty(diagnostic) {
|
|
270
210
|
const property = diagnostic.ecDefinition;
|
|
271
|
-
const [propertyName, sourceValue
|
|
272
|
-
if (
|
|
273
|
-
return;
|
|
211
|
+
const [propertyName, sourceValue] = diagnostic.messageArgs;
|
|
212
|
+
if (isPropertyTypeName(property, propertyName)) {
|
|
213
|
+
return this.visitMissingProperty(diagnostic);
|
|
274
214
|
}
|
|
275
215
|
let modifyEntry = this.schemaItemPathDifferences.find((entry) => {
|
|
276
216
|
return entry.changeType === "modify" && entry.schemaType === SchemaDifference_1.SchemaOtherTypes.Property && entry.itemName === property.class.name && entry.path === property.name;
|
|
@@ -289,32 +229,9 @@ class SchemaDiagnosticVisitor {
|
|
|
289
229
|
modifyEntry.difference[propertyName] = sourceValue;
|
|
290
230
|
}
|
|
291
231
|
}
|
|
292
|
-
validatePropertyChange(ecProperty, propertyName, sourceValue, targetValue) {
|
|
293
|
-
if (propertyName === "type"
|
|
294
|
-
|| propertyName === "primitiveType"
|
|
295
|
-
|| (propertyName === "enumeration" && (sourceValue === undefined || targetValue === undefined))) {
|
|
296
|
-
if (!this.lookupConflictEntry(SchemaConflicts_1.ConflictCode.ConflictingPropertyName, ecProperty.class.schemaItemType, ecProperty.class.name, ecProperty.name)) {
|
|
297
|
-
this.addConflict({
|
|
298
|
-
code: SchemaConflicts_1.ConflictCode.ConflictingPropertyName,
|
|
299
|
-
schemaType: ecProperty.class.schemaItemType,
|
|
300
|
-
itemName: ecProperty.class.name,
|
|
301
|
-
path: ecProperty.name,
|
|
302
|
-
source: sourceValue,
|
|
303
|
-
target: targetValue,
|
|
304
|
-
description: "Target class already contains a property with a different type.",
|
|
305
|
-
difference: ecProperty.toJSON(),
|
|
306
|
-
});
|
|
307
|
-
return false;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
return true;
|
|
311
|
-
}
|
|
312
232
|
visitMissingBaseClass(diagnostic) {
|
|
313
233
|
const ecClass = diagnostic.ecDefinition;
|
|
314
|
-
const [sourceBaseClass
|
|
315
|
-
if (!this.validateBaseClassChange(ecClass, sourceBaseClass, targetBaseClass)) {
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
234
|
+
const [sourceBaseClass] = diagnostic.messageArgs;
|
|
318
235
|
let modifyEntry = this.schemaItemDifferences.find((entry) => {
|
|
319
236
|
return entry.changeType === "modify" && entry.schemaType === ecClass.schemaItemType && entry.itemName === ecClass.name;
|
|
320
237
|
});
|
|
@@ -327,53 +244,11 @@ class SchemaDiagnosticVisitor {
|
|
|
327
244
|
};
|
|
328
245
|
this.schemaItemDifferences.push(modifyEntry);
|
|
329
246
|
}
|
|
330
|
-
modifyEntry.difference.baseClass = sourceBaseClass.fullName;
|
|
331
|
-
}
|
|
332
|
-
validateBaseClassChange(targetClass, sourceBaseClass, targetBaseClass) {
|
|
333
|
-
if (sourceBaseClass === undefined) {
|
|
334
|
-
this.addConflict({
|
|
335
|
-
code: SchemaConflicts_1.ConflictCode.RemovingBaseClass,
|
|
336
|
-
schemaType: targetClass.schemaItemType,
|
|
337
|
-
itemName: targetClass.name,
|
|
338
|
-
path: "$baseClass",
|
|
339
|
-
source: undefined,
|
|
340
|
-
target: targetBaseClass?.fullName,
|
|
341
|
-
description: "BaseClass cannot be set unset if there has been a baseClass before.",
|
|
342
|
-
});
|
|
343
|
-
return false;
|
|
344
|
-
}
|
|
345
|
-
if (sourceBaseClass.modifier === ecschema_metadata_1.ECClassModifier.Sealed) {
|
|
346
|
-
this.addConflict({
|
|
347
|
-
code: SchemaConflicts_1.ConflictCode.SealedBaseClass,
|
|
348
|
-
schemaType: targetClass.schemaItemType,
|
|
349
|
-
itemName: targetClass.name,
|
|
350
|
-
path: "$baseClass",
|
|
351
|
-
source: sourceBaseClass.fullName,
|
|
352
|
-
target: targetBaseClass?.fullName,
|
|
353
|
-
description: "BaseClass is sealed.",
|
|
354
|
-
});
|
|
355
|
-
return false;
|
|
356
|
-
}
|
|
357
|
-
if (targetBaseClass && !derivedFrom(sourceBaseClass, targetBaseClass.name)) {
|
|
358
|
-
this.addConflict({
|
|
359
|
-
code: SchemaConflicts_1.ConflictCode.ConflictingBaseClass,
|
|
360
|
-
schemaType: targetClass.schemaItemType,
|
|
361
|
-
itemName: targetClass.name,
|
|
362
|
-
path: "$baseClass",
|
|
363
|
-
source: sourceBaseClass.fullName,
|
|
364
|
-
target: targetBaseClass.fullName,
|
|
365
|
-
description: "BaseClass is not valid, source class must derive from target.",
|
|
366
|
-
});
|
|
367
|
-
return false;
|
|
368
|
-
}
|
|
369
|
-
return true;
|
|
247
|
+
modifyEntry.difference.baseClass = sourceBaseClass !== undefined ? sourceBaseClass.fullName : undefined;
|
|
370
248
|
}
|
|
371
249
|
visitMissingMixinOnClass(diagnostic) {
|
|
372
250
|
const ecClass = diagnostic.ecDefinition;
|
|
373
251
|
const [mixin] = diagnostic.messageArgs;
|
|
374
|
-
if (!this.validateMixin(ecClass, mixin)) {
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
252
|
let modifyEntry = this.schemaItemDifferences.find((entry) => {
|
|
378
253
|
return entry.changeType === "add" && entry.schemaType === SchemaDifference_1.SchemaOtherTypes.EntityClassMixin && entry.itemName === ecClass.name;
|
|
379
254
|
});
|
|
@@ -388,21 +263,6 @@ class SchemaDiagnosticVisitor {
|
|
|
388
263
|
}
|
|
389
264
|
modifyEntry.difference.push(mixin.fullName);
|
|
390
265
|
}
|
|
391
|
-
validateMixin(targetClass, mixin) {
|
|
392
|
-
if (mixin.appliesTo && !derivedFrom(targetClass, mixin.appliesTo.name)) {
|
|
393
|
-
this.addConflict({
|
|
394
|
-
code: SchemaConflicts_1.ConflictCode.MixinAppliedMustDeriveFromConstraint,
|
|
395
|
-
schemaType: targetClass.schemaItemType,
|
|
396
|
-
itemName: targetClass.name,
|
|
397
|
-
path: "$mixins",
|
|
398
|
-
source: mixin.fullName,
|
|
399
|
-
target: undefined,
|
|
400
|
-
description: "Mixin cannot applied to this class.",
|
|
401
|
-
});
|
|
402
|
-
return false;
|
|
403
|
-
}
|
|
404
|
-
return true;
|
|
405
|
-
}
|
|
406
266
|
visitMissingRelationshipConstraintClass(diagnostic) {
|
|
407
267
|
const constraint = diagnostic.ecDefinition;
|
|
408
268
|
const className = constraint.relationshipClass.name;
|
|
@@ -512,4 +372,11 @@ class SchemaDiagnosticVisitor {
|
|
|
512
372
|
}
|
|
513
373
|
}
|
|
514
374
|
exports.SchemaDiagnosticVisitor = SchemaDiagnosticVisitor;
|
|
375
|
+
function isPropertyTypeName(property, propertyName) {
|
|
376
|
+
return (propertyName === "type") ||
|
|
377
|
+
(property.isEnumeration() && propertyName === "enumeration") ||
|
|
378
|
+
(property.isPrimitive() && propertyName === "primitiveType") ||
|
|
379
|
+
(property.isStruct() && propertyName === "structClass") ||
|
|
380
|
+
(property.isNavigation() && propertyName === "relationshipClass");
|
|
381
|
+
}
|
|
515
382
|
//# sourceMappingURL=SchemaDiagnosticVisitor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaDiagnosticVisitor.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDiagnosticVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,qFAA4E;AAC5E,gEAIkC;AAClC,yDAe4B;AAC5B,uDAA2E;AAE3E;;;GAGG;AACH,SAAS,WAAW,CAAC,OAA4B,EAAE,aAAqB;IACtE,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,WAAW,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,aAAa,CAAC,CAAC;AAChE,CAAC;AAED;;;;;GAKG;AACH,MAAa,uBAAuB;IAQlC;QACE,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,yBAAyB,GAAG,EAAE,CAAC;QACpC,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC;QACrC,IAAI,C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AAziBD,0DAyiBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Differencing\r\n */\r\n\r\nimport type { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { SchemaCompareCodes } from \"../Validation/SchemaCompareDiagnostics\";\r\nimport {\r\n AnyEnumerator, AnyPropertyProps, AnySchemaItem, CustomAttribute, ECClass, ECClassModifier,\r\n Enumeration, Mixin, Property, PropertyProps,\r\n RelationshipConstraint, RelationshipConstraintProps, Schema, SchemaItem, SchemaItemType,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport {\r\n type AnySchemaItemDifference,\r\n type AnySchemaItemPathDifference,\r\n ClassItemDifference,\r\n ClassPropertyDifference,\r\n type CustomAttributeDifference,\r\n type DifferenceType,\r\n EntityClassMixinDifference,\r\n EnumeratorDifference,\r\n RelationshipConstraintClassDifference,\r\n RelationshipConstraintDifference,\r\n type SchemaDifference,\r\n SchemaOtherTypes,\r\n type SchemaReferenceDifference,\r\n type SchemaType,\r\n} from \"./SchemaDifference\";\r\nimport { ConflictCode, SchemaDifferenceConflict } from \"./SchemaConflicts\";\r\n\r\n/**\r\n * Recursive synchronous function to figure whether a given class derived from\r\n * a class with the given baseClassName.\r\n */\r\nfunction derivedFrom(ecClass: ECClass | undefined, baseClassName: string): boolean {\r\n if (ecClass === undefined) {\r\n return false;\r\n }\r\n if (ecClass && ecClass.name === baseClassName) {\r\n return true;\r\n }\r\n return derivedFrom(ecClass.getBaseClassSync(), baseClassName);\r\n}\r\n\r\n/**\r\n * The SchemaDiagnosticVisitor is a visitor implementation for diagnostic entries\r\n * from the schema comparer api. Depending on the diagnostic code, the difference\r\n * result is build together.\r\n * @internal\r\n */\r\nexport class SchemaDiagnosticVisitor {\r\n\r\n public readonly schemaDifferences: Array<SchemaDifference | SchemaReferenceDifference>;\r\n public readonly schemaItemDifferences: Array<AnySchemaItemDifference>;\r\n public readonly schemaItemPathDifferences: Array<AnySchemaItemPathDifference>;\r\n public readonly customAttributeDifferences: Array<CustomAttributeDifference>;\r\n public readonly conflicts: Array<SchemaDifferenceConflict>;\r\n\r\n constructor() {\r\n this.schemaDifferences = [];\r\n this.schemaItemDifferences = [];\r\n this.schemaItemPathDifferences = [];\r\n this.customAttributeDifferences = [];\r\n this.conflicts = [];\r\n }\r\n\r\n private addConflict(conflict: SchemaDifferenceConflict) {\r\n this.conflicts.push(conflict);\r\n }\r\n\r\n /**\r\n * Visitor function to process the schema change diagnostic object.\r\n * @internal\r\n */\r\n public visit(diagnostic: AnyDiagnostic) {\r\n switch (diagnostic.code) {\r\n case SchemaCompareCodes.SchemaDelta:\r\n return this.visitChangedSchemaProperties(diagnostic);\r\n\r\n case SchemaCompareCodes.SchemaReferenceMissing:\r\n return this.visitSchemaReference(diagnostic, \"add\");\r\n case SchemaCompareCodes.SchemaReferenceDelta:\r\n return this.visitSchemaReference(diagnostic, \"modify\");\r\n\r\n case SchemaCompareCodes.SchemaItemMissing:\r\n return this.visitMissingSchemaItem(diagnostic);\r\n\r\n case SchemaCompareCodes.SchemaItemDelta:\r\n case SchemaCompareCodes.ClassDelta:\r\n case SchemaCompareCodes.ConstantDelta:\r\n case SchemaCompareCodes.CustomAttributeClassDelta:\r\n case SchemaCompareCodes.FormatDelta:\r\n case SchemaCompareCodes.InvertedUnitDelta:\r\n case SchemaCompareCodes.KoqDelta:\r\n case SchemaCompareCodes.MixinDelta:\r\n case SchemaCompareCodes.PhenomenonDelta:\r\n case SchemaCompareCodes.PropertyCategoryDelta:\r\n case SchemaCompareCodes.RelationshipDelta:\r\n case SchemaCompareCodes.UnitDelta:\r\n return this.visitChangedSchemaItem(diagnostic);\r\n\r\n case SchemaCompareCodes.EnumerationDelta:\r\n return this.visitChangedEnumeration(diagnostic);\r\n\r\n case SchemaCompareCodes.EnumeratorDelta:\r\n return this.visitChangedEnumerator(diagnostic);\r\n case SchemaCompareCodes.EnumeratorMissing:\r\n return this.visitMissingEnumerator(diagnostic);\r\n\r\n case SchemaCompareCodes.BaseClassDelta:\r\n return this.visitMissingBaseClass(diagnostic);\r\n case SchemaCompareCodes.EntityMixinMissing:\r\n return this.visitMissingMixinOnClass(diagnostic);\r\n case SchemaCompareCodes.PropertyDelta:\r\n return this.visitChangedProperty(diagnostic);\r\n case SchemaCompareCodes.PropertyMissing:\r\n return this.visitMissingProperty(diagnostic);\r\n\r\n case SchemaCompareCodes.RelationshipConstraintClassMissing:\r\n return this.visitMissingRelationshipConstraintClass(diagnostic);\r\n case SchemaCompareCodes.RelationshipConstraintDelta:\r\n return this.visitChangedRelationshipConstraint(diagnostic);\r\n\r\n case SchemaCompareCodes.CustomAttributeInstanceClassMissing:\r\n return this.visitMissingCustomAttributeInstance(diagnostic);\r\n\r\n // Currently not handled...\r\n case SchemaCompareCodes.FormatUnitMissing:\r\n case SchemaCompareCodes.PresentationUnitMissing:\r\n case SchemaCompareCodes.UnitLabelOverrideDelta:\r\n break;\r\n }\r\n return;\r\n }\r\n\r\n private visitChangedSchemaProperties(diagnostic: AnyDiagnostic) {\r\n let modifyEntry = this.schemaDifferences.find((entry): entry is SchemaDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Schema;\r\n });\r\n\r\n let hasChanges = false;\r\n let addEntry = false;\r\n if (modifyEntry === undefined) {\r\n addEntry = true;\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.Schema,\r\n difference: {},\r\n };\r\n }\r\n\r\n // Only label and description are taken from the source schema. If the schema name or alias\r\n // differs, those are ignored for now.\r\n const [propertyName, propertyValue] = diagnostic.messageArgs as [string, any];\r\n if (propertyName === \"label\") {\r\n modifyEntry.difference.label = propertyValue;\r\n hasChanges = true;\r\n }\r\n if (propertyName === \"description\") {\r\n modifyEntry.difference.description = propertyValue;\r\n hasChanges = true;\r\n }\r\n\r\n if (addEntry && hasChanges) {\r\n this.schemaDifferences.push(modifyEntry);\r\n }\r\n }\r\n\r\n private visitMissingSchemaItem(diagnostic: AnyDiagnostic) {\r\n const schemaItem = diagnostic.ecDefinition as AnySchemaItem;\r\n\r\n this.schemaItemDifferences.push({\r\n changeType: \"add\",\r\n schemaType: schemaItem.schemaItemType,\r\n itemName: schemaItem.name,\r\n difference: schemaItem.toJSON(),\r\n });\r\n }\r\n\r\n private visitChangedSchemaItem(diagnostic: AnyDiagnostic) {\r\n const schemaItem = diagnostic.ecDefinition as AnySchemaItem;\r\n const [propertyName, sourceValue, targetValue] = diagnostic.messageArgs as [string, unknown, unknown];\r\n if (propertyName === \"schemaItemType\") {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingItemName,\r\n schemaType: schemaItem.schemaItemType,\r\n itemName: schemaItem.name,\r\n source: sourceValue,\r\n target: targetValue,\r\n description: \"Target schema already contains a schema item with the name but different type.\",\r\n difference: schemaItem.toJSON(),\r\n });\r\n }\r\n\r\n if (sourceValue === undefined) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is AnySchemaItemDifference => {\r\n return entry.changeType === \"modify\" && entry.itemName === schemaItem.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: schemaItem.schemaItemType,\r\n itemName: schemaItem.name,\r\n difference: {},\r\n } as AnySchemaItemDifference;\r\n this.schemaItemDifferences.push(modifyEntry);\r\n }\r\n\r\n // TODO: Since propertyName is type of string, the compiler complains about accepting\r\n // an unspecific string as property indexer. Casted to any as short term fix but that\r\n // needs to be handled better in future.\r\n (modifyEntry.difference as any)[propertyName] = sourceValue;\r\n }\r\n\r\n private visitChangedEnumeration(diagnostic: AnyDiagnostic) {\r\n const enumeration = diagnostic.ecDefinition as Enumeration;\r\n if (this.schemaItemPathDifferences.find((entry) => entry.changeType === \"add\" && entry.itemName === enumeration.name)) {\r\n return;\r\n }\r\n\r\n const [propertyName, sourceValue, targetValue] = diagnostic.messageArgs as [string, string, string];\r\n if (propertyName === \"type\") {\r\n return this.addConflict({\r\n code: ConflictCode.ConflictingEnumerationType,\r\n schemaType: SchemaItemType.Enumeration,\r\n itemName: enumeration.name,\r\n source: sourceValue,\r\n target: targetValue,\r\n description: \"Enumeration has a different primitive type.\",\r\n });\r\n }\r\n\r\n return this.visitChangedSchemaItem(diagnostic);\r\n }\r\n\r\n private visitMissingEnumerator(diagnostic: AnyDiagnostic) {\r\n const enumeration = diagnostic.ecDefinition as Enumeration;\r\n const [enumerator] = diagnostic.messageArgs as [AnyEnumerator];\r\n this.schemaItemPathDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.Enumerator,\r\n itemName: enumeration.name,\r\n path: \"$enumerators\",\r\n difference: enumerator,\r\n });\r\n }\r\n\r\n private lookupEnumeratorEntry(changeType: DifferenceType, item: string, enumeratorName: string) {\r\n return this.schemaItemPathDifferences.find((change) => {\r\n return change.changeType === changeType\r\n && change.schemaType === SchemaOtherTypes.Enumerator\r\n && change.itemName === item\r\n && change.path === \"$enumerators\"\r\n && change.difference.name === enumeratorName;\r\n });\r\n }\r\n\r\n private lookupConflictEntry(code: ConflictCode, schemaType: SchemaType, itemName: string, path: string) {\r\n return this.conflicts.find((change) => {\r\n return change.code === code\r\n && change.schemaType === schemaType\r\n && change.itemName === itemName\r\n && change.path === path;\r\n });\r\n }\r\n\r\n private visitChangedEnumerator(diagnostic: AnyDiagnostic) {\r\n const enumeration = diagnostic.ecDefinition as Enumeration;\r\n const [enumerator, propertyName, sourceValue, targetValue] = diagnostic.messageArgs as [AnyEnumerator, keyof AnyEnumerator, any, any];\r\n if (this.lookupEnumeratorEntry(\"add\", enumeration.name, enumerator.name)) {\r\n return;\r\n }\r\n\r\n if (!this.validateEnumerator(enumeration, enumerator, propertyName, sourceValue, targetValue)) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is EnumeratorDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Enumerator && entry.itemName === enumeration.name && entry.path === enumerator.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.Enumerator,\r\n itemName: enumeration.name,\r\n path: enumerator.name,\r\n difference: {},\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n if (sourceValue !== undefined) {\r\n modifyEntry.difference[propertyName] = sourceValue;\r\n }\r\n }\r\n\r\n private validateEnumerator(enumeration: Enumeration, enumerator: AnyEnumerator, propertyName: string, sourceValue: unknown, targetValue: unknown) {\r\n if (propertyName === \"value\") {\r\n this.addConflict({\r\n code: ConflictCode.ConflictingEnumeratorValue,\r\n schemaType: SchemaItemType.Enumeration,\r\n itemName: enumeration.name,\r\n path: enumerator.name,\r\n source: sourceValue,\r\n target: targetValue,\r\n description: \"Enumerator values must not differ.\",\r\n });\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private visitMissingProperty(diagnostic: AnyDiagnostic) {\r\n const property = diagnostic.ecDefinition as Property;\r\n this.schemaItemPathDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.Property,\r\n itemName: property.class.name,\r\n path: property.name,\r\n difference: property.toJSON() as AnyPropertyProps,\r\n });\r\n }\r\n\r\n private visitChangedProperty(diagnostic: AnyDiagnostic) {\r\n const property = diagnostic.ecDefinition as Property;\r\n const [propertyName, sourceValue, targetValue] = diagnostic.messageArgs as [keyof PropertyProps, any, any];\r\n if (!this.validatePropertyChange(property, propertyName, sourceValue, targetValue)) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is ClassPropertyDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Property && entry.itemName === property.class.name && entry.path === property.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.Property,\r\n itemName: property.class.name,\r\n path: property.name,\r\n difference: {},\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n if (propertyName !== \"name\" && sourceValue !== undefined) {\r\n modifyEntry.difference[propertyName] = sourceValue;\r\n }\r\n }\r\n\r\n private validatePropertyChange(ecProperty: Property, propertyName: string, sourceValue: unknown, targetValue: unknown): boolean {\r\n if (propertyName === \"type\"\r\n || propertyName === \"primitiveType\"\r\n || (propertyName === \"enumeration\" && (sourceValue === undefined || targetValue === undefined))) {\r\n if (!this.lookupConflictEntry(ConflictCode.ConflictingPropertyName, ecProperty.class.schemaItemType,\r\n ecProperty.class.name, ecProperty.name)) {\r\n this.addConflict({\r\n code: ConflictCode.ConflictingPropertyName,\r\n schemaType: ecProperty.class.schemaItemType,\r\n itemName: ecProperty.class.name,\r\n path: ecProperty.name,\r\n source: sourceValue,\r\n target: targetValue,\r\n description: \"Target class already contains a property with a different type.\",\r\n difference: ecProperty.toJSON(),\r\n });\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n private visitMissingBaseClass(diagnostic: AnyDiagnostic) {\r\n const ecClass = diagnostic.ecDefinition as ECClass;\r\n const [sourceBaseClass, targetBaseClass] = diagnostic.messageArgs as [ECClass, ECClass];\r\n if (!this.validateBaseClassChange(ecClass, sourceBaseClass, targetBaseClass)) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is ClassItemDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === ecClass.schemaItemType && entry.itemName === ecClass.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: ecClass.schemaItemType,\r\n itemName: ecClass.name,\r\n difference: {},\r\n } as ClassItemDifference;\r\n this.schemaItemDifferences.push(modifyEntry);\r\n }\r\n\r\n modifyEntry.difference.baseClass = sourceBaseClass.fullName;\r\n }\r\n\r\n private validateBaseClassChange(targetClass: ECClass, sourceBaseClass?: ECClass, targetBaseClass?: ECClass): boolean {\r\n if (sourceBaseClass === undefined) {\r\n this.addConflict({\r\n code: ConflictCode.RemovingBaseClass,\r\n schemaType: targetClass.schemaItemType,\r\n itemName: targetClass.name,\r\n path: \"$baseClass\",\r\n source: undefined,\r\n target: targetBaseClass?.fullName,\r\n description: \"BaseClass cannot be set unset if there has been a baseClass before.\",\r\n });\r\n return false;\r\n }\r\n\r\n if (sourceBaseClass.modifier === ECClassModifier.Sealed) {\r\n this.addConflict({\r\n code: ConflictCode.SealedBaseClass,\r\n schemaType: targetClass.schemaItemType,\r\n itemName: targetClass.name,\r\n path: \"$baseClass\",\r\n source: sourceBaseClass.fullName,\r\n target: targetBaseClass?.fullName,\r\n description: \"BaseClass is sealed.\",\r\n });\r\n return false;\r\n }\r\n\r\n if (targetBaseClass && !derivedFrom(sourceBaseClass, targetBaseClass.name)) {\r\n this.addConflict({\r\n code: ConflictCode.ConflictingBaseClass,\r\n schemaType: targetClass.schemaItemType,\r\n itemName: targetClass.name,\r\n path: \"$baseClass\",\r\n source: sourceBaseClass.fullName,\r\n target: targetBaseClass.fullName,\r\n description: \"BaseClass is not valid, source class must derive from target.\",\r\n });\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n private visitMissingMixinOnClass(diagnostic: AnyDiagnostic) {\r\n const ecClass = diagnostic.ecDefinition as ECClass;\r\n const [mixin] = diagnostic.messageArgs as [Mixin];\r\n if (!this.validateMixin(ecClass, mixin)) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is EntityClassMixinDifference => {\r\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.EntityClassMixin && entry.itemName === ecClass.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.EntityClassMixin,\r\n itemName: ecClass.name,\r\n difference: [],\r\n };\r\n this.schemaItemDifferences.push(modifyEntry);\r\n }\r\n modifyEntry.difference.push(mixin.fullName);\r\n }\r\n\r\n private validateMixin(targetClass: ECClass, mixin: Mixin): boolean {\r\n if (mixin.appliesTo && !derivedFrom(targetClass, mixin.appliesTo.name)) {\r\n this.addConflict({\r\n code: ConflictCode.MixinAppliedMustDeriveFromConstraint,\r\n schemaType: targetClass.schemaItemType,\r\n itemName: targetClass.name,\r\n path: \"$mixins\",\r\n source: mixin.fullName,\r\n target: undefined,\r\n description: \"Mixin cannot applied to this class.\",\r\n });\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private visitMissingRelationshipConstraintClass(diagnostic: AnyDiagnostic) {\r\n const constraint = diagnostic.ecDefinition as RelationshipConstraint;\r\n const className = constraint.relationshipClass.name;\r\n const constraintPath = constraint.isSource ? \"$source\" : \"$target\";\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is RelationshipConstraintClassDifference => {\r\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.RelationshipConstraintClass, entry.itemName === className && entry.path === constraintPath;\r\n });\r\n\r\n if (!modifyEntry) {\r\n modifyEntry = {\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.RelationshipConstraintClass,\r\n itemName: className,\r\n path: constraintPath,\r\n difference: [],\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n const [constraintClass] = diagnostic.messageArgs as [ECClass];\r\n modifyEntry.difference.push(constraintClass.fullName);\r\n }\r\n\r\n private visitChangedRelationshipConstraint(diagnostic: AnyDiagnostic) {\r\n const constraint = diagnostic.ecDefinition as RelationshipConstraint;\r\n const className = constraint.relationshipClass.name;\r\n const constraintPath = constraint.isSource ? \"$source\" : \"$target\";\r\n if (this.schemaItemDifferences.find((entry) => entry.changeType === \"add\" && entry.itemName === className)) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is RelationshipConstraintDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.RelationshipConstraint && entry.itemName === className && entry.path === constraintPath;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.RelationshipConstraint,\r\n itemName: className,\r\n path: constraintPath,\r\n difference: {},\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n const [propertyName, propertyValue] = diagnostic.messageArgs as [keyof RelationshipConstraintProps, any];\r\n if (propertyName === \"abstractConstraint\" && propertyValue !== undefined) {\r\n modifyEntry.difference.abstractConstraint = propertyValue;\r\n }\r\n if (propertyName === \"multiplicity\" && propertyValue !== undefined) {\r\n modifyEntry.difference.multiplicity = propertyValue;\r\n }\r\n if (propertyName === \"polymorphic\" && propertyValue !== undefined) {\r\n modifyEntry.difference.polymorphic = propertyValue;\r\n }\r\n if (propertyName === \"roleLabel\" && propertyValue !== undefined) {\r\n modifyEntry.difference.roleLabel = propertyValue;\r\n }\r\n }\r\n\r\n private visitSchemaReference(diagnostic: AnyDiagnostic, changeType: DifferenceType) {\r\n const [referencedSchema] = diagnostic.messageArgs as [Schema];\r\n this.schemaDifferences.push({\r\n changeType,\r\n schemaType: SchemaOtherTypes.SchemaReference,\r\n difference: {\r\n name: referencedSchema.name,\r\n version: referencedSchema.schemaKey.version.toString(),\r\n },\r\n });\r\n }\r\n\r\n private visitMissingCustomAttributeInstance(diagnostic: AnyDiagnostic) {\r\n const [customAttribute] = diagnostic.messageArgs as [CustomAttribute];\r\n const ecType = diagnostic.ecDefinition;\r\n if (Schema.isSchema(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"Schema\",\r\n difference: customAttribute,\r\n });\r\n }\r\n\r\n if (SchemaItem.isSchemaItem(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"SchemaItem\",\r\n itemName: ecType.name,\r\n difference: customAttribute,\r\n });\r\n }\r\n\r\n if (Property.isProperty(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"Property\",\r\n itemName: ecType.class.name,\r\n path: ecType.name,\r\n difference: customAttribute,\r\n });\r\n }\r\n\r\n if (RelationshipConstraint.isRelationshipConstraint(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"RelationshipConstraint\",\r\n itemName: ecType.relationshipClass.name,\r\n path: ecType.isSource ? \"$source\" : \"$target\",\r\n difference: customAttribute,\r\n });\r\n }\r\n return;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaDiagnosticVisitor.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDiagnosticVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,qFAA4E;AAC5E,gEAIkC;AAClC,yDAc4B;AAE5B;;;;;GAKG;AACH,MAAa,uBAAuB;IAOlC;QACE,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,yBAAyB,GAAG,EAAE,CAAC;QACpC,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC;IACvC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,UAAyB;QACpC,QAAQ,UAAU,CAAC,IAAI,EAAE,CAAC;YACxB,KAAK,6CAAkB,CAAC,WAAW;gBACjC,OAAO,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,CAAC;YAEvD,KAAK,6CAAkB,CAAC,sBAAsB;gBAC5C,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YAC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B,CAAC,IAAI;gBACvC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;gBAC7C,UAAU,EAAE,eAAe;aAC5B,CAAC,CAAC;QACL,CAAC;QACD,OAAO;IACT,CAAC;CACF;AA9ZD,0DA8ZC;AAED,SAAS,kBAAkB,CAAC,QAAkB,EAAE,YAAoB;IAClE,OAAO,CAAC,YAAY,KAAK,MAAM,CAAC;QAC9B,CAAC,QAAQ,CAAC,aAAa,EAAE,IAAI,YAAY,KAAK,aAAa,CAAC;QAC5D,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,YAAY,KAAK,eAAe,CAAC;QAC5D,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,YAAY,KAAK,aAAa,CAAC;QACvD,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,YAAY,KAAK,mBAAmB,CAAC,CAAC;AACtE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Differencing\r\n */\r\n\r\nimport type { AnyDiagnostic } from \"../Validation/Diagnostic\";\r\nimport { SchemaCompareCodes } from \"../Validation/SchemaCompareDiagnostics\";\r\nimport {\r\n AnyEnumerator, AnyPropertyProps, AnySchemaItem, CustomAttribute, ECClass,\r\n Enumeration, Mixin, Property, PropertyProps,\r\n RelationshipConstraint, RelationshipConstraintProps, Schema, SchemaItem,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport {\r\n type AnySchemaItemDifference,\r\n type AnySchemaItemPathDifference,\r\n type ClassItemDifference,\r\n type ClassPropertyDifference,\r\n type CustomAttributeDifference,\r\n type DifferenceType,\r\n type EntityClassMixinDifference,\r\n type EnumeratorDifference,\r\n type RelationshipConstraintClassDifference,\r\n type RelationshipConstraintDifference,\r\n type SchemaDifference,\r\n SchemaOtherTypes,\r\n type SchemaReferenceDifference,\r\n} from \"./SchemaDifference\";\r\n\r\n/**\r\n * The SchemaDiagnosticVisitor is a visitor implementation for diagnostic entries\r\n * from the schema comparer api. Depending on the diagnostic code, the difference\r\n * result is build together.\r\n * @internal\r\n */\r\nexport class SchemaDiagnosticVisitor {\r\n\r\n public readonly schemaDifferences: Array<SchemaDifference | SchemaReferenceDifference>;\r\n public readonly schemaItemDifferences: Array<AnySchemaItemDifference>;\r\n public readonly schemaItemPathDifferences: Array<AnySchemaItemPathDifference>;\r\n public readonly customAttributeDifferences: Array<CustomAttributeDifference>;\r\n\r\n constructor() {\r\n this.schemaDifferences = [];\r\n this.schemaItemDifferences = [];\r\n this.schemaItemPathDifferences = [];\r\n this.customAttributeDifferences = [];\r\n }\r\n\r\n /**\r\n * Visitor function to process the schema change diagnostic object.\r\n * @internal\r\n */\r\n public visit(diagnostic: AnyDiagnostic) {\r\n switch (diagnostic.code) {\r\n case SchemaCompareCodes.SchemaDelta:\r\n return this.visitChangedSchemaProperties(diagnostic);\r\n\r\n case SchemaCompareCodes.SchemaReferenceMissing:\r\n return this.visitSchemaReference(diagnostic, \"add\");\r\n case SchemaCompareCodes.SchemaReferenceDelta:\r\n return this.visitSchemaReference(diagnostic, \"modify\");\r\n\r\n case SchemaCompareCodes.SchemaItemMissing:\r\n return this.visitMissingSchemaItem(diagnostic);\r\n\r\n case SchemaCompareCodes.SchemaItemDelta:\r\n case SchemaCompareCodes.ClassDelta:\r\n case SchemaCompareCodes.ConstantDelta:\r\n case SchemaCompareCodes.CustomAttributeClassDelta:\r\n case SchemaCompareCodes.FormatDelta:\r\n case SchemaCompareCodes.InvertedUnitDelta:\r\n case SchemaCompareCodes.KoqDelta:\r\n case SchemaCompareCodes.MixinDelta:\r\n case SchemaCompareCodes.PhenomenonDelta:\r\n case SchemaCompareCodes.PropertyCategoryDelta:\r\n case SchemaCompareCodes.RelationshipDelta:\r\n case SchemaCompareCodes.UnitDelta:\r\n return this.visitChangedSchemaItem(diagnostic);\r\n\r\n case SchemaCompareCodes.EnumerationDelta:\r\n return this.visitChangedEnumeration(diagnostic);\r\n\r\n case SchemaCompareCodes.EnumeratorDelta:\r\n return this.visitChangedEnumerator(diagnostic);\r\n case SchemaCompareCodes.EnumeratorMissing:\r\n return this.visitMissingEnumerator(diagnostic);\r\n\r\n case SchemaCompareCodes.BaseClassDelta:\r\n return this.visitMissingBaseClass(diagnostic);\r\n case SchemaCompareCodes.EntityMixinMissing:\r\n return this.visitMissingMixinOnClass(diagnostic);\r\n case SchemaCompareCodes.PropertyDelta:\r\n return this.visitChangedProperty(diagnostic);\r\n case SchemaCompareCodes.PropertyMissing:\r\n return this.visitMissingProperty(diagnostic);\r\n\r\n case SchemaCompareCodes.RelationshipConstraintClassMissing:\r\n return this.visitMissingRelationshipConstraintClass(diagnostic);\r\n case SchemaCompareCodes.RelationshipConstraintDelta:\r\n return this.visitChangedRelationshipConstraint(diagnostic);\r\n\r\n case SchemaCompareCodes.CustomAttributeInstanceClassMissing:\r\n return this.visitMissingCustomAttributeInstance(diagnostic);\r\n\r\n // Currently not handled...\r\n case SchemaCompareCodes.FormatUnitMissing:\r\n case SchemaCompareCodes.PresentationUnitMissing:\r\n case SchemaCompareCodes.UnitLabelOverrideDelta:\r\n break;\r\n }\r\n return;\r\n }\r\n\r\n private visitChangedSchemaProperties(diagnostic: AnyDiagnostic) {\r\n let modifyEntry = this.schemaDifferences.find((entry): entry is SchemaDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Schema;\r\n });\r\n\r\n let hasChanges = false;\r\n let addEntry = false;\r\n if (modifyEntry === undefined) {\r\n addEntry = true;\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.Schema,\r\n difference: {},\r\n };\r\n }\r\n\r\n // Only label and description are taken from the source schema. If the schema name or alias\r\n // differs, those are ignored for now.\r\n const [propertyName, propertyValue] = diagnostic.messageArgs as [string, any];\r\n if (propertyName === \"label\") {\r\n modifyEntry.difference.label = propertyValue;\r\n hasChanges = true;\r\n }\r\n if (propertyName === \"description\") {\r\n modifyEntry.difference.description = propertyValue;\r\n hasChanges = true;\r\n }\r\n\r\n if (addEntry && hasChanges) {\r\n this.schemaDifferences.push(modifyEntry);\r\n }\r\n }\r\n\r\n private visitMissingSchemaItem(diagnostic: AnyDiagnostic) {\r\n const schemaItem = diagnostic.ecDefinition as AnySchemaItem;\r\n\r\n this.schemaItemDifferences.push({\r\n changeType: \"add\",\r\n schemaType: schemaItem.schemaItemType,\r\n itemName: schemaItem.name,\r\n difference: schemaItem.toJSON(),\r\n });\r\n }\r\n\r\n private visitChangedSchemaItem(diagnostic: AnyDiagnostic) {\r\n const schemaItem = diagnostic.ecDefinition as AnySchemaItem;\r\n const [propertyName, sourceValue, _targetValue] = diagnostic.messageArgs as [string, unknown, unknown];\r\n if (propertyName === \"schemaItemType\") {\r\n // If the schema item type is different, the whole item is added as \"new\" item. The\r\n // difference validator will then figure whether there is a conflict with items of\r\n // of the same name.\r\n return this.visitMissingSchemaItem(diagnostic);\r\n }\r\n\r\n if (sourceValue === undefined) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is AnySchemaItemDifference => {\r\n return entry.changeType === \"modify\" && entry.itemName === schemaItem.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: schemaItem.schemaItemType,\r\n itemName: schemaItem.name,\r\n difference: {},\r\n } as AnySchemaItemDifference;\r\n this.schemaItemDifferences.push(modifyEntry);\r\n }\r\n\r\n // TODO: Since propertyName is type of string, the compiler complains about accepting\r\n // an unspecific string as property indexer. Casted to any as short term fix but that\r\n // needs to be handled better in future.\r\n (modifyEntry.difference as any)[propertyName] = sourceValue;\r\n }\r\n\r\n private visitChangedEnumeration(diagnostic: AnyDiagnostic) {\r\n const enumeration = diagnostic.ecDefinition as Enumeration;\r\n if (this.schemaItemPathDifferences.find((entry) => entry.changeType === \"add\" && entry.itemName === enumeration.name)) {\r\n return;\r\n }\r\n\r\n return this.visitChangedSchemaItem(diagnostic);\r\n }\r\n\r\n private visitMissingEnumerator(diagnostic: AnyDiagnostic) {\r\n const enumeration = diagnostic.ecDefinition as Enumeration;\r\n const [enumerator] = diagnostic.messageArgs as [AnyEnumerator];\r\n this.schemaItemPathDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.Enumerator,\r\n itemName: enumeration.name,\r\n path: \"$enumerators\",\r\n difference: enumerator,\r\n });\r\n }\r\n\r\n private lookupEnumeratorEntry(changeType: DifferenceType, item: string, enumeratorName: string) {\r\n return this.schemaItemPathDifferences.find((change) => {\r\n return change.changeType === changeType\r\n && change.schemaType === SchemaOtherTypes.Enumerator\r\n && change.itemName === item\r\n && change.path === \"$enumerators\"\r\n && change.difference.name === enumeratorName;\r\n });\r\n }\r\n\r\n private visitChangedEnumerator(diagnostic: AnyDiagnostic) {\r\n const enumeration = diagnostic.ecDefinition as Enumeration;\r\n const [enumerator, propertyName, sourceValue] = diagnostic.messageArgs as [AnyEnumerator, keyof AnyEnumerator, any];\r\n if (this.lookupEnumeratorEntry(\"add\", enumeration.name, enumerator.name)) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is EnumeratorDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Enumerator && entry.itemName === enumeration.name && entry.path === enumerator.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.Enumerator,\r\n itemName: enumeration.name,\r\n path: enumerator.name,\r\n difference: {},\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n if (sourceValue !== undefined) {\r\n modifyEntry.difference[propertyName] = sourceValue;\r\n }\r\n }\r\n\r\n private visitMissingProperty(diagnostic: AnyDiagnostic) {\r\n const property = diagnostic.ecDefinition as Property;\r\n this.schemaItemPathDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.Property,\r\n itemName: property.class.name,\r\n path: property.name,\r\n difference: property.toJSON() as AnyPropertyProps,\r\n });\r\n }\r\n\r\n private visitChangedProperty(diagnostic: AnyDiagnostic) {\r\n const property = diagnostic.ecDefinition as Property;\r\n const [propertyName, sourceValue] = diagnostic.messageArgs as [keyof PropertyProps, any, any];\r\n\r\n if (isPropertyTypeName(property, propertyName)) {\r\n return this.visitMissingProperty(diagnostic);\r\n }\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is ClassPropertyDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.Property && entry.itemName === property.class.name && entry.path === property.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.Property,\r\n itemName: property.class.name,\r\n path: property.name,\r\n difference: {},\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n if (propertyName !== \"name\" && sourceValue !== undefined) {\r\n modifyEntry.difference[propertyName] = sourceValue;\r\n }\r\n }\r\n\r\n private visitMissingBaseClass(diagnostic: AnyDiagnostic) {\r\n const ecClass = diagnostic.ecDefinition as ECClass;\r\n const [sourceBaseClass] = diagnostic.messageArgs as [ECClass, ECClass];\r\n\r\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is ClassItemDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === ecClass.schemaItemType && entry.itemName === ecClass.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: ecClass.schemaItemType,\r\n itemName: ecClass.name,\r\n difference: {},\r\n } as ClassItemDifference;\r\n this.schemaItemDifferences.push(modifyEntry);\r\n }\r\n\r\n modifyEntry.difference.baseClass = sourceBaseClass !== undefined ? sourceBaseClass.fullName : undefined;\r\n }\r\n\r\n private visitMissingMixinOnClass(diagnostic: AnyDiagnostic) {\r\n const ecClass = diagnostic.ecDefinition as ECClass;\r\n const [mixin] = diagnostic.messageArgs as [Mixin];\r\n\r\n let modifyEntry = this.schemaItemDifferences.find((entry): entry is EntityClassMixinDifference => {\r\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.EntityClassMixin && entry.itemName === ecClass.name;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.EntityClassMixin,\r\n itemName: ecClass.name,\r\n difference: [],\r\n };\r\n this.schemaItemDifferences.push(modifyEntry);\r\n }\r\n modifyEntry.difference.push(mixin.fullName);\r\n }\r\n\r\n private visitMissingRelationshipConstraintClass(diagnostic: AnyDiagnostic) {\r\n const constraint = diagnostic.ecDefinition as RelationshipConstraint;\r\n const className = constraint.relationshipClass.name;\r\n const constraintPath = constraint.isSource ? \"$source\" : \"$target\";\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is RelationshipConstraintClassDifference => {\r\n return entry.changeType === \"add\" && entry.schemaType === SchemaOtherTypes.RelationshipConstraintClass, entry.itemName === className && entry.path === constraintPath;\r\n });\r\n\r\n if (!modifyEntry) {\r\n modifyEntry = {\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.RelationshipConstraintClass,\r\n itemName: className,\r\n path: constraintPath,\r\n difference: [],\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n const [constraintClass] = diagnostic.messageArgs as [ECClass];\r\n modifyEntry.difference.push(constraintClass.fullName);\r\n }\r\n\r\n private visitChangedRelationshipConstraint(diagnostic: AnyDiagnostic) {\r\n const constraint = diagnostic.ecDefinition as RelationshipConstraint;\r\n const className = constraint.relationshipClass.name;\r\n const constraintPath = constraint.isSource ? \"$source\" : \"$target\";\r\n if (this.schemaItemDifferences.find((entry) => entry.changeType === \"add\" && entry.itemName === className)) {\r\n return;\r\n }\r\n\r\n let modifyEntry = this.schemaItemPathDifferences.find((entry): entry is RelationshipConstraintDifference => {\r\n return entry.changeType === \"modify\" && entry.schemaType === SchemaOtherTypes.RelationshipConstraint && entry.itemName === className && entry.path === constraintPath;\r\n });\r\n\r\n if (modifyEntry === undefined) {\r\n modifyEntry = {\r\n changeType: \"modify\",\r\n schemaType: SchemaOtherTypes.RelationshipConstraint,\r\n itemName: className,\r\n path: constraintPath,\r\n difference: {},\r\n };\r\n this.schemaItemPathDifferences.push(modifyEntry);\r\n }\r\n\r\n const [propertyName, propertyValue] = diagnostic.messageArgs as [keyof RelationshipConstraintProps, any];\r\n if (propertyName === \"abstractConstraint\" && propertyValue !== undefined) {\r\n modifyEntry.difference.abstractConstraint = propertyValue;\r\n }\r\n if (propertyName === \"multiplicity\" && propertyValue !== undefined) {\r\n modifyEntry.difference.multiplicity = propertyValue;\r\n }\r\n if (propertyName === \"polymorphic\" && propertyValue !== undefined) {\r\n modifyEntry.difference.polymorphic = propertyValue;\r\n }\r\n if (propertyName === \"roleLabel\" && propertyValue !== undefined) {\r\n modifyEntry.difference.roleLabel = propertyValue;\r\n }\r\n }\r\n\r\n private visitSchemaReference(diagnostic: AnyDiagnostic, changeType: DifferenceType) {\r\n const [referencedSchema] = diagnostic.messageArgs as [Schema];\r\n this.schemaDifferences.push({\r\n changeType,\r\n schemaType: SchemaOtherTypes.SchemaReference,\r\n difference: {\r\n name: referencedSchema.name,\r\n version: referencedSchema.schemaKey.version.toString(),\r\n },\r\n });\r\n }\r\n\r\n private visitMissingCustomAttributeInstance(diagnostic: AnyDiagnostic) {\r\n const [customAttribute] = diagnostic.messageArgs as [CustomAttribute];\r\n const ecType = diagnostic.ecDefinition;\r\n if (Schema.isSchema(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"Schema\",\r\n difference: customAttribute,\r\n });\r\n }\r\n\r\n if (SchemaItem.isSchemaItem(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"SchemaItem\",\r\n itemName: ecType.name,\r\n difference: customAttribute,\r\n });\r\n }\r\n\r\n if (Property.isProperty(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"Property\",\r\n itemName: ecType.class.name,\r\n path: ecType.name,\r\n difference: customAttribute,\r\n });\r\n }\r\n\r\n if (RelationshipConstraint.isRelationshipConstraint(ecType)) {\r\n return this.customAttributeDifferences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.CustomAttributeInstance,\r\n appliedTo: \"RelationshipConstraint\",\r\n itemName: ecType.relationshipClass.name,\r\n path: ecType.isSource ? \"$source\" : \"$target\",\r\n difference: customAttribute,\r\n });\r\n }\r\n return;\r\n }\r\n}\r\n\r\nfunction isPropertyTypeName(property: Property, propertyName: string) {\r\n return (propertyName === \"type\") ||\r\n (property.isEnumeration() && propertyName === \"enumeration\") ||\r\n (property.isPrimitive() && propertyName === \"primitiveType\") ||\r\n (property.isStruct() && propertyName === \"structClass\") ||\r\n (property.isNavigation() && propertyName === \"relationshipClass\");\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaDifference.d.ts","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifference.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAI7D,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,E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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,CAyBtH"}
|
|
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.getSchemaDifferences = exports.SchemaOtherTypes = void 0;
|
|
11
11
|
const SchemaDiagnosticVisitor_1 = require("./SchemaDiagnosticVisitor");
|
|
12
12
|
const SchemaComparer_1 = require("../Validation/SchemaComparer");
|
|
13
|
+
const SchemaDifferenceValidator_1 = require("./SchemaDifferenceValidator");
|
|
13
14
|
/**
|
|
14
15
|
* Defines the SchemaTypes that are not SchemaItems.
|
|
15
16
|
* @alpha
|
|
@@ -46,10 +47,11 @@ async function getSchemaDifferences(targetSchema, sourceSchema) {
|
|
|
46
47
|
...visitor.schemaItemPathDifferences,
|
|
47
48
|
...visitor.customAttributeDifferences,
|
|
48
49
|
];
|
|
50
|
+
const conflicts = await (0, SchemaDifferenceValidator_1.validateDifferences)(differences, targetSchema, sourceSchema);
|
|
49
51
|
return {
|
|
50
52
|
sourceSchemaName: sourceSchema.schemaKey.toString(),
|
|
51
53
|
targetSchemaName: targetSchema.schemaKey.toString(),
|
|
52
|
-
conflicts:
|
|
54
|
+
conflicts: conflicts.length > 0 ? conflicts : undefined,
|
|
53
55
|
differences,
|
|
54
56
|
};
|
|
55
57
|
}
|