@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.
- package/.eslintrc.js +1 -1
- package/dist/directory.d.ts +6 -5
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +9 -7
- package/dist/directory.js.map +1 -1
- package/dist/interfaces.d.ts +2 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/localValues.d.ts +2 -1
- package/dist/localValues.d.ts.map +1 -1
- package/dist/localValues.js.map +1 -1
- package/dist/map.d.ts +6 -5
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +9 -10
- package/dist/map.js.map +1 -1
- package/dist/mapKernel.d.ts +3 -1
- package/dist/mapKernel.d.ts.map +1 -1
- package/dist/mapKernel.js +1 -0
- package/dist/mapKernel.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/lib/directory.d.ts +6 -5
- package/lib/directory.d.ts.map +1 -1
- package/lib/directory.js +9 -7
- package/lib/directory.js.map +1 -1
- package/lib/interfaces.d.ts +2 -0
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/localValues.d.ts +2 -1
- package/lib/localValues.d.ts.map +1 -1
- package/lib/localValues.js.map +1 -1
- package/lib/map.d.ts +6 -5
- package/lib/map.d.ts.map +1 -1
- package/lib/map.js +10 -11
- package/lib/map.js.map +1 -1
- package/lib/mapKernel.d.ts +3 -1
- package/lib/mapKernel.d.ts.map +1 -1
- package/lib/mapKernel.js +1 -0
- package/lib/mapKernel.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/package.json +19 -17
- package/src/directory.ts +12 -11
- package/src/interfaces.ts +2 -0
- package/src/localValues.ts +1 -3
- package/src/map.ts +12 -16
- package/src/mapKernel.ts +3 -2
- 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 {
|
|
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):
|
|
206
|
+
function serializeDirectory(root: SubDirectory, serializer: IFluidSerializer): ISummaryTreeWithStats {
|
|
208
207
|
const MinValueSizeSeparateSnapshotBlob = 8 * 1024;
|
|
209
208
|
|
|
210
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
263
|
+
builder.addBlob(snapshotFileName, JSON.stringify(newFormat));
|
|
265
264
|
|
|
266
|
-
return
|
|
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.
|
|
563
|
+
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}
|
|
564
564
|
* @internal
|
|
565
565
|
*/
|
|
566
|
-
protected
|
|
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
|
|
package/src/localValues.ts
CHANGED
|
@@ -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 {
|
|
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.
|
|
253
|
+
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}
|
|
256
254
|
* @internal
|
|
257
255
|
*/
|
|
258
|
-
protected
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
321
|
+
builder.addBlob(snapshotFileName, JSON.stringify(header));
|
|
326
322
|
|
|
327
|
-
return
|
|
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
|
|
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
|
package/src/packageVersion.ts
CHANGED