outbound-sdk 0.4.0 → 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 +635 -2
- package/dist/budget/index.d.ts +2 -0
- package/dist/budget/index.js +1 -0
- package/dist/cards/index.js +2 -1
- package/dist/chunks/{chunk-5CFO3CXG.js → chunk-3S32R2MH.js} +33 -67
- package/dist/chunks/{chunk-ZFVHM5JI.js → chunk-5J7GGV62.js} +11 -4
- package/dist/chunks/chunk-6TKFISG4.js +676 -0
- package/dist/chunks/{chunk-E6DSDCPI.js → chunk-BK5SLY32.js} +92 -101
- package/dist/chunks/{chunk-A6WVOCA4.js → chunk-BN6WCAWX.js} +4 -4
- package/dist/chunks/{chunk-IZFTTMJP.js → chunk-EHSJGQ5K.js} +5 -5
- package/dist/chunks/chunk-HPNGSG5E.js +51 -0
- package/dist/chunks/chunk-HWHI4LFY.js +102 -0
- package/dist/chunks/{chunk-Y5RAJ6PZ.js → chunk-OLPMBRXM.js} +3 -2
- package/dist/chunks/chunk-WGW3ROLY.js +18 -0
- package/dist/chunks/{chunk-7ZDS6SZD.js → chunk-WH6V3YNN.js} +25 -0
- package/dist/chunks/{chunk-7LNJJ2RO.js → chunk-X4RDBD4J.js} +102 -11
- package/dist/chunks/chunk-XL6LJVHJ.js +71 -0
- package/dist/chunks/{chunk-5FVKRIEJ.js → chunk-YYCT3NGV.js} +35 -11
- package/dist/cli/bin.js +13 -28
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +12 -11
- package/dist/cli/update.d.ts +15 -0
- 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/fixtures/index.js +6 -6
- package/dist/heyreach/capabilities.d.ts +3 -0
- package/dist/heyreach/index.js +20 -20
- package/dist/index.js +19 -18
- package/dist/insights/copy/copy-reuse.d.ts +6 -6
- package/dist/insights/copy/shared.d.ts +2 -2
- package/dist/insights/copy/step-funnel.d.ts +5 -5
- package/dist/insights/copy/variant-test.d.ts +2 -2
- package/dist/insights/cost.d.ts +91 -0
- package/dist/insights/define.d.ts +22 -1
- package/dist/insights/index.d.ts +4 -3
- package/dist/insights/index.js +331 -27
- package/dist/insights/inputs.generated.d.ts +4 -4
- package/dist/insights/ops/campaign-ranking.d.ts +3 -3
- package/dist/insights/ops/index.d.ts +2 -2
- package/dist/insights/ops/shared.d.ts +11 -1
- package/dist/insights/plugin.d.ts +19 -0
- package/dist/insights/registry.d.ts +2 -2
- package/dist/insights/run-cap.d.ts +35 -0
- package/dist/insights/senders/bounce-watch.d.ts +4 -4
- package/dist/insights/senders/domain-health.d.ts +2 -2
- package/dist/insights/senders/sender-load.d.ts +1 -1
- package/dist/insights/tools.d.ts +10 -0
- package/dist/instantly/capabilities.d.ts +13 -0
- package/dist/instantly/index.js +41 -28
- package/dist/internal/adapter.d.ts +12 -0
- package/dist/internal/outbound/outbound.d.ts +5 -1
- package/dist/internal/request-cap.d.ts +35 -0
- package/dist/loader/index.js +2 -2
- package/dist/memory/index.js +10 -10
- package/dist/providers/index.d.ts +21 -1
- package/dist/providers/index.js +1 -1
- package/dist/redact/index.js +4 -4
- package/dist/smartlead/capabilities.d.ts +5 -0
- package/dist/smartlead/index.js +24 -24
- package/dist/tools/ai-sdk.js +5 -3
- package/dist/tools/claude-agent.js +5 -3
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +11 -6
- package/dist/tools/registry.d.ts +20 -1
- package/dist/tools/shared.d.ts +20 -1
- package/dist/webhooks/index.js +16 -7
- package/package.json +8 -2
- package/dist/chunks/chunk-K4USHN4C.js +0 -40
- package/dist/chunks/chunk-LVQUSKEX.js +0 -17
- package/dist/chunks/{chunk-C4LS2HNV.js → chunk-JWGSB7PT.js} +3 -3
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createTools
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BK5SLY32.js";
|
|
4
4
|
import {
|
|
5
5
|
plural
|
|
6
6
|
} from "./chunk-4PA526S7.js";
|
|
7
7
|
import {
|
|
8
8
|
createOutbound
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
fromEnv
|
|
12
|
-
} from "./chunk-ZFVHM5JI.js";
|
|
13
|
-
import {
|
|
14
|
-
providers
|
|
15
|
-
} from "./chunk-7ZDS6SZD.js";
|
|
9
|
+
} from "./chunk-YYCT3NGV.js";
|
|
16
10
|
import {
|
|
17
11
|
campaignStatusSchema,
|
|
18
12
|
replyCategorySchema
|
|
19
13
|
} from "./chunk-QGRZDTX4.js";
|
|
14
|
+
import {
|
|
15
|
+
fromEnv
|
|
16
|
+
} from "./chunk-5J7GGV62.js";
|
|
20
17
|
import {
|
|
21
18
|
OutboundError
|
|
22
19
|
} from "./chunk-J7DDZ4C2.js";
|
|
@@ -28,6 +25,9 @@ import {
|
|
|
28
25
|
parseJson,
|
|
29
26
|
toJson
|
|
30
27
|
} from "./chunk-BLCJHP5H.js";
|
|
28
|
+
import {
|
|
29
|
+
providers
|
|
30
|
+
} from "./chunk-WH6V3YNN.js";
|
|
31
31
|
|
|
32
32
|
// src/cli/index.ts
|
|
33
33
|
import { parseArgs } from "node:util";
|
|
@@ -410,6 +410,8 @@ var helpText = () => [
|
|
|
410
410
|
" providers",
|
|
411
411
|
...[...COMMANDS.values()].map((command) => ` ${command.help}`),
|
|
412
412
|
" mcp start a local MCP server on stdio (redact is on)",
|
|
413
|
+
" version print the installed version (also --version, -v)",
|
|
414
|
+
" update check npm for a newer version and say how to get it",
|
|
413
415
|
"",
|
|
414
416
|
...GLOBAL_HELP
|
|
415
417
|
].join("\n");
|
|
@@ -641,6 +643,13 @@ var serveStdio = async (server, options = {}) => {
|
|
|
641
643
|
}
|
|
642
644
|
};
|
|
643
645
|
|
|
646
|
+
// src/cli/update.ts
|
|
647
|
+
import { execFile } from "node:child_process";
|
|
648
|
+
import path2 from "node:path";
|
|
649
|
+
import process2 from "node:process";
|
|
650
|
+
import { fileURLToPath } from "node:url";
|
|
651
|
+
import { promisify } from "node:util";
|
|
652
|
+
|
|
644
653
|
// src/cli/version.ts
|
|
645
654
|
import { readFileSync } from "node:fs";
|
|
646
655
|
import { z } from "zod";
|
|
@@ -654,6 +663,84 @@ var packageVersion = () => Manifest.parse(
|
|
|
654
663
|
)
|
|
655
664
|
).version;
|
|
656
665
|
|
|
666
|
+
// src/cli/update.ts
|
|
667
|
+
var PACKAGE = "outbound-sdk";
|
|
668
|
+
var STANDALONE = /* @__PURE__ */ new Map([
|
|
669
|
+
["mcp", []],
|
|
670
|
+
["providers", []],
|
|
671
|
+
["update", []],
|
|
672
|
+
["version", ["version"]]
|
|
673
|
+
]);
|
|
674
|
+
var execFileAsync = promisify(execFile);
|
|
675
|
+
var runNpm = async (args) => {
|
|
676
|
+
try {
|
|
677
|
+
const { stdout } = await execFileAsync("npm", [...args], {
|
|
678
|
+
shell: process2.platform === "win32"
|
|
679
|
+
});
|
|
680
|
+
return stdout;
|
|
681
|
+
} catch (error) {
|
|
682
|
+
const stderr = error instanceof Error && "stderr" in error ? String(error.stderr) : "";
|
|
683
|
+
const said = stderr.trim().split("\n").at(-1) ?? "";
|
|
684
|
+
throw new Error(
|
|
685
|
+
`npm ${args.join(" ")} failed${said === "" ? "" : `: ${said}`}`,
|
|
686
|
+
{ cause: error }
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
var packageDir = () => path2.dirname(fileURLToPath(new URL("../../package.json", import.meta.url)));
|
|
691
|
+
var parts = (version) => version.split("-")[0]?.split(".").map((part) => Math.trunc(Number(part)) || 0) ?? [];
|
|
692
|
+
var older = (a, b) => {
|
|
693
|
+
const [left, right] = [parts(a), parts(b)];
|
|
694
|
+
for (let index = 0; index < 3; index += 1) {
|
|
695
|
+
const difference = (left[index] ?? 0) - (right[index] ?? 0);
|
|
696
|
+
if (difference !== 0) {
|
|
697
|
+
return difference < 0;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
return false;
|
|
701
|
+
};
|
|
702
|
+
var installKind = async (npm, dir) => {
|
|
703
|
+
if (dir.split(path2.sep).includes("_npx")) {
|
|
704
|
+
return "npx";
|
|
705
|
+
}
|
|
706
|
+
const printed = await npm(["root", "--global"]).catch(() => "");
|
|
707
|
+
const globalRoot = printed.trim();
|
|
708
|
+
return globalRoot !== "" && path2.dirname(dir) === path2.resolve(globalRoot) ? "global" : "project";
|
|
709
|
+
};
|
|
710
|
+
var update = async (npm, say) => {
|
|
711
|
+
const installed = packageVersion();
|
|
712
|
+
const viewed = await npm(["view", PACKAGE, "version"]);
|
|
713
|
+
const latest = viewed.trim();
|
|
714
|
+
if (!older(installed, latest)) {
|
|
715
|
+
say(`${PACKAGE} ${installed} is the latest version.`);
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
say(`${PACKAGE} ${installed} is installed; ${latest} is the latest.`);
|
|
719
|
+
const kind = await installKind(npm, packageDir());
|
|
720
|
+
if (kind === "npx") {
|
|
721
|
+
say(`Run "npx ${PACKAGE}@latest <command>" to use ${latest}.`);
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
if (kind === "project") {
|
|
725
|
+
say(`Run "npm install ${PACKAGE}@latest" in this project to update it.`);
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
say(`Running "npm install --global ${PACKAGE}@latest"...`);
|
|
729
|
+
await npm(["install", "--global", `${PACKAGE}@latest`]);
|
|
730
|
+
say(`Updated ${PACKAGE} to ${latest}.`);
|
|
731
|
+
};
|
|
732
|
+
var runSelf = async (name, flags, npm, say) => {
|
|
733
|
+
if (name === "version" || name === void 0 && flags.version === true) {
|
|
734
|
+
say(packageVersion());
|
|
735
|
+
return true;
|
|
736
|
+
}
|
|
737
|
+
if (name === "update" && flags.help !== true) {
|
|
738
|
+
await update(npm, say);
|
|
739
|
+
return true;
|
|
740
|
+
}
|
|
741
|
+
return false;
|
|
742
|
+
};
|
|
743
|
+
|
|
657
744
|
// src/cli/index.ts
|
|
658
745
|
var OPTIONS = {
|
|
659
746
|
bodies: { type: "boolean" },
|
|
@@ -680,7 +767,8 @@ var OPTIONS = {
|
|
|
680
767
|
stats: { type: "boolean" },
|
|
681
768
|
status: { type: "string" },
|
|
682
769
|
subsequences: { type: "boolean" },
|
|
683
|
-
to: { type: "string" }
|
|
770
|
+
to: { type: "string" },
|
|
771
|
+
version: { short: "v", type: "boolean" }
|
|
684
772
|
};
|
|
685
773
|
var serve = async (outbound, io, unmasked) => {
|
|
686
774
|
const { insightTools } = await import("../insights/index.js");
|
|
@@ -723,7 +811,7 @@ var parse = (argv) => {
|
|
|
723
811
|
const [name] = loose.positionals;
|
|
724
812
|
const command = name === void 0 ? void 0 : COMMANDS.get(name);
|
|
725
813
|
const named = name !== void 0 && name !== "help";
|
|
726
|
-
if (named && !command && !
|
|
814
|
+
if (named && !command && !STANDALONE.has(name)) {
|
|
727
815
|
throw new OutboundError(
|
|
728
816
|
"Invalid",
|
|
729
817
|
`Unknown command "${name}". Run "outbound help"`
|
|
@@ -732,7 +820,7 @@ var parse = (argv) => {
|
|
|
732
820
|
if (named) {
|
|
733
821
|
checkFlags(
|
|
734
822
|
name,
|
|
735
|
-
command?.flags ?? [],
|
|
823
|
+
command?.flags ?? STANDALONE.get(name) ?? [],
|
|
736
824
|
loose.tokens.flatMap(
|
|
737
825
|
(token) => token.kind === "option" ? [token.name] : []
|
|
738
826
|
)
|
|
@@ -750,6 +838,9 @@ var run = async (argv, io) => {
|
|
|
750
838
|
try {
|
|
751
839
|
const { help, name, rest, values } = parse(argv);
|
|
752
840
|
const compact = values.compact === true;
|
|
841
|
+
if (await runSelf(name, values, io.npm ?? runNpm, io.stdout)) {
|
|
842
|
+
return 0;
|
|
843
|
+
}
|
|
753
844
|
if (help !== void 0) {
|
|
754
845
|
io.stdout(help);
|
|
755
846
|
return 0;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// src/internal/lead-fields.ts
|
|
2
|
+
var MAPPABLE = [
|
|
3
|
+
"company",
|
|
4
|
+
"companyLinkedinUrl",
|
|
5
|
+
"linkedinUrl",
|
|
6
|
+
"location",
|
|
7
|
+
"phone",
|
|
8
|
+
"title",
|
|
9
|
+
"website"
|
|
10
|
+
];
|
|
11
|
+
var fillFromCustom = (lead, map) => {
|
|
12
|
+
const filled = {};
|
|
13
|
+
for (const field of MAPPABLE) {
|
|
14
|
+
const name = map[field];
|
|
15
|
+
const value = name === void 0 ? void 0 : lead.custom[name]?.trim();
|
|
16
|
+
if (lead[field] === null && value !== void 0 && value !== "") {
|
|
17
|
+
filled[field] = value;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return { ...lead, ...filled };
|
|
21
|
+
};
|
|
22
|
+
var withLeadFields = (readers, map) => {
|
|
23
|
+
if (map === void 0 || Object.keys(map).length === 0) {
|
|
24
|
+
return readers;
|
|
25
|
+
}
|
|
26
|
+
const { getLead, listLeads } = readers;
|
|
27
|
+
const wrapped = {
|
|
28
|
+
...getLead && {
|
|
29
|
+
getLead: async (id, ctx) => fillFromCustom(await getLead(id, ctx), map)
|
|
30
|
+
},
|
|
31
|
+
...listLeads && {
|
|
32
|
+
listLeads: async (query, ctx) => {
|
|
33
|
+
const page = await listLeads(query, ctx);
|
|
34
|
+
return {
|
|
35
|
+
items: page.items.map((lead) => fillFromCustom(lead, map)),
|
|
36
|
+
next: page.next
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return { ...readers, ...wrapped };
|
|
42
|
+
};
|
|
43
|
+
var withMappedFields = (declared, map) => {
|
|
44
|
+
const lead = declared.lead === false ? void 0 : declared.lead;
|
|
45
|
+
if (map === void 0 || lead === void 0) {
|
|
46
|
+
return declared;
|
|
47
|
+
}
|
|
48
|
+
const derived = Object.fromEntries(
|
|
49
|
+
MAPPABLE.flatMap(
|
|
50
|
+
(field) => map[field] !== void 0 && lead[field] === false ? [[field, "derived"]] : []
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
return { ...declared, lead: { ...lead, ...derived } };
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// src/internal/page.ts
|
|
57
|
+
var mapPage = (page, toItem) => ({
|
|
58
|
+
items: page.items.map((raw) => toItem(raw)),
|
|
59
|
+
next: page.next
|
|
60
|
+
});
|
|
61
|
+
var flatMapPage = (page, toItems) => ({
|
|
62
|
+
items: page.items.flatMap((raw) => toItems(raw)),
|
|
63
|
+
next: page.next
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
withLeadFields,
|
|
68
|
+
withMappedFields,
|
|
69
|
+
mapPage,
|
|
70
|
+
flatMapPage
|
|
71
|
+
};
|
|
@@ -2,14 +2,8 @@ import {
|
|
|
2
2
|
defaultRateLimitStore
|
|
3
3
|
} from "./chunk-4O2HRTTI.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
buildUrl
|
|
9
|
-
} from "./chunk-NAWZ73QS.js";
|
|
10
|
-
import {
|
|
11
|
-
sha256Hex
|
|
12
|
-
} from "./chunk-FHKSLCVW.js";
|
|
5
|
+
CAPPED
|
|
6
|
+
} from "./chunk-HPNGSG5E.js";
|
|
13
7
|
import {
|
|
14
8
|
CAPABILITY_KEYS,
|
|
15
9
|
blockEntrySchema,
|
|
@@ -25,6 +19,9 @@ import {
|
|
|
25
19
|
tagSchema,
|
|
26
20
|
webhookSubscriptionSchema
|
|
27
21
|
} from "./chunk-ZOAG2C6V.js";
|
|
22
|
+
import {
|
|
23
|
+
plural
|
|
24
|
+
} from "./chunk-PTZO4QXR.js";
|
|
28
25
|
import {
|
|
29
26
|
campaignSchema,
|
|
30
27
|
leadSchema,
|
|
@@ -38,6 +35,12 @@ import {
|
|
|
38
35
|
import {
|
|
39
36
|
sourceIdFor
|
|
40
37
|
} from "./chunk-QAKJ76HB.js";
|
|
38
|
+
import {
|
|
39
|
+
buildUrl
|
|
40
|
+
} from "./chunk-NAWZ73QS.js";
|
|
41
|
+
import {
|
|
42
|
+
sha256Hex
|
|
43
|
+
} from "./chunk-FHKSLCVW.js";
|
|
41
44
|
import {
|
|
42
45
|
OutboundError,
|
|
43
46
|
redactUrl
|
|
@@ -2252,6 +2255,8 @@ var Outbound = class _Outbound {
|
|
|
2252
2255
|
#core;
|
|
2253
2256
|
#options;
|
|
2254
2257
|
#plugins;
|
|
2258
|
+
// Innermost layers a shared request cap adds; never listed in `plugins`.
|
|
2259
|
+
#layers;
|
|
2255
2260
|
campaigns;
|
|
2256
2261
|
senders;
|
|
2257
2262
|
leads;
|
|
@@ -2265,14 +2270,14 @@ var Outbound = class _Outbound {
|
|
|
2265
2270
|
webhooks;
|
|
2266
2271
|
raw;
|
|
2267
2272
|
native;
|
|
2268
|
-
constructor(options, engine = engineFor(options)) {
|
|
2273
|
+
constructor(options, engine = engineFor(options), layers = []) {
|
|
2269
2274
|
const { adapter } = options;
|
|
2270
2275
|
const plugins = options.plugins ?? [];
|
|
2271
2276
|
assertUniquePluginNames(plugins);
|
|
2272
2277
|
const declared = resolveCapabilities(adapter.capabilities);
|
|
2273
2278
|
const narrowed = narrowCapabilities(declared, plugins);
|
|
2274
2279
|
const run = composeOperations(
|
|
2275
|
-
plugins,
|
|
2280
|
+
[...plugins, ...layers],
|
|
2276
2281
|
(operation, info) => dispatch(
|
|
2277
2282
|
{
|
|
2278
2283
|
adapter,
|
|
@@ -2284,6 +2289,7 @@ var Outbound = class _Outbound {
|
|
|
2284
2289
|
);
|
|
2285
2290
|
this.#options = options;
|
|
2286
2291
|
this.#plugins = plugins;
|
|
2292
|
+
this.#layers = layers;
|
|
2287
2293
|
this.#core = {
|
|
2288
2294
|
adapter,
|
|
2289
2295
|
allowWrites: options.allowWrites ?? false,
|
|
@@ -2392,10 +2398,28 @@ var Outbound = class _Outbound {
|
|
|
2392
2398
|
}
|
|
2393
2399
|
);
|
|
2394
2400
|
}
|
|
2395
|
-
const scoped2 = new _Outbound(
|
|
2401
|
+
const scoped2 = new _Outbound(
|
|
2402
|
+
{ ...this.#options, adapter: member },
|
|
2403
|
+
engine,
|
|
2404
|
+
this.#layers
|
|
2405
|
+
);
|
|
2396
2406
|
installExtensions(scoped2, this.#plugins);
|
|
2397
2407
|
return scoped2;
|
|
2398
2408
|
}
|
|
2409
|
+
/** For a cap shared across calls, as insights and tools use. Not public. */
|
|
2410
|
+
get [CAPPED]() {
|
|
2411
|
+
return {
|
|
2412
|
+
costs: this.#core.adapter.costs,
|
|
2413
|
+
guarded: (layer) => {
|
|
2414
|
+
const copy = new _Outbound(this.#options, this.#core.engine, [
|
|
2415
|
+
...this.#layers,
|
|
2416
|
+
layer
|
|
2417
|
+
]);
|
|
2418
|
+
installExtensions(copy, this.#plugins);
|
|
2419
|
+
return copy;
|
|
2420
|
+
}
|
|
2421
|
+
};
|
|
2422
|
+
}
|
|
2399
2423
|
stats(options) {
|
|
2400
2424
|
return readStats(this.#core, options);
|
|
2401
2425
|
}
|
package/dist/cli/bin.js
CHANGED
|
@@ -1,39 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import "../chunks/chunk-
|
|
6
|
-
import "../chunks/chunk-
|
|
7
|
-
import "../chunks/chunk-LVQUSKEX.js";
|
|
2
|
+
import "../chunks/chunk-WGW3ROLY.js";
|
|
3
|
+
import "../chunks/chunk-X4RDBD4J.js";
|
|
4
|
+
import "../chunks/chunk-OLPMBRXM.js";
|
|
5
|
+
import "../chunks/chunk-BK5SLY32.js";
|
|
6
|
+
import "../chunks/chunk-HWHI4LFY.js";
|
|
8
7
|
import "../chunks/chunk-4PA526S7.js";
|
|
9
8
|
import "../chunks/chunk-HZCTYL22.js";
|
|
10
|
-
import "../chunks/chunk-
|
|
9
|
+
import "../chunks/chunk-YYCT3NGV.js";
|
|
11
10
|
import "../chunks/chunk-4O2HRTTI.js";
|
|
11
|
+
import "../chunks/chunk-HPNGSG5E.js";
|
|
12
|
+
import "../chunks/chunk-ZOAG2C6V.js";
|
|
12
13
|
import "../chunks/chunk-PTZO4QXR.js";
|
|
14
|
+
import "../chunks/chunk-BOWXGMN3.js";
|
|
13
15
|
import "../chunks/chunk-PQSTQKRD.js";
|
|
16
|
+
import "../chunks/chunk-QGRZDTX4.js";
|
|
17
|
+
import "../chunks/chunk-QAKJ76HB.js";
|
|
14
18
|
import "../chunks/chunk-NAWZ73QS.js";
|
|
15
19
|
import "../chunks/chunk-FHKSLCVW.js";
|
|
16
|
-
import "../chunks/chunk-
|
|
20
|
+
import "../chunks/chunk-5J7GGV62.js";
|
|
17
21
|
import "../chunks/chunk-GFDNRWR3.js";
|
|
18
|
-
import "../chunks/chunk-7ZDS6SZD.js";
|
|
19
|
-
import "../chunks/chunk-ZOAG2C6V.js";
|
|
20
|
-
import "../chunks/chunk-BOWXGMN3.js";
|
|
21
|
-
import "../chunks/chunk-QGRZDTX4.js";
|
|
22
|
-
import "../chunks/chunk-QAKJ76HB.js";
|
|
23
22
|
import "../chunks/chunk-J7DDZ4C2.js";
|
|
24
23
|
import "../chunks/chunk-BLCJHP5H.js";
|
|
25
|
-
|
|
26
|
-
// src/cli/bin.ts
|
|
27
|
-
import process from "node:process";
|
|
28
|
-
import { createInterface } from "node:readline";
|
|
29
|
-
process.exitCode = await run(process.argv.slice(2), {
|
|
30
|
-
stderr: (text) => {
|
|
31
|
-
process.stderr.write(`${text}
|
|
32
|
-
`);
|
|
33
|
-
},
|
|
34
|
-
stdin: () => createInterface({ input: process.stdin }),
|
|
35
|
-
stdout: (text) => {
|
|
36
|
-
process.stdout.write(`${text}
|
|
37
|
-
`);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
24
|
+
import "../chunks/chunk-WH6V3YNN.js";
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type { CliConfig } from "./config.ts";
|
|
|
4
4
|
export { createMcpServer, PROTOCOL_VERSIONS } from "./mcp.ts";
|
|
5
5
|
export type { McpServer, McpServerOptions } from "./mcp.ts";
|
|
6
6
|
export { serveStdio } from "./stdio.ts";
|
|
7
|
+
export type { NpmRunner } from "./update.ts";
|
|
7
8
|
export type { StdioOptions } from "./stdio.ts";
|
|
8
9
|
export interface CliIo {
|
|
9
10
|
readonly stdout: (text: string) => void;
|
|
@@ -12,6 +13,8 @@ export interface CliIo {
|
|
|
12
13
|
readonly stdin?: (() => AsyncIterable<string> | Iterable<string>) | undefined;
|
|
13
14
|
/** Replaces the adapter the environment would choose. Meant for tests. */
|
|
14
15
|
readonly adapter?: Adapter | undefined;
|
|
16
|
+
/** Runs npm for `outbound update` and resolves to its output. Meant for tests. */
|
|
17
|
+
readonly npm?: ((args: readonly string[]) => Promise<string>) | undefined;
|
|
15
18
|
}
|
|
16
19
|
/** Runs the CLI. Returns the process exit code. */
|
|
17
20
|
export declare const run: (argv: readonly string[], io: CliIo) => Promise<number>;
|
package/dist/cli/index.js
CHANGED
|
@@ -4,27 +4,28 @@ import {
|
|
|
4
4
|
defineConfig,
|
|
5
5
|
run,
|
|
6
6
|
serveStdio
|
|
7
|
-
} from "../chunks/chunk-
|
|
8
|
-
import "../chunks/chunk-
|
|
9
|
-
import "../chunks/chunk-
|
|
10
|
-
import "../chunks/chunk-
|
|
7
|
+
} from "../chunks/chunk-X4RDBD4J.js";
|
|
8
|
+
import "../chunks/chunk-OLPMBRXM.js";
|
|
9
|
+
import "../chunks/chunk-BK5SLY32.js";
|
|
10
|
+
import "../chunks/chunk-HWHI4LFY.js";
|
|
11
11
|
import "../chunks/chunk-4PA526S7.js";
|
|
12
12
|
import "../chunks/chunk-HZCTYL22.js";
|
|
13
|
-
import "../chunks/chunk-
|
|
13
|
+
import "../chunks/chunk-YYCT3NGV.js";
|
|
14
14
|
import "../chunks/chunk-4O2HRTTI.js";
|
|
15
|
+
import "../chunks/chunk-HPNGSG5E.js";
|
|
16
|
+
import "../chunks/chunk-ZOAG2C6V.js";
|
|
15
17
|
import "../chunks/chunk-PTZO4QXR.js";
|
|
18
|
+
import "../chunks/chunk-BOWXGMN3.js";
|
|
16
19
|
import "../chunks/chunk-PQSTQKRD.js";
|
|
20
|
+
import "../chunks/chunk-QGRZDTX4.js";
|
|
21
|
+
import "../chunks/chunk-QAKJ76HB.js";
|
|
17
22
|
import "../chunks/chunk-NAWZ73QS.js";
|
|
18
23
|
import "../chunks/chunk-FHKSLCVW.js";
|
|
19
|
-
import "../chunks/chunk-
|
|
24
|
+
import "../chunks/chunk-5J7GGV62.js";
|
|
20
25
|
import "../chunks/chunk-GFDNRWR3.js";
|
|
21
|
-
import "../chunks/chunk-7ZDS6SZD.js";
|
|
22
|
-
import "../chunks/chunk-ZOAG2C6V.js";
|
|
23
|
-
import "../chunks/chunk-BOWXGMN3.js";
|
|
24
|
-
import "../chunks/chunk-QGRZDTX4.js";
|
|
25
|
-
import "../chunks/chunk-QAKJ76HB.js";
|
|
26
26
|
import "../chunks/chunk-J7DDZ4C2.js";
|
|
27
27
|
import "../chunks/chunk-BLCJHP5H.js";
|
|
28
|
+
import "../chunks/chunk-WH6V3YNN.js";
|
|
28
29
|
export {
|
|
29
30
|
PROTOCOL_VERSIONS,
|
|
30
31
|
createMcpServer,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Runs npm with these arguments and resolves to what it printed. */
|
|
2
|
+
export type NpmRunner = (args: readonly string[]) => Promise<string>;
|
|
3
|
+
export declare const STANDALONE: ReadonlyMap<string, readonly string[]>;
|
|
4
|
+
export declare const runNpm: NpmRunner;
|
|
5
|
+
/** Checks npm for a newer version and updates a global install. */
|
|
6
|
+
export declare const update: (npm: NpmRunner, say: (text: string) => void) => Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Runs `version` (also a bare `--version`) or `update`, and says whether it
|
|
9
|
+
* did. Version comes before help, which is what no command at all prints;
|
|
10
|
+
* `update --help` prints help.
|
|
11
|
+
*/
|
|
12
|
+
export declare const runSelf: (name: string | undefined, flags: {
|
|
13
|
+
readonly help?: boolean;
|
|
14
|
+
readonly version?: boolean;
|
|
15
|
+
}, npm: NpmRunner, say: (text: string) => void) => Promise<boolean>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Adapter } from "../internal/adapter.ts";
|
|
2
|
+
import type { EmailBisonClient } from "./client.ts";
|
|
3
|
+
type Readers = Pick<Adapter, "getCampaignSettings" | "getList" | "getSenderHealth" | "getWebhook" | "listBlocklist" | "listLists" | "listTags" | "listWebhooks" | "listWorkspaces">;
|
|
4
|
+
/** The warmup window sender health reads: the last 7 days, in UTC days. */
|
|
5
|
+
export declare const WARMUP_DAYS = 7;
|
|
6
|
+
export declare const accountReaders: (client: EmailBisonClient, now?: () => number) => Readers;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Adapter } from "../internal/adapter.ts";
|
|
2
|
+
import type { EmailBisonClient } from "./client.ts";
|
|
3
|
+
type Readers = Pick<Adapter, "getCampaign" | "getCampaignSettings" | "getLead" | "getList" | "getSender" | "getSenderHealth" | "getSequence" | "getWebhook" | "listBlocklist" | "listCampaigns" | "listLeads" | "listLists" | "listMessages" | "listReplies" | "listSenders" | "listTags" | "listWebhooks" | "listWorkspaces" | "stats">;
|
|
4
|
+
export declare const readers: (client: EmailBisonClient) => Readers;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
/**
|
|
5
|
+
* The reference's only server. A customer's own instance is the URL they log
|
|
6
|
+
* in with, so most callers pass `baseUrl` or set `EMAILBISON_BASE_URL`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const BASE_URL = "https://dedi.emailbison.com";
|
|
9
|
+
export declare const API_KEY_ENV = "EMAILBISON_API_KEY";
|
|
10
|
+
export declare const BASE_URL_ENV = "EMAILBISON_BASE_URL";
|
|
11
|
+
export declare const WORKSPACE_ENV = "EMAILBISON_WORKSPACE_ID";
|
|
12
|
+
/** Every list answers 15 records per page, and no page size can be asked for. */
|
|
13
|
+
export declare const PAGE_SIZE = 15;
|
|
14
|
+
export declare const capabilities: CapabilityDeclaration;
|
|
15
|
+
export declare const fields: FieldDeclaration;
|
|
16
|
+
export declare const limits: LimitDeclaration;
|
|
17
|
+
export declare const costs: {
|
|
18
|
+
"blocklist.list": {
|
|
19
|
+
pageSize: number;
|
|
20
|
+
perPage: number;
|
|
21
|
+
};
|
|
22
|
+
"campaigns.get": {
|
|
23
|
+
perPage: number;
|
|
24
|
+
};
|
|
25
|
+
"campaigns.list": {
|
|
26
|
+
pageSize: number;
|
|
27
|
+
perPage: number;
|
|
28
|
+
};
|
|
29
|
+
"campaigns.settings": {
|
|
30
|
+
perPage: number;
|
|
31
|
+
};
|
|
32
|
+
"leads.get": {
|
|
33
|
+
perPage: number;
|
|
34
|
+
};
|
|
35
|
+
"leads.list": {
|
|
36
|
+
pageSize: number;
|
|
37
|
+
perPage: number;
|
|
38
|
+
};
|
|
39
|
+
"lists.list": {
|
|
40
|
+
pageSize: number;
|
|
41
|
+
perPage: number;
|
|
42
|
+
};
|
|
43
|
+
"messages.list": {
|
|
44
|
+
pageSize: number;
|
|
45
|
+
perPage: number;
|
|
46
|
+
};
|
|
47
|
+
"replies.list": {
|
|
48
|
+
pageSize: number;
|
|
49
|
+
perPage: number;
|
|
50
|
+
};
|
|
51
|
+
"senders.get": {
|
|
52
|
+
perPage: number;
|
|
53
|
+
};
|
|
54
|
+
"senders.health": {
|
|
55
|
+
perPage: number;
|
|
56
|
+
};
|
|
57
|
+
"senders.list": {
|
|
58
|
+
pageSize: number;
|
|
59
|
+
perPage: number;
|
|
60
|
+
};
|
|
61
|
+
"sequence.get": {
|
|
62
|
+
perPage: number;
|
|
63
|
+
};
|
|
64
|
+
stats: {
|
|
65
|
+
perPage: number;
|
|
66
|
+
};
|
|
67
|
+
"tags.list": {
|
|
68
|
+
perPage: number;
|
|
69
|
+
};
|
|
70
|
+
"webhooks.list": {
|
|
71
|
+
pageSize: number;
|
|
72
|
+
perPage: number;
|
|
73
|
+
};
|
|
74
|
+
"workspaces.list": {
|
|
75
|
+
perPage: number;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export declare const caveats: readonly string[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AdapterContext, HttpMethod, RawDescriptor } from "../internal/adapter.ts";
|
|
2
|
+
import type { RequestOptions, VendorClient } from "../internal/client.ts";
|
|
3
|
+
import type { Json, JsonObject } from "../internal/json.ts";
|
|
4
|
+
import type { RawPage } from "../internal/page.ts";
|
|
5
|
+
import type { Identity } from "../internal/record.ts";
|
|
6
|
+
export interface ClientOptions {
|
|
7
|
+
readonly apiKey: string;
|
|
8
|
+
readonly baseUrl: string | undefined;
|
|
9
|
+
readonly identity: Identity;
|
|
10
|
+
}
|
|
11
|
+
export interface EmailBisonClient extends VendorClient {
|
|
12
|
+
readonly identity: Identity;
|
|
13
|
+
readonly raw: RawDescriptor;
|
|
14
|
+
/** `data` of an answer that must be one object, or a `Provider` error. */
|
|
15
|
+
readonly one: (body: Json, path: string) => JsonObject;
|
|
16
|
+
/** `data` of an answer that must be a list, or a `Provider` error. */
|
|
17
|
+
readonly rows: (body: Json, path: string) => JsonObject[];
|
|
18
|
+
/** One page of a list, and where the next one starts. */
|
|
19
|
+
readonly page: (ctx: AdapterContext, path: string, next: Json | undefined, options?: PageOptions) => Promise<RawPage>;
|
|
20
|
+
}
|
|
21
|
+
export interface PageOptions extends RequestOptions {
|
|
22
|
+
/** The reference documents cursor pagination for this list. */
|
|
23
|
+
readonly cursor?: boolean | undefined;
|
|
24
|
+
}
|
|
25
|
+
export declare const isSecret: (path: string) => boolean;
|
|
26
|
+
export declare const isRead: (method: HttpMethod, path: string) => boolean;
|
|
27
|
+
/** The keys of a vendor payload that hold a secret, at any depth. */
|
|
28
|
+
export declare const SECRET_KEYS: RegExp;
|
|
29
|
+
export declare const createClient: (options: ClientOptions) => EmailBisonClient;
|
|
@@ -0,0 +1,30 @@
|
|
|
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 type { EmailBisonNative } from "./native.ts";
|
|
5
|
+
export declare const PROVIDER = "emailbison";
|
|
6
|
+
/** The environment variables this adapter reads. */
|
|
7
|
+
export declare const envVars: readonly ["EMAILBISON_API_KEY", "EMAILBISON_BASE_URL", "EMAILBISON_WORKSPACE_ID"];
|
|
8
|
+
export interface EmailBisonOptions {
|
|
9
|
+
/** Defaults to `EMAILBISON_API_KEY`. An `api-user` key is scoped to one workspace. */
|
|
10
|
+
readonly apiKey?: string | undefined;
|
|
11
|
+
/** A label for this client or workspace. Defaults to `EMAILBISON_WORKSPACE_ID`, then `default`. */
|
|
12
|
+
readonly workspaceId?: string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The URL you log in to EmailBison with, such as
|
|
15
|
+
* `https://send.example.com`. Defaults to `EMAILBISON_BASE_URL`, then
|
|
16
|
+
* `https://dedi.emailbison.com`.
|
|
17
|
+
*/
|
|
18
|
+
readonly baseUrl?: string | undefined;
|
|
19
|
+
/** Overrides what the adapter declares, for example on a key some endpoints refuse. */
|
|
20
|
+
readonly capabilities?: CapabilityDeclaration | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Which of a lead's custom variables holds a value EmailBison has no field
|
|
23
|
+
* for, for example `{ linkedinUrl: "linkedin_url" }`. Read only where the
|
|
24
|
+
* vendor's own field is empty.
|
|
25
|
+
*/
|
|
26
|
+
readonly leadFields?: LeadFieldMap | undefined;
|
|
27
|
+
}
|
|
28
|
+
export { NATIVE } from "./native.ts";
|
|
29
|
+
export type { EmailBisonNative } from "./native.ts";
|
|
30
|
+
export declare const emailbison: (options?: EmailBisonOptions) => Adapter<EmailBisonNative>;
|