@curviate/cli 0.48.0 → 0.50.0-next.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 +72 -0
- package/README.md +47 -6
- package/dist/{account-WKQHMM7P.js → account-KGCGUYKF.js} +668 -116
- package/dist/analytics-HRAD4ABO.js +27 -0
- package/dist/beta-consent-364JI6IL.js +81 -0
- package/dist/billing-3SSVRS2Y.js +124 -0
- package/dist/{chunk-Q63IIPL2.js → chunk-25MO7BYN.js} +4 -4
- package/dist/{chunk-76SWLAZ6.js → chunk-2W4RN5ON.js} +59 -1
- package/dist/chunk-5S3MJVI5.js +22 -0
- package/dist/chunk-67S4JHZZ.js +339 -0
- package/dist/chunk-73DJ3KNE.js +54 -0
- package/dist/chunk-CQGDMARG.js +525 -0
- package/dist/{chunk-Y7K4UBFC.js → chunk-DOHBOYXN.js} +1 -1
- package/dist/{chunk-TSOIZBBU.js → chunk-DSGKYZDK.js} +1 -1
- package/dist/{chunk-YLSJ4HKU.js → chunk-ENBIMEKS.js} +26 -1
- package/dist/{chunk-LCGXJGPB.js → chunk-GHMRPX5H.js} +7 -1
- package/dist/chunk-GOICALYQ.js +28 -0
- package/dist/chunk-L4CIJT6F.js +144 -0
- package/dist/{chunk-PQWDDSV7.js → chunk-L7JH3W56.js} +1 -1
- package/dist/{chunk-YFXLXION.js → chunk-OE6YFYUM.js} +85 -10
- package/dist/chunk-PPGKQJKU.js +38 -0
- package/dist/{chunk-MKGVNDMJ.js → chunk-QM57YDJE.js} +13 -201
- package/dist/{chunk-CVMSQ3OF.js → chunk-RYWWSZUH.js} +17 -3
- package/dist/chunk-T6GBS5SS.js +58 -0
- package/dist/{chunk-AYKKXGTR.js → chunk-TE3WBPW6.js} +392 -14
- package/dist/chunk-UL53T4O6.js +52 -0
- package/dist/chunk-UWQPX4AE.js +20 -0
- package/dist/{chunk-OHXYFICP.js → chunk-YXVF5UST.js} +77 -4
- package/dist/cli.js +35 -17
- package/dist/{comment-7IQ6ZOJF.js → comment-5JKGNYOY.js} +90 -11
- package/dist/{company-RD7RDGSA.js → company-TXST2VXW.js} +65 -15
- package/dist/{config-EYBNYRGK.js → config-TVIQUVNK.js} +53 -4
- package/dist/{connect-HVXT67A6.js → connect-RBL6U4KV.js} +63 -18
- package/dist/contact-YAHC5QFX.js +32 -0
- package/dist/contact-groups-DKOIBC57.js +399 -0
- package/dist/contact-import-ITSJQV7K.js +336 -0
- package/dist/core-PWMJPPRG.js +46 -0
- package/dist/do-not-contact-WDYIBWYA.js +200 -0
- package/dist/{doctor-HUXQERLQ.js → doctor-F7JLPTED.js} +65 -11
- package/dist/{document-AUUCGST2.js → document-BHYAUJ6F.js} +1 -1
- package/dist/{draft-DFO22K6Q.js → draft-TDJJUXLH.js} +60 -14
- package/dist/enrollment-Q6UOKHPY.js +484 -0
- package/dist/{examples-64YT5V5K.js → examples-DQSVIIXZ.js} +2 -2
- package/dist/{exit-codes-AW6KHDDN.js → exit-codes-7DBETBDT.js} +1 -1
- package/dist/export-HIJSCJS6.js +96 -0
- package/dist/{feed-JWP6ANPI.js → feed-W56ZTA4Z.js} +13 -10
- package/dist/{group-SIQFJEZV.js → group-AUALYK5H.js} +18 -10
- package/dist/{inbox-MMIMCA5O.js → inbox-HLZR2ZPV.js} +31 -12
- package/dist/{inboxes-RND3D4C7.js → inboxes-IZTRD6FE.js} +14 -10
- package/dist/incoming-ULB2RNV4.js +218 -0
- package/dist/{job-ACFKBLFK.js → job-55IKS6LP.js} +65 -13
- package/dist/{login-ZOB5KVKQ.js → login-DPZ6CXNO.js} +13 -4
- package/dist/{message-OFK6UVXR.js → message-J44YKRDS.js} +9 -7
- package/dist/motion-SQI5F2EK.js +868 -0
- package/dist/network-K4QD7APQ.js +235 -0
- package/dist/{notification-KKGAZU7M.js → notification-SEDXZHXO.js} +38 -11
- package/dist/notifications-HGIBRUNQ.js +231 -0
- package/dist/{post-A5SBCFB2.js → post-L467SKIG.js} +92 -12
- package/dist/{profile-4SOOQZ4K.js → profile-A2N6RMR2.js} +79 -23
- package/dist/{recruiter-YN73STDP.js → recruiter-AR75RHBO.js} +132 -21
- package/dist/{sales-nav-JXF5RY2K.js → sales-nav-C2AYFXPV.js} +73 -18
- package/dist/{search-JAL242A2.js → search-Z4DZIG4X.js} +55 -23
- package/dist/{setup-WICWH4JG.js → setup-45BEVX6B.js} +69 -17
- package/dist/team-6QWY4IFP.js +450 -0
- package/dist/tier-2HS3BXDF.js +61 -0
- package/dist/unibox-DHUKG65Z.js +402 -0
- package/dist/{webhook-UGKVYWBC.js → webhook-Q53WUAI2.js} +273 -45
- package/package.json +2 -2
- package/dist/chunk-GQKC6E5K.js +0 -36
- package/dist/core-6XYGUNAY.js +0 -46
|
@@ -3,10 +3,7 @@ import {
|
|
|
3
3
|
DEFAULT_FILTER_READERS,
|
|
4
4
|
assembleFilters,
|
|
5
5
|
splitCsv
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
requireAccount
|
|
9
|
-
} from "./chunk-Q63IIPL2.js";
|
|
6
|
+
} from "./chunk-DSGKYZDK.js";
|
|
10
7
|
import {
|
|
11
8
|
slimSearchCompanies,
|
|
12
9
|
slimSearchCompaniesItem,
|
|
@@ -16,7 +13,10 @@ import {
|
|
|
16
13
|
slimSearchPeopleItem,
|
|
17
14
|
slimSearchPosts,
|
|
18
15
|
slimSearchPostsItem
|
|
19
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-GHMRPX5H.js";
|
|
17
|
+
import {
|
|
18
|
+
requireAccount
|
|
19
|
+
} from "./chunk-25MO7BYN.js";
|
|
20
20
|
import {
|
|
21
21
|
intFlag,
|
|
22
22
|
intListFlag
|
|
@@ -27,27 +27,29 @@ import {
|
|
|
27
27
|
readMaxPagesFlag,
|
|
28
28
|
readablePage,
|
|
29
29
|
rejectPaginationModifiersWithoutAll,
|
|
30
|
+
streamAll
|
|
31
|
+
} from "./chunk-L4CIJT6F.js";
|
|
32
|
+
import {
|
|
30
33
|
renderError,
|
|
31
34
|
renderSuccess,
|
|
32
35
|
renderUnexpectedError,
|
|
33
|
-
resolveEffectiveConfig,
|
|
34
|
-
streamAll,
|
|
35
36
|
writeNdjsonItem
|
|
36
|
-
} from "./chunk-
|
|
37
|
-
import "./chunk-76SWLAZ6.js";
|
|
37
|
+
} from "./chunk-QM57YDJE.js";
|
|
38
38
|
import {
|
|
39
|
-
createClient
|
|
40
|
-
|
|
39
|
+
createClient,
|
|
40
|
+
resolveEffectiveConfig
|
|
41
|
+
} from "./chunk-YXVF5UST.js";
|
|
41
42
|
import {
|
|
42
43
|
GLOBAL_FLAGS,
|
|
43
44
|
readOnly
|
|
44
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-RYWWSZUH.js";
|
|
45
46
|
import {
|
|
46
47
|
DESCRIPTIONS
|
|
47
|
-
} from "./chunk-
|
|
48
|
-
import "./chunk-
|
|
48
|
+
} from "./chunk-73DJ3KNE.js";
|
|
49
|
+
import "./chunk-TE3WBPW6.js";
|
|
49
50
|
import "./chunk-FDJMAF7D.js";
|
|
50
51
|
import "./chunk-ZYURL5VK.js";
|
|
52
|
+
import "./chunk-2W4RN5ON.js";
|
|
51
53
|
|
|
52
54
|
// src/commands/search.ts
|
|
53
55
|
import { defineCommand } from "citty";
|
|
@@ -224,7 +226,7 @@ async function runSearchPeople(client, flags, out, readers = DEFAULT_FILTER_READ
|
|
|
224
226
|
} catch (err) {
|
|
225
227
|
const { CurviateError } = await import("@curviate/sdk");
|
|
226
228
|
if (err instanceof CurviateError) {
|
|
227
|
-
const { getExitCode } = await import("./exit-codes-
|
|
229
|
+
const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
|
|
228
230
|
renderError(err, outOpts, out);
|
|
229
231
|
process.exit(getExitCode(err));
|
|
230
232
|
}
|
|
@@ -266,7 +268,7 @@ async function runSearchCompanies(client, flags, out, readers = DEFAULT_FILTER_R
|
|
|
266
268
|
} catch (err) {
|
|
267
269
|
const { CurviateError } = await import("@curviate/sdk");
|
|
268
270
|
if (err instanceof CurviateError) {
|
|
269
|
-
const { getExitCode } = await import("./exit-codes-
|
|
271
|
+
const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
|
|
270
272
|
renderError(err, outOpts, out);
|
|
271
273
|
process.exit(getExitCode(err));
|
|
272
274
|
}
|
|
@@ -308,7 +310,7 @@ async function runSearchPosts(client, flags, out, readers = DEFAULT_FILTER_READE
|
|
|
308
310
|
} catch (err) {
|
|
309
311
|
const { CurviateError } = await import("@curviate/sdk");
|
|
310
312
|
if (err instanceof CurviateError) {
|
|
311
|
-
const { getExitCode } = await import("./exit-codes-
|
|
313
|
+
const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
|
|
312
314
|
renderError(err, outOpts, out);
|
|
313
315
|
process.exit(getExitCode(err));
|
|
314
316
|
}
|
|
@@ -350,7 +352,7 @@ async function runSearchJobs(client, flags, out, readers = DEFAULT_FILTER_READER
|
|
|
350
352
|
} catch (err) {
|
|
351
353
|
const { CurviateError } = await import("@curviate/sdk");
|
|
352
354
|
if (err instanceof CurviateError) {
|
|
353
|
-
const { getExitCode } = await import("./exit-codes-
|
|
355
|
+
const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
|
|
354
356
|
renderError(err, outOpts, out);
|
|
355
357
|
process.exit(getExitCode(err));
|
|
356
358
|
}
|
|
@@ -398,7 +400,7 @@ async function runSearchParameters(client, flags, out) {
|
|
|
398
400
|
} catch (err) {
|
|
399
401
|
const { CurviateError } = await import("@curviate/sdk");
|
|
400
402
|
if (err instanceof CurviateError) {
|
|
401
|
-
const { getExitCode } = await import("./exit-codes-
|
|
403
|
+
const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
|
|
402
404
|
renderError(err, outOpts, out);
|
|
403
405
|
process.exit(getExitCode(err));
|
|
404
406
|
}
|
|
@@ -440,7 +442,7 @@ async function runSearchGroups(client, flags, out) {
|
|
|
440
442
|
} catch (err) {
|
|
441
443
|
const { CurviateError } = await import("@curviate/sdk");
|
|
442
444
|
if (err instanceof CurviateError) {
|
|
443
|
-
const { getExitCode } = await import("./exit-codes-
|
|
445
|
+
const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
|
|
444
446
|
renderError(err, outOpts, out);
|
|
445
447
|
process.exit(getExitCode(err));
|
|
446
448
|
}
|
|
@@ -484,7 +486,7 @@ async function runSearchServices(client, flags, out) {
|
|
|
484
486
|
} catch (err) {
|
|
485
487
|
const { CurviateError } = await import("@curviate/sdk");
|
|
486
488
|
if (err instanceof CurviateError) {
|
|
487
|
-
const { getExitCode } = await import("./exit-codes-
|
|
489
|
+
const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
|
|
488
490
|
renderError(err, outOpts, out);
|
|
489
491
|
process.exit(getExitCode(err));
|
|
490
492
|
}
|
|
@@ -526,7 +528,7 @@ async function runSearchServiceParameters(client, flags, out) {
|
|
|
526
528
|
} catch (err) {
|
|
527
529
|
const { CurviateError } = await import("@curviate/sdk");
|
|
528
530
|
if (err instanceof CurviateError) {
|
|
529
|
-
const { getExitCode } = await import("./exit-codes-
|
|
531
|
+
const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
|
|
530
532
|
renderError(err, outOpts, out);
|
|
531
533
|
process.exit(getExitCode(err));
|
|
532
534
|
}
|
|
@@ -565,7 +567,7 @@ async function runSearchFromUrl(client, flags, out) {
|
|
|
565
567
|
} catch (err) {
|
|
566
568
|
const { CurviateError } = await import("@curviate/sdk");
|
|
567
569
|
if (err instanceof CurviateError) {
|
|
568
|
-
const { getExitCode } = await import("./exit-codes-
|
|
570
|
+
const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
|
|
569
571
|
renderError(err, outOpts, out);
|
|
570
572
|
process.exit(getExitCode(err));
|
|
571
573
|
}
|
|
@@ -577,6 +579,10 @@ var searchPeopleCommand = defineCommand({
|
|
|
577
579
|
meta: {
|
|
578
580
|
name: "people",
|
|
579
581
|
description: "Search members with structured filters.",
|
|
582
|
+
risk: "read",
|
|
583
|
+
rules: {
|
|
584
|
+
budget_rows: ["search"]
|
|
585
|
+
},
|
|
580
586
|
examples: [
|
|
581
587
|
'curviate core search people --keywords "AI engineer"',
|
|
582
588
|
'curviate core search people --keywords "AI engineer" --location 106967730',
|
|
@@ -621,6 +627,10 @@ var searchCompaniesCommand = defineCommand({
|
|
|
621
627
|
meta: {
|
|
622
628
|
name: "companies",
|
|
623
629
|
description: "Search companies.",
|
|
630
|
+
risk: "read",
|
|
631
|
+
rules: {
|
|
632
|
+
budget_rows: ["search"]
|
|
633
|
+
},
|
|
624
634
|
examples: [
|
|
625
635
|
'curviate core search companies --keywords "developer tools"',
|
|
626
636
|
"curviate core search companies --keywords robotics --headcount 11-50,51-200"
|
|
@@ -660,6 +670,10 @@ var searchPostsCommand = defineCommand({
|
|
|
660
670
|
meta: {
|
|
661
671
|
name: "posts",
|
|
662
672
|
description: "Search posts. Each result's text can repeat fragments around links, mentions and hashtags; use `curviate core post get <id>` for the clean body.",
|
|
673
|
+
risk: "read",
|
|
674
|
+
rules: {
|
|
675
|
+
budget_rows: ["search"]
|
|
676
|
+
},
|
|
663
677
|
examples: [
|
|
664
678
|
'curviate core search posts --keywords "agent infrastructure"',
|
|
665
679
|
'curviate core search posts --keywords "agent infrastructure" --date-posted past_week'
|
|
@@ -703,6 +717,10 @@ var searchJobsCommand = defineCommand({
|
|
|
703
717
|
meta: {
|
|
704
718
|
name: "jobs",
|
|
705
719
|
description: "Search jobs.",
|
|
720
|
+
risk: "read",
|
|
721
|
+
rules: {
|
|
722
|
+
budget_rows: ["search"]
|
|
723
|
+
},
|
|
706
724
|
examples: [
|
|
707
725
|
'curviate core search jobs --keywords "AI engineer"',
|
|
708
726
|
'curviate core search jobs --keywords "AI engineer" --location 106967730 --presence remote'
|
|
@@ -760,6 +778,7 @@ var searchParametersCommand = defineCommand({
|
|
|
760
778
|
meta: {
|
|
761
779
|
name: "parameters",
|
|
762
780
|
description: "Resolve human-readable terms to opaque filter IDs. Paginated: --cursor pages manually, --all streams every page as NDJSON.",
|
|
781
|
+
risk: "read",
|
|
763
782
|
examples: [
|
|
764
783
|
"curviate core search parameters --type LOCATION --keywords Berlin",
|
|
765
784
|
"curviate core search parameters --type COMPANY --keywords Acme"
|
|
@@ -796,6 +815,10 @@ var searchGroupsCommand = defineCommand({
|
|
|
796
815
|
meta: {
|
|
797
816
|
name: "groups",
|
|
798
817
|
description: "Keyword search for LinkedIn groups. A no-match search returns an empty list, not an error.",
|
|
818
|
+
risk: "read",
|
|
819
|
+
rules: {
|
|
820
|
+
budget_rows: ["search"]
|
|
821
|
+
},
|
|
799
822
|
examples: [
|
|
800
823
|
'curviate core search groups "gtm engineering"'
|
|
801
824
|
]
|
|
@@ -826,6 +849,10 @@ var searchServicesCommand = defineCommand({
|
|
|
826
849
|
meta: {
|
|
827
850
|
name: "services",
|
|
828
851
|
description: "Search Services Marketplace providers with structured filters. At least one of --keywords, --service-category, or --location is required. Resolve --service-category/--location values with `curviate core search service-parameters` first, both take opaque ids, not free text.",
|
|
852
|
+
risk: "read",
|
|
853
|
+
rules: {
|
|
854
|
+
budget_rows: ["search"]
|
|
855
|
+
},
|
|
829
856
|
examples: [
|
|
830
857
|
"curviate core search services --keywords marketing",
|
|
831
858
|
"curviate core search services --service-category 100 --location 106967730"
|
|
@@ -864,6 +891,7 @@ var searchServiceParametersCommand = defineCommand({
|
|
|
864
891
|
meta: {
|
|
865
892
|
name: "service-parameters",
|
|
866
893
|
description: "Resolve human-readable service-filter terms into the opaque ids `curviate core search services` accepts. Paginated: --cursor pages manually, --all streams every page as NDJSON.",
|
|
894
|
+
risk: "read",
|
|
867
895
|
examples: [
|
|
868
896
|
"curviate core search service-parameters --type service_category --keywords marketing"
|
|
869
897
|
]
|
|
@@ -898,6 +926,10 @@ var searchCommand = defineCommand({
|
|
|
898
926
|
meta: {
|
|
899
927
|
name: "search",
|
|
900
928
|
description: DESCRIPTIONS.search,
|
|
929
|
+
risk: "read",
|
|
930
|
+
rules: {
|
|
931
|
+
budget_rows: ["search"]
|
|
932
|
+
},
|
|
901
933
|
examples: [
|
|
902
934
|
'curviate core search "https://www.linkedin.com/search/results/people/?keywords=ai%20engineer"'
|
|
903
935
|
]
|
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
readablePage
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
getExitCode
|
|
8
|
-
} from "./chunk-76SWLAZ6.js";
|
|
3
|
+
readablePage
|
|
4
|
+
} from "./chunk-L4CIJT6F.js";
|
|
5
|
+
import "./chunk-QM57YDJE.js";
|
|
9
6
|
import {
|
|
10
7
|
readlineSync
|
|
11
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ENBIMEKS.js";
|
|
12
9
|
import {
|
|
13
10
|
createClient,
|
|
14
11
|
getConfigPath,
|
|
12
|
+
isPlainObject,
|
|
13
|
+
resolveEffectiveConfig,
|
|
15
14
|
writeProfile
|
|
16
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-YXVF5UST.js";
|
|
17
16
|
import {
|
|
18
|
-
GLOBAL_FLAGS
|
|
19
|
-
|
|
17
|
+
GLOBAL_FLAGS,
|
|
18
|
+
getTeamFlag
|
|
19
|
+
} from "./chunk-RYWWSZUH.js";
|
|
20
20
|
import {
|
|
21
21
|
DESCRIPTIONS
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-73DJ3KNE.js";
|
|
23
23
|
import {
|
|
24
24
|
defaultReadStdin,
|
|
25
25
|
isStdinToken,
|
|
26
26
|
resolveTextOrStdin
|
|
27
27
|
} from "./chunk-ZYURL5VK.js";
|
|
28
|
+
import {
|
|
29
|
+
getExitCode
|
|
30
|
+
} from "./chunk-2W4RN5ON.js";
|
|
28
31
|
|
|
29
32
|
// src/commands/setup.ts
|
|
30
33
|
import { defineCommand } from "citty";
|
|
@@ -88,10 +91,12 @@ function appRoot(baseUrl, override) {
|
|
|
88
91
|
}
|
|
89
92
|
return `${parsed.origin}${parsed.pathname.replace(/\/?api\/?$/, "").replace(/\/$/, "")}`;
|
|
90
93
|
}
|
|
91
|
-
function authorizeUrl(baseUrl, sessionId, publicKey, appUrlOverride) {
|
|
94
|
+
function authorizeUrl(baseUrl, sessionId, publicKey, appUrlOverride, team) {
|
|
92
95
|
const url = new URL(`${appRoot(baseUrl, appUrlOverride)}/cli`);
|
|
93
96
|
url.searchParams.set("sid", sessionId);
|
|
94
97
|
url.searchParams.set("pk", publicKey);
|
|
98
|
+
url.searchParams.set("picker", "1");
|
|
99
|
+
if (team) url.searchParams.set("team", team);
|
|
95
100
|
return url.toString();
|
|
96
101
|
}
|
|
97
102
|
function exchangeUrl(baseUrl) {
|
|
@@ -202,8 +207,11 @@ async function defaultOpen(url) {
|
|
|
202
207
|
const open = (await import("open")).default;
|
|
203
208
|
return open(url);
|
|
204
209
|
}
|
|
205
|
-
async function defaultVerify(apiKey, baseUrl) {
|
|
206
|
-
readablePage(await createClient({ apiKey, baseUrl }).accounts.list());
|
|
210
|
+
async function defaultVerify(apiKey, baseUrl, team) {
|
|
211
|
+
readablePage(await createClient({ apiKey, baseUrl, team: team ?? null }).accounts.list());
|
|
212
|
+
}
|
|
213
|
+
async function defaultListTeams(apiKey, baseUrl) {
|
|
214
|
+
return createClient({ apiKey, baseUrl, team: null }).teams.list({ limit: 100 });
|
|
207
215
|
}
|
|
208
216
|
function resolveSetupIO(io = {}) {
|
|
209
217
|
return {
|
|
@@ -221,6 +229,7 @@ function resolveSetupIO(io = {}) {
|
|
|
221
229
|
open: io.open ?? defaultOpen,
|
|
222
230
|
fetch: io.fetch ?? fetch,
|
|
223
231
|
verify: io.verify ?? defaultVerify,
|
|
232
|
+
listTeams: io.listTeams ?? defaultListTeams,
|
|
224
233
|
generate: io.generate ?? generateSessionMaterial
|
|
225
234
|
};
|
|
226
235
|
}
|
|
@@ -263,7 +272,8 @@ async function runSetup(args, io) {
|
|
|
263
272
|
baseUrl,
|
|
264
273
|
material.sessionId,
|
|
265
274
|
material.publicKey,
|
|
266
|
-
io.env[APP_URL_ENV]
|
|
275
|
+
io.env[APP_URL_ENV],
|
|
276
|
+
getTeamFlag()
|
|
267
277
|
);
|
|
268
278
|
if (json) {
|
|
269
279
|
await writeResumeState({
|
|
@@ -348,14 +358,17 @@ async function finishExchange(baseUrl, material, code, profileName, opts, io) {
|
|
|
348
358
|
);
|
|
349
359
|
return 1;
|
|
350
360
|
}
|
|
361
|
+
const team = result.body.team_id === void 0 ? void 0 : await confirmTeam(apiKey, baseUrl, result.body.team_id, opts, io);
|
|
351
362
|
await writeProfile(profileName, {
|
|
352
363
|
apiKey,
|
|
353
364
|
tenant: result.body.tenant_name,
|
|
365
|
+
// Always written: a Team key replacing an all-teams one must not keep its Team.
|
|
366
|
+
team,
|
|
354
367
|
...result.body.account_id !== void 0 ? { account: result.body.account_id } : {}
|
|
355
368
|
});
|
|
356
369
|
await clearResumeState();
|
|
357
370
|
try {
|
|
358
|
-
await io.verify(apiKey, baseUrl);
|
|
371
|
+
await io.verify(apiKey, baseUrl, team);
|
|
359
372
|
} catch (err) {
|
|
360
373
|
io.stderr.write(
|
|
361
374
|
"error: the credential was saved but a verifying call did not succeed. Run `curviate doctor` for detail.\n"
|
|
@@ -366,6 +379,7 @@ async function finishExchange(baseUrl, material, code, profileName, opts, io) {
|
|
|
366
379
|
ok: true,
|
|
367
380
|
tenant: result.body.tenant_name,
|
|
368
381
|
profile: profileName,
|
|
382
|
+
team: team ?? null,
|
|
369
383
|
...result.body.account_id !== void 0 ? { account_id: result.body.account_id } : {}
|
|
370
384
|
};
|
|
371
385
|
if (opts.json) {
|
|
@@ -379,23 +393,61 @@ async function finishExchange(baseUrl, material, code, profileName, opts, io) {
|
|
|
379
393
|
io.stderr.write(`Default account set to ${result.body.account_id}.
|
|
380
394
|
`);
|
|
381
395
|
}
|
|
396
|
+
if (team !== void 0) io.stderr.write(`This key works in all your Teams; calls act in ${team} (change it with \`curviate team switch <team_id>\` or --team).
|
|
397
|
+
`);
|
|
382
398
|
io.stderr.write("Run `curviate doctor` to confirm.\n");
|
|
383
399
|
}
|
|
384
400
|
return 0;
|
|
385
401
|
}
|
|
402
|
+
async function confirmTeam(apiKey, baseUrl, teamId, opts, io) {
|
|
403
|
+
let rows;
|
|
404
|
+
try {
|
|
405
|
+
const page = await io.listTeams(apiKey, baseUrl);
|
|
406
|
+
const items = isPlainObject(page) ? page["items"] : void 0;
|
|
407
|
+
if (!Array.isArray(items)) return teamId;
|
|
408
|
+
rows = items.filter((t) => isPlainObject(t) && typeof t["team_id"] === "string");
|
|
409
|
+
} catch {
|
|
410
|
+
return teamId;
|
|
411
|
+
}
|
|
412
|
+
const ids = rows.map((t) => t.team_id);
|
|
413
|
+
if (ids.includes(teamId)) return teamId;
|
|
414
|
+
io.stderr.write(`The Team you picked (${teamId}) is no longer one of yours.
|
|
415
|
+
`);
|
|
416
|
+
if (!opts.json && io.isTTY && ids.length > 0) {
|
|
417
|
+
for (const t of rows) io.stderr.write(` ${t.team_id} ${typeof t.name === "string" ? t.name : ""}
|
|
418
|
+
`);
|
|
419
|
+
const picked = (await io.prompt("Team to act in (team id, empty for none): ")).trim();
|
|
420
|
+
if (ids.includes(picked)) return picked;
|
|
421
|
+
}
|
|
422
|
+
io.stderr.write("No Team saved: pass --team, set CURVIATE_TEAM, or run `curviate team switch <team_id>` (`curviate team list` shows them).\n");
|
|
423
|
+
return void 0;
|
|
424
|
+
}
|
|
386
425
|
var setupCommand = defineCommand({
|
|
387
426
|
meta: {
|
|
388
427
|
name: "setup",
|
|
389
428
|
description: DESCRIPTIONS.setup,
|
|
429
|
+
risk: "write",
|
|
430
|
+
rules: {
|
|
431
|
+
changes: "Opens the dashboard, exchanges the code it shows for an API key and saves it as a local profile.",
|
|
432
|
+
visible_to: "Your workspace lists the new API key; nothing reaches LinkedIn.",
|
|
433
|
+
budget_rows: [],
|
|
434
|
+
retry: "Each run creates another API key; revoke the unused ones in the dashboard.",
|
|
435
|
+
undo: "Revoke the key in the dashboard and remove the profile with `curviate config reset --profile <name> --yes`."
|
|
436
|
+
},
|
|
437
|
+
errors: { INVALID_REQUEST: "the code was not accepted or has expired: run `curviate setup` again for a fresh one." },
|
|
390
438
|
examples: [
|
|
391
439
|
"curviate setup",
|
|
392
|
-
"curviate setup --json",
|
|
440
|
+
"curviate setup --json --team tnt_01HZY3K8Q2",
|
|
393
441
|
"curviate setup --code -"
|
|
394
442
|
]
|
|
395
443
|
},
|
|
396
444
|
args: {
|
|
397
445
|
profile: GLOBAL_FLAGS.profile,
|
|
398
446
|
"base-url": GLOBAL_FLAGS["base-url"],
|
|
447
|
+
team: {
|
|
448
|
+
type: "string",
|
|
449
|
+
description: "Preselect this Team (tnt_...) on the authorize page."
|
|
450
|
+
},
|
|
399
451
|
json: GLOBAL_FLAGS.json,
|
|
400
452
|
"no-browser": {
|
|
401
453
|
type: "boolean",
|