@rljson/fs-agent 0.0.44 → 0.0.46

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.
Files changed (2) hide show
  1. package/dist/fs-agent.js +12 -10
  2. package/package.json +1 -1
package/dist/fs-agent.js CHANGED
@@ -2102,8 +2102,7 @@ ${err.stack}` : String(err);
2102
2102
  const prevRefsOf = /* @__PURE__ */ new Map();
2103
2103
  for (const r of rows) {
2104
2104
  const prev = (r.previous ?? []).map((t) => refOfTimeId.get(t)).filter((x) => x !== void 0);
2105
- const existing = prevRefsOf.get(r[refKey]);
2106
- prevRefsOf.set(r[refKey], existing ? [...existing, ...prev] : prev);
2105
+ prevRefsOf.set(r[refKey], prev);
2107
2106
  }
2108
2107
  const ancestorsOf = (startRefs) => {
2109
2108
  const seen = /* @__PURE__ */ new Set();
@@ -2426,23 +2425,23 @@ ${err.stack}` : String(err);
2426
2425
  `[FsAgent] syncFromDb: equivalent content, skipping restore (incoming=${incomingFiles.size} entries, current=${currentFiles.size} entries, ref=${treeRef.slice(0, 8)}…)`
2427
2426
  );
2428
2427
  this._adoptAppliedRef(connector, treeRef);
2428
+ this._currentRef = treeRef;
2429
+ this._persistCurrentRef(treeRef);
2430
+ this._lastSentContentKey = this._contentKeyFromTree(currentTree);
2429
2431
  return;
2430
2432
  }
2431
- if (this._currentRef) {
2433
+ if (this._resolveConflicts && this._currentRef && predecessorRefs && predecessorRefs.length > 0) {
2432
2434
  const relation = await this._ancestryRelation(
2433
2435
  db,
2434
2436
  treeKey,
2435
2437
  this._currentRef,
2436
2438
  treeRef,
2437
- predecessorRefs ?? []
2439
+ predecessorRefs
2438
2440
  );
2439
2441
  if (relation === "ahead") {
2440
- console.warn(
2441
- `[FsAgent] ref=${treeRef.slice(0, 8)}… is an ancestor of the state this agent already holds — ignoring.`
2442
- );
2443
2442
  return;
2444
2443
  }
2445
- if (relation === "diverged" && this._resolveConflicts && predecessorRefs !== void 0 && predecessorRefs.length > 0) {
2444
+ if (relation === "diverged") {
2446
2445
  await this._resolveConflictInline(
2447
2446
  db,
2448
2447
  treeKey,
@@ -2478,10 +2477,13 @@ ${err.stack}` : String(err);
2478
2477
  previous
2479
2478
  });
2480
2479
  this._adoptAppliedRef(connector, treeRef);
2481
- this._lastSentRef = postRestoreRef;
2482
- this._lastSentContentKey = this._contentKeyFromTree(postRestoreTree);
2483
2480
  this._currentRef = postRestoreRef;
2484
2481
  this._persistCurrentRef(postRestoreRef);
2482
+ const postRestoreKey = this._contentKeyFromTree(postRestoreTree);
2483
+ if (postRestoreKey === this._contentKeyFromTree(incomingTree)) {
2484
+ this._lastSentRef = postRestoreRef;
2485
+ this._lastSentContentKey = postRestoreKey;
2486
+ }
2485
2487
  return;
2486
2488
  } catch (err) {
2487
2489
  if (err instanceof MassDeleteRefusedError) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rljson/fs-agent",
3
- "version": "0.0.44",
3
+ "version": "0.0.46",
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",