@fluidframework/sequence 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +9 -12
- package/.mocharc.js +2 -2
- package/.vscode/launch.json +15 -14
- package/README.md +188 -179
- package/api-extractor.json +2 -2
- package/dist/defaultMap.d.ts.map +1 -1
- package/dist/defaultMap.js +5 -4
- package/dist/defaultMap.js.map +1 -1
- package/dist/defaultMapInterfaces.d.ts.map +1 -1
- package/dist/defaultMapInterfaces.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +50 -36
- package/dist/intervalCollection.js.map +1 -1
- package/dist/intervalTree.d.ts.map +1 -1
- package/dist/intervalTree.js.map +1 -1
- package/dist/localValues.d.ts.map +1 -1
- package/dist/localValues.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/sequence.d.ts +1 -1
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +13 -17
- package/dist/sequence.js.map +1 -1
- package/dist/sequenceDeltaEvent.d.ts.map +1 -1
- package/dist/sequenceDeltaEvent.js.map +1 -1
- package/dist/sequenceFactory.d.ts.map +1 -1
- package/dist/sequenceFactory.js.map +1 -1
- package/dist/sharedIntervalCollection.d.ts.map +1 -1
- package/dist/sharedIntervalCollection.js.map +1 -1
- package/dist/sharedSequence.d.ts.map +1 -1
- package/dist/sharedSequence.js +3 -3
- package/dist/sharedSequence.js.map +1 -1
- package/dist/sharedString.d.ts.map +1 -1
- package/dist/sharedString.js +5 -4
- package/dist/sharedString.js.map +1 -1
- package/lib/defaultMap.d.ts.map +1 -1
- package/lib/defaultMap.js +6 -5
- package/lib/defaultMap.js.map +1 -1
- package/lib/defaultMapInterfaces.d.ts.map +1 -1
- package/lib/defaultMapInterfaces.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +50 -36
- package/lib/intervalCollection.js.map +1 -1
- package/lib/intervalTree.d.ts.map +1 -1
- package/lib/intervalTree.js.map +1 -1
- package/lib/localValues.d.ts.map +1 -1
- package/lib/localValues.js +1 -1
- package/lib/localValues.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/sequence.d.ts +1 -1
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +15 -19
- package/lib/sequence.js.map +1 -1
- package/lib/sequenceDeltaEvent.d.ts.map +1 -1
- package/lib/sequenceDeltaEvent.js.map +1 -1
- package/lib/sequenceFactory.d.ts.map +1 -1
- package/lib/sequenceFactory.js +1 -1
- package/lib/sequenceFactory.js.map +1 -1
- package/lib/sharedIntervalCollection.d.ts.map +1 -1
- package/lib/sharedIntervalCollection.js.map +1 -1
- package/lib/sharedSequence.d.ts.map +1 -1
- package/lib/sharedSequence.js +4 -4
- package/lib/sharedSequence.js.map +1 -1
- package/lib/sharedString.d.ts.map +1 -1
- package/lib/sharedString.js +5 -4
- package/lib/sharedString.js.map +1 -1
- package/package.json +55 -55
- package/prettier.config.cjs +1 -1
- package/src/defaultMap.ts +406 -405
- package/src/defaultMapInterfaces.ts +120 -115
- package/src/index.ts +27 -17
- package/src/intervalCollection.ts +2198 -1997
- package/src/intervalTree.ts +139 -139
- package/src/localValues.ts +64 -73
- package/src/packageVersion.ts +1 -1
- package/src/sequence.ts +739 -694
- package/src/sequenceDeltaEvent.ts +143 -137
- package/src/sequenceFactory.ts +48 -46
- package/src/sharedIntervalCollection.ts +150 -136
- package/src/sharedSequence.ts +165 -160
- package/src/sharedString.ts +385 -343
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +8 -12
- package/.editorconfig +0 -7
|
@@ -11,15 +11,15 @@ import { IEventThisPlaceHolder } from "@fluidframework/common-definitions";
|
|
|
11
11
|
* Type of "valueChanged" event parameter.
|
|
12
12
|
*/
|
|
13
13
|
export interface IValueChanged {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The key storing the value that changed.
|
|
16
|
+
*/
|
|
17
|
+
key: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The value that was stored at the key prior to the change.
|
|
21
|
+
*/
|
|
22
|
+
previousValue: any;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -27,22 +27,27 @@ export interface IValueChanged {
|
|
|
27
27
|
* @internal
|
|
28
28
|
*/
|
|
29
29
|
export interface IValueOpEmitter {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Called by the value type to emit a value type operation through the container type holding it.
|
|
32
|
+
* @param opName - Name of the emitted operation
|
|
33
|
+
* @param previousValue - JSONable previous value as defined by the value type
|
|
34
|
+
* @param params - JSONable params for the operation as defined by the value type
|
|
35
|
+
* @param localOpMetadata - JSONable local metadata which should be submitted with the op
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
emit(
|
|
39
|
+
opName: string,
|
|
40
|
+
previousValue: any,
|
|
41
|
+
params: any,
|
|
42
|
+
localOpMetadata: IMapMessageLocalMetadata,
|
|
43
|
+
): void;
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
/**
|
|
42
47
|
* @internal
|
|
43
48
|
*/
|
|
44
49
|
export interface IMapMessageLocalMetadata {
|
|
45
|
-
|
|
50
|
+
localSeq: number;
|
|
46
51
|
}
|
|
47
52
|
|
|
48
53
|
/**
|
|
@@ -50,24 +55,24 @@ export interface IMapMessageLocalMetadata {
|
|
|
50
55
|
* @alpha
|
|
51
56
|
*/
|
|
52
57
|
export interface IValueFactory<T> {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Create a new value type. Used both in creation of new value types, as well as in loading existing ones
|
|
60
|
+
* from remote.
|
|
61
|
+
* @param emitter - Emitter object that the created value type will use to emit operations
|
|
62
|
+
* @param raw - Initialization parameters as defined by the value type
|
|
63
|
+
* @returns The new value type
|
|
64
|
+
* @alpha
|
|
65
|
+
*/
|
|
66
|
+
load(emitter: IValueOpEmitter, raw: any): T;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Given a value type, provides a JSONable form of its data to be used for snapshotting. This data must be
|
|
70
|
+
* loadable using the load method of its factory.
|
|
71
|
+
* @param value - The value type to serialize
|
|
72
|
+
* @returns The JSONable form of the value type
|
|
73
|
+
* @alpha
|
|
74
|
+
*/
|
|
75
|
+
store(value: T): any;
|
|
71
76
|
}
|
|
72
77
|
|
|
73
78
|
/**
|
|
@@ -75,66 +80,66 @@ export interface IValueFactory<T> {
|
|
|
75
80
|
* @alpha
|
|
76
81
|
*/
|
|
77
82
|
export interface IValueOperation<T> {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Performs the actual processing on the incoming operation.
|
|
85
|
+
* @param value - The current value stored at the given key, which should be the value type
|
|
86
|
+
* @param params - The params on the incoming operation
|
|
87
|
+
* @param local - Whether the operation originated from this client
|
|
88
|
+
* @param message - The operation itself
|
|
89
|
+
* @param localOpMetadata - any local metadata submitted by `IValueOpEmitter.emit`.
|
|
90
|
+
* @alpha
|
|
91
|
+
*/
|
|
92
|
+
process(
|
|
93
|
+
value: T,
|
|
94
|
+
params: any,
|
|
95
|
+
local: boolean,
|
|
96
|
+
message: ISequencedDocumentMessage | undefined,
|
|
97
|
+
localOpMetadata: IMapMessageLocalMetadata | undefined,
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Rebases an `op` on `value` from its original perspective (ref/local seq) to the current
|
|
102
|
+
* perspective. Should be invoked on reconnection.
|
|
103
|
+
* @param value - The current value stored at the given key, which should be the value type.
|
|
104
|
+
* @param op - The op to be rebased.
|
|
105
|
+
* @param localOpMetadata - Any local metadata that was originally submitted with the op.
|
|
106
|
+
* @returns A rebased version of the op and any local metadata that should be submitted with it.
|
|
107
|
+
*/
|
|
108
|
+
rebase(
|
|
109
|
+
value: T,
|
|
110
|
+
op: IValueTypeOperationValue,
|
|
111
|
+
localOpMetadata: IMapMessageLocalMetadata,
|
|
112
|
+
): { rebasedOp: IValueTypeOperationValue; rebasedLocalOpMetadata: IMapMessageLocalMetadata };
|
|
108
113
|
}
|
|
109
114
|
|
|
110
115
|
/**
|
|
111
116
|
* Defines a value type that can be registered on a container type.
|
|
112
117
|
*/
|
|
113
118
|
export interface IValueType<T> {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
119
|
+
/**
|
|
120
|
+
* Name of the value type.
|
|
121
|
+
* @alpha
|
|
122
|
+
*/
|
|
123
|
+
name: string;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Factory method used to convert to/from a JSON form of the type.
|
|
127
|
+
* @alpha
|
|
128
|
+
*/
|
|
129
|
+
factory: IValueFactory<T>;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Operations that can be applied to the value type.
|
|
133
|
+
* @alpha
|
|
134
|
+
*/
|
|
135
|
+
ops: Map<string, IValueOperation<T>>;
|
|
131
136
|
}
|
|
132
137
|
|
|
133
138
|
export interface ISharedDefaultMapEvents extends ISharedObjectEvents {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
139
|
+
(
|
|
140
|
+
event: "valueChanged" | "create",
|
|
141
|
+
listener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void,
|
|
142
|
+
);
|
|
138
143
|
}
|
|
139
144
|
|
|
140
145
|
/**
|
|
@@ -149,27 +154,27 @@ export interface ISharedDefaultMapEvents extends ISharedObjectEvents {
|
|
|
149
154
|
* and deserializes via .store() and .load().
|
|
150
155
|
*/
|
|
151
156
|
export interface ISerializableValue {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
/**
|
|
158
|
+
* A type annotation to help indicate how the value serializes.
|
|
159
|
+
*/
|
|
160
|
+
type: string;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The JSONable representation of the value.
|
|
164
|
+
*/
|
|
165
|
+
value: any;
|
|
161
166
|
}
|
|
162
167
|
|
|
163
168
|
export interface ISerializedValue {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
/**
|
|
170
|
+
* A type annotation to help indicate how the value serializes.
|
|
171
|
+
*/
|
|
172
|
+
type: string;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* String representation of the value.
|
|
176
|
+
*/
|
|
177
|
+
value: string | undefined;
|
|
173
178
|
}
|
|
174
179
|
|
|
175
180
|
/**
|
|
@@ -182,13 +187,13 @@ export interface ISerializedValue {
|
|
|
182
187
|
* @alpha
|
|
183
188
|
*/
|
|
184
189
|
export interface IValueTypeOperationValue {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
190
|
+
/**
|
|
191
|
+
* The name of the operation.
|
|
192
|
+
*/
|
|
193
|
+
opName: string;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* The payload that is submitted along with the operation.
|
|
197
|
+
*/
|
|
198
|
+
value: any;
|
|
194
199
|
}
|
package/src/index.ts
CHANGED
|
@@ -17,27 +17,37 @@
|
|
|
17
17
|
*/
|
|
18
18
|
export { IMapMessageLocalMetadata, IValueOpEmitter } from "./defaultMapInterfaces";
|
|
19
19
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
DeserializeCallback,
|
|
21
|
+
IIntervalCollectionEvent,
|
|
22
|
+
IIntervalHelpers,
|
|
23
|
+
Interval,
|
|
24
|
+
IntervalCollection,
|
|
25
|
+
IntervalCollectionIterator,
|
|
26
|
+
IntervalLocator,
|
|
27
|
+
intervalLocatorFromEndpoint,
|
|
28
|
+
IntervalType,
|
|
29
|
+
ISerializableInterval,
|
|
30
|
+
ISerializedInterval,
|
|
31
|
+
SequenceInterval,
|
|
32
|
+
ISerializedIntervalCollectionV2,
|
|
33
|
+
CompressedSerializedInterval,
|
|
34
|
+
SerializedIntervalDelta,
|
|
35
35
|
} from "./intervalCollection";
|
|
36
36
|
export { IInterval, IntervalConflictResolver } from "./intervalTree";
|
|
37
37
|
export { ISharedSegmentSequenceEvents, SharedSegmentSequence } from "./sequence";
|
|
38
|
-
export {
|
|
38
|
+
export {
|
|
39
|
+
ISequenceDeltaRange,
|
|
40
|
+
SequenceDeltaEvent,
|
|
41
|
+
SequenceEvent,
|
|
42
|
+
SequenceMaintenanceEvent,
|
|
43
|
+
} from "./sequenceDeltaEvent";
|
|
39
44
|
export { SharedStringFactory } from "./sequenceFactory";
|
|
40
|
-
export {
|
|
45
|
+
export {
|
|
46
|
+
getTextAndMarkers,
|
|
47
|
+
ISharedString,
|
|
48
|
+
SharedString,
|
|
49
|
+
SharedStringSegment,
|
|
50
|
+
} from "./sharedString";
|
|
41
51
|
export {
|
|
42
52
|
ISharedIntervalCollection,
|
|
43
53
|
SharedIntervalCollection,
|