@fluidframework/map 2.50.0 → 2.51.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.
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/map";
8
- export declare const pkgVersion = "2.50.0";
8
+ export declare const pkgVersion = "2.51.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/map";
8
- export const pkgVersion = "2.50.0";
8
+ export const pkgVersion = "2.51.0";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAC7C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/map\";\nexport const pkgVersion = \"2.50.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAC7C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/map\";\nexport const pkgVersion = \"2.51.0\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/map",
3
- "version": "2.50.0",
3
+ "version": "2.51.0",
4
4
  "description": "Distributed map",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -81,33 +81,33 @@
81
81
  "temp-directory": "nyc/.nyc_output"
82
82
  },
83
83
  "dependencies": {
84
- "@fluid-internal/client-utils": "~2.50.0",
85
- "@fluidframework/core-interfaces": "~2.50.0",
86
- "@fluidframework/core-utils": "~2.50.0",
87
- "@fluidframework/datastore-definitions": "~2.50.0",
88
- "@fluidframework/driver-definitions": "~2.50.0",
89
- "@fluidframework/driver-utils": "~2.50.0",
90
- "@fluidframework/merge-tree": "~2.50.0",
91
- "@fluidframework/runtime-definitions": "~2.50.0",
92
- "@fluidframework/runtime-utils": "~2.50.0",
93
- "@fluidframework/shared-object-base": "~2.50.0",
94
- "@fluidframework/telemetry-utils": "~2.50.0",
84
+ "@fluid-internal/client-utils": "~2.51.0",
85
+ "@fluidframework/core-interfaces": "~2.51.0",
86
+ "@fluidframework/core-utils": "~2.51.0",
87
+ "@fluidframework/datastore-definitions": "~2.51.0",
88
+ "@fluidframework/driver-definitions": "~2.51.0",
89
+ "@fluidframework/driver-utils": "~2.51.0",
90
+ "@fluidframework/merge-tree": "~2.51.0",
91
+ "@fluidframework/runtime-definitions": "~2.51.0",
92
+ "@fluidframework/runtime-utils": "~2.51.0",
93
+ "@fluidframework/shared-object-base": "~2.51.0",
94
+ "@fluidframework/telemetry-utils": "~2.51.0",
95
95
  "path-browserify": "^1.0.1"
96
96
  },
97
97
  "devDependencies": {
98
98
  "@arethetypeswrong/cli": "^0.17.1",
99
99
  "@biomejs/biome": "~1.9.3",
100
- "@fluid-internal/mocha-test-setup": "~2.50.0",
101
- "@fluid-private/stochastic-test-utils": "~2.50.0",
102
- "@fluid-private/test-dds-utils": "~2.50.0",
100
+ "@fluid-internal/mocha-test-setup": "~2.51.0",
101
+ "@fluid-private/stochastic-test-utils": "~2.51.0",
102
+ "@fluid-private/test-dds-utils": "~2.51.0",
103
103
  "@fluid-tools/benchmark": "^0.51.0",
104
104
  "@fluid-tools/build-cli": "^0.56.0",
105
105
  "@fluidframework/build-common": "^2.0.3",
106
106
  "@fluidframework/build-tools": "^0.56.0",
107
- "@fluidframework/container-definitions": "~2.50.0",
107
+ "@fluidframework/container-definitions": "~2.51.0",
108
108
  "@fluidframework/eslint-config-fluid": "^5.7.4",
109
- "@fluidframework/map-previous": "npm:@fluidframework/map@2.43.0",
110
- "@fluidframework/test-runtime-utils": "~2.50.0",
109
+ "@fluidframework/map-previous": "npm:@fluidframework/map@2.50.0",
110
+ "@fluidframework/test-runtime-utils": "~2.51.0",
111
111
  "@microsoft/api-extractor": "7.52.8",
112
112
  "@types/mocha": "^10.0.10",
113
113
  "@types/node": "^18.19.0",
package/src/directory.ts CHANGED
@@ -47,7 +47,6 @@ import type {
47
47
  ISerializableValue,
48
48
  ISerializedValue,
49
49
  } from "./internalInterfaces.js";
50
- import type { ILocalValue } from "./localValues.js";
51
50
  import { serializeValue, migrateIfSharedSerializable } from "./localValues.js";
52
51
 
53
52
  // We use path-browserify since this code can run safely on the server or the browser.
@@ -890,7 +889,7 @@ export class SharedDirectory
890
889
  // as we are going to delete this subDirectory.
891
890
  if (subdir && !this.isSubDirectoryDeletePending(op.path)) {
892
891
  migrateIfSharedSerializable(op.value, this.serializer, this.handle);
893
- const localValue = local ? undefined : { value: op.value.value as unknown };
892
+ const localValue: unknown = local ? undefined : op.value.value;
894
893
  subdir.processSetMessage(msg, op, localValue, local, localOpMetadata);
895
894
  }
896
895
  },
@@ -1054,13 +1053,13 @@ export class SharedDirectory
1054
1053
  interface IKeyEditLocalOpMetadata {
1055
1054
  type: "edit";
1056
1055
  pendingMessageId: number;
1057
- previousValue: ILocalValue | undefined;
1056
+ previousValue: unknown;
1058
1057
  }
1059
1058
 
1060
1059
  interface IClearLocalOpMetadata {
1061
1060
  type: "clear";
1062
1061
  pendingMessageId: number;
1063
- previousStorage: Map<string, ILocalValue>;
1062
+ previousStorage: Map<string, unknown>;
1064
1063
  }
1065
1064
 
1066
1065
  interface ICreateSubDirLocalOpMetadata {
@@ -1143,7 +1142,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1143
1142
  /**
1144
1143
  * The in-memory data the directory is storing.
1145
1144
  */
1146
- private readonly _storage = new Map<string, ILocalValue>();
1145
+ private readonly _storage = new Map<string, unknown>();
1147
1146
 
1148
1147
  /**
1149
1148
  * The subdirectories the directory is holding.
@@ -1260,7 +1259,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1260
1259
  */
1261
1260
  public get<T = unknown>(key: string): T | undefined {
1262
1261
  this.throwIfDisposed();
1263
- return this._storage.get(key)?.value as T | undefined;
1262
+ return this._storage.get(key) as T | undefined;
1264
1263
  }
1265
1264
 
1266
1265
  /**
@@ -1274,11 +1273,10 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1274
1273
  }
1275
1274
 
1276
1275
  // Create a local value and serialize it.
1277
- const localValue: ILocalValue = { value };
1278
- bindHandles(localValue, this.serializer, this.directory.handle);
1276
+ bindHandles(value, this.serializer, this.directory.handle);
1279
1277
 
1280
1278
  // Set the value locally.
1281
- const previousValue = this.setCore(key, localValue, true);
1279
+ const previousValue = this.setCore(key, value, true);
1282
1280
 
1283
1281
  // If we are not attached, don't submit the op.
1284
1282
  if (!this.directory.isAttached()) {
@@ -1289,7 +1287,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1289
1287
  key,
1290
1288
  path: this.absolutePath,
1291
1289
  type: "set",
1292
- value: { type: ValueType[ValueType.Plain], value: localValue.value },
1290
+ value: { type: ValueType[ValueType.Plain], value },
1293
1291
  };
1294
1292
  this.submitKeyMessage(op, previousValue);
1295
1293
  return this;
@@ -1513,7 +1511,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1513
1511
  return;
1514
1512
  }
1515
1513
 
1516
- const copy = new Map<string, ILocalValue>(this._storage);
1514
+ const copy = new Map<string, unknown>(this._storage);
1517
1515
  this.clearCore(true);
1518
1516
  const op: IDirectoryClearOperation = {
1519
1517
  path: this.absolutePath,
@@ -1531,8 +1529,8 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1531
1529
  ): void {
1532
1530
  this.throwIfDisposed();
1533
1531
  // eslint-disable-next-line unicorn/no-array-for-each
1534
- this._storage.forEach((localValue, key, map) => {
1535
- callback(localValue.value, key, map);
1532
+ this._storage.forEach((value, key) => {
1533
+ callback(value, key, this);
1536
1534
  });
1537
1535
  }
1538
1536
 
@@ -1550,19 +1548,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1550
1548
  */
1551
1549
  public entries(): IterableIterator<[string, unknown]> {
1552
1550
  this.throwIfDisposed();
1553
- const localEntriesIterator = this._storage.entries();
1554
- const iterator = {
1555
- next(): IteratorResult<[string, unknown]> {
1556
- const nextVal = localEntriesIterator.next();
1557
- return nextVal.done
1558
- ? { value: undefined, done: true }
1559
- : { value: [nextVal.value[0], nextVal.value[1].value], done: false };
1560
- },
1561
- [Symbol.iterator](): IterableIterator<[string, unknown]> {
1562
- return this;
1563
- },
1564
- };
1565
- return iterator;
1551
+ return this._storage.entries();
1566
1552
  }
1567
1553
 
1568
1554
  /**
@@ -1580,19 +1566,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1580
1566
  */
1581
1567
  public values(): IterableIterator<unknown> {
1582
1568
  this.throwIfDisposed();
1583
- const localValuesIterator = this._storage.values();
1584
- const iterator = {
1585
- next(): IteratorResult<unknown> {
1586
- const nextVal = localValuesIterator.next();
1587
- return nextVal.done
1588
- ? { value: undefined, done: true }
1589
- : { value: nextVal.value.value, done: false };
1590
- },
1591
- [Symbol.iterator](): IterableIterator<unknown> {
1592
- return this;
1593
- },
1594
- };
1595
- return iterator;
1569
+ return this._storage.values();
1596
1570
  }
1597
1571
 
1598
1572
  /**
@@ -1674,7 +1648,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1674
1648
  public processSetMessage(
1675
1649
  msg: ISequencedDocumentMessage,
1676
1650
  op: IDirectorySetOperation,
1677
- localValue: ILocalValue | undefined,
1651
+ value: unknown,
1678
1652
  local: boolean,
1679
1653
  localOpMetadata: unknown,
1680
1654
  ): void {
@@ -1690,8 +1664,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1690
1664
 
1691
1665
  // needProcessStorageOperation should have returned false if local is true
1692
1666
  // so we can assume localValue is not undefined
1693
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1694
- this.setCore(op.key, localValue!, local);
1667
+ this.setCore(op.key, value, local);
1695
1668
  }
1696
1669
 
1697
1670
  /**
@@ -1758,7 +1731,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1758
1731
  */
1759
1732
  private submitClearMessage(
1760
1733
  op: IDirectoryClearOperation,
1761
- previousValue: Map<string, ILocalValue>,
1734
+ previousValue: Map<string, unknown>,
1762
1735
  ): void {
1763
1736
  this.throwIfDisposed();
1764
1737
  const pendingMsgId = ++this.pendingMessageId;
@@ -1809,7 +1782,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1809
1782
  * @param op - The operation
1810
1783
  * @param previousValue - The value of the key before this op
1811
1784
  */
1812
- private submitKeyMessage(op: IDirectoryKeyOperation, previousValue?: ILocalValue): void {
1785
+ private submitKeyMessage(op: IDirectoryKeyOperation, previousValue?: unknown): void {
1813
1786
  this.throwIfDisposed();
1814
1787
  const pendingMessageId = this.getKeyMessageId(op);
1815
1788
  const localMetadata = { type: "edit", pendingMessageId, previousValue };
@@ -1948,12 +1921,8 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1948
1921
  serializer: IFluidSerializer,
1949
1922
  ): Generator<[string, ISerializedValue], void> {
1950
1923
  this.throwIfDisposed();
1951
- for (const [key, localValue] of this._storage) {
1952
- const serializedValue = serializeValue(
1953
- localValue.value,
1954
- serializer,
1955
- this.directory.handle,
1956
- );
1924
+ for (const [key, value] of this._storage) {
1925
+ const serializedValue = serializeValue(value, serializer, this.directory.handle);
1957
1926
  const res: [string, ISerializedValue] = [key, serializedValue];
1958
1927
  yield res;
1959
1928
  }
@@ -1975,7 +1944,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1975
1944
  */
1976
1945
  public populateStorage(key: string, value: unknown): void {
1977
1946
  this.throwIfDisposed();
1978
- this._storage.set(key, { value });
1947
+ this._storage.set(key, value);
1979
1948
  }
1980
1949
 
1981
1950
  /**
@@ -1995,7 +1964,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1995
1964
  * @param key - The key to retrieve from
1996
1965
  * @returns The local value
1997
1966
  */
1998
- public getLocalValue<T extends ILocalValue = ILocalValue>(key: string): T {
1967
+ public getLocalValue<T>(key: string): T {
1999
1968
  this.throwIfDisposed();
2000
1969
  return this._storage.get(key) as T;
2001
1970
  }
@@ -2341,7 +2310,7 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
2341
2310
  private clearExceptPendingKeys(local: boolean): void {
2342
2311
  // Assuming the pendingKeys is small and the map is large
2343
2312
  // we will get the value for the pendingKeys and clear the map
2344
- const temp = new Map<string, ILocalValue>();
2313
+ const temp = new Map<string, unknown>();
2345
2314
 
2346
2315
  for (const [key] of this.pendingKeys) {
2347
2316
  const value = this._storage.get(key);
@@ -2373,9 +2342,9 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
2373
2342
  * @param local - Whether the message originated from the local client
2374
2343
  * @returns Previous local value of the key if it existed, undefined if it did not exist
2375
2344
  */
2376
- private deleteCore(key: string, local: boolean): ILocalValue | undefined {
2345
+ private deleteCore(key: string, local: boolean): unknown {
2377
2346
  const previousLocalValue = this._storage.get(key);
2378
- const previousValue: unknown = previousLocalValue?.value;
2347
+ const previousValue: unknown = previousLocalValue;
2379
2348
  const successfullyRemoved = this._storage.delete(key);
2380
2349
  if (successfullyRemoved) {
2381
2350
  const event: IDirectoryValueChanged = { key, path: this.absolutePath, previousValue };
@@ -2393,9 +2362,9 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
2393
2362
  * @param local - Whether the message originated from the local client
2394
2363
  * @returns Previous local value of the key, if any
2395
2364
  */
2396
- private setCore(key: string, value: ILocalValue, local: boolean): ILocalValue | undefined {
2365
+ private setCore(key: string, value: unknown, local: boolean): unknown {
2397
2366
  const previousLocalValue = this._storage.get(key);
2398
- const previousValue: unknown = previousLocalValue?.value;
2367
+ const previousValue: unknown = previousLocalValue;
2399
2368
  this._storage.set(key, value);
2400
2369
  const event: IDirectoryValueChanged = { key, path: this.absolutePath, previousValue };
2401
2370
  this.directory.emit("valueChanged", event, local, this.directory);
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/map";
9
- export const pkgVersion = "2.50.0";
9
+ export const pkgVersion = "2.51.0";