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,389 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Bumped only for a breaking change to the shapes below. */
|
|
3
|
+
export declare const SCHEMA_VERSION: 1;
|
|
4
|
+
/** The fields every entity carries. */
|
|
5
|
+
export declare const baseFields: {
|
|
6
|
+
provider: z.ZodString;
|
|
7
|
+
raw: z.ZodJSONSchema;
|
|
8
|
+
ref: z.ZodString;
|
|
9
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
10
|
+
sourceId: z.ZodString;
|
|
11
|
+
workspaceId: z.ZodString;
|
|
12
|
+
};
|
|
13
|
+
export declare const count: z.ZodNullable<z.ZodNumber>;
|
|
14
|
+
export declare const isoDateTime: z.ZodNullable<z.ZodISODateTime>;
|
|
15
|
+
export declare const channelSchema: z.ZodEnum<{
|
|
16
|
+
email: "email";
|
|
17
|
+
linkedin: "linkedin";
|
|
18
|
+
}>;
|
|
19
|
+
export type Channel = z.infer<typeof channelSchema>;
|
|
20
|
+
export declare const campaignStatusSchema: z.ZodEnum<{
|
|
21
|
+
active: "active";
|
|
22
|
+
archived: "archived";
|
|
23
|
+
completed: "completed";
|
|
24
|
+
draft: "draft";
|
|
25
|
+
paused: "paused";
|
|
26
|
+
unknown: "unknown";
|
|
27
|
+
}>;
|
|
28
|
+
export type CampaignStatus = z.infer<typeof campaignStatusSchema>;
|
|
29
|
+
export declare const campaignSchema: z.ZodObject<{
|
|
30
|
+
channel: z.ZodEnum<{
|
|
31
|
+
email: "email";
|
|
32
|
+
linkedin: "linkedin";
|
|
33
|
+
}>;
|
|
34
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
35
|
+
name: z.ZodString;
|
|
36
|
+
status: z.ZodEnum<{
|
|
37
|
+
active: "active";
|
|
38
|
+
archived: "archived";
|
|
39
|
+
completed: "completed";
|
|
40
|
+
draft: "draft";
|
|
41
|
+
paused: "paused";
|
|
42
|
+
unknown: "unknown";
|
|
43
|
+
}>;
|
|
44
|
+
tags: z.ZodArray<z.ZodString>;
|
|
45
|
+
provider: z.ZodString;
|
|
46
|
+
raw: z.ZodJSONSchema;
|
|
47
|
+
ref: z.ZodString;
|
|
48
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
49
|
+
sourceId: z.ZodString;
|
|
50
|
+
workspaceId: z.ZodString;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type Campaign = z.infer<typeof campaignSchema>;
|
|
53
|
+
export declare const sequenceVariantSchema: z.ZodObject<{
|
|
54
|
+
body: z.ZodNullable<z.ZodString>;
|
|
55
|
+
contentHash: z.ZodString;
|
|
56
|
+
subject: z.ZodNullable<z.ZodString>;
|
|
57
|
+
variantKey: z.ZodString;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
export type SequenceVariant = z.infer<typeof sequenceVariantSchema>;
|
|
60
|
+
export declare const sequenceStepSchema: z.ZodObject<{
|
|
61
|
+
action: z.ZodString;
|
|
62
|
+
branch: z.ZodNullable<z.ZodString>;
|
|
63
|
+
delayDays: z.ZodNullable<z.ZodNumber>;
|
|
64
|
+
index: z.ZodNumber;
|
|
65
|
+
parentIndex: z.ZodNullable<z.ZodNumber>;
|
|
66
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
67
|
+
body: z.ZodNullable<z.ZodString>;
|
|
68
|
+
contentHash: z.ZodString;
|
|
69
|
+
subject: z.ZodNullable<z.ZodString>;
|
|
70
|
+
variantKey: z.ZodString;
|
|
71
|
+
}, z.core.$strip>>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
export type SequenceStep = z.infer<typeof sequenceStepSchema>;
|
|
74
|
+
export declare const sequenceSchema: z.ZodObject<{
|
|
75
|
+
campaignRef: z.ZodString;
|
|
76
|
+
kind: z.ZodEnum<{
|
|
77
|
+
main: "main";
|
|
78
|
+
subsequence: "subsequence";
|
|
79
|
+
}>;
|
|
80
|
+
name: z.ZodNullable<z.ZodString>;
|
|
81
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
82
|
+
action: z.ZodString;
|
|
83
|
+
branch: z.ZodNullable<z.ZodString>;
|
|
84
|
+
delayDays: z.ZodNullable<z.ZodNumber>;
|
|
85
|
+
index: z.ZodNumber;
|
|
86
|
+
parentIndex: z.ZodNullable<z.ZodNumber>;
|
|
87
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
88
|
+
body: z.ZodNullable<z.ZodString>;
|
|
89
|
+
contentHash: z.ZodString;
|
|
90
|
+
subject: z.ZodNullable<z.ZodString>;
|
|
91
|
+
variantKey: z.ZodString;
|
|
92
|
+
}, z.core.$strip>>;
|
|
93
|
+
}, z.core.$strip>>;
|
|
94
|
+
provider: z.ZodString;
|
|
95
|
+
raw: z.ZodJSONSchema;
|
|
96
|
+
ref: z.ZodString;
|
|
97
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
98
|
+
sourceId: z.ZodString;
|
|
99
|
+
workspaceId: z.ZodString;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
export type Sequence = z.infer<typeof sequenceSchema>;
|
|
102
|
+
export declare const senderStatusSchema: z.ZodEnum<{
|
|
103
|
+
error: "error";
|
|
104
|
+
active: "active";
|
|
105
|
+
paused: "paused";
|
|
106
|
+
unknown: "unknown";
|
|
107
|
+
disconnected: "disconnected";
|
|
108
|
+
}>;
|
|
109
|
+
export type SenderStatus = z.infer<typeof senderStatusSchema>;
|
|
110
|
+
export declare const senderSchema: z.ZodObject<{
|
|
111
|
+
address: z.ZodNullable<z.ZodString>;
|
|
112
|
+
dailyLimit: z.ZodNullable<z.ZodNumber>;
|
|
113
|
+
kind: z.ZodEnum<{
|
|
114
|
+
linkedin: "linkedin";
|
|
115
|
+
mailbox: "mailbox";
|
|
116
|
+
}>;
|
|
117
|
+
linkedinUrl: z.ZodNullable<z.ZodString>;
|
|
118
|
+
name: z.ZodNullable<z.ZodString>;
|
|
119
|
+
status: z.ZodEnum<{
|
|
120
|
+
error: "error";
|
|
121
|
+
active: "active";
|
|
122
|
+
paused: "paused";
|
|
123
|
+
unknown: "unknown";
|
|
124
|
+
disconnected: "disconnected";
|
|
125
|
+
}>;
|
|
126
|
+
warmup: z.ZodNullable<z.ZodObject<{
|
|
127
|
+
enabled: z.ZodNullable<z.ZodBoolean>;
|
|
128
|
+
score: z.ZodNullable<z.ZodNumber>;
|
|
129
|
+
}, z.core.$strip>>;
|
|
130
|
+
provider: z.ZodString;
|
|
131
|
+
raw: z.ZodJSONSchema;
|
|
132
|
+
ref: z.ZodString;
|
|
133
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
134
|
+
sourceId: z.ZodString;
|
|
135
|
+
workspaceId: z.ZodString;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
export type Sender = z.infer<typeof senderSchema>;
|
|
138
|
+
export declare const leadStatusSchema: z.ZodEnum<{
|
|
139
|
+
active: "active";
|
|
140
|
+
completed: "completed";
|
|
141
|
+
paused: "paused";
|
|
142
|
+
unknown: "unknown";
|
|
143
|
+
bounced: "bounced";
|
|
144
|
+
replied: "replied";
|
|
145
|
+
unsubscribed: "unsubscribed";
|
|
146
|
+
}>;
|
|
147
|
+
export type LeadStatus = z.infer<typeof leadStatusSchema>;
|
|
148
|
+
/** What a lead did with the campaign's messages, as the vendor counts it. */
|
|
149
|
+
export declare const leadEngagementSchema: z.ZodObject<{
|
|
150
|
+
clicks: z.ZodNullable<z.ZodNumber>;
|
|
151
|
+
lastContactedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
152
|
+
lastOpenedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
153
|
+
lastRepliedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
154
|
+
opens: z.ZodNullable<z.ZodNumber>;
|
|
155
|
+
replies: z.ZodNullable<z.ZodNumber>;
|
|
156
|
+
repliedStepIndex: z.ZodNullable<z.ZodNumber>;
|
|
157
|
+
stepIndex: z.ZodNullable<z.ZodNumber>;
|
|
158
|
+
}, z.core.$strip>;
|
|
159
|
+
export type LeadEngagement = z.infer<typeof leadEngagementSchema>;
|
|
160
|
+
export declare const leadSchema: z.ZodObject<{
|
|
161
|
+
campaignRef: z.ZodNullable<z.ZodString>;
|
|
162
|
+
company: z.ZodNullable<z.ZodString>;
|
|
163
|
+
createdAt: z.ZodNullable<z.ZodISODateTime>;
|
|
164
|
+
custom: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
165
|
+
email: z.ZodNullable<z.ZodString>;
|
|
166
|
+
engagement: z.ZodNullable<z.ZodObject<{
|
|
167
|
+
clicks: z.ZodNullable<z.ZodNumber>;
|
|
168
|
+
lastContactedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
169
|
+
lastOpenedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
170
|
+
lastRepliedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
171
|
+
opens: z.ZodNullable<z.ZodNumber>;
|
|
172
|
+
replies: z.ZodNullable<z.ZodNumber>;
|
|
173
|
+
repliedStepIndex: z.ZodNullable<z.ZodNumber>;
|
|
174
|
+
stepIndex: z.ZodNullable<z.ZodNumber>;
|
|
175
|
+
}, z.core.$strip>>;
|
|
176
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
177
|
+
interest: z.ZodNullable<z.ZodString>;
|
|
178
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
179
|
+
linkedinUrl: z.ZodNullable<z.ZodString>;
|
|
180
|
+
status: z.ZodEnum<{
|
|
181
|
+
active: "active";
|
|
182
|
+
completed: "completed";
|
|
183
|
+
paused: "paused";
|
|
184
|
+
unknown: "unknown";
|
|
185
|
+
bounced: "bounced";
|
|
186
|
+
replied: "replied";
|
|
187
|
+
unsubscribed: "unsubscribed";
|
|
188
|
+
}>;
|
|
189
|
+
tags: z.ZodArray<z.ZodString>;
|
|
190
|
+
title: z.ZodNullable<z.ZodString>;
|
|
191
|
+
provider: z.ZodString;
|
|
192
|
+
raw: z.ZodJSONSchema;
|
|
193
|
+
ref: z.ZodString;
|
|
194
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
195
|
+
sourceId: z.ZodString;
|
|
196
|
+
workspaceId: z.ZodString;
|
|
197
|
+
}, z.core.$strip>;
|
|
198
|
+
export type Lead = z.infer<typeof leadSchema>;
|
|
199
|
+
export declare const messageSchema: z.ZodObject<{
|
|
200
|
+
direction: z.ZodEnum<{
|
|
201
|
+
out: "out";
|
|
202
|
+
in: "in";
|
|
203
|
+
}>;
|
|
204
|
+
bodyHtml: z.ZodNullable<z.ZodString>;
|
|
205
|
+
bodyText: z.ZodNullable<z.ZodString>;
|
|
206
|
+
campaignRef: z.ZodNullable<z.ZodString>;
|
|
207
|
+
channel: z.ZodEnum<{
|
|
208
|
+
email: "email";
|
|
209
|
+
linkedin: "linkedin";
|
|
210
|
+
}>;
|
|
211
|
+
leadRef: z.ZodNullable<z.ZodString>;
|
|
212
|
+
senderRef: z.ZodNullable<z.ZodString>;
|
|
213
|
+
sentAt: z.ZodNullable<z.ZodISODateTime>;
|
|
214
|
+
stepIndex: z.ZodNullable<z.ZodNumber>;
|
|
215
|
+
subject: z.ZodNullable<z.ZodString>;
|
|
216
|
+
threadId: z.ZodNullable<z.ZodString>;
|
|
217
|
+
variantKey: z.ZodNullable<z.ZodString>;
|
|
218
|
+
provider: z.ZodString;
|
|
219
|
+
raw: z.ZodJSONSchema;
|
|
220
|
+
ref: z.ZodString;
|
|
221
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
222
|
+
sourceId: z.ZodString;
|
|
223
|
+
workspaceId: z.ZodString;
|
|
224
|
+
}, z.core.$strip>;
|
|
225
|
+
export type Message = z.infer<typeof messageSchema>;
|
|
226
|
+
export declare const replyCategorySchema: z.ZodEnum<{
|
|
227
|
+
unknown: "unknown";
|
|
228
|
+
bounce: "bounce";
|
|
229
|
+
negative: "negative";
|
|
230
|
+
neutral: "neutral";
|
|
231
|
+
ooo: "ooo";
|
|
232
|
+
positive: "positive";
|
|
233
|
+
unsubscribe: "unsubscribe";
|
|
234
|
+
}>;
|
|
235
|
+
export type ReplyCategory = z.infer<typeof replyCategorySchema>;
|
|
236
|
+
export declare const replySchema: z.ZodObject<{
|
|
237
|
+
category: z.ZodEnum<{
|
|
238
|
+
unknown: "unknown";
|
|
239
|
+
bounce: "bounce";
|
|
240
|
+
negative: "negative";
|
|
241
|
+
neutral: "neutral";
|
|
242
|
+
ooo: "ooo";
|
|
243
|
+
positive: "positive";
|
|
244
|
+
unsubscribe: "unsubscribe";
|
|
245
|
+
}>;
|
|
246
|
+
categorySource: z.ZodNullable<z.ZodEnum<{
|
|
247
|
+
vendor: "vendor";
|
|
248
|
+
rule: "rule";
|
|
249
|
+
}>>;
|
|
250
|
+
direction: z.ZodLiteral<"in">;
|
|
251
|
+
isAuto: z.ZodNullable<z.ZodBoolean>;
|
|
252
|
+
bodyHtml: z.ZodNullable<z.ZodString>;
|
|
253
|
+
bodyText: z.ZodNullable<z.ZodString>;
|
|
254
|
+
campaignRef: z.ZodNullable<z.ZodString>;
|
|
255
|
+
channel: z.ZodEnum<{
|
|
256
|
+
email: "email";
|
|
257
|
+
linkedin: "linkedin";
|
|
258
|
+
}>;
|
|
259
|
+
leadRef: z.ZodNullable<z.ZodString>;
|
|
260
|
+
senderRef: z.ZodNullable<z.ZodString>;
|
|
261
|
+
sentAt: z.ZodNullable<z.ZodISODateTime>;
|
|
262
|
+
stepIndex: z.ZodNullable<z.ZodNumber>;
|
|
263
|
+
subject: z.ZodNullable<z.ZodString>;
|
|
264
|
+
threadId: z.ZodNullable<z.ZodString>;
|
|
265
|
+
variantKey: z.ZodNullable<z.ZodString>;
|
|
266
|
+
provider: z.ZodString;
|
|
267
|
+
raw: z.ZodJSONSchema;
|
|
268
|
+
ref: z.ZodString;
|
|
269
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
270
|
+
sourceId: z.ZodString;
|
|
271
|
+
workspaceId: z.ZodString;
|
|
272
|
+
}, z.core.$strip>;
|
|
273
|
+
export type Reply = z.infer<typeof replySchema>;
|
|
274
|
+
export declare const metricScopeSchema: z.ZodEnum<{
|
|
275
|
+
campaign: "campaign";
|
|
276
|
+
sender: "sender";
|
|
277
|
+
step: "step";
|
|
278
|
+
workspace: "workspace";
|
|
279
|
+
}>;
|
|
280
|
+
export type MetricScope = z.infer<typeof metricScopeSchema>;
|
|
281
|
+
export declare const evidenceSchema: z.ZodEnum<{
|
|
282
|
+
derived: "derived";
|
|
283
|
+
exact: "exact";
|
|
284
|
+
sampled: "sampled";
|
|
285
|
+
}>;
|
|
286
|
+
export type Evidence = z.infer<typeof evidenceSchema>;
|
|
287
|
+
/**
|
|
288
|
+
* Counts only. Rates are computed from these in `metrics.ts`, so every
|
|
289
|
+
* adapter and plugin agrees on what a reply rate is.
|
|
290
|
+
*/
|
|
291
|
+
export declare const metricRowSchema: z.ZodObject<{
|
|
292
|
+
bounced: z.ZodNullable<z.ZodNumber>;
|
|
293
|
+
clicked: z.ZodNullable<z.ZodNumber>;
|
|
294
|
+
connectionsAccepted: z.ZodNullable<z.ZodNumber>;
|
|
295
|
+
connectionsSent: z.ZodNullable<z.ZodNumber>;
|
|
296
|
+
contacted: z.ZodNullable<z.ZodNumber>;
|
|
297
|
+
contentHash: z.ZodNullable<z.ZodString>;
|
|
298
|
+
date: z.ZodNullable<z.ZodISODate>;
|
|
299
|
+
delivered: z.ZodNullable<z.ZodNumber>;
|
|
300
|
+
evidence: z.ZodEnum<{
|
|
301
|
+
derived: "derived";
|
|
302
|
+
exact: "exact";
|
|
303
|
+
sampled: "sampled";
|
|
304
|
+
}>;
|
|
305
|
+
inmailsSent: z.ZodNullable<z.ZodNumber>;
|
|
306
|
+
opened: z.ZodNullable<z.ZodNumber>;
|
|
307
|
+
openedTotal: z.ZodNullable<z.ZodNumber>;
|
|
308
|
+
positive: z.ZodNullable<z.ZodNumber>;
|
|
309
|
+
provider: z.ZodString;
|
|
310
|
+
replied: z.ZodNullable<z.ZodNumber>;
|
|
311
|
+
repliedAuto: z.ZodNullable<z.ZodNumber>;
|
|
312
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
313
|
+
scope: z.ZodEnum<{
|
|
314
|
+
campaign: "campaign";
|
|
315
|
+
sender: "sender";
|
|
316
|
+
step: "step";
|
|
317
|
+
workspace: "workspace";
|
|
318
|
+
}>;
|
|
319
|
+
scopeRef: z.ZodString;
|
|
320
|
+
sent: z.ZodNullable<z.ZodNumber>;
|
|
321
|
+
stepIndex: z.ZodNullable<z.ZodNumber>;
|
|
322
|
+
timezone: z.ZodNullable<z.ZodString>;
|
|
323
|
+
unsubscribed: z.ZodNullable<z.ZodNumber>;
|
|
324
|
+
variantKey: z.ZodNullable<z.ZodString>;
|
|
325
|
+
workspaceId: z.ZodString;
|
|
326
|
+
}, z.core.$strip>;
|
|
327
|
+
export type MetricRow = z.infer<typeof metricRowSchema>;
|
|
328
|
+
export declare const workspaceSchema: z.ZodObject<{
|
|
329
|
+
name: z.ZodString;
|
|
330
|
+
provider: z.ZodString;
|
|
331
|
+
raw: z.ZodJSONSchema;
|
|
332
|
+
ref: z.ZodString;
|
|
333
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
334
|
+
sourceId: z.ZodString;
|
|
335
|
+
workspaceId: z.ZodString;
|
|
336
|
+
}, z.core.$strip>;
|
|
337
|
+
export type Workspace = z.infer<typeof workspaceSchema>;
|
|
338
|
+
export declare const eventTypeSchema: z.ZodEnum<{
|
|
339
|
+
unknown: "unknown";
|
|
340
|
+
"campaign.status_changed": "campaign.status_changed";
|
|
341
|
+
"lead.status_changed": "lead.status_changed";
|
|
342
|
+
"lead.unsubscribed": "lead.unsubscribed";
|
|
343
|
+
"linkedin.connection_accepted": "linkedin.connection_accepted";
|
|
344
|
+
"linkedin.connection_sent": "linkedin.connection_sent";
|
|
345
|
+
"linkedin.message_received": "linkedin.message_received";
|
|
346
|
+
"linkedin.message_sent": "linkedin.message_sent";
|
|
347
|
+
"meeting.booked": "meeting.booked";
|
|
348
|
+
"message.bounced": "message.bounced";
|
|
349
|
+
"message.clicked": "message.clicked";
|
|
350
|
+
"message.opened": "message.opened";
|
|
351
|
+
"message.sent": "message.sent";
|
|
352
|
+
"reply.categorized": "reply.categorized";
|
|
353
|
+
"reply.received": "reply.received";
|
|
354
|
+
"sender.status_changed": "sender.status_changed";
|
|
355
|
+
}>;
|
|
356
|
+
export type EventType = z.infer<typeof eventTypeSchema>;
|
|
357
|
+
/** Every webhook and every sync diff becomes this one shape. */
|
|
358
|
+
export declare const outboundEventSchema: z.ZodObject<{
|
|
359
|
+
campaignRef: z.ZodNullable<z.ZodString>;
|
|
360
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
361
|
+
id: z.ZodString;
|
|
362
|
+
leadRef: z.ZodNullable<z.ZodString>;
|
|
363
|
+
messageRef: z.ZodNullable<z.ZodString>;
|
|
364
|
+
occurredAt: z.ZodNullable<z.ZodISODateTime>;
|
|
365
|
+
provider: z.ZodString;
|
|
366
|
+
raw: z.ZodJSONSchema;
|
|
367
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
368
|
+
senderRef: z.ZodNullable<z.ZodString>;
|
|
369
|
+
type: z.ZodEnum<{
|
|
370
|
+
unknown: "unknown";
|
|
371
|
+
"campaign.status_changed": "campaign.status_changed";
|
|
372
|
+
"lead.status_changed": "lead.status_changed";
|
|
373
|
+
"lead.unsubscribed": "lead.unsubscribed";
|
|
374
|
+
"linkedin.connection_accepted": "linkedin.connection_accepted";
|
|
375
|
+
"linkedin.connection_sent": "linkedin.connection_sent";
|
|
376
|
+
"linkedin.message_received": "linkedin.message_received";
|
|
377
|
+
"linkedin.message_sent": "linkedin.message_sent";
|
|
378
|
+
"meeting.booked": "meeting.booked";
|
|
379
|
+
"message.bounced": "message.bounced";
|
|
380
|
+
"message.clicked": "message.clicked";
|
|
381
|
+
"message.opened": "message.opened";
|
|
382
|
+
"message.sent": "message.sent";
|
|
383
|
+
"reply.categorized": "reply.categorized";
|
|
384
|
+
"reply.received": "reply.received";
|
|
385
|
+
"sender.status_changed": "sender.status_changed";
|
|
386
|
+
}>;
|
|
387
|
+
workspaceId: z.ZodString;
|
|
388
|
+
}, z.core.$strip>;
|
|
389
|
+
export type OutboundEvent = z.infer<typeof outboundEventSchema>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** The variable's value, or `undefined` when it is unset or empty. */
|
|
2
|
+
export declare const readEnv: (name: string) => string | undefined;
|
|
3
|
+
/** An explicit option, else the environment variable, else `Unauthorized`. */
|
|
4
|
+
export declare const requireCredential: (explicit: string | undefined, envName: string, provider: string) => string;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Json } from "./json.ts";
|
|
2
|
+
export type OutboundErrorCode = "Invalid" | "NotFound" | "Provider" | "RateLimited" | "Unauthorized" | "Unsupported";
|
|
3
|
+
export interface OutboundErrorOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The original error or vendor response, for debugging. It is kept as a
|
|
6
|
+
* copy with secrets and email addresses removed, because loggers print the
|
|
7
|
+
* cause chain.
|
|
8
|
+
*/
|
|
9
|
+
readonly cause?: unknown;
|
|
10
|
+
readonly provider?: string | undefined;
|
|
11
|
+
/** The HTTP status that produced this error, when there was one. */
|
|
12
|
+
readonly status?: number | undefined;
|
|
13
|
+
/** How long the vendor asked us to wait. Set on `RateLimited`. */
|
|
14
|
+
readonly retryAfterMs?: number | undefined;
|
|
15
|
+
readonly aborted?: boolean | undefined;
|
|
16
|
+
readonly timedOut?: boolean | undefined;
|
|
17
|
+
/** Secrets to strip from the message. */
|
|
18
|
+
readonly secrets?: readonly string[] | undefined;
|
|
19
|
+
}
|
|
20
|
+
declare const BRAND: unique symbol;
|
|
21
|
+
/**
|
|
22
|
+
* The one error class the SDK throws. Branch on `code`, never on a subclass.
|
|
23
|
+
*/
|
|
24
|
+
export declare class OutboundError extends Error {
|
|
25
|
+
readonly name = "OutboundError";
|
|
26
|
+
readonly code: OutboundErrorCode;
|
|
27
|
+
readonly provider: string | undefined;
|
|
28
|
+
readonly status: number | undefined;
|
|
29
|
+
readonly retryAfterMs: number | undefined;
|
|
30
|
+
readonly aborted: boolean;
|
|
31
|
+
readonly timedOut: boolean;
|
|
32
|
+
/** `true` when retrying the same call cannot succeed. */
|
|
33
|
+
readonly permanent: boolean;
|
|
34
|
+
readonly [BRAND] = true;
|
|
35
|
+
constructor(code: OutboundErrorCode, message: string, options?: OutboundErrorOptions);
|
|
36
|
+
/** Type guard that also recognises errors from another copy of the package. */
|
|
37
|
+
static is(cause: unknown): cause is OutboundError;
|
|
38
|
+
}
|
|
39
|
+
/** What the request engine hands an adapter's `mapError`. */
|
|
40
|
+
export interface HttpFailure {
|
|
41
|
+
readonly status: number;
|
|
42
|
+
readonly body: Json | undefined;
|
|
43
|
+
readonly retryAfterMs: number | undefined;
|
|
44
|
+
}
|
|
45
|
+
export declare const isHttpFailure: (cause: unknown) => cause is HttpFailure;
|
|
46
|
+
export interface ErrorMapperOptions {
|
|
47
|
+
readonly secrets?: readonly string[];
|
|
48
|
+
/** Per-status overrides for vendors that use a status unconventionally. */
|
|
49
|
+
readonly statusCodes?: Readonly<Record<number, OutboundErrorCode>>;
|
|
50
|
+
}
|
|
51
|
+
export type ErrorMapper = (cause: unknown) => OutboundError;
|
|
52
|
+
/**
|
|
53
|
+
* Builds an adapter's `mapError`. HTTP failures map by status; anything else
|
|
54
|
+
* becomes a retryable `Provider` error with the original kept in `cause`.
|
|
55
|
+
*/
|
|
56
|
+
export declare const makeErrorMapper: (provider: string, options?: ErrorMapperOptions) => ErrorMapper;
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface ActionEvent {
|
|
2
|
+
/** The operation, for example `campaigns.list`. */
|
|
3
|
+
readonly action: string;
|
|
4
|
+
readonly provider: string;
|
|
5
|
+
readonly workspaceId: string;
|
|
6
|
+
readonly durationMs: number;
|
|
7
|
+
/** Vendor requests the call made. */
|
|
8
|
+
readonly requests: number;
|
|
9
|
+
readonly throttledMs: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ErrorEvent {
|
|
12
|
+
readonly action: string;
|
|
13
|
+
readonly provider: string;
|
|
14
|
+
readonly workspaceId: string;
|
|
15
|
+
readonly error: Error;
|
|
16
|
+
}
|
|
17
|
+
export interface RetryEvent {
|
|
18
|
+
readonly provider: string;
|
|
19
|
+
/** The attempt that failed, starting at 1. */
|
|
20
|
+
readonly attempt: number;
|
|
21
|
+
readonly delayMs: number;
|
|
22
|
+
readonly reason: string;
|
|
23
|
+
/** The request URL with secrets removed. */
|
|
24
|
+
readonly url: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ThrottleEvent {
|
|
27
|
+
readonly provider: string;
|
|
28
|
+
readonly lane: string;
|
|
29
|
+
readonly waitMs: number;
|
|
30
|
+
}
|
|
31
|
+
export interface RequestEvent {
|
|
32
|
+
readonly provider: string;
|
|
33
|
+
readonly method: string;
|
|
34
|
+
/** The request URL with secrets removed. */
|
|
35
|
+
readonly url: string;
|
|
36
|
+
readonly lane: string;
|
|
37
|
+
/** The HTTP status, or `null` when no response arrived. */
|
|
38
|
+
readonly status: number | null;
|
|
39
|
+
readonly durationMs: number;
|
|
40
|
+
/** Which attempt this was, starting at 1. */
|
|
41
|
+
readonly attempt: number;
|
|
42
|
+
}
|
|
43
|
+
type Hook<Event> = (event: Event) => void | Promise<void>;
|
|
44
|
+
export interface OutboundHooks {
|
|
45
|
+
readonly onAction?: Hook<ActionEvent> | undefined;
|
|
46
|
+
readonly onError?: Hook<ErrorEvent> | undefined;
|
|
47
|
+
/** Fires once per HTTP request, after it settles. */
|
|
48
|
+
readonly onRequest?: Hook<RequestEvent> | undefined;
|
|
49
|
+
readonly onRetry?: Hook<RetryEvent> | undefined;
|
|
50
|
+
readonly onThrottle?: Hook<ThrottleEvent> | undefined;
|
|
51
|
+
}
|
|
52
|
+
export declare const fire: <Event>(hook: Hook<Event> | undefined, event: Event) => void;
|
|
53
|
+
/** One set of hooks that calls every set given, in order. */
|
|
54
|
+
export declare const mergeHooks: (all: readonly (OutboundHooks | undefined)[]) => OutboundHooks;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type Json = string | number | boolean | null | Json[] | JsonObject;
|
|
2
|
+
export interface JsonObject {
|
|
3
|
+
[key: string]: Json;
|
|
4
|
+
}
|
|
5
|
+
export declare const isJsonObject: (value: Json | undefined) => value is JsonObject;
|
|
6
|
+
export declare const isJsonArray: (value: Json | undefined) => value is Json[];
|
|
7
|
+
export declare const isString: (value: Json | undefined) => value is string;
|
|
8
|
+
export declare const isNumber: (value: Json | undefined) => value is number;
|
|
9
|
+
export declare const isBoolean: (value: Json | undefined) => value is boolean;
|
|
10
|
+
/** Reads `key` when `value` is an object, otherwise `undefined`. */
|
|
11
|
+
export declare const field: (value: Json | undefined, key: string) => Json | undefined;
|
|
12
|
+
/** A non-empty trimmed string, or `null`. Numbers become strings. */
|
|
13
|
+
export declare const text: (value: Json | undefined) => string | null;
|
|
14
|
+
/** A finite number, or `null`. Numeric strings are parsed. */
|
|
15
|
+
export declare const count: (value: Json | undefined) => number | null;
|
|
16
|
+
export declare const flag: (value: Json | undefined) => boolean | null;
|
|
17
|
+
export declare const list: (value: Json | undefined) => Json[];
|
|
18
|
+
export declare const objects: (value: Json | undefined) => JsonObject[];
|
|
19
|
+
/** An ISO 8601 UTC timestamp, or `null` when the value is not a date. */
|
|
20
|
+
export declare const timestamp: (value: Json | undefined) => string | null;
|
|
21
|
+
/** A lowercased, trimmed email address, or `null`. */
|
|
22
|
+
export declare const emailAddress: (value: Json | undefined) => string | null;
|
|
23
|
+
/** Parses a JSON string, returning `undefined` when it is not valid JSON. */
|
|
24
|
+
export declare const parseJson: (source: string) => Json | undefined;
|
|
25
|
+
/** An object's scalar values as strings, for a lead's custom fields. */
|
|
26
|
+
export declare const stringMap: (value: Json | undefined) => {
|
|
27
|
+
[k: string]: string;
|
|
28
|
+
};
|
|
29
|
+
/** A JSON object without the keys whose value is `null` or `undefined`. */
|
|
30
|
+
export declare const compactObject: (entries: Readonly<Record<string, Json | undefined>>) => JsonObject;
|
|
31
|
+
/**
|
|
32
|
+
* A typed value as plain JSON, the way `JSON.stringify` would write it:
|
|
33
|
+
* `undefined` keys are dropped and anything that is not JSON becomes `null`.
|
|
34
|
+
*/
|
|
35
|
+
export declare const toJson: <Value>(value: Value) => Json;
|
|
36
|
+
/**
|
|
37
|
+
* Says which key of `input` is not one of `known`, or `undefined` when every
|
|
38
|
+
* key is. Used so an input that would be ignored is refused instead.
|
|
39
|
+
*/
|
|
40
|
+
export declare const unknownKey: (known: readonly string[], input: Json | undefined) => string | undefined;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface RateWindow {
|
|
2
|
+
/** Requests allowed in the window. */
|
|
3
|
+
readonly requests: number;
|
|
4
|
+
/** Window length in milliseconds. */
|
|
5
|
+
readonly perMs: number;
|
|
6
|
+
}
|
|
7
|
+
export interface RateLimitHeaders {
|
|
8
|
+
/** Header holding the requests left in the current window. */
|
|
9
|
+
readonly remaining?: string | undefined;
|
|
10
|
+
/** Header holding when the window resets. */
|
|
11
|
+
readonly reset?: string | undefined;
|
|
12
|
+
/** How to read `reset`: seconds until reset, or an epoch in seconds. */
|
|
13
|
+
readonly resetUnit?: "epoch-seconds" | "seconds" | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface LimitDeclaration {
|
|
16
|
+
/** The vendor's published limits. A request must fit every window. */
|
|
17
|
+
readonly windows: readonly RateWindow[];
|
|
18
|
+
/** Requests in flight at once for one credential. Defaults to 8. */
|
|
19
|
+
readonly concurrency?: number | undefined;
|
|
20
|
+
/** Endpoints with their own stricter cap, on top of `windows`. */
|
|
21
|
+
readonly lanes?: Readonly<Record<string, readonly RateWindow[]>> | undefined;
|
|
22
|
+
/** Rate-limit headers the vendor sends, when it sends any. */
|
|
23
|
+
readonly headers?: RateLimitHeaders | undefined;
|
|
24
|
+
/** Where the numbers came from, and whether they were confirmed. */
|
|
25
|
+
readonly source: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const DEFAULT_CONCURRENCY = 8;
|
|
28
|
+
/**
|
|
29
|
+
* The fraction of a vendor's published limit the SDK uses by default. The
|
|
30
|
+
* limit is shared with the customer's other tools, so we leave room for them.
|
|
31
|
+
*/
|
|
32
|
+
export declare const DEFAULT_SHARE = 0.5;
|
|
33
|
+
/** Scales a window by `share`, never below one request. */
|
|
34
|
+
export declare const scaleWindow: (window: RateWindow, share: number) => RateWindow;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { MetricRow } from "./entities.ts";
|
|
2
|
+
export interface MetricDefinition {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly description: string;
|
|
5
|
+
}
|
|
6
|
+
/** The metric dictionary. Each number an agent sees has one written meaning. */
|
|
7
|
+
export declare const METRIC_DEFINITIONS: {
|
|
8
|
+
readonly acceptanceRate: {
|
|
9
|
+
readonly description: "LinkedIn connection requests accepted, divided by connection requests sent.";
|
|
10
|
+
readonly name: "Connection acceptance rate";
|
|
11
|
+
};
|
|
12
|
+
readonly bounceRate: {
|
|
13
|
+
readonly description: "Messages that bounced, divided by messages sent.";
|
|
14
|
+
readonly name: "Bounce rate";
|
|
15
|
+
};
|
|
16
|
+
readonly openRate: {
|
|
17
|
+
readonly description: "Unique opens divided by messages delivered (or sent when delivered is unknown). Null when open tracking is off. Mail privacy features inflate opens.";
|
|
18
|
+
readonly name: "Open rate";
|
|
19
|
+
};
|
|
20
|
+
readonly positiveReplyRate: {
|
|
21
|
+
readonly description: "Replies the vendor marked positive, divided by unique leads contacted (or messages sent when contacted is unknown).";
|
|
22
|
+
readonly name: "Positive reply rate";
|
|
23
|
+
};
|
|
24
|
+
readonly replyRate: {
|
|
25
|
+
readonly description: "Replies from people, excluding auto-replies where the vendor separates them, divided by unique leads contacted (or messages sent when contacted is unknown).";
|
|
26
|
+
readonly name: "Reply rate";
|
|
27
|
+
};
|
|
28
|
+
readonly unsubscribeRate: {
|
|
29
|
+
readonly description: "Unsubscribes divided by unique leads contacted (or messages sent).";
|
|
30
|
+
readonly name: "Unsubscribe rate";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type MetricName = keyof typeof METRIC_DEFINITIONS;
|
|
34
|
+
export interface Rate {
|
|
35
|
+
/** Between 0 and 1, or `null` when either count is missing or the base is 0. */
|
|
36
|
+
readonly value: number | null;
|
|
37
|
+
/** Which count the rate was divided by. */
|
|
38
|
+
readonly basis: "connectionsSent" | "contacted" | "delivered" | "sent" | null;
|
|
39
|
+
}
|
|
40
|
+
/** Computes every rate for one row of counts. */
|
|
41
|
+
export declare const computeRates: (row: MetricRow) => Record<MetricName, Rate>;
|
|
42
|
+
declare const COUNT_KEYS: readonly ["bounced", "clicked", "connectionsAccepted", "connectionsSent", "contacted", "delivered", "inmailsSent", "opened", "openedTotal", "positive", "replied", "repliedAuto", "sent", "unsubscribed"];
|
|
43
|
+
export type MetricCounts = Pick<MetricRow, (typeof COUNT_KEYS)[number]>;
|
|
44
|
+
/** A row of counts with every value unknown. */
|
|
45
|
+
export declare const emptyCounts: () => MetricCounts;
|
|
46
|
+
/**
|
|
47
|
+
* Adds rows together. A count stays `null` only when no row reports it, so a
|
|
48
|
+
* missing value is never turned into 0. Unique counts (opened, contacted)
|
|
49
|
+
* are summed, which over-counts people who appear in more than one row.
|
|
50
|
+
*/
|
|
51
|
+
export declare const sumCounts: (rows: readonly MetricCounts[]) => MetricCounts;
|
|
52
|
+
export {};
|