@fluidframework/map 2.80.0 → 2.81.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/CHANGELOG.md +26 -0
- package/api-report/map.legacy.beta.api.md +2 -0
- package/dist/directory.d.ts +2 -2
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +6 -4
- package/dist/directory.js.map +1 -1
- package/dist/interfaces.d.ts +14 -18
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/map.js +1 -1
- package/dist/map.js.map +1 -1
- package/dist/mapKernel.d.ts.map +1 -1
- package/dist/mapKernel.js +12 -4
- 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/eslint.config.mts +4 -4
- package/lib/directory.d.ts +2 -2
- package/lib/directory.d.ts.map +1 -1
- package/lib/directory.js +6 -4
- package/lib/directory.js.map +1 -1
- package/lib/interfaces.d.ts +14 -18
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/map.js +1 -1
- package/lib/map.js.map +1 -1
- package/lib/mapKernel.d.ts.map +1 -1
- package/lib/mapKernel.js +12 -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 +21 -21
- package/src/directory.ts +9 -6
- package/src/interfaces.ts +18 -22
- package/src/map.ts +1 -1
- package/src/mapKernel.ts +4 -0
- package/src/packageVersion.ts +1 -1
- package/.eslintrc.cjs +0 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/map",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.81.0",
|
|
4
4
|
"description": "Distributed map",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -81,32 +81,32 @@
|
|
|
81
81
|
"temp-directory": "nyc/.nyc_output"
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@fluid-internal/client-utils": "~2.
|
|
85
|
-
"@fluidframework/core-interfaces": "~2.
|
|
86
|
-
"@fluidframework/core-utils": "~2.
|
|
87
|
-
"@fluidframework/datastore-definitions": "~2.
|
|
88
|
-
"@fluidframework/driver-definitions": "~2.
|
|
89
|
-
"@fluidframework/driver-utils": "~2.
|
|
90
|
-
"@fluidframework/runtime-definitions": "~2.
|
|
91
|
-
"@fluidframework/runtime-utils": "~2.
|
|
92
|
-
"@fluidframework/shared-object-base": "~2.
|
|
93
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
84
|
+
"@fluid-internal/client-utils": "~2.81.0",
|
|
85
|
+
"@fluidframework/core-interfaces": "~2.81.0",
|
|
86
|
+
"@fluidframework/core-utils": "~2.81.0",
|
|
87
|
+
"@fluidframework/datastore-definitions": "~2.81.0",
|
|
88
|
+
"@fluidframework/driver-definitions": "~2.81.0",
|
|
89
|
+
"@fluidframework/driver-utils": "~2.81.0",
|
|
90
|
+
"@fluidframework/runtime-definitions": "~2.81.0",
|
|
91
|
+
"@fluidframework/runtime-utils": "~2.81.0",
|
|
92
|
+
"@fluidframework/shared-object-base": "~2.81.0",
|
|
93
|
+
"@fluidframework/telemetry-utils": "~2.81.0",
|
|
94
94
|
"path-browserify": "^1.0.1"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
97
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
98
98
|
"@biomejs/biome": "~1.9.3",
|
|
99
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
100
|
-
"@fluid-private/stochastic-test-utils": "~2.
|
|
101
|
-
"@fluid-private/test-dds-utils": "~2.
|
|
102
|
-
"@fluid-tools/benchmark": "^0.
|
|
103
|
-
"@fluid-tools/build-cli": "^0.
|
|
99
|
+
"@fluid-internal/mocha-test-setup": "~2.81.0",
|
|
100
|
+
"@fluid-private/stochastic-test-utils": "~2.81.0",
|
|
101
|
+
"@fluid-private/test-dds-utils": "~2.81.0",
|
|
102
|
+
"@fluid-tools/benchmark": "^0.52.0",
|
|
103
|
+
"@fluid-tools/build-cli": "^0.63.0",
|
|
104
104
|
"@fluidframework/build-common": "^2.0.3",
|
|
105
|
-
"@fluidframework/build-tools": "^0.
|
|
106
|
-
"@fluidframework/container-definitions": "~2.
|
|
107
|
-
"@fluidframework/eslint-config-fluid": "~2.
|
|
108
|
-
"@fluidframework/map-previous": "npm:@fluidframework/map@2.
|
|
109
|
-
"@fluidframework/test-runtime-utils": "~2.
|
|
105
|
+
"@fluidframework/build-tools": "^0.63.0",
|
|
106
|
+
"@fluidframework/container-definitions": "~2.81.0",
|
|
107
|
+
"@fluidframework/eslint-config-fluid": "~2.81.0",
|
|
108
|
+
"@fluidframework/map-previous": "npm:@fluidframework/map@2.80.0",
|
|
109
|
+
"@fluidframework/test-runtime-utils": "~2.81.0",
|
|
110
110
|
"@microsoft/api-extractor": "7.52.11",
|
|
111
111
|
"@types/mocha": "^10.0.10",
|
|
112
112
|
"@types/node": "^18.19.0",
|
package/src/directory.ts
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
// TODO: Fix prefer-nullish-coalescing and prefer-optional-chain lint violations
|
|
7
|
+
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/prefer-optional-chain */
|
|
8
|
+
|
|
6
9
|
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
7
10
|
import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
8
11
|
import type {
|
|
@@ -40,7 +43,7 @@ import type {
|
|
|
40
43
|
IDirectoryEvents,
|
|
41
44
|
IDirectoryValueChanged,
|
|
42
45
|
ISharedDirectory,
|
|
43
|
-
|
|
46
|
+
ISharedDirectoryEvents,
|
|
44
47
|
IValueChanged,
|
|
45
48
|
} from "./interfaces.js";
|
|
46
49
|
import type {
|
|
@@ -402,7 +405,7 @@ interface SequenceData {
|
|
|
402
405
|
* @sealed
|
|
403
406
|
*/
|
|
404
407
|
export class SharedDirectory
|
|
405
|
-
extends SharedObject<
|
|
408
|
+
extends SharedObject<ISharedDirectoryEvents>
|
|
406
409
|
implements ISharedDirectory
|
|
407
410
|
{
|
|
408
411
|
/**
|
|
@@ -525,7 +528,7 @@ export class SharedDirectory
|
|
|
525
528
|
// TODO: Use `unknown` instead (breaking change).
|
|
526
529
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
527
530
|
public forEach(callback: (value: any, key: string, map: Map<string, any>) => void): void {
|
|
528
|
-
// eslint-disable-next-line unicorn/no-array-for-each
|
|
531
|
+
// eslint-disable-next-line unicorn/no-array-for-each
|
|
529
532
|
this.root.forEach(callback);
|
|
530
533
|
}
|
|
531
534
|
|
|
@@ -1574,7 +1577,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
|
|
|
1574
1577
|
if (!this.directory.isAttached()) {
|
|
1575
1578
|
this.sequencedStorageData.clear();
|
|
1576
1579
|
this.directory.emit("clear", true, this.directory);
|
|
1577
|
-
this.directory.emit("
|
|
1580
|
+
this.directory.emit("cleared", this.absolutePath, true, this.directory);
|
|
1578
1581
|
return;
|
|
1579
1582
|
}
|
|
1580
1583
|
|
|
@@ -1586,7 +1589,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
|
|
|
1586
1589
|
this.pendingStorageData.push(pendingClear);
|
|
1587
1590
|
|
|
1588
1591
|
this.directory.emit("clear", true, this.directory);
|
|
1589
|
-
this.directory.emit("
|
|
1592
|
+
this.directory.emit("cleared", this.absolutePath, true, this.directory);
|
|
1590
1593
|
const op: IDirectoryOperation = {
|
|
1591
1594
|
type: "clear",
|
|
1592
1595
|
path: this.absolutePath,
|
|
@@ -1937,7 +1940,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
|
|
|
1937
1940
|
// Don't emit events if this directory has been disposed or no longer exists
|
|
1938
1941
|
if (!this.pendingStorageData.some((entry) => entry.type === "clear")) {
|
|
1939
1942
|
this.directory.emit("clear", local, this.directory);
|
|
1940
|
-
this.directory.emit("
|
|
1943
|
+
this.directory.emit("cleared", this.absolutePath, local, this.directory);
|
|
1941
1944
|
}
|
|
1942
1945
|
|
|
1943
1946
|
// For pending set operations, emit valueChanged events
|
package/src/interfaces.ts
CHANGED
|
@@ -153,6 +153,8 @@ export interface ISharedDirectoryEvents extends ISharedObjectEvents {
|
|
|
153
153
|
/**
|
|
154
154
|
* Emitted when the {@link ISharedDirectory} is cleared.
|
|
155
155
|
*
|
|
156
|
+
* @deprecated Use the "cleared" event instead which provides the path that was cleared.
|
|
157
|
+
*
|
|
156
158
|
* @remarks Listener parameters:
|
|
157
159
|
*
|
|
158
160
|
* - `local` - Whether the clear originated from this client.
|
|
@@ -161,6 +163,22 @@ export interface ISharedDirectoryEvents extends ISharedObjectEvents {
|
|
|
161
163
|
*/
|
|
162
164
|
(event: "clear", listener: (local: boolean, target: IEventThisPlaceHolder) => void);
|
|
163
165
|
|
|
166
|
+
/**
|
|
167
|
+
* Emitted when the {@link ISharedDirectory} is cleared.
|
|
168
|
+
*
|
|
169
|
+
* @remarks Listener parameters:
|
|
170
|
+
*
|
|
171
|
+
* - `path` - The absolute path to the directory that was cleared.
|
|
172
|
+
*
|
|
173
|
+
* - `local` - Whether the clear originated from this client.
|
|
174
|
+
*
|
|
175
|
+
* - `target` - The {@link ISharedDirectory} itself.
|
|
176
|
+
*/
|
|
177
|
+
(
|
|
178
|
+
event: "cleared",
|
|
179
|
+
listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,
|
|
180
|
+
);
|
|
181
|
+
|
|
164
182
|
/**
|
|
165
183
|
* Emitted when a subdirectory is created.
|
|
166
184
|
*
|
|
@@ -277,28 +295,6 @@ export interface IDirectoryEvents extends IEvent {
|
|
|
277
295
|
(event: "undisposed", listener: (target: IEventThisPlaceHolder) => void);
|
|
278
296
|
}
|
|
279
297
|
|
|
280
|
-
/**
|
|
281
|
-
* Internal events for {@link ISharedDirectory}.
|
|
282
|
-
* @internal
|
|
283
|
-
*/
|
|
284
|
-
export interface ISharedDirectoryEventsInternal extends ISharedDirectoryEvents {
|
|
285
|
-
/**
|
|
286
|
-
* Emitted when the {@link ISharedDirectory} is cleared.
|
|
287
|
-
*
|
|
288
|
-
* @remarks Listener parameters:
|
|
289
|
-
*
|
|
290
|
-
* - `path` - The absolute path to the directory that was cleared.
|
|
291
|
-
*
|
|
292
|
-
* - `local` - Whether the clear originated from this client.
|
|
293
|
-
*
|
|
294
|
-
* - `target` - The {@link ISharedDirectory} itself.
|
|
295
|
-
*/
|
|
296
|
-
(
|
|
297
|
-
event: "clearInternal",
|
|
298
|
-
listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
298
|
/**
|
|
303
299
|
* Provides a hierarchical organization of map-like data structures as SubDirectories.
|
|
304
300
|
* The values stored within can be accessed like a map, and the hierarchy can be navigated using path syntax.
|
package/src/map.ts
CHANGED
|
@@ -124,7 +124,7 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
|
|
|
124
124
|
// TODO: Use `unknown` instead (breaking change).
|
|
125
125
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
126
126
|
public forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void {
|
|
127
|
-
// eslint-disable-next-line unicorn/no-array-for-each
|
|
127
|
+
// eslint-disable-next-line unicorn/no-array-for-each
|
|
128
128
|
this.kernel.forEach(callbackFn);
|
|
129
129
|
}
|
|
130
130
|
|
package/src/mapKernel.ts
CHANGED
|
@@ -641,6 +641,7 @@ export class MapKernel {
|
|
|
641
641
|
// A pending clear will be last in the list, since it terminates all prior lifetimes.
|
|
642
642
|
const pendingClear = this.pendingData.pop();
|
|
643
643
|
assert(
|
|
644
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- using ?. could change behavior
|
|
644
645
|
pendingClear !== undefined &&
|
|
645
646
|
pendingClear.type === "clear" &&
|
|
646
647
|
pendingClear === typedLocalOpMetadata,
|
|
@@ -714,6 +715,7 @@ export class MapKernel {
|
|
|
714
715
|
this.sequencedData.clear();
|
|
715
716
|
const pendingClear = this.pendingData.shift();
|
|
716
717
|
assert(
|
|
718
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- using ?. could change behavior
|
|
717
719
|
pendingClear !== undefined &&
|
|
718
720
|
pendingClear.type === "clear" &&
|
|
719
721
|
pendingClear === localOpMetadata,
|
|
@@ -770,6 +772,7 @@ export class MapKernel {
|
|
|
770
772
|
);
|
|
771
773
|
const pendingEntry = this.pendingData[pendingEntryIndex];
|
|
772
774
|
assert(
|
|
775
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- using ?. could change behavior
|
|
773
776
|
pendingEntry !== undefined &&
|
|
774
777
|
pendingEntry.type === "delete" &&
|
|
775
778
|
pendingEntry === localOpMetadata,
|
|
@@ -810,6 +813,7 @@ export class MapKernel {
|
|
|
810
813
|
);
|
|
811
814
|
const pendingEntry = this.pendingData[pendingEntryIndex];
|
|
812
815
|
assert(
|
|
816
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- using ?. could change behavior
|
|
813
817
|
pendingEntry !== undefined && pendingEntry.type === "lifetime",
|
|
814
818
|
0xbf8 /* Couldn't match local set message to pending lifetime */,
|
|
815
819
|
);
|
package/src/packageVersion.ts
CHANGED
package/.eslintrc.cjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "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",
|
|
14
|
-
|
|
15
|
-
// TODO: consider re-enabling once we have addressed how this rule conflicts with our error codes.
|
|
16
|
-
"unicorn/numeric-separators-style": "off",
|
|
17
|
-
"@fluid-internal/fluid/no-unchecked-record-access": "warn",
|
|
18
|
-
},
|
|
19
|
-
overrides: [
|
|
20
|
-
{
|
|
21
|
-
files: ["src/test/**"],
|
|
22
|
-
rules: {
|
|
23
|
-
// Allow tests (which only run in Node.js) use `__dirname`
|
|
24
|
-
"unicorn/prefer-module": "off",
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
};
|