@fluidframework/map 1.2.7 → 2.0.0-dev.1.3.0.96595

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 (69) hide show
  1. package/.eslintrc.js +4 -1
  2. package/.mocharc.js +12 -0
  3. package/dist/directory.d.ts +26 -7
  4. package/dist/directory.d.ts.map +1 -1
  5. package/dist/directory.js +10 -25
  6. package/dist/directory.js.map +1 -1
  7. package/dist/index.d.ts +2 -2
  8. package/dist/index.js +2 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/interfaces.d.ts +139 -181
  11. package/dist/interfaces.d.ts.map +1 -1
  12. package/dist/interfaces.js.map +1 -1
  13. package/dist/internalInterfaces.d.ts +62 -0
  14. package/dist/internalInterfaces.d.ts.map +1 -0
  15. package/dist/internalInterfaces.js +7 -0
  16. package/dist/internalInterfaces.js.map +1 -0
  17. package/dist/localValues.d.ts +3 -3
  18. package/dist/localValues.js +2 -2
  19. package/dist/localValues.js.map +1 -1
  20. package/dist/map.d.ts +3 -5
  21. package/dist/map.d.ts.map +1 -1
  22. package/dist/map.js +4 -7
  23. package/dist/map.js.map +1 -1
  24. package/dist/mapKernel.d.ts +10 -41
  25. package/dist/mapKernel.d.ts.map +1 -1
  26. package/dist/mapKernel.js +34 -25
  27. package/dist/mapKernel.js.map +1 -1
  28. package/dist/packageVersion.d.ts +1 -1
  29. package/dist/packageVersion.d.ts.map +1 -1
  30. package/dist/packageVersion.js +1 -1
  31. package/dist/packageVersion.js.map +1 -1
  32. package/lib/directory.d.ts +26 -7
  33. package/lib/directory.d.ts.map +1 -1
  34. package/lib/directory.js +10 -25
  35. package/lib/directory.js.map +1 -1
  36. package/lib/index.d.ts +2 -2
  37. package/lib/index.js +2 -2
  38. package/lib/index.js.map +1 -1
  39. package/lib/interfaces.d.ts +139 -181
  40. package/lib/interfaces.d.ts.map +1 -1
  41. package/lib/interfaces.js.map +1 -1
  42. package/lib/internalInterfaces.d.ts +62 -0
  43. package/lib/internalInterfaces.d.ts.map +1 -0
  44. package/lib/internalInterfaces.js +6 -0
  45. package/lib/internalInterfaces.js.map +1 -0
  46. package/lib/localValues.d.ts +3 -3
  47. package/lib/localValues.js +2 -2
  48. package/lib/localValues.js.map +1 -1
  49. package/lib/map.d.ts +3 -5
  50. package/lib/map.d.ts.map +1 -1
  51. package/lib/map.js +4 -7
  52. package/lib/map.js.map +1 -1
  53. package/lib/mapKernel.d.ts +10 -41
  54. package/lib/mapKernel.d.ts.map +1 -1
  55. package/lib/mapKernel.js +34 -25
  56. package/lib/mapKernel.js.map +1 -1
  57. package/lib/packageVersion.d.ts +1 -1
  58. package/lib/packageVersion.d.ts.map +1 -1
  59. package/lib/packageVersion.js +1 -1
  60. package/lib/packageVersion.js.map +1 -1
  61. package/package.json +61 -21
  62. package/src/directory.ts +36 -27
  63. package/src/index.ts +2 -2
  64. package/src/interfaces.ts +146 -181
  65. package/src/internalInterfaces.ts +72 -0
  66. package/src/localValues.ts +3 -3
  67. package/src/map.ts +8 -11
  68. package/src/mapKernel.ts +64 -96
  69. package/src/packageVersion.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/map",
3
- "version": "1.2.7",
3
+ "version": "2.0.0-dev.1.3.0.96595",
4
4
  "description": "Distributed map",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -32,7 +32,9 @@
32
32
  "lint:fix": "npm run eslint:fix",
33
33
  "test": "npm run test:mocha",
34
34
  "test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
35
- "test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
35
+ "test:memory": "mocha --config ./src/test/memory/.mocharc.js",
36
+ "test:memory-profiling:report": "mocha --config ./src/test/memory/.mocharc.js",
37
+ "test:mocha": "mocha --unhandled-rejections=strict --recursive 'dist/test/mocha/**/*.spec.js' -r node_modules/@fluidframework/mocha-test-setup --exit",
36
38
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
37
39
  "tsc": "tsc",
38
40
  "tsfmt": "tsfmt --verify",
@@ -61,31 +63,32 @@
61
63
  },
62
64
  "dependencies": {
63
65
  "@fluidframework/common-definitions": "^0.20.1",
64
- "@fluidframework/common-utils": "^0.32.1",
65
- "@fluidframework/container-utils": "^1.2.7",
66
- "@fluidframework/core-interfaces": "^1.2.7",
67
- "@fluidframework/datastore-definitions": "^1.2.7",
68
- "@fluidframework/driver-utils": "^1.2.7",
69
- "@fluidframework/protocol-definitions": "^0.1028.2000",
70
- "@fluidframework/runtime-definitions": "^1.2.7",
71
- "@fluidframework/runtime-utils": "^1.2.7",
72
- "@fluidframework/shared-object-base": "^1.2.7",
66
+ "@fluidframework/common-utils": "^1.0.0",
67
+ "@fluidframework/container-utils": "2.0.0-dev.1.3.0.96595",
68
+ "@fluidframework/core-interfaces": "2.0.0-dev.1.3.0.96595",
69
+ "@fluidframework/datastore-definitions": "2.0.0-dev.1.3.0.96595",
70
+ "@fluidframework/driver-utils": "2.0.0-dev.1.3.0.96595",
71
+ "@fluidframework/protocol-definitions": "^1.0.0",
72
+ "@fluidframework/runtime-definitions": "2.0.0-dev.1.3.0.96595",
73
+ "@fluidframework/runtime-utils": "2.0.0-dev.1.3.0.96595",
74
+ "@fluidframework/shared-object-base": "2.0.0-dev.1.3.0.96595",
73
75
  "path-browserify": "^1.0.1"
74
76
  },
75
77
  "devDependencies": {
76
- "@fluid-internal/test-dds-utils": "^1.2.7",
77
- "@fluidframework/build-common": "^0.24.0",
78
- "@fluidframework/build-tools": "^0.2.74327",
79
- "@fluidframework/eslint-config-fluid": "^0.28.2000",
80
- "@fluidframework/map-previous": "npm:@fluidframework/map@1.2.1",
81
- "@fluidframework/mocha-test-setup": "^1.2.7",
82
- "@fluidframework/test-runtime-utils": "^1.2.7",
78
+ "@fluid-internal/test-dds-utils": "2.0.0-dev.1.3.0.96595",
79
+ "@fluid-tools/benchmark": "^0.43.0",
80
+ "@fluidframework/build-common": "^1.0.0",
81
+ "@fluidframework/build-tools": "^0.4.6000",
82
+ "@fluidframework/eslint-config-fluid": "^1.0.0",
83
+ "@fluidframework/map-previous": "npm:@fluidframework/map@^1.0.0",
84
+ "@fluidframework/mocha-test-setup": "2.0.0-dev.1.3.0.96595",
85
+ "@fluidframework/test-runtime-utils": "2.0.0-dev.1.3.0.96595",
83
86
  "@microsoft/api-extractor": "^7.22.2",
84
87
  "@rushstack/eslint-config": "^2.5.1",
85
88
  "@types/mocha": "^9.1.1",
86
89
  "@types/node": "^14.18.0",
87
90
  "concurrently": "^6.2.0",
88
- "copyfiles": "^2.1.0",
91
+ "copyfiles": "^2.4.1",
89
92
  "cross-env": "^7.0.2",
90
93
  "eslint": "~8.6.0",
91
94
  "mocha": "^10.0.0",
@@ -95,7 +98,44 @@
95
98
  "typescript-formatter": "7.1.0"
96
99
  },
97
100
  "typeValidation": {
98
- "version": "1.2.2",
99
- "broken": {}
101
+ "version": "2.0.0",
102
+ "broken": {
103
+ "RemovedInterfaceDeclaration_IDirectoryClearOperation": {
104
+ "forwardCompat": false,
105
+ "backCompat": false
106
+ },
107
+ "RemovedInterfaceDeclaration_IDirectoryCreateSubDirectoryOperation": {
108
+ "forwardCompat": false,
109
+ "backCompat": false
110
+ },
111
+ "RemovedInterfaceDeclaration_IDirectoryDeleteOperation": {
112
+ "forwardCompat": false,
113
+ "backCompat": false
114
+ },
115
+ "RemovedInterfaceDeclaration_IDirectoryDeleteSubDirectoryOperation": {
116
+ "forwardCompat": false,
117
+ "backCompat": false
118
+ },
119
+ "RemovedTypeAliasDeclaration_IDirectoryKeyOperation": {
120
+ "forwardCompat": false,
121
+ "backCompat": false
122
+ },
123
+ "RemovedInterfaceDeclaration_IDirectorySetOperation": {
124
+ "forwardCompat": false,
125
+ "backCompat": false
126
+ },
127
+ "RemovedTypeAliasDeclaration_IDirectoryStorageOperation": {
128
+ "forwardCompat": false,
129
+ "backCompat": false
130
+ },
131
+ "RemovedTypeAliasDeclaration_IDirectorySubDirectoryOperation": {
132
+ "forwardCompat": false,
133
+ "backCompat": false
134
+ },
135
+ "RemovedInterfaceDeclaration_ILocalValue": {
136
+ "forwardCompat": false,
137
+ "backCompat": false
138
+ }
139
+ }
100
140
  }
101
141
  }
package/src/directory.ts CHANGED
@@ -192,24 +192,47 @@ export type IDirectoryOperation = IDirectoryStorageOperation | IDirectorySubDire
192
192
 
193
193
  /**
194
194
  * Defines the in-memory object structure to be used for the conversion to/from serialized.
195
- * @privateRemarks
196
- * Directly used in JSON.stringify, direct result from JSON.parse.
195
+ *
196
+ * @remarks Directly used in
197
+ * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
198
+ * | JSON.stringify}, direct result from
199
+ * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}.
197
200
  */
198
201
  export interface IDirectoryDataObject {
202
+ /**
203
+ * Key/value date set by the user.
204
+ */
199
205
  storage?: { [key: string]: ISerializableValue; };
206
+
207
+ /**
208
+ * Recursive sub-directories {@link IDirectoryDataObject | objects}.
209
+ */
200
210
  subdirectories?: { [subdirName: string]: IDirectoryDataObject; };
201
211
  }
202
212
 
213
+ /**
214
+ * {@link IDirectory} storage format.
215
+ *
216
+ * @internal
217
+ */
203
218
  export interface IDirectoryNewStorageFormat {
219
+ /**
220
+ * Blob IDs representing larger directory data that was serialized.
221
+ */
204
222
  blobs: string[];
223
+
224
+ /**
225
+ * Storage content representing directory data that was not serialized.
226
+ */
205
227
  content: IDirectoryDataObject;
206
228
  }
207
229
 
208
230
  /**
209
- * The factory that defines the directory.
231
+ * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedDirectory}.
232
+ *
210
233
  * @sealed
211
234
  */
212
- export class DirectoryFactory {
235
+ export class DirectoryFactory implements IChannelFactory {
213
236
  /**
214
237
  * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory."type"}
215
238
  */
@@ -264,9 +287,7 @@ export class DirectoryFactory {
264
287
  }
265
288
 
266
289
  /**
267
- * SharedDirectory provides a hierarchical organization of map-like data structures as SubDirectories.
268
- * The values stored within can be accessed like a map, and the hierarchy can be navigated using path syntax.
269
- * SubDirectories can be retrieved for use as working directories.
290
+ * {@inheritDoc ISharedDirectory}
270
291
  *
271
292
  * @example
272
293
  * ```typescript
@@ -544,7 +565,7 @@ export class SharedDirectory extends SharedObject<ISharedDirectoryEvents> implem
544
565
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}
545
566
  * @internal
546
567
  */
547
- protected onDisconnect() {}
568
+ protected onDisconnect() { }
548
569
 
549
570
  /**
550
571
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}
@@ -1203,12 +1224,9 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1203
1224
  const iterator = {
1204
1225
  next(): IteratorResult<[string, any]> {
1205
1226
  const nextVal = localEntriesIterator.next();
1206
- if (nextVal.done) {
1207
- return { value: undefined, done: true };
1208
- } else {
1209
- // Unpack the stored value
1210
- return { value: [nextVal.value[0], nextVal.value[1].value], done: false };
1211
- }
1227
+ return nextVal.done
1228
+ ? { value: undefined, done: true }
1229
+ : { value: [nextVal.value[0], nextVal.value[1].value], done: false };
1212
1230
  },
1213
1231
  [Symbol.iterator]() {
1214
1232
  return this;
@@ -1236,12 +1254,9 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1236
1254
  const iterator = {
1237
1255
  next(): IteratorResult<any> {
1238
1256
  const nextVal = localValuesIterator.next();
1239
- if (nextVal.done) {
1240
- return { value: undefined, done: true };
1241
- } else {
1242
- // Unpack the stored value
1243
- return { value: nextVal.value.value, done: false };
1244
- }
1257
+ return nextVal.done
1258
+ ? { value: undefined, done: true }
1259
+ : { value: nextVal.value.value, done: false };
1245
1260
  },
1246
1261
  [Symbol.iterator]() {
1247
1262
  return this;
@@ -1263,7 +1278,6 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1263
1278
  * Process a clear operation.
1264
1279
  * @param op - The op to process
1265
1280
  * @param local - Whether the message originated from the local client
1266
- * @param message - The message
1267
1281
  * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
1268
1282
  * For messages from a remote client, this will be undefined.
1269
1283
  * @internal
@@ -1276,7 +1290,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1276
1290
  this.throwIfDisposed();
1277
1291
  if (local) {
1278
1292
  assert(isClearLocalOpMetadata(localOpMetadata),
1279
- 0x00f /* `pendingMessageId is missing from the local client's ${op.type} operation` */);
1293
+ 0x00f /* pendingMessageId is missing from the local client's operation */);
1280
1294
  const pendingClearMessageId = this.pendingClearMessageIds.shift();
1281
1295
  assert(pendingClearMessageId === localOpMetadata.pendingMessageId,
1282
1296
  0x32a /* pendingMessageId does not match */);
@@ -1289,7 +1303,6 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1289
1303
  * Process a delete operation.
1290
1304
  * @param op - The op to process
1291
1305
  * @param local - Whether the message originated from the local client
1292
- * @param message - The message
1293
1306
  * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
1294
1307
  * For messages from a remote client, this will be undefined.
1295
1308
  * @internal
@@ -1310,7 +1323,6 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1310
1323
  * Process a set operation.
1311
1324
  * @param op - The op to process
1312
1325
  * @param local - Whether the message originated from the local client
1313
- * @param message - The message
1314
1326
  * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
1315
1327
  * For messages from a remote client, this will be undefined.
1316
1328
  * @internal
@@ -1337,7 +1349,6 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1337
1349
  * Process a create subdirectory operation.
1338
1350
  * @param op - The op to process
1339
1351
  * @param local - Whether the message originated from the local client
1340
- * @param message - The message
1341
1352
  * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
1342
1353
  * For messages from a remote client, this will be undefined.
1343
1354
  * @internal
@@ -1358,7 +1369,6 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1358
1369
  * Process a delete subdirectory operation.
1359
1370
  * @param op - The op to process
1360
1371
  * @param local - Whether the message originated from the local client
1361
- * @param message - The message
1362
1372
  * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
1363
1373
  * For messages from a remote client, this will be undefined.
1364
1374
  * @internal
@@ -1751,7 +1761,6 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1751
1761
  /**
1752
1762
  * Clear implementation used for both locally sourced clears as well as incoming remote clears.
1753
1763
  * @param local - Whether the message originated from the local client
1754
- * @param op - The message if from a remote clear, or null if from a local clear
1755
1764
  */
1756
1765
  private clearCore(local: boolean) {
1757
1766
  this._storage.clear();
package/src/index.ts CHANGED
@@ -4,9 +4,9 @@
4
4
  */
5
5
 
6
6
  /**
7
- * The `map` package provides interfaces and implementing classes for map-like distributed data structures.
7
+ * The `map` library provides interfaces and implementing classes for map-like distributed data structures.
8
8
  *
9
- * @remarks The following distributed data structures are defined in this package:
9
+ * @remarks The following distributed data structures are defined in this library:
10
10
  *
11
11
  * - {@link SharedMap}
12
12
  *