@curviate/cli 0.19.0 → 0.21.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 +133 -0
- package/dist/{account-EGJJNBXW.js → account-A3FOYUKC.js} +29 -29
- package/dist/{chunk-42VUUKQ3.js → chunk-56ORAZJO.js} +4 -1
- package/dist/{chunk-TMU3CSPR.js → chunk-CUTMZWL6.js} +5 -1
- package/dist/chunk-HOQ7EUHJ.js +50 -0
- package/dist/{chunk-M33MI53G.js → chunk-LMVDURUZ.js} +23 -1
- package/dist/{chunk-KVV6LZ7E.js → chunk-Q7XG2VIF.js} +60 -24
- package/dist/chunk-ZYURL5VK.js +83 -0
- package/dist/cli.js +51 -36
- package/dist/{comment-VT6PO4MN.js → comment-RPLZHFJQ.js} +9 -9
- package/dist/{company-XEEBBCRZ.js → company-DFJK2RHM.js} +23 -22
- package/dist/{config-P5CPF5WC.js → config-FPWWYG7G.js} +3 -2
- package/dist/{connect-6PU7QCOL.js → connect-ELSSMOIC.js} +37 -15
- package/dist/{feed-KAUDRE5K.js → feed-23Z7OQNL.js} +4 -3
- package/dist/{group-LPVVJ2JX.js → group-52MP24W3.js} +8 -7
- package/dist/{inbox-BXCWHGWP.js → inbox-G6KNWWLI.js} +10 -9
- package/dist/{inboxes-MTPWLP5F.js → inboxes-NTTYCQPM.js} +5 -4
- package/dist/{job-EIXBJXLW.js → job-WOPIAHOR.js} +8 -7
- package/dist/{login-GDLWR542.js → login-ZLDDIAFW.js} +14 -15
- package/dist/{message-UWMRE2SJ.js → message-KJXY5RCD.js} +7 -4
- package/dist/{notification-RYFDHM3G.js → notification-MNEABNVW.js} +6 -5
- package/dist/{post-HK6HHIKV.js → post-A7YZWBFG.js} +12 -12
- package/dist/{profile-PES67647.js → profile-XOMDIYSY.js} +14 -13
- package/dist/{recruiter-MVPSTH2V.js → recruiter-CCLG4PM4.js} +38 -35
- package/dist/{sales-nav-TMXWDKSE.js → sales-nav-5ZRE2UAQ.js} +20 -19
- package/dist/{search-O2LACGHE.js → search-NDESJC3Y.js} +16 -14
- package/dist/{webhook-QFSZN3P2.js → webhook-TNZF3FMN.js} +51 -19
- package/package.json +2 -2
- package/dist/chunk-U7Y4EXHT.js +0 -33
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
assembleFilters,
|
|
5
5
|
splitCsv,
|
|
6
6
|
splitCsvNumbers
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-56ORAZJO.js";
|
|
8
8
|
import {
|
|
9
9
|
AttachError,
|
|
10
10
|
readAttachment,
|
|
@@ -26,12 +26,13 @@ import {
|
|
|
26
26
|
renderSuccess,
|
|
27
27
|
renderUnexpectedError,
|
|
28
28
|
resolveEffectiveConfig
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-LMVDURUZ.js";
|
|
30
30
|
import {
|
|
31
31
|
GLOBAL_FLAGS,
|
|
32
32
|
READ_SINGLE_FLAGS,
|
|
33
33
|
WRITE_FLAGS
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-CUTMZWL6.js";
|
|
35
|
+
import "./chunk-ZYURL5VK.js";
|
|
35
36
|
|
|
36
37
|
// src/commands/sales-nav.ts
|
|
37
38
|
import { defineCommand } from "citty";
|
|
@@ -488,7 +489,7 @@ var salesNavMessageNewCommand = defineCommand({
|
|
|
488
489
|
...WRITE_FLAGS,
|
|
489
490
|
to: {
|
|
490
491
|
type: "string",
|
|
491
|
-
description: "Recipient's LinkedIn provider ID (ACw\u2026 format, e.g. from a Sales Navigator search result or profile). Not resolved from a URL/slug
|
|
492
|
+
description: "Recipient's LinkedIn provider ID (ACw\u2026 format, e.g. from a Sales Navigator search result or profile). Not resolved from a URL/slug. Pass the provider ID directly.",
|
|
492
493
|
required: true
|
|
493
494
|
},
|
|
494
495
|
subject: { type: "string", description: "Message subject line (required for Sales Navigator messaging).", required: true },
|
|
@@ -507,7 +508,7 @@ var salesNavMessageNewCommand = defineCommand({
|
|
|
507
508
|
profile: flags.profile
|
|
508
509
|
});
|
|
509
510
|
if (!cfg.apiKey) {
|
|
510
|
-
process.stderr.write("error: no API key
|
|
511
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
511
512
|
process.exit(3);
|
|
512
513
|
}
|
|
513
514
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -530,7 +531,7 @@ var salesNavSearchPeopleCommand = defineCommand({
|
|
|
530
531
|
args: {
|
|
531
532
|
...GLOBAL_FLAGS,
|
|
532
533
|
keywords: { type: "string", description: "Keyword search string." },
|
|
533
|
-
filters: { type: "string", description: "Filter body as a JSON object (escape hatch for the full filter surface); '-' reads JSON from stdin." },
|
|
534
|
+
filters: { type: "string", stdinArg: true, description: "Filter body as a JSON object (escape hatch for the full filter surface); '-' reads JSON from stdin." },
|
|
534
535
|
"filters-file": { type: "string", description: "Path to a JSON file with the filter body." },
|
|
535
536
|
"first-name": { type: "string", description: "First name to match." },
|
|
536
537
|
"last-name": { type: "string", description: "Last name to match." },
|
|
@@ -547,7 +548,7 @@ var salesNavSearchPeopleCommand = defineCommand({
|
|
|
547
548
|
profile: flags.profile
|
|
548
549
|
});
|
|
549
550
|
if (!cfg.apiKey) {
|
|
550
|
-
process.stderr.write("error: no API key
|
|
551
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
551
552
|
process.exit(3);
|
|
552
553
|
}
|
|
553
554
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -560,7 +561,7 @@ var salesNavSearchCompaniesCommand = defineCommand({
|
|
|
560
561
|
args: {
|
|
561
562
|
...GLOBAL_FLAGS,
|
|
562
563
|
keywords: { type: "string", description: "Keyword search string." },
|
|
563
|
-
filters: { type: "string", description: "Filter body as a JSON object (escape hatch for the full filter surface); '-' reads JSON from stdin." },
|
|
564
|
+
filters: { type: "string", stdinArg: true, description: "Filter body as a JSON object (escape hatch for the full filter surface); '-' reads JSON from stdin." },
|
|
564
565
|
"filters-file": { type: "string", description: "Path to a JSON file with the filter body." },
|
|
565
566
|
technologies: { type: "string", description: "Technology tags (comma-separated)." },
|
|
566
567
|
"recent-activities": { type: "string", description: "Recent activity ids (comma-separated)." },
|
|
@@ -576,7 +577,7 @@ var salesNavSearchCompaniesCommand = defineCommand({
|
|
|
576
577
|
profile: flags.profile
|
|
577
578
|
});
|
|
578
579
|
if (!cfg.apiKey) {
|
|
579
|
-
process.stderr.write("error: no API key
|
|
580
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
580
581
|
process.exit(3);
|
|
581
582
|
}
|
|
582
583
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -605,7 +606,7 @@ var salesNavSearchParametersCommand = defineCommand({
|
|
|
605
606
|
profile: flags.profile
|
|
606
607
|
});
|
|
607
608
|
if (!cfg.apiKey) {
|
|
608
|
-
process.stderr.write("error: no API key
|
|
609
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
609
610
|
process.exit(3);
|
|
610
611
|
}
|
|
611
612
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -644,7 +645,7 @@ var salesNavSearchCommand = defineCommand({
|
|
|
644
645
|
profile: flags.profile
|
|
645
646
|
});
|
|
646
647
|
if (!cfg.apiKey) {
|
|
647
|
-
process.stderr.write("error: no API key
|
|
648
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
648
649
|
process.exit(3);
|
|
649
650
|
}
|
|
650
651
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -669,7 +670,7 @@ var salesNavProfileCommand = defineCommand({
|
|
|
669
670
|
profile: flags.profile
|
|
670
671
|
});
|
|
671
672
|
if (!cfg.apiKey) {
|
|
672
|
-
process.stderr.write("error: no API key
|
|
673
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
673
674
|
process.exit(3);
|
|
674
675
|
}
|
|
675
676
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -683,7 +684,7 @@ var salesNavSaveLeadCommand = defineCommand({
|
|
|
683
684
|
// Write command: WRITE_FLAGS omits pagination/projection flags
|
|
684
685
|
...WRITE_FLAGS,
|
|
685
686
|
userId: { type: "positional", description: "Sales Navigator member ID (ACw\u2026 format)." },
|
|
686
|
-
list: { type: "string", description: "Lead list ID to save the member into (required
|
|
687
|
+
list: { type: "string", description: "Lead list ID to save the member into (required; the v2 save always targets a specific list).", required: true }
|
|
687
688
|
},
|
|
688
689
|
async run({ args }) {
|
|
689
690
|
const flags = args;
|
|
@@ -695,7 +696,7 @@ var salesNavSaveLeadCommand = defineCommand({
|
|
|
695
696
|
profile: flags.profile
|
|
696
697
|
});
|
|
697
698
|
if (!cfg.apiKey) {
|
|
698
|
-
process.stderr.write("error: no API key
|
|
699
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
699
700
|
process.exit(3);
|
|
700
701
|
}
|
|
701
702
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -716,7 +717,7 @@ var salesNavAccountListsCommand = defineCommand({
|
|
|
716
717
|
profile: flags.profile
|
|
717
718
|
});
|
|
718
719
|
if (!cfg.apiKey) {
|
|
719
|
-
process.stderr.write("error: no API key
|
|
720
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
720
721
|
process.exit(3);
|
|
721
722
|
}
|
|
722
723
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -737,7 +738,7 @@ var salesNavLeadListsCommand = defineCommand({
|
|
|
737
738
|
profile: flags.profile
|
|
738
739
|
});
|
|
739
740
|
if (!cfg.apiKey) {
|
|
740
|
-
process.stderr.write("error: no API key
|
|
741
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
741
742
|
process.exit(3);
|
|
742
743
|
}
|
|
743
744
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -764,7 +765,7 @@ var salesNavBrowseAccountListCommand = defineCommand({
|
|
|
764
765
|
profile: flags.profile
|
|
765
766
|
});
|
|
766
767
|
if (!cfg.apiKey) {
|
|
767
|
-
process.stderr.write("error: no API key
|
|
768
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
768
769
|
process.exit(3);
|
|
769
770
|
}
|
|
770
771
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -791,7 +792,7 @@ var salesNavBrowseLeadListCommand = defineCommand({
|
|
|
791
792
|
profile: flags.profile
|
|
792
793
|
});
|
|
793
794
|
if (!cfg.apiKey) {
|
|
794
|
-
process.stderr.write("error: no API key
|
|
795
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
795
796
|
process.exit(3);
|
|
796
797
|
}
|
|
797
798
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -817,7 +818,7 @@ var salesNavSaveAccountCommand = defineCommand({
|
|
|
817
818
|
profile: flags.profile
|
|
818
819
|
});
|
|
819
820
|
if (!cfg.apiKey) {
|
|
820
|
-
process.stderr.write("error: no API key
|
|
821
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
821
822
|
process.exit(3);
|
|
822
823
|
}
|
|
823
824
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
assembleFilters,
|
|
5
5
|
splitCsv,
|
|
6
6
|
splitCsvNumbers
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-56ORAZJO.js";
|
|
8
8
|
import {
|
|
9
9
|
slimSearchCompanies,
|
|
10
10
|
slimSearchCompaniesItem,
|
|
@@ -25,10 +25,11 @@ import {
|
|
|
25
25
|
renderSuccess,
|
|
26
26
|
renderUnexpectedError,
|
|
27
27
|
resolveEffectiveConfig
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-LMVDURUZ.js";
|
|
29
29
|
import {
|
|
30
30
|
GLOBAL_FLAGS
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-CUTMZWL6.js";
|
|
32
|
+
import "./chunk-ZYURL5VK.js";
|
|
32
33
|
|
|
33
34
|
// src/commands/search.ts
|
|
34
35
|
import { defineCommand } from "citty";
|
|
@@ -45,6 +46,7 @@ var PEOPLE_INVALID_FLAGS = ["seniority", "function", "employment-type", "sort-by
|
|
|
45
46
|
var FILTER_FLAGS = {
|
|
46
47
|
filters: {
|
|
47
48
|
type: "string",
|
|
49
|
+
stdinArg: true,
|
|
48
50
|
description: "Filter body as a JSON object (named flags win on conflict; server validates and strips unknown fields); '-' reads JSON from stdin."
|
|
49
51
|
},
|
|
50
52
|
"filters-file": {
|
|
@@ -558,7 +560,7 @@ var searchPeopleCommand = defineCommand({
|
|
|
558
560
|
profile: flags.profile
|
|
559
561
|
});
|
|
560
562
|
if (!cfg.apiKey) {
|
|
561
|
-
process.stderr.write("error: no API key
|
|
563
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
562
564
|
process.exit(3);
|
|
563
565
|
}
|
|
564
566
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -591,7 +593,7 @@ var searchCompaniesCommand = defineCommand({
|
|
|
591
593
|
profile: flags.profile
|
|
592
594
|
});
|
|
593
595
|
if (!cfg.apiKey) {
|
|
594
|
-
process.stderr.write("error: no API key
|
|
596
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
595
597
|
process.exit(3);
|
|
596
598
|
}
|
|
597
599
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -627,7 +629,7 @@ var searchPostsCommand = defineCommand({
|
|
|
627
629
|
profile: flags.profile
|
|
628
630
|
});
|
|
629
631
|
if (!cfg.apiKey) {
|
|
630
|
-
process.stderr.write("error: no API key
|
|
632
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
631
633
|
process.exit(3);
|
|
632
634
|
}
|
|
633
635
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -649,11 +651,11 @@ var searchJobsCommand = defineCommand({
|
|
|
649
651
|
"job-type": { type: "string", description: "job type, independent 7-value enum: full_time|part_time|contract|temporary|volunteer|internship|other (comma-separated)" },
|
|
650
652
|
company: { type: "string", description: "Company ids (comma-separated)." },
|
|
651
653
|
"sort-by": { type: "string", description: "Sort order (e.g. relevance, recent)." },
|
|
652
|
-
"date-posted": { type: "string", description: "maximum job age in days (a number
|
|
654
|
+
"date-posted": { type: "string", description: "maximum job age in days (a number, e.g. 7, 14, 30; not an enum string)" },
|
|
653
655
|
region: { type: "string", description: "alias for --location (same body field: region)" },
|
|
654
656
|
title: {
|
|
655
657
|
type: "string",
|
|
656
|
-
description: "job title id(s), comma-separated (resolve: search parameters --type JOB_TITLE); ID-based targeting
|
|
658
|
+
description: "job title id(s), comma-separated (resolve: search parameters --type JOB_TITLE); ID-based targeting, unlike search people --title, which is free-text"
|
|
657
659
|
},
|
|
658
660
|
presence: { type: "string", description: "work presence, comma-separated: on_site, hybrid, remote" },
|
|
659
661
|
benefits: { type: "string", description: "benefit ids, comma-separated" },
|
|
@@ -677,7 +679,7 @@ var searchJobsCommand = defineCommand({
|
|
|
677
679
|
profile: flags.profile
|
|
678
680
|
});
|
|
679
681
|
if (!cfg.apiKey) {
|
|
680
|
-
process.stderr.write("error: no API key
|
|
682
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
681
683
|
process.exit(3);
|
|
682
684
|
}
|
|
683
685
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -706,7 +708,7 @@ var searchParametersCommand = defineCommand({
|
|
|
706
708
|
profile: flags.profile
|
|
707
709
|
});
|
|
708
710
|
if (!cfg.apiKey) {
|
|
709
|
-
process.stderr.write("error: no API key
|
|
711
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
710
712
|
process.exit(3);
|
|
711
713
|
}
|
|
712
714
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -730,7 +732,7 @@ var searchGroupsCommand = defineCommand({
|
|
|
730
732
|
profile: flags.profile
|
|
731
733
|
});
|
|
732
734
|
if (!cfg.apiKey) {
|
|
733
|
-
process.stderr.write("error: no API key
|
|
735
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
734
736
|
process.exit(3);
|
|
735
737
|
}
|
|
736
738
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -761,7 +763,7 @@ var searchServicesCommand = defineCommand({
|
|
|
761
763
|
profile: flags.profile
|
|
762
764
|
});
|
|
763
765
|
if (!cfg.apiKey) {
|
|
764
|
-
process.stderr.write("error: no API key
|
|
766
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
765
767
|
process.exit(3);
|
|
766
768
|
}
|
|
767
769
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -792,7 +794,7 @@ var searchServiceParametersCommand = defineCommand({
|
|
|
792
794
|
profile: flags.profile
|
|
793
795
|
});
|
|
794
796
|
if (!cfg.apiKey) {
|
|
795
|
-
process.stderr.write("error: no API key
|
|
797
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
796
798
|
process.exit(3);
|
|
797
799
|
}
|
|
798
800
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -836,7 +838,7 @@ var searchCommand = defineCommand({
|
|
|
836
838
|
profile: flags.profile
|
|
837
839
|
});
|
|
838
840
|
if (!cfg.apiKey) {
|
|
839
|
-
process.stderr.write("error: no API key
|
|
841
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
840
842
|
process.exit(3);
|
|
841
843
|
}
|
|
842
844
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -12,10 +12,14 @@ import {
|
|
|
12
12
|
renderSuccess,
|
|
13
13
|
renderUnexpectedError,
|
|
14
14
|
resolveEffectiveConfig
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-LMVDURUZ.js";
|
|
16
16
|
import {
|
|
17
17
|
GLOBAL_FLAGS
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-CUTMZWL6.js";
|
|
19
|
+
import {
|
|
20
|
+
defaultReadStdin,
|
|
21
|
+
isStdinToken
|
|
22
|
+
} from "./chunk-ZYURL5VK.js";
|
|
19
23
|
|
|
20
24
|
// src/commands/webhook.ts
|
|
21
25
|
import { defineCommand } from "citty";
|
|
@@ -202,6 +206,37 @@ async function runWebhookDelete(client, flags, out) {
|
|
|
202
206
|
await handleError(err, outOpts, out);
|
|
203
207
|
}
|
|
204
208
|
}
|
|
209
|
+
function stripTrailingNewlines(s) {
|
|
210
|
+
return s.replace(/(?:\r?\n)+$/, "");
|
|
211
|
+
}
|
|
212
|
+
async function resolveWebhookBody(raw, out, readStdin = defaultReadStdin) {
|
|
213
|
+
if (raw === void 0 || raw === "") {
|
|
214
|
+
out.stderr.write(
|
|
215
|
+
"error: --body is required: pass the raw webhook body as inline JSON, as a path to a file containing it, or as - to read it from stdin.\n"
|
|
216
|
+
);
|
|
217
|
+
process.exit(2);
|
|
218
|
+
}
|
|
219
|
+
if (isStdinToken(raw)) {
|
|
220
|
+
const piped = stripTrailingNewlines(await readStdin());
|
|
221
|
+
if (!piped) {
|
|
222
|
+
out.stderr.write("error: --body -: stdin: empty input\n");
|
|
223
|
+
process.exit(2);
|
|
224
|
+
}
|
|
225
|
+
return piped;
|
|
226
|
+
}
|
|
227
|
+
if (raw.trimStart().startsWith("{")) return raw;
|
|
228
|
+
try {
|
|
229
|
+
return stripTrailingNewlines(readFileSync(raw, "utf8"));
|
|
230
|
+
} catch (err) {
|
|
231
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
232
|
+
out.stderr.write(
|
|
233
|
+
`error: --body: could not read ${raw}: ${reason}
|
|
234
|
+
--body accepts inline JSON, a path to a file containing the raw body, or - to read it from stdin.
|
|
235
|
+
`
|
|
236
|
+
);
|
|
237
|
+
process.exit(2);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
205
240
|
async function runWebhookVerify(input, out) {
|
|
206
241
|
const { constructEvent, WebhookSignatureError } = await import("@curviate/sdk");
|
|
207
242
|
try {
|
|
@@ -222,7 +257,7 @@ async function runWebhookVerify(input, out) {
|
|
|
222
257
|
}
|
|
223
258
|
};
|
|
224
259
|
out.stdout.write(JSON.stringify(envelope) + "\n");
|
|
225
|
-
out.stderr.write(`error: webhook verification failed
|
|
260
|
+
out.stderr.write(`error: webhook verification failed, ${err.reason}: ${err.message}
|
|
226
261
|
`);
|
|
227
262
|
process.exit(2);
|
|
228
263
|
}
|
|
@@ -253,7 +288,7 @@ var webhookCreateCommand = defineCommand({
|
|
|
253
288
|
profile: flags.profile
|
|
254
289
|
});
|
|
255
290
|
if (!cfg.apiKey) {
|
|
256
|
-
process.stderr.write("error: no API key
|
|
291
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
257
292
|
process.exit(3);
|
|
258
293
|
}
|
|
259
294
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -273,7 +308,7 @@ var webhookListCommand = defineCommand({
|
|
|
273
308
|
profile: flags.profile
|
|
274
309
|
});
|
|
275
310
|
if (!cfg.apiKey) {
|
|
276
|
-
process.stderr.write("error: no API key
|
|
311
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
277
312
|
process.exit(3);
|
|
278
313
|
}
|
|
279
314
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -293,7 +328,7 @@ var webhookEventsCommand = defineCommand({
|
|
|
293
328
|
profile: flags.profile
|
|
294
329
|
});
|
|
295
330
|
if (!cfg.apiKey) {
|
|
296
|
-
process.stderr.write("error: no API key
|
|
331
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
297
332
|
process.exit(3);
|
|
298
333
|
}
|
|
299
334
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -316,7 +351,7 @@ var webhookGetCommand = defineCommand({
|
|
|
316
351
|
profile: flags.profile
|
|
317
352
|
});
|
|
318
353
|
if (!cfg.apiKey) {
|
|
319
|
-
process.stderr.write("error: no API key
|
|
354
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
320
355
|
process.exit(3);
|
|
321
356
|
}
|
|
322
357
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -346,7 +381,7 @@ var webhookUpdateCommand = defineCommand({
|
|
|
346
381
|
profile: flags.profile
|
|
347
382
|
});
|
|
348
383
|
if (!cfg.apiKey) {
|
|
349
|
-
process.stderr.write("error: no API key
|
|
384
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
350
385
|
process.exit(3);
|
|
351
386
|
}
|
|
352
387
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -369,7 +404,7 @@ var webhookDeleteCommand = defineCommand({
|
|
|
369
404
|
profile: flags.profile
|
|
370
405
|
});
|
|
371
406
|
if (!cfg.apiKey) {
|
|
372
|
-
process.stderr.write("error: no API key
|
|
407
|
+
process.stderr.write("error: no API key, run `curviate login` or pass --api-key.\n");
|
|
373
408
|
process.exit(3);
|
|
374
409
|
}
|
|
375
410
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
@@ -388,11 +423,14 @@ var webhookVerifyCommand = defineCommand({
|
|
|
388
423
|
},
|
|
389
424
|
header: {
|
|
390
425
|
type: "string",
|
|
391
|
-
description: "The full
|
|
426
|
+
description: "The full Curviate-Signature header value from the delivery (t=\u2026,v1=\u2026).",
|
|
427
|
+
required: true
|
|
392
428
|
},
|
|
393
429
|
body: {
|
|
394
430
|
type: "string",
|
|
395
|
-
|
|
431
|
+
stdinArg: true,
|
|
432
|
+
description: "The raw webhook body: inline JSON, a path to a file containing it, or - to read it from stdin.",
|
|
433
|
+
required: true
|
|
396
434
|
},
|
|
397
435
|
"max-age-secs": {
|
|
398
436
|
type: "string",
|
|
@@ -402,14 +440,7 @@ var webhookVerifyCommand = defineCommand({
|
|
|
402
440
|
async run({ args }) {
|
|
403
441
|
const flags = args;
|
|
404
442
|
const out = buildOutputStreams();
|
|
405
|
-
|
|
406
|
-
if (flags.body) {
|
|
407
|
-
if (flags.body === "-") {
|
|
408
|
-
rawBody = readFileSync("/dev/stdin", "utf8");
|
|
409
|
-
} else {
|
|
410
|
-
rawBody = readFileSync(flags.body, "utf8");
|
|
411
|
-
}
|
|
412
|
-
}
|
|
443
|
+
const rawBody = await resolveWebhookBody(flags.body, out);
|
|
413
444
|
const signatureHeader = flags.header ?? "";
|
|
414
445
|
const secret = flags.secret ?? "";
|
|
415
446
|
const replayWindowSecs = flags["max-age-secs"] ? parseInt(flags["max-age-secs"], 10) : void 0;
|
|
@@ -434,6 +465,7 @@ var webhookCommand = defineCommand({
|
|
|
434
465
|
}
|
|
435
466
|
});
|
|
436
467
|
export {
|
|
468
|
+
resolveWebhookBody,
|
|
437
469
|
runWebhookCreate,
|
|
438
470
|
runWebhookDelete,
|
|
439
471
|
runWebhookEvents,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@curviate/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Official command-line interface for the Curviate API.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@curviate/sdk": "^0.
|
|
44
|
+
"@curviate/sdk": "^0.19.0",
|
|
45
45
|
"citty": "^0.1.6",
|
|
46
46
|
"open": "^10.1.0"
|
|
47
47
|
},
|
package/dist/chunk-U7Y4EXHT.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/lib/stdin.ts
|
|
4
|
-
var STDIN_SENTINEL = "__curviate_stdin__";
|
|
5
|
-
async function defaultReadStdin() {
|
|
6
|
-
return new Promise((resolve, reject) => {
|
|
7
|
-
const chunks = [];
|
|
8
|
-
process.stdin.on("data", (chunk) => {
|
|
9
|
-
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
10
|
-
});
|
|
11
|
-
process.stdin.on("end", () => {
|
|
12
|
-
const full = Buffer.concat(chunks).toString("utf8");
|
|
13
|
-
resolve(full.replace(/\n+$/, ""));
|
|
14
|
-
});
|
|
15
|
-
process.stdin.on("error", reject);
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
async function resolveTextOrStdin(rawText, out, readStdin) {
|
|
19
|
-
if (rawText !== "-" && rawText !== STDIN_SENTINEL) return rawText;
|
|
20
|
-
const reader = readStdin ?? defaultReadStdin;
|
|
21
|
-
const text = await reader();
|
|
22
|
-
if (!text) {
|
|
23
|
-
out.stderr.write("error: stdin: empty input\n");
|
|
24
|
-
process.exit(2);
|
|
25
|
-
}
|
|
26
|
-
return text;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export {
|
|
30
|
-
STDIN_SENTINEL,
|
|
31
|
-
defaultReadStdin,
|
|
32
|
-
resolveTextOrStdin
|
|
33
|
-
};
|