@fluidframework/map 2.0.0-internal.4.2.1 → 2.0.0-internal.4.3.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/dist/directory.js CHANGED
@@ -673,6 +673,9 @@ function isDirectoryLocalOpMetadata(metadata) {
673
673
  metadata.type === "createSubDir"));
674
674
  }
675
675
  /* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */
676
+ function assertNonNullClientId(clientId) {
677
+ (0, common_utils_1.assert)(clientId !== null, 0x6af /* client id should never be null */);
678
+ }
676
679
  /**
677
680
  * Node of the directory tree.
678
681
  * @sealed
@@ -1134,6 +1137,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1134
1137
  if (!this.needProcessSubDirectoryOperation(msg, op, local, localOpMetadata)) {
1135
1138
  return;
1136
1139
  }
1140
+ assertNonNullClientId(msg.clientId);
1137
1141
  this.createSubDirectoryCore(op.subdirName, local, msg.sequenceNumber, msg.clientId);
1138
1142
  }
1139
1143
  /**
@@ -1521,7 +1525,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1521
1525
  // If the message is either from the creator of directory or this directory was created when
1522
1526
  // container was detached or in case this directory is already live(known to other clients)
1523
1527
  // and the op was created after the directory was created then apply this op.
1524
- return (this.clientIds.has(msg.clientId) ||
1528
+ return ((msg.clientId !== null && this.clientIds.has(msg.clientId)) ||
1525
1529
  this.clientIds.has("detached") ||
1526
1530
  (this.sequenceNumber !== -1 && this.sequenceNumber <= msg.referenceSequenceNumber));
1527
1531
  }
@@ -1537,6 +1541,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1537
1541
  */
1538
1542
  needProcessSubDirectoryOperation(msg, op, local, localOpMetadata) {
1539
1543
  const pendingSubDirectoryMessageId = this.pendingSubDirectories.get(op.subdirName);
1544
+ assertNonNullClientId(msg.clientId);
1540
1545
  if (pendingSubDirectoryMessageId !== undefined) {
1541
1546
  if (local) {
1542
1547
  (0, common_utils_1.assert)(isSubDirLocalOpMetadata(localOpMetadata), 0x012 /* pendingMessageId is missing from the local client's operation */);