@itwin/ecschema-editing 4.5.0-dev.8 → 4.6.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +62 -1
  2. package/LICENSE.md +1 -1
  3. package/lib/cjs/Differencing/SchemaConflicts.d.ts +76 -0
  4. package/lib/cjs/Differencing/SchemaConflicts.d.ts.map +1 -0
  5. package/lib/cjs/Differencing/SchemaConflicts.js +56 -0
  6. package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -0
  7. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts +43 -0
  8. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -0
  9. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +501 -0
  10. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -0
  11. package/lib/cjs/Differencing/SchemaDifference.d.ts +150 -0
  12. package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -0
  13. package/lib/cjs/Differencing/SchemaDifference.js +54 -0
  14. package/lib/cjs/Differencing/SchemaDifference.js.map +1 -0
  15. package/lib/cjs/Editing/ECClasses.d.ts +9 -2
  16. package/lib/cjs/Editing/ECClasses.d.ts.map +1 -1
  17. package/lib/cjs/Editing/ECClasses.js +25 -0
  18. package/lib/cjs/Editing/ECClasses.js.map +1 -1
  19. package/lib/cjs/Editing/Entities.d.ts +8 -2
  20. package/lib/cjs/Editing/Entities.d.ts.map +1 -1
  21. package/lib/cjs/Editing/Entities.js +29 -6
  22. package/lib/cjs/Editing/Entities.js.map +1 -1
  23. package/lib/cjs/Editing/Mixins.d.ts +7 -1
  24. package/lib/cjs/Editing/Mixins.d.ts.map +1 -1
  25. package/lib/cjs/Editing/Mixins.js +15 -0
  26. package/lib/cjs/Editing/Mixins.js.map +1 -1
  27. package/lib/cjs/Editing/RelationshipClasses.d.ts +7 -1
  28. package/lib/cjs/Editing/RelationshipClasses.d.ts.map +1 -1
  29. package/lib/cjs/Editing/RelationshipClasses.js +20 -1
  30. package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
  31. package/lib/cjs/Merging/CAClassMerger.d.ts.map +1 -1
  32. package/lib/cjs/Merging/CAClassMerger.js +1 -5
  33. package/lib/cjs/Merging/CAClassMerger.js.map +1 -1
  34. package/lib/cjs/Merging/ClassMerger.d.ts +4 -3
  35. package/lib/cjs/Merging/ClassMerger.d.ts.map +1 -1
  36. package/lib/cjs/Merging/ClassMerger.js +57 -49
  37. package/lib/cjs/Merging/ClassMerger.js.map +1 -1
  38. package/lib/cjs/Merging/EntityClassMerger.d.ts +3 -2
  39. package/lib/cjs/Merging/EntityClassMerger.d.ts.map +1 -1
  40. package/lib/cjs/Merging/EntityClassMerger.js +22 -7
  41. package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
  42. package/lib/cjs/Merging/MixinMerger.d.ts.map +1 -1
  43. package/lib/cjs/Merging/MixinMerger.js +1 -5
  44. package/lib/cjs/Merging/MixinMerger.js.map +1 -1
  45. package/lib/cjs/Merging/PropertyMerger.d.ts +21 -0
  46. package/lib/cjs/Merging/PropertyMerger.d.ts.map +1 -0
  47. package/lib/cjs/Merging/PropertyMerger.js +315 -0
  48. package/lib/cjs/Merging/PropertyMerger.js.map +1 -0
  49. package/lib/cjs/Merging/RelationshipClassMerger.d.ts +15 -0
  50. package/lib/cjs/Merging/RelationshipClassMerger.d.ts.map +1 -0
  51. package/lib/cjs/Merging/RelationshipClassMerger.js +132 -0
  52. package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -0
  53. package/lib/cjs/Merging/SchemaMerger.d.ts.map +1 -1
  54. package/lib/cjs/Merging/SchemaMerger.js +7 -3
  55. package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
  56. package/lib/cjs/ecschema-editing.d.ts +4 -0
  57. package/lib/cjs/ecschema-editing.d.ts.map +1 -1
  58. package/lib/cjs/ecschema-editing.js +4 -0
  59. package/lib/cjs/ecschema-editing.js.map +1 -1
  60. package/package.json +10 -10
  61. package/lib/cjs/Merging/AnyPropertyMerger.d.ts +0 -15
  62. package/lib/cjs/Merging/AnyPropertyMerger.d.ts.map +0 -1
  63. package/lib/cjs/Merging/AnyPropertyMerger.js +0 -71
  64. package/lib/cjs/Merging/AnyPropertyMerger.js.map +0 -1
  65. package/lib/cjs/Merging/ArrayPropertyMerger.d.ts +0 -32
  66. package/lib/cjs/Merging/ArrayPropertyMerger.d.ts.map +0 -1
  67. package/lib/cjs/Merging/ArrayPropertyMerger.js +0 -143
  68. package/lib/cjs/Merging/ArrayPropertyMerger.js.map +0 -1
  69. package/lib/cjs/Merging/ClassPropertyMerger.d.ts +0 -16
  70. package/lib/cjs/Merging/ClassPropertyMerger.d.ts.map +0 -1
  71. package/lib/cjs/Merging/ClassPropertyMerger.js +0 -90
  72. package/lib/cjs/Merging/ClassPropertyMerger.js.map +0 -1
  73. package/lib/cjs/Merging/PrimitiveOrEnumPropertyMerger.d.ts +0 -24
  74. package/lib/cjs/Merging/PrimitiveOrEnumPropertyMerger.d.ts.map +0 -1
  75. package/lib/cjs/Merging/PrimitiveOrEnumPropertyMerger.js +0 -106
  76. package/lib/cjs/Merging/PrimitiveOrEnumPropertyMerger.js.map +0 -1
  77. package/lib/cjs/Merging/StructPropertyMerger.d.ts +0 -11
  78. package/lib/cjs/Merging/StructPropertyMerger.d.ts.map +0 -1
  79. package/lib/cjs/Merging/StructPropertyMerger.js +0 -47
  80. package/lib/cjs/Merging/StructPropertyMerger.js.map +0 -1
@@ -1,106 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnumerationPropertyMerger = exports.PrimitivePropertyMerger = void 0;
4
- /*---------------------------------------------------------------------------------------------
5
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
- * See LICENSE.md in the project root for license terms and full copyright notice.
7
- *--------------------------------------------------------------------------------------------*/
8
- const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
9
- const AnyPropertyMerger_1 = require("./AnyPropertyMerger");
10
- /**
11
- * @internal
12
- */
13
- class PrimitiveOrEnumPropertyMerger extends AnyPropertyMerger_1.AnyPropertyMerger {
14
- async mergeAttributes(property, attributeName, attributeNewValue, attributeOldValue) {
15
- const results = await super.mergeAttributes(property, attributeName, attributeNewValue, attributeOldValue);
16
- if (results === true || this.isPropertyEditResults(results) && results.errorMessage !== undefined) {
17
- return results;
18
- }
19
- const mutableProperty = property;
20
- switch (attributeName) {
21
- case "extendedTypeName": {
22
- mutableProperty.setExtendedTypeName(attributeNewValue);
23
- return true;
24
- }
25
- case "minLength": {
26
- mutableProperty.setMinLength(attributeNewValue);
27
- return true;
28
- }
29
- case "maxLength": {
30
- mutableProperty.setMaxLength(attributeNewValue);
31
- return true;
32
- }
33
- case "minValue": {
34
- mutableProperty.setMinValue(attributeNewValue);
35
- return true;
36
- }
37
- case "maxValue": {
38
- mutableProperty.setMaxValue(attributeNewValue);
39
- return true;
40
- }
41
- }
42
- return false;
43
- }
44
- }
45
- /**
46
- * @internal
47
- */
48
- class PrimitivePropertyMerger extends PrimitiveOrEnumPropertyMerger {
49
- async createFromProps(classKey, property) {
50
- const results = await super.getPropertyProps(property);
51
- if (this.isPropertyEditResults(results) && results.errorMessage !== undefined) {
52
- return results;
53
- }
54
- const props = {
55
- ...property.toJSON(),
56
- ...results,
57
- };
58
- return this.context.editor.entities.createPrimitivePropertyFromProps(classKey, property.name, property.primitiveType, props);
59
- }
60
- }
61
- exports.PrimitivePropertyMerger = PrimitivePropertyMerger;
62
- /**
63
- * @internal
64
- */
65
- class EnumerationPropertyMerger extends PrimitiveOrEnumPropertyMerger {
66
- async mergeAttributes(property, attributeName, attributeNewValue, attributeOldValue) {
67
- const results = await super.mergeAttributes(property, attributeName, attributeNewValue, attributeOldValue);
68
- if (results === true || this.isPropertyEditResults(results) && results.errorMessage !== undefined) {
69
- return results;
70
- }
71
- switch (attributeName) {
72
- case "enumeration": {
73
- if (attributeOldValue !== undefined) {
74
- return { errorMessage: `Changing the property '${property.name}' enumeration is not supported.` };
75
- }
76
- return true;
77
- }
78
- }
79
- return false;
80
- }
81
- async createFromProps(classKey, property) {
82
- const results = await super.getPropertyProps(property);
83
- if (this.isPropertyEditResults(results) && results.errorMessage !== undefined) {
84
- return results;
85
- }
86
- if (property.enumeration === undefined) {
87
- return { errorMessage: `Property ${property.fullName} is missing the required 'enumeration' attribute.` };
88
- }
89
- const enumeration = await property.enumeration;
90
- const itemKey = new ecschema_metadata_1.SchemaItemKey(enumeration.name, this.context.sourceSchema.schemaKey.matches(enumeration.schema.schemaKey)
91
- ? this.context.targetSchema.schemaKey
92
- : enumeration.schema.schemaKey);
93
- const type = await this.context.targetSchema.lookupItem(itemKey);
94
- if (type === undefined) {
95
- return { errorMessage: `Unable to locate the enumeration class ${enumeration.name} in the merged schema.` };
96
- }
97
- const props = {
98
- ...property.toJSON(),
99
- ...results,
100
- typeName: type.fullName,
101
- };
102
- return this.context.editor.entities.createEnumerationPropertyFromProps(classKey, property.name, type, props);
103
- }
104
- }
105
- exports.EnumerationPropertyMerger = EnumerationPropertyMerger;
106
- //# sourceMappingURL=PrimitiveOrEnumPropertyMerger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrimitiveOrEnumPropertyMerger.js","sourceRoot":"","sources":["../../../src/Merging/PrimitiveOrEnumPropertyMerger.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAA6L;AAC7L,2DAAwD;AAIxD;;GAEG;AACH,MAAe,6BAAgG,SAAQ,qCAA+C;IACpJ,KAAK,CAAC,eAAe,CAAC,QAAsC,EAAE,aAAqB,EAAE,iBAAsB,EAAE,iBAAsB;QACjJ,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,eAAe,CAAC,QAAQ,EAAE,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;QAC3G,IAAI,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,qBAAqB,CAAC,O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AE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC;YAC3H,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS;YACrC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAC/B,CAAC;QACF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAc,OAAO,CAAC,CAAC;QAC9E,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,OAAO,EAAE,YAAY,EAAE,0CAA0C,WAAW,CAAC,IAAI,wBAAwB,EAAE,CAAC;SAC7G;QAED,MAAM,KAAK,GAA6B;YACtC,GAAG,QAAQ,CAAC,MAAM,EAAE;YACpB,GAAG,OAAO;YACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;QACF,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kCAAkC,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/G,CAAC;CACF;AA7CD,8DA6CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { Enumeration, EnumerationProperty, EnumerationPropertyProps, PrimitiveOrEnumPropertyBase, PrimitiveProperty, PrimitivePropertyProps, SchemaItemKey } from \"@itwin/ecschema-metadata\";\nimport { AnyPropertyMerger } from \"./AnyPropertyMerger\";\nimport { PropertyEditResults } from \"../Editing/Editor\";\nimport { MutablePrimitiveOrEnumPropertyBase } from \"../Editing/Mutable/MutablePrimitiveOrEnumProperty\";\n\n/**\n * @internal\n */\nabstract class PrimitiveOrEnumPropertyMerger<TPrimitiveOrEnumPropertyBase extends PrimitiveOrEnumPropertyBase> extends AnyPropertyMerger<TPrimitiveOrEnumPropertyBase> {\n public override async mergeAttributes(property: TPrimitiveOrEnumPropertyBase, attributeName: string, attributeNewValue: any, attributeOldValue: any): Promise<PropertyEditResults | boolean> {\n const results = await super.mergeAttributes(property, attributeName, attributeNewValue, attributeOldValue);\n if (results === true || this.isPropertyEditResults(results) && results.errorMessage !== undefined) {\n return results;\n }\n\n const mutableProperty = property as unknown as MutablePrimitiveOrEnumPropertyBase;\n switch (attributeName) {\n case \"extendedTypeName\": {\n mutableProperty.setExtendedTypeName(attributeNewValue);\n return true;\n }\n case \"minLength\": {\n mutableProperty.setMinLength(attributeNewValue);\n return true;\n }\n case \"maxLength\": {\n mutableProperty.setMaxLength(attributeNewValue);\n return true;\n }\n case \"minValue\": {\n mutableProperty.setMinValue(attributeNewValue);\n return true;\n }\n case \"maxValue\": {\n mutableProperty.setMaxValue(attributeNewValue);\n return true;\n }\n }\n return false;\n }\n}\n\n/**\n * @internal\n */\nexport class PrimitivePropertyMerger extends PrimitiveOrEnumPropertyMerger<PrimitiveProperty> {\n public override async createFromProps(classKey: SchemaItemKey, property: PrimitiveProperty): Promise<PropertyEditResults> {\n const results = await super.getPropertyProps(property);\n if (this.isPropertyEditResults(results) && results.errorMessage !== undefined) {\n return results;\n }\n\n const props: PrimitivePropertyProps = {\n ...property.toJSON(),\n ...results,\n };\n return this.context.editor.entities.createPrimitivePropertyFromProps(classKey, property.name, property.primitiveType, props);\n }\n}\n\n/**\n * @internal\n */\nexport class EnumerationPropertyMerger extends PrimitiveOrEnumPropertyMerger<EnumerationProperty> {\n public override async mergeAttributes(property: EnumerationProperty, attributeName: string, attributeNewValue: any, attributeOldValue: any): Promise<PropertyEditResults | boolean> {\n const results = await super.mergeAttributes(property, attributeName, attributeNewValue, attributeOldValue);\n if (results === true || this.isPropertyEditResults(results) && results.errorMessage !== undefined) {\n return results;\n }\n\n switch (attributeName) {\n case \"enumeration\": {\n if (attributeOldValue !== undefined) {\n return { errorMessage: `Changing the property '${property.name}' enumeration is not supported.` };\n }\n return true;\n }\n }\n return false;\n }\n\n public override async createFromProps(classKey: SchemaItemKey, property: EnumerationProperty): Promise<PropertyEditResults> {\n const results = await super.getPropertyProps(property);\n if (this.isPropertyEditResults(results) && results.errorMessage !== undefined) {\n return results;\n }\n\n if (property.enumeration === undefined) {\n return { errorMessage: `Property ${property.fullName} is missing the required 'enumeration' attribute.` };\n }\n\n const enumeration = await property.enumeration;\n const itemKey = new SchemaItemKey(enumeration.name, this.context.sourceSchema.schemaKey.matches(enumeration.schema.schemaKey)\n ? this.context.targetSchema.schemaKey\n : enumeration.schema.schemaKey,\n );\n const type = await this.context.targetSchema.lookupItem<Enumeration>(itemKey);\n if (type === undefined) {\n return { errorMessage: `Unable to locate the enumeration class ${enumeration.name} in the merged schema.` };\n }\n\n const props: EnumerationPropertyProps = {\n ...property.toJSON(),\n ...results,\n typeName: type.fullName,\n };\n return this.context.editor.entities.createEnumerationPropertyFromProps(classKey, property.name, type, props);\n }\n}\n"]}
@@ -1,11 +0,0 @@
1
- import { SchemaItemKey, StructProperty } from "@itwin/ecschema-metadata";
2
- import { AnyPropertyMerger } from "./AnyPropertyMerger";
3
- import { PropertyEditResults } from "../Editing/Editor";
4
- /**
5
- * @internal
6
- */
7
- export declare class StructPropertyMerger extends AnyPropertyMerger<StructProperty> {
8
- mergeAttributes(property: StructProperty, attributeName: string, attributeNewValue: any, attributeOldValue: any): Promise<PropertyEditResults | boolean>;
9
- createFromProps(classKey: SchemaItemKey, property: StructProperty): Promise<PropertyEditResults>;
10
- }
11
- //# sourceMappingURL=StructPropertyMerger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StructPropertyMerger.d.ts","sourceRoot":"","sources":["../../../src/Merging/StructPropertyMerger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAe,cAAc,EAAuB,MAAM,0BAA0B,CAAC;AAC3G,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,iBAAiB,CAAC,cAAc,CAAC;IACnD,eAAe,CAAC,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,EAAE,iBAAiB,EAAE,GAAG,GAAG,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC;IAcxJ,eAAe,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAsBvH"}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StructPropertyMerger = void 0;
4
- /*---------------------------------------------------------------------------------------------
5
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
- * See LICENSE.md in the project root for license terms and full copyright notice.
7
- *--------------------------------------------------------------------------------------------*/
8
- const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
9
- const AnyPropertyMerger_1 = require("./AnyPropertyMerger");
10
- /**
11
- * @internal
12
- */
13
- class StructPropertyMerger extends AnyPropertyMerger_1.AnyPropertyMerger {
14
- async mergeAttributes(property, attributeName, attributeNewValue, attributeOldValue) {
15
- const results = await super.mergeAttributes(property, attributeName, attributeNewValue, attributeOldValue);
16
- if (results === true || this.isPropertyEditResults(results) && results.errorMessage !== undefined) {
17
- return results;
18
- }
19
- switch (attributeName) {
20
- case "structClass": {
21
- return { errorMessage: `Changing the property '${property.name}' structClass is not supported.` };
22
- }
23
- }
24
- return false;
25
- }
26
- async createFromProps(classKey, property) {
27
- const results = await super.getPropertyProps(property);
28
- if (this.isPropertyEditResults(results) && results.errorMessage !== undefined) {
29
- return results;
30
- }
31
- const itemKey = new ecschema_metadata_1.SchemaItemKey(property.structClass.name, this.context.sourceSchema.schemaKey.matches(property.structClass.schema.schemaKey)
32
- ? this.context.targetSchema.schemaKey
33
- : property.structClass.schema.schemaKey);
34
- const type = await this.context.targetSchema.lookupItem(itemKey);
35
- if (type === undefined) {
36
- return { errorMessage: `Unable to locate the struct class ${property.structClass.name} in the merged schema.` };
37
- }
38
- const props = {
39
- ...property.toJSON(),
40
- ...results,
41
- typeName: type.fullName,
42
- };
43
- return this.context.editor.entities.createStructPropertyFromProps(classKey, property.name, type, props);
44
- }
45
- }
46
- exports.StructPropertyMerger = StructPropertyMerger;
47
- //# sourceMappingURL=StructPropertyMerger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StructPropertyMerger.js","sourceRoot":"","sources":["../../../src/Merging/StructPropertyMerger.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAA2G;AAC3G,2DAAwD;AAGxD;;GAEG;AACH,MAAa,oBAAqB,SAAQ,qCAAiC;IACzD,KAAK,CAAC,eAAe,CAAC,QAAwB,EAAE,aAAqB,EAAE,iBAAsB,EAAE,iBAAsB;QACnI,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,eAAe,CAAC,QAAQ,EAAE,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;QAC3G,IAAI,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE;YACjG,OAAO,OAAO,CAAC;SAChB;QAED,QAAQ,aAAa,EAAE;YACrB,KAAK,aAAa,CAAC,CAAC;gBAClB,OAAO,EAAE,YAAY,EAAE,0BAA0B,QAAQ,CAAC,IAAI,iCAAiC,EAAE,CAAC;aACnG;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAEe,KAAK,CAAC,eAAe,CAAC,QAAuB,EAAE,QAAwB;QACrF,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACvD,IAAI,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE;YAC7E,OAAO,OAAO,CAAC;SAChB;QAED,MAAM,OAAO,GAAG,IAAI,iCAAa,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC;YAC7I,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS;YACrC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CACxC,CAAC;QACF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAc,OAAO,CAAC,CAAC;QAC9E,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,OAAO,EAAE,YAAY,EAAE,qCAAqC,QAAQ,CAAC,WAAW,CAAC,IAAI,wBAAwB,EAAE,CAAC;SACjH;QAED,MAAM,KAAK,GAAwB;YACjC,GAAG,QAAQ,CAAC,MAAM,EAAE;YACpB,GAAG,OAAO;YACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;QACF,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,6BAA6B,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1G,CAAC;CACF;AArCD,oDAqCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { SchemaItemKey, StructClass, StructProperty, StructPropertyProps } from \"@itwin/ecschema-metadata\";\nimport { AnyPropertyMerger } from \"./AnyPropertyMerger\";\nimport { PropertyEditResults } from \"../Editing/Editor\";\n\n/**\n * @internal\n */\nexport class StructPropertyMerger extends AnyPropertyMerger<StructProperty> {\n public override async mergeAttributes(property: StructProperty, attributeName: string, attributeNewValue: any, attributeOldValue: any): Promise<PropertyEditResults | boolean> {\n const results = await super.mergeAttributes(property, attributeName, attributeNewValue, attributeOldValue);\n if (results === true || this.isPropertyEditResults(results) && results.errorMessage !== undefined) {\n return results;\n }\n\n switch (attributeName) {\n case \"structClass\": {\n return { errorMessage: `Changing the property '${property.name}' structClass is not supported.` };\n }\n }\n return false;\n }\n\n public override async createFromProps(classKey: SchemaItemKey, property: StructProperty): Promise<PropertyEditResults> {\n const results = await super.getPropertyProps(property);\n if (this.isPropertyEditResults(results) && results.errorMessage !== undefined) {\n return results;\n }\n\n const itemKey = new SchemaItemKey(property.structClass.name, this.context.sourceSchema.schemaKey.matches(property.structClass.schema.schemaKey)\n ? this.context.targetSchema.schemaKey\n : property.structClass.schema.schemaKey,\n );\n const type = await this.context.targetSchema.lookupItem<StructClass>(itemKey);\n if (type === undefined) {\n return { errorMessage: `Unable to locate the struct class ${property.structClass.name} in the merged schema.` };\n }\n\n const props: StructPropertyProps = {\n ...property.toJSON(),\n ...results,\n typeName: type.fullName,\n };\n return this.context.editor.entities.createStructPropertyFromProps(classKey, property.name, type, props);\n }\n}\n"]}