@fluidframework/map 2.74.0 → 2.81.0-374083
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 +8 -0
- package/api-report/map.legacy.beta.api.md +2 -0
- package/dist/directory.d.ts +20 -2
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +41 -9
- 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 +31 -4
- package/dist/mapKernel.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +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 +20 -2
- package/lib/directory.d.ts.map +1 -1
- package/lib/directory.js +41 -9
- 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 +31 -4
- package/lib/mapKernel.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +26 -26
- package/src/directory.ts +49 -9
- package/src/interfaces.ts +18 -22
- package/src/map.ts +1 -1
- package/src/mapKernel.ts +29 -0
- package/src/packageVersion.ts +1 -1
- package/.eslintrc.cjs +0 -28
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @fluidframework/map
|
|
2
2
|
|
|
3
|
+
## 2.80.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- map: Emit valueChanged events for deleted keys after a clear operation ([#26102](https://github.com/microsoft/FluidFramework/pull/26102)) [7c9be0e2d2c](https://github.com/microsoft/FluidFramework/commit/7c9be0e2d2cd7dd40aaa6bf6812ad9a6d43609f5)
|
|
8
|
+
|
|
9
|
+
When a `clear` op is processed on SharedMap, `valueChanged` events are now emitted for each key that was deleted. Previously, only the `clear` event was emitted with no subsequent `valueChanged` events.
|
|
10
|
+
|
|
3
11
|
## 2.74.0
|
|
4
12
|
|
|
5
13
|
Dependency updates only.
|
|
@@ -78,7 +78,9 @@ export interface ISharedDirectory extends ISharedObject<ISharedDirectoryEvents &
|
|
|
78
78
|
// @beta @sealed @legacy
|
|
79
79
|
export interface ISharedDirectoryEvents extends ISharedObjectEvents {
|
|
80
80
|
(event: "valueChanged", listener: (changed: IDirectoryValueChanged, local: boolean, target: IEventThisPlaceHolder) => void): any;
|
|
81
|
+
// @deprecated
|
|
81
82
|
(event: "clear", listener: (local: boolean, target: IEventThisPlaceHolder) => void): any;
|
|
83
|
+
(event: "cleared", listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void): any;
|
|
82
84
|
(event: "subDirectoryCreated", listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void): any;
|
|
83
85
|
(event: "subDirectoryDeleted", listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void): any;
|
|
84
86
|
}
|
package/dist/directory.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { ISummaryTreeWithStats, ITelemetryContext, IRuntimeMessageCollectio
|
|
|
8
8
|
import type { IFluidSerializer } from "@fluidframework/shared-object-base/internal";
|
|
9
9
|
import { SharedObject } from "@fluidframework/shared-object-base/internal";
|
|
10
10
|
import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
11
|
-
import type { IDirectory, IDirectoryEvents, ISharedDirectory,
|
|
11
|
+
import type { IDirectory, IDirectoryEvents, ISharedDirectory, ISharedDirectoryEvents } from "./interfaces.js";
|
|
12
12
|
import type { ISerializableValue, ISerializedValue } from "./internalInterfaces.js";
|
|
13
13
|
/**
|
|
14
14
|
* Operation indicating a value should be set for a key.
|
|
@@ -212,7 +212,7 @@ interface SequenceData {
|
|
|
212
212
|
*
|
|
213
213
|
* @sealed
|
|
214
214
|
*/
|
|
215
|
-
export declare class SharedDirectory extends SharedObject<
|
|
215
|
+
export declare class SharedDirectory extends SharedObject<ISharedDirectoryEvents> implements ISharedDirectory {
|
|
216
216
|
/**
|
|
217
217
|
* String representation for the class.
|
|
218
218
|
*/
|
|
@@ -579,6 +579,24 @@ declare class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implement
|
|
|
579
579
|
* is true, we will include them since some scenarios require this.
|
|
580
580
|
*/
|
|
581
581
|
private readonly getOptimisticSubDirectory;
|
|
582
|
+
/**
|
|
583
|
+
* Checks if this directory should be considered visible in the optimistic view.
|
|
584
|
+
* This requires both:
|
|
585
|
+
* 1. The directory object must not be disposed (disposed = true means fully deleted)
|
|
586
|
+
* 2. The directory must be reachable via getWorkingDirectory (respects pending deletes)
|
|
587
|
+
*
|
|
588
|
+
* There's a timing window where a directory has a pending delete but is not yet disposed:
|
|
589
|
+
* - When deleteSubDirectory is called locally, it adds a pending delete entry and emits a
|
|
590
|
+
* "dispose" event, but doesn't set disposed = true yet.
|
|
591
|
+
* - The directory only gets fully disposed when the delete message is sequenced.
|
|
592
|
+
* - During this window, !disposed is true but getWorkingDirectory returns undefined.
|
|
593
|
+
*
|
|
594
|
+
* This method should be used before emitting events during remote message processing to ensure
|
|
595
|
+
* events aren't emitted for directories that are invisible in the optimistic view.
|
|
596
|
+
*
|
|
597
|
+
* @returns true if this directory is visible in the optimistic view, false otherwise
|
|
598
|
+
*/
|
|
599
|
+
private isNotDisposedAndReachable;
|
|
582
600
|
get sequencedSubdirectories(): ReadonlyMap<string, SubDirectory>;
|
|
583
601
|
/**
|
|
584
602
|
* Process a clear operation.
|
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;AAKH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,KAAK,EACX,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AAGxD,OAAO,KAAK,EACX,qBAAqB,EACrB,iBAAiB,EACjB,yBAAyB,EAEzB,yBAAyB,EACzB,MAAM,8CAA8C,CAAC;AAEtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EACN,YAAY,EAIZ,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAEN,KAAK,mBAAmB,EAGxB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,KAAK,EACX,UAAU,EACV,gBAAgB,EAEhB,gBAAgB,EAChB,sBAAsB,EAEtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAEX,kBAAkB,EAClB,gBAAgB,EAChB,MAAM,yBAAyB,CAAC;AAuCjC;;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;IAEH,KAAK,EAAE,kBAAkB,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;IAEf;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,sBAAsB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AO,CAAC,yCAAyC;IAgBjD,OAAO,CAAC,4BAA4B;IASpC,OAAO,CAAC,uBAAuB;IAiB/B,OAAO,CAAC,wBAAwB;IAehC,OAAO,CAAC,yBAAyB;IAQjC;;OAEG;IACH,OAAO,CAAC,+BAA+B;IAwCvC;;;;OAIG;IACI,8BAA8B,IAAI,IAAI;CAQ7C"}
|
package/dist/directory.js
CHANGED
|
@@ -9,6 +9,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
var _a, _b;
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.SharedDirectory = void 0;
|
|
12
|
+
// TODO: Fix prefer-nullish-coalescing and prefer-optional-chain lint violations
|
|
13
|
+
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/prefer-optional-chain */
|
|
12
14
|
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
13
15
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
14
16
|
const internal_2 = require("@fluidframework/driver-definitions/internal");
|
|
@@ -175,7 +177,7 @@ class SharedDirectory extends internal_5.SharedObject {
|
|
|
175
177
|
// TODO: Use `unknown` instead (breaking change).
|
|
176
178
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
177
179
|
forEach(callback) {
|
|
178
|
-
// eslint-disable-next-line unicorn/no-array-for-each
|
|
180
|
+
// eslint-disable-next-line unicorn/no-array-for-each
|
|
179
181
|
this.root.forEach(callback);
|
|
180
182
|
}
|
|
181
183
|
/**
|
|
@@ -1085,7 +1087,9 @@ class SubDirectory extends client_utils_1.TypedEventEmitter {
|
|
|
1085
1087
|
if (!this.directory.isAttached()) {
|
|
1086
1088
|
const successfullyRemoved = this.sequencedStorageData.delete(key);
|
|
1087
1089
|
// Only emit if we actually deleted something.
|
|
1088
|
-
if (
|
|
1090
|
+
if (this.isNotDisposedAndReachable() &&
|
|
1091
|
+
previousOptimisticLocalValue !== undefined &&
|
|
1092
|
+
successfullyRemoved) {
|
|
1089
1093
|
const event = {
|
|
1090
1094
|
key,
|
|
1091
1095
|
path: this.absolutePath,
|
|
@@ -1116,7 +1120,7 @@ class SubDirectory extends client_utils_1.TypedEventEmitter {
|
|
|
1116
1120
|
// Only emit if we locally believe we deleted something. Otherwise we still send the op
|
|
1117
1121
|
// (permitting speculative deletion even if we don't see anything locally) but don't emit
|
|
1118
1122
|
// a valueChanged since we in fact did not locally observe a value change.
|
|
1119
|
-
if (previousOptimisticLocalValue !== undefined) {
|
|
1123
|
+
if (this.isNotDisposedAndReachable() && previousOptimisticLocalValue !== undefined) {
|
|
1120
1124
|
const event = {
|
|
1121
1125
|
key,
|
|
1122
1126
|
path: this.absolutePath,
|
|
@@ -1139,7 +1143,7 @@ class SubDirectory extends client_utils_1.TypedEventEmitter {
|
|
|
1139
1143
|
if (!this.directory.isAttached()) {
|
|
1140
1144
|
this.sequencedStorageData.clear();
|
|
1141
1145
|
this.directory.emit("clear", true, this.directory);
|
|
1142
|
-
this.directory.emit("
|
|
1146
|
+
this.directory.emit("cleared", this.absolutePath, true, this.directory);
|
|
1143
1147
|
return;
|
|
1144
1148
|
}
|
|
1145
1149
|
const pendingClear = {
|
|
@@ -1149,7 +1153,7 @@ class SubDirectory extends client_utils_1.TypedEventEmitter {
|
|
|
1149
1153
|
};
|
|
1150
1154
|
this.pendingStorageData.push(pendingClear);
|
|
1151
1155
|
this.directory.emit("clear", true, this.directory);
|
|
1152
|
-
this.directory.emit("
|
|
1156
|
+
this.directory.emit("cleared", this.absolutePath, true, this.directory);
|
|
1153
1157
|
const op = {
|
|
1154
1158
|
type: "clear",
|
|
1155
1159
|
path: this.absolutePath,
|
|
@@ -1251,6 +1255,26 @@ class SubDirectory extends client_utils_1.TypedEventEmitter {
|
|
|
1251
1255
|
this.throwIfDisposed();
|
|
1252
1256
|
return this.internalIterator();
|
|
1253
1257
|
}
|
|
1258
|
+
/**
|
|
1259
|
+
* Checks if this directory should be considered visible in the optimistic view.
|
|
1260
|
+
* This requires both:
|
|
1261
|
+
* 1. The directory object must not be disposed (disposed = true means fully deleted)
|
|
1262
|
+
* 2. The directory must be reachable via getWorkingDirectory (respects pending deletes)
|
|
1263
|
+
*
|
|
1264
|
+
* There's a timing window where a directory has a pending delete but is not yet disposed:
|
|
1265
|
+
* - When deleteSubDirectory is called locally, it adds a pending delete entry and emits a
|
|
1266
|
+
* "dispose" event, but doesn't set disposed = true yet.
|
|
1267
|
+
* - The directory only gets fully disposed when the delete message is sequenced.
|
|
1268
|
+
* - During this window, !disposed is true but getWorkingDirectory returns undefined.
|
|
1269
|
+
*
|
|
1270
|
+
* This method should be used before emitting events during remote message processing to ensure
|
|
1271
|
+
* events aren't emitted for directories that are invisible in the optimistic view.
|
|
1272
|
+
*
|
|
1273
|
+
* @returns true if this directory is visible in the optimistic view, false otherwise
|
|
1274
|
+
*/
|
|
1275
|
+
isNotDisposedAndReachable() {
|
|
1276
|
+
return (!this.disposed && this.directory.getWorkingDirectory(this.absolutePath) !== undefined);
|
|
1277
|
+
}
|
|
1254
1278
|
get sequencedSubdirectories() {
|
|
1255
1279
|
this.throwIfDisposed();
|
|
1256
1280
|
return this._sequencedSubdirectories;
|
|
@@ -1287,13 +1311,18 @@ class SubDirectory extends client_utils_1.TypedEventEmitter {
|
|
|
1287
1311
|
this.sequencedStorageData.clear();
|
|
1288
1312
|
// Only emit for remote ops, we would have already emitted for local ops. Only emit if there
|
|
1289
1313
|
// is no optimistically-applied local pending clear that would supersede this remote clear.
|
|
1314
|
+
// Don't emit events if this directory has been disposed or no longer exists
|
|
1290
1315
|
if (!this.pendingStorageData.some((entry) => entry.type === "clear")) {
|
|
1291
1316
|
this.directory.emit("clear", local, this.directory);
|
|
1292
|
-
this.directory.emit("
|
|
1317
|
+
this.directory.emit("cleared", this.absolutePath, local, this.directory);
|
|
1293
1318
|
}
|
|
1294
1319
|
// For pending set operations, emit valueChanged events
|
|
1295
1320
|
// Include 'path' so listeners can identify which subdirectory the change occurred in
|
|
1296
1321
|
for (const { key, previousValue } of pendingSets) {
|
|
1322
|
+
// Stop emitting events if this directory has been disposed or is no longer reachable
|
|
1323
|
+
if (!this.isNotDisposedAndReachable()) {
|
|
1324
|
+
break;
|
|
1325
|
+
}
|
|
1297
1326
|
this.directory.emit("valueChanged", {
|
|
1298
1327
|
key,
|
|
1299
1328
|
path: this.absolutePath,
|
|
@@ -1328,7 +1357,8 @@ class SubDirectory extends client_utils_1.TypedEventEmitter {
|
|
|
1328
1357
|
const previousValue = this.sequencedStorageData.get(op.key);
|
|
1329
1358
|
this.sequencedStorageData.delete(op.key);
|
|
1330
1359
|
// Suppress the event if local changes would cause the incoming change to be invisible optimistically.
|
|
1331
|
-
if (
|
|
1360
|
+
if (this.isNotDisposedAndReachable() &&
|
|
1361
|
+
!this.pendingStorageData.some((entry) => entry.type === "clear" || entry.key === op.key)) {
|
|
1332
1362
|
const event = {
|
|
1333
1363
|
key: op.key,
|
|
1334
1364
|
path: this.absolutePath,
|
|
@@ -1370,7 +1400,8 @@ class SubDirectory extends client_utils_1.TypedEventEmitter {
|
|
|
1370
1400
|
const previousValue = this.sequencedStorageData.get(key);
|
|
1371
1401
|
this.sequencedStorageData.set(key, value);
|
|
1372
1402
|
// Suppress the event if local changes would cause the incoming change to be invisible optimistically.
|
|
1373
|
-
if (
|
|
1403
|
+
if (this.isNotDisposedAndReachable() &&
|
|
1404
|
+
!this.pendingStorageData.some((entry) => entry.type === "clear" || entry.key === key)) {
|
|
1374
1405
|
const event = { key, path: this.absolutePath, previousValue };
|
|
1375
1406
|
this.directory.emit("valueChanged", event, local, this.directory);
|
|
1376
1407
|
const containedEvent = { key, previousValue };
|
|
@@ -1429,7 +1460,8 @@ class SubDirectory extends client_utils_1.TypedEventEmitter {
|
|
|
1429
1460
|
this.registerEventsOnSubDirectory(subDir, op.subdirName);
|
|
1430
1461
|
this._sequencedSubdirectories.set(op.subdirName, subDir);
|
|
1431
1462
|
// Suppress the event if local changes would cause the incoming change to be invisible optimistically.
|
|
1432
|
-
if (!this.pendingSubDirectoryData.some((entry) => entry.subdirName === op.subdirName)
|
|
1463
|
+
if (!this.pendingSubDirectoryData.some((entry) => entry.subdirName === op.subdirName) &&
|
|
1464
|
+
subDir.isNotDisposedAndReachable()) {
|
|
1433
1465
|
this.emit("subDirectoryCreated", op.subdirName, local, this);
|
|
1434
1466
|
}
|
|
1435
1467
|
}
|