@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/README.md CHANGED
@@ -251,11 +251,41 @@ export const CTA = () => {
251
251
  | `g8.webhooks.constructEvent(body, sig, ts, secret, opts?)` | Verify a delivery's HMAC signature and return the parsed event (throws `WebhookSignatureError`) |
252
252
  | `g8.webhooks.knownEvents` | The known event-type catalog |
253
253
 
254
+ The unreleased CRM increment adds `crm.record.created`, `crm.record.updated`,
255
+ `crm.record.archived`, and `crm.record.restored`. Their `data` contains
256
+ `object_slug`, `record_id`, and `revision`, rather than private field values.
257
+ The envelope `id` is a stable event ID; `X-Studio-Delivery-Id` identifies a
258
+ subscription's delivery. Verify the original request bytes before processing,
259
+ and deduplicate by the stable identifiers because delivery is at least once.
260
+ CRM subscription creation, update, deletion and secret rotation through the API
261
+ require explicit `webhooks:write` and `objects:read` scopes. Removing CRM events
262
+ also requires these grants. Reading CRM subscriptions or their delivery history
263
+ requires explicit `webhooks:read` and `objects:read` scopes; a subscription list
264
+ containing CRM subscriptions enforces the same read grants before returning data.
265
+ These checks refresh credentials and apply even during compatibility scope soak.
266
+ The backend checks current credential, membership and record access again before
267
+ sending. Native custom
268
+ records currently follow workspace-level access; app-owned/delegated authority
269
+ and configurable Enterprise object grants remain incomplete.
270
+
254
271
  ## Native custom objects
255
272
 
256
273
  Use an organization API key with explicit `objects:read` for schema/record/history
257
- reads, `objects:write` for create/PATCH, and `objects:delete` for archive. Unscoped
258
- keys receive 403. `objects:*` grants all three; grant only the operations the
274
+ reads, `objects:write` for record create/PATCH, and `objects:delete` for record archive.
275
+ Schema create/update/archive require `objects:manage` and current Admin access through
276
+ a personal API key. `objects.update(slug, { is_archived: false })` restores an object.
277
+ Object create accepts `description` and a typed `icon`. Update also accepts
278
+ `display_attribute_slug` for an active, single-value label field. Omit presentation
279
+ properties to preserve them or pass `null` to clear them. The current display field
280
+ must be replaced or cleared before archiving it or making it multivalue.
281
+ Attribute administration in the unreleased increment uses `objects.createAttribute`,
282
+ `objects.updateAttribute`, and `objects.archiveAttribute` with the same scope and Admin requirement.
283
+ Restore with `objects.updateAttribute(objectSlug, attributeSlug, { is_archived: false })`.
284
+ Use `objects.listAttributes(objectSlug, { include_archived: true })` to find archived fields;
285
+ normal discovery and record validation use active fields only. Attribute PATCH preserves
286
+ omitted fields; `default_value: null` explicitly clears a default. Requires the matching backend.
287
+
288
+ Unscoped keys receive 403. `objects:*` grants all object scopes; grant only the operations the
259
289
  integration needs.
260
290
 
261
291
  ```typescript
@@ -273,6 +303,36 @@ PATCH preserves omitted attributes. Enabled defaults apply only on create;
273
303
  unknown fields return 422 and unique-value collisions return 409. Standard
274
304
  contacts, companies, and deals continue using their existing SDK resources.
275
305
 
306
+ ### Create or update by a unique key
307
+
308
+ Use an active, single-value unique attribute to match a native custom record.
309
+ Supply its nonempty value with the fields to write. Existing matches retain
310
+ their graph8 ID and omitted values; new records receive configured defaults.
311
+
312
+ ```typescript
313
+ import { g8 } from '@graph8/sdk';
314
+
315
+ g8.init({ apiKey: process.env.G8_API_KEY! });
316
+ // Assumes invoices.reference is a unique text attribute in this workspace.
317
+ const invoice = await g8.objects.upsertRecord('invoices', 'reference', {
318
+ reference: 'INV-1042',
319
+ });
320
+ // A conditional update fails with 409 if the record changed or no longer matches.
321
+ await g8.objects.upsertRecord('invoices', 'reference', {
322
+ reference: 'INV-1042',
323
+ }, { expectedRevision: invoice.revision });
324
+ ```
325
+
326
+ The REST operation is `POST /api/v1/objects/{object_slug}/records/upsert` with
327
+ `{ "matching_attribute": "reference", "values": { "reference": "INV-1042" } }`.
328
+ It requires `objects:write`, returns 201 for creation or 200 for an update, and
329
+ accepts optional `expected_revision`. MCP exposes `g8_object_record_upsert`
330
+ with the same fields. Archived records do not match. Invalid or nonunique
331
+ matching attributes return 422; another unique-field collision returns 409.
332
+ Legacy values requiring a uniqueness backfill also return 409 rather than
333
+ creating a duplicate. Repeated upserts can create additional update history;
334
+ unique-key matching is not a promise of exactly-once side effects.
335
+
276
336
  ## App Platform
277
337
 
278
338
  Hosted apps do not carry a permanent org API key. Instead they **exchange** a
@@ -371,3 +431,68 @@ unique value has been reused. Validation failures leave the record archived.
371
431
  Ambiguous legacy history returns 422 with `archive_snapshot_unavailable` rather
372
432
  than guessing its prior values. Repeating a successful restore adds no revision
373
433
  or history entry.
434
+
435
+ ### Append or remove multivalue items
436
+
437
+ ```ts
438
+ import { g8 } from "@graph8/sdk";
439
+
440
+ g8.init({ apiKey: "YOUR_API_KEY" });
441
+ const projectId = "your-project-record-id";
442
+ const record = await g8.objects.getRecord("projects", projectId);
443
+ await g8.objects.updateRecord("projects", projectId, {}, {
444
+ appendValues: { tags: ["priority"] },
445
+ removeValues: { reviewers: ["former-reviewer-id"] },
446
+ expectedRevision: record.revision,
447
+ });
448
+ ```
449
+
450
+ Native and app PATCH APIs use `append_values` and `remove_values`; the MCP
451
+ `g8_object_record_update` tool accepts those same names. Each field must occur
452
+ in exactly one of `values`, `append_values`, or `remove_values`. These operations
453
+ require a multivalue attribute; `values` still replaces the entire supplied field.
454
+ Append preserves existing order and adds only canonically distinct items. Remove
455
+ deletes all matching items. The resulting values must satisfy required, unique,
456
+ and reference constraints. Changes are atomic and read the current values under
457
+ a record lock, so concurrent appends do not discard each other.
458
+
459
+ Repeating an append can leave the values unchanged while still advancing the
460
+ record revision and history. This is not an idempotency guarantee for events.
461
+ Deploy the matching backend before using these optional request fields.
462
+
463
+ ### Record mutation history
464
+
465
+ ```ts
466
+ import { g8 } from "@graph8/sdk";
467
+
468
+ g8.init({ apiKey: "YOUR_API_KEY" });
469
+ const firstPage = await g8.objects.changes("projects", "your-project-record-id", { limit: 50 });
470
+ if (firstPage.next_cursor) {
471
+ const olderPage = await g8.objects.changes("projects", "your-project-record-id", {
472
+ limit: 50,
473
+ cursor: firstPage.next_cursor,
474
+ });
475
+ console.log(olderPage.entries);
476
+ }
477
+ ```
478
+
479
+ The matching native and app APIs expose `/objects/{object_slug}/records/{record_id}/changes`
480
+ and `/app/objects/{object_slug}/records/{record_id}/changes`. The MCP tool is
481
+ `g8_object_record_changes`. These additions require the matching backend deployment.
482
+ Entries include the record revision, action, actor identity/type, source, time,
483
+ and changed values. Presence flags distinguish a cleared field from a present null.
484
+ An empty page means no mutation entries were recorded, not that the record never
485
+ changed; the existing value-history endpoint remains available for older facts.
486
+ Use the returned opaque cursor for older pages. A storage failure is an error,
487
+ not an empty history. This interface does not establish broader object/record ACL parity.
488
+
489
+ ### Conditional deal updates (unreleased)
490
+
491
+ Read the canonical deal record through `GET /api/v1/objects/deals/records/{id}`
492
+ to obtain its CRM revision, then pass `expected_revision` to
493
+ `g8.deals.update(id, { name: "Updated", expected_revision: revision })`.
494
+ A stale edit returns HTTP 409; reload and reconcile before retrying. A successful
495
+ conditional update returns `revision`. If tenant revision tracking is unavailable,
496
+ the conditional write returns 503 before mutation. Omitting `expected_revision`
497
+ retains the existing PATCH contract. The MCP `g8_update_deal` tool accepts the same
498
+ field. Deal UI integration and deployed QA verification remain pending.
package/dist/index.d.mts 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 };