@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.mjs CHANGED
@@ -430,6 +430,7 @@ var BILLABLE_ROUTES = {
430
430
  "/enrichment/lists/{list_id}/pipelines/{pipeline_id}/runs",
431
431
  "/enrichment/lookup/company",
432
432
  "/enrichment/lookup/person",
433
+ "/enrichment/person",
433
434
  "/enrichment/record-sync/{entity_type}/run",
434
435
  "/enrichment/verify-email",
435
436
  "/enrichment/waterfall/configs",
@@ -938,6 +939,10 @@ var EXTERNAL_ROUTES = {
938
939
  ]
939
940
  };
940
941
 
942
+ // src/version.ts
943
+ var SDK_VERSION = "0.251.0";
944
+ var SDK_CLIENT_ID = `js-sdk/${SDK_VERSION}`;
945
+
941
946
  // src/http.ts
942
947
  var G8Error = class _G8Error extends Error {
943
948
  constructor(args) {
@@ -1120,6 +1125,7 @@ async function request(baseUrl, path, apiKey, opts = {}) {
1120
1125
  const finalHeaders = {
1121
1126
  "Content-Type": "application/json",
1122
1127
  Authorization: `Bearer ${apiKey}`,
1128
+ ...clientIdentityHeaders(headers),
1123
1129
  ...headers
1124
1130
  };
1125
1131
  warnIfTargetOrgIgnored(apiKey, headers);
@@ -1165,6 +1171,23 @@ async function request(baseUrl, path, apiKey, opts = {}) {
1165
1171
  throw await toG8Error(resp, billable ? statusRetryable : isRetryableStatus(resp.status));
1166
1172
  }
1167
1173
  }
1174
+ function isServerRuntime() {
1175
+ const g = globalThis;
1176
+ if (typeof g.window !== "undefined") return false;
1177
+ return typeof g.process?.versions?.node === "string";
1178
+ }
1179
+ function runtimeUserAgent() {
1180
+ const g = globalThis;
1181
+ const node = typeof g.process?.version === "string" ? ` node/${g.process.version.replace(/^v/, "")}` : "";
1182
+ return `graph8-sdk-js/${SDK_VERSION}${node}`;
1183
+ }
1184
+ function clientIdentityHeaders(callerHeaders = {}) {
1185
+ const taken = new Set(Object.keys(callerHeaders).map((h) => h.toLowerCase()));
1186
+ const out = {};
1187
+ if (!taken.has("x-g8-client")) out["X-G8-Client"] = SDK_CLIENT_ID;
1188
+ if (!taken.has("user-agent") && isServerRuntime()) out["User-Agent"] = runtimeUserAgent();
1189
+ return out;
1190
+ }
1168
1191
  async function* paginate(fetchPage) {
1169
1192
  let cursor = void 0;
1170
1193
  for (; ; ) {
@@ -1791,6 +1814,10 @@ var createContactsClient = (apiKey, apiUrl) => {
1791
1814
  /**
1792
1815
  * Create a new contact. Pass `idempotencyKey` to make a retry safe — the
1793
1816
  * same key returns the first result instead of creating a duplicate (A6).
1817
+ *
1818
+ * Create-only: if a contact with the same work_email / linkedin_url exists,
1819
+ * this throws a 409 `G8Error` whose `detail.hint` / `detail.upsert` name the
1820
+ * create-or-update route. When the contact may already exist, use `upsert()`.
1794
1821
  */
1795
1822
  async create(contact, idempotencyKey) {
1796
1823
  const resp = await request(baseUrl, "/api/v1/contacts", apiKey, {
@@ -1800,6 +1827,20 @@ var createContactsClient = (apiKey, apiUrl) => {
1800
1827
  });
1801
1828
  return resp.data ?? resp;
1802
1829
  },
1830
+ /**
1831
+ * Create or update a contact in one idempotent call (`PUT /contacts/assert`).
1832
+ * Matches by `work_email`, then `linkedin_url`. Prefer this over `create()`
1833
+ * when the contact may already exist: `create()` returns a 409 for a
1834
+ * duplicate, while `upsert()` updates it. Safe to retry. The server answers
1835
+ * 400 (a `G8Error`) when neither `work_email` nor `linkedin_url` is given.
1836
+ */
1837
+ async upsert(contact) {
1838
+ const resp = await request(baseUrl, "/api/v1/contacts/assert", apiKey, {
1839
+ method: "PUT",
1840
+ body: contact
1841
+ });
1842
+ return resp.data ?? resp;
1843
+ },
1803
1844
  /** Update a contact (partial). */
1804
1845
  async update(contactId, fields) {
1805
1846
  return request(baseUrl, `/api/v1/contacts/${contactId}`, apiKey, {
@@ -2055,7 +2096,7 @@ var createMailboxesClient = (apiKey, apiUrl) => {
2055
2096
  };
2056
2097
 
2057
2098
  // src/generated/operations.ts
2058
- var API_OPERATION_COUNT = 3247;
2099
+ var API_OPERATION_COUNT = 3251;
2059
2100
  var API_OPERATIONS = {
2060
2101
  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"],
2061
2102
  accept_my_offer_marketplace_me_offers__hiring_id__accept_post: ["POST", "/marketplace/me/offers/{hiring_id}/accept", "marketplace", "acceptMyOffer", "billable", "marketplace:run"],
@@ -2114,6 +2155,7 @@ var API_OPERATIONS = {
2114
2155
  analyze_website_intelligence_analyze_post: ["POST", "/intelligence/analyze", "companyIntelligence", "analyzeWebsite", "billable", "knowledge:run"],
2115
2156
  annotate_my_invoice_marketplace_me_invoices__invoice_id__put: ["PUT", "/marketplace/me/invoices/{invoice_id}", "marketplace", "annotateMyInvoice", "billable", "marketplace:run"],
2116
2157
  answer_agent_discovery_agent_onboarding_discovery_answer_post: ["POST", "/agent/onboarding/discovery/answer", "agents", "answerAgentDiscovery", "write", "workflows:write"],
2158
+ api_health_health_get: ["GET", "/health", "health", "apiHealth", "read", null],
2117
2159
  app_token_jwks_app_platform__well_known_jwks_json_get: ["GET", "/app-platform/.well-known/jwks.json", "appPlatformTokens", "appTokenJwks", "read", null],
2118
2160
  append_copilot_memory_document_copilot_memory_documents_append_post: ["POST", "/copilot/memory/documents/append", "copilot", "appendCopilotMemoryDocument", "write", "knowledge:write"],
2119
2161
  apply_account_plan_desk_accounts__account_id__plan_apply_post: ["POST", "/desk/accounts/{account_id}/plan/apply", "desk", "applyAccountPlan", "write", "deals:write"],
@@ -2194,6 +2236,7 @@ var API_OPERATIONS = {
2194
2236
  backfill_content_pages_content_pages_backfill_post: ["POST", "/content/pages/backfill", "content", "backfillContentPages", "write", "campaigns:write"],
2195
2237
  backfill_grading_dialer_parallel_calls_grading_backfill_post: ["POST", "/dialer/parallel-calls/grading/backfill", "dialer", "backfillGrading", "billable", "voice:run"],
2196
2238
  backfill_library_case_studies_library_case_studies_backfill_post: ["POST", "/library/case-studies/backfill", "library", "backfillLibraryCaseStudies", "billable", "knowledge:run"],
2239
+ batch_contact_related_contacts_related_post: ["POST", "/contacts/related", "contacts", "batchContactRelated", "read", "contacts:read"],
2197
2240
  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"],
2198
2241
  batch_email_agent_voice_email_agent_batch_post: ["POST", "/voice/email-agent/batch", "voice", "batchEmailAgent", "billable", "voice:run"],
2199
2242
  batch_quote_action_quotes_batch_post: ["POST", "/quotes/batch", "quotes", "batchQuoteAction", "external", "quotes:run"],
@@ -4268,6 +4311,7 @@ var API_OPERATIONS = {
4268
4311
  load_copilot_intent_context_copilot_context_load_post: ["POST", "/copilot/context/load", "agents", "loadCopilotIntentContext", "write", "workflows:write"],
4269
4312
  lookup_company_enrichment_lookup_company_post: ["POST", "/enrichment/lookup/company", "enrichment", "lookupCompany", "billable", "enrichment:run"],
4270
4313
  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"],
4314
+ lookup_person_alias_enrichment_person_post: ["POST", "/enrichment/person", "enrichment", "lookupPersonAlias", "billable", "enrichment:run"],
4271
4315
  lookup_person_enrichment_lookup_person_post: ["POST", "/enrichment/lookup/person", "enrichment", "lookupPerson", "billable", "enrichment:run"],
4272
4316
  lookup_session_calls_dialer_parallel_calls_sessions__session_id__calls_post: ["POST", "/dialer/parallel-calls/sessions/{session_id}/calls", "voice", "lookupSessionCalls", "read", "voice:read"],
4273
4317
  manual_dial_dialer_parallel_calls_manual_dial_post: ["POST", "/dialer/parallel-calls/manual-dial", "dialer", "manualDial", "external", "voice:run"],
@@ -5113,6 +5157,7 @@ var API_OPERATIONS = {
5113
5157
  update_inbox_mailbox_settings_inbox_mailboxes__mailbox__settings_patch: ["PATCH", "/inbox/mailboxes/{mailbox}/settings", "aiInbox", "updateInboxMailboxSettings", "external", "inbox:run"],
5114
5158
  update_inbox_tag_inbox_tags__tag_id__put: ["PUT", "/inbox/tags/{tag_id}", "aiInbox", "updateInboxTag", "write", "inbox:write"],
5115
5159
  update_infrastructure_profile_org_infrastructure_put: ["PUT", "/org/infrastructure", "orgGovernance", "updateInfrastructureProfile", "write", "account:write"],
5160
+ update_ip_allowlist_api_keys__api_key_id__ip_allowlist_put: ["PUT", "/api-keys/{api_key_id}/ip-allowlist", "apiKeys", "updateIpAllowlist", "write", "account:write"],
5116
5161
  update_issue_newsletters__newsletter_id__issues__issue_id__put: ["PUT", "/newsletters/{newsletter_id}/issues/{issue_id}", "newsletter", "updateIssue", "external", "newsletter:run"],
5117
5162
  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"],
5118
5163
  update_landing_page_landing_pages__landing_page_id__patch: ["PATCH", "/landing-pages/{landing_page_id}", "landingPages", "updateLandingPage", "write", "campaigns:write"],