@ghostpaw/affinity 0.2.1 → 0.2.4

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
@@ -520,6 +520,7 @@ __export(read_exports, {
520
520
  getContactProfile: () => getContactProfile,
521
521
  getLinkDetail: () => getLinkDetail,
522
522
  getLinkTimeline: () => getLinkTimeline,
523
+ getLinksBetween: () => getLinksBetween,
523
524
  getMergeHistory: () => getMergeHistory,
524
525
  getOwnerProfile: () => getOwnerProfile,
525
526
  listContacts: () => listContacts,
@@ -2774,6 +2775,28 @@ function getLinkDetail(db, linkId, options) {
2774
2775
  };
2775
2776
  }
2776
2777
 
2778
+ // src/links/get_links_between.ts
2779
+ function getLinksBetween(db, contactId1, contactId2) {
2780
+ const rows = db.prepare(
2781
+ `SELECT id, from_contact_id, to_contact_id, kind, role, is_structural,
2782
+ rank, affinity, trust, state, cadence_days, bond,
2783
+ created_at, updated_at, removed_at
2784
+ FROM links
2785
+ WHERE removed_at IS NULL
2786
+ AND (
2787
+ (from_contact_id = ? AND to_contact_id = ?)
2788
+ OR (from_contact_id = ? AND to_contact_id = ?)
2789
+ )
2790
+ ORDER BY id ASC`
2791
+ ).all(
2792
+ contactId1,
2793
+ contactId2,
2794
+ contactId2,
2795
+ contactId1
2796
+ );
2797
+ return rows.map((r) => mapLinkRowToLinkListItem(r));
2798
+ }
2799
+
2777
2800
  // src/links/kinds.ts
2778
2801
  var RELATIONAL = /* @__PURE__ */ new Set([
2779
2802
  "personal",
@@ -8508,6 +8531,11 @@ var affinityToolMappings = [
8508
8531
  tool: inspectAffinityItemToolName,
8509
8532
  action: "link"
8510
8533
  },
8534
+ {
8535
+ source: "getLinksBetween",
8536
+ tool: inspectAffinityItemToolName,
8537
+ action: "links_between"
8538
+ },
8511
8539
  {
8512
8540
  source: "listContacts",
8513
8541
  tool: reviewAffinityToolName,
package/dist/index.d.cts CHANGED
@@ -878,6 +878,12 @@ declare function getAffinityChart(db: AffinityDb, options?: AffinityChartReadOpt
878
878
 
879
879
  declare function getLinkDetail(db: AffinityDb, linkId: number, options?: LinkDetailReadOptions): LinkDetailRecord | null;
880
880
 
881
+ /**
882
+ * Returns all live links (both relational and structural) between two contacts,
883
+ * in either direction.
884
+ */
885
+ declare function getLinksBetween(db: AffinityDb, contactId1: number, contactId2: number): LinkListItem[];
886
+
881
887
  declare function getLinkTimeline(db: AffinityDb, linkId: number, options?: ContactJournalReadOptions): EventRecord[];
882
888
 
883
889
  declare function listObservedLinks(db: AffinityDb, filters?: LinkListReadFilters, options?: AffinityListReadOptions): LinkListItem[];
@@ -933,6 +939,7 @@ declare const read_getContactJournal: typeof getContactJournal;
933
939
  declare const read_getContactProfile: typeof getContactProfile;
934
940
  declare const read_getLinkDetail: typeof getLinkDetail;
935
941
  declare const read_getLinkTimeline: typeof getLinkTimeline;
942
+ declare const read_getLinksBetween: typeof getLinksBetween;
936
943
  declare const read_getMergeHistory: typeof getMergeHistory;
937
944
  declare const read_getOwnerProfile: typeof getOwnerProfile;
938
945
  declare const read_listContacts: typeof listContacts;
@@ -947,7 +954,7 @@ declare const read_listRadar: typeof listRadar;
947
954
  declare const read_listUpcomingDates: typeof listUpcomingDates;
948
955
  declare const read_searchContacts: typeof searchContacts;
949
956
  declare namespace read {
950
- export { read_getAffinityChart as getAffinityChart, read_getContactJournal as getContactJournal, read_getContactProfile as getContactProfile, read_getLinkDetail as getLinkDetail, read_getLinkTimeline as getLinkTimeline, read_getMergeHistory as getMergeHistory, read_getOwnerProfile as getOwnerProfile, read_listContacts as listContacts, read_listDismissedDuplicates as listDismissedDuplicates, read_listDuplicateCandidates as listDuplicateCandidates, read_listMoments as listMoments, read_listObservedLinks as listObservedLinks, read_listOpenCommitments as listOpenCommitments, read_listOwnerSocialLinks as listOwnerSocialLinks, read_listProgressionReadiness as listProgressionReadiness, read_listRadar as listRadar, read_listUpcomingDates as listUpcomingDates, read_searchContacts as searchContacts };
957
+ export { read_getAffinityChart as getAffinityChart, read_getContactJournal as getContactJournal, read_getContactProfile as getContactProfile, read_getLinkDetail as getLinkDetail, read_getLinkTimeline as getLinkTimeline, read_getLinksBetween as getLinksBetween, read_getMergeHistory as getMergeHistory, read_getOwnerProfile as getOwnerProfile, read_listContacts as listContacts, read_listDismissedDuplicates as listDismissedDuplicates, read_listDuplicateCandidates as listDuplicateCandidates, read_listMoments as listMoments, read_listObservedLinks as listObservedLinks, read_listOpenCommitments as listOpenCommitments, read_listOwnerSocialLinks as listOwnerSocialLinks, read_listProgressionReadiness as listProgressionReadiness, read_listRadar as listRadar, read_listUpcomingDates as listUpcomingDates, read_searchContacts as searchContacts };
951
958
  }
952
959
 
953
960
  interface AffinitySoulTrait {
package/dist/index.d.ts CHANGED
@@ -878,6 +878,12 @@ declare function getAffinityChart(db: AffinityDb, options?: AffinityChartReadOpt
878
878
 
879
879
  declare function getLinkDetail(db: AffinityDb, linkId: number, options?: LinkDetailReadOptions): LinkDetailRecord | null;
880
880
 
881
+ /**
882
+ * Returns all live links (both relational and structural) between two contacts,
883
+ * in either direction.
884
+ */
885
+ declare function getLinksBetween(db: AffinityDb, contactId1: number, contactId2: number): LinkListItem[];
886
+
881
887
  declare function getLinkTimeline(db: AffinityDb, linkId: number, options?: ContactJournalReadOptions): EventRecord[];
882
888
 
883
889
  declare function listObservedLinks(db: AffinityDb, filters?: LinkListReadFilters, options?: AffinityListReadOptions): LinkListItem[];
@@ -933,6 +939,7 @@ declare const read_getContactJournal: typeof getContactJournal;
933
939
  declare const read_getContactProfile: typeof getContactProfile;
934
940
  declare const read_getLinkDetail: typeof getLinkDetail;
935
941
  declare const read_getLinkTimeline: typeof getLinkTimeline;
942
+ declare const read_getLinksBetween: typeof getLinksBetween;
936
943
  declare const read_getMergeHistory: typeof getMergeHistory;
937
944
  declare const read_getOwnerProfile: typeof getOwnerProfile;
938
945
  declare const read_listContacts: typeof listContacts;
@@ -947,7 +954,7 @@ declare const read_listRadar: typeof listRadar;
947
954
  declare const read_listUpcomingDates: typeof listUpcomingDates;
948
955
  declare const read_searchContacts: typeof searchContacts;
949
956
  declare namespace read {
950
- export { read_getAffinityChart as getAffinityChart, read_getContactJournal as getContactJournal, read_getContactProfile as getContactProfile, read_getLinkDetail as getLinkDetail, read_getLinkTimeline as getLinkTimeline, read_getMergeHistory as getMergeHistory, read_getOwnerProfile as getOwnerProfile, read_listContacts as listContacts, read_listDismissedDuplicates as listDismissedDuplicates, read_listDuplicateCandidates as listDuplicateCandidates, read_listMoments as listMoments, read_listObservedLinks as listObservedLinks, read_listOpenCommitments as listOpenCommitments, read_listOwnerSocialLinks as listOwnerSocialLinks, read_listProgressionReadiness as listProgressionReadiness, read_listRadar as listRadar, read_listUpcomingDates as listUpcomingDates, read_searchContacts as searchContacts };
957
+ export { read_getAffinityChart as getAffinityChart, read_getContactJournal as getContactJournal, read_getContactProfile as getContactProfile, read_getLinkDetail as getLinkDetail, read_getLinkTimeline as getLinkTimeline, read_getLinksBetween as getLinksBetween, read_getMergeHistory as getMergeHistory, read_getOwnerProfile as getOwnerProfile, read_listContacts as listContacts, read_listDismissedDuplicates as listDismissedDuplicates, read_listDuplicateCandidates as listDuplicateCandidates, read_listMoments as listMoments, read_listObservedLinks as listObservedLinks, read_listOpenCommitments as listOpenCommitments, read_listOwnerSocialLinks as listOwnerSocialLinks, read_listProgressionReadiness as listProgressionReadiness, read_listRadar as listRadar, read_listUpcomingDates as listUpcomingDates, read_searchContacts as searchContacts };
951
958
  }
952
959
 
953
960
  interface AffinitySoulTrait {
package/dist/index.js CHANGED
@@ -518,6 +518,7 @@ __export(read_exports, {
518
518
  getContactProfile: () => getContactProfile,
519
519
  getLinkDetail: () => getLinkDetail,
520
520
  getLinkTimeline: () => getLinkTimeline,
521
+ getLinksBetween: () => getLinksBetween,
521
522
  getMergeHistory: () => getMergeHistory,
522
523
  getOwnerProfile: () => getOwnerProfile,
523
524
  listContacts: () => listContacts,
@@ -2772,6 +2773,28 @@ function getLinkDetail(db, linkId, options) {
2772
2773
  };
2773
2774
  }
2774
2775
 
2776
+ // src/links/get_links_between.ts
2777
+ function getLinksBetween(db, contactId1, contactId2) {
2778
+ const rows = db.prepare(
2779
+ `SELECT id, from_contact_id, to_contact_id, kind, role, is_structural,
2780
+ rank, affinity, trust, state, cadence_days, bond,
2781
+ created_at, updated_at, removed_at
2782
+ FROM links
2783
+ WHERE removed_at IS NULL
2784
+ AND (
2785
+ (from_contact_id = ? AND to_contact_id = ?)
2786
+ OR (from_contact_id = ? AND to_contact_id = ?)
2787
+ )
2788
+ ORDER BY id ASC`
2789
+ ).all(
2790
+ contactId1,
2791
+ contactId2,
2792
+ contactId2,
2793
+ contactId1
2794
+ );
2795
+ return rows.map((r) => mapLinkRowToLinkListItem(r));
2796
+ }
2797
+
2775
2798
  // src/links/kinds.ts
2776
2799
  var RELATIONAL = /* @__PURE__ */ new Set([
2777
2800
  "personal",
@@ -8506,6 +8529,11 @@ var affinityToolMappings = [
8506
8529
  tool: inspectAffinityItemToolName,
8507
8530
  action: "link"
8508
8531
  },
8532
+ {
8533
+ source: "getLinksBetween",
8534
+ tool: inspectAffinityItemToolName,
8535
+ action: "links_between"
8536
+ },
8509
8537
  {
8510
8538
  source: "listContacts",
8511
8539
  tool: reviewAffinityToolName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghostpaw/affinity",
3
- "version": "0.2.1",
3
+ "version": "0.2.4",
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": {