@curviate/cli 0.49.0 → 0.50.0-next.1
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 +26 -0
- package/README.md +12 -5
- package/dist/{account-2BH2Q6VG.js → account-U7UJIE3H.js} +784 -116
- package/dist/analytics-MZU2WKON.js +27 -0
- package/dist/beta-consent-67IDUV3K.js +81 -0
- package/dist/billing-QAW75YE7.js +124 -0
- package/dist/{chunk-RXWODUWA.js → chunk-2W4RN5ON.js} +18 -2
- package/dist/{chunk-MGB6FE4A.js → chunk-3Z6PXS6N.js} +6 -6
- package/dist/chunk-5S3MJVI5.js +22 -0
- package/dist/{chunk-V7FJWTZW.js → chunk-6LBOGIVE.js} +4 -4
- package/dist/{chunk-Z7OQSWBD.js → chunk-6PLDAEMO.js} +85 -10
- package/dist/chunk-73DJ3KNE.js +54 -0
- package/dist/{chunk-3RCW7URJ.js → chunk-A57ZILRU.js} +1 -1
- package/dist/chunk-AVI7J47S.js +52 -0
- package/dist/{chunk-JYKYD57J.js → chunk-CKVCBGQX.js} +1 -1
- package/dist/chunk-EIA66ESN.js +339 -0
- 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-PQWDDSV7.js → chunk-L7JH3W56.js} +1 -1
- package/dist/chunk-LCPPXOPN.js +528 -0
- package/dist/chunk-LRMPS4UQ.js +144 -0
- package/dist/{chunk-5ZGTU4VD.js → chunk-LULN3II2.js} +78 -5
- package/dist/chunk-PPGKQJKU.js +38 -0
- package/dist/chunk-Q3ZPRFUX.js +20 -0
- package/dist/{chunk-SA2QHAXG.js → chunk-QM57YDJE.js} +13 -201
- package/dist/{chunk-Y7MZZRYR.js → chunk-RYWWSZUH.js} +14 -2
- package/dist/{chunk-TEAWYLPO.js → chunk-TYNVJDYK.js} +49 -18
- package/dist/cli.js +34 -18
- package/dist/{comment-MRDPDA33.js → comment-6NRZILAS.js} +90 -11
- package/dist/{company-2AEHSGHA.js → company-VXE7IEPT.js} +65 -15
- package/dist/{config-NRBKHXES.js → config-3WP7OD35.js} +53 -4
- package/dist/{connect-4XEBV5V3.js → connect-FBK6UWZP.js} +63 -18
- package/dist/contact-HFPZ3KGL.js +32 -0
- package/dist/contact-groups-AI4MLGQS.js +399 -0
- package/dist/contact-import-54Y7EMU2.js +336 -0
- package/dist/core-RLMWMQEI.js +46 -0
- package/dist/do-not-contact-LQ5V6SPE.js +200 -0
- package/dist/{doctor-BZ4DA7DV.js → doctor-KKRL7TEF.js} +65 -11
- package/dist/{document-RKHRWXNT.js → document-GFRWPQFV.js} +1 -1
- package/dist/{draft-C5N6EOO5.js → draft-VSWZOCDR.js} +60 -14
- package/dist/{enrollment-BNQOUKI7.js → enrollment-OACCSBM5.js} +31 -19
- package/dist/{examples-NIMSIXMV.js → examples-JJB4DZKK.js} +2 -2
- package/dist/{exit-codes-TLMKTLRI.js → exit-codes-7DBETBDT.js} +1 -1
- package/dist/export-AQHAFVAB.js +96 -0
- package/dist/{feed-DFUU7SUJ.js → feed-HY4HT75U.js} +13 -10
- package/dist/{group-CSD2OWOZ.js → group-A3SMBFU5.js} +18 -10
- package/dist/{inbox-SNSPWI7J.js → inbox-YHUO2RPI.js} +31 -12
- package/dist/{inboxes-RIRHPS4H.js → inboxes-GKLMHPDR.js} +14 -10
- package/dist/incoming-NHROOOIZ.js +218 -0
- package/dist/{job-6PNXXZNF.js → job-QBW3PGWL.js} +65 -13
- package/dist/{login-Y7JBAHCW.js → login-GWIYHKYO.js} +13 -4
- package/dist/{message-2IK4MBBG.js → message-BFLN2VHS.js} +9 -7
- package/dist/{motion-7ATUXO6R.js → motion-LTWU2GPC.js} +39 -117
- package/dist/network-CNSBX2SR.js +235 -0
- package/dist/{notification-VYK5NDEB.js → notification-DCCFJPXU.js} +38 -11
- package/dist/notifications-AQBXBK4K.js +231 -0
- package/dist/{post-AN6T2OJF.js → post-PINZHSPS.js} +92 -12
- package/dist/{profile-UQY64642.js → profile-MJQJSNYR.js} +76 -20
- package/dist/{recruiter-OY4RN5HH.js → recruiter-X6GX4A2G.js} +133 -22
- package/dist/{sales-nav-KLODLYMW.js → sales-nav-44GYWDYE.js} +74 -19
- package/dist/{search-NWP5S6CF.js → search-SULIN6TB.js} +55 -23
- package/dist/{setup-YPPFLH2N.js → setup-ZQRHMRMB.js} +69 -17
- package/dist/team-TM6LRUY5.js +450 -0
- package/dist/tier-Z3U6AT7H.js +61 -0
- package/dist/unibox-BIMI2KY5.js +402 -0
- package/dist/{webhook-OHKBL3YS.js → webhook-EHXRTHBG.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,385 @@ 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-EIA66ESN.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-3Z6PXS6N.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-LRMPS4UQ.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-LULN3II2.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
|
-
|
|
67
|
+
parseDocument,
|
|
68
|
+
readFileFlag
|
|
69
|
+
} from "./chunk-TYNVJDYK.js";
|
|
70
|
+
import "./chunk-FDJMAF7D.js";
|
|
71
|
+
import {
|
|
72
|
+
defaultReadStdin,
|
|
73
|
+
isStdinToken
|
|
49
74
|
} from "./chunk-ZYURL5VK.js";
|
|
75
|
+
import {
|
|
76
|
+
AUTH_NEEDED
|
|
77
|
+
} from "./chunk-2W4RN5ON.js";
|
|
50
78
|
|
|
51
|
-
// src/commands/account.ts
|
|
79
|
+
// src/commands/account-insights.ts
|
|
52
80
|
import { defineCommand } from "citty";
|
|
81
|
+
async function runOverview(c, f) {
|
|
82
|
+
const q = { ...windowParams(f), ...grammarParams(f) };
|
|
83
|
+
if (f.motions !== void 0) q["motion_id"] = listFlag("motions", f.motions);
|
|
84
|
+
if (f.origin !== void 0) q["origin"] = listFlag("origin", f.origin);
|
|
85
|
+
try {
|
|
86
|
+
const body = await c.accounts.overview(String(f.accountId ?? ""), q);
|
|
87
|
+
return outputOpts(f).json ? renderSuccess(body, outputOpts(f), process) : renderOverview(body);
|
|
88
|
+
} catch (err) {
|
|
89
|
+
await fail(err, f);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async function runMetrics(c, f) {
|
|
93
|
+
const { from, to, timezone } = windowParams(f);
|
|
94
|
+
try {
|
|
95
|
+
const body = await c.accounts.metrics(String(f.accountId ?? ""), { from, to, timezone });
|
|
96
|
+
if (outputOpts(f).json) return renderSuccess(body, outputOpts(f), process);
|
|
97
|
+
print(table(
|
|
98
|
+
["DATE", "CONNECTIONS", "FOLLOWERS", "VIEWERS 90D", "SEARCH/WEEK", "POST IMPR 7D", "SSI"],
|
|
99
|
+
(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"]])
|
|
100
|
+
));
|
|
101
|
+
} catch (err) {
|
|
102
|
+
await fail(err, f);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
var online = (fn) => async ({ args }) => {
|
|
106
|
+
const f = args;
|
|
107
|
+
await fn(await rootClient(f), f);
|
|
108
|
+
};
|
|
109
|
+
var ACCOUNT_ID = { type: "positional", description: "The Account (acc_...)." };
|
|
110
|
+
var accountOverviewCommand = defineCommand({
|
|
111
|
+
meta: {
|
|
112
|
+
name: "overview",
|
|
113
|
+
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.",
|
|
114
|
+
risk: "read",
|
|
115
|
+
output: ["A compact table by default; --json (or piped) prints the API body."],
|
|
116
|
+
seeAlso: ["curviate account metrics", "curviate analytics get"],
|
|
117
|
+
examples: ["curviate account overview acc_YOUR_ACCOUNT_ID", "curviate account overview acc_YOUR_ACCOUNT_ID --range 90d --compare previous_period"]
|
|
118
|
+
},
|
|
119
|
+
args: {
|
|
120
|
+
...readOnly(READ_SINGLE_FLAGS),
|
|
121
|
+
accountId: ACCOUNT_ID,
|
|
122
|
+
...WINDOW_ARGS,
|
|
123
|
+
motions: { type: "string", description: "Only these Motions, comma list (mot_...)." },
|
|
124
|
+
origin: { type: "string", description: "Who sent the actions: a comma list of motion, unibox, api; direct is an alias for unibox and api." },
|
|
125
|
+
...GRAMMAR_ARGS
|
|
126
|
+
},
|
|
127
|
+
run: online(runOverview)
|
|
128
|
+
});
|
|
129
|
+
var accountMetricsCommand = defineCommand({
|
|
130
|
+
meta: {
|
|
131
|
+
name: "metrics",
|
|
132
|
+
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.",
|
|
133
|
+
risk: "read",
|
|
134
|
+
examples: ["curviate account metrics acc_YOUR_ACCOUNT_ID --from 2026-10-01 --to 2026-10-28"]
|
|
135
|
+
},
|
|
136
|
+
args: {
|
|
137
|
+
...readOnly(READ_SINGLE_FLAGS),
|
|
138
|
+
accountId: ACCOUNT_ID,
|
|
139
|
+
from: { type: "string", description: "First day, YYYY-MM-DD, inclusive, in --timezone." },
|
|
140
|
+
to: { type: "string", description: "Last day, YYYY-MM-DD, inclusive, in --timezone." },
|
|
141
|
+
timezone: WINDOW_ARGS.timezone
|
|
142
|
+
},
|
|
143
|
+
run: online(runMetrics)
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// src/commands/account-warm-up.ts
|
|
147
|
+
import { defineCommand as defineCommand2 } from "citty";
|
|
148
|
+
async function run(f, enabled) {
|
|
149
|
+
const accountId = String(f.accountId ?? "");
|
|
150
|
+
if (f.preview) {
|
|
151
|
+
process.stdout.write(JSON.stringify(buildPreviewOutput({ method: "accounts.updateSafetyPolicy", args: { accountId }, body: { warm_up: { enabled } } })) + "\n");
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const c = await rootClient(f);
|
|
155
|
+
try {
|
|
156
|
+
const policy = await c.accounts.updateSafetyPolicy(accountId, { warm_up: { enabled } });
|
|
157
|
+
if (outputOpts(f).json) return renderSuccess(policy, outputOpts(f), process);
|
|
158
|
+
const w = policy.warm_up ?? {};
|
|
159
|
+
process.stdout.write(`Warm-up ${w.enabled ? "on" : "off"} for ${accountId}: state ${w.state ?? "unknown"}, factor ${w.factor ?? "unknown"}${w.dormant ? ", dormant" : ""}.
|
|
160
|
+
`);
|
|
161
|
+
} catch (err) {
|
|
162
|
+
await fail(err, f);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
var switchCommand = (name) => defineCommand2({
|
|
166
|
+
meta: {
|
|
167
|
+
name,
|
|
168
|
+
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.",
|
|
169
|
+
risk: "write",
|
|
170
|
+
rules: {
|
|
171
|
+
changes: `The Account's warm-up switch is set ${name}; every budget row's effective ceiling follows.`,
|
|
172
|
+
visible_to: "Everyone using this workspace's key. Nothing is posted on LinkedIn.",
|
|
173
|
+
budget_rows: [],
|
|
174
|
+
retry: "Safe to repeat: the switch ends in the same state.",
|
|
175
|
+
undo: `Run \`curviate account warm-up ${name === "on" ? "off" : "on"} <account>\`.`,
|
|
176
|
+
blast_radius: "One Account's pace."
|
|
177
|
+
},
|
|
178
|
+
seeAlso: ["curviate account get"],
|
|
179
|
+
examples: [`curviate account warm-up ${name} acc_YOUR_ACCOUNT_ID`]
|
|
180
|
+
},
|
|
181
|
+
args: { ...WRITE_SINGLE_FLAGS, accountId: { type: "positional", description: "The Account (acc_...)." } },
|
|
182
|
+
async run({ args }) {
|
|
183
|
+
await run(args, name === "on");
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
var accountWarmUpCommand = defineCommand2({
|
|
187
|
+
meta: { name: "warm-up", description: "Turn an Account's warm-up ramp on or off." },
|
|
188
|
+
subCommands: { on: switchCommand("on"), off: switchCommand("off") },
|
|
189
|
+
async run() {
|
|
190
|
+
process.stderr.write("Usage: curviate account warm-up on|off <account>\n");
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// src/commands/account-safety.ts
|
|
195
|
+
import { defineCommand as defineCommand3 } from "citty";
|
|
196
|
+
var ACCOUNT = { type: "positional", description: "The Account (acc_...)." };
|
|
197
|
+
var getCmd = defineCommand3({
|
|
198
|
+
meta: {
|
|
199
|
+
name: "get",
|
|
200
|
+
description: "One Account's safety policy: every budget row with its ceiling and effective_ceiling, Active hours, warm-up and pacing. A read: no LinkedIn call.",
|
|
201
|
+
risk: "read",
|
|
202
|
+
seeAlso: ["curviate account safety update", "curviate account get"],
|
|
203
|
+
examples: ["curviate account safety get acc_YOUR_ACCOUNT_ID", "curviate account safety get acc_YOUR_ACCOUNT_ID --fields active_hours,warm_up"]
|
|
204
|
+
},
|
|
205
|
+
args: { ...readOnly(READ_SINGLE_FLAGS), accountId: ACCOUNT },
|
|
206
|
+
async run({ args }) {
|
|
207
|
+
const f = args;
|
|
208
|
+
const c = await rootClient(f);
|
|
209
|
+
try {
|
|
210
|
+
renderSuccess(await c.accounts.getSafetyPolicy(String(f.accountId ?? "")), outputOpts(f), process);
|
|
211
|
+
} catch (err) {
|
|
212
|
+
await fail(err, f);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
var updateCmd = defineCommand3({
|
|
217
|
+
meta: {
|
|
218
|
+
name: "update",
|
|
219
|
+
description: 'Change one Account\'s safety policy from a JSON document: `rows`, for example {"rows":[{"budget_row":"profile_views","ceiling":40}]}, and `active_hours`, for example {"active_hours":{"days":["mon","tue"],"start":"09:00","end":"17:00"}}. Fields you leave out stay as they are; null clears an override. Prints the policy.',
|
|
220
|
+
risk: "write",
|
|
221
|
+
rules: {
|
|
222
|
+
changes: "The Account's limits or Active hours, from the next action on.",
|
|
223
|
+
visible_to: "Your Team. Nothing is posted on LinkedIn; a higher limit lets more actions reach it.",
|
|
224
|
+
budget_rows: [],
|
|
225
|
+
retry: "Safe: the same document leaves the same policy.",
|
|
226
|
+
undo: "Send the previous values, or null to fall back to the Team's default.",
|
|
227
|
+
blast_radius: "One Account's pace, in every Motion and every direct action."
|
|
228
|
+
},
|
|
229
|
+
errors: { INVALID_REQUEST: "a field is unknown or not settable; the message names it." },
|
|
230
|
+
seeAlso: ["curviate account safety get", "curviate account warm-up"],
|
|
231
|
+
examples: [
|
|
232
|
+
"curviate account safety update acc_YOUR_ACCOUNT_ID --file policy.json"
|
|
233
|
+
]
|
|
234
|
+
},
|
|
235
|
+
args: {
|
|
236
|
+
...WRITE_SINGLE_FLAGS,
|
|
237
|
+
accountId: ACCOUNT,
|
|
238
|
+
file: { type: "string", required: true, description: "The JSON document: a path, or - to read it from stdin." }
|
|
239
|
+
},
|
|
240
|
+
async run({ args }) {
|
|
241
|
+
const f = args;
|
|
242
|
+
const accountId = String(f.accountId ?? "");
|
|
243
|
+
const body = parseDocument("file", await readFileFlag("file", f.file ?? "", { others: f }));
|
|
244
|
+
if (f.preview) {
|
|
245
|
+
process.stdout.write(JSON.stringify(buildPreviewOutput({ method: "accounts.updateSafetyPolicy", args: { accountId }, body })) + "\n");
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const c = await rootClient(f);
|
|
249
|
+
try {
|
|
250
|
+
renderSuccess(await c.accounts.updateSafetyPolicy(accountId, body), outputOpts(f), process);
|
|
251
|
+
} catch (err) {
|
|
252
|
+
await fail(err, f);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
var accountSafetyCommand = defineCommand3({
|
|
257
|
+
meta: { name: "safety", description: "Read or change one Account's safety policy: limits per budget row and Active hours." },
|
|
258
|
+
subCommands: { get: getCmd, update: updateCmd },
|
|
259
|
+
async run() {
|
|
260
|
+
process.stderr.write("Usage: curviate account safety get|update <account>\n");
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
var accessCommand = (name) => defineCommand3({
|
|
264
|
+
meta: {
|
|
265
|
+
name,
|
|
266
|
+
description: name === "on" ? "Share the Account with its Team again (it does not rejoin a Motion). Only the person who connected it can." : "Keep the Account to its person: it leaves every Motion that held it and its queued enrichment visits are dropped. Only the person who connected it can.",
|
|
267
|
+
risk: "write",
|
|
268
|
+
rules: {
|
|
269
|
+
changes: name === "on" ? "The Team may use the Account again." : "The Team loses the Account; it leaves every Motion that held it.",
|
|
270
|
+
visible_to: "Your Team.",
|
|
271
|
+
budget_rows: [],
|
|
272
|
+
retry: "Safe to repeat: the switch ends in the same state.",
|
|
273
|
+
undo: name === "on" ? "Run `curviate account team-access off <account>`." : "Run `curviate account team-access on <account>`, then add it back to its Motions."
|
|
274
|
+
},
|
|
275
|
+
errors: { ACCOUNT_OWNER_ONLY: "only the person who connected the Account can change this." },
|
|
276
|
+
seeAlso: ["curviate account get", "curviate team members"],
|
|
277
|
+
examples: [`curviate account team-access ${name} acc_YOUR_ACCOUNT_ID`]
|
|
278
|
+
},
|
|
279
|
+
args: { ...WRITE_SINGLE_FLAGS, accountId: ACCOUNT },
|
|
280
|
+
async run({ args }) {
|
|
281
|
+
const f = args;
|
|
282
|
+
const accountId = String(f.accountId ?? "");
|
|
283
|
+
if (f.preview) {
|
|
284
|
+
process.stdout.write(JSON.stringify(buildPreviewOutput({ method: "accounts.setTeamAccess", args: { accountId }, body: { team_access: name === "on" } })) + "\n");
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
const c = await rootClient(f);
|
|
288
|
+
try {
|
|
289
|
+
renderSuccess(await c.accounts.setTeamAccess(accountId, name === "on"), outputOpts(f), process);
|
|
290
|
+
} catch (err) {
|
|
291
|
+
await fail(err, f);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
var accountTeamAccessCommand = defineCommand3({
|
|
296
|
+
meta: { name: "team-access", description: "Share an Account with its Team, or keep it to the person who connected it." },
|
|
297
|
+
subCommands: { on: accessCommand("on"), off: accessCommand("off") },
|
|
298
|
+
async run() {
|
|
299
|
+
process.stderr.write("Usage: curviate account team-access on|off <account>\n");
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// src/commands/account.ts
|
|
304
|
+
import { defineCommand as defineCommand5 } from "citty";
|
|
305
|
+
|
|
306
|
+
// src/lib/cookie-export.ts
|
|
307
|
+
var COOKIE_EXPORT_MAX_BYTES = 1024 * 1024;
|
|
308
|
+
var LI_A_EXPIRED_NOTE = "Your Sales Navigator or Recruiter session in this export has expired, so the account connects without it.";
|
|
309
|
+
function cookieExportMessage(r) {
|
|
310
|
+
switch (r.reason) {
|
|
311
|
+
case "empty":
|
|
312
|
+
return "Paste the export from Cookie-Editor.";
|
|
313
|
+
case "not_json":
|
|
314
|
+
return "This isn't a JSON export. In Cookie-Editor, click Export, choose JSON, and paste the result.";
|
|
315
|
+
case "not_array":
|
|
316
|
+
return "This JSON isn't a Cookie-Editor export. On linkedin.com, click Export in Cookie-Editor and choose JSON.";
|
|
317
|
+
case "no_li_at":
|
|
318
|
+
return "No LinkedIn session cookie (li_at) found. Sign in to linkedin.com in this browser, then export again.";
|
|
319
|
+
case "expired":
|
|
320
|
+
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.`;
|
|
321
|
+
case "too_large":
|
|
322
|
+
return "This export is too large. Export from a linkedin.com tab only.";
|
|
323
|
+
case "header_string":
|
|
324
|
+
return "This is the Header String export. In Cookie-Editor, click Export and choose JSON instead.";
|
|
325
|
+
case "netscape":
|
|
326
|
+
return "This is the Netscape export. In Cookie-Editor, click Export and choose JSON instead.";
|
|
327
|
+
case "other_site":
|
|
328
|
+
return "These cookies are from another website. Open a linkedin.com tab, then export from Cookie-Editor there.";
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
var fail2 = (reason, extra = {}) => ({ ok: false, reason, ...extra });
|
|
332
|
+
function expiryOf(c) {
|
|
333
|
+
const e = c["expirationDate"];
|
|
334
|
+
return c["session"] === true || typeof e !== "number" || !Number.isFinite(e) ? null : e;
|
|
335
|
+
}
|
|
336
|
+
function pick(cands, nowSec) {
|
|
337
|
+
const live = cands.filter((c) => c.expires === null || c.expires > nowSec);
|
|
338
|
+
const gone = cands.filter((c) => c.expires !== null && c.expires <= nowSec);
|
|
339
|
+
const rank = (c) => c.expires ?? -Infinity;
|
|
340
|
+
const latest = (xs) => xs.reduce((a, b) => a === void 0 || rank(b) > rank(a) ? b : a, void 0);
|
|
341
|
+
return { live: latest(live), expired: latest(gone) };
|
|
342
|
+
}
|
|
343
|
+
function parseCookieExport(raw, nowMs) {
|
|
344
|
+
const text = raw.replace(/^\uFEFF/, "").trim();
|
|
345
|
+
if (text === "") return fail2("empty");
|
|
346
|
+
if (/^#\s?Netscape HTTP Cookie File/i.test(text) || /^[^\t\n]*\t(TRUE|FALSE)\t/m.test(text)) return fail2("netscape");
|
|
347
|
+
if (Buffer.byteLength(text, "utf8") > COOKIE_EXPORT_MAX_BYTES) return fail2("too_large");
|
|
348
|
+
let json;
|
|
349
|
+
try {
|
|
350
|
+
json = JSON.parse(text);
|
|
351
|
+
} catch {
|
|
352
|
+
const pairs = text.split(";").map((s) => s.trim()).filter(Boolean);
|
|
353
|
+
return fail2(pairs.length >= 2 && pairs.every((p) => /^[^=\s]+=/.test(p)) ? "header_string" : "not_json");
|
|
354
|
+
}
|
|
355
|
+
if (!Array.isArray(json)) return fail2("not_array");
|
|
356
|
+
const nowSec = nowMs / 1e3;
|
|
357
|
+
const linkedin = json.filter((e) => {
|
|
358
|
+
if (e === null || typeof e !== "object" || typeof e["name"] !== "string") return false;
|
|
359
|
+
const d = e["domain"];
|
|
360
|
+
if (typeof d !== "string") return false;
|
|
361
|
+
const host = d.toLowerCase().replace(/^\./, "");
|
|
362
|
+
return host === "linkedin.com" || host === "www.linkedin.com";
|
|
363
|
+
});
|
|
364
|
+
if (json.length > 0 && linkedin.length === 0) return fail2("other_site");
|
|
365
|
+
const named = (name) => linkedin.filter((c) => c["name"] === name).flatMap((c) => {
|
|
366
|
+
const raw2 = c["value"];
|
|
367
|
+
if (typeof raw2 !== "string") return [];
|
|
368
|
+
const v = raw2.length >= 2 && raw2.startsWith('"') && raw2.endsWith('"') ? raw2.slice(1, -1) : raw2;
|
|
369
|
+
return v === "" ? [] : [{ value: v, expires: expiryOf(c) }];
|
|
370
|
+
});
|
|
371
|
+
const at = pick(named("li_at"), nowSec);
|
|
372
|
+
if (!at.live) return at.expired ? fail2("expired", { expiredAt: at.expired.expires * 1e3 }) : fail2("no_li_at");
|
|
373
|
+
const a = pick(named("li_a"), nowSec);
|
|
374
|
+
return {
|
|
375
|
+
ok: true,
|
|
376
|
+
liAt: at.live.value,
|
|
377
|
+
...a.live ? { liA: a.live.value } : {},
|
|
378
|
+
liAtExpiresAt: at.live.expires === null ? null : at.live.expires * 1e3,
|
|
379
|
+
notes: !a.live && a.expired ? [LI_A_EXPIRED_NOTE] : []
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// src/commands/account.ts
|
|
384
|
+
import { statSync, readFileSync } from "fs";
|
|
53
385
|
|
|
54
386
|
// src/lib/credential-resolve.ts
|
|
55
387
|
var STDIN_TTY_CUE = "Reading secret from stdin (paste + Enter): ";
|
|
@@ -133,35 +465,63 @@ function failConflict(out, message) {
|
|
|
133
465
|
var RESENDABLE_CHALLENGE_TYPES = /* @__PURE__ */ new Set([
|
|
134
466
|
"otp",
|
|
135
467
|
"two_factor_sms",
|
|
136
|
-
"
|
|
468
|
+
"two_factor_whatsapp",
|
|
469
|
+
"mobile_app_approval",
|
|
470
|
+
"otp_or_mobile_app_approval"
|
|
137
471
|
]);
|
|
138
|
-
|
|
472
|
+
var ANOTHER_WAY_TYPES = /* @__PURE__ */ new Set([...RESENDABLE_CHALLENGE_TYPES, "two_factor_app"]);
|
|
473
|
+
var VIA = { email: "by email", sms: "by text message", whatsapp: "on WhatsApp" };
|
|
474
|
+
function challengeTitle(type, channel) {
|
|
139
475
|
switch (type) {
|
|
140
476
|
case "otp":
|
|
141
|
-
return "Check your email";
|
|
477
|
+
return channel === "email" ? "Check your email" : channel === "sms" ? "Check your text messages" : channel === "whatsapp" ? "Check WhatsApp" : "Enter the verification code";
|
|
142
478
|
case "two_factor_sms":
|
|
143
479
|
return "Enter SMS code";
|
|
480
|
+
case "two_factor_whatsapp":
|
|
481
|
+
return "Check WhatsApp";
|
|
144
482
|
case "two_factor_app":
|
|
145
483
|
return "Enter authenticator code";
|
|
146
484
|
case "mobile_app_approval":
|
|
147
485
|
return "Approve in LinkedIn app";
|
|
486
|
+
case "otp_or_mobile_app_approval":
|
|
487
|
+
return "Enter the code or approve in the LinkedIn app";
|
|
488
|
+
case "checking":
|
|
489
|
+
return "LinkedIn is checking this sign-in";
|
|
490
|
+
case "phone_register":
|
|
491
|
+
return "Add your mobile number";
|
|
492
|
+
case "contract_selection":
|
|
493
|
+
return "Choose a contract";
|
|
494
|
+
case "challenge_selection":
|
|
495
|
+
return "Choose how LinkedIn verifies this sign-in";
|
|
148
496
|
}
|
|
149
497
|
}
|
|
150
|
-
function challengeDescription(type) {
|
|
498
|
+
function challengeDescription(type, channel) {
|
|
151
499
|
switch (type) {
|
|
152
500
|
case "otp":
|
|
153
|
-
return "LinkedIn sent a one-time code to your registered email address.";
|
|
501
|
+
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
502
|
case "two_factor_sms":
|
|
155
503
|
return "LinkedIn sent a verification code to your registered phone number.";
|
|
504
|
+
case "two_factor_whatsapp":
|
|
505
|
+
return "LinkedIn sent a verification code to you on WhatsApp.";
|
|
156
506
|
case "two_factor_app":
|
|
157
507
|
return "Enter the current code from your authenticator app.";
|
|
158
508
|
case "mobile_app_approval":
|
|
159
509
|
return "Open your LinkedIn mobile app and approve this sign-in. This will continue automatically once you tap approve.";
|
|
510
|
+
case "otp_or_mobile_app_approval":
|
|
511
|
+
return `LinkedIn sent you a code${channel ? ` ${VIA[channel]}` : ""}. Enter it, or approve this sign-in in the LinkedIn app.`;
|
|
512
|
+
case "checking":
|
|
513
|
+
return "Nothing to do yet. This continues automatically.";
|
|
514
|
+
case "phone_register":
|
|
515
|
+
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.";
|
|
516
|
+
case "contract_selection":
|
|
517
|
+
return "This account has several contracts; pick the one to send from.";
|
|
518
|
+
case "challenge_selection":
|
|
519
|
+
return "LinkedIn offers more than one way to verify this sign-in.";
|
|
160
520
|
}
|
|
161
521
|
}
|
|
162
|
-
function printChallengeCopy(type, out) {
|
|
163
|
-
out.stderr.write(`${challengeTitle(type)}
|
|
164
|
-
${challengeDescription(type)}
|
|
522
|
+
function printChallengeCopy(type, out, channel) {
|
|
523
|
+
out.stderr.write(`${challengeTitle(type, channel)}
|
|
524
|
+
${challengeDescription(type, channel)}
|
|
165
525
|
`);
|
|
166
526
|
}
|
|
167
527
|
function printResendHintIfApplicable(type, accountId, out) {
|
|
@@ -171,6 +531,11 @@ function printResendHintIfApplicable(type, accountId, out) {
|
|
|
171
531
|
`
|
|
172
532
|
);
|
|
173
533
|
}
|
|
534
|
+
function printAnotherWayHintIfApplicable(type, accountId, out) {
|
|
535
|
+
if (!ANOTHER_WAY_TYPES.has(type)) return;
|
|
536
|
+
out.stderr.write(`Can't use this method? Ask LinkedIn for another: curviate account checkpoint solve ${accountId} --code TRY_ANOTHER_WAY
|
|
537
|
+
`);
|
|
538
|
+
}
|
|
174
539
|
|
|
175
540
|
// src/lib/checkpoint-cadence.ts
|
|
176
541
|
var CHECKPOINT_POLL_FIRST_DELAY_MS = 1e3;
|
|
@@ -181,6 +546,131 @@ function nextCheckpointPollDelayMs(elapsedMs) {
|
|
|
181
546
|
return elapsedMs < CHECKPOINT_POLL_FAST_WINDOW_MS ? CHECKPOINT_POLL_FAST_INTERVAL_MS : CHECKPOINT_POLL_SLOW_INTERVAL_MS;
|
|
182
547
|
}
|
|
183
548
|
|
|
549
|
+
// src/commands/connect-request.ts
|
|
550
|
+
import { defineCommand as defineCommand4 } from "citty";
|
|
551
|
+
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.";
|
|
552
|
+
var online2 = (fn) => async ({ args }) => {
|
|
553
|
+
const f = args;
|
|
554
|
+
await fn(await rootClient(f), f);
|
|
555
|
+
};
|
|
556
|
+
function preview(method, args, body = {}) {
|
|
557
|
+
process.stdout.write(JSON.stringify(buildPreviewOutput({ method, args, body })) + "\n");
|
|
558
|
+
}
|
|
559
|
+
var requestId = (f) => {
|
|
560
|
+
const id = f.id ?? "";
|
|
561
|
+
if (id.trim() === "") usage("the request id is empty. Pass the creq_... id from `curviate account connect-request create`.");
|
|
562
|
+
return id;
|
|
563
|
+
};
|
|
564
|
+
async function runCreate(c, f) {
|
|
565
|
+
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.");
|
|
566
|
+
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`.");
|
|
567
|
+
const body = f.reconnect !== void 0 ? { account_id: f.reconnect } : {};
|
|
568
|
+
if (f["warm-up"] === false) body["warm_up"] = false;
|
|
569
|
+
if (f.preview) return preview("connectRequests.create", {}, body);
|
|
570
|
+
try {
|
|
571
|
+
const req = await c.connectRequests.create(body);
|
|
572
|
+
const opts = outputOpts(f);
|
|
573
|
+
if (opts.json) renderSuccess(req, opts, process);
|
|
574
|
+
else {
|
|
575
|
+
process.stdout.write(`Link: ${req.url ?? ""}
|
|
576
|
+
Expires: ${req.expires_at ?? ""}
|
|
577
|
+
Request: ${req.id ?? ""}
|
|
578
|
+
`);
|
|
579
|
+
}
|
|
580
|
+
process.stderr.write(`${CONNECT_REQUEST_INSTRUCTION}
|
|
581
|
+
Check on it: curviate account connect-request get ${req.id ?? "<request_id>"}
|
|
582
|
+
`);
|
|
583
|
+
} catch (err) {
|
|
584
|
+
await fail(err, f);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
async function runGet(c, f) {
|
|
588
|
+
const id = requestId(f);
|
|
589
|
+
try {
|
|
590
|
+
renderSuccess(readableObject(await c.connectRequests.get(id)), outputOpts(f), process);
|
|
591
|
+
} catch (err) {
|
|
592
|
+
await fail(err, f);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
async function runCancel(c, f) {
|
|
596
|
+
const id = requestId(f);
|
|
597
|
+
if (f.preview) return preview("connectRequests.cancel", { requestId: id });
|
|
598
|
+
try {
|
|
599
|
+
renderSuccess(readableObject(await c.connectRequests.cancel(id)), outputOpts(f), process);
|
|
600
|
+
} catch (err) {
|
|
601
|
+
await fail(err, f);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
var ID = { type: "positional", description: "Connect request id (creq_...)." };
|
|
605
|
+
var createCmd = defineCommand4({
|
|
606
|
+
meta: {
|
|
607
|
+
name: "create",
|
|
608
|
+
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.",
|
|
609
|
+
risk: "write",
|
|
610
|
+
rules: {
|
|
611
|
+
changes: "Creates a pending connect request and a link. Nothing is connected until the person completes it.",
|
|
612
|
+
visible_to: "Your Team: the person it is for sees it listed under Accounts in their dashboard.",
|
|
613
|
+
budget_rows: [],
|
|
614
|
+
retry: "Not safe: a repeated call creates a second request. Read `curviate account connect-request get <request_id>` first.",
|
|
615
|
+
undo: "`curviate account connect-request cancel <request_id>`."
|
|
616
|
+
},
|
|
617
|
+
errors: {
|
|
618
|
+
ACCOUNT_NOT_FOUND: "--reconnect names an account that is unknown, archived or another Team's.",
|
|
619
|
+
INSUFFICIENT_ROLE: "your role cannot operate the account you named.",
|
|
620
|
+
ACCOUNT_NOT_SHARED: "the account you named is not shared with you."
|
|
621
|
+
},
|
|
622
|
+
seeAlso: ["curviate account connect-request get", "curviate account connect-request cancel"],
|
|
623
|
+
examples: ["curviate account connect-request create", "curviate account connect-request create --no-warm-up", "curviate account connect-request create --reconnect acc_YOUR_ACCOUNT_ID"]
|
|
624
|
+
},
|
|
625
|
+
args: {
|
|
626
|
+
...WRITE_SINGLE_FLAGS,
|
|
627
|
+
reconnect: { type: "string", description: "Reconnect this account (acc_...) instead of connecting a new one." },
|
|
628
|
+
"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." }
|
|
629
|
+
},
|
|
630
|
+
run: online2(runCreate)
|
|
631
|
+
});
|
|
632
|
+
var getCmd2 = defineCommand4({
|
|
633
|
+
meta: {
|
|
634
|
+
name: "get",
|
|
635
|
+
description: "Read a connect request: pending, completed (with the connected account_id), expired, failed or cancelled. Poll it until it leaves pending.",
|
|
636
|
+
risk: "read",
|
|
637
|
+
output: ["The request: status, and account_id once completed. Never a credential, code or the step the person is on."],
|
|
638
|
+
examples: ["curviate account connect-request get creq_YOUR_REQUEST_ID"]
|
|
639
|
+
},
|
|
640
|
+
args: { ...readOnly(READ_SINGLE_FLAGS), id: ID },
|
|
641
|
+
run: online2(runGet)
|
|
642
|
+
});
|
|
643
|
+
var cancelCmd = defineCommand4({
|
|
644
|
+
meta: {
|
|
645
|
+
name: "cancel",
|
|
646
|
+
description: "Cancel a pending connect request; its link stops working. A request that is no longer pending is refused.",
|
|
647
|
+
risk: "write",
|
|
648
|
+
rules: {
|
|
649
|
+
changes: "The request becomes cancelled and its link stops working.",
|
|
650
|
+
visible_to: "Your Team: it leaves the person's Accounts list.",
|
|
651
|
+
budget_rows: [],
|
|
652
|
+
retry: "Safe: cancelling a cancelled request answers the same request again.",
|
|
653
|
+
undo: "Cannot be undone; create a new request."
|
|
654
|
+
},
|
|
655
|
+
errors: {
|
|
656
|
+
CONNECT_REQUEST_NOT_PENDING: "the request is completed, expired or failed; the message names which.",
|
|
657
|
+
CONNECT_REQUEST_IN_USE: "the person is completing it right now; try again in a minute.",
|
|
658
|
+
RESOURCE_NOT_FOUND: "no such request, or it was removed a day after it ended."
|
|
659
|
+
},
|
|
660
|
+
examples: ["curviate account connect-request cancel creq_YOUR_REQUEST_ID"]
|
|
661
|
+
},
|
|
662
|
+
args: { ...WRITE_SINGLE_FLAGS, id: ID },
|
|
663
|
+
run: online2(runCancel)
|
|
664
|
+
});
|
|
665
|
+
var connectRequestCommand = defineCommand4({
|
|
666
|
+
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." },
|
|
667
|
+
subCommands: { create: createCmd, get: getCmd2, cancel: cancelCmd },
|
|
668
|
+
async run() {
|
|
669
|
+
const { showHelp } = await import("./examples-JJB4DZKK.js");
|
|
670
|
+
await showHelp(connectRequestCommand, ["curviate", "account", "connect-request"]);
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
|
|
184
674
|
// src/commands/account.ts
|
|
185
675
|
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
676
|
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 +697,7 @@ function resolveOutputOpts(flags) {
|
|
|
207
697
|
async function handleError(err, outOpts, out) {
|
|
208
698
|
const { CurviateError } = await import("@curviate/sdk");
|
|
209
699
|
if (err instanceof CurviateError) {
|
|
210
|
-
const { getExitCode } = await import("./exit-codes-
|
|
700
|
+
const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
|
|
211
701
|
renderError(err, outOpts, out);
|
|
212
702
|
process.exit(getExitCode(err));
|
|
213
703
|
}
|
|
@@ -240,6 +730,9 @@ async function runAccountList(client, flags, out) {
|
|
|
240
730
|
const result = await client.accounts.list(params);
|
|
241
731
|
readablePage(result);
|
|
242
732
|
renderSuccess(result, { ...outOpts, slim: slimAccountList }, out);
|
|
733
|
+
if (!isJsonMode(outOpts) && !result.items?.length && !cursor && flags["external-id"] === void 0) {
|
|
734
|
+
out.stderr.write("No Account connected: ask your user to connect one in the dashboard, or create a Connect request.\n");
|
|
735
|
+
}
|
|
243
736
|
}
|
|
244
737
|
} catch (err) {
|
|
245
738
|
await handleError(err, outOpts, out);
|
|
@@ -296,41 +789,36 @@ async function runAccountSeats(client, flags, out) {
|
|
|
296
789
|
}
|
|
297
790
|
const notices = renderNotices(result.notices);
|
|
298
791
|
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
|
-
}
|
|
792
|
+
const body = result.items.length === 0 ? "(no seats)" : result.items.map(renderSeatLineHuman).join("\n");
|
|
305
793
|
out.stdout.write(body + "\n");
|
|
306
794
|
}
|
|
307
795
|
function assertLocationFlags(flags, out, opts) {
|
|
308
|
-
const
|
|
796
|
+
const fail3 = (message) => {
|
|
309
797
|
out.stderr.write(`error: ${message}
|
|
310
798
|
`);
|
|
311
799
|
process.exit(2);
|
|
312
800
|
};
|
|
313
801
|
const named = ["country", "ip", "proxy-host"].filter((k) => flags[k] !== void 0);
|
|
314
|
-
for (const k of named) if (flags[k].trim() === "")
|
|
802
|
+
for (const k of named) if (flags[k].trim() === "") fail3(`--${k} was given an empty value.`);
|
|
315
803
|
if (named.length > 1) {
|
|
316
|
-
|
|
804
|
+
fail3(
|
|
317
805
|
`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
806
|
);
|
|
319
807
|
}
|
|
320
808
|
if (named.length === 0 && opts.requireOne) {
|
|
321
|
-
|
|
809
|
+
fail3(
|
|
322
810
|
"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
811
|
);
|
|
324
812
|
}
|
|
325
813
|
if (flags.country !== void 0 && !/^[a-z]{2}$/i.test(flags.country.trim())) {
|
|
326
|
-
|
|
814
|
+
fail3("--country takes a two-letter ISO 3166-1 country code, e.g. US or DE.");
|
|
327
815
|
}
|
|
328
816
|
if (flags["allow-country-fallback"] !== void 0) {
|
|
329
817
|
if (flags["proxy-host"] !== void 0) {
|
|
330
|
-
|
|
818
|
+
fail3("--allow-country-fallback applies to a managed location (--country or --ip), not to your own proxy; remove one.");
|
|
331
819
|
}
|
|
332
820
|
if (!opts.fallbackAlone && flags.country === void 0 && flags.ip === void 0) {
|
|
333
|
-
|
|
821
|
+
fail3("--allow-country-fallback applies to --country or --ip; pass one of them with it.");
|
|
334
822
|
}
|
|
335
823
|
}
|
|
336
824
|
}
|
|
@@ -340,6 +828,30 @@ function managedLocationBody(flags) {
|
|
|
340
828
|
...flags["allow-country-fallback"] !== void 0 ? { allow_country_fallback: flags["allow-country-fallback"] } : {}
|
|
341
829
|
};
|
|
342
830
|
}
|
|
831
|
+
var COOKIES_FILE_CUE = "Paste the export, then press Ctrl-D. It won't be shown.";
|
|
832
|
+
async function loadCookieExport(value, ctx) {
|
|
833
|
+
const stop = (message) => {
|
|
834
|
+
ctx.out.stderr.write(`error: ${message}
|
|
835
|
+
`);
|
|
836
|
+
return process.exit(2);
|
|
837
|
+
};
|
|
838
|
+
let text;
|
|
839
|
+
if (isStdinToken(value)) {
|
|
840
|
+
text = ctx.isTTY ? await ctx.readToEof(COOKIES_FILE_CUE) : await ctx.readStdin();
|
|
841
|
+
} else {
|
|
842
|
+
try {
|
|
843
|
+
if (statSync(value).isDirectory()) throw new Error("directory");
|
|
844
|
+
text = readFileSync(value, "utf8");
|
|
845
|
+
} catch {
|
|
846
|
+
return stop(`--cookies-file: cannot read ${value}.`);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
const parsed = parseCookieExport(text, ctx.now());
|
|
850
|
+
if (!parsed.ok) return stop(cookieExportMessage(parsed));
|
|
851
|
+
for (const note of parsed.notes) ctx.out.stderr.write(`note: ${note}
|
|
852
|
+
`);
|
|
853
|
+
return { li_at: parsed.liAt, ...parsed.liA !== void 0 ? { li_a: parsed.liA } : {} };
|
|
854
|
+
}
|
|
343
855
|
async function buildAuthBody(flags, ctx) {
|
|
344
856
|
const body = {};
|
|
345
857
|
if (flags["auth-method"]) body["auth_method"] = flags["auth-method"];
|
|
@@ -358,7 +870,7 @@ async function buildAuthBody(flags, ctx) {
|
|
|
358
870
|
}
|
|
359
871
|
}
|
|
360
872
|
if (flags["external-id"] !== void 0) body["external_id"] = flags["external-id"];
|
|
361
|
-
if (flags
|
|
873
|
+
if (flags["warm-up"] === false) body["warm_up"] = false;
|
|
362
874
|
if (flags.products !== void 0) {
|
|
363
875
|
const products = flags.products.split(",").map((p) => p.trim()).filter(Boolean);
|
|
364
876
|
if (products.length === 0 || products.some((p) => p !== "sales_navigator" && p !== "recruiter")) {
|
|
@@ -401,7 +913,8 @@ async function buildAuthBody(flags, ctx) {
|
|
|
401
913
|
};
|
|
402
914
|
}
|
|
403
915
|
}
|
|
404
|
-
if (
|
|
916
|
+
if (ctx.cookieExport) body["cookie"] = ctx.cookieExport;
|
|
917
|
+
if (flags["auth-method"] === "cookie" && flags["cookies-file"] === void 0) {
|
|
405
918
|
const liAt = await resolveSecret({
|
|
406
919
|
flagValue: flags["li-at"],
|
|
407
920
|
stdinRequested: flags["li-at-stdin"],
|
|
@@ -461,6 +974,7 @@ function resolveCredentialIO(io) {
|
|
|
461
974
|
// readlineSync itself writes its `prompt` argument to stderr too, the
|
|
462
975
|
// cue text would otherwise print twice on a real terminal.
|
|
463
976
|
readSingleLine: io.readSingleLine ?? (() => readlineSync("", { mask: true })),
|
|
977
|
+
readToEof: io.readToEof ?? ((cue) => readHiddenToEof(cue)),
|
|
464
978
|
sleep: io.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms))),
|
|
465
979
|
now: io.now ?? (() => Date.now()),
|
|
466
980
|
open: io.open ?? defaultOpen
|
|
@@ -470,6 +984,9 @@ function printConnected(result, ctx) {
|
|
|
470
984
|
const r = result;
|
|
471
985
|
ctx.out.stderr.write(`Account ${ctx.successVerb}: ${r.account_id ?? ""}
|
|
472
986
|
`);
|
|
987
|
+
if (r.contract_selected === false) {
|
|
988
|
+
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");
|
|
989
|
+
}
|
|
473
990
|
renderSuccess(result, ctx.outOpts, ctx.out);
|
|
474
991
|
}
|
|
475
992
|
function printInvalidCodeRetryHint(err, out) {
|
|
@@ -478,7 +995,11 @@ function printInvalidCodeRetryHint(err, out) {
|
|
|
478
995
|
out.stderr.write(`${message}
|
|
479
996
|
`);
|
|
480
997
|
}
|
|
998
|
+
function isCheckpointExpired(err, CurviateError) {
|
|
999
|
+
return err instanceof CurviateError && err.code === "CHECKPOINT_EXPIRED";
|
|
1000
|
+
}
|
|
481
1001
|
async function waitForMobileApproval(client, accountId, expiresAt, ctx) {
|
|
1002
|
+
const { CurviateError } = await import("@curviate/sdk");
|
|
482
1003
|
const startedAt = ctx.now();
|
|
483
1004
|
const timeoutAt = expiresAt ? new Date(expiresAt).getTime() : startedAt + 10 * 6e4;
|
|
484
1005
|
await ctx.sleep(CHECKPOINT_POLL_FIRST_DELAY_MS);
|
|
@@ -488,37 +1009,78 @@ async function waitForMobileApproval(client, accountId, expiresAt, ctx) {
|
|
|
488
1009
|
result = await client.auth.pollCheckpoint(accountId);
|
|
489
1010
|
readableObject(result);
|
|
490
1011
|
} catch (err) {
|
|
1012
|
+
if (isCheckpointExpired(err, CurviateError)) return { kind: "terminal_failure", status: "expired" };
|
|
491
1013
|
return await handleError(err, ctx.outOpts, ctx.out);
|
|
492
1014
|
}
|
|
493
1015
|
const status = result.status;
|
|
494
1016
|
if (status === "active") return { kind: "active", result };
|
|
495
|
-
if (status === "
|
|
496
|
-
|
|
497
|
-
}
|
|
1017
|
+
if (status === "checkpoint_required") return { kind: "chained", result: { ...result, account_id: result.account_id ?? accountId } };
|
|
1018
|
+
if (status === "failed") return { kind: "terminal_failure", status };
|
|
498
1019
|
const n = ctx.now();
|
|
499
1020
|
if (n >= timeoutAt) return { kind: "timeout" };
|
|
500
1021
|
await ctx.sleep(nextCheckpointPollDelayMs(n - startedAt));
|
|
501
1022
|
}
|
|
502
1023
|
}
|
|
1024
|
+
function phoneCode(input) {
|
|
1025
|
+
const m = /^\(\+(\d{1,3})\)([\d\s-]+)$/.exec(input.trim());
|
|
1026
|
+
const rest = m?.[2]?.replace(/[\s-]/g, "") ?? "";
|
|
1027
|
+
return m && rest.length >= 4 ? `(+${m[1]})${rest}` : void 0;
|
|
1028
|
+
}
|
|
503
1029
|
async function runInteractiveCheckpointLoop(client, initial, ctx) {
|
|
504
1030
|
const { CurviateError } = await import("@curviate/sdk");
|
|
505
1031
|
let current = initial;
|
|
506
1032
|
for (; ; ) {
|
|
507
1033
|
const challengeType = current.challenge_type;
|
|
508
1034
|
const accountId = current.account_id ?? "";
|
|
509
|
-
if (
|
|
1035
|
+
if (challengeType === "challenge_selection" || challengeType === "contract_selection") {
|
|
510
1036
|
readableObject(current);
|
|
511
1037
|
renderSuccess(current, ctx.outOpts, ctx.out);
|
|
512
1038
|
ctx.out.stderr.write(
|
|
513
|
-
`Choose how LinkedIn verifies this sign-in: curviate account checkpoint request ${accountId} --challenge <id> (an id from challenges).
|
|
1039
|
+
challengeType === "challenge_selection" ? `Choose how LinkedIn verifies this sign-in: curviate account checkpoint request ${accountId} --challenge <id> (an id from challenges).
|
|
1040
|
+
` : `Choose the contract to send from: curviate account checkpoint solve ${accountId} --code <id> (an id from contracts).
|
|
514
1041
|
`
|
|
515
1042
|
);
|
|
516
1043
|
process.exit(AUTH_NEEDED);
|
|
517
1044
|
return;
|
|
518
1045
|
}
|
|
519
|
-
printChallengeCopy(challengeType, ctx.out);
|
|
1046
|
+
printChallengeCopy(challengeType, ctx.out, current.channel);
|
|
520
1047
|
printResendHintIfApplicable(challengeType, accountId, ctx.out);
|
|
521
|
-
|
|
1048
|
+
printAnotherWayHintIfApplicable(challengeType, accountId, ctx.out);
|
|
1049
|
+
let wait = challengeType === "mobile_app_approval" || challengeType === "checking";
|
|
1050
|
+
if (!wait) {
|
|
1051
|
+
for (; ; ) {
|
|
1052
|
+
const either = challengeType === "otp_or_mobile_app_approval";
|
|
1053
|
+
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: ";
|
|
1054
|
+
const typed = (await ctx.readline(prompt)).trim();
|
|
1055
|
+
if (either && typed === "") {
|
|
1056
|
+
wait = true;
|
|
1057
|
+
break;
|
|
1058
|
+
}
|
|
1059
|
+
const code = challengeType === "phone_register" ? phoneCode(typed) : typed;
|
|
1060
|
+
if (code === void 0) {
|
|
1061
|
+
ctx.out.stderr.write("That is not a number in the form (+CC)number, for example (+49)1701234567.\n");
|
|
1062
|
+
continue;
|
|
1063
|
+
}
|
|
1064
|
+
try {
|
|
1065
|
+
const result = await client.auth.solveCheckpoint(accountId, { code });
|
|
1066
|
+
const r = result;
|
|
1067
|
+
if (r.status === "checkpoint_required") {
|
|
1068
|
+
current = { ...r, account_id: r.account_id ?? accountId };
|
|
1069
|
+
break;
|
|
1070
|
+
}
|
|
1071
|
+
printConnected(result, { out: ctx.out, outOpts: ctx.outOpts, successVerb: ctx.successVerb });
|
|
1072
|
+
return;
|
|
1073
|
+
} catch (err) {
|
|
1074
|
+
if (err instanceof CurviateError && err.code === "CHECKPOINT_INVALID_CODE") {
|
|
1075
|
+
printInvalidCodeRetryHint(err, ctx.out);
|
|
1076
|
+
continue;
|
|
1077
|
+
}
|
|
1078
|
+
if (isCheckpointExpired(err, CurviateError)) return expiredExit(ctx.out);
|
|
1079
|
+
await handleError(err, ctx.outOpts, ctx.out);
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
if (wait) {
|
|
522
1084
|
const outcome = await waitForMobileApproval(client, accountId, current.expires_at, {
|
|
523
1085
|
out: ctx.out,
|
|
524
1086
|
outOpts: ctx.outOpts,
|
|
@@ -529,11 +1091,14 @@ async function runInteractiveCheckpointLoop(client, initial, ctx) {
|
|
|
529
1091
|
printConnected(outcome.result, { out: ctx.out, outOpts: ctx.outOpts, successVerb: ctx.successVerb });
|
|
530
1092
|
return;
|
|
531
1093
|
}
|
|
1094
|
+
if (outcome.kind === "chained") {
|
|
1095
|
+
current = outcome.result;
|
|
1096
|
+
continue;
|
|
1097
|
+
}
|
|
532
1098
|
if (outcome.kind === "terminal_failure") {
|
|
533
|
-
ctx.out
|
|
534
|
-
|
|
535
|
-
`
|
|
536
|
-
);
|
|
1099
|
+
if (outcome.status === "expired") return expiredExit(ctx.out);
|
|
1100
|
+
ctx.out.stderr.write(`This checkpoint has ${outcome.status}. Run the connect command again to restart.
|
|
1101
|
+
`);
|
|
537
1102
|
process.exit(9);
|
|
538
1103
|
return;
|
|
539
1104
|
}
|
|
@@ -544,27 +1109,12 @@ async function runInteractiveCheckpointLoop(client, initial, ctx) {
|
|
|
544
1109
|
process.exit(AUTH_NEEDED);
|
|
545
1110
|
return;
|
|
546
1111
|
}
|
|
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
1112
|
}
|
|
567
1113
|
}
|
|
1114
|
+
function expiredExit(out) {
|
|
1115
|
+
out.stderr.write("This sign-in timed out (the checkpoint expired). Run the connect command again to start over.\n");
|
|
1116
|
+
return process.exit(9);
|
|
1117
|
+
}
|
|
568
1118
|
async function handleAccountConnectResult(client, result, ctx) {
|
|
569
1119
|
const envelope = result;
|
|
570
1120
|
if (envelope?.status !== "checkpoint_required") {
|
|
@@ -633,8 +1183,23 @@ async function soleFreeSeat(client, out, outOpts) {
|
|
|
633
1183
|
return seatId;
|
|
634
1184
|
}
|
|
635
1185
|
async function runAccountLink(client, flags, out, io = {}) {
|
|
1186
|
+
const cookiesFile = flags["cookies-file"];
|
|
1187
|
+
if (cookiesFile !== void 0) {
|
|
1188
|
+
if (cookiesFile.trim() === "") {
|
|
1189
|
+
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");
|
|
1190
|
+
process.exit(2);
|
|
1191
|
+
}
|
|
1192
|
+
const clash = ["li-at", "li-at-stdin", "li-a", "email", "password", "password-stdin"].find((k) => flags[k] !== void 0 && flags[k] !== false);
|
|
1193
|
+
const named = clash ? `--${clash}` : flags["auth-method"] === "credentials" ? "--auth-method credentials" : void 0;
|
|
1194
|
+
if (named) {
|
|
1195
|
+
out.stderr.write(`error: --cookies-file cannot be combined with ${named}: the export carries the session cookies, so pass one source.
|
|
1196
|
+
`);
|
|
1197
|
+
process.exit(2);
|
|
1198
|
+
}
|
|
1199
|
+
flags = { ...flags, "auth-method": "cookie" };
|
|
1200
|
+
}
|
|
636
1201
|
if (!flags["auth-method"]) {
|
|
637
|
-
out.stderr.write("error: --auth-method is required for account link (credentials | cookie).\n");
|
|
1202
|
+
out.stderr.write("error: --auth-method is required for account link (credentials | cookie), or pass --cookies-file.\n");
|
|
638
1203
|
process.exit(2);
|
|
639
1204
|
}
|
|
640
1205
|
if (flags["account-id"] !== void 0 && flags["account-id"].trim() === "") {
|
|
@@ -643,8 +1208,18 @@ async function runAccountLink(client, flags, out, io = {}) {
|
|
|
643
1208
|
);
|
|
644
1209
|
process.exit(2);
|
|
645
1210
|
}
|
|
1211
|
+
if (flags["warm-up"] === false && flags["account-id"] !== void 0) {
|
|
1212
|
+
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");
|
|
1213
|
+
process.exit(2);
|
|
1214
|
+
}
|
|
646
1215
|
checkCredentialConflicts(flags, out);
|
|
647
|
-
if (!flags.preview &&
|
|
1216
|
+
if (!flags.preview && cookiesFile !== void 0 && !flags["user-agent"]) {
|
|
1217
|
+
out.stderr.write(
|
|
1218
|
+
"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"
|
|
1219
|
+
);
|
|
1220
|
+
process.exit(2);
|
|
1221
|
+
}
|
|
1222
|
+
if (!flags.preview && cookiesFile === void 0 && flags["auth-method"] === "cookie" && !flags["user-agent"]) {
|
|
648
1223
|
out.stderr.write(
|
|
649
1224
|
"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
1225
|
);
|
|
@@ -658,6 +1233,10 @@ async function runAccountLink(client, flags, out, io = {}) {
|
|
|
658
1233
|
);
|
|
659
1234
|
process.exit(2);
|
|
660
1235
|
}
|
|
1236
|
+
const resolvedIo = resolveCredentialIO(io);
|
|
1237
|
+
const pasteExport = cookiesFile !== void 0 && isStdinToken(cookiesFile) && resolvedIo.isTTY;
|
|
1238
|
+
const exportCtx = { out, isTTY: resolvedIo.isTTY, readStdin: resolvedIo.readStdin, readToEof: resolvedIo.readToEof, now: resolvedIo.now };
|
|
1239
|
+
let cookieExport = cookiesFile !== void 0 && !pasteExport ? await loadCookieExport(cookiesFile, exportCtx) : void 0;
|
|
661
1240
|
let seatId = flags["seat-id"];
|
|
662
1241
|
if (!seatId) {
|
|
663
1242
|
if (flags.preview) {
|
|
@@ -674,8 +1253,9 @@ async function runAccountLink(client, flags, out, io = {}) {
|
|
|
674
1253
|
}
|
|
675
1254
|
seatId = await soleFreeSeat(client, out, outOpts);
|
|
676
1255
|
}
|
|
677
|
-
|
|
1256
|
+
if (pasteExport && !flags.preview) cookieExport = await loadCookieExport(cookiesFile, exportCtx);
|
|
678
1257
|
const authBody = await buildAuthBody(flags, {
|
|
1258
|
+
cookieExport,
|
|
679
1259
|
out,
|
|
680
1260
|
isTTY: resolvedIo.isTTY,
|
|
681
1261
|
readline: resolvedIo.readline,
|
|
@@ -692,8 +1272,8 @@ async function runAccountLink(client, flags, out, io = {}) {
|
|
|
692
1272
|
...flags["account-id"] ? { account_id: flags["account-id"] } : {}
|
|
693
1273
|
};
|
|
694
1274
|
if (flags.preview) {
|
|
695
|
-
const
|
|
696
|
-
out.stdout.write(JSON.stringify(
|
|
1275
|
+
const preview2 = buildPreviewOutput({ method: "auth.intent", args: {}, body });
|
|
1276
|
+
out.stdout.write(JSON.stringify(preview2) + "\n");
|
|
697
1277
|
return;
|
|
698
1278
|
}
|
|
699
1279
|
let result;
|
|
@@ -757,8 +1337,8 @@ async function runAccountConnectSessionPoll(client, flags, out, io = {}) {
|
|
|
757
1337
|
const sessionId = flags.session;
|
|
758
1338
|
const outOpts = resolveOutputOpts(flags);
|
|
759
1339
|
if (flags.preview) {
|
|
760
|
-
const
|
|
761
|
-
out.stdout.write(JSON.stringify(
|
|
1340
|
+
const preview2 = buildPreviewOutput({ method: "auth.getSession", args: { session_id: sessionId }, body: {} });
|
|
1341
|
+
out.stdout.write(JSON.stringify(preview2) + "\n");
|
|
762
1342
|
return;
|
|
763
1343
|
}
|
|
764
1344
|
if (!flags.wait) {
|
|
@@ -841,6 +1421,7 @@ async function runAccountUpdate(client, flags, out) {
|
|
|
841
1421
|
}
|
|
842
1422
|
assertLocationFlags(flags, out, { requireOne: false, fallbackAlone: true });
|
|
843
1423
|
Object.assign(body, managedLocationBody(flags));
|
|
1424
|
+
if (flags["save-connections-as-contacts"] !== void 0) body["save_connections_as_contacts"] = flags["save-connections-as-contacts"];
|
|
844
1425
|
if (flags["proxy-host"]) {
|
|
845
1426
|
const proxyPassword = await resolveSecret({
|
|
846
1427
|
flagValue: flags["proxy-password"],
|
|
@@ -857,12 +1438,12 @@ async function runAccountUpdate(client, flags, out) {
|
|
|
857
1438
|
}
|
|
858
1439
|
const outOpts = resolveOutputOpts(flags);
|
|
859
1440
|
if (flags.preview) {
|
|
860
|
-
const
|
|
1441
|
+
const preview2 = buildPreviewOutput({
|
|
861
1442
|
method: "accounts.update",
|
|
862
1443
|
args: { accountId },
|
|
863
1444
|
body
|
|
864
1445
|
});
|
|
865
|
-
out.stdout.write(JSON.stringify(
|
|
1446
|
+
out.stdout.write(JSON.stringify(preview2) + "\n");
|
|
866
1447
|
return;
|
|
867
1448
|
}
|
|
868
1449
|
try {
|
|
@@ -876,12 +1457,12 @@ async function runAccountDisconnect(client, flags, out) {
|
|
|
876
1457
|
const accountId = requireAccountId(flags, out);
|
|
877
1458
|
const outOpts = resolveOutputOpts(flags);
|
|
878
1459
|
if (flags.preview) {
|
|
879
|
-
const
|
|
1460
|
+
const preview2 = buildPreviewOutput({
|
|
880
1461
|
method: "accounts.disconnect",
|
|
881
1462
|
args: { accountId },
|
|
882
1463
|
body: {}
|
|
883
1464
|
});
|
|
884
|
-
out.stdout.write(JSON.stringify(
|
|
1465
|
+
out.stdout.write(JSON.stringify(preview2) + "\n");
|
|
885
1466
|
return;
|
|
886
1467
|
}
|
|
887
1468
|
try {
|
|
@@ -900,12 +1481,12 @@ async function runAccountCheckpointSolve(client, flags, out) {
|
|
|
900
1481
|
const body = { code: flags.code };
|
|
901
1482
|
const outOpts = resolveOutputOpts(flags);
|
|
902
1483
|
if (flags.preview) {
|
|
903
|
-
const
|
|
1484
|
+
const preview2 = buildPreviewOutput({
|
|
904
1485
|
method: "auth.solveCheckpoint",
|
|
905
1486
|
args: { accountId },
|
|
906
1487
|
body
|
|
907
1488
|
});
|
|
908
|
-
out.stdout.write(JSON.stringify(
|
|
1489
|
+
out.stdout.write(JSON.stringify(preview2) + "\n");
|
|
909
1490
|
return;
|
|
910
1491
|
}
|
|
911
1492
|
let chained = false;
|
|
@@ -928,12 +1509,12 @@ async function runAccountCheckpointRequest(client, flags, out) {
|
|
|
928
1509
|
const outOpts = resolveOutputOpts(flags);
|
|
929
1510
|
const body = flags.challenge !== void 0 ? { challenge: flags.challenge } : void 0;
|
|
930
1511
|
if (flags.preview) {
|
|
931
|
-
const
|
|
1512
|
+
const preview2 = buildPreviewOutput({
|
|
932
1513
|
method: "auth.requestCheckpoint",
|
|
933
1514
|
args: { accountId },
|
|
934
1515
|
body: body ?? {}
|
|
935
1516
|
});
|
|
936
|
-
out.stdout.write(JSON.stringify(
|
|
1517
|
+
out.stdout.write(JSON.stringify(preview2) + "\n");
|
|
937
1518
|
return;
|
|
938
1519
|
}
|
|
939
1520
|
let chained = false;
|
|
@@ -957,14 +1538,20 @@ async function runCheckpointPollWaitLoop(client, accountId, ctx) {
|
|
|
957
1538
|
const startedAt = ctx.now();
|
|
958
1539
|
let timeoutAt = ctx.timeoutOverrideMs !== void 0 ? startedAt + ctx.timeoutOverrideMs : void 0;
|
|
959
1540
|
await ctx.sleep(CHECKPOINT_POLL_FIRST_DELAY_MS);
|
|
1541
|
+
const { CurviateError } = await import("@curviate/sdk");
|
|
960
1542
|
for (; ; ) {
|
|
961
|
-
|
|
1543
|
+
let result;
|
|
1544
|
+
try {
|
|
1545
|
+
result = await client.auth.pollCheckpoint(accountId);
|
|
1546
|
+
} catch (err) {
|
|
1547
|
+
if (isCheckpointExpired(err, CurviateError)) return { kind: "terminal_failure", status: "expired", result: { status: "expired" } };
|
|
1548
|
+
throw err;
|
|
1549
|
+
}
|
|
962
1550
|
readableObject(result);
|
|
963
1551
|
const r = result;
|
|
964
1552
|
if (r.status === "active") return { kind: "active", result };
|
|
965
|
-
if (r.status === "
|
|
966
|
-
|
|
967
|
-
}
|
|
1553
|
+
if (r.status === "checkpoint_required") return { kind: "chained", result };
|
|
1554
|
+
if (r.status === "failed") return { kind: "terminal_failure", status: r.status, result };
|
|
968
1555
|
if (timeoutAt === void 0) {
|
|
969
1556
|
const expiresAtMs = r.expires_at ? new Date(r.expires_at).getTime() : NaN;
|
|
970
1557
|
timeoutAt = Number.isNaN(expiresAtMs) ? startedAt + 10 * 6e4 : expiresAtMs;
|
|
@@ -972,7 +1559,7 @@ async function runCheckpointPollWaitLoop(client, accountId, ctx) {
|
|
|
972
1559
|
const n = ctx.now();
|
|
973
1560
|
if (n >= timeoutAt) return { kind: "timeout", result };
|
|
974
1561
|
if (ctx.showTicker) {
|
|
975
|
-
ctx.out.stderr.write(`\rWaiting for
|
|
1562
|
+
ctx.out.stderr.write(`\rWaiting for LinkedIn... ${formatRemaining(timeoutAt - n)} remaining`);
|
|
976
1563
|
}
|
|
977
1564
|
await ctx.sleep(nextCheckpointPollDelayMs(n - startedAt));
|
|
978
1565
|
}
|
|
@@ -981,12 +1568,12 @@ async function runAccountCheckpointPoll(client, flags, out, io = {}) {
|
|
|
981
1568
|
const accountId = requireAccountId(flags, out);
|
|
982
1569
|
const outOpts = resolveOutputOpts(flags);
|
|
983
1570
|
if (flags.preview) {
|
|
984
|
-
const
|
|
1571
|
+
const preview2 = buildPreviewOutput({
|
|
985
1572
|
method: "auth.pollCheckpoint",
|
|
986
1573
|
args: { accountId },
|
|
987
1574
|
body: {}
|
|
988
1575
|
});
|
|
989
|
-
out.stdout.write(JSON.stringify(
|
|
1576
|
+
out.stdout.write(JSON.stringify(preview2) + "\n");
|
|
990
1577
|
return;
|
|
991
1578
|
}
|
|
992
1579
|
if (!flags.wait) {
|
|
@@ -1020,7 +1607,19 @@ async function runAccountCheckpointPoll(client, flags, out, io = {}) {
|
|
|
1020
1607
|
printConnected(outcome.result, { out, outOpts, successVerb: "linked" });
|
|
1021
1608
|
return;
|
|
1022
1609
|
}
|
|
1610
|
+
if (outcome.kind === "chained") {
|
|
1611
|
+
renderSuccess(outcome.result, outOpts, out);
|
|
1612
|
+
out.stderr.write(`LinkedIn asks for another step. Answer it: curviate account checkpoint solve ${accountId} --code <code> (see challenge_type).
|
|
1613
|
+
`);
|
|
1614
|
+
process.exit(AUTH_NEEDED);
|
|
1615
|
+
return;
|
|
1616
|
+
}
|
|
1023
1617
|
if (outcome.kind === "terminal_failure") {
|
|
1618
|
+
if (outcome.status === "expired") {
|
|
1619
|
+
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");
|
|
1620
|
+
process.exit(9);
|
|
1621
|
+
return;
|
|
1622
|
+
}
|
|
1024
1623
|
renderSuccess(outcome.result, outOpts, out);
|
|
1025
1624
|
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
1625
|
`);
|
|
@@ -1034,10 +1633,11 @@ async function runAccountCheckpointPoll(client, flags, out, io = {}) {
|
|
|
1034
1633
|
);
|
|
1035
1634
|
process.exit(AUTH_NEEDED);
|
|
1036
1635
|
}
|
|
1037
|
-
var accountListCommand =
|
|
1636
|
+
var accountListCommand = defineCommand5({
|
|
1038
1637
|
meta: {
|
|
1039
1638
|
name: "list",
|
|
1040
1639
|
description: "List connected LinkedIn accounts.",
|
|
1640
|
+
risk: "read",
|
|
1041
1641
|
examples: [
|
|
1042
1642
|
"curviate account list",
|
|
1043
1643
|
"curviate account list --json --fields items.account_id,items.status",
|
|
@@ -1065,10 +1665,11 @@ var accountListCommand = defineCommand({
|
|
|
1065
1665
|
await runAccountList(client, flags, out);
|
|
1066
1666
|
}
|
|
1067
1667
|
});
|
|
1068
|
-
var accountGetCommand =
|
|
1668
|
+
var accountGetCommand = defineCommand5({
|
|
1069
1669
|
meta: {
|
|
1070
1670
|
name: "get",
|
|
1071
1671
|
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.",
|
|
1672
|
+
risk: "read",
|
|
1072
1673
|
examples: [
|
|
1073
1674
|
"curviate account get acc_YOUR_ACCOUNT_ID"
|
|
1074
1675
|
]
|
|
@@ -1095,10 +1696,11 @@ var accountGetCommand = defineCommand({
|
|
|
1095
1696
|
await runAccountGet(client, flags, out);
|
|
1096
1697
|
}
|
|
1097
1698
|
});
|
|
1098
|
-
var accountSeatsCommand =
|
|
1699
|
+
var accountSeatsCommand = defineCommand5({
|
|
1099
1700
|
meta: {
|
|
1100
1701
|
name: "seats",
|
|
1101
1702
|
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.",
|
|
1703
|
+
risk: "read",
|
|
1102
1704
|
examples: [
|
|
1103
1705
|
"curviate account seats"
|
|
1104
1706
|
]
|
|
@@ -1121,17 +1723,29 @@ var accountSeatsCommand = defineCommand({
|
|
|
1121
1723
|
await runAccountSeats(client, flags, out);
|
|
1122
1724
|
}
|
|
1123
1725
|
});
|
|
1124
|
-
var accountLinkCommand =
|
|
1726
|
+
var accountLinkCommand = defineCommand5({
|
|
1125
1727
|
meta: {
|
|
1126
1728
|
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`.",
|
|
1729
|
+
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`.",
|
|
1730
|
+
risk: "high",
|
|
1731
|
+
rules: {
|
|
1732
|
+
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.",
|
|
1733
|
+
visible_to: "Your Team gets the Account to operate; LinkedIn sees a sign-in from the chosen location.",
|
|
1734
|
+
budget_rows: [],
|
|
1735
|
+
retry: "Not safe for a new connect: each success takes another seat. Read `curviate account list` first.",
|
|
1736
|
+
undo: "`curviate account disconnect <account_id>` disconnects it and releases the seat.",
|
|
1737
|
+
blast_radius: "One LinkedIn account and one seat."
|
|
1738
|
+
},
|
|
1739
|
+
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." },
|
|
1740
|
+
seeAlso: ["curviate account seats", "curviate account connect-request create", "curviate account checkpoint solve"],
|
|
1128
1741
|
examples: [
|
|
1129
1742
|
"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"
|
|
1743
|
+
"curviate account link --auth-method credentials --email jane@example.com --password-stdin --account-id acc_YOUR_ACCOUNT_ID --seat-id SEAT_ID",
|
|
1744
|
+
'curviate account link --cookies-file linkedin-cookies.json --user-agent "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36" --country US'
|
|
1131
1745
|
],
|
|
1132
1746
|
requires: [
|
|
1133
1747
|
"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.",
|
|
1748
|
+
"--user-agent with --auth-method cookie or --cookies-file.",
|
|
1135
1749
|
"--seat-id with --preview or --account-id, and when zero or several seats are free.",
|
|
1136
1750
|
"--password-stdin only with --auth-method credentials; --li-at-stdin only with --auth-method cookie."
|
|
1137
1751
|
]
|
|
@@ -1139,7 +1753,8 @@ var accountLinkCommand = defineCommand({
|
|
|
1139
1753
|
args: {
|
|
1140
1754
|
...WRITE_SINGLE_FLAGS,
|
|
1141
1755
|
"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.
|
|
1756
|
+
"auth-method": { type: "string", description: "Authentication method: credentials | cookie. Not needed with --cookies-file, which implies cookie." },
|
|
1757
|
+
"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
1758
|
email: { type: "string", description: "LinkedIn email (credentials method)." },
|
|
1144
1759
|
password: { type: "string", description: `LinkedIn password (credentials method). ${PW_WARNING("--password-stdin", "CURVIATE_LINKEDIN_PASSWORD")}` },
|
|
1145
1760
|
"password-stdin": { type: "boolean", description: "Read the LinkedIn password from stdin (one line, trimmed).", default: false },
|
|
@@ -1155,11 +1770,12 @@ var accountLinkCommand = defineCommand({
|
|
|
1155
1770
|
"proxy-username": { type: "string", description: "Proxy auth username." },
|
|
1156
1771
|
"proxy-password": { type: "string", description: `Proxy auth password. ${OPTIONAL_SECRET_WARNING("CURVIATE_PROXY_PASSWORD")}` },
|
|
1157
1772
|
"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
|
|
1773
|
+
"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
1774
|
"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
1775
|
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
1776
|
"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: "
|
|
1777
|
+
timezone: { type: "string", description: "Ignored: the account's time zone follows its connection location. Accepted so existing scripts keep working; nothing is sent." },
|
|
1778
|
+
"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
1779
|
"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
1780
|
"no-interactive": {
|
|
1165
1781
|
type: "boolean",
|
|
@@ -1184,10 +1800,19 @@ var accountLinkCommand = defineCommand({
|
|
|
1184
1800
|
await runAccountLink(client, flags, out);
|
|
1185
1801
|
}
|
|
1186
1802
|
});
|
|
1187
|
-
var accountConnectSessionPollCommand =
|
|
1803
|
+
var accountConnectSessionPollCommand = defineCommand5({
|
|
1188
1804
|
meta: {
|
|
1189
1805
|
name: "poll",
|
|
1190
1806
|
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.",
|
|
1807
|
+
risk: "write",
|
|
1808
|
+
rules: {
|
|
1809
|
+
changes: "Asks for the status of a connect that is still running; with --wait, keeps asking until it ends.",
|
|
1810
|
+
visible_to: "Your Team; a connect that finishes makes the Account available.",
|
|
1811
|
+
budget_rows: [],
|
|
1812
|
+
retry: "Safe: it only asks again.",
|
|
1813
|
+
undo: "Nothing to undo; a connected Account is released with `curviate account disconnect <account_id>`."
|
|
1814
|
+
},
|
|
1815
|
+
errors: { CONNECTION_IN_PROGRESS: "the connect has not ended yet." },
|
|
1191
1816
|
examples: [
|
|
1192
1817
|
"curviate account connect-session poll --session acc_YOUR_ACCOUNT_ID",
|
|
1193
1818
|
"curviate account connect-session poll --session acc_YOUR_ACCOUNT_ID --wait"
|
|
@@ -1230,7 +1855,7 @@ var accountConnectSessionPollCommand = defineCommand({
|
|
|
1230
1855
|
await runAccountConnectSessionPoll(client, flags, out);
|
|
1231
1856
|
}
|
|
1232
1857
|
});
|
|
1233
|
-
var accountConnectSessionCommand =
|
|
1858
|
+
var accountConnectSessionCommand = defineCommand5({
|
|
1234
1859
|
meta: { name: "connect-session", description: "In-progress connect operations (poll for completion)." },
|
|
1235
1860
|
subCommands: {
|
|
1236
1861
|
poll: accountConnectSessionPollCommand
|
|
@@ -1239,10 +1864,19 @@ var accountConnectSessionCommand = defineCommand({
|
|
|
1239
1864
|
process.stderr.write("Usage: curviate account connect-session poll --session <session_id>\n");
|
|
1240
1865
|
}
|
|
1241
1866
|
});
|
|
1242
|
-
var accountUpdateCommand =
|
|
1867
|
+
var accountUpdateCommand = defineCommand5({
|
|
1243
1868
|
meta: {
|
|
1244
1869
|
name: "update",
|
|
1245
|
-
description: "Update an account's metadata, connection location or
|
|
1870
|
+
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.",
|
|
1871
|
+
risk: "write",
|
|
1872
|
+
rules: {
|
|
1873
|
+
changes: "Changes the Account's metadata, connection location, own proxy or Save Connections as Contacts.",
|
|
1874
|
+
visible_to: "Your Team; LinkedIn sees the new location and may ask the owner to verify.",
|
|
1875
|
+
budget_rows: [],
|
|
1876
|
+
retry: "Safe: the same values written again leave the Account the same.",
|
|
1877
|
+
undo: "Run it again with the previous values; metadata is replaced wholesale and the old map is not kept."
|
|
1878
|
+
},
|
|
1879
|
+
errors: { ACCOUNT_NOT_FOUND: "the Account is not in your Team.", CONNECTION_LOCATION_UNAVAILABLE: "no connection is free in that country." },
|
|
1246
1880
|
examples: [
|
|
1247
1881
|
`curviate account update acc_YOUR_ACCOUNT_ID --metadata '{"team":"growth"}'`,
|
|
1248
1882
|
"curviate account update acc_YOUR_ACCOUNT_ID --country DE",
|
|
@@ -1260,7 +1894,8 @@ var accountUpdateCommand = defineCommand({
|
|
|
1260
1894
|
"proxy-host": { type: "string", description: "Your own proxy's host or IP. Not accepted with --country." },
|
|
1261
1895
|
"proxy-port": { type: "string", description: "Proxy port." },
|
|
1262
1896
|
"proxy-username": { type: "string", description: "Proxy auth username." },
|
|
1263
|
-
"proxy-password": { type: "string", description: `Proxy auth password. ${OPTIONAL_SECRET_WARNING("CURVIATE_PROXY_PASSWORD")}` }
|
|
1897
|
+
"proxy-password": { type: "string", description: `Proxy auth password. ${OPTIONAL_SECRET_WARNING("CURVIATE_PROXY_PASSWORD")}` },
|
|
1898
|
+
"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
1899
|
},
|
|
1265
1900
|
async run({ args }) {
|
|
1266
1901
|
const flags = args;
|
|
@@ -1279,7 +1914,7 @@ var accountUpdateCommand = defineCommand({
|
|
|
1279
1914
|
await runAccountUpdate(client, flags, out);
|
|
1280
1915
|
}
|
|
1281
1916
|
});
|
|
1282
|
-
var accountDisconnectCommand =
|
|
1917
|
+
var accountDisconnectCommand = defineCommand5({
|
|
1283
1918
|
meta: {
|
|
1284
1919
|
name: "disconnect",
|
|
1285
1920
|
description: "Hard-disconnect a LinkedIn account and release its seat.",
|
|
@@ -1319,10 +1954,19 @@ var accountDisconnectCommand = defineCommand({
|
|
|
1319
1954
|
await runAccountDisconnect(client, flags, out);
|
|
1320
1955
|
}
|
|
1321
1956
|
});
|
|
1322
|
-
var accountCheckpointSolveCommand =
|
|
1957
|
+
var accountCheckpointSolveCommand = defineCommand5({
|
|
1323
1958
|
meta: {
|
|
1324
1959
|
name: "solve",
|
|
1325
1960
|
description: "Solve a checkpoint challenge with an OTP / 2FA code.",
|
|
1961
|
+
risk: "write",
|
|
1962
|
+
rules: {
|
|
1963
|
+
changes: "Sends the verification code for the Account's pending checkpoint; on success the Account connects.",
|
|
1964
|
+
visible_to: "LinkedIn, and your Team once the Account is connected.",
|
|
1965
|
+
budget_rows: [],
|
|
1966
|
+
retry: "Read `curviate account get <account_id>` first: a wrong code counts against the attempts the checkpoint allows.",
|
|
1967
|
+
undo: "Nothing to undo; disconnect with `curviate account disconnect <account_id>`."
|
|
1968
|
+
},
|
|
1969
|
+
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
1970
|
examples: [
|
|
1327
1971
|
"curviate account checkpoint solve acc_YOUR_ACCOUNT_ID --code 123456"
|
|
1328
1972
|
]
|
|
@@ -1356,10 +2000,19 @@ var accountCheckpointSolveCommand = defineCommand({
|
|
|
1356
2000
|
await runAccountCheckpointSolve(client, flags, out);
|
|
1357
2001
|
}
|
|
1358
2002
|
});
|
|
1359
|
-
var accountCheckpointPollCommand =
|
|
2003
|
+
var accountCheckpointPollCommand = defineCommand5({
|
|
1360
2004
|
meta: {
|
|
1361
2005
|
name: "poll",
|
|
1362
2006
|
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.",
|
|
2007
|
+
risk: "write",
|
|
2008
|
+
rules: {
|
|
2009
|
+
changes: "Asks LinkedIn whether the mobile-app approval has happened; with --wait, keeps asking until it ends.",
|
|
2010
|
+
visible_to: "LinkedIn, and your Team once the Account is connected.",
|
|
2011
|
+
budget_rows: [],
|
|
2012
|
+
retry: "Safe: it only asks again.",
|
|
2013
|
+
undo: "Nothing to undo; disconnect with `curviate account disconnect <account_id>`."
|
|
2014
|
+
},
|
|
2015
|
+
errors: { CHECKPOINT_NOT_FOUND: "the Account has no pending checkpoint.", CHECKPOINT_EXPIRED: "the checkpoint expired: connect again." },
|
|
1363
2016
|
examples: [
|
|
1364
2017
|
"curviate account checkpoint poll acc_YOUR_ACCOUNT_ID",
|
|
1365
2018
|
"curviate account checkpoint poll acc_YOUR_ACCOUNT_ID --wait"
|
|
@@ -1401,10 +2054,19 @@ var accountCheckpointPollCommand = defineCommand({
|
|
|
1401
2054
|
await runAccountCheckpointPoll(client, flags, out);
|
|
1402
2055
|
}
|
|
1403
2056
|
});
|
|
1404
|
-
var accountCheckpointRequestCommand =
|
|
2057
|
+
var accountCheckpointRequestCommand = defineCommand5({
|
|
1405
2058
|
meta: {
|
|
1406
2059
|
name: "request",
|
|
1407
2060
|
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.",
|
|
2061
|
+
risk: "write",
|
|
2062
|
+
rules: {
|
|
2063
|
+
changes: "Asks LinkedIn to send the challenge notification again, or with --challenge picks the verification method.",
|
|
2064
|
+
visible_to: "The Account's owner, who receives a new code or push.",
|
|
2065
|
+
budget_rows: [],
|
|
2066
|
+
retry: "A repeat sends another notification; the answer's `resent` says whether one went out.",
|
|
2067
|
+
undo: "Cannot be undone: the notification is sent."
|
|
2068
|
+
},
|
|
2069
|
+
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
2070
|
examples: [
|
|
1409
2071
|
"curviate account checkpoint request acc_YOUR_ACCOUNT_ID",
|
|
1410
2072
|
"curviate account checkpoint request acc_YOUR_ACCOUNT_ID --challenge sms"
|
|
@@ -1438,7 +2100,7 @@ var accountCheckpointRequestCommand = defineCommand({
|
|
|
1438
2100
|
await runAccountCheckpointRequest(client, flags, out);
|
|
1439
2101
|
}
|
|
1440
2102
|
});
|
|
1441
|
-
var accountCheckpointCommand =
|
|
2103
|
+
var accountCheckpointCommand = defineCommand5({
|
|
1442
2104
|
meta: {
|
|
1443
2105
|
name: "checkpoint",
|
|
1444
2106
|
description: "Checkpoint challenge operations (solve with an OTP, poll mobile-app approval, or re-request the challenge notification)."
|
|
@@ -1452,21 +2114,27 @@ var accountCheckpointCommand = defineCommand({
|
|
|
1452
2114
|
process.stderr.write("Usage: curviate account checkpoint solve <account_id> --code <code> | poll <account_id> | request <account_id>\n");
|
|
1453
2115
|
}
|
|
1454
2116
|
});
|
|
1455
|
-
var accountCommand =
|
|
2117
|
+
var accountCommand = defineCommand5({
|
|
1456
2118
|
meta: { name: "account", description: DESCRIPTIONS.account },
|
|
1457
2119
|
subCommands: {
|
|
1458
2120
|
list: accountListCommand,
|
|
1459
2121
|
get: accountGetCommand,
|
|
1460
2122
|
seats: accountSeatsCommand,
|
|
1461
2123
|
link: accountLinkCommand,
|
|
2124
|
+
"connect-request": connectRequestCommand,
|
|
1462
2125
|
"connect-session": accountConnectSessionCommand,
|
|
1463
2126
|
update: accountUpdateCommand,
|
|
1464
2127
|
disconnect: accountDisconnectCommand,
|
|
1465
|
-
checkpoint: accountCheckpointCommand
|
|
2128
|
+
checkpoint: accountCheckpointCommand,
|
|
2129
|
+
overview: accountOverviewCommand,
|
|
2130
|
+
metrics: accountMetricsCommand,
|
|
2131
|
+
"warm-up": accountWarmUpCommand,
|
|
2132
|
+
safety: accountSafetyCommand,
|
|
2133
|
+
"team-access": accountTeamAccessCommand
|
|
1466
2134
|
},
|
|
1467
2135
|
async run() {
|
|
1468
2136
|
process.stderr.write(
|
|
1469
|
-
"Usage: curviate account <subcommand>\n list | get | seats | link | connect-session poll | update | disconnect | checkpoint\n"
|
|
2137
|
+
"Usage: curviate account <subcommand>\n list | get | seats | link | connect-request | connect-session poll | update | disconnect | checkpoint | overview | metrics | warm-up | safety | team-access\n"
|
|
1470
2138
|
);
|
|
1471
2139
|
}
|
|
1472
2140
|
});
|