outbound-sdk 0.2.0 → 0.4.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/dist/alerts/index.js +50 -19
- package/dist/alerts/plugin.d.ts +20 -3
- package/dist/audit/index.js +2 -2
- package/dist/benchmarks/index.js +5 -5
- package/dist/budget/index.d.ts +3 -2
- package/dist/budget/index.js +11 -10
- package/dist/cards/content.d.ts +6 -1
- package/dist/cards/format.d.ts +17 -2
- package/dist/cards/index.d.ts +1 -1
- package/dist/cards/index.js +297 -132
- package/dist/cards/parts.d.ts +9 -2
- package/dist/cards/render.d.ts +20 -3
- package/dist/chunks/{chunk-U2D34ARZ.js → chunk-2D42TQFU.js} +3 -3
- package/dist/chunks/chunk-4PA526S7.js +17 -0
- package/dist/chunks/{chunk-6CVZOUHB.js → chunk-5CFO3CXG.js} +24 -0
- package/dist/chunks/{chunk-XNFESPZH.js → chunk-5FVKRIEJ.js} +168 -31
- package/dist/chunks/{chunk-PMSSUWD7.js → chunk-7LNJJ2RO.js} +217 -58
- package/dist/chunks/{chunk-XC6CZP73.js → chunk-7ZDS6SZD.js} +7 -1
- package/dist/chunks/{chunk-SBIZDCRY.js → chunk-A6WVOCA4.js} +4 -4
- package/dist/chunks/{chunk-VQSCHOBV.js → chunk-BLCJHP5H.js} +11 -4
- package/dist/chunks/{chunk-4PSO6JEK.js → chunk-BOWXGMN3.js} +6 -21
- package/dist/chunks/{chunk-DJ2IUQEU.js → chunk-C4LS2HNV.js} +3 -3
- package/dist/chunks/{chunk-AFU5E5QB.js → chunk-E6DSDCPI.js} +98 -69
- package/dist/chunks/{chunk-IPUYZD4O.js → chunk-GFDNRWR3.js} +1 -1
- package/dist/chunks/{chunk-PURHK3JU.js → chunk-IZFTTMJP.js} +4 -4
- package/dist/chunks/{chunk-E7JHLNLG.js → chunk-J7DDZ4C2.js} +15 -2
- package/dist/chunks/{chunk-FKH5N47I.js → chunk-K4USHN4C.js} +1 -1
- package/dist/chunks/chunk-LVQUSKEX.js +17 -0
- package/dist/chunks/{chunk-YOTW5ESM.js → chunk-PQSTQKRD.js} +2 -2
- package/dist/chunks/chunk-PTZO4QXR.js +15 -0
- package/dist/chunks/{chunk-LVYG7XZJ.js → chunk-QAKJ76HB.js} +1 -1
- package/dist/chunks/chunk-QGRZDTX4.js +26 -0
- package/dist/chunks/{chunk-R3Y56YVF.js → chunk-Y5RAJ6PZ.js} +2 -2
- package/dist/chunks/{chunk-RCZ7ZZFU.js → chunk-ZFVHM5JI.js} +3 -3
- package/dist/chunks/{chunk-UAT3JSJZ.js → chunk-ZOAG2C6V.js} +2 -2
- package/dist/cli/bin.js +17 -13
- package/dist/cli/commands.d.ts +11 -0
- package/dist/cli/index.js +17 -13
- package/dist/cli/mcp.d.ts +5 -0
- package/dist/cli/version.d.ts +2 -0
- package/dist/clients/index.d.ts +1 -1
- package/dist/clients/index.js +35 -10
- package/dist/clients/plugin.d.ts +9 -2
- package/dist/combine/index.js +7 -6
- package/dist/exporter/index.d.ts +5 -2
- package/dist/exporter/index.js +2 -2
- package/dist/failover/index.js +3 -3
- package/dist/fixtures/index.js +5 -4
- package/dist/heyreach/client.d.ts +2 -0
- package/dist/heyreach/index.js +71 -39
- package/dist/heyreach/map.d.ts +5 -2
- package/dist/identity/index.js +33 -17
- package/dist/identity/plugin.d.ts +2 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -10
- package/dist/insights/campaign.d.ts +3 -0
- package/dist/insights/capped.d.ts +29 -0
- package/dist/insights/copy/copy-audit.d.ts +2 -0
- package/dist/insights/copy/copy-reuse.d.ts +27 -3
- package/dist/insights/copy/index.d.ts +8 -8
- package/dist/insights/copy/reply-timing.d.ts +8 -0
- package/dist/insights/copy/reuse-base.d.ts +32 -0
- package/dist/insights/copy/shared.d.ts +39 -15
- package/dist/insights/copy/step-funnel.d.ts +16 -5
- package/dist/insights/copy/variant-test.d.ts +19 -8
- package/dist/insights/define.d.ts +56 -2
- package/dist/insights/fields.d.ts +16 -0
- package/dist/insights/index.d.ts +2 -1
- package/dist/insights/index.js +1494 -730
- package/dist/insights/inputs.generated.d.ts +951 -0
- package/dist/insights/ops/campaign-diagnosis.d.ts +3 -1
- package/dist/insights/ops/campaign-ranking.d.ts +12 -4
- package/dist/insights/ops/channel-mix.d.ts +2 -1
- package/dist/insights/ops/client-report.d.ts +18 -5
- package/dist/insights/ops/index.d.ts +6 -2
- package/dist/insights/ops/period-comparison.d.ts +14 -3
- package/dist/insights/ops/pipeline-forecast.d.ts +14 -4
- package/dist/insights/ops/shared.d.ts +29 -24
- package/dist/insights/ops/tag-rollup.d.ts +2 -1
- package/dist/insights/people/account-summary.d.ts +13 -0
- package/dist/insights/people/dropped-replies.d.ts +8 -0
- package/dist/insights/people/find.d.ts +7 -1
- package/dist/insights/people/hot-leads.d.ts +16 -1
- package/dist/insights/people/person-summary.d.ts +6 -0
- package/dist/insights/people/read.d.ts +26 -10
- package/dist/insights/people/suppression-check.d.ts +11 -2
- package/dist/insights/plugin.d.ts +7 -5
- package/dist/insights/ref.d.ts +6 -0
- package/dist/insights/registry.d.ts +28 -16
- package/dist/insights/senders/bounce-watch.d.ts +25 -8
- package/dist/insights/senders/capacity-sends.d.ts +22 -0
- package/dist/insights/senders/domain-health.d.ts +10 -4
- package/dist/insights/senders/index.d.ts +14 -6
- package/dist/insights/senders/read.d.ts +15 -14
- package/dist/insights/senders/sender-capacity.d.ts +5 -13
- package/dist/insights/senders/sender-load.d.ts +2 -0
- package/dist/insights/stats.d.ts +8 -0
- package/dist/insights/tools.d.ts +3 -2
- package/dist/instantly/client.d.ts +2 -0
- package/dist/instantly/index.js +44 -29
- package/dist/instantly/map.d.ts +6 -2
- package/dist/internal/engine/request.d.ts +5 -0
- package/dist/internal/entities.d.ts +3 -20
- package/dist/internal/errors.d.ts +44 -0
- package/dist/internal/fields.d.ts +1 -1
- package/dist/internal/json.d.ts +9 -2
- package/dist/internal/lists.d.ts +24 -0
- package/dist/internal/numbers.d.ts +8 -0
- package/dist/internal/outbound/collections.d.ts +4 -0
- package/dist/internal/outbound/create.d.ts +24 -3
- package/dist/internal/outbound/outbound.d.ts +13 -1
- package/dist/internal/outbound/validate.d.ts +4 -0
- package/dist/internal/outbound/walker.d.ts +3 -2
- package/dist/internal/plural.d.ts +12 -0
- package/dist/internal/renamed.d.ts +28 -0
- package/dist/internal/vocabulary.d.ts +20 -0
- package/dist/loader/index.js +5 -5
- package/dist/memory/adapter.d.ts +7 -0
- package/dist/memory/demo-stats.d.ts +3 -0
- package/dist/memory/demo.d.ts +14 -3
- package/dist/memory/index.d.ts +1 -0
- package/dist/memory/index.js +200 -95
- package/dist/providers/index.d.ts +72 -0
- package/dist/providers/index.js +3 -1
- package/dist/reconcile/index.js +5 -4
- package/dist/redact/index.js +10 -4
- package/dist/redact/plugin.d.ts +7 -0
- package/dist/smartlead/index.js +102 -49
- package/dist/smartlead/shared.d.ts +13 -0
- package/dist/sync/index.js +2 -2
- package/dist/tools/ai-sdk.js +8 -6
- package/dist/tools/campaign-tools.d.ts +1 -1
- package/dist/tools/claude-agent.js +8 -6
- package/dist/tools/index.js +9 -7
- package/dist/tools/input-problem.d.ts +8 -0
- package/dist/tools/registry.d.ts +7 -2
- package/dist/tools/shared.d.ts +7 -0
- package/dist/tracing/index.js +2 -2
- package/dist/webhooks/index.js +10 -9
- package/package.json +1 -1
package/dist/instantly/map.d.ts
CHANGED
|
@@ -18,5 +18,9 @@ export interface ListEnvelope {
|
|
|
18
18
|
readonly items: JsonObject[];
|
|
19
19
|
readonly next: string | undefined;
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* `{ items, next_starting_after }`: the shape of every Instantly list, with
|
|
23
|
+
* `items` required. Any other answer, a bare array included, is a `Provider`
|
|
24
|
+
* error naming `path`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const listEnvelope: (body: Json, provider: string, path: string) => ListEnvelope;
|
|
@@ -15,6 +15,11 @@ export interface CallState {
|
|
|
15
15
|
readonly deadlineAt: number | undefined;
|
|
16
16
|
/** Stop after this many vendor requests. A plugin may lower it. */
|
|
17
17
|
maxRequests: number | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The setting to raise when `maxRequests` stops the call, named in the
|
|
20
|
+
* error. Defaults to "maxRequests". A plugin that lowers the cap sets it.
|
|
21
|
+
*/
|
|
22
|
+
maxRequestsSetBy: string | undefined;
|
|
18
23
|
/**
|
|
19
24
|
* Runs as each vendor request is about to be sent, after any wait, with no
|
|
20
25
|
* other request able to slip in between. A plugin that caps requests across
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
import { campaignStatusSchema, replyCategorySchema } from "./vocabulary.ts";
|
|
3
|
+
export { campaignStatusSchema, replyCategorySchema, SCHEMA_VERSION, } from "./vocabulary.ts";
|
|
4
4
|
/** The fields every entity carries. */
|
|
5
5
|
export declare const baseFields: {
|
|
6
6
|
provider: z.ZodString;
|
|
@@ -17,14 +17,6 @@ export declare const channelSchema: z.ZodEnum<{
|
|
|
17
17
|
linkedin: "linkedin";
|
|
18
18
|
}>;
|
|
19
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
20
|
export type CampaignStatus = z.infer<typeof campaignStatusSchema>;
|
|
29
21
|
export declare const campaignSchema: z.ZodObject<{
|
|
30
22
|
channel: z.ZodEnum<{
|
|
@@ -149,15 +141,6 @@ export declare const senderSchema: z.ZodObject<{
|
|
|
149
141
|
workspaceId: z.ZodString;
|
|
150
142
|
}, z.core.$strip>;
|
|
151
143
|
export type Sender = z.infer<typeof senderSchema>;
|
|
152
|
-
export declare const replyCategorySchema: z.ZodEnum<{
|
|
153
|
-
unknown: "unknown";
|
|
154
|
-
bounce: "bounce";
|
|
155
|
-
negative: "negative";
|
|
156
|
-
neutral: "neutral";
|
|
157
|
-
ooo: "ooo";
|
|
158
|
-
positive: "positive";
|
|
159
|
-
unsubscribe: "unsubscribe";
|
|
160
|
-
}>;
|
|
161
144
|
export type ReplyCategory = z.infer<typeof replyCategorySchema>;
|
|
162
145
|
export declare const leadStatusSchema: z.ZodEnum<{
|
|
163
146
|
active: "active";
|
|
@@ -252,8 +235,8 @@ export declare const leadSchema: z.ZodObject<{
|
|
|
252
235
|
export type Lead = z.infer<typeof leadSchema>;
|
|
253
236
|
export declare const messageSchema: z.ZodObject<{
|
|
254
237
|
direction: z.ZodEnum<{
|
|
255
|
-
in: "in";
|
|
256
238
|
out: "out";
|
|
239
|
+
in: "in";
|
|
257
240
|
}>;
|
|
258
241
|
bodyHtml: z.ZodNullable<z.ZodString>;
|
|
259
242
|
bodyText: z.ZodNullable<z.ZodString>;
|
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
import type { Json, JsonObject } from "./json.ts";
|
|
2
2
|
export type OutboundErrorCode = "Invalid" | "NotFound" | "Provider" | "RateLimited" | "Unauthorized" | "Unsupported";
|
|
3
|
+
/**
|
|
4
|
+
* What stopped a `RateLimited` call.
|
|
5
|
+
*
|
|
6
|
+
* - `vendor`: the vendor answered 429 and the SDK's retries did not get past it.
|
|
7
|
+
* - `deadline`: the SDK's own rate budget was full, and waiting for room
|
|
8
|
+
* would pass the call's `deadline`. No request was sent.
|
|
9
|
+
* - `call`: the call reached its request cap (`maxRequests` on the call or on
|
|
10
|
+
* `createOutbound`, or `budget({ per: "call" })`).
|
|
11
|
+
* - `run`: a `budget({ per: "run" })` has nothing left.
|
|
12
|
+
*
|
|
13
|
+
* `vendor` and `deadline` can work later. `call` and `run` are caps you set,
|
|
14
|
+
* so the same call stops the same way until you raise or reset them.
|
|
15
|
+
*/
|
|
16
|
+
export type RequestLimit = "call" | "deadline" | "run" | "vendor";
|
|
17
|
+
/**
|
|
18
|
+
* What a `listAll().toArray()` walk had fetched when it stopped. Resume with
|
|
19
|
+
* `listAll({ cursor })`: no record is skipped or repeated.
|
|
20
|
+
*/
|
|
21
|
+
export interface PartialWalk {
|
|
22
|
+
/** The records fetched before the stop, in order. */
|
|
23
|
+
readonly items: readonly unknown[];
|
|
24
|
+
/** Where to resume. `undefined` when no page was finished: start over. */
|
|
25
|
+
readonly cursor: string | undefined;
|
|
26
|
+
/** Vendor requests the walk made, including the one that failed. */
|
|
27
|
+
readonly requests: number;
|
|
28
|
+
}
|
|
3
29
|
export interface OutboundErrorOptions {
|
|
4
30
|
/**
|
|
5
31
|
* The original error or vendor response, for debugging. It is kept as a
|
|
@@ -14,6 +40,13 @@ export interface OutboundErrorOptions {
|
|
|
14
40
|
readonly retryAfterMs?: number | undefined;
|
|
15
41
|
readonly aborted?: boolean | undefined;
|
|
16
42
|
readonly timedOut?: boolean | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* What stopped a `RateLimited` call. Defaults to `vendor` when there is an
|
|
45
|
+
* HTTP status. A `call` or `run` cap makes the error permanent.
|
|
46
|
+
*/
|
|
47
|
+
readonly limit?: RequestLimit | undefined;
|
|
48
|
+
/** What a `toArray()` walk had fetched when it stopped. */
|
|
49
|
+
readonly partial?: PartialWalk | undefined;
|
|
17
50
|
/** Secrets to strip from the message. */
|
|
18
51
|
readonly secrets?: readonly string[] | undefined;
|
|
19
52
|
}
|
|
@@ -29,6 +62,17 @@ export declare class OutboundError extends Error {
|
|
|
29
62
|
readonly retryAfterMs: number | undefined;
|
|
30
63
|
readonly aborted: boolean;
|
|
31
64
|
readonly timedOut: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* What stopped a `RateLimited` call: the vendor, a deadline, or a request
|
|
67
|
+
* cap of your own. `undefined` on every other code.
|
|
68
|
+
*/
|
|
69
|
+
readonly limit: RequestLimit | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Set when `listAll().toArray()` stopped part way: the records it had
|
|
72
|
+
* fetched and the cursor to resume from. A partial answer is never returned
|
|
73
|
+
* as if it were complete.
|
|
74
|
+
*/
|
|
75
|
+
readonly partial: PartialWalk | undefined;
|
|
32
76
|
/** `true` when retrying the same call cannot succeed. */
|
|
33
77
|
readonly permanent: boolean;
|
|
34
78
|
readonly [BRAND] = true;
|
|
@@ -162,8 +162,8 @@ export declare const RECORD_SCHEMAS: {
|
|
|
162
162
|
}, z.core.$strip>;
|
|
163
163
|
readonly message: z.ZodObject<{
|
|
164
164
|
direction: z.ZodEnum<{
|
|
165
|
-
in: "in";
|
|
166
165
|
out: "out";
|
|
166
|
+
in: "in";
|
|
167
167
|
}>;
|
|
168
168
|
bodyHtml: z.ZodNullable<z.ZodString>;
|
|
169
169
|
bodyText: z.ZodNullable<z.ZodString>;
|
package/dist/internal/json.d.ts
CHANGED
|
@@ -36,9 +36,16 @@ export declare const compactObject: (entries: Readonly<Record<string, Json | und
|
|
|
36
36
|
*/
|
|
37
37
|
export declare const toJson: <Value>(value: Value) => Json;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
39
|
+
* `toJson`, or `undefined` for a value `JSON.stringify` cannot write (a
|
|
40
|
+
* BigInt, a cycle). For an input from a caller, such as a tool's.
|
|
41
41
|
*/
|
|
42
|
+
export declare const jsonInput: <Value>(value: Value) => Json | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Says which of the `given` keys is not one of `known`, or `undefined` when
|
|
45
|
+
* every one is. Used so an input that would be ignored is refused instead.
|
|
46
|
+
*/
|
|
47
|
+
export declare const strayKey: (known: readonly string[], given: readonly string[], noun?: string) => string | undefined;
|
|
48
|
+
/** `strayKey` for a JSON input: which key of `input` is not one of `known`. */
|
|
42
49
|
export declare const unknownKey: (known: readonly string[], input: Json | undefined) => string | undefined;
|
|
43
50
|
/**
|
|
44
51
|
* A copy of `value` without any key that matches `secret`, at any depth. A
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Json } from "./json.ts";
|
|
2
|
+
/**
|
|
3
|
+
* A vendor list that must be a JSON array. Anything else is a `Provider`
|
|
4
|
+
* error with `status: 200`, the answer it was found in.
|
|
5
|
+
*/
|
|
6
|
+
export declare const requireList: (value: Json | undefined, provider: string, message: string) => Json[];
|
|
7
|
+
export interface ListPlace {
|
|
8
|
+
/** The vendor as a person names it: `Instantly`. */
|
|
9
|
+
readonly vendor: string;
|
|
10
|
+
/** The adapter's provider name, for the error. */
|
|
11
|
+
readonly provider: string;
|
|
12
|
+
/** The request, as the error names it: `/campaigns`. */
|
|
13
|
+
readonly path: string;
|
|
14
|
+
/** The field of the answer that holds the array. Omitted when the answer is the array. */
|
|
15
|
+
readonly key?: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
/** The message for an answer that is not the documented list. */
|
|
18
|
+
export declare const noListMessage: (place: ListPlace) => string;
|
|
19
|
+
/**
|
|
20
|
+
* The array a vendor answer holds under `place.key`, or the answer itself
|
|
21
|
+
* when it has no key. Anything else is a `Provider` error that says what was
|
|
22
|
+
* expected.
|
|
23
|
+
*/
|
|
24
|
+
export declare const listIn: (body: Json | undefined, place: ListPlace) => Json[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** A count for a sentence, with thousands separators and at most one decimal: `2,000`, `1.5`. */
|
|
2
|
+
export declare const count: (amount: number) => string;
|
|
3
|
+
/** A rate in percent points with at most one decimal and no sign: `0.0525` as `5.3`, `0.05` as `5`. */
|
|
4
|
+
export declare const points: (rate: number) => string;
|
|
5
|
+
/** A rate as a percent: `0.0525` as `5.3%`, `0.05` as `5%`. */
|
|
6
|
+
export declare const percentOf: (rate: number) => string;
|
|
7
|
+
/** `1 lead`, `2,000 leads`. Pass `many` when adding an `s` is wrong. */
|
|
8
|
+
export declare const plural: (amount: number, one: string, many?: string) => string;
|
|
@@ -11,6 +11,10 @@ export interface PageRequest {
|
|
|
11
11
|
export interface ListSpec<Item, Filters> {
|
|
12
12
|
readonly action: OperationKind;
|
|
13
13
|
readonly schema: ZodType<Item>;
|
|
14
|
+
/** Every filter the listing takes. Any other key is refused, so a misspelt filter cannot widen the answer. */
|
|
15
|
+
readonly takes: {
|
|
16
|
+
readonly [Key in keyof Filters]-?: true;
|
|
17
|
+
};
|
|
14
18
|
/** Checks the filters and the capabilities they need. Returns clean filters. */
|
|
15
19
|
readonly prepare: (filters: Filters) => Filters;
|
|
16
20
|
readonly toOperation: (filters: Filters, page: PageRequest) => Operation;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Adapter } from "../adapter.ts";
|
|
1
2
|
import type { NativeCatalog, NoNative } from "../native.ts";
|
|
2
3
|
import { Outbound } from "./outbound.ts";
|
|
3
4
|
import type { OutboundOptions } from "./outbound.ts";
|
|
@@ -6,11 +7,31 @@ type ExtensionOf<Plugin> = Plugin extends OutboundPlugin<infer Extension> ? unkn
|
|
|
6
7
|
type UnionToIntersection<Union> = (Union extends unknown ? (value: Union) => void : never) extends (value: infer Intersection) => void ? Intersection : never;
|
|
7
8
|
/** The methods a list of plugins adds to the instance. */
|
|
8
9
|
export type ExtensionsOf<Plugins extends readonly OutboundPlugin[]> = UnionToIntersection<ExtensionOf<Plugins[number]>>;
|
|
10
|
+
/**
|
|
11
|
+
* The type of an instance built with these plugins, for a function that
|
|
12
|
+
* takes one:
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* const plugins = [insights(), exporter()];
|
|
16
|
+
* type MyOutbound = OutboundWith<typeof plugins>;
|
|
17
|
+
* const brief = async (outbound: MyOutbound) => outbound.insights.hotLeads({});
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* `Outbound` alone is an instance with no plugins.
|
|
21
|
+
*/
|
|
22
|
+
export type OutboundWith<Plugins extends readonly OutboundPlugin[] = [], Native extends NativeCatalog = NoNative> = Outbound<Native> & ExtensionsOf<Plugins>;
|
|
23
|
+
/**
|
|
24
|
+
* The native catalog of an adapter type. A union of adapters, as from
|
|
25
|
+
* `cond ? smartlead() : instantly()`, gives the union of their catalogs, so
|
|
26
|
+
* only the reads they share are typed.
|
|
27
|
+
*/
|
|
28
|
+
export type NativeOf<Given> = Given extends Adapter<infer Native> ? Native : NoNative;
|
|
9
29
|
/**
|
|
10
30
|
* Creates the client. One instance wraps one adapter; `combine()` puts
|
|
11
31
|
* several adapters behind one.
|
|
12
32
|
*/
|
|
13
|
-
export declare const createOutbound: <const Plugins extends readonly OutboundPlugin[] = [],
|
|
14
|
-
readonly
|
|
15
|
-
|
|
33
|
+
export declare const createOutbound: <const Plugins extends readonly OutboundPlugin[] = [], const Given extends Adapter<NativeCatalog> = Adapter>(options: Omit<OutboundOptions, "adapter"> & {
|
|
34
|
+
readonly adapter: Given;
|
|
35
|
+
readonly plugins?: Plugins | readonly Plugins[number][] | undefined;
|
|
36
|
+
}) => NoInfer<OutboundWith<Plugins, NativeOf<Given>>>;
|
|
16
37
|
export {};
|
|
@@ -11,8 +11,20 @@ import type { OutboundHooks } from "../hooks.ts";
|
|
|
11
11
|
import type { NativeCatalog, NoNative } from "../native.ts";
|
|
12
12
|
import type { CampaignFilters, CampaignHandle, Collection, Estimate, EstimateQuery, LeadFilters, LeadHandle, ListHandle, MessageFilters, NativeClient, OutboundApi, RawClient, ReadCollection, ReplyFilters, SenderFilters, SenderHandle, StatsResult, ThreadHandle, TopLevelStatsOptions, WebhookFilters } from "./api.ts";
|
|
13
13
|
import type { OutboundPlugin } from "./plugins.ts";
|
|
14
|
-
export interface OutboundOptions<Native extends NativeCatalog = NoNative> extends OperationOptions {
|
|
14
|
+
export interface OutboundOptions<Native extends NativeCatalog = NoNative> extends Omit<OperationOptions, "maxRequests"> {
|
|
15
15
|
readonly adapter: Adapter<Native>;
|
|
16
|
+
/**
|
|
17
|
+
* The most vendor requests each SDK call may send, retries included. It is
|
|
18
|
+
* not a total for the instance: for that, use `budget({ maxRequests })`.
|
|
19
|
+
* A `maxRequests` on one call replaces it for that call.
|
|
20
|
+
*/
|
|
21
|
+
readonly maxRequestsPerCall?: number | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use `maxRequestsPerCall`. On `createOutbound` this caps each
|
|
24
|
+
* call, not the whole run. It keeps working, with a warning, until a later
|
|
25
|
+
* minor version removes it.
|
|
26
|
+
*/
|
|
27
|
+
readonly maxRequests?: number | undefined;
|
|
16
28
|
/** `plugins[0]` is the outermost layer. */
|
|
17
29
|
readonly plugins?: readonly OutboundPlugin[] | undefined;
|
|
18
30
|
readonly hooks?: OutboundHooks | undefined;
|
|
@@ -2,4 +2,8 @@ import type { TimeRange } from "../adapter.ts";
|
|
|
2
2
|
export declare const normalizeRange: (range: TimeRange) => TimeRange;
|
|
3
3
|
export declare const assertDay: (value: string | undefined, name: string) => string | undefined;
|
|
4
4
|
export declare const assertLimit: (limit: number | undefined) => number | undefined;
|
|
5
|
+
/** `max` for `listAll`: a positive integer, like `limit`. */
|
|
6
|
+
export declare const assertMax: (max: number | undefined) => number | undefined;
|
|
7
|
+
/** A plain JavaScript caller can pass anything as an id. */
|
|
8
|
+
export declare const assertIdIsString: (id: string, what: string) => string;
|
|
5
9
|
export declare const assertId: (id: string, what: string) => string;
|
|
@@ -3,10 +3,11 @@ import type { ListAll, PageResult, ResultMeta } from "./api.ts";
|
|
|
3
3
|
export interface WalkerOptions<Item> {
|
|
4
4
|
readonly cursor: string | undefined;
|
|
5
5
|
readonly max: number | undefined;
|
|
6
|
+
/** Starts the call's accounting, when the first page is asked for. */
|
|
7
|
+
readonly begin: () => CallState;
|
|
6
8
|
/** Fetches one page. `state` is shared by every page of the walk. */
|
|
7
|
-
readonly fetchPage: (cursor: string | undefined, state: CallState
|
|
9
|
+
readonly fetchPage: (cursor: string | undefined, state: CallState) => Promise<{
|
|
8
10
|
readonly page: PageResult<Item>;
|
|
9
|
-
readonly state: CallState;
|
|
10
11
|
}>;
|
|
11
12
|
/** A stable key used to drop records a shifting page returned twice. */
|
|
12
13
|
readonly keyOf: (item: Item) => string | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The word that goes with `amount`: `one` for exactly one, `many` otherwise.
|
|
3
|
+
* Works for verbs too: `noun(count, "is", "are")`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const noun: (amount: number, one: string, many?: string) => string;
|
|
6
|
+
/** `1 lead`, `3 leads`. Pass `many` when adding an `s` is wrong. */
|
|
7
|
+
export declare const plural: (amount: number, one: string, many?: string) => string;
|
|
8
|
+
/**
|
|
9
|
+
* A person key as a person reads it: `email:jo@example.com` is the address,
|
|
10
|
+
* `linkedin:jo-doe` the profile's address without `https://www.`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const shownKey: (key: string) => string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { ZodType } from "zod";
|
|
3
|
+
import type { Json } from "./json.ts";
|
|
4
|
+
/** The fields of an object schema, by name. */
|
|
5
|
+
type Fields = Readonly<Record<string, ZodType>>;
|
|
6
|
+
/**
|
|
7
|
+
* The old name of the field `to`. Pass the new field's schema without its
|
|
8
|
+
* default, so leaving the old name out does not set it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const renamed: <Schema extends ZodType>(to: string, base: Schema) => z.ZodOptional<Schema>;
|
|
11
|
+
/** The field names without the deprecated old names. */
|
|
12
|
+
export declare const liveKeys: (fields: Fields) => string[];
|
|
13
|
+
export type Renamed = {
|
|
14
|
+
readonly input: Json | undefined;
|
|
15
|
+
readonly notes: readonly string[];
|
|
16
|
+
} | {
|
|
17
|
+
readonly conflict: {
|
|
18
|
+
readonly from: string;
|
|
19
|
+
readonly to: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The input with each old name's value moved to its new name, and a note
|
|
24
|
+
* for each old name used. Both names at once is a conflict, since either
|
|
25
|
+
* value could be the one meant.
|
|
26
|
+
*/
|
|
27
|
+
export declare const applyRenames: (fields: Fields, input: Json | undefined) => Renamed;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Bumped only for a breaking change to the shapes in entities.ts. */
|
|
3
|
+
export declare const SCHEMA_VERSION: 1;
|
|
4
|
+
export declare const campaignStatusSchema: z.ZodEnum<{
|
|
5
|
+
active: "active";
|
|
6
|
+
archived: "archived";
|
|
7
|
+
completed: "completed";
|
|
8
|
+
draft: "draft";
|
|
9
|
+
paused: "paused";
|
|
10
|
+
unknown: "unknown";
|
|
11
|
+
}>;
|
|
12
|
+
export declare const replyCategorySchema: z.ZodEnum<{
|
|
13
|
+
unknown: "unknown";
|
|
14
|
+
bounce: "bounce";
|
|
15
|
+
negative: "negative";
|
|
16
|
+
neutral: "neutral";
|
|
17
|
+
ooo: "ooo";
|
|
18
|
+
positive: "positive";
|
|
19
|
+
unsubscribe: "unsubscribe";
|
|
20
|
+
}>;
|
package/dist/loader/index.js
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
configuredProviders,
|
|
4
4
|
fromEnv,
|
|
5
5
|
loadableProviders
|
|
6
|
-
} from "../chunks/chunk-
|
|
7
|
-
import "../chunks/chunk-
|
|
8
|
-
import "../chunks/chunk-
|
|
9
|
-
import "../chunks/chunk-
|
|
10
|
-
import "../chunks/chunk-
|
|
6
|
+
} from "../chunks/chunk-ZFVHM5JI.js";
|
|
7
|
+
import "../chunks/chunk-GFDNRWR3.js";
|
|
8
|
+
import "../chunks/chunk-7ZDS6SZD.js";
|
|
9
|
+
import "../chunks/chunk-J7DDZ4C2.js";
|
|
10
|
+
import "../chunks/chunk-BLCJHP5H.js";
|
|
11
11
|
export {
|
|
12
12
|
ALL_PROVIDERS,
|
|
13
13
|
configuredProviders,
|
package/dist/memory/adapter.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Adapter } from "../internal/adapter.ts";
|
|
2
2
|
import type { CapabilityDeclaration } from "../internal/capabilities.ts";
|
|
3
|
+
import type { FieldDeclaration } from "../internal/fields.ts";
|
|
3
4
|
import type { MemoryData } from "./data.ts";
|
|
4
5
|
export interface MemoryOptions {
|
|
5
6
|
readonly data?: MemoryData | undefined;
|
|
@@ -11,6 +12,12 @@ export interface MemoryOptions {
|
|
|
11
12
|
readonly pageSize?: number | undefined;
|
|
12
13
|
/** Overrides what the adapter declares, to exercise gating and fallbacks. */
|
|
13
14
|
readonly capabilities?: CapabilityDeclaration | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* The fields this adapter says it never fills, as a vendor adapter declares
|
|
17
|
+
* them, for example `{ campaign: { tags: false } }` to act like a tool whose
|
|
18
|
+
* campaigns have no tags. Defaults to every field filled.
|
|
19
|
+
*/
|
|
20
|
+
readonly fields?: FieldDeclaration | undefined;
|
|
14
21
|
}
|
|
15
22
|
/** An adapter over data held in memory. */
|
|
16
23
|
export declare const memory: (options?: MemoryOptions) => Adapter;
|
package/dist/memory/demo.d.ts
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import type { MemoryData } from "./data.ts";
|
|
2
|
+
export interface DemoDataOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The moment the data is built for: every date is counted back from its
|
|
5
|
+
* day. Defaults to now. Pass a fixed time for output that never changes.
|
|
6
|
+
*/
|
|
7
|
+
readonly now?: Date | number | string | undefined;
|
|
8
|
+
}
|
|
2
9
|
/**
|
|
3
10
|
* A small made-up dataset for demos and docs: two campaigns, two mailboxes,
|
|
4
|
-
* three leads,
|
|
5
|
-
* entry. No real people
|
|
11
|
+
* three leads, three messages, three weeks of daily stats split by step and
|
|
12
|
+
* variant, and one list, tag, webhook and block list entry. No real people
|
|
13
|
+
* or companies. Its dates sit in the weeks before `now`, so the reports over
|
|
14
|
+
* the last seven or fourteen days find data on any day it is called. Step 0
|
|
15
|
+
* of "Q4 SaaS founders" runs an A/B test, both campaigns share a follow-up,
|
|
16
|
+
* and four days before `now` bounces spike.
|
|
6
17
|
*/
|
|
7
|
-
export declare const demoData: () => MemoryData;
|
|
18
|
+
export declare const demoData: (options?: DemoDataOptions) => MemoryData;
|
package/dist/memory/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export type { MemoryOptions } from "./adapter.ts";
|
|
|
3
3
|
export type { MemoryBlockEntry, MemoryHealth, MemoryList, MemorySettings, MemoryTag, MemoryWebhook, } from "./account.ts";
|
|
4
4
|
export type { MemoryCampaign, MemoryData, MemoryLead, MemoryMessage, MemorySender, MemoryStats, MemoryStep, MemorySubsequence, MemoryVariant, } from "./data.ts";
|
|
5
5
|
export { demoData } from "./demo.ts";
|
|
6
|
+
export type { DemoDataOptions } from "./demo.ts";
|