outbound-sdk 0.0.0-stage → 0.2.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.
Files changed (284) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +119 -2
  3. package/dist/alerts/index.d.ts +2 -0
  4. package/dist/alerts/index.js +140 -0
  5. package/dist/alerts/plugin.d.ts +58 -0
  6. package/dist/audit/index.d.ts +33 -0
  7. package/dist/audit/index.js +60 -0
  8. package/dist/benchmarks/index.d.ts +29 -0
  9. package/dist/benchmarks/index.js +72 -0
  10. package/dist/budget/index.d.ts +21 -0
  11. package/dist/budget/index.js +71 -0
  12. package/dist/cache/index.d.ts +31 -0
  13. package/dist/cache/index.js +11 -0
  14. package/dist/cards/content.d.ts +43 -0
  15. package/dist/cards/copy-cards.d.ts +2 -0
  16. package/dist/cards/format.d.ts +39 -0
  17. package/dist/cards/index.d.ts +9 -0
  18. package/dist/cards/index.js +2070 -0
  19. package/dist/cards/notify-cards.d.ts +14 -0
  20. package/dist/cards/ops-cards.d.ts +2 -0
  21. package/dist/cards/parts.d.ts +22 -0
  22. package/dist/cards/people-cards.d.ts +2 -0
  23. package/dist/cards/render.d.ts +28 -0
  24. package/dist/cards/sender-cards.d.ts +2 -0
  25. package/dist/cards/slack-rich.d.ts +19 -0
  26. package/dist/cards/slack-text.d.ts +10 -0
  27. package/dist/cards/slack.d.ts +21 -0
  28. package/dist/cards/spec.d.ts +86 -0
  29. package/dist/cards/tool-cards.d.ts +4 -0
  30. package/dist/chunks/chunk-4O2HRTTI.js +75 -0
  31. package/dist/chunks/chunk-4PSO6JEK.js +357 -0
  32. package/dist/chunks/chunk-6CVZOUHB.js +152 -0
  33. package/dist/chunks/chunk-AFU5E5QB.js +714 -0
  34. package/dist/chunks/chunk-DJ2IUQEU.js +111 -0
  35. package/dist/chunks/chunk-E7JHLNLG.js +187 -0
  36. package/dist/chunks/chunk-FHKSLCVW.js +154 -0
  37. package/dist/chunks/chunk-FKH5N47I.js +40 -0
  38. package/dist/chunks/chunk-HZCTYL22.js +29 -0
  39. package/dist/chunks/chunk-IPUYZD4O.js +25 -0
  40. package/dist/chunks/chunk-IVH3NMQZ.js +61 -0
  41. package/dist/chunks/chunk-LVYG7XZJ.js +45 -0
  42. package/dist/chunks/chunk-NAKXLBA6.js +30 -0
  43. package/dist/chunks/chunk-NAWZ73QS.js +22 -0
  44. package/dist/chunks/chunk-PMSSUWD7.js +636 -0
  45. package/dist/chunks/chunk-PURHK3JU.js +432 -0
  46. package/dist/chunks/chunk-R3Y56YVF.js +43 -0
  47. package/dist/chunks/chunk-RCZ7ZZFU.js +92 -0
  48. package/dist/chunks/chunk-SBIZDCRY.js +106 -0
  49. package/dist/chunks/chunk-U2D34ARZ.js +41 -0
  50. package/dist/chunks/chunk-UAT3JSJZ.js +331 -0
  51. package/dist/chunks/chunk-VQSCHOBV.js +111 -0
  52. package/dist/chunks/chunk-XC6CZP73.js +80 -0
  53. package/dist/chunks/chunk-XNFESPZH.js +2307 -0
  54. package/dist/chunks/chunk-YOTW5ESM.js +118 -0
  55. package/dist/cli/bin.d.ts +2 -0
  56. package/dist/cli/bin.js +35 -0
  57. package/dist/cli/commands.d.ts +19 -0
  58. package/dist/cli/config.d.ts +22 -0
  59. package/dist/cli/index.d.ts +17 -0
  60. package/dist/cli/index.js +30 -0
  61. package/dist/cli/mcp.d.ts +14 -0
  62. package/dist/cli/stdio.d.ts +9 -0
  63. package/dist/clients/index.d.ts +2 -0
  64. package/dist/clients/index.js +117 -0
  65. package/dist/clients/plugin.d.ts +42 -0
  66. package/dist/combine/account.d.ts +4 -0
  67. package/dist/combine/adapter.d.ts +9 -0
  68. package/dist/combine/index.d.ts +2 -0
  69. package/dist/combine/index.js +420 -0
  70. package/dist/combine/route.d.ts +24 -0
  71. package/dist/exporter/index.d.ts +29 -0
  72. package/dist/exporter/index.js +77 -0
  73. package/dist/failover/index.d.ts +11 -0
  74. package/dist/failover/index.js +45 -0
  75. package/dist/fixtures/index.d.ts +27 -0
  76. package/dist/fixtures/index.js +260 -0
  77. package/dist/fixtures/scrub.d.ts +5 -0
  78. package/dist/heyreach/account.d.ts +11 -0
  79. package/dist/heyreach/adapter.d.ts +5 -0
  80. package/dist/heyreach/capabilities.d.ts +70 -0
  81. package/dist/heyreach/client.d.ts +18 -0
  82. package/dist/heyreach/inbox.d.ts +7 -0
  83. package/dist/heyreach/index.d.ts +25 -0
  84. package/dist/heyreach/index.js +1931 -0
  85. package/dist/heyreach/leads.d.ts +4 -0
  86. package/dist/heyreach/lookup.d.ts +15 -0
  87. package/dist/heyreach/map-account.d.ts +31 -0
  88. package/dist/heyreach/map-sequence.d.ts +5 -0
  89. package/dist/heyreach/map-stats.d.ts +13 -0
  90. package/dist/heyreach/map.d.ts +37 -0
  91. package/dist/heyreach/native-organization.d.ts +128 -0
  92. package/dist/heyreach/native-voice.d.ts +106 -0
  93. package/dist/heyreach/native.d.ts +496 -0
  94. package/dist/heyreach/paging.d.ts +7 -0
  95. package/dist/heyreach/webhooks.d.ts +3 -0
  96. package/dist/identity/index.d.ts +3 -0
  97. package/dist/identity/index.js +159 -0
  98. package/dist/identity/keys.d.ts +9 -0
  99. package/dist/identity/plugin.d.ts +34 -0
  100. package/dist/index.d.ts +33 -0
  101. package/dist/index.js +131 -0
  102. package/dist/insights/copy/copy-audit.d.ts +55 -0
  103. package/dist/insights/copy/copy-checks.d.ts +44 -0
  104. package/dist/insights/copy/copy-reuse.d.ts +59 -0
  105. package/dist/insights/copy/index.d.ts +67 -0
  106. package/dist/insights/copy/reply-timing.d.ts +63 -0
  107. package/dist/insights/copy/shared.d.ts +53 -0
  108. package/dist/insights/copy/step-funnel.d.ts +66 -0
  109. package/dist/insights/copy/variant-test.d.ts +64 -0
  110. package/dist/insights/define.d.ts +98 -0
  111. package/dist/insights/index.d.ts +10 -0
  112. package/dist/insights/index.js +4937 -0
  113. package/dist/insights/ops/anomalies.d.ts +80 -0
  114. package/dist/insights/ops/campaign-diagnosis.d.ts +39 -0
  115. package/dist/insights/ops/campaign-ranking.d.ts +56 -0
  116. package/dist/insights/ops/channel-mix.d.ts +44 -0
  117. package/dist/insights/ops/client-report.d.ts +76 -0
  118. package/dist/insights/ops/diagnosis-checks.d.ts +48 -0
  119. package/dist/insights/ops/index.d.ts +135 -0
  120. package/dist/insights/ops/period-comparison.d.ts +86 -0
  121. package/dist/insights/ops/pipeline-forecast.d.ts +44 -0
  122. package/dist/insights/ops/shared.d.ts +155 -0
  123. package/dist/insights/ops/tag-rollup.d.ts +32 -0
  124. package/dist/insights/people/account-summary.d.ts +68 -0
  125. package/dist/insights/people/dropped-replies.d.ts +51 -0
  126. package/dist/insights/people/find.d.ts +18 -0
  127. package/dist/insights/people/hot-leads.d.ts +67 -0
  128. package/dist/insights/people/index.d.ts +88 -0
  129. package/dist/insights/people/lead-collisions.d.ts +43 -0
  130. package/dist/insights/people/person-summary.d.ts +46 -0
  131. package/dist/insights/people/personalization-gaps.d.ts +60 -0
  132. package/dist/insights/people/read.d.ts +40 -0
  133. package/dist/insights/people/suppression-check.d.ts +53 -0
  134. package/dist/insights/plugin.d.ts +40 -0
  135. package/dist/insights/registry.d.ts +335 -0
  136. package/dist/insights/senders/bounce-watch.d.ts +70 -0
  137. package/dist/insights/senders/domain-health.d.ts +69 -0
  138. package/dist/insights/senders/index.d.ts +74 -0
  139. package/dist/insights/senders/read.d.ts +37 -0
  140. package/dist/insights/senders/sender-capacity.d.ts +67 -0
  141. package/dist/insights/senders/sender-load.d.ts +52 -0
  142. package/dist/insights/senders/settings-audit.d.ts +48 -0
  143. package/dist/insights/senders/warmup-readiness.d.ts +39 -0
  144. package/dist/insights/stats.d.ts +45 -0
  145. package/dist/insights/tools.d.ts +16 -0
  146. package/dist/insights/types.d.ts +4 -0
  147. package/dist/instantly/adapter-account.d.ts +5 -0
  148. package/dist/instantly/adapter-mail.d.ts +3 -0
  149. package/dist/instantly/adapter.d.ts +7 -0
  150. package/dist/instantly/capabilities.d.ts +85 -0
  151. package/dist/instantly/client.d.ts +24 -0
  152. package/dist/instantly/index.d.ts +27 -0
  153. package/dist/instantly/index.js +2627 -0
  154. package/dist/instantly/map-account.d.ts +38 -0
  155. package/dist/instantly/map-lead.d.ts +18 -0
  156. package/dist/instantly/map-stats.d.ts +25 -0
  157. package/dist/instantly/map.d.ts +22 -0
  158. package/dist/instantly/native-agents-sales.d.ts +161 -0
  159. package/dist/instantly/native-agents.d.ts +156 -0
  160. package/dist/instantly/native-campaigns.d.ts +101 -0
  161. package/dist/instantly/native-leads.d.ts +93 -0
  162. package/dist/instantly/native-params.d.ts +7 -0
  163. package/dist/instantly/native-search.d.ts +82 -0
  164. package/dist/instantly/native-senders.d.ts +182 -0
  165. package/dist/instantly/native-supersearch.d.ts +149 -0
  166. package/dist/instantly/native-workspace.d.ts +170 -0
  167. package/dist/instantly/native.d.ts +1081 -0
  168. package/dist/instantly/pages.d.ts +29 -0
  169. package/dist/instantly/stats.d.ts +5 -0
  170. package/dist/instantly/webhooks.d.ts +3 -0
  171. package/dist/internal/adapter.d.ts +211 -0
  172. package/dist/internal/capabilities.d.ts +104 -0
  173. package/dist/internal/client.d.ts +15 -0
  174. package/dist/internal/concurrency.d.ts +8 -0
  175. package/dist/internal/cursor.d.ts +10 -0
  176. package/dist/internal/engine/budget.d.ts +44 -0
  177. package/dist/internal/engine/engine.d.ts +45 -0
  178. package/dist/internal/engine/rate-store.d.ts +25 -0
  179. package/dist/internal/engine/request.d.ts +34 -0
  180. package/dist/internal/engine/retry.d.ts +21 -0
  181. package/dist/internal/engine/runtime.d.ts +13 -0
  182. package/dist/internal/entities-account.d.ts +205 -0
  183. package/dist/internal/entities.d.ts +493 -0
  184. package/dist/internal/env.d.ts +4 -0
  185. package/dist/internal/errors.d.ts +62 -0
  186. package/dist/internal/fields.d.ts +462 -0
  187. package/dist/internal/hooks.d.ts +55 -0
  188. package/dist/internal/json.d.ts +49 -0
  189. package/dist/internal/lead-fields.d.ts +21 -0
  190. package/dist/internal/lead-status.d.ts +13 -0
  191. package/dist/internal/limits.d.ts +34 -0
  192. package/dist/internal/metrics.d.ts +64 -0
  193. package/dist/internal/native.d.ts +81 -0
  194. package/dist/internal/outbound/api.d.ts +292 -0
  195. package/dist/internal/outbound/collections.d.ts +31 -0
  196. package/dist/internal/outbound/core.d.ts +36 -0
  197. package/dist/internal/outbound/create.d.ts +16 -0
  198. package/dist/internal/outbound/handles.d.ts +7 -0
  199. package/dist/internal/outbound/native.d.ts +4 -0
  200. package/dist/internal/outbound/operation-shared.d.ts +28 -0
  201. package/dist/internal/outbound/operations-account.d.ts +41 -0
  202. package/dist/internal/outbound/operations.d.ts +42 -0
  203. package/dist/internal/outbound/outbound.d.ts +67 -0
  204. package/dist/internal/outbound/plugins.d.ts +40 -0
  205. package/dist/internal/outbound/raw.d.ts +9 -0
  206. package/dist/internal/outbound/specs-account.d.ts +20 -0
  207. package/dist/internal/outbound/specs.d.ts +14 -0
  208. package/dist/internal/outbound/stats.d.ts +7 -0
  209. package/dist/internal/outbound/validate.d.ts +5 -0
  210. package/dist/internal/outbound/walker.d.ts +22 -0
  211. package/dist/internal/page.d.ts +14 -0
  212. package/dist/internal/record.d.ts +36 -0
  213. package/dist/internal/records.d.ts +7 -0
  214. package/dist/internal/redact.d.ts +18 -0
  215. package/dist/internal/ref.d.ts +16 -0
  216. package/dist/internal/sequence.d.ts +14 -0
  217. package/dist/internal/sha256.d.ts +6 -0
  218. package/dist/internal/text.d.ts +11 -0
  219. package/dist/internal/url.d.ts +9 -0
  220. package/dist/loader/index.d.ts +24 -0
  221. package/dist/loader/index.js +16 -0
  222. package/dist/memory/account-reads.d.ts +5 -0
  223. package/dist/memory/account.d.ts +81 -0
  224. package/dist/memory/adapter.d.ts +16 -0
  225. package/dist/memory/data.d.ts +137 -0
  226. package/dist/memory/demo.d.ts +7 -0
  227. package/dist/memory/index.d.ts +5 -0
  228. package/dist/memory/index.js +867 -0
  229. package/dist/memory/stats.d.ts +6 -0
  230. package/dist/memory/store.d.ts +18 -0
  231. package/dist/providers/index.d.ts +22 -0
  232. package/dist/providers/index.js +10 -0
  233. package/dist/reconcile/index.d.ts +2 -0
  234. package/dist/reconcile/index.js +72 -0
  235. package/dist/reconcile/plugin.d.ts +55 -0
  236. package/dist/redact/index.d.ts +2 -0
  237. package/dist/redact/index.js +197 -0
  238. package/dist/redact/plugin.d.ts +22 -0
  239. package/dist/redis/index.d.ts +41 -0
  240. package/dist/redis/index.js +114 -0
  241. package/dist/smartlead/account.d.ts +5 -0
  242. package/dist/smartlead/adapter.d.ts +5 -0
  243. package/dist/smartlead/capabilities.d.ts +87 -0
  244. package/dist/smartlead/client.d.ts +18 -0
  245. package/dist/smartlead/hmac.d.ts +7 -0
  246. package/dist/smartlead/index.d.ts +24 -0
  247. package/dist/smartlead/index.js +2329 -0
  248. package/dist/smartlead/leads.d.ts +9 -0
  249. package/dist/smartlead/lookup.d.ts +8 -0
  250. package/dist/smartlead/mail.d.ts +5 -0
  251. package/dist/smartlead/map-account.d.ts +34 -0
  252. package/dist/smartlead/map-messages.d.ts +31 -0
  253. package/dist/smartlead/map-stats.d.ts +36 -0
  254. package/dist/smartlead/map.d.ts +62 -0
  255. package/dist/smartlead/native-analytics.d.ts +242 -0
  256. package/dist/smartlead/native-campaigns.d.ts +211 -0
  257. package/dist/smartlead/native-inbox.d.ts +141 -0
  258. package/dist/smartlead/native-params.d.ts +12 -0
  259. package/dist/smartlead/native-services.d.ts +204 -0
  260. package/dist/smartlead/native.d.ts +785 -0
  261. package/dist/smartlead/shared.d.ts +29 -0
  262. package/dist/smartlead/stats.d.ts +5 -0
  263. package/dist/smartlead/webhooks.d.ts +3 -0
  264. package/dist/sync/index.d.ts +2 -0
  265. package/dist/sync/index.js +158 -0
  266. package/dist/sync/plugin.d.ts +58 -0
  267. package/dist/tools/account-tools.d.ts +21 -0
  268. package/dist/tools/ai-sdk.d.ts +8 -0
  269. package/dist/tools/ai-sdk.js +28 -0
  270. package/dist/tools/campaign-tools.d.ts +59 -0
  271. package/dist/tools/claude-agent.d.ts +18 -0
  272. package/dist/tools/claude-agent.js +42 -0
  273. package/dist/tools/index.d.ts +28 -0
  274. package/dist/tools/index.js +22 -0
  275. package/dist/tools/people-tools.d.ts +19 -0
  276. package/dist/tools/registry.d.ts +34 -0
  277. package/dist/tools/shared.d.ts +75 -0
  278. package/dist/tracing/index.d.ts +25 -0
  279. package/dist/tracing/index.js +69 -0
  280. package/dist/webhooks/index.d.ts +3 -0
  281. package/dist/webhooks/index.js +227 -0
  282. package/dist/webhooks/parse.d.ts +41 -0
  283. package/dist/webhooks/secret.d.ts +4 -0
  284. package/package.json +181 -4
@@ -0,0 +1,9 @@
1
+ export declare const emailKey: (email: string | null) => string | null;
2
+ export declare const linkedinKey: (url: string | null) => string | null;
3
+ /** Every exact identifier a record carries. The first is its primary key. */
4
+ export declare const keysOf: (record: {
5
+ readonly email: string | null;
6
+ readonly linkedinUrl: string | null;
7
+ }) => string[];
8
+ /** Accepts a person key, an email address or a LinkedIn URL. */
9
+ export declare const toKey: (identifier: string) => string | null;
@@ -0,0 +1,34 @@
1
+ import type { Lead, Message } from "../internal/entities.ts";
2
+ import type { Include } from "../internal/outbound/api.ts";
3
+ import type { OutboundPlugin } from "../internal/outbound/plugins.ts";
4
+ export interface PersonLead extends Lead {
5
+ /** The lead's primary exact identifier, or `null` when it has none. */
6
+ readonly personKey: string | null;
7
+ /** Every exact identifier the lead carries. */
8
+ readonly personKeys: readonly string[];
9
+ }
10
+ export interface PersonOptions {
11
+ /** Look only in these campaigns (refs). Without it, the vendor is asked for the person when it can find one by identifier, and every lead is scanned otherwise. */
12
+ readonly campaignIds?: readonly string[] | undefined;
13
+ /** Leave the timeline out, which saves a request per matching record. */
14
+ readonly timeline?: boolean | undefined;
15
+ /** What to ask for on the timeline's messages, for example `["body"]`. */
16
+ readonly include?: readonly Include[] | undefined;
17
+ }
18
+ export interface Person {
19
+ /** The key that was looked up. */
20
+ readonly key: string;
21
+ /** Every exact identifier found on the matching records. */
22
+ readonly keys: readonly string[];
23
+ /** `false` when no record carries the key: the link is unknown, not absent. */
24
+ readonly found: boolean;
25
+ /** One record per tool or campaign the person is in. Linked, not merged. */
26
+ readonly records: readonly Lead[];
27
+ /** Every message to and from the person across tools, oldest first. */
28
+ readonly timeline: readonly Message[];
29
+ }
30
+ export interface IdentityExtension {
31
+ readonly person: (identifier: string, options?: PersonOptions) => Promise<Person>;
32
+ }
33
+ /** Links the same person across tools by exact identifier. */
34
+ export declare const identity: () => OutboundPlugin<IdentityExtension>;
@@ -0,0 +1,33 @@
1
+ export { createOutbound } from "./internal/outbound/create.ts";
2
+ export type { ExtensionsOf } from "./internal/outbound/create.ts";
3
+ export { Outbound } from "./internal/outbound/outbound.ts";
4
+ export type { OutboundOptions } from "./internal/outbound/outbound.ts";
5
+ export type { BulkOptions, BulkResult, CampaignFilters, CampaignHandle, Collection, Estimate, EstimateQuery, Include, LeadFilters, LeadHandle, ListAll, ListHandle, ListAllOptions, ListOptions, MessageFilters, NativeClient, NativeParams, NativeReads, NativeResult, OutboundApi, PageResult, RawClient, RawRequestOptions, ReadCollection, ReplyFilters, ResultMeta, SenderFilters, SenderHandle, StatsOptions, StatsResult, ThreadHandle, TopLevelStatsOptions, WebhookFilters, WithMeta, } from "./internal/outbound/api.ts";
6
+ export type { Operation, OperationKind, OperationOutput, OutboundRecord, } from "./internal/outbound/operations.ts";
7
+ export type { NextOperation, OperationInfo, OutboundPlugin, } from "./internal/outbound/plugins.ts";
8
+ export { makeErrorMapper, OutboundError } from "./internal/errors.ts";
9
+ export type { ErrorMapper, ErrorMapperOptions, HttpFailure, OutboundErrorCode, OutboundErrorOptions, } from "./internal/errors.ts";
10
+ export * from "./internal/records.ts";
11
+ export { defineNative } from "./internal/native.ts";
12
+ export type { NativeCatalog, NativeParam, NativeParamsOf, NativeRead, NoNative, } from "./internal/native.ts";
13
+ export { CAPABILITY_KEYS, intersectCapabilities, NO_CAPABILITIES, resolveCapabilities, } from "./internal/capabilities.ts";
14
+ export type { Capabilities, CapabilityDeclaration, CapabilityKey, FilterGrade, StatGrade, } from "./internal/capabilities.ts";
15
+ export type { Adapter, AdapterContext, CampaignQuery, EventFormat, HttpMethod, LeadQuery, Maturity, MessageQuery, OperationCost, Page, PageQuery, RawDescriptor, ReplyQuery, RequestSpec, SenderQuery, StatsQuery, TimeRange, VendorResponse, WebhookRequest, } from "./internal/adapter.ts";
16
+ export { MemoryRateLimitStore } from "./internal/engine/rate-store.ts";
17
+ export type { RateLimitStore } from "./internal/engine/rate-store.ts";
18
+ export type { LimitsSnapshot, OperationOptions, } from "./internal/engine/engine.ts";
19
+ export type { BudgetWindowUsage } from "./internal/engine/budget.ts";
20
+ export { fullJitterBackoff } from "./internal/engine/retry.ts";
21
+ export type { RetriesOption, RetryPolicy } from "./internal/engine/retry.ts";
22
+ export type { Runtime } from "./internal/engine/runtime.ts";
23
+ export { DEFAULT_SHARE } from "./internal/limits.ts";
24
+ export type { LimitDeclaration, RateLimitHeaders, RateWindow, } from "./internal/limits.ts";
25
+ export type { ActionEvent, ErrorEvent, OutboundHooks, RequestEvent, RetryEvent, ThrottleEvent, } from "./internal/hooks.ts";
26
+ export { computeRates, emptyCounts, METRIC_DEFINITIONS, sumCounts, } from "./internal/metrics.ts";
27
+ export type { MetricCounts, MetricDefinition, MetricName, Rate, } from "./internal/metrics.ts";
28
+ export { makeRef, parseRef } from "./internal/ref.ts";
29
+ export { profileSlug } from "./internal/url.ts";
30
+ export type { RefParts } from "./internal/ref.ts";
31
+ export { REDACTED_EMAIL, REDACTED_KEY, redactText } from "./internal/redact.ts";
32
+ export { sha256Hex, stableId } from "./internal/sha256.ts";
33
+ export type { Json, JsonObject } from "./internal/json.ts";
package/dist/index.js ADDED
@@ -0,0 +1,131 @@
1
+ import {
2
+ DEFAULT_SHARE,
3
+ Outbound,
4
+ createOutbound,
5
+ fullJitterBackoff
6
+ } from "./chunks/chunk-XNFESPZH.js";
7
+ import {
8
+ MemoryRateLimitStore
9
+ } from "./chunks/chunk-4O2HRTTI.js";
10
+ import {
11
+ defineNative
12
+ } from "./chunks/chunk-NAKXLBA6.js";
13
+ import {
14
+ METRIC_DEFINITIONS,
15
+ computeRates,
16
+ emptyCounts,
17
+ sumCounts
18
+ } from "./chunks/chunk-YOTW5ESM.js";
19
+ import {
20
+ profileSlug
21
+ } from "./chunks/chunk-NAWZ73QS.js";
22
+ import {
23
+ sha256Hex,
24
+ stableId
25
+ } from "./chunks/chunk-FHKSLCVW.js";
26
+ import {
27
+ CAPABILITY_KEYS,
28
+ NO_CAPABILITIES,
29
+ blockEntrySchema,
30
+ campaignProgressSchema,
31
+ campaignSettingsSchema,
32
+ intersectCapabilities,
33
+ leadListSchema,
34
+ placementTestSchema,
35
+ resolveCapabilities,
36
+ resolveFields,
37
+ senderHealthSchema,
38
+ tagSchema,
39
+ webhookSubscriptionSchema
40
+ } from "./chunks/chunk-UAT3JSJZ.js";
41
+ import {
42
+ SCHEMA_VERSION,
43
+ campaignSchema,
44
+ campaignStatusSchema,
45
+ channelSchema,
46
+ eventDataSchema,
47
+ eventTypeSchema,
48
+ evidenceSchema,
49
+ leadProgressSchema,
50
+ leadSchema,
51
+ leadStatusSchema,
52
+ mailProviderSchema,
53
+ messageSchema,
54
+ metricRowSchema,
55
+ metricScopeSchema,
56
+ outboundEventSchema,
57
+ replyCategorySchema,
58
+ replySchema,
59
+ senderSchema,
60
+ senderStatusSchema,
61
+ sequenceSchema,
62
+ workspaceSchema
63
+ } from "./chunks/chunk-4PSO6JEK.js";
64
+ import {
65
+ makeRef,
66
+ parseRef
67
+ } from "./chunks/chunk-LVYG7XZJ.js";
68
+ import {
69
+ OutboundError,
70
+ REDACTED_EMAIL,
71
+ REDACTED_KEY,
72
+ makeErrorMapper,
73
+ redactText
74
+ } from "./chunks/chunk-E7JHLNLG.js";
75
+ import "./chunks/chunk-VQSCHOBV.js";
76
+ export {
77
+ CAPABILITY_KEYS,
78
+ DEFAULT_SHARE,
79
+ METRIC_DEFINITIONS,
80
+ MemoryRateLimitStore,
81
+ NO_CAPABILITIES,
82
+ Outbound,
83
+ OutboundError,
84
+ REDACTED_EMAIL,
85
+ REDACTED_KEY,
86
+ SCHEMA_VERSION,
87
+ blockEntrySchema,
88
+ campaignProgressSchema,
89
+ campaignSchema,
90
+ campaignSettingsSchema,
91
+ campaignStatusSchema,
92
+ channelSchema,
93
+ computeRates,
94
+ createOutbound,
95
+ defineNative,
96
+ emptyCounts,
97
+ eventDataSchema,
98
+ eventTypeSchema,
99
+ evidenceSchema,
100
+ fullJitterBackoff,
101
+ intersectCapabilities,
102
+ leadListSchema,
103
+ leadProgressSchema,
104
+ leadSchema,
105
+ leadStatusSchema,
106
+ mailProviderSchema,
107
+ makeErrorMapper,
108
+ makeRef,
109
+ messageSchema,
110
+ metricRowSchema,
111
+ metricScopeSchema,
112
+ outboundEventSchema,
113
+ parseRef,
114
+ placementTestSchema,
115
+ profileSlug,
116
+ redactText,
117
+ replyCategorySchema,
118
+ replySchema,
119
+ resolveCapabilities,
120
+ resolveFields,
121
+ senderHealthSchema,
122
+ senderSchema,
123
+ senderStatusSchema,
124
+ sequenceSchema,
125
+ sha256Hex,
126
+ stableId,
127
+ sumCounts,
128
+ tagSchema,
129
+ webhookSubscriptionSchema,
130
+ workspaceSchema
131
+ };
@@ -0,0 +1,55 @@
1
+ import type { CheckName, Severity } from "./copy-checks.ts";
2
+ export interface CopyFinding {
3
+ /** Counted from 0. */
4
+ readonly step: number;
5
+ readonly variantKey: string;
6
+ readonly action: string;
7
+ readonly check: CheckName;
8
+ readonly severity: Severity;
9
+ readonly finding: string;
10
+ /** The text that triggered the check. */
11
+ readonly text: string;
12
+ }
13
+ export interface CheckCount {
14
+ readonly check: CheckName;
15
+ readonly severity: Severity;
16
+ readonly count: number;
17
+ }
18
+ export interface CopyAudit {
19
+ readonly campaign: string;
20
+ readonly channel: "email" | "linkedin";
21
+ /** `true` when no check found anything in the copy that could be read. */
22
+ readonly clean: boolean;
23
+ /** High severity first, then by step and variant. */
24
+ readonly findings: readonly CopyFinding[];
25
+ /** Every check that was run, with how often it fired. */
26
+ readonly byCheck: readonly CheckCount[];
27
+ readonly bySeverity: {
28
+ readonly high: number;
29
+ readonly medium: number;
30
+ readonly low: number;
31
+ };
32
+ readonly stepsChecked: number;
33
+ readonly variantsChecked: number;
34
+ /** Variants whose body the vendor did not return; their body checks were skipped. */
35
+ readonly variantsWithoutBody: number;
36
+ }
37
+ export declare const copyAudit: import("../define.ts").InsightDefinition<"copyAudit", {
38
+ campaign: string;
39
+ max_body_words: number;
40
+ max_caps_words: number;
41
+ max_connection_chars: number;
42
+ max_exclamations: number;
43
+ max_links: number;
44
+ max_subject_chars: number;
45
+ spam_words: string[];
46
+ }, CopyAudit, {
47
+ campaign: string;
48
+ max_body_words?: number | undefined;
49
+ max_caps_words?: number | undefined;
50
+ max_connection_chars?: number | undefined;
51
+ max_exclamations?: number | undefined;
52
+ max_links?: number | undefined;
53
+ max_subject_chars?: number | undefined;
54
+ spam_words?: string[] | undefined;
55
+ }>;
@@ -0,0 +1,44 @@
1
+ export type Severity = "high" | "low" | "medium";
2
+ export declare const CHECKS: {
3
+ readonly all_caps: "low";
4
+ readonly body_too_long: "low";
5
+ readonly connection_request_too_long: "high";
6
+ readonly exclamation_marks: "low";
7
+ readonly image: "medium";
8
+ readonly malformed_variable: "high";
9
+ readonly missing_subject: "high";
10
+ readonly spam_words: "medium";
11
+ readonly subject_breaks_thread: "medium";
12
+ readonly subject_too_long: "low";
13
+ readonly too_many_links: "medium";
14
+ };
15
+ export type CheckName = keyof typeof CHECKS;
16
+ export interface Problem {
17
+ readonly check: CheckName;
18
+ /** What is wrong, in plain words, with the number behind it. */
19
+ readonly finding: string;
20
+ /** The text that triggered the check. */
21
+ readonly text: string;
22
+ }
23
+ export interface Limits {
24
+ readonly maxSubjectChars: number;
25
+ readonly maxBodyWords: number;
26
+ readonly maxLinks: number;
27
+ readonly maxCapsWords: number;
28
+ readonly maxExclamations: number;
29
+ readonly maxConnectionChars: number;
30
+ readonly spamWords: readonly string[];
31
+ }
32
+ /** Words and phrases that spam filters weigh. A caller can replace the list. */
33
+ export declare const DEFAULT_SPAM_WORDS: readonly ["100% free", "act now", "buy now", "cash bonus", "click here", "double your", "earn money", "free trial", "guarantee", "limited time", "no obligation", "risk-free", "urgent", "winner"];
34
+ export declare const subjectTooLong: (subject: string, limits: Limits) => Problem | null;
35
+ export declare const bodyTooLong: (body: string, limits: Limits) => Problem | null;
36
+ export declare const tooManyLinks: (body: string, limits: Limits) => Problem | null;
37
+ export declare const spamWords: (text: string, limits: Limits) => Problem | null;
38
+ export declare const malformedVariable: (text: string) => Problem | null;
39
+ export declare const allCaps: (text: string, limits: Limits) => Problem | null;
40
+ export declare const exclamationMarks: (text: string, limits: Limits) => Problem | null;
41
+ export declare const image: (body: string) => Problem | null;
42
+ /** A subject as the thread sees it: no `Re:` and no case. */
43
+ export declare const threadKey: (subject: string | null) => string;
44
+ export declare const connectionTooLong: (body: string, limits: Limits) => Problem | null;
@@ -0,0 +1,59 @@
1
+ import type { Interval } from "../stats.ts";
2
+ export interface CopyUse {
3
+ readonly campaign: string;
4
+ readonly campaignName: string;
5
+ readonly provider: string;
6
+ /** Where the copy sits in the campaign, as `step:variant` with steps counted from 0. */
7
+ readonly places: readonly string[];
8
+ readonly sent: number | null;
9
+ readonly replies: number | null;
10
+ /** What the rate is divided by. `null` when the vendor reports no counts for this copy. */
11
+ readonly trials: number | null;
12
+ readonly replyRate: number | null;
13
+ readonly replyRateInterval: Interval | null;
14
+ }
15
+ export interface CopyPiece {
16
+ readonly contentHash: string;
17
+ readonly subject: string | null;
18
+ /** The first 120 characters of the body. */
19
+ readonly bodyPreview: string | null;
20
+ readonly campaigns: number;
21
+ readonly sent: number | null;
22
+ readonly replies: number | null;
23
+ readonly trials: number | null;
24
+ /** Replies over the base, added up across campaigns. */
25
+ readonly replyRate: number | null;
26
+ readonly replyRateInterval: Interval | null;
27
+ }
28
+ export interface ReusedCopy extends CopyPiece {
29
+ /** Best reply rate first; a campaign with no known rate is last. */
30
+ readonly uses: readonly CopyUse[];
31
+ /** Best minus worst reply rate among campaigns with a base of `min_sent`. `null` with fewer than two such campaigns. */
32
+ readonly spread: number | null;
33
+ readonly best: string | null;
34
+ readonly worst: string | null;
35
+ /** Two-sided p-value of best against worst. `null` when there is no spread or both rates are 0. */
36
+ readonly spreadPValue: number | null;
37
+ /** `true` when the spread is more than chance at the usual 0.05 bar. */
38
+ readonly spreadIsReal: boolean | null;
39
+ readonly finding: string;
40
+ }
41
+ export interface CopyReuse {
42
+ /** Copy used in two or more campaigns, widest spread first. */
43
+ readonly reused: readonly ReusedCopy[];
44
+ /** The copy with the highest pooled reply rate among those with a base of `min_sent`. `null` when none has. */
45
+ readonly bestCopy: CopyPiece | null;
46
+ readonly campaignsRead: number;
47
+ readonly piecesOfCopy: number;
48
+ /** Variants whose counts the vendor does not split out, so their copy has no numbers. */
49
+ readonly variantsWithoutStats: number;
50
+ }
51
+ export declare const copyReuse: import("../define.ts").InsightDefinition<"copyReuse", {
52
+ max_campaigns: number;
53
+ min_sent: number;
54
+ statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
55
+ }, CopyReuse, {
56
+ max_campaigns?: number | undefined;
57
+ min_sent?: number | undefined;
58
+ statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
59
+ }>;
@@ -0,0 +1,67 @@
1
+ export declare const COPY_INSIGHTS: readonly [import("../define.ts").InsightDefinition<"stepFunnel", {
2
+ campaign: string;
3
+ from: string | null;
4
+ min_reply_rate: number;
5
+ to: string | null;
6
+ }, import("./step-funnel.ts").StepFunnel, {
7
+ campaign: string;
8
+ from?: string | null | undefined;
9
+ min_reply_rate?: number | undefined;
10
+ to?: string | null | undefined;
11
+ }>, import("../define.ts").InsightDefinition<"variantTest", {
12
+ alpha: number;
13
+ campaign: string;
14
+ from: string | null;
15
+ metric: "positive" | "replied" | "clicked" | "opened";
16
+ min_sent: number;
17
+ to: string | null;
18
+ }, import("./variant-test.ts").VariantTest, {
19
+ campaign: string;
20
+ alpha?: number | undefined;
21
+ from?: string | null | undefined;
22
+ metric?: "positive" | "replied" | "clicked" | "opened" | undefined;
23
+ min_sent?: number | undefined;
24
+ to?: string | null | undefined;
25
+ }>, import("../define.ts").InsightDefinition<"copyAudit", {
26
+ campaign: string;
27
+ max_body_words: number;
28
+ max_caps_words: number;
29
+ max_connection_chars: number;
30
+ max_exclamations: number;
31
+ max_links: number;
32
+ max_subject_chars: number;
33
+ spam_words: string[];
34
+ }, import("./copy-audit.ts").CopyAudit, {
35
+ campaign: string;
36
+ max_body_words?: number | undefined;
37
+ max_caps_words?: number | undefined;
38
+ max_connection_chars?: number | undefined;
39
+ max_exclamations?: number | undefined;
40
+ max_links?: number | undefined;
41
+ max_subject_chars?: number | undefined;
42
+ spam_words?: string[] | undefined;
43
+ }>, import("../define.ts").InsightDefinition<"copyReuse", {
44
+ max_campaigns: number;
45
+ min_sent: number;
46
+ statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
47
+ }, import("./copy-reuse.ts").CopyReuse, {
48
+ max_campaigns?: number | undefined;
49
+ min_sent?: number | undefined;
50
+ statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
51
+ }>, import("../define.ts").InsightDefinition<"replyTiming", {
52
+ campaign: string | null;
53
+ max_messages: number;
54
+ since: string | null;
55
+ timezone_offset_minutes: number;
56
+ }, import("./reply-timing.ts").ReplyTiming, {
57
+ campaign?: string | null | undefined;
58
+ max_messages?: number | undefined;
59
+ since?: string | null | undefined;
60
+ timezone_offset_minutes?: number | undefined;
61
+ }>];
62
+ export type { CheckName, Severity } from "./copy-checks.ts";
63
+ export type { CheckCount, CopyAudit, CopyFinding } from "./copy-audit.ts";
64
+ export type { CopyPiece, CopyReuse, CopyUse, ReusedCopy, } from "./copy-reuse.ts";
65
+ export type { HourCount, ReplyTiming, TimeTable, WeekdayCount, } from "./reply-timing.ts";
66
+ export type { FunnelStep, FunnelVariant, StepFunnel } from "./step-funnel.ts";
67
+ export type { TestedVariant, VariantStepTest, VariantTest, VariantVerdict, } from "./variant-test.ts";
@@ -0,0 +1,63 @@
1
+ declare const WEEKDAYS: readonly ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
2
+ export interface WeekdayCount {
3
+ readonly weekday: (typeof WEEKDAYS)[number];
4
+ readonly count: number;
5
+ readonly share: number | null;
6
+ }
7
+ export interface HourCount {
8
+ /** 0 to 23, in the given offset. */
9
+ readonly hour: number;
10
+ readonly count: number;
11
+ readonly share: number | null;
12
+ }
13
+ export interface TimeTable {
14
+ /** Monday first. */
15
+ readonly byWeekday: readonly WeekdayCount[];
16
+ /** Hour 0 to hour 23. */
17
+ readonly byHour: readonly HourCount[];
18
+ /** The weekday with the most. `null` when there is nothing to count. */
19
+ readonly topWeekday: string | null;
20
+ readonly topHour: number | null;
21
+ }
22
+ export interface ReplyTiming {
23
+ readonly campaign: string | null;
24
+ readonly since: string;
25
+ readonly timezoneOffsetMinutes: number;
26
+ readonly timeToReply: {
27
+ /** Replies paired with the message they answer. Every figure below rests on this many. */
28
+ readonly sample: number;
29
+ readonly medianHours: number | null;
30
+ readonly p75Hours: number | null;
31
+ readonly p90Hours: number | null;
32
+ /** Share of paired replies that came within the hour. */
33
+ readonly within1Hour: number | null;
34
+ readonly within24Hours: number | null;
35
+ readonly within72Hours: number | null;
36
+ };
37
+ /** When replies arrive, over every reply with a time. */
38
+ readonly replies: TimeTable;
39
+ /** When the sends that drew a reply went out, over the paired replies. */
40
+ readonly sendsThatDrewReplies: TimeTable;
41
+ readonly counts: {
42
+ readonly messagesRead: number;
43
+ readonly sent: number;
44
+ readonly received: number;
45
+ readonly paired: number;
46
+ /** A further message from someone who had already replied, before anything new was sent. Not timed. */
47
+ readonly followOnReplies: number;
48
+ /** Replies with no earlier send in what was read, no thread or lead to match on, or no time. */
49
+ readonly unpaired: number;
50
+ };
51
+ }
52
+ export declare const replyTiming: import("../define.ts").InsightDefinition<"replyTiming", {
53
+ campaign: string | null;
54
+ max_messages: number;
55
+ since: string | null;
56
+ timezone_offset_minutes: number;
57
+ }, ReplyTiming, {
58
+ campaign?: string | null | undefined;
59
+ max_messages?: number | undefined;
60
+ since?: string | null | undefined;
61
+ timezone_offset_minutes?: number | undefined;
62
+ }>;
63
+ export {};
@@ -0,0 +1,53 @@
1
+ import { z } from "zod";
2
+ import type { Campaign, CampaignStatus, MetricRow } from "../../internal/entities.ts";
3
+ import type { MetricCounts } from "../../internal/metrics.ts";
4
+ import type { ListAll } from "../../internal/outbound/api.ts";
5
+ import type { InsightContext } from "../define.ts";
6
+ import type { Interval } from "../stats.ts";
7
+ /** A `YYYY-MM-DD` input that defaults to `null`, meaning no bound. */
8
+ export declare const dayInput: (description: string) => z.ZodDefault<z.ZodNullable<z.ZodString>>;
9
+ export interface DayRange {
10
+ readonly from: string | undefined;
11
+ readonly to: string | undefined;
12
+ }
13
+ export declare const rangeOf: (from: string | null, to: string | null) => DayRange;
14
+ /** Reads a listing up to `max` records; a listing that holds more is reported as cut off. */
15
+ export declare const readCapped: <Item>(context: InsightContext, walk: (max: number) => ListAll<Item>, max: number) => Promise<Item[]>;
16
+ /** The campaigns in the given statuses, up to `max` in all. */
17
+ export declare const campaignsIn: (context: InsightContext, statuses: readonly CampaignStatus[], max: number) => Promise<Campaign[]>;
18
+ export type RateBasis = "contacted" | "delivered" | "sent";
19
+ export interface Base {
20
+ /** What the rate is divided by. `null` when the vendor reports no base. */
21
+ readonly trials: number | null;
22
+ readonly basis: RateBasis | null;
23
+ }
24
+ /** Replies are counted per lead contacted, or per message sent when the vendor reports no leads. */
25
+ export declare const perLead: (counts: MetricCounts) => Base;
26
+ /** Opens and clicks are counted per message delivered, or per message sent. */
27
+ export declare const perMessage: (counts: MetricCounts) => Base;
28
+ export interface Measured {
29
+ readonly count: number | null;
30
+ readonly trials: number | null;
31
+ readonly basis: RateBasis | null;
32
+ readonly rate: number | null;
33
+ /** The 95% Wilson interval of the rate. `null` when the rate is unknown. */
34
+ readonly interval: Interval | null;
35
+ }
36
+ export declare const measure: (count: number | null, base: Base) => Measured;
37
+ /** Adds rows of counts; a count no row reports stays `null`. */
38
+ export declare const sumRows: (rows: readonly MetricRow[]) => MetricCounts;
39
+ /** Groups values by a key, in first-seen order. */
40
+ export declare const groupBy: <Value, Key>(values: readonly Value[], keyOf: (value: Value) => Key) => Map<Key, Value[]>;
41
+ export interface StepStats {
42
+ /** The step's own total: its step-level rows, or its variant rows added up. */
43
+ readonly total: MetricCounts | null;
44
+ /** Counts per variant key, when the vendor splits the step by variant. */
45
+ readonly variants: ReadonlyMap<string, MetricCounts>;
46
+ }
47
+ export interface SplitStats {
48
+ readonly steps: ReadonlyMap<number, StepStats>;
49
+ /** Rows the vendor tied to no step. */
50
+ readonly unattributed: readonly MetricRow[];
51
+ }
52
+ /** Sorts step stats rows into steps and their variants. */
53
+ export declare const splitStats: (rows: readonly MetricRow[]) => SplitStats;
@@ -0,0 +1,66 @@
1
+ import type { Interval } from "../stats.ts";
2
+ import type { RateBasis } from "./shared.ts";
3
+ export interface FunnelVariant {
4
+ readonly variantKey: string;
5
+ /** The hash of the variant's current copy. `null` when the sequence no longer has the variant. */
6
+ readonly contentHash: string | null;
7
+ readonly sent: number | null;
8
+ readonly replies: number | null;
9
+ readonly replyRate: number | null;
10
+ readonly replyRateInterval: Interval | null;
11
+ }
12
+ export interface FunnelStep {
13
+ /** Counted from 0. */
14
+ readonly step: number;
15
+ /** `null` when the stats name a step the sequence no longer has. */
16
+ readonly action: string | null;
17
+ readonly delayDays: number | null;
18
+ readonly inSequence: boolean;
19
+ readonly sent: number | null;
20
+ readonly replies: number | null;
21
+ /** Replies divided by `replyRateBasis`. `null` when either count is unknown. */
22
+ readonly replyRate: number | null;
23
+ readonly replyRateInterval: Interval | null;
24
+ readonly replyRateBasis: RateBasis | null;
25
+ /** This step's replies divided by every reply in the campaign, unattributed ones included. */
26
+ readonly shareOfReplies: number | null;
27
+ /** Sends of the step before minus this step's sends. `null` for the first step or an unknown count. */
28
+ readonly sentDrop: number | null;
29
+ /** `sentDrop` divided by the sends of the step before. */
30
+ readonly sentDropRate: number | null;
31
+ /** `true` when the low end of the reply rate interval is above `min_reply_rate`. `null` when the rate is unknown. */
32
+ readonly earnsPlace: boolean | null;
33
+ /** Empty when the vendor does not split step stats by variant. */
34
+ readonly variants: readonly FunnelVariant[];
35
+ }
36
+ export interface StepFunnel {
37
+ readonly campaign: string;
38
+ /** What the numbers say, in one or two sentences. */
39
+ readonly finding: string;
40
+ /** The step with the most replies. `null` when no step has a reply. */
41
+ readonly topStep: number | null;
42
+ /** The last step whose reply rate is reliably above `min_reply_rate`. `null` when none is. */
43
+ readonly lastStepEarningPlace: number | null;
44
+ readonly steps: readonly FunnelStep[];
45
+ readonly totals: {
46
+ readonly sent: number | null;
47
+ readonly replies: number | null;
48
+ };
49
+ /** Counts the vendor tied to no step. They are in no step's row. */
50
+ readonly unattributed: {
51
+ readonly rows: number;
52
+ readonly sent: number | null;
53
+ readonly replies: number | null;
54
+ };
55
+ }
56
+ export declare const stepFunnel: import("../define.ts").InsightDefinition<"stepFunnel", {
57
+ campaign: string;
58
+ from: string | null;
59
+ min_reply_rate: number;
60
+ to: string | null;
61
+ }, StepFunnel, {
62
+ campaign: string;
63
+ from?: string | null | undefined;
64
+ min_reply_rate?: number | undefined;
65
+ to?: string | null | undefined;
66
+ }>;