@fluidframework/merge-tree 2.30.0 → 2.31.0
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/CHANGELOG.md +403 -399
- package/api-report/merge-tree.legacy.alpha.api.md +1 -0
- package/dist/MergeTreeTextHelper.d.ts +9 -3
- package/dist/MergeTreeTextHelper.d.ts.map +1 -1
- package/dist/MergeTreeTextHelper.js +5 -5
- package/dist/MergeTreeTextHelper.js.map +1 -1
- package/dist/client.d.ts +7 -13
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +136 -110
- package/dist/client.js.map +1 -1
- package/dist/endOfTreeSegment.d.ts +12 -8
- package/dist/endOfTreeSegment.d.ts.map +1 -1
- package/dist/endOfTreeSegment.js +2 -4
- package/dist/endOfTreeSegment.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/mergeTree.d.ts +37 -23
- package/dist/mergeTree.d.ts.map +1 -1
- package/dist/mergeTree.js +400 -483
- package/dist/mergeTree.js.map +1 -1
- package/dist/mergeTreeDeltaCallback.d.ts +4 -8
- package/dist/mergeTreeDeltaCallback.d.ts.map +1 -1
- package/dist/mergeTreeDeltaCallback.js.map +1 -1
- package/dist/mergeTreeNodes.d.ts +32 -10
- package/dist/mergeTreeNodes.d.ts.map +1 -1
- package/dist/mergeTreeNodes.js +43 -28
- package/dist/mergeTreeNodes.js.map +1 -1
- package/dist/partialLengths.d.ts +2 -2
- package/dist/partialLengths.d.ts.map +1 -1
- package/dist/partialLengths.js +181 -109
- package/dist/partialLengths.js.map +1 -1
- package/dist/perspective.d.ts +8 -27
- package/dist/perspective.d.ts.map +1 -1
- package/dist/perspective.js +7 -67
- package/dist/perspective.js.map +1 -1
- package/dist/revertibles.d.ts.map +1 -1
- package/dist/revertibles.js +2 -2
- package/dist/revertibles.js.map +1 -1
- package/dist/segmentInfos.d.ts +20 -106
- package/dist/segmentInfos.d.ts.map +1 -1
- package/dist/segmentInfos.js +28 -42
- package/dist/segmentInfos.js.map +1 -1
- package/dist/segmentPropertiesManager.d.ts +1 -14
- package/dist/segmentPropertiesManager.d.ts.map +1 -1
- package/dist/segmentPropertiesManager.js +3 -17
- package/dist/segmentPropertiesManager.js.map +1 -1
- package/dist/snapshotLoader.d.ts.map +1 -1
- package/dist/snapshotLoader.js +62 -19
- package/dist/snapshotLoader.js.map +1 -1
- package/dist/snapshotV1.d.ts.map +1 -1
- package/dist/snapshotV1.js +55 -24
- package/dist/snapshotV1.js.map +1 -1
- package/dist/snapshotlegacy.d.ts.map +1 -1
- package/dist/snapshotlegacy.js +6 -9
- package/dist/snapshotlegacy.js.map +1 -1
- package/dist/stamps.d.ts +1 -1
- package/dist/stamps.js +1 -1
- package/dist/stamps.js.map +1 -1
- package/dist/test/Insertion.perf.spec.js +6 -51
- package/dist/test/Insertion.perf.spec.js.map +1 -1
- package/dist/test/PartialLengths.perf.spec.js +18 -25
- package/dist/test/PartialLengths.perf.spec.js.map +1 -1
- package/dist/test/Removal.perf.spec.js +13 -41
- package/dist/test/Removal.perf.spec.js.map +1 -1
- package/dist/test/beastTest.spec.d.ts.map +1 -1
- package/dist/test/beastTest.spec.js +41 -66
- package/dist/test/beastTest.spec.js.map +1 -1
- package/dist/test/client.annotateMarker.spec.js +1 -11
- package/dist/test/client.annotateMarker.spec.js.map +1 -1
- package/dist/test/client.applyMsg.spec.js +14 -14
- package/dist/test/client.applyMsg.spec.js.map +1 -1
- package/dist/test/client.getPosition.spec.js +1 -1
- package/dist/test/client.getPosition.spec.js.map +1 -1
- package/dist/test/client.localReference.spec.js +1 -1
- package/dist/test/client.localReference.spec.js.map +1 -1
- package/dist/test/client.rollback.spec.js +49 -58
- package/dist/test/client.rollback.spec.js.map +1 -1
- package/dist/test/client.rollbackFarm.spec.js +1 -1
- package/dist/test/client.rollbackFarm.spec.js.map +1 -1
- package/dist/test/client.searchForMarker.spec.js +4 -21
- package/dist/test/client.searchForMarker.spec.js.map +1 -1
- package/dist/test/index.d.ts +2 -2
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +2 -6
- package/dist/test/index.js.map +1 -1
- package/dist/test/mergeTree.annotate.deltaCallback.spec.js +14 -59
- package/dist/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -1
- package/dist/test/mergeTree.annotate.spec.js +47 -63
- package/dist/test/mergeTree.annotate.spec.js.map +1 -1
- package/dist/test/mergeTree.insert.deltaCallback.spec.js +9 -62
- package/dist/test/mergeTree.insert.deltaCallback.spec.js.map +1 -1
- package/dist/test/mergeTree.insertingWalk.spec.js +59 -125
- package/dist/test/mergeTree.insertingWalk.spec.js.map +1 -1
- package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +12 -93
- package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
- package/dist/test/mergeTree.markRangeRemoved.spec.js +10 -7
- package/dist/test/mergeTree.markRangeRemoved.spec.js.map +1 -1
- package/dist/test/mergeTree.walk.spec.js +2 -14
- package/dist/test/mergeTree.walk.spec.js.map +1 -1
- package/dist/test/mergeTreeOperationRunner.js +2 -2
- package/dist/test/mergeTreeOperationRunner.js.map +1 -1
- package/dist/test/obliterate.concurrent.spec.js +18 -23
- package/dist/test/obliterate.concurrent.spec.js.map +1 -1
- package/dist/test/obliterate.partialLength.spec.js +166 -136
- package/dist/test/obliterate.partialLength.spec.js.map +1 -1
- package/dist/test/obliterate.spec.js +16 -126
- package/dist/test/obliterate.spec.js.map +1 -1
- package/dist/test/partialLength.spec.js +28 -196
- package/dist/test/partialLength.spec.js.map +1 -1
- package/dist/test/perspective.spec.js +34 -0
- package/dist/test/perspective.spec.js.map +1 -1
- package/dist/test/propertyManager.spec.js +1 -1
- package/dist/test/propertyManager.spec.js.map +1 -1
- package/dist/test/resetPendingSegmentsToOp.spec.js +0 -2
- package/dist/test/resetPendingSegmentsToOp.spec.js.map +1 -1
- package/dist/test/segmentGroupCollection.spec.js +10 -4
- package/dist/test/segmentGroupCollection.spec.js.map +1 -1
- package/dist/test/testClient.d.ts +1 -0
- package/dist/test/testClient.d.ts.map +1 -1
- package/dist/test/testClient.js +16 -26
- package/dist/test/testClient.js.map +1 -1
- package/dist/test/testClientLogger.d.ts.map +1 -1
- package/dist/test/testClientLogger.js +3 -10
- package/dist/test/testClientLogger.js.map +1 -1
- package/dist/test/testServer.d.ts +2 -1
- package/dist/test/testServer.d.ts.map +1 -1
- package/dist/test/testServer.js +7 -5
- package/dist/test/testServer.js.map +1 -1
- package/dist/test/testUtils.d.ts +36 -56
- package/dist/test/testUtils.d.ts.map +1 -1
- package/dist/test/testUtils.js +68 -77
- package/dist/test/testUtils.js.map +1 -1
- package/dist/test/text.d.ts +2 -2
- package/dist/test/text.d.ts.map +1 -1
- package/dist/test/text.js +5 -2
- package/dist/test/text.js.map +1 -1
- package/dist/textSegment.d.ts +0 -6
- package/dist/textSegment.d.ts.map +1 -1
- package/dist/textSegment.js.map +1 -1
- package/dist/zamboni.d.ts.map +1 -1
- package/dist/zamboni.js +53 -26
- package/dist/zamboni.js.map +1 -1
- package/lib/MergeTreeTextHelper.d.ts +9 -3
- package/lib/MergeTreeTextHelper.d.ts.map +1 -1
- package/lib/MergeTreeTextHelper.js +5 -5
- package/lib/MergeTreeTextHelper.js.map +1 -1
- package/lib/client.d.ts +7 -13
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +117 -116
- package/lib/client.js.map +1 -1
- package/lib/endOfTreeSegment.d.ts +12 -8
- package/lib/endOfTreeSegment.d.ts.map +1 -1
- package/lib/endOfTreeSegment.js +2 -4
- package/lib/endOfTreeSegment.js.map +1 -1
- package/lib/index.d.ts +6 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/mergeTree.d.ts +37 -23
- package/lib/mergeTree.d.ts.map +1 -1
- package/lib/mergeTree.js +381 -488
- package/lib/mergeTree.js.map +1 -1
- package/lib/mergeTreeDeltaCallback.d.ts +4 -8
- package/lib/mergeTreeDeltaCallback.d.ts.map +1 -1
- package/lib/mergeTreeDeltaCallback.js.map +1 -1
- package/lib/mergeTreeNodes.d.ts +32 -10
- package/lib/mergeTreeNodes.d.ts.map +1 -1
- package/lib/mergeTreeNodes.js +42 -29
- package/lib/mergeTreeNodes.js.map +1 -1
- package/lib/partialLengths.d.ts +2 -2
- package/lib/partialLengths.d.ts.map +1 -1
- package/lib/partialLengths.js +160 -111
- package/lib/partialLengths.js.map +1 -1
- package/lib/perspective.d.ts +8 -27
- package/lib/perspective.d.ts.map +1 -1
- package/lib/perspective.js +8 -68
- package/lib/perspective.js.map +1 -1
- package/lib/revertibles.d.ts.map +1 -1
- package/lib/revertibles.js +2 -2
- package/lib/revertibles.js.map +1 -1
- package/lib/segmentInfos.d.ts +20 -106
- package/lib/segmentInfos.d.ts.map +1 -1
- package/lib/segmentInfos.js +26 -37
- package/lib/segmentInfos.js.map +1 -1
- package/lib/segmentPropertiesManager.d.ts +1 -14
- package/lib/segmentPropertiesManager.d.ts.map +1 -1
- package/lib/segmentPropertiesManager.js +2 -16
- package/lib/segmentPropertiesManager.js.map +1 -1
- package/lib/snapshotLoader.d.ts.map +1 -1
- package/lib/snapshotLoader.js +39 -19
- package/lib/snapshotLoader.js.map +1 -1
- package/lib/snapshotV1.d.ts.map +1 -1
- package/lib/snapshotV1.js +34 -26
- package/lib/snapshotV1.js.map +1 -1
- package/lib/snapshotlegacy.d.ts.map +1 -1
- package/lib/snapshotlegacy.js +7 -10
- package/lib/snapshotlegacy.js.map +1 -1
- package/lib/stamps.d.ts +1 -1
- package/lib/stamps.js +1 -1
- package/lib/stamps.js.map +1 -1
- package/lib/test/Insertion.perf.spec.js +6 -51
- package/lib/test/Insertion.perf.spec.js.map +1 -1
- package/lib/test/PartialLengths.perf.spec.js +18 -25
- package/lib/test/PartialLengths.perf.spec.js.map +1 -1
- package/lib/test/Removal.perf.spec.js +13 -41
- package/lib/test/Removal.perf.spec.js.map +1 -1
- package/lib/test/beastTest.spec.d.ts.map +1 -1
- package/lib/test/beastTest.spec.js +42 -67
- package/lib/test/beastTest.spec.js.map +1 -1
- package/lib/test/client.annotateMarker.spec.js +1 -11
- package/lib/test/client.annotateMarker.spec.js.map +1 -1
- package/lib/test/client.applyMsg.spec.js +14 -14
- package/lib/test/client.applyMsg.spec.js.map +1 -1
- package/lib/test/client.getPosition.spec.js +1 -1
- package/lib/test/client.getPosition.spec.js.map +1 -1
- package/lib/test/client.localReference.spec.js +1 -1
- package/lib/test/client.localReference.spec.js.map +1 -1
- package/lib/test/client.rollback.spec.js +50 -59
- package/lib/test/client.rollback.spec.js.map +1 -1
- package/lib/test/client.rollbackFarm.spec.js +1 -1
- package/lib/test/client.rollbackFarm.spec.js.map +1 -1
- package/lib/test/client.searchForMarker.spec.js +4 -21
- package/lib/test/client.searchForMarker.spec.js.map +1 -1
- package/lib/test/index.d.ts +2 -2
- package/lib/test/index.d.ts.map +1 -1
- package/lib/test/index.js +1 -1
- package/lib/test/index.js.map +1 -1
- package/lib/test/mergeTree.annotate.deltaCallback.spec.js +15 -60
- package/lib/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -1
- package/lib/test/mergeTree.annotate.spec.js +48 -64
- package/lib/test/mergeTree.annotate.spec.js.map +1 -1
- package/lib/test/mergeTree.insert.deltaCallback.spec.js +10 -63
- package/lib/test/mergeTree.insert.deltaCallback.spec.js.map +1 -1
- package/lib/test/mergeTree.insertingWalk.spec.js +61 -127
- package/lib/test/mergeTree.insertingWalk.spec.js.map +1 -1
- package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +13 -94
- package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
- package/lib/test/mergeTree.markRangeRemoved.spec.js +10 -7
- package/lib/test/mergeTree.markRangeRemoved.spec.js.map +1 -1
- package/lib/test/mergeTree.walk.spec.js +2 -14
- package/lib/test/mergeTree.walk.spec.js.map +1 -1
- package/lib/test/mergeTreeOperationRunner.js +3 -3
- package/lib/test/mergeTreeOperationRunner.js.map +1 -1
- package/lib/test/obliterate.concurrent.spec.js +18 -23
- package/lib/test/obliterate.concurrent.spec.js.map +1 -1
- package/lib/test/obliterate.partialLength.spec.js +167 -137
- package/lib/test/obliterate.partialLength.spec.js.map +1 -1
- package/lib/test/obliterate.spec.js +17 -127
- package/lib/test/obliterate.spec.js.map +1 -1
- package/lib/test/partialLength.spec.js +29 -197
- package/lib/test/partialLength.spec.js.map +1 -1
- package/lib/test/perspective.spec.js +34 -0
- package/lib/test/perspective.spec.js.map +1 -1
- package/lib/test/propertyManager.spec.js +2 -2
- package/lib/test/propertyManager.spec.js.map +1 -1
- package/lib/test/resetPendingSegmentsToOp.spec.js +0 -2
- package/lib/test/resetPendingSegmentsToOp.spec.js.map +1 -1
- package/lib/test/segmentGroupCollection.spec.js +10 -4
- package/lib/test/segmentGroupCollection.spec.js.map +1 -1
- package/lib/test/testClient.d.ts +1 -0
- package/lib/test/testClient.d.ts.map +1 -1
- package/lib/test/testClient.js +18 -28
- package/lib/test/testClient.js.map +1 -1
- package/lib/test/testClientLogger.d.ts.map +1 -1
- package/lib/test/testClientLogger.js +3 -10
- package/lib/test/testClientLogger.js.map +1 -1
- package/lib/test/testServer.d.ts +2 -1
- package/lib/test/testServer.d.ts.map +1 -1
- package/lib/test/testServer.js +7 -5
- package/lib/test/testServer.js.map +1 -1
- package/lib/test/testUtils.d.ts +36 -56
- package/lib/test/testUtils.d.ts.map +1 -1
- package/lib/test/testUtils.js +66 -48
- package/lib/test/testUtils.js.map +1 -1
- package/lib/test/text.d.ts +2 -2
- package/lib/test/text.d.ts.map +1 -1
- package/lib/test/text.js +6 -3
- package/lib/test/text.js.map +1 -1
- package/lib/textSegment.d.ts +0 -6
- package/lib/textSegment.d.ts.map +1 -1
- package/lib/textSegment.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/zamboni.d.ts.map +1 -1
- package/lib/zamboni.js +32 -28
- package/lib/zamboni.js.map +1 -1
- package/package.json +17 -20
- package/src/MergeTreeTextHelper.ts +17 -12
- package/src/client.ts +141 -197
- package/src/endOfTreeSegment.ts +11 -8
- package/src/index.ts +4 -3
- package/src/mergeTree.ts +482 -633
- package/src/mergeTreeDeltaCallback.ts +4 -8
- package/src/mergeTreeNodes.ts +66 -45
- package/src/partialLengths.ts +181 -137
- package/src/perspective.ts +17 -95
- package/src/revertibles.ts +2 -7
- package/src/segmentInfos.ts +48 -141
- package/src/segmentPropertiesManager.ts +2 -16
- package/src/snapshotLoader.ts +62 -30
- package/src/snapshotV1.ts +36 -28
- package/src/snapshotlegacy.ts +7 -16
- package/src/stamps.ts +1 -1
- package/src/textSegment.ts +0 -13
- package/src/zamboni.ts +38 -32
- package/tsconfig.json +1 -0
- package/prettier.config.cjs +0 -8
package/dist/perspective.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perspective.js","sourceRoot":"","sources":["../src/perspective.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iDAAyE;AAEzE,iEAAyF;AACzF,2DAAgE;AAChE,uDAA0E;AAC1E,0DAA4C;AAkD5C,MAAe,eAAe;IAG7B;;;;;;;;OAQG;IACI,WAAW,CACjB,SAAoB,EACpB,OAAqB,EACrB,UAAmB,IAAI;QAEvB,IAAI,IAA8B,CAAC;QACnC,MAAM,MAAM,GAAG,CAAC,GAAiB,EAAuB,EAAE;YACzD,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChC,IAAI,GAAG,GAAG,CAAC;gBACX,OAAO,iCAAU,CAAC,IAAI,CAAC;YACxB,CAAC;QACF,CAAC,CAAC;QACF,CAAC,OAAO,CAAC,CAAC,CAAC,uCAAgB,CAAC,CAAC,CAAC,wCAAiB,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAClE,OAAO,IAAI,IAAI,CAAC,OAAO,C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AAO,IAAI,CAAC;IACb,CAAC;CACD;AAnBD,kEAmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { LocalClientId, UnassignedSequenceNumber } from \"./constants.js\";\nimport { type MergeTree } from \"./mergeTree.js\";\nimport { LeafAction, backwardExcursion, forwardExcursion } from \"./mergeTreeNodeWalk.js\";\nimport { seqLTE, type ISegmentLeaf } from \"./mergeTreeNodes.js\";\nimport { isInserted, toMoveInfo, toRemovalInfo } from \"./segmentInfos.js\";\nimport * as opstampUtils from \"./stamps.js\";\nimport type { OperationStamp, InsertOperationStamp, RemoveOperationStamp } from \"./stamps.js\";\n\n/**\n * A perspective which includes some subset of operations known to the local client.\n *\n * This helps the local client reason about the state of other clients when they issued an operation.\n */\nexport interface Perspective {\n\t/**\n\t * The sequence number last seen from this perspective. Same concept as `ISequencedDocumentMessage.referenceSequenceNumber`.\n\t * @privateRemarks\n\t * This currently allows inter-operation between MergeTree methods and the partial lengths implementation, which still depends\n\t * on the (refSeq, clientId, localSeq?) representation of perspectives.\n\t */\n\treadonly refSeq: number;\n\n\t/**\n\t * The client id for this perspective.\n\t * @privateRemarks\n\t * This currently allows inter-operation between MergeTree methods and the partial lengths implementation, which still depends\n\t * on the (refSeq, clientId, localSeq?) representation of perspectives.\n\t */\n\treadonly clientId: number;\n\n\t/**\n\t * When this is a local perspective, the local sequence number last seen from this perspective.\n\t *\n\t * Perspectives with defined `localSeq` values are useful in reconnection flows, where the local client may need to resend some\n\t * of its ops after rederiving their new equivalents.\n\t * @privateRemarks\n\t * This currently allows inter-operation between MergeTree methods and the partial lengths implementation, which still depends\n\t * on the (refSeq, clientId, localSeq?) representation of perspectives.\n\t */\n\treadonly localSeq?: number;\n\n\t/**\n\t * @returns Whether the segment is present (visible) from this perspective\n\t */\n\tisSegmentPresent(segment: ISegmentLeaf): boolean;\n\n\t/**\n\t * @returns Whether this perspective has seen the given operation.\n\t */\n\thasOccurred(stamp: RemoveOperationStamp | InsertOperationStamp): boolean;\n\n\tnextSegment(mergeTree: MergeTree, segment: ISegmentLeaf, forward?: boolean): ISegmentLeaf;\n\tpreviousSegment(mergeTree: MergeTree, segment: ISegmentLeaf): ISegmentLeaf;\n}\n\nabstract class PerspectiveBase {\n\tabstract hasOccurred(stamp: RemoveOperationStamp | InsertOperationStamp): boolean;\n\n\t/**\n\t * Returns the immediately adjacent segment in the specified direction from this perspective.\n\t * There may actually be multiple segments between the given segment and the returned segment,\n\t * but they were either inserted after this perspective, or have been removed before this perspective.\n\t *\n\t * @param segment - The segment to start from.\n\t * @param forward - The direction to search.\n\t * @returns the next segment in the specified direction, or the start or end of the tree if there is no next segment.\n\t */\n\tpublic nextSegment(\n\t\tmergeTree: MergeTree,\n\t\tsegment: ISegmentLeaf,\n\t\tforward: boolean = true,\n\t): ISegmentLeaf {\n\t\tlet next: ISegmentLeaf | undefined;\n\t\tconst action = (seg: ISegmentLeaf): boolean | undefined => {\n\t\t\tif (this.isSegmentPresent(seg)) {\n\t\t\t\tnext = seg;\n\t\t\t\treturn LeafAction.Exit;\n\t\t\t}\n\t\t};\n\t\t(forward ? forwardExcursion : backwardExcursion)(segment, action);\n\t\treturn next ?? (forward ? mergeTree.endOfTree : mergeTree.startOfTree);\n\t}\n\n\t/**\n\t * Finds the segment prior to the given segment.\n\t * @param segment - The segment to start from.\n\t * @returns the previous segment, or the start of the tree if there is no previous segment.\n\t * @remarks This is a convenient equivalent to calling `nextSegment(segment, false)`.\n\t */\n\tpublic previousSegment(mergeTree: MergeTree, segment: ISegmentLeaf): ISegmentLeaf {\n\t\treturn this.nextSegment(mergeTree, segment, false);\n\t}\n\n\tpublic isSegmentPresent(seg: ISegmentLeaf): boolean {\n\t\tconst insert: InsertOperationStamp = {\n\t\t\ttype: \"insert\",\n\t\t\tclientId: seg.clientId,\n\t\t\tseq: seg.seq,\n\t\t\tlocalSeq: seg.localSeq,\n\t\t};\n\t\tif (isInserted(seg) && !this.hasOccurred(insert)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst removes: RemoveOperationStamp[] = [];\n\t\tconst removalInfo = toRemovalInfo(seg);\n\t\tif (removalInfo !== undefined) {\n\t\t\tremoves.push(\n\t\t\t\t...removalInfo.removedClientIds.map((clientId) =>\n\t\t\t\t\t(clientId === LocalClientId || clientId === 0) &&\n\t\t\t\t\tremovalInfo.localRemovedSeq !== undefined\n\t\t\t\t\t\t? ({\n\t\t\t\t\t\t\t\ttype: \"setRemove\",\n\t\t\t\t\t\t\t\tseq: UnassignedSequenceNumber,\n\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\tlocalSeq: removalInfo.localRemovedSeq,\n\t\t\t\t\t\t\t} as const)\n\t\t\t\t\t\t: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\t\t({ type: \"setRemove\", seq: removalInfo.removedSeq, clientId } as const),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tconst moveInfo = toMoveInfo(seg);\n\t\tif (moveInfo !== undefined) {\n\t\t\tremoves.push(\n\t\t\t\t...moveInfo.movedClientIds.map((clientId, index) =>\n\t\t\t\t\t(clientId === LocalClientId || clientId === 0) &&\n\t\t\t\t\tmoveInfo.localMovedSeq !== undefined\n\t\t\t\t\t\t? ({\n\t\t\t\t\t\t\t\ttype: \"sliceRemove\",\n\t\t\t\t\t\t\t\tseq: UnassignedSequenceNumber,\n\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\tlocalSeq: moveInfo.localMovedSeq,\n\t\t\t\t\t\t\t} as const)\n\t\t\t\t\t\t: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\t\t({ type: \"setRemove\", seq: moveInfo.movedSeqs[index]!, clientId } as const),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tif (removes.some((remove) => this.hasOccurred(remove))) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n}\n\n/**\n * A perspective which includes edits at or before some reference sequence number alongside all edits from some particular client.\n *\n * @remarks\n * This works for both the local client as well as remote clients since refSeq-based checks disallow unacked edits, but the clientId check\n * catches unacked edits from the local client.\n */\nexport class PriorPerspective extends PerspectiveBase implements Perspective {\n\tpublic constructor(\n\t\tpublic readonly refSeq: number,\n\t\tpublic readonly clientId: number,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic hasOccurred(stamp: OperationStamp): boolean {\n\t\tconst predatesViaRefSeq = seqLTE(stamp.seq, this.refSeq);\n\t\tconst predatesViaSameClient = stamp.clientId === this.clientId;\n\t\treturn predatesViaRefSeq || predatesViaSameClient;\n\t}\n}\n\n/**\n * A perspective which includes edits which were either:\n * - acked and at or before some reference sequence number\n * - unacked, but at or before some local sequence number\n *\n * This is a useful perspective when the local client is in the process of reconnecting, since it must\n * rederive positions for unacked ops while only considering a portion of its own edits as having been applied.\n */\nexport class LocalReconnectingPerspective extends PerspectiveBase implements Perspective {\n\tpublic constructor(\n\t\tpublic readonly refSeq: number,\n\t\tpublic readonly clientId: number,\n\t\tpublic readonly localSeq: number,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic hasOccurred(stamp: OperationStamp): boolean {\n\t\tconst predatesViaRefSeq = seqLTE(stamp.seq, this.refSeq);\n\t\tconst predatesViaLocalSeq =\n\t\t\tstamp.localSeq !== undefined && stamp.localSeq <= this.localSeq;\n\t\treturn predatesViaRefSeq || predatesViaLocalSeq;\n\t}\n}\n\n/**\n * A perspective which includes all known edits.\n *\n * This is the perspective that the application sees.\n * @remarks\n * This can be represented using {@link PriorPerspective} with a refSeq of `Number.MAX_SAFE_INTEGER`, but having an explicit\n * variant of this perspective renders extra refSeq checks unnecessary and is a bit easier to read.\n */\nexport class LocalDefaultPerspective extends PerspectiveBase implements Perspective {\n\tpublic readonly refSeq = Number.MAX_SAFE_INTEGER;\n\n\tpublic constructor(public readonly clientId: number) {\n\t\tsuper();\n\t}\n\n\tpublic hasOccurred(_stamp: OperationStamp): boolean {\n\t\treturn true;\n\t}\n}\n\n/**\n * A perspective dictating whether segments are 'visible' to a remote obliterate operation.\n *\n * NOTE: Beware that partial lengths doesn't support this perspective, in the sense that consulting partial lengths' for the length of a block\n * can give different results than summing the lengths of present segments in that block.\n * This ends up not affecting the current obliterate implementation (which has some special casing in the mapRange calls it uses),\n * but use with caution.\n */\nexport class RemoteObliteratePerspective extends PerspectiveBase implements Perspective {\n\tpublic readonly refSeq = Number.MAX_SAFE_INTEGER;\n\n\tconstructor(public readonly clientId: number) {\n\t\tsuper();\n\t}\n\n\tpublic hasOccurred(stamp: InsertOperationStamp | RemoveOperationStamp): boolean {\n\t\t// Local-only removals are not visible to an obliterate operation, since this means the local removal was concurrent\n\t\t// to a remote obliterate and we may need to mark the segment appropriately to reflect this overlapping remove.\n\t\t// Every other type of operation is visible: obliterates do not affect segments that have already been removed and acked,\n\t\t// and they always affect segments within their range that have not been removed, even if those segments were inserted\n\t\t// after the obliterate's refSeq.\n\t\tif (stamp.type !== \"insert\" && opstampUtils.isLocal(stamp)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"perspective.js","sourceRoot":"","sources":["../src/perspective.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2DAA4D;AAC5D,uDAA0D;AAC1D,0DAA4C;AAgD5C,MAAe,eAAe;IAGtB,gBAAgB,CAAC,GAAa;QACpC,IAAI,IAAA,4BAAU,EAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YACtD,OAAO,KAAK,CAAC;QACd,CAAC;QAED,IAAI,IAAA,2BAAS,EAAC,GAAG,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;YAC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gBAAgB,CAAC;IAIjD,CAAC;IAEM,WAAW,CAAC,MAAsB;QACxC,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAVD,0DAUC;AAED;;;;;;;GAOG;AACH,MAAa,2BAA4B,SAAQ,eAAe;IAG/D,YAA4B,QAAgB;QAC3C,KAAK,EAAE,CAAC;QADmB,aAAQ,GAAR,QAAQ,CAAQ;QAF5B,WAAM,GAAG,MAAM,CAAC,gBAAgB,CAAC;IAIjD,CAAC;IAEM,WAAW,CAAC,KAAqB;QACvC,oHAAoH;QACpH,+GAA+G;QAC/G,yHAAyH;QACzH,sHAAsH;QACtH,iCAAiC;QACjC,IAAI,sBAAsB,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAClE,OAAO,KAAK,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAnBD,kEAmBC;AAED,SAAS,sBAAsB,CAAC,KAAqB;IACpD,MAAM,EAAE,IAAI,EAAE,GAAG,KAAwC,CAAC;IAC1D,OAAO,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,aAAa,CAAC;AACvD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { seqLTE, type ISegment } from \"./mergeTreeNodes.js\";\nimport { isInserted, isRemoved } from \"./segmentInfos.js\";\nimport * as opstampUtils from \"./stamps.js\";\nimport type { OperationStamp, RemoveOperationStamp } from \"./stamps.js\";\n\n/**\n * A perspective which includes some subset of operations known to the local client.\n *\n * This helps the local client reason about the state of other clients when they issued an operation.\n * @internal\n */\nexport interface Perspective {\n\t/**\n\t * The sequence number last seen from this perspective. Same concept as `ISequencedDocumentMessage.referenceSequenceNumber`.\n\t * @privateRemarks\n\t * This currently allows inter-operation between MergeTree methods and the partial lengths implementation, which still depends\n\t * on the (refSeq, clientId, localSeq?) representation of perspectives.\n\t */\n\treadonly refSeq: number;\n\n\t/**\n\t * The client id for this perspective.\n\t * @privateRemarks\n\t * This currently allows inter-operation between MergeTree methods and the partial lengths implementation, which still depends\n\t * on the (refSeq, clientId, localSeq?) representation of perspectives.\n\t */\n\treadonly clientId: number;\n\n\t/**\n\t * When this is a local perspective, the local sequence number last seen from this perspective.\n\t *\n\t * Perspectives with defined `localSeq` values are useful in reconnection flows, where the local client may need to resend some\n\t * of its ops after rederiving their new equivalents.\n\t * @privateRemarks\n\t * This currently allows inter-operation between MergeTree methods and the partial lengths implementation, which still depends\n\t * on the (refSeq, clientId, localSeq?) representation of perspectives.\n\t */\n\treadonly localSeq?: number;\n\n\t/**\n\t * @returns Whether the segment is present (visible) from this perspective\n\t */\n\tisSegmentPresent(segment: ISegment): boolean;\n\n\t/**\n\t * @returns Whether this perspective has seen the given operation.\n\t */\n\thasOccurred(stamp: OperationStamp): boolean;\n}\n\nabstract class PerspectiveBase {\n\tabstract hasOccurred(stamp: OperationStamp): boolean;\n\n\tpublic isSegmentPresent(seg: ISegment): boolean {\n\t\tif (isInserted(seg) && !this.hasOccurred(seg.insert)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (isRemoved(seg) && seg.removes.some((remove) => this.hasOccurred(remove))) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n}\n\n/**\n * A perspective which includes edits at or before some reference sequence number alongside all edits from some particular client.\n *\n * @remarks\n * This works for both the local client as well as remote clients since refSeq-based checks disallow unacked edits, but the clientId check\n * catches unacked edits from the local client.\n */\nexport class PriorPerspective extends PerspectiveBase implements Perspective {\n\tpublic constructor(\n\t\tpublic readonly refSeq: number,\n\t\tpublic readonly clientId: number,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic hasOccurred(stamp: OperationStamp): boolean {\n\t\tconst predatesViaRefSeq = seqLTE(stamp.seq, this.refSeq);\n\t\tconst predatesViaSameClient = stamp.clientId === this.clientId;\n\t\treturn predatesViaRefSeq || predatesViaSameClient;\n\t}\n}\n\n/**\n * A perspective which includes edits which were either:\n * - acked and at or before some reference sequence number\n * - unacked, but at or before some local sequence number\n *\n * This is a useful perspective when the local client is in the process of reconnecting, since it must\n * rederive positions for unacked ops while only considering a portion of its own edits as having been applied.\n */\nexport class LocalReconnectingPerspective extends PerspectiveBase implements Perspective {\n\tpublic constructor(\n\t\tpublic readonly refSeq: number,\n\t\tpublic readonly clientId: number,\n\t\tpublic readonly localSeq: number,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic hasOccurred(stamp: OperationStamp): boolean {\n\t\tconst predatesViaRefSeq = seqLTE(stamp.seq, this.refSeq);\n\t\tconst predatesViaLocalSeq =\n\t\t\tstamp.localSeq !== undefined && stamp.localSeq <= this.localSeq;\n\t\treturn predatesViaRefSeq || predatesViaLocalSeq;\n\t}\n}\n\n/**\n * A perspective which includes all known edits.\n *\n * This is the perspective that the application sees.\n * @remarks\n * This can be represented using {@link PriorPerspective} with a refSeq of `Number.MAX_SAFE_INTEGER`, but having an explicit\n * variant of this perspective renders extra refSeq checks unnecessary and is a bit easier to read.\n */\nexport class LocalDefaultPerspective extends PerspectiveBase implements Perspective {\n\tpublic readonly refSeq = Number.MAX_SAFE_INTEGER;\n\n\tpublic constructor(public readonly clientId: number) {\n\t\tsuper();\n\t}\n\n\tpublic hasOccurred(_stamp: OperationStamp): boolean {\n\t\treturn true;\n\t}\n}\n\n/**\n * A perspective dictating whether segments are 'visible' to a remote obliterate operation.\n *\n * NOTE: Beware that partial lengths doesn't support this perspective, in the sense that consulting partial lengths' for the length of a block\n * can give different results than summing the lengths of present segments in that block.\n * This ends up not affecting the current obliterate implementation (which has some special casing in the mapRange calls it uses),\n * but use with caution.\n */\nexport class RemoteObliteratePerspective extends PerspectiveBase implements Perspective {\n\tpublic readonly refSeq = Number.MAX_SAFE_INTEGER;\n\n\tconstructor(public readonly clientId: number) {\n\t\tsuper();\n\t}\n\n\tpublic hasOccurred(stamp: OperationStamp): boolean {\n\t\t// Local-only removals are not visible to an obliterate operation, since this means the local removal was concurrent\n\t\t// to a remote obliterate and we may need to mark the segment appropriately to reflect this overlapping remove.\n\t\t// Every other type of operation is visible: obliterates do not affect segments that have already been removed and acked,\n\t\t// and they always affect segments within their range that have not been removed, even if those segments were inserted\n\t\t// after the obliterate's refSeq.\n\t\tif (isRemoveOperationStamp(stamp) && opstampUtils.isLocal(stamp)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n}\n\nfunction isRemoveOperationStamp(stamp: OperationStamp): stamp is RemoveOperationStamp {\n\tconst { type } = stamp as unknown as RemoveOperationStamp;\n\treturn type === \"setRemove\" || type === \"sliceRemove\";\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revertibles.d.ts","sourceRoot":"","sources":["../src/revertibles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAA4B,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,SAAS,EAAsB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAS1E,OAAO,EAAE,cAAc,EAAqC,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAiB,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAI/D;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GACjC;IACA,SAAS,EAAE,OAAO,kBAAkB,CAAC,MAAM,CAAC;IAC5C,aAAa,EAAE,cAAc,CAAC;CAC7B,GACD;IACA,SAAS,EAAE,OAAO,kBAAkB,CAAC,MAAM,CAAC;IAC5C,aAAa,EAAE,cAAc,CAAC;CAC7B,GACD;IACA,SAAS,EAAE,OAAO,kBAAkB,CAAC,QAAQ,CAAC;IAC9C,aAAa,EAAE,cAAc,CAAC;IAC9B,cAAc,EAAE,WA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AAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AA4GjF;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAChD,SAAS,EAAE,2BAA2B,EACtC,WAAW,EAAE,wBAAwB,EAAE,GACrC,IAAI,CA0BN;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC9C,WAAW,EAAE,wBAAwB,EAAE,GACrC,IAAI,CAWN;AAgJD;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC9C,MAAM,EAAE,yBAAyB,EACjC,WAAW,EAAE,wBAAwB,EAAE,GACrC,IAAI,CA4BN"}
|
package/dist/revertibles.js
CHANGED
|
@@ -186,7 +186,7 @@ function revertLocalRemove(driver, mergeTreeWithRevert, revertible) {
|
|
|
186
186
|
}
|
|
187
187
|
const props = tracked.properties;
|
|
188
188
|
driver.insertFromSpec(realPos, props.segSpec);
|
|
189
|
-
const insertSegment = mergeTreeWithRevert.getContainingSegment(realPos, mergeTreeWithRevert.
|
|
189
|
+
const insertSegment = mergeTreeWithRevert.getContainingSegment(realPos, mergeTreeWithRevert.localPerspective).segment;
|
|
190
190
|
(0, mergeTreeNodes_js_1.assertSegmentLeaf)(insertSegment);
|
|
191
191
|
const localSlideFilter = (lref) => lref.properties?.referenceSpace ===
|
|
192
192
|
"mergeTreeDeltaRevertible";
|
|
@@ -248,7 +248,7 @@ function revertLocalAnnotate(driver, mergeTreeWithRevert, revertible) {
|
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
function getPosition(mergeTreeWithRevert, segment) {
|
|
251
|
-
return mergeTreeWithRevert.getPosition(segment, mergeTreeWithRevert.
|
|
251
|
+
return mergeTreeWithRevert.getPosition(segment, mergeTreeWithRevert.localPerspective);
|
|
252
252
|
}
|
|
253
253
|
/**
|
|
254
254
|
* Reverts all operations in the list of revertibles.
|
package/dist/revertibles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
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AAQ,CAAC,CAAC,CAAC;oBAClC,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC;oBACpD,MAAM;gBACP,CAAC;gBACD,OAAO,CAAC,CAAC,CAAC;oBACT,IAAA,0BAAe,EAAC,SAAS,CAAC,CAAC;gBAC5B,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC;AA/BD,0EA+BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { DoublyLinkedList } from \"./collections/index.js\";\nimport { EndOfTreeSegment } from \"./endOfTreeSegment.js\";\nimport { LocalReferenceCollection, LocalReferencePosition } from \"./localReference.js\";\nimport { MergeTree, findRootMergeBlock } from \"./mergeTree.js\";\nimport { IMergeTreeDeltaCallbackArgs } from \"./mergeTreeDeltaCallback.js\";\nimport { depthFirstNodeWalk } from \"./mergeTreeNodeWalk.js\";\nimport {\n\tassertSegmentLeaf,\n\tisSegmentLeaf,\n\ttoSegmentLeaf,\n\ttype ISegmentLeaf,\n\ttype ISegmentPrivate,\n} from \"./mergeTreeNodes.js\";\nimport { ITrackingGroup, Trackable, UnorderedTrackingGroup } from \"./mergeTreeTracking.js\";\nimport { IJSONSegment, MergeTreeDeltaType, ReferenceType } from \"./ops.js\";\nimport { PropertySet, matchProperties } from \"./properties.js\";\nimport { DetachedReferencePosition } from \"./referencePositions.js\";\nimport { toRemovalInfo } from \"./segmentInfos.js\";\n\n/**\n * @legacy\n * @alpha\n */\nexport type MergeTreeDeltaRevertible =\n\t| {\n\t\t\toperation: typeof MergeTreeDeltaType.INSERT;\n\t\t\ttrackingGroup: ITrackingGroup;\n\t }\n\t| {\n\t\t\toperation: typeof MergeTreeDeltaType.REMOVE;\n\t\t\ttrackingGroup: ITrackingGroup;\n\t }\n\t| {\n\t\t\toperation: typeof MergeTreeDeltaType.ANNOTATE;\n\t\t\ttrackingGroup: ITrackingGroup;\n\t\t\tpropertyDeltas: PropertySet;\n\t };\n\n/**\n * Tests whether x is a MergeTreeDeltaRevertible\n * @internal\n */\nexport function isMergeTreeDeltaRevertible(x: unknown): x is MergeTreeDeltaRevertible {\n\treturn !!x && typeof x === \"object\" && \"operation\" in x && \"trackingGroup\" in x;\n}\n\ntype TypedRevertible<T extends MergeTreeDeltaRevertible[\"operation\"]> =\n\tMergeTreeDeltaRevertible & {\n\t\toperation: T;\n\t};\n\ninterface RemoveSegmentRefProperties {\n\t/**\n\t * the serialized form of the segment, so it can be re-inserted\n\t */\n\tsegSpec: IJSONSegment;\n\t/**\n\t * a tag so the reference can be identified as being created for revert\n\t */\n\treferenceSpace: \"mergeTreeDeltaRevertible\";\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface MergeTreeRevertibleDriver {\n\tinsertFromSpec(pos: number, spec: IJSONSegment): void;\n\tremoveRange(start: number, end: number): void;\n\tannotateRange(start: number, end: number, props: PropertySet): void;\n}\n\n/**\n * exported for test only. should not be exported out the the package\n * @internal\n */\nexport interface MergeTreeWithRevert extends MergeTree {\n\t__mergeTreeRevertible: {\n\t\tdetachedReferences: EndOfTreeSegment;\n\t\trefCallbacks: LocalReferencePosition[\"callbacks\"];\n\t};\n}\n\nexport type PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\nfunction findMergeTreeWithRevert(trackable: Trackable): MergeTreeWithRevert {\n\tconst segmentOrNode = trackable.isLeaf() ? trackable : trackable.getSegment();\n\tconst maybeRoot = findRootMergeBlock(toSegmentLeaf(segmentOrNode));\n\tassert(\n\t\tmaybeRoot?.mergeTree !== undefined,\n\t\t0x5c2 /* trackable is invalid as it is not in a rooted merge tree. */,\n\t);\n\tconst mergeTree: PickPartial<MergeTreeWithRevert, \"__mergeTreeRevertible\"> =\n\t\tmaybeRoot.mergeTree;\n\n\tif (mergeTree.__mergeTreeRevertible === undefined) {\n\t\tconst detachedReferences = new EndOfTreeSegment(maybeRoot.mergeTree);\n\t\tconst refCallbacks: MergeTreeWithRevert[\"__mergeTreeRevertible\"][\"refCallbacks\"] = {\n\t\t\tafterSlide: (r: LocalReferencePosition) => {\n\t\t\t\tif (mergeTree.referencePositionToLocalPosition(r) === DetachedReferencePosition) {\n\t\t\t\t\tconst refs = LocalReferenceCollection.setOrGet(detachedReferences);\n\t\t\t\t\trefs.addAfterTombstones([r]);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t\tmergeTree.__mergeTreeRevertible = {\n\t\t\trefCallbacks,\n\t\t\tdetachedReferences,\n\t\t};\n\t}\n\treturn mergeTree as MergeTreeWithRevert;\n}\n\nfunction appendLocalInsertToRevertibles(\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\trevertibles: MergeTreeDeltaRevertible[],\n): MergeTreeDeltaRevertible[] {\n\tif (revertibles[revertibles.length - 1]?.operation !== MergeTreeDeltaType.INSERT) {\n\t\trevertibles.push({\n\t\t\toperation: MergeTreeDeltaType.INSERT,\n\t\t\ttrackingGroup: new UnorderedTrackingGroup(),\n\t\t});\n\t}\n\tconst last = revertibles[revertibles.length - 1];\n\tfor (const t of deltaArgs.deltaSegments) last.trackingGroup.link(t.segment);\n\n\treturn revertibles;\n}\n\nfunction appendLocalRemoveToRevertibles(\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\trevertibles: MergeTreeDeltaRevertible[],\n): MergeTreeDeltaRevertible[] {\n\tif (revertibles[revertibles.length - 1]?.operation !== MergeTreeDeltaType.REMOVE) {\n\t\trevertibles.push({\n\t\t\toperation: MergeTreeDeltaType.REMOVE,\n\t\t\ttrackingGroup: new UnorderedTrackingGroup(),\n\t\t});\n\t}\n\tconst last = revertibles[revertibles.length - 1];\n\n\tconst mergeTreeWithRevert = findMergeTreeWithRevert(deltaArgs.deltaSegments[0].segment);\n\n\tfor (const t of deltaArgs.deltaSegments) {\n\t\tconst props: RemoveSegmentRefProperties = {\n\t\t\tsegSpec: t.segment.toJSONObject() as IJSONSegment,\n\t\t\treferenceSpace: \"mergeTreeDeltaRevertible\",\n\t\t};\n\t\tconst ref = mergeTreeWithRevert.createLocalReferencePosition(\n\t\t\tt.segment,\n\t\t\t0,\n\t\t\tReferenceType.SlideOnRemove,\n\t\t\tprops,\n\t\t);\n\t\tref.callbacks = mergeTreeWithRevert.__mergeTreeRevertible.refCallbacks;\n\t\tfor (const tg of t.segment.trackingCollection.trackingGroups) {\n\t\t\ttg.link(ref);\n\t\t\ttg.unlink(t.segment);\n\t\t}\n\n\t\tlast.trackingGroup.link(ref);\n\t}\n\treturn revertibles;\n}\n\nfunction appendLocalAnnotateToRevertibles(\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\trevertibles: MergeTreeDeltaRevertible[],\n): MergeTreeDeltaRevertible[] {\n\tlet last = revertibles[revertibles.length - 1];\n\tfor (const ds of deltaArgs.deltaSegments) {\n\t\tconst propertyDeltas = ds.propertyDeltas;\n\t\tif (propertyDeltas) {\n\t\t\tif (\n\t\t\t\tlast?.operation === MergeTreeDeltaType.ANNOTATE &&\n\t\t\t\tmatchProperties(last?.propertyDeltas, propertyDeltas)\n\t\t\t) {\n\t\t\t\tlast.trackingGroup.link(ds.segment);\n\t\t\t} else {\n\t\t\t\tlast = {\n\t\t\t\t\toperation: MergeTreeDeltaType.ANNOTATE,\n\t\t\t\t\tpropertyDeltas,\n\t\t\t\t\ttrackingGroup: new UnorderedTrackingGroup(),\n\t\t\t\t};\n\t\t\t\tlast.trackingGroup.link(ds.segment);\n\t\t\t\trevertibles.push(last);\n\t\t\t}\n\t\t}\n\t}\n\treturn revertibles;\n}\n\n/**\n * Appends a merge tree delta to the list of revertibles.\n *\n * @legacy\n * @alpha\n */\nexport function appendToMergeTreeDeltaRevertibles(\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\trevertibles: MergeTreeDeltaRevertible[],\n): void {\n\tif (deltaArgs.deltaSegments.length === 0) {\n\t\treturn;\n\t}\n\tswitch (deltaArgs.operation) {\n\t\tcase MergeTreeDeltaType.INSERT: {\n\t\t\tappendLocalInsertToRevertibles(deltaArgs, revertibles);\n\t\t\tbreak;\n\t\t}\n\n\t\tcase MergeTreeDeltaType.REMOVE: {\n\t\t\tappendLocalRemoveToRevertibles(deltaArgs, revertibles);\n\t\t\tbreak;\n\t\t}\n\n\t\tcase MergeTreeDeltaType.ANNOTATE: {\n\t\t\tappendLocalAnnotateToRevertibles(deltaArgs, revertibles);\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault: {\n\t\t\tthrow new UsageError(\"Unsupported event delta type\", {\n\t\t\t\toperation: deltaArgs.operation,\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * Removes all revertibles from the list of revertibles.\n *\n * @legacy\n * @alpha\n */\nexport function discardMergeTreeDeltaRevertible(\n\trevertibles: MergeTreeDeltaRevertible[],\n): void {\n\tfor (const r of revertibles) {\n\t\tfor (const t of r.trackingGroup.tracked) {\n\t\t\tt.trackingCollection.unlink(r.trackingGroup);\n\t\t\t// remove untracked local references\n\t\t\tif (t.trackingCollection.empty && !t.isLeaf()) {\n\t\t\t\tconst segment: ISegmentPrivate | undefined = t.getSegment();\n\t\t\t\tsegment?.localRefs?.removeLocalRef(t);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction revertLocalInsert(\n\tdriver: MergeTreeRevertibleDriver,\n\tmergeTreeWithRevert: MergeTreeWithRevert,\n\trevertible: TypedRevertible<typeof MergeTreeDeltaType.INSERT>,\n): void {\n\twhile (revertible.trackingGroup.size > 0) {\n\t\tconst tracked = revertible.trackingGroup.tracked[0];\n\t\tassert(\n\t\t\ttracked.trackingCollection.unlink(revertible.trackingGroup),\n\t\t\t0x3f1 /* tracking group removed */,\n\t\t);\n\t\tassert(isSegmentLeaf(tracked), 0x3f2 /* inserts must track segments */);\n\t\tif (toRemovalInfo(tracked) === undefined) {\n\t\t\tconst start = getPosition(mergeTreeWithRevert, tracked);\n\t\t\tdriver.removeRange(start, start + tracked.cachedLength);\n\t\t}\n\t}\n}\n\nfunction revertLocalRemove(\n\tdriver: MergeTreeRevertibleDriver,\n\tmergeTreeWithRevert: MergeTreeWithRevert,\n\trevertible: TypedRevertible<typeof MergeTreeDeltaType.REMOVE>,\n): void {\n\twhile (revertible.trackingGroup.size > 0) {\n\t\tconst tracked = revertible.trackingGroup.tracked[0];\n\n\t\tassert(\n\t\t\ttracked.trackingCollection.unlink(revertible.trackingGroup),\n\t\t\t0x3f3 /* tracking group removed */,\n\t\t);\n\n\t\tassert(!tracked.isLeaf(), 0x3f4 /* removes must track local refs */);\n\n\t\tconst refSeg = tracked.getSegment();\n\t\tlet realPos = mergeTreeWithRevert.referencePositionToLocalPosition(tracked);\n\n\t\t// References which are on EndOfStringSegment don't return detached for pos,\n\t\t// they will return the length of the merge-tree. this case just catches\n\t\t// random references, likely not created in the revertible flow,\n\t\t// that are tying to be reverted for some reason.\n\t\tif (realPos === DetachedReferencePosition || !isSegmentLeaf(refSeg)) {\n\t\t\tthrow new UsageError(\"Cannot insert at detached references position\");\n\t\t}\n\n\t\tif (toRemovalInfo(refSeg) === undefined && refSeg.localRefs?.isAfterTombstone(tracked)) {\n\t\t\trealPos++;\n\t\t}\n\n\t\tconst props = tracked.properties as RemoveSegmentRefProperties;\n\t\tdriver.insertFromSpec(realPos, props.segSpec);\n\t\tconst insertSegment = mergeTreeWithRevert.getContainingSegment(\n\t\t\trealPos,\n\t\t\tmergeTreeWithRevert.collabWindow.currentSeq,\n\t\t\tmergeTreeWithRevert.collabWindow.clientId,\n\t\t).segment;\n\t\tassertSegmentLeaf(insertSegment);\n\n\t\tconst localSlideFilter = (lref: LocalReferencePosition): boolean =>\n\t\t\t(lref.properties as Partial<RemoveSegmentRefProperties>)?.referenceSpace ===\n\t\t\t\"mergeTreeDeltaRevertible\";\n\n\t\tconst insertRef: Partial<\n\t\t\tRecord<\"before\" | \"after\", DoublyLinkedList<LocalReferencePosition>>\n\t\t> = {};\n\t\tconst forward = insertSegment.ordinal < refSeg.ordinal;\n\t\tconst refHandler = (lref: LocalReferencePosition): false | undefined => {\n\t\t\t// once we reach it keep the original reference where it is\n\t\t\t// we'll move tracking groups, and remove it as a last step.\n\t\t\tif (tracked === lref) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (localSlideFilter(lref)) {\n\t\t\t\tif (forward) {\n\t\t\t\t\tconst before = (insertRef.before ??= new DoublyLinkedList());\n\t\t\t\t\tbefore.push(lref);\n\t\t\t\t} else {\n\t\t\t\t\tconst after = (insertRef.after ??= new DoublyLinkedList());\n\t\t\t\t\tafter.unshift(lref);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tdepthFirstNodeWalk(\n\t\t\tinsertSegment.parent,\n\t\t\tinsertSegment,\n\t\t\tundefined,\n\t\t\t(seg: ISegmentPrivate) => {\n\t\t\t\tif (seg.localRefs?.empty === false) {\n\t\t\t\t\treturn seg.localRefs.walkReferences(refHandler, undefined, forward);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tundefined,\n\t\t\tforward,\n\t\t);\n\t\tif (\n\t\t\tmergeTreeWithRevert?.__mergeTreeRevertible?.detachedReferences?.localRefs?.has(tracked)\n\t\t) {\n\t\t\tassert(forward, 0x3f6 /* forward should always be true when detached */);\n\t\t\tmergeTreeWithRevert?.__mergeTreeRevertible.detachedReferences.localRefs.walkReferences(\n\t\t\t\trefHandler,\n\t\t\t);\n\t\t}\n\n\t\tif (insertRef !== undefined) {\n\t\t\tconst localRefs = LocalReferenceCollection.setOrGet(insertSegment);\n\t\t\tif (insertRef.before?.empty === false) {\n\t\t\t\tlocalRefs.addBeforeTombstones(insertRef.before.map((n) => n.data));\n\t\t\t}\n\t\t\tif (insertRef.after?.empty === false) {\n\t\t\t\tlocalRefs.addAfterTombstones(insertRef.after.map((n) => n.data));\n\t\t\t}\n\t\t}\n\n\t\tfor (const tg of tracked.trackingCollection.trackingGroups) {\n\t\t\ttg.link(insertSegment);\n\t\t\ttg.unlink(tracked);\n\t\t}\n\t\tconst segment: ISegmentPrivate | undefined = tracked.getSegment();\n\t\tsegment?.localRefs?.removeLocalRef(tracked);\n\t}\n}\n\nfunction revertLocalAnnotate(\n\tdriver: MergeTreeRevertibleDriver,\n\tmergeTreeWithRevert: MergeTreeWithRevert,\n\trevertible: TypedRevertible<typeof MergeTreeDeltaType.ANNOTATE>,\n): void {\n\twhile (revertible.trackingGroup.size > 0) {\n\t\tconst tracked = revertible.trackingGroup.tracked[0];\n\t\tconst unlinked = tracked.trackingCollection.unlink(revertible.trackingGroup);\n\t\tassert(unlinked && isSegmentLeaf(tracked), 0x3f7 /* annotates must track segments */);\n\t\tif (toRemovalInfo(tracked) === undefined) {\n\t\t\tconst start = getPosition(mergeTreeWithRevert, tracked);\n\t\t\tdriver.annotateRange(start, start + tracked.cachedLength, revertible.propertyDeltas);\n\t\t}\n\t}\n}\n\nfunction getPosition(mergeTreeWithRevert: MergeTreeWithRevert, segment: ISegmentLeaf): number {\n\treturn mergeTreeWithRevert.getPosition(\n\t\tsegment,\n\t\tmergeTreeWithRevert.collabWindow.currentSeq,\n\t\tmergeTreeWithRevert.collabWindow.clientId,\n\t);\n}\n\n/**\n * Reverts all operations in the list of revertibles.\n *\n * @legacy\n * @alpha\n */\nexport function revertMergeTreeDeltaRevertibles(\n\tdriver: MergeTreeRevertibleDriver,\n\trevertibles: MergeTreeDeltaRevertible[],\n): void {\n\tlet mergeTreeWithRevert: MergeTreeWithRevert | undefined;\n\n\twhile (revertibles.length > 0) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tconst r = revertibles.pop()!;\n\t\tconst operation = r.operation;\n\t\tif (r.trackingGroup.size > 0) {\n\t\t\tmergeTreeWithRevert ??= findMergeTreeWithRevert(r.trackingGroup.tracked[0]);\n\t\t\tswitch (operation) {\n\t\t\t\tcase MergeTreeDeltaType.INSERT: {\n\t\t\t\t\trevertLocalInsert(driver, mergeTreeWithRevert, r);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase MergeTreeDeltaType.REMOVE: {\n\t\t\t\t\trevertLocalRemove(driver, mergeTreeWithRevert, r);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase MergeTreeDeltaType.ANNOTATE: {\n\t\t\t\t\trevertLocalAnnotate(driver, mergeTreeWithRevert, r);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(operation);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"revertibles.js","sourceRoot":"","sources":["../src/revertibles.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA8E;AAC9E,uEAAsE;AAEtE,qDAA0D;AAC1D,+DAAyD;AACzD,2DAAuF;AACvF,iDAA+D;AAE/D,iEAA4D;AAC5D,2DAM6B;AAC7B,iEAA2F;AAC3F,qCAA2E;AAC3E,mDAA+D;AAC/D,mEAAoE;AACpE,uDAAkD;AAqBlD;;;GAGG;AACH,SAAgB,0BAA0B,CAAC,CAAU;IACpD,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,WAAW,IAAI,CAAC,IAAI,eAAe,IAAI,CAAC,CAAC;AACjF,CAAC;AAFD,gEAEC;AAwCD,SAAS,uBAAuB,CAAC,SAAoB;IACpD,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IAC9E,MAAM,SAAS,GAAG,IAAA,iCAAkB,EAAC,IAAA,iCAAa,EAAC,aAAa,CAAC,CAAC,CAAC;IACnE,IAAA,iBAAM,EACL,SAAS,EAAE,SAAS,KAAK,SAAS,EAClC,KAAK,CAAC,+DAA+D,CACrE,CAAC;IACF,MAAM,SAAS,GACd,SAAS,CAAC,SAAS,C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AC,CAAC,CAAC;oBAChC,iBAAiB,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC;oBAClD,MAAM;gBACP,CAAC;gBACD,KAAK,2BAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAChC,iBAAiB,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC;oBAClD,MAAM;gBACP,CAAC;gBACD,KAAK,2BAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAClC,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC;oBACpD,MAAM;gBACP,CAAC;gBACD,OAAO,CAAC,CAAC,CAAC;oBACT,IAAA,0BAAe,EAAC,SAAS,CAAC,CAAC;gBAC5B,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC;AA/BD,0EA+BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { DoublyLinkedList } from \"./collections/index.js\";\nimport { EndOfTreeSegment } from \"./endOfTreeSegment.js\";\nimport { LocalReferenceCollection, LocalReferencePosition } from \"./localReference.js\";\nimport { MergeTree, findRootMergeBlock } from \"./mergeTree.js\";\nimport { IMergeTreeDeltaCallbackArgs } from \"./mergeTreeDeltaCallback.js\";\nimport { depthFirstNodeWalk } from \"./mergeTreeNodeWalk.js\";\nimport {\n\tassertSegmentLeaf,\n\tisSegmentLeaf,\n\ttoSegmentLeaf,\n\ttype ISegmentLeaf,\n\ttype ISegmentPrivate,\n} from \"./mergeTreeNodes.js\";\nimport { ITrackingGroup, Trackable, UnorderedTrackingGroup } from \"./mergeTreeTracking.js\";\nimport { IJSONSegment, MergeTreeDeltaType, ReferenceType } from \"./ops.js\";\nimport { PropertySet, matchProperties } from \"./properties.js\";\nimport { DetachedReferencePosition } from \"./referencePositions.js\";\nimport { toRemovalInfo } from \"./segmentInfos.js\";\n\n/**\n * @legacy\n * @alpha\n */\nexport type MergeTreeDeltaRevertible =\n\t| {\n\t\t\toperation: typeof MergeTreeDeltaType.INSERT;\n\t\t\ttrackingGroup: ITrackingGroup;\n\t }\n\t| {\n\t\t\toperation: typeof MergeTreeDeltaType.REMOVE;\n\t\t\ttrackingGroup: ITrackingGroup;\n\t }\n\t| {\n\t\t\toperation: typeof MergeTreeDeltaType.ANNOTATE;\n\t\t\ttrackingGroup: ITrackingGroup;\n\t\t\tpropertyDeltas: PropertySet;\n\t };\n\n/**\n * Tests whether x is a MergeTreeDeltaRevertible\n * @internal\n */\nexport function isMergeTreeDeltaRevertible(x: unknown): x is MergeTreeDeltaRevertible {\n\treturn !!x && typeof x === \"object\" && \"operation\" in x && \"trackingGroup\" in x;\n}\n\ntype TypedRevertible<T extends MergeTreeDeltaRevertible[\"operation\"]> =\n\tMergeTreeDeltaRevertible & {\n\t\toperation: T;\n\t};\n\ninterface RemoveSegmentRefProperties {\n\t/**\n\t * the serialized form of the segment, so it can be re-inserted\n\t */\n\tsegSpec: IJSONSegment;\n\t/**\n\t * a tag so the reference can be identified as being created for revert\n\t */\n\treferenceSpace: \"mergeTreeDeltaRevertible\";\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface MergeTreeRevertibleDriver {\n\tinsertFromSpec(pos: number, spec: IJSONSegment): void;\n\tremoveRange(start: number, end: number): void;\n\tannotateRange(start: number, end: number, props: PropertySet): void;\n}\n\n/**\n * exported for test only. should not be exported out the the package\n * @internal\n */\nexport interface MergeTreeWithRevert extends MergeTree {\n\t__mergeTreeRevertible: {\n\t\tdetachedReferences: EndOfTreeSegment;\n\t\trefCallbacks: LocalReferencePosition[\"callbacks\"];\n\t};\n}\n\nexport type PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\nfunction findMergeTreeWithRevert(trackable: Trackable): MergeTreeWithRevert {\n\tconst segmentOrNode = trackable.isLeaf() ? trackable : trackable.getSegment();\n\tconst maybeRoot = findRootMergeBlock(toSegmentLeaf(segmentOrNode));\n\tassert(\n\t\tmaybeRoot?.mergeTree !== undefined,\n\t\t0x5c2 /* trackable is invalid as it is not in a rooted merge tree. */,\n\t);\n\tconst mergeTree: PickPartial<MergeTreeWithRevert, \"__mergeTreeRevertible\"> =\n\t\tmaybeRoot.mergeTree;\n\n\tif (mergeTree.__mergeTreeRevertible === undefined) {\n\t\tconst detachedReferences = new EndOfTreeSegment(maybeRoot.mergeTree);\n\t\tconst refCallbacks: MergeTreeWithRevert[\"__mergeTreeRevertible\"][\"refCallbacks\"] = {\n\t\t\tafterSlide: (r: LocalReferencePosition) => {\n\t\t\t\tif (mergeTree.referencePositionToLocalPosition(r) === DetachedReferencePosition) {\n\t\t\t\t\tconst refs = LocalReferenceCollection.setOrGet(detachedReferences);\n\t\t\t\t\trefs.addAfterTombstones([r]);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t\tmergeTree.__mergeTreeRevertible = {\n\t\t\trefCallbacks,\n\t\t\tdetachedReferences,\n\t\t};\n\t}\n\treturn mergeTree as MergeTreeWithRevert;\n}\n\nfunction appendLocalInsertToRevertibles(\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\trevertibles: MergeTreeDeltaRevertible[],\n): MergeTreeDeltaRevertible[] {\n\tif (revertibles[revertibles.length - 1]?.operation !== MergeTreeDeltaType.INSERT) {\n\t\trevertibles.push({\n\t\t\toperation: MergeTreeDeltaType.INSERT,\n\t\t\ttrackingGroup: new UnorderedTrackingGroup(),\n\t\t});\n\t}\n\tconst last = revertibles[revertibles.length - 1];\n\tfor (const t of deltaArgs.deltaSegments) last.trackingGroup.link(t.segment);\n\n\treturn revertibles;\n}\n\nfunction appendLocalRemoveToRevertibles(\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\trevertibles: MergeTreeDeltaRevertible[],\n): MergeTreeDeltaRevertible[] {\n\tif (revertibles[revertibles.length - 1]?.operation !== MergeTreeDeltaType.REMOVE) {\n\t\trevertibles.push({\n\t\t\toperation: MergeTreeDeltaType.REMOVE,\n\t\t\ttrackingGroup: new UnorderedTrackingGroup(),\n\t\t});\n\t}\n\tconst last = revertibles[revertibles.length - 1];\n\n\tconst mergeTreeWithRevert = findMergeTreeWithRevert(deltaArgs.deltaSegments[0].segment);\n\n\tfor (const t of deltaArgs.deltaSegments) {\n\t\tconst props: RemoveSegmentRefProperties = {\n\t\t\tsegSpec: t.segment.toJSONObject() as IJSONSegment,\n\t\t\treferenceSpace: \"mergeTreeDeltaRevertible\",\n\t\t};\n\t\tconst ref = mergeTreeWithRevert.createLocalReferencePosition(\n\t\t\tt.segment,\n\t\t\t0,\n\t\t\tReferenceType.SlideOnRemove,\n\t\t\tprops,\n\t\t);\n\t\tref.callbacks = mergeTreeWithRevert.__mergeTreeRevertible.refCallbacks;\n\t\tfor (const tg of t.segment.trackingCollection.trackingGroups) {\n\t\t\ttg.link(ref);\n\t\t\ttg.unlink(t.segment);\n\t\t}\n\n\t\tlast.trackingGroup.link(ref);\n\t}\n\treturn revertibles;\n}\n\nfunction appendLocalAnnotateToRevertibles(\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\trevertibles: MergeTreeDeltaRevertible[],\n): MergeTreeDeltaRevertible[] {\n\tlet last = revertibles[revertibles.length - 1];\n\tfor (const ds of deltaArgs.deltaSegments) {\n\t\tconst propertyDeltas = ds.propertyDeltas;\n\t\tif (propertyDeltas) {\n\t\t\tif (\n\t\t\t\tlast?.operation === MergeTreeDeltaType.ANNOTATE &&\n\t\t\t\tmatchProperties(last?.propertyDeltas, propertyDeltas)\n\t\t\t) {\n\t\t\t\tlast.trackingGroup.link(ds.segment);\n\t\t\t} else {\n\t\t\t\tlast = {\n\t\t\t\t\toperation: MergeTreeDeltaType.ANNOTATE,\n\t\t\t\t\tpropertyDeltas,\n\t\t\t\t\ttrackingGroup: new UnorderedTrackingGroup(),\n\t\t\t\t};\n\t\t\t\tlast.trackingGroup.link(ds.segment);\n\t\t\t\trevertibles.push(last);\n\t\t\t}\n\t\t}\n\t}\n\treturn revertibles;\n}\n\n/**\n * Appends a merge tree delta to the list of revertibles.\n *\n * @legacy\n * @alpha\n */\nexport function appendToMergeTreeDeltaRevertibles(\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\trevertibles: MergeTreeDeltaRevertible[],\n): void {\n\tif (deltaArgs.deltaSegments.length === 0) {\n\t\treturn;\n\t}\n\tswitch (deltaArgs.operation) {\n\t\tcase MergeTreeDeltaType.INSERT: {\n\t\t\tappendLocalInsertToRevertibles(deltaArgs, revertibles);\n\t\t\tbreak;\n\t\t}\n\n\t\tcase MergeTreeDeltaType.REMOVE: {\n\t\t\tappendLocalRemoveToRevertibles(deltaArgs, revertibles);\n\t\t\tbreak;\n\t\t}\n\n\t\tcase MergeTreeDeltaType.ANNOTATE: {\n\t\t\tappendLocalAnnotateToRevertibles(deltaArgs, revertibles);\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault: {\n\t\t\tthrow new UsageError(\"Unsupported event delta type\", {\n\t\t\t\toperation: deltaArgs.operation,\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * Removes all revertibles from the list of revertibles.\n *\n * @legacy\n * @alpha\n */\nexport function discardMergeTreeDeltaRevertible(\n\trevertibles: MergeTreeDeltaRevertible[],\n): void {\n\tfor (const r of revertibles) {\n\t\tfor (const t of r.trackingGroup.tracked) {\n\t\t\tt.trackingCollection.unlink(r.trackingGroup);\n\t\t\t// remove untracked local references\n\t\t\tif (t.trackingCollection.empty && !t.isLeaf()) {\n\t\t\t\tconst segment: ISegmentPrivate | undefined = t.getSegment();\n\t\t\t\tsegment?.localRefs?.removeLocalRef(t);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction revertLocalInsert(\n\tdriver: MergeTreeRevertibleDriver,\n\tmergeTreeWithRevert: MergeTreeWithRevert,\n\trevertible: TypedRevertible<typeof MergeTreeDeltaType.INSERT>,\n): void {\n\twhile (revertible.trackingGroup.size > 0) {\n\t\tconst tracked = revertible.trackingGroup.tracked[0];\n\t\tassert(\n\t\t\ttracked.trackingCollection.unlink(revertible.trackingGroup),\n\t\t\t0x3f1 /* tracking group removed */,\n\t\t);\n\t\tassert(isSegmentLeaf(tracked), 0x3f2 /* inserts must track segments */);\n\t\tif (toRemovalInfo(tracked) === undefined) {\n\t\t\tconst start = getPosition(mergeTreeWithRevert, tracked);\n\t\t\tdriver.removeRange(start, start + tracked.cachedLength);\n\t\t}\n\t}\n}\n\nfunction revertLocalRemove(\n\tdriver: MergeTreeRevertibleDriver,\n\tmergeTreeWithRevert: MergeTreeWithRevert,\n\trevertible: TypedRevertible<typeof MergeTreeDeltaType.REMOVE>,\n): void {\n\twhile (revertible.trackingGroup.size > 0) {\n\t\tconst tracked = revertible.trackingGroup.tracked[0];\n\n\t\tassert(\n\t\t\ttracked.trackingCollection.unlink(revertible.trackingGroup),\n\t\t\t0x3f3 /* tracking group removed */,\n\t\t);\n\n\t\tassert(!tracked.isLeaf(), 0x3f4 /* removes must track local refs */);\n\n\t\tconst refSeg = tracked.getSegment();\n\t\tlet realPos = mergeTreeWithRevert.referencePositionToLocalPosition(tracked);\n\n\t\t// References which are on EndOfStringSegment don't return detached for pos,\n\t\t// they will return the length of the merge-tree. this case just catches\n\t\t// random references, likely not created in the revertible flow,\n\t\t// that are tying to be reverted for some reason.\n\t\tif (realPos === DetachedReferencePosition || !isSegmentLeaf(refSeg)) {\n\t\t\tthrow new UsageError(\"Cannot insert at detached references position\");\n\t\t}\n\n\t\tif (toRemovalInfo(refSeg) === undefined && refSeg.localRefs?.isAfterTombstone(tracked)) {\n\t\t\trealPos++;\n\t\t}\n\n\t\tconst props = tracked.properties as RemoveSegmentRefProperties;\n\t\tdriver.insertFromSpec(realPos, props.segSpec);\n\t\tconst insertSegment = mergeTreeWithRevert.getContainingSegment(\n\t\t\trealPos,\n\t\t\tmergeTreeWithRevert.localPerspective,\n\t\t).segment;\n\t\tassertSegmentLeaf(insertSegment);\n\n\t\tconst localSlideFilter = (lref: LocalReferencePosition): boolean =>\n\t\t\t(lref.properties as Partial<RemoveSegmentRefProperties>)?.referenceSpace ===\n\t\t\t\"mergeTreeDeltaRevertible\";\n\n\t\tconst insertRef: Partial<\n\t\t\tRecord<\"before\" | \"after\", DoublyLinkedList<LocalReferencePosition>>\n\t\t> = {};\n\t\tconst forward = insertSegment.ordinal < refSeg.ordinal;\n\t\tconst refHandler = (lref: LocalReferencePosition): false | undefined => {\n\t\t\t// once we reach it keep the original reference where it is\n\t\t\t// we'll move tracking groups, and remove it as a last step.\n\t\t\tif (tracked === lref) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (localSlideFilter(lref)) {\n\t\t\t\tif (forward) {\n\t\t\t\t\tconst before = (insertRef.before ??= new DoublyLinkedList());\n\t\t\t\t\tbefore.push(lref);\n\t\t\t\t} else {\n\t\t\t\t\tconst after = (insertRef.after ??= new DoublyLinkedList());\n\t\t\t\t\tafter.unshift(lref);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tdepthFirstNodeWalk(\n\t\t\tinsertSegment.parent,\n\t\t\tinsertSegment,\n\t\t\tundefined,\n\t\t\t(seg: ISegmentPrivate) => {\n\t\t\t\tif (seg.localRefs?.empty === false) {\n\t\t\t\t\treturn seg.localRefs.walkReferences(refHandler, undefined, forward);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tundefined,\n\t\t\tforward,\n\t\t);\n\t\tif (\n\t\t\tmergeTreeWithRevert?.__mergeTreeRevertible?.detachedReferences?.localRefs?.has(tracked)\n\t\t) {\n\t\t\tassert(forward, 0x3f6 /* forward should always be true when detached */);\n\t\t\tmergeTreeWithRevert?.__mergeTreeRevertible.detachedReferences.localRefs.walkReferences(\n\t\t\t\trefHandler,\n\t\t\t);\n\t\t}\n\n\t\tif (insertRef !== undefined) {\n\t\t\tconst localRefs = LocalReferenceCollection.setOrGet(insertSegment);\n\t\t\tif (insertRef.before?.empty === false) {\n\t\t\t\tlocalRefs.addBeforeTombstones(insertRef.before.map((n) => n.data));\n\t\t\t}\n\t\t\tif (insertRef.after?.empty === false) {\n\t\t\t\tlocalRefs.addAfterTombstones(insertRef.after.map((n) => n.data));\n\t\t\t}\n\t\t}\n\n\t\tfor (const tg of tracked.trackingCollection.trackingGroups) {\n\t\t\ttg.link(insertSegment);\n\t\t\ttg.unlink(tracked);\n\t\t}\n\t\tconst segment: ISegmentPrivate | undefined = tracked.getSegment();\n\t\tsegment?.localRefs?.removeLocalRef(tracked);\n\t}\n}\n\nfunction revertLocalAnnotate(\n\tdriver: MergeTreeRevertibleDriver,\n\tmergeTreeWithRevert: MergeTreeWithRevert,\n\trevertible: TypedRevertible<typeof MergeTreeDeltaType.ANNOTATE>,\n): void {\n\twhile (revertible.trackingGroup.size > 0) {\n\t\tconst tracked = revertible.trackingGroup.tracked[0];\n\t\tconst unlinked = tracked.trackingCollection.unlink(revertible.trackingGroup);\n\t\tassert(unlinked && isSegmentLeaf(tracked), 0x3f7 /* annotates must track segments */);\n\t\tif (toRemovalInfo(tracked) === undefined) {\n\t\t\tconst start = getPosition(mergeTreeWithRevert, tracked);\n\t\t\tdriver.annotateRange(start, start + tracked.cachedLength, revertible.propertyDeltas);\n\t\t}\n\t}\n}\n\nfunction getPosition(mergeTreeWithRevert: MergeTreeWithRevert, segment: ISegmentLeaf): number {\n\treturn mergeTreeWithRevert.getPosition(segment, mergeTreeWithRevert.localPerspective);\n}\n\n/**\n * Reverts all operations in the list of revertibles.\n *\n * @legacy\n * @alpha\n */\nexport function revertMergeTreeDeltaRevertibles(\n\tdriver: MergeTreeRevertibleDriver,\n\trevertibles: MergeTreeDeltaRevertible[],\n): void {\n\tlet mergeTreeWithRevert: MergeTreeWithRevert | undefined;\n\n\twhile (revertibles.length > 0) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tconst r = revertibles.pop()!;\n\t\tconst operation = r.operation;\n\t\tif (r.trackingGroup.size > 0) {\n\t\t\tmergeTreeWithRevert ??= findMergeTreeWithRevert(r.trackingGroup.tracked[0]);\n\t\t\tswitch (operation) {\n\t\t\t\tcase MergeTreeDeltaType.INSERT: {\n\t\t\t\t\trevertLocalInsert(driver, mergeTreeWithRevert, r);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase MergeTreeDeltaType.REMOVE: {\n\t\t\t\t\trevertLocalRemove(driver, mergeTreeWithRevert, r);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase MergeTreeDeltaType.ANNOTATE: {\n\t\t\t\t\trevertLocalAnnotate(driver, mergeTreeWithRevert, r);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(operation);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
package/dist/segmentInfos.d.ts
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { ISegmentInternal, ISegmentPrivate, MergeBlock } from "./mergeTreeNodes.js";
|
|
6
|
-
import type {
|
|
6
|
+
import type { InsertOperationStamp, RemoveOperationStamp } from "./stamps.js";
|
|
7
7
|
export interface StringToType {
|
|
8
8
|
"string": string;
|
|
9
9
|
"number": number;
|
|
10
10
|
"object": object;
|
|
11
|
-
"array": [];
|
|
11
|
+
"array": unknown[];
|
|
12
12
|
"boolean": boolean;
|
|
13
13
|
}
|
|
14
14
|
export declare function propExists<P extends string>(thing: unknown, prop: P): thing is Record<P, unknown>;
|
|
@@ -17,25 +17,8 @@ export declare function propInstanceOf<P extends string, T>(thing: unknown, prop
|
|
|
17
17
|
/**
|
|
18
18
|
* Contains insertion information associated to an {@link ISegment}.
|
|
19
19
|
*/
|
|
20
|
-
export interface
|
|
21
|
-
|
|
22
|
-
* Short clientId for the client that inserted this segment.
|
|
23
|
-
*/
|
|
24
|
-
clientId: number;
|
|
25
|
-
/**
|
|
26
|
-
* Local seq at which this segment was inserted.
|
|
27
|
-
* This is defined if and only if the insertion of the segment is pending ack, i.e. `seq` is UnassignedSequenceNumber.
|
|
28
|
-
* Once the segment is acked, this field is cleared.
|
|
29
|
-
*
|
|
30
|
-
* @privateRemarks
|
|
31
|
-
* See {@link CollaborationWindow.localSeq} for more information on the semantics of localSeq.
|
|
32
|
-
*/
|
|
33
|
-
localSeq?: number;
|
|
34
|
-
/**
|
|
35
|
-
* Seq at which this segment was inserted.
|
|
36
|
-
* If undefined, it is assumed the segment was inserted prior to the collab window's minimum sequence number.
|
|
37
|
-
*/
|
|
38
|
-
seq: number;
|
|
20
|
+
export interface IHasInsertionInfo {
|
|
21
|
+
insert: InsertOperationStamp;
|
|
39
22
|
}
|
|
40
23
|
/**
|
|
41
24
|
* Converts a segment-like object to an insertion info object if possible.
|
|
@@ -43,7 +26,7 @@ export interface IInsertionInfo {
|
|
|
43
26
|
* @param segmentLike - The segment-like object to convert.
|
|
44
27
|
* @returns The insertion info object if the conversion is possible, otherwise undefined.
|
|
45
28
|
*/
|
|
46
|
-
export declare const toInsertionInfo: (segmentLike: unknown) =>
|
|
29
|
+
export declare const toInsertionInfo: (segmentLike: unknown) => IHasInsertionInfo | undefined;
|
|
47
30
|
/**
|
|
48
31
|
* A type-guard which determines if the segment has insertion info, and
|
|
49
32
|
* returns true if it does, along with applying strong typing.
|
|
@@ -51,14 +34,14 @@ export declare const toInsertionInfo: (segmentLike: unknown) => IInsertionInfo |
|
|
|
51
34
|
* @param segmentLike - The segment-like object to check.
|
|
52
35
|
* @returns True if the segment has insertion info, otherwise false.
|
|
53
36
|
*/
|
|
54
|
-
export declare const isInserted: (segmentLike: unknown) => segmentLike is
|
|
37
|
+
export declare const isInserted: (segmentLike: unknown) => segmentLike is IHasInsertionInfo;
|
|
55
38
|
/**
|
|
56
39
|
* Asserts that the segment has insertion info. Usage of this function should not produce a user facing error.
|
|
57
40
|
*
|
|
58
41
|
* @param segmentLike - The segment-like object to check.
|
|
59
42
|
* @throws Will throw an error if the segment does not have insertion info.
|
|
60
43
|
*/
|
|
61
|
-
export declare const assertInserted: <T extends Partial<
|
|
44
|
+
export declare const assertInserted: <T extends Partial<IHasInsertionInfo> | undefined>(segmentLike: ISegmentInternal | Partial<IHasInsertionInfo> | T) => asserts segmentLike is IHasInsertionInfo | Exclude<T, Partial<IHasInsertionInfo>>;
|
|
62
45
|
/**
|
|
63
46
|
* Common properties for a node in a merge tree.
|
|
64
47
|
*/
|
|
@@ -108,24 +91,15 @@ export declare const assertMergeNode: <T extends Partial<IMergeNodeInfo> | undef
|
|
|
108
91
|
*/
|
|
109
92
|
export declare const removeMergeNodeInfo: (nodeLike: IMergeNodeInfo) => asserts nodeLike is never;
|
|
110
93
|
/**
|
|
111
|
-
* Contains removal information associated
|
|
94
|
+
* Contains removal information associated with an {@link ISegment}.
|
|
95
|
+
*
|
|
96
|
+
* Segments can be removed concurrently by multiple clients.
|
|
112
97
|
*/
|
|
113
|
-
export interface
|
|
114
|
-
/**
|
|
115
|
-
* Local seq at which this segment was removed, if the removal is yet-to-be acked.
|
|
116
|
-
*/
|
|
117
|
-
localRemovedSeq?: number;
|
|
98
|
+
export interface IHasRemovalInfo {
|
|
118
99
|
/**
|
|
119
|
-
*
|
|
100
|
+
* Operation stamps which have removed this segment. This list is sorted by stamp order, where removes[0] is the earliest removal.
|
|
120
101
|
*/
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* List of client IDs that have removed this segment.
|
|
124
|
-
* The client that actually removed the segment (i.e. whose removal op was sequenced first) is stored as the first
|
|
125
|
-
* client in this list. Other clients in the list have all issued concurrent ops to remove the segment.
|
|
126
|
-
* @remarks When this list has length \> 1, this is referred to as the "overlapping remove" case.
|
|
127
|
-
*/
|
|
128
|
-
removedClientIds: number[];
|
|
102
|
+
removes: RemoveOperationStamp[];
|
|
129
103
|
}
|
|
130
104
|
/**
|
|
131
105
|
* Converts a segment-like object to a removal info object if possible.
|
|
@@ -133,7 +107,7 @@ export interface IRemovalInfo {
|
|
|
133
107
|
* @param segmentLike - The segment-like object to convert.
|
|
134
108
|
* @returns The removal info object if the conversion is possible, otherwise undefined.
|
|
135
109
|
*/
|
|
136
|
-
export declare const toRemovalInfo: (segmentLike: unknown) =>
|
|
110
|
+
export declare const toRemovalInfo: (segmentLike: unknown) => IHasRemovalInfo | undefined;
|
|
137
111
|
/**
|
|
138
112
|
* A type-guard which determines if the segment has removal info, and
|
|
139
113
|
* returns true if it does, along with applying strong typing.
|
|
@@ -141,14 +115,14 @@ export declare const toRemovalInfo: (segmentLike: unknown) => IRemovalInfo | und
|
|
|
141
115
|
* @param segmentLike - The segment-like object to check.
|
|
142
116
|
* @returns True if the segment has removal info, otherwise false.
|
|
143
117
|
*/
|
|
144
|
-
export declare const isRemoved: (segmentLike: unknown) => segmentLike is
|
|
118
|
+
export declare const isRemoved: (segmentLike: unknown) => segmentLike is IHasRemovalInfo;
|
|
145
119
|
/**
|
|
146
120
|
* Asserts that the segment has removal info. Usage of this function should not produce a user facing error.
|
|
147
121
|
*
|
|
148
122
|
* @param segmentLike - The segment-like object to check.
|
|
149
123
|
* @throws Will throw an error if the segment does not have removal info.
|
|
150
124
|
*/
|
|
151
|
-
export declare const assertRemoved: <T extends Partial<
|
|
125
|
+
export declare const assertRemoved: <T extends Partial<IHasRemovalInfo> | undefined>(segmentLike: ISegmentInternal | Partial<IHasRemovalInfo> | T) => asserts segmentLike is IHasRemovalInfo | Exclude<T, Partial<IHasRemovalInfo>>;
|
|
152
126
|
/**
|
|
153
127
|
* Removes the removal info. This is used in rollback.
|
|
154
128
|
* @param segmentLike - The segment-like object to check.
|
|
@@ -156,62 +130,9 @@ export declare const assertRemoved: <T extends Partial<IRemovalInfo> | undefined
|
|
|
156
130
|
* ensures no further usage of the removed removal info is allowed. if continued use is required other
|
|
157
131
|
* type coercion methods should be use to correctly re-type the variable.
|
|
158
132
|
*/
|
|
159
|
-
export declare const removeRemovalInfo: (nodeLike:
|
|
160
|
-
/**
|
|
161
|
-
* Tracks information about when and where this segment was moved to.
|
|
162
|
-
*
|
|
163
|
-
* Note that merge-tree does not currently support moving and only supports
|
|
164
|
-
* obliterate. The fields below include "move" in their names to avoid renaming
|
|
165
|
-
* in the future, when moves _are_ supported.
|
|
166
|
-
*/
|
|
167
|
-
export interface IMoveInfo {
|
|
168
|
-
/**
|
|
169
|
-
* Local seq at which this segment was moved if the move is yet-to-be
|
|
170
|
-
* acked.
|
|
171
|
-
*/
|
|
172
|
-
localMovedSeq?: number;
|
|
173
|
-
/**
|
|
174
|
-
* The first seq at which this segment was moved.
|
|
175
|
-
*/
|
|
176
|
-
movedSeq: number;
|
|
177
|
-
/**
|
|
178
|
-
* All seqs at which this segment was moved. In the case of overlapping,
|
|
179
|
-
* concurrent moves this array will contain multiple seqs.
|
|
180
|
-
*
|
|
181
|
-
* The seq at `movedSeqs[i]` corresponds to the client id at `movedClientIds[i]`.
|
|
182
|
-
*
|
|
183
|
-
* The first element corresponds to the seq of the first move
|
|
184
|
-
*/
|
|
185
|
-
movedSeqs: number[];
|
|
186
|
-
/**
|
|
187
|
-
* A reference to the inserted destination segment corresponding to this
|
|
188
|
-
* segment's move.
|
|
189
|
-
*
|
|
190
|
-
* If undefined, the move was an obliterate.
|
|
191
|
-
*
|
|
192
|
-
* Currently this field is unused, as we only support obliterate operations
|
|
193
|
-
*/
|
|
194
|
-
moveDst?: ReferencePosition;
|
|
195
|
-
/**
|
|
196
|
-
* List of client IDs that have moved this segment.
|
|
197
|
-
*
|
|
198
|
-
* The client that actually moved the segment (i.e. whose move op was sequenced
|
|
199
|
-
* first) is stored as the first client in this list. Other clients in the
|
|
200
|
-
* list have all issued concurrent ops to move the segment.
|
|
201
|
-
*/
|
|
202
|
-
movedClientIds: number[];
|
|
203
|
-
}
|
|
204
|
-
export declare const toMoveInfo: (segmentLike: unknown) => IMoveInfo | undefined;
|
|
205
|
-
/**
|
|
206
|
-
* A type-guard which determines if the segment has move info, and
|
|
207
|
-
* returns true if it does, along with applying strong typing.
|
|
208
|
-
*
|
|
209
|
-
* @param segmentLike - The segment-like object to check.
|
|
210
|
-
* @returns True if the segment has move info, otherwise false.
|
|
211
|
-
*/
|
|
212
|
-
export declare const isMoved: (segmentLike: unknown) => segmentLike is IMoveInfo;
|
|
133
|
+
export declare const removeRemovalInfo: (nodeLike: IHasRemovalInfo) => asserts nodeLike is never;
|
|
213
134
|
/**
|
|
214
|
-
* Returns whether this segment was marked
|
|
135
|
+
* Returns whether this segment was marked removed as soon as its insertion was acked.
|
|
215
136
|
*
|
|
216
137
|
* This can happen when an an insert occurs concurrent to an obliterate over the range the segment was inserted into,
|
|
217
138
|
* and the obliterate was sequenced first.
|
|
@@ -219,18 +140,11 @@ export declare const isMoved: (segmentLike: unknown) => segmentLike is IMoveInfo
|
|
|
219
140
|
* When this happens, the segment is only ever visible to the client that inserted the segment
|
|
220
141
|
* (and only until that client has seen the obliterate which removed their segment).
|
|
221
142
|
*/
|
|
222
|
-
export declare function
|
|
223
|
-
/**
|
|
224
|
-
* Asserts that the segment has move info. Usage of this function should not produce a user facing error.
|
|
225
|
-
*
|
|
226
|
-
* @param segmentLike - The segment-like object to check.
|
|
227
|
-
* @throws Will throw an error if the segment does not have move info.
|
|
228
|
-
*/
|
|
229
|
-
export declare const assertMoved: <T extends Partial<IMoveInfo> | undefined>(segmentLike: ISegmentInternal | Partial<IMoveInfo> | T) => asserts segmentLike is IMoveInfo | Exclude<T, Partial<IMoveInfo>>;
|
|
143
|
+
export declare function wasRemovedOnInsert(segment: IHasInsertionInfo & ISegmentPrivate): boolean;
|
|
230
144
|
/**
|
|
231
145
|
* A union type representing any segment info.
|
|
232
146
|
*/
|
|
233
|
-
export type SegmentInfo = IMergeNodeInfo |
|
|
147
|
+
export type SegmentInfo = IMergeNodeInfo | IHasInsertionInfo | IHasRemovalInfo;
|
|
234
148
|
/**
|
|
235
149
|
* A type representing a segment with additional info.
|
|
236
150
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmentInfos.d.ts","sourceRoot":"","sources":["../src/segmentInfos.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"segmentInfos.d.ts","sourceRoot":"","sources":["../src/segmentInfos.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,WAAW,YAAY;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAC1C,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,CAAC,GACL,KAAK,IAAI,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAE7B;AAED,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,YAAY,EACrE,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,CAAC,GACL,KAAK,IAAI,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,OAAO,IAAI,CAAC,CAAC,CAK/C;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EACjD,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GAC7B,KAAK,IAAI,MAAM,CAAC,CAAC,EAAE,C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|
7
|
-
exports.overwriteInfo = exports.
|
|
7
|
+
exports.overwriteInfo = exports.wasRemovedOnInsert = exports.removeRemovalInfo = exports.assertRemoved = exports.isRemoved = exports.toRemovalInfo = exports.removeMergeNodeInfo = exports.assertMergeNode = exports.isMergeNodeInfo = exports.toMergeNodeInfo = exports.assertInserted = exports.isInserted = exports.toInsertionInfo = exports.propInstanceOf = exports.hasProp = exports.propExists = void 0;
|
|
8
8
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
9
|
const constants_js_1 = require("./constants.js");
|
|
10
10
|
const mergeTreeNodes_js_1 = require("./mergeTreeNodes.js");
|
|
@@ -27,9 +27,14 @@ exports.propInstanceOf = propInstanceOf;
|
|
|
27
27
|
* @param segmentLike - The segment-like object to convert.
|
|
28
28
|
* @returns The insertion info object if the conversion is possible, otherwise undefined.
|
|
29
29
|
*/
|
|
30
|
-
const toInsertionInfo = (segmentLike) =>
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const toInsertionInfo = (segmentLike) => {
|
|
31
|
+
return segmentLike !== undefined &&
|
|
32
|
+
hasProp(segmentLike, "insert", "object") &&
|
|
33
|
+
hasProp(segmentLike.insert, "clientId", "number") &&
|
|
34
|
+
hasProp(segmentLike.insert, "seq", "number")
|
|
35
|
+
? segmentLike
|
|
36
|
+
: undefined;
|
|
37
|
+
};
|
|
33
38
|
exports.toInsertionInfo = toInsertionInfo;
|
|
34
39
|
/**
|
|
35
40
|
* A type-guard which determines if the segment has insertion info, and
|
|
@@ -96,10 +101,14 @@ exports.removeMergeNodeInfo = removeMergeNodeInfo;
|
|
|
96
101
|
* @param segmentLike - The segment-like object to convert.
|
|
97
102
|
* @returns The removal info object if the conversion is possible, otherwise undefined.
|
|
98
103
|
*/
|
|
99
|
-
const toRemovalInfo = (segmentLike) =>
|
|
100
|
-
hasProp(segmentLike, "
|
|
101
|
-
|
|
102
|
-
|
|
104
|
+
const toRemovalInfo = (segmentLike) => {
|
|
105
|
+
return hasProp(segmentLike, "removes", "array") &&
|
|
106
|
+
segmentLike.removes.length > 0 &&
|
|
107
|
+
hasProp(segmentLike.removes[0], "clientId", "number") &&
|
|
108
|
+
hasProp(segmentLike.removes[0], "seq", "number")
|
|
109
|
+
? segmentLike
|
|
110
|
+
: undefined;
|
|
111
|
+
};
|
|
103
112
|
exports.toRemovalInfo = toRemovalInfo;
|
|
104
113
|
/**
|
|
105
114
|
* A type-guard which determines if the segment has removal info, and
|
|
@@ -108,6 +117,8 @@ exports.toRemovalInfo = toRemovalInfo;
|
|
|
108
117
|
* @param segmentLike - The segment-like object to check.
|
|
109
118
|
* @returns True if the segment has removal info, otherwise false.
|
|
110
119
|
*/
|
|
120
|
+
// export const isRemoved = (segmentLike: unknown): segmentLike is IHasRemovalInfo =>
|
|
121
|
+
// toRemovalInfo(segmentLike) !== undefined;
|
|
111
122
|
const isRemoved = (segmentLike) => (0, exports.toRemovalInfo)(segmentLike) !== undefined;
|
|
112
123
|
exports.isRemoved = isRemoved;
|
|
113
124
|
/**
|
|
@@ -126,28 +137,11 @@ exports.assertRemoved = assertRemoved;
|
|
|
126
137
|
* type coercion methods should be use to correctly re-type the variable.
|
|
127
138
|
*/
|
|
128
139
|
const removeRemovalInfo = (nodeLike) => Object.assign(nodeLike, {
|
|
129
|
-
|
|
130
|
-
removedClientIds: undefined,
|
|
131
|
-
removedSeq: undefined,
|
|
140
|
+
removes: undefined,
|
|
132
141
|
});
|
|
133
142
|
exports.removeRemovalInfo = removeRemovalInfo;
|
|
134
|
-
const toMoveInfo = (segmentLike) => hasProp(segmentLike, "movedClientIds", "array") &&
|
|
135
|
-
hasProp(segmentLike, "movedSeq", "number") &&
|
|
136
|
-
hasProp(segmentLike, "movedSeqs", "array")
|
|
137
|
-
? segmentLike
|
|
138
|
-
: undefined;
|
|
139
|
-
exports.toMoveInfo = toMoveInfo;
|
|
140
|
-
/**
|
|
141
|
-
* A type-guard which determines if the segment has move info, and
|
|
142
|
-
* returns true if it does, along with applying strong typing.
|
|
143
|
-
*
|
|
144
|
-
* @param segmentLike - The segment-like object to check.
|
|
145
|
-
* @returns True if the segment has move info, otherwise false.
|
|
146
|
-
*/
|
|
147
|
-
const isMoved = (segmentLike) => (0, exports.toMoveInfo)(segmentLike) !== undefined;
|
|
148
|
-
exports.isMoved = isMoved;
|
|
149
143
|
/**
|
|
150
|
-
* Returns whether this segment was marked
|
|
144
|
+
* Returns whether this segment was marked removed as soon as its insertion was acked.
|
|
151
145
|
*
|
|
152
146
|
* This can happen when an an insert occurs concurrent to an obliterate over the range the segment was inserted into,
|
|
153
147
|
* and the obliterate was sequenced first.
|
|
@@ -155,24 +149,16 @@ exports.isMoved = isMoved;
|
|
|
155
149
|
* When this happens, the segment is only ever visible to the client that inserted the segment
|
|
156
150
|
* (and only until that client has seen the obliterate which removed their segment).
|
|
157
151
|
*/
|
|
158
|
-
function
|
|
159
|
-
const
|
|
160
|
-
const
|
|
161
|
-
if (
|
|
152
|
+
function wasRemovedOnInsert(segment) {
|
|
153
|
+
const removeInfo = (0, exports.toRemovalInfo)(segment);
|
|
154
|
+
const removedSeq = removeInfo?.removes[0].seq;
|
|
155
|
+
if (removedSeq === undefined || removedSeq === constants_js_1.UnassignedSequenceNumber) {
|
|
162
156
|
return false;
|
|
163
157
|
}
|
|
164
|
-
const insertSeq = segment.seq;
|
|
165
|
-
return insertSeq === constants_js_1.UnassignedSequenceNumber || insertSeq >
|
|
158
|
+
const insertSeq = segment.insert.seq;
|
|
159
|
+
return insertSeq === constants_js_1.UnassignedSequenceNumber || insertSeq > removedSeq;
|
|
166
160
|
}
|
|
167
|
-
exports.
|
|
168
|
-
/**
|
|
169
|
-
* Asserts that the segment has move info. Usage of this function should not produce a user facing error.
|
|
170
|
-
*
|
|
171
|
-
* @param segmentLike - The segment-like object to check.
|
|
172
|
-
* @throws Will throw an error if the segment does not have move info.
|
|
173
|
-
*/
|
|
174
|
-
const assertMoved = (segmentLike) => (0, internal_1.assert)(segmentLike === undefined || (0, exports.isMoved)(segmentLike), 0xaa3 /* must be moveInfo */);
|
|
175
|
-
exports.assertMoved = assertMoved;
|
|
161
|
+
exports.wasRemovedOnInsert = wasRemovedOnInsert;
|
|
176
162
|
/**
|
|
177
163
|
* Overwrites the segment info on a segment-like object.
|
|
178
164
|
*
|