@curviate/cli 0.46.1 → 0.48.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +199 -1
  2. package/README.md +124 -77
  3. package/dist/{account-O5UX5UAH.js → account-WKQHMM7P.js} +41 -31
  4. package/dist/{chunk-BGZW6B7G.js → chunk-5I6JJJIV.js} +1 -0
  5. package/dist/{chunk-76E3O6HY.js → chunk-76SWLAZ6.js} +13 -0
  6. package/dist/chunk-AYKKXGTR.js +1141 -0
  7. package/dist/{chunk-TC4ZPUWI.js → chunk-CVMSQ3OF.js} +19 -80
  8. package/dist/{chunk-HOQ7EUHJ.js → chunk-FDJMAF7D.js} +1 -0
  9. package/dist/chunk-GQKC6E5K.js +36 -0
  10. package/dist/{chunk-FXF5FF3W.js → chunk-MKGVNDMJ.js} +10 -2
  11. package/dist/chunk-NNV2OYEF.js +23 -0
  12. package/dist/{chunk-UJOTQPL6.js → chunk-OHXYFICP.js} +47 -14
  13. package/dist/{chunk-2FECYCAC.js → chunk-Q63IIPL2.js} +3 -3
  14. package/dist/chunk-TSOIZBBU.js +41 -0
  15. package/dist/{chunk-DGIDAO2H.js → chunk-Y7K4UBFC.js} +1 -1
  16. package/dist/{chunk-LD6WPZZM.js → chunk-YFXLXION.js} +39 -34
  17. package/dist/chunk-ZYURL5VK.js +83 -0
  18. package/dist/cli.js +77 -97
  19. package/dist/{comment-BKGVJYS2.js → comment-7IQ6ZOJF.js} +30 -25
  20. package/dist/{company-F2AZTDPK.js → company-RD7RDGSA.js} +58 -53
  21. package/dist/{config-K4G3VSBA.js → config-EYBNYRGK.js} +13 -5
  22. package/dist/{connect-TX6PT7NV.js → connect-HVXT67A6.js} +42 -38
  23. package/dist/core-6XYGUNAY.js +46 -0
  24. package/dist/{doctor-USTZQ75D.js → doctor-HUXQERLQ.js} +9 -5
  25. package/dist/document-AUUCGST2.js +27 -0
  26. package/dist/draft-DFO22K6Q.js +463 -0
  27. package/dist/examples-64YT5V5K.js +53 -0
  28. package/dist/{exit-codes-TMAIV7EM.js → exit-codes-AW6KHDDN.js} +1 -1
  29. package/dist/{feed-ANBPRGFQ.js → feed-JWP6ANPI.js} +15 -11
  30. package/dist/{group-HFF7LDDQ.js → group-SIQFJEZV.js} +17 -13
  31. package/dist/{inbox-XQMGW6RT.js → inbox-MMIMCA5O.js} +23 -19
  32. package/dist/{inboxes-CILMIVVD.js → inboxes-RND3D4C7.js} +18 -14
  33. package/dist/{job-TOJDDJ2P.js → job-ACFKBLFK.js} +31 -27
  34. package/dist/{login-OHAHNBRW.js → login-ZOB5KVKQ.js} +10 -5
  35. package/dist/{message-WCBNBPAJ.js → message-OFK6UVXR.js} +10 -8
  36. package/dist/{notification-CJ3LEHFL.js → notification-KKGAZU7M.js} +19 -15
  37. package/dist/{post-OQWJRL4B.js → post-A5SBCFB2.js} +36 -31
  38. package/dist/{profile-GT6ZD37M.js → profile-4SOOQZ4K.js} +52 -48
  39. package/dist/{recruiter-ZKWG6QG3.js → recruiter-YN73STDP.js} +125 -122
  40. package/dist/{sales-nav-WV3YHYD6.js → sales-nav-JXF5RY2K.js} +41 -35
  41. package/dist/{search-VAZEQ2WJ.js → search-JAL242A2.js} +68 -58
  42. package/dist/{setup-GGXMHXAF.js → setup-WICWH4JG.js} +14 -9
  43. package/dist/{webhook-5M47UX6U.js → webhook-UGKVYWBC.js} +40 -42
  44. package/package.json +2 -2
  45. package/dist/chunk-KJ24DIAJ.js +0 -60
  46. 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-FXF5FF3W.js";
28
+ } from "./chunk-MKGVNDMJ.js";
29
29
  import {
30
30
  AUTH_NEEDED
31
- } from "./chunk-76E3O6HY.js";
31
+ } from "./chunk-76SWLAZ6.js";
32
+ import {
33
+ readlineSync
34
+ } from "./chunk-YLSJ4HKU.js";
32
35
  import {
33
36
  createClient
34
- } from "./chunk-UJOTQPL6.js";
37
+ } from "./chunk-OHXYFICP.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-TC4ZPUWI.js";
43
+ } from "./chunk-CVMSQ3OF.js";
44
+ import {
45
+ DESCRIPTIONS
46
+ } from "./chunk-GQKC6E5K.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-TMAIV7EM.js");
210
+ const { getExitCode } = await import("./exit-codes-AW6KHDDN.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"] ? parseInt(flags["proxy-port"], 10) : 80,
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.status !== "checkpoint_required") {
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
- const parsed = Number(flags.timeout);
739
- if (Number.isNaN(parsed)) {
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 parsed;
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"] ? parseInt(flags["proxy-port"], 10) : 80,
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
- let timeoutOverrideMs;
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: "LinkedIn account connection management." },
1456
+ meta: { name: "account", description: DESCRIPTIONS.account },
1447
1457
  subCommands: {
1448
1458
  list: accountListCommand,
1449
1459
  get: accountGetCommand,
@@ -55,5 +55,6 @@ export {
55
55
  AttachError,
56
56
  readAttachment,
57
57
  describeAttachment,
58
+ guessContentType,
58
59
  toAttachmentPayload
59
60
  };
@@ -20,6 +20,16 @@ var EXIT_CODE_MAP = {
20
20
  // a country). `account link` refuses this itself before any request with the
21
21
  // same exit, so the API's 400 and the CLI's own guard read alike.
22
22
  CONNECTION_LOCATION_REQUIRED: 2,
23
+ // 2: Draft refusals the caller fixes by changing the request, none of which
24
+ // clears on an unchanged retry: the bucket is full (`DRAFT_LIMIT_REACHED`),
25
+ // the media quota is used (`MEDIA_QUOTA_EXCEEDED`), the Draft has no account
26
+ // (`ACCOUNT_REQUIRED`), a content gap (`DRAFT_NOT_PUBLISHABLE`), or another
27
+ // scheduled Draft is within 5 minutes (`SCHEDULE_CONFLICT`).
28
+ DRAFT_LIMIT_REACHED: 2,
29
+ MEDIA_QUOTA_EXCEEDED: 2,
30
+ ACCOUNT_REQUIRED: 2,
31
+ DRAFT_NOT_PUBLISHABLE: 2,
32
+ SCHEDULE_CONFLICT: 2,
23
33
  // Not found (4)
24
34
  RESOURCE_NOT_FOUND: 4,
25
35
  ACCOUNT_NOT_FOUND: 4,
@@ -37,6 +47,9 @@ var EXIT_CODE_MAP = {
37
47
  // Transient platform (7)
38
48
  PLATFORM_ERROR: 7,
39
49
  LINKEDIN_SERVICE_UNAVAILABLE: 7,
50
+ // 7: a publish of this Draft is in flight (or being settled); read it again
51
+ // in a few seconds. A busy state, not a malformed request.
52
+ DRAFT_PUBLISHING: 7,
40
53
  // Account / connection state (8)
41
54
  ACCOUNT_RESTRICTED: 8,
42
55
  RESOURCE_ACCESS_RESTRICTED: 8,