@ghostpaw/affinity 0.2.0 → 0.2.1

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/index.cjs CHANGED
@@ -3332,11 +3332,10 @@ function dedupeLiveLinks(db, now) {
3332
3332
  }
3333
3333
  return [...removed];
3334
3334
  }
3335
- function softDeleteSelfLoops(db, contactId, now) {
3335
+ function softDeleteSelfLoops(db, now) {
3336
3336
  const rows = db.prepare(
3337
- `SELECT id FROM links
3338
- WHERE removed_at IS NULL AND from_contact_id = to_contact_id AND from_contact_id = ?`
3339
- ).all(contactId);
3337
+ "SELECT id FROM links WHERE removed_at IS NULL AND from_contact_id = to_contact_id"
3338
+ ).all();
3340
3339
  const ids = [];
3341
3340
  for (const r of rows) {
3342
3341
  db.prepare(
@@ -3439,7 +3438,7 @@ function mergeContacts(db, input) {
3439
3438
  WHERE to_contact_id = ? AND removed_at IS NULL`
3440
3439
  ).run(winnerId, now, loserId);
3441
3440
  const affectedLinks = /* @__PURE__ */ new Set();
3442
- for (const id of softDeleteSelfLoops(db, winnerId, now)) {
3441
+ for (const id of softDeleteSelfLoops(db, now)) {
3443
3442
  affectedLinks.add(id);
3444
3443
  }
3445
3444
  for (const id of dedupeLiveLinks(db, now)) {
package/dist/index.js CHANGED
@@ -3330,11 +3330,10 @@ function dedupeLiveLinks(db, now) {
3330
3330
  }
3331
3331
  return [...removed];
3332
3332
  }
3333
- function softDeleteSelfLoops(db, contactId, now) {
3333
+ function softDeleteSelfLoops(db, now) {
3334
3334
  const rows = db.prepare(
3335
- `SELECT id FROM links
3336
- WHERE removed_at IS NULL AND from_contact_id = to_contact_id AND from_contact_id = ?`
3337
- ).all(contactId);
3335
+ "SELECT id FROM links WHERE removed_at IS NULL AND from_contact_id = to_contact_id"
3336
+ ).all();
3338
3337
  const ids = [];
3339
3338
  for (const r of rows) {
3340
3339
  db.prepare(
@@ -3437,7 +3436,7 @@ function mergeContacts(db, input) {
3437
3436
  WHERE to_contact_id = ? AND removed_at IS NULL`
3438
3437
  ).run(winnerId, now, loserId);
3439
3438
  const affectedLinks = /* @__PURE__ */ new Set();
3440
- for (const id of softDeleteSelfLoops(db, winnerId, now)) {
3439
+ for (const id of softDeleteSelfLoops(db, now)) {
3441
3440
  affectedLinks.add(id);
3442
3441
  }
3443
3442
  for (const id of dedupeLiveLinks(db, now)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghostpaw/affinity",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Relationship intelligence and social CRM model for Node.js — SQLite, zero dependencies, with a built-in LLM tool facade",
5
5
  "license": "MIT",
6
6
  "author": {