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,260 @@
1
+ import {
2
+ profileSlug
3
+ } from "../chunks/chunk-NAWZ73QS.js";
4
+ import {
5
+ stableId
6
+ } from "../chunks/chunk-FHKSLCVW.js";
7
+ import {
8
+ evidenceSchema
9
+ } from "../chunks/chunk-4PSO6JEK.js";
10
+ import {
11
+ makeRef,
12
+ parseRef
13
+ } from "../chunks/chunk-LVYG7XZJ.js";
14
+ import {
15
+ OutboundError
16
+ } from "../chunks/chunk-E7JHLNLG.js";
17
+ import {
18
+ field,
19
+ objects,
20
+ parseJson,
21
+ toJson
22
+ } from "../chunks/chunk-VQSCHOBV.js";
23
+
24
+ // src/fixtures/index.ts
25
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
26
+ import path from "node:path";
27
+
28
+ // src/fixtures/scrub.ts
29
+ var FORMAT = {
30
+ campaign: (index) => `Campaign ${index}`,
31
+ company: (index) => `Company ${index}`,
32
+ email: (index) => `person${index}@example.com`,
33
+ linkedin: (index) => `https://www.linkedin.com/in/example-person-${index}`,
34
+ person: (index) => `Person ${index}`,
35
+ value: (index) => `value-${index}`,
36
+ workspace: (index) => `Workspace ${index}`
37
+ };
38
+ var isAccountRecord = (record) => "steps" in record || "description" in record || "inProgress" in record || "nextRunAt" in record || "schedule" in record || "dns" in record || "value" in record || "size" in record || "url" in record;
39
+ var accountRecord = ({ base, placeholder, scrubRef }, record) => {
40
+ if ("steps" in record || "description" in record) {
41
+ return base(record);
42
+ }
43
+ if ("schedule" in record || "inProgress" in record) {
44
+ return {
45
+ ...base(record),
46
+ campaignRef: scrubRef(record.campaignRef) ?? record.campaignRef
47
+ };
48
+ }
49
+ if ("nextRunAt" in record) {
50
+ return {
51
+ ...base(record),
52
+ campaignRef: scrubRef(record.campaignRef),
53
+ name: placeholder("value", record.name) ?? record.name
54
+ };
55
+ }
56
+ if ("dns" in record) {
57
+ return {
58
+ ...base(record),
59
+ domain: record.domain === null ? null : "example.com",
60
+ senderRef: scrubRef(record.senderRef) ?? record.senderRef
61
+ };
62
+ }
63
+ if ("value" in record) {
64
+ return {
65
+ ...base(record),
66
+ value: placeholder("value", record.value) ?? record.value
67
+ };
68
+ }
69
+ if ("size" in record) {
70
+ return {
71
+ ...base(record),
72
+ name: placeholder("value", record.name) ?? record.name
73
+ };
74
+ }
75
+ return {
76
+ ...base(record),
77
+ campaignRefs: record.campaignRefs.map((ref) => scrubRef(ref) ?? ref),
78
+ name: placeholder("value", record.name),
79
+ url: "https://example.com/webhook"
80
+ };
81
+ };
82
+ var standIn = (value, fake) => value === null ? null : fake;
83
+ var leadRecord = ({ base, placeholder }, record) => ({
84
+ ...base(record),
85
+ company: placeholder("company", record.company),
86
+ companyLinkedinUrl: standIn(
87
+ record.companyLinkedinUrl,
88
+ "https://www.linkedin.com/company/example-co"
89
+ ),
90
+ custom: Object.fromEntries(
91
+ Object.entries(record.custom).map(([key, value]) => [
92
+ key,
93
+ placeholder("value", value) ?? ""
94
+ ])
95
+ ),
96
+ email: placeholder("email", record.email),
97
+ firstName: standIn(record.firstName, "Person"),
98
+ lastName: placeholder("person", record.lastName)?.replace("Person ", "") ?? null,
99
+ linkedinUrl: placeholder("linkedin", record.linkedinUrl),
100
+ location: standIn(record.location, "Example City"),
101
+ phone: standIn(record.phone, "+15550000000"),
102
+ website: standIn(record.website, "https://example.com")
103
+ });
104
+ var withPersonKeys = (original, scrubbed) => {
105
+ if (!("personKeys" in original)) {
106
+ return scrubbed;
107
+ }
108
+ const slug = profileSlug(scrubbed.linkedinUrl);
109
+ const personKeys = [
110
+ scrubbed.email === null ? null : `email:${scrubbed.email}`,
111
+ slug === null ? null : `linkedin:${slug}`
112
+ ].filter((key) => key !== null);
113
+ return { ...scrubbed, personKey: personKeys[0] ?? null, personKeys };
114
+ };
115
+ var createScrubber = () => {
116
+ const seen = /* @__PURE__ */ new Map();
117
+ const counters = /* @__PURE__ */ new Map();
118
+ const placeholder = (kind, value) => {
119
+ if (value === null) {
120
+ return null;
121
+ }
122
+ const key = `${kind}:${value.toLowerCase()}`;
123
+ const known = seen.get(key);
124
+ if (known !== void 0) {
125
+ return known;
126
+ }
127
+ const index = (counters.get(kind) ?? 0) + 1;
128
+ counters.set(kind, index);
129
+ const made = FORMAT[kind](index);
130
+ seen.set(key, made);
131
+ return made;
132
+ };
133
+ const scrubId = (id) => {
134
+ if (profileSlug(id) !== null) {
135
+ return placeholder("linkedin", id) ?? id;
136
+ }
137
+ return id.includes("@") ? placeholder("email", id) ?? id : id;
138
+ };
139
+ const scrubRef = (ref) => {
140
+ const parts = ref === null ? null : parseRef(ref);
141
+ return parts === null ? ref : makeRef(parts.provider, parts.workspaceId, scrubId(parts.sourceId));
142
+ };
143
+ const base = (item) => ({
144
+ ...item,
145
+ raw: null,
146
+ ref: scrubRef(item.ref) ?? item.ref,
147
+ sourceId: scrubId(item.sourceId)
148
+ });
149
+ return {
150
+ record: (record) => {
151
+ if ("scope" in record) {
152
+ return {
153
+ ...record,
154
+ scopeRef: scrubRef(record.scopeRef) ?? record.scopeRef
155
+ };
156
+ }
157
+ if ("direction" in record) {
158
+ return {
159
+ ...base(record),
160
+ bodyHtml: null,
161
+ bodyText: record.bodyText === null ? null : "[body]",
162
+ leadRef: scrubRef(record.leadRef),
163
+ senderRef: scrubRef(record.senderRef),
164
+ subject: record.subject === null ? null : "[subject]"
165
+ };
166
+ }
167
+ if ("custom" in record) {
168
+ return withPersonKeys(
169
+ record,
170
+ leadRecord({ base, placeholder, scrubRef }, record)
171
+ );
172
+ }
173
+ if (isAccountRecord(record)) {
174
+ return accountRecord({ base, placeholder, scrubRef }, record);
175
+ }
176
+ if ("kind" in record) {
177
+ return {
178
+ ...base(record),
179
+ address: placeholder("email", record.address),
180
+ linkedinUrl: placeholder("linkedin", record.linkedinUrl),
181
+ name: placeholder("person", record.name)
182
+ };
183
+ }
184
+ if ("tags" in record) {
185
+ return {
186
+ ...base(record),
187
+ name: placeholder("campaign", record.name) ?? record.name
188
+ };
189
+ }
190
+ return {
191
+ ...base(record),
192
+ name: placeholder("workspace", record.name) ?? record.name
193
+ };
194
+ }
195
+ };
196
+ };
197
+
198
+ // src/fixtures/index.ts
199
+ var fileSafe = (label) => label.replaceAll(/[^\w.-]+/gu, "_");
200
+ var fixtureFile = (dir, scope, operation) => path.join(
201
+ dir,
202
+ `${fileSafe(scope.provider)}.${fileSafe(scope.workspaceId)}.${operation.kind}.${stableId(scope.workspaceId, JSON.stringify(operation)).slice(0, 12)}.json`
203
+ );
204
+ var load = async (file) => {
205
+ let source;
206
+ try {
207
+ source = await readFile(file, "utf-8");
208
+ } catch {
209
+ return void 0;
210
+ }
211
+ const parsed = parseJson(source);
212
+ const evidence = evidenceSchema.safeParse(field(parsed, "evidence"));
213
+ if (parsed === void 0 || !evidence.success) {
214
+ throw new OutboundError(
215
+ "Invalid",
216
+ `The fixture ${file} is not a recorded operation`
217
+ );
218
+ }
219
+ return {
220
+ evidence: evidence.data,
221
+ // SAFETY: written by this plugin from an OperationOutput; the wrapper re-validates every record against its schema.
222
+ items: objects(field(parsed, "items")),
223
+ next: field(parsed, "next") ?? void 0
224
+ };
225
+ };
226
+ var fixtures = (options) => {
227
+ const mode = options.mode ?? "auto";
228
+ const scrubber = createScrubber();
229
+ return {
230
+ name: "fixtures",
231
+ wrap: async (operation, next, info) => {
232
+ const file = fixtureFile(options.dir, info, operation);
233
+ const saved = mode === "record" ? void 0 : await load(file);
234
+ if (saved !== void 0) {
235
+ return saved;
236
+ }
237
+ if (mode === "replay") {
238
+ throw new OutboundError(
239
+ "NotFound",
240
+ `No fixture was recorded for ${operation.kind} (${path.basename(file)})`,
241
+ { provider: info.provider }
242
+ );
243
+ }
244
+ const output = await next(operation);
245
+ const kept = options.scrub === false ? output : {
246
+ ...output,
247
+ items: output.items.map((record) => scrubber.record(record))
248
+ };
249
+ await mkdir(options.dir, { recursive: true });
250
+ await writeFile(file, `${JSON.stringify(toJson(kept), null, 2)}
251
+ `);
252
+ return kept;
253
+ }
254
+ };
255
+ };
256
+ export {
257
+ createScrubber,
258
+ fixtureFile,
259
+ fixtures
260
+ };
@@ -0,0 +1,5 @@
1
+ import type { OutboundRecord } from "../internal/outbound/operations.ts";
2
+ export interface Scrubber {
3
+ readonly record: (record: OutboundRecord) => OutboundRecord;
4
+ }
5
+ export declare const createScrubber: () => Scrubber;
@@ -0,0 +1,11 @@
1
+ import type { Adapter, AdapterContext, Page, SenderQuery } from "../internal/adapter.ts";
2
+ import type { Sender } from "../internal/entities.ts";
3
+ import type { HeyReachClient } from "./client.ts";
4
+ type AccountReaders = Required<Pick<Adapter, "getCampaignProgress" | "getList" | "getSenderHealth" | "getWebhook" | "listBlocklist" | "listLists" | "listWebhooks">>;
5
+ /** Lists, blacklist, webhooks and sender health. */
6
+ export declare const accountReaders: (client: HeyReachClient) => AccountReaders;
7
+ /** The LinkedIn accounts attached to one campaign. */
8
+ export declare const campaignSenders: (client: HeyReachClient, ctx: AdapterContext, query: SenderQuery & {
9
+ readonly campaignId: string;
10
+ }) => Promise<Page<Sender>>;
11
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { Adapter } from "../internal/adapter.ts";
2
+ import type { HeyReachClient } from "./client.ts";
3
+ type Readers = Pick<Adapter, "getCampaign" | "getCampaignProgress" | "getLead" | "getList" | "getSender" | "getSenderHealth" | "getSequence" | "getWebhook" | "listBlocklist" | "listCampaigns" | "listLeads" | "listLists" | "listMessages" | "listReplies" | "listSenders" | "listWebhooks" | "stats">;
4
+ export declare const readers: (client: HeyReachClient) => Readers;
5
+ export {};
@@ -0,0 +1,70 @@
1
+ import type { CapabilityDeclaration } from "../internal/capabilities.ts";
2
+ import type { FieldDeclaration } from "../internal/fields.ts";
3
+ import type { LimitDeclaration } from "../internal/limits.ts";
4
+ export declare const BASE_URL = "https://api.heyreach.io/api/public";
5
+ export declare const API_KEY_ENV = "HEYREACH_API_KEY";
6
+ export declare const WORKSPACE_ENV = "HEYREACH_WORKSPACE_ID";
7
+ /** The documented maximum for the lists this adapter reads. */
8
+ export declare const PAGE_SIZE = 100;
9
+ /** `POST /list/GetLeadsFromList` alone returns up to 1000 rows. */
10
+ export declare const LIST_LEADS_PAGE_SIZE = 1000;
11
+ export declare const capabilities: CapabilityDeclaration;
12
+ export declare const fields: FieldDeclaration;
13
+ export declare const limits: LimitDeclaration;
14
+ export declare const costs: {
15
+ "blocklist.list": {
16
+ pageSize: number;
17
+ perPage: number;
18
+ };
19
+ "campaigns.get": {
20
+ perPage: number;
21
+ };
22
+ "campaigns.list": {
23
+ pageSize: number;
24
+ perPage: number;
25
+ };
26
+ "leads.get": {
27
+ perPage: number;
28
+ };
29
+ "leads.list": {
30
+ pageSize: number;
31
+ perPage: number;
32
+ };
33
+ "leads.lookup": {
34
+ pageSize: number;
35
+ perPage: number;
36
+ };
37
+ "lists.list": {
38
+ pageSize: number;
39
+ perPage: number;
40
+ };
41
+ "messages.list": {
42
+ pageSize: number;
43
+ perPage: number;
44
+ };
45
+ "replies.list": {
46
+ pageSize: number;
47
+ perPage: number;
48
+ };
49
+ "senders.get": {
50
+ perPage: number;
51
+ };
52
+ "senders.health": {
53
+ perPage: number;
54
+ };
55
+ "senders.list": {
56
+ pageSize: number;
57
+ perPage: number;
58
+ };
59
+ "sequence.get": {
60
+ perPage: number;
61
+ };
62
+ stats: {
63
+ perPage: number;
64
+ };
65
+ "webhooks.list": {
66
+ pageSize: number;
67
+ perPage: number;
68
+ };
69
+ };
70
+ export declare const caveats: readonly string[];
@@ -0,0 +1,18 @@
1
+ import type { HttpMethod, RawDescriptor } from "../internal/adapter.ts";
2
+ import type { VendorClient } from "../internal/client.ts";
3
+ import type { Json, JsonObject } from "../internal/json.ts";
4
+ import type { Identity } from "../internal/record.ts";
5
+ export interface ClientOptions {
6
+ readonly apiKey: string;
7
+ readonly baseUrl: string | undefined;
8
+ readonly identity: Identity;
9
+ }
10
+ export interface HeyReachClient extends VendorClient {
11
+ readonly identity: Identity;
12
+ readonly raw: RawDescriptor;
13
+ /** Narrows a response to one object, or throws a `Provider` error. */
14
+ readonly object: (body: Json, path: string) => JsonObject;
15
+ }
16
+ export declare const isSecret: (path: string) => boolean;
17
+ export declare const isRead: (method: HttpMethod, path: string) => boolean;
18
+ export declare const createClient: (options: ClientOptions) => HeyReachClient;
@@ -0,0 +1,7 @@
1
+ import type { Adapter } from "../internal/adapter.ts";
2
+ import type { HeyReachClient } from "./client.ts";
3
+ export declare const CONVERSATIONS_PATH = "/inbox/GetConversationsV3";
4
+ type InboxReaders = Pick<Adapter, "listMessages" | "listReplies">;
5
+ /** Messages and replies, read from one page of conversations at a time. */
6
+ export declare const inboxReaders: (client: HeyReachClient) => InboxReaders;
7
+ export {};
@@ -0,0 +1,25 @@
1
+ import type { Adapter } from "../internal/adapter.ts";
2
+ import type { CapabilityDeclaration } from "../internal/capabilities.ts";
3
+ import type { LeadFieldMap } from "../internal/lead-fields.ts";
4
+ import { NATIVE } from "./native.ts";
5
+ export { NATIVE } from "./native.ts";
6
+ export type { HeyReachNative } from "./native.ts";
7
+ export declare const PROVIDER = "heyreach";
8
+ /** The environment variables this adapter reads. */
9
+ export declare const envVars: readonly ["HEYREACH_API_KEY", "HEYREACH_WORKSPACE_ID"];
10
+ export interface HeyReachOptions {
11
+ /** Defaults to `HEYREACH_API_KEY`. A workspace API key. */
12
+ readonly apiKey?: string | undefined;
13
+ /** A label for this client or workspace. Defaults to `HEYREACH_WORKSPACE_ID`, then `default`. */
14
+ readonly workspaceId?: string | undefined;
15
+ readonly baseUrl?: string | undefined;
16
+ /** Overrides what the adapter declares. */
17
+ readonly capabilities?: CapabilityDeclaration | undefined;
18
+ /**
19
+ * Which of a lead's custom fields holds a value this vendor has no field
20
+ * for, for example `{ title: "job_title" }`. Read only where the vendor's
21
+ * own field is empty.
22
+ */
23
+ readonly leadFields?: LeadFieldMap | undefined;
24
+ }
25
+ export declare const heyreach: (options?: HeyReachOptions) => Adapter<typeof NATIVE>;