@fluid-experimental/property-changeset 0.57.2 → 0.58.1000

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.
@@ -1 +1 @@
1
- {"version":3,"file":"changeset.d.ts","sourceRoot":"","sources":["../src/changeset.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AAaH,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAGvE,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAA;AAE5E,OAAO,EAAE,mCAAmC,EAAE,MAAM,0CAA0C,CAAC;AAY/F,MAAM,WAAW,qBAAqB;IAClC;;OAEG;IACH,yBAAyB,CAAC,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAE1C;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAA;CACpC;AAGD,MAAM,WAAW,sBAAuB,SAAQ,qBAAqB;IACjE,qBAAqB,CAAC,EAAE,MAAM,CAAA;CACjC;AAED;;GAEG;AACH,oBAAY,mBAAmB,GAAG,GAAG,CAAC;AACtC,oBAAY,aAAa,GAAG,GAAG,CAAC;AAChC,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B;;OAEG;IACH,IAAI,EAAE,YAAY,CAAC;IACnB,iBAAiB,CAAC,EAAE,mBAAmB,CAAC;CAC3C;AAED;;;;GAIG;AACH,qBAAa,SAAS;IAClB,MAAM,CAAC,YAAY,sBAAgB;IACnC,MAAM,CAAC,gBAAgB,iCAAoB;IAC3C,MAAM,CAAC,iBAAiB,8BAAqB;IAE9B,gCAAgC,EAAE,OAAO,mCAAmC,CAAC,gCAAgC,CAAC;IAC9G,iCAAiC,EAAE,OAAO,uBAAuB,CAAC,iCAAiC,CAAC;IACpG,gCAAgC,EAAE,OAAO,uBAAuB,CAAC,gCAAgC,CAAC;IAClG,yBAAyB,EAAE,OA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OAmBG;IACH,OAAO,CAAC,yCAAyC;IAwEjD;;;;;OAKG;IACH,OAAO,CAAC,oCAAoC;IAkM5C;;;;;;;OAOG;IACI,sBAAsB,CAAC,qBAAqB,EAAE,mBAAmB;IAuBxE;;;;;;OAMG;IACI,yBAAyB,CAAC,cAAc,EAAE,OAAO;IAmHxD;;;;;;OAMG;IACH,OAAO,CAAC,uBAAuB;IAgB/B;;;OAGG;IACH,OAAO,CAAC,qCAAqC;IAoI7C;;;;;OAKG;IACI,kBAAkB;CAY5B"}
package/dist/changeset.js CHANGED
@@ -559,7 +559,6 @@ class ChangeSet {
559
559
  * or updates the former state of a reversible changeset
560
560
  * @param in_context the traversal context
561
561
  */
562
- // eslint-disable-next-line complexity
563
562
  _recursivelyBuildReversibleChangeSet(in_context) {
564
563
  const opType = in_context.getOperationType();
565
564
  if (opType === "modify") {
@@ -791,7 +790,6 @@ class ChangeSet {
791
790
  * @param in_withoutRoot - Bypass a fix where the root of a changeset is cleaned
792
791
  */
793
792
  _stripReversibleChangeSet(in_withoutRoot) {
794
- // eslint-disable-next-line complexity
795
793
  const callback = function (in_context) {
796
794
  const opType = in_context.getOperationType();
797
795
  if (opType === "remove" || opType === "modify") {
@@ -1 +1 @@
1
- {"version":3,"file":"changeset.js","sourceRoot":"","sources":["../src/changeset.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;;;;AAEH,+DAAuC;AACvC,+DAAuC;AACvC,yDAAoD;AACpD,6DAAqC;AACrC,2DAAmC;AACnC,uDAA+B;AAE/B,YAAY;AACZ,yEAAyF;AAEzF,yDAAsD;AACtD,wDAAuE;AAEvE,0FAAuF;AACvF,0FAA4E;AAC5E,2EAA2E;AAC3E,gFAA+F;AAC/F,8EAA2E;AAC3E,2DAAwD;AACxD,mCAAgC;AAChC,2DAAwD;AACxD,0EAAmF;AAEnF,MAAM,EAAE,uBAAuB,EAAE,GAAG,EAAE,GAAG,2BAAS,CAAC;AAEnD,MAAM,EAAE,cAAc,EA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AAiB,GAAG,qCAAiB,CAAC;AA+nCjD,SAAS,CAAC,SAAS,CAAC,iCAAiC,GAAG,+BAAuB,CAAC,iCAAiC,CAAC;AAClH,SAAS,CAAC,SAAS,CAAC,gCAAgC,GAAG,+BAAuB,CAAC,gCAAgC,CAAC;AAChH,SAAS,CAAC,SAAS,CAAC,yBAAyB,GAAG,+BAAuB,CAAC,yBAAyB,CAAC;AAElG,2EAA2E;AAC3E,SAAS,CAAC,SAAS,CAAC,6CAA6C;IAC7D,uDAAmC,CAAC,6CAA6C,CAAC;AACtF,SAAS,CAAC,SAAS,CAAC,gCAAgC;IAChD,uDAAmC,CAAC,gCAAgC,CAAC;AACzE,SAAS,CAAC,SAAS,CAAC,4CAA4C;IAC5D,uDAAmC,CAAC,4CAA4C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Serialized representation of the changes in a repository\n */\n\nimport isObject from \"lodash/isObject\";\nimport isString from \"lodash/isString\";\nimport {copy as cloneDeep} from \"fastest-json-copy\";\nimport isEmpty from \"lodash/isEmpty\";\nimport extend from \"lodash/extend\";\nimport each from \"lodash/each\";\n\n//@ts-ignore\nimport { ConsoleUtils, joinPaths, constants } from \"@fluid-experimental/property-common\";\n\nimport { TypeIdHelper } from \"./helpers/typeidHelper\";\nimport { ChangeSetArrayFunctions } from './changeset_operations/array';\n\nimport { ArrayChangeSetIterator } from \"./changeset_operations/arrayChangesetIterator\";\nimport { ConflictType } from './changeset_operations/changesetConflictTypes'\n// Add the indexed collection functions into the prototype of the ChangeSet\nimport { ChangeSetIndexedCollectionFunctions } from \"./changeset_operations/indexedCollection\";\nimport { isEmptyChangeSet } from \"./changeset_operations/isEmptyChangeset\";\nimport { isReservedKeyword } from \"./isReservedKeyword\";\nimport { Utils } from \"./utils\";\nimport { TemplateValidator } from \"./templateValidator\";\nimport { ArrayIteratorOperationTypes } from \"./changeset_operations/operationTypes\"\n\nconst { PROPERTY_PATH_DELIMITER, MSG } = constants;\n\nconst { extractContext, isPrimitiveType } = TypeIdHelper;\n\n\nexport interface ApplyChangeSetOptions {\n /**\n * Additional meta information which help later to obtain more compact changeset during the apply operation.\n */\n applyAfterMetaInformation?: Map<any, any>,\n\n /**\n * Throw error for template definition mismatches.\n */\n throwOnTemplateMismatch?: boolean\n}\n\n\nexport interface RebaseChangeSetOptions extends ApplyChangeSetOptions {\n rebaseMetaInformation?: object\n}\n\n/**\n * The plain serialization data structure used to encode a ChangeSet.\n */\nexport type SerializedChangeSet = any; //@TODO Maybe we should add full type for the ChangeSet\nexport type ChangeSetType = any;\nexport interface ConflictInfo {\n /**\n * Path to the position where the conflict occurred. If the conflicting change is of type\n * MISMATCH_TEMPLATES then the path will be undefined.\n */\n path?: string | undefined;\n /**\n * Type of the conflict\n */\n type: ConflictType;\n conflictingChange?: SerializedChangeSet;\n}\n\n/**\n * The ChangeSet represents an operation to be done (or that was done) on the data. It encapsulate one or\n * many addition/insertion and deletion of properties. The ChangeSetObject also provides functionality\n * to merge and swap change sets.\n */\nexport class ChangeSet {\n static ConflictType = ConflictType;\n static isEmptyChangeSet = isEmptyChangeSet;\n static isReservedKeyword = isReservedKeyword;\n\n declare public _cleanIndexedCollectionChangeSet: typeof ChangeSetIndexedCollectionFunctions._cleanIndexedCollectionChangeSet;\n declare public _performApplyAfterOnPropertyArray: typeof ChangeSetArrayFunctions._performApplyAfterOnPropertyArray;\n declare public _rebaseArrayChangeSetForProperty: typeof ChangeSetArrayFunctions._rebaseArrayChangeSetForProperty;\n declare public _rebaseChangeSetForString: typeof ChangeSetArrayFunctions._rebaseChangeSetForString;\n declare public _performApplyAfterOnPropertyIndexedCollection: typeof ChangeSetIndexedCollectionFunctions._performApplyAfterOnPropertyIndexedCollection;\n declare public _rebaseIndexedCollectionChangeSetForProperty: typeof ChangeSetIndexedCollectionFunctions._rebaseIndexedCollectionChangeSetForProperty;\n\n\n _changes: SerializedChangeSet;\n _isNormalized: boolean;\n\n /**\n * @param [in_changes] - The serialized changes to store in this change set if a string is supplied,\n * we assume it to be a serialized JSON representation of the change set. If none is supplied, an empty changeset will be created.\n */\n constructor(in_changes?: ChangeSetType) {\n if (in_changes === undefined || in_changes === null) {\n this._changes = {};\n } else if (isString(in_changes)) { // Stringified Serialized JSON\n this._changes = JSON.parse(in_changes);\n } else if (in_changes instanceof ChangeSet) {\n this._changes = cloneDeep(in_changes._changes);\n } else {\n // Serialized Changeset\n this._changes = in_changes;\n }\n\n this._isNormalized = false;\n }\n\n\n /**\n * Creates a string representation of the change set\n * @returns JSON encoding of the changes in this change set\n */\n toString(): string {\n return JSON.stringify(this._changes);\n };\n\n\n /**\n * Returns the serialized changes.\n *\n * @returns The serialized changeset\n */\n getSerializedChangeSet(): SerializedChangeSet {\n return this._changes;\n };\n\n /**\n * Indicates whether this is a normalized ChangeSet. If this is set to true, squashes will not remove empty entries\n * from the ChangeSet.\n *\n * @param in_isNormalized - is this a normalized ChangeSet?\n */\n setIsNormalized(in_isNormalized: boolean) {\n this._isNormalized = in_isNormalized;\n };\n\n /**\n * Indicates whether this is a normalized ChangeSet. If this is set to true, squashes will not remove empty entries\n * from the ChangeSet.\n *\n * @returns Is this a normalized ChangeSet?\n */\n getIsNormalized(): boolean {\n return this._isNormalized;\n };\n\n /**\n * Clones the ChangeSet\n *\n * @returns The cloned ChangeSet\n */\n clone(): ChangeSet {\n return new ChangeSet(cloneDeep(this._changes));\n };\n\n\n /**\n * Updates this ChangeSet. The result will be the concatenation of the two ChangeSets. First the changes in this\n * ChangeSet are executed, then the changes in the supplied in_changeSet are applied. The result will be\n * stored in this ChangeSet. This function assumes that the second ChangeSet is relative to the state after\n * application of the first ChangeSet.\n *\n * @param in_changeSet - The changeset to apply\n * @param in_options - Optional additional parameters\n */\n applyChangeSet(in_changeSet: SerializedChangeSet, in_options?: ApplyChangeSetOptions) {\n let changes = in_changeSet;\n if (in_changeSet instanceof ChangeSet) {\n changes = in_changeSet.getSerializedChangeSet();\n }\n\n if (!isObject(this._changes) || Array.isArray(this._changes)) {\n const oldValue = isObject(changes) && (changes as SerializedChangeSet).value !== undefined ? (changes as SerializedChangeSet).value : changes;\n this._changes = Array.isArray(oldValue) ? oldValue.slice() : oldValue;\n } else {\n this._performApplyAfterOnProperty(this._changes, changes, !this._isNormalized, in_options);\n }\n };\n\n /**\n * Applies a changeset to a given property (recursively). The ChangeSet is assumed to be relative to the same\n * property root and it will be applied behind the base ChangeSet (assuming that the changes are relative to the\n * 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_removeEmpty - Should empty ChangeSets be removed?\n * @param in_options - Optional additional parameters\n */\n private _performApplyAfterOnProperty(\n io_basePropertyChanges: SerializedChangeSet,\n in_appliedPropertyChanges: SerializedChangeSet,\n in_removeEmpty: boolean,\n in_options?: ApplyChangeSetOptions) {\n // Apply dynamic property operations\n if (in_appliedPropertyChanges.insert ||\n in_appliedPropertyChanges.modify ||\n in_appliedPropertyChanges.remove) {\n this._performApplyAfterOnPropertyIndexedCollection(io_basePropertyChanges,\n in_appliedPropertyChanges,\n \"NodeProperty\",\n in_options); // TODO: recursively propagate the typeid?\n }\n\n if (!isEmpty(in_appliedPropertyChanges.insertTemplates)) {\n io_basePropertyChanges.insertTemplates = io_basePropertyChanges.insertTemplates || {};\n extend(io_basePropertyChanges.insertTemplates, in_appliedPropertyChanges.insertTemplates);\n }\n\n // Apply ChangeSet to the properties\n const modifiedTypeids = Object.keys(in_appliedPropertyChanges);\n for (let i = 0; i < modifiedTypeids.length; i++) {\n const typeid = modifiedTypeids[i];\n // The reserved keywords have already been handled above\n if (ChangeSet.isReservedKeyword(typeid)) {\n continue;\n }\n\n io_basePropertyChanges[typeid] = io_basePropertyChanges[typeid] || {};\n const baseChanges = io_basePropertyChanges[typeid];\n const changedKeys = Object.keys(in_appliedPropertyChanges[typeid]);\n for (let j = 0; j < changedKeys.length; j++) {\n this.performApplyAfterOnPropertyWithTypeid(changedKeys[j],\n baseChanges,\n in_appliedPropertyChanges[typeid],\n typeid,\n in_removeEmpty,\n in_options);\n }\n // Remove the type when it no longer contains any changed keys\n if (in_removeEmpty && isEmpty(io_basePropertyChanges[typeid])) {\n delete io_basePropertyChanges[typeid];\n }\n }\n };\n\n /**\n * Helper function used to apply a new value to a given ChangeSet.\n * It is used to handle setting a primitive value, which might either be represented\n * via a literal or an object with a member value.\n * applies in_appliedValue to the io_baseChanges at the given in_baseKey\n * @param io_baseChanges - base changes (modified)\n * @param in_baseKey - key\n * @param in_appliedValue - applied changes to be applied\n */\n private _applyValue(io_baseChanges: SerializedChangeSet, in_baseKey: string, in_appliedValue: SerializedChangeSet) {\n const newValue = (in_appliedValue && in_appliedValue.hasOwnProperty(\"value\")) ?\n in_appliedValue.value : in_appliedValue;\n if (io_baseChanges[in_baseKey] && io_baseChanges[in_baseKey].hasOwnProperty(\"value\")) {\n io_baseChanges[in_baseKey].value = newValue;\n } else {\n if (io_baseChanges[in_baseKey] === undefined &&\n in_appliedValue && in_appliedValue.hasOwnProperty(\"oldValue\")) {\n io_baseChanges[in_baseKey] = {\n value: newValue,\n oldValue: in_appliedValue.oldValue,\n };\n } else {\n io_baseChanges[in_baseKey] = newValue;\n }\n }\n };\n\n /**\n * Decides based on the given Typeid which applyAfter operation to perform.\n * Note: This function is not directly called on the ChangeSet but on the object containing it together with a key\n * since it needs to be able to overwrite this entry\n *\n * @param in_changedKey - The key of the entry in the object\n * @param in_baseChanges - The object containing the state before the applyAfter\n * @param in_appliedPropertyChanges - The object containing the ChangeSet with the modification\n * @param in_typeid - The typeid of the property to modify\n * @param in_removeEmpty - Should empty ChangeSets be removed?\n * @param in_options - Optional additional parameters\n */\n public performApplyAfterOnPropertyWithTypeid(\n in_changedKey: string,\n in_baseChanges: SerializedChangeSet,\n in_appliedPropertyChanges: { [x: string]: any; },\n in_typeid: string,\n in_removeEmpty: boolean,\n in_options?: ApplyChangeSetOptions) {\n const splitTypeid = extractContext(in_typeid);\n\n if (splitTypeid.context === \"set\" ||\n splitTypeid.context === \"map\") {\n in_baseChanges[in_changedKey] = in_baseChanges[in_changedKey] || {};\n this._performApplyAfterOnPropertyIndexedCollection(in_baseChanges[in_changedKey],\n in_appliedPropertyChanges[in_changedKey],\n splitTypeid.typeid,\n in_options);\n\n // Remove the key, when it no longer contains a changeset\n if (in_removeEmpty && isEmpty(in_baseChanges[in_changedKey])) {\n delete in_baseChanges[in_changedKey];\n }\n } else if (splitTypeid.context === \"array\" || splitTypeid.typeid === \"String\") {\n in_baseChanges[in_changedKey] = in_baseChanges[in_changedKey] !== undefined ? in_baseChanges[in_changedKey] : {};\n let baseIsSetChange = false;\n let oldValue;\n if (splitTypeid.typeid === \"String\" &&\n (isString(in_baseChanges[in_changedKey]) ||\n (in_baseChanges[in_changedKey] && in_baseChanges[in_changedKey].hasOwnProperty(\"value\")))) {\n oldValue = in_baseChanges[in_changedKey].oldValue;\n // we need to convert the format to allow the application of the changes\n // since _performApplyAfterOnPropertyArray only understands insert/modify/remove commands\n if (in_baseChanges[in_changedKey] && in_baseChanges[in_changedKey].hasOwnProperty(\"value\")) {\n in_baseChanges[in_changedKey] = {\n insert: [\n [0, in_baseChanges[in_changedKey].value],\n ],\n };\n } else {\n in_baseChanges[in_changedKey] = {\n insert: [\n [0, in_baseChanges[in_changedKey]],\n ],\n };\n }\n baseIsSetChange = true;\n }\n let appliedChanges = in_appliedPropertyChanges[in_changedKey];\n if (isObject(appliedChanges) && appliedChanges.hasOwnProperty(\"value\")) {\n appliedChanges = (appliedChanges as SerializedChangeSet).value;\n }\n\n if (splitTypeid.typeid === \"String\" && isString(appliedChanges)) {\n // we've got a 'set' command and just overwrite the changes\n if (baseIsSetChange && oldValue !== undefined) {\n in_baseChanges[in_changedKey] = {\n value: appliedChanges,\n oldValue,\n };\n } else {\n in_baseChanges[in_changedKey] = appliedChanges;\n }\n } else {\n // we have incremental changes (or a standard array)\n this._performApplyAfterOnPropertyArray(in_baseChanges[in_changedKey],\n in_appliedPropertyChanges[in_changedKey],\n splitTypeid.typeid,\n in_options);\n if (baseIsSetChange) {\n // we have to convert back to a string, if it had been converted before\n let newValue;\n if (isEmpty(in_baseChanges[in_changedKey])) {\n newValue = \"\";\n } else {\n newValue = in_baseChanges[in_changedKey].insert[0][1];\n }\n if (oldValue !== undefined) {\n in_baseChanges[in_changedKey] = {\n value: newValue,\n oldValue,\n };\n } else {\n in_baseChanges[in_changedKey] = newValue;\n }\n }\n }\n\n // Remove the key, when it no longer contains a changeset\n if (in_removeEmpty && ChangeSet.isEmptyChangeSet(in_baseChanges[in_changedKey])) {\n delete in_baseChanges[in_changedKey];\n }\n } else if (splitTypeid.isEnum) {\n // Enum types can simply be overwritten\n this._applyValue(in_baseChanges, in_changedKey, in_appliedPropertyChanges[in_changedKey]);\n } else if (splitTypeid.context === \"single\") {\n if (isPrimitiveType(splitTypeid.typeid)) {\n // Primitive types can simply be overwritten, however we have an exception for\n // 64 bit integers (until javascript natively supports them)\n if (splitTypeid.typeid === \"Int64\" || splitTypeid.typeid === \"Uint64\") {\n let appliedVal = in_appliedPropertyChanges[in_changedKey];\n if (appliedVal && appliedVal.hasOwnProperty(\"value\")) {\n appliedVal = appliedVal.value;\n }\n this._applyValue(in_baseChanges, in_changedKey, appliedVal.slice());\n } else {\n this._applyValue(in_baseChanges, in_changedKey, in_appliedPropertyChanges[in_changedKey]);\n }\n } else {\n if (in_baseChanges[in_changedKey]) {\n // Otherwise we have to continue the merging recursively\n this._performApplyAfterOnProperty(in_baseChanges[in_changedKey],\n in_appliedPropertyChanges[in_changedKey],\n false,\n in_options);\n } else {\n // If the key doesn't exist, yet, we can just copy it\n in_baseChanges[in_changedKey] = cloneDeep(in_appliedPropertyChanges[in_changedKey]);\n }\n }\n } else {\n throw new Error(MSG.UNKNOWN_CONTEXT + splitTypeid.context);\n }\n };\n\n /**\n * Rebases a given ChangeSet behind the current ChangeSet.\n *\n * This function takes a ChangeSet which is assumed to be relative to the same base state as the ChangeSet stored in\n * this class and transforms it in such a way that it can be applied after this ChangeSet. The function will modify\n * the supplied ChangeSet\n *\n * @param io_changeSet -\n * The ChangeSet that is rebased behind the state obtained by application of this ChangeSet\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 * @returns The rebased ChangeSet (the same object as io_changeSet, it will be\n * modified in place)\n */\n public _rebaseChangeSet(io_changeSet: SerializedChangeSet, out_conflicts: ConflictInfo[],\n in_options?: RebaseChangeSetOptions): SerializedChangeSet {\n // We actually only pass this request to the recursive internal function\n return this._rebaseChangeSetForProperty(this._changes, io_changeSet, \"\", out_conflicts, in_options);\n };\n\n /**\n * Internal helper function that performs a rebase on a single property\n *\n * @param in_ownPropertyChangeSet -\n * The ChangeSet for the property stored in this class\n * @param io_rebasePropertyChangeSet -\n * The ChangeSet for the property to be rebased\n * @param in_basePath -\n * Base path to get to the property processed by this function\n * @param out_conflicts -\n * A list of paths that resulted in conflicts together with the type of the conflict\n * @param in_options - Optional additional parameters\n * @returns The rebased ChangeSet for this property\n */\n private _rebaseChangeSetForProperty(\n in_ownPropertyChangeSet: SerializedChangeSet,\n io_rebasePropertyChangeSet: SerializedChangeSet,\n in_basePath: string,\n out_conflicts: ConflictInfo[],\n in_options: ApplyChangeSetOptions): SerializedChangeSet {\n // Process the children in this ChangeSet\n if ((in_ownPropertyChangeSet.insert ||\n in_ownPropertyChangeSet.modify ||\n in_ownPropertyChangeSet.remove) &&\n (io_rebasePropertyChangeSet.insert ||\n io_rebasePropertyChangeSet.modify ||\n io_rebasePropertyChangeSet.remove)) {\n this._rebaseIndexedCollectionChangeSetForProperty(in_ownPropertyChangeSet,\n io_rebasePropertyChangeSet,\n in_basePath,\n \"NodeProperty\", // TODO: recursively propagate the typeid?\n false, // don't use square brackets (use dots instead)\n out_conflicts,\n in_options);\n }\n if (!isEmpty(io_rebasePropertyChangeSet.insertTemplates)) {\n const typeids = Object.keys(io_rebasePropertyChangeSet.insertTemplates);\n\n const templateMismatchChangeSet = { insertTemplates: {} };\n\n const templateMismatchConflict = {\n type: ChangeSet.ConflictType.MISMATCH_TEMPLATES,\n conflictingChange: templateMismatchChangeSet,\n };\n\n each(typeids, function(typeid) {\n const template = io_rebasePropertyChangeSet.insertTemplates[typeid];\n if (in_ownPropertyChangeSet.insertTemplates &&\n in_ownPropertyChangeSet.insertTemplates[typeid]) {\n const isEqual = TemplateValidator.Utils.psetDeepEquals(\n template,\n in_ownPropertyChangeSet.insertTemplates[template.typeid],\n );\n\n if (!isEqual) {\n if (in_options && in_options.throwOnTemplateMismatch) {\n throw new Error(MSG.TEMPLATE_MISMATCH + typeid);\n }\n\n templateMismatchChangeSet.insertTemplates[typeid] =\n in_ownPropertyChangeSet.insertTemplates[template.typeid];\n // TODO: Remove this warning message once we offer a conflict resolution API\n console.warn(MSG.TEMPLATE_MISMATCH + typeid);\n }\n\n delete io_rebasePropertyChangeSet.insertTemplates[typeid];\n }\n });\n\n // Remove insertTemplates key if it is empty\n if (isEmpty(io_rebasePropertyChangeSet.insertTemplates)) {\n delete io_rebasePropertyChangeSet.insertTemplates;\n }\n\n if (!isEmpty(templateMismatchConflict.conflictingChange.insertTemplates)) {\n out_conflicts.push(templateMismatchConflict);\n }\n }\n\n // Check for collisions in the property assignments\n const changedTypeids = Object.keys(in_ownPropertyChangeSet);\n\n // We currently do not yet have any\n const changeSet = {};\n for (let i = 0; i < changedTypeids.length; i++) {\n const typeid = changedTypeids[i];\n const paths = Object.keys(in_ownPropertyChangeSet[typeid]);\n\n // Update the oldValue of primitive property of a changeset\n // for simple changeset with 'modify', property type, name, value\n // find the oldValue of the property and update it\n if (typeid === \"modify\" && \"modify\" in io_rebasePropertyChangeSet) {\n for (let j = 0; j < paths.length; j++) {\n const tempTypeid = paths[i];\n if ((isPrimitiveType(tempTypeid)) &&\n tempTypeid in io_rebasePropertyChangeSet.modify) {\n const tempPaths = Object.keys(in_ownPropertyChangeSet.modify[tempTypeid]);\n for (let z = 0; z < tempPaths.length; z++) {\n if (tempPaths[z] in io_rebasePropertyChangeSet.modify[tempTypeid]) {\n let rebasedPropContent = io_rebasePropertyChangeSet.modify[tempTypeid][tempPaths[z]];\n if (isObject(rebasedPropContent) && \"oldValue\" in rebasedPropContent) {\n (rebasedPropContent as SerializedChangeSet).oldValue = in_ownPropertyChangeSet.modify[tempTypeid][tempPaths[z]].value;\n }\n }\n }\n }\n }\n } else if (isPrimitiveType(typeid)) {\n // for complex changeset, the function will be called recursively, when the function is at the level where\n // io_rebasePropertyChangeSet && in_ownPropertyChangeSet contain only property type, name and value, we update\n // oldValue of io_rebasePropertyChangeSet.\n for (let j = 0; j < paths.length; j++) {\n if (typeid in io_rebasePropertyChangeSet && paths[j] in io_rebasePropertyChangeSet[typeid]) {\n let rebasedPropContent = io_rebasePropertyChangeSet[typeid][paths[j]];\n if (isObject(rebasedPropContent) && \"oldValue\" in rebasedPropContent) {\n // if oldValue already be update above, we don't need to update\n if (io_rebasePropertyChangeSet[typeid][paths[j]].oldValue !==\n in_ownPropertyChangeSet[typeid][paths[j]].value) {\n io_rebasePropertyChangeSet[typeid][paths[j]].oldValue = in_ownPropertyChangeSet[typeid][paths[j]].value;\n }\n }\n }\n }\n }\n\n // The reserved keywords have already been handled above and changes which are not present in\n // the other ChangeSet can be ignored\n if (ChangeSet.isReservedKeyword(typeid) ||\n !io_rebasePropertyChangeSet[typeid]) {\n continue;\n }\n\n // Check, whether we have a collision in a path update\n for (let j = 0; j < paths.length; j++) {\n if (io_rebasePropertyChangeSet[typeid][paths[j]] !== undefined) {\n in_ownPropertyChangeSet[typeid] = in_ownPropertyChangeSet[typeid] || {};\n\n const newPath = joinPaths(in_basePath,\n paths[j],\n PROPERTY_PATH_DELIMITER);\n // Perform the rebase operation on the ChangeSet for this entry\n const setConflict = this.rebaseChangeSetForPropertyEntryWithTypeid(paths[j],\n in_ownPropertyChangeSet[typeid],\n io_rebasePropertyChangeSet[typeid],\n typeid,\n newPath,\n true,\n out_conflicts,\n in_options);\n\n // If there has been a non-recursive set collision we handle it here separately\n if (setConflict) {\n // If we have two writes to primitive types, this is a conflict\n changeSet[typeid] = changeSet[typeid] || {};\n\n // Store the change. Note: We make a deep copy here, as this is a reference into our\n // own internal ChangeSet and we want to be sure, nobody changes our internal data-structures\n changeSet[typeid][paths[j]] = cloneDeep(in_ownPropertyChangeSet[typeid][paths[j]]);\n }\n\n // Remove the typeid, when it no longer contains any keys\n if (isEmpty(io_rebasePropertyChangeSet[typeid])) {\n delete io_rebasePropertyChangeSet[typeid];\n }\n }\n }\n }\n\n // If there were conflicts in the set operations, report them\n if (!isEmpty(changeSet)) {\n const conflict = {\n path: in_basePath,\n type: ChangeSet.ConflictType.COLLIDING_SET,\n conflictingChange: changeSet,\n };\n out_conflicts.push(conflict);\n }\n\n return io_rebasePropertyChangeSet;\n };\n\n /**\n * Decides based on the given Typeid which rebase operation to perform\n * Note: This function is not directly called on the ChangeSet but on the object containing it together with a key\n * since it needs to be able to overwrite this entry\n *\n * @param in_key - The key of the entry in the object\n * @param in_ownPropertyChangeSet - The object containing the ChangeSet for the property\n * stored in this class\n * @param io_rebasePropertyChangeSet - The object containing the ChangeSet for the property to\n * be rebased\n * @param in_typeid - The typeid of the property to rebase\n * @param in_basePath - Base path to get to the property processed by this function\n * @param in_removeEmpty - Should empty ChangeSets be removed?\n * @param out_conflicts - A list of paths that resulted in\n * conflicts together with the type of the conflict\n *\n * @returns Has there been a simple set collision? Those have to be handled separately\n * TODO: We should unify the handling of set collisions\n * @private\n */\n private rebaseChangeSetForPropertyEntryWithTypeid(\n in_key: string,\n in_ownPropertyChangeSet: SerializedChangeSet,\n io_rebasePropertyChangeSet: SerializedChangeSet,\n in_typeid: string,\n in_basePath: string,\n in_removeEmpty: boolean,\n out_conflicts: any,\n in_options: ApplyChangeSetOptions): boolean {\n const splitTypeid = extractContext(in_typeid);\n\n if (splitTypeid.context === \"set\" ||\n splitTypeid.context === \"map\") {\n this._rebaseIndexedCollectionChangeSetForProperty(in_ownPropertyChangeSet[in_key],\n io_rebasePropertyChangeSet[in_key],\n in_basePath,\n splitTypeid.typeid,\n true, // use square brackets\n out_conflicts,\n in_options);\n\n // Remove the key, when it no longer contains a changeset\n if (in_removeEmpty && isEmpty(io_rebasePropertyChangeSet[in_key])) {\n delete io_rebasePropertyChangeSet[in_key];\n }\n } else if (splitTypeid.context === \"array\") {\n this._rebaseArrayChangeSetForProperty(in_ownPropertyChangeSet[in_key],\n io_rebasePropertyChangeSet[in_key],\n in_basePath,\n out_conflicts,\n splitTypeid.typeid,\n in_options);\n // Remove the key, when it no longer contains a changeset\n if (in_removeEmpty && isEmpty(io_rebasePropertyChangeSet[in_key])) {\n delete io_rebasePropertyChangeSet[in_key];\n }\n } else if (splitTypeid.typeid === \"String\") {\n this._rebaseChangeSetForString(in_ownPropertyChangeSet[in_key],\n io_rebasePropertyChangeSet, in_key,\n in_basePath,\n out_conflicts,\n in_options);\n // Remove the key, when it no longer contains a changeset\n if (in_removeEmpty && isEmpty(io_rebasePropertyChangeSet[in_key])) {\n delete io_rebasePropertyChangeSet[in_key];\n }\n } else if (splitTypeid.context === \"single\") {\n // We only can have a conflict when the path exists in both ChangeSets\n if (in_ownPropertyChangeSet[in_key] !== undefined) {\n if (isPrimitiveType(splitTypeid.typeid) || splitTypeid.isEnum) {\n return true;\n } else {\n // Otherwise, we have to continue recursively\n\n // Make sure the paths exist\n in_ownPropertyChangeSet[in_key] = in_ownPropertyChangeSet[in_key] || {};\n\n // And then perform the recursive rebase\n this._rebaseChangeSetForProperty(in_ownPropertyChangeSet[in_key],\n io_rebasePropertyChangeSet[in_key],\n in_basePath,\n out_conflicts,\n in_options);\n }\n }\n } else {\n throw new Error(MSG.UNKNOWN_CONTEXT + splitTypeid.context);\n }\n\n return false;\n };\n\n /**\n * recursive helper function for ChangeSet.prototype._toReversibleChangeSet\n * which converts a irreversible changeset to a reversible changeset\n * or updates the former state of a reversible changeset\n * @param in_context the traversal context\n */\n // eslint-disable-next-line complexity\n private _recursivelyBuildReversibleChangeSet(in_context: Utils.TraversalContext) {\n const opType = in_context.getOperationType();\n if (opType === \"modify\") {\n const type = in_context.getTypeid();\n const splitType = in_context.getSplitTypeID();\n let nestedChangeset = in_context.getNestedChangeSet();\n\n let current = in_context.getUserData().parallelState;\n if (in_context.getPropertyContainerType() === \"root\") {\n current = in_context.getUserData().oldState;\n } else if (current) {\n if (in_context.getPropertyContainerType() !== \"template\") {\n current = current.insert;\n }\n\n if (in_context.getPropertyContainerType() !== \"array\") {\n current = current && current[in_context.getTypeid()];\n current = current && current[in_context.getLastSegment()];\n } else {\n current = current && current[0][1][in_context.getLastSegment()];\n }\n }\n\n in_context.setUserData({\n parallelState: current,\n oldState: in_context.getUserData().oldState,\n });\n\n if (isPrimitiveType(type)) {\n if (current === undefined) {\n throw new Error(`${MSG.INVALID_PATH + in_context.getFullPath()}. Making primitive value reversible.`);\n }\n let oldValue = current;\n\n // store it in reversibleChangeSet\n if (type === \"String\" && !isString(nestedChangeset)) {\n // String is a special case\n let oldString;\n if (isString(oldValue)) {\n oldString = oldValue;\n }\n if (nestedChangeset.modify) {\n for (let i = 0; i < nestedChangeset.modify.length; i++) {\n let entry = nestedChangeset.modify[i];\n let entryOffset = entry[0];\n const entryLength = entry[1].length;\n entry[2] = oldString.slice(entryOffset, entryOffset + entryLength);\n }\n }\n if (nestedChangeset.remove) {\n for (let i = 0; i < nestedChangeset.remove.length; i++) {\n let entry = nestedChangeset.remove[i];\n let entryOffset = entry[0];\n\n let removeRangeLength = entry[1];\n if (isString(removeRangeLength)) {\n removeRangeLength = entry[1].length;\n }\n entry[1] = oldString.slice(entryOffset, entryOffset + removeRangeLength);\n }\n }\n } else {\n if (nestedChangeset && nestedChangeset.hasOwnProperty(\"value\")) {\n nestedChangeset.oldValue = oldValue;\n } else {\n const newChangeSet = {\n value: nestedChangeset,\n oldValue,\n };\n in_context.replaceNestedChangeSet(newChangeSet);\n }\n }\n } else if (splitType.context === \"array\") {\n if (current === undefined) {\n throw new Error(`${MSG.INVALID_PATH + in_context.getFullPath()}. Making array value reversible.`);\n }\n let oldValue = current.insert ? current.insert[0][1] : [];\n\n let nestedChangeset = in_context.getNestedChangeSet();\n if (nestedChangeset.modify) {\n if (isPrimitiveType(splitType.typeid)) {\n for (let i = 0; i < nestedChangeset.modify.length; i++) {\n let entry = nestedChangeset.modify[i];\n let entryOffset = entry[0];\n let oldEntries = [];\n for (let j = 0; j < entry[1].length; j++) {\n oldEntries.push(cloneDeep(oldValue[entryOffset + j]));\n }\n entry[2] = oldEntries;\n }\n }\n }\n if (nestedChangeset.remove) {\n for (let i = 0; i < nestedChangeset.remove.length; i++) {\n let entry = nestedChangeset.remove[i];\n let entryOffset = entry[0];\n let oldEntries = [];\n\n let removeRangeLength = entry[1];\n if (Array.isArray(removeRangeLength)) {\n removeRangeLength = entry[1].length;\n }\n\n for (let j = 0; j < removeRangeLength; j++) {\n oldEntries.push(cloneDeep(oldValue[entryOffset + j]));\n }\n entry[1] = oldEntries;\n }\n }\n } else if (splitType.context === \"map\" ||\n // node property test: (we have to do the test this way, because of inheritance)\n (nestedChangeset.insert ||\n nestedChangeset.modify ||\n nestedChangeset.remove)) {\n // This prevents an error, if the changeset only contains an insert operation. In that case\n // we don't actually need the corresponding old state and thus do not need to throw an error\n // This type of situation can occur in the materialized history, if an insert happens right at a chunk boundary.\n if (Object.keys(nestedChangeset).length === 1 &&\n nestedChangeset.insert) {\n in_context._traversalStopped = true;\n return;\n }\n if (current === undefined) {\n throw new Error(`${MSG.INVALID_PATH + in_context.getFullPath()}. Making map value reversible.`);\n }\n let oldValue = current.insert;\n\n if (isPrimitiveType(splitType.typeid)) {\n if (nestedChangeset.modify) {\n const modifiedKeys = Object.keys(nestedChangeset.modify);\n for (let i = 0; i < modifiedKeys.length; i++) {\n let entry = nestedChangeset.modify[modifiedKeys[i]];\n if (typeof entry === \"object\" && entry.hasOwnProperty(\"value\")) {\n entry = entry.value;\n }\n nestedChangeset.modify[modifiedKeys[i]] = {\n value: entry,\n oldValue: cloneDeep(oldValue[modifiedKeys[i]]),\n };\n }\n }\n let newRemove = {};\n if (nestedChangeset.remove) {\n let removedKeys = nestedChangeset.remove;\n if (!Array.isArray(removedKeys)) {\n removedKeys = Object.keys(removedKeys);\n }\n for (let i = 0; i < removedKeys.length; i++) {\n newRemove[removedKeys[i]] = cloneDeep(oldValue[removedKeys[i]]);\n }\n nestedChangeset.remove = newRemove;\n }\n } else {\n let nestedChangeset = in_context.getNestedChangeSet();\n if (nestedChangeset.modify) {\n // this case is handeled recursively\n }\n let newRemove = {};\n if (nestedChangeset.remove) {\n if (Array.isArray(nestedChangeset.remove)) {\n let removedKeys = nestedChangeset.remove;\n for (let i = 0; i < removedKeys.length; i++) {\n let searchedKey = removedKeys[i];\n // search for this key in the old keys:\n const oldTypeKeys = Object.keys(oldValue);\n for (let k = 0; k < oldTypeKeys.length; k++) {\n if (oldValue[oldTypeKeys[k]].hasOwnProperty(searchedKey)) {\n let entry = oldValue[oldTypeKeys[k]][searchedKey];\n if (!newRemove[oldTypeKeys[k]]) {\n newRemove[oldTypeKeys[k]] = {};\n }\n newRemove[oldTypeKeys[k]][removedKeys[i]] = cloneDeep(entry);\n }\n }\n }\n nestedChangeset.remove = newRemove;\n } else {\n // we already have a reversibleChangeSet and need to update the oldValues\n const removedTypes = Object.keys(nestedChangeset.remove);\n for (let t = 0; t < removedTypes.length; t++) {\n let removedKeys = Object.keys(nestedChangeset.remove[removedTypes[t]]);\n for (let i = 0; i < removedKeys.length; i++) {\n let searchedKey = removedKeys[i];\n let entry = oldValue[removedTypes[t]][searchedKey];\n nestedChangeset.remove[removedTypes[t]][removedKeys[i]] = entry;\n }\n }\n }\n }\n }\n }\n }\n };\n\n /**\n * Converts an irreversible changeset to a reversible changeset\n * or updates the former state of a reversible changeset\n * WARNING: This function is still experimental and needs more testing\n * and it's set to private for now. It will be converted to a public API function\n * in a later release.\n * @param in_oldSerializedState the old state\n */\n public _toReversibleChangeSet(in_oldSerializedState: SerializedChangeSet) {\n ConsoleUtils.assert(in_oldSerializedState !== undefined,\n `${MSG.ASSERTION_FAILED}Missing function parameter \"in_oldSerializedState\" of \"_toReversibleChangeSet\".`);\n\n if (!isObject(in_oldSerializedState) || Array.isArray(in_oldSerializedState)) {\n if (!isObject(this._changes) || Array.isArray(this._changes)) {\n this._changes = {\n oldValue: Array.isArray(in_oldSerializedState) ? in_oldSerializedState.slice() : in_oldSerializedState,\n value: this._changes,\n };\n } else {\n (this._changes as SerializedChangeSet).oldValue = Array.isArray(in_oldSerializedState) ? in_oldSerializedState.slice() :\n in_oldSerializedState;\n }\n } else {\n const workspace = { oldState: in_oldSerializedState };\n Utils.traverseChangeSetRecursively(this._changes, {\n preCallback: this._recursivelyBuildReversibleChangeSet,\n userData: workspace,\n });\n }\n };\n\n /**\n * Converts a reversible changeset to an irreversible changeset\n * WARNING: This function is still experimental and needs more testing\n * and it's set to private for now. It will be converted to a public API function\n * in a later release.\n * @param in_withoutRoot - Bypass a fix where the root of a changeset is cleaned\n */\n public _stripReversibleChangeSet(in_withoutRoot: boolean) {\n // eslint-disable-next-line complexity\n const callback = function(in_context) {\n const opType = in_context.getOperationType();\n if (opType === \"remove\" || opType === \"modify\") {\n const type = in_context.getTypeid();\n if (!type) {\n return;\n }\n const splitType = in_context.getSplitTypeID();\n\n if (isPrimitiveType(type)) {\n // remove old state\n let nestedChangeset = in_context.getNestedChangeSet();\n if (type === \"String\" && !isString(nestedChangeset)) {\n // String is a special case\n\n if (nestedChangeset.modify) {\n for (let i = 0; i < nestedChangeset.modify.length; i++) {\n let entry = nestedChangeset.modify[i];\n entry.splice(2, 1);\n }\n }\n if (nestedChangeset.remove) {\n for (let i = 0; i < nestedChangeset.remove.length; i++) {\n let entry = nestedChangeset.remove[i];\n\n let removeRangeLength = entry[1];\n if (isString(removeRangeLength)) {\n removeRangeLength = entry[1].length;\n }\n entry[1] = removeRangeLength;\n }\n }\n if (nestedChangeset && nestedChangeset.hasOwnProperty(\"value\")) {\n in_context.replaceNestedChangeSet(nestedChangeset.value);\n }\n } else if (nestedChangeset && nestedChangeset.hasOwnProperty(\"value\")) {\n in_context.replaceNestedChangeSet(nestedChangeset.value);\n }\n } else if (splitType.context === \"array\") {\n let nestedChangeset = in_context.getNestedChangeSet();\n if (nestedChangeset.modify) {\n for (let i = 0; i < nestedChangeset.modify.length; i++) {\n let entry = nestedChangeset.modify[i];\n entry.splice(2, 1);\n }\n }\n if (nestedChangeset.remove) {\n for (let i = 0; i < nestedChangeset.remove.length; i++) {\n let entry = nestedChangeset.remove[i];\n let removeRangeLength = entry[1];\n if (Array.isArray(removeRangeLength)) {\n removeRangeLength = entry[1].length;\n }\n entry[1] = removeRangeLength;\n }\n }\n // TODO: Remove in_withoutRoot when it will not be used anymore\n } else if (splitType.context === \"map\" ||\n (!in_withoutRoot && splitType.context === \"single\")) { // For NodeProperty / inserts at the root\n let nestedChangeset = in_context.getNestedChangeSet();\n if (isPrimitiveType(splitType.typeid)) {\n if (nestedChangeset.modify) {\n const modifiedKeys = Object.keys(nestedChangeset.modify);\n for (let i = 0; i < modifiedKeys.length; i++) {\n let entry = nestedChangeset.modify[modifiedKeys[i]];\n if (typeof entry === \"object\" && entry.hasOwnProperty(\"value\")) {\n entry = entry.value;\n }\n nestedChangeset.modify[modifiedKeys[i]] = entry;\n }\n }\n if (nestedChangeset.remove) {\n let removedKeys = nestedChangeset.remove;\n if (!Array.isArray(removedKeys)) {\n removedKeys = Object.keys(removedKeys);\n nestedChangeset.remove = removedKeys;\n }\n }\n } else {\n let nestedChangeset = in_context.getNestedChangeSet();\n if (nestedChangeset.modify) {\n // this case is handeled recursively\n }\n if (nestedChangeset.remove) {\n if (!Array.isArray(nestedChangeset.remove)) {\n // we have a reversibleChangeSet and need to convert\n let newRemove = [];\n const removedTypes = Object.keys(nestedChangeset.remove);\n for (let t = 0; t < removedTypes.length; t++) {\n let removedKeys = Object.keys(nestedChangeset.remove[removedTypes[t]]);\n for (let i = 0; i < removedKeys.length; i++) {\n newRemove.push(removedKeys[i]);\n }\n }\n nestedChangeset.remove = newRemove;\n }\n }\n }\n }\n }\n };\n\n if (isObject(this._changes) &&\n (this._changes as SerializedChangeSet).oldValue !== undefined &&\n (this._changes as SerializedChangeSet).value !== undefined) {\n this._changes = (this._changes as SerializedChangeSet).value;\n return;\n }\n\n Utils.traverseChangeSetRecursively(this._changes, {\n preCallback: callback,\n });\n };\n\n /**\n * Helper function to extract the first level paths from a given change set\n * @param in_changeSet The ChangeSet to extract paths from\n * @param isPrimitiveCollection Is this a primitive type collection?\n *\n * @returns List of paths found at the first level of the change set\n */\n private _extractFirstLevelPaths(in_changeSet: SerializedChangeSet, isPrimitiveCollection: boolean): string[] {\n let paths;\n if (isPrimitiveCollection) {\n paths = Object.keys(in_changeSet);\n } else {\n paths = [];\n each(in_changeSet, function(nestedChangeSet) {\n each(nestedChangeSet, function(nestedChangeSet2, path) {\n paths.push(path);\n });\n });\n }\n\n return paths;\n };\n\n /**\n * recursive helper function for ChangeSet.prototype._toInverseChangeSet\n * @param in_context the traversal context\n */\n private _recursivelyInvertReversibleChangeset(in_context: Utils.TraversalContext) {\n in_context.setUserData(in_context.getUserData() || {});\n\n // Figure out if we have already visited this path by verifying that the full path\n // is contained within the list of processed deleted or inserted paths\n const isWithinInsertOrDelete = in_context.getUserData()[in_context.getFullPath()];\n\n if (isWithinInsertOrDelete && in_context.getOperationType() !== \"modify\") {\n // We are within an insert or remove sub tree. Skip this iteration.\n in_context._traversalStopped = true;\n return;\n }\n\n if (in_context.getOperationType() === \"remove\" ||\n in_context.getOperationType() === \"modify\") {\n const type = in_context.getTypeid();\n const splitType = in_context.getSplitTypeID();\n\n if (!splitType) {\n ConsoleUtils.assert(false,\n `${MSG.ASSERTION_FAILED}Missing \"splitType\" in \"in_context\":${JSON.stringify(in_context)}`);\n }\n\n const nestedChangeset = in_context.getNestedChangeSet();\n\n if ((isPrimitiveType(type) && type !== \"String\") ||\n (type === \"String\" && isString(nestedChangeset.oldValue))) {\n // check if we were called with an irreversible changeset\n if (in_context.getOperationType() === \"modify\" &&\n (!isObject(nestedChangeset) || typeof (nestedChangeset as SerializedChangeSet).oldValue === \"undefined\")) {\n throw new Error(MSG.OLD_VALUE_NOT_FOUND);\n }\n\n // switch oldValue and value\n let tmp = nestedChangeset.oldValue;\n nestedChangeset.oldValue = nestedChangeset.value;\n nestedChangeset.value = tmp;\n } else if ((type === \"String\" && !isString(nestedChangeset.oldValue)) || splitType.context === \"array\") {\n // String and Arrays need special treatment:\n const arrayIterator = new ArrayChangeSetIterator(nestedChangeset);\n const resultChangeset: SerializedChangeSet = {};\n if (nestedChangeset.modify) {\n resultChangeset.modify = [];\n }\n if (nestedChangeset.insert) {\n resultChangeset.remove = [];\n }\n if (nestedChangeset.remove) {\n resultChangeset.insert = [];\n }\n // Successively invert the changes from the changeSet\n while (!arrayIterator.atEnd()) {\n switch (arrayIterator.opDescription.type) {\n case ArrayIteratorOperationTypes.INSERT:\n // Handle inserts\n resultChangeset.remove.push([\n arrayIterator.opDescription.operation[0] + arrayIterator.opDescription.offset,\n arrayIterator.opDescription.operation[1],\n ]);\n break;\n case ArrayIteratorOperationTypes.REMOVE:\n // Handle removes\n resultChangeset.insert.push([\n arrayIterator.opDescription.operation[0] + arrayIterator.opDescription.offset,\n arrayIterator.opDescription.operation[1],\n ]);\n break;\n case ArrayIteratorOperationTypes.MODIFY:\n // Handle modifies\n if (isPrimitiveType(splitType.typeid)) {\n resultChangeset.modify.push([\n arrayIterator.opDescription.operation[0] + arrayIterator.opDescription.offset,\n arrayIterator.opDescription.operation[2],\n arrayIterator.opDescription.operation[1],\n ]);\n } else {\n resultChangeset.modify.push([\n arrayIterator.opDescription.operation[0] + arrayIterator.opDescription.offset,\n arrayIterator.opDescription.operation[1],\n ]);\n }\n break;\n default:\n console.error(`applyChangeset: ${MSG.UNKNOWN_OPERATION}${arrayIterator.opDescription.type}`);\n }\n arrayIterator.next();\n }\n in_context.replaceNestedChangeSet(resultChangeset);\n } else {\n // Covers NodeProperty, Map and Set\n if (nestedChangeset.modify) {\n if (isPrimitiveType(splitType.typeid) && splitType.context === \"map\") {\n const modifiedKeys = Object.keys(nestedChangeset.modify);\n for (let i = 0; i < modifiedKeys.length; i++) {\n const entry = nestedChangeset.modify[modifiedKeys[i]];\n let tmp = entry.value;\n entry.value = entry.oldValue;\n entry.oldValue = tmp;\n }\n }\n }\n const oldInsert = nestedChangeset.insert;\n let replacedInsert = false;\n if (nestedChangeset.remove) {\n nestedChangeset.insert = nestedChangeset.remove;\n replacedInsert = true;\n nestedChangeset.remove = undefined;\n delete nestedChangeset.remove;\n const isPrimitiveTypeid = isPrimitiveType(in_context.getSplitTypeID().typeid);\n each(this._extractFirstLevelPaths(nestedChangeset.insert, isPrimitiveTypeid), function(path) {\n const fullPath = joinPaths(in_context.getFullPath(), path, PROPERTY_PATH_DELIMITER);\n in_context.getUserData()[fullPath] = true;\n });\n }\n if (oldInsert) {\n if (replacedInsert) {\n nestedChangeset.remove = cloneDeep(oldInsert);\n } else {\n nestedChangeset.remove = oldInsert;\n nestedChangeset.insert = undefined;\n delete nestedChangeset.insert;\n }\n const isPrimitiveTypeid = isPrimitiveType(in_context.getSplitTypeID().typeid);\n each(this._extractFirstLevelPaths(nestedChangeset.remove, isPrimitiveTypeid), function(path) {\n const fullPath = joinPaths(in_context.getFullPath(), path, PROPERTY_PATH_DELIMITER);\n in_context.getUserData()[fullPath] = true;\n });\n }\n }\n }\n };\n\n /**\n * Inverts a reversible ChangeSets\n * WARNING: This function is still experimental and needs more testing\n * and it's set to private for now. It will be converted to a public API function\n * in a later release\n */\n public toInverseChangeSet() {\n if (this._changes.value !== undefined &&\n this._changes.oldValue !== undefined) {\n const tmp = this._changes.value;\n this._changes.value = this._changes.oldValue;\n this._changes.oldValue = tmp;\n } else {\n Utils.traverseChangeSetRecursively(this._changes, {\n preCallback: this._recursivelyInvertReversibleChangeset.bind(this),\n });\n }\n }\n}\n\n\nChangeSet.prototype._performApplyAfterOnPropertyArray = ChangeSetArrayFunctions._performApplyAfterOnPropertyArray;\nChangeSet.prototype._rebaseArrayChangeSetForProperty = ChangeSetArrayFunctions._rebaseArrayChangeSetForProperty;\nChangeSet.prototype._rebaseChangeSetForString = ChangeSetArrayFunctions._rebaseChangeSetForString;\n\n// Add the indexed collection functions into the prototype of the ChangeSet\nChangeSet.prototype._performApplyAfterOnPropertyIndexedCollection =\n ChangeSetIndexedCollectionFunctions._performApplyAfterOnPropertyIndexedCollection;\nChangeSet.prototype._cleanIndexedCollectionChangeSet =\n ChangeSetIndexedCollectionFunctions._cleanIndexedCollectionChangeSet;\nChangeSet.prototype._rebaseIndexedCollectionChangeSetForProperty =\n ChangeSetIndexedCollectionFunctions._rebaseIndexedCollectionChangeSetForProperty;\n"]}
1
+ {"version":3,"file":"changeset.js","sourceRoot":"","sources":["../src/changeset.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;;;;AAEH,+DAAuC;AACvC,+DAAuC;AACvC,yDAAoD;AACpD,6DAAqC;AACrC,2DAAmC;AACnC,uDAA+B;AAE/B,YAAY;AACZ,yEAAyF;AAEzF,yDAAsD;AACtD,wDAAuE;AAEvE,0FAAuF;AACvF,0FAA4E;AAC5E,2EAA2E;AAC3E,gFAA+F;AAC/F,8EAA2E;AAC3E,2DAAwD;AACxD,mCAAgC;AAChC,2DAAwD;AACxD,0EAAmF;AAEnF,MAAM,EAAE,uBAAuB,EAAE,GAAG,EAAE,GAAG,2BAAS,CAAC;AAEnD,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,GAAG,2BAAY,CAAC;AAsCzD;;;;GAIG;AACH,MAAa,SAAS;IAgBlB;;;OAGG;IACH,YAAY,UAA0B;QAClC,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,IAAI,EAAE;YACjD,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;SACtB;aAAM,IAAI,kBAAQ,CAAC,UAAU,CAAC,EAAE,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,CAAC,6CAA6C;IAC7D,uDAAmC,CAAC,6CAA6C,CAAC;AACtF,SAAS,CAAC,SAAS,CAAC,gCAAgC;IAChD,uDAAmC,CAAC,gCAAgC,CAAC;AACzE,SAAS,CAAC,SAAS,CAAC,4CAA4C;IAC5D,uDAAmC,CAAC,4CAA4C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Serialized representation of the changes in a repository\n */\n\nimport isObject from \"lodash/isObject\";\nimport isString from \"lodash/isString\";\nimport {copy as cloneDeep} from \"fastest-json-copy\";\nimport isEmpty from \"lodash/isEmpty\";\nimport extend from \"lodash/extend\";\nimport each from \"lodash/each\";\n\n//@ts-ignore\nimport { ConsoleUtils, joinPaths, constants } from \"@fluid-experimental/property-common\";\n\nimport { TypeIdHelper } from \"./helpers/typeidHelper\";\nimport { ChangeSetArrayFunctions } from './changeset_operations/array';\n\nimport { ArrayChangeSetIterator } from \"./changeset_operations/arrayChangesetIterator\";\nimport { ConflictType } from './changeset_operations/changesetConflictTypes'\n// Add the indexed collection functions into the prototype of the ChangeSet\nimport { ChangeSetIndexedCollectionFunctions } from \"./changeset_operations/indexedCollection\";\nimport { isEmptyChangeSet } from \"./changeset_operations/isEmptyChangeset\";\nimport { isReservedKeyword } from \"./isReservedKeyword\";\nimport { Utils } from \"./utils\";\nimport { TemplateValidator } from \"./templateValidator\";\nimport { ArrayIteratorOperationTypes } from \"./changeset_operations/operationTypes\"\n\nconst { PROPERTY_PATH_DELIMITER, MSG } = constants;\n\nconst { extractContext, isPrimitiveType } = TypeIdHelper;\n\n\nexport interface ApplyChangeSetOptions {\n /**\n * Additional meta information which help later to obtain more compact changeset during the apply operation.\n */\n applyAfterMetaInformation?: Map<any, any>,\n\n /**\n * Throw error for template definition mismatches.\n */\n throwOnTemplateMismatch?: boolean\n}\n\n\nexport interface RebaseChangeSetOptions extends ApplyChangeSetOptions {\n rebaseMetaInformation?: object\n}\n\n/**\n * The plain serialization data structure used to encode a ChangeSet.\n */\nexport type SerializedChangeSet = any; //@TODO Maybe we should add full type for the ChangeSet\nexport type ChangeSetType = any;\nexport interface ConflictInfo {\n /**\n * Path to the position where the conflict occurred. If the conflicting change is of type\n * MISMATCH_TEMPLATES then the path will be undefined.\n */\n path?: string | undefined;\n /**\n * Type of the conflict\n */\n type: ConflictType;\n conflictingChange?: SerializedChangeSet;\n}\n\n/**\n * The ChangeSet represents an operation to be done (or that was done) on the data. It encapsulate one or\n * many addition/insertion and deletion of properties. The ChangeSetObject also provides functionality\n * to merge and swap change sets.\n */\nexport class ChangeSet {\n static ConflictType = ConflictType;\n static isEmptyChangeSet = isEmptyChangeSet;\n static isReservedKeyword = isReservedKeyword;\n\n declare public _cleanIndexedCollectionChangeSet: typeof ChangeSetIndexedCollectionFunctions._cleanIndexedCollectionChangeSet;\n declare public _performApplyAfterOnPropertyArray: typeof ChangeSetArrayFunctions._performApplyAfterOnPropertyArray;\n declare public _rebaseArrayChangeSetForProperty: typeof ChangeSetArrayFunctions._rebaseArrayChangeSetForProperty;\n declare public _rebaseChangeSetForString: typeof ChangeSetArrayFunctions._rebaseChangeSetForString;\n declare public _performApplyAfterOnPropertyIndexedCollection: typeof ChangeSetIndexedCollectionFunctions._performApplyAfterOnPropertyIndexedCollection;\n declare public _rebaseIndexedCollectionChangeSetForProperty: typeof ChangeSetIndexedCollectionFunctions._rebaseIndexedCollectionChangeSetForProperty;\n\n\n _changes: SerializedChangeSet;\n _isNormalized: boolean;\n\n /**\n * @param [in_changes] - The serialized changes to store in this change set if a string is supplied,\n * we assume it to be a serialized JSON representation of the change set. If none is supplied, an empty changeset will be created.\n */\n constructor(in_changes?: ChangeSetType) {\n if (in_changes === undefined || in_changes === null) {\n this._changes = {};\n } else if (isString(in_changes)) { // Stringified Serialized JSON\n this._changes = JSON.parse(in_changes);\n } else if (in_changes instanceof ChangeSet) {\n this._changes = cloneDeep(in_changes._changes);\n } else {\n // Serialized Changeset\n this._changes = in_changes;\n }\n\n this._isNormalized = false;\n }\n\n\n /**\n * Creates a string representation of the change set\n * @returns JSON encoding of the changes in this change set\n */\n toString(): string {\n return JSON.stringify(this._changes);\n };\n\n\n /**\n * Returns the serialized changes.\n *\n * @returns The serialized changeset\n */\n getSerializedChangeSet(): SerializedChangeSet {\n return this._changes;\n };\n\n /**\n * Indicates whether this is a normalized ChangeSet. If this is set to true, squashes will not remove empty entries\n * from the ChangeSet.\n *\n * @param in_isNormalized - is this a normalized ChangeSet?\n */\n setIsNormalized(in_isNormalized: boolean) {\n this._isNormalized = in_isNormalized;\n };\n\n /**\n * Indicates whether this is a normalized ChangeSet. If this is set to true, squashes will not remove empty entries\n * from the ChangeSet.\n *\n * @returns Is this a normalized ChangeSet?\n */\n getIsNormalized(): boolean {\n return this._isNormalized;\n };\n\n /**\n * Clones the ChangeSet\n *\n * @returns The cloned ChangeSet\n */\n clone(): ChangeSet {\n return new ChangeSet(cloneDeep(this._changes));\n };\n\n\n /**\n * Updates this ChangeSet. The result will be the concatenation of the two ChangeSets. First the changes in this\n * ChangeSet are executed, then the changes in the supplied in_changeSet are applied. The result will be\n * stored in this ChangeSet. This function assumes that the second ChangeSet is relative to the state after\n * application of the first ChangeSet.\n *\n * @param in_changeSet - The changeset to apply\n * @param in_options - Optional additional parameters\n */\n applyChangeSet(in_changeSet: SerializedChangeSet, in_options?: ApplyChangeSetOptions) {\n let changes = in_changeSet;\n if (in_changeSet instanceof ChangeSet) {\n changes = in_changeSet.getSerializedChangeSet();\n }\n\n if (!isObject(this._changes) || Array.isArray(this._changes)) {\n const oldValue = isObject(changes) && (changes as SerializedChangeSet).value !== undefined ? (changes as SerializedChangeSet).value : changes;\n this._changes = Array.isArray(oldValue) ? oldValue.slice() : oldValue;\n } else {\n this._performApplyAfterOnProperty(this._changes, changes, !this._isNormalized, in_options);\n }\n };\n\n /**\n * Applies a changeset to a given property (recursively). The ChangeSet is assumed to be relative to the same\n * property root and it will be applied behind the base ChangeSet (assuming that the changes are relative to the\n * 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_removeEmpty - Should empty ChangeSets be removed?\n * @param in_options - Optional additional parameters\n */\n private _performApplyAfterOnProperty(\n io_basePropertyChanges: SerializedChangeSet,\n in_appliedPropertyChanges: SerializedChangeSet,\n in_removeEmpty: boolean,\n in_options?: ApplyChangeSetOptions) {\n // Apply dynamic property operations\n if (in_appliedPropertyChanges.insert ||\n in_appliedPropertyChanges.modify ||\n in_appliedPropertyChanges.remove) {\n this._performApplyAfterOnPropertyIndexedCollection(io_basePropertyChanges,\n in_appliedPropertyChanges,\n \"NodeProperty\",\n in_options); // TODO: recursively propagate the typeid?\n }\n\n if (!isEmpty(in_appliedPropertyChanges.insertTemplates)) {\n io_basePropertyChanges.insertTemplates = io_basePropertyChanges.insertTemplates || {};\n extend(io_basePropertyChanges.insertTemplates, in_appliedPropertyChanges.insertTemplates);\n }\n\n // Apply ChangeSet to the properties\n const modifiedTypeids = Object.keys(in_appliedPropertyChanges);\n for (let i = 0; i < modifiedTypeids.length; i++) {\n const typeid = modifiedTypeids[i];\n // The reserved keywords have already been handled above\n if (ChangeSet.isReservedKeyword(typeid)) {\n continue;\n }\n\n io_basePropertyChanges[typeid] = io_basePropertyChanges[typeid] || {};\n const baseChanges = io_basePropertyChanges[typeid];\n const changedKeys = Object.keys(in_appliedPropertyChanges[typeid]);\n for (let j = 0; j < changedKeys.length; j++) {\n this.performApplyAfterOnPropertyWithTypeid(changedKeys[j],\n baseChanges,\n in_appliedPropertyChanges[typeid],\n typeid,\n in_removeEmpty,\n in_options);\n }\n // Remove the type when it no longer contains any changed keys\n if (in_removeEmpty && isEmpty(io_basePropertyChanges[typeid])) {\n delete io_basePropertyChanges[typeid];\n }\n }\n };\n\n /**\n * Helper function used to apply a new value to a given ChangeSet.\n * It is used to handle setting a primitive value, which might either be represented\n * via a literal or an object with a member value.\n * applies in_appliedValue to the io_baseChanges at the given in_baseKey\n * @param io_baseChanges - base changes (modified)\n * @param in_baseKey - key\n * @param in_appliedValue - applied changes to be applied\n */\n private _applyValue(io_baseChanges: SerializedChangeSet, in_baseKey: string, in_appliedValue: SerializedChangeSet) {\n const newValue = (in_appliedValue && in_appliedValue.hasOwnProperty(\"value\")) ?\n in_appliedValue.value : in_appliedValue;\n if (io_baseChanges[in_baseKey] && io_baseChanges[in_baseKey].hasOwnProperty(\"value\")) {\n io_baseChanges[in_baseKey].value = newValue;\n } else {\n if (io_baseChanges[in_baseKey] === undefined &&\n in_appliedValue && in_appliedValue.hasOwnProperty(\"oldValue\")) {\n io_baseChanges[in_baseKey] = {\n value: newValue,\n oldValue: in_appliedValue.oldValue,\n };\n } else {\n io_baseChanges[in_baseKey] = newValue;\n }\n }\n };\n\n /**\n * Decides based on the given Typeid which applyAfter operation to perform.\n * Note: This function is not directly called on the ChangeSet but on the object containing it together with a key\n * since it needs to be able to overwrite this entry\n *\n * @param in_changedKey - The key of the entry in the object\n * @param in_baseChanges - The object containing the state before the applyAfter\n * @param in_appliedPropertyChanges - The object containing the ChangeSet with the modification\n * @param in_typeid - The typeid of the property to modify\n * @param in_removeEmpty - Should empty ChangeSets be removed?\n * @param in_options - Optional additional parameters\n */\n public performApplyAfterOnPropertyWithTypeid(\n in_changedKey: string,\n in_baseChanges: SerializedChangeSet,\n in_appliedPropertyChanges: { [x: string]: any; },\n in_typeid: string,\n in_removeEmpty: boolean,\n in_options?: ApplyChangeSetOptions) {\n const splitTypeid = extractContext(in_typeid);\n\n if (splitTypeid.context === \"set\" ||\n splitTypeid.context === \"map\") {\n in_baseChanges[in_changedKey] = in_baseChanges[in_changedKey] || {};\n this._performApplyAfterOnPropertyIndexedCollection(in_baseChanges[in_changedKey],\n in_appliedPropertyChanges[in_changedKey],\n splitTypeid.typeid,\n in_options);\n\n // Remove the key, when it no longer contains a changeset\n if (in_removeEmpty && isEmpty(in_baseChanges[in_changedKey])) {\n delete in_baseChanges[in_changedKey];\n }\n } else if (splitTypeid.context === \"array\" || splitTypeid.typeid === \"String\") {\n in_baseChanges[in_changedKey] = in_baseChanges[in_changedKey] !== undefined ? in_baseChanges[in_changedKey] : {};\n let baseIsSetChange = false;\n let oldValue;\n if (splitTypeid.typeid === \"String\" &&\n (isString(in_baseChanges[in_changedKey]) ||\n (in_baseChanges[in_changedKey] && in_baseChanges[in_changedKey].hasOwnProperty(\"value\")))) {\n oldValue = in_baseChanges[in_changedKey].oldValue;\n // we need to convert the format to allow the application of the changes\n // since _performApplyAfterOnPropertyArray only understands insert/modify/remove commands\n if (in_baseChanges[in_changedKey] && in_baseChanges[in_changedKey].hasOwnProperty(\"value\")) {\n in_baseChanges[in_changedKey] = {\n insert: [\n [0, in_baseChanges[in_changedKey].value],\n ],\n };\n } else {\n in_baseChanges[in_changedKey] = {\n insert: [\n [0, in_baseChanges[in_changedKey]],\n ],\n };\n }\n baseIsSetChange = true;\n }\n let appliedChanges = in_appliedPropertyChanges[in_changedKey];\n if (isObject(appliedChanges) && appliedChanges.hasOwnProperty(\"value\")) {\n appliedChanges = (appliedChanges as SerializedChangeSet).value;\n }\n\n if (splitTypeid.typeid === \"String\" && isString(appliedChanges)) {\n // we've got a 'set' command and just overwrite the changes\n if (baseIsSetChange && oldValue !== undefined) {\n in_baseChanges[in_changedKey] = {\n value: appliedChanges,\n oldValue,\n };\n } else {\n in_baseChanges[in_changedKey] = appliedChanges;\n }\n } else {\n // we have incremental changes (or a standard array)\n this._performApplyAfterOnPropertyArray(in_baseChanges[in_changedKey],\n in_appliedPropertyChanges[in_changedKey],\n splitTypeid.typeid,\n in_options);\n if (baseIsSetChange) {\n // we have to convert back to a string, if it had been converted before\n let newValue;\n if (isEmpty(in_baseChanges[in_changedKey])) {\n newValue = \"\";\n } else {\n newValue = in_baseChanges[in_changedKey].insert[0][1];\n }\n if (oldValue !== undefined) {\n in_baseChanges[in_changedKey] = {\n value: newValue,\n oldValue,\n };\n } else {\n in_baseChanges[in_changedKey] = newValue;\n }\n }\n }\n\n // Remove the key, when it no longer contains a changeset\n if (in_removeEmpty && ChangeSet.isEmptyChangeSet(in_baseChanges[in_changedKey])) {\n delete in_baseChanges[in_changedKey];\n }\n } else if (splitTypeid.isEnum) {\n // Enum types can simply be overwritten\n this._applyValue(in_baseChanges, in_changedKey, in_appliedPropertyChanges[in_changedKey]);\n } else if (splitTypeid.context === \"single\") {\n if (isPrimitiveType(splitTypeid.typeid)) {\n // Primitive types can simply be overwritten, however we have an exception for\n // 64 bit integers (until javascript natively supports them)\n if (splitTypeid.typeid === \"Int64\" || splitTypeid.typeid === \"Uint64\") {\n let appliedVal = in_appliedPropertyChanges[in_changedKey];\n if (appliedVal && appliedVal.hasOwnProperty(\"value\")) {\n appliedVal = appliedVal.value;\n }\n this._applyValue(in_baseChanges, in_changedKey, appliedVal.slice());\n } else {\n this._applyValue(in_baseChanges, in_changedKey, in_appliedPropertyChanges[in_changedKey]);\n }\n } else {\n if (in_baseChanges[in_changedKey]) {\n // Otherwise we have to continue the merging recursively\n this._performApplyAfterOnProperty(in_baseChanges[in_changedKey],\n in_appliedPropertyChanges[in_changedKey],\n false,\n in_options);\n } else {\n // If the key doesn't exist, yet, we can just copy it\n in_baseChanges[in_changedKey] = cloneDeep(in_appliedPropertyChanges[in_changedKey]);\n }\n }\n } else {\n throw new Error(MSG.UNKNOWN_CONTEXT + splitTypeid.context);\n }\n };\n\n /**\n * Rebases a given ChangeSet behind the current ChangeSet.\n *\n * This function takes a ChangeSet which is assumed to be relative to the same base state as the ChangeSet stored in\n * this class and transforms it in such a way that it can be applied after this ChangeSet. The function will modify\n * the supplied ChangeSet\n *\n * @param io_changeSet -\n * The ChangeSet that is rebased behind the state obtained by application of this ChangeSet\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 * @returns The rebased ChangeSet (the same object as io_changeSet, it will be\n * modified in place)\n */\n public _rebaseChangeSet(io_changeSet: SerializedChangeSet, out_conflicts: ConflictInfo[],\n in_options?: RebaseChangeSetOptions): SerializedChangeSet {\n // We actually only pass this request to the recursive internal function\n return this._rebaseChangeSetForProperty(this._changes, io_changeSet, \"\", out_conflicts, in_options);\n };\n\n /**\n * Internal helper function that performs a rebase on a single property\n *\n * @param in_ownPropertyChangeSet -\n * The ChangeSet for the property stored in this class\n * @param io_rebasePropertyChangeSet -\n * The ChangeSet for the property to be rebased\n * @param in_basePath -\n * Base path to get to the property processed by this function\n * @param out_conflicts -\n * A list of paths that resulted in conflicts together with the type of the conflict\n * @param in_options - Optional additional parameters\n * @returns The rebased ChangeSet for this property\n */\n private _rebaseChangeSetForProperty(\n in_ownPropertyChangeSet: SerializedChangeSet,\n io_rebasePropertyChangeSet: SerializedChangeSet,\n in_basePath: string,\n out_conflicts: ConflictInfo[],\n in_options: ApplyChangeSetOptions): SerializedChangeSet {\n // Process the children in this ChangeSet\n if ((in_ownPropertyChangeSet.insert ||\n in_ownPropertyChangeSet.modify ||\n in_ownPropertyChangeSet.remove) &&\n (io_rebasePropertyChangeSet.insert ||\n io_rebasePropertyChangeSet.modify ||\n io_rebasePropertyChangeSet.remove)) {\n this._rebaseIndexedCollectionChangeSetForProperty(in_ownPropertyChangeSet,\n io_rebasePropertyChangeSet,\n in_basePath,\n \"NodeProperty\", // TODO: recursively propagate the typeid?\n false, // don't use square brackets (use dots instead)\n out_conflicts,\n in_options);\n }\n if (!isEmpty(io_rebasePropertyChangeSet.insertTemplates)) {\n const typeids = Object.keys(io_rebasePropertyChangeSet.insertTemplates);\n\n const templateMismatchChangeSet = { insertTemplates: {} };\n\n const templateMismatchConflict = {\n type: ChangeSet.ConflictType.MISMATCH_TEMPLATES,\n conflictingChange: templateMismatchChangeSet,\n };\n\n each(typeids, function(typeid) {\n const template = io_rebasePropertyChangeSet.insertTemplates[typeid];\n if (in_ownPropertyChangeSet.insertTemplates &&\n in_ownPropertyChangeSet.insertTemplates[typeid]) {\n const isEqual = TemplateValidator.Utils.psetDeepEquals(\n template,\n in_ownPropertyChangeSet.insertTemplates[template.typeid],\n );\n\n if (!isEqual) {\n if (in_options && in_options.throwOnTemplateMismatch) {\n throw new Error(MSG.TEMPLATE_MISMATCH + typeid);\n }\n\n templateMismatchChangeSet.insertTemplates[typeid] =\n in_ownPropertyChangeSet.insertTemplates[template.typeid];\n // TODO: Remove this warning message once we offer a conflict resolution API\n console.warn(MSG.TEMPLATE_MISMATCH + typeid);\n }\n\n delete io_rebasePropertyChangeSet.insertTemplates[typeid];\n }\n });\n\n // Remove insertTemplates key if it is empty\n if (isEmpty(io_rebasePropertyChangeSet.insertTemplates)) {\n delete io_rebasePropertyChangeSet.insertTemplates;\n }\n\n if (!isEmpty(templateMismatchConflict.conflictingChange.insertTemplates)) {\n out_conflicts.push(templateMismatchConflict);\n }\n }\n\n // Check for collisions in the property assignments\n const changedTypeids = Object.keys(in_ownPropertyChangeSet);\n\n // We currently do not yet have any\n const changeSet = {};\n for (let i = 0; i < changedTypeids.length; i++) {\n const typeid = changedTypeids[i];\n const paths = Object.keys(in_ownPropertyChangeSet[typeid]);\n\n // Update the oldValue of primitive property of a changeset\n // for simple changeset with 'modify', property type, name, value\n // find the oldValue of the property and update it\n if (typeid === \"modify\" && \"modify\" in io_rebasePropertyChangeSet) {\n for (let j = 0; j < paths.length; j++) {\n const tempTypeid = paths[i];\n if ((isPrimitiveType(tempTypeid)) &&\n tempTypeid in io_rebasePropertyChangeSet.modify) {\n const tempPaths = Object.keys(in_ownPropertyChangeSet.modify[tempTypeid]);\n for (let z = 0; z < tempPaths.length; z++) {\n if (tempPaths[z] in io_rebasePropertyChangeSet.modify[tempTypeid]) {\n let rebasedPropContent = io_rebasePropertyChangeSet.modify[tempTypeid][tempPaths[z]];\n if (isObject(rebasedPropContent) && \"oldValue\" in rebasedPropContent) {\n (rebasedPropContent as SerializedChangeSet).oldValue = in_ownPropertyChangeSet.modify[tempTypeid][tempPaths[z]].value;\n }\n }\n }\n }\n }\n } else if (isPrimitiveType(typeid)) {\n // for complex changeset, the function will be called recursively, when the function is at the level where\n // io_rebasePropertyChangeSet && in_ownPropertyChangeSet contain only property type, name and value, we update\n // oldValue of io_rebasePropertyChangeSet.\n for (let j = 0; j < paths.length; j++) {\n if (typeid in io_rebasePropertyChangeSet && paths[j] in io_rebasePropertyChangeSet[typeid]) {\n let rebasedPropContent = io_rebasePropertyChangeSet[typeid][paths[j]];\n if (isObject(rebasedPropContent) && \"oldValue\" in rebasedPropContent) {\n // if oldValue already be update above, we don't need to update\n if (io_rebasePropertyChangeSet[typeid][paths[j]].oldValue !==\n in_ownPropertyChangeSet[typeid][paths[j]].value) {\n io_rebasePropertyChangeSet[typeid][paths[j]].oldValue = in_ownPropertyChangeSet[typeid][paths[j]].value;\n }\n }\n }\n }\n }\n\n // The reserved keywords have already been handled above and changes which are not present in\n // the other ChangeSet can be ignored\n if (ChangeSet.isReservedKeyword(typeid) ||\n !io_rebasePropertyChangeSet[typeid]) {\n continue;\n }\n\n // Check, whether we have a collision in a path update\n for (let j = 0; j < paths.length; j++) {\n if (io_rebasePropertyChangeSet[typeid][paths[j]] !== undefined) {\n in_ownPropertyChangeSet[typeid] = in_ownPropertyChangeSet[typeid] || {};\n\n const newPath = joinPaths(in_basePath,\n paths[j],\n PROPERTY_PATH_DELIMITER);\n // Perform the rebase operation on the ChangeSet for this entry\n const setConflict = this.rebaseChangeSetForPropertyEntryWithTypeid(paths[j],\n in_ownPropertyChangeSet[typeid],\n io_rebasePropertyChangeSet[typeid],\n typeid,\n newPath,\n true,\n out_conflicts,\n in_options);\n\n // If there has been a non-recursive set collision we handle it here separately\n if (setConflict) {\n // If we have two writes to primitive types, this is a conflict\n changeSet[typeid] = changeSet[typeid] || {};\n\n // Store the change. Note: We make a deep copy here, as this is a reference into our\n // own internal ChangeSet and we want to be sure, nobody changes our internal data-structures\n changeSet[typeid][paths[j]] = cloneDeep(in_ownPropertyChangeSet[typeid][paths[j]]);\n }\n\n // Remove the typeid, when it no longer contains any keys\n if (isEmpty(io_rebasePropertyChangeSet[typeid])) {\n delete io_rebasePropertyChangeSet[typeid];\n }\n }\n }\n }\n\n // If there were conflicts in the set operations, report them\n if (!isEmpty(changeSet)) {\n const conflict = {\n path: in_basePath,\n type: ChangeSet.ConflictType.COLLIDING_SET,\n conflictingChange: changeSet,\n };\n out_conflicts.push(conflict);\n }\n\n return io_rebasePropertyChangeSet;\n };\n\n /**\n * Decides based on the given Typeid which rebase operation to perform\n * Note: This function is not directly called on the ChangeSet but on the object containing it together with a key\n * since it needs to be able to overwrite this entry\n *\n * @param in_key - The key of the entry in the object\n * @param in_ownPropertyChangeSet - The object containing the ChangeSet for the property\n * stored in this class\n * @param io_rebasePropertyChangeSet - The object containing the ChangeSet for the property to\n * be rebased\n * @param in_typeid - The typeid of the property to rebase\n * @param in_basePath - Base path to get to the property processed by this function\n * @param in_removeEmpty - Should empty ChangeSets be removed?\n * @param out_conflicts - A list of paths that resulted in\n * conflicts together with the type of the conflict\n *\n * @returns Has there been a simple set collision? Those have to be handled separately\n * TODO: We should unify the handling of set collisions\n * @private\n */\n private rebaseChangeSetForPropertyEntryWithTypeid(\n in_key: string,\n in_ownPropertyChangeSet: SerializedChangeSet,\n io_rebasePropertyChangeSet: SerializedChangeSet,\n in_typeid: string,\n in_basePath: string,\n in_removeEmpty: boolean,\n out_conflicts: any,\n in_options: ApplyChangeSetOptions): boolean {\n const splitTypeid = extractContext(in_typeid);\n\n if (splitTypeid.context === \"set\" ||\n splitTypeid.context === \"map\") {\n this._rebaseIndexedCollectionChangeSetForProperty(in_ownPropertyChangeSet[in_key],\n io_rebasePropertyChangeSet[in_key],\n in_basePath,\n splitTypeid.typeid,\n true, // use square brackets\n out_conflicts,\n in_options);\n\n // Remove the key, when it no longer contains a changeset\n if (in_removeEmpty && isEmpty(io_rebasePropertyChangeSet[in_key])) {\n delete io_rebasePropertyChangeSet[in_key];\n }\n } else if (splitTypeid.context === \"array\") {\n this._rebaseArrayChangeSetForProperty(in_ownPropertyChangeSet[in_key],\n io_rebasePropertyChangeSet[in_key],\n in_basePath,\n out_conflicts,\n splitTypeid.typeid,\n in_options);\n // Remove the key, when it no longer contains a changeset\n if (in_removeEmpty && isEmpty(io_rebasePropertyChangeSet[in_key])) {\n delete io_rebasePropertyChangeSet[in_key];\n }\n } else if (splitTypeid.typeid === \"String\") {\n this._rebaseChangeSetForString(in_ownPropertyChangeSet[in_key],\n io_rebasePropertyChangeSet, in_key,\n in_basePath,\n out_conflicts,\n in_options);\n // Remove the key, when it no longer contains a changeset\n if (in_removeEmpty && isEmpty(io_rebasePropertyChangeSet[in_key])) {\n delete io_rebasePropertyChangeSet[in_key];\n }\n } else if (splitTypeid.context === \"single\") {\n // We only can have a conflict when the path exists in both ChangeSets\n if (in_ownPropertyChangeSet[in_key] !== undefined) {\n if (isPrimitiveType(splitTypeid.typeid) || splitTypeid.isEnum) {\n return true;\n } else {\n // Otherwise, we have to continue recursively\n\n // Make sure the paths exist\n in_ownPropertyChangeSet[in_key] = in_ownPropertyChangeSet[in_key] || {};\n\n // And then perform the recursive rebase\n this._rebaseChangeSetForProperty(in_ownPropertyChangeSet[in_key],\n io_rebasePropertyChangeSet[in_key],\n in_basePath,\n out_conflicts,\n in_options);\n }\n }\n } else {\n throw new Error(MSG.UNKNOWN_CONTEXT + splitTypeid.context);\n }\n\n return false;\n };\n\n /**\n * recursive helper function for ChangeSet.prototype._toReversibleChangeSet\n * which converts a irreversible changeset to a reversible changeset\n * or updates the former state of a reversible changeset\n * @param in_context the traversal context\n */\n private _recursivelyBuildReversibleChangeSet(in_context: Utils.TraversalContext) {\n const opType = in_context.getOperationType();\n if (opType === \"modify\") {\n const type = in_context.getTypeid();\n const splitType = in_context.getSplitTypeID();\n let nestedChangeset = in_context.getNestedChangeSet();\n\n let current = in_context.getUserData().parallelState;\n if (in_context.getPropertyContainerType() === \"root\") {\n current = in_context.getUserData().oldState;\n } else if (current) {\n if (in_context.getPropertyContainerType() !== \"template\") {\n current = current.insert;\n }\n\n if (in_context.getPropertyContainerType() !== \"array\") {\n current = current && current[in_context.getTypeid()];\n current = current && current[in_context.getLastSegment()];\n } else {\n current = current && current[0][1][in_context.getLastSegment()];\n }\n }\n\n in_context.setUserData({\n parallelState: current,\n oldState: in_context.getUserData().oldState,\n });\n\n if (isPrimitiveType(type)) {\n if (current === undefined) {\n throw new Error(`${MSG.INVALID_PATH + in_context.getFullPath()}. Making primitive value reversible.`);\n }\n let oldValue = current;\n\n // store it in reversibleChangeSet\n if (type === \"String\" && !isString(nestedChangeset)) {\n // String is a special case\n let oldString;\n if (isString(oldValue)) {\n oldString = oldValue;\n }\n if (nestedChangeset.modify) {\n for (let i = 0; i < nestedChangeset.modify.length; i++) {\n let entry = nestedChangeset.modify[i];\n let entryOffset = entry[0];\n const entryLength = entry[1].length;\n entry[2] = oldString.slice(entryOffset, entryOffset + entryLength);\n }\n }\n if (nestedChangeset.remove) {\n for (let i = 0; i < nestedChangeset.remove.length; i++) {\n let entry = nestedChangeset.remove[i];\n let entryOffset = entry[0];\n\n let removeRangeLength = entry[1];\n if (isString(removeRangeLength)) {\n removeRangeLength = entry[1].length;\n }\n entry[1] = oldString.slice(entryOffset, entryOffset + removeRangeLength);\n }\n }\n } else {\n if (nestedChangeset && nestedChangeset.hasOwnProperty(\"value\")) {\n nestedChangeset.oldValue = oldValue;\n } else {\n const newChangeSet = {\n value: nestedChangeset,\n oldValue,\n };\n in_context.replaceNestedChangeSet(newChangeSet);\n }\n }\n } else if (splitType.context === \"array\") {\n if (current === undefined) {\n throw new Error(`${MSG.INVALID_PATH + in_context.getFullPath()}. Making array value reversible.`);\n }\n let oldValue = current.insert ? current.insert[0][1] : [];\n\n let nestedChangeset = in_context.getNestedChangeSet();\n if (nestedChangeset.modify) {\n if (isPrimitiveType(splitType.typeid)) {\n for (let i = 0; i < nestedChangeset.modify.length; i++) {\n let entry = nestedChangeset.modify[i];\n let entryOffset = entry[0];\n let oldEntries = [];\n for (let j = 0; j < entry[1].length; j++) {\n oldEntries.push(cloneDeep(oldValue[entryOffset + j]));\n }\n entry[2] = oldEntries;\n }\n }\n }\n if (nestedChangeset.remove) {\n for (let i = 0; i < nestedChangeset.remove.length; i++) {\n let entry = nestedChangeset.remove[i];\n let entryOffset = entry[0];\n let oldEntries = [];\n\n let removeRangeLength = entry[1];\n if (Array.isArray(removeRangeLength)) {\n removeRangeLength = entry[1].length;\n }\n\n for (let j = 0; j < removeRangeLength; j++) {\n oldEntries.push(cloneDeep(oldValue[entryOffset + j]));\n }\n entry[1] = oldEntries;\n }\n }\n } else if (splitType.context === \"map\" ||\n // node property test: (we have to do the test this way, because of inheritance)\n (nestedChangeset.insert ||\n nestedChangeset.modify ||\n nestedChangeset.remove)) {\n // This prevents an error, if the changeset only contains an insert operation. In that case\n // we don't actually need the corresponding old state and thus do not need to throw an error\n // This type of situation can occur in the materialized history, if an insert happens right at a chunk boundary.\n if (Object.keys(nestedChangeset).length === 1 &&\n nestedChangeset.insert) {\n in_context._traversalStopped = true;\n return;\n }\n if (current === undefined) {\n throw new Error(`${MSG.INVALID_PATH + in_context.getFullPath()}. Making map value reversible.`);\n }\n let oldValue = current.insert;\n\n if (isPrimitiveType(splitType.typeid)) {\n if (nestedChangeset.modify) {\n const modifiedKeys = Object.keys(nestedChangeset.modify);\n for (let i = 0; i < modifiedKeys.length; i++) {\n let entry = nestedChangeset.modify[modifiedKeys[i]];\n if (typeof entry === \"object\" && entry.hasOwnProperty(\"value\")) {\n entry = entry.value;\n }\n nestedChangeset.modify[modifiedKeys[i]] = {\n value: entry,\n oldValue: cloneDeep(oldValue[modifiedKeys[i]]),\n };\n }\n }\n let newRemove = {};\n if (nestedChangeset.remove) {\n let removedKeys = nestedChangeset.remove;\n if (!Array.isArray(removedKeys)) {\n removedKeys = Object.keys(removedKeys);\n }\n for (let i = 0; i < removedKeys.length; i++) {\n newRemove[removedKeys[i]] = cloneDeep(oldValue[removedKeys[i]]);\n }\n nestedChangeset.remove = newRemove;\n }\n } else {\n let nestedChangeset = in_context.getNestedChangeSet();\n if (nestedChangeset.modify) {\n // this case is handeled recursively\n }\n let newRemove = {};\n if (nestedChangeset.remove) {\n if (Array.isArray(nestedChangeset.remove)) {\n let removedKeys = nestedChangeset.remove;\n for (let i = 0; i < removedKeys.length; i++) {\n let searchedKey = removedKeys[i];\n // search for this key in the old keys:\n const oldTypeKeys = Object.keys(oldValue);\n for (let k = 0; k < oldTypeKeys.length; k++) {\n if (oldValue[oldTypeKeys[k]].hasOwnProperty(searchedKey)) {\n let entry = oldValue[oldTypeKeys[k]][searchedKey];\n if (!newRemove[oldTypeKeys[k]]) {\n newRemove[oldTypeKeys[k]] = {};\n }\n newRemove[oldTypeKeys[k]][removedKeys[i]] = cloneDeep(entry);\n }\n }\n }\n nestedChangeset.remove = newRemove;\n } else {\n // we already have a reversibleChangeSet and need to update the oldValues\n const removedTypes = Object.keys(nestedChangeset.remove);\n for (let t = 0; t < removedTypes.length; t++) {\n let removedKeys = Object.keys(nestedChangeset.remove[removedTypes[t]]);\n for (let i = 0; i < removedKeys.length; i++) {\n let searchedKey = removedKeys[i];\n let entry = oldValue[removedTypes[t]][searchedKey];\n nestedChangeset.remove[removedTypes[t]][removedKeys[i]] = entry;\n }\n }\n }\n }\n }\n }\n }\n };\n\n /**\n * Converts an irreversible changeset to a reversible changeset\n * or updates the former state of a reversible changeset\n * WARNING: This function is still experimental and needs more testing\n * and it's set to private for now. It will be converted to a public API function\n * in a later release.\n * @param in_oldSerializedState the old state\n */\n public _toReversibleChangeSet(in_oldSerializedState: SerializedChangeSet) {\n ConsoleUtils.assert(in_oldSerializedState !== undefined,\n `${MSG.ASSERTION_FAILED}Missing function parameter \"in_oldSerializedState\" of \"_toReversibleChangeSet\".`);\n\n if (!isObject(in_oldSerializedState) || Array.isArray(in_oldSerializedState)) {\n if (!isObject(this._changes) || Array.isArray(this._changes)) {\n this._changes = {\n oldValue: Array.isArray(in_oldSerializedState) ? in_oldSerializedState.slice() : in_oldSerializedState,\n value: this._changes,\n };\n } else {\n (this._changes as SerializedChangeSet).oldValue = Array.isArray(in_oldSerializedState) ? in_oldSerializedState.slice() :\n in_oldSerializedState;\n }\n } else {\n const workspace = { oldState: in_oldSerializedState };\n Utils.traverseChangeSetRecursively(this._changes, {\n preCallback: this._recursivelyBuildReversibleChangeSet,\n userData: workspace,\n });\n }\n };\n\n /**\n * Converts a reversible changeset to an irreversible changeset\n * WARNING: This function is still experimental and needs more testing\n * and it's set to private for now. It will be converted to a public API function\n * in a later release.\n * @param in_withoutRoot - Bypass a fix where the root of a changeset is cleaned\n */\n public _stripReversibleChangeSet(in_withoutRoot: boolean) {\n const callback = function(in_context) {\n const opType = in_context.getOperationType();\n if (opType === \"remove\" || opType === \"modify\") {\n const type = in_context.getTypeid();\n if (!type) {\n return;\n }\n const splitType = in_context.getSplitTypeID();\n\n if (isPrimitiveType(type)) {\n // remove old state\n let nestedChangeset = in_context.getNestedChangeSet();\n if (type === \"String\" && !isString(nestedChangeset)) {\n // String is a special case\n\n if (nestedChangeset.modify) {\n for (let i = 0; i < nestedChangeset.modify.length; i++) {\n let entry = nestedChangeset.modify[i];\n entry.splice(2, 1);\n }\n }\n if (nestedChangeset.remove) {\n for (let i = 0; i < nestedChangeset.remove.length; i++) {\n let entry = nestedChangeset.remove[i];\n\n let removeRangeLength = entry[1];\n if (isString(removeRangeLength)) {\n removeRangeLength = entry[1].length;\n }\n entry[1] = removeRangeLength;\n }\n }\n if (nestedChangeset && nestedChangeset.hasOwnProperty(\"value\")) {\n in_context.replaceNestedChangeSet(nestedChangeset.value);\n }\n } else if (nestedChangeset && nestedChangeset.hasOwnProperty(\"value\")) {\n in_context.replaceNestedChangeSet(nestedChangeset.value);\n }\n } else if (splitType.context === \"array\") {\n let nestedChangeset = in_context.getNestedChangeSet();\n if (nestedChangeset.modify) {\n for (let i = 0; i < nestedChangeset.modify.length; i++) {\n let entry = nestedChangeset.modify[i];\n entry.splice(2, 1);\n }\n }\n if (nestedChangeset.remove) {\n for (let i = 0; i < nestedChangeset.remove.length; i++) {\n let entry = nestedChangeset.remove[i];\n let removeRangeLength = entry[1];\n if (Array.isArray(removeRangeLength)) {\n removeRangeLength = entry[1].length;\n }\n entry[1] = removeRangeLength;\n }\n }\n // TODO: Remove in_withoutRoot when it will not be used anymore\n } else if (splitType.context === \"map\" ||\n (!in_withoutRoot && splitType.context === \"single\")) { // For NodeProperty / inserts at the root\n let nestedChangeset = in_context.getNestedChangeSet();\n if (isPrimitiveType(splitType.typeid)) {\n if (nestedChangeset.modify) {\n const modifiedKeys = Object.keys(nestedChangeset.modify);\n for (let i = 0; i < modifiedKeys.length; i++) {\n let entry = nestedChangeset.modify[modifiedKeys[i]];\n if (typeof entry === \"object\" && entry.hasOwnProperty(\"value\")) {\n entry = entry.value;\n }\n nestedChangeset.modify[modifiedKeys[i]] = entry;\n }\n }\n if (nestedChangeset.remove) {\n let removedKeys = nestedChangeset.remove;\n if (!Array.isArray(removedKeys)) {\n removedKeys = Object.keys(removedKeys);\n nestedChangeset.remove = removedKeys;\n }\n }\n } else {\n let nestedChangeset = in_context.getNestedChangeSet();\n if (nestedChangeset.modify) {\n // this case is handeled recursively\n }\n if (nestedChangeset.remove) {\n if (!Array.isArray(nestedChangeset.remove)) {\n // we have a reversibleChangeSet and need to convert\n let newRemove = [];\n const removedTypes = Object.keys(nestedChangeset.remove);\n for (let t = 0; t < removedTypes.length; t++) {\n let removedKeys = Object.keys(nestedChangeset.remove[removedTypes[t]]);\n for (let i = 0; i < removedKeys.length; i++) {\n newRemove.push(removedKeys[i]);\n }\n }\n nestedChangeset.remove = newRemove;\n }\n }\n }\n }\n }\n };\n\n if (isObject(this._changes) &&\n (this._changes as SerializedChangeSet).oldValue !== undefined &&\n (this._changes as SerializedChangeSet).value !== undefined) {\n this._changes = (this._changes as SerializedChangeSet).value;\n return;\n }\n\n Utils.traverseChangeSetRecursively(this._changes, {\n preCallback: callback,\n });\n };\n\n /**\n * Helper function to extract the first level paths from a given change set\n * @param in_changeSet The ChangeSet to extract paths from\n * @param isPrimitiveCollection Is this a primitive type collection?\n *\n * @returns List of paths found at the first level of the change set\n */\n private _extractFirstLevelPaths(in_changeSet: SerializedChangeSet, isPrimitiveCollection: boolean): string[] {\n let paths;\n if (isPrimitiveCollection) {\n paths = Object.keys(in_changeSet);\n } else {\n paths = [];\n each(in_changeSet, function(nestedChangeSet) {\n each(nestedChangeSet, function(nestedChangeSet2, path) {\n paths.push(path);\n });\n });\n }\n\n return paths;\n };\n\n /**\n * recursive helper function for ChangeSet.prototype._toInverseChangeSet\n * @param in_context the traversal context\n */\n private _recursivelyInvertReversibleChangeset(in_context: Utils.TraversalContext) {\n in_context.setUserData(in_context.getUserData() || {});\n\n // Figure out if we have already visited this path by verifying that the full path\n // is contained within the list of processed deleted or inserted paths\n const isWithinInsertOrDelete = in_context.getUserData()[in_context.getFullPath()];\n\n if (isWithinInsertOrDelete && in_context.getOperationType() !== \"modify\") {\n // We are within an insert or remove sub tree. Skip this iteration.\n in_context._traversalStopped = true;\n return;\n }\n\n if (in_context.getOperationType() === \"remove\" ||\n in_context.getOperationType() === \"modify\") {\n const type = in_context.getTypeid();\n const splitType = in_context.getSplitTypeID();\n\n if (!splitType) {\n ConsoleUtils.assert(false,\n `${MSG.ASSERTION_FAILED}Missing \"splitType\" in \"in_context\":${JSON.stringify(in_context)}`);\n }\n\n const nestedChangeset = in_context.getNestedChangeSet();\n\n if ((isPrimitiveType(type) && type !== \"String\") ||\n (type === \"String\" && isString(nestedChangeset.oldValue))) {\n // check if we were called with an irreversible changeset\n if (in_context.getOperationType() === \"modify\" &&\n (!isObject(nestedChangeset) || typeof (nestedChangeset as SerializedChangeSet).oldValue === \"undefined\")) {\n throw new Error(MSG.OLD_VALUE_NOT_FOUND);\n }\n\n // switch oldValue and value\n let tmp = nestedChangeset.oldValue;\n nestedChangeset.oldValue = nestedChangeset.value;\n nestedChangeset.value = tmp;\n } else if ((type === \"String\" && !isString(nestedChangeset.oldValue)) || splitType.context === \"array\") {\n // String and Arrays need special treatment:\n const arrayIterator = new ArrayChangeSetIterator(nestedChangeset);\n const resultChangeset: SerializedChangeSet = {};\n if (nestedChangeset.modify) {\n resultChangeset.modify = [];\n }\n if (nestedChangeset.insert) {\n resultChangeset.remove = [];\n }\n if (nestedChangeset.remove) {\n resultChangeset.insert = [];\n }\n // Successively invert the changes from the changeSet\n while (!arrayIterator.atEnd()) {\n switch (arrayIterator.opDescription.type) {\n case ArrayIteratorOperationTypes.INSERT:\n // Handle inserts\n resultChangeset.remove.push([\n arrayIterator.opDescription.operation[0] + arrayIterator.opDescription.offset,\n arrayIterator.opDescription.operation[1],\n ]);\n break;\n case ArrayIteratorOperationTypes.REMOVE:\n // Handle removes\n resultChangeset.insert.push([\n arrayIterator.opDescription.operation[0] + arrayIterator.opDescription.offset,\n arrayIterator.opDescription.operation[1],\n ]);\n break;\n case ArrayIteratorOperationTypes.MODIFY:\n // Handle modifies\n if (isPrimitiveType(splitType.typeid)) {\n resultChangeset.modify.push([\n arrayIterator.opDescription.operation[0] + arrayIterator.opDescription.offset,\n arrayIterator.opDescription.operation[2],\n arrayIterator.opDescription.operation[1],\n ]);\n } else {\n resultChangeset.modify.push([\n arrayIterator.opDescription.operation[0] + arrayIterator.opDescription.offset,\n arrayIterator.opDescription.operation[1],\n ]);\n }\n break;\n default:\n console.error(`applyChangeset: ${MSG.UNKNOWN_OPERATION}${arrayIterator.opDescription.type}`);\n }\n arrayIterator.next();\n }\n in_context.replaceNestedChangeSet(resultChangeset);\n } else {\n // Covers NodeProperty, Map and Set\n if (nestedChangeset.modify) {\n if (isPrimitiveType(splitType.typeid) && splitType.context === \"map\") {\n const modifiedKeys = Object.keys(nestedChangeset.modify);\n for (let i = 0; i < modifiedKeys.length; i++) {\n const entry = nestedChangeset.modify[modifiedKeys[i]];\n let tmp = entry.value;\n entry.value = entry.oldValue;\n entry.oldValue = tmp;\n }\n }\n }\n const oldInsert = nestedChangeset.insert;\n let replacedInsert = false;\n if (nestedChangeset.remove) {\n nestedChangeset.insert = nestedChangeset.remove;\n replacedInsert = true;\n nestedChangeset.remove = undefined;\n delete nestedChangeset.remove;\n const isPrimitiveTypeid = isPrimitiveType(in_context.getSplitTypeID().typeid);\n each(this._extractFirstLevelPaths(nestedChangeset.insert, isPrimitiveTypeid), function(path) {\n const fullPath = joinPaths(in_context.getFullPath(), path, PROPERTY_PATH_DELIMITER);\n in_context.getUserData()[fullPath] = true;\n });\n }\n if (oldInsert) {\n if (replacedInsert) {\n nestedChangeset.remove = cloneDeep(oldInsert);\n } else {\n nestedChangeset.remove = oldInsert;\n nestedChangeset.insert = undefined;\n delete nestedChangeset.insert;\n }\n const isPrimitiveTypeid = isPrimitiveType(in_context.getSplitTypeID().typeid);\n each(this._extractFirstLevelPaths(nestedChangeset.remove, isPrimitiveTypeid), function(path) {\n const fullPath = joinPaths(in_context.getFullPath(), path, PROPERTY_PATH_DELIMITER);\n in_context.getUserData()[fullPath] = true;\n });\n }\n }\n }\n };\n\n /**\n * Inverts a reversible ChangeSets\n * WARNING: This function is still experimental and needs more testing\n * and it's set to private for now. It will be converted to a public API function\n * in a later release\n */\n public toInverseChangeSet() {\n if (this._changes.value !== undefined &&\n this._changes.oldValue !== undefined) {\n const tmp = this._changes.value;\n this._changes.value = this._changes.oldValue;\n this._changes.oldValue = tmp;\n } else {\n Utils.traverseChangeSetRecursively(this._changes, {\n preCallback: this._recursivelyInvertReversibleChangeset.bind(this),\n });\n }\n }\n}\n\n\nChangeSet.prototype._performApplyAfterOnPropertyArray = ChangeSetArrayFunctions._performApplyAfterOnPropertyArray;\nChangeSet.prototype._rebaseArrayChangeSetForProperty = ChangeSetArrayFunctions._rebaseArrayChangeSetForProperty;\nChangeSet.prototype._rebaseChangeSetForString = ChangeSetArrayFunctions._rebaseChangeSetForString;\n\n// Add the indexed collection functions into the prototype of the ChangeSet\nChangeSet.prototype._performApplyAfterOnPropertyIndexedCollection =\n ChangeSetIndexedCollectionFunctions._performApplyAfterOnPropertyIndexedCollection;\nChangeSet.prototype._cleanIndexedCollectionChangeSet =\n ChangeSetIndexedCollectionFunctions._cleanIndexedCollectionChangeSet;\nChangeSet.prototype._rebaseIndexedCollectionChangeSetForProperty =\n ChangeSetIndexedCollectionFunctions._rebaseIndexedCollectionChangeSetForProperty;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"indexedCollection.d.ts","sourceRoot":"","sources":["../../src/changeset_operations/indexedCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AAWH,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAoCxF,yBAAiB,mCAAmC,CAAC;IACjD;;;;;;;;;;;;;;OAcG;IACI,MAAM,6CAA6C,2BAC9B,mBAAmB,6BAChB,mBAAmB,aACnC,MAAM,cACL,qBAAqB,SAgUpC,CAAA;IAED;;;;;;;;;;;;;;;;OAgBG;IACI,MAAM,4CAA4C,4BAC5B,mBAAmB,8BAChB,mBAAmB,eAClC,MAAM,aACR,MAAM,8BACW,OAAO,iBACpB,YAAY,EAAE,cACjB,qBAAqB,SA+UpC,CAAA;IAED;;;;;;OAMG;IACI,MAAM,gCAAgC,uBAAgC,mBAAmB,sBAAsB,OAAO,SAwD5H,CAAA;CACJ"}
1
+ {"version":3,"file":"indexedCollection.d.ts","sourceRoot":"","sources":["../../src/changeset_operations/indexedCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AAWH,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAqCxF,yBAAiB,mCAAmC,CAAC;IACjD;;;;;;;;;;;;;;OAcG;IACI,MAAM,6CAA6C,2BAC9B,mBAAmB,6BAChB,mBAAmB,aACnC,MAAM,cACL,qBAAqB,SAgUpC,CAAA;IAED;;;;;;;;;;;;;;;;OAgBG;IACI,MAAM,4CAA4C,4BAC5B,mBAAmB,8BAChB,mBAAmB,eAClC,MAAM,aACR,MAAM,8BACW,OAAO,iBACpB,YAAY,EAAE,cACjB,qBAAqB,SA+UpC,CAAA;IAED;;;;;;OAMG;IACI,MAAM,gCAAgC,uBAAgC,mBAAmB,sBAAsB,OAAO,SAwD5H,CAAA;CACJ"}
@@ -43,7 +43,8 @@ const _fastIsEmptyObject = function (in_object) {
43
43
  if (!in_object || Array.isArray(in_object) || !isObject_1.default(in_object)) {
44
44
  return isEmpty_1.default(in_object);
45
45
  }
46
- for (const _entry in in_object) { // eslint-disable-line
46
+ // eslint-disable-next-line guard-for-in
47
+ for (const _entry in in_object) {
47
48
  return false;
48
49
  }
49
50
  return true;