@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.mjs
CHANGED
|
@@ -435,6 +435,7 @@ var BILLABLE_ROUTES = {
|
|
|
435
435
|
"/enrichment/lists/{list_id}/pipelines/{pipeline_id}/runs",
|
|
436
436
|
"/enrichment/lookup/company",
|
|
437
437
|
"/enrichment/lookup/person",
|
|
438
|
+
"/enrichment/person",
|
|
438
439
|
"/enrichment/record-sync/{entity_type}/run",
|
|
439
440
|
"/enrichment/verify-email",
|
|
440
441
|
"/enrichment/waterfall/configs",
|
|
@@ -943,6 +944,10 @@ var EXTERNAL_ROUTES = {
|
|
|
943
944
|
]
|
|
944
945
|
};
|
|
945
946
|
|
|
947
|
+
// src/version.ts
|
|
948
|
+
var SDK_VERSION = "0.251.0";
|
|
949
|
+
var SDK_CLIENT_ID = `js-sdk/${SDK_VERSION}`;
|
|
950
|
+
|
|
946
951
|
// src/http.ts
|
|
947
952
|
var G8Error = class _G8Error extends Error {
|
|
948
953
|
constructor(args) {
|
|
@@ -1125,6 +1130,7 @@ async function request(baseUrl, path, apiKey, opts = {}) {
|
|
|
1125
1130
|
const finalHeaders = {
|
|
1126
1131
|
"Content-Type": "application/json",
|
|
1127
1132
|
Authorization: `Bearer ${apiKey}`,
|
|
1133
|
+
...clientIdentityHeaders(headers),
|
|
1128
1134
|
...headers
|
|
1129
1135
|
};
|
|
1130
1136
|
warnIfTargetOrgIgnored(apiKey, headers);
|
|
@@ -1170,6 +1176,23 @@ async function request(baseUrl, path, apiKey, opts = {}) {
|
|
|
1170
1176
|
throw await toG8Error(resp, billable ? statusRetryable : isRetryableStatus(resp.status));
|
|
1171
1177
|
}
|
|
1172
1178
|
}
|
|
1179
|
+
function isServerRuntime() {
|
|
1180
|
+
const g = globalThis;
|
|
1181
|
+
if (typeof g.window !== "undefined") return false;
|
|
1182
|
+
return typeof g.process?.versions?.node === "string";
|
|
1183
|
+
}
|
|
1184
|
+
function runtimeUserAgent() {
|
|
1185
|
+
const g = globalThis;
|
|
1186
|
+
const node = typeof g.process?.version === "string" ? ` node/${g.process.version.replace(/^v/, "")}` : "";
|
|
1187
|
+
return `graph8-sdk-js/${SDK_VERSION}${node}`;
|
|
1188
|
+
}
|
|
1189
|
+
function clientIdentityHeaders(callerHeaders = {}) {
|
|
1190
|
+
const taken = new Set(Object.keys(callerHeaders).map((h) => h.toLowerCase()));
|
|
1191
|
+
const out = {};
|
|
1192
|
+
if (!taken.has("x-g8-client")) out["X-G8-Client"] = SDK_CLIENT_ID;
|
|
1193
|
+
if (!taken.has("user-agent") && isServerRuntime()) out["User-Agent"] = runtimeUserAgent();
|
|
1194
|
+
return out;
|
|
1195
|
+
}
|
|
1173
1196
|
async function* paginate(fetchPage) {
|
|
1174
1197
|
let cursor = void 0;
|
|
1175
1198
|
for (; ; ) {
|
|
@@ -1796,6 +1819,10 @@ var createContactsClient = (apiKey, apiUrl) => {
|
|
|
1796
1819
|
/**
|
|
1797
1820
|
* Create a new contact. Pass `idempotencyKey` to make a retry safe — the
|
|
1798
1821
|
* same key returns the first result instead of creating a duplicate (A6).
|
|
1822
|
+
*
|
|
1823
|
+
* Create-only: if a contact with the same work_email / linkedin_url exists,
|
|
1824
|
+
* this throws a 409 `G8Error` whose `detail.hint` / `detail.upsert` name the
|
|
1825
|
+
* create-or-update route. When the contact may already exist, use `upsert()`.
|
|
1799
1826
|
*/
|
|
1800
1827
|
async create(contact, idempotencyKey) {
|
|
1801
1828
|
const resp = await request(baseUrl, "/api/v1/contacts", apiKey, {
|
|
@@ -1805,6 +1832,20 @@ var createContactsClient = (apiKey, apiUrl) => {
|
|
|
1805
1832
|
});
|
|
1806
1833
|
return resp.data ?? resp;
|
|
1807
1834
|
},
|
|
1835
|
+
/**
|
|
1836
|
+
* Create or update a contact in one idempotent call (`PUT /contacts/assert`).
|
|
1837
|
+
* Matches by `work_email`, then `linkedin_url`. Prefer this over `create()`
|
|
1838
|
+
* when the contact may already exist: `create()` returns a 409 for a
|
|
1839
|
+
* duplicate, while `upsert()` updates it. Safe to retry. The server answers
|
|
1840
|
+
* 400 (a `G8Error`) when neither `work_email` nor `linkedin_url` is given.
|
|
1841
|
+
*/
|
|
1842
|
+
async upsert(contact) {
|
|
1843
|
+
const resp = await request(baseUrl, "/api/v1/contacts/assert", apiKey, {
|
|
1844
|
+
method: "PUT",
|
|
1845
|
+
body: contact
|
|
1846
|
+
});
|
|
1847
|
+
return resp.data ?? resp;
|
|
1848
|
+
},
|
|
1808
1849
|
/** Update a contact (partial). */
|
|
1809
1850
|
async update(contactId, fields) {
|
|
1810
1851
|
return request(baseUrl, `/api/v1/contacts/${contactId}`, apiKey, {
|
|
@@ -2118,6 +2159,7 @@ var API_OPERATIONS = {
|
|
|
2118
2159
|
analyze_website_intelligence_analyze_post: ["POST", "/intelligence/analyze", "companyIntelligence", "analyzeWebsite", "billable", "knowledge:run"],
|
|
2119
2160
|
annotate_my_invoice_marketplace_me_invoices__invoice_id__put: ["PUT", "/marketplace/me/invoices/{invoice_id}", "marketplace", "annotateMyInvoice", "billable", "marketplace:run"],
|
|
2120
2161
|
answer_agent_discovery_agent_onboarding_discovery_answer_post: ["POST", "/agent/onboarding/discovery/answer", "agents", "answerAgentDiscovery", "write", "workflows:write"],
|
|
2162
|
+
api_health_health_get: ["GET", "/health", "health", "apiHealth", "read", null],
|
|
2121
2163
|
app_token_jwks_app_platform__well_known_jwks_json_get: ["GET", "/app-platform/.well-known/jwks.json", "appPlatformTokens", "appTokenJwks", "read", null],
|
|
2122
2164
|
append_copilot_memory_document_copilot_memory_documents_append_post: ["POST", "/copilot/memory/documents/append", "copilot", "appendCopilotMemoryDocument", "write", "knowledge:write"],
|
|
2123
2165
|
apply_account_plan_desk_accounts__account_id__plan_apply_post: ["POST", "/desk/accounts/{account_id}/plan/apply", "desk", "applyAccountPlan", "write", "deals:write"],
|
|
@@ -2198,6 +2240,7 @@ var API_OPERATIONS = {
|
|
|
2198
2240
|
backfill_content_pages_content_pages_backfill_post: ["POST", "/content/pages/backfill", "content", "backfillContentPages", "write", "campaigns:write"],
|
|
2199
2241
|
backfill_grading_dialer_parallel_calls_grading_backfill_post: ["POST", "/dialer/parallel-calls/grading/backfill", "dialer", "backfillGrading", "billable", "voice:run"],
|
|
2200
2242
|
backfill_library_case_studies_library_case_studies_backfill_post: ["POST", "/library/case-studies/backfill", "library", "backfillLibraryCaseStudies", "billable", "knowledge:run"],
|
|
2243
|
+
batch_contact_related_contacts_related_post: ["POST", "/contacts/related", "contacts", "batchContactRelated", "read", "contacts:read"],
|
|
2201
2244
|
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"],
|
|
2202
2245
|
batch_email_agent_voice_email_agent_batch_post: ["POST", "/voice/email-agent/batch", "voice", "batchEmailAgent", "billable", "voice:run"],
|
|
2203
2246
|
batch_quote_action_quotes_batch_post: ["POST", "/quotes/batch", "quotes", "batchQuoteAction", "external", "quotes:run"],
|
|
@@ -4272,6 +4315,7 @@ var API_OPERATIONS = {
|
|
|
4272
4315
|
load_copilot_intent_context_copilot_context_load_post: ["POST", "/copilot/context/load", "agents", "loadCopilotIntentContext", "write", "workflows:write"],
|
|
4273
4316
|
lookup_company_enrichment_lookup_company_post: ["POST", "/enrichment/lookup/company", "enrichment", "lookupCompany", "billable", "enrichment:run"],
|
|
4274
4317
|
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"],
|
|
4318
|
+
lookup_person_alias_enrichment_person_post: ["POST", "/enrichment/person", "enrichment", "lookupPersonAlias", "billable", "enrichment:run"],
|
|
4275
4319
|
lookup_person_enrichment_lookup_person_post: ["POST", "/enrichment/lookup/person", "enrichment", "lookupPerson", "billable", "enrichment:run"],
|
|
4276
4320
|
lookup_session_calls_dialer_parallel_calls_sessions__session_id__calls_post: ["POST", "/dialer/parallel-calls/sessions/{session_id}/calls", "voice", "lookupSessionCalls", "read", "voice:read"],
|
|
4277
4321
|
manual_dial_dialer_parallel_calls_manual_dial_post: ["POST", "/dialer/parallel-calls/manual-dial", "dialer", "manualDial", "external", "voice:run"],
|
|
@@ -5117,6 +5161,7 @@ var API_OPERATIONS = {
|
|
|
5117
5161
|
update_inbox_mailbox_settings_inbox_mailboxes__mailbox__settings_patch: ["PATCH", "/inbox/mailboxes/{mailbox}/settings", "aiInbox", "updateInboxMailboxSettings", "external", "inbox:run"],
|
|
5118
5162
|
update_inbox_tag_inbox_tags__tag_id__put: ["PUT", "/inbox/tags/{tag_id}", "aiInbox", "updateInboxTag", "write", "inbox:write"],
|
|
5119
5163
|
update_infrastructure_profile_org_infrastructure_put: ["PUT", "/org/infrastructure", "orgGovernance", "updateInfrastructureProfile", "write", "account:write"],
|
|
5164
|
+
update_ip_allowlist_api_keys__api_key_id__ip_allowlist_put: ["PUT", "/api-keys/{api_key_id}/ip-allowlist", "apiKeys", "updateIpAllowlist", "write", "account:write"],
|
|
5120
5165
|
update_issue_newsletters__newsletter_id__issues__issue_id__put: ["PUT", "/newsletters/{newsletter_id}/issues/{issue_id}", "newsletter", "updateIssue", "external", "newsletter:run"],
|
|
5121
5166
|
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"],
|
|
5122
5167
|
update_landing_page_landing_pages__landing_page_id__patch: ["PATCH", "/landing-pages/{landing_page_id}", "landingPages", "updateLandingPage", "write", "campaigns:write"],
|