@fluidframework/sequence 2.33.0-333010 → 2.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/api-report/sequence.legacy.alpha.api.md +39 -39
- package/dist/intervalCollection.d.ts +7 -4
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +78 -31
- package/dist/intervalCollection.js.map +1 -1
- package/dist/intervalCollectionMap.d.ts +1 -0
- package/dist/intervalCollectionMap.d.ts.map +1 -1
- package/dist/intervalCollectionMap.js +9 -0
- package/dist/intervalCollectionMap.js.map +1 -1
- package/dist/intervalCollectionMapInterfaces.d.ts +1 -0
- package/dist/intervalCollectionMapInterfaces.d.ts.map +1 -1
- package/dist/intervalCollectionMapInterfaces.js.map +1 -1
- package/dist/intervalIndex/intervalIndex.d.ts +1 -1
- package/dist/intervalIndex/intervalIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/dist/intervals/sequenceInterval.d.ts +3 -3
- package/dist/intervals/sequenceInterval.d.ts.map +1 -1
- package/dist/intervals/sequenceInterval.js +10 -9
- package/dist/intervals/sequenceInterval.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/sequence.d.ts +4 -0
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +10 -0
- package/dist/sequence.js.map +1 -1
- package/dist/sharedIntervalCollection.d.ts +1 -1
- package/dist/sharedIntervalCollection.js.map +1 -1
- package/dist/sharedString.d.ts +0 -4
- package/dist/sharedString.d.ts.map +1 -1
- package/dist/sharedString.js +0 -11
- package/dist/sharedString.js.map +1 -1
- package/lib/intervalCollection.d.ts +7 -4
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +78 -31
- package/lib/intervalCollection.js.map +1 -1
- package/lib/intervalCollectionMap.d.ts +1 -0
- package/lib/intervalCollectionMap.d.ts.map +1 -1
- package/lib/intervalCollectionMap.js +9 -0
- package/lib/intervalCollectionMap.js.map +1 -1
- package/lib/intervalCollectionMapInterfaces.d.ts +1 -0
- package/lib/intervalCollectionMapInterfaces.d.ts.map +1 -1
- package/lib/intervalCollectionMapInterfaces.js.map +1 -1
- package/lib/intervalIndex/intervalIndex.d.ts +1 -1
- package/lib/intervalIndex/intervalIndex.js.map +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/lib/intervals/sequenceInterval.d.ts +3 -3
- package/lib/intervals/sequenceInterval.d.ts.map +1 -1
- package/lib/intervals/sequenceInterval.js +10 -9
- package/lib/intervals/sequenceInterval.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/sequence.d.ts +4 -0
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +10 -0
- package/lib/sequence.js.map +1 -1
- package/lib/sharedIntervalCollection.d.ts +1 -1
- package/lib/sharedIntervalCollection.js.map +1 -1
- package/lib/sharedString.d.ts +0 -4
- package/lib/sharedString.d.ts.map +1 -1
- package/lib/sharedString.js +0 -11
- package/lib/sharedString.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +18 -20
- package/src/intervalCollection.ts +112 -42
- package/src/intervalCollectionMap.ts +13 -0
- package/src/intervalCollectionMapInterfaces.ts +1 -0
- package/src/intervalIndex/intervalIndex.ts +1 -1
- package/src/intervalIndex/overlappingIntervalsIndex.ts +1 -1
- package/src/intervals/sequenceInterval.ts +14 -2
- package/src/packageVersion.ts +1 -1
- package/src/sequence.ts +15 -0
- package/src/sharedIntervalCollection.ts +1 -1
- package/src/sharedString.ts +0 -11
|
@@ -215,6 +215,7 @@ export class LocalIntervalCollection {
|
|
|
215
215
|
end: SequencePlace,
|
|
216
216
|
props?: PropertySet,
|
|
217
217
|
op?: ISequencedDocumentMessage,
|
|
218
|
+
rollback?: boolean,
|
|
218
219
|
) {
|
|
219
220
|
// This check is intended to prevent scenarios where a random interval is created and then
|
|
220
221
|
// inserted into a collection. The aim is to ensure that the collection is created first
|
|
@@ -238,6 +239,7 @@ export class LocalIntervalCollection {
|
|
|
238
239
|
undefined,
|
|
239
240
|
this.options.mergeTreeReferencesCanSlideToEndpoint,
|
|
240
241
|
props,
|
|
242
|
+
rollback,
|
|
241
243
|
);
|
|
242
244
|
|
|
243
245
|
this.add(interval);
|
|
@@ -391,7 +393,7 @@ class IntervalCollectionIterator implements Iterator<SequenceIntervalClass> {
|
|
|
391
393
|
* Change events emitted by `IntervalCollection`s
|
|
392
394
|
* @legacy
|
|
393
395
|
* @alpha
|
|
394
|
-
* @
|
|
396
|
+
* @deprecated The generic version of this interface is no longer used and will be removed. Use {@link ISequenceIntervalCollectionEvents} instead.
|
|
395
397
|
*/
|
|
396
398
|
export interface IIntervalCollectionEvent<TInterval extends ISerializableInterval>
|
|
397
399
|
extends IEvent {
|
|
@@ -1075,6 +1077,59 @@ export class IntervalCollection
|
|
|
1075
1077
|
return true;
|
|
1076
1078
|
}
|
|
1077
1079
|
|
|
1080
|
+
public rollback(
|
|
1081
|
+
op: IIntervalCollectionTypeOperationValue,
|
|
1082
|
+
localOpMetadata: IMapMessageLocalMetadata,
|
|
1083
|
+
) {
|
|
1084
|
+
const { opName, value } = op;
|
|
1085
|
+
const { id, properties } = getSerializedProperties(value);
|
|
1086
|
+
const { localSeq, previous } = localOpMetadata;
|
|
1087
|
+
switch (opName) {
|
|
1088
|
+
case "add": {
|
|
1089
|
+
const interval = this.getIntervalById(id);
|
|
1090
|
+
if (interval) {
|
|
1091
|
+
this.deleteExistingInterval({ interval, local: true, rollback: true });
|
|
1092
|
+
}
|
|
1093
|
+
break;
|
|
1094
|
+
}
|
|
1095
|
+
case "change": {
|
|
1096
|
+
assert(previous !== undefined, 0xb7c /* must have previous for change */);
|
|
1097
|
+
|
|
1098
|
+
const endpointsChanged = value.start !== undefined && value.end !== undefined;
|
|
1099
|
+
const start = endpointsChanged
|
|
1100
|
+
? toOptionalSequencePlace(previous.start, previous.startSide)
|
|
1101
|
+
: undefined;
|
|
1102
|
+
const end = endpointsChanged
|
|
1103
|
+
? toOptionalSequencePlace(previous.end, previous.endSide)
|
|
1104
|
+
: undefined;
|
|
1105
|
+
this.change(id, {
|
|
1106
|
+
start,
|
|
1107
|
+
end,
|
|
1108
|
+
props: Object.keys(properties).length > 0 ? properties : undefined,
|
|
1109
|
+
rollback: true,
|
|
1110
|
+
});
|
|
1111
|
+
this.localSeqToSerializedInterval.delete(localSeq);
|
|
1112
|
+
if (endpointsChanged) {
|
|
1113
|
+
this.removePendingChange(value);
|
|
1114
|
+
}
|
|
1115
|
+
break;
|
|
1116
|
+
}
|
|
1117
|
+
case "delete": {
|
|
1118
|
+
assert(previous !== undefined, 0xb7d /* must have previous for delete */);
|
|
1119
|
+
this.add({
|
|
1120
|
+
id,
|
|
1121
|
+
start: toSequencePlace(previous.start, previous.startSide),
|
|
1122
|
+
end: toSequencePlace(previous.end, previous.endSide),
|
|
1123
|
+
props: Object.keys(properties).length > 0 ? properties : undefined,
|
|
1124
|
+
rollback: true,
|
|
1125
|
+
});
|
|
1126
|
+
break;
|
|
1127
|
+
}
|
|
1128
|
+
default:
|
|
1129
|
+
unreachableCase(opName);
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1078
1133
|
public process(
|
|
1079
1134
|
op: IIntervalCollectionTypeOperationValue,
|
|
1080
1135
|
local: boolean,
|
|
@@ -1339,11 +1394,13 @@ export class IntervalCollection
|
|
|
1339
1394
|
start,
|
|
1340
1395
|
end,
|
|
1341
1396
|
props,
|
|
1397
|
+
rollback,
|
|
1342
1398
|
}: {
|
|
1343
1399
|
id?: string;
|
|
1344
1400
|
start: SequencePlace;
|
|
1345
1401
|
end: SequencePlace;
|
|
1346
1402
|
props?: PropertySet;
|
|
1403
|
+
rollback?: boolean;
|
|
1347
1404
|
}): SequenceIntervalClass {
|
|
1348
1405
|
if (!this.localCollection) {
|
|
1349
1406
|
throw new LoggingError("attach must be called prior to adding intervals");
|
|
@@ -1366,6 +1423,8 @@ export class IntervalCollection
|
|
|
1366
1423
|
toSequencePlace(startPos, startSide),
|
|
1367
1424
|
toSequencePlace(endPos, endSide),
|
|
1368
1425
|
props,
|
|
1426
|
+
undefined,
|
|
1427
|
+
rollback,
|
|
1369
1428
|
);
|
|
1370
1429
|
|
|
1371
1430
|
if (interval) {
|
|
@@ -1375,19 +1434,19 @@ export class IntervalCollection
|
|
|
1375
1434
|
}
|
|
1376
1435
|
const serializedInterval: ISerializedInterval = interval.serialize();
|
|
1377
1436
|
const localSeq = this.getNextLocalSeq();
|
|
1378
|
-
if (this.isCollaborating) {
|
|
1437
|
+
if (this.isCollaborating && rollback !== true) {
|
|
1379
1438
|
this.localSeqToSerializedInterval.set(localSeq, serializedInterval);
|
|
1380
|
-
}
|
|
1381
1439
|
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1440
|
+
this.submitDelta(
|
|
1441
|
+
{
|
|
1442
|
+
opName: "add",
|
|
1443
|
+
value: serializedInterval,
|
|
1444
|
+
},
|
|
1445
|
+
{
|
|
1446
|
+
localSeq,
|
|
1447
|
+
},
|
|
1448
|
+
);
|
|
1449
|
+
}
|
|
1391
1450
|
}
|
|
1392
1451
|
|
|
1393
1452
|
this.emit("addInterval", interval, true, undefined);
|
|
@@ -1395,11 +1454,17 @@ export class IntervalCollection
|
|
|
1395
1454
|
return interval;
|
|
1396
1455
|
}
|
|
1397
1456
|
|
|
1398
|
-
private deleteExistingInterval(
|
|
1399
|
-
interval
|
|
1400
|
-
local
|
|
1401
|
-
op
|
|
1402
|
-
|
|
1457
|
+
private deleteExistingInterval({
|
|
1458
|
+
interval,
|
|
1459
|
+
local,
|
|
1460
|
+
op,
|
|
1461
|
+
rollback,
|
|
1462
|
+
}: {
|
|
1463
|
+
interval: SequenceIntervalClass;
|
|
1464
|
+
local: boolean;
|
|
1465
|
+
op?: ISequencedDocumentMessage;
|
|
1466
|
+
rollback?: boolean;
|
|
1467
|
+
}) {
|
|
1403
1468
|
if (!this.localCollection) {
|
|
1404
1469
|
throw new LoggingError("Attach must be called before accessing intervals");
|
|
1405
1470
|
}
|
|
@@ -1408,7 +1473,7 @@ export class IntervalCollection
|
|
|
1408
1473
|
|
|
1409
1474
|
if (interval) {
|
|
1410
1475
|
// Local ops get submitted to the server. Remote ops have the deserializer run.
|
|
1411
|
-
if (local) {
|
|
1476
|
+
if (local && rollback !== true) {
|
|
1412
1477
|
this.submitDelta(
|
|
1413
1478
|
{
|
|
1414
1479
|
opName: "delete",
|
|
@@ -1416,6 +1481,7 @@ export class IntervalCollection
|
|
|
1416
1481
|
},
|
|
1417
1482
|
{
|
|
1418
1483
|
localSeq: this.getNextLocalSeq(),
|
|
1484
|
+
previous: interval.serialize(),
|
|
1419
1485
|
},
|
|
1420
1486
|
);
|
|
1421
1487
|
} else {
|
|
@@ -1437,7 +1503,7 @@ export class IntervalCollection
|
|
|
1437
1503
|
}
|
|
1438
1504
|
const interval = this.localCollection.idIntervalIndex.getIntervalById(id);
|
|
1439
1505
|
if (interval) {
|
|
1440
|
-
this.deleteExistingInterval(interval, true
|
|
1506
|
+
this.deleteExistingInterval({ interval, local: true });
|
|
1441
1507
|
}
|
|
1442
1508
|
return interval;
|
|
1443
1509
|
}
|
|
@@ -1446,7 +1512,12 @@ export class IntervalCollection
|
|
|
1446
1512
|
*/
|
|
1447
1513
|
public change(
|
|
1448
1514
|
id: string,
|
|
1449
|
-
{
|
|
1515
|
+
{
|
|
1516
|
+
start,
|
|
1517
|
+
end,
|
|
1518
|
+
props,
|
|
1519
|
+
rollback,
|
|
1520
|
+
}: { start?: SequencePlace; end?: SequencePlace; props?: PropertySet; rollback?: boolean },
|
|
1450
1521
|
): SequenceIntervalClass | undefined {
|
|
1451
1522
|
if (!this.localCollection) {
|
|
1452
1523
|
throw new LoggingError("Attach must be called before accessing intervals");
|
|
@@ -1477,7 +1548,7 @@ export class IntervalCollection
|
|
|
1477
1548
|
let deltaProps: PropertySet | undefined;
|
|
1478
1549
|
let newInterval: SequenceIntervalClass | undefined;
|
|
1479
1550
|
if (props !== undefined) {
|
|
1480
|
-
deltaProps = interval.changeProperties(props);
|
|
1551
|
+
deltaProps = interval.changeProperties(props, undefined, rollback);
|
|
1481
1552
|
}
|
|
1482
1553
|
const changeEndpoints = start !== undefined && end !== undefined;
|
|
1483
1554
|
if (changeEndpoints) {
|
|
@@ -1487,28 +1558,28 @@ export class IntervalCollection
|
|
|
1487
1558
|
setSlideOnRemove(newInterval.end);
|
|
1488
1559
|
}
|
|
1489
1560
|
}
|
|
1490
|
-
// Emit a property bag containing the ID and the other (if any) properties changed
|
|
1491
|
-
const serializedInterval: SerializedIntervalDelta = (
|
|
1492
|
-
newInterval ?? interval
|
|
1493
|
-
).serializeDelta({
|
|
1494
|
-
props,
|
|
1495
|
-
includeEndpoints: changeEndpoints,
|
|
1496
|
-
});
|
|
1497
1561
|
|
|
1498
|
-
|
|
1499
|
-
|
|
1562
|
+
if (this.isCollaborating && rollback !== true) {
|
|
1563
|
+
// Emit a property bag containing the ID and the other (if any) properties changed
|
|
1564
|
+
const serializedInterval: SerializedIntervalDelta = (
|
|
1565
|
+
newInterval ?? interval
|
|
1566
|
+
).serializeDelta({ props, includeEndpoints: changeEndpoints });
|
|
1567
|
+
const localSeq = this.getNextLocalSeq();
|
|
1568
|
+
|
|
1500
1569
|
this.localSeqToSerializedInterval.set(localSeq, serializedInterval);
|
|
1501
|
-
|
|
1570
|
+
this.addPendingChange(id, serializedInterval);
|
|
1502
1571
|
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1572
|
+
this.submitDelta(
|
|
1573
|
+
{
|
|
1574
|
+
opName: "change",
|
|
1575
|
+
value: serializedInterval,
|
|
1576
|
+
},
|
|
1577
|
+
{
|
|
1578
|
+
localSeq,
|
|
1579
|
+
previous: interval.serialize(),
|
|
1580
|
+
},
|
|
1581
|
+
);
|
|
1582
|
+
}
|
|
1512
1583
|
if (deltaProps !== undefined) {
|
|
1513
1584
|
this.emit("propertyChanged", interval, deltaProps, true, undefined);
|
|
1514
1585
|
this.emit(
|
|
@@ -1521,7 +1592,6 @@ export class IntervalCollection
|
|
|
1521
1592
|
);
|
|
1522
1593
|
}
|
|
1523
1594
|
if (newInterval) {
|
|
1524
|
-
this.addPendingChange(id, serializedInterval);
|
|
1525
1595
|
this.emitChange(newInterval, interval, true, false);
|
|
1526
1596
|
this.client?.removeLocalReferencePosition(interval.start);
|
|
1527
1597
|
this.client?.removeLocalReferencePosition(interval.end);
|
|
@@ -1955,7 +2025,7 @@ export class IntervalCollection
|
|
|
1955
2025
|
const { id } = getSerializedProperties(serializedInterval);
|
|
1956
2026
|
const interval = this.localCollection.idIntervalIndex.getIntervalById(id);
|
|
1957
2027
|
if (interval) {
|
|
1958
|
-
this.deleteExistingInterval(interval, local, op);
|
|
2028
|
+
this.deleteExistingInterval({ interval, local, op });
|
|
1959
2029
|
}
|
|
1960
2030
|
}
|
|
1961
2031
|
|
|
@@ -206,6 +206,19 @@ export class IntervalCollectionMap {
|
|
|
206
206
|
return false;
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
public tryRollback(content: any, localOpMetadata: unknown) {
|
|
210
|
+
if (isMapOperation(content)) {
|
|
211
|
+
const localValue = this.data.get(content.key);
|
|
212
|
+
|
|
213
|
+
assert(localValue !== undefined, 0xb7e /* Local value expected on rollback */);
|
|
214
|
+
|
|
215
|
+
localValue.rollback(content.value, localOpMetadata as IMapMessageLocalMetadata);
|
|
216
|
+
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
|
|
209
222
|
public tryApplyStashedOp(content: unknown): boolean {
|
|
210
223
|
if (isMapOperation(content)) {
|
|
211
224
|
const { value, key } = content;
|
|
@@ -16,7 +16,7 @@ import { ISerializableInterval, type SequenceInterval } from "../intervals/index
|
|
|
16
16
|
* @legacy
|
|
17
17
|
* @alpha
|
|
18
18
|
*
|
|
19
|
-
* @
|
|
19
|
+
* @deprecated The generic version of this interface is no longer used and will be removed. Use {@link SequenceIntervalIndex} instead.
|
|
20
20
|
*/
|
|
21
21
|
export interface IntervalIndex<TInterval extends ISerializableInterval> {
|
|
22
22
|
/**
|
|
@@ -26,7 +26,7 @@ import { IntervalIndex, type SequenceIntervalIndex } from "./intervalIndex.js";
|
|
|
26
26
|
* Use {@link ISequenceOverlappingIntervalsIndex} instead.
|
|
27
27
|
* @legacy
|
|
28
28
|
* @alpha
|
|
29
|
-
* @
|
|
29
|
+
* @deprecated The generic version of this interface is no longer used and will be removed. Use {@link ISequenceOverlappingIntervalsIndex} instead.
|
|
30
30
|
*/
|
|
31
31
|
export interface IOverlappingIntervalsIndex<TInterval extends ISerializableInterval>
|
|
32
32
|
extends IntervalIndex<TInterval> {
|
|
@@ -219,7 +219,11 @@ export class SequenceIntervalClass implements SequenceInterval {
|
|
|
219
219
|
return this.#props.properties;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
public changeProperties(
|
|
222
|
+
public changeProperties(
|
|
223
|
+
props: PropertySet | undefined,
|
|
224
|
+
op?: ISequencedDocumentMessage,
|
|
225
|
+
rollback?: boolean,
|
|
226
|
+
) {
|
|
223
227
|
if (props !== undefined) {
|
|
224
228
|
this.#props.propertyManager ??= new PropertiesManager();
|
|
225
229
|
return this.#props.propertyManager.handleProperties(
|
|
@@ -230,6 +234,7 @@ export class SequenceIntervalClass implements SequenceInterval {
|
|
|
230
234
|
: UniversalSequenceNumber,
|
|
231
235
|
op?.minimumSequenceNumber ?? UniversalSequenceNumber,
|
|
232
236
|
this.client.getCollabWindow().collaborating,
|
|
237
|
+
rollback,
|
|
233
238
|
);
|
|
234
239
|
}
|
|
235
240
|
}
|
|
@@ -573,6 +578,7 @@ export function createPositionReferenceFromSegoff(
|
|
|
573
578
|
fromSnapshot?: boolean,
|
|
574
579
|
slidingPreference?: SlidingPreference,
|
|
575
580
|
canSlideToEndpoint?: boolean,
|
|
581
|
+
rollback?: boolean,
|
|
576
582
|
): LocalReferencePosition {
|
|
577
583
|
if (segoff === "start" || segoff === "end") {
|
|
578
584
|
return client.createLocalReferencePosition(
|
|
@@ -606,7 +612,8 @@ export function createPositionReferenceFromSegoff(
|
|
|
606
612
|
!op &&
|
|
607
613
|
!localSeq &&
|
|
608
614
|
!fromSnapshot &&
|
|
609
|
-
!refTypeIncludesFlag(refType, ReferenceType.Transient)
|
|
615
|
+
!refTypeIncludesFlag(refType, ReferenceType.Transient) &&
|
|
616
|
+
!rollback
|
|
610
617
|
) {
|
|
611
618
|
throw new UsageError("Non-transient references need segment");
|
|
612
619
|
}
|
|
@@ -624,6 +631,7 @@ function createPositionReference(
|
|
|
624
631
|
slidingPreference?: SlidingPreference,
|
|
625
632
|
exclusive: boolean = false,
|
|
626
633
|
useNewSlidingBehavior: boolean = false,
|
|
634
|
+
rollback?: boolean,
|
|
627
635
|
): LocalReferencePosition {
|
|
628
636
|
let segoff;
|
|
629
637
|
|
|
@@ -661,6 +669,7 @@ function createPositionReference(
|
|
|
661
669
|
fromSnapshot,
|
|
662
670
|
slidingPreference,
|
|
663
671
|
exclusive,
|
|
672
|
+
rollback,
|
|
664
673
|
);
|
|
665
674
|
}
|
|
666
675
|
|
|
@@ -690,6 +699,7 @@ export function createSequenceInterval(
|
|
|
690
699
|
fromSnapshot?: boolean,
|
|
691
700
|
useNewSlidingBehavior: boolean = false,
|
|
692
701
|
props?: PropertySet,
|
|
702
|
+
rollback?: boolean,
|
|
693
703
|
): SequenceIntervalClass {
|
|
694
704
|
const { startPos, startSide, endPos, endSide } = endpointPosAndSide(
|
|
695
705
|
start ?? "start",
|
|
@@ -731,6 +741,7 @@ export function createSequenceInterval(
|
|
|
731
741
|
startReferenceSlidingPreference(stickiness),
|
|
732
742
|
startReferenceSlidingPreference(stickiness) === SlidingPreference.BACKWARD,
|
|
733
743
|
useNewSlidingBehavior,
|
|
744
|
+
rollback,
|
|
734
745
|
);
|
|
735
746
|
|
|
736
747
|
const endLref = createPositionReference(
|
|
@@ -743,6 +754,7 @@ export function createSequenceInterval(
|
|
|
743
754
|
endReferenceSlidingPreference(stickiness),
|
|
744
755
|
endReferenceSlidingPreference(stickiness) === SlidingPreference.FORWARD,
|
|
745
756
|
useNewSlidingBehavior,
|
|
757
|
+
rollback,
|
|
746
758
|
);
|
|
747
759
|
|
|
748
760
|
const rangeProp = {
|
package/src/packageVersion.ts
CHANGED
package/src/sequence.ts
CHANGED
|
@@ -796,6 +796,21 @@ export abstract class SharedSegmentSequence<T extends ISegment>
|
|
|
796
796
|
});
|
|
797
797
|
}
|
|
798
798
|
|
|
799
|
+
/**
|
|
800
|
+
* Revert an op
|
|
801
|
+
*/
|
|
802
|
+
protected rollback(content: any, localOpMetadata: unknown): void {
|
|
803
|
+
const originalRefSeq = this.inFlightRefSeqs.pop();
|
|
804
|
+
assert(
|
|
805
|
+
originalRefSeq !== undefined,
|
|
806
|
+
0xb7f /* Expected a recorded refSeq when rolling back an op */,
|
|
807
|
+
);
|
|
808
|
+
|
|
809
|
+
if (!this.intervalCollections.tryRollback(content, localOpMetadata)) {
|
|
810
|
+
this.client.rollback(content, localOpMetadata);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
|
|
799
814
|
/**
|
|
800
815
|
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
|
|
801
816
|
*/
|
|
@@ -10,7 +10,7 @@ import { ISerializableInterval } from "./intervals/index.js";
|
|
|
10
10
|
/**
|
|
11
11
|
* @legacy
|
|
12
12
|
* @alpha
|
|
13
|
-
* @
|
|
13
|
+
* @deprecated This interface is no longer used and will be removed.
|
|
14
14
|
*/
|
|
15
15
|
export interface ISharedIntervalCollection<TInterval extends ISerializableInterval> {
|
|
16
16
|
// eslint-disable-next-line import/no-deprecated
|
package/src/sharedString.ts
CHANGED
|
@@ -271,17 +271,6 @@ export class SharedStringClass
|
|
|
271
271
|
public getMarkerFromId(id: string): ISegment | undefined {
|
|
272
272
|
return this.client.getMarkerFromId(id);
|
|
273
273
|
}
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Revert an op
|
|
277
|
-
*/
|
|
278
|
-
protected rollback(content: any, localOpMetadata: unknown): void {
|
|
279
|
-
if (this.client.rollback !== undefined) {
|
|
280
|
-
this.client.rollback(content, localOpMetadata);
|
|
281
|
-
} else {
|
|
282
|
-
super.rollback(content, localOpMetadata);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
274
|
}
|
|
286
275
|
|
|
287
276
|
interface ITextAndMarkerAccumulator {
|