@fluidframework/map 2.0.0-internal.5.4.2 → 2.0.0-internal.6.0.1

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @fluidframework/map
2
2
 
3
+ ## 2.0.0-internal.6.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
8
+
9
+ 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.
10
+
3
11
  ## 2.0.0-internal.5.4.0
4
12
 
5
13
  Dependency updates only.
package/dist/directory.js CHANGED
@@ -774,9 +774,8 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
774
774
  * {@inheritDoc IDirectory.get}
775
775
  */
776
776
  get(key) {
777
- var _c;
778
777
  this.throwIfDisposed();
779
- return (_c = this._storage.get(key)) === null || _c === void 0 ? void 0 : _c.value;
778
+ return this._storage.get(key)?.value;
780
779
  }
781
780
  /**
782
781
  * {@inheritDoc IDirectory.set}
@@ -815,7 +814,6 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
815
814
  * {@inheritDoc IDirectory.createSubDirectory}
816
815
  */
817
816
  createSubDirectory(subdirName) {
818
- var _c;
819
817
  this.throwIfDisposed();
820
818
  // Undefined/null subdirectory names can't be serialized to JSON in the manner we currently snapshot.
821
819
  if (subdirName === undefined || subdirName === null) {
@@ -825,7 +823,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
825
823
  throw new Error(`SubDirectory name may not contain ${posix.sep}`);
826
824
  }
827
825
  // Create the sub directory locally first.
828
- const isNew = this.createSubDirectoryCore(subdirName, true, this.getLocalSeq(), (_c = this.runtime.clientId) !== null && _c !== void 0 ? _c : "detached");
826
+ const isNew = this.createSubDirectoryCore(subdirName, true, this.getLocalSeq(), this.runtime.clientId ?? "detached");
829
827
  const subDir = this._subdirectories.get(subdirName);
830
828
  (0, common_utils_1.assert)(subDir !== undefined, 0x5aa /* subdirectory should exist after creation */);
831
829
  // If we are not attached, don't submit the op.
@@ -1162,10 +1160,9 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1162
1160
  * @returns metadata generated for stahed op
1163
1161
  */
1164
1162
  applyStashedCreateSubDirMessage(op) {
1165
- var _c;
1166
1163
  this.throwIfDisposed();
1167
1164
  // Create the sub directory locally first.
1168
- this.createSubDirectoryCore(op.subdirName, true, this.getLocalSeq(), (_c = this.runtime.clientId) !== null && _c !== void 0 ? _c : "detached");
1165
+ this.createSubDirectoryCore(op.subdirName, true, this.getLocalSeq(), this.runtime.clientId ?? "detached");
1169
1166
  this.updatePendingSubDirMessageCount(op);
1170
1167
  const localOpMetadata = {
1171
1168
  type: "createSubDir",
@@ -1282,13 +1279,11 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1282
1279
  }
1283
1280
  }
1284
1281
  incrementPendingSubDirCount(map, subDirName) {
1285
- var _c;
1286
- const count = (_c = map.get(subDirName)) !== null && _c !== void 0 ? _c : 0;
1282
+ const count = map.get(subDirName) ?? 0;
1287
1283
  map.set(subDirName, count + 1);
1288
1284
  }
1289
1285
  decrementPendingSubDirCount(map, subDirName) {
1290
- var _c;
1291
- const count = (_c = map.get(subDirName)) !== null && _c !== void 0 ? _c : 0;
1286
+ const count = map.get(subDirName) ?? 0;
1292
1287
  map.set(subDirName, count - 1);
1293
1288
  if (count <= 1) {
1294
1289
  map.delete(subDirName);
@@ -1419,7 +1414,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1419
1414
  */
1420
1415
  rollbackPendingMessageId(map, key, pendingMessageId) {
1421
1416
  const pendingMessageIds = map.get(key);
1422
- const lastPendingMessageId = pendingMessageIds === null || pendingMessageIds === void 0 ? void 0 : pendingMessageIds.pop();
1417
+ const lastPendingMessageId = pendingMessageIds?.pop();
1423
1418
  if (!pendingMessageIds || lastPendingMessageId !== pendingMessageId) {
1424
1419
  throw new Error("Rollback op does not match last pending");
1425
1420
  }
@@ -1607,8 +1602,9 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1607
1602
  if (op.type === "createSubDirectory") {
1608
1603
  const dir = this._subdirectories.get(op.subdirName);
1609
1604
  // Child sub directory create seq number can't be lower than the parent subdirectory.
1610
- if (this.sequenceNumber !== -1 && this.sequenceNumber < msg.sequenceNumber) {
1611
- if ((dir === null || dir === void 0 ? void 0 : dir.sequenceNumber) === -1) {
1605
+ // The sequence number for multiple ops can be the same when multiple createSubDirectory occurs with grouped batching enabled, thus <= and not just <.
1606
+ if (this.sequenceNumber !== -1 && this.sequenceNumber <= msg.sequenceNumber) {
1607
+ if (dir?.sequenceNumber === -1) {
1612
1608
  // Only set the seq on the first message, could be more
1613
1609
  dir.sequenceNumber = msg.sequenceNumber;
1614
1610
  }
@@ -1659,7 +1655,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1659
1655
  */
1660
1656
  deleteCore(key, local) {
1661
1657
  const previousLocalValue = this._storage.get(key);
1662
- const previousValue = previousLocalValue === null || previousLocalValue === void 0 ? void 0 : previousLocalValue.value;
1658
+ const previousValue = previousLocalValue?.value;
1663
1659
  const successfullyRemoved = this._storage.delete(key);
1664
1660
  if (successfullyRemoved) {
1665
1661
  const event = { key, path: this.absolutePath, previousValue };
@@ -1678,7 +1674,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1678
1674
  */
1679
1675
  setCore(key, value, local) {
1680
1676
  const previousLocalValue = this._storage.get(key);
1681
- const previousValue = previousLocalValue === null || previousLocalValue === void 0 ? void 0 : previousLocalValue.value;
1677
+ const previousValue = previousLocalValue?.value;
1682
1678
  this._storage.set(key, value);
1683
1679
  const event = { key, path: this.absolutePath, previousValue };
1684
1680
  this.directory.emit("valueChanged", event, local, this.directory);