@itwin/ecschema-editing 4.9.0-dev.23 → 4.9.0-dev.25

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 (106) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/Differencing/Errors.js.map +1 -1
  3. package/lib/cjs/Differencing/SchemaConflicts.d.ts +2 -2
  4. package/lib/cjs/Differencing/SchemaConflicts.d.ts.map +1 -1
  5. package/lib/cjs/Differencing/SchemaConflicts.js +2 -0
  6. package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
  7. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts +0 -9
  8. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.d.ts.map +1 -1
  9. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js +19 -168
  10. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
  11. package/lib/cjs/Differencing/SchemaDifference.d.ts.map +1 -1
  12. package/lib/cjs/Differencing/SchemaDifference.js +3 -1
  13. package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
  14. package/lib/cjs/Differencing/SchemaDifferenceValidator.d.ts +17 -0
  15. package/lib/cjs/Differencing/SchemaDifferenceValidator.d.ts.map +1 -0
  16. package/lib/cjs/Differencing/SchemaDifferenceValidator.js +450 -0
  17. package/lib/cjs/Differencing/SchemaDifferenceValidator.js.map +1 -0
  18. package/lib/cjs/Differencing/SchemaDifferenceVisitor.d.ts +29 -0
  19. package/lib/cjs/Differencing/SchemaDifferenceVisitor.d.ts.map +1 -0
  20. package/lib/cjs/Differencing/SchemaDifferenceVisitor.js +82 -0
  21. package/lib/cjs/Differencing/SchemaDifferenceVisitor.js.map +1 -0
  22. package/lib/cjs/Differencing/Utils.js.map +1 -1
  23. package/lib/cjs/Editing/Constants.js.map +1 -1
  24. package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
  25. package/lib/cjs/Editing/ECClasses.js.map +1 -1
  26. package/lib/cjs/Editing/Editor.js.map +1 -1
  27. package/lib/cjs/Editing/Entities.js.map +1 -1
  28. package/lib/cjs/Editing/Enumerations.js.map +1 -1
  29. package/lib/cjs/Editing/Exception.js.map +1 -1
  30. package/lib/cjs/Editing/Formats.js.map +1 -1
  31. package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
  32. package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
  33. package/lib/cjs/Editing/Mixins.js.map +1 -1
  34. package/lib/cjs/Editing/Mutable/MutableArrayProperty.js.map +1 -1
  35. package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
  36. package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
  37. package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
  38. package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
  39. package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
  40. package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
  41. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
  42. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
  43. package/lib/cjs/Editing/Mutable/MutableMixin.js.map +1 -1
  44. package/lib/cjs/Editing/Mutable/MutableNavigationProperty.js.map +1 -1
  45. package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
  46. package/lib/cjs/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -1
  47. package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
  48. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
  49. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
  50. package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
  51. package/lib/cjs/Editing/Mutable/MutableSchemaItem.js.map +1 -1
  52. package/lib/cjs/Editing/Mutable/MutableStructProperty.js.map +1 -1
  53. package/lib/cjs/Editing/Mutable/MutableUnit.js.map +1 -1
  54. package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
  55. package/lib/cjs/Editing/Phenomena.js.map +1 -1
  56. package/lib/cjs/Editing/Properties.js.map +1 -1
  57. package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
  58. package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
  59. package/lib/cjs/Editing/SchemaItems.js.map +1 -1
  60. package/lib/cjs/Editing/Structs.js.map +1 -1
  61. package/lib/cjs/Editing/UnitSystems.js.map +1 -1
  62. package/lib/cjs/Editing/Units.js.map +1 -1
  63. package/lib/cjs/Merging/CAClassMerger.js.map +1 -1
  64. package/lib/cjs/Merging/ClassMerger.js.map +1 -1
  65. package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
  66. package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
  67. package/lib/cjs/Merging/Edits/RenameEditHandler.d.ts.map +1 -1
  68. package/lib/cjs/Merging/Edits/RenameEditHandler.js +27 -45
  69. package/lib/cjs/Merging/Edits/RenameEditHandler.js.map +1 -1
  70. package/lib/cjs/Merging/Edits/SchemaEdits.d.ts +4 -4
  71. package/lib/cjs/Merging/Edits/SchemaEdits.d.ts.map +1 -1
  72. package/lib/cjs/Merging/Edits/SchemaEdits.js +8 -8
  73. package/lib/cjs/Merging/Edits/SchemaEdits.js.map +1 -1
  74. package/lib/cjs/Merging/Edits/SkipEditHandler.d.ts.map +1 -1
  75. package/lib/cjs/Merging/Edits/SkipEditHandler.js +4 -1
  76. package/lib/cjs/Merging/Edits/SkipEditHandler.js.map +1 -1
  77. package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
  78. package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
  79. package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
  80. package/lib/cjs/Merging/MixinMerger.js.map +1 -1
  81. package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
  82. package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -1
  83. package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
  84. package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
  85. package/lib/cjs/Merging/SchemaItemMerger.js.map +1 -1
  86. package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
  87. package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
  88. package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -1
  89. package/lib/cjs/Validation/Diagnostic.js.map +1 -1
  90. package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
  91. package/lib/cjs/Validation/ECRules.js.map +1 -1
  92. package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
  93. package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
  94. package/lib/cjs/Validation/Rules.js.map +1 -1
  95. package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
  96. package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
  97. package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
  98. package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
  99. package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
  100. package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
  101. package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
  102. package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
  103. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  104. package/lib/cjs/ecschema-editing.js.map +1 -1
  105. package/package.json +9 -9
  106. package/public/locales/en/ECSchemaEditing.json +26 -26
@@ -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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AAM,CAAC,gBAAgB,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YACrH,KAAK,kCAAc,CAAC,WAAW,CAAC,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;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,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,EAAE,UAAU,CAAC,CAAC;QACxC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,qFAAqF;IACrF,mFAAmF;IACnF,MAAM,mBAAmB,CAAC,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;QAC/D,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,MAAM,UAAU,GAAG,MAAM,IAAA,mCAAgB,EAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;YACvF,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,C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CAAC,QAAQ;YACrB,GAAG,MAAM,CAAC,UAAU;SACrB,CAAC,CAAC;IACL,CAAC;IACD,MAAM,EAAE,WAAW;CACpB,CAAC","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 { type SchemaMergeContext } from \"./SchemaMerger\";\nimport { AnySchemaDifference, AnySchemaItemDifference, AnySchemaItemPathDifference, ClassItemDifference, StructClassDifference } from \"../Differencing/SchemaDifference\";\nimport { locateSchemaItem, SchemaItemMergerHandler, updateSchemaItemKey } from \"./SchemaItemMerger\";\nimport { type MutableClass } from \"../Editing/Mutable/MutableClass\";\nimport { CustomAttribute, ECClass, ECClassModifier, parseClassModifier, SchemaItemKey, SchemaItemType } from \"@itwin/ecschema-metadata\";\nimport { entityClassMerger, mergeClassMixins } from \"./EntityClassMerger\";\nimport { customAttributeClassMerger } from \"./CAClassMerger\";\nimport { mixinClassMerger } from \"./MixinMerger\";\nimport { mergeRelationshipClassConstraint, mergeRelationshipConstraint, relationshipClassMerger } from \"./RelationshipClassMerger\";\nimport { mergeClassProperties, mergePropertyDifference } from \"./PropertyMerger\";\nimport { applyCustomAttributes } from \"./CustomAttributeMerger\";\nimport * as Utils from \"../Differencing/Utils\";\n\ntype ClassItemHandler = <T extends AnySchemaItemDifference | AnySchemaItemPathDifference>(change: T, merger: SchemaItemMergerHandler<T>) => Promise<void>;\n\n/**\n * @internal\n */\nexport async function* mergeClassItems(context: SchemaMergeContext, classChanges: AnySchemaDifference[]) {\n // In the first pass all class items will be created as stubs. That only applies to added entities.\n await iterateClassChanges(classChanges, async (change, merger) => {\n if (change.changeType === \"add\" && merger.add) {\n // Make a copy of the change instance, we don't want to alter the actual instance.\n const changeCopy = {\n ...change,\n difference: {\n ...change.difference,\n // Remove everything we want to validate before setting\n baseClass: undefined,\n mixins: undefined,\n properties: undefined,\n customAttributes: undefined,\n },\n };\n await merger.add(context, changeCopy);\n }\n });\n\n // In the second pass the base classes and mixins get merged. At that add-changes are\n // effectively modify changes now, as the items has been created in the first pass.\n await iterateClassChanges(classChanges, async (change, merger) => {\n if (merger.modify) {\n const schemaItem = await locateSchemaItem(context, change.itemName, change.schemaType);\n await merger.modify(context, change, schemaItem.key, schemaItem);\n }\n });\n\n for (const difference of classChanges.filter(Utils.isEntityClassMixinDifference)) {\n await mergeClassMixins(context, difference);\n }\n\n for (const difference of classChanges.filter(Utils.isRelationshipConstraintDifference)) {\n await mergeRelationshipConstraint(context, difference);\n }\n\n for (const difference of classChanges.filter(Utils.isRelationshipConstraintClassDifference)) {\n await mergeRelationshipClassConstraint(context, difference);\n }\n\n // At last step the properties that are added to existing classes or modified.\n for (const difference of classChanges.filter(Utils.isClassPropertyDifference)) {\n await mergePropertyDifference(context, difference);\n }\n}\n\nasync function iterateClassChanges(classChanges: AnySchemaDifference[], handler: ClassItemHandler) {\n for (const difference of classChanges.filter(Utils.isCustomAttributeClassDifference)) {\n await handler(difference, customAttributeClassMerger);\n }\n\n for (const difference of classChanges.filter(Utils.isMixinClassDifference)) {\n await handler(difference, mixinClassMerger);\n }\n\n for (const difference of classChanges.filter(Utils.isStructClassDifference)) {\n await handler(difference, structClassMerger);\n }\n\n for (const difference of classChanges.filter(Utils.isEntityClassDifference)) {\n await handler(difference, entityClassMerger);\n }\n\n for (const difference of classChanges.filter(Utils.isRelationshipClassDifference)) {\n await handler(difference, relationshipClassMerger);\n }\n}\n\n/**\n * Shared modify merger of all ECClass based items.\n * @internal\n */\nexport async function modifyClass(context: SchemaMergeContext, change: ClassItemDifference, itemKey: SchemaItemKey, item: ECClass): Promise<void> {\n const mutableClass = item as MutableClass;\n if (change.difference.label !== undefined) {\n mutableClass.setDisplayLabel(change.difference.label);\n }\n\n if (change.difference.description !== undefined) {\n mutableClass.setDescription(change.difference.description);\n }\n\n if (change.difference.baseClass !== undefined) {\n await setBaseClass(context, item, change.difference.baseClass, change.changeType === \"add\");\n }\n\n if (change.difference.modifier !== undefined) {\n await setClassModifier(mutableClass, change.difference.modifier);\n }\n\n if (change.difference.customAttributes !== undefined) {\n await applyCustomAttributes(context, change.difference.customAttributes as CustomAttribute[], async (ca) => {\n await context.editor.entities.addCustomAttribute(itemKey, ca);\n });\n }\n\n return mergeClassProperties(context, change, itemKey);\n}\n\nasync function setBaseClass(context: SchemaMergeContext, item: ECClass, baseClass: string, isInitial: boolean): Promise<void> {\n const baseClassKey = await updateSchemaItemKey(context, baseClass);\n const baseClassSetter = getBaseClassSetter(context, item);\n if (!isInitial && item.baseClass === undefined)\n throw new Error(`Changing the class '${item.key.name}' baseClass is not supported.`);\n\n await baseClassSetter(item.key, baseClassKey);\n}\n\nasync function setClassModifier(item: MutableClass, modifierValue: string): Promise<void> {\n const modifier = parseClassModifier(modifierValue);\n if (modifier === undefined) {\n throw new Error(\"An invalid class modifier has been provided.\");\n }\n if (item.modifier === undefined || item.modifier === modifier || modifier === ECClassModifier.None) {\n item.setModifier(modifier);\n return;\n }\n throw new Error(`Changing the class '${item.name}' modifier is not supported.`);\n}\n\nfunction getBaseClassSetter(context: SchemaMergeContext, item: ECClass) {\n return async (itemKey: SchemaItemKey, baseClassKey: SchemaItemKey) => {\n switch (item.schemaItemType) {\n case SchemaItemType.CustomAttributeClass: return context.editor.customAttributes.setBaseClass(itemKey, baseClassKey);\n case SchemaItemType.EntityClass: return context.editor.entities.setBaseClass(itemKey, baseClassKey);\n case SchemaItemType.Mixin: return context.editor.mixins.setBaseClass(itemKey, baseClassKey);\n case SchemaItemType.RelationshipClass: return context.editor.relationships.setBaseClass(itemKey, baseClassKey);\n case SchemaItemType.StructClass: return context.editor.structs.setBaseClass(itemKey, baseClassKey);\n }\n throw new Error(`Changing the base class '${item.name}' is not supported.`);\n };\n}\n\nconst structClassMerger: SchemaItemMergerHandler<StructClassDifference> = {\n async add(context, change) {\n return context.editor.structs.createFromProps(context.targetSchemaKey, {\n name: change.itemName,\n ...change.difference,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EAAE,CAAC,CAAC;YACxH,CAAC;YACD,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YAC/C,MAAM,SAAS,GAAG,MAAM,IAAA,sCAAmB,EAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;YACnF,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,CAAa,SAAS,CAAC,CAAC;YAC3F,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;gBAC7B,MAAM,IAAI,KAAK,CAAC,6BAA6B,SAAS,CAAC,QAAQ,yBAAyB,CAAC,CAAC;YAC5F,CAAC;YAED,IAAI,CAAC,aAAa,CAAC,IAAI,2CAAuB,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC;CACF,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 ConstantDifference } from \"../Differencing/SchemaDifference\";\r\nimport { type SchemaItemMergerHandler, updateSchemaItemKey } from \"./SchemaItemMerger\";\r\nimport { type MutableConstant } from \"../Editing/Mutable/MutableConstant\";\r\nimport { DelayedPromiseWithProps, ECObjectsError, ECObjectsStatus, Phenomenon } from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * Defines a merge handler to merge Constant schema items.\r\n * @internal\r\n */\r\nexport const constantMerger: SchemaItemMergerHandler<ConstantDifference> = {\r\n async add(context, change) {\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 const phenomenonKey = await updateSchemaItemKey(context, change.difference.phenomenon);\r\n change.difference.phenomenon = phenomenonKey.fullName;\r\n\r\n return 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 async modify(context, change, itemKey, item: MutableConstant) {\r\n if (change.difference.label !== undefined) {\r\n item.setDisplayLabel(change.difference.label);\r\n }\r\n if (change.difference.description !== undefined) {\r\n item.setDescription(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 !== \"\" && item.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 item.setDefinition(change.difference.definition);\r\n }\r\n if (change.difference.denominator !== undefined) {\r\n if (item.hasDenominator && item.denominator !== change.difference.denominator) {\r\n throw new Error(`Failed to merged, constant denominator conflict: ${change.difference.denominator} -> ${item.denominator}`);\r\n }\r\n item.setDenominator(change.difference.denominator);\r\n }\r\n if (change.difference.numerator !== undefined) {\r\n if (item.hasNumerator && item.numerator !== change.difference.numerator) {\r\n throw new Error(`Failed to merged, constant numerator conflict: ${change.difference.numerator} -> ${item.numerator}`);\r\n }\r\n item.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 item.setPhenomenon(new DelayedPromiseWithProps(phenomenon.key, async () => phenomenon));\r\n }\r\n },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;YACD,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YAC/C,MAAM,SAAS,GAAG,MAAM,IAAA,sCAAmB,EAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;YACnF,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,CAAa,SAAS,CAAC,CAAC;YAC3F,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;gBAC7B,MAAM,IAAI,KAAK,CAAC,6BAA6B,SAAS,CAAC,QAAQ,yBAAyB,CAAC,CAAC;YAC5F,CAAC;YAED,IAAI,CAAC,aAAa,CAAC,IAAI,2CAAuB,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC;CACF,CAAC","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 { type ConstantDifference } from \"../Differencing/SchemaDifference\";\nimport { type SchemaItemMergerHandler, updateSchemaItemKey } from \"./SchemaItemMerger\";\nimport { type MutableConstant } from \"../Editing/Mutable/MutableConstant\";\nimport { DelayedPromiseWithProps, ECObjectsError, ECObjectsStatus, Phenomenon } from \"@itwin/ecschema-metadata\";\n\n/**\n * Defines a merge handler to merge Constant schema items.\n * @internal\n */\nexport const constantMerger: SchemaItemMergerHandler<ConstantDifference> = {\n async add(context, change) {\n if (change.difference.phenomenon === undefined) {\n throw new Error(\"Constant must define phenomenon\");\n }\n if (change.difference.definition === undefined) {\n throw new Error(\"Constant must define definition\");\n }\n\n // Needs to update the reference from source to target schema.\n const phenomenonKey = await updateSchemaItemKey(context, change.difference.phenomenon);\n change.difference.phenomenon = phenomenonKey.fullName;\n\n return context.editor.constants.createFromProps(context.targetSchemaKey, {\n ...change.difference,\n name: change.itemName,\n schemaItemType: change.schemaType,\n phenomenon: change.difference.phenomenon,\n definition: change.difference.definition,\n });\n },\n async modify(context, change, itemKey, item: MutableConstant) {\n if (change.difference.label !== undefined) {\n item.setDisplayLabel(change.difference.label);\n }\n if (change.difference.description !== undefined) {\n item.setDescription(change.difference.description);\n }\n\n // Note: There are no editor methods to modify a constant.\n if (change.difference.definition !== undefined) {\n if (change.difference.definition !== \"\" && item.definition.toLowerCase() !== change.difference.definition.toLowerCase()) {\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Constant ${itemKey.name} has an invalid 'definition' attribute.`);\n }\n item.setDefinition(change.difference.definition);\n }\n if (change.difference.denominator !== undefined) {\n if (item.hasDenominator && item.denominator !== change.difference.denominator) {\n throw new Error(`Failed to merged, constant denominator conflict: ${change.difference.denominator} -> ${item.denominator}`);\n }\n item.setDenominator(change.difference.denominator);\n }\n if (change.difference.numerator !== undefined) {\n if (item.hasNumerator && item.numerator !== change.difference.numerator) {\n throw new Error(`Failed to merged, constant numerator conflict: ${change.difference.numerator} -> ${item.numerator}`);\n }\n item.setNumerator(change.difference.numerator);\n }\n if (change.difference.phenomenon !== undefined) {\n const lookupKey = await updateSchemaItemKey(context, change.difference.phenomenon);\n const phenomenon = await context.editor.schemaContext.getSchemaItem<Phenomenon>(lookupKey);\n if (phenomenon === undefined) {\n throw new Error(`Could not find phenomenon ${lookupKey.fullName} in the current context`);\n }\n\n item.setPhenomenon(new DelayedPromiseWithProps(phenomenon.key, async () => phenomenon));\n }\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CustomAttributeMerger.js","sourceRoot":"","sources":["../../../src/Merging/CustomAttributeMerger.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAmH;AAGnH,yDAAmF;AAInF;;;;;;;GAOG;AACI,KAAK,UA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AC,OAA2B,EAAE,eAAgC,EAAE,OAA8B;IACtI,eAAe,CAAC,SAAS,GAAG,MAAM,IAAA,2CAAwB,EAAC,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAC/F,OAAO,OAAO,CAAC,eAAe,CAAC,CAAC;AAClC,CAAC;AAHD,oDAGC","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 { CustomAttribute, CustomAttributeClass, RelationshipClass, SchemaItemKey } from \"@itwin/ecschema-metadata\";\r\nimport { type SchemaMergeContext } from \"./SchemaMerger\";\r\nimport { type CustomAttributeDifference } from \"../Differencing/SchemaDifference\";\r\nimport { updateSchemaItemFullName, updateSchemaItemKey } from \"./SchemaItemMerger\";\r\n\r\ntype CustomAttributeSetter = (customAttribute: CustomAttribute) => Promise<void>;\r\n\r\n/**\r\n * Merges the custom attributes of the given changes iterable. The third parameter is a callback to pass\r\n * a scope (Class, Property, Schema) specific handler.\r\n * @param context The current schema merging context.\r\n * @param change The individual custom attribute change.\r\n * @returns A EditResults object.\r\n * @internal\r\n */\r\nexport async function mergeCustomAttribute(context: SchemaMergeContext, change: CustomAttributeDifference): Promise<void> {\r\n if (change.changeType === \"add\") {\r\n if (change.difference.className === undefined) {\r\n throw new Error(\"CustomAttribute instance must specify className\");\r\n }\r\n const schemaItemKey = await updateSchemaItemKey(context, change.difference.className);\r\n\r\n const targetCustomAttributeClass = await context.targetSchema.lookupItem<CustomAttributeClass>(schemaItemKey);\r\n if (targetCustomAttributeClass === undefined) {\r\n throw new Error(`Unable to locate the custom attribute class ${schemaItemKey.name} in the merged schema.`);\r\n }\r\n\r\n const caInstance: CustomAttribute = {\r\n ...change.difference,\r\n className: schemaItemKey.fullName,\r\n };\r\n\r\n if (change.appliedTo === \"Schema\") {\r\n await context.editor.addCustomAttribute(context.targetSchemaKey, caInstance);\r\n }\r\n if (change.appliedTo === \"SchemaItem\") {\r\n const itemKey = new SchemaItemKey(change.itemName, context.targetSchemaKey);\r\n await context.editor.entities.addCustomAttribute(itemKey, caInstance);\r\n }\r\n if (change.appliedTo === \"Property\") {\r\n const itemKey = new SchemaItemKey(change.itemName, context.targetSchemaKey);\r\n const [propertyName] = change.path.split(\".\");\r\n await context.editor.entities.properties.addCustomAttribute(itemKey, propertyName, caInstance);\r\n }\r\n if (change.appliedTo === \"RelationshipConstraint\") {\r\n const itemKey = new SchemaItemKey(change.itemName, context.targetSchemaKey);\r\n const relationshipClass = await context.targetSchema.lookupItem<RelationshipClass>(itemKey);\r\n if (relationshipClass === undefined) {\r\n throw new Error(`Unable to locate the relationship class ${itemKey.name} in the merged schema.`);\r\n }\r\n const constraint = change.path === \"$source\"\r\n ? relationshipClass.source\r\n : relationshipClass.target;\r\n\r\n return context.editor.relationships.addCustomAttributeToConstraint(constraint, caInstance);\r\n }\r\n } else {\r\n throw new Error(`Changes of Custom Attribute on merge is not implemented.`);\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport async function applyCustomAttributes(context: SchemaMergeContext, customAttributes: CustomAttribute[], handler: CustomAttributeSetter): Promise<void> {\r\n for (const customAttribute of customAttributes) {\r\n await applyCustomAttribute(context, customAttribute, handler);\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport async function applyCustomAttribute(context: SchemaMergeContext, customAttribute: CustomAttribute, handler: CustomAttributeSetter): Promise<void> {\r\n customAttribute.className = await updateSchemaItemFullName(context, customAttribute.className);\r\n return handler(customAttribute);\r\n}\r\n"]}
1
+ {"version":3,"file":"CustomAttributeMerger.js","sourceRoot":"","sources":["../../../src/Merging/CustomAttributeMerger.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAmH;AAGnH,yDAAmF;AAInF;;;;;;;GAOG;AACI,KAAK,UAAU,oBAAoB,CAAC,OAA2B,EAAE,MAAiC;IACvG,IAA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,CAAC,SAAS,GAAG,MAAM,IAAA,2CAAwB,EAAC,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAC/F,OAAO,OAAO,CAAC,eAAe,CAAC,CAAC;AAClC,CAAC;AAHD,oDAGC","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 { CustomAttribute, CustomAttributeClass, RelationshipClass, SchemaItemKey } from \"@itwin/ecschema-metadata\";\nimport { type SchemaMergeContext } from \"./SchemaMerger\";\nimport { type CustomAttributeDifference } from \"../Differencing/SchemaDifference\";\nimport { updateSchemaItemFullName, updateSchemaItemKey } from \"./SchemaItemMerger\";\n\ntype CustomAttributeSetter = (customAttribute: CustomAttribute) => Promise<void>;\n\n/**\n * Merges the custom attributes of the given changes iterable. The third parameter is a callback to pass\n * a scope (Class, Property, Schema) specific handler.\n * @param context The current schema merging context.\n * @param change The individual custom attribute change.\n * @returns A EditResults object.\n * @internal\n */\nexport async function mergeCustomAttribute(context: SchemaMergeContext, change: CustomAttributeDifference): Promise<void> {\n if (change.changeType === \"add\") {\n if (change.difference.className === undefined) {\n throw new Error(\"CustomAttribute instance must specify className\");\n }\n const schemaItemKey = await updateSchemaItemKey(context, change.difference.className);\n\n const targetCustomAttributeClass = await context.targetSchema.lookupItem<CustomAttributeClass>(schemaItemKey);\n if (targetCustomAttributeClass === undefined) {\n throw new Error(`Unable to locate the custom attribute class ${schemaItemKey.name} in the merged schema.`);\n }\n\n const caInstance: CustomAttribute = {\n ...change.difference,\n className: schemaItemKey.fullName,\n };\n\n if (change.appliedTo === \"Schema\") {\n await context.editor.addCustomAttribute(context.targetSchemaKey, caInstance);\n }\n if (change.appliedTo === \"SchemaItem\") {\n const itemKey = new SchemaItemKey(change.itemName, context.targetSchemaKey);\n await context.editor.entities.addCustomAttribute(itemKey, caInstance);\n }\n if (change.appliedTo === \"Property\") {\n const itemKey = new SchemaItemKey(change.itemName, context.targetSchemaKey);\n const [propertyName] = change.path.split(\".\");\n await context.editor.entities.properties.addCustomAttribute(itemKey, propertyName, caInstance);\n }\n if (change.appliedTo === \"RelationshipConstraint\") {\n const itemKey = new SchemaItemKey(change.itemName, context.targetSchemaKey);\n const relationshipClass = await context.targetSchema.lookupItem<RelationshipClass>(itemKey);\n if (relationshipClass === undefined) {\n throw new Error(`Unable to locate the relationship class ${itemKey.name} in the merged schema.`);\n }\n const constraint = change.path === \"$source\"\n ? relationshipClass.source\n : relationshipClass.target;\n\n return context.editor.relationships.addCustomAttributeToConstraint(constraint, caInstance);\n }\n } else {\n throw new Error(`Changes of Custom Attribute on merge is not implemented.`);\n }\n}\n\n/**\n * @internal\n */\nexport async function applyCustomAttributes(context: SchemaMergeContext, customAttributes: CustomAttribute[], handler: CustomAttributeSetter): Promise<void> {\n for (const customAttribute of customAttributes) {\n await applyCustomAttribute(context, customAttribute, handler);\n }\n}\n\n/**\n * @internal\n */\nexport async function applyCustomAttribute(context: SchemaMergeContext, customAttribute: CustomAttribute, handler: CustomAttributeSetter): Promise<void> {\n customAttribute.className = await updateSchemaItemFullName(context, customAttribute.className);\n return handler(customAttribute);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RenameEditHandler.d.ts","sourceRoot":"","sources":["../../../../src/Merging/Edits/RenameEditHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAA6I,sBAAsB,EAAgC,MAAM,qCAAqC,CAAC;AAQtP;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,sBAAsB,EAAE,IAAI,EAAE,kBAAkB,QA8B/F;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,sBAAsB,EAAE,IAAI,EAAE,oBAAoB,EAAE,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAAI,QA0C7I"}
1
+ {"version":3,"file":"RenameEditHandler.d.ts","sourceRoot":"","sources":["../../../../src/Merging/Edits/RenameEditHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAA6I,sBAAsB,EAAgC,MAAM,qCAAqC,CAAC;AAQtP;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,sBAAsB,EAAE,IAAI,EAAE,kBAAkB,QAuB/F;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,sBAAsB,EAAE,IAAI,EAAE,oBAAoB,EAAE,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAAI,QA2B7I"}
@@ -15,67 +15,48 @@ const Utils = require("../../Differencing/Utils");
15
15
  * @internal
16
16
  */
17
17
  function applyRenamePropertyEdit(result, edit) {
18
- const [itemName, path] = edit.key.split(".");
19
- let entryIndex = result.differences.findIndex((entry) => {
18
+ const [schemaName, itemName, path] = edit.key.split(".");
19
+ if (!result.sourceSchemaName.startsWith(schemaName)) {
20
+ return;
21
+ }
22
+ const difference = result.differences.find((entry) => {
20
23
  return Utils.isClassPropertyDifference(entry) && entry.changeType === "add" && entry.itemName === itemName && entry.path === path;
21
24
  });
22
- if (entryIndex === -1 && result.conflicts) {
23
- const conflictIndex = result.conflicts.findIndex((entry) => {
24
- return entry.itemName === itemName && entry.path === path;
25
- });
25
+ const propertyDifference = difference;
26
+ if (propertyDifference === undefined) {
27
+ return;
28
+ }
29
+ propertyDifference.path = edit.value;
30
+ if (result.conflicts) {
31
+ const conflictIndex = result.conflicts.findIndex((entry) => entry.itemName === itemName && entry.path === path);
26
32
  if (conflictIndex > -1) {
27
- const conflictEntry = result.conflicts[conflictIndex];
28
- entryIndex = result.differences.push({
29
- changeType: "add",
30
- schemaType: SchemaDifference_1.SchemaOtherTypes.Property,
31
- itemName,
32
- path,
33
- difference: conflictEntry.difference,
34
- }) - 1;
35
33
  result.conflicts.splice(conflictIndex, 1);
36
34
  }
37
35
  }
38
- const propertyEntry = result.differences[entryIndex];
39
- if (propertyEntry) {
40
- propertyEntry.path = edit.value;
41
- }
42
36
  }
43
37
  exports.applyRenamePropertyEdit = applyRenamePropertyEdit;
44
38
  /**
45
39
  * @internal
46
40
  */
47
41
  function applyRenameSchemaItemEdit(result, edit, postProcessing) {
48
- let difference = result.differences.find((entry) => {
49
- return Utils.isSchemaItemDifference(entry) && entry.changeType === "add" && entry.itemName === edit.key;
50
- });
51
- if (difference === undefined && result.conflicts) {
52
- const conflictIndex = result.conflicts.findIndex((entry) => entry.itemName === edit.key && entry.path === undefined);
53
- if (conflictIndex > -1) {
54
- const conflictEntry = result.conflicts[conflictIndex];
55
- result.differences.push(difference = {
56
- changeType: "add",
57
- schemaType: conflictEntry.schemaType,
58
- itemName: edit.value,
59
- difference: conflictEntry.difference,
60
- }) - 1;
61
- result.conflicts.splice(conflictIndex, 1);
62
- // If item gets added, remove the modify references to this item
63
- const relatedModifications = [];
64
- result.differences.forEach((entry, index) => {
65
- if (Utils.isSchemaItemDifference(entry) && entry.itemName === edit.key) {
66
- relatedModifications.push(index);
67
- }
68
- });
69
- for (const index of relatedModifications.reverse()) {
70
- result.differences.splice(index, 1);
71
- }
72
- }
42
+ const [schemaName, itemName] = ecschema_metadata_1.SchemaItem.parseFullName(edit.key);
43
+ if (!result.sourceSchemaName.startsWith(schemaName)) {
44
+ return;
73
45
  }
46
+ const difference = result.differences.find((entry) => {
47
+ return Utils.isSchemaItemDifference(entry) && entry.changeType === "add" && entry.itemName === itemName;
48
+ });
74
49
  const itemDifference = difference;
75
50
  if (itemDifference === undefined) {
76
51
  return;
77
52
  }
78
- renameName(itemDifference, edit.key, edit.value);
53
+ renameName(itemDifference, itemName, edit.value);
54
+ if (result.conflicts) {
55
+ const conflictIndex = result.conflicts.findIndex((entry) => entry.itemName === itemName && entry.path === undefined);
56
+ if (conflictIndex > -1) {
57
+ result.conflicts.splice(conflictIndex, 1);
58
+ }
59
+ }
79
60
  postProcessing(() => {
80
61
  renameSchemaItem(result, edit, itemDifference.schemaType);
81
62
  });
@@ -83,7 +64,8 @@ function applyRenameSchemaItemEdit(result, edit, postProcessing) {
83
64
  exports.applyRenameSchemaItemEdit = applyRenameSchemaItemEdit;
84
65
  function renameSchemaItem(result, edit, schemaType) {
85
66
  const schemaKey = ecschema_metadata_1.SchemaKey.parseString(result.sourceSchemaName);
86
- const oldKey = new ecschema_metadata_1.SchemaItemKey(edit.key, schemaKey);
67
+ const [_schemaName, itemName] = ecschema_metadata_1.SchemaItem.parseFullName(edit.key);
68
+ const oldKey = new ecschema_metadata_1.SchemaItemKey(itemName, schemaKey);
87
69
  const newKey = new ecschema_metadata_1.SchemaItemKey(edit.value, schemaKey);
88
70
  switch (schemaType) {
89
71
  case ecschema_metadata_1.SchemaItemType.CustomAttributeClass:
@@ -1 +1 @@
1
- {"version":3,"file":"RenameEditHandler.js","sourceRoot":"","sources":["../../../../src/Merging/Edits/RenameEditHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,0EAAsP;AACtP,gEAA8O;AAC9O,kDAAkD;AAMlD;;GAEG;AACH,SAAgB,uBAAuB,CAAC,MAA8B,EAAE,IAAwB;IAC9F,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAqB,CAAC;IAEjE,IAAI,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;QACtD,OAAO,KAAK,CAAC,yBAAyB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,UAAU,KAAK,KAAK,IAAI,KAAK,CAAC,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;IACpI,CAAC,CA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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 Merging\r\n */\r\n\r\nimport type { RenamePropertyEdit, RenameSchemaItemEdit } from \"./SchemaEdits\";\r\nimport { AnySchemaItemDifference, ClassItemDifference, ClassPropertyDifference, RelationshipClassDifference, RelationshipConstraintClassDifference, SchemaDifferenceResult, SchemaOtherTypes, SchemaType } from \"../../Differencing/SchemaDifference\";\r\nimport { NavigationPropertyProps, PrimitiveArrayPropertyProps, PrimitivePropertyProps, RelationshipConstraintProps, SchemaItemKey, SchemaItemType, SchemaKey, StructArrayPropertyProps, StructPropertyProps } from \"@itwin/ecschema-metadata\";\r\nimport * as Utils from \"../../Differencing/Utils\";\r\n\r\ntype Editable<T extends object> = {\r\n -readonly [P in keyof T]: T[P];\r\n};\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function applyRenamePropertyEdit(result: SchemaDifferenceResult, edit: RenamePropertyEdit) {\r\n const [itemName, path] = edit.key.split(\".\") as [string, string];\r\n\r\n let entryIndex = result.differences.findIndex((entry) => {\r\n return Utils.isClassPropertyDifference(entry) && entry.changeType === \"add\" && entry.itemName === itemName && entry.path === path;\r\n });\r\n\r\n if (entryIndex === -1 && result.conflicts) {\r\n const conflictIndex = result.conflicts.findIndex((entry) => {\r\n return entry.itemName === itemName && entry.path === path;\r\n });\r\n\r\n if (conflictIndex > -1) {\r\n const conflictEntry = result.conflicts[conflictIndex];\r\n entryIndex = result.differences.push({\r\n changeType: \"add\",\r\n schemaType: SchemaOtherTypes.Property,\r\n itemName,\r\n path,\r\n difference: conflictEntry.difference,\r\n } as ClassPropertyDifference) - 1;\r\n\r\n result.conflicts.splice(conflictIndex, 1);\r\n }\r\n }\r\n\r\n const propertyEntry = result.differences[entryIndex] as Editable<ClassPropertyDifference>;\r\n if (propertyEntry) {\r\n propertyEntry.path = edit.value;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport function applyRenameSchemaItemEdit(result: SchemaDifferenceResult, edit: RenameSchemaItemEdit, postProcessing: (cb: () => void) => void) {\r\n let difference = result.differences.find((entry) => {\r\n return Utils.isSchemaItemDifference(entry) && entry.changeType === \"add\" && entry.itemName === edit.key;\r\n });\r\n\r\n if (difference === undefined && result.conflicts) {\r\n const conflictIndex = result.conflicts.findIndex((entry) => entry.itemName === edit.key && entry.path === undefined);\r\n if (conflictIndex > -1) {\r\n const conflictEntry = result.conflicts[conflictIndex];\r\n result.differences.push(difference = {\r\n changeType: \"add\",\r\n schemaType: conflictEntry.schemaType,\r\n itemName: edit.value,\r\n difference: conflictEntry.difference,\r\n } as AnySchemaItemDifference) - 1;\r\n\r\n result.conflicts.splice(conflictIndex, 1);\r\n\r\n // If item gets added, remove the modify references to this item\r\n const relatedModifications: number[] = [];\r\n result.differences.forEach((entry, index) => {\r\n if (Utils.isSchemaItemDifference(entry) && entry.itemName === edit.key) {\r\n relatedModifications.push(index);\r\n }\r\n });\r\n\r\n for (const index of relatedModifications.reverse()) {\r\n result.differences.splice(index, 1);\r\n }\r\n }\r\n }\r\n\r\n const itemDifference = difference as AnySchemaItemDifference;\r\n if (itemDifference === undefined) {\r\n return;\r\n }\r\n\r\n renameName(itemDifference, edit.key, edit.value);\r\n\r\n postProcessing(() => {\r\n renameSchemaItem(result, edit, itemDifference.schemaType);\r\n });\r\n}\r\n\r\nfunction renameSchemaItem(result: SchemaDifferenceResult, edit: RenameSchemaItemEdit, schemaType: SchemaType) {\r\n const schemaKey = SchemaKey.parseString(result.sourceSchemaName);\r\n const oldKey = new SchemaItemKey(edit.key, schemaKey);\r\n const newKey = new SchemaItemKey(edit.value, schemaKey);\r\n\r\n switch (schemaType) {\r\n case SchemaItemType.CustomAttributeClass:\r\n renameCustomAttributeClassName(result, oldKey, newKey);\r\n break;\r\n case SchemaItemType.EntityClass:\r\n renameEntityClassName(result, oldKey, newKey);\r\n break;\r\n case SchemaItemType.Enumeration:\r\n renameEnumerationName(result, oldKey, newKey);\r\n break;\r\n case SchemaItemType.Format:\r\n break;\r\n case SchemaItemType.InvertedUnit:\r\n break;\r\n case SchemaItemType.KindOfQuantity:\r\n renameKindOfQuantityName(result, oldKey, newKey);\r\n break;\r\n case SchemaItemType.Mixin:\r\n renameMixinName(result, oldKey, newKey);\r\n break;\r\n case SchemaItemType.Phenomenon:\r\n renamePhenomenonName(result, oldKey, newKey);\r\n break;\r\n case SchemaItemType.PropertyCategory:\r\n renamePropertyCategoryName(result, oldKey, newKey);\r\n break;\r\n case SchemaItemType.RelationshipClass:\r\n renameRelationshipClassName(result, oldKey, newKey);\r\n break;\r\n case SchemaItemType.StructClass:\r\n renameStructClassName(result, oldKey, newKey);\r\n break;\r\n case SchemaItemType.Unit:\r\n break;\r\n case SchemaItemType.UnitSystem:\r\n break;\r\n }\r\n}\r\n\r\nfunction renameBaseClass(difference: ClassItemDifference[\"difference\"], oldKey: SchemaItemKey, newKey: SchemaItemKey) {\r\n if (difference.baseClass && oldKey.matchesFullName(difference.baseClass)) {\r\n difference.baseClass = newKey.fullName;\r\n }\r\n}\r\n\r\nfunction renameName(change: AnySchemaItemDifference, oldName: string, newName: string) {\r\n if (change.itemName === oldName) {\r\n const schemaItemDifference = change as Editable<AnySchemaItemDifference>;\r\n schemaItemDifference.itemName = newName;\r\n }\r\n}\r\n\r\nfunction renameRelationshipConstraint(change: RelationshipClassDifference | RelationshipConstraintClassDifference, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\r\n if (change.schemaType === SchemaItemType.RelationshipClass) {\r\n const constraintProps = [change.difference.source, change.difference.target] as Editable<RelationshipConstraintProps>[];\r\n for (const props of constraintProps) {\r\n if (props) {\r\n if (props.abstractConstraint && oldKey.matchesFullName(props.abstractConstraint)) {\r\n props.abstractConstraint = newKey.fullName;\r\n }\r\n if (props.constraintClasses !== undefined) {\r\n for (let i = 0; i < props.constraintClasses.length; i++) {\r\n if (oldKey.matchesFullName(props.constraintClasses[i]))\r\n props.constraintClasses[i] = newKey.fullName;\r\n }\r\n }\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < change.difference.length; i++) {\r\n if (oldKey.matchesFullName(change.difference[i]))\r\n change.difference[i] = newKey.fullName;\r\n }\r\n }\r\n}\r\n\r\nfunction renamePropertyCategoryName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\r\n for (const entry of differences) {\r\n if (entry.schemaType === SchemaItemType.PropertyCategory) {\r\n renameName(entry, oldKey.name, newKey.name);\r\n }\r\n\r\n if (Utils.isClassDifference(entry) && entry.difference.properties) {\r\n for (const property of entry.difference.properties) {\r\n if (property.category && oldKey.matchesFullName(property.category)) {\r\n const props = property as Editable<typeof property>;\r\n props.category = newKey.fullName;\r\n }\r\n }\r\n }\r\n\r\n if (entry.schemaType === SchemaOtherTypes.Property) {\r\n if (entry.difference.category && oldKey.matchesFullName(entry.difference.category)) {\r\n entry.difference.category = newKey.fullName;\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction renameKindOfQuantityName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\r\n for (const entry of differences) {\r\n if (Utils.isClassDifference(entry) && entry.difference.properties) {\r\n for (const property of entry.difference.properties) {\r\n if (property.kindOfQuantity && oldKey.matchesFullName(property.kindOfQuantity)) {\r\n const props = property as Editable<typeof property>;\r\n props.kindOfQuantity = newKey.fullName;\r\n }\r\n }\r\n }\r\n\r\n if (entry.schemaType === SchemaOtherTypes.Property) {\r\n if (entry.difference.kindOfQuantity && oldKey.matchesFullName(entry.difference.kindOfQuantity)) {\r\n entry.difference.kindOfQuantity = newKey.fullName;\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction renameEnumerationName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\r\n for (const change of differences) {\r\n if (Utils.isClassDifference(change) && change.difference.properties) {\r\n for (const property of change.difference.properties) {\r\n if (property.type === \"PrimitiveProperty\" || property.type === \"PrimitiveArrayProperty\") {\r\n const props = property as Editable<PrimitivePropertyProps | PrimitiveArrayPropertyProps>;\r\n if (props.typeName && oldKey.matchesFullName(props.typeName))\r\n props.typeName = newKey.fullName;\r\n }\r\n }\r\n }\r\n\r\n if (change.schemaType === SchemaOtherTypes.Property && (\r\n change.difference.type === \"PrimitiveProperty\" || change.difference.type === \"PrimitiveArrayProperty\"\r\n )) {\r\n const props = change.difference as Editable<PrimitivePropertyProps | PrimitiveArrayPropertyProps>;\r\n if (props.typeName && oldKey.matchesFullName(props.typeName))\r\n props.typeName = newKey.fullName;\r\n }\r\n }\r\n}\r\n\r\nfunction renamePhenomenonName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\r\n for (const entry of differences) {\r\n if (entry.schemaType === SchemaItemType.Constant || entry.schemaType === SchemaItemType.Unit) {\r\n if (entry.difference.phenomenon && oldKey.matchesFullName(entry.difference.phenomenon))\r\n entry.difference.phenomenon = newKey.fullName;\r\n }\r\n }\r\n}\r\n\r\nfunction renameStructClassName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\r\n for (const change of differences) {\r\n if (change.schemaType === SchemaItemType.StructClass) {\r\n renameBaseClass(change.difference, oldKey, newKey);\r\n }\r\n\r\n if (Utils.isClassDifference(change) && change.difference.properties) {\r\n for (const property of change.difference.properties) {\r\n if (property.type === \"StructProperty\" || property.type === \"StructArrayProperty\") {\r\n const props = property as Editable<StructPropertyProps | StructArrayPropertyProps>;;\r\n if (props.typeName && oldKey.matchesFullName(props.typeName))\r\n props.typeName = newKey.fullName;\r\n }\r\n }\r\n }\r\n\r\n if (change.schemaType === SchemaOtherTypes.Property && (\r\n change.difference.type === \"StructProperty\" || change.difference.type === \"StructArrayProperty\"\r\n )) {\r\n const props = change.difference as Editable<StructPropertyProps | StructArrayPropertyProps>;\r\n if (props.typeName && oldKey.matchesFullName(props.typeName))\r\n props.typeName = newKey.fullName;\r\n }\r\n }\r\n}\r\n\r\nfunction renameCustomAttributeClassName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\r\n for (const change of differences) {\r\n if (change.schemaType === SchemaItemType.CustomAttributeClass) {\r\n renameBaseClass(change.difference, oldKey, newKey);\r\n }\r\n\r\n if (change.schemaType === SchemaOtherTypes.CustomAttributeInstance) {\r\n if (change.difference.className && oldKey.matchesFullName(change.difference.className)) {\r\n change.difference.className = newKey.fullName;\r\n }\r\n }\r\n\r\n if (change.schemaType === SchemaOtherTypes.Property || Utils.isClassDifference(change)) {\r\n if (change.difference.customAttributes) {\r\n for (const customAttribute of change.difference.customAttributes) {\r\n if (oldKey.matchesFullName(customAttribute.className))\r\n customAttribute.className = newKey.fullName;\r\n }\r\n }\r\n }\r\n\r\n if (Utils.isClassDifference(change) && change.difference.properties) {\r\n for (const property of change.difference.properties) {\r\n if (property.customAttributes) {\r\n for (const customAttribute of property.customAttributes) {\r\n if (oldKey.matchesFullName(customAttribute.className))\r\n customAttribute.className = newKey.fullName;\r\n }\r\n }\r\n }\r\n }\r\n // https://github.com/iTwin/itwinjs-core/issues/7020\r\n /* if (change.schemaType === SchemaItemType.RelationshipClass) {\r\n const constraintProps = [change.difference.source, change.difference.target] as Editable<RelationshipConstraintProps>[];\r\n for (const props of constraintProps) {\r\n if (props.customAttributes !== undefined) {\r\n for (const customAttribute of props.customAttributes) {\r\n if (oldKey.matchesFullName(customAttribute.className))\r\n customAttribute.className = newKey.fullName;\r\n }\r\n }\r\n }\r\n } */\r\n }\r\n}\r\n\r\nfunction renameRelationshipClassName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\r\n for (const change of differences) {\r\n if (change.schemaType === SchemaItemType.RelationshipClass) {\r\n renameBaseClass(change.difference, oldKey, newKey);\r\n }\r\n\r\n if (change.schemaType === SchemaOtherTypes.Property && change.difference.type === \"NavigationProperty\") {\r\n const props = change.difference as Editable<NavigationPropertyProps>;\r\n if (props.relationshipName && oldKey.matchesFullName(props.relationshipName))\r\n props.relationshipName = newKey.fullName;\r\n }\r\n\r\n if (Utils.isClassDifference(change) && change.difference.properties) {\r\n for (const property of change.difference.properties) {\r\n if (property.type === \"NavigationProperty\") {\r\n const props = property as Editable<NavigationPropertyProps>;\r\n if (props.relationshipName && oldKey.matchesFullName(props.relationshipName))\r\n props.relationshipName = newKey.fullName;\r\n }\r\n }\r\n }\r\n\r\n if (change.schemaType === SchemaItemType.RelationshipClass || change.schemaType === SchemaOtherTypes.RelationshipConstraintClass) {\r\n renameRelationshipConstraint(change, oldKey, newKey);\r\n }\r\n }\r\n}\r\n\r\nfunction renameEntityClassName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\r\n for (const entry of differences) {\r\n if (entry.schemaType === SchemaItemType.EntityClass) {\r\n renameName(entry, oldKey.name, newKey.name);\r\n renameBaseClass(entry.difference, oldKey, newKey);\r\n }\r\n\r\n if (entry.schemaType === SchemaItemType.Mixin) {\r\n if (entry.difference.appliesTo && oldKey.matchesFullName(entry.difference.appliesTo))\r\n entry.difference.appliesTo = newKey.fullName;\r\n }\r\n\r\n if (Utils.isRelationshipClassDifference(entry) || Utils.isRelationshipConstraintClassDifference(entry)) {\r\n renameRelationshipConstraint(entry, oldKey, newKey);\r\n }\r\n }\r\n}\r\n\r\nfunction renameMixinName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\r\n for (const entry of differences) {\r\n if (entry.schemaType === SchemaItemType.Mixin) {\r\n renameBaseClass(entry.difference, oldKey, newKey);\r\n }\r\n\r\n if (entry.schemaType === SchemaOtherTypes.EntityClassMixin) {\r\n for (let i = 0; i < entry.difference.length; i++) {\r\n if (oldKey.matchesFullName(entry.difference[i])) {\r\n entry.difference[i] = newKey.fullName;\r\n }\r\n }\r\n }\r\n\r\n if (Utils.isRelationshipClassDifference(entry) || Utils.isRelationshipConstraintClassDifference(entry)) {\r\n renameRelationshipConstraint(entry, oldKey, newKey);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"RenameEditHandler.js","sourceRoot":"","sources":["../../../../src/Merging/Edits/RenameEditHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,0EAAsP;AACtP,gEAA0P;AAC1P,kDAAkD;AAMlD;;GAEG;AACH,SAAgB,uBAAuB,CAAC,MAA8B,EAAE,IAAwB;IAC9F,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAA6B,CAAC;IACrF,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QACpD,OAAO;IACT,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;QACnD,OAAO,KAAK,CAAC,yBAAyB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,UAAU,KAAK,KAAK,IAAI,KAAK,CAAC,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;IACpI,CAAC,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAG,UAA+C,CAAC;IAC3E,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;QACrC,OAAO;IACT,CAAC;IAED,kBAAkB,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;IAErC,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QAChH,IAAI,aAAa,GAAG,CAAC,CAAC,EAAE,CAAC;YACvB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,KAAK,CAAC,UAAU,CAAC,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;QACjD,CAAC;QAED,IAAI,KAAK,CAAC,6BAA6B,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,uCAAuC,CAAC,KAAK,CAAC,EAAE,CAAC;YACvG,4BAA4B,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,EAAE,WAAW,EAA0B,EAAE,MAAqB,EAAE,MAAqB;IAC5G,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;QAChC,IAAI,KAAK,CAAC,UAAU,KAAK,kCAAc,CAAC,KAAK,EAAE,CAAC;YAC9C,eAAe,CAAC,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACpD,CAAC;QAED,IAAI,KAAK,CAAC,UAAU,KAAK,mCAAgB,CAAC,gBAAgB,EAAE,CAAC;YAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACjD,IAAI,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBAChD,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC;gBACxC,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,KAAK,CAAC,6BAA6B,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,uCAAuC,CAAC,KAAK,CAAC,EAAE,CAAC;YACvG,4BAA4B,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Merging\n */\n\nimport type { RenamePropertyEdit, RenameSchemaItemEdit } from \"./SchemaEdits\";\nimport { AnySchemaItemDifference, ClassItemDifference, ClassPropertyDifference, RelationshipClassDifference, RelationshipConstraintClassDifference, SchemaDifferenceResult, SchemaOtherTypes, SchemaType } from \"../../Differencing/SchemaDifference\";\nimport { NavigationPropertyProps, PrimitiveArrayPropertyProps, PrimitivePropertyProps, RelationshipConstraintProps, SchemaItem, SchemaItemKey, SchemaItemType, SchemaKey, StructArrayPropertyProps, StructPropertyProps } from \"@itwin/ecschema-metadata\";\nimport * as Utils from \"../../Differencing/Utils\";\n\ntype Editable<T extends object> = {\n -readonly [P in keyof T]: T[P];\n};\n\n/**\n * @internal\n */\nexport function applyRenamePropertyEdit(result: SchemaDifferenceResult, edit: RenamePropertyEdit) {\n const [schemaName, itemName, path] = edit.key.split(\".\") as [string, string, string];\n if (!result.sourceSchemaName.startsWith(schemaName)) {\n return;\n }\n\n const difference = result.differences.find((entry) => {\n return Utils.isClassPropertyDifference(entry) && entry.changeType === \"add\" && entry.itemName === itemName && entry.path === path;\n });\n\n const propertyDifference = difference as Editable<ClassPropertyDifference>;\n if (propertyDifference === undefined) {\n return;\n }\n\n propertyDifference.path = edit.value;\n\n if (result.conflicts) {\n const conflictIndex = result.conflicts.findIndex((entry) => entry.itemName === itemName && entry.path === path);\n if (conflictIndex > -1) {\n result.conflicts.splice(conflictIndex, 1);\n }\n }\n}\n\n/**\n * @internal\n */\nexport function applyRenameSchemaItemEdit(result: SchemaDifferenceResult, edit: RenameSchemaItemEdit, postProcessing: (cb: () => void) => void) {\n const [schemaName, itemName] = SchemaItem.parseFullName(edit.key);\n if (!result.sourceSchemaName.startsWith(schemaName)) {\n return;\n }\n\n const difference = result.differences.find((entry) => {\n return Utils.isSchemaItemDifference(entry) && entry.changeType === \"add\" && entry.itemName === itemName;\n });\n\n const itemDifference = difference as AnySchemaItemDifference;\n if (itemDifference === undefined) {\n return;\n }\n\n renameName(itemDifference, itemName, edit.value);\n\n if (result.conflicts) {\n const conflictIndex = result.conflicts.findIndex((entry) => entry.itemName === itemName && entry.path === undefined);\n if (conflictIndex > -1) {\n result.conflicts.splice(conflictIndex, 1);\n }\n }\n\n postProcessing(() => {\n renameSchemaItem(result, edit, itemDifference.schemaType);\n });\n}\n\nfunction renameSchemaItem(result: SchemaDifferenceResult, edit: RenameSchemaItemEdit, schemaType: SchemaType) {\n const schemaKey = SchemaKey.parseString(result.sourceSchemaName);\n const [_schemaName, itemName] = SchemaItem.parseFullName(edit.key);\n const oldKey = new SchemaItemKey(itemName, schemaKey);\n const newKey = new SchemaItemKey(edit.value, schemaKey);\n\n switch (schemaType) {\n case SchemaItemType.CustomAttributeClass:\n renameCustomAttributeClassName(result, oldKey, newKey);\n break;\n case SchemaItemType.EntityClass:\n renameEntityClassName(result, oldKey, newKey);\n break;\n case SchemaItemType.Enumeration:\n renameEnumerationName(result, oldKey, newKey);\n break;\n case SchemaItemType.Format:\n break;\n case SchemaItemType.InvertedUnit:\n break;\n case SchemaItemType.KindOfQuantity:\n renameKindOfQuantityName(result, oldKey, newKey);\n break;\n case SchemaItemType.Mixin:\n renameMixinName(result, oldKey, newKey);\n break;\n case SchemaItemType.Phenomenon:\n renamePhenomenonName(result, oldKey, newKey);\n break;\n case SchemaItemType.PropertyCategory:\n renamePropertyCategoryName(result, oldKey, newKey);\n break;\n case SchemaItemType.RelationshipClass:\n renameRelationshipClassName(result, oldKey, newKey);\n break;\n case SchemaItemType.StructClass:\n renameStructClassName(result, oldKey, newKey);\n break;\n case SchemaItemType.Unit:\n break;\n case SchemaItemType.UnitSystem:\n break;\n }\n}\n\nfunction renameBaseClass(difference: ClassItemDifference[\"difference\"], oldKey: SchemaItemKey, newKey: SchemaItemKey) {\n if (difference.baseClass && oldKey.matchesFullName(difference.baseClass)) {\n difference.baseClass = newKey.fullName;\n }\n}\n\nfunction renameName(change: AnySchemaItemDifference, oldName: string, newName: string) {\n if (change.itemName === oldName) {\n const schemaItemDifference = change as Editable<AnySchemaItemDifference>;\n schemaItemDifference.itemName = newName;\n }\n}\n\nfunction renameRelationshipConstraint(change: RelationshipClassDifference | RelationshipConstraintClassDifference, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\n if (change.schemaType === SchemaItemType.RelationshipClass) {\n const constraintProps = [change.difference.source, change.difference.target] as Editable<RelationshipConstraintProps>[];\n for (const props of constraintProps) {\n if (props) {\n if (props.abstractConstraint && oldKey.matchesFullName(props.abstractConstraint)) {\n props.abstractConstraint = newKey.fullName;\n }\n if (props.constraintClasses !== undefined) {\n for (let i = 0; i < props.constraintClasses.length; i++) {\n if (oldKey.matchesFullName(props.constraintClasses[i]))\n props.constraintClasses[i] = newKey.fullName;\n }\n }\n }\n }\n } else {\n for (let i = 0; i < change.difference.length; i++) {\n if (oldKey.matchesFullName(change.difference[i]))\n change.difference[i] = newKey.fullName;\n }\n }\n}\n\nfunction renamePropertyCategoryName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\n for (const entry of differences) {\n if (entry.schemaType === SchemaItemType.PropertyCategory) {\n renameName(entry, oldKey.name, newKey.name);\n }\n\n if (Utils.isClassDifference(entry) && entry.difference.properties) {\n for (const property of entry.difference.properties) {\n if (property.category && oldKey.matchesFullName(property.category)) {\n const props = property as Editable<typeof property>;\n props.category = newKey.fullName;\n }\n }\n }\n\n if (entry.schemaType === SchemaOtherTypes.Property) {\n if (entry.difference.category && oldKey.matchesFullName(entry.difference.category)) {\n entry.difference.category = newKey.fullName;\n }\n }\n }\n}\n\nfunction renameKindOfQuantityName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\n for (const entry of differences) {\n if (Utils.isClassDifference(entry) && entry.difference.properties) {\n for (const property of entry.difference.properties) {\n if (property.kindOfQuantity && oldKey.matchesFullName(property.kindOfQuantity)) {\n const props = property as Editable<typeof property>;\n props.kindOfQuantity = newKey.fullName;\n }\n }\n }\n\n if (entry.schemaType === SchemaOtherTypes.Property) {\n if (entry.difference.kindOfQuantity && oldKey.matchesFullName(entry.difference.kindOfQuantity)) {\n entry.difference.kindOfQuantity = newKey.fullName;\n }\n }\n }\n}\n\nfunction renameEnumerationName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\n for (const change of differences) {\n if (Utils.isClassDifference(change) && change.difference.properties) {\n for (const property of change.difference.properties) {\n if (property.type === \"PrimitiveProperty\" || property.type === \"PrimitiveArrayProperty\") {\n const props = property as Editable<PrimitivePropertyProps | PrimitiveArrayPropertyProps>;\n if (props.typeName && oldKey.matchesFullName(props.typeName))\n props.typeName = newKey.fullName;\n }\n }\n }\n\n if (change.schemaType === SchemaOtherTypes.Property && (\n change.difference.type === \"PrimitiveProperty\" || change.difference.type === \"PrimitiveArrayProperty\"\n )) {\n const props = change.difference as Editable<PrimitivePropertyProps | PrimitiveArrayPropertyProps>;\n if (props.typeName && oldKey.matchesFullName(props.typeName))\n props.typeName = newKey.fullName;\n }\n }\n}\n\nfunction renamePhenomenonName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\n for (const entry of differences) {\n if (entry.schemaType === SchemaItemType.Constant || entry.schemaType === SchemaItemType.Unit) {\n if (entry.difference.phenomenon && oldKey.matchesFullName(entry.difference.phenomenon))\n entry.difference.phenomenon = newKey.fullName;\n }\n }\n}\n\nfunction renameStructClassName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\n for (const change of differences) {\n if (change.schemaType === SchemaItemType.StructClass) {\n renameBaseClass(change.difference, oldKey, newKey);\n }\n\n if (Utils.isClassDifference(change) && change.difference.properties) {\n for (const property of change.difference.properties) {\n if (property.type === \"StructProperty\" || property.type === \"StructArrayProperty\") {\n const props = property as Editable<StructPropertyProps | StructArrayPropertyProps>;;\n if (props.typeName && oldKey.matchesFullName(props.typeName))\n props.typeName = newKey.fullName;\n }\n }\n }\n\n if (change.schemaType === SchemaOtherTypes.Property && (\n change.difference.type === \"StructProperty\" || change.difference.type === \"StructArrayProperty\"\n )) {\n const props = change.difference as Editable<StructPropertyProps | StructArrayPropertyProps>;\n if (props.typeName && oldKey.matchesFullName(props.typeName))\n props.typeName = newKey.fullName;\n }\n }\n}\n\nfunction renameCustomAttributeClassName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\n for (const change of differences) {\n if (change.schemaType === SchemaItemType.CustomAttributeClass) {\n renameBaseClass(change.difference, oldKey, newKey);\n }\n\n if (change.schemaType === SchemaOtherTypes.CustomAttributeInstance) {\n if (change.difference.className && oldKey.matchesFullName(change.difference.className)) {\n change.difference.className = newKey.fullName;\n }\n }\n\n if (change.schemaType === SchemaOtherTypes.Property || Utils.isClassDifference(change)) {\n if (change.difference.customAttributes) {\n for (const customAttribute of change.difference.customAttributes) {\n if (oldKey.matchesFullName(customAttribute.className))\n customAttribute.className = newKey.fullName;\n }\n }\n }\n\n if (Utils.isClassDifference(change) && change.difference.properties) {\n for (const property of change.difference.properties) {\n if (property.customAttributes) {\n for (const customAttribute of property.customAttributes) {\n if (oldKey.matchesFullName(customAttribute.className))\n customAttribute.className = newKey.fullName;\n }\n }\n }\n }\n // https://github.com/iTwin/itwinjs-core/issues/7020\n /* if (change.schemaType === SchemaItemType.RelationshipClass) {\n const constraintProps = [change.difference.source, change.difference.target] as Editable<RelationshipConstraintProps>[];\n for (const props of constraintProps) {\n if (props.customAttributes !== undefined) {\n for (const customAttribute of props.customAttributes) {\n if (oldKey.matchesFullName(customAttribute.className))\n customAttribute.className = newKey.fullName;\n }\n }\n }\n } */\n }\n}\n\nfunction renameRelationshipClassName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\n for (const change of differences) {\n if (change.schemaType === SchemaItemType.RelationshipClass) {\n renameBaseClass(change.difference, oldKey, newKey);\n }\n\n if (change.schemaType === SchemaOtherTypes.Property && change.difference.type === \"NavigationProperty\") {\n const props = change.difference as Editable<NavigationPropertyProps>;\n if (props.relationshipName && oldKey.matchesFullName(props.relationshipName))\n props.relationshipName = newKey.fullName;\n }\n\n if (Utils.isClassDifference(change) && change.difference.properties) {\n for (const property of change.difference.properties) {\n if (property.type === \"NavigationProperty\") {\n const props = property as Editable<NavigationPropertyProps>;\n if (props.relationshipName && oldKey.matchesFullName(props.relationshipName))\n props.relationshipName = newKey.fullName;\n }\n }\n }\n\n if (change.schemaType === SchemaItemType.RelationshipClass || change.schemaType === SchemaOtherTypes.RelationshipConstraintClass) {\n renameRelationshipConstraint(change, oldKey, newKey);\n }\n }\n}\n\nfunction renameEntityClassName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\n for (const entry of differences) {\n if (entry.schemaType === SchemaItemType.EntityClass) {\n renameName(entry, oldKey.name, newKey.name);\n renameBaseClass(entry.difference, oldKey, newKey);\n }\n\n if (entry.schemaType === SchemaItemType.Mixin) {\n if (entry.difference.appliesTo && oldKey.matchesFullName(entry.difference.appliesTo))\n entry.difference.appliesTo = newKey.fullName;\n }\n\n if (Utils.isRelationshipClassDifference(entry) || Utils.isRelationshipConstraintClassDifference(entry)) {\n renameRelationshipConstraint(entry, oldKey, newKey);\n }\n }\n}\n\nfunction renameMixinName({ differences }: SchemaDifferenceResult, oldKey: SchemaItemKey, newKey: SchemaItemKey) {\n for (const entry of differences) {\n if (entry.schemaType === SchemaItemType.Mixin) {\n renameBaseClass(entry.difference, oldKey, newKey);\n }\n\n if (entry.schemaType === SchemaOtherTypes.EntityClassMixin) {\n for (let i = 0; i < entry.difference.length; i++) {\n if (oldKey.matchesFullName(entry.difference[i])) {\n entry.difference[i] = newKey.fullName;\n }\n }\n }\n\n if (Utils.isRelationshipClassDifference(entry) || Utils.isRelationshipConstraintClassDifference(entry)) {\n renameRelationshipConstraint(entry, oldKey, newKey);\n }\n }\n}\n"]}
@@ -48,12 +48,12 @@ declare abstract class Editor {
48
48
  protected add(edit: AnySchemaEdits): void;
49
49
  }
50
50
  declare class PropertyEditor extends Editor {
51
- rename(className: string, propertyName: string, newName: string): void;
52
- skip(className: string, propertyName: string): void;
51
+ rename(schemaName: string, className: string, propertyName: string, newName: string): void;
52
+ skip(schemaName: string, className: string, propertyName: string): void;
53
53
  }
54
54
  declare class ItemEditor extends Editor {
55
- rename(itemName: string, newName: string): void;
56
- skip(itemName: string): void;
55
+ rename(schemaName: string, itemName: string, newName: string): void;
56
+ skip(schemaName: string, itemName: string): void;
57
57
  }
58
58
  /**
59
59
  * Defines a set of edits of a schema that can be applied to a schema during merging. The intention of this class
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaEdits.d.ts","sourceRoot":"","sources":["../../../../src/Merging/Edits/SchemaEdits.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAIlF;;;GAGG;AACH,oBAAY,cAAc;IACxB,gBAAgB,qBAAqB;IACrC,cAAc,mBAAmB;IACjC,IAAI,SAAS;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,cAAc,CAAC,gBAAgB,CAAC;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,cAAc,CAAC,cAAc,CAAC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GACxB,QAAQ,GACR,oBAAoB,GACpB,kBAAkB,CAAC;AAErB,uBAAe,MAAM;IACnB,OAAO,CAAC,QAAQ,CAAC,MAAM,CA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C;CAG/C"}
@@ -37,32 +37,32 @@ class Editor {
37
37
  }
38
38
  }
39
39
  class PropertyEditor extends Editor {
40
- rename(className, propertyName, newName) {
40
+ rename(schemaName, className, propertyName, newName) {
41
41
  this.add({
42
42
  type: SchemaEditType.RenameProperty,
43
- key: `${className}.${propertyName}`,
43
+ key: `${schemaName}.${className}.${propertyName}`,
44
44
  value: newName,
45
45
  });
46
46
  }
47
- skip(className, propertyName) {
47
+ skip(schemaName, className, propertyName) {
48
48
  this.add({
49
49
  type: SchemaEditType.Skip,
50
- key: `${className}.${propertyName}`,
50
+ key: `${schemaName}.${className}.${propertyName}`,
51
51
  });
52
52
  }
53
53
  }
54
54
  class ItemEditor extends Editor {
55
- rename(itemName, newName) {
55
+ rename(schemaName, itemName, newName) {
56
56
  this.add({
57
57
  type: SchemaEditType.RenameSchemaItem,
58
- key: itemName,
58
+ key: `${schemaName}.${itemName}`,
59
59
  value: newName,
60
60
  });
61
61
  }
62
- skip(itemName) {
62
+ skip(schemaName, itemName) {
63
63
  this.add({
64
64
  type: SchemaEditType.Skip,
65
- key: itemName,
65
+ key: `${schemaName}.${itemName}`,
66
66
  });
67
67
  }
68
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaEdits.js","sourceRoot":"","sources":["../../../../src/Merging/Edits/SchemaEdits.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,2DAAyF;AACzF,uDAAkD;AAElD;;;GAGG;AACH,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,uDAAqC,CAAA;IACrC,mDAAiC,CAAA;IACjC,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB;AAwCD,MAAe,MAAM;IAGnB,YAAY,KAA4B;QACtC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAES,GAAG,CAAC,IAAoB;QAChC,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,K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IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QAEjB,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC;QAClC,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,gBAAwC;QAC3D,MAAM,cAAc,GAAsB,EAAE,CAAC;QAC7C,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACrC,IAAI,UAAU,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;gBACxD,IAAA,6CAAyB,EAAC,gBAAgB,EAAE,UAAU,EAAE,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;YACpG,CAAC;YACD,IAAI,UAAU,CAAC,IAAI,KAAK,cAAc,CAAC,cAAc,EAAE,CAAC;gBACtD,IAAA,2CAAuB,EAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;YACxD,CAAC;YACD,IAAI,UAAU,CAAC,IAAI,KAAK,cAAc,CAAC,IAAI,EAAE,CAAC;gBAC5C,IAAA,+BAAa,EAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;QAED,KAAK,MAAM,QAAQ,IAAI,cAAc,EAAE,CAAC;YACtC,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AA7CD,kCA6CC","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 Merging\r\n */\r\n\r\nimport type { SchemaDifferenceResult } from \"../../Differencing/SchemaDifference\";\r\nimport { applyRenamePropertyEdit, applyRenameSchemaItemEdit } from \"./RenameEditHandler\";\r\nimport { applySkipEdit } from \"./SkipEditHandler\";\r\n\r\n/**\r\n * An enumeration that has all the schema edit names.\r\n * @alpha\r\n */\r\nexport enum SchemaEditType {\r\n RenameSchemaItem = \"RenameSchemaItem\",\r\n RenameProperty = \"RenameProperty\",\r\n Skip = \"Skip\",\r\n}\r\n\r\n/**\r\n * Schema edit entry to rename a schema item.\r\n * @alpha\r\n */\r\nexport interface RenameSchemaItemEdit {\r\n type: SchemaEditType.RenameSchemaItem;\r\n key: string;\r\n value: string;\r\n}\r\n\r\n/**\r\n * Schema edit entry to rename a property of a class.\r\n * @alpha\r\n */\r\nexport interface RenamePropertyEdit {\r\n type: SchemaEditType.RenameProperty;\r\n key: string;\r\n value: string;\r\n}\r\n\r\n/**\r\n * Schema edit entry to skip a certain schema element matching the given key.\r\n * @alpha\r\n */\r\nexport interface SkipEdit {\r\n type: SchemaEditType.Skip;\r\n key: string;\r\n}\r\n\r\n/**\r\n * Union for all supported edits that can be applied to a schema.\r\n * @alpha\r\n */\r\nexport type AnySchemaEdits =\r\n SkipEdit |\r\n RenameSchemaItemEdit |\r\n RenamePropertyEdit;\r\n\r\nabstract class Editor {\r\n private readonly _edits: Array<AnySchemaEdits>;\r\n\r\n constructor(edits: Array<AnySchemaEdits>) {\r\n this._edits = edits;\r\n }\r\n\r\n protected add(edit: AnySchemaEdits) {\r\n const overrideEntry = this._edits.findIndex((entry) => {\r\n return entry.type === edit.type && entry.key === edit.key;\r\n });\r\n\r\n if (overrideEntry > -1) {\r\n this._edits[overrideEntry] = edit;\r\n } else {\r\n this._edits.push(edit);\r\n }\r\n }\r\n}\r\n\r\nclass PropertyEditor extends Editor {\r\n\r\n public rename(className: string, propertyName: string, newName: string) {\r\n this.add({\r\n type: SchemaEditType.RenameProperty,\r\n key: `${className}.${propertyName}`,\r\n value: newName,\r\n });\r\n }\r\n\r\n public skip(className: string, propertyName: string) {\r\n this.add({\r\n type: SchemaEditType.Skip,\r\n key: `${className}.${propertyName}`,\r\n });\r\n }\r\n}\r\n\r\nclass ItemEditor extends Editor {\r\n public rename(itemName: string, newName: string) {\r\n this.add({\r\n type: SchemaEditType.RenameSchemaItem,\r\n key: itemName,\r\n value: newName,\r\n });\r\n }\r\n\r\n public skip(itemName: string) {\r\n this.add({\r\n type: SchemaEditType.Skip,\r\n key: itemName,\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Defines a set of edits of a schema that can be applied to a schema during merging. The intention of this class\r\n * is to support saving of edits and load them again if needed.\r\n * @alpha\r\n */\r\nexport class SchemaEdits {\r\n private readonly _edits: Array<AnySchemaEdits>;\r\n\r\n public readonly properties: PropertyEditor;\r\n public readonly items: ItemEditor;\r\n\r\n /**\r\n * @alpha\r\n */\r\n constructor(initialize?: ReadonlyArray<AnySchemaEdits>) {\r\n this._edits = [];\r\n\r\n if (initialize) {\r\n this._edits.push(...initialize);\r\n }\r\n\r\n this.items = new ItemEditor(this._edits);\r\n this.properties = new PropertyEditor(this._edits);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public async applyTo(differenceResult: SchemaDifferenceResult): Promise<void> {\r\n const postProcessing: Array<() => void> = [];\r\n for (const schemaEdit of this._edits) {\r\n if (schemaEdit.type === SchemaEditType.RenameSchemaItem) {\r\n applyRenameSchemaItemEdit(differenceResult, schemaEdit, postProcessing.push.bind(postProcessing));\r\n }\r\n if (schemaEdit.type === SchemaEditType.RenameProperty) {\r\n applyRenamePropertyEdit(differenceResult, schemaEdit);\r\n }\r\n if (schemaEdit.type === SchemaEditType.Skip) {\r\n applySkipEdit(differenceResult, schemaEdit);\r\n }\r\n }\r\n\r\n for (const callback of postProcessing) {\r\n callback();\r\n }\r\n }\r\n\r\n public toJSON(): ReadonlyArray<AnySchemaEdits> {\r\n return this._edits;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SchemaEdits.js","sourceRoot":"","sources":["../../../../src/Merging/Edits/SchemaEdits.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,2DAAyF;AACzF,uDAAkD;AAElD;;;GAGG;AACH,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,uDAAqC,CAAA;IACrC,mDAAiC,CAAA;IACjC,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB;AAwCD,MAAe,MAAM;IAGnB,YAAY,KAA4B;QACtC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAES,GAAG,CAAC,IAAoB;QAChC,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;YACpD,OAAO,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC;QAC5D,CAAC,CAAC,CAAC;QAEH,IAAI,aAAa,GAAG,CAAC,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;QACpC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;CACF;AAED,MAAM,cAAe,SAAQ,MAAM;IAE1B,MAAM,CAAC,UAAkB,EAAE,SAAiB,EAAE,YAAoB,EAAE,OAAe;QACxF,IAAI,CAAC,GAAG,CAAC;YACP,IAAI,EAAE,cAAc,CAAC,cAAc;YACnC,GAAG,EAAE,GAAG,UAAU,IAAI,SAAS,IAAI,YAAY,EAAE;YACjD,KAAK,EAAE,OAAO;SACf,CAAC,CAAC;IACL,CAAC;IAEM,IAAI,CAAC,UAAkB,EAAE,SAAiB,EAAE,YAAoB;QACrE,IAAI,CAA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,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;YACpG,CAAC;YACD,IAAI,UAAU,CAAC,IAAI,KAAK,cAAc,CAAC,cAAc,EAAE,CAAC;gBACtD,IAAA,2CAAuB,EAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;YACxD,CAAC;YACD,IAAI,UAAU,CAAC,IAAI,KAAK,cAAc,CAAC,IAAI,EAAE,CAAC;gBAC5C,IAAA,+BAAa,EAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;QAED,KAAK,MAAM,QAAQ,IAAI,cAAc,EAAE,CAAC;YACtC,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AA7CD,kCA6CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Merging\n */\n\nimport type { SchemaDifferenceResult } from \"../../Differencing/SchemaDifference\";\nimport { applyRenamePropertyEdit, applyRenameSchemaItemEdit } from \"./RenameEditHandler\";\nimport { applySkipEdit } from \"./SkipEditHandler\";\n\n/**\n * An enumeration that has all the schema edit names.\n * @alpha\n */\nexport enum SchemaEditType {\n RenameSchemaItem = \"RenameSchemaItem\",\n RenameProperty = \"RenameProperty\",\n Skip = \"Skip\",\n}\n\n/**\n * Schema edit entry to rename a schema item.\n * @alpha\n */\nexport interface RenameSchemaItemEdit {\n type: SchemaEditType.RenameSchemaItem;\n key: string;\n value: string;\n}\n\n/**\n * Schema edit entry to rename a property of a class.\n * @alpha\n */\nexport interface RenamePropertyEdit {\n type: SchemaEditType.RenameProperty;\n key: string;\n value: string;\n}\n\n/**\n * Schema edit entry to skip a certain schema element matching the given key.\n * @alpha\n */\nexport interface SkipEdit {\n type: SchemaEditType.Skip;\n key: string;\n}\n\n/**\n * Union for all supported edits that can be applied to a schema.\n * @alpha\n */\nexport type AnySchemaEdits =\n SkipEdit |\n RenameSchemaItemEdit |\n RenamePropertyEdit;\n\nabstract class Editor {\n private readonly _edits: Array<AnySchemaEdits>;\n\n constructor(edits: Array<AnySchemaEdits>) {\n this._edits = edits;\n }\n\n protected add(edit: AnySchemaEdits) {\n const overrideEntry = this._edits.findIndex((entry) => {\n return entry.type === edit.type && entry.key === edit.key;\n });\n\n if (overrideEntry > -1) {\n this._edits[overrideEntry] = edit;\n } else {\n this._edits.push(edit);\n }\n }\n}\n\nclass PropertyEditor extends Editor {\n\n public rename(schemaName: string, className: string, propertyName: string, newName: string) {\n this.add({\n type: SchemaEditType.RenameProperty,\n key: `${schemaName}.${className}.${propertyName}`,\n value: newName,\n });\n }\n\n public skip(schemaName: string, className: string, propertyName: string) {\n this.add({\n type: SchemaEditType.Skip,\n key: `${schemaName}.${className}.${propertyName}`,\n });\n }\n}\n\nclass ItemEditor extends Editor {\n public rename(schemaName: string, itemName: string, newName: string) {\n this.add({\n type: SchemaEditType.RenameSchemaItem,\n key: `${schemaName}.${itemName}`,\n value: newName,\n });\n }\n\n public skip(schemaName: string, itemName: string) {\n this.add({\n type: SchemaEditType.Skip,\n key: `${schemaName}.${itemName}`,\n });\n }\n}\n\n/**\n * Defines a set of edits of a schema that can be applied to a schema during merging. The intention of this class\n * is to support saving of edits and load them again if needed.\n * @alpha\n */\nexport class SchemaEdits {\n private readonly _edits: Array<AnySchemaEdits>;\n\n public readonly properties: PropertyEditor;\n public readonly items: ItemEditor;\n\n /**\n * @alpha\n */\n constructor(initialize?: ReadonlyArray<AnySchemaEdits>) {\n this._edits = [];\n\n if (initialize) {\n this._edits.push(...initialize);\n }\n\n this.items = new ItemEditor(this._edits);\n this.properties = new PropertyEditor(this._edits);\n }\n\n /**\n * @internal\n */\n public async applyTo(differenceResult: SchemaDifferenceResult): Promise<void> {\n const postProcessing: Array<() => void> = [];\n for (const schemaEdit of this._edits) {\n if (schemaEdit.type === SchemaEditType.RenameSchemaItem) {\n applyRenameSchemaItemEdit(differenceResult, schemaEdit, postProcessing.push.bind(postProcessing));\n }\n if (schemaEdit.type === SchemaEditType.RenameProperty) {\n applyRenamePropertyEdit(differenceResult, schemaEdit);\n }\n if (schemaEdit.type === SchemaEditType.Skip) {\n applySkipEdit(differenceResult, schemaEdit);\n }\n }\n\n for (const callback of postProcessing) {\n callback();\n }\n }\n\n public toJSON(): ReadonlyArray<AnySchemaEdits> {\n return this._edits;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SkipEditHandler.d.ts","sourceRoot":"","sources":["../../../../src/Merging/Edits/SkipEditHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAElF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,sBAAsB,EAAE,IAAI,EAAE,QAAQ,QAa3E"}
1
+ {"version":3,"file":"SkipEditHandler.d.ts","sourceRoot":"","sources":["../../../../src/Merging/Edits/SkipEditHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAElF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,sBAAsB,EAAE,IAAI,EAAE,QAAQ,QAiB3E"}
@@ -16,7 +16,10 @@ exports.applySkipEdit = void 0;
16
16
  * @internal
17
17
  */
18
18
  function applySkipEdit(result, edit) {
19
- const [itemName, pathName] = edit.key.split(".");
19
+ const [schemaName, itemName, pathName] = edit.key.split(".");
20
+ if (!result.sourceSchemaName.startsWith(schemaName)) {
21
+ return;
22
+ }
20
23
  const foundIndices = pathName !== undefined
21
24
  ? findRelatedItemEntries(result, itemName, pathName)
22
25
  : findItemEntries(result, itemName);
@@ -1 +1 @@
1
- {"version":3,"file":"SkipEditHandler.js","sourceRoot":"","sources":["../../../../src/Merging/Edits/SkipEditHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAMH;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,MAA8B,EAAE,IAAc;IAC1E,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAiC,CAAC;IACjF,MAAM,YAAY,GAAG,QAAQ,KAAK,SAAS;QACzC,CAAC,CAAC,sBAAsB,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC;QACpD,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEtC,KAAK,MAAM,KAAK,IAAI,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC;QAC3C,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,sBAAsB,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC;AAbD,sCAaC;AAED,SAAS,sBAAsB,CAAC,SAAqC,EAAE,QAAgB,EAAE,IAAa;IACpG,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;QACpC,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YAC7D,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;QACtC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,EAAE,WAAW,EAA0B,EAAE,QAAgB;IAChF,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE;QACxC,IAAI,UAAU,IAAI,UAAU,IAAI,UAAU,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACjE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,sBAAsB,CAAC,EAAE,WAAW,EAA0B,EAAE,QAAgB,EAAE,QAAgB;IACzG,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE;QACxC,IAAI,UAAU,IAAI,UAAU,IAAI,UAAU,CAAC,QAAQ,KAAK,QAAQ,IAAI,MAAM,IAAI,UAAU,IAAI,UAAU,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACzH,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Merging\r\n */\r\n\r\nimport type { SchemaDifferenceResult } from \"../../Differencing/SchemaDifference\";\r\nimport type { SchemaDifferenceConflict } from \"../../ecschema-editing\";\r\nimport type { SkipEdit } from \"./SchemaEdits\";\r\n\r\n/**\r\n * Applies a skip edit to the schema differences. It basically removes all entries that\r\n * that are associated with the item to skip.\r\n * @param result The result of a schema differencing run\r\n * @param edit The skip edit to be applied.\r\n * @internal\r\n */\r\nexport function applySkipEdit(result: SchemaDifferenceResult, edit: SkipEdit) {\r\n const [itemName, pathName] = edit.key.split(\".\") as [string, string | undefined];\r\n const foundIndices = pathName !== undefined\r\n ? findRelatedItemEntries(result, itemName, pathName)\r\n : findItemEntries(result, itemName);\r\n\r\n for (const index of foundIndices.reverse()) {\r\n result.differences.splice(index, 1);\r\n }\r\n\r\n if (result.conflicts) {\r\n removeRelatedConflicts(result.conflicts, itemName, pathName);\r\n }\r\n}\r\n\r\nfunction removeRelatedConflicts(conflicts: SchemaDifferenceConflict[], itemName: string, path?: string) {\r\n const indices: number[] = [];\r\n conflicts.forEach((conflict, index) => {\r\n if (conflict.itemName === itemName && conflict.path === path) {\r\n indices.push(index);\r\n }\r\n });\r\n\r\n for (const index of indices.reverse()) {\r\n conflicts.splice(index, 1);\r\n }\r\n}\r\n\r\nfunction findItemEntries({ differences }: SchemaDifferenceResult, itemName: string): number[] {\r\n const found: number[] = [];\r\n differences.forEach((difference, index) => {\r\n if (\"itemName\" in difference && difference.itemName === itemName) {\r\n found.push(index);\r\n }\r\n });\r\n return found;\r\n}\r\n\r\nfunction findRelatedItemEntries({ differences }: SchemaDifferenceResult, itemName: string, pathName: string): number[] {\r\n const found: number[] = [];\r\n differences.forEach((difference, index) => {\r\n if (\"itemName\" in difference && difference.itemName === itemName && \"path\" in difference && difference.path === pathName) {\r\n found.push(index);\r\n }\r\n });\r\n return found;\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"SkipEditHandler.js","sourceRoot":"","sources":["../../../../src/Merging/Edits/SkipEditHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAMH;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,MAA8B,EAAE,IAAc;IAC1E,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,Q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,EAAE,CAAC;IAC3B,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE;QACxC,IAAI,UAAU,IAAI,UAAU,IAAI,UAAU,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACjE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,sBAAsB,CAAC,EAAE,WAAW,EAA0B,EAAE,QAAgB,EAAE,QAAgB;IACzG,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE;QACxC,IAAI,UAAU,IAAI,UAAU,IAAI,UAAU,CAAC,QAAQ,KAAK,QAAQ,IAAI,MAAM,IAAI,UAAU,IAAI,UAAU,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACzH,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Merging\n */\n\nimport type { SchemaDifferenceResult } from \"../../Differencing/SchemaDifference\";\nimport type { SchemaDifferenceConflict } from \"../../ecschema-editing\";\nimport type { SkipEdit } from \"./SchemaEdits\";\n\n/**\n * Applies a skip edit to the schema differences. It basically removes all entries that\n * that are associated with the item to skip.\n * @param result The result of a schema differencing run\n * @param edit The skip edit to be applied.\n * @internal\n */\nexport function applySkipEdit(result: SchemaDifferenceResult, edit: SkipEdit) {\n const [schemaName, itemName, pathName] = edit.key.split(\".\") as [string, string, string | undefined];\n if (!result.sourceSchemaName.startsWith(schemaName)) {\n return;\n }\n\n const foundIndices = pathName !== undefined\n ? findRelatedItemEntries(result, itemName, pathName)\n : findItemEntries(result, itemName);\n\n for (const index of foundIndices.reverse()) {\n result.differences.splice(index, 1);\n }\n\n if (result.conflicts) {\n removeRelatedConflicts(result.conflicts, itemName, pathName);\n }\n}\n\nfunction removeRelatedConflicts(conflicts: SchemaDifferenceConflict[], itemName: string, path?: string) {\n const indices: number[] = [];\n conflicts.forEach((conflict, index) => {\n if (conflict.itemName === itemName && conflict.path === path) {\n indices.push(index);\n }\n });\n\n for (const index of indices.reverse()) {\n conflicts.splice(index, 1);\n }\n}\n\nfunction findItemEntries({ differences }: SchemaDifferenceResult, itemName: string): number[] {\n const found: number[] = [];\n differences.forEach((difference, index) => {\n if (\"itemName\" in difference && difference.itemName === itemName) {\n found.push(index);\n }\n });\n return found;\n}\n\nfunction findRelatedItemEntries({ differences }: SchemaDifferenceResult, itemName: string, pathName: string): number[] {\n const found: number[] = [];\n differences.forEach((difference, index) => {\n if (\"itemName\" in difference && difference.itemName === itemName && \"path\" in difference && difference.path === pathName) {\n found.push(index);\n }\n });\n return found;\n}\n\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/EntityClassMerger.ts"],"names":[],"mappings":";;;AAKA,yDAAuF;AAEvF,+CAA4C;AAC5C,gEAAyD;AAGzD;;;GAGG;AACU,QAAA,iBAAiB,GAAmD;IAC/E,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM;QACvB,OAAO,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE;YACtE,IAAI,EAAE,MAAM,CAAC,QAAQ;YACrB,cAAc,EAAE,MAAM,CAAC,UAAU;YAEjC,GAAG,MAAM,CAAC,UAAU;SACrB,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAwB;QAC7D,IAAG,MAAM,CAAC,UAAU,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1C,KAAI,MAAM,KAAK,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;gBAC5C,MAAM,QAAQ,GAAG,MAAM,IAAA,sCAAmB,EAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gBAC3D,MAAM,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;QAED,OAAO,IAAA,yBAAW,EAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;CACF,CAAC;AAEF;;;GAGG;AACI,KAAK,UAAU,gBAAgB,CAAC,OAA2B,EAAE,MAAkC;IACpG,IAAG,MAAM,CAAC,UAAU,KAAK,KAAK,EAAE,CAAC;QAC/B,KAAI,MAAM,aAAa,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YAC7C,MAAM,QAAQ,GAAG,MAAM,IAAA,sCAAmB,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;YACnE,MAAM,SAAS,GAAG,IAAI,iCAAa,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;YAC9E,MAAM,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,8BAA8B,MAAM,CAAC,QAAQ,4BAA4B,CAAC,CAAC;IAC7F,CAAC;AACH,CAAC;AAVD,4CAUC","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 EntityClassDifference, EntityClassMixinDifference } from \"../Differencing/SchemaDifference\";\r\nimport { type SchemaItemMergerHandler, updateSchemaItemKey } from \"./SchemaItemMerger\";\r\nimport { type MutableEntityClass } from \"../Editing/Mutable/MutableEntityClass\";\r\nimport { modifyClass } from \"./ClassMerger\";\r\nimport { SchemaItemKey } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaMergeContext } from \"./SchemaMerger\";\r\n\r\n/**\r\n * Defines a merge handler to merge Entity Class schema items.\r\n * @internal\r\n */\r\nexport const entityClassMerger: SchemaItemMergerHandler<EntityClassDifference> = {\r\n async add(context, change) {\r\n return context.editor.entities.createFromProps(context.targetSchemaKey, {\r\n name: change.itemName,\r\n schemaItemType: change.schemaType,\r\n\r\n ...change.difference,\r\n });\r\n },\r\n async modify(context, change, itemKey, item: MutableEntityClass) {\r\n if(change.difference.mixins !== undefined) {\r\n for(const mixin of change.difference.mixins) {\r\n const mixinKey = await updateSchemaItemKey(context, mixin);\r\n await context.editor.entities.addMixin(itemKey, mixinKey);\r\n }\r\n }\r\n\r\n return modifyClass(context, change, itemKey, item);\r\n },\r\n};\r\n\r\n/**\r\n * Merges Mixins to Entity Class schema items.\r\n * @internal\r\n */\r\nexport async function mergeClassMixins(context: SchemaMergeContext, change: EntityClassMixinDifference): Promise<void> {\r\n if(change.changeType === \"add\") {\r\n for(const mixinFullName of change.difference) {\r\n const mixinKey = await updateSchemaItemKey(context, mixinFullName);\r\n const entityKey = new SchemaItemKey(change.itemName, context.targetSchemaKey);\r\n await context.editor.entities.addMixin(entityKey, mixinKey);\r\n }\r\n } else {\r\n throw new Error(`Changing the entity class '${change.itemName}' mixins is not supported.`);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"EntityClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/EntityClassMerger.ts"],"names":[],"mappings":";;;AAKA,yDAAuF;AAEvF,+CAA4C;AAC5C,gEAAyD;AAGzD;;;GAGG;AACU,QAAA,iBAAiB,GAAmD;IAC/E,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM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,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,8BAA8B,MAAM,CAAC,QAAQ,4BAA4B,CAAC,CAAC;IAC7F,CAAC;AACH,CAAC;AAVD,4CAUC","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 { type EntityClassDifference, EntityClassMixinDifference } from \"../Differencing/SchemaDifference\";\nimport { type SchemaItemMergerHandler, updateSchemaItemKey } from \"./SchemaItemMerger\";\nimport { type MutableEntityClass } from \"../Editing/Mutable/MutableEntityClass\";\nimport { modifyClass } from \"./ClassMerger\";\nimport { SchemaItemKey } from \"@itwin/ecschema-metadata\";\nimport { SchemaMergeContext } from \"./SchemaMerger\";\n\n/**\n * Defines a merge handler to merge Entity Class schema items.\n * @internal\n */\nexport const entityClassMerger: SchemaItemMergerHandler<EntityClassDifference> = {\n async add(context, change) {\n return context.editor.entities.createFromProps(context.targetSchemaKey, {\n name: change.itemName,\n schemaItemType: change.schemaType,\n\n ...change.difference,\n });\n },\n async modify(context, change, itemKey, item: MutableEntityClass) {\n if(change.difference.mixins !== undefined) {\n for(const mixin of change.difference.mixins) {\n const mixinKey = await updateSchemaItemKey(context, mixin);\n await context.editor.entities.addMixin(itemKey, mixinKey);\n }\n }\n\n return modifyClass(context, change, itemKey, item);\n },\n};\n\n/**\n * Merges Mixins to Entity Class schema items.\n * @internal\n */\nexport async function mergeClassMixins(context: SchemaMergeContext, change: EntityClassMixinDifference): Promise<void> {\n if(change.changeType === \"add\") {\n for(const mixinFullName of change.difference) {\n const mixinKey = await updateSchemaItemKey(context, mixinFullName);\n const entityKey = new SchemaItemKey(change.itemName, context.targetSchemaKey);\n await context.editor.entities.addMixin(entityKey, mixinKey);\n }\n } else {\n throw new Error(`Changing the entity class '${change.itemName}' mixins is not supported.`);\n }\n}\n"]}