@fluidframework/map 2.0.0-dev.5.3.2.178189 → 2.0.0-dev.6.4.0.191258
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/CHANGELOG.md +51 -0
- package/README.md +4 -3
- package/dist/directory.d.ts +2 -1
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +50 -39
- package/dist/directory.js.map +1 -1
- package/dist/interfaces.d.ts +1 -2
- 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 +1 -0
- package/dist/localValues.js.map +1 -1
- package/dist/mapKernel.d.ts +1 -1
- package/dist/mapKernel.d.ts.map +1 -1
- package/dist/mapKernel.js +13 -12
- 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 +2 -1
- package/lib/directory.d.ts.map +1 -1
- package/lib/directory.js +32 -21
- package/lib/directory.js.map +1 -1
- package/lib/interfaces.d.ts +1 -2
- 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 +1 -0
- package/lib/localValues.js.map +1 -1
- package/lib/mapKernel.d.ts +1 -1
- package/lib/mapKernel.d.ts.map +1 -1
- package/lib/mapKernel.js +5 -4
- 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 +25 -27
- package/src/directory.ts +32 -8
- package/src/interfaces.ts +6 -2
- package/src/internalInterfaces.ts +2 -0
- package/src/localValues.ts +3 -0
- package/src/mapKernel.ts +5 -1
- package/src/packageVersion.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @fluidframework/map
|
|
2
2
|
|
|
3
|
+
## 2.0.0-internal.6.3.0
|
|
4
|
+
|
|
5
|
+
Dependency updates only.
|
|
6
|
+
|
|
7
|
+
## 2.0.0-internal.6.2.0
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- Remove use of @fluidframework/common-definitions ([#16638](https://github.com/microsoft/FluidFramework/issues/16638)) [a8c81509c9](https://github.com/microsoft/FluidFramework/commits/a8c81509c9bf09cfb2092ebcf7265205f9eb6dbf)
|
|
12
|
+
|
|
13
|
+
The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now
|
|
14
|
+
imported from the **@fluidframework/core-interfaces** package:
|
|
15
|
+
|
|
16
|
+
- interface IDisposable
|
|
17
|
+
- interface IErrorEvent
|
|
18
|
+
- interface IErrorEvent
|
|
19
|
+
- interface IEvent
|
|
20
|
+
- interface IEventProvider
|
|
21
|
+
- interface ILoggingError
|
|
22
|
+
- interface ITaggedTelemetryPropertyType
|
|
23
|
+
- interface ITelemetryBaseEvent
|
|
24
|
+
- interface ITelemetryBaseLogger
|
|
25
|
+
- interface ITelemetryErrorEvent
|
|
26
|
+
- interface ITelemetryGenericEvent
|
|
27
|
+
- interface ITelemetryLogger
|
|
28
|
+
- interface ITelemetryPerformanceEvent
|
|
29
|
+
- interface ITelemetryProperties
|
|
30
|
+
- type ExtendEventProvider
|
|
31
|
+
- type IEventThisPlaceHolder
|
|
32
|
+
- type IEventTransformer
|
|
33
|
+
- type ReplaceIEventThisPlaceHolder
|
|
34
|
+
- type ReplaceIEventThisPlaceHolder
|
|
35
|
+
- type TelemetryEventCategory
|
|
36
|
+
- type TelemetryEventPropertyType
|
|
37
|
+
|
|
38
|
+
## 2.0.0-internal.6.1.0
|
|
39
|
+
|
|
40
|
+
Dependency updates only.
|
|
41
|
+
|
|
42
|
+
## 2.0.0-internal.6.0.0
|
|
43
|
+
|
|
44
|
+
### Major Changes
|
|
45
|
+
|
|
46
|
+
- Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
47
|
+
|
|
48
|
+
Upgraded typescript transpilation target to ES2020. This is done in order to decrease the bundle sizes of Fluid Framework packages. This has provided size improvements across the board for ex. Loader, Driver, Runtime etc. Reduced bundle sizes helps to load lesser code in apps and hence also helps to improve the perf.If any app wants to target any older versions of browsers with which this target version is not compatible, then they can use packages like babel to transpile to a older target.
|
|
49
|
+
|
|
50
|
+
## 2.0.0-internal.5.4.0
|
|
51
|
+
|
|
52
|
+
Dependency updates only.
|
|
53
|
+
|
|
3
54
|
## 2.0.0-internal.5.3.0
|
|
4
55
|
|
|
5
56
|
Dependency updates only.
|
package/README.md
CHANGED
|
@@ -11,9 +11,10 @@ When taking a dependency on a Fluid Framework library, we recommend using a `^`
|
|
|
11
11
|
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
|
|
12
12
|
library consumers should always prefer `^`.
|
|
13
13
|
|
|
14
|
-
Note that when depending on a library version of the form 2.0.0-internal.x.y.z
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
Note that when depending on a library version of the form `2.0.0-internal.x.y.z`, called the Fluid internal version scheme,
|
|
15
|
+
you must use a `>= <` dependency range (such as `>=2.0.0-internal.x.y.z <2.0.0-internal.w.0.0` where `w` is `x+1`).
|
|
16
|
+
Standard `^` and `~` ranges will not work as expected.
|
|
17
|
+
See the [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
|
|
17
18
|
package for more information including tools to convert between version schemes.
|
|
18
19
|
|
|
19
20
|
<!-- prettier-ignore-end -->
|
package/dist/directory.d.ts
CHANGED
|
@@ -202,6 +202,7 @@ export declare class DirectoryFactory implements IChannelFactory {
|
|
|
202
202
|
* {@inheritDoc ISharedDirectory}
|
|
203
203
|
*
|
|
204
204
|
* @example
|
|
205
|
+
*
|
|
205
206
|
* ```typescript
|
|
206
207
|
* mySharedDirectory.createSubDirectory("a").createSubDirectory("b").createSubDirectory("c").set("foo", val1);
|
|
207
208
|
* const mySubDir = mySharedDirectory.getWorkingDirectory("/a/b/c");
|
|
@@ -399,7 +400,7 @@ export declare class SharedDirectory extends SharedObject<ISharedDirectoryEvents
|
|
|
399
400
|
/**
|
|
400
401
|
* This checks if there is pending delete op for local delete for a any subdir in the relative path.
|
|
401
402
|
* @param relativePath - path of sub directory.
|
|
402
|
-
* @returns
|
|
403
|
+
* @returns `true` if there is pending delete, `false` otherwise.
|
|
403
404
|
*/
|
|
404
405
|
private isSubDirectoryDeletePending;
|
|
405
406
|
/**
|
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;
|
|
1
|
+
{"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,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,EAIV,kBAAkB,EAElB,gBAAgB,EAChB,sBAAsB,EAEtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAe,eAAe,EAAoB,MAAM,eAAe,CAAC;AAsC/E;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,IAAI,EAAE,KAAK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e,EAAE,OAAO,GAAG,IAAI;IAQpE;;;OAGG;IACH,OAAO,CAAC,YAAY;IAIpB;;;;;;;;;OASG;IACH,OAAO,CAAC,SAAS;IAcjB;;;;OAIG;IACH,OAAO,CAAC,2BAA2B;IAsBnC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAsJ1B;;;OAGG;IACH,SAAS,CAAC,cAAc,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO;IAQ9C,OAAO,CAAC,kBAAkB;CAkE1B"}
|
package/dist/directory.js
CHANGED
|
@@ -25,8 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
var _a, _b;
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
27
|
exports.SharedDirectory = exports.DirectoryFactory = void 0;
|
|
28
|
-
const
|
|
29
|
-
const
|
|
28
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
29
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
30
|
+
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
30
31
|
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
31
32
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
32
33
|
const shared_object_base_1 = require("@fluidframework/shared-object-base");
|
|
@@ -90,6 +91,7 @@ DirectoryFactory.Attributes = {
|
|
|
90
91
|
* {@inheritDoc ISharedDirectory}
|
|
91
92
|
*
|
|
92
93
|
* @example
|
|
94
|
+
*
|
|
93
95
|
* ```typescript
|
|
94
96
|
* mySharedDirectory.createSubDirectory("a").createSubDirectory("b").createSubDirectory("c").set("foo", val1);
|
|
95
97
|
* const mySubDir = mySharedDirectory.getWorkingDirectory("/a/b/c");
|
|
@@ -333,7 +335,7 @@ class SharedDirectory extends shared_object_base_1.SharedObject {
|
|
|
333
335
|
reSubmitCore(content, localOpMetadata) {
|
|
334
336
|
const message = content;
|
|
335
337
|
const handler = this.messageHandlers.get(message.type);
|
|
336
|
-
(0,
|
|
338
|
+
(0, core_utils_1.assert)(handler !== undefined, 0x00d /* Missing message handler for message type */);
|
|
337
339
|
handler.submit(message, localOpMetadata);
|
|
338
340
|
}
|
|
339
341
|
/**
|
|
@@ -400,7 +402,7 @@ class SharedDirectory extends shared_object_base_1.SharedObject {
|
|
|
400
402
|
if (message.type === protocol_definitions_1.MessageType.Operation) {
|
|
401
403
|
const op = message.contents;
|
|
402
404
|
const handler = this.messageHandlers.get(op.type);
|
|
403
|
-
(0,
|
|
405
|
+
(0, core_utils_1.assert)(handler !== undefined, 0x00e /* Missing message handler for message type */);
|
|
404
406
|
handler.process(message, op, local, localOpMetadata);
|
|
405
407
|
}
|
|
406
408
|
}
|
|
@@ -432,15 +434,17 @@ class SharedDirectory extends shared_object_base_1.SharedObject {
|
|
|
432
434
|
* @param serializable - The remote information that we can convert into a real object
|
|
433
435
|
* @returns The local value that was produced
|
|
434
436
|
*/
|
|
435
|
-
makeLocal(key, absolutePath,
|
|
436
|
-
|
|
437
|
+
makeLocal(key, absolutePath,
|
|
438
|
+
// eslint-disable-next-line import/no-deprecated
|
|
439
|
+
serializable) {
|
|
440
|
+
(0, core_utils_1.assert)(serializable.type === shared_object_base_1.ValueType[shared_object_base_1.ValueType.Plain] ||
|
|
437
441
|
serializable.type === shared_object_base_1.ValueType[shared_object_base_1.ValueType.Shared], 0x1e4 /* "Unexpected serializable type" */);
|
|
438
442
|
return this.localValueMaker.fromSerializable(serializable);
|
|
439
443
|
}
|
|
440
444
|
/**
|
|
441
445
|
* This checks if there is pending delete op for local delete for a any subdir in the relative path.
|
|
442
446
|
* @param relativePath - path of sub directory.
|
|
443
|
-
* @returns
|
|
447
|
+
* @returns `true` if there is pending delete, `false` otherwise.
|
|
444
448
|
*/
|
|
445
449
|
isSubDirectoryDeletePending(relativePath) {
|
|
446
450
|
const absolutePath = this.makeAbsolute(relativePath);
|
|
@@ -609,6 +613,7 @@ class SharedDirectory extends shared_object_base_1.SharedObject {
|
|
|
609
613
|
if (!currentSubDirObject.storage) {
|
|
610
614
|
currentSubDirObject.storage = {};
|
|
611
615
|
}
|
|
616
|
+
// eslint-disable-next-line import/no-deprecated
|
|
612
617
|
const result = {
|
|
613
618
|
type: value.type,
|
|
614
619
|
value: value.value && JSON.parse(value.value),
|
|
@@ -674,13 +679,13 @@ function isDirectoryLocalOpMetadata(metadata) {
|
|
|
674
679
|
}
|
|
675
680
|
/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */
|
|
676
681
|
function assertNonNullClientId(clientId) {
|
|
677
|
-
(0,
|
|
682
|
+
(0, core_utils_1.assert)(clientId !== null, 0x6af /* client id should never be null */);
|
|
678
683
|
}
|
|
679
684
|
/**
|
|
680
685
|
* Node of the directory tree.
|
|
681
686
|
* @sealed
|
|
682
687
|
*/
|
|
683
|
-
class SubDirectory extends
|
|
688
|
+
class SubDirectory extends client_utils_1.TypedEventEmitter {
|
|
684
689
|
/**
|
|
685
690
|
* Constructor.
|
|
686
691
|
* @param sequenceNumber - Message seq number at which this was created.
|
|
@@ -758,7 +763,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
758
763
|
}
|
|
759
764
|
throwIfDisposed() {
|
|
760
765
|
if (this._deleted) {
|
|
761
|
-
throw new
|
|
766
|
+
throw new telemetry_utils_1.UsageError("Cannot access Disposed subDirectory");
|
|
762
767
|
}
|
|
763
768
|
}
|
|
764
769
|
/**
|
|
@@ -774,9 +779,8 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
774
779
|
* {@inheritDoc IDirectory.get}
|
|
775
780
|
*/
|
|
776
781
|
get(key) {
|
|
777
|
-
var _c;
|
|
778
782
|
this.throwIfDisposed();
|
|
779
|
-
return
|
|
783
|
+
return this._storage.get(key)?.value;
|
|
780
784
|
}
|
|
781
785
|
/**
|
|
782
786
|
* {@inheritDoc IDirectory.set}
|
|
@@ -815,7 +819,6 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
815
819
|
* {@inheritDoc IDirectory.createSubDirectory}
|
|
816
820
|
*/
|
|
817
821
|
createSubDirectory(subdirName) {
|
|
818
|
-
var _c;
|
|
819
822
|
this.throwIfDisposed();
|
|
820
823
|
// Undefined/null subdirectory names can't be serialized to JSON in the manner we currently snapshot.
|
|
821
824
|
if (subdirName === undefined || subdirName === null) {
|
|
@@ -825,9 +828,9 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
825
828
|
throw new Error(`SubDirectory name may not contain ${posix.sep}`);
|
|
826
829
|
}
|
|
827
830
|
// Create the sub directory locally first.
|
|
828
|
-
const isNew = this.createSubDirectoryCore(subdirName, true,
|
|
831
|
+
const isNew = this.createSubDirectoryCore(subdirName, true, this.getLocalSeq(), this.runtime.clientId ?? "detached");
|
|
829
832
|
const subDir = this._subdirectories.get(subdirName);
|
|
830
|
-
(0,
|
|
833
|
+
(0, core_utils_1.assert)(subDir !== undefined, 0x5aa /* subdirectory should exist after creation */);
|
|
831
834
|
// If we are not attached, don't submit the op.
|
|
832
835
|
if (!this.directory.isAttached()) {
|
|
833
836
|
return subDir;
|
|
@@ -843,6 +846,16 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
843
846
|
}
|
|
844
847
|
return subDir;
|
|
845
848
|
}
|
|
849
|
+
/**
|
|
850
|
+
* @returns A sequenceNumber which should be used for local changes.
|
|
851
|
+
* @remarks While detached, 0 is used rather than -1 to represent a change which should be universally known (as opposed to known
|
|
852
|
+
* only by the local client). This ensures that if the directory is later attached, none of its data needs to be updated (the values
|
|
853
|
+
* last set while detached will now be known to any new client, until they are changed).
|
|
854
|
+
* TODO: Convert these conventions to named constants. The semantics used here match those for merge-tree.
|
|
855
|
+
*/
|
|
856
|
+
getLocalSeq() {
|
|
857
|
+
return this.directory.isAttached() ? -1 : 0;
|
|
858
|
+
}
|
|
846
859
|
/**
|
|
847
860
|
* {@inheritDoc IDirectory.getSubDirectory}
|
|
848
861
|
*/
|
|
@@ -896,7 +909,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
896
909
|
/**
|
|
897
910
|
* This checks if there is pending delete op for local delete for a given child subdirectory.
|
|
898
911
|
* @param subDirName - directory name.
|
|
899
|
-
* @returns
|
|
912
|
+
* @returns true if there is pending delete.
|
|
900
913
|
*/
|
|
901
914
|
isSubDirectoryDeletePending(subDirName) {
|
|
902
915
|
if (this.pendingDeleteSubDirectoriesTracker.has(subDirName)) {
|
|
@@ -1032,9 +1045,9 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1032
1045
|
return;
|
|
1033
1046
|
}
|
|
1034
1047
|
if (local) {
|
|
1035
|
-
(0,
|
|
1048
|
+
(0, core_utils_1.assert)(isClearLocalOpMetadata(localOpMetadata), 0x00f /* pendingMessageId is missing from the local client's operation */);
|
|
1036
1049
|
const pendingClearMessageId = this.pendingClearMessageIds.shift();
|
|
1037
|
-
(0,
|
|
1050
|
+
(0, core_utils_1.assert)(pendingClearMessageId === localOpMetadata.pendingMessageId, 0x32a /* pendingMessageId does not match */);
|
|
1038
1051
|
return;
|
|
1039
1052
|
}
|
|
1040
1053
|
this.clearExceptPendingKeys(false);
|
|
@@ -1152,10 +1165,9 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1152
1165
|
* @returns metadata generated for stahed op
|
|
1153
1166
|
*/
|
|
1154
1167
|
applyStashedCreateSubDirMessage(op) {
|
|
1155
|
-
var _c;
|
|
1156
1168
|
this.throwIfDisposed();
|
|
1157
1169
|
// Create the sub directory locally first.
|
|
1158
|
-
this.createSubDirectoryCore(op.subdirName, true,
|
|
1170
|
+
this.createSubDirectoryCore(op.subdirName, true, this.getLocalSeq(), this.runtime.clientId ?? "detached");
|
|
1159
1171
|
this.updatePendingSubDirMessageCount(op);
|
|
1160
1172
|
const localOpMetadata = {
|
|
1161
1173
|
type: "createSubDir",
|
|
@@ -1215,7 +1227,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1215
1227
|
* @internal
|
|
1216
1228
|
*/
|
|
1217
1229
|
resubmitClearMessage(op, localOpMetadata) {
|
|
1218
|
-
(0,
|
|
1230
|
+
(0, core_utils_1.assert)(isClearLocalOpMetadata(localOpMetadata), 0x32b /* Invalid localOpMetadata for clear */);
|
|
1219
1231
|
// We don't reuse the metadata pendingMessageId but send a new one on each submit.
|
|
1220
1232
|
const pendingClearMessageId = this.pendingClearMessageIds.shift();
|
|
1221
1233
|
// Only submit the op, if we have record for it, otherwise it is possible that the older instance
|
|
@@ -1257,7 +1269,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1257
1269
|
* @internal
|
|
1258
1270
|
*/
|
|
1259
1271
|
resubmitKeyMessage(op, localOpMetadata) {
|
|
1260
|
-
(0,
|
|
1272
|
+
(0, core_utils_1.assert)(isKeyEditLocalOpMetadata(localOpMetadata), 0x32d /* Invalid localOpMetadata in submit */);
|
|
1261
1273
|
// clear the old pending message id
|
|
1262
1274
|
const pendingMessageIds = this.pendingKeys.get(op.key);
|
|
1263
1275
|
// Only submit the op, if we have record for it, otherwise it is possible that the older instance
|
|
@@ -1272,13 +1284,11 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1272
1284
|
}
|
|
1273
1285
|
}
|
|
1274
1286
|
incrementPendingSubDirCount(map, subDirName) {
|
|
1275
|
-
|
|
1276
|
-
const count = (_c = map.get(subDirName)) !== null && _c !== void 0 ? _c : 0;
|
|
1287
|
+
const count = map.get(subDirName) ?? 0;
|
|
1277
1288
|
map.set(subDirName, count + 1);
|
|
1278
1289
|
}
|
|
1279
1290
|
decrementPendingSubDirCount(map, subDirName) {
|
|
1280
|
-
|
|
1281
|
-
const count = (_c = map.get(subDirName)) !== null && _c !== void 0 ? _c : 0;
|
|
1291
|
+
const count = map.get(subDirName) ?? 0;
|
|
1282
1292
|
map.set(subDirName, count - 1);
|
|
1283
1293
|
if (count <= 1) {
|
|
1284
1294
|
map.delete(subDirName);
|
|
@@ -1329,7 +1339,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1329
1339
|
* @internal
|
|
1330
1340
|
*/
|
|
1331
1341
|
resubmitSubDirectoryMessage(op, localOpMetadata) {
|
|
1332
|
-
(0,
|
|
1342
|
+
(0, core_utils_1.assert)(isSubDirLocalOpMetadata(localOpMetadata), 0x32f /* Invalid localOpMetadata for sub directory op */);
|
|
1333
1343
|
// Only submit the op, if we have record for it, otherwise it is possible that the older instance
|
|
1334
1344
|
// is already deleted, in which case we don't need to submit the op.
|
|
1335
1345
|
if (localOpMetadata.type === "createSubDir" &&
|
|
@@ -1409,7 +1419,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1409
1419
|
*/
|
|
1410
1420
|
rollbackPendingMessageId(map, key, pendingMessageId) {
|
|
1411
1421
|
const pendingMessageIds = map.get(key);
|
|
1412
|
-
const lastPendingMessageId = pendingMessageIds
|
|
1422
|
+
const lastPendingMessageId = pendingMessageIds?.pop();
|
|
1413
1423
|
if (!pendingMessageIds || lastPendingMessageId !== pendingMessageId) {
|
|
1414
1424
|
throw new Error("Rollback op does not match last pending");
|
|
1415
1425
|
}
|
|
@@ -1485,7 +1495,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1485
1495
|
needProcessStorageOperation(op, local, localOpMetadata) {
|
|
1486
1496
|
if (this.pendingClearMessageIds.length > 0) {
|
|
1487
1497
|
if (local) {
|
|
1488
|
-
(0,
|
|
1498
|
+
(0, core_utils_1.assert)(localOpMetadata !== undefined &&
|
|
1489
1499
|
isKeyEditLocalOpMetadata(localOpMetadata) &&
|
|
1490
1500
|
localOpMetadata.pendingMessageId < this.pendingClearMessageIds[0], 0x010 /* "Received out of order storage op when there is an unackd clear message" */);
|
|
1491
1501
|
// Remove all pendingMessageIds lower than first pendingClearMessageId.
|
|
@@ -1513,9 +1523,9 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1513
1523
|
// Found an NACK op, clear it from the directory if the latest sequence number in the directory
|
|
1514
1524
|
// match the message's and don't process the op.
|
|
1515
1525
|
if (local) {
|
|
1516
|
-
(0,
|
|
1526
|
+
(0, core_utils_1.assert)(localOpMetadata !== undefined && isKeyEditLocalOpMetadata(localOpMetadata), 0x011 /* pendingMessageId is missing from the local client's operation */);
|
|
1517
1527
|
const pendingMessageIds = this.pendingKeys.get(op.key);
|
|
1518
|
-
(0,
|
|
1528
|
+
(0, core_utils_1.assert)(pendingMessageIds !== undefined &&
|
|
1519
1529
|
pendingMessageIds[0] === localOpMetadata.pendingMessageId, 0x331 /* Unexpected pending message received */);
|
|
1520
1530
|
pendingMessageIds.shift();
|
|
1521
1531
|
if (pendingMessageIds.length === 0) {
|
|
@@ -1557,13 +1567,13 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1557
1567
|
if ((pendingDeleteCount !== undefined && pendingDeleteCount > 0) ||
|
|
1558
1568
|
(pendingCreateCount !== undefined && pendingCreateCount > 0)) {
|
|
1559
1569
|
if (local) {
|
|
1560
|
-
(0,
|
|
1570
|
+
(0, core_utils_1.assert)(isSubDirLocalOpMetadata(localOpMetadata), 0x012 /* pendingMessageId is missing from the local client's operation */);
|
|
1561
1571
|
if (localOpMetadata.type === "deleteSubDir") {
|
|
1562
|
-
(0,
|
|
1572
|
+
(0, core_utils_1.assert)(pendingDeleteCount !== undefined && pendingDeleteCount > 0, 0x6c2 /* pendingDeleteCount should exist */);
|
|
1563
1573
|
this.decrementPendingSubDirCount(this.pendingDeleteSubDirectoriesTracker, op.subdirName);
|
|
1564
1574
|
}
|
|
1565
1575
|
else if (localOpMetadata.type === "createSubDir") {
|
|
1566
|
-
(0,
|
|
1576
|
+
(0, core_utils_1.assert)(pendingCreateCount !== undefined && pendingCreateCount > 0, 0x6c3 /* pendingCreateCount should exist */);
|
|
1567
1577
|
this.decrementPendingSubDirCount(this.pendingCreateSubDirectoriesTracker, op.subdirName);
|
|
1568
1578
|
}
|
|
1569
1579
|
}
|
|
@@ -1597,8 +1607,9 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1597
1607
|
if (op.type === "createSubDirectory") {
|
|
1598
1608
|
const dir = this._subdirectories.get(op.subdirName);
|
|
1599
1609
|
// Child sub directory create seq number can't be lower than the parent subdirectory.
|
|
1600
|
-
|
|
1601
|
-
|
|
1610
|
+
// The sequence number for multiple ops can be the same when multiple createSubDirectory occurs with grouped batching enabled, thus <= and not just <.
|
|
1611
|
+
if (this.sequenceNumber !== -1 && this.sequenceNumber <= msg.sequenceNumber) {
|
|
1612
|
+
if (dir?.sequenceNumber === -1) {
|
|
1602
1613
|
// Only set the seq on the first message, could be more
|
|
1603
1614
|
dir.sequenceNumber = msg.sequenceNumber;
|
|
1604
1615
|
}
|
|
@@ -1649,7 +1660,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1649
1660
|
*/
|
|
1650
1661
|
deleteCore(key, local) {
|
|
1651
1662
|
const previousLocalValue = this._storage.get(key);
|
|
1652
|
-
const previousValue = previousLocalValue
|
|
1663
|
+
const previousValue = previousLocalValue?.value;
|
|
1653
1664
|
const successfullyRemoved = this._storage.delete(key);
|
|
1654
1665
|
if (successfullyRemoved) {
|
|
1655
1666
|
const event = { key, path: this.absolutePath, previousValue };
|
|
@@ -1668,7 +1679,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1668
1679
|
*/
|
|
1669
1680
|
setCore(key, value, local) {
|
|
1670
1681
|
const previousLocalValue = this._storage.get(key);
|
|
1671
|
-
const previousValue = previousLocalValue
|
|
1682
|
+
const previousValue = previousLocalValue?.value;
|
|
1672
1683
|
this._storage.set(key, value);
|
|
1673
1684
|
const event = { key, path: this.absolutePath, previousValue };
|
|
1674
1685
|
this.directory.emit("valueChanged", event, local, this.directory);
|
|
@@ -1682,7 +1693,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
|
|
|
1682
1693
|
* @param local - Whether the message originated from the local client
|
|
1683
1694
|
* @param seq - Sequence number at which this directory is created
|
|
1684
1695
|
* @param clientId - Id of client which created this directory.
|
|
1685
|
-
* @returns
|
|
1696
|
+
* @returns True if is newly created, false if it already existed.
|
|
1686
1697
|
*/
|
|
1687
1698
|
createSubDirectoryCore(subdirName, local, seq, clientId) {
|
|
1688
1699
|
const subdir = this._subdirectories.get(subdirName);
|