@fluidframework/map 2.0.0-internal.3.0.1 → 2.0.0-internal.3.1.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 +11 -16
- package/.mocharc.js +2 -2
- package/README.md +3 -3
- package/api-extractor.json +2 -2
- package/dist/directory.d.ts +1 -1
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +40 -18
- package/dist/directory.js.map +1 -1
- package/dist/interfaces.d.ts +12 -12
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/internalInterfaces.d.ts.map +1 -1
- package/dist/internalInterfaces.js.map +1 -1
- package/dist/localValues.d.ts.map +1 -1
- package/dist/localValues.js.map +1 -1
- package/dist/map.d.ts +1 -1
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +4 -2
- package/dist/map.js.map +1 -1
- package/dist/mapKernel.d.ts.map +1 -1
- package/dist/mapKernel.js +33 -22
- 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 +1 -1
- package/lib/directory.d.ts.map +1 -1
- package/lib/directory.js +42 -20
- package/lib/directory.js.map +1 -1
- package/lib/interfaces.d.ts +12 -12
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/internalInterfaces.d.ts.map +1 -1
- package/lib/internalInterfaces.js.map +1 -1
- package/lib/localValues.d.ts.map +1 -1
- package/lib/localValues.js.map +1 -1
- package/lib/map.d.ts +1 -1
- package/lib/map.d.ts.map +1 -1
- package/lib/map.js +5 -3
- package/lib/map.js.map +1 -1
- package/lib/mapKernel.d.ts.map +1 -1
- package/lib/mapKernel.js +34 -23
- 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 +111 -110
- package/prettier.config.cjs +1 -1
- package/src/directory.ts +1952 -1875
- package/src/interfaces.ts +303 -306
- package/src/internalInterfaces.ts +67 -67
- package/src/localValues.ts +85 -94
- package/src/map.ts +363 -355
- package/src/mapKernel.ts +725 -690
- package/src/packageVersion.ts +1 -1
- package/tsconfig.esnext.json +5 -5
- package/tsconfig.json +9 -15
package/.eslintrc.js
CHANGED
|
@@ -4,20 +4,15 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
"rules": {
|
|
17
|
-
"@typescript-eslint/no-use-before-define": "off",
|
|
18
|
-
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
7
|
+
extends: [require.resolve("@fluidframework/eslint-config-fluid/minimal"), "prettier"],
|
|
8
|
+
parserOptions: {
|
|
9
|
+
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
13
|
+
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
15
|
+
// TODO: consider re-enabling once we have addressed how this rule conflicts with our error codes.
|
|
16
|
+
"unicorn/numeric-separators-style": "off",
|
|
17
|
+
},
|
|
18
|
+
};
|
package/.mocharc.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
"use strict";
|
|
7
7
|
|
|
8
|
-
const getFluidTestMochaConfig = require(
|
|
8
|
+
const getFluidTestMochaConfig = require("@fluidframework/mocha-test-setup/mocharc-common");
|
|
9
9
|
|
|
10
10
|
const packageDir = __dirname;
|
|
11
11
|
const config = getFluidTestMochaConfig(packageDir);
|
package/README.md
CHANGED
|
@@ -27,11 +27,11 @@ when the key becomes available.
|
|
|
27
27
|
|
|
28
28
|
### Eventing
|
|
29
29
|
|
|
30
|
-
`SharedMap` is an `EventEmitter`, and will emit events when other clients make modifications.
|
|
30
|
+
`SharedMap` is an `EventEmitter`, and will emit events when other clients make modifications. You should register for these events and respond appropriately as the data is modified. `valueChanged` will be emitted in response to a `set` or `delete`, and provide the key and previous value that was stored at that key. `clear` will be emitted in response to a `clear`.
|
|
31
31
|
|
|
32
32
|
## SharedDirectory and IDirectory
|
|
33
33
|
|
|
34
|
-
A `SharedDirectory` is a map-like DDS that additionally supports storing key/value pairs within a tree of subdirectories.
|
|
34
|
+
A `SharedDirectory` is a map-like DDS that additionally supports storing key/value pairs within a tree of subdirectories. This subdirectory tree can be used to give hierarchical structure to stored key/value pairs rather than storing them on a flat map. Both the `SharedDirectory` and any subdirectories are `IDirectories`.
|
|
35
35
|
|
|
36
36
|
### Creation
|
|
37
37
|
|
|
@@ -43,7 +43,7 @@ const myDirectory = SharedDirectory.create(this.runtime, id);
|
|
|
43
43
|
|
|
44
44
|
### Usage
|
|
45
45
|
|
|
46
|
-
The map operations on an `IDirectory` refer to the key/value pairs stored in that `IDirectory`, and function just like `SharedMap` including the same extra functionality and restrictions on keys and values.
|
|
46
|
+
The map operations on an `IDirectory` refer to the key/value pairs stored in that `IDirectory`, and function just like `SharedMap` including the same extra functionality and restrictions on keys and values. To operate on the subdirectory structure, use the corresponding subdirectory methods.
|
|
47
47
|
|
|
48
48
|
#### `getWorkingDirectory()`
|
|
49
49
|
|
package/api-extractor.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "@fluidframework/build-common/api-extractor-common-strict.json"
|
|
4
4
|
}
|
package/dist/directory.d.ts
CHANGED
|
@@ -357,7 +357,7 @@ export declare class SharedDirectory extends SharedObject<ISharedDirectoryEvents
|
|
|
357
357
|
/**
|
|
358
358
|
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}
|
|
359
359
|
* @internal
|
|
360
|
-
|
|
360
|
+
*/
|
|
361
361
|
protected rollback(content: unknown, localOpMetadata: unknown): void;
|
|
362
362
|
/**
|
|
363
363
|
* Converts the given relative path to absolute against the root.
|
package/dist/directory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,
|
|
1
|
+
{"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAa,MAAM,oCAAoC,CAAC;AAG/F,OAAO,EACN,UAAU,EAGV,kBAAkB,EAElB,gBAAgB,EAChB,sBAAsB,EAEtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAe,eAAe,EAAoB,MAAM,eAAe,CAAC;AAgC/E;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;IAEZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,kBAAkB,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC;;OAEG;IAC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gB,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAI/D;;OAEG;IACI,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAiBxE;;;OAGG;IACH,SAAS,CAAC,aAAa,CACtB,UAAU,EAAE,gBAAgB,EAC5B,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,qBAAqB;IAIxB;;;;;;OAMG;IACI,sBAAsB,CAAC,EAAE,EAAE,mBAAmB,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAItF;;;OAGG;IACH,SAAS,CAAC,YAAY,IAAI,IAAI;IAE9B;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAOxE;;;OAGG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBxE;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI;IAqCpD;;;OAGG;IACH,SAAS,CAAC,WAAW,CACpB,OAAO,EAAE,yBAAyB,EAClC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,OAAO,GACtB,IAAI;IASP;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAQpE;;;OAGG;IACH,OAAO,CAAC,YAAY;IAIpB;;;;;;;;;OASG;IACH,OAAO,CAAC,SAAS;IAajB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAmH1B;;;OAGG;IACH,SAAS,CAAC,cAAc,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO;IAQ9C,OAAO,CAAC,kBAAkB;CAgE1B"}
|
package/dist/directory.js
CHANGED
|
@@ -400,7 +400,7 @@ class SharedDirectory extends shared_object_base_1.SharedObject {
|
|
|
400
400
|
/**
|
|
401
401
|
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}
|
|
402
402
|
* @internal
|
|
403
|
-
|
|
403
|
+
*/
|
|
404
404
|
rollback(content, localOpMetadata) {
|
|
405
405
|
const op = content;
|
|
406
406
|
const subdir = this.getWorkingDirectory(op.path);
|
|
@@ -426,7 +426,8 @@ class SharedDirectory extends shared_object_base_1.SharedObject {
|
|
|
426
426
|
* @returns The local value that was produced
|
|
427
427
|
*/
|
|
428
428
|
makeLocal(key, absolutePath, serializable) {
|
|
429
|
-
(0, common_utils_1.assert)(serializable.type === shared_object_base_1.ValueType[shared_object_base_1.ValueType.Plain] ||
|
|
429
|
+
(0, common_utils_1.assert)(serializable.type === shared_object_base_1.ValueType[shared_object_base_1.ValueType.Plain] ||
|
|
430
|
+
serializable.type === shared_object_base_1.ValueType[shared_object_base_1.ValueType.Shared], 0x1e4 /* "Unexpected serializable type" */);
|
|
430
431
|
return this.localValueMaker.fromSerializable(serializable);
|
|
431
432
|
}
|
|
432
433
|
/**
|
|
@@ -608,22 +609,29 @@ class SharedDirectory extends shared_object_base_1.SharedObject {
|
|
|
608
609
|
exports.SharedDirectory = SharedDirectory;
|
|
609
610
|
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */
|
|
610
611
|
function isKeyEditLocalOpMetadata(metadata) {
|
|
611
|
-
return metadata !== undefined &&
|
|
612
|
+
return (metadata !== undefined &&
|
|
613
|
+
typeof metadata.pendingMessageId === "number" &&
|
|
614
|
+
metadata.type === "edit");
|
|
612
615
|
}
|
|
613
616
|
function isClearLocalOpMetadata(metadata) {
|
|
614
|
-
return metadata !== undefined &&
|
|
615
|
-
|
|
617
|
+
return (metadata !== undefined &&
|
|
618
|
+
metadata.type === "clear" &&
|
|
619
|
+
typeof metadata.pendingMessageId === "number" &&
|
|
620
|
+
typeof metadata.previousStorage === "object");
|
|
616
621
|
}
|
|
617
622
|
function isSubDirLocalOpMetadata(metadata) {
|
|
618
|
-
return metadata !== undefined &&
|
|
623
|
+
return (metadata !== undefined &&
|
|
624
|
+
typeof metadata.pendingMessageId === "number" &&
|
|
619
625
|
((metadata.type === "createSubDir" && typeof metadata.previouslyExisted === "boolean") ||
|
|
620
|
-
metadata.type === "deleteSubDir");
|
|
626
|
+
metadata.type === "deleteSubDir"));
|
|
621
627
|
}
|
|
622
628
|
function isDirectoryLocalOpMetadata(metadata) {
|
|
623
|
-
return metadata !== undefined &&
|
|
624
|
-
|
|
629
|
+
return (metadata !== undefined &&
|
|
630
|
+
typeof metadata.pendingMessageId === "number" &&
|
|
631
|
+
(metadata.type === "edit" ||
|
|
632
|
+
metadata.type === "deleteSubDir" ||
|
|
625
633
|
(metadata.type === "clear" && typeof metadata.previousStorage === "object") ||
|
|
626
|
-
(metadata.type === "createSubDir" && typeof metadata.previouslyExisted === "boolean"));
|
|
634
|
+
(metadata.type === "createSubDir" && typeof metadata.previouslyExisted === "boolean")));
|
|
627
635
|
}
|
|
628
636
|
/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */
|
|
629
637
|
/**
|
|
@@ -994,7 +1002,11 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
994
1002
|
this.throwIfDisposed();
|
|
995
1003
|
const previousValue = this.deleteCore(op.key, true);
|
|
996
1004
|
const pendingMessageId = this.getKeyMessageId(op);
|
|
997
|
-
const localMetadata = {
|
|
1005
|
+
const localMetadata = {
|
|
1006
|
+
type: "edit",
|
|
1007
|
+
pendingMessageId,
|
|
1008
|
+
previousValue,
|
|
1009
|
+
};
|
|
998
1010
|
return localMetadata;
|
|
999
1011
|
}
|
|
1000
1012
|
/**
|
|
@@ -1026,7 +1038,11 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1026
1038
|
const previousValue = this.setCore(op.key, context, true);
|
|
1027
1039
|
// Create metadata
|
|
1028
1040
|
const pendingMessageId = this.getKeyMessageId(op);
|
|
1029
|
-
const localMetadata = {
|
|
1041
|
+
const localMetadata = {
|
|
1042
|
+
type: "edit",
|
|
1043
|
+
pendingMessageId,
|
|
1044
|
+
previousValue,
|
|
1045
|
+
};
|
|
1030
1046
|
return localMetadata;
|
|
1031
1047
|
}
|
|
1032
1048
|
/**
|
|
@@ -1155,7 +1171,8 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1155
1171
|
(0, common_utils_1.assert)(isKeyEditLocalOpMetadata(localOpMetadata), 0x32d /* Invalid localOpMetadata in submit */);
|
|
1156
1172
|
// clear the old pending message id
|
|
1157
1173
|
const pendingMessageIds = this.pendingKeys.get(op.key);
|
|
1158
|
-
(0, common_utils_1.assert)(pendingMessageIds !== undefined &&
|
|
1174
|
+
(0, common_utils_1.assert)(pendingMessageIds !== undefined &&
|
|
1175
|
+
pendingMessageIds[0] === localOpMetadata.pendingMessageId, 0x32e /* Unexpected pending message received */);
|
|
1159
1176
|
pendingMessageIds.shift();
|
|
1160
1177
|
if (pendingMessageIds.length === 0) {
|
|
1161
1178
|
this.pendingKeys.delete(op.key);
|
|
@@ -1217,7 +1234,8 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1217
1234
|
(0, common_utils_1.assert)(isSubDirLocalOpMetadata(localOpMetadata), 0x32f /* Invalid localOpMetadata for sub directory op */);
|
|
1218
1235
|
// clear the old pending message id
|
|
1219
1236
|
const pendingMessageIds = this.pendingSubDirectories.get(op.subdirName);
|
|
1220
|
-
(0, common_utils_1.assert)(pendingMessageIds !== undefined &&
|
|
1237
|
+
(0, common_utils_1.assert)(pendingMessageIds !== undefined &&
|
|
1238
|
+
pendingMessageIds[0] === localOpMetadata.pendingMessageId, 0x330 /* Unexpected pending message received */);
|
|
1221
1239
|
pendingMessageIds.shift();
|
|
1222
1240
|
if (pendingMessageIds.length === 0) {
|
|
1223
1241
|
this.pendingSubDirectories.delete(op.subdirName);
|
|
@@ -1305,7 +1323,8 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1305
1323
|
this.setCore(key, localValue, true);
|
|
1306
1324
|
}
|
|
1307
1325
|
const lastPendingClearId = this.pendingClearMessageIds.pop();
|
|
1308
|
-
if (lastPendingClearId === undefined ||
|
|
1326
|
+
if (lastPendingClearId === undefined ||
|
|
1327
|
+
lastPendingClearId !== localOpMetadata.pendingMessageId) {
|
|
1309
1328
|
throw new Error("Rollback op does match last clear");
|
|
1310
1329
|
}
|
|
1311
1330
|
}
|
|
@@ -1358,7 +1377,8 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1358
1377
|
needProcessStorageOperation(op, local, localOpMetadata) {
|
|
1359
1378
|
if (this.pendingClearMessageIds.length > 0) {
|
|
1360
1379
|
if (local) {
|
|
1361
|
-
(0, common_utils_1.assert)(localOpMetadata !== undefined &&
|
|
1380
|
+
(0, common_utils_1.assert)(localOpMetadata !== undefined &&
|
|
1381
|
+
isKeyEditLocalOpMetadata(localOpMetadata) &&
|
|
1362
1382
|
localOpMetadata.pendingMessageId < this.pendingClearMessageIds[0], 0x010 /* "Received out of order storage op when there is an unackd clear message" */);
|
|
1363
1383
|
}
|
|
1364
1384
|
// If I have a NACK clear, we can ignore all ops.
|
|
@@ -1371,7 +1391,8 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1371
1391
|
if (local) {
|
|
1372
1392
|
(0, common_utils_1.assert)(localOpMetadata !== undefined && isKeyEditLocalOpMetadata(localOpMetadata), 0x011 /* pendingMessageId is missing from the local client's operation */);
|
|
1373
1393
|
const pendingMessageIds = this.pendingKeys.get(op.key);
|
|
1374
|
-
(0, common_utils_1.assert)(pendingMessageIds !== undefined &&
|
|
1394
|
+
(0, common_utils_1.assert)(pendingMessageIds !== undefined &&
|
|
1395
|
+
pendingMessageIds[0] === localOpMetadata.pendingMessageId, 0x331 /* Unexpected pending message received */);
|
|
1375
1396
|
pendingMessageIds.shift();
|
|
1376
1397
|
if (pendingMessageIds.length === 0) {
|
|
1377
1398
|
this.pendingKeys.delete(op.key);
|
|
@@ -1398,7 +1419,8 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1398
1419
|
if (local) {
|
|
1399
1420
|
(0, common_utils_1.assert)(isSubDirLocalOpMetadata(localOpMetadata), 0x012 /* pendingMessageId is missing from the local client's operation */);
|
|
1400
1421
|
const pendingMessageIds = this.pendingSubDirectories.get(op.subdirName);
|
|
1401
|
-
(0, common_utils_1.assert)(pendingMessageIds !== undefined &&
|
|
1422
|
+
(0, common_utils_1.assert)(pendingMessageIds !== undefined &&
|
|
1423
|
+
pendingMessageIds[0] === localOpMetadata.pendingMessageId, 0x332 /* Unexpected pending message received */);
|
|
1402
1424
|
pendingMessageIds.shift();
|
|
1403
1425
|
if (pendingMessageIds.length === 0) {
|
|
1404
1426
|
this.pendingSubDirectories.delete(op.subdirName);
|