@fluid-experimental/property-changeset 0.59.2001 → 0.59.3000

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/changeset.d.ts.map +1 -1
  2. package/dist/changeset.js +50 -50
  3. package/dist/changeset.js.map +1 -1
  4. package/dist/changeset_operations/array.d.ts.map +1 -1
  5. package/dist/changeset_operations/array.js +22 -22
  6. package/dist/changeset_operations/array.js.map +1 -1
  7. package/dist/changeset_operations/arrayChangesetIterator.d.ts.map +1 -1
  8. package/dist/changeset_operations/arrayChangesetIterator.js +3 -3
  9. package/dist/changeset_operations/arrayChangesetIterator.js.map +1 -1
  10. package/dist/changeset_operations/indexedCollection.js +21 -21
  11. package/dist/changeset_operations/indexedCollection.js.map +1 -1
  12. package/dist/changeset_operations/isEmptyChangeset.js +2 -2
  13. package/dist/changeset_operations/isEmptyChangeset.js.map +1 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/pathHelper.js.map +1 -1
  17. package/dist/rebase.js +6 -6
  18. package/dist/rebase.js.map +1 -1
  19. package/dist/templateSchema.d.ts.map +1 -1
  20. package/dist/templateSchema.js +1 -0
  21. package/dist/templateSchema.js.map +1 -1
  22. package/dist/templateValidator.d.ts.map +1 -1
  23. package/dist/templateValidator.js +32 -32
  24. package/dist/templateValidator.js.map +1 -1
  25. package/dist/test/array.spec.js +40 -40
  26. package/dist/test/array.spec.js.map +1 -1
  27. package/dist/test/pathHelper.spec.js +147 -147
  28. package/dist/test/pathHelper.spec.js.map +1 -1
  29. package/dist/test/reversibleCs.spec.js +2 -2
  30. package/dist/test/reversibleCs.spec.js.map +1 -1
  31. package/dist/test/tsconfig.tsbuildinfo +1 -1660
  32. package/dist/test/validator/templateSyntax.spec.js +29 -29
  33. package/dist/test/validator/templateSyntax.spec.js.map +1 -1
  34. package/dist/test/validator/templateValidator.spec.js +202 -202
  35. package/dist/test/validator/templateValidator.spec.js.map +1 -1
  36. package/dist/test/validator/typeidHelper.spec.js +39 -39
  37. package/dist/test/validator/typeidHelper.spec.js.map +1 -1
  38. package/dist/utils.d.ts.map +1 -1
  39. package/dist/utils.js +41 -41
  40. package/dist/utils.js.map +1 -1
  41. package/lib/changeset.js.map +1 -1
  42. package/lib/changeset_operations/array.js.map +1 -1
  43. package/lib/changeset_operations/arrayChangesetIterator.js.map +1 -1
  44. package/lib/changeset_operations/indexedCollection.js.map +1 -1
  45. package/lib/index.js.map +1 -1
  46. package/lib/pathHelper.js.map +1 -1
  47. package/lib/rebase.js.map +1 -1
  48. package/lib/templateSchema.js +1 -0
  49. package/lib/templateSchema.js.map +1 -1
  50. package/lib/templateValidator.js +1 -1
  51. package/lib/templateValidator.js.map +1 -1
  52. package/lib/utils.js.map +1 -1
  53. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"indexedCollection.js","sourceRoot":"","sources":["../../src/changeset_operations/indexedCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;;;;AAEF,yDAAoD;AACpD,6DAAqC;AACrC,6DAAqC;AACrC,+DAAuC;AACvC,6DAAqC;AACrC,+DAAuC;AAExC,aAAa;AACb,yEAA2E;AAE3E,0DAAuD;AACvD,8CAA2C;AAC3C,qEAAwD;AACxD,yDAAsD;AAEtD,MAAM,EAAE,uBAAuB,EAAE,GAAG,EAAE,GAAG,2BAAS,CAAC;AAEnD;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,MAAM,kBAAkB,GAAG,UAAS,SAAc;IAC9C,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,kBAAQ,CAAC,SAAS,CAAC,EAAE;QAChE,OAAO,iBAAO,CAAC,SAAS,CAAC,CAAC;KAC7B;IAED,wCAAwC;IACxC,KAAK,MAAM,MAAM,IAAI,SAAS,EAAE;QAC5B,OAAO,KAAK,CAAC;KAChB;IAED,OAAO,IAAI,C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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;gBACxC,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;oBACxC,IAAI,mCAAgB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;wBAC3C,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;qBAClC;iBACJ;gBACD,IAAI,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;oBACnD,OAAO,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;iBACxC;aACJ;SACJ;QAED,mDAAmD;QACnD,IAAI,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACpC,OAAO,OAAO,CAAC,MAAM,CAAC;SACzB;IACL,CAAC,CAAC;AACN,CAAC,EA/vBgB,mCAAmC,GAAnC,2CAAmC,KAAnC,2CAAmC,QA+vBnD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Helper functions and classes to work with ChangeSets with indexed collections (sets and maps)\n */\n\n import {copy as cloneDeep} from \"fastest-json-copy\";\n import isEmpty from \"lodash/isEmpty\";\n import isEqual from \"lodash/isEqual\";\n import isObject from \"lodash/isObject\";\n import without from \"lodash/without\";\n import includes from \"lodash/includes\";\n\n// @ts-ignore\nimport { constants, joinPaths } from \"@fluid-experimental/property-common\";\nimport { ApplyChangeSetOptions, ConflictInfo, SerializedChangeSet } from \"../changeset\";\nimport { TypeIdHelper } from \"../helpers/typeidHelper\";\nimport { PathHelper } from \"../pathHelper\";\nimport { ConflictType } from \"./changesetConflictTypes\";\nimport { isEmptyChangeSet } from \"./isEmptyChangeset\";\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 if (!in_object || Array.isArray(in_object) || !isObject(in_object)) {\n return isEmpty(in_object);\n }\n\n // eslint-disable-next-line guard-for-in\n for (const _entry in in_object) {\n return false;\n }\n\n return true;\n};\n\nexport namespace ChangeSetIndexedCollectionFunctions {\n /**\n * Applies a ChangeSet to a given indexed collection property (recursively). The ChangeSet is assumed to be relative\n * to the same property root and it will be applied behind the base ChangeSet (assuming that the changes are\n * relative to the state after the base ChangeSet has been applied. It will change the base ChangeSet.\n *\n * @param io_basePropertyChanges - The ChangeSet describing the initial state\n * @param in_appliedPropertyChanges - The ChangeSet to apply to this state\n * @param in_typeid - The typeid of the contents collection\n * (without the collection type)\n * @param in_options - Optional additional parameters\n * @param in_options.applyAfterMetaInformation - Additional meta information which help later to obtain\n * more compact changeset during the apply operation\n *\n * @private\n */\n export const _performApplyAfterOnPropertyIndexedCollection = function(\n io_basePropertyChanges: SerializedChangeSet, // eslint-disable-line complexity\n in_appliedPropertyChanges: SerializedChangeSet,\n in_typeid: string,\n in_options: ApplyChangeSetOptions) {\n const isPrimitiveTypeid = TypeIdHelper.isPrimitiveType(in_typeid);\n\n // Handle remove entry operations\n if (in_appliedPropertyChanges.remove) {\n // Get and initialize the corresponding entries in the existing collection\n let removedEntries = in_appliedPropertyChanges.remove;\n\n io_basePropertyChanges = io_basePropertyChanges || {};\n io_basePropertyChanges.remove = io_basePropertyChanges.remove ||\n (Array.isArray(in_appliedPropertyChanges.remove) ? [] : {});\n let baseInserted = io_basePropertyChanges.insert || {};\n let baseRemoved = io_basePropertyChanges.remove;\n let baseModified = io_basePropertyChanges.modify;\n let done = false;\n\n if (!Array.isArray(removedEntries)) {\n if (isPrimitiveTypeid) {\n removedEntries = Object.keys(removedEntries);\n } else {\n // this is a reversible change set of templated types\n const removedTypes = Object.keys(removedEntries);\n for (let t = 0; t < removedTypes.length; t++) {\n const removedKeys = Object.keys(removedEntries[removedTypes[t]]);\n for (let i = 0; i < removedKeys.length; i++) {\n if (baseInserted[removedTypes[t]] &&\n baseInserted[removedTypes[t]][removedKeys[i]] !== undefined) {\n delete baseInserted[removedTypes[t]][removedKeys[i]];\n\n // If all entries for a typeid have been removed, we can remove\n // the whole typeid from the inserted section\n if (baseInserted && isEmpty(baseInserted[removedTypes[t]])) {\n delete baseInserted[removedTypes[t]];\n }\n } else {\n if (baseModified && baseModified[removedTypes[t]] &&\n baseModified[removedTypes[t]][removedKeys[i]] !== undefined) {\n delete baseModified[removedTypes[t]][removedKeys[i]];\n\n // If all entries for a typeid have been removed, we can remove\n // the whole typeid from the inserted section\n if (baseModified && isEmpty(baseModified[removedTypes[t]])) {\n delete baseModified[removedTypes[t]];\n }\n }\n if (Array.isArray(baseRemoved)) {\n baseRemoved.push(removedKeys[i]);\n } else {\n if (!baseRemoved[removedTypes[t]]) {\n baseRemoved[removedTypes[t]] = {};\n }\n baseRemoved[removedTypes[t]][removedKeys[i]] = removedEntries[removedTypes[t]][removedKeys[i]];\n }\n }\n }\n }\n done = true;\n }\n }\n\n if (!done) {\n if (isPrimitiveTypeid) {\n for (let i = 0; i < removedEntries.length; i++) {\n let key = removedEntries[i];\n\n // If there is an insert for this key, we just remove it\n if (baseInserted[key] !== undefined) {\n delete baseInserted[key];\n } else {\n // There could be a modify entry for this key, which we have to remove\n if (baseModified && baseModified[key] !== undefined) {\n delete baseModified[key];\n }\n\n // Otherwise we add it to the remove list\n if (Array.isArray(baseRemoved)) {\n baseRemoved.push(key);\n } else {\n baseRemoved[key] = in_appliedPropertyChanges.remove[key];\n }\n }\n }\n } else {\n const baseInsertedTypeids = Object.keys(baseInserted);\n for (let i = 0; i < removedEntries.length; i++) {\n let key = removedEntries[i];\n let foundInTypeid;\n\n // Since we only have a flat remove list (without typeid) in the changeset, we have\n // to check all inserts\n for (let j = 0; j < baseInsertedTypeids.length; j++) {\n if (baseInserted[baseInsertedTypeids[j]] &&\n baseInserted[baseInsertedTypeids[j]][key] !== undefined) {\n foundInTypeid = baseInsertedTypeids[j];\n break;\n }\n }\n\n if (foundInTypeid) {\n // If this key was inserted by this ChangeSet, we just remove it from the inserted list\n delete baseInserted[foundInTypeid][key];\n\n // If all entries for a typeid have been removed, we can remove\n // the whole typeid from the inserted or modified section\n if (baseInserted && isEmpty(baseInserted[foundInTypeid])) {\n delete baseInserted[foundInTypeid];\n }\n if (baseModified && isEmpty(baseModified[foundInTypeid])) {\n delete baseModified[foundInTypeid];\n }\n } else {\n // There could be a modify entry for this key, which we have to remove\n const baseModifiedTypeids = Object.keys(baseModified || {});\n for (let j = 0; j < baseModifiedTypeids.length; j++) {\n if (baseModified[baseModifiedTypeids[j]][key]) {\n foundInTypeid = baseModifiedTypeids[j];\n delete baseModified[foundInTypeid][key];\n break;\n }\n }\n\n // Otherwise we add it to the remove list\n baseRemoved.push(key);\n }\n }\n }\n }\n }\n\n // Apply insert operations\n if (in_appliedPropertyChanges.insert) {\n // Get and initialize the corresponding entries from the existing collection\n io_basePropertyChanges = io_basePropertyChanges || {};\n io_basePropertyChanges.insert = io_basePropertyChanges.insert || {};\n let baseInserted = io_basePropertyChanges.insert;\n let baseRemoved = io_basePropertyChanges.remove;\n\n // Insert the inserted entries\n\n // If no typeids are included, we just use a placeholder for the iteration below\n const insertedTypeids = isPrimitiveTypeid ? [undefined] : Object.keys(in_appliedPropertyChanges.insert);\n for (let i = 0; i < insertedTypeids.length; i++) {\n let typeid = insertedTypeids[i];\n const insertedEntries = isPrimitiveTypeid ?\n in_appliedPropertyChanges.insert : in_appliedPropertyChanges.insert[typeid];\n const insertedKeys = Object.keys(insertedEntries);\n let removalCS;\n if (baseRemoved) {\n removalCS = isPrimitiveTypeid ? baseRemoved : baseRemoved[typeid];\n }\n for (let j = 0; j < insertedKeys.length; j++) {\n let key = insertedKeys[j];\n let deeplyEqualCS = false;\n\n // If we have a complex type in the collection, we need to do a deep comparison of the two\n // ChangeSets to determine, whether they are equal\n // TODO: We should actually compute a diff between the two and recursively convert portions to modifies\n // Instead, right now, we only handle the case where the two keys cancel each out perfectly, i.e.,\n // the insert is reinserting exactly what was removed.\n if (!isPrimitiveTypeid && removalCS && isObject(removalCS) && removalCS[key] !== undefined) {\n // Split out the two parts: all the keys other than remove/insert should match exactly.\n // The contents 'remove' and 'insert', if they exist, should also match.\n deeplyEqualCS = !!insertedEntries[key].insert === !!removalCS[key].remove;\n\n // If there are 'insert' and 'remove', see if the removed data matches the inserted data\n if (deeplyEqualCS && insertedEntries[key].insert) {\n deeplyEqualCS = isEqual(\n insertedEntries[key].insert,\n removalCS[key].remove,\n );\n }\n\n // Finally, check if the data being inserted matches the data that was removed\n const insertedEntry = isObject(insertedEntries[key]) ? without(insertedEntries[key], \"insert\") : insertedEntries[key];\n const removedEntry = isObject(removalCS[key]) ? without(removalCS[key], \"remove\") : removalCS[key];\n deeplyEqualCS = deeplyEqualCS && isEqual(insertedEntry, removedEntry);\n }\n\n if ((isPrimitiveTypeid || TypeIdHelper.isPrimitiveType(typeid) || deeplyEqualCS) &&\n removalCS &&\n ((Array.isArray(removalCS) && includes(baseRemoved, key)) || removalCS[key] !== undefined)) {\n // A remove and insert are combined into a modify for primitive types\n\n // Remove the old remove command\n let oldValueMatches = false;\n if (Array.isArray(removalCS)) {\n if (isPrimitiveTypeid) {\n io_basePropertyChanges.remove = without(io_basePropertyChanges.remove, key);\n } else {\n io_basePropertyChanges.remove[typeid] = without(io_basePropertyChanges.remove[typeid], key);\n }\n } else {\n oldValueMatches = deeplyEqualCS || (removalCS[key] === insertedEntries[key]);\n delete removalCS[key];\n }\n\n // Insert a modify command instead\n if (!oldValueMatches) {\n io_basePropertyChanges.modify = io_basePropertyChanges.modify || {};\n if (isPrimitiveTypeid) {\n io_basePropertyChanges.modify[key] = insertedEntries[key];\n } else {\n io_basePropertyChanges.modify[typeid] = io_basePropertyChanges.modify[typeid] || {};\n io_basePropertyChanges.modify[typeid][key] = cloneDeep(insertedEntries[key]);\n }\n }\n } else if (isPrimitiveTypeid && baseInserted[key] === undefined) {\n baseInserted[key] = insertedEntries[key];\n } else if (!isPrimitiveTypeid && (!baseInserted[typeid] || baseInserted[typeid][key] === undefined)) {\n baseInserted[typeid] = baseInserted[typeid] || {};\n baseInserted[typeid][key] = cloneDeep(insertedEntries[key]);\n } else {\n throw new Error(MSG.ALREADY_EXISTING_ENTRY + key);\n }\n }\n }\n }\n\n // Handle modification operations\n if (in_appliedPropertyChanges.modify) {\n // Get and initialize the corresponding entries from the existing collection\n const modifiedEntries = in_appliedPropertyChanges.modify;\n io_basePropertyChanges = io_basePropertyChanges || {};\n io_basePropertyChanges.modify = io_basePropertyChanges.modify || {};\n let baseModified = io_basePropertyChanges.modify;\n let baseInserted = io_basePropertyChanges.insert || {};\n\n // Process the modifications\n\n // If no typeids are included, we just use a placeholder for the iteration below\n const modifiedTypeids = isPrimitiveTypeid ? [undefined] : Object.keys(modifiedEntries);\n for (let i = 0; i < modifiedTypeids.length; i++) {\n let typeid = modifiedTypeids[i];\n\n const modifyKeys = Object.keys(isPrimitiveTypeid ? modifiedEntries : modifiedEntries[typeid]);\n for (let j = 0; j < modifyKeys.length; j++) {\n let key = modifyKeys[j];\n\n if (isPrimitiveTypeid) {\n let newValue = modifiedEntries[key];\n if (newValue && newValue.hasOwnProperty(\"value\")) {\n newValue = newValue.value;\n }\n if (baseInserted[key] !== undefined) {\n // If this entry was added by this ChangeSet, we modify the insert operation according to the\n // new ChangeSet\n baseInserted[key] = newValue;\n } else {\n if (baseModified[key] && baseModified[key].hasOwnProperty(\"value\")) {\n baseModified[key].value = newValue;\n } else {\n baseModified[key] = newValue;\n }\n }\n } else {\n // If this is a polymorphic collection, we can still have individual entries with\n // primitive types\n const isEntryPrimitiveType = TypeIdHelper.isPrimitiveType(typeid);\n\n if (baseInserted[typeid] && baseInserted[typeid][key] !== undefined) {\n // If this entry was added by this ChangeSet, we modify the insert operation according to the\n // new ChangeSet\n if (isEntryPrimitiveType && typeid !== \"String\") {\n let newValue = modifiedEntries[typeid][key];\n if (newValue && newValue.hasOwnProperty(\"value\")) {\n newValue = modifiedEntries[typeid][key].value;\n }\n\n // In the case of Int64 or Uint64 we copy the array so that\n // both ChangeSets don't point to the same instance\n if (typeid === \"Int64\" || typeid === \"Uint64\") {\n newValue = newValue.slice();\n }\n\n if (baseInserted[typeid][key] && baseInserted[typeid][key].hasOwnProperty(\"value\")) {\n baseInserted[typeid][key].value = newValue;\n } else {\n baseInserted[typeid][key] = newValue;\n }\n } else {\n this.performApplyAfterOnPropertyWithTypeid(key,\n baseInserted[typeid],\n modifiedEntries[typeid],\n typeid,\n false,\n in_options);\n }\n } else if (baseModified[typeid] && baseModified[typeid][key] !== undefined) {\n // If there was a previous modification operation, we have to merge the two\n if (isEntryPrimitiveType && typeid !== \"String\") {\n // Primitive types can simply be overwritten, however we have an exception for\n // 64 bit integers (until javascript natively supports them)\n if (typeid === \"Int64\" || typeid === \"Uint64\") {\n let appliedVal = modifiedEntries[typeid][key];\n if (appliedVal && appliedVal.hasOwnProperty(\"value\")) {\n appliedVal = appliedVal.value;\n }\n baseModified[typeid][key] = appliedVal.slice();\n } else {\n baseModified[typeid][key] = modifiedEntries[typeid][key];\n }\n } else {\n this.performApplyAfterOnPropertyWithTypeid(key,\n baseModified[typeid],\n modifiedEntries[typeid],\n typeid,\n true,\n in_options);\n }\n } else {\n baseModified[typeid] = baseModified[typeid] || {};\n baseModified[typeid][key] = cloneDeep(modifiedEntries[typeid][key]);\n }\n }\n }\n }\n }\n\n // Remove unnecessary entries from the ChangeSet\n this._cleanIndexedCollectionChangeSet(io_basePropertyChanges, !isPrimitiveTypeid);\n };\n\n /**\n * Performs the rebase operation for set and map collections\n *\n * @param in_ownPropertyChangeSet - The ChangeSet for this collection\n * @param io_rebasePropertyChangeSet - The ChangeSet for the collection to be rebased\n * @param in_basePath - Base path to get to the property processed by this function\n * @param in_typeid - The typeid of the contents collection (without the collection type)\n * @param in_useSquareBracketsInPath -\n * If set to true, paths will be created using the angular brackets syntax (for\n * arrays), otherwise dots will be used (for NodeProperties)\n * @param out_conflicts - A list of paths that resulted in conflicts together with the type of the conflict\n * @param in_options - Optional additional parameters\n * @param in_options.applyAfterMetaInformation - Additional meta information which help later to obtain\n * more compact changeset during the apply operation\n *\n * @private\n */\n export const _rebaseIndexedCollectionChangeSetForProperty = function(\n in_ownPropertyChangeSet: SerializedChangeSet, // eslint-disable-line complexity\n io_rebasePropertyChangeSet: SerializedChangeSet,\n in_basePath: string,\n in_typeid: string,\n in_useSquareBracketsInPath: boolean,\n out_conflicts: ConflictInfo[],\n in_options: ApplyChangeSetOptions) {\n const isPrimitiveTypeid = TypeIdHelper.isPrimitiveType(in_typeid);\n\n const changesByKeys = {};\n let modifyMap = {};\n // Helper function which stores the changes indexed by key in the changesByKeys array to\n // make it easier to compare the related changes in the two ChangeSets\n const addChanges = function(in_collection: Record<string, any>, in_changeIdentifier: string, in_changePrefix: string, in_typeidChange?: string) {\n // Collection didn't exist in this ChangeSet\n if (in_collection === undefined) {\n return;\n }\n\n // For remove operations, the ChangeSet is only an array of keys, otherwise it is a map, so we have to\n // distinguish the two cases here\n const keys = Array.isArray(in_collection) ? in_collection : Object.keys(in_collection);\n\n // Add all entries indexed with the key\n for (let j = 0; j < keys.length; j++) {\n const key = keys[j];\n\n // Store the type of the change\n changesByKeys[key] = changesByKeys[key] || {};\n changesByKeys[key][in_changePrefix] = changesByKeys[key][in_changePrefix] ?\n `${changesByKeys[key][in_changePrefix]}_${in_changeIdentifier}` :\n in_changeIdentifier;\n\n // If applicable store the typeid of the change\n if (in_typeidChange) {\n changesByKeys[key][`${in_changePrefix}Typeid`] = in_typeidChange;\n }\n\n // Store the ChangeSet\n if (in_changePrefix === \"other\") {\n if (!Array.isArray(in_collection)) {\n changesByKeys[key].change = in_collection[key];\n } else {\n changesByKeys[key].change = key;\n }\n }\n }\n };\n\n // Helper function which adds the Changes for a ChangeSet that is ordered by typeid\n const addChangesWithTypeids = function(in_collection, in_changeIdentifier, in_changePrefix) {\n if (in_collection === undefined) {\n return;\n }\n // Iterate over the typeids (or use dummy entry for the iteration\n const addedKeyTypeids = Object.keys(in_collection);\n for (let i = 0; i < addedKeyTypeids.length; i++) {\n const Typeid = addedKeyTypeids[i];\n addChanges(in_collection[Typeid], in_changeIdentifier, in_changePrefix, Typeid);\n }\n };\n\n // Insert all changes from the ChangeSet into the lookup map\n if (Array.isArray(in_ownPropertyChangeSet.remove)) {\n addChanges(in_ownPropertyChangeSet.remove, \"remove\", \"own\");\n } else {\n if (isPrimitiveTypeid) {\n addChanges(in_ownPropertyChangeSet.remove, \"remove\", \"own\");\n } else {\n addChangesWithTypeids(in_ownPropertyChangeSet.remove, \"remove\", \"own\");\n }\n }\n\n if (Array.isArray(io_rebasePropertyChangeSet.remove)) {\n addChanges(io_rebasePropertyChangeSet.remove, \"remove\", \"other\");\n } else {\n if (isPrimitiveTypeid) {\n addChanges(io_rebasePropertyChangeSet.remove, \"remove\", \"other\");\n } else {\n addChangesWithTypeids(io_rebasePropertyChangeSet.remove, \"remove\", \"other\");\n }\n }\n\n if (isPrimitiveTypeid) {\n addChanges(in_ownPropertyChangeSet.insert, \"insert\", \"own\");\n addChanges(in_ownPropertyChangeSet.modify, \"modify\", \"own\");\n addChanges(io_rebasePropertyChangeSet.insert, \"insert\", \"other\");\n addChanges(io_rebasePropertyChangeSet.modify, \"modify\", \"other\");\n } else {\n addChangesWithTypeids(in_ownPropertyChangeSet.insert, \"insert\", \"own\");\n addChangesWithTypeids(in_ownPropertyChangeSet.modify, \"modify\", \"own\");\n addChangesWithTypeids(io_rebasePropertyChangeSet.insert, \"insert\", \"other\");\n addChangesWithTypeids(io_rebasePropertyChangeSet.modify, \"modify\", \"other\");\n }\n\n // Check for modifications that affect the same object\n const changedKeys = Object.keys(changesByKeys);\n for (let i = 0; i < changedKeys.length; i++) {\n const key = changedKeys[i];\n const newPath = in_useSquareBracketsInPath ?\n `${in_basePath}[${PathHelper.quotePathSegmentIfNeeded(key)}]` :\n joinPaths(in_basePath, PathHelper.quotePathSegmentIfNeeded(key), PROPERTY_PATH_DELIMITER);\n\n const modification = changesByKeys[key];\n if (modification.own && modification.other) {\n /*\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 // A key was modified after it had been removed\n if (modification.own === \"modify\" && modification.other === \"modify\") {\n if (isPrimitiveTypeid ||\n (TypeIdHelper.isPrimitiveType(modification.ownTypeid) && modification.ownTypeid !== \"String\")) {\n // We have two modification operations that affect the same entry for a base type.\n // This is a legal operation, the second one will overwrite the first one, but we\n // report it as a possible conflict\n let ownModify = in_ownPropertyChangeSet.modify;\n let rebasedModify = io_rebasePropertyChangeSet.modify;\n if (modification.otherTypeid) {\n ownModify = ownModify[modification.otherTypeid];\n rebasedModify = rebasedModify[modification.otherTypeid];\n }\n\n let conflict = {\n path: newPath,\n type: ConflictType.COLLIDING_SET,\n conflictingChange: ownModify[key],\n };\n out_conflicts.push(conflict);\n // If value is the same, delete the entry\n let ownValue = ownModify[key];\n if (typeof ownValue === \"object\" && ownValue.hasOwnProperty(\"value\")) {\n ownValue = ownValue.value;\n }\n let rebaseValue = rebasedModify[key];\n if (typeof rebaseValue === \"object\" && rebaseValue.hasOwnProperty(\"value\")) {\n rebaseValue = rebaseValue.value;\n }\n if (modification.ownTypeid === \"Int64\" || modification.ownTypeid === \"Uint64\" || ownValue.length === 2) {\n // For (u)int64, values are arrays of 2 elements\n if (ownValue[0] === rebaseValue[0] && ownValue[1] === rebaseValue[1]) {\n delete rebasedModify[key];\n }\n } else {\n if (ownValue === rebaseValue) {\n delete rebasedModify[key];\n }\n }\n } else {\n this.rebaseChangeSetForPropertyEntryWithTypeid(key,\n in_ownPropertyChangeSet.modify[modification.ownTypeid],\n io_rebasePropertyChangeSet.modify[modification.otherTypeid],\n modification.ownTypeid,\n newPath,\n true,\n out_conflicts,\n in_options);\n }\n } else if (modification.own === \"remove\" && modification.other === \"modify\") {\n modifyMap = modification.otherTypeid ? io_rebasePropertyChangeSet.modify[modification.otherTypeid] :\n io_rebasePropertyChangeSet.modify;\n\n // Create the conflict information\n let conflict = {\n path: newPath,\n type: ConflictType.ENTRY_MODIFIED_AFTER_REMOVE,\n conflictingChange: modifyMap[key],\n };\n out_conflicts.push(conflict);\n\n // Delete the modification from the rebased ChangeSet\n delete modifyMap[key];\n } else if (modification.own === \"remove_insert\" && modification.other === \"modify\") {\n // We have a conflicting change. A node was removed and inserted (replaced) in the original\n // ChangeSet and then modified by the rebased ChangeSet. Since the base of the modification\n // can have been changed significantly by this operation, we don't know whether we can\n // apply the modification\n\n // Create the conflict information\n let conflict = {\n path: newPath,\n type: ConflictType.ENTRY_MODIFICATION_AFTER_REMOVE_INSERT,\n conflictingChange: io_rebasePropertyChangeSet.modify[modification.otherTypeid][key],\n };\n out_conflicts.push(conflict);\n\n // Delete the modification from the rebased ChangeSet\n delete io_rebasePropertyChangeSet.modify[key];\n } else if ((modification.own === \"modify\" || modification.own === \"remove\") &&\n (modification.other === \"remove\" || modification.other === \"remove_insert\")) {\n if (modification.own === \"modify\") {\n modifyMap = modification.ownTypeid ? in_ownPropertyChangeSet.modify[modification.ownTypeid] :\n in_ownPropertyChangeSet.modify;\n\n // Create the conflict information\n let conflict = {\n path: newPath,\n type: ConflictType.REMOVE_AFTER_MODIFY,\n conflictingChange: modifyMap[key],\n };\n out_conflicts.push(conflict);\n }\n\n // If we have a duplicated delete, we remove it from the new ChangeSet\n if (modification.own === \"remove\") {\n if (Array.isArray(io_rebasePropertyChangeSet.remove)) {\n io_rebasePropertyChangeSet.remove = without(io_rebasePropertyChangeSet.remove, key);\n } else {\n if (isPrimitiveTypeid) {\n delete io_rebasePropertyChangeSet.remove[key];\n } else {\n delete io_rebasePropertyChangeSet.remove[modification.otherTypeid][key];\n }\n }\n }\n } else if (modification.own === \"insert\" && modification.other === \"insert\") {\n if (isPrimitiveTypeid ||\n (TypeIdHelper.isPrimitiveType(modification.ownTypeid))) {\n let insertMap = modification.otherTypeid ? io_rebasePropertyChangeSet.insert[modification.otherTypeid] :\n io_rebasePropertyChangeSet.insert;\n\n // We have two insert operations that affect the same key for a primitive type.\n // This is a legal operation, the second one will overwrite the first one, but we\n // report it as a possible conflicting set\n let conflict = {\n path: newPath,\n type: ConflictType.COLLIDING_SET,\n conflictingChange: insertMap[key],\n };\n out_conflicts.push(conflict);\n\n // Convert to modify\n let oldValue;\n if (modification.otherTypeid) {\n io_rebasePropertyChangeSet.modify = io_rebasePropertyChangeSet.modify || {};\n io_rebasePropertyChangeSet.modify[modification.otherTypeid] =\n io_rebasePropertyChangeSet.modify[modification.otherTypeid] || {};\n modifyMap = io_rebasePropertyChangeSet.modify[modification.otherTypeid];\n oldValue = in_ownPropertyChangeSet.insert[modification.ownTypeid][key];\n } else {\n io_rebasePropertyChangeSet.modify = io_rebasePropertyChangeSet.modify || {};\n modifyMap = io_rebasePropertyChangeSet.modify;\n oldValue = in_ownPropertyChangeSet.insert[key];\n }\n\n modifyMap[key] = { value: insertMap[key], oldValue };\n delete insertMap[key];\n } else {\n // Here we have two insert operations for objects. Since these affect a whole sub-tree and not\n // just a single value, we cannot easily convert it into a modify and instead report it as invalid\n\n let insertMap = modification.otherTypeid ? io_rebasePropertyChangeSet.insert[modification.otherTypeid] :\n io_rebasePropertyChangeSet.insert;\n\n // Create the conflict information\n let conflict = {\n path: newPath,\n type: ConflictType.INSERTED_ENTRY_WITH_SAME_KEY,\n conflictingChange: insertMap[key],\n };\n out_conflicts.push(conflict);\n\n // Delete the modification from the rebased ChangeSet\n delete insertMap[key];\n }\n } else if (modification.own === \"remove_insert\" && modification.other === \"remove_insert\") {\n let insertMap = modification.otherTypeid ? io_rebasePropertyChangeSet.insert[modification.otherTypeid] :\n io_rebasePropertyChangeSet.insert;\n\n // Raise the duplicate inserts as a conflict\n let conflict = {\n path: newPath,\n type: ConflictType.COLLIDING_SET,\n conflictingChange: insertMap[key],\n };\n out_conflicts.push(conflict);\n } else {\n // All other operations are conflicting changes, which only occur for ChangeSets that are relative\n // to different bases\n\n // Create the conflict information\n let conflict = {\n path: newPath,\n type: ConflictType.INVALID_CHANGESET_BASE,\n conflictingChange: modification.change,\n };\n out_conflicts.push(conflict);\n\n // Remove the change from the ChangeSet\n if (modification.other !== \"remove\") {\n if (modification.otherTypeid !== undefined) {\n delete io_rebasePropertyChangeSet[modification.other][modification.otherTypeid][key];\n } else {\n delete io_rebasePropertyChangeSet[modification.other][key];\n }\n } else {\n // Remove remove operations from the ChangeSet\n if (Array.isArray(io_rebasePropertyChangeSet[modification.other])) {\n io_rebasePropertyChangeSet[modification.other] =\n without(io_rebasePropertyChangeSet[modification.other], key);\n } else {\n delete io_rebasePropertyChangeSet[modification.other][key];\n }\n }\n\n console.error(\"Rebase operation with conflicting ChangeSets. Probably incorrect bases.\");\n }\n }\n }\n\n // Remove unnecessary entries from the ChangeSet\n this._cleanIndexedCollectionChangeSet(io_rebasePropertyChangeSet, !isPrimitiveTypeid);\n };\n\n /**\n * Removes empty entries from the .children collection of the ChangeSet\n *\n * @param in_propertyChanges - The ChangeSet to clean up\n * @param in_containsTypeids - Does this ChangeSet contain typeids\n * @private\n */\n export const _cleanIndexedCollectionChangeSet = function(in_propertyChanges: SerializedChangeSet, in_containsTypeids: boolean) {\n const changes = in_propertyChanges;\n // Clean inserts\n\n // First remove unused typeid sections\n if (in_containsTypeids) {\n let typeidList = Object.keys(changes.insert || {});\n for (let j = 0; j < typeidList.length; j++) {\n if (_fastIsEmptyObject(changes.insert[typeidList[j]])) {\n delete changes.insert[typeidList[j]];\n }\n }\n }\n\n // Remove add group if no operations are present\n if (_fastIsEmptyObject(changes.insert)) {\n delete changes.insert;\n }\n\n // First remove unused typeid sections\n if (in_containsTypeids) {\n let typeidList = Object.keys(changes.remove || {});\n for (let j = 0; j < typeidList.length; j++) {\n if (_fastIsEmptyObject(changes.remove[typeidList[j]])) {\n delete changes.remove[typeidList[j]];\n }\n }\n }\n // Remove remove group if no operations are present\n if (_fastIsEmptyObject(changes.remove)) {\n delete changes.remove;\n }\n\n // Clean modifies\n\n // First remove unused typeid sections\n if (in_containsTypeids) {\n let typeidList = Object.keys(changes.modify || {});\n for (let j = 0; j < typeidList.length; j++) {\n const modifies = changes.modify[typeidList[j]];\n const modifyKeys = Object.keys(modifies);\n for (let k = 0; k < modifyKeys.length; k++) {\n if (isEmptyChangeSet(modifies[modifyKeys[k]])) {\n delete modifies[modifyKeys[k]];\n }\n }\n if (_fastIsEmptyObject(changes.modify[typeidList[j]])) {\n delete changes.modify[typeidList[j]];\n }\n }\n }\n\n // Remove modify group if no operations are present\n if (_fastIsEmptyObject(changes.modify)) {\n delete changes.modify;\n }\n };\n}\n"]}
1
+ {"version":3,"file":"indexedCollection.js","sourceRoot":"","sources":["../../src/changeset_operations/indexedCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;;;;AAEF,yDAAsD;AACtD,6DAAqC;AACrC,6DAAqC;AACrC,+DAAuC;AACvC,6DAAqC;AACrC,+DAAuC;AAExC,aAAa;AACb,yEAA2E;AAE3E,0DAAuD;AACvD,8CAA2C;AAC3C,qEAAwD;AACxD,yDAAsD;AAEtD,MAAM,EAAE,uBAAuB,EAAE,GAAG,EAAE,GAAG,2BAAS,CAAC;AAEnD;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,MAAM,kBAAkB,GAAG,UAAS,SAAc;IAC9C,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAA,kBAAQ,EAAC,SAAS,CAAC,EAAE;QAChE,OAAO,IAAA,iBAAO,EAAC,SAAS,CAAC,CAAC;KAC7B;IAED,wCAAwC;IACxC,KAAK,MAAM,MAAM,IAAI,SAAS,EAAE;QAC5B,OAAO,KAAK,CAAC;KAChB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,IAAiB,mCAAmC,CA+vBnD;AA/vBD,WAAiB,mCAAmC;IAChD;;;;;;;;;;;;;;OAcG;IACU,iFAA6C,GAAG,UACzD,sBAA2C,EAAE,iCAAiC;IAC9E,yBAA8C,EA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M,IAAI,EAAE,CAAC,CAAC;YACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACxC,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;oBACxC,IAAI,IAAA,mCAAgB,EAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;wBAC3C,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;qBAClC;iBACJ;gBACD,IAAI,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;oBACnD,OAAO,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;iBACxC;aACJ;SACJ;QAED,mDAAmD;QACnD,IAAI,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACpC,OAAO,OAAO,CAAC,MAAM,CAAC;SACzB;IACL,CAAC,CAAC;AACN,CAAC,EA/vBgB,mCAAmC,GAAnC,2CAAmC,KAAnC,2CAAmC,QA+vBnD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Helper functions and classes to work with ChangeSets with indexed collections (sets and maps)\n */\n\n import { copy as cloneDeep } from \"fastest-json-copy\";\n import isEmpty from \"lodash/isEmpty\";\n import isEqual from \"lodash/isEqual\";\n import isObject from \"lodash/isObject\";\n import without from \"lodash/without\";\n import includes from \"lodash/includes\";\n\n// @ts-ignore\nimport { constants, joinPaths } from \"@fluid-experimental/property-common\";\nimport { ApplyChangeSetOptions, ConflictInfo, SerializedChangeSet } from \"../changeset\";\nimport { TypeIdHelper } from \"../helpers/typeidHelper\";\nimport { PathHelper } from \"../pathHelper\";\nimport { ConflictType } from \"./changesetConflictTypes\";\nimport { isEmptyChangeSet } from \"./isEmptyChangeset\";\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 if (!in_object || Array.isArray(in_object) || !isObject(in_object)) {\n return isEmpty(in_object);\n }\n\n // eslint-disable-next-line guard-for-in\n for (const _entry in in_object) {\n return false;\n }\n\n return true;\n};\n\nexport namespace ChangeSetIndexedCollectionFunctions {\n /**\n * Applies a ChangeSet to a given indexed collection property (recursively). The ChangeSet is assumed to be relative\n * to the same property root and it will be applied behind the base ChangeSet (assuming that the changes are\n * relative to the state after the base ChangeSet has been applied. It will change the base ChangeSet.\n *\n * @param io_basePropertyChanges - The ChangeSet describing the initial state\n * @param in_appliedPropertyChanges - The ChangeSet to apply to this state\n * @param in_typeid - The typeid of the contents collection\n * (without the collection type)\n * @param in_options - Optional additional parameters\n * @param in_options.applyAfterMetaInformation - Additional meta information which help later to obtain\n * more compact changeset during the apply operation\n *\n * @private\n */\n export const _performApplyAfterOnPropertyIndexedCollection = function(\n io_basePropertyChanges: SerializedChangeSet, // eslint-disable-line complexity\n in_appliedPropertyChanges: SerializedChangeSet,\n in_typeid: string,\n in_options: ApplyChangeSetOptions) {\n const isPrimitiveTypeid = TypeIdHelper.isPrimitiveType(in_typeid);\n\n // Handle remove entry operations\n if (in_appliedPropertyChanges.remove) {\n // Get and initialize the corresponding entries in the existing collection\n let removedEntries = in_appliedPropertyChanges.remove;\n\n io_basePropertyChanges = io_basePropertyChanges || {};\n io_basePropertyChanges.remove = io_basePropertyChanges.remove ||\n (Array.isArray(in_appliedPropertyChanges.remove) ? [] : {});\n let baseInserted = io_basePropertyChanges.insert || {};\n let baseRemoved = io_basePropertyChanges.remove;\n let baseModified = io_basePropertyChanges.modify;\n let done = false;\n\n if (!Array.isArray(removedEntries)) {\n if (isPrimitiveTypeid) {\n removedEntries = Object.keys(removedEntries);\n } else {\n // this is a reversible change set of templated types\n const removedTypes = Object.keys(removedEntries);\n for (let t = 0; t < removedTypes.length; t++) {\n const removedKeys = Object.keys(removedEntries[removedTypes[t]]);\n for (let i = 0; i < removedKeys.length; i++) {\n if (baseInserted[removedTypes[t]] &&\n baseInserted[removedTypes[t]][removedKeys[i]] !== undefined) {\n delete baseInserted[removedTypes[t]][removedKeys[i]];\n\n // If all entries for a typeid have been removed, we can remove\n // the whole typeid from the inserted section\n if (baseInserted && isEmpty(baseInserted[removedTypes[t]])) {\n delete baseInserted[removedTypes[t]];\n }\n } else {\n if (baseModified && baseModified[removedTypes[t]] &&\n baseModified[removedTypes[t]][removedKeys[i]] !== undefined) {\n delete baseModified[removedTypes[t]][removedKeys[i]];\n\n // If all entries for a typeid have been removed, we can remove\n // the whole typeid from the inserted section\n if (baseModified && isEmpty(baseModified[removedTypes[t]])) {\n delete baseModified[removedTypes[t]];\n }\n }\n if (Array.isArray(baseRemoved)) {\n baseRemoved.push(removedKeys[i]);\n } else {\n if (!baseRemoved[removedTypes[t]]) {\n baseRemoved[removedTypes[t]] = {};\n }\n baseRemoved[removedTypes[t]][removedKeys[i]] = removedEntries[removedTypes[t]][removedKeys[i]];\n }\n }\n }\n }\n done = true;\n }\n }\n\n if (!done) {\n if (isPrimitiveTypeid) {\n for (let i = 0; i < removedEntries.length; i++) {\n let key = removedEntries[i];\n\n // If there is an insert for this key, we just remove it\n if (baseInserted[key] !== undefined) {\n delete baseInserted[key];\n } else {\n // There could be a modify entry for this key, which we have to remove\n if (baseModified && baseModified[key] !== undefined) {\n delete baseModified[key];\n }\n\n // Otherwise we add it to the remove list\n if (Array.isArray(baseRemoved)) {\n baseRemoved.push(key);\n } else {\n baseRemoved[key] = in_appliedPropertyChanges.remove[key];\n }\n }\n }\n } else {\n const baseInsertedTypeids = Object.keys(baseInserted);\n for (let i = 0; i < removedEntries.length; i++) {\n let key = removedEntries[i];\n let foundInTypeid;\n\n // Since we only have a flat remove list (without typeid) in the changeset, we have\n // to check all inserts\n for (let j = 0; j < baseInsertedTypeids.length; j++) {\n if (baseInserted[baseInsertedTypeids[j]] &&\n baseInserted[baseInsertedTypeids[j]][key] !== undefined) {\n foundInTypeid = baseInsertedTypeids[j];\n break;\n }\n }\n\n if (foundInTypeid) {\n // If this key was inserted by this ChangeSet, we just remove it from the inserted list\n delete baseInserted[foundInTypeid][key];\n\n // If all entries for a typeid have been removed, we can remove\n // the whole typeid from the inserted or modified section\n if (baseInserted && isEmpty(baseInserted[foundInTypeid])) {\n delete baseInserted[foundInTypeid];\n }\n if (baseModified && isEmpty(baseModified[foundInTypeid])) {\n delete baseModified[foundInTypeid];\n }\n } else {\n // There could be a modify entry for this key, which we have to remove\n const baseModifiedTypeids = Object.keys(baseModified || {});\n for (let j = 0; j < baseModifiedTypeids.length; j++) {\n if (baseModified[baseModifiedTypeids[j]][key]) {\n foundInTypeid = baseModifiedTypeids[j];\n delete baseModified[foundInTypeid][key];\n break;\n }\n }\n\n // Otherwise we add it to the remove list\n baseRemoved.push(key);\n }\n }\n }\n }\n }\n\n // Apply insert operations\n if (in_appliedPropertyChanges.insert) {\n // Get and initialize the corresponding entries from the existing collection\n io_basePropertyChanges = io_basePropertyChanges || {};\n io_basePropertyChanges.insert = io_basePropertyChanges.insert || {};\n let baseInserted = io_basePropertyChanges.insert;\n let baseRemoved = io_basePropertyChanges.remove;\n\n // Insert the inserted entries\n\n // If no typeids are included, we just use a placeholder for the iteration below\n const insertedTypeids = isPrimitiveTypeid ? [undefined] : Object.keys(in_appliedPropertyChanges.insert);\n for (let i = 0; i < insertedTypeids.length; i++) {\n let typeid = insertedTypeids[i];\n const insertedEntries = isPrimitiveTypeid ?\n in_appliedPropertyChanges.insert : in_appliedPropertyChanges.insert[typeid];\n const insertedKeys = Object.keys(insertedEntries);\n let removalCS;\n if (baseRemoved) {\n removalCS = isPrimitiveTypeid ? baseRemoved : baseRemoved[typeid];\n }\n for (let j = 0; j < insertedKeys.length; j++) {\n let key = insertedKeys[j];\n let deeplyEqualCS = false;\n\n // If we have a complex type in the collection, we need to do a deep comparison of the two\n // ChangeSets to determine, whether they are equal\n // TODO: We should actually compute a diff between the two and recursively convert portions to modifies\n // Instead, right now, we only handle the case where the two keys cancel each out perfectly, i.e.,\n // the insert is reinserting exactly what was removed.\n if (!isPrimitiveTypeid && removalCS && isObject(removalCS) && removalCS[key] !== undefined) {\n // Split out the two parts: all the keys other than remove/insert should match exactly.\n // The contents 'remove' and 'insert', if they exist, should also match.\n deeplyEqualCS = !!insertedEntries[key].insert === !!removalCS[key].remove;\n\n // If there are 'insert' and 'remove', see if the removed data matches the inserted data\n if (deeplyEqualCS && insertedEntries[key].insert) {\n deeplyEqualCS = isEqual(\n insertedEntries[key].insert,\n removalCS[key].remove,\n );\n }\n\n // Finally, check if the data being inserted matches the data that was removed\n const insertedEntry = isObject(insertedEntries[key]) ? without(insertedEntries[key], \"insert\") : insertedEntries[key];\n const removedEntry = isObject(removalCS[key]) ? without(removalCS[key], \"remove\") : removalCS[key];\n deeplyEqualCS = deeplyEqualCS && isEqual(insertedEntry, removedEntry);\n }\n\n if ((isPrimitiveTypeid || TypeIdHelper.isPrimitiveType(typeid) || deeplyEqualCS) &&\n removalCS &&\n ((Array.isArray(removalCS) && includes(baseRemoved, key)) || removalCS[key] !== undefined)) {\n // A remove and insert are combined into a modify for primitive types\n\n // Remove the old remove command\n let oldValueMatches = false;\n if (Array.isArray(removalCS)) {\n if (isPrimitiveTypeid) {\n io_basePropertyChanges.remove = without(io_basePropertyChanges.remove, key);\n } else {\n io_basePropertyChanges.remove[typeid] = without(io_basePropertyChanges.remove[typeid], key);\n }\n } else {\n oldValueMatches = deeplyEqualCS || (removalCS[key] === insertedEntries[key]);\n delete removalCS[key];\n }\n\n // Insert a modify command instead\n if (!oldValueMatches) {\n io_basePropertyChanges.modify = io_basePropertyChanges.modify || {};\n if (isPrimitiveTypeid) {\n io_basePropertyChanges.modify[key] = insertedEntries[key];\n } else {\n io_basePropertyChanges.modify[typeid] = io_basePropertyChanges.modify[typeid] || {};\n io_basePropertyChanges.modify[typeid][key] = cloneDeep(insertedEntries[key]);\n }\n }\n } else if (isPrimitiveTypeid && baseInserted[key] === undefined) {\n baseInserted[key] = insertedEntries[key];\n } else if (!isPrimitiveTypeid && (!baseInserted[typeid] || baseInserted[typeid][key] === undefined)) {\n baseInserted[typeid] = baseInserted[typeid] || {};\n baseInserted[typeid][key] = cloneDeep(insertedEntries[key]);\n } else {\n throw new Error(MSG.ALREADY_EXISTING_ENTRY + key);\n }\n }\n }\n }\n\n // Handle modification operations\n if (in_appliedPropertyChanges.modify) {\n // Get and initialize the corresponding entries from the existing collection\n const modifiedEntries = in_appliedPropertyChanges.modify;\n io_basePropertyChanges = io_basePropertyChanges || {};\n io_basePropertyChanges.modify = io_basePropertyChanges.modify || {};\n let baseModified = io_basePropertyChanges.modify;\n let baseInserted = io_basePropertyChanges.insert || {};\n\n // Process the modifications\n\n // If no typeids are included, we just use a placeholder for the iteration below\n const modifiedTypeids = isPrimitiveTypeid ? [undefined] : Object.keys(modifiedEntries);\n for (let i = 0; i < modifiedTypeids.length; i++) {\n let typeid = modifiedTypeids[i];\n\n const modifyKeys = Object.keys(isPrimitiveTypeid ? modifiedEntries : modifiedEntries[typeid]);\n for (let j = 0; j < modifyKeys.length; j++) {\n let key = modifyKeys[j];\n\n if (isPrimitiveTypeid) {\n let newValue = modifiedEntries[key];\n if (newValue && newValue.hasOwnProperty(\"value\")) {\n newValue = newValue.value;\n }\n if (baseInserted[key] !== undefined) {\n // If this entry was added by this ChangeSet, we modify the insert operation according to the\n // new ChangeSet\n baseInserted[key] = newValue;\n } else {\n if (baseModified[key] && baseModified[key].hasOwnProperty(\"value\")) {\n baseModified[key].value = newValue;\n } else {\n baseModified[key] = newValue;\n }\n }\n } else {\n // If this is a polymorphic collection, we can still have individual entries with\n // primitive types\n const isEntryPrimitiveType = TypeIdHelper.isPrimitiveType(typeid);\n\n if (baseInserted[typeid] && baseInserted[typeid][key] !== undefined) {\n // If this entry was added by this ChangeSet, we modify the insert operation according to the\n // new ChangeSet\n if (isEntryPrimitiveType && typeid !== \"String\") {\n let newValue = modifiedEntries[typeid][key];\n if (newValue && newValue.hasOwnProperty(\"value\")) {\n newValue = modifiedEntries[typeid][key].value;\n }\n\n // In the case of Int64 or Uint64 we copy the array so that\n // both ChangeSets don't point to the same instance\n if (typeid === \"Int64\" || typeid === \"Uint64\") {\n newValue = newValue.slice();\n }\n\n if (baseInserted[typeid][key] && baseInserted[typeid][key].hasOwnProperty(\"value\")) {\n baseInserted[typeid][key].value = newValue;\n } else {\n baseInserted[typeid][key] = newValue;\n }\n } else {\n this.performApplyAfterOnPropertyWithTypeid(key,\n baseInserted[typeid],\n modifiedEntries[typeid],\n typeid,\n false,\n in_options);\n }\n } else if (baseModified[typeid] && baseModified[typeid][key] !== undefined) {\n // If there was a previous modification operation, we have to merge the two\n if (isEntryPrimitiveType && typeid !== \"String\") {\n // Primitive types can simply be overwritten, however we have an exception for\n // 64 bit integers (until javascript natively supports them)\n if (typeid === \"Int64\" || typeid === \"Uint64\") {\n let appliedVal = modifiedEntries[typeid][key];\n if (appliedVal && appliedVal.hasOwnProperty(\"value\")) {\n appliedVal = appliedVal.value;\n }\n baseModified[typeid][key] = appliedVal.slice();\n } else {\n baseModified[typeid][key] = modifiedEntries[typeid][key];\n }\n } else {\n this.performApplyAfterOnPropertyWithTypeid(key,\n baseModified[typeid],\n modifiedEntries[typeid],\n typeid,\n true,\n in_options);\n }\n } else {\n baseModified[typeid] = baseModified[typeid] || {};\n baseModified[typeid][key] = cloneDeep(modifiedEntries[typeid][key]);\n }\n }\n }\n }\n }\n\n // Remove unnecessary entries from the ChangeSet\n this._cleanIndexedCollectionChangeSet(io_basePropertyChanges, !isPrimitiveTypeid);\n };\n\n /**\n * Performs the rebase operation for set and map collections\n *\n * @param in_ownPropertyChangeSet - The ChangeSet for this collection\n * @param io_rebasePropertyChangeSet - The ChangeSet for the collection to be rebased\n * @param in_basePath - Base path to get to the property processed by this function\n * @param in_typeid - The typeid of the contents collection (without the collection type)\n * @param in_useSquareBracketsInPath -\n * If set to true, paths will be created using the angular brackets syntax (for\n * arrays), otherwise dots will be used (for NodeProperties)\n * @param out_conflicts - A list of paths that resulted in conflicts together with the type of the conflict\n * @param in_options - Optional additional parameters\n * @param in_options.applyAfterMetaInformation - Additional meta information which help later to obtain\n * more compact changeset during the apply operation\n *\n * @private\n */\n export const _rebaseIndexedCollectionChangeSetForProperty = function(\n in_ownPropertyChangeSet: SerializedChangeSet, // eslint-disable-line complexity\n io_rebasePropertyChangeSet: SerializedChangeSet,\n in_basePath: string,\n in_typeid: string,\n in_useSquareBracketsInPath: boolean,\n out_conflicts: ConflictInfo[],\n in_options: ApplyChangeSetOptions) {\n const isPrimitiveTypeid = TypeIdHelper.isPrimitiveType(in_typeid);\n\n const changesByKeys = {};\n let modifyMap = {};\n // Helper function which stores the changes indexed by key in the changesByKeys array to\n // make it easier to compare the related changes in the two ChangeSets\n const addChanges = function(in_collection: Record<string, any>, in_changeIdentifier: string, in_changePrefix: string, in_typeidChange?: string) {\n // Collection didn't exist in this ChangeSet\n if (in_collection === undefined) {\n return;\n }\n\n // For remove operations, the ChangeSet is only an array of keys, otherwise it is a map, so we have to\n // distinguish the two cases here\n const keys = Array.isArray(in_collection) ? in_collection : Object.keys(in_collection);\n\n // Add all entries indexed with the key\n for (let j = 0; j < keys.length; j++) {\n const key = keys[j];\n\n // Store the type of the change\n changesByKeys[key] = changesByKeys[key] || {};\n changesByKeys[key][in_changePrefix] = changesByKeys[key][in_changePrefix] ?\n `${changesByKeys[key][in_changePrefix]}_${in_changeIdentifier}` :\n in_changeIdentifier;\n\n // If applicable store the typeid of the change\n if (in_typeidChange) {\n changesByKeys[key][`${in_changePrefix}Typeid`] = in_typeidChange;\n }\n\n // Store the ChangeSet\n if (in_changePrefix === \"other\") {\n if (!Array.isArray(in_collection)) {\n changesByKeys[key].change = in_collection[key];\n } else {\n changesByKeys[key].change = key;\n }\n }\n }\n };\n\n // Helper function which adds the Changes for a ChangeSet that is ordered by typeid\n const addChangesWithTypeids = function(in_collection, in_changeIdentifier, in_changePrefix) {\n if (in_collection === undefined) {\n return;\n }\n // Iterate over the typeids (or use dummy entry for the iteration\n const addedKeyTypeids = Object.keys(in_collection);\n for (let i = 0; i < addedKeyTypeids.length; i++) {\n const Typeid = addedKeyTypeids[i];\n addChanges(in_collection[Typeid], in_changeIdentifier, in_changePrefix, Typeid);\n }\n };\n\n // Insert all changes from the ChangeSet into the lookup map\n if (Array.isArray(in_ownPropertyChangeSet.remove)) {\n addChanges(in_ownPropertyChangeSet.remove, \"remove\", \"own\");\n } else {\n if (isPrimitiveTypeid) {\n addChanges(in_ownPropertyChangeSet.remove, \"remove\", \"own\");\n } else {\n addChangesWithTypeids(in_ownPropertyChangeSet.remove, \"remove\", \"own\");\n }\n }\n\n if (Array.isArray(io_rebasePropertyChangeSet.remove)) {\n addChanges(io_rebasePropertyChangeSet.remove, \"remove\", \"other\");\n } else {\n if (isPrimitiveTypeid) {\n addChanges(io_rebasePropertyChangeSet.remove, \"remove\", \"other\");\n } else {\n addChangesWithTypeids(io_rebasePropertyChangeSet.remove, \"remove\", \"other\");\n }\n }\n\n if (isPrimitiveTypeid) {\n addChanges(in_ownPropertyChangeSet.insert, \"insert\", \"own\");\n addChanges(in_ownPropertyChangeSet.modify, \"modify\", \"own\");\n addChanges(io_rebasePropertyChangeSet.insert, \"insert\", \"other\");\n addChanges(io_rebasePropertyChangeSet.modify, \"modify\", \"other\");\n } else {\n addChangesWithTypeids(in_ownPropertyChangeSet.insert, \"insert\", \"own\");\n addChangesWithTypeids(in_ownPropertyChangeSet.modify, \"modify\", \"own\");\n addChangesWithTypeids(io_rebasePropertyChangeSet.insert, \"insert\", \"other\");\n addChangesWithTypeids(io_rebasePropertyChangeSet.modify, \"modify\", \"other\");\n }\n\n // Check for modifications that affect the same object\n const changedKeys = Object.keys(changesByKeys);\n for (let i = 0; i < changedKeys.length; i++) {\n const key = changedKeys[i];\n const newPath = in_useSquareBracketsInPath ?\n `${in_basePath}[${PathHelper.quotePathSegmentIfNeeded(key)}]` :\n joinPaths(in_basePath, PathHelper.quotePathSegmentIfNeeded(key), PROPERTY_PATH_DELIMITER);\n\n const modification = changesByKeys[key];\n if (modification.own && modification.other) {\n /*\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 // A key was modified after it had been removed\n if (modification.own === \"modify\" && modification.other === \"modify\") {\n if (isPrimitiveTypeid ||\n (TypeIdHelper.isPrimitiveType(modification.ownTypeid) && modification.ownTypeid !== \"String\")) {\n // We have two modification operations that affect the same entry for a base type.\n // This is a legal operation, the second one will overwrite the first one, but we\n // report it as a possible conflict\n let ownModify = in_ownPropertyChangeSet.modify;\n let rebasedModify = io_rebasePropertyChangeSet.modify;\n if (modification.otherTypeid) {\n ownModify = ownModify[modification.otherTypeid];\n rebasedModify = rebasedModify[modification.otherTypeid];\n }\n\n let conflict = {\n path: newPath,\n type: ConflictType.COLLIDING_SET,\n conflictingChange: ownModify[key],\n };\n out_conflicts.push(conflict);\n // If value is the same, delete the entry\n let ownValue = ownModify[key];\n if (typeof ownValue === \"object\" && ownValue.hasOwnProperty(\"value\")) {\n ownValue = ownValue.value;\n }\n let rebaseValue = rebasedModify[key];\n if (typeof rebaseValue === \"object\" && rebaseValue.hasOwnProperty(\"value\")) {\n rebaseValue = rebaseValue.value;\n }\n if (modification.ownTypeid === \"Int64\" || modification.ownTypeid === \"Uint64\" || ownValue.length === 2) {\n // For (u)int64, values are arrays of 2 elements\n if (ownValue[0] === rebaseValue[0] && ownValue[1] === rebaseValue[1]) {\n delete rebasedModify[key];\n }\n } else {\n if (ownValue === rebaseValue) {\n delete rebasedModify[key];\n }\n }\n } else {\n this.rebaseChangeSetForPropertyEntryWithTypeid(key,\n in_ownPropertyChangeSet.modify[modification.ownTypeid],\n io_rebasePropertyChangeSet.modify[modification.otherTypeid],\n modification.ownTypeid,\n newPath,\n true,\n out_conflicts,\n in_options);\n }\n } else if (modification.own === \"remove\" && modification.other === \"modify\") {\n modifyMap = modification.otherTypeid ? io_rebasePropertyChangeSet.modify[modification.otherTypeid] :\n io_rebasePropertyChangeSet.modify;\n\n // Create the conflict information\n let conflict = {\n path: newPath,\n type: ConflictType.ENTRY_MODIFIED_AFTER_REMOVE,\n conflictingChange: modifyMap[key],\n };\n out_conflicts.push(conflict);\n\n // Delete the modification from the rebased ChangeSet\n delete modifyMap[key];\n } else if (modification.own === \"remove_insert\" && modification.other === \"modify\") {\n // We have a conflicting change. A node was removed and inserted (replaced) in the original\n // ChangeSet and then modified by the rebased ChangeSet. Since the base of the modification\n // can have been changed significantly by this operation, we don't know whether we can\n // apply the modification\n\n // Create the conflict information\n let conflict = {\n path: newPath,\n type: ConflictType.ENTRY_MODIFICATION_AFTER_REMOVE_INSERT,\n conflictingChange: io_rebasePropertyChangeSet.modify[modification.otherTypeid][key],\n };\n out_conflicts.push(conflict);\n\n // Delete the modification from the rebased ChangeSet\n delete io_rebasePropertyChangeSet.modify[key];\n } else if ((modification.own === \"modify\" || modification.own === \"remove\") &&\n (modification.other === \"remove\" || modification.other === \"remove_insert\")) {\n if (modification.own === \"modify\") {\n modifyMap = modification.ownTypeid ? in_ownPropertyChangeSet.modify[modification.ownTypeid] :\n in_ownPropertyChangeSet.modify;\n\n // Create the conflict information\n let conflict = {\n path: newPath,\n type: ConflictType.REMOVE_AFTER_MODIFY,\n conflictingChange: modifyMap[key],\n };\n out_conflicts.push(conflict);\n }\n\n // If we have a duplicated delete, we remove it from the new ChangeSet\n if (modification.own === \"remove\") {\n if (Array.isArray(io_rebasePropertyChangeSet.remove)) {\n io_rebasePropertyChangeSet.remove = without(io_rebasePropertyChangeSet.remove, key);\n } else {\n if (isPrimitiveTypeid) {\n delete io_rebasePropertyChangeSet.remove[key];\n } else {\n delete io_rebasePropertyChangeSet.remove[modification.otherTypeid][key];\n }\n }\n }\n } else if (modification.own === \"insert\" && modification.other === \"insert\") {\n if (isPrimitiveTypeid ||\n (TypeIdHelper.isPrimitiveType(modification.ownTypeid))) {\n let insertMap = modification.otherTypeid ? io_rebasePropertyChangeSet.insert[modification.otherTypeid] :\n io_rebasePropertyChangeSet.insert;\n\n // We have two insert operations that affect the same key for a primitive type.\n // This is a legal operation, the second one will overwrite the first one, but we\n // report it as a possible conflicting set\n let conflict = {\n path: newPath,\n type: ConflictType.COLLIDING_SET,\n conflictingChange: insertMap[key],\n };\n out_conflicts.push(conflict);\n\n // Convert to modify\n let oldValue;\n if (modification.otherTypeid) {\n io_rebasePropertyChangeSet.modify = io_rebasePropertyChangeSet.modify || {};\n io_rebasePropertyChangeSet.modify[modification.otherTypeid] =\n io_rebasePropertyChangeSet.modify[modification.otherTypeid] || {};\n modifyMap = io_rebasePropertyChangeSet.modify[modification.otherTypeid];\n oldValue = in_ownPropertyChangeSet.insert[modification.ownTypeid][key];\n } else {\n io_rebasePropertyChangeSet.modify = io_rebasePropertyChangeSet.modify || {};\n modifyMap = io_rebasePropertyChangeSet.modify;\n oldValue = in_ownPropertyChangeSet.insert[key];\n }\n\n modifyMap[key] = { value: insertMap[key], oldValue };\n delete insertMap[key];\n } else {\n // Here we have two insert operations for objects. Since these affect a whole sub-tree and not\n // just a single value, we cannot easily convert it into a modify and instead report it as invalid\n\n let insertMap = modification.otherTypeid ? io_rebasePropertyChangeSet.insert[modification.otherTypeid] :\n io_rebasePropertyChangeSet.insert;\n\n // Create the conflict information\n let conflict = {\n path: newPath,\n type: ConflictType.INSERTED_ENTRY_WITH_SAME_KEY,\n conflictingChange: insertMap[key],\n };\n out_conflicts.push(conflict);\n\n // Delete the modification from the rebased ChangeSet\n delete insertMap[key];\n }\n } else if (modification.own === \"remove_insert\" && modification.other === \"remove_insert\") {\n let insertMap = modification.otherTypeid ? io_rebasePropertyChangeSet.insert[modification.otherTypeid] :\n io_rebasePropertyChangeSet.insert;\n\n // Raise the duplicate inserts as a conflict\n let conflict = {\n path: newPath,\n type: ConflictType.COLLIDING_SET,\n conflictingChange: insertMap[key],\n };\n out_conflicts.push(conflict);\n } else {\n // All other operations are conflicting changes, which only occur for ChangeSets that are relative\n // to different bases\n\n // Create the conflict information\n let conflict = {\n path: newPath,\n type: ConflictType.INVALID_CHANGESET_BASE,\n conflictingChange: modification.change,\n };\n out_conflicts.push(conflict);\n\n // Remove the change from the ChangeSet\n if (modification.other !== \"remove\") {\n if (modification.otherTypeid !== undefined) {\n delete io_rebasePropertyChangeSet[modification.other][modification.otherTypeid][key];\n } else {\n delete io_rebasePropertyChangeSet[modification.other][key];\n }\n } else {\n // Remove remove operations from the ChangeSet\n if (Array.isArray(io_rebasePropertyChangeSet[modification.other])) {\n io_rebasePropertyChangeSet[modification.other] =\n without(io_rebasePropertyChangeSet[modification.other], key);\n } else {\n delete io_rebasePropertyChangeSet[modification.other][key];\n }\n }\n\n console.error(\"Rebase operation with conflicting ChangeSets. Probably incorrect bases.\");\n }\n }\n }\n\n // Remove unnecessary entries from the ChangeSet\n this._cleanIndexedCollectionChangeSet(io_rebasePropertyChangeSet, !isPrimitiveTypeid);\n };\n\n /**\n * Removes empty entries from the .children collection of the ChangeSet\n *\n * @param in_propertyChanges - The ChangeSet to clean up\n * @param in_containsTypeids - Does this ChangeSet contain typeids\n * @private\n */\n export const _cleanIndexedCollectionChangeSet = function(in_propertyChanges: SerializedChangeSet, in_containsTypeids: boolean) {\n const changes = in_propertyChanges;\n // Clean inserts\n\n // First remove unused typeid sections\n if (in_containsTypeids) {\n let typeidList = Object.keys(changes.insert || {});\n for (let j = 0; j < typeidList.length; j++) {\n if (_fastIsEmptyObject(changes.insert[typeidList[j]])) {\n delete changes.insert[typeidList[j]];\n }\n }\n }\n\n // Remove add group if no operations are present\n if (_fastIsEmptyObject(changes.insert)) {\n delete changes.insert;\n }\n\n // First remove unused typeid sections\n if (in_containsTypeids) {\n let typeidList = Object.keys(changes.remove || {});\n for (let j = 0; j < typeidList.length; j++) {\n if (_fastIsEmptyObject(changes.remove[typeidList[j]])) {\n delete changes.remove[typeidList[j]];\n }\n }\n }\n // Remove remove group if no operations are present\n if (_fastIsEmptyObject(changes.remove)) {\n delete changes.remove;\n }\n\n // Clean modifies\n\n // First remove unused typeid sections\n if (in_containsTypeids) {\n let typeidList = Object.keys(changes.modify || {});\n for (let j = 0; j < typeidList.length; j++) {\n const modifies = changes.modify[typeidList[j]];\n const modifyKeys = Object.keys(modifies);\n for (let k = 0; k < modifyKeys.length; k++) {\n if (isEmptyChangeSet(modifies[modifyKeys[k]])) {\n delete modifies[modifyKeys[k]];\n }\n }\n if (_fastIsEmptyObject(changes.modify[typeidList[j]])) {\n delete changes.modify[typeidList[j]];\n }\n }\n }\n\n // Remove modify group if no operations are present\n if (_fastIsEmptyObject(changes.modify)) {\n delete changes.modify;\n }\n };\n}\n"]}
@@ -21,7 +21,7 @@ const isObject_1 = __importDefault(require("lodash/isObject"));
21
21
  * @returns True if it is an empty changeset.
22
22
  */
23
23
  const isEmptyChangeSet = (in_changeSet) => in_changeSet === undefined ||
24
- (isObject_1.default(in_changeSet) &&
25
- (isEmpty_1.default(in_changeSet) || (Object.keys(in_changeSet).length === 1 && has_1.default(in_changeSet, "typeid"))));
24
+ ((0, isObject_1.default)(in_changeSet) &&
25
+ ((0, isEmpty_1.default)(in_changeSet) || (Object.keys(in_changeSet).length === 1 && (0, has_1.default)(in_changeSet, "typeid"))));
26
26
  exports.isEmptyChangeSet = isEmptyChangeSet;
27
27
  //# sourceMappingURL=isEmptyChangeset.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isEmptyChangeset.js","sourceRoot":"","sources":["../../src/changeset_operations/isEmptyChangeset.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;;;;AAEF,6DAAqC;AACrC,qDAA6B;AAC7B,+DAAuC;AAIxC;;;;;GAKG;AACI,MAAM,gBAAgB,GAAG,CAAC,YAAiC,EAAW,EAAE,CAAC,YAAY,KAAK,SAAS;IAClG,CAAC,kBAAQ,CAAC,YAAY,CAAC;QACnB,CAAC,iBAAO,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,aAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAFnG,QAAA,gBAAgB,oBAEmF","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Helper function to check whether a changeset is empty\n */\n\n import isEmpty from \"lodash/isEmpty\";\n import has from \"lodash/has\";\n import isObject from \"lodash/isObject\";\n\n import { SerializedChangeSet } from \"../changeset\";\n\n/**\n * Helper function which checks whether a given serialized changeSet is an empty changeSet.\n *\n * @param in_changeSet - The changeset to test\n * @returns True if it is an empty changeset.\n */\nexport const isEmptyChangeSet = (in_changeSet: SerializedChangeSet): boolean => in_changeSet === undefined ||\n (isObject(in_changeSet) &&\n (isEmpty(in_changeSet) || (Object.keys(in_changeSet).length === 1 && has(in_changeSet, \"typeid\"))));\n"]}
1
+ {"version":3,"file":"isEmptyChangeset.js","sourceRoot":"","sources":["../../src/changeset_operations/isEmptyChangeset.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;;;;AAEF,6DAAqC;AACrC,qDAA6B;AAC7B,+DAAuC;AAIxC;;;;;GAKG;AACI,MAAM,gBAAgB,GAAG,CAAC,YAAiC,EAAW,EAAE,CAAC,YAAY,KAAK,SAAS;IAClG,CAAC,IAAA,kBAAQ,EAAC,YAAY,CAAC;QACnB,CAAC,IAAA,iBAAO,EAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,IAAA,aAAG,EAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAFnG,QAAA,gBAAgB,oBAEmF","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Helper function to check whether a changeset is empty\n */\n\n import isEmpty from \"lodash/isEmpty\";\n import has from \"lodash/has\";\n import isObject from \"lodash/isObject\";\n\n import { SerializedChangeSet } from \"../changeset\";\n\n/**\n * Helper function which checks whether a given serialized changeSet is an empty changeSet.\n *\n * @param in_changeSet - The changeset to test\n * @returns True if it is an empty changeset.\n */\nexport const isEmptyChangeSet = (in_changeSet: SerializedChangeSet): boolean => in_changeSet === undefined ||\n (isObject(in_changeSet) &&\n (isEmpty(in_changeSet) || (Object.keys(in_changeSet).length === 1 && has(in_changeSet, \"typeid\"))));\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAC,MAAM,SAAS,CAAC;AAE/B,QAAA,MAAQ,gBAAgB,+BAAU,CAAC;AAEnC,OAAO,EACH,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,KAAK,EACL,UAAU,EACV,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,GACnB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,QAAA,MAAQ,gBAAgB,+BAAU,CAAC;AAEnC,OAAO,EACH,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,KAAK,EACL,UAAU,EACV,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,GACnB,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2CAA6D;AAezD,0FAfK,qBAAS,OAeL;AAdb,0FAAuF;AAiBnF,uGAjBK,+CAAsB,OAiBL;AAhB1B,yDAAwE;AAYpE,6FAZuB,2BAAY,OAYvB;AAXhB,6CAA0C;AActC,2FAdK,uBAAU,OAcL;AAbd,qCAAiD;AAe7C,sGAfK,8BAAqB,OAeL;AAdzB,qDAAkD;AAO9C,+FAPK,+BAAc,OAOL;AANlB,2DAAwD;AAOpD,kGAPK,qCAAiB,OAOL;AANrB,mCAA+B;AAS3B,sFATK,aAAK,OASL;AAPT,MAAM,EAAE,gBAAgB,EAAE,GAAG,aAAK,CAAC;AAY/B,4CAAgB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ChangeSet, SerializedChangeSet } from \"./changeset\";\nimport { ArrayChangeSetIterator } from \"./changeset_operations/arrayChangesetIterator\";\nimport { ExtractedContext, TypeIdHelper } from \"./helpers/typeidHelper\";\nimport { PathHelper } from \"./pathHelper\";\nimport { rebaseToRemoteChanges } from \"./rebase\";\nimport { TemplateSchema } from \"./templateSchema\";\nimport { TemplateValidator } from \"./templateValidator\";\nimport { Utils} from \"./utils\";\n\nconst { TraversalContext } = Utils;\n\nexport {\n TemplateSchema,\n TemplateValidator,\n TypeIdHelper,\n ChangeSet,\n Utils,\n PathHelper,\n ArrayChangeSetIterator,\n rebaseToRemoteChanges,\n SerializedChangeSet,\n TraversalContext,\n ExtractedContext,\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2CAA6D;AAezD,0FAfK,qBAAS,OAeL;AAdb,0FAAuF;AAiBnF,uGAjBK,+CAAsB,OAiBL;AAhB1B,yDAAwE;AAYpE,6FAZuB,2BAAY,OAYvB;AAXhB,6CAA0C;AActC,2FAdK,uBAAU,OAcL;AAbd,qCAAiD;AAe7C,sGAfK,8BAAqB,OAeL;AAdzB,qDAAkD;AAO9C,+FAPK,+BAAc,OAOL;AANlB,2DAAwD;AAOpD,kGAPK,qCAAiB,OAOL;AANrB,mCAAgC;AAS5B,sFATK,aAAK,OASL;AAPT,MAAM,EAAE,gBAAgB,EAAE,GAAG,aAAK,CAAC;AAY/B,4CAAgB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ChangeSet, SerializedChangeSet } from \"./changeset\";\nimport { ArrayChangeSetIterator } from \"./changeset_operations/arrayChangesetIterator\";\nimport { ExtractedContext, TypeIdHelper } from \"./helpers/typeidHelper\";\nimport { PathHelper } from \"./pathHelper\";\nimport { rebaseToRemoteChanges } from \"./rebase\";\nimport { TemplateSchema } from \"./templateSchema\";\nimport { TemplateValidator } from \"./templateValidator\";\nimport { Utils } from \"./utils\";\n\nconst { TraversalContext } = Utils;\n\nexport {\n TemplateSchema,\n TemplateValidator,\n TypeIdHelper,\n ChangeSet,\n Utils,\n PathHelper,\n ArrayChangeSetIterator,\n rebaseToRemoteChanges,\n SerializedChangeSet,\n TraversalContext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AAQ,CAAC,CAAC,CAAC,CAAC,EAAE;gBACrC,OAAO;oBACH,cAAc,EAAE,cAAc,CAAC,aAAa;oBAC5C,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;iBAC1B,CAAC;aACL;SACJ;QACD,sEAAsE;QACtE,mDAAmD;QACnD,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;gBACrC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;aAC3B;SACJ;QACD,IAAI,KAAK,CAAC,MAAM,EAAE;YACd,+DAA+D;YAC/D,OAAO;gBACH,cAAc,EAAE,cAAc,CAAC,cAAc;gBAC7C,QAAQ,EAAE,KAAK;aAClB,CAAC;SACL;QAED,yDAAyD;QACzD,OAAO;YACH,cAAc,EAAE,cAAc,CAAC,SAAS;YACxC,QAAQ,EAAE,KAAK;SAClB,CAAC;IACN,CAAC,CAAC;AACN,CAAC,EA1egB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QA0e1B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Helper functions to work with path strings\n */\n\n// @ts-ignore\nimport { constants } from '@fluid-experimental/property-common';\n\nconst { PROPERTY_PATH_DELIMITER, MSG } = constants;\n\nexport type PathTree = Map<String, PathTree>;\n\n/**\n * Helper functions for string processing\n */\nexport namespace PathHelper {\n\n const RE_ALL_OPEN_SQUARE_BRACKETS = new RegExp(\"[[]\", \"g\");\n\n /**\n * Token Types\n * Type of the token in the path string\n */\n export enum TOKEN_TYPES {\n /** A normal path segment, separated via . */\n PATH_SEGMENT_TOKEN,\n /** An array path segment, separated via [ ] */\n ARRAY_TOKEN,\n /** A / at the beginning of the path */\n PATH_ROOT_TOKEN,\n /** A * that indicates a dereferencing operation */ // note: reversed!\n DEREFERENCE_TOKEN,\n /** A ../ that indicates one step above the current path */\n RAISE_LEVEL_TOKEN,\n }\n\n /**\n * Tokenizes a path string\n *\n * @param in_path - The path string to divide into tokens\n * @param out_types - The types of the tokens\n *\n * @returns the tokens from the path string\n */\n export const tokenizePathString = function(in_path: string, out_types?: TOKEN_TYPES[]): string[] { // eslint-disable-line complexity\n const tokens = [];\n let currentToken = \"\";\n\n if (out_types) {\n // Make sure out_types is empty\n out_types.splice(0, out_types.length);\n }\n\n // Handle a / at the beginning of the path by adding a special token for it\n let path_start = 0;\n if (in_path[0] === \"/\") {\n tokens.push(\"/\");\n if (out_types) {\n out_types.push(TOKEN_TYPES.PATH_ROOT_TOKEN);\n }\n path_start = 1;\n } else if (in_path.substr(0, 3) === \"../\") {\n // Handle relative paths by extracting the number steps above\n var extractLevel = function(current_path) {\n if (current_path.substr(0, 3) === \"../\") {\n if (out_types) {\n out_types.push(TOKEN_TYPES.RAISE_LEVEL_TOKEN);\n }\n tokens.push(\"../\");\n extractLevel(current_path.substr(3));\n path_start = path_start + 3;\n }\n };\n extractLevel(in_path);\n }\n\n // Let's see if the path is simple enough to use a fast-track algorithm.\n let hackedPath = in_path.substr(path_start);\n if (in_path.indexOf(\"\\\\\") === -1 && in_path.indexOf('\"') === -1 && in_path.indexOf(\"*\") === -1) {\n // Yes, we can do something faster than parsing each character one by one.\n let additionalTokens: string[] = [];\n const additionalTypes = [];\n let token: string | string[];\n let i: number;\n // Hack for simplicity, let's first replace all occurences of '[' by '.['\n hackedPath = hackedPath.replace(RE_ALL_OPEN_SQUARE_BRACKETS, \".[\");\n // Then split on '.'\n additionalTokens = hackedPath.split(\".\");\n // And validate each token.\n for (i = 0; i < additionalTokens.length; ++i) {\n token = additionalTokens[i];\n // Empty tokens are considered errors... but shouldn't '' be a valid name?\n if (token.length === 0) {\n // There's an error somewhere. Let's abort the fast-track.\n break;\n } else if (token[0] === \"[\") {\n if (token.length > 2 && token[token.length - 1] === \"]\") {\n additionalTypes.push(TOKEN_TYPES.ARRAY_TOKEN);\n additionalTokens[i] = token.substr(1, token.length - 2);\n } else {\n // There's an error somewhere. Let's abort the fast-track.\n break;\n }\n } else {\n if (token.indexOf(\"]\") !== -1) {\n // There's an error somewhere. Let's abort the fast-track.\n break;\n } else {\n // It was a simple property name.\n additionalTypes.push(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n }\n }\n }\n if (i === additionalTokens.length) {\n // Parsed everything successfully so end function here.\n if (out_types) {\n for (i = 0; i < additionalTypes.length; i++) {\n out_types.push(additionalTypes[i]);\n }\n }\n return tokens.concat(additionalTokens);\n }\n }\n\n let inSquareBrackets = false;\n let tokenStarted = false;\n let lastTokenWasQuoted = false;\n\n // We are in a context where an empty token is valid\n let atStartToken = false;\n let allowSegmentStart = true;\n\n const storeNextToken = function(tokenType) {\n // Make sure, this is not an empty token (E.g. a .. or a [] )\n if (!tokenStarted) {\n if (!atStartToken) {\n throw new Error(MSG.EMPTY_TOKEN + in_path);\n } else {\n return;\n }\n }\n\n // Store the token\n tokens.push(currentToken);\n currentToken = \"\";\n tokenStarted = false;\n atStartToken = false;\n lastTokenWasQuoted = false;\n allowSegmentStart = false;\n\n if (out_types) {\n out_types.push(tokenType);\n }\n };\n\n for (var i = path_start; i < in_path.length; i++) {\n const character = in_path[i];\n\n if (character === '\"') {\n // If we encounter a quotation mark, we start parsing the\n // quoted section\n if (!tokenStarted) {\n let endFound = false;\n\n // Read the quoted token\n for (i++; i < in_path.length; i++) {\n if (in_path[i] === '\"') {\n // We have found the end of the quoted token\n endFound = true;\n break;\n } else if (in_path[i] === \"\\\\\") {\n // Read an escaped symbol\n if (in_path.length > i + 1) {\n if (in_path[i + 1] === \"\\\\\") {\n currentToken += \"\\\\\";\n i++;\n } else if (in_path[i + 1] === '\"') {\n currentToken += '\"';\n i++;\n } else {\n throw new Error(MSG.INVALID_ESCAPE_SEQUENCE + in_path);\n }\n } else {\n throw new Error(MSG.INVALID_ESCAPE_SEQUENCE + in_path);\n }\n } else {\n // Everything else is just added to the token\n currentToken += in_path[i];\n }\n }\n\n if (!endFound) {\n throw new Error(MSG.UNCLOSED_QUOTATION_MARKS + in_path);\n }\n lastTokenWasQuoted = true;\n tokenStarted = true;\n } else {\n throw new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n }\n } else if (!inSquareBrackets) {\n if (character === PROPERTY_PATH_DELIMITER) {\n // A dot symbols starts a new token\n storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n\n allowSegmentStart = true;\n } else if (character === \"[\") {\n // An opening square bracket starts a new token\n if (tokenStarted) {\n storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n }\n\n // And sets the state to inSquareBrackets\n inSquareBrackets = true;\n } else if (character === \"]\") {\n throw new Error(MSG.CLOSING_BRACKET_WITHOUT_OPENING + in_path);\n } else if (character === \"*\") {\n // Store the last token\n if (tokenStarted) {\n storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n }\n\n // Create a new dereference token\n tokens.push(\"*\");\n if (out_types) {\n out_types.push(TOKEN_TYPES.DEREFERENCE_TOKEN);\n }\n\n // Reset the token started flag\n tokenStarted = false;\n atStartToken = true;\n allowSegmentStart = false;\n } else {\n if (!tokenStarted &&\n !allowSegmentStart &&\n !inSquareBrackets) {\n throw new Error(MSG.MISSING_DOT_AT_SEGMENT_START + in_path);\n }\n\n currentToken += character;\n\n // We have started parsing the token\n tokenStarted = true;\n\n // When a symbols appears after a closing quotation mark, we have an error\n if (lastTokenWasQuoted) {\n throw new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n }\n }\n } else {\n if (character === \"]\") {\n // A closing square bracket starts a new token\n storeNextToken(TOKEN_TYPES.ARRAY_TOKEN);\n\n // We now have to check the next character,\n // as only the combinations '][' and '].' are\n // valid\n if (in_path.length > i + 1) { // We only have to check this at the end of the string\n if (in_path[i + 1] === PROPERTY_PATH_DELIMITER) {\n // We are no longer in square brackets\n inSquareBrackets = false;\n allowSegmentStart = true;\n i++;\n } else if (in_path[i + 1] === \"[\") {\n // We remain in square brackets\n // so inSquareBrackets remains true;\n i++;\n } else if (in_path[i + 1] === \"*\") {\n // We leave the square brackets\n inSquareBrackets = false;\n } else {\n throw new Error(MSG.INVALID_END_OF_SQUARE_BRACKETS + in_path);\n }\n } else {\n inSquareBrackets = false;\n tokenStarted = false;\n }\n } else if (character === PROPERTY_PATH_DELIMITER) {\n throw new Error(MSG.DOTS_IN_SQUARE_BRACKETS + in_path);\n } else {\n currentToken += character;\n\n // We have started parsing the token\n tokenStarted = true;\n\n // When a symbols appears after a closing quotation mark, we have an error\n if (lastTokenWasQuoted) {\n throw new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n }\n }\n }\n }\n\n // At the end of the path we have to distinguish a few error cases\n if (inSquareBrackets) {\n // There was a un-closed bracket at the end\n throw new Error(MSG.UNCLOSED_BRACKETS + in_path);\n } else if (in_path[in_path.length - 1] === PROPERTY_PATH_DELIMITER) {\n // A path ended with a PROPERTY_PATH_DELIMITER\n throw new Error(MSG.DOT_AT_END + in_path);\n } else if (tokenStarted) {\n // There was a valid, not yet ended token\n storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n }\n\n return tokens;\n };\n\n /**\n * Creates a quoted string for a path seqment to make sure it parses correctly\n *\n * @param in_pathSegment - The path string to put in quotes\n *\n * @returns quoted path string\n */\n export const quotePathSegment = function(in_pathSegment: string): string {\n // WARNING: I use RegExps here, as the normal replace\n // function only replaces the first occurrence\n\n // First we escape escape symbols\n in_pathSegment = in_pathSegment.replace(/\\\\/g, \"\\\\\\\\\");\n\n // Then we escape quotes\n in_pathSegment = in_pathSegment.replace(/\"/g, '\\\\\"');\n\n // And finally, we put the string into quotation marks\n return `\"${in_pathSegment}\"`;\n };\n\n /**\n * Reverse a quoted/escaped string for a path seqment\n *\n * @param in_quotedPathSegment - The quoted/escaped path string to put in quotes\n *\n * @return unquoted path string\n */\n export const unquotePathSegment = function(in_quotedPathSegment: string): string {\n if (typeof in_quotedPathSegment !== \"string\") {\n throw new Error(`Expecting a string as a path: ${in_quotedPathSegment}`);\n }\n\n if (in_quotedPathSegment[0] === '\"' && in_quotedPathSegment[in_quotedPathSegment.length - 1] === '\"') {\n // We remove double quotes\n in_quotedPathSegment = in_quotedPathSegment.substr(1, in_quotedPathSegment.length - 2);\n\n // Then we unescape escape symbols\n in_quotedPathSegment = in_quotedPathSegment.replace(/\\\\\\\\/g, \"\\\\\");\n\n // Then we unescape quotes\n in_quotedPathSegment = in_quotedPathSegment.replace(/\\\\\"/g, '\"');\n }\n\n return in_quotedPathSegment;\n };\n\n /**\n * Adds quotation marks to a path string if they are needed\n *\n * @param in_pathSegment - The path string to put in quotes\n *\n * @returns quoted path string\n */\n export const quotePathSegmentIfNeeded = function(in_pathSegment: string): string {\n if (in_pathSegment.indexOf(PROPERTY_PATH_DELIMITER) !== -1 ||\n in_pathSegment.indexOf('\"') !== -1 ||\n in_pathSegment.indexOf(\"\\\\\") !== -1 ||\n in_pathSegment.indexOf(\"/\") !== -1 ||\n in_pathSegment.indexOf(\"*\") !== -1 ||\n in_pathSegment.indexOf(\"[\") !== -1 ||\n in_pathSegment.indexOf(\"]\") !== -1 ||\n in_pathSegment.length === 0) {\n return quotePathSegment(in_pathSegment);\n } else {\n return in_pathSegment;\n }\n };\n\n /**\n * This function checks, whether the supplied path is a valid repository absolute path.\n *\n * It has to be either an empty string, or a path starting with a /\n *\n * @param in_path - The path to check\n */\n export const checkValidRepositoryAbsolutePath = function(in_path: string) {\n if (in_path !== \"\" && // either an empty reference\n in_path[0] !== \"/\") { // or an absolute path starting with /\n throw new Error(MSG.INVALID_PATH_IN_REFERENCE);\n }\n };\n\n /**\n * This utility function provides a canonical representation of an absolute property path.\n * It is useful to compare partial checkout paths and property paths.\n * The canonical form of paths is not suitable for ChangeSets.\n *\n * @param in_absolutePath - The absolute path to make canonical\n * @return Absolute path in canonical form\n */\n export const convertAbsolutePathToCanonical = function(in_absolutePath: string): string {\n const tokenTypes = [];\n const tokens = tokenizePathString(in_absolutePath, tokenTypes);\n let path = \"\";\n for (let i = 0; i < tokenTypes.length; i++) {\n const tokenType = tokenTypes[i];\n switch (tokenType) {\n case TOKEN_TYPES.PATH_ROOT_TOKEN:\n // Skip the leading '/'\n break;\n case TOKEN_TYPES.RAISE_LEVEL_TOKEN:\n throw new Error(`No level up (\"../\") is expected in an absolute path: ${in_absolutePath}`);\n case TOKEN_TYPES.DEREFERENCE_TOKEN:\n throw new Error(`Dereference (\"*\") is not supported in canonical paths: ${in_absolutePath}`);\n case TOKEN_TYPES.ARRAY_TOKEN:\n case TOKEN_TYPES.PATH_SEGMENT_TOKEN:\n path += (PROPERTY_PATH_DELIMITER + quotePathSegmentIfNeeded(tokens[i]));\n break;\n default:\n break;\n }\n }\n // Removes the leading PROPERTY_PATH_DELIMITER.\n if (path) {\n path = path.substring(1);\n }\n return path;\n };\n\n /**\n * This utility function provides a canonical representation of a child property path.\n * It is useful to compare partial checkout paths and property paths.\n * The canonical form of paths is not suitable for ChangeSets.\n *\n * @param in_parentAbsolutePathCanonical - The absolute path of the parent property in canonical form\n * @param in_childId - The name of the child property in its parent\n * @returns Absolute path of the child property in canonical form\n */\n export const getChildAbsolutePathCanonical = function(in_parentAbsolutePathCanonical: string, in_childId: string): string {\n const childPath = quotePathSegmentIfNeeded(String(in_childId));\n if (in_parentAbsolutePathCanonical) {\n return (in_parentAbsolutePathCanonical + PROPERTY_PATH_DELIMITER + childPath);\n } else {\n return childPath;\n }\n };\n\n export enum CoverageExtent {\n // The base path is not covered by any path from a given list of paths.\n // This means a property with this path and all its children would not be covered.\n UNCOVERED,\n // The base path is partially covered by at least one path from a given list of paths.\n // This means a property with this path would be covered, but some of its children could be uncovered.\n PARTLY_COVERED,\n // The base path is fully covered by at least one path from a given list of paths.\n // This means a property with this path would be covered and all of its children would be covered also.\n FULLY_COVERED,\n }\n\n interface BasePathCoverage {\n coverageExtent: CoverageExtent,\n pathList: string[],\n }\n\n /**\n * Determines if the base path is covered by the given list of paths. From that you can deduce if a\n * property with that path and all its children are covered by the given list of paths.\n *\n * This function uses the canonical representation of the property paths.\n *\n * @param in_basePath - The property's absolute path in canonical form\n * @param in_paths - The array of paths that must cover the property and its children\n * @returns The coverage of the property and its children. For a coverage of\n * 'FULLY_COVERED', only the first matching path is returned.\n */\n export const getPathCoverage = function(in_basePath: string, in_paths: string[]): BasePathCoverage {\n // First, check if the base path is entirely included in one of the paths\n for (let i = 0; i < in_paths.length; i++) {\n if (in_basePath.startsWith(in_paths[i])) {\n return {\n coverageExtent: CoverageExtent.FULLY_COVERED,\n pathList: [in_paths[i]],\n };\n }\n }\n // We did not find a path including all the children of this insertion\n // Let's check if there are paths going through it.\n const paths = [];\n for (let i = 0; i < in_paths.length; i++) {\n if (in_paths[i].startsWith(in_basePath)) {\n paths.push(in_paths[i]);\n }\n }\n if (paths.length) {\n // We found at least one path including parts of the base path.\n return {\n coverageExtent: CoverageExtent.PARTLY_COVERED,\n pathList: paths,\n };\n }\n\n // We did not find any path covering the given base path.\n return {\n coverageExtent: CoverageExtent.UNCOVERED,\n pathList: paths,\n };\n };\n}\n"]}
1
+ {"version":3,"file":"pathHelper.js","sourceRoot":"","sources":["../src/pathHelper.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;AAEH,aAAa;AACb,yEAAgE;AAEhE,MAAM,EAAE,uBAAuB,EAAE,GAAG,EAAE,GAAG,2BAAS,CAAC;AAInD;;GAEG;AACH,IAAiB,UAAU,CA0e1B;AA1eD,WAAiB,UAAU;IAEvB,MAAM,2BAA2B,GAAG,IAAI,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAE3D;;;OAGG;IACH,IAAY,WAWX;IAXD,WAAY,WAAW;QACnB,6CAA6C;QAC7C,yEAAkB,CAAA;QAClB,+CAA+C;QAC/C,2D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AC3B;SACJ;QACD,IAAI,KAAK,CAAC,MAAM,EAAE;YACd,+DAA+D;YAC/D,OAAO;gBACH,cAAc,EAAE,cAAc,CAAC,cAAc;gBAC7C,QAAQ,EAAE,KAAK;aAClB,CAAC;SACL;QAED,yDAAyD;QACzD,OAAO;YACH,cAAc,EAAE,cAAc,CAAC,SAAS;YACxC,QAAQ,EAAE,KAAK;SAClB,CAAC;IACN,CAAC,CAAC;AACN,CAAC,EA1egB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QA0e1B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Helper functions to work with path strings\n */\n\n// @ts-ignore\nimport { constants } from '@fluid-experimental/property-common';\n\nconst { PROPERTY_PATH_DELIMITER, MSG } = constants;\n\nexport type PathTree = Map<String, PathTree>;\n\n/**\n * Helper functions for string processing\n */\nexport namespace PathHelper {\n\n const RE_ALL_OPEN_SQUARE_BRACKETS = new RegExp(\"[[]\", \"g\");\n\n /**\n * Token Types\n * Type of the token in the path string\n */\n export enum TOKEN_TYPES {\n /** A normal path segment, separated via . */\n PATH_SEGMENT_TOKEN,\n /** An array path segment, separated via [ ] */\n ARRAY_TOKEN,\n /** A / at the beginning of the path */\n PATH_ROOT_TOKEN,\n /** A * that indicates a dereferencing operation */ // note: reversed!\n DEREFERENCE_TOKEN,\n /** A ../ that indicates one step above the current path */\n RAISE_LEVEL_TOKEN,\n }\n\n /**\n * Tokenizes a path string\n *\n * @param in_path - The path string to divide into tokens\n * @param out_types - The types of the tokens\n *\n * @returns the tokens from the path string\n */\n export const tokenizePathString = function(in_path: string, out_types?: TOKEN_TYPES[]): string[] { // eslint-disable-line complexity\n const tokens = [];\n let currentToken = \"\";\n\n if (out_types) {\n // Make sure out_types is empty\n out_types.splice(0, out_types.length);\n }\n\n // Handle a / at the beginning of the path by adding a special token for it\n let path_start = 0;\n if (in_path[0] === \"/\") {\n tokens.push(\"/\");\n if (out_types) {\n out_types.push(TOKEN_TYPES.PATH_ROOT_TOKEN);\n }\n path_start = 1;\n } else if (in_path.substr(0, 3) === \"../\") {\n // Handle relative paths by extracting the number steps above\n var extractLevel = function(current_path) {\n if (current_path.substr(0, 3) === \"../\") {\n if (out_types) {\n out_types.push(TOKEN_TYPES.RAISE_LEVEL_TOKEN);\n }\n tokens.push(\"../\");\n extractLevel(current_path.substr(3));\n path_start = path_start + 3;\n }\n };\n extractLevel(in_path);\n }\n\n // Let's see if the path is simple enough to use a fast-track algorithm.\n let hackedPath = in_path.substr(path_start);\n if (in_path.indexOf(\"\\\\\") === -1 && in_path.indexOf('\"') === -1 && in_path.indexOf(\"*\") === -1) {\n // Yes, we can do something faster than parsing each character one by one.\n let additionalTokens: string[] = [];\n const additionalTypes = [];\n let token: string | string[];\n let i: number;\n // Hack for simplicity, let's first replace all occurences of '[' by '.['\n hackedPath = hackedPath.replace(RE_ALL_OPEN_SQUARE_BRACKETS, \".[\");\n // Then split on '.'\n additionalTokens = hackedPath.split(\".\");\n // And validate each token.\n for (i = 0; i < additionalTokens.length; ++i) {\n token = additionalTokens[i];\n // Empty tokens are considered errors... but shouldn't '' be a valid name?\n if (token.length === 0) {\n // There's an error somewhere. Let's abort the fast-track.\n break;\n } else if (token[0] === \"[\") {\n if (token.length > 2 && token[token.length - 1] === \"]\") {\n additionalTypes.push(TOKEN_TYPES.ARRAY_TOKEN);\n additionalTokens[i] = token.substr(1, token.length - 2);\n } else {\n // There's an error somewhere. Let's abort the fast-track.\n break;\n }\n } else {\n if (token.indexOf(\"]\") !== -1) {\n // There's an error somewhere. Let's abort the fast-track.\n break;\n } else {\n // It was a simple property name.\n additionalTypes.push(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n }\n }\n }\n if (i === additionalTokens.length) {\n // Parsed everything successfully so end function here.\n if (out_types) {\n for (i = 0; i < additionalTypes.length; i++) {\n out_types.push(additionalTypes[i]);\n }\n }\n return tokens.concat(additionalTokens);\n }\n }\n\n let inSquareBrackets = false;\n let tokenStarted = false;\n let lastTokenWasQuoted = false;\n\n // We are in a context where an empty token is valid\n let atStartToken = false;\n let allowSegmentStart = true;\n\n const storeNextToken = function(tokenType) {\n // Make sure, this is not an empty token (E.g. a .. or a [] )\n if (!tokenStarted) {\n if (!atStartToken) {\n throw new Error(MSG.EMPTY_TOKEN + in_path);\n } else {\n return;\n }\n }\n\n // Store the token\n tokens.push(currentToken);\n currentToken = \"\";\n tokenStarted = false;\n atStartToken = false;\n lastTokenWasQuoted = false;\n allowSegmentStart = false;\n\n if (out_types) {\n out_types.push(tokenType);\n }\n };\n\n for (var i = path_start; i < in_path.length; i++) {\n const character = in_path[i];\n\n if (character === '\"') {\n // If we encounter a quotation mark, we start parsing the\n // quoted section\n if (!tokenStarted) {\n let endFound = false;\n\n // Read the quoted token\n for (i++; i < in_path.length; i++) {\n if (in_path[i] === '\"') {\n // We have found the end of the quoted token\n endFound = true;\n break;\n } else if (in_path[i] === \"\\\\\") {\n // Read an escaped symbol\n if (in_path.length > i + 1) {\n if (in_path[i + 1] === \"\\\\\") {\n currentToken += \"\\\\\";\n i++;\n } else if (in_path[i + 1] === '\"') {\n currentToken += '\"';\n i++;\n } else {\n throw new Error(MSG.INVALID_ESCAPE_SEQUENCE + in_path);\n }\n } else {\n throw new Error(MSG.INVALID_ESCAPE_SEQUENCE + in_path);\n }\n } else {\n // Everything else is just added to the token\n currentToken += in_path[i];\n }\n }\n\n if (!endFound) {\n throw new Error(MSG.UNCLOSED_QUOTATION_MARKS + in_path);\n }\n lastTokenWasQuoted = true;\n tokenStarted = true;\n } else {\n throw new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n }\n } else if (!inSquareBrackets) {\n if (character === PROPERTY_PATH_DELIMITER) {\n // A dot symbols starts a new token\n storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n\n allowSegmentStart = true;\n } else if (character === \"[\") {\n // An opening square bracket starts a new token\n if (tokenStarted) {\n storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n }\n\n // And sets the state to inSquareBrackets\n inSquareBrackets = true;\n } else if (character === \"]\") {\n throw new Error(MSG.CLOSING_BRACKET_WITHOUT_OPENING + in_path);\n } else if (character === \"*\") {\n // Store the last token\n if (tokenStarted) {\n storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n }\n\n // Create a new dereference token\n tokens.push(\"*\");\n if (out_types) {\n out_types.push(TOKEN_TYPES.DEREFERENCE_TOKEN);\n }\n\n // Reset the token started flag\n tokenStarted = false;\n atStartToken = true;\n allowSegmentStart = false;\n } else {\n if (!tokenStarted &&\n !allowSegmentStart &&\n !inSquareBrackets) {\n throw new Error(MSG.MISSING_DOT_AT_SEGMENT_START + in_path);\n }\n\n currentToken += character;\n\n // We have started parsing the token\n tokenStarted = true;\n\n // When a symbols appears after a closing quotation mark, we have an error\n if (lastTokenWasQuoted) {\n throw new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n }\n }\n } else {\n if (character === \"]\") {\n // A closing square bracket starts a new token\n storeNextToken(TOKEN_TYPES.ARRAY_TOKEN);\n\n // We now have to check the next character,\n // as only the combinations '][' and '].' are\n // valid\n if (in_path.length > i + 1) { // We only have to check this at the end of the string\n if (in_path[i + 1] === PROPERTY_PATH_DELIMITER) {\n // We are no longer in square brackets\n inSquareBrackets = false;\n allowSegmentStart = true;\n i++;\n } else if (in_path[i + 1] === \"[\") {\n // We remain in square brackets\n // so inSquareBrackets remains true;\n i++;\n } else if (in_path[i + 1] === \"*\") {\n // We leave the square brackets\n inSquareBrackets = false;\n } else {\n throw new Error(MSG.INVALID_END_OF_SQUARE_BRACKETS + in_path);\n }\n } else {\n inSquareBrackets = false;\n tokenStarted = false;\n }\n } else if (character === PROPERTY_PATH_DELIMITER) {\n throw new Error(MSG.DOTS_IN_SQUARE_BRACKETS + in_path);\n } else {\n currentToken += character;\n\n // We have started parsing the token\n tokenStarted = true;\n\n // When a symbols appears after a closing quotation mark, we have an error\n if (lastTokenWasQuoted) {\n throw new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n }\n }\n }\n }\n\n // At the end of the path we have to distinguish a few error cases\n if (inSquareBrackets) {\n // There was a un-closed bracket at the end\n throw new Error(MSG.UNCLOSED_BRACKETS + in_path);\n } else if (in_path[in_path.length - 1] === PROPERTY_PATH_DELIMITER) {\n // A path ended with a PROPERTY_PATH_DELIMITER\n throw new Error(MSG.DOT_AT_END + in_path);\n } else if (tokenStarted) {\n // There was a valid, not yet ended token\n storeNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n }\n\n return tokens;\n };\n\n /**\n * Creates a quoted string for a path seqment to make sure it parses correctly\n *\n * @param in_pathSegment - The path string to put in quotes\n *\n * @returns quoted path string\n */\n export const quotePathSegment = function(in_pathSegment: string): string {\n // WARNING: I use RegExps here, as the normal replace\n // function only replaces the first occurrence\n\n // First we escape escape symbols\n in_pathSegment = in_pathSegment.replace(/\\\\/g, \"\\\\\\\\\");\n\n // Then we escape quotes\n in_pathSegment = in_pathSegment.replace(/\"/g, '\\\\\"');\n\n // And finally, we put the string into quotation marks\n return `\"${in_pathSegment}\"`;\n };\n\n /**\n * Reverse a quoted/escaped string for a path seqment\n *\n * @param in_quotedPathSegment - The quoted/escaped path string to put in quotes\n *\n * @return unquoted path string\n */\n export const unquotePathSegment = function(in_quotedPathSegment: string): string {\n if (typeof in_quotedPathSegment !== \"string\") {\n throw new Error(`Expecting a string as a path: ${in_quotedPathSegment}`);\n }\n\n if (in_quotedPathSegment[0] === '\"' && in_quotedPathSegment[in_quotedPathSegment.length - 1] === '\"') {\n // We remove double quotes\n in_quotedPathSegment = in_quotedPathSegment.substr(1, in_quotedPathSegment.length - 2);\n\n // Then we unescape escape symbols\n in_quotedPathSegment = in_quotedPathSegment.replace(/\\\\\\\\/g, \"\\\\\");\n\n // Then we unescape quotes\n in_quotedPathSegment = in_quotedPathSegment.replace(/\\\\\"/g, '\"');\n }\n\n return in_quotedPathSegment;\n };\n\n /**\n * Adds quotation marks to a path string if they are needed\n *\n * @param in_pathSegment - The path string to put in quotes\n *\n * @returns quoted path string\n */\n export const quotePathSegmentIfNeeded = function(in_pathSegment: string): string {\n if (in_pathSegment.indexOf(PROPERTY_PATH_DELIMITER) !== -1 ||\n in_pathSegment.indexOf('\"') !== -1 ||\n in_pathSegment.indexOf(\"\\\\\") !== -1 ||\n in_pathSegment.indexOf(\"/\") !== -1 ||\n in_pathSegment.indexOf(\"*\") !== -1 ||\n in_pathSegment.indexOf(\"[\") !== -1 ||\n in_pathSegment.indexOf(\"]\") !== -1 ||\n in_pathSegment.length === 0) {\n return quotePathSegment(in_pathSegment);\n } else {\n return in_pathSegment;\n }\n };\n\n /**\n * This function checks, whether the supplied path is a valid repository absolute path.\n *\n * It has to be either an empty string, or a path starting with a /\n *\n * @param in_path - The path to check\n */\n export const checkValidRepositoryAbsolutePath = function(in_path: string) {\n if (in_path !== \"\" && // either an empty reference\n in_path[0] !== \"/\") { // or an absolute path starting with /\n throw new Error(MSG.INVALID_PATH_IN_REFERENCE);\n }\n };\n\n /**\n * This utility function provides a canonical representation of an absolute property path.\n * It is useful to compare partial checkout paths and property paths.\n * The canonical form of paths is not suitable for ChangeSets.\n *\n * @param in_absolutePath - The absolute path to make canonical\n * @return Absolute path in canonical form\n */\n export const convertAbsolutePathToCanonical = function(in_absolutePath: string): string {\n const tokenTypes = [];\n const tokens = tokenizePathString(in_absolutePath, tokenTypes);\n let path = \"\";\n for (let i = 0; i < tokenTypes.length; i++) {\n const tokenType = tokenTypes[i];\n switch (tokenType) {\n case TOKEN_TYPES.PATH_ROOT_TOKEN:\n // Skip the leading '/'\n break;\n case TOKEN_TYPES.RAISE_LEVEL_TOKEN:\n throw new Error(`No level up (\"../\") is expected in an absolute path: ${in_absolutePath}`);\n case TOKEN_TYPES.DEREFERENCE_TOKEN:\n throw new Error(`Dereference (\"*\") is not supported in canonical paths: ${in_absolutePath}`);\n case TOKEN_TYPES.ARRAY_TOKEN:\n case TOKEN_TYPES.PATH_SEGMENT_TOKEN:\n path += (PROPERTY_PATH_DELIMITER + quotePathSegmentIfNeeded(tokens[i]));\n break;\n default:\n break;\n }\n }\n // Removes the leading PROPERTY_PATH_DELIMITER.\n if (path) {\n path = path.substring(1);\n }\n return path;\n };\n\n /**\n * This utility function provides a canonical representation of a child property path.\n * It is useful to compare partial checkout paths and property paths.\n * The canonical form of paths is not suitable for ChangeSets.\n *\n * @param in_parentAbsolutePathCanonical - The absolute path of the parent property in canonical form\n * @param in_childId - The name of the child property in its parent\n * @returns Absolute path of the child property in canonical form\n */\n export const getChildAbsolutePathCanonical = function(in_parentAbsolutePathCanonical: string, in_childId: string): string {\n const childPath = quotePathSegmentIfNeeded(String(in_childId));\n if (in_parentAbsolutePathCanonical) {\n return (in_parentAbsolutePathCanonical + PROPERTY_PATH_DELIMITER + childPath);\n } else {\n return childPath;\n }\n };\n\n export enum CoverageExtent {\n // The base path is not covered by any path from a given list of paths.\n // This means a property with this path and all its children would not be covered.\n UNCOVERED,\n // The base path is partially covered by at least one path from a given list of paths.\n // This means a property with this path would be covered, but some of its children could be uncovered.\n PARTLY_COVERED,\n // The base path is fully covered by at least one path from a given list of paths.\n // This means a property with this path would be covered and all of its children would be covered also.\n FULLY_COVERED,\n }\n\n interface BasePathCoverage {\n coverageExtent: CoverageExtent;\n pathList: string[];\n }\n\n /**\n * Determines if the base path is covered by the given list of paths. From that you can deduce if a\n * property with that path and all its children are covered by the given list of paths.\n *\n * This function uses the canonical representation of the property paths.\n *\n * @param in_basePath - The property's absolute path in canonical form\n * @param in_paths - The array of paths that must cover the property and its children\n * @returns The coverage of the property and its children. For a coverage of\n * 'FULLY_COVERED', only the first matching path is returned.\n */\n export const getPathCoverage = function(in_basePath: string, in_paths: string[]): BasePathCoverage {\n // First, check if the base path is entirely included in one of the paths\n for (let i = 0; i < in_paths.length; i++) {\n if (in_basePath.startsWith(in_paths[i])) {\n return {\n coverageExtent: CoverageExtent.FULLY_COVERED,\n pathList: [in_paths[i]],\n };\n }\n }\n // We did not find a path including all the children of this insertion\n // Let's check if there are paths going through it.\n const paths = [];\n for (let i = 0; i < in_paths.length; i++) {\n if (in_paths[i].startsWith(in_basePath)) {\n paths.push(in_paths[i]);\n }\n }\n if (paths.length) {\n // We found at least one path including parts of the base path.\n return {\n coverageExtent: CoverageExtent.PARTLY_COVERED,\n pathList: paths,\n };\n }\n\n // We did not find any path covering the given base path.\n return {\n coverageExtent: CoverageExtent.UNCOVERED,\n pathList: paths,\n };\n };\n}\n"]}
package/dist/rebase.js CHANGED
@@ -82,12 +82,12 @@ function rebaseToRemoteChanges(change, getUnrebasedChange, getRebasedChanges, is
82
82
  let changeset = c.changeSet;
83
83
  let applyAfterMetaInformation;
84
84
  if (alreadyRebasedChanges[0] !== undefined && alreadyRebasedChanges[0].guid === c.guid) {
85
- const invertedChange = new changeset_1.ChangeSet(fastest_json_copy_1.copy(alreadyRebasedChanges[0].changeSet));
85
+ const invertedChange = new changeset_1.ChangeSet((0, fastest_json_copy_1.copy)(alreadyRebasedChanges[0].changeSet));
86
86
  invertedChange.toInverseChangeSet();
87
87
  invertedChange.applyChangeSet(rebaseBaseChangeSetForAlreadyRebasedChanges);
88
88
  applyAfterMetaInformation = new Map();
89
89
  const conflicts2 = [];
90
- changeset = fastest_json_copy_1.copy(alreadyRebasedChanges[0].changeSet);
90
+ changeset = (0, fastest_json_copy_1.copy)(alreadyRebasedChanges[0].changeSet);
91
91
  rebaseBaseChangeSetForAlreadyRebasedChanges._rebaseChangeSet(changeset, conflicts2, {
92
92
  applyAfterMetaInformation,
93
93
  });
@@ -111,18 +111,18 @@ function rebaseToRemoteChanges(change, getUnrebasedChange, getRebasedChanges, is
111
111
  .then(() => makePromise(getRebasedChanges(change.remoteHeadGuid)))
112
112
  .then((remoteChanges) => {
113
113
  const conflicts = [];
114
- if (!isEqual_1.default(changesOnOtherLocalBranch.map((change) => change.guid), remoteChanges.map((change) => change.guid))) {
114
+ if (!(0, isEqual_1.default)(changesOnOtherLocalBranch.map((change) => change.guid), remoteChanges.map((change) => change.guid))) {
115
115
  for (const remoteChange of remoteChanges) {
116
116
  let applyAfterMetaInformation = commitsOnOtherLocalBranch[remoteChange.guid] !== undefined ?
117
117
  remoteChange.rebaseMetaInformation :
118
118
  undefined;
119
119
  let changeset = remoteChange.changeSet;
120
120
  if (changesOnOtherLocalBranch[0] !== undefined && changesOnOtherLocalBranch[0].guid === remoteChange.guid) {
121
- const invertedChange = new changeset_1.ChangeSet(fastest_json_copy_1.copy(changesOnOtherLocalBranch[0].changeSet));
121
+ const invertedChange = new changeset_1.ChangeSet((0, fastest_json_copy_1.copy)(changesOnOtherLocalBranch[0].changeSet));
122
122
  invertedChange.toInverseChangeSet();
123
123
  invertedChange.applyChangeSet(rebaseBaseChangeSet);
124
124
  applyAfterMetaInformation = new Map();
125
- changeset = fastest_json_copy_1.copy(changesOnOtherLocalBranch[0].changeSet);
125
+ changeset = (0, fastest_json_copy_1.copy)(changesOnOtherLocalBranch[0].changeSet);
126
126
  rebaseBaseChangeSet._rebaseChangeSet(changeset, conflicts, { applyAfterMetaInformation });
127
127
  // This is disabled for performance reasons. Only used during debugging
128
128
  // assert(isEqual(changeset,this.remoteChanges[i].changeSet),
@@ -145,7 +145,7 @@ exports.rebaseToRemoteChanges = rebaseToRemoteChanges;
145
145
  function rebaseChangeArrays(baseChangeSet, changesToRebase) {
146
146
  let rebaseBaseChangeSet = baseChangeSet;
147
147
  for (const change of changesToRebase) {
148
- const copiedChangeSet = new changeset_1.ChangeSet(fastest_json_copy_1.copy(change.changeSet));
148
+ const copiedChangeSet = new changeset_1.ChangeSet((0, fastest_json_copy_1.copy)(change.changeSet));
149
149
  copiedChangeSet.toInverseChangeSet();
150
150
  const conflicts = [];
151
151
  change.rebaseMetaInformation = new Map();