@fluidframework/map 0.59.4000 → 1.0.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/map",
3
- "version": "0.59.4000",
3
+ "version": "1.0.1",
4
4
  "description": "Distributed map",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -62,45 +62,32 @@
62
62
  "dependencies": {
63
63
  "@fluidframework/common-definitions": "^0.20.1",
64
64
  "@fluidframework/common-utils": "^0.32.1",
65
- "@fluidframework/container-utils": "^0.59.4000",
66
- "@fluidframework/core-interfaces": "^0.43.1000",
67
- "@fluidframework/datastore-definitions": "^0.59.4000",
68
- "@fluidframework/driver-utils": "^0.59.4000",
65
+ "@fluidframework/container-utils": "^1.0.1",
66
+ "@fluidframework/core-interfaces": "^1.0.1",
67
+ "@fluidframework/datastore-definitions": "^1.0.1",
68
+ "@fluidframework/driver-utils": "^1.0.1",
69
69
  "@fluidframework/protocol-definitions": "^0.1028.2000",
70
- "@fluidframework/runtime-definitions": "^0.59.4000",
71
- "@fluidframework/runtime-utils": "^0.59.4000",
72
- "@fluidframework/shared-object-base": "^0.59.4000",
70
+ "@fluidframework/runtime-definitions": "^1.0.1",
71
+ "@fluidframework/runtime-utils": "^1.0.1",
72
+ "@fluidframework/shared-object-base": "^1.0.1",
73
73
  "path-browserify": "^1.0.1"
74
74
  },
75
75
  "devDependencies": {
76
- "@fluid-internal/test-dds-utils": "^0.59.4000",
76
+ "@fluid-internal/test-dds-utils": "^1.0.1",
77
77
  "@fluidframework/build-common": "^0.23.0",
78
- "@fluidframework/build-tools": "^0.2.70857",
78
+ "@fluidframework/build-tools": "^0.2.71273",
79
79
  "@fluidframework/eslint-config-fluid": "^0.28.2000",
80
- "@fluidframework/map-previous": "npm:@fluidframework/map@0.59.3000",
81
- "@fluidframework/mocha-test-setup": "^0.59.4000",
82
- "@fluidframework/test-runtime-utils": "^0.59.4000",
80
+ "@fluidframework/map-previous": "npm:@fluidframework/map@^0.59.0",
81
+ "@fluidframework/mocha-test-setup": "^1.0.1",
82
+ "@fluidframework/test-runtime-utils": "^1.0.1",
83
83
  "@microsoft/api-extractor": "^7.22.2",
84
84
  "@rushstack/eslint-config": "^2.5.1",
85
85
  "@types/mocha": "^9.1.1",
86
86
  "@types/node": "^14.18.0",
87
- "@typescript-eslint/eslint-plugin": "~5.9.0",
88
- "@typescript-eslint/parser": "~5.9.0",
89
87
  "concurrently": "^6.2.0",
90
88
  "copyfiles": "^2.1.0",
91
89
  "cross-env": "^7.0.2",
92
90
  "eslint": "~8.6.0",
93
- "eslint-plugin-editorconfig": "~3.2.0",
94
- "eslint-plugin-eslint-comments": "~3.2.0",
95
- "eslint-plugin-import": "~2.25.4",
96
- "eslint-plugin-jest": "~26.1.3",
97
- "eslint-plugin-jsdoc": "~39.3.0",
98
- "eslint-plugin-mocha": "~10.0.3",
99
- "eslint-plugin-promise": "~6.0.0",
100
- "eslint-plugin-react": "~7.28.0",
101
- "eslint-plugin-tsdoc": "~0.2.14",
102
- "eslint-plugin-unicorn": "~40.0.0",
103
- "eslint-plugin-unused-imports": "~2.0.0",
104
91
  "mocha": "^10.0.0",
105
92
  "nyc": "^15.0.0",
106
93
  "rimraf": "^2.6.2",
@@ -108,7 +95,7 @@
108
95
  "typescript-formatter": "7.1.0"
109
96
  },
110
97
  "typeValidation": {
111
- "version": "0.59.4000",
98
+ "version": "1.0.0",
112
99
  "broken": {}
113
100
  }
114
101
  }
package/src/directory.ts CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  IChannelServices,
18
18
  IChannelFactory,
19
19
  } from "@fluidframework/datastore-definitions";
20
- import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
20
+ import { ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions";
21
21
  import { IFluidSerializer, SharedObject, ValueType } from "@fluidframework/shared-object-base";
22
22
  import { SummaryTreeBuilder } from "@fluidframework/runtime-utils";
23
23
  import * as path from "path-browserify";
@@ -204,67 +204,6 @@ export interface IDirectoryNewStorageFormat {
204
204
  content: IDirectoryDataObject;
205
205
  }
206
206
 
207
- function serializeDirectory(root: SubDirectory, serializer: IFluidSerializer): ISummaryTreeWithStats {
208
- const MinValueSizeSeparateSnapshotBlob = 8 * 1024;
209
-
210
- const builder = new SummaryTreeBuilder();
211
- let counter = 0;
212
- const blobs: string[] = [];
213
-
214
- const stack: [SubDirectory, IDirectoryDataObject][] = [];
215
- const content: IDirectoryDataObject = {};
216
- stack.push([root, content]);
217
-
218
- while (stack.length > 0) {
219
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
220
- const [currentSubDir, currentSubDirObject] = stack.pop()!;
221
- for (const [key, value] of currentSubDir.getSerializedStorage(serializer)) {
222
- if (!currentSubDirObject.storage) {
223
- currentSubDirObject.storage = {};
224
- }
225
- const result: ISerializableValue = {
226
- type: value.type,
227
- value: value.value && JSON.parse(value.value) as object,
228
- };
229
- if (value.value && value.value.length >= MinValueSizeSeparateSnapshotBlob) {
230
- const extraContent: IDirectoryDataObject = {};
231
- let largeContent = extraContent;
232
- if (currentSubDir.absolutePath !== posix.sep) {
233
- for (const dir of currentSubDir.absolutePath.substr(1).split(posix.sep)) {
234
- const subDataObject: IDirectoryDataObject = {};
235
- largeContent.subdirectories = { [dir]: subDataObject };
236
- largeContent = subDataObject;
237
- }
238
- }
239
- largeContent.storage = { [key]: result };
240
- const blobName = `blob${counter}`;
241
- counter++;
242
- blobs.push(blobName);
243
- builder.addBlob(blobName, JSON.stringify(extraContent));
244
- } else {
245
- currentSubDirObject.storage[key] = result;
246
- }
247
- }
248
-
249
- for (const [subdirName, subdir] of currentSubDir.subdirectories()) {
250
- if (!currentSubDirObject.subdirectories) {
251
- currentSubDirObject.subdirectories = {};
252
- }
253
- const subDataObject: IDirectoryDataObject = {};
254
- currentSubDirObject.subdirectories[subdirName] = subDataObject;
255
- stack.push([subdir as SubDirectory, subDataObject]);
256
- }
257
- }
258
-
259
- const newFormat: IDirectoryNewStorageFormat = {
260
- blobs,
261
- content,
262
- };
263
- builder.addBlob(snapshotFileName, JSON.stringify(newFormat));
264
-
265
- return builder.getSummaryTree();
266
- }
267
-
268
207
  /**
269
208
  * The factory that defines the directory.
270
209
  * @sealed
@@ -397,7 +336,7 @@ export class SharedDirectory extends SharedObject<ISharedDirectoryEvents> implem
397
336
  runtime: IFluidDataStoreRuntime,
398
337
  attributes: IChannelAttributes,
399
338
  ) {
400
- super(id, runtime, attributes);
339
+ super(id, runtime, attributes, "fluid_directory_");
401
340
  this.localValueMaker = new LocalValueMaker(this.serializer);
402
341
  this.setMessageHandlers();
403
342
  // Mirror the containedValueChanged op on the SharedDirectory
@@ -582,8 +521,11 @@ export class SharedDirectory extends SharedObject<ISharedDirectoryEvents> implem
582
521
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}
583
522
  * @internal
584
523
  */
585
- protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {
586
- return serializeDirectory(this.root, serializer);
524
+ protected summarizeCore(
525
+ serializer: IFluidSerializer,
526
+ telemetryContext?: ITelemetryContext,
527
+ ): ISummaryTreeWithStats {
528
+ return this.serializeDirectory(this.root, serializer);
587
529
  }
588
530
 
589
531
  /**
@@ -822,6 +764,72 @@ export class SharedDirectory extends SharedObject<ISharedDirectoryEvents> implem
822
764
  protected applyStashedOp() {
823
765
  throw new Error("not implemented");
824
766
  }
767
+
768
+ private serializeDirectory(
769
+ root: SubDirectory,
770
+ serializer: IFluidSerializer,
771
+ telemetryContext?: ITelemetryContext,
772
+ ): ISummaryTreeWithStats {
773
+ const MinValueSizeSeparateSnapshotBlob = 8 * 1024;
774
+
775
+ const builder = new SummaryTreeBuilder();
776
+ let counter = 0;
777
+ const blobs: string[] = [];
778
+
779
+ const stack: [SubDirectory, IDirectoryDataObject][] = [];
780
+ const content: IDirectoryDataObject = {};
781
+ stack.push([root, content]);
782
+
783
+ while (stack.length > 0) {
784
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
785
+ const [currentSubDir, currentSubDirObject] = stack.pop()!;
786
+ for (const [key, value] of currentSubDir.getSerializedStorage(serializer)) {
787
+ if (!currentSubDirObject.storage) {
788
+ currentSubDirObject.storage = {};
789
+ }
790
+ const result: ISerializableValue = {
791
+ type: value.type,
792
+ // eslint-disable-next-line @typescript-eslint/ban-types
793
+ value: value.value && JSON.parse(value.value) as object,
794
+ };
795
+ if (value.value && value.value.length >= MinValueSizeSeparateSnapshotBlob) {
796
+ const extraContent: IDirectoryDataObject = {};
797
+ let largeContent = extraContent;
798
+ if (currentSubDir.absolutePath !== posix.sep) {
799
+ for (const dir of currentSubDir.absolutePath.substr(1).split(posix.sep)) {
800
+ const subDataObject: IDirectoryDataObject = {};
801
+ largeContent.subdirectories = { [dir]: subDataObject };
802
+ largeContent = subDataObject;
803
+ }
804
+ }
805
+ largeContent.storage = { [key]: result };
806
+ const blobName = `blob${counter}`;
807
+ counter++;
808
+ blobs.push(blobName);
809
+ builder.addBlob(blobName, JSON.stringify(extraContent));
810
+ } else {
811
+ currentSubDirObject.storage[key] = result;
812
+ }
813
+ }
814
+
815
+ for (const [subdirName, subdir] of currentSubDir.subdirectories()) {
816
+ if (!currentSubDirObject.subdirectories) {
817
+ currentSubDirObject.subdirectories = {};
818
+ }
819
+ const subDataObject: IDirectoryDataObject = {};
820
+ currentSubDirObject.subdirectories[subdirName] = subDataObject;
821
+ stack.push([subdir as SubDirectory, subDataObject]);
822
+ }
823
+ }
824
+
825
+ const newFormat: IDirectoryNewStorageFormat = {
826
+ blobs,
827
+ content,
828
+ };
829
+ builder.addBlob(snapshotFileName, JSON.stringify(newFormat));
830
+
831
+ return builder.getSummaryTree();
832
+ }
825
833
  }
826
834
 
827
835
  /**
package/src/map.ts CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  IChannelServices,
12
12
  IChannelFactory,
13
13
  } from "@fluidframework/datastore-definitions";
14
- import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
14
+ import { ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions";
15
15
  import { readAndParse } from "@fluidframework/driver-utils";
16
16
  import {
17
17
  IFluidSerializer,
@@ -144,7 +144,7 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
144
144
  runtime: IFluidDataStoreRuntime,
145
145
  attributes: IChannelAttributes,
146
146
  ) {
147
- super(id, runtime, attributes);
147
+ super(id, runtime, attributes, "fluid_map_");
148
148
  this.kernel = new MapKernel(
149
149
  this.serializer,
150
150
  this.handle,
@@ -245,7 +245,10 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
245
245
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}
246
246
  * @internal
247
247
  */
248
- protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {
248
+ protected summarizeCore(
249
+ serializer: IFluidSerializer,
250
+ telemetryContext?: ITelemetryContext,
251
+ ): ISummaryTreeWithStats {
249
252
  let currentSize = 0;
250
253
  let counter = 0;
251
254
  let headerBlob: IMapDataObjectSerializable = {};
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/map";
9
- export const pkgVersion = "0.59.4000";
9
+ export const pkgVersion = "1.0.1";