@fluidframework/map 2.0.0-internal.4.3.1 → 2.0.0-internal.4.4.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,9 @@
1
1
  # @fluidframework/map
2
2
 
3
+ ## 2.0.0-internal.4.4.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.0.0-internal.4.1.0
4
8
 
5
9
  Dependency updates only.
@@ -1 +1 @@
1
- {"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAa,MAAM,oCAAoC,CAAC;AAG/F,OAAO,EACN,UAAU,EAGV,kBAAkB,EAElB,gBAAgB,EAChB,sBAAsB,EAEtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAe,eAAe,EAAoB,MAAM,eAAe,CAAC;AAsC/E;;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;IACH,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;;G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CAAC,EAAE,EAAE,mBAAmB,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAItF;;;OAGG;IACH,SAAS,CAAC,YAAY,IAAI,IAAI;IAE9B;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAOxE;;;OAGG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBxE;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI;IA6CpD;;;OAGG;IACH,SAAS,CAAC,WAAW,CACpB,OAAO,EAAE,yBAAyB,EAClC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,OAAO,GACtB,IAAI;IASP;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAQpE;;;OAGG;IACH,OAAO,CAAC,YAAY;IAIpB;;;;;;;;;OASG;IACH,OAAO,CAAC,SAAS;IAajB;;;;OAIG;IACH,OAAO,CAAC,2BAA2B;IAsBnC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAsJ1B;;;OAGG;IACH,SAAS,CAAC,cAAc,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO;IAQ9C,OAAO,CAAC,kBAAkB;CAiE1B"}
package/dist/directory.js CHANGED
@@ -372,7 +372,11 @@ class SharedDirectory extends shared_object_base_1.SharedObject {
372
372
  let newSubDir = currentSubDir.getSubDirectory(subdirName);
373
373
  if (!newSubDir) {
374
374
  const createInfo = subdirObject.ci;
375
- newSubDir = new SubDirectory(createInfo !== undefined ? createInfo.csn : 0, createInfo !== undefined
375
+ newSubDir = new SubDirectory(
376
+ // If csn is -1, then initialize it with 0, otherwise we will never process ops for this
377
+ // sub directory. This could be done at serialization time too, but we need to maintain
378
+ // back compat too and also we will actually know the state when it was serialized.
379
+ createInfo !== undefined && createInfo.csn > -1 ? createInfo.csn : 0, createInfo !== undefined
376
380
  ? new Set(createInfo.ccIds)
377
381
  : new Set(), this, this.runtime, this.serializer, posix.join(currentSubDir.absolutePath, subdirName));
378
382
  currentSubDir.populateSubDirectory(subdirName, newSubDir);
@@ -661,16 +665,12 @@ function isClearLocalOpMetadata(metadata) {
661
665
  }
662
666
  function isSubDirLocalOpMetadata(metadata) {
663
667
  return (metadata !== undefined &&
664
- typeof metadata.pendingMessageId === "number" &&
665
668
  (metadata.type === "createSubDir" || metadata.type === "deleteSubDir"));
666
669
  }
667
670
  function isDirectoryLocalOpMetadata(metadata) {
668
- return (metadata !== undefined &&
669
- typeof metadata.pendingMessageId === "number" &&
670
- (metadata.type === "edit" ||
671
- metadata.type === "deleteSubDir" ||
672
- (metadata.type === "clear" && typeof metadata.previousStorage === "object") ||
673
- metadata.type === "createSubDir"));
671
+ return (isKeyEditLocalOpMetadata(metadata) ||
672
+ isClearLocalOpMetadata(metadata) ||
673
+ isSubDirLocalOpMetadata(metadata));
674
674
  }
675
675
  /* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */
676
676
  function assertNonNullClientId(clientId) {
@@ -715,18 +715,24 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
715
715
  */
716
716
  this._subdirectories = new Map();
717
717
  /**
718
- * Keys that have been modified locally but not yet ack'd from the server.
718
+ * Keys that have been modified locally but not yet ack'd from the server. This is for operations on keys like
719
+ * set/delete operations on keys. The value of this map is list of pendingMessageIds at which that key
720
+ * was modified. We don't store the type of ops, and behaviour of key ops are different from behaviour of sub
721
+ * directory ops, so we have separate map from subDirectories tracker.
719
722
  */
720
723
  this.pendingKeys = new Map();
721
724
  /**
722
- * Subdirectories that have been created/deleted locally but not yet ack'd from the server.
725
+ * Subdirectories that have been deleted locally but not yet ack'd from the server. This maintains the record
726
+ * of delete op that are pending or yet to be acked from server. This is maintained just to track the locally
727
+ * deleted sub directory.
723
728
  */
724
- this.pendingSubDirectories = new Map();
729
+ this.pendingDeleteSubDirectoriesTracker = new Map();
725
730
  /**
726
- * Subdirectories that have been deleted locally but not yet ack'd from the server. This maintains the count
727
- * of delete op that are pending or yet to be acked from server.
731
+ * Subdirectories that have been created locally but not yet ack'd from the server. This maintains the record
732
+ * of create op that are pending or yet to be acked from server. This is maintained just to track the locally
733
+ * created sub directory.
728
734
  */
729
- this.pendingDeleteSubDirectoriesCount = new Map();
735
+ this.pendingCreateSubDirectoriesTracker = new Map();
730
736
  /**
731
737
  * This is used to assign a unique id to every outgoing operation and helps in tracking unack'd ops.
732
738
  */
@@ -893,8 +899,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
893
899
  * @returns - true if there is pending delete.
894
900
  */
895
901
  isSubDirectoryDeletePending(subDirName) {
896
- const pendingDeleteSubDirectory = this.pendingDeleteSubDirectoriesCount.get(subDirName);
897
- if (pendingDeleteSubDirectory !== undefined && pendingDeleteSubDirectory > 0) {
902
+ if (this.pendingDeleteSubDirectoriesTracker.has(subDirName)) {
898
903
  return true;
899
904
  }
900
905
  return false;
@@ -1134,7 +1139,8 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1134
1139
  */
1135
1140
  processCreateSubDirectoryMessage(msg, op, local, localOpMetadata) {
1136
1141
  this.throwIfDisposed();
1137
- if (!this.needProcessSubDirectoryOperation(msg, op, local, localOpMetadata)) {
1142
+ if (!(this.isMessageForCurrentInstanceOfSubDirectory(msg) &&
1143
+ this.needProcessSubDirectoryOperation(msg, op, local, localOpMetadata))) {
1138
1144
  return;
1139
1145
  }
1140
1146
  assertNonNullClientId(msg.clientId);
@@ -1150,10 +1156,9 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1150
1156
  this.throwIfDisposed();
1151
1157
  // Create the sub directory locally first.
1152
1158
  this.createSubDirectoryCore(op.subdirName, true, -1, (_c = this.runtime.clientId) !== null && _c !== void 0 ? _c : "detached");
1153
- const newMessageId = this.getSubDirMessageId(op);
1159
+ this.updatePendingSubDirMessageCount(op);
1154
1160
  const localOpMetadata = {
1155
1161
  type: "createSubDir",
1156
- pendingMessageId: newMessageId,
1157
1162
  };
1158
1163
  return localOpMetadata;
1159
1164
  }
@@ -1182,10 +1187,9 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1182
1187
  applyStashedDeleteSubDirMessage(op) {
1183
1188
  this.throwIfDisposed();
1184
1189
  const subDir = this.deleteSubDirectoryCore(op.subdirName, true);
1185
- const newMessageId = this.getSubDirMessageId(op);
1190
+ this.updatePendingSubDirMessageCount(op);
1186
1191
  const metadata = {
1187
1192
  type: "deleteSubDir",
1188
- pendingMessageId: newMessageId,
1189
1193
  subDirectory: subDir,
1190
1194
  };
1191
1195
  return metadata;
@@ -1214,8 +1218,11 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1214
1218
  (0, common_utils_1.assert)(isClearLocalOpMetadata(localOpMetadata), 0x32b /* Invalid localOpMetadata for clear */);
1215
1219
  // We don't reuse the metadata pendingMessageId but send a new one on each submit.
1216
1220
  const pendingClearMessageId = this.pendingClearMessageIds.shift();
1217
- (0, common_utils_1.assert)(pendingClearMessageId === localOpMetadata.pendingMessageId, 0x32c /* pendingMessageId does not match */);
1218
- this.submitClearMessage(op, localOpMetadata.previousStorage);
1221
+ // Only submit the op, if we have record for it, otherwise it is possible that the older instance
1222
+ // is already deleted, in which case we don't need to submit the op.
1223
+ if (pendingClearMessageId === localOpMetadata.pendingMessageId) {
1224
+ this.submitClearMessage(op, localOpMetadata.previousStorage);
1225
+ }
1219
1226
  }
1220
1227
  /**
1221
1228
  * Get a new pending message id for the op and cache it to track the pending op
@@ -1253,33 +1260,41 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1253
1260
  (0, common_utils_1.assert)(isKeyEditLocalOpMetadata(localOpMetadata), 0x32d /* Invalid localOpMetadata in submit */);
1254
1261
  // clear the old pending message id
1255
1262
  const pendingMessageIds = this.pendingKeys.get(op.key);
1256
- (0, common_utils_1.assert)(pendingMessageIds !== undefined &&
1257
- pendingMessageIds[0] === localOpMetadata.pendingMessageId, 0x32e /* Unexpected pending message received */);
1258
- pendingMessageIds.shift();
1259
- if (pendingMessageIds.length === 0) {
1260
- this.pendingKeys.delete(op.key);
1263
+ // Only submit the op, if we have record for it, otherwise it is possible that the older instance
1264
+ // is already deleted, in which case we don't need to submit the op.
1265
+ if (pendingMessageIds !== undefined &&
1266
+ pendingMessageIds[0] === localOpMetadata.pendingMessageId) {
1267
+ pendingMessageIds.shift();
1268
+ if (pendingMessageIds.length === 0) {
1269
+ this.pendingKeys.delete(op.key);
1270
+ }
1271
+ this.submitKeyMessage(op, localOpMetadata.previousValue);
1261
1272
  }
1262
- this.submitKeyMessage(op, localOpMetadata.previousValue);
1263
1273
  }
1264
- /**
1265
- * Get a new pending message id for the op and cache it to track the pending op
1266
- */
1267
- getSubDirMessageId(op) {
1274
+ incrementPendingSubDirCount(map, subDirName) {
1268
1275
  var _c;
1269
- // We don't reuse the metadata pendingMessageId but send a new one on each submit.
1270
- const newMessageId = ++this.pendingMessageId;
1271
- const pendingMessageIds = this.pendingSubDirectories.get(op.subdirName);
1272
- if (pendingMessageIds !== undefined) {
1273
- pendingMessageIds.push(newMessageId);
1274
- }
1275
- else {
1276
- this.pendingSubDirectories.set(op.subdirName, [newMessageId]);
1276
+ const count = (_c = map.get(subDirName)) !== null && _c !== void 0 ? _c : 0;
1277
+ map.set(subDirName, count + 1);
1278
+ }
1279
+ decrementPendingSubDirCount(map, subDirName) {
1280
+ var _c;
1281
+ const count = (_c = map.get(subDirName)) !== null && _c !== void 0 ? _c : 0;
1282
+ map.set(subDirName, count - 1);
1283
+ if (count <= 1) {
1284
+ map.delete(subDirName);
1277
1285
  }
1286
+ }
1287
+ /**
1288
+ * Update the count for pending create/delete of the sub directory so that it can be validated on receiving op
1289
+ * or while resubmitting the op.
1290
+ */
1291
+ updatePendingSubDirMessageCount(op) {
1278
1292
  if (op.type === "deleteSubDirectory") {
1279
- const count = (_c = this.pendingDeleteSubDirectoriesCount.get(op.subdirName)) !== null && _c !== void 0 ? _c : 0;
1280
- this.pendingDeleteSubDirectoriesCount.set(op.subdirName, count + 1);
1293
+ this.incrementPendingSubDirCount(this.pendingDeleteSubDirectoriesTracker, op.subdirName);
1294
+ }
1295
+ else if (op.type === "createSubDirectory") {
1296
+ this.incrementPendingSubDirCount(this.pendingCreateSubDirectoriesTracker, op.subdirName);
1281
1297
  }
1282
- return newMessageId;
1283
1298
  }
1284
1299
  /**
1285
1300
  * Submit a create subdirectory operation.
@@ -1287,10 +1302,9 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1287
1302
  */
1288
1303
  submitCreateSubDirectoryMessage(op) {
1289
1304
  this.throwIfDisposed();
1290
- const newMessageId = this.getSubDirMessageId(op);
1305
+ this.updatePendingSubDirMessageCount(op);
1291
1306
  const localOpMetadata = {
1292
1307
  type: "createSubDir",
1293
- pendingMessageId: newMessageId,
1294
1308
  };
1295
1309
  this.directory.submitDirectoryMessage(op, localOpMetadata);
1296
1310
  }
@@ -1301,10 +1315,9 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1301
1315
  */
1302
1316
  submitDeleteSubDirectoryMessage(op, subDir) {
1303
1317
  this.throwIfDisposed();
1304
- const newMessageId = this.getSubDirMessageId(op);
1318
+ this.updatePendingSubDirMessageCount(op);
1305
1319
  const localOpMetadata = {
1306
1320
  type: "deleteSubDir",
1307
- pendingMessageId: newMessageId,
1308
1321
  subDirectory: subDir,
1309
1322
  };
1310
1323
  this.directory.submitDirectoryMessage(op, localOpMetadata);
@@ -1317,18 +1330,22 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1317
1330
  */
1318
1331
  resubmitSubDirectoryMessage(op, localOpMetadata) {
1319
1332
  (0, common_utils_1.assert)(isSubDirLocalOpMetadata(localOpMetadata), 0x32f /* Invalid localOpMetadata for sub directory op */);
1320
- // clear the old pending message id
1321
- const pendingMessageIds = this.pendingSubDirectories.get(op.subdirName);
1322
- (0, common_utils_1.assert)(pendingMessageIds !== undefined &&
1323
- pendingMessageIds[0] === localOpMetadata.pendingMessageId, 0x330 /* Unexpected pending message received */);
1324
- pendingMessageIds.shift();
1325
- if (pendingMessageIds.length === 0) {
1326
- this.pendingSubDirectories.delete(op.subdirName);
1333
+ // Only submit the op, if we have record for it, otherwise it is possible that the older instance
1334
+ // is already deleted, in which case we don't need to submit the op.
1335
+ if (localOpMetadata.type === "createSubDir" &&
1336
+ !this.pendingCreateSubDirectoriesTracker.has(op.subdirName)) {
1337
+ return;
1338
+ }
1339
+ else if (localOpMetadata.type === "deleteSubDir" &&
1340
+ !this.pendingDeleteSubDirectoriesTracker.has(op.subdirName)) {
1341
+ return;
1327
1342
  }
1328
1343
  if (localOpMetadata.type === "createSubDir") {
1344
+ this.decrementPendingSubDirCount(this.pendingCreateSubDirectoriesTracker, op.subdirName);
1329
1345
  this.submitCreateSubDirectoryMessage(op);
1330
1346
  }
1331
1347
  else {
1348
+ this.decrementPendingSubDirCount(this.pendingDeleteSubDirectoriesTracker, op.subdirName);
1332
1349
  this.submitDeleteSubDirectoryMessage(op, localOpMetadata.subDirectory);
1333
1350
  }
1334
1351
  }
@@ -1432,7 +1449,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1432
1449
  }
1433
1450
  else if (op.type === "createSubDirectory" && localOpMetadata.type === "createSubDir") {
1434
1451
  this.deleteSubDirectoryCore(op.subdirName, true);
1435
- this.rollbackPendingMessageId(this.pendingSubDirectories, op.subdirName, localOpMetadata.pendingMessageId);
1452
+ this.decrementPendingSubDirCount(this.pendingCreateSubDirectoriesTracker, op.subdirName);
1436
1453
  }
1437
1454
  else if (op.type === "deleteSubDirectory" && localOpMetadata.type === "deleteSubDir") {
1438
1455
  if (localOpMetadata.subDirectory !== undefined) {
@@ -1441,13 +1458,7 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1441
1458
  this._subdirectories.set(op.subdirName, localOpMetadata.subDirectory);
1442
1459
  this.emit("subDirectoryCreated", op.subdirName, true, this);
1443
1460
  }
1444
- this.rollbackPendingMessageId(this.pendingSubDirectories, op.subdirName, localOpMetadata.pendingMessageId);
1445
- const count = this.pendingDeleteSubDirectoriesCount.get(op.subdirName);
1446
- (0, common_utils_1.assert)(count !== undefined && count > 0, 0x5ab /* should have record for delete op */);
1447
- this.pendingDeleteSubDirectoriesCount.set(op.subdirName, count - 1);
1448
- if (count === 1) {
1449
- this.pendingDeleteSubDirectoriesCount.delete(op.subdirName);
1450
- }
1461
+ this.decrementPendingSubDirCount(this.pendingDeleteSubDirectoriesTracker, op.subDirName);
1451
1462
  }
1452
1463
  else {
1453
1464
  throw new Error("Unsupported op for rollback");
@@ -1540,51 +1551,63 @@ class SubDirectory extends common_utils_1.TypedEventEmitter {
1540
1551
  * @returns True if the operation should be processed, false otherwise
1541
1552
  */
1542
1553
  needProcessSubDirectoryOperation(msg, op, local, localOpMetadata) {
1543
- const pendingSubDirectoryMessageId = this.pendingSubDirectories.get(op.subdirName);
1544
1554
  assertNonNullClientId(msg.clientId);
1545
- if (pendingSubDirectoryMessageId !== undefined) {
1555
+ const pendingDeleteCount = this.pendingDeleteSubDirectoriesTracker.get(op.subdirName);
1556
+ const pendingCreateCount = this.pendingCreateSubDirectoriesTracker.get(op.subdirName);
1557
+ if ((pendingDeleteCount !== undefined && pendingDeleteCount > 0) ||
1558
+ (pendingCreateCount !== undefined && pendingCreateCount > 0)) {
1546
1559
  if (local) {
1547
1560
  (0, common_utils_1.assert)(isSubDirLocalOpMetadata(localOpMetadata), 0x012 /* pendingMessageId is missing from the local client's operation */);
1548
- const pendingMessageIds = this.pendingSubDirectories.get(op.subdirName);
1549
- (0, common_utils_1.assert)(pendingMessageIds !== undefined &&
1550
- pendingMessageIds[0] === localOpMetadata.pendingMessageId, 0x332 /* Unexpected pending message received */);
1551
- pendingMessageIds.shift();
1552
- if (pendingMessageIds.length === 0) {
1553
- this.pendingSubDirectories.delete(op.subdirName);
1561
+ if (localOpMetadata.type === "deleteSubDir") {
1562
+ (0, common_utils_1.assert)(pendingDeleteCount !== undefined && pendingDeleteCount > 0, 0x6c2 /* pendingDeleteCount should exist */);
1563
+ this.decrementPendingSubDirCount(this.pendingDeleteSubDirectoriesTracker, op.subdirName);
1554
1564
  }
1555
- if (op.type === "deleteSubDirectory") {
1556
- const count = this.pendingDeleteSubDirectoriesCount.get(op.subdirName);
1557
- (0, common_utils_1.assert)(count !== undefined && count > 0, 0x5ac /* should have record for delete op */);
1558
- this.pendingDeleteSubDirectoriesCount.set(op.subdirName, count - 1);
1559
- if (count === 1) {
1560
- this.pendingDeleteSubDirectoriesCount.delete(op.subdirName);
1561
- }
1565
+ else if (localOpMetadata.type === "createSubDir") {
1566
+ (0, common_utils_1.assert)(pendingCreateCount !== undefined && pendingCreateCount > 0, 0x6c3 /* pendingCreateCount should exist */);
1567
+ this.decrementPendingSubDirCount(this.pendingCreateSubDirectoriesTracker, op.subdirName);
1562
1568
  }
1563
1569
  }
1564
- else if (op.type === "deleteSubDirectory") {
1565
- // If this is remote delete op and we have keys in this subDirectory, then we need to delete these
1566
- // keys except the pending ones as they will be sequenced after this delete.
1567
- const subDirectory = this._subdirectories.get(op.subdirName);
1568
- if (subDirectory) {
1569
- subDirectory.clearExceptPendingKeys(local);
1570
- // In case of remote delete op, we need to reset the creation seq number and client ids of
1570
+ if (op.type === "deleteSubDirectory") {
1571
+ const resetSubDirectoryTree = (directory) => {
1572
+ if (!directory) {
1573
+ return;
1574
+ }
1575
+ // If this is delete op and we have keys in this subDirectory, then we need to delete these
1576
+ // keys except the pending ones as they will be sequenced after this delete.
1577
+ directory.clearExceptPendingKeys(local);
1578
+ // In case of delete op, we need to reset the creation seq number and client ids of
1571
1579
  // creators as the previous directory is getting deleted and we will initialize again when
1572
1580
  // we will receive op for the create again.
1573
- subDirectory.sequenceNumber = -1;
1574
- subDirectory.clientIds.clear();
1575
- }
1581
+ directory.sequenceNumber = -1;
1582
+ directory.clientIds.clear();
1583
+ // Do the same thing for the subtree of the directory. If create is not pending for a child, then just
1584
+ // delete it.
1585
+ const subDirectories = directory.subdirectories();
1586
+ for (const [subDirName, subDir] of subDirectories) {
1587
+ if (directory.pendingCreateSubDirectoriesTracker.has(subDirName)) {
1588
+ resetSubDirectoryTree(subDir);
1589
+ continue;
1590
+ }
1591
+ directory.deleteSubDirectoryCore(subDirName, false);
1592
+ }
1593
+ };
1594
+ const subDirectory = this._subdirectories.get(op.subdirName);
1595
+ resetSubDirectoryTree(subDirectory);
1576
1596
  }
1577
1597
  if (op.type === "createSubDirectory") {
1578
1598
  const dir = this._subdirectories.get(op.subdirName);
1579
- if ((dir === null || dir === void 0 ? void 0 : dir.sequenceNumber) === -1) {
1580
- // Only set the seq on the first message, could be more
1581
- dir.sequenceNumber = msg.sequenceNumber;
1582
- }
1583
- // The client created the dir at or after the dirs seq, so list its client id as a creator.
1584
- if (dir !== undefined &&
1585
- !dir.clientIds.has(msg.clientId) &&
1586
- dir.sequenceNumber <= msg.sequenceNumber) {
1587
- dir.clientIds.add(msg.clientId);
1599
+ // Child sub directory create seq number can't be lower than the parent subdirectory.
1600
+ if (this.sequenceNumber !== -1 && this.sequenceNumber < msg.sequenceNumber) {
1601
+ if ((dir === null || dir === void 0 ? void 0 : dir.sequenceNumber) === -1) {
1602
+ // Only set the seq on the first message, could be more
1603
+ dir.sequenceNumber = msg.sequenceNumber;
1604
+ }
1605
+ // The client created the dir at or after the dirs seq, so list its client id as a creator.
1606
+ if (dir !== undefined &&
1607
+ !dir.clientIds.has(msg.clientId) &&
1608
+ dir.sequenceNumber <= msg.sequenceNumber) {
1609
+ dir.clientIds.add(msg.clientId);
1610
+ }
1588
1611
  }
1589
1612
  }
1590
1613
  return false;