@ai4b-team/fsaos-gateway-sdk 4.2.2 → 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/index.js CHANGED
@@ -1339,6 +1339,9 @@ function resubscribeAll(isReconnect = false) {
1339
1339
  sendPathSubscribe(sub.path, sub.event_types);
1340
1340
  }
1341
1341
  if (!isReconnect) return;
1342
+ catchUpAfterGap("reconnect");
1343
+ }
1344
+ function catchUpAfterGap(reason) {
1342
1345
  try {
1343
1346
  const qc = getQueryClient();
1344
1347
  refreshInfiniteItemsAfterReconnect(qc);
@@ -1347,9 +1350,9 @@ function resubscribeAll(isReconnect = false) {
1347
1350
  void qc.invalidateQueries({ queryKey: vfsKeys.item(sub.path) });
1348
1351
  void qc.invalidateQueries({ queryKey: vfsKeys.children(sub.path) });
1349
1352
  }
1350
- log("resubscribeAll: invalidated", activePaths.size, "paths after reconnect");
1353
+ log("catchUpAfterGap:", reason, "- invalidated", activePaths.size, "paths");
1351
1354
  } catch (err) {
1352
- log("resubscribeAll: cache invalidation skipped", err);
1355
+ log("catchUpAfterGap: cache invalidation skipped", err);
1353
1356
  }
1354
1357
  }
1355
1358
  function sendMessage(msg) {
@@ -1372,6 +1375,10 @@ function handleMessage(raw) {
1372
1375
  console.warn("[WS] Server error:", msg.message);
1373
1376
  return;
1374
1377
  }
1378
+ if (msg.type === "resync") {
1379
+ catchUpAfterGap(typeof msg.reason === "string" ? msg.reason : "resync");
1380
+ return;
1381
+ }
1375
1382
  if (msg.type === "event" || msg.event_type) {
1376
1383
  const eventType = msg.event_type || "message";
1377
1384
  const data = msg.data || msg;