@fluidframework/merge-tree 2.3.0 → 2.4.0-294316
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-report/merge-tree.legacy.alpha.api.md +0 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +0 -1
- package/dist/client.js.map +1 -1
- package/dist/mergeTree.d.ts +1 -2
- package/dist/mergeTree.d.ts.map +1 -1
- package/dist/mergeTree.js +10 -36
- package/dist/mergeTree.js.map +1 -1
- package/dist/mergeTreeNodes.d.ts +0 -9
- package/dist/mergeTreeNodes.d.ts.map +1 -1
- package/dist/mergeTreeNodes.js.map +1 -1
- package/dist/test/obliterate.partialLength.spec.js +8 -4
- package/dist/test/obliterate.partialLength.spec.js.map +1 -1
- package/dist/test/obliterate.spec.js +12 -6
- package/dist/test/obliterate.spec.js.map +1 -1
- package/dist/test/testClient.d.ts +1 -11
- package/dist/test/testClient.d.ts.map +1 -1
- package/dist/test/testClient.js +0 -3
- package/dist/test/testClient.js.map +1 -1
- package/dist/test/testUtils.d.ts +10 -0
- package/dist/test/testUtils.d.ts.map +1 -1
- package/dist/test/testUtils.js +5 -1
- package/dist/test/testUtils.js.map +1 -1
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +0 -1
- package/lib/client.js.map +1 -1
- package/lib/mergeTree.d.ts +1 -2
- package/lib/mergeTree.d.ts.map +1 -1
- package/lib/mergeTree.js +10 -36
- package/lib/mergeTree.js.map +1 -1
- package/lib/mergeTreeNodes.d.ts +0 -9
- package/lib/mergeTreeNodes.d.ts.map +1 -1
- package/lib/mergeTreeNodes.js.map +1 -1
- package/lib/test/obliterate.partialLength.spec.js +9 -5
- package/lib/test/obliterate.partialLength.spec.js.map +1 -1
- package/lib/test/obliterate.spec.js +13 -7
- package/lib/test/obliterate.spec.js.map +1 -1
- package/lib/test/testClient.d.ts +1 -11
- package/lib/test/testClient.d.ts.map +1 -1
- package/lib/test/testClient.js +0 -3
- package/lib/test/testClient.js.map +1 -1
- package/lib/test/testUtils.d.ts +10 -0
- package/lib/test/testUtils.d.ts.map +1 -1
- package/lib/test/testUtils.js +3 -0
- package/lib/test/testUtils.js.map +1 -1
- package/package.json +16 -16
- package/src/client.ts +5 -2
- package/src/mergeTree.ts +16 -63
- package/src/mergeTreeNodes.ts +0 -9
package/dist/mergeTreeNodes.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ import { PropertySet, type MapLike } from "./properties.js";
|
|
|
13
13
|
import { ReferencePosition } from "./referencePositions.js";
|
|
14
14
|
import { SegmentGroupCollection } from "./segmentGroupCollection.js";
|
|
15
15
|
import { PropertiesManager, PropertiesRollback } from "./segmentPropertiesManager.js";
|
|
16
|
-
import { Side } from "./sequencePlace.js";
|
|
17
16
|
/**
|
|
18
17
|
* Common properties for a node in a merge tree.
|
|
19
18
|
* @legacy
|
|
@@ -212,14 +211,6 @@ export interface ISegment extends IMergeNodeCommon, Partial<IRemovalInfo>, Parti
|
|
|
212
211
|
* Properties that have been added to this segment via annotation.
|
|
213
212
|
*/
|
|
214
213
|
properties?: PropertySet;
|
|
215
|
-
/**
|
|
216
|
-
* Stores side information passed to obliterate for the start of a range.
|
|
217
|
-
*/
|
|
218
|
-
startSide?: Side.Before | Side.After;
|
|
219
|
-
/**
|
|
220
|
-
* Stores side information passed to obliterate for the end of a range.
|
|
221
|
-
*/
|
|
222
|
-
endSide?: Side.Before | Side.After;
|
|
223
214
|
/**
|
|
224
215
|
* Add properties to this segment via annotation.
|
|
225
216
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeTreeNodes.d.ts","sourceRoot":"","sources":["../src/mergeTreeNodes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAE9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAMpE,OAAO,EAAE,wBAAwB,EAAE,KAAK,sBAAsB,EAAE,MAAM,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E,CAAC;gBACX,IAAI,IAAI,IAAI,CAAC;YACd,CAAC;YACD,IAAI,IAAI,SAAS,CAAC;QACnB,CAAC;IACF,CAAC;IAED,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACvB,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YACxD,wEAAwE;YACxE,uCAAuC;YACvC,+GAA+G;YAC/G,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,YAAY,CAAC;YAE7C,2GAA2G;YAC3G,OAAO,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,CAAC,YAAY,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;QAC/E,CAAC,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,IAAI,KAAK,IAAI,IAAI,IAAI,EAAE,CAAC;AACrC,CAAC;AAnCD,kDAmCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { AttributionKey } from \"@fluidframework/runtime-definitions/internal\";\n\nimport { IAttributionCollection } from \"./attributionCollection.js\";\nimport {\n\tLocalClientId,\n\tUnassignedSequenceNumber,\n\tUniversalSequenceNumber,\n} from \"./constants.js\";\nimport { LocalReferenceCollection, type LocalReferencePosition } from \"./localReference.js\";\nimport { IMergeTreeDeltaOpArgs } from \"./mergeTreeDeltaCallback.js\";\nimport { TrackingGroupCollection } from \"./mergeTreeTracking.js\";\nimport { IJSONSegment, IMarkerDef, MergeTreeDeltaType, ReferenceType } from \"./ops.js\";\nimport { computeHierarchicalOrdinal } from \"./ordinal.js\";\nimport type { PartialSequenceLengths } from \"./partialLengths.js\";\nimport { PropertySet, clone, createMap, type MapLike } from \"./properties.js\";\nimport {\n\tReferencePosition,\n\trefGetTileLabels,\n\trefTypeIncludesFlag,\n} from \"./referencePositions.js\";\n// eslint-disable-next-line import/no-deprecated\nimport { SegmentGroupCollection } from \"./segmentGroupCollection.js\";\n// eslint-disable-next-line import/no-deprecated\nimport { PropertiesManager, PropertiesRollback } from \"./segmentPropertiesManager.js\";\nimport { Side } from \"./sequencePlace.js\";\n\n/**\n * Common properties for a node in a merge tree.\n * @legacy\n * @alpha\n */\nexport interface IMergeNodeCommon {\n\t/**\n\t * The index of this node in its parent's list of children.\n\t */\n\tindex: number;\n\t/**\n\t * A string that can be used for comparing the location of this node to other `MergeNode`s in the same tree.\n\t * `a.ordinal < b.ordinal` if and only if `a` comes before `b` in a pre-order traversal of the tree.\n\t */\n\tordinal: string;\n\tisLeaf(): this is ISegment;\n}\n/**\n * someday we may split tree leaves from segments, but for now they are the same\n * this is just a convenience type that makes it clear that we need something that is both a segment and a leaf node\n */\nexport type ISegmentLeaf = ISegment & { parent?: MergeBlock };\nexport type IMergeNode = MergeBlock | ISegmentLeaf;\n\n/**\n * Contains removal information associated to an {@link ISegment}.\n * @legacy\n * @alpha\n */\nexport interface IRemovalInfo {\n\t/**\n\t * Local seq at which this segment was removed, if the removal is yet-to-be acked.\n\t */\n\tlocalRemovedSeq?: number;\n\t/**\n\t * Seq at which this segment was removed.\n\t */\n\tremovedSeq: number;\n\t/**\n\t * List of client IDs that have removed this segment.\n\t * The client that actually removed the segment (i.e. whose removal op was sequenced first) is stored as the first\n\t * client in this list. Other clients in the list have all issued concurrent ops to remove the segment.\n\t * @remarks When this list has length \\> 1, this is referred to as the \"overlapping remove\" case.\n\t */\n\tremovedClientIds: number[];\n}\n\n/**\n * Returns the removal information for a segment.\n *\n * @internal\n */\nexport function toRemovalInfo(\n\tmaybe: Partial<IRemovalInfo> | undefined,\n): IRemovalInfo | undefined {\n\tif (maybe?.removedClientIds !== undefined && maybe?.removedSeq !== undefined) {\n\t\treturn maybe as IRemovalInfo;\n\t}\n\tassert(\n\t\tmaybe?.removedClientIds === undefined && maybe?.removedSeq === undefined,\n\t\t0x2bf /* \"both removedClientIds and removedSeq should be set or not set\" */,\n\t);\n}\n\n/**\n * Tracks information about when and where this segment was moved to.\n *\n * Note that merge-tree does not currently support moving and only supports\n * obliterate. The fields below include \"move\" in their names to avoid renaming\n * in the future, when moves _are_ supported.\n * @legacy\n * @alpha\n */\nexport interface IMoveInfo {\n\t/**\n\t * Local seq at which this segment was moved if the move is yet-to-be\n\t * acked.\n\t */\n\tlocalMovedSeq?: number;\n\n\t/**\n\t * The first seq at which this segment was moved.\n\t */\n\tmovedSeq: number;\n\n\t/**\n\t * All seqs at which this segment was moved. In the case of overlapping,\n\t * concurrent moves this array will contain multiple seqs.\n\t *\n\t * The seq at `movedSeqs[i]` corresponds to the client id at `movedClientIds[i]`.\n\t *\n\t * The first element corresponds to the seq of the first move\n\t */\n\tmovedSeqs: number[];\n\n\t/**\n\t * A reference to the inserted destination segment corresponding to this\n\t * segment's move.\n\t *\n\t * If undefined, the move was an obliterate.\n\t *\n\t * Currently this field is unused, as we only support obliterate operations\n\t */\n\tmoveDst?: ReferencePosition;\n\n\t/**\n\t * List of client IDs that have moved this segment.\n\t *\n\t * The client that actually moved the segment (i.e. whose move op was sequenced\n\t * first) is stored as the first client in this list. Other clients in the\n\t * list have all issued concurrent ops to move the segment.\n\t */\n\tmovedClientIds: number[];\n\n\t/**\n\t * If this segment was inserted into a concurrently moved range and\n\t * the move op was sequenced before the insertion op. In this case,\n\t * the segment is visible only to the inserting client\n\t *\n\t * `wasMovedOnInsert` only applies for acked obliterates. That is, if\n\t * a segment inserted by a remote client is moved on insertion by a local\n\t * and unacked obliterate, we do not consider it as having been moved\n\t * on insert\n\t *\n\t * If a segment is moved on insertion, its length is only ever visible to\n\t * the client that inserted the segment. This is relevant in partial length\n\t * calculations\n\t */\n\twasMovedOnInsert: boolean;\n}\n\nexport function toMoveInfo(maybe: Partial<IMoveInfo> | undefined): IMoveInfo | undefined {\n\tif (maybe?.movedClientIds !== undefined && maybe?.movedSeq !== undefined) {\n\t\treturn maybe as IMoveInfo;\n\t}\n\tassert(\n\t\tmaybe?.movedClientIds === undefined &&\n\t\t\tmaybe?.movedSeq === undefined &&\n\t\t\tmaybe?.movedSeqs === undefined &&\n\t\t\tmaybe?.wasMovedOnInsert === undefined,\n\t\t0x86d /* movedClientIds, movedSeq, wasMovedOnInsert, and movedSeqs should all be either set or not set */,\n\t);\n}\n\n/**\n * A segment representing a portion of the merge tree.\n * Segments are leaf nodes of the merge tree and contain data.\n * @legacy\n * @alpha\n */\nexport interface ISegment extends IMergeNodeCommon, Partial<IRemovalInfo>, Partial<IMoveInfo> {\n\treadonly type: string;\n\t/**\n\t * @deprecated - This property should not be used externally and will be removed in a subsequent release.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\treadonly segmentGroups: SegmentGroupCollection;\n\treadonly trackingCollection: TrackingGroupCollection;\n\t/**\n\t * Whether or not this segment is a special segment denoting the start or\n\t * end of the tree\n\t *\n\t * Endpoint segments are imaginary segments positioned immediately before or\n\t * after the tree. These segments cannot be referenced by regular operations\n\t * and exist primarily as a bucket for local references to slide onto during\n\t * deletion of regular segments.\n\t */\n\treadonly endpointType?: \"start\" | \"end\";\n\n\t/**\n\t * The length of the contents of the node.\n\t */\n\tcachedLength: number;\n\t/**\n\t * Stores attribution keys associated with offsets of this segment.\n\t * This data is only persisted if MergeTree's `attributions.track` flag is set to true.\n\t * Pending segments (i.e. ones that only exist locally and haven't been acked by the server) also have\n\t * `attribution === undefined` until ack.\n\t *\n\t * Keys can be used opaquely with an IAttributor or a container runtime that provides attribution.\n\t * @remarks There are plans to make the shape of the data stored extensible in a couple ways:\n\t *\n\t * 1. Injection of custom attribution information associated with the segment (ex: copy-paste of\n\t * content but keeping the old attribution information).\n\t *\n\t * 2. Storage of multiple \"channels\" of information (ex: track property changes separately from insertion,\n\t * or only attribute certain property modifications, etc.)\n\t */\n\tattribution?: IAttributionCollection<AttributionKey>;\n\n\t/**\n\t * Manages pending local state for properties on this segment.\n\t *\n\t * @deprecated - This property should not be used externally and will be removed in a subsequent release.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tpropertyManager?: PropertiesManager;\n\t/**\n\t * Local seq at which this segment was inserted.\n\t * This is defined if and only if the insertion of the segment is pending ack, i.e. `seq` is UnassignedSequenceNumber.\n\t * Once the segment is acked, this field is cleared.\n\t *\n\t * See {@link CollaborationWindow.localSeq} for more information on the semantics of localSeq.\n\t */\n\tlocalSeq?: number;\n\t/**\n\t * Local seq at which this segment was removed. If this is defined, `removedSeq` will initially be set to\n\t * UnassignedSequenceNumber. However, if another client concurrently removes the same segment, `removedSeq`\n\t * will be updated to the seq at which that client removed this segment.\n\t *\n\t * Like {@link ISegment.localSeq}, this field is cleared once the local removal of the segment is acked.\n\t * See {@link CollaborationWindow.localSeq} for more information on the semantics of localSeq.\n\t */\n\tlocalRemovedSeq?: number;\n\t/**\n\t * Seq at which this segment was inserted.\n\t * If undefined, it is assumed the segment was inserted prior to the collab window's minimum sequence number.\n\t */\n\tseq?: number;\n\t/**\n\t * Short clientId for the client that inserted this segment.\n\t */\n\tclientId: number;\n\t/**\n\t * Local references added to this segment.\n\t */\n\tlocalRefs?: LocalReferenceCollection;\n\t/**\n\t * Properties that have been added to this segment via annotation.\n\t */\n\tproperties?: PropertySet;\n\t/**\n\t * Stores side information passed to obliterate for the start of a range.\n\t */\n\tstartSide?: Side.Before | Side.After;\n\t/**\n\t * Stores side information passed to obliterate for the end of a range.\n\t */\n\tendSide?: Side.Before | Side.After;\n\n\t/**\n\t * Add properties to this segment via annotation.\n\t *\n\t * @deprecated - This function should not be used externally and will be removed in a subsequent release.\n\t *\n\t * @remarks This function should not be called directly. Properties should\n\t * be added through the `annotateRange` functions.\n\t */\n\taddProperties(\n\t\tnewProps: PropertySet,\n\t\tseq?: number,\n\t\tcollaborating?: boolean,\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\trollback?: PropertiesRollback,\n\t): PropertySet;\n\tclone(): ISegment;\n\tcanAppend(segment: ISegment): boolean;\n\tappend(segment: ISegment): void;\n\tsplitAt(pos: number): ISegment | undefined;\n\t// Changing this to something other than any would break consumers.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\ttoJSONObject(): any;\n\t/**\n\t * @deprecated - This function should not be used externally and will be removed in a subsequent release.\n\t * Acks the current segment against the segment group, op, and merge tree.\n\t *\n\t * @param segmentGroup - Pending segment group associated with this op.\n\t * @param opArgs - Information about the op that was acked\n\t * @returns `true` if the op modifies the segment, otherwise `false`.\n\t * The only current false case is overlapping remove, where a segment is removed\n\t * by a previously sequenced operation before the current operation is acked.\n\t * @throws - error if the segment state doesn't match segment group or op.\n\t * E.g. if the segment group is not first in the pending queue, or\n\t * an inserted segment does not have unassigned sequence number.\n\t */\n\tack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean;\n}\n\n/**\n * @internal\n */\nexport interface IMarkerModifiedAction {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(marker: Marker): void;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISegmentAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tsegment: ISegment,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number,\n\t\tend: number,\n\t\taccum: TClientData,\n\t): boolean;\n}\n/**\n * @internal\n */\nexport interface ISegmentChanges {\n\tnext?: ISegment;\n\treplaceCurrent?: ISegment;\n}\n/**\n * @internal\n */\nexport interface BlockAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tblock: MergeBlock,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\taccum: TClientData,\n\t): boolean;\n}\n\n/**\n * @internal\n */\nexport interface NodeAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tnode: MergeNode,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\tclientData: TClientData,\n\t): boolean;\n}\n\n/**\n * @internal\n */\nexport interface InsertContext {\n\tcandidateSegment?: ISegment;\n\tleaf: (segment: ISegment | undefined, pos: number, ic: InsertContext) => ISegmentChanges;\n\tcontinuePredicate?: (continueFromBlock: MergeBlock) => boolean;\n}\n\n/**\n * @internal\n */\nexport interface SegmentActions<TClientData> {\n\tleaf?: ISegmentAction<TClientData>;\n\tshift?: NodeAction<TClientData>;\n\tcontains?: NodeAction<TClientData>;\n\tpre?: BlockAction<TClientData>;\n\tpost?: BlockAction<TClientData>;\n}\n\n/**\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n * @legacy\n * @alpha\n */\nexport interface ObliterateInfo {\n\tstart: LocalReferencePosition;\n\tend: LocalReferencePosition;\n\trefSeq: number;\n\tclientId: number;\n\tseq: number;\n\tlocalSeq: number | undefined;\n\tsegmentGroup: SegmentGroup | undefined;\n}\n\n/**\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n * @legacy\n * @alpha\n */\nexport interface SegmentGroup {\n\tsegments: ISegment[];\n\tpreviousProps?: PropertySet[];\n\tlocalSeq?: number;\n\trefSeq: number;\n\tobliterateInfo?: ObliterateInfo;\n}\n\n/**\n * @legacy\n * @alpha\n * @deprecated - unused and will be removed\n */\nexport class MergeNode implements IMergeNodeCommon {\n\tindex: number = 0;\n\tordinal: string = \"\";\n\tcachedLength: number = 0;\n\n\tisLeaf(): this is ISegment {\n\t\treturn false;\n\t}\n}\n\n/**\n * Note that the actual branching factor of the MergeTree is `MaxNodesInBlock - 1`. This is because\n * the MergeTree always inserts first, then checks for overflow and splits if the child count equals\n * `MaxNodesInBlock`. (i.e., `MaxNodesInBlock` contains 1 extra slot for temporary storage to\n * facilitate splits.)\n * @internal\n */\nexport const MaxNodesInBlock = 8;\n/**\n * @internal\n */\nexport class MergeBlock implements IMergeNodeCommon {\n\tpublic children: IMergeNode[];\n\tpublic needsScour?: boolean;\n\tpublic parent?: MergeBlock;\n\tpublic index: number = 0;\n\tpublic ordinal: string = \"\";\n\tpublic cachedLength: number | undefined = 0;\n\n\t/**\n\t * Maps each tile label in this block to the rightmost (i.e. furthest) marker associated with that tile label.\n\t * When combined with the tree structure of MergeBlocks, this allows accelerated queries for nearest tile\n\t * with a certain label before a given position\n\t */\n\tpublic rightmostTiles: Readonly<MapLike<Marker>>;\n\t/**\n\t * Maps each tile label in this block to the leftmost (i.e. nearest) marker associated with that tile label.\n\t * When combined with the tree structure of MergeBlocks, this allows accelerated queries for nearest tile\n\t * with a certain label before a given position\n\t */\n\tpublic leftmostTiles: Readonly<MapLike<Marker>>;\n\n\tisLeaf(): this is ISegment {\n\t\treturn false;\n\t}\n\n\t/**\n\t * Supports querying the total length of all descendants of this IMergeBlock from the perspective of any\n\t * (clientId, seq) within the collab window.\n\t *\n\t * @remarks This is only optional for implementation reasons (internal nodes can be created/moved without\n\t * immediately initializing the partial lengths). Aside from mid-update on tree operations, these lengths\n\t * objects are always defined.\n\t */\n\tpartialLengths?: PartialSequenceLengths;\n\n\tpublic constructor(public childCount: number) {\n\t\t// Suppression needed due to the way the merge tree children are initalized - we\n\t\t// allocate 8 children blocks, but any unused blocks are not counted in the childCount.\n\t\t// Using Array.from leads to unused children being undefined, which are counted in childCount.\n\t\t// eslint-disable-next-line unicorn/no-new-array\n\t\tthis.children = new Array<IMergeNode>(MaxNodesInBlock);\n\t\tthis.rightmostTiles = createMap<Marker>();\n\t\tthis.leftmostTiles = createMap<Marker>();\n\t}\n\n\tpublic setOrdinal(child: IMergeNode, index: number): void {\n\t\tconst childCount = this.childCount;\n\t\tassert(\n\t\t\tchildCount >= 1 && childCount <= MaxNodesInBlock,\n\t\t\t0x040 /* \"Child count is not within [1,8] range!\" */,\n\t\t);\n\t\tchild.ordinal = computeHierarchicalOrdinal(\n\t\t\tMaxNodesInBlock,\n\t\t\tchildCount,\n\t\t\tthis.ordinal,\n\t\t\tindex === 0 ? undefined : this.children[index - 1]?.ordinal,\n\t\t);\n\t}\n\n\tpublic assignChild(child: IMergeNode, index: number, updateOrdinal = true): void {\n\t\tchild.parent = this;\n\t\tchild.index = index;\n\t\tif (updateOrdinal) {\n\t\t\tthis.setOrdinal(child, index);\n\t\t}\n\t\tthis.children[index] = child;\n\t}\n}\n\nexport function seqLTE(seq: number, minOrRefSeq: number): boolean {\n\treturn seq !== UnassignedSequenceNumber && seq <= minOrRefSeq;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport abstract class BaseSegment implements ISegment {\n\tpublic clientId: number = LocalClientId;\n\tpublic seq: number = UniversalSequenceNumber;\n\tpublic removedSeq?: number;\n\tpublic removedClientIds?: number[];\n\tpublic movedSeq?: number;\n\tpublic movedSeqs?: number[];\n\tpublic movedClientIds?: number[];\n\tpublic wasMovedOnInsert?: boolean | undefined;\n\tpublic index: number = 0;\n\tpublic ordinal: string = \"\";\n\tpublic cachedLength: number = 0;\n\n\t/**\n\t * {@inheritdoc ISegment.segmentGroups}\n\t * @deprecated - This property should not be used externally and will be removed in a subsequent release.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic readonly segmentGroups: SegmentGroupCollection = new SegmentGroupCollection(this);\n\tpublic readonly trackingCollection: TrackingGroupCollection = new TrackingGroupCollection(\n\t\tthis,\n\t);\n\t/***/\n\tpublic attribution?: IAttributionCollection<AttributionKey>;\n\t/**\n\t * {@inheritdoc ISegment.propertyManager}\n\t * @deprecated - This property should not be used externally and will be removed in a subsequent release.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic propertyManager?: PropertiesManager;\n\tpublic properties?: PropertySet;\n\tpublic localRefs?: LocalReferenceCollection;\n\tpublic abstract readonly type: string;\n\tpublic localSeq?: number;\n\tpublic localRemovedSeq?: number;\n\tpublic localMovedSeq?: number;\n\n\tpublic constructor(properties?: PropertySet) {\n\t\tif (properties !== undefined) {\n\t\t\tthis.properties = clone(properties);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritdoc ISegment.addProperties}\n\t * @deprecated - This function should not be used externally and will be removed in a subsequent release.\n\t */\n\tpublic addProperties(\n\t\tnewProps: PropertySet,\n\t\tseq?: number,\n\t\tcollaborating?: boolean,\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\trollback: PropertiesRollback = PropertiesRollback.None,\n\t): PropertySet {\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tthis.propertyManager ??= new PropertiesManager();\n\t\t// A property set must be able to hold properties of any type, so the any is needed.\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tthis.properties ??= createMap<any>();\n\t\treturn this.propertyManager.addProperties(\n\t\t\tthis.properties,\n\t\t\tnewProps,\n\t\t\tseq,\n\t\t\tcollaborating,\n\t\t\trollback,\n\t\t);\n\t}\n\n\tpublic hasProperty(key: string): boolean {\n\t\treturn !!this.properties && this.properties[key] !== undefined;\n\t}\n\n\tpublic isLeaf(): this is ISegment {\n\t\treturn true;\n\t}\n\n\tprotected cloneInto(b: ISegment): void {\n\t\tb.clientId = this.clientId;\n\t\t// TODO: deep clone properties\n\t\tb.properties = clone(this.properties);\n\t\tb.removedClientIds = this.removedClientIds?.slice();\n\t\t// TODO: copy removed client overlap and branch removal info\n\t\tb.removedSeq = this.removedSeq;\n\t\tb.movedClientIds = this.movedClientIds?.slice();\n\t\tb.movedSeq = this.movedSeq;\n\t\tb.movedSeqs = this.movedSeqs;\n\t\tb.wasMovedOnInsert = this.wasMovedOnInsert;\n\t\tb.seq = this.seq;\n\t\tb.attribution = this.attribution?.clone();\n\t}\n\n\tpublic canAppend(segment: ISegment): boolean {\n\t\treturn false;\n\t}\n\n\tprotected addSerializedProps(jseg: IJSONSegment): void {\n\t\tif (this.properties) {\n\t\t\tjseg.props = { ...this.properties };\n\t\t}\n\t}\n\t// This has to return any type because the return type is different for different segment types.\n\t// TODO: If possible, change the return type to match what should be returned for each segment type.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic abstract toJSONObject(): any;\n\n\t/**\n\t * {@inheritdoc ISegment.ack}\n\t * @deprecated - This function should not be used externally and will be removed in a subsequent release.\n\t */\n\tpublic ack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean {\n\t\tconst currentSegmentGroup = this.segmentGroups.dequeue();\n\t\tassert(\n\t\t\tcurrentSegmentGroup === segmentGroup,\n\t\t\t0x043 /* \"On ack, unexpected segmentGroup!\" */,\n\t\t);\n\t\tswitch (opArgs.op.type) {\n\t\t\tcase MergeTreeDeltaType.ANNOTATE: {\n\t\t\t\tassert(\n\t\t\t\t\t!!this.propertyManager,\n\t\t\t\t\t0x044 /* \"On annotate ack, missing segment property manager!\" */,\n\t\t\t\t);\n\t\t\t\tthis.propertyManager.ackPendingProperties(opArgs.op);\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tcase MergeTreeDeltaType.INSERT: {\n\t\t\t\tassert(\n\t\t\t\t\tthis.seq === UnassignedSequenceNumber,\n\t\t\t\t\t0x045 /* \"On insert, seq number already assigned!\" */,\n\t\t\t\t);\n\t\t\t\tthis.seq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\tthis.localSeq = undefined;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tcase MergeTreeDeltaType.REMOVE: {\n\t\t\t\tconst removalInfo: IRemovalInfo | undefined = toRemovalInfo(this);\n\t\t\t\tassert(removalInfo !== undefined, 0x046 /* \"On remove ack, missing removal info!\" */);\n\t\t\t\tthis.localRemovedSeq = undefined;\n\t\t\t\tif (removalInfo.removedSeq === UnassignedSequenceNumber) {\n\t\t\t\t\tremovalInfo.removedSeq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tcase MergeTreeDeltaType.OBLITERATE: {\n\t\t\t\tconst moveInfo: IMoveInfo | undefined = toMoveInfo(this);\n\t\t\t\tassert(moveInfo !== undefined, 0x86e /* On obliterate ack, missing move info! */);\n\t\t\t\tconst obliterateInfo = segmentGroup.obliterateInfo;\n\t\t\t\tassert(obliterateInfo !== undefined, 0xa40 /* must have obliterate info */);\n\t\t\t\tthis.localMovedSeq = obliterateInfo.localSeq = undefined;\n\t\t\t\tconst seqIdx = moveInfo.movedSeqs.indexOf(UnassignedSequenceNumber);\n\t\t\t\tassert(seqIdx !== -1, 0x86f /* expected movedSeqs to contain unacked seq */);\n\t\t\t\tmoveInfo.movedSeqs[seqIdx] = obliterateInfo.seq =\n\t\t\t\t\topArgs.sequencedMessage!.sequenceNumber;\n\n\t\t\t\tif (moveInfo.movedSeq === UnassignedSequenceNumber) {\n\t\t\t\t\tmoveInfo.movedSeq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(`${opArgs.op.type} is in unrecognized operation type`);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic splitAt(pos: number): ISegment | undefined {\n\t\tif (pos <= 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst leafSegment: ISegmentLeaf | undefined = this.createSplitSegmentAt(pos);\n\n\t\tif (!leafSegment) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tthis.copyPropertiesTo(leafSegment);\n\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias, unicorn/no-this-assignment\n\t\tconst thisAsMergeSegment: ISegmentLeaf = this;\n\t\tleafSegment.parent = thisAsMergeSegment.parent;\n\n\t\t// Give the leaf a temporary yet valid ordinal.\n\t\t// when this segment is put in the tree, it will get its real ordinal,\n\t\t// but this ordinal meets all the necessary invariants for now.\n\t\t// Ordinals exist purely for lexicographical sort order and use a small set of valid bytes for each string character.\n\t\t// The extra handling fromCodePoint has for things like surrogate pairs is therefore unnecessary.\n\t\t// eslint-disable-next-line unicorn/prefer-code-point\n\t\tleafSegment.ordinal = this.ordinal + String.fromCharCode(0);\n\n\t\tleafSegment.removedClientIds = this.removedClientIds?.slice();\n\t\tleafSegment.removedSeq = this.removedSeq;\n\t\tleafSegment.localRemovedSeq = this.localRemovedSeq;\n\t\tleafSegment.seq = this.seq;\n\t\tleafSegment.localSeq = this.localSeq;\n\t\tleafSegment.clientId = this.clientId;\n\t\tleafSegment.movedClientIds = this.movedClientIds?.slice();\n\t\tleafSegment.movedSeq = this.movedSeq;\n\t\tleafSegment.movedSeqs = this.movedSeqs?.slice();\n\t\tleafSegment.localMovedSeq = this.localMovedSeq;\n\t\tleafSegment.wasMovedOnInsert = this.wasMovedOnInsert;\n\t\tthis.segmentGroups.copyTo(leafSegment);\n\t\tthis.trackingCollection.copyTo(leafSegment);\n\t\tif (this.localRefs) {\n\t\t\tthis.localRefs.split(pos, leafSegment);\n\t\t}\n\t\tif (this.attribution) {\n\t\t\tleafSegment.attribution = this.attribution.splitAt(pos);\n\t\t}\n\n\t\treturn leafSegment;\n\t}\n\n\tprivate copyPropertiesTo(other: ISegment): void {\n\t\tif (this.properties !== undefined) {\n\t\t\tif (this.propertyManager) {\n\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\tother.propertyManager = new PropertiesManager();\n\t\t\t\tother.properties = this.propertyManager.copyTo(\n\t\t\t\t\tthis.properties,\n\t\t\t\t\tother.properties,\n\t\t\t\t\tother.propertyManager,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tother.properties = clone(this.properties);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic abstract clone(): ISegment;\n\n\tpublic append(other: ISegment): void {\n\t\t// Note: Must call 'appendLocalRefs' before modifying this segment's length as\n\t\t// 'this.cachedLength' is used to adjust the offsets of the local refs.\n\t\tLocalReferenceCollection.append(this, other);\n\t\tif (this.attribution) {\n\t\t\tassert(\n\t\t\t\tother.attribution !== undefined,\n\t\t\t\t0x4bd /* attribution should be set on appendee */,\n\t\t\t);\n\t\t\tthis.attribution.append(other.attribution);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tother.attribution === undefined,\n\t\t\t\t0x4be /* attribution should not be set on appendee */,\n\t\t\t);\n\t\t}\n\n\t\tthis.cachedLength ??= 0;\n\t\tthis.cachedLength += other.cachedLength;\n\t}\n\n\tprotected abstract createSplitSegmentAt(pos: number): BaseSegment | undefined;\n}\n\n/**\n * The special-cased property key that tracks the id of a {@link Marker}.\n *\n * @remarks In general, marker ids should be accessed using the inherent method\n * {@link Marker.getId}. Marker ids should not be updated after creation.\n * @legacy\n * @alpha\n */\nexport const reservedMarkerIdKey = \"markerId\";\n\n/**\n * @internal\n */\nexport const reservedMarkerSimpleTypeKey = \"markerSimpleType\";\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IJSONMarkerSegment extends IJSONSegment {\n\tmarker: IMarkerDef;\n}\n\n/**\n * Markers are a special kind of segment that do not hold any content.\n *\n * Markers with a reference type of {@link ReferenceType.Tile} support spatially\n * accelerated queries for finding the next marker to the left or right of it in\n * sub-linear time. This is useful, for example, in the case of jumping from the\n * start of a paragraph to the end, assuming a paragraph is bound by markers at\n * the start and end.\n *\n * @legacy\n * @alpha\n */\nexport class Marker extends BaseSegment implements ReferencePosition, ISegment {\n\tpublic static readonly type = \"Marker\";\n\tpublic static is(segment: ISegment): segment is Marker {\n\t\treturn segment.type === Marker.type;\n\t}\n\tpublic readonly type = Marker.type;\n\n\tpublic static make(refType: ReferenceType, props?: PropertySet): Marker {\n\t\treturn new Marker(refType, props);\n\t}\n\n\tconstructor(\n\t\tpublic refType: ReferenceType,\n\t\tprops?: PropertySet,\n\t) {\n\t\tsuper(props);\n\t\tthis.cachedLength = 1;\n\t}\n\n\ttoJSONObject(): IJSONMarkerSegment {\n\t\tconst obj: IJSONMarkerSegment = { marker: { refType: this.refType } };\n\t\tsuper.addSerializedProps(obj);\n\t\treturn obj;\n\t}\n\n\tstatic fromJSONObject(spec: IJSONSegment): Marker | undefined {\n\t\tif (spec && typeof spec === \"object\" && \"marker\" in spec) {\n\t\t\treturn Marker.make((spec.marker as Marker).refType, spec.props as PropertySet);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tclone(): Marker {\n\t\tconst b = Marker.make(this.refType, this.properties);\n\t\tthis.cloneInto(b);\n\t\treturn b;\n\t}\n\n\tgetSegment(): Marker {\n\t\treturn this;\n\t}\n\n\tgetOffset(): number {\n\t\treturn 0;\n\t}\n\n\tgetProperties(): PropertySet | undefined {\n\t\treturn this.properties;\n\t}\n\n\tgetId(): string | undefined {\n\t\treturn this.properties?.[reservedMarkerIdKey] as string;\n\t}\n\n\ttoString(): string {\n\t\treturn `M${this.getId()}`;\n\t}\n\n\tprotected createSplitSegmentAt(pos: number): undefined {\n\t\treturn undefined;\n\t}\n\n\tcanAppend(segment: ISegment): boolean {\n\t\treturn false;\n\t}\n\n\tappend(): void {\n\t\tthrow new Error(\"Can not append to marker\");\n\t}\n}\n\n/**\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n * @legacy\n * @alpha\n */\nexport class CollaborationWindow {\n\tclientId = LocalClientId;\n\tcollaborating = false;\n\n\t/**\n\t * Lowest-numbered segment in window; no client can reference a state before this one\n\t */\n\tminSeq = 0;\n\t/**\n\t * Highest-numbered segment in window and current reference sequence number for this client.\n\t */\n\tcurrentSeq = 0;\n\n\t/**\n\t * Highest-numbered localSeq used for a pending segment.\n\t * Semantically, `localSeq`s provide an ordering on in-flight merge-tree operations:\n\t * for operations stamped with localSeqs `a` and `b`, `a < b` if and only if `a` was submitted before `b`.\n\t *\n\t * @remarks - This field is analogous to the `clientSequenceNumber` field on ops, but it's accessible to merge-tree\n\t * at op submission time rather than only at ack time. This enables more natural state tracking for in-flight ops.\n\t *\n\t * It's useful to stamp ops with such an incrementing counter because it enables reasoning about which segments existed from\n\t * the perspective of the local client at a given point in 'un-acked' time, which is necessary to support the reconnect flow.\n\t *\n\t * For example, imagine a client with initial state \"123456\" submits some ops to create the text \"123456ABC\".\n\t * If they insert the \"C\" first, then \"B\", then \"A\", their local segment state might look like this:\n\t * ```js\n\t * [\n\t * { seq: 0, text: \"1234\" },\n\t * { seq: 5, text: \"56\" },\n\t * { localSeq: 3, seq: UnassignedSequenceNumber, text: \"A\" },\n\t * { localSeq: 2, seq: UnassignedSequenceNumber, text: \"B\" },\n\t * { localSeq: 1, seq: UnassignedSequenceNumber, text: \"C\" },\n\t * ]\n\t * ```\n\t * (note that {@link ISegment.localSeq} tracks the localSeq at which a segment was inserted)\n\t *\n\t * Suppose the client then disconnects and reconnects before any of its insertions are acked. The reconnect flow will necessitate\n\t * that the client regenerates and resubmits ops based on its current segment state as well as the original op that was sent.\n\t *\n\t * It will generate the ops\n\t * 1. \\{ pos: 6, text: \"C\" \\}\n\t * 2. \\{ pos: 6, text: \"B\" \\}\n\t * 3. \\{ pos: 6, text: \"A\" \\}\n\t *\n\t * since when submitting the first op, remote clients don't know that this client is about to submit the \"A\" and \"B\".\n\t *\n\t * On the other hand, imagine if the client had originally submitted the ops in the order \"A\", \"B\", \"C\"\n\t * such that the segments' local state was instead:\n\t *\n\t * ```js\n\t * [\n\t * { seq: 0, text: \"1234\" },\n\t * { seq: 5, text: \"56\" },\n\t * { localSeq: 1, seq: UnassignedSequenceNumber, text: \"A\" },\n\t * { localSeq: 2, seq: UnassignedSequenceNumber, text: \"B\" },\n\t * { localSeq: 3, seq: UnassignedSequenceNumber, text: \"C\" },\n\t * ]\n\t * ```\n\t *\n\t * The resubmitted ops should instead be:\n\t * 1. \\{ pos: 6, text: \"A\" \\}\n\t * 2. \\{ pos: 7, text: \"B\" \\}\n\t * 3. \\{ pos: 8, text: \"C\" \\}\n\t *\n\t * since remote clients will have seen the \"A\" when processing the \"B\" as well as both the \"A\" and \"B\" when processing the \"C\".\n\t * As can be seen, the list of resubmitted ops is different in the two cases despite the merge-tree's segment state only differing\n\t * in `localSeq`.\n\t *\n\t * This example is a bit simplified from the general scenario: since no remote clients modified the merge-tree while the client\n\t * was disconnected, the resubmitted ops end up matching the original ops exactly.\n\t * However, this is not generally true: the production reconnect code takes into account visibility of segments based on both acked\n\t * and local information as appropriate.\n\t * Nonetheless, this simple scenario is enough to understand why it's useful to be able to determine if a segment should be visible\n\t * from a given (seq, localSeq) perspective.\n\t */\n\tlocalSeq = 0;\n\n\tloadFrom(a: CollaborationWindow): void {\n\t\tthis.clientId = a.clientId;\n\t\tthis.collaborating = a.collaborating;\n\t\tthis.minSeq = a.minSeq;\n\t\tthis.currentSeq = a.currentSeq;\n\t}\n}\n\n/**\n * Compares two numbers.\n */\nexport const compareNumbers = (a: number, b: number): number => a - b;\n\n/**\n * Compares two strings.\n */\nexport const compareStrings = (a: string, b: string): number => a.localeCompare(b);\n\n/**\n * Get a human-readable string for a given {@link Marker}.\n *\n * @remarks This function is intended for debugging only. The exact format of\n * this string should not be relied upon between versions.\n * @internal\n */\nexport function debugMarkerToString(marker: Marker): string {\n\tlet bbuf = \"\";\n\tif (refTypeIncludesFlag(marker, ReferenceType.Tile)) {\n\t\tbbuf += \"Tile\";\n\t}\n\tlet lbuf = \"\";\n\tconst id = marker.getId();\n\tif (id) {\n\t\tbbuf += ` (${id}) `;\n\t}\n\tconst tileLabels = refGetTileLabels(marker);\n\tif (tileLabels) {\n\t\tlbuf += \"tile -- \";\n\t\tfor (let i = 0, len = tileLabels.length; i < len; i++) {\n\t\t\tconst tileLabel = tileLabels[i];\n\t\t\tif (i > 0) {\n\t\t\t\tlbuf += \"; \";\n\t\t\t}\n\t\t\tlbuf += tileLabel;\n\t\t}\n\t}\n\n\tlet pbuf = \"\";\n\tif (marker.properties) {\n\t\tpbuf += JSON.stringify(marker.properties, (key, value) => {\n\t\t\t// Avoid circular reference when stringifying makers containing handles.\n\t\t\t// (Substitute a debug string instead.)\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n\t\t\tconst handle = !!value && value.IFluidHandle;\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access\n\t\t\treturn handle ? `#Handle(${handle.routeContext.path}/${handle.path})` : value;\n\t\t});\n\t}\n\treturn `M ${bbuf}: ${lbuf} ${pbuf}`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mergeTreeNodes.js","sourceRoot":"","sources":["../src/mergeTreeNodes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6DAA6D;AAE7D,kEAA6D;AAI7D,iDAIwB;AACxB,2DAA4F;AAE5F,iEAAiE;AACjE,qCAAuF;AACvF,6CAA0D;AAE1D,mDAA8E;AAC9E,mEAIiC;AACjC,gDAAgD;AAChD,2EAAqE;AACrE,gDAAgD;AAChD,+EAAsF;AAiDtF;;;;GAIG;AACH,SAAgB,aAAa,CAC5B,KAAwC;IAExC,IAAI,KAAK,EAAE,gBAAgB,KAAK,SAAS,IAAI,KAAK,EAAE,UAAU,KAAK,SAAS,EAAE,CAAC;QAC9E,OAAO,KAAqB,CAAC;IAC9B,CAAC;IACD,IAAA,iBAAM,EACL,KAAK,EAAE,gBAAgB,KAAK,SAAS,IAAI,KAAK,EAAE,UAAU,KAAK,SAAS,EACxE,KAAK,CAAC,qEAAqE,CAC3E,CAAC;AACH,CAAC;AAVD,sCAUC;AAqED,SAAgB,UAAU,CAAC,KAAqC;IAC/D,IAAI,KAAK,EAAE,cAAc,KAAK,SAAS,IAAI,KAAK,EAAE,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC1E,OAAO,KAAkB,CAAC;IAC3B,CAAC;IACD,IAAA,iBAAM,EACL,KAAK,EAAE,cAAc,KAAK,SAAS;QAClC,KAAK,EAAE,QAAQ,KAAK,SAAS;QAC7B,KAAK,EAAE,SAAS,KAAK,SAAS;QAC9B,KAAK,EAAE,gBAAgB,KAAK,SAAS,EACtC,KAAK,CAAC,mGAAmG,CACzG,CAAC;AACH,CAAC;AAXD,gCAWC;AA+OD;;;;GAIG;AAC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M,CAAC,UAAU,EAAE,CAAC;QACvB,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YACxD,wEAAwE;YACxE,uCAAuC;YACvC,+GAA+G;YAC/G,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,YAAY,CAAC;YAE7C,2GAA2G;YAC3G,OAAO,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,CAAC,YAAY,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;QAC/E,CAAC,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,IAAI,KAAK,IAAI,IAAI,IAAI,EAAE,CAAC;AACrC,CAAC;AAnCD,kDAmCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { AttributionKey } from \"@fluidframework/runtime-definitions/internal\";\n\nimport { IAttributionCollection } from \"./attributionCollection.js\";\nimport {\n\tLocalClientId,\n\tUnassignedSequenceNumber,\n\tUniversalSequenceNumber,\n} from \"./constants.js\";\nimport { LocalReferenceCollection, type LocalReferencePosition } from \"./localReference.js\";\nimport { IMergeTreeDeltaOpArgs } from \"./mergeTreeDeltaCallback.js\";\nimport { TrackingGroupCollection } from \"./mergeTreeTracking.js\";\nimport { IJSONSegment, IMarkerDef, MergeTreeDeltaType, ReferenceType } from \"./ops.js\";\nimport { computeHierarchicalOrdinal } from \"./ordinal.js\";\nimport type { PartialSequenceLengths } from \"./partialLengths.js\";\nimport { PropertySet, clone, createMap, type MapLike } from \"./properties.js\";\nimport {\n\tReferencePosition,\n\trefGetTileLabels,\n\trefTypeIncludesFlag,\n} from \"./referencePositions.js\";\n// eslint-disable-next-line import/no-deprecated\nimport { SegmentGroupCollection } from \"./segmentGroupCollection.js\";\n// eslint-disable-next-line import/no-deprecated\nimport { PropertiesManager, PropertiesRollback } from \"./segmentPropertiesManager.js\";\n\n/**\n * Common properties for a node in a merge tree.\n * @legacy\n * @alpha\n */\nexport interface IMergeNodeCommon {\n\t/**\n\t * The index of this node in its parent's list of children.\n\t */\n\tindex: number;\n\t/**\n\t * A string that can be used for comparing the location of this node to other `MergeNode`s in the same tree.\n\t * `a.ordinal < b.ordinal` if and only if `a` comes before `b` in a pre-order traversal of the tree.\n\t */\n\tordinal: string;\n\tisLeaf(): this is ISegment;\n}\n/**\n * someday we may split tree leaves from segments, but for now they are the same\n * this is just a convenience type that makes it clear that we need something that is both a segment and a leaf node\n */\nexport type ISegmentLeaf = ISegment & { parent?: MergeBlock };\nexport type IMergeNode = MergeBlock | ISegmentLeaf;\n\n/**\n * Contains removal information associated to an {@link ISegment}.\n * @legacy\n * @alpha\n */\nexport interface IRemovalInfo {\n\t/**\n\t * Local seq at which this segment was removed, if the removal is yet-to-be acked.\n\t */\n\tlocalRemovedSeq?: number;\n\t/**\n\t * Seq at which this segment was removed.\n\t */\n\tremovedSeq: number;\n\t/**\n\t * List of client IDs that have removed this segment.\n\t * The client that actually removed the segment (i.e. whose removal op was sequenced first) is stored as the first\n\t * client in this list. Other clients in the list have all issued concurrent ops to remove the segment.\n\t * @remarks When this list has length \\> 1, this is referred to as the \"overlapping remove\" case.\n\t */\n\tremovedClientIds: number[];\n}\n\n/**\n * Returns the removal information for a segment.\n *\n * @internal\n */\nexport function toRemovalInfo(\n\tmaybe: Partial<IRemovalInfo> | undefined,\n): IRemovalInfo | undefined {\n\tif (maybe?.removedClientIds !== undefined && maybe?.removedSeq !== undefined) {\n\t\treturn maybe as IRemovalInfo;\n\t}\n\tassert(\n\t\tmaybe?.removedClientIds === undefined && maybe?.removedSeq === undefined,\n\t\t0x2bf /* \"both removedClientIds and removedSeq should be set or not set\" */,\n\t);\n}\n\n/**\n * Tracks information about when and where this segment was moved to.\n *\n * Note that merge-tree does not currently support moving and only supports\n * obliterate. The fields below include \"move\" in their names to avoid renaming\n * in the future, when moves _are_ supported.\n * @legacy\n * @alpha\n */\nexport interface IMoveInfo {\n\t/**\n\t * Local seq at which this segment was moved if the move is yet-to-be\n\t * acked.\n\t */\n\tlocalMovedSeq?: number;\n\n\t/**\n\t * The first seq at which this segment was moved.\n\t */\n\tmovedSeq: number;\n\n\t/**\n\t * All seqs at which this segment was moved. In the case of overlapping,\n\t * concurrent moves this array will contain multiple seqs.\n\t *\n\t * The seq at `movedSeqs[i]` corresponds to the client id at `movedClientIds[i]`.\n\t *\n\t * The first element corresponds to the seq of the first move\n\t */\n\tmovedSeqs: number[];\n\n\t/**\n\t * A reference to the inserted destination segment corresponding to this\n\t * segment's move.\n\t *\n\t * If undefined, the move was an obliterate.\n\t *\n\t * Currently this field is unused, as we only support obliterate operations\n\t */\n\tmoveDst?: ReferencePosition;\n\n\t/**\n\t * List of client IDs that have moved this segment.\n\t *\n\t * The client that actually moved the segment (i.e. whose move op was sequenced\n\t * first) is stored as the first client in this list. Other clients in the\n\t * list have all issued concurrent ops to move the segment.\n\t */\n\tmovedClientIds: number[];\n\n\t/**\n\t * If this segment was inserted into a concurrently moved range and\n\t * the move op was sequenced before the insertion op. In this case,\n\t * the segment is visible only to the inserting client\n\t *\n\t * `wasMovedOnInsert` only applies for acked obliterates. That is, if\n\t * a segment inserted by a remote client is moved on insertion by a local\n\t * and unacked obliterate, we do not consider it as having been moved\n\t * on insert\n\t *\n\t * If a segment is moved on insertion, its length is only ever visible to\n\t * the client that inserted the segment. This is relevant in partial length\n\t * calculations\n\t */\n\twasMovedOnInsert: boolean;\n}\n\nexport function toMoveInfo(maybe: Partial<IMoveInfo> | undefined): IMoveInfo | undefined {\n\tif (maybe?.movedClientIds !== undefined && maybe?.movedSeq !== undefined) {\n\t\treturn maybe as IMoveInfo;\n\t}\n\tassert(\n\t\tmaybe?.movedClientIds === undefined &&\n\t\t\tmaybe?.movedSeq === undefined &&\n\t\t\tmaybe?.movedSeqs === undefined &&\n\t\t\tmaybe?.wasMovedOnInsert === undefined,\n\t\t0x86d /* movedClientIds, movedSeq, wasMovedOnInsert, and movedSeqs should all be either set or not set */,\n\t);\n}\n\n/**\n * A segment representing a portion of the merge tree.\n * Segments are leaf nodes of the merge tree and contain data.\n * @legacy\n * @alpha\n */\nexport interface ISegment extends IMergeNodeCommon, Partial<IRemovalInfo>, Partial<IMoveInfo> {\n\treadonly type: string;\n\t/**\n\t * @deprecated - This property should not be used externally and will be removed in a subsequent release.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\treadonly segmentGroups: SegmentGroupCollection;\n\treadonly trackingCollection: TrackingGroupCollection;\n\t/**\n\t * Whether or not this segment is a special segment denoting the start or\n\t * end of the tree\n\t *\n\t * Endpoint segments are imaginary segments positioned immediately before or\n\t * after the tree. These segments cannot be referenced by regular operations\n\t * and exist primarily as a bucket for local references to slide onto during\n\t * deletion of regular segments.\n\t */\n\treadonly endpointType?: \"start\" | \"end\";\n\n\t/**\n\t * The length of the contents of the node.\n\t */\n\tcachedLength: number;\n\t/**\n\t * Stores attribution keys associated with offsets of this segment.\n\t * This data is only persisted if MergeTree's `attributions.track` flag is set to true.\n\t * Pending segments (i.e. ones that only exist locally and haven't been acked by the server) also have\n\t * `attribution === undefined` until ack.\n\t *\n\t * Keys can be used opaquely with an IAttributor or a container runtime that provides attribution.\n\t * @remarks There are plans to make the shape of the data stored extensible in a couple ways:\n\t *\n\t * 1. Injection of custom attribution information associated with the segment (ex: copy-paste of\n\t * content but keeping the old attribution information).\n\t *\n\t * 2. Storage of multiple \"channels\" of information (ex: track property changes separately from insertion,\n\t * or only attribute certain property modifications, etc.)\n\t */\n\tattribution?: IAttributionCollection<AttributionKey>;\n\n\t/**\n\t * Manages pending local state for properties on this segment.\n\t *\n\t * @deprecated - This property should not be used externally and will be removed in a subsequent release.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tpropertyManager?: PropertiesManager;\n\t/**\n\t * Local seq at which this segment was inserted.\n\t * This is defined if and only if the insertion of the segment is pending ack, i.e. `seq` is UnassignedSequenceNumber.\n\t * Once the segment is acked, this field is cleared.\n\t *\n\t * See {@link CollaborationWindow.localSeq} for more information on the semantics of localSeq.\n\t */\n\tlocalSeq?: number;\n\t/**\n\t * Local seq at which this segment was removed. If this is defined, `removedSeq` will initially be set to\n\t * UnassignedSequenceNumber. However, if another client concurrently removes the same segment, `removedSeq`\n\t * will be updated to the seq at which that client removed this segment.\n\t *\n\t * Like {@link ISegment.localSeq}, this field is cleared once the local removal of the segment is acked.\n\t * See {@link CollaborationWindow.localSeq} for more information on the semantics of localSeq.\n\t */\n\tlocalRemovedSeq?: number;\n\t/**\n\t * Seq at which this segment was inserted.\n\t * If undefined, it is assumed the segment was inserted prior to the collab window's minimum sequence number.\n\t */\n\tseq?: number;\n\t/**\n\t * Short clientId for the client that inserted this segment.\n\t */\n\tclientId: number;\n\t/**\n\t * Local references added to this segment.\n\t */\n\tlocalRefs?: LocalReferenceCollection;\n\t/**\n\t * Properties that have been added to this segment via annotation.\n\t */\n\tproperties?: PropertySet;\n\n\t/**\n\t * Add properties to this segment via annotation.\n\t *\n\t * @deprecated - This function should not be used externally and will be removed in a subsequent release.\n\t *\n\t * @remarks This function should not be called directly. Properties should\n\t * be added through the `annotateRange` functions.\n\t */\n\taddProperties(\n\t\tnewProps: PropertySet,\n\t\tseq?: number,\n\t\tcollaborating?: boolean,\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\trollback?: PropertiesRollback,\n\t): PropertySet;\n\tclone(): ISegment;\n\tcanAppend(segment: ISegment): boolean;\n\tappend(segment: ISegment): void;\n\tsplitAt(pos: number): ISegment | undefined;\n\t// Changing this to something other than any would break consumers.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\ttoJSONObject(): any;\n\t/**\n\t * @deprecated - This function should not be used externally and will be removed in a subsequent release.\n\t * Acks the current segment against the segment group, op, and merge tree.\n\t *\n\t * @param segmentGroup - Pending segment group associated with this op.\n\t * @param opArgs - Information about the op that was acked\n\t * @returns `true` if the op modifies the segment, otherwise `false`.\n\t * The only current false case is overlapping remove, where a segment is removed\n\t * by a previously sequenced operation before the current operation is acked.\n\t * @throws - error if the segment state doesn't match segment group or op.\n\t * E.g. if the segment group is not first in the pending queue, or\n\t * an inserted segment does not have unassigned sequence number.\n\t */\n\tack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean;\n}\n\n/**\n * @internal\n */\nexport interface IMarkerModifiedAction {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(marker: Marker): void;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISegmentAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tsegment: ISegment,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number,\n\t\tend: number,\n\t\taccum: TClientData,\n\t): boolean;\n}\n/**\n * @internal\n */\nexport interface ISegmentChanges {\n\tnext?: ISegment;\n\treplaceCurrent?: ISegment;\n}\n/**\n * @internal\n */\nexport interface BlockAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tblock: MergeBlock,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\taccum: TClientData,\n\t): boolean;\n}\n\n/**\n * @internal\n */\nexport interface NodeAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tnode: MergeNode,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\tclientData: TClientData,\n\t): boolean;\n}\n\n/**\n * @internal\n */\nexport interface InsertContext {\n\tcandidateSegment?: ISegment;\n\tleaf: (segment: ISegment | undefined, pos: number, ic: InsertContext) => ISegmentChanges;\n\tcontinuePredicate?: (continueFromBlock: MergeBlock) => boolean;\n}\n\n/**\n * @internal\n */\nexport interface SegmentActions<TClientData> {\n\tleaf?: ISegmentAction<TClientData>;\n\tshift?: NodeAction<TClientData>;\n\tcontains?: NodeAction<TClientData>;\n\tpre?: BlockAction<TClientData>;\n\tpost?: BlockAction<TClientData>;\n}\n\n/**\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n * @legacy\n * @alpha\n */\nexport interface ObliterateInfo {\n\tstart: LocalReferencePosition;\n\tend: LocalReferencePosition;\n\trefSeq: number;\n\tclientId: number;\n\tseq: number;\n\tlocalSeq: number | undefined;\n\tsegmentGroup: SegmentGroup | undefined;\n}\n\n/**\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n * @legacy\n * @alpha\n */\nexport interface SegmentGroup {\n\tsegments: ISegment[];\n\tpreviousProps?: PropertySet[];\n\tlocalSeq?: number;\n\trefSeq: number;\n\tobliterateInfo?: ObliterateInfo;\n}\n\n/**\n * @legacy\n * @alpha\n * @deprecated - unused and will be removed\n */\nexport class MergeNode implements IMergeNodeCommon {\n\tindex: number = 0;\n\tordinal: string = \"\";\n\tcachedLength: number = 0;\n\n\tisLeaf(): this is ISegment {\n\t\treturn false;\n\t}\n}\n\n/**\n * Note that the actual branching factor of the MergeTree is `MaxNodesInBlock - 1`. This is because\n * the MergeTree always inserts first, then checks for overflow and splits if the child count equals\n * `MaxNodesInBlock`. (i.e., `MaxNodesInBlock` contains 1 extra slot for temporary storage to\n * facilitate splits.)\n * @internal\n */\nexport const MaxNodesInBlock = 8;\n/**\n * @internal\n */\nexport class MergeBlock implements IMergeNodeCommon {\n\tpublic children: IMergeNode[];\n\tpublic needsScour?: boolean;\n\tpublic parent?: MergeBlock;\n\tpublic index: number = 0;\n\tpublic ordinal: string = \"\";\n\tpublic cachedLength: number | undefined = 0;\n\n\t/**\n\t * Maps each tile label in this block to the rightmost (i.e. furthest) marker associated with that tile label.\n\t * When combined with the tree structure of MergeBlocks, this allows accelerated queries for nearest tile\n\t * with a certain label before a given position\n\t */\n\tpublic rightmostTiles: Readonly<MapLike<Marker>>;\n\t/**\n\t * Maps each tile label in this block to the leftmost (i.e. nearest) marker associated with that tile label.\n\t * When combined with the tree structure of MergeBlocks, this allows accelerated queries for nearest tile\n\t * with a certain label before a given position\n\t */\n\tpublic leftmostTiles: Readonly<MapLike<Marker>>;\n\n\tisLeaf(): this is ISegment {\n\t\treturn false;\n\t}\n\n\t/**\n\t * Supports querying the total length of all descendants of this IMergeBlock from the perspective of any\n\t * (clientId, seq) within the collab window.\n\t *\n\t * @remarks This is only optional for implementation reasons (internal nodes can be created/moved without\n\t * immediately initializing the partial lengths). Aside from mid-update on tree operations, these lengths\n\t * objects are always defined.\n\t */\n\tpartialLengths?: PartialSequenceLengths;\n\n\tpublic constructor(public childCount: number) {\n\t\t// Suppression needed due to the way the merge tree children are initalized - we\n\t\t// allocate 8 children blocks, but any unused blocks are not counted in the childCount.\n\t\t// Using Array.from leads to unused children being undefined, which are counted in childCount.\n\t\t// eslint-disable-next-line unicorn/no-new-array\n\t\tthis.children = new Array<IMergeNode>(MaxNodesInBlock);\n\t\tthis.rightmostTiles = createMap<Marker>();\n\t\tthis.leftmostTiles = createMap<Marker>();\n\t}\n\n\tpublic setOrdinal(child: IMergeNode, index: number): void {\n\t\tconst childCount = this.childCount;\n\t\tassert(\n\t\t\tchildCount >= 1 && childCount <= MaxNodesInBlock,\n\t\t\t0x040 /* \"Child count is not within [1,8] range!\" */,\n\t\t);\n\t\tchild.ordinal = computeHierarchicalOrdinal(\n\t\t\tMaxNodesInBlock,\n\t\t\tchildCount,\n\t\t\tthis.ordinal,\n\t\t\tindex === 0 ? undefined : this.children[index - 1]?.ordinal,\n\t\t);\n\t}\n\n\tpublic assignChild(child: IMergeNode, index: number, updateOrdinal = true): void {\n\t\tchild.parent = this;\n\t\tchild.index = index;\n\t\tif (updateOrdinal) {\n\t\t\tthis.setOrdinal(child, index);\n\t\t}\n\t\tthis.children[index] = child;\n\t}\n}\n\nexport function seqLTE(seq: number, minOrRefSeq: number): boolean {\n\treturn seq !== UnassignedSequenceNumber && seq <= minOrRefSeq;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport abstract class BaseSegment implements ISegment {\n\tpublic clientId: number = LocalClientId;\n\tpublic seq: number = UniversalSequenceNumber;\n\tpublic removedSeq?: number;\n\tpublic removedClientIds?: number[];\n\tpublic movedSeq?: number;\n\tpublic movedSeqs?: number[];\n\tpublic movedClientIds?: number[];\n\tpublic wasMovedOnInsert?: boolean | undefined;\n\tpublic index: number = 0;\n\tpublic ordinal: string = \"\";\n\tpublic cachedLength: number = 0;\n\n\t/**\n\t * {@inheritdoc ISegment.segmentGroups}\n\t * @deprecated - This property should not be used externally and will be removed in a subsequent release.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic readonly segmentGroups: SegmentGroupCollection = new SegmentGroupCollection(this);\n\tpublic readonly trackingCollection: TrackingGroupCollection = new TrackingGroupCollection(\n\t\tthis,\n\t);\n\t/***/\n\tpublic attribution?: IAttributionCollection<AttributionKey>;\n\t/**\n\t * {@inheritdoc ISegment.propertyManager}\n\t * @deprecated - This property should not be used externally and will be removed in a subsequent release.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic propertyManager?: PropertiesManager;\n\tpublic properties?: PropertySet;\n\tpublic localRefs?: LocalReferenceCollection;\n\tpublic abstract readonly type: string;\n\tpublic localSeq?: number;\n\tpublic localRemovedSeq?: number;\n\tpublic localMovedSeq?: number;\n\n\tpublic constructor(properties?: PropertySet) {\n\t\tif (properties !== undefined) {\n\t\t\tthis.properties = clone(properties);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritdoc ISegment.addProperties}\n\t * @deprecated - This function should not be used externally and will be removed in a subsequent release.\n\t */\n\tpublic addProperties(\n\t\tnewProps: PropertySet,\n\t\tseq?: number,\n\t\tcollaborating?: boolean,\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\trollback: PropertiesRollback = PropertiesRollback.None,\n\t): PropertySet {\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tthis.propertyManager ??= new PropertiesManager();\n\t\t// A property set must be able to hold properties of any type, so the any is needed.\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tthis.properties ??= createMap<any>();\n\t\treturn this.propertyManager.addProperties(\n\t\t\tthis.properties,\n\t\t\tnewProps,\n\t\t\tseq,\n\t\t\tcollaborating,\n\t\t\trollback,\n\t\t);\n\t}\n\n\tpublic hasProperty(key: string): boolean {\n\t\treturn !!this.properties && this.properties[key] !== undefined;\n\t}\n\n\tpublic isLeaf(): this is ISegment {\n\t\treturn true;\n\t}\n\n\tprotected cloneInto(b: ISegment): void {\n\t\tb.clientId = this.clientId;\n\t\t// TODO: deep clone properties\n\t\tb.properties = clone(this.properties);\n\t\tb.removedClientIds = this.removedClientIds?.slice();\n\t\t// TODO: copy removed client overlap and branch removal info\n\t\tb.removedSeq = this.removedSeq;\n\t\tb.movedClientIds = this.movedClientIds?.slice();\n\t\tb.movedSeq = this.movedSeq;\n\t\tb.movedSeqs = this.movedSeqs;\n\t\tb.wasMovedOnInsert = this.wasMovedOnInsert;\n\t\tb.seq = this.seq;\n\t\tb.attribution = this.attribution?.clone();\n\t}\n\n\tpublic canAppend(segment: ISegment): boolean {\n\t\treturn false;\n\t}\n\n\tprotected addSerializedProps(jseg: IJSONSegment): void {\n\t\tif (this.properties) {\n\t\t\tjseg.props = { ...this.properties };\n\t\t}\n\t}\n\t// This has to return any type because the return type is different for different segment types.\n\t// TODO: If possible, change the return type to match what should be returned for each segment type.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic abstract toJSONObject(): any;\n\n\t/**\n\t * {@inheritdoc ISegment.ack}\n\t * @deprecated - This function should not be used externally and will be removed in a subsequent release.\n\t */\n\tpublic ack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean {\n\t\tconst currentSegmentGroup = this.segmentGroups.dequeue();\n\t\tassert(\n\t\t\tcurrentSegmentGroup === segmentGroup,\n\t\t\t0x043 /* \"On ack, unexpected segmentGroup!\" */,\n\t\t);\n\t\tswitch (opArgs.op.type) {\n\t\t\tcase MergeTreeDeltaType.ANNOTATE: {\n\t\t\t\tassert(\n\t\t\t\t\t!!this.propertyManager,\n\t\t\t\t\t0x044 /* \"On annotate ack, missing segment property manager!\" */,\n\t\t\t\t);\n\t\t\t\tthis.propertyManager.ackPendingProperties(opArgs.op);\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tcase MergeTreeDeltaType.INSERT: {\n\t\t\t\tassert(\n\t\t\t\t\tthis.seq === UnassignedSequenceNumber,\n\t\t\t\t\t0x045 /* \"On insert, seq number already assigned!\" */,\n\t\t\t\t);\n\t\t\t\tthis.seq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\tthis.localSeq = undefined;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tcase MergeTreeDeltaType.REMOVE: {\n\t\t\t\tconst removalInfo: IRemovalInfo | undefined = toRemovalInfo(this);\n\t\t\t\tassert(removalInfo !== undefined, 0x046 /* \"On remove ack, missing removal info!\" */);\n\t\t\t\tthis.localRemovedSeq = undefined;\n\t\t\t\tif (removalInfo.removedSeq === UnassignedSequenceNumber) {\n\t\t\t\t\tremovalInfo.removedSeq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tcase MergeTreeDeltaType.OBLITERATE: {\n\t\t\t\tconst moveInfo: IMoveInfo | undefined = toMoveInfo(this);\n\t\t\t\tassert(moveInfo !== undefined, 0x86e /* On obliterate ack, missing move info! */);\n\t\t\t\tconst obliterateInfo = segmentGroup.obliterateInfo;\n\t\t\t\tassert(obliterateInfo !== undefined, 0xa40 /* must have obliterate info */);\n\t\t\t\tthis.localMovedSeq = obliterateInfo.localSeq = undefined;\n\t\t\t\tconst seqIdx = moveInfo.movedSeqs.indexOf(UnassignedSequenceNumber);\n\t\t\t\tassert(seqIdx !== -1, 0x86f /* expected movedSeqs to contain unacked seq */);\n\t\t\t\tmoveInfo.movedSeqs[seqIdx] = obliterateInfo.seq =\n\t\t\t\t\topArgs.sequencedMessage!.sequenceNumber;\n\n\t\t\t\tif (moveInfo.movedSeq === UnassignedSequenceNumber) {\n\t\t\t\t\tmoveInfo.movedSeq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(`${opArgs.op.type} is in unrecognized operation type`);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic splitAt(pos: number): ISegment | undefined {\n\t\tif (pos <= 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst leafSegment: ISegmentLeaf | undefined = this.createSplitSegmentAt(pos);\n\n\t\tif (!leafSegment) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tthis.copyPropertiesTo(leafSegment);\n\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias, unicorn/no-this-assignment\n\t\tconst thisAsMergeSegment: ISegmentLeaf = this;\n\t\tleafSegment.parent = thisAsMergeSegment.parent;\n\n\t\t// Give the leaf a temporary yet valid ordinal.\n\t\t// when this segment is put in the tree, it will get its real ordinal,\n\t\t// but this ordinal meets all the necessary invariants for now.\n\t\t// Ordinals exist purely for lexicographical sort order and use a small set of valid bytes for each string character.\n\t\t// The extra handling fromCodePoint has for things like surrogate pairs is therefore unnecessary.\n\t\t// eslint-disable-next-line unicorn/prefer-code-point\n\t\tleafSegment.ordinal = this.ordinal + String.fromCharCode(0);\n\n\t\tleafSegment.removedClientIds = this.removedClientIds?.slice();\n\t\tleafSegment.removedSeq = this.removedSeq;\n\t\tleafSegment.localRemovedSeq = this.localRemovedSeq;\n\t\tleafSegment.seq = this.seq;\n\t\tleafSegment.localSeq = this.localSeq;\n\t\tleafSegment.clientId = this.clientId;\n\t\tleafSegment.movedClientIds = this.movedClientIds?.slice();\n\t\tleafSegment.movedSeq = this.movedSeq;\n\t\tleafSegment.movedSeqs = this.movedSeqs?.slice();\n\t\tleafSegment.localMovedSeq = this.localMovedSeq;\n\t\tleafSegment.wasMovedOnInsert = this.wasMovedOnInsert;\n\t\tthis.segmentGroups.copyTo(leafSegment);\n\t\tthis.trackingCollection.copyTo(leafSegment);\n\t\tif (this.localRefs) {\n\t\t\tthis.localRefs.split(pos, leafSegment);\n\t\t}\n\t\tif (this.attribution) {\n\t\t\tleafSegment.attribution = this.attribution.splitAt(pos);\n\t\t}\n\n\t\treturn leafSegment;\n\t}\n\n\tprivate copyPropertiesTo(other: ISegment): void {\n\t\tif (this.properties !== undefined) {\n\t\t\tif (this.propertyManager) {\n\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\tother.propertyManager = new PropertiesManager();\n\t\t\t\tother.properties = this.propertyManager.copyTo(\n\t\t\t\t\tthis.properties,\n\t\t\t\t\tother.properties,\n\t\t\t\t\tother.propertyManager,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tother.properties = clone(this.properties);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic abstract clone(): ISegment;\n\n\tpublic append(other: ISegment): void {\n\t\t// Note: Must call 'appendLocalRefs' before modifying this segment's length as\n\t\t// 'this.cachedLength' is used to adjust the offsets of the local refs.\n\t\tLocalReferenceCollection.append(this, other);\n\t\tif (this.attribution) {\n\t\t\tassert(\n\t\t\t\tother.attribution !== undefined,\n\t\t\t\t0x4bd /* attribution should be set on appendee */,\n\t\t\t);\n\t\t\tthis.attribution.append(other.attribution);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tother.attribution === undefined,\n\t\t\t\t0x4be /* attribution should not be set on appendee */,\n\t\t\t);\n\t\t}\n\n\t\tthis.cachedLength ??= 0;\n\t\tthis.cachedLength += other.cachedLength;\n\t}\n\n\tprotected abstract createSplitSegmentAt(pos: number): BaseSegment | undefined;\n}\n\n/**\n * The special-cased property key that tracks the id of a {@link Marker}.\n *\n * @remarks In general, marker ids should be accessed using the inherent method\n * {@link Marker.getId}. Marker ids should not be updated after creation.\n * @legacy\n * @alpha\n */\nexport const reservedMarkerIdKey = \"markerId\";\n\n/**\n * @internal\n */\nexport const reservedMarkerSimpleTypeKey = \"markerSimpleType\";\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IJSONMarkerSegment extends IJSONSegment {\n\tmarker: IMarkerDef;\n}\n\n/**\n * Markers are a special kind of segment that do not hold any content.\n *\n * Markers with a reference type of {@link ReferenceType.Tile} support spatially\n * accelerated queries for finding the next marker to the left or right of it in\n * sub-linear time. This is useful, for example, in the case of jumping from the\n * start of a paragraph to the end, assuming a paragraph is bound by markers at\n * the start and end.\n *\n * @legacy\n * @alpha\n */\nexport class Marker extends BaseSegment implements ReferencePosition, ISegment {\n\tpublic static readonly type = \"Marker\";\n\tpublic static is(segment: ISegment): segment is Marker {\n\t\treturn segment.type === Marker.type;\n\t}\n\tpublic readonly type = Marker.type;\n\n\tpublic static make(refType: ReferenceType, props?: PropertySet): Marker {\n\t\treturn new Marker(refType, props);\n\t}\n\n\tconstructor(\n\t\tpublic refType: ReferenceType,\n\t\tprops?: PropertySet,\n\t) {\n\t\tsuper(props);\n\t\tthis.cachedLength = 1;\n\t}\n\n\ttoJSONObject(): IJSONMarkerSegment {\n\t\tconst obj: IJSONMarkerSegment = { marker: { refType: this.refType } };\n\t\tsuper.addSerializedProps(obj);\n\t\treturn obj;\n\t}\n\n\tstatic fromJSONObject(spec: IJSONSegment): Marker | undefined {\n\t\tif (spec && typeof spec === \"object\" && \"marker\" in spec) {\n\t\t\treturn Marker.make((spec.marker as Marker).refType, spec.props as PropertySet);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tclone(): Marker {\n\t\tconst b = Marker.make(this.refType, this.properties);\n\t\tthis.cloneInto(b);\n\t\treturn b;\n\t}\n\n\tgetSegment(): Marker {\n\t\treturn this;\n\t}\n\n\tgetOffset(): number {\n\t\treturn 0;\n\t}\n\n\tgetProperties(): PropertySet | undefined {\n\t\treturn this.properties;\n\t}\n\n\tgetId(): string | undefined {\n\t\treturn this.properties?.[reservedMarkerIdKey] as string;\n\t}\n\n\ttoString(): string {\n\t\treturn `M${this.getId()}`;\n\t}\n\n\tprotected createSplitSegmentAt(pos: number): undefined {\n\t\treturn undefined;\n\t}\n\n\tcanAppend(segment: ISegment): boolean {\n\t\treturn false;\n\t}\n\n\tappend(): void {\n\t\tthrow new Error(\"Can not append to marker\");\n\t}\n}\n\n/**\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n * @legacy\n * @alpha\n */\nexport class CollaborationWindow {\n\tclientId = LocalClientId;\n\tcollaborating = false;\n\n\t/**\n\t * Lowest-numbered segment in window; no client can reference a state before this one\n\t */\n\tminSeq = 0;\n\t/**\n\t * Highest-numbered segment in window and current reference sequence number for this client.\n\t */\n\tcurrentSeq = 0;\n\n\t/**\n\t * Highest-numbered localSeq used for a pending segment.\n\t * Semantically, `localSeq`s provide an ordering on in-flight merge-tree operations:\n\t * for operations stamped with localSeqs `a` and `b`, `a < b` if and only if `a` was submitted before `b`.\n\t *\n\t * @remarks - This field is analogous to the `clientSequenceNumber` field on ops, but it's accessible to merge-tree\n\t * at op submission time rather than only at ack time. This enables more natural state tracking for in-flight ops.\n\t *\n\t * It's useful to stamp ops with such an incrementing counter because it enables reasoning about which segments existed from\n\t * the perspective of the local client at a given point in 'un-acked' time, which is necessary to support the reconnect flow.\n\t *\n\t * For example, imagine a client with initial state \"123456\" submits some ops to create the text \"123456ABC\".\n\t * If they insert the \"C\" first, then \"B\", then \"A\", their local segment state might look like this:\n\t * ```js\n\t * [\n\t * { seq: 0, text: \"1234\" },\n\t * { seq: 5, text: \"56\" },\n\t * { localSeq: 3, seq: UnassignedSequenceNumber, text: \"A\" },\n\t * { localSeq: 2, seq: UnassignedSequenceNumber, text: \"B\" },\n\t * { localSeq: 1, seq: UnassignedSequenceNumber, text: \"C\" },\n\t * ]\n\t * ```\n\t * (note that {@link ISegment.localSeq} tracks the localSeq at which a segment was inserted)\n\t *\n\t * Suppose the client then disconnects and reconnects before any of its insertions are acked. The reconnect flow will necessitate\n\t * that the client regenerates and resubmits ops based on its current segment state as well as the original op that was sent.\n\t *\n\t * It will generate the ops\n\t * 1. \\{ pos: 6, text: \"C\" \\}\n\t * 2. \\{ pos: 6, text: \"B\" \\}\n\t * 3. \\{ pos: 6, text: \"A\" \\}\n\t *\n\t * since when submitting the first op, remote clients don't know that this client is about to submit the \"A\" and \"B\".\n\t *\n\t * On the other hand, imagine if the client had originally submitted the ops in the order \"A\", \"B\", \"C\"\n\t * such that the segments' local state was instead:\n\t *\n\t * ```js\n\t * [\n\t * { seq: 0, text: \"1234\" },\n\t * { seq: 5, text: \"56\" },\n\t * { localSeq: 1, seq: UnassignedSequenceNumber, text: \"A\" },\n\t * { localSeq: 2, seq: UnassignedSequenceNumber, text: \"B\" },\n\t * { localSeq: 3, seq: UnassignedSequenceNumber, text: \"C\" },\n\t * ]\n\t * ```\n\t *\n\t * The resubmitted ops should instead be:\n\t * 1. \\{ pos: 6, text: \"A\" \\}\n\t * 2. \\{ pos: 7, text: \"B\" \\}\n\t * 3. \\{ pos: 8, text: \"C\" \\}\n\t *\n\t * since remote clients will have seen the \"A\" when processing the \"B\" as well as both the \"A\" and \"B\" when processing the \"C\".\n\t * As can be seen, the list of resubmitted ops is different in the two cases despite the merge-tree's segment state only differing\n\t * in `localSeq`.\n\t *\n\t * This example is a bit simplified from the general scenario: since no remote clients modified the merge-tree while the client\n\t * was disconnected, the resubmitted ops end up matching the original ops exactly.\n\t * However, this is not generally true: the production reconnect code takes into account visibility of segments based on both acked\n\t * and local information as appropriate.\n\t * Nonetheless, this simple scenario is enough to understand why it's useful to be able to determine if a segment should be visible\n\t * from a given (seq, localSeq) perspective.\n\t */\n\tlocalSeq = 0;\n\n\tloadFrom(a: CollaborationWindow): void {\n\t\tthis.clientId = a.clientId;\n\t\tthis.collaborating = a.collaborating;\n\t\tthis.minSeq = a.minSeq;\n\t\tthis.currentSeq = a.currentSeq;\n\t}\n}\n\n/**\n * Compares two numbers.\n */\nexport const compareNumbers = (a: number, b: number): number => a - b;\n\n/**\n * Compares two strings.\n */\nexport const compareStrings = (a: string, b: string): number => a.localeCompare(b);\n\n/**\n * Get a human-readable string for a given {@link Marker}.\n *\n * @remarks This function is intended for debugging only. The exact format of\n * this string should not be relied upon between versions.\n * @internal\n */\nexport function debugMarkerToString(marker: Marker): string {\n\tlet bbuf = \"\";\n\tif (refTypeIncludesFlag(marker, ReferenceType.Tile)) {\n\t\tbbuf += \"Tile\";\n\t}\n\tlet lbuf = \"\";\n\tconst id = marker.getId();\n\tif (id) {\n\t\tbbuf += ` (${id}) `;\n\t}\n\tconst tileLabels = refGetTileLabels(marker);\n\tif (tileLabels) {\n\t\tlbuf += \"tile -- \";\n\t\tfor (let i = 0, len = tileLabels.length; i < len; i++) {\n\t\t\tconst tileLabel = tileLabels[i];\n\t\t\tif (i > 0) {\n\t\t\t\tlbuf += \"; \";\n\t\t\t}\n\t\t\tlbuf += tileLabel;\n\t\t}\n\t}\n\n\tlet pbuf = \"\";\n\tif (marker.properties) {\n\t\tpbuf += JSON.stringify(marker.properties, (key, value) => {\n\t\t\t// Avoid circular reference when stringifying makers containing handles.\n\t\t\t// (Substitute a debug string instead.)\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n\t\t\tconst handle = !!value && value.IFluidHandle;\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access\n\t\t\treturn handle ? `#Handle(${handle.routeContext.path}/${handle.path})` : value;\n\t\t});\n\t}\n\treturn `M ${bbuf}: ${lbuf} ${pbuf}`;\n}\n"]}
|
|
@@ -83,7 +83,8 @@ describe("obliterate partial lengths", () => {
|
|
|
83
83
|
describe("overlapping remove+obliterate", () => {
|
|
84
84
|
it("passes for local remove and remote obliterate", () => {
|
|
85
85
|
const localRemoveOp = client.removeRangeLocal(0, "hello ".length);
|
|
86
|
-
|
|
86
|
+
(0, testUtils_js_1.obliterateRange)({
|
|
87
|
+
mergeTree: client.mergeTree,
|
|
87
88
|
start: 0,
|
|
88
89
|
end: "hello ".length,
|
|
89
90
|
refSeq,
|
|
@@ -119,7 +120,8 @@ describe("obliterate partial lengths", () => {
|
|
|
119
120
|
});
|
|
120
121
|
it("passes for remote remove and remote obliterate", () => {
|
|
121
122
|
client.removeRangeRemote(0, "hello ".length, refSeq + 1, refSeq, client.getLongClientId(remoteClientId));
|
|
122
|
-
|
|
123
|
+
(0, testUtils_js_1.obliterateRange)({
|
|
124
|
+
mergeTree: client.mergeTree,
|
|
123
125
|
start: 0,
|
|
124
126
|
end: "hello ".length,
|
|
125
127
|
refSeq,
|
|
@@ -148,7 +150,8 @@ describe("obliterate partial lengths", () => {
|
|
|
148
150
|
describe("overlapping obliterate+obliterate", () => {
|
|
149
151
|
it("passes for local obliterate and remote obliterate", () => {
|
|
150
152
|
const localObliterateOp = client.obliterateRangeLocal(0, "hello ".length);
|
|
151
|
-
|
|
153
|
+
(0, testUtils_js_1.obliterateRange)({
|
|
154
|
+
mergeTree: client.mergeTree,
|
|
152
155
|
start: 0,
|
|
153
156
|
end: "hello ".length,
|
|
154
157
|
refSeq,
|
|
@@ -170,7 +173,8 @@ describe("obliterate partial lengths", () => {
|
|
|
170
173
|
], refSeq);
|
|
171
174
|
});
|
|
172
175
|
it("passes for remote obliterate and local obliterate", () => {
|
|
173
|
-
|
|
176
|
+
(0, testUtils_js_1.obliterateRange)({
|
|
177
|
+
mergeTree: client.mergeTree,
|
|
174
178
|
start: 0,
|
|
175
179
|
end: "hello ".length,
|
|
176
180
|
refSeq,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obliterate.partialLength.spec.js","sourceRoot":"","sources":["../../src/test/obliterate.partialLength.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,6CAA+C;AAE/C,sCAA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,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE;aACxC,EACD,MAAM,CACN,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport { MergeTreeDeltaType } from \"../ops.js\";\n\nimport { TestClient } from \"./testClient.js\";\nimport {\n\tinsertText,\n\tuseStrictPartialLengthChecks,\n\tvalidatePartialLengths,\n} from \"./testUtils.js\";\n\ndescribe(\"obliterate partial lengths\", () => {\n\tlet client: TestClient;\n\tlet refSeq: number;\n\tconst localClientId = 17;\n\tconst remoteClientId = 18;\n\n\tuseStrictPartialLengthChecks();\n\n\tbeforeEach(() => {\n\t\tclient = new TestClient({\n\t\t\tmergeTreeEnableObliterate: true,\n\t\t});\n\t\tclient.startOrUpdateCollaboration(\"local\");\n\t\tfor (const char of \"hello world\") {\n\t\t\tclient.applyMsg(\n\t\t\t\tclient.makeOpMessage(\n\t\t\t\t\tclient.insertTextLocal(client.getLength(), char),\n\t\t\t\t\tclient.getCurrentSeq() + 1,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tassert.equal(client.getText(), \"hello world\");\n\t\trefSeq = client.getCurrentSeq();\n\t});\n\n\tit(\"removes text\", () => {\n\t\tassert.equal(client.getText(), \"hello world\");\n\t\tconst localObliterateOp = client.obliterateRangeLocal(0, \"hello world\".length);\n\t\tassert.equal(client.getText(), \"\");\n\n\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t{ seq: refSeq, len: \"hello world\".length, localSeq: refSeq },\n\t\t\t{ seq: refSeq + 1, len: \"\".length, localSeq: refSeq + 1 },\n\t\t]);\n\n\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 1));\n\n\t\tvalidatePartialLengths(remoteClientId, client.mergeTree, [\n\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t{ seq: refSeq + 1, len: \"\".length },\n\t\t]);\n\t});\n\n\tit(\"correctly applies local remove after local obliterate\", () => {\n\t\tconst localObliterateOp = client.obliterateRangeLocal(0, \"hello \".length);\n\t\tconst localRemoveOp = client.removeRangeLocal(0, \"world\".length);\n\n\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t{ seq: refSeq + 1, len: \"world\".length, localSeq: refSeq + 1 },\n\t\t\t{ seq: refSeq + 2, len: \"\".length, localSeq: refSeq + 2 },\n\t\t]);\n\n\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 1));\n\t\tclient.applyMsg(client.makeOpMessage(localRemoveOp, refSeq + 2));\n\n\t\tvalidatePartialLengths(remoteClientId, client.mergeTree, [\n\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t{ seq: refSeq + 1, len: \"world\".length },\n\t\t\t{ seq: refSeq + 2, len: \"\".length },\n\t\t]);\n\t});\n\n\tit(\"is correct for different heights\", () => {\n\t\tclient = new TestClient({\n\t\t\tmergeTreeEnableObliterate: true,\n\t\t});\n\t\tclient.startOrUpdateCollaboration(\"local\");\n\n\t\tfor (let i = 0; i < 100; i++) {\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 0,\n\t\t\t\trefSeq: i,\n\t\t\t\tclientId: localClientId,\n\t\t\t\tseq: i + 1,\n\t\t\t\ttext: \"a\",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [{ seq: i + 1, len: i + 1 }]);\n\t\t\tvalidatePartialLengths(remoteClientId, client.mergeTree, [{ seq: i + 1, len: i + 1 }]);\n\n\t\t\trefSeq += 1;\n\t\t}\n\n\t\tconst localObliterateOp = client.obliterateRangeLocal(50, 100);\n\n\t\tvalidatePartialLengths(localClientId, client.mergeTree);\n\n\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 1));\n\n\t\tvalidatePartialLengths(remoteClientId, client.mergeTree);\n\t});\n\n\tdescribe(\"overlapping remove+obliterate\", () => {\n\t\tit(\"passes for local remove and remote obliterate\", () => {\n\t\t\tconst localRemoveOp = client.removeRangeLocal(0, \"hello \".length);\n\t\t\tclient.obliterateRange({\n\t\t\t\tstart: 0,\n\t\t\t\tend: \"hello \".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length, localSeq: refSeq },\n\t\t\t\t{ seq: refSeq + 1, len: \"world\".length, localSeq: refSeq + 1 },\n\t\t\t]);\n\n\t\t\tclient.applyMsg(client.makeOpMessage(localRemoveOp, refSeq + 1));\n\n\t\t\tvalidatePartialLengths(\n\t\t\t\tremoteClientId,\n\t\t\t\tclient.mergeTree,\n\t\t\t\t[\n\t\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 1, len: \"world\".length, localSeq: refSeq + 1 },\n\t\t\t\t],\n\t\t\t\trefSeq,\n\t\t\t);\n\t\t});\n\n\t\tit(\"passes for remote remove and local obliterate\", () => {\n\t\t\tclient.removeRangeRemote(\n\t\t\t\t0,\n\t\t\t\t\"hello \".length,\n\t\t\t\trefSeq + 1,\n\t\t\t\trefSeq,\n\t\t\t\tclient.getLongClientId(remoteClientId),\n\t\t\t);\n\t\t\tconst localObliterateOp = client.obliterateRangeLocal(0, \"hello \".length);\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length, localSeq: refSeq },\n\t\t\t\t{ seq: refSeq + 1, len: \"world\".length, localSeq: refSeq + 1 },\n\t\t\t\t{ seq: refSeq + 2, len: \"world\".length, localSeq: refSeq + 2 },\n\t\t\t]);\n\n\t\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 2));\n\n\t\t\tvalidatePartialLengths(remoteClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 2, len: \"world\".length },\n\t\t\t]);\n\t\t});\n\n\t\tit(\"passes for remote remove and remote obliterate\", () => {\n\t\t\tclient.removeRangeRemote(\n\t\t\t\t0,\n\t\t\t\t\"hello \".length,\n\t\t\t\trefSeq + 1,\n\t\t\t\trefSeq,\n\t\t\t\tclient.getLongClientId(remoteClientId),\n\t\t\t);\n\t\t\tclient.obliterateRange({\n\t\t\t\tstart: 0,\n\t\t\t\tend: \"hello \".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 2, len: \"world\".length },\n\t\t\t]);\n\t\t\tvalidatePartialLengths(\n\t\t\t\tremoteClientId,\n\t\t\t\tclient.mergeTree,\n\t\t\t\t[\n\t\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 1, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 2, len: \"world\".length },\n\t\t\t\t],\n\t\t\t\t0,\n\t\t\t);\n\t\t\tvalidatePartialLengths(\n\t\t\t\tremoteClientId + 1,\n\t\t\t\tclient.mergeTree,\n\t\t\t\t[\n\t\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 1, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 2, len: \"world\".length },\n\t\t\t\t],\n\t\t\t\t0,\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe(\"overlapping obliterate+obliterate\", () => {\n\t\tit(\"passes for local obliterate and remote obliterate\", () => {\n\t\t\tconst localObliterateOp = client.obliterateRangeLocal(0, \"hello \".length);\n\t\t\tclient.obliterateRange({\n\t\t\t\tstart: 0,\n\t\t\t\tend: \"hello \".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"world\".length },\n\t\t\t\t{ seq: refSeq + 2, len: \"world\".length },\n\t\t\t]);\n\n\t\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 2));\n\n\t\t\tvalidatePartialLengths(\n\t\t\t\tremoteClientId,\n\t\t\t\tclient.mergeTree,\n\t\t\t\t[\n\t\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 1, len: \"world\".length, localSeq: refSeq + 1 },\n\t\t\t\t\t{ seq: refSeq + 2, len: \"world\".length, localSeq: refSeq + 2 },\n\t\t\t\t],\n\t\t\t\trefSeq,\n\t\t\t);\n\t\t});\n\n\t\tit(\"passes for remote obliterate and local obliterate\", () => {\n\t\t\tclient.obliterateRange({\n\t\t\t\tstart: 0,\n\t\t\t\tend: \"hello \".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tconst localObliterateOp = client.obliterateRangeLocal(0, \"hello\".length);\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"world\".length },\n\t\t\t\t{ seq: refSeq + 2, len: \"world\".length },\n\t\t\t]);\n\n\t\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 2));\n\n\t\t\tvalidatePartialLengths(\n\t\t\t\tremoteClientId,\n\t\t\t\tclient.mergeTree,\n\t\t\t\t[\n\t\t\t\t\t{ seq: refSeq, len: \"hello world\".length, localSeq: refSeq },\n\t\t\t\t\t{ seq: refSeq + 1, len: \"world\".length, localSeq: refSeq + 1 },\n\t\t\t\t\t{ seq: refSeq + 2, len: \"\".length, localSeq: refSeq + 2 },\n\t\t\t\t],\n\t\t\t\trefSeq,\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe(\"obliterate with concurrent inserts\", () => {\n\t\tit(\"obliterates when concurrent insert in middle of string\", () => {\n\t\t\tconst localObliterateOp = client.obliterateRangeLocal(0, client.getLength());\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: \"hello\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"hellomore world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"\".length, localSeq: refSeq + 1 },\n\t\t\t]);\n\n\t\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 2));\n\n\t\t\tvalidatePartialLengths(\n\t\t\t\tremoteClientId,\n\t\t\t\tclient.mergeTree,\n\t\t\t\t[\n\t\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 1, len: \"hellomore world\".length },\n\t\t\t\t\t{ seq: refSeq + 2, len: \"\".length, localSeq: refSeq + 2 },\n\t\t\t\t],\n\t\t\t\trefSeq,\n\t\t\t);\n\t\t});\n\n\t\tit(\"obliterate does not affect concurrent insert at start of string\", () => {\n\t\t\tconst localObliterateOp = client.obliterateRangeLocal(0, client.getLength());\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 0,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"more \");\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"more hello world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"more \".length, localSeq: refSeq + 1 },\n\t\t\t]);\n\n\t\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 2));\n\n\t\t\tvalidatePartialLengths(\n\t\t\t\tremoteClientId,\n\t\t\t\tclient.mergeTree,\n\t\t\t\t[\n\t\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 1, len: \"more hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 2, len: \"more \".length },\n\t\t\t\t],\n\t\t\t\trefSeq,\n\t\t\t);\n\t\t});\n\n\t\tit(\"obliterate does not affect concurrent insert at end of string\", () => {\n\t\t\tconst localObliterateOp = client.obliterateRangeLocal(0, client.getLength());\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: \"hello world\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"more \");\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"hello worldmore \".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"more \".length, localSeq: refSeq + 1 },\n\t\t\t]);\n\n\t\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 2));\n\n\t\t\tvalidatePartialLengths(\n\t\t\t\tremoteClientId,\n\t\t\t\tclient.mergeTree,\n\t\t\t\t[\n\t\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 1, len: \"hello worldmore \".length },\n\t\t\t\t\t{ seq: refSeq + 2, len: \"more \".length },\n\t\t\t\t],\n\t\t\t\trefSeq,\n\t\t\t);\n\t\t});\n\t});\n});\n"]}
|
|
1
|
+
{"version":3,"file":"obliterate.partialLength.spec.js","sourceRoot":"","sources":["../../src/test/obliterate.partialLength.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,6CAA+C;AAE/C,sCAA+C;AAE/C,mDAA6C;AAC7C,iDAKwB;AAExB,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC3C,IAAI,MAAkB,CAAC;IACvB,IAAI,MAAc,CAAC;IACnB,MAAM,aAAa,GAAG,EAAE,CAAC;IACzB,MAAM,cAAc,GAAG,EAAE,CAAC;IAE1B,IAAA,2CAA4B,GAAE,CAAC;IAE/B,UAAU,CAAC,GAAG,EAAE;QACf,MAAM,GAAG,IAAI,0BAAU,CAAC;YACvB,yBAAyB,EAAE,IAAI;SAC/B,CAAC,CAAC;QACH,MAAM,CAAC,0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n\nimport { strict as assert } from \"node:assert\";\n\nimport { MergeTreeDeltaType } from \"../ops.js\";\n\nimport { TestClient } from \"./testClient.js\";\nimport {\n\tinsertText,\n\tobliterateRange,\n\tuseStrictPartialLengthChecks,\n\tvalidatePartialLengths,\n} from \"./testUtils.js\";\n\ndescribe(\"obliterate partial lengths\", () => {\n\tlet client: TestClient;\n\tlet refSeq: number;\n\tconst localClientId = 17;\n\tconst remoteClientId = 18;\n\n\tuseStrictPartialLengthChecks();\n\n\tbeforeEach(() => {\n\t\tclient = new TestClient({\n\t\t\tmergeTreeEnableObliterate: true,\n\t\t});\n\t\tclient.startOrUpdateCollaboration(\"local\");\n\t\tfor (const char of \"hello world\") {\n\t\t\tclient.applyMsg(\n\t\t\t\tclient.makeOpMessage(\n\t\t\t\t\tclient.insertTextLocal(client.getLength(), char),\n\t\t\t\t\tclient.getCurrentSeq() + 1,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tassert.equal(client.getText(), \"hello world\");\n\t\trefSeq = client.getCurrentSeq();\n\t});\n\n\tit(\"removes text\", () => {\n\t\tassert.equal(client.getText(), \"hello world\");\n\t\tconst localObliterateOp = client.obliterateRangeLocal(0, \"hello world\".length);\n\t\tassert.equal(client.getText(), \"\");\n\n\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t{ seq: refSeq, len: \"hello world\".length, localSeq: refSeq },\n\t\t\t{ seq: refSeq + 1, len: \"\".length, localSeq: refSeq + 1 },\n\t\t]);\n\n\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 1));\n\n\t\tvalidatePartialLengths(remoteClientId, client.mergeTree, [\n\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t{ seq: refSeq + 1, len: \"\".length },\n\t\t]);\n\t});\n\n\tit(\"correctly applies local remove after local obliterate\", () => {\n\t\tconst localObliterateOp = client.obliterateRangeLocal(0, \"hello \".length);\n\t\tconst localRemoveOp = client.removeRangeLocal(0, \"world\".length);\n\n\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t{ seq: refSeq + 1, len: \"world\".length, localSeq: refSeq + 1 },\n\t\t\t{ seq: refSeq + 2, len: \"\".length, localSeq: refSeq + 2 },\n\t\t]);\n\n\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 1));\n\t\tclient.applyMsg(client.makeOpMessage(localRemoveOp, refSeq + 2));\n\n\t\tvalidatePartialLengths(remoteClientId, client.mergeTree, [\n\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t{ seq: refSeq + 1, len: \"world\".length },\n\t\t\t{ seq: refSeq + 2, len: \"\".length },\n\t\t]);\n\t});\n\n\tit(\"is correct for different heights\", () => {\n\t\tclient = new TestClient({\n\t\t\tmergeTreeEnableObliterate: true,\n\t\t});\n\t\tclient.startOrUpdateCollaboration(\"local\");\n\n\t\tfor (let i = 0; i < 100; i++) {\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 0,\n\t\t\t\trefSeq: i,\n\t\t\t\tclientId: localClientId,\n\t\t\t\tseq: i + 1,\n\t\t\t\ttext: \"a\",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [{ seq: i + 1, len: i + 1 }]);\n\t\t\tvalidatePartialLengths(remoteClientId, client.mergeTree, [{ seq: i + 1, len: i + 1 }]);\n\n\t\t\trefSeq += 1;\n\t\t}\n\n\t\tconst localObliterateOp = client.obliterateRangeLocal(50, 100);\n\n\t\tvalidatePartialLengths(localClientId, client.mergeTree);\n\n\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 1));\n\n\t\tvalidatePartialLengths(remoteClientId, client.mergeTree);\n\t});\n\n\tdescribe(\"overlapping remove+obliterate\", () => {\n\t\tit(\"passes for local remove and remote obliterate\", () => {\n\t\t\tconst localRemoveOp = client.removeRangeLocal(0, \"hello \".length);\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: \"hello \".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length, localSeq: refSeq },\n\t\t\t\t{ seq: refSeq + 1, len: \"world\".length, localSeq: refSeq + 1 },\n\t\t\t]);\n\n\t\t\tclient.applyMsg(client.makeOpMessage(localRemoveOp, refSeq + 1));\n\n\t\t\tvalidatePartialLengths(\n\t\t\t\tremoteClientId,\n\t\t\t\tclient.mergeTree,\n\t\t\t\t[\n\t\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 1, len: \"world\".length, localSeq: refSeq + 1 },\n\t\t\t\t],\n\t\t\t\trefSeq,\n\t\t\t);\n\t\t});\n\n\t\tit(\"passes for remote remove and local obliterate\", () => {\n\t\t\tclient.removeRangeRemote(\n\t\t\t\t0,\n\t\t\t\t\"hello \".length,\n\t\t\t\trefSeq + 1,\n\t\t\t\trefSeq,\n\t\t\t\tclient.getLongClientId(remoteClientId),\n\t\t\t);\n\t\t\tconst localObliterateOp = client.obliterateRangeLocal(0, \"hello \".length);\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length, localSeq: refSeq },\n\t\t\t\t{ seq: refSeq + 1, len: \"world\".length, localSeq: refSeq + 1 },\n\t\t\t\t{ seq: refSeq + 2, len: \"world\".length, localSeq: refSeq + 2 },\n\t\t\t]);\n\n\t\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 2));\n\n\t\t\tvalidatePartialLengths(remoteClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 2, len: \"world\".length },\n\t\t\t]);\n\t\t});\n\n\t\tit(\"passes for remote remove and remote obliterate\", () => {\n\t\t\tclient.removeRangeRemote(\n\t\t\t\t0,\n\t\t\t\t\"hello \".length,\n\t\t\t\trefSeq + 1,\n\t\t\t\trefSeq,\n\t\t\t\tclient.getLongClientId(remoteClientId),\n\t\t\t);\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: \"hello \".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 2, len: \"world\".length },\n\t\t\t]);\n\t\t\tvalidatePartialLengths(\n\t\t\t\tremoteClientId,\n\t\t\t\tclient.mergeTree,\n\t\t\t\t[\n\t\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 1, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 2, len: \"world\".length },\n\t\t\t\t],\n\t\t\t\t0,\n\t\t\t);\n\t\t\tvalidatePartialLengths(\n\t\t\t\tremoteClientId + 1,\n\t\t\t\tclient.mergeTree,\n\t\t\t\t[\n\t\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 1, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 2, len: \"world\".length },\n\t\t\t\t],\n\t\t\t\t0,\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe(\"overlapping obliterate+obliterate\", () => {\n\t\tit(\"passes for local obliterate and remote obliterate\", () => {\n\t\t\tconst localObliterateOp = client.obliterateRangeLocal(0, \"hello \".length);\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: \"hello \".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"world\".length },\n\t\t\t\t{ seq: refSeq + 2, len: \"world\".length },\n\t\t\t]);\n\n\t\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 2));\n\n\t\t\tvalidatePartialLengths(\n\t\t\t\tremoteClientId,\n\t\t\t\tclient.mergeTree,\n\t\t\t\t[\n\t\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 1, len: \"world\".length, localSeq: refSeq + 1 },\n\t\t\t\t\t{ seq: refSeq + 2, len: \"world\".length, localSeq: refSeq + 2 },\n\t\t\t\t],\n\t\t\t\trefSeq,\n\t\t\t);\n\t\t});\n\n\t\tit(\"passes for remote obliterate and local obliterate\", () => {\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: \"hello \".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tconst localObliterateOp = client.obliterateRangeLocal(0, \"hello\".length);\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"world\".length },\n\t\t\t\t{ seq: refSeq + 2, len: \"world\".length },\n\t\t\t]);\n\n\t\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 2));\n\n\t\t\tvalidatePartialLengths(\n\t\t\t\tremoteClientId,\n\t\t\t\tclient.mergeTree,\n\t\t\t\t[\n\t\t\t\t\t{ seq: refSeq, len: \"hello world\".length, localSeq: refSeq },\n\t\t\t\t\t{ seq: refSeq + 1, len: \"world\".length, localSeq: refSeq + 1 },\n\t\t\t\t\t{ seq: refSeq + 2, len: \"\".length, localSeq: refSeq + 2 },\n\t\t\t\t],\n\t\t\t\trefSeq,\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe(\"obliterate with concurrent inserts\", () => {\n\t\tit(\"obliterates when concurrent insert in middle of string\", () => {\n\t\t\tconst localObliterateOp = client.obliterateRangeLocal(0, client.getLength());\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: \"hello\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"hellomore world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"\".length, localSeq: refSeq + 1 },\n\t\t\t]);\n\n\t\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 2));\n\n\t\t\tvalidatePartialLengths(\n\t\t\t\tremoteClientId,\n\t\t\t\tclient.mergeTree,\n\t\t\t\t[\n\t\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 1, len: \"hellomore world\".length },\n\t\t\t\t\t{ seq: refSeq + 2, len: \"\".length, localSeq: refSeq + 2 },\n\t\t\t\t],\n\t\t\t\trefSeq,\n\t\t\t);\n\t\t});\n\n\t\tit(\"obliterate does not affect concurrent insert at start of string\", () => {\n\t\t\tconst localObliterateOp = client.obliterateRangeLocal(0, client.getLength());\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 0,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"more \");\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"more hello world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"more \".length, localSeq: refSeq + 1 },\n\t\t\t]);\n\n\t\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 2));\n\n\t\t\tvalidatePartialLengths(\n\t\t\t\tremoteClientId,\n\t\t\t\tclient.mergeTree,\n\t\t\t\t[\n\t\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 1, len: \"more hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 2, len: \"more \".length },\n\t\t\t\t],\n\t\t\t\trefSeq,\n\t\t\t);\n\t\t});\n\n\t\tit(\"obliterate does not affect concurrent insert at end of string\", () => {\n\t\t\tconst localObliterateOp = client.obliterateRangeLocal(0, client.getLength());\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: \"hello world\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"more \");\n\n\t\t\tvalidatePartialLengths(localClientId, client.mergeTree, [\n\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"hello worldmore \".length },\n\t\t\t\t{ seq: refSeq + 1, len: \"more \".length, localSeq: refSeq + 1 },\n\t\t\t]);\n\n\t\t\tclient.applyMsg(client.makeOpMessage(localObliterateOp, refSeq + 2));\n\n\t\t\tvalidatePartialLengths(\n\t\t\t\tremoteClientId,\n\t\t\t\tclient.mergeTree,\n\t\t\t\t[\n\t\t\t\t\t{ seq: refSeq, len: \"hello world\".length },\n\t\t\t\t\t{ seq: refSeq + 1, len: \"hello worldmore \".length },\n\t\t\t\t\t{ seq: refSeq + 2, len: \"more \".length },\n\t\t\t\t],\n\t\t\t\trefSeq,\n\t\t\t);\n\t\t});\n\t});\n});\n"]}
|
|
@@ -30,7 +30,8 @@ describe("obliterate", () => {
|
|
|
30
30
|
});
|
|
31
31
|
describe("concurrent obliterate and insert", () => {
|
|
32
32
|
it("removes text for obliterate then insert", () => {
|
|
33
|
-
|
|
33
|
+
(0, testUtils_js_1.obliterateRange)({
|
|
34
|
+
mergeTree: client.mergeTree,
|
|
34
35
|
start: 0,
|
|
35
36
|
end: client.getLength(),
|
|
36
37
|
refSeq,
|
|
@@ -62,7 +63,8 @@ describe("obliterate", () => {
|
|
|
62
63
|
props: undefined,
|
|
63
64
|
opArgs: { op: { type: ops_js_1.MergeTreeDeltaType.INSERT } },
|
|
64
65
|
});
|
|
65
|
-
|
|
66
|
+
(0, testUtils_js_1.obliterateRange)({
|
|
67
|
+
mergeTree: client.mergeTree,
|
|
66
68
|
start: 0,
|
|
67
69
|
end: "hello world".length,
|
|
68
70
|
refSeq,
|
|
@@ -84,7 +86,8 @@ describe("obliterate", () => {
|
|
|
84
86
|
props: undefined,
|
|
85
87
|
opArgs: { op: { type: ops_js_1.MergeTreeDeltaType.INSERT } },
|
|
86
88
|
});
|
|
87
|
-
|
|
89
|
+
(0, testUtils_js_1.obliterateRange)({
|
|
90
|
+
mergeTree: client.mergeTree,
|
|
88
91
|
start: 1,
|
|
89
92
|
end: "hello world".length,
|
|
90
93
|
refSeq,
|
|
@@ -98,7 +101,8 @@ describe("obliterate", () => {
|
|
|
98
101
|
});
|
|
99
102
|
describe("endpoint behavior", () => {
|
|
100
103
|
it("does not expand to include text inserted at start", () => {
|
|
101
|
-
|
|
104
|
+
(0, testUtils_js_1.obliterateRange)({
|
|
105
|
+
mergeTree: client.mergeTree,
|
|
102
106
|
start: 5,
|
|
103
107
|
end: "hello world".length,
|
|
104
108
|
refSeq,
|
|
@@ -120,7 +124,8 @@ describe("obliterate", () => {
|
|
|
120
124
|
node_assert_1.strict.equal(client.getText(), "helloXXX");
|
|
121
125
|
});
|
|
122
126
|
it("does not expand to include text inserted at end", () => {
|
|
123
|
-
|
|
127
|
+
(0, testUtils_js_1.obliterateRange)({
|
|
128
|
+
mergeTree: client.mergeTree,
|
|
124
129
|
start: 0,
|
|
125
130
|
end: "hello".length,
|
|
126
131
|
refSeq,
|
|
@@ -166,7 +171,8 @@ describe("obliterate", () => {
|
|
|
166
171
|
const obliterateEnd = client.getLength();
|
|
167
172
|
const startSeg = client.getContainingSegment(obliterateStart);
|
|
168
173
|
const endSeg = client.getContainingSegment(obliterateEnd);
|
|
169
|
-
|
|
174
|
+
(0, testUtils_js_1.obliterateRange)({
|
|
175
|
+
mergeTree: client.mergeTree,
|
|
170
176
|
start: obliterateStart,
|
|
171
177
|
end: obliterateEnd,
|
|
172
178
|
refSeq,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obliterate.spec.js","sourceRoot":"","sources":["../../src/test/obliterate.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,6CAA+C;AAG/C,sCAA+C;AAE/C,mDAA6C;AAC7C,iDAA4C;AAE5C,QAAQ,CAAC,YAA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,CAAC,CAAC,GAAG,EAAE,EAAE;gBACnD,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,EAAE,UAA4B,CAAC;gBAC9D,IAAA,oBAAM,EAAC,QAAQ,CAAC,KAAK,KAAK,SAAS,EAAE,6BAA6B,CAAC,CAAC;YACrE,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,GAAG,EAAE,EAAE;gBACjD,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,EAAE,UAA4B,CAAC;gBAC9D,IAAA,oBAAM,EAAC,QAAQ,CAAC,GAAG,KAAK,SAAS,EAAE,2BAA2B,CAAC,CAAC;YACjE,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport type { ObliterateInfo } from \"../mergeTreeNodes.js\";\nimport { MergeTreeDeltaType } from \"../ops.js\";\n\nimport { TestClient } from \"./testClient.js\";\nimport { insertText } from \"./testUtils.js\";\n\ndescribe(\"obliterate\", () => {\n\tlet client: TestClient;\n\tlet refSeq: number;\n\tconst localClientId = 17;\n\tconst remoteClientId = localClientId + 1;\n\n\tbeforeEach(() => {\n\t\tclient = new TestClient({\n\t\t\tmergeTreeEnableObliterate: true,\n\t\t});\n\t\tclient.startOrUpdateCollaboration(\"local\");\n\t\tfor (const char of \"hello world\") {\n\t\t\tclient.applyMsg(\n\t\t\t\tclient.makeOpMessage(\n\t\t\t\t\tclient.insertTextLocal(client.getLength(), char),\n\t\t\t\t\tclient.getCurrentSeq() + 1,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tassert.equal(client.getText(), \"hello world\");\n\t\trefSeq = client.getCurrentSeq();\n\t});\n\n\tit(\"removes text\", () => {\n\t\tclient.obliterateRangeLocal(0, client.getLength());\n\t\tassert.equal(client.getText(), \"\");\n\t});\n\n\tdescribe(\"concurrent obliterate and insert\", () => {\n\t\tit(\"removes text for obliterate then insert\", () => {\n\t\t\tclient.obliterateRange({\n\t\t\t\tstart: 0,\n\t\t\t\tend: client.getLength(),\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 1,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\t\t});\n\t\tit(\"removes text for insert then obliterate when deleting entire string\", () => {\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 1,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tclient.obliterateRange({\n\t\t\t\tstart: 0,\n\t\t\t\tend: \"hello world\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\t\t});\n\t\tit(\"removes text for insert then obliterate\", () => {\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 5,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tclient.obliterateRange({\n\t\t\t\tstart: 1,\n\t\t\t\tend: \"hello world\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"h\");\n\t\t});\n\t});\n\n\tdescribe(\"endpoint behavior\", () => {\n\t\tit(\"does not expand to include text inserted at start\", () => {\n\t\t\tclient.obliterateRange({\n\t\t\t\tstart: 5,\n\t\t\t\tend: \"hello world\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 5,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"XXX\",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"helloXXX\");\n\t\t});\n\t\tit(\"does not expand to include text inserted at end\", () => {\n\t\t\tclient.obliterateRange({\n\t\t\t\tstart: 0,\n\t\t\t\tend: \"hello\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 5,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"XXX\",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"XXX world\");\n\t\t});\n\t});\n\n\tdescribe(\"local obliterate with concurrent inserts\", () => {\n\t\tit(\"removes range when pending local obliterate op\", () => {\n\t\t\tclient.obliterateRangeLocal(0, \"hello world\".length);\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 1,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"XXX\",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\t\t});\n\t});\n\n\tdescribe(\"local references\", () => {\n\t\tit(\"cleans up local references once the collab window advances enough\", () => {\n\t\t\tconst client2 = new TestClient({ mergeTreeEnableObliterate: true });\n\t\t\tclient2.startOrUpdateCollaboration(\"client2\");\n\n\t\t\tconst obliterateStart = 0;\n\t\t\tconst obliterateEnd = client.getLength();\n\t\t\tconst startSeg = client.getContainingSegment(obliterateStart);\n\t\t\tconst endSeg = client.getContainingSegment(obliterateEnd);\n\t\t\tclient.obliterateRange({\n\t\t\t\tstart: obliterateStart,\n\t\t\t\tend: obliterateEnd,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 1,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\n\t\t\tstartSeg.segment?.localRefs?.walkReferences((ref) => {\n\t\t\t\tconst oblProps = ref.properties?.obliterate as ObliterateInfo | undefined;\n\t\t\t\tassert(oblProps?.start !== undefined, \"start ref should NOT be removed\");\n\t\t\t});\n\t\t\tendSeg.segment?.localRefs?.walkReferences((ref) => {\n\t\t\t\tconst oblProps = ref.properties?.obliterate as ObliterateInfo | undefined;\n\t\t\t\tassert(oblProps?.end !== undefined, \"end ref should NOT be removed\");\n\t\t\t});\n\n\t\t\t// this will force Zamboni to run\n\t\t\tlet seq = refSeq;\n\t\t\tfor (let i = 0; i < 5; i++) {\n\t\t\t\tconst insert = client.makeOpMessage(\n\t\t\t\t\tclient.insertTextLocal(client.getLength(), i.toString()),\n\t\t\t\t\t++seq,\n\t\t\t\t);\n\t\t\t\tinsert.minimumSequenceNumber = seq - 1;\n\t\t\t\tclient.applyMsg(insert);\n\t\t\t\tclient2.applyMsg(insert);\n\t\t\t}\n\n\t\t\t// want to check that the start and end segment don't have the obliterate refs on them\n\t\t\tstartSeg.segment?.localRefs?.walkReferences((ref) => {\n\t\t\t\tconst oblProps = ref.properties?.obliterate as ObliterateInfo;\n\t\t\t\tassert(oblProps.start === undefined, \"start ref should be removed\");\n\t\t\t});\n\t\t\tendSeg.segment?.localRefs?.walkReferences((ref) => {\n\t\t\t\tconst oblProps = ref.properties?.obliterate as ObliterateInfo;\n\t\t\t\tassert(oblProps.end === undefined, \"end ref should be removed\");\n\t\t\t});\n\t\t});\n\t});\n});\n"]}
|
|
1
|
+
{"version":3,"file":"obliterate.spec.js","sourceRoot":"","sources":["../../src/test/obliterate.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,6CAA+C;AAG/C,sCAA+C;AAE/C,mDAA6C;AAC7C,iDAA6D;AAE7D,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC3B,IAAI,MAAkB,CAAC;IACvB,IAAI,MAAc,CAAC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gBACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC1B,CAAC;YAED,sFAAsF;YACtF,QAAQ,CAAC,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,GAAG,EAAE,EAAE;gBACnD,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,EAAE,UAA4B,CAAC;gBAC9D,IAAA,oBAAM,EAAC,QAAQ,CAAC,KAAK,KAAK,SAAS,EAAE,6BAA6B,CAAC,CAAC;YACrE,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,GAAG,EAAE,EAAE;gBACjD,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,EAAE,UAA4B,CAAC;gBAC9D,IAAA,oBAAM,EAAC,QAAQ,CAAC,GAAG,KAAK,SAAS,EAAE,2BAA2B,CAAC,CAAC;YACjE,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport type { ObliterateInfo } from \"../mergeTreeNodes.js\";\nimport { MergeTreeDeltaType } from \"../ops.js\";\n\nimport { TestClient } from \"./testClient.js\";\nimport { insertText, obliterateRange } from \"./testUtils.js\";\n\ndescribe(\"obliterate\", () => {\n\tlet client: TestClient;\n\tlet refSeq: number;\n\tconst localClientId = 17;\n\tconst remoteClientId = localClientId + 1;\n\n\tbeforeEach(() => {\n\t\tclient = new TestClient({\n\t\t\tmergeTreeEnableObliterate: true,\n\t\t});\n\t\tclient.startOrUpdateCollaboration(\"local\");\n\t\tfor (const char of \"hello world\") {\n\t\t\tclient.applyMsg(\n\t\t\t\tclient.makeOpMessage(\n\t\t\t\t\tclient.insertTextLocal(client.getLength(), char),\n\t\t\t\t\tclient.getCurrentSeq() + 1,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tassert.equal(client.getText(), \"hello world\");\n\t\trefSeq = client.getCurrentSeq();\n\t});\n\n\tit(\"removes text\", () => {\n\t\tclient.obliterateRangeLocal(0, client.getLength());\n\t\tassert.equal(client.getText(), \"\");\n\t});\n\n\tdescribe(\"concurrent obliterate and insert\", () => {\n\t\tit(\"removes text for obliterate then insert\", () => {\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: client.getLength(),\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 1,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\t\t});\n\t\tit(\"removes text for insert then obliterate when deleting entire string\", () => {\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 1,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: \"hello world\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\t\t});\n\t\tit(\"removes text for insert then obliterate\", () => {\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 5,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 1,\n\t\t\t\tend: \"hello world\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"h\");\n\t\t});\n\t});\n\n\tdescribe(\"endpoint behavior\", () => {\n\t\tit(\"does not expand to include text inserted at start\", () => {\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 5,\n\t\t\t\tend: \"hello world\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 5,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"XXX\",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"helloXXX\");\n\t\t});\n\t\tit(\"does not expand to include text inserted at end\", () => {\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: \"hello\".length,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 5,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"XXX\",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"XXX world\");\n\t\t});\n\t});\n\n\tdescribe(\"local obliterate with concurrent inserts\", () => {\n\t\tit(\"removes range when pending local obliterate op\", () => {\n\t\t\tclient.obliterateRangeLocal(0, \"hello world\".length);\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 1,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"XXX\",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\t\t});\n\t});\n\n\tdescribe(\"local references\", () => {\n\t\tit(\"cleans up local references once the collab window advances enough\", () => {\n\t\t\tconst client2 = new TestClient({ mergeTreeEnableObliterate: true });\n\t\t\tclient2.startOrUpdateCollaboration(\"client2\");\n\n\t\t\tconst obliterateStart = 0;\n\t\t\tconst obliterateEnd = client.getLength();\n\t\t\tconst startSeg = client.getContainingSegment(obliterateStart);\n\t\t\tconst endSeg = client.getContainingSegment(obliterateEnd);\n\t\t\tobliterateRange({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tstart: obliterateStart,\n\t\t\t\tend: obliterateEnd,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId,\n\t\t\t\tseq: refSeq + 1,\n\t\t\t\toverwrite: false,\n\t\t\t\topArgs: undefined as never,\n\t\t\t});\n\t\t\tinsertText({\n\t\t\t\tmergeTree: client.mergeTree,\n\t\t\t\tpos: 1,\n\t\t\t\trefSeq,\n\t\t\t\tclientId: remoteClientId + 1,\n\t\t\t\tseq: refSeq + 2,\n\t\t\t\ttext: \"more \",\n\t\t\t\tprops: undefined,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.INSERT } },\n\t\t\t});\n\t\t\tassert.equal(client.getText(), \"\");\n\n\t\t\tstartSeg.segment?.localRefs?.walkReferences((ref) => {\n\t\t\t\tconst oblProps = ref.properties?.obliterate as ObliterateInfo;\n\t\t\t\tassert(oblProps?.start !== undefined, \"start ref should NOT be removed\");\n\t\t\t});\n\t\t\tendSeg.segment?.localRefs?.walkReferences((ref) => {\n\t\t\t\tconst oblProps = ref.properties?.obliterate as ObliterateInfo;\n\t\t\t\tassert(oblProps?.end !== undefined, \"end ref should NOT be removed\");\n\t\t\t});\n\n\t\t\t// this will force Zamboni to run\n\t\t\tlet seq = refSeq;\n\t\t\tfor (let i = 0; i < 5; i++) {\n\t\t\t\tconst insert = client.makeOpMessage(\n\t\t\t\t\tclient.insertTextLocal(client.getLength(), i.toString()),\n\t\t\t\t\t++seq,\n\t\t\t\t);\n\t\t\t\tinsert.minimumSequenceNumber = seq - 1;\n\t\t\t\tclient.applyMsg(insert);\n\t\t\t\tclient2.applyMsg(insert);\n\t\t\t}\n\n\t\t\t// want to check that the start and end segment don't have the obliterate refs on them\n\t\t\tstartSeg.segment?.localRefs?.walkReferences((ref) => {\n\t\t\t\tconst oblProps = ref.properties?.obliterate as ObliterateInfo;\n\t\t\t\tassert(oblProps.start === undefined, \"start ref should be removed\");\n\t\t\t});\n\t\t\tendSeg.segment?.localRefs?.walkReferences((ref) => {\n\t\t\t\tconst oblProps = ref.properties?.obliterate as ObliterateInfo;\n\t\t\t\tassert(oblProps.end === undefined, \"end ref should be removed\");\n\t\t\t});\n\t\t});\n\t});\n});\n"]}
|