@curviate/cli 0.10.0 → 0.12.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.
@@ -1,59 +1,14 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ readlineSync
4
+ } from "./chunk-MKXA2LAR.js";
2
5
  import {
3
6
  GLOBAL_FLAGS,
4
7
  writeProfile
5
- } from "./chunk-TDYIQHQX.js";
8
+ } from "./chunk-4JHGVY7R.js";
6
9
 
7
10
  // src/commands/login.ts
8
11
  import { defineCommand } from "citty";
9
-
10
- // src/lib/readline.ts
11
- import { createInterface } from "readline";
12
- async function readlineSync(prompt, opts = {}) {
13
- return new Promise((resolve, reject) => {
14
- process.stderr.write(prompt);
15
- if (opts.mask && typeof process.stdin.setRawMode === "function") {
16
- process.stdin.setRawMode(true);
17
- process.stdin.resume();
18
- process.stdin.setEncoding("utf8");
19
- let input = "";
20
- const onData = (char) => {
21
- if (char === "\r" || char === "\n") {
22
- process.stdin.setRawMode(false);
23
- process.stdin.pause();
24
- process.stdin.removeListener("data", onData);
25
- process.stderr.write("\n");
26
- resolve(input);
27
- } else if (char === "") {
28
- process.stdin.setRawMode(false);
29
- process.stdin.pause();
30
- process.stdin.removeListener("data", onData);
31
- reject(new Error("Interrupted."));
32
- } else if (char === "\x7F" || char === "\b") {
33
- input = input.slice(0, -1);
34
- } else {
35
- input += char;
36
- }
37
- };
38
- process.stdin.on("data", onData);
39
- } else {
40
- const rl = createInterface({
41
- input: process.stdin,
42
- output: void 0,
43
- // suppress default echo (prompt already on stderr)
44
- terminal: false
45
- });
46
- rl.once("line", (line) => {
47
- rl.close();
48
- resolve(line.trim());
49
- });
50
- rl.once("error", reject);
51
- rl.once("close", () => resolve(""));
52
- }
53
- });
54
- }
55
-
56
- // src/commands/login.ts
57
12
  async function runLogin(args, out) {
58
13
  const profileName = args.profile ?? "default";
59
14
  const apiKey = (args["api-key"] ?? "").trim();
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-Q43HZUN3.js";
10
10
  import {
11
11
  resolveTextOrStdin
12
- } from "./chunk-CHFKVAEI.js";
12
+ } from "./chunk-U7Y4EXHT.js";
13
13
  import {
14
14
  buildPreviewOutput
15
15
  } from "./chunk-R3VLWLVV.js";
@@ -23,11 +23,11 @@ import {
23
23
  renderSuccess,
24
24
  renderUnexpectedError,
25
25
  resolveEffectiveConfig
26
- } from "./chunk-47SYFQRF.js";
26
+ } from "./chunk-JXF47TRY.js";
27
27
  import {
28
28
  READ_SINGLE_FLAGS,
29
29
  WRITE_FLAGS
30
- } from "./chunk-TDYIQHQX.js";
30
+ } from "./chunk-4JHGVY7R.js";
31
31
 
32
32
  // src/commands/message.ts
33
33
  import { defineCommand } from "citty";
@@ -73,7 +73,7 @@ var MEMBER_PROVIDER_ID_RE = /^A[CDE][A-Za-z0-9_-]{4,}$/;
73
73
  async function handleSdkError(err, outOpts, out) {
74
74
  const { CurviateError } = await import("@curviate/sdk");
75
75
  if (err instanceof CurviateError) {
76
- const { getExitCode } = await import("./exit-codes-NFIR57ZA.js");
76
+ const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
77
77
  renderError(err, outOpts, out);
78
78
  process.exit(getExitCode(err.code));
79
79
  }
@@ -5,24 +5,24 @@ import {
5
5
  } from "./chunk-Q43HZUN3.js";
6
6
  import {
7
7
  resolveTextOrStdin
8
- } from "./chunk-CHFKVAEI.js";
9
- import {
10
- streamAll
11
- } from "./chunk-GXTZION6.js";
8
+ } from "./chunk-U7Y4EXHT.js";
12
9
  import {
13
10
  buildPreviewOutput
14
11
  } from "./chunk-R3VLWLVV.js";
12
+ import {
13
+ streamAll
14
+ } from "./chunk-GXTZION6.js";
15
15
  import {
16
16
  createClient,
17
17
  renderError,
18
18
  renderSuccess,
19
19
  renderUnexpectedError,
20
20
  resolveEffectiveConfig
21
- } from "./chunk-47SYFQRF.js";
21
+ } from "./chunk-JXF47TRY.js";
22
22
  import {
23
23
  GLOBAL_FLAGS,
24
24
  WRITE_FLAGS
25
- } from "./chunk-TDYIQHQX.js";
25
+ } from "./chunk-4JHGVY7R.js";
26
26
 
27
27
  // src/commands/post.ts
28
28
  import { defineCommand } from "citty";
@@ -72,7 +72,7 @@ function normalizeAttachPaths(attach) {
72
72
  async function handleSdkError(err, outOpts, out) {
73
73
  const { CurviateError } = await import("@curviate/sdk");
74
74
  if (err instanceof CurviateError) {
75
- const { getExitCode } = await import("./exit-codes-NFIR57ZA.js");
75
+ const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
76
76
  renderError(err, outOpts, out);
77
77
  process.exit(getExitCode(err.code));
78
78
  }
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- streamAll
4
- } from "./chunk-GXTZION6.js";
5
2
  import {
6
3
  buildPreviewOutput
7
4
  } from "./chunk-R3VLWLVV.js";
5
+ import {
6
+ streamAll
7
+ } from "./chunk-GXTZION6.js";
8
8
  import {
9
9
  slimProfile,
10
10
  slimProfileMe
@@ -18,10 +18,10 @@ import {
18
18
  renderSuccess,
19
19
  renderUnexpectedError,
20
20
  resolveEffectiveConfig
21
- } from "./chunk-47SYFQRF.js";
21
+ } from "./chunk-JXF47TRY.js";
22
22
  import {
23
23
  GLOBAL_FLAGS
24
- } from "./chunk-TDYIQHQX.js";
24
+ } from "./chunk-4JHGVY7R.js";
25
25
 
26
26
  // src/commands/profile.ts
27
27
  import { defineCommand } from "citty";
@@ -141,7 +141,7 @@ async function runProfileMe(client, flags, out) {
141
141
  } catch (err) {
142
142
  const { CurviateError } = await import("@curviate/sdk");
143
143
  if (err instanceof CurviateError) {
144
- const { getExitCode } = await import("./exit-codes-NFIR57ZA.js");
144
+ const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
145
145
  renderError(err, outOpts, out);
146
146
  process.exit(getExitCode(err.code));
147
147
  }
@@ -161,7 +161,7 @@ async function runProfileMe(client, flags, out) {
161
161
  } catch (err) {
162
162
  const { CurviateError } = await import("@curviate/sdk");
163
163
  if (err instanceof CurviateError) {
164
- const { getExitCode } = await import("./exit-codes-NFIR57ZA.js");
164
+ const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
165
165
  renderError(err, outOpts, out);
166
166
  process.exit(getExitCode(err.code));
167
167
  }
@@ -278,7 +278,7 @@ async function runProfileGet(client, flags, out) {
278
278
  } catch (err) {
279
279
  const { CurviateError } = await import("@curviate/sdk");
280
280
  if (err instanceof CurviateError) {
281
- const { getExitCode } = await import("./exit-codes-NFIR57ZA.js");
281
+ const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
282
282
  renderError(err, outOpts, out);
283
283
  process.exit(getExitCode(err.code));
284
284
  }
@@ -315,7 +315,7 @@ async function runProfileConnections(client, flags, out) {
315
315
  } catch (err) {
316
316
  const { CurviateError } = await import("@curviate/sdk");
317
317
  if (err instanceof CurviateError) {
318
- const { getExitCode } = await import("./exit-codes-NFIR57ZA.js");
318
+ const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
319
319
  renderError(err, outOpts, out);
320
320
  process.exit(getExitCode(err.code));
321
321
  }
@@ -346,7 +346,7 @@ async function runProfileEndorse(client, flags, out) {
346
346
  } catch (err) {
347
347
  const { CurviateError } = await import("@curviate/sdk");
348
348
  if (err instanceof CurviateError) {
349
- const { getExitCode } = await import("./exit-codes-NFIR57ZA.js");
349
+ const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
350
350
  renderError(err, outOpts, out);
351
351
  process.exit(getExitCode(err.code));
352
352
  }
@@ -12,12 +12,12 @@ import {
12
12
  AttachError,
13
13
  readAttachment
14
14
  } from "./chunk-Q43HZUN3.js";
15
- import {
16
- streamAll
17
- } from "./chunk-GXTZION6.js";
18
15
  import {
19
16
  buildPreviewOutput
20
17
  } from "./chunk-R3VLWLVV.js";
18
+ import {
19
+ streamAll
20
+ } from "./chunk-GXTZION6.js";
21
21
  import {
22
22
  slimJob
23
23
  } from "./chunk-SSPILTKF.js";
@@ -31,12 +31,12 @@ import {
31
31
  renderSuccess,
32
32
  renderUnexpectedError,
33
33
  resolveEffectiveConfig
34
- } from "./chunk-47SYFQRF.js";
34
+ } from "./chunk-JXF47TRY.js";
35
35
  import {
36
36
  GLOBAL_FLAGS,
37
37
  READ_SINGLE_FLAGS,
38
38
  WRITE_FLAGS
39
- } from "./chunk-TDYIQHQX.js";
39
+ } from "./chunk-4JHGVY7R.js";
40
40
 
41
41
  // src/commands/recruiter.ts
42
42
  import { defineCommand } from "citty";
@@ -75,7 +75,7 @@ function normalizeAttachPaths(attach) {
75
75
  async function handleSdkError(err, outOpts, out) {
76
76
  const { CurviateError } = await import("@curviate/sdk");
77
77
  if (err instanceof CurviateError) {
78
- const { getExitCode } = await import("./exit-codes-NFIR57ZA.js");
78
+ const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
79
79
  renderError(err, outOpts, out);
80
80
  process.exit(getExitCode(err.code));
81
81
  }
@@ -9,12 +9,12 @@ import {
9
9
  AttachError,
10
10
  readAttachment
11
11
  } from "./chunk-Q43HZUN3.js";
12
- import {
13
- streamAll
14
- } from "./chunk-GXTZION6.js";
15
12
  import {
16
13
  buildPreviewOutput
17
14
  } from "./chunk-R3VLWLVV.js";
15
+ import {
16
+ streamAll
17
+ } from "./chunk-GXTZION6.js";
18
18
  import {
19
19
  resolveIdentifier
20
20
  } from "./chunk-DMQZEPQE.js";
@@ -24,12 +24,12 @@ import {
24
24
  renderSuccess,
25
25
  renderUnexpectedError,
26
26
  resolveEffectiveConfig
27
- } from "./chunk-47SYFQRF.js";
27
+ } from "./chunk-JXF47TRY.js";
28
28
  import {
29
29
  GLOBAL_FLAGS,
30
30
  READ_SINGLE_FLAGS,
31
31
  WRITE_FLAGS
32
- } from "./chunk-TDYIQHQX.js";
32
+ } from "./chunk-4JHGVY7R.js";
33
33
 
34
34
  // src/commands/sales-nav.ts
35
35
  import { defineCommand } from "citty";
@@ -66,7 +66,7 @@ function normalizeAttachPaths(attach) {
66
66
  async function handleSdkError(err, outOpts, out) {
67
67
  const { CurviateError } = await import("@curviate/sdk");
68
68
  if (err instanceof CurviateError) {
69
- const { getExitCode } = await import("./exit-codes-NFIR57ZA.js");
69
+ const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
70
70
  renderError(err, outOpts, out);
71
71
  process.exit(getExitCode(err.code));
72
72
  }
@@ -276,13 +276,13 @@ async function runSalesNavProfile(client, flags, out) {
276
276
  async function runSalesNavSaveLead(client, flags, out) {
277
277
  const accountId = requireAccount(flags.account, out);
278
278
  const userId = flags.userId ?? "";
279
+ const listId = flags.list ?? "";
279
280
  const outOpts = resolveOutputOpts(flags);
280
- const body = {};
281
- if (flags["list-id"]) body["list_id"] = flags["list-id"];
281
+ const body = { user_id: userId };
282
282
  if (flags.preview) {
283
283
  const preview = buildPreviewOutput({
284
284
  method: "salesNavigator.saveLead",
285
- args: { user_id: userId },
285
+ args: { list_id: listId, user_id: userId },
286
286
  body,
287
287
  account: accountId
288
288
  });
@@ -291,7 +291,153 @@ async function runSalesNavSaveLead(client, flags, out) {
291
291
  }
292
292
  const ns = client.account(accountId);
293
293
  try {
294
- const result = await ns.salesNavigator.saveLead(userId, body);
294
+ const result = await ns.salesNavigator.saveLead({ list_id: listId, user_id: userId });
295
+ renderSuccess(result, outOpts, out);
296
+ } catch (err) {
297
+ await handleSdkError(err, outOpts, out);
298
+ }
299
+ }
300
+ async function runSalesNavAccountLists(client, flags, out) {
301
+ rejectPreviewOnRead(flags.preview, out);
302
+ const accountId = requireAccount(flags.account, out);
303
+ const ns = client.account(accountId);
304
+ const outOpts = resolveOutputOpts(flags);
305
+ const all = flags.all ?? false;
306
+ const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
307
+ const params = {};
308
+ if (flags.limit) params["limit"] = parseInt(flags.limit, 10);
309
+ if (flags.cursor) params["cursor"] = flags.cursor;
310
+ try {
311
+ if (all) {
312
+ const fn = (p) => ns.salesNavigator.accountLists(p);
313
+ for await (const item of streamAll(fn, params, {
314
+ maxPages,
315
+ onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
316
+ `)
317
+ })) {
318
+ out.stdout.write(JSON.stringify(item) + "\n");
319
+ }
320
+ return;
321
+ }
322
+ const result = await ns.salesNavigator.accountLists(Object.keys(params).length > 0 ? params : void 0);
323
+ renderSuccess(result, outOpts, out);
324
+ } catch (err) {
325
+ await handleSdkError(err, outOpts, out);
326
+ }
327
+ }
328
+ async function runSalesNavLeadLists(client, flags, out) {
329
+ rejectPreviewOnRead(flags.preview, out);
330
+ const accountId = requireAccount(flags.account, out);
331
+ const ns = client.account(accountId);
332
+ const outOpts = resolveOutputOpts(flags);
333
+ const all = flags.all ?? false;
334
+ const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
335
+ const params = {};
336
+ if (flags.limit) params["limit"] = parseInt(flags.limit, 10);
337
+ if (flags.cursor) params["cursor"] = flags.cursor;
338
+ try {
339
+ if (all) {
340
+ const fn = (p) => ns.salesNavigator.leadLists(p);
341
+ for await (const item of streamAll(fn, params, {
342
+ maxPages,
343
+ onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
344
+ `)
345
+ })) {
346
+ out.stdout.write(JSON.stringify(item) + "\n");
347
+ }
348
+ return;
349
+ }
350
+ const result = await ns.salesNavigator.leadLists(Object.keys(params).length > 0 ? params : void 0);
351
+ renderSuccess(result, outOpts, out);
352
+ } catch (err) {
353
+ await handleSdkError(err, outOpts, out);
354
+ }
355
+ }
356
+ async function runSalesNavBrowseAccountList(client, flags, out) {
357
+ rejectPreviewOnRead(flags.preview, out);
358
+ const accountId = requireAccount(flags.account, out);
359
+ const listId = flags.listId ?? "";
360
+ const ns = client.account(accountId);
361
+ const outOpts = resolveOutputOpts(flags);
362
+ const all = flags.all ?? false;
363
+ const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
364
+ const body = {};
365
+ if (flags.filter) body["filter"] = flags.filter;
366
+ if (flags["sort-by"]) body["sort_by"] = flags["sort-by"];
367
+ if (flags["sort-order"]) body["sort_order"] = flags["sort-order"];
368
+ const params = {};
369
+ if (flags.limit) params["limit"] = parseInt(flags.limit, 10);
370
+ if (flags.cursor) params["cursor"] = flags.cursor;
371
+ try {
372
+ if (all) {
373
+ const fn = (p) => ns.salesNavigator.browseAccountList(listId, body, p);
374
+ for await (const item of streamAll(fn, params, {
375
+ maxPages,
376
+ onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
377
+ `)
378
+ })) {
379
+ out.stdout.write(JSON.stringify(item) + "\n");
380
+ }
381
+ return;
382
+ }
383
+ const result = await ns.salesNavigator.browseAccountList(listId, body, Object.keys(params).length > 0 ? params : void 0);
384
+ renderSuccess(result, outOpts, out);
385
+ } catch (err) {
386
+ await handleSdkError(err, outOpts, out);
387
+ }
388
+ }
389
+ async function runSalesNavBrowseLeadList(client, flags, out) {
390
+ rejectPreviewOnRead(flags.preview, out);
391
+ const accountId = requireAccount(flags.account, out);
392
+ const listId = flags.listId ?? "";
393
+ const ns = client.account(accountId);
394
+ const outOpts = resolveOutputOpts(flags);
395
+ const all = flags.all ?? false;
396
+ const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
397
+ const body = {};
398
+ if (flags.spotlight) body["spotlight"] = flags.spotlight;
399
+ if (flags["sort-by"]) body["sort_by"] = flags["sort-by"];
400
+ if (flags["sort-order"]) body["sort_order"] = flags["sort-order"];
401
+ const params = {};
402
+ if (flags.limit) params["limit"] = parseInt(flags.limit, 10);
403
+ if (flags.cursor) params["cursor"] = flags.cursor;
404
+ try {
405
+ if (all) {
406
+ const fn = (p) => ns.salesNavigator.browseLeadList(listId, body, p);
407
+ for await (const item of streamAll(fn, params, {
408
+ maxPages,
409
+ onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
410
+ `)
411
+ })) {
412
+ out.stdout.write(JSON.stringify(item) + "\n");
413
+ }
414
+ return;
415
+ }
416
+ const result = await ns.salesNavigator.browseLeadList(listId, body, Object.keys(params).length > 0 ? params : void 0);
417
+ renderSuccess(result, outOpts, out);
418
+ } catch (err) {
419
+ await handleSdkError(err, outOpts, out);
420
+ }
421
+ }
422
+ async function runSalesNavSaveAccount(client, flags, out) {
423
+ const accountId = requireAccount(flags.account, out);
424
+ const listId = flags.list ?? "";
425
+ const companyId = flags.companyId ?? "";
426
+ const outOpts = resolveOutputOpts(flags);
427
+ const body = { company_id: companyId };
428
+ if (flags.preview) {
429
+ const preview = buildPreviewOutput({
430
+ method: "salesNavigator.saveAccount",
431
+ args: { list_id: listId, company_id: companyId },
432
+ body,
433
+ account: accountId
434
+ });
435
+ out.stdout.write(JSON.stringify(preview) + "\n");
436
+ return;
437
+ }
438
+ const ns = client.account(accountId);
439
+ try {
440
+ const result = await ns.salesNavigator.saveAccount({ list_id: listId, company_id: companyId });
295
441
  renderSuccess(result, outOpts, out);
296
442
  } catch (err) {
297
443
  await handleSdkError(err, outOpts, out);
@@ -489,12 +635,12 @@ var salesNavProfileCommand = defineCommand({
489
635
  }
490
636
  });
491
637
  var salesNavSaveLeadCommand = defineCommand({
492
- meta: { name: "save-lead", description: "Save a Sales Navigator member as a lead." },
638
+ meta: { name: "save-lead", description: "Save a Sales Navigator member into a lead list." },
493
639
  args: {
494
640
  // Write command: WRITE_FLAGS omits pagination/projection flags
495
641
  ...WRITE_FLAGS,
496
642
  userId: { type: "positional", description: "Sales Navigator member ID (ACw\u2026 format)." },
497
- "list-id": { type: "string", description: "Lead list ID to save the lead into." }
643
+ list: { type: "string", description: "Lead list ID to save the member into (required \u2014 the v2 save always targets a specific list).", required: true }
498
644
  },
499
645
  async run({ args }) {
500
646
  const flags = args;
@@ -514,6 +660,128 @@ var salesNavSaveLeadCommand = defineCommand({
514
660
  await runSalesNavSaveLead(client, { ...flags, account: flags.account ?? cfg.account }, out);
515
661
  }
516
662
  });
663
+ var salesNavAccountListsCommand = defineCommand({
664
+ meta: { name: "account-lists", description: "List the saved-account (company) lists on the operator's Sales Navigator seat." },
665
+ args: { ...GLOBAL_FLAGS },
666
+ async run({ args }) {
667
+ const flags = args;
668
+ const cfg = await resolveEffectiveConfig({
669
+ apiKey: flags["api-key"],
670
+ baseUrl: flags["base-url"],
671
+ timeout: flags.timeout,
672
+ account: flags.account,
673
+ profile: flags.profile
674
+ });
675
+ if (!cfg.apiKey) {
676
+ process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
677
+ process.exit(3);
678
+ }
679
+ const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
680
+ const out = buildOutputStreams();
681
+ await runSalesNavAccountLists(client, { ...flags, account: flags.account ?? cfg.account }, out);
682
+ }
683
+ });
684
+ var salesNavLeadListsCommand = defineCommand({
685
+ meta: { name: "lead-lists", description: "List the saved-lead (member) lists on the operator's Sales Navigator seat." },
686
+ args: { ...GLOBAL_FLAGS },
687
+ async run({ args }) {
688
+ const flags = args;
689
+ const cfg = await resolveEffectiveConfig({
690
+ apiKey: flags["api-key"],
691
+ baseUrl: flags["base-url"],
692
+ timeout: flags.timeout,
693
+ account: flags.account,
694
+ profile: flags.profile
695
+ });
696
+ if (!cfg.apiKey) {
697
+ process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
698
+ process.exit(3);
699
+ }
700
+ const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
701
+ const out = buildOutputStreams();
702
+ await runSalesNavLeadLists(client, { ...flags, account: flags.account ?? cfg.account }, out);
703
+ }
704
+ });
705
+ var salesNavBrowseAccountListCommand = defineCommand({
706
+ meta: { name: "browse-account-list", description: "Browse the saved accounts (companies) in one account list." },
707
+ args: {
708
+ ...GLOBAL_FLAGS,
709
+ listId: { type: "positional", description: "The account-list id (from `sales-nav account-lists`)." },
710
+ filter: { type: "string", description: "Restrict to a saved-account subset: STARRED, GROWTH_ALERTS, or RISK_ALERTS." },
711
+ "sort-by": { type: "string", description: "Sort field: DATE_ADDED or NAME. Defaults to NAME." },
712
+ "sort-order": { type: "string", description: "Sort direction: ASCENDING or DESCENDING. Defaults to ASCENDING." }
713
+ },
714
+ async run({ args }) {
715
+ const flags = args;
716
+ const cfg = await resolveEffectiveConfig({
717
+ apiKey: flags["api-key"],
718
+ baseUrl: flags["base-url"],
719
+ timeout: flags.timeout,
720
+ account: flags.account,
721
+ profile: flags.profile
722
+ });
723
+ if (!cfg.apiKey) {
724
+ process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
725
+ process.exit(3);
726
+ }
727
+ const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
728
+ const out = buildOutputStreams();
729
+ await runSalesNavBrowseAccountList(client, { ...flags, account: flags.account ?? cfg.account }, out);
730
+ }
731
+ });
732
+ var salesNavBrowseLeadListCommand = defineCommand({
733
+ meta: { name: "browse-lead-list", description: "Browse the saved leads (members) in one lead list." },
734
+ args: {
735
+ ...GLOBAL_FLAGS,
736
+ listId: { type: "positional", description: "The lead-list id (from `sales-nav lead-lists`)." },
737
+ spotlight: { type: "string", description: "Restrict to a spotlighted lead subset: RECENT_POSITION_CHANGE, RECENTLY_POSTED_ON_LINKEDIN, FOLLOW_YOUR_COMPANY, or SHARE_EXPERIENCE." },
738
+ "sort-by": { type: "string", description: "Sort field: DATE_ADDED, ACCOUNT, NAME, or OUTREACH_ACTIVITY. Defaults to DATE_ADDED." },
739
+ "sort-order": { type: "string", description: "Sort direction: ASCENDING or DESCENDING. Defaults to DESCENDING." }
740
+ },
741
+ async run({ args }) {
742
+ const flags = args;
743
+ const cfg = await resolveEffectiveConfig({
744
+ apiKey: flags["api-key"],
745
+ baseUrl: flags["base-url"],
746
+ timeout: flags.timeout,
747
+ account: flags.account,
748
+ profile: flags.profile
749
+ });
750
+ if (!cfg.apiKey) {
751
+ process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
752
+ process.exit(3);
753
+ }
754
+ const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
755
+ const out = buildOutputStreams();
756
+ await runSalesNavBrowseLeadList(client, { ...flags, account: flags.account ?? cfg.account }, out);
757
+ }
758
+ });
759
+ var salesNavSaveAccountCommand = defineCommand({
760
+ meta: { name: "save-account", description: "Save a LinkedIn company into an account list." },
761
+ args: {
762
+ // Write command: WRITE_FLAGS omits pagination/projection flags
763
+ ...WRITE_FLAGS,
764
+ companyId: { type: "positional", description: "The LinkedIn company id to save into the account list." },
765
+ list: { type: "string", description: "The target account-list id to save the company into (required).", required: true }
766
+ },
767
+ async run({ args }) {
768
+ const flags = args;
769
+ const cfg = await resolveEffectiveConfig({
770
+ apiKey: flags["api-key"],
771
+ baseUrl: flags["base-url"],
772
+ timeout: flags.timeout,
773
+ account: flags.account,
774
+ profile: flags.profile
775
+ });
776
+ if (!cfg.apiKey) {
777
+ process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
778
+ process.exit(3);
779
+ }
780
+ const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
781
+ const out = buildOutputStreams();
782
+ await runSalesNavSaveAccount(client, { ...flags, account: flags.account ?? cfg.account }, out);
783
+ }
784
+ });
517
785
  var salesNavCommand = defineCommand({
518
786
  meta: { name: "sales-nav", description: "Sales Navigator operations (requires the Sales Navigator add-on)." },
519
787
  args: { ...GLOBAL_FLAGS },
@@ -522,18 +790,28 @@ var salesNavCommand = defineCommand({
522
790
  message: salesNavMessageCommand,
523
791
  search: salesNavSearchCommand,
524
792
  profile: salesNavProfileCommand,
525
- "save-lead": salesNavSaveLeadCommand
793
+ "save-lead": salesNavSaveLeadCommand,
794
+ "account-lists": salesNavAccountListsCommand,
795
+ "lead-lists": salesNavLeadListsCommand,
796
+ "browse-account-list": salesNavBrowseAccountListCommand,
797
+ "browse-lead-list": salesNavBrowseLeadListCommand,
798
+ "save-account": salesNavSaveAccountCommand
526
799
  },
527
800
  async run() {
528
801
  process.stderr.write(
529
- 'Usage: curviate sales-nav sync\n curviate sales-nav search people [--keywords <k>]\n curviate sales-nav search companies [--keywords <k>]\n curviate sales-nav search parameters --type <t>\n curviate sales-nav message new --to <id> "<text>"\n curviate sales-nav profile <identifier>\n curviate sales-nav save-lead <user_id> [--list-id <id>]\n'
802
+ 'Usage: curviate sales-nav sync\n curviate sales-nav search people [--keywords <k>]\n curviate sales-nav search companies [--keywords <k>]\n curviate sales-nav search parameters --type <t>\n curviate sales-nav message new --to <id> "<text>"\n curviate sales-nav profile <identifier>\n curviate sales-nav save-lead --list <id> <user_id>\n curviate sales-nav account-lists --account <id>\n curviate sales-nav lead-lists --account <id>\n curviate sales-nav browse-account-list <list_id> --account <id>\n curviate sales-nav browse-lead-list <list_id> --account <id>\n curviate sales-nav save-account --list <id> <company_id> --account <id>\n'
530
803
  );
531
804
  }
532
805
  });
533
806
  export {
807
+ runSalesNavAccountLists,
808
+ runSalesNavBrowseAccountList,
809
+ runSalesNavBrowseLeadList,
534
810
  runSalesNavGetParameters,
811
+ runSalesNavLeadLists,
535
812
  runSalesNavMessageNew,
536
813
  runSalesNavProfile,
814
+ runSalesNavSaveAccount,
537
815
  runSalesNavSaveLead,
538
816
  runSalesNavSearchCompanies,
539
817
  runSalesNavSearchPeople,