@fluidframework/merge-tree 2.0.0-rc.1.0.4 → 2.0.0-rc.2.0.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.js → .eslintrc.cjs} +4 -1
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +4 -0
- package/api-extractor-cjs.json +8 -0
- package/api-extractor-lint.json +1 -1
- package/api-extractor.json +1 -9
- package/api-report/merge-tree.api.md +6 -12
- package/dist/MergeTreeTextHelper.d.ts +2 -2
- package/dist/MergeTreeTextHelper.d.ts.map +1 -1
- package/dist/MergeTreeTextHelper.js +3 -3
- package/dist/MergeTreeTextHelper.js.map +1 -1
- package/dist/attributionCollection.d.ts +1 -1
- package/dist/attributionCollection.d.ts.map +1 -1
- package/dist/attributionCollection.js.map +1 -1
- package/dist/attributionPolicy.d.ts +1 -1
- package/dist/attributionPolicy.d.ts.map +1 -1
- package/dist/attributionPolicy.js +15 -15
- package/dist/attributionPolicy.js.map +1 -1
- package/dist/client.d.ts +31 -12
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +103 -92
- package/dist/client.js.map +1 -1
- package/dist/collections/index.d.ts +2 -2
- package/dist/collections/index.d.ts.map +1 -1
- package/dist/collections/index.js +6 -6
- package/dist/collections/index.js.map +1 -1
- package/dist/endOfTreeSegment.d.ts +3 -3
- package/dist/endOfTreeSegment.d.ts.map +1 -1
- package/dist/endOfTreeSegment.js +8 -8
- package/dist/endOfTreeSegment.js.map +1 -1
- package/dist/index.d.ts +20 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +71 -71
- package/dist/index.js.map +1 -1
- package/dist/localReference.d.ts +9 -39
- package/dist/localReference.d.ts.map +1 -1
- package/dist/localReference.js +29 -24
- package/dist/localReference.js.map +1 -1
- package/dist/merge-tree-alpha.d.ts +28 -450
- package/dist/merge-tree-beta.d.ts +0 -438
- package/dist/merge-tree-public.d.ts +0 -438
- package/dist/merge-tree-untrimmed.d.ts +28 -787
- package/dist/mergeTree.d.ts +11 -19
- package/dist/mergeTree.d.ts.map +1 -1
- package/dist/mergeTree.js +201 -189
- package/dist/mergeTree.js.map +1 -1
- package/dist/mergeTreeDeltaCallback.d.ts +3 -7
- package/dist/mergeTreeDeltaCallback.d.ts.map +1 -1
- package/dist/mergeTreeDeltaCallback.js.map +1 -1
- package/dist/mergeTreeNodeWalk.d.ts +1 -1
- package/dist/mergeTreeNodeWalk.d.ts.map +1 -1
- package/dist/mergeTreeNodeWalk.js.map +1 -1
- package/dist/mergeTreeNodes.d.ts +17 -14
- package/dist/mergeTreeNodes.d.ts.map +1 -1
- package/dist/mergeTreeNodes.js +32 -32
- package/dist/mergeTreeNodes.js.map +1 -1
- package/dist/mergeTreeTracking.d.ts +2 -2
- package/dist/mergeTreeTracking.d.ts.map +1 -1
- package/dist/mergeTreeTracking.js +2 -2
- package/dist/mergeTreeTracking.js.map +1 -1
- package/dist/opBuilder.d.ts +3 -3
- package/dist/opBuilder.d.ts.map +1 -1
- package/dist/opBuilder.js +7 -7
- package/dist/opBuilder.js.map +1 -1
- package/dist/package.json +3 -0
- package/dist/partialLengths.d.ts +5 -5
- package/dist/partialLengths.d.ts.map +1 -1
- package/dist/partialLengths.js +29 -29
- package/dist/partialLengths.js.map +1 -1
- package/dist/referencePositions.d.ts +4 -4
- package/dist/referencePositions.d.ts.map +1 -1
- package/dist/referencePositions.js +2 -2
- package/dist/referencePositions.js.map +1 -1
- package/dist/revertibles.d.ts +7 -7
- package/dist/revertibles.d.ts.map +1 -1
- package/dist/revertibles.js +39 -39
- package/dist/revertibles.js.map +1 -1
- package/dist/segmentGroupCollection.d.ts +1 -1
- package/dist/segmentGroupCollection.d.ts.map +1 -1
- package/dist/segmentGroupCollection.js +3 -3
- package/dist/segmentGroupCollection.js.map +1 -1
- package/dist/segmentPropertiesManager.d.ts +2 -2
- package/dist/segmentPropertiesManager.d.ts.map +1 -1
- package/dist/segmentPropertiesManager.js +8 -8
- package/dist/segmentPropertiesManager.js.map +1 -1
- package/dist/snapshotChunks.d.ts +3 -3
- package/dist/snapshotChunks.d.ts.map +1 -1
- package/dist/snapshotChunks.js +5 -5
- package/dist/snapshotChunks.js.map +1 -1
- package/dist/snapshotLoader.d.ts +3 -3
- package/dist/snapshotLoader.d.ts.map +1 -1
- package/dist/snapshotLoader.js +19 -19
- package/dist/snapshotLoader.js.map +1 -1
- package/dist/snapshotV1.d.ts +3 -3
- package/dist/snapshotV1.d.ts.map +1 -1
- package/dist/snapshotV1.js +35 -18
- package/dist/snapshotV1.js.map +1 -1
- package/dist/snapshotlegacy.d.ts +2 -2
- package/dist/snapshotlegacy.d.ts.map +1 -1
- package/dist/snapshotlegacy.js +22 -10
- package/dist/snapshotlegacy.js.map +1 -1
- package/dist/sortedSegmentSet.d.ts +3 -3
- package/dist/sortedSegmentSet.d.ts.map +1 -1
- package/dist/sortedSegmentSet.js +2 -2
- package/dist/sortedSegmentSet.js.map +1 -1
- package/dist/test/Insertion.perf.spec.js +15 -15
- package/dist/test/Insertion.perf.spec.js.map +1 -1
- package/dist/test/PartialLengths.perf.spec.js +13 -13
- package/dist/test/PartialLengths.perf.spec.js.map +1 -1
- package/dist/test/Removal.perf.spec.js +25 -25
- package/dist/test/Removal.perf.spec.js.map +1 -1
- package/dist/test/Snapshot.perf.spec.js +3 -3
- package/dist/test/Snapshot.perf.spec.js.map +1 -1
- package/dist/test/attributionCollection.perf.spec.js +9 -9
- package/dist/test/attributionCollection.perf.spec.js.map +1 -1
- package/dist/test/attributionCollection.spec.js +46 -46
- package/dist/test/attributionCollection.spec.js.map +1 -1
- package/dist/test/attributionPolicy.spec.js +13 -13
- package/dist/test/attributionPolicy.spec.js.map +1 -1
- package/dist/test/{beastTest.d.ts → beastTest.spec.d.ts} +3 -3
- package/dist/test/beastTest.spec.d.ts.map +1 -0
- package/dist/test/{beastTest.js → beastTest.spec.js} +120 -119
- package/dist/test/beastTest.spec.js.map +1 -0
- package/dist/test/client.annotateMarker.spec.js +13 -13
- package/dist/test/client.annotateMarker.spec.js.map +1 -1
- package/dist/test/{client.apis.d.ts → client.apis.spec.d.ts} +1 -1
- package/dist/test/client.apis.spec.d.ts.map +1 -0
- package/dist/test/{client.apis.js → client.apis.spec.js} +8 -8
- package/dist/test/client.apis.spec.js.map +1 -0
- package/dist/test/client.applyMsg.spec.js +106 -43
- package/dist/test/client.applyMsg.spec.js.map +1 -1
- package/dist/test/client.applyStashedOpFarm.spec.d.ts +1 -1
- package/dist/test/client.applyStashedOpFarm.spec.d.ts.map +1 -1
- package/dist/test/client.applyStashedOpFarm.spec.js +33 -21
- package/dist/test/client.applyStashedOpFarm.spec.js.map +1 -1
- package/dist/test/client.attributionFarm.spec.d.ts +1 -1
- package/dist/test/client.attributionFarm.spec.d.ts.map +1 -1
- package/dist/test/client.attributionFarm.spec.js +13 -13
- package/dist/test/client.attributionFarm.spec.js.map +1 -1
- package/dist/test/client.conflictFarm.spec.d.ts +1 -1
- package/dist/test/client.conflictFarm.spec.d.ts.map +1 -1
- package/dist/test/client.conflictFarm.spec.js +9 -9
- package/dist/test/client.conflictFarm.spec.js.map +1 -1
- package/dist/test/client.getPosition.spec.js +4 -4
- package/dist/test/client.getPosition.spec.js.map +1 -1
- package/dist/test/client.localReference.spec.js +72 -72
- package/dist/test/client.localReference.spec.js.map +1 -1
- package/dist/test/client.localReferenceFarm.spec.js +18 -18
- package/dist/test/client.localReferenceFarm.spec.js.map +1 -1
- package/dist/test/client.rebasePosition.spec.js +2 -2
- package/dist/test/client.rebasePosition.spec.js.map +1 -1
- package/dist/test/client.reconnectFarm.spec.d.ts +1 -1
- package/dist/test/client.reconnectFarm.spec.d.ts.map +1 -1
- package/dist/test/client.reconnectFarm.spec.js +10 -10
- package/dist/test/client.reconnectFarm.spec.js.map +1 -1
- package/dist/test/client.replay.spec.js +11 -11
- package/dist/test/client.replay.spec.js.map +1 -1
- package/dist/test/client.rollback.spec.js +83 -83
- package/dist/test/client.rollback.spec.js.map +1 -1
- package/dist/test/client.rollbackFarm.spec.js +9 -9
- package/dist/test/client.rollbackFarm.spec.js.map +1 -1
- package/dist/test/client.searchForMarker.spec.js +137 -137
- package/dist/test/client.searchForMarker.spec.js.map +1 -1
- package/dist/test/client.walkSegments.spec.js +2 -2
- package/dist/test/client.walkSegments.spec.js.map +1 -1
- package/dist/test/collections.list.spec.js +4 -4
- package/dist/test/collections.list.spec.js.map +1 -1
- package/dist/test/createInsertOnlyAttributionPolicy.spec.js +4 -4
- package/dist/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -1
- package/dist/test/dirname.cjs +16 -0
- package/dist/test/dirname.cjs.map +1 -0
- package/dist/test/dirname.d.cts +6 -0
- package/dist/test/dirname.d.cts.map +1 -0
- package/dist/test/index.d.ts +8 -8
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +82 -81
- package/dist/test/index.js.map +1 -1
- package/dist/test/mergeTree.annotate.deltaCallback.spec.js +39 -39
- package/dist/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -1
- package/dist/test/mergeTree.annotate.spec.js +39 -39
- package/dist/test/mergeTree.annotate.spec.js.map +1 -1
- package/dist/test/mergeTree.insert.deltaCallback.spec.js +35 -35
- package/dist/test/mergeTree.insert.deltaCallback.spec.js.map +1 -1
- package/dist/test/mergeTree.insertingWalk.spec.js +77 -77
- package/dist/test/mergeTree.insertingWalk.spec.js.map +1 -1
- package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +42 -42
- package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
- package/dist/test/mergeTree.markRangeRemoved.spec.js +15 -15
- package/dist/test/mergeTree.markRangeRemoved.spec.js.map +1 -1
- package/dist/test/mergeTree.walk.spec.js +14 -14
- package/dist/test/mergeTree.walk.spec.js.map +1 -1
- package/dist/test/mergeTree.zamboni.spec.js +9 -9
- package/dist/test/mergeTree.zamboni.spec.js.map +1 -1
- package/dist/test/mergeTreeOperationRunner.d.ts +4 -4
- package/dist/test/mergeTreeOperationRunner.d.ts.map +1 -1
- package/dist/test/mergeTreeOperationRunner.js +16 -15
- package/dist/test/mergeTreeOperationRunner.js.map +1 -1
- package/dist/test/mergeTreeOperationRunner.spec.js +5 -5
- package/dist/test/mergeTreeOperationRunner.spec.js.map +1 -1
- package/dist/test/obliterate.concurrent.spec.js +85 -88
- package/dist/test/obliterate.concurrent.spec.js.map +1 -1
- package/dist/test/obliterate.deltaCallback.spec.d.ts +6 -0
- package/dist/test/obliterate.deltaCallback.spec.d.ts.map +1 -0
- package/dist/test/obliterate.deltaCallback.spec.js +146 -0
- package/dist/test/obliterate.deltaCallback.spec.js.map +1 -0
- package/dist/test/obliterate.partialLength.spec.js +39 -44
- package/dist/test/obliterate.partialLength.spec.js.map +1 -1
- package/dist/test/obliterate.reconnect.spec.js +15 -18
- package/dist/test/obliterate.reconnect.spec.js.map +1 -1
- package/dist/test/obliterate.spec.js +16 -16
- package/dist/test/obliterate.spec.js.map +1 -1
- package/dist/test/ordinal.spec.js +5 -5
- package/dist/test/ordinal.spec.js.map +1 -1
- package/dist/test/partialLength.spec.js +58 -64
- 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 +8 -8
- package/dist/test/reconnectHelper.d.ts.map +1 -1
- package/dist/test/reconnectHelper.js +3 -3
- package/dist/test/reconnectHelper.js.map +1 -1
- package/dist/test/resetPendingSegmentsToOp.spec.js +18 -18
- package/dist/test/resetPendingSegmentsToOp.spec.js.map +1 -1
- package/dist/test/revertibleFarm.spec.js +21 -21
- package/dist/test/revertibleFarm.spec.js.map +1 -1
- package/dist/test/revertibles.spec.js +67 -67
- package/dist/test/revertibles.spec.js.map +1 -1
- package/dist/test/segmentGroupCollection.spec.js +3 -3
- package/dist/test/segmentGroupCollection.spec.js.map +1 -1
- package/dist/test/snapshot.spec.js +16 -16
- package/dist/test/snapshot.spec.js.map +1 -1
- package/dist/test/snapshot.utils.d.ts +4 -4
- package/dist/test/snapshot.utils.d.ts.map +1 -1
- package/dist/test/snapshot.utils.js +11 -11
- package/dist/test/snapshot.utils.js.map +1 -1
- package/dist/test/snapshotlegacy.spec.js +22 -22
- package/dist/test/snapshotlegacy.spec.js.map +1 -1
- package/dist/test/sortedSegmentSet.spec.js +9 -9
- package/dist/test/sortedSegmentSet.spec.js.map +1 -1
- package/dist/test/testClient.d.ts +13 -16
- package/dist/test/testClient.d.ts.map +1 -1
- package/dist/test/testClient.js +57 -59
- package/dist/test/testClient.js.map +1 -1
- package/dist/test/testClientLogger.d.ts +3 -3
- package/dist/test/testClientLogger.d.ts.map +1 -1
- package/dist/test/testClientLogger.js +19 -19
- package/dist/test/testClientLogger.js.map +1 -1
- package/dist/test/testServer.d.ts +3 -3
- package/dist/test/testServer.d.ts.map +1 -1
- package/dist/test/testServer.js +8 -8
- package/dist/test/testServer.js.map +1 -1
- package/dist/test/testUtils.d.ts +14 -6
- package/dist/test/testUtils.d.ts.map +1 -1
- package/dist/test/testUtils.js +36 -17
- package/dist/test/testUtils.js.map +1 -1
- package/dist/test/text.d.ts +2 -2
- package/dist/test/text.d.ts.map +1 -1
- package/dist/test/text.js +10 -10
- package/dist/test/text.js.map +1 -1
- package/dist/test/tracking.spec.js +12 -12
- package/dist/test/tracking.spec.js.map +1 -1
- package/dist/test/{wordUnitTests.d.ts → wordUnitTests.spec.d.ts} +1 -1
- package/dist/test/wordUnitTests.spec.d.ts.map +1 -0
- package/dist/test/{wordUnitTests.js → wordUnitTests.spec.js} +16 -15
- package/dist/test/wordUnitTests.spec.js.map +1 -0
- package/dist/textSegment.d.ts +3 -3
- package/dist/textSegment.d.ts.map +1 -1
- package/dist/textSegment.js +2 -2
- package/dist/textSegment.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/zamboni.d.ts +2 -2
- package/dist/zamboni.d.ts.map +1 -1
- package/dist/zamboni.js +19 -19
- package/dist/zamboni.js.map +1 -1
- package/lib/{MergeTreeTextHelper.d.mts → MergeTreeTextHelper.d.ts} +3 -3
- package/lib/MergeTreeTextHelper.d.ts.map +1 -0
- package/lib/{MergeTreeTextHelper.mjs → MergeTreeTextHelper.js} +3 -2
- package/lib/MergeTreeTextHelper.js.map +1 -0
- package/lib/{attributionCollection.d.mts → attributionCollection.d.ts} +2 -2
- package/lib/attributionCollection.d.ts.map +1 -0
- package/lib/{attributionCollection.mjs → attributionCollection.js} +1 -1
- package/lib/attributionCollection.js.map +1 -0
- package/lib/{attributionPolicy.d.mts → attributionPolicy.d.ts} +2 -2
- package/lib/attributionPolicy.d.ts.map +1 -0
- package/lib/{attributionPolicy.mjs → attributionPolicy.js} +4 -4
- package/lib/attributionPolicy.js.map +1 -0
- package/lib/{client.d.mts → client.d.ts} +32 -13
- package/lib/client.d.ts.map +1 -0
- package/lib/{client.mjs → client.js} +42 -31
- package/lib/client.js.map +1 -0
- package/lib/collections/{index.d.mts → index.d.ts} +3 -3
- package/lib/collections/index.d.ts.map +1 -0
- package/lib/collections/index.js +7 -0
- package/lib/collections/index.js.map +1 -0
- package/lib/collections/{list.d.mts → list.d.ts} +1 -1
- package/lib/collections/list.d.ts.map +1 -0
- package/lib/collections/{list.mjs → list.js} +1 -1
- package/lib/collections/list.js.map +1 -0
- package/lib/collections/{rbTree.d.mts → rbTree.d.ts} +1 -1
- package/lib/collections/rbTree.d.ts.map +1 -0
- package/lib/collections/{rbTree.mjs → rbTree.js} +1 -1
- package/lib/collections/rbTree.js.map +1 -0
- package/lib/{constants.d.mts → constants.d.ts} +1 -1
- package/lib/constants.d.ts.map +1 -0
- package/lib/{constants.mjs → constants.js} +1 -1
- package/lib/constants.js.map +1 -0
- package/lib/{endOfTreeSegment.d.mts → endOfTreeSegment.d.ts} +4 -4
- package/lib/endOfTreeSegment.d.ts.map +1 -0
- package/lib/{endOfTreeSegment.mjs → endOfTreeSegment.js} +3 -3
- package/lib/endOfTreeSegment.js.map +1 -0
- package/lib/{index.d.mts → index.d.ts} +21 -21
- package/lib/index.d.ts.map +1 -0
- package/lib/{index.mjs → index.js} +20 -20
- package/lib/index.js.map +1 -0
- package/lib/{localReference.d.mts → localReference.d.ts} +10 -40
- package/lib/localReference.d.ts.map +1 -0
- package/lib/{localReference.mjs → localReference.js} +12 -6
- package/lib/localReference.js.map +1 -0
- package/lib/{merge-tree-alpha.d.mts → merge-tree-alpha.d.ts} +28 -450
- package/lib/merge-tree-beta.d.ts +230 -0
- package/lib/merge-tree-public.d.ts +230 -0
- package/lib/{merge-tree-untrimmed.d.mts → merge-tree-untrimmed.d.ts} +28 -787
- package/lib/{mergeTree.d.mts → mergeTree.d.ts} +12 -20
- package/lib/mergeTree.d.ts.map +1 -0
- package/lib/{mergeTree.mjs → mergeTree.js} +47 -32
- package/lib/mergeTree.js.map +1 -0
- package/lib/{mergeTreeDeltaCallback.d.mts → mergeTreeDeltaCallback.d.ts} +8 -8
- package/lib/mergeTreeDeltaCallback.d.ts.map +1 -0
- package/lib/{mergeTreeDeltaCallback.mjs → mergeTreeDeltaCallback.js} +1 -1
- package/lib/mergeTreeDeltaCallback.js.map +1 -0
- package/lib/{mergeTreeNodeWalk.d.mts → mergeTreeNodeWalk.d.ts} +2 -2
- package/lib/mergeTreeNodeWalk.d.ts.map +1 -0
- package/lib/{mergeTreeNodeWalk.mjs → mergeTreeNodeWalk.js} +1 -1
- package/lib/mergeTreeNodeWalk.js.map +1 -0
- package/lib/{mergeTreeNodes.d.mts → mergeTreeNodes.d.ts} +18 -15
- package/lib/mergeTreeNodes.d.ts.map +1 -0
- package/lib/{mergeTreeNodes.mjs → mergeTreeNodes.js} +12 -10
- package/lib/mergeTreeNodes.js.map +1 -0
- package/lib/{mergeTreeTracking.d.mts → mergeTreeTracking.d.ts} +3 -3
- package/lib/mergeTreeTracking.d.ts.map +1 -0
- package/lib/{mergeTreeTracking.mjs → mergeTreeTracking.js} +3 -2
- package/lib/mergeTreeTracking.js.map +1 -0
- package/lib/{opBuilder.d.mts → opBuilder.d.ts} +4 -4
- package/lib/{opBuilder.d.mts.map → opBuilder.d.ts.map} +1 -1
- package/lib/{opBuilder.mjs → opBuilder.js} +2 -2
- package/lib/opBuilder.js.map +1 -0
- package/lib/{ops.d.mts → ops.d.ts} +1 -1
- package/lib/ops.d.ts.map +1 -0
- package/lib/{ops.mjs → ops.js} +1 -1
- package/lib/ops.js.map +1 -0
- package/lib/{ordinal.d.mts → ordinal.d.ts} +1 -1
- package/lib/ordinal.d.ts.map +1 -0
- package/lib/{ordinal.mjs → ordinal.js} +2 -1
- package/lib/ordinal.js.map +1 -0
- package/lib/{partialLengths.d.mts → partialLengths.d.ts} +6 -6
- package/lib/partialLengths.d.ts.map +1 -0
- package/lib/{partialLengths.mjs → partialLengths.js} +11 -10
- package/lib/partialLengths.js.map +1 -0
- package/lib/{properties.d.mts → properties.d.ts} +1 -1
- package/lib/properties.d.ts.map +1 -0
- package/lib/{properties.mjs → properties.js} +1 -1
- package/lib/properties.js.map +1 -0
- package/lib/{referencePositions.d.mts → referencePositions.d.ts} +5 -5
- package/lib/referencePositions.d.ts.map +1 -0
- package/lib/{referencePositions.mjs → referencePositions.js} +2 -2
- package/lib/referencePositions.js.map +1 -0
- package/lib/{revertibles.d.mts → revertibles.d.ts} +8 -8
- package/lib/revertibles.d.ts.map +1 -0
- package/lib/{revertibles.mjs → revertibles.js} +13 -13
- package/lib/revertibles.js.map +1 -0
- package/lib/{segmentGroupCollection.d.mts → segmentGroupCollection.d.ts} +2 -2
- package/lib/segmentGroupCollection.d.ts.map +1 -0
- package/lib/{segmentGroupCollection.mjs → segmentGroupCollection.js} +2 -2
- package/lib/segmentGroupCollection.js.map +1 -0
- package/lib/{segmentPropertiesManager.d.mts → segmentPropertiesManager.d.ts} +3 -3
- package/lib/segmentPropertiesManager.d.ts.map +1 -0
- package/lib/{segmentPropertiesManager.mjs → segmentPropertiesManager.js} +5 -3
- package/lib/segmentPropertiesManager.js.map +1 -0
- package/lib/{snapshotChunks.d.mts → snapshotChunks.d.ts} +4 -4
- package/lib/snapshotChunks.d.ts.map +1 -0
- package/lib/{snapshotChunks.mjs → snapshotChunks.js} +2 -2
- package/lib/snapshotChunks.js.map +1 -0
- package/lib/{snapshotLoader.d.mts → snapshotLoader.d.ts} +4 -4
- package/lib/snapshotLoader.d.ts.map +1 -0
- package/lib/{snapshotLoader.mjs → snapshotLoader.js} +10 -9
- package/lib/snapshotLoader.js.map +1 -0
- package/lib/{snapshotV1.d.mts → snapshotV1.d.ts} +4 -4
- package/lib/snapshotV1.d.ts.map +1 -0
- package/lib/{snapshotV1.mjs → snapshotV1.js} +24 -7
- package/lib/snapshotV1.js.map +1 -0
- package/lib/{snapshotlegacy.d.mts → snapshotlegacy.d.ts} +3 -3
- package/lib/snapshotlegacy.d.ts.map +1 -0
- package/lib/{snapshotlegacy.mjs → snapshotlegacy.js} +17 -4
- package/lib/snapshotlegacy.js.map +1 -0
- package/lib/{sortedSegmentSet.d.mts → sortedSegmentSet.d.ts} +4 -4
- package/lib/sortedSegmentSet.d.ts.map +1 -0
- package/lib/{sortedSegmentSet.mjs → sortedSegmentSet.js} +3 -2
- package/lib/sortedSegmentSet.js.map +1 -0
- package/lib/{sortedSet.d.mts → sortedSet.d.ts} +1 -1
- package/lib/sortedSet.d.ts.map +1 -0
- package/lib/{sortedSet.mjs → sortedSet.js} +1 -1
- package/lib/sortedSet.js.map +1 -0
- package/lib/test/Insertion.perf.spec.d.ts +6 -0
- package/lib/test/Insertion.perf.spec.d.ts.map +1 -0
- package/lib/test/Insertion.perf.spec.js +111 -0
- package/lib/test/Insertion.perf.spec.js.map +1 -0
- package/lib/test/PartialLengths.perf.spec.d.ts +6 -0
- package/lib/test/PartialLengths.perf.spec.d.ts.map +1 -0
- package/lib/test/PartialLengths.perf.spec.js +65 -0
- package/lib/test/PartialLengths.perf.spec.js.map +1 -0
- package/lib/test/Removal.perf.spec.d.ts +6 -0
- package/lib/test/Removal.perf.spec.d.ts.map +1 -0
- package/lib/test/Removal.perf.spec.js +164 -0
- package/lib/test/Removal.perf.spec.js.map +1 -0
- package/lib/test/Snapshot.perf.spec.d.ts +6 -0
- package/lib/test/Snapshot.perf.spec.d.ts.map +1 -0
- package/lib/test/Snapshot.perf.spec.js +31 -0
- package/lib/test/Snapshot.perf.spec.js.map +1 -0
- package/lib/test/attributionCollection.perf.spec.d.ts +6 -0
- package/lib/test/attributionCollection.perf.spec.d.ts.map +1 -0
- package/lib/test/attributionCollection.perf.spec.js +229 -0
- package/lib/test/attributionCollection.perf.spec.js.map +1 -0
- package/lib/test/attributionCollection.spec.d.ts +6 -0
- package/lib/test/attributionCollection.spec.d.ts.map +1 -0
- package/lib/test/attributionCollection.spec.js +484 -0
- package/lib/test/attributionCollection.spec.js.map +1 -0
- package/lib/test/attributionPolicy.spec.d.ts +6 -0
- package/lib/test/attributionPolicy.spec.d.ts.map +1 -0
- package/lib/test/attributionPolicy.spec.js +187 -0
- package/lib/test/attributionPolicy.spec.js.map +1 -0
- package/lib/test/beastTest.spec.d.ts +54 -0
- package/lib/test/beastTest.spec.d.ts.map +1 -0
- package/lib/test/beastTest.spec.js +1318 -0
- package/lib/test/beastTest.spec.js.map +1 -0
- package/lib/test/client.annotateMarker.spec.d.ts +6 -0
- package/lib/test/client.annotateMarker.spec.d.ts.map +1 -0
- package/lib/test/client.annotateMarker.spec.js +43 -0
- package/lib/test/client.annotateMarker.spec.js.map +1 -0
- package/lib/test/client.apis.spec.d.ts +7 -0
- package/lib/test/client.apis.spec.d.ts.map +1 -0
- package/lib/test/client.apis.spec.js +67 -0
- package/lib/test/client.apis.spec.js.map +1 -0
- package/lib/test/client.applyMsg.spec.d.ts +6 -0
- package/lib/test/client.applyMsg.spec.d.ts.map +1 -0
- package/lib/test/client.applyMsg.spec.js +561 -0
- package/lib/test/client.applyMsg.spec.js.map +1 -0
- package/lib/test/client.applyStashedOpFarm.spec.d.ts +12 -0
- package/lib/test/client.applyStashedOpFarm.spec.d.ts.map +1 -0
- package/lib/test/client.applyStashedOpFarm.spec.js +153 -0
- package/lib/test/client.applyStashedOpFarm.spec.js.map +1 -0
- package/lib/test/client.attributionFarm.spec.d.ts +7 -0
- package/lib/test/client.attributionFarm.spec.d.ts.map +1 -0
- package/lib/test/client.attributionFarm.spec.js +92 -0
- package/lib/test/client.attributionFarm.spec.js.map +1 -0
- package/lib/test/client.conflictFarm.spec.d.ts +15 -0
- package/lib/test/client.conflictFarm.spec.d.ts.map +1 -0
- package/lib/test/client.conflictFarm.spec.js +85 -0
- package/lib/test/client.conflictFarm.spec.js.map +1 -0
- package/lib/test/client.getPosition.spec.d.ts +6 -0
- package/lib/test/client.getPosition.spec.d.ts.map +1 -0
- package/lib/test/client.getPosition.spec.js +52 -0
- package/lib/test/client.getPosition.spec.js.map +1 -0
- package/lib/test/client.localReference.spec.d.ts +6 -0
- package/lib/test/client.localReference.spec.d.ts.map +1 -0
- package/lib/test/client.localReference.spec.js +468 -0
- package/lib/test/client.localReference.spec.js.map +1 -0
- package/lib/test/client.localReferenceFarm.spec.d.ts +6 -0
- package/lib/test/client.localReferenceFarm.spec.d.ts.map +1 -0
- package/lib/test/client.localReferenceFarm.spec.js +86 -0
- package/lib/test/client.localReferenceFarm.spec.js.map +1 -0
- package/lib/test/client.rebasePosition.spec.d.ts +6 -0
- package/lib/test/client.rebasePosition.spec.d.ts.map +1 -0
- package/lib/test/client.rebasePosition.spec.js +100 -0
- package/lib/test/client.rebasePosition.spec.js.map +1 -0
- package/lib/test/client.reconnectFarm.spec.d.ts +12 -0
- package/lib/test/client.reconnectFarm.spec.d.ts.map +1 -0
- package/lib/test/client.reconnectFarm.spec.js +88 -0
- package/lib/test/client.reconnectFarm.spec.js.map +1 -0
- package/lib/test/client.replay.spec.d.ts +6 -0
- package/lib/test/client.replay.spec.d.ts.map +1 -0
- package/lib/test/client.replay.spec.js +57 -0
- package/lib/test/client.replay.spec.js.map +1 -0
- package/lib/test/client.rollback.spec.d.ts +6 -0
- package/lib/test/client.rollback.spec.d.ts.map +1 -0
- package/lib/test/client.rollback.spec.js +451 -0
- package/lib/test/client.rollback.spec.js.map +1 -0
- package/lib/test/client.rollbackFarm.spec.d.ts +6 -0
- package/lib/test/client.rollbackFarm.spec.d.ts.map +1 -0
- package/lib/test/client.rollbackFarm.spec.js +46 -0
- package/lib/test/client.rollbackFarm.spec.js.map +1 -0
- package/lib/test/client.searchForMarker.spec.d.ts +6 -0
- package/lib/test/client.searchForMarker.spec.d.ts.map +1 -0
- package/lib/test/client.searchForMarker.spec.js +495 -0
- package/lib/test/client.searchForMarker.spec.js.map +1 -0
- package/lib/test/client.walkSegments.spec.d.ts +6 -0
- package/lib/test/client.walkSegments.spec.d.ts.map +1 -0
- package/lib/test/client.walkSegments.spec.js +52 -0
- package/lib/test/client.walkSegments.spec.js.map +1 -0
- package/lib/test/collections.list.spec.d.ts +6 -0
- package/lib/test/collections.list.spec.d.ts.map +1 -0
- package/lib/test/collections.list.spec.js +82 -0
- package/lib/test/collections.list.spec.js.map +1 -0
- package/lib/test/createInsertOnlyAttributionPolicy.spec.d.ts +6 -0
- package/lib/test/createInsertOnlyAttributionPolicy.spec.d.ts.map +1 -0
- package/lib/test/createInsertOnlyAttributionPolicy.spec.js +33 -0
- package/lib/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -0
- package/lib/test/dirname.cjs +16 -0
- package/lib/test/dirname.cjs.map +1 -0
- package/lib/test/dirname.d.cts +6 -0
- package/lib/test/dirname.d.cts.map +1 -0
- package/lib/test/index.d.ts +13 -0
- package/lib/test/index.d.ts.map +1 -0
- package/lib/test/index.js +13 -0
- package/lib/test/index.js.map +1 -0
- package/lib/test/mergeTree.annotate.deltaCallback.spec.d.ts +6 -0
- package/lib/test/mergeTree.annotate.deltaCallback.spec.d.ts.map +1 -0
- package/lib/test/mergeTree.annotate.deltaCallback.spec.js +140 -0
- package/lib/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -0
- package/lib/test/mergeTree.annotate.spec.d.ts +6 -0
- package/lib/test/mergeTree.annotate.spec.d.ts.map +1 -0
- package/lib/test/mergeTree.annotate.spec.js +446 -0
- package/lib/test/mergeTree.annotate.spec.js.map +1 -0
- package/lib/test/mergeTree.insert.deltaCallback.spec.d.ts +6 -0
- package/lib/test/mergeTree.insert.deltaCallback.spec.d.ts.map +1 -0
- package/lib/test/mergeTree.insert.deltaCallback.spec.js +124 -0
- package/lib/test/mergeTree.insert.deltaCallback.spec.js.map +1 -0
- package/lib/test/mergeTree.insertingWalk.spec.d.ts +6 -0
- package/lib/test/mergeTree.insertingWalk.spec.d.ts.map +1 -0
- package/lib/test/mergeTree.insertingWalk.spec.js +277 -0
- package/lib/test/mergeTree.insertingWalk.spec.js.map +1 -0
- package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.d.ts +6 -0
- package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.d.ts.map +1 -0
- package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +176 -0
- package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -0
- package/lib/test/mergeTree.markRangeRemoved.spec.d.ts +6 -0
- package/lib/test/mergeTree.markRangeRemoved.spec.d.ts.map +1 -0
- package/lib/test/mergeTree.markRangeRemoved.spec.js +128 -0
- package/lib/test/mergeTree.markRangeRemoved.spec.js.map +1 -0
- package/lib/test/mergeTree.walk.spec.d.ts +6 -0
- package/lib/test/mergeTree.walk.spec.d.ts.map +1 -0
- package/lib/test/mergeTree.walk.spec.js +61 -0
- package/lib/test/mergeTree.walk.spec.js.map +1 -0
- package/lib/test/mergeTree.zamboni.spec.d.ts +6 -0
- package/lib/test/mergeTree.zamboni.spec.d.ts.map +1 -0
- package/lib/test/mergeTree.zamboni.spec.js +50 -0
- package/lib/test/mergeTree.zamboni.spec.js.map +1 -0
- package/lib/test/mergeTreeOperationRunner.d.ts +63 -0
- package/lib/test/mergeTreeOperationRunner.d.ts.map +1 -0
- package/lib/test/mergeTreeOperationRunner.js +207 -0
- package/lib/test/mergeTreeOperationRunner.js.map +1 -0
- package/lib/test/mergeTreeOperationRunner.spec.d.ts +6 -0
- package/lib/test/mergeTreeOperationRunner.spec.d.ts.map +1 -0
- package/lib/test/mergeTreeOperationRunner.spec.js +154 -0
- package/lib/test/mergeTreeOperationRunner.spec.js.map +1 -0
- package/lib/test/obliterate.concurrent.spec.d.ts +6 -0
- package/lib/test/obliterate.concurrent.spec.d.ts.map +1 -0
- package/lib/test/obliterate.concurrent.spec.js +1441 -0
- package/lib/test/obliterate.concurrent.spec.js.map +1 -0
- package/lib/test/obliterate.deltaCallback.spec.d.ts +6 -0
- package/lib/test/obliterate.deltaCallback.spec.d.ts.map +1 -0
- package/lib/test/obliterate.deltaCallback.spec.js +144 -0
- package/lib/test/obliterate.deltaCallback.spec.js.map +1 -0
- package/lib/test/obliterate.partialLength.spec.d.ts +6 -0
- package/lib/test/obliterate.partialLength.spec.d.ts.map +1 -0
- package/lib/test/obliterate.partialLength.spec.js +272 -0
- package/lib/test/obliterate.partialLength.spec.js.map +1 -0
- package/lib/test/obliterate.reconnect.spec.d.ts +6 -0
- package/lib/test/obliterate.reconnect.spec.d.ts.map +1 -0
- package/lib/test/obliterate.reconnect.spec.js +159 -0
- package/lib/test/obliterate.reconnect.spec.js.map +1 -0
- package/lib/test/obliterate.spec.d.ts +6 -0
- package/lib/test/obliterate.spec.d.ts.map +1 -0
- package/lib/test/obliterate.spec.js +160 -0
- package/lib/test/obliterate.spec.js.map +1 -0
- package/lib/test/ordinal.spec.d.ts +2 -0
- package/lib/test/ordinal.spec.d.ts.map +1 -0
- package/lib/test/ordinal.spec.js +38 -0
- package/lib/test/ordinal.spec.js.map +1 -0
- package/lib/test/partialLength.spec.d.ts +6 -0
- package/lib/test/partialLength.spec.d.ts.map +1 -0
- package/lib/test/partialLength.spec.js +274 -0
- package/lib/test/partialLength.spec.js.map +1 -0
- package/lib/test/properties.spec.d.ts +6 -0
- package/lib/test/properties.spec.d.ts.map +1 -0
- package/lib/test/properties.spec.js +53 -0
- package/lib/test/properties.spec.js.map +1 -0
- package/lib/test/reconnectHelper.d.ts +48 -0
- package/lib/test/reconnectHelper.d.ts.map +1 -0
- package/lib/test/reconnectHelper.js +82 -0
- package/lib/test/reconnectHelper.js.map +1 -0
- package/lib/test/resetPendingSegmentsToOp.spec.d.ts +6 -0
- package/lib/test/resetPendingSegmentsToOp.spec.d.ts.map +1 -0
- package/lib/test/resetPendingSegmentsToOp.spec.js +235 -0
- package/lib/test/resetPendingSegmentsToOp.spec.js.map +1 -0
- package/lib/test/revertibleFarm.spec.d.ts +6 -0
- package/lib/test/revertibleFarm.spec.d.ts.map +1 -0
- package/lib/test/revertibleFarm.spec.js +119 -0
- package/lib/test/revertibleFarm.spec.js.map +1 -0
- package/lib/test/revertibles.spec.d.ts +17 -0
- package/lib/test/revertibles.spec.d.ts.map +1 -0
- package/lib/test/revertibles.spec.js +381 -0
- package/lib/test/revertibles.spec.js.map +1 -0
- package/lib/test/segmentGroupCollection.spec.d.ts +6 -0
- package/lib/test/segmentGroupCollection.spec.d.ts.map +1 -0
- package/lib/test/segmentGroupCollection.spec.js +58 -0
- package/lib/test/segmentGroupCollection.spec.js.map +1 -0
- package/lib/test/snapshot.spec.d.ts +6 -0
- package/lib/test/snapshot.spec.d.ts.map +1 -0
- package/lib/test/snapshot.spec.js +176 -0
- package/lib/test/snapshot.spec.js.map +1 -0
- package/lib/test/snapshot.utils.d.ts +33 -0
- package/lib/test/snapshot.utils.d.ts.map +1 -0
- package/lib/test/snapshot.utils.js +104 -0
- package/lib/test/snapshot.utils.js.map +1 -0
- package/lib/test/snapshotlegacy.spec.d.ts +6 -0
- package/lib/test/snapshotlegacy.spec.d.ts.map +1 -0
- package/lib/test/snapshotlegacy.spec.js +137 -0
- package/lib/test/snapshotlegacy.spec.js.map +1 -0
- package/lib/test/sortedSegmentSet.spec.d.ts +6 -0
- package/lib/test/sortedSegmentSet.spec.d.ts.map +1 -0
- package/lib/test/sortedSegmentSet.spec.js +93 -0
- package/lib/test/sortedSegmentSet.spec.js.map +1 -0
- package/lib/test/testClient.d.ts +116 -0
- package/lib/test/testClient.d.ts.map +1 -0
- package/lib/test/testClient.js +430 -0
- package/lib/test/testClient.js.map +1 -0
- package/lib/test/testClientLogger.d.ts +44 -0
- package/lib/test/testClientLogger.d.ts.map +1 -0
- package/lib/test/testClientLogger.js +282 -0
- package/lib/test/testClientLogger.js.map +1 -0
- package/lib/test/testSerializer.d.ts +18 -0
- package/lib/test/testSerializer.d.ts.map +1 -0
- package/lib/test/testSerializer.js +29 -0
- package/lib/test/testSerializer.js.map +1 -0
- package/lib/test/testServer.d.ts +36 -0
- package/lib/test/testServer.d.ts.map +1 -0
- package/lib/test/testServer.js +133 -0
- package/lib/test/testServer.js.map +1 -0
- package/lib/test/testUtils.d.ts +77 -0
- package/lib/test/testUtils.d.ts.map +1 -0
- package/lib/test/testUtils.js +151 -0
- package/lib/test/testUtils.js.map +1 -0
- package/lib/test/text.d.ts +9 -0
- package/lib/test/text.d.ts.map +1 -0
- package/lib/test/text.js +71 -0
- package/lib/test/text.js.map +1 -0
- package/lib/test/tracking.spec.d.ts +6 -0
- package/lib/test/tracking.spec.d.ts.map +1 -0
- package/lib/test/tracking.spec.js +118 -0
- package/lib/test/tracking.spec.js.map +1 -0
- package/lib/test/types/validateMergeTreePrevious.generated.d.ts +2 -0
- package/lib/test/types/validateMergeTreePrevious.generated.d.ts.map +1 -0
- package/lib/test/types/validateMergeTreePrevious.generated.js +228 -0
- package/lib/test/types/validateMergeTreePrevious.generated.js.map +1 -0
- package/lib/test/wordUnitTests.spec.d.ts +6 -0
- package/lib/test/wordUnitTests.spec.d.ts.map +1 -0
- package/lib/test/wordUnitTests.spec.js +166 -0
- package/lib/test/wordUnitTests.spec.js.map +1 -0
- package/lib/{textSegment.d.mts → textSegment.d.ts} +4 -4
- package/lib/textSegment.d.ts.map +1 -0
- package/lib/{textSegment.mjs → textSegment.js} +2 -2
- package/lib/textSegment.js.map +1 -0
- package/lib/{zamboni.d.mts → zamboni.d.ts} +3 -3
- package/lib/zamboni.d.ts.map +1 -0
- package/lib/{zamboni.mjs → zamboni.js} +7 -6
- package/lib/zamboni.js.map +1 -0
- package/package.json +50 -57
- package/src/MergeTreeTextHelper.ts +4 -4
- package/src/attributionCollection.ts +1 -1
- package/src/attributionPolicy.ts +5 -5
- package/src/client.ts +50 -41
- package/src/collections/index.ts +2 -2
- package/src/endOfTreeSegment.ts +5 -5
- package/src/index.ts +20 -20
- package/src/localReference.ts +13 -7
- package/src/mergeTree.ts +53 -44
- package/src/mergeTreeDeltaCallback.ts +3 -8
- package/src/mergeTreeNodeWalk.ts +1 -1
- package/src/mergeTreeNodes.ts +21 -19
- package/src/mergeTreeTracking.ts +3 -3
- package/src/opBuilder.ts +3 -3
- package/src/partialLengths.ts +10 -10
- package/src/referencePositions.ts +4 -4
- package/src/revertibles.ts +14 -18
- package/src/segmentGroupCollection.ts +2 -2
- package/src/segmentPropertiesManager.ts +3 -3
- package/src/snapshotChunks.ts +4 -4
- package/src/snapshotLoader.ts +14 -11
- package/src/snapshotV1.ts +29 -9
- package/src/snapshotlegacy.ts +19 -5
- package/src/sortedSegmentSet.ts +3 -3
- package/src/textSegment.ts +3 -3
- package/src/zamboni.ts +7 -7
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +2 -5
- package/api-extractor-esm.json +0 -17
- package/dist/test/beastTest.d.ts.map +0 -1
- package/dist/test/beastTest.js.map +0 -1
- package/dist/test/client.apis.d.ts.map +0 -1
- package/dist/test/client.apis.js.map +0 -1
- package/dist/test/wordUnitTests.d.ts.map +0 -1
- package/dist/test/wordUnitTests.js.map +0 -1
- package/lib/MergeTreeTextHelper.d.mts.map +0 -1
- package/lib/MergeTreeTextHelper.mjs.map +0 -1
- package/lib/attributionCollection.d.mts.map +0 -1
- package/lib/attributionCollection.mjs.map +0 -1
- package/lib/attributionPolicy.d.mts.map +0 -1
- package/lib/attributionPolicy.mjs.map +0 -1
- package/lib/client.d.mts.map +0 -1
- package/lib/client.mjs.map +0 -1
- package/lib/collections/index.d.mts.map +0 -1
- package/lib/collections/index.mjs +0 -7
- package/lib/collections/index.mjs.map +0 -1
- package/lib/collections/list.d.mts.map +0 -1
- package/lib/collections/list.mjs.map +0 -1
- package/lib/collections/rbTree.d.mts.map +0 -1
- package/lib/collections/rbTree.mjs.map +0 -1
- package/lib/constants.d.mts.map +0 -1
- package/lib/constants.mjs.map +0 -1
- package/lib/endOfTreeSegment.d.mts.map +0 -1
- package/lib/endOfTreeSegment.mjs.map +0 -1
- package/lib/index.d.mts.map +0 -1
- package/lib/index.mjs.map +0 -1
- package/lib/localReference.d.mts.map +0 -1
- package/lib/localReference.mjs.map +0 -1
- package/lib/merge-tree-beta.d.mts +0 -668
- package/lib/merge-tree-public.d.mts +0 -668
- package/lib/mergeTree.d.mts.map +0 -1
- package/lib/mergeTree.mjs.map +0 -1
- package/lib/mergeTreeDeltaCallback.d.mts.map +0 -1
- package/lib/mergeTreeDeltaCallback.mjs.map +0 -1
- package/lib/mergeTreeNodeWalk.d.mts.map +0 -1
- package/lib/mergeTreeNodeWalk.mjs.map +0 -1
- package/lib/mergeTreeNodes.d.mts.map +0 -1
- package/lib/mergeTreeNodes.mjs.map +0 -1
- package/lib/mergeTreeTracking.d.mts.map +0 -1
- package/lib/mergeTreeTracking.mjs.map +0 -1
- package/lib/opBuilder.mjs.map +0 -1
- package/lib/ops.d.mts.map +0 -1
- package/lib/ops.mjs.map +0 -1
- package/lib/ordinal.d.mts.map +0 -1
- package/lib/ordinal.mjs.map +0 -1
- package/lib/partialLengths.d.mts.map +0 -1
- package/lib/partialLengths.mjs.map +0 -1
- package/lib/properties.d.mts.map +0 -1
- package/lib/properties.mjs.map +0 -1
- package/lib/referencePositions.d.mts.map +0 -1
- package/lib/referencePositions.mjs.map +0 -1
- package/lib/revertibles.d.mts.map +0 -1
- package/lib/revertibles.mjs.map +0 -1
- package/lib/segmentGroupCollection.d.mts.map +0 -1
- package/lib/segmentGroupCollection.mjs.map +0 -1
- package/lib/segmentPropertiesManager.d.mts.map +0 -1
- package/lib/segmentPropertiesManager.mjs.map +0 -1
- package/lib/snapshotChunks.d.mts.map +0 -1
- package/lib/snapshotChunks.mjs.map +0 -1
- package/lib/snapshotLoader.d.mts.map +0 -1
- package/lib/snapshotLoader.mjs.map +0 -1
- package/lib/snapshotV1.d.mts.map +0 -1
- package/lib/snapshotV1.mjs.map +0 -1
- package/lib/snapshotlegacy.d.mts.map +0 -1
- package/lib/snapshotlegacy.mjs.map +0 -1
- package/lib/sortedSegmentSet.d.mts.map +0 -1
- package/lib/sortedSegmentSet.mjs.map +0 -1
- package/lib/sortedSet.d.mts.map +0 -1
- package/lib/sortedSet.mjs.map +0 -1
- package/lib/textSegment.d.mts.map +0 -1
- package/lib/textSegment.mjs.map +0 -1
- package/lib/zamboni.d.mts.map +0 -1
- package/lib/zamboni.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Removal.perf.spec.js","sourceRoot":"","sources":["../../src/test/Removal.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,sDAAkE;AAClE,gCAA4C;AAC5C,gDAA6F;AAC7F,2CAA+C;AAC/C,qDAA4D;AAE5D,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,IAAI,OAAO,CAAC;IAEZ,IAAA,qBAAS,EAAC;QACT,IAAI,EAAE,yBAAa,CAAC,WAAW;QAC/B,sEAAsE;QACtE,uEAAuE;QACvE,UAAU;QACV,KAAK,EAAE,uBAAuB;QAC9B,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,GAAG,EAAE;YACZ,MAAM,GAAG,GAAG,IAAI,2BAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;gBAC9B,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aACvB;YAED,G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Q,EAAE,CAAC;gBACX,GAAG,EAAE,IAAI;gBACT,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,wBAAkB,CAAC,MAAM,EAAE,EAAE;gBACnD,SAAS,EAAE,KAAK;aAChB,CAAC,CAAC;QACJ,CAAC;KACD,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { benchmark, BenchmarkType } from \"@fluid-tools/benchmark\";\nimport { MergeTreeDeltaType } from \"../ops\";\nimport { appendToMergeTreeDeltaRevertibles, MergeTreeDeltaRevertible } from \"../revertibles\";\nimport { markRangeRemoved } from \"./testUtils\";\nimport { loadSnapshot, TestString } from \"./snapshot.utils\";\n\ndescribe(\"MergeTree remove\", () => {\n\tlet summary;\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\t// baseline summary benchmark to compare to other remove tests. such a\n\t\t// comparison should give a (rough) sense of overhead caused by summary\n\t\t// loading\n\t\ttitle: \"baseline summary load\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tawait loadSnapshot(summary);\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove large range of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: 1000,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n\n\tfor (const length of [10, 100, 1000]) {\n\t\tbenchmark({\n\t\t\ttype: BenchmarkType.Measurement,\n\t\t\ttitle: \"remove large range of large tree with undo-redo\",\n\t\t\tcategory: \"remove\",\n\t\t\tbefore: () => {\n\t\t\t\tconst str = new TestString(\"id\", {});\n\t\t\t\tfor (let i = 0; i < length / 2; i++) {\n\t\t\t\t\tstr.append(\"a\", true);\n\t\t\t\t\tstr.appendMarker(true);\n\t\t\t\t}\n\n\t\t\t\tstr.applyPendingOps();\n\t\t\t\tsummary = str.getSummary();\n\t\t\t},\n\t\t\tbenchmarkFnAsync: async () => {\n\t\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\t\tconst revertibles: MergeTreeDeltaRevertible[] = [];\n\t\t\t\tstr.on(\"delta\", (_op, delta) => {\n\t\t\t\t\tappendToMergeTreeDeltaRevertibles(delta, revertibles);\n\t\t\t\t});\n\n\t\t\t\tconst op = str.removeRangeLocal(0, length - 1);\n\t\t\t\tstr.applyMsg(\n\t\t\t\t\tstr.makeOpMessage(\n\t\t\t\t\t\top,\n\t\t\t\t\t\t/* seq */ length + 1,\n\t\t\t\t\t\t/* refSeq */ length,\n\t\t\t\t\t\tstr.longClientId,\n\t\t\t\t\t\t/* minSeq */ length,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\t}\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove start of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: 1,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove middle of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 499,\n\t\t\t\tend: 501,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove end of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 999,\n\t\t\t\tend: 1000,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n});\n"]}
|
|
1
|
+
{"version":3,"file":"Removal.perf.spec.js","sourceRoot":"","sources":["../../src/test/Removal.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,sDAAkE;AAClE,sCAA+C;AAC/C,sDAAgG;AAChG,iDAAkD;AAClD,2DAA+D;AAE/D,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,IAAI,OAAO,CAAC;IAEZ,IAAA,qBAAS,EAAC;QACT,IAAI,EAAE,yBAAa,CAAC,WAAW;QAC/B,sEAAsE;QACtE,uEAAuE;QACvE,UAAU;QACV,KAAK,EAAE,uBAAuB;QAC9B,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,GAAG,EAAE;YACZ,MAAM,GAAG,GAAG,IAAI,8BAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;gBAC9B,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aACvB;YAED,GAAG,CAAC,eAAe,EAAE,CAAC;YACtB,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;QAC5B,CAAC;QACD,gBAAgB,EAAE,KAAK,IAAI,EAAE;YAC5B,MAAM,IAAA,gCAAY,EAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;KACD,CAAC,CAAC;IAEH,IAAA,qBAAS,EAAC;QACT,IAAI,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(c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { benchmark, BenchmarkType } from \"@fluid-tools/benchmark\";\nimport { MergeTreeDeltaType } from \"../ops.js\";\nimport { appendToMergeTreeDeltaRevertibles, MergeTreeDeltaRevertible } from \"../revertibles.js\";\nimport { markRangeRemoved } from \"./testUtils.js\";\nimport { loadSnapshot, TestString } from \"./snapshot.utils.js\";\n\ndescribe(\"MergeTree remove\", () => {\n\tlet summary;\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\t// baseline summary benchmark to compare to other remove tests. such a\n\t\t// comparison should give a (rough) sense of overhead caused by summary\n\t\t// loading\n\t\ttitle: \"baseline summary load\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tawait loadSnapshot(summary);\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove large range of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: 1000,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n\n\tfor (const length of [10, 100, 1000]) {\n\t\tbenchmark({\n\t\t\ttype: BenchmarkType.Measurement,\n\t\t\ttitle: \"remove large range of large tree with undo-redo\",\n\t\t\tcategory: \"remove\",\n\t\t\tbefore: () => {\n\t\t\t\tconst str = new TestString(\"id\", {});\n\t\t\t\tfor (let i = 0; i < length / 2; i++) {\n\t\t\t\t\tstr.append(\"a\", true);\n\t\t\t\t\tstr.appendMarker(true);\n\t\t\t\t}\n\n\t\t\t\tstr.applyPendingOps();\n\t\t\t\tsummary = str.getSummary();\n\t\t\t},\n\t\t\tbenchmarkFnAsync: async () => {\n\t\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\t\tconst revertibles: MergeTreeDeltaRevertible[] = [];\n\t\t\t\tstr.on(\"delta\", (_op, delta) => {\n\t\t\t\t\tappendToMergeTreeDeltaRevertibles(delta, revertibles);\n\t\t\t\t});\n\n\t\t\t\tconst op = str.removeRangeLocal(0, length - 1);\n\t\t\t\tstr.applyMsg(\n\t\t\t\t\tstr.makeOpMessage(\n\t\t\t\t\t\top,\n\t\t\t\t\t\t/* seq */ length + 1,\n\t\t\t\t\t\t/* refSeq */ length,\n\t\t\t\t\t\tstr.longClientId,\n\t\t\t\t\t\t/* minSeq */ length,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\t}\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove start of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 0,\n\t\t\t\tend: 1,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove middle of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 499,\n\t\t\t\tend: 501,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n\n\tbenchmark({\n\t\ttype: BenchmarkType.Measurement,\n\t\ttitle: \"remove end of large tree\",\n\t\tcategory: \"remove\",\n\t\tbefore: () => {\n\t\t\tconst str = new TestString(\"id\", {});\n\t\t\tfor (let i = 0; i < 1000; i++) {\n\t\t\t\tstr.append(\"a\", false);\n\t\t\t}\n\n\t\t\tstr.applyPendingOps();\n\t\t\tsummary = str.getSummary();\n\t\t},\n\t\tbenchmarkFnAsync: async () => {\n\t\t\tconst str = await loadSnapshot(summary);\n\n\t\t\tmarkRangeRemoved({\n\t\t\t\tmergeTree: str.mergeTree,\n\t\t\t\tstart: 999,\n\t\t\t\tend: 1000,\n\t\t\t\trefSeq: 1000,\n\t\t\t\tclientId: 0,\n\t\t\t\tseq: 1001,\n\t\t\t\topArgs: { op: { type: MergeTreeDeltaType.REMOVE } },\n\t\t\t\toverwrite: false,\n\t\t\t});\n\t\t},\n\t});\n});\n"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const benchmark_1 = require("@fluid-tools/benchmark");
|
|
8
|
-
const
|
|
8
|
+
const snapshot_utils_js_1 = require("./snapshot.utils.js");
|
|
9
9
|
describe("MergeTree snapshots", () => {
|
|
10
10
|
let summary;
|
|
11
11
|
for (const summarySize of [10, 50, 100, 500, 1000, 5000, 10000]) {
|
|
@@ -14,7 +14,7 @@ describe("MergeTree snapshots", () => {
|
|
|
14
14
|
title: `load snapshot with ${summarySize} segments`,
|
|
15
15
|
category: "snapshot loading",
|
|
16
16
|
before: () => {
|
|
17
|
-
const str = new
|
|
17
|
+
const str = new snapshot_utils_js_1.TestString("id", {});
|
|
18
18
|
for (let i = 0; i < summarySize; i++) {
|
|
19
19
|
str.append("a", false);
|
|
20
20
|
}
|
|
@@ -22,7 +22,7 @@ describe("MergeTree snapshots", () => {
|
|
|
22
22
|
summary = str.getSummary();
|
|
23
23
|
},
|
|
24
24
|
benchmarkFnAsync: async () => {
|
|
25
|
-
await (0,
|
|
25
|
+
await (0, snapshot_utils_js_1.loadSnapshot)(summary);
|
|
26
26
|
},
|
|
27
27
|
after: () => {
|
|
28
28
|
summary = undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snapshot.perf.spec.js","sourceRoot":"","sources":["../../src/test/Snapshot.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,sDAAkE;AAClE,
|
|
1
|
+
{"version":3,"file":"Snapshot.perf.spec.js","sourceRoot":"","sources":["../../src/test/Snapshot.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,sDAAkE;AAClE,2DAA+D;AAE/D,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,IAAI,OAAO,CAAC;IAEZ,KAAK,MAAM,WAAW,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAK,EAAE,KAAM,CAAC,EAAE;QAClE,IAAA,qBAAS,EAAC;YACT,IAAI,EAAE,yBAAa,CAAC,WAAW;YAC/B,KAAK,EAAE,sBAAsB,WAAW,WAAW;YACnD,QAAQ,EAAE,kBAAkB;YAC5B,MAAM,EAAE,GAAG,EAAE;gBACZ,MAAM,GAAG,GAAG,IAAI,8BAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE;oBACrC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;iBACvB;gBAED,GAAG,CAAC,eAAe,EAAE,CAAC;gBACtB,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;YAC5B,CAAC;YACD,gBAAgB,EAAE,KAAK,IAAI,EAAE;gBAC5B,MAAM,IAAA,gCAAY,EAAC,OAAO,CAAC,CAAC;YAC7B,CAAC;YACD,KAAK,EAAE,GAAG,EAAE;gBACX,OAAO,GAAG,SAAS,CAAC;YACrB,CAAC;SACD,CAAC,CAAC;KACH;AACF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { benchmark, BenchmarkType } from \"@fluid-tools/benchmark\";\nimport { loadSnapshot, TestString } from \"./snapshot.utils.js\";\n\ndescribe(\"MergeTree snapshots\", () => {\n\tlet summary;\n\n\tfor (const summarySize of [10, 50, 100, 500, 1000, 5_000, 10_000]) {\n\t\tbenchmark({\n\t\t\ttype: BenchmarkType.Measurement,\n\t\t\ttitle: `load snapshot with ${summarySize} segments`,\n\t\t\tcategory: \"snapshot loading\",\n\t\t\tbefore: () => {\n\t\t\t\tconst str = new TestString(\"id\", {});\n\t\t\t\tfor (let i = 0; i < summarySize; i++) {\n\t\t\t\t\tstr.append(\"a\", false);\n\t\t\t\t}\n\n\t\t\t\tstr.applyPendingOps();\n\t\t\t\tsummary = str.getSummary();\n\t\t\t},\n\t\t\tbenchmarkFnAsync: async () => {\n\t\t\t\tawait loadSnapshot(summary);\n\t\t\t},\n\t\t\tafter: () => {\n\t\t\t\tsummary = undefined;\n\t\t\t},\n\t\t});\n\t}\n});\n"]}
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const assert_1 = require("assert");
|
|
8
8
|
const benchmark_1 = require("@fluid-tools/benchmark");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
9
|
+
const attributionCollection_js_1 = require("../attributionCollection.js");
|
|
10
|
+
const textSegment_js_1 = require("../textSegment.js");
|
|
11
|
+
const mergeTreeNodes_js_1 = require("../mergeTreeNodes.js");
|
|
12
|
+
const index_js_1 = require("../collections/index.js");
|
|
13
13
|
function getCollectionSizes(ctor, baseSuiteType) {
|
|
14
14
|
const singleKeyCollection = new ctor(5, { type: "op", seq: 42 });
|
|
15
15
|
const tenKeyCollection = new ctor(2, { type: "op", seq: 0 });
|
|
@@ -17,7 +17,7 @@ function getCollectionSizes(ctor, baseSuiteType) {
|
|
|
17
17
|
tenKeyCollection.append(new ctor(3 * i, { type: "op", seq: i }));
|
|
18
18
|
}
|
|
19
19
|
const maxSizeCollection = new ctor(1, { type: "op", seq: 0 });
|
|
20
|
-
for (let i = 1; i <
|
|
20
|
+
for (let i = 1; i < textSegment_js_1.TextSegmentGranularity; i++) {
|
|
21
21
|
maxSizeCollection.append(new ctor(1, { type: "op", seq: i }));
|
|
22
22
|
}
|
|
23
23
|
return [
|
|
@@ -99,7 +99,7 @@ class TreeAttributionCollection {
|
|
|
99
99
|
// eslint-disable-next-line @rushstack/no-new-null
|
|
100
100
|
baseEntry) {
|
|
101
101
|
this._length = _length;
|
|
102
|
-
this.entries = new
|
|
102
|
+
this.entries = new index_js_1.RedBlackTree(mergeTreeNodes_js_1.compareNumbers);
|
|
103
103
|
if (baseEntry !== undefined) {
|
|
104
104
|
this.entries.put(0, baseEntry);
|
|
105
105
|
}
|
|
@@ -135,7 +135,7 @@ class TreeAttributionCollection {
|
|
|
135
135
|
append(other) {
|
|
136
136
|
const lastEntry = this.getAtOffset(this.length - 1);
|
|
137
137
|
other.entries.map(({ key, data }) => {
|
|
138
|
-
if (key !== 0 || !(0,
|
|
138
|
+
if (key !== 0 || !(0, attributionCollection_js_1.areEqualAttributionKeys)(lastEntry, data)) {
|
|
139
139
|
this.entries.put(key + this.length, data);
|
|
140
140
|
}
|
|
141
141
|
return true;
|
|
@@ -199,7 +199,7 @@ class TreeAttributionCollection {
|
|
|
199
199
|
segmentsWithAttribution++;
|
|
200
200
|
for (const { offset, key: info } of segment.attribution?.getAll()?.root ?? []) {
|
|
201
201
|
if (mostRecentAttributionKey === undefined ||
|
|
202
|
-
!(0,
|
|
202
|
+
!(0, attributionCollection_js_1.areEqualAttributionKeys)(info, mostRecentAttributionKey)) {
|
|
203
203
|
posBreakpoints.push(offset + cumulativePos);
|
|
204
204
|
seqs.push(!info ? null : info.type === "op" ? info.seq : info);
|
|
205
205
|
}
|
|
@@ -225,7 +225,7 @@ describe("IAttributionCollection perf", () => {
|
|
|
225
225
|
runAttributionCollectionSuite(TreeAttributionCollection, benchmark_1.BenchmarkType.Diagnostic);
|
|
226
226
|
});
|
|
227
227
|
describe("list-based implementation", () => {
|
|
228
|
-
runAttributionCollectionSuite(
|
|
228
|
+
runAttributionCollectionSuite(attributionCollection_js_1.AttributionCollection, benchmark_1.BenchmarkType.Measurement);
|
|
229
229
|
});
|
|
230
230
|
});
|
|
231
231
|
//# sourceMappingURL=attributionCollection.perf.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributionCollection.perf.spec.js","sourceRoot":"","sources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I,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;qBAC/D;oBACD,wBAAwB,GAAG,IAAI,CAAC;iBAChC;aACD;iBAAM;gBACN,0BAA0B,EAAE,CAAC;aAC7B;YAED,aAAa,IAAI,OAAO,CAAC,YAAY,CAAC;SACtC;QAED,IAAA,eAAM,EACL,uBAAuB,KAAK,CAAC,IAAI,0BAA0B,KAAK,CAAC,EACjE,8EAA8E,CAC9E,CAAC;QAEF,MAAM,YAAY,GAAoC;YACrD,IAAI;YACJ,cAAc;YACd,MAAM,EAAE,aAAa;SACrB,CAAC;QACF,OAAO,YAAY,CAAC;IACrB,CAAC;CACD;AAED,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC5C,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACpC,6BAA6B,CAAC,yBAAyB,EAAE,yBAAa,CAAC,UAAU,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;QAC1C,6BAA6B,CAAC,6CAAwB,EAAE,yBAAa,CAAC,WAAW,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"assert\";\nimport { benchmark, BenchmarkType } from \"@fluid-tools/benchmark\";\nimport { AttributionKey } from \"@fluidframework/runtime-definitions\";\nimport {\n\tareEqualAttributionKeys,\n\tAttributionCollection as NewAttributionCollection,\n\tIAttributionCollection,\n\tIAttributionCollectionSpec,\n\tSerializedAttributionCollection,\n} from \"../attributionCollection\";\nimport { TextSegmentGranularity } from \"../textSegment\";\nimport { compareNumbers, ISegment } from \"../mergeTreeNodes\";\nimport { RedBlackTree } from \"../collections\";\n\ninterface IAttributionCollectionCtor {\n\tnew (length: number, key?: AttributionKey): IAttributionCollection<AttributionKey>;\n\n\tserializeAttributionCollections(\n\t\tsegments: Iterable<{\n\t\t\tattribution?: IAttributionCollection<AttributionKey>;\n\t\t\tcachedLength: number;\n\t\t}>,\n\t): SerializedAttributionCollection;\n\n\tpopulateAttributionCollections(\n\t\tsegments: Iterable<ISegment>,\n\t\tsummary: SerializedAttributionCollection,\n\t): void;\n}\n\nfunction getCollectionSizes(\n\tctor: IAttributionCollectionCtor,\n\tbaseSuiteType: BenchmarkType,\n): {\n\tname: string;\n\tcollection: IAttributionCollection<AttributionKey>;\n\ttype: BenchmarkType;\n}[] {\n\tconst singleKeyCollection = new ctor(5, { type: \"op\", seq: 42 });\n\tconst tenKeyCollection = new ctor(2, { type: \"op\", seq: 0 });\n\tfor (let i = 1; i < 10; i++) {\n\t\ttenKeyCollection.append(new ctor(3 * i, { type: \"op\", seq: i }));\n\t}\n\tconst maxSizeCollection = new ctor(1, { type: \"op\", seq: 0 });\n\tfor (let i = 1; i < TextSegmentGranularity; i++) {\n\t\tmaxSizeCollection.append(new ctor(1, { type: \"op\", seq: i }));\n\t}\n\treturn [\n\t\t{ name: \"one key\", collection: singleKeyCollection, type: BenchmarkType.Diagnostic },\n\t\t{ name: \"ten keys\", collection: tenKeyCollection, type: baseSuiteType },\n\t\t{ name: \"maximum keys\", collection: maxSizeCollection, type: BenchmarkType.Diagnostic },\n\t];\n}\n\nfunction runAttributionCollectionSuite(\n\tctor: IAttributionCollectionCtor,\n\tsuiteBaseType: BenchmarkType,\n): void {\n\tconst collectionTestCases = getCollectionSizes(ctor, suiteBaseType);\n\tfor (const { name, collection, type } of collectionTestCases) {\n\t\tdescribe(`using a collection with ${name}`, () => {\n\t\t\tconst { length } = collection;\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAtOffset at the start\",\n\t\t\t\tbenchmarkFn: () => collection.getAtOffset(0),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAtOffset at the end\",\n\t\t\t\tbenchmarkFn: () => collection.getAtOffset(length - 1),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAtOffset in the middle\",\n\t\t\t\tbenchmarkFn: () => collection.getAtOffset(length / 2),\n\t\t\t\ttype: BenchmarkType.Diagnostic,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAll\",\n\t\t\t\tbenchmarkFn: () => collection.getAll(),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"clone\",\n\t\t\t\tbenchmarkFn: () => collection.clone(),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"split + append in the middle\",\n\t\t\t\tbenchmarkFn: () => {\n\t\t\t\t\tconst split = collection.splitAt(length / 2);\n\t\t\t\t\tcollection.append(split);\n\t\t\t\t},\n\t\t\t\ttype,\n\t\t\t});\n\t\t});\n\t}\n\n\tbenchmark({\n\t\ttitle: \"construction\",\n\t\tbenchmarkFn: () => new ctor(42, { type: \"op\", seq: 5 }),\n\t\ttype: suiteBaseType,\n\t});\n\n\tconst segmentsToSerialize = collectionTestCases.map(({ collection }) => ({\n\t\tattribution: collection,\n\t\tcachedLength: collection.length,\n\t}));\n\n\tbenchmark({\n\t\ttitle: \"serializing\",\n\t\tbenchmarkFn: () => ctor.serializeAttributionCollections(segmentsToSerialize),\n\t\ttype: suiteBaseType,\n\t});\n\n\tconst summary = ctor.serializeAttributionCollections(segmentsToSerialize);\n\tconst segments: ISegment[] = Array.from({ length: 9 }, () => ({\n\t\tcachedLength: Math.floor(summary.length / 10),\n\t})) as ISegment[];\n\tsegments.push({ cachedLength: summary.length - 9 * Math.floor(summary.length / 10) } as any);\n\tbenchmark({\n\t\ttitle: \"deserialize into 10 segments\",\n\t\tbenchmarkFn: () => {\n\t\t\tctor.populateAttributionCollections(segments, summary);\n\t\t},\n\t\ttype: suiteBaseType,\n\t});\n}\n\n// Note: channel functionality is left unimplemented.\nclass TreeAttributionCollection implements IAttributionCollection<AttributionKey> {\n\tprivate readonly entries: RedBlackTree<number, AttributionKey | null> = new RedBlackTree(\n\t\tcompareNumbers,\n\t);\n\n\tpublic constructor(\n\t\tprivate _length: number,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tbaseEntry?: AttributionKey | null,\n\t) {\n\t\tif (baseEntry !== undefined) {\n\t\t\tthis.entries.put(0, baseEntry);\n\t\t}\n\t}\n\n\tpublic get channelNames() {\n\t\treturn [];\n\t}\n\n\tpublic getAtOffset(offset: number): AttributionKey | undefined {\n\t\tassert(offset >= 0 && offset < this._length, \"Requested offset should be valid\");\n\t\tconst node = this.entries.floor(offset);\n\t\tassert(node !== undefined, \"Collection should have at least one entry\");\n\t\treturn node.data ?? undefined;\n\t}\n\n\tpublic get length(): number {\n\t\treturn this._length;\n\t}\n\n\t/**\n\t * Splits this attribution collection into two with entries for [0, pos) and [pos, length).\n\t */\n\tpublic splitAt(pos: number): TreeAttributionCollection {\n\t\tconst splitBaseEntry = this.getAtOffset(pos);\n\t\tconst splitCollection = new TreeAttributionCollection(this.length - pos, splitBaseEntry);\n\t\tfor (\n\t\t\tlet current = this.entries.ceil(pos);\n\t\t\tcurrent !== undefined;\n\t\t\tcurrent = this.entries.ceil(pos)\n\t\t) {\n\t\t\t// If there happened to be an attribution change at exactly pos, it's already set in the base entry\n\t\t\tif (current.key !== pos) {\n\t\t\t\tsplitCollection.entries.put(current.key - pos, current.data);\n\t\t\t}\n\t\t\tthis.entries.remove(current.key);\n\t\t}\n\t\tthis._length = pos;\n\t\treturn splitCollection;\n\t}\n\n\tpublic append(other: TreeAttributionCollection): void {\n\t\tconst lastEntry = this.getAtOffset(this.length - 1);\n\t\tother.entries.map(({ key, data }) => {\n\t\t\tif (key !== 0 || !areEqualAttributionKeys(lastEntry, data)) {\n\t\t\t\tthis.entries.put(key + this.length, data);\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\tthis._length += other.length;\n\t}\n\n\tpublic getAll(): IAttributionCollectionSpec<AttributionKey> {\n\t\tconst results: { offset: number; key: AttributionKey | null }[] = [];\n\t\tthis.entries.map(({ key, data }) => {\n\t\t\tresults.push({ offset: key, key: data });\n\t\t\treturn true;\n\t\t});\n\t\treturn { root: results, length: this.length };\n\t}\n\n\tpublic clone(): TreeAttributionCollection {\n\t\tconst copy = new TreeAttributionCollection(this.length, this.getAtOffset(0));\n\t\tthis.entries.map(({ key, data }) => {\n\t\t\tcopy.entries.put(key, data);\n\t\t\treturn true;\n\t\t});\n\t\treturn copy;\n\t}\n\n\t/**\n\t * Rehydrates attribution information from its serialized form into the provided iterable of consecutive segments.\n\t */\n\tpublic static populateAttributionCollections(\n\t\tsegments: Iterable<ISegment>,\n\t\tsummary: SerializedAttributionCollection,\n\t): void {\n\t\tconst { seqs, posBreakpoints } = summary;\n\t\tassert(\n\t\t\tseqs.length === posBreakpoints.length && seqs.length > 0,\n\t\t\t\"Invalid attribution summary blob provided\",\n\t\t);\n\t\tlet curIndex = 0;\n\t\tlet cumulativeSegPos = 0;\n\t\tlet currentInfo = seqs[curIndex];\n\t\tconst getCurrentKey = () =>\n\t\t\ttypeof currentInfo === \"object\"\n\t\t\t\t? currentInfo\n\t\t\t\t: ({ type: \"op\", seq: currentInfo } as const);\n\n\t\tfor (const segment of segments) {\n\t\t\tconst attribution = new TreeAttributionCollection(\n\t\t\t\tsegment.cachedLength,\n\t\t\t\tgetCurrentKey(),\n\t\t\t);\n\t\t\twhile (posBreakpoints[curIndex] < cumulativeSegPos + segment.cachedLength) {\n\t\t\t\tcurrentInfo = seqs[curIndex];\n\t\t\t\tattribution.entries.put(\n\t\t\t\t\tposBreakpoints[curIndex] - cumulativeSegPos,\n\t\t\t\t\tgetCurrentKey(),\n\t\t\t\t);\n\t\t\t\tcurIndex++;\n\t\t\t}\n\n\t\t\tsegment.attribution = attribution;\n\t\t\tcumulativeSegPos += segment.cachedLength;\n\t\t}\n\t}\n\n\tpublic update(): void {\n\t\tthrow new Error(\"unimplemented\");\n\t}\n\n\t/**\n\t * Condenses attribution information on consecutive segments into a `SerializedAttributionCollection`\n\t */\n\tpublic static serializeAttributionCollections(\n\t\tsegments: Iterable<{\n\t\t\tattribution?: IAttributionCollection<AttributionKey>;\n\t\t\tcachedLength: number;\n\t\t}>,\n\t): SerializedAttributionCollection {\n\t\tconst posBreakpoints: number[] = [];\n\t\tconst seqs: (number | AttributionKey | null)[] = [];\n\t\tlet mostRecentAttributionKey: AttributionKey | null | undefined;\n\t\tlet cumulativePos = 0;\n\n\t\tlet segmentsWithAttribution = 0;\n\t\tlet segmentsWithoutAttribution = 0;\n\t\tfor (const segment of segments) {\n\t\t\tif (segment.attribution) {\n\t\t\t\tsegmentsWithAttribution++;\n\t\t\t\tfor (const { offset, key: info } of segment.attribution?.getAll()?.root ?? []) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tmostRecentAttributionKey === undefined ||\n\t\t\t\t\t\t!areEqualAttributionKeys(info, mostRecentAttributionKey)\n\t\t\t\t\t) {\n\t\t\t\t\t\tposBreakpoints.push(offset + cumulativePos);\n\t\t\t\t\t\tseqs.push(!info ? null : info.type === \"op\" ? info.seq : info);\n\t\t\t\t\t}\n\t\t\t\t\tmostRecentAttributionKey = info;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsegmentsWithoutAttribution++;\n\t\t\t}\n\n\t\t\tcumulativePos += segment.cachedLength;\n\t\t}\n\n\t\tassert(\n\t\t\tsegmentsWithAttribution === 0 || segmentsWithoutAttribution === 0,\n\t\t\t\"Expected either all segments or no segments to have attribution information.\",\n\t\t);\n\n\t\tconst blobContents: SerializedAttributionCollection = {\n\t\t\tseqs,\n\t\t\tposBreakpoints,\n\t\t\tlength: cumulativePos,\n\t\t};\n\t\treturn blobContents;\n\t}\n}\n\ndescribe(\"IAttributionCollection perf\", () => {\n\tdescribe(\"tree implementation\", () => {\n\t\trunAttributionCollectionSuite(TreeAttributionCollection, BenchmarkType.Diagnostic);\n\t});\n\n\tdescribe(\"list-based implementation\", () => {\n\t\trunAttributionCollectionSuite(NewAttributionCollection, BenchmarkType.Measurement);\n\t});\n});\n"]}
|
|
1
|
+
{"version":3,"file":"attributionCollection.perf.spec.js","sourceRoot":"","sources":["../../src/test/attributionCollection.perf.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,mCAA0C;AAC1C,sDAAkE;AAElE,0EAMqC;AACrC,sDAA2D;AAC3D,4DAAgE;AAChE,sDAAuD;AAkBvD,SAAS,kBAAkB,CAC1B,IAAgC,EAChC,aAA4B;IAM5B,MAAM,mBAAmB,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IACjE,MAAM,gBAAgB,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAC7D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;QAC5B,gBAAgB,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;KACjE;IACD,MAAM,iBAAiB,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAC9D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,uCAAsB,EAAE,CAAC,EAAE,EAAE;QAChD,iBAAiB,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;KAC9D;IACD,OAAO;QACN,EAAE,IAAI,EAA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D;wBACD,cAAc,CAAC,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,CAAC;wBAC5C,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;qBAC/D;oBACD,wBAAwB,GAAG,IAAI,CAAC;iBAChC;aACD;iBAAM;gBACN,0BAA0B,EAAE,CAAC;aAC7B;YAED,aAAa,IAAI,OAAO,CAAC,YAAY,CAAC;SACtC;QAED,IAAA,eAAM,EACL,uBAAuB,KAAK,CAAC,IAAI,0BAA0B,KAAK,CAAC,EACjE,8EAA8E,CAC9E,CAAC;QAEF,MAAM,YAAY,GAAoC;YACrD,IAAI;YACJ,cAAc;YACd,MAAM,EAAE,aAAa;SACrB,CAAC;QACF,OAAO,YAAY,CAAC;IACrB,CAAC;CACD;AAED,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC5C,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACpC,6BAA6B,CAAC,yBAAyB,EAAE,yBAAa,CAAC,UAAU,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;QAC1C,6BAA6B,CAAC,gDAAwB,EAAE,yBAAa,CAAC,WAAW,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"assert\";\nimport { benchmark, BenchmarkType } from \"@fluid-tools/benchmark\";\nimport { AttributionKey } from \"@fluidframework/runtime-definitions\";\nimport {\n\tareEqualAttributionKeys,\n\tAttributionCollection as NewAttributionCollection,\n\tIAttributionCollection,\n\tIAttributionCollectionSpec,\n\tSerializedAttributionCollection,\n} from \"../attributionCollection.js\";\nimport { TextSegmentGranularity } from \"../textSegment.js\";\nimport { compareNumbers, ISegment } from \"../mergeTreeNodes.js\";\nimport { RedBlackTree } from \"../collections/index.js\";\n\ninterface IAttributionCollectionCtor {\n\tnew (length: number, key?: AttributionKey): IAttributionCollection<AttributionKey>;\n\n\tserializeAttributionCollections(\n\t\tsegments: Iterable<{\n\t\t\tattribution?: IAttributionCollection<AttributionKey>;\n\t\t\tcachedLength: number;\n\t\t}>,\n\t): SerializedAttributionCollection;\n\n\tpopulateAttributionCollections(\n\t\tsegments: Iterable<ISegment>,\n\t\tsummary: SerializedAttributionCollection,\n\t): void;\n}\n\nfunction getCollectionSizes(\n\tctor: IAttributionCollectionCtor,\n\tbaseSuiteType: BenchmarkType,\n): {\n\tname: string;\n\tcollection: IAttributionCollection<AttributionKey>;\n\ttype: BenchmarkType;\n}[] {\n\tconst singleKeyCollection = new ctor(5, { type: \"op\", seq: 42 });\n\tconst tenKeyCollection = new ctor(2, { type: \"op\", seq: 0 });\n\tfor (let i = 1; i < 10; i++) {\n\t\ttenKeyCollection.append(new ctor(3 * i, { type: \"op\", seq: i }));\n\t}\n\tconst maxSizeCollection = new ctor(1, { type: \"op\", seq: 0 });\n\tfor (let i = 1; i < TextSegmentGranularity; i++) {\n\t\tmaxSizeCollection.append(new ctor(1, { type: \"op\", seq: i }));\n\t}\n\treturn [\n\t\t{ name: \"one key\", collection: singleKeyCollection, type: BenchmarkType.Diagnostic },\n\t\t{ name: \"ten keys\", collection: tenKeyCollection, type: baseSuiteType },\n\t\t{ name: \"maximum keys\", collection: maxSizeCollection, type: BenchmarkType.Diagnostic },\n\t];\n}\n\nfunction runAttributionCollectionSuite(\n\tctor: IAttributionCollectionCtor,\n\tsuiteBaseType: BenchmarkType,\n): void {\n\tconst collectionTestCases = getCollectionSizes(ctor, suiteBaseType);\n\tfor (const { name, collection, type } of collectionTestCases) {\n\t\tdescribe(`using a collection with ${name}`, () => {\n\t\t\tconst { length } = collection;\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAtOffset at the start\",\n\t\t\t\tbenchmarkFn: () => collection.getAtOffset(0),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAtOffset at the end\",\n\t\t\t\tbenchmarkFn: () => collection.getAtOffset(length - 1),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAtOffset in the middle\",\n\t\t\t\tbenchmarkFn: () => collection.getAtOffset(length / 2),\n\t\t\t\ttype: BenchmarkType.Diagnostic,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"getAll\",\n\t\t\t\tbenchmarkFn: () => collection.getAll(),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"clone\",\n\t\t\t\tbenchmarkFn: () => collection.clone(),\n\t\t\t\ttype,\n\t\t\t});\n\n\t\t\tbenchmark({\n\t\t\t\ttitle: \"split + append in the middle\",\n\t\t\t\tbenchmarkFn: () => {\n\t\t\t\t\tconst split = collection.splitAt(length / 2);\n\t\t\t\t\tcollection.append(split);\n\t\t\t\t},\n\t\t\t\ttype,\n\t\t\t});\n\t\t});\n\t}\n\n\tbenchmark({\n\t\ttitle: \"construction\",\n\t\tbenchmarkFn: () => new ctor(42, { type: \"op\", seq: 5 }),\n\t\ttype: suiteBaseType,\n\t});\n\n\tconst segmentsToSerialize = collectionTestCases.map(({ collection }) => ({\n\t\tattribution: collection,\n\t\tcachedLength: collection.length,\n\t}));\n\n\tbenchmark({\n\t\ttitle: \"serializing\",\n\t\tbenchmarkFn: () => ctor.serializeAttributionCollections(segmentsToSerialize),\n\t\ttype: suiteBaseType,\n\t});\n\n\tconst summary = ctor.serializeAttributionCollections(segmentsToSerialize);\n\tconst segments: ISegment[] = Array.from({ length: 9 }, () => ({\n\t\tcachedLength: Math.floor(summary.length / 10),\n\t})) as ISegment[];\n\tsegments.push({ cachedLength: summary.length - 9 * Math.floor(summary.length / 10) } as any);\n\tbenchmark({\n\t\ttitle: \"deserialize into 10 segments\",\n\t\tbenchmarkFn: () => {\n\t\t\tctor.populateAttributionCollections(segments, summary);\n\t\t},\n\t\ttype: suiteBaseType,\n\t});\n}\n\n// Note: channel functionality is left unimplemented.\nclass TreeAttributionCollection implements IAttributionCollection<AttributionKey> {\n\tprivate readonly entries: RedBlackTree<number, AttributionKey | null> = new RedBlackTree(\n\t\tcompareNumbers,\n\t);\n\n\tpublic constructor(\n\t\tprivate _length: number,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tbaseEntry?: AttributionKey | null,\n\t) {\n\t\tif (baseEntry !== undefined) {\n\t\t\tthis.entries.put(0, baseEntry);\n\t\t}\n\t}\n\n\tpublic get channelNames() {\n\t\treturn [];\n\t}\n\n\tpublic getAtOffset(offset: number): AttributionKey | undefined {\n\t\tassert(offset >= 0 && offset < this._length, \"Requested offset should be valid\");\n\t\tconst node = this.entries.floor(offset);\n\t\tassert(node !== undefined, \"Collection should have at least one entry\");\n\t\treturn node.data ?? undefined;\n\t}\n\n\tpublic get length(): number {\n\t\treturn this._length;\n\t}\n\n\t/**\n\t * Splits this attribution collection into two with entries for [0, pos) and [pos, length).\n\t */\n\tpublic splitAt(pos: number): TreeAttributionCollection {\n\t\tconst splitBaseEntry = this.getAtOffset(pos);\n\t\tconst splitCollection = new TreeAttributionCollection(this.length - pos, splitBaseEntry);\n\t\tfor (\n\t\t\tlet current = this.entries.ceil(pos);\n\t\t\tcurrent !== undefined;\n\t\t\tcurrent = this.entries.ceil(pos)\n\t\t) {\n\t\t\t// If there happened to be an attribution change at exactly pos, it's already set in the base entry\n\t\t\tif (current.key !== pos) {\n\t\t\t\tsplitCollection.entries.put(current.key - pos, current.data);\n\t\t\t}\n\t\t\tthis.entries.remove(current.key);\n\t\t}\n\t\tthis._length = pos;\n\t\treturn splitCollection;\n\t}\n\n\tpublic append(other: TreeAttributionCollection): void {\n\t\tconst lastEntry = this.getAtOffset(this.length - 1);\n\t\tother.entries.map(({ key, data }) => {\n\t\t\tif (key !== 0 || !areEqualAttributionKeys(lastEntry, data)) {\n\t\t\t\tthis.entries.put(key + this.length, data);\n\t\t\t}\n\t\t\treturn true;\n\t\t});\n\t\tthis._length += other.length;\n\t}\n\n\tpublic getAll(): IAttributionCollectionSpec<AttributionKey> {\n\t\tconst results: { offset: number; key: AttributionKey | null }[] = [];\n\t\tthis.entries.map(({ key, data }) => {\n\t\t\tresults.push({ offset: key, key: data });\n\t\t\treturn true;\n\t\t});\n\t\treturn { root: results, length: this.length };\n\t}\n\n\tpublic clone(): TreeAttributionCollection {\n\t\tconst copy = new TreeAttributionCollection(this.length, this.getAtOffset(0));\n\t\tthis.entries.map(({ key, data }) => {\n\t\t\tcopy.entries.put(key, data);\n\t\t\treturn true;\n\t\t});\n\t\treturn copy;\n\t}\n\n\t/**\n\t * Rehydrates attribution information from its serialized form into the provided iterable of consecutive segments.\n\t */\n\tpublic static populateAttributionCollections(\n\t\tsegments: Iterable<ISegment>,\n\t\tsummary: SerializedAttributionCollection,\n\t): void {\n\t\tconst { seqs, posBreakpoints } = summary;\n\t\tassert(\n\t\t\tseqs.length === posBreakpoints.length && seqs.length > 0,\n\t\t\t\"Invalid attribution summary blob provided\",\n\t\t);\n\t\tlet curIndex = 0;\n\t\tlet cumulativeSegPos = 0;\n\t\tlet currentInfo = seqs[curIndex];\n\t\tconst getCurrentKey = () =>\n\t\t\ttypeof currentInfo === \"object\"\n\t\t\t\t? currentInfo\n\t\t\t\t: ({ type: \"op\", seq: currentInfo } as const);\n\n\t\tfor (const segment of segments) {\n\t\t\tconst attribution = new TreeAttributionCollection(\n\t\t\t\tsegment.cachedLength,\n\t\t\t\tgetCurrentKey(),\n\t\t\t);\n\t\t\twhile (posBreakpoints[curIndex] < cumulativeSegPos + segment.cachedLength) {\n\t\t\t\tcurrentInfo = seqs[curIndex];\n\t\t\t\tattribution.entries.put(\n\t\t\t\t\tposBreakpoints[curIndex] - cumulativeSegPos,\n\t\t\t\t\tgetCurrentKey(),\n\t\t\t\t);\n\t\t\t\tcurIndex++;\n\t\t\t}\n\n\t\t\tsegment.attribution = attribution;\n\t\t\tcumulativeSegPos += segment.cachedLength;\n\t\t}\n\t}\n\n\tpublic update(): void {\n\t\tthrow new Error(\"unimplemented\");\n\t}\n\n\t/**\n\t * Condenses attribution information on consecutive segments into a `SerializedAttributionCollection`\n\t */\n\tpublic static serializeAttributionCollections(\n\t\tsegments: Iterable<{\n\t\t\tattribution?: IAttributionCollection<AttributionKey>;\n\t\t\tcachedLength: number;\n\t\t}>,\n\t): SerializedAttributionCollection {\n\t\tconst posBreakpoints: number[] = [];\n\t\tconst seqs: (number | AttributionKey | null)[] = [];\n\t\tlet mostRecentAttributionKey: AttributionKey | null | undefined;\n\t\tlet cumulativePos = 0;\n\n\t\tlet segmentsWithAttribution = 0;\n\t\tlet segmentsWithoutAttribution = 0;\n\t\tfor (const segment of segments) {\n\t\t\tif (segment.attribution) {\n\t\t\t\tsegmentsWithAttribution++;\n\t\t\t\tfor (const { offset, key: info } of segment.attribution?.getAll()?.root ?? []) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tmostRecentAttributionKey === undefined ||\n\t\t\t\t\t\t!areEqualAttributionKeys(info, mostRecentAttributionKey)\n\t\t\t\t\t) {\n\t\t\t\t\t\tposBreakpoints.push(offset + cumulativePos);\n\t\t\t\t\t\tseqs.push(!info ? null : info.type === \"op\" ? info.seq : info);\n\t\t\t\t\t}\n\t\t\t\t\tmostRecentAttributionKey = info;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsegmentsWithoutAttribution++;\n\t\t\t}\n\n\t\t\tcumulativePos += segment.cachedLength;\n\t\t}\n\n\t\tassert(\n\t\t\tsegmentsWithAttribution === 0 || segmentsWithoutAttribution === 0,\n\t\t\t\"Expected either all segments or no segments to have attribution information.\",\n\t\t);\n\n\t\tconst blobContents: SerializedAttributionCollection = {\n\t\t\tseqs,\n\t\t\tposBreakpoints,\n\t\t\tlength: cumulativePos,\n\t\t};\n\t\treturn blobContents;\n\t}\n}\n\ndescribe(\"IAttributionCollection perf\", () => {\n\tdescribe(\"tree implementation\", () => {\n\t\trunAttributionCollectionSuite(TreeAttributionCollection, BenchmarkType.Diagnostic);\n\t});\n\n\tdescribe(\"list-based implementation\", () => {\n\t\trunAttributionCollectionSuite(NewAttributionCollection, BenchmarkType.Measurement);\n\t});\n});\n"]}
|
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const assert_1 = require("assert");
|
|
8
8
|
const stochastic_test_utils_1 = require("@fluid-private/stochastic-test-utils");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const attributionCollection_js_1 = require("../attributionCollection.js");
|
|
10
|
+
const mergeTreeNodes_js_1 = require("../mergeTreeNodes.js");
|
|
11
11
|
const opKey = (seq) => ({ type: "op", seq });
|
|
12
12
|
const detachedKey = { type: "detached", id: 0 };
|
|
13
13
|
describe("AttributionCollection", () => {
|
|
14
14
|
const makeCollectionWithChannel = ({ length, seq }) => {
|
|
15
|
-
const collection = new
|
|
16
|
-
collection.update("foo", new
|
|
15
|
+
const collection = new attributionCollection_js_1.AttributionCollection(length, null);
|
|
16
|
+
collection.update("foo", new attributionCollection_js_1.AttributionCollection(length, opKey(seq)));
|
|
17
17
|
return collection;
|
|
18
18
|
};
|
|
19
19
|
describe(".getAtOffset", () => {
|
|
20
20
|
describe("on a collection with a single entry", () => {
|
|
21
|
-
const collection = new
|
|
21
|
+
const collection = new attributionCollection_js_1.AttributionCollection(5, opKey(100));
|
|
22
22
|
it("returns the entry for offsets within the length range", () => {
|
|
23
23
|
for (let i = 0; i < 5; i++) {
|
|
24
24
|
assert_1.strict.deepEqual(collection.getAtOffset(i), opKey(100));
|
|
@@ -30,8 +30,8 @@ describe("AttributionCollection", () => {
|
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
32
|
describe("on a collection with multiple entries", () => {
|
|
33
|
-
const collection = new
|
|
34
|
-
collection.append(new
|
|
33
|
+
const collection = new attributionCollection_js_1.AttributionCollection(3, opKey(100));
|
|
34
|
+
collection.append(new attributionCollection_js_1.AttributionCollection(5, opKey(101)));
|
|
35
35
|
it("returns the correct entries", () => {
|
|
36
36
|
for (let i = 0; i < 3; i++) {
|
|
37
37
|
assert_1.strict.deepEqual(collection.getAtOffset(i), opKey(100));
|
|
@@ -52,9 +52,9 @@ describe("AttributionCollection", () => {
|
|
|
52
52
|
describe("on a collection with 3 entries", () => {
|
|
53
53
|
let collection;
|
|
54
54
|
beforeEach(() => {
|
|
55
|
-
collection = new
|
|
56
|
-
collection.append(new
|
|
57
|
-
collection.append(new
|
|
55
|
+
collection = new attributionCollection_js_1.AttributionCollection(3, opKey(100));
|
|
56
|
+
collection.append(new attributionCollection_js_1.AttributionCollection(2, opKey(101)));
|
|
57
|
+
collection.append(new attributionCollection_js_1.AttributionCollection(1, opKey(102)));
|
|
58
58
|
});
|
|
59
59
|
it("can split on non-breakpoints", () => {
|
|
60
60
|
const splitCollection = collection.splitAt(4);
|
|
@@ -81,7 +81,7 @@ describe("AttributionCollection", () => {
|
|
|
81
81
|
});
|
|
82
82
|
});
|
|
83
83
|
it("can split collection with a single value", () => {
|
|
84
|
-
const collection = new
|
|
84
|
+
const collection = new attributionCollection_js_1.AttributionCollection(5, opKey(100));
|
|
85
85
|
const splitCollection = collection.splitAt(3);
|
|
86
86
|
assert_1.strict.equal(collection.length, 3);
|
|
87
87
|
assert_1.strict.equal(splitCollection.length, 2);
|
|
@@ -89,8 +89,8 @@ describe("AttributionCollection", () => {
|
|
|
89
89
|
assert_1.strict.deepEqual(splitCollection.getAll().root, [{ offset: 0, key: opKey(100) }]);
|
|
90
90
|
});
|
|
91
91
|
it("splits channels", () => {
|
|
92
|
-
const collection = new
|
|
93
|
-
collection.update("foo", new
|
|
92
|
+
const collection = new attributionCollection_js_1.AttributionCollection(5, null);
|
|
93
|
+
collection.update("foo", new attributionCollection_js_1.AttributionCollection(5, opKey(100)));
|
|
94
94
|
const splitCollection = collection.splitAt(2);
|
|
95
95
|
assert_1.strict.deepEqual(collection.getAll().channels, {
|
|
96
96
|
foo: [{ offset: 0, key: opKey(100) }],
|
|
@@ -102,24 +102,24 @@ describe("AttributionCollection", () => {
|
|
|
102
102
|
});
|
|
103
103
|
describe(".append", () => {
|
|
104
104
|
it("modifies the receiving collection", () => {
|
|
105
|
-
const collection = new
|
|
105
|
+
const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
|
|
106
106
|
assert_1.strict.deepEqual(collection.getAll().root, [{ offset: 0, key: opKey(100) }]);
|
|
107
|
-
collection.append(new
|
|
107
|
+
collection.append(new attributionCollection_js_1.AttributionCollection(1, opKey(101)));
|
|
108
108
|
assert_1.strict.deepEqual(collection.getAll().root, [
|
|
109
109
|
{ offset: 0, key: opKey(100) },
|
|
110
110
|
{ offset: 2, key: opKey(101) },
|
|
111
111
|
]);
|
|
112
112
|
});
|
|
113
113
|
it("does not modify the argument collection", () => {
|
|
114
|
-
const collection = new
|
|
115
|
-
const appendedCollection = new
|
|
114
|
+
const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
|
|
115
|
+
const appendedCollection = new attributionCollection_js_1.AttributionCollection(1, opKey(101));
|
|
116
116
|
assert_1.strict.deepEqual(appendedCollection.getAll().root, [{ offset: 0, key: opKey(101) }]);
|
|
117
117
|
collection.append(appendedCollection);
|
|
118
118
|
assert_1.strict.deepEqual(appendedCollection.getAll().root, [{ offset: 0, key: opKey(101) }]);
|
|
119
119
|
});
|
|
120
120
|
it("coalesces referentially equal values at the join point", () => {
|
|
121
|
-
const collection = new
|
|
122
|
-
collection.append(new
|
|
121
|
+
const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
|
|
122
|
+
collection.append(new attributionCollection_js_1.AttributionCollection(7, opKey(100)));
|
|
123
123
|
assert_1.strict.deepEqual(collection.getAll().root, [{ offset: 0, key: opKey(100) }]);
|
|
124
124
|
assert_1.strict.equal(collection.length, 9);
|
|
125
125
|
});
|
|
@@ -145,7 +145,7 @@ describe("AttributionCollection", () => {
|
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
147
|
it("when only appended collection has a channel", () => {
|
|
148
|
-
const appender = new
|
|
148
|
+
const appender = new attributionCollection_js_1.AttributionCollection(2, null);
|
|
149
149
|
appender.append(makeCollectionWithChannel({ length: 5, seq: 200 }));
|
|
150
150
|
assert_1.strict.deepEqual(appender.getAll(), {
|
|
151
151
|
length: 7,
|
|
@@ -166,7 +166,7 @@ describe("AttributionCollection", () => {
|
|
|
166
166
|
});
|
|
167
167
|
it("when only segment being appended to has a channel", () => {
|
|
168
168
|
const appender = makeCollectionWithChannel({ length: 2, seq: 100 });
|
|
169
|
-
appender.append(new
|
|
169
|
+
appender.append(new attributionCollection_js_1.AttributionCollection(5, null));
|
|
170
170
|
assert_1.strict.deepEqual(appender.getAll(), {
|
|
171
171
|
length: 7,
|
|
172
172
|
root: [{ offset: 0, key: null }],
|
|
@@ -188,20 +188,20 @@ describe("AttributionCollection", () => {
|
|
|
188
188
|
});
|
|
189
189
|
describe(".channelNames", () => {
|
|
190
190
|
it("is empty when collection has no channels", () => {
|
|
191
|
-
const collection = new
|
|
191
|
+
const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
|
|
192
192
|
assert_1.strict.deepEqual(collection.channelNames, []);
|
|
193
193
|
});
|
|
194
194
|
it("returns all channels with content for collection with channels", () => {
|
|
195
|
-
const collection = new
|
|
196
|
-
collection.update("foo", new
|
|
197
|
-
collection.update("bar", new
|
|
195
|
+
const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
|
|
196
|
+
collection.update("foo", new attributionCollection_js_1.AttributionCollection(2));
|
|
197
|
+
collection.update("bar", new attributionCollection_js_1.AttributionCollection(2));
|
|
198
198
|
assert_1.strict.deepEqual(collection.channelNames, ["foo", "bar"]);
|
|
199
199
|
});
|
|
200
200
|
});
|
|
201
201
|
describe(".populateAttributionCollections", () => {
|
|
202
202
|
it("correctly splits segment boundaries on breakpoints", () => {
|
|
203
203
|
const segments = [{ cachedLength: 5 }, { cachedLength: 4 }];
|
|
204
|
-
|
|
204
|
+
attributionCollection_js_1.AttributionCollection.populateAttributionCollections(segments, {
|
|
205
205
|
length: 9,
|
|
206
206
|
posBreakpoints: [0, 2, 5, 7],
|
|
207
207
|
seqs: [10, 12, 15, 17],
|
|
@@ -220,7 +220,7 @@ describe("AttributionCollection", () => {
|
|
|
220
220
|
});
|
|
221
221
|
it("correctly splits segment boundaries between breakpoints", () => {
|
|
222
222
|
const segments = [{ cachedLength: 4 }, { cachedLength: 5 }];
|
|
223
|
-
|
|
223
|
+
attributionCollection_js_1.AttributionCollection.populateAttributionCollections(segments, {
|
|
224
224
|
length: 9,
|
|
225
225
|
posBreakpoints: [0, 2, 5, 7],
|
|
226
226
|
seqs: [10, 12, 15, 17],
|
|
@@ -243,15 +243,15 @@ describe("AttributionCollection", () => {
|
|
|
243
243
|
it("combines equal values on endpoints", () => {
|
|
244
244
|
const segments = [
|
|
245
245
|
{
|
|
246
|
-
attribution: new
|
|
246
|
+
attribution: new attributionCollection_js_1.AttributionCollection(4, opKey(0)),
|
|
247
247
|
cachedLength: 4,
|
|
248
248
|
},
|
|
249
249
|
{
|
|
250
|
-
attribution: new
|
|
250
|
+
attribution: new attributionCollection_js_1.AttributionCollection(5, opKey(0)),
|
|
251
251
|
cachedLength: 5,
|
|
252
252
|
},
|
|
253
253
|
];
|
|
254
|
-
const blob =
|
|
254
|
+
const blob = attributionCollection_js_1.AttributionCollection.serializeAttributionCollections(segments);
|
|
255
255
|
assert_1.strict.deepEqual(blob, {
|
|
256
256
|
posBreakpoints: [0],
|
|
257
257
|
seqs: [0],
|
|
@@ -326,15 +326,15 @@ describe("AttributionCollection", () => {
|
|
|
326
326
|
];
|
|
327
327
|
for (const { name, blob, segments } of testCases) {
|
|
328
328
|
it(name, () => {
|
|
329
|
-
|
|
330
|
-
assert_1.strict.deepEqual(
|
|
329
|
+
attributionCollection_js_1.AttributionCollection.populateAttributionCollections(segments, blob);
|
|
330
|
+
assert_1.strict.deepEqual(attributionCollection_js_1.AttributionCollection.serializeAttributionCollections(segments), blob);
|
|
331
331
|
});
|
|
332
332
|
}
|
|
333
333
|
});
|
|
334
334
|
describe(".clone", () => {
|
|
335
335
|
it("copies the original collection", () => {
|
|
336
|
-
const collection = new
|
|
337
|
-
const appendedCollection = new
|
|
336
|
+
const collection = new attributionCollection_js_1.AttributionCollection(2, opKey(100));
|
|
337
|
+
const appendedCollection = new attributionCollection_js_1.AttributionCollection(1, opKey(101));
|
|
338
338
|
const copy = collection.clone();
|
|
339
339
|
collection.append(appendedCollection);
|
|
340
340
|
assert_1.strict.deepEqual(collection.getAll().root, [
|
|
@@ -358,32 +358,32 @@ describe("AttributionCollection", () => {
|
|
|
358
358
|
describe(".update", () => {
|
|
359
359
|
let collection;
|
|
360
360
|
beforeEach(() => {
|
|
361
|
-
collection = new
|
|
362
|
-
collection.update("bar", new
|
|
361
|
+
collection = new attributionCollection_js_1.AttributionCollection(2, null);
|
|
362
|
+
collection.update("bar", new attributionCollection_js_1.AttributionCollection(2, opKey(10)));
|
|
363
363
|
assert_1.strict.deepEqual(collection.getAtOffset(0, "foo"), undefined, "channel should be undefined on creation");
|
|
364
364
|
});
|
|
365
365
|
afterEach(() => {
|
|
366
366
|
assert_1.strict.deepEqual(collection.getAtOffset(0, "bar"), opKey(10), "update should never modify unrelated channels");
|
|
367
367
|
});
|
|
368
368
|
it("creates a new channel when updating from an undefined state", () => {
|
|
369
|
-
collection.update("foo", new
|
|
369
|
+
collection.update("foo", new attributionCollection_js_1.AttributionCollection(2, opKey(5)));
|
|
370
370
|
assert_1.strict.deepEqual(collection.getAtOffset(0, "foo"), opKey(5));
|
|
371
371
|
});
|
|
372
372
|
it("overrides earlier calls with later ones", () => {
|
|
373
|
-
collection.update("foo", new
|
|
374
|
-
collection.update("foo", new
|
|
373
|
+
collection.update("foo", new attributionCollection_js_1.AttributionCollection(2, opKey(3)));
|
|
374
|
+
collection.update("foo", new attributionCollection_js_1.AttributionCollection(2, opKey(5)));
|
|
375
375
|
assert_1.strict.deepEqual(collection.getAtOffset(0, "foo"), opKey(5));
|
|
376
376
|
});
|
|
377
377
|
it("can update the root channel", () => {
|
|
378
|
-
collection.update(undefined, new
|
|
378
|
+
collection.update(undefined, new attributionCollection_js_1.AttributionCollection(2, opKey(3)));
|
|
379
379
|
assert_1.strict.deepEqual(collection.getAtOffset(0), opKey(3));
|
|
380
380
|
});
|
|
381
381
|
it("doesn't tolerate updates to channels having inconsistent length fields", () => {
|
|
382
|
-
assert_1.strict.throws(() => collection.update("foo", new
|
|
382
|
+
assert_1.strict.throws(() => collection.update("foo", new attributionCollection_js_1.AttributionCollection(3, null)));
|
|
383
383
|
});
|
|
384
384
|
});
|
|
385
385
|
describe("serialized structure is independent of segment lengths", () => {
|
|
386
|
-
class Segment extends
|
|
386
|
+
class Segment extends mergeTreeNodes_js_1.BaseSegment {
|
|
387
387
|
constructor(length) {
|
|
388
388
|
super();
|
|
389
389
|
this.type = "testSeg";
|
|
@@ -416,11 +416,11 @@ describe("AttributionCollection", () => {
|
|
|
416
416
|
const channelNamePool = ["ch1", "ch2", "ch3"];
|
|
417
417
|
const insertGenerator = (0, stochastic_test_utils_1.take)(segmentCount, ({ random }) => {
|
|
418
418
|
const length = random.integer(1, 20);
|
|
419
|
-
const collection = new
|
|
419
|
+
const collection = new attributionCollection_js_1.AttributionCollection(length, generateAttributionKey(random));
|
|
420
420
|
if (random.bool(0.25)) {
|
|
421
421
|
for (const channel of channelNamePool) {
|
|
422
422
|
if (random.bool()) {
|
|
423
|
-
collection.update(channel, new
|
|
423
|
+
collection.update(channel, new attributionCollection_js_1.AttributionCollection(length, generateAttributionKey(random)));
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
}
|
|
@@ -438,7 +438,7 @@ describe("AttributionCollection", () => {
|
|
|
438
438
|
return state;
|
|
439
439
|
},
|
|
440
440
|
}, { random: (0, stochastic_test_utils_1.makeRandom)(seed), segments: [] });
|
|
441
|
-
const expected =
|
|
441
|
+
const expected = attributionCollection_js_1.AttributionCollection.serializeAttributionCollections(initialState.segments);
|
|
442
442
|
const split = ({ segments, random }) => {
|
|
443
443
|
const validIndices = segments
|
|
444
444
|
.map((seg, i) => (seg.cachedLength > 1 ? i : -1))
|
|
@@ -478,7 +478,7 @@ describe("AttributionCollection", () => {
|
|
|
478
478
|
return state;
|
|
479
479
|
},
|
|
480
480
|
}, initialState);
|
|
481
|
-
assert_1.strict.deepEqual(
|
|
481
|
+
assert_1.strict.deepEqual(attributionCollection_js_1.AttributionCollection.serializeAttributionCollections(finalState.segments), expected);
|
|
482
482
|
});
|
|
483
483
|
}
|
|
484
484
|
});
|