@graph8/sdk 0.5.1 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,313 @@
1
1
  import { AnalyticsInterface } from '@jitsu/js';
2
2
 
3
+ interface Snippet {
4
+ write_key: string;
5
+ tracking_host: string;
6
+ domains: string[];
7
+ /** Ready-to-use React component import for @graph8/nextjs. */
8
+ react_snippet: string;
9
+ /** Vanilla JS script tag for non-React apps. */
10
+ script_tag: string;
11
+ /** Full configuration object (gtm/config.json). */
12
+ config: Record<string, unknown>;
13
+ }
14
+ /**
15
+ * Snippet API — fetch your org's graph8 tracking snippet programmatically, to
16
+ * embed the tracker into an app or a customer's site (the write key, a React
17
+ * component, a vanilla `<script>` tag, allowed domains, and the full config).
18
+ * Requires an API key (server-side). Built on the hardened HTTP core, so it
19
+ * throws a typed `G8Error` on failure and retries transient errors.
20
+ *
21
+ * Backed by `GET /api/v1/snippet`.
22
+ */
23
+ declare const createSnippetClient: (apiKey: string, apiUrl?: string) => {
24
+ /** Get your org's tracking snippet (write key + React/script-tag embeds + config). */
25
+ get(): Promise<Snippet>;
26
+ };
27
+
28
+ interface MarketplaceProfile {
29
+ id: string;
30
+ email: string;
31
+ first_name?: string | null;
32
+ last_name?: string | null;
33
+ marketplace_role?: string | null;
34
+ country_code?: string | null;
35
+ monthly_rate_usd?: string | null;
36
+ per_meeting_rate_usd?: string | null;
37
+ availability_status?: string | null;
38
+ bio?: string | null;
39
+ is_complete: boolean;
40
+ }
41
+ interface MarketplaceOffer {
42
+ id: string;
43
+ org_id: string;
44
+ org_name?: string | null;
45
+ sdr_id: string;
46
+ status: string;
47
+ monthly_rate_usd?: string | null;
48
+ per_meeting_rate_usd?: string | null;
49
+ created_at?: string | null;
50
+ }
51
+ interface MarketplaceHiring {
52
+ id: string;
53
+ org_id: string;
54
+ sdr_id: string;
55
+ status: string;
56
+ sdr_name?: string | null;
57
+ sdr_role?: string | null;
58
+ sdr_email?: string | null;
59
+ monthly_rate_usd?: string | null;
60
+ per_meeting_rate_usd?: string | null;
61
+ started_at?: string | null;
62
+ }
63
+ /**
64
+ * Marketplace API — for SDR/AE talent on the graph8 marketplace. View your
65
+ * profile, see pending hire offers and respond to them, and list your active
66
+ * hirings. Requires a personal API key (server-side). Built on the hardened
67
+ * HTTP core, so every method throws a typed `G8Error` on failure and retries
68
+ * transient errors.
69
+ *
70
+ * Backed by `/api/v1/marketplace`.
71
+ */
72
+ declare const createMarketplaceClient: (apiKey: string, apiUrl?: string) => {
73
+ /** Your own marketplace SDR profile. */
74
+ profile(): Promise<MarketplaceProfile>;
75
+ /** Pending hire offers you can accept or reject. */
76
+ offers(): Promise<{
77
+ offers: MarketplaceOffer[];
78
+ count: number;
79
+ }>;
80
+ /** Accept a pending hire offer (by hiring id). */
81
+ acceptOffer(hiringId: string): Promise<Record<string, unknown>>;
82
+ /** Reject a pending hire offer (by hiring id). */
83
+ rejectOffer(hiringId: string): Promise<Record<string, unknown>>;
84
+ /** Your active hiring contracts. */
85
+ hirings(): Promise<{
86
+ hirings: MarketplaceHiring[];
87
+ count: number;
88
+ }>;
89
+ };
90
+
91
+ interface AgencyInfo {
92
+ agency_org_id: string;
93
+ agency_org_name: string | null;
94
+ is_agency: boolean;
95
+ client_count: number;
96
+ /** Request header to set when operating a client org (e.g. "X-Target-Org-Id"). */
97
+ target_header: string;
98
+ }
99
+ interface AgencyClient {
100
+ /** Pass this as the `X-Target-Org-Id` header to operate this client org. */
101
+ org_id: string;
102
+ }
103
+ /**
104
+ * Agency API — for agency-scoped API keys (minted with `is_agency: true`).
105
+ * Discover the agency credential and the client orgs it may operate. To act on a
106
+ * client org, set the `X-Target-Org-Id` header (see `target_header`) to that
107
+ * client's `org_id` on your subsequent requests. Requires an agency API key
108
+ * (server-side); a non-agency key gets a `403`.
109
+ *
110
+ * Built on the hardened HTTP core (typed `G8Error` + retries). Backed by
111
+ * `/api/v1/agency`.
112
+ */
113
+ declare const createAgencyClient: (apiKey: string, apiUrl?: string) => {
114
+ /** Describe the agency credential: agency org + authorized client count. */
115
+ me(): Promise<AgencyInfo>;
116
+ /** List the client orgs this agency key may target via `X-Target-Org-Id`. */
117
+ clients(): Promise<{
118
+ data: AgencyClient[];
119
+ }>;
120
+ };
121
+
122
+ /** Filter operators supported by open-data search. */
123
+ type SearchOperator = "any_of" | "contains" | "all_of" | "none_of" | "is_empty" | "is_not_empty" | "between" | "exists";
124
+ /** A single search filter condition (named to avoid colliding with enrich's `SearchFilter`). */
125
+ interface SearchCondition {
126
+ /** Field to filter on, e.g. "job_title", "country", "industry". */
127
+ field: string;
128
+ operator: SearchOperator;
129
+ /** Filter values (operator-dependent; e.g. `["VP", "Director"]` for any_of). */
130
+ value?: unknown[];
131
+ }
132
+ interface SearchParams {
133
+ /** Filter conditions, combined with AND. */
134
+ filters?: SearchCondition[];
135
+ /** Page number, 1-indexed (1-100). */
136
+ page?: number;
137
+ /** Results per page (1-100, default 25). */
138
+ limit?: number;
139
+ }
140
+ interface SearchSaveParams extends SearchParams {
141
+ /** Title for the new list the matched records are saved into. */
142
+ list_title: string;
143
+ /** Max records to save (1-10,000, default 1,000). */
144
+ max_results?: number;
145
+ }
146
+ interface SearchContactItem {
147
+ first_name?: string | null;
148
+ last_name?: string | null;
149
+ middle_name?: string | null;
150
+ work_email?: string | null;
151
+ personal_emails?: string | null;
152
+ direct_phone?: string | null;
153
+ mobile_phone?: string | null;
154
+ job_title?: string | null;
155
+ job_department?: string | null;
156
+ seniority_level?: string | null;
157
+ role?: string | null;
158
+ linkedin_url?: string | null;
159
+ linkedin_headline?: string | null;
160
+ city?: string | null;
161
+ state?: string | null;
162
+ country?: string | null;
163
+ company_name?: string | null;
164
+ company_domain?: string | null;
165
+ company_industry?: string | null;
166
+ company_employee_count?: string | null;
167
+ company_country?: string | null;
168
+ confidence_score?: number | null;
169
+ }
170
+ interface SearchCompanyItem {
171
+ name?: string | null;
172
+ domain?: string | null;
173
+ website?: string | null;
174
+ description?: string | null;
175
+ industry?: string | null;
176
+ industry_group?: string | null;
177
+ employee_count?: string | null;
178
+ revenue?: string | null;
179
+ founded_year?: number | null;
180
+ phone?: string | null;
181
+ address?: string | null;
182
+ city?: string | null;
183
+ state?: string | null;
184
+ country?: string | null;
185
+ zip?: number | null;
186
+ linkedin_url?: string | null;
187
+ linkedin_followers?: string | null;
188
+ facebook_url?: string | null;
189
+ twitter_url?: string | null;
190
+ crunchbase_url?: string | null;
191
+ logo_url?: string | null;
192
+ }
193
+ interface SearchSaveResult {
194
+ list_id: number;
195
+ list_title: string;
196
+ estimated_total: number;
197
+ status: string;
198
+ }
199
+ /**
200
+ * Search API — prospect the open-data graph for new contacts and companies by
201
+ * filter, and optionally save the matches straight into a list. Requires API
202
+ * key (server-side). Built on the hardened HTTP core, so every method throws a
203
+ * typed `G8Error` on failure and retries transient errors.
204
+ *
205
+ * Backed by `/api/v1/search`.
206
+ */
207
+ declare const createSearchClient: (apiKey: string, apiUrl?: string) => {
208
+ /** Search open-data contacts by filter. */
209
+ contacts(params?: SearchParams): Promise<{
210
+ data: SearchContactItem[];
211
+ }>;
212
+ /** Search open-data companies by filter. */
213
+ companies(params?: SearchParams): Promise<{
214
+ data: SearchCompanyItem[];
215
+ }>;
216
+ /** Search contacts and save the matches into a new list. */
217
+ saveContacts(params: SearchSaveParams): Promise<SearchSaveResult>;
218
+ /** Search companies and save the matches into a new list. */
219
+ saveCompanies(params: SearchSaveParams): Promise<SearchSaveResult>;
220
+ };
221
+
222
+ /** Ad platform an audience can sync to. */
223
+ type AudienceSyncPlatform = "meta" | "linkedin" | "google" | "x";
224
+ /** Sync mode: full mirror, or only ever add members. */
225
+ type AudienceSyncMode = "mirror" | "append_only";
226
+ interface AudienceSync {
227
+ id: number;
228
+ audience_id: number;
229
+ platform: string;
230
+ platform_audience_name: string | null;
231
+ mode: string;
232
+ refresh_cadence_hours: number;
233
+ is_active: boolean;
234
+ status: string | null;
235
+ last_sync_at: string | null;
236
+ created_at: string | null;
237
+ }
238
+ interface AudienceSyncCreateParams {
239
+ /** Audience list ID to sync. */
240
+ audience_id: number;
241
+ platform: AudienceSyncPlatform;
242
+ platform_audience_name?: string;
243
+ /** Default "mirror". */
244
+ mode?: AudienceSyncMode;
245
+ /** Refresh cadence in hours (0-720; default 24). */
246
+ refresh_cadence_hours?: number;
247
+ /** Platform-specific config (OAuth creds, ad-account ids, etc.). */
248
+ platform_config?: Record<string, unknown>;
249
+ /** Audience list IDs whose members should be suppressed from the sync. */
250
+ suppression_list_ids?: number[];
251
+ }
252
+ interface AudienceSyncUpdateParams {
253
+ mode?: AudienceSyncMode;
254
+ refresh_cadence_hours?: number;
255
+ is_active?: boolean;
256
+ suppression_list_ids?: number[];
257
+ }
258
+ interface AudienceSyncRun {
259
+ id: number;
260
+ started_at: string | null;
261
+ finished_at: string | null;
262
+ status: string | null;
263
+ members_added: number | null;
264
+ members_removed: number | null;
265
+ total_members: number | null;
266
+ error_message: string | null;
267
+ }
268
+ interface AudienceSyncError {
269
+ id: number;
270
+ started_at: string | null;
271
+ error_message: string | null;
272
+ details: Record<string, unknown> | null;
273
+ }
274
+ /**
275
+ * Audiences API — sync an audience list to ad platforms (Meta, LinkedIn,
276
+ * Google, X). Requires API key (server-side). Built on the hardened HTTP core,
277
+ * so every method throws a typed `G8Error` on failure and retries transient
278
+ * 429/5xx/network errors.
279
+ *
280
+ * Backed by `/api/v1/audience-syncs`.
281
+ */
282
+ declare const createAudiencesClient: (apiKey: string, apiUrl?: string) => {
283
+ /** List all audience syncs for the organization. */
284
+ list(): Promise<{
285
+ data: AudienceSync[];
286
+ }>;
287
+ /** Create a new audience sync to an ad platform. */
288
+ create(params: AudienceSyncCreateParams): Promise<AudienceSync>;
289
+ /** Get a single audience sync by ID. */
290
+ get(configId: number): Promise<AudienceSync>;
291
+ /** Update an audience sync (partial). */
292
+ update(configId: number, fields: AudienceSyncUpdateParams): Promise<AudienceSync>;
293
+ /** Delete an audience sync. */
294
+ delete(configId: number): Promise<{
295
+ data: Record<string, unknown>;
296
+ }>;
297
+ /** Trigger an immediate sync run for a config. */
298
+ trigger(configId: number): Promise<{
299
+ data: Record<string, unknown>;
300
+ }>;
301
+ /** List recent sync runs for a config (most recent first). */
302
+ runs(configId: number): Promise<{
303
+ data: AudienceSyncRun[];
304
+ }>;
305
+ /** List recent sync errors for a config. */
306
+ errors(configId: number): Promise<{
307
+ data: AudienceSyncError[];
308
+ }>;
309
+ };
310
+
3
311
  interface MeetingAttendee {
4
312
  name: string | null;
5
313
  email: string;
@@ -133,10 +441,13 @@ interface ResearchReport {
133
441
  * GET /api/v1/research-reports
134
442
  */
135
443
  declare const createStudioClient: (apiKey: string, apiUrl?: string) => {
136
- /** Org-level Studio documents (brand_brief, value_props, messaging_house, etc.). */
444
+ /** Org-level Studio documents (brand_brief, value_props, messaging_house, etc.).
445
+ * `include_content` defaults to true server-side, so each document includes
446
+ * its `content` body unless you explicitly pass `include_content: false`. */
137
447
  globalContext(params?: {
138
448
  category?: string;
139
449
  limit?: number;
450
+ include_content?: boolean;
140
451
  }): Promise<{
141
452
  data: GlobalContextDocument[];
142
453
  }>;
@@ -582,7 +893,8 @@ interface WorkflowListParams {
582
893
  }
583
894
  /**
584
895
  * Workflows API - automation workflows with nodes, connections, and execution lifecycle.
585
- * Requires API key (server-side).
896
+ * Requires API key (server-side). On the hardened HTTP core: throws a typed
897
+ * `G8Error` on failure and retries transient errors.
586
898
  *
587
899
  * The graph8 workflow surface treats the whole workflow definition as a single
588
900
  * record updated via `update()` — there are no per-node CRUD endpoints. To edit
@@ -647,9 +959,9 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
647
959
  }>;
648
960
  /** Execute a workflow immediately with a trigger payload. */
649
961
  execute(workflowId: string, triggerPayload?: Record<string, unknown>): Promise<WorkflowExecution>;
650
- /** Get the status + output of a workflow execution. */
962
+ /** Get the status + outputs of a single execution. */
651
963
  getExecution(executionId: string): Promise<WorkflowExecution>;
652
- /** Pause an in-flight execution. */
964
+ /** Pause a running execution. */
653
965
  pauseExecution(executionId: string): Promise<{
654
966
  data: {
655
967
  paused: boolean;
@@ -661,34 +973,32 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
661
973
  resumed: boolean;
662
974
  };
663
975
  }>;
664
- /** Stop an execution (terminal state — cannot resume). */
976
+ /** Stop an execution. */
665
977
  stopExecution(executionId: string): Promise<{
666
978
  data: {
667
979
  stopped: boolean;
668
980
  };
669
981
  }>;
670
- /** Get the status of a workflow's external trigger (e.g. "waiting for webhook"). */
982
+ /** Get the trigger status (e.g. schedule / webhook wiring) for a workflow. */
671
983
  getTriggerStatus(workflowId: string): Promise<{
672
984
  data: {
673
985
  status: string;
674
986
  details: Record<string, unknown>;
675
987
  };
676
988
  }>;
677
- /** Reset the trigger cursor (e.g. for event-stream triggers — resume from beginning). */
989
+ /** Reset a workflow's trigger cursor / state. */
678
990
  resetTrigger(workflowId: string): Promise<{
679
991
  data: {
680
992
  reset: boolean;
681
993
  };
682
994
  }>;
683
- /**
684
- * List available node types with schemas. Pass a `type` param to fetch one type's full schema.
685
- */
995
+ /** Catalog of available workflow node types with config + output schemas. */
686
996
  nodeTypes(params?: {
687
997
  type?: string;
688
998
  }): Promise<{
689
999
  data: NodeTypeSchema[];
690
1000
  }>;
691
- /** Slack workspace users (for Slack action recipients). */
1001
+ /** Slack users available to workflow nodes. */
692
1002
  listSlackUsers(): Promise<{
693
1003
  data: Array<{
694
1004
  id: string;
@@ -696,7 +1006,7 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
696
1006
  email: string | null;
697
1007
  }>;
698
1008
  }>;
699
- /** Slack channels. */
1009
+ /** Slack channels available to workflow nodes. */
700
1010
  listSlackChannels(): Promise<{
701
1011
  data: Array<{
702
1012
  id: string;
@@ -704,7 +1014,7 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
704
1014
  is_private: boolean;
705
1015
  }>;
706
1016
  }>;
707
- /** Roam (Copilot chat) users. */
1017
+ /** Roam users available to workflow nodes. */
708
1018
  listRoamUsers(): Promise<{
709
1019
  data: Array<{
710
1020
  id: string;
@@ -712,14 +1022,14 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
712
1022
  email: string | null;
713
1023
  }>;
714
1024
  }>;
715
- /** Roam (Copilot chat) groups. */
1025
+ /** Roam groups available to workflow nodes. */
716
1026
  listRoamGroups(): Promise<{
717
1027
  data: Array<{
718
1028
  id: string;
719
1029
  name: string;
720
1030
  }>;
721
1031
  }>;
722
- /** Available MCP servers (for Agent-node integrations). */
1032
+ /** MCP servers available to workflow nodes. */
723
1033
  listMcpServers(): Promise<{
724
1034
  data: Array<{
725
1035
  id: string;
@@ -727,14 +1037,14 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
727
1037
  url: string;
728
1038
  }>;
729
1039
  }>;
730
- /** Available call dispositions (voice workflow nodes). */
1040
+ /** Disposition options available to workflow nodes. */
731
1041
  listDispositions(): Promise<{
732
1042
  data: Array<{
733
1043
  id: string;
734
1044
  label: string;
735
1045
  }>;
736
1046
  }>;
737
- /** Form field schema for form-trigger nodes. */
1047
+ /** Form field definitions for a given form (used by form-trigger nodes). */
738
1048
  listFormFields(formId: string): Promise<{
739
1049
  data: Array<{
740
1050
  name: string;
@@ -817,7 +1127,8 @@ interface PipelineSuggestion {
817
1127
  }
818
1128
  /**
819
1129
  * Stage Checklist Pipelines API - workflow pipelines with evidence + scripts.
820
- * Requires API key (server-side).
1130
+ * Requires API key (server-side). On the hardened HTTP core: throws a typed
1131
+ * `G8Error` on failure and retries transient errors.
821
1132
  *
822
1133
  * Backed by:
823
1134
  * GET /api/v1/pipelines
@@ -960,7 +1271,9 @@ interface PaginationMeta$2 {
960
1271
  has_next: boolean;
961
1272
  }
962
1273
  /**
963
- * Quotes API - quote-to-cash lifecycle. Requires API key (server-side).
1274
+ * Quotes API - quote-to-cash lifecycle. Requires API key (server-side). On the
1275
+ * hardened HTTP core: throws a typed `G8Error` on failure and retries transient
1276
+ * errors.
964
1277
  *
965
1278
  * Backed by:
966
1279
  * GET /api/v1/quotes
@@ -1113,7 +1426,9 @@ interface InboxSendResult {
1113
1426
  }
1114
1427
  /**
1115
1428
  * Inbox API — read + reply to multi-channel inbox threads (email, SMS, LinkedIn/HeyReach).
1116
- * Requires API key (server-side).
1429
+ * Requires API key (server-side). On the hardened HTTP core: throws a typed
1430
+ * `G8Error` on failure (e.g. 402 when an AI draft exceeds your credit balance)
1431
+ * and retries transient errors.
1117
1432
  *
1118
1433
  * Backed by:
1119
1434
  * GET /api/v1/inbox
@@ -1320,7 +1635,8 @@ interface SetFieldValueParams {
1320
1635
  }
1321
1636
  /**
1322
1637
  * Fields API - manage custom fields (columns) on contacts and companies.
1323
- * Requires API key (server-side).
1638
+ * Requires API key (server-side). On the hardened HTTP core: throws a typed
1639
+ * `G8Error` on failure and retries transient errors.
1324
1640
  *
1325
1641
  * Backed by:
1326
1642
  * GET /api/v1/fields — list contact fields
@@ -1714,8 +2030,11 @@ declare const createContactsClient: (apiKey: string, apiUrl?: string) => {
1714
2030
  }>;
1715
2031
  /** Get a single contact by ID. */
1716
2032
  get(contactId: number): Promise<Contact>;
1717
- /** Create a new contact. */
1718
- create(contact: ContactCreateParams): Promise<Contact>;
2033
+ /**
2034
+ * Create a new contact. Pass `idempotencyKey` to make a retry safe — the
2035
+ * same key returns the first result instead of creating a duplicate (A6).
2036
+ */
2037
+ create(contact: ContactCreateParams, idempotencyKey?: string): Promise<Contact>;
1719
2038
  /** Update a contact (partial). */
1720
2039
  update(contactId: number, fields: ContactUpdateParams): Promise<{
1721
2040
  updated: number;
@@ -1732,18 +2051,76 @@ declare const createContactsClient: (apiKey: string, apiUrl?: string) => {
1732
2051
  createColumn(params: ContactColumnCreateParams): Promise<ContactColumn>;
1733
2052
  };
1734
2053
 
1735
- type WebhookEvent = "reply_received" | "meeting_booked" | "contact_enriched" | "contact_created" | "sequence_completed" | "sequence_replied" | "campaign_launched" | "form_submitted" | "visitor_identified";
1736
- type WebhookCallback = (data: Record<string, unknown>) => void;
1737
2054
  /**
1738
- * Webhooks - listen for graph8 events. Requires API key (server-side).
2055
+ * Known graph8 webhook event types.
1739
2056
  *
1740
- * For client-side real-time events, use g8.visitors.onIntent() or g8.chat.on() instead.
2057
+ * Source of truth is the backend ``WEBHOOK_EVENTS`` catalog
2058
+ * (campaign_builder/services/webhook_service.py). Keep in sync when the backend
2059
+ * adds events. ``WebhookEvent`` also accepts any string so a newly-added
2060
+ * backend event never breaks a client that hasn't upgraded.
1741
2061
  */
1742
- declare const createWebhooksClient: (apiKey: string, apiUrl?: string) => {
1743
- /** Register a listener for a webhook event. Starts polling automatically. */
1744
- on(event: WebhookEvent, callback: WebhookCallback): void;
1745
- /** Stop all webhook polling. */
1746
- stop(): void;
2062
+ declare const KNOWN_WEBHOOK_EVENTS: readonly ["campaign.created", "campaign.updated", "campaign.deleted", "campaign.launched", "campaign.paused", "campaign.completed", "campaign.status_changed", "campaign.content_ready", "document.generated", "document.failed", "intelligence.completed", "intelligence.failed", "company.enriched", "company_intelligence.completed", "audience.ready", "audience.failed", "sequence.deployed", "sequence.started", "sequence.paused", "sequence.completed", "engagement.email_sent", "engagement.email_replied", "engagement.email_bounced", "engagement.email_skipped", "engagement.call_dispatched", "engagement.sms_sent", "engagement.sms_replied", "engagement.whatsapp_sent", "engagement.linkedin_connection_sent", "engagement.linkedin_message_sent", "engagement.linkedin_inmail_sent", "engagement.linkedin_reply_received", "engagement.linkedin_connection_accepted", "meeting.booked", "meeting.cancelled", "meeting.rescheduled"];
2063
+ type WebhookEvent = (typeof KNOWN_WEBHOOK_EVENTS)[number] | (string & {});
2064
+ /** The decoded body graph8 delivers to a webhook endpoint. */
2065
+ interface WebhookEventPayload {
2066
+ event: WebhookEvent;
2067
+ timestamp: string;
2068
+ data: Record<string, unknown>;
2069
+ org_id: string;
2070
+ /** Stable per-delivery id (present once the backend adds it; for consumer dedup). */
2071
+ id?: string;
2072
+ }
2073
+ interface ConstructEventOptions {
2074
+ /**
2075
+ * Reject events whose ``X-Studio-Timestamp`` is older (or newer) than this
2076
+ * many seconds — replay protection. Disabled when 0/undefined.
2077
+ */
2078
+ toleranceSeconds?: number;
2079
+ }
2080
+ /** Thrown by {@link constructEvent} when a webhook cannot be verified. */
2081
+ declare class WebhookSignatureError extends Error {
2082
+ constructor(message: string);
2083
+ }
2084
+ /**
2085
+ * Verify the HMAC-SHA256 signature of an incoming graph8 webhook and return the
2086
+ * parsed event. Server-side only (needs the per-endpoint signing secret).
2087
+ *
2088
+ * Mirrors the backend signing scheme exactly: the signature is
2089
+ * ``HMAC_SHA256(secret, `${timestamp}.${rawBody}`)`` hex-encoded, delivered in
2090
+ * the ``X-Studio-Signature`` header alongside the unix ``X-Studio-Timestamp``.
2091
+ *
2092
+ * @param payload The RAW request body string (verify before JSON.parse — re-serializing changes bytes).
2093
+ * @param signature The ``X-Studio-Signature`` header (an optional ``sha256=`` prefix is tolerated).
2094
+ * @param timestamp The ``X-Studio-Timestamp`` header (unix seconds).
2095
+ * @param secret The endpoint's signing secret.
2096
+ * @throws {WebhookSignatureError} on a missing/invalid signature, stale timestamp, or bad JSON.
2097
+ *
2098
+ * @example
2099
+ * app.post("/webhooks/graph8", (req, res) => {
2100
+ * const event = g8.webhooks.constructEvent(
2101
+ * req.rawBody,
2102
+ * req.header("X-Studio-Signature"),
2103
+ * req.header("X-Studio-Timestamp"),
2104
+ * process.env.G8_WEBHOOK_SECRET,
2105
+ * { toleranceSeconds: 300 },
2106
+ * );
2107
+ * if (event.event === "meeting.booked") { ... }
2108
+ * res.sendStatus(200);
2109
+ * });
2110
+ */
2111
+ declare function constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
2112
+ /**
2113
+ * Webhooks client (server-side). graph8 webhooks are PUSH — graph8 POSTs to your
2114
+ * endpoint; you verify each delivery with {@link constructEvent}. (The previous
2115
+ * polling implementation hit a feed endpoint that never existed and is removed.)
2116
+ */
2117
+ declare const createWebhooksClient: (_apiKey: string, apiUrl?: string) => {
2118
+ /** Base URL the webhook subscription API lives under. */
2119
+ baseUrl: string;
2120
+ /** Known event types (for autocomplete / validation). */
2121
+ knownEvents: readonly ["campaign.created", "campaign.updated", "campaign.deleted", "campaign.launched", "campaign.paused", "campaign.completed", "campaign.status_changed", "campaign.content_ready", "document.generated", "document.failed", "intelligence.completed", "intelligence.failed", "company.enriched", "company_intelligence.completed", "audience.ready", "audience.failed", "sequence.deployed", "sequence.started", "sequence.paused", "sequence.completed", "engagement.email_sent", "engagement.email_replied", "engagement.email_bounced", "engagement.email_skipped", "engagement.call_dispatched", "engagement.sms_sent", "engagement.sms_replied", "engagement.whatsapp_sent", "engagement.linkedin_connection_sent", "engagement.linkedin_message_sent", "engagement.linkedin_inmail_sent", "engagement.linkedin_reply_received", "engagement.linkedin_connection_accepted", "meeting.booked", "meeting.cancelled", "meeting.rescheduled"];
2122
+ /** Verify an incoming webhook's HMAC signature and return the parsed event. */
2123
+ constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
1747
2124
  };
1748
2125
 
1749
2126
  interface LandingPage {
@@ -1754,7 +2131,9 @@ interface LandingPage {
1754
2131
  published_url: string | null;
1755
2132
  }
1756
2133
  /**
1757
- * Landing pages - clone, create, publish. Requires API key (server-side).
2134
+ * Landing pages - clone, create, publish. Requires API key (server-side). On the
2135
+ * hardened HTTP core: throws a typed `G8Error` on failure and retries transient
2136
+ * errors.
1758
2137
  */
1759
2138
  declare const createPagesClient: (apiKey: string, apiUrl?: string) => {
1760
2139
  /** Clone a landing page from any URL. */
@@ -2112,6 +2491,12 @@ interface AnalyticsOverview {
2112
2491
  }
2113
2492
  /**
2114
2493
  * Analytics - dashboard data and metrics. Requires API key (server-side).
2494
+ *
2495
+ * On the hardened HTTP core: throws a typed `G8Error` on failure and retries
2496
+ * transient errors. Note the deliberate behavior change vs the preview client —
2497
+ * a non-2xx response now **throws** instead of silently returning an all-zeros
2498
+ * overview, so callers can distinguish genuinely-zero activity from an auth/5xx
2499
+ * failure.
2115
2500
  */
2116
2501
  declare const createAnalyticsClient: (apiKey: string, apiUrl?: string) => {
2117
2502
  overview(config?: {
@@ -2144,7 +2529,9 @@ interface Integration {
2144
2529
  connected_at: string | null;
2145
2530
  }
2146
2531
  /**
2147
- * Integrations - connect CRM platforms, trigger syncs. Requires API key (server-side).
2532
+ * Integrations - connect CRM platforms, trigger syncs. Requires API key
2533
+ * (server-side). On the hardened HTTP core: throws a typed `G8Error` on failure
2534
+ * and retries transient errors.
2148
2535
  */
2149
2536
  declare const createIntegrationsClient: (apiKey: string, apiUrl?: string) => {
2150
2537
  list(): Promise<Integration[]>;
@@ -2180,6 +2567,8 @@ interface CampaignStats {
2180
2567
  }
2181
2568
  /**
2182
2569
  * Campaigns - create, manage, launch campaigns. Requires API key (server-side).
2570
+ * On the hardened HTTP core: throws a typed `G8Error` on failure and retries
2571
+ * transient errors.
2183
2572
  */
2184
2573
  declare const createCampaignsClient: (apiKey: string, apiUrl?: string) => {
2185
2574
  list(page?: number, limit?: number): Promise<Campaign[]>;
@@ -2218,6 +2607,8 @@ interface SequenceListParams {
2218
2607
  limit?: number;
2219
2608
  /** Filter by sequence status (e.g. "live", "draft", "paused"). */
2220
2609
  status?: string;
2610
+ /** Filter by sequence kind ("cold_outbound" or "nurture"). Omit to list all kinds. */
2611
+ sequence_kind?: SequenceKind;
2221
2612
  }
2222
2613
  interface SequenceDetail {
2223
2614
  id: string;
@@ -2231,6 +2622,10 @@ interface SequenceDetail {
2231
2622
  wait_for_new_contacts: boolean;
2232
2623
  paused_at: string | null;
2233
2624
  resumed_at: string | null;
2625
+ /** Sequence kind. Immutable after creation. "cold_outbound" (default) or "nurture". */
2626
+ sequence_kind?: string | null;
2627
+ /** Pinned mailbox for nurture sequences; null for cold_outbound. Immutable. */
2628
+ pinned_mailbox_id?: number | null;
2234
2629
  created_at: string | null;
2235
2630
  updated_at: string | null;
2236
2631
  }
@@ -2275,6 +2670,13 @@ interface SequenceChannelConfig {
2275
2670
  channel_type: string;
2276
2671
  channel_data?: Record<string, unknown>;
2277
2672
  }
2673
+ /**
2674
+ * Sequence kind. A "nurture" is an ordinary sequence with `sequence_kind:
2675
+ * "nurture"` — same step types as cold outreach, but pinned to a single mailbox
2676
+ * with a higher daily email cap. There is no separate nurture client; create one
2677
+ * via `sequences.create({ sequence_kind: "nurture", pinned_mailbox_id })`.
2678
+ */
2679
+ type SequenceKind = "cold_outbound" | "nurture";
2278
2680
  interface SequenceCreateParams {
2279
2681
  name: string;
2280
2682
  user_email: string;
@@ -2286,6 +2688,18 @@ interface SequenceCreateParams {
2286
2688
  steps?: SequenceStepConfig[];
2287
2689
  channels?: SequenceChannelConfig[];
2288
2690
  campaign_id?: string;
2691
+ /**
2692
+ * Sequence kind. Defaults to "cold_outbound" server-side. Immutable after
2693
+ * creation. "nurture" requires `pinned_mailbox_id` and is gated by the
2694
+ * ENABLE_NURTURE feature flag.
2695
+ */
2696
+ sequence_kind?: SequenceKind;
2697
+ /**
2698
+ * Mailbox to pin for a nurture sequence. Required when
2699
+ * `sequence_kind: "nurture"`; all email channels must use this mailbox.
2700
+ * Ignored for cold_outbound sequences.
2701
+ */
2702
+ pinned_mailbox_id?: number;
2289
2703
  }
2290
2704
  interface SequenceCreateResult {
2291
2705
  id: string;
@@ -2431,7 +2845,8 @@ interface SearchResults {
2431
2845
  /**
2432
2846
  * Enrichment API - person/company lookup, email verification, prospecting search.
2433
2847
  *
2434
- * Requires API key (server-side only). Credits charged per call.
2848
+ * Requires API key (server-side only). Credits charged per call. On the hardened
2849
+ * HTTP core: throws a typed `G8Error` on failure and retries transient errors.
2435
2850
  */
2436
2851
  declare const createEnrichClient: (apiKey: string, apiUrl?: string) => {
2437
2852
  /** Look up a person by email, LinkedIn, or name + company. Costs 1 credit. */
@@ -2708,6 +3123,11 @@ declare class G8 {
2708
3123
  /** @internal */ _intent: ReturnType<typeof createIntentClient> | null;
2709
3124
  /** @internal */ _studio: ReturnType<typeof createStudioClient> | null;
2710
3125
  /** @internal */ _meetings: ReturnType<typeof createMeetingsClient> | null;
3126
+ /** @internal */ _audiences: ReturnType<typeof createAudiencesClient> | null;
3127
+ /** @internal */ _search: ReturnType<typeof createSearchClient> | null;
3128
+ /** @internal */ _agency: ReturnType<typeof createAgencyClient> | null;
3129
+ /** @internal */ _marketplace: ReturnType<typeof createMarketplaceClient> | null;
3130
+ /** @internal */ _snippet: ReturnType<typeof createSnippetClient> | null;
2711
3131
  /**
2712
3132
  * Initialize the graph8 SDK. Must be called before any other method.
2713
3133
  * Safe to call on the server (SSR) - becomes a no-op for tracking.
@@ -2768,19 +3188,7 @@ declare class G8 {
2768
3188
  company_domain?: string;
2769
3189
  }): Promise<PersonEnrichment>;
2770
3190
  company(params: {
2771
- domain
2772
- /**
2773
- * graph8 SDK client.
2774
- *
2775
- * Handles event tracking, identity, and progressive forms.
2776
- *
2777
- * Usage:
2778
- * import { g8 } from '@graph8/js';
2779
- * g8.init({ writeKey: 'your_write_key' });
2780
- * g8.track('page_view', { page: '/pricing' });
2781
- * g8.identify('user@acme.com', { name: 'John', company: 'Acme' });
2782
- */
2783
- ?: string;
3191
+ domain?: string;
2784
3192
  name?: string;
2785
3193
  }): Promise<CompanyEnrichment>;
2786
3194
  verifyEmail(email: string): Promise<EmailVerification>;
@@ -2906,8 +3314,9 @@ declare class G8 {
2906
3314
  };
2907
3315
  /** Webhook event listeners (requires API key). */
2908
3316
  get webhooks(): {
2909
- on(event: WebhookEvent, callback: (data: Record<string, unknown>) => void): void;
2910
- stop(): void;
3317
+ baseUrl: string;
3318
+ knownEvents: readonly ["campaign.created", "campaign.updated", "campaign.deleted", "campaign.launched", "campaign.paused", "campaign.completed", "campaign.status_changed", "campaign.content_ready", "document.generated", "document.failed", "intelligence.completed", "intelligence.failed", "company.enriched", "company_intelligence.completed", "audience.ready", "audience.failed", "sequence.deployed", "sequence.started", "sequence.paused", "sequence.completed", "engagement.email_sent", "engagement.email_replied", "engagement.email_bounced", "engagement.email_skipped", "engagement.call_dispatched", "engagement.sms_sent", "engagement.sms_replied", "engagement.whatsapp_sent", "engagement.linkedin_connection_sent", "engagement.linkedin_message_sent", "engagement.linkedin_inmail_sent", "engagement.linkedin_reply_received", "engagement.linkedin_connection_accepted", "meeting.booked", "meeting.cancelled", "meeting.rescheduled"];
3319
+ constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
2911
3320
  };
2912
3321
  /** Contacts CRUD (requires API key). */
2913
3322
  get contacts(): {
@@ -2916,7 +3325,7 @@ declare class G8 {
2916
3325
  total: number;
2917
3326
  }>;
2918
3327
  get(contactId: number): Promise<Contact>;
2919
- create(contact: ContactCreateParams): Promise<Contact>;
3328
+ create(contact: ContactCreateParams, idempotencyKey?: string): Promise<Contact>;
2920
3329
  update(contactId: number, fields: ContactUpdateParams): Promise<{
2921
3330
  updated: number;
2922
3331
  }>;
@@ -3318,7 +3727,7 @@ declare class G8 {
3318
3727
  }>;
3319
3728
  keywordContacts(keywordId: string, params?: {
3320
3729
  limit?: number;
3321
- date_from? /** @internal */: string;
3730
+ date_from?: string;
3322
3731
  date_to?: string;
3323
3732
  }): Promise<{
3324
3733
  data: IntentContact[];
@@ -3369,6 +3778,7 @@ declare class G8 {
3369
3778
  globalContext(params?: {
3370
3779
  category?: string;
3371
3780
  limit?: number;
3781
+ include_content?: boolean;
3372
3782
  }): Promise<{
3373
3783
  data: GlobalContextDocument[];
3374
3784
  }>;
@@ -3380,7 +3790,7 @@ declare class G8 {
3380
3790
  }>;
3381
3791
  personas(params?: {
3382
3792
  status?: string;
3383
- limit?: number;
3793
+ limit? /** @internal */: number;
3384
3794
  }): Promise<{
3385
3795
  data: Persona[];
3386
3796
  }>;
@@ -3410,6 +3820,63 @@ declare class G8 {
3410
3820
  }>;
3411
3821
  get(meetingId: string): Promise<MeetingDetail>;
3412
3822
  };
3823
+ /** Audiences — sync audience lists to ad platforms (Meta, LinkedIn, Google, X) (requires API key). */
3824
+ get audiences(): {
3825
+ list(): Promise<{
3826
+ data: AudienceSync[];
3827
+ }>;
3828
+ create(params: AudienceSyncCreateParams): Promise<AudienceSync>;
3829
+ get(configId: number): Promise<AudienceSync>;
3830
+ update(configId: number, fields: AudienceSyncUpdateParams): Promise<AudienceSync>;
3831
+ delete(configId: number): Promise<{
3832
+ data: Record<string, unknown>;
3833
+ }>;
3834
+ trigger(configId: number): Promise<{
3835
+ data: Record<string, unknown>;
3836
+ }>;
3837
+ runs(configId: number): Promise<{
3838
+ data: AudienceSyncRun[];
3839
+ }>;
3840
+ errors(configId: number): Promise<{
3841
+ data: AudienceSyncError[];
3842
+ }>;
3843
+ };
3844
+ /** Search — prospect open-data contacts + companies by filter, optionally save to a list (requires API key). */
3845
+ get search(): {
3846
+ contacts(params?: SearchParams): Promise<{
3847
+ data: SearchContactItem[];
3848
+ }>;
3849
+ companies(params?: SearchParams): Promise<{
3850
+ data: SearchCompanyItem[];
3851
+ }>;
3852
+ saveContacts(params: SearchSaveParams): Promise<SearchSaveResult>;
3853
+ saveCompanies(params: SearchSaveParams): Promise<SearchSaveResult>;
3854
+ };
3855
+ /** Agency — for agency keys: discover the agency credential + the client orgs it may target (requires API key). */
3856
+ get agency(): {
3857
+ me(): Promise<AgencyInfo>;
3858
+ clients(): Promise<{
3859
+ data: AgencyClient[];
3860
+ }>;
3861
+ };
3862
+ /** Marketplace — for SDR/AE talent: profile, hire offers (accept/reject), active hirings (requires API key). */
3863
+ get marketplace(): {
3864
+ profile(): Promise<MarketplaceProfile>;
3865
+ offers(): Promise<{
3866
+ offers: MarketplaceOffer[];
3867
+ count: number;
3868
+ }>;
3869
+ acceptOffer(hiringId: string): Promise<Record<string, unknown>>;
3870
+ rejectOffer(hiringId: string): Promise<Record<string, unknown>>;
3871
+ hirings(): Promise<{
3872
+ hirings: MarketplaceHiring[];
3873
+ count: number;
3874
+ }>;
3875
+ };
3876
+ /** Snippet — fetch your org's tracking snippet (write key + React/script-tag embeds + config) for embedding (requires API key). */
3877
+ get snippet(): {
3878
+ get(): Promise<Snippet>;
3879
+ };
3413
3880
  /** Whether the SDK has been initialized. */
3414
3881
  get initialized(): boolean;
3415
3882
  /** @internal */
@@ -3420,4 +3887,88 @@ declare class G8 {
3420
3887
  /** Singleton g8 client instance. */
3421
3888
  declare const g8: G8;
3422
3889
 
3423
- export { type AddToSequenceConfig, type AnalyticsOverview, type Booking, type BookingRequest, type CalendarConfig, type CallAnalysis, type CallGradingResult, type Campaign, type CampaignCreateConfig, type CampaignStats, type ChatConfig, type Company, type CompanyColumn, type CompanyColumnCreateParams, type CompanyContact, type CompanyEnrichment, type CompanyListParams, type CompanyUpdateParams, type Contact, type ContactColumn, type ContactColumnCreateParams, type ContactCreateParams, type ContactDeal, type ContactList, type ContactListParams, type ContactUpdateParams, type CopilotConfig, type CreatedField, type Deal, type DealCreateParams, type DealListParams, type DealUpdateParams, type DialerAgentSummary, type DialerAgentsListParams, type DialerAgentsListResult, type DialerNumberInfo, type DialerNumbersListResult, type DialerReportFilters, type DialerReportMetric, type DialerSessionCreateParams, type DialerSessionCreateResult, type DialerSessionResumeResult, type DialerSessionStatus, type DialerSessionStatusUpdateResult, type DialerSessionSummary, type DialerSessionsListParams, type DialerSessionsListResult, type DialerStatsParams, type DialerStatsResult, type EmailVerification, type EnrichLookupResult, type EvidenceKey, type Field, type FieldCreateParams, type FieldDeleteParams, type G8Config, type G8PrivacyConfig, type GlobalContextDocument, type ICP, type IdentifyProperties, type InboxAssignResult, type InboxAssignee, type InboxChannel, type InboxContact, type InboxDraft, type InboxListParams, type InboxMessage, type InboxSendParams, type InboxSendResult, type InboxTag, type InboxTagResult, type InboxThread, type Integration, type IntelligenceData, type IntentCompany, type IntentContact, type IntentKeyword, type IntentPage, type IntentSignals, type IntentStats, type IntentVisitor, type LandingPage, type ListContact, type MeetingAnalysis, type MeetingAttendee, type MeetingDetail, type MeetingListParams, type MeetingSummary, type MeetingTranscriptLine, type MissedCallback, type MissedCallbacksResult, type NodeTypeSchema, type Note, type PaginationMeta$1 as PaginationMeta, type PersonEnrichment, type Persona, type Pipeline, type PipelineStage, type PipelineSuggestion, type QuotableProduct, type QuoteCreateParams, type QuoteDetail, type QuoteLineItem, type QuoteListParams, type QuoteSendParams, type QuoteSettings, type QuoteStatus, type QuoteSummary, type QuoteUpdateParams, type ResearchReport, type SearchFilter, type SearchResults, type Sequence, type SequenceActionResult, type SequenceAnalytics, type SequenceChannelConfig, type SequenceContactItem, type SequenceContactsParams, type SequenceCreateParams, type SequenceCreateResult, type SequenceDetail, type SequenceListItem, type SequenceListParams, type SequencePreview, type SequencePreviewChannel, type SequencePreviewStep, type SequenceStepConfig, type SequenceStepInputType, type SequenceStepType, type SequenceStepUpdateParams, type SequenceUpdateParams, type SetFieldValueParams, type Skill, type SkillCreateAPIParams, type SkillCreateLLMParams, type SkillInputField, type SkillListParams, type SkillTemplate, type SkillType, type SkillUpdateAPIParams, type SkillUpdateLLMParams, type StageCreateParams, type StagePipeline, type StagePipelineCreateParams, type StagePipelineStage, type StagePipelineUpdateParams, type StageUpdateParams, type Task, type TaskCreateParams, type TaskListParams, type TaskUpdateParams, type TimeSlot, type TrackProperties, type VisitorCompany, type VisitorScore, type VoicePagination, type VoiceSession, type WebhookEvent, type Workflow, type WorkflowConfig, type WorkflowConnection, type WorkflowCreateParams, type WorkflowExecution, type WorkflowListParams, type WorkflowNode, type WorkflowUpdateParams, g8 };
3890
+ /**
3891
+ * Hardened HTTP core for the graph8 JS SDK (sprint B2).
3892
+ *
3893
+ * Resource clients historically called `fetch` directly and returned
3894
+ * `resp.json()` even on a 4xx/5xx — so API errors surfaced silently as "data".
3895
+ * This module centralizes the request path with:
3896
+ *
3897
+ * - a typed `G8Error` (status, type, code, request_id, detail) thrown on any
3898
+ * non-2xx response, parsed from the standard ApiError envelope;
3899
+ * - automatic retry with exponential backoff + jitter on 429 and 5xx,
3900
+ * honoring the `Retry-After` header;
3901
+ * - `Idempotency-Key` support for safe POST retries (pairs with the backend
3902
+ * idempotency added in A6);
3903
+ * - a cursor `paginate()` async-iterator that follows `next_cursor` (A9).
3904
+ *
3905
+ * `fetch` and `sleep` are injectable so the retry/backoff logic is
3906
+ * deterministically unit-testable without real timers or network.
3907
+ */
3908
+ declare class G8Error extends Error {
3909
+ readonly status: number;
3910
+ readonly type: string;
3911
+ readonly code?: string;
3912
+ readonly requestId?: string;
3913
+ readonly detail?: unknown;
3914
+ /** True when the failure class is transient (429/5xx/network). */
3915
+ readonly retryable: boolean;
3916
+ constructor(args: {
3917
+ message: string;
3918
+ status: number;
3919
+ type: string;
3920
+ code?: string;
3921
+ requestId?: string;
3922
+ detail?: unknown;
3923
+ retryable?: boolean;
3924
+ });
3925
+ }
3926
+ /** 429 and 5xx are the transient classes worth retrying. */
3927
+ declare function isRetryableStatus(status: number): boolean;
3928
+ /**
3929
+ * Parse a `Retry-After` header into milliseconds. Supports both the
3930
+ * delta-seconds form (`"2"`) and the HTTP-date form. Returns null when absent
3931
+ * or unparseable so the caller falls back to computed backoff.
3932
+ */
3933
+ declare function parseRetryAfter(header: string | null | undefined, nowMs?: number): number | null;
3934
+ /** Exponential backoff with full jitter, capped at 10s. */
3935
+ declare function backoffDelayMs(attempt: number, baseMs?: number, rand?: () => number): number;
3936
+ interface RequestOptions {
3937
+ method?: string;
3938
+ body?: unknown;
3939
+ headers?: Record<string, string>;
3940
+ query?: Record<string, unknown>;
3941
+ /** Sent as the `Idempotency-Key` header (safe POST retries; see A6). */
3942
+ idempotencyKey?: string;
3943
+ /** Max retry attempts on 429/5xx/network (default 2 -> up to 3 tries). */
3944
+ maxRetries?: number;
3945
+ /** Base backoff in ms (default 200). */
3946
+ retryBaseMs?: number;
3947
+ signal?: AbortSignal;
3948
+ /** Injected for tests; defaults to global fetch. */
3949
+ fetchImpl?: typeof fetch;
3950
+ /** Injected for tests; defaults to a real setTimeout sleep. */
3951
+ sleepImpl?: (ms: number) => Promise<void>;
3952
+ }
3953
+ /**
3954
+ * Perform a JSON request with retries + typed errors. Returns the parsed JSON
3955
+ * envelope (callers unwrap `.data` as today). Throws `G8Error` on any non-2xx
3956
+ * after exhausting retries.
3957
+ */
3958
+ declare function request<T = unknown>(baseUrl: string, path: string, apiKey: string, opts?: RequestOptions): Promise<T>;
3959
+ interface PaginatedResponse<T> {
3960
+ data: T[];
3961
+ pagination?: {
3962
+ next_cursor?: string | null;
3963
+ has_next?: boolean;
3964
+ page?: number;
3965
+ };
3966
+ }
3967
+ /**
3968
+ * Auto-pagination async iterator following `next_cursor` (A9). Yields every
3969
+ * item across pages so callers can `for await (const x of paginate(...))`
3970
+ * without manual cursor bookkeeping.
3971
+ */
3972
+ declare function paginate<T>(fetchPage: (cursor?: string) => Promise<PaginatedResponse<T>>): AsyncGenerator<T, void, unknown>;
3973
+
3974
+ export { type AddToSequenceConfig, type AgencyClient, type AgencyInfo, type AnalyticsOverview, type AudienceSync, type AudienceSyncCreateParams, type AudienceSyncError, type AudienceSyncMode, type AudienceSyncPlatform, type AudienceSyncRun, type AudienceSyncUpdateParams, type Booking, type BookingRequest, type CalendarConfig, type CallAnalysis, type CallGradingResult, type Campaign, type CampaignCreateConfig, type CampaignStats, type ChatConfig, type Company, type CompanyColumn, type CompanyColumnCreateParams, type CompanyContact, type CompanyEnrichment, type CompanyListParams, type CompanyUpdateParams, type ConstructEventOptions, type Contact, type ContactColumn, type ContactColumnCreateParams, type ContactCreateParams, type ContactDeal, type ContactList, type ContactListParams, type ContactUpdateParams, type CopilotConfig, type CreatedField, type Deal, type DealCreateParams, type DealListParams, type DealUpdateParams, type DialerAgentSummary, type DialerAgentsListParams, type DialerAgentsListResult, type DialerNumberInfo, type DialerNumbersListResult, type DialerReportFilters, type DialerReportMetric, type DialerSessionCreateParams, type DialerSessionCreateResult, type DialerSessionResumeResult, type DialerSessionStatus, type DialerSessionStatusUpdateResult, type DialerSessionSummary, type DialerSessionsListParams, type DialerSessionsListResult, type DialerStatsParams, type DialerStatsResult, type EmailVerification, type EnrichLookupResult, type EvidenceKey, type Field, type FieldCreateParams, type FieldDeleteParams, type G8Config, G8Error, type G8PrivacyConfig, type GlobalContextDocument, type ICP, type IdentifyProperties, type InboxAssignResult, type InboxAssignee, type InboxChannel, type InboxContact, type InboxDraft, type InboxListParams, type InboxMessage, type InboxSendParams, type InboxSendResult, type InboxTag, type InboxTagResult, type InboxThread, type Integration, type IntelligenceData, type IntentCompany, type IntentContact, type IntentKeyword, type IntentPage, type IntentSignals, type IntentStats, type IntentVisitor, KNOWN_WEBHOOK_EVENTS, type LandingPage, type ListContact, type MarketplaceHiring, type MarketplaceOffer, type MarketplaceProfile, type MeetingAnalysis, type MeetingAttendee, type MeetingDetail, type MeetingListParams, type MeetingSummary, type MeetingTranscriptLine, type MissedCallback, type MissedCallbacksResult, type NodeTypeSchema, type Note, type PaginatedResponse, type PaginationMeta$1 as PaginationMeta, type PersonEnrichment, type Persona, type Pipeline, type PipelineStage, type PipelineSuggestion, type QuotableProduct, type QuoteCreateParams, type QuoteDetail, type QuoteLineItem, type QuoteListParams, type QuoteSendParams, type QuoteSettings, type QuoteStatus, type QuoteSummary, type QuoteUpdateParams, type RequestOptions, type ResearchReport, type SearchCompanyItem, type SearchCondition, type SearchContactItem, type SearchFilter, type SearchOperator, type SearchParams, type SearchResults, type SearchSaveParams, type SearchSaveResult, type Sequence, type SequenceActionResult, type SequenceAnalytics, type SequenceChannelConfig, type SequenceContactItem, type SequenceContactsParams, type SequenceCreateParams, type SequenceCreateResult, type SequenceDetail, type SequenceKind, type SequenceListItem, type SequenceListParams, type SequencePreview, type SequencePreviewChannel, type SequencePreviewStep, type SequenceStepConfig, type SequenceStepInputType, type SequenceStepType, type SequenceStepUpdateParams, type SequenceUpdateParams, type SetFieldValueParams, type Skill, type SkillCreateAPIParams, type SkillCreateLLMParams, type SkillInputField, type SkillListParams, type SkillTemplate, type SkillType, type SkillUpdateAPIParams, type SkillUpdateLLMParams, type Snippet, type StageCreateParams, type StagePipeline, type StagePipelineCreateParams, type StagePipelineStage, type StagePipelineUpdateParams, type StageUpdateParams, type Task, type TaskCreateParams, type TaskListParams, type TaskUpdateParams, type TimeSlot, type TrackProperties, type VisitorCompany, type VisitorScore, type VoicePagination, type VoiceSession, type WebhookEvent, type WebhookEventPayload, WebhookSignatureError, type Workflow, type WorkflowConfig, type WorkflowConnection, type WorkflowCreateParams, type WorkflowExecution, type WorkflowListParams, type WorkflowNode, type WorkflowUpdateParams, backoffDelayMs, constructEvent, g8, isRetryableStatus, paginate, parseRetryAfter, request };