@fluidframework/merge-tree 0.59.2001 → 0.59.3000
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 +0 -1
- package/dist/client.d.ts +15 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +60 -34
- package/dist/client.js.map +1 -1
- package/dist/collections.d.ts +7 -1
- package/dist/collections.d.ts.map +1 -1
- package/dist/collections.js +27 -1
- package/dist/collections.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/localReference.d.ts +104 -10
- package/dist/localReference.d.ts.map +1 -1
- package/dist/localReference.js +152 -96
- package/dist/localReference.js.map +1 -1
- package/dist/mergeTree.d.ts +28 -21
- package/dist/mergeTree.d.ts.map +1 -1
- package/dist/mergeTree.js +100 -88
- package/dist/mergeTree.js.map +1 -1
- package/dist/partialLengths.js +10 -10
- package/dist/partialLengths.js.map +1 -1
- package/dist/referencePositions.d.ts +55 -0
- package/dist/referencePositions.d.ts.map +1 -0
- package/dist/referencePositions.js +93 -0
- package/dist/referencePositions.js.map +1 -0
- package/dist/segmentGroupCollection.js +1 -1
- package/dist/segmentGroupCollection.js.map +1 -1
- package/dist/segmentPropertiesManager.js +5 -5
- package/dist/segmentPropertiesManager.js.map +1 -1
- package/dist/snapshotChunks.js.map +1 -1
- package/dist/snapshotLoader.d.ts.map +1 -1
- package/dist/snapshotLoader.js +9 -9
- package/dist/snapshotLoader.js.map +1 -1
- package/dist/snapshotV1.js +7 -7
- package/dist/snapshotV1.js.map +1 -1
- package/dist/snapshotlegacy.js +6 -6
- package/dist/snapshotlegacy.js.map +1 -1
- package/dist/sortedSegmentSet.d.ts.map +1 -1
- package/dist/sortedSegmentSet.js +1 -1
- package/dist/sortedSegmentSet.js.map +1 -1
- package/dist/textSegment.js +3 -2
- package/dist/textSegment.js.map +1 -1
- package/lib/client.d.ts +15 -4
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +31 -5
- package/lib/client.js.map +1 -1
- package/lib/collections.d.ts +7 -1
- package/lib/collections.d.ts.map +1 -1
- package/lib/collections.js +26 -1
- package/lib/collections.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/localReference.d.ts +104 -10
- package/lib/localReference.d.ts.map +1 -1
- package/lib/localReference.js +146 -90
- package/lib/localReference.js.map +1 -1
- package/lib/mergeTree.d.ts +28 -21
- package/lib/mergeTree.d.ts.map +1 -1
- package/lib/mergeTree.js +67 -51
- package/lib/mergeTree.js.map +1 -1
- package/lib/referencePositions.d.ts +55 -0
- package/lib/referencePositions.d.ts.map +1 -0
- package/lib/referencePositions.js +80 -0
- package/lib/referencePositions.js.map +1 -0
- package/lib/segmentPropertiesManager.js.map +1 -1
- package/lib/snapshotChunks.js.map +1 -1
- package/lib/snapshotLoader.d.ts.map +1 -1
- package/lib/snapshotLoader.js.map +1 -1
- package/lib/snapshotV1.js.map +1 -1
- package/lib/snapshotlegacy.js +1 -1
- package/lib/snapshotlegacy.js.map +1 -1
- package/lib/sortedSegmentSet.d.ts.map +1 -1
- package/lib/sortedSegmentSet.js +1 -1
- package/lib/sortedSegmentSet.js.map +1 -1
- package/lib/textSegment.js +3 -2
- package/lib/textSegment.js.map +1 -1
- package/package.json +161 -14
- package/src/client.ts +45 -19
- package/src/collections.ts +55 -54
- package/src/index.ts +1 -0
- package/src/localReference.ts +190 -100
- package/src/mergeTree.ts +107 -99
- package/src/referencePositions.ts +126 -0
- package/src/snapshotChunks.ts +8 -8
- package/src/snapshotLoader.ts +4 -4
- package/src/snapshotV1.ts +1 -1
- package/src/snapshotlegacy.ts +2 -2
- package/src/sortedSegmentSet.ts +4 -4
- package/src/textSegment.ts +2 -2
package/.eslintrc.js
CHANGED
|
@@ -15,7 +15,6 @@ module.exports = {
|
|
|
15
15
|
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
16
16
|
"keyword-spacing": "off", // Off because it conflicts with typescript-formatter
|
|
17
17
|
"no-case-declarations": "off",
|
|
18
|
-
"no-null/no-null": "off",
|
|
19
18
|
"prefer-arrow/prefer-arrow-functions": "off"
|
|
20
19
|
}
|
|
21
20
|
}
|
package/dist/client.d.ts
CHANGED
|
@@ -9,12 +9,13 @@ import { IFluidDataStoreRuntime, IChannelStorageService } from "@fluidframework/
|
|
|
9
9
|
import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
|
|
10
10
|
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
11
11
|
import { LocalReference } from "./localReference";
|
|
12
|
-
import { CollaborationWindow, ISegment, ISegmentAction, Marker, MergeTree,
|
|
12
|
+
import { CollaborationWindow, ISegment, ISegmentAction, Marker, MergeTree, SegmentGroup } from "./mergeTree";
|
|
13
13
|
import { MergeTreeDeltaCallback } from "./mergeTreeDeltaCallback";
|
|
14
|
-
import { ICombiningOp, IJSONSegment, IMergeTreeAnnotateMsg, IMergeTreeDeltaOp, IMergeTreeGroupMsg, IMergeTreeInsertMsg, IMergeTreeRemoveMsg, IMergeTreeOp, IRelativePosition } from "./ops";
|
|
14
|
+
import { ICombiningOp, IJSONSegment, IMergeTreeAnnotateMsg, IMergeTreeDeltaOp, IMergeTreeGroupMsg, IMergeTreeInsertMsg, IMergeTreeRemoveMsg, IMergeTreeOp, IRelativePosition, ReferenceType } from "./ops";
|
|
15
15
|
import { PropertySet } from "./properties";
|
|
16
16
|
import { MergeTreeTextHelper } from "./textSegment";
|
|
17
|
-
import {
|
|
17
|
+
import { ReferencePosition, RangeStackMap } from "./referencePositions";
|
|
18
|
+
import { MergeTreeMaintenanceCallback } from "./index";
|
|
18
19
|
export declare class Client {
|
|
19
20
|
readonly specToSegment: (spec: IJSONSegment) => ISegment;
|
|
20
21
|
readonly logger: ITelemetryLogger;
|
|
@@ -101,8 +102,17 @@ export declare class Client {
|
|
|
101
102
|
* @param segment - The segment to get the position of
|
|
102
103
|
*/
|
|
103
104
|
getPosition(segment: ISegment): number;
|
|
105
|
+
/**
|
|
106
|
+
* @deprecated - use createReferencePosition instead
|
|
107
|
+
*/
|
|
104
108
|
addLocalReference(lref: LocalReference): void;
|
|
105
|
-
|
|
109
|
+
/**
|
|
110
|
+
* @deprecated - use removeReferencePosition instead
|
|
111
|
+
*/
|
|
112
|
+
removeLocalReference(lref: LocalReference): ReferencePosition | undefined;
|
|
113
|
+
createLocalReferencePosition(segment: ISegment, offset: number, refType: ReferenceType, properties: PropertySet | undefined): ReferencePosition;
|
|
114
|
+
removeLocalReferencePosition(lref: ReferencePosition): ReferencePosition | undefined;
|
|
115
|
+
localReferencePositionToPosition(lref: ReferencePosition): number;
|
|
106
116
|
/**
|
|
107
117
|
* Given a position specified relative to a marker id, lookup the marker
|
|
108
118
|
* and convert the position to a character position.
|
|
@@ -167,6 +177,7 @@ export declare class Client {
|
|
|
167
177
|
private applyRemoteOp;
|
|
168
178
|
applyStashedOp(op: IMergeTreeDeltaOp): SegmentGroup;
|
|
169
179
|
applyStashedOp(op: IMergeTreeGroupMsg): SegmentGroup[];
|
|
180
|
+
applyStashedOp(op: IMergeTreeOp): SegmentGroup | SegmentGroup[];
|
|
170
181
|
applyMsg(msg: ISequencedDocumentMessage, local?: boolean): void;
|
|
171
182
|
updateSeqNumbers(min: number, seq: number): void;
|
|
172
183
|
/**
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,uCAAu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");
|
|
|
17
17
|
const snapshotLoader_1 = require("./snapshotLoader");
|
|
18
18
|
const textSegment_1 = require("./textSegment");
|
|
19
19
|
const snapshotV1_1 = require("./snapshotV1");
|
|
20
|
+
const referencePositions_1 = require("./referencePositions");
|
|
20
21
|
function elapsedMicroseconds(trace) {
|
|
21
22
|
return trace.trace().duration * 1000;
|
|
22
23
|
}
|
|
@@ -102,7 +103,7 @@ class Client {
|
|
|
102
103
|
* @returns The annotate op if valid, otherwise undefined
|
|
103
104
|
*/
|
|
104
105
|
annotateMarker(marker, props, combiningOp) {
|
|
105
|
-
const annotateOp = opBuilder_1.createAnnotateMarkerOp(marker, props, combiningOp);
|
|
106
|
+
const annotateOp = (0, opBuilder_1.createAnnotateMarkerOp)(marker, props, combiningOp);
|
|
106
107
|
if (this.applyAnnotateRangeOp({ op: annotateOp })) {
|
|
107
108
|
return annotateOp;
|
|
108
109
|
}
|
|
@@ -119,7 +120,7 @@ class Client {
|
|
|
119
120
|
* @returns The annotate op if valid, otherwise undefined
|
|
120
121
|
*/
|
|
121
122
|
annotateRangeLocal(start, end, props, combiningOp) {
|
|
122
|
-
const annotateOp = opBuilder_1.createAnnotateRangeOp(start, end, props, combiningOp);
|
|
123
|
+
const annotateOp = (0, opBuilder_1.createAnnotateRangeOp)(start, end, props, combiningOp);
|
|
123
124
|
if (this.applyAnnotateRangeOp({ op: annotateOp })) {
|
|
124
125
|
return annotateOp;
|
|
125
126
|
}
|
|
@@ -132,7 +133,7 @@ class Client {
|
|
|
132
133
|
* @param end - The exclusive end of the range to remove
|
|
133
134
|
*/
|
|
134
135
|
removeRangeLocal(start, end) {
|
|
135
|
-
const removeOp = opBuilder_1.createRemoveRangeOp(start, end);
|
|
136
|
+
const removeOp = (0, opBuilder_1.createRemoveRangeOp)(start, end);
|
|
136
137
|
if (this.applyRemoveRangeOp({ op: removeOp })) {
|
|
137
138
|
return removeOp;
|
|
138
139
|
}
|
|
@@ -146,7 +147,7 @@ class Client {
|
|
|
146
147
|
if (segment.cachedLength <= 0) {
|
|
147
148
|
return undefined;
|
|
148
149
|
}
|
|
149
|
-
const insertOp = opBuilder_1.createInsertSegmentOp(pos, segment);
|
|
150
|
+
const insertOp = (0, opBuilder_1.createInsertSegmentOp)(pos, segment);
|
|
150
151
|
if (this.applyInsertOp({ op: insertOp })) {
|
|
151
152
|
return insertOp;
|
|
152
153
|
}
|
|
@@ -161,7 +162,7 @@ class Client {
|
|
|
161
162
|
if (pos === localReference_1.LocalReference.DetachedPosition) {
|
|
162
163
|
return undefined;
|
|
163
164
|
}
|
|
164
|
-
const op = opBuilder_1.createInsertSegmentOp(pos, segment);
|
|
165
|
+
const op = (0, opBuilder_1.createInsertSegmentOp)(pos, segment);
|
|
165
166
|
const opArgs = { op };
|
|
166
167
|
let traceStart;
|
|
167
168
|
if (this.measureOps) {
|
|
@@ -204,11 +205,30 @@ class Client {
|
|
|
204
205
|
}
|
|
205
206
|
return this.mergeTree.getPosition(segment, this.getCurrentSeq(), this.getClientId());
|
|
206
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* @deprecated - use createReferencePosition instead
|
|
210
|
+
*/
|
|
207
211
|
addLocalReference(lref) {
|
|
208
212
|
return this.mergeTree.addLocalReference(lref);
|
|
209
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* @deprecated - use removeReferencePosition instead
|
|
216
|
+
*/
|
|
210
217
|
removeLocalReference(lref) {
|
|
211
|
-
return this.
|
|
218
|
+
return this.removeLocalReferencePosition(lref);
|
|
219
|
+
}
|
|
220
|
+
createLocalReferencePosition(segment, offset, refType, properties) {
|
|
221
|
+
return this.mergeTree.createLocalReferencePosition(segment, offset, refType, properties, this);
|
|
222
|
+
}
|
|
223
|
+
removeLocalReferencePosition(lref) {
|
|
224
|
+
return this.mergeTree.removeLocalReferencePosition(lref);
|
|
225
|
+
}
|
|
226
|
+
localReferencePositionToPosition(lref) {
|
|
227
|
+
const segment = lref.getSegment();
|
|
228
|
+
if (segment === undefined) {
|
|
229
|
+
return referencePositions_1.DetachedReferencePosition;
|
|
230
|
+
}
|
|
231
|
+
return this.getPosition(segment) + lref.getOffset();
|
|
212
232
|
}
|
|
213
233
|
/**
|
|
214
234
|
* Given a position specified relative to a marker id, lookup the marker
|
|
@@ -227,7 +247,7 @@ class Client {
|
|
|
227
247
|
* @returns True if the remove was applied. False if it could not be.
|
|
228
248
|
*/
|
|
229
249
|
applyRemoveRangeOp(opArgs) {
|
|
230
|
-
common_utils_1.assert(opArgs.op.type === 1 /* REMOVE */, 0x02d /* "Unexpected op type on range remove!" */);
|
|
250
|
+
(0, common_utils_1.assert)(opArgs.op.type === 1 /* REMOVE */, 0x02d /* "Unexpected op type on range remove!" */);
|
|
231
251
|
const op = opArgs.op;
|
|
232
252
|
const clientArgs = this.getClientSequenceArgs(opArgs);
|
|
233
253
|
const range = this.getValidOpRange(op, clientArgs);
|
|
@@ -248,7 +268,7 @@ class Client {
|
|
|
248
268
|
* @returns True if the annotate was applied. False if it could not be.
|
|
249
269
|
*/
|
|
250
270
|
applyAnnotateRangeOp(opArgs) {
|
|
251
|
-
common_utils_1.assert(opArgs.op.type === 2 /* ANNOTATE */, 0x02e /* "Unexpected op type on range annotate!" */);
|
|
271
|
+
(0, common_utils_1.assert)(opArgs.op.type === 2 /* ANNOTATE */, 0x02e /* "Unexpected op type on range annotate!" */);
|
|
252
272
|
const op = opArgs.op;
|
|
253
273
|
const clientArgs = this.getClientSequenceArgs(opArgs);
|
|
254
274
|
const range = this.getValidOpRange(op, clientArgs);
|
|
@@ -269,7 +289,7 @@ class Client {
|
|
|
269
289
|
* @returns True if the insert was applied. False if it could not be.
|
|
270
290
|
*/
|
|
271
291
|
applyInsertOp(opArgs) {
|
|
272
|
-
common_utils_1.assert(opArgs.op.type === 0 /* INSERT */, 0x02f /* "Unexpected op type on range insert!" */);
|
|
292
|
+
(0, common_utils_1.assert)(opArgs.op.type === 0 /* INSERT */, 0x02f /* "Unexpected op type on range insert!" */);
|
|
273
293
|
const op = opArgs.op;
|
|
274
294
|
const clientArgs = this.getClientSequenceArgs(opArgs);
|
|
275
295
|
const range = this.getValidOpRange(op, clientArgs);
|
|
@@ -306,8 +326,8 @@ class Client {
|
|
|
306
326
|
}
|
|
307
327
|
}
|
|
308
328
|
else {
|
|
309
|
-
common_utils_1.assert(this.mergeTree.getCollabWindow().currentSeq < clientArgs.sequenceNumber, 0x030 /* "Incoming remote op sequence# <= local collabWindow's currentSequence#" */);
|
|
310
|
-
common_utils_1.assert(this.mergeTree.getCollabWindow().minSeq <= opArgs.sequencedMessage.minimumSequenceNumber, 0x031 /* "Incoming remote op minSequence# < local collabWindow's minSequence#" */);
|
|
329
|
+
(0, common_utils_1.assert)(this.mergeTree.getCollabWindow().currentSeq < clientArgs.sequenceNumber, 0x030 /* "Incoming remote op sequence# <= local collabWindow's currentSequence#" */);
|
|
330
|
+
(0, common_utils_1.assert)(this.mergeTree.getCollabWindow().minSeq <= opArgs.sequencedMessage.minimumSequenceNumber, 0x031 /* "Incoming remote op minSequence# < local collabWindow's minSequence#" */);
|
|
311
331
|
if (traceStart) {
|
|
312
332
|
this.accumTime += elapsedMicroseconds(traceStart);
|
|
313
333
|
this.accumOps++;
|
|
@@ -461,7 +481,7 @@ class Client {
|
|
|
461
481
|
* @param localSeq - The localSeq to find the position of the segment at
|
|
462
482
|
*/
|
|
463
483
|
findReconnectionPosition(segment, localSeq) {
|
|
464
|
-
common_utils_1.assert(localSeq <= this.mergeTree.collabWindow.localSeq, 0x032 /* "localSeq greater than collab window" */);
|
|
484
|
+
(0, common_utils_1.assert)(localSeq <= this.mergeTree.collabWindow.localSeq, 0x032 /* "localSeq greater than collab window" */);
|
|
465
485
|
let segmentPosition = 0;
|
|
466
486
|
/*
|
|
467
487
|
Walk the segments up to the current segment, and calculate it's
|
|
@@ -492,9 +512,9 @@ class Client {
|
|
|
492
512
|
}
|
|
493
513
|
resetPendingDeltaToOps(resetOp, segmentGroup) {
|
|
494
514
|
var _a, _b;
|
|
495
|
-
common_utils_1.assert(!!segmentGroup, 0x033 /* "Segment group undefined" */);
|
|
515
|
+
(0, common_utils_1.assert)(!!segmentGroup, 0x033 /* "Segment group undefined" */);
|
|
496
516
|
const NACKedSegmentGroup = (_a = this.mergeTree.pendingSegments) === null || _a === void 0 ? void 0 : _a.dequeue();
|
|
497
|
-
common_utils_1.assert(segmentGroup === NACKedSegmentGroup, 0x034 /* "Segment group not at head of merge tree pending queue" */);
|
|
517
|
+
(0, common_utils_1.assert)(segmentGroup === NACKedSegmentGroup, 0x034 /* "Segment group not at head of merge tree pending queue" */);
|
|
498
518
|
const opList = [];
|
|
499
519
|
// We need to sort the segments by ordinal, as the segments are not sorted in the segment group.
|
|
500
520
|
// The reason they need them sorted, as they have the same local sequence number and which means
|
|
@@ -503,26 +523,26 @@ class Client {
|
|
|
503
523
|
// so their recalculated positions will be correct.
|
|
504
524
|
for (const segment of segmentGroup.segments.sort((a, b) => a.ordinal < b.ordinal ? -1 : 1)) {
|
|
505
525
|
const segmentSegGroup = segment.segmentGroups.dequeue();
|
|
506
|
-
common_utils_1.assert(segmentGroup === segmentSegGroup, 0x035 /* "Segment group not at head of segment pending queue" */);
|
|
526
|
+
(0, common_utils_1.assert)(segmentGroup === segmentSegGroup, 0x035 /* "Segment group not at head of segment pending queue" */);
|
|
507
527
|
const segmentPosition = this.findReconnectionPosition(segment, segmentGroup.localSeq);
|
|
508
528
|
let newOp;
|
|
509
529
|
switch (resetOp.type) {
|
|
510
530
|
case 2 /* ANNOTATE */:
|
|
511
|
-
common_utils_1.assert(((_b = segment.propertyManager) === null || _b === void 0 ? void 0 : _b.hasPendingProperties()) === true, 0x036 /* "Segment has no pending properties" */);
|
|
531
|
+
(0, common_utils_1.assert)(((_b = segment.propertyManager) === null || _b === void 0 ? void 0 : _b.hasPendingProperties()) === true, 0x036 /* "Segment has no pending properties" */);
|
|
512
532
|
// if the segment has been removed, there's no need to send the annotate op
|
|
513
533
|
// unless the remove was local, in which case the annotate must have come
|
|
514
534
|
// before the remove
|
|
515
535
|
if (segment.removedSeq === undefined || segment.localRemovedSeq !== undefined) {
|
|
516
|
-
newOp = opBuilder_1.createAnnotateRangeOp(segmentPosition, segmentPosition + segment.cachedLength, resetOp.props, resetOp.combiningOp);
|
|
536
|
+
newOp = (0, opBuilder_1.createAnnotateRangeOp)(segmentPosition, segmentPosition + segment.cachedLength, resetOp.props, resetOp.combiningOp);
|
|
517
537
|
}
|
|
518
538
|
break;
|
|
519
539
|
case 0 /* INSERT */:
|
|
520
|
-
common_utils_1.assert(segment.seq === constants_1.UnassignedSequenceNumber, 0x037 /* "Segment already has assigned sequence number" */);
|
|
521
|
-
newOp = opBuilder_1.createInsertSegmentOp(segmentPosition, segment);
|
|
540
|
+
(0, common_utils_1.assert)(segment.seq === constants_1.UnassignedSequenceNumber, 0x037 /* "Segment already has assigned sequence number" */);
|
|
541
|
+
newOp = (0, opBuilder_1.createInsertSegmentOp)(segmentPosition, segment);
|
|
522
542
|
break;
|
|
523
543
|
case 1 /* REMOVE */:
|
|
524
544
|
if (segment.localRemovedSeq !== undefined) {
|
|
525
|
-
newOp = opBuilder_1.createRemoveRangeOp(segmentPosition, segmentPosition + segment.cachedLength);
|
|
545
|
+
newOp = (0, opBuilder_1.createRemoveRangeOp)(segmentPosition, segmentPosition + segment.cachedLength);
|
|
526
546
|
}
|
|
527
547
|
break;
|
|
528
548
|
default:
|
|
@@ -566,21 +586,27 @@ class Client {
|
|
|
566
586
|
}
|
|
567
587
|
}
|
|
568
588
|
applyStashedOp(op) {
|
|
589
|
+
let metadata;
|
|
569
590
|
switch (op.type) {
|
|
570
591
|
case 0 /* INSERT */:
|
|
571
592
|
this.applyInsertOp({ op });
|
|
572
|
-
|
|
593
|
+
metadata = this.peekPendingSegmentGroups();
|
|
594
|
+
break;
|
|
573
595
|
case 1 /* REMOVE */:
|
|
574
596
|
this.applyRemoveRangeOp({ op });
|
|
575
|
-
|
|
597
|
+
metadata = this.peekPendingSegmentGroups();
|
|
598
|
+
break;
|
|
576
599
|
case 2 /* ANNOTATE */:
|
|
577
600
|
this.applyAnnotateRangeOp({ op });
|
|
578
|
-
|
|
601
|
+
metadata = this.peekPendingSegmentGroups();
|
|
602
|
+
break;
|
|
579
603
|
case 3 /* GROUP */:
|
|
580
604
|
return op.ops.map((o) => this.applyStashedOp(o));
|
|
581
605
|
default:
|
|
582
|
-
common_utils_1.unreachableCase(op, "unrecognized op type");
|
|
606
|
+
(0, common_utils_1.unreachableCase)(op, "unrecognized op type");
|
|
583
607
|
}
|
|
608
|
+
(0, common_utils_1.assert)(!!metadata, 0x2db /* "Applying op must generate a pending segment" */);
|
|
609
|
+
return metadata;
|
|
584
610
|
}
|
|
585
611
|
applyMsg(msg, local = false) {
|
|
586
612
|
var _a;
|
|
@@ -604,9 +630,9 @@ class Client {
|
|
|
604
630
|
updateSeqNumbers(min, seq) {
|
|
605
631
|
const collabWindow = this.mergeTree.getCollabWindow();
|
|
606
632
|
// Equal is fine here due to SharedSegmentSequence<>.snapshotContent() potentially updating with same #
|
|
607
|
-
common_utils_1.assert(collabWindow.currentSeq <= seq, 0x038 /* "Incoming op sequence# < local collabWindow's currentSequence#" */);
|
|
633
|
+
(0, common_utils_1.assert)(collabWindow.currentSeq <= seq, 0x038 /* "Incoming op sequence# < local collabWindow's currentSequence#" */);
|
|
608
634
|
collabWindow.currentSeq = seq;
|
|
609
|
-
common_utils_1.assert(min <= seq, 0x039 /* "Incoming op sequence# < minSequence#" */);
|
|
635
|
+
(0, common_utils_1.assert)(min <= seq, 0x039 /* "Incoming op sequence# < minSequence#" */);
|
|
610
636
|
this.updateMinSeq(min);
|
|
611
637
|
}
|
|
612
638
|
/**
|
|
@@ -631,7 +657,7 @@ class Client {
|
|
|
631
657
|
const opList = [];
|
|
632
658
|
if (resetOp.type === 3 /* GROUP */) {
|
|
633
659
|
if (Array.isArray(segmentGroup)) {
|
|
634
|
-
common_utils_1.assert(resetOp.ops.length === segmentGroup.length, 0x03a /* "Number of ops in 'resetOp' must match the number of segment groups provided." */);
|
|
660
|
+
(0, common_utils_1.assert)(resetOp.ops.length === segmentGroup.length, 0x03a /* "Number of ops in 'resetOp' must match the number of segment groups provided." */);
|
|
635
661
|
for (let i = 0; i < resetOp.ops.length; i++) {
|
|
636
662
|
opList.push(...this.resetPendingDeltaToOps(resetOp.ops[i], segmentGroup[i]));
|
|
637
663
|
}
|
|
@@ -639,16 +665,16 @@ class Client {
|
|
|
639
665
|
else {
|
|
640
666
|
// A group op containing a single op will pass a direct reference to 'segmentGroup'
|
|
641
667
|
// rather than an array of segment groups. (See 'peekPendingSegmentGroups()')
|
|
642
|
-
common_utils_1.assert(resetOp.ops.length === 1, 0x03b /* "Number of ops in 'resetOp' must match the number of segment groups provided." */);
|
|
668
|
+
(0, common_utils_1.assert)(resetOp.ops.length === 1, 0x03b /* "Number of ops in 'resetOp' must match the number of segment groups provided." */);
|
|
643
669
|
opList.push(...this.resetPendingDeltaToOps(resetOp.ops[0], segmentGroup));
|
|
644
670
|
}
|
|
645
671
|
}
|
|
646
672
|
else {
|
|
647
|
-
common_utils_1.assert(resetOp.type !== 3 /* GROUP */, 0x03c /* "Reset op has 'group' delta type!" */);
|
|
648
|
-
common_utils_1.assert(!Array.isArray(segmentGroup), 0x03d /* "segmentGroup is array rather than singleton!" */);
|
|
673
|
+
(0, common_utils_1.assert)(resetOp.type !== 3 /* GROUP */, 0x03c /* "Reset op has 'group' delta type!" */);
|
|
674
|
+
(0, common_utils_1.assert)(!Array.isArray(segmentGroup), 0x03d /* "segmentGroup is array rather than singleton!" */);
|
|
649
675
|
opList.push(...this.resetPendingDeltaToOps(resetOp, segmentGroup));
|
|
650
676
|
}
|
|
651
|
-
return opList.length === 1 ? opList[0] : opBuilder_1.createGroupOp(...opList);
|
|
677
|
+
return opList.length === 1 ? opList[0] : (0, opBuilder_1.createGroupOp)(...opList);
|
|
652
678
|
}
|
|
653
679
|
createTextHelper() {
|
|
654
680
|
return new textSegment_1.MergeTreeTextHelper(this.mergeTree);
|
|
@@ -663,11 +689,11 @@ class Client {
|
|
|
663
689
|
this.updateSeqNumbers(minSeq, deltaManager.lastSequenceNumber);
|
|
664
690
|
// One of the summaries (from SPO) I observed to have chunk.chunkSequenceNumber > minSeq!
|
|
665
691
|
// Not sure why - need to catch it sooner
|
|
666
|
-
common_utils_1.assert(this.getCollabWindow().minSeq === minSeq, 0x03e /* "minSeq mismatch between collab window and delta manager!" */);
|
|
692
|
+
(0, common_utils_1.assert)(this.getCollabWindow().minSeq === minSeq, 0x03e /* "minSeq mismatch between collab window and delta manager!" */);
|
|
667
693
|
// Must continue to support legacy
|
|
668
694
|
// (See https://github.com/microsoft/FluidFramework/issues/84)
|
|
669
695
|
if (((_a = this.mergeTree.options) === null || _a === void 0 ? void 0 : _a.newMergeTreeSnapshotFormat) === true) {
|
|
670
|
-
common_utils_1.assert(catchUpMsgs === undefined || catchUpMsgs.length === 0, 0x03f /* "New format should not emit catchup ops" */);
|
|
696
|
+
(0, common_utils_1.assert)(catchUpMsgs === undefined || catchUpMsgs.length === 0, 0x03f /* "New format should not emit catchup ops" */);
|
|
671
697
|
const snap = new snapshotV1_1.SnapshotV1(this.mergeTree, this.logger, (id) => this.getLongClientId(id));
|
|
672
698
|
snap.extractSync();
|
|
673
699
|
return snap.emit(serializer, handle);
|
|
@@ -742,7 +768,7 @@ class Client {
|
|
|
742
768
|
let clientId;
|
|
743
769
|
if (op) {
|
|
744
770
|
clientId = this.getOrAddShortClientId(op.clientId);
|
|
745
|
-
seq = op.
|
|
771
|
+
seq = op.referenceSequenceNumber;
|
|
746
772
|
}
|
|
747
773
|
else {
|
|
748
774
|
const segWindow = this.mergeTree.getCollabWindow();
|