@graph8/sdk 0.14.0 → 0.16.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.d.ts CHANGED
@@ -1550,6 +1550,8 @@ declare const createInboxClient: (apiKey: string, apiUrl?: string) => {
1550
1550
  };
1551
1551
 
1552
1552
  interface Deal {
1553
+ /** Canonical CRM revision returned by a conditional update. */
1554
+ revision?: number | null;
1553
1555
  id: string | null;
1554
1556
  name: string | null;
1555
1557
  description: string | null;
@@ -1614,6 +1616,8 @@ interface DealCreateParams {
1614
1616
  allow_duplicate?: boolean;
1615
1617
  }
1616
1618
  interface DealUpdateParams {
1619
+ /** Require this current CRM revision; a stale edit returns HTTP 409. */
1620
+ expected_revision?: number;
1617
1621
  name?: string;
1618
1622
  description?: string;
1619
1623
  amount?: number;
@@ -1649,7 +1653,26 @@ interface DealUpdateParams {
1649
1653
  add_contact_ids?: number[];
1650
1654
  /** mashup_contact_ids to unlink. Idempotent. */
1651
1655
  remove_contact_ids?: number[];
1656
+ /**
1657
+ * Buying-committee role per contact on this deal, keyed by
1658
+ * mashup_contact_id. JSON object keys are strings, so the key type is
1659
+ * `string` even though the id is numeric: `{ "5500429": "champion" }`.
1660
+ * `null` clears a contact's role.
1661
+ *
1662
+ * Applies to contacts already linked to the deal, and to contacts linked by
1663
+ * `add_contact_ids` in the same call (roles are applied after the link). An
1664
+ * id that is neither already linked nor being added is rejected with HTTP
1665
+ * 422 naming the id, and the whole update is rolled back. A role outside the
1666
+ * vocabulary is HTTP 422.
1667
+ */
1668
+ contact_roles?: Record<string, DealContactRole | null>;
1652
1669
  }
1670
+ /**
1671
+ * Role a contact plays in a deal's buying committee
1672
+ * (`cb_deal_contacts.role`). The same person can hold different roles on
1673
+ * different deals, so this lives on the deal-contact link, not the contact.
1674
+ */
1675
+ type DealContactRole = "champion" | "decision_maker" | "influencer" | "blocker" | "coach" | "end_user";
1653
1676
  interface DealListParams {
1654
1677
  page?: number;
1655
1678
  limit?: number;
@@ -1739,6 +1762,7 @@ declare const createDealsClient: (apiKey: string, apiUrl?: string) => {
1739
1762
  }>;
1740
1763
  };
1741
1764
 
1765
+ type CustomObjectIcon = "box" | "briefcase" | "building" | "calendar" | "flag" | "folder" | "globe" | "heart" | "layers" | "package" | "target" | "users";
1742
1766
  /** A custom object type in your workspace — a record type you define. */
1743
1767
  interface CustomObject {
1744
1768
  /** Stable API slug, e.g. `invoices`. */
@@ -1748,6 +1772,28 @@ interface CustomObject {
1748
1772
  /** True for object types graph8 ships; system objects cannot be deleted. */
1749
1773
  is_system: boolean;
1750
1774
  is_archived: boolean;
1775
+ /** Presentation settings may be absent on older servers. */
1776
+ description?: string | null;
1777
+ icon?: string | null;
1778
+ display_attribute_slug?: string | null;
1779
+ }
1780
+ /** Native schema creation requires objects:manage and current Admin access. */
1781
+ interface CreateCustomObject {
1782
+ slug: string;
1783
+ singular_noun: string;
1784
+ plural_noun: string;
1785
+ description?: string | null;
1786
+ icon?: CustomObjectIcon | null;
1787
+ }
1788
+ /** Omitted labels/state are preserved. The API slug is immutable. */
1789
+ interface UpdateCustomObject {
1790
+ singular_noun?: string;
1791
+ plural_noun?: string;
1792
+ is_archived?: boolean;
1793
+ /** Omit to preserve; null clears the setting. */
1794
+ description?: string | null;
1795
+ icon?: CustomObjectIcon | null;
1796
+ display_attribute_slug?: string | null;
1751
1797
  }
1752
1798
  /**
1753
1799
  * One attribute on a custom object, and the rules its values must satisfy.
@@ -1760,6 +1806,15 @@ interface CustomObject {
1760
1806
  */
1761
1807
  interface CustomObjectAttribute {
1762
1808
  slug: string;
1809
+ /** Customer-facing label. Display metadata is absent on older servers. */
1810
+ title?: string;
1811
+ description?: string | null;
1812
+ /** Display order; ties are ordered by slug. */
1813
+ sort_order?: number;
1814
+ /** Protected system field rather than a customer-defined field. */
1815
+ is_system?: boolean;
1816
+ /** Archive state; absent on older servers. */
1817
+ is_archived?: boolean;
1763
1818
  attribute_type: string;
1764
1819
  is_required: boolean;
1765
1820
  /** No two ACTIVE records may hold the same value. A collision returns 409. */
@@ -1772,6 +1827,24 @@ interface CustomObjectAttribute {
1772
1827
  /** Type-specific configuration, e.g. the allowed options for a `select`. */
1773
1828
  config: Record<string, unknown>;
1774
1829
  }
1830
+ /** Schema creation requires objects:manage and current Admin access. */
1831
+ interface CreateCustomObjectAttribute {
1832
+ slug: string;
1833
+ title: string;
1834
+ attribute_type: "text" | "number" | "currency" | "date" | "timestamp" | "checkbox" | "select" | "status" | "email_address" | "phone_number" | "domain" | "location" | "personal_name" | "record_reference" | "rating" | "actor_reference";
1835
+ description?: string | null;
1836
+ is_required?: boolean;
1837
+ is_unique?: boolean;
1838
+ is_multiselect?: boolean;
1839
+ is_default_value_enabled?: boolean;
1840
+ default_value?: unknown;
1841
+ config?: Record<string, unknown>;
1842
+ sort_order?: number;
1843
+ }
1844
+ /** Omitted fields are preserved; explicit null can clear the configured default. */
1845
+ type UpdateCustomObjectAttribute = Partial<Omit<CreateCustomObjectAttribute, "slug" | "attribute_type">> & {
1846
+ is_archived?: boolean;
1847
+ };
1775
1848
  /** One record, with its currently active attribute values. */
1776
1849
  interface CustomObjectRecord {
1777
1850
  id: string;
@@ -1802,6 +1875,29 @@ interface CustomObjectHistory {
1802
1875
  record_id: string;
1803
1876
  entries: CustomObjectHistoryEntry[];
1804
1877
  }
1878
+ interface CustomObjectMutation {
1879
+ id: string;
1880
+ action: "created" | "updated" | "archived" | "restored";
1881
+ occurred_at: string;
1882
+ revision: number;
1883
+ actor_id: string | null;
1884
+ actor_type: "user" | "api" | "app" | "integration" | "system";
1885
+ source: string;
1886
+ app_id: string | null;
1887
+ changes: Record<string, {
1888
+ before_present: boolean;
1889
+ before: unknown;
1890
+ after_present: boolean;
1891
+ after: unknown;
1892
+ }>;
1893
+ was_archived: boolean;
1894
+ is_archived: boolean;
1895
+ }
1896
+ interface CustomObjectMutations {
1897
+ record_id: string;
1898
+ entries: CustomObjectMutation[];
1899
+ next_cursor: string | null;
1900
+ }
1805
1901
  interface ListRecordsParams {
1806
1902
  page?: number;
1807
1903
  /** 1-200, default 50. */
@@ -1866,16 +1962,33 @@ interface ObjectPagination {
1866
1962
  */
1867
1963
  declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1868
1964
  /** List the custom object types in your workspace. */
1869
- list(): Promise<{
1965
+ list(params?: {
1966
+ include_archived?: boolean;
1967
+ }): Promise<{
1870
1968
  data: CustomObject[];
1871
1969
  }>;
1970
+ /** Create a native custom object. Requires objects:manage and Admin access. */
1971
+ create(input: CreateCustomObject): Promise<CustomObject>;
1972
+ /** Rename, archive or restore an object while preserving its slug and data. */
1973
+ update(objectSlug: string, input: UpdateCustomObject): Promise<CustomObject>;
1974
+ /** Archive the object without deleting records; restore with update({ is_archived: false }). */
1975
+ archive(objectSlug: string): Promise<CustomObject>;
1872
1976
  /** Fetch one object type by slug. */
1873
1977
  get(objectSlug: string): Promise<CustomObject>;
1874
1978
  /** The object's attributes — the schema its records must satisfy. */
1875
- listAttributes(objectSlug: string): Promise<{
1979
+ listAttributes(objectSlug: string, params?: {
1980
+ include_archived?: boolean;
1981
+ }): Promise<{
1876
1982
  data: CustomObjectAttribute[];
1877
1983
  }>;
1878
- /** Paginated records with their current values. Archived records are excluded. */
1984
+ /** Create a field using the same schema rules as the customer UI. */
1985
+ createAttribute(objectSlug: string, input: CreateCustomObjectAttribute): Promise<CustomObjectAttribute>;
1986
+ /** Edit or restore a field; its type and slug are immutable. */
1987
+ updateAttribute(objectSlug: string, attributeSlug: string, input: UpdateCustomObjectAttribute): Promise<CustomObjectAttribute>;
1988
+ /** Archive without deleting values; restore with updateAttribute({ is_archived: false }). */
1989
+ archiveAttribute(objectSlug: string, attributeSlug: string): Promise<CustomObjectAttribute>;
1990
+ /** Paginated custom records or canonical deals with current values and revisions.
1991
+ * Deal totals and related references respect current record access. */
1879
1992
  listRecords(objectSlug: string, params?: ListRecordsParams): Promise<{
1880
1993
  data: CustomObjectRecord[];
1881
1994
  pagination?: ObjectPagination;
@@ -1886,18 +1999,28 @@ declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1886
1999
  * unique attribute is a 409.
1887
2000
  */
1888
2001
  createRecord(objectSlug: string, values: Record<string, unknown>): Promise<CustomObjectRecord>;
1889
- /** Fetch one record with its currently active values. */
2002
+ /** Match a unique single-value key, creating or updating while preserving omitted fields. */
2003
+ upsertRecord(objectSlug: string, matchingAttribute: string, values: Record<string, unknown>, options?: {
2004
+ expectedRevision?: number;
2005
+ }): Promise<CustomObjectRecord>;
2006
+ /** Fetch one custom record, canonical contact/company, or deal by its stable graph8 ID.
2007
+ * Deals retain their UUIDs and expose company, primary-contact and contact_ids references only
2008
+ * when permitted. Generic deal mutations are not yet supported.
2009
+ */
1890
2010
  getRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
1891
2011
  /**
1892
2012
  * Update a record. PARTIAL: only the attributes you send are touched, so
1893
2013
  * required attributes you omit are left alone rather than reported missing.
1894
2014
  * Sending an explicit `null` CLEARS that attribute.
1895
2015
  *
1896
- * Values are versioned rather than overwritten, so the previous value stays
1897
- * readable through `history`.
2016
+ * Custom values retain generations through `history`. Canonical contacts and
2017
+ * companies require expectedRevision from a fresh read and expose recorded
2018
+ * mutations through `changes`. They do not yet support appendValues/removeValues.
1898
2019
  */
1899
2020
  updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown>, options?: {
1900
2021
  expectedRevision?: number;
2022
+ appendValues?: Record<string, unknown[]>;
2023
+ removeValues?: Record<string, unknown[]>;
1901
2024
  }): Promise<CustomObjectRecord>;
1902
2025
  /**
1903
2026
  * Archive a record. It leaves listings, stays readable by id, and keeps its
@@ -1911,6 +2034,14 @@ declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1911
2034
  * null is the value currently in force.
1912
2035
  */
1913
2036
  history(objectSlug: string, recordId: string, limit?: number): Promise<CustomObjectHistory>;
2037
+ /** Recorded custom-record or canonical contact/company mutations. Pass next_cursor to continue.
2038
+ * Canonical history respects current access/privacy; archived records and older
2039
+ * unrecorded writes are not reconstructed. Store unavailability returns 503.
2040
+ */
2041
+ changes(objectSlug: string, recordId: string, options?: {
2042
+ limit?: number;
2043
+ cursor?: string;
2044
+ }): Promise<CustomObjectMutations>;
1914
2045
  };
1915
2046
 
1916
2047
  /**
@@ -2785,7 +2916,7 @@ declare const createContactsClient: (apiKey: string, apiUrl?: string) => {
2785
2916
  * adds events. ``WebhookEvent`` also accepts any string so a newly-added
2786
2917
  * backend event never breaks a client that hasn't upgraded.
2787
2918
  */
2788
- 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.draft_created", "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"];
2919
+ 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.draft_created", "sequence.started", "sequence.paused", "sequence.completed", "engagement.email_sent", "engagement.email_replied", "engagement.email_bounced", "engagement.email_skipped", "engagement.call_dispatched", "engagement.call_connected", "engagement.call_graded", "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", "deal.won", "crm.record.created", "crm.record.updated", "crm.record.archived", "crm.record.restored"];
2789
2920
  type WebhookEvent = (typeof KNOWN_WEBHOOK_EVENTS)[number] | (string & {});
2790
2921
  /** The decoded body graph8 delivers to a webhook endpoint. */
2791
2922
  interface WebhookEventPayload {
@@ -2793,7 +2924,7 @@ interface WebhookEventPayload {
2793
2924
  timestamp: string;
2794
2925
  data: Record<string, unknown>;
2795
2926
  org_id: string;
2796
- /** Stable per-delivery id (present once the backend adds it; for consumer dedup). */
2927
+ /** Stable event ID for consumer deduplication; delivery ID is in X-Studio-Delivery-Id. */
2797
2928
  id?: string;
2798
2929
  }
2799
2930
  interface ConstructEventOptions {
@@ -2844,7 +2975,7 @@ declare const createWebhooksClient: (_apiKey: string, apiUrl?: string) => {
2844
2975
  /** Base URL the webhook subscription API lives under. */
2845
2976
  baseUrl: string;
2846
2977
  /** Known event types (for autocomplete / validation). */
2847
- 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.draft_created", "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"];
2978
+ 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.draft_created", "sequence.started", "sequence.paused", "sequence.completed", "engagement.email_sent", "engagement.email_replied", "engagement.email_bounced", "engagement.email_skipped", "engagement.call_dispatched", "engagement.call_connected", "engagement.call_graded", "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", "deal.won", "crm.record.created", "crm.record.updated", "crm.record.archived", "crm.record.restored"];
2848
2979
  /** Verify an incoming webhook's HMAC signature and return the parsed event. */
2849
2980
  constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
2850
2981
  };
@@ -3947,7 +4078,7 @@ declare class G8 {
3947
4078
  /** Webhook event listeners (requires API key). */
3948
4079
  get webhooks(): {
3949
4080
  baseUrl: string;
3950
- 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.draft_created", "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"];
4081
+ 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.draft_created", "sequence.started", "sequence.paused", "sequence.completed", "engagement.email_sent", "engagement.email_replied", "engagement.email_bounced", "engagement.email_skipped", "engagement.call_dispatched", "engagement.call_connected", "engagement.call_graded", "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", "deal.won", "crm.record.created", "crm.record.updated", "crm.record.archived", "crm.record.restored"];
3951
4082
  constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
3952
4083
  };
3953
4084
  /** Contacts CRUD (requires API key). */
@@ -4125,25 +4256,44 @@ declare class G8 {
4125
4256
  };
4126
4257
  /** Custom object types, their schema, and their records (requires API key). PREVIEW. */
4127
4258
  get objects(): {
4128
- list(): Promise<{
4259
+ list(params?: {
4260
+ include_archived?: boolean;
4261
+ }): Promise<{
4129
4262
  data: CustomObject[];
4130
4263
  }>;
4264
+ create(input: CreateCustomObject): Promise<CustomObject>;
4265
+ update(objectSlug: string, input: UpdateCustomObject): Promise<CustomObject>;
4266
+ archive(objectSlug: string): Promise<CustomObject>;
4131
4267
  get(objectSlug: string): Promise<CustomObject>;
4132
- listAttributes(objectSlug: string): Promise<{
4268
+ listAttributes(objectSlug: string, params?: {
4269
+ include_archived?: boolean;
4270
+ }): Promise<{
4133
4271
  data: CustomObjectAttribute[];
4134
4272
  }>;
4273
+ createAttribute(objectSlug: string, input: CreateCustomObjectAttribute): Promise<CustomObjectAttribute>;
4274
+ updateAttribute(objectSlug: string, attributeSlug: string, input: UpdateCustomObjectAttribute): Promise<CustomObjectAttribute>;
4275
+ archiveAttribute(objectSlug: string, attributeSlug: string): Promise<CustomObjectAttribute>;
4135
4276
  listRecords(objectSlug: string, params?: ListRecordsParams): Promise<{
4136
4277
  data: CustomObjectRecord[];
4137
4278
  pagination?: ObjectPagination;
4138
4279
  }>;
4139
4280
  createRecord(objectSlug: string, values: Record<string, unknown>): Promise<CustomObjectRecord>;
4281
+ upsertRecord(objectSlug: string, matchingAttribute: string, values: Record<string, unknown>, options?: {
4282
+ expectedRevision?: number;
4283
+ }): Promise<CustomObjectRecord>;
4140
4284
  getRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4141
4285
  updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown>, options?: {
4142
4286
  expectedRevision?: number;
4287
+ appendValues?: Record<string, unknown[]>;
4288
+ removeValues?: Record<string, unknown[]>;
4143
4289
  }): Promise<CustomObjectRecord>;
4144
4290
  archiveRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4145
4291
  restoreRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4146
4292
  history(objectSlug: string, recordId: string, limit?: number): Promise<CustomObjectHistory>;
4293
+ changes(objectSlug: string, recordId: string, options?: {
4294
+ limit?: number;
4295
+ cursor?: string;
4296
+ }): Promise<CustomObjectMutations>;
4147
4297
  };
4148
4298
  /** Deals and pipelines (requires API key). */
4149
4299
  get deals(): {
@@ -4967,4 +5117,4 @@ interface Graph8ServiceClient {
4967
5117
  */
4968
5118
  declare function createGraph8ServiceClient(config: Graph8ServiceClientConfig): Graph8ServiceClient;
4969
5119
 
4970
- export { type AddToSequenceConfig, type AgencyClient, type AgencyInfo, type App, type AppCreateParams, type AppDomain, type AppInstallation, type AppLimit, type AppLogs, type AppRequest, type AppRequestOptions, type AppSecretMetadata, type AppSourceParams, type AppStatus, type AppTokenResponse, type AppUsageSummary, type AudienceSync, type AudienceSyncCreateParams, type AudienceSyncError, type AudienceSyncMode, type AudienceSyncPlatform, type AudienceSyncRun, type AudienceSyncUpdateParams, type Booking, type BookingRequest, type CalendarConfig, type CallGradingResult, type Campaign, type CampaignCreateConfig, type CampaignLaunchExecution, type CampaignLaunchResult, 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 ContainerLog, type CopilotConfig, type CreateDeploymentParams, type CreatedField, type CustomObject, type CustomObjectAttribute, type CustomObjectHistory, type CustomObjectHistoryEntry, type CustomObjectRecord, DEFAULT_APP_API, type Deal, type DealCreateParams, type DealListParams, type DealUpdateParams, type Deployment, type DeploymentStatus, 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 DomainVerificationInstructions, type DomainVerificationStatus, type EmailVerification, type EnrichLookupResult, type EvidenceKey, type Field, type FieldCreateParams, type FieldDeleteParams, type G8Config, G8Error, type G8PrivacyConfig, type GlobalContextDocument, type Graph8AppClient, type Graph8AppClientConfig, type Graph8ServiceClient, type Graph8ServiceClientConfig, 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 InstallStatus, type IntelligenceData, type IntentCompany, type IntentContact, type IntentKeyword, type IntentPage, type IntentSignals, type IntentStats, type IntentVisitor, KNOWN_WEBHOOK_EVENTS, type ListContact, type ListRecordsParams, MAX_TAIL_LINES, MIN_TAIL_LINES, 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 ObjectPagination, 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 SchemaVersion, type SchemaVersionStatus, 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 SourceProvider, type StageCreateParams, type StagePipeline, type StagePipelineCreateParams, type StagePipelineStage, type StagePipelineUpdateParams, type StageUpdateParams, type Task, type TaskCreateParams, type TaskListParams, type TaskUpdateParams, type TimeSlot, type TokenManager, type TrackProperties, type VisitorCompany, type VisitorScore, type VoicePagination, type WebhookEvent, type WebhookEventPayload, WebhookSignatureError, type Workflow, type WorkflowConfig, type WorkflowConnection, type WorkflowCreateParams, type WorkflowExecution, type WorkflowListParams, type WorkflowNode, type WorkflowUpdateParams, backoffDelayMs, constructEvent, createAppPlatformClient, createAppRequester, createGraph8AppClient, createGraph8ServiceClient, createTokenManager, exchangeBrowserToken, exchangeServiceToken, g8, isRetryableStatus, paginate, parseRetryAfter, request };
5120
+ export { type AddToSequenceConfig, type AgencyClient, type AgencyInfo, type App, type AppCreateParams, type AppDomain, type AppInstallation, type AppLimit, type AppLogs, type AppRequest, type AppRequestOptions, type AppSecretMetadata, type AppSourceParams, type AppStatus, type AppTokenResponse, type AppUsageSummary, type AudienceSync, type AudienceSyncCreateParams, type AudienceSyncError, type AudienceSyncMode, type AudienceSyncPlatform, type AudienceSyncRun, type AudienceSyncUpdateParams, type Booking, type BookingRequest, type CalendarConfig, type CallGradingResult, type Campaign, type CampaignCreateConfig, type CampaignLaunchExecution, type CampaignLaunchResult, 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 ContainerLog, type CopilotConfig, type CreateCustomObject, type CreateCustomObjectAttribute, type CreateDeploymentParams, type CreatedField, type CustomObject, type CustomObjectAttribute, type CustomObjectHistory, type CustomObjectHistoryEntry, type CustomObjectIcon, type CustomObjectMutation, type CustomObjectMutations, type CustomObjectRecord, DEFAULT_APP_API, type Deal, type DealContactRole, type DealCreateParams, type DealListParams, type DealUpdateParams, type Deployment, type DeploymentStatus, 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 DomainVerificationInstructions, type DomainVerificationStatus, type EmailVerification, type EnrichLookupResult, type EvidenceKey, type Field, type FieldCreateParams, type FieldDeleteParams, type G8Config, G8Error, type G8PrivacyConfig, type GlobalContextDocument, type Graph8AppClient, type Graph8AppClientConfig, type Graph8ServiceClient, type Graph8ServiceClientConfig, 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 InstallStatus, type IntelligenceData, type IntentCompany, type IntentContact, type IntentKeyword, type IntentPage, type IntentSignals, type IntentStats, type IntentVisitor, KNOWN_WEBHOOK_EVENTS, type ListContact, type ListRecordsParams, MAX_TAIL_LINES, MIN_TAIL_LINES, 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 ObjectPagination, 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 SchemaVersion, type SchemaVersionStatus, 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 SourceProvider, type StageCreateParams, type StagePipeline, type StagePipelineCreateParams, type StagePipelineStage, type StagePipelineUpdateParams, type StageUpdateParams, type Task, type TaskCreateParams, type TaskListParams, type TaskUpdateParams, type TimeSlot, type TokenManager, type TrackProperties, type UpdateCustomObject, type UpdateCustomObjectAttribute, type VisitorCompany, type VisitorScore, type VoicePagination, type WebhookEvent, type WebhookEventPayload, WebhookSignatureError, type Workflow, type WorkflowConfig, type WorkflowConnection, type WorkflowCreateParams, type WorkflowExecution, type WorkflowListParams, type WorkflowNode, type WorkflowUpdateParams, backoffDelayMs, constructEvent, createAppPlatformClient, createAppRequester, createGraph8AppClient, createGraph8ServiceClient, createTokenManager, exchangeBrowserToken, exchangeServiceToken, g8, isRetryableStatus, paginate, parseRetryAfter, request };
package/dist/index.js CHANGED
@@ -891,6 +891,8 @@ var KNOWN_WEBHOOK_EVENTS = [
891
891
  "engagement.email_bounced",
892
892
  "engagement.email_skipped",
893
893
  "engagement.call_dispatched",
894
+ "engagement.call_connected",
895
+ "engagement.call_graded",
894
896
  "engagement.sms_sent",
895
897
  "engagement.sms_replied",
896
898
  "engagement.whatsapp_sent",
@@ -901,7 +903,12 @@ var KNOWN_WEBHOOK_EVENTS = [
901
903
  "engagement.linkedin_connection_accepted",
902
904
  "meeting.booked",
903
905
  "meeting.cancelled",
904
- "meeting.rescheduled"
906
+ "meeting.rescheduled",
907
+ "deal.won",
908
+ "crm.record.created",
909
+ "crm.record.updated",
910
+ "crm.record.archived",
911
+ "crm.record.restored"
905
912
  ];
906
913
  var WebhookSignatureError = class extends Error {
907
914
  constructor(message) {
@@ -1586,8 +1593,32 @@ var createObjectsClient = (apiKey, apiUrl) => {
1586
1593
  const encode = (value) => encodeURIComponent(value);
1587
1594
  return {
1588
1595
  /** List the custom object types in your workspace. */
1589
- async list() {
1590
- return request(baseUrl, "/api/v1/objects", apiKey);
1596
+ async list(params = {}) {
1597
+ const query = params.include_archived ? "?include_archived=true" : "";
1598
+ return request(baseUrl, `/api/v1/objects${query}`, apiKey);
1599
+ },
1600
+ /** Create a native custom object. Requires objects:manage and Admin access. */
1601
+ async create(input) {
1602
+ const resp = await request(baseUrl, "/api/v1/objects", apiKey, {
1603
+ method: "POST",
1604
+ body: input
1605
+ });
1606
+ return resp.data;
1607
+ },
1608
+ /** Rename, archive or restore an object while preserving its slug and data. */
1609
+ async update(objectSlug, input) {
1610
+ const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}`, apiKey, {
1611
+ method: "PATCH",
1612
+ body: input
1613
+ });
1614
+ return resp.data;
1615
+ },
1616
+ /** Archive the object without deleting records; restore with update({ is_archived: false }). */
1617
+ async archive(objectSlug) {
1618
+ const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}`, apiKey, {
1619
+ method: "DELETE"
1620
+ });
1621
+ return resp.data;
1591
1622
  },
1592
1623
  /** Fetch one object type by slug. */
1593
1624
  async get(objectSlug) {
@@ -1599,10 +1630,35 @@ var createObjectsClient = (apiKey, apiUrl) => {
1599
1630
  return resp.data ?? resp;
1600
1631
  },
1601
1632
  /** The object's attributes — the schema its records must satisfy. */
1602
- async listAttributes(objectSlug) {
1603
- return request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes`, apiKey);
1633
+ async listAttributes(objectSlug, params = {}) {
1634
+ const query = params.include_archived ? "?include_archived=true" : "";
1635
+ return request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes${query}`, apiKey);
1604
1636
  },
1605
- /** Paginated records with their current values. Archived records are excluded. */
1637
+ /** Create a field using the same schema rules as the customer UI. */
1638
+ async createAttribute(objectSlug, input) {
1639
+ const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes`, apiKey, {
1640
+ method: "POST",
1641
+ body: input
1642
+ });
1643
+ return resp.data;
1644
+ },
1645
+ /** Edit or restore a field; its type and slug are immutable. */
1646
+ async updateAttribute(objectSlug, attributeSlug, input) {
1647
+ const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes/${encode(attributeSlug)}`, apiKey, {
1648
+ method: "PATCH",
1649
+ body: input
1650
+ });
1651
+ return resp.data;
1652
+ },
1653
+ /** Archive without deleting values; restore with updateAttribute({ is_archived: false }). */
1654
+ async archiveAttribute(objectSlug, attributeSlug) {
1655
+ const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes/${encode(attributeSlug)}`, apiKey, {
1656
+ method: "DELETE"
1657
+ });
1658
+ return resp.data;
1659
+ },
1660
+ /** Paginated custom records or canonical deals with current values and revisions.
1661
+ * Deal totals and related references respect current record access. */
1606
1662
  async listRecords(objectSlug, params = {}) {
1607
1663
  const query = {};
1608
1664
  if (params.page != null) query.page = params.page;
@@ -1626,7 +1682,24 @@ var createObjectsClient = (apiKey, apiUrl) => {
1626
1682
  );
1627
1683
  return resp.data ?? resp;
1628
1684
  },
1629
- /** Fetch one record with its currently active values. */
1685
+ /** Match a unique single-value key, creating or updating while preserving omitted fields. */
1686
+ async upsertRecord(objectSlug, matchingAttribute, values, options = {}) {
1687
+ const resp = await request(
1688
+ baseUrl,
1689
+ `/api/v1/objects/${encode(objectSlug)}/records/upsert`,
1690
+ apiKey,
1691
+ { method: "POST", body: {
1692
+ matching_attribute: matchingAttribute,
1693
+ values,
1694
+ ...options.expectedRevision !== void 0 ? { expected_revision: options.expectedRevision } : {}
1695
+ } }
1696
+ );
1697
+ return resp.data;
1698
+ },
1699
+ /** Fetch one custom record, canonical contact/company, or deal by its stable graph8 ID.
1700
+ * Deals retain their UUIDs and expose company, primary-contact and contact_ids references only
1701
+ * when permitted. Generic deal mutations are not yet supported.
1702
+ */
1630
1703
  async getRecord(objectSlug, recordId) {
1631
1704
  const resp = await request(
1632
1705
  baseUrl,
@@ -1640,15 +1713,24 @@ var createObjectsClient = (apiKey, apiUrl) => {
1640
1713
  * required attributes you omit are left alone rather than reported missing.
1641
1714
  * Sending an explicit `null` CLEARS that attribute.
1642
1715
  *
1643
- * Values are versioned rather than overwritten, so the previous value stays
1644
- * readable through `history`.
1716
+ * Custom values retain generations through `history`. Canonical contacts and
1717
+ * companies require expectedRevision from a fresh read and expose recorded
1718
+ * mutations through `changes`. They do not yet support appendValues/removeValues.
1645
1719
  */
1646
1720
  async updateRecord(objectSlug, recordId, values, options) {
1647
1721
  const resp = await request(
1648
1722
  baseUrl,
1649
1723
  `/api/v1/objects/${encode(objectSlug)}/records/${encode(recordId)}`,
1650
1724
  apiKey,
1651
- { method: "PATCH", body: { values, ...options?.expectedRevision === void 0 ? {} : { expected_revision: options.expectedRevision } } }
1725
+ {
1726
+ method: "PATCH",
1727
+ body: {
1728
+ values,
1729
+ ...options?.expectedRevision === void 0 ? {} : { expected_revision: options.expectedRevision },
1730
+ ...options?.appendValues === void 0 ? {} : { append_values: options.appendValues },
1731
+ ...options?.removeValues === void 0 ? {} : { remove_values: options.removeValues }
1732
+ }
1733
+ }
1652
1734
  );
1653
1735
  return resp.data ?? resp;
1654
1736
  },
@@ -1687,6 +1769,19 @@ var createObjectsClient = (apiKey, apiUrl) => {
1687
1769
  { query: limit != null ? { limit } : void 0 }
1688
1770
  );
1689
1771
  return resp.data ?? resp;
1772
+ },
1773
+ /** Recorded custom-record or canonical contact/company mutations. Pass next_cursor to continue.
1774
+ * Canonical history respects current access/privacy; archived records and older
1775
+ * unrecorded writes are not reconstructed. Store unavailability returns 503.
1776
+ */
1777
+ async changes(objectSlug, recordId, options = {}) {
1778
+ const resp = await request(
1779
+ baseUrl,
1780
+ `/api/v1/objects/${encode(objectSlug)}/records/${encode(recordId)}/changes`,
1781
+ apiKey,
1782
+ { query: options }
1783
+ );
1784
+ return resp.data ?? resp;
1690
1785
  }
1691
1786
  };
1692
1787
  };