@graph8/sdk 0.14.0 → 0.15.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/react.d.mts CHANGED
@@ -1552,6 +1552,8 @@ declare const createInboxClient: (apiKey: string, apiUrl?: string) => {
1552
1552
  };
1553
1553
 
1554
1554
  interface Deal {
1555
+ /** Canonical CRM revision returned by a conditional update. */
1556
+ revision?: number | null;
1555
1557
  id: string | null;
1556
1558
  name: string | null;
1557
1559
  description: string | null;
@@ -1616,6 +1618,8 @@ interface DealCreateParams {
1616
1618
  allow_duplicate?: boolean;
1617
1619
  }
1618
1620
  interface DealUpdateParams {
1621
+ /** Require this current CRM revision; a stale edit returns HTTP 409. */
1622
+ expected_revision?: number;
1619
1623
  name?: string;
1620
1624
  description?: string;
1621
1625
  amount?: number;
@@ -1741,6 +1745,7 @@ declare const createDealsClient: (apiKey: string, apiUrl?: string) => {
1741
1745
  }>;
1742
1746
  };
1743
1747
 
1748
+ type CustomObjectIcon = "box" | "briefcase" | "building" | "calendar" | "flag" | "folder" | "globe" | "heart" | "layers" | "package" | "target" | "users";
1744
1749
  /** A custom object type in your workspace — a record type you define. */
1745
1750
  interface CustomObject {
1746
1751
  /** Stable API slug, e.g. `invoices`. */
@@ -1750,6 +1755,28 @@ interface CustomObject {
1750
1755
  /** True for object types graph8 ships; system objects cannot be deleted. */
1751
1756
  is_system: boolean;
1752
1757
  is_archived: boolean;
1758
+ /** Presentation settings may be absent on older servers. */
1759
+ description?: string | null;
1760
+ icon?: string | null;
1761
+ display_attribute_slug?: string | null;
1762
+ }
1763
+ /** Native schema creation requires objects:manage and current Admin access. */
1764
+ interface CreateCustomObject {
1765
+ slug: string;
1766
+ singular_noun: string;
1767
+ plural_noun: string;
1768
+ description?: string | null;
1769
+ icon?: CustomObjectIcon | null;
1770
+ }
1771
+ /** Omitted labels/state are preserved. The API slug is immutable. */
1772
+ interface UpdateCustomObject {
1773
+ singular_noun?: string;
1774
+ plural_noun?: string;
1775
+ is_archived?: boolean;
1776
+ /** Omit to preserve; null clears the setting. */
1777
+ description?: string | null;
1778
+ icon?: CustomObjectIcon | null;
1779
+ display_attribute_slug?: string | null;
1753
1780
  }
1754
1781
  /**
1755
1782
  * One attribute on a custom object, and the rules its values must satisfy.
@@ -1762,6 +1789,15 @@ interface CustomObject {
1762
1789
  */
1763
1790
  interface CustomObjectAttribute {
1764
1791
  slug: string;
1792
+ /** Customer-facing label. Display metadata is absent on older servers. */
1793
+ title?: string;
1794
+ description?: string | null;
1795
+ /** Display order; ties are ordered by slug. */
1796
+ sort_order?: number;
1797
+ /** Protected system field rather than a customer-defined field. */
1798
+ is_system?: boolean;
1799
+ /** Archive state; absent on older servers. */
1800
+ is_archived?: boolean;
1765
1801
  attribute_type: string;
1766
1802
  is_required: boolean;
1767
1803
  /** No two ACTIVE records may hold the same value. A collision returns 409. */
@@ -1774,6 +1810,24 @@ interface CustomObjectAttribute {
1774
1810
  /** Type-specific configuration, e.g. the allowed options for a `select`. */
1775
1811
  config: Record<string, unknown>;
1776
1812
  }
1813
+ /** Schema creation requires objects:manage and current Admin access. */
1814
+ interface CreateCustomObjectAttribute {
1815
+ slug: string;
1816
+ title: string;
1817
+ attribute_type: "text" | "number" | "currency" | "date" | "timestamp" | "checkbox" | "select" | "status" | "email_address" | "phone_number" | "domain" | "location" | "personal_name" | "record_reference" | "rating" | "actor_reference";
1818
+ description?: string | null;
1819
+ is_required?: boolean;
1820
+ is_unique?: boolean;
1821
+ is_multiselect?: boolean;
1822
+ is_default_value_enabled?: boolean;
1823
+ default_value?: unknown;
1824
+ config?: Record<string, unknown>;
1825
+ sort_order?: number;
1826
+ }
1827
+ /** Omitted fields are preserved; explicit null can clear the configured default. */
1828
+ type UpdateCustomObjectAttribute = Partial<Omit<CreateCustomObjectAttribute, "slug" | "attribute_type">> & {
1829
+ is_archived?: boolean;
1830
+ };
1777
1831
  /** One record, with its currently active attribute values. */
1778
1832
  interface CustomObjectRecord {
1779
1833
  id: string;
@@ -1804,6 +1858,29 @@ interface CustomObjectHistory {
1804
1858
  record_id: string;
1805
1859
  entries: CustomObjectHistoryEntry[];
1806
1860
  }
1861
+ interface CustomObjectMutation {
1862
+ id: string;
1863
+ action: "created" | "updated" | "archived" | "restored";
1864
+ occurred_at: string;
1865
+ revision: number;
1866
+ actor_id: string | null;
1867
+ actor_type: "user" | "api" | "app" | "integration" | "system";
1868
+ source: string;
1869
+ app_id: string | null;
1870
+ changes: Record<string, {
1871
+ before_present: boolean;
1872
+ before: unknown;
1873
+ after_present: boolean;
1874
+ after: unknown;
1875
+ }>;
1876
+ was_archived: boolean;
1877
+ is_archived: boolean;
1878
+ }
1879
+ interface CustomObjectMutations {
1880
+ record_id: string;
1881
+ entries: CustomObjectMutation[];
1882
+ next_cursor: string | null;
1883
+ }
1807
1884
  interface ListRecordsParams {
1808
1885
  page?: number;
1809
1886
  /** 1-200, default 50. */
@@ -1868,16 +1945,33 @@ interface ObjectPagination {
1868
1945
  */
1869
1946
  declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1870
1947
  /** List the custom object types in your workspace. */
1871
- list(): Promise<{
1948
+ list(params?: {
1949
+ include_archived?: boolean;
1950
+ }): Promise<{
1872
1951
  data: CustomObject[];
1873
1952
  }>;
1953
+ /** Create a native custom object. Requires objects:manage and Admin access. */
1954
+ create(input: CreateCustomObject): Promise<CustomObject>;
1955
+ /** Rename, archive or restore an object while preserving its slug and data. */
1956
+ update(objectSlug: string, input: UpdateCustomObject): Promise<CustomObject>;
1957
+ /** Archive the object without deleting records; restore with update({ is_archived: false }). */
1958
+ archive(objectSlug: string): Promise<CustomObject>;
1874
1959
  /** Fetch one object type by slug. */
1875
1960
  get(objectSlug: string): Promise<CustomObject>;
1876
1961
  /** The object's attributes — the schema its records must satisfy. */
1877
- listAttributes(objectSlug: string): Promise<{
1962
+ listAttributes(objectSlug: string, params?: {
1963
+ include_archived?: boolean;
1964
+ }): Promise<{
1878
1965
  data: CustomObjectAttribute[];
1879
1966
  }>;
1880
- /** Paginated records with their current values. Archived records are excluded. */
1967
+ /** Create a field using the same schema rules as the customer UI. */
1968
+ createAttribute(objectSlug: string, input: CreateCustomObjectAttribute): Promise<CustomObjectAttribute>;
1969
+ /** Edit or restore a field; its type and slug are immutable. */
1970
+ updateAttribute(objectSlug: string, attributeSlug: string, input: UpdateCustomObjectAttribute): Promise<CustomObjectAttribute>;
1971
+ /** Archive without deleting values; restore with updateAttribute({ is_archived: false }). */
1972
+ archiveAttribute(objectSlug: string, attributeSlug: string): Promise<CustomObjectAttribute>;
1973
+ /** Paginated custom records or canonical deals with current values and revisions.
1974
+ * Deal totals and related references respect current record access. */
1881
1975
  listRecords(objectSlug: string, params?: ListRecordsParams): Promise<{
1882
1976
  data: CustomObjectRecord[];
1883
1977
  pagination?: ObjectPagination;
@@ -1888,18 +1982,28 @@ declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1888
1982
  * unique attribute is a 409.
1889
1983
  */
1890
1984
  createRecord(objectSlug: string, values: Record<string, unknown>): Promise<CustomObjectRecord>;
1891
- /** Fetch one record with its currently active values. */
1985
+ /** Match a unique single-value key, creating or updating while preserving omitted fields. */
1986
+ upsertRecord(objectSlug: string, matchingAttribute: string, values: Record<string, unknown>, options?: {
1987
+ expectedRevision?: number;
1988
+ }): Promise<CustomObjectRecord>;
1989
+ /** Fetch one custom record, canonical contact/company, or deal by its stable graph8 ID.
1990
+ * Deals retain their UUIDs and expose company, primary-contact and contact_ids references only
1991
+ * when permitted. Generic deal mutations are not yet supported.
1992
+ */
1892
1993
  getRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
1893
1994
  /**
1894
1995
  * Update a record. PARTIAL: only the attributes you send are touched, so
1895
1996
  * required attributes you omit are left alone rather than reported missing.
1896
1997
  * Sending an explicit `null` CLEARS that attribute.
1897
1998
  *
1898
- * Values are versioned rather than overwritten, so the previous value stays
1899
- * readable through `history`.
1999
+ * Custom values retain generations through `history`. Canonical contacts and
2000
+ * companies require expectedRevision from a fresh read and expose recorded
2001
+ * mutations through `changes`. They do not yet support appendValues/removeValues.
1900
2002
  */
1901
2003
  updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown>, options?: {
1902
2004
  expectedRevision?: number;
2005
+ appendValues?: Record<string, unknown[]>;
2006
+ removeValues?: Record<string, unknown[]>;
1903
2007
  }): Promise<CustomObjectRecord>;
1904
2008
  /**
1905
2009
  * Archive a record. It leaves listings, stays readable by id, and keeps its
@@ -1913,6 +2017,14 @@ declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1913
2017
  * null is the value currently in force.
1914
2018
  */
1915
2019
  history(objectSlug: string, recordId: string, limit?: number): Promise<CustomObjectHistory>;
2020
+ /** Recorded custom-record or canonical contact/company mutations. Pass next_cursor to continue.
2021
+ * Canonical history respects current access/privacy; archived records and older
2022
+ * unrecorded writes are not reconstructed. Store unavailability returns 503.
2023
+ */
2024
+ changes(objectSlug: string, recordId: string, options?: {
2025
+ limit?: number;
2026
+ cursor?: string;
2027
+ }): Promise<CustomObjectMutations>;
1916
2028
  };
1917
2029
 
1918
2030
  /**
@@ -2781,7 +2893,7 @@ declare const createContactsClient: (apiKey: string, apiUrl?: string) => {
2781
2893
  * adds events. ``WebhookEvent`` also accepts any string so a newly-added
2782
2894
  * backend event never breaks a client that hasn't upgraded.
2783
2895
  */
2784
- 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"];
2896
+ 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"];
2785
2897
  type WebhookEvent = (typeof KNOWN_WEBHOOK_EVENTS)[number] | (string & {});
2786
2898
  /** The decoded body graph8 delivers to a webhook endpoint. */
2787
2899
  interface WebhookEventPayload {
@@ -2789,7 +2901,7 @@ interface WebhookEventPayload {
2789
2901
  timestamp: string;
2790
2902
  data: Record<string, unknown>;
2791
2903
  org_id: string;
2792
- /** Stable per-delivery id (present once the backend adds it; for consumer dedup). */
2904
+ /** Stable event ID for consumer deduplication; delivery ID is in X-Studio-Delivery-Id. */
2793
2905
  id?: string;
2794
2906
  }
2795
2907
  interface ConstructEventOptions {
@@ -2808,7 +2920,7 @@ declare const createWebhooksClient: (_apiKey: string, apiUrl?: string) => {
2808
2920
  /** Base URL the webhook subscription API lives under. */
2809
2921
  baseUrl: string;
2810
2922
  /** Known event types (for autocomplete / validation). */
2811
- 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"];
2923
+ 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"];
2812
2924
  /** Verify an incoming webhook's HMAC signature and return the parsed event. */
2813
2925
  constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
2814
2926
  };
@@ -3915,7 +4027,7 @@ declare const useG8: () => {
3915
4027
  };
3916
4028
  get webhooks(): {
3917
4029
  baseUrl: string;
3918
- 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"];
4030
+ 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"];
3919
4031
  constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
3920
4032
  };
3921
4033
  get contacts(): {
@@ -4077,25 +4189,44 @@ declare const useG8: () => {
4077
4189
  }>;
4078
4190
  };
4079
4191
  get objects(): {
4080
- list(): Promise<{
4192
+ list(params?: {
4193
+ include_archived?: boolean;
4194
+ }): Promise<{
4081
4195
  data: CustomObject[];
4082
4196
  }>;
4197
+ create(input: CreateCustomObject): Promise<CustomObject>;
4198
+ update(objectSlug: string, input: UpdateCustomObject): Promise<CustomObject>;
4199
+ archive(objectSlug: string): Promise<CustomObject>;
4083
4200
  get(objectSlug: string): Promise<CustomObject>;
4084
- listAttributes(objectSlug: string): Promise<{
4201
+ listAttributes(objectSlug: string, params?: {
4202
+ include_archived?: boolean;
4203
+ }): Promise<{
4085
4204
  data: CustomObjectAttribute[];
4086
4205
  }>;
4206
+ createAttribute(objectSlug: string, input: CreateCustomObjectAttribute): Promise<CustomObjectAttribute>;
4207
+ updateAttribute(objectSlug: string, attributeSlug: string, input: UpdateCustomObjectAttribute): Promise<CustomObjectAttribute>;
4208
+ archiveAttribute(objectSlug: string, attributeSlug: string): Promise<CustomObjectAttribute>;
4087
4209
  listRecords(objectSlug: string, params?: ListRecordsParams): Promise<{
4088
4210
  data: CustomObjectRecord[];
4089
4211
  pagination?: ObjectPagination;
4090
4212
  }>;
4091
4213
  createRecord(objectSlug: string, values: Record<string, unknown>): Promise<CustomObjectRecord>;
4214
+ upsertRecord(objectSlug: string, matchingAttribute: string, values: Record<string, unknown>, options?: {
4215
+ expectedRevision?: number;
4216
+ }): Promise<CustomObjectRecord>;
4092
4217
  getRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4093
4218
  updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown>, options?: {
4094
4219
  expectedRevision?: number;
4220
+ appendValues?: Record<string, unknown[]>;
4221
+ removeValues?: Record<string, unknown[]>;
4095
4222
  }): Promise<CustomObjectRecord>;
4096
4223
  archiveRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4097
4224
  restoreRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4098
4225
  history(objectSlug: string, recordId: string, limit?: number): Promise<CustomObjectHistory>;
4226
+ changes(objectSlug: string, recordId: string, options?: {
4227
+ limit?: number;
4228
+ cursor?: string;
4229
+ }): Promise<CustomObjectMutations>;
4099
4230
  };
4100
4231
  get deals(): {
4101
4232
  pipelines(): Promise<{
package/dist/react.d.ts CHANGED
@@ -1552,6 +1552,8 @@ declare const createInboxClient: (apiKey: string, apiUrl?: string) => {
1552
1552
  };
1553
1553
 
1554
1554
  interface Deal {
1555
+ /** Canonical CRM revision returned by a conditional update. */
1556
+ revision?: number | null;
1555
1557
  id: string | null;
1556
1558
  name: string | null;
1557
1559
  description: string | null;
@@ -1616,6 +1618,8 @@ interface DealCreateParams {
1616
1618
  allow_duplicate?: boolean;
1617
1619
  }
1618
1620
  interface DealUpdateParams {
1621
+ /** Require this current CRM revision; a stale edit returns HTTP 409. */
1622
+ expected_revision?: number;
1619
1623
  name?: string;
1620
1624
  description?: string;
1621
1625
  amount?: number;
@@ -1741,6 +1745,7 @@ declare const createDealsClient: (apiKey: string, apiUrl?: string) => {
1741
1745
  }>;
1742
1746
  };
1743
1747
 
1748
+ type CustomObjectIcon = "box" | "briefcase" | "building" | "calendar" | "flag" | "folder" | "globe" | "heart" | "layers" | "package" | "target" | "users";
1744
1749
  /** A custom object type in your workspace — a record type you define. */
1745
1750
  interface CustomObject {
1746
1751
  /** Stable API slug, e.g. `invoices`. */
@@ -1750,6 +1755,28 @@ interface CustomObject {
1750
1755
  /** True for object types graph8 ships; system objects cannot be deleted. */
1751
1756
  is_system: boolean;
1752
1757
  is_archived: boolean;
1758
+ /** Presentation settings may be absent on older servers. */
1759
+ description?: string | null;
1760
+ icon?: string | null;
1761
+ display_attribute_slug?: string | null;
1762
+ }
1763
+ /** Native schema creation requires objects:manage and current Admin access. */
1764
+ interface CreateCustomObject {
1765
+ slug: string;
1766
+ singular_noun: string;
1767
+ plural_noun: string;
1768
+ description?: string | null;
1769
+ icon?: CustomObjectIcon | null;
1770
+ }
1771
+ /** Omitted labels/state are preserved. The API slug is immutable. */
1772
+ interface UpdateCustomObject {
1773
+ singular_noun?: string;
1774
+ plural_noun?: string;
1775
+ is_archived?: boolean;
1776
+ /** Omit to preserve; null clears the setting. */
1777
+ description?: string | null;
1778
+ icon?: CustomObjectIcon | null;
1779
+ display_attribute_slug?: string | null;
1753
1780
  }
1754
1781
  /**
1755
1782
  * One attribute on a custom object, and the rules its values must satisfy.
@@ -1762,6 +1789,15 @@ interface CustomObject {
1762
1789
  */
1763
1790
  interface CustomObjectAttribute {
1764
1791
  slug: string;
1792
+ /** Customer-facing label. Display metadata is absent on older servers. */
1793
+ title?: string;
1794
+ description?: string | null;
1795
+ /** Display order; ties are ordered by slug. */
1796
+ sort_order?: number;
1797
+ /** Protected system field rather than a customer-defined field. */
1798
+ is_system?: boolean;
1799
+ /** Archive state; absent on older servers. */
1800
+ is_archived?: boolean;
1765
1801
  attribute_type: string;
1766
1802
  is_required: boolean;
1767
1803
  /** No two ACTIVE records may hold the same value. A collision returns 409. */
@@ -1774,6 +1810,24 @@ interface CustomObjectAttribute {
1774
1810
  /** Type-specific configuration, e.g. the allowed options for a `select`. */
1775
1811
  config: Record<string, unknown>;
1776
1812
  }
1813
+ /** Schema creation requires objects:manage and current Admin access. */
1814
+ interface CreateCustomObjectAttribute {
1815
+ slug: string;
1816
+ title: string;
1817
+ attribute_type: "text" | "number" | "currency" | "date" | "timestamp" | "checkbox" | "select" | "status" | "email_address" | "phone_number" | "domain" | "location" | "personal_name" | "record_reference" | "rating" | "actor_reference";
1818
+ description?: string | null;
1819
+ is_required?: boolean;
1820
+ is_unique?: boolean;
1821
+ is_multiselect?: boolean;
1822
+ is_default_value_enabled?: boolean;
1823
+ default_value?: unknown;
1824
+ config?: Record<string, unknown>;
1825
+ sort_order?: number;
1826
+ }
1827
+ /** Omitted fields are preserved; explicit null can clear the configured default. */
1828
+ type UpdateCustomObjectAttribute = Partial<Omit<CreateCustomObjectAttribute, "slug" | "attribute_type">> & {
1829
+ is_archived?: boolean;
1830
+ };
1777
1831
  /** One record, with its currently active attribute values. */
1778
1832
  interface CustomObjectRecord {
1779
1833
  id: string;
@@ -1804,6 +1858,29 @@ interface CustomObjectHistory {
1804
1858
  record_id: string;
1805
1859
  entries: CustomObjectHistoryEntry[];
1806
1860
  }
1861
+ interface CustomObjectMutation {
1862
+ id: string;
1863
+ action: "created" | "updated" | "archived" | "restored";
1864
+ occurred_at: string;
1865
+ revision: number;
1866
+ actor_id: string | null;
1867
+ actor_type: "user" | "api" | "app" | "integration" | "system";
1868
+ source: string;
1869
+ app_id: string | null;
1870
+ changes: Record<string, {
1871
+ before_present: boolean;
1872
+ before: unknown;
1873
+ after_present: boolean;
1874
+ after: unknown;
1875
+ }>;
1876
+ was_archived: boolean;
1877
+ is_archived: boolean;
1878
+ }
1879
+ interface CustomObjectMutations {
1880
+ record_id: string;
1881
+ entries: CustomObjectMutation[];
1882
+ next_cursor: string | null;
1883
+ }
1807
1884
  interface ListRecordsParams {
1808
1885
  page?: number;
1809
1886
  /** 1-200, default 50. */
@@ -1868,16 +1945,33 @@ interface ObjectPagination {
1868
1945
  */
1869
1946
  declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1870
1947
  /** List the custom object types in your workspace. */
1871
- list(): Promise<{
1948
+ list(params?: {
1949
+ include_archived?: boolean;
1950
+ }): Promise<{
1872
1951
  data: CustomObject[];
1873
1952
  }>;
1953
+ /** Create a native custom object. Requires objects:manage and Admin access. */
1954
+ create(input: CreateCustomObject): Promise<CustomObject>;
1955
+ /** Rename, archive or restore an object while preserving its slug and data. */
1956
+ update(objectSlug: string, input: UpdateCustomObject): Promise<CustomObject>;
1957
+ /** Archive the object without deleting records; restore with update({ is_archived: false }). */
1958
+ archive(objectSlug: string): Promise<CustomObject>;
1874
1959
  /** Fetch one object type by slug. */
1875
1960
  get(objectSlug: string): Promise<CustomObject>;
1876
1961
  /** The object's attributes — the schema its records must satisfy. */
1877
- listAttributes(objectSlug: string): Promise<{
1962
+ listAttributes(objectSlug: string, params?: {
1963
+ include_archived?: boolean;
1964
+ }): Promise<{
1878
1965
  data: CustomObjectAttribute[];
1879
1966
  }>;
1880
- /** Paginated records with their current values. Archived records are excluded. */
1967
+ /** Create a field using the same schema rules as the customer UI. */
1968
+ createAttribute(objectSlug: string, input: CreateCustomObjectAttribute): Promise<CustomObjectAttribute>;
1969
+ /** Edit or restore a field; its type and slug are immutable. */
1970
+ updateAttribute(objectSlug: string, attributeSlug: string, input: UpdateCustomObjectAttribute): Promise<CustomObjectAttribute>;
1971
+ /** Archive without deleting values; restore with updateAttribute({ is_archived: false }). */
1972
+ archiveAttribute(objectSlug: string, attributeSlug: string): Promise<CustomObjectAttribute>;
1973
+ /** Paginated custom records or canonical deals with current values and revisions.
1974
+ * Deal totals and related references respect current record access. */
1881
1975
  listRecords(objectSlug: string, params?: ListRecordsParams): Promise<{
1882
1976
  data: CustomObjectRecord[];
1883
1977
  pagination?: ObjectPagination;
@@ -1888,18 +1982,28 @@ declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1888
1982
  * unique attribute is a 409.
1889
1983
  */
1890
1984
  createRecord(objectSlug: string, values: Record<string, unknown>): Promise<CustomObjectRecord>;
1891
- /** Fetch one record with its currently active values. */
1985
+ /** Match a unique single-value key, creating or updating while preserving omitted fields. */
1986
+ upsertRecord(objectSlug: string, matchingAttribute: string, values: Record<string, unknown>, options?: {
1987
+ expectedRevision?: number;
1988
+ }): Promise<CustomObjectRecord>;
1989
+ /** Fetch one custom record, canonical contact/company, or deal by its stable graph8 ID.
1990
+ * Deals retain their UUIDs and expose company, primary-contact and contact_ids references only
1991
+ * when permitted. Generic deal mutations are not yet supported.
1992
+ */
1892
1993
  getRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
1893
1994
  /**
1894
1995
  * Update a record. PARTIAL: only the attributes you send are touched, so
1895
1996
  * required attributes you omit are left alone rather than reported missing.
1896
1997
  * Sending an explicit `null` CLEARS that attribute.
1897
1998
  *
1898
- * Values are versioned rather than overwritten, so the previous value stays
1899
- * readable through `history`.
1999
+ * Custom values retain generations through `history`. Canonical contacts and
2000
+ * companies require expectedRevision from a fresh read and expose recorded
2001
+ * mutations through `changes`. They do not yet support appendValues/removeValues.
1900
2002
  */
1901
2003
  updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown>, options?: {
1902
2004
  expectedRevision?: number;
2005
+ appendValues?: Record<string, unknown[]>;
2006
+ removeValues?: Record<string, unknown[]>;
1903
2007
  }): Promise<CustomObjectRecord>;
1904
2008
  /**
1905
2009
  * Archive a record. It leaves listings, stays readable by id, and keeps its
@@ -1913,6 +2017,14 @@ declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1913
2017
  * null is the value currently in force.
1914
2018
  */
1915
2019
  history(objectSlug: string, recordId: string, limit?: number): Promise<CustomObjectHistory>;
2020
+ /** Recorded custom-record or canonical contact/company mutations. Pass next_cursor to continue.
2021
+ * Canonical history respects current access/privacy; archived records and older
2022
+ * unrecorded writes are not reconstructed. Store unavailability returns 503.
2023
+ */
2024
+ changes(objectSlug: string, recordId: string, options?: {
2025
+ limit?: number;
2026
+ cursor?: string;
2027
+ }): Promise<CustomObjectMutations>;
1916
2028
  };
1917
2029
 
1918
2030
  /**
@@ -2781,7 +2893,7 @@ declare const createContactsClient: (apiKey: string, apiUrl?: string) => {
2781
2893
  * adds events. ``WebhookEvent`` also accepts any string so a newly-added
2782
2894
  * backend event never breaks a client that hasn't upgraded.
2783
2895
  */
2784
- 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"];
2896
+ 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"];
2785
2897
  type WebhookEvent = (typeof KNOWN_WEBHOOK_EVENTS)[number] | (string & {});
2786
2898
  /** The decoded body graph8 delivers to a webhook endpoint. */
2787
2899
  interface WebhookEventPayload {
@@ -2789,7 +2901,7 @@ interface WebhookEventPayload {
2789
2901
  timestamp: string;
2790
2902
  data: Record<string, unknown>;
2791
2903
  org_id: string;
2792
- /** Stable per-delivery id (present once the backend adds it; for consumer dedup). */
2904
+ /** Stable event ID for consumer deduplication; delivery ID is in X-Studio-Delivery-Id. */
2793
2905
  id?: string;
2794
2906
  }
2795
2907
  interface ConstructEventOptions {
@@ -2808,7 +2920,7 @@ declare const createWebhooksClient: (_apiKey: string, apiUrl?: string) => {
2808
2920
  /** Base URL the webhook subscription API lives under. */
2809
2921
  baseUrl: string;
2810
2922
  /** Known event types (for autocomplete / validation). */
2811
- 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"];
2923
+ 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"];
2812
2924
  /** Verify an incoming webhook's HMAC signature and return the parsed event. */
2813
2925
  constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
2814
2926
  };
@@ -3915,7 +4027,7 @@ declare const useG8: () => {
3915
4027
  };
3916
4028
  get webhooks(): {
3917
4029
  baseUrl: string;
3918
- 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"];
4030
+ 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"];
3919
4031
  constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
3920
4032
  };
3921
4033
  get contacts(): {
@@ -4077,25 +4189,44 @@ declare const useG8: () => {
4077
4189
  }>;
4078
4190
  };
4079
4191
  get objects(): {
4080
- list(): Promise<{
4192
+ list(params?: {
4193
+ include_archived?: boolean;
4194
+ }): Promise<{
4081
4195
  data: CustomObject[];
4082
4196
  }>;
4197
+ create(input: CreateCustomObject): Promise<CustomObject>;
4198
+ update(objectSlug: string, input: UpdateCustomObject): Promise<CustomObject>;
4199
+ archive(objectSlug: string): Promise<CustomObject>;
4083
4200
  get(objectSlug: string): Promise<CustomObject>;
4084
- listAttributes(objectSlug: string): Promise<{
4201
+ listAttributes(objectSlug: string, params?: {
4202
+ include_archived?: boolean;
4203
+ }): Promise<{
4085
4204
  data: CustomObjectAttribute[];
4086
4205
  }>;
4206
+ createAttribute(objectSlug: string, input: CreateCustomObjectAttribute): Promise<CustomObjectAttribute>;
4207
+ updateAttribute(objectSlug: string, attributeSlug: string, input: UpdateCustomObjectAttribute): Promise<CustomObjectAttribute>;
4208
+ archiveAttribute(objectSlug: string, attributeSlug: string): Promise<CustomObjectAttribute>;
4087
4209
  listRecords(objectSlug: string, params?: ListRecordsParams): Promise<{
4088
4210
  data: CustomObjectRecord[];
4089
4211
  pagination?: ObjectPagination;
4090
4212
  }>;
4091
4213
  createRecord(objectSlug: string, values: Record<string, unknown>): Promise<CustomObjectRecord>;
4214
+ upsertRecord(objectSlug: string, matchingAttribute: string, values: Record<string, unknown>, options?: {
4215
+ expectedRevision?: number;
4216
+ }): Promise<CustomObjectRecord>;
4092
4217
  getRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4093
4218
  updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown>, options?: {
4094
4219
  expectedRevision?: number;
4220
+ appendValues?: Record<string, unknown[]>;
4221
+ removeValues?: Record<string, unknown[]>;
4095
4222
  }): Promise<CustomObjectRecord>;
4096
4223
  archiveRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4097
4224
  restoreRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4098
4225
  history(objectSlug: string, recordId: string, limit?: number): Promise<CustomObjectHistory>;
4226
+ changes(objectSlug: string, recordId: string, options?: {
4227
+ limit?: number;
4228
+ cursor?: string;
4229
+ }): Promise<CustomObjectMutations>;
4099
4230
  };
4100
4231
  get deals(): {
4101
4232
  pipelines(): Promise<{