@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/eslint.config.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* To regenerate: pnpm tsx scripts/generate-flat-eslint-configs.ts --typescript
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
5
4
|
*/
|
|
5
|
+
|
|
6
6
|
import type { Linter } from "eslint";
|
|
7
7
|
import { strict } from "../../../common/build/eslint-config-fluid/flat.mts";
|
|
8
8
|
|
package/lib/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/lib/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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;OAIG;IACI,2BAA2B,CACjC,EAAE,EAAE,+BAA+B,EACnC,eAAe,EAAE,qBAAqB,GACpC,IAAI;IAoCP;;;;OAIG;IACK,oBAAoB,CAC3B,UAAU,EAAE,gBAAgB,GAC1B,SAAS,CAAC,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAAE,IAAI,CAAC;IASvC,yBAAyB,IAAI,WAAW;IAS/C;;;;OAIG;IACI,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAKzD;;;;OAIG;IACI,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,GAAG,IAAI;IAM9E;;;;OAIG;IAEI,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,eAAe,EAAE,wBAAwB,GAAG,IAAI;IAwJzE;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAIpB;;;;;OAKG;IACH,OAAO,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/lib/directory.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
var _a, _b;
|
|
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 */
|
|
6
8
|
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
7
9
|
import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
8
10
|
import { MessageType } from "@fluidframework/driver-definitions/internal";
|
|
@@ -169,7 +171,7 @@ export class SharedDirectory extends SharedObject {
|
|
|
169
171
|
// TODO: Use `unknown` instead (breaking change).
|
|
170
172
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
171
173
|
forEach(callback) {
|
|
172
|
-
// eslint-disable-next-line unicorn/no-array-for-each
|
|
174
|
+
// eslint-disable-next-line unicorn/no-array-for-each
|
|
173
175
|
this.root.forEach(callback);
|
|
174
176
|
}
|
|
175
177
|
/**
|
|
@@ -1078,7 +1080,9 @@ class SubDirectory extends TypedEventEmitter {
|
|
|
1078
1080
|
if (!this.directory.isAttached()) {
|
|
1079
1081
|
const successfullyRemoved = this.sequencedStorageData.delete(key);
|
|
1080
1082
|
// Only emit if we actually deleted something.
|
|
1081
|
-
if (
|
|
1083
|
+
if (this.isNotDisposedAndReachable() &&
|
|
1084
|
+
previousOptimisticLocalValue !== undefined &&
|
|
1085
|
+
successfullyRemoved) {
|
|
1082
1086
|
const event = {
|
|
1083
1087
|
key,
|
|
1084
1088
|
path: this.absolutePath,
|
|
@@ -1109,7 +1113,7 @@ class SubDirectory extends TypedEventEmitter {
|
|
|
1109
1113
|
// Only emit if we locally believe we deleted something. Otherwise we still send the op
|
|
1110
1114
|
// (permitting speculative deletion even if we don't see anything locally) but don't emit
|
|
1111
1115
|
// a valueChanged since we in fact did not locally observe a value change.
|
|
1112
|
-
if (previousOptimisticLocalValue !== undefined) {
|
|
1116
|
+
if (this.isNotDisposedAndReachable() && previousOptimisticLocalValue !== undefined) {
|
|
1113
1117
|
const event = {
|
|
1114
1118
|
key,
|
|
1115
1119
|
path: this.absolutePath,
|
|
@@ -1132,7 +1136,7 @@ class SubDirectory extends TypedEventEmitter {
|
|
|
1132
1136
|
if (!this.directory.isAttached()) {
|
|
1133
1137
|
this.sequencedStorageData.clear();
|
|
1134
1138
|
this.directory.emit("clear", true, this.directory);
|
|
1135
|
-
this.directory.emit("
|
|
1139
|
+
this.directory.emit("cleared", this.absolutePath, true, this.directory);
|
|
1136
1140
|
return;
|
|
1137
1141
|
}
|
|
1138
1142
|
const pendingClear = {
|
|
@@ -1142,7 +1146,7 @@ class SubDirectory extends TypedEventEmitter {
|
|
|
1142
1146
|
};
|
|
1143
1147
|
this.pendingStorageData.push(pendingClear);
|
|
1144
1148
|
this.directory.emit("clear", true, this.directory);
|
|
1145
|
-
this.directory.emit("
|
|
1149
|
+
this.directory.emit("cleared", this.absolutePath, true, this.directory);
|
|
1146
1150
|
const op = {
|
|
1147
1151
|
type: "clear",
|
|
1148
1152
|
path: this.absolutePath,
|
|
@@ -1244,6 +1248,26 @@ class SubDirectory extends TypedEventEmitter {
|
|
|
1244
1248
|
this.throwIfDisposed();
|
|
1245
1249
|
return this.internalIterator();
|
|
1246
1250
|
}
|
|
1251
|
+
/**
|
|
1252
|
+
* Checks if this directory should be considered visible in the optimistic view.
|
|
1253
|
+
* This requires both:
|
|
1254
|
+
* 1. The directory object must not be disposed (disposed = true means fully deleted)
|
|
1255
|
+
* 2. The directory must be reachable via getWorkingDirectory (respects pending deletes)
|
|
1256
|
+
*
|
|
1257
|
+
* There's a timing window where a directory has a pending delete but is not yet disposed:
|
|
1258
|
+
* - When deleteSubDirectory is called locally, it adds a pending delete entry and emits a
|
|
1259
|
+
* "dispose" event, but doesn't set disposed = true yet.
|
|
1260
|
+
* - The directory only gets fully disposed when the delete message is sequenced.
|
|
1261
|
+
* - During this window, !disposed is true but getWorkingDirectory returns undefined.
|
|
1262
|
+
*
|
|
1263
|
+
* This method should be used before emitting events during remote message processing to ensure
|
|
1264
|
+
* events aren't emitted for directories that are invisible in the optimistic view.
|
|
1265
|
+
*
|
|
1266
|
+
* @returns true if this directory is visible in the optimistic view, false otherwise
|
|
1267
|
+
*/
|
|
1268
|
+
isNotDisposedAndReachable() {
|
|
1269
|
+
return (!this.disposed && this.directory.getWorkingDirectory(this.absolutePath) !== undefined);
|
|
1270
|
+
}
|
|
1247
1271
|
get sequencedSubdirectories() {
|
|
1248
1272
|
this.throwIfDisposed();
|
|
1249
1273
|
return this._sequencedSubdirectories;
|
|
@@ -1280,13 +1304,18 @@ class SubDirectory extends TypedEventEmitter {
|
|
|
1280
1304
|
this.sequencedStorageData.clear();
|
|
1281
1305
|
// Only emit for remote ops, we would have already emitted for local ops. Only emit if there
|
|
1282
1306
|
// is no optimistically-applied local pending clear that would supersede this remote clear.
|
|
1307
|
+
// Don't emit events if this directory has been disposed or no longer exists
|
|
1283
1308
|
if (!this.pendingStorageData.some((entry) => entry.type === "clear")) {
|
|
1284
1309
|
this.directory.emit("clear", local, this.directory);
|
|
1285
|
-
this.directory.emit("
|
|
1310
|
+
this.directory.emit("cleared", this.absolutePath, local, this.directory);
|
|
1286
1311
|
}
|
|
1287
1312
|
// For pending set operations, emit valueChanged events
|
|
1288
1313
|
// Include 'path' so listeners can identify which subdirectory the change occurred in
|
|
1289
1314
|
for (const { key, previousValue } of pendingSets) {
|
|
1315
|
+
// Stop emitting events if this directory has been disposed or is no longer reachable
|
|
1316
|
+
if (!this.isNotDisposedAndReachable()) {
|
|
1317
|
+
break;
|
|
1318
|
+
}
|
|
1290
1319
|
this.directory.emit("valueChanged", {
|
|
1291
1320
|
key,
|
|
1292
1321
|
path: this.absolutePath,
|
|
@@ -1321,7 +1350,8 @@ class SubDirectory extends TypedEventEmitter {
|
|
|
1321
1350
|
const previousValue = this.sequencedStorageData.get(op.key);
|
|
1322
1351
|
this.sequencedStorageData.delete(op.key);
|
|
1323
1352
|
// Suppress the event if local changes would cause the incoming change to be invisible optimistically.
|
|
1324
|
-
if (
|
|
1353
|
+
if (this.isNotDisposedAndReachable() &&
|
|
1354
|
+
!this.pendingStorageData.some((entry) => entry.type === "clear" || entry.key === op.key)) {
|
|
1325
1355
|
const event = {
|
|
1326
1356
|
key: op.key,
|
|
1327
1357
|
path: this.absolutePath,
|
|
@@ -1363,7 +1393,8 @@ class SubDirectory extends TypedEventEmitter {
|
|
|
1363
1393
|
const previousValue = this.sequencedStorageData.get(key);
|
|
1364
1394
|
this.sequencedStorageData.set(key, value);
|
|
1365
1395
|
// Suppress the event if local changes would cause the incoming change to be invisible optimistically.
|
|
1366
|
-
if (
|
|
1396
|
+
if (this.isNotDisposedAndReachable() &&
|
|
1397
|
+
!this.pendingStorageData.some((entry) => entry.type === "clear" || entry.key === key)) {
|
|
1367
1398
|
const event = { key, path: this.absolutePath, previousValue };
|
|
1368
1399
|
this.directory.emit("valueChanged", event, local, this.directory);
|
|
1369
1400
|
const containedEvent = { key, previousValue };
|
|
@@ -1422,7 +1453,8 @@ class SubDirectory extends TypedEventEmitter {
|
|
|
1422
1453
|
this.registerEventsOnSubDirectory(subDir, op.subdirName);
|
|
1423
1454
|
this._sequencedSubdirectories.set(op.subdirName, subDir);
|
|
1424
1455
|
// Suppress the event if local changes would cause the incoming change to be invisible optimistically.
|
|
1425
|
-
if (!this.pendingSubDirectoryData.some((entry) => entry.subdirName === op.subdirName)
|
|
1456
|
+
if (!this.pendingSubDirectoryData.some((entry) => entry.subdirName === op.subdirName) &&
|
|
1457
|
+
subDir.isNotDisposedAndReachable()) {
|
|
1426
1458
|
this.emit("subDirectoryCreated", op.subdirName, local, this);
|
|
1427
1459
|
}
|
|
1428
1460
|
}
|