@rljson/fs-agent 0.0.43 → 0.0.44

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 +8 -4
  2. package/package.json +1 -1
package/dist/fs-agent.js CHANGED
@@ -2102,7 +2102,8 @@ ${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
- prevRefsOf.set(r[refKey], prev);
2105
+ const existing = prevRefsOf.get(r[refKey]);
2106
+ prevRefsOf.set(r[refKey], existing ? [...existing, ...prev] : prev);
2106
2107
  }
2107
2108
  const ancestorsOf = (startRefs) => {
2108
2109
  const seen = /* @__PURE__ */ new Set();
@@ -2427,18 +2428,21 @@ ${err.stack}` : String(err);
2427
2428
  this._adoptAppliedRef(connector, treeRef);
2428
2429
  return;
2429
2430
  }
2430
- if (this._resolveConflicts && this._currentRef && predecessorRefs && predecessorRefs.length > 0) {
2431
+ if (this._currentRef) {
2431
2432
  const relation = await this._ancestryRelation(
2432
2433
  db,
2433
2434
  treeKey,
2434
2435
  this._currentRef,
2435
2436
  treeRef,
2436
- predecessorRefs
2437
+ predecessorRefs ?? []
2437
2438
  );
2438
2439
  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
+ );
2439
2443
  return;
2440
2444
  }
2441
- if (relation === "diverged") {
2445
+ if (relation === "diverged" && this._resolveConflicts && predecessorRefs !== void 0 && predecessorRefs.length > 0) {
2442
2446
  await this._resolveConflictInline(
2443
2447
  db,
2444
2448
  treeKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rljson/fs-agent",
3
- "version": "0.0.43",
3
+ "version": "0.0.44",
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",