@fluidframework/sequence 2.0.0-dev.4.4.0.162253 → 2.0.0-dev.5.2.0.169897
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 +20 -0
- package/dist/defaultMap.d.ts +3 -2
- package/dist/defaultMap.d.ts.map +1 -1
- package/dist/defaultMap.js +4 -3
- package/dist/defaultMap.js.map +1 -1
- package/dist/defaultMapInterfaces.d.ts +12 -1
- package/dist/defaultMapInterfaces.d.ts.map +1 -1
- package/dist/defaultMapInterfaces.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/intervalCollection.d.ts +231 -59
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +288 -86
- package/dist/intervalCollection.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/revertibles.d.ts +104 -0
- package/dist/revertibles.d.ts.map +1 -0
- package/dist/revertibles.js +374 -0
- package/dist/revertibles.js.map +1 -0
- package/dist/sequence.d.ts +4 -4
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +3 -3
- package/dist/sequence.js.map +1 -1
- package/dist/sharedIntervalCollection.d.ts +3 -3
- package/dist/sharedIntervalCollection.d.ts.map +1 -1
- package/dist/sharedIntervalCollection.js +1 -1
- package/dist/sharedIntervalCollection.js.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/lib/defaultMap.d.ts +3 -2
- package/lib/defaultMap.d.ts.map +1 -1
- package/lib/defaultMap.js +4 -3
- package/lib/defaultMap.js.map +1 -1
- package/lib/defaultMapInterfaces.d.ts +12 -1
- package/lib/defaultMapInterfaces.d.ts.map +1 -1
- package/lib/defaultMapInterfaces.js.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/intervalCollection.d.ts +231 -59
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +286 -86
- package/lib/intervalCollection.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/revertibles.d.ts +104 -0
- package/lib/revertibles.d.ts.map +1 -0
- package/lib/revertibles.js +364 -0
- package/lib/revertibles.js.map +1 -0
- package/lib/sequence.d.ts +4 -4
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +3 -3
- package/lib/sequence.js.map +1 -1
- package/lib/sharedIntervalCollection.d.ts +3 -3
- package/lib/sharedIntervalCollection.d.ts.map +1 -1
- package/lib/sharedIntervalCollection.js +1 -1
- package/lib/sharedIntervalCollection.js.map +1 -1
- package/package.json +20 -22
- package/src/defaultMap.ts +4 -1
- package/src/defaultMapInterfaces.ts +13 -1
- package/src/index.ts +21 -5
- package/src/intervalCollection.ts +619 -73
- package/src/packageVersion.ts +1 -1
- package/src/revertibles.ts +572 -0
- package/src/sequence.ts +12 -2
- package/src/sharedIntervalCollection.ts +4 -2
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/sequence";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-dev.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-dev.5.2.0.169897";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/sequence";
|
|
11
|
-
exports.pkgVersion = "2.0.0-dev.
|
|
11
|
+
exports.pkgVersion = "2.0.0-dev.5.2.0.169897";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,0BAA0B,CAAC;AACrC,QAAA,UAAU,GAAG,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.0.0-dev.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,0BAA0B,CAAC;AACrC,QAAA,UAAU,GAAG,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.0.0-dev.5.2.0.169897\";\n"]}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { LocalReferencePosition, MergeTreeDeltaRevertible, PropertySet } from "@fluidframework/merge-tree";
|
|
6
|
+
import { IntervalOpType, SequenceInterval } from "./intervalCollection";
|
|
7
|
+
import { SharedString } from "./sharedString";
|
|
8
|
+
import { SequenceDeltaEvent } from "./sequenceDeltaEvent";
|
|
9
|
+
/**
|
|
10
|
+
* Data for undoing edits on SharedStrings and Intervals.
|
|
11
|
+
*
|
|
12
|
+
* Revertibles are new and require the option mergeTreeUseNewLengthCalculations to
|
|
13
|
+
* be set as true on the underlying merge tree in order to function correctly.
|
|
14
|
+
*
|
|
15
|
+
* @alpha
|
|
16
|
+
*/
|
|
17
|
+
export declare type SharedStringRevertible = MergeTreeDeltaRevertible | IntervalRevertible;
|
|
18
|
+
declare type IntervalOpType = typeof IntervalOpType[keyof typeof IntervalOpType];
|
|
19
|
+
/**
|
|
20
|
+
* Data for undoing edits affecting Intervals.
|
|
21
|
+
*
|
|
22
|
+
* Revertibles are new and require the option mergeTreeUseNewLengthCalculations to
|
|
23
|
+
* be set as true on the underlying merge tree in order to function correctly.
|
|
24
|
+
*
|
|
25
|
+
* @alpha
|
|
26
|
+
*/
|
|
27
|
+
export declare type IntervalRevertible = {
|
|
28
|
+
event: typeof IntervalOpType.CHANGE;
|
|
29
|
+
interval: SequenceInterval;
|
|
30
|
+
start: LocalReferencePosition;
|
|
31
|
+
end: LocalReferencePosition;
|
|
32
|
+
} | {
|
|
33
|
+
event: typeof IntervalOpType.ADD;
|
|
34
|
+
interval: SequenceInterval;
|
|
35
|
+
} | {
|
|
36
|
+
event: typeof IntervalOpType.DELETE;
|
|
37
|
+
interval: SequenceInterval;
|
|
38
|
+
start: LocalReferencePosition;
|
|
39
|
+
end: LocalReferencePosition;
|
|
40
|
+
} | {
|
|
41
|
+
event: typeof IntervalOpType.PROPERTY_CHANGED;
|
|
42
|
+
interval: SequenceInterval;
|
|
43
|
+
propertyDeltas: PropertySet;
|
|
44
|
+
} | {
|
|
45
|
+
event: typeof IntervalOpType.POSITION_REMOVE;
|
|
46
|
+
intervals: {
|
|
47
|
+
intervalId: string;
|
|
48
|
+
label: string;
|
|
49
|
+
startOffset?: number;
|
|
50
|
+
endOffset?: number;
|
|
51
|
+
}[];
|
|
52
|
+
revertibleRefs: {
|
|
53
|
+
revertible: IntervalRevertible;
|
|
54
|
+
offset: number;
|
|
55
|
+
isStart: boolean;
|
|
56
|
+
}[];
|
|
57
|
+
mergeTreeRevertible: MergeTreeDeltaRevertible;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Create revertibles for adding an interval
|
|
61
|
+
* @alpha
|
|
62
|
+
*/
|
|
63
|
+
export declare function appendAddIntervalToRevertibles(interval: SequenceInterval, revertibles: SharedStringRevertible[]): SharedStringRevertible[];
|
|
64
|
+
/**
|
|
65
|
+
* Create revertibles for deleting an interval
|
|
66
|
+
* @alpha
|
|
67
|
+
*/
|
|
68
|
+
export declare function appendDeleteIntervalToRevertibles(string: SharedString, interval: SequenceInterval, revertibles: SharedStringRevertible[]): SharedStringRevertible[];
|
|
69
|
+
/**
|
|
70
|
+
* Create revertibles for moving endpoints of an interval
|
|
71
|
+
* @alpha
|
|
72
|
+
*/
|
|
73
|
+
export declare function appendChangeIntervalToRevertibles(string: SharedString, newInterval: SequenceInterval, previousInterval: SequenceInterval, revertibles: SharedStringRevertible[]): SharedStringRevertible[];
|
|
74
|
+
/**
|
|
75
|
+
* Create revertibles for changing properties of an interval
|
|
76
|
+
* @alpha
|
|
77
|
+
*/
|
|
78
|
+
export declare function appendIntervalPropertyChangedToRevertibles(interval: SequenceInterval, deltas: PropertySet, revertibles: SharedStringRevertible[]): SharedStringRevertible[];
|
|
79
|
+
/**
|
|
80
|
+
* Create revertibles for SharedStringDeltas, handling indirectly modified intervals
|
|
81
|
+
* (e.g. reverting remove of a range that contains an interval will move the interval back)
|
|
82
|
+
*
|
|
83
|
+
* Revertibles are new and require the option mergeTreeUseNewLengthCalculations to
|
|
84
|
+
* be set as true on the underlying merge tree in order to function correctly.
|
|
85
|
+
*
|
|
86
|
+
* @alpha
|
|
87
|
+
*/
|
|
88
|
+
export declare function appendSharedStringDeltaToRevertibles(string: SharedString, delta: SequenceDeltaEvent, revertibles: SharedStringRevertible[]): void;
|
|
89
|
+
/**
|
|
90
|
+
* Clean up resources held by revertibles that are no longer needed.
|
|
91
|
+
* @alpha
|
|
92
|
+
*/
|
|
93
|
+
export declare function discardSharedStringRevertibles(sharedString: SharedString, revertibles: SharedStringRevertible[]): void;
|
|
94
|
+
/**
|
|
95
|
+
* Invoke revertibles to reverse prior edits
|
|
96
|
+
*
|
|
97
|
+
* Revertibles are new and require the option mergeTreeUseNewLengthCalculations to
|
|
98
|
+
* be set as true on the underlying merge tree in order to function correctly.
|
|
99
|
+
*
|
|
100
|
+
* @alpha
|
|
101
|
+
*/
|
|
102
|
+
export declare function revertSharedStringRevertibles(sharedString: SharedString, revertibles: SharedStringRevertible[]): void;
|
|
103
|
+
export {};
|
|
104
|
+
//# sourceMappingURL=revertibles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revertibles.d.ts","sourceRoot":"","sources":["../src/revertibles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAIN,sBAAsB,EAEtB,wBAAwB,EAExB,WAAW,EAKX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAuB,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAuB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/E;;;;;;;GAOG;AACH,oBAAY,sBAAsB,GAAG,wBAAwB,GAAG,kBAAkB,CAAC;AAInF,aAAK,cAAc,GAAG,OAAO,cAAc,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAEzE;;;;;;;GAOG;AACH,oBAAY,kBAAkB,GAC3B;IACA,KAAK,EAAE,OAAO,cAAc,CAAC,MAAM,CAAC;IACpC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,EAAE,sBAAsB,CAAC;IAC9B,GAAG,EAAE,sBAAsB,CAAC;CAC3B,GACD;IACA,KAAK,EAAE,OAAO,cAAc,CAAC,GAAG,CAAC;IACjC,QAAQ,EAAE,gBAAgB,CAAC;CAC1B,GACD;IACA,KA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AoC,CACnD,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,kBAAkB,EACzB,WAAW,EAAE,sBAAsB,EAAE,QAoFrC;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAC7C,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,sBAAsB,EAAE,QAUrC;AA4KD;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC5C,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,sBAAsB,EAAE,QA8BrC"}
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
/* eslint-disable no-bitwise */
|
|
7
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
8
|
+
var t = {};
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
12
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
13
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
14
|
+
t[p[i]] = s[p[i]];
|
|
15
|
+
}
|
|
16
|
+
return t;
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.revertSharedStringRevertibles = exports.discardSharedStringRevertibles = exports.appendSharedStringDeltaToRevertibles = exports.appendIntervalPropertyChangedToRevertibles = exports.appendChangeIntervalToRevertibles = exports.appendDeleteIntervalToRevertibles = exports.appendAddIntervalToRevertibles = void 0;
|
|
20
|
+
const common_utils_1 = require("@fluidframework/common-utils");
|
|
21
|
+
const merge_tree_1 = require("@fluidframework/merge-tree");
|
|
22
|
+
const intervalCollection_1 = require("./intervalCollection");
|
|
23
|
+
const idMap = new Map();
|
|
24
|
+
function getUpdatedIdFromInterval(interval) {
|
|
25
|
+
const maybeId = interval.getIntervalId();
|
|
26
|
+
return getUpdatedId(maybeId);
|
|
27
|
+
}
|
|
28
|
+
function getUpdatedId(intervalId) {
|
|
29
|
+
var _a;
|
|
30
|
+
return (_a = idMap.get(intervalId)) !== null && _a !== void 0 ? _a : intervalId;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create revertibles for adding an interval
|
|
34
|
+
* @alpha
|
|
35
|
+
*/
|
|
36
|
+
function appendAddIntervalToRevertibles(interval, revertibles) {
|
|
37
|
+
revertibles.push({
|
|
38
|
+
event: intervalCollection_1.IntervalOpType.ADD,
|
|
39
|
+
interval,
|
|
40
|
+
});
|
|
41
|
+
return revertibles;
|
|
42
|
+
}
|
|
43
|
+
exports.appendAddIntervalToRevertibles = appendAddIntervalToRevertibles;
|
|
44
|
+
/**
|
|
45
|
+
* Create revertibles for deleting an interval
|
|
46
|
+
* @alpha
|
|
47
|
+
*/
|
|
48
|
+
function appendDeleteIntervalToRevertibles(string, interval, revertibles) {
|
|
49
|
+
const startSeg = interval.start.getSegment();
|
|
50
|
+
const endSeg = interval.end.getSegment();
|
|
51
|
+
const startRef = string.createLocalReferencePosition(startSeg, interval.start.getOffset(), merge_tree_1.ReferenceType.StayOnRemove | merge_tree_1.ReferenceType.RangeBegin, undefined);
|
|
52
|
+
const endRef = string.createLocalReferencePosition(endSeg, interval.end.getOffset(), merge_tree_1.ReferenceType.StayOnRemove | merge_tree_1.ReferenceType.RangeEnd, undefined);
|
|
53
|
+
const revertible = {
|
|
54
|
+
event: intervalCollection_1.IntervalOpType.DELETE,
|
|
55
|
+
interval,
|
|
56
|
+
start: startRef,
|
|
57
|
+
end: endRef,
|
|
58
|
+
};
|
|
59
|
+
revertible.start.addProperties({ revertible });
|
|
60
|
+
revertible.end.addProperties({ revertible });
|
|
61
|
+
revertibles.push(revertible);
|
|
62
|
+
return revertibles;
|
|
63
|
+
}
|
|
64
|
+
exports.appendDeleteIntervalToRevertibles = appendDeleteIntervalToRevertibles;
|
|
65
|
+
/**
|
|
66
|
+
* Create revertibles for moving endpoints of an interval
|
|
67
|
+
* @alpha
|
|
68
|
+
*/
|
|
69
|
+
function appendChangeIntervalToRevertibles(string, newInterval, previousInterval, revertibles) {
|
|
70
|
+
const startSeg = previousInterval.start.getSegment();
|
|
71
|
+
const endSeg = previousInterval.end.getSegment();
|
|
72
|
+
const prevStartRef = string.createLocalReferencePosition(startSeg, previousInterval.start.getOffset(), merge_tree_1.ReferenceType.StayOnRemove | merge_tree_1.ReferenceType.RangeBegin, undefined);
|
|
73
|
+
const prevEndRef = string.createLocalReferencePosition(endSeg, previousInterval.end.getOffset(), merge_tree_1.ReferenceType.StayOnRemove | merge_tree_1.ReferenceType.RangeEnd, undefined);
|
|
74
|
+
const revertible = {
|
|
75
|
+
event: intervalCollection_1.IntervalOpType.CHANGE,
|
|
76
|
+
interval: newInterval,
|
|
77
|
+
start: prevStartRef,
|
|
78
|
+
end: prevEndRef,
|
|
79
|
+
};
|
|
80
|
+
revertible.start.addProperties({ revertible });
|
|
81
|
+
revertible.end.addProperties({ revertible });
|
|
82
|
+
revertibles.push(revertible);
|
|
83
|
+
return revertibles;
|
|
84
|
+
}
|
|
85
|
+
exports.appendChangeIntervalToRevertibles = appendChangeIntervalToRevertibles;
|
|
86
|
+
/**
|
|
87
|
+
* Create revertibles for changing properties of an interval
|
|
88
|
+
* @alpha
|
|
89
|
+
*/
|
|
90
|
+
function appendIntervalPropertyChangedToRevertibles(interval, deltas, revertibles) {
|
|
91
|
+
revertibles.push({
|
|
92
|
+
event: intervalCollection_1.IntervalOpType.PROPERTY_CHANGED,
|
|
93
|
+
interval,
|
|
94
|
+
propertyDeltas: deltas,
|
|
95
|
+
});
|
|
96
|
+
return revertibles;
|
|
97
|
+
}
|
|
98
|
+
exports.appendIntervalPropertyChangedToRevertibles = appendIntervalPropertyChangedToRevertibles;
|
|
99
|
+
function addIfIntervalEndpoint(ref, segmentLengths, startIntervals, endIntervals) {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
if ((0, merge_tree_1.refTypeIncludesFlag)(ref.refType, merge_tree_1.ReferenceType.RangeBegin)) {
|
|
102
|
+
const interval = (_a = ref.properties) === null || _a === void 0 ? void 0 : _a.interval;
|
|
103
|
+
if (interval && interval instanceof intervalCollection_1.SequenceInterval) {
|
|
104
|
+
startIntervals.push({ offset: segmentLengths + interval.start.getOffset(), interval });
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else if ((0, merge_tree_1.refTypeIncludesFlag)(ref.refType, merge_tree_1.ReferenceType.RangeEnd)) {
|
|
109
|
+
const interval = (_b = ref.properties) === null || _b === void 0 ? void 0 : _b.interval;
|
|
110
|
+
if (interval && interval instanceof intervalCollection_1.SequenceInterval) {
|
|
111
|
+
endIntervals.push({ offset: segmentLengths + interval.end.getOffset(), interval });
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
function addIfRevertibleRef(ref, segmentLengths, revertibleRefs) {
|
|
118
|
+
var _a;
|
|
119
|
+
const revertible = (_a = ref.properties) === null || _a === void 0 ? void 0 : _a.revertible;
|
|
120
|
+
if (revertible) {
|
|
121
|
+
revertibleRefs.push({
|
|
122
|
+
revertible,
|
|
123
|
+
offset: segmentLengths + ref.getOffset(),
|
|
124
|
+
isStart: (0, merge_tree_1.refTypeIncludesFlag)(ref.refType, merge_tree_1.ReferenceType.RangeBegin),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Create revertibles for SharedStringDeltas, handling indirectly modified intervals
|
|
130
|
+
* (e.g. reverting remove of a range that contains an interval will move the interval back)
|
|
131
|
+
*
|
|
132
|
+
* Revertibles are new and require the option mergeTreeUseNewLengthCalculations to
|
|
133
|
+
* be set as true on the underlying merge tree in order to function correctly.
|
|
134
|
+
*
|
|
135
|
+
* @alpha
|
|
136
|
+
*/
|
|
137
|
+
function appendSharedStringDeltaToRevertibles(string, delta, revertibles) {
|
|
138
|
+
if (delta.ranges.length === 0) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (delta.deltaOperation === merge_tree_1.MergeTreeDeltaType.REMOVE) {
|
|
142
|
+
const startIntervals = [];
|
|
143
|
+
const endIntervals = [];
|
|
144
|
+
const revertibleRefs = [];
|
|
145
|
+
let segmentLengths = 0;
|
|
146
|
+
// find interval endpoints in each segment
|
|
147
|
+
for (const deltaRange of delta.ranges) {
|
|
148
|
+
const refs = deltaRange.segment.localRefs;
|
|
149
|
+
if (refs !== undefined && deltaRange.position !== -1) {
|
|
150
|
+
for (const ref of refs) {
|
|
151
|
+
addIfIntervalEndpoint(ref, segmentLengths, startIntervals, endIntervals);
|
|
152
|
+
addIfRevertibleRef(ref, segmentLengths, revertibleRefs);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
segmentLengths += deltaRange.segment.cachedLength;
|
|
156
|
+
}
|
|
157
|
+
if (startIntervals.length > 0 || endIntervals.length > 0 || revertibleRefs.length > 0) {
|
|
158
|
+
const removeRevertibles = [];
|
|
159
|
+
(0, merge_tree_1.appendToMergeTreeDeltaRevertibles)(delta.deltaArgs, removeRevertibles);
|
|
160
|
+
(0, common_utils_1.assert)(removeRevertibles.length === 1, 0x6c4 /* Remove revertible should be a single delta */);
|
|
161
|
+
const revertible = {
|
|
162
|
+
event: intervalCollection_1.IntervalOpType.POSITION_REMOVE,
|
|
163
|
+
intervals: [],
|
|
164
|
+
revertibleRefs,
|
|
165
|
+
mergeTreeRevertible: removeRevertibles[0],
|
|
166
|
+
};
|
|
167
|
+
// add an interval for each startInterval, accounting for any corresponding endIntervals
|
|
168
|
+
startIntervals.forEach(({ interval, offset }) => {
|
|
169
|
+
// find any corresponding end for this interval
|
|
170
|
+
const endIntervalIndex = endIntervals.findIndex((end) => {
|
|
171
|
+
return end.interval === interval;
|
|
172
|
+
});
|
|
173
|
+
let endOffset;
|
|
174
|
+
if (endIntervalIndex !== -1) {
|
|
175
|
+
endOffset = endIntervals[endIntervalIndex].offset;
|
|
176
|
+
endIntervals.splice(endIntervalIndex, 1);
|
|
177
|
+
}
|
|
178
|
+
revertible.intervals.push({
|
|
179
|
+
intervalId: interval.getIntervalId(),
|
|
180
|
+
label: interval.properties.referenceRangeLabels[0],
|
|
181
|
+
startOffset: offset,
|
|
182
|
+
endOffset,
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
// add any remaining endIntervals that aren't matched with a startInterval
|
|
186
|
+
endIntervals.forEach(({ interval, offset }) => {
|
|
187
|
+
revertible.intervals.push({
|
|
188
|
+
intervalId: interval.getIntervalId(),
|
|
189
|
+
label: interval.properties.referenceRangeLabels[0],
|
|
190
|
+
endOffset: offset,
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
revertibles.push(revertible);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// Handle any merge tree delta that is not REMOVE or is REMOVE with no interval endpoints
|
|
198
|
+
const mergeTreeRevertibles = [];
|
|
199
|
+
// Allow merging MergeTreeDeltaRevertible with previous
|
|
200
|
+
if (revertibles.length > 0 && (0, merge_tree_1.isMergeTreeDeltaRevertible)(revertibles[revertibles.length - 1])) {
|
|
201
|
+
mergeTreeRevertibles.push(revertibles.pop());
|
|
202
|
+
}
|
|
203
|
+
(0, merge_tree_1.appendToMergeTreeDeltaRevertibles)(delta.deltaArgs, mergeTreeRevertibles);
|
|
204
|
+
revertibles.push(...mergeTreeRevertibles);
|
|
205
|
+
}
|
|
206
|
+
exports.appendSharedStringDeltaToRevertibles = appendSharedStringDeltaToRevertibles;
|
|
207
|
+
/**
|
|
208
|
+
* Clean up resources held by revertibles that are no longer needed.
|
|
209
|
+
* @alpha
|
|
210
|
+
*/
|
|
211
|
+
function discardSharedStringRevertibles(sharedString, revertibles) {
|
|
212
|
+
revertibles.forEach((r) => {
|
|
213
|
+
if ((0, merge_tree_1.isMergeTreeDeltaRevertible)(r)) {
|
|
214
|
+
(0, merge_tree_1.discardMergeTreeDeltaRevertible)([r]);
|
|
215
|
+
}
|
|
216
|
+
else if (r.event === intervalCollection_1.IntervalOpType.CHANGE || r.event === intervalCollection_1.IntervalOpType.DELETE) {
|
|
217
|
+
sharedString.removeLocalReferencePosition(r.start);
|
|
218
|
+
sharedString.removeLocalReferencePosition(r.end);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
exports.discardSharedStringRevertibles = discardSharedStringRevertibles;
|
|
223
|
+
// Uses of referenceRangeLabels will be removed once AB#4081 is completed.
|
|
224
|
+
function revertLocalAdd(string, revertible) {
|
|
225
|
+
const id = getUpdatedIdFromInterval(revertible.interval);
|
|
226
|
+
const label = revertible.interval.properties.referenceRangeLabels[0];
|
|
227
|
+
string.getIntervalCollection(label).removeIntervalById(id);
|
|
228
|
+
}
|
|
229
|
+
function revertLocalDelete(string, revertible) {
|
|
230
|
+
const label = revertible.interval.properties.referenceRangeLabels[0];
|
|
231
|
+
const start = string.localReferencePositionToPosition(revertible.start);
|
|
232
|
+
const end = string.localReferencePositionToPosition(revertible.end);
|
|
233
|
+
const type = revertible.interval.intervalType;
|
|
234
|
+
// reusing the id causes eventual consistency bugs, so it is removed here and recreated in add
|
|
235
|
+
const _a = revertible.interval.properties, { intervalId } = _a, props = __rest(_a, ["intervalId"]);
|
|
236
|
+
const int = string.getIntervalCollection(label).add(start, end, type, props);
|
|
237
|
+
idMap.forEach((newId, oldId) => {
|
|
238
|
+
if (intervalId === newId) {
|
|
239
|
+
idMap.set(oldId, getUpdatedIdFromInterval(int));
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
idMap.set(intervalId, int.getIntervalId());
|
|
243
|
+
string.removeLocalReferencePosition(revertible.start);
|
|
244
|
+
string.removeLocalReferencePosition(revertible.end);
|
|
245
|
+
}
|
|
246
|
+
function revertLocalChange(string, revertible) {
|
|
247
|
+
const label = revertible.interval.properties.referenceRangeLabels[0];
|
|
248
|
+
const id = getUpdatedIdFromInterval(revertible.interval);
|
|
249
|
+
const start = string.localReferencePositionToPosition(revertible.start);
|
|
250
|
+
const end = string.localReferencePositionToPosition(revertible.end);
|
|
251
|
+
string.getIntervalCollection(label).change(id, start, end);
|
|
252
|
+
string.removeLocalReferencePosition(revertible.start);
|
|
253
|
+
string.removeLocalReferencePosition(revertible.end);
|
|
254
|
+
}
|
|
255
|
+
function revertLocalPropertyChanged(string, revertible) {
|
|
256
|
+
const label = revertible.interval.properties.referenceRangeLabels[0];
|
|
257
|
+
const id = getUpdatedIdFromInterval(revertible.interval);
|
|
258
|
+
const newProps = revertible.propertyDeltas;
|
|
259
|
+
string.getIntervalCollection(label).changeProperties(id, newProps);
|
|
260
|
+
}
|
|
261
|
+
function newPosition(offset, restoredRanges) {
|
|
262
|
+
if (offset === undefined) {
|
|
263
|
+
return undefined;
|
|
264
|
+
}
|
|
265
|
+
let offsetFromSegment = offset;
|
|
266
|
+
for (const rangeInfo of restoredRanges.items) {
|
|
267
|
+
if (offsetFromSegment < rangeInfo.length) {
|
|
268
|
+
// find the segment inside the range
|
|
269
|
+
for (const range of rangeInfo.ranges) {
|
|
270
|
+
if (range.segment.cachedLength > offsetFromSegment) {
|
|
271
|
+
return { segment: range.segment, offset: offsetFromSegment };
|
|
272
|
+
}
|
|
273
|
+
offsetFromSegment -= range.segment.cachedLength;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
offsetFromSegment -= rangeInfo.length;
|
|
277
|
+
}
|
|
278
|
+
return undefined;
|
|
279
|
+
}
|
|
280
|
+
function newEndpointPosition(offset, restoredRanges, sharedString) {
|
|
281
|
+
const pos = newPosition(offset, restoredRanges);
|
|
282
|
+
return pos === undefined ? undefined : sharedString.getPosition(pos.segment) + pos.offset;
|
|
283
|
+
}
|
|
284
|
+
class SortedRangeSet extends merge_tree_1.SortedSet {
|
|
285
|
+
getKey(item) {
|
|
286
|
+
return item.ranges[0].segment.ordinal;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
function revertLocalSequenceRemove(sharedString, revertible) {
|
|
290
|
+
const restoredRanges = new SortedRangeSet();
|
|
291
|
+
const saveSegments = (event) => {
|
|
292
|
+
if (event.ranges.length > 0) {
|
|
293
|
+
let length = 0;
|
|
294
|
+
event.ranges.forEach((range) => {
|
|
295
|
+
length += range.segment.cachedLength;
|
|
296
|
+
});
|
|
297
|
+
restoredRanges.addOrUpdate({ ranges: event.ranges, length });
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
sharedString.on("sequenceDelta", saveSegments);
|
|
301
|
+
(0, merge_tree_1.revertMergeTreeDeltaRevertibles)(sharedString, [revertible.mergeTreeRevertible]);
|
|
302
|
+
sharedString.off("sequenceDelta", saveSegments);
|
|
303
|
+
revertible.intervals.forEach((intervalInfo) => {
|
|
304
|
+
const intervalCollection = sharedString.getIntervalCollection(intervalInfo.label);
|
|
305
|
+
const intervalId = getUpdatedId(intervalInfo.intervalId);
|
|
306
|
+
const interval = intervalCollection.getIntervalById(intervalId);
|
|
307
|
+
if (interval !== undefined) {
|
|
308
|
+
const newStart = newEndpointPosition(intervalInfo.startOffset, restoredRanges, sharedString);
|
|
309
|
+
const newEnd = newEndpointPosition(intervalInfo.endOffset, restoredRanges, sharedString);
|
|
310
|
+
if (newStart !== undefined || newEnd !== undefined) {
|
|
311
|
+
intervalCollection.change(intervalId, newStart, newEnd);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
// fix up the local references used by delete and change revertibles
|
|
316
|
+
revertible.revertibleRefs.forEach((revertibleRef) => {
|
|
317
|
+
(0, common_utils_1.assert)(revertibleRef.revertible.event === intervalCollection_1.IntervalOpType.CHANGE ||
|
|
318
|
+
revertibleRef.revertible.event === intervalCollection_1.IntervalOpType.DELETE, 0x6c5 /* revertible is not delete or change */);
|
|
319
|
+
const pos = newPosition(revertibleRef.offset, restoredRanges);
|
|
320
|
+
if (pos !== undefined) {
|
|
321
|
+
if (revertibleRef.isStart) {
|
|
322
|
+
sharedString.removeLocalReferencePosition(revertibleRef.revertible.start);
|
|
323
|
+
const newRef = sharedString.createLocalReferencePosition(pos.segment, pos.offset, merge_tree_1.ReferenceType.StayOnRemove | merge_tree_1.ReferenceType.RangeBegin, { revertible: revertibleRef.revertible });
|
|
324
|
+
revertibleRef.revertible.start = newRef;
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
sharedString.removeLocalReferencePosition(revertibleRef.revertible.end);
|
|
328
|
+
const newRef = sharedString.createLocalReferencePosition(pos.segment, pos.offset, merge_tree_1.ReferenceType.StayOnRemove | merge_tree_1.ReferenceType.RangeEnd, { revertible: revertibleRef.revertible });
|
|
329
|
+
revertibleRef.revertible.end = newRef;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Invoke revertibles to reverse prior edits
|
|
336
|
+
*
|
|
337
|
+
* Revertibles are new and require the option mergeTreeUseNewLengthCalculations to
|
|
338
|
+
* be set as true on the underlying merge tree in order to function correctly.
|
|
339
|
+
*
|
|
340
|
+
* @alpha
|
|
341
|
+
*/
|
|
342
|
+
function revertSharedStringRevertibles(sharedString, revertibles) {
|
|
343
|
+
while (revertibles.length > 0) {
|
|
344
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
345
|
+
const r = revertibles.pop();
|
|
346
|
+
if ("event" in r) {
|
|
347
|
+
const event = r.event;
|
|
348
|
+
switch (event) {
|
|
349
|
+
case intervalCollection_1.IntervalOpType.ADD:
|
|
350
|
+
revertLocalAdd(sharedString, r);
|
|
351
|
+
break;
|
|
352
|
+
case intervalCollection_1.IntervalOpType.DELETE:
|
|
353
|
+
revertLocalDelete(sharedString, r);
|
|
354
|
+
break;
|
|
355
|
+
case intervalCollection_1.IntervalOpType.CHANGE:
|
|
356
|
+
revertLocalChange(sharedString, r);
|
|
357
|
+
break;
|
|
358
|
+
case intervalCollection_1.IntervalOpType.PROPERTY_CHANGED:
|
|
359
|
+
revertLocalPropertyChanged(sharedString, r);
|
|
360
|
+
break;
|
|
361
|
+
case intervalCollection_1.IntervalOpType.POSITION_REMOVE:
|
|
362
|
+
revertLocalSequenceRemove(sharedString, r);
|
|
363
|
+
break;
|
|
364
|
+
default:
|
|
365
|
+
(0, common_utils_1.unreachableCase)(event);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
(0, merge_tree_1.revertMergeTreeDeltaRevertibles)(sharedString, [r]);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
exports.revertSharedStringRevertibles = revertSharedStringRevertibles;
|
|
374
|
+
//# sourceMappingURL=revertibles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revertibles.js","sourceRoot":"","sources":["../src/revertibles.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,+BAA+B;;;;;;;;;;;;;;AAE/B,+DAAuE;AACvE,2DAaoC;AACpC,6DAAwE;AAcxE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;AAqDxC,SAAS,wBAAwB,CAAC,QAA0B;IAC3D,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,EAAE,CAAC;IACzC,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,YAAY,CAAC,UAAkB;;IACvC,OAAO,MAAA,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,mCAAI,UAAU,CAAC;AAC5C,CAAC;AAED;;;GAGG;AACH,SAAgB,8BAA8B,CAC7C,QAA0B,EAC1B,WAAqC;IAErC,WAAW,CAAC,IAAI,CAAC;QAChB,KAAK,EAAE,mCAAc,CAAC,GAAG;QACzB,QAAQ;KACR,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;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gBACP;oBACC,IAAA,8BAAe,EAAC,KAAK,CAAC,CAAC;aACxB;SACD;aAAM;YACN,IAAA,4CAA+B,EAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;SACnD;KACD;AACF,CAAC;AAhCD,sEAgCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint-disable no-bitwise */\n\nimport { assert, unreachableCase } from \"@fluidframework/common-utils\";\nimport {\n\tappendToMergeTreeDeltaRevertibles,\n\tdiscardMergeTreeDeltaRevertible,\n\tisMergeTreeDeltaRevertible,\n\tLocalReferencePosition,\n\tMergeTreeDeltaOperationType,\n\tMergeTreeDeltaRevertible,\n\tMergeTreeDeltaType,\n\tPropertySet,\n\tReferenceType,\n\trefTypeIncludesFlag,\n\trevertMergeTreeDeltaRevertibles,\n\tSortedSet,\n} from \"@fluidframework/merge-tree\";\nimport { IntervalOpType, SequenceInterval } from \"./intervalCollection\";\nimport { SharedString, SharedStringSegment } from \"./sharedString\";\nimport { ISequenceDeltaRange, SequenceDeltaEvent } from \"./sequenceDeltaEvent\";\n\n/**\n * Data for undoing edits on SharedStrings and Intervals.\n *\n * Revertibles are new and require the option mergeTreeUseNewLengthCalculations to\n * be set as true on the underlying merge tree in order to function correctly.\n *\n * @alpha\n */\nexport type SharedStringRevertible = MergeTreeDeltaRevertible | IntervalRevertible;\n\nconst idMap = new Map<string, string>();\n\ntype IntervalOpType = typeof IntervalOpType[keyof typeof IntervalOpType];\n\n/**\n * Data for undoing edits affecting Intervals.\n *\n * Revertibles are new and require the option mergeTreeUseNewLengthCalculations to\n * be set as true on the underlying merge tree in order to function correctly.\n *\n * @alpha\n */\nexport type IntervalRevertible =\n\t| {\n\t\t\tevent: typeof IntervalOpType.CHANGE;\n\t\t\tinterval: SequenceInterval;\n\t\t\tstart: LocalReferencePosition;\n\t\t\tend: LocalReferencePosition;\n\t }\n\t| {\n\t\t\tevent: typeof IntervalOpType.ADD;\n\t\t\tinterval: SequenceInterval;\n\t }\n\t| {\n\t\t\tevent: typeof IntervalOpType.DELETE;\n\t\t\tinterval: SequenceInterval;\n\t\t\tstart: LocalReferencePosition;\n\t\t\tend: LocalReferencePosition;\n\t }\n\t| {\n\t\t\tevent: typeof IntervalOpType.PROPERTY_CHANGED;\n\t\t\tinterval: SequenceInterval;\n\t\t\tpropertyDeltas: PropertySet;\n\t }\n\t| {\n\t\t\tevent: typeof IntervalOpType.POSITION_REMOVE;\n\t\t\tintervals: {\n\t\t\t\tintervalId: string;\n\t\t\t\tlabel: string;\n\t\t\t\tstartOffset?: number; // interval start index within a removed range\n\t\t\t\tendOffset?: number; // interval end index within a removed range\n\t\t\t}[];\n\t\t\t// local refs used by IntervalOpType.CHANGE and DELETE revertibles\n\t\t\trevertibleRefs: {\n\t\t\t\trevertible: IntervalRevertible;\n\t\t\t\toffset: number;\n\t\t\t\tisStart: boolean;\n\t\t\t}[];\n\t\t\tmergeTreeRevertible: MergeTreeDeltaRevertible;\n\t };\n\ntype TypedRevertible<T extends IntervalRevertible[\"event\"]> = IntervalRevertible & { event: T };\n\nfunction getUpdatedIdFromInterval(interval: SequenceInterval): string {\n\tconst maybeId = interval.getIntervalId();\n\treturn getUpdatedId(maybeId);\n}\n\nfunction getUpdatedId(intervalId: string): string {\n\treturn idMap.get(intervalId) ?? intervalId;\n}\n\n/**\n * Create revertibles for adding an interval\n * @alpha\n */\nexport function appendAddIntervalToRevertibles(\n\tinterval: SequenceInterval,\n\trevertibles: SharedStringRevertible[],\n) {\n\trevertibles.push({\n\t\tevent: IntervalOpType.ADD,\n\t\tinterval,\n\t});\n\n\treturn revertibles;\n}\n\n/**\n * Create revertibles for deleting an interval\n * @alpha\n */\nexport function appendDeleteIntervalToRevertibles(\n\tstring: SharedString,\n\tinterval: SequenceInterval,\n\trevertibles: SharedStringRevertible[],\n) {\n\tconst startSeg = interval.start.getSegment() as SharedStringSegment;\n\tconst endSeg = interval.end.getSegment() as SharedStringSegment;\n\tconst startRef = string.createLocalReferencePosition(\n\t\tstartSeg,\n\t\tinterval.start.getOffset(),\n\t\tReferenceType.StayOnRemove | ReferenceType.RangeBegin,\n\t\tundefined,\n\t);\n\tconst endRef = string.createLocalReferencePosition(\n\t\tendSeg,\n\t\tinterval.end.getOffset(),\n\t\tReferenceType.StayOnRemove | ReferenceType.RangeEnd,\n\t\tundefined,\n\t);\n\tconst revertible = {\n\t\tevent: IntervalOpType.DELETE,\n\t\tinterval,\n\t\tstart: startRef,\n\t\tend: endRef,\n\t};\n\trevertible.start.addProperties({ revertible });\n\trevertible.end.addProperties({ revertible });\n\trevertibles.push(revertible);\n\n\treturn revertibles;\n}\n\n/**\n * Create revertibles for moving endpoints of an interval\n * @alpha\n */\nexport function appendChangeIntervalToRevertibles(\n\tstring: SharedString,\n\tnewInterval: SequenceInterval,\n\tpreviousInterval: SequenceInterval,\n\trevertibles: SharedStringRevertible[],\n) {\n\tconst startSeg = previousInterval.start.getSegment() as SharedStringSegment;\n\tconst endSeg = previousInterval.end.getSegment() as SharedStringSegment;\n\tconst prevStartRef = string.createLocalReferencePosition(\n\t\tstartSeg,\n\t\tpreviousInterval.start.getOffset(),\n\t\tReferenceType.StayOnRemove | ReferenceType.RangeBegin,\n\t\tundefined,\n\t);\n\tconst prevEndRef = string.createLocalReferencePosition(\n\t\tendSeg,\n\t\tpreviousInterval.end.getOffset(),\n\t\tReferenceType.StayOnRemove | ReferenceType.RangeEnd,\n\t\tundefined,\n\t);\n\tconst revertible = {\n\t\tevent: IntervalOpType.CHANGE,\n\t\tinterval: newInterval,\n\t\tstart: prevStartRef,\n\t\tend: prevEndRef,\n\t};\n\trevertible.start.addProperties({ revertible });\n\trevertible.end.addProperties({ revertible });\n\trevertibles.push(revertible);\n\n\treturn revertibles;\n}\n\n/**\n * Create revertibles for changing properties of an interval\n * @alpha\n */\nexport function appendIntervalPropertyChangedToRevertibles(\n\tinterval: SequenceInterval,\n\tdeltas: PropertySet,\n\trevertibles: SharedStringRevertible[],\n) {\n\trevertibles.push({\n\t\tevent: IntervalOpType.PROPERTY_CHANGED,\n\t\tinterval,\n\t\tpropertyDeltas: deltas,\n\t});\n\n\treturn revertibles;\n}\n\nfunction addIfIntervalEndpoint(\n\tref: LocalReferencePosition,\n\tsegmentLengths: number,\n\tstartIntervals: { offset: number; interval: SequenceInterval }[],\n\tendIntervals: { offset: number; interval: SequenceInterval }[],\n) {\n\tif (refTypeIncludesFlag(ref.refType, ReferenceType.RangeBegin)) {\n\t\tconst interval = ref.properties?.interval;\n\t\tif (interval && interval instanceof SequenceInterval) {\n\t\t\tstartIntervals.push({ offset: segmentLengths + interval.start.getOffset(), interval });\n\t\t\treturn true;\n\t\t}\n\t} else if (refTypeIncludesFlag(ref.refType, ReferenceType.RangeEnd)) {\n\t\tconst interval = ref.properties?.interval;\n\t\tif (interval && interval instanceof SequenceInterval) {\n\t\t\tendIntervals.push({ offset: segmentLengths + interval.end.getOffset(), interval });\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction addIfRevertibleRef(\n\tref: LocalReferencePosition,\n\tsegmentLengths: number,\n\trevertibleRefs: {\n\t\trevertible: IntervalRevertible;\n\t\toffset: number;\n\t\tisStart: boolean;\n\t}[],\n) {\n\tconst revertible = ref.properties?.revertible;\n\tif (revertible) {\n\t\trevertibleRefs.push({\n\t\t\trevertible,\n\t\t\toffset: segmentLengths + ref.getOffset(),\n\t\t\tisStart: refTypeIncludesFlag(ref.refType, ReferenceType.RangeBegin),\n\t\t});\n\t}\n}\n\n/**\n * Create revertibles for SharedStringDeltas, handling indirectly modified intervals\n * (e.g. reverting remove of a range that contains an interval will move the interval back)\n *\n * Revertibles are new and require the option mergeTreeUseNewLengthCalculations to\n * be set as true on the underlying merge tree in order to function correctly.\n *\n * @alpha\n */\nexport function appendSharedStringDeltaToRevertibles(\n\tstring: SharedString,\n\tdelta: SequenceDeltaEvent,\n\trevertibles: SharedStringRevertible[],\n) {\n\tif (delta.ranges.length === 0) {\n\t\treturn;\n\t}\n\tif (delta.deltaOperation === MergeTreeDeltaType.REMOVE) {\n\t\tconst startIntervals: { offset: number; interval: SequenceInterval }[] = [];\n\t\tconst endIntervals: { offset: number; interval: SequenceInterval }[] = [];\n\t\tconst revertibleRefs: {\n\t\t\trevertible: IntervalRevertible;\n\t\t\toffset: number;\n\t\t\tisStart: boolean;\n\t\t}[] = [];\n\t\tlet segmentLengths = 0;\n\n\t\t// find interval endpoints in each segment\n\t\tfor (const deltaRange of delta.ranges) {\n\t\t\tconst refs = deltaRange.segment.localRefs;\n\t\t\tif (refs !== undefined && deltaRange.position !== -1) {\n\t\t\t\tfor (const ref of refs) {\n\t\t\t\t\taddIfIntervalEndpoint(ref, segmentLengths, startIntervals, endIntervals);\n\t\t\t\t\taddIfRevertibleRef(ref, segmentLengths, revertibleRefs);\n\t\t\t\t}\n\t\t\t}\n\t\t\tsegmentLengths += deltaRange.segment.cachedLength;\n\t\t}\n\n\t\tif (startIntervals.length > 0 || endIntervals.length > 0 || revertibleRefs.length > 0) {\n\t\t\tconst removeRevertibles: MergeTreeDeltaRevertible[] = [];\n\t\t\tappendToMergeTreeDeltaRevertibles(delta.deltaArgs, removeRevertibles);\n\t\t\tassert(\n\t\t\t\tremoveRevertibles.length === 1,\n\t\t\t\t0x6c4 /* Remove revertible should be a single delta */,\n\t\t\t);\n\n\t\t\tconst revertible: TypedRevertible<typeof IntervalOpType.POSITION_REMOVE> = {\n\t\t\t\tevent: IntervalOpType.POSITION_REMOVE,\n\t\t\t\tintervals: [],\n\t\t\t\trevertibleRefs,\n\t\t\t\tmergeTreeRevertible: removeRevertibles[0],\n\t\t\t};\n\n\t\t\t// add an interval for each startInterval, accounting for any corresponding endIntervals\n\t\t\tstartIntervals.forEach(({ interval, offset }) => {\n\t\t\t\t// find any corresponding end for this interval\n\t\t\t\tconst endIntervalIndex = endIntervals.findIndex((end) => {\n\t\t\t\t\treturn end.interval === interval;\n\t\t\t\t});\n\t\t\t\tlet endOffset: number | undefined;\n\t\t\t\tif (endIntervalIndex !== -1) {\n\t\t\t\t\tendOffset = endIntervals[endIntervalIndex].offset;\n\t\t\t\t\tendIntervals.splice(endIntervalIndex, 1);\n\t\t\t\t}\n\n\t\t\t\trevertible.intervals.push({\n\t\t\t\t\tintervalId: interval.getIntervalId(),\n\t\t\t\t\tlabel: interval.properties.referenceRangeLabels[0],\n\t\t\t\t\tstartOffset: offset,\n\t\t\t\t\tendOffset,\n\t\t\t\t});\n\t\t\t});\n\n\t\t\t// add any remaining endIntervals that aren't matched with a startInterval\n\t\t\tendIntervals.forEach(({ interval, offset }) => {\n\t\t\t\trevertible.intervals.push({\n\t\t\t\t\tintervalId: interval.getIntervalId(),\n\t\t\t\t\tlabel: interval.properties.referenceRangeLabels[0],\n\t\t\t\t\tendOffset: offset,\n\t\t\t\t});\n\t\t\t});\n\n\t\t\trevertibles.push(revertible);\n\t\t\treturn;\n\t\t}\n\t}\n\n\t// Handle any merge tree delta that is not REMOVE or is REMOVE with no interval endpoints\n\tconst mergeTreeRevertibles: MergeTreeDeltaRevertible[] = [];\n\t// Allow merging MergeTreeDeltaRevertible with previous\n\tif (revertibles.length > 0 && isMergeTreeDeltaRevertible(revertibles[revertibles.length - 1])) {\n\t\tmergeTreeRevertibles.push(revertibles.pop() as MergeTreeDeltaRevertible);\n\t}\n\tappendToMergeTreeDeltaRevertibles(delta.deltaArgs, mergeTreeRevertibles);\n\trevertibles.push(...mergeTreeRevertibles);\n}\n\n/**\n * Clean up resources held by revertibles that are no longer needed.\n * @alpha\n */\nexport function discardSharedStringRevertibles(\n\tsharedString: SharedString,\n\trevertibles: SharedStringRevertible[],\n) {\n\trevertibles.forEach((r) => {\n\t\tif (isMergeTreeDeltaRevertible(r)) {\n\t\t\tdiscardMergeTreeDeltaRevertible([r]);\n\t\t} else if (r.event === IntervalOpType.CHANGE || r.event === IntervalOpType.DELETE) {\n\t\t\tsharedString.removeLocalReferencePosition(r.start);\n\t\t\tsharedString.removeLocalReferencePosition(r.end);\n\t\t}\n\t});\n}\n\n// Uses of referenceRangeLabels will be removed once AB#4081 is completed.\nfunction revertLocalAdd(\n\tstring: SharedString,\n\trevertible: TypedRevertible<typeof IntervalOpType.ADD>,\n) {\n\tconst id = getUpdatedIdFromInterval(revertible.interval);\n\tconst label = revertible.interval.properties.referenceRangeLabels[0];\n\tstring.getIntervalCollection(label).removeIntervalById(id);\n}\n\nfunction revertLocalDelete(\n\tstring: SharedString,\n\trevertible: TypedRevertible<typeof IntervalOpType.DELETE>,\n) {\n\tconst label = revertible.interval.properties.referenceRangeLabels[0];\n\tconst start = string.localReferencePositionToPosition(revertible.start);\n\tconst end = string.localReferencePositionToPosition(revertible.end);\n\tconst type = revertible.interval.intervalType;\n\t// reusing the id causes eventual consistency bugs, so it is removed here and recreated in add\n\tconst { intervalId, ...props } = revertible.interval.properties;\n\tconst int = string.getIntervalCollection(label).add(start, end, type, props);\n\n\tidMap.forEach((newId, oldId) => {\n\t\tif (intervalId === newId) {\n\t\t\tidMap.set(oldId, getUpdatedIdFromInterval(int));\n\t\t}\n\t});\n\tidMap.set(intervalId, int.getIntervalId());\n\n\tstring.removeLocalReferencePosition(revertible.start);\n\tstring.removeLocalReferencePosition(revertible.end);\n}\n\nfunction revertLocalChange(\n\tstring: SharedString,\n\trevertible: TypedRevertible<typeof IntervalOpType.CHANGE>,\n) {\n\tconst label = revertible.interval.properties.referenceRangeLabels[0];\n\tconst id = getUpdatedIdFromInterval(revertible.interval);\n\tconst start = string.localReferencePositionToPosition(revertible.start);\n\tconst end = string.localReferencePositionToPosition(revertible.end);\n\tstring.getIntervalCollection(label).change(id, start, end);\n\n\tstring.removeLocalReferencePosition(revertible.start);\n\tstring.removeLocalReferencePosition(revertible.end);\n}\n\nfunction revertLocalPropertyChanged(\n\tstring: SharedString,\n\trevertible: TypedRevertible<typeof IntervalOpType.PROPERTY_CHANGED>,\n) {\n\tconst label = revertible.interval.properties.referenceRangeLabels[0];\n\tconst id = getUpdatedIdFromInterval(revertible.interval);\n\tconst newProps = revertible.propertyDeltas;\n\tstring.getIntervalCollection(label).changeProperties(id, newProps);\n}\n\nfunction newPosition(offset: number | undefined, restoredRanges: SortedRangeSet) {\n\tif (offset === undefined) {\n\t\treturn undefined;\n\t}\n\n\tlet offsetFromSegment = offset;\n\tfor (const rangeInfo of restoredRanges.items) {\n\t\tif (offsetFromSegment < rangeInfo.length) {\n\t\t\t// find the segment inside the range\n\t\t\tfor (const range of rangeInfo.ranges) {\n\t\t\t\tif (range.segment.cachedLength > offsetFromSegment) {\n\t\t\t\t\treturn { segment: range.segment, offset: offsetFromSegment };\n\t\t\t\t}\n\t\t\t\toffsetFromSegment -= range.segment.cachedLength;\n\t\t\t}\n\t\t}\n\t\toffsetFromSegment -= rangeInfo.length;\n\t}\n\n\treturn undefined;\n}\n\nfunction newEndpointPosition(\n\toffset: number | undefined,\n\trestoredRanges: SortedRangeSet,\n\tsharedString: SharedString,\n) {\n\tconst pos = newPosition(offset, restoredRanges);\n\treturn pos === undefined ? undefined : sharedString.getPosition(pos.segment) + pos.offset;\n}\n\ninterface RangeInfo {\n\tranges: readonly Readonly<ISequenceDeltaRange<MergeTreeDeltaOperationType>>[];\n\tlength: number;\n}\n\nclass SortedRangeSet extends SortedSet<RangeInfo, string> {\n\tprotected getKey(item: RangeInfo): string {\n\t\treturn item.ranges[0].segment.ordinal;\n\t}\n}\n\nfunction revertLocalSequenceRemove(\n\tsharedString: SharedString,\n\trevertible: TypedRevertible<typeof IntervalOpType.POSITION_REMOVE>,\n) {\n\tconst restoredRanges = new SortedRangeSet();\n\tconst saveSegments = (event: SequenceDeltaEvent) => {\n\t\tif (event.ranges.length > 0) {\n\t\t\tlet length = 0;\n\t\t\tevent.ranges.forEach((range) => {\n\t\t\t\tlength += range.segment.cachedLength;\n\t\t\t});\n\t\t\trestoredRanges.addOrUpdate({ ranges: event.ranges, length });\n\t\t}\n\t};\n\tsharedString.on(\"sequenceDelta\", saveSegments);\n\trevertMergeTreeDeltaRevertibles(sharedString, [revertible.mergeTreeRevertible]);\n\tsharedString.off(\"sequenceDelta\", saveSegments);\n\n\trevertible.intervals.forEach((intervalInfo) => {\n\t\tconst intervalCollection = sharedString.getIntervalCollection(intervalInfo.label);\n\t\tconst intervalId = getUpdatedId(intervalInfo.intervalId);\n\t\tconst interval = intervalCollection.getIntervalById(intervalId);\n\t\tif (interval !== undefined) {\n\t\t\tconst newStart = newEndpointPosition(\n\t\t\t\tintervalInfo.startOffset,\n\t\t\t\trestoredRanges,\n\t\t\t\tsharedString,\n\t\t\t);\n\t\t\tconst newEnd = newEndpointPosition(\n\t\t\t\tintervalInfo.endOffset,\n\t\t\t\trestoredRanges,\n\t\t\t\tsharedString,\n\t\t\t);\n\t\t\tif (newStart !== undefined || newEnd !== undefined) {\n\t\t\t\tintervalCollection.change(intervalId, newStart, newEnd);\n\t\t\t}\n\t\t}\n\t});\n\n\t// fix up the local references used by delete and change revertibles\n\trevertible.revertibleRefs.forEach((revertibleRef) => {\n\t\tassert(\n\t\t\trevertibleRef.revertible.event === IntervalOpType.CHANGE ||\n\t\t\t\trevertibleRef.revertible.event === IntervalOpType.DELETE,\n\t\t\t0x6c5 /* revertible is not delete or change */,\n\t\t);\n\t\tconst pos = newPosition(revertibleRef.offset, restoredRanges);\n\t\tif (pos !== undefined) {\n\t\t\tif (revertibleRef.isStart) {\n\t\t\t\tsharedString.removeLocalReferencePosition(revertibleRef.revertible.start);\n\t\t\t\tconst newRef = sharedString.createLocalReferencePosition(\n\t\t\t\t\tpos.segment as SharedStringSegment,\n\t\t\t\t\tpos.offset,\n\t\t\t\t\tReferenceType.StayOnRemove | ReferenceType.RangeBegin,\n\t\t\t\t\t{ revertible: revertibleRef.revertible },\n\t\t\t\t);\n\t\t\t\trevertibleRef.revertible.start = newRef;\n\t\t\t} else {\n\t\t\t\tsharedString.removeLocalReferencePosition(revertibleRef.revertible.end);\n\t\t\t\tconst newRef = sharedString.createLocalReferencePosition(\n\t\t\t\t\tpos.segment as SharedStringSegment,\n\t\t\t\t\tpos.offset,\n\t\t\t\t\tReferenceType.StayOnRemove | ReferenceType.RangeEnd,\n\t\t\t\t\t{ revertible: revertibleRef.revertible },\n\t\t\t\t);\n\t\t\t\trevertibleRef.revertible.end = newRef;\n\t\t\t}\n\t\t}\n\t});\n}\n\n/**\n * Invoke revertibles to reverse prior edits\n *\n * Revertibles are new and require the option mergeTreeUseNewLengthCalculations to\n * be set as true on the underlying merge tree in order to function correctly.\n *\n * @alpha\n */\nexport function revertSharedStringRevertibles(\n\tsharedString: SharedString,\n\trevertibles: SharedStringRevertible[],\n) {\n\twhile (revertibles.length > 0) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tconst r = revertibles.pop()!;\n\t\tif (\"event\" in r) {\n\t\t\tconst event = r.event;\n\t\t\tswitch (event) {\n\t\t\t\tcase IntervalOpType.ADD:\n\t\t\t\t\trevertLocalAdd(sharedString, r);\n\t\t\t\t\tbreak;\n\t\t\t\tcase IntervalOpType.DELETE:\n\t\t\t\t\trevertLocalDelete(sharedString, r);\n\t\t\t\t\tbreak;\n\t\t\t\tcase IntervalOpType.CHANGE:\n\t\t\t\t\trevertLocalChange(sharedString, r);\n\t\t\t\t\tbreak;\n\t\t\t\tcase IntervalOpType.PROPERTY_CHANGED:\n\t\t\t\t\trevertLocalPropertyChanged(sharedString, r);\n\t\t\t\t\tbreak;\n\t\t\t\tcase IntervalOpType.POSITION_REMOVE:\n\t\t\t\t\trevertLocalSequenceRemove(sharedString, r);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(event);\n\t\t\t}\n\t\t} else {\n\t\t\trevertMergeTreeDeltaRevertibles(sharedString, [r]);\n\t\t}\n\t}\n}\n"]}
|
package/dist/sequence.d.ts
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
import { Deferred } from "@fluidframework/common-utils";
|
|
6
6
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { IChannelAttributes, IFluidDataStoreRuntime, IChannelStorageService } from "@fluidframework/datastore-definitions";
|
|
8
|
-
import { Client, ICombiningOp, IJSONSegment, IMergeTreeGroupMsg, IMergeTreeOp, IMergeTreeRemoveMsg, IRelativePosition, ISegment, ISegmentAction, LocalReferencePosition, PropertySet, RangeStackMap, ReferencePosition, ReferenceType, MergeTreeRevertibleDriver } from "@fluidframework/merge-tree";
|
|
8
|
+
import { Client, ICombiningOp, IJSONSegment, IMergeTreeGroupMsg, IMergeTreeOp, IMergeTreeRemoveMsg, IRelativePosition, ISegment, ISegmentAction, LocalReferencePosition, PropertySet, RangeStackMap, ReferencePosition, ReferenceType, MergeTreeRevertibleDriver, SlidingPreference } from "@fluidframework/merge-tree";
|
|
9
9
|
import { IFluidSerializer, SharedObject, ISharedObjectEvents, SummarySerializer } from "@fluidframework/shared-object-base";
|
|
10
10
|
import { IEventThisPlaceHolder } from "@fluidframework/common-definitions";
|
|
11
11
|
import { ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions";
|
|
12
|
-
import {
|
|
12
|
+
import { IIntervalCollection, SequenceInterval } from "./intervalCollection";
|
|
13
13
|
import { SequenceDeltaEvent, SequenceMaintenanceEvent } from "./sequenceDeltaEvent";
|
|
14
14
|
import { ISharedIntervalCollection } from "./sharedIntervalCollection";
|
|
15
15
|
/**
|
|
@@ -113,7 +113,7 @@ export declare abstract class SharedSegmentSequence<T extends ISegment> extends
|
|
|
113
113
|
* @param refType - ReferenceType for the created local reference
|
|
114
114
|
* @param properties - PropertySet to place on the created local reference
|
|
115
115
|
*/
|
|
116
|
-
createLocalReferencePosition(segment: T, offset: number, refType: ReferenceType, properties: PropertySet | undefined): LocalReferencePosition;
|
|
116
|
+
createLocalReferencePosition(segment: T, offset: number, refType: ReferenceType, properties: PropertySet | undefined, slidingPreference?: SlidingPreference): LocalReferencePosition;
|
|
117
117
|
/**
|
|
118
118
|
* Resolves a `ReferencePosition` into a character position using this client's perspective.
|
|
119
119
|
*/
|
|
@@ -180,7 +180,7 @@ export declare abstract class SharedSegmentSequence<T extends ISegment> extends
|
|
|
180
180
|
* Retrieves the interval collection keyed on `label`. If no such interval collection exists,
|
|
181
181
|
* creates one.
|
|
182
182
|
*/
|
|
183
|
-
getIntervalCollection(label: string):
|
|
183
|
+
getIntervalCollection(label: string): IIntervalCollection<SequenceInterval>;
|
|
184
184
|
/**
|
|
185
185
|
* @returns An iterable object that enumerates the IntervalCollection labels.
|
|
186
186
|
*
|
package/dist/sequence.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequence.d.ts","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAA0B,MAAM,8BAA8B,CAAC;AAEhF,OAAO,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,MAAM,EAKN,YAAY,EACZ,YAAY,EAGZ,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,sBAAsB,EAGtB,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,yBAAyB,EAEzB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACN,gBAAgB,EAGhB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAI/F,OAAO,EACN,
|
|
1
|
+
{"version":3,"file":"sequence.d.ts","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAA0B,M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