@fluidframework/sequence 0.59.3003 → 0.59.4000

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 (80) hide show
  1. package/dist/{mapKernel.d.ts → defaultMap.d.ts} +21 -145
  2. package/dist/defaultMap.d.ts.map +1 -0
  3. package/dist/defaultMap.js +317 -0
  4. package/dist/defaultMap.js.map +1 -0
  5. package/dist/{mapKernelInterfaces.d.ts → defaultMapInterfaces.d.ts} +9 -51
  6. package/dist/defaultMapInterfaces.d.ts.map +1 -0
  7. package/dist/{mapKernelInterfaces.js → defaultMapInterfaces.js} +1 -1
  8. package/dist/defaultMapInterfaces.js.map +1 -0
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/intervalCollection.d.ts +12 -3
  13. package/dist/intervalCollection.d.ts.map +1 -1
  14. package/dist/intervalCollection.js +44 -39
  15. package/dist/intervalCollection.js.map +1 -1
  16. package/dist/localValues.d.ts +7 -86
  17. package/dist/localValues.d.ts.map +1 -1
  18. package/dist/localValues.js +1 -131
  19. package/dist/localValues.js.map +1 -1
  20. package/dist/packageVersion.d.ts +1 -1
  21. package/dist/packageVersion.js +1 -1
  22. package/dist/packageVersion.js.map +1 -1
  23. package/dist/sequence.d.ts +5 -1
  24. package/dist/sequence.d.ts.map +1 -1
  25. package/dist/sequence.js +23 -23
  26. package/dist/sequence.js.map +1 -1
  27. package/dist/sharedIntervalCollection.d.ts +13 -5
  28. package/dist/sharedIntervalCollection.d.ts.map +1 -1
  29. package/dist/sharedIntervalCollection.js +16 -12
  30. package/dist/sharedIntervalCollection.js.map +1 -1
  31. package/lib/{mapKernel.d.ts → defaultMap.d.ts} +21 -145
  32. package/lib/defaultMap.d.ts.map +1 -0
  33. package/lib/defaultMap.js +313 -0
  34. package/lib/defaultMap.js.map +1 -0
  35. package/lib/{mapKernelInterfaces.d.ts → defaultMapInterfaces.d.ts} +9 -51
  36. package/lib/defaultMapInterfaces.d.ts.map +1 -0
  37. package/lib/{mapKernelInterfaces.js → defaultMapInterfaces.js} +1 -1
  38. package/lib/defaultMapInterfaces.js.map +1 -0
  39. package/lib/index.d.ts +1 -1
  40. package/lib/index.d.ts.map +1 -1
  41. package/lib/index.js.map +1 -1
  42. package/lib/intervalCollection.d.ts +12 -3
  43. package/lib/intervalCollection.d.ts.map +1 -1
  44. package/lib/intervalCollection.js +44 -39
  45. package/lib/intervalCollection.js.map +1 -1
  46. package/lib/localValues.d.ts +7 -86
  47. package/lib/localValues.d.ts.map +1 -1
  48. package/lib/localValues.js +1 -129
  49. package/lib/localValues.js.map +1 -1
  50. package/lib/packageVersion.d.ts +1 -1
  51. package/lib/packageVersion.js +1 -1
  52. package/lib/packageVersion.js.map +1 -1
  53. package/lib/sequence.d.ts +5 -1
  54. package/lib/sequence.d.ts.map +1 -1
  55. package/lib/sequence.js +23 -23
  56. package/lib/sequence.js.map +1 -1
  57. package/lib/sharedIntervalCollection.d.ts +13 -5
  58. package/lib/sharedIntervalCollection.d.ts.map +1 -1
  59. package/lib/sharedIntervalCollection.js +16 -12
  60. package/lib/sharedIntervalCollection.js.map +1 -1
  61. package/package.json +23 -18
  62. package/src/defaultMap.ts +453 -0
  63. package/src/{mapKernelInterfaces.ts → defaultMapInterfaces.ts} +14 -59
  64. package/src/index.ts +1 -1
  65. package/src/intervalCollection.ts +58 -43
  66. package/src/localValues.ts +6 -154
  67. package/src/packageVersion.ts +1 -1
  68. package/src/sequence.ts +32 -33
  69. package/src/sharedIntervalCollection.ts +22 -25
  70. package/dist/mapKernel.d.ts.map +0 -1
  71. package/dist/mapKernel.js +0 -599
  72. package/dist/mapKernel.js.map +0 -1
  73. package/dist/mapKernelInterfaces.d.ts.map +0 -1
  74. package/dist/mapKernelInterfaces.js.map +0 -1
  75. package/lib/mapKernel.d.ts.map +0 -1
  76. package/lib/mapKernel.js +0 -595
  77. package/lib/mapKernel.js.map +0 -1
  78. package/lib/mapKernelInterfaces.d.ts.map +0 -1
  79. package/lib/mapKernelInterfaces.js.map +0 -1
  80. package/src/mapKernel.ts +0 -850
@@ -0,0 +1,453 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { IFluidHandle } from "@fluidframework/core-interfaces";
7
+ import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
8
+ import {
9
+ IFluidSerializer,
10
+ makeHandlesSerializable,
11
+ parseHandles,
12
+ ValueType,
13
+ } from "@fluidframework/shared-object-base";
14
+ import { assert, TypedEventEmitter } from "@fluidframework/common-utils";
15
+ import {
16
+ makeSerializable,
17
+ ValueTypeLocalValue,
18
+ } from "./localValues";
19
+ import {
20
+ ISerializableValue,
21
+ ISerializedValue,
22
+ IValueChanged,
23
+ IValueOpEmitter,
24
+ IValueType,
25
+ IValueTypeOperationValue,
26
+ ISharedDefaultMapEvents,
27
+ } from "./defaultMapInterfaces";
28
+
29
+ /**
30
+ * Defines the means to process and submit a given op on a map.
31
+ */
32
+ interface IMapMessageHandler {
33
+ /**
34
+ * Apply the given operation.
35
+ * @param op - The map operation to apply
36
+ * @param local - Whether the message originated from the local client
37
+ * @param message - The full message. Not provided for stashed ops.
38
+ * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
39
+ * For messages from a remote client, this will be undefined.
40
+ */
41
+ process(
42
+ op: IMapOperation,
43
+ local: boolean,
44
+ message: ISequencedDocumentMessage | undefined,
45
+ localOpMetadata: IMapMessageLocalMetadata,
46
+ ): void;
47
+
48
+ /**
49
+ * Communicate the operation to remote clients.
50
+ * @param op - The map operation to submit
51
+ */
52
+ submit(op: IMapOperation): void;
53
+
54
+ getStashedOpLocalMetadata(op: IMapOperation): unknown;
55
+ }
56
+
57
+ export interface IMapMessageLocalMetadata {
58
+ lastProcessedSeq: number;
59
+ }
60
+
61
+ /**
62
+ * Describes an operation specific to a value type.
63
+ */
64
+ export interface IMapValueTypeOperation {
65
+ /**
66
+ * String identifier of the operation type.
67
+ */
68
+ type: "act";
69
+
70
+ /**
71
+ * Map key being modified.
72
+ */
73
+ key: string;
74
+
75
+ /**
76
+ * Value of the operation, specific to the value type.
77
+ * @alpha
78
+ */
79
+ value: IValueTypeOperationValue;
80
+ }
81
+
82
+ /**
83
+ * Description of a map delta operation
84
+ */
85
+ export type IMapOperation = IMapValueTypeOperation;
86
+
87
+ /**
88
+ * Defines the in-memory object structure to be used for the conversion to/from serialized.
89
+ * Directly used in JSON.stringify, direct result from JSON.parse
90
+ */
91
+ export interface IMapDataObjectSerializable {
92
+ [key: string]: ISerializableValue;
93
+ }
94
+
95
+ export interface IMapDataObjectSerialized {
96
+ [key: string]: ISerializedValue;
97
+ }
98
+
99
+ /**
100
+ * A DefaultMap is a map-like distributed data structure, supporting operations on values stored by
101
+ * string key locations.
102
+ *
103
+ * Creation of values is implicit on access (either via `get` or a remote op application referring to
104
+ * a collection that wasn't previously known)
105
+ */
106
+ export class DefaultMap<T> {
107
+ /**
108
+ * The number of key/value pairs stored in the map.
109
+ */
110
+ public get size(): number {
111
+ return this.data.size;
112
+ }
113
+
114
+ /**
115
+ * Mapping of op types to message handlers.
116
+ */
117
+ private readonly messageHandlers: ReadonlyMap<string, IMapMessageHandler> = new Map();
118
+
119
+ /**
120
+ * The in-memory data the map is storing.
121
+ */
122
+ private readonly data = new Map<string, ValueTypeLocalValue<T>>();
123
+
124
+ private lastProcessedSeq: number = -1;
125
+
126
+ /**
127
+ * Create a new default map.
128
+ * @param serializer - The serializer to serialize / parse handles
129
+ * @param handle - The handle of the shared object using the kernel
130
+ * @param submitMessage - A callback to submit a message through the shared object
131
+ * @param type - The value type to create at values of this map
132
+ * @param eventEmitter - The object that will emit map events
133
+ */
134
+ constructor(
135
+ private readonly serializer: IFluidSerializer,
136
+ private readonly handle: IFluidHandle,
137
+ private readonly submitMessage: (op: any, localOpMetadata: IMapMessageLocalMetadata) => void,
138
+ private readonly type: IValueType<T>,
139
+ public readonly eventEmitter = new TypedEventEmitter<ISharedDefaultMapEvents>(),
140
+ ) {
141
+ this.messageHandlers = this.getMessageHandlers();
142
+ }
143
+
144
+ /**
145
+ * Get an iterator over the keys in this map.
146
+ * @returns The iterator
147
+ */
148
+ public keys(): IterableIterator<string> {
149
+ return this.data.keys();
150
+ }
151
+
152
+ /**
153
+ * Get an iterator over the entries in this map.
154
+ * @returns The iterator
155
+ */
156
+ public entries(): IterableIterator<[string, any]> {
157
+ const localEntriesIterator = this.data.entries();
158
+ const iterator = {
159
+ next(): IteratorResult<[string, any]> {
160
+ const nextVal = localEntriesIterator.next();
161
+ if (nextVal.done) {
162
+ return { value: undefined, done: true };
163
+ } else {
164
+ // Unpack the stored value
165
+ return { value: [nextVal.value[0], nextVal.value[1].value], done: false };
166
+ }
167
+ },
168
+ [Symbol.iterator]() {
169
+ return this;
170
+ },
171
+ };
172
+ return iterator;
173
+ }
174
+
175
+ /**
176
+ * Get an iterator over the values in this map.
177
+ * @returns The iterator
178
+ */
179
+ public values(): IterableIterator<any> {
180
+ const localValuesIterator = this.data.values();
181
+ const iterator = {
182
+ next(): IteratorResult<any> {
183
+ const nextVal = localValuesIterator.next();
184
+ if (nextVal.done) {
185
+ return { value: undefined, done: true };
186
+ } else {
187
+ // Unpack the stored value
188
+ return { value: nextVal.value.value, done: false };
189
+ }
190
+ },
191
+ [Symbol.iterator]() {
192
+ return this;
193
+ },
194
+ };
195
+ return iterator;
196
+ }
197
+
198
+ /**
199
+ * Get an iterator over the entries in this map.
200
+ * @returns The iterator
201
+ */
202
+ public [Symbol.iterator](): IterableIterator<[string, any]> {
203
+ return this.entries();
204
+ }
205
+
206
+ /**
207
+ * Executes the given callback on each entry in the map.
208
+ * @param callbackFn - Callback function
209
+ */
210
+ public forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void {
211
+ this.data.forEach((localValue, key, m) => {
212
+ callbackFn(localValue.value, key, m);
213
+ });
214
+ }
215
+
216
+ /**
217
+ * {@inheritDoc ISharedMap.get}
218
+ */
219
+ public get(key: string): T {
220
+ let localValue = this.data.get(key);
221
+ if (!this.data.has(key)) {
222
+ localValue = this.createCore(key, true);
223
+ }
224
+ return localValue.value;
225
+ }
226
+
227
+ /**
228
+ * Check if a key exists in the map.
229
+ * @param key - The key to check
230
+ * @returns True if the key exists, false otherwise
231
+ */
232
+ public has(key: string): boolean {
233
+ return this.data.has(key);
234
+ }
235
+
236
+ /**
237
+ * Serializes the data stored in the shared map to a JSON string
238
+ * @param serializer - The serializer to use to serialize handles in its values.
239
+ * @returns A JSON string containing serialized map data
240
+ */
241
+ public getSerializedStorage(serializer: IFluidSerializer): IMapDataObjectSerialized {
242
+ const serializableMapData: IMapDataObjectSerialized = {};
243
+ this.data.forEach((localValue, key) => {
244
+ serializableMapData[key] = localValue.makeSerialized(serializer, this.handle);
245
+ });
246
+ return serializableMapData;
247
+ }
248
+
249
+ public getSerializableStorage(serializer: IFluidSerializer): IMapDataObjectSerializable {
250
+ const serializableMapData: IMapDataObjectSerializable = {};
251
+ this.data.forEach((localValue, key) => {
252
+ serializableMapData[key] = makeSerializable(localValue, serializer, this.handle);
253
+ });
254
+ return serializableMapData;
255
+ }
256
+
257
+ public serialize(serializer: IFluidSerializer): string {
258
+ return JSON.stringify(this.getSerializableStorage(serializer));
259
+ }
260
+
261
+ /**
262
+ * Populate the kernel with the given map data.
263
+ * @param data - A JSON string containing serialized map data
264
+ */
265
+ public populateFromSerializable(json: IMapDataObjectSerializable): void {
266
+ for (const [key, serializable] of Object.entries(json)) {
267
+ // Back-compat: legacy documents may have handles to an intervalCollection map kernel.
268
+ // These collections should be empty, and ValueTypes are no longer supported.
269
+ if (serializable.type === ValueType[ValueType.Plain]
270
+ || serializable.type === ValueType[ValueType.Shared]) {
271
+ continue;
272
+ }
273
+
274
+ const localValue = {
275
+ key,
276
+ value: this.makeLocal(key, serializable),
277
+ };
278
+
279
+ this.data.set(localValue.key, localValue.value);
280
+ }
281
+ }
282
+
283
+ public populate(json: string): void {
284
+ this.populateFromSerializable(JSON.parse(json) as IMapDataObjectSerializable);
285
+ }
286
+
287
+ /**
288
+ * Submit the given op if a handler is registered.
289
+ * @param op - The operation to attempt to submit
290
+ * @param localOpMetadata - The local metadata associated with the op. This is kept locally by the runtime
291
+ * and not sent to the server. This will be sent back when this message is received back from the server. This is
292
+ * also sent if we are asked to resubmit the message.
293
+ * @returns True if the operation was submitted, false otherwise.
294
+ */
295
+ public trySubmitMessage(op: any, localOpMetadata: IMapMessageLocalMetadata): boolean {
296
+ const type: string = op.type;
297
+ const handler = this.messageHandlers.get(type);
298
+ if (handler !== undefined) {
299
+ const mapLocalMetadata: Partial<IMapMessageLocalMetadata> = localOpMetadata;
300
+ // we don't know how to rebase these operations, so if any other op has come in
301
+ // we will fail.
302
+ if (this.lastProcessedSeq !== mapLocalMetadata?.lastProcessedSeq) {
303
+ throw new Error("SharedInterval does not support reconnect in presence of external changes");
304
+ }
305
+ handler.submit(op as IMapOperation);
306
+ return true;
307
+ }
308
+ return false;
309
+ }
310
+
311
+ public tryGetStashedOpLocalMetadata(op: any): unknown {
312
+ const type: string = op.type;
313
+ if (this.messageHandlers.has(type)) {
314
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
315
+ return this.messageHandlers.get(type)!.getStashedOpLocalMetadata(op as IMapOperation);
316
+ }
317
+ throw new Error("no apply stashed op handler");
318
+ }
319
+
320
+ /**
321
+ * Process the given op if a handler is registered.
322
+ * @param message - The message to process
323
+ * @param local - Whether the message originated from the local client
324
+ * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
325
+ * For messages from a remote client, this will be undefined.
326
+ * @returns True if the operation was processed, false otherwise.
327
+ */
328
+ public tryProcessMessage(
329
+ op: IMapOperation,
330
+ local: boolean,
331
+ message: ISequencedDocumentMessage | undefined,
332
+ localOpMetadata: unknown,
333
+ ): boolean {
334
+ // track the seq of every incoming message, so we can detect if any
335
+ // changes happened during a resubmit
336
+ this.lastProcessedSeq = message.sequenceNumber;
337
+ const handler = this.messageHandlers.get(op.type);
338
+ if (handler !== undefined) {
339
+ handler.process(op, local, message, localOpMetadata as IMapMessageLocalMetadata);
340
+ return true;
341
+ }
342
+ return false;
343
+ }
344
+
345
+ /**
346
+ * Initializes a default ValueType at the provided key.
347
+ * Should be used when a map operation incurs creation.
348
+ * @param key - The key being initialized
349
+ * @param local - Whether the message originated from the local client
350
+ */
351
+ private createCore(key: string, local: boolean): ValueTypeLocalValue<T> {
352
+ const localValue = new ValueTypeLocalValue(
353
+ this.type.factory.load(this.makeMapValueOpEmitter(key), undefined),
354
+ this.type,
355
+ );
356
+ const previousValue = this.data.get(key);
357
+ this.data.set(key, localValue);
358
+ const event: IValueChanged = { key, previousValue };
359
+ this.eventEmitter.emit("create", event, local, this.eventEmitter);
360
+ return localValue;
361
+ }
362
+
363
+ /**
364
+ * The remote ISerializableValue we're receiving (either as a result of a load or an incoming set op) will
365
+ * have the information we need to create a real object, but will not be the real object yet. For example,
366
+ * we might know it's a map and the map's ID but not have the actual map or its data yet. makeLocal's
367
+ * job is to convert that information into a real object for local usage.
368
+ * @param key - The key that the caller intends to store the local value into (used for ops later). But
369
+ * doesn't actually store the local value into that key. So better not lie!
370
+ * @param serializable - The remote information that we can convert into a real object
371
+ * @returns The local value that was produced
372
+ */
373
+ private makeLocal(key: string, serializable: ISerializableValue): ValueTypeLocalValue<T> {
374
+ assert(serializable.type !== ValueType[ValueType.Plain] && serializable.type !== ValueType[ValueType.Shared],
375
+ 0x2e1 /* "Support for plain value types removed." */);
376
+
377
+ serializable.value = parseHandles(serializable.value, this.serializer);
378
+ const localValue = this.type.factory.load(
379
+ this.makeMapValueOpEmitter(key),
380
+ serializable.value,
381
+ );
382
+ return new ValueTypeLocalValue(localValue, this.type);
383
+ }
384
+
385
+ /**
386
+ * Get the message handlers for the map.
387
+ * @returns A map of string op names to IMapMessageHandlers for those ops
388
+ */
389
+ private getMessageHandlers() {
390
+ const messageHandlers = new Map<string, IMapMessageHandler>();
391
+ // Ops with type "act" describe actions taken by custom value type handlers of whatever item is
392
+ // being addressed. These custom handlers can be retrieved from the ValueTypeLocalValue which has
393
+ // stashed its valueType (and therefore its handlers). We also emit a valueChanged for anyone
394
+ // watching for manipulations of that item.
395
+ messageHandlers.set(
396
+ "act",
397
+ {
398
+ process: (op: IMapValueTypeOperation, local, message, localOpMetadata) => {
399
+ const localValue = this.data.get(op.key) ?? this.createCore(op.key, local);
400
+ const handler = localValue.getOpHandler(op.value.opName);
401
+ const previousValue = localValue.value;
402
+ const translatedValue = parseHandles(
403
+ op.value.value,
404
+ this.serializer);
405
+ handler.process(previousValue, translatedValue, local, message);
406
+ const event: IValueChanged = { key: op.key, previousValue };
407
+ this.eventEmitter.emit("valueChanged", event, local, message, this.eventEmitter);
408
+ },
409
+ submit: (op: IMapValueTypeOperation) => {
410
+ this.submitMessage(
411
+ op,
412
+ { lastProcessedSeq: this.lastProcessedSeq },
413
+ );
414
+ },
415
+ getStashedOpLocalMetadata: (op: IMapValueTypeOperation) => {
416
+ assert(false, 0x016 /* "apply stashed op not implemented for custom value type ops" */);
417
+ },
418
+ });
419
+
420
+ return messageHandlers;
421
+ }
422
+
423
+ /**
424
+ * Create an emitter for a value type to emit ops from the given key.
425
+ * @alpha
426
+ * @param key - The key of the map that the value type will be stored on
427
+ * @returns A value op emitter for the given key
428
+ */
429
+ private makeMapValueOpEmitter(key: string): IValueOpEmitter {
430
+ const emit = (opName: string, previousValue: any, params: any) => {
431
+ const translatedParams = makeHandlesSerializable(
432
+ params,
433
+ this.serializer,
434
+ this.handle);
435
+
436
+ const op: IMapValueTypeOperation = {
437
+ key,
438
+ type: "act",
439
+ value: {
440
+ opName,
441
+ value: translatedParams,
442
+ },
443
+ };
444
+ // Send the localOpMetadata as undefined because we don't care about the ack.
445
+ this.submitMessage(op, { lastProcessedSeq: this.lastProcessedSeq });
446
+
447
+ const event: IValueChanged = { key, previousValue };
448
+ this.eventEmitter.emit("valueChanged", event, true, null, this.eventEmitter);
449
+ };
450
+
451
+ return { emit };
452
+ }
453
+ }
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
7
- import { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-object-base";
7
+ import { ISharedObjectEvents } from "@fluidframework/shared-object-base";
8
8
  import { IEventThisPlaceHolder } from "@fluidframework/common-definitions";
9
9
 
10
10
  /**
@@ -74,7 +74,12 @@ export interface IValueOperation<T> {
74
74
  * @param message - The operation itself
75
75
  * @alpha
76
76
  */
77
- process(value: T, params: any, local: boolean, message: ISequencedDocumentMessage | undefined);
77
+ process(
78
+ value: T,
79
+ params: any,
80
+ local: boolean,
81
+ message: ISequencedDocumentMessage | undefined
82
+ );
78
83
  }
79
84
 
80
85
  /**
@@ -100,73 +105,23 @@ export interface IValueType<T> {
100
105
  ops: Map<string, IValueOperation<T>>;
101
106
  }
102
107
 
103
- /**
104
- * Container types that are able to create value types as contained values.
105
- */
106
- export interface IValueTypeCreator {
107
- /**
108
- * Create a new value type at the given key.
109
- * @param key - Key to create the value type at
110
- * @param type - Type of the value type to create
111
- * @param params - Initialization params for the value type
112
- * @alpha
113
- */
114
- createValueType(key: string, type: string, params: any): this;
115
- }
116
-
117
- export interface ISharedMapEvents extends ISharedObjectEvents {
108
+ export interface ISharedDefaultMapEvents extends ISharedObjectEvents {
118
109
  (event: "valueChanged" | "create", listener: (
119
110
  changed: IValueChanged,
120
111
  local: boolean,
121
112
  target: IEventThisPlaceHolder) => void);
122
- (event: "clear", listener: (
123
- local: boolean,
124
- target: IEventThisPlaceHolder
125
- ) => void);
126
- }
127
-
128
- /**
129
- * Shared map interface
130
- */
131
- export interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string, any> {
132
- /**
133
- * Retrieves the given key from the map.
134
- * @param key - Key to retrieve from
135
- * @returns The stored value, or undefined if the key is not set
136
- */
137
- get<T = any>(key: string): T | undefined;
138
-
139
- /**
140
- * A form of get except it will only resolve the promise once the key exists in the map.
141
- * @param key - Key to retrieve from
142
- * @returns The stored value once available
143
- */
144
- wait<T = any>(key: string): Promise<T>;
145
-
146
- /**
147
- * Sets the value stored at key to the provided value.
148
- * @param key - Key to set at
149
- * @param value - Value to set
150
- * @returns The ISharedMap itself
151
- */
152
- set<T = any>(key: string, value: T): this;
153
-
154
113
  }
155
114
 
156
115
  /**
157
- * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use
116
+ * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use
158
117
  * ISerializableValue.type to understand whether they're storing a Plain JS object, a SharedObject, or a value type.
159
118
  * Note that the in-memory equivalent of ISerializableValue is ILocalValue (similarly holding a type, but with
160
- * the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to
161
- * JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate)
119
+ * the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to
120
+ * JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate)
162
121
  * and ops (set).
163
- * If type is Plain, it must be a plain JS object that can survive a JSON.stringify/parse. E.g. a URL object will
164
- * just get stringified to a URL string and not rehydrate as a URL object on the other side. It may contain members
165
- * that are ISerializedHandle (the serialized form of a handle).
166
- * If type is a value type then it must be amongst the types registered via registerValueType or we won't know how
167
- * to serialize/deserialize it (we rely on its factory via .load() and .store()). Its value will be type-dependent.
168
- * If type is Shared, then the in-memory value will just be a reference to the SharedObject. Its value will be a
169
- * channel ID. This type is legacy and deprecated.
122
+ *
123
+ * The DefaultMap impelmentation for sequence has been specialized to only support a single ValueType, which serializes
124
+ * and deserializes via .store() and .load().
170
125
  */
171
126
  export interface ISerializableValue {
172
127
  /**
package/src/index.ts CHANGED
@@ -17,7 +17,7 @@ export {
17
17
  } from "./intervalCollection";
18
18
  export {
19
19
  IValueOpEmitter,
20
- } from "./mapKernelInterfaces";
20
+ } from "./defaultMapInterfaces";
21
21
  export * from "./sharedString";
22
22
  export * from "./sequence";
23
23
  export * from "./sequenceFactory";