outbound-sdk 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +119 -2
- package/dist/alerts/index.d.ts +2 -0
- package/dist/alerts/index.js +140 -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 +72 -0
- package/dist/budget/index.d.ts +21 -0
- package/dist/budget/index.js +71 -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-4PSO6JEK.js +357 -0
- package/dist/chunks/chunk-6CVZOUHB.js +152 -0
- package/dist/chunks/chunk-AFU5E5QB.js +714 -0
- package/dist/chunks/chunk-DJ2IUQEU.js +111 -0
- package/dist/chunks/chunk-E7JHLNLG.js +187 -0
- package/dist/chunks/chunk-FHKSLCVW.js +154 -0
- package/dist/chunks/chunk-FKH5N47I.js +40 -0
- package/dist/chunks/chunk-HZCTYL22.js +29 -0
- package/dist/chunks/chunk-IPUYZD4O.js +25 -0
- package/dist/chunks/chunk-IVH3NMQZ.js +61 -0
- package/dist/chunks/chunk-LVYG7XZJ.js +45 -0
- package/dist/chunks/chunk-NAKXLBA6.js +30 -0
- package/dist/chunks/chunk-NAWZ73QS.js +22 -0
- package/dist/chunks/chunk-PMSSUWD7.js +636 -0
- package/dist/chunks/chunk-PURHK3JU.js +432 -0
- package/dist/chunks/chunk-R3Y56YVF.js +43 -0
- package/dist/chunks/chunk-RCZ7ZZFU.js +92 -0
- package/dist/chunks/chunk-SBIZDCRY.js +106 -0
- package/dist/chunks/chunk-U2D34ARZ.js +41 -0
- package/dist/chunks/chunk-UAT3JSJZ.js +331 -0
- package/dist/chunks/chunk-VQSCHOBV.js +111 -0
- package/dist/chunks/chunk-XC6CZP73.js +80 -0
- package/dist/chunks/chunk-XNFESPZH.js +2307 -0
- package/dist/chunks/chunk-YOTW5ESM.js +118 -0
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +35 -0
- package/dist/cli/commands.d.ts +19 -0
- package/dist/cli/config.d.ts +22 -0
- package/dist/cli/index.d.ts +17 -0
- package/dist/cli/index.js +30 -0
- package/dist/cli/mcp.d.ts +14 -0
- package/dist/cli/stdio.d.ts +9 -0
- package/dist/clients/index.d.ts +2 -0
- package/dist/clients/index.js +117 -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 +420 -0
- package/dist/combine/route.d.ts +24 -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 +260 -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 +70 -0
- package/dist/heyreach/client.d.ts +18 -0
- package/dist/heyreach/inbox.d.ts +7 -0
- package/dist/heyreach/index.d.ts +25 -0
- package/dist/heyreach/index.js +1931 -0
- package/dist/heyreach/leads.d.ts +4 -0
- package/dist/heyreach/lookup.d.ts +15 -0
- package/dist/heyreach/map-account.d.ts +31 -0
- package/dist/heyreach/map-sequence.d.ts +5 -0
- package/dist/heyreach/map-stats.d.ts +13 -0
- package/dist/heyreach/map.d.ts +37 -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 +3 -0
- package/dist/identity/index.d.ts +3 -0
- package/dist/identity/index.js +159 -0
- package/dist/identity/keys.d.ts +9 -0
- package/dist/identity/plugin.d.ts +34 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +131 -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 +4937 -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 +155 -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 +85 -0
- package/dist/instantly/client.d.ts +24 -0
- package/dist/instantly/index.d.ts +27 -0
- package/dist/instantly/index.js +2627 -0
- package/dist/instantly/map-account.d.ts +38 -0
- package/dist/instantly/map-lead.d.ts +18 -0
- package/dist/instantly/map-stats.d.ts +25 -0
- package/dist/instantly/map.d.ts +22 -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 +7 -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 +3 -0
- package/dist/internal/adapter.d.ts +211 -0
- package/dist/internal/capabilities.d.ts +104 -0
- package/dist/internal/client.d.ts +15 -0
- package/dist/internal/concurrency.d.ts +8 -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 +34 -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 +205 -0
- package/dist/internal/entities.d.ts +493 -0
- package/dist/internal/env.d.ts +4 -0
- package/dist/internal/errors.d.ts +62 -0
- package/dist/internal/fields.d.ts +462 -0
- package/dist/internal/hooks.d.ts +55 -0
- package/dist/internal/json.d.ts +49 -0
- package/dist/internal/lead-fields.d.ts +21 -0
- package/dist/internal/lead-status.d.ts +13 -0
- package/dist/internal/limits.d.ts +34 -0
- package/dist/internal/metrics.d.ts +64 -0
- package/dist/internal/native.d.ts +81 -0
- package/dist/internal/outbound/api.d.ts +292 -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 +41 -0
- package/dist/internal/outbound/operations.d.ts +42 -0
- package/dist/internal/outbound/outbound.d.ts +67 -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 +20 -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/page.d.ts +14 -0
- package/dist/internal/record.d.ts +36 -0
- package/dist/internal/records.d.ts +7 -0
- package/dist/internal/redact.d.ts +18 -0
- package/dist/internal/ref.d.ts +16 -0
- package/dist/internal/sequence.d.ts +14 -0
- package/dist/internal/sha256.d.ts +6 -0
- package/dist/internal/text.d.ts +11 -0
- package/dist/internal/url.d.ts +9 -0
- package/dist/loader/index.d.ts +24 -0
- package/dist/loader/index.js +16 -0
- package/dist/memory/account-reads.d.ts +5 -0
- package/dist/memory/account.d.ts +81 -0
- package/dist/memory/adapter.d.ts +16 -0
- package/dist/memory/data.d.ts +137 -0
- package/dist/memory/demo.d.ts +7 -0
- package/dist/memory/index.d.ts +5 -0
- package/dist/memory/index.js +867 -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 +197 -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 +87 -0
- package/dist/smartlead/client.d.ts +18 -0
- package/dist/smartlead/hmac.d.ts +7 -0
- package/dist/smartlead/index.d.ts +24 -0
- package/dist/smartlead/index.js +2329 -0
- package/dist/smartlead/leads.d.ts +9 -0
- package/dist/smartlead/lookup.d.ts +8 -0
- package/dist/smartlead/mail.d.ts +5 -0
- package/dist/smartlead/map-account.d.ts +34 -0
- package/dist/smartlead/map-messages.d.ts +31 -0
- package/dist/smartlead/map-stats.d.ts +36 -0
- package/dist/smartlead/map.d.ts +62 -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 +12 -0
- package/dist/smartlead/native-services.d.ts +204 -0
- package/dist/smartlead/native.d.ts +785 -0
- package/dist/smartlead/shared.d.ts +29 -0
- package/dist/smartlead/stats.d.ts +5 -0
- package/dist/smartlead/webhooks.d.ts +3 -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 +28 -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 +42 -0
- package/dist/tools/index.d.ts +28 -0
- package/dist/tools/index.js +22 -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 +227 -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,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SCHEMA_VERSION
|
|
3
|
+
} from "./chunk-4PSO6JEK.js";
|
|
4
|
+
import {
|
|
5
|
+
makeRef
|
|
6
|
+
} from "./chunk-LVYG7XZJ.js";
|
|
7
|
+
import {
|
|
8
|
+
compactObject
|
|
9
|
+
} from "./chunk-VQSCHOBV.js";
|
|
10
|
+
|
|
11
|
+
// src/internal/record.ts
|
|
12
|
+
var recordBase = (identity, sourceId, raw) => ({
|
|
13
|
+
provider: identity.provider,
|
|
14
|
+
raw,
|
|
15
|
+
ref: makeRef(identity.provider, identity.workspaceId, sourceId),
|
|
16
|
+
schemaVersion: SCHEMA_VERSION,
|
|
17
|
+
sourceId: String(sourceId),
|
|
18
|
+
workspaceId: identity.workspaceId
|
|
19
|
+
});
|
|
20
|
+
var refTo = (identity, sourceId) => sourceId === null || sourceId === void 0 || sourceId === "" ? null : makeRef(identity.provider, identity.workspaceId, sourceId);
|
|
21
|
+
var refsTo = (identity, sourceIds) => sourceIds.flatMap((sourceId) => refTo(identity, sourceId) ?? []);
|
|
22
|
+
var eventTypesOf = (names, known) => [
|
|
23
|
+
...new Set(
|
|
24
|
+
names.flatMap((name) => {
|
|
25
|
+
const type = known.get(name);
|
|
26
|
+
return type === void 0 || type === "unknown" ? [] : [type];
|
|
27
|
+
})
|
|
28
|
+
)
|
|
29
|
+
].toSorted();
|
|
30
|
+
var eventData = (shared, extras = {}) => (
|
|
31
|
+
// SAFETY: the shared keys were typed on the way in and only absent values are dropped.
|
|
32
|
+
compactObject({ ...extras, ...shared })
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
recordBase,
|
|
37
|
+
refTo,
|
|
38
|
+
refsTo,
|
|
39
|
+
eventTypesOf,
|
|
40
|
+
eventData
|
|
41
|
+
};
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import {
|
|
2
|
+
baseFields,
|
|
3
|
+
campaignSchema,
|
|
4
|
+
count,
|
|
5
|
+
eventTypeSchema,
|
|
6
|
+
isoDateTime,
|
|
7
|
+
leadSchema,
|
|
8
|
+
messageSchema,
|
|
9
|
+
metricRowSchema,
|
|
10
|
+
replySchema,
|
|
11
|
+
senderSchema,
|
|
12
|
+
sequenceSchema,
|
|
13
|
+
workspaceSchema
|
|
14
|
+
} from "./chunk-4PSO6JEK.js";
|
|
15
|
+
import {
|
|
16
|
+
OutboundError
|
|
17
|
+
} from "./chunk-E7JHLNLG.js";
|
|
18
|
+
|
|
19
|
+
// src/internal/capabilities.ts
|
|
20
|
+
var NO_CAPABILITIES = {
|
|
21
|
+
blocklist: false,
|
|
22
|
+
"campaigns.bySender": false,
|
|
23
|
+
"campaigns.progress": false,
|
|
24
|
+
"campaigns.settings": false,
|
|
25
|
+
"campaigns.status": false,
|
|
26
|
+
deletionDetection: false,
|
|
27
|
+
"events.parse": false,
|
|
28
|
+
"events.verify": false,
|
|
29
|
+
"leads.byCampaign": false,
|
|
30
|
+
"leads.engagement": false,
|
|
31
|
+
"leads.get": false,
|
|
32
|
+
"leads.list": false,
|
|
33
|
+
"leads.lookup": false,
|
|
34
|
+
"leads.since": false,
|
|
35
|
+
"leads.timeline": false,
|
|
36
|
+
"lists.get": false,
|
|
37
|
+
"lists.leads": false,
|
|
38
|
+
"lists.list": false,
|
|
39
|
+
"messages.body": false,
|
|
40
|
+
"messages.byThread": false,
|
|
41
|
+
"messages.list": false,
|
|
42
|
+
"messages.since": false,
|
|
43
|
+
native: false,
|
|
44
|
+
"placementTests.list": false,
|
|
45
|
+
"replies.category": false,
|
|
46
|
+
"replies.list": false,
|
|
47
|
+
"replies.since": false,
|
|
48
|
+
"replies.unread": false,
|
|
49
|
+
"senders.byCampaign": false,
|
|
50
|
+
"senders.get": false,
|
|
51
|
+
"senders.health": false,
|
|
52
|
+
"senders.list": false,
|
|
53
|
+
"senders.warmup": false,
|
|
54
|
+
sequence: false,
|
|
55
|
+
"sequence.subsequences": false,
|
|
56
|
+
"stats.byDay": false,
|
|
57
|
+
"stats.bySender": false,
|
|
58
|
+
"stats.byStep": false,
|
|
59
|
+
"stats.allCampaigns": false,
|
|
60
|
+
"stats.campaign": false,
|
|
61
|
+
"stats.workspace": false,
|
|
62
|
+
tags: false,
|
|
63
|
+
"webhooks.get": false,
|
|
64
|
+
"webhooks.list": false,
|
|
65
|
+
workspaces: false
|
|
66
|
+
};
|
|
67
|
+
var RANK = /* @__PURE__ */ new Map([
|
|
68
|
+
["client", 1],
|
|
69
|
+
["derived", 1],
|
|
70
|
+
["exact", 2],
|
|
71
|
+
["false", 0],
|
|
72
|
+
["full", 2],
|
|
73
|
+
["partial", 1],
|
|
74
|
+
["sampled", 1],
|
|
75
|
+
["secret", 1],
|
|
76
|
+
["server", 2],
|
|
77
|
+
["signature", 2],
|
|
78
|
+
["true", 2],
|
|
79
|
+
["vendor", 2]
|
|
80
|
+
]);
|
|
81
|
+
var rank = (value) => RANK.get(String(value)) ?? 0;
|
|
82
|
+
var resolveCapabilities = (declared = {}) => ({
|
|
83
|
+
...NO_CAPABILITIES,
|
|
84
|
+
...declared
|
|
85
|
+
});
|
|
86
|
+
var weaker = (left, right) => rank(right) < rank(left) ? right : left;
|
|
87
|
+
var narrowKey = (target, key, other) => {
|
|
88
|
+
target[key] = weaker(target[key], other[key]);
|
|
89
|
+
};
|
|
90
|
+
var CAPABILITY_KEYS = Object.keys(NO_CAPABILITIES);
|
|
91
|
+
var intersectCapabilities = (first, ...rest) => {
|
|
92
|
+
const result = { ...first };
|
|
93
|
+
for (const other of rest) {
|
|
94
|
+
for (const key of CAPABILITY_KEYS) {
|
|
95
|
+
narrowKey(result, key, other);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
99
|
+
};
|
|
100
|
+
var requireCapability = (gate, key, what) => {
|
|
101
|
+
const value = gate.capabilities[key];
|
|
102
|
+
if (value === false) {
|
|
103
|
+
const plugin = gate.narrowedBy.get(key);
|
|
104
|
+
const reason = plugin === void 0 ? `the ${gate.provider} adapter does not support it` : `the ${plugin} plugin turned it off`;
|
|
105
|
+
throw new OutboundError(
|
|
106
|
+
"Unsupported",
|
|
107
|
+
`${what} is not available: ${reason} (${key})`,
|
|
108
|
+
{
|
|
109
|
+
provider: gate.provider
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
return value;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// src/internal/entities-account.ts
|
|
117
|
+
import { z } from "zod";
|
|
118
|
+
var clock = z.string().regex(/^\d{2}:\d{2}$/u).nullable();
|
|
119
|
+
var flag = z.boolean().nullable();
|
|
120
|
+
var sendingWindowSchema = z.object({
|
|
121
|
+
/** Days of the week the window is open, 0 for Sunday to 6 for Saturday. */
|
|
122
|
+
days: z.array(z.number().int().min(0).max(6)),
|
|
123
|
+
/** `HH:MM` in `timezone`. */
|
|
124
|
+
from: clock,
|
|
125
|
+
name: z.string().nullable(),
|
|
126
|
+
/** An IANA name where the vendor gives one, otherwise the vendor's own label. */
|
|
127
|
+
timezone: z.string().nullable(),
|
|
128
|
+
/** `HH:MM` in `timezone`. */
|
|
129
|
+
to: clock
|
|
130
|
+
});
|
|
131
|
+
var campaignSettingsSchema = z.object({
|
|
132
|
+
...baseFields,
|
|
133
|
+
campaignRef: z.string(),
|
|
134
|
+
/** The most messages (or LinkedIn actions) the campaign sends per day. */
|
|
135
|
+
dailyLimit: count,
|
|
136
|
+
/** The most new leads the campaign contacts per day. */
|
|
137
|
+
dailyNewLeads: count,
|
|
138
|
+
endDate: z.iso.date().nullable(),
|
|
139
|
+
/** The shortest wait between two sends, in minutes. */
|
|
140
|
+
gapMinutes: z.number().nonnegative().nullable(),
|
|
141
|
+
/** `true` when emails are sent without HTML. */
|
|
142
|
+
plainText: flag,
|
|
143
|
+
schedule: z.array(sendingWindowSchema),
|
|
144
|
+
startDate: z.iso.date().nullable(),
|
|
145
|
+
/** `true` when a lead who sends an automatic reply gets no more steps. */
|
|
146
|
+
stopOnAutoReply: flag,
|
|
147
|
+
/** `true` when a lead who replies gets no more steps. */
|
|
148
|
+
stopOnReply: flag,
|
|
149
|
+
tracking: z.object({ clicks: flag, opens: flag })
|
|
150
|
+
});
|
|
151
|
+
var campaignProgressSchema = z.object({
|
|
152
|
+
...baseFields,
|
|
153
|
+
/** Leads the vendor stopped for a bounce or a block list. */
|
|
154
|
+
blocked: count,
|
|
155
|
+
campaignRef: z.string(),
|
|
156
|
+
/** Leads who reached the end of the sequence. */
|
|
157
|
+
completed: count,
|
|
158
|
+
/** Leads the campaign could not run for. */
|
|
159
|
+
failed: count,
|
|
160
|
+
/** Leads who have had a step and have more to come. */
|
|
161
|
+
inProgress: count,
|
|
162
|
+
/** Every lead in the campaign. */
|
|
163
|
+
leads: count,
|
|
164
|
+
/** Leads still waiting for their first step. */
|
|
165
|
+
notStarted: count,
|
|
166
|
+
/** Leads taken out of the sequence before its end. */
|
|
167
|
+
stopped: count
|
|
168
|
+
});
|
|
169
|
+
var senderHealthSchema = z.object({
|
|
170
|
+
...baseFields,
|
|
171
|
+
/** `true` when the domain or address is on a block list the vendor checks. */
|
|
172
|
+
blacklisted: flag,
|
|
173
|
+
/** When the vendor last checked. */
|
|
174
|
+
checkedAt: isoDateTime,
|
|
175
|
+
/** `true` when the vendor can sign in to the mailbox or the LinkedIn seat. */
|
|
176
|
+
connected: flag,
|
|
177
|
+
/** Whether each DNS record is present and valid. */
|
|
178
|
+
dns: z.object({ dkim: flag, dmarc: flag, mx: flag, spf: flag }),
|
|
179
|
+
/** The mailbox's domain, lowercased. `null` for a LinkedIn seat. */
|
|
180
|
+
domain: z.string().nullable(),
|
|
181
|
+
/** Problems in the vendor's own words. */
|
|
182
|
+
issues: z.array(z.string()),
|
|
183
|
+
senderRef: z.string(),
|
|
184
|
+
/** Warmup traffic over the vendor's reporting window. `null` when there is none. */
|
|
185
|
+
warmup: z.object({
|
|
186
|
+
inbox: count,
|
|
187
|
+
received: count,
|
|
188
|
+
score: z.number().nullable(),
|
|
189
|
+
sent: count,
|
|
190
|
+
spam: count
|
|
191
|
+
}).nullable()
|
|
192
|
+
});
|
|
193
|
+
var leadListSchema = z.object({
|
|
194
|
+
...baseFields,
|
|
195
|
+
createdAt: isoDateTime,
|
|
196
|
+
kind: z.enum(["companies", "leads"]),
|
|
197
|
+
/** The vendor's name for it, or its id when the vendor gave none. Never empty. */
|
|
198
|
+
name: z.string().min(1),
|
|
199
|
+
/** How many records the list holds. */
|
|
200
|
+
size: count
|
|
201
|
+
});
|
|
202
|
+
var blockEntrySchema = z.object({
|
|
203
|
+
...baseFields,
|
|
204
|
+
createdAt: isoDateTime,
|
|
205
|
+
kind: z.enum(["company", "domain", "email", "linkedin", "other"]),
|
|
206
|
+
/** Lowercased for emails and domains. Never empty. */
|
|
207
|
+
value: z.string().min(1)
|
|
208
|
+
});
|
|
209
|
+
var tagSchema = z.object({
|
|
210
|
+
...baseFields,
|
|
211
|
+
description: z.string().nullable(),
|
|
212
|
+
name: z.string().min(1)
|
|
213
|
+
});
|
|
214
|
+
var placementTestSchema = z.object({
|
|
215
|
+
...baseFields,
|
|
216
|
+
/** The campaign whose email the test sends. */
|
|
217
|
+
campaignRef: z.string().nullable(),
|
|
218
|
+
createdAt: isoDateTime,
|
|
219
|
+
/** When a scheduled test stops running. */
|
|
220
|
+
endsAt: isoDateTime,
|
|
221
|
+
/** `one_time` for a test run once, `automated` for one on a schedule. */
|
|
222
|
+
kind: z.enum(["automated", "one_time"]).nullable(),
|
|
223
|
+
name: z.string().min(1),
|
|
224
|
+
/** When an automated test runs next. */
|
|
225
|
+
nextRunAt: isoDateTime,
|
|
226
|
+
/** When a scheduled test starts running. */
|
|
227
|
+
startsAt: isoDateTime,
|
|
228
|
+
status: z.enum(["active", "completed", "paused", "unknown"])
|
|
229
|
+
});
|
|
230
|
+
var webhookSubscriptionSchema = z.object({
|
|
231
|
+
...baseFields,
|
|
232
|
+
active: flag,
|
|
233
|
+
/** The campaigns the webhook is limited to. Empty for every campaign. */
|
|
234
|
+
campaignRefs: z.array(z.string()),
|
|
235
|
+
createdAt: isoDateTime,
|
|
236
|
+
/**
|
|
237
|
+
* What those events become when they arrive: the SDK's own event types,
|
|
238
|
+
* without repeats. Empty when no event name is one the adapter knows.
|
|
239
|
+
*/
|
|
240
|
+
eventTypes: z.array(eventTypeSchema),
|
|
241
|
+
/** Event names in the vendor's own words. */
|
|
242
|
+
events: z.array(z.string()),
|
|
243
|
+
name: z.string().nullable(),
|
|
244
|
+
/** Where the vendor posts. It can hold a secret in its path or query. */
|
|
245
|
+
url: z.string()
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
// src/internal/fields.ts
|
|
249
|
+
var RECORD_SCHEMAS = {
|
|
250
|
+
blockEntry: blockEntrySchema,
|
|
251
|
+
campaign: campaignSchema,
|
|
252
|
+
campaignProgress: campaignProgressSchema,
|
|
253
|
+
campaignSettings: campaignSettingsSchema,
|
|
254
|
+
lead: leadSchema,
|
|
255
|
+
leadList: leadListSchema,
|
|
256
|
+
message: messageSchema,
|
|
257
|
+
metricRow: metricRowSchema,
|
|
258
|
+
placementTest: placementTestSchema,
|
|
259
|
+
reply: replySchema,
|
|
260
|
+
sender: senderSchema,
|
|
261
|
+
senderHealth: senderHealthSchema,
|
|
262
|
+
sequence: sequenceSchema,
|
|
263
|
+
tag: tagSchema,
|
|
264
|
+
webhook: webhookSubscriptionSchema,
|
|
265
|
+
workspace: workspaceSchema
|
|
266
|
+
};
|
|
267
|
+
var IDENTITY = /* @__PURE__ */ new Set([
|
|
268
|
+
"provider",
|
|
269
|
+
"raw",
|
|
270
|
+
"ref",
|
|
271
|
+
"schemaVersion",
|
|
272
|
+
"sourceId",
|
|
273
|
+
"workspaceId"
|
|
274
|
+
]);
|
|
275
|
+
var RECORD_NAMES = Object.keys(RECORD_SCHEMAS);
|
|
276
|
+
var fieldsOf = (name) => Object.keys(RECORD_SCHEMAS[name].shape).filter(
|
|
277
|
+
(field) => !IDENTITY.has(field)
|
|
278
|
+
);
|
|
279
|
+
var gradesOf = (name, declared) => {
|
|
280
|
+
const stated = declared === false || declared === void 0 ? {} : declared;
|
|
281
|
+
return Object.fromEntries(
|
|
282
|
+
fieldsOf(name).map((field) => [
|
|
283
|
+
field,
|
|
284
|
+
declared === false ? false : stated[field] ?? "exact"
|
|
285
|
+
])
|
|
286
|
+
);
|
|
287
|
+
};
|
|
288
|
+
var resolveFields = (declared = {}) => (
|
|
289
|
+
// SAFETY: every RecordName is mapped, so the entries are a FieldCoverage.
|
|
290
|
+
Object.fromEntries(
|
|
291
|
+
RECORD_NAMES.map((name) => [name, gradesOf(name, declared[name])])
|
|
292
|
+
)
|
|
293
|
+
);
|
|
294
|
+
var best = (grades) => {
|
|
295
|
+
if (grades.includes("exact")) {
|
|
296
|
+
return "exact";
|
|
297
|
+
}
|
|
298
|
+
return grades.includes("derived") ? "derived" : false;
|
|
299
|
+
};
|
|
300
|
+
var mergeFields = (coverages) => (
|
|
301
|
+
// SAFETY: every RecordName is mapped, so the entries are a FieldCoverage.
|
|
302
|
+
Object.fromEntries(
|
|
303
|
+
RECORD_NAMES.map((name) => [
|
|
304
|
+
name,
|
|
305
|
+
Object.fromEntries(
|
|
306
|
+
fieldsOf(name).map((field) => [
|
|
307
|
+
field,
|
|
308
|
+
best(coverages.map((coverage) => coverage[name][field] ?? false))
|
|
309
|
+
])
|
|
310
|
+
)
|
|
311
|
+
])
|
|
312
|
+
)
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
export {
|
|
316
|
+
NO_CAPABILITIES,
|
|
317
|
+
resolveCapabilities,
|
|
318
|
+
CAPABILITY_KEYS,
|
|
319
|
+
intersectCapabilities,
|
|
320
|
+
requireCapability,
|
|
321
|
+
campaignSettingsSchema,
|
|
322
|
+
campaignProgressSchema,
|
|
323
|
+
senderHealthSchema,
|
|
324
|
+
leadListSchema,
|
|
325
|
+
blockEntrySchema,
|
|
326
|
+
tagSchema,
|
|
327
|
+
placementTestSchema,
|
|
328
|
+
webhookSubscriptionSchema,
|
|
329
|
+
resolveFields,
|
|
330
|
+
mergeFields
|
|
331
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// src/internal/json.ts
|
|
2
|
+
var isJsonObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3
|
+
var isJsonArray = (value) => Array.isArray(value);
|
|
4
|
+
var isString = (value) => typeof value === "string";
|
|
5
|
+
var isNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
6
|
+
var isBoolean = (value) => typeof value === "boolean";
|
|
7
|
+
var field = (value, key) => isJsonObject(value) ? value[key] : void 0;
|
|
8
|
+
var text = (value) => {
|
|
9
|
+
if (isNumber(value)) {
|
|
10
|
+
return String(value);
|
|
11
|
+
}
|
|
12
|
+
if (!isString(value)) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const trimmed = value.trim();
|
|
16
|
+
return trimmed === "" ? null : trimmed;
|
|
17
|
+
};
|
|
18
|
+
var count = (value) => {
|
|
19
|
+
if (isNumber(value)) {
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
if (isString(value) && value.trim() !== "") {
|
|
23
|
+
const parsed = Number(value);
|
|
24
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
};
|
|
28
|
+
var fullName = (first, last) => {
|
|
29
|
+
const name = [text(first), text(last)].filter((part) => part !== null).join(" ");
|
|
30
|
+
return name === "" ? null : name;
|
|
31
|
+
};
|
|
32
|
+
var flag = (value) => isBoolean(value) ? value : null;
|
|
33
|
+
var list = (value) => isJsonArray(value) ? value : [];
|
|
34
|
+
var objects = (value) => list(value).filter((item) => isJsonObject(item));
|
|
35
|
+
var timestamp = (value) => {
|
|
36
|
+
if (!isString(value) && !isNumber(value)) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const epoch = isNumber(value) && value < 1e11 ? value * 1e3 : value;
|
|
40
|
+
const date = new Date(epoch);
|
|
41
|
+
return Number.isNaN(date.getTime()) ? null : date.toISOString();
|
|
42
|
+
};
|
|
43
|
+
var emailAddress = (value) => {
|
|
44
|
+
const raw = text(value);
|
|
45
|
+
return raw !== null && raw.includes("@") ? raw.toLowerCase() : null;
|
|
46
|
+
};
|
|
47
|
+
var parseJson = (source) => {
|
|
48
|
+
try {
|
|
49
|
+
return JSON.parse(source);
|
|
50
|
+
} catch {
|
|
51
|
+
return void 0;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var isScalar = (value) => isString(value) || isNumber(value) || isBoolean(value);
|
|
55
|
+
var stringMap = (value) => Object.fromEntries(
|
|
56
|
+
Object.entries(isJsonObject(value) ? value : {}).flatMap(
|
|
57
|
+
([key, entry]) => isScalar(entry) ? [[key, String(entry)]] : []
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
var compactObject = (entries) => {
|
|
61
|
+
const result = {};
|
|
62
|
+
for (const [key, value] of Object.entries(entries)) {
|
|
63
|
+
if (value !== null && value !== void 0) {
|
|
64
|
+
result[key] = value;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
};
|
|
69
|
+
var toJson = (value) => parseJson(JSON.stringify(value) ?? "null") ?? null;
|
|
70
|
+
var unknownKey = (known, input) => {
|
|
71
|
+
if (!isJsonObject(input)) {
|
|
72
|
+
return void 0;
|
|
73
|
+
}
|
|
74
|
+
const stray = Object.keys(input).find((key) => !known.includes(key));
|
|
75
|
+
return stray === void 0 ? void 0 : `"${stray}" is not an input. It takes: ${known.toSorted().join(", ") || "nothing"}`;
|
|
76
|
+
};
|
|
77
|
+
var withoutKeys = (value, secret) => {
|
|
78
|
+
if (isJsonArray(value)) {
|
|
79
|
+
return value.map((entry) => withoutKeys(entry, secret));
|
|
80
|
+
}
|
|
81
|
+
if (!isJsonObject(value)) {
|
|
82
|
+
return value;
|
|
83
|
+
}
|
|
84
|
+
return Object.fromEntries(
|
|
85
|
+
Object.entries(value).flatMap(
|
|
86
|
+
([key, entry]) => secret.test(key) ? [] : [[key, withoutKeys(entry, secret)]]
|
|
87
|
+
)
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
isJsonObject,
|
|
93
|
+
isJsonArray,
|
|
94
|
+
isString,
|
|
95
|
+
isNumber,
|
|
96
|
+
field,
|
|
97
|
+
text,
|
|
98
|
+
count,
|
|
99
|
+
fullName,
|
|
100
|
+
flag,
|
|
101
|
+
list,
|
|
102
|
+
objects,
|
|
103
|
+
timestamp,
|
|
104
|
+
emailAddress,
|
|
105
|
+
parseJson,
|
|
106
|
+
stringMap,
|
|
107
|
+
compactObject,
|
|
108
|
+
toJson,
|
|
109
|
+
unknownKey,
|
|
110
|
+
withoutKeys
|
|
111
|
+
};
|
|
@@ -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
|
+
};
|