outbound-sdk 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +121 -2
- package/dist/alerts/index.d.ts +2 -0
- package/dist/alerts/index.js +136 -0
- package/dist/alerts/plugin.d.ts +58 -0
- package/dist/audit/index.d.ts +33 -0
- package/dist/audit/index.js +60 -0
- package/dist/benchmarks/index.d.ts +29 -0
- package/dist/benchmarks/index.js +70 -0
- package/dist/budget/index.d.ts +21 -0
- package/dist/budget/index.js +50 -0
- package/dist/cache/index.d.ts +31 -0
- package/dist/cache/index.js +11 -0
- package/dist/cards/content.d.ts +43 -0
- package/dist/cards/copy-cards.d.ts +2 -0
- package/dist/cards/format.d.ts +39 -0
- package/dist/cards/index.d.ts +9 -0
- package/dist/cards/index.js +2070 -0
- package/dist/cards/notify-cards.d.ts +14 -0
- package/dist/cards/ops-cards.d.ts +2 -0
- package/dist/cards/parts.d.ts +22 -0
- package/dist/cards/people-cards.d.ts +2 -0
- package/dist/cards/render.d.ts +28 -0
- package/dist/cards/sender-cards.d.ts +2 -0
- package/dist/cards/slack-rich.d.ts +19 -0
- package/dist/cards/slack-text.d.ts +10 -0
- package/dist/cards/slack.d.ts +21 -0
- package/dist/cards/spec.d.ts +86 -0
- package/dist/cards/tool-cards.d.ts +4 -0
- package/dist/chunks/chunk-4O2HRTTI.js +75 -0
- package/dist/chunks/chunk-7BCYLIDG.js +483 -0
- package/dist/chunks/chunk-B7V6EOAC.js +2273 -0
- package/dist/chunks/chunk-CMQ5ZHLZ.js +25 -0
- package/dist/chunks/chunk-F7MKFVIG.js +43 -0
- package/dist/chunks/chunk-FZF6CLPX.js +232 -0
- package/dist/chunks/chunk-GPEJG34O.js +53 -0
- package/dist/chunks/chunk-HEC7XFFH.js +65 -0
- package/dist/chunks/chunk-IBC52BX3.js +24 -0
- package/dist/chunks/chunk-LNCOGBMI.js +144 -0
- package/dist/chunks/chunk-LOXBLQ3I.js +180 -0
- package/dist/chunks/chunk-NAWZ73QS.js +22 -0
- package/dist/chunks/chunk-OCV66TS2.js +705 -0
- package/dist/chunks/chunk-Q465X22Y.js +548 -0
- package/dist/chunks/chunk-QTB747K4.js +100 -0
- package/dist/chunks/chunk-QZNNCXXD.js +92 -0
- package/dist/chunks/chunk-R6AM4GJR.js +105 -0
- package/dist/chunks/chunk-TIJKJJDW.js +6 -0
- package/dist/chunks/chunk-VURTOVGI.js +61 -0
- package/dist/chunks/chunk-WAM6N4OF.js +269 -0
- package/dist/chunks/chunk-WW746NJF.js +94 -0
- package/dist/chunks/chunk-XC6CZP73.js +80 -0
- package/dist/chunks/chunk-ZGHQYZEH.js +45 -0
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +34 -0
- package/dist/cli/commands.d.ts +16 -0
- package/dist/cli/index.d.ts +13 -0
- package/dist/cli/index.js +25 -0
- package/dist/cli/mcp.d.ts +14 -0
- package/dist/clients/index.d.ts +2 -0
- package/dist/clients/index.js +107 -0
- package/dist/clients/plugin.d.ts +42 -0
- package/dist/combine/account.d.ts +4 -0
- package/dist/combine/adapter.d.ts +9 -0
- package/dist/combine/index.d.ts +2 -0
- package/dist/combine/index.js +345 -0
- package/dist/combine/route.d.ts +17 -0
- package/dist/exporter/index.d.ts +29 -0
- package/dist/exporter/index.js +77 -0
- package/dist/failover/index.d.ts +11 -0
- package/dist/failover/index.js +45 -0
- package/dist/fixtures/index.d.ts +27 -0
- package/dist/fixtures/index.js +241 -0
- package/dist/fixtures/scrub.d.ts +5 -0
- package/dist/heyreach/account.d.ts +11 -0
- package/dist/heyreach/adapter.d.ts +5 -0
- package/dist/heyreach/capabilities.d.ts +68 -0
- package/dist/heyreach/client.d.ts +20 -0
- package/dist/heyreach/inbox.d.ts +7 -0
- package/dist/heyreach/index.d.ts +18 -0
- package/dist/heyreach/index.js +1708 -0
- package/dist/heyreach/lookup.d.ts +15 -0
- package/dist/heyreach/map-account.d.ts +25 -0
- package/dist/heyreach/map-sequence.d.ts +5 -0
- package/dist/heyreach/map-stats.d.ts +10 -0
- package/dist/heyreach/map.d.ts +35 -0
- package/dist/heyreach/native-organization.d.ts +128 -0
- package/dist/heyreach/native-voice.d.ts +106 -0
- package/dist/heyreach/native.d.ts +496 -0
- package/dist/heyreach/paging.d.ts +7 -0
- package/dist/heyreach/webhooks.d.ts +2 -0
- package/dist/identity/index.d.ts +3 -0
- package/dist/identity/index.js +148 -0
- package/dist/identity/keys.d.ts +9 -0
- package/dist/identity/plugin.d.ts +34 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +119 -0
- package/dist/insights/copy/copy-audit.d.ts +55 -0
- package/dist/insights/copy/copy-checks.d.ts +44 -0
- package/dist/insights/copy/copy-reuse.d.ts +59 -0
- package/dist/insights/copy/index.d.ts +67 -0
- package/dist/insights/copy/reply-timing.d.ts +63 -0
- package/dist/insights/copy/shared.d.ts +53 -0
- package/dist/insights/copy/step-funnel.d.ts +66 -0
- package/dist/insights/copy/variant-test.d.ts +64 -0
- package/dist/insights/define.d.ts +98 -0
- package/dist/insights/index.d.ts +10 -0
- package/dist/insights/index.js +4873 -0
- package/dist/insights/ops/anomalies.d.ts +80 -0
- package/dist/insights/ops/campaign-diagnosis.d.ts +39 -0
- package/dist/insights/ops/campaign-ranking.d.ts +56 -0
- package/dist/insights/ops/channel-mix.d.ts +44 -0
- package/dist/insights/ops/client-report.d.ts +76 -0
- package/dist/insights/ops/diagnosis-checks.d.ts +48 -0
- package/dist/insights/ops/index.d.ts +135 -0
- package/dist/insights/ops/period-comparison.d.ts +86 -0
- package/dist/insights/ops/pipeline-forecast.d.ts +44 -0
- package/dist/insights/ops/shared.d.ts +149 -0
- package/dist/insights/ops/tag-rollup.d.ts +32 -0
- package/dist/insights/people/account-summary.d.ts +68 -0
- package/dist/insights/people/dropped-replies.d.ts +51 -0
- package/dist/insights/people/find.d.ts +18 -0
- package/dist/insights/people/hot-leads.d.ts +67 -0
- package/dist/insights/people/index.d.ts +88 -0
- package/dist/insights/people/lead-collisions.d.ts +43 -0
- package/dist/insights/people/person-summary.d.ts +46 -0
- package/dist/insights/people/personalization-gaps.d.ts +60 -0
- package/dist/insights/people/read.d.ts +40 -0
- package/dist/insights/people/suppression-check.d.ts +53 -0
- package/dist/insights/plugin.d.ts +40 -0
- package/dist/insights/registry.d.ts +335 -0
- package/dist/insights/senders/bounce-watch.d.ts +70 -0
- package/dist/insights/senders/domain-health.d.ts +69 -0
- package/dist/insights/senders/index.d.ts +74 -0
- package/dist/insights/senders/read.d.ts +37 -0
- package/dist/insights/senders/sender-capacity.d.ts +67 -0
- package/dist/insights/senders/sender-load.d.ts +52 -0
- package/dist/insights/senders/settings-audit.d.ts +48 -0
- package/dist/insights/senders/warmup-readiness.d.ts +39 -0
- package/dist/insights/stats.d.ts +45 -0
- package/dist/insights/tools.d.ts +16 -0
- package/dist/insights/types.d.ts +4 -0
- package/dist/instantly/adapter-account.d.ts +5 -0
- package/dist/instantly/adapter-mail.d.ts +3 -0
- package/dist/instantly/adapter.d.ts +7 -0
- package/dist/instantly/capabilities.d.ts +83 -0
- package/dist/instantly/client.d.ts +29 -0
- package/dist/instantly/index.d.ts +20 -0
- package/dist/instantly/index.js +2372 -0
- package/dist/instantly/map-account.d.ts +23 -0
- package/dist/instantly/map-lead.d.ts +18 -0
- package/dist/instantly/map-stats.d.ts +22 -0
- package/dist/instantly/map.d.ts +24 -0
- package/dist/instantly/native-agents-sales.d.ts +161 -0
- package/dist/instantly/native-agents.d.ts +156 -0
- package/dist/instantly/native-campaigns.d.ts +101 -0
- package/dist/instantly/native-leads.d.ts +93 -0
- package/dist/instantly/native-params.d.ts +24 -0
- package/dist/instantly/native-search.d.ts +82 -0
- package/dist/instantly/native-senders.d.ts +182 -0
- package/dist/instantly/native-supersearch.d.ts +149 -0
- package/dist/instantly/native-workspace.d.ts +170 -0
- package/dist/instantly/native.d.ts +1081 -0
- package/dist/instantly/pages.d.ts +29 -0
- package/dist/instantly/stats.d.ts +5 -0
- package/dist/instantly/webhooks.d.ts +2 -0
- package/dist/internal/adapter.d.ts +189 -0
- package/dist/internal/capabilities.d.ts +86 -0
- package/dist/internal/cursor.d.ts +10 -0
- package/dist/internal/engine/budget.d.ts +44 -0
- package/dist/internal/engine/engine.d.ts +45 -0
- package/dist/internal/engine/rate-store.d.ts +25 -0
- package/dist/internal/engine/request.d.ts +27 -0
- package/dist/internal/engine/retry.d.ts +21 -0
- package/dist/internal/engine/runtime.d.ts +13 -0
- package/dist/internal/entities-account.d.ts +135 -0
- package/dist/internal/entities.d.ts +389 -0
- package/dist/internal/env.d.ts +4 -0
- package/dist/internal/errors.d.ts +57 -0
- package/dist/internal/hooks.d.ts +55 -0
- package/dist/internal/json.d.ts +40 -0
- package/dist/internal/limits.d.ts +34 -0
- package/dist/internal/metrics.d.ts +52 -0
- package/dist/internal/native.d.ts +66 -0
- package/dist/internal/outbound/api.d.ts +267 -0
- package/dist/internal/outbound/collections.d.ts +31 -0
- package/dist/internal/outbound/core.d.ts +36 -0
- package/dist/internal/outbound/create.d.ts +16 -0
- package/dist/internal/outbound/handles.d.ts +7 -0
- package/dist/internal/outbound/native.d.ts +4 -0
- package/dist/internal/outbound/operation-shared.d.ts +28 -0
- package/dist/internal/outbound/operations-account.d.ts +29 -0
- package/dist/internal/outbound/operations.d.ts +42 -0
- package/dist/internal/outbound/outbound.d.ts +64 -0
- package/dist/internal/outbound/plugins.d.ts +40 -0
- package/dist/internal/outbound/raw.d.ts +9 -0
- package/dist/internal/outbound/specs-account.d.ts +16 -0
- package/dist/internal/outbound/specs.d.ts +14 -0
- package/dist/internal/outbound/stats.d.ts +7 -0
- package/dist/internal/outbound/validate.d.ts +5 -0
- package/dist/internal/outbound/walker.d.ts +22 -0
- package/dist/internal/record.d.ts +19 -0
- package/dist/internal/redact.d.ts +18 -0
- package/dist/internal/ref.d.ts +16 -0
- package/dist/internal/sha256.d.ts +4 -0
- package/dist/internal/text.d.ts +11 -0
- package/dist/internal/url.d.ts +9 -0
- package/dist/loader/index.d.ts +12 -0
- package/dist/loader/index.js +12 -0
- package/dist/memory/account-reads.d.ts +5 -0
- package/dist/memory/account.d.ts +67 -0
- package/dist/memory/adapter.d.ts +16 -0
- package/dist/memory/data.d.ts +122 -0
- package/dist/memory/demo.d.ts +7 -0
- package/dist/memory/index.d.ts +5 -0
- package/dist/memory/index.js +792 -0
- package/dist/memory/stats.d.ts +6 -0
- package/dist/memory/store.d.ts +18 -0
- package/dist/providers/index.d.ts +22 -0
- package/dist/providers/index.js +10 -0
- package/dist/reconcile/index.d.ts +2 -0
- package/dist/reconcile/index.js +72 -0
- package/dist/reconcile/plugin.d.ts +55 -0
- package/dist/redact/index.d.ts +2 -0
- package/dist/redact/index.js +192 -0
- package/dist/redact/plugin.d.ts +22 -0
- package/dist/redis/index.d.ts +41 -0
- package/dist/redis/index.js +114 -0
- package/dist/smartlead/account.d.ts +5 -0
- package/dist/smartlead/adapter.d.ts +5 -0
- package/dist/smartlead/capabilities.d.ts +85 -0
- package/dist/smartlead/client.d.ts +23 -0
- package/dist/smartlead/hmac.d.ts +9 -0
- package/dist/smartlead/index.d.ts +17 -0
- package/dist/smartlead/index.js +2170 -0
- package/dist/smartlead/leads.d.ts +6 -0
- package/dist/smartlead/lookup.d.ts +8 -0
- package/dist/smartlead/mail.d.ts +5 -0
- package/dist/smartlead/map-account.d.ts +22 -0
- package/dist/smartlead/map-messages.d.ts +31 -0
- package/dist/smartlead/map-stats.d.ts +37 -0
- package/dist/smartlead/map.d.ts +52 -0
- package/dist/smartlead/native-analytics.d.ts +242 -0
- package/dist/smartlead/native-campaigns.d.ts +211 -0
- package/dist/smartlead/native-inbox.d.ts +141 -0
- package/dist/smartlead/native-params.d.ts +33 -0
- package/dist/smartlead/native-services.d.ts +204 -0
- package/dist/smartlead/native.d.ts +785 -0
- package/dist/smartlead/shared.d.ts +28 -0
- package/dist/smartlead/stats.d.ts +5 -0
- package/dist/smartlead/webhooks.d.ts +2 -0
- package/dist/sync/index.d.ts +2 -0
- package/dist/sync/index.js +158 -0
- package/dist/sync/plugin.d.ts +58 -0
- package/dist/tools/account-tools.d.ts +21 -0
- package/dist/tools/ai-sdk.d.ts +8 -0
- package/dist/tools/ai-sdk.js +26 -0
- package/dist/tools/campaign-tools.d.ts +59 -0
- package/dist/tools/claude-agent.d.ts +18 -0
- package/dist/tools/claude-agent.js +40 -0
- package/dist/tools/index.d.ts +28 -0
- package/dist/tools/index.js +20 -0
- package/dist/tools/people-tools.d.ts +19 -0
- package/dist/tools/registry.d.ts +34 -0
- package/dist/tools/shared.d.ts +75 -0
- package/dist/tracing/index.d.ts +25 -0
- package/dist/tracing/index.js +69 -0
- package/dist/webhooks/index.d.ts +3 -0
- package/dist/webhooks/index.js +226 -0
- package/dist/webhooks/parse.d.ts +41 -0
- package/dist/webhooks/secret.d.ts +4 -0
- package/package.json +181 -4
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// src/providers/index.ts
|
|
2
|
+
var providers = [
|
|
3
|
+
{
|
|
4
|
+
channels: ["email"],
|
|
5
|
+
docsUrl: "https://developer.instantly.ai/",
|
|
6
|
+
envVars: [
|
|
7
|
+
{
|
|
8
|
+
description: "API V2 key. The all:read scope is enough.",
|
|
9
|
+
name: "INSTANTLY_API_KEY",
|
|
10
|
+
required: true
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
description: "A label for this client or workspace.",
|
|
14
|
+
name: "INSTANTLY_WORKSPACE_ID",
|
|
15
|
+
required: false
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
id: "instantly",
|
|
19
|
+
maturity: "beta",
|
|
20
|
+
name: "Instantly",
|
|
21
|
+
note: "Its reads were run, read-only, against one live workspace. Fixtures are built from the documentation."
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
channels: ["email"],
|
|
25
|
+
docsUrl: "https://api.smartlead.ai",
|
|
26
|
+
envVars: [
|
|
27
|
+
{
|
|
28
|
+
description: "API key. It is sent as a query parameter.",
|
|
29
|
+
name: "SMARTLEAD_API_KEY",
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
description: "A label for this client or workspace.",
|
|
34
|
+
name: "SMARTLEAD_WORKSPACE_ID",
|
|
35
|
+
required: false
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
id: "smartlead",
|
|
39
|
+
maturity: "unverified",
|
|
40
|
+
name: "Smartlead",
|
|
41
|
+
note: "Never run against a live account. Written from the public documentation and tested offline only."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
channels: ["linkedin"],
|
|
45
|
+
docsUrl: "https://docs.heyreach.io/hey-reach-api.md",
|
|
46
|
+
envVars: [
|
|
47
|
+
{
|
|
48
|
+
description: "A workspace API key.",
|
|
49
|
+
name: "HEYREACH_API_KEY",
|
|
50
|
+
required: true
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
description: "A label for this client or workspace.",
|
|
54
|
+
name: "HEYREACH_WORKSPACE_ID",
|
|
55
|
+
required: false
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
id: "heyreach",
|
|
59
|
+
maturity: "beta",
|
|
60
|
+
name: "HeyReach",
|
|
61
|
+
note: "Its reads were run, read-only, against one live workspace. Fixtures are built from the documentation."
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
channels: ["email", "linkedin"],
|
|
65
|
+
docsUrl: null,
|
|
66
|
+
envVars: [],
|
|
67
|
+
id: "memory",
|
|
68
|
+
maturity: "stable",
|
|
69
|
+
name: "In-memory (tests and demos)",
|
|
70
|
+
note: "Holds data in memory. For tests and demos; there is no vendor behind it."
|
|
71
|
+
}
|
|
72
|
+
];
|
|
73
|
+
var findProvider = (id) => providers.find((provider) => provider.id === id);
|
|
74
|
+
var PROVIDER_ENV = "OUTBOUND_SDK_PROVIDER";
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
providers,
|
|
78
|
+
findProvider,
|
|
79
|
+
PROVIDER_ENV
|
|
80
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OutboundError
|
|
3
|
+
} from "./chunk-LOXBLQ3I.js";
|
|
4
|
+
|
|
5
|
+
// src/internal/ref.ts
|
|
6
|
+
var SEPARATOR = ":";
|
|
7
|
+
var makeRef = (provider, workspaceId, sourceId) => [provider, workspaceId, String(sourceId)].join(SEPARATOR);
|
|
8
|
+
var parseRef = (ref) => {
|
|
9
|
+
const [provider, workspaceId, ...rest] = ref.split(SEPARATOR);
|
|
10
|
+
if (!provider || !workspaceId || rest.length === 0) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return { provider, sourceId: rest.join(SEPARATOR), workspaceId };
|
|
14
|
+
};
|
|
15
|
+
var sourceIdFor = (id, provider, workspaceId) => {
|
|
16
|
+
const parts = parseRef(id);
|
|
17
|
+
if (parts === null || parts.provider !== provider) {
|
|
18
|
+
return id;
|
|
19
|
+
}
|
|
20
|
+
if (parts.workspaceId !== workspaceId) {
|
|
21
|
+
throw new OutboundError(
|
|
22
|
+
"Invalid",
|
|
23
|
+
`${id} belongs to workspace ${parts.workspaceId}, not ${workspaceId}`,
|
|
24
|
+
{ provider }
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
return parts.sourceId;
|
|
28
|
+
};
|
|
29
|
+
var assertWorkspaceId = (workspaceId, provider) => {
|
|
30
|
+
if (workspaceId === "" || workspaceId.includes(SEPARATOR)) {
|
|
31
|
+
throw new OutboundError(
|
|
32
|
+
"Invalid",
|
|
33
|
+
`workspaceId must be a non-empty string without "${SEPARATOR}"`,
|
|
34
|
+
{ provider }
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
return workspaceId;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
makeRef,
|
|
42
|
+
parseRef,
|
|
43
|
+
sourceIdFor,
|
|
44
|
+
assertWorkspaceId
|
|
45
|
+
};
|
package/dist/cli/bin.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
run
|
|
4
|
+
} from "../chunks/chunk-7BCYLIDG.js";
|
|
5
|
+
import "../chunks/chunk-F7MKFVIG.js";
|
|
6
|
+
import "../chunks/chunk-OCV66TS2.js";
|
|
7
|
+
import "../chunks/chunk-B7V6EOAC.js";
|
|
8
|
+
import "../chunks/chunk-4O2HRTTI.js";
|
|
9
|
+
import "../chunks/chunk-WW746NJF.js";
|
|
10
|
+
import "../chunks/chunk-NAWZ73QS.js";
|
|
11
|
+
import "../chunks/chunk-LNCOGBMI.js";
|
|
12
|
+
import "../chunks/chunk-HEC7XFFH.js";
|
|
13
|
+
import "../chunks/chunk-CMQ5ZHLZ.js";
|
|
14
|
+
import "../chunks/chunk-XC6CZP73.js";
|
|
15
|
+
import "../chunks/chunk-QTB747K4.js";
|
|
16
|
+
import "../chunks/chunk-WAM6N4OF.js";
|
|
17
|
+
import "../chunks/chunk-ZGHQYZEH.js";
|
|
18
|
+
import "../chunks/chunk-LOXBLQ3I.js";
|
|
19
|
+
import "../chunks/chunk-QZNNCXXD.js";
|
|
20
|
+
|
|
21
|
+
// src/cli/bin.ts
|
|
22
|
+
import process from "node:process";
|
|
23
|
+
import { createInterface } from "node:readline";
|
|
24
|
+
process.exitCode = await run(process.argv.slice(2), {
|
|
25
|
+
stderr: (text) => {
|
|
26
|
+
process.stderr.write(`${text}
|
|
27
|
+
`);
|
|
28
|
+
},
|
|
29
|
+
stdin: () => createInterface({ input: process.stdin }),
|
|
30
|
+
stdout: (text) => {
|
|
31
|
+
process.stdout.write(`${text}
|
|
32
|
+
`);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Json } from "../internal/json.ts";
|
|
2
|
+
import type { OutboundApi } from "../internal/outbound/api.ts";
|
|
3
|
+
export interface CommandInput {
|
|
4
|
+
readonly positionals: readonly string[];
|
|
5
|
+
readonly flags: Readonly<Record<string, string | boolean | undefined>>;
|
|
6
|
+
}
|
|
7
|
+
type Command = (outbound: OutboundApi, input: CommandInput) => Promise<Json>;
|
|
8
|
+
export interface CommandSpec {
|
|
9
|
+
readonly help: string;
|
|
10
|
+
readonly run: Command;
|
|
11
|
+
}
|
|
12
|
+
export declare const COMMANDS: Map<string, CommandSpec>;
|
|
13
|
+
/** The provider catalog. Needs no adapter and no key. */
|
|
14
|
+
export declare const listProviders: () => Json;
|
|
15
|
+
export declare const helpText: () => string;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Adapter } from "../internal/adapter.ts";
|
|
2
|
+
export { createMcpServer, PROTOCOL_VERSIONS } from "./mcp.ts";
|
|
3
|
+
export type { McpServer, McpServerOptions } from "./mcp.ts";
|
|
4
|
+
export interface CliIo {
|
|
5
|
+
readonly stdout: (text: string) => void;
|
|
6
|
+
readonly stderr: (text: string) => void;
|
|
7
|
+
/** Opens standard input as lines. Called only by `outbound mcp`, so other commands exit when done. */
|
|
8
|
+
readonly stdin?: (() => AsyncIterable<string>) | undefined;
|
|
9
|
+
/** Replaces the adapter the environment would choose. Meant for tests. */
|
|
10
|
+
readonly adapter?: Adapter | undefined;
|
|
11
|
+
}
|
|
12
|
+
/** Runs the CLI. Returns the process exit code. */
|
|
13
|
+
export declare const run: (argv: readonly string[], io: CliIo) => Promise<number>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PROTOCOL_VERSIONS,
|
|
3
|
+
createMcpServer,
|
|
4
|
+
run
|
|
5
|
+
} from "../chunks/chunk-7BCYLIDG.js";
|
|
6
|
+
import "../chunks/chunk-F7MKFVIG.js";
|
|
7
|
+
import "../chunks/chunk-OCV66TS2.js";
|
|
8
|
+
import "../chunks/chunk-B7V6EOAC.js";
|
|
9
|
+
import "../chunks/chunk-4O2HRTTI.js";
|
|
10
|
+
import "../chunks/chunk-WW746NJF.js";
|
|
11
|
+
import "../chunks/chunk-NAWZ73QS.js";
|
|
12
|
+
import "../chunks/chunk-LNCOGBMI.js";
|
|
13
|
+
import "../chunks/chunk-HEC7XFFH.js";
|
|
14
|
+
import "../chunks/chunk-CMQ5ZHLZ.js";
|
|
15
|
+
import "../chunks/chunk-XC6CZP73.js";
|
|
16
|
+
import "../chunks/chunk-QTB747K4.js";
|
|
17
|
+
import "../chunks/chunk-WAM6N4OF.js";
|
|
18
|
+
import "../chunks/chunk-ZGHQYZEH.js";
|
|
19
|
+
import "../chunks/chunk-LOXBLQ3I.js";
|
|
20
|
+
import "../chunks/chunk-QZNNCXXD.js";
|
|
21
|
+
export {
|
|
22
|
+
PROTOCOL_VERSIONS,
|
|
23
|
+
createMcpServer,
|
|
24
|
+
run
|
|
25
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Json, JsonObject } from "../internal/json.ts";
|
|
2
|
+
import type { OutboundApi } from "../internal/outbound/api.ts";
|
|
3
|
+
import type { ToolsOptions } from "../tools/index.ts";
|
|
4
|
+
export declare const PROTOCOL_VERSIONS: readonly ["2025-06-18", "2025-03-26", "2024-11-05"];
|
|
5
|
+
export interface McpServerOptions extends ToolsOptions {
|
|
6
|
+
readonly version?: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface McpServer {
|
|
9
|
+
/** Handles one JSON-RPC message. Returns `undefined` for a notification. */
|
|
10
|
+
readonly handle: (message: Json) => Promise<JsonObject | undefined>;
|
|
11
|
+
/** Handles one line of input, which must be one JSON-RPC message. */
|
|
12
|
+
readonly handleLine: (line: string) => Promise<string | undefined>;
|
|
13
|
+
}
|
|
14
|
+
export declare const createMcpServer: (outbound: OutboundApi, options?: McpServerOptions) => McpServer;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import {
|
|
2
|
+
emptyCounts,
|
|
3
|
+
sumCounts
|
|
4
|
+
} from "../chunks/chunk-WW746NJF.js";
|
|
5
|
+
|
|
6
|
+
// src/clients/plugin.ts
|
|
7
|
+
var UNASSIGNED = "unassigned";
|
|
8
|
+
var isCampaign = (record) => "tags" in record && "channel" in record;
|
|
9
|
+
var campaignRefOf = (record) => {
|
|
10
|
+
if (isCampaign(record)) {
|
|
11
|
+
return record.ref;
|
|
12
|
+
}
|
|
13
|
+
if ("campaignRef" in record) {
|
|
14
|
+
return record.campaignRef;
|
|
15
|
+
}
|
|
16
|
+
return "scope" in record && record.scope !== "workspace" && record.scope !== "sender" ? record.scopeRef : null;
|
|
17
|
+
};
|
|
18
|
+
var needsCampaign = (rule) => rule.campaignTag !== void 0 || rule.campaignName !== void 0;
|
|
19
|
+
var matches = (rule, record, campaign) => (rule.provider === void 0 || rule.provider === record.provider) && (rule.workspaceId === void 0 || rule.workspaceId === record.workspaceId) && (rule.campaignIds === void 0 || campaign !== null && rule.campaignIds.includes(campaign.ref)) && (rule.campaignTag === void 0 || campaign !== null && campaign.tags.includes(rule.campaignTag)) && (rule.campaignName === void 0 || campaign !== null && rule.campaignName.test(campaign.name));
|
|
20
|
+
var Assigner = class {
|
|
21
|
+
#rules;
|
|
22
|
+
/** Campaigns seen so far, so a lead can be matched by its campaign's tag. */
|
|
23
|
+
#campaigns = /* @__PURE__ */ new Map();
|
|
24
|
+
constructor(rules) {
|
|
25
|
+
this.#rules = rules;
|
|
26
|
+
}
|
|
27
|
+
names() {
|
|
28
|
+
return [...new Set(this.#rules.map((rule) => rule.client))];
|
|
29
|
+
}
|
|
30
|
+
remember(record) {
|
|
31
|
+
if (isCampaign(record)) {
|
|
32
|
+
this.#campaigns.set(record.ref, {
|
|
33
|
+
name: record.name,
|
|
34
|
+
ref: record.ref,
|
|
35
|
+
tags: record.tags
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async #campaignFor(record, next) {
|
|
40
|
+
const ref = campaignRefOf(record);
|
|
41
|
+
if (ref === null) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const known = this.#campaigns.get(ref);
|
|
45
|
+
if (known !== void 0 || !this.#rules.some(needsCampaign)) {
|
|
46
|
+
return known ?? { name: "", ref, tags: [] };
|
|
47
|
+
}
|
|
48
|
+
const output = await next({ id: ref, kind: "campaigns.get" });
|
|
49
|
+
for (const item of output.items) {
|
|
50
|
+
this.remember(item);
|
|
51
|
+
}
|
|
52
|
+
return this.#campaigns.get(ref) ?? { name: "", ref, tags: [] };
|
|
53
|
+
}
|
|
54
|
+
async assign(record, next) {
|
|
55
|
+
if (this.#rules.length === 0) {
|
|
56
|
+
return record.workspaceId;
|
|
57
|
+
}
|
|
58
|
+
const campaign = await this.#campaignFor(record, next);
|
|
59
|
+
return this.#rules.find((rule) => matches(rule, record, campaign))?.client ?? UNASSIGNED;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var clientStats = async (outbound, options) => {
|
|
63
|
+
const campaigns = await outbound.campaigns.listAll(options).toArray();
|
|
64
|
+
const byClient = /* @__PURE__ */ new Map();
|
|
65
|
+
for (const campaign of campaigns) {
|
|
66
|
+
const stats = await outbound.campaign(campaign.ref).stats(options);
|
|
67
|
+
const { client } = campaign;
|
|
68
|
+
byClient.set(client, [...byClient.get(client) ?? [], ...stats.rows]);
|
|
69
|
+
}
|
|
70
|
+
return [...byClient.entries()].map(([client, rows]) => ({
|
|
71
|
+
campaigns: rows.length,
|
|
72
|
+
client,
|
|
73
|
+
counts: rows.length === 0 ? emptyCounts() : sumCounts(rows)
|
|
74
|
+
})).toSorted((left, right) => left.client.localeCompare(right.client));
|
|
75
|
+
};
|
|
76
|
+
var clients = (options = {}) => {
|
|
77
|
+
const assigner = new Assigner(options.rules ?? []);
|
|
78
|
+
return {
|
|
79
|
+
extend: (outbound) => ({
|
|
80
|
+
clients: {
|
|
81
|
+
names: () => assigner.names(),
|
|
82
|
+
stats: (statsOptions = {}) => clientStats(outbound, statsOptions)
|
|
83
|
+
}
|
|
84
|
+
}),
|
|
85
|
+
name: "clients",
|
|
86
|
+
wrap: async (operation, next) => {
|
|
87
|
+
const output = await next(operation);
|
|
88
|
+
for (const item of output.items) {
|
|
89
|
+
assigner.remember(item);
|
|
90
|
+
}
|
|
91
|
+
const items = [];
|
|
92
|
+
for (const item of output.items) {
|
|
93
|
+
const client = await assigner.assign(item, next);
|
|
94
|
+
const tagged = {
|
|
95
|
+
...item,
|
|
96
|
+
client
|
|
97
|
+
};
|
|
98
|
+
items.push(tagged);
|
|
99
|
+
}
|
|
100
|
+
return { ...output, items };
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
export {
|
|
105
|
+
UNASSIGNED,
|
|
106
|
+
clients
|
|
107
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { OperationOptions } from "../internal/engine/engine.ts";
|
|
2
|
+
import type { MetricCounts } from "../internal/metrics.ts";
|
|
3
|
+
import type { OutboundPlugin } from "../internal/outbound/plugins.ts";
|
|
4
|
+
export declare const UNASSIGNED = "unassigned";
|
|
5
|
+
export interface ClientRule {
|
|
6
|
+
/** The client this rule assigns to. */
|
|
7
|
+
readonly client: string;
|
|
8
|
+
readonly provider?: string | undefined;
|
|
9
|
+
readonly workspaceId?: string | undefined;
|
|
10
|
+
/** Campaigns carrying this tag. */
|
|
11
|
+
readonly campaignTag?: string | undefined;
|
|
12
|
+
/** Campaigns by ref. */
|
|
13
|
+
readonly campaignIds?: readonly string[] | undefined;
|
|
14
|
+
/** Campaigns whose name matches. */
|
|
15
|
+
readonly campaignName?: RegExp | undefined;
|
|
16
|
+
}
|
|
17
|
+
export interface ClientsOptions {
|
|
18
|
+
readonly rules?: readonly ClientRule[] | undefined;
|
|
19
|
+
}
|
|
20
|
+
export interface ClientStats {
|
|
21
|
+
readonly client: string;
|
|
22
|
+
/** How many campaigns were added together. */
|
|
23
|
+
readonly campaigns: number;
|
|
24
|
+
readonly counts: MetricCounts;
|
|
25
|
+
}
|
|
26
|
+
export interface ClientStatsOptions extends OperationOptions {
|
|
27
|
+
readonly from?: string | undefined;
|
|
28
|
+
readonly to?: string | undefined;
|
|
29
|
+
}
|
|
30
|
+
export interface ClientsExtension {
|
|
31
|
+
readonly clients: {
|
|
32
|
+
/** Every client named by a rule, in rule order. */
|
|
33
|
+
readonly names: () => string[];
|
|
34
|
+
/**
|
|
35
|
+
* The same counts for every client, built by adding up each client's
|
|
36
|
+
* campaigns. It costs one stats request per campaign.
|
|
37
|
+
*/
|
|
38
|
+
readonly stats: (options?: ClientStatsOptions) => Promise<ClientStats[]>;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Tags every record with the client it belongs to. */
|
|
42
|
+
export declare const clients: (options?: ClientsOptions) => OutboundPlugin<ClientsExtension>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Adapter } from "../internal/adapter.ts";
|
|
2
|
+
type AccountReads = Pick<Adapter, "getCampaignSettings" | "getSenderHealth" | "listBlocklist" | "listLists" | "listSubsequences" | "listTags" | "listWebhooks">;
|
|
3
|
+
export declare const accountReads: (members: readonly Adapter[]) => AccountReads;
|
|
4
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Adapter } from "../internal/adapter.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Puts several adapters behind one instance.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* createOutbound({ adapter: combine([instantly(), heyreach()]) });
|
|
7
|
+
* ```
|
|
8
|
+
*/
|
|
9
|
+
export declare const combine: (members: readonly Adapter[]) => Adapter;
|