outbound-sdk 0.1.0 → 0.2.1

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.
Files changed (146) hide show
  1. package/README.md +0 -2
  2. package/dist/alerts/index.js +5 -1
  3. package/dist/audit/index.js +2 -2
  4. package/dist/benchmarks/index.js +5 -3
  5. package/dist/budget/index.js +31 -10
  6. package/dist/cache/index.js +2 -2
  7. package/dist/cards/index.js +1 -1
  8. package/dist/chunks/{chunk-WAM6N4OF.js → chunk-4PSO6JEK.js} +107 -19
  9. package/dist/chunks/chunk-6CVZOUHB.js +152 -0
  10. package/dist/chunks/{chunk-OCV66TS2.js → chunk-AFU5E5QB.js} +17 -8
  11. package/dist/chunks/{chunk-R6AM4GJR.js → chunk-DJ2IUQEU.js} +24 -18
  12. package/dist/chunks/{chunk-LOXBLQ3I.js → chunk-E7JHLNLG.js} +9 -2
  13. package/dist/chunks/{chunk-LNCOGBMI.js → chunk-FHKSLCVW.js} +13 -3
  14. package/dist/chunks/chunk-FKH5N47I.js +40 -0
  15. package/dist/chunks/chunk-HZCTYL22.js +29 -0
  16. package/dist/chunks/{chunk-CMQ5ZHLZ.js → chunk-IPUYZD4O.js} +1 -1
  17. package/dist/chunks/{chunk-VURTOVGI.js → chunk-IVH3NMQZ.js} +1 -1
  18. package/dist/chunks/{chunk-ZGHQYZEH.js → chunk-LVYG7XZJ.js} +1 -1
  19. package/dist/chunks/chunk-NAKXLBA6.js +30 -0
  20. package/dist/chunks/{chunk-7BCYLIDG.js → chunk-P3IJBJUI.js} +203 -34
  21. package/dist/chunks/{chunk-Q465X22Y.js → chunk-PURHK3JU.js} +93 -209
  22. package/dist/chunks/{chunk-F7MKFVIG.js → chunk-R3Y56YVF.js} +2 -2
  23. package/dist/chunks/chunk-RCZ7ZZFU.js +92 -0
  24. package/dist/chunks/chunk-SBIZDCRY.js +106 -0
  25. package/dist/chunks/{chunk-IBC52BX3.js → chunk-U2D34ARZ.js} +20 -3
  26. package/dist/chunks/chunk-UAT3JSJZ.js +331 -0
  27. package/dist/chunks/{chunk-QZNNCXXD.js → chunk-VQSCHOBV.js} +20 -1
  28. package/dist/chunks/{chunk-B7V6EOAC.js → chunk-XNFESPZH.js} +160 -126
  29. package/dist/chunks/{chunk-WW746NJF.js → chunk-YOTW5ESM.js} +25 -1
  30. package/dist/cli/bin.js +14 -13
  31. package/dist/cli/commands.d.ts +3 -0
  32. package/dist/cli/config.d.ts +22 -0
  33. package/dist/cli/index.d.ts +5 -1
  34. package/dist/cli/index.js +20 -15
  35. package/dist/cli/stdio.d.ts +9 -0
  36. package/dist/cli/version.d.ts +2 -0
  37. package/dist/clients/index.js +13 -3
  38. package/dist/combine/account.d.ts +1 -1
  39. package/dist/combine/index.js +90 -15
  40. package/dist/combine/route.d.ts +7 -0
  41. package/dist/exporter/index.js +2 -2
  42. package/dist/failover/index.js +4 -4
  43. package/dist/fixtures/index.js +40 -21
  44. package/dist/heyreach/account.d.ts +1 -1
  45. package/dist/heyreach/adapter.d.ts +1 -1
  46. package/dist/heyreach/capabilities.d.ts +2 -0
  47. package/dist/heyreach/client.d.ts +3 -5
  48. package/dist/heyreach/index.d.ts +7 -0
  49. package/dist/heyreach/index.js +428 -205
  50. package/dist/heyreach/leads.d.ts +4 -0
  51. package/dist/heyreach/map-account.d.ts +7 -1
  52. package/dist/heyreach/map-stats.d.ts +8 -5
  53. package/dist/heyreach/map.d.ts +3 -1
  54. package/dist/heyreach/webhooks.d.ts +1 -0
  55. package/dist/identity/index.js +22 -11
  56. package/dist/index.d.ts +1 -4
  57. package/dist/index.js +29 -17
  58. package/dist/insights/copy/index.d.ts +2 -2
  59. package/dist/insights/copy/variant-test.d.ts +2 -2
  60. package/dist/insights/index.js +248 -184
  61. package/dist/insights/ops/anomalies.d.ts +3 -3
  62. package/dist/insights/ops/index.d.ts +2 -2
  63. package/dist/insights/ops/shared.d.ts +7 -1
  64. package/dist/insights/registry.d.ts +4 -4
  65. package/dist/instantly/adapter-account.d.ts +1 -1
  66. package/dist/instantly/capabilities.d.ts +2 -0
  67. package/dist/instantly/client.d.ts +4 -9
  68. package/dist/instantly/index.d.ts +7 -0
  69. package/dist/instantly/index.js +410 -155
  70. package/dist/instantly/map-account.d.ts +20 -5
  71. package/dist/instantly/map-stats.d.ts +9 -6
  72. package/dist/instantly/map.d.ts +0 -2
  73. package/dist/instantly/native-agents-sales.d.ts +41 -41
  74. package/dist/instantly/native-agents.d.ts +44 -44
  75. package/dist/instantly/native-campaigns.d.ts +21 -21
  76. package/dist/instantly/native-leads.d.ts +12 -12
  77. package/dist/instantly/native-params.d.ts +2 -19
  78. package/dist/instantly/native-search.d.ts +10 -10
  79. package/dist/instantly/native-senders.d.ts +56 -56
  80. package/dist/instantly/native-supersearch.d.ts +33 -33
  81. package/dist/instantly/native-workspace.d.ts +45 -45
  82. package/dist/instantly/native.d.ts +262 -262
  83. package/dist/instantly/webhooks.d.ts +1 -0
  84. package/dist/internal/adapter.d.ts +24 -2
  85. package/dist/internal/capabilities.d.ts +18 -0
  86. package/dist/internal/client.d.ts +15 -0
  87. package/dist/internal/concurrency.d.ts +8 -0
  88. package/dist/internal/engine/request.d.ts +7 -0
  89. package/dist/internal/entities-account.d.ts +73 -3
  90. package/dist/internal/entities.d.ts +116 -12
  91. package/dist/internal/errors.d.ts +6 -1
  92. package/dist/internal/fields.d.ts +462 -0
  93. package/dist/internal/json.d.ts +9 -0
  94. package/dist/internal/lead-fields.d.ts +21 -0
  95. package/dist/internal/lead-status.d.ts +13 -0
  96. package/dist/internal/metrics.d.ts +14 -2
  97. package/dist/internal/native.d.ts +15 -0
  98. package/dist/internal/outbound/api.d.ts +29 -4
  99. package/dist/internal/outbound/operations-account.d.ts +12 -0
  100. package/dist/internal/outbound/outbound.d.ts +6 -3
  101. package/dist/internal/outbound/specs-account.d.ts +5 -1
  102. package/dist/internal/page.d.ts +14 -0
  103. package/dist/internal/record.d.ts +17 -0
  104. package/dist/internal/records.d.ts +7 -0
  105. package/dist/internal/sequence.d.ts +14 -0
  106. package/dist/internal/sha256.d.ts +2 -0
  107. package/dist/loader/index.d.ts +14 -2
  108. package/dist/loader/index.js +8 -4
  109. package/dist/memory/account-reads.d.ts +1 -1
  110. package/dist/memory/account.d.ts +15 -1
  111. package/dist/memory/data.d.ts +17 -2
  112. package/dist/memory/index.js +110 -35
  113. package/dist/redact/index.js +11 -6
  114. package/dist/redact/plugin.d.ts +1 -1
  115. package/dist/smartlead/account.d.ts +1 -1
  116. package/dist/smartlead/adapter.d.ts +1 -1
  117. package/dist/smartlead/capabilities.d.ts +2 -0
  118. package/dist/smartlead/client.d.ts +6 -11
  119. package/dist/smartlead/hmac.d.ts +0 -2
  120. package/dist/smartlead/index.d.ts +7 -0
  121. package/dist/smartlead/index.js +731 -572
  122. package/dist/smartlead/leads.d.ts +4 -1
  123. package/dist/smartlead/map-account.d.ts +17 -5
  124. package/dist/smartlead/map-stats.d.ts +9 -10
  125. package/dist/smartlead/map.d.ts +15 -5
  126. package/dist/smartlead/native-analytics.d.ts +87 -87
  127. package/dist/smartlead/native-campaigns.d.ts +64 -64
  128. package/dist/smartlead/native-inbox.d.ts +51 -51
  129. package/dist/smartlead/native-params.d.ts +2 -23
  130. package/dist/smartlead/native-services.d.ts +34 -34
  131. package/dist/smartlead/native.d.ts +236 -236
  132. package/dist/smartlead/shared.d.ts +6 -5
  133. package/dist/smartlead/webhooks.d.ts +1 -0
  134. package/dist/sync/index.js +3 -3
  135. package/dist/tools/ai-sdk.js +7 -5
  136. package/dist/tools/campaign-tools.d.ts +1 -1
  137. package/dist/tools/claude-agent.js +7 -5
  138. package/dist/tools/index.js +8 -6
  139. package/dist/tracing/index.js +2 -2
  140. package/dist/webhooks/index.js +10 -9
  141. package/package.json +1 -1
  142. package/dist/chunks/chunk-FZF6CLPX.js +0 -232
  143. package/dist/chunks/chunk-GPEJG34O.js +0 -53
  144. package/dist/chunks/chunk-HEC7XFFH.js +0 -65
  145. package/dist/chunks/chunk-QTB747K4.js +0 -100
  146. package/dist/chunks/chunk-TIJKJJDW.js +0 -6
@@ -1,2 +1,3 @@
1
1
  import type { EventFormat } from "../internal/adapter.ts";
2
+ export declare const EVENT_TYPES: Map<string, "unknown" | "campaign.status_changed" | "lead.status_changed" | "lead.unsubscribed" | "linkedin.connection_accepted" | "linkedin.connection_sent" | "linkedin.message_received" | "linkedin.message_sent" | "meeting.booked" | "message.bounced" | "message.clicked" | "message.opened" | "message.sent" | "reply.categorized" | "reply.received" | "sender.status_changed">;
2
3
  export declare const instantlyEvents: (provider: string) => EventFormat;
@@ -1,7 +1,8 @@
1
1
  import type { CapabilityDeclaration } from "./capabilities.ts";
2
- import type { BlockEntry, CampaignSettings, LeadList, SenderHealth, Tag, WebhookSubscription } from "./entities-account.ts";
2
+ import type { BlockEntry, CampaignProgress, CampaignSettings, LeadList, PlacementTest, SenderHealth, Tag, WebhookSubscription } from "./entities-account.ts";
3
3
  import type { Campaign, CampaignStatus, Lead, Message, MetricRow, MetricScope, OutboundEvent, Reply, ReplyCategory, Sender, Sequence, Workspace } from "./entities.ts";
4
4
  import type { ErrorMapper } from "./errors.ts";
5
+ import type { FieldCoverage, FieldDeclaration } from "./fields.ts";
5
6
  import type { Json } from "./json.ts";
6
7
  import type { LimitDeclaration } from "./limits.ts";
7
8
  import type { NativeCatalog, NoNative } from "./native.ts";
@@ -38,6 +39,8 @@ export interface PageQuery {
38
39
  }
39
40
  export interface CampaignQuery extends PageQuery {
40
41
  readonly status?: CampaignStatus | undefined;
42
+ /** Only the campaigns this sender is attached to. */
43
+ readonly senderId?: string | undefined;
41
44
  }
42
45
  export interface SenderQuery extends PageQuery {
43
46
  readonly campaignId?: string | undefined;
@@ -68,6 +71,8 @@ export interface MessageQuery extends PageQuery, TimeRange {
68
71
  export interface ReplyQuery extends PageQuery, TimeRange {
69
72
  readonly campaignId?: string | undefined;
70
73
  readonly category?: ReplyCategory | undefined;
74
+ /** `true` for unread replies only, `false` for read ones only. */
75
+ readonly unread?: boolean | undefined;
71
76
  readonly includeBody: boolean;
72
77
  }
73
78
  export interface SubsequenceQuery extends PageQuery {
@@ -78,7 +83,10 @@ export interface WebhookQuery extends PageQuery {
78
83
  }
79
84
  export interface StatsQuery {
80
85
  readonly scope: MetricScope;
81
- /** The campaign or sender id. Not used for the workspace scope. */
86
+ /**
87
+ * The campaign or sender id. Not used for the workspace scope. The
88
+ * campaign scope without one asks for a row per campaign.
89
+ */
82
90
  readonly scopeId?: string | undefined;
83
91
  /** Inclusive `YYYY-MM-DD`. */
84
92
  readonly from?: string | undefined;
@@ -152,6 +160,16 @@ export interface Adapter<Native extends NativeCatalog = NoNative> {
152
160
  readonly events?: EventFormat | undefined;
153
161
  /** What is assumed and not yet confirmed against the live API. */
154
162
  readonly caveats?: readonly string[] | undefined;
163
+ /**
164
+ * The fields this adapter derives or never fills, by record. Omitted: every
165
+ * field is one the vendor reports.
166
+ */
167
+ readonly fields?: FieldDeclaration | undefined;
168
+ /**
169
+ * Set by `combine()` in place of `fields`: the coverage of the members read
170
+ * as one.
171
+ */
172
+ readonly fieldCoverage?: FieldCoverage | undefined;
155
173
  /** Request costs by operation kind, for `outbound.estimate()`. */
156
174
  readonly costs?: Readonly<Record<string, OperationCost>> | undefined;
157
175
  /**
@@ -180,10 +198,14 @@ export interface Adapter<Native extends NativeCatalog = NoNative> {
180
198
  readonly stats?: (query: StatsQuery, ctx: AdapterContext) => Promise<readonly MetricRow[]>;
181
199
  readonly listWorkspaces?: (query: PageQuery, ctx: AdapterContext) => Promise<Page<Workspace>>;
182
200
  readonly getCampaignSettings?: (campaignId: string, ctx: AdapterContext) => Promise<CampaignSettings>;
201
+ readonly getCampaignProgress?: (campaignId: string, ctx: AdapterContext) => Promise<CampaignProgress>;
183
202
  readonly listSubsequences?: (query: SubsequenceQuery, ctx: AdapterContext) => Promise<Page<Sequence>>;
184
203
  readonly getSenderHealth?: (senderId: string, ctx: AdapterContext) => Promise<SenderHealth>;
185
204
  readonly listLists?: (query: PageQuery, ctx: AdapterContext) => Promise<Page<LeadList>>;
205
+ readonly getList?: (id: string, ctx: AdapterContext) => Promise<LeadList>;
186
206
  readonly listBlocklist?: (query: PageQuery, ctx: AdapterContext) => Promise<Page<BlockEntry>>;
207
+ readonly listPlacementTests?: (query: PageQuery, ctx: AdapterContext) => Promise<Page<PlacementTest>>;
187
208
  readonly listTags?: (query: PageQuery, ctx: AdapterContext) => Promise<Page<Tag>>;
188
209
  readonly listWebhooks?: (query: WebhookQuery, ctx: AdapterContext) => Promise<Page<WebhookSubscription>>;
210
+ readonly getWebhook?: (id: string, ctx: AdapterContext) => Promise<WebhookSubscription>;
189
211
  }
@@ -5,6 +5,10 @@ export type StatGrade = "derived" | "exact" | false;
5
5
  export interface Capabilities {
6
6
  /** Filter campaigns by status. */
7
7
  "campaigns.status": FilterGrade;
8
+ /** List the campaigns one sender is attached to. */
9
+ "campaigns.bySender": boolean;
10
+ /** How many of a campaign's leads are waiting, in progress, finished or stopped. */
11
+ "campaigns.progress": boolean;
8
12
  /** A campaign's schedule, daily caps, tracking and stop rules. */
9
13
  "campaigns.settings": boolean;
10
14
  /** A campaign's steps and variants. */
@@ -31,6 +35,8 @@ export interface Capabilities {
31
35
  "leads.engagement": boolean;
32
36
  /** List the saved lead lists. */
33
37
  "lists.list": boolean;
38
+ /** One saved lead list by id. */
39
+ "lists.get": boolean;
34
40
  /** List the leads of one saved list. */
35
41
  "lists.leads": boolean;
36
42
  /** Every message for one lead, in order. */
@@ -45,17 +51,29 @@ export interface Capabilities {
45
51
  /** Reply categories come from the vendor, or are not available. */
46
52
  "replies.category": "vendor" | false;
47
53
  "replies.since": FilterGrade;
54
+ /** Only the replies that are unread, or only the ones that are read. */
55
+ "replies.unread": FilterGrade;
48
56
  "stats.workspace": StatGrade;
49
57
  "stats.campaign": StatGrade;
58
+ /**
59
+ * One row per campaign in a single call: `stats({ scope: "campaign" })` with
60
+ * no campaign named. `full` when each row carries every count the read of
61
+ * one campaign does, `partial` when the vendor's report has fewer.
62
+ */
63
+ "stats.allCampaigns": "full" | "partial" | false;
50
64
  "stats.byDay": StatGrade;
51
65
  "stats.byStep": StatGrade;
52
66
  "stats.bySender": StatGrade;
53
67
  workspaces: boolean;
54
68
  /** The addresses, domains and profiles the account never contacts. */
55
69
  blocklist: boolean;
70
+ /** List the inbox placement tests the account has set up. */
71
+ "placementTests.list": boolean;
56
72
  tags: boolean;
57
73
  /** The webhooks registered with the vendor. */
58
74
  "webhooks.list": boolean;
75
+ /** One webhook subscription by id. */
76
+ "webhooks.get": boolean;
59
77
  /** The vendor's own reads are available by name through `outbound.native`. */
60
78
  native: boolean;
61
79
  /** Webhook payloads can be parsed into `OutboundEvent`s. */
@@ -0,0 +1,15 @@
1
+ import type { AdapterContext, RequestSpec } from "./adapter.ts";
2
+ import type { Json, JsonObject } from "./json.ts";
3
+ import type { QueryValue } from "./url.ts";
4
+ export interface RequestOptions {
5
+ readonly query?: Readonly<Record<string, QueryValue>> | undefined;
6
+ /** A rate lane declared in the adapter's limits. */
7
+ readonly lane?: string | undefined;
8
+ }
9
+ export interface VendorClient {
10
+ readonly get: (ctx: AdapterContext, path: string, options?: RequestOptions) => Promise<Json>;
11
+ /** Only for the reads a vendor serves over POST. */
12
+ readonly post: (ctx: AdapterContext, path: string, body: JsonObject, options?: RequestOptions) => Promise<Json>;
13
+ }
14
+ /** `get` and `post` for one vendor: every request is authorized and goes through `ctx.request`. */
15
+ export declare const createVendorClient: (baseUrl: string, authorize: (spec: RequestSpec) => RequestSpec) => VendorClient;
@@ -0,0 +1,8 @@
1
+ /** How many independent reads a caller keeps in flight by default. */
2
+ export declare const DEFAULT_READ_CONCURRENCY = 4;
3
+ /**
4
+ * Maps `items` through `read` with at most `limit` reads in flight, and
5
+ * returns the results in the order of `items`. After a read fails no new read
6
+ * starts, and the first failure is thrown once the reads in flight settle.
7
+ */
8
+ export declare const mapConcurrent: <Item, Result>(items: readonly Item[], read: (item: Item, index: number) => Promise<Result>, limit?: number) => Promise<Result[]>;
@@ -15,6 +15,13 @@ export interface CallState {
15
15
  readonly deadlineAt: number | undefined;
16
16
  /** Stop after this many vendor requests. A plugin may lower it. */
17
17
  maxRequests: number | undefined;
18
+ /**
19
+ * Runs as each vendor request is about to be sent, after any wait, with no
20
+ * other request able to slip in between. A plugin that caps requests across
21
+ * calls counts the request here, or throws to stop it. A plugin chains onto
22
+ * the one already set.
23
+ */
24
+ beforeRequest: (() => void) | undefined;
18
25
  }
19
26
  export interface RequestEnvironment {
20
27
  readonly adapter: Adapter;
@@ -39,6 +39,27 @@ export declare const campaignSettingsSchema: z.ZodObject<{
39
39
  workspaceId: z.ZodString;
40
40
  }, z.core.$strip>;
41
41
  export type CampaignSettings = z.infer<typeof campaignSettingsSchema>;
42
+ /**
43
+ * How far a campaign's leads have got, as counts of leads. `sourceId` is the
44
+ * campaign's id. Stats count messages and replies; this counts people.
45
+ */
46
+ export declare const campaignProgressSchema: z.ZodObject<{
47
+ blocked: z.ZodNullable<z.ZodNumber>;
48
+ campaignRef: z.ZodString;
49
+ completed: z.ZodNullable<z.ZodNumber>;
50
+ failed: z.ZodNullable<z.ZodNumber>;
51
+ inProgress: z.ZodNullable<z.ZodNumber>;
52
+ leads: z.ZodNullable<z.ZodNumber>;
53
+ notStarted: z.ZodNullable<z.ZodNumber>;
54
+ stopped: z.ZodNullable<z.ZodNumber>;
55
+ provider: z.ZodString;
56
+ raw: z.ZodJSONSchema;
57
+ ref: z.ZodString;
58
+ schemaVersion: z.ZodLiteral<1>;
59
+ sourceId: z.ZodString;
60
+ workspaceId: z.ZodString;
61
+ }, z.core.$strip>;
62
+ export type CampaignProgress = z.infer<typeof campaignProgressSchema>;
42
63
  /** What the vendor knows about a sender's deliverability. `sourceId` is the sender's id. */
43
64
  export declare const senderHealthSchema: z.ZodObject<{
44
65
  blacklisted: z.ZodNullable<z.ZodBoolean>;
@@ -72,8 +93,8 @@ export type SenderHealth = z.infer<typeof senderHealthSchema>;
72
93
  export declare const leadListSchema: z.ZodObject<{
73
94
  createdAt: z.ZodNullable<z.ZodISODateTime>;
74
95
  kind: z.ZodEnum<{
75
- companies: "companies";
76
96
  leads: "leads";
97
+ companies: "companies";
77
98
  }>;
78
99
  name: z.ZodString;
79
100
  size: z.ZodNullable<z.ZodNumber>;
@@ -91,9 +112,9 @@ export declare const blockEntrySchema: z.ZodObject<{
91
112
  kind: z.ZodEnum<{
92
113
  email: "email";
93
114
  linkedin: "linkedin";
115
+ other: "other";
94
116
  company: "company";
95
117
  domain: "domain";
96
- other: "other";
97
118
  }>;
98
119
  value: z.ZodString;
99
120
  provider: z.ZodString;
@@ -115,11 +136,60 @@ export declare const tagSchema: z.ZodObject<{
115
136
  workspaceId: z.ZodString;
116
137
  }, z.core.$strip>;
117
138
  export type Tag = z.infer<typeof tagSchema>;
139
+ /**
140
+ * An inbox placement test: the vendor sends a campaign's email to seed
141
+ * mailboxes and reports where it landed. This is the test itself. Its
142
+ * results stay native, because one vendor reports them as a row per email
143
+ * and another as rates.
144
+ */
145
+ export declare const placementTestSchema: z.ZodObject<{
146
+ campaignRef: z.ZodNullable<z.ZodString>;
147
+ createdAt: z.ZodNullable<z.ZodISODateTime>;
148
+ endsAt: z.ZodNullable<z.ZodISODateTime>;
149
+ kind: z.ZodNullable<z.ZodEnum<{
150
+ automated: "automated";
151
+ one_time: "one_time";
152
+ }>>;
153
+ name: z.ZodString;
154
+ nextRunAt: z.ZodNullable<z.ZodISODateTime>;
155
+ startsAt: z.ZodNullable<z.ZodISODateTime>;
156
+ status: z.ZodEnum<{
157
+ active: "active";
158
+ completed: "completed";
159
+ paused: "paused";
160
+ unknown: "unknown";
161
+ }>;
162
+ provider: z.ZodString;
163
+ raw: z.ZodJSONSchema;
164
+ ref: z.ZodString;
165
+ schemaVersion: z.ZodLiteral<1>;
166
+ sourceId: z.ZodString;
167
+ workspaceId: z.ZodString;
168
+ }, z.core.$strip>;
169
+ export type PlacementTest = z.infer<typeof placementTestSchema>;
118
170
  /** A webhook registered with the vendor. */
119
171
  export declare const webhookSubscriptionSchema: z.ZodObject<{
120
172
  active: z.ZodNullable<z.ZodBoolean>;
121
173
  campaignRefs: z.ZodArray<z.ZodString>;
122
174
  createdAt: z.ZodNullable<z.ZodISODateTime>;
175
+ eventTypes: z.ZodArray<z.ZodEnum<{
176
+ unknown: "unknown";
177
+ "campaign.status_changed": "campaign.status_changed";
178
+ "lead.status_changed": "lead.status_changed";
179
+ "lead.unsubscribed": "lead.unsubscribed";
180
+ "linkedin.connection_accepted": "linkedin.connection_accepted";
181
+ "linkedin.connection_sent": "linkedin.connection_sent";
182
+ "linkedin.message_received": "linkedin.message_received";
183
+ "linkedin.message_sent": "linkedin.message_sent";
184
+ "meeting.booked": "meeting.booked";
185
+ "message.bounced": "message.bounced";
186
+ "message.clicked": "message.clicked";
187
+ "message.opened": "message.opened";
188
+ "message.sent": "message.sent";
189
+ "reply.categorized": "reply.categorized";
190
+ "reply.received": "reply.received";
191
+ "sender.status_changed": "sender.status_changed";
192
+ }>>;
123
193
  events: z.ZodArray<z.ZodString>;
124
194
  name: z.ZodNullable<z.ZodString>;
125
195
  url: z.ZodString;
@@ -132,4 +202,4 @@ export declare const webhookSubscriptionSchema: z.ZodObject<{
132
202
  }, z.core.$strip>;
133
203
  export type WebhookSubscription = z.infer<typeof webhookSubscriptionSchema>;
134
204
  /** Any record a list or get call returns. */
135
- export type Entity = BlockEntry | Campaign | CampaignSettings | Lead | LeadList | Message | Reply | Sender | SenderHealth | Sequence | Tag | WebhookSubscription | Workspace;
205
+ export type Entity = BlockEntry | Campaign | CampaignProgress | CampaignSettings | Lead | LeadList | Message | PlacementTest | Reply | Sender | SenderHealth | Sequence | Tag | WebhookSubscription | Workspace;
@@ -107,6 +107,13 @@ export declare const senderStatusSchema: z.ZodEnum<{
107
107
  disconnected: "disconnected";
108
108
  }>;
109
109
  export type SenderStatus = z.infer<typeof senderStatusSchema>;
110
+ export declare const mailProviderSchema: z.ZodEnum<{
111
+ google: "google";
112
+ microsoft: "microsoft";
113
+ other: "other";
114
+ smtp: "smtp";
115
+ }>;
116
+ export type MailProvider = z.infer<typeof mailProviderSchema>;
110
117
  export declare const senderSchema: z.ZodObject<{
111
118
  address: z.ZodNullable<z.ZodString>;
112
119
  dailyLimit: z.ZodNullable<z.ZodNumber>;
@@ -115,6 +122,12 @@ export declare const senderSchema: z.ZodObject<{
115
122
  mailbox: "mailbox";
116
123
  }>;
117
124
  linkedinUrl: z.ZodNullable<z.ZodString>;
125
+ mailProvider: z.ZodNullable<z.ZodEnum<{
126
+ google: "google";
127
+ microsoft: "microsoft";
128
+ other: "other";
129
+ smtp: "smtp";
130
+ }>>;
118
131
  name: z.ZodNullable<z.ZodString>;
119
132
  status: z.ZodEnum<{
120
133
  error: "error";
@@ -123,6 +136,7 @@ export declare const senderSchema: z.ZodObject<{
123
136
  unknown: "unknown";
124
137
  disconnected: "disconnected";
125
138
  }>;
139
+ tags: z.ZodArray<z.ZodString>;
126
140
  warmup: z.ZodNullable<z.ZodObject<{
127
141
  enabled: z.ZodNullable<z.ZodBoolean>;
128
142
  score: z.ZodNullable<z.ZodNumber>;
@@ -135,6 +149,16 @@ export declare const senderSchema: z.ZodObject<{
135
149
  workspaceId: z.ZodString;
136
150
  }, z.core.$strip>;
137
151
  export type Sender = z.infer<typeof senderSchema>;
152
+ export declare const replyCategorySchema: z.ZodEnum<{
153
+ unknown: "unknown";
154
+ bounce: "bounce";
155
+ negative: "negative";
156
+ neutral: "neutral";
157
+ ooo: "ooo";
158
+ positive: "positive";
159
+ unsubscribe: "unsubscribe";
160
+ }>;
161
+ export type ReplyCategory = z.infer<typeof replyCategorySchema>;
138
162
  export declare const leadStatusSchema: z.ZodEnum<{
139
163
  active: "active";
140
164
  completed: "completed";
@@ -145,6 +169,14 @@ export declare const leadStatusSchema: z.ZodEnum<{
145
169
  unsubscribed: "unsubscribed";
146
170
  }>;
147
171
  export type LeadStatus = z.infer<typeof leadStatusSchema>;
172
+ /** Where a lead is in its sequence, whatever came back from it. */
173
+ export declare const leadProgressSchema: z.ZodEnum<{
174
+ active: "active";
175
+ completed: "completed";
176
+ paused: "paused";
177
+ unknown: "unknown";
178
+ }>;
179
+ export type LeadProgress = z.infer<typeof leadProgressSchema>;
148
180
  /** What a lead did with the campaign's messages, as the vendor counts it. */
149
181
  export declare const leadEngagementSchema: z.ZodObject<{
150
182
  clicks: z.ZodNullable<z.ZodNumber>;
@@ -158,8 +190,10 @@ export declare const leadEngagementSchema: z.ZodObject<{
158
190
  }, z.core.$strip>;
159
191
  export type LeadEngagement = z.infer<typeof leadEngagementSchema>;
160
192
  export declare const leadSchema: z.ZodObject<{
193
+ bounced: z.ZodNullable<z.ZodBoolean>;
161
194
  campaignRef: z.ZodNullable<z.ZodString>;
162
195
  company: z.ZodNullable<z.ZodString>;
196
+ companyLinkedinUrl: z.ZodNullable<z.ZodString>;
163
197
  createdAt: z.ZodNullable<z.ZodISODateTime>;
164
198
  custom: z.ZodRecord<z.ZodString, z.ZodString>;
165
199
  email: z.ZodNullable<z.ZodString>;
@@ -175,8 +209,26 @@ export declare const leadSchema: z.ZodObject<{
175
209
  }, z.core.$strip>>;
176
210
  firstName: z.ZodNullable<z.ZodString>;
177
211
  interest: z.ZodNullable<z.ZodString>;
212
+ interestCategory: z.ZodNullable<z.ZodEnum<{
213
+ unknown: "unknown";
214
+ bounce: "bounce";
215
+ negative: "negative";
216
+ neutral: "neutral";
217
+ ooo: "ooo";
218
+ positive: "positive";
219
+ unsubscribe: "unsubscribe";
220
+ }>>;
178
221
  lastName: z.ZodNullable<z.ZodString>;
179
222
  linkedinUrl: z.ZodNullable<z.ZodString>;
223
+ location: z.ZodNullable<z.ZodString>;
224
+ phone: z.ZodNullable<z.ZodString>;
225
+ progress: z.ZodEnum<{
226
+ active: "active";
227
+ completed: "completed";
228
+ paused: "paused";
229
+ unknown: "unknown";
230
+ }>;
231
+ replied: z.ZodNullable<z.ZodBoolean>;
180
232
  status: z.ZodEnum<{
181
233
  active: "active";
182
234
  completed: "completed";
@@ -188,6 +240,8 @@ export declare const leadSchema: z.ZodObject<{
188
240
  }>;
189
241
  tags: z.ZodArray<z.ZodString>;
190
242
  title: z.ZodNullable<z.ZodString>;
243
+ unsubscribed: z.ZodNullable<z.ZodBoolean>;
244
+ website: z.ZodNullable<z.ZodString>;
191
245
  provider: z.ZodString;
192
246
  raw: z.ZodJSONSchema;
193
247
  ref: z.ZodString;
@@ -198,8 +252,8 @@ export declare const leadSchema: z.ZodObject<{
198
252
  export type Lead = z.infer<typeof leadSchema>;
199
253
  export declare const messageSchema: z.ZodObject<{
200
254
  direction: z.ZodEnum<{
201
- out: "out";
202
255
  in: "in";
256
+ out: "out";
203
257
  }>;
204
258
  bodyHtml: z.ZodNullable<z.ZodString>;
205
259
  bodyText: z.ZodNullable<z.ZodString>;
@@ -223,16 +277,6 @@ export declare const messageSchema: z.ZodObject<{
223
277
  workspaceId: z.ZodString;
224
278
  }, z.core.$strip>;
225
279
  export type Message = z.infer<typeof messageSchema>;
226
- export declare const replyCategorySchema: z.ZodEnum<{
227
- unknown: "unknown";
228
- bounce: "bounce";
229
- negative: "negative";
230
- neutral: "neutral";
231
- ooo: "ooo";
232
- positive: "positive";
233
- unsubscribe: "unsubscribe";
234
- }>;
235
- export type ReplyCategory = z.infer<typeof replyCategorySchema>;
236
280
  export declare const replySchema: z.ZodObject<{
237
281
  category: z.ZodEnum<{
238
282
  unknown: "unknown";
@@ -245,10 +289,12 @@ export declare const replySchema: z.ZodObject<{
245
289
  }>;
246
290
  categorySource: z.ZodNullable<z.ZodEnum<{
247
291
  vendor: "vendor";
292
+ lead: "lead";
248
293
  rule: "rule";
249
294
  }>>;
250
295
  direction: z.ZodLiteral<"in">;
251
296
  isAuto: z.ZodNullable<z.ZodBoolean>;
297
+ unread: z.ZodNullable<z.ZodBoolean>;
252
298
  bodyHtml: z.ZodNullable<z.ZodString>;
253
299
  bodyText: z.ZodNullable<z.ZodString>;
254
300
  campaignRef: z.ZodNullable<z.ZodString>;
@@ -291,6 +337,7 @@ export type Evidence = z.infer<typeof evidenceSchema>;
291
337
  export declare const metricRowSchema: z.ZodObject<{
292
338
  bounced: z.ZodNullable<z.ZodNumber>;
293
339
  clicked: z.ZodNullable<z.ZodNumber>;
340
+ clickedTotal: z.ZodNullable<z.ZodNumber>;
294
341
  connectionsAccepted: z.ZodNullable<z.ZodNumber>;
295
342
  connectionsSent: z.ZodNullable<z.ZodNumber>;
296
343
  contacted: z.ZodNullable<z.ZodNumber>;
@@ -354,10 +401,67 @@ export declare const eventTypeSchema: z.ZodEnum<{
354
401
  "sender.status_changed": "sender.status_changed";
355
402
  }>;
356
403
  export type EventType = z.infer<typeof eventTypeSchema>;
404
+ /**
405
+ * What an event says beyond its refs. The keys below mean the same on every
406
+ * vendor and are checked; a vendor's own extras ride along beside them. A key
407
+ * is absent when the vendor's payload does not carry it.
408
+ */
409
+ export declare const eventDataSchema: z.ZodObject<{
410
+ campaignName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
411
+ category: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
412
+ unknown: "unknown";
413
+ bounce: "bounce";
414
+ negative: "negative";
415
+ neutral: "neutral";
416
+ ooo: "ooo";
417
+ positive: "positive";
418
+ unsubscribe: "unsubscribe";
419
+ }>>>;
420
+ categoryName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
421
+ isAuto: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
422
+ isFirst: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
423
+ isInmail: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
424
+ isTest: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
425
+ leadEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
426
+ leadName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
427
+ senderEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
428
+ stepIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
429
+ subject: z.ZodOptional<z.ZodNullable<z.ZodString>>;
430
+ text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
431
+ untracked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
432
+ variantKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
433
+ vendorEvent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
434
+ }, z.core.$catchall<z.ZodJSONSchema>>;
435
+ export type EventData = z.infer<typeof eventDataSchema>;
357
436
  /** Every webhook and every sync diff becomes this one shape. */
358
437
  export declare const outboundEventSchema: z.ZodObject<{
359
438
  campaignRef: z.ZodNullable<z.ZodString>;
360
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
439
+ data: z.ZodObject<{
440
+ campaignName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
441
+ category: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
442
+ unknown: "unknown";
443
+ bounce: "bounce";
444
+ negative: "negative";
445
+ neutral: "neutral";
446
+ ooo: "ooo";
447
+ positive: "positive";
448
+ unsubscribe: "unsubscribe";
449
+ }>>>;
450
+ categoryName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
451
+ isAuto: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
452
+ isFirst: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
453
+ isInmail: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
454
+ isTest: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
455
+ leadEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
456
+ leadName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
457
+ senderEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
458
+ stepIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
459
+ subject: z.ZodOptional<z.ZodNullable<z.ZodString>>;
460
+ text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
461
+ untracked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
462
+ variantKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
463
+ vendorEvent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
464
+ }, z.core.$catchall<z.ZodJSONSchema>>;
361
465
  id: z.ZodString;
362
466
  leadRef: z.ZodNullable<z.ZodString>;
363
467
  messageRef: z.ZodNullable<z.ZodString>;
@@ -1,4 +1,4 @@
1
- import type { Json } from "./json.ts";
1
+ import type { Json, JsonObject } from "./json.ts";
2
2
  export type OutboundErrorCode = "Invalid" | "NotFound" | "Provider" | "RateLimited" | "Unauthorized" | "Unsupported";
3
3
  export interface OutboundErrorOptions {
4
4
  /**
@@ -54,4 +54,9 @@ export type ErrorMapper = (cause: unknown) => OutboundError;
54
54
  * becomes a retryable `Provider` error with the original kept in `cause`.
55
55
  */
56
56
  export declare const makeErrorMapper: (provider: string, options?: ErrorMapperOptions) => ErrorMapper;
57
+ /**
58
+ * A vendor response that must be one object. Anything else is the vendor's
59
+ * fault, so it is a `Provider` error with the adapter's own message.
60
+ */
61
+ export declare const requireObject: (body: Json | undefined, provider: string, message: string) => JsonObject;
57
62
  export {};