@fluidframework/map 0.54.0 → 0.55.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 (50) hide show
  1. package/.eslintrc.js +1 -1
  2. package/dist/directory.d.ts +6 -5
  3. package/dist/directory.d.ts.map +1 -1
  4. package/dist/directory.js +9 -7
  5. package/dist/directory.js.map +1 -1
  6. package/dist/interfaces.d.ts +2 -0
  7. package/dist/interfaces.d.ts.map +1 -1
  8. package/dist/interfaces.js.map +1 -1
  9. package/dist/localValues.d.ts +2 -1
  10. package/dist/localValues.d.ts.map +1 -1
  11. package/dist/localValues.js.map +1 -1
  12. package/dist/map.d.ts +6 -5
  13. package/dist/map.d.ts.map +1 -1
  14. package/dist/map.js +9 -10
  15. package/dist/map.js.map +1 -1
  16. package/dist/mapKernel.d.ts +3 -1
  17. package/dist/mapKernel.d.ts.map +1 -1
  18. package/dist/mapKernel.js +1 -0
  19. package/dist/mapKernel.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/lib/directory.d.ts +6 -5
  24. package/lib/directory.d.ts.map +1 -1
  25. package/lib/directory.js +9 -7
  26. package/lib/directory.js.map +1 -1
  27. package/lib/interfaces.d.ts +2 -0
  28. package/lib/interfaces.d.ts.map +1 -1
  29. package/lib/interfaces.js.map +1 -1
  30. package/lib/localValues.d.ts +2 -1
  31. package/lib/localValues.d.ts.map +1 -1
  32. package/lib/localValues.js.map +1 -1
  33. package/lib/map.d.ts +6 -5
  34. package/lib/map.d.ts.map +1 -1
  35. package/lib/map.js +10 -11
  36. package/lib/map.js.map +1 -1
  37. package/lib/mapKernel.d.ts +3 -1
  38. package/lib/mapKernel.d.ts.map +1 -1
  39. package/lib/mapKernel.js +1 -0
  40. package/lib/mapKernel.js.map +1 -1
  41. package/lib/packageVersion.d.ts +1 -1
  42. package/lib/packageVersion.js +1 -1
  43. package/lib/packageVersion.js.map +1 -1
  44. package/package.json +19 -17
  45. package/src/directory.ts +12 -11
  46. package/src/interfaces.ts +2 -0
  47. package/src/localValues.ts +1 -3
  48. package/src/map.ts +12 -16
  49. package/src/mapKernel.ts +3 -2
  50. package/src/packageVersion.ts +1 -1
package/src/directory.ts CHANGED
@@ -4,12 +4,9 @@
4
4
  */
5
5
 
6
6
  import { assert,TypedEventEmitter } from "@fluidframework/common-utils";
7
- import { IFluidSerializer } from "@fluidframework/core-interfaces";
8
7
  import { readAndParse } from "@fluidframework/driver-utils";
9
- import { addBlobToTree } from "@fluidframework/protocol-base";
10
8
  import {
11
9
  ISequencedDocumentMessage,
12
- ITree,
13
10
  MessageType,
14
11
  } from "@fluidframework/protocol-definitions";
15
12
  import {
@@ -19,7 +16,9 @@ import {
19
16
  IChannelServices,
20
17
  IChannelFactory,
21
18
  } from "@fluidframework/datastore-definitions";
22
- import { SharedObject, ValueType } from "@fluidframework/shared-object-base";
19
+ import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
20
+ import { IFluidSerializer, SharedObject, ValueType } from "@fluidframework/shared-object-base";
21
+ import { SummaryTreeBuilder } from "@fluidframework/runtime-utils";
23
22
  import * as path from "path-browserify";
24
23
  import {
25
24
  IDirectory,
@@ -204,10 +203,10 @@ export interface IDirectoryNewStorageFormat {
204
203
  content: IDirectoryDataObject;
205
204
  }
206
205
 
207
- function serializeDirectory(root: SubDirectory, serializer: IFluidSerializer): ITree {
206
+ function serializeDirectory(root: SubDirectory, serializer: IFluidSerializer): ISummaryTreeWithStats {
208
207
  const MinValueSizeSeparateSnapshotBlob = 8 * 1024;
209
208
 
210
- const tree: ITree = { entries: [] };
209
+ const builder = new SummaryTreeBuilder();
211
210
  let counter = 0;
212
211
  const blobs: string[] = [];
213
212
 
@@ -241,7 +240,7 @@ function serializeDirectory(root: SubDirectory, serializer: IFluidSerializer): I
241
240
  const blobName = `blob${counter}`;
242
241
  counter++;
243
242
  blobs.push(blobName);
244
- addBlobToTree(tree, blobName, extraContent);
243
+ builder.addBlob(blobName, JSON.stringify(extraContent));
245
244
  } else {
246
245
  currentSubDirObject.storage[key] = result;
247
246
  }
@@ -261,9 +260,9 @@ function serializeDirectory(root: SubDirectory, serializer: IFluidSerializer): I
261
260
  blobs,
262
261
  content,
263
262
  };
264
- addBlobToTree(tree, snapshotFileName, newFormat);
263
+ builder.addBlob(snapshotFileName, JSON.stringify(newFormat));
265
264
 
266
- return tree;
265
+ return builder.getSummaryTree();
267
266
  }
268
267
 
269
268
  /**
@@ -419,6 +418,7 @@ export class SharedDirectory extends SharedObject<ISharedDirectoryEvents> implem
419
418
 
420
419
  /**
421
420
  * {@inheritDoc IDirectory.wait}
421
+ * @deprecated 0.55 - This method will be removed in an upcoming release. See BREAKING.md for migration options.
422
422
  */
423
423
  public async wait<T = any>(key: string): Promise<T> {
424
424
  return this.root.wait<T>(key);
@@ -560,10 +560,10 @@ export class SharedDirectory extends SharedObject<ISharedDirectoryEvents> implem
560
560
  }
561
561
 
562
562
  /**
563
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.snapshotCore}
563
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}
564
564
  * @internal
565
565
  */
566
- protected snapshotCore(serializer: IFluidSerializer): ITree {
566
+ protected summarizeCore(serializer: IFluidSerializer, fullTree: boolean): ISummaryTreeWithStats {
567
567
  return serializeDirectory(this.root, serializer);
568
568
  }
569
569
 
@@ -901,6 +901,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
901
901
 
902
902
  /**
903
903
  * {@inheritDoc IDirectory.wait}
904
+ * @deprecated 0.55 - This method will be removed in an upcoming release. See BREAKING.md for migration options.
904
905
  */
905
906
  public async wait<T = any>(key: string): Promise<T> {
906
907
  // Return immediately if the value already exists
package/src/interfaces.ts CHANGED
@@ -44,6 +44,7 @@ export interface IDirectory extends Map<string, any>, IEventProvider<IDirectoryE
44
44
  * A form of get except it will only resolve the promise once the key exists in the directory.
45
45
  * @param key - Key to retrieve from
46
46
  * @returns The stored value once available
47
+ * @deprecated 0.55 - This method will be removed in an upcoming release. See BREAKING.md for migration options.
47
48
  */
48
49
  wait<T = any>(key: string): Promise<T>;
49
50
 
@@ -268,6 +269,7 @@ export interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string,
268
269
  * A form of get except it will only resolve the promise once the key exists in the map.
269
270
  * @param key - Key to retrieve from
270
271
  * @returns The stored value once available
272
+ * @deprecated 0.55 - This method will be removed in an upcoming release. See BREAKING.md for migration options.
271
273
  */
272
274
  wait<T = any>(key: string): Promise<T>;
273
275
 
@@ -3,12 +3,10 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ import { IFluidHandle } from "@fluidframework/core-interfaces";
6
7
  import {
7
- IFluidHandle,
8
8
  IFluidSerializer,
9
9
  ISerializedHandle,
10
- } from "@fluidframework/core-interfaces";
11
- import {
12
10
  parseHandles,
13
11
  serializeHandles,
14
12
  SharedObject,
package/src/map.ts CHANGED
@@ -3,13 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { IFluidSerializer } from "@fluidframework/core-interfaces";
7
- import { addBlobToTree } from "@fluidframework/protocol-base";
8
- import {
9
- ISequencedDocumentMessage,
10
- ITree,
11
- MessageType,
12
- } from "@fluidframework/protocol-definitions";
6
+ import { ISequencedDocumentMessage, MessageType } from "@fluidframework/protocol-definitions";
13
7
  import {
14
8
  IChannelAttributes,
15
9
  IFluidDataStoreRuntime,
@@ -17,10 +11,13 @@ import {
17
11
  IChannelServices,
18
12
  IChannelFactory,
19
13
  } from "@fluidframework/datastore-definitions";
14
+ import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
20
15
  import { readAndParse } from "@fluidframework/driver-utils";
21
16
  import {
17
+ IFluidSerializer,
22
18
  SharedObject,
23
19
  } from "@fluidframework/shared-object-base";
20
+ import { SummaryTreeBuilder } from "@fluidframework/runtime-utils";
24
21
  import {
25
22
  ISharedMap,
26
23
  ISharedMapEvents,
@@ -213,6 +210,7 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
213
210
 
214
211
  /**
215
212
  * {@inheritDoc ISharedMap.wait}
213
+ * @deprecated 0.55 - This method will be removed in an upcoming release. See BREAKING.md for migration options.
216
214
  */
217
215
  public async wait<T = any>(key: string): Promise<T> {
218
216
  return this.kernel.wait<T>(key);
@@ -252,18 +250,16 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
252
250
  }
253
251
 
254
252
  /**
255
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.snapshotCore}
253
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}
256
254
  * @internal
257
255
  */
258
- protected snapshotCore(serializer: IFluidSerializer): ITree {
256
+ protected summarizeCore(serializer: IFluidSerializer, fullTree: boolean): ISummaryTreeWithStats {
259
257
  let currentSize = 0;
260
258
  let counter = 0;
261
259
  let headerBlob: IMapDataObjectSerializable = {};
262
260
  const blobs: string[] = [];
263
261
 
264
- const tree: ITree = {
265
- entries: [],
266
- };
262
+ const builder = new SummaryTreeBuilder();
267
263
 
268
264
  const data = this.kernel.getSerializedStorage(serializer);
269
265
 
@@ -296,7 +292,7 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
296
292
  value: JSON.parse(value.value),
297
293
  },
298
294
  };
299
- addBlobToTree(tree, blobName, content);
295
+ builder.addBlob(blobName, JSON.stringify(content));
300
296
  } else {
301
297
  currentSize += value.type.length + 21; // Approximation cost of property header
302
298
  if (value.value) {
@@ -307,7 +303,7 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
307
303
  const blobName = `blob${counter}`;
308
304
  counter++;
309
305
  blobs.push(blobName);
310
- addBlobToTree(tree, blobName, headerBlob);
306
+ builder.addBlob(blobName, JSON.stringify(headerBlob));
311
307
  headerBlob = {};
312
308
  currentSize = 0;
313
309
  }
@@ -322,9 +318,9 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
322
318
  blobs,
323
319
  content: headerBlob,
324
320
  };
325
- addBlobToTree(tree, snapshotFileName, header);
321
+ builder.addBlob(snapshotFileName, JSON.stringify(header));
326
322
 
327
- return tree;
323
+ return builder.getSummaryTree();
328
324
  }
329
325
 
330
326
  /**
package/src/mapKernel.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { IFluidHandle, IFluidSerializer } from "@fluidframework/core-interfaces";
7
- import { ValueType } from "@fluidframework/shared-object-base";
6
+ import { IFluidHandle } from "@fluidframework/core-interfaces";
7
+ import { IFluidSerializer, ValueType } from "@fluidframework/shared-object-base";
8
8
  import { assert, TypedEventEmitter } from "@fluidframework/common-utils";
9
9
  import {
10
10
  ISerializableValue,
@@ -262,6 +262,7 @@ export class MapKernel {
262
262
 
263
263
  /**
264
264
  * {@inheritDoc ISharedMap.wait}
265
+ * @deprecated 0.55 - This method will be removed in an upcoming release. See BREAKING.md for migration options.
265
266
  */
266
267
  public async wait<T = any>(key: string): Promise<T> {
267
268
  // Return immediately if the value already exists
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/map";
9
- export const pkgVersion = "0.54.0";
9
+ export const pkgVersion = "0.55.0";