@rljson/fs-agent 0.0.40 → 0.0.41

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.
@@ -263,6 +263,16 @@ export declare class FsAgent {
263
263
  * view — and undo a deletion the peer just made.
264
264
  */
265
265
  private _remoteApplyInFlight;
266
+ /**
267
+ * Whether a safety rescan was suppressed while a remote apply was running.
268
+ *
269
+ * The rescan is what covers a watcher that drops or coalesces events, so a
270
+ * suppressed one has to be re-run rather than forgotten — see the deferral in
271
+ * `syncToDb`'s change handler.
272
+ */
273
+ private _rescanDeferred;
274
+ /** Re-runs a deferred rescan once the apply that blocked it has finished. */
275
+ private _flushDeferredRescan;
266
276
  /** Files written vs left alone by the current {@link restore}. */
267
277
  private _restoreWritten;
268
278
  private _restoreSkipped;
package/dist/fs-agent.js CHANGED
@@ -1090,6 +1090,16 @@ class FsAgent {
1090
1090
  * view — and undo a deletion the peer just made.
1091
1091
  */
1092
1092
  _remoteApplyInFlight = false;
1093
+ /**
1094
+ * Whether a safety rescan was suppressed while a remote apply was running.
1095
+ *
1096
+ * The rescan is what covers a watcher that drops or coalesces events, so a
1097
+ * suppressed one has to be re-run rather than forgotten — see the deferral in
1098
+ * `syncToDb`'s change handler.
1099
+ */
1100
+ _rescanDeferred = false;
1101
+ /** Re-runs a deferred rescan once the apply that blocked it has finished. */
1102
+ _flushDeferredRescan;
1093
1103
  /** Files written vs left alone by the current {@link restore}. */
1094
1104
  _restoreWritten = 0;
1095
1105
  _restoreSkipped = 0;
@@ -1932,8 +1942,14 @@ ${err.stack}` : String(err);
1932
1942
  );
1933
1943
  }
1934
1944
  let debounceTimer = null;
1945
+ this._flushDeferredRescan = () => {
1946
+ if (!this._rescanDeferred) return;
1947
+ this._rescanDeferred = false;
1948
+ debouncedSync({ type: "safety-rescan" });
1949
+ };
1935
1950
  const debouncedSync = (change) => {
1936
1951
  if (change?.type === "safety-rescan" && this._remoteApplyInFlight) {
1952
+ this._rescanDeferred = true;
1937
1953
  return;
1938
1954
  }
1939
1955
  if (debounceTimer) clearTimeout(debounceTimer);
@@ -2459,6 +2475,7 @@ ${err.stack}` : String(err);
2459
2475
  } finally {
2460
2476
  this._remoteApplyInFlight = false;
2461
2477
  this._scanner.resumeWatch();
2478
+ this._flushDeferredRescan?.();
2462
2479
  }
2463
2480
  await new Promise(
2464
2481
  (r) => setTimeout(r, attempt * this._timeouts.processRefRetryDelayMs)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rljson/fs-agent",
3
- "version": "0.0.40",
3
+ "version": "0.0.41",
4
4
  "description": "Rljson fs-agent description",
5
5
  "homepage": "https://github.com/rljson/fs-agent",
6
6
  "bugs": "https://github.com/rljson/fs-agent/issues",
@@ -19,6 +19,14 @@
19
19
  "dist"
20
20
  ],
21
21
  "type": "module",
22
+ "scripts": {
23
+ "build": "pnpm exec vite build && tsc && node scripts/copy-readme-to-dist.js",
24
+ "test": "cross-env NODE_OPTIONS=--max-old-space-size=8192 pnpm exec vitest run --coverage && pnpm run lint",
25
+ "prebuild": "npm run test",
26
+ "prepublishOnly": "npm run build",
27
+ "lint": "pnpm exec eslint .",
28
+ "updateGoldens": "cross-env UPDATE_GOLDENS=true pnpm test"
29
+ },
22
30
  "devDependencies": {
23
31
  "@rljson/server": "^0.0.43",
24
32
  "@types/node": "^25.3.1",
@@ -51,11 +59,13 @@
51
59
  "socket.io": "^4.8.3",
52
60
  "socket.io-client": "^4.8.3"
53
61
  },
54
- "scripts": {
55
- "build": "pnpm exec vite build && tsc && node scripts/copy-readme-to-dist.js",
56
- "test": "cross-env NODE_OPTIONS=--max-old-space-size=8192 pnpm exec vitest run --coverage && pnpm run lint",
57
- "prebuild": "npm run test",
58
- "lint": "pnpm exec eslint .",
59
- "updateGoldens": "cross-env UPDATE_GOLDENS=true pnpm test"
60
- }
61
- }
62
+ "pnpm": {
63
+ "onlyBuiltDependencies": [
64
+ "esbuild"
65
+ ],
66
+ "overrides": {
67
+ "@rljson/rljson": "^0.0.78"
68
+ }
69
+ },
70
+ "packageManager": "pnpm@10.11.0"
71
+ }