@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/dist/index.js CHANGED
@@ -480,6 +480,7 @@ var BILLABLE_ROUTES = {
480
480
  "/enrichment/lists/{list_id}/pipelines/{pipeline_id}/runs",
481
481
  "/enrichment/lookup/company",
482
482
  "/enrichment/lookup/person",
483
+ "/enrichment/person",
483
484
  "/enrichment/record-sync/{entity_type}/run",
484
485
  "/enrichment/verify-email",
485
486
  "/enrichment/waterfall/configs",
@@ -988,6 +989,10 @@ var EXTERNAL_ROUTES = {
988
989
  ]
989
990
  };
990
991
 
992
+ // src/version.ts
993
+ var SDK_VERSION = "0.251.0";
994
+ var SDK_CLIENT_ID = `js-sdk/${SDK_VERSION}`;
995
+
991
996
  // src/http.ts
992
997
  var G8Error = class _G8Error extends Error {
993
998
  constructor(args) {
@@ -1170,6 +1175,7 @@ async function request(baseUrl, path, apiKey, opts = {}) {
1170
1175
  const finalHeaders = {
1171
1176
  "Content-Type": "application/json",
1172
1177
  Authorization: `Bearer ${apiKey}`,
1178
+ ...clientIdentityHeaders(headers),
1173
1179
  ...headers
1174
1180
  };
1175
1181
  warnIfTargetOrgIgnored(apiKey, headers);
@@ -1215,6 +1221,23 @@ async function request(baseUrl, path, apiKey, opts = {}) {
1215
1221
  throw await toG8Error(resp, billable ? statusRetryable : isRetryableStatus(resp.status));
1216
1222
  }
1217
1223
  }
1224
+ function isServerRuntime() {
1225
+ const g = globalThis;
1226
+ if (typeof g.window !== "undefined") return false;
1227
+ return typeof g.process?.versions?.node === "string";
1228
+ }
1229
+ function runtimeUserAgent() {
1230
+ const g = globalThis;
1231
+ const node = typeof g.process?.version === "string" ? ` node/${g.process.version.replace(/^v/, "")}` : "";
1232
+ return `graph8-sdk-js/${SDK_VERSION}${node}`;
1233
+ }
1234
+ function clientIdentityHeaders(callerHeaders = {}) {
1235
+ const taken = new Set(Object.keys(callerHeaders).map((h) => h.toLowerCase()));
1236
+ const out = {};
1237
+ if (!taken.has("x-g8-client")) out["X-G8-Client"] = SDK_CLIENT_ID;
1238
+ if (!taken.has("user-agent") && isServerRuntime()) out["User-Agent"] = runtimeUserAgent();
1239
+ return out;
1240
+ }
1218
1241
  async function* paginate(fetchPage) {
1219
1242
  let cursor = void 0;
1220
1243
  for (; ; ) {
@@ -1841,6 +1864,10 @@ var createContactsClient = (apiKey, apiUrl) => {
1841
1864
  /**
1842
1865
  * Create a new contact. Pass `idempotencyKey` to make a retry safe — the
1843
1866
  * same key returns the first result instead of creating a duplicate (A6).
1867
+ *
1868
+ * Create-only: if a contact with the same work_email / linkedin_url exists,
1869
+ * this throws a 409 `G8Error` whose `detail.hint` / `detail.upsert` name the
1870
+ * create-or-update route. When the contact may already exist, use `upsert()`.
1844
1871
  */
1845
1872
  async create(contact, idempotencyKey) {
1846
1873
  const resp = await request(baseUrl, "/api/v1/contacts", apiKey, {
@@ -1850,6 +1877,20 @@ var createContactsClient = (apiKey, apiUrl) => {
1850
1877
  });
1851
1878
  return resp.data ?? resp;
1852
1879
  },
1880
+ /**
1881
+ * Create or update a contact in one idempotent call (`PUT /contacts/assert`).
1882
+ * Matches by `work_email`, then `linkedin_url`. Prefer this over `create()`
1883
+ * when the contact may already exist: `create()` returns a 409 for a
1884
+ * duplicate, while `upsert()` updates it. Safe to retry. The server answers
1885
+ * 400 (a `G8Error`) when neither `work_email` nor `linkedin_url` is given.
1886
+ */
1887
+ async upsert(contact) {
1888
+ const resp = await request(baseUrl, "/api/v1/contacts/assert", apiKey, {
1889
+ method: "PUT",
1890
+ body: contact
1891
+ });
1892
+ return resp.data ?? resp;
1893
+ },
1853
1894
  /** Update a contact (partial). */
1854
1895
  async update(contactId, fields) {
1855
1896
  return request(baseUrl, `/api/v1/contacts/${contactId}`, apiKey, {
@@ -2105,7 +2146,7 @@ var createMailboxesClient = (apiKey, apiUrl) => {
2105
2146
  };
2106
2147
 
2107
2148
  // src/generated/operations.ts
2108
- var API_OPERATION_COUNT = 3247;
2149
+ var API_OPERATION_COUNT = 3251;
2109
2150
  var API_OPERATIONS = {
2110
2151
  accept_audience_pipeline_filters_campaigns__campaign_id__audience_pipeline_accept_filters_post: ["POST", "/campaigns/{campaign_id}/audience-pipeline/accept-filters", "campaigns", "acceptAudiencePipelineFilters", "billable", "campaigns:run"],
2111
2152
  accept_my_offer_marketplace_me_offers__hiring_id__accept_post: ["POST", "/marketplace/me/offers/{hiring_id}/accept", "marketplace", "acceptMyOffer", "billable", "marketplace:run"],
@@ -2164,6 +2205,7 @@ var API_OPERATIONS = {
2164
2205
  analyze_website_intelligence_analyze_post: ["POST", "/intelligence/analyze", "companyIntelligence", "analyzeWebsite", "billable", "knowledge:run"],
2165
2206
  annotate_my_invoice_marketplace_me_invoices__invoice_id__put: ["PUT", "/marketplace/me/invoices/{invoice_id}", "marketplace", "annotateMyInvoice", "billable", "marketplace:run"],
2166
2207
  answer_agent_discovery_agent_onboarding_discovery_answer_post: ["POST", "/agent/onboarding/discovery/answer", "agents", "answerAgentDiscovery", "write", "workflows:write"],
2208
+ api_health_health_get: ["GET", "/health", "health", "apiHealth", "read", null],
2167
2209
  app_token_jwks_app_platform__well_known_jwks_json_get: ["GET", "/app-platform/.well-known/jwks.json", "appPlatformTokens", "appTokenJwks", "read", null],
2168
2210
  append_copilot_memory_document_copilot_memory_documents_append_post: ["POST", "/copilot/memory/documents/append", "copilot", "appendCopilotMemoryDocument", "write", "knowledge:write"],
2169
2211
  apply_account_plan_desk_accounts__account_id__plan_apply_post: ["POST", "/desk/accounts/{account_id}/plan/apply", "desk", "applyAccountPlan", "write", "deals:write"],
@@ -2244,6 +2286,7 @@ var API_OPERATIONS = {
2244
2286
  backfill_content_pages_content_pages_backfill_post: ["POST", "/content/pages/backfill", "content", "backfillContentPages", "write", "campaigns:write"],
2245
2287
  backfill_grading_dialer_parallel_calls_grading_backfill_post: ["POST", "/dialer/parallel-calls/grading/backfill", "dialer", "backfillGrading", "billable", "voice:run"],
2246
2288
  backfill_library_case_studies_library_case_studies_backfill_post: ["POST", "/library/case-studies/backfill", "library", "backfillLibraryCaseStudies", "billable", "knowledge:run"],
2289
+ batch_contact_related_contacts_related_post: ["POST", "/contacts/related", "contacts", "batchContactRelated", "read", "contacts:read"],
2247
2290
  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"],
2248
2291
  batch_email_agent_voice_email_agent_batch_post: ["POST", "/voice/email-agent/batch", "voice", "batchEmailAgent", "billable", "voice:run"],
2249
2292
  batch_quote_action_quotes_batch_post: ["POST", "/quotes/batch", "quotes", "batchQuoteAction", "external", "quotes:run"],
@@ -4318,6 +4361,7 @@ var API_OPERATIONS = {
4318
4361
  load_copilot_intent_context_copilot_context_load_post: ["POST", "/copilot/context/load", "agents", "loadCopilotIntentContext", "write", "workflows:write"],
4319
4362
  lookup_company_enrichment_lookup_company_post: ["POST", "/enrichment/lookup/company", "enrichment", "lookupCompany", "billable", "enrichment:run"],
4320
4363
  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"],
4364
+ lookup_person_alias_enrichment_person_post: ["POST", "/enrichment/person", "enrichment", "lookupPersonAlias", "billable", "enrichment:run"],
4321
4365
  lookup_person_enrichment_lookup_person_post: ["POST", "/enrichment/lookup/person", "enrichment", "lookupPerson", "billable", "enrichment:run"],
4322
4366
  lookup_session_calls_dialer_parallel_calls_sessions__session_id__calls_post: ["POST", "/dialer/parallel-calls/sessions/{session_id}/calls", "voice", "lookupSessionCalls", "read", "voice:read"],
4323
4367
  manual_dial_dialer_parallel_calls_manual_dial_post: ["POST", "/dialer/parallel-calls/manual-dial", "dialer", "manualDial", "external", "voice:run"],
@@ -5163,6 +5207,7 @@ var API_OPERATIONS = {
5163
5207
  update_inbox_mailbox_settings_inbox_mailboxes__mailbox__settings_patch: ["PATCH", "/inbox/mailboxes/{mailbox}/settings", "aiInbox", "updateInboxMailboxSettings", "external", "inbox:run"],
5164
5208
  update_inbox_tag_inbox_tags__tag_id__put: ["PUT", "/inbox/tags/{tag_id}", "aiInbox", "updateInboxTag", "write", "inbox:write"],
5165
5209
  update_infrastructure_profile_org_infrastructure_put: ["PUT", "/org/infrastructure", "orgGovernance", "updateInfrastructureProfile", "write", "account:write"],
5210
+ update_ip_allowlist_api_keys__api_key_id__ip_allowlist_put: ["PUT", "/api-keys/{api_key_id}/ip-allowlist", "apiKeys", "updateIpAllowlist", "write", "account:write"],
5166
5211
  update_issue_newsletters__newsletter_id__issues__issue_id__put: ["PUT", "/newsletters/{newsletter_id}/issues/{issue_id}", "newsletter", "updateIssue", "external", "newsletter:run"],
5167
5212
  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"],
5168
5213
  update_landing_page_landing_pages__landing_page_id__patch: ["PATCH", "/landing-pages/{landing_page_id}", "landingPages", "updateLandingPage", "write", "campaigns:write"],