@curviate/cli 0.14.0 → 0.15.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 +104 -0
- package/README.md +52 -79
- package/dist/{account-7AUDAMIK.js → account-VB52GIUA.js} +34 -369
- package/dist/{chunk-SSPILTKF.js → chunk-45KHSWCV.js} +56 -48
- package/dist/chunk-BGZW6B7G.js +59 -0
- package/dist/{chunk-GXTZION6.js → chunk-DNTRQZBT.js} +13 -1
- package/dist/chunk-QJZ3LWOX.js +24 -0
- package/dist/{chunk-HMAGEMF7.js → chunk-ZE7QGR3F.js} +4 -0
- package/dist/cli.js +75 -12
- package/dist/comment-Y5IU42CR.js +550 -0
- package/dist/{company-RU2CA5DY.js → company-LGID3SK3.js} +21 -72
- package/dist/{connect-QT6ZOS75.js → connect-A7HEKKEE.js} +86 -43
- package/dist/{exit-codes-ZTY2NY3X.js → exit-codes-SL3GQF7W.js} +1 -1
- package/dist/{inbox-DN7X7CM2.js → inbox-44JRTJAP.js} +50 -122
- package/dist/job-TFTTCP5B.js +561 -0
- package/dist/{message-6K5E3CUF.js → message-FOJTDPW3.js} +47 -47
- package/dist/{post-2JQZ3OSF.js → post-FC6NZXM5.js} +177 -219
- package/dist/profile-I6YMVXSS.js +799 -0
- package/dist/{recruiter-XHVMQWK6.js → recruiter-BHT5OJD7.js} +731 -224
- package/dist/{sales-nav-QTSTJMKA.js → sales-nav-6IYKQ4TC.js} +109 -75
- package/dist/{search-ZGTS45BT.js → search-6C72M563.js} +95 -37
- package/dist/{webhook-EIY5WWTE.js → webhook-NSXEIU44.js} +4 -43
- package/package.json +4 -3
- package/dist/chunk-Q43HZUN3.js +0 -29
- package/dist/job-FGGQEXSU.js +0 -105
- package/dist/profile-DD5GMGNL.js +0 -501
|
@@ -7,18 +7,18 @@ 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
|
+
streamAll
|
|
21
|
+
} from "./chunk-DNTRQZBT.js";
|
|
22
22
|
import {
|
|
23
23
|
createClient,
|
|
24
24
|
renderError,
|
|
@@ -203,7 +203,7 @@ function resolveOutputOpts(flags) {
|
|
|
203
203
|
async function handleError(err, outOpts, out) {
|
|
204
204
|
const { CurviateError } = await import("@curviate/sdk");
|
|
205
205
|
if (err instanceof CurviateError) {
|
|
206
|
-
const { getExitCode } = await import("./exit-codes-
|
|
206
|
+
const { getExitCode } = await import("./exit-codes-SL3GQF7W.js");
|
|
207
207
|
renderError(err, outOpts, out);
|
|
208
208
|
process.exit(getExitCode(err.code));
|
|
209
209
|
}
|
|
@@ -225,8 +225,7 @@ async function runAccountList(client, flags, out) {
|
|
|
225
225
|
const fn = (p) => client.accounts.list(p);
|
|
226
226
|
for await (const item of streamAll(fn, params, {
|
|
227
227
|
maxPages,
|
|
228
|
-
|
|
229
|
-
`)
|
|
228
|
+
out
|
|
230
229
|
})) {
|
|
231
230
|
const projected = outOpts.verbose ? item : slimAccountListItem(item);
|
|
232
231
|
out.stdout.write(JSON.stringify(projected) + "\n");
|
|
@@ -353,7 +352,7 @@ async function waitForMobileApproval(client, accountId, expiresAt, ctx) {
|
|
|
353
352
|
for (; ; ) {
|
|
354
353
|
let result;
|
|
355
354
|
try {
|
|
356
|
-
result = await client.
|
|
355
|
+
result = await client.auth.pollCheckpoint(accountId);
|
|
357
356
|
} catch (err) {
|
|
358
357
|
return await handleError(err, ctx.outOpts, ctx.out);
|
|
359
358
|
}
|
|
@@ -404,7 +403,7 @@ async function runInteractiveCheckpointLoop(client, initial, ctx) {
|
|
|
404
403
|
for (; ; ) {
|
|
405
404
|
const code = await ctx.readline("Enter the code: ");
|
|
406
405
|
try {
|
|
407
|
-
const result = await client.
|
|
406
|
+
const result = await client.auth.solveCheckpoint(accountId, { code });
|
|
408
407
|
const r = result;
|
|
409
408
|
if (r.status === "checkpoint_required") {
|
|
410
409
|
current = { ...r, account_id: r.account_id ?? accountId };
|
|
@@ -467,17 +466,21 @@ async function runAccountLink(client, flags, out, io = {}) {
|
|
|
467
466
|
});
|
|
468
467
|
const body = {
|
|
469
468
|
seat_id: flags["seat-id"],
|
|
470
|
-
...authBody
|
|
469
|
+
...authBody,
|
|
470
|
+
// --account-id (0.15.0): present → re-authenticate this existing account in
|
|
471
|
+
// place (reconnect); omit → connect a new account, with NO account_id key in
|
|
472
|
+
// the body at all (not undefined, not empty).
|
|
473
|
+
...flags["account-id"] ? { account_id: flags["account-id"] } : {}
|
|
471
474
|
};
|
|
472
475
|
const outOpts = resolveOutputOpts(flags);
|
|
473
476
|
if (flags.preview) {
|
|
474
|
-
const preview = buildPreviewOutput({ method: "
|
|
477
|
+
const preview = buildPreviewOutput({ method: "auth.intent", args: {}, body: maskCredentialSecretsForPreview(body) });
|
|
475
478
|
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
476
479
|
return;
|
|
477
480
|
}
|
|
478
481
|
let result;
|
|
479
482
|
try {
|
|
480
|
-
result = await client.
|
|
483
|
+
result = await client.auth.intent(body);
|
|
481
484
|
} catch (err) {
|
|
482
485
|
await handleError(err, outOpts, out);
|
|
483
486
|
return;
|
|
@@ -495,7 +498,7 @@ async function runConnectSessionWaitLoop(client, sessionId, ctx) {
|
|
|
495
498
|
let timeoutAt = ctx.timeoutOverrideMs !== void 0 ? startedAt + ctx.timeoutOverrideMs : void 0;
|
|
496
499
|
await ctx.sleep(CHECKPOINT_POLL_FIRST_DELAY_MS);
|
|
497
500
|
for (; ; ) {
|
|
498
|
-
const result = await client.
|
|
501
|
+
const result = await client.auth.getSession(sessionId);
|
|
499
502
|
const r = result;
|
|
500
503
|
if (r.status === "resolved") return { kind: "resolved", result };
|
|
501
504
|
if (r.status === "expired" || r.status === "failed") {
|
|
@@ -528,99 +531,21 @@ function resolveWaitTimeoutOverrideMs(flags, out) {
|
|
|
528
531
|
}
|
|
529
532
|
return parsed;
|
|
530
533
|
}
|
|
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
534
|
async function runAccountConnectSessionPoll(client, flags, out, io = {}) {
|
|
610
535
|
if (!flags.session) {
|
|
611
|
-
out.stderr.write("error: --session is required (the
|
|
536
|
+
out.stderr.write("error: --session is required (the account's acc_\u2026 id from `account link` or a checkpoint response).\n");
|
|
612
537
|
process.exit(2);
|
|
613
538
|
}
|
|
614
539
|
const sessionId = flags.session;
|
|
615
540
|
const outOpts = resolveOutputOpts(flags);
|
|
616
541
|
if (flags.preview) {
|
|
617
|
-
const preview = buildPreviewOutput({ method: "
|
|
542
|
+
const preview = buildPreviewOutput({ method: "auth.getSession", args: { session_id: sessionId }, body: {} });
|
|
618
543
|
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
619
544
|
return;
|
|
620
545
|
}
|
|
621
546
|
if (!flags.wait) {
|
|
622
547
|
try {
|
|
623
|
-
const result = await client.
|
|
548
|
+
const result = await client.auth.getSession(sessionId);
|
|
624
549
|
renderSuccess(result, outOpts, out);
|
|
625
550
|
} catch (err) {
|
|
626
551
|
await handleError(err, outOpts, out);
|
|
@@ -650,7 +575,7 @@ async function runAccountConnectSessionPoll(client, flags, out, io = {}) {
|
|
|
650
575
|
if (outcome.kind === "terminal_failure") {
|
|
651
576
|
renderSuccess(outcome.result, outOpts, out);
|
|
652
577
|
out.stderr.write(
|
|
653
|
-
`This connect session has ${outcome.status}.
|
|
578
|
+
`This connect session has ${outcome.status}. Start a new connect: curviate account link.
|
|
654
579
|
`
|
|
655
580
|
);
|
|
656
581
|
process.exit(9);
|
|
@@ -663,128 +588,6 @@ async function runAccountConnectSessionPoll(client, flags, out, io = {}) {
|
|
|
663
588
|
);
|
|
664
589
|
process.exit(AUTH_NEEDED);
|
|
665
590
|
}
|
|
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
591
|
async function runAccountUpdate(client, flags, out) {
|
|
789
592
|
const accountId = flags["account-id"] ?? "";
|
|
790
593
|
const body = {};
|
|
@@ -871,13 +674,11 @@ async function runAccountCheckpointSolve(client, flags, out) {
|
|
|
871
674
|
process.exit(2);
|
|
872
675
|
}
|
|
873
676
|
const accountId = flags["account-id"] ?? "";
|
|
874
|
-
const body = {
|
|
875
|
-
code: flags.code
|
|
876
|
-
};
|
|
677
|
+
const body = { code: flags.code };
|
|
877
678
|
const outOpts = resolveOutputOpts(flags);
|
|
878
679
|
if (flags.preview) {
|
|
879
680
|
const preview = buildPreviewOutput({
|
|
880
|
-
method: "
|
|
681
|
+
method: "auth.solveCheckpoint",
|
|
881
682
|
args: { accountId },
|
|
882
683
|
body
|
|
883
684
|
});
|
|
@@ -886,7 +687,7 @@ async function runAccountCheckpointSolve(client, flags, out) {
|
|
|
886
687
|
}
|
|
887
688
|
let chained = false;
|
|
888
689
|
try {
|
|
889
|
-
const result = await client.
|
|
690
|
+
const result = await client.auth.solveCheckpoint(accountId, body);
|
|
890
691
|
const r = result;
|
|
891
692
|
renderSuccess(result, outOpts, out);
|
|
892
693
|
chained = r.status === "checkpoint_required";
|
|
@@ -907,7 +708,7 @@ async function runAccountCheckpointRequest(client, flags, out) {
|
|
|
907
708
|
const outOpts = resolveOutputOpts(flags);
|
|
908
709
|
if (flags.preview) {
|
|
909
710
|
const preview = buildPreviewOutput({
|
|
910
|
-
method: "
|
|
711
|
+
method: "auth.requestCheckpoint",
|
|
911
712
|
args: { accountId },
|
|
912
713
|
body: {}
|
|
913
714
|
});
|
|
@@ -915,7 +716,7 @@ async function runAccountCheckpointRequest(client, flags, out) {
|
|
|
915
716
|
return;
|
|
916
717
|
}
|
|
917
718
|
try {
|
|
918
|
-
const result = await client.
|
|
719
|
+
const result = await client.auth.requestCheckpoint(accountId);
|
|
919
720
|
renderSuccess(result, outOpts, out);
|
|
920
721
|
} catch (err) {
|
|
921
722
|
await handleError(err, outOpts, out);
|
|
@@ -932,7 +733,7 @@ async function runCheckpointPollWaitLoop(client, accountId, ctx) {
|
|
|
932
733
|
let timeoutAt = ctx.timeoutOverrideMs !== void 0 ? startedAt + ctx.timeoutOverrideMs : void 0;
|
|
933
734
|
await ctx.sleep(CHECKPOINT_POLL_FIRST_DELAY_MS);
|
|
934
735
|
for (; ; ) {
|
|
935
|
-
const result = await client.
|
|
736
|
+
const result = await client.auth.pollCheckpoint(accountId);
|
|
936
737
|
const r = result;
|
|
937
738
|
if (r.status === "active") return { kind: "active", result };
|
|
938
739
|
if (r.status === "expired" || r.status === "failed") {
|
|
@@ -959,7 +760,7 @@ async function runAccountCheckpointPoll(client, flags, out, io = {}) {
|
|
|
959
760
|
const outOpts = resolveOutputOpts(flags);
|
|
960
761
|
if (flags.preview) {
|
|
961
762
|
const preview = buildPreviewOutput({
|
|
962
|
-
method: "
|
|
763
|
+
method: "auth.pollCheckpoint",
|
|
963
764
|
args: { accountId },
|
|
964
765
|
body: {}
|
|
965
766
|
});
|
|
@@ -968,7 +769,7 @@ async function runAccountCheckpointPoll(client, flags, out, io = {}) {
|
|
|
968
769
|
}
|
|
969
770
|
if (!flags.wait) {
|
|
970
771
|
try {
|
|
971
|
-
const result = await client.
|
|
772
|
+
const result = await client.auth.pollCheckpoint(accountId);
|
|
972
773
|
renderSuccess(result, outOpts, out);
|
|
973
774
|
} catch (err) {
|
|
974
775
|
await handleError(err, outOpts, out);
|
|
@@ -1086,6 +887,7 @@ var accountLinkCommand = defineCommand({
|
|
|
1086
887
|
"proxy-password": { type: "string", description: `Proxy auth password. ${OPTIONAL_SECRET_WARNING("CURVIATE_PROXY_PASSWORD")}` },
|
|
1087
888
|
"user-agent": { type: "string", description: "Browser User-Agent to pin for this account." },
|
|
1088
889
|
"recruiter-contract-id": { type: "string", description: "Recruiter contract to bind to (Recruiter tier only)." },
|
|
890
|
+
"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
891
|
"no-interactive": {
|
|
1090
892
|
type: "boolean",
|
|
1091
893
|
description: "Never prompt for a checkpoint code \u2014 on a checkpoint, always render the envelope and exit 12, even on a TTY.",
|
|
@@ -1109,100 +911,16 @@ var accountLinkCommand = defineCommand({
|
|
|
1109
911
|
await runAccountLink(client, flags, out);
|
|
1110
912
|
}
|
|
1111
913
|
});
|
|
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
914
|
var accountConnectSessionPollCommand = defineCommand({
|
|
1197
915
|
meta: {
|
|
1198
916
|
name: "poll",
|
|
1199
|
-
description: "Poll
|
|
917
|
+
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
918
|
},
|
|
1201
919
|
args: {
|
|
1202
920
|
...WRITE_SINGLE_FLAGS,
|
|
1203
921
|
session: {
|
|
1204
922
|
type: "string",
|
|
1205
|
-
description: "The
|
|
923
|
+
description: "The account's acc_\u2026 id, returned by `account link` or a checkpoint response.",
|
|
1206
924
|
required: true
|
|
1207
925
|
},
|
|
1208
926
|
wait: {
|
|
@@ -1236,7 +954,7 @@ var accountConnectSessionPollCommand = defineCommand({
|
|
|
1236
954
|
}
|
|
1237
955
|
});
|
|
1238
956
|
var accountConnectSessionCommand = defineCommand({
|
|
1239
|
-
meta: { name: "connect-session", description: "
|
|
957
|
+
meta: { name: "connect-session", description: "In-progress connect operations (poll for completion)." },
|
|
1240
958
|
subCommands: {
|
|
1241
959
|
poll: accountConnectSessionPollCommand
|
|
1242
960
|
},
|
|
@@ -1244,53 +962,6 @@ var accountConnectSessionCommand = defineCommand({
|
|
|
1244
962
|
process.stderr.write("Usage: curviate account connect-session poll --session <session_id>\n");
|
|
1245
963
|
}
|
|
1246
964
|
});
|
|
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
965
|
var accountUpdateCommand = defineCommand({
|
|
1295
966
|
meta: { name: "update", description: "Update an account's metadata and/or custom-proxy configuration." },
|
|
1296
967
|
args: {
|
|
@@ -1465,17 +1136,14 @@ var accountCommand = defineCommand({
|
|
|
1465
1136
|
list: accountListCommand,
|
|
1466
1137
|
get: accountGetCommand,
|
|
1467
1138
|
link: accountLinkCommand,
|
|
1468
|
-
"connect-link": accountConnectLinkCommand,
|
|
1469
|
-
"reconnect-link": accountReconnectLinkCommand,
|
|
1470
1139
|
"connect-session": accountConnectSessionCommand,
|
|
1471
|
-
reconnect: accountReconnectCommand,
|
|
1472
1140
|
update: accountUpdateCommand,
|
|
1473
1141
|
disconnect: accountDisconnectCommand,
|
|
1474
1142
|
checkpoint: accountCheckpointCommand
|
|
1475
1143
|
},
|
|
1476
1144
|
async run() {
|
|
1477
1145
|
process.stderr.write(
|
|
1478
|
-
"Usage: curviate account <subcommand>\n list | get | link | connect-
|
|
1146
|
+
"Usage: curviate account <subcommand>\n list | get | link | connect-session poll | update | disconnect | checkpoint\n"
|
|
1479
1147
|
);
|
|
1480
1148
|
}
|
|
1481
1149
|
});
|
|
@@ -1484,13 +1152,10 @@ export {
|
|
|
1484
1152
|
runAccountCheckpointPoll,
|
|
1485
1153
|
runAccountCheckpointRequest,
|
|
1486
1154
|
runAccountCheckpointSolve,
|
|
1487
|
-
runAccountConnectLink,
|
|
1488
1155
|
runAccountConnectSessionPoll,
|
|
1489
1156
|
runAccountDisconnect,
|
|
1490
1157
|
runAccountGet,
|
|
1491
1158
|
runAccountLink,
|
|
1492
1159
|
runAccountList,
|
|
1493
|
-
runAccountReconnect,
|
|
1494
|
-
runAccountReconnectLink,
|
|
1495
1160
|
runAccountUpdate
|
|
1496
1161
|
};
|