@itwin/ecschema-editing 4.9.0-dev.6 → 4.9.0-dev.8

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 (82) hide show
  1. package/lib/cjs/Differencing/Errors.js.map +1 -1
  2. package/lib/cjs/Differencing/SchemaConflicts.js.map +1 -1
  3. package/lib/cjs/Differencing/SchemaDiagnosticVisitor.js.map +1 -1
  4. package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
  5. package/lib/cjs/Differencing/Utils.js.map +1 -1
  6. package/lib/cjs/Editing/Constants.js.map +1 -1
  7. package/lib/cjs/Editing/CustomAttributes.js.map +1 -1
  8. package/lib/cjs/Editing/ECClasses.js.map +1 -1
  9. package/lib/cjs/Editing/Editor.js.map +1 -1
  10. package/lib/cjs/Editing/Entities.js.map +1 -1
  11. package/lib/cjs/Editing/Enumerations.js.map +1 -1
  12. package/lib/cjs/Editing/Exception.js.map +1 -1
  13. package/lib/cjs/Editing/Formats.js.map +1 -1
  14. package/lib/cjs/Editing/InvertedUnits.js.map +1 -1
  15. package/lib/cjs/Editing/KindOfQuantities.js.map +1 -1
  16. package/lib/cjs/Editing/Mixins.js.map +1 -1
  17. package/lib/cjs/Editing/Mutable/MutableArrayProperty.js.map +1 -1
  18. package/lib/cjs/Editing/Mutable/MutableCAClass.js.map +1 -1
  19. package/lib/cjs/Editing/Mutable/MutableClass.js.map +1 -1
  20. package/lib/cjs/Editing/Mutable/MutableConstant.js.map +1 -1
  21. package/lib/cjs/Editing/Mutable/MutableEntityClass.js.map +1 -1
  22. package/lib/cjs/Editing/Mutable/MutableEnumeration.js.map +1 -1
  23. package/lib/cjs/Editing/Mutable/MutableFormat.js.map +1 -1
  24. package/lib/cjs/Editing/Mutable/MutableInvertedUnit.js.map +1 -1
  25. package/lib/cjs/Editing/Mutable/MutableKindOfQuantity.js.map +1 -1
  26. package/lib/cjs/Editing/Mutable/MutableMixin.js.map +1 -1
  27. package/lib/cjs/Editing/Mutable/MutableNavigationProperty.js.map +1 -1
  28. package/lib/cjs/Editing/Mutable/MutablePhenomenon.js.map +1 -1
  29. package/lib/cjs/Editing/Mutable/MutablePrimitiveOrEnumProperty.js.map +1 -1
  30. package/lib/cjs/Editing/Mutable/MutableProperty.js.map +1 -1
  31. package/lib/cjs/Editing/Mutable/MutablePropertyCategory.js.map +1 -1
  32. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.js.map +1 -1
  33. package/lib/cjs/Editing/Mutable/MutableSchema.js.map +1 -1
  34. package/lib/cjs/Editing/Mutable/MutableSchemaItem.js.map +1 -1
  35. package/lib/cjs/Editing/Mutable/MutableStructProperty.js.map +1 -1
  36. package/lib/cjs/Editing/Mutable/MutableUnit.js.map +1 -1
  37. package/lib/cjs/Editing/Mutable/MutableUnitSystem.js.map +1 -1
  38. package/lib/cjs/Editing/Phenomena.js.map +1 -1
  39. package/lib/cjs/Editing/Properties.js.map +1 -1
  40. package/lib/cjs/Editing/PropertyCategories.js.map +1 -1
  41. package/lib/cjs/Editing/RelationshipClasses.js.map +1 -1
  42. package/lib/cjs/Editing/SchemaItems.js.map +1 -1
  43. package/lib/cjs/Editing/Structs.js.map +1 -1
  44. package/lib/cjs/Editing/UnitSystems.js.map +1 -1
  45. package/lib/cjs/Editing/Units.js.map +1 -1
  46. package/lib/cjs/Merging/CAClassMerger.js.map +1 -1
  47. package/lib/cjs/Merging/ClassMerger.js.map +1 -1
  48. package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
  49. package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
  50. package/lib/cjs/Merging/Edits/RenameEditHandler.js.map +1 -1
  51. package/lib/cjs/Merging/Edits/SchemaEdits.js.map +1 -1
  52. package/lib/cjs/Merging/Edits/SkipEditHandler.js.map +1 -1
  53. package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
  54. package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
  55. package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
  56. package/lib/cjs/Merging/MixinMerger.js.map +1 -1
  57. package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
  58. package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -1
  59. package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
  60. package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
  61. package/lib/cjs/Merging/SchemaItemMerger.js.map +1 -1
  62. package/lib/cjs/Merging/SchemaMerger.js.map +1 -1
  63. package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
  64. package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -1
  65. package/lib/cjs/Validation/Diagnostic.js.map +1 -1
  66. package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
  67. package/lib/cjs/Validation/ECRules.js.map +1 -1
  68. package/lib/cjs/Validation/LoggingDiagnosticReporter.js.map +1 -1
  69. package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
  70. package/lib/cjs/Validation/Rules.js.map +1 -1
  71. package/lib/cjs/Validation/SchemaChanges.js.map +1 -1
  72. package/lib/cjs/Validation/SchemaCompareDiagnostics.js.map +1 -1
  73. package/lib/cjs/Validation/SchemaCompareReporter.js.map +1 -1
  74. package/lib/cjs/Validation/SchemaCompareResultDelegate.js.map +1 -1
  75. package/lib/cjs/Validation/SchemaCompareVisitor.js.map +1 -1
  76. package/lib/cjs/Validation/SchemaComparer.js.map +1 -1
  77. package/lib/cjs/Validation/SchemaValidater.js.map +1 -1
  78. package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
  79. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  80. package/lib/cjs/ecschema-editing.js.map +1 -1
  81. package/package.json +9 -9
  82. package/public/locales/en/ECSchemaEditing.json +26 -26
@@ -1 +1 @@
1
- {"version":3,"file":"Structs.js","sourceRoot":"","sources":["../../../src/Editing/Structs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAmH;AAE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,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7I,CAAC;IACH,CAAC;CACF;AA/BD,0BA+BC","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 Editing\n */\n\nimport { SchemaItemKey, SchemaItemType, SchemaKey, StructClass, StructClassProps } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport { ECClasses } from \"./ECClasses\";\nimport { MutableStructClass } from \"./Mutable/MutableClass\";\nimport { ClassId, ECEditingStatus, SchemaEditingError } from \"./Exception\";\n\n/**\n * @alpha A class extending ECClasses allowing you to create schema items of type StructClass.\n */\nexport class Structs extends ECClasses {\n public constructor(schemaEditor: SchemaContextEditor) {\n super(SchemaItemType.StructClass, schemaEditor);\n }\n\n public async create(schemaKey: SchemaKey, name: string, displayLabel?: string, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey> {\n try {\n const newClass = await this.createClass<StructClass>(schemaKey, this.schemaItemType, (schema) => schema.createStructClass.bind(schema), name, baseClassKey) as MutableStructClass;\n\n if (displayLabel)\n newClass.setDisplayLabel(displayLabel);\n\n return newClass.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new ClassId(this.schemaItemType, name, schemaKey), e);\n }\n }\n\n /**\n * Creates a StructClass through a StructClassProps.\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\n * @param structProps a json object that will be used to populate the new StructClass. Needs a name value passed in.\n */\n public async createFromProps(schemaKey: SchemaKey, structProps: StructClassProps): Promise<SchemaItemKey> {\n try {\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createStructClass.bind(schema), structProps);\n return newClass.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, structProps.name!, schemaKey), e);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"Structs.js","sourceRoot":"","sources":["../../../src/Editing/Structs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAmH;AAEnH,2CAAwC;AAExC,2CAA2E;AAE3E;;GAEG;AACH,MAAa,OAAQ,SAAQ,qBAAS;IACpC,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAClD,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,YAAqB,EAAE,YAA4B;QACzG,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAc,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,YAAY,CAAuB,CAAC;YAElL,IAAI,YAAY;gBACd,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YAEzC,OAAO,QAAQ,CAAC,GAAG,CAAC;QACtB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,sBAAsB,EAAE,IAAI,mBAAO,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7H,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,WAA6B;QAC9E,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC;YACtJ,OAAO,QAAQ,CAAC,GAAG,CAAC;QACtB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,mBAAO,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7I,CAAC;IACH,CAAC;CACF;AA/BD,0BA+BC","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 Editing\r\n */\r\n\r\nimport { SchemaItemKey, SchemaItemType, SchemaKey, StructClass, StructClassProps } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { ECClasses } from \"./ECClasses\";\r\nimport { MutableStructClass } from \"./Mutable/MutableClass\";\r\nimport { ClassId, ECEditingStatus, SchemaEditingError } from \"./Exception\";\r\n\r\n/**\r\n * @alpha A class extending ECClasses allowing you to create schema items of type StructClass.\r\n */\r\nexport class Structs extends ECClasses {\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.StructClass, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, displayLabel?: string, baseClassKey?: SchemaItemKey): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createClass<StructClass>(schemaKey, this.schemaItemType, (schema) => schema.createStructClass.bind(schema), name, baseClassKey) as MutableStructClass;\r\n\r\n if (displayLabel)\r\n newClass.setDisplayLabel(displayLabel);\r\n\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new ClassId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a StructClass through a StructClassProps.\r\n * @param schemaKey a SchemaKey of the Schema that will house the new object.\r\n * @param structProps a json object that will be used to populate the new StructClass. Needs a name value passed in.\r\n */\r\n public async createFromProps(schemaKey: SchemaKey, structProps: StructClassProps): Promise<SchemaItemKey> {\r\n try {\r\n const newClass = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createStructClass.bind(schema), structProps);\r\n return newClass.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new ClassId(this.schemaItemType, structProps.name!, schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"UnitSystems.js","sourceRoot":"","sources":["../../../src/Editing/UnitSystems.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAiH;AAGjH,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,WAAY,SAAQ,yBAAW;IAC1C,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,YAAqB;QAE3E,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAa,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAsB,CAAC;YAE3K,IAAI,YAAY;gBACd,aAAa,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YAE9C,OAAO,aAAa,CAAC,GAAG,CAAC;QAC3B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,sBAAsB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAClI,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,eAAgC;QACjF,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC,CAAC;YAC9J,OAAO,aAAa,CAAC,GAAG,CAAC;QAC3B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACtJ,CAAC;IACH,CAAC;CACF;AA3BD,kCA2BC","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 Editing\n */\n\nimport { SchemaItemKey, SchemaItemType, SchemaKey, UnitSystem, UnitSystemProps } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport { MutableUnitSystem } from \"./Mutable/MutableUnitSystem\";\nimport { ECEditingStatus, SchemaEditingError, SchemaItemId } from \"./Exception\";\nimport { SchemaItems } from \"./SchemaItems\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type UnitSystems.\n */\nexport class UnitSystems extends SchemaItems {\n public constructor(schemaEditor: SchemaContextEditor) {\n super(SchemaItemType.UnitSystem, schemaEditor);\n }\n\n public async create(schemaKey: SchemaKey, name: string, displayLabel?: string): Promise<SchemaItemKey> {\n\n try {\n const newUnitSystem = await this.createSchemaItem<UnitSystem>(schemaKey, this.schemaItemType, (schema) => schema.createUnitSystem.bind(schema), name) as MutableUnitSystem;\n\n if (displayLabel)\n newUnitSystem.setDisplayLabel(displayLabel);\n\n return newUnitSystem.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);\n }\n }\n\n public async createFromProps(schemaKey: SchemaKey, unitSystemProps: UnitSystemProps): Promise<SchemaItemKey> {\n try {\n const newUnitSystem = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createUnitSystem.bind(schema), unitSystemProps);\n return newUnitSystem.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, unitSystemProps.name!, schemaKey), e);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"UnitSystems.js","sourceRoot":"","sources":["../../../src/Editing/UnitSystems.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAiH;AAGjH,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,WAAY,SAAQ,yBAAW;IAC1C,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,YAAqB;QAE3E,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAa,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAsB,CAAC;YAE3K,IAAI,YAAY;gBACd,aAAa,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YAE9C,OAAO,aAAa,CAAC,GAAG,CAAC;QAC3B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,sBAAsB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAClI,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAAoB,EAAE,eAAgC;QACjF,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC,CAAC;YAC9J,OAAO,aAAa,CAAC,GAAG,CAAC;QAC3B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QACtJ,CAAC;IACH,CAAC;CACF;AA3BD,kCA2BC","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 Editing\r\n */\r\n\r\nimport { SchemaItemKey, SchemaItemType, SchemaKey, UnitSystem, UnitSystemProps } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableUnitSystem } from \"./Mutable/MutableUnitSystem\";\r\nimport { ECEditingStatus, SchemaEditingError, SchemaItemId } from \"./Exception\";\r\nimport { SchemaItems } from \"./SchemaItems\";\r\n\r\n/**\r\n * @alpha\r\n * A class allowing you to create schema items of type UnitSystems.\r\n */\r\nexport class UnitSystems extends SchemaItems {\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.UnitSystem, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, displayLabel?: string): Promise<SchemaItemKey> {\r\n\r\n try {\r\n const newUnitSystem = await this.createSchemaItem<UnitSystem>(schemaKey, this.schemaItemType, (schema) => schema.createUnitSystem.bind(schema), name) as MutableUnitSystem;\r\n\r\n if (displayLabel)\r\n newUnitSystem.setDisplayLabel(displayLabel);\r\n\r\n return newUnitSystem.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n public async createFromProps(schemaKey: SchemaKey, unitSystemProps: UnitSystemProps): Promise<SchemaItemKey> {\r\n try {\r\n const newUnitSystem = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createUnitSystem.bind(schema), unitSystemProps);\r\n return newUnitSystem.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, unitSystemProps.name!, schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Units.js","sourceRoot":"","sources":["../../../src/Editing/Units.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAgK;AAGhK,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,KAAM,SAAQ,yBAAW;IACpC,6CAA6C;IAC7C,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAC3C,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,UAAkB,EAAE,UAAyB,EAAE,UAAyB,EAAE,YAAqB;QACrJ,IAAI,CAAC;YACH,MAAM,OAAO,GA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M,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;YAC5I,OAAO,OAAO,CAAC,GAAG,CAAC;QACrB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAChJ,CAAC;IACH,CAAC;CACF;AAnCD,sBAmCC","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 Editing\n */\n\nimport { DelayedPromiseWithProps, Phenomenon, SchemaItemKey, SchemaItemType, SchemaItemUnitProps, SchemaKey, Unit, UnitSystem } from \"@itwin/ecschema-metadata\";\nimport { SchemaContextEditor } from \"./Editor\";\nimport { MutableUnit } from \"./Mutable/MutableUnit\";\nimport { ECEditingStatus, SchemaEditingError, SchemaItemId } from \"./Exception\";\nimport { SchemaItems } from \"./SchemaItems\";\n\n/**\n * @alpha\n * A class allowing you to create schema items of type Unit.\n */\nexport class Units extends SchemaItems {\n // TODO: Add more setters for all attributes.\n public constructor(schemaEditor: SchemaContextEditor) {\n super(SchemaItemType.Unit, schemaEditor);\n }\n\n public async create(schemaKey: SchemaKey, name: string, definition: string, phenomenon: SchemaItemKey, unitSystem: SchemaItemKey, displayLabel?: string): Promise<SchemaItemKey> {\n try {\n const newUnit = await this.createSchemaItem<Unit>(schemaKey, this.schemaItemType, (schema) => schema.createUnit.bind(schema), name) as MutableUnit;\n\n const phenomenonItem = await this.lookupSchemaItem<Phenomenon>(newUnit.schema.schemaKey, phenomenon, SchemaItemType.Phenomenon);\n await newUnit.setPhenomenon(new DelayedPromiseWithProps<SchemaItemKey, Phenomenon>(phenomenon, async () => phenomenonItem));\n\n const unitSystemItem = await this.lookupSchemaItem<UnitSystem>(newUnit.schema.schemaKey, unitSystem, SchemaItemType.UnitSystem);\n await newUnit.setUnitSystem(new DelayedPromiseWithProps<SchemaItemKey, UnitSystem>(unitSystem, async () => unitSystemItem));\n\n await newUnit.setDefinition(definition);\n\n if (displayLabel)\n newUnit.setDisplayLabel(displayLabel);\n\n return newUnit.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);\n }\n }\n\n public async createFromProps(schemaKey: SchemaKey, unitProps: SchemaItemUnitProps): Promise<SchemaItemKey> {\n try {\n const newUnit = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createUnit.bind(schema), unitProps);\n return newUnit.key;\n } catch (e: any) {\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, unitProps.name!, schemaKey), e);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"Units.js","sourceRoot":"","sources":["../../../src/Editing/Units.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gEAAgK;AAGhK,2CAAgF;AAChF,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,KAAM,SAAQ,yBAAW;IACpC,6CAA6C;IAC7C,YAAmB,YAAiC;QAClD,KAAK,CAAC,kCAAc,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAC3C,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,IAAY,EAAE,UAAkB,EAAE,UAAyB,EAAE,UAAyB,EAAE,YAAqB;QACrJ,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAO,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,I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C;QACrB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,MAAM,IAAI,8BAAkB,CAAC,2BAAe,CAAC,yBAAyB,EAAE,IAAI,wBAAY,CAAC,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,IAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAChJ,CAAC;IACH,CAAC;CACF;AAnCD,sBAmCC","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 Editing\r\n */\r\n\r\nimport { DelayedPromiseWithProps, Phenomenon, SchemaItemKey, SchemaItemType, SchemaItemUnitProps, SchemaKey, Unit, UnitSystem } from \"@itwin/ecschema-metadata\";\r\nimport { SchemaContextEditor } from \"./Editor\";\r\nimport { MutableUnit } from \"./Mutable/MutableUnit\";\r\nimport { ECEditingStatus, SchemaEditingError, SchemaItemId } from \"./Exception\";\r\nimport { SchemaItems } from \"./SchemaItems\";\r\n\r\n/**\r\n * @alpha\r\n * A class allowing you to create schema items of type Unit.\r\n */\r\nexport class Units extends SchemaItems {\r\n // TODO: Add more setters for all attributes.\r\n public constructor(schemaEditor: SchemaContextEditor) {\r\n super(SchemaItemType.Unit, schemaEditor);\r\n }\r\n\r\n public async create(schemaKey: SchemaKey, name: string, definition: string, phenomenon: SchemaItemKey, unitSystem: SchemaItemKey, displayLabel?: string): Promise<SchemaItemKey> {\r\n try {\r\n const newUnit = await this.createSchemaItem<Unit>(schemaKey, this.schemaItemType, (schema) => schema.createUnit.bind(schema), name) as MutableUnit;\r\n\r\n const phenomenonItem = await this.lookupSchemaItem<Phenomenon>(newUnit.schema.schemaKey, phenomenon, SchemaItemType.Phenomenon);\r\n await newUnit.setPhenomenon(new DelayedPromiseWithProps<SchemaItemKey, Phenomenon>(phenomenon, async () => phenomenonItem));\r\n\r\n const unitSystemItem = await this.lookupSchemaItem<UnitSystem>(newUnit.schema.schemaKey, unitSystem, SchemaItemType.UnitSystem);\r\n await newUnit.setUnitSystem(new DelayedPromiseWithProps<SchemaItemKey, UnitSystem>(unitSystem, async () => unitSystemItem));\r\n\r\n await newUnit.setDefinition(definition);\r\n\r\n if (displayLabel)\r\n newUnit.setDisplayLabel(displayLabel);\r\n\r\n return newUnit.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFailed, new SchemaItemId(this.schemaItemType, name, schemaKey), e);\r\n }\r\n }\r\n\r\n public async createFromProps(schemaKey: SchemaKey, unitProps: SchemaItemUnitProps): Promise<SchemaItemKey> {\r\n try {\r\n const newUnit = await this.createSchemaItemFromProps(schemaKey, this.schemaItemType, (schema) => schema.createUnit.bind(schema), unitProps);\r\n return newUnit.key;\r\n } catch (e: any) {\r\n throw new SchemaEditingError(ECEditingStatus.CreateSchemaItemFromProps, new SchemaItemId(this.schemaItemType, unitProps.name!, schemaKey), e);\r\n }\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CAClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/CAClassMerger.ts"],"names":[],"mappings":";;;AAOA,gEAAoG;AACpG,+CAA4C;AAE5C;;;GAGG;AACU,QAAA,0BAA0B,GAA4D;IACjG,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM;QACvB,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;QAClG,CAAC;QAED,OAAO,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE;YAC9E,GAAG,MAAM,CAAC,UAAU;YACpB,IAAI,EAAE,MAAM,CAAC,QAAQ;YACrB,cAAc,EAAE,MAAM,CAAC,UAAU;YACjC,SAAS,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS;SACvC,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAoB;QACzD,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAC9C,MAAM,YAAY,GAAG,IAAA,yCAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC3D,IAAI,YAAY,KAAK,EAAE,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,YAAY,EAAE,CAAC;gBACxE,MAAM,aAAa,GAAG,IAAA,qDAAiC,EAAC,GAAG,YAAY,KAAK,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBAC3G,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;oBAChC,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;gBACxF,CAAC;gBACD,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;QACD,OAAO,IAAA,yBAAW,EAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACrD,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 CustomAttributeClassDifference } from \"../Differencing/SchemaDifference\";\nimport { type SchemaItemMergerHandler } from \"./SchemaItemMerger\";\nimport { type MutableCAClass } from \"../Editing/Mutable/MutableCAClass\";\nimport { containerTypeToString, parseCustomAttributeContainerType } from \"@itwin/ecschema-metadata\";\nimport { modifyClass } from \"./ClassMerger\";\n\n/**\n * Defines a merge handler to merge Custom Attribute Class schema items.\n * @internal\n */\nexport const customAttributeClassMerger: SchemaItemMergerHandler<CustomAttributeClassDifference> = {\n async add(context, change) {\n if (change.difference.appliesTo === undefined) {\n throw new Error(\"appliesTo is a required property of a CustomAttributeClass but it is not set\");\n }\n\n return context.editor.customAttributes.createFromProps(context.targetSchemaKey, {\n ...change.difference,\n name: change.itemName,\n schemaItemType: change.schemaType,\n appliesTo: change.difference.appliesTo,\n });\n },\n async modify(context, change, itemKey, item: MutableCAClass) {\n if (change.difference.appliesTo !== undefined) {\n const currentValue = containerTypeToString(item.appliesTo);\n if (currentValue !== \"\" && change.difference.appliesTo !== currentValue) {\n const containerType = parseCustomAttributeContainerType(`${currentValue}, ${change.difference.appliesTo}`);\n if (containerType === undefined) {\n throw new Error(\"An invalid custom attribute class containerType has been provided.\");\n }\n item.setAppliesTo(containerType);\n }\n }\n return modifyClass(context, change, itemKey, item);\n },\n};\n"]}
1
+ {"version":3,"file":"CAClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/CAClassMerger.ts"],"names":[],"mappings":";;;AAOA,gEAAoG;AACpG,+CAA4C;AAE5C;;;GAGG;AACU,QAAA,0BAA0B,GAA4D;IACjG,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM;QACvB,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;QAClG,CAAC;QAED,OAAO,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE;YAC9E,GAAG,MAAM,CAAC,UAAU;YACpB,IAAI,EAAE,MAAM,CAAC,QAAQ;YACrB,cAAc,EAAE,MAAM,CAAC,UAAU;YACjC,SAAS,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS;SACvC,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAoB;QACzD,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAC9C,MAAM,YAAY,GAAG,IAAA,yCAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC3D,IAAI,YAAY,KAAK,EAAE,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,YAAY,EAAE,CAAC;gBACxE,MAAM,aAAa,GAAG,IAAA,qDAAiC,EAAC,GAAG,YAAY,KAAK,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBAC3G,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;oBAChC,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;gBACxF,CAAC;gBACD,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;QACD,OAAO,IAAA,yBAAW,EAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACrD,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 CustomAttributeClassDifference } from \"../Differencing/SchemaDifference\";\r\nimport { type SchemaItemMergerHandler } from \"./SchemaItemMerger\";\r\nimport { type MutableCAClass } from \"../Editing/Mutable/MutableCAClass\";\r\nimport { containerTypeToString, parseCustomAttributeContainerType } from \"@itwin/ecschema-metadata\";\r\nimport { modifyClass } from \"./ClassMerger\";\r\n\r\n/**\r\n * Defines a merge handler to merge Custom Attribute Class schema items.\r\n * @internal\r\n */\r\nexport const customAttributeClassMerger: SchemaItemMergerHandler<CustomAttributeClassDifference> = {\r\n async add(context, change) {\r\n if (change.difference.appliesTo === undefined) {\r\n throw new Error(\"appliesTo is a required property of a CustomAttributeClass but it is not set\");\r\n }\r\n\r\n return context.editor.customAttributes.createFromProps(context.targetSchemaKey, {\r\n ...change.difference,\r\n name: change.itemName,\r\n schemaItemType: change.schemaType,\r\n appliesTo: change.difference.appliesTo,\r\n });\r\n },\r\n async modify(context, change, itemKey, item: MutableCAClass) {\r\n if (change.difference.appliesTo !== undefined) {\r\n const currentValue = containerTypeToString(item.appliesTo);\r\n if (currentValue !== \"\" && change.difference.appliesTo !== currentValue) {\r\n const containerType = parseCustomAttributeContainerType(`${currentValue}, ${change.difference.appliesTo}`);\r\n if (containerType === undefined) {\r\n throw new Error(\"An invalid custom attribute class containerType has been provided.\");\r\n }\r\n item.setAppliesTo(containerType);\r\n }\r\n }\r\n return modifyClass(context, change, itemKey, item);\r\n },\r\n};\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ClassMerger.js","sourceRoot":"","sources":["../../../src/Merging/ClassMerger.ts"],"names":[],"mappings":";;;AAMA,yDAAoG;AAEpG,gEAAwI;AACxI,2DAA0E;AAC1E,mDAA6D;AAC7D,+CAAiD;AACjD,uEAAmI;AACnI,qDAAiF;AACjF,mEAAgE;AAChE,+CAA+C;AAI/C;;GAEG;AACI,KAAK,SAAS,CAAC,CAAC,eAAe,CAAC,OAA2B,EAAE,YAAmC;IACrG,mGAAmG;IACnG,MAAM,mBAAmB,CAAC,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;QAC/D,IAAI,MAAM,CAAC,UAAU,KAAK,KAAK,IAAI,MAAM,CAAC,GAAG,EAAE,CAAC;YAC9C,kFAAkF;YAClF,MAAM,UAAU,GAAG;gBACjB,GAAG,MAAM;gBACT,UAAU,EAAE;oBACV,GAAG,MAAM,CAAC,UAAU;oBACpB,uDAAuD;oBACvD,SAAS,EAAE,SAAS;oBACpB,MAAM,EAAE,SAAS;oBACjB,UAAU,EAAE,SAAS;oBACrB,gBAAgB,EAAE,SAAS;iBAC5B;aACF,CAAC;YACF,MAAM,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QACxC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,qFAAqF;IACrF,mFAAmF;IACnF,MAAM,mBAAmB,CAAC,YAAY,EAAE,KAAK,EAAE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BAA4B,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":["/*---------------------------------------------------------------------------------------------\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,\n });\n },\n modify: modifyClass,\n};\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,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E,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 +1 @@
1
- {"version":3,"file":"ConstantMerger.js","sourceRoot":"","sources":["../../../src/Merging/ConstantMerger.ts"],"names":[],"mappings":";;;AAKA,yDAAuF;AAEvF,gEAAgH;AAEhH;;;GAGG;AACU,QAAA,cAAc,GAAgD;IACzE,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM;QACvB,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;QACD,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;QAED,8DAA8D;QAC9D,MAAM,aAAa,GAAG,MAAM,IAAA,sCAAmB,EAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;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,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
+ {"version":3,"file":"ConstantMerger.js","sourceRoot":"","sources":["../../../src/Merging/ConstantMerger.ts"],"names":[],"mappings":";;;AAKA,yDAAuF;AAEvF,gEAAgH;AAEhH;;;GAGG;AACU,QAAA,cAAc,GAAgD;IACzE,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM;QACvB,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;QACD,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;QAED,8DAA8D;QAC9D,MAAM,aAAa,GAAG,MAAM,IAAA,sCAAmB,EAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACvF,MAAM,CAAC,UAAU,CAAC,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC;QAEtD,OAAO,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE;YACvE,GAAG,MAAM,CAAC,UAAU;YACpB,IAAI,EAAE,M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AW,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YAC9H,CAAC;YACD,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QACrD,CAAC;QACD,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAC9C,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,SAAS,KAAK,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;gBACxE,MAAM,IAAI,KAAK,CAAC,kDAAkD,MAAM,CAAC,UAAU,CAAC,SAAS,OAAO,IAAI,CAAC,SAAS,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 },\r\n};\r\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,UAAU,oBAAoB,CAAC,OAA2B,EAAE,MAAiC;IACvG,IAAI,MAAM,CAAC,UAAU,KAAK,KAAK,EAAE,CAAC;QAChC,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;QACD,MAAM,aAAa,GAAG,MAAM,IAAA,sCAAmB,EAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAEtF,MAAM,0BAA0B,GAAG,MAAM,OAAO,CAAC,YAAY,CAAC,UAAU,CAAuB,aAAa,CAAC,CAAC;QAC9G,IAAI,0BAA0B,KAAK,SAAS,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CAAC,+CAA+C,aAAa,CAAC,IAAI,wBAAwB,CAAC,CAAC;QAC7G,CAAC;QAED,MAAM,UAAU,GAAoB;YAClC,GAAG,MAAM,CAAC,UAAU;YACpB,SAAS,EAAE,a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CAAC,IAAI,KAAK,SAAS;gBAC1C,CAAC,CAAC,iBAAiB,CAAC,MAAM;gBAC1B,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC;YAE7B,OAAO,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,8BAA8B,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAC7F,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC;AA5CD,oDA4CC;AAED;;GAEG;AACI,KAAK,UAAU,qBAAqB,CAAC,OAA2B,EAAE,gBAAmC,EAAE,OAA8B;IAC1I,KAAK,MAAM,eAAe,IAAI,gBAAgB,EAAE,CAAC;QAC/C,MAAM,oBAAoB,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAJD,sDAIC;AAED;;GAEG;AACI,KAAK,UAAU,oBAAoB,CAAC,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":["/*---------------------------------------------------------------------------------------------\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
+ {"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,IAAI,MAAM,CAAC,UAAU,KAAK,KAAK,EAAE,CAAC;QAChC,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;QACD,MAAM,aAAa,GAAG,MAAM,IAAA,sCAAmB,EAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAEtF,MAAM,0BAA0B,GAAG,MAAM,OAAO,CAAC,YAAY,CAAC,UAAU,CAAuB,aAAa,CAAC,CAAC;QAC9G,IAAI,0BAA0B,KAAK,SAAS,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CAAC,+CAA+C,aAAa,CAAC,IAAI,wBAAwB,CAAC,CAAC;QAC7G,CAAC;QAED,MAAM,UAAU,GAAoB;YAClC,GAAG,MAAM,CAAC,UAAU;YACpB,SAAS,EAAE,aAAa,CAAC,QAAQ;SAClC,CAAC;QAEF,IAAI,MAAM,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;YAClC,MAAM,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;QAC/E,CAAC;QACD,IAAI,MAAM,CAAC,SAAS,KAAK,YAAY,EAAE,CAAC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ACN,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC;AA5CD,oDA4CC;AAED;;GAEG;AACI,KAAK,UAAU,qBAAqB,CAAC,OAA2B,EAAE,gBAAmC,EAAE,OAA8B;IAC1I,KAAK,MAAM,eAAe,IAAI,gBAAgB,EAAE,CAAC;QAC/C,MAAM,oBAAoB,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAJD,sDAIC;AAED;;GAEG;AACI,KAAK,UAAU,oBAAoB,CAAC,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 +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,CAAC,CAAC;IAEH,IAAI,UAAU,KAAK,CAAC,CAAC,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QAC1C,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;YACzD,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;QAC5D,CAAC,CAAC,CAAC;QAEH,IAAI,aAAa,GAAG,CAAC,CAAC,EAAE,CAAC;YACvB,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;YACtD,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;gBACnC,UAAU,EAAE,KAAK;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,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, 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 [itemName, path] = edit.key.split(\".\") as [string, string];\n\n let entryIndex = result.differences.findIndex((entry) => {\n return Utils.isClassPropertyDifference(entry) && entry.changeType === \"add\" && entry.itemName === itemName && entry.path === path;\n });\n\n if (entryIndex === -1 && result.conflicts) {\n const conflictIndex = result.conflicts.findIndex((entry) => {\n return entry.itemName === itemName && entry.path === path;\n });\n\n if (conflictIndex > -1) {\n const conflictEntry = result.conflicts[conflictIndex];\n entryIndex = result.differences.push({\n changeType: \"add\",\n schemaType: SchemaOtherTypes.Property,\n itemName,\n path,\n difference: conflictEntry.difference,\n } as ClassPropertyDifference) - 1;\n\n result.conflicts.splice(conflictIndex, 1);\n }\n }\n\n const propertyEntry = result.differences[entryIndex] as Editable<ClassPropertyDifference>;\n if (propertyEntry) {\n propertyEntry.path = edit.value;\n }\n}\n\n/**\n * @internal\n */\nexport function applyRenameSchemaItemEdit(result: SchemaDifferenceResult, edit: RenameSchemaItemEdit, postProcessing: (cb: () => void) => void) {\n let difference = result.differences.find((entry) => {\n return Utils.isSchemaItemDifference(entry) && entry.changeType === \"add\" && entry.itemName === edit.key;\n });\n\n if (difference === undefined && result.conflicts) {\n const conflictIndex = result.conflicts.findIndex((entry) => entry.itemName === edit.key && entry.path === undefined);\n if (conflictIndex > -1) {\n const conflictEntry = result.conflicts[conflictIndex];\n result.differences.push(difference = {\n changeType: \"add\",\n schemaType: conflictEntry.schemaType,\n itemName: edit.value,\n difference: conflictEntry.difference,\n } as AnySchemaItemDifference) - 1;\n\n result.conflicts.splice(conflictIndex, 1);\n\n // If item gets added, remove the modify references to this item\n const relatedModifications: number[] = [];\n result.differences.forEach((entry, index) => {\n if (Utils.isSchemaItemDifference(entry) && entry.itemName === edit.key) {\n relatedModifications.push(index);\n }\n });\n\n for (const index of relatedModifications.reverse()) {\n result.differences.splice(index, 1);\n }\n }\n }\n\n const itemDifference = difference as AnySchemaItemDifference;\n if (itemDifference === undefined) {\n return;\n }\n\n renameName(itemDifference, edit.key, edit.value);\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 oldKey = new SchemaItemKey(edit.key, 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"]}
1
+ {"version":3,"file":"RenameEditHandler.js","sourceRoot":"","sources":["../../../../src/Merging/Edits/RenameEditHandler.ts"],"names":[],"mappings":";AAAA;;;+FA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E,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":["/*---------------------------------------------------------------------------------------------\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 +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,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;QA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I,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":["/*---------------------------------------------------------------------------------------------\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(className: string, propertyName: string, newName: string) {\n this.add({\n type: SchemaEditType.RenameProperty,\n key: `${className}.${propertyName}`,\n value: newName,\n });\n }\n\n public skip(className: string, propertyName: string) {\n this.add({\n type: SchemaEditType.Skip,\n key: `${className}.${propertyName}`,\n });\n }\n}\n\nclass ItemEditor extends Editor {\n public rename(itemName: string, newName: string) {\n this.add({\n type: SchemaEditType.RenameSchemaItem,\n key: itemName,\n value: newName,\n });\n }\n\n public skip(itemName: string) {\n this.add({\n type: SchemaEditType.Skip,\n key: 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
+ {"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,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,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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,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":["/*---------------------------------------------------------------------------------------------\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 [itemName, pathName] = edit.key.split(\".\") as [string, string | undefined];\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
+ {"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,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;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 +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":["/*---------------------------------------------------------------------------------------------\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"]}
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 +1 @@
1
- {"version":3,"file":"EnumerationMerger.js","sourceRoot":"","sources":["../../../src/Merging/EnumerationMerger.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAgF;AAKhF;;;GAGG;AACU,QAAA,iBAAiB,GAAmD;IAC/E,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAA6B;QAC9C,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,KAAK,SAA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;QAC7G,CAAC;QAED,IAAG,MAAM,CAAC,UAAU,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YAC/C,MAAM,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAClH,CAAC;QACD,IAAG,MAAM,CAAC,UAAU,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACzC,MAAM,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACtG,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 { primitiveTypeToString, SchemaItemKey } from \"@itwin/ecschema-metadata\";\nimport type { EnumerationDifference, EnumeratorDifference } from \"../Differencing/SchemaDifference\";\nimport type { SchemaItemMergerHandler } from \"./SchemaItemMerger\";\nimport type { MutableEnumeration } from \"../Editing/Mutable/MutableEnumeration\";\n\n/**\n * Defines a merge handler to merge Enumeration schema items.\n * @internal\n */\nexport const enumerationMerger: SchemaItemMergerHandler<EnumerationDifference> = {\n async add(context, change: EnumerationDifference) {\n if (change.difference.type === undefined) {\n throw new Error(\"Enumerations must define a type property\");\n }\n if (change.difference.isStrict === undefined) {\n throw new Error(\"Enumerations must define whether enumeration is strict.\");\n }\n if (change.difference.enumerators === undefined) {\n throw new Error(\"Enumerations must define at least ine enumerator.\");\n }\n\n return context.editor.enumerations.createFromProps(context.targetSchemaKey, {\n ...change.difference,\n name: change.itemName,\n schemaItemType: change.schemaType,\n type: change.difference.type,\n isStrict: change.difference.isStrict,\n enumerators: change.difference.enumerators,\n });\n },\n async modify(_context, change, itemKey, item: MutableEnumeration) {\n if(change.difference.type !== undefined) {\n throw new Error(`The Enumeration ${itemKey.name} has an incompatible type. It must be \"${primitiveTypeToString(item.type!)}\", not \"${change.difference.type}\".`);\n }\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 if(change.difference.isStrict !== undefined) {\n item.setIsStrict(change.difference.isStrict);\n }\n },\n};\n\n/**\n * Defines a merge handler to merge Enumeration schema items.\n * @internal\n */\nexport const enumeratorMerger: SchemaItemMergerHandler<EnumeratorDifference> = {\n async add(context, change) {\n if (change.difference.name === undefined) {\n throw new Error(\"Enumerators must define a name\");\n }\n if (change.difference.value === undefined) {\n throw new Error(\"Enumerators must define a value\");\n }\n\n const itemKey = new SchemaItemKey(change.itemName, context.targetSchemaKey);\n await context.editor.enumerations.addEnumerator(itemKey, {\n name: change.difference.name,\n value: change.difference.value,\n label: change.difference.label,\n description: change.difference.description,\n });\n return itemKey;\n },\n async modify(context, change, itemKey) {\n if(change.difference.value !== undefined) {\n throw new Error(`Failed to merge enumerator attribute, Enumerator \"${change.path}\" has different values.`);\n }\n\n if(change.difference.description !== undefined) {\n await context.editor.enumerations.setEnumeratorDescription(itemKey, change.path, change.difference.description);\n }\n if(change.difference.label !== undefined) {\n await context.editor.enumerations.setEnumeratorLabel(itemKey, change.path, change.difference.label);\n }\n },\n};\n"]}
1
+ {"version":3,"file":"EnumerationMerger.js","sourceRoot":"","sources":["../../../src/Merging/EnumerationMerger.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,gEAAgF;AAKhF;;;GAGG;AACU,QAAA,iBAAiB,GAAmD;IAC/E,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAA6B;QAC9C,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QACD,IA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,MAAM,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAClH,CAAC;QACD,IAAG,MAAM,CAAC,UAAU,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACzC,MAAM,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACtG,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 { primitiveTypeToString, SchemaItemKey } from \"@itwin/ecschema-metadata\";\r\nimport type { EnumerationDifference, EnumeratorDifference } from \"../Differencing/SchemaDifference\";\r\nimport type { SchemaItemMergerHandler } from \"./SchemaItemMerger\";\r\nimport type { MutableEnumeration } from \"../Editing/Mutable/MutableEnumeration\";\r\n\r\n/**\r\n * Defines a merge handler to merge Enumeration schema items.\r\n * @internal\r\n */\r\nexport const enumerationMerger: SchemaItemMergerHandler<EnumerationDifference> = {\r\n async add(context, change: EnumerationDifference) {\r\n if (change.difference.type === undefined) {\r\n throw new Error(\"Enumerations must define a type property\");\r\n }\r\n if (change.difference.isStrict === undefined) {\r\n throw new Error(\"Enumerations must define whether enumeration is strict.\");\r\n }\r\n if (change.difference.enumerators === undefined) {\r\n throw new Error(\"Enumerations must define at least ine enumerator.\");\r\n }\r\n\r\n return context.editor.enumerations.createFromProps(context.targetSchemaKey, {\r\n ...change.difference,\r\n name: change.itemName,\r\n schemaItemType: change.schemaType,\r\n type: change.difference.type,\r\n isStrict: change.difference.isStrict,\r\n enumerators: change.difference.enumerators,\r\n });\r\n },\r\n async modify(_context, change, itemKey, item: MutableEnumeration) {\r\n if(change.difference.type !== undefined) {\r\n throw new Error(`The Enumeration ${itemKey.name} has an incompatible type. It must be \"${primitiveTypeToString(item.type!)}\", not \"${change.difference.type}\".`);\r\n }\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 if(change.difference.isStrict !== undefined) {\r\n item.setIsStrict(change.difference.isStrict);\r\n }\r\n },\r\n};\r\n\r\n/**\r\n * Defines a merge handler to merge Enumeration schema items.\r\n * @internal\r\n */\r\nexport const enumeratorMerger: SchemaItemMergerHandler<EnumeratorDifference> = {\r\n async add(context, change) {\r\n if (change.difference.name === undefined) {\r\n throw new Error(\"Enumerators must define a name\");\r\n }\r\n if (change.difference.value === undefined) {\r\n throw new Error(\"Enumerators must define a value\");\r\n }\r\n\r\n const itemKey = new SchemaItemKey(change.itemName, context.targetSchemaKey);\r\n await context.editor.enumerations.addEnumerator(itemKey, {\r\n name: change.difference.name,\r\n value: change.difference.value,\r\n label: change.difference.label,\r\n description: change.difference.description,\r\n });\r\n return itemKey;\r\n },\r\n async modify(context, change, itemKey) {\r\n if(change.difference.value !== undefined) {\r\n throw new Error(`Failed to merge enumerator attribute, Enumerator \"${change.path}\" has different values.`);\r\n }\r\n\r\n if(change.difference.description !== undefined) {\r\n await context.editor.enumerations.setEnumeratorDescription(itemKey, change.path, change.difference.description);\r\n }\r\n if(change.difference.label !== undefined) {\r\n await context.editor.enumerations.setEnumeratorLabel(itemKey, change.path, change.difference.label);\r\n }\r\n },\r\n};\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"KindOfQuantityMerger.js","sourceRoot":"","sources":["../../../src/Merging/KindOfQuantityMerger.ts"],"names":[],"mappings":";;;AAKA,yDAA4F;AAI5F;;;GAGG;AACU,QAAA,oBAAoB,GAAsD;IACrF,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM;QACvB,IAAI,MAAM,C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AC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5C,KAAI,IAAI,KAAK,GAAC,CAAC,EAAE,KAAK,GAAE,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACtD,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtD,MAAM,WAAW,GAAG,MAAM,IAAA,2CAAwB,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAClE,aAAa,CAAC,KAAK,CAAC,GAAG,GAAG,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACrE,CAAC;IAED,OAAO,GAAG,aAAa,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AACtE,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 KindOfQuantityDifference } from \"../Differencing/SchemaDifference\";\nimport { type SchemaItemMergerHandler, updateSchemaItemFullName } from \"./SchemaItemMerger\";\nimport { type MutableKindOfQuantity } from \"../Editing/Mutable/MutableKindOfQuantity\";\nimport { SchemaMergeContext } from \"./SchemaMerger\";\n\n/**\n * Defines a merge handler to merge KindOfQuantity schema items.\n * @internal\n */\nexport const kindOfQuantityMerger: SchemaItemMergerHandler<KindOfQuantityDifference> = {\n async add(context, change) {\n if (change.difference.persistenceUnit === undefined) {\n throw new Error(\"KindOfQuantity must define persistenceUnit\");\n }\n if (change.difference.relativeError === undefined) {\n throw new Error(\"KindOfQuantity must define relativeError\");\n }\n change.difference.persistenceUnit = await updateSchemaItemFullName(context, change.difference.persistenceUnit);\n if(change.difference.presentationUnits) {\n if(Array.isArray(change.difference.presentationUnits)) {\n for(let index = 0; index < change.difference.presentationUnits.length; index++) {\n change.difference.presentationUnits[index] = await updateOverrideFormat(context, change.difference.presentationUnits[index]);\n }\n } else {\n change.difference.presentationUnits = await updateOverrideFormat(context, change.difference.presentationUnits);\n }\n }\n\n return context.editor.kindOfQuantities.createFromProps(context.targetSchemaKey, {\n ...change.difference,\n name: change.itemName,\n schemaItemType: change.schemaType,\n persistenceUnit: change.difference.persistenceUnit,\n presentationUnits: change.difference.presentationUnits,\n relativeError: change.difference.relativeError,\n });\n },\n async modify(_context, change, itemKey, item: MutableKindOfQuantity) {\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 if(change.difference.relativeError !== undefined) {\n item.setRelativeError(change.difference.relativeError);\n }\n if(change.difference.persistenceUnit !== undefined) {\n // TODO: It should be checked if the unit is the same, but referring to the source schema.\n throw new Error(`Changing the kind of quantity '${itemKey.name}' persistenceUnit is not supported.`);\n }\n },\n};\n\nasync function updateOverrideFormat(context: SchemaMergeContext, formatString: string) {\n // https://www.itwinjs.org/v1/bis/ec/kindofquantity/#format-string\n const match = formatString.match(/^([^(]+)\\((\\d+)\\)\\[(.*)\\]$/);\n if(match === null) {\n return formatString;\n }\n\n const originalFormat = match[1];\n const updatedFormat = await updateSchemaItemFullName(context, originalFormat);\n\n const unitOverrides = match[3].split(\"][\");\n for(let index=0; index< unitOverrides.length; index++) {\n const [unit, label] = unitOverrides[index].split(\"|\");\n const updatedUnit = await updateSchemaItemFullName(context, unit);\n unitOverrides[index] = `${updatedUnit}${label ? `|${label}` : \"\"}`;\n }\n\n return `${updatedFormat}(${match[2]})[${unitOverrides.join(\"][\")}]`;\n}\n"]}
1
+ {"version":3,"file":"KindOfQuantityMerger.js","sourceRoot":"","sources":["../../../src/Merging/KindOfQuantityMerger.ts"],"names":[],"mappings":";;;AAKA,yDAA4F;AAI5F;;;GAGG;AACU,QAAA,oBAAoB,GAA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,cAAc,CAAC,CAAC;IAE9E,MAAM,aAAa,GAAI,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5C,KAAI,IAAI,KAAK,GAAC,CAAC,EAAE,KAAK,GAAE,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACtD,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtD,MAAM,WAAW,GAAG,MAAM,IAAA,2CAAwB,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAClE,aAAa,CAAC,KAAK,CAAC,GAAG,GAAG,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACrE,CAAC;IAED,OAAO,GAAG,aAAa,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AACtE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { type KindOfQuantityDifference } from \"../Differencing/SchemaDifference\";\r\nimport { type SchemaItemMergerHandler, updateSchemaItemFullName } from \"./SchemaItemMerger\";\r\nimport { type MutableKindOfQuantity } from \"../Editing/Mutable/MutableKindOfQuantity\";\r\nimport { SchemaMergeContext } from \"./SchemaMerger\";\r\n\r\n/**\r\n * Defines a merge handler to merge KindOfQuantity schema items.\r\n * @internal\r\n */\r\nexport const kindOfQuantityMerger: SchemaItemMergerHandler<KindOfQuantityDifference> = {\r\n async add(context, change) {\r\n if (change.difference.persistenceUnit === undefined) {\r\n throw new Error(\"KindOfQuantity must define persistenceUnit\");\r\n }\r\n if (change.difference.relativeError === undefined) {\r\n throw new Error(\"KindOfQuantity must define relativeError\");\r\n }\r\n change.difference.persistenceUnit = await updateSchemaItemFullName(context, change.difference.persistenceUnit);\r\n if(change.difference.presentationUnits) {\r\n if(Array.isArray(change.difference.presentationUnits)) {\r\n for(let index = 0; index < change.difference.presentationUnits.length; index++) {\r\n change.difference.presentationUnits[index] = await updateOverrideFormat(context, change.difference.presentationUnits[index]);\r\n }\r\n } else {\r\n change.difference.presentationUnits = await updateOverrideFormat(context, change.difference.presentationUnits);\r\n }\r\n }\r\n\r\n return context.editor.kindOfQuantities.createFromProps(context.targetSchemaKey, {\r\n ...change.difference,\r\n name: change.itemName,\r\n schemaItemType: change.schemaType,\r\n persistenceUnit: change.difference.persistenceUnit,\r\n presentationUnits: change.difference.presentationUnits,\r\n relativeError: change.difference.relativeError,\r\n });\r\n },\r\n async modify(_context, change, itemKey, item: MutableKindOfQuantity) {\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 if(change.difference.relativeError !== undefined) {\r\n item.setRelativeError(change.difference.relativeError);\r\n }\r\n if(change.difference.persistenceUnit !== undefined) {\r\n // TODO: It should be checked if the unit is the same, but referring to the source schema.\r\n throw new Error(`Changing the kind of quantity '${itemKey.name}' persistenceUnit is not supported.`);\r\n }\r\n },\r\n};\r\n\r\nasync function updateOverrideFormat(context: SchemaMergeContext, formatString: string) {\r\n // https://www.itwinjs.org/v1/bis/ec/kindofquantity/#format-string\r\n const match = formatString.match(/^([^(]+)\\((\\d+)\\)\\[(.*)\\]$/);\r\n if(match === null) {\r\n return formatString;\r\n }\r\n\r\n const originalFormat = match[1];\r\n const updatedFormat = await updateSchemaItemFullName(context, originalFormat);\r\n\r\n const unitOverrides = match[3].split(\"][\");\r\n for(let index=0; index< unitOverrides.length; index++) {\r\n const [unit, label] = unitOverrides[index].split(\"|\");\r\n const updatedUnit = await updateSchemaItemFullName(context, unit);\r\n unitOverrides[index] = `${updatedUnit}${label ? `|${label}` : \"\"}`;\r\n }\r\n\r\n return `${updatedFormat}(${match[2]})[${unitOverrides.join(\"][\")}]`;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MixinMerger.js","sourceRoot":"","sources":["../../../src/Merging/MixinMerger.ts"],"names":[],"mappings":";;;AAKA,yDAAiH;AAEjH,+CAA4C;AAE5C;;;GAGG;AACU,QAAA,gBAAgB,GAAkD;IAC7E,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM;QACvB,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE;YACpE,GAAG,MAAM,CAAC,UAAU;YACpB,IAAI,EAAE,MAAM,CAAC,QAAQ;YACrB,cAAc,EAAE,MAAM,CAAC,UAAU;YACjC,SAAS,EAAE,MAAM,IAAA,2CAAwB,EAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC;SAChF,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAkB;QACvD,IAAG,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAC7C,MAAM,SAAS,GAAG,MAAM,IAAA,sCAAmB,EAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;YAClF,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC;YAC1C,IAAI,YAAY,KAAK,SAAS,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvE,MAAM,IAAI,KAAK,CAAC,uBAAuB,OAAO,CAAC,IAAI,+BAA+B,CAAC,CAAC;YACtF,CAAC;QACH,CAAC;QACD,OAAO,IAAA,yBAAW,EAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACrD,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 MixinClassDifference } from \"../Differencing/SchemaDifference\";\nimport { type SchemaItemMergerHandler, updateSchemaItemFullName, updateSchemaItemKey } from \"./SchemaItemMerger\";\nimport { type MutableMixin } from \"../Editing/Mutable/MutableMixin\";\nimport { modifyClass } from \"./ClassMerger\";\n\n/**\n * Defines a merge handler to merge Mixin schema items.\n * @internal\n */\nexport const mixinClassMerger: SchemaItemMergerHandler<MixinClassDifference> = {\n async add(context, change) {\n if (change.difference.appliesTo === undefined) {\n throw new Error(\"Mixin must define appliesTo\");\n }\n return context.editor.mixins.createFromProps(context.targetSchemaKey, {\n ...change.difference,\n name: change.itemName,\n schemaItemType: change.schemaType,\n appliesTo: await updateSchemaItemFullName(context, change.difference.appliesTo),\n });\n },\n async modify(context, change, itemKey, item: MutableMixin) {\n if(change.difference.appliesTo !== undefined) {\n const appliesTo = await updateSchemaItemKey(context, change.difference.appliesTo);\n const currentValue = await item.appliesTo;\n if (currentValue !== undefined && !appliesTo.matches(currentValue.key)) {\n throw new Error(`Changing the mixin '${itemKey.name}' appliesTo is not supported.`);\n }\n }\n return modifyClass(context, change, itemKey, item);\n },\n};\n\n"]}
1
+ {"version":3,"file":"MixinMerger.js","sourceRoot":"","sources":["../../../src/Merging/MixinMerger.ts"],"names":[],"mappings":";;;AAKA,yDAAiH;AAEjH,+CAA4C;AAE5C;;;GAGG;AACU,QAAA,gBAAgB,GAAkD;IAC7E,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM;QACvB,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE;YACpE,GAAG,MAAM,CAAC,UAAU;YACpB,IAAI,EAAE,MAAM,CAAC,QAAQ;YACrB,cAAc,EAAE,MAAM,CAAC,UAAU;YACjC,SAAS,EAAE,MAAM,IAAA,2CAAwB,EAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC;SAChF,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAkB;QACvD,IAAG,MAAM,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAC7C,MAAM,SAAS,GAAG,MAAM,IAAA,sCAAmB,EAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;YAClF,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC;YAC1C,IAAI,YAAY,KAAK,SAAS,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvE,MAAM,IAAI,KAAK,CAAC,uBAAuB,OAAO,CAAC,IAAI,+BAA+B,CAAC,CAAC;YACtF,CAAC;QACH,CAAC;QACD,OAAO,IAAA,yBAAW,EAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACrD,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 MixinClassDifference } from \"../Differencing/SchemaDifference\";\r\nimport { type SchemaItemMergerHandler, updateSchemaItemFullName, updateSchemaItemKey } from \"./SchemaItemMerger\";\r\nimport { type MutableMixin } from \"../Editing/Mutable/MutableMixin\";\r\nimport { modifyClass } from \"./ClassMerger\";\r\n\r\n/**\r\n * Defines a merge handler to merge Mixin schema items.\r\n * @internal\r\n */\r\nexport const mixinClassMerger: SchemaItemMergerHandler<MixinClassDifference> = {\r\n async add(context, change) {\r\n if (change.difference.appliesTo === undefined) {\r\n throw new Error(\"Mixin must define appliesTo\");\r\n }\r\n return context.editor.mixins.createFromProps(context.targetSchemaKey, {\r\n ...change.difference,\r\n name: change.itemName,\r\n schemaItemType: change.schemaType,\r\n appliesTo: await updateSchemaItemFullName(context, change.difference.appliesTo),\r\n });\r\n },\r\n async modify(context, change, itemKey, item: MutableMixin) {\r\n if(change.difference.appliesTo !== undefined) {\r\n const appliesTo = await updateSchemaItemKey(context, change.difference.appliesTo);\r\n const currentValue = await item.appliesTo;\r\n if (currentValue !== undefined && !appliesTo.matches(currentValue.key)) {\r\n throw new Error(`Changing the mixin '${itemKey.name}' appliesTo is not supported.`);\r\n }\r\n }\r\n return modifyClass(context, change, itemKey, item);\r\n },\r\n};\r\n\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PhenomenonMerger.js","sourceRoot":"","sources":["../../../src/Merging/PhenomenonMerger.ts"],"names":[],"mappings":";;;AAOA,gEAA2E;AAE3E;;;GAGG;AACU,QAAA,gBAAgB,GAAkD;IAC7E,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;QAC7B,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE;YACzE,GAAG,MAAM,CAAC,UAAU;YACpB,IAAI,EAAE,MAAM,CAAC,QAAQ;YACrB,cAAc,EAAE,MAAM,CAAC,UAAU;YACjC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU;SACzC,CAAC,CAAC;IACL,CAAC;IACD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,UAA6B,EAAE,EAAE;QACzE,IAAG,MAAM,CAAC,UAAU,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACzC,UAAU,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACtD,CAAC;QACD,IAAG,MAAM,CAAC,UAAU,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YAC/C,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC3D,CAAC;QACD,IAAG,MAAM,CAAC,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YAC9C,kFAAkF;YAClF,IAAI,UAAU,CAAC,UAAU,KAAK,EAAE,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE;gBACpH,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,aAAa,EAAE,kBAAkB,OAAO,CAAC,IAAI,yCAAyC,CAAC,CAAC;YAEnI,MAAM,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAC/D,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 PhenomenonDifference } from \"../Differencing/SchemaDifference\";\nimport { type MutablePhenomenon } from \"../Editing/Mutable/MutablePhenomenon\";\nimport { type SchemaItemMergerHandler} from \"./SchemaItemMerger\";\nimport { ECObjectsError, ECObjectsStatus } from \"@itwin/ecschema-metadata\";\n\n/**\n * Defines a merge handler to merge Phenomenon schema items.\n * @internal\n */\nexport const phenomenonMerger: SchemaItemMergerHandler<PhenomenonDifference> = {\n add: async (context, change) => {\n if (change.difference.definition === undefined) {\n throw new Error(\"Phenomenon must define definition\");\n }\n\n return context.editor.phenomenons.createFromProps(context.targetSchemaKey, {\n ...change.difference,\n name: change.itemName,\n schemaItemType: change.schemaType,\n definition: change.difference.definition,\n });\n },\n modify: async (_context, change, itemKey, phenomenon: MutablePhenomenon) => {\n if(change.difference.label !== undefined) {\n phenomenon.setDisplayLabel(change.difference.label);\n }\n if(change.difference.description !== undefined) {\n phenomenon.setDescription(change.difference.description);\n }\n if(change.difference.definition !== undefined) {\n // It would be better if the validation would be part of phenomenon.setDefinition.\n if (phenomenon.definition !== \"\" && change.difference.definition.toLowerCase() !== phenomenon.definition.toLowerCase())\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Phenomenon ${itemKey.name} has an invalid 'definition' attribute.`);\n\n await phenomenon.setDefinition(change.difference.definition);\n }\n },\n};\n"]}
1
+ {"version":3,"file":"PhenomenonMerger.js","sourceRoot":"","sources":["../../../src/Merging/PhenomenonMerger.ts"],"names":[],"mappings":";;;AAOA,gEAA2E;AAE3E;;;GAGG;AACU,QAAA,gBAAgB,GAAkD;IAC7E,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;QAC7B,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,eAAe,EAAE;YACzE,GAAG,MAAM,CAAC,UAAU;YACpB,IAAI,EAAE,MAAM,CAAC,QAAQ;YACrB,cAAc,EAAE,MAAM,CAAC,UAAU;YACjC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU;SACzC,CAAC,CAAC;IACL,CAAC;IACD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,UAA6B,EAAE,EAAE;QACzE,IAAG,MAAM,CAAC,UAAU,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACzC,UAAU,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACtD,CAAC;QACD,IAAG,MAAM,CAAC,UAAU,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YAC/C,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC3D,CAAC;QACD,IAAG,MAAM,CAAC,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YAC9C,kFAAkF;YAClF,IAAI,UAAU,CAAC,UAAU,KAAK,EAAE,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE;gBACpH,MAAM,IAAI,kCAAc,CAAC,mCAAe,CAAC,aAAa,EAAE,kBAAkB,OAAO,CAAC,IAAI,yCAAyC,CAAC,CAAC;YAEnI,MAAM,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAC/D,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 PhenomenonDifference } from \"../Differencing/SchemaDifference\";\r\nimport { type MutablePhenomenon } from \"../Editing/Mutable/MutablePhenomenon\";\r\nimport { type SchemaItemMergerHandler} from \"./SchemaItemMerger\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * Defines a merge handler to merge Phenomenon schema items.\r\n * @internal\r\n */\r\nexport const phenomenonMerger: SchemaItemMergerHandler<PhenomenonDifference> = {\r\n add: async (context, change) => {\r\n if (change.difference.definition === undefined) {\r\n throw new Error(\"Phenomenon must define definition\");\r\n }\r\n\r\n return context.editor.phenomenons.createFromProps(context.targetSchemaKey, {\r\n ...change.difference,\r\n name: change.itemName,\r\n schemaItemType: change.schemaType,\r\n definition: change.difference.definition,\r\n });\r\n },\r\n modify: async (_context, change, itemKey, phenomenon: MutablePhenomenon) => {\r\n if(change.difference.label !== undefined) {\r\n phenomenon.setDisplayLabel(change.difference.label);\r\n }\r\n if(change.difference.description !== undefined) {\r\n phenomenon.setDescription(change.difference.description);\r\n }\r\n if(change.difference.definition !== undefined) {\r\n // It would be better if the validation would be part of phenomenon.setDefinition.\r\n if (phenomenon.definition !== \"\" && change.difference.definition.toLowerCase() !== phenomenon.definition.toLowerCase())\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Phenomenon ${itemKey.name} has an invalid 'definition' attribute.`);\r\n\r\n await phenomenon.setDefinition(change.difference.definition);\r\n }\r\n },\r\n};\r\n"]}