outbound-sdk 0.7.0 → 0.8.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 +3 -3
- package/dist/audit/index.js +1 -1
- package/dist/benchmarks/index.js +3 -3
- package/dist/budget/index.d.ts +7 -0
- package/dist/budget/index.js +3 -3
- package/dist/cache/index.js +2 -2
- package/dist/cards/index.js +17 -5
- package/dist/chunks/{chunk-ZJCVLBAE.js → chunk-4GK56PRO.js} +667 -363
- package/dist/chunks/{chunk-MW4C6LTN.js → chunk-7TASUWPC.js} +2 -2
- package/dist/chunks/{chunk-M2VXGLLZ.js → chunk-CPACP4YD.js} +1 -1
- package/dist/chunks/{chunk-4AVYRVN5.js → chunk-FTK4JS65.js} +31 -10
- package/dist/chunks/{chunk-YW6FFVSZ.js → chunk-HXB2IOJJ.js} +1 -1
- package/dist/chunks/{chunk-Y7KECJAV.js → chunk-IKKCMWBK.js} +1 -1
- package/dist/chunks/{chunk-FHKSLCVW.js → chunk-KVAG5GM2.js} +19 -0
- package/dist/chunks/{chunk-7I3EPR23.js → chunk-MPE6VLLY.js} +3 -3
- package/dist/chunks/{chunk-UFQ4WMLU.js → chunk-NFWWA7MI.js} +1 -1
- package/dist/chunks/{chunk-GL7BABF2.js → chunk-OMCDMELK.js} +1 -1
- package/dist/chunks/{chunk-JRL3QRBS.js → chunk-OVTYA3IB.js} +88 -28
- package/dist/chunks/{chunk-HIAK2GCI.js → chunk-RMAHQ2OZ.js} +5 -1
- package/dist/chunks/{chunk-65YAGEWZ.js → chunk-RQLOPMMR.js} +153 -39
- package/dist/chunks/{chunk-OK3GAZMT.js → chunk-SYUMA3CP.js} +12 -0
- package/dist/chunks/{chunk-LVZGIKNF.js → chunk-U5AK6OJM.js} +1 -1
- package/dist/chunks/{chunk-KTYTE2BU.js → chunk-UAHYPASH.js} +20 -11
- package/dist/chunks/{chunk-BNDHEDHD.js → chunk-UOJG4VYF.js} +3 -3
- package/dist/chunks/{chunk-LD6F46UT.js → chunk-UWD65SK7.js} +2 -2
- package/dist/chunks/{chunk-I7DXXGNZ.js → chunk-UZLFZZ2U.js} +5 -5
- package/dist/chunks/{chunk-DNPNTD5W.js → chunk-VVDBCQLK.js} +1 -1
- package/dist/chunks/{chunk-IVH3NMQZ.js → chunk-WROJO6XB.js} +1 -1
- package/dist/chunks/chunk-XMCNRU4H.js +7279 -0
- package/dist/chunks/{chunk-QFC4ZHD3.js → chunk-XYHM4KHC.js} +1 -1
- package/dist/chunks/{chunk-NAWZ73QS.js → chunk-YFJ3OQZS.js} +8 -1
- package/dist/chunks/tools-II7GXAOM.js +23 -0
- package/dist/cli/args.d.ts +48 -0
- package/dist/cli/bin.js +14 -14
- package/dist/cli/commands.d.ts +0 -7
- package/dist/cli/config.d.ts +31 -2
- package/dist/cli/envelope.d.ts +2 -0
- package/dist/cli/index.d.ts +6 -0
- package/dist/cli/index.js +19 -15
- package/dist/cli/listing.d.ts +5 -2
- package/dist/cli/mcp.d.ts +9 -0
- package/dist/cli/offered.d.ts +10 -0
- package/dist/cli/options.d.ts +6 -0
- package/dist/cli/progress.d.ts +27 -0
- package/dist/cli/serve.d.ts +17 -0
- package/dist/cli/update.d.ts +25 -2
- package/dist/clients/index.js +3 -3
- package/dist/combine/index.js +154 -35
- package/dist/combine/newest.d.ts +18 -0
- package/dist/combine/route.d.ts +19 -5
- package/dist/emailbison/index.js +22 -14
- package/dist/emailbison/map-sequence.d.ts +2 -1
- package/dist/exporter/index.js +1 -1
- package/dist/failover/index.js +3 -3
- package/dist/fixtures/index.js +4 -4
- package/dist/heyreach/capabilities.d.ts +4 -0
- package/dist/heyreach/conversations.d.ts +23 -0
- package/dist/heyreach/inbox.d.ts +0 -1
- package/dist/heyreach/index.js +251 -92
- package/dist/identity/index.js +2 -2
- package/dist/index.js +7 -7
- package/dist/insights/capped.d.ts +6 -6
- package/dist/insights/copy/index.d.ts +2 -0
- package/dist/insights/copy/reply-timing.d.ts +4 -0
- package/dist/insights/cost.d.ts +11 -1
- package/dist/insights/define.d.ts +25 -16
- package/dist/insights/inbox.d.ts +12 -0
- package/dist/insights/index.js +42 -6578
- package/dist/insights/inputs.generated.d.ts +60 -24
- package/dist/insights/ops/anomalies.d.ts +9 -0
- package/dist/insights/ops/index.d.ts +2 -0
- package/dist/insights/ops/period-comparison.d.ts +7 -8
- package/dist/insights/ops/pipeline-forecast.d.ts +10 -0
- package/dist/insights/ops/shared.d.ts +6 -1
- package/dist/insights/people/auto-replies.d.ts +11 -7
- package/dist/insights/people/dropped-replies.d.ts +13 -4
- package/dist/insights/people/hot-leads-read.d.ts +31 -0
- package/dist/insights/people/hot-leads.d.ts +15 -3
- package/dist/insights/people/index.d.ts +10 -2
- package/dist/insights/people/read.d.ts +1 -1
- package/dist/insights/registry.d.ts +14 -2
- package/dist/insights/run-cap.d.ts +10 -0
- package/dist/insights/senders/read.d.ts +0 -3
- package/dist/insights/tools.d.ts +12 -0
- package/dist/insights/tracked-reads.d.ts +53 -0
- package/dist/instantly/capabilities.d.ts +13 -1
- package/dist/instantly/index.js +122 -46
- package/dist/instantly/map-account.d.ts +2 -1
- package/dist/instantly/map-lead.d.ts +1 -0
- package/dist/instantly/map.d.ts +4 -3
- package/dist/internal/adapter.d.ts +17 -0
- package/dist/internal/capabilities.d.ts +13 -0
- package/dist/internal/engine/budget.d.ts +9 -1
- package/dist/internal/engine/engine.d.ts +2 -1
- package/dist/internal/engine/request.d.ts +2 -0
- package/dist/internal/errors.d.ts +5 -0
- package/dist/internal/hooks.d.ts +11 -0
- package/dist/internal/notes.d.ts +16 -0
- package/dist/internal/outbound/api.d.ts +14 -0
- package/dist/internal/outbound/core.d.ts +4 -1
- package/dist/internal/outbound/operation-shared.d.ts +2 -0
- package/dist/internal/sha256.d.ts +2 -0
- package/dist/internal/url.d.ts +1 -0
- package/dist/loader/index.js +3 -3
- package/dist/memory/index.js +6 -6
- package/dist/redact/index.d.ts +1 -1
- package/dist/redact/index.js +107 -19
- package/dist/redact/plugin.d.ts +26 -3
- package/dist/smartlead/index.js +22 -13
- package/dist/smartlead/map.d.ts +3 -2
- package/dist/sync/index.js +2 -2
- package/dist/tools/ai-sdk.js +5 -5
- package/dist/tools/by-name.d.ts +9 -1
- package/dist/tools/campaign-tools.d.ts +3 -1
- package/dist/tools/claude-agent.js +5 -5
- package/dist/tools/index.js +6 -6
- package/dist/tools/registry.d.ts +6 -0
- package/dist/tools/shared.d.ts +5 -1
- package/dist/tracing/index.js +1 -1
- package/dist/webhooks/index.js +11 -11
- package/package.json +1 -1
package/dist/internal/hooks.d.ts
CHANGED
|
@@ -27,6 +27,17 @@ export interface ThrottleEvent {
|
|
|
27
27
|
readonly provider: string;
|
|
28
28
|
readonly lane: string;
|
|
29
29
|
readonly waitMs: number;
|
|
30
|
+
/**
|
|
31
|
+
* `budget`: the SDK's own rate budget for the lane is full. `vendor`: the
|
|
32
|
+
* vendor answered 429, often because another process or tool on the same
|
|
33
|
+
* workspace spent the limit.
|
|
34
|
+
*/
|
|
35
|
+
readonly cause: "budget" | "vendor";
|
|
36
|
+
/** The windows the SDK keeps the lane inside, after `share` and any slowdown. */
|
|
37
|
+
readonly windows: readonly {
|
|
38
|
+
readonly requests: number;
|
|
39
|
+
readonly perMs: number;
|
|
40
|
+
}[];
|
|
30
41
|
}
|
|
31
42
|
export interface RequestEvent {
|
|
32
43
|
readonly provider: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Says what an adapter left out of a record, and why. */
|
|
2
|
+
export type Note = (text: string) => void;
|
|
3
|
+
export interface NegativeContext {
|
|
4
|
+
readonly note: Note;
|
|
5
|
+
/** The vendor's name as people know it, for example `Instantly`. */
|
|
6
|
+
readonly vendor: string;
|
|
7
|
+
/** What the value is, for example `Step 4's delay`. */
|
|
8
|
+
readonly what: string;
|
|
9
|
+
/** Written after the value in the note, for example `days`. */
|
|
10
|
+
readonly unit?: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A number the normalized record holds as 0 or more. A negative one is
|
|
14
|
+
* `null`, with a note that names it.
|
|
15
|
+
*/
|
|
16
|
+
export declare const notNegative: (value: number | null, { note, unit, vendor, what }: NegativeContext) => number | null;
|
|
@@ -22,6 +22,8 @@ export interface ResultMeta {
|
|
|
22
22
|
readonly workspaceId: string;
|
|
23
23
|
/** `true` when an older answer was served because the vendor was down. */
|
|
24
24
|
readonly stale: boolean;
|
|
25
|
+
/** What the adapter left out, and why: a vendor value it could not use, mapped to `null`. */
|
|
26
|
+
readonly notes: readonly string[];
|
|
25
27
|
}
|
|
26
28
|
export type WithMeta<Item> = Item & {
|
|
27
29
|
readonly meta: ResultMeta;
|
|
@@ -102,6 +104,10 @@ export interface LeadFilters extends TimeRange {
|
|
|
102
104
|
readonly linkedinUrl?: string | undefined;
|
|
103
105
|
/** Only the records whose email address is at exactly this domain, such as `acme.com`. Needs `leads.byDomain`. */
|
|
104
106
|
readonly domain?: string | undefined;
|
|
107
|
+
/** Only the records of the people with exactly these email addresses, read in one listing. Needs `leads.lookupMany`. */
|
|
108
|
+
readonly emails?: readonly string[] | undefined;
|
|
109
|
+
/** `positive`: only the leads the vendor labels positive (`interestCategory` `positive`). Needs `leads.byInterest`. */
|
|
110
|
+
readonly interest?: "positive" | undefined;
|
|
105
111
|
}
|
|
106
112
|
export interface WebhookFilters {
|
|
107
113
|
readonly campaignId?: string | undefined;
|
|
@@ -111,6 +117,8 @@ export interface MessageFilters extends TimeRange {
|
|
|
111
117
|
readonly leadId?: string | undefined;
|
|
112
118
|
/** A `threadId` from an earlier message. */
|
|
113
119
|
readonly threadId?: string | undefined;
|
|
120
|
+
/** `true` for the messages a person sent by hand only, leaving out the ones a campaign sent. Needs `messages.byHand`. */
|
|
121
|
+
readonly byHand?: true | undefined;
|
|
114
122
|
readonly include?: readonly Include[] | undefined;
|
|
115
123
|
}
|
|
116
124
|
export interface ReplyFilters extends TimeRange {
|
|
@@ -118,6 +126,12 @@ export interface ReplyFilters extends TimeRange {
|
|
|
118
126
|
readonly category?: ReplyCategory | undefined;
|
|
119
127
|
/** `true` for unread replies only, `false` for read ones only. */
|
|
120
128
|
readonly unread?: boolean | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Also return replies from conversations that belong to no campaign, such
|
|
131
|
+
* as a LinkedIn inbox's own messages. Only adapters whose `replies.inbox`
|
|
132
|
+
* capability is true leave any out; on the others this changes nothing.
|
|
133
|
+
*/
|
|
134
|
+
readonly includeInbox?: boolean | undefined;
|
|
121
135
|
readonly include?: readonly Include[] | undefined;
|
|
122
136
|
}
|
|
123
137
|
export interface StatsOptions extends OperationOptions {
|
|
@@ -27,10 +27,13 @@ export interface MetaInput {
|
|
|
27
27
|
readonly complete: boolean;
|
|
28
28
|
readonly stale?: boolean | undefined;
|
|
29
29
|
readonly fetchedAt?: string | undefined;
|
|
30
|
+
/** The output's notes. They join the call's, so a walk keeps every page's. */
|
|
31
|
+
readonly notes?: readonly string[] | undefined;
|
|
30
32
|
}
|
|
31
33
|
export declare const metaFor: (core: Core, state: CallState, input: MetaInput) => ResultMeta;
|
|
32
34
|
/**
|
|
33
35
|
* Checks what came back against the schema. An adapter or plugin that
|
|
34
|
-
* returns a malformed record fails here, loudly, and not in the caller.
|
|
36
|
+
* returns a malformed record fails here, loudly, and not in the caller. The
|
|
37
|
+
* error is permanent: the vendor returns the same record on every retry.
|
|
35
38
|
*/
|
|
36
39
|
export declare const checked: <Item>(core: Core, schema: ZodType<Item>, records: readonly OutboundRecord[], action: string) => Item[];
|
|
@@ -15,6 +15,8 @@ export interface OperationOutput {
|
|
|
15
15
|
readonly stale?: boolean | undefined;
|
|
16
16
|
/** When the answer was fetched, if a plugin served it from a store. ISO 8601 UTC. */
|
|
17
17
|
readonly fetchedAt?: string | undefined;
|
|
18
|
+
/** What the adapter left out of these records, and why. */
|
|
19
|
+
readonly notes?: readonly string[] | undefined;
|
|
18
20
|
}
|
|
19
21
|
export declare const unsupported: (adapter: Adapter, kind: string) => OutboundError;
|
|
20
22
|
export declare const idFor: (adapter: Adapter, id: string) => string;
|
|
@@ -2,5 +2,7 @@
|
|
|
2
2
|
export declare const sha256: (bytes: Uint8Array) => Uint8Array;
|
|
3
3
|
/** The SHA-256 digest of a UTF-8 string, as lowercase hex. */
|
|
4
4
|
export declare const sha256Hex: (input: string) => string;
|
|
5
|
+
/** HMAC-SHA-256 (RFC 2104) of a UTF-8 message under `key`, as lowercase hex. */
|
|
6
|
+
export declare const hmacSha256Hex: (key: Uint8Array, message: string) => string;
|
|
5
7
|
/** A short stable id derived from the parts, for refs, event ids and cache keys. */
|
|
6
8
|
export declare const stableId: (...parts: (string | number | null | undefined)[]) => string;
|
package/dist/internal/url.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ export declare const buildUrl: (baseUrl: string, path: string, query?: Readonly<
|
|
|
5
5
|
* The part of a LinkedIn profile URL that names the person, lowercased, or
|
|
6
6
|
* `null` when the text is not a profile URL. Two URLs for the same person can
|
|
7
7
|
* differ in scheme, host prefix, trailing slash and query; the slug does not.
|
|
8
|
+
* A slug that is not valid percent-encoding is kept undecoded.
|
|
8
9
|
*/
|
|
9
10
|
export declare const profileSlug: (url: string | null | undefined) => string | null;
|
package/dist/loader/index.js
CHANGED
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
configuredProviders,
|
|
4
4
|
fromEnv,
|
|
5
5
|
loadableProviders
|
|
6
|
-
} from "../chunks/chunk-
|
|
7
|
-
import "../chunks/chunk-
|
|
8
|
-
import "../chunks/chunk-
|
|
6
|
+
} from "../chunks/chunk-7TASUWPC.js";
|
|
7
|
+
import "../chunks/chunk-NFWWA7MI.js";
|
|
8
|
+
import "../chunks/chunk-XYHM4KHC.js";
|
|
9
9
|
import "../chunks/chunk-45TXPJW7.js";
|
|
10
10
|
import "../chunks/chunk-WH6V3YNN.js";
|
|
11
11
|
export {
|
package/dist/memory/index.js
CHANGED
|
@@ -2,31 +2,31 @@ import {
|
|
|
2
2
|
recordBase,
|
|
3
3
|
refTo,
|
|
4
4
|
refsTo
|
|
5
|
-
} from "../chunks/chunk-
|
|
5
|
+
} from "../chunks/chunk-U5AK6OJM.js";
|
|
6
6
|
import {
|
|
7
7
|
leadProgressSchema
|
|
8
8
|
} from "../chunks/chunk-POBAY3TI.js";
|
|
9
9
|
import {
|
|
10
10
|
emptyCounts,
|
|
11
11
|
sumCounts
|
|
12
|
-
} from "../chunks/chunk-
|
|
12
|
+
} from "../chunks/chunk-CPACP4YD.js";
|
|
13
13
|
import {
|
|
14
14
|
SCHEMA_VERSION
|
|
15
15
|
} from "../chunks/chunk-QGRZDTX4.js";
|
|
16
16
|
import {
|
|
17
17
|
assertWorkspaceId,
|
|
18
18
|
makeRef
|
|
19
|
-
} from "../chunks/chunk-
|
|
19
|
+
} from "../chunks/chunk-HXB2IOJJ.js";
|
|
20
20
|
import {
|
|
21
21
|
profileSlug
|
|
22
|
-
} from "../chunks/chunk-
|
|
22
|
+
} from "../chunks/chunk-YFJ3OQZS.js";
|
|
23
23
|
import {
|
|
24
24
|
stableId
|
|
25
|
-
} from "../chunks/chunk-
|
|
25
|
+
} from "../chunks/chunk-KVAG5GM2.js";
|
|
26
26
|
import {
|
|
27
27
|
OutboundError,
|
|
28
28
|
makeErrorMapper
|
|
29
|
-
} from "../chunks/chunk-
|
|
29
|
+
} from "../chunks/chunk-XYHM4KHC.js";
|
|
30
30
|
import {
|
|
31
31
|
isNumber
|
|
32
32
|
} from "../chunks/chunk-45TXPJW7.js";
|
package/dist/redact/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ALL_FIELDS, MASK, redact } from "./plugin.ts";
|
|
1
|
+
export { ALL_FIELDS, KNOWN_TOKENS, MASK, redact } from "./plugin.ts";
|
|
2
2
|
export type { RedactExtension, RedactField, RedactOptions } from "./plugin.ts";
|
package/dist/redact/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeRef,
|
|
3
3
|
parseRef
|
|
4
|
-
} from "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-HXB2IOJJ.js";
|
|
5
5
|
import {
|
|
6
6
|
profileSlug
|
|
7
|
-
} from "../chunks/chunk-
|
|
7
|
+
} from "../chunks/chunk-YFJ3OQZS.js";
|
|
8
8
|
import {
|
|
9
|
+
hmacSha256Hex,
|
|
9
10
|
stableId
|
|
10
|
-
} from "../chunks/chunk-
|
|
11
|
+
} from "../chunks/chunk-KVAG5GM2.js";
|
|
11
12
|
import {
|
|
12
13
|
OutboundError
|
|
13
|
-
} from "../chunks/chunk-
|
|
14
|
+
} from "../chunks/chunk-XYHM4KHC.js";
|
|
14
15
|
import {
|
|
15
16
|
isJsonArray,
|
|
16
17
|
isJsonObject,
|
|
@@ -35,6 +36,65 @@ var replacer = (strategy) => (value) => {
|
|
|
35
36
|
}
|
|
36
37
|
return strategy === "mask" ? MASK : `redacted:${stableId(value).slice(0, 16)}`;
|
|
37
38
|
};
|
|
39
|
+
var keyedToken = () => {
|
|
40
|
+
const key = crypto.getRandomValues(new Uint8Array(32));
|
|
41
|
+
return (value) => `redacted:${hmacSha256Hex(key, value).slice(0, 16)}`;
|
|
42
|
+
};
|
|
43
|
+
var KNOWN_TOKENS = 1e4;
|
|
44
|
+
var TOKEN = /redacted:[0-9a-f]{16}/gu;
|
|
45
|
+
var knownTokens = () => {
|
|
46
|
+
const values = /* @__PURE__ */ new Map();
|
|
47
|
+
return {
|
|
48
|
+
kindOf: (token) => values.get(token)?.kind ?? null,
|
|
49
|
+
remask: (text) => {
|
|
50
|
+
let result = text;
|
|
51
|
+
for (const [token, { value }] of values) {
|
|
52
|
+
result = result.replaceAll(value, token);
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
},
|
|
56
|
+
remember: (token, kind, value) => {
|
|
57
|
+
values.delete(token);
|
|
58
|
+
values.set(token, { kind, value });
|
|
59
|
+
if (values.size > KNOWN_TOKENS) {
|
|
60
|
+
const [oldest] = values.keys();
|
|
61
|
+
if (oldest !== void 0) {
|
|
62
|
+
values.delete(oldest);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return token;
|
|
66
|
+
},
|
|
67
|
+
unmask: (text) => text.replaceAll(TOKEN, (token) => values.get(token)?.value ?? token)
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
var maskIdentifier = (masks, field, value) => masks.has(field) ? masks.identifier(field, value) : value;
|
|
71
|
+
var masksFor = (fields, strategy) => {
|
|
72
|
+
const replace = replacer(strategy);
|
|
73
|
+
const has = (field) => fields.has(field);
|
|
74
|
+
const known = knownTokens();
|
|
75
|
+
if (strategy === "hash") {
|
|
76
|
+
return {
|
|
77
|
+
has,
|
|
78
|
+
identifier: (field, value) => value === null ? null : known.remember(replace(value) ?? MASK, field, value),
|
|
79
|
+
known,
|
|
80
|
+
replace,
|
|
81
|
+
token: (kind, value, original = value) => known.remember(replace(value) ?? MASK, kind, original)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const keyed = keyedToken();
|
|
85
|
+
const token = (kind, value, original = value) => known.remember(keyed(value), kind, original);
|
|
86
|
+
return {
|
|
87
|
+
has,
|
|
88
|
+
identifier: (field, value) => value === null ? null : token(
|
|
89
|
+
field,
|
|
90
|
+
field === "email" ? value.toLowerCase() : profileSlug(value) ?? value,
|
|
91
|
+
value
|
|
92
|
+
),
|
|
93
|
+
known,
|
|
94
|
+
replace,
|
|
95
|
+
token
|
|
96
|
+
};
|
|
97
|
+
};
|
|
38
98
|
var maskIf = (masks, field, value) => masks.has(field) ? masks.replace(value) : value;
|
|
39
99
|
var maskCustom = (masks, custom) => masks.has("custom") ? Object.fromEntries(
|
|
40
100
|
Object.keys(custom).map((key) => [
|
|
@@ -46,11 +106,11 @@ var EMAIL_IN_ID = /[^\s@:/]+@[^\s@:/]+\.[^\s@:/]+/gu;
|
|
|
46
106
|
var maskId = (masks, id) => {
|
|
47
107
|
const slug = masks.has("linkedin") ? profileSlug(id) : null;
|
|
48
108
|
if (slug !== null) {
|
|
49
|
-
return masks.
|
|
109
|
+
return masks.token("linkedin", slug, id);
|
|
50
110
|
}
|
|
51
111
|
return masks.has("email") ? id.replaceAll(
|
|
52
112
|
EMAIL_IN_ID,
|
|
53
|
-
(address) => masks.
|
|
113
|
+
(address) => masks.token("email", address.toLowerCase(), address)
|
|
54
114
|
) : id;
|
|
55
115
|
};
|
|
56
116
|
var maskRef = (masks, ref) => {
|
|
@@ -60,7 +120,7 @@ var maskRef = (masks, ref) => {
|
|
|
60
120
|
var KEY_FIELDS = ["email", "linkedin"];
|
|
61
121
|
var maskKey = (masks, key) => {
|
|
62
122
|
const field = KEY_FIELDS.find((name) => key.startsWith(`${name}:`));
|
|
63
|
-
return field === void 0 || !masks.has(field) ? key : `${field}:${masks.
|
|
123
|
+
return field === void 0 || !masks.has(field) ? key : `${field}:${masks.token(field, key.slice(field.length + 1))}`;
|
|
64
124
|
};
|
|
65
125
|
var maskEach = (value, mask) => {
|
|
66
126
|
if (isString(value)) {
|
|
@@ -105,10 +165,10 @@ var redactFields = (masks, record) => {
|
|
|
105
165
|
// The company's LinkedIn page and its website name the company too.
|
|
106
166
|
companyLinkedinUrl: maskIf(masks, "company", record.companyLinkedinUrl),
|
|
107
167
|
custom: maskCustom(masks, record.custom),
|
|
108
|
-
email:
|
|
168
|
+
email: maskIdentifier(masks, "email", record.email),
|
|
109
169
|
firstName: maskIf(masks, "name", record.firstName),
|
|
110
170
|
lastName: maskIf(masks, "name", record.lastName),
|
|
111
|
-
linkedinUrl:
|
|
171
|
+
linkedinUrl: maskIdentifier(masks, "linkedin", record.linkedinUrl),
|
|
112
172
|
phone: maskIf(masks, "phone", record.phone),
|
|
113
173
|
raw: null,
|
|
114
174
|
website: maskIf(masks, "company", record.website)
|
|
@@ -119,7 +179,7 @@ var redactFields = (masks, record) => {
|
|
|
119
179
|
return {
|
|
120
180
|
...record,
|
|
121
181
|
raw: null,
|
|
122
|
-
value: blocked === void 0 ? record.value :
|
|
182
|
+
value: blocked === void 0 ? record.value : maskIdentifier(masks, blocked, record.value) ?? MASK
|
|
123
183
|
};
|
|
124
184
|
}
|
|
125
185
|
if ("steps" in record || "inProgress" in record || "nextRunAt" in record || "schedule" in record || "dns" in record || "size" in record || "url" in record || "description" in record) {
|
|
@@ -128,8 +188,8 @@ var redactFields = (masks, record) => {
|
|
|
128
188
|
if ("kind" in record) {
|
|
129
189
|
return {
|
|
130
190
|
...record,
|
|
131
|
-
address:
|
|
132
|
-
linkedinUrl:
|
|
191
|
+
address: maskIdentifier(masks, "email", record.address),
|
|
192
|
+
linkedinUrl: maskIdentifier(masks, "linkedin", record.linkedinUrl),
|
|
133
193
|
name: maskIf(masks, "name", record.name),
|
|
134
194
|
raw: null
|
|
135
195
|
};
|
|
@@ -143,6 +203,7 @@ var redactFields = (masks, record) => {
|
|
|
143
203
|
);
|
|
144
204
|
};
|
|
145
205
|
var redactRecord = (masks, record) => maskIdentifiers(masks, redactFields(masks, record));
|
|
206
|
+
var maskEventField = (masks, field, value) => field === "email" || field === "linkedin" ? maskIdentifier(masks, field, value) : maskIf(masks, field, value);
|
|
146
207
|
var EVENT_FIELDS = /* @__PURE__ */ new Map([
|
|
147
208
|
["leadEmail", "email"],
|
|
148
209
|
["leadName", "name"],
|
|
@@ -157,18 +218,31 @@ var redactEventData = (masks, data) => {
|
|
|
157
218
|
if (field === void 0) {
|
|
158
219
|
result[key] = isJsonObject(value) || Array.isArray(value) ? MASK : value;
|
|
159
220
|
} else {
|
|
160
|
-
result[key] = isString(value) ?
|
|
221
|
+
result[key] = isString(value) ? maskEventField(masks, field, value) : null;
|
|
161
222
|
}
|
|
162
223
|
}
|
|
163
224
|
return result;
|
|
164
225
|
};
|
|
226
|
+
var remasked = (known, error) => new OutboundError(error.code, known.remask(error.message), {
|
|
227
|
+
aborted: error.aborted,
|
|
228
|
+
limit: error.limit,
|
|
229
|
+
permanent: error.permanent,
|
|
230
|
+
provider: error.provider,
|
|
231
|
+
retryAfterMs: error.retryAfterMs,
|
|
232
|
+
status: error.status,
|
|
233
|
+
timedOut: error.timedOut
|
|
234
|
+
});
|
|
235
|
+
var unmasked = (known, operation) => {
|
|
236
|
+
if (!("id" in operation)) {
|
|
237
|
+
return operation;
|
|
238
|
+
}
|
|
239
|
+
const id = known.unmask(operation.id);
|
|
240
|
+
return id === operation.id ? operation : { ...operation, id };
|
|
241
|
+
};
|
|
165
242
|
var redact = (options = {}) => {
|
|
166
243
|
const fields = new Set(options.fields ?? ALL_FIELDS);
|
|
167
244
|
const strategy = options.strategy ?? "mask";
|
|
168
|
-
const masks =
|
|
169
|
-
has: (field) => fields.has(field),
|
|
170
|
-
replace: replacer(strategy)
|
|
171
|
-
};
|
|
245
|
+
const masks = masksFor(fields, strategy);
|
|
172
246
|
return {
|
|
173
247
|
// Asking for bodies while they are being removed is a contradiction, so
|
|
174
248
|
// the capability is turned off and the request is refused up front.
|
|
@@ -179,16 +253,29 @@ var redact = (options = {}) => {
|
|
|
179
253
|
data: redactEventData(masks, event.data),
|
|
180
254
|
raw: null
|
|
181
255
|
}),
|
|
182
|
-
extend: () => ({
|
|
256
|
+
extend: (outbound) => ({
|
|
183
257
|
redacted: {
|
|
184
258
|
fields: [...fields].toSorted(),
|
|
185
259
|
hash: (value) => masks.replace(value) ?? MASK,
|
|
260
|
+
leadsByToken: (tokens, campaign) => {
|
|
261
|
+
const emails = tokens.flatMap(
|
|
262
|
+
(token) => masks.known.kindOf(token) === "email" ? masks.known.unmask(token) : []
|
|
263
|
+
);
|
|
264
|
+
return campaign === null ? outbound.leads.listAll({ emails }) : outbound.campaign(campaign).leads.listAll({ emails });
|
|
265
|
+
},
|
|
266
|
+
resolves: (token) => masks.known.kindOf(token),
|
|
186
267
|
strategy
|
|
187
268
|
}
|
|
188
269
|
}),
|
|
189
270
|
name: "redact",
|
|
190
271
|
wrap: async (operation, next) => {
|
|
191
|
-
const
|
|
272
|
+
const sent = unmasked(masks.known, operation);
|
|
273
|
+
let output;
|
|
274
|
+
try {
|
|
275
|
+
output = await next(sent);
|
|
276
|
+
} catch (error) {
|
|
277
|
+
throw sent !== operation && OutboundError.is(error) ? remasked(masks.known, error) : error;
|
|
278
|
+
}
|
|
192
279
|
return {
|
|
193
280
|
...output,
|
|
194
281
|
items: output.items.map((record) => redactRecord(masks, record))
|
|
@@ -198,6 +285,7 @@ var redact = (options = {}) => {
|
|
|
198
285
|
};
|
|
199
286
|
export {
|
|
200
287
|
ALL_FIELDS,
|
|
288
|
+
KNOWN_TOKENS,
|
|
201
289
|
MASK,
|
|
202
290
|
redact
|
|
203
291
|
};
|
package/dist/redact/plugin.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import type { Lead } from "../internal/entities.ts";
|
|
2
|
+
import type { ListAll } from "../internal/outbound/api.ts";
|
|
1
3
|
import type { OutboundPlugin } from "../internal/outbound/plugins.ts";
|
|
2
4
|
export type RedactField = "body" | "company" | "custom" | "email" | "linkedin" | "name" | "phone" | "subject";
|
|
3
5
|
export interface RedactOptions {
|
|
4
6
|
/** What to mask. Defaults to everything. */
|
|
5
7
|
readonly fields?: readonly RedactField[] | undefined;
|
|
6
8
|
/**
|
|
7
|
-
* `mask` replaces a value with `[redacted]
|
|
8
|
-
*
|
|
9
|
+
* `mask` replaces a value with `[redacted]`, and an address or a profile
|
|
10
|
+
* with a token keyed for this plugin, so people can still be counted and
|
|
11
|
+
* joined while it lives. `hash` replaces every value with a stable token,
|
|
12
|
+
* so the same person gets the same token from one run to the next.
|
|
9
13
|
*/
|
|
10
14
|
readonly strategy?: "hash" | "mask" | undefined;
|
|
11
15
|
}
|
|
@@ -20,10 +24,29 @@ export interface RedactExtension {
|
|
|
20
24
|
* What this redact writes in place of `value` in a masked field: the
|
|
21
25
|
* stable token under `hash`, so a caller can find a known address among
|
|
22
26
|
* hashed records without the records holding it; `[redacted]` under
|
|
23
|
-
* `mask
|
|
27
|
+
* `mask`, whose tokens for addresses and profiles are keyed and never
|
|
28
|
+
* given out.
|
|
24
29
|
*/
|
|
25
30
|
readonly hash: (value: string) => string;
|
|
31
|
+
/**
|
|
32
|
+
* What a token this redact wrote for an address or a profile stands for,
|
|
33
|
+
* `email` or `linkedin`, or `null` when it wrote no such token. The
|
|
34
|
+
* value itself is never given out: a call that names the token, in a ref
|
|
35
|
+
* or a field, reaches the vendor with the value in its place, and its
|
|
36
|
+
* answer comes back masked.
|
|
37
|
+
*/
|
|
38
|
+
readonly resolves: (token: string) => Identifier | null;
|
|
39
|
+
/**
|
|
40
|
+
* The leads behind the address tokens given, in one campaign or all,
|
|
41
|
+
* read with the addresses in their place and returned masked. A token
|
|
42
|
+
* this redact did not write for an address is left out.
|
|
43
|
+
*/
|
|
44
|
+
readonly leadsByToken: (tokens: readonly string[], campaign: string | null) => ListAll<Lead>;
|
|
26
45
|
};
|
|
27
46
|
}
|
|
47
|
+
type Identifier = "email" | "linkedin";
|
|
48
|
+
/** The most tokens one redact remembers the value of; the oldest go first. */
|
|
49
|
+
export declare const KNOWN_TOKENS = 10000;
|
|
28
50
|
/** Masks emails, names, companies, LinkedIn URLs, custom fields and message text. */
|
|
29
51
|
export declare const redact: (options?: RedactOptions) => OutboundPlugin<RedactExtension>;
|
|
52
|
+
export {};
|
package/dist/smartlead/index.js
CHANGED
|
@@ -13,15 +13,15 @@ import {
|
|
|
13
13
|
toWorkspace,
|
|
14
14
|
unwrap,
|
|
15
15
|
withoutSecrets
|
|
16
|
-
} from "../chunks/chunk-
|
|
16
|
+
} from "../chunks/chunk-UAHYPASH.js";
|
|
17
17
|
import {
|
|
18
18
|
applyTracking,
|
|
19
19
|
ownTracking,
|
|
20
20
|
unlessFailed
|
|
21
|
-
} from "../chunks/chunk-
|
|
21
|
+
} from "../chunks/chunk-VVDBCQLK.js";
|
|
22
22
|
import {
|
|
23
23
|
detectAutoReply
|
|
24
|
-
} from "../chunks/chunk-
|
|
24
|
+
} from "../chunks/chunk-SYUMA3CP.js";
|
|
25
25
|
import {
|
|
26
26
|
flatMapPage,
|
|
27
27
|
mapPage,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
createVendorClient,
|
|
33
33
|
fromOne,
|
|
34
34
|
listIn
|
|
35
|
-
} from "../chunks/chunk-
|
|
35
|
+
} from "../chunks/chunk-UOJG4VYF.js";
|
|
36
36
|
import {
|
|
37
37
|
normalizeBody
|
|
38
38
|
} from "../chunks/chunk-FALWG5U3.js";
|
|
@@ -49,31 +49,31 @@ import {
|
|
|
49
49
|
recordBase,
|
|
50
50
|
refTo,
|
|
51
51
|
refsTo
|
|
52
|
-
} from "../chunks/chunk-
|
|
52
|
+
} from "../chunks/chunk-U5AK6OJM.js";
|
|
53
53
|
import "../chunks/chunk-POBAY3TI.js";
|
|
54
54
|
import {
|
|
55
55
|
emptyCounts,
|
|
56
56
|
metricRow
|
|
57
|
-
} from "../chunks/chunk-
|
|
57
|
+
} from "../chunks/chunk-CPACP4YD.js";
|
|
58
58
|
import {
|
|
59
59
|
replyCategorySchema
|
|
60
60
|
} from "../chunks/chunk-QGRZDTX4.js";
|
|
61
61
|
import {
|
|
62
62
|
assertWorkspaceId
|
|
63
|
-
} from "../chunks/chunk-
|
|
64
|
-
import "../chunks/chunk-
|
|
63
|
+
} from "../chunks/chunk-HXB2IOJJ.js";
|
|
64
|
+
import "../chunks/chunk-YFJ3OQZS.js";
|
|
65
65
|
import {
|
|
66
66
|
stableId
|
|
67
|
-
} from "../chunks/chunk-
|
|
67
|
+
} from "../chunks/chunk-KVAG5GM2.js";
|
|
68
68
|
import {
|
|
69
69
|
readEnv,
|
|
70
70
|
requireCredential
|
|
71
|
-
} from "../chunks/chunk-
|
|
71
|
+
} from "../chunks/chunk-NFWWA7MI.js";
|
|
72
72
|
import {
|
|
73
73
|
OutboundError,
|
|
74
74
|
makeErrorMapper,
|
|
75
75
|
requireObject
|
|
76
|
-
} from "../chunks/chunk-
|
|
76
|
+
} from "../chunks/chunk-XYHM4KHC.js";
|
|
77
77
|
import {
|
|
78
78
|
count,
|
|
79
79
|
emailAddress,
|
|
@@ -786,7 +786,15 @@ var listSubsequences = async (client, ctx, query) => {
|
|
|
786
786
|
}
|
|
787
787
|
const steps = await client.get(ctx, `/campaigns/${segment(id)}/sequences`);
|
|
788
788
|
return {
|
|
789
|
-
items: [
|
|
789
|
+
items: [
|
|
790
|
+
toSubsequence(
|
|
791
|
+
client.identity,
|
|
792
|
+
query.campaignId,
|
|
793
|
+
current,
|
|
794
|
+
steps,
|
|
795
|
+
ctx.note
|
|
796
|
+
)
|
|
797
|
+
],
|
|
790
798
|
next: rest.length > 0 ? { subsequences: rest } : void 0
|
|
791
799
|
};
|
|
792
800
|
};
|
|
@@ -1587,7 +1595,8 @@ var readers = (client) => {
|
|
|
1587
1595
|
getSequence: async (id, ctx) => toSequence(
|
|
1588
1596
|
identity,
|
|
1589
1597
|
id,
|
|
1590
|
-
await client.get(ctx, `/campaigns/${segment(id)}/sequences`)
|
|
1598
|
+
await client.get(ctx, `/campaigns/${segment(id)}/sequences`),
|
|
1599
|
+
ctx.note
|
|
1591
1600
|
),
|
|
1592
1601
|
listCampaigns: async (query, ctx) => {
|
|
1593
1602
|
const { senderId } = query;
|
package/dist/smartlead/map.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Campaign, CampaignStatus, Lead, ReplyCategory, Sender, Sequence, Workspace } from "../internal/entities.ts";
|
|
2
2
|
import type { Json, JsonObject } from "../internal/json.ts";
|
|
3
|
+
import type { Note } from "../internal/notes.ts";
|
|
3
4
|
import type { Identity } from "../internal/record.ts";
|
|
4
5
|
/**
|
|
5
6
|
* Several endpoints are documented both bare and wrapped in
|
|
@@ -14,12 +15,12 @@ export declare const withoutSecrets: (value: Json) => Json;
|
|
|
14
15
|
export declare const campaignStatus: (value: Json | undefined) => CampaignStatus;
|
|
15
16
|
export declare const toCampaign: (identity: Identity, raw: JsonObject) => Campaign;
|
|
16
17
|
/** `GET /campaigns/{id}/sequences`: an array of steps, bare or wrapped. */
|
|
17
|
-
export declare const toSequence: (identity: Identity, campaignId: string, body: Json) => Sequence;
|
|
18
|
+
export declare const toSequence: (identity: Identity, campaignId: string, body: Json, note: Note) => Sequence;
|
|
18
19
|
/**
|
|
19
20
|
* A subsequence is a child campaign: `campaign` is its row in the campaign
|
|
20
21
|
* list and `body` is its own `GET /campaigns/{id}/sequences`.
|
|
21
22
|
*/
|
|
22
|
-
export declare const toSubsequence: (identity: Identity, parentId: string, campaign: JsonObject, body: Json) => Sequence;
|
|
23
|
+
export declare const toSubsequence: (identity: Identity, parentId: string, campaign: JsonObject, body: Json, note: Note) => Sequence;
|
|
23
24
|
export declare const reputation: (value: Json | undefined) => number | null;
|
|
24
25
|
/** A mailbox. `raw` is the payload without its SMTP and IMAP passwords. */
|
|
25
26
|
export declare const toSender: (identity: Identity, raw: JsonObject) => Sender;
|
package/dist/sync/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
stableId
|
|
3
|
-
} from "../chunks/chunk-
|
|
3
|
+
} from "../chunks/chunk-KVAG5GM2.js";
|
|
4
4
|
import {
|
|
5
5
|
OutboundError
|
|
6
|
-
} from "../chunks/chunk-
|
|
6
|
+
} from "../chunks/chunk-XYHM4KHC.js";
|
|
7
7
|
import "../chunks/chunk-45TXPJW7.js";
|
|
8
8
|
|
|
9
9
|
// src/sync/plugin.ts
|
package/dist/tools/ai-sdk.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createTools
|
|
3
|
-
} from "../chunks/chunk-
|
|
4
|
-
import "../chunks/chunk-
|
|
3
|
+
} from "../chunks/chunk-OVTYA3IB.js";
|
|
4
|
+
import "../chunks/chunk-FTK4JS65.js";
|
|
5
5
|
import "../chunks/chunk-4PA526S7.js";
|
|
6
6
|
import "../chunks/chunk-HZCTYL22.js";
|
|
7
7
|
import "../chunks/chunk-HPNGSG5E.js";
|
|
8
8
|
import "../chunks/chunk-PTZO4QXR.js";
|
|
9
9
|
import "../chunks/chunk-POBAY3TI.js";
|
|
10
|
-
import "../chunks/chunk-
|
|
10
|
+
import "../chunks/chunk-CPACP4YD.js";
|
|
11
11
|
import "../chunks/chunk-QGRZDTX4.js";
|
|
12
|
-
import "../chunks/chunk-
|
|
13
|
-
import "../chunks/chunk-
|
|
12
|
+
import "../chunks/chunk-HXB2IOJJ.js";
|
|
13
|
+
import "../chunks/chunk-XYHM4KHC.js";
|
|
14
14
|
import "../chunks/chunk-45TXPJW7.js";
|
|
15
15
|
|
|
16
16
|
// src/tools/ai-sdk.ts
|
package/dist/tools/by-name.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import type { ListAll, OutboundApi } from "../internal/outbound/api.ts";
|
|
|
3
3
|
* Whether `value` is surely a ref or an id, so it is used with no lookup: a
|
|
4
4
|
* ref, an id in the vendor's documented form, or, on an instance whose id
|
|
5
5
|
* form is not known (a test adapter, your own adapter), any text without a
|
|
6
|
-
* space, as before names were accepted.
|
|
6
|
+
* space, as before names were accepted. On a combined instance only a ref
|
|
7
|
+
* is: a bare id names no member, so it is looked up like a name.
|
|
7
8
|
*/
|
|
8
9
|
export declare const isIdentifier: (outbound: OutboundApi, value: string) => boolean;
|
|
9
10
|
/** Reads a whole listing. An insight passes its own, which counts the requests. */
|
|
@@ -14,5 +15,12 @@ export declare const resolveCampaign: (outbound: OutboundApi, value: string, rea
|
|
|
14
15
|
export declare const resolveList: (outbound: OutboundApi, value: string) => Promise<string>;
|
|
15
16
|
/** Whether the input's `campaign` is a name, which costs a campaign listing to look up. */
|
|
16
17
|
export declare const namesCampaign: <Input>(outbound: OutboundApi, input: Input) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Where a read of this input goes: on a combined instance whose `campaign`
|
|
20
|
+
* is a ref, the member that ref names, so what that member supports applies
|
|
21
|
+
* rather than what every member does. Anything else stays on `outbound`; a
|
|
22
|
+
* ref of no member is refused later, by the read it reaches.
|
|
23
|
+
*/
|
|
24
|
+
export declare const routedByCampaign: <Input>(outbound: OutboundApi, input: Input) => OutboundApi;
|
|
17
25
|
/** The input with its `campaign`, when it is text, resolved to a ref or id. */
|
|
18
26
|
export declare const withCampaign: <Input>(outbound: OutboundApi, input: Input, read?: ReadAll) => Promise<Input>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { ToolDefinition } from "./shared.ts";
|
|
3
3
|
declare const overviewInput: z.ZodObject<{
|
|
4
|
+
campaign: z.ZodOptional<z.ZodString>;
|
|
4
5
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
5
6
|
status: z.ZodDefault<z.ZodEnum<{
|
|
6
7
|
active: "active";
|
|
@@ -13,7 +14,8 @@ declare const overviewInput: z.ZodObject<{
|
|
|
13
14
|
from: z.ZodOptional<z.ZodString>;
|
|
14
15
|
to: z.ZodOptional<z.ZodString>;
|
|
15
16
|
}, z.core.$strip>;
|
|
16
|
-
|
|
17
|
+
type OverviewInput = z.infer<typeof overviewInput>;
|
|
18
|
+
export declare const campaignOverview: ToolDefinition<OverviewInput>;
|
|
17
19
|
declare const trendInput: z.ZodObject<{
|
|
18
20
|
campaign: z.ZodString;
|
|
19
21
|
from: z.ZodOptional<z.ZodString>;
|