@graph8/sdk 0.244.0 → 0.251.0
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 +10 -3
- package/dist/index.d.mts +186 -11
- package/dist/index.d.ts +186 -11
- package/dist/index.js +46 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +175 -7
- package/dist/react.d.ts +175 -7
- package/dist/react.js +45 -0
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +45 -0
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -459,6 +459,7 @@ var BILLABLE_ROUTES = {
|
|
|
459
459
|
"/enrichment/lists/{list_id}/pipelines/{pipeline_id}/runs",
|
|
460
460
|
"/enrichment/lookup/company",
|
|
461
461
|
"/enrichment/lookup/person",
|
|
462
|
+
"/enrichment/person",
|
|
462
463
|
"/enrichment/record-sync/{entity_type}/run",
|
|
463
464
|
"/enrichment/verify-email",
|
|
464
465
|
"/enrichment/waterfall/configs",
|
|
@@ -967,6 +968,10 @@ var EXTERNAL_ROUTES = {
|
|
|
967
968
|
]
|
|
968
969
|
};
|
|
969
970
|
|
|
971
|
+
// src/version.ts
|
|
972
|
+
var SDK_VERSION = "0.251.0";
|
|
973
|
+
var SDK_CLIENT_ID = `js-sdk/${SDK_VERSION}`;
|
|
974
|
+
|
|
970
975
|
// src/http.ts
|
|
971
976
|
var G8Error = class _G8Error extends Error {
|
|
972
977
|
constructor(args) {
|
|
@@ -1149,6 +1154,7 @@ async function request(baseUrl, path, apiKey, opts = {}) {
|
|
|
1149
1154
|
const finalHeaders = {
|
|
1150
1155
|
"Content-Type": "application/json",
|
|
1151
1156
|
Authorization: `Bearer ${apiKey}`,
|
|
1157
|
+
...clientIdentityHeaders(headers),
|
|
1152
1158
|
...headers
|
|
1153
1159
|
};
|
|
1154
1160
|
warnIfTargetOrgIgnored(apiKey, headers);
|
|
@@ -1194,6 +1200,23 @@ async function request(baseUrl, path, apiKey, opts = {}) {
|
|
|
1194
1200
|
throw await toG8Error(resp, billable ? statusRetryable : isRetryableStatus(resp.status));
|
|
1195
1201
|
}
|
|
1196
1202
|
}
|
|
1203
|
+
function isServerRuntime() {
|
|
1204
|
+
const g = globalThis;
|
|
1205
|
+
if (typeof g.window !== "undefined") return false;
|
|
1206
|
+
return typeof g.process?.versions?.node === "string";
|
|
1207
|
+
}
|
|
1208
|
+
function runtimeUserAgent() {
|
|
1209
|
+
const g = globalThis;
|
|
1210
|
+
const node = typeof g.process?.version === "string" ? ` node/${g.process.version.replace(/^v/, "")}` : "";
|
|
1211
|
+
return `graph8-sdk-js/${SDK_VERSION}${node}`;
|
|
1212
|
+
}
|
|
1213
|
+
function clientIdentityHeaders(callerHeaders = {}) {
|
|
1214
|
+
const taken = new Set(Object.keys(callerHeaders).map((h) => h.toLowerCase()));
|
|
1215
|
+
const out = {};
|
|
1216
|
+
if (!taken.has("x-g8-client")) out["X-G8-Client"] = SDK_CLIENT_ID;
|
|
1217
|
+
if (!taken.has("user-agent") && isServerRuntime()) out["User-Agent"] = runtimeUserAgent();
|
|
1218
|
+
return out;
|
|
1219
|
+
}
|
|
1197
1220
|
async function* paginate(fetchPage) {
|
|
1198
1221
|
let cursor = void 0;
|
|
1199
1222
|
for (; ; ) {
|
|
@@ -1820,6 +1843,10 @@ var createContactsClient = (apiKey, apiUrl) => {
|
|
|
1820
1843
|
/**
|
|
1821
1844
|
* Create a new contact. Pass `idempotencyKey` to make a retry safe — the
|
|
1822
1845
|
* same key returns the first result instead of creating a duplicate (A6).
|
|
1846
|
+
*
|
|
1847
|
+
* Create-only: if a contact with the same work_email / linkedin_url exists,
|
|
1848
|
+
* this throws a 409 `G8Error` whose `detail.hint` / `detail.upsert` name the
|
|
1849
|
+
* create-or-update route. When the contact may already exist, use `upsert()`.
|
|
1823
1850
|
*/
|
|
1824
1851
|
async create(contact, idempotencyKey) {
|
|
1825
1852
|
const resp = await request(baseUrl, "/api/v1/contacts", apiKey, {
|
|
@@ -1829,6 +1856,20 @@ var createContactsClient = (apiKey, apiUrl) => {
|
|
|
1829
1856
|
});
|
|
1830
1857
|
return resp.data ?? resp;
|
|
1831
1858
|
},
|
|
1859
|
+
/**
|
|
1860
|
+
* Create or update a contact in one idempotent call (`PUT /contacts/assert`).
|
|
1861
|
+
* Matches by `work_email`, then `linkedin_url`. Prefer this over `create()`
|
|
1862
|
+
* when the contact may already exist: `create()` returns a 409 for a
|
|
1863
|
+
* duplicate, while `upsert()` updates it. Safe to retry. The server answers
|
|
1864
|
+
* 400 (a `G8Error`) when neither `work_email` nor `linkedin_url` is given.
|
|
1865
|
+
*/
|
|
1866
|
+
async upsert(contact) {
|
|
1867
|
+
const resp = await request(baseUrl, "/api/v1/contacts/assert", apiKey, {
|
|
1868
|
+
method: "PUT",
|
|
1869
|
+
body: contact
|
|
1870
|
+
});
|
|
1871
|
+
return resp.data ?? resp;
|
|
1872
|
+
},
|
|
1832
1873
|
/** Update a contact (partial). */
|
|
1833
1874
|
async update(contactId, fields) {
|
|
1834
1875
|
return request(baseUrl, `/api/v1/contacts/${contactId}`, apiKey, {
|
|
@@ -2142,6 +2183,7 @@ var API_OPERATIONS = {
|
|
|
2142
2183
|
analyze_website_intelligence_analyze_post: ["POST", "/intelligence/analyze", "companyIntelligence", "analyzeWebsite", "billable", "knowledge:run"],
|
|
2143
2184
|
annotate_my_invoice_marketplace_me_invoices__invoice_id__put: ["PUT", "/marketplace/me/invoices/{invoice_id}", "marketplace", "annotateMyInvoice", "billable", "marketplace:run"],
|
|
2144
2185
|
answer_agent_discovery_agent_onboarding_discovery_answer_post: ["POST", "/agent/onboarding/discovery/answer", "agents", "answerAgentDiscovery", "write", "workflows:write"],
|
|
2186
|
+
api_health_health_get: ["GET", "/health", "health", "apiHealth", "read", null],
|
|
2145
2187
|
app_token_jwks_app_platform__well_known_jwks_json_get: ["GET", "/app-platform/.well-known/jwks.json", "appPlatformTokens", "appTokenJwks", "read", null],
|
|
2146
2188
|
append_copilot_memory_document_copilot_memory_documents_append_post: ["POST", "/copilot/memory/documents/append", "copilot", "appendCopilotMemoryDocument", "write", "knowledge:write"],
|
|
2147
2189
|
apply_account_plan_desk_accounts__account_id__plan_apply_post: ["POST", "/desk/accounts/{account_id}/plan/apply", "desk", "applyAccountPlan", "write", "deals:write"],
|
|
@@ -2222,6 +2264,7 @@ var API_OPERATIONS = {
|
|
|
2222
2264
|
backfill_content_pages_content_pages_backfill_post: ["POST", "/content/pages/backfill", "content", "backfillContentPages", "write", "campaigns:write"],
|
|
2223
2265
|
backfill_grading_dialer_parallel_calls_grading_backfill_post: ["POST", "/dialer/parallel-calls/grading/backfill", "dialer", "backfillGrading", "billable", "voice:run"],
|
|
2224
2266
|
backfill_library_case_studies_library_case_studies_backfill_post: ["POST", "/library/case-studies/backfill", "library", "backfillLibraryCaseStudies", "billable", "knowledge:run"],
|
|
2267
|
+
batch_contact_related_contacts_related_post: ["POST", "/contacts/related", "contacts", "batchContactRelated", "read", "contacts:read"],
|
|
2225
2268
|
batch_create_crm_contacts_integrations_crm_connections__connection_id__batch_contacts_post: ["POST", "/integrations/crm/connections/{connection_id}/batch/contacts", "integrations", "batchCreateCrmContacts", "external", "integrations:run"],
|
|
2226
2269
|
batch_email_agent_voice_email_agent_batch_post: ["POST", "/voice/email-agent/batch", "voice", "batchEmailAgent", "billable", "voice:run"],
|
|
2227
2270
|
batch_quote_action_quotes_batch_post: ["POST", "/quotes/batch", "quotes", "batchQuoteAction", "external", "quotes:run"],
|
|
@@ -4296,6 +4339,7 @@ var API_OPERATIONS = {
|
|
|
4296
4339
|
load_copilot_intent_context_copilot_context_load_post: ["POST", "/copilot/context/load", "agents", "loadCopilotIntentContext", "write", "workflows:write"],
|
|
4297
4340
|
lookup_company_enrichment_lookup_company_post: ["POST", "/enrichment/lookup/company", "enrichment", "lookupCompany", "billable", "enrichment:run"],
|
|
4298
4341
|
lookup_crm_contacts_by_email_integrations_crm_connections__connection_id__batch_contacts_lookup_by_email_post: ["POST", "/integrations/crm/connections/{connection_id}/batch/contacts/lookup-by-email", "integrations", "lookupCrmContactsByEmail", "read", "integrations:read"],
|
|
4342
|
+
lookup_person_alias_enrichment_person_post: ["POST", "/enrichment/person", "enrichment", "lookupPersonAlias", "billable", "enrichment:run"],
|
|
4299
4343
|
lookup_person_enrichment_lookup_person_post: ["POST", "/enrichment/lookup/person", "enrichment", "lookupPerson", "billable", "enrichment:run"],
|
|
4300
4344
|
lookup_session_calls_dialer_parallel_calls_sessions__session_id__calls_post: ["POST", "/dialer/parallel-calls/sessions/{session_id}/calls", "voice", "lookupSessionCalls", "read", "voice:read"],
|
|
4301
4345
|
manual_dial_dialer_parallel_calls_manual_dial_post: ["POST", "/dialer/parallel-calls/manual-dial", "dialer", "manualDial", "external", "voice:run"],
|
|
@@ -5141,6 +5185,7 @@ var API_OPERATIONS = {
|
|
|
5141
5185
|
update_inbox_mailbox_settings_inbox_mailboxes__mailbox__settings_patch: ["PATCH", "/inbox/mailboxes/{mailbox}/settings", "aiInbox", "updateInboxMailboxSettings", "external", "inbox:run"],
|
|
5142
5186
|
update_inbox_tag_inbox_tags__tag_id__put: ["PUT", "/inbox/tags/{tag_id}", "aiInbox", "updateInboxTag", "write", "inbox:write"],
|
|
5143
5187
|
update_infrastructure_profile_org_infrastructure_put: ["PUT", "/org/infrastructure", "orgGovernance", "updateInfrastructureProfile", "write", "account:write"],
|
|
5188
|
+
update_ip_allowlist_api_keys__api_key_id__ip_allowlist_put: ["PUT", "/api-keys/{api_key_id}/ip-allowlist", "apiKeys", "updateIpAllowlist", "write", "account:write"],
|
|
5144
5189
|
update_issue_newsletters__newsletter_id__issues__issue_id__put: ["PUT", "/newsletters/{newsletter_id}/issues/{issue_id}", "newsletter", "updateIssue", "external", "newsletter:run"],
|
|
5145
5190
|
update_landing_page_html_landing_pages__landing_page_id__update_html_post: ["POST", "/landing-pages/{landing_page_id}/update-html", "landingPages", "updateLandingPageHtml", "write", "campaigns:write"],
|
|
5146
5191
|
update_landing_page_landing_pages__landing_page_id__patch: ["PATCH", "/landing-pages/{landing_page_id}", "landingPages", "updateLandingPage", "write", "campaigns:write"],
|