@curviate/cli 0.49.0 → 0.50.0-next.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 +15 -0
- package/README.md +12 -5
- package/dist/{account-2BH2Q6VG.js → account-KGCGUYKF.js} +668 -116
- package/dist/analytics-HRAD4ABO.js +27 -0
- package/dist/beta-consent-364JI6IL.js +81 -0
- package/dist/billing-3SSVRS2Y.js +124 -0
- package/dist/{chunk-V7FJWTZW.js → chunk-25MO7BYN.js} +4 -4
- package/dist/{chunk-RXWODUWA.js → chunk-2W4RN5ON.js} +18 -2
- package/dist/chunk-5S3MJVI5.js +22 -0
- package/dist/chunk-67S4JHZZ.js +339 -0
- package/dist/chunk-73DJ3KNE.js +54 -0
- package/dist/chunk-CQGDMARG.js +525 -0
- package/dist/{chunk-JYKYD57J.js → chunk-DOHBOYXN.js} +1 -1
- package/dist/{chunk-3RCW7URJ.js → chunk-DSGKYZDK.js} +1 -1
- package/dist/{chunk-YLSJ4HKU.js → chunk-ENBIMEKS.js} +26 -1
- package/dist/{chunk-LCGXJGPB.js → chunk-GHMRPX5H.js} +7 -1
- package/dist/chunk-GOICALYQ.js +28 -0
- package/dist/chunk-L4CIJT6F.js +144 -0
- package/dist/{chunk-PQWDDSV7.js → chunk-L7JH3W56.js} +1 -1
- package/dist/{chunk-Z7OQSWBD.js → chunk-OE6YFYUM.js} +85 -10
- package/dist/chunk-PPGKQJKU.js +38 -0
- package/dist/{chunk-SA2QHAXG.js → chunk-QM57YDJE.js} +13 -201
- package/dist/{chunk-Y7MZZRYR.js → chunk-RYWWSZUH.js} +14 -2
- package/dist/{chunk-MGB6FE4A.js → chunk-T6GBS5SS.js} +6 -6
- package/dist/{chunk-TEAWYLPO.js → chunk-TE3WBPW6.js} +43 -17
- package/dist/chunk-UL53T4O6.js +52 -0
- package/dist/chunk-UWQPX4AE.js +20 -0
- package/dist/{chunk-5ZGTU4VD.js → chunk-YXVF5UST.js} +77 -4
- package/dist/cli.js +34 -18
- package/dist/{comment-MRDPDA33.js → comment-5JKGNYOY.js} +90 -11
- package/dist/{company-2AEHSGHA.js → company-TXST2VXW.js} +65 -15
- package/dist/{config-NRBKHXES.js → config-TVIQUVNK.js} +53 -4
- package/dist/{connect-4XEBV5V3.js → connect-RBL6U4KV.js} +63 -18
- package/dist/contact-YAHC5QFX.js +32 -0
- package/dist/contact-groups-DKOIBC57.js +399 -0
- package/dist/contact-import-ITSJQV7K.js +336 -0
- package/dist/core-PWMJPPRG.js +46 -0
- package/dist/do-not-contact-WDYIBWYA.js +200 -0
- package/dist/{doctor-BZ4DA7DV.js → doctor-F7JLPTED.js} +65 -11
- package/dist/{document-RKHRWXNT.js → document-BHYAUJ6F.js} +1 -1
- package/dist/{draft-C5N6EOO5.js → draft-TDJJUXLH.js} +60 -14
- package/dist/{enrollment-BNQOUKI7.js → enrollment-Q6UOKHPY.js} +31 -19
- package/dist/{examples-NIMSIXMV.js → examples-DQSVIIXZ.js} +2 -2
- package/dist/{exit-codes-TLMKTLRI.js → exit-codes-7DBETBDT.js} +1 -1
- package/dist/export-HIJSCJS6.js +96 -0
- package/dist/{feed-DFUU7SUJ.js → feed-W56ZTA4Z.js} +13 -10
- package/dist/{group-CSD2OWOZ.js → group-AUALYK5H.js} +18 -10
- package/dist/{inbox-SNSPWI7J.js → inbox-HLZR2ZPV.js} +31 -12
- package/dist/{inboxes-RIRHPS4H.js → inboxes-IZTRD6FE.js} +14 -10
- package/dist/incoming-ULB2RNV4.js +218 -0
- package/dist/{job-6PNXXZNF.js → job-55IKS6LP.js} +65 -13
- package/dist/{login-Y7JBAHCW.js → login-DPZ6CXNO.js} +13 -4
- package/dist/{message-2IK4MBBG.js → message-J44YKRDS.js} +9 -7
- package/dist/{motion-7ATUXO6R.js → motion-SQI5F2EK.js} +39 -117
- package/dist/network-K4QD7APQ.js +235 -0
- package/dist/{notification-VYK5NDEB.js → notification-SEDXZHXO.js} +38 -11
- package/dist/notifications-HGIBRUNQ.js +231 -0
- package/dist/{post-AN6T2OJF.js → post-L467SKIG.js} +92 -12
- package/dist/{profile-UQY64642.js → profile-A2N6RMR2.js} +76 -20
- package/dist/{recruiter-OY4RN5HH.js → recruiter-AR75RHBO.js} +133 -22
- package/dist/{sales-nav-KLODLYMW.js → sales-nav-C2AYFXPV.js} +74 -19
- package/dist/{search-NWP5S6CF.js → search-Z4DZIG4X.js} +55 -23
- package/dist/{setup-YPPFLH2N.js → setup-45BEVX6B.js} +69 -17
- package/dist/team-6QWY4IFP.js +450 -0
- package/dist/tier-2HS3BXDF.js +61 -0
- package/dist/unibox-DHUKG65Z.js +402 -0
- package/dist/{webhook-OHKBL3YS.js → webhook-Q53WUAI2.js} +257 -27
- package/package.json +2 -2
- package/dist/chunk-D2S5OCYU.js +0 -38
- package/dist/core-RGU2SCBN.js +0 -46
|
@@ -3,53 +3,271 @@ import {
|
|
|
3
3
|
slimAccountGet,
|
|
4
4
|
slimAccountList,
|
|
5
5
|
slimAccountListItem
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GHMRPX5H.js";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
GRAMMAR_ARGS,
|
|
9
|
+
WINDOW_ARGS,
|
|
10
|
+
grammarParams,
|
|
11
|
+
renderOverview,
|
|
12
|
+
windowParams
|
|
13
|
+
} from "./chunk-67S4JHZZ.js";
|
|
14
|
+
import {
|
|
15
|
+
print,
|
|
16
|
+
table
|
|
17
|
+
} from "./chunk-5S3MJVI5.js";
|
|
18
|
+
import "./chunk-PPGKQJKU.js";
|
|
19
|
+
import {
|
|
20
|
+
fail,
|
|
21
|
+
listFlag,
|
|
22
|
+
outputOpts,
|
|
23
|
+
rootClient,
|
|
24
|
+
usage
|
|
25
|
+
} from "./chunk-T6GBS5SS.js";
|
|
10
26
|
import {
|
|
11
27
|
buildPreviewOutput
|
|
12
28
|
} from "./chunk-TCUYH5GO.js";
|
|
13
29
|
import {
|
|
14
|
-
|
|
30
|
+
intFlag
|
|
31
|
+
} from "./chunk-NNV2OYEF.js";
|
|
32
|
+
import {
|
|
15
33
|
pageDelayFromFlags,
|
|
16
34
|
readCursorFlag,
|
|
17
35
|
readMaxPagesFlag,
|
|
18
36
|
readableObject,
|
|
19
37
|
readablePage,
|
|
20
38
|
rejectPaginationModifiersWithoutAll,
|
|
39
|
+
streamAll
|
|
40
|
+
} from "./chunk-L4CIJT6F.js";
|
|
41
|
+
import {
|
|
42
|
+
isJsonMode,
|
|
21
43
|
renderError,
|
|
22
44
|
renderNotices,
|
|
23
45
|
renderSuccess,
|
|
24
46
|
renderUnexpectedError,
|
|
25
|
-
resolveEffectiveConfig,
|
|
26
|
-
streamAll,
|
|
27
47
|
writeNdjsonItem
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import {
|
|
30
|
-
AUTH_NEEDED
|
|
31
|
-
} from "./chunk-RXWODUWA.js";
|
|
48
|
+
} from "./chunk-QM57YDJE.js";
|
|
32
49
|
import {
|
|
50
|
+
readHiddenToEof,
|
|
33
51
|
readlineSync
|
|
34
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-ENBIMEKS.js";
|
|
35
53
|
import {
|
|
36
|
-
createClient
|
|
37
|
-
|
|
54
|
+
createClient,
|
|
55
|
+
resolveEffectiveConfig
|
|
56
|
+
} from "./chunk-YXVF5UST.js";
|
|
38
57
|
import {
|
|
39
58
|
GLOBAL_FLAGS,
|
|
40
59
|
READ_SINGLE_FLAGS,
|
|
41
60
|
WRITE_SINGLE_FLAGS,
|
|
42
61
|
readOnly
|
|
43
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-RYWWSZUH.js";
|
|
44
63
|
import {
|
|
45
64
|
DESCRIPTIONS
|
|
46
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-73DJ3KNE.js";
|
|
47
66
|
import {
|
|
48
|
-
defaultReadStdin
|
|
67
|
+
defaultReadStdin,
|
|
68
|
+
isStdinToken
|
|
49
69
|
} from "./chunk-ZYURL5VK.js";
|
|
70
|
+
import {
|
|
71
|
+
AUTH_NEEDED
|
|
72
|
+
} from "./chunk-2W4RN5ON.js";
|
|
50
73
|
|
|
51
|
-
// src/commands/account.ts
|
|
74
|
+
// src/commands/account-insights.ts
|
|
52
75
|
import { defineCommand } from "citty";
|
|
76
|
+
async function runOverview(c, f) {
|
|
77
|
+
const q = { ...windowParams(f), ...grammarParams(f) };
|
|
78
|
+
if (f.motions !== void 0) q["motion_id"] = listFlag("motions", f.motions);
|
|
79
|
+
if (f.origin !== void 0) q["origin"] = listFlag("origin", f.origin);
|
|
80
|
+
try {
|
|
81
|
+
const body = await c.accounts.overview(String(f.accountId ?? ""), q);
|
|
82
|
+
return outputOpts(f).json ? renderSuccess(body, outputOpts(f), process) : renderOverview(body);
|
|
83
|
+
} catch (err) {
|
|
84
|
+
await fail(err, f);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async function runMetrics(c, f) {
|
|
88
|
+
const { from, to, timezone } = windowParams(f);
|
|
89
|
+
try {
|
|
90
|
+
const body = await c.accounts.metrics(String(f.accountId ?? ""), { from, to, timezone });
|
|
91
|
+
if (outputOpts(f).json) return renderSuccess(body, outputOpts(f), process);
|
|
92
|
+
print(table(
|
|
93
|
+
["DATE", "CONNECTIONS", "FOLLOWERS", "VIEWERS 90D", "SEARCH/WEEK", "POST IMPR 7D", "SSI"],
|
|
94
|
+
(body.items ?? []).map((d) => [d["date"], d["connections"], d["followers"], d["profile_viewers_90d"], d["search_appearances_week"], d["post_impressions_7d"], d["ssi"]?.["score"]])
|
|
95
|
+
));
|
|
96
|
+
} catch (err) {
|
|
97
|
+
await fail(err, f);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
var online = (fn) => async ({ args }) => {
|
|
101
|
+
const f = args;
|
|
102
|
+
await fn(await rootClient(f), f);
|
|
103
|
+
};
|
|
104
|
+
var ACCOUNT_ID = { type: "positional", description: "The Account (acc_...)." };
|
|
105
|
+
var accountOverviewCommand = defineCommand({
|
|
106
|
+
meta: {
|
|
107
|
+
name: "overview",
|
|
108
|
+
description: "One Account's overview over a window: profile and status, latest metrics, outcomes so far (acceptance, reply, InMail reply), budget rows used today, its Motions, and flags with the next command to run. Each Contact counts once per Account.",
|
|
109
|
+
risk: "read",
|
|
110
|
+
output: ["A compact table by default; --json (or piped) prints the API body."],
|
|
111
|
+
seeAlso: ["curviate account metrics", "curviate analytics get"],
|
|
112
|
+
examples: ["curviate account overview acc_YOUR_ACCOUNT_ID", "curviate account overview acc_YOUR_ACCOUNT_ID --range 90d --compare previous_period"]
|
|
113
|
+
},
|
|
114
|
+
args: {
|
|
115
|
+
...readOnly(READ_SINGLE_FLAGS),
|
|
116
|
+
accountId: ACCOUNT_ID,
|
|
117
|
+
...WINDOW_ARGS,
|
|
118
|
+
motions: { type: "string", description: "Only these Motions, comma list (mot_...)." },
|
|
119
|
+
origin: { type: "string", description: "Who sent the actions: a comma list of motion, unibox, api; direct is an alias for unibox and api." },
|
|
120
|
+
...GRAMMAR_ARGS
|
|
121
|
+
},
|
|
122
|
+
run: online(runOverview)
|
|
123
|
+
});
|
|
124
|
+
var accountMetricsCommand = defineCommand({
|
|
125
|
+
meta: {
|
|
126
|
+
name: "metrics",
|
|
127
|
+
description: "One Account's daily profile metrics, one row per day: connections, followers, profile viewers (90 days), search appearances (week), post impressions (7 days), SSI and its pillars.",
|
|
128
|
+
risk: "read",
|
|
129
|
+
examples: ["curviate account metrics acc_YOUR_ACCOUNT_ID --from 2026-10-01 --to 2026-10-28"]
|
|
130
|
+
},
|
|
131
|
+
args: {
|
|
132
|
+
...readOnly(READ_SINGLE_FLAGS),
|
|
133
|
+
accountId: ACCOUNT_ID,
|
|
134
|
+
from: { type: "string", description: "First day, YYYY-MM-DD, inclusive, in --timezone." },
|
|
135
|
+
to: { type: "string", description: "Last day, YYYY-MM-DD, inclusive, in --timezone." },
|
|
136
|
+
timezone: WINDOW_ARGS.timezone
|
|
137
|
+
},
|
|
138
|
+
run: online(runMetrics)
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// src/commands/account-warm-up.ts
|
|
142
|
+
import { defineCommand as defineCommand2 } from "citty";
|
|
143
|
+
async function run(f, enabled) {
|
|
144
|
+
const accountId = String(f.accountId ?? "");
|
|
145
|
+
if (f.preview) {
|
|
146
|
+
process.stdout.write(JSON.stringify(buildPreviewOutput({ method: "accounts.updateSafetyPolicy", args: { accountId }, body: { warm_up: { enabled } } })) + "\n");
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const c = await rootClient(f);
|
|
150
|
+
try {
|
|
151
|
+
const policy = await c.accounts.updateSafetyPolicy(accountId, { warm_up: { enabled } });
|
|
152
|
+
if (outputOpts(f).json) return renderSuccess(policy, outputOpts(f), process);
|
|
153
|
+
const w = policy.warm_up ?? {};
|
|
154
|
+
process.stdout.write(`Warm-up ${w.enabled ? "on" : "off"} for ${accountId}: state ${w.state ?? "unknown"}, factor ${w.factor ?? "unknown"}${w.dormant ? ", dormant" : ""}.
|
|
155
|
+
`);
|
|
156
|
+
} catch (err) {
|
|
157
|
+
await fail(err, f);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
var switchCommand = (name) => defineCommand2({
|
|
161
|
+
meta: {
|
|
162
|
+
name,
|
|
163
|
+
description: name === "on" ? "Turn the Account's warm-up on: the ramp holds its ceilings below the limits after a connect or a quiet spell. Prints the resulting warm-up." : "Turn the Account's warm-up off: the connect and quiet ramps no longer apply (recovery after a LinkedIn restriction still does). Prints the resulting warm-up.",
|
|
164
|
+
risk: "write",
|
|
165
|
+
rules: {
|
|
166
|
+
changes: `The Account's warm-up switch is set ${name}; every budget row's effective ceiling follows.`,
|
|
167
|
+
visible_to: "Everyone using this workspace's key. Nothing is posted on LinkedIn.",
|
|
168
|
+
budget_rows: [],
|
|
169
|
+
retry: "Safe to repeat: the switch ends in the same state.",
|
|
170
|
+
undo: `Run \`curviate account warm-up ${name === "on" ? "off" : "on"} <account>\`.`,
|
|
171
|
+
blast_radius: "One Account's pace."
|
|
172
|
+
},
|
|
173
|
+
seeAlso: ["curviate account get"],
|
|
174
|
+
examples: [`curviate account warm-up ${name} acc_YOUR_ACCOUNT_ID`]
|
|
175
|
+
},
|
|
176
|
+
args: { ...WRITE_SINGLE_FLAGS, accountId: { type: "positional", description: "The Account (acc_...)." } },
|
|
177
|
+
async run({ args }) {
|
|
178
|
+
await run(args, name === "on");
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
var accountWarmUpCommand = defineCommand2({
|
|
182
|
+
meta: { name: "warm-up", description: "Turn an Account's warm-up ramp on or off." },
|
|
183
|
+
subCommands: { on: switchCommand("on"), off: switchCommand("off") },
|
|
184
|
+
async run() {
|
|
185
|
+
process.stderr.write("Usage: curviate account warm-up on|off <account>\n");
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
// src/commands/account.ts
|
|
190
|
+
import { defineCommand as defineCommand4 } from "citty";
|
|
191
|
+
|
|
192
|
+
// src/lib/cookie-export.ts
|
|
193
|
+
var COOKIE_EXPORT_MAX_BYTES = 1024 * 1024;
|
|
194
|
+
var LI_A_EXPIRED_NOTE = "Your Sales Navigator or Recruiter session in this export has expired, so the account connects without it.";
|
|
195
|
+
function cookieExportMessage(r) {
|
|
196
|
+
switch (r.reason) {
|
|
197
|
+
case "empty":
|
|
198
|
+
return "Paste the export from Cookie-Editor.";
|
|
199
|
+
case "not_json":
|
|
200
|
+
return "This isn't a JSON export. In Cookie-Editor, click Export, choose JSON, and paste the result.";
|
|
201
|
+
case "not_array":
|
|
202
|
+
return "This JSON isn't a Cookie-Editor export. On linkedin.com, click Export in Cookie-Editor and choose JSON.";
|
|
203
|
+
case "no_li_at":
|
|
204
|
+
return "No LinkedIn session cookie (li_at) found. Sign in to linkedin.com in this browser, then export again.";
|
|
205
|
+
case "expired":
|
|
206
|
+
return `The LinkedIn session in this export expired on ${new Date(r.expiredAt ?? 0).toISOString().slice(0, 10)}. Sign in to linkedin.com again, then export again.`;
|
|
207
|
+
case "too_large":
|
|
208
|
+
return "This export is too large. Export from a linkedin.com tab only.";
|
|
209
|
+
case "header_string":
|
|
210
|
+
return "This is the Header String export. In Cookie-Editor, click Export and choose JSON instead.";
|
|
211
|
+
case "netscape":
|
|
212
|
+
return "This is the Netscape export. In Cookie-Editor, click Export and choose JSON instead.";
|
|
213
|
+
case "other_site":
|
|
214
|
+
return "These cookies are from another website. Open a linkedin.com tab, then export from Cookie-Editor there.";
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
var fail2 = (reason, extra = {}) => ({ ok: false, reason, ...extra });
|
|
218
|
+
function expiryOf(c) {
|
|
219
|
+
const e = c["expirationDate"];
|
|
220
|
+
return c["session"] === true || typeof e !== "number" || !Number.isFinite(e) ? null : e;
|
|
221
|
+
}
|
|
222
|
+
function pick(cands, nowSec) {
|
|
223
|
+
const live = cands.filter((c) => c.expires === null || c.expires > nowSec);
|
|
224
|
+
const gone = cands.filter((c) => c.expires !== null && c.expires <= nowSec);
|
|
225
|
+
const rank = (c) => c.expires ?? -Infinity;
|
|
226
|
+
const latest = (xs) => xs.reduce((a, b) => a === void 0 || rank(b) > rank(a) ? b : a, void 0);
|
|
227
|
+
return { live: latest(live), expired: latest(gone) };
|
|
228
|
+
}
|
|
229
|
+
function parseCookieExport(raw, nowMs) {
|
|
230
|
+
const text = raw.replace(/^\uFEFF/, "").trim();
|
|
231
|
+
if (text === "") return fail2("empty");
|
|
232
|
+
if (/^#\s?Netscape HTTP Cookie File/i.test(text) || /^[^\t\n]*\t(TRUE|FALSE)\t/m.test(text)) return fail2("netscape");
|
|
233
|
+
if (Buffer.byteLength(text, "utf8") > COOKIE_EXPORT_MAX_BYTES) return fail2("too_large");
|
|
234
|
+
let json;
|
|
235
|
+
try {
|
|
236
|
+
json = JSON.parse(text);
|
|
237
|
+
} catch {
|
|
238
|
+
const pairs = text.split(";").map((s) => s.trim()).filter(Boolean);
|
|
239
|
+
return fail2(pairs.length >= 2 && pairs.every((p) => /^[^=\s]+=/.test(p)) ? "header_string" : "not_json");
|
|
240
|
+
}
|
|
241
|
+
if (!Array.isArray(json)) return fail2("not_array");
|
|
242
|
+
const nowSec = nowMs / 1e3;
|
|
243
|
+
const linkedin = json.filter((e) => {
|
|
244
|
+
if (e === null || typeof e !== "object" || typeof e["name"] !== "string") return false;
|
|
245
|
+
const d = e["domain"];
|
|
246
|
+
if (typeof d !== "string") return false;
|
|
247
|
+
const host = d.toLowerCase().replace(/^\./, "");
|
|
248
|
+
return host === "linkedin.com" || host === "www.linkedin.com";
|
|
249
|
+
});
|
|
250
|
+
if (json.length > 0 && linkedin.length === 0) return fail2("other_site");
|
|
251
|
+
const named = (name) => linkedin.filter((c) => c["name"] === name).flatMap((c) => {
|
|
252
|
+
const raw2 = c["value"];
|
|
253
|
+
if (typeof raw2 !== "string") return [];
|
|
254
|
+
const v = raw2.length >= 2 && raw2.startsWith('"') && raw2.endsWith('"') ? raw2.slice(1, -1) : raw2;
|
|
255
|
+
return v === "" ? [] : [{ value: v, expires: expiryOf(c) }];
|
|
256
|
+
});
|
|
257
|
+
const at = pick(named("li_at"), nowSec);
|
|
258
|
+
if (!at.live) return at.expired ? fail2("expired", { expiredAt: at.expired.expires * 1e3 }) : fail2("no_li_at");
|
|
259
|
+
const a = pick(named("li_a"), nowSec);
|
|
260
|
+
return {
|
|
261
|
+
ok: true,
|
|
262
|
+
liAt: at.live.value,
|
|
263
|
+
...a.live ? { liA: a.live.value } : {},
|
|
264
|
+
liAtExpiresAt: at.live.expires === null ? null : at.live.expires * 1e3,
|
|
265
|
+
notes: !a.live && a.expired ? [LI_A_EXPIRED_NOTE] : []
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// src/commands/account.ts
|
|
270
|
+
import { statSync, readFileSync } from "fs";
|
|
53
271
|
|
|
54
272
|
// src/lib/credential-resolve.ts
|
|
55
273
|
var STDIN_TTY_CUE = "Reading secret from stdin (paste + Enter): ";
|
|
@@ -133,35 +351,63 @@ function failConflict(out, message) {
|
|
|
133
351
|
var RESENDABLE_CHALLENGE_TYPES = /* @__PURE__ */ new Set([
|
|
134
352
|
"otp",
|
|
135
353
|
"two_factor_sms",
|
|
136
|
-
"
|
|
354
|
+
"two_factor_whatsapp",
|
|
355
|
+
"mobile_app_approval",
|
|
356
|
+
"otp_or_mobile_app_approval"
|
|
137
357
|
]);
|
|
138
|
-
|
|
358
|
+
var ANOTHER_WAY_TYPES = /* @__PURE__ */ new Set([...RESENDABLE_CHALLENGE_TYPES, "two_factor_app"]);
|
|
359
|
+
var VIA = { email: "by email", sms: "by text message", whatsapp: "on WhatsApp" };
|
|
360
|
+
function challengeTitle(type, channel) {
|
|
139
361
|
switch (type) {
|
|
140
362
|
case "otp":
|
|
141
|
-
return "Check your email";
|
|
363
|
+
return channel === "email" ? "Check your email" : channel === "sms" ? "Check your text messages" : channel === "whatsapp" ? "Check WhatsApp" : "Enter the verification code";
|
|
142
364
|
case "two_factor_sms":
|
|
143
365
|
return "Enter SMS code";
|
|
366
|
+
case "two_factor_whatsapp":
|
|
367
|
+
return "Check WhatsApp";
|
|
144
368
|
case "two_factor_app":
|
|
145
369
|
return "Enter authenticator code";
|
|
146
370
|
case "mobile_app_approval":
|
|
147
371
|
return "Approve in LinkedIn app";
|
|
372
|
+
case "otp_or_mobile_app_approval":
|
|
373
|
+
return "Enter the code or approve in the LinkedIn app";
|
|
374
|
+
case "checking":
|
|
375
|
+
return "LinkedIn is checking this sign-in";
|
|
376
|
+
case "phone_register":
|
|
377
|
+
return "Add your mobile number";
|
|
378
|
+
case "contract_selection":
|
|
379
|
+
return "Choose a contract";
|
|
380
|
+
case "challenge_selection":
|
|
381
|
+
return "Choose how LinkedIn verifies this sign-in";
|
|
148
382
|
}
|
|
149
383
|
}
|
|
150
|
-
function challengeDescription(type) {
|
|
384
|
+
function challengeDescription(type, channel) {
|
|
151
385
|
switch (type) {
|
|
152
386
|
case "otp":
|
|
153
|
-
return "LinkedIn sent a one-time code to your registered email address.";
|
|
387
|
+
return channel === "email" ? "LinkedIn sent a one-time code to your registered email address." : channel === "sms" ? "LinkedIn texted a verification code to your registered phone number." : channel === "whatsapp" ? "LinkedIn sent a verification code to you on WhatsApp." : "LinkedIn sent you a verification code.";
|
|
154
388
|
case "two_factor_sms":
|
|
155
389
|
return "LinkedIn sent a verification code to your registered phone number.";
|
|
390
|
+
case "two_factor_whatsapp":
|
|
391
|
+
return "LinkedIn sent a verification code to you on WhatsApp.";
|
|
156
392
|
case "two_factor_app":
|
|
157
393
|
return "Enter the current code from your authenticator app.";
|
|
158
394
|
case "mobile_app_approval":
|
|
159
395
|
return "Open your LinkedIn mobile app and approve this sign-in. This will continue automatically once you tap approve.";
|
|
396
|
+
case "otp_or_mobile_app_approval":
|
|
397
|
+
return `LinkedIn sent you a code${channel ? ` ${VIA[channel]}` : ""}. Enter it, or approve this sign-in in the LinkedIn app.`;
|
|
398
|
+
case "checking":
|
|
399
|
+
return "Nothing to do yet. This continues automatically.";
|
|
400
|
+
case "phone_register":
|
|
401
|
+
return "LinkedIn asks for a mobile number before it signs in, then sends a code to it. Enter it as (+CC)number, for example (+49)1701234567.";
|
|
402
|
+
case "contract_selection":
|
|
403
|
+
return "This account has several contracts; pick the one to send from.";
|
|
404
|
+
case "challenge_selection":
|
|
405
|
+
return "LinkedIn offers more than one way to verify this sign-in.";
|
|
160
406
|
}
|
|
161
407
|
}
|
|
162
|
-
function printChallengeCopy(type, out) {
|
|
163
|
-
out.stderr.write(`${challengeTitle(type)}
|
|
164
|
-
${challengeDescription(type)}
|
|
408
|
+
function printChallengeCopy(type, out, channel) {
|
|
409
|
+
out.stderr.write(`${challengeTitle(type, channel)}
|
|
410
|
+
${challengeDescription(type, channel)}
|
|
165
411
|
`);
|
|
166
412
|
}
|
|
167
413
|
function printResendHintIfApplicable(type, accountId, out) {
|
|
@@ -171,6 +417,11 @@ function printResendHintIfApplicable(type, accountId, out) {
|
|
|
171
417
|
`
|
|
172
418
|
);
|
|
173
419
|
}
|
|
420
|
+
function printAnotherWayHintIfApplicable(type, accountId, out) {
|
|
421
|
+
if (!ANOTHER_WAY_TYPES.has(type)) return;
|
|
422
|
+
out.stderr.write(`Can't use this method? Ask LinkedIn for another: curviate account checkpoint solve ${accountId} --code TRY_ANOTHER_WAY
|
|
423
|
+
`);
|
|
424
|
+
}
|
|
174
425
|
|
|
175
426
|
// src/lib/checkpoint-cadence.ts
|
|
176
427
|
var CHECKPOINT_POLL_FIRST_DELAY_MS = 1e3;
|
|
@@ -181,6 +432,131 @@ function nextCheckpointPollDelayMs(elapsedMs) {
|
|
|
181
432
|
return elapsedMs < CHECKPOINT_POLL_FAST_WINDOW_MS ? CHECKPOINT_POLL_FAST_INTERVAL_MS : CHECKPOINT_POLL_SLOW_INTERVAL_MS;
|
|
182
433
|
}
|
|
183
434
|
|
|
435
|
+
// src/commands/connect-request.ts
|
|
436
|
+
import { defineCommand as defineCommand3 } from "citty";
|
|
437
|
+
var CONNECT_REQUEST_INSTRUCTION = "Ask your user to open this link in the browser where they're signed in to Curviate, or to open Accounts in their Curviate dashboard, where this request is listed. It expires in 15 minutes. Never ask them for their LinkedIn password, cookies or verification codes.";
|
|
438
|
+
var online2 = (fn) => async ({ args }) => {
|
|
439
|
+
const f = args;
|
|
440
|
+
await fn(await rootClient(f), f);
|
|
441
|
+
};
|
|
442
|
+
function preview(method, args, body = {}) {
|
|
443
|
+
process.stdout.write(JSON.stringify(buildPreviewOutput({ method, args, body })) + "\n");
|
|
444
|
+
}
|
|
445
|
+
var requestId = (f) => {
|
|
446
|
+
const id = f.id ?? "";
|
|
447
|
+
if (id.trim() === "") usage("the request id is empty. Pass the creq_... id from `curviate account connect-request create`.");
|
|
448
|
+
return id;
|
|
449
|
+
};
|
|
450
|
+
async function runCreate(c, f) {
|
|
451
|
+
if (f.reconnect !== void 0 && f.reconnect.trim() === "") usage("--reconnect was given an empty value. Pass the acc_... id of the account to reconnect, or omit it to connect a new account.");
|
|
452
|
+
if (f["warm-up"] === false && f.reconnect !== void 0) usage("--no-warm-up applies to a new connect. A connected account's ramp is switched with `curviate account warm-up`.");
|
|
453
|
+
const body = f.reconnect !== void 0 ? { account_id: f.reconnect } : {};
|
|
454
|
+
if (f["warm-up"] === false) body["warm_up"] = false;
|
|
455
|
+
if (f.preview) return preview("connectRequests.create", {}, body);
|
|
456
|
+
try {
|
|
457
|
+
const req = await c.connectRequests.create(body);
|
|
458
|
+
const opts = outputOpts(f);
|
|
459
|
+
if (opts.json) renderSuccess(req, opts, process);
|
|
460
|
+
else {
|
|
461
|
+
process.stdout.write(`Link: ${req.url ?? ""}
|
|
462
|
+
Expires: ${req.expires_at ?? ""}
|
|
463
|
+
Request: ${req.id ?? ""}
|
|
464
|
+
`);
|
|
465
|
+
}
|
|
466
|
+
process.stderr.write(`${CONNECT_REQUEST_INSTRUCTION}
|
|
467
|
+
Check on it: curviate account connect-request get ${req.id ?? "<request_id>"}
|
|
468
|
+
`);
|
|
469
|
+
} catch (err) {
|
|
470
|
+
await fail(err, f);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
async function runGet(c, f) {
|
|
474
|
+
const id = requestId(f);
|
|
475
|
+
try {
|
|
476
|
+
renderSuccess(readableObject(await c.connectRequests.get(id)), outputOpts(f), process);
|
|
477
|
+
} catch (err) {
|
|
478
|
+
await fail(err, f);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
async function runCancel(c, f) {
|
|
482
|
+
const id = requestId(f);
|
|
483
|
+
if (f.preview) return preview("connectRequests.cancel", { requestId: id });
|
|
484
|
+
try {
|
|
485
|
+
renderSuccess(readableObject(await c.connectRequests.cancel(id)), outputOpts(f), process);
|
|
486
|
+
} catch (err) {
|
|
487
|
+
await fail(err, f);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
var ID = { type: "positional", description: "Connect request id (creq_...)." };
|
|
491
|
+
var createCmd = defineCommand3({
|
|
492
|
+
meta: {
|
|
493
|
+
name: "create",
|
|
494
|
+
description: "Ask a person to connect a new LinkedIn account, or with --reconnect to reconnect one, without handing you any credential. Prints the link to give them; they connect in their own Curviate dashboard, where the request is also listed. The link expires if it is not opened in time. AI agents: never ask for, read or pass a LinkedIn password, cookies or verification codes. Use this instead.",
|
|
495
|
+
risk: "write",
|
|
496
|
+
rules: {
|
|
497
|
+
changes: "Creates a pending connect request and a link. Nothing is connected until the person completes it.",
|
|
498
|
+
visible_to: "Your Team: the person it is for sees it listed under Accounts in their dashboard.",
|
|
499
|
+
budget_rows: [],
|
|
500
|
+
retry: "Not safe: a repeated call creates a second request. Read `curviate account connect-request get <request_id>` first.",
|
|
501
|
+
undo: "`curviate account connect-request cancel <request_id>`."
|
|
502
|
+
},
|
|
503
|
+
errors: {
|
|
504
|
+
ACCOUNT_NOT_FOUND: "--reconnect names an account that is unknown, archived or another Team's.",
|
|
505
|
+
INSUFFICIENT_ROLE: "your role cannot operate the account you named.",
|
|
506
|
+
ACCOUNT_NOT_SHARED: "the account you named is not shared with you."
|
|
507
|
+
},
|
|
508
|
+
seeAlso: ["curviate account connect-request get", "curviate account connect-request cancel"],
|
|
509
|
+
examples: ["curviate account connect-request create", "curviate account connect-request create --no-warm-up", "curviate account connect-request create --reconnect acc_YOUR_ACCOUNT_ID"]
|
|
510
|
+
},
|
|
511
|
+
args: {
|
|
512
|
+
...WRITE_SINGLE_FLAGS,
|
|
513
|
+
reconnect: { type: "string", description: "Reconnect this account (acc_...) instead of connecting a new one." },
|
|
514
|
+
"warm-up": { type: "boolean", description: "--no-warm-up: the new account skips the ramp (its first weeks at lower limits) once the person connects it. A new connect only. Default on." }
|
|
515
|
+
},
|
|
516
|
+
run: online2(runCreate)
|
|
517
|
+
});
|
|
518
|
+
var getCmd = defineCommand3({
|
|
519
|
+
meta: {
|
|
520
|
+
name: "get",
|
|
521
|
+
description: "Read a connect request: pending, completed (with the connected account_id), expired, failed or cancelled. Poll it until it leaves pending.",
|
|
522
|
+
risk: "read",
|
|
523
|
+
output: ["The request: status, and account_id once completed. Never a credential, code or the step the person is on."],
|
|
524
|
+
examples: ["curviate account connect-request get creq_YOUR_REQUEST_ID"]
|
|
525
|
+
},
|
|
526
|
+
args: { ...readOnly(READ_SINGLE_FLAGS), id: ID },
|
|
527
|
+
run: online2(runGet)
|
|
528
|
+
});
|
|
529
|
+
var cancelCmd = defineCommand3({
|
|
530
|
+
meta: {
|
|
531
|
+
name: "cancel",
|
|
532
|
+
description: "Cancel a pending connect request; its link stops working. A request that is no longer pending is refused.",
|
|
533
|
+
risk: "write",
|
|
534
|
+
rules: {
|
|
535
|
+
changes: "The request becomes cancelled and its link stops working.",
|
|
536
|
+
visible_to: "Your Team: it leaves the person's Accounts list.",
|
|
537
|
+
budget_rows: [],
|
|
538
|
+
retry: "Safe: cancelling a cancelled request answers the same request again.",
|
|
539
|
+
undo: "Cannot be undone; create a new request."
|
|
540
|
+
},
|
|
541
|
+
errors: {
|
|
542
|
+
CONNECT_REQUEST_NOT_PENDING: "the request is completed, expired or failed; the message names which.",
|
|
543
|
+
CONNECT_REQUEST_IN_USE: "the person is completing it right now; try again in a minute.",
|
|
544
|
+
RESOURCE_NOT_FOUND: "no such request, or it was removed a day after it ended."
|
|
545
|
+
},
|
|
546
|
+
examples: ["curviate account connect-request cancel creq_YOUR_REQUEST_ID"]
|
|
547
|
+
},
|
|
548
|
+
args: { ...WRITE_SINGLE_FLAGS, id: ID },
|
|
549
|
+
run: online2(runCancel)
|
|
550
|
+
});
|
|
551
|
+
var connectRequestCommand = defineCommand3({
|
|
552
|
+
meta: { name: "connect-request", description: "Connect a LinkedIn account without any credential passing through you: create a request, give the person its link, read it until done." },
|
|
553
|
+
subCommands: { create: createCmd, get: getCmd, cancel: cancelCmd },
|
|
554
|
+
async run() {
|
|
555
|
+
const { showHelp } = await import("./examples-DQSVIIXZ.js");
|
|
556
|
+
await showHelp(connectRequestCommand, ["curviate", "account", "connect-request"]);
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
|
|
184
560
|
// src/commands/account.ts
|
|
185
561
|
var PW_WARNING = (stdinFlag, envVar) => `Note: a value on the command line is visible to other processes via \`ps\` and saved in shell history; prefer \`${stdinFlag}\` or the ${envVar} env var.`;
|
|
186
562
|
var OPTIONAL_SECRET_WARNING = (envVar) => `Note: a value on the command line is visible to other processes via \`ps\` and saved in shell history; prefer the ${envVar} env var.`;
|
|
@@ -207,7 +583,7 @@ function resolveOutputOpts(flags) {
|
|
|
207
583
|
async function handleError(err, outOpts, out) {
|
|
208
584
|
const { CurviateError } = await import("@curviate/sdk");
|
|
209
585
|
if (err instanceof CurviateError) {
|
|
210
|
-
const { getExitCode } = await import("./exit-codes-
|
|
586
|
+
const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
|
|
211
587
|
renderError(err, outOpts, out);
|
|
212
588
|
process.exit(getExitCode(err));
|
|
213
589
|
}
|
|
@@ -240,6 +616,9 @@ async function runAccountList(client, flags, out) {
|
|
|
240
616
|
const result = await client.accounts.list(params);
|
|
241
617
|
readablePage(result);
|
|
242
618
|
renderSuccess(result, { ...outOpts, slim: slimAccountList }, out);
|
|
619
|
+
if (!isJsonMode(outOpts) && !result.items?.length && !cursor && flags["external-id"] === void 0) {
|
|
620
|
+
out.stderr.write("No Account connected: ask your user to connect one in the dashboard, or create a Connect request.\n");
|
|
621
|
+
}
|
|
243
622
|
}
|
|
244
623
|
} catch (err) {
|
|
245
624
|
await handleError(err, outOpts, out);
|
|
@@ -296,41 +675,36 @@ async function runAccountSeats(client, flags, out) {
|
|
|
296
675
|
}
|
|
297
676
|
const notices = renderNotices(result.notices);
|
|
298
677
|
if (notices) out.stdout.write(notices + "\n");
|
|
299
|
-
|
|
300
|
-
const safetyWarning = result.safety_warning;
|
|
301
|
-
if (typeof safetyWarning === "object" && safetyWarning !== null) {
|
|
302
|
-
body = `safety_warning: ${JSON.stringify(safetyWarning)}
|
|
303
|
-
${body}`;
|
|
304
|
-
}
|
|
678
|
+
const body = result.items.length === 0 ? "(no seats)" : result.items.map(renderSeatLineHuman).join("\n");
|
|
305
679
|
out.stdout.write(body + "\n");
|
|
306
680
|
}
|
|
307
681
|
function assertLocationFlags(flags, out, opts) {
|
|
308
|
-
const
|
|
682
|
+
const fail3 = (message) => {
|
|
309
683
|
out.stderr.write(`error: ${message}
|
|
310
684
|
`);
|
|
311
685
|
process.exit(2);
|
|
312
686
|
};
|
|
313
687
|
const named = ["country", "ip", "proxy-host"].filter((k) => flags[k] !== void 0);
|
|
314
|
-
for (const k of named) if (flags[k].trim() === "")
|
|
688
|
+
for (const k of named) if (flags[k].trim() === "") fail3(`--${k} was given an empty value.`);
|
|
315
689
|
if (named.length > 1) {
|
|
316
|
-
|
|
690
|
+
fail3(
|
|
317
691
|
`pass one location source, not ${named.map((k) => `--${k}`).join(" and ")}: ` + (named.includes("proxy-host") ? "your own proxy decides the location by itself." : "--ip overrides --country.")
|
|
318
692
|
);
|
|
319
693
|
}
|
|
320
694
|
if (named.length === 0 && opts.requireOne) {
|
|
321
|
-
|
|
695
|
+
fail3(
|
|
322
696
|
"choose where LinkedIn sees this account connecting from. Pass --country with the two-letter code of the country its owner normally signs in from (e.g. --country US), --ip with a public IPv4 address, or your own proxy with --proxy-host. Nothing was sent."
|
|
323
697
|
);
|
|
324
698
|
}
|
|
325
699
|
if (flags.country !== void 0 && !/^[a-z]{2}$/i.test(flags.country.trim())) {
|
|
326
|
-
|
|
700
|
+
fail3("--country takes a two-letter ISO 3166-1 country code, e.g. US or DE.");
|
|
327
701
|
}
|
|
328
702
|
if (flags["allow-country-fallback"] !== void 0) {
|
|
329
703
|
if (flags["proxy-host"] !== void 0) {
|
|
330
|
-
|
|
704
|
+
fail3("--allow-country-fallback applies to a managed location (--country or --ip), not to your own proxy; remove one.");
|
|
331
705
|
}
|
|
332
706
|
if (!opts.fallbackAlone && flags.country === void 0 && flags.ip === void 0) {
|
|
333
|
-
|
|
707
|
+
fail3("--allow-country-fallback applies to --country or --ip; pass one of them with it.");
|
|
334
708
|
}
|
|
335
709
|
}
|
|
336
710
|
}
|
|
@@ -340,6 +714,30 @@ function managedLocationBody(flags) {
|
|
|
340
714
|
...flags["allow-country-fallback"] !== void 0 ? { allow_country_fallback: flags["allow-country-fallback"] } : {}
|
|
341
715
|
};
|
|
342
716
|
}
|
|
717
|
+
var COOKIES_FILE_CUE = "Paste the export, then press Ctrl-D. It won't be shown.";
|
|
718
|
+
async function loadCookieExport(value, ctx) {
|
|
719
|
+
const stop = (message) => {
|
|
720
|
+
ctx.out.stderr.write(`error: ${message}
|
|
721
|
+
`);
|
|
722
|
+
return process.exit(2);
|
|
723
|
+
};
|
|
724
|
+
let text;
|
|
725
|
+
if (isStdinToken(value)) {
|
|
726
|
+
text = ctx.isTTY ? await ctx.readToEof(COOKIES_FILE_CUE) : await ctx.readStdin();
|
|
727
|
+
} else {
|
|
728
|
+
try {
|
|
729
|
+
if (statSync(value).isDirectory()) throw new Error("directory");
|
|
730
|
+
text = readFileSync(value, "utf8");
|
|
731
|
+
} catch {
|
|
732
|
+
return stop(`--cookies-file: cannot read ${value}.`);
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
const parsed = parseCookieExport(text, ctx.now());
|
|
736
|
+
if (!parsed.ok) return stop(cookieExportMessage(parsed));
|
|
737
|
+
for (const note of parsed.notes) ctx.out.stderr.write(`note: ${note}
|
|
738
|
+
`);
|
|
739
|
+
return { li_at: parsed.liAt, ...parsed.liA !== void 0 ? { li_a: parsed.liA } : {} };
|
|
740
|
+
}
|
|
343
741
|
async function buildAuthBody(flags, ctx) {
|
|
344
742
|
const body = {};
|
|
345
743
|
if (flags["auth-method"]) body["auth_method"] = flags["auth-method"];
|
|
@@ -358,7 +756,7 @@ async function buildAuthBody(flags, ctx) {
|
|
|
358
756
|
}
|
|
359
757
|
}
|
|
360
758
|
if (flags["external-id"] !== void 0) body["external_id"] = flags["external-id"];
|
|
361
|
-
if (flags
|
|
759
|
+
if (flags["warm-up"] === false) body["warm_up"] = false;
|
|
362
760
|
if (flags.products !== void 0) {
|
|
363
761
|
const products = flags.products.split(",").map((p) => p.trim()).filter(Boolean);
|
|
364
762
|
if (products.length === 0 || products.some((p) => p !== "sales_navigator" && p !== "recruiter")) {
|
|
@@ -401,7 +799,8 @@ async function buildAuthBody(flags, ctx) {
|
|
|
401
799
|
};
|
|
402
800
|
}
|
|
403
801
|
}
|
|
404
|
-
if (
|
|
802
|
+
if (ctx.cookieExport) body["cookie"] = ctx.cookieExport;
|
|
803
|
+
if (flags["auth-method"] === "cookie" && flags["cookies-file"] === void 0) {
|
|
405
804
|
const liAt = await resolveSecret({
|
|
406
805
|
flagValue: flags["li-at"],
|
|
407
806
|
stdinRequested: flags["li-at-stdin"],
|
|
@@ -461,6 +860,7 @@ function resolveCredentialIO(io) {
|
|
|
461
860
|
// readlineSync itself writes its `prompt` argument to stderr too, the
|
|
462
861
|
// cue text would otherwise print twice on a real terminal.
|
|
463
862
|
readSingleLine: io.readSingleLine ?? (() => readlineSync("", { mask: true })),
|
|
863
|
+
readToEof: io.readToEof ?? ((cue) => readHiddenToEof(cue)),
|
|
464
864
|
sleep: io.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms))),
|
|
465
865
|
now: io.now ?? (() => Date.now()),
|
|
466
866
|
open: io.open ?? defaultOpen
|
|
@@ -470,6 +870,9 @@ function printConnected(result, ctx) {
|
|
|
470
870
|
const r = result;
|
|
471
871
|
ctx.out.stderr.write(`Account ${ctx.successVerb}: ${r.account_id ?? ""}
|
|
472
872
|
`);
|
|
873
|
+
if (r.contract_selected === false) {
|
|
874
|
+
ctx.out.stderr.write("note: the account is connected, but the Recruiter contract you named was not selected. Check the account in your dashboard.\n");
|
|
875
|
+
}
|
|
473
876
|
renderSuccess(result, ctx.outOpts, ctx.out);
|
|
474
877
|
}
|
|
475
878
|
function printInvalidCodeRetryHint(err, out) {
|
|
@@ -478,7 +881,11 @@ function printInvalidCodeRetryHint(err, out) {
|
|
|
478
881
|
out.stderr.write(`${message}
|
|
479
882
|
`);
|
|
480
883
|
}
|
|
884
|
+
function isCheckpointExpired(err, CurviateError) {
|
|
885
|
+
return err instanceof CurviateError && err.code === "CHECKPOINT_EXPIRED";
|
|
886
|
+
}
|
|
481
887
|
async function waitForMobileApproval(client, accountId, expiresAt, ctx) {
|
|
888
|
+
const { CurviateError } = await import("@curviate/sdk");
|
|
482
889
|
const startedAt = ctx.now();
|
|
483
890
|
const timeoutAt = expiresAt ? new Date(expiresAt).getTime() : startedAt + 10 * 6e4;
|
|
484
891
|
await ctx.sleep(CHECKPOINT_POLL_FIRST_DELAY_MS);
|
|
@@ -488,37 +895,78 @@ async function waitForMobileApproval(client, accountId, expiresAt, ctx) {
|
|
|
488
895
|
result = await client.auth.pollCheckpoint(accountId);
|
|
489
896
|
readableObject(result);
|
|
490
897
|
} catch (err) {
|
|
898
|
+
if (isCheckpointExpired(err, CurviateError)) return { kind: "terminal_failure", status: "expired" };
|
|
491
899
|
return await handleError(err, ctx.outOpts, ctx.out);
|
|
492
900
|
}
|
|
493
901
|
const status = result.status;
|
|
494
902
|
if (status === "active") return { kind: "active", result };
|
|
495
|
-
if (status === "
|
|
496
|
-
|
|
497
|
-
}
|
|
903
|
+
if (status === "checkpoint_required") return { kind: "chained", result: { ...result, account_id: result.account_id ?? accountId } };
|
|
904
|
+
if (status === "failed") return { kind: "terminal_failure", status };
|
|
498
905
|
const n = ctx.now();
|
|
499
906
|
if (n >= timeoutAt) return { kind: "timeout" };
|
|
500
907
|
await ctx.sleep(nextCheckpointPollDelayMs(n - startedAt));
|
|
501
908
|
}
|
|
502
909
|
}
|
|
910
|
+
function phoneCode(input) {
|
|
911
|
+
const m = /^\(\+(\d{1,3})\)([\d\s-]+)$/.exec(input.trim());
|
|
912
|
+
const rest = m?.[2]?.replace(/[\s-]/g, "") ?? "";
|
|
913
|
+
return m && rest.length >= 4 ? `(+${m[1]})${rest}` : void 0;
|
|
914
|
+
}
|
|
503
915
|
async function runInteractiveCheckpointLoop(client, initial, ctx) {
|
|
504
916
|
const { CurviateError } = await import("@curviate/sdk");
|
|
505
917
|
let current = initial;
|
|
506
918
|
for (; ; ) {
|
|
507
919
|
const challengeType = current.challenge_type;
|
|
508
920
|
const accountId = current.account_id ?? "";
|
|
509
|
-
if (
|
|
921
|
+
if (challengeType === "challenge_selection" || challengeType === "contract_selection") {
|
|
510
922
|
readableObject(current);
|
|
511
923
|
renderSuccess(current, ctx.outOpts, ctx.out);
|
|
512
924
|
ctx.out.stderr.write(
|
|
513
|
-
`Choose how LinkedIn verifies this sign-in: curviate account checkpoint request ${accountId} --challenge <id> (an id from challenges).
|
|
925
|
+
challengeType === "challenge_selection" ? `Choose how LinkedIn verifies this sign-in: curviate account checkpoint request ${accountId} --challenge <id> (an id from challenges).
|
|
926
|
+
` : `Choose the contract to send from: curviate account checkpoint solve ${accountId} --code <id> (an id from contracts).
|
|
514
927
|
`
|
|
515
928
|
);
|
|
516
929
|
process.exit(AUTH_NEEDED);
|
|
517
930
|
return;
|
|
518
931
|
}
|
|
519
|
-
printChallengeCopy(challengeType, ctx.out);
|
|
932
|
+
printChallengeCopy(challengeType, ctx.out, current.channel);
|
|
520
933
|
printResendHintIfApplicable(challengeType, accountId, ctx.out);
|
|
521
|
-
|
|
934
|
+
printAnotherWayHintIfApplicable(challengeType, accountId, ctx.out);
|
|
935
|
+
let wait = challengeType === "mobile_app_approval" || challengeType === "checking";
|
|
936
|
+
if (!wait) {
|
|
937
|
+
for (; ; ) {
|
|
938
|
+
const either = challengeType === "otp_or_mobile_app_approval";
|
|
939
|
+
const prompt = challengeType === "phone_register" ? "Mobile number, as (+CC)number: " : either ? "Enter the code (or press Enter once you approved in the app): " : "Enter the code: ";
|
|
940
|
+
const typed = (await ctx.readline(prompt)).trim();
|
|
941
|
+
if (either && typed === "") {
|
|
942
|
+
wait = true;
|
|
943
|
+
break;
|
|
944
|
+
}
|
|
945
|
+
const code = challengeType === "phone_register" ? phoneCode(typed) : typed;
|
|
946
|
+
if (code === void 0) {
|
|
947
|
+
ctx.out.stderr.write("That is not a number in the form (+CC)number, for example (+49)1701234567.\n");
|
|
948
|
+
continue;
|
|
949
|
+
}
|
|
950
|
+
try {
|
|
951
|
+
const result = await client.auth.solveCheckpoint(accountId, { code });
|
|
952
|
+
const r = result;
|
|
953
|
+
if (r.status === "checkpoint_required") {
|
|
954
|
+
current = { ...r, account_id: r.account_id ?? accountId };
|
|
955
|
+
break;
|
|
956
|
+
}
|
|
957
|
+
printConnected(result, { out: ctx.out, outOpts: ctx.outOpts, successVerb: ctx.successVerb });
|
|
958
|
+
return;
|
|
959
|
+
} catch (err) {
|
|
960
|
+
if (err instanceof CurviateError && err.code === "CHECKPOINT_INVALID_CODE") {
|
|
961
|
+
printInvalidCodeRetryHint(err, ctx.out);
|
|
962
|
+
continue;
|
|
963
|
+
}
|
|
964
|
+
if (isCheckpointExpired(err, CurviateError)) return expiredExit(ctx.out);
|
|
965
|
+
await handleError(err, ctx.outOpts, ctx.out);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
if (wait) {
|
|
522
970
|
const outcome = await waitForMobileApproval(client, accountId, current.expires_at, {
|
|
523
971
|
out: ctx.out,
|
|
524
972
|
outOpts: ctx.outOpts,
|
|
@@ -529,11 +977,14 @@ async function runInteractiveCheckpointLoop(client, initial, ctx) {
|
|
|
529
977
|
printConnected(outcome.result, { out: ctx.out, outOpts: ctx.outOpts, successVerb: ctx.successVerb });
|
|
530
978
|
return;
|
|
531
979
|
}
|
|
980
|
+
if (outcome.kind === "chained") {
|
|
981
|
+
current = outcome.result;
|
|
982
|
+
continue;
|
|
983
|
+
}
|
|
532
984
|
if (outcome.kind === "terminal_failure") {
|
|
533
|
-
ctx.out
|
|
534
|
-
|
|
535
|
-
`
|
|
536
|
-
);
|
|
985
|
+
if (outcome.status === "expired") return expiredExit(ctx.out);
|
|
986
|
+
ctx.out.stderr.write(`This checkpoint has ${outcome.status}. Run the connect command again to restart.
|
|
987
|
+
`);
|
|
537
988
|
process.exit(9);
|
|
538
989
|
return;
|
|
539
990
|
}
|
|
@@ -544,27 +995,12 @@ async function runInteractiveCheckpointLoop(client, initial, ctx) {
|
|
|
544
995
|
process.exit(AUTH_NEEDED);
|
|
545
996
|
return;
|
|
546
997
|
}
|
|
547
|
-
for (; ; ) {
|
|
548
|
-
const code = await ctx.readline("Enter the code: ");
|
|
549
|
-
try {
|
|
550
|
-
const result = await client.auth.solveCheckpoint(accountId, { code });
|
|
551
|
-
const r = result;
|
|
552
|
-
if (r.status === "checkpoint_required") {
|
|
553
|
-
current = { ...r, account_id: r.account_id ?? accountId };
|
|
554
|
-
break;
|
|
555
|
-
}
|
|
556
|
-
printConnected(result, { out: ctx.out, outOpts: ctx.outOpts, successVerb: ctx.successVerb });
|
|
557
|
-
return;
|
|
558
|
-
} catch (err) {
|
|
559
|
-
if (err instanceof CurviateError && err.code === "CHECKPOINT_INVALID_CODE") {
|
|
560
|
-
printInvalidCodeRetryHint(err, ctx.out);
|
|
561
|
-
continue;
|
|
562
|
-
}
|
|
563
|
-
await handleError(err, ctx.outOpts, ctx.out);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
998
|
}
|
|
567
999
|
}
|
|
1000
|
+
function expiredExit(out) {
|
|
1001
|
+
out.stderr.write("This sign-in timed out (the checkpoint expired). Run the connect command again to start over.\n");
|
|
1002
|
+
return process.exit(9);
|
|
1003
|
+
}
|
|
568
1004
|
async function handleAccountConnectResult(client, result, ctx) {
|
|
569
1005
|
const envelope = result;
|
|
570
1006
|
if (envelope?.status !== "checkpoint_required") {
|
|
@@ -633,8 +1069,23 @@ async function soleFreeSeat(client, out, outOpts) {
|
|
|
633
1069
|
return seatId;
|
|
634
1070
|
}
|
|
635
1071
|
async function runAccountLink(client, flags, out, io = {}) {
|
|
1072
|
+
const cookiesFile = flags["cookies-file"];
|
|
1073
|
+
if (cookiesFile !== void 0) {
|
|
1074
|
+
if (cookiesFile.trim() === "") {
|
|
1075
|
+
out.stderr.write("error: --cookies-file was given an empty value. Pass the path of the Cookie-Editor JSON export, or - to read it from stdin.\n");
|
|
1076
|
+
process.exit(2);
|
|
1077
|
+
}
|
|
1078
|
+
const clash = ["li-at", "li-at-stdin", "li-a", "email", "password", "password-stdin"].find((k) => flags[k] !== void 0 && flags[k] !== false);
|
|
1079
|
+
const named = clash ? `--${clash}` : flags["auth-method"] === "credentials" ? "--auth-method credentials" : void 0;
|
|
1080
|
+
if (named) {
|
|
1081
|
+
out.stderr.write(`error: --cookies-file cannot be combined with ${named}: the export carries the session cookies, so pass one source.
|
|
1082
|
+
`);
|
|
1083
|
+
process.exit(2);
|
|
1084
|
+
}
|
|
1085
|
+
flags = { ...flags, "auth-method": "cookie" };
|
|
1086
|
+
}
|
|
636
1087
|
if (!flags["auth-method"]) {
|
|
637
|
-
out.stderr.write("error: --auth-method is required for account link (credentials | cookie).\n");
|
|
1088
|
+
out.stderr.write("error: --auth-method is required for account link (credentials | cookie), or pass --cookies-file.\n");
|
|
638
1089
|
process.exit(2);
|
|
639
1090
|
}
|
|
640
1091
|
if (flags["account-id"] !== void 0 && flags["account-id"].trim() === "") {
|
|
@@ -643,8 +1094,18 @@ async function runAccountLink(client, flags, out, io = {}) {
|
|
|
643
1094
|
);
|
|
644
1095
|
process.exit(2);
|
|
645
1096
|
}
|
|
1097
|
+
if (flags["warm-up"] === false && flags["account-id"] !== void 0) {
|
|
1098
|
+
out.stderr.write("error: --no-warm-up applies to a new connect. A connected account's ramp is switched with `curviate account warm-up`.\n");
|
|
1099
|
+
process.exit(2);
|
|
1100
|
+
}
|
|
646
1101
|
checkCredentialConflicts(flags, out);
|
|
647
|
-
if (!flags.preview &&
|
|
1102
|
+
if (!flags.preview && cookiesFile !== void 0 && !flags["user-agent"]) {
|
|
1103
|
+
out.stderr.write(
|
|
1104
|
+
"error: --user-agent is required with --cookies-file. Pass --user-agent with the exact user agent of the browser you exported from. In that browser's console, run navigator.userAgent.\n"
|
|
1105
|
+
);
|
|
1106
|
+
process.exit(2);
|
|
1107
|
+
}
|
|
1108
|
+
if (!flags.preview && cookiesFile === void 0 && flags["auth-method"] === "cookie" && !flags["user-agent"]) {
|
|
648
1109
|
out.stderr.write(
|
|
649
1110
|
"error: --user-agent is required when --auth-method=cookie. Pass the User-Agent string of the browser the li_at cookie was copied from; the cookie only works paired with it.\n"
|
|
650
1111
|
);
|
|
@@ -658,6 +1119,10 @@ async function runAccountLink(client, flags, out, io = {}) {
|
|
|
658
1119
|
);
|
|
659
1120
|
process.exit(2);
|
|
660
1121
|
}
|
|
1122
|
+
const resolvedIo = resolveCredentialIO(io);
|
|
1123
|
+
const pasteExport = cookiesFile !== void 0 && isStdinToken(cookiesFile) && resolvedIo.isTTY;
|
|
1124
|
+
const exportCtx = { out, isTTY: resolvedIo.isTTY, readStdin: resolvedIo.readStdin, readToEof: resolvedIo.readToEof, now: resolvedIo.now };
|
|
1125
|
+
let cookieExport = cookiesFile !== void 0 && !pasteExport ? await loadCookieExport(cookiesFile, exportCtx) : void 0;
|
|
661
1126
|
let seatId = flags["seat-id"];
|
|
662
1127
|
if (!seatId) {
|
|
663
1128
|
if (flags.preview) {
|
|
@@ -674,8 +1139,9 @@ async function runAccountLink(client, flags, out, io = {}) {
|
|
|
674
1139
|
}
|
|
675
1140
|
seatId = await soleFreeSeat(client, out, outOpts);
|
|
676
1141
|
}
|
|
677
|
-
|
|
1142
|
+
if (pasteExport && !flags.preview) cookieExport = await loadCookieExport(cookiesFile, exportCtx);
|
|
678
1143
|
const authBody = await buildAuthBody(flags, {
|
|
1144
|
+
cookieExport,
|
|
679
1145
|
out,
|
|
680
1146
|
isTTY: resolvedIo.isTTY,
|
|
681
1147
|
readline: resolvedIo.readline,
|
|
@@ -692,8 +1158,8 @@ async function runAccountLink(client, flags, out, io = {}) {
|
|
|
692
1158
|
...flags["account-id"] ? { account_id: flags["account-id"] } : {}
|
|
693
1159
|
};
|
|
694
1160
|
if (flags.preview) {
|
|
695
|
-
const
|
|
696
|
-
out.stdout.write(JSON.stringify(
|
|
1161
|
+
const preview2 = buildPreviewOutput({ method: "auth.intent", args: {}, body });
|
|
1162
|
+
out.stdout.write(JSON.stringify(preview2) + "\n");
|
|
697
1163
|
return;
|
|
698
1164
|
}
|
|
699
1165
|
let result;
|
|
@@ -757,8 +1223,8 @@ async function runAccountConnectSessionPoll(client, flags, out, io = {}) {
|
|
|
757
1223
|
const sessionId = flags.session;
|
|
758
1224
|
const outOpts = resolveOutputOpts(flags);
|
|
759
1225
|
if (flags.preview) {
|
|
760
|
-
const
|
|
761
|
-
out.stdout.write(JSON.stringify(
|
|
1226
|
+
const preview2 = buildPreviewOutput({ method: "auth.getSession", args: { session_id: sessionId }, body: {} });
|
|
1227
|
+
out.stdout.write(JSON.stringify(preview2) + "\n");
|
|
762
1228
|
return;
|
|
763
1229
|
}
|
|
764
1230
|
if (!flags.wait) {
|
|
@@ -841,6 +1307,7 @@ async function runAccountUpdate(client, flags, out) {
|
|
|
841
1307
|
}
|
|
842
1308
|
assertLocationFlags(flags, out, { requireOne: false, fallbackAlone: true });
|
|
843
1309
|
Object.assign(body, managedLocationBody(flags));
|
|
1310
|
+
if (flags["save-connections-as-contacts"] !== void 0) body["save_connections_as_contacts"] = flags["save-connections-as-contacts"];
|
|
844
1311
|
if (flags["proxy-host"]) {
|
|
845
1312
|
const proxyPassword = await resolveSecret({
|
|
846
1313
|
flagValue: flags["proxy-password"],
|
|
@@ -857,12 +1324,12 @@ async function runAccountUpdate(client, flags, out) {
|
|
|
857
1324
|
}
|
|
858
1325
|
const outOpts = resolveOutputOpts(flags);
|
|
859
1326
|
if (flags.preview) {
|
|
860
|
-
const
|
|
1327
|
+
const preview2 = buildPreviewOutput({
|
|
861
1328
|
method: "accounts.update",
|
|
862
1329
|
args: { accountId },
|
|
863
1330
|
body
|
|
864
1331
|
});
|
|
865
|
-
out.stdout.write(JSON.stringify(
|
|
1332
|
+
out.stdout.write(JSON.stringify(preview2) + "\n");
|
|
866
1333
|
return;
|
|
867
1334
|
}
|
|
868
1335
|
try {
|
|
@@ -876,12 +1343,12 @@ async function runAccountDisconnect(client, flags, out) {
|
|
|
876
1343
|
const accountId = requireAccountId(flags, out);
|
|
877
1344
|
const outOpts = resolveOutputOpts(flags);
|
|
878
1345
|
if (flags.preview) {
|
|
879
|
-
const
|
|
1346
|
+
const preview2 = buildPreviewOutput({
|
|
880
1347
|
method: "accounts.disconnect",
|
|
881
1348
|
args: { accountId },
|
|
882
1349
|
body: {}
|
|
883
1350
|
});
|
|
884
|
-
out.stdout.write(JSON.stringify(
|
|
1351
|
+
out.stdout.write(JSON.stringify(preview2) + "\n");
|
|
885
1352
|
return;
|
|
886
1353
|
}
|
|
887
1354
|
try {
|
|
@@ -900,12 +1367,12 @@ async function runAccountCheckpointSolve(client, flags, out) {
|
|
|
900
1367
|
const body = { code: flags.code };
|
|
901
1368
|
const outOpts = resolveOutputOpts(flags);
|
|
902
1369
|
if (flags.preview) {
|
|
903
|
-
const
|
|
1370
|
+
const preview2 = buildPreviewOutput({
|
|
904
1371
|
method: "auth.solveCheckpoint",
|
|
905
1372
|
args: { accountId },
|
|
906
1373
|
body
|
|
907
1374
|
});
|
|
908
|
-
out.stdout.write(JSON.stringify(
|
|
1375
|
+
out.stdout.write(JSON.stringify(preview2) + "\n");
|
|
909
1376
|
return;
|
|
910
1377
|
}
|
|
911
1378
|
let chained = false;
|
|
@@ -928,12 +1395,12 @@ async function runAccountCheckpointRequest(client, flags, out) {
|
|
|
928
1395
|
const outOpts = resolveOutputOpts(flags);
|
|
929
1396
|
const body = flags.challenge !== void 0 ? { challenge: flags.challenge } : void 0;
|
|
930
1397
|
if (flags.preview) {
|
|
931
|
-
const
|
|
1398
|
+
const preview2 = buildPreviewOutput({
|
|
932
1399
|
method: "auth.requestCheckpoint",
|
|
933
1400
|
args: { accountId },
|
|
934
1401
|
body: body ?? {}
|
|
935
1402
|
});
|
|
936
|
-
out.stdout.write(JSON.stringify(
|
|
1403
|
+
out.stdout.write(JSON.stringify(preview2) + "\n");
|
|
937
1404
|
return;
|
|
938
1405
|
}
|
|
939
1406
|
let chained = false;
|
|
@@ -957,14 +1424,20 @@ async function runCheckpointPollWaitLoop(client, accountId, ctx) {
|
|
|
957
1424
|
const startedAt = ctx.now();
|
|
958
1425
|
let timeoutAt = ctx.timeoutOverrideMs !== void 0 ? startedAt + ctx.timeoutOverrideMs : void 0;
|
|
959
1426
|
await ctx.sleep(CHECKPOINT_POLL_FIRST_DELAY_MS);
|
|
1427
|
+
const { CurviateError } = await import("@curviate/sdk");
|
|
960
1428
|
for (; ; ) {
|
|
961
|
-
|
|
1429
|
+
let result;
|
|
1430
|
+
try {
|
|
1431
|
+
result = await client.auth.pollCheckpoint(accountId);
|
|
1432
|
+
} catch (err) {
|
|
1433
|
+
if (isCheckpointExpired(err, CurviateError)) return { kind: "terminal_failure", status: "expired", result: { status: "expired" } };
|
|
1434
|
+
throw err;
|
|
1435
|
+
}
|
|
962
1436
|
readableObject(result);
|
|
963
1437
|
const r = result;
|
|
964
1438
|
if (r.status === "active") return { kind: "active", result };
|
|
965
|
-
if (r.status === "
|
|
966
|
-
|
|
967
|
-
}
|
|
1439
|
+
if (r.status === "checkpoint_required") return { kind: "chained", result };
|
|
1440
|
+
if (r.status === "failed") return { kind: "terminal_failure", status: r.status, result };
|
|
968
1441
|
if (timeoutAt === void 0) {
|
|
969
1442
|
const expiresAtMs = r.expires_at ? new Date(r.expires_at).getTime() : NaN;
|
|
970
1443
|
timeoutAt = Number.isNaN(expiresAtMs) ? startedAt + 10 * 6e4 : expiresAtMs;
|
|
@@ -972,7 +1445,7 @@ async function runCheckpointPollWaitLoop(client, accountId, ctx) {
|
|
|
972
1445
|
const n = ctx.now();
|
|
973
1446
|
if (n >= timeoutAt) return { kind: "timeout", result };
|
|
974
1447
|
if (ctx.showTicker) {
|
|
975
|
-
ctx.out.stderr.write(`\rWaiting for
|
|
1448
|
+
ctx.out.stderr.write(`\rWaiting for LinkedIn... ${formatRemaining(timeoutAt - n)} remaining`);
|
|
976
1449
|
}
|
|
977
1450
|
await ctx.sleep(nextCheckpointPollDelayMs(n - startedAt));
|
|
978
1451
|
}
|
|
@@ -981,12 +1454,12 @@ async function runAccountCheckpointPoll(client, flags, out, io = {}) {
|
|
|
981
1454
|
const accountId = requireAccountId(flags, out);
|
|
982
1455
|
const outOpts = resolveOutputOpts(flags);
|
|
983
1456
|
if (flags.preview) {
|
|
984
|
-
const
|
|
1457
|
+
const preview2 = buildPreviewOutput({
|
|
985
1458
|
method: "auth.pollCheckpoint",
|
|
986
1459
|
args: { accountId },
|
|
987
1460
|
body: {}
|
|
988
1461
|
});
|
|
989
|
-
out.stdout.write(JSON.stringify(
|
|
1462
|
+
out.stdout.write(JSON.stringify(preview2) + "\n");
|
|
990
1463
|
return;
|
|
991
1464
|
}
|
|
992
1465
|
if (!flags.wait) {
|
|
@@ -1020,7 +1493,19 @@ async function runAccountCheckpointPoll(client, flags, out, io = {}) {
|
|
|
1020
1493
|
printConnected(outcome.result, { out, outOpts, successVerb: "linked" });
|
|
1021
1494
|
return;
|
|
1022
1495
|
}
|
|
1496
|
+
if (outcome.kind === "chained") {
|
|
1497
|
+
renderSuccess(outcome.result, outOpts, out);
|
|
1498
|
+
out.stderr.write(`LinkedIn asks for another step. Answer it: curviate account checkpoint solve ${accountId} --code <code> (see challenge_type).
|
|
1499
|
+
`);
|
|
1500
|
+
process.exit(AUTH_NEEDED);
|
|
1501
|
+
return;
|
|
1502
|
+
}
|
|
1023
1503
|
if (outcome.kind === "terminal_failure") {
|
|
1504
|
+
if (outcome.status === "expired") {
|
|
1505
|
+
out.stderr.write("This sign-in timed out (the checkpoint expired). Start over: curviate account link --auth-method <m> --country <CC>, or add --account-id <acc_...> to reconnect an existing account.\n");
|
|
1506
|
+
process.exit(9);
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1024
1509
|
renderSuccess(outcome.result, outOpts, out);
|
|
1025
1510
|
out.stderr.write(`This checkpoint has ${outcome.status}. Start over: curviate account link --auth-method <m> --country <CC>, or add --account-id <acc_...> to reconnect an existing account.
|
|
1026
1511
|
`);
|
|
@@ -1034,10 +1519,11 @@ async function runAccountCheckpointPoll(client, flags, out, io = {}) {
|
|
|
1034
1519
|
);
|
|
1035
1520
|
process.exit(AUTH_NEEDED);
|
|
1036
1521
|
}
|
|
1037
|
-
var accountListCommand =
|
|
1522
|
+
var accountListCommand = defineCommand4({
|
|
1038
1523
|
meta: {
|
|
1039
1524
|
name: "list",
|
|
1040
1525
|
description: "List connected LinkedIn accounts.",
|
|
1526
|
+
risk: "read",
|
|
1041
1527
|
examples: [
|
|
1042
1528
|
"curviate account list",
|
|
1043
1529
|
"curviate account list --json --fields items.account_id,items.status",
|
|
@@ -1065,10 +1551,11 @@ var accountListCommand = defineCommand({
|
|
|
1065
1551
|
await runAccountList(client, flags, out);
|
|
1066
1552
|
}
|
|
1067
1553
|
});
|
|
1068
|
-
var accountGetCommand =
|
|
1554
|
+
var accountGetCommand = defineCommand4({
|
|
1069
1555
|
meta: {
|
|
1070
1556
|
name: "get",
|
|
1071
1557
|
description: "Get a connected LinkedIn account: its status (active, reconnect_needed, restricted, connecting or disconnected) and its per-action quotas. --verbose adds cached profile fields, which may be null.",
|
|
1558
|
+
risk: "read",
|
|
1072
1559
|
examples: [
|
|
1073
1560
|
"curviate account get acc_YOUR_ACCOUNT_ID"
|
|
1074
1561
|
]
|
|
@@ -1095,10 +1582,11 @@ var accountGetCommand = defineCommand({
|
|
|
1095
1582
|
await runAccountGet(client, flags, out);
|
|
1096
1583
|
}
|
|
1097
1584
|
});
|
|
1098
|
-
var accountSeatsCommand =
|
|
1585
|
+
var accountSeatsCommand = defineCommand4({
|
|
1099
1586
|
meta: {
|
|
1100
1587
|
name: "seats",
|
|
1101
1588
|
description: "List the workspace's live seats and whether each is free or bound to an account. A seat with occupied:false (free) is a seat_id `curviate account link --seat-id` accepts right now. Not paginated (bounded by purchased seats), --all is not supported. An empty result can mean the workspace has no seats, or that billing needs attention.",
|
|
1589
|
+
risk: "read",
|
|
1102
1590
|
examples: [
|
|
1103
1591
|
"curviate account seats"
|
|
1104
1592
|
]
|
|
@@ -1121,17 +1609,29 @@ var accountSeatsCommand = defineCommand({
|
|
|
1121
1609
|
await runAccountSeats(client, flags, out);
|
|
1122
1610
|
}
|
|
1123
1611
|
});
|
|
1124
|
-
var accountLinkCommand =
|
|
1612
|
+
var accountLinkCommand = defineCommand4({
|
|
1125
1613
|
meta: {
|
|
1126
1614
|
name: "link",
|
|
1127
|
-
description: "Connect a LinkedIn account to an empty seat. If LinkedIn requires verification you'll be prompted for the code interactively. Given --auth-method and its credentials, a non-interactive shell exits 12 at that step and you finish with `curviate account checkpoint solve <account_id> --code`.",
|
|
1615
|
+
description: "Connect a LinkedIn account to an empty seat. AI agents: do not read, pass or ask for passwords, cookies or cookie exports; run `curviate account connect-request create` and hand the person its link instead. --cookies-file takes an export of a live LinkedIn session; delete it after use. If LinkedIn requires verification you'll be prompted for the code interactively. Given --auth-method and its credentials, a non-interactive shell exits 12 at that step and you finish with `curviate account checkpoint solve <account_id> --code`.",
|
|
1616
|
+
risk: "high",
|
|
1617
|
+
rules: {
|
|
1618
|
+
changes: "Connects a LinkedIn account to a seat, signing in with the credentials or session cookies you pass; with --account-id, signs an existing Account in again.",
|
|
1619
|
+
visible_to: "Your Team gets the Account to operate; LinkedIn sees a sign-in from the chosen location.",
|
|
1620
|
+
budget_rows: [],
|
|
1621
|
+
retry: "Not safe for a new connect: each success takes another seat. Read `curviate account list` first.",
|
|
1622
|
+
undo: "`curviate account disconnect <account_id>` disconnects it and releases the seat.",
|
|
1623
|
+
blast_radius: "One LinkedIn account and one seat."
|
|
1624
|
+
},
|
|
1625
|
+
errors: { NO_ACTIVE_SEAT: "no seat is free.", ACCOUNT_ALREADY_LINKED: "this LinkedIn account is already connected: reconnect it with --account-id.", CONNECTION_IN_PROGRESS: "a connect for this seat is still running.", LINKEDIN_AUTH_FAILED: "LinkedIn did not accept the credentials or cookies.", CONNECTION_LOCATION_REQUIRED: "a new connect named no location." },
|
|
1626
|
+
seeAlso: ["curviate account seats", "curviate account connect-request create", "curviate account checkpoint solve"],
|
|
1128
1627
|
examples: [
|
|
1129
1628
|
"curviate account link --auth-method credentials --email jane@example.com --password-stdin --country US",
|
|
1130
|
-
"curviate account link --auth-method credentials --email jane@example.com --password-stdin --account-id acc_YOUR_ACCOUNT_ID --seat-id SEAT_ID"
|
|
1629
|
+
"curviate account link --auth-method credentials --email jane@example.com --password-stdin --account-id acc_YOUR_ACCOUNT_ID --seat-id SEAT_ID",
|
|
1630
|
+
'curviate account link --cookies-file linkedin-cookies.json --user-agent "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36" --country US'
|
|
1131
1631
|
],
|
|
1132
1632
|
requires: [
|
|
1133
1633
|
"Exactly one of --country, --ip or --proxy-host on a new connect; a reconnect (--account-id) may omit it to keep the account's location.",
|
|
1134
|
-
"--user-agent with --auth-method cookie.",
|
|
1634
|
+
"--user-agent with --auth-method cookie or --cookies-file.",
|
|
1135
1635
|
"--seat-id with --preview or --account-id, and when zero or several seats are free.",
|
|
1136
1636
|
"--password-stdin only with --auth-method credentials; --li-at-stdin only with --auth-method cookie."
|
|
1137
1637
|
]
|
|
@@ -1139,7 +1639,8 @@ var accountLinkCommand = defineCommand({
|
|
|
1139
1639
|
args: {
|
|
1140
1640
|
...WRITE_SINGLE_FLAGS,
|
|
1141
1641
|
"seat-id": { type: "string", description: "Empty seat to bind the account to, listed by `curviate account seats` (a free seat there is one this call accepts right now). Omit it and the only free seat is used; with zero or several free the command says so and connects nothing. Required with --preview (which calls nothing) and with --account-id (a reconnect keeps the seat that account already holds)." },
|
|
1142
|
-
"auth-method": { type: "string", description: "Authentication method: credentials | cookie.
|
|
1642
|
+
"auth-method": { type: "string", description: "Authentication method: credentials | cookie. Not needed with --cookies-file, which implies cookie." },
|
|
1643
|
+
"cookies-file": { type: "string", stdinArg: true, description: "The Cookie-Editor JSON export of a signed-in linkedin.com tab: a path, or - to read it from stdin (on a terminal: paste, then Ctrl-D; nothing is shown). The file holds a live LinkedIn session: delete it after use. Only li_at and li_a are sent. Needs --user-agent. Not with --li-at, --li-at-stdin, --li-a, --email, --password or --password-stdin." },
|
|
1143
1644
|
email: { type: "string", description: "LinkedIn email (credentials method)." },
|
|
1144
1645
|
password: { type: "string", description: `LinkedIn password (credentials method). ${PW_WARNING("--password-stdin", "CURVIATE_LINKEDIN_PASSWORD")}` },
|
|
1145
1646
|
"password-stdin": { type: "boolean", description: "Read the LinkedIn password from stdin (one line, trimmed).", default: false },
|
|
@@ -1155,11 +1656,12 @@ var accountLinkCommand = defineCommand({
|
|
|
1155
1656
|
"proxy-username": { type: "string", description: "Proxy auth username." },
|
|
1156
1657
|
"proxy-password": { type: "string", description: `Proxy auth password. ${OPTIONAL_SECRET_WARNING("CURVIATE_PROXY_PASSWORD")}` },
|
|
1157
1658
|
"user-agent": { type: "string", description: "Browser User-Agent to pin for this account. Required with --auth-method cookie: a session cookie only works paired with the User-Agent of the browser it was copied from, and the command exits 2 without it. Optional with --auth-method credentials, where it is still pinned for the account when given." },
|
|
1158
|
-
"recruiter-contract-id": { type: "string", description: "Recruiter contract to
|
|
1659
|
+
"recruiter-contract-id": { type: "string", description: "Recruiter contract to select once the account is connected, so a connected account may still have none selected: `contract_selected: false` in the answer means connected, not selected. Only meaningful when the LinkedIn account holds a Recruiter subscription." },
|
|
1159
1660
|
"linkedin-premium": { type: "string", description: "Narrow this connection to one LinkedIn premium surface: sales_navigator | recruiter. Omit it and the connect asks for every product and LinkedIn activates what the account holds. Applies to THIS call only and is never remembered, so restate it on every connect and reconnect where Recruiter must win." },
|
|
1160
1661
|
products: { type: "string", description: "Comma-separated premium products to ask for: sales_navigator, recruiter. Omit to ask for both (--linkedin-premium still narrows). Classic LinkedIn and company pages are always included." },
|
|
1161
1662
|
"external-id": { type: "string", description: "Your own id for this account's end user (1-255 chars, not unique). Returned on the account and every account webhook; filter with `curviate account list --external-id`. Use an opaque id, not an email." },
|
|
1162
|
-
timezone: { type: "string", description: "
|
|
1663
|
+
timezone: { type: "string", description: "Ignored: the account's time zone follows its connection location. Accepted so existing scripts keep working; nothing is sent." },
|
|
1664
|
+
"warm-up": { type: "boolean", description: "--no-warm-up skips the ramp a new account starts on (its first weeks at lower limits). A new connect only; for a connected account use `curviate account warm-up`. Default on." },
|
|
1163
1665
|
"account-id": { type: "string", description: "Existing account id (acc_...) to re-authenticate IN PLACE. Passing it makes this an in-place reconnect of that account. Omit to connect a NEW account into --seat-id." },
|
|
1164
1666
|
"no-interactive": {
|
|
1165
1667
|
type: "boolean",
|
|
@@ -1184,10 +1686,19 @@ var accountLinkCommand = defineCommand({
|
|
|
1184
1686
|
await runAccountLink(client, flags, out);
|
|
1185
1687
|
}
|
|
1186
1688
|
});
|
|
1187
|
-
var accountConnectSessionPollCommand =
|
|
1689
|
+
var accountConnectSessionPollCommand = defineCommand4({
|
|
1188
1690
|
meta: {
|
|
1189
1691
|
name: "poll",
|
|
1190
1692
|
description: "Poll the status of an in-progress connect (auth intent) for completion. Without --wait: a single poll. The JSON `status` field (pending | resolved | expired | failed) tells you what to do next. With --wait: block on the same adaptive cadence as `curviate account link` until a terminal state.",
|
|
1693
|
+
risk: "write",
|
|
1694
|
+
rules: {
|
|
1695
|
+
changes: "Asks for the status of a connect that is still running; with --wait, keeps asking until it ends.",
|
|
1696
|
+
visible_to: "Your Team; a connect that finishes makes the Account available.",
|
|
1697
|
+
budget_rows: [],
|
|
1698
|
+
retry: "Safe: it only asks again.",
|
|
1699
|
+
undo: "Nothing to undo; a connected Account is released with `curviate account disconnect <account_id>`."
|
|
1700
|
+
},
|
|
1701
|
+
errors: { CONNECTION_IN_PROGRESS: "the connect has not ended yet." },
|
|
1191
1702
|
examples: [
|
|
1192
1703
|
"curviate account connect-session poll --session acc_YOUR_ACCOUNT_ID",
|
|
1193
1704
|
"curviate account connect-session poll --session acc_YOUR_ACCOUNT_ID --wait"
|
|
@@ -1230,7 +1741,7 @@ var accountConnectSessionPollCommand = defineCommand({
|
|
|
1230
1741
|
await runAccountConnectSessionPoll(client, flags, out);
|
|
1231
1742
|
}
|
|
1232
1743
|
});
|
|
1233
|
-
var accountConnectSessionCommand =
|
|
1744
|
+
var accountConnectSessionCommand = defineCommand4({
|
|
1234
1745
|
meta: { name: "connect-session", description: "In-progress connect operations (poll for completion)." },
|
|
1235
1746
|
subCommands: {
|
|
1236
1747
|
poll: accountConnectSessionPollCommand
|
|
@@ -1239,10 +1750,19 @@ var accountConnectSessionCommand = defineCommand({
|
|
|
1239
1750
|
process.stderr.write("Usage: curviate account connect-session poll --session <session_id>\n");
|
|
1240
1751
|
}
|
|
1241
1752
|
});
|
|
1242
|
-
var accountUpdateCommand =
|
|
1753
|
+
var accountUpdateCommand = defineCommand4({
|
|
1243
1754
|
meta: {
|
|
1244
1755
|
name: "update",
|
|
1245
|
-
description: "Update an account's metadata, connection location or
|
|
1756
|
+
description: "Update an account's metadata, connection location, own proxy or whether its Connections are saved as Contacts. Prints the updated account, with connection_location re-read after a location change.",
|
|
1757
|
+
risk: "write",
|
|
1758
|
+
rules: {
|
|
1759
|
+
changes: "Changes the Account's metadata, connection location, own proxy or Save Connections as Contacts.",
|
|
1760
|
+
visible_to: "Your Team; LinkedIn sees the new location and may ask the owner to verify.",
|
|
1761
|
+
budget_rows: [],
|
|
1762
|
+
retry: "Safe: the same values written again leave the Account the same.",
|
|
1763
|
+
undo: "Run it again with the previous values; metadata is replaced wholesale and the old map is not kept."
|
|
1764
|
+
},
|
|
1765
|
+
errors: { ACCOUNT_NOT_FOUND: "the Account is not in your Team.", CONNECTION_LOCATION_UNAVAILABLE: "no connection is free in that country." },
|
|
1246
1766
|
examples: [
|
|
1247
1767
|
`curviate account update acc_YOUR_ACCOUNT_ID --metadata '{"team":"growth"}'`,
|
|
1248
1768
|
"curviate account update acc_YOUR_ACCOUNT_ID --country DE",
|
|
@@ -1260,7 +1780,8 @@ var accountUpdateCommand = defineCommand({
|
|
|
1260
1780
|
"proxy-host": { type: "string", description: "Your own proxy's host or IP. Not accepted with --country." },
|
|
1261
1781
|
"proxy-port": { type: "string", description: "Proxy port." },
|
|
1262
1782
|
"proxy-username": { type: "string", description: "Proxy auth username." },
|
|
1263
|
-
"proxy-password": { type: "string", description: `Proxy auth password. ${OPTIONAL_SECRET_WARNING("CURVIATE_PROXY_PASSWORD")}` }
|
|
1783
|
+
"proxy-password": { type: "string", description: `Proxy auth password. ${OPTIONAL_SECRET_WARNING("CURVIATE_PROXY_PASSWORD")}` },
|
|
1784
|
+
"save-connections-as-contacts": { type: "boolean", description: "Save this account's Connections as Contacts (Automate; on by default): each person becomes one Contact in your team, do-not-contact people skipped. Turning it on also saves the Connections already synced; --no-save-connections-as-contacts stops it and keeps the Contacts saved so far." }
|
|
1264
1785
|
},
|
|
1265
1786
|
async run({ args }) {
|
|
1266
1787
|
const flags = args;
|
|
@@ -1279,7 +1800,7 @@ var accountUpdateCommand = defineCommand({
|
|
|
1279
1800
|
await runAccountUpdate(client, flags, out);
|
|
1280
1801
|
}
|
|
1281
1802
|
});
|
|
1282
|
-
var accountDisconnectCommand =
|
|
1803
|
+
var accountDisconnectCommand = defineCommand4({
|
|
1283
1804
|
meta: {
|
|
1284
1805
|
name: "disconnect",
|
|
1285
1806
|
description: "Hard-disconnect a LinkedIn account and release its seat.",
|
|
@@ -1319,10 +1840,19 @@ var accountDisconnectCommand = defineCommand({
|
|
|
1319
1840
|
await runAccountDisconnect(client, flags, out);
|
|
1320
1841
|
}
|
|
1321
1842
|
});
|
|
1322
|
-
var accountCheckpointSolveCommand =
|
|
1843
|
+
var accountCheckpointSolveCommand = defineCommand4({
|
|
1323
1844
|
meta: {
|
|
1324
1845
|
name: "solve",
|
|
1325
1846
|
description: "Solve a checkpoint challenge with an OTP / 2FA code.",
|
|
1847
|
+
risk: "write",
|
|
1848
|
+
rules: {
|
|
1849
|
+
changes: "Sends the verification code for the Account's pending checkpoint; on success the Account connects.",
|
|
1850
|
+
visible_to: "LinkedIn, and your Team once the Account is connected.",
|
|
1851
|
+
budget_rows: [],
|
|
1852
|
+
retry: "Read `curviate account get <account_id>` first: a wrong code counts against the attempts the checkpoint allows.",
|
|
1853
|
+
undo: "Nothing to undo; disconnect with `curviate account disconnect <account_id>`."
|
|
1854
|
+
},
|
|
1855
|
+
errors: { CHECKPOINT_NOT_FOUND: "the Account has no pending checkpoint.", CHECKPOINT_EXPIRED: "the checkpoint expired: connect again.", CHECKPOINT_INVALID_CODE: "the code was not accepted.", CHECKPOINT_MAX_ATTEMPTS: "too many wrong codes: connect again.", CHECKPOINT_ALREADY_RESOLVED: "the checkpoint is already resolved." },
|
|
1326
1856
|
examples: [
|
|
1327
1857
|
"curviate account checkpoint solve acc_YOUR_ACCOUNT_ID --code 123456"
|
|
1328
1858
|
]
|
|
@@ -1356,10 +1886,19 @@ var accountCheckpointSolveCommand = defineCommand({
|
|
|
1356
1886
|
await runAccountCheckpointSolve(client, flags, out);
|
|
1357
1887
|
}
|
|
1358
1888
|
});
|
|
1359
|
-
var accountCheckpointPollCommand =
|
|
1889
|
+
var accountCheckpointPollCommand = defineCommand4({
|
|
1360
1890
|
meta: {
|
|
1361
1891
|
name: "poll",
|
|
1362
1892
|
description: "Poll for mobile-app approval of a pending checkpoint challenge. With --wait, blocks on an adaptive cadence until a terminal state (or --timeout elapses) instead of a single poll.",
|
|
1893
|
+
risk: "write",
|
|
1894
|
+
rules: {
|
|
1895
|
+
changes: "Asks LinkedIn whether the mobile-app approval has happened; with --wait, keeps asking until it ends.",
|
|
1896
|
+
visible_to: "LinkedIn, and your Team once the Account is connected.",
|
|
1897
|
+
budget_rows: [],
|
|
1898
|
+
retry: "Safe: it only asks again.",
|
|
1899
|
+
undo: "Nothing to undo; disconnect with `curviate account disconnect <account_id>`."
|
|
1900
|
+
},
|
|
1901
|
+
errors: { CHECKPOINT_NOT_FOUND: "the Account has no pending checkpoint.", CHECKPOINT_EXPIRED: "the checkpoint expired: connect again." },
|
|
1363
1902
|
examples: [
|
|
1364
1903
|
"curviate account checkpoint poll acc_YOUR_ACCOUNT_ID",
|
|
1365
1904
|
"curviate account checkpoint poll acc_YOUR_ACCOUNT_ID --wait"
|
|
@@ -1401,10 +1940,19 @@ var accountCheckpointPollCommand = defineCommand({
|
|
|
1401
1940
|
await runAccountCheckpointPoll(client, flags, out);
|
|
1402
1941
|
}
|
|
1403
1942
|
});
|
|
1404
|
-
var accountCheckpointRequestCommand =
|
|
1943
|
+
var accountCheckpointRequestCommand = defineCommand4({
|
|
1405
1944
|
meta: {
|
|
1406
1945
|
name: "request",
|
|
1407
1946
|
description: "Re-request the challenge notification for a pending checkpoint (e.g. re-send an OTP email, SMS code, or mobile-app approval push). Not every challenge type supports it; an authenticator- app code has nothing to re-send. The response's `resent` boolean tells you honestly whether a new notification actually went out; the command still exits 0 either way. With --challenge it instead answers a challenge_selection checkpoint by picking the verification method.",
|
|
1947
|
+
risk: "write",
|
|
1948
|
+
rules: {
|
|
1949
|
+
changes: "Asks LinkedIn to send the challenge notification again, or with --challenge picks the verification method.",
|
|
1950
|
+
visible_to: "The Account's owner, who receives a new code or push.",
|
|
1951
|
+
budget_rows: [],
|
|
1952
|
+
retry: "A repeat sends another notification; the answer's `resent` says whether one went out.",
|
|
1953
|
+
undo: "Cannot be undone: the notification is sent."
|
|
1954
|
+
},
|
|
1955
|
+
errors: { CHECKPOINT_NOT_FOUND: "the Account has no pending checkpoint.", CHECKPOINT_EXPIRED: "the checkpoint expired: connect again.", CHECKPOINT_UNSUPPORTED: "this challenge cannot be re-sent." },
|
|
1408
1956
|
examples: [
|
|
1409
1957
|
"curviate account checkpoint request acc_YOUR_ACCOUNT_ID",
|
|
1410
1958
|
"curviate account checkpoint request acc_YOUR_ACCOUNT_ID --challenge sms"
|
|
@@ -1438,7 +1986,7 @@ var accountCheckpointRequestCommand = defineCommand({
|
|
|
1438
1986
|
await runAccountCheckpointRequest(client, flags, out);
|
|
1439
1987
|
}
|
|
1440
1988
|
});
|
|
1441
|
-
var accountCheckpointCommand =
|
|
1989
|
+
var accountCheckpointCommand = defineCommand4({
|
|
1442
1990
|
meta: {
|
|
1443
1991
|
name: "checkpoint",
|
|
1444
1992
|
description: "Checkpoint challenge operations (solve with an OTP, poll mobile-app approval, or re-request the challenge notification)."
|
|
@@ -1452,21 +2000,25 @@ var accountCheckpointCommand = defineCommand({
|
|
|
1452
2000
|
process.stderr.write("Usage: curviate account checkpoint solve <account_id> --code <code> | poll <account_id> | request <account_id>\n");
|
|
1453
2001
|
}
|
|
1454
2002
|
});
|
|
1455
|
-
var accountCommand =
|
|
2003
|
+
var accountCommand = defineCommand4({
|
|
1456
2004
|
meta: { name: "account", description: DESCRIPTIONS.account },
|
|
1457
2005
|
subCommands: {
|
|
1458
2006
|
list: accountListCommand,
|
|
1459
2007
|
get: accountGetCommand,
|
|
1460
2008
|
seats: accountSeatsCommand,
|
|
1461
2009
|
link: accountLinkCommand,
|
|
2010
|
+
"connect-request": connectRequestCommand,
|
|
1462
2011
|
"connect-session": accountConnectSessionCommand,
|
|
1463
2012
|
update: accountUpdateCommand,
|
|
1464
2013
|
disconnect: accountDisconnectCommand,
|
|
1465
|
-
checkpoint: accountCheckpointCommand
|
|
2014
|
+
checkpoint: accountCheckpointCommand,
|
|
2015
|
+
overview: accountOverviewCommand,
|
|
2016
|
+
metrics: accountMetricsCommand,
|
|
2017
|
+
"warm-up": accountWarmUpCommand
|
|
1466
2018
|
},
|
|
1467
2019
|
async run() {
|
|
1468
2020
|
process.stderr.write(
|
|
1469
|
-
"Usage: curviate account <subcommand>\n list | get | seats | link | connect-session poll | update | disconnect | checkpoint\n"
|
|
2021
|
+
"Usage: curviate account <subcommand>\n list | get | seats | link | connect-request | connect-session poll | update | disconnect | checkpoint | overview | metrics | warm-up\n"
|
|
1470
2022
|
);
|
|
1471
2023
|
}
|
|
1472
2024
|
});
|