@curviate/cli 0.54.0 → 0.56.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/CHANGELOG.md +57 -0
- package/README.md +35 -17
- package/dist/{account-DW5N5MJ6.js → account-ZF5NEMID.js} +132 -125
- package/dist/{analytics-T2K3OWVQ.js → analytics-M7JWS67A.js} +5 -5
- package/dist/{beta-consent-O736ONE7.js → beta-consent-4Q2LZZQC.js} +4 -4
- package/dist/{billing-NTBL32EX.js → billing-LYPSX5SR.js} +78 -6
- package/dist/{chunk-N76WNJ5T.js → chunk-7PLTQHNO.js} +1 -1
- package/dist/{chunk-N4IYTFIY.js → chunk-AMTKGO37.js} +1 -1
- package/dist/{chunk-ACKKHLUH.js → chunk-CRO7PJ4I.js} +2 -2
- package/dist/chunk-DENWYJK2.js +94 -0
- package/dist/{chunk-FBLCSVIU.js → chunk-EI64VFBE.js} +47 -47
- package/dist/{chunk-ENBIMEKS.js → chunk-IB6ARI3R.js} +1 -1
- package/dist/{chunk-Q57PZJLX.js → chunk-J4SFOFMT.js} +90 -88
- package/dist/{chunk-FUX3BRYP.js → chunk-JXDEV33Z.js} +1 -1
- package/dist/{chunk-5B4T6BMN.js → chunk-L3RJU7C3.js} +44 -44
- package/dist/{chunk-KXJJFHSD.js → chunk-MIOEYSBQ.js} +1 -1
- package/dist/{chunk-R4HS2MWM.js → chunk-MWVTFTWV.js} +15 -13
- package/dist/{chunk-QW5K5DTC.js → chunk-RDKTHFQ6.js} +25 -6
- package/dist/{chunk-62YAYAUI.js → chunk-RKNW4UX4.js} +51 -9
- package/dist/{chunk-V3HHYTBY.js → chunk-UOWOKEB2.js} +1 -1
- package/dist/{chunk-HOMRAZ6S.js → chunk-UWRWZG4N.js} +2 -2
- package/dist/{chunk-A3UNS44U.js → chunk-VEMK4MJM.js} +10 -10
- package/dist/{chunk-UFHT2KZG.js → chunk-XP6S6E55.js} +2 -2
- package/dist/cli.js +33 -25
- package/dist/{comment-ATVJOTWV.js → comment-D6RSZTVK.js} +8 -8
- package/dist/{company-BRKFROPE.js → company-3Z6PXGTW.js} +11 -11
- package/dist/{config-E223SS5K.js → config-VY5MCJMN.js} +2 -2
- package/dist/{connect-XVDQ5FTT.js → connect-G2RTLV7G.js} +15 -15
- package/dist/{contact-4HOUOVD7.js → contact-QSLJCBDE.js} +8 -8
- package/dist/{contact-groups-ENA3VGGL.js → contact-groups-OITAD73K.js} +85 -85
- package/dist/{contact-import-4EKVDFPV.js → contact-import-LT7BKESC.js} +10 -10
- package/dist/core-RFTNNB6P.js +46 -0
- package/dist/{do-not-contact-S2WGHSQL.js → do-not-contact-ZA7KS5WD.js} +59 -33
- package/dist/{doctor-OFIUGRUG.js → doctor-JQT3DO6G.js} +4 -4
- package/dist/{document-MDE2WJYX.js → document-H65EXU4L.js} +1 -1
- package/dist/domain-7EX4E34B.js +70 -0
- package/dist/{draft-DD3DTXBM.js → draft-7U6H4BPF.js} +4 -4
- package/dist/{enrollment-ESCHKQ5X.js → enrollment-AZ6XGVVL.js} +40 -38
- package/dist/{examples-KAMXHRLE.js → examples-IGQJCSNL.js} +2 -2
- package/dist/{exit-codes-CYQHN4NE.js → exit-codes-ZSOLAXQO.js} +1 -1
- package/dist/{export-GUAGB7TF.js → export-OYMQXL62.js} +5 -5
- package/dist/{feed-ZC4FY4BA.js → feed-M5D4SJW7.js} +6 -6
- package/dist/{group-42ZE7K3K.js → group-UTC3YBKE.js} +6 -6
- package/dist/{inbox-2YS7CTXH.js → inbox-VSGNHSLG.js} +9 -9
- package/dist/{inboxes-5RB3BGCQ.js → inboxes-23C2MJK4.js} +6 -6
- package/dist/{incoming-ATZN6JJA.js → incoming-QVPP32K7.js} +13 -13
- package/dist/{job-WD3Z3P3Q.js → job-ZHVFFRWE.js} +10 -10
- package/dist/{login-JQ57YHEJ.js → login-6OTNXEJZ.js} +4 -4
- package/dist/mailbox-HD2UXZCA.js +405 -0
- package/dist/{message-WGS2IIDC.js → message-PIV77W47.js} +7 -7
- package/dist/{motion-BRVBJJJP.js → motion-AHYF34DP.js} +224 -149
- package/dist/{network-CODIWCJQ.js → network-RJHJFZEY.js} +5 -5
- package/dist/{notification-RLVF4NLJ.js → notification-XGR4NT3S.js} +6 -6
- package/dist/{notifications-HGEHM5KW.js → notifications-BHRWSHPR.js} +6 -6
- package/dist/{post-3GH2IPO6.js → post-Z7AVDDKA.js} +8 -8
- package/dist/{profile-6RFJQMIB.js → profile-YZNBX2RP.js} +15 -15
- package/dist/{recruiter-GK3UNS62.js → recruiter-EXM4P7X7.js} +17 -17
- package/dist/{sales-nav-SLS3ABF4.js → sales-nav-CKDSEXV2.js} +15 -15
- package/dist/{search-45WRT5T3.js → search-B7FB6674.js} +17 -17
- package/dist/{setup-5QZOM2Q2.js → setup-VZVPLJ4V.js} +5 -5
- package/dist/{team-WM3RKOQ2.js → team-PYABBUHO.js} +6 -6
- package/dist/{tier-5AMLO5KE.js → tier-PRK4WQKR.js} +4 -4
- package/dist/{unibox-TTCF7YVO.js → unibox-ZNKX2EKL.js} +34 -34
- package/dist/{webhook-UCCCSKDO.js → webhook-V74EV4E2.js} +18 -18
- package/package.json +2 -2
- package/dist/core-6VDDV2NM.js +0 -46
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
outputOpts,
|
|
8
8
|
rootClient,
|
|
9
9
|
usage
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-UWRWZG4N.js";
|
|
11
11
|
import {
|
|
12
12
|
intFlag
|
|
13
13
|
} from "./chunk-NNV2OYEF.js";
|
|
@@ -18,21 +18,22 @@ import {
|
|
|
18
18
|
readablePage,
|
|
19
19
|
rejectPaginationModifiersWithoutAll,
|
|
20
20
|
streamAll
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-MIOEYSBQ.js";
|
|
22
22
|
import {
|
|
23
23
|
renderSuccess,
|
|
24
24
|
writeNdjsonItem
|
|
25
25
|
} from "./chunk-QM57YDJE.js";
|
|
26
26
|
import {
|
|
27
27
|
downloadBinary
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-7PLTQHNO.js";
|
|
29
29
|
import {
|
|
30
30
|
GLOBAL_FLAGS,
|
|
31
|
+
READ_SINGLE_FLAGS,
|
|
31
32
|
readOnly
|
|
32
33
|
} from "./chunk-QLKGOIWS.js";
|
|
33
34
|
import {
|
|
34
35
|
DESCRIPTIONS
|
|
35
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-MWVTFTWV.js";
|
|
36
37
|
import "./chunk-ZYURL5VK.js";
|
|
37
38
|
|
|
38
39
|
// src/commands/billing.ts
|
|
@@ -41,6 +42,40 @@ var online = (fn) => async ({ args }) => {
|
|
|
41
42
|
const f = args;
|
|
42
43
|
await fn(await rootClient(f), f);
|
|
43
44
|
};
|
|
45
|
+
async function runQuote(c, f) {
|
|
46
|
+
const seats = intFlag("seats", f.seats ?? usage("--seats is required: how many seats to price, 1 or more."), 1);
|
|
47
|
+
const period = f.period ?? "monthly";
|
|
48
|
+
if (period !== "monthly" && period !== "annual") usage("--period takes monthly or annual.");
|
|
49
|
+
try {
|
|
50
|
+
renderSuccess(await c.billing.quote({ seats: String(seats), period }), outputOpts(f), process);
|
|
51
|
+
} catch (err) {
|
|
52
|
+
await fail(err, f);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async function runCap(c, f) {
|
|
56
|
+
try {
|
|
57
|
+
renderSuccess(await c.billing.spendingCap(), outputOpts(f), process);
|
|
58
|
+
} catch (err) {
|
|
59
|
+
await fail(err, f);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async function runChanges(c, f) {
|
|
63
|
+
rejectPaginationModifiersWithoutAll(f, process);
|
|
64
|
+
const params = {};
|
|
65
|
+
if (f.limit !== void 0) params["limit"] = intFlag("limit", f.limit, 1, 100);
|
|
66
|
+
const cursor = readCursorFlag(f, process);
|
|
67
|
+
if (cursor) params["cursor"] = cursor;
|
|
68
|
+
try {
|
|
69
|
+
if (f.all) {
|
|
70
|
+
const page = (p) => c.billing.changes(p);
|
|
71
|
+
for await (const item of streamAll(page, params, { maxPages: readMaxPagesFlag(f, process), out: process, pageDelayMs: pageDelayFromFlags(f) })) writeNdjsonItem(process, item, f.fields);
|
|
72
|
+
} else {
|
|
73
|
+
renderSuccess(readablePage(await c.billing.changes(params)), outputOpts(f), process);
|
|
74
|
+
}
|
|
75
|
+
} catch (err) {
|
|
76
|
+
await fail(err, f);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
44
79
|
async function runList(c, f) {
|
|
45
80
|
rejectPaginationModifiersWithoutAll(f, process);
|
|
46
81
|
const params = {};
|
|
@@ -111,11 +146,48 @@ var invoicesCmd = defineCommand({
|
|
|
111
146
|
subCommands: { pdf: pdfCmd },
|
|
112
147
|
run: online(runList)
|
|
113
148
|
});
|
|
149
|
+
var quoteCmd = defineCommand({
|
|
150
|
+
meta: {
|
|
151
|
+
name: "quote",
|
|
152
|
+
description: "Price a number of seats for one period, step by step: each seat costs the price of the step it falls in, so adding a seat never changes what the earlier ones cost. Amounts in cents. Computed from the price list; charges nothing. Owners only.",
|
|
153
|
+
risk: "read",
|
|
154
|
+
output: ["`total` and `steps[]` (from, up_to, unit_amount, seats, amount), in cents, with `currency` and `period`."],
|
|
155
|
+
examples: ["curviate billing quote --seats 25", "curviate billing quote --seats 25 --period annual"]
|
|
156
|
+
},
|
|
157
|
+
args: {
|
|
158
|
+
...readOnly(READ_SINGLE_FLAGS),
|
|
159
|
+
seats: { type: "string", required: true, description: "How many seats to price, 1 or more." },
|
|
160
|
+
period: { type: "string", description: "monthly (default) or annual." }
|
|
161
|
+
},
|
|
162
|
+
run: online(runQuote)
|
|
163
|
+
});
|
|
164
|
+
var capCmd = defineCommand({
|
|
165
|
+
meta: {
|
|
166
|
+
name: "cap",
|
|
167
|
+
description: "The spending cap: the most seats an agent may bring your Team to (100 until an Owner sets one), the seats now, the room left and what the cap's seats cost a month. Read only: an Owner changes it in the dashboard. Adding a seat past it is refused with SPENDING_CAP_REACHED. Owners only.",
|
|
168
|
+
risk: "read",
|
|
169
|
+
output: ["`cap_seats`, `is_default`, `seats`, `room_seats`, `monthly_amount` (cents), `currency`."],
|
|
170
|
+
examples: ["curviate billing cap"]
|
|
171
|
+
},
|
|
172
|
+
args: { ...readOnly(READ_SINGLE_FLAGS) },
|
|
173
|
+
run: online(runCap)
|
|
174
|
+
});
|
|
175
|
+
var changesCmd = defineCommand({
|
|
176
|
+
meta: {
|
|
177
|
+
name: "changes",
|
|
178
|
+
description: "Every seat added or removed and every spending cap change on your Team, newest first: who made it (a person or an API key), the way it came in, the seat counts before and after and what it adds to the monthly price. Owners only.",
|
|
179
|
+
risk: "read",
|
|
180
|
+
output: ["`items` and a `cursor`; with --all, one change per line."],
|
|
181
|
+
examples: ["curviate billing changes", "curviate billing changes --all"]
|
|
182
|
+
},
|
|
183
|
+
args: { ...readOnly(GLOBAL_FLAGS) },
|
|
184
|
+
run: online(runChanges)
|
|
185
|
+
});
|
|
114
186
|
var billingCommand = defineCommand({
|
|
115
187
|
meta: { name: "billing", description: DESCRIPTIONS.billing },
|
|
116
|
-
subCommands: { invoices: invoicesCmd },
|
|
188
|
+
subCommands: { quote: quoteCmd, cap: capCmd, changes: changesCmd, invoices: invoicesCmd },
|
|
117
189
|
async run() {
|
|
118
|
-
const { showHelp } = await import("./examples-
|
|
190
|
+
const { showHelp } = await import("./examples-IGQJCSNL.js");
|
|
119
191
|
await showHelp(billingCommand, ["curviate", "billing"]);
|
|
120
192
|
}
|
|
121
193
|
});
|
|
@@ -274,7 +274,7 @@ import { AsyncLocalStorage } from "async_hooks";
|
|
|
274
274
|
import { Curviate, CurviateError as CurviateError2 } from "@curviate/sdk";
|
|
275
275
|
|
|
276
276
|
// package.json
|
|
277
|
-
var version = "0.
|
|
277
|
+
var version = "0.56.0";
|
|
278
278
|
|
|
279
279
|
// src/lib/client.ts
|
|
280
280
|
function headerStrings(headers) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
readablePage
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MIOEYSBQ.js";
|
|
5
5
|
import {
|
|
6
6
|
assertNoStdinPlaceholder
|
|
7
7
|
} from "./chunk-ZYURL5VK.js";
|
|
8
8
|
import {
|
|
9
9
|
getExitCode
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-RDKTHFQ6.js";
|
|
11
11
|
|
|
12
12
|
// src/lib/path-safety.ts
|
|
13
13
|
var UNSAFE_CHARS = /[\u0000-\u0020\u007F/\\?#%]/;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
readlineSync
|
|
4
|
+
} from "./chunk-IB6ARI3R.js";
|
|
5
|
+
import {
|
|
6
|
+
defaultReadStdin
|
|
7
|
+
} from "./chunk-ZYURL5VK.js";
|
|
8
|
+
|
|
9
|
+
// src/lib/credential-resolve.ts
|
|
10
|
+
var STDIN_TTY_CUE = "Reading secret from stdin (paste + Enter): ";
|
|
11
|
+
function defaultReadSingleLine() {
|
|
12
|
+
return readlineSync("", { mask: true });
|
|
13
|
+
}
|
|
14
|
+
async function resolveSecret(params) {
|
|
15
|
+
if (params.flagValue !== void 0 && params.flagValue !== "") {
|
|
16
|
+
return params.flagValue;
|
|
17
|
+
}
|
|
18
|
+
if (params.stdinRequested) {
|
|
19
|
+
if (params.isTTY) {
|
|
20
|
+
const stdinReadAllowed = params.allowInteractiveStdinRead ?? params.allowInteractive;
|
|
21
|
+
if (stdinReadAllowed !== false) {
|
|
22
|
+
params.out.stderr.write(STDIN_TTY_CUE);
|
|
23
|
+
const reader = params.readSingleLine ?? defaultReadSingleLine;
|
|
24
|
+
const raw = await reader(STDIN_TTY_CUE);
|
|
25
|
+
const trimmed = raw.trimEnd();
|
|
26
|
+
if (trimmed !== "") {
|
|
27
|
+
return trimmed;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
const reader = params.readStdin ?? defaultReadStdin;
|
|
32
|
+
const raw = await reader();
|
|
33
|
+
const trimmed = raw.trimEnd();
|
|
34
|
+
if (/[\r\n]/.test(trimmed)) {
|
|
35
|
+
params.out.stderr.write("error: stdin held more than one line. Pipe the secret alone, on one line.\n");
|
|
36
|
+
process.exit(2);
|
|
37
|
+
}
|
|
38
|
+
if (trimmed !== "") {
|
|
39
|
+
return trimmed;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const envValue = params.envVar ? process.env[params.envVar] : void 0;
|
|
44
|
+
if (envValue !== void 0 && envValue !== "") {
|
|
45
|
+
return envValue;
|
|
46
|
+
}
|
|
47
|
+
if (!params.required) {
|
|
48
|
+
return void 0;
|
|
49
|
+
}
|
|
50
|
+
if (params.allowInteractive === false) {
|
|
51
|
+
return void 0;
|
|
52
|
+
}
|
|
53
|
+
if (params.prompt && params.prompt.isTTY) {
|
|
54
|
+
const value = await params.prompt.readline(params.prompt.promptText, { mask: true });
|
|
55
|
+
if (value) {
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
params.out.stderr.write(`error: ${params.failMessage ?? "missing required credential"}
|
|
60
|
+
`);
|
|
61
|
+
process.exit(2);
|
|
62
|
+
}
|
|
63
|
+
function checkCredentialConflicts(flags, out) {
|
|
64
|
+
const passwordStdin = flags["password-stdin"] ?? false;
|
|
65
|
+
const liAtStdin = flags["li-at-stdin"] ?? false;
|
|
66
|
+
if (flags.password !== void 0 && passwordStdin) {
|
|
67
|
+
failConflict(out, "--password and --password-stdin cannot both be set. Choose one source.");
|
|
68
|
+
}
|
|
69
|
+
if (flags["li-at"] !== void 0 && liAtStdin) {
|
|
70
|
+
failConflict(out, "--li-at and --li-at-stdin cannot both be set. Choose one source.");
|
|
71
|
+
}
|
|
72
|
+
if (passwordStdin && liAtStdin) {
|
|
73
|
+
failConflict(
|
|
74
|
+
out,
|
|
75
|
+
"--password-stdin and --li-at-stdin cannot both be set. stdin can feed only one secret per invocation."
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
if (liAtStdin && flags["auth-method"] === "credentials") {
|
|
79
|
+
failConflict(out, "--li-at-stdin requires --auth-method cookie (it does not apply to the credentials method).");
|
|
80
|
+
}
|
|
81
|
+
if (passwordStdin && flags["auth-method"] === "cookie") {
|
|
82
|
+
failConflict(out, "--password-stdin requires --auth-method credentials (it does not apply to the cookie method).");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function failConflict(out, message) {
|
|
86
|
+
out.stderr.write(`error: ${message}
|
|
87
|
+
`);
|
|
88
|
+
process.exit(2);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
resolveSecret,
|
|
93
|
+
checkCredentialConflicts
|
|
94
|
+
};
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
outputOpts,
|
|
14
14
|
rootClient,
|
|
15
15
|
usage
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UWRWZG4N.js";
|
|
17
17
|
import {
|
|
18
18
|
intFlag
|
|
19
19
|
} from "./chunk-NNV2OYEF.js";
|
|
@@ -24,14 +24,14 @@ import {
|
|
|
24
24
|
readablePage,
|
|
25
25
|
rejectPaginationModifiersWithoutAll,
|
|
26
26
|
streamAll
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-MIOEYSBQ.js";
|
|
28
28
|
import {
|
|
29
29
|
renderSuccess,
|
|
30
30
|
writeNdjsonItem
|
|
31
31
|
} from "./chunk-QM57YDJE.js";
|
|
32
32
|
import {
|
|
33
33
|
downloadBinary
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-7PLTQHNO.js";
|
|
35
35
|
import {
|
|
36
36
|
GLOBAL_FLAGS,
|
|
37
37
|
READ_SINGLE_FLAGS,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
} from "./chunk-QLKGOIWS.js";
|
|
40
40
|
import {
|
|
41
41
|
DESCRIPTIONS
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-MWVTFTWV.js";
|
|
43
43
|
|
|
44
44
|
// src/commands/analytics.ts
|
|
45
45
|
import { defineCommand } from "citty";
|
|
@@ -68,7 +68,7 @@ function grammarParams(f) {
|
|
|
68
68
|
}
|
|
69
69
|
function filterParams(f, keys) {
|
|
70
70
|
const q = {};
|
|
71
|
-
if (keys.includes("
|
|
71
|
+
if (keys.includes("campaigns") && f.campaigns !== void 0) q["campaign_id"] = listFlag("campaigns", f.campaigns);
|
|
72
72
|
if (keys.includes("accounts") && f.accounts !== void 0) q["account_id"] = listFlag("accounts", f.accounts);
|
|
73
73
|
if (keys.includes("origin") && f.origin !== void 0) q["origin"] = listFlag("origin", f.origin);
|
|
74
74
|
return q;
|
|
@@ -115,14 +115,14 @@ function renderOverview(body) {
|
|
|
115
115
|
}
|
|
116
116
|
const limits = body["limits"]?.["rows"];
|
|
117
117
|
if (Array.isArray(limits) && limits.length) out.push(table(["BUDGET ROW", "USED", "CEILING", "LEFT"], limits.map((r) => [r["budget_row"], r["used"], r["effective_ceiling"], r["remaining"]])));
|
|
118
|
-
out.push(rowsTable("
|
|
118
|
+
out.push(rowsTable("CAMPAIGN", "campaign_id", "name", body["campaigns"]));
|
|
119
119
|
out.push(rowsTable("ACCOUNT", "account_id", "account_name", body["accounts"]));
|
|
120
120
|
const forecast = body["forecast"];
|
|
121
121
|
if (forecast?.status === "computing") out.push("forecast: being computed (an Account has had no simulation yet); read again in a few minutes");
|
|
122
122
|
else if (forecast?.daily?.length) {
|
|
123
|
-
out.push(`forecast through ${forecast.through} (
|
|
123
|
+
out.push(`forecast through ${forecast.through} (Campaigns only, the configuration as it is now)`);
|
|
124
124
|
out.push(table(["DATE", "INVITES", "ACCEPTED", "MESSAGES", "REPLIES", "INMAILS", "INMAIL REPLIES"], forecast.daily.map((d) => [d["date"], d["invites_sent"], d["accepted"], d["messages_sent"], d["replies"], d["inmails_sent"], d["inmail_replies"]])));
|
|
125
|
-
} else if (forecast === null) out.push("forecast: none (pick an Account for this
|
|
125
|
+
} else if (forecast === null) out.push("forecast: none (pick an Account for this Campaign)");
|
|
126
126
|
for (const fl of body["flags"] ?? []) out.push(`${fl["code"]}: ${fl["message"]}${fl["next"] ? ` (${fl["next"]})` : ""}`);
|
|
127
127
|
print(out.filter((x) => !!x).join("\n"));
|
|
128
128
|
}
|
|
@@ -132,13 +132,13 @@ function renderActivity(body) {
|
|
|
132
132
|
print(out.join("\n"));
|
|
133
133
|
}
|
|
134
134
|
async function runGet(c, f) {
|
|
135
|
-
const view = f.view ?? "
|
|
136
|
-
if (view !== "
|
|
135
|
+
const view = f.view ?? "campaigns";
|
|
136
|
+
if (view !== "campaigns" && view !== "activity") usage("--view takes campaigns or activity.");
|
|
137
137
|
if (view === "activity") {
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
138
|
+
const campaignOnly = ["campaign", "campaigns", "origin", "include", "sort", "limit", "compare", "forecast-days", "version"].find((k) => f[k] !== void 0);
|
|
139
|
+
if (campaignOnly) usage(`--${campaignOnly} reads Campaigns: --view activity takes the window and --accounts only.`);
|
|
140
140
|
}
|
|
141
|
-
if (f.version !== void 0 && f.
|
|
141
|
+
if (f.version !== void 0 && f.campaign === void 0) usage("--version needs --campaign.");
|
|
142
142
|
const q = { ...windowParams(f), ...filterParams(f, view === "activity" ? ["accounts"] : ["accounts", "origin"]) };
|
|
143
143
|
try {
|
|
144
144
|
if (view === "activity") {
|
|
@@ -148,8 +148,8 @@ async function runGet(c, f) {
|
|
|
148
148
|
Object.assign(q, grammarParams(f));
|
|
149
149
|
if (f.version !== void 0) q["version"] = intFlag("version", f.version);
|
|
150
150
|
let body;
|
|
151
|
-
if (f.
|
|
152
|
-
else body = await c.analytics.
|
|
151
|
+
if (f.campaign !== void 0) body = await c.analytics.campaigns.get(f.campaign, q);
|
|
152
|
+
else body = await c.analytics.campaigns.list({ ...q, ...filterParams(f, ["campaigns"]) });
|
|
153
153
|
return outputOpts(f).json ? renderSuccess(body, outputOpts(f), process) : renderOverview(body);
|
|
154
154
|
} catch (err) {
|
|
155
155
|
await fail(err, f);
|
|
@@ -157,11 +157,11 @@ async function runGet(c, f) {
|
|
|
157
157
|
}
|
|
158
158
|
async function runEvents(c, f) {
|
|
159
159
|
rejectPaginationModifiersWithoutAll(f, process);
|
|
160
|
-
if (f.step !== void 0 && f.
|
|
160
|
+
if (f.step !== void 0 && f.campaign === void 0) usage("--step needs --campaign: a step id names a step of one Campaign.");
|
|
161
161
|
const q = { ...filterParams(f, ["origin"]) };
|
|
162
|
-
if (f.
|
|
162
|
+
if (f.campaign !== void 0) q["campaign_id"] = f.campaign;
|
|
163
163
|
if (f.step !== void 0) q["step_id"] = f.step;
|
|
164
|
-
if (f.
|
|
164
|
+
if (f.lead !== void 0) q["lead_id"] = f.lead;
|
|
165
165
|
if (f.accounts !== void 0) q["account_id"] = listFlag("accounts", f.accounts).join(",");
|
|
166
166
|
if (f.kind !== void 0) q["kind"] = listFlag("kind", f.kind);
|
|
167
167
|
if (f.limit !== void 0) q["limit"] = intFlag("limit", f.limit, 1, 100);
|
|
@@ -176,16 +176,16 @@ async function runEvents(c, f) {
|
|
|
176
176
|
const page = readablePage(await c.analytics.events.list(q));
|
|
177
177
|
if (outputOpts(f).json) return renderSuccess(page, outputOpts(f), process);
|
|
178
178
|
print(table(
|
|
179
|
-
["AT", "KIND", "ORIGIN", "
|
|
180
|
-
page.items.map((e) => [e["occurred_at"], e["kind"], e["origin"], e["
|
|
179
|
+
["AT", "KIND", "ORIGIN", "CAMPAIGN", "STEP", "OUTCOME", "REASON", "LEAD"],
|
|
180
|
+
page.items.map((e) => [e["occurred_at"], e["kind"], e["origin"], e["campaign_name"], e["step_id"], e["outcome"], e["reason"] ? `${e["reason"]}: ${e["reason_message"] ?? ""}` : null, e["lead"]?.["full_name"]])
|
|
181
181
|
));
|
|
182
182
|
if (page["cursor"]) print(`next page: --cursor ${String(page["cursor"])}`);
|
|
183
183
|
} catch (err) {
|
|
184
184
|
await fail(err, f);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
var ANALYTICS_TABLES = ["daily", "accounts", "
|
|
188
|
-
var JOB_ENTITIES = ["
|
|
187
|
+
var ANALYTICS_TABLES = ["daily", "accounts", "campaigns", "enrollments"];
|
|
188
|
+
var JOB_ENTITIES = ["campaign_activity", "account_activity", "account_metrics"];
|
|
189
189
|
async function runExport(c, f) {
|
|
190
190
|
if (f.json) usage("export commands take no --json: pass --format json.");
|
|
191
191
|
const tables = f.table === void 0 ? [] : listFlag("table", f.table);
|
|
@@ -194,7 +194,7 @@ async function runExport(c, f) {
|
|
|
194
194
|
const unknown = tables.find((t) => !ANALYTICS_TABLES.includes(t) && t !== entity);
|
|
195
195
|
if (unknown !== void 0) usage(`--table takes ${ANALYTICS_TABLES.join(", ")}, or one of ${JOB_ENTITIES.join(", ")} with --job.`);
|
|
196
196
|
const format = f.format ?? "csv";
|
|
197
|
-
const filters = { ...windowParams(f), ...filterParams(f, ["
|
|
197
|
+
const filters = { ...windowParams(f), ...filterParams(f, ["campaigns", "accounts", "origin"]) };
|
|
198
198
|
try {
|
|
199
199
|
if (f.job) {
|
|
200
200
|
const exp = await c.exports.create({ entity, tables: tables.length ? tables : ANALYTICS_TABLES, format, filters });
|
|
@@ -217,7 +217,7 @@ var online = (fn) => async ({ args }) => {
|
|
|
217
217
|
var WINDOW_ARGS = {
|
|
218
218
|
from: {
|
|
219
219
|
type: "string",
|
|
220
|
-
description: "First day, YYYY-MM-DD, inclusive, in --timezone. A
|
|
220
|
+
description: "First day, YYYY-MM-DD, inclusive, in --timezone. A Campaign read (with or without --campaign) or an Account overview may start more than a year back: up to `window.counts_only_through` the figures come from daily counts (UTC days, no step, variant or seen detail), and `paths` cover only the days after `window.paths_through`. --view activity and the activity exports keep their own cap, named in the refusal."
|
|
221
221
|
},
|
|
222
222
|
to: { type: "string", description: "Last day, YYYY-MM-DD, inclusive, in --timezone (default today). Same rules as --from." },
|
|
223
223
|
range: { type: "string", description: "Instead of --from/--to: 7d, 30d, 90d, 12m or all." },
|
|
@@ -226,40 +226,40 @@ var WINDOW_ARGS = {
|
|
|
226
226
|
};
|
|
227
227
|
var FILTER_ARGS = {
|
|
228
228
|
accounts: { type: "string", description: "Only these Accounts: a comma list of ids (acc_...). Never filled from your profile's default Account." },
|
|
229
|
-
origin: { type: "string", description: "Who sent the actions: a comma list of
|
|
229
|
+
origin: { type: "string", description: "Who sent the actions: a comma list of campaign, unibox, api; direct is an alias for unibox and api." }
|
|
230
230
|
};
|
|
231
231
|
var GRAMMAR_ARGS = {
|
|
232
|
-
include: { type: "string", description: "Sections to return, comma list (for example performance,
|
|
232
|
+
include: { type: "string", description: "Sections to return, comma list (for example performance,campaigns,accounts,steps,variants,paths,flags). forecast: what your Campaigns are expected to send and get per day from today, a simulation with their observed rates; Campaigns only, the configuration frozen as it is now (no new Enrollments, no edits), never in the summary." },
|
|
233
233
|
"forecast-days": { type: "string", description: "With --include forecast: days after today, 1-365 (default 30); the forecast ends sooner when activity does." },
|
|
234
|
-
sort: { type: "string", description: "Order of the
|
|
235
|
-
limit: { type: "string", description: "How many
|
|
234
|
+
sort: { type: "string", description: "Order of the Campaign and Account lists, comma list of sent, acceptance.rate, reply.rate, inmail_reply.rate, last_activity_at, name; a leading - sorts descending." },
|
|
235
|
+
limit: { type: "string", description: "How many Campaigns and Accounts to return." },
|
|
236
236
|
compare: { type: "string", description: "previous_period: add the same number of days before --from to every rate (`previous`, `delta`)." }
|
|
237
237
|
};
|
|
238
238
|
var getCmd = defineCommand({
|
|
239
239
|
meta: {
|
|
240
240
|
name: "get",
|
|
241
|
-
description: "
|
|
241
|
+
description: "Campaign outcomes over a window: invitations, acceptance, messages, reply and InMail reply as outcomes so far, with each Campaign and Account. With --campaign: one Campaign's steps, paths and Accounts. With --view activity: the budget rows your Accounts used. Each Lead counts once per Account.",
|
|
242
242
|
risk: "read",
|
|
243
243
|
output: [
|
|
244
244
|
"acceptance: invitations accepted over invitations sent in the window, so far.",
|
|
245
245
|
"reply: people who replied over people messaged; InMail reply the same for InMails. Rates move as replies and acceptances arrive; `maturing` counts what was sent under 7 days ago and `low_sample` marks fewer than 30.",
|
|
246
|
-
"seen (--
|
|
247
|
-
"forecast (--include forecast): per day from today, the expected invitations, acceptances, messages, replies (InMail replies included), InMails and InMail replies; a draft
|
|
246
|
+
"seen (--campaign): messages read or replied over messages sent, per message step.",
|
|
247
|
+
"forecast (--include forecast): per day from today, the expected invitations, acceptances, messages, replies (InMail replies included), InMails and InMail replies; a draft Campaign as if turned on now.",
|
|
248
248
|
"A compact table by default; --json (or piped) prints the API body."
|
|
249
249
|
],
|
|
250
250
|
seeAlso: ["curviate analytics events list", "curviate account overview", "Judgement on reading the numbers: https://github.com/curviate/curviate-plugin"],
|
|
251
251
|
examples: [
|
|
252
252
|
"curviate analytics get --range 30d",
|
|
253
|
-
"curviate analytics get --
|
|
253
|
+
"curviate analytics get --campaign mot_YOUR_CAMPAIGN_ID --include steps,paths,forecast --forecast-days 14",
|
|
254
254
|
"curviate analytics get --view activity --from 2026-10-01 --to 2026-10-28"
|
|
255
255
|
]
|
|
256
256
|
},
|
|
257
257
|
args: {
|
|
258
258
|
...readOnly(READ_SINGLE_FLAGS),
|
|
259
|
-
view: { type: "string", description: "
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
version: { type: "string", description: "With --
|
|
259
|
+
view: { type: "string", description: "campaigns (default): Campaign outcomes; activity: budget rows used, not with --campaign." },
|
|
260
|
+
campaign: { type: "string", description: "One Campaign (mot_...): its steps, paths and Accounts." },
|
|
261
|
+
campaigns: { type: "string", description: "Without --campaign: only these Campaigns, comma list (mot_...)." },
|
|
262
|
+
version: { type: "string", description: "With --campaign: only this Sequence version." },
|
|
263
263
|
...WINDOW_ARGS,
|
|
264
264
|
...FILTER_ARGS,
|
|
265
265
|
...GRAMMAR_ARGS
|
|
@@ -272,15 +272,15 @@ var eventsListCmd = defineCommand({
|
|
|
272
272
|
description: "The records behind the numbers, newest first: steps executed or failed, invitations accepted, replies; each reason with its sentence. Metadata only, never message text.",
|
|
273
273
|
risk: "read",
|
|
274
274
|
examples: [
|
|
275
|
-
"curviate analytics events list --
|
|
276
|
-
"curviate analytics events list --
|
|
275
|
+
"curviate analytics events list --campaign mot_YOUR_CAMPAIGN_ID --step opener",
|
|
276
|
+
"curviate analytics events list --lead con_YOUR_LEAD_ID --origin unibox,api --all"
|
|
277
277
|
]
|
|
278
278
|
},
|
|
279
279
|
args: {
|
|
280
280
|
...readOnly(GLOBAL_FLAGS),
|
|
281
|
-
|
|
282
|
-
step: { type: "string", description: "With --
|
|
283
|
-
|
|
281
|
+
campaign: { type: "string", description: "Only this Campaign's records (mot_...)." },
|
|
282
|
+
step: { type: "string", description: "With --campaign: only this step's records." },
|
|
283
|
+
lead: { type: "string", description: "Only this Lead's records (con_...): its Campaign records and its direct ones." },
|
|
284
284
|
kind: { type: "string", description: "Comma list of step.executed, step.failed, invite.accepted, message.replied." },
|
|
285
285
|
accounts: FILTER_ARGS.accounts,
|
|
286
286
|
origin: FILTER_ARGS.origin
|
|
@@ -290,14 +290,14 @@ var eventsListCmd = defineCommand({
|
|
|
290
290
|
var exportCmd = defineCommand({
|
|
291
291
|
meta: {
|
|
292
292
|
name: "export",
|
|
293
|
-
description: "Export the Analytics tables (daily, accounts,
|
|
293
|
+
description: "Export the Analytics tables (daily, accounts, campaigns, enrollments) under the same window and filters: streamed now, or with --job built in the background (then `curviate export get` and `curviate export download`). One table is one file; several are one ZIP. Never message text. Owners and Managers only.",
|
|
294
294
|
risk: "read",
|
|
295
295
|
output: ["Data only on stdout or the --output file (mode 0600); with --job the export record."],
|
|
296
296
|
errors: { INSUFFICIENT_ROLE: "Members cannot export: ask an Owner or Manager.", EXPORT_IN_PROGRESS: "your Team already has an export running; read it with `curviate export get <export_id>`." },
|
|
297
297
|
seeAlso: ["curviate export get", "curviate export download"],
|
|
298
298
|
examples: [
|
|
299
299
|
"curviate analytics export --table enrollments --format csv --range 30d -o enrollments.csv",
|
|
300
|
-
"curviate analytics export --table daily,accounts,
|
|
300
|
+
"curviate analytics export --table daily,accounts,campaigns,enrollments --format csv --range 90d --job"
|
|
301
301
|
]
|
|
302
302
|
},
|
|
303
303
|
args: {
|
|
@@ -306,11 +306,11 @@ var exportCmd = defineCommand({
|
|
|
306
306
|
team: GLOBAL_FLAGS.team,
|
|
307
307
|
"base-url": GLOBAL_FLAGS["base-url"],
|
|
308
308
|
timeout: GLOBAL_FLAGS.timeout,
|
|
309
|
-
table: { type: "string", description: "Comma list of daily, accounts,
|
|
309
|
+
table: { type: "string", description: "Comma list of daily, accounts, campaigns, enrollments (default all four); or, with --job, one of campaign_activity, account_activity, account_metrics." },
|
|
310
310
|
format: { type: "string", description: "csv (default), json or ndjson (ndjson takes one table)." },
|
|
311
311
|
output: { type: "string", alias: "o", description: "File to write (mode 0600), or - for stdout (default)." },
|
|
312
312
|
job: { type: "boolean", description: "Build it in the background and print the export record instead of streaming it." },
|
|
313
|
-
|
|
313
|
+
campaigns: { type: "string", description: "Only these Campaigns, comma list (mot_...)." },
|
|
314
314
|
...WINDOW_ARGS,
|
|
315
315
|
...FILTER_ARGS,
|
|
316
316
|
json: { type: "boolean", description: "Not taken by exports: pass --format json." }
|
|
@@ -321,7 +321,7 @@ var eventsCommand = defineCommand({
|
|
|
321
321
|
meta: { name: "events", description: "The records behind the analytics numbers." },
|
|
322
322
|
subCommands: { list: eventsListCmd },
|
|
323
323
|
async run() {
|
|
324
|
-
const { showHelp } = await import("./examples-
|
|
324
|
+
const { showHelp } = await import("./examples-IGQJCSNL.js");
|
|
325
325
|
await showHelp(eventsCommand, ["curviate", "analytics", "events"]);
|
|
326
326
|
}
|
|
327
327
|
});
|
|
@@ -333,7 +333,7 @@ var analyticsCommand = defineCommand({
|
|
|
333
333
|
export: exportCmd
|
|
334
334
|
},
|
|
335
335
|
async run() {
|
|
336
|
-
const { showHelp } = await import("./examples-
|
|
336
|
+
const { showHelp } = await import("./examples-IGQJCSNL.js");
|
|
337
337
|
await showHelp(analyticsCommand, ["curviate", "analytics"]);
|
|
338
338
|
}
|
|
339
339
|
});
|