outbound-sdk 0.2.1 → 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-P3IJBJUI.js → chunk-7LNJJ2RO.js} +200 -57
- 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/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/alerts/index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
percentOf
|
|
3
|
+
} from "../chunks/chunk-4PA526S7.js";
|
|
4
|
+
import "../chunks/chunk-PTZO4QXR.js";
|
|
1
5
|
import {
|
|
2
6
|
computeRates
|
|
3
|
-
} from "../chunks/chunk-
|
|
4
|
-
import "../chunks/chunk-
|
|
5
|
-
import "../chunks/chunk-
|
|
6
|
-
import "../chunks/chunk-
|
|
7
|
-
import "../chunks/chunk-
|
|
7
|
+
} from "../chunks/chunk-PQSTQKRD.js";
|
|
8
|
+
import "../chunks/chunk-QGRZDTX4.js";
|
|
9
|
+
import "../chunks/chunk-QAKJ76HB.js";
|
|
10
|
+
import "../chunks/chunk-J7DDZ4C2.js";
|
|
11
|
+
import "../chunks/chunk-BLCJHP5H.js";
|
|
8
12
|
|
|
9
13
|
// src/alerts/plugin.ts
|
|
10
14
|
var memoryAlertDedupe = () => {
|
|
@@ -18,7 +22,7 @@ var memoryAlertDedupe = () => {
|
|
|
18
22
|
};
|
|
19
23
|
var isMetricRow = (record) => "scope" in record;
|
|
20
24
|
var isSender = (record) => "kind" in record && "dailyLimit" in record;
|
|
21
|
-
var
|
|
25
|
+
var isCampaign = (record) => "channel" in record && "tags" in record && "status" in record;
|
|
22
26
|
var bounceRateAbove = (threshold, options = {}) => ({
|
|
23
27
|
check: (record) => {
|
|
24
28
|
if (!isMetricRow(record) || (record.sent ?? 0) < (options.minSent ?? 50)) {
|
|
@@ -26,7 +30,8 @@ var bounceRateAbove = (threshold, options = {}) => ({
|
|
|
26
30
|
}
|
|
27
31
|
const { value } = computeRates(record).bounceRate;
|
|
28
32
|
return value !== null && value > threshold ? {
|
|
29
|
-
message: `Bounce rate is ${
|
|
33
|
+
message: `Bounce rate is ${percentOf(value)}, above ${percentOf(threshold)}`,
|
|
34
|
+
day: record.date,
|
|
30
35
|
rule: "bounce-rate-above",
|
|
31
36
|
subject: record.scopeRef,
|
|
32
37
|
threshold,
|
|
@@ -42,7 +47,8 @@ var replyRateBelow = (threshold, options = {}) => ({
|
|
|
42
47
|
}
|
|
43
48
|
const { value } = computeRates(record).replyRate;
|
|
44
49
|
return value !== null && value < threshold ? {
|
|
45
|
-
message: `Reply rate is ${
|
|
50
|
+
message: `Reply rate is ${percentOf(value)}, below ${percentOf(threshold)}`,
|
|
51
|
+
day: record.date,
|
|
46
52
|
rule: "reply-rate-below",
|
|
47
53
|
subject: record.scopeRef,
|
|
48
54
|
threshold,
|
|
@@ -56,13 +62,16 @@ var senderNotActive = () => ({
|
|
|
56
62
|
message: `Sender is ${record.status}`,
|
|
57
63
|
rule: "sender-not-active",
|
|
58
64
|
subject: record.ref,
|
|
65
|
+
subjectName: record.address ?? record.name,
|
|
59
66
|
threshold: "active",
|
|
60
67
|
value: record.status
|
|
61
68
|
} : null,
|
|
62
|
-
name: "sender-not-active"
|
|
69
|
+
name: "sender-not-active",
|
|
70
|
+
state: true
|
|
63
71
|
});
|
|
64
72
|
var noSends = () => ({
|
|
65
73
|
check: (record) => isMetricRow(record) && record.date !== null && record.sent === 0 ? {
|
|
74
|
+
day: record.date,
|
|
66
75
|
message: `Nothing was sent on ${record.date}`,
|
|
67
76
|
rule: "no-sends",
|
|
68
77
|
subject: record.scopeRef,
|
|
@@ -73,10 +82,15 @@ var noSends = () => ({
|
|
|
73
82
|
});
|
|
74
83
|
var ignore = () => {
|
|
75
84
|
};
|
|
85
|
+
var keyOf = (alert, rule) => [
|
|
86
|
+
alert.rule,
|
|
87
|
+
alert.subject,
|
|
88
|
+
...alert.day ? [alert.day] : [],
|
|
89
|
+
...rule.state === true ? [String(alert.value)] : []
|
|
90
|
+
].join("|");
|
|
76
91
|
var fresh = async (fired, seen) => {
|
|
77
92
|
const unseen = [];
|
|
78
|
-
for (const alert of fired) {
|
|
79
|
-
const key = `${alert.rule}|${alert.subject}`;
|
|
93
|
+
for (const { alert, key } of fired) {
|
|
80
94
|
if (!await seen.has(key)) {
|
|
81
95
|
await seen.add(key);
|
|
82
96
|
unseen.push(alert);
|
|
@@ -85,12 +99,29 @@ var fresh = async (fired, seen) => {
|
|
|
85
99
|
return unseen;
|
|
86
100
|
};
|
|
87
101
|
var alerts = (options) => {
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
102
|
+
const names = /* @__PURE__ */ new Map();
|
|
103
|
+
const fire = (records) => {
|
|
104
|
+
for (const record of records) {
|
|
105
|
+
if (isCampaign(record)) {
|
|
106
|
+
names.set(record.ref, record.name);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return records.flatMap(
|
|
110
|
+
(record) => options.rules.flatMap((rule) => {
|
|
111
|
+
const alert = rule.check(record);
|
|
112
|
+
return alert === null ? [] : [
|
|
113
|
+
{
|
|
114
|
+
alert: {
|
|
115
|
+
...alert,
|
|
116
|
+
subjectName: alert.subjectName ?? names.get(alert.subject) ?? null
|
|
117
|
+
},
|
|
118
|
+
key: keyOf(alert, rule)
|
|
119
|
+
}
|
|
120
|
+
];
|
|
121
|
+
})
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
const evaluate = (records) => fire(records).map((each) => each.alert);
|
|
94
125
|
const { dedupe } = options;
|
|
95
126
|
let last = Promise.resolve();
|
|
96
127
|
const notifyFresh = (fired, seen) => {
|
|
@@ -118,10 +149,10 @@ var alerts = (options) => {
|
|
|
118
149
|
name: "alerts",
|
|
119
150
|
wrap: async (operation, next) => {
|
|
120
151
|
const output = await next(operation);
|
|
121
|
-
const fired =
|
|
152
|
+
const fired = fire(output.items);
|
|
122
153
|
if (fired.length > 0) {
|
|
123
154
|
if (dedupe === void 0) {
|
|
124
|
-
notifyAll(fired);
|
|
155
|
+
notifyAll(fired.map((each) => each.alert));
|
|
125
156
|
} else {
|
|
126
157
|
notifyFresh(fired, dedupe);
|
|
127
158
|
}
|
package/dist/alerts/plugin.d.ts
CHANGED
|
@@ -5,16 +5,32 @@ export interface Alert {
|
|
|
5
5
|
readonly rule: string;
|
|
6
6
|
/** The ref of the campaign, sender or workspace it is about. */
|
|
7
7
|
readonly subject: string;
|
|
8
|
+
/**
|
|
9
|
+
* The subject as a person knows it: the sender's address, or the campaign's
|
|
10
|
+
* name when this instance has read that campaign. `null` when neither is known.
|
|
11
|
+
*/
|
|
12
|
+
readonly subjectName?: string | null | undefined;
|
|
8
13
|
readonly message: string;
|
|
9
14
|
/** What was measured. */
|
|
10
15
|
readonly value: number | string | null;
|
|
11
16
|
/** What it was compared with. */
|
|
12
17
|
readonly threshold: number | string | null;
|
|
18
|
+
/**
|
|
19
|
+
* The day of the data point, `YYYY-MM-DD`, for an alert about a day's
|
|
20
|
+
* counts. With `dedupe`, the same rule and subject on another day is a new
|
|
21
|
+
* alert. `null` or absent for a record that is not one day's.
|
|
22
|
+
*/
|
|
23
|
+
readonly day?: string | null | undefined;
|
|
13
24
|
}
|
|
14
25
|
export interface AlertRule {
|
|
15
26
|
readonly name: string;
|
|
16
27
|
/** Returns an alert when the record breaks the rule, otherwise `null`. */
|
|
17
28
|
readonly check: (record: OutboundRecord) => Alert | null;
|
|
29
|
+
/**
|
|
30
|
+
* The rule is about a state, such as a sender's status: with `dedupe`, a
|
|
31
|
+
* new `value` for the same subject is a new alert (paused, then error).
|
|
32
|
+
*/
|
|
33
|
+
readonly state?: boolean | undefined;
|
|
18
34
|
}
|
|
19
35
|
/**
|
|
20
36
|
* Remembers which alerts were already notified, by a key per alert. Supply
|
|
@@ -30,9 +46,10 @@ export interface AlertsOptions {
|
|
|
30
46
|
readonly rules: readonly AlertRule[];
|
|
31
47
|
readonly notify: (alerts: readonly Alert[]) => void | Promise<void>;
|
|
32
48
|
/**
|
|
33
|
-
* Notify once per distinct alert
|
|
34
|
-
*
|
|
35
|
-
*
|
|
49
|
+
* Notify once per distinct alert: its rule, its subject, the day of its
|
|
50
|
+
* data point when it has one, and its value for a state rule
|
|
51
|
+
* (`no-sends|<campaign ref>|2026-11-10`, `sender-not-active|<sender ref>|paused`).
|
|
52
|
+
* Without it, every read that shows the condition notifies again.
|
|
36
53
|
*/
|
|
37
54
|
readonly dedupe?: AlertDedupe | undefined;
|
|
38
55
|
}
|
package/dist/audit/index.js
CHANGED
package/dist/benchmarks/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
computeRates
|
|
3
|
-
} from "../chunks/chunk-
|
|
4
|
-
import "../chunks/chunk-
|
|
5
|
-
import "../chunks/chunk-
|
|
3
|
+
} from "../chunks/chunk-PQSTQKRD.js";
|
|
4
|
+
import "../chunks/chunk-QGRZDTX4.js";
|
|
5
|
+
import "../chunks/chunk-QAKJ76HB.js";
|
|
6
6
|
import {
|
|
7
7
|
OutboundError
|
|
8
|
-
} from "../chunks/chunk-
|
|
9
|
-
import "../chunks/chunk-
|
|
8
|
+
} from "../chunks/chunk-J7DDZ4C2.js";
|
|
9
|
+
import "../chunks/chunk-BLCJHP5H.js";
|
|
10
10
|
|
|
11
11
|
// src/benchmarks/index.ts
|
|
12
12
|
var compare = (value, baseline) => ({
|
package/dist/budget/index.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ export interface BudgetOptions {
|
|
|
3
3
|
/** The most vendor requests allowed. */
|
|
4
4
|
readonly maxRequests: number;
|
|
5
5
|
/**
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
6
|
+
* `run` (the default) allows `maxRequests` in total across every call on
|
|
7
|
+
* the instance, until `reset()`. `call` allows it for each SDK call, as
|
|
8
|
+
* `maxRequestsPerCall` on `createOutbound` does.
|
|
8
9
|
*/
|
|
9
10
|
readonly per?: "call" | "run" | undefined;
|
|
10
11
|
}
|
package/dist/budget/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
plural
|
|
3
|
+
} from "../chunks/chunk-PTZO4QXR.js";
|
|
1
4
|
import {
|
|
2
5
|
OutboundError
|
|
3
|
-
} from "../chunks/chunk-
|
|
4
|
-
import "../chunks/chunk-
|
|
6
|
+
} from "../chunks/chunk-J7DDZ4C2.js";
|
|
7
|
+
import "../chunks/chunk-BLCJHP5H.js";
|
|
5
8
|
|
|
6
9
|
// src/budget/index.ts
|
|
7
10
|
var budget = (options) => {
|
|
@@ -11,14 +14,14 @@ var budget = (options) => {
|
|
|
11
14
|
"budget() needs maxRequests to be a positive integer"
|
|
12
15
|
);
|
|
13
16
|
}
|
|
14
|
-
const perRun = options.per
|
|
17
|
+
const perRun = options.per !== "call";
|
|
15
18
|
let used = 0;
|
|
16
19
|
const remaining = () => Math.max(0, options.maxRequests - used);
|
|
17
20
|
const live = /* @__PURE__ */ new WeakMap();
|
|
18
21
|
const spent = (provider) => new OutboundError(
|
|
19
22
|
"RateLimited",
|
|
20
|
-
`The run used its budget of ${options.maxRequests
|
|
21
|
-
{ provider }
|
|
23
|
+
`The run used its budget of ${plural(options.maxRequests, "request")} to ${provider}. Call requestBudget.reset() to start a new run, or raise budget()'s maxRequests.`,
|
|
24
|
+
{ limit: "run", provider }
|
|
22
25
|
);
|
|
23
26
|
return {
|
|
24
27
|
extend: () => ({
|
|
@@ -36,11 +39,9 @@ var budget = (options) => {
|
|
|
36
39
|
if (perRun && remaining() === 0) {
|
|
37
40
|
throw spent(info.provider);
|
|
38
41
|
}
|
|
39
|
-
if (!perRun) {
|
|
40
|
-
state.maxRequests =
|
|
41
|
-
|
|
42
|
-
options.maxRequests
|
|
43
|
-
);
|
|
42
|
+
if (!perRun && (state.maxRequests === void 0 || options.maxRequests < state.maxRequests)) {
|
|
43
|
+
state.maxRequests = options.maxRequests;
|
|
44
|
+
state.maxRequestsSetBy = "budget()'s maxRequests";
|
|
44
45
|
}
|
|
45
46
|
if (!live.has(state)) {
|
|
46
47
|
live.set(state, 0);
|
package/dist/cards/content.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { CardLink, CardNode, ChartData, SeriesChart, TableData } from "./spec.ts";
|
|
2
2
|
export type Stat = readonly [label: string, value: string];
|
|
3
|
+
/** A table, and how many rows it stands for when the data holds fewer. */
|
|
4
|
+
export interface ContentTable extends TableData {
|
|
5
|
+
/** Every row the answer counted, shown or not, for "… and 62 more". Defaults to `rows.length`. */
|
|
6
|
+
readonly total?: number | undefined;
|
|
7
|
+
}
|
|
3
8
|
export interface CardContent {
|
|
4
9
|
readonly title: string;
|
|
5
10
|
readonly subtitle?: string | null | undefined;
|
|
@@ -7,7 +12,7 @@ export interface CardContent {
|
|
|
7
12
|
readonly finding?: string | null | undefined;
|
|
8
13
|
readonly stats?: readonly Stat[] | undefined;
|
|
9
14
|
readonly bullets?: readonly string[] | undefined;
|
|
10
|
-
readonly table?:
|
|
15
|
+
readonly table?: ContentTable | undefined;
|
|
11
16
|
readonly chart?: ChartData | null | undefined;
|
|
12
17
|
/** What to know before trusting the numbers. */
|
|
13
18
|
readonly notes?: readonly string[] | undefined;
|
package/dist/cards/format.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Json, JsonObject } from "../internal/json.ts";
|
|
2
|
+
export { noun } from "../internal/plural.ts";
|
|
2
3
|
/** What a card shows for a value the vendor does not report. */
|
|
3
4
|
export declare const DASH = "\u2014";
|
|
4
5
|
/**
|
|
@@ -14,14 +15,25 @@ export declare const clip: (value: string, max: number) => string;
|
|
|
14
15
|
export declare const str: (value: Json | undefined, key: string) => string | null;
|
|
15
16
|
/** A string field for display: made inert, or a dash. */
|
|
16
17
|
export declare const show: (value: Json | undefined, key: string) => string;
|
|
18
|
+
/** A campaign's name: `campaignName`, or `name` in a result stored before it. */
|
|
19
|
+
export declare const campaignNameOf: (value: Json | undefined) => string;
|
|
17
20
|
export declare const num: (value: Json | undefined, key: string) => number | null;
|
|
18
21
|
export declare const bool: (value: Json | undefined, key: string) => boolean | null;
|
|
19
22
|
export declare const rows: (value: Json | undefined, key: string) => JsonObject[];
|
|
20
23
|
/** A list of strings, each made inert. */
|
|
21
24
|
export declare const strings: (value: Json | undefined, key: string) => string[];
|
|
25
|
+
/** Person keys as a person reads them: `jo@example.com · linkedin.com/in/jo`, or `null`. */
|
|
26
|
+
export declare const people: (value: Json | undefined, key: string) => string | null;
|
|
22
27
|
export declare const child: (value: Json | undefined, key: string) => JsonObject;
|
|
23
28
|
/** A count with thousands separators, or a dash. */
|
|
24
29
|
export declare const int: (value: number | null) => string;
|
|
30
|
+
/**
|
|
31
|
+
* A step as a person counts it, from 1. A tool or insight counts steps from
|
|
32
|
+
* 0, as the vendor does, so step `0` is shown as `1`.
|
|
33
|
+
*/
|
|
34
|
+
export declare const stepOf: (value: Json | undefined, key: string) => string;
|
|
35
|
+
/** A list of steps as a person counts them, from 1: `1, 3`. */
|
|
36
|
+
export declare const stepsOf: (value: Json | undefined, key: string) => string;
|
|
25
37
|
/** A rate between 0 and 1 as a percentage with one decimal, or a dash. */
|
|
26
38
|
export declare const pct: (rate: number | null) => string;
|
|
27
39
|
/** A rate with its interval, as `4.2% (3.1–5.6%)`. */
|
|
@@ -31,8 +43,11 @@ export declare const yesNo: (value: boolean | null) => string;
|
|
|
31
43
|
export declare const day: (value: string | null) => string;
|
|
32
44
|
/** Hours as `5h` or, from two days up, `3d`. */
|
|
33
45
|
export declare const waiting: (hours: number | null) => string;
|
|
34
|
-
/**
|
|
35
|
-
|
|
46
|
+
/**
|
|
47
|
+
* `1 campaign`, `3 campaigns`, with thousands separators, and `— campaigns`
|
|
48
|
+
* for a count the vendor does not report. Pass `many` when adding an `s` is wrong.
|
|
49
|
+
*/
|
|
50
|
+
export declare const plural: (amount: number | null, word: string, many?: string) => string;
|
|
36
51
|
/** A coloured dot for `high`, `medium`, `low` or `ok`; white for anything else. */
|
|
37
52
|
export declare const mark: (severity: string | null) => string;
|
|
38
53
|
/** A snake_case or camelCase name as words: `reply_rate` becomes `Reply rate`. */
|
package/dist/cards/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { CARD_NAMES, cardFor, digest } from "./render.ts";
|
|
2
|
-
export type { DigestOptions, DigestSection } from "./render.ts";
|
|
2
|
+
export type { CardInput, DigestOptions, DigestSection, InsightResultLike, } from "./render.ts";
|
|
3
3
|
export { alertCard, eventCard } from "./notify-cards.ts";
|
|
4
4
|
export type { EventCardOptions } from "./notify-cards.ts";
|
|
5
5
|
export { toSlackBlocks, toSlackMessage } from "./slack.ts";
|