@graph8/sdk 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1550,6 +1550,8 @@ declare const createInboxClient: (apiKey: string, apiUrl?: string) => {
1550
1550
  };
1551
1551
 
1552
1552
  interface Deal {
1553
+ /** Canonical CRM revision returned by a conditional update. */
1554
+ revision?: number | null;
1553
1555
  id: string | null;
1554
1556
  name: string | null;
1555
1557
  description: string | null;
@@ -1614,6 +1616,8 @@ interface DealCreateParams {
1614
1616
  allow_duplicate?: boolean;
1615
1617
  }
1616
1618
  interface DealUpdateParams {
1619
+ /** Require this current CRM revision; a stale edit returns HTTP 409. */
1620
+ expected_revision?: number;
1617
1621
  name?: string;
1618
1622
  description?: string;
1619
1623
  amount?: number;
@@ -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 };
package/dist/index.js CHANGED
@@ -891,6 +891,8 @@ var KNOWN_WEBHOOK_EVENTS = [
891
891
  "engagement.email_bounced",
892
892
  "engagement.email_skipped",
893
893
  "engagement.call_dispatched",
894
+ "engagement.call_connected",
895
+ "engagement.call_graded",
894
896
  "engagement.sms_sent",
895
897
  "engagement.sms_replied",
896
898
  "engagement.whatsapp_sent",
@@ -901,7 +903,12 @@ var KNOWN_WEBHOOK_EVENTS = [
901
903
  "engagement.linkedin_connection_accepted",
902
904
  "meeting.booked",
903
905
  "meeting.cancelled",
904
- "meeting.rescheduled"
906
+ "meeting.rescheduled",
907
+ "deal.won",
908
+ "crm.record.created",
909
+ "crm.record.updated",
910
+ "crm.record.archived",
911
+ "crm.record.restored"
905
912
  ];
906
913
  var WebhookSignatureError = class extends Error {
907
914
  constructor(message) {
@@ -1586,8 +1593,32 @@ var createObjectsClient = (apiKey, apiUrl) => {
1586
1593
  const encode = (value) => encodeURIComponent(value);
1587
1594
  return {
1588
1595
  /** List the custom object types in your workspace. */
1589
- async list() {
1590
- return request(baseUrl, "/api/v1/objects", apiKey);
1596
+ async list(params = {}) {
1597
+ const query = params.include_archived ? "?include_archived=true" : "";
1598
+ return request(baseUrl, `/api/v1/objects${query}`, apiKey);
1599
+ },
1600
+ /** Create a native custom object. Requires objects:manage and Admin access. */
1601
+ async create(input) {
1602
+ const resp = await request(baseUrl, "/api/v1/objects", apiKey, {
1603
+ method: "POST",
1604
+ body: input
1605
+ });
1606
+ return resp.data;
1607
+ },
1608
+ /** Rename, archive or restore an object while preserving its slug and data. */
1609
+ async update(objectSlug, input) {
1610
+ const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}`, apiKey, {
1611
+ method: "PATCH",
1612
+ body: input
1613
+ });
1614
+ return resp.data;
1615
+ },
1616
+ /** Archive the object without deleting records; restore with update({ is_archived: false }). */
1617
+ async archive(objectSlug) {
1618
+ const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}`, apiKey, {
1619
+ method: "DELETE"
1620
+ });
1621
+ return resp.data;
1591
1622
  },
1592
1623
  /** Fetch one object type by slug. */
1593
1624
  async get(objectSlug) {
@@ -1599,10 +1630,35 @@ var createObjectsClient = (apiKey, apiUrl) => {
1599
1630
  return resp.data ?? resp;
1600
1631
  },
1601
1632
  /** The object's attributes — the schema its records must satisfy. */
1602
- async listAttributes(objectSlug) {
1603
- return request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes`, apiKey);
1633
+ async listAttributes(objectSlug, params = {}) {
1634
+ const query = params.include_archived ? "?include_archived=true" : "";
1635
+ return request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes${query}`, apiKey);
1604
1636
  },
1605
- /** Paginated records with their current values. Archived records are excluded. */
1637
+ /** Create a field using the same schema rules as the customer UI. */
1638
+ async createAttribute(objectSlug, input) {
1639
+ const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes`, apiKey, {
1640
+ method: "POST",
1641
+ body: input
1642
+ });
1643
+ return resp.data;
1644
+ },
1645
+ /** Edit or restore a field; its type and slug are immutable. */
1646
+ async updateAttribute(objectSlug, attributeSlug, input) {
1647
+ const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes/${encode(attributeSlug)}`, apiKey, {
1648
+ method: "PATCH",
1649
+ body: input
1650
+ });
1651
+ return resp.data;
1652
+ },
1653
+ /** Archive without deleting values; restore with updateAttribute({ is_archived: false }). */
1654
+ async archiveAttribute(objectSlug, attributeSlug) {
1655
+ const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes/${encode(attributeSlug)}`, apiKey, {
1656
+ method: "DELETE"
1657
+ });
1658
+ return resp.data;
1659
+ },
1660
+ /** Paginated custom records or canonical deals with current values and revisions.
1661
+ * Deal totals and related references respect current record access. */
1606
1662
  async listRecords(objectSlug, params = {}) {
1607
1663
  const query = {};
1608
1664
  if (params.page != null) query.page = params.page;
@@ -1626,7 +1682,24 @@ var createObjectsClient = (apiKey, apiUrl) => {
1626
1682
  );
1627
1683
  return resp.data ?? resp;
1628
1684
  },
1629
- /** Fetch one record with its currently active values. */
1685
+ /** Match a unique single-value key, creating or updating while preserving omitted fields. */
1686
+ async upsertRecord(objectSlug, matchingAttribute, values, options = {}) {
1687
+ const resp = await request(
1688
+ baseUrl,
1689
+ `/api/v1/objects/${encode(objectSlug)}/records/upsert`,
1690
+ apiKey,
1691
+ { method: "POST", body: {
1692
+ matching_attribute: matchingAttribute,
1693
+ values,
1694
+ ...options.expectedRevision !== void 0 ? { expected_revision: options.expectedRevision } : {}
1695
+ } }
1696
+ );
1697
+ return resp.data;
1698
+ },
1699
+ /** Fetch one custom record, canonical contact/company, or deal by its stable graph8 ID.
1700
+ * Deals retain their UUIDs and expose company, primary-contact and contact_ids references only
1701
+ * when permitted. Generic deal mutations are not yet supported.
1702
+ */
1630
1703
  async getRecord(objectSlug, recordId) {
1631
1704
  const resp = await request(
1632
1705
  baseUrl,
@@ -1640,15 +1713,24 @@ var createObjectsClient = (apiKey, apiUrl) => {
1640
1713
  * required attributes you omit are left alone rather than reported missing.
1641
1714
  * Sending an explicit `null` CLEARS that attribute.
1642
1715
  *
1643
- * Values are versioned rather than overwritten, so the previous value stays
1644
- * readable through `history`.
1716
+ * Custom values retain generations through `history`. Canonical contacts and
1717
+ * companies require expectedRevision from a fresh read and expose recorded
1718
+ * mutations through `changes`. They do not yet support appendValues/removeValues.
1645
1719
  */
1646
1720
  async updateRecord(objectSlug, recordId, values, options) {
1647
1721
  const resp = await request(
1648
1722
  baseUrl,
1649
1723
  `/api/v1/objects/${encode(objectSlug)}/records/${encode(recordId)}`,
1650
1724
  apiKey,
1651
- { method: "PATCH", body: { values, ...options?.expectedRevision === void 0 ? {} : { expected_revision: options.expectedRevision } } }
1725
+ {
1726
+ method: "PATCH",
1727
+ body: {
1728
+ values,
1729
+ ...options?.expectedRevision === void 0 ? {} : { expected_revision: options.expectedRevision },
1730
+ ...options?.appendValues === void 0 ? {} : { append_values: options.appendValues },
1731
+ ...options?.removeValues === void 0 ? {} : { remove_values: options.removeValues }
1732
+ }
1733
+ }
1652
1734
  );
1653
1735
  return resp.data ?? resp;
1654
1736
  },
@@ -1687,6 +1769,19 @@ var createObjectsClient = (apiKey, apiUrl) => {
1687
1769
  { query: limit != null ? { limit } : void 0 }
1688
1770
  );
1689
1771
  return resp.data ?? resp;
1772
+ },
1773
+ /** Recorded custom-record or canonical contact/company mutations. Pass next_cursor to continue.
1774
+ * Canonical history respects current access/privacy; archived records and older
1775
+ * unrecorded writes are not reconstructed. Store unavailability returns 503.
1776
+ */
1777
+ async changes(objectSlug, recordId, options = {}) {
1778
+ const resp = await request(
1779
+ baseUrl,
1780
+ `/api/v1/objects/${encode(objectSlug)}/records/${encode(recordId)}/changes`,
1781
+ apiKey,
1782
+ { query: options }
1783
+ );
1784
+ return resp.data ?? resp;
1690
1785
  }
1691
1786
  };
1692
1787
  };