outbound-sdk 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/alerts/index.js +5 -1
- package/dist/audit/index.js +2 -2
- package/dist/benchmarks/index.js +5 -3
- package/dist/budget/index.js +31 -10
- package/dist/cache/index.js +2 -2
- package/dist/cards/index.js +1 -1
- package/dist/chunks/{chunk-WAM6N4OF.js → chunk-4PSO6JEK.js} +107 -19
- package/dist/chunks/chunk-6CVZOUHB.js +152 -0
- package/dist/chunks/{chunk-OCV66TS2.js → chunk-AFU5E5QB.js} +17 -8
- package/dist/chunks/{chunk-R6AM4GJR.js → chunk-DJ2IUQEU.js} +24 -18
- package/dist/chunks/{chunk-LOXBLQ3I.js → chunk-E7JHLNLG.js} +9 -2
- package/dist/chunks/{chunk-LNCOGBMI.js → chunk-FHKSLCVW.js} +13 -3
- package/dist/chunks/chunk-FKH5N47I.js +40 -0
- package/dist/chunks/chunk-HZCTYL22.js +29 -0
- package/dist/chunks/{chunk-CMQ5ZHLZ.js → chunk-IPUYZD4O.js} +1 -1
- package/dist/chunks/{chunk-VURTOVGI.js → chunk-IVH3NMQZ.js} +1 -1
- package/dist/chunks/{chunk-ZGHQYZEH.js → chunk-LVYG7XZJ.js} +1 -1
- package/dist/chunks/chunk-NAKXLBA6.js +30 -0
- package/dist/chunks/{chunk-7BCYLIDG.js → chunk-P3IJBJUI.js} +203 -34
- package/dist/chunks/{chunk-Q465X22Y.js → chunk-PURHK3JU.js} +93 -209
- package/dist/chunks/{chunk-F7MKFVIG.js → chunk-R3Y56YVF.js} +2 -2
- package/dist/chunks/chunk-RCZ7ZZFU.js +92 -0
- package/dist/chunks/chunk-SBIZDCRY.js +106 -0
- package/dist/chunks/{chunk-IBC52BX3.js → chunk-U2D34ARZ.js} +20 -3
- package/dist/chunks/chunk-UAT3JSJZ.js +331 -0
- package/dist/chunks/{chunk-QZNNCXXD.js → chunk-VQSCHOBV.js} +20 -1
- package/dist/chunks/{chunk-B7V6EOAC.js → chunk-XNFESPZH.js} +160 -126
- package/dist/chunks/{chunk-WW746NJF.js → chunk-YOTW5ESM.js} +25 -1
- package/dist/cli/bin.js +14 -13
- package/dist/cli/commands.d.ts +3 -0
- package/dist/cli/config.d.ts +22 -0
- package/dist/cli/index.d.ts +5 -1
- package/dist/cli/index.js +20 -15
- package/dist/cli/stdio.d.ts +9 -0
- package/dist/cli/version.d.ts +2 -0
- package/dist/clients/index.js +13 -3
- package/dist/combine/account.d.ts +1 -1
- package/dist/combine/index.js +90 -15
- package/dist/combine/route.d.ts +7 -0
- package/dist/exporter/index.js +2 -2
- package/dist/failover/index.js +4 -4
- package/dist/fixtures/index.js +40 -21
- package/dist/heyreach/account.d.ts +1 -1
- package/dist/heyreach/adapter.d.ts +1 -1
- package/dist/heyreach/capabilities.d.ts +2 -0
- package/dist/heyreach/client.d.ts +3 -5
- package/dist/heyreach/index.d.ts +7 -0
- package/dist/heyreach/index.js +428 -205
- package/dist/heyreach/leads.d.ts +4 -0
- package/dist/heyreach/map-account.d.ts +7 -1
- package/dist/heyreach/map-stats.d.ts +8 -5
- package/dist/heyreach/map.d.ts +3 -1
- package/dist/heyreach/webhooks.d.ts +1 -0
- package/dist/identity/index.js +22 -11
- package/dist/index.d.ts +1 -4
- package/dist/index.js +29 -17
- package/dist/insights/copy/index.d.ts +2 -2
- package/dist/insights/copy/variant-test.d.ts +2 -2
- package/dist/insights/index.js +248 -184
- package/dist/insights/ops/anomalies.d.ts +3 -3
- package/dist/insights/ops/index.d.ts +2 -2
- package/dist/insights/ops/shared.d.ts +7 -1
- package/dist/insights/registry.d.ts +4 -4
- package/dist/instantly/adapter-account.d.ts +1 -1
- package/dist/instantly/capabilities.d.ts +2 -0
- package/dist/instantly/client.d.ts +4 -9
- package/dist/instantly/index.d.ts +7 -0
- package/dist/instantly/index.js +410 -155
- package/dist/instantly/map-account.d.ts +20 -5
- package/dist/instantly/map-stats.d.ts +9 -6
- package/dist/instantly/map.d.ts +0 -2
- package/dist/instantly/native-agents-sales.d.ts +41 -41
- package/dist/instantly/native-agents.d.ts +44 -44
- package/dist/instantly/native-campaigns.d.ts +21 -21
- package/dist/instantly/native-leads.d.ts +12 -12
- package/dist/instantly/native-params.d.ts +2 -19
- package/dist/instantly/native-search.d.ts +10 -10
- package/dist/instantly/native-senders.d.ts +56 -56
- package/dist/instantly/native-supersearch.d.ts +33 -33
- package/dist/instantly/native-workspace.d.ts +45 -45
- package/dist/instantly/native.d.ts +262 -262
- package/dist/instantly/webhooks.d.ts +1 -0
- package/dist/internal/adapter.d.ts +24 -2
- package/dist/internal/capabilities.d.ts +18 -0
- package/dist/internal/client.d.ts +15 -0
- package/dist/internal/concurrency.d.ts +8 -0
- package/dist/internal/engine/request.d.ts +7 -0
- package/dist/internal/entities-account.d.ts +73 -3
- package/dist/internal/entities.d.ts +116 -12
- package/dist/internal/errors.d.ts +6 -1
- package/dist/internal/fields.d.ts +462 -0
- package/dist/internal/json.d.ts +9 -0
- package/dist/internal/lead-fields.d.ts +21 -0
- package/dist/internal/lead-status.d.ts +13 -0
- package/dist/internal/metrics.d.ts +14 -2
- package/dist/internal/native.d.ts +15 -0
- package/dist/internal/outbound/api.d.ts +29 -4
- package/dist/internal/outbound/operations-account.d.ts +12 -0
- package/dist/internal/outbound/outbound.d.ts +6 -3
- package/dist/internal/outbound/specs-account.d.ts +5 -1
- package/dist/internal/page.d.ts +14 -0
- package/dist/internal/record.d.ts +17 -0
- package/dist/internal/records.d.ts +7 -0
- package/dist/internal/sequence.d.ts +14 -0
- package/dist/internal/sha256.d.ts +2 -0
- package/dist/loader/index.d.ts +14 -2
- package/dist/loader/index.js +8 -4
- package/dist/memory/account-reads.d.ts +1 -1
- package/dist/memory/account.d.ts +15 -1
- package/dist/memory/data.d.ts +17 -2
- package/dist/memory/index.js +110 -35
- package/dist/redact/index.js +11 -6
- package/dist/redact/plugin.d.ts +1 -1
- package/dist/smartlead/account.d.ts +1 -1
- package/dist/smartlead/adapter.d.ts +1 -1
- package/dist/smartlead/capabilities.d.ts +2 -0
- package/dist/smartlead/client.d.ts +6 -11
- package/dist/smartlead/hmac.d.ts +0 -2
- package/dist/smartlead/index.d.ts +7 -0
- package/dist/smartlead/index.js +731 -572
- package/dist/smartlead/leads.d.ts +4 -1
- package/dist/smartlead/map-account.d.ts +17 -5
- package/dist/smartlead/map-stats.d.ts +9 -10
- package/dist/smartlead/map.d.ts +15 -5
- package/dist/smartlead/native-analytics.d.ts +87 -87
- package/dist/smartlead/native-campaigns.d.ts +64 -64
- package/dist/smartlead/native-inbox.d.ts +51 -51
- package/dist/smartlead/native-params.d.ts +2 -23
- package/dist/smartlead/native-services.d.ts +34 -34
- package/dist/smartlead/native.d.ts +236 -236
- package/dist/smartlead/shared.d.ts +6 -5
- package/dist/smartlead/webhooks.d.ts +1 -0
- package/dist/sync/index.js +3 -3
- package/dist/tools/ai-sdk.js +7 -5
- package/dist/tools/campaign-tools.d.ts +1 -1
- package/dist/tools/claude-agent.js +7 -5
- package/dist/tools/index.js +8 -6
- package/dist/tracing/index.js +2 -2
- package/dist/webhooks/index.js +10 -9
- package/package.json +1 -1
- package/dist/chunks/chunk-FZF6CLPX.js +0 -232
- package/dist/chunks/chunk-GPEJG34O.js +0 -53
- package/dist/chunks/chunk-HEC7XFFH.js +0 -65
- package/dist/chunks/chunk-QTB747K4.js +0 -100
- package/dist/chunks/chunk-TIJKJJDW.js +0 -6
|
@@ -6,18 +6,24 @@ import {
|
|
|
6
6
|
} from "./chunk-NAWZ73QS.js";
|
|
7
7
|
import {
|
|
8
8
|
sha256Hex
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FHKSLCVW.js";
|
|
10
10
|
import {
|
|
11
11
|
CAPABILITY_KEYS,
|
|
12
|
+
blockEntrySchema,
|
|
13
|
+
campaignProgressSchema,
|
|
14
|
+
campaignSettingsSchema,
|
|
12
15
|
intersectCapabilities,
|
|
16
|
+
leadListSchema,
|
|
17
|
+
placementTestSchema,
|
|
13
18
|
requireCapability,
|
|
14
|
-
resolveCapabilities
|
|
15
|
-
|
|
19
|
+
resolveCapabilities,
|
|
20
|
+
resolveFields,
|
|
21
|
+
senderHealthSchema,
|
|
22
|
+
tagSchema,
|
|
23
|
+
webhookSubscriptionSchema
|
|
24
|
+
} from "./chunk-UAT3JSJZ.js";
|
|
16
25
|
import {
|
|
17
|
-
baseFields,
|
|
18
26
|
campaignSchema,
|
|
19
|
-
count as count2,
|
|
20
|
-
isoDateTime,
|
|
21
27
|
leadSchema,
|
|
22
28
|
messageSchema,
|
|
23
29
|
metricRowSchema,
|
|
@@ -25,21 +31,21 @@ import {
|
|
|
25
31
|
senderSchema,
|
|
26
32
|
sequenceSchema,
|
|
27
33
|
workspaceSchema
|
|
28
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-4PSO6JEK.js";
|
|
29
35
|
import {
|
|
30
36
|
sourceIdFor
|
|
31
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-LVYG7XZJ.js";
|
|
32
38
|
import {
|
|
33
39
|
OutboundError,
|
|
34
40
|
redactUrl
|
|
35
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-E7JHLNLG.js";
|
|
36
42
|
import {
|
|
37
43
|
count,
|
|
38
44
|
field,
|
|
39
45
|
isJsonObject,
|
|
40
46
|
isString,
|
|
41
47
|
parseJson
|
|
42
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-VQSCHOBV.js";
|
|
43
49
|
|
|
44
50
|
// src/internal/limits.ts
|
|
45
51
|
var DEFAULT_CONCURRENCY = 8;
|
|
@@ -104,98 +110,6 @@ var RETRYABLE_STATUSES = /* @__PURE__ */ new Set([
|
|
|
104
110
|
]);
|
|
105
111
|
var isRetryableStatus = (status) => RETRYABLE_STATUSES.has(status);
|
|
106
112
|
|
|
107
|
-
// src/internal/entities-account.ts
|
|
108
|
-
import { z } from "zod";
|
|
109
|
-
var clock = z.string().regex(/^\d{2}:\d{2}$/u).nullable();
|
|
110
|
-
var flag = z.boolean().nullable();
|
|
111
|
-
var sendingWindowSchema = z.object({
|
|
112
|
-
/** Days of the week the window is open, 0 for Sunday to 6 for Saturday. */
|
|
113
|
-
days: z.array(z.number().int().min(0).max(6)),
|
|
114
|
-
/** `HH:MM` in `timezone`. */
|
|
115
|
-
from: clock,
|
|
116
|
-
name: z.string().nullable(),
|
|
117
|
-
/** An IANA name where the vendor gives one, otherwise the vendor's own label. */
|
|
118
|
-
timezone: z.string().nullable(),
|
|
119
|
-
/** `HH:MM` in `timezone`. */
|
|
120
|
-
to: clock
|
|
121
|
-
});
|
|
122
|
-
var campaignSettingsSchema = z.object({
|
|
123
|
-
...baseFields,
|
|
124
|
-
campaignRef: z.string(),
|
|
125
|
-
/** The most messages (or LinkedIn actions) the campaign sends per day. */
|
|
126
|
-
dailyLimit: count2,
|
|
127
|
-
/** The most new leads the campaign contacts per day. */
|
|
128
|
-
dailyNewLeads: count2,
|
|
129
|
-
endDate: z.iso.date().nullable(),
|
|
130
|
-
/** The shortest wait between two sends, in minutes. */
|
|
131
|
-
gapMinutes: z.number().nonnegative().nullable(),
|
|
132
|
-
/** `true` when emails are sent without HTML. */
|
|
133
|
-
plainText: flag,
|
|
134
|
-
schedule: z.array(sendingWindowSchema),
|
|
135
|
-
startDate: z.iso.date().nullable(),
|
|
136
|
-
/** `true` when a lead who sends an automatic reply gets no more steps. */
|
|
137
|
-
stopOnAutoReply: flag,
|
|
138
|
-
/** `true` when a lead who replies gets no more steps. */
|
|
139
|
-
stopOnReply: flag,
|
|
140
|
-
tracking: z.object({ clicks: flag, opens: flag })
|
|
141
|
-
});
|
|
142
|
-
var senderHealthSchema = z.object({
|
|
143
|
-
...baseFields,
|
|
144
|
-
/** `true` when the domain or address is on a block list the vendor checks. */
|
|
145
|
-
blacklisted: flag,
|
|
146
|
-
/** When the vendor last checked. */
|
|
147
|
-
checkedAt: isoDateTime,
|
|
148
|
-
/** `true` when the vendor can sign in to the mailbox or the LinkedIn seat. */
|
|
149
|
-
connected: flag,
|
|
150
|
-
/** Whether each DNS record is present and valid. */
|
|
151
|
-
dns: z.object({ dkim: flag, dmarc: flag, mx: flag, spf: flag }),
|
|
152
|
-
/** The mailbox's domain, lowercased. `null` for a LinkedIn seat. */
|
|
153
|
-
domain: z.string().nullable(),
|
|
154
|
-
/** Problems in the vendor's own words. */
|
|
155
|
-
issues: z.array(z.string()),
|
|
156
|
-
senderRef: z.string(),
|
|
157
|
-
/** Warmup traffic over the vendor's reporting window. `null` when there is none. */
|
|
158
|
-
warmup: z.object({
|
|
159
|
-
inbox: count2,
|
|
160
|
-
received: count2,
|
|
161
|
-
score: z.number().nullable(),
|
|
162
|
-
sent: count2,
|
|
163
|
-
spam: count2
|
|
164
|
-
}).nullable()
|
|
165
|
-
});
|
|
166
|
-
var leadListSchema = z.object({
|
|
167
|
-
...baseFields,
|
|
168
|
-
createdAt: isoDateTime,
|
|
169
|
-
kind: z.enum(["companies", "leads"]),
|
|
170
|
-
name: z.string(),
|
|
171
|
-
/** How many records the list holds. */
|
|
172
|
-
size: count2
|
|
173
|
-
});
|
|
174
|
-
var blockEntrySchema = z.object({
|
|
175
|
-
...baseFields,
|
|
176
|
-
createdAt: isoDateTime,
|
|
177
|
-
kind: z.enum(["company", "domain", "email", "linkedin", "other"]),
|
|
178
|
-
/** Lowercased for emails and domains. */
|
|
179
|
-
value: z.string()
|
|
180
|
-
});
|
|
181
|
-
var tagSchema = z.object({
|
|
182
|
-
...baseFields,
|
|
183
|
-
description: z.string().nullable(),
|
|
184
|
-
name: z.string()
|
|
185
|
-
});
|
|
186
|
-
var webhookSubscriptionSchema = z.object({
|
|
187
|
-
...baseFields,
|
|
188
|
-
active: flag,
|
|
189
|
-
/** The campaigns the webhook is limited to. Empty for every campaign. */
|
|
190
|
-
campaignRefs: z.array(z.string()),
|
|
191
|
-
createdAt: isoDateTime,
|
|
192
|
-
/** Event names in the vendor's own words. */
|
|
193
|
-
events: z.array(z.string()),
|
|
194
|
-
name: z.string().nullable(),
|
|
195
|
-
/** Where the vendor posts. It can hold a secret in its path or query. */
|
|
196
|
-
url: z.string()
|
|
197
|
-
});
|
|
198
|
-
|
|
199
113
|
// src/internal/hooks.ts
|
|
200
114
|
var ignore = () => {
|
|
201
115
|
};
|
|
@@ -502,6 +416,13 @@ var attempt = async (spec, environment, attemptNumber) => {
|
|
|
502
416
|
runtime,
|
|
503
417
|
signal: state.signal
|
|
504
418
|
});
|
|
419
|
+
try {
|
|
420
|
+
assertRequestBudget(environment);
|
|
421
|
+
state.beforeRequest?.();
|
|
422
|
+
} catch (error) {
|
|
423
|
+
budget.release();
|
|
424
|
+
throw error;
|
|
425
|
+
}
|
|
505
426
|
state.requests += 1;
|
|
506
427
|
const startedAt = runtime.now();
|
|
507
428
|
let status = null;
|
|
@@ -651,6 +572,7 @@ var RequestEngine = class {
|
|
|
651
572
|
begin(options = {}) {
|
|
652
573
|
const merged = { ...this.#defaults, ...options };
|
|
653
574
|
return {
|
|
575
|
+
beforeRequest: void 0,
|
|
654
576
|
deadlineAt: merged.deadline === void 0 ? void 0 : this.now() + merged.deadline,
|
|
655
577
|
maxRequests: merged.maxRequests,
|
|
656
578
|
requests: 0,
|
|
@@ -1055,6 +977,19 @@ var settingsGet = (core) => ({
|
|
|
1055
977
|
toOperation: (id) => ({ id, kind: "campaigns.settings" }),
|
|
1056
978
|
what: "Settings for campaign"
|
|
1057
979
|
});
|
|
980
|
+
var progressGet = (core) => ({
|
|
981
|
+
action: "campaigns.progress",
|
|
982
|
+
prepare: () => {
|
|
983
|
+
requireCapability(
|
|
984
|
+
core.gate,
|
|
985
|
+
"campaigns.progress",
|
|
986
|
+
"Reading a campaign's progress"
|
|
987
|
+
);
|
|
988
|
+
},
|
|
989
|
+
schema: campaignProgressSchema,
|
|
990
|
+
toOperation: (id) => ({ id, kind: "campaigns.progress" }),
|
|
991
|
+
what: "Progress for campaign"
|
|
992
|
+
});
|
|
1058
993
|
var healthGet = (core) => ({
|
|
1059
994
|
action: "senders.health",
|
|
1060
995
|
prepare: () => {
|
|
@@ -1096,6 +1031,24 @@ var listList = (core) => ({
|
|
|
1096
1031
|
schema: leadListSchema,
|
|
1097
1032
|
toOperation: (_filters, page) => ({ kind: "lists.list", query: page })
|
|
1098
1033
|
});
|
|
1034
|
+
var listGet = (core) => ({
|
|
1035
|
+
action: "lists.get",
|
|
1036
|
+
prepare: () => {
|
|
1037
|
+
requireCapability(core.gate, "lists.get", "Reading a lead list");
|
|
1038
|
+
},
|
|
1039
|
+
schema: leadListSchema,
|
|
1040
|
+
toOperation: (id) => ({ id, kind: "lists.get" }),
|
|
1041
|
+
what: "List"
|
|
1042
|
+
});
|
|
1043
|
+
var webhookGet = (core) => ({
|
|
1044
|
+
action: "webhooks.get",
|
|
1045
|
+
prepare: () => {
|
|
1046
|
+
requireCapability(core.gate, "webhooks.get", "Reading a webhook");
|
|
1047
|
+
},
|
|
1048
|
+
schema: webhookSubscriptionSchema,
|
|
1049
|
+
toOperation: (id) => ({ id, kind: "webhooks.get" }),
|
|
1050
|
+
what: "Webhook"
|
|
1051
|
+
});
|
|
1099
1052
|
var blocklistList = (core) => ({
|
|
1100
1053
|
action: "blocklist.list",
|
|
1101
1054
|
keyOf: refOf,
|
|
@@ -1106,6 +1059,23 @@ var blocklistList = (core) => ({
|
|
|
1106
1059
|
schema: blockEntrySchema,
|
|
1107
1060
|
toOperation: (_filters, page) => ({ kind: "blocklist.list", query: page })
|
|
1108
1061
|
});
|
|
1062
|
+
var placementTestList = (core) => ({
|
|
1063
|
+
action: "placementTests.list",
|
|
1064
|
+
keyOf: refOf,
|
|
1065
|
+
prepare: () => {
|
|
1066
|
+
requireCapability(
|
|
1067
|
+
core.gate,
|
|
1068
|
+
"placementTests.list",
|
|
1069
|
+
"Listing inbox placement tests"
|
|
1070
|
+
);
|
|
1071
|
+
return {};
|
|
1072
|
+
},
|
|
1073
|
+
schema: placementTestSchema,
|
|
1074
|
+
toOperation: (_filters, page) => ({
|
|
1075
|
+
kind: "placementTests.list",
|
|
1076
|
+
query: page
|
|
1077
|
+
})
|
|
1078
|
+
});
|
|
1109
1079
|
var tagList = (core) => ({
|
|
1110
1080
|
action: "tags.list",
|
|
1111
1081
|
keyOf: refOf,
|
|
@@ -1145,7 +1115,14 @@ var campaignList = (core) => ({
|
|
|
1145
1115
|
"Filtering campaigns by status"
|
|
1146
1116
|
);
|
|
1147
1117
|
}
|
|
1148
|
-
|
|
1118
|
+
if (filters.senderId !== void 0) {
|
|
1119
|
+
requireCapability(
|
|
1120
|
+
core.gate,
|
|
1121
|
+
"campaigns.bySender",
|
|
1122
|
+
"Listing a sender's campaigns"
|
|
1123
|
+
);
|
|
1124
|
+
}
|
|
1125
|
+
return { senderId: filters.senderId, status: filters.status };
|
|
1149
1126
|
},
|
|
1150
1127
|
schema: campaignSchema,
|
|
1151
1128
|
toOperation: (filters, page) => ({
|
|
@@ -1314,6 +1291,13 @@ var replyList = (core) => ({
|
|
|
1314
1291
|
"Filtering replies by category"
|
|
1315
1292
|
);
|
|
1316
1293
|
}
|
|
1294
|
+
if (filters.unread !== void 0) {
|
|
1295
|
+
requireCapability(
|
|
1296
|
+
core.gate,
|
|
1297
|
+
"replies.unread",
|
|
1298
|
+
"Filtering replies by whether they are unread"
|
|
1299
|
+
);
|
|
1300
|
+
}
|
|
1317
1301
|
if (wantsBody(filters.include)) {
|
|
1318
1302
|
requireCapability(core.gate, "messages.body", "Reading reply bodies");
|
|
1319
1303
|
}
|
|
@@ -1328,6 +1312,7 @@ var replyList = (core) => ({
|
|
|
1328
1312
|
campaignId: filters.campaignId,
|
|
1329
1313
|
category: filters.category,
|
|
1330
1314
|
include: filters.include,
|
|
1315
|
+
unread: filters.unread,
|
|
1331
1316
|
...normalizeRange(filters)
|
|
1332
1317
|
};
|
|
1333
1318
|
},
|
|
@@ -1339,6 +1324,7 @@ var replyList = (core) => ({
|
|
|
1339
1324
|
category: filters.category,
|
|
1340
1325
|
includeBody: wantsBody(filters.include),
|
|
1341
1326
|
since: filters.since,
|
|
1327
|
+
unread: filters.unread,
|
|
1342
1328
|
until: filters.until,
|
|
1343
1329
|
...page
|
|
1344
1330
|
}
|
|
@@ -1370,7 +1356,8 @@ var readStats = async (core, options = {}) => {
|
|
|
1370
1356
|
if (from !== void 0 && to !== void 0 && from > to) {
|
|
1371
1357
|
throw new OutboundError("Invalid", "from must not be after to");
|
|
1372
1358
|
}
|
|
1373
|
-
|
|
1359
|
+
const everyCampaign = scope === "campaign" && options.scopeId === void 0;
|
|
1360
|
+
if (scope !== "workspace" && options.scopeId === void 0 && !everyCampaign) {
|
|
1374
1361
|
throw new OutboundError(
|
|
1375
1362
|
"Invalid",
|
|
1376
1363
|
`stats for the ${scope} scope need a scopeId`
|
|
@@ -1378,8 +1365,8 @@ var readStats = async (core, options = {}) => {
|
|
|
1378
1365
|
}
|
|
1379
1366
|
requireCapability(
|
|
1380
1367
|
core.gate,
|
|
1381
|
-
SCOPE_CAPABILITY[scope],
|
|
1382
|
-
`Reading stats for the ${scope} scope`
|
|
1368
|
+
everyCampaign ? "stats.allCampaigns" : SCOPE_CAPABILITY[scope],
|
|
1369
|
+
everyCampaign ? "Reading stats for every campaign in one call" : `Reading stats for the ${scope} scope`
|
|
1383
1370
|
);
|
|
1384
1371
|
if (by === "day") {
|
|
1385
1372
|
requireCapability(core.gate, "stats.byDay", "Reading stats by day");
|
|
@@ -1418,12 +1405,14 @@ var makeCampaignHandle = (core, id) => {
|
|
|
1418
1405
|
const get = makeGetter(core, campaignGet());
|
|
1419
1406
|
const sequence = makeGetter(core, sequenceGet(core));
|
|
1420
1407
|
const settings = makeGetter(core, settingsGet(core));
|
|
1408
|
+
const progress = makeGetter(core, progressGet(core));
|
|
1421
1409
|
const fixed = { campaignId };
|
|
1422
1410
|
return {
|
|
1423
1411
|
get: (options) => get(campaignId, options),
|
|
1424
1412
|
id: campaignId,
|
|
1425
1413
|
leads: scoped(core, leadList(core), fixed),
|
|
1426
1414
|
messages: scoped(core, messageList(core), fixed),
|
|
1415
|
+
progress: (options) => progress(campaignId, options),
|
|
1427
1416
|
replies: scoped(core, replyList(core), fixed),
|
|
1428
1417
|
senders: scoped(core, senderList(core), fixed),
|
|
1429
1418
|
sequence: (options) => sequence(campaignId, options),
|
|
@@ -1442,6 +1431,7 @@ var makeSenderHandle = (core, id) => {
|
|
|
1442
1431
|
const get = makeGetter(core, senderGet(core));
|
|
1443
1432
|
const health = makeGetter(core, healthGet(core));
|
|
1444
1433
|
return {
|
|
1434
|
+
campaigns: scoped(core, campaignList(core), { senderId }),
|
|
1445
1435
|
get: (options) => get(senderId, options),
|
|
1446
1436
|
health: (options) => health(senderId, options),
|
|
1447
1437
|
id: senderId,
|
|
@@ -1500,7 +1490,12 @@ var makeLeadHandle = (core, id) => {
|
|
|
1500
1490
|
};
|
|
1501
1491
|
var makeListHandle = (core, id) => {
|
|
1502
1492
|
const listId = assertId(id, "List");
|
|
1503
|
-
|
|
1493
|
+
const get = makeGetter(core, listGet(core));
|
|
1494
|
+
return {
|
|
1495
|
+
get: (options) => get(listId, options),
|
|
1496
|
+
id: listId,
|
|
1497
|
+
leads: scoped(core, leadList(core), { listId })
|
|
1498
|
+
};
|
|
1504
1499
|
};
|
|
1505
1500
|
var makeThreadHandle = (core, id) => {
|
|
1506
1501
|
const threadId = assertId(id, "Thread");
|
|
@@ -1662,27 +1657,32 @@ var single = (item) => ({
|
|
|
1662
1657
|
// src/internal/outbound/operations-account.ts
|
|
1663
1658
|
var ACCOUNT_KINDS = /* @__PURE__ */ new Set([
|
|
1664
1659
|
"blocklist.list",
|
|
1660
|
+
"campaigns.progress",
|
|
1665
1661
|
"campaigns.settings",
|
|
1662
|
+
"lists.get",
|
|
1666
1663
|
"lists.list",
|
|
1664
|
+
"placementTests.list",
|
|
1667
1665
|
"senders.health",
|
|
1668
1666
|
"sequence.subsequences",
|
|
1669
1667
|
"tags.list",
|
|
1668
|
+
"webhooks.get",
|
|
1670
1669
|
"webhooks.list"
|
|
1671
1670
|
]);
|
|
1672
1671
|
var isAccountOperation = (operation) => ACCOUNT_KINDS.has(operation.kind);
|
|
1673
1672
|
var lookup = async (target, operation) => {
|
|
1674
1673
|
const { adapter, ctx } = target;
|
|
1675
1674
|
const id = idFor(adapter, operation.id);
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1675
|
+
const read = {
|
|
1676
|
+
"campaigns.progress": adapter.getCampaignProgress,
|
|
1677
|
+
"campaigns.settings": adapter.getCampaignSettings,
|
|
1678
|
+
"lists.get": adapter.getList,
|
|
1679
|
+
"senders.health": adapter.getSenderHealth,
|
|
1680
|
+
"webhooks.get": adapter.getWebhook
|
|
1681
|
+
}[operation.kind];
|
|
1682
|
+
if (read === void 0) {
|
|
1683
1683
|
throw unsupported(adapter, operation.kind);
|
|
1684
1684
|
}
|
|
1685
|
-
return single(await
|
|
1685
|
+
return single(await read(id, ctx));
|
|
1686
1686
|
};
|
|
1687
1687
|
var scopedList = async (target, operation) => {
|
|
1688
1688
|
const { adapter, ctx } = target;
|
|
@@ -1716,8 +1716,11 @@ var scopedList = async (target, operation) => {
|
|
|
1716
1716
|
var dispatchAccount = async (target, operation) => {
|
|
1717
1717
|
const { adapter, ctx } = target;
|
|
1718
1718
|
switch (operation.kind) {
|
|
1719
|
+
case "campaigns.progress":
|
|
1719
1720
|
case "campaigns.settings":
|
|
1720
|
-
case "
|
|
1721
|
+
case "lists.get":
|
|
1722
|
+
case "senders.health":
|
|
1723
|
+
case "webhooks.get": {
|
|
1721
1724
|
return await lookup(target, operation);
|
|
1722
1725
|
}
|
|
1723
1726
|
case "sequence.subsequences":
|
|
@@ -1736,6 +1739,12 @@ var dispatchAccount = async (target, operation) => {
|
|
|
1736
1739
|
}
|
|
1737
1740
|
return output(await adapter.listLists(operation.query, ctx));
|
|
1738
1741
|
}
|
|
1742
|
+
case "placementTests.list": {
|
|
1743
|
+
if (adapter.listPlacementTests === void 0) {
|
|
1744
|
+
throw unsupported(adapter, operation.kind);
|
|
1745
|
+
}
|
|
1746
|
+
return output(await adapter.listPlacementTests(operation.query, ctx));
|
|
1747
|
+
}
|
|
1739
1748
|
case "tags.list": {
|
|
1740
1749
|
if (adapter.listTags === void 0) {
|
|
1741
1750
|
throw unsupported(adapter, operation.kind);
|
|
@@ -1774,7 +1783,10 @@ var filterByTime = (page, range, grade, timeOf) => {
|
|
|
1774
1783
|
};
|
|
1775
1784
|
};
|
|
1776
1785
|
var listCampaigns = async (target, query) => {
|
|
1777
|
-
const page = await target.adapter.listCampaigns(
|
|
1786
|
+
const page = await target.adapter.listCampaigns(
|
|
1787
|
+
{ ...query, senderId: optionalId(target.adapter, query.senderId) },
|
|
1788
|
+
target.ctx
|
|
1789
|
+
);
|
|
1778
1790
|
if (target.capabilities["campaigns.status"] !== "client" || query.status === void 0) {
|
|
1779
1791
|
return output(page);
|
|
1780
1792
|
}
|
|
@@ -1843,7 +1855,18 @@ var listReplies = async (target, query) => {
|
|
|
1843
1855
|
capabilities["replies.since"],
|
|
1844
1856
|
(reply) => reply.sentAt
|
|
1845
1857
|
);
|
|
1846
|
-
|
|
1858
|
+
if (capabilities["replies.unread"] !== "client" || query.unread === void 0) {
|
|
1859
|
+
return output(filtered.page, filtered.derived);
|
|
1860
|
+
}
|
|
1861
|
+
return output(
|
|
1862
|
+
{
|
|
1863
|
+
items: filtered.page.items.filter(
|
|
1864
|
+
(reply) => reply.unread === query.unread
|
|
1865
|
+
),
|
|
1866
|
+
next: filtered.page.next
|
|
1867
|
+
},
|
|
1868
|
+
true
|
|
1869
|
+
);
|
|
1847
1870
|
};
|
|
1848
1871
|
var listSenders = async (target, query) => {
|
|
1849
1872
|
const { adapter, ctx } = target;
|
|
@@ -2104,6 +2127,7 @@ var Outbound = class _Outbound {
|
|
|
2104
2127
|
lists;
|
|
2105
2128
|
blocklist;
|
|
2106
2129
|
tags;
|
|
2130
|
+
placementTests;
|
|
2107
2131
|
webhooks;
|
|
2108
2132
|
raw;
|
|
2109
2133
|
native;
|
|
@@ -2151,10 +2175,22 @@ var Outbound = class _Outbound {
|
|
|
2151
2175
|
this.messages = makeReadCollection(this.#core, messageList(this.#core));
|
|
2152
2176
|
this.replies = makeReadCollection(this.#core, replyList(this.#core));
|
|
2153
2177
|
this.workspaces = makeReadCollection(this.#core, workspaceList(this.#core));
|
|
2154
|
-
this.lists =
|
|
2178
|
+
this.lists = makeCollection(
|
|
2179
|
+
this.#core,
|
|
2180
|
+
listList(this.#core),
|
|
2181
|
+
listGet(this.#core)
|
|
2182
|
+
);
|
|
2155
2183
|
this.blocklist = makeReadCollection(this.#core, blocklistList(this.#core));
|
|
2156
2184
|
this.tags = makeReadCollection(this.#core, tagList(this.#core));
|
|
2157
|
-
this.
|
|
2185
|
+
this.placementTests = makeReadCollection(
|
|
2186
|
+
this.#core,
|
|
2187
|
+
placementTestList(this.#core)
|
|
2188
|
+
);
|
|
2189
|
+
this.webhooks = makeCollection(
|
|
2190
|
+
this.#core,
|
|
2191
|
+
webhookList(this.#core),
|
|
2192
|
+
webhookGet(this.#core)
|
|
2193
|
+
);
|
|
2158
2194
|
this.raw = makeRawClient(
|
|
2159
2195
|
this.#core,
|
|
2160
2196
|
// Asked as if the adapter had native reads: a plugin that would turn
|
|
@@ -2180,6 +2216,10 @@ var Outbound = class _Outbound {
|
|
|
2180
2216
|
get caveats() {
|
|
2181
2217
|
return this.#core.adapter.caveats ?? [];
|
|
2182
2218
|
}
|
|
2219
|
+
get fields() {
|
|
2220
|
+
const { adapter } = this.#core;
|
|
2221
|
+
return adapter.fieldCoverage ?? resolveFields(adapter.fields);
|
|
2222
|
+
}
|
|
2183
2223
|
/** The plugins on this instance, outermost first. */
|
|
2184
2224
|
get plugins() {
|
|
2185
2225
|
return this.#plugins;
|
|
@@ -2262,12 +2302,6 @@ var createOutbound = (options) => {
|
|
|
2262
2302
|
export {
|
|
2263
2303
|
DEFAULT_SHARE,
|
|
2264
2304
|
fullJitterBackoff,
|
|
2265
|
-
campaignSettingsSchema,
|
|
2266
|
-
senderHealthSchema,
|
|
2267
|
-
leadListSchema,
|
|
2268
|
-
blockEntrySchema,
|
|
2269
|
-
tagSchema,
|
|
2270
|
-
webhookSubscriptionSchema,
|
|
2271
2305
|
Outbound,
|
|
2272
2306
|
createOutbound
|
|
2273
2307
|
};
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SCHEMA_VERSION
|
|
3
|
+
} from "./chunk-4PSO6JEK.js";
|
|
4
|
+
import {
|
|
5
|
+
makeRef
|
|
6
|
+
} from "./chunk-LVYG7XZJ.js";
|
|
7
|
+
|
|
1
8
|
// src/internal/metrics.ts
|
|
2
9
|
var METRIC_DEFINITIONS = {
|
|
3
10
|
acceptanceRate: {
|
|
@@ -44,6 +51,7 @@ var computeRates = (row) => ({
|
|
|
44
51
|
var COUNT_KEYS = [
|
|
45
52
|
"bounced",
|
|
46
53
|
"clicked",
|
|
54
|
+
"clickedTotal",
|
|
47
55
|
"connectionsAccepted",
|
|
48
56
|
"connectionsSent",
|
|
49
57
|
"contacted",
|
|
@@ -60,6 +68,7 @@ var COUNT_KEYS = [
|
|
|
60
68
|
var emptyCounts = () => ({
|
|
61
69
|
bounced: null,
|
|
62
70
|
clicked: null,
|
|
71
|
+
clickedTotal: null,
|
|
63
72
|
connectionsAccepted: null,
|
|
64
73
|
connectionsSent: null,
|
|
65
74
|
contacted: null,
|
|
@@ -85,10 +94,25 @@ var sumCounts = (rows) => {
|
|
|
85
94
|
}
|
|
86
95
|
return total;
|
|
87
96
|
};
|
|
97
|
+
var metricRow = (scope, counts, extra = {}) => ({
|
|
98
|
+
...counts,
|
|
99
|
+
contentHash: null,
|
|
100
|
+
date: extra.date ?? null,
|
|
101
|
+
evidence: extra.evidence ?? "exact",
|
|
102
|
+
provider: scope.provider,
|
|
103
|
+
schemaVersion: SCHEMA_VERSION,
|
|
104
|
+
scope: scope.scope,
|
|
105
|
+
scopeRef: makeRef(scope.provider, scope.workspaceId, scope.scopeId),
|
|
106
|
+
stepIndex: extra.stepIndex ?? null,
|
|
107
|
+
timezone: extra.timezone ?? null,
|
|
108
|
+
variantKey: extra.variantKey ?? null,
|
|
109
|
+
workspaceId: scope.workspaceId
|
|
110
|
+
});
|
|
88
111
|
|
|
89
112
|
export {
|
|
90
113
|
METRIC_DEFINITIONS,
|
|
91
114
|
computeRates,
|
|
92
115
|
emptyCounts,
|
|
93
|
-
sumCounts
|
|
116
|
+
sumCounts,
|
|
117
|
+
metricRow
|
|
94
118
|
};
|
package/dist/cli/bin.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
run
|
|
4
|
-
} from "../chunks/chunk-
|
|
5
|
-
import "../chunks/chunk-
|
|
6
|
-
import "../chunks/chunk-
|
|
7
|
-
import "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-P3IJBJUI.js";
|
|
5
|
+
import "../chunks/chunk-R3Y56YVF.js";
|
|
6
|
+
import "../chunks/chunk-AFU5E5QB.js";
|
|
7
|
+
import "../chunks/chunk-HZCTYL22.js";
|
|
8
|
+
import "../chunks/chunk-XNFESPZH.js";
|
|
8
9
|
import "../chunks/chunk-4O2HRTTI.js";
|
|
9
|
-
import "../chunks/chunk-
|
|
10
|
+
import "../chunks/chunk-YOTW5ESM.js";
|
|
10
11
|
import "../chunks/chunk-NAWZ73QS.js";
|
|
11
|
-
import "../chunks/chunk-
|
|
12
|
-
import "../chunks/chunk-
|
|
13
|
-
import "../chunks/chunk-
|
|
12
|
+
import "../chunks/chunk-FHKSLCVW.js";
|
|
13
|
+
import "../chunks/chunk-RCZ7ZZFU.js";
|
|
14
|
+
import "../chunks/chunk-IPUYZD4O.js";
|
|
14
15
|
import "../chunks/chunk-XC6CZP73.js";
|
|
15
|
-
import "../chunks/chunk-
|
|
16
|
-
import "../chunks/chunk-
|
|
17
|
-
import "../chunks/chunk-
|
|
18
|
-
import "../chunks/chunk-
|
|
19
|
-
import "../chunks/chunk-
|
|
16
|
+
import "../chunks/chunk-UAT3JSJZ.js";
|
|
17
|
+
import "../chunks/chunk-4PSO6JEK.js";
|
|
18
|
+
import "../chunks/chunk-LVYG7XZJ.js";
|
|
19
|
+
import "../chunks/chunk-E7JHLNLG.js";
|
|
20
|
+
import "../chunks/chunk-VQSCHOBV.js";
|
|
20
21
|
|
|
21
22
|
// src/cli/bin.ts
|
|
22
23
|
import process from "node:process";
|
package/dist/cli/commands.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { Json } from "../internal/json.ts";
|
|
2
2
|
import type { OutboundApi } from "../internal/outbound/api.ts";
|
|
3
|
+
import type { OutboundTool } from "../tools/index.ts";
|
|
3
4
|
export interface CommandInput {
|
|
4
5
|
readonly positionals: readonly string[];
|
|
5
6
|
readonly flags: Readonly<Record<string, string | boolean | undefined>>;
|
|
6
7
|
}
|
|
7
8
|
type Command = (outbound: OutboundApi, input: CommandInput) => Promise<Json>;
|
|
9
|
+
/** The tools `outbound mcp` offers: the built-in ones, then the insights. */
|
|
10
|
+
export declare const offeredTools: (outbound: OutboundApi) => Promise<OutboundTool[]>;
|
|
8
11
|
export interface CommandSpec {
|
|
9
12
|
readonly help: string;
|
|
10
13
|
readonly run: Command;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { OutboundPlugin } from "../internal/outbound/plugins.ts";
|
|
2
|
+
/** What a file passed to `--config` exports as its default. */
|
|
3
|
+
export interface CliConfig {
|
|
4
|
+
/** Plugins for the instance, outermost first, as in `createOutbound`. */
|
|
5
|
+
readonly plugins?: readonly OutboundPlugin[] | undefined;
|
|
6
|
+
}
|
|
7
|
+
/** Returns the config unchanged. It exists so an editor can check its shape. */
|
|
8
|
+
export declare const defineConfig: (config: CliConfig) => CliConfig;
|
|
9
|
+
export interface PluginFlags {
|
|
10
|
+
readonly config?: string | undefined;
|
|
11
|
+
readonly redact?: boolean | undefined;
|
|
12
|
+
readonly "no-redact"?: boolean | undefined;
|
|
13
|
+
readonly "max-requests"?: string | undefined;
|
|
14
|
+
readonly cache?: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The plugins for one command, outermost first: redact, then the config
|
|
18
|
+
* file's plugins, then cache, then budget, then identity, next to the
|
|
19
|
+
* request engine.
|
|
20
|
+
* `mcp` turns redact on unless `--no-redact` is set.
|
|
21
|
+
*/
|
|
22
|
+
export declare const pluginsFor: (flags: PluginFlags, mcp: boolean) => Promise<OutboundPlugin[]>;
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { Adapter } from "../internal/adapter.ts";
|
|
2
|
+
export { defineConfig } from "./config.ts";
|
|
3
|
+
export type { CliConfig } from "./config.ts";
|
|
2
4
|
export { createMcpServer, PROTOCOL_VERSIONS } from "./mcp.ts";
|
|
3
5
|
export type { McpServer, McpServerOptions } from "./mcp.ts";
|
|
6
|
+
export { serveStdio } from "./stdio.ts";
|
|
7
|
+
export type { StdioOptions } from "./stdio.ts";
|
|
4
8
|
export interface CliIo {
|
|
5
9
|
readonly stdout: (text: string) => void;
|
|
6
10
|
readonly stderr: (text: string) => void;
|
|
7
11
|
/** Opens standard input as lines. Called only by `outbound mcp`, so other commands exit when done. */
|
|
8
|
-
readonly stdin?: (() => AsyncIterable<string>) | undefined;
|
|
12
|
+
readonly stdin?: (() => AsyncIterable<string> | Iterable<string>) | undefined;
|
|
9
13
|
/** Replaces the adapter the environment would choose. Meant for tests. */
|
|
10
14
|
readonly adapter?: Adapter | undefined;
|
|
11
15
|
}
|
package/dist/cli/index.js
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PROTOCOL_VERSIONS,
|
|
3
3
|
createMcpServer,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import "../chunks/chunk-
|
|
4
|
+
defineConfig,
|
|
5
|
+
run,
|
|
6
|
+
serveStdio
|
|
7
|
+
} from "../chunks/chunk-P3IJBJUI.js";
|
|
8
|
+
import "../chunks/chunk-R3Y56YVF.js";
|
|
9
|
+
import "../chunks/chunk-AFU5E5QB.js";
|
|
10
|
+
import "../chunks/chunk-HZCTYL22.js";
|
|
11
|
+
import "../chunks/chunk-XNFESPZH.js";
|
|
9
12
|
import "../chunks/chunk-4O2HRTTI.js";
|
|
10
|
-
import "../chunks/chunk-
|
|
13
|
+
import "../chunks/chunk-YOTW5ESM.js";
|
|
11
14
|
import "../chunks/chunk-NAWZ73QS.js";
|
|
12
|
-
import "../chunks/chunk-
|
|
13
|
-
import "../chunks/chunk-
|
|
14
|
-
import "../chunks/chunk-
|
|
15
|
+
import "../chunks/chunk-FHKSLCVW.js";
|
|
16
|
+
import "../chunks/chunk-RCZ7ZZFU.js";
|
|
17
|
+
import "../chunks/chunk-IPUYZD4O.js";
|
|
15
18
|
import "../chunks/chunk-XC6CZP73.js";
|
|
16
|
-
import "../chunks/chunk-
|
|
17
|
-
import "../chunks/chunk-
|
|
18
|
-
import "../chunks/chunk-
|
|
19
|
-
import "../chunks/chunk-
|
|
20
|
-
import "../chunks/chunk-
|
|
19
|
+
import "../chunks/chunk-UAT3JSJZ.js";
|
|
20
|
+
import "../chunks/chunk-4PSO6JEK.js";
|
|
21
|
+
import "../chunks/chunk-LVYG7XZJ.js";
|
|
22
|
+
import "../chunks/chunk-E7JHLNLG.js";
|
|
23
|
+
import "../chunks/chunk-VQSCHOBV.js";
|
|
21
24
|
export {
|
|
22
25
|
PROTOCOL_VERSIONS,
|
|
23
26
|
createMcpServer,
|
|
24
|
-
|
|
27
|
+
defineConfig,
|
|
28
|
+
run,
|
|
29
|
+
serveStdio
|
|
25
30
|
};
|