@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/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 unavailable("createGroup");
5566
+ async createGroup(input) {
5567
+ return pick(await this.post("/groups", input), "group");
5544
5568
  }
5545
- async getGroup() {
5546
- return unavailable("getGroup");
5569
+ async getGroup(id) {
5570
+ return pick(await this.gMaybe(`/groups/${this.enc(id)}`), "group") ?? null;
5547
5571
  }
5548
- async listGroups() {
5549
- return unavailable("listGroups");
5572
+ async listGroups(projectId) {
5573
+ return pick(await this.g("/groups", projectId ? { project_id: projectId } : undefined), "groups") ?? [];
5550
5574
  }
5551
- async updateGroup() {
5552
- return unavailable("updateGroup");
5575
+ async updateGroup(id, input) {
5576
+ return pick(await this.patch(`/groups/${this.enc(id)}`, input), "group");
5553
5577
  }
5554
- async deleteGroup() {
5555
- return unavailable("deleteGroup");
5578
+ async deleteGroup(id) {
5579
+ await this.del(`/groups/${this.enc(id)}`);
5556
5580
  }
5557
- async addContactToGroup() {
5558
- return unavailable("addContactToGroup");
5581
+ async addContactToGroup(contactId, groupId) {
5582
+ return this.post(`/groups/${this.enc(groupId)}/contacts`, { contact_id: contactId });
5559
5583
  }
5560
- async removeContactFromGroup() {
5561
- return unavailable("removeContactFromGroup");
5584
+ async removeContactFromGroup(contactId, groupId) {
5585
+ await this.del(`/groups/${this.enc(groupId)}/contacts/${this.enc(contactId)}`);
5562
5586
  }
5563
- async listContactsInGroup() {
5564
- return unavailable("listContactsInGroup");
5587
+ async listContactsInGroup(groupId) {
5588
+ return pick(await this.g(`/groups/${this.enc(groupId)}/contacts`), "contact_ids") ?? [];
5565
5589
  }
5566
- async listGroupsForContact() {
5567
- return unavailable("listGroupsForContact");
5590
+ async listGroupsForContact(contactId) {
5591
+ return pick(await this.g(`/groups/for-contact/${this.enc(contactId)}`), "groups") ?? [];
5568
5592
  }
5569
- async addCompanyToGroup() {
5570
- return unavailable("addCompanyToGroup");
5593
+ async addCompanyToGroup(companyId, groupId) {
5594
+ return this.post(`/groups/${this.enc(groupId)}/companies`, { company_id: companyId });
5571
5595
  }
5572
- async removeCompanyFromGroup() {
5573
- return unavailable("removeCompanyFromGroup");
5596
+ async removeCompanyFromGroup(companyId, groupId) {
5597
+ await this.del(`/groups/${this.enc(groupId)}/companies/${this.enc(companyId)}`);
5574
5598
  }
5575
- async listCompaniesInGroup() {
5576
- return unavailable("listCompaniesInGroup");
5599
+ async listCompaniesInGroup(groupId) {
5600
+ return pick(await this.g(`/groups/${this.enc(groupId)}/companies`), "company_ids") ?? [];
5577
5601
  }
5578
- async listGroupsForCompany() {
5579
- return unavailable("listGroupsForCompany");
5602
+ async listGroupsForCompany(companyId) {
5603
+ return pick(await this.g(`/groups/for-company/${this.enc(companyId)}`), "groups") ?? [];
5580
5604
  }
5581
- async createRelationship() {
5582
- return unavailable("createRelationship");
5605
+ async createRelationship(input) {
5606
+ return pick(await this.post("/relationships", input), "relationship");
5583
5607
  }
5584
- async listRelationships() {
5585
- return unavailable("listRelationships");
5608
+ async listRelationships(opts = {}) {
5609
+ return pick(await this.g("/relationships", stripUndefined(opts)), "relationships") ?? [];
5586
5610
  }
5587
- async deleteRelationship() {
5588
- return unavailable("deleteRelationship");
5611
+ async deleteRelationship(id) {
5612
+ await this.del(`/relationships/${this.enc(id)}`);
5589
5613
  }
5590
- async createCompanyRelationship() {
5591
- return unavailable("createCompanyRelationship");
5614
+ async createCompanyRelationship(input) {
5615
+ return pick(await this.post("/company-relationships", input), "relationship");
5592
5616
  }
5593
- async listCompanyRelationships() {
5594
- return unavailable("listCompanyRelationships");
5617
+ async listCompanyRelationships(opts = {}) {
5618
+ return pick(await this.g("/company-relationships", stripUndefined(opts)), "relationships") ?? [];
5595
5619
  }
5596
- async deleteCompanyRelationship() {
5597
- return unavailable("deleteCompanyRelationship");
5620
+ async deleteCompanyRelationship(id) {
5621
+ await this.del(`/company-relationships/${this.enc(id)}`);
5598
5622
  }
5599
- async addNote() {
5600
- return unavailable("addNote");
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 unavailable("listNotes");
5626
+ async listNotes(contactId) {
5627
+ return pick(await this.g("/notes", { contact_id: contactId }), "notes") ?? [];
5604
5628
  }
5605
- async listNotesForContactAtCompany() {
5606
- return unavailable("listNotesForContactAtCompany");
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
- return unavailable("deleteNote");
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 unavailable("findEmailDuplicates");
5648
+ return pick(await this.g("/email-duplicates"), "duplicates") ?? [];
5625
5649
  }
5626
5650
  async findNameDuplicates() {
5627
- return unavailable("findNameDuplicates");
5651
+ return pick(await this.g("/name-duplicates"), "duplicates") ?? [];
5628
5652
  }
5629
- async flushForBackup() {
5630
- return unavailable("flushForBackup");
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
- return unavailable("findOrCreateContact");
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 unavailable("findContactsForContext");
5672
+ async findContactsForContext(topic, limit) {
5673
+ return pick(await this.g("/contacts-for-context", { topic, limit }), "contacts") ?? [];
5640
5674
  }
5641
- async listContactsNotContactedSince() {
5642
- return unavailable("listContactsNotContactedSince");
5675
+ async listContactsNotContactedSince(days, limit) {
5676
+ return pick(await this.g("/not-contacted", { days, limit }), "contacts") ?? [];
5643
5677
  }
5644
- async listFollowupDueContacts() {
5645
- return unavailable("listFollowupDueContacts");
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 unavailable("logVendorCommunication");
5681
+ async logVendorCommunication(input) {
5682
+ return pick(await this.post("/vendor-comms", input), "communication");
5649
5683
  }
5650
- async listVendorCommunications() {
5651
- return unavailable("listVendorCommunications");
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 unavailable("listMissingInvoices");
5688
+ return pick(await this.g("/vendor-comms/missing-invoices"), "communications") ?? [];
5655
5689
  }
5656
5690
  async listPendingFollowUps() {
5657
- return unavailable("listPendingFollowUps");
5691
+ return pick(await this.g("/vendor-comms/pending-follow-ups"), "communications") ?? [];
5658
5692
  }
5659
- async markFollowUpDone() {
5660
- return unavailable("markFollowUpDone");
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 unavailable("createContactTask");
5696
+ async createContactTask(input) {
5697
+ return pick(await this.post("/tasks", input), "task");
5664
5698
  }
5665
- async listContactTasks() {
5666
- return unavailable("listContactTasks");
5699
+ async listContactTasks(opts = {}) {
5700
+ return pick(await this.g("/tasks", stripUndefined(opts)), "tasks") ?? [];
5667
5701
  }
5668
- async updateContactTask() {
5669
- return unavailable("updateContactTask");
5702
+ async updateContactTask(id, input) {
5703
+ return pick(await this.patch(`/tasks/${this.enc(id)}`, input), "task");
5670
5704
  }
5671
- async deleteContactTask() {
5672
- return unavailable("deleteContactTask");
5705
+ async deleteContactTask(id) {
5706
+ await this.del(`/tasks/${this.enc(id)}`);
5673
5707
  }
5674
5708
  async listOverdueTasks() {
5675
- return unavailable("listOverdueTasks");
5709
+ return pick(await this.g("/tasks/overdue"), "tasks") ?? [];
5676
5710
  }
5677
5711
  async checkEscalations() {
5678
- return unavailable("checkEscalations");
5712
+ return pick(await this.g("/tasks/escalations"), "escalations") ?? [];
5679
5713
  }
5680
- async createApplication() {
5681
- return unavailable("createApplication");
5714
+ async createApplication(input) {
5715
+ return pick(await this.post("/applications", input), "application");
5682
5716
  }
5683
- async listApplications() {
5684
- return unavailable("listApplications");
5717
+ async listApplications(opts = {}) {
5718
+ return pick(await this.g("/applications", stripUndefined(opts)), "applications") ?? [];
5685
5719
  }
5686
- async updateApplication() {
5687
- return unavailable("updateApplication");
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 unavailable("listFollowUpDueApplications");
5724
+ return pick(await this.g("/applications/follow-up-due"), "applications") ?? [];
5691
5725
  }
5692
- async addOrgMember() {
5693
- return unavailable("addOrgMember");
5726
+ async addOrgMember(input) {
5727
+ return pick(await this.post("/org-members", input), "org_member");
5694
5728
  }
5695
- async listOrgMembers() {
5696
- return unavailable("listOrgMembers");
5729
+ async listOrgMembers(companyId) {
5730
+ return pick(await this.g("/org-members", { company_id: companyId }), "org_members") ?? [];
5697
5731
  }
5698
- async updateOrgMember() {
5699
- return unavailable("updateOrgMember");
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
- return unavailable("removeOrgMember");
5735
+ async removeOrgMember(id) {
5736
+ await this.del(`/org-members/${this.enc(id)}`);
5703
5737
  }
5704
- async listOrgMembersForContact() {
5705
- return unavailable("listOrgMembersForContact");
5738
+ async listOrgMembersForContact(contactId) {
5739
+ return pick(await this.g("/org-members", { contact_id: contactId }), "org_members") ?? [];
5706
5740
  }
5707
- async createDeal() {
5708
- return unavailable("createDeal");
5741
+ async createDeal(input) {
5742
+ return pick(await this.post("/deals", input), "deal");
5709
5743
  }
5710
- async getDeal() {
5711
- return unavailable("getDeal");
5744
+ async getDeal(id) {
5745
+ return pick(await this.gMaybe(`/deals/${this.enc(id)}`), "deal") ?? null;
5712
5746
  }
5713
- async listDeals() {
5714
- return unavailable("listDeals");
5747
+ async listDeals(opts = {}) {
5748
+ return pick(await this.g("/deals", stripUndefined(opts)), "deals") ?? [];
5715
5749
  }
5716
- async updateDeal() {
5717
- return unavailable("updateDeal");
5750
+ async updateDeal(id, input) {
5751
+ return pick(await this.patch(`/deals/${this.enc(id)}`, input), "deal") ?? null;
5718
5752
  }
5719
- async deleteDeal() {
5720
- return unavailable("deleteDeal");
5753
+ async deleteDeal(id) {
5754
+ await this.del(`/deals/${this.enc(id)}`);
5721
5755
  }
5722
- async logEvent() {
5723
- return unavailable("logEvent");
5756
+ async logEvent(input) {
5757
+ return pick(await this.post("/events", input), "event");
5724
5758
  }
5725
- async listEvents() {
5726
- return unavailable("listEvents");
5759
+ async listEvents(opts = {}) {
5760
+ return pick(await this.g("/events", stripUndefined(opts)), "events") ?? [];
5727
5761
  }
5728
- async deleteEvent() {
5729
- return unavailable("deleteEvent");
5762
+ async deleteEvent(id) {
5763
+ await this.del(`/events/${this.enc(id)}`);
5730
5764
  }
5731
- async getFieldHistory() {
5732
- return unavailable("getFieldHistory");
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 unavailable("getContactAt");
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 unavailable("addJobEntry");
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 unavailable("getJobHistory");
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 unavailable("saveLearning");
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 unavailable("getLearnings");
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 unavailable("searchLearnings");
5783
+ async searchLearnings(query, opts = {}) {
5784
+ return pick(await this.g("/learnings/search", { q: query, ...stripUndefined(opts) }), "learnings") ?? [];
5751
5785
  }
5752
- async confirmLearning() {
5753
- return unavailable("confirmLearning");
5786
+ async confirmLearning(learningId) {
5787
+ await this.post(`/learnings/${this.enc(learningId)}/confirm`);
5754
5788
  }
5755
- async getStaleLearnings() {
5756
- return unavailable("getStaleLearnings");
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
- return unavailable("runLearningMaintenance");
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 unavailable("acquireContactLock");
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
- return unavailable("releaseContactLock");
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 unavailable("checkContactLock");
5803
+ async checkContactLock(contactId) {
5804
+ return pick(await this.g(`/locks/${this.enc(contactId)}`), "lock") ?? null;
5769
5805
  }
5770
- async logAgentActivity() {
5771
- return unavailable("logAgentActivity");
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 unavailable("getAgentActivity");
5809
+ async getAgentActivity(contactId, limit) {
5810
+ return pick(await this.g("/activity", { contact_id: contactId, limit }), "activity") ?? [];
5775
5811
  }
5776
- async computeRelationshipStrength() {
5777
- return unavailable("computeRelationshipStrength");
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 unavailable("findWarmPath");
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 unavailable("findConnectionsAtCompany");
5819
+ async findConnectionsAtCompany(companyId) {
5820
+ return pick(await this.g(`/graph/company/${this.enc(companyId)}`), "connections") ?? [];
5784
5821
  }
5785
5822
  async detectCoolingRelationships() {
5786
- return unavailable("detectCoolingRelationships");
5823
+ return pick(await this.g("/graph/cooling"), "cooling") ?? [];
5787
5824
  }
5788
- async resolveContactIdentity() {
5789
- return unavailable("resolveContactIdentity");
5825
+ async resolveContactIdentity(partial) {
5826
+ return pick(await this.post("/identity/resolve", partial), "matches") ?? [];
5790
5827
  }
5791
- async addContactIdentity() {
5792
- return unavailable("addContactIdentity");
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 unavailable("getContactIdentities");
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 unavailable("getRelationshipSignals");
5843
+ async getRelationshipSignals(contactId) {
5844
+ return pick(await this.g("/signals", { contact_id: contactId }), "signals") ?? [];
5808
5845
  }
5809
5846
  async getGhostContacts() {
5810
- return unavailable("getGhostContacts");
5847
+ return pick(await this.g("/signals/ghost"), "signals") ?? [];
5811
5848
  }
5812
5849
  async getWarmingContacts() {
5813
- return unavailable("getWarmingContacts");
5850
+ return pick(await this.g("/signals/warming"), "signals") ?? [];
5814
5851
  }
5815
5852
  async recomputeSignals() {
5816
- return unavailable("recomputeSignals");
5853
+ const r = await this.post("/signals/recompute");
5854
+ return { updated: Number(r?.updated ?? 0) };
5817
5855
  }
5818
- async getFreshnessScore() {
5819
- return unavailable("getFreshnessScore");
5856
+ async getFreshnessScore(contactId) {
5857
+ return pick(await this.g(`/freshness/${this.enc(contactId)}`), "freshness");
5820
5858
  }
5821
- async getStaleContacts() {
5822
- return unavailable("getStaleContacts");
5859
+ async getStaleContacts(threshold) {
5860
+ return pick(await this.g("/freshness/stale", { threshold }), "contacts") ?? [];
5823
5861
  }
5824
- async markFieldVerified() {
5825
- return unavailable("markFieldVerified");
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 unavailable("addOrgChartEdge");
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 unavailable("listOrgChart");
5868
+ async listOrgChart(companyId) {
5869
+ return pick(await this.g("/org-chart", { company_id: companyId }), "edges") ?? [];
5832
5870
  }
5833
- async setDealContactRole() {
5834
- return unavailable("setDealContactRole");
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 unavailable("getDealTeam");
5874
+ async getDealTeam(dealId) {
5875
+ return pick(await this.g(`/deals/${this.enc(dealId)}/team`), "team") ?? [];
5838
5876
  }
5839
- async getCoverageGaps() {
5840
- return unavailable("getCoverageGaps");
5877
+ async getCoverageGaps(companyId) {
5878
+ return pick(await this.g(`/org-chart/coverage/${this.enc(companyId)}`), "coverage");
5841
5879
  }
5842
- async getRecentContactEvents() {
5843
- return unavailable("getRecentContactEvents");
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 unavailable("createAudience");
5907
+ async createAudience(input) {
5908
+ return pick(await this.post("/audiences", input), "audience");
5871
5909
  }
5872
- async getAudience() {
5873
- return unavailable("getAudience");
5910
+ async getAudience(idOrSlug) {
5911
+ return pick(await this.g(`/audiences/${this.enc(idOrSlug)}`), "audience");
5874
5912
  }
5875
5913
  async listAudiences() {
5876
- return unavailable("listAudiences");
5914
+ return pick(await this.g("/audiences"), "audiences") ?? [];
5877
5915
  }
5878
- async updateAudience() {
5879
- return unavailable("updateAudience");
5916
+ async updateAudience(idOrSlug, input) {
5917
+ return pick(await this.patch(`/audiences/${this.enc(idOrSlug)}`, input), "audience");
5880
5918
  }
5881
- async deleteAudience() {
5882
- return unavailable("deleteAudience");
5919
+ async deleteAudience(idOrSlug) {
5920
+ await this.del(`/audiences/${this.enc(idOrSlug)}`);
5883
5921
  }
5884
- async resolveAudience() {
5885
- return unavailable("resolveAudience");
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 unavailable("setContactConsent");
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 unavailable("listContactConsent");
5928
+ async listContactConsent(contactId) {
5929
+ return pick(await this.g("/consent", { contact_id: contactId }), "consent") ?? [];
5892
5930
  }
5893
- async suppressAddress() {
5894
- return unavailable("suppressAddress");
5931
+ async suppressAddress(input) {
5932
+ return pick(await this.post("/suppressions", input), "suppression");
5895
5933
  }
5896
- async unsuppressAddress() {
5897
- return unavailable("unsuppressAddress");
5934
+ async unsuppressAddress(channel, address) {
5935
+ await this.del("/suppressions", { channel, address });
5898
5936
  }
5899
- async listSuppressions() {
5900
- return unavailable("listSuppressions");
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
- return unavailable("generateBrief");
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 unavailable("getContactCard");
5947
+ async getContactCard(contactId) {
5948
+ return pick(await this.g(`/contacts/${this.enc(contactId)}/card`), "card");
5910
5949
  }
5911
- async getContactBrief() {
5912
- return unavailable("getContactBrief");
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 unavailable("assembleContext");
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 unavailable("getUpcomingItems");
5956
+ async getUpcomingItems(days) {
5957
+ return pick(await this.g("/upcoming", { days }), "items") ?? [];
5919
5958
  }
5920
5959
  async getNetworkStats() {
5921
- return unavailable("getNetworkStats");
5960
+ return pick(await this.g("/network-stats"), "stats");
5922
5961
  }
5923
5962
  async listContactAudit() {
5924
- return unavailable("listContactAudit");
5963
+ return pick(await this.g("/contact-audit"), "audit") ?? [];
5925
5964
  }
5926
- async getContactTimeline() {
5927
- return unavailable("getContactTimeline");
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 unavailable("isVaultInitialized");
5996
+ return false;
5958
5997
  }
5959
5998
  async isVaultUnlocked() {
5960
- return unavailable("isVaultUnlocked");
5999
+ return false;
5961
6000
  }
5962
6001
  async vaultStatus() {
5963
- return unavailable("vaultStatus");
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 unavailable("listActiveWebhooks");
6011
+ return [];
5973
6012
  }
5974
6013
  }
5975
6014
  var cached;