@fluidframework/merge-tree 2.1.0-276985 → 2.1.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/.eslintrc.cjs +2 -4
- package/CHANGELOG.md +15 -0
- package/README.md +109 -1
- package/api-extractor/api-extractor.current.json +5 -0
- package/api-extractor/api-extractor.legacy.json +1 -1
- package/api-extractor.json +1 -1
- package/api-report/merge-tree.legacy.alpha.api.md +10 -22
- package/api-report/merge-tree.legacy.public.api.md +9 -0
- package/dist/MergeTreeTextHelper.d.ts.map +1 -1
- package/dist/MergeTreeTextHelper.js +1 -1
- package/dist/MergeTreeTextHelper.js.map +1 -1
- package/dist/attributionCollection.d.ts.map +1 -1
- package/dist/attributionCollection.js +65 -17
- package/dist/attributionCollection.js.map +1 -1
- package/dist/attributionPolicy.d.ts +2 -1
- package/dist/attributionPolicy.d.ts.map +1 -1
- package/dist/attributionPolicy.js +10 -3
- package/dist/attributionPolicy.js.map +1 -1
- package/dist/client.d.ts +3 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +65 -37
- package/dist/client.js.map +1 -1
- package/dist/collections/list.d.ts.map +1 -1
- package/dist/collections/list.js +5 -2
- package/dist/collections/list.js.map +1 -1
- package/dist/collections/rbTree.d.ts +2 -2
- package/dist/collections/rbTree.d.ts.map +1 -1
- package/dist/collections/rbTree.js +23 -35
- package/dist/collections/rbTree.js.map +1 -1
- package/dist/endOfTreeSegment.d.ts.map +1 -1
- package/dist/endOfTreeSegment.js +4 -1
- package/dist/endOfTreeSegment.js.map +1 -1
- package/dist/legacy.d.ts +1 -1
- package/dist/localReference.d.ts +16 -6
- package/dist/localReference.d.ts.map +1 -1
- package/dist/localReference.js +31 -20
- package/dist/localReference.js.map +1 -1
- package/dist/mergeTree.d.ts +0 -1
- package/dist/mergeTree.d.ts.map +1 -1
- package/dist/mergeTree.js +127 -112
- package/dist/mergeTree.js.map +1 -1
- package/dist/mergeTreeNodeWalk.d.ts.map +1 -1
- package/dist/mergeTreeNodeWalk.js +1 -1
- package/dist/mergeTreeNodeWalk.js.map +1 -1
- package/dist/mergeTreeNodes.d.ts +6 -5
- package/dist/mergeTreeNodes.d.ts.map +1 -1
- package/dist/mergeTreeNodes.js +29 -20
- package/dist/mergeTreeNodes.js.map +1 -1
- package/dist/mergeTreeTracking.js +3 -3
- package/dist/mergeTreeTracking.js.map +1 -1
- package/dist/opBuilder.d.ts +6 -1
- package/dist/opBuilder.d.ts.map +1 -1
- package/dist/opBuilder.js +5 -0
- package/dist/opBuilder.js.map +1 -1
- package/dist/ops.d.ts.map +1 -1
- package/dist/ops.js.map +1 -1
- package/dist/ordinal.d.ts.map +1 -1
- package/dist/ordinal.js +7 -0
- package/dist/ordinal.js.map +1 -1
- package/dist/partialLengths.d.ts +4 -2
- package/dist/partialLengths.d.ts.map +1 -1
- package/dist/partialLengths.js +101 -53
- package/dist/partialLengths.js.map +1 -1
- package/dist/perspective.d.ts +4 -1
- package/dist/perspective.d.ts.map +1 -1
- package/dist/perspective.js +7 -6
- package/dist/perspective.js.map +1 -1
- package/dist/properties.d.ts +13 -10
- package/dist/properties.d.ts.map +1 -1
- package/dist/properties.js +22 -11
- package/dist/properties.js.map +1 -1
- package/dist/public.d.ts +1 -1
- package/dist/referencePositions.d.ts +7 -0
- package/dist/referencePositions.d.ts.map +1 -1
- package/dist/referencePositions.js +7 -0
- package/dist/referencePositions.js.map +1 -1
- package/dist/revertibles.d.ts +6 -0
- package/dist/revertibles.d.ts.map +1 -1
- package/dist/revertibles.js +50 -21
- package/dist/revertibles.js.map +1 -1
- package/dist/segmentGroupCollection.d.ts.map +1 -1
- package/dist/segmentGroupCollection.js +2 -0
- package/dist/segmentGroupCollection.js.map +1 -1
- package/dist/segmentPropertiesManager.d.ts +7 -3
- package/dist/segmentPropertiesManager.d.ts.map +1 -1
- package/dist/segmentPropertiesManager.js +20 -15
- package/dist/segmentPropertiesManager.js.map +1 -1
- package/dist/snapshotChunks.d.ts.map +1 -1
- package/dist/snapshotChunks.js +10 -5
- package/dist/snapshotChunks.js.map +1 -1
- package/dist/snapshotLoader.d.ts.map +1 -1
- package/dist/snapshotLoader.js +14 -10
- package/dist/snapshotLoader.js.map +1 -1
- package/dist/snapshotV1.d.ts.map +1 -1
- package/dist/snapshotV1.js +20 -8
- package/dist/snapshotV1.js.map +1 -1
- package/dist/snapshotlegacy.d.ts.map +1 -1
- package/dist/snapshotlegacy.js +4 -2
- package/dist/snapshotlegacy.js.map +1 -1
- package/dist/sortedSegmentSet.d.ts.map +1 -1
- package/dist/sortedSegmentSet.js +8 -1
- package/dist/sortedSegmentSet.js.map +1 -1
- package/dist/sortedSet.d.ts.map +1 -1
- package/dist/sortedSet.js +4 -0
- package/dist/sortedSet.js.map +1 -1
- package/dist/test/Insertion.perf.spec.js.map +1 -1
- package/dist/test/Removal.perf.spec.js.map +1 -1
- package/dist/test/Snapshot.perf.spec.js +1 -0
- package/dist/test/Snapshot.perf.spec.js.map +1 -1
- package/dist/test/attributionCollection.perf.spec.js +3 -1
- package/dist/test/attributionCollection.perf.spec.js.map +1 -1
- package/dist/test/attributionCollection.spec.js +69 -68
- package/dist/test/attributionCollection.spec.js.map +1 -1
- package/dist/test/attributionPolicy.spec.js +29 -27
- package/dist/test/attributionPolicy.spec.js.map +1 -1
- package/dist/test/beastTest.spec.d.ts +1 -4
- package/dist/test/beastTest.spec.d.ts.map +1 -1
- package/dist/test/beastTest.spec.js +32 -30
- package/dist/test/beastTest.spec.js.map +1 -1
- package/dist/test/client.annotateMarker.spec.js +5 -5
- package/dist/test/client.annotateMarker.spec.js.map +1 -1
- package/dist/test/client.apis.spec.d.ts.map +1 -1
- package/dist/test/client.apis.spec.js +5 -7
- package/dist/test/client.apis.spec.js.map +1 -1
- package/dist/test/client.applyMsg.spec.js +125 -103
- package/dist/test/client.applyMsg.spec.js.map +1 -1
- package/dist/test/client.applyStashedOpFarm.spec.js +18 -10
- package/dist/test/client.applyStashedOpFarm.spec.js.map +1 -1
- package/dist/test/client.attributionFarm.spec.js +13 -8
- package/dist/test/client.attributionFarm.spec.js.map +1 -1
- package/dist/test/client.conflictFarm.spec.js +4 -2
- package/dist/test/client.conflictFarm.spec.js.map +1 -1
- package/dist/test/client.getPosition.spec.js +10 -10
- package/dist/test/client.getPosition.spec.js.map +1 -1
- package/dist/test/client.localReference.spec.js +111 -104
- package/dist/test/client.localReference.spec.js.map +1 -1
- package/dist/test/client.localReferenceFarm.spec.js +14 -10
- package/dist/test/client.localReferenceFarm.spec.js.map +1 -1
- package/dist/test/client.rebasePosition.spec.js +12 -12
- package/dist/test/client.rebasePosition.spec.js.map +1 -1
- package/dist/test/client.reconnectFarm.spec.js +12 -9
- package/dist/test/client.reconnectFarm.spec.js.map +1 -1
- package/dist/test/client.replay.spec.js +11 -10
- package/dist/test/client.replay.spec.js.map +1 -1
- package/dist/test/client.rollback.spec.js +87 -84
- package/dist/test/client.rollback.spec.js.map +1 -1
- package/dist/test/client.rollbackFarm.spec.js +3 -1
- package/dist/test/client.rollbackFarm.spec.js.map +1 -1
- package/dist/test/client.searchForMarker.spec.js +122 -112
- package/dist/test/client.searchForMarker.spec.js.map +1 -1
- package/dist/test/client.walkSegments.spec.js +7 -7
- package/dist/test/client.walkSegments.spec.js.map +1 -1
- package/dist/test/collections.list.spec.js +14 -14
- package/dist/test/collections.list.spec.js.map +1 -1
- package/dist/test/createInsertOnlyAttributionPolicy.spec.js +3 -3
- package/dist/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -1
- package/dist/test/dirname.cjs +1 -0
- package/dist/test/dirname.cjs.map +1 -1
- package/dist/test/dirname.d.cts.map +1 -1
- package/dist/test/mergeTree.annotate.deltaCallback.spec.js +7 -7
- package/dist/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -1
- package/dist/test/mergeTree.annotate.spec.js +87 -87
- package/dist/test/mergeTree.annotate.spec.js.map +1 -1
- package/dist/test/mergeTree.insert.deltaCallback.spec.js +6 -6
- package/dist/test/mergeTree.insert.deltaCallback.spec.js.map +1 -1
- package/dist/test/mergeTree.insertingWalk.spec.js +24 -24
- package/dist/test/mergeTree.insertingWalk.spec.js.map +1 -1
- package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +6 -6
- package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
- package/dist/test/mergeTree.markRangeRemoved.spec.js +23 -23
- package/dist/test/mergeTree.markRangeRemoved.spec.js.map +1 -1
- package/dist/test/mergeTree.walk.spec.js +3 -3
- package/dist/test/mergeTree.walk.spec.js.map +1 -1
- package/dist/test/mergeTree.zamboni.spec.js +10 -10
- package/dist/test/mergeTree.zamboni.spec.js.map +1 -1
- package/dist/test/mergeTreeOperationRunner.d.ts.map +1 -1
- package/dist/test/mergeTreeOperationRunner.js +28 -16
- package/dist/test/mergeTreeOperationRunner.js.map +1 -1
- package/dist/test/mergeTreeOperationRunner.spec.js +9 -5
- package/dist/test/mergeTreeOperationRunner.spec.js.map +1 -1
- package/dist/test/obliterate.concurrent.spec.js +165 -165
- package/dist/test/obliterate.concurrent.spec.js.map +1 -1
- package/dist/test/obliterate.deltaCallback.spec.js +20 -21
- package/dist/test/obliterate.deltaCallback.spec.js.map +1 -1
- package/dist/test/obliterate.partialLength.spec.js +7 -7
- package/dist/test/obliterate.partialLength.spec.js.map +1 -1
- package/dist/test/obliterate.reconnect.spec.js +13 -13
- package/dist/test/obliterate.reconnect.spec.js.map +1 -1
- package/dist/test/obliterate.spec.js +9 -9
- package/dist/test/obliterate.spec.js.map +1 -1
- package/dist/test/ordinal.spec.js +10 -4
- package/dist/test/ordinal.spec.js.map +1 -1
- package/dist/test/partialLength.spec.js.map +1 -1
- package/dist/test/properties.spec.js +15 -15
- package/dist/test/properties.spec.js.map +1 -1
- package/dist/test/reconnectHelper.d.ts +4 -4
- package/dist/test/reconnectHelper.d.ts.map +1 -1
- package/dist/test/reconnectHelper.js +28 -20
- package/dist/test/reconnectHelper.js.map +1 -1
- package/dist/test/resetPendingSegmentsToOp.spec.js +35 -29
- package/dist/test/resetPendingSegmentsToOp.spec.js.map +1 -1
- package/dist/test/revertibleFarm.spec.js +11 -10
- package/dist/test/revertibleFarm.spec.js.map +1 -1
- package/dist/test/revertibles.spec.d.ts.map +1 -1
- package/dist/test/revertibles.spec.js +96 -57
- package/dist/test/revertibles.spec.js.map +1 -1
- package/dist/test/segmentGroupCollection.spec.js +17 -17
- package/dist/test/segmentGroupCollection.spec.js.map +1 -1
- package/dist/test/snapshot.spec.js +5 -5
- package/dist/test/snapshot.spec.js.map +1 -1
- package/dist/test/snapshot.utils.d.ts.map +1 -1
- package/dist/test/snapshot.utils.js +6 -6
- package/dist/test/snapshot.utils.js.map +1 -1
- package/dist/test/snapshotlegacy.spec.js +18 -13
- package/dist/test/snapshotlegacy.spec.js.map +1 -1
- package/dist/test/sortedSegmentSet.spec.js +22 -18
- package/dist/test/sortedSegmentSet.spec.js.map +1 -1
- package/dist/test/testClient.d.ts +6 -5
- package/dist/test/testClient.d.ts.map +1 -1
- package/dist/test/testClient.js +30 -32
- package/dist/test/testClient.js.map +1 -1
- package/dist/test/testClientLogger.d.ts.map +1 -1
- package/dist/test/testClientLogger.js +39 -38
- package/dist/test/testClientLogger.js.map +1 -1
- package/dist/test/testSerializer.d.ts +5 -5
- package/dist/test/testSerializer.d.ts.map +1 -1
- package/dist/test/testSerializer.js +0 -1
- package/dist/test/testSerializer.js.map +1 -1
- package/dist/test/testServer.d.ts.map +1 -1
- package/dist/test/testServer.js.map +1 -1
- package/dist/test/testUtils.d.ts +1 -1
- package/dist/test/testUtils.d.ts.map +1 -1
- package/dist/test/testUtils.js +15 -17
- package/dist/test/testUtils.js.map +1 -1
- package/dist/test/text.d.ts.map +1 -1
- package/dist/test/text.js +1 -1
- package/dist/test/text.js.map +1 -1
- package/dist/test/tracking.spec.js +50 -46
- package/dist/test/tracking.spec.js.map +1 -1
- package/dist/test/wordUnitTests.spec.d.ts.map +1 -1
- package/dist/test/wordUnitTests.spec.js +10 -10
- package/dist/test/wordUnitTests.spec.js.map +1 -1
- package/dist/textSegment.d.ts +1 -1
- package/dist/textSegment.d.ts.map +1 -1
- package/dist/textSegment.js +3 -3
- package/dist/textSegment.js.map +1 -1
- package/dist/zamboni.d.ts.map +1 -1
- package/dist/zamboni.js +7 -2
- package/dist/zamboni.js.map +1 -1
- package/internal.d.ts +1 -1
- package/legacy.d.ts +1 -1
- package/lib/MergeTreeTextHelper.d.ts.map +1 -1
- package/lib/MergeTreeTextHelper.js +1 -1
- package/lib/MergeTreeTextHelper.js.map +1 -1
- package/lib/attributionCollection.d.ts.map +1 -1
- package/lib/attributionCollection.js +65 -17
- package/lib/attributionCollection.js.map +1 -1
- package/lib/attributionPolicy.d.ts +2 -1
- package/lib/attributionPolicy.d.ts.map +1 -1
- package/lib/attributionPolicy.js +10 -3
- package/lib/attributionPolicy.js.map +1 -1
- package/lib/client.d.ts +3 -1
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +65 -37
- package/lib/client.js.map +1 -1
- package/lib/collections/list.d.ts.map +1 -1
- package/lib/collections/list.js +5 -2
- package/lib/collections/list.js.map +1 -1
- package/lib/collections/rbTree.d.ts +2 -2
- package/lib/collections/rbTree.d.ts.map +1 -1
- package/lib/collections/rbTree.js +23 -35
- package/lib/collections/rbTree.js.map +1 -1
- package/lib/endOfTreeSegment.d.ts.map +1 -1
- package/lib/endOfTreeSegment.js +4 -1
- package/lib/endOfTreeSegment.js.map +1 -1
- package/lib/legacy.d.ts +1 -1
- package/lib/localReference.d.ts +16 -6
- package/lib/localReference.d.ts.map +1 -1
- package/lib/localReference.js +31 -20
- package/lib/localReference.js.map +1 -1
- package/lib/mergeTree.d.ts +0 -1
- package/lib/mergeTree.d.ts.map +1 -1
- package/lib/mergeTree.js +127 -112
- package/lib/mergeTree.js.map +1 -1
- package/lib/mergeTreeNodeWalk.d.ts.map +1 -1
- package/lib/mergeTreeNodeWalk.js +1 -1
- package/lib/mergeTreeNodeWalk.js.map +1 -1
- package/lib/mergeTreeNodes.d.ts +6 -5
- package/lib/mergeTreeNodes.d.ts.map +1 -1
- package/lib/mergeTreeNodes.js +29 -20
- package/lib/mergeTreeNodes.js.map +1 -1
- package/lib/mergeTreeTracking.js +3 -3
- package/lib/mergeTreeTracking.js.map +1 -1
- package/lib/opBuilder.d.ts +6 -1
- package/lib/opBuilder.d.ts.map +1 -1
- package/lib/opBuilder.js +5 -0
- package/lib/opBuilder.js.map +1 -1
- package/lib/ops.d.ts.map +1 -1
- package/lib/ops.js.map +1 -1
- package/lib/ordinal.d.ts.map +1 -1
- package/lib/ordinal.js +7 -0
- package/lib/ordinal.js.map +1 -1
- package/lib/partialLengths.d.ts +4 -2
- package/lib/partialLengths.d.ts.map +1 -1
- package/lib/partialLengths.js +101 -53
- package/lib/partialLengths.js.map +1 -1
- package/lib/perspective.d.ts +4 -1
- package/lib/perspective.d.ts.map +1 -1
- package/lib/perspective.js +7 -6
- package/lib/perspective.js.map +1 -1
- package/lib/properties.d.ts +13 -10
- package/lib/properties.d.ts.map +1 -1
- package/lib/properties.js +22 -11
- package/lib/properties.js.map +1 -1
- package/lib/public.d.ts +1 -1
- package/lib/referencePositions.d.ts +7 -0
- package/lib/referencePositions.d.ts.map +1 -1
- package/lib/referencePositions.js +7 -0
- package/lib/referencePositions.js.map +1 -1
- package/lib/revertibles.d.ts +6 -0
- package/lib/revertibles.d.ts.map +1 -1
- package/lib/revertibles.js +50 -21
- package/lib/revertibles.js.map +1 -1
- package/lib/segmentGroupCollection.d.ts.map +1 -1
- package/lib/segmentGroupCollection.js +2 -0
- package/lib/segmentGroupCollection.js.map +1 -1
- package/lib/segmentPropertiesManager.d.ts +7 -3
- package/lib/segmentPropertiesManager.d.ts.map +1 -1
- package/lib/segmentPropertiesManager.js +20 -15
- package/lib/segmentPropertiesManager.js.map +1 -1
- package/lib/snapshotChunks.d.ts.map +1 -1
- package/lib/snapshotChunks.js +10 -5
- package/lib/snapshotChunks.js.map +1 -1
- package/lib/snapshotLoader.d.ts.map +1 -1
- package/lib/snapshotLoader.js +14 -10
- package/lib/snapshotLoader.js.map +1 -1
- package/lib/snapshotV1.d.ts.map +1 -1
- package/lib/snapshotV1.js +20 -8
- package/lib/snapshotV1.js.map +1 -1
- package/lib/snapshotlegacy.d.ts.map +1 -1
- package/lib/snapshotlegacy.js +4 -2
- package/lib/snapshotlegacy.js.map +1 -1
- package/lib/sortedSegmentSet.d.ts.map +1 -1
- package/lib/sortedSegmentSet.js +8 -1
- package/lib/sortedSegmentSet.js.map +1 -1
- package/lib/sortedSet.d.ts.map +1 -1
- package/lib/sortedSet.js +4 -0
- package/lib/sortedSet.js.map +1 -1
- package/lib/test/Insertion.perf.spec.js.map +1 -1
- package/lib/test/Removal.perf.spec.js.map +1 -1
- package/lib/test/Snapshot.perf.spec.js +1 -0
- package/lib/test/Snapshot.perf.spec.js.map +1 -1
- package/lib/test/attributionCollection.perf.spec.js +3 -1
- package/lib/test/attributionCollection.perf.spec.js.map +1 -1
- package/lib/test/attributionCollection.spec.js +3 -2
- package/lib/test/attributionCollection.spec.js.map +1 -1
- package/lib/test/attributionPolicy.spec.js +3 -1
- package/lib/test/attributionPolicy.spec.js.map +1 -1
- package/lib/test/beastTest.spec.d.ts +1 -4
- package/lib/test/beastTest.spec.d.ts.map +1 -1
- package/lib/test/beastTest.spec.js +26 -24
- package/lib/test/beastTest.spec.js.map +1 -1
- package/lib/test/client.annotateMarker.spec.js +1 -1
- package/lib/test/client.annotateMarker.spec.js.map +1 -1
- package/lib/test/client.apis.spec.d.ts.map +1 -1
- package/lib/test/client.apis.spec.js +4 -6
- package/lib/test/client.apis.spec.js.map +1 -1
- package/lib/test/client.applyMsg.spec.js +72 -50
- package/lib/test/client.applyMsg.spec.js.map +1 -1
- package/lib/test/client.applyStashedOpFarm.spec.js +18 -10
- package/lib/test/client.applyStashedOpFarm.spec.js.map +1 -1
- package/lib/test/client.attributionFarm.spec.js +12 -7
- package/lib/test/client.attributionFarm.spec.js.map +1 -1
- package/lib/test/client.conflictFarm.spec.js +4 -2
- package/lib/test/client.conflictFarm.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 +14 -7
- package/lib/test/client.localReference.spec.js.map +1 -1
- package/lib/test/client.localReferenceFarm.spec.js +13 -9
- package/lib/test/client.localReferenceFarm.spec.js.map +1 -1
- package/lib/test/client.rebasePosition.spec.js +1 -1
- package/lib/test/client.rebasePosition.spec.js.map +1 -1
- package/lib/test/client.reconnectFarm.spec.js +11 -8
- package/lib/test/client.reconnectFarm.spec.js.map +1 -1
- package/lib/test/client.replay.spec.js +8 -7
- package/lib/test/client.replay.spec.js.map +1 -1
- package/lib/test/client.rollback.spec.js +14 -11
- package/lib/test/client.rollback.spec.js.map +1 -1
- package/lib/test/client.rollbackFarm.spec.js +3 -1
- package/lib/test/client.rollbackFarm.spec.js.map +1 -1
- package/lib/test/client.searchForMarker.spec.js +29 -19
- package/lib/test/client.searchForMarker.spec.js.map +1 -1
- package/lib/test/client.walkSegments.spec.js +1 -1
- package/lib/test/client.walkSegments.spec.js.map +1 -1
- package/lib/test/collections.list.spec.js +1 -1
- package/lib/test/collections.list.spec.js.map +1 -1
- package/lib/test/createInsertOnlyAttributionPolicy.spec.js +1 -1
- package/lib/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -1
- package/lib/test/dirname.cjs +1 -0
- package/lib/test/dirname.cjs.map +1 -1
- package/lib/test/dirname.d.cts.map +1 -1
- package/lib/test/mergeTree.annotate.deltaCallback.spec.js +1 -1
- package/lib/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -1
- package/lib/test/mergeTree.annotate.spec.js +1 -1
- package/lib/test/mergeTree.annotate.spec.js.map +1 -1
- package/lib/test/mergeTree.insert.deltaCallback.spec.js +1 -1
- package/lib/test/mergeTree.insert.deltaCallback.spec.js.map +1 -1
- package/lib/test/mergeTree.insertingWalk.spec.js +8 -8
- package/lib/test/mergeTree.insertingWalk.spec.js.map +1 -1
- package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +1 -1
- package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
- package/lib/test/mergeTree.markRangeRemoved.spec.js +1 -1
- package/lib/test/mergeTree.markRangeRemoved.spec.js.map +1 -1
- package/lib/test/mergeTree.walk.spec.js +1 -1
- package/lib/test/mergeTree.walk.spec.js.map +1 -1
- package/lib/test/mergeTree.zamboni.spec.js +1 -1
- package/lib/test/mergeTree.zamboni.spec.js.map +1 -1
- package/lib/test/mergeTreeOperationRunner.d.ts.map +1 -1
- package/lib/test/mergeTreeOperationRunner.js +27 -15
- package/lib/test/mergeTreeOperationRunner.js.map +1 -1
- package/lib/test/mergeTreeOperationRunner.spec.js +5 -1
- package/lib/test/mergeTreeOperationRunner.spec.js.map +1 -1
- package/lib/test/obliterate.concurrent.spec.js +4 -4
- package/lib/test/obliterate.concurrent.spec.js.map +1 -1
- package/lib/test/obliterate.deltaCallback.spec.js +2 -3
- package/lib/test/obliterate.deltaCallback.spec.js.map +1 -1
- package/lib/test/obliterate.partialLength.spec.js +1 -1
- package/lib/test/obliterate.partialLength.spec.js.map +1 -1
- package/lib/test/obliterate.reconnect.spec.js +1 -1
- package/lib/test/obliterate.reconnect.spec.js.map +1 -1
- package/lib/test/obliterate.spec.js +1 -1
- package/lib/test/obliterate.spec.js.map +1 -1
- package/lib/test/ordinal.spec.js +7 -1
- package/lib/test/ordinal.spec.js.map +1 -1
- package/lib/test/partialLength.spec.js.map +1 -1
- package/lib/test/properties.spec.js +1 -1
- package/lib/test/properties.spec.js.map +1 -1
- package/lib/test/reconnectHelper.d.ts +4 -4
- package/lib/test/reconnectHelper.d.ts.map +1 -1
- package/lib/test/reconnectHelper.js +22 -14
- package/lib/test/reconnectHelper.js.map +1 -1
- package/lib/test/resetPendingSegmentsToOp.spec.js +8 -2
- package/lib/test/resetPendingSegmentsToOp.spec.js.map +1 -1
- package/lib/test/revertibleFarm.spec.js +8 -7
- package/lib/test/revertibleFarm.spec.js.map +1 -1
- package/lib/test/revertibles.spec.d.ts.map +1 -1
- package/lib/test/revertibles.spec.js +93 -54
- package/lib/test/revertibles.spec.js.map +1 -1
- package/lib/test/segmentGroupCollection.spec.js +1 -1
- package/lib/test/segmentGroupCollection.spec.js.map +1 -1
- package/lib/test/snapshot.spec.js +1 -1
- package/lib/test/snapshot.spec.js.map +1 -1
- package/lib/test/snapshot.utils.d.ts.map +1 -1
- package/lib/test/snapshot.utils.js +1 -1
- package/lib/test/snapshot.utils.js.map +1 -1
- package/lib/test/snapshotlegacy.spec.js +10 -5
- package/lib/test/snapshotlegacy.spec.js.map +1 -1
- package/lib/test/sortedSegmentSet.spec.js +6 -2
- package/lib/test/sortedSegmentSet.spec.js.map +1 -1
- package/lib/test/testClient.d.ts +6 -5
- package/lib/test/testClient.d.ts.map +1 -1
- package/lib/test/testClient.js +25 -27
- package/lib/test/testClient.js.map +1 -1
- package/lib/test/testClientLogger.d.ts.map +1 -1
- package/lib/test/testClientLogger.js +37 -36
- package/lib/test/testClientLogger.js.map +1 -1
- package/lib/test/testSerializer.d.ts +5 -5
- package/lib/test/testSerializer.d.ts.map +1 -1
- package/lib/test/testSerializer.js +0 -1
- package/lib/test/testSerializer.js.map +1 -1
- package/lib/test/testServer.d.ts.map +1 -1
- package/lib/test/testServer.js.map +1 -1
- package/lib/test/testUtils.d.ts +1 -1
- package/lib/test/testUtils.d.ts.map +1 -1
- package/lib/test/testUtils.js +6 -8
- package/lib/test/testUtils.js.map +1 -1
- package/lib/test/text.d.ts.map +1 -1
- package/lib/test/text.js +1 -1
- package/lib/test/text.js.map +1 -1
- package/lib/test/tracking.spec.js +9 -5
- package/lib/test/tracking.spec.js.map +1 -1
- package/lib/test/wordUnitTests.spec.d.ts.map +1 -1
- package/lib/test/wordUnitTests.spec.js +9 -9
- package/lib/test/wordUnitTests.spec.js.map +1 -1
- package/lib/textSegment.d.ts +1 -1
- package/lib/textSegment.d.ts.map +1 -1
- package/lib/textSegment.js +3 -3
- package/lib/textSegment.js.map +1 -1
- package/lib/zamboni.d.ts.map +1 -1
- package/lib/zamboni.js +7 -2
- package/lib/zamboni.js.map +1 -1
- package/package.json +29 -27
- package/src/MergeTreeTextHelper.ts +2 -2
- package/src/attributionCollection.ts +71 -28
- package/src/attributionPolicy.ts +14 -9
- package/src/client.ts +120 -71
- package/src/collections/list.ts +9 -6
- package/src/collections/rbTree.ts +62 -71
- package/src/endOfTreeSegment.ts +21 -10
- package/src/localReference.ts +61 -43
- package/src/mergeTree.ts +229 -178
- package/src/mergeTreeNodeWalk.ts +2 -1
- package/src/mergeTreeNodes.ts +59 -46
- package/src/mergeTreeTracking.ts +3 -3
- package/src/opBuilder.ts +6 -1
- package/src/ops.ts +5 -0
- package/src/ordinal.ts +8 -1
- package/src/partialLengths.ts +143 -87
- package/src/perspective.ts +10 -7
- package/src/properties.ts +36 -18
- package/src/referencePositions.ts +7 -0
- package/src/revertibles.ts +71 -41
- package/src/segmentGroupCollection.ts +8 -6
- package/src/segmentPropertiesManager.ts +28 -24
- package/src/snapshotChunks.ts +12 -7
- package/src/snapshotLoader.ts +20 -17
- package/src/snapshotV1.ts +36 -18
- package/src/snapshotlegacy.ts +7 -5
- package/src/sortedSegmentSet.ts +9 -3
- package/src/sortedSet.ts +7 -3
- package/src/textSegment.ts +9 -9
- package/src/zamboni.ts +14 -10
- package/tsconfig.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeTreeNodeWalk.d.ts","sourceRoot":"","sources":["../src/mergeTreeNodeWalk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE5E,eAAO,MAAM,UAAU;;CAEb,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;AAEpD,eAAO,MAAM,UAAU;;;;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eAAO,MAAM,UAAU;;;;CAKb,CAAC;AAGX,MAAM,MAAM,UAAU,GACnB,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,GAC5C,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AAE7B;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CACjC,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,GAAG,SAAS,EAClC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,UAAU,EAC7C,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,UAAU,EAClD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,EACtC,OAAO,GAAE,OAAc,GACrB,OAAO,CAyET;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC/B,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,OAAO,GAAG,SAAS,GAChD,OAAO,CAcT;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAChC,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,OAAO,GAAG,SAAS,GAChD,OAAO,CAeT;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CACnC,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,GAAG,SAAS,GAAG,IAAI,GAC3D,OAAO,CAqBT"}
|
package/lib/mergeTreeNodeWalk.js
CHANGED
|
@@ -137,6 +137,6 @@ export function walkAllChildSegments(startBlock, leafAction) {
|
|
|
137
137
|
}
|
|
138
138
|
return depthFirstNodeWalk(startBlock, startBlock.children[0], ancestors.size === 0
|
|
139
139
|
? undefined
|
|
140
|
-
: (node) =>
|
|
140
|
+
: (node) => ancestors.has(node.parent) ? NodeAction.Exit : NodeAction.Continue, leafAction);
|
|
141
141
|
}
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CAAC,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,yGAAyG;IACzG,gCAAgC;IAChC,MAAM,SAAS,GAAG,IAAI,GAAG,EAA0B,CAAC;IACpD,KAAK,IAAI,GAAG,GAAG,UAAU,CAAC,MAAM,EAAE,GAAG,KAAK,SAAS,EAAE,GAAG,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;QACvE,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IAED,OAAO,kBAAkB,CACxB,UAAU,EACV,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EACtB,SAAS,CAAC,IAAI,KAAK,CAAC;QACnB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,EACjF,UAAU,CACV,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type MergeBlock, IMergeNode, ISegment } from \"./mergeTreeNodes.js\";\n\nexport const LeafAction = {\n\tExit: false,\n} as const;\n\nexport type LeafAction = boolean | undefined | void;\n\nexport const NodeAction = {\n\tContinue: undefined,\n\t// exit is false to unify with leafActionOverride\n\tExit: LeafAction.Exit,\n\tSkip: 2,\n} as const;\n\n// we exclude true from, as we only want one continue value, undefined\nexport type NodeAction =\n\t| (typeof NodeAction)[keyof typeof NodeAction]\n\t| Exclude<LeafAction, true>;\n\n/**\n * Does a depth first walk of the tree from the specific start.\n *\n * @param startBlock - The block of the tree to start the walk from\n * @param startChild - The child of that block to start from\n * @param downAction - Called as we walk down the tree to the leaves.\n * @param leafActionOverride - Overrides downAction for leaves, generally used without downAction\n * @param upAction - Called after all the children of a block are walked.\n * @param forward - whether to walk forward or backward\n * @returns true if we naturally exit, false if exiting due to Exit action result\n */\nexport function depthFirstNodeWalk(\n\tstartBlock: MergeBlock,\n\tstartChild: IMergeNode | undefined,\n\tdownAction?: (node: IMergeNode) => NodeAction,\n\tleafActionOverride?: (seg: ISegment) => LeafAction,\n\tupAction?: (block: MergeBlock) => void,\n\tforward: boolean = true,\n): boolean {\n\tconst increment = forward ? 1 : -1;\n\tconst leafAction = leafActionOverride ?? downAction;\n\tif (leafAction === undefined) {\n\t\treturn true;\n\t}\n\n\tlet block = startBlock;\n\tlet childCount = block.childCount;\n\tlet start: IMergeNode | undefined = startChild;\n\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\t// go down to the leaf level\n\t\tlet blockResult: NodeAction;\n\t\twhile (start?.isLeaf() === false) {\n\t\t\t// cast is safe due to isLeaf === false in while above\n\t\t\tblock = start as MergeBlock;\n\t\t\tchildCount = block.childCount;\n\t\t\tblockResult = downAction?.(block);\n\t\t\t// setting start undefined will skip the leaf walk\n\t\t\t// so if the block result isn't continue, set it\n\t\t\t// undefined\n\t\t\tstart =\n\t\t\t\tblockResult === NodeAction.Continue\n\t\t\t\t\t? block.children[forward ? 0 : childCount - 1]\n\t\t\t\t\t: undefined;\n\t\t}\n\n\t\tlet exit = blockResult === NodeAction.Exit;\n\n\t\t// walk the leaves if we reached them\n\t\tif (start !== undefined) {\n\t\t\tfor (let i = start.index; i !== -1 && i !== childCount; i += increment) {\n\t\t\t\t// the above loop ensures start is a leaf or undefined, so all children\n\t\t\t\t// will be leaves if start exits, so the cast is safe\n\t\t\t\tif (leafAction(block.children[i] as ISegment) === LeafAction.Exit) {\n\t\t\t\t\texit = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// if there is no upAction, we don't need to walk up before exiting\n\t\tif (upAction === undefined && exit) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// since we already enumerated the children\n\t\t// we walk up to the next level until there is a sibling\n\t\t// or all the way up if exit is true\n\t\tlet nextIndex = -1;\n\t\tdo {\n\t\t\t// if the blockAction was exit or skip\n\t\t\t// we shouldn't process that block again,\n\t\t\t// if there are subsequent parents while walking up\n\t\t\t// we will process those.\n\t\t\tif (blockResult === NodeAction.Continue) {\n\t\t\t\tupAction?.(block);\n\t\t\t} else {\n\t\t\t\tblockResult = NodeAction.Continue;\n\t\t\t}\n\t\t\tif (block.parent === undefined) {\n\t\t\t\treturn !exit;\n\t\t\t}\n\t\t\tstart = block;\n\t\t\tblock = block.parent;\n\t\t\tchildCount = block.childCount;\n\t\t\tnextIndex = start.index + increment;\n\t\t} while (exit || nextIndex === -1 || nextIndex === childCount);\n\t\t// the above loop ensured that siblings are possible\n\t\tstart = block.children[nextIndex];\n\t}\n}\n\n/**\n * Visit segments starting from node's right/far/forward siblings, then up to node's parent.\n * All segments past `node` are visited, regardless of their visibility.\n */\nexport function forwardExcursion(\n\tstartNode: IMergeNode,\n\tleafAction: (seg: ISegment) => boolean | undefined,\n): boolean {\n\tif (startNode.parent === undefined) {\n\t\treturn true;\n\t}\n\n\treturn depthFirstNodeWalk(\n\t\tstartNode.parent,\n\t\t// this will either be the sibling, or undefined\n\t\t// either is fine, and will result in skipping\n\t\t// the startNode only\n\t\tstartNode.parent.children[startNode.index + 1],\n\t\tundefined /* downAction */,\n\t\tleafAction,\n\t);\n}\n\n/**\n * Visit segments starting from node's left/near/backwards siblings, then up to node's parent.\n * All segments past `node` are visited, regardless of their visibility.\n */\nexport function backwardExcursion(\n\tstartNode: IMergeNode,\n\tleafAction: (seg: ISegment) => boolean | undefined,\n): boolean {\n\tif (startNode.parent === undefined) {\n\t\treturn true;\n\t}\n\treturn depthFirstNodeWalk(\n\t\tstartNode.parent,\n\t\t// this will either be the sibling, or undefined\n\t\t// either is fine, and will result in skipping\n\t\t// the startNode only\n\t\tstartNode.parent.children[startNode.index - 1],\n\t\tundefined /* downAction */,\n\t\tleafAction,\n\t\tundefined /* upAction */,\n\t\tfalse /* forward */,\n\t);\n}\n\n/**\n * Walks all segments below the specific start block\n * @param startBlock - The block to start the walk at\n * @param leafAction - The action to perform on the leaves\n * @returns true if we naturally exit, false if exiting due to leaf action result\n */\nexport function walkAllChildSegments(\n\tstartBlock: MergeBlock,\n\tleafAction: (segment: ISegment) => boolean | undefined | void,\n): boolean {\n\tif (startBlock.childCount === 0) {\n\t\treturn true;\n\t}\n\n\t// undefined shouldn't actually be added, but this allows subsequent check for `node.parent` to typecheck\n\t// without further runtime work.\n\tconst ancestors = new Set<MergeBlock | undefined>();\n\tfor (let cur = startBlock.parent; cur !== undefined; cur = cur.parent) {\n\t\tancestors.add(cur);\n\t}\n\n\treturn depthFirstNodeWalk(\n\t\tstartBlock,\n\t\tstartBlock.children[0],\n\t\tancestors.size === 0\n\t\t\t? undefined\n\t\t\t: (node) => (ancestors.has(node.parent) ? NodeAction.Exit : NodeAction.Continue),\n\t\tleafAction,\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mergeTreeNodeWalk.js","sourceRoot":"","sources":["../src/mergeTreeNodeWalk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,IAAI,EAAE,KAAK;CACF,CAAC;AAIX,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,QAAQ,EAAE,SAAS;IACnB,iDAAiD;IACjD,IAAI,EAAE,UAAU,CAAC,IAAI;IACrB,IAAI,EAAE,CAAC;CACE,CAAC;AAOX;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CACjC,UAAsB,EACtB,UAAkC,EAClC,UAA6C,EAC7C,kBAAkD,EAClD,QAAsC,EACtC,UAAmB,IAAI;IAEvB,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,UAAU,GAAG,kBAAkB,IAAI,UAAU,CAAC;IACpD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC9B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AAU,iBAAiB,CAChC,SAAqB,EACrB,UAAkD;IAElD,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACpC,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,kBAAkB,CACxB,SAAS,CAAC,MAAM;IAChB,gDAAgD;IAChD,8CAA8C;IAC9C,qBAAqB;IACrB,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,EAC9C,SAAS,CAAC,gBAAgB,EAC1B,UAAU,EACV,SAAS,CAAC,cAAc,EACxB,KAAK,CAAC,aAAa,CACnB,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CACnC,UAAsB,EACtB,UAA6D;IAE7D,IAAI,UAAU,CAAC,UAAU,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,yGAAyG;IACzG,gCAAgC;IAChC,MAAM,SAAS,GAAG,IAAI,GAAG,EAA0B,CAAC;IACpD,KAAK,IAAI,GAAG,GAAG,UAAU,CAAC,MAAM,EAAE,GAAG,KAAK,SAAS,EAAE,GAAG,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;QACvE,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IAED,OAAO,kBAAkB,CACxB,UAAU,EACV,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EACtB,SAAS,CAAC,IAAI,KAAK,CAAC;QACnB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,CAAC,IAAI,EAAqB,EAAE,CAC5B,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,EACrE,UAAU,CACV,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type MergeBlock, IMergeNode, ISegment } from \"./mergeTreeNodes.js\";\n\nexport const LeafAction = {\n\tExit: false,\n} as const;\n\nexport type LeafAction = boolean | undefined | void;\n\nexport const NodeAction = {\n\tContinue: undefined,\n\t// exit is false to unify with leafActionOverride\n\tExit: LeafAction.Exit,\n\tSkip: 2,\n} as const;\n\n// we exclude true from, as we only want one continue value, undefined\nexport type NodeAction =\n\t| (typeof NodeAction)[keyof typeof NodeAction]\n\t| Exclude<LeafAction, true>;\n\n/**\n * Does a depth first walk of the tree from the specific start.\n *\n * @param startBlock - The block of the tree to start the walk from\n * @param startChild - The child of that block to start from\n * @param downAction - Called as we walk down the tree to the leaves.\n * @param leafActionOverride - Overrides downAction for leaves, generally used without downAction\n * @param upAction - Called after all the children of a block are walked.\n * @param forward - whether to walk forward or backward\n * @returns true if we naturally exit, false if exiting due to Exit action result\n */\nexport function depthFirstNodeWalk(\n\tstartBlock: MergeBlock,\n\tstartChild: IMergeNode | undefined,\n\tdownAction?: (node: IMergeNode) => NodeAction,\n\tleafActionOverride?: (seg: ISegment) => LeafAction,\n\tupAction?: (block: MergeBlock) => void,\n\tforward: boolean = true,\n): boolean {\n\tconst increment = forward ? 1 : -1;\n\tconst leafAction = leafActionOverride ?? downAction;\n\tif (leafAction === undefined) {\n\t\treturn true;\n\t}\n\n\tlet block = startBlock;\n\tlet childCount = block.childCount;\n\tlet start: IMergeNode | undefined = startChild;\n\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\t// go down to the leaf level\n\t\tlet blockResult: NodeAction;\n\t\twhile (start?.isLeaf() === false) {\n\t\t\t// cast is safe due to isLeaf === false in while above\n\t\t\tblock = start as MergeBlock;\n\t\t\tchildCount = block.childCount;\n\t\t\tblockResult = downAction?.(block);\n\t\t\t// setting start undefined will skip the leaf walk\n\t\t\t// so if the block result isn't continue, set it\n\t\t\t// undefined\n\t\t\tstart =\n\t\t\t\tblockResult === NodeAction.Continue\n\t\t\t\t\t? block.children[forward ? 0 : childCount - 1]\n\t\t\t\t\t: undefined;\n\t\t}\n\n\t\tlet exit = blockResult === NodeAction.Exit;\n\n\t\t// walk the leaves if we reached them\n\t\tif (start !== undefined) {\n\t\t\tfor (let i = start.index; i !== -1 && i !== childCount; i += increment) {\n\t\t\t\t// the above loop ensures start is a leaf or undefined, so all children\n\t\t\t\t// will be leaves if start exits, so the cast is safe\n\t\t\t\tif (leafAction(block.children[i] as ISegment) === LeafAction.Exit) {\n\t\t\t\t\texit = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// if there is no upAction, we don't need to walk up before exiting\n\t\tif (upAction === undefined && exit) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// since we already enumerated the children\n\t\t// we walk up to the next level until there is a sibling\n\t\t// or all the way up if exit is true\n\t\tlet nextIndex = -1;\n\t\tdo {\n\t\t\t// if the blockAction was exit or skip\n\t\t\t// we shouldn't process that block again,\n\t\t\t// if there are subsequent parents while walking up\n\t\t\t// we will process those.\n\t\t\tif (blockResult === NodeAction.Continue) {\n\t\t\t\tupAction?.(block);\n\t\t\t} else {\n\t\t\t\tblockResult = NodeAction.Continue;\n\t\t\t}\n\t\t\tif (block.parent === undefined) {\n\t\t\t\treturn !exit;\n\t\t\t}\n\t\t\tstart = block;\n\t\t\tblock = block.parent;\n\t\t\tchildCount = block.childCount;\n\t\t\tnextIndex = start.index + increment;\n\t\t} while (exit || nextIndex === -1 || nextIndex === childCount);\n\t\t// the above loop ensured that siblings are possible\n\t\tstart = block.children[nextIndex];\n\t}\n}\n\n/**\n * Visit segments starting from node's right/far/forward siblings, then up to node's parent.\n * All segments past `node` are visited, regardless of their visibility.\n */\nexport function forwardExcursion(\n\tstartNode: IMergeNode,\n\tleafAction: (seg: ISegment) => boolean | undefined,\n): boolean {\n\tif (startNode.parent === undefined) {\n\t\treturn true;\n\t}\n\n\treturn depthFirstNodeWalk(\n\t\tstartNode.parent,\n\t\t// this will either be the sibling, or undefined\n\t\t// either is fine, and will result in skipping\n\t\t// the startNode only\n\t\tstartNode.parent.children[startNode.index + 1],\n\t\tundefined /* downAction */,\n\t\tleafAction,\n\t);\n}\n\n/**\n * Visit segments starting from node's left/near/backwards siblings, then up to node's parent.\n * All segments past `node` are visited, regardless of their visibility.\n */\nexport function backwardExcursion(\n\tstartNode: IMergeNode,\n\tleafAction: (seg: ISegment) => boolean | undefined,\n): boolean {\n\tif (startNode.parent === undefined) {\n\t\treturn true;\n\t}\n\treturn depthFirstNodeWalk(\n\t\tstartNode.parent,\n\t\t// this will either be the sibling, or undefined\n\t\t// either is fine, and will result in skipping\n\t\t// the startNode only\n\t\tstartNode.parent.children[startNode.index - 1],\n\t\tundefined /* downAction */,\n\t\tleafAction,\n\t\tundefined /* upAction */,\n\t\tfalse /* forward */,\n\t);\n}\n\n/**\n * Walks all segments below the specific start block\n * @param startBlock - The block to start the walk at\n * @param leafAction - The action to perform on the leaves\n * @returns true if we naturally exit, false if exiting due to leaf action result\n */\nexport function walkAllChildSegments(\n\tstartBlock: MergeBlock,\n\tleafAction: (segment: ISegment) => boolean | undefined | void,\n): boolean {\n\tif (startBlock.childCount === 0) {\n\t\treturn true;\n\t}\n\n\t// undefined shouldn't actually be added, but this allows subsequent check for `node.parent` to typecheck\n\t// without further runtime work.\n\tconst ancestors = new Set<MergeBlock | undefined>();\n\tfor (let cur = startBlock.parent; cur !== undefined; cur = cur.parent) {\n\t\tancestors.add(cur);\n\t}\n\n\treturn depthFirstNodeWalk(\n\t\tstartBlock,\n\t\tstartBlock.children[0],\n\t\tancestors.size === 0\n\t\t\t? undefined\n\t\t\t: (node): false | undefined =>\n\t\t\t\t\tancestors.has(node.parent) ? NodeAction.Exit : NodeAction.Continue,\n\t\tleafAction,\n\t);\n}\n"]}
|
package/lib/mergeTreeNodes.d.ts
CHANGED
|
@@ -61,6 +61,8 @@ export interface IRemovalInfo {
|
|
|
61
61
|
removedClientIds: number[];
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
|
+
* Returns the removal information for a segment.
|
|
65
|
+
*
|
|
64
66
|
* @internal
|
|
65
67
|
*/
|
|
66
68
|
export declare function toRemovalInfo(maybe: Partial<IRemovalInfo> | undefined): IRemovalInfo | undefined;
|
|
@@ -382,7 +384,6 @@ export declare abstract class BaseSegment implements ISegment {
|
|
|
382
384
|
canAppend(segment: ISegment): boolean;
|
|
383
385
|
protected addSerializedProps(jseg: IJSONSegment): void;
|
|
384
386
|
abstract toJSONObject(): any;
|
|
385
|
-
/***/
|
|
386
387
|
ack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean;
|
|
387
388
|
splitAt(pos: number): ISegment | undefined;
|
|
388
389
|
private copyPropertiesTo;
|
|
@@ -430,9 +431,9 @@ export declare class Marker extends BaseSegment implements ReferencePosition, IS
|
|
|
430
431
|
static make(refType: ReferenceType, props?: PropertySet): Marker;
|
|
431
432
|
constructor(refType: ReferenceType);
|
|
432
433
|
toJSONObject(): IJSONMarkerSegment;
|
|
433
|
-
static fromJSONObject(spec:
|
|
434
|
+
static fromJSONObject(spec: IJSONSegment): Marker | undefined;
|
|
434
435
|
clone(): Marker;
|
|
435
|
-
getSegment():
|
|
436
|
+
getSegment(): Marker;
|
|
436
437
|
getOffset(): number;
|
|
437
438
|
getProperties(): PropertySet | undefined;
|
|
438
439
|
getId(): string | undefined;
|
|
@@ -524,11 +525,11 @@ export declare class CollaborationWindow {
|
|
|
524
525
|
loadFrom(a: CollaborationWindow): void;
|
|
525
526
|
}
|
|
526
527
|
/**
|
|
527
|
-
*
|
|
528
|
+
* Compares two numbers.
|
|
528
529
|
*/
|
|
529
530
|
export declare const compareNumbers: (a: number, b: number) => number;
|
|
530
531
|
/**
|
|
531
|
-
*
|
|
532
|
+
* Compares two strings.
|
|
532
533
|
*/
|
|
533
534
|
export declare const compareStrings: (a: string, b: string) => number;
|
|
534
535
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeTreeNodes.d.ts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C,EAAE,WAAW,GAAG,MAAM;gBAQpD,OAAO,EAAE,aAAa;IAKzC,YAAY,IAAI,kBAAkB;IAMlC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS;IAO7D,KAAK,IAAI,MAAM;IAMf,UAAU,IAAI,MAAM;IAIpB,SAAS,IAAI,MAAM;IAInB,aAAa,IAAI,WAAW,GAAG,SAAS;IAIxC,KAAK,IAAI,MAAM,GAAG,SAAS;IAI3B,QAAQ,IAAI,MAAM;IAIlB,SAAS,CAAC,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS;IAItD,SAAS,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IAIrC,MAAM,IAAI,IAAI;CAGd;AAED;;;;GAIG;AACH,qBAAa,mBAAmB;IAC/B,QAAQ,SAAiB;IACzB,aAAa,UAAS;IAEtB;;OAEG;IACH,MAAM,SAAK;IACX;;OAEG;IACH,UAAU,SAAK;IAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8DG;IACH,QAAQ,SAAK;IAEb,QAAQ,CAAC,CAAC,EAAE,mBAAmB,GAAG,IAAI;CAMtC;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,MAAO,MAAM,KAAK,MAAM,KAAG,MAAe,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,cAAc,MAAO,MAAM,KAAK,MAAM,KAAG,MAA4B,CAAC;AAEnF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAmC1D"}
|
package/lib/mergeTreeNodes.js
CHANGED
|
@@ -9,12 +9,13 @@ import { LocalReferenceCollection } from "./localReference.js";
|
|
|
9
9
|
import { TrackingGroupCollection } from "./mergeTreeTracking.js";
|
|
10
10
|
import { MergeTreeDeltaType, ReferenceType } from "./ops.js";
|
|
11
11
|
import { computeHierarchicalOrdinal } from "./ordinal.js";
|
|
12
|
-
// eslint-disable-next-line import/no-deprecated
|
|
13
12
|
import { clone, createMap } from "./properties.js";
|
|
14
13
|
import { refGetTileLabels, refTypeIncludesFlag, } from "./referencePositions.js";
|
|
15
14
|
import { SegmentGroupCollection } from "./segmentGroupCollection.js";
|
|
16
15
|
import { PropertiesManager, PropertiesRollback } from "./segmentPropertiesManager.js";
|
|
17
16
|
/**
|
|
17
|
+
* Returns the removal information for a segment.
|
|
18
|
+
*
|
|
18
19
|
* @internal
|
|
19
20
|
*/
|
|
20
21
|
export function toRemovalInfo(maybe) {
|
|
@@ -67,10 +68,12 @@ export class MergeBlock {
|
|
|
67
68
|
this.index = 0;
|
|
68
69
|
this.ordinal = "";
|
|
69
70
|
this.cachedLength = 0;
|
|
71
|
+
// Suppression needed due to the way the merge tree children are initalized - we
|
|
72
|
+
// allocate 8 children blocks, but any unused blocks are not counted in the childCount.
|
|
73
|
+
// Using Array.from leads to unused children being undefined, which are counted in childCount.
|
|
74
|
+
// eslint-disable-next-line unicorn/no-new-array
|
|
70
75
|
this.children = new Array(MaxNodesInBlock);
|
|
71
|
-
// eslint-disable-next-line import/no-deprecated
|
|
72
76
|
this.rightmostTiles = createMap();
|
|
73
|
-
// eslint-disable-next-line import/no-deprecated
|
|
74
77
|
this.leftmostTiles = createMap();
|
|
75
78
|
}
|
|
76
79
|
setOrdinal(child, index) {
|
|
@@ -106,7 +109,8 @@ export class BaseSegment {
|
|
|
106
109
|
}
|
|
107
110
|
addProperties(newProps, seq, collaborating, rollback = PropertiesRollback.None) {
|
|
108
111
|
this.propertyManager ?? (this.propertyManager = new PropertiesManager());
|
|
109
|
-
//
|
|
112
|
+
// A property set must be able to hold properties of any type, so the any is needed.
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
114
|
this.properties ?? (this.properties = createMap());
|
|
111
115
|
return this.propertyManager.addProperties(this.properties, newProps, seq, collaborating, rollback);
|
|
112
116
|
}
|
|
@@ -119,7 +123,6 @@ export class BaseSegment {
|
|
|
119
123
|
cloneInto(b) {
|
|
120
124
|
b.clientId = this.clientId;
|
|
121
125
|
// TODO: deep clone properties
|
|
122
|
-
// eslint-disable-next-line import/no-deprecated
|
|
123
126
|
b.properties = clone(this.properties);
|
|
124
127
|
b.removedClientIds = this.removedClientIds?.slice();
|
|
125
128
|
// TODO: copy removed client overlap and branch removal info
|
|
@@ -139,21 +142,22 @@ export class BaseSegment {
|
|
|
139
142
|
jseg.props = { ...this.properties };
|
|
140
143
|
}
|
|
141
144
|
}
|
|
142
|
-
/***/
|
|
143
145
|
ack(segmentGroup, opArgs) {
|
|
144
146
|
const currentSegmentGroup = this.segmentGroups.dequeue();
|
|
145
147
|
assert(currentSegmentGroup === segmentGroup, 0x043 /* "On ack, unexpected segmentGroup!" */);
|
|
146
148
|
switch (opArgs.op.type) {
|
|
147
|
-
case MergeTreeDeltaType.ANNOTATE:
|
|
149
|
+
case MergeTreeDeltaType.ANNOTATE: {
|
|
148
150
|
assert(!!this.propertyManager, 0x044 /* "On annotate ack, missing segment property manager!" */);
|
|
149
151
|
this.propertyManager.ackPendingProperties(opArgs.op);
|
|
150
152
|
return true;
|
|
151
|
-
|
|
153
|
+
}
|
|
154
|
+
case MergeTreeDeltaType.INSERT: {
|
|
152
155
|
assert(this.seq === UnassignedSequenceNumber, 0x045 /* "On insert, seq number already assigned!" */);
|
|
153
156
|
this.seq = opArgs.sequencedMessage.sequenceNumber;
|
|
154
157
|
this.localSeq = undefined;
|
|
155
158
|
return true;
|
|
156
|
-
|
|
159
|
+
}
|
|
160
|
+
case MergeTreeDeltaType.REMOVE: {
|
|
157
161
|
const removalInfo = toRemovalInfo(this);
|
|
158
162
|
assert(removalInfo !== undefined, 0x046 /* "On remove ack, missing removal info!" */);
|
|
159
163
|
this.localRemovedSeq = undefined;
|
|
@@ -162,7 +166,8 @@ export class BaseSegment {
|
|
|
162
166
|
return true;
|
|
163
167
|
}
|
|
164
168
|
return false;
|
|
165
|
-
|
|
169
|
+
}
|
|
170
|
+
case MergeTreeDeltaType.OBLITERATE: {
|
|
166
171
|
const moveInfo = toMoveInfo(this);
|
|
167
172
|
assert(moveInfo !== undefined, 0x86e /* On obliterate ack, missing move info! */);
|
|
168
173
|
this.localMovedSeq = undefined;
|
|
@@ -174,8 +179,10 @@ export class BaseSegment {
|
|
|
174
179
|
return true;
|
|
175
180
|
}
|
|
176
181
|
return false;
|
|
177
|
-
|
|
182
|
+
}
|
|
183
|
+
default: {
|
|
178
184
|
throw new Error(`${opArgs.op.type} is in unrecognized operation type`);
|
|
185
|
+
}
|
|
179
186
|
}
|
|
180
187
|
}
|
|
181
188
|
splitAt(pos) {
|
|
@@ -187,12 +194,15 @@ export class BaseSegment {
|
|
|
187
194
|
return undefined;
|
|
188
195
|
}
|
|
189
196
|
this.copyPropertiesTo(leafSegment);
|
|
190
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
197
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias, unicorn/no-this-assignment
|
|
191
198
|
const thisAsMergeSegment = this;
|
|
192
199
|
leafSegment.parent = thisAsMergeSegment.parent;
|
|
193
200
|
// Give the leaf a temporary yet valid ordinal.
|
|
194
201
|
// when this segment is put in the tree, it will get its real ordinal,
|
|
195
202
|
// but this ordinal meets all the necessary invariants for now.
|
|
203
|
+
// Ordinals exist purely for lexicographical sort order and use a small set of valid bytes for each string character.
|
|
204
|
+
// The extra handling fromCodePoint has for things like surrogate pairs is therefore unnecessary.
|
|
205
|
+
// eslint-disable-next-line unicorn/prefer-code-point
|
|
196
206
|
leafSegment.ordinal = this.ordinal + String.fromCharCode(0);
|
|
197
207
|
leafSegment.removedClientIds = this.removedClientIds?.slice();
|
|
198
208
|
leafSegment.removedSeq = this.removedSeq;
|
|
@@ -216,11 +226,9 @@ export class BaseSegment {
|
|
|
216
226
|
return leafSegment;
|
|
217
227
|
}
|
|
218
228
|
copyPropertiesTo(other) {
|
|
219
|
-
if (this.propertyManager) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
other.properties = this.propertyManager.copyTo(this.properties, other.properties, other.propertyManager);
|
|
223
|
-
}
|
|
229
|
+
if (this.propertyManager && this.properties) {
|
|
230
|
+
other.propertyManager = new PropertiesManager();
|
|
231
|
+
other.properties = this.propertyManager.copyTo(this.properties, other.properties, other.propertyManager);
|
|
224
232
|
}
|
|
225
233
|
}
|
|
226
234
|
append(other) {
|
|
@@ -412,11 +420,11 @@ export class CollaborationWindow {
|
|
|
412
420
|
}
|
|
413
421
|
}
|
|
414
422
|
/**
|
|
415
|
-
*
|
|
423
|
+
* Compares two numbers.
|
|
416
424
|
*/
|
|
417
425
|
export const compareNumbers = (a, b) => a - b;
|
|
418
426
|
/**
|
|
419
|
-
*
|
|
427
|
+
* Compares two strings.
|
|
420
428
|
*/
|
|
421
429
|
export const compareStrings = (a, b) => a.localeCompare(b);
|
|
422
430
|
/**
|
|
@@ -452,8 +460,9 @@ export function debugMarkerToString(marker) {
|
|
|
452
460
|
pbuf += JSON.stringify(marker.properties, (key, value) => {
|
|
453
461
|
// Avoid circular reference when stringifying makers containing handles.
|
|
454
462
|
// (Substitute a debug string instead.)
|
|
463
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
455
464
|
const handle = !!value && value.IFluidHandle;
|
|
456
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
465
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access
|
|
457
466
|
return handle ? `#Handle(${handle.routeContext.path}/${handle.path})` : value;
|
|
458
467
|
});
|
|
459
468
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeTreeNodes.js","sourceRoot":"","sources":["../src/mergeTreeNodes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,6DAA6D;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAI7D,OAAO,EACN,aA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AC,MAAM,CAAC,CAAC;IAC5C,IAAI,UAAU,EAAE,CAAC;QAChB,IAAI,IAAI,UAAU,CAAC;QACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;YACvD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,EAAE,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,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,YAAY,CAAC;YAE7C,+DAA+D;YAC/D,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","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 } 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\";\n// eslint-disable-next-line import/no-deprecated\nimport { PropertySet, clone, createMap, type MapLike } from \"./properties.js\";\nimport {\n\tReferencePosition,\n\trefGetTileLabels,\n\trefTypeIncludesFlag,\n} from \"./referencePositions.js\";\nimport { SegmentGroupCollection } from \"./segmentGroupCollection.js\";\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 * @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\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\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 * @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\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\ttoJSONObject(): any;\n\t/**\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 SegmentGroup {\n\tsegments: ISegment[];\n\tpreviousProps?: PropertySet[];\n\tlocalSeq?: number;\n\trefSeq: number;\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\tthis.children = new Array<IMergeNode>(MaxNodesInBlock);\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tthis.rightmostTiles = createMap<Marker>();\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tthis.leftmostTiles = createMap<Marker>();\n\t}\n\n\tpublic setOrdinal(child: IMergeNode, index: number) {\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) {\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) {\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\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\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 addProperties(\n\t\tnewProps: PropertySet,\n\t\tseq?: number,\n\t\tcollaborating?: boolean,\n\t\trollback: PropertiesRollback = PropertiesRollback.None,\n\t) {\n\t\tthis.propertyManager ??= new PropertiesManager();\n\t\t// eslint-disable-next-line import/no-deprecated\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) {\n\t\tb.clientId = this.clientId;\n\t\t// TODO: deep clone properties\n\t\t// eslint-disable-next-line import/no-deprecated\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) {\n\t\tif (this.properties) {\n\t\t\tjseg.props = { ...this.properties };\n\t\t}\n\t}\n\n\tpublic abstract toJSONObject(): any;\n\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\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\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\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\tthis.localMovedSeq = 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] = opArgs.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\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`${opArgs.op.type} is in unrecognized operation type`);\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\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\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) {\n\t\tif (this.propertyManager) {\n\t\t\tif (this.properties) {\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}\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) {\n\t\tconst marker = new Marker(refType);\n\t\tif (props) {\n\t\t\tmarker.addProperties(props);\n\t\t}\n\t\treturn marker;\n\t}\n\n\tconstructor(public refType: ReferenceType) {\n\t\tsuper();\n\t\tthis.cachedLength = 1;\n\t}\n\n\ttoJSONObject() {\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: any) {\n\t\tif (spec && typeof spec === \"object\" && \"marker\" in spec) {\n\t\t\treturn Marker.make(spec.marker.refType, spec.props as PropertySet);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tclone() {\n\t\tconst b = Marker.make(this.refType, this.properties);\n\t\tthis.cloneInto(b);\n\t\treturn b;\n\t}\n\n\tgetSegment() {\n\t\treturn this;\n\t}\n\n\tgetOffset() {\n\t\treturn 0;\n\t}\n\n\tgetProperties() {\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() {\n\t\treturn `M${this.getId()}`;\n\t}\n\n\tprotected createSplitSegmentAt(pos: number) {\n\t\treturn undefined;\n\t}\n\n\tcanAppend(segment: ISegment): boolean {\n\t\treturn false;\n\t}\n\n\tappend() {\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) {\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 * @internal\n */\nexport const compareNumbers = (a: number, b: number) => a - b;\n\n/**\n * @internal\n */\nexport const compareStrings = (a: string, b: string) => 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\tconst handle = !!value && value.IFluidHandle;\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\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,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAI7D,OAAO,EACN,aAAa,EACb,wBAAwB,EACxB,uBAAuB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAA4B,kBAAkB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;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AAI,UAAU,CAAC;QACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;YACvD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,EAAE,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","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 } 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\";\nimport { SegmentGroupCollection } from \"./segmentGroupCollection.js\";\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\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\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 * @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\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 * 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 SegmentGroup {\n\tsegments: ISegment[];\n\tpreviousProps?: PropertySet[];\n\tlocalSeq?: number;\n\trefSeq: number;\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\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\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 addProperties(\n\t\tnewProps: PropertySet,\n\t\tseq?: number,\n\t\tcollaborating?: boolean,\n\t\trollback: PropertiesRollback = PropertiesRollback.None,\n\t): PropertySet {\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\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\tthis.localMovedSeq = 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] = opArgs.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.propertyManager && this.properties) {\n\t\t\tother.propertyManager = new PropertiesManager();\n\t\t\tother.properties = this.propertyManager.copyTo(\n\t\t\t\tthis.properties,\n\t\t\t\tother.properties,\n\t\t\t\tother.propertyManager,\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\tconst marker = new Marker(refType);\n\t\tif (props) {\n\t\t\tmarker.addProperties(props);\n\t\t}\n\t\treturn marker;\n\t}\n\n\tconstructor(public refType: ReferenceType) {\n\t\tsuper();\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"]}
|
package/lib/mergeTreeTracking.js
CHANGED
|
@@ -44,7 +44,7 @@ export class UnorderedTrackingGroup {
|
|
|
44
44
|
this.trackedSet = new Set();
|
|
45
45
|
}
|
|
46
46
|
get tracked() {
|
|
47
|
-
return
|
|
47
|
+
return [...this.trackedSet];
|
|
48
48
|
}
|
|
49
49
|
get size() {
|
|
50
50
|
return this.trackedSet.size;
|
|
@@ -103,9 +103,9 @@ export class TrackingGroupCollection {
|
|
|
103
103
|
return false;
|
|
104
104
|
}
|
|
105
105
|
copyTo(trackable) {
|
|
106
|
-
this._trackingGroups
|
|
106
|
+
for (const sg of this._trackingGroups) {
|
|
107
107
|
trackable.trackingCollection.link(sg);
|
|
108
|
-
}
|
|
108
|
+
}
|
|
109
109
|
}
|
|
110
110
|
get empty() {
|
|
111
111
|
return this._trackingGroups.size === 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeTreeTracking.js","sourceRoot":"","sources":["../src/mergeTreeTracking.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,gDAAgD;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAoBzD;;;GAGG;AACH,MAAM,OAAO,aAAa;IAIzB;QACC,gDAAgD;QAChD,IAAI,CAAC,UAAU,GAAG,IAAI,gBAAgB,EAAa,CAAC;IACrD,CAAC;IAED,IAAW,OAAO;QACjB,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;IAC9B,CAAC;IAED,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IAC7B,CAAC;IAEM,GAAG,CAAC,SAAoB;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC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EAAE,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;IAED,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,KAAK,CAAC,CAAC;IACxC,CAAC;IAEM,OAAO,CAAC,kBAA2C;QACzD,IACC,CAAC,kBAAkB;YACnB,IAAI,CAAC,eAAe,CAAC,IAAI,KAAK,kBAAkB,CAAC,eAAe,CAAC,IAAI,EACpE,CAAC;YACF,OAAO,KAAK,CAAC;QACd,CAAC;QACD,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,EAAE,CAAC;YAChD,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;gBACjD,OAAO,KAAK,CAAC;YACd,CAAC;QACF,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { LocalReferencePosition } from \"./localReference.js\";\nimport { ISegment } from \"./mergeTreeNodes.js\";\n// eslint-disable-next-line import/no-deprecated\nimport { SortedSegmentSet } from \"./sortedSegmentSet.js\";\n\n/**\n * @legacy\n * @alpha\n */\nexport type Trackable = ISegment | LocalReferencePosition;\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ITrackingGroup {\n\ttracked: readonly Trackable[];\n\tsize: number;\n\thas(trackable: Trackable): boolean;\n\tlink(trackable: Trackable): void;\n\tunlink(trackable: Trackable): boolean;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport class TrackingGroup implements ITrackingGroup {\n\t// eslint-disable-next-line import/no-deprecated\n\tprivate readonly trackedSet: SortedSegmentSet<Trackable>;\n\n\tconstructor() {\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tthis.trackedSet = new SortedSegmentSet<Trackable>();\n\t}\n\n\tpublic get tracked(): readonly Trackable[] {\n\t\treturn this.trackedSet.items;\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.trackedSet.size;\n\t}\n\n\tpublic has(trackable: Trackable): boolean {\n\t\treturn this.trackedSet.has(trackable);\n\t}\n\n\tpublic link(trackable: Trackable): void {\n\t\tif (!this.trackedSet.has(trackable)) {\n\t\t\tthis.trackedSet.addOrUpdate(trackable);\n\t\t\ttrackable.trackingCollection.link(this);\n\t\t}\n\t}\n\n\tpublic unlink(trackable: Trackable): boolean {\n\t\tif (this.trackedSet.remove(trackable)) {\n\t\t\ttrackable.trackingCollection.unlink(this);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n\n/**\n * Tracking group backed by an unordered set. Lookup, insertion, and deletion are O(1)\n */\nexport class UnorderedTrackingGroup implements ITrackingGroup {\n\tprivate readonly trackedSet: Set<Trackable>;\n\n\tconstructor() {\n\t\tthis.trackedSet = new Set<Trackable>();\n\t}\n\n\tpublic get tracked(): readonly Trackable[] {\n\t\treturn [...this.trackedSet];\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.trackedSet.size;\n\t}\n\n\tpublic has(trackable: Trackable): boolean {\n\t\treturn this.trackedSet.has(trackable);\n\t}\n\n\tpublic link(trackable: Trackable): void {\n\t\tif (!this.trackedSet.has(trackable)) {\n\t\t\tthis.trackedSet.add(trackable);\n\t\t\ttrackable.trackingCollection.link(this);\n\t\t}\n\t}\n\n\tpublic unlink(trackable: Trackable): boolean {\n\t\tif (this.trackedSet.delete(trackable)) {\n\t\t\ttrackable.trackingCollection.unlink(this);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n\n/**\n * A collection of {@link ITrackingGroup}.\n * @legacy\n * @alpha\n */\nexport class TrackingGroupCollection {\n\tprivate readonly _trackingGroups: Set<ITrackingGroup>;\n\n\tpublic get trackingGroups(): Set<TrackingGroup> {\n\t\t// Cast here is necessary to avoid a breaking change to\n\t\t// `TrackingGroupCollection`. Ideally we could just return\n\t\t// `Set<ITrackingGroup>`\n\t\treturn this._trackingGroups as Set<TrackingGroup>;\n\t}\n\n\tconstructor(private readonly trackable: Trackable) {\n\t\tthis._trackingGroups = new Set<ITrackingGroup>();\n\t}\n\n\tpublic link(trackingGroup: ITrackingGroup): void {\n\t\tif (trackingGroup) {\n\t\t\tif (!this._trackingGroups.has(trackingGroup)) {\n\t\t\t\tthis._trackingGroups.add(trackingGroup);\n\t\t\t}\n\n\t\t\tif (!trackingGroup.has(this.trackable)) {\n\t\t\t\ttrackingGroup.link(this.trackable);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic unlink(trackingGroup: ITrackingGroup): boolean {\n\t\tif (this._trackingGroups.has(trackingGroup)) {\n\t\t\tif (trackingGroup.has(this.trackable)) {\n\t\t\t\ttrackingGroup.unlink(this.trackable);\n\t\t\t}\n\t\t\tthis._trackingGroups.delete(trackingGroup);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic copyTo(trackable: Trackable): void {\n\t\tfor (const sg of this._trackingGroups) {\n\t\t\ttrackable.trackingCollection.link(sg);\n\t\t}\n\t}\n\n\tpublic get empty(): boolean {\n\t\treturn this._trackingGroups.size === 0;\n\t}\n\n\tpublic matches(trackingCollection: TrackingGroupCollection): boolean {\n\t\tif (\n\t\t\t!trackingCollection ||\n\t\t\tthis._trackingGroups.size !== trackingCollection._trackingGroups.size\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\tfor (const tg of this._trackingGroups.values()) {\n\t\t\tif (!trackingCollection._trackingGroups.has(tg)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n"]}
|
package/lib/opBuilder.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export declare function createRemoveRangeOp(start: number, end: number): IMergeT
|
|
|
43
43
|
*/
|
|
44
44
|
export declare function createObliterateRangeOp(start: number, end: number): IMergeTreeObliterateMsg;
|
|
45
45
|
/**
|
|
46
|
+
* Creates an op for inserting a segment at the specified position.
|
|
46
47
|
*
|
|
47
48
|
* @param pos - The position to insert the segment at
|
|
48
49
|
* @param segment - The segment to insert
|
|
@@ -51,10 +52,14 @@ export declare function createObliterateRangeOp(start: number, end: number): IMe
|
|
|
51
52
|
*/
|
|
52
53
|
export declare function createInsertSegmentOp(pos: number, segment: ISegment): IMergeTreeInsertMsg;
|
|
53
54
|
/**
|
|
55
|
+
* Creates the op for inserting a segment from its JSON representation at
|
|
56
|
+
* the specified position.
|
|
57
|
+
*
|
|
54
58
|
* @internal
|
|
55
59
|
*/
|
|
56
|
-
export declare function createInsertOp(pos: number, segSpec:
|
|
60
|
+
export declare function createInsertOp(pos: number, segSpec: unknown): IMergeTreeInsertMsg;
|
|
57
61
|
/**
|
|
62
|
+
* Creates a group op from the provided ops.
|
|
58
63
|
*
|
|
59
64
|
* @param ops - The ops to group
|
|
60
65
|
*
|
package/lib/opBuilder.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opBuilder.d.ts","sourceRoot":"","sources":["../src/opBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACN,qBAAqB,EACrB,iBAAiB,EAEjB,kBAAkB,EAClB,mBAAmB,EAEnB,uBAAuB,EACvB,mBAAmB,EAEnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,WAAW,GAChB,qBAAqB,GAAG,SAAS,CAYnC;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,WAAW,GAChB,qBAAqB,CAOvB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,mBAAm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