@fluidframework/merge-tree 2.118.1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -4
- package/README.md +53 -50
- package/{api-extractor.json → api-extractor/api-extractor-model.json} +1 -1
- package/dist/MergeTreeTextHelper.js +1 -0
- package/dist/MergeTreeTextHelper.js.map +1 -1
- package/dist/attributionCollection.js +6 -4
- package/dist/attributionCollection.js.map +1 -1
- package/dist/attributionPolicy.js +3 -4
- package/dist/attributionPolicy.js.map +1 -1
- package/dist/client.js +27 -10
- package/dist/client.js.map +1 -1
- package/dist/collections/rbTree.d.ts.map +1 -1
- package/dist/collections/rbTree.js +3 -0
- package/dist/collections/rbTree.js.map +1 -1
- package/dist/endOfTreeSegment.d.ts.map +1 -1
- package/dist/endOfTreeSegment.js +25 -26
- package/dist/endOfTreeSegment.js.map +1 -1
- package/dist/localReference.js +17 -7
- package/dist/localReference.js.map +1 -1
- package/dist/mergeTree.d.ts.map +1 -1
- package/dist/mergeTree.js +90 -74
- package/dist/mergeTree.js.map +1 -1
- package/dist/mergeTreeNodeWalk.js +5 -5
- package/dist/mergeTreeNodeWalk.js.map +1 -1
- package/dist/mergeTreeNodes.d.ts.map +1 -1
- package/dist/mergeTreeNodes.js +117 -90
- package/dist/mergeTreeNodes.js.map +1 -1
- package/dist/mergeTreeTracking.js +4 -0
- package/dist/mergeTreeTracking.js.map +1 -1
- package/dist/opBuilder.js +9 -10
- package/dist/opBuilder.js.map +1 -1
- package/dist/ordinal.js +1 -2
- package/dist/ordinal.js.map +1 -1
- package/dist/partialLengths.js +109 -73
- package/dist/partialLengths.js.map +1 -1
- package/dist/perspective.js +31 -11
- package/dist/perspective.js.map +1 -1
- package/dist/properties.js +6 -7
- package/dist/properties.js.map +1 -1
- package/dist/referencePositions.d.ts.map +1 -1
- package/dist/referencePositions.js +7 -7
- package/dist/referencePositions.js.map +1 -1
- package/dist/revertibles.js +4 -5
- package/dist/revertibles.js.map +1 -1
- package/dist/segmentGroupCollection.js +2 -0
- package/dist/segmentGroupCollection.js.map +1 -1
- package/dist/segmentInfos.d.ts.map +1 -1
- package/dist/segmentInfos.js +5 -5
- package/dist/segmentInfos.js.map +1 -1
- package/dist/segmentPropertiesManager.js +3 -5
- package/dist/segmentPropertiesManager.js.map +1 -1
- package/dist/sequencePlace.js +3 -3
- package/dist/sequencePlace.js.map +1 -1
- package/dist/snapshotChunks.js +4 -5
- package/dist/snapshotChunks.js.map +1 -1
- package/dist/snapshotLoader.js +85 -70
- package/dist/snapshotLoader.js.map +1 -1
- package/dist/snapshotV1.d.ts.map +1 -1
- package/dist/snapshotV1.js +34 -14
- package/dist/snapshotV1.js.map +1 -1
- package/dist/snapshotlegacy.d.ts.map +1 -1
- package/dist/snapshotlegacy.js +18 -10
- package/dist/snapshotlegacy.js.map +1 -1
- package/dist/sortedSet.js +1 -3
- package/dist/sortedSet.js.map +1 -1
- package/dist/stamps.js +11 -12
- package/dist/stamps.js.map +1 -1
- package/dist/test/attributionCollection.spec.js +1 -1
- package/dist/test/attributionCollection.spec.js.map +1 -1
- package/dist/test/beastTest.spec.js +15 -11
- package/dist/test/beastTest.spec.js.map +1 -1
- package/dist/test/client.apis.spec.js +2 -3
- package/dist/test/client.apis.spec.js.map +1 -1
- package/dist/test/client.replay.spec.js +17 -7
- package/dist/test/client.replay.spec.js.map +1 -1
- package/dist/test/clientTestHelper.js +7 -4
- package/dist/test/clientTestHelper.js.map +1 -1
- package/dist/test/mergeTreeOperationRunner.js +26 -16
- package/dist/test/mergeTreeOperationRunner.js.map +1 -1
- package/dist/test/obliterateOperations.d.ts.map +1 -1
- package/dist/test/revertibles.spec.js +1 -2
- package/dist/test/revertibles.spec.js.map +1 -1
- package/dist/test/snapshot.utils.d.ts.map +1 -1
- package/dist/test/snapshot.utils.js +7 -5
- package/dist/test/snapshot.utils.js.map +1 -1
- package/dist/test/stamps.spec.js +17 -7
- package/dist/test/stamps.spec.js.map +1 -1
- package/dist/test/testClient.d.ts.map +1 -1
- package/dist/test/testClient.js +19 -17
- package/dist/test/testClient.js.map +1 -1
- package/dist/test/testClientLogger.d.ts.map +1 -1
- package/dist/test/testClientLogger.js +12 -8
- package/dist/test/testClientLogger.js.map +1 -1
- package/dist/test/testServer.js +7 -7
- package/dist/test/testServer.js.map +1 -1
- package/dist/test/testUtils.d.ts +0 -1
- package/dist/test/testUtils.d.ts.map +1 -1
- package/dist/test/testUtils.js +9 -10
- package/dist/test/testUtils.js.map +1 -1
- package/dist/test/text.js +2 -3
- package/dist/test/text.js.map +1 -1
- package/dist/test/wordUnitTests.spec.js +1 -2
- package/dist/test/wordUnitTests.spec.js.map +1 -1
- package/dist/textSegment.js +3 -2
- package/dist/textSegment.js.map +1 -1
- package/dist/zamboni.js +20 -10
- package/dist/zamboni.js.map +1 -1
- package/lib/MergeTreeTextHelper.js +1 -0
- package/lib/MergeTreeTextHelper.js.map +1 -1
- package/lib/attributionCollection.js +4 -2
- package/lib/attributionCollection.js.map +1 -1
- package/lib/client.js +10 -3
- package/lib/client.js.map +1 -1
- package/lib/collections/rbTree.d.ts.map +1 -1
- package/lib/collections/rbTree.js +3 -0
- package/lib/collections/rbTree.js.map +1 -1
- package/lib/endOfTreeSegment.d.ts.map +1 -1
- package/lib/endOfTreeSegment.js +25 -26
- package/lib/endOfTreeSegment.js.map +1 -1
- package/lib/legacy.d.ts +1 -1
- package/lib/localReference.js +12 -2
- package/lib/localReference.js.map +1 -1
- package/lib/mergeTree.d.ts.map +1 -1
- package/lib/mergeTree.js +68 -62
- package/lib/mergeTree.js.map +1 -1
- package/lib/mergeTreeNodes.d.ts.map +1 -1
- package/lib/mergeTreeNodes.js +111 -84
- package/lib/mergeTreeNodes.js.map +1 -1
- package/lib/mergeTreeTracking.js +4 -0
- package/lib/mergeTreeTracking.js.map +1 -1
- package/lib/partialLengths.js +89 -63
- package/lib/partialLengths.js.map +1 -1
- package/lib/perspective.js +12 -2
- package/lib/perspective.js.map +1 -1
- package/lib/public.d.ts +1 -1
- package/lib/referencePositions.d.ts.map +1 -1
- package/lib/segmentGroupCollection.js +2 -0
- package/lib/segmentGroupCollection.js.map +1 -1
- package/lib/segmentInfos.d.ts.map +1 -1
- package/lib/segmentPropertiesManager.js +1 -3
- package/lib/segmentPropertiesManager.js.map +1 -1
- package/lib/snapshotLoader.js +68 -63
- package/lib/snapshotLoader.js.map +1 -1
- package/lib/snapshotV1.d.ts.map +1 -1
- package/lib/snapshotV1.js +17 -7
- package/lib/snapshotV1.js.map +1 -1
- package/lib/snapshotlegacy.d.ts.map +1 -1
- package/lib/snapshotlegacy.js +18 -10
- package/lib/snapshotlegacy.js.map +1 -1
- package/lib/sortedSet.js +1 -3
- package/lib/sortedSet.js.map +1 -1
- package/lib/test/attributionCollection.spec.js +1 -1
- package/lib/test/attributionCollection.spec.js.map +1 -1
- package/lib/test/beastTest.spec.js +7 -3
- package/lib/test/beastTest.spec.js.map +1 -1
- package/lib/test/clientTestHelper.js +7 -4
- package/lib/test/clientTestHelper.js.map +1 -1
- package/lib/test/obliterateOperations.d.ts.map +1 -1
- package/lib/test/snapshot.utils.d.ts.map +1 -1
- package/lib/test/snapshot.utils.js +5 -3
- package/lib/test/snapshot.utils.js.map +1 -1
- package/lib/test/testClient.d.ts.map +1 -1
- package/lib/test/testClient.js +16 -14
- package/lib/test/testClient.js.map +1 -1
- package/lib/test/testClientLogger.d.ts.map +1 -1
- package/lib/test/testClientLogger.js +10 -6
- package/lib/test/testClientLogger.js.map +1 -1
- package/lib/test/testServer.js +5 -5
- package/lib/test/testServer.js.map +1 -1
- package/lib/test/testUtils.d.ts +0 -1
- package/lib/test/testUtils.d.ts.map +1 -1
- package/lib/textSegment.js +3 -2
- package/lib/textSegment.js.map +1 -1
- package/package.json +39 -58
- package/tsconfig.json +1 -1
- package/internal.d.ts +0 -11
- package/legacy.d.ts +0 -11
- /package/api-extractor/{api-extractor.current.json → api-extractor-report.current.json} +0 -0
- /package/api-extractor/{api-extractor.legacy.json → api-extractor-report.legacy.json} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeTreeTracking.js","sourceRoot":"","sources":["../src/mergeTreeTracking.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,+DAAyD;AAkBzD;;GAEG;AACH,MAAa,aAAa;
|
|
1
|
+
{"version":3,"file":"mergeTreeTracking.js","sourceRoot":"","sources":["../src/mergeTreeTracking.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,+DAAyD;AAkBzD;;GAEG;AACH,MAAa,aAAa;IACR,UAAU,CAA8B;IAEzD;QACC,IAAI,CAAC,UAAU,GAAG,IAAI,sCAAgB,EAAa,CAAC;IACrD,CAAC;IAED,IAAW,OAAO;QACjB,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;IAC9B,CAAC;IAED,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IAC7B,CAAC;IAEM,GAAG,CAAC,SAAoB;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAEM,IAAI,CAAC,SAAoB;QAC/B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YACvC,SAAS,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,CAAC;IACF,CAAC;IAEM,MAAM,CAAC,SAAoB;QACjC,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;YACvC,SAAS,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC1C,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AAjCD,sCAiCC;AAED;;GAEG;AACH,M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AAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;gBACjD,OAAO,KAAK,CAAC;YACd,CAAC;QACF,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AA/DD,0DA+DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { LocalReferencePosition } from \"./localReference.js\";\nimport type { ISegment } from \"./mergeTreeNodes.js\";\nimport { SortedSegmentSet } from \"./sortedSegmentSet.js\";\n\n/**\n * @legacy @beta\n */\nexport type Trackable = ISegment | LocalReferencePosition;\n\n/**\n * @legacy @beta\n */\nexport interface ITrackingGroup {\n\ttracked: readonly Trackable[];\n\tsize: number;\n\thas(trackable: Trackable): boolean;\n\tlink(trackable: Trackable): void;\n\tunlink(trackable: Trackable): boolean;\n}\n\n/**\n * @legacy @beta\n */\nexport class TrackingGroup implements ITrackingGroup {\n\tprivate readonly trackedSet: SortedSegmentSet<Trackable>;\n\n\tconstructor() {\n\t\tthis.trackedSet = new SortedSegmentSet<Trackable>();\n\t}\n\n\tpublic get tracked(): readonly Trackable[] {\n\t\treturn this.trackedSet.items;\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.trackedSet.size;\n\t}\n\n\tpublic has(trackable: Trackable): boolean {\n\t\treturn this.trackedSet.has(trackable);\n\t}\n\n\tpublic link(trackable: Trackable): void {\n\t\tif (!this.trackedSet.has(trackable)) {\n\t\t\tthis.trackedSet.addOrUpdate(trackable);\n\t\t\ttrackable.trackingCollection.link(this);\n\t\t}\n\t}\n\n\tpublic unlink(trackable: Trackable): boolean {\n\t\tif (this.trackedSet.remove(trackable)) {\n\t\t\ttrackable.trackingCollection.unlink(this);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n\n/**\n * Tracking group backed by an unordered set. Lookup, insertion, and deletion are O(1)\n */\nexport class UnorderedTrackingGroup implements ITrackingGroup {\n\tprivate readonly trackedSet: Set<Trackable>;\n\n\tconstructor() {\n\t\tthis.trackedSet = new Set<Trackable>();\n\t}\n\n\tpublic get tracked(): readonly Trackable[] {\n\t\treturn [...this.trackedSet];\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.trackedSet.size;\n\t}\n\n\tpublic has(trackable: Trackable): boolean {\n\t\treturn this.trackedSet.has(trackable);\n\t}\n\n\tpublic link(trackable: Trackable): void {\n\t\tif (!this.trackedSet.has(trackable)) {\n\t\t\tthis.trackedSet.add(trackable);\n\t\t\ttrackable.trackingCollection.link(this);\n\t\t}\n\t}\n\n\tpublic unlink(trackable: Trackable): boolean {\n\t\tif (this.trackedSet.delete(trackable)) {\n\t\t\ttrackable.trackingCollection.unlink(this);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n\n/**\n * A collection of {@link ITrackingGroup}.\n * @legacy @beta\n */\nexport class TrackingGroupCollection {\n\tprivate readonly _trackingGroups: Set<ITrackingGroup>;\n\n\tpublic get trackingGroups(): Set<TrackingGroup> {\n\t\t// Cast here is necessary to avoid a breaking change to\n\t\t// `TrackingGroupCollection`. Ideally we could just return\n\t\t// `Set<ITrackingGroup>`\n\t\treturn this._trackingGroups as Set<TrackingGroup>;\n\t}\n\n\tconstructor(private readonly trackable: Trackable) {\n\t\tthis._trackingGroups = new Set<ITrackingGroup>();\n\t}\n\n\tpublic link(trackingGroup: ITrackingGroup): void {\n\t\tif (trackingGroup) {\n\t\t\tif (!this._trackingGroups.has(trackingGroup)) {\n\t\t\t\tthis._trackingGroups.add(trackingGroup);\n\t\t\t}\n\n\t\t\tif (!trackingGroup.has(this.trackable)) {\n\t\t\t\ttrackingGroup.link(this.trackable);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic unlink(trackingGroup: ITrackingGroup): boolean {\n\t\tif (this._trackingGroups.has(trackingGroup)) {\n\t\t\tif (trackingGroup.has(this.trackable)) {\n\t\t\t\ttrackingGroup.unlink(this.trackable);\n\t\t\t}\n\t\t\tthis._trackingGroups.delete(trackingGroup);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic copyTo(trackable: Trackable): void {\n\t\tfor (const sg of this._trackingGroups) {\n\t\t\ttrackable.trackingCollection.link(sg);\n\t\t}\n\t}\n\n\tpublic get empty(): boolean {\n\t\treturn this._trackingGroups.size === 0;\n\t}\n\n\tpublic matches(trackingCollection: TrackingGroupCollection): boolean {\n\t\tif (\n\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- TODO: ADO#58520 Code owners should verify if this code change is safe and make it if so or update this comment otherwise\n\t\t\t!trackingCollection ||\n\t\t\tthis._trackingGroups.size !== trackingCollection._trackingGroups.size\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\tfor (const tg of this._trackingGroups.values()) {\n\t\t\tif (!trackingCollection._trackingGroups.has(tg)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n"]}
|
package/dist/opBuilder.js
CHANGED
|
@@ -4,7 +4,15 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.createAnnotateMarkerOp = createAnnotateMarkerOp;
|
|
8
|
+
exports.createAnnotateRangeOp = createAnnotateRangeOp;
|
|
9
|
+
exports.createAdjustRangeOp = createAdjustRangeOp;
|
|
10
|
+
exports.createRemoveRangeOp = createRemoveRangeOp;
|
|
11
|
+
exports.createObliterateRangeOp = createObliterateRangeOp;
|
|
12
|
+
exports.createObliterateRangeOpSided = createObliterateRangeOpSided;
|
|
13
|
+
exports.createInsertSegmentOp = createInsertSegmentOp;
|
|
14
|
+
exports.createInsertOp = createInsertOp;
|
|
15
|
+
exports.createGroupOp = createGroupOp;
|
|
8
16
|
const ops_js_1 = require("./ops.js");
|
|
9
17
|
const sequencePlace_js_1 = require("./sequencePlace.js");
|
|
10
18
|
/**
|
|
@@ -27,7 +35,6 @@ function createAnnotateMarkerOp(marker, props) {
|
|
|
27
35
|
type: ops_js_1.MergeTreeDeltaType.ANNOTATE,
|
|
28
36
|
};
|
|
29
37
|
}
|
|
30
|
-
exports.createAnnotateMarkerOp = createAnnotateMarkerOp;
|
|
31
38
|
/**
|
|
32
39
|
* Creates the op for annotating the range with the provided properties
|
|
33
40
|
* @param start - The inclusive start position of the range to annotate
|
|
@@ -45,7 +52,6 @@ function createAnnotateRangeOp(start, end, props) {
|
|
|
45
52
|
type: ops_js_1.MergeTreeDeltaType.ANNOTATE,
|
|
46
53
|
};
|
|
47
54
|
}
|
|
48
|
-
exports.createAnnotateRangeOp = createAnnotateRangeOp;
|
|
49
55
|
/**
|
|
50
56
|
* Creates the op for annotating the range with the provided properties
|
|
51
57
|
* @param start - The inclusive start position of the range to annotate
|
|
@@ -63,7 +69,6 @@ function createAdjustRangeOp(start, end, adjust) {
|
|
|
63
69
|
type: ops_js_1.MergeTreeDeltaType.ANNOTATE,
|
|
64
70
|
};
|
|
65
71
|
}
|
|
66
|
-
exports.createAdjustRangeOp = createAdjustRangeOp;
|
|
67
72
|
/**
|
|
68
73
|
* Creates the op to remove a range
|
|
69
74
|
*
|
|
@@ -79,7 +84,6 @@ function createRemoveRangeOp(start, end) {
|
|
|
79
84
|
type: ops_js_1.MergeTreeDeltaType.REMOVE,
|
|
80
85
|
};
|
|
81
86
|
}
|
|
82
|
-
exports.createRemoveRangeOp = createRemoveRangeOp;
|
|
83
87
|
/**
|
|
84
88
|
* Creates the op to obliterate a range
|
|
85
89
|
*
|
|
@@ -96,7 +100,6 @@ function createObliterateRangeOp(start, end) {
|
|
|
96
100
|
type: ops_js_1.MergeTreeDeltaType.OBLITERATE,
|
|
97
101
|
};
|
|
98
102
|
}
|
|
99
|
-
exports.createObliterateRangeOp = createObliterateRangeOp;
|
|
100
103
|
/**
|
|
101
104
|
* Creates the op to obliterate a range
|
|
102
105
|
*
|
|
@@ -122,7 +125,6 @@ function createObliterateRangeOpSided(start, end) {
|
|
|
122
125
|
pos2: { pos: endPlace.pos, before: endPlace.side === sequencePlace_js_1.Side.Before },
|
|
123
126
|
};
|
|
124
127
|
}
|
|
125
|
-
exports.createObliterateRangeOpSided = createObliterateRangeOpSided;
|
|
126
128
|
/**
|
|
127
129
|
* Creates an op for inserting a segment at the specified position.
|
|
128
130
|
*
|
|
@@ -134,7 +136,6 @@ exports.createObliterateRangeOpSided = createObliterateRangeOpSided;
|
|
|
134
136
|
function createInsertSegmentOp(pos, segment) {
|
|
135
137
|
return createInsertOp(pos, segment.toJSONObject());
|
|
136
138
|
}
|
|
137
|
-
exports.createInsertSegmentOp = createInsertSegmentOp;
|
|
138
139
|
/**
|
|
139
140
|
* Creates the op for inserting a segment from its JSON representation at
|
|
140
141
|
* the specified position.
|
|
@@ -148,7 +149,6 @@ function createInsertOp(pos, segSpec) {
|
|
|
148
149
|
type: ops_js_1.MergeTreeDeltaType.INSERT,
|
|
149
150
|
};
|
|
150
151
|
}
|
|
151
|
-
exports.createInsertOp = createInsertOp;
|
|
152
152
|
/**
|
|
153
153
|
* Creates a group op from the provided ops.
|
|
154
154
|
*
|
|
@@ -163,5 +163,4 @@ function createGroupOp(...ops) {
|
|
|
163
163
|
type: ops_js_1.MergeTreeDeltaType.GROUP,
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
|
-
exports.createGroupOp = createGroupOp;
|
|
167
166
|
//# sourceMappingURL=opBuilder.js.map
|
package/dist/opBuilder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opBuilder.js","sourceRoot":"","sources":["../src/opBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"opBuilder.js","sourceRoot":"","sources":["../src/opBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA4BH,wDAeC;AAWD,sDAWC;AAWD,kDAWC;AAUD,kDAMC;AAWD,0DAMC;AAcD,oEAgBC;AAUD,sDAEC;AAQD,wCAMC;AAUD,sCAKC;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cesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ISegment, Marker } from \"./mergeTreeNodes.js\";\nimport {\n\ttype IMergeTreeAnnotateMsg,\n\ttype IMergeTreeDeltaOp,\n\t// eslint-disable-next-line import-x/no-deprecated\n\ttype IMergeTreeGroupMsg,\n\ttype IMergeTreeInsertMsg,\n\t// eslint-disable-next-line import-x/no-deprecated\n\ttype IMergeTreeObliterateMsg,\n\ttype IMergeTreeRemoveMsg,\n\tMergeTreeDeltaType,\n\ttype AdjustParams,\n\ttype IMergeTreeAnnotateAdjustMsg,\n\ttype IMergeTreeObliterateSidedMsg,\n} from \"./ops.js\";\nimport type { PropertySet, MapLike } from \"./properties.js\";\nimport { normalizePlace, Side, type SequencePlace } from \"./sequencePlace.js\";\n\n/**\n * Creates the op for annotating the markers with the provided properties\n * @param marker - The marker to annotate\n * @param props - The properties to annotate the marker with\n * @returns The annotate op\n *\n * @internal\n */\nexport function createAnnotateMarkerOp(\n\tmarker: Marker,\n\tprops: PropertySet,\n): IMergeTreeAnnotateMsg | undefined {\n\tconst id = marker.getId();\n\tif (!id) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tprops: { ...props },\n\t\trelativePos1: { id, before: true },\n\t\trelativePos2: { id },\n\t\ttype: MergeTreeDeltaType.ANNOTATE,\n\t};\n}\n\n/**\n * Creates the op for annotating the range with the provided properties\n * @param start - The inclusive start position of the range to annotate\n * @param end - The exclusive end position of the range to annotate\n * @param props - The properties to annotate the range with\n * @returns The annotate op\n *\n * @internal\n */\nexport function createAnnotateRangeOp(\n\tstart: number,\n\tend: number,\n\tprops: PropertySet,\n): IMergeTreeAnnotateMsg {\n\treturn {\n\t\tpos1: start,\n\t\tpos2: end,\n\t\tprops: { ...props },\n\t\ttype: MergeTreeDeltaType.ANNOTATE,\n\t};\n}\n\n/**\n * Creates the op for annotating the range with the provided properties\n * @param start - The inclusive start position of the range to annotate\n * @param end - The exclusive end position of the range to annotate\n * @param props - The properties to annotate the range with\n * @returns The annotate op\n *\n * @internal\n */\nexport function createAdjustRangeOp(\n\tstart: number,\n\tend: number,\n\tadjust: MapLike<AdjustParams>,\n): IMergeTreeAnnotateAdjustMsg {\n\treturn {\n\t\tpos1: start,\n\t\tpos2: end,\n\t\tadjust: { ...adjust },\n\t\ttype: MergeTreeDeltaType.ANNOTATE,\n\t};\n}\n\n/**\n * Creates the op to remove a range\n *\n * @param start - The inclusive start of the range to remove\n * @param end - The exclusive end of the range to remove\n *\n * @internal\n */\nexport function createRemoveRangeOp(start: number, end: number): IMergeTreeRemoveMsg {\n\treturn {\n\t\tpos1: start,\n\t\tpos2: end,\n\t\ttype: MergeTreeDeltaType.REMOVE,\n\t};\n}\n\n/**\n * Creates the op to obliterate a range\n *\n * @param start - The inclusive start of the range to obliterate\n * @param end - The exclusive end of the range to obliterate\n *\n * @internal\n */\n// eslint-disable-next-line import-x/no-deprecated\nexport function createObliterateRangeOp(start: number, end: number): IMergeTreeObliterateMsg {\n\treturn {\n\t\tpos1: start,\n\t\tpos2: end,\n\t\ttype: MergeTreeDeltaType.OBLITERATE,\n\t};\n}\n\n/**\n * Creates the op to obliterate a range\n *\n * @param start - The start of the range to obliterate.\n * If a number is provided, the range will start before that index.\n * @param end - The end of the range to obliterate.\n * If a number is provided, the range will end after that index -1.\n * This preserves the previous behavior of not expanding obliteration ranges at the endpoints\n * for uses which predate the availability of endpoint expansion.\n *\n * @internal\n */\nexport function createObliterateRangeOpSided(\n\tstart: SequencePlace,\n\tend: SequencePlace,\n): IMergeTreeObliterateSidedMsg {\n\tconst startPlace = normalizePlace(start);\n\t// If a number is provided, default to after the previous index.\n\t// This preserves the behavior of obliterate prior to the introduction of endpoint expansion.\n\tconst endPlace =\n\t\ttypeof end === \"number\"\n\t\t\t? { pos: end - 1, side: Side.After } // default to inclusive bounds\n\t\t\t: normalizePlace(end);\n\treturn {\n\t\ttype: MergeTreeDeltaType.OBLITERATE_SIDED,\n\t\tpos1: { pos: startPlace.pos, before: startPlace.side === Side.Before },\n\t\tpos2: { pos: endPlace.pos, before: endPlace.side === Side.Before },\n\t};\n}\n\n/**\n * Creates an op for inserting a segment at the specified position.\n *\n * @param pos - The position to insert the segment at\n * @param segment - The segment to insert\n *\n * @internal\n */\nexport function createInsertSegmentOp(pos: number, segment: ISegment): IMergeTreeInsertMsg {\n\treturn createInsertOp(pos, segment.toJSONObject());\n}\n\n/**\n * Creates the op for inserting a segment from its JSON representation at\n * the specified position.\n *\n * @internal\n */\nexport function createInsertOp(pos: number, segSpec: unknown): IMergeTreeInsertMsg {\n\treturn {\n\t\tpos1: pos,\n\t\tseg: segSpec,\n\t\ttype: MergeTreeDeltaType.INSERT,\n\t};\n}\n\n/**\n * Creates a group op from the provided ops.\n *\n * @param ops - The ops to group\n *\n * @internal\n */\n// eslint-disable-next-line import-x/no-deprecated\nexport function createGroupOp(...ops: IMergeTreeDeltaOp[]): IMergeTreeGroupMsg {\n\treturn {\n\t\tops,\n\t\ttype: MergeTreeDeltaType.GROUP,\n\t};\n}\n"]}
|
package/dist/ordinal.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.computeHierarchicalOrdinal =
|
|
7
|
+
exports.computeHierarchicalOrdinal = computeHierarchicalOrdinal;
|
|
8
8
|
/* eslint-disable no-bitwise */
|
|
9
9
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
10
10
|
function computeHierarchicalOrdinal(maxCount, actualCount, parentOrdinal, previousOrdinal) {
|
|
@@ -28,5 +28,4 @@ function computeHierarchicalOrdinal(maxCount, actualCount, parentOrdinal, previo
|
|
|
28
28
|
}
|
|
29
29
|
return ordinal;
|
|
30
30
|
}
|
|
31
|
-
exports.computeHierarchicalOrdinal = computeHierarchicalOrdinal;
|
|
32
31
|
//# sourceMappingURL=ordinal.js.map
|
package/dist/ordinal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ordinal.js","sourceRoot":"","sources":["../src/ordinal.ts"],"names":[],"mappings":";AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"ordinal.js","sourceRoot":"","sources":["../src/ordinal.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAKH,gEA6BC;AAhCD,+BAA+B;AAC/B,kEAA6D;AAE7D,SAAgB,0BAA0B,CACzC,QAAgB,EAChB,WAAmB,EACnB,aAAqB,EACrB,eAAmC;IAEnC,IAAA,iBAAM,EACL,QAAQ,IAAI,EAAE,IAAI,WAAW,IAAI,QAAQ,EACzC,KAAK,CAAC,6DAA6D,CACnE,CAAC;IAEF,MAAM,YAAY,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,CAAC;IACnD,IAAI,OAAe,CAAC;IACpB,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QACnC,qHAAqH;QACrH,iGAAiG;QACjG,kEAAkE;QAClE,qDAAqD;QACrD,OAAO,GAAG,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;IACjE,CAAC;SAAM,CAAC;QACP,qDAAqD;QACrD,MAAM,WAAW,GAAG,eAAe,CAAC,UAAU,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC3E,IAAA,iBAAM,EAAC,WAAW,KAAK,SAAS,EAAE,KAAK,CAAC,0CAA0C,CAAC,CAAC;QACpF,MAAM,YAAY,GAAG,WAAW,GAAG,YAAY,CAAC;QAChD,qDAAqD;QACrD,OAAO,GAAG,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nexport function computeHierarchicalOrdinal(\n\tmaxCount: number,\n\tactualCount: number,\n\tparentOrdinal: string,\n\tpreviousOrdinal: string | undefined,\n): string {\n\tassert(\n\t\tmaxCount <= 16 && actualCount <= maxCount,\n\t\t0x3f0 /* count must be less than max, and max must be 16 or less */,\n\t);\n\n\tconst ordinalWidth = 1 << (maxCount - actualCount);\n\tlet ordinal: string;\n\tif (previousOrdinal === undefined) {\n\t\t// Ordinals exist purely for lexicographical sort order and use a small set of valid bytes for each string character.\n\t\t// The extra handling fromCodePoint has for things like surrogate pairs is therefore unnecessary.\n\t\t// disable the rule to use code points when dealing with ordinals.\n\t\t// eslint-disable-next-line unicorn/prefer-code-point\n\t\tordinal = parentOrdinal + String.fromCharCode(ordinalWidth - 1);\n\t} else {\n\t\t// eslint-disable-next-line unicorn/prefer-code-point\n\t\tconst prevOrdCode = previousOrdinal.charCodeAt(previousOrdinal.length - 1);\n\t\tassert(prevOrdCode !== undefined, 0x9ad /* previous ordinal should not be empty */);\n\t\tconst localOrdinal = prevOrdCode + ordinalWidth;\n\t\t// eslint-disable-next-line unicorn/prefer-code-point\n\t\tordinal = parentOrdinal + String.fromCharCode(localOrdinal);\n\t}\n\n\treturn ordinal;\n}\n"]}
|
package/dist/partialLengths.js
CHANGED
|
@@ -19,15 +19,27 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
19
19
|
}) : function(o, v) {
|
|
20
20
|
o["default"] = v;
|
|
21
21
|
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || function (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
29
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.
|
|
40
|
+
exports.PartialSequenceLengths = void 0;
|
|
41
|
+
exports.verifyExpectedPartialLengths = verifyExpectedPartialLengths;
|
|
42
|
+
exports.verifyPartialLengths = verifyPartialLengths;
|
|
31
43
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
32
44
|
const mergeTreeNodes_js_1 = require("./mergeTreeNodes.js");
|
|
33
45
|
const perspective_js_1 = require("./perspective.js");
|
|
@@ -155,6 +167,82 @@ class PartialSequenceLengthsSet extends sortedSet_js_1.SortedSet {
|
|
|
155
167
|
* 5. The incremental code path of `update`
|
|
156
168
|
*/
|
|
157
169
|
class PartialSequenceLengths {
|
|
170
|
+
minSeq;
|
|
171
|
+
static options = {
|
|
172
|
+
zamboni: true,
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Length of the block this PartialSequenceLength corresponds to when viewed at `minSeq`.
|
|
176
|
+
*/
|
|
177
|
+
minLength = 0;
|
|
178
|
+
/**
|
|
179
|
+
* Total number of segments in the subtree rooted at the block this PartialSequenceLength corresponds to.
|
|
180
|
+
*/
|
|
181
|
+
segmentCount = 0;
|
|
182
|
+
/**
|
|
183
|
+
* List of PartialSequenceLength objects--ordered by increasing seq--giving length information about
|
|
184
|
+
* the block associated with this PartialSequenceLengths object.
|
|
185
|
+
*
|
|
186
|
+
* `minLength + partialLengths[i].len` gives the length of this block when considering the perspective of an observer
|
|
187
|
+
* client who has received edits up to (and including) sequence number `i`.
|
|
188
|
+
*/
|
|
189
|
+
partialLengths = new PartialSequenceLengthsSet();
|
|
190
|
+
/**
|
|
191
|
+
* perClientAdjustments[clientId] contains a PartialSequenceLengthsSet of adjustments to the observer client's
|
|
192
|
+
* perspective (see {@link PartialSequenceLengths.partialLengths}) necessary to account for changes made by
|
|
193
|
+
* that client.
|
|
194
|
+
*
|
|
195
|
+
* As per doc comment on {@link PartialSequenceLengths}, the overall adjustment performed for the perspective of
|
|
196
|
+
* (clientId, refSeq) is given by the sum of length deltas in `perClientAdjustments[clientId]`
|
|
197
|
+
* for all sequence numbers S such that S \>= refSeq.
|
|
198
|
+
*
|
|
199
|
+
* (since these are ordered by sequence number and we cache cumulative sums, this is implemented using two lookups and a subtraction).
|
|
200
|
+
*
|
|
201
|
+
* The specific adjustments are roughly categorized as follows:
|
|
202
|
+
*
|
|
203
|
+
* - Ops submitted by a given client generally receive a partial lengths entry corresponding to their sequence number.
|
|
204
|
+
* e.g. insert of "ABC" at seq 5 will have a per-client adjustment entry of \{ seq: 5, seglen: 3 \}.
|
|
205
|
+
*
|
|
206
|
+
* - When client A deletes a segment concurrently with client B and loses the race (B's delete is sequenced first),
|
|
207
|
+
* A's per-client adjustments will contain an entry with a negative `seglen` corresponding to the length of the segment
|
|
208
|
+
* and a sequence number corresponding to that of B's delete. It will *not* receive a per-client adjustment for its own delete.
|
|
209
|
+
* This ensures that for perspectives (A, refSeq), the deleted segment will show up as a negative delta for all values of refSeq, since:
|
|
210
|
+
* 1. For refSeq \< B's delete, the per-client adjustment will apply and be added to the total length
|
|
211
|
+
* 2. For refSeq \>= B's delete, B's partial length entry in the overall set will apply, and the per-client adjustment will not apply
|
|
212
|
+
*
|
|
213
|
+
* - When client A attempts to insert a segment into a location that is concurrently obliterated by client B immediately upon insertion,
|
|
214
|
+
* A's per-client adjustments will again not include an entry for its own insert.
|
|
215
|
+
* Instead, the entry which would normally contain `seq` equal to that of A's insert would instead have `seq` equal to that of B's obliterate.
|
|
216
|
+
* This gives the overall correct behavior: for any perspective which isn't client A, there is no adjustment necessary anywhere (it's as if
|
|
217
|
+
* the segment never existed). For client A's perspective, the segment should be considered visible until A has acked B's obliterate.
|
|
218
|
+
* This is accomplished as for the perspective (A, refSeq):
|
|
219
|
+
* 1. For refSeq \< B's obliterate, the segment length will be included as part of the per-client adjustment for A
|
|
220
|
+
* 2. For refSeq \>= B's obliterate, the segment will be omitted from the per-client adjustment for A
|
|
221
|
+
*
|
|
222
|
+
* Note that the special-casing for inserting segments that are immediately obliterated is only necessary for segments that never were visible
|
|
223
|
+
* in the tree. If an insert and obliterate are concurrent but the insert is sequenced first, the normal per-client adjustment is fine.
|
|
224
|
+
*
|
|
225
|
+
* The second case (overlapping removal) applies to any combination of remove / obliterate operations.
|
|
226
|
+
*/
|
|
227
|
+
perClientAdjustments = [];
|
|
228
|
+
/**
|
|
229
|
+
* Contains information required to answer queries for the length of this segment from the perspective of
|
|
230
|
+
* the local client but not including all local segments (i.e., `localSeq !== collabWindow.localSeq`).
|
|
231
|
+
* This field is only computed if requested in the constructor (i.e. `computeLocalPartials === true`).
|
|
232
|
+
*
|
|
233
|
+
* Note that the usage pattern for this list is a bit different from perClientAdjustments: when dealing with perspectives of remote clients,
|
|
234
|
+
* we generally want to know what their view of the block was accounting for all changes made by that client as well as all \<= some refSeq.
|
|
235
|
+
*
|
|
236
|
+
* However, when dealing with perspectives relevant to the local client, we are still interested in changes made \<= some refSeq, but instead
|
|
237
|
+
* of caring about all changes made by the local client, we additionally want the subset of them that were made \<= some localSeq.
|
|
238
|
+
*
|
|
239
|
+
* The PartialSequenceLengthsSets stored in this field therefore track localSeqs rather than seqs (it's still named seq for ease of implementation).
|
|
240
|
+
* Furthermore, when computing the length of the block at a given refSeq/localSeq perspective,
|
|
241
|
+
* rather than add something like `perClientAdjustments[clientId].latestLeq(latestSeq) - perClientAdjustments[clientId].latestLeq(refSeq)` [to
|
|
242
|
+
* get the tail end of adjustments necessary for a remote client client], we instead add `unsequencedRecords.partialLengths.latestLeq(localSeq)`
|
|
243
|
+
* [to get the head end of adjustments necessary for the local client].
|
|
244
|
+
*/
|
|
245
|
+
unsequencedRecords;
|
|
158
246
|
constructor(
|
|
159
247
|
/**
|
|
160
248
|
* The minimumSequenceNumber as defined by the collab window used in the last call to `update`,
|
|
@@ -162,66 +250,6 @@ class PartialSequenceLengths {
|
|
|
162
250
|
*/
|
|
163
251
|
minSeq, computeLocalPartials) {
|
|
164
252
|
this.minSeq = minSeq;
|
|
165
|
-
/**
|
|
166
|
-
* Length of the block this PartialSequenceLength corresponds to when viewed at `minSeq`.
|
|
167
|
-
*/
|
|
168
|
-
this.minLength = 0;
|
|
169
|
-
/**
|
|
170
|
-
* Total number of segments in the subtree rooted at the block this PartialSequenceLength corresponds to.
|
|
171
|
-
*/
|
|
172
|
-
this.segmentCount = 0;
|
|
173
|
-
/**
|
|
174
|
-
* List of PartialSequenceLength objects--ordered by increasing seq--giving length information about
|
|
175
|
-
* the block associated with this PartialSequenceLengths object.
|
|
176
|
-
*
|
|
177
|
-
* `minLength + partialLengths[i].len` gives the length of this block when considering the perspective of an observer
|
|
178
|
-
* client who has received edits up to (and including) sequence number `i`.
|
|
179
|
-
*/
|
|
180
|
-
this.partialLengths = new PartialSequenceLengthsSet();
|
|
181
|
-
/**
|
|
182
|
-
* perClientAdjustments[clientId] contains a PartialSequenceLengthsSet of adjustments to the observer client's
|
|
183
|
-
* perspective (see {@link PartialSequenceLengths.partialLengths}) necessary to account for changes made by
|
|
184
|
-
* that client.
|
|
185
|
-
*
|
|
186
|
-
* As per doc comment on {@link PartialSequenceLengths}, the overall adjustment performed for the perspective of
|
|
187
|
-
* (clientId, refSeq) is given by the sum of length deltas in `perClientAdjustments[clientId]`
|
|
188
|
-
* for all sequence numbers S such that S \>= refSeq.
|
|
189
|
-
*
|
|
190
|
-
* (since these are ordered by sequence number and we cache cumulative sums, this is implemented using two lookups and a subtraction).
|
|
191
|
-
*
|
|
192
|
-
* The specific adjustments are roughly categorized as follows:
|
|
193
|
-
*
|
|
194
|
-
* - Ops submitted by a given client generally receive a partial lengths entry corresponding to their sequence number.
|
|
195
|
-
* e.g. insert of "ABC" at seq 5 will have a per-client adjustment entry of \{ seq: 5, seglen: 3 \}.
|
|
196
|
-
*
|
|
197
|
-
* - When client A deletes a segment concurrently with client B and loses the race (B's delete is sequenced first),
|
|
198
|
-
* A's per-client adjustments will contain an entry with a negative `seglen` corresponding to the length of the segment
|
|
199
|
-
* and a sequence number corresponding to that of B's delete. It will *not* receive a per-client adjustment for its own delete.
|
|
200
|
-
* This ensures that for perspectives (A, refSeq), the deleted segment will show up as a negative delta for all values of refSeq, since:
|
|
201
|
-
* 1. For refSeq \< B's delete, the per-client adjustment will apply and be added to the total length
|
|
202
|
-
* 2. For refSeq \>= B's delete, B's partial length entry in the overall set will apply, and the per-client adjustment will not apply
|
|
203
|
-
*
|
|
204
|
-
* - When client A attempts to insert a segment into a location that is concurrently obliterated by client B immediately upon insertion,
|
|
205
|
-
* A's per-client adjustments will again not include an entry for its own insert.
|
|
206
|
-
* Instead, the entry which would normally contain `seq` equal to that of A's insert would instead have `seq` equal to that of B's obliterate.
|
|
207
|
-
* This gives the overall correct behavior: for any perspective which isn't client A, there is no adjustment necessary anywhere (it's as if
|
|
208
|
-
* the segment never existed). For client A's perspective, the segment should be considered visible until A has acked B's obliterate.
|
|
209
|
-
* This is accomplished as for the perspective (A, refSeq):
|
|
210
|
-
* 1. For refSeq \< B's obliterate, the segment length will be included as part of the per-client adjustment for A
|
|
211
|
-
* 2. For refSeq \>= B's obliterate, the segment will be omitted from the per-client adjustment for A
|
|
212
|
-
*
|
|
213
|
-
* Note that the special-casing for inserting segments that are immediately obliterated is only necessary for segments that never were visible
|
|
214
|
-
* in the tree. If an insert and obliterate are concurrent but the insert is sequenced first, the normal per-client adjustment is fine.
|
|
215
|
-
*
|
|
216
|
-
* The second case (overlapping removal) applies to any combination of remove / obliterate operations.
|
|
217
|
-
*/
|
|
218
|
-
this.perClientAdjustments = [];
|
|
219
|
-
/**
|
|
220
|
-
* If incremental update of partial lengths fails, this gets set to the seq of the failed update.
|
|
221
|
-
* When higher up blocks attempt to incrementally update, they first check if the seq they are updating for
|
|
222
|
-
* matches this value. If it does, they propagate a full refresh instead.
|
|
223
|
-
*/
|
|
224
|
-
this.lastIncrementalInvalidationSeq = Number.NEGATIVE_INFINITY;
|
|
225
253
|
if (computeLocalPartials) {
|
|
226
254
|
this.unsequencedRecords = {
|
|
227
255
|
partialLengths: new PartialSequenceLengthsSet(),
|
|
@@ -618,6 +646,12 @@ class PartialSequenceLengths {
|
|
|
618
646
|
}
|
|
619
647
|
}
|
|
620
648
|
}
|
|
649
|
+
/**
|
|
650
|
+
* If incremental update of partial lengths fails, this gets set to the seq of the failed update.
|
|
651
|
+
* When higher up blocks attempt to incrementally update, they first check if the seq they are updating for
|
|
652
|
+
* matches this value. If it does, they propagate a full refresh instead.
|
|
653
|
+
*/
|
|
654
|
+
lastIncrementalInvalidationSeq = Number.NEGATIVE_INFINITY;
|
|
621
655
|
// Assume: seq is latest sequence number; no structural change to sub-tree, but this partial lengths
|
|
622
656
|
// entry needs to account for the change made by the client with `clientId` at sequence number `seq`.
|
|
623
657
|
// (and `update` has been called on all descendant PartialSequenceLengths).
|
|
@@ -859,9 +893,6 @@ class PartialSequenceLengths {
|
|
|
859
893
|
}
|
|
860
894
|
}
|
|
861
895
|
exports.PartialSequenceLengths = PartialSequenceLengths;
|
|
862
|
-
PartialSequenceLengths.options = {
|
|
863
|
-
zamboni: true,
|
|
864
|
-
};
|
|
865
896
|
/* eslint-disable @typescript-eslint/dot-notation */
|
|
866
897
|
function verifyPartialLengthsInner(partialSeqLengths, partialLengths, clientPartials) {
|
|
867
898
|
if (partialLengths.size === 0) {
|
|
@@ -936,7 +967,6 @@ function verifyExpectedPartialLengths(mergeTree, node, refSeq, clientId, localSe
|
|
|
936
967
|
throw new Error(`expected partial length of ${expected} but found ${partialLen}. refSeq: ${refSeq}, clientId: ${clientId}. (non-incremental codepath returned ${nonIncrementalLength})`);
|
|
937
968
|
}
|
|
938
969
|
}
|
|
939
|
-
exports.verifyExpectedPartialLengths = verifyExpectedPartialLengths;
|
|
940
970
|
function verifyPartialLengths(partialSeqLengths) {
|
|
941
971
|
if (partialSeqLengths["perClientAdjustments"]) {
|
|
942
972
|
for (const cliSeq of partialSeqLengths["perClientAdjustments"]) {
|
|
@@ -953,7 +983,6 @@ function verifyPartialLengths(partialSeqLengths) {
|
|
|
953
983
|
(0, internal_1.assert)(!partialSeqLengths["partialLengths"], 0x05b /* "Flat view exists but client view does not!" */);
|
|
954
984
|
}
|
|
955
985
|
}
|
|
956
|
-
exports.verifyPartialLengths = verifyPartialLengths;
|
|
957
986
|
/* eslint-enable @typescript-eslint/dot-notation */
|
|
958
987
|
/**
|
|
959
988
|
* Given a number of seq-sorted `partialLength` lists, merges them into a combined seq-sorted `partialLength`
|
|
@@ -986,6 +1015,13 @@ function mergePartialLengths(childPartialLengths, mergedLengths = new PartialSeq
|
|
|
986
1015
|
*/
|
|
987
1016
|
function mergeSortedListsBySeq(lists) {
|
|
988
1017
|
class PartialSequenceLengthIterator {
|
|
1018
|
+
sublists;
|
|
1019
|
+
/**
|
|
1020
|
+
* nextSmallestIndex[i] is the next element of sublists[i] to check.
|
|
1021
|
+
* In other words, the iterator has already yielded elements of sublists[i] *up through*
|
|
1022
|
+
* sublists[i][nextSmallestIndex[i] - 1].
|
|
1023
|
+
*/
|
|
1024
|
+
nextSmallestIndex;
|
|
989
1025
|
constructor(sublists) {
|
|
990
1026
|
this.sublists = sublists;
|
|
991
1027
|
this.nextSmallestIndex = Array.from({ length: sublists.length });
|