@hasna/contacts 0.6.28 → 0.6.30
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/cli/commands/crm.d.ts.map +1 -1
- package/dist/cli/index.js +2315 -323
- package/dist/index.js +255 -216
- package/dist/mcp/index.js +255 -216
- package/dist/server/index.js +2268 -319
- package/dist/server/pg-store.d.ts +801 -0
- package/dist/server/pg-store.d.ts.map +1 -1
- package/dist/server/v1.d.ts.map +1 -1
- package/dist/store/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/mcp/index.js
CHANGED
|
@@ -5409,6 +5409,30 @@ class ApiStore {
|
|
|
5409
5409
|
constructor(client) {
|
|
5410
5410
|
this.client = client;
|
|
5411
5411
|
}
|
|
5412
|
+
g(path, query) {
|
|
5413
|
+
return this.client.transport.get(path, query ? { query } : undefined);
|
|
5414
|
+
}
|
|
5415
|
+
post(path, body) {
|
|
5416
|
+
return this.client.transport.post(path, body);
|
|
5417
|
+
}
|
|
5418
|
+
patch(path, body) {
|
|
5419
|
+
return this.client.transport.patch(path, body);
|
|
5420
|
+
}
|
|
5421
|
+
del(path, query) {
|
|
5422
|
+
return this.client.transport.del(path, undefined, query ? { query } : undefined);
|
|
5423
|
+
}
|
|
5424
|
+
async gMaybe(path) {
|
|
5425
|
+
try {
|
|
5426
|
+
return await this.client.transport.get(path);
|
|
5427
|
+
} catch (e) {
|
|
5428
|
+
if (e && typeof e === "object" && e.status === 404)
|
|
5429
|
+
return null;
|
|
5430
|
+
throw e;
|
|
5431
|
+
}
|
|
5432
|
+
}
|
|
5433
|
+
enc(id) {
|
|
5434
|
+
return encodeURIComponent(String(id));
|
|
5435
|
+
}
|
|
5412
5436
|
async createContact(input) {
|
|
5413
5437
|
const res = await this.client.create("contacts", stripUndefined(input));
|
|
5414
5438
|
return pick(res, "contact") ?? res;
|
|
@@ -5539,74 +5563,74 @@ class ApiStore {
|
|
|
5539
5563
|
async removeTagFromCompany() {
|
|
5540
5564
|
return unavailable("removeTagFromCompany");
|
|
5541
5565
|
}
|
|
5542
|
-
async createGroup() {
|
|
5543
|
-
return
|
|
5566
|
+
async createGroup(input) {
|
|
5567
|
+
return pick(await this.post("/groups", input), "group");
|
|
5544
5568
|
}
|
|
5545
|
-
async getGroup() {
|
|
5546
|
-
return
|
|
5569
|
+
async getGroup(id) {
|
|
5570
|
+
return pick(await this.gMaybe(`/groups/${this.enc(id)}`), "group") ?? null;
|
|
5547
5571
|
}
|
|
5548
|
-
async listGroups() {
|
|
5549
|
-
return
|
|
5572
|
+
async listGroups(projectId) {
|
|
5573
|
+
return pick(await this.g("/groups", projectId ? { project_id: projectId } : undefined), "groups") ?? [];
|
|
5550
5574
|
}
|
|
5551
|
-
async updateGroup() {
|
|
5552
|
-
return
|
|
5575
|
+
async updateGroup(id, input) {
|
|
5576
|
+
return pick(await this.patch(`/groups/${this.enc(id)}`, input), "group");
|
|
5553
5577
|
}
|
|
5554
|
-
async deleteGroup() {
|
|
5555
|
-
|
|
5578
|
+
async deleteGroup(id) {
|
|
5579
|
+
await this.del(`/groups/${this.enc(id)}`);
|
|
5556
5580
|
}
|
|
5557
|
-
async addContactToGroup() {
|
|
5558
|
-
return
|
|
5581
|
+
async addContactToGroup(contactId, groupId) {
|
|
5582
|
+
return this.post(`/groups/${this.enc(groupId)}/contacts`, { contact_id: contactId });
|
|
5559
5583
|
}
|
|
5560
|
-
async removeContactFromGroup() {
|
|
5561
|
-
|
|
5584
|
+
async removeContactFromGroup(contactId, groupId) {
|
|
5585
|
+
await this.del(`/groups/${this.enc(groupId)}/contacts/${this.enc(contactId)}`);
|
|
5562
5586
|
}
|
|
5563
|
-
async listContactsInGroup() {
|
|
5564
|
-
return
|
|
5587
|
+
async listContactsInGroup(groupId) {
|
|
5588
|
+
return pick(await this.g(`/groups/${this.enc(groupId)}/contacts`), "contact_ids") ?? [];
|
|
5565
5589
|
}
|
|
5566
|
-
async listGroupsForContact() {
|
|
5567
|
-
return
|
|
5590
|
+
async listGroupsForContact(contactId) {
|
|
5591
|
+
return pick(await this.g(`/groups/for-contact/${this.enc(contactId)}`), "groups") ?? [];
|
|
5568
5592
|
}
|
|
5569
|
-
async addCompanyToGroup() {
|
|
5570
|
-
return
|
|
5593
|
+
async addCompanyToGroup(companyId, groupId) {
|
|
5594
|
+
return this.post(`/groups/${this.enc(groupId)}/companies`, { company_id: companyId });
|
|
5571
5595
|
}
|
|
5572
|
-
async removeCompanyFromGroup() {
|
|
5573
|
-
|
|
5596
|
+
async removeCompanyFromGroup(companyId, groupId) {
|
|
5597
|
+
await this.del(`/groups/${this.enc(groupId)}/companies/${this.enc(companyId)}`);
|
|
5574
5598
|
}
|
|
5575
|
-
async listCompaniesInGroup() {
|
|
5576
|
-
return
|
|
5599
|
+
async listCompaniesInGroup(groupId) {
|
|
5600
|
+
return pick(await this.g(`/groups/${this.enc(groupId)}/companies`), "company_ids") ?? [];
|
|
5577
5601
|
}
|
|
5578
|
-
async listGroupsForCompany() {
|
|
5579
|
-
return
|
|
5602
|
+
async listGroupsForCompany(companyId) {
|
|
5603
|
+
return pick(await this.g(`/groups/for-company/${this.enc(companyId)}`), "groups") ?? [];
|
|
5580
5604
|
}
|
|
5581
|
-
async createRelationship() {
|
|
5582
|
-
return
|
|
5605
|
+
async createRelationship(input) {
|
|
5606
|
+
return pick(await this.post("/relationships", input), "relationship");
|
|
5583
5607
|
}
|
|
5584
|
-
async listRelationships() {
|
|
5585
|
-
return
|
|
5608
|
+
async listRelationships(opts = {}) {
|
|
5609
|
+
return pick(await this.g("/relationships", stripUndefined(opts)), "relationships") ?? [];
|
|
5586
5610
|
}
|
|
5587
|
-
async deleteRelationship() {
|
|
5588
|
-
|
|
5611
|
+
async deleteRelationship(id) {
|
|
5612
|
+
await this.del(`/relationships/${this.enc(id)}`);
|
|
5589
5613
|
}
|
|
5590
|
-
async createCompanyRelationship() {
|
|
5591
|
-
return
|
|
5614
|
+
async createCompanyRelationship(input) {
|
|
5615
|
+
return pick(await this.post("/company-relationships", input), "relationship");
|
|
5592
5616
|
}
|
|
5593
|
-
async listCompanyRelationships() {
|
|
5594
|
-
return
|
|
5617
|
+
async listCompanyRelationships(opts = {}) {
|
|
5618
|
+
return pick(await this.g("/company-relationships", stripUndefined(opts)), "relationships") ?? [];
|
|
5595
5619
|
}
|
|
5596
|
-
async deleteCompanyRelationship() {
|
|
5597
|
-
|
|
5620
|
+
async deleteCompanyRelationship(id) {
|
|
5621
|
+
await this.del(`/company-relationships/${this.enc(id)}`);
|
|
5598
5622
|
}
|
|
5599
|
-
async addNote() {
|
|
5600
|
-
return
|
|
5623
|
+
async addNote(contactId, body, createdBy, companyId) {
|
|
5624
|
+
return pick(await this.post("/notes", { contact_id: contactId, body, created_by: createdBy, company_id: companyId }), "note");
|
|
5601
5625
|
}
|
|
5602
|
-
async listNotes() {
|
|
5603
|
-
return
|
|
5626
|
+
async listNotes(contactId) {
|
|
5627
|
+
return pick(await this.g("/notes", { contact_id: contactId }), "notes") ?? [];
|
|
5604
5628
|
}
|
|
5605
|
-
async listNotesForContactAtCompany() {
|
|
5606
|
-
return
|
|
5629
|
+
async listNotesForContactAtCompany(contactId, companyId) {
|
|
5630
|
+
return pick(await this.g("/notes", { contact_id: contactId, company_id: companyId }), "notes") ?? [];
|
|
5607
5631
|
}
|
|
5608
|
-
async deleteNote() {
|
|
5609
|
-
|
|
5632
|
+
async deleteNote(noteId) {
|
|
5633
|
+
await this.del(`/notes/${this.enc(noteId)}`);
|
|
5610
5634
|
}
|
|
5611
5635
|
async listActivity() {
|
|
5612
5636
|
return unavailable("listActivity");
|
|
@@ -5621,178 +5645,191 @@ class ApiStore {
|
|
|
5621
5645
|
};
|
|
5622
5646
|
}
|
|
5623
5647
|
async findEmailDuplicates() {
|
|
5624
|
-
return
|
|
5648
|
+
return pick(await this.g("/email-duplicates"), "duplicates") ?? [];
|
|
5625
5649
|
}
|
|
5626
5650
|
async findNameDuplicates() {
|
|
5627
|
-
return
|
|
5651
|
+
return pick(await this.g("/name-duplicates"), "duplicates") ?? [];
|
|
5628
5652
|
}
|
|
5629
|
-
async flushForBackup() {
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
async listColdContacts() {
|
|
5633
|
-
return unavailable("listColdContacts");
|
|
5653
|
+
async flushForBackup() {}
|
|
5654
|
+
async listColdContacts(days) {
|
|
5655
|
+
return pick(await this.g("/cold-contacts", { days }), "contacts") ?? [];
|
|
5634
5656
|
}
|
|
5635
|
-
async findOrCreateContact() {
|
|
5636
|
-
|
|
5657
|
+
async findOrCreateContact(input) {
|
|
5658
|
+
const emails = (input.emails ?? []).map((e) => e.address).filter(Boolean);
|
|
5659
|
+
for (const addr of emails) {
|
|
5660
|
+
const c = await this.getContactByEmail(addr);
|
|
5661
|
+
if (c)
|
|
5662
|
+
return { contact: c, created: false };
|
|
5663
|
+
}
|
|
5664
|
+
const nameQuery = input.display_name ?? (input.first_name || input.last_name ? `${input.first_name ?? ""} ${input.last_name ?? ""}`.trim() : null);
|
|
5665
|
+
if (nameQuery) {
|
|
5666
|
+
const results = await this.searchContacts(nameQuery);
|
|
5667
|
+
if (results[0])
|
|
5668
|
+
return { contact: results[0], created: false };
|
|
5669
|
+
}
|
|
5670
|
+
return { contact: await this.createContact(input), created: true };
|
|
5637
5671
|
}
|
|
5638
|
-
async findContactsForContext() {
|
|
5639
|
-
return
|
|
5672
|
+
async findContactsForContext(topic, limit) {
|
|
5673
|
+
return pick(await this.g("/contacts-for-context", { topic, limit }), "contacts") ?? [];
|
|
5640
5674
|
}
|
|
5641
|
-
async listContactsNotContactedSince() {
|
|
5642
|
-
return
|
|
5675
|
+
async listContactsNotContactedSince(days, limit) {
|
|
5676
|
+
return pick(await this.g("/not-contacted", { days, limit }), "contacts") ?? [];
|
|
5643
5677
|
}
|
|
5644
|
-
async listFollowupDueContacts() {
|
|
5645
|
-
return
|
|
5678
|
+
async listFollowupDueContacts(onOrBefore) {
|
|
5679
|
+
return pick(await this.g("/followup-due-contacts", { on_or_before: onOrBefore }), "contacts") ?? [];
|
|
5646
5680
|
}
|
|
5647
|
-
async logVendorCommunication() {
|
|
5648
|
-
return
|
|
5681
|
+
async logVendorCommunication(input) {
|
|
5682
|
+
return pick(await this.post("/vendor-comms", input), "communication");
|
|
5649
5683
|
}
|
|
5650
|
-
async listVendorCommunications() {
|
|
5651
|
-
return
|
|
5684
|
+
async listVendorCommunications(companyId, opts = {}) {
|
|
5685
|
+
return pick(await this.g("/vendor-comms", { company_id: companyId, ...stripUndefined(opts) }), "communications") ?? [];
|
|
5652
5686
|
}
|
|
5653
5687
|
async listMissingInvoices() {
|
|
5654
|
-
return
|
|
5688
|
+
return pick(await this.g("/vendor-comms/missing-invoices"), "communications") ?? [];
|
|
5655
5689
|
}
|
|
5656
5690
|
async listPendingFollowUps() {
|
|
5657
|
-
return
|
|
5691
|
+
return pick(await this.g("/vendor-comms/pending-follow-ups"), "communications") ?? [];
|
|
5658
5692
|
}
|
|
5659
|
-
async markFollowUpDone() {
|
|
5660
|
-
return
|
|
5693
|
+
async markFollowUpDone(id) {
|
|
5694
|
+
return pick(await this.post(`/vendor-comms/${this.enc(id)}/mark-done`), "communication");
|
|
5661
5695
|
}
|
|
5662
|
-
async createContactTask() {
|
|
5663
|
-
return
|
|
5696
|
+
async createContactTask(input) {
|
|
5697
|
+
return pick(await this.post("/tasks", input), "task");
|
|
5664
5698
|
}
|
|
5665
|
-
async listContactTasks() {
|
|
5666
|
-
return
|
|
5699
|
+
async listContactTasks(opts = {}) {
|
|
5700
|
+
return pick(await this.g("/tasks", stripUndefined(opts)), "tasks") ?? [];
|
|
5667
5701
|
}
|
|
5668
|
-
async updateContactTask() {
|
|
5669
|
-
return
|
|
5702
|
+
async updateContactTask(id, input) {
|
|
5703
|
+
return pick(await this.patch(`/tasks/${this.enc(id)}`, input), "task");
|
|
5670
5704
|
}
|
|
5671
|
-
async deleteContactTask() {
|
|
5672
|
-
|
|
5705
|
+
async deleteContactTask(id) {
|
|
5706
|
+
await this.del(`/tasks/${this.enc(id)}`);
|
|
5673
5707
|
}
|
|
5674
5708
|
async listOverdueTasks() {
|
|
5675
|
-
return
|
|
5709
|
+
return pick(await this.g("/tasks/overdue"), "tasks") ?? [];
|
|
5676
5710
|
}
|
|
5677
5711
|
async checkEscalations() {
|
|
5678
|
-
return
|
|
5712
|
+
return pick(await this.g("/tasks/escalations"), "escalations") ?? [];
|
|
5679
5713
|
}
|
|
5680
|
-
async createApplication() {
|
|
5681
|
-
return
|
|
5714
|
+
async createApplication(input) {
|
|
5715
|
+
return pick(await this.post("/applications", input), "application");
|
|
5682
5716
|
}
|
|
5683
|
-
async listApplications() {
|
|
5684
|
-
return
|
|
5717
|
+
async listApplications(opts = {}) {
|
|
5718
|
+
return pick(await this.g("/applications", stripUndefined(opts)), "applications") ?? [];
|
|
5685
5719
|
}
|
|
5686
|
-
async updateApplication() {
|
|
5687
|
-
return
|
|
5720
|
+
async updateApplication(id, input) {
|
|
5721
|
+
return pick(await this.patch(`/applications/${this.enc(id)}`, input), "application");
|
|
5688
5722
|
}
|
|
5689
5723
|
async listFollowUpDueApplications() {
|
|
5690
|
-
return
|
|
5724
|
+
return pick(await this.g("/applications/follow-up-due"), "applications") ?? [];
|
|
5691
5725
|
}
|
|
5692
|
-
async addOrgMember() {
|
|
5693
|
-
return
|
|
5726
|
+
async addOrgMember(input) {
|
|
5727
|
+
return pick(await this.post("/org-members", input), "org_member");
|
|
5694
5728
|
}
|
|
5695
|
-
async listOrgMembers() {
|
|
5696
|
-
return
|
|
5729
|
+
async listOrgMembers(companyId) {
|
|
5730
|
+
return pick(await this.g("/org-members", { company_id: companyId }), "org_members") ?? [];
|
|
5697
5731
|
}
|
|
5698
|
-
async updateOrgMember() {
|
|
5699
|
-
return
|
|
5732
|
+
async updateOrgMember(id, input) {
|
|
5733
|
+
return pick(await this.patch(`/org-members/${this.enc(id)}`, input), "org_member");
|
|
5700
5734
|
}
|
|
5701
|
-
async removeOrgMember() {
|
|
5702
|
-
|
|
5735
|
+
async removeOrgMember(id) {
|
|
5736
|
+
await this.del(`/org-members/${this.enc(id)}`);
|
|
5703
5737
|
}
|
|
5704
|
-
async listOrgMembersForContact() {
|
|
5705
|
-
return
|
|
5738
|
+
async listOrgMembersForContact(contactId) {
|
|
5739
|
+
return pick(await this.g("/org-members", { contact_id: contactId }), "org_members") ?? [];
|
|
5706
5740
|
}
|
|
5707
|
-
async createDeal() {
|
|
5708
|
-
return
|
|
5741
|
+
async createDeal(input) {
|
|
5742
|
+
return pick(await this.post("/deals", input), "deal");
|
|
5709
5743
|
}
|
|
5710
|
-
async getDeal() {
|
|
5711
|
-
return
|
|
5744
|
+
async getDeal(id) {
|
|
5745
|
+
return pick(await this.gMaybe(`/deals/${this.enc(id)}`), "deal") ?? null;
|
|
5712
5746
|
}
|
|
5713
|
-
async listDeals() {
|
|
5714
|
-
return
|
|
5747
|
+
async listDeals(opts = {}) {
|
|
5748
|
+
return pick(await this.g("/deals", stripUndefined(opts)), "deals") ?? [];
|
|
5715
5749
|
}
|
|
5716
|
-
async updateDeal() {
|
|
5717
|
-
return
|
|
5750
|
+
async updateDeal(id, input) {
|
|
5751
|
+
return pick(await this.patch(`/deals/${this.enc(id)}`, input), "deal") ?? null;
|
|
5718
5752
|
}
|
|
5719
|
-
async deleteDeal() {
|
|
5720
|
-
|
|
5753
|
+
async deleteDeal(id) {
|
|
5754
|
+
await this.del(`/deals/${this.enc(id)}`);
|
|
5721
5755
|
}
|
|
5722
|
-
async logEvent() {
|
|
5723
|
-
return
|
|
5756
|
+
async logEvent(input) {
|
|
5757
|
+
return pick(await this.post("/events", input), "event");
|
|
5724
5758
|
}
|
|
5725
|
-
async listEvents() {
|
|
5726
|
-
return
|
|
5759
|
+
async listEvents(opts = {}) {
|
|
5760
|
+
return pick(await this.g("/events", stripUndefined(opts)), "events") ?? [];
|
|
5727
5761
|
}
|
|
5728
|
-
async deleteEvent() {
|
|
5729
|
-
|
|
5762
|
+
async deleteEvent(id) {
|
|
5763
|
+
await this.del(`/events/${this.enc(id)}`);
|
|
5730
5764
|
}
|
|
5731
|
-
async getFieldHistory() {
|
|
5732
|
-
return
|
|
5765
|
+
async getFieldHistory(contactId, fieldName) {
|
|
5766
|
+
return pick(await this.g(`/contacts/${this.enc(contactId)}/field-history`, fieldName ? { field_name: fieldName } : undefined), "history") ?? [];
|
|
5733
5767
|
}
|
|
5734
|
-
async getContactAt() {
|
|
5735
|
-
return
|
|
5768
|
+
async getContactAt(contactId, timestamp) {
|
|
5769
|
+
return pick(await this.g(`/contacts/${this.enc(contactId)}/field-at`, { timestamp }), "fields") ?? {};
|
|
5736
5770
|
}
|
|
5737
|
-
async addJobEntry() {
|
|
5738
|
-
return
|
|
5771
|
+
async addJobEntry(contactId, input) {
|
|
5772
|
+
return pick(await this.post(`/contacts/${this.enc(contactId)}/job-history`, input), "job");
|
|
5739
5773
|
}
|
|
5740
|
-
async getJobHistory() {
|
|
5741
|
-
return
|
|
5774
|
+
async getJobHistory(contactId) {
|
|
5775
|
+
return pick(await this.g(`/contacts/${this.enc(contactId)}/job-history`), "job_history") ?? [];
|
|
5742
5776
|
}
|
|
5743
|
-
async saveLearning() {
|
|
5744
|
-
return
|
|
5777
|
+
async saveLearning(contactId, input) {
|
|
5778
|
+
return pick(await this.post(`/contacts/${this.enc(contactId)}/learnings`, input), "learning");
|
|
5745
5779
|
}
|
|
5746
|
-
async getLearnings() {
|
|
5747
|
-
return
|
|
5780
|
+
async getLearnings(contactId, opts = {}) {
|
|
5781
|
+
return pick(await this.g(`/contacts/${this.enc(contactId)}/learnings`, stripUndefined(opts)), "learnings") ?? [];
|
|
5748
5782
|
}
|
|
5749
|
-
async searchLearnings() {
|
|
5750
|
-
return
|
|
5783
|
+
async searchLearnings(query, opts = {}) {
|
|
5784
|
+
return pick(await this.g("/learnings/search", { q: query, ...stripUndefined(opts) }), "learnings") ?? [];
|
|
5751
5785
|
}
|
|
5752
|
-
async confirmLearning() {
|
|
5753
|
-
|
|
5786
|
+
async confirmLearning(learningId) {
|
|
5787
|
+
await this.post(`/learnings/${this.enc(learningId)}/confirm`);
|
|
5754
5788
|
}
|
|
5755
|
-
async getStaleLearnings() {
|
|
5756
|
-
return
|
|
5789
|
+
async getStaleLearnings(daysOld, minConfidence) {
|
|
5790
|
+
return pick(await this.g("/learnings/stale", { days_old: daysOld, min_confidence: minConfidence }), "learnings") ?? [];
|
|
5757
5791
|
}
|
|
5758
5792
|
async runLearningMaintenance() {
|
|
5759
|
-
|
|
5793
|
+
const r = await this.post("/learnings/maintenance");
|
|
5794
|
+
return { decayed_count: Number(r?.decayed_count ?? 0), potential_contradictions: r?.potential_contradictions ?? [] };
|
|
5760
5795
|
}
|
|
5761
|
-
async acquireContactLock() {
|
|
5762
|
-
return
|
|
5796
|
+
async acquireContactLock(contactId, agentName, ttlSeconds, reason, sessionId) {
|
|
5797
|
+
return this.post("/locks", { contact_id: contactId, agent_name: agentName, ttl_seconds: ttlSeconds, reason, session_id: sessionId });
|
|
5763
5798
|
}
|
|
5764
|
-
async releaseContactLock() {
|
|
5765
|
-
|
|
5799
|
+
async releaseContactLock(contactId, agentName) {
|
|
5800
|
+
const r = await this.del(`/locks/${this.enc(contactId)}`, { agent_name: agentName });
|
|
5801
|
+
return Boolean(r?.released);
|
|
5766
5802
|
}
|
|
5767
|
-
async checkContactLock() {
|
|
5768
|
-
return
|
|
5803
|
+
async checkContactLock(contactId) {
|
|
5804
|
+
return pick(await this.g(`/locks/${this.enc(contactId)}`), "lock") ?? null;
|
|
5769
5805
|
}
|
|
5770
|
-
async logAgentActivity() {
|
|
5771
|
-
|
|
5806
|
+
async logAgentActivity(contactId, agentName, action, details, sessionId) {
|
|
5807
|
+
await this.post("/activity", { contact_id: contactId, agent_name: agentName, action, details, session_id: sessionId });
|
|
5772
5808
|
}
|
|
5773
|
-
async getAgentActivity() {
|
|
5774
|
-
return
|
|
5809
|
+
async getAgentActivity(contactId, limit) {
|
|
5810
|
+
return pick(await this.g("/activity", { contact_id: contactId, limit }), "activity") ?? [];
|
|
5775
5811
|
}
|
|
5776
|
-
async computeRelationshipStrength() {
|
|
5777
|
-
|
|
5812
|
+
async computeRelationshipStrength(contactId) {
|
|
5813
|
+
const r = await this.g(`/graph/strength/${this.enc(contactId)}`);
|
|
5814
|
+
return Number(r?.strength ?? 0);
|
|
5778
5815
|
}
|
|
5779
|
-
async findWarmPath() {
|
|
5780
|
-
return
|
|
5816
|
+
async findWarmPath(fromContactId, toContactId) {
|
|
5817
|
+
return pick(await this.g("/graph/warm-path", { from: fromContactId, to: toContactId }), "path") ?? [];
|
|
5781
5818
|
}
|
|
5782
|
-
async findConnectionsAtCompany() {
|
|
5783
|
-
return
|
|
5819
|
+
async findConnectionsAtCompany(companyId) {
|
|
5820
|
+
return pick(await this.g(`/graph/company/${this.enc(companyId)}`), "connections") ?? [];
|
|
5784
5821
|
}
|
|
5785
5822
|
async detectCoolingRelationships() {
|
|
5786
|
-
return
|
|
5823
|
+
return pick(await this.g("/graph/cooling"), "cooling") ?? [];
|
|
5787
5824
|
}
|
|
5788
|
-
async resolveContactIdentity() {
|
|
5789
|
-
return
|
|
5825
|
+
async resolveContactIdentity(partial) {
|
|
5826
|
+
return pick(await this.post("/identity/resolve", partial), "matches") ?? [];
|
|
5790
5827
|
}
|
|
5791
|
-
async addContactIdentity() {
|
|
5792
|
-
return
|
|
5828
|
+
async addContactIdentity(contactId, system, externalId, externalUrl, confidence = "inferred") {
|
|
5829
|
+
return pick(await this.post("/identity", { contact_id: contactId, system, external_id: externalId, external_url: externalUrl, confidence }), "identity");
|
|
5793
5830
|
}
|
|
5794
|
-
async getContactIdentities() {
|
|
5795
|
-
return
|
|
5831
|
+
async getContactIdentities(contactId) {
|
|
5832
|
+
return pick(await this.g("/identity", { contact_id: contactId }), "identities") ?? [];
|
|
5796
5833
|
}
|
|
5797
5834
|
async semanticSearch() {
|
|
5798
5835
|
return unavailable("semanticSearch");
|
|
@@ -5803,44 +5840,45 @@ class ApiStore {
|
|
|
5803
5840
|
async embedAllContacts() {
|
|
5804
5841
|
return unavailable("embedAllContacts");
|
|
5805
5842
|
}
|
|
5806
|
-
async getRelationshipSignals() {
|
|
5807
|
-
return
|
|
5843
|
+
async getRelationshipSignals(contactId) {
|
|
5844
|
+
return pick(await this.g("/signals", { contact_id: contactId }), "signals") ?? [];
|
|
5808
5845
|
}
|
|
5809
5846
|
async getGhostContacts() {
|
|
5810
|
-
return
|
|
5847
|
+
return pick(await this.g("/signals/ghost"), "signals") ?? [];
|
|
5811
5848
|
}
|
|
5812
5849
|
async getWarmingContacts() {
|
|
5813
|
-
return
|
|
5850
|
+
return pick(await this.g("/signals/warming"), "signals") ?? [];
|
|
5814
5851
|
}
|
|
5815
5852
|
async recomputeSignals() {
|
|
5816
|
-
|
|
5853
|
+
const r = await this.post("/signals/recompute");
|
|
5854
|
+
return { updated: Number(r?.updated ?? 0) };
|
|
5817
5855
|
}
|
|
5818
|
-
async getFreshnessScore() {
|
|
5819
|
-
return
|
|
5856
|
+
async getFreshnessScore(contactId) {
|
|
5857
|
+
return pick(await this.g(`/freshness/${this.enc(contactId)}`), "freshness");
|
|
5820
5858
|
}
|
|
5821
|
-
async getStaleContacts() {
|
|
5822
|
-
return
|
|
5859
|
+
async getStaleContacts(threshold) {
|
|
5860
|
+
return pick(await this.g("/freshness/stale", { threshold }), "contacts") ?? [];
|
|
5823
5861
|
}
|
|
5824
|
-
async markFieldVerified() {
|
|
5825
|
-
|
|
5862
|
+
async markFieldVerified(contactId, fieldName, source) {
|
|
5863
|
+
await this.post("/freshness/verify", { contact_id: contactId, field_name: fieldName, source });
|
|
5826
5864
|
}
|
|
5827
|
-
async addOrgChartEdge() {
|
|
5828
|
-
return
|
|
5865
|
+
async addOrgChartEdge(companyId, contactAId, contactBId, edgeType, inferred = false) {
|
|
5866
|
+
return pick(await this.post("/org-chart", { company_id: companyId, contact_a_id: contactAId, contact_b_id: contactBId, edge_type: edgeType, inferred }), "edge");
|
|
5829
5867
|
}
|
|
5830
|
-
async listOrgChart() {
|
|
5831
|
-
return
|
|
5868
|
+
async listOrgChart(companyId) {
|
|
5869
|
+
return pick(await this.g("/org-chart", { company_id: companyId }), "edges") ?? [];
|
|
5832
5870
|
}
|
|
5833
|
-
async setDealContactRole() {
|
|
5834
|
-
return
|
|
5871
|
+
async setDealContactRole(dealId, contactId, accountRole) {
|
|
5872
|
+
return pick(await this.post(`/deals/${this.enc(dealId)}/roles`, { contact_id: contactId, account_role: accountRole }), "role");
|
|
5835
5873
|
}
|
|
5836
|
-
async getDealTeam() {
|
|
5837
|
-
return
|
|
5874
|
+
async getDealTeam(dealId) {
|
|
5875
|
+
return pick(await this.g(`/deals/${this.enc(dealId)}/team`), "team") ?? [];
|
|
5838
5876
|
}
|
|
5839
|
-
async getCoverageGaps() {
|
|
5840
|
-
return
|
|
5877
|
+
async getCoverageGaps(companyId) {
|
|
5878
|
+
return pick(await this.g(`/org-chart/coverage/${this.enc(companyId)}`), "coverage");
|
|
5841
5879
|
}
|
|
5842
|
-
async getRecentContactEvents() {
|
|
5843
|
-
return
|
|
5880
|
+
async getRecentContactEvents(since, eventTypes) {
|
|
5881
|
+
return pick(await this.g("/recent-events", { since, types: eventTypes?.length ? eventTypes.join(",") : undefined }), "events") ?? [];
|
|
5844
5882
|
}
|
|
5845
5883
|
async addDocument() {
|
|
5846
5884
|
return unavailable("addDocument");
|
|
@@ -5866,65 +5904,66 @@ class ApiStore {
|
|
|
5866
5904
|
async deleteHealthData() {
|
|
5867
5905
|
return unavailable("deleteHealthData");
|
|
5868
5906
|
}
|
|
5869
|
-
async createAudience() {
|
|
5870
|
-
return
|
|
5907
|
+
async createAudience(input) {
|
|
5908
|
+
return pick(await this.post("/audiences", input), "audience");
|
|
5871
5909
|
}
|
|
5872
|
-
async getAudience() {
|
|
5873
|
-
return
|
|
5910
|
+
async getAudience(idOrSlug) {
|
|
5911
|
+
return pick(await this.g(`/audiences/${this.enc(idOrSlug)}`), "audience");
|
|
5874
5912
|
}
|
|
5875
5913
|
async listAudiences() {
|
|
5876
|
-
return
|
|
5914
|
+
return pick(await this.g("/audiences"), "audiences") ?? [];
|
|
5877
5915
|
}
|
|
5878
|
-
async updateAudience() {
|
|
5879
|
-
return
|
|
5916
|
+
async updateAudience(idOrSlug, input) {
|
|
5917
|
+
return pick(await this.patch(`/audiences/${this.enc(idOrSlug)}`, input), "audience");
|
|
5880
5918
|
}
|
|
5881
|
-
async deleteAudience() {
|
|
5882
|
-
|
|
5919
|
+
async deleteAudience(idOrSlug) {
|
|
5920
|
+
await this.del(`/audiences/${this.enc(idOrSlug)}`);
|
|
5883
5921
|
}
|
|
5884
|
-
async resolveAudience() {
|
|
5885
|
-
return
|
|
5922
|
+
async resolveAudience(idOrSlug, channel) {
|
|
5923
|
+
return pick(await this.g(`/audiences/${this.enc(idOrSlug)}/resolve`, { channel }), "resolution");
|
|
5886
5924
|
}
|
|
5887
|
-
async setContactConsent() {
|
|
5888
|
-
return
|
|
5925
|
+
async setContactConsent(contactId, channel, status, source) {
|
|
5926
|
+
return pick(await this.post("/consent", { contact_id: contactId, channel, status, source }), "consent");
|
|
5889
5927
|
}
|
|
5890
|
-
async listContactConsent() {
|
|
5891
|
-
return
|
|
5928
|
+
async listContactConsent(contactId) {
|
|
5929
|
+
return pick(await this.g("/consent", { contact_id: contactId }), "consent") ?? [];
|
|
5892
5930
|
}
|
|
5893
|
-
async suppressAddress() {
|
|
5894
|
-
return
|
|
5931
|
+
async suppressAddress(input) {
|
|
5932
|
+
return pick(await this.post("/suppressions", input), "suppression");
|
|
5895
5933
|
}
|
|
5896
|
-
async unsuppressAddress() {
|
|
5897
|
-
|
|
5934
|
+
async unsuppressAddress(channel, address) {
|
|
5935
|
+
await this.del("/suppressions", { channel, address });
|
|
5898
5936
|
}
|
|
5899
|
-
async listSuppressions() {
|
|
5900
|
-
return
|
|
5937
|
+
async listSuppressions(opts = {}) {
|
|
5938
|
+
return pick(await this.g("/suppressions", stripUndefined(opts)), "suppressions") ?? [];
|
|
5901
5939
|
}
|
|
5902
5940
|
async syncSuppressions() {
|
|
5903
5941
|
return unavailable("syncSuppressions");
|
|
5904
5942
|
}
|
|
5905
|
-
async generateBrief() {
|
|
5906
|
-
|
|
5943
|
+
async generateBrief(contactId) {
|
|
5944
|
+
const r = await this.g(`/contacts/${this.enc(contactId)}/brief-text`);
|
|
5945
|
+
return String(r?.text ?? "");
|
|
5907
5946
|
}
|
|
5908
|
-
async getContactCard() {
|
|
5909
|
-
return
|
|
5947
|
+
async getContactCard(contactId) {
|
|
5948
|
+
return pick(await this.g(`/contacts/${this.enc(contactId)}/card`), "card");
|
|
5910
5949
|
}
|
|
5911
|
-
async getContactBrief() {
|
|
5912
|
-
return
|
|
5950
|
+
async getContactBrief(contactId, taskContext) {
|
|
5951
|
+
return pick(await this.g(`/contacts/${this.enc(contactId)}/brief`, taskContext ? { context: taskContext } : undefined), "brief");
|
|
5913
5952
|
}
|
|
5914
|
-
async assembleContext() {
|
|
5915
|
-
return
|
|
5953
|
+
async assembleContext(contactIds, format) {
|
|
5954
|
+
return pick(await this.post("/assemble-context", { contact_ids: contactIds, format }), "context");
|
|
5916
5955
|
}
|
|
5917
|
-
async getUpcomingItems() {
|
|
5918
|
-
return
|
|
5956
|
+
async getUpcomingItems(days) {
|
|
5957
|
+
return pick(await this.g("/upcoming", { days }), "items") ?? [];
|
|
5919
5958
|
}
|
|
5920
5959
|
async getNetworkStats() {
|
|
5921
|
-
return
|
|
5960
|
+
return pick(await this.g("/network-stats"), "stats");
|
|
5922
5961
|
}
|
|
5923
5962
|
async listContactAudit() {
|
|
5924
|
-
return
|
|
5963
|
+
return pick(await this.g("/contact-audit"), "audit") ?? [];
|
|
5925
5964
|
}
|
|
5926
|
-
async getContactTimeline() {
|
|
5927
|
-
return
|
|
5965
|
+
async getContactTimeline(contactId, limit) {
|
|
5966
|
+
return pick(await this.g(`/contacts/${this.enc(contactId)}/timeline`, { limit }), "timeline") ?? [];
|
|
5928
5967
|
}
|
|
5929
5968
|
async ingestMeetingParticipants() {
|
|
5930
5969
|
return unavailable("ingestMeetingParticipants");
|
|
@@ -5954,13 +5993,13 @@ class ApiStore {
|
|
|
5954
5993
|
return unavailable("lockVault");
|
|
5955
5994
|
}
|
|
5956
5995
|
async isVaultInitialized() {
|
|
5957
|
-
return
|
|
5996
|
+
return false;
|
|
5958
5997
|
}
|
|
5959
5998
|
async isVaultUnlocked() {
|
|
5960
|
-
return
|
|
5999
|
+
return false;
|
|
5961
6000
|
}
|
|
5962
6001
|
async vaultStatus() {
|
|
5963
|
-
return
|
|
6002
|
+
return pick(await this.g("/vault-status"), "vault") ?? { initialized: false, unlocked: false, document_count: 0 };
|
|
5964
6003
|
}
|
|
5965
6004
|
async saveFeedback() {
|
|
5966
6005
|
return unavailable("saveFeedback");
|
|
@@ -5969,7 +6008,7 @@ class ApiStore {
|
|
|
5969
6008
|
return null;
|
|
5970
6009
|
}
|
|
5971
6010
|
async listActiveWebhooks() {
|
|
5972
|
-
return
|
|
6011
|
+
return [];
|
|
5973
6012
|
}
|
|
5974
6013
|
}
|
|
5975
6014
|
var cached;
|