@rljson/fs-agent 0.0.46 → 0.0.47

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.
@@ -276,6 +276,16 @@ export declare class FsAgent {
276
276
  /** Files written vs left alone by the current {@link restore}. */
277
277
  private _restoreWritten;
278
278
  private _restoreSkipped;
279
+ /**
280
+ * Files this restore DELETED.
281
+ *
282
+ * Counted and reported because a prune is the only half of a restore that
283
+ * can destroy anything, and until now it was the only half that happened
284
+ * silently: `restore: wrote 0, left 901 already-correct` is what a node
285
+ * printed while removing 77 files. The number that mattered was the one not
286
+ * on the line.
287
+ */
288
+ private _restorePruned;
279
289
  /** Paths the current {@link restore} could not write because they were held open. */
280
290
  private _restoreLocked;
281
291
  /**
package/dist/fs-agent.js CHANGED
@@ -1152,6 +1152,16 @@ class FsAgent {
1152
1152
  /** Files written vs left alone by the current {@link restore}. */
1153
1153
  _restoreWritten = 0;
1154
1154
  _restoreSkipped = 0;
1155
+ /**
1156
+ * Files this restore DELETED.
1157
+ *
1158
+ * Counted and reported because a prune is the only half of a restore that
1159
+ * can destroy anything, and until now it was the only half that happened
1160
+ * silently: `restore: wrote 0, left 901 already-correct` is what a node
1161
+ * printed while removing 77 files. The number that mattered was the one not
1162
+ * on the line.
1163
+ */
1164
+ _restorePruned = 0;
1155
1165
  /** Paths the current {@link restore} could not write because they were held open. */
1156
1166
  _restoreLocked = [];
1157
1167
  /**
@@ -1481,6 +1491,7 @@ ${err.stack}` : String(err);
1481
1491
  const preRestore = options?.cleanTarget ? await this._collectAllFiles(target) : /* @__PURE__ */ new Set();
1482
1492
  this._restoreWritten = 0;
1483
1493
  this._restoreSkipped = 0;
1494
+ this._restorePruned = 0;
1484
1495
  this._restoreLocked = [];
1485
1496
  await this._restoreTree(
1486
1497
  tree.rootHash,
@@ -1488,9 +1499,9 @@ ${err.stack}` : String(err);
1488
1499
  target,
1489
1500
  target === this._rootPath
1490
1501
  );
1491
- if (this._restoreSkipped > 0) {
1502
+ if (this._restoreSkipped > 0 || this._restorePruned > 0) {
1492
1503
  console.log(
1493
- `[FsAgent] restore: wrote ${this._restoreWritten}, left ${this._restoreSkipped} already-correct file${this._restoreSkipped === 1 ? "" : "s"} untouched`
1504
+ `[FsAgent] restore: wrote ${this._restoreWritten}, left ${this._restoreSkipped} already-correct file${this._restoreSkipped === 1 ? "" : "s"} untouched` + (this._restorePruned > 0 ? `, DELETED ${this._restorePruned}` : "")
1494
1505
  );
1495
1506
  }
1496
1507
  if (options?.cleanTarget) {
@@ -1929,6 +1940,7 @@ ${err.stack}` : String(err);
1929
1940
  }
1930
1941
  } else if (!expectedFiles.has(fullPath) && preRestore.has(fullPath)) {
1931
1942
  await rm(fullPath, { force: true });
1943
+ this._restorePruned++;
1932
1944
  }
1933
1945
  }
1934
1946
  }
@@ -2460,6 +2472,11 @@ ${err.stack}` : String(err);
2460
2472
  `[FsAgent] ref=${treeRef.slice(0, 8)}… declares no ancestry — applying additively, not pruning.`
2461
2473
  );
2462
2474
  }
2475
+ if (restoreOptions?.cleanTarget) {
2476
+ console.log(
2477
+ `[FsAgent] applying ref=${treeRef.slice(0, 8)}… newestFromSender=${isNewestFromSender} declaresAncestry=${declaresAncestry} mayPrune=${applyOptions === restoreOptions} incomingFiles=${this._getFileContentMap(incomingTree).size} currentFiles=${this._getFileContentMap(currentTree).size}`
2478
+ );
2479
+ }
2463
2480
  await FsAgent._withTimeout(
2464
2481
  this.restore(incomingTree, void 0, applyOptions),
2465
2482
  this._timeouts.restore,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rljson/fs-agent",
3
- "version": "0.0.46",
3
+ "version": "0.0.47",
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",