@rljson/fs-agent 0.0.40 → 0.0.42
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/fs-agent.d.ts +10 -0
- package/dist/fs-agent.js +18 -3
- package/package.json +19 -9
package/dist/fs-agent.d.ts
CHANGED
|
@@ -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;
|
|
@@ -1344,9 +1354,7 @@ ${err.stack}` : String(err);
|
|
|
1344
1354
|
*/
|
|
1345
1355
|
async _sendRef(connector, ref, predecessorRefs) {
|
|
1346
1356
|
connector.invalidateSent?.(ref);
|
|
1347
|
-
|
|
1348
|
-
connector.setPredecessors(predecessorRefs ?? []);
|
|
1349
|
-
}
|
|
1357
|
+
connector.setPredecessors(predecessorRefs ?? []);
|
|
1350
1358
|
await FsAgent._withRetry(
|
|
1351
1359
|
async () => {
|
|
1352
1360
|
if (connector.syncConfig?.requireAck) {
|
|
@@ -1932,8 +1940,14 @@ ${err.stack}` : String(err);
|
|
|
1932
1940
|
);
|
|
1933
1941
|
}
|
|
1934
1942
|
let debounceTimer = null;
|
|
1943
|
+
this._flushDeferredRescan = () => {
|
|
1944
|
+
if (!this._rescanDeferred) return;
|
|
1945
|
+
this._rescanDeferred = false;
|
|
1946
|
+
debouncedSync({ type: "safety-rescan" });
|
|
1947
|
+
};
|
|
1935
1948
|
const debouncedSync = (change) => {
|
|
1936
1949
|
if (change?.type === "safety-rescan" && this._remoteApplyInFlight) {
|
|
1950
|
+
this._rescanDeferred = true;
|
|
1937
1951
|
return;
|
|
1938
1952
|
}
|
|
1939
1953
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
@@ -2459,6 +2473,7 @@ ${err.stack}` : String(err);
|
|
|
2459
2473
|
} finally {
|
|
2460
2474
|
this._remoteApplyInFlight = false;
|
|
2461
2475
|
this._scanner.resumeWatch();
|
|
2476
|
+
this._flushDeferredRescan?.();
|
|
2462
2477
|
}
|
|
2463
2478
|
await new Promise(
|
|
2464
2479
|
(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.
|
|
3
|
+
"version": "0.0.42",
|
|
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
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
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
|
+
}
|