@curviate/cli 0.14.0 → 0.15.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 +161 -0
- package/README.md +52 -79
- package/dist/{account-7AUDAMIK.js → account-FM473HEK.js} +38 -371
- package/dist/{chunk-SSPILTKF.js → chunk-45KHSWCV.js} +56 -48
- package/dist/chunk-BGZW6B7G.js +59 -0
- package/dist/chunk-EEMJDJ4W.js +80 -0
- package/dist/{chunk-JXF47TRY.js → chunk-M33MI53G.js} +33 -1
- package/dist/chunk-QJZ3LWOX.js +24 -0
- package/dist/{chunk-4JHGVY7R.js → chunk-TMU3CSPR.js} +4 -0
- package/dist/{chunk-HMAGEMF7.js → chunk-ZE7QGR3F.js} +4 -0
- package/dist/cli.js +127 -15
- package/dist/comment-NCDXERSI.js +555 -0
- package/dist/{company-RU2CA5DY.js → company-IYTMW64G.js} +27 -74
- package/dist/{config-Q2AEWSEC.js → config-P5CPF5WC.js} +1 -1
- package/dist/{connect-QT6ZOS75.js → connect-TTJHMBUP.js} +91 -45
- package/dist/{exit-codes-ZTY2NY3X.js → exit-codes-SL3GQF7W.js} +1 -1
- package/dist/{inbox-DN7X7CM2.js → inbox-EOOGJ3ZN.js} +55 -124
- package/dist/job-YARGTHUY.js +631 -0
- package/dist/{login-BBVQLXM7.js → login-MFB45PVZ.js} +1 -1
- package/dist/{message-6K5E3CUF.js → message-2DLIQIE6.js} +61 -51
- package/dist/{post-2JQZ3OSF.js → post-GRIJ7X52.js} +188 -221
- package/dist/profile-57RJEL7H.js +809 -0
- package/dist/{recruiter-XHVMQWK6.js → recruiter-CTYH7AYG.js} +740 -226
- package/dist/{sales-nav-QTSTJMKA.js → sales-nav-NUMEYOEO.js} +119 -77
- package/dist/{search-ZGTS45BT.js → search-RD4TXNV7.js} +103 -39
- package/dist/{webhook-EIY5WWTE.js → webhook-CEP7SGP5.js} +8 -45
- package/package.json +4 -3
- package/dist/chunk-GXTZION6.js +0 -45
- package/dist/chunk-Q43HZUN3.js +0 -29
- package/dist/job-FGGQEXSU.js +0 -105
- package/dist/profile-DD5GMGNL.js +0 -501
|
@@ -7,30 +7,31 @@ import {
|
|
|
7
7
|
} from "./chunk-MKXA2LAR.js";
|
|
8
8
|
import {
|
|
9
9
|
AUTH_NEEDED
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ZE7QGR3F.js";
|
|
11
11
|
import {
|
|
12
12
|
buildPreviewOutput
|
|
13
13
|
} from "./chunk-R3VLWLVV.js";
|
|
14
|
-
import {
|
|
15
|
-
streamAll
|
|
16
|
-
} from "./chunk-GXTZION6.js";
|
|
17
14
|
import {
|
|
18
15
|
slimAccountGet,
|
|
19
16
|
slimAccountList,
|
|
20
17
|
slimAccountListItem
|
|
21
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-45KHSWCV.js";
|
|
19
|
+
import {
|
|
20
|
+
pageDelayFromFlags,
|
|
21
|
+
streamAll
|
|
22
|
+
} from "./chunk-EEMJDJ4W.js";
|
|
22
23
|
import {
|
|
23
24
|
createClient,
|
|
24
25
|
renderError,
|
|
25
26
|
renderSuccess,
|
|
26
27
|
renderUnexpectedError,
|
|
27
28
|
resolveEffectiveConfig
|
|
28
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-M33MI53G.js";
|
|
29
30
|
import {
|
|
30
31
|
GLOBAL_FLAGS,
|
|
31
32
|
READ_SINGLE_FLAGS,
|
|
32
33
|
WRITE_SINGLE_FLAGS
|
|
33
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-TMU3CSPR.js";
|
|
34
35
|
|
|
35
36
|
// src/commands/account.ts
|
|
36
37
|
import { defineCommand } from "citty";
|
|
@@ -203,7 +204,7 @@ function resolveOutputOpts(flags) {
|
|
|
203
204
|
async function handleError(err, outOpts, out) {
|
|
204
205
|
const { CurviateError } = await import("@curviate/sdk");
|
|
205
206
|
if (err instanceof CurviateError) {
|
|
206
|
-
const { getExitCode } = await import("./exit-codes-
|
|
207
|
+
const { getExitCode } = await import("./exit-codes-SL3GQF7W.js");
|
|
207
208
|
renderError(err, outOpts, out);
|
|
208
209
|
process.exit(getExitCode(err.code));
|
|
209
210
|
}
|
|
@@ -225,8 +226,8 @@ async function runAccountList(client, flags, out) {
|
|
|
225
226
|
const fn = (p) => client.accounts.list(p);
|
|
226
227
|
for await (const item of streamAll(fn, params, {
|
|
227
228
|
maxPages,
|
|
228
|
-
|
|
229
|
-
|
|
229
|
+
out,
|
|
230
|
+
pageDelayMs: pageDelayFromFlags(flags)
|
|
230
231
|
})) {
|
|
231
232
|
const projected = outOpts.verbose ? item : slimAccountListItem(item);
|
|
232
233
|
out.stdout.write(JSON.stringify(projected) + "\n");
|
|
@@ -353,7 +354,7 @@ async function waitForMobileApproval(client, accountId, expiresAt, ctx) {
|
|
|
353
354
|
for (; ; ) {
|
|
354
355
|
let result;
|
|
355
356
|
try {
|
|
356
|
-
result = await client.
|
|
357
|
+
result = await client.auth.pollCheckpoint(accountId);
|
|
357
358
|
} catch (err) {
|
|
358
359
|
return await handleError(err, ctx.outOpts, ctx.out);
|
|
359
360
|
}
|
|
@@ -404,7 +405,7 @@ async function runInteractiveCheckpointLoop(client, initial, ctx) {
|
|
|
404
405
|
for (; ; ) {
|
|
405
406
|
const code = await ctx.readline("Enter the code: ");
|
|
406
407
|
try {
|
|
407
|
-
const result = await client.
|
|
408
|
+
const result = await client.auth.solveCheckpoint(accountId, { code });
|
|
408
409
|
const r = result;
|
|
409
410
|
if (r.status === "checkpoint_required") {
|
|
410
411
|
current = { ...r, account_id: r.account_id ?? accountId };
|
|
@@ -467,17 +468,21 @@ async function runAccountLink(client, flags, out, io = {}) {
|
|
|
467
468
|
});
|
|
468
469
|
const body = {
|
|
469
470
|
seat_id: flags["seat-id"],
|
|
470
|
-
...authBody
|
|
471
|
+
...authBody,
|
|
472
|
+
// --account-id (0.15.0): present → re-authenticate this existing account in
|
|
473
|
+
// place (reconnect); omit → connect a new account, with NO account_id key in
|
|
474
|
+
// the body at all (not undefined, not empty).
|
|
475
|
+
...flags["account-id"] ? { account_id: flags["account-id"] } : {}
|
|
471
476
|
};
|
|
472
477
|
const outOpts = resolveOutputOpts(flags);
|
|
473
478
|
if (flags.preview) {
|
|
474
|
-
const preview = buildPreviewOutput({ method: "
|
|
479
|
+
const preview = buildPreviewOutput({ method: "auth.intent", args: {}, body: maskCredentialSecretsForPreview(body) });
|
|
475
480
|
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
476
481
|
return;
|
|
477
482
|
}
|
|
478
483
|
let result;
|
|
479
484
|
try {
|
|
480
|
-
result = await client.
|
|
485
|
+
result = await client.auth.intent(body);
|
|
481
486
|
} catch (err) {
|
|
482
487
|
await handleError(err, outOpts, out);
|
|
483
488
|
return;
|
|
@@ -495,7 +500,7 @@ async function runConnectSessionWaitLoop(client, sessionId, ctx) {
|
|
|
495
500
|
let timeoutAt = ctx.timeoutOverrideMs !== void 0 ? startedAt + ctx.timeoutOverrideMs : void 0;
|
|
496
501
|
await ctx.sleep(CHECKPOINT_POLL_FIRST_DELAY_MS);
|
|
497
502
|
for (; ; ) {
|
|
498
|
-
const result = await client.
|
|
503
|
+
const result = await client.auth.getSession(sessionId);
|
|
499
504
|
const r = result;
|
|
500
505
|
if (r.status === "resolved") return { kind: "resolved", result };
|
|
501
506
|
if (r.status === "expired" || r.status === "failed") {
|
|
@@ -528,99 +533,21 @@ function resolveWaitTimeoutOverrideMs(flags, out) {
|
|
|
528
533
|
}
|
|
529
534
|
return parsed;
|
|
530
535
|
}
|
|
531
|
-
async function runAccountConnectLink(client, flags, out, io = {}) {
|
|
532
|
-
const body = {};
|
|
533
|
-
if (flags["seat-id"]) body["seat_id"] = flags["seat-id"];
|
|
534
|
-
if (flags["expires-in-seconds"]) body["expires_in_seconds"] = parseInt(flags["expires-in-seconds"], 10);
|
|
535
|
-
if (flags["redirect-url"]) body["redirect_url"] = flags["redirect-url"];
|
|
536
|
-
const outOpts = resolveOutputOpts(flags);
|
|
537
|
-
if (flags.preview) {
|
|
538
|
-
const preview = buildPreviewOutput({ method: "accounts.createConnectLink", args: {}, body });
|
|
539
|
-
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
540
|
-
return;
|
|
541
|
-
}
|
|
542
|
-
let result;
|
|
543
|
-
try {
|
|
544
|
-
result = await client.accounts.createConnectLink(body);
|
|
545
|
-
} catch (err) {
|
|
546
|
-
await handleError(err, outOpts, out);
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
const mint = result;
|
|
550
|
-
const resolvedIo = resolveCredentialIO(io);
|
|
551
|
-
const isInteractive = resolvedIo.isTTY && resolvedIo.isOutputTTY && !(flags["no-interactive"] ?? false);
|
|
552
|
-
if (!isInteractive) {
|
|
553
|
-
if (mint.url) {
|
|
554
|
-
out.stderr.write(`Open this URL in a browser to connect the account: ${mint.url}
|
|
555
|
-
`);
|
|
556
|
-
}
|
|
557
|
-
if (mint.session_id) {
|
|
558
|
-
out.stderr.write(
|
|
559
|
-
`Session: ${mint.session_id} \u2014 check it later with: curviate account connect-session poll --session ${mint.session_id} --wait
|
|
560
|
-
`
|
|
561
|
-
);
|
|
562
|
-
}
|
|
563
|
-
renderSuccess(result, outOpts, out);
|
|
564
|
-
return;
|
|
565
|
-
}
|
|
566
|
-
if ((flags.open ?? true) && mint.url) {
|
|
567
|
-
await resolvedIo.open(mint.url);
|
|
568
|
-
}
|
|
569
|
-
if (!(flags.wait ?? true)) {
|
|
570
|
-
renderSuccess(result, outOpts, out);
|
|
571
|
-
return;
|
|
572
|
-
}
|
|
573
|
-
const timeoutOverrideMs = resolveWaitTimeoutOverrideMs(flags, out);
|
|
574
|
-
const showTicker = resolvedIo.isOutputTTY && !(flags.json ?? false);
|
|
575
|
-
const sessionId = mint.session_id ?? "";
|
|
576
|
-
let outcome;
|
|
577
|
-
try {
|
|
578
|
-
outcome = await runConnectSessionWaitLoop(client, sessionId, {
|
|
579
|
-
out,
|
|
580
|
-
sleep: resolvedIo.sleep,
|
|
581
|
-
now: resolvedIo.now,
|
|
582
|
-
showTicker,
|
|
583
|
-
timeoutOverrideMs
|
|
584
|
-
});
|
|
585
|
-
} catch (err) {
|
|
586
|
-
await handleError(err, outOpts, out);
|
|
587
|
-
return;
|
|
588
|
-
}
|
|
589
|
-
if (outcome.kind === "resolved") {
|
|
590
|
-
printConnectSessionResolved(outcome.result, { out, outOpts });
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
if (outcome.kind === "terminal_failure") {
|
|
594
|
-
renderSuccess(outcome.result, outOpts, out);
|
|
595
|
-
out.stderr.write(
|
|
596
|
-
`This connect session has ${outcome.status}. Generate a new link: curviate account connect-link.
|
|
597
|
-
`
|
|
598
|
-
);
|
|
599
|
-
process.exit(9);
|
|
600
|
-
return;
|
|
601
|
-
}
|
|
602
|
-
renderSuccess(outcome.result, outOpts, out);
|
|
603
|
-
out.stderr.write(
|
|
604
|
-
`Still waiting for the account to connect \u2014 the wait window elapsed. Check again: curviate account connect-session poll --session ${sessionId} --wait
|
|
605
|
-
`
|
|
606
|
-
);
|
|
607
|
-
process.exit(AUTH_NEEDED);
|
|
608
|
-
}
|
|
609
536
|
async function runAccountConnectSessionPoll(client, flags, out, io = {}) {
|
|
610
537
|
if (!flags.session) {
|
|
611
|
-
out.stderr.write("error: --session is required (the
|
|
538
|
+
out.stderr.write("error: --session is required (the account's acc_\u2026 id from `account link` or a checkpoint response).\n");
|
|
612
539
|
process.exit(2);
|
|
613
540
|
}
|
|
614
541
|
const sessionId = flags.session;
|
|
615
542
|
const outOpts = resolveOutputOpts(flags);
|
|
616
543
|
if (flags.preview) {
|
|
617
|
-
const preview = buildPreviewOutput({ method: "
|
|
544
|
+
const preview = buildPreviewOutput({ method: "auth.getSession", args: { session_id: sessionId }, body: {} });
|
|
618
545
|
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
619
546
|
return;
|
|
620
547
|
}
|
|
621
548
|
if (!flags.wait) {
|
|
622
549
|
try {
|
|
623
|
-
const result = await client.
|
|
550
|
+
const result = await client.auth.getSession(sessionId);
|
|
624
551
|
renderSuccess(result, outOpts, out);
|
|
625
552
|
} catch (err) {
|
|
626
553
|
await handleError(err, outOpts, out);
|
|
@@ -650,7 +577,7 @@ async function runAccountConnectSessionPoll(client, flags, out, io = {}) {
|
|
|
650
577
|
if (outcome.kind === "terminal_failure") {
|
|
651
578
|
renderSuccess(outcome.result, outOpts, out);
|
|
652
579
|
out.stderr.write(
|
|
653
|
-
`This connect session has ${outcome.status}.
|
|
580
|
+
`This connect session has ${outcome.status}. Start a new connect: curviate account link.
|
|
654
581
|
`
|
|
655
582
|
);
|
|
656
583
|
process.exit(9);
|
|
@@ -663,128 +590,6 @@ async function runAccountConnectSessionPoll(client, flags, out, io = {}) {
|
|
|
663
590
|
);
|
|
664
591
|
process.exit(AUTH_NEEDED);
|
|
665
592
|
}
|
|
666
|
-
async function runAccountReconnectLink(client, flags, out, io = {}) {
|
|
667
|
-
const accountId = flags["account-id"] ?? "";
|
|
668
|
-
const body = {};
|
|
669
|
-
if (flags["expires-in-seconds"]) body["expires_in_seconds"] = parseInt(flags["expires-in-seconds"], 10);
|
|
670
|
-
if (flags["redirect-url"]) body["redirect_url"] = flags["redirect-url"];
|
|
671
|
-
const outOpts = resolveOutputOpts(flags);
|
|
672
|
-
if (flags.preview) {
|
|
673
|
-
const preview = buildPreviewOutput({ method: "accounts.createReconnectLink", args: { accountId }, body });
|
|
674
|
-
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
let result;
|
|
678
|
-
try {
|
|
679
|
-
result = await client.accounts.createReconnectLink(accountId, body);
|
|
680
|
-
} catch (err) {
|
|
681
|
-
await handleError(err, outOpts, out);
|
|
682
|
-
return;
|
|
683
|
-
}
|
|
684
|
-
const mint = result;
|
|
685
|
-
const resolvedIo = resolveCredentialIO(io);
|
|
686
|
-
const isInteractive = resolvedIo.isTTY && resolvedIo.isOutputTTY && !(flags["no-interactive"] ?? false);
|
|
687
|
-
if (!isInteractive) {
|
|
688
|
-
if (mint.url) {
|
|
689
|
-
out.stderr.write(`Open this URL in a browser to reconnect the account: ${mint.url}
|
|
690
|
-
`);
|
|
691
|
-
}
|
|
692
|
-
if (mint.session_id) {
|
|
693
|
-
out.stderr.write(
|
|
694
|
-
`Session: ${mint.session_id} \u2014 check it later with: curviate account connect-session poll --session ${mint.session_id} --wait
|
|
695
|
-
`
|
|
696
|
-
);
|
|
697
|
-
}
|
|
698
|
-
renderSuccess(result, outOpts, out);
|
|
699
|
-
return;
|
|
700
|
-
}
|
|
701
|
-
if ((flags.open ?? true) && mint.url) {
|
|
702
|
-
await resolvedIo.open(mint.url);
|
|
703
|
-
}
|
|
704
|
-
if (!(flags.wait ?? true)) {
|
|
705
|
-
renderSuccess(result, outOpts, out);
|
|
706
|
-
return;
|
|
707
|
-
}
|
|
708
|
-
const timeoutOverrideMs = resolveWaitTimeoutOverrideMs(flags, out);
|
|
709
|
-
const showTicker = resolvedIo.isOutputTTY && !(flags.json ?? false);
|
|
710
|
-
const sessionId = mint.session_id ?? "";
|
|
711
|
-
let outcome;
|
|
712
|
-
try {
|
|
713
|
-
outcome = await runConnectSessionWaitLoop(client, sessionId, {
|
|
714
|
-
out,
|
|
715
|
-
sleep: resolvedIo.sleep,
|
|
716
|
-
now: resolvedIo.now,
|
|
717
|
-
showTicker,
|
|
718
|
-
timeoutOverrideMs
|
|
719
|
-
});
|
|
720
|
-
} catch (err) {
|
|
721
|
-
await handleError(err, outOpts, out);
|
|
722
|
-
return;
|
|
723
|
-
}
|
|
724
|
-
if (outcome.kind === "resolved") {
|
|
725
|
-
printConnectSessionResolved(outcome.result, { out, outOpts });
|
|
726
|
-
return;
|
|
727
|
-
}
|
|
728
|
-
if (outcome.kind === "terminal_failure") {
|
|
729
|
-
renderSuccess(outcome.result, outOpts, out);
|
|
730
|
-
out.stderr.write(
|
|
731
|
-
`This reconnect session has ${outcome.status}. Generate a new link: curviate account reconnect-link ${accountId}.
|
|
732
|
-
`
|
|
733
|
-
);
|
|
734
|
-
process.exit(9);
|
|
735
|
-
return;
|
|
736
|
-
}
|
|
737
|
-
renderSuccess(outcome.result, outOpts, out);
|
|
738
|
-
out.stderr.write(
|
|
739
|
-
`Still waiting for the account to reconnect \u2014 the wait window elapsed. Check again: curviate account connect-session poll --session ${sessionId} --wait
|
|
740
|
-
`
|
|
741
|
-
);
|
|
742
|
-
process.exit(AUTH_NEEDED);
|
|
743
|
-
}
|
|
744
|
-
async function runAccountReconnect(client, flags, out, io = {}) {
|
|
745
|
-
if (!flags["auth-method"]) {
|
|
746
|
-
out.stderr.write("error: --auth-method is required for account reconnect (credentials | cookie).\n");
|
|
747
|
-
process.exit(2);
|
|
748
|
-
}
|
|
749
|
-
checkCredentialConflicts(flags, out);
|
|
750
|
-
if (!flags.preview && flags["auth-method"] === "cookie" && !flags["user-agent"]) {
|
|
751
|
-
out.stderr.write("error: --user-agent is required when --auth-method=cookie.\n");
|
|
752
|
-
process.exit(2);
|
|
753
|
-
}
|
|
754
|
-
const accountId = flags["account-id"] ?? "";
|
|
755
|
-
const resolvedIo = resolveCredentialIO(io);
|
|
756
|
-
const body = await buildAuthBody(flags, {
|
|
757
|
-
out,
|
|
758
|
-
isTTY: resolvedIo.isTTY,
|
|
759
|
-
readline: resolvedIo.readline,
|
|
760
|
-
readStdin: resolvedIo.readStdin,
|
|
761
|
-
previewMode: flags.preview ?? false
|
|
762
|
-
});
|
|
763
|
-
const outOpts = resolveOutputOpts(flags);
|
|
764
|
-
if (flags.preview) {
|
|
765
|
-
const preview = buildPreviewOutput({
|
|
766
|
-
method: "accounts.reconnect",
|
|
767
|
-
args: { accountId },
|
|
768
|
-
body: maskCredentialSecretsForPreview(body)
|
|
769
|
-
});
|
|
770
|
-
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
771
|
-
return;
|
|
772
|
-
}
|
|
773
|
-
let result;
|
|
774
|
-
try {
|
|
775
|
-
result = await client.accounts.reconnect(accountId, body);
|
|
776
|
-
} catch (err) {
|
|
777
|
-
await handleError(err, outOpts, out);
|
|
778
|
-
return;
|
|
779
|
-
}
|
|
780
|
-
await handleAccountConnectResult(client, result, {
|
|
781
|
-
out,
|
|
782
|
-
flags,
|
|
783
|
-
outOpts,
|
|
784
|
-
io: resolvedIo,
|
|
785
|
-
successVerb: "reconnected"
|
|
786
|
-
});
|
|
787
|
-
}
|
|
788
593
|
async function runAccountUpdate(client, flags, out) {
|
|
789
594
|
const accountId = flags["account-id"] ?? "";
|
|
790
595
|
const body = {};
|
|
@@ -871,13 +676,11 @@ async function runAccountCheckpointSolve(client, flags, out) {
|
|
|
871
676
|
process.exit(2);
|
|
872
677
|
}
|
|
873
678
|
const accountId = flags["account-id"] ?? "";
|
|
874
|
-
const body = {
|
|
875
|
-
code: flags.code
|
|
876
|
-
};
|
|
679
|
+
const body = { code: flags.code };
|
|
877
680
|
const outOpts = resolveOutputOpts(flags);
|
|
878
681
|
if (flags.preview) {
|
|
879
682
|
const preview = buildPreviewOutput({
|
|
880
|
-
method: "
|
|
683
|
+
method: "auth.solveCheckpoint",
|
|
881
684
|
args: { accountId },
|
|
882
685
|
body
|
|
883
686
|
});
|
|
@@ -886,7 +689,7 @@ async function runAccountCheckpointSolve(client, flags, out) {
|
|
|
886
689
|
}
|
|
887
690
|
let chained = false;
|
|
888
691
|
try {
|
|
889
|
-
const result = await client.
|
|
692
|
+
const result = await client.auth.solveCheckpoint(accountId, body);
|
|
890
693
|
const r = result;
|
|
891
694
|
renderSuccess(result, outOpts, out);
|
|
892
695
|
chained = r.status === "checkpoint_required";
|
|
@@ -907,7 +710,7 @@ async function runAccountCheckpointRequest(client, flags, out) {
|
|
|
907
710
|
const outOpts = resolveOutputOpts(flags);
|
|
908
711
|
if (flags.preview) {
|
|
909
712
|
const preview = buildPreviewOutput({
|
|
910
|
-
method: "
|
|
713
|
+
method: "auth.requestCheckpoint",
|
|
911
714
|
args: { accountId },
|
|
912
715
|
body: {}
|
|
913
716
|
});
|
|
@@ -915,7 +718,7 @@ async function runAccountCheckpointRequest(client, flags, out) {
|
|
|
915
718
|
return;
|
|
916
719
|
}
|
|
917
720
|
try {
|
|
918
|
-
const result = await client.
|
|
721
|
+
const result = await client.auth.requestCheckpoint(accountId);
|
|
919
722
|
renderSuccess(result, outOpts, out);
|
|
920
723
|
} catch (err) {
|
|
921
724
|
await handleError(err, outOpts, out);
|
|
@@ -932,7 +735,7 @@ async function runCheckpointPollWaitLoop(client, accountId, ctx) {
|
|
|
932
735
|
let timeoutAt = ctx.timeoutOverrideMs !== void 0 ? startedAt + ctx.timeoutOverrideMs : void 0;
|
|
933
736
|
await ctx.sleep(CHECKPOINT_POLL_FIRST_DELAY_MS);
|
|
934
737
|
for (; ; ) {
|
|
935
|
-
const result = await client.
|
|
738
|
+
const result = await client.auth.pollCheckpoint(accountId);
|
|
936
739
|
const r = result;
|
|
937
740
|
if (r.status === "active") return { kind: "active", result };
|
|
938
741
|
if (r.status === "expired" || r.status === "failed") {
|
|
@@ -959,7 +762,7 @@ async function runAccountCheckpointPoll(client, flags, out, io = {}) {
|
|
|
959
762
|
const outOpts = resolveOutputOpts(flags);
|
|
960
763
|
if (flags.preview) {
|
|
961
764
|
const preview = buildPreviewOutput({
|
|
962
|
-
method: "
|
|
765
|
+
method: "auth.pollCheckpoint",
|
|
963
766
|
args: { accountId },
|
|
964
767
|
body: {}
|
|
965
768
|
});
|
|
@@ -968,7 +771,7 @@ async function runAccountCheckpointPoll(client, flags, out, io = {}) {
|
|
|
968
771
|
}
|
|
969
772
|
if (!flags.wait) {
|
|
970
773
|
try {
|
|
971
|
-
const result = await client.
|
|
774
|
+
const result = await client.auth.pollCheckpoint(accountId);
|
|
972
775
|
renderSuccess(result, outOpts, out);
|
|
973
776
|
} catch (err) {
|
|
974
777
|
await handleError(err, outOpts, out);
|
|
@@ -1086,6 +889,7 @@ var accountLinkCommand = defineCommand({
|
|
|
1086
889
|
"proxy-password": { type: "string", description: `Proxy auth password. ${OPTIONAL_SECRET_WARNING("CURVIATE_PROXY_PASSWORD")}` },
|
|
1087
890
|
"user-agent": { type: "string", description: "Browser User-Agent to pin for this account." },
|
|
1088
891
|
"recruiter-contract-id": { type: "string", description: "Recruiter contract to bind to (Recruiter tier only)." },
|
|
892
|
+
"account-id": { type: "string", description: "Existing account id (acc_\u2026) to re-authenticate IN PLACE \u2014 passing it makes this an in-place reconnect of that account. Omit to connect a NEW account into --seat-id." },
|
|
1089
893
|
"no-interactive": {
|
|
1090
894
|
type: "boolean",
|
|
1091
895
|
description: "Never prompt for a checkpoint code \u2014 on a checkpoint, always render the envelope and exit 12, even on a TTY.",
|
|
@@ -1109,100 +913,16 @@ var accountLinkCommand = defineCommand({
|
|
|
1109
913
|
await runAccountLink(client, flags, out);
|
|
1110
914
|
}
|
|
1111
915
|
});
|
|
1112
|
-
var accountConnectLinkCommand = defineCommand({
|
|
1113
|
-
meta: {
|
|
1114
|
-
name: "connect-link",
|
|
1115
|
-
description: "Generate a one-time hosted URL to connect a NEW LinkedIn account. On an interactive TTY the URL auto-opens in your browser and the command waits for the account to connect (exit 0 on success, 9 if the link expires or fails, 12 if the wait window elapses first). Non-interactively it never opens a browser and returns immediately with the url and session_id \u2014 poll completion later with `account connect-session poll`. To re-authorize an EXISTING account, use `account reconnect-link`."
|
|
1116
|
-
},
|
|
1117
|
-
args: {
|
|
1118
|
-
...WRITE_SINGLE_FLAGS,
|
|
1119
|
-
"seat-id": { type: "string", description: "Empty seat to bind the new account to.", required: true },
|
|
1120
|
-
"expires-in-seconds": { type: "string", description: "Link expiry in seconds (60\u20133600, default 900)." },
|
|
1121
|
-
"redirect-url": { type: "string", description: "Browser return URL after the hosted flow." },
|
|
1122
|
-
open: {
|
|
1123
|
-
type: "boolean",
|
|
1124
|
-
description: "Auto-open the URL in your default browser. Default: on for an interactive TTY, always off otherwise (ignored non-interactively)."
|
|
1125
|
-
},
|
|
1126
|
-
wait: {
|
|
1127
|
-
type: "boolean",
|
|
1128
|
-
description: "Poll for the account to connect on an adaptive cadence (1000ms, then 1500ms for 30s, then 3000ms) after opening the URL. Default: on for an interactive TTY, always off otherwise (the agent polls later via `account connect-session poll`)."
|
|
1129
|
-
},
|
|
1130
|
-
// Override WRITE_SINGLE_FLAGS.timeout: on this command --timeout is the
|
|
1131
|
-
// TTY+interactive wait loop's own wall-clock bound in MILLISECONDS
|
|
1132
|
-
// (meaningless outside that branch) — NOT the SDK request timeout.
|
|
1133
|
-
// Default: the time remaining to the link's own expiry.
|
|
1134
|
-
timeout: {
|
|
1135
|
-
type: "string",
|
|
1136
|
-
description: "Wait-loop timeout in milliseconds (only meaningful under the interactive TTY wait; default: time remaining to the link's expiry). Note the unit: this is milliseconds."
|
|
1137
|
-
}
|
|
1138
|
-
},
|
|
1139
|
-
async run({ args }) {
|
|
1140
|
-
const flags = args;
|
|
1141
|
-
const cfg = await resolveEffectiveConfig({
|
|
1142
|
-
apiKey: flags["api-key"],
|
|
1143
|
-
baseUrl: flags["base-url"],
|
|
1144
|
-
profile: flags.profile
|
|
1145
|
-
});
|
|
1146
|
-
if (!cfg.apiKey) {
|
|
1147
|
-
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
1148
|
-
process.exit(3);
|
|
1149
|
-
}
|
|
1150
|
-
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
1151
|
-
const out = buildOutputStreams();
|
|
1152
|
-
await runAccountConnectLink(client, flags, out);
|
|
1153
|
-
}
|
|
1154
|
-
});
|
|
1155
|
-
var accountReconnectLinkCommand = defineCommand({
|
|
1156
|
-
meta: {
|
|
1157
|
-
name: "reconnect-link",
|
|
1158
|
-
description: "Generate a one-time hosted URL to re-authorize an EXISTING disconnected account (the hosted counterpart of `account reconnect`). On an interactive TTY the URL auto-opens and the command waits for the account to reconnect (exit 0 on success, 9 if the link expires or fails, 12 if the wait window elapses first). Non-interactively it prints the url + session_id and returns immediately \u2014 poll completion later with `account connect-session poll`."
|
|
1159
|
-
},
|
|
1160
|
-
args: {
|
|
1161
|
-
...WRITE_SINGLE_FLAGS,
|
|
1162
|
-
"account-id": { type: "positional", description: "Account id (acc_\u2026) to re-authorize." },
|
|
1163
|
-
"expires-in-seconds": { type: "string", description: "Link expiry in seconds (60\u20133600, default 900)." },
|
|
1164
|
-
"redirect-url": { type: "string", description: "Browser return URL after the hosted flow." },
|
|
1165
|
-
open: {
|
|
1166
|
-
type: "boolean",
|
|
1167
|
-
description: "Auto-open the URL in your default browser. Default: on for an interactive TTY, always off otherwise (ignored non-interactively)."
|
|
1168
|
-
},
|
|
1169
|
-
wait: {
|
|
1170
|
-
type: "boolean",
|
|
1171
|
-
description: "Poll for the account to reconnect on an adaptive cadence (1000ms, then 1500ms for 30s, then 3000ms) after opening the URL. Default: on for an interactive TTY, always off otherwise."
|
|
1172
|
-
},
|
|
1173
|
-
// Override WRITE_SINGLE_FLAGS.timeout: --timeout is the interactive wait
|
|
1174
|
-
// loop's own wall-clock bound in MILLISECONDS, not the SDK request timeout.
|
|
1175
|
-
timeout: {
|
|
1176
|
-
type: "string",
|
|
1177
|
-
description: "Wait-loop timeout in milliseconds (only meaningful under the interactive TTY wait; default: time remaining to the link's expiry). Note the unit: this is milliseconds."
|
|
1178
|
-
}
|
|
1179
|
-
},
|
|
1180
|
-
async run({ args }) {
|
|
1181
|
-
const flags = args;
|
|
1182
|
-
const cfg = await resolveEffectiveConfig({
|
|
1183
|
-
apiKey: flags["api-key"],
|
|
1184
|
-
baseUrl: flags["base-url"],
|
|
1185
|
-
profile: flags.profile
|
|
1186
|
-
});
|
|
1187
|
-
if (!cfg.apiKey) {
|
|
1188
|
-
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
1189
|
-
process.exit(3);
|
|
1190
|
-
}
|
|
1191
|
-
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
1192
|
-
const out = buildOutputStreams();
|
|
1193
|
-
await runAccountReconnectLink(client, flags, out);
|
|
1194
|
-
}
|
|
1195
|
-
});
|
|
1196
916
|
var accountConnectSessionPollCommand = defineCommand({
|
|
1197
917
|
meta: {
|
|
1198
918
|
name: "poll",
|
|
1199
|
-
description: "Poll
|
|
919
|
+
description: "Poll the status of an in-progress connect (auth intent) for completion. Without --wait: a single poll \u2014 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."
|
|
1200
920
|
},
|
|
1201
921
|
args: {
|
|
1202
922
|
...WRITE_SINGLE_FLAGS,
|
|
1203
923
|
session: {
|
|
1204
924
|
type: "string",
|
|
1205
|
-
description: "The
|
|
925
|
+
description: "The account's acc_\u2026 id, returned by `account link` or a checkpoint response.",
|
|
1206
926
|
required: true
|
|
1207
927
|
},
|
|
1208
928
|
wait: {
|
|
@@ -1236,7 +956,7 @@ var accountConnectSessionPollCommand = defineCommand({
|
|
|
1236
956
|
}
|
|
1237
957
|
});
|
|
1238
958
|
var accountConnectSessionCommand = defineCommand({
|
|
1239
|
-
meta: { name: "connect-session", description: "
|
|
959
|
+
meta: { name: "connect-session", description: "In-progress connect operations (poll for completion)." },
|
|
1240
960
|
subCommands: {
|
|
1241
961
|
poll: accountConnectSessionPollCommand
|
|
1242
962
|
},
|
|
@@ -1244,53 +964,6 @@ var accountConnectSessionCommand = defineCommand({
|
|
|
1244
964
|
process.stderr.write("Usage: curviate account connect-session poll --session <session_id>\n");
|
|
1245
965
|
}
|
|
1246
966
|
});
|
|
1247
|
-
var accountReconnectCommand = defineCommand({
|
|
1248
|
-
meta: {
|
|
1249
|
-
name: "reconnect",
|
|
1250
|
-
description: "Re-authorize a disconnected account in place. If LinkedIn requires verification you'll be prompted for the code interactively; in a non-interactive shell the command exits 12 and you finish with `curviate account checkpoint solve <account_id> --code`."
|
|
1251
|
-
},
|
|
1252
|
-
args: {
|
|
1253
|
-
...WRITE_SINGLE_FLAGS,
|
|
1254
|
-
"account-id": { type: "positional", description: "Account id (acc_\u2026)." },
|
|
1255
|
-
"auth-method": { type: "string", description: "Authentication method: credentials | cookie.", required: true },
|
|
1256
|
-
email: { type: "string", description: "LinkedIn email (credentials method)." },
|
|
1257
|
-
password: { type: "string", description: `LinkedIn password (credentials method). ${PW_WARNING("--password-stdin", "CURVIATE_LINKEDIN_PASSWORD")}` },
|
|
1258
|
-
"password-stdin": { type: "boolean", description: "Read the LinkedIn password from stdin (one line, trimmed).", default: false },
|
|
1259
|
-
"li-at": { type: "string", description: `LinkedIn session cookie li_at (cookie method). ${PW_WARNING("--li-at-stdin", "CURVIATE_LINKEDIN_LI_AT")}` },
|
|
1260
|
-
"li-at-stdin": { type: "boolean", description: "Read the li_at session cookie from stdin (one line, trimmed).", default: false },
|
|
1261
|
-
"li-a": { type: "string", description: `Optional premium session cookie li_a (cookie method). ${OPTIONAL_SECRET_WARNING("CURVIATE_LINKEDIN_LI_A")}` },
|
|
1262
|
-
country: { type: "string", description: "Proxy location hint (ISO 3166-1 alpha-2)." },
|
|
1263
|
-
ip: { type: "string", description: "IP to infer the managed proxy location." },
|
|
1264
|
-
"proxy-protocol": { type: "string", description: "Proxy protocol: http | https | socks5." },
|
|
1265
|
-
"proxy-host": { type: "string", description: "Proxy host or IP." },
|
|
1266
|
-
"proxy-port": { type: "string", description: "Proxy port." },
|
|
1267
|
-
"proxy-username": { type: "string", description: "Proxy auth username." },
|
|
1268
|
-
"proxy-password": { type: "string", description: `Proxy auth password. ${OPTIONAL_SECRET_WARNING("CURVIATE_PROXY_PASSWORD")}` },
|
|
1269
|
-
"user-agent": { type: "string", description: "Browser User-Agent to pin." },
|
|
1270
|
-
"recruiter-contract-id": { type: "string", description: "Recruiter contract id (Recruiter tier only)." },
|
|
1271
|
-
"no-interactive": {
|
|
1272
|
-
type: "boolean",
|
|
1273
|
-
description: "Never prompt for a checkpoint code \u2014 on a checkpoint, always render the envelope and exit 12, even on a TTY.",
|
|
1274
|
-
default: false
|
|
1275
|
-
}
|
|
1276
|
-
},
|
|
1277
|
-
async run({ args }) {
|
|
1278
|
-
const flags = args;
|
|
1279
|
-
const cfg = await resolveEffectiveConfig({
|
|
1280
|
-
apiKey: flags["api-key"],
|
|
1281
|
-
baseUrl: flags["base-url"],
|
|
1282
|
-
timeout: flags.timeout,
|
|
1283
|
-
profile: flags.profile
|
|
1284
|
-
});
|
|
1285
|
-
if (!cfg.apiKey) {
|
|
1286
|
-
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
1287
|
-
process.exit(3);
|
|
1288
|
-
}
|
|
1289
|
-
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
1290
|
-
const out = buildOutputStreams();
|
|
1291
|
-
await runAccountReconnect(client, flags, out);
|
|
1292
|
-
}
|
|
1293
|
-
});
|
|
1294
967
|
var accountUpdateCommand = defineCommand({
|
|
1295
968
|
meta: { name: "update", description: "Update an account's metadata and/or custom-proxy configuration." },
|
|
1296
969
|
args: {
|
|
@@ -1465,17 +1138,14 @@ var accountCommand = defineCommand({
|
|
|
1465
1138
|
list: accountListCommand,
|
|
1466
1139
|
get: accountGetCommand,
|
|
1467
1140
|
link: accountLinkCommand,
|
|
1468
|
-
"connect-link": accountConnectLinkCommand,
|
|
1469
|
-
"reconnect-link": accountReconnectLinkCommand,
|
|
1470
1141
|
"connect-session": accountConnectSessionCommand,
|
|
1471
|
-
reconnect: accountReconnectCommand,
|
|
1472
1142
|
update: accountUpdateCommand,
|
|
1473
1143
|
disconnect: accountDisconnectCommand,
|
|
1474
1144
|
checkpoint: accountCheckpointCommand
|
|
1475
1145
|
},
|
|
1476
1146
|
async run() {
|
|
1477
1147
|
process.stderr.write(
|
|
1478
|
-
"Usage: curviate account <subcommand>\n list | get | link | connect-
|
|
1148
|
+
"Usage: curviate account <subcommand>\n list | get | link | connect-session poll | update | disconnect | checkpoint\n"
|
|
1479
1149
|
);
|
|
1480
1150
|
}
|
|
1481
1151
|
});
|
|
@@ -1484,13 +1154,10 @@ export {
|
|
|
1484
1154
|
runAccountCheckpointPoll,
|
|
1485
1155
|
runAccountCheckpointRequest,
|
|
1486
1156
|
runAccountCheckpointSolve,
|
|
1487
|
-
runAccountConnectLink,
|
|
1488
1157
|
runAccountConnectSessionPoll,
|
|
1489
1158
|
runAccountDisconnect,
|
|
1490
1159
|
runAccountGet,
|
|
1491
1160
|
runAccountLink,
|
|
1492
1161
|
runAccountList,
|
|
1493
|
-
runAccountReconnect,
|
|
1494
|
-
runAccountReconnectLink,
|
|
1495
1162
|
runAccountUpdate
|
|
1496
1163
|
};
|