@curviate/cli 0.22.0 → 0.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/CHANGELOG.md +85 -1
  2. package/README.md +65 -23
  3. package/dist/{account-QRGWUQXF.js → account-NZZLUI4E.js} +11 -12
  4. package/dist/{chunk-H6XD3F66.js → chunk-766W25QS.js} +1 -1
  5. package/dist/{chunk-ZYURL5VK.js → chunk-AHYUM2XQ.js} +93 -1
  6. package/dist/{chunk-56ORAZJO.js → chunk-LCIUD7S2.js} +1 -1
  7. package/dist/chunk-LCLYFE54.js +182 -0
  8. package/dist/{chunk-QJZ3LWOX.js → chunk-RJTG5YWE.js} +1 -1
  9. package/dist/{chunk-T5LPGAGJ.js → chunk-S6VAMUCC.js} +16 -22
  10. package/dist/{chunk-CUTMZWL6.js → chunk-SYRFLZ4D.js} +2 -94
  11. package/dist/{chunk-JA3NNST6.js → chunk-TKWW6BV6.js} +2 -2
  12. package/dist/{chunk-DMQZEPQE.js → chunk-UEAX6KUB.js} +10 -0
  13. package/dist/cli.js +107 -68
  14. package/dist/{comment-MCGXFMN4.js → comment-SXYTJPXI.js} +21 -25
  15. package/dist/{company-WDDLWP7E.js → company-GZ2QR2CZ.js} +26 -30
  16. package/dist/{config-FPWWYG7G.js → config-YKQ4QEBI.js} +4 -3
  17. package/dist/{connect-5OROSY5C.js → connect-3LTKVRGM.js} +15 -18
  18. package/dist/{feed-SFVYEAYP.js → feed-ZY27EY52.js} +9 -12
  19. package/dist/{group-HSZY2IJU.js → group-DBE25EID.js} +16 -16
  20. package/dist/{inbox-L6JBGZIB.js → inbox-E6ME3ROZ.js} +14 -17
  21. package/dist/{inboxes-UIO74C5Q.js → inboxes-JRX3J32A.js} +10 -13
  22. package/dist/{job-75ML7R7I.js → job-U5YIJ7KB.js} +19 -22
  23. package/dist/{login-ZLDDIAFW.js → login-ERQVI27Q.js} +3 -3
  24. package/dist/{message-DAQHRBSJ.js → message-NPX7UX46.js} +7 -5
  25. package/dist/{notification-DYJN4ZHN.js → notification-XSSA5QOJ.js} +11 -14
  26. package/dist/{post-RGDOCGC4.js → post-OSM7JH65.js} +22 -26
  27. package/dist/{profile-TJS2YAZD.js → profile-LQXOC7HY.js} +25 -28
  28. package/dist/{recruiter-NSM33IEK.js → recruiter-ZUTWJHO5.js} +34 -38
  29. package/dist/{sales-nav-5O7FR57S.js → sales-nav-LSUBIJWZ.js} +22 -25
  30. package/dist/{search-TDSLK2MB.js → search-FEHXVTQ3.js} +30 -33
  31. package/dist/{webhook-7ESDSIRU.js → webhook-C43C5BK7.js} +5 -10
  32. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  sentAsNotice
4
- } from "./chunk-T5LPGAGJ.js";
4
+ } from "./chunk-S6VAMUCC.js";
5
5
  import "./chunk-HOQ7EUHJ.js";
6
6
  import {
7
7
  AttachError,
@@ -20,11 +20,14 @@ import {
20
20
  import {
21
21
  pageDelayFromFlags,
22
22
  streamAll
23
- } from "./chunk-H6XD3F66.js";
23
+ } from "./chunk-766W25QS.js";
24
24
  import "./chunk-UWO2D4HW.js";
25
25
  import {
26
26
  resolveIdentifier
27
- } from "./chunk-DMQZEPQE.js";
27
+ } from "./chunk-UEAX6KUB.js";
28
+ import {
29
+ requireAccount
30
+ } from "./chunk-LCLYFE54.js";
28
31
  import {
29
32
  buildPreviewOutput
30
33
  } from "./chunk-R3VLWLVV.js";
@@ -34,14 +37,14 @@ import {
34
37
  renderSuccess,
35
38
  renderUnexpectedError,
36
39
  resolveEffectiveConfig
37
- } from "./chunk-JA3NNST6.js";
40
+ } from "./chunk-TKWW6BV6.js";
41
+ import "./chunk-SYRFLZ4D.js";
38
42
  import {
39
43
  GLOBAL_FLAGS,
40
- WRITE_FLAGS
41
- } from "./chunk-CUTMZWL6.js";
42
- import {
44
+ WRITE_FLAGS,
43
45
  resolveTextOrStdin
44
- } from "./chunk-ZYURL5VK.js";
46
+ } from "./chunk-AHYUM2XQ.js";
47
+ import "./chunk-PMRQXBCP.js";
45
48
 
46
49
  // src/commands/company.ts
47
50
  import { defineCommand } from "citty";
@@ -51,13 +54,6 @@ function buildOutputStreams() {
51
54
  stderr: { write: (s) => process.stderr.write(s) }
52
55
  };
53
56
  }
54
- function requireAccount(account, out) {
55
- if (!account) {
56
- out.stderr.write("error: --account is required for this command. Set it via --account, CURVIATE_ACCOUNT, or `curviate config set-account`.\n");
57
- process.exit(2);
58
- }
59
- return account;
60
- }
61
57
  function rejectPreviewOnRead(preview, out) {
62
58
  if (preview) {
63
59
  out.stderr.write("error: --preview is only valid on write commands (mutations). Reads just run.\n");
@@ -106,7 +102,7 @@ async function runCompanyGet(client, flags, out) {
106
102
  out.stderr.write("error: --sections is not supported on company commands.\n");
107
103
  process.exit(2);
108
104
  }
109
- const accountId = requireAccount(flags.account, out);
105
+ const accountId = await requireAccount(client, flags, out);
110
106
  const rawId = flags.id ?? "";
111
107
  const resolvedId = resolveIdentifier(rawId);
112
108
  const outOpts = { ...resolveOutputOpts(flags), slim: slimCompany };
@@ -119,7 +115,7 @@ async function runCompanyGet(client, flags, out) {
119
115
  }
120
116
  async function runCompanyEmployees(client, flags, out) {
121
117
  rejectPreviewOnRead(flags.preview, out);
122
- const accountId = requireAccount(flags.account, out);
118
+ const accountId = await requireAccount(client, flags, out);
123
119
  const ns = client.account(accountId);
124
120
  const outOpts = resolveOutputOpts(flags);
125
121
  const params = {};
@@ -149,7 +145,7 @@ async function runCompanyEmployees(client, flags, out) {
149
145
  }
150
146
  async function runCompanyPosts(client, flags, out) {
151
147
  rejectPreviewOnRead(flags.preview, out);
152
- const accountId = requireAccount(flags.account, out);
148
+ const accountId = await requireAccount(client, flags, out);
153
149
  const ns = client.account(accountId);
154
150
  const outOpts = resolveOutputOpts(flags);
155
151
  const params = {};
@@ -177,7 +173,7 @@ async function runCompanyPosts(client, flags, out) {
177
173
  }
178
174
  async function runCompanyJobs(client, flags, out) {
179
175
  rejectPreviewOnRead(flags.preview, out);
180
- const accountId = requireAccount(flags.account, out);
176
+ const accountId = await requireAccount(client, flags, out);
181
177
  const ns = client.account(accountId);
182
178
  const outOpts = resolveOutputOpts(flags);
183
179
  const params = {};
@@ -206,7 +202,7 @@ async function runCompanyJobs(client, flags, out) {
206
202
  }
207
203
  async function runCompanyInvitableFollowers(client, flags, out) {
208
204
  rejectPreviewOnRead(flags.preview, out);
209
- const accountId = requireAccount(flags.account, out);
205
+ const accountId = await requireAccount(client, flags, out);
210
206
  const ns = client.account(accountId);
211
207
  const outOpts = resolveOutputOpts(flags);
212
208
  const params = {};
@@ -234,7 +230,7 @@ async function runCompanyInvitableFollowers(client, flags, out) {
234
230
  }
235
231
  }
236
232
  async function runCompanyFollowInvite(client, flags, out) {
237
- const accountId = requireAccount(flags.account, out);
233
+ const accountId = await requireAccount(client, flags, out);
238
234
  const ns = client.account(accountId);
239
235
  const outOpts = resolveOutputOpts(flags);
240
236
  const inviteeIds = normalizeInviteeIds(flags.invitee);
@@ -264,7 +260,7 @@ async function runCompanyFollowInvite(client, flags, out) {
264
260
  }
265
261
  async function runCompanyManaged(client, flags, out) {
266
262
  rejectPreviewOnRead(flags.preview, out);
267
- const accountId = requireAccount(flags.account, out);
263
+ const accountId = await requireAccount(client, flags, out);
268
264
  const ns = client.account(accountId);
269
265
  const outOpts = resolveOutputOpts(flags);
270
266
  const params = {};
@@ -291,7 +287,7 @@ async function runCompanyManaged(client, flags, out) {
291
287
  }
292
288
  async function runCompanyFollowers(client, flags, out) {
293
289
  rejectPreviewOnRead(flags.preview, out);
294
- const accountId = requireAccount(flags.account, out);
290
+ const accountId = await requireAccount(client, flags, out);
295
291
  const ns = client.account(accountId);
296
292
  const outOpts = resolveOutputOpts(flags);
297
293
  const params = {};
@@ -319,7 +315,7 @@ async function runCompanyFollowers(client, flags, out) {
319
315
  }
320
316
  async function runCompanyChats(client, flags, out) {
321
317
  rejectPreviewOnRead(flags.preview, out);
322
- const accountId = requireAccount(flags.account, out);
318
+ const accountId = await requireAccount(client, flags, out);
323
319
  const ns = client.account(accountId);
324
320
  const outOpts = resolveOutputOpts(flags);
325
321
  const params = {};
@@ -351,7 +347,7 @@ async function runCompanyChat(client, flags, out) {
351
347
  out.stderr.write("error: --all is not supported on non-paginated commands.\n");
352
348
  process.exit(2);
353
349
  }
354
- const accountId = requireAccount(flags.account, out);
350
+ const accountId = await requireAccount(client, flags, out);
355
351
  const ns = client.account(accountId);
356
352
  const outOpts = resolveOutputOpts(flags);
357
353
  const chatId = flags.chatId ?? "";
@@ -365,7 +361,7 @@ async function runCompanyChat(client, flags, out) {
365
361
  }
366
362
  async function runCompanyMessages(client, flags, out) {
367
363
  rejectPreviewOnRead(flags.preview, out);
368
- const accountId = requireAccount(flags.account, out);
364
+ const accountId = await requireAccount(client, flags, out);
369
365
  const ns = client.account(accountId);
370
366
  const outOpts = resolveOutputOpts(flags);
371
367
  const chatId = flags.chatId ?? "";
@@ -398,7 +394,7 @@ async function runCompanyMessage(client, flags, out) {
398
394
  out.stderr.write("error: --all is not supported on non-paginated commands.\n");
399
395
  process.exit(2);
400
396
  }
401
- const accountId = requireAccount(flags.account, out);
397
+ const accountId = await requireAccount(client, flags, out);
402
398
  const ns = client.account(accountId);
403
399
  const outOpts = resolveOutputOpts(flags);
404
400
  const chatId = flags.chatId ?? "";
@@ -413,7 +409,7 @@ async function runCompanyMessage(client, flags, out) {
413
409
  }
414
410
  async function runCompanySearchChats(client, flags, out) {
415
411
  rejectPreviewOnRead(flags.preview, out);
416
- const accountId = requireAccount(flags.account, out);
412
+ const accountId = await requireAccount(client, flags, out);
417
413
  const ns = client.account(accountId);
418
414
  const outOpts = resolveOutputOpts(flags);
419
415
  const params = {};
@@ -443,7 +439,7 @@ async function runCompanySearchChats(client, flags, out) {
443
439
  }
444
440
  }
445
441
  async function runCompanyReply(client, flags, out, _readStdin) {
446
- const accountId = requireAccount(flags.account, out);
442
+ const accountId = await requireAccount(client, flags, out);
447
443
  const ns = client.account(accountId);
448
444
  const outOpts = resolveOutputOpts(flags);
449
445
  const chatId = flags.chatId ?? "";
@@ -498,7 +494,7 @@ var companyEmployeesCommand = defineCommand({
498
494
  ...GLOBAL_FLAGS,
499
495
  id: { type: "positional", description: "Company identifier (URL, slug, or numeric id), a slug/URL is resolved to the numeric id first." },
500
496
  keywords: { type: "string", description: "Free-text keyword filter across employee profile fields." },
501
- location: { type: "string", description: "Opaque location id from `search parameters --type LOCATION`." }
497
+ location: { type: "string", description: "Opaque location id from `curviate search parameters --type LOCATION`." }
502
498
  },
503
499
  async run({ args }) {
504
500
  const flags = args;
@@ -1,14 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- GLOBAL_FLAGS,
4
3
  getConfigPath,
5
4
  readConfig,
6
5
  removeProfile,
7
6
  renameProfile,
8
7
  setActiveProfile,
9
8
  updateProfileField
10
- } from "./chunk-CUTMZWL6.js";
11
- import "./chunk-ZYURL5VK.js";
9
+ } from "./chunk-SYRFLZ4D.js";
10
+ import {
11
+ GLOBAL_FLAGS
12
+ } from "./chunk-AHYUM2XQ.js";
12
13
 
13
14
  // src/commands/config.ts
14
15
  import { defineCommand } from "citty";
@@ -11,10 +11,13 @@ import {
11
11
  import {
12
12
  pageDelayFromFlags,
13
13
  streamAll
14
- } from "./chunk-H6XD3F66.js";
14
+ } from "./chunk-766W25QS.js";
15
15
  import {
16
16
  resolveIdentifier
17
- } from "./chunk-DMQZEPQE.js";
17
+ } from "./chunk-UEAX6KUB.js";
18
+ import {
19
+ requireAccount
20
+ } from "./chunk-LCLYFE54.js";
18
21
  import {
19
22
  buildPreviewOutput
20
23
  } from "./chunk-R3VLWLVV.js";
@@ -24,12 +27,13 @@ import {
24
27
  renderSuccess,
25
28
  renderUnexpectedError,
26
29
  resolveEffectiveConfig
27
- } from "./chunk-JA3NNST6.js";
30
+ } from "./chunk-TKWW6BV6.js";
31
+ import "./chunk-SYRFLZ4D.js";
28
32
  import {
29
33
  GLOBAL_FLAGS,
30
34
  WRITE_FLAGS
31
- } from "./chunk-CUTMZWL6.js";
32
- import "./chunk-ZYURL5VK.js";
35
+ } from "./chunk-AHYUM2XQ.js";
36
+ import "./chunk-PMRQXBCP.js";
33
37
 
34
38
  // src/commands/connect.ts
35
39
  import { defineCommand } from "citty";
@@ -39,13 +43,6 @@ function buildOutputStreams() {
39
43
  stderr: { write: (s) => process.stderr.write(s) }
40
44
  };
41
45
  }
42
- function requireAccount(account, out) {
43
- if (!account) {
44
- out.stderr.write("error: --account is required for this command. Set it via --account, CURVIATE_ACCOUNT, or `curviate config set-account`.\n");
45
- process.exit(2);
46
- }
47
- return account;
48
- }
49
46
  function rejectPreviewOnRead(preview, out) {
50
47
  if (preview) {
51
48
  out.stderr.write("error: --preview is only valid on write commands (mutations). Reads just run.\n");
@@ -61,7 +58,7 @@ function resolveOutputOpts(flags) {
61
58
  };
62
59
  }
63
60
  async function runConnectSend(client, flags, out) {
64
- const accountId = requireAccount(flags.account, out);
61
+ const accountId = await requireAccount(client, flags, out);
65
62
  const rawId = flags.id ?? "";
66
63
  const resolvedId = resolveIdentifier(rawId);
67
64
  const body = {
@@ -96,7 +93,7 @@ async function runConnectSend(client, flags, out) {
96
93
  }
97
94
  async function runConnectSent(client, flags, out) {
98
95
  rejectPreviewOnRead(flags.preview, out);
99
- const accountId = requireAccount(flags.account, out);
96
+ const accountId = await requireAccount(client, flags, out);
100
97
  const ns = client.account(accountId);
101
98
  const outOpts = resolveOutputOpts(flags);
102
99
  const all = flags.all ?? false;
@@ -134,7 +131,7 @@ async function runConnectSent(client, flags, out) {
134
131
  }
135
132
  async function runConnectReceived(client, flags, out) {
136
133
  rejectPreviewOnRead(flags.preview, out);
137
- const accountId = requireAccount(flags.account, out);
134
+ const accountId = await requireAccount(client, flags, out);
138
135
  const ns = client.account(accountId);
139
136
  const outOpts = resolveOutputOpts(flags);
140
137
  const all = flags.all ?? false;
@@ -171,7 +168,7 @@ async function runConnectReceived(client, flags, out) {
171
168
  }
172
169
  }
173
170
  async function runConnectAccept(client, flags, out) {
174
- const accountId = requireAccount(flags.account, out);
171
+ const accountId = await requireAccount(client, flags, out);
175
172
  const invitationId = flags.id ?? "";
176
173
  if (flags.preview) {
177
174
  const preview = buildPreviewOutput({
@@ -200,7 +197,7 @@ async function runConnectAccept(client, flags, out) {
200
197
  }
201
198
  }
202
199
  async function runConnectDecline(client, flags, out) {
203
- const accountId = requireAccount(flags.account, out);
200
+ const accountId = await requireAccount(client, flags, out);
204
201
  const invitationId = flags.id ?? "";
205
202
  if (flags.preview) {
206
203
  const preview = buildPreviewOutput({
@@ -229,7 +226,7 @@ async function runConnectDecline(client, flags, out) {
229
226
  }
230
227
  }
231
228
  async function runConnectCancel(client, flags, out) {
232
- const accountId = requireAccount(flags.account, out);
229
+ const accountId = await requireAccount(client, flags, out);
233
230
  const invitationId = flags.id ?? "";
234
231
  if (flags.preview) {
235
232
  const preview = buildPreviewOutput({
@@ -2,18 +2,22 @@
2
2
  import {
3
3
  pageDelayFromFlags,
4
4
  streamAll
5
- } from "./chunk-H6XD3F66.js";
5
+ } from "./chunk-766W25QS.js";
6
+ import {
7
+ requireAccount
8
+ } from "./chunk-LCLYFE54.js";
6
9
  import {
7
10
  createClient,
8
11
  renderError,
9
12
  renderSuccess,
10
13
  renderUnexpectedError,
11
14
  resolveEffectiveConfig
12
- } from "./chunk-JA3NNST6.js";
15
+ } from "./chunk-TKWW6BV6.js";
16
+ import "./chunk-SYRFLZ4D.js";
13
17
  import {
14
18
  GLOBAL_FLAGS
15
- } from "./chunk-CUTMZWL6.js";
16
- import "./chunk-ZYURL5VK.js";
19
+ } from "./chunk-AHYUM2XQ.js";
20
+ import "./chunk-PMRQXBCP.js";
17
21
 
18
22
  // src/commands/feed.ts
19
23
  import { defineCommand } from "citty";
@@ -23,13 +27,6 @@ function buildOutputStreams() {
23
27
  stderr: { write: (s) => process.stderr.write(s) }
24
28
  };
25
29
  }
26
- function requireAccount(account, out) {
27
- if (!account) {
28
- out.stderr.write("error: --account is required for this command. Set it via --account, CURVIATE_ACCOUNT, or `curviate config set-account`.\n");
29
- process.exit(2);
30
- }
31
- return account;
32
- }
33
30
  function rejectPreviewOnRead(preview, out) {
34
31
  if (preview) {
35
32
  out.stderr.write("error: --preview is only valid on write commands (mutations). Reads just run.\n");
@@ -56,7 +53,7 @@ async function handleSdkError(err, outOpts, out) {
56
53
  }
57
54
  async function runFeedHome(client, flags, out) {
58
55
  rejectPreviewOnRead(flags.preview, out);
59
- const accountId = requireAccount(flags.account, out);
56
+ const accountId = await requireAccount(client, flags, out);
60
57
  const ns = client.account(accountId);
61
58
  const outOpts = resolveOutputOpts(flags);
62
59
  const all = flags.all ?? false;
@@ -2,19 +2,26 @@
2
2
  import {
3
3
  pageDelayFromFlags,
4
4
  streamAll
5
- } from "./chunk-H6XD3F66.js";
5
+ } from "./chunk-766W25QS.js";
6
+ import {
7
+ normalizeGroupId
8
+ } from "./chunk-UEAX6KUB.js";
9
+ import {
10
+ requireAccount
11
+ } from "./chunk-LCLYFE54.js";
6
12
  import {
7
13
  createClient,
8
14
  renderError,
9
15
  renderSuccess,
10
16
  renderUnexpectedError,
11
17
  resolveEffectiveConfig
12
- } from "./chunk-JA3NNST6.js";
18
+ } from "./chunk-TKWW6BV6.js";
19
+ import "./chunk-SYRFLZ4D.js";
13
20
  import {
14
21
  GLOBAL_FLAGS,
15
22
  READ_SINGLE_FLAGS
16
- } from "./chunk-CUTMZWL6.js";
17
- import "./chunk-ZYURL5VK.js";
23
+ } from "./chunk-AHYUM2XQ.js";
24
+ import "./chunk-PMRQXBCP.js";
18
25
 
19
26
  // src/commands/group.ts
20
27
  import { defineCommand } from "citty";
@@ -24,13 +31,6 @@ function buildOutputStreams() {
24
31
  stderr: { write: (s) => process.stderr.write(s) }
25
32
  };
26
33
  }
27
- function requireAccount(account, out) {
28
- if (!account) {
29
- out.stderr.write("error: --account is required for this command. Set it via --account, CURVIATE_ACCOUNT, or `curviate config set-account`.\n");
30
- process.exit(2);
31
- }
32
- return account;
33
- }
34
34
  function rejectPreviewOnRead(preview, out) {
35
35
  if (preview) {
36
36
  out.stderr.write("error: --preview is only valid on write commands (mutations). Reads just run.\n");
@@ -63,7 +63,7 @@ async function handleSdkError(err, outOpts, out) {
63
63
  }
64
64
  async function runGroupList(client, flags, out) {
65
65
  rejectPreviewOnRead(flags.preview, out);
66
- const accountId = requireAccount(flags.account, out);
66
+ const accountId = await requireAccount(client, flags, out);
67
67
  const ns = client.account(accountId);
68
68
  const outOpts = resolveOutputOpts(flags);
69
69
  const all = flags.all ?? false;
@@ -93,8 +93,8 @@ async function runGroupList(client, flags, out) {
93
93
  async function runGroupGet(client, flags, out) {
94
94
  rejectPreviewOnRead(flags.preview, out);
95
95
  rejectAllOnNonPaginated(flags.all, out);
96
- const accountId = requireAccount(flags.account, out);
97
- const groupId = flags.groupId ?? "";
96
+ const accountId = await requireAccount(client, flags, out);
97
+ const groupId = normalizeGroupId(flags.groupId ?? "");
98
98
  const ns = client.account(accountId);
99
99
  const outOpts = resolveOutputOpts(flags);
100
100
  try {
@@ -106,8 +106,8 @@ async function runGroupGet(client, flags, out) {
106
106
  }
107
107
  async function runGroupMembers(client, flags, out) {
108
108
  rejectPreviewOnRead(flags.preview, out);
109
- const accountId = requireAccount(flags.account, out);
110
- const groupId = flags.groupId ?? "";
109
+ const accountId = await requireAccount(client, flags, out);
110
+ const groupId = normalizeGroupId(flags.groupId ?? "");
111
111
  const ns = client.account(accountId);
112
112
  const outOpts = resolveOutputOpts(flags);
113
113
  const all = flags.all ?? false;
@@ -2,10 +2,13 @@
2
2
  import {
3
3
  pageDelayFromFlags,
4
4
  streamAll
5
- } from "./chunk-H6XD3F66.js";
5
+ } from "./chunk-766W25QS.js";
6
6
  import {
7
7
  normalizeChatId
8
- } from "./chunk-DMQZEPQE.js";
8
+ } from "./chunk-UEAX6KUB.js";
9
+ import {
10
+ requireAccount
11
+ } from "./chunk-LCLYFE54.js";
9
12
  import {
10
13
  buildPreviewOutput
11
14
  } from "./chunk-R3VLWLVV.js";
@@ -15,13 +18,14 @@ import {
15
18
  renderSuccess,
16
19
  renderUnexpectedError,
17
20
  resolveEffectiveConfig
18
- } from "./chunk-JA3NNST6.js";
21
+ } from "./chunk-TKWW6BV6.js";
22
+ import "./chunk-SYRFLZ4D.js";
19
23
  import {
20
24
  GLOBAL_FLAGS,
21
25
  READ_SINGLE_FLAGS,
22
26
  WRITE_SINGLE_FLAGS
23
- } from "./chunk-CUTMZWL6.js";
24
- import "./chunk-ZYURL5VK.js";
27
+ } from "./chunk-AHYUM2XQ.js";
28
+ import "./chunk-PMRQXBCP.js";
25
29
 
26
30
  // src/commands/inbox.ts
27
31
  import { defineCommand } from "citty";
@@ -31,13 +35,6 @@ function buildOutputStreams() {
31
35
  stderr: { write: (s) => process.stderr.write(s) }
32
36
  };
33
37
  }
34
- function requireAccount(account, out) {
35
- if (!account) {
36
- out.stderr.write("error: --account is required for this command. Set it via --account, CURVIATE_ACCOUNT, or `curviate config set-account`.\n");
37
- process.exit(2);
38
- }
39
- return account;
40
- }
41
38
  function rejectPreviewOnRead(preview, out) {
42
39
  if (preview) {
43
40
  out.stderr.write("error: --preview is only valid on write commands (mutations). Reads just run.\n");
@@ -94,7 +91,7 @@ async function handleSdkError(err, outOpts, out) {
94
91
  }
95
92
  async function runInboxList(client, flags, out) {
96
93
  rejectPreviewOnRead(flags.preview, out);
97
- const accountId = requireAccount(flags.account, out);
94
+ const accountId = await requireAccount(client, flags, out);
98
95
  const ns = client.account(accountId);
99
96
  const outOpts = resolveOutputOpts(flags);
100
97
  const all = flags.all ?? false;
@@ -125,7 +122,7 @@ async function runInboxList(client, flags, out) {
125
122
  async function runInboxGet(client, flags, out) {
126
123
  rejectPreviewOnRead(flags.preview, out);
127
124
  rejectAllOnNonPaginated(flags.all, out);
128
- const accountId = requireAccount(flags.account, out);
125
+ const accountId = await requireAccount(client, flags, out);
129
126
  const chatId = normalizeChatId(flags.chatId ?? "");
130
127
  const ns = client.account(accountId);
131
128
  const outOpts = resolveOutputOpts(flags);
@@ -137,7 +134,7 @@ async function runInboxGet(client, flags, out) {
137
134
  }
138
135
  }
139
136
  async function runInboxMarkRead(client, flags, out) {
140
- const accountId = requireAccount(flags.account, out);
137
+ const accountId = await requireAccount(client, flags, out);
141
138
  const chatId = normalizeChatId(flags.chatId ?? "");
142
139
  const body = { read: true };
143
140
  if (flags.preview) {
@@ -156,7 +153,7 @@ async function runInboxMarkRead(client, flags, out) {
156
153
  }
157
154
  async function runInboxMessages(client, flags, out) {
158
155
  rejectPreviewOnRead(flags.preview, out);
159
- const accountId = requireAccount(flags.account, out);
156
+ const accountId = await requireAccount(client, flags, out);
160
157
  const chatId = normalizeChatId(flags.chatId ?? "");
161
158
  const ns = client.account(accountId);
162
159
  const outOpts = resolveOutputOpts(flags);
@@ -192,7 +189,7 @@ async function runInboxMessages(client, flags, out) {
192
189
  }
193
190
  async function runInboxSearch(client, flags, out) {
194
191
  rejectPreviewOnRead(flags.preview, out);
195
- const accountId = requireAccount(flags.account, out);
192
+ const accountId = await requireAccount(client, flags, out);
196
193
  const query = flags.query ?? "";
197
194
  if (!query) {
198
195
  out.stderr.write("error: <query> is required.\n");
@@ -2,19 +2,23 @@
2
2
  import {
3
3
  pageDelayFromFlags,
4
4
  streamAll
5
- } from "./chunk-H6XD3F66.js";
5
+ } from "./chunk-766W25QS.js";
6
+ import {
7
+ requireAccount
8
+ } from "./chunk-LCLYFE54.js";
6
9
  import {
7
10
  createClient,
8
11
  renderError,
9
12
  renderSuccess,
10
13
  renderUnexpectedError,
11
14
  resolveEffectiveConfig
12
- } from "./chunk-JA3NNST6.js";
15
+ } from "./chunk-TKWW6BV6.js";
16
+ import "./chunk-SYRFLZ4D.js";
13
17
  import {
14
18
  GLOBAL_FLAGS,
15
19
  READ_SINGLE_FLAGS
16
- } from "./chunk-CUTMZWL6.js";
17
- import "./chunk-ZYURL5VK.js";
20
+ } from "./chunk-AHYUM2XQ.js";
21
+ import "./chunk-PMRQXBCP.js";
18
22
 
19
23
  // src/commands/inboxes.ts
20
24
  import { defineCommand } from "citty";
@@ -24,13 +28,6 @@ function buildOutputStreams() {
24
28
  stderr: { write: (s) => process.stderr.write(s) }
25
29
  };
26
30
  }
27
- function requireAccount(account, out) {
28
- if (!account) {
29
- out.stderr.write("error: --account is required for this command. Set it via --account, CURVIATE_ACCOUNT, or `curviate config set-account`.\n");
30
- process.exit(2);
31
- }
32
- return account;
33
- }
34
31
  function rejectPreviewOnRead(preview, out) {
35
32
  if (preview) {
36
33
  out.stderr.write("error: --preview is only valid on write commands (mutations). Reads just run.\n");
@@ -74,7 +71,7 @@ function validateLimitRange(raw, out) {
74
71
  async function runInboxesList(client, flags, out) {
75
72
  rejectPreviewOnRead(flags.preview, out);
76
73
  rejectAllOnNonPaginated(flags.all, out);
77
- const accountId = requireAccount(flags.account, out);
74
+ const accountId = await requireAccount(client, flags, out);
78
75
  const ns = client.account(accountId);
79
76
  const outOpts = resolveOutputOpts(flags);
80
77
  const params = {};
@@ -89,7 +86,7 @@ async function runInboxesList(client, flags, out) {
89
86
  }
90
87
  async function runInboxesChats(client, flags, out) {
91
88
  rejectPreviewOnRead(flags.preview, out);
92
- const accountId = requireAccount(flags.account, out);
89
+ const accountId = await requireAccount(client, flags, out);
93
90
  const inboxId = flags.inboxId ?? "";
94
91
  const ns = client.account(accountId);
95
92
  const outOpts = resolveOutputOpts(flags);