@itwin/ecschema-editing 4.10.0-dev.1 → 4.10.0-dev.2
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/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifference.d.ts +2 -2
- package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifferenceValidator.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDifferenceValidator.js.map +1 -1
- package/lib/cjs/Differencing/SchemaDifferenceVisitor.d.ts +7 -4
- package/lib/cjs/Differencing/SchemaDifferenceVisitor.d.ts.map +1 -1
- package/lib/cjs/Differencing/SchemaDifferenceVisitor.js +28 -25
- package/lib/cjs/Differencing/SchemaDifferenceVisitor.js.map +1 -1
- package/lib/cjs/Differencing/Utils.d.ts +2 -2
- package/lib/cjs/Differencing/Utils.d.ts.map +1 -1
- package/lib/cjs/Differencing/Utils.js.map +1 -1
- package/lib/cjs/Merging/ClassMerger.d.ts +2 -6
- package/lib/cjs/Merging/ClassMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/ClassMerger.js +12 -82
- package/lib/cjs/Merging/ClassMerger.js.map +1 -1
- package/lib/cjs/Merging/ConstantMerger.d.ts +10 -4
- package/lib/cjs/Merging/ConstantMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/ConstantMerger.js +58 -54
- package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
- package/lib/cjs/Merging/CustomAttributeClassMerger.d.ts +14 -0
- package/lib/cjs/Merging/CustomAttributeClassMerger.d.ts.map +1 -0
- package/lib/cjs/Merging/CustomAttributeClassMerger.js +41 -0
- package/lib/cjs/Merging/CustomAttributeClassMerger.js.map +1 -0
- package/lib/cjs/Merging/CustomAttributeMerger.d.ts +2 -6
- package/lib/cjs/Merging/CustomAttributeMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/CustomAttributeMerger.js +39 -48
- package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
- package/lib/cjs/Merging/Edits/RenameEditHandler.d.ts.map +1 -1
- package/lib/cjs/Merging/Edits/RenameEditHandler.js.map +1 -1
- package/lib/cjs/Merging/EntityClassMerger.d.ts +11 -6
- package/lib/cjs/Merging/EntityClassMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/EntityClassMerger.js +32 -32
- package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
- package/lib/cjs/Merging/EnumerationMerger.d.ts +7 -6
- package/lib/cjs/Merging/EnumerationMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/EnumerationMerger.js +39 -67
- package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
- package/lib/cjs/Merging/EnumeratorMerger.d.ts +14 -0
- package/lib/cjs/Merging/EnumeratorMerger.d.ts.map +1 -0
- package/lib/cjs/Merging/EnumeratorMerger.js +41 -0
- package/lib/cjs/Merging/EnumeratorMerger.js.map +1 -0
- package/lib/cjs/Merging/KindOfQuantityMerger.d.ts +10 -4
- package/lib/cjs/Merging/KindOfQuantityMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/KindOfQuantityMerger.js +51 -46
- package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
- package/lib/cjs/Merging/MixinMerger.d.ts +10 -4
- package/lib/cjs/Merging/MixinMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/MixinMerger.js +30 -25
- package/lib/cjs/Merging/MixinMerger.js.map +1 -1
- package/lib/cjs/Merging/PhenomenonMerger.d.ts +10 -4
- package/lib/cjs/Merging/PhenomenonMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/PhenomenonMerger.js +34 -29
- package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
- package/lib/cjs/Merging/PropertyCategoryMerger.d.ts +10 -4
- package/lib/cjs/Merging/PropertyCategoryMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/PropertyCategoryMerger.js +30 -27
- package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -1
- package/lib/cjs/Merging/PropertyMerger.d.ts +2 -2
- package/lib/cjs/Merging/PropertyMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/PropertyMerger.js +7 -7
- package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
- package/lib/cjs/Merging/RelationshipClassMerger.d.ts +8 -4
- package/lib/cjs/Merging/RelationshipClassMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/RelationshipClassMerger.js +40 -40
- package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaMerger.d.ts +1 -1
- package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/SchemaMerger.js +7 -42
- package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
- package/lib/cjs/Merging/SchemaMergingVisitor.d.ts +138 -0
- package/lib/cjs/Merging/SchemaMergingVisitor.d.ts.map +1 -0
- package/lib/cjs/Merging/SchemaMergingVisitor.js +309 -0
- package/lib/cjs/Merging/SchemaMergingVisitor.js.map +1 -0
- package/lib/cjs/Merging/SchemaMergingWalker.d.ts +19 -0
- package/lib/cjs/Merging/SchemaMergingWalker.d.ts.map +1 -0
- package/lib/cjs/Merging/SchemaMergingWalker.js +62 -0
- package/lib/cjs/Merging/SchemaMergingWalker.js.map +1 -0
- package/lib/cjs/Merging/SchemaReferenceMerger.d.ts +9 -6
- package/lib/cjs/Merging/SchemaReferenceMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/SchemaReferenceMerger.js +28 -37
- package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
- package/lib/cjs/Merging/StructClassMerger.d.ts +14 -0
- package/lib/cjs/Merging/StructClassMerger.d.ts.map +1 -0
- package/lib/cjs/Merging/StructClassMerger.js +25 -0
- package/lib/cjs/Merging/StructClassMerger.js.map +1 -0
- package/lib/cjs/Merging/UnitSystemMerger.d.ts +10 -4
- package/lib/cjs/Merging/UnitSystemMerger.d.ts.map +1 -1
- package/lib/cjs/Merging/UnitSystemMerger.js +23 -19
- package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -1
- package/lib/cjs/Merging/Utils.d.ts +18 -0
- package/lib/cjs/Merging/Utils.d.ts.map +1 -0
- package/lib/cjs/Merging/Utils.js +56 -0
- package/lib/cjs/Merging/Utils.js.map +1 -0
- package/package.json +9 -9
- package/lib/cjs/Merging/CAClassMerger.d.ts +0 -8
- package/lib/cjs/Merging/CAClassMerger.d.ts.map +0 -1
- package/lib/cjs/Merging/CAClassMerger.js +0 -36
- package/lib/cjs/Merging/CAClassMerger.js.map +0 -1
- package/lib/cjs/Merging/SchemaItemMerger.d.ts +0 -35
- package/lib/cjs/Merging/SchemaItemMerger.d.ts.map +0 -1
- package/lib/cjs/Merging/SchemaItemMerger.js +0 -121
- package/lib/cjs/Merging/SchemaItemMerger.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaDifferenceVisitor.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifferenceVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA0D;AAC1D,yDAAgF;AAWhF;;;;GAIG;AACH,MAAa,sBAAsB;IAIjC,kEAAkE;IAClE,YAAY,
|
|
1
|
+
{"version":3,"file":"SchemaDifferenceVisitor.js","sourceRoot":"","sources":["../../../src/Differencing/SchemaDifferenceVisitor.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA0D;AAC1D,yDAAgF;AAWhF;;;;GAIG;AACH,MAAa,sBAAsB;IAIjC,kEAAkE;IAClE,YAAY,OAAgC;QAC1C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,QAAQ,CAAC,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,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAClF,KAAK,mCAAgB,CAAC,sBAAsB;gBAC1C,OAAO,IAAI,CAAC,QAAQ,CAAC,qCAAqC,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACvF,KAAK,mCAAgB,CAAC,2BAA2B;gBAC/C,OAAO,IAAI,CAAC,QAAQ,CAAC,0CAA0C,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC5F,KAAK,kCAAc,CAAC,WAAW;gBAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,0BAA0B,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC5E,KAAK,kCAAc,CAAC,IAAI;gBACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YACrE,KAAK,kCAAc,CAAC,UAAU;gBAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,yBAAyB,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;CACF;AAtED,wDAsEC","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 { SchemaItemType } from \"@itwin/ecschema-metadata\";\r\nimport { type AnySchemaDifference, SchemaOtherTypes } from \"./SchemaDifference\";\r\n\r\n/**\r\n * Defines the interface for a visitor that can be used to traverse schema differences.\r\n * It dynamically creates a method for each schema difference type.\r\n * @internal\r\n */\r\nexport type SchemaDifferenceVisitor = {\r\n [Difference in AnySchemaDifference as `visit${Difference[\"schemaType\"]}Difference`]: (entry: Difference, index: number, array: AnySchemaDifference[]) => Promise<void>;\r\n};\r\n\r\n/**\r\n * Implementation of a walker that traverses schema differences and calls the appropriate\r\n * method on the visitor.\r\n * @internal\r\n */\r\nexport class SchemaDifferenceWalker {\r\n\r\n private readonly _visitor: SchemaDifferenceVisitor;\r\n\r\n /** Initializes a new instance of SchemaDifferenceWalker class. */\r\n constructor(visitor: SchemaDifferenceVisitor) {\r\n this._visitor = visitor;\r\n }\r\n\r\n /**\r\n * Traverses the schema differences and calls the appropriate method on the visitor.\r\n * @param differences The differences to traverse.\r\n */\r\n public async traverse(differences: Array<AnySchemaDifference>): Promise<void> {\r\n for (const [index, entry] of differences.entries()) {\r\n await this.visit(entry, index, differences);\r\n }\r\n }\r\n\r\n /**\r\n * Calls the appropriate method on the visitor based on the schema difference type.\r\n */\r\n private async visit(difference: AnySchemaDifference, index: number, array: AnySchemaDifference[]) {\r\n switch (difference.schemaType) {\r\n case SchemaOtherTypes.Schema:\r\n return this._visitor.visitSchemaDifference(difference, index, array);\r\n case SchemaOtherTypes.SchemaReference:\r\n return this._visitor.visitSchemaReferenceDifference(difference, index, array);\r\n case SchemaItemType.Constant:\r\n return this._visitor.visitConstantDifference(difference, index, array);\r\n case SchemaItemType.CustomAttributeClass:\r\n return this._visitor.visitCustomAttributeClassDifference(difference, index, array);\r\n case SchemaOtherTypes.CustomAttributeInstance:\r\n return this._visitor.visitCustomAttributeInstanceDifference(difference, index, array);\r\n case SchemaItemType.EntityClass:\r\n return this._visitor.visitEntityClassDifference(difference, index, array);\r\n case SchemaOtherTypes.EntityClassMixin:\r\n return this._visitor.visitEntityClassMixinDifference(difference, index, array);\r\n case SchemaItemType.Enumeration:\r\n return this._visitor.visitEnumerationDifference(difference, index, array);\r\n case SchemaOtherTypes.Enumerator:\r\n return this._visitor.visitEnumeratorDifference(difference, index, array);\r\n case SchemaItemType.Format:\r\n return this._visitor.visitFormatDifference(difference, index, array);\r\n case SchemaItemType.InvertedUnit:\r\n return this._visitor.visitInvertedUnitDifference(difference, index, array);\r\n case SchemaItemType.KindOfQuantity:\r\n return this._visitor.visitKindOfQuantityDifference(difference, index, array);\r\n case SchemaItemType.Mixin:\r\n return this._visitor.visitMixinDifference(difference, index, array);\r\n case SchemaItemType.Phenomenon:\r\n return this._visitor.visitPhenomenonDifference(difference, index, array);\r\n case SchemaOtherTypes.Property:\r\n return this._visitor.visitPropertyDifference(difference, index, array);\r\n case SchemaItemType.PropertyCategory:\r\n return this._visitor.visitPropertyCategoryDifference(difference, index, array);\r\n case SchemaItemType.RelationshipClass:\r\n return this._visitor.visitRelationshipClassDifference(difference, index, array);\r\n case SchemaOtherTypes.RelationshipConstraint:\r\n return this._visitor.visitRelationshipConstraintDifference(difference, index, array);\r\n case SchemaOtherTypes.RelationshipConstraintClass:\r\n return this._visitor.visitRelationshipConstraintClassDifference(difference, index, array);\r\n case SchemaItemType.StructClass:\r\n return this._visitor.visitStructClassDifference(difference, index, array);\r\n case SchemaItemType.Unit:\r\n return this._visitor.visitUnitDifference(difference, index, array);\r\n case SchemaItemType.UnitSystem:\r\n return this._visitor.visitUnitSystemDifference(difference, index, array);\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Differencing
|
|
3
3
|
*/
|
|
4
|
-
import { type
|
|
4
|
+
import { type AnyClassItemDifference, type AnySchemaDifference, type AnySchemaItemDifference, 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
5
|
/**
|
|
6
6
|
* Indicates whether the given difference is type of ConstantDifference.
|
|
7
7
|
* @alpha
|
|
@@ -106,5 +106,5 @@ export declare function isSchemaItemDifference(difference: AnySchemaDifference):
|
|
|
106
106
|
* Indicates whether the given difference is type of ClassItemDifference.
|
|
107
107
|
* @alpha
|
|
108
108
|
*/
|
|
109
|
-
export declare function isClassDifference(difference: AnySchemaDifference): difference is
|
|
109
|
+
export declare function isClassDifference(difference: AnySchemaDifference): difference is AnyClassItemDifference;
|
|
110
110
|
//# sourceMappingURL=Utils.d.ts.map
|
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/Differencing/Utils.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,qCAAqC,EAC1C,KAAK,gCAAgC,EACrC,KAAK,gBAAgB,EAErB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EAC1B,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,mBAAmB,GAAG,UAAU,IAAI,kBAAkB,CAEtG;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,mBAAmB,GAAG,UAAU,IAAI,uBAAuB,CAEhH;AAED;;;GAGG;AACH,wBA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------------------------------------------------\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 { SchemaItemType } from \"@itwin/ecschema-metadata\";\r\nimport {\r\n type AnySchemaDifference,\r\n type AnySchemaItemDifference,\r\n type ClassItemDifference,\r\n type ClassPropertyDifference,\r\n type ConstantDifference,\r\n type CustomAttributeClassDifference,\r\n type CustomAttributeDifference,\r\n type EntityClassDifference,\r\n type EntityClassMixinDifference,\r\n type EnumerationDifference,\r\n type EnumeratorDifference,\r\n type KindOfQuantityDifference,\r\n type MixinClassDifference,\r\n type PhenomenonDifference,\r\n type PropertyCategoryDifference,\r\n type RelationshipClassDifference,\r\n type RelationshipConstraintClassDifference,\r\n type RelationshipConstraintDifference,\r\n type SchemaDifference,\r\n SchemaOtherTypes,\r\n type SchemaReferenceDifference,\r\n type StructClassDifference,\r\n type UnitSystemDifference,\r\n} from \"./SchemaDifference\";\r\n\r\n/**\r\n * Indicates whether the given difference is type of ConstantDifference.\r\n * @alpha\r\n */\r\nexport function isConstantDifference(difference: AnySchemaDifference): difference is ConstantDifference {\r\n return difference.schemaType === SchemaItemType.Constant;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of ClassPropertyDifference.\r\n * @alpha\r\n */\r\nexport function isClassPropertyDifference(difference: AnySchemaDifference): difference is ClassPropertyDifference {\r\n return difference.schemaType === SchemaOtherTypes.Property;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of CustomAttributeClassDifference.\r\n * @alpha\r\n */\r\nexport function isCustomAttributeClassDifference(difference: AnySchemaDifference): difference is CustomAttributeClassDifference {\r\n return difference.schemaType === SchemaItemType.CustomAttributeClass;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of CustomAttributeDifference.\r\n * @alpha\r\n */\r\nexport function isCustomAttributeDifference(difference: AnySchemaDifference): difference is CustomAttributeDifference {\r\n return difference.schemaType === SchemaOtherTypes.CustomAttributeInstance;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of EntityClassDifference.\r\n * @alpha\r\n */\r\nexport function isEntityClassDifference(difference: AnySchemaDifference): difference is EntityClassDifference {\r\n return difference.schemaType === SchemaItemType.EntityClass;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of EntityClassMixinDifference.\r\n * @alpha\r\n */\r\nexport function isEntityClassMixinDifference(difference: AnySchemaDifference): difference is EntityClassMixinDifference {\r\n return difference.schemaType === SchemaOtherTypes.EntityClassMixin;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of EnumerationDifference.\r\n * @alpha\r\n */\r\nexport function isEnumerationDifference(difference: AnySchemaDifference): difference is EnumerationDifference {\r\n return difference.schemaType === SchemaItemType.Enumeration;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of EnumeratorDifference.\r\n * @alpha\r\n */\r\nexport function isEnumeratorDifference(difference: AnySchemaDifference): difference is EnumeratorDifference {\r\n return difference.schemaType === SchemaOtherTypes.Enumerator;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of KindOfQuantityDifference.\r\n * @alpha\r\n */\r\nexport function isKindOfQuantityDifference(difference: AnySchemaDifference): difference is KindOfQuantityDifference {\r\n return difference.schemaType === SchemaItemType.KindOfQuantity;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of MixinClassDifference.\r\n * @alpha\r\n */\r\nexport function isMixinClassDifference(difference: AnySchemaDifference): difference is MixinClassDifference {\r\n return difference.schemaType === SchemaItemType.Mixin;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of PhenomenonDifference.\r\n * @alpha\r\n */\r\nexport function isPhenomenonDifference(difference: AnySchemaDifference): difference is PhenomenonDifference {\r\n return difference.schemaType === SchemaItemType.Phenomenon;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of PropertyCategoryDifference.\r\n * @alpha\r\n */\r\nexport function isPropertyCategoryDifference(difference: AnySchemaDifference): difference is PropertyCategoryDifference {\r\n return difference.schemaType === SchemaItemType.PropertyCategory;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of SchemaDifference.\r\n * @alpha\r\n */\r\nexport function isSchemaDifference(difference: AnySchemaDifference): difference is SchemaDifference {\r\n return difference.schemaType === SchemaOtherTypes.Schema;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of SchemaReferenceDifference.\r\n * @alpha\r\n */\r\nexport function isSchemaReferenceDifference(difference: AnySchemaDifference): difference is SchemaReferenceDifference {\r\n return difference.schemaType === SchemaOtherTypes.SchemaReference;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of CustomAttributeDifference.\r\n * @alpha\r\n */\r\nexport function isStructClassDifference(difference: AnySchemaDifference): difference is StructClassDifference {\r\n return difference.schemaType === SchemaItemType.StructClass;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of UnitSystemDifference.\r\n * @alpha\r\n */\r\nexport function isUnitSystemDifference(difference: AnySchemaDifference): difference is UnitSystemDifference {\r\n return difference.schemaType === SchemaItemType.UnitSystem;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of RelationshipClassDifference.\r\n * @alpha\r\n */\r\nexport function isRelationshipClassDifference(difference: AnySchemaDifference): difference is RelationshipClassDifference {\r\n return difference.schemaType === SchemaItemType.RelationshipClass;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of RelationshipConstraintDifference.\r\n * @alpha\r\n */\r\nexport function isRelationshipConstraintDifference(difference: AnySchemaDifference): difference is RelationshipConstraintDifference {\r\n return difference.schemaType === SchemaOtherTypes.RelationshipConstraint;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of RelationshipConstraintClassDifference.\r\n * @alpha\r\n */\r\nexport function isRelationshipConstraintClassDifference(difference: AnySchemaDifference): difference is RelationshipConstraintClassDifference {\r\n return difference.schemaType === SchemaOtherTypes.RelationshipConstraintClass;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of AnySchemaItemDifference.\r\n * @alpha\r\n */\r\nexport function isSchemaItemDifference(difference: AnySchemaDifference): difference is AnySchemaItemDifference {\r\n return difference.schemaType in SchemaItemType;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of ClassItemDifference.\r\n * @alpha\r\n */\r\nexport function isClassDifference(difference: AnySchemaDifference): difference is ClassItemDifference {\r\n return isStructClassDifference(difference)\r\n || isCustomAttributeClassDifference(difference)\r\n || isEntityClassDifference(difference)\r\n || isMixinClassDifference(difference)\r\n || isRelationshipClassDifference(difference);\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/Differencing/Utils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAA0D;AAC1D,yDAwB4B;AAE5B;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,UAA+B;IAClE,OAAO,UAAU,CAAC,UAAU,KAAK,kCAAc,CAAC,QAAQ,CAAC;AAC3D,CAAC;AAFD,oDAEC;AAED;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,UAA+B;IACvE,OAAO,UAAU,CAAC,UAAU,KAAK,mCAAgB,CAAC,QAAQ,CAAC;AAC7D,CAAC;AAFD,8DAEC;AAED;;;GAGG;AACH,SAAgB,gCAAgC,CAAC,UAA+B;IAC9E,OAAO,UAAU,CAAC,UAAU,KAAK,kCAAc,CAAC,oBAAoB,CAAC;AACvE,CAAC;AAFD,4EAEC;AAED;;;GAGG;AACH,SAAgB,2BAA2B,CAAC,UAA+B;IACzE,OAAO,UAAU,CAAC,UAAU,KAAK,mCAAgB,CAAC,uBAAuB,CAAC;AAC5E,CAAC;AAFD,kEAEC;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,UAA+B;IACrE,OAAO,UAAU,CAAC,UAAU,KAAK,kCAAc,CAAC,WAAW,CAAC;AAC9D,CAAC;AAFD,0DAEC;AAED;;;GAGG;AACH,SA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CAAC,UAA+B;IACrE,OAAO,UAAU,CAAC,UAAU,KAAK,kCAAc,CAAC,WAAW,CAAC;AAC9D,CAAC;AAFD,0DAEC;AAED;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,UAA+B;IACpE,OAAO,UAAU,CAAC,UAAU,KAAK,kCAAc,CAAC,UAAU,CAAC;AAC7D,CAAC;AAFD,wDAEC;AAED;;;GAGG;AACH,SAAgB,6BAA6B,CAAC,UAA+B;IAC3E,OAAO,UAAU,CAAC,UAAU,KAAK,kCAAc,CAAC,iBAAiB,CAAC;AACpE,CAAC;AAFD,sEAEC;AAED;;;GAGG;AACH,SAAgB,kCAAkC,CAAC,UAA+B;IAChF,OAAO,UAAU,CAAC,UAAU,KAAK,mCAAgB,CAAC,sBAAsB,CAAC;AAC3E,CAAC;AAFD,gFAEC;AAED;;;GAGG;AACH,SAAgB,uCAAuC,CAAC,UAA+B;IACrF,OAAO,UAAU,CAAC,UAAU,KAAK,mCAAgB,CAAC,2BAA2B,CAAC;AAChF,CAAC;AAFD,0FAEC;AAED;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,UAA+B;IACpE,OAAO,UAAU,CAAC,UAAU,IAAI,kCAAc,CAAC;AACjD,CAAC;AAFD,wDAEC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,UAA+B;IAC/D,OAAO,uBAAuB,CAAC,UAAU,CAAC;WACrC,gCAAgC,CAAC,UAAU,CAAC;WAC5C,uBAAuB,CAAC,UAAU,CAAC;WACnC,sBAAsB,CAAC,UAAU,CAAC;WAClC,6BAA6B,CAAC,UAAU,CAAC,CAAC;AACjD,CAAC;AAND,8CAMC","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 { SchemaItemType } from \"@itwin/ecschema-metadata\";\r\nimport {\r\n type AnyClassItemDifference,\r\n type AnySchemaDifference,\r\n type AnySchemaItemDifference,\r\n type ClassPropertyDifference,\r\n type ConstantDifference,\r\n type CustomAttributeClassDifference,\r\n type CustomAttributeDifference,\r\n type EntityClassDifference,\r\n type EntityClassMixinDifference,\r\n type EnumerationDifference,\r\n type EnumeratorDifference,\r\n type KindOfQuantityDifference,\r\n type MixinClassDifference,\r\n type PhenomenonDifference,\r\n type PropertyCategoryDifference,\r\n type RelationshipClassDifference,\r\n type RelationshipConstraintClassDifference,\r\n type RelationshipConstraintDifference,\r\n type SchemaDifference,\r\n SchemaOtherTypes,\r\n type SchemaReferenceDifference,\r\n type StructClassDifference,\r\n type UnitSystemDifference,\r\n} from \"./SchemaDifference\";\r\n\r\n/**\r\n * Indicates whether the given difference is type of ConstantDifference.\r\n * @alpha\r\n */\r\nexport function isConstantDifference(difference: AnySchemaDifference): difference is ConstantDifference {\r\n return difference.schemaType === SchemaItemType.Constant;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of ClassPropertyDifference.\r\n * @alpha\r\n */\r\nexport function isClassPropertyDifference(difference: AnySchemaDifference): difference is ClassPropertyDifference {\r\n return difference.schemaType === SchemaOtherTypes.Property;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of CustomAttributeClassDifference.\r\n * @alpha\r\n */\r\nexport function isCustomAttributeClassDifference(difference: AnySchemaDifference): difference is CustomAttributeClassDifference {\r\n return difference.schemaType === SchemaItemType.CustomAttributeClass;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of CustomAttributeDifference.\r\n * @alpha\r\n */\r\nexport function isCustomAttributeDifference(difference: AnySchemaDifference): difference is CustomAttributeDifference {\r\n return difference.schemaType === SchemaOtherTypes.CustomAttributeInstance;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of EntityClassDifference.\r\n * @alpha\r\n */\r\nexport function isEntityClassDifference(difference: AnySchemaDifference): difference is EntityClassDifference {\r\n return difference.schemaType === SchemaItemType.EntityClass;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of EntityClassMixinDifference.\r\n * @alpha\r\n */\r\nexport function isEntityClassMixinDifference(difference: AnySchemaDifference): difference is EntityClassMixinDifference {\r\n return difference.schemaType === SchemaOtherTypes.EntityClassMixin;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of EnumerationDifference.\r\n * @alpha\r\n */\r\nexport function isEnumerationDifference(difference: AnySchemaDifference): difference is EnumerationDifference {\r\n return difference.schemaType === SchemaItemType.Enumeration;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of EnumeratorDifference.\r\n * @alpha\r\n */\r\nexport function isEnumeratorDifference(difference: AnySchemaDifference): difference is EnumeratorDifference {\r\n return difference.schemaType === SchemaOtherTypes.Enumerator;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of KindOfQuantityDifference.\r\n * @alpha\r\n */\r\nexport function isKindOfQuantityDifference(difference: AnySchemaDifference): difference is KindOfQuantityDifference {\r\n return difference.schemaType === SchemaItemType.KindOfQuantity;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of MixinClassDifference.\r\n * @alpha\r\n */\r\nexport function isMixinClassDifference(difference: AnySchemaDifference): difference is MixinClassDifference {\r\n return difference.schemaType === SchemaItemType.Mixin;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of PhenomenonDifference.\r\n * @alpha\r\n */\r\nexport function isPhenomenonDifference(difference: AnySchemaDifference): difference is PhenomenonDifference {\r\n return difference.schemaType === SchemaItemType.Phenomenon;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of PropertyCategoryDifference.\r\n * @alpha\r\n */\r\nexport function isPropertyCategoryDifference(difference: AnySchemaDifference): difference is PropertyCategoryDifference {\r\n return difference.schemaType === SchemaItemType.PropertyCategory;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of SchemaDifference.\r\n * @alpha\r\n */\r\nexport function isSchemaDifference(difference: AnySchemaDifference): difference is SchemaDifference {\r\n return difference.schemaType === SchemaOtherTypes.Schema;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of SchemaReferenceDifference.\r\n * @alpha\r\n */\r\nexport function isSchemaReferenceDifference(difference: AnySchemaDifference): difference is SchemaReferenceDifference {\r\n return difference.schemaType === SchemaOtherTypes.SchemaReference;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of CustomAttributeDifference.\r\n * @alpha\r\n */\r\nexport function isStructClassDifference(difference: AnySchemaDifference): difference is StructClassDifference {\r\n return difference.schemaType === SchemaItemType.StructClass;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of UnitSystemDifference.\r\n * @alpha\r\n */\r\nexport function isUnitSystemDifference(difference: AnySchemaDifference): difference is UnitSystemDifference {\r\n return difference.schemaType === SchemaItemType.UnitSystem;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of RelationshipClassDifference.\r\n * @alpha\r\n */\r\nexport function isRelationshipClassDifference(difference: AnySchemaDifference): difference is RelationshipClassDifference {\r\n return difference.schemaType === SchemaItemType.RelationshipClass;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of RelationshipConstraintDifference.\r\n * @alpha\r\n */\r\nexport function isRelationshipConstraintDifference(difference: AnySchemaDifference): difference is RelationshipConstraintDifference {\r\n return difference.schemaType === SchemaOtherTypes.RelationshipConstraint;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of RelationshipConstraintClassDifference.\r\n * @alpha\r\n */\r\nexport function isRelationshipConstraintClassDifference(difference: AnySchemaDifference): difference is RelationshipConstraintClassDifference {\r\n return difference.schemaType === SchemaOtherTypes.RelationshipConstraintClass;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of AnySchemaItemDifference.\r\n * @alpha\r\n */\r\nexport function isSchemaItemDifference(difference: AnySchemaDifference): difference is AnySchemaItemDifference {\r\n return difference.schemaType in SchemaItemType;\r\n}\r\n\r\n/**\r\n * Indicates whether the given difference is type of ClassItemDifference.\r\n * @alpha\r\n */\r\nexport function isClassDifference(difference: AnySchemaDifference): difference is AnyClassItemDifference {\r\n return isStructClassDifference(difference)\r\n || isCustomAttributeClassDifference(difference)\r\n || isEntityClassDifference(difference)\r\n || isMixinClassDifference(difference)\r\n || isRelationshipClassDifference(difference);\r\n}\r\n"]}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { type SchemaMergeContext } from "./SchemaMerger";
|
|
2
|
-
import {
|
|
2
|
+
import { AnyClassItemDifference } from "../Differencing/SchemaDifference";
|
|
3
3
|
import { ECClass, SchemaItemKey } from "@itwin/ecschema-metadata";
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare function mergeClassItems(context: SchemaMergeContext, classChanges: AnySchemaDifference[]): AsyncGenerator<never, void, unknown>;
|
|
8
4
|
/**
|
|
9
5
|
* Shared modify merger of all ECClass based items.
|
|
10
6
|
* @internal
|
|
11
7
|
*/
|
|
12
|
-
export declare function modifyClass(context: SchemaMergeContext, change:
|
|
8
|
+
export declare function modifyClass(context: SchemaMergeContext, change: AnyClassItemDifference, itemKey: SchemaItemKey, item: ECClass): Promise<void>;
|
|
13
9
|
//# sourceMappingURL=ClassMerger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClassMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/ClassMerger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ClassMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/ClassMerger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAG1E,OAAO,EAAmB,OAAO,EAAuC,aAAa,EAAkB,MAAM,0BAA0B,CAAC;AAIxI;;;GAGG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,sBAAsB,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BnJ"}
|
|
@@ -1,77 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.modifyClass =
|
|
4
|
-
const
|
|
3
|
+
exports.modifyClass = void 0;
|
|
4
|
+
const Utils_1 = require("./Utils");
|
|
5
5
|
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
6
|
-
const EntityClassMerger_1 = require("./EntityClassMerger");
|
|
7
|
-
const CAClassMerger_1 = require("./CAClassMerger");
|
|
8
|
-
const MixinMerger_1 = require("./MixinMerger");
|
|
9
|
-
const RelationshipClassMerger_1 = require("./RelationshipClassMerger");
|
|
10
6
|
const PropertyMerger_1 = require("./PropertyMerger");
|
|
11
7
|
const CustomAttributeMerger_1 = require("./CustomAttributeMerger");
|
|
12
|
-
const Utils = require("../Differencing/Utils");
|
|
13
|
-
/**
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
async function* mergeClassItems(context, classChanges) {
|
|
17
|
-
// In the first pass all class items will be created as stubs. That only applies to added entities.
|
|
18
|
-
await iterateClassChanges(classChanges, async (change, merger) => {
|
|
19
|
-
if (change.changeType === "add" && merger.add) {
|
|
20
|
-
// Make a copy of the change instance, we don't want to alter the actual instance.
|
|
21
|
-
const changeCopy = {
|
|
22
|
-
...change,
|
|
23
|
-
difference: {
|
|
24
|
-
...change.difference,
|
|
25
|
-
// Remove everything we want to validate before setting
|
|
26
|
-
baseClass: undefined,
|
|
27
|
-
mixins: undefined,
|
|
28
|
-
properties: undefined,
|
|
29
|
-
customAttributes: undefined,
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
await merger.add(context, changeCopy);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
// In the second pass the base classes and mixins get merged. At that add-changes are
|
|
36
|
-
// effectively modify changes now, as the items has been created in the first pass.
|
|
37
|
-
await iterateClassChanges(classChanges, async (change, merger) => {
|
|
38
|
-
if (merger.modify) {
|
|
39
|
-
const schemaItem = await (0, SchemaItemMerger_1.locateSchemaItem)(context, change.itemName, change.schemaType);
|
|
40
|
-
await merger.modify(context, change, schemaItem.key, schemaItem);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
for (const difference of classChanges.filter(Utils.isEntityClassMixinDifference)) {
|
|
44
|
-
await (0, EntityClassMerger_1.mergeClassMixins)(context, difference);
|
|
45
|
-
}
|
|
46
|
-
for (const difference of classChanges.filter(Utils.isRelationshipConstraintDifference)) {
|
|
47
|
-
await (0, RelationshipClassMerger_1.mergeRelationshipConstraint)(context, difference);
|
|
48
|
-
}
|
|
49
|
-
for (const difference of classChanges.filter(Utils.isRelationshipConstraintClassDifference)) {
|
|
50
|
-
await (0, RelationshipClassMerger_1.mergeRelationshipClassConstraint)(context, difference);
|
|
51
|
-
}
|
|
52
|
-
// At last step the properties that are added to existing classes or modified.
|
|
53
|
-
for (const difference of classChanges.filter(Utils.isClassPropertyDifference)) {
|
|
54
|
-
await (0, PropertyMerger_1.mergePropertyDifference)(context, difference);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.mergeClassItems = mergeClassItems;
|
|
58
|
-
async function iterateClassChanges(classChanges, handler) {
|
|
59
|
-
for (const difference of classChanges.filter(Utils.isCustomAttributeClassDifference)) {
|
|
60
|
-
await handler(difference, CAClassMerger_1.customAttributeClassMerger);
|
|
61
|
-
}
|
|
62
|
-
for (const difference of classChanges.filter(Utils.isMixinClassDifference)) {
|
|
63
|
-
await handler(difference, MixinMerger_1.mixinClassMerger);
|
|
64
|
-
}
|
|
65
|
-
for (const difference of classChanges.filter(Utils.isStructClassDifference)) {
|
|
66
|
-
await handler(difference, structClassMerger);
|
|
67
|
-
}
|
|
68
|
-
for (const difference of classChanges.filter(Utils.isEntityClassDifference)) {
|
|
69
|
-
await handler(difference, EntityClassMerger_1.entityClassMerger);
|
|
70
|
-
}
|
|
71
|
-
for (const difference of classChanges.filter(Utils.isRelationshipClassDifference)) {
|
|
72
|
-
await handler(difference, RelationshipClassMerger_1.relationshipClassMerger);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
8
|
/**
|
|
76
9
|
* Shared modify merger of all ECClass based items.
|
|
77
10
|
* @internal
|
|
@@ -84,7 +17,13 @@ async function modifyClass(context, change, itemKey, item) {
|
|
|
84
17
|
if (change.difference.description !== undefined) {
|
|
85
18
|
mutableClass.setDescription(change.difference.description);
|
|
86
19
|
}
|
|
87
|
-
if (change.difference.baseClass
|
|
20
|
+
if (change.difference.hasOwnProperty("baseClass")) {
|
|
21
|
+
// If the entry difference have a property baseClass and it is explicitly set to undefined,
|
|
22
|
+
// it is expected to remove the base class, which is not allowed in this case.
|
|
23
|
+
// TODO: We should consider using null for this case.
|
|
24
|
+
if (change.difference.baseClass === undefined) {
|
|
25
|
+
throw new Error(`Changing the class '${item.key.name}' baseClass is not supported.`);
|
|
26
|
+
}
|
|
88
27
|
await setBaseClass(context, item, change.difference.baseClass, change.changeType === "add");
|
|
89
28
|
}
|
|
90
29
|
if (change.difference.modifier !== undefined) {
|
|
@@ -99,10 +38,10 @@ async function modifyClass(context, change, itemKey, item) {
|
|
|
99
38
|
}
|
|
100
39
|
exports.modifyClass = modifyClass;
|
|
101
40
|
async function setBaseClass(context, item, baseClass, isInitial) {
|
|
102
|
-
|
|
103
|
-
const baseClassSetter = getBaseClassSetter(context, item);
|
|
104
|
-
if (!isInitial && item.baseClass === undefined)
|
|
41
|
+
if (!isInitial && (item.baseClass === undefined))
|
|
105
42
|
throw new Error(`Changing the class '${item.key.name}' baseClass is not supported.`);
|
|
43
|
+
const baseClassKey = await (0, Utils_1.updateSchemaItemKey)(context, baseClass);
|
|
44
|
+
const baseClassSetter = getBaseClassSetter(context, item);
|
|
106
45
|
await baseClassSetter(item.key, baseClassKey);
|
|
107
46
|
}
|
|
108
47
|
async function setClassModifier(item, modifierValue) {
|
|
@@ -128,13 +67,4 @@ function getBaseClassSetter(context, item) {
|
|
|
128
67
|
throw new Error(`Changing the base class '${item.name}' is not supported.`);
|
|
129
68
|
};
|
|
130
69
|
}
|
|
131
|
-
const structClassMerger = {
|
|
132
|
-
async add(context, change) {
|
|
133
|
-
return context.editor.structs.createFromProps(context.targetSchemaKey, {
|
|
134
|
-
name: change.itemName,
|
|
135
|
-
...change.difference,
|
|
136
|
-
});
|
|
137
|
-
},
|
|
138
|
-
modify: modifyClass,
|
|
139
|
-
};
|
|
140
70
|
//# sourceMappingURL=ClassMerger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/ClassMerger.ts"],"names":[],"mappings":";;;AAMA,yDAAoG;AAEpG,gEAAwI;AACxI,2DAA0E;AAC1E,mDAA6D;AAC7D,+CAAiD;AACjD,uEAAmI;AACnI,qDAAiF;AACjF,mEAAgE;AAChE,+CAA+C;AAI/C;;GAEG;AACI,KAAK,SAAS,CAAC,CAAC,eAAe,CAAC,OAA2B,EAAE,YAAmC;IACrG,mGAAmG;IACnG,MAAM,mBAAmB,CAAC,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;QAC/D,IAAI,MAAM,CAAC,UAAU,KAAK,KAAK,IAAI,MAAM,CAAC,GAAG,EAAE,CAAC;YAC9C,kFAAkF;YAClF,MAAM,UAAU,GAAG;gBACjB,GAAG,MAAM;gBACT,UAAU,EAAE;oBACV,GAAG,MAAM,CAAC,UAAU;oBACpB,uDAAuD;oBACvD,SAAS,EAAE,SAAS;oBACpB,MAAM,EAAE,SAAS;oBACjB,UAAU,EAAE,SAAS;oBACrB,gBAAgB,EAAE,SAAS;iBAC5B;aACF,CAAC;YACF,MAAM,MAAM,CAAC,GAAG,CAAC,OAAO,E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AC,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACrG,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,4BAA4B,IAAI,CAAC,IAAI,qBAAqB,CAAC,CAAC;IAC9E,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,iBAAiB,GAAmD;IACxE,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM;QACvB,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE;YACrE,IAAI,EAAE,MAAM,CAAC,QAAQ;YACrB,GAAG,MAAM,CAAC,UAAU;SACrB,CAAC,CAAC;IACL,CAAC;IACD,MAAM,EAAE,WAAW;CACpB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { type SchemaMergeContext } from \"./SchemaMerger\";\r\nimport { AnySchemaDifference, AnySchemaItemDifference, AnySchemaItemPathDifference, ClassItemDifference, StructClassDifference } from \"../Differencing/SchemaDifference\";\r\nimport { locateSchemaItem, SchemaItemMergerHandler, updateSchemaItemKey } from \"./SchemaItemMerger\";\r\nimport { type MutableClass } from \"../Editing/Mutable/MutableClass\";\r\nimport { CustomAttribute, ECClass, ECClassModifier, parseClassModifier, SchemaItemKey, SchemaItemType } from \"@itwin/ecschema-metadata\";\r\nimport { entityClassMerger, mergeClassMixins } from \"./EntityClassMerger\";\r\nimport { customAttributeClassMerger } from \"./CAClassMerger\";\r\nimport { mixinClassMerger } from \"./MixinMerger\";\r\nimport { mergeRelationshipClassConstraint, mergeRelationshipConstraint, relationshipClassMerger } from \"./RelationshipClassMerger\";\r\nimport { mergeClassProperties, mergePropertyDifference } from \"./PropertyMerger\";\r\nimport { applyCustomAttributes } from \"./CustomAttributeMerger\";\r\nimport * as Utils from \"../Differencing/Utils\";\r\n\r\ntype ClassItemHandler = <T extends AnySchemaItemDifference | AnySchemaItemPathDifference>(change: T, merger: SchemaItemMergerHandler<T>) => Promise<void>;\r\n\r\n/**\r\n * @internal\r\n */\r\nexport async function* mergeClassItems(context: SchemaMergeContext, classChanges: AnySchemaDifference[]) {\r\n // In the first pass all class items will be created as stubs. That only applies to added entities.\r\n await iterateClassChanges(classChanges, async (change, merger) => {\r\n if (change.changeType === \"add\" && merger.add) {\r\n // Make a copy of the change instance, we don't want to alter the actual instance.\r\n const changeCopy = {\r\n ...change,\r\n difference: {\r\n ...change.difference,\r\n // Remove everything we want to validate before setting\r\n baseClass: undefined,\r\n mixins: undefined,\r\n properties: undefined,\r\n customAttributes: undefined,\r\n },\r\n };\r\n await merger.add(context, changeCopy);\r\n }\r\n });\r\n\r\n // In the second pass the base classes and mixins get merged. At that add-changes are\r\n // effectively modify changes now, as the items has been created in the first pass.\r\n await iterateClassChanges(classChanges, async (change, merger) => {\r\n if (merger.modify) {\r\n const schemaItem = await locateSchemaItem(context, change.itemName, change.schemaType);\r\n await merger.modify(context, change, schemaItem.key, schemaItem);\r\n }\r\n });\r\n\r\n for (const difference of classChanges.filter(Utils.isEntityClassMixinDifference)) {\r\n await mergeClassMixins(context, difference);\r\n }\r\n\r\n for (const difference of classChanges.filter(Utils.isRelationshipConstraintDifference)) {\r\n await mergeRelationshipConstraint(context, difference);\r\n }\r\n\r\n for (const difference of classChanges.filter(Utils.isRelationshipConstraintClassDifference)) {\r\n await mergeRelationshipClassConstraint(context, difference);\r\n }\r\n\r\n // At last step the properties that are added to existing classes or modified.\r\n for (const difference of classChanges.filter(Utils.isClassPropertyDifference)) {\r\n await mergePropertyDifference(context, difference);\r\n }\r\n}\r\n\r\nasync function iterateClassChanges(classChanges: AnySchemaDifference[], handler: ClassItemHandler) {\r\n for (const difference of classChanges.filter(Utils.isCustomAttributeClassDifference)) {\r\n await handler(difference, customAttributeClassMerger);\r\n }\r\n\r\n for (const difference of classChanges.filter(Utils.isMixinClassDifference)) {\r\n await handler(difference, mixinClassMerger);\r\n }\r\n\r\n for (const difference of classChanges.filter(Utils.isStructClassDifference)) {\r\n await handler(difference, structClassMerger);\r\n }\r\n\r\n for (const difference of classChanges.filter(Utils.isEntityClassDifference)) {\r\n await handler(difference, entityClassMerger);\r\n }\r\n\r\n for (const difference of classChanges.filter(Utils.isRelationshipClassDifference)) {\r\n await handler(difference, relationshipClassMerger);\r\n }\r\n}\r\n\r\n/**\r\n * Shared modify merger of all ECClass based items.\r\n * @internal\r\n */\r\nexport async function modifyClass(context: SchemaMergeContext, change: ClassItemDifference, itemKey: SchemaItemKey, item: ECClass): Promise<void> {\r\n const mutableClass = item as MutableClass;\r\n if (change.difference.label !== undefined) {\r\n mutableClass.setDisplayLabel(change.difference.label);\r\n }\r\n\r\n if (change.difference.description !== undefined) {\r\n mutableClass.setDescription(change.difference.description);\r\n }\r\n\r\n if (change.difference.baseClass !== undefined) {\r\n await setBaseClass(context, item, change.difference.baseClass, change.changeType === \"add\");\r\n }\r\n\r\n if (change.difference.modifier !== undefined) {\r\n await setClassModifier(mutableClass, change.difference.modifier);\r\n }\r\n\r\n if (change.difference.customAttributes !== undefined) {\r\n await applyCustomAttributes(context, change.difference.customAttributes as CustomAttribute[], async (ca) => {\r\n await context.editor.entities.addCustomAttribute(itemKey, ca);\r\n });\r\n }\r\n\r\n return mergeClassProperties(context, change, itemKey);\r\n}\r\n\r\nasync function setBaseClass(context: SchemaMergeContext, item: ECClass, baseClass: string, isInitial: boolean): Promise<void> {\r\n const baseClassKey = await updateSchemaItemKey(context, baseClass);\r\n const baseClassSetter = getBaseClassSetter(context, item);\r\n if (!isInitial && item.baseClass === undefined)\r\n throw new Error(`Changing the class '${item.key.name}' baseClass is not supported.`);\r\n\r\n await baseClassSetter(item.key, baseClassKey);\r\n}\r\n\r\nasync function setClassModifier(item: MutableClass, modifierValue: string): Promise<void> {\r\n const modifier = parseClassModifier(modifierValue);\r\n if (modifier === undefined) {\r\n throw new Error(\"An invalid class modifier has been provided.\");\r\n }\r\n if (item.modifier === undefined || item.modifier === modifier || modifier === ECClassModifier.None) {\r\n item.setModifier(modifier);\r\n return;\r\n }\r\n throw new Error(`Changing the class '${item.name}' modifier is not supported.`);\r\n}\r\n\r\nfunction getBaseClassSetter(context: SchemaMergeContext, item: ECClass) {\r\n return async (itemKey: SchemaItemKey, baseClassKey: SchemaItemKey) => {\r\n switch (item.schemaItemType) {\r\n case SchemaItemType.CustomAttributeClass: return context.editor.customAttributes.setBaseClass(itemKey, baseClassKey);\r\n case SchemaItemType.EntityClass: return context.editor.entities.setBaseClass(itemKey, baseClassKey);\r\n case SchemaItemType.Mixin: return context.editor.mixins.setBaseClass(itemKey, baseClassKey);\r\n case SchemaItemType.RelationshipClass: return context.editor.relationships.setBaseClass(itemKey, baseClassKey);\r\n case SchemaItemType.StructClass: return context.editor.structs.setBaseClass(itemKey, baseClassKey);\r\n }\r\n throw new Error(`Changing the base class '${item.name}' is not supported.`);\r\n };\r\n}\r\n\r\nconst structClassMerger: SchemaItemMergerHandler<StructClassDifference> = {\r\n async add(context, change) {\r\n return context.editor.structs.createFromProps(context.targetSchemaKey, {\r\n name: change.itemName,\r\n ...change.difference,\r\n });\r\n },\r\n modify: modifyClass,\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"ClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/ClassMerger.ts"],"names":[],"mappings":";;;AAMA,mCAA8C;AAE9C,gEAAwI;AACxI,qDAAwD;AACxD,mEAAgE;AAEhE;;;GAGG;AACI,KAAK,UAAU,WAAW,CAAC,OAA2B,EAAE,MAA8B,EAAE,OAAsB,EAAE,IAAa;IAClI,MAAM,YAAY,GAAG,IAAoB,CAAC;IAC1C,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC1C,YAAY,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CA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,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YACpG,KAAK,kCAAc,CAAC,KAAK,CAAC,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAC5F,KAAK,kCAAc,CAAC,iBAAiB,CAAC,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAC/G,KAAK,kCAAc,CAAC,WAAW,CAAC,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACrG,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,4BAA4B,IAAI,CAAC,IAAI,qBAAqB,CAAC,CAAC;IAC9E,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { type SchemaMergeContext } from \"./SchemaMerger\";\r\nimport { AnyClassItemDifference } from \"../Differencing/SchemaDifference\";\r\nimport { updateSchemaItemKey } from \"./Utils\";\r\nimport { type MutableClass } from \"../Editing/Mutable/MutableClass\";\r\nimport { CustomAttribute, ECClass, ECClassModifier, parseClassModifier, SchemaItemKey, SchemaItemType } from \"@itwin/ecschema-metadata\";\r\nimport { mergeClassProperties } from \"./PropertyMerger\";\r\nimport { applyCustomAttributes } from \"./CustomAttributeMerger\";\r\n\r\n/**\r\n * Shared modify merger of all ECClass based items.\r\n * @internal\r\n */\r\nexport async function modifyClass(context: SchemaMergeContext, change: AnyClassItemDifference, itemKey: SchemaItemKey, item: ECClass): Promise<void> {\r\n const mutableClass = item as MutableClass;\r\n if (change.difference.label !== undefined) {\r\n mutableClass.setDisplayLabel(change.difference.label);\r\n }\r\n\r\n if (change.difference.description !== undefined) {\r\n mutableClass.setDescription(change.difference.description);\r\n }\r\n\r\n if (change.difference.hasOwnProperty(\"baseClass\")) {\r\n // If the entry difference have a property baseClass and it is explicitly set to undefined,\r\n // it is expected to remove the base class, which is not allowed in this case.\r\n // TODO: We should consider using null for this case.\r\n if(change.difference.baseClass === undefined) {\r\n throw new Error(`Changing the class '${item.key.name}' baseClass is not supported.`);\r\n }\r\n await setBaseClass(context, item, change.difference.baseClass, change.changeType === \"add\");\r\n }\r\n\r\n if (change.difference.modifier !== undefined) {\r\n await setClassModifier(mutableClass, change.difference.modifier);\r\n }\r\n\r\n if (change.difference.customAttributes !== undefined) {\r\n await applyCustomAttributes(context, change.difference.customAttributes as CustomAttribute[], async (ca) => {\r\n await context.editor.entities.addCustomAttribute(itemKey, ca);\r\n });\r\n }\r\n\r\n return mergeClassProperties(context, change, itemKey);\r\n}\r\n\r\nasync function setBaseClass(context: SchemaMergeContext, item: ECClass, baseClass: string, isInitial: boolean): Promise<void> {\r\n if (!isInitial && (item.baseClass === undefined))\r\n throw new Error(`Changing the class '${item.key.name}' baseClass is not supported.`);\r\n\r\n const baseClassKey = await updateSchemaItemKey(context, baseClass);\r\n const baseClassSetter = getBaseClassSetter(context, item);\r\n\r\n await baseClassSetter(item.key, baseClassKey);\r\n}\r\n\r\nasync function setClassModifier(item: MutableClass, modifierValue: string): Promise<void> {\r\n const modifier = parseClassModifier(modifierValue);\r\n if (modifier === undefined) {\r\n throw new Error(\"An invalid class modifier has been provided.\");\r\n }\r\n if (item.modifier === undefined || item.modifier === modifier || modifier === ECClassModifier.None) {\r\n item.setModifier(modifier);\r\n return;\r\n }\r\n throw new Error(`Changing the class '${item.name}' modifier is not supported.`);\r\n}\r\n\r\nfunction getBaseClassSetter(context: SchemaMergeContext, item: ECClass) {\r\n return async (itemKey: SchemaItemKey, baseClassKey: SchemaItemKey) => {\r\n switch (item.schemaItemType) {\r\n case SchemaItemType.CustomAttributeClass: return context.editor.customAttributes.setBaseClass(itemKey, baseClassKey);\r\n case SchemaItemType.EntityClass: return context.editor.entities.setBaseClass(itemKey, baseClassKey);\r\n case SchemaItemType.Mixin: return context.editor.mixins.setBaseClass(itemKey, baseClassKey);\r\n case SchemaItemType.RelationshipClass: return context.editor.relationships.setBaseClass(itemKey, baseClassKey);\r\n case SchemaItemType.StructClass: return context.editor.structs.setBaseClass(itemKey, baseClassKey);\r\n }\r\n throw new Error(`Changing the base class '${item.name}' is not supported.`);\r\n };\r\n}\r\n"]}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ConstantDifference } from "../Differencing/SchemaDifference";
|
|
2
|
+
import type { SchemaMergeContext } from "./SchemaMerger";
|
|
3
|
+
import { SchemaItemKey } from "@itwin/ecschema-metadata";
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* Merges a new Constant into the target schema.
|
|
5
6
|
* @internal
|
|
6
7
|
*/
|
|
7
|
-
export declare
|
|
8
|
+
export declare function addConstant(context: SchemaMergeContext, change: ConstantDifference): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Merges differences to an existing Constant in the target schema.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function modifyConstant(context: SchemaMergeContext, change: ConstantDifference, itemKey: SchemaItemKey): Promise<void>;
|
|
8
14
|
//# sourceMappingURL=ConstantMerger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConstantMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/ConstantMerger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ConstantMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/ConstantMerger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAwE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG/H;;;GAGG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,iBAkBxF;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,EAAE,OAAO,EAAE,aAAa,iBAqCnH"}
|
|
@@ -1,65 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const SchemaItemMerger_1 = require("./SchemaItemMerger");
|
|
3
|
+
exports.modifyConstant = exports.addConstant = void 0;
|
|
5
4
|
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
5
|
+
const Utils_1 = require("./Utils");
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Merges a new Constant into the target schema.
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
change.difference
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
10
|
+
async function addConstant(context, change) {
|
|
11
|
+
if (change.difference.phenomenon === undefined) {
|
|
12
|
+
throw new Error("Constant must define phenomenon");
|
|
13
|
+
}
|
|
14
|
+
if (change.difference.definition === undefined) {
|
|
15
|
+
throw new Error("Constant must define definition");
|
|
16
|
+
}
|
|
17
|
+
// Needs to update the reference from source to target schema.
|
|
18
|
+
change.difference.phenomenon = await (0, Utils_1.updateSchemaItemFullName)(context, change.difference.phenomenon);
|
|
19
|
+
await context.editor.constants.createFromProps(context.targetSchemaKey, {
|
|
20
|
+
...change.difference,
|
|
21
|
+
name: change.itemName,
|
|
22
|
+
schemaItemType: change.schemaType,
|
|
23
|
+
phenomenon: change.difference.phenomenon,
|
|
24
|
+
definition: change.difference.definition,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.addConstant = addConstant;
|
|
28
|
+
/**
|
|
29
|
+
* Merges differences to an existing Constant in the target schema.
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
async function modifyConstant(context, change, itemKey) {
|
|
33
|
+
const constant = await context.targetSchema.lookupItem(itemKey);
|
|
34
|
+
if (change.difference.label !== undefined) {
|
|
35
|
+
await context.editor.constants.setDisplayLabel(itemKey, change.difference.label);
|
|
36
|
+
}
|
|
37
|
+
if (change.difference.description !== undefined) {
|
|
38
|
+
await context.editor.constants.setDescription(itemKey, change.difference.description);
|
|
39
|
+
}
|
|
40
|
+
// Note: There are no editor methods to modify a constant.
|
|
41
|
+
if (change.difference.definition !== undefined) {
|
|
42
|
+
if (change.difference.definition !== "" && constant.definition.toLowerCase() !== change.difference.definition.toLowerCase()) {
|
|
43
|
+
throw new ecschema_metadata_1.ECObjectsError(ecschema_metadata_1.ECObjectsStatus.InvalidECJson, `The Constant ${itemKey.name} has an invalid 'definition' attribute.`);
|
|
42
44
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
constant.setDefinition(change.difference.definition);
|
|
46
|
+
}
|
|
47
|
+
if (change.difference.denominator !== undefined) {
|
|
48
|
+
if (constant.hasDenominator && constant.denominator !== change.difference.denominator) {
|
|
49
|
+
throw new Error(`Failed to merged, constant denominator conflict: ${change.difference.denominator} -> ${constant.denominator}`);
|
|
48
50
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
constant.setDenominator(change.difference.denominator);
|
|
52
|
+
}
|
|
53
|
+
if (change.difference.numerator !== undefined) {
|
|
54
|
+
if (constant.hasNumerator && constant.numerator !== change.difference.numerator) {
|
|
55
|
+
throw new Error(`Failed to merged, constant numerator conflict: ${change.difference.numerator} -> ${constant.numerator}`);
|
|
54
56
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
constant.setNumerator(change.difference.numerator);
|
|
58
|
+
}
|
|
59
|
+
if (change.difference.phenomenon !== undefined) {
|
|
60
|
+
const lookupKey = await (0, Utils_1.updateSchemaItemKey)(context, change.difference.phenomenon);
|
|
61
|
+
const phenomenon = await context.editor.schemaContext.getSchemaItem(lookupKey);
|
|
62
|
+
if (phenomenon === undefined) {
|
|
63
|
+
throw new Error(`Could not find phenomenon ${lookupKey.fullName} in the current context`);
|
|
62
64
|
}
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
+
constant.setPhenomenon(new ecschema_metadata_1.DelayedPromiseWithProps(phenomenon.key, async () => phenomenon));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.modifyConstant = modifyConstant;
|
|
65
69
|
//# sourceMappingURL=ConstantMerger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConstantMerger.js","sourceRoot":"","sources":["../../../src/Merging/ConstantMerger.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ConstantMerger.js","sourceRoot":"","sources":["../../../src/Merging/ConstantMerger.ts"],"names":[],"mappings":";;;AAOA,gEAA+H;AAC/H,mCAAwE;AAExE;;;GAGG;AACI,KAAK,UAAU,WAAW,CAAC,OAA2B,EAAE,MAA0B;IACvF,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,KAAK,SAAS,E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AK,SAAS,EAAE,CAAC;QAC/C,MAAM,SAAS,GAAG,MAAM,IAAA,2BAAmB,EAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACnF,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,CAAa,SAAS,CAAC,CAAC;QAC3F,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,6BAA6B,SAAS,CAAC,QAAQ,yBAAyB,CAAC,CAAC;QAC5F,CAAC;QAED,QAAQ,CAAC,aAAa,CAAC,IAAI,2CAAuB,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9F,CAAC;AACH,CAAC;AArCD,wCAqCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport type { ConstantDifference } from \"../Differencing/SchemaDifference\";\r\nimport type{ MutableConstant } from \"../Editing/Mutable/MutableConstant\";\r\nimport type { SchemaMergeContext } from \"./SchemaMerger\";\r\nimport { DelayedPromiseWithProps, ECObjectsError, ECObjectsStatus, Phenomenon, SchemaItemKey } from \"@itwin/ecschema-metadata\";\r\nimport { updateSchemaItemFullName, updateSchemaItemKey } from \"./Utils\";\r\n\r\n/**\r\n * Merges a new Constant into the target schema.\r\n * @internal\r\n */\r\nexport async function addConstant(context: SchemaMergeContext, change: ConstantDifference) {\r\n if (change.difference.phenomenon === undefined) {\r\n throw new Error(\"Constant must define phenomenon\");\r\n }\r\n if (change.difference.definition === undefined) {\r\n throw new Error(\"Constant must define definition\");\r\n }\r\n\r\n // Needs to update the reference from source to target schema.\r\n change.difference.phenomenon = await updateSchemaItemFullName(context, change.difference.phenomenon);\r\n\r\n await context.editor.constants.createFromProps(context.targetSchemaKey, {\r\n ...change.difference,\r\n name: change.itemName,\r\n schemaItemType: change.schemaType,\r\n phenomenon: change.difference.phenomenon,\r\n definition: change.difference.definition,\r\n });\r\n}\r\n\r\n/**\r\n * Merges differences to an existing Constant in the target schema.\r\n * @internal\r\n */\r\nexport async function modifyConstant(context: SchemaMergeContext, change: ConstantDifference, itemKey: SchemaItemKey) {\r\n const constant = await context.targetSchema.lookupItem(itemKey) as MutableConstant;\r\n if (change.difference.label !== undefined) {\r\n await context.editor.constants.setDisplayLabel(itemKey, change.difference.label);\r\n }\r\n if (change.difference.description !== undefined) {\r\n await context.editor.constants.setDescription(itemKey, change.difference.description);\r\n }\r\n\r\n // Note: There are no editor methods to modify a constant.\r\n if (change.difference.definition !== undefined) {\r\n if (change.difference.definition !== \"\" && constant.definition.toLowerCase() !== change.difference.definition.toLowerCase()) {\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Constant ${itemKey.name} has an invalid 'definition' attribute.`);\r\n }\r\n constant.setDefinition(change.difference.definition);\r\n }\r\n if (change.difference.denominator !== undefined) {\r\n if (constant.hasDenominator && constant.denominator !== change.difference.denominator) {\r\n throw new Error(`Failed to merged, constant denominator conflict: ${change.difference.denominator} -> ${constant.denominator}`);\r\n }\r\n constant.setDenominator(change.difference.denominator);\r\n }\r\n if (change.difference.numerator !== undefined) {\r\n if (constant.hasNumerator && constant.numerator !== change.difference.numerator) {\r\n throw new Error(`Failed to merged, constant numerator conflict: ${change.difference.numerator} -> ${constant.numerator}`);\r\n }\r\n constant.setNumerator(change.difference.numerator);\r\n }\r\n if (change.difference.phenomenon !== undefined) {\r\n const lookupKey = await updateSchemaItemKey(context, change.difference.phenomenon);\r\n const phenomenon = await context.editor.schemaContext.getSchemaItem<Phenomenon>(lookupKey);\r\n if (phenomenon === undefined) {\r\n throw new Error(`Could not find phenomenon ${lookupKey.fullName} in the current context`);\r\n }\r\n\r\n constant.setPhenomenon(new DelayedPromiseWithProps(phenomenon.key, async () => phenomenon));\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CustomAttributeClassDifference } from "../Differencing/SchemaDifference";
|
|
2
|
+
import type { SchemaMergeContext } from "./SchemaMerger";
|
|
3
|
+
import { SchemaItemKey } from "@itwin/ecschema-metadata";
|
|
4
|
+
/**
|
|
5
|
+
* Merges a new CustomAttribute into the target schema.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare function addCustomAttributeClass(context: SchemaMergeContext, change: CustomAttributeClassDifference): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Merges differences to an existing CustomAttribute in the target schema.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function modifyCustomAttributeClass(context: SchemaMergeContext, change: CustomAttributeClassDifference, itemKey: SchemaItemKey): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=CustomAttributeClassMerger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomAttributeClassMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/CustomAttributeClassMerger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAEvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAA4D,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGnH;;;GAGG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,8BAA8B,iBAWhH;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,8BAA8B,EAAE,OAAO,EAAE,aAAa,iBAa3I"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.modifyCustomAttributeClass = exports.addCustomAttributeClass = void 0;
|
|
4
|
+
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
5
|
+
const ClassMerger_1 = require("./ClassMerger");
|
|
6
|
+
/**
|
|
7
|
+
* Merges a new CustomAttribute into the target schema.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
async function addCustomAttributeClass(context, change) {
|
|
11
|
+
if (change.difference.appliesTo === undefined) {
|
|
12
|
+
throw new Error("appliesTo is a required property of a CustomAttributeClass but it is not set");
|
|
13
|
+
}
|
|
14
|
+
await context.editor.customAttributes.createFromProps(context.targetSchemaKey, {
|
|
15
|
+
...change.difference,
|
|
16
|
+
name: change.itemName,
|
|
17
|
+
schemaItemType: change.schemaType,
|
|
18
|
+
appliesTo: change.difference.appliesTo,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.addCustomAttributeClass = addCustomAttributeClass;
|
|
22
|
+
/**
|
|
23
|
+
* Merges differences to an existing CustomAttribute in the target schema.
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
async function modifyCustomAttributeClass(context, change, itemKey) {
|
|
27
|
+
const item = await context.targetSchema.lookupItem(itemKey);
|
|
28
|
+
if (change.difference.appliesTo !== undefined) {
|
|
29
|
+
const currentValue = (0, ecschema_metadata_1.containerTypeToString)(item.appliesTo);
|
|
30
|
+
if (currentValue !== "" && change.difference.appliesTo !== currentValue) {
|
|
31
|
+
const containerType = (0, ecschema_metadata_1.parseCustomAttributeContainerType)(`${currentValue}, ${change.difference.appliesTo}`);
|
|
32
|
+
if (containerType === undefined) {
|
|
33
|
+
throw new Error("An invalid custom attribute class containerType has been provided.");
|
|
34
|
+
}
|
|
35
|
+
item.setAppliesTo(containerType);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return (0, ClassMerger_1.modifyClass)(context, change, itemKey, item);
|
|
39
|
+
}
|
|
40
|
+
exports.modifyCustomAttributeClass = modifyCustomAttributeClass;
|
|
41
|
+
//# sourceMappingURL=CustomAttributeClass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EAAoE,CAAC,CAAC;YACxF,CAAC;YACD,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IACD,OAAO,IAAA,yBAAW,EAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACrD,CAAC;AAbD,gEAaC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport type { CustomAttributeClassDifference } from \"../Differencing/SchemaDifference\";\r\nimport type { MutableCAClass } from \"../Editing/Mutable/MutableCAClass\";\r\nimport type { SchemaMergeContext } from \"./SchemaMerger\";\r\nimport { containerTypeToString, parseCustomAttributeContainerType, SchemaItemKey } from \"@itwin/ecschema-metadata\";\r\nimport { modifyClass } from \"./ClassMerger\";\r\n\r\n/**\r\n * Merges a new CustomAttribute into the target schema.\r\n * @internal\r\n */\r\nexport async function addCustomAttributeClass(context: SchemaMergeContext, change: CustomAttributeClassDifference) {\r\n if (change.difference.appliesTo === undefined) {\r\n throw new Error(\"appliesTo is a required property of a CustomAttributeClass but it is not set\");\r\n }\r\n\r\n await context.editor.customAttributes.createFromProps(context.targetSchemaKey, {\r\n ...change.difference,\r\n name: change.itemName,\r\n schemaItemType: change.schemaType,\r\n appliesTo: change.difference.appliesTo,\r\n });\r\n}\r\n\r\n/**\r\n * Merges differences to an existing CustomAttribute in the target schema.\r\n * @internal\r\n */\r\nexport async function modifyCustomAttributeClass(context: SchemaMergeContext, change: CustomAttributeClassDifference, itemKey: SchemaItemKey) {\r\n const item = await context.targetSchema.lookupItem(itemKey) as MutableCAClass;\r\n if (change.difference.appliesTo !== undefined) {\r\n const currentValue = containerTypeToString(item.appliesTo);\r\n if (currentValue !== \"\" && change.difference.appliesTo !== currentValue) {\r\n const containerType = parseCustomAttributeContainerType(`${currentValue}, ${change.difference.appliesTo}`);\r\n if (containerType === undefined) {\r\n throw new Error(\"An invalid custom attribute class containerType has been provided.\");\r\n }\r\n item.setAppliesTo(containerType);\r\n }\r\n }\r\n return modifyClass(context, change, itemKey, item);\r\n}\r\n"]}
|