@hasna/contacts 0.6.34 → 0.6.35

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.
Files changed (212) hide show
  1. package/dashboard/dist/assets/index-0l6aQb1t.css +1 -0
  2. package/dashboard/dist/assets/index-opnZdkVD.js +229 -0
  3. package/dashboard/dist/index.html +13 -0
  4. package/dist/cli/commands/advanced.d.ts +3 -0
  5. package/dist/cli/commands/advanced.d.ts.map +1 -0
  6. package/dist/cli/commands/audience.d.ts +18 -0
  7. package/dist/cli/commands/audience.d.ts.map +1 -0
  8. package/dist/cli/commands/core.d.ts +3 -0
  9. package/dist/cli/commands/core.d.ts.map +1 -0
  10. package/dist/cli/commands/crm.d.ts +3 -0
  11. package/dist/cli/commands/crm.d.ts.map +1 -0
  12. package/dist/cli/index.d.ts +3 -0
  13. package/dist/cli/index.d.ts.map +1 -0
  14. package/dist/cli/index.js +1060 -46
  15. package/dist/cli/storage.d.ts +3 -0
  16. package/dist/cli/storage.d.ts.map +1 -0
  17. package/dist/cli/utils.d.ts +10 -0
  18. package/dist/cli/utils.d.ts.map +1 -0
  19. package/dist/cloud/http-storage.d.ts +88 -0
  20. package/dist/cloud/http-storage.d.ts.map +1 -0
  21. package/dist/db/activity.d.ts +15 -0
  22. package/dist/db/activity.d.ts.map +1 -0
  23. package/dist/db/applications.d.ts +10 -0
  24. package/dist/db/applications.d.ts.map +1 -0
  25. package/dist/db/audiences.d.ts +51 -0
  26. package/dist/db/audiences.d.ts.map +1 -0
  27. package/dist/db/companies.d.ts +19 -0
  28. package/dist/db/companies.d.ts.map +1 -0
  29. package/dist/db/contact-tasks.d.ts +19 -0
  30. package/dist/db/contact-tasks.d.ts.map +1 -0
  31. package/dist/db/contacts.d.ts +30 -0
  32. package/dist/db/contacts.d.ts.map +1 -0
  33. package/dist/db/coordination.d.ts +30 -0
  34. package/dist/db/coordination.d.ts.map +1 -0
  35. package/dist/db/database.d.ts +8 -0
  36. package/dist/db/database.d.ts.map +1 -0
  37. package/dist/db/deals.d.ts +14 -0
  38. package/dist/db/deals.d.ts.map +1 -0
  39. package/dist/db/documents.d.ts +38 -0
  40. package/dist/db/documents.d.ts.map +1 -0
  41. package/dist/db/events.d.ts +14 -0
  42. package/dist/db/events.d.ts.map +1 -0
  43. package/dist/db/field-history.d.ts +17 -0
  44. package/dist/db/field-history.d.ts.map +1 -0
  45. package/dist/db/freshness.d.ts +24 -0
  46. package/dist/db/freshness.d.ts.map +1 -0
  47. package/dist/db/graph.d.ts +21 -0
  48. package/dist/db/graph.d.ts.map +1 -0
  49. package/dist/db/groups.d.ts +22 -0
  50. package/dist/db/groups.d.ts.map +1 -0
  51. package/dist/db/health.d.ts +40 -0
  52. package/dist/db/health.d.ts.map +1 -0
  53. package/dist/db/identity.d.ts +32 -0
  54. package/dist/db/identity.d.ts.map +1 -0
  55. package/dist/db/job-history.d.ts +29 -0
  56. package/dist/db/job-history.d.ts.map +1 -0
  57. package/dist/db/learnings.d.ts +43 -0
  58. package/dist/db/learnings.d.ts.map +1 -0
  59. package/dist/db/notes.d.ts +8 -0
  60. package/dist/db/notes.d.ts.map +1 -0
  61. package/dist/db/org-chart.d.ts +37 -0
  62. package/dist/db/org-chart.d.ts.map +1 -0
  63. package/dist/db/org-members.d.ts +9 -0
  64. package/dist/db/org-members.d.ts.map +1 -0
  65. package/dist/db/paths.d.ts +3 -0
  66. package/dist/db/paths.d.ts.map +1 -0
  67. package/dist/db/pg-migrations.d.ts +8 -0
  68. package/dist/db/pg-migrations.d.ts.map +1 -0
  69. package/dist/db/project-memberships.d.ts +8 -0
  70. package/dist/db/project-memberships.d.ts.map +1 -0
  71. package/dist/db/relationships.d.ts +30 -0
  72. package/dist/db/relationships.d.ts.map +1 -0
  73. package/dist/db/signals.d.ts +18 -0
  74. package/dist/db/signals.d.ts.map +1 -0
  75. package/dist/db/sqlite-adapter.d.ts +15 -0
  76. package/dist/db/sqlite-adapter.d.ts.map +1 -0
  77. package/dist/db/storage.d.ts +15 -0
  78. package/dist/db/storage.d.ts.map +1 -0
  79. package/dist/db/tags.d.ts +14 -0
  80. package/dist/db/tags.d.ts.map +1 -0
  81. package/dist/db/tombstones.d.ts +19 -0
  82. package/dist/db/tombstones.d.ts.map +1 -0
  83. package/dist/db/vendor-comms.d.ts +15 -0
  84. package/dist/db/vendor-comms.d.ts.map +1 -0
  85. package/dist/generated/storage-kit/health.d.ts +20 -0
  86. package/dist/generated/storage-kit/health.d.ts.map +1 -0
  87. package/dist/generated/storage-kit/index.d.ts +8 -0
  88. package/dist/generated/storage-kit/index.d.ts.map +1 -0
  89. package/dist/generated/storage-kit/migrations.d.ts +48 -0
  90. package/dist/generated/storage-kit/migrations.d.ts.map +1 -0
  91. package/dist/generated/storage-kit/mode.d.ts +48 -0
  92. package/dist/generated/storage-kit/mode.d.ts.map +1 -0
  93. package/dist/generated/storage-kit/pool.d.ts +34 -0
  94. package/dist/generated/storage-kit/pool.d.ts.map +1 -0
  95. package/dist/generated/storage-kit/query.d.ts +36 -0
  96. package/dist/generated/storage-kit/query.d.ts.map +1 -0
  97. package/dist/generated/storage-kit/tls.d.ts +26 -0
  98. package/dist/generated/storage-kit/tls.d.ts.map +1 -0
  99. package/dist/index.d.ts +9 -0
  100. package/dist/index.d.ts.map +1 -0
  101. package/dist/index.js +613 -23
  102. package/dist/lib/apple-contacts.d.ts +3 -0
  103. package/dist/lib/apple-contacts.d.ts.map +1 -0
  104. package/dist/lib/audience-contract.d.ts +215 -0
  105. package/dist/lib/audience-contract.d.ts.map +1 -0
  106. package/dist/lib/audit.d.ts +12 -0
  107. package/dist/lib/audit.d.ts.map +1 -0
  108. package/dist/lib/brief.d.ts +3 -0
  109. package/dist/lib/brief.d.ts.map +1 -0
  110. package/dist/lib/config.d.ts +7 -0
  111. package/dist/lib/config.d.ts.map +1 -0
  112. package/dist/lib/connector.d.ts +44 -0
  113. package/dist/lib/connector.d.ts.map +1 -0
  114. package/dist/lib/context.d.ts +5 -0
  115. package/dist/lib/context.d.ts.map +1 -0
  116. package/dist/lib/dedup.d.ts +10 -0
  117. package/dist/lib/dedup.d.ts.map +1 -0
  118. package/dist/lib/document-scanner.d.ts +8 -0
  119. package/dist/lib/document-scanner.d.ts.map +1 -0
  120. package/dist/lib/embeddings.d.ts +9 -0
  121. package/dist/lib/embeddings.d.ts.map +1 -0
  122. package/dist/lib/export.d.ts +8 -0
  123. package/dist/lib/export.d.ts.map +1 -0
  124. package/dist/lib/freshness.d.ts +19 -0
  125. package/dist/lib/freshness.d.ts.map +1 -0
  126. package/dist/lib/gmail-import.d.ts +51 -0
  127. package/dist/lib/gmail-import.d.ts.map +1 -0
  128. package/dist/lib/google-contacts.d.ts +115 -0
  129. package/dist/lib/google-contacts.d.ts.map +1 -0
  130. package/dist/lib/images.d.ts +30 -0
  131. package/dist/lib/images.d.ts.map +1 -0
  132. package/dist/lib/import.d.ts +10 -0
  133. package/dist/lib/import.d.ts.map +1 -0
  134. package/dist/lib/learning-maintenance.d.ts +8 -0
  135. package/dist/lib/learning-maintenance.d.ts.map +1 -0
  136. package/dist/lib/mailery-sync.d.ts +46 -0
  137. package/dist/lib/mailery-sync.d.ts.map +1 -0
  138. package/dist/lib/meeting-capture.d.ts +15 -0
  139. package/dist/lib/meeting-capture.d.ts.map +1 -0
  140. package/dist/lib/package-version.d.ts +6 -0
  141. package/dist/lib/package-version.d.ts.map +1 -0
  142. package/dist/lib/signals.d.ts +9 -0
  143. package/dist/lib/signals.d.ts.map +1 -0
  144. package/dist/lib/signature-parser.d.ts +36 -0
  145. package/dist/lib/signature-parser.d.ts.map +1 -0
  146. package/dist/lib/stats.d.ts +24 -0
  147. package/dist/lib/stats.d.ts.map +1 -0
  148. package/dist/lib/timeline.d.ts +11 -0
  149. package/dist/lib/timeline.d.ts.map +1 -0
  150. package/dist/lib/upcoming.d.ts +14 -0
  151. package/dist/lib/upcoming.d.ts.map +1 -0
  152. package/dist/lib/vault.d.ts +24 -0
  153. package/dist/lib/vault.d.ts.map +1 -0
  154. package/dist/mcp/handlers/advanced.d.ts +14 -0
  155. package/dist/mcp/handlers/advanced.d.ts.map +1 -0
  156. package/dist/mcp/handlers/audience.d.ts +9 -0
  157. package/dist/mcp/handlers/audience.d.ts.map +1 -0
  158. package/dist/mcp/handlers/core.d.ts +10 -0
  159. package/dist/mcp/handlers/core.d.ts.map +1 -0
  160. package/dist/mcp/handlers/crm.d.ts +14 -0
  161. package/dist/mcp/handlers/crm.d.ts.map +1 -0
  162. package/dist/mcp/handlers/index.d.ts +4 -0
  163. package/dist/mcp/handlers/index.d.ts.map +1 -0
  164. package/dist/mcp/handlers/types.d.ts +10 -0
  165. package/dist/mcp/handlers/types.d.ts.map +1 -0
  166. package/dist/mcp/http.d.ts +17 -0
  167. package/dist/mcp/http.d.ts.map +1 -0
  168. package/dist/mcp/index.d.ts +5 -0
  169. package/dist/mcp/index.d.ts.map +1 -0
  170. package/dist/mcp/index.js +339 -27
  171. package/dist/mcp/register-tools.d.ts +3 -0
  172. package/dist/mcp/register-tools.d.ts.map +1 -0
  173. package/dist/mcp/schema.d.ts +3 -0
  174. package/dist/mcp/schema.d.ts.map +1 -0
  175. package/dist/mcp/storage-tools.d.ts +3 -0
  176. package/dist/mcp/storage-tools.d.ts.map +1 -0
  177. package/dist/mcp/tools.d.ts +3799 -0
  178. package/dist/mcp/tools.d.ts.map +1 -0
  179. package/dist/sdk/index.d.ts +16 -0
  180. package/dist/sdk/index.d.ts.map +1 -0
  181. package/dist/sdk/index.js +63 -0
  182. package/dist/sdk/v1.generated.d.ts +270 -0
  183. package/dist/sdk/v1.generated.d.ts.map +1 -0
  184. package/dist/server/cloud-index.d.ts +3 -0
  185. package/dist/server/cloud-index.d.ts.map +1 -0
  186. package/dist/server/cloud-serve.d.ts +3 -0
  187. package/dist/server/cloud-serve.d.ts.map +1 -0
  188. package/dist/server/cloud.d.ts +53 -0
  189. package/dist/server/cloud.d.ts.map +1 -0
  190. package/dist/server/index.d.ts +3 -0
  191. package/dist/server/index.d.ts.map +1 -0
  192. package/dist/server/index.js +1022 -46
  193. package/dist/server/openapi.d.ts +1134 -0
  194. package/dist/server/openapi.d.ts.map +1 -0
  195. package/dist/server/pg-store.d.ts +893 -0
  196. package/dist/server/pg-store.d.ts.map +1 -0
  197. package/dist/server/security.d.ts +24 -0
  198. package/dist/server/security.d.ts.map +1 -0
  199. package/dist/server/serve.d.ts +9 -0
  200. package/dist/server/serve.d.ts.map +1 -0
  201. package/dist/server/v1.d.ts +28 -0
  202. package/dist/server/v1.d.ts.map +1 -0
  203. package/dist/store/index.d.ts +387 -0
  204. package/dist/store/index.d.ts.map +1 -0
  205. package/dist/types/index.d.ts +856 -0
  206. package/dist/types/index.d.ts.map +1 -0
  207. package/dist/types/project-memberships.d.ts +32 -0
  208. package/dist/types/project-memberships.d.ts.map +1 -0
  209. package/migrations/0015_contact_project_membership_authority.sql +88 -0
  210. package/package.json +1 -1
  211. package/vendor/fast-uri/README.md +12 -0
  212. package/dist/server/cloud-index.js +0 -9187
@@ -0,0 +1,893 @@
1
+ import type { PoolQueryClient } from "../generated/storage-kit/query.js";
2
+ import type { Company, Contact, CreateCompanyInput, CreateContactInput, CreateTagInput, Email, Phone, Tag, UpdateCompanyInput, UpdateContactInput, UpdateTagInput } from "../types/index.js";
3
+ import type { ContactProjectMembershipListResult, ContactProjectMembershipMutationDirection, ContactProjectMembershipMutationInput, ContactProjectMembershipMutationResult, ContactProjectMembershipSnapshot } from "../types/project-memberships.js";
4
+ /**
5
+ * Contact read responses carry their child collections, matching what the
6
+ * on-box SQLite store returns from `loadContactDetails`. The ApiStore is typed
7
+ * against the SQLite return shape, so omitting these here is a silent parity
8
+ * break rather than a smaller-but-valid response.
9
+ */
10
+ export type ContactWithMethods = Contact & {
11
+ tags: Tag[];
12
+ emails: Email[];
13
+ phones: Phone[];
14
+ };
15
+ export interface ContactListFilter {
16
+ limit?: number;
17
+ offset?: number;
18
+ company_id?: string;
19
+ status?: string;
20
+ tag_id?: string;
21
+ q?: string;
22
+ }
23
+ export interface CompanyListFilter {
24
+ limit?: number;
25
+ offset?: number;
26
+ industry?: string;
27
+ }
28
+ export declare class ContactsPgStore {
29
+ private readonly client;
30
+ constructor(client: PoolQueryClient);
31
+ /** Attach cloud tag memberships in one query for contact read responses. */
32
+ private attachTags;
33
+ /**
34
+ * Attach email/phone child rows in TWO batched queries regardless of how many
35
+ * contacts are passed. `loadDetails` below queries per contact, which is
36
+ * correct for a single row and an N+1 on a list or an export — this is the
37
+ * list-safe counterpart, shaped like `attachTags` above.
38
+ */
39
+ private attachContactMethods;
40
+ /** The single readback contract for every contact-returning v1 path. */
41
+ private attachContactDetails;
42
+ /**
43
+ * Append emails/phones, skipping duplicates the way the SQLite store does —
44
+ * case-insensitively on address, exactly on number. `WHERE NOT EXISTS` keeps
45
+ * the check and the insert in one statement so two concurrent appends of the
46
+ * same address cannot both pass a separate existence check.
47
+ */
48
+ private insertContactMethods;
49
+ listContacts(filter?: ContactListFilter): Promise<{
50
+ contacts: ContactWithMethods[];
51
+ count: number;
52
+ }>;
53
+ getContact(id: string): Promise<ContactWithMethods | null>;
54
+ createContact(input: CreateContactInput): Promise<ContactWithMethods>;
55
+ updateContact(id: string, input: UpdateContactInput): Promise<ContactWithMethods | null>;
56
+ deleteContact(id: string): Promise<boolean>;
57
+ linkContactToProject(contactId: string, projectId: string): Promise<void>;
58
+ unlinkContactFromProject(contactId: string, projectId: string): Promise<boolean>;
59
+ getContactProjectIds(contactId: string): Promise<string[]>;
60
+ setContactProjects(contactId: string, projectIds: string[]): Promise<string[]>;
61
+ listContactIdsByProject(projectId: string): Promise<string[]>;
62
+ private contactProjectMembershipState;
63
+ private transitionContactProjectMembershipWithoutReceipt;
64
+ readContactProjectMembership(contactId: string, projectId: string): Promise<ContactProjectMembershipSnapshot>;
65
+ listContactProjectMemberships(projectId: string, maxItems: number): Promise<ContactProjectMembershipListResult>;
66
+ mutateContactProjectMembership(direction: ContactProjectMembershipMutationDirection, rawInput: ContactProjectMembershipMutationInput): Promise<ContactProjectMembershipMutationResult>;
67
+ listCompanies(filter?: CompanyListFilter): Promise<{
68
+ companies: Company[];
69
+ count: number;
70
+ }>;
71
+ getCompany(id: string): Promise<Company | null>;
72
+ createCompany(input: CreateCompanyInput): Promise<Company>;
73
+ updateCompany(id: string, input: UpdateCompanyInput): Promise<Company | null>;
74
+ deleteCompany(id: string): Promise<boolean>;
75
+ listTags(): Promise<Tag[]>;
76
+ getTag(id: string): Promise<Tag | null>;
77
+ getTagByName(name: string): Promise<Tag | null>;
78
+ createTag(input: CreateTagInput): Promise<Tag>;
79
+ updateTag(id: string, input: UpdateTagInput): Promise<Tag | null>;
80
+ deleteTag(id: string): Promise<boolean>;
81
+ addTagToContact(contactId: string, tagId: string): Promise<void>;
82
+ removeTagFromContact(contactId: string, tagId: string): Promise<boolean>;
83
+ stats(): Promise<{
84
+ contacts: number;
85
+ companies: number;
86
+ tags: number;
87
+ }>;
88
+ private loadDetails;
89
+ searchContacts(q: string): Promise<Record<string, unknown>[]>;
90
+ listColdContacts(days: number): Promise<Record<string, unknown>[]>;
91
+ listContactsNotContactedSince(days: number, limit: number): Promise<Array<{
92
+ id: string;
93
+ display_name: string;
94
+ last_contacted_at: string | null;
95
+ }>>;
96
+ listFollowupDueContacts(onOrBefore: string): Promise<Array<{
97
+ id: string;
98
+ display_name: string;
99
+ follow_up_at: string;
100
+ }>>;
101
+ findContactsForContext(topic: string, limit: number): Promise<Array<{
102
+ id: string;
103
+ display_name: string;
104
+ job_title: string | null;
105
+ reason: string;
106
+ }>>;
107
+ findEmailDuplicates(): Promise<Array<{
108
+ email: string;
109
+ contact_ids: string[];
110
+ }>>;
111
+ findNameDuplicates(): Promise<Array<{
112
+ contact_ids: [string, string];
113
+ similarity: number;
114
+ }>>;
115
+ getRecentContactEvents(since?: string, eventTypes?: string[]): Promise<Record<string, unknown>[]>;
116
+ private mapDeal;
117
+ createDeal(input: Record<string, unknown>): Promise<{
118
+ id: unknown;
119
+ title: unknown;
120
+ contact_id: unknown;
121
+ company_id: unknown;
122
+ stage: unknown;
123
+ value_usd: unknown;
124
+ currency: unknown;
125
+ close_date: unknown;
126
+ notes: unknown;
127
+ created_at: string;
128
+ updated_at: string;
129
+ }>;
130
+ getDeal(id: string): Promise<{
131
+ id: unknown;
132
+ title: unknown;
133
+ contact_id: unknown;
134
+ company_id: unknown;
135
+ stage: unknown;
136
+ value_usd: unknown;
137
+ currency: unknown;
138
+ close_date: unknown;
139
+ notes: unknown;
140
+ created_at: string;
141
+ updated_at: string;
142
+ } | null>;
143
+ listDeals(opts?: {
144
+ stage?: string;
145
+ contact_id?: string;
146
+ company_id?: string;
147
+ }): Promise<{
148
+ id: unknown;
149
+ title: unknown;
150
+ contact_id: unknown;
151
+ company_id: unknown;
152
+ stage: unknown;
153
+ value_usd: unknown;
154
+ currency: unknown;
155
+ close_date: unknown;
156
+ notes: unknown;
157
+ created_at: string;
158
+ updated_at: string;
159
+ }[]>;
160
+ updateDeal(id: string, input: Record<string, unknown>): Promise<{
161
+ id: unknown;
162
+ title: unknown;
163
+ contact_id: unknown;
164
+ company_id: unknown;
165
+ stage: unknown;
166
+ value_usd: unknown;
167
+ currency: unknown;
168
+ close_date: unknown;
169
+ notes: unknown;
170
+ created_at: string;
171
+ updated_at: string;
172
+ } | null>;
173
+ deleteDeal(id: string): Promise<boolean>;
174
+ private mapEvent;
175
+ logEvent(input: Record<string, unknown>): Promise<{
176
+ id: unknown;
177
+ title: unknown;
178
+ type: unknown;
179
+ event_date: unknown;
180
+ duration_min: unknown;
181
+ contact_ids: string[];
182
+ company_id: unknown;
183
+ notes: unknown;
184
+ outcome: unknown;
185
+ deal_id: unknown;
186
+ created_at: string;
187
+ }>;
188
+ listEvents(opts?: {
189
+ contact_id?: string;
190
+ company_id?: string;
191
+ type?: string;
192
+ date_from?: string;
193
+ date_to?: string;
194
+ }): Promise<{
195
+ id: unknown;
196
+ title: unknown;
197
+ type: unknown;
198
+ event_date: unknown;
199
+ duration_min: unknown;
200
+ contact_ids: string[];
201
+ company_id: unknown;
202
+ notes: unknown;
203
+ outcome: unknown;
204
+ deal_id: unknown;
205
+ created_at: string;
206
+ }[]>;
207
+ deleteEvent(id: string): Promise<boolean>;
208
+ private mapTask;
209
+ createContactTask(input: Record<string, unknown>): Promise<{
210
+ id: unknown;
211
+ title: unknown;
212
+ description: unknown;
213
+ contact_id: unknown;
214
+ assigned_by: unknown;
215
+ deadline: unknown;
216
+ status: unknown;
217
+ priority: unknown;
218
+ entity_id: unknown;
219
+ linked_todos_task_id: unknown;
220
+ escalation_rules: unknown[];
221
+ created_at: string;
222
+ updated_at: string;
223
+ }>;
224
+ listContactTasks(opts?: {
225
+ contact_id?: string;
226
+ entity_id?: string;
227
+ status?: string;
228
+ priority?: string;
229
+ }): Promise<{
230
+ id: unknown;
231
+ title: unknown;
232
+ description: unknown;
233
+ contact_id: unknown;
234
+ assigned_by: unknown;
235
+ deadline: unknown;
236
+ status: unknown;
237
+ priority: unknown;
238
+ entity_id: unknown;
239
+ linked_todos_task_id: unknown;
240
+ escalation_rules: unknown[];
241
+ created_at: string;
242
+ updated_at: string;
243
+ }[]>;
244
+ updateContactTask(id: string, input: Record<string, unknown>): Promise<{
245
+ id: unknown;
246
+ title: unknown;
247
+ description: unknown;
248
+ contact_id: unknown;
249
+ assigned_by: unknown;
250
+ deadline: unknown;
251
+ status: unknown;
252
+ priority: unknown;
253
+ entity_id: unknown;
254
+ linked_todos_task_id: unknown;
255
+ escalation_rules: unknown[];
256
+ created_at: string;
257
+ updated_at: string;
258
+ } | null>;
259
+ deleteContactTask(id: string): Promise<boolean>;
260
+ listOverdueTasks(): Promise<{
261
+ id: unknown;
262
+ title: unknown;
263
+ description: unknown;
264
+ contact_id: unknown;
265
+ assigned_by: unknown;
266
+ deadline: unknown;
267
+ status: unknown;
268
+ priority: unknown;
269
+ entity_id: unknown;
270
+ linked_todos_task_id: unknown;
271
+ escalation_rules: unknown[];
272
+ created_at: string;
273
+ updated_at: string;
274
+ }[]>;
275
+ checkEscalations(): Promise<{
276
+ task: Record<string, unknown>;
277
+ rules_triggered: Array<{
278
+ after_days: number;
279
+ }>;
280
+ }[]>;
281
+ private mapApplication;
282
+ createApplication(input: Record<string, unknown>): Promise<{
283
+ id: unknown;
284
+ program_name: unknown;
285
+ provider_company_id: unknown;
286
+ type: unknown;
287
+ value_usd: unknown;
288
+ applicant_contact_id: unknown;
289
+ primary_contact_id: unknown;
290
+ status: unknown;
291
+ submitted_date: unknown;
292
+ decision_date: unknown;
293
+ follow_up_date: unknown;
294
+ notes: unknown;
295
+ method: {} | null;
296
+ form_url: unknown;
297
+ metadata: Record<string, unknown>;
298
+ created_at: string;
299
+ updated_at: string;
300
+ }>;
301
+ listApplications(opts?: {
302
+ type?: string;
303
+ status?: string;
304
+ provider_company_id?: string;
305
+ applicant_contact_id?: string;
306
+ }): Promise<{
307
+ id: unknown;
308
+ program_name: unknown;
309
+ provider_company_id: unknown;
310
+ type: unknown;
311
+ value_usd: unknown;
312
+ applicant_contact_id: unknown;
313
+ primary_contact_id: unknown;
314
+ status: unknown;
315
+ submitted_date: unknown;
316
+ decision_date: unknown;
317
+ follow_up_date: unknown;
318
+ notes: unknown;
319
+ method: {} | null;
320
+ form_url: unknown;
321
+ metadata: Record<string, unknown>;
322
+ created_at: string;
323
+ updated_at: string;
324
+ }[]>;
325
+ updateApplication(id: string, input: Record<string, unknown>): Promise<{
326
+ id: unknown;
327
+ program_name: unknown;
328
+ provider_company_id: unknown;
329
+ type: unknown;
330
+ value_usd: unknown;
331
+ applicant_contact_id: unknown;
332
+ primary_contact_id: unknown;
333
+ status: unknown;
334
+ submitted_date: unknown;
335
+ decision_date: unknown;
336
+ follow_up_date: unknown;
337
+ notes: unknown;
338
+ method: {} | null;
339
+ form_url: unknown;
340
+ metadata: Record<string, unknown>;
341
+ created_at: string;
342
+ updated_at: string;
343
+ } | null>;
344
+ listFollowUpDueApplications(): Promise<{
345
+ id: unknown;
346
+ program_name: unknown;
347
+ provider_company_id: unknown;
348
+ type: unknown;
349
+ value_usd: unknown;
350
+ applicant_contact_id: unknown;
351
+ primary_contact_id: unknown;
352
+ status: unknown;
353
+ submitted_date: unknown;
354
+ decision_date: unknown;
355
+ follow_up_date: unknown;
356
+ notes: unknown;
357
+ method: {} | null;
358
+ form_url: unknown;
359
+ metadata: Record<string, unknown>;
360
+ created_at: string;
361
+ updated_at: string;
362
+ }[]>;
363
+ private mapGroup;
364
+ createGroup(input: Record<string, unknown>): Promise<{
365
+ created_at: string | null;
366
+ updated_at: string | null;
367
+ member_count: number | undefined;
368
+ company_count: number | undefined;
369
+ } | null>;
370
+ getGroup(id: string): Promise<{
371
+ created_at: string | null;
372
+ updated_at: string | null;
373
+ member_count: number | undefined;
374
+ company_count: number | undefined;
375
+ } | null>;
376
+ listGroups(projectId?: string): Promise<{
377
+ created_at: string | null;
378
+ updated_at: string | null;
379
+ member_count: number | undefined;
380
+ company_count: number | undefined;
381
+ }[]>;
382
+ updateGroup(id: string, input: Record<string, unknown>): Promise<{
383
+ created_at: string | null;
384
+ updated_at: string | null;
385
+ member_count: number | undefined;
386
+ company_count: number | undefined;
387
+ } | null>;
388
+ deleteGroup(id: string): Promise<boolean>;
389
+ addContactToGroup(contactId: string, groupId: string): Promise<{
390
+ added: boolean;
391
+ already_member: boolean;
392
+ }>;
393
+ removeContactFromGroup(contactId: string, groupId: string): Promise<void>;
394
+ listContactsInGroup(groupId: string): Promise<string[]>;
395
+ listGroupsForContact(contactId: string): Promise<{
396
+ created_at: string | null;
397
+ updated_at: string | null;
398
+ member_count: number | undefined;
399
+ company_count: number | undefined;
400
+ }[]>;
401
+ addCompanyToGroup(companyId: string, groupId: string): Promise<{
402
+ added: boolean;
403
+ already_member: boolean;
404
+ }>;
405
+ removeCompanyFromGroup(companyId: string, groupId: string): Promise<void>;
406
+ listCompaniesInGroup(groupId: string): Promise<string[]>;
407
+ listGroupsForCompany(companyId: string): Promise<{
408
+ created_at: string | null;
409
+ updated_at: string | null;
410
+ member_count: number | undefined;
411
+ company_count: number | undefined;
412
+ }[]>;
413
+ private mapVendorComm;
414
+ logVendorCommunication(input: Record<string, unknown>): Promise<{
415
+ id: unknown;
416
+ company_id: unknown;
417
+ contact_id: unknown;
418
+ comm_date: unknown;
419
+ type: unknown;
420
+ direction: unknown;
421
+ subject: unknown;
422
+ body: unknown;
423
+ status: unknown;
424
+ invoice_amount: unknown;
425
+ invoice_currency: unknown;
426
+ invoice_ref: unknown;
427
+ follow_up_date: unknown;
428
+ follow_up_done: boolean;
429
+ created_at: string;
430
+ }>;
431
+ listVendorCommunications(companyId: string, opts?: {
432
+ type?: string;
433
+ status?: string;
434
+ direction?: string;
435
+ }): Promise<{
436
+ id: unknown;
437
+ company_id: unknown;
438
+ contact_id: unknown;
439
+ comm_date: unknown;
440
+ type: unknown;
441
+ direction: unknown;
442
+ subject: unknown;
443
+ body: unknown;
444
+ status: unknown;
445
+ invoice_amount: unknown;
446
+ invoice_currency: unknown;
447
+ invoice_ref: unknown;
448
+ follow_up_date: unknown;
449
+ follow_up_done: boolean;
450
+ created_at: string;
451
+ }[]>;
452
+ listMissingInvoices(): Promise<{
453
+ id: unknown;
454
+ company_id: unknown;
455
+ contact_id: unknown;
456
+ comm_date: unknown;
457
+ type: unknown;
458
+ direction: unknown;
459
+ subject: unknown;
460
+ body: unknown;
461
+ status: unknown;
462
+ invoice_amount: unknown;
463
+ invoice_currency: unknown;
464
+ invoice_ref: unknown;
465
+ follow_up_date: unknown;
466
+ follow_up_done: boolean;
467
+ created_at: string;
468
+ }[]>;
469
+ listPendingFollowUps(): Promise<{
470
+ id: unknown;
471
+ company_id: unknown;
472
+ contact_id: unknown;
473
+ comm_date: unknown;
474
+ type: unknown;
475
+ direction: unknown;
476
+ subject: unknown;
477
+ body: unknown;
478
+ status: unknown;
479
+ invoice_amount: unknown;
480
+ invoice_currency: unknown;
481
+ invoice_ref: unknown;
482
+ follow_up_date: unknown;
483
+ follow_up_done: boolean;
484
+ created_at: string;
485
+ }[]>;
486
+ markFollowUpDone(id: string): Promise<{
487
+ id: unknown;
488
+ company_id: unknown;
489
+ contact_id: unknown;
490
+ comm_date: unknown;
491
+ type: unknown;
492
+ direction: unknown;
493
+ subject: unknown;
494
+ body: unknown;
495
+ status: unknown;
496
+ invoice_amount: unknown;
497
+ invoice_currency: unknown;
498
+ invoice_ref: unknown;
499
+ follow_up_date: unknown;
500
+ follow_up_done: boolean;
501
+ created_at: string;
502
+ } | null>;
503
+ private mapOrgMember;
504
+ addOrgMember(input: Record<string, unknown>): Promise<{
505
+ id: unknown;
506
+ company_id: unknown;
507
+ contact_id: unknown;
508
+ title: unknown;
509
+ specialization: unknown;
510
+ office_phone: unknown;
511
+ response_sla_hours: unknown;
512
+ notes: unknown;
513
+ created_at: string;
514
+ updated_at: string;
515
+ }>;
516
+ listOrgMembers(companyId: string): Promise<{
517
+ id: unknown;
518
+ company_id: unknown;
519
+ contact_id: unknown;
520
+ title: unknown;
521
+ specialization: unknown;
522
+ office_phone: unknown;
523
+ response_sla_hours: unknown;
524
+ notes: unknown;
525
+ created_at: string;
526
+ updated_at: string;
527
+ }[]>;
528
+ updateOrgMember(id: string, input: Record<string, unknown>): Promise<{
529
+ id: unknown;
530
+ company_id: unknown;
531
+ contact_id: unknown;
532
+ title: unknown;
533
+ specialization: unknown;
534
+ office_phone: unknown;
535
+ response_sla_hours: unknown;
536
+ notes: unknown;
537
+ created_at: string;
538
+ updated_at: string;
539
+ } | null>;
540
+ removeOrgMember(id: string): Promise<boolean>;
541
+ listOrgMembersForContact(contactId: string): Promise<{
542
+ id: unknown;
543
+ company_id: unknown;
544
+ contact_id: unknown;
545
+ title: unknown;
546
+ specialization: unknown;
547
+ office_phone: unknown;
548
+ response_sla_hours: unknown;
549
+ notes: unknown;
550
+ created_at: string;
551
+ updated_at: string;
552
+ }[]>;
553
+ private mapNote;
554
+ addNote(contactId: string, body: string, createdBy?: string, companyId?: string): Promise<Record<string, unknown>>;
555
+ listNotes(contactId: string): Promise<Record<string, unknown>[]>;
556
+ listNotesForContactAtCompany(contactId: string, companyId: string): Promise<Record<string, unknown>[]>;
557
+ deleteNote(noteId: string): Promise<void>;
558
+ createRelationship(input: Record<string, unknown>): Promise<{
559
+ created_at: string | null;
560
+ }>;
561
+ listRelationships(opts?: {
562
+ contact_id?: string;
563
+ }): Promise<Record<string, unknown>[]>;
564
+ deleteRelationship(id: string): Promise<void>;
565
+ createCompanyRelationship(input: Record<string, unknown>): Promise<{
566
+ created_at: string | null;
567
+ is_primary: boolean;
568
+ }>;
569
+ listCompanyRelationships(opts?: {
570
+ contact_id?: string;
571
+ company_id?: string;
572
+ }): Promise<Record<string, unknown>[]>;
573
+ deleteCompanyRelationship(id: string): Promise<void>;
574
+ getFieldHistory(contactId: string, fieldName?: string): Promise<{
575
+ valid_from: string | null;
576
+ created_at: string | null;
577
+ }[]>;
578
+ getContactAt(contactId: string, timestamp: string): Promise<Record<string, string>>;
579
+ private mapJob;
580
+ addJobEntry(contactId: string, input: Record<string, unknown>): Promise<{
581
+ is_current: boolean;
582
+ inferred: boolean;
583
+ created_at: string | null;
584
+ }>;
585
+ getJobHistory(contactId: string): Promise<{
586
+ is_current: boolean;
587
+ inferred: boolean;
588
+ created_at: string | null;
589
+ }[]>;
590
+ private mapLearning;
591
+ saveLearning(contactId: string, input: Record<string, unknown>): Promise<Record<string, unknown>>;
592
+ getLearnings(contactId: string, opts?: {
593
+ type?: string;
594
+ min_importance?: number;
595
+ visibility?: string;
596
+ }): Promise<Record<string, unknown>[]>;
597
+ searchLearnings(query: string, opts?: {
598
+ type?: string;
599
+ contact_id?: string;
600
+ }): Promise<Record<string, unknown>[]>;
601
+ confirmLearning(learningId: string): Promise<void>;
602
+ getStaleLearnings(daysOld: number, minConfidence: number): Promise<Record<string, unknown>[]>;
603
+ runLearningMaintenance(): Promise<{
604
+ decayed_count: number;
605
+ potential_contradictions: Record<string, unknown>[];
606
+ }>;
607
+ private mapLock;
608
+ acquireContactLock(contactId: string, agentName: string, ttlSeconds?: number, reason?: string, sessionId?: string): Promise<{
609
+ acquired: boolean;
610
+ held_by: unknown;
611
+ lock: {
612
+ acquired_at: string | null;
613
+ expires_at: string | null;
614
+ };
615
+ } | {
616
+ acquired: boolean;
617
+ lock: {
618
+ acquired_at: string | null;
619
+ expires_at: string | null;
620
+ };
621
+ held_by?: undefined;
622
+ }>;
623
+ releaseContactLock(contactId: string, agentName: string): Promise<boolean>;
624
+ checkContactLock(contactId: string): Promise<{
625
+ acquired_at: string | null;
626
+ expires_at: string | null;
627
+ } | null>;
628
+ logAgentActivity(contactId: string, agentName: string, action: string, details?: string, sessionId?: string): Promise<void>;
629
+ getAgentActivity(contactId: string, limit?: number): Promise<{
630
+ created_at: string | null;
631
+ }[]>;
632
+ resolveContactIdentity(partial: {
633
+ name?: string;
634
+ email?: string;
635
+ phone?: string;
636
+ linkedin_url?: string;
637
+ }): Promise<{
638
+ contact: {
639
+ id: string;
640
+ display_name: string;
641
+ job_title?: string;
642
+ };
643
+ confidence_score: number;
644
+ match_reasons: string[];
645
+ }[]>;
646
+ addContactIdentity(contactId: string, system: string, externalId: string, externalUrl?: string, confidence?: "verified" | "inferred"): Promise<{
647
+ created_at: string | null;
648
+ }>;
649
+ getContactIdentities(contactId: string): Promise<{
650
+ created_at: string | null;
651
+ }[]>;
652
+ private signalRow;
653
+ getRelationshipSignals(contactId: string): Promise<{
654
+ signal_type: string;
655
+ reason: string;
656
+ contact_id: unknown;
657
+ display_name: unknown;
658
+ last_contacted_at: string | null;
659
+ interaction_count_30d: number;
660
+ engagement_status: {} | null;
661
+ relationship_health: {} | null;
662
+ days_since_contact: number | null;
663
+ }[]>;
664
+ getGhostContacts(): Promise<{
665
+ signal_type: string;
666
+ reason: string;
667
+ contact_id: unknown;
668
+ display_name: unknown;
669
+ last_contacted_at: string | null;
670
+ interaction_count_30d: number;
671
+ engagement_status: {} | null;
672
+ relationship_health: {} | null;
673
+ days_since_contact: number | null;
674
+ }[]>;
675
+ getWarmingContacts(): Promise<{
676
+ signal_type: string;
677
+ reason: string;
678
+ contact_id: unknown;
679
+ display_name: unknown;
680
+ last_contacted_at: string | null;
681
+ interaction_count_30d: number;
682
+ engagement_status: {} | null;
683
+ relationship_health: {} | null;
684
+ days_since_contact: number | null;
685
+ }[]>;
686
+ recomputeSignals(): Promise<{
687
+ updated: number;
688
+ }>;
689
+ getFreshnessScore(contactId: string): Promise<{
690
+ contact_id: string;
691
+ overall_score: number;
692
+ fields: {
693
+ field_name: string;
694
+ value: string | null;
695
+ last_verified_at: string | null;
696
+ source: string | null;
697
+ confidence: string;
698
+ days_old: number | null;
699
+ }[];
700
+ stale_fields: string[];
701
+ verified_fields: string[];
702
+ }>;
703
+ getStaleContacts(threshold?: number): Promise<{
704
+ contact_id: string;
705
+ display_name: string;
706
+ score: number;
707
+ }[]>;
708
+ markFieldVerified(contactId: string, fieldName: string, source?: string): Promise<void>;
709
+ computeRelationshipStrength(contactId: string): Promise<number>;
710
+ findWarmPath(fromContactId: string, toContactId: string): Promise<{
711
+ contact_id: string;
712
+ display_name: string;
713
+ strength: number;
714
+ }[]>;
715
+ findConnectionsAtCompany(companyId: string): Promise<{
716
+ contact_id: string;
717
+ display_name: string;
718
+ job_title?: string;
719
+ strength: number;
720
+ }[]>;
721
+ detectCoolingRelationships(): Promise<{
722
+ contact_id: string;
723
+ display_name: string;
724
+ days_since: number;
725
+ }[]>;
726
+ addOrgChartEdge(companyId: string, contactAId: string, contactBId: string, edgeType: string, inferred?: boolean): Promise<{
727
+ inferred: boolean;
728
+ created_at: string | null;
729
+ }>;
730
+ listOrgChart(companyId: string): Promise<{
731
+ contact_a_name: string;
732
+ contact_b_name: string;
733
+ edge_type: string;
734
+ }[]>;
735
+ setDealContactRole(dealId: string, contactId: string, accountRole: string): Promise<{
736
+ created_at: string | null;
737
+ }>;
738
+ getDealTeam(dealId: string): Promise<{
739
+ display_name: string;
740
+ account_role: string;
741
+ job_title?: string;
742
+ }[]>;
743
+ getCoverageGaps(companyId: string): Promise<{
744
+ covered: string[];
745
+ missing_key_roles: string[];
746
+ }>;
747
+ private mapAudience;
748
+ createAudience(input: Record<string, unknown>): Promise<{
749
+ id: unknown;
750
+ audience_id: unknown;
751
+ name: unknown;
752
+ match: unknown;
753
+ predicates: unknown[];
754
+ consent_policy: unknown;
755
+ suppression_synced_at: string | null;
756
+ created_at: string | null;
757
+ updated_at: string | null;
758
+ }>;
759
+ getAudience(idOrSlug: string): Promise<{
760
+ id: unknown;
761
+ audience_id: unknown;
762
+ name: unknown;
763
+ match: unknown;
764
+ predicates: unknown[];
765
+ consent_policy: unknown;
766
+ suppression_synced_at: string | null;
767
+ created_at: string | null;
768
+ updated_at: string | null;
769
+ }>;
770
+ listAudiences(): Promise<{
771
+ id: unknown;
772
+ audience_id: unknown;
773
+ name: unknown;
774
+ match: unknown;
775
+ predicates: unknown[];
776
+ consent_policy: unknown;
777
+ suppression_synced_at: string | null;
778
+ created_at: string | null;
779
+ updated_at: string | null;
780
+ }[]>;
781
+ updateAudience(idOrSlug: string, input: Record<string, unknown>): Promise<{
782
+ id: unknown;
783
+ audience_id: unknown;
784
+ name: unknown;
785
+ match: unknown;
786
+ predicates: unknown[];
787
+ consent_policy: unknown;
788
+ suppression_synced_at: string | null;
789
+ created_at: string | null;
790
+ updated_at: string | null;
791
+ }>;
792
+ deleteAudience(idOrSlug: string): Promise<void>;
793
+ setContactConsent(contactId: string, channel: string, status: string, source?: string): Promise<{
794
+ updated_at: string | null;
795
+ }>;
796
+ listContactConsent(contactId: string): Promise<{
797
+ updated_at: string | null;
798
+ }[]>;
799
+ suppressAddress(input: {
800
+ channel: string;
801
+ address: string;
802
+ contact_id?: string;
803
+ reason?: string;
804
+ }): Promise<{
805
+ created_at: string | null;
806
+ synced_at: string | null;
807
+ }>;
808
+ unsuppressAddress(channel: string, address: string): Promise<void>;
809
+ listSuppressions(opts?: {
810
+ channel?: string;
811
+ unsyncedOnly?: boolean;
812
+ }): Promise<{
813
+ created_at: string | null;
814
+ synced_at: string | null;
815
+ }[]>;
816
+ resolveAudience(idOrSlug: string, channel: string): Promise<{
817
+ audience_id: unknown;
818
+ channel: string;
819
+ consent_policy: unknown;
820
+ matched: number;
821
+ recipients: {
822
+ contact_id: string;
823
+ display_name: string;
824
+ address: string;
825
+ consent_status: string;
826
+ }[];
827
+ excluded: {
828
+ contact_id: string;
829
+ reason: string;
830
+ }[];
831
+ }>;
832
+ getUpcomingItems(days?: number): Promise<Record<string, unknown>[]>;
833
+ listContactAudit(): Promise<{
834
+ contact_id: string;
835
+ display_name: string;
836
+ score: number;
837
+ missing: string[];
838
+ suggestions: string[];
839
+ }[]>;
840
+ getContactTimeline(contactId: string, limit?: number): Promise<{
841
+ date: string;
842
+ type: string;
843
+ title: string;
844
+ body?: string;
845
+ metadata?: Record<string, unknown>;
846
+ }[]>;
847
+ getNetworkStats(): Promise<{
848
+ total_contacts: number;
849
+ total_companies: number;
850
+ owned_entities: number;
851
+ total_tags: number;
852
+ total_groups: number;
853
+ total_deals: number;
854
+ total_events: number;
855
+ cold_30d: number;
856
+ cold_60d: number;
857
+ cold_never: number;
858
+ contacts_with_email: number;
859
+ contacts_with_phone: number;
860
+ contacts_no_company: number;
861
+ overdue_tasks: number;
862
+ pending_applications: number;
863
+ missing_invoices: number;
864
+ upcoming_7d: number;
865
+ notes_count: number;
866
+ active_deals_value: number;
867
+ }>;
868
+ getContactCard(contactId: string): Promise<{
869
+ id: string;
870
+ display_name: string;
871
+ job_title: string | null;
872
+ company: string | undefined;
873
+ primary_email: string | undefined;
874
+ primary_phone: string | undefined;
875
+ }>;
876
+ getContactBrief(contactId: string, taskContext?: string): Promise<Record<string, unknown>>;
877
+ assembleContext(contactIds: string[], format: string): Promise<{
878
+ format: string;
879
+ contact_count: number;
880
+ assembled_at: string;
881
+ contacts: Record<string, unknown>[];
882
+ }>;
883
+ generateBrief(contactId: string): Promise<string>;
884
+ vaultStatus(): Promise<{
885
+ initialized: boolean;
886
+ unlocked: boolean;
887
+ document_count: number;
888
+ }>;
889
+ }
890
+ export declare function createContactsPgStore(client: PoolQueryClient): ContactsPgStore;
891
+ export declare function getContactsPgStore(client: PoolQueryClient): ContactsPgStore;
892
+ export declare function resetContactsPgStore(): void;
893
+ //# sourceMappingURL=pg-store.d.ts.map