@curviate/cli 0.47.0 → 0.49.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 +231 -1
- package/README.md +136 -88
- package/dist/{account-RFJ63QYL.js → account-2BH2Q6VG.js} +41 -31
- package/dist/chunk-3RCW7URJ.js +41 -0
- package/dist/{chunk-UJOTQPL6.js → chunk-5ZGTU4VD.js} +47 -14
- package/dist/chunk-D2S5OCYU.js +38 -0
- package/dist/{chunk-HOQ7EUHJ.js → chunk-FDJMAF7D.js} +1 -0
- package/dist/{chunk-ERBYEC5P.js → chunk-JYKYD57J.js} +1 -1
- package/dist/chunk-MGB6FE4A.js +58 -0
- package/dist/chunk-NNV2OYEF.js +23 -0
- package/dist/{chunk-76SWLAZ6.js → chunk-RXWODUWA.js} +43 -1
- package/dist/{chunk-V3MVOVQT.js → chunk-SA2QHAXG.js} +8 -1
- package/dist/chunk-TEAWYLPO.js +1493 -0
- package/dist/{chunk-PD2I5TYC.js → chunk-V7FJWTZW.js} +3 -3
- package/dist/{chunk-TC4ZPUWI.js → chunk-Y7MZZRYR.js} +21 -80
- package/dist/{chunk-FXYK2GTO.js → chunk-Z7OQSWBD.js} +38 -33
- package/dist/chunk-ZYURL5VK.js +83 -0
- package/dist/cli.js +79 -98
- package/dist/{comment-MCXE7B7V.js → comment-MRDPDA33.js} +29 -24
- package/dist/{company-EUUN372H.js → company-2AEHSGHA.js} +57 -52
- package/dist/{config-K4G3VSBA.js → config-NRBKHXES.js} +13 -5
- package/dist/{connect-2AL7XVJO.js → connect-4XEBV5V3.js} +42 -38
- package/dist/core-RGU2SCBN.js +46 -0
- package/dist/{doctor-WPYI7X2T.js → doctor-BZ4DA7DV.js} +9 -5
- package/dist/document-RKHRWXNT.js +27 -0
- package/dist/{draft-G65DVXT7.js → draft-C5N6EOO5.js} +27 -22
- package/dist/enrollment-BNQOUKI7.js +472 -0
- package/dist/examples-NIMSIXMV.js +53 -0
- package/dist/{exit-codes-AW6KHDDN.js → exit-codes-TLMKTLRI.js} +1 -1
- package/dist/{feed-HV24WME4.js → feed-DFUU7SUJ.js} +15 -11
- package/dist/{group-HADXNVJW.js → group-CSD2OWOZ.js} +17 -13
- package/dist/{inbox-G3EE54OB.js → inbox-SNSPWI7J.js} +23 -19
- package/dist/{inboxes-237XOBTP.js → inboxes-RIRHPS4H.js} +18 -14
- package/dist/{job-LIN6RWD7.js → job-6PNXXZNF.js} +31 -27
- package/dist/{login-OHAHNBRW.js → login-Y7JBAHCW.js} +10 -5
- package/dist/{message-U2O2JQSW.js → message-2IK4MBBG.js} +10 -8
- package/dist/motion-7ATUXO6R.js +946 -0
- package/dist/{notification-3VG32LWM.js → notification-VYK5NDEB.js} +19 -15
- package/dist/{post-ECDK2KJL.js → post-AN6T2OJF.js} +35 -30
- package/dist/{profile-JOHS6SDW.js → profile-UQY64642.js} +46 -42
- package/dist/{recruiter-7VXEIXN3.js → recruiter-OY4RN5HH.js} +122 -119
- package/dist/{sales-nav-K4BMBH7R.js → sales-nav-KLODLYMW.js} +36 -30
- package/dist/{search-C2UYO6PI.js → search-NWP5S6CF.js} +68 -58
- package/dist/{setup-GYEZFDEN.js → setup-YPPFLH2N.js} +14 -9
- package/dist/{webhook-KCOQOH7D.js → webhook-OHKBL3YS.js} +51 -55
- package/package.json +2 -2
- package/dist/chunk-KJ24DIAJ.js +0 -60
- package/dist/examples-IJL3A6SZ.js +0 -18
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
readlineSync
|
|
4
|
-
} from "./chunk-YLSJ4HKU.js";
|
|
5
2
|
import {
|
|
6
3
|
slimAccountGet,
|
|
7
4
|
slimAccountList,
|
|
8
5
|
slimAccountListItem
|
|
9
6
|
} from "./chunk-LCGXJGPB.js";
|
|
7
|
+
import {
|
|
8
|
+
intFlag
|
|
9
|
+
} from "./chunk-NNV2OYEF.js";
|
|
10
10
|
import {
|
|
11
11
|
buildPreviewOutput
|
|
12
12
|
} from "./chunk-TCUYH5GO.js";
|
|
@@ -25,20 +25,28 @@ import {
|
|
|
25
25
|
resolveEffectiveConfig,
|
|
26
26
|
streamAll,
|
|
27
27
|
writeNdjsonItem
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-SA2QHAXG.js";
|
|
29
29
|
import {
|
|
30
30
|
AUTH_NEEDED
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-RXWODUWA.js";
|
|
32
|
+
import {
|
|
33
|
+
readlineSync
|
|
34
|
+
} from "./chunk-YLSJ4HKU.js";
|
|
32
35
|
import {
|
|
33
36
|
createClient
|
|
34
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-5ZGTU4VD.js";
|
|
35
38
|
import {
|
|
36
39
|
GLOBAL_FLAGS,
|
|
37
40
|
READ_SINGLE_FLAGS,
|
|
38
41
|
WRITE_SINGLE_FLAGS,
|
|
39
|
-
defaultReadStdin,
|
|
40
42
|
readOnly
|
|
41
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-Y7MZZRYR.js";
|
|
44
|
+
import {
|
|
45
|
+
DESCRIPTIONS
|
|
46
|
+
} from "./chunk-D2S5OCYU.js";
|
|
47
|
+
import {
|
|
48
|
+
defaultReadStdin
|
|
49
|
+
} from "./chunk-ZYURL5VK.js";
|
|
42
50
|
|
|
43
51
|
// src/commands/account.ts
|
|
44
52
|
import { defineCommand } from "citty";
|
|
@@ -199,7 +207,7 @@ function resolveOutputOpts(flags) {
|
|
|
199
207
|
async function handleError(err, outOpts, out) {
|
|
200
208
|
const { CurviateError } = await import("@curviate/sdk");
|
|
201
209
|
if (err instanceof CurviateError) {
|
|
202
|
-
const { getExitCode } = await import("./exit-codes-
|
|
210
|
+
const { getExitCode } = await import("./exit-codes-TLMKTLRI.js");
|
|
203
211
|
renderError(err, outOpts, out);
|
|
204
212
|
process.exit(getExitCode(err));
|
|
205
213
|
}
|
|
@@ -429,7 +437,7 @@ async function buildAuthBody(flags, ctx) {
|
|
|
429
437
|
body["proxy"] = {
|
|
430
438
|
protocol: flags["proxy-protocol"] ?? "http",
|
|
431
439
|
host: flags["proxy-host"],
|
|
432
|
-
port: flags["proxy-port"] ?
|
|
440
|
+
port: flags["proxy-port"] === void 0 ? 80 : intFlag("proxy-port", flags["proxy-port"], 1, 65535),
|
|
433
441
|
...flags["proxy-username"] ? { username: flags["proxy-username"] } : {},
|
|
434
442
|
...proxyPassword !== void 0 ? { password: proxyPassword } : {}
|
|
435
443
|
};
|
|
@@ -559,7 +567,7 @@ async function runInteractiveCheckpointLoop(client, initial, ctx) {
|
|
|
559
567
|
}
|
|
560
568
|
async function handleAccountConnectResult(client, result, ctx) {
|
|
561
569
|
const envelope = result;
|
|
562
|
-
if (envelope
|
|
570
|
+
if (envelope?.status !== "checkpoint_required") {
|
|
563
571
|
renderSuccess(result, ctx.outOpts, ctx.out);
|
|
564
572
|
return;
|
|
565
573
|
}
|
|
@@ -735,16 +743,15 @@ function printConnectSessionResolved(result, ctx) {
|
|
|
735
743
|
}
|
|
736
744
|
function resolveWaitTimeoutOverrideMs(flags, out) {
|
|
737
745
|
if (flags.timeout === void 0) return void 0;
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
out.stderr.write("error: --timeout must be a number of milliseconds.\n");
|
|
746
|
+
if (!/^[1-9]\d*$/.test(flags.timeout) || Number(flags.timeout) > 2147483647) {
|
|
747
|
+
out.stderr.write("error: --timeout must be a whole number of milliseconds, from 1 to 2147483647.\n");
|
|
741
748
|
process.exit(2);
|
|
742
749
|
}
|
|
743
|
-
return
|
|
750
|
+
return Number(flags.timeout);
|
|
744
751
|
}
|
|
745
752
|
async function runAccountConnectSessionPoll(client, flags, out, io = {}) {
|
|
746
753
|
if (!flags.session) {
|
|
747
|
-
out.stderr.write("error: --session is required (the account's acc_... id from `account link` or a checkpoint response).\n");
|
|
754
|
+
out.stderr.write("error: --session is required (the account's acc_... id from `curviate account link` or a checkpoint response).\n");
|
|
748
755
|
process.exit(2);
|
|
749
756
|
}
|
|
750
757
|
const sessionId = flags.session;
|
|
@@ -843,7 +850,7 @@ async function runAccountUpdate(client, flags, out) {
|
|
|
843
850
|
body["proxy"] = {
|
|
844
851
|
protocol: flags["proxy-protocol"] ?? "http",
|
|
845
852
|
host: flags["proxy-host"],
|
|
846
|
-
port: flags["proxy-port"] ?
|
|
853
|
+
port: flags["proxy-port"] === void 0 ? 80 : intFlag("proxy-port", flags["proxy-port"], 1, 65535),
|
|
847
854
|
...flags["proxy-username"] ? { username: flags["proxy-username"] } : {},
|
|
848
855
|
...proxyPassword !== void 0 ? { password: proxyPassword } : {}
|
|
849
856
|
};
|
|
@@ -992,15 +999,7 @@ async function runAccountCheckpointPoll(client, flags, out, io = {}) {
|
|
|
992
999
|
}
|
|
993
1000
|
return;
|
|
994
1001
|
}
|
|
995
|
-
|
|
996
|
-
if (flags.timeout !== void 0) {
|
|
997
|
-
const parsed = Number(flags.timeout);
|
|
998
|
-
if (Number.isNaN(parsed)) {
|
|
999
|
-
out.stderr.write("error: --timeout must be a number of milliseconds.\n");
|
|
1000
|
-
process.exit(2);
|
|
1001
|
-
}
|
|
1002
|
-
timeoutOverrideMs = parsed;
|
|
1003
|
-
}
|
|
1002
|
+
const timeoutOverrideMs = resolveWaitTimeoutOverrideMs(flags, out);
|
|
1004
1003
|
const resolvedIo = resolveCredentialIO(io);
|
|
1005
1004
|
const showTicker = resolvedIo.isOutputTTY && !(flags.json ?? false);
|
|
1006
1005
|
printResendHintIfApplicable("mobile_app_approval", accountId, out);
|
|
@@ -1159,7 +1158,7 @@ var accountLinkCommand = defineCommand({
|
|
|
1159
1158
|
"recruiter-contract-id": { type: "string", description: "Recruiter contract to bind to. Only meaningful when the LinkedIn account holds a Recruiter subscription." },
|
|
1160
1159
|
"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." },
|
|
1161
1160
|
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." },
|
|
1162
|
-
"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 `account list --external-id`. Use an opaque id, not an email." },
|
|
1161
|
+
"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." },
|
|
1163
1162
|
timezone: { type: "string", description: "IANA time zone for the account, e.g. Europe/Berlin. A UTC offset is refused." },
|
|
1164
1163
|
"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." },
|
|
1165
1164
|
"no-interactive": {
|
|
@@ -1188,7 +1187,7 @@ var accountLinkCommand = defineCommand({
|
|
|
1188
1187
|
var accountConnectSessionPollCommand = defineCommand({
|
|
1189
1188
|
meta: {
|
|
1190
1189
|
name: "poll",
|
|
1191
|
-
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 `account link` until a terminal state.",
|
|
1190
|
+
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.",
|
|
1192
1191
|
examples: [
|
|
1193
1192
|
"curviate account connect-session poll --session acc_YOUR_ACCOUNT_ID",
|
|
1194
1193
|
"curviate account connect-session poll --session acc_YOUR_ACCOUNT_ID --wait"
|
|
@@ -1198,7 +1197,7 @@ var accountConnectSessionPollCommand = defineCommand({
|
|
|
1198
1197
|
...WRITE_SINGLE_FLAGS,
|
|
1199
1198
|
session: {
|
|
1200
1199
|
type: "string",
|
|
1201
|
-
description: "The account's acc_... id, returned by `account link` or a checkpoint response.",
|
|
1200
|
+
description: "The account's acc_... id, returned by `curviate account link` or a checkpoint response.",
|
|
1202
1201
|
required: true
|
|
1203
1202
|
},
|
|
1204
1203
|
wait: {
|
|
@@ -1284,6 +1283,17 @@ var accountDisconnectCommand = defineCommand({
|
|
|
1284
1283
|
meta: {
|
|
1285
1284
|
name: "disconnect",
|
|
1286
1285
|
description: "Hard-disconnect a LinkedIn account and release its seat.",
|
|
1286
|
+
risk: "high",
|
|
1287
|
+
rules: {
|
|
1288
|
+
changes: "The Account is disconnected and deleted from Curviate, its seat is released, and its stored data goes with it.",
|
|
1289
|
+
visible_to: "Everyone using this workspace's key: the Account disappears from `curviate account list`. Nothing is posted on LinkedIn.",
|
|
1290
|
+
budget_rows: [],
|
|
1291
|
+
retry: "A retry after success answers ACCOUNT_NOT_FOUND; read `curviate account list` first.",
|
|
1292
|
+
undo: "Cannot be undone. Link the LinkedIn account again with `curviate account link`; history does not come back.",
|
|
1293
|
+
blast_radius: "One Account and everything stored for it."
|
|
1294
|
+
},
|
|
1295
|
+
errors: { ACCOUNT_NOT_FOUND: "no Account with this id (already disconnected, or another workspace's)." },
|
|
1296
|
+
seeAlso: ["curviate account list", "curviate account link"],
|
|
1287
1297
|
examples: [
|
|
1288
1298
|
"curviate account disconnect acc_YOUR_ACCOUNT_ID"
|
|
1289
1299
|
]
|
|
@@ -1408,7 +1418,7 @@ var accountCheckpointRequestCommand = defineCommand({
|
|
|
1408
1418
|
},
|
|
1409
1419
|
challenge: {
|
|
1410
1420
|
type: "string",
|
|
1411
|
-
description: "Answer a challenge_selection checkpoint: an id from its challenges list (email | sms | whatsapp). Prints the next checkpoint and exits 12; solve it with `checkpoint solve`. Omit to re-send the current code."
|
|
1421
|
+
description: "Answer a challenge_selection checkpoint: an id from its challenges list (email | sms | whatsapp). Prints the next checkpoint and exits 12; solve it with `curviate account checkpoint solve`. Omit to re-send the current code."
|
|
1412
1422
|
}
|
|
1413
1423
|
},
|
|
1414
1424
|
async run({ args }) {
|
|
@@ -1443,7 +1453,7 @@ var accountCheckpointCommand = defineCommand({
|
|
|
1443
1453
|
}
|
|
1444
1454
|
});
|
|
1445
1455
|
var accountCommand = defineCommand({
|
|
1446
|
-
meta: { name: "account", description:
|
|
1456
|
+
meta: { name: "account", description: DESCRIPTIONS.account },
|
|
1447
1457
|
subCommands: {
|
|
1448
1458
|
list: accountListCommand,
|
|
1449
1459
|
get: accountGetCommand,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
parseDocument,
|
|
4
|
+
readFileFlag,
|
|
5
|
+
readStdinCapped
|
|
6
|
+
} from "./chunk-TEAWYLPO.js";
|
|
7
|
+
import {
|
|
8
|
+
isStdinToken
|
|
9
|
+
} from "./chunk-ZYURL5VK.js";
|
|
10
|
+
|
|
11
|
+
// src/lib/search-filters.ts
|
|
12
|
+
var DEFAULT_FILTER_READERS = { readStdin: () => readStdinCapped("filters") };
|
|
13
|
+
async function assembleFilters(flags, readers = DEFAULT_FILTER_READERS) {
|
|
14
|
+
let raw;
|
|
15
|
+
let source;
|
|
16
|
+
if (flags["filters-file"] !== void 0) {
|
|
17
|
+
source = "--filters-file";
|
|
18
|
+
raw = await readFileFlag("filters-file", flags["filters-file"], { readStdin: readers === DEFAULT_FILTER_READERS ? void 0 : readers.readStdin, others: { filters: flags.filters } });
|
|
19
|
+
} else if (isStdinToken(flags.filters)) {
|
|
20
|
+
source = "--filters - (stdin)";
|
|
21
|
+
raw = await readers.readStdin();
|
|
22
|
+
} else if (flags.filters !== void 0) {
|
|
23
|
+
source = "--filters";
|
|
24
|
+
raw = flags.filters;
|
|
25
|
+
}
|
|
26
|
+
if (raw === void 0) return { body: {} };
|
|
27
|
+
const parsed = parseDocument(source === "--filters-file" ? "filters-file" : "filters", raw);
|
|
28
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
29
|
+
return { error: `${source} must be a JSON object` };
|
|
30
|
+
}
|
|
31
|
+
return { body: parsed };
|
|
32
|
+
}
|
|
33
|
+
function splitCsv(value) {
|
|
34
|
+
return value.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
DEFAULT_FILTER_READERS,
|
|
39
|
+
assembleFilters,
|
|
40
|
+
splitCsv
|
|
41
|
+
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
betaOverrideHeader,
|
|
4
|
+
getRecheck,
|
|
5
|
+
getWriteKind,
|
|
6
|
+
isPoll
|
|
7
|
+
} from "./chunk-Y7MZZRYR.js";
|
|
8
|
+
import {
|
|
9
|
+
assertNoStdinPlaceholder
|
|
10
|
+
} from "./chunk-ZYURL5VK.js";
|
|
6
11
|
|
|
7
12
|
// src/lib/config.ts
|
|
8
13
|
import {
|
|
@@ -219,7 +224,8 @@ var guardedFetch = async (input, init) => {
|
|
|
219
224
|
typeof merged?.body === "string" ? merged.body : void 0
|
|
220
225
|
]);
|
|
221
226
|
const res = await fetch(input, merged);
|
|
222
|
-
|
|
227
|
+
const method = (merged?.method ?? (input instanceof Request ? input.method : "GET")).toUpperCase();
|
|
228
|
+
return downloading.getStore() && res.ok ? asOpaqueBytes(res) : platformFaultIfUnreadable(res, getWriteKind() === "state" ? "state" : method === "GET" ? "read" : getWriteKind());
|
|
223
229
|
};
|
|
224
230
|
var downloading = new AsyncLocalStorage();
|
|
225
231
|
function downloadBinary(call) {
|
|
@@ -230,7 +236,7 @@ function asOpaqueBytes(res) {
|
|
|
230
236
|
headers.set("content-type", "application/octet-stream");
|
|
231
237
|
return new Response(res.body, { status: res.status, statusText: res.statusText, headers });
|
|
232
238
|
}
|
|
233
|
-
async function platformFaultIfUnreadable(res) {
|
|
239
|
+
async function platformFaultIfUnreadable(res, kind) {
|
|
234
240
|
const text = res.status === 204 ? "" : await res.clone().text();
|
|
235
241
|
let parsed = true;
|
|
236
242
|
let env = null;
|
|
@@ -239,30 +245,57 @@ async function platformFaultIfUnreadable(res) {
|
|
|
239
245
|
} catch {
|
|
240
246
|
parsed = false;
|
|
241
247
|
}
|
|
248
|
+
if (res.ok && kind === "write") return acceptedWrite(res, text, parsed ? env : void 0);
|
|
249
|
+
if (res.ok && kind === "state" && !(env !== null && typeof env === "object" && !Array.isArray(env) && Object.keys(env).length > 0)) {
|
|
250
|
+
return fault(res, `The API answered ${res.status} without a readable body. The request may have been applied: check with \`${getRecheck()}\` before sending it again.`, false);
|
|
251
|
+
}
|
|
242
252
|
if (res.status >= 500) {
|
|
243
253
|
if (typeof env?.code === "string") return res;
|
|
244
254
|
} else if (!res.ok || parsed) {
|
|
245
255
|
return res;
|
|
246
256
|
} else if (text === "") {
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
return new Response(null, { status: res.status, statusText: res.statusText, headers
|
|
257
|
+
const headers = new Headers(res.headers);
|
|
258
|
+
headers.delete("content-type");
|
|
259
|
+
return new Response(null, { status: res.status, statusText: res.statusText, headers });
|
|
250
260
|
}
|
|
261
|
+
if (kind !== "read" && !isPoll()) {
|
|
262
|
+
const check = kind === "state" ? `check with \`${getRecheck()}\`` : "read the current state";
|
|
263
|
+
return fault(res, `The API answered ${res.status} without a readable body. The request may have been applied: ${check} before sending it again.`, false);
|
|
264
|
+
}
|
|
265
|
+
return fault(res, `The API answered ${res.status} without a readable body.`, true);
|
|
266
|
+
}
|
|
267
|
+
function fault(res, message, retryLikely) {
|
|
251
268
|
const headers = new Headers(res.headers);
|
|
252
269
|
headers.set("content-type", "application/json");
|
|
253
270
|
headers.delete("content-length");
|
|
254
271
|
headers.delete("content-encoding");
|
|
255
272
|
return new Response(
|
|
256
|
-
JSON.stringify({
|
|
257
|
-
code: "PLATFORM_ERROR",
|
|
258
|
-
message: `The API answered ${res.status} without a readable body.`,
|
|
259
|
-
user_fixable: false,
|
|
260
|
-
retry_likely_to_succeed: true
|
|
261
|
-
}),
|
|
273
|
+
JSON.stringify({ code: "PLATFORM_ERROR", message, user_fixable: false, retry_likely_to_succeed: retryLikely }),
|
|
262
274
|
// A 2xx has to become an error status for the SDK to decode it as one.
|
|
263
275
|
{ status: res.status >= 500 ? res.status : 502, statusText: res.statusText, headers }
|
|
264
276
|
);
|
|
265
277
|
}
|
|
278
|
+
function acceptedWrite(res, text, body) {
|
|
279
|
+
if (res.status === 204 || text === "") {
|
|
280
|
+
if (res.status !== 204) process.stderr.write(`warning: the API accepted this write (HTTP ${res.status}) with an empty body. The write happened: do not retry it.
|
|
281
|
+
`);
|
|
282
|
+
const headers2 = new Headers(res.headers);
|
|
283
|
+
headers2.delete("content-type");
|
|
284
|
+
return new Response(null, { status: res.status, statusText: res.statusText, headers: headers2 });
|
|
285
|
+
}
|
|
286
|
+
const expected = body !== null && typeof body === "object" && !Array.isArray(body) && "object" in body;
|
|
287
|
+
if (!expected) {
|
|
288
|
+
const what = body === void 0 ? "a body that is not JSON" : "a body of an unexpected shape";
|
|
289
|
+
process.stderr.write(`warning: the API accepted this write (HTTP ${res.status}) with ${what}. The write happened: do not retry it.
|
|
290
|
+
`);
|
|
291
|
+
}
|
|
292
|
+
if (body !== void 0) return res;
|
|
293
|
+
const headers = new Headers(res.headers);
|
|
294
|
+
headers.set("content-type", "application/json");
|
|
295
|
+
headers.delete("content-length");
|
|
296
|
+
headers.delete("content-encoding");
|
|
297
|
+
return new Response("{}", { status: res.status, statusText: res.statusText, headers });
|
|
298
|
+
}
|
|
266
299
|
function usage(message) {
|
|
267
300
|
return new CurviateError2({ code: "INVALID_REQUEST", message, userFixable: true, retryLikelyToSucceed: false });
|
|
268
301
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/commands/descriptions.ts
|
|
4
|
+
var DESCRIPTIONS = {
|
|
5
|
+
setup: "Connect this machine to your workspace: opens the dashboard, takes the code it shows you, and saves an API key.",
|
|
6
|
+
doctor: "Check that this machine can call the API: config, credential source, workspace, reachability and connected accounts.",
|
|
7
|
+
login: "Save an API key to a local profile. Run `curviate core profile me` to verify.",
|
|
8
|
+
config: "Manage CLI profiles and settings.",
|
|
9
|
+
account: "LinkedIn account connection management.",
|
|
10
|
+
motion: "Motions: one Sequence run for the Contacts of your Team's Contact lists, from its sending Accounts, paced on a schedule. Create and edit drafts, preview, start, pause, resume, archive, add or remove Contacts; lint a Sequence and write a template offline. Your Team's data: every role reads; writes need motion-send on each sending Account, and Motions need the Automate plan.",
|
|
11
|
+
enrollment: "Enrollments: one Contact in one Motion on one Account. List and read them; pause, resume, retry a failed Step, stop, send a custom event, reassign, or act on many at once. Your Team's data: every role reads; writes need operate on the Enrollment's Account.",
|
|
12
|
+
webhook: "Webhook management and signature verification.",
|
|
13
|
+
core: "Curviate core: LinkedIn building blocks. Each command runs one action now, from one Account, and counts against that Account's budgets. Nothing is queued, paced or retried for you, except a Draft scheduled with `--schedule-at`, which Curviate publishes at that time (`curviate core draft create`).",
|
|
14
|
+
profile: "LinkedIn profile operations.",
|
|
15
|
+
company: "Fetch a company profile by URL, slug, or numeric id, and its sub-resources.",
|
|
16
|
+
job: "Classic LinkedIn job-posting operations.",
|
|
17
|
+
connect: "Send or manage connection invitations. Connection requests may take 10-30 seconds to appear in the recipient's received list (LinkedIn propagation delay).",
|
|
18
|
+
search: "Search people, companies, posts, and jobs. Also runs a pasted search URL directly.",
|
|
19
|
+
inbox: "Read LinkedIn message inbox.",
|
|
20
|
+
inboxes: "Discover LinkedIn inboxes (personal + company pages) and list their conversations. Beta. See also: `curviate core inbox` (the account's own message-thread inbox), `curviate core message send` (reply to a chat).",
|
|
21
|
+
message: "Send and manage LinkedIn messages. A COMPANY_ chat id (from `curviate core inboxes chats`) sends as that company page instead of yourself; see `curviate core message send --help`.",
|
|
22
|
+
post: "Create and manage LinkedIn posts.",
|
|
23
|
+
comment: "Comment-thread operations (list, add, reply, edit, delete, react).",
|
|
24
|
+
"sales-nav": "Beta. Sales Navigator operations. Needs the LinkedIn account's own Sales Navigator subscription; no Curviate add-on. Beta operations can require consent: a human enables beta in Settings, or pass --beta for this call.",
|
|
25
|
+
recruiter: "Beta. LinkedIn Recruiter operations. Needs the LinkedIn account's own Recruiter subscription; no Curviate add-on. Beta operations can require consent: a human enables beta in Settings, or pass --beta for this call.",
|
|
26
|
+
group: "Read LinkedIn groups: your own membership list, one group's detail, and its member roster.",
|
|
27
|
+
feed: "Read the connected account's LinkedIn home feed as agent-actionable posts.",
|
|
28
|
+
notification: "Read and act on LinkedIn notification cards.",
|
|
29
|
+
draft: "Drafts and scheduled posts."
|
|
30
|
+
};
|
|
31
|
+
function lazy(name, load) {
|
|
32
|
+
return Object.assign(load, { description: DESCRIPTIONS[name] });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
DESCRIPTIONS,
|
|
37
|
+
lazy
|
|
38
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
renderError,
|
|
4
|
+
renderUnexpectedError,
|
|
5
|
+
resolveEffectiveConfig
|
|
6
|
+
} from "./chunk-SA2QHAXG.js";
|
|
7
|
+
import {
|
|
8
|
+
createClient
|
|
9
|
+
} from "./chunk-5ZGTU4VD.js";
|
|
10
|
+
|
|
11
|
+
// src/lib/root-command.ts
|
|
12
|
+
var outputOpts = (f) => ({
|
|
13
|
+
json: (f.json ?? false) || !process.stdout.isTTY,
|
|
14
|
+
isTTY: process.stdout.isTTY ?? false,
|
|
15
|
+
fields: f.fields,
|
|
16
|
+
verbose: f.verbose
|
|
17
|
+
});
|
|
18
|
+
function usage(message) {
|
|
19
|
+
process.stderr.write(`error: ${message}
|
|
20
|
+
`);
|
|
21
|
+
process.exit(2);
|
|
22
|
+
}
|
|
23
|
+
async function rootClient(f) {
|
|
24
|
+
const cfg = await resolveEffectiveConfig({ apiKey: f["api-key"], baseUrl: f["base-url"], timeout: f.timeout, profile: f.profile });
|
|
25
|
+
if (!cfg.apiKey) {
|
|
26
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
27
|
+
process.exit(3);
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
return createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
31
|
+
} catch (err) {
|
|
32
|
+
return fail(err, f);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async function fail(err, f) {
|
|
36
|
+
const { CurviateError } = await import("@curviate/sdk");
|
|
37
|
+
if (err instanceof CurviateError) {
|
|
38
|
+
const { getExitCode } = await import("./exit-codes-TLMKTLRI.js");
|
|
39
|
+
renderError(err, outputOpts(f), process);
|
|
40
|
+
process.exit(getExitCode(err));
|
|
41
|
+
}
|
|
42
|
+
renderUnexpectedError(err, process);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
function listFlag(flag, raw) {
|
|
46
|
+
if (raw === void 0) return [];
|
|
47
|
+
const ids = [].concat(raw).flatMap((v) => v.split(",")).map((s) => s.trim());
|
|
48
|
+
if (ids.length === 0 || ids.some((s) => s === "")) usage(`--${flag} was given an empty value. Pass one or more ids, comma-separated or with --${flag} repeated.`);
|
|
49
|
+
return ids;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
outputOpts,
|
|
54
|
+
usage,
|
|
55
|
+
rootClient,
|
|
56
|
+
fail,
|
|
57
|
+
listFlag
|
|
58
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/lib/int-flag.ts
|
|
4
|
+
function intFlag(flag, raw, min = 1, max = Number.MAX_SAFE_INTEGER) {
|
|
5
|
+
const n = /^\d+$/.test(raw) ? Number(raw) : NaN;
|
|
6
|
+
if (n >= min && n <= max) return n;
|
|
7
|
+
const range = max === Number.MAX_SAFE_INTEGER ? `${min} or more` : `from ${min} to ${max}`;
|
|
8
|
+
process.stderr.write(`error: --${flag} must be a whole number, ${range}.
|
|
9
|
+
`);
|
|
10
|
+
process.exit(2);
|
|
11
|
+
}
|
|
12
|
+
function intListFlag(flag, raw, min = 1, max = Number.MAX_SAFE_INTEGER) {
|
|
13
|
+
const n = raw.split(",").map((s) => s.trim()).map((s) => /^\d+$/.test(s) ? Number(s) : NaN);
|
|
14
|
+
if (n.length > 0 && n.every((x) => x >= min && x <= max)) return n;
|
|
15
|
+
process.stderr.write(`error: --${flag} takes comma-separated whole numbers, each from ${min} to ${max}.
|
|
16
|
+
`);
|
|
17
|
+
process.exit(2);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
intFlag,
|
|
22
|
+
intListFlag
|
|
23
|
+
};
|
|
@@ -156,7 +156,49 @@ var EXIT_CODE_MAP = {
|
|
|
156
156
|
// takes the same bucket. Not 7, which tells the caller to retry with
|
|
157
157
|
// backoff. Not 11, which tells the caller the tenant's billing is at fault,
|
|
158
158
|
// and here it is not. The `--json` envelope still names the real code.
|
|
159
|
-
STRIPE_DRIFT_DETECTED: 1
|
|
159
|
+
STRIPE_DRIFT_DETECTED: 1,
|
|
160
|
+
// Teams: the credential is valid, a person with the right
|
|
161
|
+
// role, or the Account's own person, must act first (5, never 3, which tells
|
|
162
|
+
// a script to rotate its key). The credential is another team's: 3. The
|
|
163
|
+
// rest never succeed as sent: 2. TIER_REQUIRED joins the entitlement bucket.
|
|
164
|
+
INSUFFICIENT_ROLE: 5,
|
|
165
|
+
ACCOUNT_NOT_SHARED: 5,
|
|
166
|
+
ACCOUNT_OWNER_ONLY: 5,
|
|
167
|
+
BILLING_OWNER_REQUIRED: 5,
|
|
168
|
+
LAST_OWNER: 5,
|
|
169
|
+
TIER_REQUIRED: 5,
|
|
170
|
+
TEAM_ACCESS_DENIED: 3,
|
|
171
|
+
DEFAULT_TEAM_PROTECTED: 2,
|
|
172
|
+
ALREADY_MEMBER: 2,
|
|
173
|
+
INVITE_ALREADY_PENDING: 2,
|
|
174
|
+
INVITE_NOT_PENDING: 2,
|
|
175
|
+
INVITE_LIMIT_REACHED: 2,
|
|
176
|
+
CONNECT_REQUEST_NOT_PENDING: 2,
|
|
177
|
+
CONNECT_REQUEST_IN_USE: 2,
|
|
178
|
+
LINKEDIN_ACCOUNT_MISMATCH: 8,
|
|
179
|
+
// Contacts: a cap or a name clash never succeeds as sent; a full import queue drains (6).
|
|
180
|
+
NAME_TAKEN: 2,
|
|
181
|
+
RESOURCE_IN_USE: 2,
|
|
182
|
+
CONTACT_LIMIT_REACHED: 2,
|
|
183
|
+
IMPORT_QUEUE_FULL: 6,
|
|
184
|
+
// Motions and Enrollments. Every refusal but one never succeeds as
|
|
185
|
+
// sent (2): fix the document, merge the newer Sequence, or pick another
|
|
186
|
+
// Enrollment or Account. STEP_IN_FLIGHT settles within a minute (7, the
|
|
187
|
+
// DRAFT_PUBLISHING precedent: read again, then retry).
|
|
188
|
+
SEQUENCE_INVALID: 2,
|
|
189
|
+
SEQUENCE_CONFLICT: 2,
|
|
190
|
+
MOTION_NOT_STARTABLE: 2,
|
|
191
|
+
MOTION_STATUS_CONFLICT: 2,
|
|
192
|
+
ENROLLMENT_NOT_ACTIVE: 2,
|
|
193
|
+
NOTHING_TO_RETRY: 2,
|
|
194
|
+
ACCOUNT_ALREADY_ENGAGED: 2,
|
|
195
|
+
ALREADY_ENROLLED_ON_ACCOUNT: 2,
|
|
196
|
+
KNOWN_CHAT: 2,
|
|
197
|
+
CONTACT_NOT_ENROLLABLE: 2,
|
|
198
|
+
CHAT_NOT_ONE_TO_ONE: 2,
|
|
199
|
+
STEP_IN_FLIGHT: 7,
|
|
200
|
+
// Client-side: no response within --timeout. Transient, as a refused connection is.
|
|
201
|
+
CLIENT_TIMEOUT: 7
|
|
160
202
|
};
|
|
161
203
|
function getExitCode(error) {
|
|
162
204
|
if (typeof error === "string") return EXIT_CODE_MAP[error] ?? 1;
|
|
@@ -3,7 +3,10 @@ import {
|
|
|
3
3
|
isPlainObject,
|
|
4
4
|
profileValue,
|
|
5
5
|
readConfigFile
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5ZGTU4VD.js";
|
|
7
|
+
import {
|
|
8
|
+
isStdinToken
|
|
9
|
+
} from "./chunk-ZYURL5VK.js";
|
|
7
10
|
|
|
8
11
|
// src/lib/output.ts
|
|
9
12
|
function isJsonMode(opts) {
|
|
@@ -380,6 +383,10 @@ var DEFAULT_TIMEOUT_MS = 3e4;
|
|
|
380
383
|
async function resolveEffectiveConfig(flags) {
|
|
381
384
|
const file = await readConfigFile();
|
|
382
385
|
const fromProfile = (field) => profileValue(file, flags.profile, field);
|
|
386
|
+
if (isStdinToken(flags.apiKey)) {
|
|
387
|
+
process.stderr.write("error: --api-key - reads stdin only on `curviate login`. Set CURVIATE_API_KEY, or save the key with `curviate login --api-key -`.\n");
|
|
388
|
+
process.exit(2);
|
|
389
|
+
}
|
|
383
390
|
const profileKey = flags.apiKey === void 0 && process.env["CURVIATE_API_KEY"] === void 0 ? fromProfile("apiKey") : void 0;
|
|
384
391
|
const apiKey = flags.apiKey ?? process.env["CURVIATE_API_KEY"] ?? profileKey;
|
|
385
392
|
const apiKeySource = flags.apiKey !== void 0 ? "flag" : process.env["CURVIATE_API_KEY"] !== void 0 ? "env" : profileKey !== void 0 ? "profile" : "none";
|