@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.
Files changed (94) hide show
  1. package/.eslintrc.js +9 -12
  2. package/.mocharc.js +2 -2
  3. package/.vscode/launch.json +15 -14
  4. package/README.md +188 -179
  5. package/api-extractor.json +2 -2
  6. package/dist/defaultMap.d.ts.map +1 -1
  7. package/dist/defaultMap.js +5 -4
  8. package/dist/defaultMap.js.map +1 -1
  9. package/dist/defaultMapInterfaces.d.ts.map +1 -1
  10. package/dist/defaultMapInterfaces.js.map +1 -1
  11. package/dist/index.d.ts +2 -2
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/intervalCollection.d.ts.map +1 -1
  15. package/dist/intervalCollection.js +50 -36
  16. package/dist/intervalCollection.js.map +1 -1
  17. package/dist/intervalTree.d.ts.map +1 -1
  18. package/dist/intervalTree.js.map +1 -1
  19. package/dist/localValues.d.ts.map +1 -1
  20. package/dist/localValues.js.map +1 -1
  21. package/dist/packageVersion.d.ts +1 -1
  22. package/dist/packageVersion.js +1 -1
  23. package/dist/packageVersion.js.map +1 -1
  24. package/dist/sequence.d.ts +1 -1
  25. package/dist/sequence.d.ts.map +1 -1
  26. package/dist/sequence.js +13 -17
  27. package/dist/sequence.js.map +1 -1
  28. package/dist/sequenceDeltaEvent.d.ts.map +1 -1
  29. package/dist/sequenceDeltaEvent.js.map +1 -1
  30. package/dist/sequenceFactory.d.ts.map +1 -1
  31. package/dist/sequenceFactory.js.map +1 -1
  32. package/dist/sharedIntervalCollection.d.ts.map +1 -1
  33. package/dist/sharedIntervalCollection.js.map +1 -1
  34. package/dist/sharedSequence.d.ts.map +1 -1
  35. package/dist/sharedSequence.js +3 -3
  36. package/dist/sharedSequence.js.map +1 -1
  37. package/dist/sharedString.d.ts.map +1 -1
  38. package/dist/sharedString.js +5 -4
  39. package/dist/sharedString.js.map +1 -1
  40. package/lib/defaultMap.d.ts.map +1 -1
  41. package/lib/defaultMap.js +6 -5
  42. package/lib/defaultMap.js.map +1 -1
  43. package/lib/defaultMapInterfaces.d.ts.map +1 -1
  44. package/lib/defaultMapInterfaces.js.map +1 -1
  45. package/lib/index.d.ts +2 -2
  46. package/lib/index.d.ts.map +1 -1
  47. package/lib/index.js +2 -2
  48. package/lib/index.js.map +1 -1
  49. package/lib/intervalCollection.d.ts.map +1 -1
  50. package/lib/intervalCollection.js +50 -36
  51. package/lib/intervalCollection.js.map +1 -1
  52. package/lib/intervalTree.d.ts.map +1 -1
  53. package/lib/intervalTree.js.map +1 -1
  54. package/lib/localValues.d.ts.map +1 -1
  55. package/lib/localValues.js +1 -1
  56. package/lib/localValues.js.map +1 -1
  57. package/lib/packageVersion.d.ts +1 -1
  58. package/lib/packageVersion.js +1 -1
  59. package/lib/packageVersion.js.map +1 -1
  60. package/lib/sequence.d.ts +1 -1
  61. package/lib/sequence.d.ts.map +1 -1
  62. package/lib/sequence.js +15 -19
  63. package/lib/sequence.js.map +1 -1
  64. package/lib/sequenceDeltaEvent.d.ts.map +1 -1
  65. package/lib/sequenceDeltaEvent.js.map +1 -1
  66. package/lib/sequenceFactory.d.ts.map +1 -1
  67. package/lib/sequenceFactory.js +1 -1
  68. package/lib/sequenceFactory.js.map +1 -1
  69. package/lib/sharedIntervalCollection.d.ts.map +1 -1
  70. package/lib/sharedIntervalCollection.js.map +1 -1
  71. package/lib/sharedSequence.d.ts.map +1 -1
  72. package/lib/sharedSequence.js +4 -4
  73. package/lib/sharedSequence.js.map +1 -1
  74. package/lib/sharedString.d.ts.map +1 -1
  75. package/lib/sharedString.js +5 -4
  76. package/lib/sharedString.js.map +1 -1
  77. package/package.json +55 -55
  78. package/prettier.config.cjs +1 -1
  79. package/src/defaultMap.ts +406 -405
  80. package/src/defaultMapInterfaces.ts +120 -115
  81. package/src/index.ts +27 -17
  82. package/src/intervalCollection.ts +2198 -1997
  83. package/src/intervalTree.ts +139 -139
  84. package/src/localValues.ts +64 -73
  85. package/src/packageVersion.ts +1 -1
  86. package/src/sequence.ts +739 -694
  87. package/src/sequenceDeltaEvent.ts +143 -137
  88. package/src/sequenceFactory.ts +48 -46
  89. package/src/sharedIntervalCollection.ts +150 -136
  90. package/src/sharedSequence.ts +165 -160
  91. package/src/sharedString.ts +385 -343
  92. package/tsconfig.esnext.json +6 -6
  93. package/tsconfig.json +8 -12
  94. 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
- * 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;
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
- * 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(opName: string, previousValue: any, params: any, localOpMetadata: IMapMessageLocalMetadata): void;
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
- localSeq: number;
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
- * Create a new value type. Used both in creation of new value types, as well as in loading existing ones
55
- * from remote.
56
- * @param emitter - Emitter object that the created value type will use to emit operations
57
- * @param raw - Initialization parameters as defined by the value type
58
- * @returns The new value type
59
- * @alpha
60
- */
61
- load(emitter: IValueOpEmitter, raw: any): T;
62
-
63
- /**
64
- * Given a value type, provides a JSONable form of its data to be used for snapshotting. This data must be
65
- * loadable using the load method of its factory.
66
- * @param value - The value type to serialize
67
- * @returns The JSONable form of the value type
68
- * @alpha
69
- */
70
- store(value: T): any;
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
- * Performs the actual processing on the incoming operation.
80
- * @param value - The current value stored at the given key, which should be the value type
81
- * @param params - The params on the incoming operation
82
- * @param local - Whether the operation originated from this client
83
- * @param message - The operation itself
84
- * @param localOpMetadata - any local metadata submitted by `IValueOpEmitter.emit`.
85
- * @alpha
86
- */
87
- process(
88
- value: T,
89
- params: any,
90
- local: boolean,
91
- message: ISequencedDocumentMessage | undefined,
92
- localOpMetadata: IMapMessageLocalMetadata | undefined
93
- );
94
-
95
- /**
96
- * Rebases an `op` on `value` from its original perspective (ref/local seq) to the current
97
- * perspective. Should be invoked on reconnection.
98
- * @param value - The current value stored at the given key, which should be the value type.
99
- * @param op - The op to be rebased.
100
- * @param localOpMetadata - Any local metadata that was originally submitted with the op.
101
- * @returns A rebased version of the op and any local metadata that should be submitted with it.
102
- */
103
- rebase(
104
- value: T,
105
- op: IValueTypeOperationValue,
106
- localOpMetadata: IMapMessageLocalMetadata
107
- ): { rebasedOp: IValueTypeOperationValue; rebasedLocalOpMetadata: IMapMessageLocalMetadata; };
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
- * Name of the value type.
116
- * @alpha
117
- */
118
- name: string;
119
-
120
- /**
121
- * Factory method used to convert to/from a JSON form of the type.
122
- * @alpha
123
- */
124
- factory: IValueFactory<T>;
125
-
126
- /**
127
- * Operations that can be applied to the value type.
128
- * @alpha
129
- */
130
- ops: Map<string, IValueOperation<T>>;
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
- (event: "valueChanged" | "create", listener: (
135
- changed: IValueChanged,
136
- local: boolean,
137
- target: IEventThisPlaceHolder) => void);
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
- * A type annotation to help indicate how the value serializes.
154
- */
155
- type: string;
156
-
157
- /**
158
- * The JSONable representation of the value.
159
- */
160
- value: any;
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
- * A type annotation to help indicate how the value serializes.
166
- */
167
- type: string;
168
-
169
- /**
170
- * String representation of the value.
171
- */
172
- value: string | undefined;
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
- * The name of the operation.
187
- */
188
- opName: string;
189
-
190
- /**
191
- * The payload that is submitted along with the operation.
192
- */
193
- value: any;
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
- 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,
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 { ISequenceDeltaRange, SequenceDeltaEvent, SequenceEvent, SequenceMaintenanceEvent } from "./sequenceDeltaEvent";
38
+ export {
39
+ ISequenceDeltaRange,
40
+ SequenceDeltaEvent,
41
+ SequenceEvent,
42
+ SequenceMaintenanceEvent,
43
+ } from "./sequenceDeltaEvent";
39
44
  export { SharedStringFactory } from "./sequenceFactory";
40
- export { getTextAndMarkers, ISharedString, SharedString, SharedStringSegment } from "./sharedString";
45
+ export {
46
+ getTextAndMarkers,
47
+ ISharedString,
48
+ SharedString,
49
+ SharedStringSegment,
50
+ } from "./sharedString";
41
51
  export {
42
52
  ISharedIntervalCollection,
43
53
  SharedIntervalCollection,