@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/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;
@@ -1651,7 +1655,26 @@ interface DealUpdateParams {
1651
1655
  add_contact_ids?: number[];
1652
1656
  /** mashup_contact_ids to unlink. Idempotent. */
1653
1657
  remove_contact_ids?: number[];
1658
+ /**
1659
+ * Buying-committee role per contact on this deal, keyed by
1660
+ * mashup_contact_id. JSON object keys are strings, so the key type is
1661
+ * `string` even though the id is numeric: `{ "5500429": "champion" }`.
1662
+ * `null` clears a contact's role.
1663
+ *
1664
+ * Applies to contacts already linked to the deal, and to contacts linked by
1665
+ * `add_contact_ids` in the same call (roles are applied after the link). An
1666
+ * id that is neither already linked nor being added is rejected with HTTP
1667
+ * 422 naming the id, and the whole update is rolled back. A role outside the
1668
+ * vocabulary is HTTP 422.
1669
+ */
1670
+ contact_roles?: Record<string, DealContactRole | null>;
1654
1671
  }
1672
+ /**
1673
+ * Role a contact plays in a deal's buying committee
1674
+ * (`cb_deal_contacts.role`). The same person can hold different roles on
1675
+ * different deals, so this lives on the deal-contact link, not the contact.
1676
+ */
1677
+ type DealContactRole = "champion" | "decision_maker" | "influencer" | "blocker" | "coach" | "end_user";
1655
1678
  interface DealListParams {
1656
1679
  page?: number;
1657
1680
  limit?: number;
@@ -1741,6 +1764,7 @@ declare const createDealsClient: (apiKey: string, apiUrl?: string) => {
1741
1764
  }>;
1742
1765
  };
1743
1766
 
1767
+ type CustomObjectIcon = "box" | "briefcase" | "building" | "calendar" | "flag" | "folder" | "globe" | "heart" | "layers" | "package" | "target" | "users";
1744
1768
  /** A custom object type in your workspace — a record type you define. */
1745
1769
  interface CustomObject {
1746
1770
  /** Stable API slug, e.g. `invoices`. */
@@ -1750,6 +1774,28 @@ interface CustomObject {
1750
1774
  /** True for object types graph8 ships; system objects cannot be deleted. */
1751
1775
  is_system: boolean;
1752
1776
  is_archived: boolean;
1777
+ /** Presentation settings may be absent on older servers. */
1778
+ description?: string | null;
1779
+ icon?: string | null;
1780
+ display_attribute_slug?: string | null;
1781
+ }
1782
+ /** Native schema creation requires objects:manage and current Admin access. */
1783
+ interface CreateCustomObject {
1784
+ slug: string;
1785
+ singular_noun: string;
1786
+ plural_noun: string;
1787
+ description?: string | null;
1788
+ icon?: CustomObjectIcon | null;
1789
+ }
1790
+ /** Omitted labels/state are preserved. The API slug is immutable. */
1791
+ interface UpdateCustomObject {
1792
+ singular_noun?: string;
1793
+ plural_noun?: string;
1794
+ is_archived?: boolean;
1795
+ /** Omit to preserve; null clears the setting. */
1796
+ description?: string | null;
1797
+ icon?: CustomObjectIcon | null;
1798
+ display_attribute_slug?: string | null;
1753
1799
  }
1754
1800
  /**
1755
1801
  * One attribute on a custom object, and the rules its values must satisfy.
@@ -1762,6 +1808,15 @@ interface CustomObject {
1762
1808
  */
1763
1809
  interface CustomObjectAttribute {
1764
1810
  slug: string;
1811
+ /** Customer-facing label. Display metadata is absent on older servers. */
1812
+ title?: string;
1813
+ description?: string | null;
1814
+ /** Display order; ties are ordered by slug. */
1815
+ sort_order?: number;
1816
+ /** Protected system field rather than a customer-defined field. */
1817
+ is_system?: boolean;
1818
+ /** Archive state; absent on older servers. */
1819
+ is_archived?: boolean;
1765
1820
  attribute_type: string;
1766
1821
  is_required: boolean;
1767
1822
  /** No two ACTIVE records may hold the same value. A collision returns 409. */
@@ -1774,6 +1829,24 @@ interface CustomObjectAttribute {
1774
1829
  /** Type-specific configuration, e.g. the allowed options for a `select`. */
1775
1830
  config: Record<string, unknown>;
1776
1831
  }
1832
+ /** Schema creation requires objects:manage and current Admin access. */
1833
+ interface CreateCustomObjectAttribute {
1834
+ slug: string;
1835
+ title: string;
1836
+ attribute_type: "text" | "number" | "currency" | "date" | "timestamp" | "checkbox" | "select" | "status" | "email_address" | "phone_number" | "domain" | "location" | "personal_name" | "record_reference" | "rating" | "actor_reference";
1837
+ description?: string | null;
1838
+ is_required?: boolean;
1839
+ is_unique?: boolean;
1840
+ is_multiselect?: boolean;
1841
+ is_default_value_enabled?: boolean;
1842
+ default_value?: unknown;
1843
+ config?: Record<string, unknown>;
1844
+ sort_order?: number;
1845
+ }
1846
+ /** Omitted fields are preserved; explicit null can clear the configured default. */
1847
+ type UpdateCustomObjectAttribute = Partial<Omit<CreateCustomObjectAttribute, "slug" | "attribute_type">> & {
1848
+ is_archived?: boolean;
1849
+ };
1777
1850
  /** One record, with its currently active attribute values. */
1778
1851
  interface CustomObjectRecord {
1779
1852
  id: string;
@@ -1804,6 +1877,29 @@ interface CustomObjectHistory {
1804
1877
  record_id: string;
1805
1878
  entries: CustomObjectHistoryEntry[];
1806
1879
  }
1880
+ interface CustomObjectMutation {
1881
+ id: string;
1882
+ action: "created" | "updated" | "archived" | "restored";
1883
+ occurred_at: string;
1884
+ revision: number;
1885
+ actor_id: string | null;
1886
+ actor_type: "user" | "api" | "app" | "integration" | "system";
1887
+ source: string;
1888
+ app_id: string | null;
1889
+ changes: Record<string, {
1890
+ before_present: boolean;
1891
+ before: unknown;
1892
+ after_present: boolean;
1893
+ after: unknown;
1894
+ }>;
1895
+ was_archived: boolean;
1896
+ is_archived: boolean;
1897
+ }
1898
+ interface CustomObjectMutations {
1899
+ record_id: string;
1900
+ entries: CustomObjectMutation[];
1901
+ next_cursor: string | null;
1902
+ }
1807
1903
  interface ListRecordsParams {
1808
1904
  page?: number;
1809
1905
  /** 1-200, default 50. */
@@ -1868,16 +1964,33 @@ interface ObjectPagination {
1868
1964
  */
1869
1965
  declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1870
1966
  /** List the custom object types in your workspace. */
1871
- list(): Promise<{
1967
+ list(params?: {
1968
+ include_archived?: boolean;
1969
+ }): Promise<{
1872
1970
  data: CustomObject[];
1873
1971
  }>;
1972
+ /** Create a native custom object. Requires objects:manage and Admin access. */
1973
+ create(input: CreateCustomObject): Promise<CustomObject>;
1974
+ /** Rename, archive or restore an object while preserving its slug and data. */
1975
+ update(objectSlug: string, input: UpdateCustomObject): Promise<CustomObject>;
1976
+ /** Archive the object without deleting records; restore with update({ is_archived: false }). */
1977
+ archive(objectSlug: string): Promise<CustomObject>;
1874
1978
  /** Fetch one object type by slug. */
1875
1979
  get(objectSlug: string): Promise<CustomObject>;
1876
1980
  /** The object's attributes — the schema its records must satisfy. */
1877
- listAttributes(objectSlug: string): Promise<{
1981
+ listAttributes(objectSlug: string, params?: {
1982
+ include_archived?: boolean;
1983
+ }): Promise<{
1878
1984
  data: CustomObjectAttribute[];
1879
1985
  }>;
1880
- /** Paginated records with their current values. Archived records are excluded. */
1986
+ /** Create a field using the same schema rules as the customer UI. */
1987
+ createAttribute(objectSlug: string, input: CreateCustomObjectAttribute): Promise<CustomObjectAttribute>;
1988
+ /** Edit or restore a field; its type and slug are immutable. */
1989
+ updateAttribute(objectSlug: string, attributeSlug: string, input: UpdateCustomObjectAttribute): Promise<CustomObjectAttribute>;
1990
+ /** Archive without deleting values; restore with updateAttribute({ is_archived: false }). */
1991
+ archiveAttribute(objectSlug: string, attributeSlug: string): Promise<CustomObjectAttribute>;
1992
+ /** Paginated custom records or canonical deals with current values and revisions.
1993
+ * Deal totals and related references respect current record access. */
1881
1994
  listRecords(objectSlug: string, params?: ListRecordsParams): Promise<{
1882
1995
  data: CustomObjectRecord[];
1883
1996
  pagination?: ObjectPagination;
@@ -1888,18 +2001,28 @@ declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1888
2001
  * unique attribute is a 409.
1889
2002
  */
1890
2003
  createRecord(objectSlug: string, values: Record<string, unknown>): Promise<CustomObjectRecord>;
1891
- /** Fetch one record with its currently active values. */
2004
+ /** Match a unique single-value key, creating or updating while preserving omitted fields. */
2005
+ upsertRecord(objectSlug: string, matchingAttribute: string, values: Record<string, unknown>, options?: {
2006
+ expectedRevision?: number;
2007
+ }): Promise<CustomObjectRecord>;
2008
+ /** Fetch one custom record, canonical contact/company, or deal by its stable graph8 ID.
2009
+ * Deals retain their UUIDs and expose company, primary-contact and contact_ids references only
2010
+ * when permitted. Generic deal mutations are not yet supported.
2011
+ */
1892
2012
  getRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
1893
2013
  /**
1894
2014
  * Update a record. PARTIAL: only the attributes you send are touched, so
1895
2015
  * required attributes you omit are left alone rather than reported missing.
1896
2016
  * Sending an explicit `null` CLEARS that attribute.
1897
2017
  *
1898
- * Values are versioned rather than overwritten, so the previous value stays
1899
- * readable through `history`.
2018
+ * Custom values retain generations through `history`. Canonical contacts and
2019
+ * companies require expectedRevision from a fresh read and expose recorded
2020
+ * mutations through `changes`. They do not yet support appendValues/removeValues.
1900
2021
  */
1901
2022
  updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown>, options?: {
1902
2023
  expectedRevision?: number;
2024
+ appendValues?: Record<string, unknown[]>;
2025
+ removeValues?: Record<string, unknown[]>;
1903
2026
  }): Promise<CustomObjectRecord>;
1904
2027
  /**
1905
2028
  * Archive a record. It leaves listings, stays readable by id, and keeps its
@@ -1913,6 +2036,14 @@ declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1913
2036
  * null is the value currently in force.
1914
2037
  */
1915
2038
  history(objectSlug: string, recordId: string, limit?: number): Promise<CustomObjectHistory>;
2039
+ /** Recorded custom-record or canonical contact/company mutations. Pass next_cursor to continue.
2040
+ * Canonical history respects current access/privacy; archived records and older
2041
+ * unrecorded writes are not reconstructed. Store unavailability returns 503.
2042
+ */
2043
+ changes(objectSlug: string, recordId: string, options?: {
2044
+ limit?: number;
2045
+ cursor?: string;
2046
+ }): Promise<CustomObjectMutations>;
1916
2047
  };
1917
2048
 
1918
2049
  /**
@@ -2781,7 +2912,7 @@ declare const createContactsClient: (apiKey: string, apiUrl?: string) => {
2781
2912
  * adds events. ``WebhookEvent`` also accepts any string so a newly-added
2782
2913
  * backend event never breaks a client that hasn't upgraded.
2783
2914
  */
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"];
2915
+ 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
2916
  type WebhookEvent = (typeof KNOWN_WEBHOOK_EVENTS)[number] | (string & {});
2786
2917
  /** The decoded body graph8 delivers to a webhook endpoint. */
2787
2918
  interface WebhookEventPayload {
@@ -2789,7 +2920,7 @@ interface WebhookEventPayload {
2789
2920
  timestamp: string;
2790
2921
  data: Record<string, unknown>;
2791
2922
  org_id: string;
2792
- /** Stable per-delivery id (present once the backend adds it; for consumer dedup). */
2923
+ /** Stable event ID for consumer deduplication; delivery ID is in X-Studio-Delivery-Id. */
2793
2924
  id?: string;
2794
2925
  }
2795
2926
  interface ConstructEventOptions {
@@ -2808,7 +2939,7 @@ declare const createWebhooksClient: (_apiKey: string, apiUrl?: string) => {
2808
2939
  /** Base URL the webhook subscription API lives under. */
2809
2940
  baseUrl: string;
2810
2941
  /** 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"];
2942
+ 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
2943
  /** Verify an incoming webhook's HMAC signature and return the parsed event. */
2813
2944
  constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
2814
2945
  };
@@ -3915,7 +4046,7 @@ declare const useG8: () => {
3915
4046
  };
3916
4047
  get webhooks(): {
3917
4048
  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"];
4049
+ 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
4050
  constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
3920
4051
  };
3921
4052
  get contacts(): {
@@ -4077,25 +4208,44 @@ declare const useG8: () => {
4077
4208
  }>;
4078
4209
  };
4079
4210
  get objects(): {
4080
- list(): Promise<{
4211
+ list(params?: {
4212
+ include_archived?: boolean;
4213
+ }): Promise<{
4081
4214
  data: CustomObject[];
4082
4215
  }>;
4216
+ create(input: CreateCustomObject): Promise<CustomObject>;
4217
+ update(objectSlug: string, input: UpdateCustomObject): Promise<CustomObject>;
4218
+ archive(objectSlug: string): Promise<CustomObject>;
4083
4219
  get(objectSlug: string): Promise<CustomObject>;
4084
- listAttributes(objectSlug: string): Promise<{
4220
+ listAttributes(objectSlug: string, params?: {
4221
+ include_archived?: boolean;
4222
+ }): Promise<{
4085
4223
  data: CustomObjectAttribute[];
4086
4224
  }>;
4225
+ createAttribute(objectSlug: string, input: CreateCustomObjectAttribute): Promise<CustomObjectAttribute>;
4226
+ updateAttribute(objectSlug: string, attributeSlug: string, input: UpdateCustomObjectAttribute): Promise<CustomObjectAttribute>;
4227
+ archiveAttribute(objectSlug: string, attributeSlug: string): Promise<CustomObjectAttribute>;
4087
4228
  listRecords(objectSlug: string, params?: ListRecordsParams): Promise<{
4088
4229
  data: CustomObjectRecord[];
4089
4230
  pagination?: ObjectPagination;
4090
4231
  }>;
4091
4232
  createRecord(objectSlug: string, values: Record<string, unknown>): Promise<CustomObjectRecord>;
4233
+ upsertRecord(objectSlug: string, matchingAttribute: string, values: Record<string, unknown>, options?: {
4234
+ expectedRevision?: number;
4235
+ }): Promise<CustomObjectRecord>;
4092
4236
  getRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4093
4237
  updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown>, options?: {
4094
4238
  expectedRevision?: number;
4239
+ appendValues?: Record<string, unknown[]>;
4240
+ removeValues?: Record<string, unknown[]>;
4095
4241
  }): Promise<CustomObjectRecord>;
4096
4242
  archiveRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4097
4243
  restoreRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4098
4244
  history(objectSlug: string, recordId: string, limit?: number): Promise<CustomObjectHistory>;
4245
+ changes(objectSlug: string, recordId: string, options?: {
4246
+ limit?: number;
4247
+ cursor?: string;
4248
+ }): Promise<CustomObjectMutations>;
4099
4249
  };
4100
4250
  get deals(): {
4101
4251
  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;
@@ -1651,7 +1655,26 @@ interface DealUpdateParams {
1651
1655
  add_contact_ids?: number[];
1652
1656
  /** mashup_contact_ids to unlink. Idempotent. */
1653
1657
  remove_contact_ids?: number[];
1658
+ /**
1659
+ * Buying-committee role per contact on this deal, keyed by
1660
+ * mashup_contact_id. JSON object keys are strings, so the key type is
1661
+ * `string` even though the id is numeric: `{ "5500429": "champion" }`.
1662
+ * `null` clears a contact's role.
1663
+ *
1664
+ * Applies to contacts already linked to the deal, and to contacts linked by
1665
+ * `add_contact_ids` in the same call (roles are applied after the link). An
1666
+ * id that is neither already linked nor being added is rejected with HTTP
1667
+ * 422 naming the id, and the whole update is rolled back. A role outside the
1668
+ * vocabulary is HTTP 422.
1669
+ */
1670
+ contact_roles?: Record<string, DealContactRole | null>;
1654
1671
  }
1672
+ /**
1673
+ * Role a contact plays in a deal's buying committee
1674
+ * (`cb_deal_contacts.role`). The same person can hold different roles on
1675
+ * different deals, so this lives on the deal-contact link, not the contact.
1676
+ */
1677
+ type DealContactRole = "champion" | "decision_maker" | "influencer" | "blocker" | "coach" | "end_user";
1655
1678
  interface DealListParams {
1656
1679
  page?: number;
1657
1680
  limit?: number;
@@ -1741,6 +1764,7 @@ declare const createDealsClient: (apiKey: string, apiUrl?: string) => {
1741
1764
  }>;
1742
1765
  };
1743
1766
 
1767
+ type CustomObjectIcon = "box" | "briefcase" | "building" | "calendar" | "flag" | "folder" | "globe" | "heart" | "layers" | "package" | "target" | "users";
1744
1768
  /** A custom object type in your workspace — a record type you define. */
1745
1769
  interface CustomObject {
1746
1770
  /** Stable API slug, e.g. `invoices`. */
@@ -1750,6 +1774,28 @@ interface CustomObject {
1750
1774
  /** True for object types graph8 ships; system objects cannot be deleted. */
1751
1775
  is_system: boolean;
1752
1776
  is_archived: boolean;
1777
+ /** Presentation settings may be absent on older servers. */
1778
+ description?: string | null;
1779
+ icon?: string | null;
1780
+ display_attribute_slug?: string | null;
1781
+ }
1782
+ /** Native schema creation requires objects:manage and current Admin access. */
1783
+ interface CreateCustomObject {
1784
+ slug: string;
1785
+ singular_noun: string;
1786
+ plural_noun: string;
1787
+ description?: string | null;
1788
+ icon?: CustomObjectIcon | null;
1789
+ }
1790
+ /** Omitted labels/state are preserved. The API slug is immutable. */
1791
+ interface UpdateCustomObject {
1792
+ singular_noun?: string;
1793
+ plural_noun?: string;
1794
+ is_archived?: boolean;
1795
+ /** Omit to preserve; null clears the setting. */
1796
+ description?: string | null;
1797
+ icon?: CustomObjectIcon | null;
1798
+ display_attribute_slug?: string | null;
1753
1799
  }
1754
1800
  /**
1755
1801
  * One attribute on a custom object, and the rules its values must satisfy.
@@ -1762,6 +1808,15 @@ interface CustomObject {
1762
1808
  */
1763
1809
  interface CustomObjectAttribute {
1764
1810
  slug: string;
1811
+ /** Customer-facing label. Display metadata is absent on older servers. */
1812
+ title?: string;
1813
+ description?: string | null;
1814
+ /** Display order; ties are ordered by slug. */
1815
+ sort_order?: number;
1816
+ /** Protected system field rather than a customer-defined field. */
1817
+ is_system?: boolean;
1818
+ /** Archive state; absent on older servers. */
1819
+ is_archived?: boolean;
1765
1820
  attribute_type: string;
1766
1821
  is_required: boolean;
1767
1822
  /** No two ACTIVE records may hold the same value. A collision returns 409. */
@@ -1774,6 +1829,24 @@ interface CustomObjectAttribute {
1774
1829
  /** Type-specific configuration, e.g. the allowed options for a `select`. */
1775
1830
  config: Record<string, unknown>;
1776
1831
  }
1832
+ /** Schema creation requires objects:manage and current Admin access. */
1833
+ interface CreateCustomObjectAttribute {
1834
+ slug: string;
1835
+ title: string;
1836
+ attribute_type: "text" | "number" | "currency" | "date" | "timestamp" | "checkbox" | "select" | "status" | "email_address" | "phone_number" | "domain" | "location" | "personal_name" | "record_reference" | "rating" | "actor_reference";
1837
+ description?: string | null;
1838
+ is_required?: boolean;
1839
+ is_unique?: boolean;
1840
+ is_multiselect?: boolean;
1841
+ is_default_value_enabled?: boolean;
1842
+ default_value?: unknown;
1843
+ config?: Record<string, unknown>;
1844
+ sort_order?: number;
1845
+ }
1846
+ /** Omitted fields are preserved; explicit null can clear the configured default. */
1847
+ type UpdateCustomObjectAttribute = Partial<Omit<CreateCustomObjectAttribute, "slug" | "attribute_type">> & {
1848
+ is_archived?: boolean;
1849
+ };
1777
1850
  /** One record, with its currently active attribute values. */
1778
1851
  interface CustomObjectRecord {
1779
1852
  id: string;
@@ -1804,6 +1877,29 @@ interface CustomObjectHistory {
1804
1877
  record_id: string;
1805
1878
  entries: CustomObjectHistoryEntry[];
1806
1879
  }
1880
+ interface CustomObjectMutation {
1881
+ id: string;
1882
+ action: "created" | "updated" | "archived" | "restored";
1883
+ occurred_at: string;
1884
+ revision: number;
1885
+ actor_id: string | null;
1886
+ actor_type: "user" | "api" | "app" | "integration" | "system";
1887
+ source: string;
1888
+ app_id: string | null;
1889
+ changes: Record<string, {
1890
+ before_present: boolean;
1891
+ before: unknown;
1892
+ after_present: boolean;
1893
+ after: unknown;
1894
+ }>;
1895
+ was_archived: boolean;
1896
+ is_archived: boolean;
1897
+ }
1898
+ interface CustomObjectMutations {
1899
+ record_id: string;
1900
+ entries: CustomObjectMutation[];
1901
+ next_cursor: string | null;
1902
+ }
1807
1903
  interface ListRecordsParams {
1808
1904
  page?: number;
1809
1905
  /** 1-200, default 50. */
@@ -1868,16 +1964,33 @@ interface ObjectPagination {
1868
1964
  */
1869
1965
  declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1870
1966
  /** List the custom object types in your workspace. */
1871
- list(): Promise<{
1967
+ list(params?: {
1968
+ include_archived?: boolean;
1969
+ }): Promise<{
1872
1970
  data: CustomObject[];
1873
1971
  }>;
1972
+ /** Create a native custom object. Requires objects:manage and Admin access. */
1973
+ create(input: CreateCustomObject): Promise<CustomObject>;
1974
+ /** Rename, archive or restore an object while preserving its slug and data. */
1975
+ update(objectSlug: string, input: UpdateCustomObject): Promise<CustomObject>;
1976
+ /** Archive the object without deleting records; restore with update({ is_archived: false }). */
1977
+ archive(objectSlug: string): Promise<CustomObject>;
1874
1978
  /** Fetch one object type by slug. */
1875
1979
  get(objectSlug: string): Promise<CustomObject>;
1876
1980
  /** The object's attributes — the schema its records must satisfy. */
1877
- listAttributes(objectSlug: string): Promise<{
1981
+ listAttributes(objectSlug: string, params?: {
1982
+ include_archived?: boolean;
1983
+ }): Promise<{
1878
1984
  data: CustomObjectAttribute[];
1879
1985
  }>;
1880
- /** Paginated records with their current values. Archived records are excluded. */
1986
+ /** Create a field using the same schema rules as the customer UI. */
1987
+ createAttribute(objectSlug: string, input: CreateCustomObjectAttribute): Promise<CustomObjectAttribute>;
1988
+ /** Edit or restore a field; its type and slug are immutable. */
1989
+ updateAttribute(objectSlug: string, attributeSlug: string, input: UpdateCustomObjectAttribute): Promise<CustomObjectAttribute>;
1990
+ /** Archive without deleting values; restore with updateAttribute({ is_archived: false }). */
1991
+ archiveAttribute(objectSlug: string, attributeSlug: string): Promise<CustomObjectAttribute>;
1992
+ /** Paginated custom records or canonical deals with current values and revisions.
1993
+ * Deal totals and related references respect current record access. */
1881
1994
  listRecords(objectSlug: string, params?: ListRecordsParams): Promise<{
1882
1995
  data: CustomObjectRecord[];
1883
1996
  pagination?: ObjectPagination;
@@ -1888,18 +2001,28 @@ declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1888
2001
  * unique attribute is a 409.
1889
2002
  */
1890
2003
  createRecord(objectSlug: string, values: Record<string, unknown>): Promise<CustomObjectRecord>;
1891
- /** Fetch one record with its currently active values. */
2004
+ /** Match a unique single-value key, creating or updating while preserving omitted fields. */
2005
+ upsertRecord(objectSlug: string, matchingAttribute: string, values: Record<string, unknown>, options?: {
2006
+ expectedRevision?: number;
2007
+ }): Promise<CustomObjectRecord>;
2008
+ /** Fetch one custom record, canonical contact/company, or deal by its stable graph8 ID.
2009
+ * Deals retain their UUIDs and expose company, primary-contact and contact_ids references only
2010
+ * when permitted. Generic deal mutations are not yet supported.
2011
+ */
1892
2012
  getRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
1893
2013
  /**
1894
2014
  * Update a record. PARTIAL: only the attributes you send are touched, so
1895
2015
  * required attributes you omit are left alone rather than reported missing.
1896
2016
  * Sending an explicit `null` CLEARS that attribute.
1897
2017
  *
1898
- * Values are versioned rather than overwritten, so the previous value stays
1899
- * readable through `history`.
2018
+ * Custom values retain generations through `history`. Canonical contacts and
2019
+ * companies require expectedRevision from a fresh read and expose recorded
2020
+ * mutations through `changes`. They do not yet support appendValues/removeValues.
1900
2021
  */
1901
2022
  updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown>, options?: {
1902
2023
  expectedRevision?: number;
2024
+ appendValues?: Record<string, unknown[]>;
2025
+ removeValues?: Record<string, unknown[]>;
1903
2026
  }): Promise<CustomObjectRecord>;
1904
2027
  /**
1905
2028
  * Archive a record. It leaves listings, stays readable by id, and keeps its
@@ -1913,6 +2036,14 @@ declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1913
2036
  * null is the value currently in force.
1914
2037
  */
1915
2038
  history(objectSlug: string, recordId: string, limit?: number): Promise<CustomObjectHistory>;
2039
+ /** Recorded custom-record or canonical contact/company mutations. Pass next_cursor to continue.
2040
+ * Canonical history respects current access/privacy; archived records and older
2041
+ * unrecorded writes are not reconstructed. Store unavailability returns 503.
2042
+ */
2043
+ changes(objectSlug: string, recordId: string, options?: {
2044
+ limit?: number;
2045
+ cursor?: string;
2046
+ }): Promise<CustomObjectMutations>;
1916
2047
  };
1917
2048
 
1918
2049
  /**
@@ -2781,7 +2912,7 @@ declare const createContactsClient: (apiKey: string, apiUrl?: string) => {
2781
2912
  * adds events. ``WebhookEvent`` also accepts any string so a newly-added
2782
2913
  * backend event never breaks a client that hasn't upgraded.
2783
2914
  */
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"];
2915
+ 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
2916
  type WebhookEvent = (typeof KNOWN_WEBHOOK_EVENTS)[number] | (string & {});
2786
2917
  /** The decoded body graph8 delivers to a webhook endpoint. */
2787
2918
  interface WebhookEventPayload {
@@ -2789,7 +2920,7 @@ interface WebhookEventPayload {
2789
2920
  timestamp: string;
2790
2921
  data: Record<string, unknown>;
2791
2922
  org_id: string;
2792
- /** Stable per-delivery id (present once the backend adds it; for consumer dedup). */
2923
+ /** Stable event ID for consumer deduplication; delivery ID is in X-Studio-Delivery-Id. */
2793
2924
  id?: string;
2794
2925
  }
2795
2926
  interface ConstructEventOptions {
@@ -2808,7 +2939,7 @@ declare const createWebhooksClient: (_apiKey: string, apiUrl?: string) => {
2808
2939
  /** Base URL the webhook subscription API lives under. */
2809
2940
  baseUrl: string;
2810
2941
  /** 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"];
2942
+ 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
2943
  /** Verify an incoming webhook's HMAC signature and return the parsed event. */
2813
2944
  constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
2814
2945
  };
@@ -3915,7 +4046,7 @@ declare const useG8: () => {
3915
4046
  };
3916
4047
  get webhooks(): {
3917
4048
  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"];
4049
+ 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
4050
  constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
3920
4051
  };
3921
4052
  get contacts(): {
@@ -4077,25 +4208,44 @@ declare const useG8: () => {
4077
4208
  }>;
4078
4209
  };
4079
4210
  get objects(): {
4080
- list(): Promise<{
4211
+ list(params?: {
4212
+ include_archived?: boolean;
4213
+ }): Promise<{
4081
4214
  data: CustomObject[];
4082
4215
  }>;
4216
+ create(input: CreateCustomObject): Promise<CustomObject>;
4217
+ update(objectSlug: string, input: UpdateCustomObject): Promise<CustomObject>;
4218
+ archive(objectSlug: string): Promise<CustomObject>;
4083
4219
  get(objectSlug: string): Promise<CustomObject>;
4084
- listAttributes(objectSlug: string): Promise<{
4220
+ listAttributes(objectSlug: string, params?: {
4221
+ include_archived?: boolean;
4222
+ }): Promise<{
4085
4223
  data: CustomObjectAttribute[];
4086
4224
  }>;
4225
+ createAttribute(objectSlug: string, input: CreateCustomObjectAttribute): Promise<CustomObjectAttribute>;
4226
+ updateAttribute(objectSlug: string, attributeSlug: string, input: UpdateCustomObjectAttribute): Promise<CustomObjectAttribute>;
4227
+ archiveAttribute(objectSlug: string, attributeSlug: string): Promise<CustomObjectAttribute>;
4087
4228
  listRecords(objectSlug: string, params?: ListRecordsParams): Promise<{
4088
4229
  data: CustomObjectRecord[];
4089
4230
  pagination?: ObjectPagination;
4090
4231
  }>;
4091
4232
  createRecord(objectSlug: string, values: Record<string, unknown>): Promise<CustomObjectRecord>;
4233
+ upsertRecord(objectSlug: string, matchingAttribute: string, values: Record<string, unknown>, options?: {
4234
+ expectedRevision?: number;
4235
+ }): Promise<CustomObjectRecord>;
4092
4236
  getRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4093
4237
  updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown>, options?: {
4094
4238
  expectedRevision?: number;
4239
+ appendValues?: Record<string, unknown[]>;
4240
+ removeValues?: Record<string, unknown[]>;
4095
4241
  }): Promise<CustomObjectRecord>;
4096
4242
  archiveRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4097
4243
  restoreRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4098
4244
  history(objectSlug: string, recordId: string, limit?: number): Promise<CustomObjectHistory>;
4245
+ changes(objectSlug: string, recordId: string, options?: {
4246
+ limit?: number;
4247
+ cursor?: string;
4248
+ }): Promise<CustomObjectMutations>;
4099
4249
  };
4100
4250
  get deals(): {
4101
4251
  pipelines(): Promise<{