outbound-sdk 0.2.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/alerts/check-evaluate.d.ts +53 -0
- package/dist/alerts/check-measure.d.ts +100 -0
- package/dist/alerts/check-schema.d.ts +184 -0
- package/dist/alerts/check-validate.d.ts +18 -0
- package/dist/alerts/index.d.ts +7 -0
- package/dist/alerts/index.js +684 -20
- package/dist/alerts/plugin.d.ts +20 -3
- package/dist/audit/index.js +2 -2
- package/dist/benchmarks/index.js +5 -5
- package/dist/budget/index.d.ts +5 -2
- package/dist/budget/index.js +12 -10
- package/dist/cards/content.d.ts +6 -1
- package/dist/cards/format.d.ts +17 -2
- package/dist/cards/index.d.ts +1 -1
- package/dist/cards/index.js +298 -132
- package/dist/cards/parts.d.ts +9 -2
- package/dist/cards/render.d.ts +20 -3
- package/dist/chunks/{chunk-U2D34ARZ.js → chunk-2D42TQFU.js} +3 -3
- package/dist/chunks/{chunk-6CVZOUHB.js → chunk-3S32R2MH.js} +53 -63
- package/dist/chunks/chunk-4PA526S7.js +17 -0
- package/dist/chunks/{chunk-RCZ7ZZFU.js → chunk-5J7GGV62.js} +12 -5
- package/dist/chunks/chunk-6TKFISG4.js +676 -0
- package/dist/chunks/{chunk-AFU5E5QB.js → chunk-BK5SLY32.js} +104 -84
- package/dist/chunks/{chunk-VQSCHOBV.js → chunk-BLCJHP5H.js} +11 -4
- package/dist/chunks/{chunk-SBIZDCRY.js → chunk-BN6WCAWX.js} +7 -7
- package/dist/chunks/{chunk-4PSO6JEK.js → chunk-BOWXGMN3.js} +6 -21
- package/dist/chunks/{chunk-PURHK3JU.js → chunk-EHSJGQ5K.js} +8 -8
- package/dist/chunks/{chunk-IPUYZD4O.js → chunk-GFDNRWR3.js} +1 -1
- package/dist/chunks/chunk-HPNGSG5E.js +51 -0
- package/dist/chunks/chunk-HWHI4LFY.js +102 -0
- package/dist/chunks/{chunk-E7JHLNLG.js → chunk-J7DDZ4C2.js} +15 -2
- package/dist/chunks/{chunk-DJ2IUQEU.js → chunk-JWGSB7PT.js} +6 -6
- package/dist/chunks/{chunk-R3Y56YVF.js → chunk-OLPMBRXM.js} +4 -3
- package/dist/chunks/{chunk-YOTW5ESM.js → chunk-PQSTQKRD.js} +2 -2
- package/dist/chunks/chunk-PTZO4QXR.js +15 -0
- package/dist/chunks/{chunk-LVYG7XZJ.js → chunk-QAKJ76HB.js} +1 -1
- package/dist/chunks/chunk-QGRZDTX4.js +26 -0
- package/dist/chunks/chunk-WGW3ROLY.js +18 -0
- package/dist/chunks/{chunk-XC6CZP73.js → chunk-WH6V3YNN.js} +32 -1
- package/dist/chunks/{chunk-P3IJBJUI.js → chunk-X4RDBD4J.js} +296 -62
- package/dist/chunks/chunk-XL6LJVHJ.js +71 -0
- package/dist/chunks/{chunk-XNFESPZH.js → chunk-YYCT3NGV.js} +200 -39
- package/dist/chunks/{chunk-UAT3JSJZ.js → chunk-ZOAG2C6V.js} +2 -2
- package/dist/cli/bin.js +19 -30
- package/dist/cli/commands.d.ts +11 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +18 -13
- package/dist/cli/mcp.d.ts +5 -0
- package/dist/cli/update.d.ts +15 -0
- package/dist/clients/index.d.ts +1 -1
- package/dist/clients/index.js +35 -10
- package/dist/clients/plugin.d.ts +9 -2
- package/dist/combine/index.js +7 -6
- package/dist/emailbison/account.d.ts +7 -0
- package/dist/emailbison/adapter.d.ts +5 -0
- package/dist/emailbison/capabilities.d.ts +78 -0
- package/dist/emailbison/client.d.ts +29 -0
- package/dist/emailbison/index.d.ts +30 -0
- package/dist/emailbison/index.js +1017 -0
- package/dist/emailbison/mail.d.ts +5 -0
- package/dist/emailbison/map-mail.d.ts +13 -0
- package/dist/emailbison/map-sequence.d.ts +12 -0
- package/dist/emailbison/map-stats.d.ts +47 -0
- package/dist/emailbison/map.d.ts +24 -0
- package/dist/emailbison/native-params.d.ts +5 -0
- package/dist/emailbison/native-workspace.d.ts +167 -0
- package/dist/emailbison/native.d.ts +327 -0
- package/dist/emailbison/stats.d.ts +4 -0
- package/dist/emailbison/webhooks.d.ts +2 -0
- package/dist/exporter/index.d.ts +5 -2
- package/dist/exporter/index.js +2 -2
- package/dist/failover/index.js +3 -3
- package/dist/fixtures/index.js +10 -9
- package/dist/heyreach/capabilities.d.ts +3 -0
- package/dist/heyreach/client.d.ts +2 -0
- package/dist/heyreach/index.js +83 -51
- package/dist/heyreach/map.d.ts +5 -2
- package/dist/identity/index.js +33 -17
- package/dist/identity/plugin.d.ts +2 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +29 -25
- package/dist/insights/campaign.d.ts +3 -0
- package/dist/insights/capped.d.ts +29 -0
- package/dist/insights/copy/copy-audit.d.ts +2 -0
- package/dist/insights/copy/copy-reuse.d.ts +27 -3
- package/dist/insights/copy/index.d.ts +8 -8
- package/dist/insights/copy/reply-timing.d.ts +8 -0
- package/dist/insights/copy/reuse-base.d.ts +32 -0
- package/dist/insights/copy/shared.d.ts +39 -15
- package/dist/insights/copy/step-funnel.d.ts +16 -5
- package/dist/insights/copy/variant-test.d.ts +19 -8
- package/dist/insights/cost.d.ts +91 -0
- package/dist/insights/define.d.ts +78 -3
- package/dist/insights/fields.d.ts +16 -0
- package/dist/insights/index.d.ts +6 -4
- package/dist/insights/index.js +1816 -748
- package/dist/insights/inputs.generated.d.ts +951 -0
- package/dist/insights/ops/campaign-diagnosis.d.ts +3 -1
- package/dist/insights/ops/campaign-ranking.d.ts +15 -7
- package/dist/insights/ops/channel-mix.d.ts +2 -1
- package/dist/insights/ops/client-report.d.ts +18 -5
- package/dist/insights/ops/index.d.ts +8 -4
- package/dist/insights/ops/period-comparison.d.ts +14 -3
- package/dist/insights/ops/pipeline-forecast.d.ts +14 -4
- package/dist/insights/ops/shared.d.ts +39 -24
- package/dist/insights/ops/tag-rollup.d.ts +2 -1
- package/dist/insights/people/account-summary.d.ts +13 -0
- package/dist/insights/people/dropped-replies.d.ts +8 -0
- package/dist/insights/people/find.d.ts +7 -1
- package/dist/insights/people/hot-leads.d.ts +16 -1
- package/dist/insights/people/person-summary.d.ts +6 -0
- package/dist/insights/people/read.d.ts +26 -10
- package/dist/insights/people/suppression-check.d.ts +11 -2
- package/dist/insights/plugin.d.ts +26 -5
- package/dist/insights/ref.d.ts +6 -0
- package/dist/insights/registry.d.ts +30 -18
- package/dist/insights/run-cap.d.ts +35 -0
- package/dist/insights/senders/bounce-watch.d.ts +25 -8
- package/dist/insights/senders/capacity-sends.d.ts +22 -0
- package/dist/insights/senders/domain-health.d.ts +10 -4
- package/dist/insights/senders/index.d.ts +14 -6
- package/dist/insights/senders/read.d.ts +15 -14
- package/dist/insights/senders/sender-capacity.d.ts +5 -13
- package/dist/insights/senders/sender-load.d.ts +2 -0
- package/dist/insights/stats.d.ts +8 -0
- package/dist/insights/tools.d.ts +13 -2
- package/dist/instantly/capabilities.d.ts +13 -0
- package/dist/instantly/client.d.ts +2 -0
- package/dist/instantly/index.js +77 -49
- package/dist/instantly/map.d.ts +6 -2
- package/dist/internal/adapter.d.ts +12 -0
- package/dist/internal/engine/request.d.ts +5 -0
- package/dist/internal/entities.d.ts +3 -20
- package/dist/internal/errors.d.ts +44 -0
- package/dist/internal/fields.d.ts +1 -1
- package/dist/internal/json.d.ts +9 -2
- package/dist/internal/lists.d.ts +24 -0
- package/dist/internal/numbers.d.ts +8 -0
- package/dist/internal/outbound/collections.d.ts +4 -0
- package/dist/internal/outbound/create.d.ts +24 -3
- package/dist/internal/outbound/outbound.d.ts +18 -2
- package/dist/internal/outbound/validate.d.ts +4 -0
- package/dist/internal/outbound/walker.d.ts +3 -2
- package/dist/internal/plural.d.ts +12 -0
- package/dist/internal/renamed.d.ts +28 -0
- package/dist/internal/request-cap.d.ts +35 -0
- package/dist/internal/vocabulary.d.ts +20 -0
- package/dist/loader/index.js +5 -5
- package/dist/memory/adapter.d.ts +7 -0
- package/dist/memory/demo-stats.d.ts +3 -0
- package/dist/memory/demo.d.ts +14 -3
- package/dist/memory/index.d.ts +1 -0
- package/dist/memory/index.js +209 -104
- package/dist/providers/index.d.ts +92 -0
- package/dist/providers/index.js +3 -1
- package/dist/reconcile/index.js +5 -4
- package/dist/redact/index.js +13 -7
- package/dist/redact/plugin.d.ts +7 -0
- package/dist/smartlead/capabilities.d.ts +5 -0
- package/dist/smartlead/index.js +119 -66
- package/dist/smartlead/shared.d.ts +13 -0
- package/dist/sync/index.js +2 -2
- package/dist/tools/ai-sdk.js +10 -6
- package/dist/tools/campaign-tools.d.ts +1 -1
- package/dist/tools/claude-agent.js +10 -6
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +16 -9
- package/dist/tools/input-problem.d.ts +8 -0
- package/dist/tools/registry.d.ts +26 -2
- package/dist/tools/shared.d.ts +27 -1
- package/dist/tracing/index.js +2 -2
- package/dist/webhooks/index.js +22 -12
- package/package.json +8 -2
- package/dist/chunks/chunk-FKH5N47I.js +0 -40
package/dist/providers/index.js
CHANGED
package/dist/reconcile/index.js
CHANGED
|
@@ -41,11 +41,12 @@ var checkEvents = async (outbound, check) => {
|
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
var checkDeletions = async (outbound, check) => {
|
|
44
|
-
const { campaignId } = check;
|
|
44
|
+
const { campaignId, deadline, maxRequests, retries, signal, timeout } = check;
|
|
45
|
+
const options = { deadline, maxRequests, retries, signal, timeout };
|
|
45
46
|
const walks = {
|
|
46
|
-
campaigns: () => outbound.campaigns.listAll(
|
|
47
|
-
leads: () => outbound.leads.listAll({ ...
|
|
48
|
-
senders: () => outbound.senders.listAll({ ...
|
|
47
|
+
campaigns: () => outbound.campaigns.listAll(options),
|
|
48
|
+
leads: () => outbound.leads.listAll({ ...options, campaignId }),
|
|
49
|
+
senders: () => outbound.senders.listAll({ ...options, campaignId })
|
|
49
50
|
};
|
|
50
51
|
const listed = /* @__PURE__ */ new Set();
|
|
51
52
|
for await (const record of walks[check.collection]()) {
|
package/dist/redact/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
makeRef,
|
|
3
|
+
parseRef
|
|
4
|
+
} from "../chunks/chunk-QAKJ76HB.js";
|
|
1
5
|
import {
|
|
2
6
|
profileSlug
|
|
3
7
|
} from "../chunks/chunk-NAWZ73QS.js";
|
|
4
8
|
import {
|
|
5
9
|
stableId
|
|
6
10
|
} from "../chunks/chunk-FHKSLCVW.js";
|
|
7
|
-
import {
|
|
8
|
-
makeRef,
|
|
9
|
-
parseRef
|
|
10
|
-
} from "../chunks/chunk-LVYG7XZJ.js";
|
|
11
11
|
import {
|
|
12
12
|
OutboundError
|
|
13
|
-
} from "../chunks/chunk-
|
|
13
|
+
} from "../chunks/chunk-J7DDZ4C2.js";
|
|
14
14
|
import {
|
|
15
15
|
isJsonArray,
|
|
16
16
|
isJsonObject,
|
|
17
17
|
isString
|
|
18
|
-
} from "../chunks/chunk-
|
|
18
|
+
} from "../chunks/chunk-BLCJHP5H.js";
|
|
19
19
|
|
|
20
20
|
// src/redact/plugin.ts
|
|
21
21
|
var ALL_FIELDS = [
|
|
@@ -179,7 +179,13 @@ var redact = (options = {}) => {
|
|
|
179
179
|
data: redactEventData(masks, event.data),
|
|
180
180
|
raw: null
|
|
181
181
|
}),
|
|
182
|
-
extend: () => ({
|
|
182
|
+
extend: () => ({
|
|
183
|
+
redacted: {
|
|
184
|
+
fields: [...fields].toSorted(),
|
|
185
|
+
hash: (value) => masks.replace(value) ?? MASK,
|
|
186
|
+
strategy
|
|
187
|
+
}
|
|
188
|
+
}),
|
|
183
189
|
name: "redact",
|
|
184
190
|
wrap: async (operation, next) => {
|
|
185
191
|
const output = await next(operation);
|
package/dist/redact/plugin.d.ts
CHANGED
|
@@ -16,6 +16,13 @@ export interface RedactExtension {
|
|
|
16
16
|
readonly redacted: {
|
|
17
17
|
readonly fields: readonly RedactField[];
|
|
18
18
|
readonly strategy: "hash" | "mask";
|
|
19
|
+
/**
|
|
20
|
+
* What this redact writes in place of `value` in a masked field: the
|
|
21
|
+
* stable token under `hash`, so a caller can find a known address among
|
|
22
|
+
* hashed records without the records holding it; `[redacted]` under
|
|
23
|
+
* `mask`.
|
|
24
|
+
*/
|
|
25
|
+
readonly hash: (value: string) => string;
|
|
19
26
|
};
|
|
20
27
|
}
|
|
21
28
|
/** Masks emails, names, companies, LinkedIn URLs, custom fields and message text. */
|
|
@@ -37,10 +37,12 @@ export declare const costs: {
|
|
|
37
37
|
};
|
|
38
38
|
"leads.get": {
|
|
39
39
|
perPage: number;
|
|
40
|
+
perWalk: number;
|
|
40
41
|
};
|
|
41
42
|
"leads.list": {
|
|
42
43
|
pageSize: number;
|
|
43
44
|
perPage: number;
|
|
45
|
+
perWalk: number;
|
|
44
46
|
};
|
|
45
47
|
"lists.list": {
|
|
46
48
|
pageSize: number;
|
|
@@ -53,6 +55,7 @@ export declare const costs: {
|
|
|
53
55
|
"replies.list": {
|
|
54
56
|
pageSize: number;
|
|
55
57
|
perPage: number;
|
|
58
|
+
perWalk: number;
|
|
56
59
|
};
|
|
57
60
|
"senders.get": {
|
|
58
61
|
perPage: number;
|
|
@@ -70,6 +73,7 @@ export declare const costs: {
|
|
|
70
73
|
"sequence.subsequences": {
|
|
71
74
|
pageSize: number;
|
|
72
75
|
perPage: number;
|
|
76
|
+
perWalk: number;
|
|
73
77
|
};
|
|
74
78
|
stats: {
|
|
75
79
|
perPage: number;
|
|
@@ -79,6 +83,7 @@ export declare const costs: {
|
|
|
79
83
|
};
|
|
80
84
|
"webhooks.list": {
|
|
81
85
|
perPage: number;
|
|
86
|
+
perWalk: number;
|
|
82
87
|
};
|
|
83
88
|
"workspaces.list": {
|
|
84
89
|
perPage: number;
|
package/dist/smartlead/index.js
CHANGED
|
@@ -13,18 +13,19 @@ import {
|
|
|
13
13
|
toWorkspace,
|
|
14
14
|
unwrap,
|
|
15
15
|
withoutSecrets
|
|
16
|
-
} from "../chunks/chunk-
|
|
16
|
+
} from "../chunks/chunk-EHSJGQ5K.js";
|
|
17
17
|
import {
|
|
18
|
-
createVendorClient,
|
|
19
18
|
flatMapPage,
|
|
20
19
|
mapPage,
|
|
21
|
-
normalizeBody,
|
|
22
20
|
withLeadFields,
|
|
23
21
|
withMappedFields
|
|
24
|
-
} from "../chunks/chunk-
|
|
22
|
+
} from "../chunks/chunk-XL6LJVHJ.js";
|
|
25
23
|
import {
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
createVendorClient,
|
|
25
|
+
fromOne,
|
|
26
|
+
listIn,
|
|
27
|
+
normalizeBody
|
|
28
|
+
} from "../chunks/chunk-3S32R2MH.js";
|
|
28
29
|
import {
|
|
29
30
|
defineNative,
|
|
30
31
|
inBody,
|
|
@@ -33,10 +34,23 @@ import {
|
|
|
33
34
|
inQuery,
|
|
34
35
|
inQueryRequired
|
|
35
36
|
} from "../chunks/chunk-NAKXLBA6.js";
|
|
37
|
+
import {
|
|
38
|
+
eventTypesOf,
|
|
39
|
+
recordBase,
|
|
40
|
+
refTo,
|
|
41
|
+
refsTo
|
|
42
|
+
} from "../chunks/chunk-2D42TQFU.js";
|
|
43
|
+
import "../chunks/chunk-BOWXGMN3.js";
|
|
36
44
|
import {
|
|
37
45
|
emptyCounts,
|
|
38
46
|
metricRow
|
|
39
|
-
} from "../chunks/chunk-
|
|
47
|
+
} from "../chunks/chunk-PQSTQKRD.js";
|
|
48
|
+
import {
|
|
49
|
+
replyCategorySchema
|
|
50
|
+
} from "../chunks/chunk-QGRZDTX4.js";
|
|
51
|
+
import {
|
|
52
|
+
assertWorkspaceId
|
|
53
|
+
} from "../chunks/chunk-QAKJ76HB.js";
|
|
40
54
|
import "../chunks/chunk-NAWZ73QS.js";
|
|
41
55
|
import {
|
|
42
56
|
stableId
|
|
@@ -44,24 +58,12 @@ import {
|
|
|
44
58
|
import {
|
|
45
59
|
readEnv,
|
|
46
60
|
requireCredential
|
|
47
|
-
} from "../chunks/chunk-
|
|
48
|
-
import {
|
|
49
|
-
eventTypesOf,
|
|
50
|
-
recordBase,
|
|
51
|
-
refTo,
|
|
52
|
-
refsTo
|
|
53
|
-
} from "../chunks/chunk-U2D34ARZ.js";
|
|
54
|
-
import {
|
|
55
|
-
replyCategorySchema
|
|
56
|
-
} from "../chunks/chunk-4PSO6JEK.js";
|
|
57
|
-
import {
|
|
58
|
-
assertWorkspaceId
|
|
59
|
-
} from "../chunks/chunk-LVYG7XZJ.js";
|
|
61
|
+
} from "../chunks/chunk-GFDNRWR3.js";
|
|
60
62
|
import {
|
|
61
63
|
OutboundError,
|
|
62
64
|
makeErrorMapper,
|
|
63
65
|
requireObject
|
|
64
|
-
} from "../chunks/chunk-
|
|
66
|
+
} from "../chunks/chunk-J7DDZ4C2.js";
|
|
65
67
|
import {
|
|
66
68
|
count,
|
|
67
69
|
emailAddress,
|
|
@@ -76,7 +78,7 @@ import {
|
|
|
76
78
|
stringMap,
|
|
77
79
|
text,
|
|
78
80
|
timestamp
|
|
79
|
-
} from "../chunks/chunk-
|
|
81
|
+
} from "../chunks/chunk-BLCJHP5H.js";
|
|
80
82
|
|
|
81
83
|
// src/smartlead/capabilities.ts
|
|
82
84
|
var BASE_URL = "https://server.smartlead.ai/api/v1";
|
|
@@ -216,31 +218,31 @@ var costs = {
|
|
|
216
218
|
"campaigns.settings": { perPage: 1 },
|
|
217
219
|
// The lead, then its tags, then the category list when the lead has a
|
|
218
220
|
// category.
|
|
219
|
-
"leads.get": { perPage: 2 },
|
|
221
|
+
"leads.get": { perPage: 2, perWalk: 1 },
|
|
220
222
|
// The first page also reads the lead category list and, without a
|
|
221
223
|
// campaign, the campaign list. A lookup by address is one request, two
|
|
222
224
|
// when a campaign gives a lead category, and never walks leads.
|
|
223
|
-
"leads.list": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
225
|
+
"leads.list": { pageSize: PAGE_SIZE, perPage: 1, perWalk: 2 },
|
|
224
226
|
"lists.list": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
225
227
|
// A lead's timeline costs one request per campaign the lead is in, plus one
|
|
226
228
|
// to find those campaigns. A thread is one request.
|
|
227
229
|
"messages.list": { pageSize: ACTIVITIES_PAGE_SIZE, perPage: 1 },
|
|
228
230
|
// The first page of a walk also reads the lead category list.
|
|
229
|
-
"replies.list": { pageSize: INBOX_PAGE_SIZE, perPage: 1 },
|
|
231
|
+
"replies.list": { pageSize: INBOX_PAGE_SIZE, perPage: 1, perWalk: 1 },
|
|
230
232
|
"senders.get": { perPage: 1 },
|
|
231
233
|
// The mailbox, then its warmup statistics.
|
|
232
234
|
"senders.health": { perPage: 2 },
|
|
233
235
|
"senders.list": { pageSize: PAGE_SIZE, perPage: 1 },
|
|
234
236
|
"sequence.get": { perPage: 1 },
|
|
235
237
|
// One subsequence per page; the first page also reads the campaign list.
|
|
236
|
-
"sequence.subsequences": { pageSize: 1, perPage: 1 },
|
|
238
|
+
"sequence.subsequences": { pageSize: 1, perPage: 1, perWalk: 1 },
|
|
237
239
|
// A mailbox's totals cost two: the mailbox for its address, then the list.
|
|
238
240
|
// Daily rows cost two: the day-wise counts, then the positive replies.
|
|
239
241
|
stats: { perPage: 1 },
|
|
240
242
|
"tags.list": { perPage: 1 },
|
|
241
243
|
// One campaign per page; without a campaign, the first page also reads the
|
|
242
244
|
// campaign list.
|
|
243
|
-
"webhooks.list": { perPage: 1 },
|
|
245
|
+
"webhooks.list": { perPage: 1, perWalk: 1 },
|
|
244
246
|
"workspaces.list": { perPage: 1 }
|
|
245
247
|
};
|
|
246
248
|
var caveats = [
|
|
@@ -653,22 +655,50 @@ var toInboxReplies = (identity, item, categories, includeBody) => {
|
|
|
653
655
|
var pageSize = (limit, max = PAGE_SIZE) => Math.min(limit ?? max, max);
|
|
654
656
|
var segment = (id) => encodeURIComponent(id);
|
|
655
657
|
var idList = (value) => list(value).flatMap((id) => text(id) ?? []);
|
|
658
|
+
var providerError = (client, message) => new OutboundError("Provider", message, {
|
|
659
|
+
provider: client.identity.provider
|
|
660
|
+
});
|
|
656
661
|
var objectOf = (client, body, what) => requireObject(
|
|
657
662
|
unwrap(body),
|
|
658
663
|
client.identity.provider,
|
|
659
664
|
`Smartlead returned no object for ${what}`
|
|
660
665
|
);
|
|
661
|
-
var
|
|
662
|
-
unwrap(
|
|
663
|
-
|
|
664
|
-
|
|
666
|
+
var rowsOf = (client, body, path, key) => objects(
|
|
667
|
+
listIn(unwrap(body), {
|
|
668
|
+
key,
|
|
669
|
+
path,
|
|
670
|
+
provider: client.identity.provider,
|
|
671
|
+
vendor: "Smartlead"
|
|
672
|
+
})
|
|
665
673
|
);
|
|
674
|
+
var legacyRows = (client, body, path) => {
|
|
675
|
+
if (body === null || body === void 0 || isString(body)) {
|
|
676
|
+
throw providerError(client, `Smartlead returned no JSON for ${path}`);
|
|
677
|
+
}
|
|
678
|
+
const payload = unwrap(body);
|
|
679
|
+
return isJsonArray(payload) ? objects(payload) : [];
|
|
680
|
+
};
|
|
681
|
+
var campaignList = async (client, ctx) => {
|
|
682
|
+
const body = unwrap(
|
|
683
|
+
await client.get(ctx, "/campaigns/", { query: { include_tags: true } })
|
|
684
|
+
);
|
|
685
|
+
return rowsOf(
|
|
686
|
+
client,
|
|
687
|
+
body,
|
|
688
|
+
"/campaigns/",
|
|
689
|
+
isJsonObject(body) ? "campaigns" : void 0
|
|
690
|
+
);
|
|
691
|
+
};
|
|
666
692
|
var campaignIds = async (client, ctx) => {
|
|
667
693
|
const campaigns = await campaignList(client, ctx);
|
|
668
694
|
return campaigns.flatMap((campaign) => text(campaign.id) ?? []);
|
|
669
695
|
};
|
|
670
696
|
var offsetPage = async (client, ctx, path, page) => {
|
|
671
|
-
const rows =
|
|
697
|
+
const rows = rowsOf(
|
|
698
|
+
client,
|
|
699
|
+
await client.get(ctx, path, { query: page }),
|
|
700
|
+
path
|
|
701
|
+
);
|
|
672
702
|
return {
|
|
673
703
|
items: rows,
|
|
674
704
|
next: rows.length === page.limit ? page.offset + page.limit : void 0
|
|
@@ -681,11 +711,15 @@ var leadCategories = async (client, ctx, next) => {
|
|
|
681
711
|
names: stringMap(next.categories)
|
|
682
712
|
};
|
|
683
713
|
}
|
|
684
|
-
const body =
|
|
714
|
+
const body = rowsOf(
|
|
715
|
+
client,
|
|
716
|
+
await client.get(ctx, "/leads/fetch-categories"),
|
|
717
|
+
"/leads/fetch-categories"
|
|
718
|
+
);
|
|
685
719
|
return {
|
|
686
720
|
meanings: toCategoryMap(body),
|
|
687
721
|
names: Object.fromEntries(
|
|
688
|
-
|
|
722
|
+
body.flatMap((category) => {
|
|
689
723
|
const id = text(category.id);
|
|
690
724
|
const name = text(category.name);
|
|
691
725
|
return id === null || name === null ? [] : [[id, name]];
|
|
@@ -715,8 +749,10 @@ var listSubsequences = async (client, ctx, query) => {
|
|
|
715
749
|
next: rest.length > 0 ? { subsequences: rest } : void 0
|
|
716
750
|
};
|
|
717
751
|
};
|
|
718
|
-
var campaignWebhooks = async (client, ctx, campaignId) =>
|
|
719
|
-
|
|
752
|
+
var campaignWebhooks = async (client, ctx, campaignId) => rowsOf(
|
|
753
|
+
client,
|
|
754
|
+
await client.get(ctx, `/campaigns/${segment(campaignId)}/webhooks`),
|
|
755
|
+
`/campaigns/${campaignId}/webhooks`
|
|
720
756
|
).map((webhook) => toWebhook(client.identity, campaignId, webhook));
|
|
721
757
|
var listWebhooks = async (client, ctx, query) => {
|
|
722
758
|
if (query.campaignId !== void 0) {
|
|
@@ -809,16 +845,20 @@ var accountReaders = (client) => {
|
|
|
809
845
|
},
|
|
810
846
|
// SmartDelivery answers with every test at once: no pages are documented.
|
|
811
847
|
listPlacementTests: async (_query, ctx) => ({
|
|
812
|
-
items:
|
|
813
|
-
|
|
848
|
+
items: rowsOf(
|
|
849
|
+
client,
|
|
850
|
+
await client.delivery.post(ctx, "/spam-test/report", {}),
|
|
851
|
+
"/spam-test/report"
|
|
814
852
|
).map((test) => toPlacementTest(identity, test))
|
|
815
853
|
}),
|
|
816
854
|
listSubsequences: (query, ctx) => listSubsequences(client, ctx, query),
|
|
817
855
|
// One response holds every tag of the account; there are no pages.
|
|
818
856
|
listTags: async (_query, ctx) => ({
|
|
819
|
-
items:
|
|
820
|
-
|
|
821
|
-
|
|
857
|
+
items: rowsOf(
|
|
858
|
+
client,
|
|
859
|
+
await client.get(ctx, "/email-accounts/tags"),
|
|
860
|
+
"/email-accounts/tags"
|
|
861
|
+
).map((tag) => toTag(identity, tag))
|
|
822
862
|
}),
|
|
823
863
|
listWebhooks: (query, ctx) => listWebhooks(client, ctx, query)
|
|
824
864
|
};
|
|
@@ -828,14 +868,8 @@ var accountReaders = (client) => {
|
|
|
828
868
|
var NONE = { items: [] };
|
|
829
869
|
var memberships = async (client, ctx, lead) => {
|
|
830
870
|
const listed = lead.lead_campaign_data;
|
|
831
|
-
const
|
|
832
|
-
|
|
833
|
-
await client.get(
|
|
834
|
-
ctx,
|
|
835
|
-
`/leads/${segment(text(lead.id) ?? "")}/campaigns`
|
|
836
|
-
)
|
|
837
|
-
)
|
|
838
|
-
);
|
|
871
|
+
const path = `/leads/${segment(text(lead.id) ?? "")}/campaigns`;
|
|
872
|
+
const entries = isJsonArray(listed) ? objects(listed) : legacyRows(client, await client.get(ctx, path), path);
|
|
839
873
|
return entries.flatMap((entry) => {
|
|
840
874
|
const campaignId = text(entry.campaign_id) ?? text(entry.id);
|
|
841
875
|
return campaignId === null ? [] : [{ campaignId, entry }];
|
|
@@ -848,7 +882,14 @@ var leadsByEmail = async (client, ctx, query) => {
|
|
|
848
882
|
const lead = unwrap(
|
|
849
883
|
await client.get(ctx, "/leads/", { query: { email: query.email } })
|
|
850
884
|
);
|
|
851
|
-
if (!isJsonObject(lead)
|
|
885
|
+
if (!isJsonObject(lead)) {
|
|
886
|
+
throw new OutboundError(
|
|
887
|
+
"Provider",
|
|
888
|
+
"Smartlead returned no object for /leads/?email=",
|
|
889
|
+
{ provider: client.identity.provider }
|
|
890
|
+
);
|
|
891
|
+
}
|
|
892
|
+
if (text(lead.id) === null || emailAddress(lead.email) !== query.email) {
|
|
852
893
|
return NONE;
|
|
853
894
|
}
|
|
854
895
|
const found = await memberships(client, ctx, lead);
|
|
@@ -873,7 +914,12 @@ var campaignLeads = async (client, ctx, place) => {
|
|
|
873
914
|
`/campaigns/${segment(place.campaignId)}/leads`,
|
|
874
915
|
{ query: { limit: place.limit, offset: place.offset } }
|
|
875
916
|
);
|
|
876
|
-
const rows =
|
|
917
|
+
const rows = rowsOf(
|
|
918
|
+
client,
|
|
919
|
+
body,
|
|
920
|
+
`/campaigns/${place.campaignId}/leads`,
|
|
921
|
+
"data"
|
|
922
|
+
);
|
|
877
923
|
const total = count(field(body, "total_leads"));
|
|
878
924
|
const end = place.offset + rows.length;
|
|
879
925
|
const more = rows.length > 0 && (total === null ? rows.length === place.limit : end < total);
|
|
@@ -950,7 +996,9 @@ var getLead = async (client, ctx, id) => {
|
|
|
950
996
|
return toLead(
|
|
951
997
|
client.identity,
|
|
952
998
|
lead,
|
|
953
|
-
|
|
999
|
+
rowsOf(client, tags, "/crm/leads/tags").flatMap(
|
|
1000
|
+
(tag) => text(tag.name) ?? []
|
|
1001
|
+
),
|
|
954
1002
|
categories
|
|
955
1003
|
);
|
|
956
1004
|
};
|
|
@@ -974,7 +1022,7 @@ var listActivities = async (client, ctx, query) => {
|
|
|
974
1022
|
offset
|
|
975
1023
|
}
|
|
976
1024
|
});
|
|
977
|
-
const rows =
|
|
1025
|
+
const rows = rowsOf(client, body, "/campaigns/all-leads-activities", "data");
|
|
978
1026
|
const more = flag(field(body, "hasMore")) === true && rows.length > 0;
|
|
979
1027
|
return {
|
|
980
1028
|
// The feed has no campaign filter, so one campaign's rows are picked here.
|
|
@@ -993,11 +1041,8 @@ var leadCampaigns = async (client, ctx, query, leadId) => {
|
|
|
993
1041
|
if (query.campaignId !== void 0) {
|
|
994
1042
|
return [query.campaignId];
|
|
995
1043
|
}
|
|
996
|
-
const
|
|
997
|
-
|
|
998
|
-
`/leads/${encodeURIComponent(leadId)}/campaigns`
|
|
999
|
-
);
|
|
1000
|
-
return objects(unwrap(campaigns)).flatMap(
|
|
1044
|
+
const path = `/leads/${encodeURIComponent(leadId)}/campaigns`;
|
|
1045
|
+
return legacyRows(client, await client.get(ctx, path), path).flatMap(
|
|
1001
1046
|
(campaign) => text(campaign.id) ?? []
|
|
1002
1047
|
);
|
|
1003
1048
|
};
|
|
@@ -1051,7 +1096,13 @@ var listMessages = (client, ctx, query) => {
|
|
|
1051
1096
|
}
|
|
1052
1097
|
return query.leadId === void 0 ? listActivities(client, ctx, query) : listHistory(client, ctx, query, query.leadId);
|
|
1053
1098
|
};
|
|
1054
|
-
var readCategories = async (client, ctx, next) => isJsonObject(next) ? categoriesFromJson(next.categories) : toCategoryMap(
|
|
1099
|
+
var readCategories = async (client, ctx, next) => isJsonObject(next) ? categoriesFromJson(next.categories) : toCategoryMap(
|
|
1100
|
+
rowsOf(
|
|
1101
|
+
client,
|
|
1102
|
+
await client.get(ctx, "/leads/fetch-categories"),
|
|
1103
|
+
"/leads/fetch-categories"
|
|
1104
|
+
)
|
|
1105
|
+
);
|
|
1055
1106
|
var inboxFilters = (query, wanted) => {
|
|
1056
1107
|
const filters2 = {};
|
|
1057
1108
|
if (query.campaignId !== void 0) {
|
|
@@ -1083,7 +1134,12 @@ var listReplies = async (client, ctx, query) => {
|
|
|
1083
1134
|
// Without it a thread carries only its latest reply.
|
|
1084
1135
|
{ query: { fetch_message_history: true } }
|
|
1085
1136
|
);
|
|
1086
|
-
const threads =
|
|
1137
|
+
const threads = rowsOf(
|
|
1138
|
+
client,
|
|
1139
|
+
body,
|
|
1140
|
+
"/master-inbox/inbox-replies",
|
|
1141
|
+
"messages"
|
|
1142
|
+
);
|
|
1087
1143
|
const total = count(field(unwrap(body), "total_count"));
|
|
1088
1144
|
const end = offset + threads.length;
|
|
1089
1145
|
const more = threads.length > 0 && (total === null ? threads.length === limit : end < total);
|
|
@@ -1375,12 +1431,9 @@ var readStats = async (client, ctx, query) => {
|
|
|
1375
1431
|
// src/smartlead/adapter.ts
|
|
1376
1432
|
var listSenders = async (client, ctx, query) => {
|
|
1377
1433
|
if (query.campaignId !== void 0) {
|
|
1378
|
-
const
|
|
1379
|
-
ctx,
|
|
1380
|
-
`/campaigns/${segment(query.campaignId)}/email-accounts`
|
|
1381
|
-
);
|
|
1434
|
+
const path = `/campaigns/${segment(query.campaignId)}/email-accounts`;
|
|
1382
1435
|
return {
|
|
1383
|
-
items:
|
|
1436
|
+
items: rowsOf(client, await client.get(ctx, path), path).map(
|
|
1384
1437
|
(account) => toSender(client.identity, account)
|
|
1385
1438
|
)
|
|
1386
1439
|
};
|
|
@@ -1443,7 +1496,7 @@ var readers = (client) => {
|
|
|
1443
1496
|
listReplies: (query, ctx) => listReplies(client, ctx, query),
|
|
1444
1497
|
listSenders: (query, ctx) => listSenders(client, ctx, query),
|
|
1445
1498
|
listWorkspaces: async (_query, ctx) => ({
|
|
1446
|
-
items:
|
|
1499
|
+
items: rowsOf(client, await client.get(ctx, "/client/"), "/client/").map(
|
|
1447
1500
|
(raw) => toWorkspace(identity, raw)
|
|
1448
1501
|
)
|
|
1449
1502
|
}),
|
|
@@ -10,6 +10,19 @@ export declare const idList: (value: Json | undefined) => string[];
|
|
|
10
10
|
export declare const providerError: (client: SmartleadClient, message: string) => OutboundError;
|
|
11
11
|
/** The payload of an endpoint that returns one object, bare or wrapped. */
|
|
12
12
|
export declare const objectOf: (client: SmartleadClient, body: Json, what: string) => JsonObject;
|
|
13
|
+
/**
|
|
14
|
+
* The rows of a list answer: `body`, once unwrapped from `{ ok | success,
|
|
15
|
+
* data }`, is the array, or holds it under `key`. Anything else is a
|
|
16
|
+
* `Provider` error naming `path`.
|
|
17
|
+
*/
|
|
18
|
+
export declare const rowsOf: (client: SmartleadClient, body: Json | undefined, path: string, key?: string) => JsonObject[];
|
|
19
|
+
/**
|
|
20
|
+
* The rows of `GET /leads/{id}/campaigns`, read leniently. The endpoint is
|
|
21
|
+
* not in the current reference; only the deprecated docs show it, as a bare
|
|
22
|
+
* array, so an answer that is JSON but no array stays "no campaigns", as it
|
|
23
|
+
* always has. A body that is not JSON, or empty, is still a `Provider` error.
|
|
24
|
+
*/
|
|
25
|
+
export declare const legacyRows: (client: SmartleadClient, body: Json | undefined, path: string) => JsonObject[];
|
|
13
26
|
export declare const campaignList: (client: SmartleadClient, ctx: AdapterContext) => Promise<JsonObject[]>;
|
|
14
27
|
export declare const campaignIds: (client: SmartleadClient, ctx: AdapterContext) => Promise<string[]>;
|
|
15
28
|
export interface OffsetPage {
|
package/dist/sync/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
} from "../chunks/chunk-FHKSLCVW.js";
|
|
4
4
|
import {
|
|
5
5
|
OutboundError
|
|
6
|
-
} from "../chunks/chunk-
|
|
7
|
-
import "../chunks/chunk-
|
|
6
|
+
} from "../chunks/chunk-J7DDZ4C2.js";
|
|
7
|
+
import "../chunks/chunk-BLCJHP5H.js";
|
|
8
8
|
|
|
9
9
|
// src/sync/plugin.ts
|
|
10
10
|
var memoryCheckpointStore = () => {
|
package/dist/tools/ai-sdk.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createTools
|
|
3
|
-
} from "../chunks/chunk-
|
|
3
|
+
} from "../chunks/chunk-BK5SLY32.js";
|
|
4
|
+
import "../chunks/chunk-HWHI4LFY.js";
|
|
4
5
|
import "../chunks/chunk-HZCTYL22.js";
|
|
5
|
-
import "../chunks/chunk-
|
|
6
|
-
import "../chunks/chunk-
|
|
7
|
-
import "../chunks/chunk-
|
|
8
|
-
import "../chunks/chunk-
|
|
9
|
-
import "../chunks/chunk-
|
|
6
|
+
import "../chunks/chunk-HPNGSG5E.js";
|
|
7
|
+
import "../chunks/chunk-PTZO4QXR.js";
|
|
8
|
+
import "../chunks/chunk-BOWXGMN3.js";
|
|
9
|
+
import "../chunks/chunk-PQSTQKRD.js";
|
|
10
|
+
import "../chunks/chunk-QGRZDTX4.js";
|
|
11
|
+
import "../chunks/chunk-QAKJ76HB.js";
|
|
12
|
+
import "../chunks/chunk-J7DDZ4C2.js";
|
|
13
|
+
import "../chunks/chunk-BLCJHP5H.js";
|
|
10
14
|
|
|
11
15
|
// src/tools/ai-sdk.ts
|
|
12
16
|
import { jsonSchema, tool } from "ai";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { ToolDefinition } from "./shared.ts";
|
|
3
3
|
declare const overviewInput: z.ZodObject<{
|
|
4
|
-
from: z.ZodOptional<z.ZodString>;
|
|
5
4
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
6
5
|
status: z.ZodDefault<z.ZodEnum<{
|
|
7
6
|
active: "active";
|
|
@@ -11,6 +10,7 @@ declare const overviewInput: z.ZodObject<{
|
|
|
11
10
|
paused: "paused";
|
|
12
11
|
unknown: "unknown";
|
|
13
12
|
}>>;
|
|
13
|
+
from: z.ZodOptional<z.ZodString>;
|
|
14
14
|
to: z.ZodOptional<z.ZodString>;
|
|
15
15
|
}, z.core.$strip>;
|
|
16
16
|
export declare const campaignOverview: ToolDefinition<z.infer<typeof overviewInput>>;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createTools
|
|
3
|
-
} from "../chunks/chunk-
|
|
3
|
+
} from "../chunks/chunk-BK5SLY32.js";
|
|
4
|
+
import "../chunks/chunk-HWHI4LFY.js";
|
|
4
5
|
import "../chunks/chunk-HZCTYL22.js";
|
|
5
|
-
import "../chunks/chunk-
|
|
6
|
-
import "../chunks/chunk-
|
|
7
|
-
import "../chunks/chunk-
|
|
8
|
-
import "../chunks/chunk-
|
|
9
|
-
import "../chunks/chunk-
|
|
6
|
+
import "../chunks/chunk-HPNGSG5E.js";
|
|
7
|
+
import "../chunks/chunk-PTZO4QXR.js";
|
|
8
|
+
import "../chunks/chunk-BOWXGMN3.js";
|
|
9
|
+
import "../chunks/chunk-PQSTQKRD.js";
|
|
10
|
+
import "../chunks/chunk-QGRZDTX4.js";
|
|
11
|
+
import "../chunks/chunk-QAKJ76HB.js";
|
|
12
|
+
import "../chunks/chunk-J7DDZ4C2.js";
|
|
13
|
+
import "../chunks/chunk-BLCJHP5H.js";
|
|
10
14
|
|
|
11
15
|
// src/tools/claude-agent.ts
|
|
12
16
|
import { createSdkMcpServer, tool } from "@anthropic-ai/claude-agent-sdk";
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { Json } from "../internal/json.ts";
|
|
|
2
2
|
import type { OutboundApi } from "../internal/outbound/api.ts";
|
|
3
3
|
import type { ToolsOptions } from "./registry.ts";
|
|
4
4
|
export { createTools, TOOL_NAMES } from "./registry.ts";
|
|
5
|
-
export type { OutboundTool, ToolName, ToolsOptions } from "./registry.ts";
|
|
6
|
-
export { DEFAULT_BODY_CHARS, UNTRUSTED_NOTE } from "./shared.ts";
|
|
5
|
+
export type { OutboundTool, ToolCallOptions, ToolName, ToolsOptions, } from "./registry.ts";
|
|
6
|
+
export { DEFAULT_BODY_CHARS, DEFAULT_TOOL_REQUESTS, UNTRUSTED_NOTE, } from "./shared.ts";
|
|
7
7
|
export type { MetricSummary, ToolFailure, ToolResult, ToolSuccess, } from "./shared.ts";
|
|
8
8
|
/** One function tool in the OpenAI SDK's shape. */
|
|
9
9
|
export interface OpenAiFunctionTool {
|
package/dist/tools/index.js
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openaiTools
|
|
3
|
-
} from "../chunks/chunk-
|
|
3
|
+
} from "../chunks/chunk-OLPMBRXM.js";
|
|
4
4
|
import {
|
|
5
|
-
DEFAULT_BODY_CHARS,
|
|
6
5
|
TOOL_NAMES,
|
|
7
|
-
UNTRUSTED_NOTE,
|
|
8
6
|
createTools
|
|
9
|
-
} from "../chunks/chunk-
|
|
7
|
+
} from "../chunks/chunk-BK5SLY32.js";
|
|
8
|
+
import {
|
|
9
|
+
DEFAULT_BODY_CHARS,
|
|
10
|
+
DEFAULT_TOOL_REQUESTS,
|
|
11
|
+
UNTRUSTED_NOTE
|
|
12
|
+
} from "../chunks/chunk-HWHI4LFY.js";
|
|
10
13
|
import "../chunks/chunk-HZCTYL22.js";
|
|
11
|
-
import "../chunks/chunk-
|
|
12
|
-
import "../chunks/chunk-
|
|
13
|
-
import "../chunks/chunk-
|
|
14
|
-
import "../chunks/chunk-
|
|
15
|
-
import "../chunks/chunk-
|
|
14
|
+
import "../chunks/chunk-HPNGSG5E.js";
|
|
15
|
+
import "../chunks/chunk-PTZO4QXR.js";
|
|
16
|
+
import "../chunks/chunk-BOWXGMN3.js";
|
|
17
|
+
import "../chunks/chunk-PQSTQKRD.js";
|
|
18
|
+
import "../chunks/chunk-QGRZDTX4.js";
|
|
19
|
+
import "../chunks/chunk-QAKJ76HB.js";
|
|
20
|
+
import "../chunks/chunk-J7DDZ4C2.js";
|
|
21
|
+
import "../chunks/chunk-BLCJHP5H.js";
|
|
16
22
|
export {
|
|
17
23
|
DEFAULT_BODY_CHARS,
|
|
24
|
+
DEFAULT_TOOL_REQUESTS,
|
|
18
25
|
TOOL_NAMES,
|
|
19
26
|
UNTRUSTED_NOTE,
|
|
20
27
|
createTools,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Json } from "../internal/json.ts";
|
|
2
|
+
/** The part of a schema issue the sentence needs. */
|
|
3
|
+
export interface InputIssue {
|
|
4
|
+
readonly path: readonly PropertyKey[];
|
|
5
|
+
readonly message: string;
|
|
6
|
+
}
|
|
7
|
+
/** "`campaign` is required", or "from Use YYYY-MM-DD" for a value given wrong. */
|
|
8
|
+
export declare const inputProblem: (input: Json | undefined, issue: InputIssue | undefined) => string;
|