@curviate/cli 0.32.0 → 0.33.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 +215 -1
- package/README.md +2 -0
- package/dist/{account-JDSZC633.js → account-IPAW6YRD.js} +89 -46
- package/dist/{chunk-V3PB4HSF.js → chunk-27E2M2PS.js} +9 -6
- package/dist/chunk-4EH6EWFW.js +327 -0
- package/dist/{chunk-SKJNLN37.js → chunk-4GXO42ZH.js} +85 -1
- package/dist/{chunk-KQXYEQAD.js → chunk-4IPHFPLO.js} +172 -8
- package/dist/{chunk-5EJDQ47B.js → chunk-5SHLELR7.js} +16 -16
- package/dist/{chunk-JRKM4OV2.js → chunk-REO2BCEX.js} +1 -1
- package/dist/{chunk-6P52Q2GK.js → chunk-REVD4GXL.js} +5 -4
- package/dist/chunk-TCUYH5GO.js +34 -0
- package/dist/{chunk-EIEF2KFH.js → chunk-YCLU5VSN.js} +4 -2
- package/dist/cli.js +104 -37
- package/dist/{comment-YOFNFQUE.js → comment-F2O4UOSD.js} +32 -26
- package/dist/{company-6PKHDK6L.js → company-ANZGO2HT.js} +52 -34
- package/dist/{config-FUHT23SX.js → config-ZD3Y5MWP.js} +74 -29
- package/dist/{connect-DG2AVGVL.js → connect-HYJCGYFO.js} +34 -31
- package/dist/{doctor-FK7B6754.js → doctor-VPGGB5CW.js} +22 -16
- package/dist/{exit-codes-AAFTOAXF.js → exit-codes-ZFWQJYOY.js} +1 -1
- package/dist/{feed-HXBKXKAQ.js → feed-IZZYSYYI.js} +18 -17
- package/dist/{group-UYX3KTX3.js → group-ETDDF2PJ.js} +21 -18
- package/dist/{inbox-EVE2ZTHC.js → inbox-XQQ4YRRO.js} +27 -22
- package/dist/{inboxes-JBB34WMQ.js → inboxes-6KHXXEBC.js} +18 -17
- package/dist/{job-GXUZANYN.js → job-PBTJ5DWL.js} +43 -29
- package/dist/{login-3OAUY7TG.js → login-HP5URYD6.js} +15 -3
- package/dist/{message-34AGROW2.js → message-DQQPMRFU.js} +7 -9
- package/dist/{notification-SKKZS2C5.js → notification-CXIRJB57.js} +20 -19
- package/dist/{post-FIW522Q6.js → post-2S7FYMZO.js} +33 -25
- package/dist/{profile-SX6JOYMD.js → profile-UCERD6RR.js} +61 -43
- package/dist/{recruiter-H7ROBEVC.js → recruiter-PJFUM2ZZ.js} +41 -28
- package/dist/{sales-nav-7KCK562X.js → sales-nav-7XNJGVIX.js} +43 -29
- package/dist/{search-PASMDQEH.js → search-DYGIIODT.js} +57 -43
- package/dist/{setup-YV5PVIU5.js → setup-BRULZH53.js} +12 -8
- package/dist/{webhook-GPLFPC6N.js → webhook-2TKWOXYK.js} +25 -22
- package/package.json +2 -2
- package/dist/chunk-LKF5MZIP.js +0 -90
- package/dist/chunk-PKSKQ3LN.js +0 -68
- package/dist/chunk-R3VLWLVV.js +0 -23
- package/dist/chunk-TD2ZIXFR.js +0 -67
- package/dist/chunk-TQJ77SL4.js +0 -147
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
readablePage,
|
|
4
4
|
resolveEffectiveConfig
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-PKSKQ3LN.js";
|
|
5
|
+
} from "./chunk-4IPHFPLO.js";
|
|
7
6
|
import {
|
|
8
7
|
getExitCode
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YCLU5VSN.js";
|
|
10
9
|
import {
|
|
10
|
+
createClient,
|
|
11
11
|
getConfigPath,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
isPlainObject,
|
|
13
|
+
readConfigFile,
|
|
14
|
+
withoutUserinfo
|
|
15
|
+
} from "./chunk-4EH6EWFW.js";
|
|
14
16
|
import {
|
|
15
17
|
GLOBAL_FLAGS
|
|
16
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-4GXO42ZH.js";
|
|
17
19
|
|
|
18
20
|
// src/commands/doctor.ts
|
|
19
21
|
import { defineCommand } from "citty";
|
|
@@ -57,15 +59,18 @@ function accountLines(payload) {
|
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
61
|
async function runDoctor(args, io) {
|
|
60
|
-
const
|
|
62
|
+
const file = await readConfigFile();
|
|
61
63
|
const effective = await resolveEffectiveConfig({
|
|
62
64
|
apiKey: args["api-key"],
|
|
63
65
|
baseUrl: args["base-url"],
|
|
64
66
|
timeout: args.timeout,
|
|
65
67
|
profile: args.profile
|
|
66
68
|
});
|
|
67
|
-
const
|
|
69
|
+
const root = file?.root;
|
|
70
|
+
const active = isPlainObject(root) && typeof root["active"] === "string" ? root["active"] : void 0;
|
|
71
|
+
const profileName = args.profile ?? active ?? "default";
|
|
68
72
|
const checks = [];
|
|
73
|
+
const shownBaseUrl = withoutUserinfo(effective.baseUrl);
|
|
69
74
|
const credentialResolved = effective.apiKey !== void 0;
|
|
70
75
|
checks.push({
|
|
71
76
|
name: "credential",
|
|
@@ -85,14 +90,15 @@ async function runDoctor(args, io) {
|
|
|
85
90
|
effective.baseUrl,
|
|
86
91
|
effective.timeout
|
|
87
92
|
);
|
|
93
|
+
readablePage(payload);
|
|
88
94
|
reachable = true;
|
|
89
95
|
valid = true;
|
|
90
96
|
accounts = accountLines(payload);
|
|
91
|
-
checks.push({ name: "api reachable", ok: true, detail:
|
|
97
|
+
checks.push({ name: "api reachable", ok: true, detail: shownBaseUrl, exit: 7 });
|
|
92
98
|
checks.push({
|
|
93
99
|
name: "credential valid",
|
|
94
100
|
ok: true,
|
|
95
|
-
detail: `accepted by ${
|
|
101
|
+
detail: `accepted by ${shownBaseUrl}`,
|
|
96
102
|
exit: 3
|
|
97
103
|
});
|
|
98
104
|
checks.push({
|
|
@@ -106,12 +112,12 @@ async function runDoctor(args, io) {
|
|
|
106
112
|
const code = typeof error.code === "string" ? error.code : void 0;
|
|
107
113
|
const responded = typeof error.httpStatus === "number";
|
|
108
114
|
const transportFault = !responded && error.retryLikelyToSucceed === true;
|
|
109
|
-
const codeExit = code ? getExitCode(
|
|
115
|
+
const codeExit = code ? getExitCode(error) : 3;
|
|
110
116
|
reachable = responded;
|
|
111
117
|
checks.push({
|
|
112
118
|
name: "api reachable",
|
|
113
119
|
ok: reachable,
|
|
114
|
-
detail: reachable ?
|
|
120
|
+
detail: reachable ? shownBaseUrl : transportFault ? `could not reach ${shownBaseUrl}: ${error.message ?? "network error"}` : "not checked: the request was refused before it was sent",
|
|
115
121
|
exit: transportFault ? 7 : codeExit
|
|
116
122
|
});
|
|
117
123
|
checks.push({
|
|
@@ -120,18 +126,18 @@ async function runDoctor(args, io) {
|
|
|
120
126
|
// Nothing asked the credential anything unless a response came back,
|
|
121
127
|
// so it was not "rejected". Saying it was is the half of this defect
|
|
122
128
|
// that actually misdirects: it names the one subsystem that is fine.
|
|
123
|
-
detail: responded ? code ? `rejected: ${code}` : error.message ?? "the call did not succeed" : transportFault ? `not checked: ${
|
|
129
|
+
detail: responded ? code === "PLATFORM_ERROR" ? `not verified: ${error.message ?? code}` : code ? `rejected: ${code}` : error.message ?? "the call did not succeed" : transportFault ? `not checked: ${shownBaseUrl} could not be reached` : error.message ?? "the request was refused before it was sent",
|
|
124
130
|
exit: responded ? codeExit : transportFault ? 3 : codeExit
|
|
125
131
|
});
|
|
126
132
|
}
|
|
127
133
|
}
|
|
128
|
-
const tenant = effective.
|
|
134
|
+
const tenant = effective.tenant ?? null;
|
|
129
135
|
const firstFailure = checks.find((c) => !c.ok);
|
|
130
136
|
const report = {
|
|
131
137
|
version: io.version(),
|
|
132
138
|
config_path: getConfigPath(),
|
|
133
139
|
profile: profileName,
|
|
134
|
-
base_url:
|
|
140
|
+
base_url: shownBaseUrl,
|
|
135
141
|
credential_source: effective.apiKeySource,
|
|
136
142
|
credential_resolved: credentialResolved,
|
|
137
143
|
tenant,
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
pageDelayFromFlags,
|
|
4
|
-
streamAll
|
|
5
|
-
} from "./chunk-LKF5MZIP.js";
|
|
6
2
|
import {
|
|
7
3
|
requireAccount
|
|
8
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-27E2M2PS.js";
|
|
9
5
|
import {
|
|
6
|
+
pageDelayFromFlags,
|
|
7
|
+
readablePage,
|
|
8
|
+
rejectPaginationModifiersWithoutAll,
|
|
10
9
|
renderError,
|
|
11
10
|
renderSuccess,
|
|
12
|
-
renderUnexpectedError
|
|
13
|
-
|
|
11
|
+
renderUnexpectedError,
|
|
12
|
+
resolveEffectiveConfig,
|
|
13
|
+
streamAll,
|
|
14
|
+
writeNdjsonItem
|
|
15
|
+
} from "./chunk-4IPHFPLO.js";
|
|
16
|
+
import "./chunk-YCLU5VSN.js";
|
|
14
17
|
import {
|
|
15
|
-
createClient
|
|
16
|
-
|
|
17
|
-
} from "./chunk-TD2ZIXFR.js";
|
|
18
|
-
import "./chunk-PKSKQ3LN.js";
|
|
19
|
-
import "./chunk-EIEF2KFH.js";
|
|
20
|
-
import "./chunk-TQJ77SL4.js";
|
|
18
|
+
createClient
|
|
19
|
+
} from "./chunk-4EH6EWFW.js";
|
|
21
20
|
import {
|
|
22
21
|
GLOBAL_FLAGS
|
|
23
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-4GXO42ZH.js";
|
|
24
23
|
|
|
25
24
|
// src/commands/feed.ts
|
|
26
25
|
import { defineCommand } from "citty";
|
|
@@ -47,15 +46,16 @@ function resolveOutputOpts(flags) {
|
|
|
47
46
|
async function handleSdkError(err, outOpts, out) {
|
|
48
47
|
const { CurviateError } = await import("@curviate/sdk");
|
|
49
48
|
if (err instanceof CurviateError) {
|
|
50
|
-
const { getExitCode } = await import("./exit-codes-
|
|
49
|
+
const { getExitCode } = await import("./exit-codes-ZFWQJYOY.js");
|
|
51
50
|
renderError(err, outOpts, out);
|
|
52
|
-
process.exit(getExitCode(err
|
|
51
|
+
process.exit(getExitCode(err));
|
|
53
52
|
}
|
|
54
53
|
renderUnexpectedError(err, out);
|
|
55
54
|
process.exit(1);
|
|
56
55
|
}
|
|
57
56
|
async function runFeedHome(client, flags, out) {
|
|
58
57
|
rejectPreviewOnRead(flags.preview, out);
|
|
58
|
+
rejectPaginationModifiersWithoutAll(flags, out);
|
|
59
59
|
const accountId = await requireAccount(client, flags, out);
|
|
60
60
|
const ns = client.account(accountId);
|
|
61
61
|
const outOpts = resolveOutputOpts(flags);
|
|
@@ -73,10 +73,11 @@ async function runFeedHome(client, flags, out) {
|
|
|
73
73
|
out,
|
|
74
74
|
pageDelayMs: pageDelayFromFlags(flags)
|
|
75
75
|
})) {
|
|
76
|
-
out
|
|
76
|
+
writeNdjsonItem(out, item, outOpts.fields);
|
|
77
77
|
}
|
|
78
78
|
} else {
|
|
79
79
|
const result = await ns.feed.home(params);
|
|
80
|
+
readablePage(result);
|
|
80
81
|
renderSuccess(result, outOpts, out);
|
|
81
82
|
}
|
|
82
83
|
} catch (err) {
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
pageDelayFromFlags,
|
|
4
|
-
streamAll
|
|
5
|
-
} from "./chunk-LKF5MZIP.js";
|
|
6
2
|
import {
|
|
7
3
|
normalizeGroupId
|
|
8
4
|
} from "./chunk-UEAX6KUB.js";
|
|
9
5
|
import {
|
|
10
6
|
requireAccount
|
|
11
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-27E2M2PS.js";
|
|
12
8
|
import {
|
|
9
|
+
pageDelayFromFlags,
|
|
10
|
+
readablePage,
|
|
11
|
+
rejectPaginationModifiersWithoutAll,
|
|
13
12
|
renderError,
|
|
14
13
|
renderSuccess,
|
|
15
|
-
renderUnexpectedError
|
|
16
|
-
|
|
14
|
+
renderUnexpectedError,
|
|
15
|
+
resolveEffectiveConfig,
|
|
16
|
+
streamAll,
|
|
17
|
+
writeNdjsonItem
|
|
18
|
+
} from "./chunk-4IPHFPLO.js";
|
|
19
|
+
import "./chunk-YCLU5VSN.js";
|
|
17
20
|
import {
|
|
18
|
-
createClient
|
|
19
|
-
|
|
20
|
-
} from "./chunk-TD2ZIXFR.js";
|
|
21
|
-
import "./chunk-PKSKQ3LN.js";
|
|
22
|
-
import "./chunk-EIEF2KFH.js";
|
|
23
|
-
import "./chunk-TQJ77SL4.js";
|
|
21
|
+
createClient
|
|
22
|
+
} from "./chunk-4EH6EWFW.js";
|
|
24
23
|
import {
|
|
25
24
|
GLOBAL_FLAGS,
|
|
26
25
|
READ_SINGLE_FLAGS
|
|
27
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-4GXO42ZH.js";
|
|
28
27
|
|
|
29
28
|
// src/commands/group.ts
|
|
30
29
|
import { defineCommand } from "citty";
|
|
@@ -57,15 +56,16 @@ function resolveOutputOpts(flags) {
|
|
|
57
56
|
async function handleSdkError(err, outOpts, out) {
|
|
58
57
|
const { CurviateError } = await import("@curviate/sdk");
|
|
59
58
|
if (err instanceof CurviateError) {
|
|
60
|
-
const { getExitCode } = await import("./exit-codes-
|
|
59
|
+
const { getExitCode } = await import("./exit-codes-ZFWQJYOY.js");
|
|
61
60
|
renderError(err, outOpts, out);
|
|
62
|
-
process.exit(getExitCode(err
|
|
61
|
+
process.exit(getExitCode(err));
|
|
63
62
|
}
|
|
64
63
|
renderUnexpectedError(err, out);
|
|
65
64
|
process.exit(1);
|
|
66
65
|
}
|
|
67
66
|
async function runGroupList(client, flags, out) {
|
|
68
67
|
rejectPreviewOnRead(flags.preview, out);
|
|
68
|
+
rejectPaginationModifiersWithoutAll(flags, out);
|
|
69
69
|
const accountId = await requireAccount(client, flags, out);
|
|
70
70
|
const ns = client.account(accountId);
|
|
71
71
|
const outOpts = resolveOutputOpts(flags);
|
|
@@ -83,10 +83,11 @@ async function runGroupList(client, flags, out) {
|
|
|
83
83
|
out,
|
|
84
84
|
pageDelayMs: pageDelayFromFlags(flags)
|
|
85
85
|
})) {
|
|
86
|
-
out
|
|
86
|
+
writeNdjsonItem(out, item, outOpts.fields);
|
|
87
87
|
}
|
|
88
88
|
} else {
|
|
89
89
|
const result = await ns.groups.list(params);
|
|
90
|
+
readablePage(result);
|
|
90
91
|
renderSuccess(result, outOpts, out);
|
|
91
92
|
}
|
|
92
93
|
} catch (err) {
|
|
@@ -109,6 +110,7 @@ async function runGroupGet(client, flags, out) {
|
|
|
109
110
|
}
|
|
110
111
|
async function runGroupMembers(client, flags, out) {
|
|
111
112
|
rejectPreviewOnRead(flags.preview, out);
|
|
113
|
+
rejectPaginationModifiersWithoutAll(flags, out);
|
|
112
114
|
const accountId = await requireAccount(client, flags, out);
|
|
113
115
|
const groupId = normalizeGroupId(flags.groupId ?? "");
|
|
114
116
|
const ns = client.account(accountId);
|
|
@@ -127,10 +129,11 @@ async function runGroupMembers(client, flags, out) {
|
|
|
127
129
|
out,
|
|
128
130
|
pageDelayMs: pageDelayFromFlags(flags)
|
|
129
131
|
})) {
|
|
130
|
-
out
|
|
132
|
+
writeNdjsonItem(out, item, outOpts.fields);
|
|
131
133
|
}
|
|
132
134
|
} else {
|
|
133
135
|
const result = await ns.groups.members(groupId, params);
|
|
136
|
+
readablePage(result);
|
|
134
137
|
renderSuccess(result, outOpts, out);
|
|
135
138
|
}
|
|
136
139
|
} catch (err) {
|
|
@@ -3,36 +3,35 @@ import {
|
|
|
3
3
|
RETRIEVAL_FLAGS,
|
|
4
4
|
parseRetrievalFlags
|
|
5
5
|
} from "./chunk-PQWDDSV7.js";
|
|
6
|
-
import {
|
|
7
|
-
pageDelayFromFlags,
|
|
8
|
-
streamAll
|
|
9
|
-
} from "./chunk-LKF5MZIP.js";
|
|
10
6
|
import {
|
|
11
7
|
normalizeChatId
|
|
12
8
|
} from "./chunk-UEAX6KUB.js";
|
|
13
|
-
import {
|
|
14
|
-
buildPreviewOutput
|
|
15
|
-
} from "./chunk-R3VLWLVV.js";
|
|
16
9
|
import {
|
|
17
10
|
requireAccount
|
|
18
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-27E2M2PS.js";
|
|
19
12
|
import {
|
|
13
|
+
buildPreviewOutput
|
|
14
|
+
} from "./chunk-TCUYH5GO.js";
|
|
15
|
+
import {
|
|
16
|
+
pageDelayFromFlags,
|
|
17
|
+
readablePage,
|
|
18
|
+
rejectPaginationModifiersWithoutAll,
|
|
20
19
|
renderError,
|
|
21
20
|
renderSuccess,
|
|
22
|
-
renderUnexpectedError
|
|
23
|
-
|
|
21
|
+
renderUnexpectedError,
|
|
22
|
+
resolveEffectiveConfig,
|
|
23
|
+
streamAll,
|
|
24
|
+
writeNdjsonItem
|
|
25
|
+
} from "./chunk-4IPHFPLO.js";
|
|
26
|
+
import "./chunk-YCLU5VSN.js";
|
|
24
27
|
import {
|
|
25
|
-
createClient
|
|
26
|
-
|
|
27
|
-
} from "./chunk-TD2ZIXFR.js";
|
|
28
|
-
import "./chunk-PKSKQ3LN.js";
|
|
29
|
-
import "./chunk-EIEF2KFH.js";
|
|
30
|
-
import "./chunk-TQJ77SL4.js";
|
|
28
|
+
createClient
|
|
29
|
+
} from "./chunk-4EH6EWFW.js";
|
|
31
30
|
import {
|
|
32
31
|
GLOBAL_FLAGS,
|
|
33
32
|
READ_SINGLE_FLAGS,
|
|
34
33
|
WRITE_SINGLE_FLAGS
|
|
35
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-4GXO42ZH.js";
|
|
36
35
|
|
|
37
36
|
// src/commands/inbox.ts
|
|
38
37
|
import { defineCommand } from "citty";
|
|
@@ -99,15 +98,16 @@ function validateInboxFolder(raw, out) {
|
|
|
99
98
|
async function handleSdkError(err, outOpts, out) {
|
|
100
99
|
const { CurviateError } = await import("@curviate/sdk");
|
|
101
100
|
if (err instanceof CurviateError) {
|
|
102
|
-
const { getExitCode } = await import("./exit-codes-
|
|
101
|
+
const { getExitCode } = await import("./exit-codes-ZFWQJYOY.js");
|
|
103
102
|
renderError(err, outOpts, out);
|
|
104
|
-
process.exit(getExitCode(err
|
|
103
|
+
process.exit(getExitCode(err));
|
|
105
104
|
}
|
|
106
105
|
renderUnexpectedError(err, out);
|
|
107
106
|
process.exit(1);
|
|
108
107
|
}
|
|
109
108
|
async function runInboxList(client, flags, out) {
|
|
110
109
|
rejectPreviewOnRead(flags.preview, out);
|
|
110
|
+
rejectPaginationModifiersWithoutAll(flags, out);
|
|
111
111
|
const accountId = await requireAccount(client, flags, out);
|
|
112
112
|
const ns = client.account(accountId);
|
|
113
113
|
const outOpts = resolveOutputOpts(flags);
|
|
@@ -130,10 +130,11 @@ async function runInboxList(client, flags, out) {
|
|
|
130
130
|
out,
|
|
131
131
|
pageDelayMs: pageDelayFromFlags(flags)
|
|
132
132
|
})) {
|
|
133
|
-
out
|
|
133
|
+
writeNdjsonItem(out, item, outOpts.fields);
|
|
134
134
|
}
|
|
135
135
|
} else {
|
|
136
136
|
const result = await ns.messaging.listChats(params);
|
|
137
|
+
readablePage(result);
|
|
137
138
|
renderSuccess(result, outOpts, out);
|
|
138
139
|
}
|
|
139
140
|
} catch (err) {
|
|
@@ -180,6 +181,7 @@ async function runInboxMarkRead(client, flags, out) {
|
|
|
180
181
|
}
|
|
181
182
|
async function runInboxMessages(client, flags, out) {
|
|
182
183
|
rejectPreviewOnRead(flags.preview, out);
|
|
184
|
+
rejectPaginationModifiersWithoutAll(flags, out);
|
|
183
185
|
const retrieval = parseRetrievalFlags(flags);
|
|
184
186
|
if (!retrieval.ok) {
|
|
185
187
|
out.stderr.write(retrieval.error);
|
|
@@ -210,10 +212,11 @@ async function runInboxMessages(client, flags, out) {
|
|
|
210
212
|
out,
|
|
211
213
|
pageDelayMs: pageDelayFromFlags(flags)
|
|
212
214
|
})) {
|
|
213
|
-
out
|
|
215
|
+
writeNdjsonItem(out, item, outOpts.fields);
|
|
214
216
|
}
|
|
215
217
|
} else {
|
|
216
218
|
const result = await ns.messaging.listMessages(chatId, params);
|
|
219
|
+
readablePage(result);
|
|
217
220
|
renderSuccess(result, outOpts, out);
|
|
218
221
|
}
|
|
219
222
|
} catch (err) {
|
|
@@ -222,6 +225,7 @@ async function runInboxMessages(client, flags, out) {
|
|
|
222
225
|
}
|
|
223
226
|
async function runInboxSearch(client, flags, out) {
|
|
224
227
|
rejectPreviewOnRead(flags.preview, out);
|
|
228
|
+
rejectPaginationModifiersWithoutAll(flags, out);
|
|
225
229
|
const accountId = await requireAccount(client, flags, out);
|
|
226
230
|
const query = flags.query ?? "";
|
|
227
231
|
if (!query) {
|
|
@@ -248,10 +252,11 @@ async function runInboxSearch(client, flags, out) {
|
|
|
248
252
|
out,
|
|
249
253
|
pageDelayMs: pageDelayFromFlags(flags)
|
|
250
254
|
})) {
|
|
251
|
-
out
|
|
255
|
+
writeNdjsonItem(out, item, outOpts.fields);
|
|
252
256
|
}
|
|
253
257
|
} else {
|
|
254
258
|
const result = await ns.messaging.searchChats(params);
|
|
259
|
+
readablePage(result);
|
|
255
260
|
renderSuccess(result, outOpts, out);
|
|
256
261
|
}
|
|
257
262
|
} catch (err) {
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
pageDelayFromFlags,
|
|
4
|
-
streamAll
|
|
5
|
-
} from "./chunk-LKF5MZIP.js";
|
|
6
2
|
import {
|
|
7
3
|
requireAccount
|
|
8
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-27E2M2PS.js";
|
|
9
5
|
import {
|
|
6
|
+
pageDelayFromFlags,
|
|
7
|
+
readablePage,
|
|
8
|
+
rejectPaginationModifiersWithoutAll,
|
|
10
9
|
renderError,
|
|
11
10
|
renderSuccess,
|
|
12
|
-
renderUnexpectedError
|
|
13
|
-
|
|
11
|
+
renderUnexpectedError,
|
|
12
|
+
resolveEffectiveConfig,
|
|
13
|
+
streamAll,
|
|
14
|
+
writeNdjsonItem
|
|
15
|
+
} from "./chunk-4IPHFPLO.js";
|
|
16
|
+
import "./chunk-YCLU5VSN.js";
|
|
14
17
|
import {
|
|
15
|
-
createClient
|
|
16
|
-
|
|
17
|
-
} from "./chunk-TD2ZIXFR.js";
|
|
18
|
-
import "./chunk-PKSKQ3LN.js";
|
|
19
|
-
import "./chunk-EIEF2KFH.js";
|
|
20
|
-
import "./chunk-TQJ77SL4.js";
|
|
18
|
+
createClient
|
|
19
|
+
} from "./chunk-4EH6EWFW.js";
|
|
21
20
|
import {
|
|
22
21
|
GLOBAL_FLAGS,
|
|
23
22
|
READ_SINGLE_FLAGS
|
|
24
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-4GXO42ZH.js";
|
|
25
24
|
|
|
26
25
|
// src/commands/inboxes.ts
|
|
27
26
|
import { defineCommand } from "citty";
|
|
@@ -54,9 +53,9 @@ function resolveOutputOpts(flags) {
|
|
|
54
53
|
async function handleSdkError(err, outOpts, out) {
|
|
55
54
|
const { CurviateError } = await import("@curviate/sdk");
|
|
56
55
|
if (err instanceof CurviateError) {
|
|
57
|
-
const { getExitCode } = await import("./exit-codes-
|
|
56
|
+
const { getExitCode } = await import("./exit-codes-ZFWQJYOY.js");
|
|
58
57
|
renderError(err, outOpts, out);
|
|
59
|
-
process.exit(getExitCode(err
|
|
58
|
+
process.exit(getExitCode(err));
|
|
60
59
|
}
|
|
61
60
|
renderUnexpectedError(err, out);
|
|
62
61
|
process.exit(1);
|
|
@@ -89,6 +88,7 @@ async function runInboxesList(client, flags, out) {
|
|
|
89
88
|
}
|
|
90
89
|
async function runInboxesChats(client, flags, out) {
|
|
91
90
|
rejectPreviewOnRead(flags.preview, out);
|
|
91
|
+
rejectPaginationModifiersWithoutAll(flags, out);
|
|
92
92
|
const accountId = await requireAccount(client, flags, out);
|
|
93
93
|
const inboxId = flags.inboxId ?? "";
|
|
94
94
|
const ns = client.account(accountId);
|
|
@@ -107,10 +107,11 @@ async function runInboxesChats(client, flags, out) {
|
|
|
107
107
|
out,
|
|
108
108
|
pageDelayMs: pageDelayFromFlags(flags)
|
|
109
109
|
})) {
|
|
110
|
-
out
|
|
110
|
+
writeNdjsonItem(out, item, outOpts.fields);
|
|
111
111
|
}
|
|
112
112
|
} else {
|
|
113
113
|
const result = await ns.inboxes.listChats(inboxId, params);
|
|
114
|
+
readablePage(result);
|
|
114
115
|
renderSuccess(result, outOpts, out);
|
|
115
116
|
}
|
|
116
117
|
} catch (err) {
|
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
import {
|
|
3
3
|
slimJob
|
|
4
4
|
} from "./chunk-LJR4LJG6.js";
|
|
5
|
-
import {
|
|
6
|
-
DEFAULT_PAGE_DELAY_MS,
|
|
7
|
-
ndjsonModeNotice,
|
|
8
|
-
pageDelayFromFlags,
|
|
9
|
-
streamAll
|
|
10
|
-
} from "./chunk-LKF5MZIP.js";
|
|
11
5
|
import {
|
|
12
6
|
BinaryOutputError,
|
|
13
7
|
writeBinaryOutput
|
|
@@ -15,29 +9,35 @@ import {
|
|
|
15
9
|
import {
|
|
16
10
|
resolveJobIdentifier
|
|
17
11
|
} from "./chunk-UEAX6KUB.js";
|
|
18
|
-
import {
|
|
19
|
-
buildPreviewOutput
|
|
20
|
-
} from "./chunk-R3VLWLVV.js";
|
|
21
12
|
import {
|
|
22
13
|
requireAccount
|
|
23
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-27E2M2PS.js";
|
|
15
|
+
import {
|
|
16
|
+
buildPreviewOutput
|
|
17
|
+
} from "./chunk-TCUYH5GO.js";
|
|
24
18
|
import {
|
|
19
|
+
DEFAULT_PAGE_DELAY_MS,
|
|
20
|
+
ndjsonModeNotice,
|
|
21
|
+
pageDelayFromFlags,
|
|
22
|
+
readablePage,
|
|
23
|
+
rejectPaginationModifiersWithoutAll,
|
|
25
24
|
renderError,
|
|
26
25
|
renderSuccess,
|
|
27
|
-
renderUnexpectedError
|
|
28
|
-
|
|
26
|
+
renderUnexpectedError,
|
|
27
|
+
resolveEffectiveConfig,
|
|
28
|
+
streamAll,
|
|
29
|
+
writeNdjsonItem
|
|
30
|
+
} from "./chunk-4IPHFPLO.js";
|
|
31
|
+
import "./chunk-YCLU5VSN.js";
|
|
29
32
|
import {
|
|
30
33
|
createClient,
|
|
31
|
-
|
|
32
|
-
} from "./chunk-
|
|
33
|
-
import "./chunk-PKSKQ3LN.js";
|
|
34
|
-
import "./chunk-EIEF2KFH.js";
|
|
35
|
-
import "./chunk-TQJ77SL4.js";
|
|
34
|
+
downloadBinary
|
|
35
|
+
} from "./chunk-4EH6EWFW.js";
|
|
36
36
|
import {
|
|
37
37
|
GLOBAL_FLAGS,
|
|
38
38
|
READ_SINGLE_FLAGS,
|
|
39
39
|
WRITE_SINGLE_FLAGS
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-4GXO42ZH.js";
|
|
41
41
|
|
|
42
42
|
// src/commands/job.ts
|
|
43
43
|
import { defineCommand } from "citty";
|
|
@@ -99,9 +99,9 @@ function requireEnum(value, allowed, flag, out) {
|
|
|
99
99
|
async function handleSdkError(err, outOpts, out) {
|
|
100
100
|
const { CurviateError } = await import("@curviate/sdk");
|
|
101
101
|
if (err instanceof CurviateError) {
|
|
102
|
-
const { getExitCode } = await import("./exit-codes-
|
|
102
|
+
const { getExitCode } = await import("./exit-codes-ZFWQJYOY.js");
|
|
103
103
|
renderError(err, outOpts, out);
|
|
104
|
-
process.exit(getExitCode(err
|
|
104
|
+
process.exit(getExitCode(err));
|
|
105
105
|
}
|
|
106
106
|
renderUnexpectedError(err, out);
|
|
107
107
|
process.exit(1);
|
|
@@ -136,8 +136,16 @@ async function runJobGet(client, flags, out) {
|
|
|
136
136
|
}
|
|
137
137
|
async function runJobList(client, flags, out) {
|
|
138
138
|
rejectPreviewOnRead(flags.preview, out);
|
|
139
|
-
const accountId = await requireAccount(client, flags, out);
|
|
140
139
|
const state = requireFlag(flags.state, "--state", out);
|
|
140
|
+
if (state === "ALL") {
|
|
141
|
+
if (!flags.all && flags["max-pages"] !== void 0) {
|
|
142
|
+
out.stderr.write("error: --max-pages requires --all; without it, streaming never engages so the flag does nothing.\n");
|
|
143
|
+
process.exit(2);
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
rejectPaginationModifiersWithoutAll(flags, out);
|
|
147
|
+
}
|
|
148
|
+
const accountId = await requireAccount(client, flags, out);
|
|
141
149
|
const ns = client.account(accountId);
|
|
142
150
|
const outOpts = resolveOutputOpts(flags);
|
|
143
151
|
const all = flags.all ?? false;
|
|
@@ -153,7 +161,7 @@ async function runJobList(client, flags, out) {
|
|
|
153
161
|
if (flags.cursor) base.cursor = flags.cursor;
|
|
154
162
|
try {
|
|
155
163
|
if (all) {
|
|
156
|
-
const fn = (p) => ns
|
|
164
|
+
const fn = (p) => listJobs(ns, p).then((page) => {
|
|
157
165
|
const { items: filtered, dropped } = filterJobsByState(page.items, state);
|
|
158
166
|
if (dropped > 0) {
|
|
159
167
|
out.stderr.write(stateFilterDroppedNote(dropped, page.items?.length ?? 0, state));
|
|
@@ -165,10 +173,11 @@ async function runJobList(client, flags, out) {
|
|
|
165
173
|
out,
|
|
166
174
|
pageDelayMs: pageDelayFromFlags(flags)
|
|
167
175
|
})) {
|
|
168
|
-
out
|
|
176
|
+
writeNdjsonItem(out, item, outOpts.fields);
|
|
169
177
|
}
|
|
170
178
|
} else {
|
|
171
|
-
const result = await ns
|
|
179
|
+
const result = await listJobs(ns, base);
|
|
180
|
+
readablePage(result);
|
|
172
181
|
const { items: filtered, dropped } = filterJobsByState(result.items, state);
|
|
173
182
|
if (dropped > 0) {
|
|
174
183
|
out.stderr.write(stateFilterDroppedNote(dropped, result.items?.length ?? 0, state));
|
|
@@ -179,6 +188,9 @@ async function runJobList(client, flags, out) {
|
|
|
179
188
|
await handleSdkError(err, outOpts, out);
|
|
180
189
|
}
|
|
181
190
|
}
|
|
191
|
+
function listJobs(ns, query) {
|
|
192
|
+
return ns.jobs.list(query).then(readablePage);
|
|
193
|
+
}
|
|
182
194
|
function pace(ms) {
|
|
183
195
|
return ms > 0 ? new Promise((resolve) => setTimeout(resolve, ms)) : Promise.resolve();
|
|
184
196
|
}
|
|
@@ -200,7 +212,7 @@ async function runJobListAllStates(ns, flags, out, outOpts, opts) {
|
|
|
200
212
|
const s = JOB_STATES[i];
|
|
201
213
|
const base = { state: s };
|
|
202
214
|
if (limit !== void 0) base.limit = limit;
|
|
203
|
-
const fn = (p) => ns
|
|
215
|
+
const fn = (p) => listJobs(ns, p).then((page) => ({
|
|
204
216
|
...page,
|
|
205
217
|
items: filterJobsByState(page.items, s).items
|
|
206
218
|
}));
|
|
@@ -212,7 +224,7 @@ async function runJobListAllStates(ns, flags, out, outOpts, opts) {
|
|
|
212
224
|
const id = jobItemId(item);
|
|
213
225
|
if (id !== void 0 && seen.has(id)) continue;
|
|
214
226
|
if (id !== void 0) seen.add(id);
|
|
215
|
-
out
|
|
227
|
+
writeNdjsonItem(out, item, outOpts.fields);
|
|
216
228
|
}
|
|
217
229
|
if (i < JOB_STATES.length - 1) await pace(betweenStatesDelay);
|
|
218
230
|
}
|
|
@@ -223,7 +235,7 @@ async function runJobListAllStates(ns, flags, out, outOpts, opts) {
|
|
|
223
235
|
const s = JOB_STATES[i];
|
|
224
236
|
const base = { state: s };
|
|
225
237
|
if (limit !== void 0) base.limit = limit;
|
|
226
|
-
const page = await ns
|
|
238
|
+
const page = await listJobs(ns, base);
|
|
227
239
|
const { items: filtered } = filterJobsByState(page.items, s);
|
|
228
240
|
for (const item of filtered) {
|
|
229
241
|
const id = jobItemId(item);
|
|
@@ -254,6 +266,7 @@ async function runJobBudget(client, flags, out) {
|
|
|
254
266
|
}
|
|
255
267
|
async function runJobApplicants(client, flags, out) {
|
|
256
268
|
rejectPreviewOnRead(flags.preview, out);
|
|
269
|
+
rejectPaginationModifiersWithoutAll(flags, out);
|
|
257
270
|
const accountId = await requireAccount(client, flags, out);
|
|
258
271
|
const jobId = resolveJobIdentifier(flags.id ?? "");
|
|
259
272
|
const ns = client.account(accountId);
|
|
@@ -276,10 +289,11 @@ async function runJobApplicants(client, flags, out) {
|
|
|
276
289
|
out,
|
|
277
290
|
pageDelayMs: pageDelayFromFlags(flags)
|
|
278
291
|
})) {
|
|
279
|
-
out
|
|
292
|
+
writeNdjsonItem(out, item, outOpts.fields);
|
|
280
293
|
}
|
|
281
294
|
} else {
|
|
282
295
|
const result = await ns.jobs.listApplicants(jobId, base);
|
|
296
|
+
readablePage(result);
|
|
283
297
|
renderSuccess(result, outOpts, out);
|
|
284
298
|
}
|
|
285
299
|
} catch (err) {
|
|
@@ -307,7 +321,7 @@ async function runJobApplicantResume(client, flags, out, isTTY) {
|
|
|
307
321
|
const applicantId = flags.applicantId ?? "";
|
|
308
322
|
const ns = client.account(accountId);
|
|
309
323
|
try {
|
|
310
|
-
const data = await ns.jobs.downloadResume(jobId, applicantId);
|
|
324
|
+
const data = await downloadBinary(() => ns.jobs.downloadResume(jobId, applicantId));
|
|
311
325
|
await writeBinaryOutput(data, { outputPath: flags.output, isTTY, stdout: process.stdout });
|
|
312
326
|
} catch (err) {
|
|
313
327
|
if (err instanceof BinaryOutputError) {
|