@curviate/cli 0.22.0 → 0.23.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.
@@ -19,6 +19,9 @@ import {
19
19
  pageDelayFromFlags,
20
20
  streamAll
21
21
  } from "./chunk-H6XD3F66.js";
22
+ import {
23
+ requireAccount
24
+ } from "./chunk-3BO6GVS2.js";
22
25
  import {
23
26
  createClient,
24
27
  renderError,
@@ -30,6 +33,7 @@ import {
30
33
  GLOBAL_FLAGS
31
34
  } from "./chunk-CUTMZWL6.js";
32
35
  import "./chunk-ZYURL5VK.js";
36
+ import "./chunk-PMRQXBCP.js";
33
37
 
34
38
  // src/commands/search.ts
35
39
  import { defineCommand } from "citty";
@@ -60,13 +64,6 @@ function buildOutputStreams() {
60
64
  stderr: { write: (s) => process.stderr.write(s) }
61
65
  };
62
66
  }
63
- function requireAccount(account, out) {
64
- if (!account) {
65
- out.stderr.write("error: --account is required for this command. Set it via --account, CURVIATE_ACCOUNT, or `curviate config set-account`.\n");
66
- process.exit(2);
67
- }
68
- return account;
69
- }
70
67
  function rejectPreviewOnRead(preview, out) {
71
68
  if (preview) {
72
69
  out.stderr.write("error: --preview is only valid on write commands (mutations). Reads just run.\n");
@@ -191,7 +188,7 @@ async function runSearchPeople(client, flags, out, readers = DEFAULT_FILTER_READ
191
188
  process.exit(2);
192
189
  }
193
190
  }
194
- const accountId = requireAccount(flags.account, out);
191
+ const accountId = await requireAccount(client, flags, out);
195
192
  const ns = client.account(accountId);
196
193
  const outOpts = resolveOutputOpts(flags);
197
194
  const verbose = flags.verbose ?? false;
@@ -232,7 +229,7 @@ async function runSearchPeople(client, flags, out, readers = DEFAULT_FILTER_READ
232
229
  }
233
230
  async function runSearchCompanies(client, flags, out, readers = DEFAULT_FILTER_READERS) {
234
231
  rejectPreviewOnRead(flags.preview, out);
235
- const accountId = requireAccount(flags.account, out);
232
+ const accountId = await requireAccount(client, flags, out);
236
233
  const ns = client.account(accountId);
237
234
  const outOpts = resolveOutputOpts(flags);
238
235
  const verbose = flags.verbose ?? false;
@@ -273,7 +270,7 @@ async function runSearchCompanies(client, flags, out, readers = DEFAULT_FILTER_R
273
270
  }
274
271
  async function runSearchPosts(client, flags, out, readers = DEFAULT_FILTER_READERS) {
275
272
  rejectPreviewOnRead(flags.preview, out);
276
- const accountId = requireAccount(flags.account, out);
273
+ const accountId = await requireAccount(client, flags, out);
277
274
  const ns = client.account(accountId);
278
275
  const outOpts = resolveOutputOpts(flags);
279
276
  const verbose = flags.verbose ?? false;
@@ -314,7 +311,7 @@ async function runSearchPosts(client, flags, out, readers = DEFAULT_FILTER_READE
314
311
  }
315
312
  async function runSearchJobs(client, flags, out, readers = DEFAULT_FILTER_READERS) {
316
313
  rejectPreviewOnRead(flags.preview, out);
317
- const accountId = requireAccount(flags.account, out);
314
+ const accountId = await requireAccount(client, flags, out);
318
315
  const ns = client.account(accountId);
319
316
  const outOpts = resolveOutputOpts(flags);
320
317
  const verbose = flags.verbose ?? false;
@@ -364,7 +361,7 @@ async function runSearchParameters(client, flags, out) {
364
361
  out.stderr.write("error: --keywords is required (v2: required for every --type).\n");
365
362
  process.exit(2);
366
363
  }
367
- const accountId = requireAccount(flags.account, out);
364
+ const accountId = await requireAccount(client, flags, out);
368
365
  const ns = client.account(accountId);
369
366
  const outOpts = resolveOutputOpts(flags);
370
367
  const query = {
@@ -393,7 +390,7 @@ async function runSearchGroups(client, flags, out) {
393
390
  out.stderr.write("error: <query> is required.\n");
394
391
  process.exit(2);
395
392
  }
396
- const accountId = requireAccount(flags.account, out);
393
+ const accountId = await requireAccount(client, flags, out);
397
394
  const ns = client.account(accountId);
398
395
  const outOpts = resolveOutputOpts(flags);
399
396
  const all = flags.all ?? false;
@@ -428,7 +425,7 @@ async function runSearchGroups(client, flags, out) {
428
425
  }
429
426
  async function runSearchServices(client, flags, out) {
430
427
  rejectPreviewOnRead(flags.preview, out);
431
- const accountId = requireAccount(flags.account, out);
428
+ const accountId = await requireAccount(client, flags, out);
432
429
  const ns = client.account(accountId);
433
430
  const outOpts = resolveOutputOpts(flags);
434
431
  const all = flags.all ?? false;
@@ -475,7 +472,7 @@ async function runSearchServiceParameters(client, flags, out) {
475
472
  out.stderr.write("error: --keywords is required.\n");
476
473
  process.exit(2);
477
474
  }
478
- const accountId = requireAccount(flags.account, out);
475
+ const accountId = await requireAccount(client, flags, out);
479
476
  const ns = client.account(accountId);
480
477
  const outOpts = resolveOutputOpts(flags);
481
478
  const query = { keywords: flags.keywords };
@@ -497,7 +494,7 @@ async function runSearchServiceParameters(client, flags, out) {
497
494
  }
498
495
  async function runSearchFromUrl(client, flags, out) {
499
496
  rejectPreviewOnRead(flags.preview, out);
500
- const accountId = requireAccount(flags.account, out);
497
+ const accountId = await requireAccount(client, flags, out);
501
498
  const url = flags.url ?? "";
502
499
  const ns = client.account(accountId);
503
500
  const outOpts = resolveOutputOpts(flags);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curviate/cli",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "private": false,
5
5
  "description": "Official command-line interface for the Curviate API.",
6
6
  "license": "MIT",
@@ -42,7 +42,7 @@
42
42
  "clean": "rm -rf dist *.tsbuildinfo"
43
43
  },
44
44
  "dependencies": {
45
- "@curviate/sdk": "^0.20.0",
45
+ "@curviate/sdk": "^0.20.1",
46
46
  "citty": "^0.1.6",
47
47
  "open": "^10.1.0"
48
48
  },
@@ -2,9 +2,6 @@
2
2
  import {
3
3
  readlineSync
4
4
  } from "./chunk-H4KV7MIN.js";
5
- import {
6
- AUTH_NEEDED
7
- } from "./chunk-PMRQXBCP.js";
8
5
  import {
9
6
  slimAccountGet,
10
7
  slimAccountList,
@@ -32,6 +29,9 @@ import {
32
29
  import {
33
30
  defaultReadStdin
34
31
  } from "./chunk-ZYURL5VK.js";
32
+ import {
33
+ AUTH_NEEDED
34
+ } from "./chunk-PMRQXBCP.js";
35
35
 
36
36
  // src/commands/account.ts
37
37
  import { defineCommand } from "citty";