@fluid-experimental/property-changeset 2.0.2 → 2.1.0-276326
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/changeset.js +11 -11
- package/dist/changeset.js.map +1 -1
- package/dist/changeset_operations/array.js +7 -7
- package/dist/changeset_operations/array.js.map +1 -1
- package/dist/changeset_operations/indexedCollection.js +4 -4
- package/dist/changeset_operations/indexedCollection.js.map +1 -1
- package/dist/rebase.js +6 -6
- package/dist/rebase.js.map +1 -1
- package/dist/templateValidator.js +2 -2
- package/dist/templateValidator.js.map +1 -1
- package/dist/test/array.spec.js +15 -15
- package/dist/test/array.spec.js.map +1 -1
- package/dist/test/reversibleCs.spec.js +6 -3
- package/dist/test/reversibleCs.spec.js.map +1 -1
- package/dist/test/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/utils.js +9 -9
- package/dist/utils.js.map +1 -1
- package/lib/changeset.js +1 -1
- package/lib/changeset.js.map +1 -1
- package/lib/changeset_operations/array.js +1 -1
- package/lib/changeset_operations/array.js.map +1 -1
- package/lib/changeset_operations/indexedCollection.js +1 -1
- package/lib/changeset_operations/indexedCollection.js.map +1 -1
- package/lib/rebase.js +1 -1
- package/lib/rebase.js.map +1 -1
- package/lib/templateValidator.js +1 -1
- package/lib/templateValidator.js.map +1 -1
- package/lib/test/array.spec.js +1 -1
- package/lib/test/array.spec.js.map +1 -1
- package/lib/test/reversibleCs.spec.js +1 -1
- package/lib/test/reversibleCs.spec.js.map +1 -1
- package/lib/test/tsconfig.tsbuildinfo +1 -1
- package/lib/utils.js +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +3 -4
|
@@ -12,7 +12,7 @@ exports.ChangeSetIndexedCollectionFunctions = void 0;
|
|
|
12
12
|
* @fileoverview Helper functions and classes to work with ChangeSets with indexed collections (sets and maps)
|
|
13
13
|
*/
|
|
14
14
|
const property_common_1 = require("@fluid-experimental/property-common");
|
|
15
|
-
const
|
|
15
|
+
const cloneDeep_js_1 = __importDefault(require("lodash/cloneDeep.js"));
|
|
16
16
|
const includes_js_1 = __importDefault(require("lodash/includes.js"));
|
|
17
17
|
const isEmpty_js_1 = __importDefault(require("lodash/isEmpty.js"));
|
|
18
18
|
const isEqual_js_1 = __importDefault(require("lodash/isEqual.js"));
|
|
@@ -269,7 +269,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
269
269
|
else {
|
|
270
270
|
io_basePropertyChanges.modify[typeid] =
|
|
271
271
|
io_basePropertyChanges.modify[typeid] || {};
|
|
272
|
-
io_basePropertyChanges.modify[typeid][key] = (0,
|
|
272
|
+
io_basePropertyChanges.modify[typeid][key] = (0, cloneDeep_js_1.default)(insertedEntries[key]);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
}
|
|
@@ -279,7 +279,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
279
279
|
else if (!isPrimitiveTypeid &&
|
|
280
280
|
(!baseInserted[typeid] || baseInserted[typeid][key] === undefined)) {
|
|
281
281
|
baseInserted[typeid] = baseInserted[typeid] || {};
|
|
282
|
-
baseInserted[typeid][key] = (0,
|
|
282
|
+
baseInserted[typeid][key] = (0, cloneDeep_js_1.default)(insertedEntries[key]);
|
|
283
283
|
}
|
|
284
284
|
else {
|
|
285
285
|
throw new Error(MSG.ALREADY_EXISTING_ENTRY + key);
|
|
@@ -373,7 +373,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
373
373
|
}
|
|
374
374
|
else {
|
|
375
375
|
baseModified[typeid] = baseModified[typeid] || {};
|
|
376
|
-
baseModified[typeid][key] = (0,
|
|
376
|
+
baseModified[typeid][key] = (0, cloneDeep_js_1.default)(modifiedEntries[typeid][key]);
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexedCollection.js","sourceRoot":"","sources":["../../src/changeset_operations/indexedCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;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AAU,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC/C,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBAC5C,IAAI,IAAA,sCAAgB,EAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;wBAC/C,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;oBAChC,CAAC;gBACF,CAAC;gBACD,IAAI,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBACvD,OAAO,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;gBACtC,CAAC;YACF,CAAC;QACF,CAAC;QAED,mDAAmD;QACnD,IAAI,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACxC,OAAO,OAAO,CAAC,MAAM,CAAC;QACvB,CAAC;IACF,CAAC,CAAC;AACH,CAAC,EA90BgB,mCAAmC,mDAAnC,mCAAmC,QA80BnD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Helper functions and classes to work with ChangeSets with indexed collections (sets and maps)\n */\n\nimport { constants, joinPaths } from \"@fluid-experimental/property-common\";\nimport { copy as cloneDeep } from \"fastest-json-copy\";\nimport includes from \"lodash/includes.js\";\nimport isEmpty from \"lodash/isEmpty.js\";\nimport isEqual from \"lodash/isEqual.js\";\nimport isObject from \"lodash/isObject.js\";\nimport without from \"lodash/without.js\";\n\n// @ts-ignore\nimport { ApplyChangeSetOptions, ConflictInfo, SerializedChangeSet } from \"../changeset.js\";\nimport { TypeIdHelper } from \"../helpers/typeidHelper.js\";\nimport { PathHelper } from \"../pathHelper.js\";\n\nimport { ConflictType } from \"./changesetConflictTypes.js\";\nimport { isEmptyChangeSet } from \"./isEmptyChangeset.js\";\n\nconst { PROPERTY_PATH_DELIMITER, MSG } = constants;\n\n/**\n * @namespace property-changeset.ChangeSetOperations.IndexedCollectionOperations\n * @alias property-changeset.ChangeSetOperations.IndexedCollectionOperations\n * Helper functions and classes to perform operations on ChangeSets with indexed collections (sets and maps)\n */\n\n/**\n * Checks whether an object is empty (has no keys)\n * This function should be a bit faster than the isEmpty from\n * underscore. Unfortunately, at least on Chrome, it is still in\n * O(n)\n *\n * @param in_object - The object to check\n * @returns Is it empty?\n * @private\n */\nconst _fastIsEmptyObject = function (in_object: any): boolean {\n\tif (!in_object || Array.isArray(in_object) || !isObject(in_object)) {\n\t\treturn isEmpty(in_object);\n\t}\n\n\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\tfor (const _entry in in_object) {\n\t\treturn false;\n\t}\n\n\treturn true;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace ChangeSetIndexedCollectionFunctions {\n\t/**\n\t * Applies a ChangeSet to a given indexed collection property (recursively). The ChangeSet is assumed to be relative\n\t * to the same property root and it will be applied behind the base ChangeSet (assuming that the changes are\n\t * relative to the state after the base ChangeSet has been applied. It will change the base ChangeSet.\n\t *\n\t * @param io_basePropertyChanges - The ChangeSet describing the initial state\n\t * @param in_appliedPropertyChanges - The ChangeSet to apply to this state\n\t * @param in_typeid - The typeid of the contents collection (without the collection type).\n\t * @param in_options - Optional additional parameters\n\t * @param in_options.applyAfterMetaInformation - Additional meta information which help later to obtain\n\t * more compact changeset during the apply operation.\n\t *\n\t * @private\n\t */\n\texport const _performApplyAfterOnPropertyIndexedCollection = function (\n\t\tio_basePropertyChanges: SerializedChangeSet,\n\t\tin_appliedPropertyChanges: SerializedChangeSet,\n\t\tin_typeid: string,\n\t\tin_options: ApplyChangeSetOptions,\n\t) {\n\t\tconst isPrimitiveTypeid = TypeIdHelper.isPrimitiveType(in_typeid);\n\n\t\t// Handle remove entry operations\n\t\tif (in_appliedPropertyChanges.remove) {\n\t\t\t// Get and initialize the corresponding entries in the existing collection\n\t\t\tlet removedEntries = in_appliedPropertyChanges.remove;\n\n\t\t\tio_basePropertyChanges = io_basePropertyChanges || {};\n\t\t\tio_basePropertyChanges.remove =\n\t\t\t\tio_basePropertyChanges.remove ||\n\t\t\t\t(Array.isArray(in_appliedPropertyChanges.remove) ? [] : {});\n\t\t\tlet baseInserted = io_basePropertyChanges.insert || {};\n\t\t\tlet baseRemoved = io_basePropertyChanges.remove;\n\t\t\tlet baseModified = io_basePropertyChanges.modify;\n\t\t\tlet done = false;\n\n\t\t\tif (!Array.isArray(removedEntries)) {\n\t\t\t\tif (isPrimitiveTypeid) {\n\t\t\t\t\tremovedEntries = Object.keys(removedEntries);\n\t\t\t\t} else {\n\t\t\t\t\t// this is a reversible change set of templated types\n\t\t\t\t\tconst removedTypes = Object.keys(removedEntries);\n\t\t\t\t\tfor (let t = 0; t < removedTypes.length; t++) {\n\t\t\t\t\t\tconst removedKeys = Object.keys(removedEntries[removedTypes[t]]);\n\t\t\t\t\t\tfor (let i = 0; i < removedKeys.length; i++) {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tbaseInserted[removedTypes[t]] &&\n\t\t\t\t\t\t\t\tbaseInserted[removedTypes[t]][removedKeys[i]] !== undefined\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tdelete baseInserted[removedTypes[t]][removedKeys[i]];\n\n\t\t\t\t\t\t\t\t// If all entries for a typeid have been removed, we can remove\n\t\t\t\t\t\t\t\t// the whole typeid from the inserted section\n\t\t\t\t\t\t\t\tif (baseInserted && isEmpty(baseInserted[removedTypes[t]])) {\n\t\t\t\t\t\t\t\t\tdelete baseInserted[removedTypes[t]];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tbaseModified &&\n\t\t\t\t\t\t\t\t\tbaseModified[removedTypes[t]] &&\n\t\t\t\t\t\t\t\t\tbaseModified[removedTypes[t]][removedKeys[i]] !== undefined\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tdelete baseModified[removedTypes[t]][removedKeys[i]];\n\n\t\t\t\t\t\t\t\t\t// If all entries for a typeid have been removed, we can remove\n\t\t\t\t\t\t\t\t\t// the whole typeid from the inserted section\n\t\t\t\t\t\t\t\t\tif (baseModified && isEmpty(baseModified[removedTypes[t]])) {\n\t\t\t\t\t\t\t\t\t\tdelete baseModified[removedTypes[t]];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (Array.isArray(baseRemoved)) {\n\t\t\t\t\t\t\t\t\tbaseRemoved.push(removedKeys[i]);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tif (!baseRemoved[removedTypes[t]]) {\n\t\t\t\t\t\t\t\t\t\tbaseRemoved[removedTypes[t]] = {};\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbaseRemoved[removedTypes[t]][removedKeys[i]] =\n\t\t\t\t\t\t\t\t\t\tremovedEntries[removedTypes[t]][removedKeys[i]];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdone = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!done) {\n\t\t\t\tif (isPrimitiveTypeid) {\n\t\t\t\t\tfor (let i = 0; i < removedEntries.length; i++) {\n\t\t\t\t\t\tlet key = removedEntries[i];\n\n\t\t\t\t\t\t// If there is an insert for this key, we just remove it\n\t\t\t\t\t\tif (baseInserted[key] !== undefined) {\n\t\t\t\t\t\t\tdelete baseInserted[key];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// There could be a modify entry for this key, which we have to remove\n\t\t\t\t\t\t\tif (baseModified && baseModified[key] !== undefined) {\n\t\t\t\t\t\t\t\tdelete baseModified[key];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Otherwise we add it to the remove list\n\t\t\t\t\t\t\tif (Array.isArray(baseRemoved)) {\n\t\t\t\t\t\t\t\tbaseRemoved.push(key);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tbaseRemoved[key] = in_appliedPropertyChanges.remove[key];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst baseInsertedTypeids = Object.keys(baseInserted);\n\t\t\t\t\tfor (let i = 0; i < removedEntries.length; i++) {\n\t\t\t\t\t\tlet key = removedEntries[i];\n\t\t\t\t\t\tlet foundInTypeid;\n\n\t\t\t\t\t\t// Since we only have a flat remove list (without typeid) in the changeset, we have\n\t\t\t\t\t\t// to check all inserts\n\t\t\t\t\t\tfor (let j = 0; j < baseInsertedTypeids.length; j++) {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tbaseInserted[baseInsertedTypeids[j]] &&\n\t\t\t\t\t\t\t\tbaseInserted[baseInsertedTypeids[j]][key] !== undefined\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tfoundInTypeid = baseInsertedTypeids[j];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (foundInTypeid) {\n\t\t\t\t\t\t\t// If this key was inserted by this ChangeSet, we just remove it from the inserted list\n\t\t\t\t\t\t\tdelete baseInserted[foundInTypeid][key];\n\n\t\t\t\t\t\t\t// If all entries for a typeid have been removed, we can remove\n\t\t\t\t\t\t\t// the whole typeid from the inserted or modified section\n\t\t\t\t\t\t\tif (baseInserted && isEmpty(baseInserted[foundInTypeid])) {\n\t\t\t\t\t\t\t\tdelete baseInserted[foundInTypeid];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (baseModified && isEmpty(baseModified[foundInTypeid])) {\n\t\t\t\t\t\t\t\tdelete baseModified[foundInTypeid];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// There could be a modify entry for this key, which we have to remove\n\t\t\t\t\t\t\tconst baseModifiedTypeids = Object.keys(baseModified || {});\n\t\t\t\t\t\t\tfor (let j = 0; j < baseModifiedTypeids.length; j++) {\n\t\t\t\t\t\t\t\tif (baseModified[baseModifiedTypeids[j]][key]) {\n\t\t\t\t\t\t\t\t\tfoundInTypeid = baseModifiedTypeids[j];\n\t\t\t\t\t\t\t\t\tdelete baseModified[foundInTypeid][key];\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Otherwise we add it to the remove list\n\t\t\t\t\t\t\tbaseRemoved.push(key);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Apply insert operations\n\t\tif (in_appliedPropertyChanges.insert) {\n\t\t\t// Get and initialize the corresponding entries from the existing collection\n\t\t\tio_basePropertyChanges = io_basePropertyChanges || {};\n\t\t\tio_basePropertyChanges.insert = io_basePropertyChanges.insert || {};\n\t\t\tlet baseInserted = io_basePropertyChanges.insert;\n\t\t\tlet baseRemoved = io_basePropertyChanges.remove;\n\n\t\t\t// Insert the inserted entries\n\n\t\t\t// If no typeids are included, we just use a placeholder for the iteration below\n\t\t\tconst insertedTypeids = isPrimitiveTypeid\n\t\t\t\t? [undefined]\n\t\t\t\t: Object.keys(in_appliedPropertyChanges.insert);\n\t\t\tfor (let i = 0; i < insertedTypeids.length; i++) {\n\t\t\t\tlet typeid = insertedTypeids[i];\n\t\t\t\tconst insertedEntries = isPrimitiveTypeid\n\t\t\t\t\t? in_appliedPropertyChanges.insert\n\t\t\t\t\t: in_appliedPropertyChanges.insert[typeid];\n\t\t\t\tconst insertedKeys = Object.keys(insertedEntries);\n\t\t\t\tlet removalCS;\n\t\t\t\tif (baseRemoved) {\n\t\t\t\t\tremovalCS = isPrimitiveTypeid ? baseRemoved : baseRemoved[typeid];\n\t\t\t\t}\n\t\t\t\tfor (let j = 0; j < insertedKeys.length; j++) {\n\t\t\t\t\tlet key = insertedKeys[j];\n\t\t\t\t\tlet deeplyEqualCS = false;\n\n\t\t\t\t\t// If we have a complex type in the collection, we need to do a deep comparison of the two\n\t\t\t\t\t// ChangeSets to determine, whether they are equal\n\t\t\t\t\t// TODO: We should actually compute a diff between the two and recursively convert portions to modifies\n\t\t\t\t\t// Instead, right now, we only handle the case where the two keys cancel each out perfectly, i.e.,\n\t\t\t\t\t// the insert is reinserting exactly what was removed.\n\t\t\t\t\tif (\n\t\t\t\t\t\t!isPrimitiveTypeid &&\n\t\t\t\t\t\tremovalCS &&\n\t\t\t\t\t\tisObject(removalCS) &&\n\t\t\t\t\t\tremovalCS[key] !== undefined\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Split out the two parts: all the keys other than remove/insert should match exactly.\n\t\t\t\t\t\t// The contents 'remove' and 'insert', if they exist, should also match.\n\t\t\t\t\t\tdeeplyEqualCS = !!insertedEntries[key].insert === !!removalCS[key].remove;\n\n\t\t\t\t\t\t// If there are 'insert' and 'remove', see if the removed data matches the inserted data\n\t\t\t\t\t\tif (deeplyEqualCS && insertedEntries[key].insert) {\n\t\t\t\t\t\t\tdeeplyEqualCS = isEqual(insertedEntries[key].insert, removalCS[key].remove);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Finally, check if the data being inserted matches the data that was removed\n\t\t\t\t\t\tconst insertedEntry = isObject(insertedEntries[key])\n\t\t\t\t\t\t\t? without(insertedEntries[key], \"insert\")\n\t\t\t\t\t\t\t: insertedEntries[key];\n\t\t\t\t\t\tconst removedEntry = isObject(removalCS[key])\n\t\t\t\t\t\t\t? without(removalCS[key], \"remove\")\n\t\t\t\t\t\t\t: removalCS[key];\n\t\t\t\t\t\tdeeplyEqualCS = deeplyEqualCS && isEqual(insertedEntry, removedEntry);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t(isPrimitiveTypeid || TypeIdHelper.isPrimitiveType(typeid) || deeplyEqualCS) &&\n\t\t\t\t\t\tremovalCS &&\n\t\t\t\t\t\t((Array.isArray(removalCS) && includes(baseRemoved, key)) ||\n\t\t\t\t\t\t\tremovalCS[key] !== undefined)\n\t\t\t\t\t) {\n\t\t\t\t\t\t// A remove and insert are combined into a modify for primitive types\n\n\t\t\t\t\t\t// Remove the old remove command\n\t\t\t\t\t\tlet oldValueMatches = false;\n\t\t\t\t\t\tif (Array.isArray(removalCS)) {\n\t\t\t\t\t\t\tif (isPrimitiveTypeid) {\n\t\t\t\t\t\t\t\tio_basePropertyChanges.remove = without(io_basePropertyChanges.remove, key);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tio_basePropertyChanges.remove[typeid] = without(\n\t\t\t\t\t\t\t\t\tio_basePropertyChanges.remove[typeid],\n\t\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\toldValueMatches = deeplyEqualCS || removalCS[key] === insertedEntries[key];\n\t\t\t\t\t\t\tdelete removalCS[key];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Insert a modify command instead\n\t\t\t\t\t\tif (!oldValueMatches) {\n\t\t\t\t\t\t\tio_basePropertyChanges.modify = io_basePropertyChanges.modify || {};\n\t\t\t\t\t\t\tif (isPrimitiveTypeid) {\n\t\t\t\t\t\t\t\tio_basePropertyChanges.modify[key] = insertedEntries[key];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tio_basePropertyChanges.modify[typeid] =\n\t\t\t\t\t\t\t\t\tio_basePropertyChanges.modify[typeid] || {};\n\t\t\t\t\t\t\t\tio_basePropertyChanges.modify[typeid][key] = cloneDeep(insertedEntries[key]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (isPrimitiveTypeid && baseInserted[key] === undefined) {\n\t\t\t\t\t\tbaseInserted[key] = insertedEntries[key];\n\t\t\t\t\t} else if (\n\t\t\t\t\t\t!isPrimitiveTypeid &&\n\t\t\t\t\t\t(!baseInserted[typeid] || baseInserted[typeid][key] === undefined)\n\t\t\t\t\t) {\n\t\t\t\t\t\tbaseInserted[typeid] = baseInserted[typeid] || {};\n\t\t\t\t\t\tbaseInserted[typeid][key] = cloneDeep(insertedEntries[key]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new Error(MSG.ALREADY_EXISTING_ENTRY + key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Handle modification operations\n\t\tif (in_appliedPropertyChanges.modify) {\n\t\t\t// Get and initialize the corresponding entries from the existing collection\n\t\t\tconst modifiedEntries = in_appliedPropertyChanges.modify;\n\t\t\tio_basePropertyChanges = io_basePropertyChanges || {};\n\t\t\tio_basePropertyChanges.modify = io_basePropertyChanges.modify || {};\n\t\t\tlet baseModified = io_basePropertyChanges.modify;\n\t\t\tlet baseInserted = io_basePropertyChanges.insert || {};\n\n\t\t\t// Process the modifications\n\n\t\t\t// If no typeids are included, we just use a placeholder for the iteration below\n\t\t\tconst modifiedTypeids = isPrimitiveTypeid ? [undefined] : Object.keys(modifiedEntries);\n\t\t\tfor (let i = 0; i < modifiedTypeids.length; i++) {\n\t\t\t\tlet typeid = modifiedTypeids[i];\n\n\t\t\t\tconst modifyKeys = Object.keys(\n\t\t\t\t\tisPrimitiveTypeid ? modifiedEntries : modifiedEntries[typeid],\n\t\t\t\t);\n\t\t\t\tfor (let j = 0; j < modifyKeys.length; j++) {\n\t\t\t\t\tlet key = modifyKeys[j];\n\n\t\t\t\t\tif (isPrimitiveTypeid) {\n\t\t\t\t\t\tlet newValue = modifiedEntries[key];\n\t\t\t\t\t\tif (newValue && newValue.hasOwnProperty(\"value\")) {\n\t\t\t\t\t\t\tnewValue = newValue.value;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (baseInserted[key] !== undefined) {\n\t\t\t\t\t\t\t// If this entry was added by this ChangeSet, we modify the insert operation according to the\n\t\t\t\t\t\t\t// new ChangeSet\n\t\t\t\t\t\t\tbaseInserted[key] = newValue;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (baseModified[key] && baseModified[key].hasOwnProperty(\"value\")) {\n\t\t\t\t\t\t\t\tbaseModified[key].value = newValue;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tbaseModified[key] = newValue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If this is a polymorphic collection, we can still have individual entries with\n\t\t\t\t\t\t// primitive types\n\t\t\t\t\t\tconst isEntryPrimitiveType = TypeIdHelper.isPrimitiveType(typeid);\n\n\t\t\t\t\t\tif (baseInserted[typeid] && baseInserted[typeid][key] !== undefined) {\n\t\t\t\t\t\t\t// If this entry was added by this ChangeSet, we modify the insert operation according to the\n\t\t\t\t\t\t\t// new ChangeSet\n\t\t\t\t\t\t\tif (isEntryPrimitiveType && typeid !== \"String\") {\n\t\t\t\t\t\t\t\tlet newValue = modifiedEntries[typeid][key];\n\t\t\t\t\t\t\t\tif (newValue && newValue.hasOwnProperty(\"value\")) {\n\t\t\t\t\t\t\t\t\tnewValue = modifiedEntries[typeid][key].value;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// In the case of Int64 or Uint64 we copy the array so that\n\t\t\t\t\t\t\t\t// both ChangeSets don't point to the same instance\n\t\t\t\t\t\t\t\tif (typeid === \"Int64\" || typeid === \"Uint64\") {\n\t\t\t\t\t\t\t\t\tnewValue = newValue.slice();\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tbaseInserted[typeid][key] &&\n\t\t\t\t\t\t\t\t\tbaseInserted[typeid][key].hasOwnProperty(\"value\")\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tbaseInserted[typeid][key].value = newValue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbaseInserted[typeid][key] = newValue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.performApplyAfterOnPropertyWithTypeid(\n\t\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\t\tbaseInserted[typeid],\n\t\t\t\t\t\t\t\t\tmodifiedEntries[typeid],\n\t\t\t\t\t\t\t\t\ttypeid,\n\t\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t\tin_options,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (baseModified[typeid] && baseModified[typeid][key] !== undefined) {\n\t\t\t\t\t\t\t// If there was a previous modification operation, we have to merge the two\n\t\t\t\t\t\t\tif (isEntryPrimitiveType && typeid !== \"String\") {\n\t\t\t\t\t\t\t\t// Primitive types can simply be overwritten, however we have an exception for\n\t\t\t\t\t\t\t\t// 64 bit integers (until javascript natively supports them)\n\t\t\t\t\t\t\t\tif (typeid === \"Int64\" || typeid === \"Uint64\") {\n\t\t\t\t\t\t\t\t\tlet appliedVal = modifiedEntries[typeid][key];\n\t\t\t\t\t\t\t\t\tif (appliedVal && appliedVal.hasOwnProperty(\"value\")) {\n\t\t\t\t\t\t\t\t\t\tappliedVal = appliedVal.value;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbaseModified[typeid][key] = appliedVal.slice();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbaseModified[typeid][key] = modifiedEntries[typeid][key];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.performApplyAfterOnPropertyWithTypeid(\n\t\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\t\tbaseModified[typeid],\n\t\t\t\t\t\t\t\t\tmodifiedEntries[typeid],\n\t\t\t\t\t\t\t\t\ttypeid,\n\t\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t\t\tin_options,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbaseModified[typeid] = baseModified[typeid] || {};\n\t\t\t\t\t\t\tbaseModified[typeid][key] = cloneDeep(modifiedEntries[typeid][key]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Remove unnecessary entries from the ChangeSet\n\t\tthis._cleanIndexedCollectionChangeSet(io_basePropertyChanges, !isPrimitiveTypeid);\n\t};\n\n\t/**\n\t * Performs the rebase operation for set and map collections.\n\t *\n\t * @param in_ownPropertyChangeSet - The ChangeSet for this collection.\n\t * @param io_rebasePropertyChangeSet - The ChangeSet for the collection to be rebased.\n\t * @param in_basePath - Base path to get to the property processed by this function.\n\t * @param in_typeid - The typeid of the contents collection (without the collection type).\n\t * @param in_useSquareBracketsInPath - If set to true, paths will be created using the angular brackets syntax (for\n\t * arrays), otherwise dots will be used (for NodeProperties).\n\t * @param out_conflicts - A list of paths that resulted in conflicts together with the type of the conflict.\n\t * @param in_options - Optional additional parameters.\n\t * @param in_options.applyAfterMetaInformation - Additional meta information which help later to obtain\n\t * more compact changeset during the apply operation.\n\t *\n\t * @private\n\t */\n\texport const _rebaseIndexedCollectionChangeSetForProperty = function (\n\t\tin_ownPropertyChangeSet: SerializedChangeSet,\n\t\tio_rebasePropertyChangeSet: SerializedChangeSet,\n\t\tin_basePath: string,\n\t\tin_typeid: string,\n\t\tin_useSquareBracketsInPath: boolean,\n\t\tout_conflicts: ConflictInfo[],\n\t\tin_options: ApplyChangeSetOptions,\n\t) {\n\t\tconst isPrimitiveTypeid = TypeIdHelper.isPrimitiveType(in_typeid);\n\n\t\tconst changesByKeys = {};\n\t\tlet modifyMap = {};\n\t\t// Helper function which stores the changes indexed by key in the changesByKeys array to\n\t\t// make it easier to compare the related changes in the two ChangeSets\n\t\tconst addChanges = function (\n\t\t\tin_collection: Record<string, any>,\n\t\t\tin_changeIdentifier: string,\n\t\t\tin_changePrefix: string,\n\t\t\tin_typeidChange?: string,\n\t\t) {\n\t\t\t// Collection didn't exist in this ChangeSet\n\t\t\tif (in_collection === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For remove operations, the ChangeSet is only an array of keys, otherwise it is a map, so we have to\n\t\t\t// distinguish the two cases here\n\t\t\tconst keys = Array.isArray(in_collection) ? in_collection : Object.keys(in_collection);\n\n\t\t\t// Add all entries indexed with the key\n\t\t\tfor (let j = 0; j < keys.length; j++) {\n\t\t\t\tconst key = keys[j];\n\n\t\t\t\t// Store the type of the change\n\t\t\t\tchangesByKeys[key] = changesByKeys[key] || {};\n\t\t\t\tchangesByKeys[key][in_changePrefix] = changesByKeys[key][in_changePrefix]\n\t\t\t\t\t? `${changesByKeys[key][in_changePrefix]}_${in_changeIdentifier}`\n\t\t\t\t\t: in_changeIdentifier;\n\n\t\t\t\t// If applicable store the typeid of the change\n\t\t\t\tif (in_typeidChange) {\n\t\t\t\t\tchangesByKeys[key][`${in_changePrefix}Typeid`] = in_typeidChange;\n\t\t\t\t}\n\n\t\t\t\t// Store the ChangeSet\n\t\t\t\tif (in_changePrefix === \"other\") {\n\t\t\t\t\tchangesByKeys[key].change = Array.isArray(in_collection) ? key : in_collection[key];\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t// Helper function which adds the Changes for a ChangeSet that is ordered by typeid\n\t\tconst addChangesWithTypeids = function (\n\t\t\tin_collection,\n\t\t\tin_changeIdentifier,\n\t\t\tin_changePrefix,\n\t\t) {\n\t\t\tif (in_collection === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Iterate over the typeids (or use dummy entry for the iteration\n\t\t\tconst addedKeyTypeids = Object.keys(in_collection);\n\t\t\tfor (let i = 0; i < addedKeyTypeids.length; i++) {\n\t\t\t\tconst Typeid = addedKeyTypeids[i];\n\t\t\t\taddChanges(in_collection[Typeid], in_changeIdentifier, in_changePrefix, Typeid);\n\t\t\t}\n\t\t};\n\n\t\t// Insert all changes from the ChangeSet into the lookup map\n\t\tif (Array.isArray(in_ownPropertyChangeSet.remove)) {\n\t\t\taddChanges(in_ownPropertyChangeSet.remove, \"remove\", \"own\");\n\t\t} else {\n\t\t\tif (isPrimitiveTypeid) {\n\t\t\t\taddChanges(in_ownPropertyChangeSet.remove, \"remove\", \"own\");\n\t\t\t} else {\n\t\t\t\taddChangesWithTypeids(in_ownPropertyChangeSet.remove, \"remove\", \"own\");\n\t\t\t}\n\t\t}\n\n\t\tif (Array.isArray(io_rebasePropertyChangeSet.remove)) {\n\t\t\taddChanges(io_rebasePropertyChangeSet.remove, \"remove\", \"other\");\n\t\t} else {\n\t\t\tif (isPrimitiveTypeid) {\n\t\t\t\taddChanges(io_rebasePropertyChangeSet.remove, \"remove\", \"other\");\n\t\t\t} else {\n\t\t\t\taddChangesWithTypeids(io_rebasePropertyChangeSet.remove, \"remove\", \"other\");\n\t\t\t}\n\t\t}\n\n\t\tif (isPrimitiveTypeid) {\n\t\t\taddChanges(in_ownPropertyChangeSet.insert, \"insert\", \"own\");\n\t\t\taddChanges(in_ownPropertyChangeSet.modify, \"modify\", \"own\");\n\t\t\taddChanges(io_rebasePropertyChangeSet.insert, \"insert\", \"other\");\n\t\t\taddChanges(io_rebasePropertyChangeSet.modify, \"modify\", \"other\");\n\t\t} else {\n\t\t\taddChangesWithTypeids(in_ownPropertyChangeSet.insert, \"insert\", \"own\");\n\t\t\taddChangesWithTypeids(in_ownPropertyChangeSet.modify, \"modify\", \"own\");\n\t\t\taddChangesWithTypeids(io_rebasePropertyChangeSet.insert, \"insert\", \"other\");\n\t\t\taddChangesWithTypeids(io_rebasePropertyChangeSet.modify, \"modify\", \"other\");\n\t\t}\n\n\t\t// Check for modifications that affect the same object\n\t\tconst changedKeys = Object.keys(changesByKeys);\n\t\tfor (let i = 0; i < changedKeys.length; i++) {\n\t\t\tconst key = changedKeys[i];\n\t\t\tconst newPath = in_useSquareBracketsInPath\n\t\t\t\t? `${in_basePath}[${PathHelper.quotePathSegmentIfNeeded(key)}]`\n\t\t\t\t: joinPaths(\n\t\t\t\t\t\tin_basePath,\n\t\t\t\t\t\tPathHelper.quotePathSegmentIfNeeded(key),\n\t\t\t\t\t\tPROPERTY_PATH_DELIMITER,\n\t\t\t\t\t);\n\n\t\t\tconst modification = changesByKeys[key];\n\t\t\tif (modification.own && modification.other) {\n\t\t\t\t/*\n We found a key that was changed by both ChangeSets at the same time\n We now have to handle the conflicting changes. The changes we do, are summarized in this table:\n\n <START REBASE HANDLING TABLE>\n +-------+-----------------+------------------+-------------------+-------------------------------------+\n | \\Own| insert | modify | remove | remove+insert |\n | \\ | | | | |\n |other\\ | | | | |\n +=======+=================+==================+===================+=====================================+\n | | conflicting | incompatible | incompatible | incompatible |\n |insert | inserts | psets | psets | psets |\n | | | | | |\n +-------+-----------------+------------------+-------------------+-------------------------------------+\n | | incompatible | merge recursively| conflict | conflict |\n |modify | psets | (conflicting on | | (modify can not be applied due to |\n | | | leaf) | - delete modify | to incompatible base) |\n | | | | in other | |\n | | | | | - delete modify in other |\n +-------+-----------------+------------------+-------------------+-------------------------------------+\n | | incompatible | non-conflicting | non-conflicting | incompatible |\n |remove | psets | change | change | psets |\n | | | | | |\n | | | | - rem dupl. remove| |\n +-------+-----------------+------------------+-------------------+-------------------------------------+\n | | incompatible | non-conflicting | non-conflicting | conflict |\n |remove+| psets | change | change | |\n |insert | | | | - remove conflicting insert |\n | | | | - rem dupl. remove| |\n +-------+-----------------+------------------+-------------------+-------------------------------------+\n <END REBASE HANDLING TABLE>\n */\n\n\t\t\t\t// A key was modified after it had been removed\n\t\t\t\tif (modification.own === \"modify\" && modification.other === \"modify\") {\n\t\t\t\t\tif (\n\t\t\t\t\t\tisPrimitiveTypeid ||\n\t\t\t\t\t\t(TypeIdHelper.isPrimitiveType(modification.ownTypeid) &&\n\t\t\t\t\t\t\tmodification.ownTypeid !== \"String\")\n\t\t\t\t\t) {\n\t\t\t\t\t\t// We have two modification operations that affect the same entry for a base type.\n\t\t\t\t\t\t// This is a legal operation, the second one will overwrite the first one, but we\n\t\t\t\t\t\t// report it as a possible conflict\n\t\t\t\t\t\tlet ownModify = in_ownPropertyChangeSet.modify;\n\t\t\t\t\t\tlet rebasedModify = io_rebasePropertyChangeSet.modify;\n\t\t\t\t\t\tif (modification.otherTypeid) {\n\t\t\t\t\t\t\townModify = ownModify[modification.otherTypeid];\n\t\t\t\t\t\t\trebasedModify = rebasedModify[modification.otherTypeid];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet conflict = {\n\t\t\t\t\t\t\tpath: newPath,\n\t\t\t\t\t\t\ttype: ConflictType.COLLIDING_SET,\n\t\t\t\t\t\t\tconflictingChange: ownModify[key],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tout_conflicts.push(conflict);\n\t\t\t\t\t\t// If value is the same, delete the entry\n\t\t\t\t\t\tlet ownValue = ownModify[key];\n\t\t\t\t\t\tif (typeof ownValue === \"object\" && ownValue.hasOwnProperty(\"value\")) {\n\t\t\t\t\t\t\townValue = ownValue.value;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlet rebaseValue = rebasedModify[key];\n\t\t\t\t\t\tif (typeof rebaseValue === \"object\" && rebaseValue.hasOwnProperty(\"value\")) {\n\t\t\t\t\t\t\trebaseValue = rebaseValue.value;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tmodification.ownTypeid === \"Int64\" ||\n\t\t\t\t\t\t\tmodification.ownTypeid === \"Uint64\" ||\n\t\t\t\t\t\t\townValue.length === 2\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// For (u)int64, values are arrays of 2 elements\n\t\t\t\t\t\t\tif (ownValue[0] === rebaseValue[0] && ownValue[1] === rebaseValue[1]) {\n\t\t\t\t\t\t\t\tdelete rebasedModify[key];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (ownValue === rebaseValue) {\n\t\t\t\t\t\t\t\tdelete rebasedModify[key];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.rebaseChangeSetForPropertyEntryWithTypeid(\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tin_ownPropertyChangeSet.modify[modification.ownTypeid],\n\t\t\t\t\t\t\tio_rebasePropertyChangeSet.modify[modification.otherTypeid],\n\t\t\t\t\t\t\tmodification.ownTypeid,\n\t\t\t\t\t\t\tnewPath,\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\tout_conflicts,\n\t\t\t\t\t\t\tin_options,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else if (modification.own === \"remove\" && modification.other === \"modify\") {\n\t\t\t\t\tmodifyMap = modification.otherTypeid\n\t\t\t\t\t\t? io_rebasePropertyChangeSet.modify[modification.otherTypeid]\n\t\t\t\t\t\t: io_rebasePropertyChangeSet.modify;\n\n\t\t\t\t\t// Create the conflict information\n\t\t\t\t\tlet conflict = {\n\t\t\t\t\t\tpath: newPath,\n\t\t\t\t\t\ttype: ConflictType.ENTRY_MODIFIED_AFTER_REMOVE,\n\t\t\t\t\t\tconflictingChange: modifyMap[key],\n\t\t\t\t\t};\n\t\t\t\t\tout_conflicts.push(conflict);\n\n\t\t\t\t\t// Delete the modification from the rebased ChangeSet\n\t\t\t\t\tdelete modifyMap[key];\n\t\t\t\t} else if (modification.own === \"remove_insert\" && modification.other === \"modify\") {\n\t\t\t\t\tif (!isPrimitiveTypeid) {\n\t\t\t\t\t\t// We have a conflicting change. A node was removed and inserted (replaced) in the original\n\t\t\t\t\t\t// ChangeSet and then modified by the rebased ChangeSet. Since the base of the modification\n\t\t\t\t\t\t// can have been changed significantly by this operation, we don't know whether we can\n\t\t\t\t\t\t// apply the modification\n\n\t\t\t\t\t\t// Create the conflict information\n\t\t\t\t\t\tlet conflict = {\n\t\t\t\t\t\t\tpath: newPath,\n\t\t\t\t\t\t\ttype: ConflictType.ENTRY_MODIFICATION_AFTER_REMOVE_INSERT,\n\t\t\t\t\t\t\tconflictingChange:\n\t\t\t\t\t\t\t\tio_rebasePropertyChangeSet.modify[modification.otherTypeid][key],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tout_conflicts.push(conflict);\n\n\t\t\t\t\t\t// Delete the modification from the rebased ChangeSet\n\t\t\t\t\t\tdelete io_rebasePropertyChangeSet.modify[modification.otherTypeid][key];\n\t\t\t\t\t}\n\t\t\t\t} else if (\n\t\t\t\t\t(modification.own === \"modify\" || modification.own === \"remove\") &&\n\t\t\t\t\t(modification.other === \"remove\" || modification.other === \"remove_insert\")\n\t\t\t\t) {\n\t\t\t\t\tif (modification.own === \"modify\") {\n\t\t\t\t\t\tmodifyMap = modification.ownTypeid\n\t\t\t\t\t\t\t? in_ownPropertyChangeSet.modify[modification.ownTypeid]\n\t\t\t\t\t\t\t: in_ownPropertyChangeSet.modify;\n\n\t\t\t\t\t\t// Create the conflict information\n\t\t\t\t\t\tlet conflict = {\n\t\t\t\t\t\t\tpath: newPath,\n\t\t\t\t\t\t\ttype: ConflictType.REMOVE_AFTER_MODIFY,\n\t\t\t\t\t\t\tconflictingChange: modifyMap[key],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tout_conflicts.push(conflict);\n\t\t\t\t\t}\n\n\t\t\t\t\t// If we have a duplicated delete, we remove it from the new ChangeSet\n\t\t\t\t\tif (modification.own === \"remove\") {\n\t\t\t\t\t\tif (Array.isArray(io_rebasePropertyChangeSet.remove)) {\n\t\t\t\t\t\t\tio_rebasePropertyChangeSet.remove = without(\n\t\t\t\t\t\t\t\tio_rebasePropertyChangeSet.remove,\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (isPrimitiveTypeid) {\n\t\t\t\t\t\t\t\tdelete io_rebasePropertyChangeSet.remove[key];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdelete io_rebasePropertyChangeSet.remove[modification.otherTypeid][key];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (modification.own === \"insert\" && modification.other === \"insert\") {\n\t\t\t\t\tif (isPrimitiveTypeid || TypeIdHelper.isPrimitiveType(modification.ownTypeid)) {\n\t\t\t\t\t\tlet insertMap = modification.otherTypeid\n\t\t\t\t\t\t\t? io_rebasePropertyChangeSet.insert[modification.otherTypeid]\n\t\t\t\t\t\t\t: io_rebasePropertyChangeSet.insert;\n\n\t\t\t\t\t\t// We have two insert operations that affect the same key for a primitive type.\n\t\t\t\t\t\t// This is a legal operation, the second one will overwrite the first one, but we\n\t\t\t\t\t\t// report it as a possible conflicting set\n\t\t\t\t\t\tlet conflict = {\n\t\t\t\t\t\t\tpath: newPath,\n\t\t\t\t\t\t\ttype: ConflictType.COLLIDING_SET,\n\t\t\t\t\t\t\tconflictingChange: insertMap[key],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tout_conflicts.push(conflict);\n\n\t\t\t\t\t\t// Convert to modify\n\t\t\t\t\t\tlet oldValue;\n\t\t\t\t\t\tif (modification.otherTypeid) {\n\t\t\t\t\t\t\tio_rebasePropertyChangeSet.modify = io_rebasePropertyChangeSet.modify || {};\n\t\t\t\t\t\t\tio_rebasePropertyChangeSet.modify[modification.otherTypeid] =\n\t\t\t\t\t\t\t\tio_rebasePropertyChangeSet.modify[modification.otherTypeid] || {};\n\t\t\t\t\t\t\tmodifyMap = io_rebasePropertyChangeSet.modify[modification.otherTypeid];\n\t\t\t\t\t\t\toldValue = in_ownPropertyChangeSet.insert[modification.ownTypeid][key];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tio_rebasePropertyChangeSet.modify = io_rebasePropertyChangeSet.modify || {};\n\t\t\t\t\t\t\tmodifyMap = io_rebasePropertyChangeSet.modify;\n\t\t\t\t\t\t\toldValue = in_ownPropertyChangeSet.insert[key];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmodifyMap[key] = { value: insertMap[key], oldValue };\n\t\t\t\t\t\tdelete insertMap[key];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Here we have two insert operations for objects. Since these affect a whole sub-tree and not\n\t\t\t\t\t\t// just a single value, we cannot easily convert it into a modify and instead report it as invalid\n\n\t\t\t\t\t\tlet insertMap = modification.otherTypeid\n\t\t\t\t\t\t\t? io_rebasePropertyChangeSet.insert[modification.otherTypeid]\n\t\t\t\t\t\t\t: io_rebasePropertyChangeSet.insert;\n\n\t\t\t\t\t\t// Create the conflict information\n\t\t\t\t\t\tlet conflict = {\n\t\t\t\t\t\t\tpath: newPath,\n\t\t\t\t\t\t\ttype: ConflictType.INSERTED_ENTRY_WITH_SAME_KEY,\n\t\t\t\t\t\t\tconflictingChange: insertMap[key],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tout_conflicts.push(conflict);\n\n\t\t\t\t\t\t// Delete the modification from the rebased ChangeSet\n\t\t\t\t\t\tdelete insertMap[key];\n\t\t\t\t\t}\n\t\t\t\t} else if (\n\t\t\t\t\tmodification.own === \"remove_insert\" &&\n\t\t\t\t\tmodification.other === \"remove_insert\"\n\t\t\t\t) {\n\t\t\t\t\tlet insertMap = modification.otherTypeid\n\t\t\t\t\t\t? io_rebasePropertyChangeSet.insert[modification.otherTypeid]\n\t\t\t\t\t\t: io_rebasePropertyChangeSet.insert;\n\n\t\t\t\t\t// Raise the duplicate inserts as a conflict\n\t\t\t\t\tlet conflict = {\n\t\t\t\t\t\tpath: newPath,\n\t\t\t\t\t\ttype: ConflictType.COLLIDING_SET,\n\t\t\t\t\t\tconflictingChange: insertMap[key],\n\t\t\t\t\t};\n\t\t\t\t\tout_conflicts.push(conflict);\n\t\t\t\t} else {\n\t\t\t\t\t// All other operations are conflicting changes, which only occur for ChangeSets that are relative\n\t\t\t\t\t// to different bases\n\n\t\t\t\t\t// Create the conflict information\n\t\t\t\t\tlet conflict = {\n\t\t\t\t\t\tpath: newPath,\n\t\t\t\t\t\ttype: ConflictType.INVALID_CHANGESET_BASE,\n\t\t\t\t\t\tconflictingChange: modification.change,\n\t\t\t\t\t};\n\t\t\t\t\tout_conflicts.push(conflict);\n\n\t\t\t\t\t// Remove the change from the ChangeSet\n\t\t\t\t\tif (modification.other !== \"remove\") {\n\t\t\t\t\t\tif (modification.otherTypeid !== undefined) {\n\t\t\t\t\t\t\tdelete io_rebasePropertyChangeSet[modification.other][modification.otherTypeid][\n\t\t\t\t\t\t\t\tkey\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdelete io_rebasePropertyChangeSet[modification.other][key];\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Remove remove operations from the ChangeSet\n\t\t\t\t\t\tif (Array.isArray(io_rebasePropertyChangeSet[modification.other])) {\n\t\t\t\t\t\t\tio_rebasePropertyChangeSet[modification.other] = without(\n\t\t\t\t\t\t\t\tio_rebasePropertyChangeSet[modification.other],\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdelete io_rebasePropertyChangeSet[modification.other][key];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\"Rebase operation with conflicting ChangeSets. Probably incorrect bases.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Remove unnecessary entries from the ChangeSet\n\t\tthis._cleanIndexedCollectionChangeSet(io_rebasePropertyChangeSet, !isPrimitiveTypeid);\n\t};\n\n\t/**\n\t * Removes empty entries from the .children collection of the ChangeSet\n\t *\n\t * @param in_propertyChanges - The ChangeSet to clean up\n\t * @param in_containsTypeids - Does this ChangeSet contain typeids\n\t * @private\n\t */\n\texport const _cleanIndexedCollectionChangeSet = function (\n\t\tin_propertyChanges: SerializedChangeSet,\n\t\tin_containsTypeids: boolean,\n\t) {\n\t\tconst changes = in_propertyChanges;\n\t\t// Clean inserts\n\n\t\t// First remove unused typeid sections\n\t\tif (in_containsTypeids) {\n\t\t\tlet typeidList = Object.keys(changes.insert || {});\n\t\t\tfor (let j = 0; j < typeidList.length; j++) {\n\t\t\t\tif (_fastIsEmptyObject(changes.insert[typeidList[j]])) {\n\t\t\t\t\tdelete changes.insert[typeidList[j]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Remove add group if no operations are present\n\t\tif (_fastIsEmptyObject(changes.insert)) {\n\t\t\tdelete changes.insert;\n\t\t}\n\n\t\t// First remove unused typeid sections\n\t\tif (in_containsTypeids) {\n\t\t\tlet typeidList = Object.keys(changes.remove || {});\n\t\t\tfor (let j = 0; j < typeidList.length; j++) {\n\t\t\t\tif (_fastIsEmptyObject(changes.remove[typeidList[j]])) {\n\t\t\t\t\tdelete changes.remove[typeidList[j]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Remove remove group if no operations are present\n\t\tif (_fastIsEmptyObject(changes.remove)) {\n\t\t\tdelete changes.remove;\n\t\t}\n\n\t\t// Clean modifies\n\n\t\t// First remove unused typeid sections\n\t\tif (in_containsTypeids) {\n\t\t\tlet typeidList = Object.keys(changes.modify || {});\n\t\t\tfor (let j = 0; j < typeidList.length; j++) {\n\t\t\t\tconst modifies = changes.modify[typeidList[j]];\n\t\t\t\tconst modifyKeys = Object.keys(modifies);\n\t\t\t\tfor (let k = 0; k < modifyKeys.length; k++) {\n\t\t\t\t\tif (isEmptyChangeSet(modifies[modifyKeys[k]])) {\n\t\t\t\t\t\tdelete modifies[modifyKeys[k]];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (_fastIsEmptyObject(changes.modify[typeidList[j]])) {\n\t\t\t\t\tdelete changes.modify[typeidList[j]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Remove modify group if no operations are present\n\t\tif (_fastIsEmptyObject(changes.modify)) {\n\t\t\tdelete changes.modify;\n\t\t}\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"indexedCollection.js","sourceRoot":"","sources":["../../src/changeset_operations/indexedCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH;;GAEG;AAEH,yEAA2E;AAC3E,uEAA4C;AAC5C,qEAA0C;AAC1C,mEAAwC;AACxC,mEAAwC;AACxC,qEAA0C;AAC1C,mEAAwC;AAIxC,gEAA0D;AAC1D,oDAA8C;AAE9C,2EAA2D;AAC3D,+DAAyD;AAEzD,MAAM,EAAE,uBAAuB,EAAE,GAAG,EAAE,GAAG,2BAAS,CAAC;AAEnD;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,MAAM,kBAAkB,GAAG,UAAU,SAAc;IAClD,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAA,qBAAQ,EAAC,SAAS,CAAC,EAAE,CAAC;QACpE,OAAO,IAAA,oBAAO,EAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED,8DAA8D;IAC9D,KAAK,MAAM,MAAM,IAAI,SAAS,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC;IACd,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAEF,2DAA2D;AAC3D,IAAiB,mCAAmC,CA80BnD;AA90BD,WAAiB,mCAAmC;IACnD;;;;;;;;;;;;;OAaG;IACU,iFAA6C,GAAG,UAC5D,sBAA2C,EAC3C,yBAA8C,EAC9C,SAAiB,EACjB,UAAiC;QAEjC,MAAM,iBAAiB,GAAG,8BAAY,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;QAElE,iCAAiC;QACjC,IAAI,yBAAyB,CAAC,MAAM,EAAE,CAAC;YACtC,0EAA0E;YAC1E,IAAI,cAAc,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AAC;YACxB,IAAI,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;YACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC5C,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC/C,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBAC5C,IAAI,IAAA,sCAAgB,EAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;wBAC/C,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;oBAChC,CAAC;gBACF,CAAC;gBACD,IAAI,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBACvD,OAAO,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;gBACtC,CAAC;YACF,CAAC;QACF,CAAC;QAED,mDAAmD;QACnD,IAAI,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACxC,OAAO,OAAO,CAAC,MAAM,CAAC;QACvB,CAAC;IACF,CAAC,CAAC;AACH,CAAC,EA90BgB,mCAAmC,mDAAnC,mCAAmC,QA80BnD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Helper functions and classes to work with ChangeSets with indexed collections (sets and maps)\n */\n\nimport { constants, joinPaths } from \"@fluid-experimental/property-common\";\nimport cloneDeep from \"lodash/cloneDeep.js\";\nimport includes from \"lodash/includes.js\";\nimport isEmpty from \"lodash/isEmpty.js\";\nimport isEqual from \"lodash/isEqual.js\";\nimport isObject from \"lodash/isObject.js\";\nimport without from \"lodash/without.js\";\n\n// @ts-ignore\nimport { ApplyChangeSetOptions, ConflictInfo, SerializedChangeSet } from \"../changeset.js\";\nimport { TypeIdHelper } from \"../helpers/typeidHelper.js\";\nimport { PathHelper } from \"../pathHelper.js\";\n\nimport { ConflictType } from \"./changesetConflictTypes.js\";\nimport { isEmptyChangeSet } from \"./isEmptyChangeset.js\";\n\nconst { PROPERTY_PATH_DELIMITER, MSG } = constants;\n\n/**\n * @namespace property-changeset.ChangeSetOperations.IndexedCollectionOperations\n * @alias property-changeset.ChangeSetOperations.IndexedCollectionOperations\n * Helper functions and classes to perform operations on ChangeSets with indexed collections (sets and maps)\n */\n\n/**\n * Checks whether an object is empty (has no keys)\n * This function should be a bit faster than the isEmpty from\n * underscore. Unfortunately, at least on Chrome, it is still in\n * O(n)\n *\n * @param in_object - The object to check\n * @returns Is it empty?\n * @private\n */\nconst _fastIsEmptyObject = function (in_object: any): boolean {\n\tif (!in_object || Array.isArray(in_object) || !isObject(in_object)) {\n\t\treturn isEmpty(in_object);\n\t}\n\n\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\tfor (const _entry in in_object) {\n\t\treturn false;\n\t}\n\n\treturn true;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace ChangeSetIndexedCollectionFunctions {\n\t/**\n\t * Applies a ChangeSet to a given indexed collection property (recursively). The ChangeSet is assumed to be relative\n\t * to the same property root and it will be applied behind the base ChangeSet (assuming that the changes are\n\t * relative to the state after the base ChangeSet has been applied. It will change the base ChangeSet.\n\t *\n\t * @param io_basePropertyChanges - The ChangeSet describing the initial state\n\t * @param in_appliedPropertyChanges - The ChangeSet to apply to this state\n\t * @param in_typeid - The typeid of the contents collection (without the collection type).\n\t * @param in_options - Optional additional parameters\n\t * @param in_options.applyAfterMetaInformation - Additional meta information which help later to obtain\n\t * more compact changeset during the apply operation.\n\t *\n\t * @private\n\t */\n\texport const _performApplyAfterOnPropertyIndexedCollection = function (\n\t\tio_basePropertyChanges: SerializedChangeSet,\n\t\tin_appliedPropertyChanges: SerializedChangeSet,\n\t\tin_typeid: string,\n\t\tin_options: ApplyChangeSetOptions,\n\t) {\n\t\tconst isPrimitiveTypeid = TypeIdHelper.isPrimitiveType(in_typeid);\n\n\t\t// Handle remove entry operations\n\t\tif (in_appliedPropertyChanges.remove) {\n\t\t\t// Get and initialize the corresponding entries in the existing collection\n\t\t\tlet removedEntries = in_appliedPropertyChanges.remove;\n\n\t\t\tio_basePropertyChanges = io_basePropertyChanges || {};\n\t\t\tio_basePropertyChanges.remove =\n\t\t\t\tio_basePropertyChanges.remove ||\n\t\t\t\t(Array.isArray(in_appliedPropertyChanges.remove) ? [] : {});\n\t\t\tlet baseInserted = io_basePropertyChanges.insert || {};\n\t\t\tlet baseRemoved = io_basePropertyChanges.remove;\n\t\t\tlet baseModified = io_basePropertyChanges.modify;\n\t\t\tlet done = false;\n\n\t\t\tif (!Array.isArray(removedEntries)) {\n\t\t\t\tif (isPrimitiveTypeid) {\n\t\t\t\t\tremovedEntries = Object.keys(removedEntries);\n\t\t\t\t} else {\n\t\t\t\t\t// this is a reversible change set of templated types\n\t\t\t\t\tconst removedTypes = Object.keys(removedEntries);\n\t\t\t\t\tfor (let t = 0; t < removedTypes.length; t++) {\n\t\t\t\t\t\tconst removedKeys = Object.keys(removedEntries[removedTypes[t]]);\n\t\t\t\t\t\tfor (let i = 0; i < removedKeys.length; i++) {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tbaseInserted[removedTypes[t]] &&\n\t\t\t\t\t\t\t\tbaseInserted[removedTypes[t]][removedKeys[i]] !== undefined\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tdelete baseInserted[removedTypes[t]][removedKeys[i]];\n\n\t\t\t\t\t\t\t\t// If all entries for a typeid have been removed, we can remove\n\t\t\t\t\t\t\t\t// the whole typeid from the inserted section\n\t\t\t\t\t\t\t\tif (baseInserted && isEmpty(baseInserted[removedTypes[t]])) {\n\t\t\t\t\t\t\t\t\tdelete baseInserted[removedTypes[t]];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tbaseModified &&\n\t\t\t\t\t\t\t\t\tbaseModified[removedTypes[t]] &&\n\t\t\t\t\t\t\t\t\tbaseModified[removedTypes[t]][removedKeys[i]] !== undefined\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tdelete baseModified[removedTypes[t]][removedKeys[i]];\n\n\t\t\t\t\t\t\t\t\t// If all entries for a typeid have been removed, we can remove\n\t\t\t\t\t\t\t\t\t// the whole typeid from the inserted section\n\t\t\t\t\t\t\t\t\tif (baseModified && isEmpty(baseModified[removedTypes[t]])) {\n\t\t\t\t\t\t\t\t\t\tdelete baseModified[removedTypes[t]];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (Array.isArray(baseRemoved)) {\n\t\t\t\t\t\t\t\t\tbaseRemoved.push(removedKeys[i]);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tif (!baseRemoved[removedTypes[t]]) {\n\t\t\t\t\t\t\t\t\t\tbaseRemoved[removedTypes[t]] = {};\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbaseRemoved[removedTypes[t]][removedKeys[i]] =\n\t\t\t\t\t\t\t\t\t\tremovedEntries[removedTypes[t]][removedKeys[i]];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdone = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!done) {\n\t\t\t\tif (isPrimitiveTypeid) {\n\t\t\t\t\tfor (let i = 0; i < removedEntries.length; i++) {\n\t\t\t\t\t\tlet key = removedEntries[i];\n\n\t\t\t\t\t\t// If there is an insert for this key, we just remove it\n\t\t\t\t\t\tif (baseInserted[key] !== undefined) {\n\t\t\t\t\t\t\tdelete baseInserted[key];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// There could be a modify entry for this key, which we have to remove\n\t\t\t\t\t\t\tif (baseModified && baseModified[key] !== undefined) {\n\t\t\t\t\t\t\t\tdelete baseModified[key];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Otherwise we add it to the remove list\n\t\t\t\t\t\t\tif (Array.isArray(baseRemoved)) {\n\t\t\t\t\t\t\t\tbaseRemoved.push(key);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tbaseRemoved[key] = in_appliedPropertyChanges.remove[key];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst baseInsertedTypeids = Object.keys(baseInserted);\n\t\t\t\t\tfor (let i = 0; i < removedEntries.length; i++) {\n\t\t\t\t\t\tlet key = removedEntries[i];\n\t\t\t\t\t\tlet foundInTypeid;\n\n\t\t\t\t\t\t// Since we only have a flat remove list (without typeid) in the changeset, we have\n\t\t\t\t\t\t// to check all inserts\n\t\t\t\t\t\tfor (let j = 0; j < baseInsertedTypeids.length; j++) {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tbaseInserted[baseInsertedTypeids[j]] &&\n\t\t\t\t\t\t\t\tbaseInserted[baseInsertedTypeids[j]][key] !== undefined\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tfoundInTypeid = baseInsertedTypeids[j];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (foundInTypeid) {\n\t\t\t\t\t\t\t// If this key was inserted by this ChangeSet, we just remove it from the inserted list\n\t\t\t\t\t\t\tdelete baseInserted[foundInTypeid][key];\n\n\t\t\t\t\t\t\t// If all entries for a typeid have been removed, we can remove\n\t\t\t\t\t\t\t// the whole typeid from the inserted or modified section\n\t\t\t\t\t\t\tif (baseInserted && isEmpty(baseInserted[foundInTypeid])) {\n\t\t\t\t\t\t\t\tdelete baseInserted[foundInTypeid];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (baseModified && isEmpty(baseModified[foundInTypeid])) {\n\t\t\t\t\t\t\t\tdelete baseModified[foundInTypeid];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// There could be a modify entry for this key, which we have to remove\n\t\t\t\t\t\t\tconst baseModifiedTypeids = Object.keys(baseModified || {});\n\t\t\t\t\t\t\tfor (let j = 0; j < baseModifiedTypeids.length; j++) {\n\t\t\t\t\t\t\t\tif (baseModified[baseModifiedTypeids[j]][key]) {\n\t\t\t\t\t\t\t\t\tfoundInTypeid = baseModifiedTypeids[j];\n\t\t\t\t\t\t\t\t\tdelete baseModified[foundInTypeid][key];\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Otherwise we add it to the remove list\n\t\t\t\t\t\t\tbaseRemoved.push(key);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Apply insert operations\n\t\tif (in_appliedPropertyChanges.insert) {\n\t\t\t// Get and initialize the corresponding entries from the existing collection\n\t\t\tio_basePropertyChanges = io_basePropertyChanges || {};\n\t\t\tio_basePropertyChanges.insert = io_basePropertyChanges.insert || {};\n\t\t\tlet baseInserted = io_basePropertyChanges.insert;\n\t\t\tlet baseRemoved = io_basePropertyChanges.remove;\n\n\t\t\t// Insert the inserted entries\n\n\t\t\t// If no typeids are included, we just use a placeholder for the iteration below\n\t\t\tconst insertedTypeids = isPrimitiveTypeid\n\t\t\t\t? [undefined]\n\t\t\t\t: Object.keys(in_appliedPropertyChanges.insert);\n\t\t\tfor (let i = 0; i < insertedTypeids.length; i++) {\n\t\t\t\tlet typeid = insertedTypeids[i];\n\t\t\t\tconst insertedEntries = isPrimitiveTypeid\n\t\t\t\t\t? in_appliedPropertyChanges.insert\n\t\t\t\t\t: in_appliedPropertyChanges.insert[typeid];\n\t\t\t\tconst insertedKeys = Object.keys(insertedEntries);\n\t\t\t\tlet removalCS;\n\t\t\t\tif (baseRemoved) {\n\t\t\t\t\tremovalCS = isPrimitiveTypeid ? baseRemoved : baseRemoved[typeid];\n\t\t\t\t}\n\t\t\t\tfor (let j = 0; j < insertedKeys.length; j++) {\n\t\t\t\t\tlet key = insertedKeys[j];\n\t\t\t\t\tlet deeplyEqualCS = false;\n\n\t\t\t\t\t// If we have a complex type in the collection, we need to do a deep comparison of the two\n\t\t\t\t\t// ChangeSets to determine, whether they are equal\n\t\t\t\t\t// TODO: We should actually compute a diff between the two and recursively convert portions to modifies\n\t\t\t\t\t// Instead, right now, we only handle the case where the two keys cancel each out perfectly, i.e.,\n\t\t\t\t\t// the insert is reinserting exactly what was removed.\n\t\t\t\t\tif (\n\t\t\t\t\t\t!isPrimitiveTypeid &&\n\t\t\t\t\t\tremovalCS &&\n\t\t\t\t\t\tisObject(removalCS) &&\n\t\t\t\t\t\tremovalCS[key] !== undefined\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Split out the two parts: all the keys other than remove/insert should match exactly.\n\t\t\t\t\t\t// The contents 'remove' and 'insert', if they exist, should also match.\n\t\t\t\t\t\tdeeplyEqualCS = !!insertedEntries[key].insert === !!removalCS[key].remove;\n\n\t\t\t\t\t\t// If there are 'insert' and 'remove', see if the removed data matches the inserted data\n\t\t\t\t\t\tif (deeplyEqualCS && insertedEntries[key].insert) {\n\t\t\t\t\t\t\tdeeplyEqualCS = isEqual(insertedEntries[key].insert, removalCS[key].remove);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Finally, check if the data being inserted matches the data that was removed\n\t\t\t\t\t\tconst insertedEntry = isObject(insertedEntries[key])\n\t\t\t\t\t\t\t? without(insertedEntries[key], \"insert\")\n\t\t\t\t\t\t\t: insertedEntries[key];\n\t\t\t\t\t\tconst removedEntry = isObject(removalCS[key])\n\t\t\t\t\t\t\t? without(removalCS[key], \"remove\")\n\t\t\t\t\t\t\t: removalCS[key];\n\t\t\t\t\t\tdeeplyEqualCS = deeplyEqualCS && isEqual(insertedEntry, removedEntry);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t(isPrimitiveTypeid || TypeIdHelper.isPrimitiveType(typeid) || deeplyEqualCS) &&\n\t\t\t\t\t\tremovalCS &&\n\t\t\t\t\t\t((Array.isArray(removalCS) && includes(baseRemoved, key)) ||\n\t\t\t\t\t\t\tremovalCS[key] !== undefined)\n\t\t\t\t\t) {\n\t\t\t\t\t\t// A remove and insert are combined into a modify for primitive types\n\n\t\t\t\t\t\t// Remove the old remove command\n\t\t\t\t\t\tlet oldValueMatches = false;\n\t\t\t\t\t\tif (Array.isArray(removalCS)) {\n\t\t\t\t\t\t\tif (isPrimitiveTypeid) {\n\t\t\t\t\t\t\t\tio_basePropertyChanges.remove = without(io_basePropertyChanges.remove, key);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tio_basePropertyChanges.remove[typeid] = without(\n\t\t\t\t\t\t\t\t\tio_basePropertyChanges.remove[typeid],\n\t\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\toldValueMatches = deeplyEqualCS || removalCS[key] === insertedEntries[key];\n\t\t\t\t\t\t\tdelete removalCS[key];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Insert a modify command instead\n\t\t\t\t\t\tif (!oldValueMatches) {\n\t\t\t\t\t\t\tio_basePropertyChanges.modify = io_basePropertyChanges.modify || {};\n\t\t\t\t\t\t\tif (isPrimitiveTypeid) {\n\t\t\t\t\t\t\t\tio_basePropertyChanges.modify[key] = insertedEntries[key];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tio_basePropertyChanges.modify[typeid] =\n\t\t\t\t\t\t\t\t\tio_basePropertyChanges.modify[typeid] || {};\n\t\t\t\t\t\t\t\tio_basePropertyChanges.modify[typeid][key] = cloneDeep(insertedEntries[key]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (isPrimitiveTypeid && baseInserted[key] === undefined) {\n\t\t\t\t\t\tbaseInserted[key] = insertedEntries[key];\n\t\t\t\t\t} else if (\n\t\t\t\t\t\t!isPrimitiveTypeid &&\n\t\t\t\t\t\t(!baseInserted[typeid] || baseInserted[typeid][key] === undefined)\n\t\t\t\t\t) {\n\t\t\t\t\t\tbaseInserted[typeid] = baseInserted[typeid] || {};\n\t\t\t\t\t\tbaseInserted[typeid][key] = cloneDeep(insertedEntries[key]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new Error(MSG.ALREADY_EXISTING_ENTRY + key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Handle modification operations\n\t\tif (in_appliedPropertyChanges.modify) {\n\t\t\t// Get and initialize the corresponding entries from the existing collection\n\t\t\tconst modifiedEntries = in_appliedPropertyChanges.modify;\n\t\t\tio_basePropertyChanges = io_basePropertyChanges || {};\n\t\t\tio_basePropertyChanges.modify = io_basePropertyChanges.modify || {};\n\t\t\tlet baseModified = io_basePropertyChanges.modify;\n\t\t\tlet baseInserted = io_basePropertyChanges.insert || {};\n\n\t\t\t// Process the modifications\n\n\t\t\t// If no typeids are included, we just use a placeholder for the iteration below\n\t\t\tconst modifiedTypeids = isPrimitiveTypeid ? [undefined] : Object.keys(modifiedEntries);\n\t\t\tfor (let i = 0; i < modifiedTypeids.length; i++) {\n\t\t\t\tlet typeid = modifiedTypeids[i];\n\n\t\t\t\tconst modifyKeys = Object.keys(\n\t\t\t\t\tisPrimitiveTypeid ? modifiedEntries : modifiedEntries[typeid],\n\t\t\t\t);\n\t\t\t\tfor (let j = 0; j < modifyKeys.length; j++) {\n\t\t\t\t\tlet key = modifyKeys[j];\n\n\t\t\t\t\tif (isPrimitiveTypeid) {\n\t\t\t\t\t\tlet newValue = modifiedEntries[key];\n\t\t\t\t\t\tif (newValue && newValue.hasOwnProperty(\"value\")) {\n\t\t\t\t\t\t\tnewValue = newValue.value;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (baseInserted[key] !== undefined) {\n\t\t\t\t\t\t\t// If this entry was added by this ChangeSet, we modify the insert operation according to the\n\t\t\t\t\t\t\t// new ChangeSet\n\t\t\t\t\t\t\tbaseInserted[key] = newValue;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (baseModified[key] && baseModified[key].hasOwnProperty(\"value\")) {\n\t\t\t\t\t\t\t\tbaseModified[key].value = newValue;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tbaseModified[key] = newValue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If this is a polymorphic collection, we can still have individual entries with\n\t\t\t\t\t\t// primitive types\n\t\t\t\t\t\tconst isEntryPrimitiveType = TypeIdHelper.isPrimitiveType(typeid);\n\n\t\t\t\t\t\tif (baseInserted[typeid] && baseInserted[typeid][key] !== undefined) {\n\t\t\t\t\t\t\t// If this entry was added by this ChangeSet, we modify the insert operation according to the\n\t\t\t\t\t\t\t// new ChangeSet\n\t\t\t\t\t\t\tif (isEntryPrimitiveType && typeid !== \"String\") {\n\t\t\t\t\t\t\t\tlet newValue = modifiedEntries[typeid][key];\n\t\t\t\t\t\t\t\tif (newValue && newValue.hasOwnProperty(\"value\")) {\n\t\t\t\t\t\t\t\t\tnewValue = modifiedEntries[typeid][key].value;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// In the case of Int64 or Uint64 we copy the array so that\n\t\t\t\t\t\t\t\t// both ChangeSets don't point to the same instance\n\t\t\t\t\t\t\t\tif (typeid === \"Int64\" || typeid === \"Uint64\") {\n\t\t\t\t\t\t\t\t\tnewValue = newValue.slice();\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tbaseInserted[typeid][key] &&\n\t\t\t\t\t\t\t\t\tbaseInserted[typeid][key].hasOwnProperty(\"value\")\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tbaseInserted[typeid][key].value = newValue;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbaseInserted[typeid][key] = newValue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.performApplyAfterOnPropertyWithTypeid(\n\t\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\t\tbaseInserted[typeid],\n\t\t\t\t\t\t\t\t\tmodifiedEntries[typeid],\n\t\t\t\t\t\t\t\t\ttypeid,\n\t\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t\tin_options,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (baseModified[typeid] && baseModified[typeid][key] !== undefined) {\n\t\t\t\t\t\t\t// If there was a previous modification operation, we have to merge the two\n\t\t\t\t\t\t\tif (isEntryPrimitiveType && typeid !== \"String\") {\n\t\t\t\t\t\t\t\t// Primitive types can simply be overwritten, however we have an exception for\n\t\t\t\t\t\t\t\t// 64 bit integers (until javascript natively supports them)\n\t\t\t\t\t\t\t\tif (typeid === \"Int64\" || typeid === \"Uint64\") {\n\t\t\t\t\t\t\t\t\tlet appliedVal = modifiedEntries[typeid][key];\n\t\t\t\t\t\t\t\t\tif (appliedVal && appliedVal.hasOwnProperty(\"value\")) {\n\t\t\t\t\t\t\t\t\t\tappliedVal = appliedVal.value;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbaseModified[typeid][key] = appliedVal.slice();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbaseModified[typeid][key] = modifiedEntries[typeid][key];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.performApplyAfterOnPropertyWithTypeid(\n\t\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\t\tbaseModified[typeid],\n\t\t\t\t\t\t\t\t\tmodifiedEntries[typeid],\n\t\t\t\t\t\t\t\t\ttypeid,\n\t\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t\t\tin_options,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbaseModified[typeid] = baseModified[typeid] || {};\n\t\t\t\t\t\t\tbaseModified[typeid][key] = cloneDeep(modifiedEntries[typeid][key]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Remove unnecessary entries from the ChangeSet\n\t\tthis._cleanIndexedCollectionChangeSet(io_basePropertyChanges, !isPrimitiveTypeid);\n\t};\n\n\t/**\n\t * Performs the rebase operation for set and map collections.\n\t *\n\t * @param in_ownPropertyChangeSet - The ChangeSet for this collection.\n\t * @param io_rebasePropertyChangeSet - The ChangeSet for the collection to be rebased.\n\t * @param in_basePath - Base path to get to the property processed by this function.\n\t * @param in_typeid - The typeid of the contents collection (without the collection type).\n\t * @param in_useSquareBracketsInPath - If set to true, paths will be created using the angular brackets syntax (for\n\t * arrays), otherwise dots will be used (for NodeProperties).\n\t * @param out_conflicts - A list of paths that resulted in conflicts together with the type of the conflict.\n\t * @param in_options - Optional additional parameters.\n\t * @param in_options.applyAfterMetaInformation - Additional meta information which help later to obtain\n\t * more compact changeset during the apply operation.\n\t *\n\t * @private\n\t */\n\texport const _rebaseIndexedCollectionChangeSetForProperty = function (\n\t\tin_ownPropertyChangeSet: SerializedChangeSet,\n\t\tio_rebasePropertyChangeSet: SerializedChangeSet,\n\t\tin_basePath: string,\n\t\tin_typeid: string,\n\t\tin_useSquareBracketsInPath: boolean,\n\t\tout_conflicts: ConflictInfo[],\n\t\tin_options: ApplyChangeSetOptions,\n\t) {\n\t\tconst isPrimitiveTypeid = TypeIdHelper.isPrimitiveType(in_typeid);\n\n\t\tconst changesByKeys = {};\n\t\tlet modifyMap = {};\n\t\t// Helper function which stores the changes indexed by key in the changesByKeys array to\n\t\t// make it easier to compare the related changes in the two ChangeSets\n\t\tconst addChanges = function (\n\t\t\tin_collection: Record<string, any>,\n\t\t\tin_changeIdentifier: string,\n\t\t\tin_changePrefix: string,\n\t\t\tin_typeidChange?: string,\n\t\t) {\n\t\t\t// Collection didn't exist in this ChangeSet\n\t\t\tif (in_collection === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For remove operations, the ChangeSet is only an array of keys, otherwise it is a map, so we have to\n\t\t\t// distinguish the two cases here\n\t\t\tconst keys = Array.isArray(in_collection) ? in_collection : Object.keys(in_collection);\n\n\t\t\t// Add all entries indexed with the key\n\t\t\tfor (let j = 0; j < keys.length; j++) {\n\t\t\t\tconst key = keys[j];\n\n\t\t\t\t// Store the type of the change\n\t\t\t\tchangesByKeys[key] = changesByKeys[key] || {};\n\t\t\t\tchangesByKeys[key][in_changePrefix] = changesByKeys[key][in_changePrefix]\n\t\t\t\t\t? `${changesByKeys[key][in_changePrefix]}_${in_changeIdentifier}`\n\t\t\t\t\t: in_changeIdentifier;\n\n\t\t\t\t// If applicable store the typeid of the change\n\t\t\t\tif (in_typeidChange) {\n\t\t\t\t\tchangesByKeys[key][`${in_changePrefix}Typeid`] = in_typeidChange;\n\t\t\t\t}\n\n\t\t\t\t// Store the ChangeSet\n\t\t\t\tif (in_changePrefix === \"other\") {\n\t\t\t\t\tchangesByKeys[key].change = Array.isArray(in_collection) ? key : in_collection[key];\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t// Helper function which adds the Changes for a ChangeSet that is ordered by typeid\n\t\tconst addChangesWithTypeids = function (\n\t\t\tin_collection,\n\t\t\tin_changeIdentifier,\n\t\t\tin_changePrefix,\n\t\t) {\n\t\t\tif (in_collection === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Iterate over the typeids (or use dummy entry for the iteration\n\t\t\tconst addedKeyTypeids = Object.keys(in_collection);\n\t\t\tfor (let i = 0; i < addedKeyTypeids.length; i++) {\n\t\t\t\tconst Typeid = addedKeyTypeids[i];\n\t\t\t\taddChanges(in_collection[Typeid], in_changeIdentifier, in_changePrefix, Typeid);\n\t\t\t}\n\t\t};\n\n\t\t// Insert all changes from the ChangeSet into the lookup map\n\t\tif (Array.isArray(in_ownPropertyChangeSet.remove)) {\n\t\t\taddChanges(in_ownPropertyChangeSet.remove, \"remove\", \"own\");\n\t\t} else {\n\t\t\tif (isPrimitiveTypeid) {\n\t\t\t\taddChanges(in_ownPropertyChangeSet.remove, \"remove\", \"own\");\n\t\t\t} else {\n\t\t\t\taddChangesWithTypeids(in_ownPropertyChangeSet.remove, \"remove\", \"own\");\n\t\t\t}\n\t\t}\n\n\t\tif (Array.isArray(io_rebasePropertyChangeSet.remove)) {\n\t\t\taddChanges(io_rebasePropertyChangeSet.remove, \"remove\", \"other\");\n\t\t} else {\n\t\t\tif (isPrimitiveTypeid) {\n\t\t\t\taddChanges(io_rebasePropertyChangeSet.remove, \"remove\", \"other\");\n\t\t\t} else {\n\t\t\t\taddChangesWithTypeids(io_rebasePropertyChangeSet.remove, \"remove\", \"other\");\n\t\t\t}\n\t\t}\n\n\t\tif (isPrimitiveTypeid) {\n\t\t\taddChanges(in_ownPropertyChangeSet.insert, \"insert\", \"own\");\n\t\t\taddChanges(in_ownPropertyChangeSet.modify, \"modify\", \"own\");\n\t\t\taddChanges(io_rebasePropertyChangeSet.insert, \"insert\", \"other\");\n\t\t\taddChanges(io_rebasePropertyChangeSet.modify, \"modify\", \"other\");\n\t\t} else {\n\t\t\taddChangesWithTypeids(in_ownPropertyChangeSet.insert, \"insert\", \"own\");\n\t\t\taddChangesWithTypeids(in_ownPropertyChangeSet.modify, \"modify\", \"own\");\n\t\t\taddChangesWithTypeids(io_rebasePropertyChangeSet.insert, \"insert\", \"other\");\n\t\t\taddChangesWithTypeids(io_rebasePropertyChangeSet.modify, \"modify\", \"other\");\n\t\t}\n\n\t\t// Check for modifications that affect the same object\n\t\tconst changedKeys = Object.keys(changesByKeys);\n\t\tfor (let i = 0; i < changedKeys.length; i++) {\n\t\t\tconst key = changedKeys[i];\n\t\t\tconst newPath = in_useSquareBracketsInPath\n\t\t\t\t? `${in_basePath}[${PathHelper.quotePathSegmentIfNeeded(key)}]`\n\t\t\t\t: joinPaths(\n\t\t\t\t\t\tin_basePath,\n\t\t\t\t\t\tPathHelper.quotePathSegmentIfNeeded(key),\n\t\t\t\t\t\tPROPERTY_PATH_DELIMITER,\n\t\t\t\t\t);\n\n\t\t\tconst modification = changesByKeys[key];\n\t\t\tif (modification.own && modification.other) {\n\t\t\t\t/*\n We found a key that was changed by both ChangeSets at the same time\n We now have to handle the conflicting changes. The changes we do, are summarized in this table:\n\n <START REBASE HANDLING TABLE>\n +-------+-----------------+------------------+-------------------+-------------------------------------+\n | \\Own| insert | modify | remove | remove+insert |\n | \\ | | | | |\n |other\\ | | | | |\n +=======+=================+==================+===================+=====================================+\n | | conflicting | incompatible | incompatible | incompatible |\n |insert | inserts | psets | psets | psets |\n | | | | | |\n +-------+-----------------+------------------+-------------------+-------------------------------------+\n | | incompatible | merge recursively| conflict | conflict |\n |modify | psets | (conflicting on | | (modify can not be applied due to |\n | | | leaf) | - delete modify | to incompatible base) |\n | | | | in other | |\n | | | | | - delete modify in other |\n +-------+-----------------+------------------+-------------------+-------------------------------------+\n | | incompatible | non-conflicting | non-conflicting | incompatible |\n |remove | psets | change | change | psets |\n | | | | | |\n | | | | - rem dupl. remove| |\n +-------+-----------------+------------------+-------------------+-------------------------------------+\n | | incompatible | non-conflicting | non-conflicting | conflict |\n |remove+| psets | change | change | |\n |insert | | | | - remove conflicting insert |\n | | | | - rem dupl. remove| |\n +-------+-----------------+------------------+-------------------+-------------------------------------+\n <END REBASE HANDLING TABLE>\n */\n\n\t\t\t\t// A key was modified after it had been removed\n\t\t\t\tif (modification.own === \"modify\" && modification.other === \"modify\") {\n\t\t\t\t\tif (\n\t\t\t\t\t\tisPrimitiveTypeid ||\n\t\t\t\t\t\t(TypeIdHelper.isPrimitiveType(modification.ownTypeid) &&\n\t\t\t\t\t\t\tmodification.ownTypeid !== \"String\")\n\t\t\t\t\t) {\n\t\t\t\t\t\t// We have two modification operations that affect the same entry for a base type.\n\t\t\t\t\t\t// This is a legal operation, the second one will overwrite the first one, but we\n\t\t\t\t\t\t// report it as a possible conflict\n\t\t\t\t\t\tlet ownModify = in_ownPropertyChangeSet.modify;\n\t\t\t\t\t\tlet rebasedModify = io_rebasePropertyChangeSet.modify;\n\t\t\t\t\t\tif (modification.otherTypeid) {\n\t\t\t\t\t\t\townModify = ownModify[modification.otherTypeid];\n\t\t\t\t\t\t\trebasedModify = rebasedModify[modification.otherTypeid];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet conflict = {\n\t\t\t\t\t\t\tpath: newPath,\n\t\t\t\t\t\t\ttype: ConflictType.COLLIDING_SET,\n\t\t\t\t\t\t\tconflictingChange: ownModify[key],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tout_conflicts.push(conflict);\n\t\t\t\t\t\t// If value is the same, delete the entry\n\t\t\t\t\t\tlet ownValue = ownModify[key];\n\t\t\t\t\t\tif (typeof ownValue === \"object\" && ownValue.hasOwnProperty(\"value\")) {\n\t\t\t\t\t\t\townValue = ownValue.value;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlet rebaseValue = rebasedModify[key];\n\t\t\t\t\t\tif (typeof rebaseValue === \"object\" && rebaseValue.hasOwnProperty(\"value\")) {\n\t\t\t\t\t\t\trebaseValue = rebaseValue.value;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tmodification.ownTypeid === \"Int64\" ||\n\t\t\t\t\t\t\tmodification.ownTypeid === \"Uint64\" ||\n\t\t\t\t\t\t\townValue.length === 2\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// For (u)int64, values are arrays of 2 elements\n\t\t\t\t\t\t\tif (ownValue[0] === rebaseValue[0] && ownValue[1] === rebaseValue[1]) {\n\t\t\t\t\t\t\t\tdelete rebasedModify[key];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (ownValue === rebaseValue) {\n\t\t\t\t\t\t\t\tdelete rebasedModify[key];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.rebaseChangeSetForPropertyEntryWithTypeid(\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tin_ownPropertyChangeSet.modify[modification.ownTypeid],\n\t\t\t\t\t\t\tio_rebasePropertyChangeSet.modify[modification.otherTypeid],\n\t\t\t\t\t\t\tmodification.ownTypeid,\n\t\t\t\t\t\t\tnewPath,\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\tout_conflicts,\n\t\t\t\t\t\t\tin_options,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else if (modification.own === \"remove\" && modification.other === \"modify\") {\n\t\t\t\t\tmodifyMap = modification.otherTypeid\n\t\t\t\t\t\t? io_rebasePropertyChangeSet.modify[modification.otherTypeid]\n\t\t\t\t\t\t: io_rebasePropertyChangeSet.modify;\n\n\t\t\t\t\t// Create the conflict information\n\t\t\t\t\tlet conflict = {\n\t\t\t\t\t\tpath: newPath,\n\t\t\t\t\t\ttype: ConflictType.ENTRY_MODIFIED_AFTER_REMOVE,\n\t\t\t\t\t\tconflictingChange: modifyMap[key],\n\t\t\t\t\t};\n\t\t\t\t\tout_conflicts.push(conflict);\n\n\t\t\t\t\t// Delete the modification from the rebased ChangeSet\n\t\t\t\t\tdelete modifyMap[key];\n\t\t\t\t} else if (modification.own === \"remove_insert\" && modification.other === \"modify\") {\n\t\t\t\t\tif (!isPrimitiveTypeid) {\n\t\t\t\t\t\t// We have a conflicting change. A node was removed and inserted (replaced) in the original\n\t\t\t\t\t\t// ChangeSet and then modified by the rebased ChangeSet. Since the base of the modification\n\t\t\t\t\t\t// can have been changed significantly by this operation, we don't know whether we can\n\t\t\t\t\t\t// apply the modification\n\n\t\t\t\t\t\t// Create the conflict information\n\t\t\t\t\t\tlet conflict = {\n\t\t\t\t\t\t\tpath: newPath,\n\t\t\t\t\t\t\ttype: ConflictType.ENTRY_MODIFICATION_AFTER_REMOVE_INSERT,\n\t\t\t\t\t\t\tconflictingChange:\n\t\t\t\t\t\t\t\tio_rebasePropertyChangeSet.modify[modification.otherTypeid][key],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tout_conflicts.push(conflict);\n\n\t\t\t\t\t\t// Delete the modification from the rebased ChangeSet\n\t\t\t\t\t\tdelete io_rebasePropertyChangeSet.modify[modification.otherTypeid][key];\n\t\t\t\t\t}\n\t\t\t\t} else if (\n\t\t\t\t\t(modification.own === \"modify\" || modification.own === \"remove\") &&\n\t\t\t\t\t(modification.other === \"remove\" || modification.other === \"remove_insert\")\n\t\t\t\t) {\n\t\t\t\t\tif (modification.own === \"modify\") {\n\t\t\t\t\t\tmodifyMap = modification.ownTypeid\n\t\t\t\t\t\t\t? in_ownPropertyChangeSet.modify[modification.ownTypeid]\n\t\t\t\t\t\t\t: in_ownPropertyChangeSet.modify;\n\n\t\t\t\t\t\t// Create the conflict information\n\t\t\t\t\t\tlet conflict = {\n\t\t\t\t\t\t\tpath: newPath,\n\t\t\t\t\t\t\ttype: ConflictType.REMOVE_AFTER_MODIFY,\n\t\t\t\t\t\t\tconflictingChange: modifyMap[key],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tout_conflicts.push(conflict);\n\t\t\t\t\t}\n\n\t\t\t\t\t// If we have a duplicated delete, we remove it from the new ChangeSet\n\t\t\t\t\tif (modification.own === \"remove\") {\n\t\t\t\t\t\tif (Array.isArray(io_rebasePropertyChangeSet.remove)) {\n\t\t\t\t\t\t\tio_rebasePropertyChangeSet.remove = without(\n\t\t\t\t\t\t\t\tio_rebasePropertyChangeSet.remove,\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (isPrimitiveTypeid) {\n\t\t\t\t\t\t\t\tdelete io_rebasePropertyChangeSet.remove[key];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdelete io_rebasePropertyChangeSet.remove[modification.otherTypeid][key];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (modification.own === \"insert\" && modification.other === \"insert\") {\n\t\t\t\t\tif (isPrimitiveTypeid || TypeIdHelper.isPrimitiveType(modification.ownTypeid)) {\n\t\t\t\t\t\tlet insertMap = modification.otherTypeid\n\t\t\t\t\t\t\t? io_rebasePropertyChangeSet.insert[modification.otherTypeid]\n\t\t\t\t\t\t\t: io_rebasePropertyChangeSet.insert;\n\n\t\t\t\t\t\t// We have two insert operations that affect the same key for a primitive type.\n\t\t\t\t\t\t// This is a legal operation, the second one will overwrite the first one, but we\n\t\t\t\t\t\t// report it as a possible conflicting set\n\t\t\t\t\t\tlet conflict = {\n\t\t\t\t\t\t\tpath: newPath,\n\t\t\t\t\t\t\ttype: ConflictType.COLLIDING_SET,\n\t\t\t\t\t\t\tconflictingChange: insertMap[key],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tout_conflicts.push(conflict);\n\n\t\t\t\t\t\t// Convert to modify\n\t\t\t\t\t\tlet oldValue;\n\t\t\t\t\t\tif (modification.otherTypeid) {\n\t\t\t\t\t\t\tio_rebasePropertyChangeSet.modify = io_rebasePropertyChangeSet.modify || {};\n\t\t\t\t\t\t\tio_rebasePropertyChangeSet.modify[modification.otherTypeid] =\n\t\t\t\t\t\t\t\tio_rebasePropertyChangeSet.modify[modification.otherTypeid] || {};\n\t\t\t\t\t\t\tmodifyMap = io_rebasePropertyChangeSet.modify[modification.otherTypeid];\n\t\t\t\t\t\t\toldValue = in_ownPropertyChangeSet.insert[modification.ownTypeid][key];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tio_rebasePropertyChangeSet.modify = io_rebasePropertyChangeSet.modify || {};\n\t\t\t\t\t\t\tmodifyMap = io_rebasePropertyChangeSet.modify;\n\t\t\t\t\t\t\toldValue = in_ownPropertyChangeSet.insert[key];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmodifyMap[key] = { value: insertMap[key], oldValue };\n\t\t\t\t\t\tdelete insertMap[key];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Here we have two insert operations for objects. Since these affect a whole sub-tree and not\n\t\t\t\t\t\t// just a single value, we cannot easily convert it into a modify and instead report it as invalid\n\n\t\t\t\t\t\tlet insertMap = modification.otherTypeid\n\t\t\t\t\t\t\t? io_rebasePropertyChangeSet.insert[modification.otherTypeid]\n\t\t\t\t\t\t\t: io_rebasePropertyChangeSet.insert;\n\n\t\t\t\t\t\t// Create the conflict information\n\t\t\t\t\t\tlet conflict = {\n\t\t\t\t\t\t\tpath: newPath,\n\t\t\t\t\t\t\ttype: ConflictType.INSERTED_ENTRY_WITH_SAME_KEY,\n\t\t\t\t\t\t\tconflictingChange: insertMap[key],\n\t\t\t\t\t\t};\n\t\t\t\t\t\tout_conflicts.push(conflict);\n\n\t\t\t\t\t\t// Delete the modification from the rebased ChangeSet\n\t\t\t\t\t\tdelete insertMap[key];\n\t\t\t\t\t}\n\t\t\t\t} else if (\n\t\t\t\t\tmodification.own === \"remove_insert\" &&\n\t\t\t\t\tmodification.other === \"remove_insert\"\n\t\t\t\t) {\n\t\t\t\t\tlet insertMap = modification.otherTypeid\n\t\t\t\t\t\t? io_rebasePropertyChangeSet.insert[modification.otherTypeid]\n\t\t\t\t\t\t: io_rebasePropertyChangeSet.insert;\n\n\t\t\t\t\t// Raise the duplicate inserts as a conflict\n\t\t\t\t\tlet conflict = {\n\t\t\t\t\t\tpath: newPath,\n\t\t\t\t\t\ttype: ConflictType.COLLIDING_SET,\n\t\t\t\t\t\tconflictingChange: insertMap[key],\n\t\t\t\t\t};\n\t\t\t\t\tout_conflicts.push(conflict);\n\t\t\t\t} else {\n\t\t\t\t\t// All other operations are conflicting changes, which only occur for ChangeSets that are relative\n\t\t\t\t\t// to different bases\n\n\t\t\t\t\t// Create the conflict information\n\t\t\t\t\tlet conflict = {\n\t\t\t\t\t\tpath: newPath,\n\t\t\t\t\t\ttype: ConflictType.INVALID_CHANGESET_BASE,\n\t\t\t\t\t\tconflictingChange: modification.change,\n\t\t\t\t\t};\n\t\t\t\t\tout_conflicts.push(conflict);\n\n\t\t\t\t\t// Remove the change from the ChangeSet\n\t\t\t\t\tif (modification.other !== \"remove\") {\n\t\t\t\t\t\tif (modification.otherTypeid !== undefined) {\n\t\t\t\t\t\t\tdelete io_rebasePropertyChangeSet[modification.other][modification.otherTypeid][\n\t\t\t\t\t\t\t\tkey\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdelete io_rebasePropertyChangeSet[modification.other][key];\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Remove remove operations from the ChangeSet\n\t\t\t\t\t\tif (Array.isArray(io_rebasePropertyChangeSet[modification.other])) {\n\t\t\t\t\t\t\tio_rebasePropertyChangeSet[modification.other] = without(\n\t\t\t\t\t\t\t\tio_rebasePropertyChangeSet[modification.other],\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdelete io_rebasePropertyChangeSet[modification.other][key];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\"Rebase operation with conflicting ChangeSets. Probably incorrect bases.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Remove unnecessary entries from the ChangeSet\n\t\tthis._cleanIndexedCollectionChangeSet(io_rebasePropertyChangeSet, !isPrimitiveTypeid);\n\t};\n\n\t/**\n\t * Removes empty entries from the .children collection of the ChangeSet\n\t *\n\t * @param in_propertyChanges - The ChangeSet to clean up\n\t * @param in_containsTypeids - Does this ChangeSet contain typeids\n\t * @private\n\t */\n\texport const _cleanIndexedCollectionChangeSet = function (\n\t\tin_propertyChanges: SerializedChangeSet,\n\t\tin_containsTypeids: boolean,\n\t) {\n\t\tconst changes = in_propertyChanges;\n\t\t// Clean inserts\n\n\t\t// First remove unused typeid sections\n\t\tif (in_containsTypeids) {\n\t\t\tlet typeidList = Object.keys(changes.insert || {});\n\t\t\tfor (let j = 0; j < typeidList.length; j++) {\n\t\t\t\tif (_fastIsEmptyObject(changes.insert[typeidList[j]])) {\n\t\t\t\t\tdelete changes.insert[typeidList[j]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Remove add group if no operations are present\n\t\tif (_fastIsEmptyObject(changes.insert)) {\n\t\t\tdelete changes.insert;\n\t\t}\n\n\t\t// First remove unused typeid sections\n\t\tif (in_containsTypeids) {\n\t\t\tlet typeidList = Object.keys(changes.remove || {});\n\t\t\tfor (let j = 0; j < typeidList.length; j++) {\n\t\t\t\tif (_fastIsEmptyObject(changes.remove[typeidList[j]])) {\n\t\t\t\t\tdelete changes.remove[typeidList[j]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Remove remove group if no operations are present\n\t\tif (_fastIsEmptyObject(changes.remove)) {\n\t\t\tdelete changes.remove;\n\t\t}\n\n\t\t// Clean modifies\n\n\t\t// First remove unused typeid sections\n\t\tif (in_containsTypeids) {\n\t\t\tlet typeidList = Object.keys(changes.modify || {});\n\t\t\tfor (let j = 0; j < typeidList.length; j++) {\n\t\t\t\tconst modifies = changes.modify[typeidList[j]];\n\t\t\t\tconst modifyKeys = Object.keys(modifies);\n\t\t\t\tfor (let k = 0; k < modifyKeys.length; k++) {\n\t\t\t\t\tif (isEmptyChangeSet(modifies[modifyKeys[k]])) {\n\t\t\t\t\t\tdelete modifies[modifyKeys[k]];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (_fastIsEmptyObject(changes.modify[typeidList[j]])) {\n\t\t\t\t\tdelete changes.modify[typeidList[j]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Remove modify group if no operations are present\n\t\tif (_fastIsEmptyObject(changes.modify)) {\n\t\t\tdelete changes.modify;\n\t\t}\n\t};\n}\n"]}
|
package/dist/rebase.js
CHANGED
|
@@ -8,7 +8,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.rebaseToRemoteChanges = void 0;
|
|
11
|
-
const
|
|
11
|
+
const cloneDeep_js_1 = __importDefault(require("lodash/cloneDeep.js"));
|
|
12
12
|
const isEqual_js_1 = __importDefault(require("lodash/isEqual.js"));
|
|
13
13
|
const changeset_js_1 = require("./changeset.js");
|
|
14
14
|
class SyncPromise {
|
|
@@ -87,12 +87,12 @@ function rebaseToRemoteChanges(change, getUnrebasedChange, getRebasedChanges, is
|
|
|
87
87
|
let applyAfterMetaInformation;
|
|
88
88
|
if (alreadyRebasedChanges[0] !== undefined &&
|
|
89
89
|
alreadyRebasedChanges[0].guid === c.guid) {
|
|
90
|
-
const invertedChange = new changeset_js_1.ChangeSet((0,
|
|
90
|
+
const invertedChange = new changeset_js_1.ChangeSet((0, cloneDeep_js_1.default)(alreadyRebasedChanges[0].changeSet));
|
|
91
91
|
invertedChange.toInverseChangeSet();
|
|
92
92
|
invertedChange.applyChangeSet(rebaseBaseChangeSetForAlreadyRebasedChanges);
|
|
93
93
|
applyAfterMetaInformation = new Map();
|
|
94
94
|
const conflicts2 = [];
|
|
95
|
-
changeset = (0,
|
|
95
|
+
changeset = (0, cloneDeep_js_1.default)(alreadyRebasedChanges[0].changeSet);
|
|
96
96
|
rebaseBaseChangeSetForAlreadyRebasedChanges._rebaseChangeSet(changeset, conflicts2, {
|
|
97
97
|
applyAfterMetaInformation,
|
|
98
98
|
});
|
|
@@ -126,11 +126,11 @@ function rebaseToRemoteChanges(change, getUnrebasedChange, getRebasedChanges, is
|
|
|
126
126
|
let changeset = remoteChange.changeSet;
|
|
127
127
|
if (changesOnOtherLocalBranch[0] !== undefined &&
|
|
128
128
|
changesOnOtherLocalBranch[0].guid === remoteChange.guid) {
|
|
129
|
-
const invertedChange = new changeset_js_1.ChangeSet((0,
|
|
129
|
+
const invertedChange = new changeset_js_1.ChangeSet((0, cloneDeep_js_1.default)(changesOnOtherLocalBranch[0].changeSet));
|
|
130
130
|
invertedChange.toInverseChangeSet();
|
|
131
131
|
invertedChange.applyChangeSet(rebaseBaseChangeSet);
|
|
132
132
|
applyAfterMetaInformation = new Map();
|
|
133
|
-
changeset = (0,
|
|
133
|
+
changeset = (0, cloneDeep_js_1.default)(changesOnOtherLocalBranch[0].changeSet);
|
|
134
134
|
rebaseBaseChangeSet._rebaseChangeSet(changeset, conflicts, {
|
|
135
135
|
applyAfterMetaInformation,
|
|
136
136
|
});
|
|
@@ -155,7 +155,7 @@ exports.rebaseToRemoteChanges = rebaseToRemoteChanges;
|
|
|
155
155
|
function rebaseChangeArrays(baseChangeSet, changesToRebase) {
|
|
156
156
|
let rebaseBaseChangeSet = baseChangeSet;
|
|
157
157
|
for (const change of changesToRebase) {
|
|
158
|
-
const copiedChangeSet = new changeset_js_1.ChangeSet((0,
|
|
158
|
+
const copiedChangeSet = new changeset_js_1.ChangeSet((0, cloneDeep_js_1.default)(change.changeSet));
|
|
159
159
|
copiedChangeSet.toInverseChangeSet();
|
|
160
160
|
const conflicts = [];
|
|
161
161
|
change.rebaseMetaInformation = new Map();
|
package/dist/rebase.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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EAAE,SAAS,EAAE;YACjE,yBAAyB,EAAE,MAAM,CAAC,qBAAqB;SACvD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAhLD,sDAgLC;AAED,SAAS,kBAAkB,CAAC,aAAa,EAAE,eAAe;IACzD,IAAI,mBAAmB,GAAG,aAAa,CAAC;IACxC,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;QACtC,MAAM,eAAe,GAAG,IAAI,wBAAS,CAAC,IAAA,wBAAS,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QACnE,eAAe,CAAC,kBAAkB,EAAE,CAAC;QAErC,MAAM,SAAS,GAAG,EAAE,CAAC;QACrB,MAAM,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;QACzC,mBAAmB,CAAC,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE;YACjE,yBAAyB,EAAE,MAAM,CAAC,qBAAqB;SACvD,CAAC,CAAC;QAEH,eAAe,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;QACpD,eAAe,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE;YAChD,yBAAyB,EAAE,MAAM,CAAC,qBAAqB;SACvD,CAAC,CAAC;QACH,mBAAmB,GAAG,eAAe,CAAC;IACvC,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { copy as cloneDeep } from \"fastest-json-copy\";\nimport isEqual from \"lodash/isEqual.js\";\n\nimport { ChangeSet } from \"./changeset.js\";\n\nclass SyncPromise {\n\tvalue: any;\n\n\tconstructor(x: { value: any }) {\n\t\tif (!(this instanceof SyncPromise)) {\n\t\t\treturn new SyncPromise(x);\n\t\t}\n\t\tif (x instanceof SyncPromise) {\n\t\t\tx = x.value;\n\t\t}\n\t\tthis.value = x;\n\t}\n\n\tthen(fn: (arg0: any) => { value: any }): SyncPromise {\n\t\tthis.value = new SyncPromise(fn(this.value)).value;\n\t\treturn this;\n\t}\n}\n\nconst loop = (\n\tpromise: Promise<any>,\n\tfn: { (currentChange: any): any; (currentRebasedChange: any): any },\n\tmakePromise: (arg0: any) => any,\n) =>\n\tpromise\n\t\t.then(fn)\n\t\t.then((result) => (result === null ? result : loop(makePromise(result), fn, makePromise)));\n\n/**\n * @internal\n */\nexport function rebaseToRemoteChanges(\n\tchange: any,\n\tgetUnrebasedChange: any,\n\tgetRebasedChanges: any,\n\tisAsync: boolean = false,\n) {\n\tconst makePromise = isAsync ? Promise.resolve.bind(Promise) : (x) => new SyncPromise(x);\n\tlet mainPromise = makePromise();\n\n\tconst commitsOnOtherLocalBranch = {};\n\tlet rebaseBaseChangeSet = new ChangeSet({});\n\tconst changesOnOtherLocalBranch = [];\n\tif (change.referenceGuid !== change.remoteHeadGuid) {\n\t\t// Extract all changes between the remoteHeadGuid and the referenceGuid\n\t\tlet currentGuid = change.referenceGuid;\n\t\tmainPromise = loop(\n\t\t\tmakePromise(getUnrebasedChange(currentGuid)),\n\t\t\t(currentChange) => {\n\t\t\t\tif (currentChange === undefined) {\n\t\t\t\t\tthrow new Error(\"Received change that references a non-existing parent change\");\n\t\t\t\t}\n\t\t\t\tchangesOnOtherLocalBranch.unshift(currentChange);\n\t\t\t\tcommitsOnOtherLocalBranch[currentGuid] = currentChange;\n\t\t\t\tif (currentGuid === change.localBranchStart) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tcurrentGuid = currentChange.referenceGuid;\n\t\t\t\treturn getUnrebasedChange(currentGuid);\n\t\t\t},\n\t\t\tmakePromise,\n\t\t);\n\n\t\t// Now we extract all changes until we arrive at a change that is relative to a remote change\n\t\tconst alreadyRebasedChanges = [];\n\n\t\tmainPromise = mainPromise.then(() =>\n\t\t\tloop(\n\t\t\t\tmakePromise(getUnrebasedChange(change.localBranchStart)),\n\t\t\t\t(currentRebasedChange) => {\n\t\t\t\t\tif (currentRebasedChange.remoteHeadGuid === currentRebasedChange.referenceGuid) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\treturn makePromise(getUnrebasedChange(currentRebasedChange.referenceGuid)).then(\n\t\t\t\t\t\t(rebaseChange) => {\n\t\t\t\t\t\t\talreadyRebasedChanges.unshift(rebaseChange);\n\t\t\t\t\t\t\tif (rebaseChange === undefined) {\n\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t\"Received change that references a non-existing parent change\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn rebaseChange;\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tmakePromise,\n\t\t\t),\n\t\t);\n\n\t\t// Compute the base Changeset to rebase the changes on the branch that was still the local branch\n\t\t// when the incoming change was created\n\n\t\tmainPromise = mainPromise\n\t\t\t.then(() => {\n\t\t\t\t// First invert all changes on the previous local branch\n\t\t\t\tconst startGuid =\n\t\t\t\t\talreadyRebasedChanges.length > 0\n\t\t\t\t\t\t? alreadyRebasedChanges[0].referenceGuid\n\t\t\t\t\t\t: changesOnOtherLocalBranch[0].referenceGuid;\n\n\t\t\t\t// Then apply all changes on the local remote branch\n\t\t\t\tconst endGuid = change.remoteHeadGuid;\n\t\t\t\treturn getRebasedChanges(startGuid, endGuid);\n\t\t\t})\n\t\t\t.then((relevantRemoteChanges) => {\n\t\t\t\tlet rebaseBaseChangeSetForAlreadyRebasedChanges = new ChangeSet({});\n\n\t\t\t\tif (relevantRemoteChanges.length > 0) {\n\t\t\t\t\tfor (const c of relevantRemoteChanges) {\n\t\t\t\t\t\tlet changeset = c.changeSet;\n\t\t\t\t\t\tlet applyAfterMetaInformation;\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\talreadyRebasedChanges[0] !== undefined &&\n\t\t\t\t\t\t\talreadyRebasedChanges[0].guid === c.guid\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst invertedChange = new ChangeSet(\n\t\t\t\t\t\t\t\tcloneDeep(alreadyRebasedChanges[0].changeSet),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tinvertedChange.toInverseChangeSet();\n\t\t\t\t\t\t\tinvertedChange.applyChangeSet(rebaseBaseChangeSetForAlreadyRebasedChanges);\n\t\t\t\t\t\t\tapplyAfterMetaInformation = new Map();\n\t\t\t\t\t\t\tconst conflicts2 = [];\n\t\t\t\t\t\t\tchangeset = cloneDeep(alreadyRebasedChanges[0].changeSet);\n\t\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges._rebaseChangeSet(\n\t\t\t\t\t\t\t\tchangeset,\n\t\t\t\t\t\t\t\tconflicts2,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tapplyAfterMetaInformation,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges = invertedChange;\n\t\t\t\t\t\t\talreadyRebasedChanges.shift();\n\t\t\t\t\t\t}\n\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges.applyChangeSet(changeset, {\n\t\t\t\t\t\t\tapplyAfterMetaInformation,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t// Now we have to rebase all changes from the remote local branch with respect to this base changeset\n\t\t\t\t\trebaseChangeArrays(\n\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges,\n\t\t\t\t\t\tchangesOnOtherLocalBranch,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Update the reference for the rebased changes to indicate that they are now with respect to the\n\t\t\t\t// new remoteHeadGuid\n\t\t\t\tif (changesOnOtherLocalBranch.length > 0) {\n\t\t\t\t\tchangesOnOtherLocalBranch[0].remoteHeadGuid = change.remoteHeadGuid;\n\t\t\t\t\tchangesOnOtherLocalBranch[0].referenceGuid = change.remoteHeadGuid;\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\treturn mainPromise\n\t\t.then(() => makePromise(getRebasedChanges(change.remoteHeadGuid)))\n\t\t.then((remoteChanges) => {\n\t\t\tconst conflicts = [];\n\t\t\tif (\n\t\t\t\t!isEqual(\n\t\t\t\t\tchangesOnOtherLocalBranch.map((change) => change.guid),\n\t\t\t\t\tremoteChanges.map((change) => change.guid),\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tfor (const remoteChange of remoteChanges) {\n\t\t\t\t\tlet applyAfterMetaInformation =\n\t\t\t\t\t\tcommitsOnOtherLocalBranch[remoteChange.guid] !== undefined\n\t\t\t\t\t\t\t? remoteChange.rebaseMetaInformation\n\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\tlet changeset = remoteChange.changeSet;\n\t\t\t\t\tif (\n\t\t\t\t\t\tchangesOnOtherLocalBranch[0] !== undefined &&\n\t\t\t\t\t\tchangesOnOtherLocalBranch[0].guid === remoteChange.guid\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst invertedChange = new ChangeSet(\n\t\t\t\t\t\t\tcloneDeep(changesOnOtherLocalBranch[0].changeSet),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tinvertedChange.toInverseChangeSet();\n\t\t\t\t\t\tinvertedChange.applyChangeSet(rebaseBaseChangeSet);\n\n\t\t\t\t\t\tapplyAfterMetaInformation = new Map();\n\t\t\t\t\t\tchangeset = cloneDeep(changesOnOtherLocalBranch[0].changeSet);\n\t\t\t\t\t\trebaseBaseChangeSet._rebaseChangeSet(changeset, conflicts, {\n\t\t\t\t\t\t\tapplyAfterMetaInformation,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// This is disabled for performance reasons. Only used during debugging\n\t\t\t\t\t\t// assert(isEqual(changeset,this.remoteChanges[i].changeSet),\n\t\t\t\t\t\t// \"Failed Rebase in rebaseToRemoteChanges\");\n\t\t\t\t\t\trebaseBaseChangeSet = invertedChange;\n\t\t\t\t\t\tchangesOnOtherLocalBranch.shift();\n\t\t\t\t\t}\n\n\t\t\t\t\trebaseBaseChangeSet.applyChangeSet(changeset, {\n\t\t\t\t\t\tapplyAfterMetaInformation,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tchange.rebaseMetaInformation = new Map();\n\t\t\trebaseBaseChangeSet._rebaseChangeSet(change.changeSet, conflicts, {\n\t\t\t\tapplyAfterMetaInformation: change.rebaseMetaInformation,\n\t\t\t});\n\t\t});\n}\n\nfunction rebaseChangeArrays(baseChangeSet, changesToRebase) {\n\tlet rebaseBaseChangeSet = baseChangeSet;\n\tfor (const change of changesToRebase) {\n\t\tconst copiedChangeSet = new ChangeSet(cloneDeep(change.changeSet));\n\t\tcopiedChangeSet.toInverseChangeSet();\n\n\t\tconst conflicts = [];\n\t\tchange.rebaseMetaInformation = new Map();\n\t\trebaseBaseChangeSet._rebaseChangeSet(change.changeSet, conflicts, {\n\t\t\tapplyAfterMetaInformation: change.rebaseMetaInformation,\n\t\t});\n\n\t\tcopiedChangeSet.applyChangeSet(rebaseBaseChangeSet);\n\t\tcopiedChangeSet.applyChangeSet(change.changeSet, {\n\t\t\tapplyAfterMetaInformation: change.rebaseMetaInformation,\n\t\t});\n\t\trebaseBaseChangeSet = copiedChangeSet;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rebase.js","sourceRoot":"","sources":["../src/rebase.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,uEAA4C;AAC5C,mEAAwC;AAExC,iDAA2C;AAE3C,MAAM,WAAW;IAGhB,YAAY,CAAiB;QAC5B,IAAI,CAAC,CAAC,IAAI,YAAY,WAAW,CAAC,EAAE,CAAC;YACpC,OAAO,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC;QACD,IAAI,CAAC,YAAY,WAAW,EAAE,CAAC;YAC9B,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;QACb,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IAChB,CAAC;IAED,IAAI,CAA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,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;QACzC,mBAAmB,CAAC,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE;YACjE,yBAAyB,EAAE,MAAM,CAAC,qBAAqB;SACvD,CAAC,CAAC;QAEH,eAAe,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;QACpD,eAAe,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE;YAChD,yBAAyB,EAAE,MAAM,CAAC,qBAAqB;SACvD,CAAC,CAAC;QACH,mBAAmB,GAAG,eAAe,CAAC;IACvC,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport cloneDeep from \"lodash/cloneDeep.js\";\nimport isEqual from \"lodash/isEqual.js\";\n\nimport { ChangeSet } from \"./changeset.js\";\n\nclass SyncPromise {\n\tvalue: any;\n\n\tconstructor(x: { value: any }) {\n\t\tif (!(this instanceof SyncPromise)) {\n\t\t\treturn new SyncPromise(x);\n\t\t}\n\t\tif (x instanceof SyncPromise) {\n\t\t\tx = x.value;\n\t\t}\n\t\tthis.value = x;\n\t}\n\n\tthen(fn: (arg0: any) => { value: any }): SyncPromise {\n\t\tthis.value = new SyncPromise(fn(this.value)).value;\n\t\treturn this;\n\t}\n}\n\nconst loop = (\n\tpromise: Promise<any>,\n\tfn: { (currentChange: any): any; (currentRebasedChange: any): any },\n\tmakePromise: (arg0: any) => any,\n) =>\n\tpromise\n\t\t.then(fn)\n\t\t.then((result) => (result === null ? result : loop(makePromise(result), fn, makePromise)));\n\n/**\n * @internal\n */\nexport function rebaseToRemoteChanges(\n\tchange: any,\n\tgetUnrebasedChange: any,\n\tgetRebasedChanges: any,\n\tisAsync: boolean = false,\n) {\n\tconst makePromise = isAsync ? Promise.resolve.bind(Promise) : (x) => new SyncPromise(x);\n\tlet mainPromise = makePromise();\n\n\tconst commitsOnOtherLocalBranch = {};\n\tlet rebaseBaseChangeSet = new ChangeSet({});\n\tconst changesOnOtherLocalBranch = [];\n\tif (change.referenceGuid !== change.remoteHeadGuid) {\n\t\t// Extract all changes between the remoteHeadGuid and the referenceGuid\n\t\tlet currentGuid = change.referenceGuid;\n\t\tmainPromise = loop(\n\t\t\tmakePromise(getUnrebasedChange(currentGuid)),\n\t\t\t(currentChange) => {\n\t\t\t\tif (currentChange === undefined) {\n\t\t\t\t\tthrow new Error(\"Received change that references a non-existing parent change\");\n\t\t\t\t}\n\t\t\t\tchangesOnOtherLocalBranch.unshift(currentChange);\n\t\t\t\tcommitsOnOtherLocalBranch[currentGuid] = currentChange;\n\t\t\t\tif (currentGuid === change.localBranchStart) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tcurrentGuid = currentChange.referenceGuid;\n\t\t\t\treturn getUnrebasedChange(currentGuid);\n\t\t\t},\n\t\t\tmakePromise,\n\t\t);\n\n\t\t// Now we extract all changes until we arrive at a change that is relative to a remote change\n\t\tconst alreadyRebasedChanges = [];\n\n\t\tmainPromise = mainPromise.then(() =>\n\t\t\tloop(\n\t\t\t\tmakePromise(getUnrebasedChange(change.localBranchStart)),\n\t\t\t\t(currentRebasedChange) => {\n\t\t\t\t\tif (currentRebasedChange.remoteHeadGuid === currentRebasedChange.referenceGuid) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\treturn makePromise(getUnrebasedChange(currentRebasedChange.referenceGuid)).then(\n\t\t\t\t\t\t(rebaseChange) => {\n\t\t\t\t\t\t\talreadyRebasedChanges.unshift(rebaseChange);\n\t\t\t\t\t\t\tif (rebaseChange === undefined) {\n\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t\"Received change that references a non-existing parent change\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn rebaseChange;\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tmakePromise,\n\t\t\t),\n\t\t);\n\n\t\t// Compute the base Changeset to rebase the changes on the branch that was still the local branch\n\t\t// when the incoming change was created\n\n\t\tmainPromise = mainPromise\n\t\t\t.then(() => {\n\t\t\t\t// First invert all changes on the previous local branch\n\t\t\t\tconst startGuid =\n\t\t\t\t\talreadyRebasedChanges.length > 0\n\t\t\t\t\t\t? alreadyRebasedChanges[0].referenceGuid\n\t\t\t\t\t\t: changesOnOtherLocalBranch[0].referenceGuid;\n\n\t\t\t\t// Then apply all changes on the local remote branch\n\t\t\t\tconst endGuid = change.remoteHeadGuid;\n\t\t\t\treturn getRebasedChanges(startGuid, endGuid);\n\t\t\t})\n\t\t\t.then((relevantRemoteChanges) => {\n\t\t\t\tlet rebaseBaseChangeSetForAlreadyRebasedChanges = new ChangeSet({});\n\n\t\t\t\tif (relevantRemoteChanges.length > 0) {\n\t\t\t\t\tfor (const c of relevantRemoteChanges) {\n\t\t\t\t\t\tlet changeset = c.changeSet;\n\t\t\t\t\t\tlet applyAfterMetaInformation;\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\talreadyRebasedChanges[0] !== undefined &&\n\t\t\t\t\t\t\talreadyRebasedChanges[0].guid === c.guid\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst invertedChange = new ChangeSet(\n\t\t\t\t\t\t\t\tcloneDeep(alreadyRebasedChanges[0].changeSet),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tinvertedChange.toInverseChangeSet();\n\t\t\t\t\t\t\tinvertedChange.applyChangeSet(rebaseBaseChangeSetForAlreadyRebasedChanges);\n\t\t\t\t\t\t\tapplyAfterMetaInformation = new Map();\n\t\t\t\t\t\t\tconst conflicts2 = [];\n\t\t\t\t\t\t\tchangeset = cloneDeep(alreadyRebasedChanges[0].changeSet);\n\t\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges._rebaseChangeSet(\n\t\t\t\t\t\t\t\tchangeset,\n\t\t\t\t\t\t\t\tconflicts2,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tapplyAfterMetaInformation,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges = invertedChange;\n\t\t\t\t\t\t\talreadyRebasedChanges.shift();\n\t\t\t\t\t\t}\n\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges.applyChangeSet(changeset, {\n\t\t\t\t\t\t\tapplyAfterMetaInformation,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t// Now we have to rebase all changes from the remote local branch with respect to this base changeset\n\t\t\t\t\trebaseChangeArrays(\n\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges,\n\t\t\t\t\t\tchangesOnOtherLocalBranch,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Update the reference for the rebased changes to indicate that they are now with respect to the\n\t\t\t\t// new remoteHeadGuid\n\t\t\t\tif (changesOnOtherLocalBranch.length > 0) {\n\t\t\t\t\tchangesOnOtherLocalBranch[0].remoteHeadGuid = change.remoteHeadGuid;\n\t\t\t\t\tchangesOnOtherLocalBranch[0].referenceGuid = change.remoteHeadGuid;\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\treturn mainPromise\n\t\t.then(() => makePromise(getRebasedChanges(change.remoteHeadGuid)))\n\t\t.then((remoteChanges) => {\n\t\t\tconst conflicts = [];\n\t\t\tif (\n\t\t\t\t!isEqual(\n\t\t\t\t\tchangesOnOtherLocalBranch.map((change) => change.guid),\n\t\t\t\t\tremoteChanges.map((change) => change.guid),\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tfor (const remoteChange of remoteChanges) {\n\t\t\t\t\tlet applyAfterMetaInformation =\n\t\t\t\t\t\tcommitsOnOtherLocalBranch[remoteChange.guid] !== undefined\n\t\t\t\t\t\t\t? remoteChange.rebaseMetaInformation\n\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\tlet changeset = remoteChange.changeSet;\n\t\t\t\t\tif (\n\t\t\t\t\t\tchangesOnOtherLocalBranch[0] !== undefined &&\n\t\t\t\t\t\tchangesOnOtherLocalBranch[0].guid === remoteChange.guid\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst invertedChange = new ChangeSet(\n\t\t\t\t\t\t\tcloneDeep(changesOnOtherLocalBranch[0].changeSet),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tinvertedChange.toInverseChangeSet();\n\t\t\t\t\t\tinvertedChange.applyChangeSet(rebaseBaseChangeSet);\n\n\t\t\t\t\t\tapplyAfterMetaInformation = new Map();\n\t\t\t\t\t\tchangeset = cloneDeep(changesOnOtherLocalBranch[0].changeSet);\n\t\t\t\t\t\trebaseBaseChangeSet._rebaseChangeSet(changeset, conflicts, {\n\t\t\t\t\t\t\tapplyAfterMetaInformation,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// This is disabled for performance reasons. Only used during debugging\n\t\t\t\t\t\t// assert(isEqual(changeset,this.remoteChanges[i].changeSet),\n\t\t\t\t\t\t// \"Failed Rebase in rebaseToRemoteChanges\");\n\t\t\t\t\t\trebaseBaseChangeSet = invertedChange;\n\t\t\t\t\t\tchangesOnOtherLocalBranch.shift();\n\t\t\t\t\t}\n\n\t\t\t\t\trebaseBaseChangeSet.applyChangeSet(changeset, {\n\t\t\t\t\t\tapplyAfterMetaInformation,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tchange.rebaseMetaInformation = new Map();\n\t\t\trebaseBaseChangeSet._rebaseChangeSet(change.changeSet, conflicts, {\n\t\t\t\tapplyAfterMetaInformation: change.rebaseMetaInformation,\n\t\t\t});\n\t\t});\n}\n\nfunction rebaseChangeArrays(baseChangeSet, changesToRebase) {\n\tlet rebaseBaseChangeSet = baseChangeSet;\n\tfor (const change of changesToRebase) {\n\t\tconst copiedChangeSet = new ChangeSet(cloneDeep(change.changeSet));\n\t\tcopiedChangeSet.toInverseChangeSet();\n\n\t\tconst conflicts = [];\n\t\tchange.rebaseMetaInformation = new Map();\n\t\trebaseBaseChangeSet._rebaseChangeSet(change.changeSet, conflicts, {\n\t\t\tapplyAfterMetaInformation: change.rebaseMetaInformation,\n\t\t});\n\n\t\tcopiedChangeSet.applyChangeSet(rebaseBaseChangeSet);\n\t\tcopiedChangeSet.applyChangeSet(change.changeSet, {\n\t\t\tapplyAfterMetaInformation: change.rebaseMetaInformation,\n\t\t});\n\t\trebaseBaseChangeSet = copiedChangeSet;\n\t}\n}\n"]}
|
|
@@ -17,7 +17,7 @@ exports.TemplateValidator = void 0;
|
|
|
17
17
|
/* eslint-disable jsdoc/check-line-alignment */
|
|
18
18
|
const property_common_1 = require("@fluid-experimental/property-common");
|
|
19
19
|
const async_1 = require("async");
|
|
20
|
-
const
|
|
20
|
+
const cloneDeep_js_1 = __importDefault(require("lodash/cloneDeep.js"));
|
|
21
21
|
const difference_js_1 = __importDefault(require("lodash/difference.js"));
|
|
22
22
|
const each_js_1 = __importDefault(require("lodash/each.js"));
|
|
23
23
|
const every_js_1 = __importDefault(require("lodash/every.js"));
|
|
@@ -716,7 +716,7 @@ const _processValidationResults = function (in_template) {
|
|
|
716
716
|
break;
|
|
717
717
|
}
|
|
718
718
|
// Deep-copy for thread-safety.
|
|
719
|
-
that._resultBuilder.addError((0,
|
|
719
|
+
that._resultBuilder.addError((0, cloneDeep_js_1.default)(error));
|
|
720
720
|
});
|
|
721
721
|
}
|
|
722
722
|
result.unresolvedTypes = _unresolvedTypes.call(this, in_template);
|