@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/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;
@@ -1739,6 +1743,7 @@ declare const createDealsClient: (apiKey: string, apiUrl?: string) => {
1739
1743
  }>;
1740
1744
  };
1741
1745
 
1746
+ type CustomObjectIcon = "box" | "briefcase" | "building" | "calendar" | "flag" | "folder" | "globe" | "heart" | "layers" | "package" | "target" | "users";
1742
1747
  /** A custom object type in your workspace — a record type you define. */
1743
1748
  interface CustomObject {
1744
1749
  /** Stable API slug, e.g. `invoices`. */
@@ -1748,6 +1753,28 @@ interface CustomObject {
1748
1753
  /** True for object types graph8 ships; system objects cannot be deleted. */
1749
1754
  is_system: boolean;
1750
1755
  is_archived: boolean;
1756
+ /** Presentation settings may be absent on older servers. */
1757
+ description?: string | null;
1758
+ icon?: string | null;
1759
+ display_attribute_slug?: string | null;
1760
+ }
1761
+ /** Native schema creation requires objects:manage and current Admin access. */
1762
+ interface CreateCustomObject {
1763
+ slug: string;
1764
+ singular_noun: string;
1765
+ plural_noun: string;
1766
+ description?: string | null;
1767
+ icon?: CustomObjectIcon | null;
1768
+ }
1769
+ /** Omitted labels/state are preserved. The API slug is immutable. */
1770
+ interface UpdateCustomObject {
1771
+ singular_noun?: string;
1772
+ plural_noun?: string;
1773
+ is_archived?: boolean;
1774
+ /** Omit to preserve; null clears the setting. */
1775
+ description?: string | null;
1776
+ icon?: CustomObjectIcon | null;
1777
+ display_attribute_slug?: string | null;
1751
1778
  }
1752
1779
  /**
1753
1780
  * One attribute on a custom object, and the rules its values must satisfy.
@@ -1760,6 +1787,15 @@ interface CustomObject {
1760
1787
  */
1761
1788
  interface CustomObjectAttribute {
1762
1789
  slug: string;
1790
+ /** Customer-facing label. Display metadata is absent on older servers. */
1791
+ title?: string;
1792
+ description?: string | null;
1793
+ /** Display order; ties are ordered by slug. */
1794
+ sort_order?: number;
1795
+ /** Protected system field rather than a customer-defined field. */
1796
+ is_system?: boolean;
1797
+ /** Archive state; absent on older servers. */
1798
+ is_archived?: boolean;
1763
1799
  attribute_type: string;
1764
1800
  is_required: boolean;
1765
1801
  /** No two ACTIVE records may hold the same value. A collision returns 409. */
@@ -1772,6 +1808,24 @@ interface CustomObjectAttribute {
1772
1808
  /** Type-specific configuration, e.g. the allowed options for a `select`. */
1773
1809
  config: Record<string, unknown>;
1774
1810
  }
1811
+ /** Schema creation requires objects:manage and current Admin access. */
1812
+ interface CreateCustomObjectAttribute {
1813
+ slug: string;
1814
+ title: string;
1815
+ attribute_type: "text" | "number" | "currency" | "date" | "timestamp" | "checkbox" | "select" | "status" | "email_address" | "phone_number" | "domain" | "location" | "personal_name" | "record_reference" | "rating" | "actor_reference";
1816
+ description?: string | null;
1817
+ is_required?: boolean;
1818
+ is_unique?: boolean;
1819
+ is_multiselect?: boolean;
1820
+ is_default_value_enabled?: boolean;
1821
+ default_value?: unknown;
1822
+ config?: Record<string, unknown>;
1823
+ sort_order?: number;
1824
+ }
1825
+ /** Omitted fields are preserved; explicit null can clear the configured default. */
1826
+ type UpdateCustomObjectAttribute = Partial<Omit<CreateCustomObjectAttribute, "slug" | "attribute_type">> & {
1827
+ is_archived?: boolean;
1828
+ };
1775
1829
  /** One record, with its currently active attribute values. */
1776
1830
  interface CustomObjectRecord {
1777
1831
  id: string;
@@ -1802,6 +1856,29 @@ interface CustomObjectHistory {
1802
1856
  record_id: string;
1803
1857
  entries: CustomObjectHistoryEntry[];
1804
1858
  }
1859
+ interface CustomObjectMutation {
1860
+ id: string;
1861
+ action: "created" | "updated" | "archived" | "restored";
1862
+ occurred_at: string;
1863
+ revision: number;
1864
+ actor_id: string | null;
1865
+ actor_type: "user" | "api" | "app" | "integration" | "system";
1866
+ source: string;
1867
+ app_id: string | null;
1868
+ changes: Record<string, {
1869
+ before_present: boolean;
1870
+ before: unknown;
1871
+ after_present: boolean;
1872
+ after: unknown;
1873
+ }>;
1874
+ was_archived: boolean;
1875
+ is_archived: boolean;
1876
+ }
1877
+ interface CustomObjectMutations {
1878
+ record_id: string;
1879
+ entries: CustomObjectMutation[];
1880
+ next_cursor: string | null;
1881
+ }
1805
1882
  interface ListRecordsParams {
1806
1883
  page?: number;
1807
1884
  /** 1-200, default 50. */
@@ -1866,16 +1943,33 @@ interface ObjectPagination {
1866
1943
  */
1867
1944
  declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1868
1945
  /** List the custom object types in your workspace. */
1869
- list(): Promise<{
1946
+ list(params?: {
1947
+ include_archived?: boolean;
1948
+ }): Promise<{
1870
1949
  data: CustomObject[];
1871
1950
  }>;
1951
+ /** Create a native custom object. Requires objects:manage and Admin access. */
1952
+ create(input: CreateCustomObject): Promise<CustomObject>;
1953
+ /** Rename, archive or restore an object while preserving its slug and data. */
1954
+ update(objectSlug: string, input: UpdateCustomObject): Promise<CustomObject>;
1955
+ /** Archive the object without deleting records; restore with update({ is_archived: false }). */
1956
+ archive(objectSlug: string): Promise<CustomObject>;
1872
1957
  /** Fetch one object type by slug. */
1873
1958
  get(objectSlug: string): Promise<CustomObject>;
1874
1959
  /** The object's attributes — the schema its records must satisfy. */
1875
- listAttributes(objectSlug: string): Promise<{
1960
+ listAttributes(objectSlug: string, params?: {
1961
+ include_archived?: boolean;
1962
+ }): Promise<{
1876
1963
  data: CustomObjectAttribute[];
1877
1964
  }>;
1878
- /** Paginated records with their current values. Archived records are excluded. */
1965
+ /** Create a field using the same schema rules as the customer UI. */
1966
+ createAttribute(objectSlug: string, input: CreateCustomObjectAttribute): Promise<CustomObjectAttribute>;
1967
+ /** Edit or restore a field; its type and slug are immutable. */
1968
+ updateAttribute(objectSlug: string, attributeSlug: string, input: UpdateCustomObjectAttribute): Promise<CustomObjectAttribute>;
1969
+ /** Archive without deleting values; restore with updateAttribute({ is_archived: false }). */
1970
+ archiveAttribute(objectSlug: string, attributeSlug: string): Promise<CustomObjectAttribute>;
1971
+ /** Paginated custom records or canonical deals with current values and revisions.
1972
+ * Deal totals and related references respect current record access. */
1879
1973
  listRecords(objectSlug: string, params?: ListRecordsParams): Promise<{
1880
1974
  data: CustomObjectRecord[];
1881
1975
  pagination?: ObjectPagination;
@@ -1886,18 +1980,28 @@ declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1886
1980
  * unique attribute is a 409.
1887
1981
  */
1888
1982
  createRecord(objectSlug: string, values: Record<string, unknown>): Promise<CustomObjectRecord>;
1889
- /** Fetch one record with its currently active values. */
1983
+ /** Match a unique single-value key, creating or updating while preserving omitted fields. */
1984
+ upsertRecord(objectSlug: string, matchingAttribute: string, values: Record<string, unknown>, options?: {
1985
+ expectedRevision?: number;
1986
+ }): Promise<CustomObjectRecord>;
1987
+ /** Fetch one custom record, canonical contact/company, or deal by its stable graph8 ID.
1988
+ * Deals retain their UUIDs and expose company, primary-contact and contact_ids references only
1989
+ * when permitted. Generic deal mutations are not yet supported.
1990
+ */
1890
1991
  getRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
1891
1992
  /**
1892
1993
  * Update a record. PARTIAL: only the attributes you send are touched, so
1893
1994
  * required attributes you omit are left alone rather than reported missing.
1894
1995
  * Sending an explicit `null` CLEARS that attribute.
1895
1996
  *
1896
- * Values are versioned rather than overwritten, so the previous value stays
1897
- * readable through `history`.
1997
+ * Custom values retain generations through `history`. Canonical contacts and
1998
+ * companies require expectedRevision from a fresh read and expose recorded
1999
+ * mutations through `changes`. They do not yet support appendValues/removeValues.
1898
2000
  */
1899
2001
  updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown>, options?: {
1900
2002
  expectedRevision?: number;
2003
+ appendValues?: Record<string, unknown[]>;
2004
+ removeValues?: Record<string, unknown[]>;
1901
2005
  }): Promise<CustomObjectRecord>;
1902
2006
  /**
1903
2007
  * Archive a record. It leaves listings, stays readable by id, and keeps its
@@ -1911,6 +2015,14 @@ declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
1911
2015
  * null is the value currently in force.
1912
2016
  */
1913
2017
  history(objectSlug: string, recordId: string, limit?: number): Promise<CustomObjectHistory>;
2018
+ /** Recorded custom-record or canonical contact/company mutations. Pass next_cursor to continue.
2019
+ * Canonical history respects current access/privacy; archived records and older
2020
+ * unrecorded writes are not reconstructed. Store unavailability returns 503.
2021
+ */
2022
+ changes(objectSlug: string, recordId: string, options?: {
2023
+ limit?: number;
2024
+ cursor?: string;
2025
+ }): Promise<CustomObjectMutations>;
1914
2026
  };
1915
2027
 
1916
2028
  /**
@@ -2785,7 +2897,7 @@ declare const createContactsClient: (apiKey: string, apiUrl?: string) => {
2785
2897
  * adds events. ``WebhookEvent`` also accepts any string so a newly-added
2786
2898
  * backend event never breaks a client that hasn't upgraded.
2787
2899
  */
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"];
2900
+ 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
2901
  type WebhookEvent = (typeof KNOWN_WEBHOOK_EVENTS)[number] | (string & {});
2790
2902
  /** The decoded body graph8 delivers to a webhook endpoint. */
2791
2903
  interface WebhookEventPayload {
@@ -2793,7 +2905,7 @@ interface WebhookEventPayload {
2793
2905
  timestamp: string;
2794
2906
  data: Record<string, unknown>;
2795
2907
  org_id: string;
2796
- /** Stable per-delivery id (present once the backend adds it; for consumer dedup). */
2908
+ /** Stable event ID for consumer deduplication; delivery ID is in X-Studio-Delivery-Id. */
2797
2909
  id?: string;
2798
2910
  }
2799
2911
  interface ConstructEventOptions {
@@ -2844,7 +2956,7 @@ declare const createWebhooksClient: (_apiKey: string, apiUrl?: string) => {
2844
2956
  /** Base URL the webhook subscription API lives under. */
2845
2957
  baseUrl: string;
2846
2958
  /** 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"];
2959
+ 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
2960
  /** Verify an incoming webhook's HMAC signature and return the parsed event. */
2849
2961
  constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
2850
2962
  };
@@ -3947,7 +4059,7 @@ declare class G8 {
3947
4059
  /** Webhook event listeners (requires API key). */
3948
4060
  get webhooks(): {
3949
4061
  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"];
4062
+ 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
4063
  constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
3952
4064
  };
3953
4065
  /** Contacts CRUD (requires API key). */
@@ -4125,25 +4237,44 @@ declare class G8 {
4125
4237
  };
4126
4238
  /** Custom object types, their schema, and their records (requires API key). PREVIEW. */
4127
4239
  get objects(): {
4128
- list(): Promise<{
4240
+ list(params?: {
4241
+ include_archived?: boolean;
4242
+ }): Promise<{
4129
4243
  data: CustomObject[];
4130
4244
  }>;
4245
+ create(input: CreateCustomObject): Promise<CustomObject>;
4246
+ update(objectSlug: string, input: UpdateCustomObject): Promise<CustomObject>;
4247
+ archive(objectSlug: string): Promise<CustomObject>;
4131
4248
  get(objectSlug: string): Promise<CustomObject>;
4132
- listAttributes(objectSlug: string): Promise<{
4249
+ listAttributes(objectSlug: string, params?: {
4250
+ include_archived?: boolean;
4251
+ }): Promise<{
4133
4252
  data: CustomObjectAttribute[];
4134
4253
  }>;
4254
+ createAttribute(objectSlug: string, input: CreateCustomObjectAttribute): Promise<CustomObjectAttribute>;
4255
+ updateAttribute(objectSlug: string, attributeSlug: string, input: UpdateCustomObjectAttribute): Promise<CustomObjectAttribute>;
4256
+ archiveAttribute(objectSlug: string, attributeSlug: string): Promise<CustomObjectAttribute>;
4135
4257
  listRecords(objectSlug: string, params?: ListRecordsParams): Promise<{
4136
4258
  data: CustomObjectRecord[];
4137
4259
  pagination?: ObjectPagination;
4138
4260
  }>;
4139
4261
  createRecord(objectSlug: string, values: Record<string, unknown>): Promise<CustomObjectRecord>;
4262
+ upsertRecord(objectSlug: string, matchingAttribute: string, values: Record<string, unknown>, options?: {
4263
+ expectedRevision?: number;
4264
+ }): Promise<CustomObjectRecord>;
4140
4265
  getRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4141
4266
  updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown>, options?: {
4142
4267
  expectedRevision?: number;
4268
+ appendValues?: Record<string, unknown[]>;
4269
+ removeValues?: Record<string, unknown[]>;
4143
4270
  }): Promise<CustomObjectRecord>;
4144
4271
  archiveRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4145
4272
  restoreRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
4146
4273
  history(objectSlug: string, recordId: string, limit?: number): Promise<CustomObjectHistory>;
4274
+ changes(objectSlug: string, recordId: string, options?: {
4275
+ limit?: number;
4276
+ cursor?: string;
4277
+ }): Promise<CustomObjectMutations>;
4147
4278
  };
4148
4279
  /** Deals and pipelines (requires API key). */
4149
4280
  get deals(): {
@@ -4967,4 +5098,4 @@ interface Graph8ServiceClient {
4967
5098
  */
4968
5099
  declare function createGraph8ServiceClient(config: Graph8ServiceClientConfig): Graph8ServiceClient;
4969
5100
 
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 };
5101
+ 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 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 };