@hasna/contacts 0.6.29 → 0.6.31
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/index.js +2269 -320
- 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/index.js
CHANGED
|
@@ -5290,6 +5290,30 @@ class ApiStore {
|
|
|
5290
5290
|
constructor(client) {
|
|
5291
5291
|
this.client = client;
|
|
5292
5292
|
}
|
|
5293
|
+
g(path, query) {
|
|
5294
|
+
return this.client.transport.get(path, query ? { query } : undefined);
|
|
5295
|
+
}
|
|
5296
|
+
post(path, body) {
|
|
5297
|
+
return this.client.transport.post(path, body);
|
|
5298
|
+
}
|
|
5299
|
+
patch(path, body) {
|
|
5300
|
+
return this.client.transport.patch(path, body);
|
|
5301
|
+
}
|
|
5302
|
+
del(path, query) {
|
|
5303
|
+
return this.client.transport.del(path, undefined, query ? { query } : undefined);
|
|
5304
|
+
}
|
|
5305
|
+
async gMaybe(path) {
|
|
5306
|
+
try {
|
|
5307
|
+
return await this.client.transport.get(path);
|
|
5308
|
+
} catch (e) {
|
|
5309
|
+
if (e && typeof e === "object" && e.status === 404)
|
|
5310
|
+
return null;
|
|
5311
|
+
throw e;
|
|
5312
|
+
}
|
|
5313
|
+
}
|
|
5314
|
+
enc(id) {
|
|
5315
|
+
return encodeURIComponent(String(id));
|
|
5316
|
+
}
|
|
5293
5317
|
async createContact(input) {
|
|
5294
5318
|
const res = await this.client.create("contacts", stripUndefined(input));
|
|
5295
5319
|
return pick(res, "contact") ?? res;
|
|
@@ -5420,74 +5444,74 @@ class ApiStore {
|
|
|
5420
5444
|
async removeTagFromCompany() {
|
|
5421
5445
|
return unavailable("removeTagFromCompany");
|
|
5422
5446
|
}
|
|
5423
|
-
async createGroup() {
|
|
5424
|
-
return
|
|
5447
|
+
async createGroup(input) {
|
|
5448
|
+
return pick(await this.post("/groups", input), "group");
|
|
5425
5449
|
}
|
|
5426
|
-
async getGroup() {
|
|
5427
|
-
return
|
|
5450
|
+
async getGroup(id) {
|
|
5451
|
+
return pick(await this.gMaybe(`/groups/${this.enc(id)}`), "group") ?? null;
|
|
5428
5452
|
}
|
|
5429
|
-
async listGroups() {
|
|
5430
|
-
return
|
|
5453
|
+
async listGroups(projectId) {
|
|
5454
|
+
return pick(await this.g("/groups", projectId ? { project_id: projectId } : undefined), "groups") ?? [];
|
|
5431
5455
|
}
|
|
5432
|
-
async updateGroup() {
|
|
5433
|
-
return
|
|
5456
|
+
async updateGroup(id, input) {
|
|
5457
|
+
return pick(await this.patch(`/groups/${this.enc(id)}`, input), "group");
|
|
5434
5458
|
}
|
|
5435
|
-
async deleteGroup() {
|
|
5436
|
-
|
|
5459
|
+
async deleteGroup(id) {
|
|
5460
|
+
await this.del(`/groups/${this.enc(id)}`);
|
|
5437
5461
|
}
|
|
5438
|
-
async addContactToGroup() {
|
|
5439
|
-
return
|
|
5462
|
+
async addContactToGroup(contactId, groupId) {
|
|
5463
|
+
return this.post(`/groups/${this.enc(groupId)}/contacts`, { contact_id: contactId });
|
|
5440
5464
|
}
|
|
5441
|
-
async removeContactFromGroup() {
|
|
5442
|
-
|
|
5465
|
+
async removeContactFromGroup(contactId, groupId) {
|
|
5466
|
+
await this.del(`/groups/${this.enc(groupId)}/contacts/${this.enc(contactId)}`);
|
|
5443
5467
|
}
|
|
5444
|
-
async listContactsInGroup() {
|
|
5445
|
-
return
|
|
5468
|
+
async listContactsInGroup(groupId) {
|
|
5469
|
+
return pick(await this.g(`/groups/${this.enc(groupId)}/contacts`), "contact_ids") ?? [];
|
|
5446
5470
|
}
|
|
5447
|
-
async listGroupsForContact() {
|
|
5448
|
-
return
|
|
5471
|
+
async listGroupsForContact(contactId) {
|
|
5472
|
+
return pick(await this.g(`/groups/for-contact/${this.enc(contactId)}`), "groups") ?? [];
|
|
5449
5473
|
}
|
|
5450
|
-
async addCompanyToGroup() {
|
|
5451
|
-
return
|
|
5474
|
+
async addCompanyToGroup(companyId, groupId) {
|
|
5475
|
+
return this.post(`/groups/${this.enc(groupId)}/companies`, { company_id: companyId });
|
|
5452
5476
|
}
|
|
5453
|
-
async removeCompanyFromGroup() {
|
|
5454
|
-
|
|
5477
|
+
async removeCompanyFromGroup(companyId, groupId) {
|
|
5478
|
+
await this.del(`/groups/${this.enc(groupId)}/companies/${this.enc(companyId)}`);
|
|
5455
5479
|
}
|
|
5456
|
-
async listCompaniesInGroup() {
|
|
5457
|
-
return
|
|
5480
|
+
async listCompaniesInGroup(groupId) {
|
|
5481
|
+
return pick(await this.g(`/groups/${this.enc(groupId)}/companies`), "company_ids") ?? [];
|
|
5458
5482
|
}
|
|
5459
|
-
async listGroupsForCompany() {
|
|
5460
|
-
return
|
|
5483
|
+
async listGroupsForCompany(companyId) {
|
|
5484
|
+
return pick(await this.g(`/groups/for-company/${this.enc(companyId)}`), "groups") ?? [];
|
|
5461
5485
|
}
|
|
5462
|
-
async createRelationship() {
|
|
5463
|
-
return
|
|
5486
|
+
async createRelationship(input) {
|
|
5487
|
+
return pick(await this.post("/relationships", input), "relationship");
|
|
5464
5488
|
}
|
|
5465
|
-
async listRelationships() {
|
|
5466
|
-
return
|
|
5489
|
+
async listRelationships(opts = {}) {
|
|
5490
|
+
return pick(await this.g("/relationships", stripUndefined(opts)), "relationships") ?? [];
|
|
5467
5491
|
}
|
|
5468
|
-
async deleteRelationship() {
|
|
5469
|
-
|
|
5492
|
+
async deleteRelationship(id) {
|
|
5493
|
+
await this.del(`/relationships/${this.enc(id)}`);
|
|
5470
5494
|
}
|
|
5471
|
-
async createCompanyRelationship() {
|
|
5472
|
-
return
|
|
5495
|
+
async createCompanyRelationship(input) {
|
|
5496
|
+
return pick(await this.post("/company-relationships", input), "relationship");
|
|
5473
5497
|
}
|
|
5474
|
-
async listCompanyRelationships() {
|
|
5475
|
-
return
|
|
5498
|
+
async listCompanyRelationships(opts = {}) {
|
|
5499
|
+
return pick(await this.g("/company-relationships", stripUndefined(opts)), "relationships") ?? [];
|
|
5476
5500
|
}
|
|
5477
|
-
async deleteCompanyRelationship() {
|
|
5478
|
-
|
|
5501
|
+
async deleteCompanyRelationship(id) {
|
|
5502
|
+
await this.del(`/company-relationships/${this.enc(id)}`);
|
|
5479
5503
|
}
|
|
5480
|
-
async addNote() {
|
|
5481
|
-
return
|
|
5504
|
+
async addNote(contactId, body, createdBy, companyId) {
|
|
5505
|
+
return pick(await this.post("/notes", { contact_id: contactId, body, created_by: createdBy, company_id: companyId }), "note");
|
|
5482
5506
|
}
|
|
5483
|
-
async listNotes() {
|
|
5484
|
-
return
|
|
5507
|
+
async listNotes(contactId) {
|
|
5508
|
+
return pick(await this.g("/notes", { contact_id: contactId }), "notes") ?? [];
|
|
5485
5509
|
}
|
|
5486
|
-
async listNotesForContactAtCompany() {
|
|
5487
|
-
return
|
|
5510
|
+
async listNotesForContactAtCompany(contactId, companyId) {
|
|
5511
|
+
return pick(await this.g("/notes", { contact_id: contactId, company_id: companyId }), "notes") ?? [];
|
|
5488
5512
|
}
|
|
5489
|
-
async deleteNote() {
|
|
5490
|
-
|
|
5513
|
+
async deleteNote(noteId) {
|
|
5514
|
+
await this.del(`/notes/${this.enc(noteId)}`);
|
|
5491
5515
|
}
|
|
5492
5516
|
async listActivity() {
|
|
5493
5517
|
return unavailable("listActivity");
|
|
@@ -5502,178 +5526,191 @@ class ApiStore {
|
|
|
5502
5526
|
};
|
|
5503
5527
|
}
|
|
5504
5528
|
async findEmailDuplicates() {
|
|
5505
|
-
return
|
|
5529
|
+
return pick(await this.g("/email-duplicates"), "duplicates") ?? [];
|
|
5506
5530
|
}
|
|
5507
5531
|
async findNameDuplicates() {
|
|
5508
|
-
return
|
|
5532
|
+
return pick(await this.g("/name-duplicates"), "duplicates") ?? [];
|
|
5509
5533
|
}
|
|
5510
|
-
async flushForBackup() {
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
async listColdContacts() {
|
|
5514
|
-
return unavailable("listColdContacts");
|
|
5534
|
+
async flushForBackup() {}
|
|
5535
|
+
async listColdContacts(days) {
|
|
5536
|
+
return pick(await this.g("/cold-contacts", { days }), "contacts") ?? [];
|
|
5515
5537
|
}
|
|
5516
|
-
async findOrCreateContact() {
|
|
5517
|
-
|
|
5538
|
+
async findOrCreateContact(input) {
|
|
5539
|
+
const emails = (input.emails ?? []).map((e) => e.address).filter(Boolean);
|
|
5540
|
+
for (const addr of emails) {
|
|
5541
|
+
const c = await this.getContactByEmail(addr);
|
|
5542
|
+
if (c)
|
|
5543
|
+
return { contact: c, created: false };
|
|
5544
|
+
}
|
|
5545
|
+
const nameQuery = input.display_name ?? (input.first_name || input.last_name ? `${input.first_name ?? ""} ${input.last_name ?? ""}`.trim() : null);
|
|
5546
|
+
if (nameQuery) {
|
|
5547
|
+
const results = await this.searchContacts(nameQuery);
|
|
5548
|
+
if (results[0])
|
|
5549
|
+
return { contact: results[0], created: false };
|
|
5550
|
+
}
|
|
5551
|
+
return { contact: await this.createContact(input), created: true };
|
|
5518
5552
|
}
|
|
5519
|
-
async findContactsForContext() {
|
|
5520
|
-
return
|
|
5553
|
+
async findContactsForContext(topic, limit) {
|
|
5554
|
+
return pick(await this.g("/contacts-for-context", { topic, limit }), "contacts") ?? [];
|
|
5521
5555
|
}
|
|
5522
|
-
async listContactsNotContactedSince() {
|
|
5523
|
-
return
|
|
5556
|
+
async listContactsNotContactedSince(days, limit) {
|
|
5557
|
+
return pick(await this.g("/not-contacted", { days, limit }), "contacts") ?? [];
|
|
5524
5558
|
}
|
|
5525
|
-
async listFollowupDueContacts() {
|
|
5526
|
-
return
|
|
5559
|
+
async listFollowupDueContacts(onOrBefore) {
|
|
5560
|
+
return pick(await this.g("/followup-due-contacts", { on_or_before: onOrBefore }), "contacts") ?? [];
|
|
5527
5561
|
}
|
|
5528
|
-
async logVendorCommunication() {
|
|
5529
|
-
return
|
|
5562
|
+
async logVendorCommunication(input) {
|
|
5563
|
+
return pick(await this.post("/vendor-comms", input), "communication");
|
|
5530
5564
|
}
|
|
5531
|
-
async listVendorCommunications() {
|
|
5532
|
-
return
|
|
5565
|
+
async listVendorCommunications(companyId, opts = {}) {
|
|
5566
|
+
return pick(await this.g("/vendor-comms", { company_id: companyId, ...stripUndefined(opts) }), "communications") ?? [];
|
|
5533
5567
|
}
|
|
5534
5568
|
async listMissingInvoices() {
|
|
5535
|
-
return
|
|
5569
|
+
return pick(await this.g("/vendor-comms/missing-invoices"), "communications") ?? [];
|
|
5536
5570
|
}
|
|
5537
5571
|
async listPendingFollowUps() {
|
|
5538
|
-
return
|
|
5572
|
+
return pick(await this.g("/vendor-comms/pending-follow-ups"), "communications") ?? [];
|
|
5539
5573
|
}
|
|
5540
|
-
async markFollowUpDone() {
|
|
5541
|
-
return
|
|
5574
|
+
async markFollowUpDone(id) {
|
|
5575
|
+
return pick(await this.post(`/vendor-comms/${this.enc(id)}/mark-done`), "communication");
|
|
5542
5576
|
}
|
|
5543
|
-
async createContactTask() {
|
|
5544
|
-
return
|
|
5577
|
+
async createContactTask(input) {
|
|
5578
|
+
return pick(await this.post("/tasks", input), "task");
|
|
5545
5579
|
}
|
|
5546
|
-
async listContactTasks() {
|
|
5547
|
-
return
|
|
5580
|
+
async listContactTasks(opts = {}) {
|
|
5581
|
+
return pick(await this.g("/tasks", stripUndefined(opts)), "tasks") ?? [];
|
|
5548
5582
|
}
|
|
5549
|
-
async updateContactTask() {
|
|
5550
|
-
return
|
|
5583
|
+
async updateContactTask(id, input) {
|
|
5584
|
+
return pick(await this.patch(`/tasks/${this.enc(id)}`, input), "task");
|
|
5551
5585
|
}
|
|
5552
|
-
async deleteContactTask() {
|
|
5553
|
-
|
|
5586
|
+
async deleteContactTask(id) {
|
|
5587
|
+
await this.del(`/tasks/${this.enc(id)}`);
|
|
5554
5588
|
}
|
|
5555
5589
|
async listOverdueTasks() {
|
|
5556
|
-
return
|
|
5590
|
+
return pick(await this.g("/tasks/overdue"), "tasks") ?? [];
|
|
5557
5591
|
}
|
|
5558
5592
|
async checkEscalations() {
|
|
5559
|
-
return
|
|
5593
|
+
return pick(await this.g("/tasks/escalations"), "escalations") ?? [];
|
|
5560
5594
|
}
|
|
5561
|
-
async createApplication() {
|
|
5562
|
-
return
|
|
5595
|
+
async createApplication(input) {
|
|
5596
|
+
return pick(await this.post("/applications", input), "application");
|
|
5563
5597
|
}
|
|
5564
|
-
async listApplications() {
|
|
5565
|
-
return
|
|
5598
|
+
async listApplications(opts = {}) {
|
|
5599
|
+
return pick(await this.g("/applications", stripUndefined(opts)), "applications") ?? [];
|
|
5566
5600
|
}
|
|
5567
|
-
async updateApplication() {
|
|
5568
|
-
return
|
|
5601
|
+
async updateApplication(id, input) {
|
|
5602
|
+
return pick(await this.patch(`/applications/${this.enc(id)}`, input), "application");
|
|
5569
5603
|
}
|
|
5570
5604
|
async listFollowUpDueApplications() {
|
|
5571
|
-
return
|
|
5605
|
+
return pick(await this.g("/applications/follow-up-due"), "applications") ?? [];
|
|
5572
5606
|
}
|
|
5573
|
-
async addOrgMember() {
|
|
5574
|
-
return
|
|
5607
|
+
async addOrgMember(input) {
|
|
5608
|
+
return pick(await this.post("/org-members", input), "org_member");
|
|
5575
5609
|
}
|
|
5576
|
-
async listOrgMembers() {
|
|
5577
|
-
return
|
|
5610
|
+
async listOrgMembers(companyId) {
|
|
5611
|
+
return pick(await this.g("/org-members", { company_id: companyId }), "org_members") ?? [];
|
|
5578
5612
|
}
|
|
5579
|
-
async updateOrgMember() {
|
|
5580
|
-
return
|
|
5613
|
+
async updateOrgMember(id, input) {
|
|
5614
|
+
return pick(await this.patch(`/org-members/${this.enc(id)}`, input), "org_member");
|
|
5581
5615
|
}
|
|
5582
|
-
async removeOrgMember() {
|
|
5583
|
-
|
|
5616
|
+
async removeOrgMember(id) {
|
|
5617
|
+
await this.del(`/org-members/${this.enc(id)}`);
|
|
5584
5618
|
}
|
|
5585
|
-
async listOrgMembersForContact() {
|
|
5586
|
-
return
|
|
5619
|
+
async listOrgMembersForContact(contactId) {
|
|
5620
|
+
return pick(await this.g("/org-members", { contact_id: contactId }), "org_members") ?? [];
|
|
5587
5621
|
}
|
|
5588
|
-
async createDeal() {
|
|
5589
|
-
return
|
|
5622
|
+
async createDeal(input) {
|
|
5623
|
+
return pick(await this.post("/deals", input), "deal");
|
|
5590
5624
|
}
|
|
5591
|
-
async getDeal() {
|
|
5592
|
-
return
|
|
5625
|
+
async getDeal(id) {
|
|
5626
|
+
return pick(await this.gMaybe(`/deals/${this.enc(id)}`), "deal") ?? null;
|
|
5593
5627
|
}
|
|
5594
|
-
async listDeals() {
|
|
5595
|
-
return
|
|
5628
|
+
async listDeals(opts = {}) {
|
|
5629
|
+
return pick(await this.g("/deals", stripUndefined(opts)), "deals") ?? [];
|
|
5596
5630
|
}
|
|
5597
|
-
async updateDeal() {
|
|
5598
|
-
return
|
|
5631
|
+
async updateDeal(id, input) {
|
|
5632
|
+
return pick(await this.patch(`/deals/${this.enc(id)}`, input), "deal") ?? null;
|
|
5599
5633
|
}
|
|
5600
|
-
async deleteDeal() {
|
|
5601
|
-
|
|
5634
|
+
async deleteDeal(id) {
|
|
5635
|
+
await this.del(`/deals/${this.enc(id)}`);
|
|
5602
5636
|
}
|
|
5603
|
-
async logEvent() {
|
|
5604
|
-
return
|
|
5637
|
+
async logEvent(input) {
|
|
5638
|
+
return pick(await this.post("/events", input), "event");
|
|
5605
5639
|
}
|
|
5606
|
-
async listEvents() {
|
|
5607
|
-
return
|
|
5640
|
+
async listEvents(opts = {}) {
|
|
5641
|
+
return pick(await this.g("/events", stripUndefined(opts)), "events") ?? [];
|
|
5608
5642
|
}
|
|
5609
|
-
async deleteEvent() {
|
|
5610
|
-
|
|
5643
|
+
async deleteEvent(id) {
|
|
5644
|
+
await this.del(`/events/${this.enc(id)}`);
|
|
5611
5645
|
}
|
|
5612
|
-
async getFieldHistory() {
|
|
5613
|
-
return
|
|
5646
|
+
async getFieldHistory(contactId, fieldName) {
|
|
5647
|
+
return pick(await this.g(`/contacts/${this.enc(contactId)}/field-history`, fieldName ? { field_name: fieldName } : undefined), "history") ?? [];
|
|
5614
5648
|
}
|
|
5615
|
-
async getContactAt() {
|
|
5616
|
-
return
|
|
5649
|
+
async getContactAt(contactId, timestamp) {
|
|
5650
|
+
return pick(await this.g(`/contacts/${this.enc(contactId)}/field-at`, { timestamp }), "fields") ?? {};
|
|
5617
5651
|
}
|
|
5618
|
-
async addJobEntry() {
|
|
5619
|
-
return
|
|
5652
|
+
async addJobEntry(contactId, input) {
|
|
5653
|
+
return pick(await this.post(`/contacts/${this.enc(contactId)}/job-history`, input), "job");
|
|
5620
5654
|
}
|
|
5621
|
-
async getJobHistory() {
|
|
5622
|
-
return
|
|
5655
|
+
async getJobHistory(contactId) {
|
|
5656
|
+
return pick(await this.g(`/contacts/${this.enc(contactId)}/job-history`), "job_history") ?? [];
|
|
5623
5657
|
}
|
|
5624
|
-
async saveLearning() {
|
|
5625
|
-
return
|
|
5658
|
+
async saveLearning(contactId, input) {
|
|
5659
|
+
return pick(await this.post(`/contacts/${this.enc(contactId)}/learnings`, input), "learning");
|
|
5626
5660
|
}
|
|
5627
|
-
async getLearnings() {
|
|
5628
|
-
return
|
|
5661
|
+
async getLearnings(contactId, opts = {}) {
|
|
5662
|
+
return pick(await this.g(`/contacts/${this.enc(contactId)}/learnings`, stripUndefined(opts)), "learnings") ?? [];
|
|
5629
5663
|
}
|
|
5630
|
-
async searchLearnings() {
|
|
5631
|
-
return
|
|
5664
|
+
async searchLearnings(query, opts = {}) {
|
|
5665
|
+
return pick(await this.g("/learnings/search", { q: query, ...stripUndefined(opts) }), "learnings") ?? [];
|
|
5632
5666
|
}
|
|
5633
|
-
async confirmLearning() {
|
|
5634
|
-
|
|
5667
|
+
async confirmLearning(learningId) {
|
|
5668
|
+
await this.post(`/learnings/${this.enc(learningId)}/confirm`);
|
|
5635
5669
|
}
|
|
5636
|
-
async getStaleLearnings() {
|
|
5637
|
-
return
|
|
5670
|
+
async getStaleLearnings(daysOld, minConfidence) {
|
|
5671
|
+
return pick(await this.g("/learnings/stale", { days_old: daysOld, min_confidence: minConfidence }), "learnings") ?? [];
|
|
5638
5672
|
}
|
|
5639
5673
|
async runLearningMaintenance() {
|
|
5640
|
-
|
|
5674
|
+
const r = await this.post("/learnings/maintenance");
|
|
5675
|
+
return { decayed_count: Number(r?.decayed_count ?? 0), potential_contradictions: r?.potential_contradictions ?? [] };
|
|
5641
5676
|
}
|
|
5642
|
-
async acquireContactLock() {
|
|
5643
|
-
return
|
|
5677
|
+
async acquireContactLock(contactId, agentName, ttlSeconds, reason, sessionId) {
|
|
5678
|
+
return this.post("/locks", { contact_id: contactId, agent_name: agentName, ttl_seconds: ttlSeconds, reason, session_id: sessionId });
|
|
5644
5679
|
}
|
|
5645
|
-
async releaseContactLock() {
|
|
5646
|
-
|
|
5680
|
+
async releaseContactLock(contactId, agentName) {
|
|
5681
|
+
const r = await this.del(`/locks/${this.enc(contactId)}`, { agent_name: agentName });
|
|
5682
|
+
return Boolean(r?.released);
|
|
5647
5683
|
}
|
|
5648
|
-
async checkContactLock() {
|
|
5649
|
-
return
|
|
5684
|
+
async checkContactLock(contactId) {
|
|
5685
|
+
return pick(await this.g(`/locks/${this.enc(contactId)}`), "lock") ?? null;
|
|
5650
5686
|
}
|
|
5651
|
-
async logAgentActivity() {
|
|
5652
|
-
|
|
5687
|
+
async logAgentActivity(contactId, agentName, action, details, sessionId) {
|
|
5688
|
+
await this.post("/activity", { contact_id: contactId, agent_name: agentName, action, details, session_id: sessionId });
|
|
5653
5689
|
}
|
|
5654
|
-
async getAgentActivity() {
|
|
5655
|
-
return
|
|
5690
|
+
async getAgentActivity(contactId, limit) {
|
|
5691
|
+
return pick(await this.g("/activity", { contact_id: contactId, limit }), "activity") ?? [];
|
|
5656
5692
|
}
|
|
5657
|
-
async computeRelationshipStrength() {
|
|
5658
|
-
|
|
5693
|
+
async computeRelationshipStrength(contactId) {
|
|
5694
|
+
const r = await this.g(`/graph/strength/${this.enc(contactId)}`);
|
|
5695
|
+
return Number(r?.strength ?? 0);
|
|
5659
5696
|
}
|
|
5660
|
-
async findWarmPath() {
|
|
5661
|
-
return
|
|
5697
|
+
async findWarmPath(fromContactId, toContactId) {
|
|
5698
|
+
return pick(await this.g("/graph/warm-path", { from: fromContactId, to: toContactId }), "path") ?? [];
|
|
5662
5699
|
}
|
|
5663
|
-
async findConnectionsAtCompany() {
|
|
5664
|
-
return
|
|
5700
|
+
async findConnectionsAtCompany(companyId) {
|
|
5701
|
+
return pick(await this.g(`/graph/company/${this.enc(companyId)}`), "connections") ?? [];
|
|
5665
5702
|
}
|
|
5666
5703
|
async detectCoolingRelationships() {
|
|
5667
|
-
return
|
|
5704
|
+
return pick(await this.g("/graph/cooling"), "cooling") ?? [];
|
|
5668
5705
|
}
|
|
5669
|
-
async resolveContactIdentity() {
|
|
5670
|
-
return
|
|
5706
|
+
async resolveContactIdentity(partial) {
|
|
5707
|
+
return pick(await this.post("/identity/resolve", partial), "matches") ?? [];
|
|
5671
5708
|
}
|
|
5672
|
-
async addContactIdentity() {
|
|
5673
|
-
return
|
|
5709
|
+
async addContactIdentity(contactId, system, externalId, externalUrl, confidence = "inferred") {
|
|
5710
|
+
return pick(await this.post("/identity", { contact_id: contactId, system, external_id: externalId, external_url: externalUrl, confidence }), "identity");
|
|
5674
5711
|
}
|
|
5675
|
-
async getContactIdentities() {
|
|
5676
|
-
return
|
|
5712
|
+
async getContactIdentities(contactId) {
|
|
5713
|
+
return pick(await this.g("/identity", { contact_id: contactId }), "identities") ?? [];
|
|
5677
5714
|
}
|
|
5678
5715
|
async semanticSearch() {
|
|
5679
5716
|
return unavailable("semanticSearch");
|
|
@@ -5684,44 +5721,45 @@ class ApiStore {
|
|
|
5684
5721
|
async embedAllContacts() {
|
|
5685
5722
|
return unavailable("embedAllContacts");
|
|
5686
5723
|
}
|
|
5687
|
-
async getRelationshipSignals() {
|
|
5688
|
-
return
|
|
5724
|
+
async getRelationshipSignals(contactId) {
|
|
5725
|
+
return pick(await this.g("/signals", { contact_id: contactId }), "signals") ?? [];
|
|
5689
5726
|
}
|
|
5690
5727
|
async getGhostContacts() {
|
|
5691
|
-
return
|
|
5728
|
+
return pick(await this.g("/signals/ghost"), "signals") ?? [];
|
|
5692
5729
|
}
|
|
5693
5730
|
async getWarmingContacts() {
|
|
5694
|
-
return
|
|
5731
|
+
return pick(await this.g("/signals/warming"), "signals") ?? [];
|
|
5695
5732
|
}
|
|
5696
5733
|
async recomputeSignals() {
|
|
5697
|
-
|
|
5734
|
+
const r = await this.post("/signals/recompute");
|
|
5735
|
+
return { updated: Number(r?.updated ?? 0) };
|
|
5698
5736
|
}
|
|
5699
|
-
async getFreshnessScore() {
|
|
5700
|
-
return
|
|
5737
|
+
async getFreshnessScore(contactId) {
|
|
5738
|
+
return pick(await this.g(`/freshness/${this.enc(contactId)}`), "freshness");
|
|
5701
5739
|
}
|
|
5702
|
-
async getStaleContacts() {
|
|
5703
|
-
return
|
|
5740
|
+
async getStaleContacts(threshold) {
|
|
5741
|
+
return pick(await this.g("/freshness/stale", { threshold }), "contacts") ?? [];
|
|
5704
5742
|
}
|
|
5705
|
-
async markFieldVerified() {
|
|
5706
|
-
|
|
5743
|
+
async markFieldVerified(contactId, fieldName, source) {
|
|
5744
|
+
await this.post("/freshness/verify", { contact_id: contactId, field_name: fieldName, source });
|
|
5707
5745
|
}
|
|
5708
|
-
async addOrgChartEdge() {
|
|
5709
|
-
return
|
|
5746
|
+
async addOrgChartEdge(companyId, contactAId, contactBId, edgeType, inferred = false) {
|
|
5747
|
+
return pick(await this.post("/org-chart", { company_id: companyId, contact_a_id: contactAId, contact_b_id: contactBId, edge_type: edgeType, inferred }), "edge");
|
|
5710
5748
|
}
|
|
5711
|
-
async listOrgChart() {
|
|
5712
|
-
return
|
|
5749
|
+
async listOrgChart(companyId) {
|
|
5750
|
+
return pick(await this.g("/org-chart", { company_id: companyId }), "edges") ?? [];
|
|
5713
5751
|
}
|
|
5714
|
-
async setDealContactRole() {
|
|
5715
|
-
return
|
|
5752
|
+
async setDealContactRole(dealId, contactId, accountRole) {
|
|
5753
|
+
return pick(await this.post(`/deals/${this.enc(dealId)}/roles`, { contact_id: contactId, account_role: accountRole }), "role");
|
|
5716
5754
|
}
|
|
5717
|
-
async getDealTeam() {
|
|
5718
|
-
return
|
|
5755
|
+
async getDealTeam(dealId) {
|
|
5756
|
+
return pick(await this.g(`/deals/${this.enc(dealId)}/team`), "team") ?? [];
|
|
5719
5757
|
}
|
|
5720
|
-
async getCoverageGaps() {
|
|
5721
|
-
return
|
|
5758
|
+
async getCoverageGaps(companyId) {
|
|
5759
|
+
return pick(await this.g(`/org-chart/coverage/${this.enc(companyId)}`), "coverage");
|
|
5722
5760
|
}
|
|
5723
|
-
async getRecentContactEvents() {
|
|
5724
|
-
return
|
|
5761
|
+
async getRecentContactEvents(since, eventTypes) {
|
|
5762
|
+
return pick(await this.g("/recent-events", { since, types: eventTypes?.length ? eventTypes.join(",") : undefined }), "events") ?? [];
|
|
5725
5763
|
}
|
|
5726
5764
|
async addDocument() {
|
|
5727
5765
|
return unavailable("addDocument");
|
|
@@ -5747,65 +5785,66 @@ class ApiStore {
|
|
|
5747
5785
|
async deleteHealthData() {
|
|
5748
5786
|
return unavailable("deleteHealthData");
|
|
5749
5787
|
}
|
|
5750
|
-
async createAudience() {
|
|
5751
|
-
return
|
|
5788
|
+
async createAudience(input) {
|
|
5789
|
+
return pick(await this.post("/audiences", input), "audience");
|
|
5752
5790
|
}
|
|
5753
|
-
async getAudience() {
|
|
5754
|
-
return
|
|
5791
|
+
async getAudience(idOrSlug) {
|
|
5792
|
+
return pick(await this.g(`/audiences/${this.enc(idOrSlug)}`), "audience");
|
|
5755
5793
|
}
|
|
5756
5794
|
async listAudiences() {
|
|
5757
|
-
return
|
|
5795
|
+
return pick(await this.g("/audiences"), "audiences") ?? [];
|
|
5758
5796
|
}
|
|
5759
|
-
async updateAudience() {
|
|
5760
|
-
return
|
|
5797
|
+
async updateAudience(idOrSlug, input) {
|
|
5798
|
+
return pick(await this.patch(`/audiences/${this.enc(idOrSlug)}`, input), "audience");
|
|
5761
5799
|
}
|
|
5762
|
-
async deleteAudience() {
|
|
5763
|
-
|
|
5800
|
+
async deleteAudience(idOrSlug) {
|
|
5801
|
+
await this.del(`/audiences/${this.enc(idOrSlug)}`);
|
|
5764
5802
|
}
|
|
5765
|
-
async resolveAudience() {
|
|
5766
|
-
return
|
|
5803
|
+
async resolveAudience(idOrSlug, channel) {
|
|
5804
|
+
return pick(await this.g(`/audiences/${this.enc(idOrSlug)}/resolve`, { channel }), "resolution");
|
|
5767
5805
|
}
|
|
5768
|
-
async setContactConsent() {
|
|
5769
|
-
return
|
|
5806
|
+
async setContactConsent(contactId, channel, status, source) {
|
|
5807
|
+
return pick(await this.post("/consent", { contact_id: contactId, channel, status, source }), "consent");
|
|
5770
5808
|
}
|
|
5771
|
-
async listContactConsent() {
|
|
5772
|
-
return
|
|
5809
|
+
async listContactConsent(contactId) {
|
|
5810
|
+
return pick(await this.g("/consent", { contact_id: contactId }), "consent") ?? [];
|
|
5773
5811
|
}
|
|
5774
|
-
async suppressAddress() {
|
|
5775
|
-
return
|
|
5812
|
+
async suppressAddress(input) {
|
|
5813
|
+
return pick(await this.post("/suppressions", input), "suppression");
|
|
5776
5814
|
}
|
|
5777
|
-
async unsuppressAddress() {
|
|
5778
|
-
|
|
5815
|
+
async unsuppressAddress(channel, address) {
|
|
5816
|
+
await this.del("/suppressions", { channel, address });
|
|
5779
5817
|
}
|
|
5780
|
-
async listSuppressions() {
|
|
5781
|
-
return
|
|
5818
|
+
async listSuppressions(opts = {}) {
|
|
5819
|
+
return pick(await this.g("/suppressions", stripUndefined(opts)), "suppressions") ?? [];
|
|
5782
5820
|
}
|
|
5783
5821
|
async syncSuppressions() {
|
|
5784
5822
|
return unavailable("syncSuppressions");
|
|
5785
5823
|
}
|
|
5786
|
-
async generateBrief() {
|
|
5787
|
-
|
|
5824
|
+
async generateBrief(contactId) {
|
|
5825
|
+
const r = await this.g(`/contacts/${this.enc(contactId)}/brief-text`);
|
|
5826
|
+
return String(r?.text ?? "");
|
|
5788
5827
|
}
|
|
5789
|
-
async getContactCard() {
|
|
5790
|
-
return
|
|
5828
|
+
async getContactCard(contactId) {
|
|
5829
|
+
return pick(await this.g(`/contacts/${this.enc(contactId)}/card`), "card");
|
|
5791
5830
|
}
|
|
5792
|
-
async getContactBrief() {
|
|
5793
|
-
return
|
|
5831
|
+
async getContactBrief(contactId, taskContext) {
|
|
5832
|
+
return pick(await this.g(`/contacts/${this.enc(contactId)}/brief`, taskContext ? { context: taskContext } : undefined), "brief");
|
|
5794
5833
|
}
|
|
5795
|
-
async assembleContext() {
|
|
5796
|
-
return
|
|
5834
|
+
async assembleContext(contactIds, format) {
|
|
5835
|
+
return pick(await this.post("/assemble-context", { contact_ids: contactIds, format }), "context");
|
|
5797
5836
|
}
|
|
5798
|
-
async getUpcomingItems() {
|
|
5799
|
-
return
|
|
5837
|
+
async getUpcomingItems(days) {
|
|
5838
|
+
return pick(await this.g("/upcoming", { days }), "items") ?? [];
|
|
5800
5839
|
}
|
|
5801
5840
|
async getNetworkStats() {
|
|
5802
|
-
return
|
|
5841
|
+
return pick(await this.g("/network-stats"), "stats");
|
|
5803
5842
|
}
|
|
5804
5843
|
async listContactAudit() {
|
|
5805
|
-
return
|
|
5844
|
+
return pick(await this.g("/contact-audit"), "audit") ?? [];
|
|
5806
5845
|
}
|
|
5807
|
-
async getContactTimeline() {
|
|
5808
|
-
return
|
|
5846
|
+
async getContactTimeline(contactId, limit) {
|
|
5847
|
+
return pick(await this.g(`/contacts/${this.enc(contactId)}/timeline`, { limit }), "timeline") ?? [];
|
|
5809
5848
|
}
|
|
5810
5849
|
async ingestMeetingParticipants() {
|
|
5811
5850
|
return unavailable("ingestMeetingParticipants");
|
|
@@ -5835,13 +5874,13 @@ class ApiStore {
|
|
|
5835
5874
|
return unavailable("lockVault");
|
|
5836
5875
|
}
|
|
5837
5876
|
async isVaultInitialized() {
|
|
5838
|
-
return
|
|
5877
|
+
return false;
|
|
5839
5878
|
}
|
|
5840
5879
|
async isVaultUnlocked() {
|
|
5841
|
-
return
|
|
5880
|
+
return false;
|
|
5842
5881
|
}
|
|
5843
5882
|
async vaultStatus() {
|
|
5844
|
-
return
|
|
5883
|
+
return pick(await this.g("/vault-status"), "vault") ?? { initialized: false, unlocked: false, document_count: 0 };
|
|
5845
5884
|
}
|
|
5846
5885
|
async saveFeedback() {
|
|
5847
5886
|
return unavailable("saveFeedback");
|
|
@@ -5850,7 +5889,7 @@ class ApiStore {
|
|
|
5850
5889
|
return null;
|
|
5851
5890
|
}
|
|
5852
5891
|
async listActiveWebhooks() {
|
|
5853
|
-
return
|
|
5892
|
+
return [];
|
|
5854
5893
|
}
|
|
5855
5894
|
}
|
|
5856
5895
|
var cached;
|