@graph8/sdk 0.5.3 → 0.7.2
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/README.md +13 -5
- package/dist/index.d.mts +608 -68
- package/dist/index.d.ts +608 -68
- package/dist/index.js +940 -907
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +930 -906
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +483 -52
- package/dist/react.d.ts +483 -52
- package/dist/react.js +910 -905
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +910 -905
- package/dist/react.mjs.map +1 -1
- package/package.json +24 -7
package/dist/index.d.mts
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;
|
|
@@ -585,7 +893,8 @@ interface WorkflowListParams {
|
|
|
585
893
|
}
|
|
586
894
|
/**
|
|
587
895
|
* Workflows API - automation workflows with nodes, connections, and execution lifecycle.
|
|
588
|
-
* 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.
|
|
589
898
|
*
|
|
590
899
|
* The graph8 workflow surface treats the whole workflow definition as a single
|
|
591
900
|
* record updated via `update()` — there are no per-node CRUD endpoints. To edit
|
|
@@ -650,9 +959,9 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
|
|
|
650
959
|
}>;
|
|
651
960
|
/** Execute a workflow immediately with a trigger payload. */
|
|
652
961
|
execute(workflowId: string, triggerPayload?: Record<string, unknown>): Promise<WorkflowExecution>;
|
|
653
|
-
/** Get the status +
|
|
962
|
+
/** Get the status + outputs of a single execution. */
|
|
654
963
|
getExecution(executionId: string): Promise<WorkflowExecution>;
|
|
655
|
-
/** Pause
|
|
964
|
+
/** Pause a running execution. */
|
|
656
965
|
pauseExecution(executionId: string): Promise<{
|
|
657
966
|
data: {
|
|
658
967
|
paused: boolean;
|
|
@@ -664,34 +973,32 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
|
|
|
664
973
|
resumed: boolean;
|
|
665
974
|
};
|
|
666
975
|
}>;
|
|
667
|
-
/** Stop an execution
|
|
976
|
+
/** Stop an execution. */
|
|
668
977
|
stopExecution(executionId: string): Promise<{
|
|
669
978
|
data: {
|
|
670
979
|
stopped: boolean;
|
|
671
980
|
};
|
|
672
981
|
}>;
|
|
673
|
-
/** Get the status
|
|
982
|
+
/** Get the trigger status (e.g. schedule / webhook wiring) for a workflow. */
|
|
674
983
|
getTriggerStatus(workflowId: string): Promise<{
|
|
675
984
|
data: {
|
|
676
985
|
status: string;
|
|
677
986
|
details: Record<string, unknown>;
|
|
678
987
|
};
|
|
679
988
|
}>;
|
|
680
|
-
/** Reset
|
|
989
|
+
/** Reset a workflow's trigger cursor / state. */
|
|
681
990
|
resetTrigger(workflowId: string): Promise<{
|
|
682
991
|
data: {
|
|
683
992
|
reset: boolean;
|
|
684
993
|
};
|
|
685
994
|
}>;
|
|
686
|
-
/**
|
|
687
|
-
* List available node types with schemas. Pass a `type` param to fetch one type's full schema.
|
|
688
|
-
*/
|
|
995
|
+
/** Catalog of available workflow node types with config + output schemas. */
|
|
689
996
|
nodeTypes(params?: {
|
|
690
997
|
type?: string;
|
|
691
998
|
}): Promise<{
|
|
692
999
|
data: NodeTypeSchema[];
|
|
693
1000
|
}>;
|
|
694
|
-
/** Slack
|
|
1001
|
+
/** Slack users available to workflow nodes. */
|
|
695
1002
|
listSlackUsers(): Promise<{
|
|
696
1003
|
data: Array<{
|
|
697
1004
|
id: string;
|
|
@@ -699,7 +1006,7 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
|
|
|
699
1006
|
email: string | null;
|
|
700
1007
|
}>;
|
|
701
1008
|
}>;
|
|
702
|
-
/** Slack channels. */
|
|
1009
|
+
/** Slack channels available to workflow nodes. */
|
|
703
1010
|
listSlackChannels(): Promise<{
|
|
704
1011
|
data: Array<{
|
|
705
1012
|
id: string;
|
|
@@ -707,7 +1014,7 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
|
|
|
707
1014
|
is_private: boolean;
|
|
708
1015
|
}>;
|
|
709
1016
|
}>;
|
|
710
|
-
/** Roam
|
|
1017
|
+
/** Roam users available to workflow nodes. */
|
|
711
1018
|
listRoamUsers(): Promise<{
|
|
712
1019
|
data: Array<{
|
|
713
1020
|
id: string;
|
|
@@ -715,14 +1022,14 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
|
|
|
715
1022
|
email: string | null;
|
|
716
1023
|
}>;
|
|
717
1024
|
}>;
|
|
718
|
-
/** Roam
|
|
1025
|
+
/** Roam groups available to workflow nodes. */
|
|
719
1026
|
listRoamGroups(): Promise<{
|
|
720
1027
|
data: Array<{
|
|
721
1028
|
id: string;
|
|
722
1029
|
name: string;
|
|
723
1030
|
}>;
|
|
724
1031
|
}>;
|
|
725
|
-
/**
|
|
1032
|
+
/** MCP servers available to workflow nodes. */
|
|
726
1033
|
listMcpServers(): Promise<{
|
|
727
1034
|
data: Array<{
|
|
728
1035
|
id: string;
|
|
@@ -730,14 +1037,14 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
|
|
|
730
1037
|
url: string;
|
|
731
1038
|
}>;
|
|
732
1039
|
}>;
|
|
733
|
-
/**
|
|
1040
|
+
/** Disposition options available to workflow nodes. */
|
|
734
1041
|
listDispositions(): Promise<{
|
|
735
1042
|
data: Array<{
|
|
736
1043
|
id: string;
|
|
737
1044
|
label: string;
|
|
738
1045
|
}>;
|
|
739
1046
|
}>;
|
|
740
|
-
/** Form field
|
|
1047
|
+
/** Form field definitions for a given form (used by form-trigger nodes). */
|
|
741
1048
|
listFormFields(formId: string): Promise<{
|
|
742
1049
|
data: Array<{
|
|
743
1050
|
name: string;
|
|
@@ -820,7 +1127,8 @@ interface PipelineSuggestion {
|
|
|
820
1127
|
}
|
|
821
1128
|
/**
|
|
822
1129
|
* Stage Checklist Pipelines API - workflow pipelines with evidence + scripts.
|
|
823
|
-
* 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.
|
|
824
1132
|
*
|
|
825
1133
|
* Backed by:
|
|
826
1134
|
* GET /api/v1/pipelines
|
|
@@ -963,7 +1271,9 @@ interface PaginationMeta$2 {
|
|
|
963
1271
|
has_next: boolean;
|
|
964
1272
|
}
|
|
965
1273
|
/**
|
|
966
|
-
* 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.
|
|
967
1277
|
*
|
|
968
1278
|
* Backed by:
|
|
969
1279
|
* GET /api/v1/quotes
|
|
@@ -1116,7 +1426,9 @@ interface InboxSendResult {
|
|
|
1116
1426
|
}
|
|
1117
1427
|
/**
|
|
1118
1428
|
* Inbox API — read + reply to multi-channel inbox threads (email, SMS, LinkedIn/HeyReach).
|
|
1119
|
-
* 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.
|
|
1120
1432
|
*
|
|
1121
1433
|
* Backed by:
|
|
1122
1434
|
* GET /api/v1/inbox
|
|
@@ -1323,7 +1635,8 @@ interface SetFieldValueParams {
|
|
|
1323
1635
|
}
|
|
1324
1636
|
/**
|
|
1325
1637
|
* Fields API - manage custom fields (columns) on contacts and companies.
|
|
1326
|
-
* 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.
|
|
1327
1640
|
*
|
|
1328
1641
|
* Backed by:
|
|
1329
1642
|
* GET /api/v1/fields — list contact fields
|
|
@@ -1717,8 +2030,11 @@ declare const createContactsClient: (apiKey: string, apiUrl?: string) => {
|
|
|
1717
2030
|
}>;
|
|
1718
2031
|
/** Get a single contact by ID. */
|
|
1719
2032
|
get(contactId: number): Promise<Contact>;
|
|
1720
|
-
/**
|
|
1721
|
-
|
|
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>;
|
|
1722
2038
|
/** Update a contact (partial). */
|
|
1723
2039
|
update(contactId: number, fields: ContactUpdateParams): Promise<{
|
|
1724
2040
|
updated: number;
|
|
@@ -1735,18 +2051,76 @@ declare const createContactsClient: (apiKey: string, apiUrl?: string) => {
|
|
|
1735
2051
|
createColumn(params: ContactColumnCreateParams): Promise<ContactColumn>;
|
|
1736
2052
|
};
|
|
1737
2053
|
|
|
1738
|
-
type WebhookEvent = "reply_received" | "meeting_booked" | "contact_enriched" | "contact_created" | "sequence_completed" | "sequence_replied" | "campaign_launched" | "form_submitted" | "visitor_identified";
|
|
1739
|
-
type WebhookCallback = (data: Record<string, unknown>) => void;
|
|
1740
2054
|
/**
|
|
1741
|
-
*
|
|
2055
|
+
* Known graph8 webhook event types.
|
|
2056
|
+
*
|
|
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.
|
|
2061
|
+
*/
|
|
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``.
|
|
1742
2091
|
*
|
|
1743
|
-
*
|
|
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.)
|
|
1744
2116
|
*/
|
|
1745
|
-
declare const createWebhooksClient: (
|
|
1746
|
-
/**
|
|
1747
|
-
|
|
1748
|
-
/**
|
|
1749
|
-
|
|
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;
|
|
1750
2124
|
};
|
|
1751
2125
|
|
|
1752
2126
|
interface LandingPage {
|
|
@@ -1757,7 +2131,9 @@ interface LandingPage {
|
|
|
1757
2131
|
published_url: string | null;
|
|
1758
2132
|
}
|
|
1759
2133
|
/**
|
|
1760
|
-
* 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.
|
|
1761
2137
|
*/
|
|
1762
2138
|
declare const createPagesClient: (apiKey: string, apiUrl?: string) => {
|
|
1763
2139
|
/** Clone a landing page from any URL. */
|
|
@@ -2115,6 +2491,12 @@ interface AnalyticsOverview {
|
|
|
2115
2491
|
}
|
|
2116
2492
|
/**
|
|
2117
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.
|
|
2118
2500
|
*/
|
|
2119
2501
|
declare const createAnalyticsClient: (apiKey: string, apiUrl?: string) => {
|
|
2120
2502
|
overview(config?: {
|
|
@@ -2147,7 +2529,9 @@ interface Integration {
|
|
|
2147
2529
|
connected_at: string | null;
|
|
2148
2530
|
}
|
|
2149
2531
|
/**
|
|
2150
|
-
* Integrations - connect CRM platforms, trigger syncs. Requires API key
|
|
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.
|
|
2151
2535
|
*/
|
|
2152
2536
|
declare const createIntegrationsClient: (apiKey: string, apiUrl?: string) => {
|
|
2153
2537
|
list(): Promise<Integration[]>;
|
|
@@ -2183,6 +2567,8 @@ interface CampaignStats {
|
|
|
2183
2567
|
}
|
|
2184
2568
|
/**
|
|
2185
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.
|
|
2186
2572
|
*/
|
|
2187
2573
|
declare const createCampaignsClient: (apiKey: string, apiUrl?: string) => {
|
|
2188
2574
|
list(page?: number, limit?: number): Promise<Campaign[]>;
|
|
@@ -2408,22 +2794,40 @@ declare const createSequencesClient: (apiKey: string, apiUrl?: string) => {
|
|
|
2408
2794
|
data: SequenceContactItem[];
|
|
2409
2795
|
pagination?: PaginationMeta;
|
|
2410
2796
|
}>;
|
|
2411
|
-
/**
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2797
|
+
/**
|
|
2798
|
+
* Add contacts to a sequence (V2 queuing). Live or drafted sequences only.
|
|
2799
|
+
* Pass `idempotencyKey` to make a retry safe — the same key returns the
|
|
2800
|
+
* first result instead of re-enrolling on a 5xx-then-success (A6).
|
|
2801
|
+
*/
|
|
2802
|
+
add(config: AddToSequenceConfig, idempotencyKey?: string): Promise<SequenceActionResult>;
|
|
2803
|
+
/**
|
|
2804
|
+
* Create a new sequence with optional steps + channels. Pass `idempotencyKey`
|
|
2805
|
+
* to make a retry safe — the same key returns the first result instead of
|
|
2806
|
+
* creating a duplicate sequence on a 5xx-then-success (A6).
|
|
2807
|
+
*/
|
|
2808
|
+
create(payload: SequenceCreateParams, idempotencyKey?: string): Promise<SequenceCreateResult>;
|
|
2415
2809
|
/** Update sequence metadata. Rejected (409) if sequence is in a transitional status. */
|
|
2416
2810
|
update(sequenceId: string, fields: SequenceUpdateParams): Promise<SequenceActionResult>;
|
|
2417
2811
|
/** Update a single step within a sequence. */
|
|
2418
2812
|
updateStep(sequenceId: string, stepId: string, fields: SequenceStepUpdateParams): Promise<SequenceActionResult>;
|
|
2419
2813
|
/** Soft-delete (archive) a sequence. */
|
|
2420
2814
|
delete(sequenceId: string): Promise<SequenceActionResult>;
|
|
2421
|
-
/**
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2815
|
+
/**
|
|
2816
|
+
* Run/start a DRAFTED sequence (V2 orchestration). Pass `idempotencyKey` to
|
|
2817
|
+
* make a retry safe — the same key won't re-trigger the run on a
|
|
2818
|
+
* 5xx-then-success (A6).
|
|
2819
|
+
*/
|
|
2820
|
+
run(sequenceId: string, idempotencyKey?: string): Promise<SequenceActionResult>;
|
|
2821
|
+
/**
|
|
2822
|
+
* Pause a live sequence. Pass `idempotencyKey` to make a retry safe — the
|
|
2823
|
+
* same key won't double-apply on a 5xx-then-success (A6).
|
|
2824
|
+
*/
|
|
2825
|
+
pause(sequenceId: string, idempotencyKey?: string): Promise<SequenceActionResult>;
|
|
2826
|
+
/**
|
|
2827
|
+
* Resume a paused sequence. Pass `idempotencyKey` to make a retry safe — the
|
|
2828
|
+
* same key won't double-apply on a 5xx-then-success (A6).
|
|
2829
|
+
*/
|
|
2830
|
+
resume(sequenceId: string, idempotencyKey?: string): Promise<SequenceActionResult>;
|
|
2427
2831
|
/** Read-only sequence preview with all steps + channels (no enrollment). */
|
|
2428
2832
|
preview(sequenceId: string): Promise<SequencePreview>;
|
|
2429
2833
|
/** Comprehensive analytics for a sequence. */
|
|
@@ -2459,7 +2863,8 @@ interface SearchResults {
|
|
|
2459
2863
|
/**
|
|
2460
2864
|
* Enrichment API - person/company lookup, email verification, prospecting search.
|
|
2461
2865
|
*
|
|
2462
|
-
* Requires API key (server-side only). Credits charged per call.
|
|
2866
|
+
* Requires API key (server-side only). Credits charged per call. On the hardened
|
|
2867
|
+
* HTTP core: throws a typed `G8Error` on failure and retries transient errors.
|
|
2463
2868
|
*/
|
|
2464
2869
|
declare const createEnrichClient: (apiKey: string, apiUrl?: string) => {
|
|
2465
2870
|
/** Look up a person by email, LinkedIn, or name + company. Costs 1 credit. */
|
|
@@ -2736,6 +3141,11 @@ declare class G8 {
|
|
|
2736
3141
|
/** @internal */ _intent: ReturnType<typeof createIntentClient> | null;
|
|
2737
3142
|
/** @internal */ _studio: ReturnType<typeof createStudioClient> | null;
|
|
2738
3143
|
/** @internal */ _meetings: ReturnType<typeof createMeetingsClient> | null;
|
|
3144
|
+
/** @internal */ _audiences: ReturnType<typeof createAudiencesClient> | null;
|
|
3145
|
+
/** @internal */ _search: ReturnType<typeof createSearchClient> | null;
|
|
3146
|
+
/** @internal */ _agency: ReturnType<typeof createAgencyClient> | null;
|
|
3147
|
+
/** @internal */ _marketplace: ReturnType<typeof createMarketplaceClient> | null;
|
|
3148
|
+
/** @internal */ _snippet: ReturnType<typeof createSnippetClient> | null;
|
|
2739
3149
|
/**
|
|
2740
3150
|
* Initialize the graph8 SDK. Must be called before any other method.
|
|
2741
3151
|
* Safe to call on the server (SSR) - becomes a no-op for tracking.
|
|
@@ -2796,19 +3206,7 @@ declare class G8 {
|
|
|
2796
3206
|
company_domain?: string;
|
|
2797
3207
|
}): Promise<PersonEnrichment>;
|
|
2798
3208
|
company(params: {
|
|
2799
|
-
domain
|
|
2800
|
-
/**
|
|
2801
|
-
* graph8 SDK client.
|
|
2802
|
-
*
|
|
2803
|
-
* Handles event tracking, identity, and progressive forms.
|
|
2804
|
-
*
|
|
2805
|
-
* Usage:
|
|
2806
|
-
* import { g8 } from '@graph8/js';
|
|
2807
|
-
* g8.init({ writeKey: 'your_write_key' });
|
|
2808
|
-
* g8.track('page_view', { page: '/pricing' });
|
|
2809
|
-
* g8.identify('user@acme.com', { name: 'John', company: 'Acme' });
|
|
2810
|
-
*/
|
|
2811
|
-
?: string;
|
|
3209
|
+
domain?: string;
|
|
2812
3210
|
name?: string;
|
|
2813
3211
|
}): Promise<CompanyEnrichment>;
|
|
2814
3212
|
verifyEmail(email: string): Promise<EmailVerification>;
|
|
@@ -2826,14 +3224,14 @@ declare class G8 {
|
|
|
2826
3224
|
data: SequenceContactItem[];
|
|
2827
3225
|
pagination?: PaginationMeta;
|
|
2828
3226
|
}>;
|
|
2829
|
-
add(config: AddToSequenceConfig): Promise<SequenceActionResult>;
|
|
2830
|
-
create(payload: SequenceCreateParams): Promise<SequenceCreateResult>;
|
|
3227
|
+
add(config: AddToSequenceConfig, idempotencyKey?: string): Promise<SequenceActionResult>;
|
|
3228
|
+
create(payload: SequenceCreateParams, idempotencyKey?: string): Promise<SequenceCreateResult>;
|
|
2831
3229
|
update(sequenceId: string, fields: SequenceUpdateParams): Promise<SequenceActionResult>;
|
|
2832
3230
|
updateStep(sequenceId: string, stepId: string, fields: SequenceStepUpdateParams): Promise<SequenceActionResult>;
|
|
2833
3231
|
delete(sequenceId: string): Promise<SequenceActionResult>;
|
|
2834
|
-
run(sequenceId: string): Promise<SequenceActionResult>;
|
|
2835
|
-
pause(sequenceId: string): Promise<SequenceActionResult>;
|
|
2836
|
-
resume(sequenceId: string): Promise<SequenceActionResult>;
|
|
3232
|
+
run(sequenceId: string, idempotencyKey?: string): Promise<SequenceActionResult>;
|
|
3233
|
+
pause(sequenceId: string, idempotencyKey?: string): Promise<SequenceActionResult>;
|
|
3234
|
+
resume(sequenceId: string, idempotencyKey?: string): Promise<SequenceActionResult>;
|
|
2837
3235
|
preview(sequenceId: string): Promise<SequencePreview>;
|
|
2838
3236
|
analytics(sequenceId: string): Promise<SequenceAnalytics>;
|
|
2839
3237
|
};
|
|
@@ -2934,8 +3332,9 @@ declare class G8 {
|
|
|
2934
3332
|
};
|
|
2935
3333
|
/** Webhook event listeners (requires API key). */
|
|
2936
3334
|
get webhooks(): {
|
|
2937
|
-
|
|
2938
|
-
|
|
3335
|
+
baseUrl: string;
|
|
3336
|
+
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"];
|
|
3337
|
+
constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
|
|
2939
3338
|
};
|
|
2940
3339
|
/** Contacts CRUD (requires API key). */
|
|
2941
3340
|
get contacts(): {
|
|
@@ -2944,7 +3343,7 @@ declare class G8 {
|
|
|
2944
3343
|
total: number;
|
|
2945
3344
|
}>;
|
|
2946
3345
|
get(contactId: number): Promise<Contact>;
|
|
2947
|
-
create(contact: ContactCreateParams): Promise<Contact>;
|
|
3346
|
+
create(contact: ContactCreateParams, idempotencyKey?: string): Promise<Contact>;
|
|
2948
3347
|
update(contactId: number, fields: ContactUpdateParams): Promise<{
|
|
2949
3348
|
updated: number;
|
|
2950
3349
|
}>;
|
|
@@ -3346,7 +3745,7 @@ declare class G8 {
|
|
|
3346
3745
|
}>;
|
|
3347
3746
|
keywordContacts(keywordId: string, params?: {
|
|
3348
3747
|
limit?: number;
|
|
3349
|
-
date_from
|
|
3748
|
+
date_from?: string;
|
|
3350
3749
|
date_to?: string;
|
|
3351
3750
|
}): Promise<{
|
|
3352
3751
|
data: IntentContact[];
|
|
@@ -3409,7 +3808,7 @@ declare class G8 {
|
|
|
3409
3808
|
}>;
|
|
3410
3809
|
personas(params?: {
|
|
3411
3810
|
status?: string;
|
|
3412
|
-
limit
|
|
3811
|
+
limit? /** @internal */: number;
|
|
3413
3812
|
}): Promise<{
|
|
3414
3813
|
data: Persona[];
|
|
3415
3814
|
}>;
|
|
@@ -3439,6 +3838,63 @@ declare class G8 {
|
|
|
3439
3838
|
}>;
|
|
3440
3839
|
get(meetingId: string): Promise<MeetingDetail>;
|
|
3441
3840
|
};
|
|
3841
|
+
/** Audiences — sync audience lists to ad platforms (Meta, LinkedIn, Google, X) (requires API key). */
|
|
3842
|
+
get audiences(): {
|
|
3843
|
+
list(): Promise<{
|
|
3844
|
+
data: AudienceSync[];
|
|
3845
|
+
}>;
|
|
3846
|
+
create(params: AudienceSyncCreateParams): Promise<AudienceSync>;
|
|
3847
|
+
get(configId: number): Promise<AudienceSync>;
|
|
3848
|
+
update(configId: number, fields: AudienceSyncUpdateParams): Promise<AudienceSync>;
|
|
3849
|
+
delete(configId: number): Promise<{
|
|
3850
|
+
data: Record<string, unknown>;
|
|
3851
|
+
}>;
|
|
3852
|
+
trigger(configId: number): Promise<{
|
|
3853
|
+
data: Record<string, unknown>;
|
|
3854
|
+
}>;
|
|
3855
|
+
runs(configId: number): Promise<{
|
|
3856
|
+
data: AudienceSyncRun[];
|
|
3857
|
+
}>;
|
|
3858
|
+
errors(configId: number): Promise<{
|
|
3859
|
+
data: AudienceSyncError[];
|
|
3860
|
+
}>;
|
|
3861
|
+
};
|
|
3862
|
+
/** Search — prospect open-data contacts + companies by filter, optionally save to a list (requires API key). */
|
|
3863
|
+
get search(): {
|
|
3864
|
+
contacts(params?: SearchParams): Promise<{
|
|
3865
|
+
data: SearchContactItem[];
|
|
3866
|
+
}>;
|
|
3867
|
+
companies(params?: SearchParams): Promise<{
|
|
3868
|
+
data: SearchCompanyItem[];
|
|
3869
|
+
}>;
|
|
3870
|
+
saveContacts(params: SearchSaveParams): Promise<SearchSaveResult>;
|
|
3871
|
+
saveCompanies(params: SearchSaveParams): Promise<SearchSaveResult>;
|
|
3872
|
+
};
|
|
3873
|
+
/** Agency — for agency keys: discover the agency credential + the client orgs it may target (requires API key). */
|
|
3874
|
+
get agency(): {
|
|
3875
|
+
me(): Promise<AgencyInfo>;
|
|
3876
|
+
clients(): Promise<{
|
|
3877
|
+
data: AgencyClient[];
|
|
3878
|
+
}>;
|
|
3879
|
+
};
|
|
3880
|
+
/** Marketplace — for SDR/AE talent: profile, hire offers (accept/reject), active hirings (requires API key). */
|
|
3881
|
+
get marketplace(): {
|
|
3882
|
+
profile(): Promise<MarketplaceProfile>;
|
|
3883
|
+
offers(): Promise<{
|
|
3884
|
+
offers: MarketplaceOffer[];
|
|
3885
|
+
count: number;
|
|
3886
|
+
}>;
|
|
3887
|
+
acceptOffer(hiringId: string): Promise<Record<string, unknown>>;
|
|
3888
|
+
rejectOffer(hiringId: string): Promise<Record<string, unknown>>;
|
|
3889
|
+
hirings(): Promise<{
|
|
3890
|
+
hirings: MarketplaceHiring[];
|
|
3891
|
+
count: number;
|
|
3892
|
+
}>;
|
|
3893
|
+
};
|
|
3894
|
+
/** Snippet — fetch your org's tracking snippet (write key + React/script-tag embeds + config) for embedding (requires API key). */
|
|
3895
|
+
get snippet(): {
|
|
3896
|
+
get(): Promise<Snippet>;
|
|
3897
|
+
};
|
|
3442
3898
|
/** Whether the SDK has been initialized. */
|
|
3443
3899
|
get initialized(): boolean;
|
|
3444
3900
|
/** @internal */
|
|
@@ -3449,4 +3905,88 @@ declare class G8 {
|
|
|
3449
3905
|
/** Singleton g8 client instance. */
|
|
3450
3906
|
declare const g8: G8;
|
|
3451
3907
|
|
|
3452
|
-
|
|
3908
|
+
/**
|
|
3909
|
+
* Hardened HTTP core for the graph8 JS SDK (sprint B2).
|
|
3910
|
+
*
|
|
3911
|
+
* Resource clients historically called `fetch` directly and returned
|
|
3912
|
+
* `resp.json()` even on a 4xx/5xx — so API errors surfaced silently as "data".
|
|
3913
|
+
* This module centralizes the request path with:
|
|
3914
|
+
*
|
|
3915
|
+
* - a typed `G8Error` (status, type, code, request_id, detail) thrown on any
|
|
3916
|
+
* non-2xx response, parsed from the standard ApiError envelope;
|
|
3917
|
+
* - automatic retry with exponential backoff + jitter on 429 and 5xx,
|
|
3918
|
+
* honoring the `Retry-After` header;
|
|
3919
|
+
* - `Idempotency-Key` support for safe POST retries (pairs with the backend
|
|
3920
|
+
* idempotency added in A6);
|
|
3921
|
+
* - a cursor `paginate()` async-iterator that follows `next_cursor` (A9).
|
|
3922
|
+
*
|
|
3923
|
+
* `fetch` and `sleep` are injectable so the retry/backoff logic is
|
|
3924
|
+
* deterministically unit-testable without real timers or network.
|
|
3925
|
+
*/
|
|
3926
|
+
declare class G8Error extends Error {
|
|
3927
|
+
readonly status: number;
|
|
3928
|
+
readonly type: string;
|
|
3929
|
+
readonly code?: string;
|
|
3930
|
+
readonly requestId?: string;
|
|
3931
|
+
readonly detail?: unknown;
|
|
3932
|
+
/** True when the failure class is transient (429/5xx/network). */
|
|
3933
|
+
readonly retryable: boolean;
|
|
3934
|
+
constructor(args: {
|
|
3935
|
+
message: string;
|
|
3936
|
+
status: number;
|
|
3937
|
+
type: string;
|
|
3938
|
+
code?: string;
|
|
3939
|
+
requestId?: string;
|
|
3940
|
+
detail?: unknown;
|
|
3941
|
+
retryable?: boolean;
|
|
3942
|
+
});
|
|
3943
|
+
}
|
|
3944
|
+
/** 429 and 5xx are the transient classes worth retrying. */
|
|
3945
|
+
declare function isRetryableStatus(status: number): boolean;
|
|
3946
|
+
/**
|
|
3947
|
+
* Parse a `Retry-After` header into milliseconds. Supports both the
|
|
3948
|
+
* delta-seconds form (`"2"`) and the HTTP-date form. Returns null when absent
|
|
3949
|
+
* or unparseable so the caller falls back to computed backoff.
|
|
3950
|
+
*/
|
|
3951
|
+
declare function parseRetryAfter(header: string | null | undefined, nowMs?: number): number | null;
|
|
3952
|
+
/** Exponential backoff with full jitter, capped at 10s. */
|
|
3953
|
+
declare function backoffDelayMs(attempt: number, baseMs?: number, rand?: () => number): number;
|
|
3954
|
+
interface RequestOptions {
|
|
3955
|
+
method?: string;
|
|
3956
|
+
body?: unknown;
|
|
3957
|
+
headers?: Record<string, string>;
|
|
3958
|
+
query?: Record<string, unknown>;
|
|
3959
|
+
/** Sent as the `Idempotency-Key` header (safe POST retries; see A6). */
|
|
3960
|
+
idempotencyKey?: string;
|
|
3961
|
+
/** Max retry attempts on 429/5xx/network (default 2 -> up to 3 tries). */
|
|
3962
|
+
maxRetries?: number;
|
|
3963
|
+
/** Base backoff in ms (default 200). */
|
|
3964
|
+
retryBaseMs?: number;
|
|
3965
|
+
signal?: AbortSignal;
|
|
3966
|
+
/** Injected for tests; defaults to global fetch. */
|
|
3967
|
+
fetchImpl?: typeof fetch;
|
|
3968
|
+
/** Injected for tests; defaults to a real setTimeout sleep. */
|
|
3969
|
+
sleepImpl?: (ms: number) => Promise<void>;
|
|
3970
|
+
}
|
|
3971
|
+
/**
|
|
3972
|
+
* Perform a JSON request with retries + typed errors. Returns the parsed JSON
|
|
3973
|
+
* envelope (callers unwrap `.data` as today). Throws `G8Error` on any non-2xx
|
|
3974
|
+
* after exhausting retries.
|
|
3975
|
+
*/
|
|
3976
|
+
declare function request<T = unknown>(baseUrl: string, path: string, apiKey: string, opts?: RequestOptions): Promise<T>;
|
|
3977
|
+
interface PaginatedResponse<T> {
|
|
3978
|
+
data: T[];
|
|
3979
|
+
pagination?: {
|
|
3980
|
+
next_cursor?: string | null;
|
|
3981
|
+
has_next?: boolean;
|
|
3982
|
+
page?: number;
|
|
3983
|
+
};
|
|
3984
|
+
}
|
|
3985
|
+
/**
|
|
3986
|
+
* Auto-pagination async iterator following `next_cursor` (A9). Yields every
|
|
3987
|
+
* item across pages so callers can `for await (const x of paginate(...))`
|
|
3988
|
+
* without manual cursor bookkeeping.
|
|
3989
|
+
*/
|
|
3990
|
+
declare function paginate<T>(fetchPage: (cursor?: string) => Promise<PaginatedResponse<T>>): AsyncGenerator<T, void, unknown>;
|
|
3991
|
+
|
|
3992
|
+
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 };
|