@curviate/cli 0.38.0 → 0.41.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.
Files changed (27) hide show
  1. package/CHANGELOG.md +115 -0
  2. package/README.md +2 -2
  3. package/dist/{account-TYKHUB7X.js → account-QZ5RYKIT.js} +13 -3
  4. package/dist/{chunk-BN7L7WSY.js → chunk-4AAKZPOM.js} +34 -4
  5. package/dist/{chunk-MNDXMGPX.js → chunk-BLFGJIJJ.js} +1 -1
  6. package/dist/{chunk-7JU4IXXG.js → chunk-CBHL3QQJ.js} +32 -1
  7. package/dist/{chunk-ZJ7D3NFS.js → chunk-WAE7YLO5.js} +1 -1
  8. package/dist/cli.js +19 -19
  9. package/dist/{comment-G6RB2PBZ.js → comment-SYA6OKEY.js} +16 -13
  10. package/dist/{company-OWND3W3L.js → company-IXQ4OFU3.js} +36 -21
  11. package/dist/{connect-3E7EC5ZM.js → connect-TTA2X3KO.js} +8 -6
  12. package/dist/{doctor-Z6OSCGKT.js → doctor-ET7XQ22E.js} +1 -1
  13. package/dist/{feed-VDTFIMKN.js → feed-556LS3CN.js} +7 -4
  14. package/dist/{group-KDJHY2IM.js → group-DIIG4XQT.js} +12 -6
  15. package/dist/{inbox-DQLX2LR7.js → inbox-SRVTUTE6.js} +16 -11
  16. package/dist/{inboxes-WMNHOPY7.js → inboxes-XHZTAUQ7.js} +9 -4
  17. package/dist/{job-ESKS2LDJ.js → job-QNVGEM4J.js} +14 -6
  18. package/dist/{message-5W2R3YHS.js → message-2JEL6P7E.js} +3 -3
  19. package/dist/{notification-IGNUH2GR.js → notification-T4SRAIJ3.js} +7 -4
  20. package/dist/{post-NLI76K74.js → post-PV4UQVPO.js} +18 -13
  21. package/dist/{profile-TBKKIICM.js → profile-K5BZNGX5.js} +26 -15
  22. package/dist/{recruiter-AEJRHIX5.js → recruiter-OBKS4ZVL.js} +27 -15
  23. package/dist/{sales-nav-SW6WJVMD.js → sales-nav-WPTMS6QF.js} +46 -19
  24. package/dist/{search-WRMVQU6C.js → search-YAKZKK74.js} +51 -35
  25. package/dist/{setup-YUSWG77F.js → setup-NZQUWJYC.js} +1 -1
  26. package/dist/{webhook-NGMRJMQ5.js → webhook-PXSLDB2F.js} +8 -3
  27. package/package.json +2 -2
@@ -17,9 +17,11 @@ import {
17
17
  } from "./chunk-XP2LN6F6.js";
18
18
  import {
19
19
  requireAccount
20
- } from "./chunk-MNDXMGPX.js";
20
+ } from "./chunk-BLFGJIJJ.js";
21
21
  import {
22
22
  pageDelayFromFlags,
23
+ readCursorFlag,
24
+ readMaxPagesFlag,
23
25
  readablePage,
24
26
  rejectPaginationModifiersWithoutAll,
25
27
  renderError,
@@ -28,14 +30,13 @@ import {
28
30
  resolveEffectiveConfig,
29
31
  streamAll,
30
32
  writeNdjsonItem
31
- } from "./chunk-7JU4IXXG.js";
33
+ } from "./chunk-CBHL3QQJ.js";
32
34
  import "./chunk-XZJQQJBE.js";
33
35
  import {
34
36
  createClient
35
37
  } from "./chunk-DCZR4M7G.js";
36
38
  import {
37
- GLOBAL_FLAGS,
38
- NON_STREAM_FLAGS
39
+ GLOBAL_FLAGS
39
40
  } from "./chunk-XDQHNUEU.js";
40
41
 
41
42
  // src/commands/search.ts
@@ -73,12 +74,6 @@ function rejectPreviewOnRead(preview, out) {
73
74
  process.exit(2);
74
75
  }
75
76
  }
76
- function rejectAllOnNonPaginated(all, out) {
77
- if (all) {
78
- out.stderr.write("error: --all is not supported on non-paginated commands.\n");
79
- process.exit(2);
80
- }
81
- }
82
77
  function resolveOutputOpts(flags) {
83
78
  return {
84
79
  json: (flags.json ?? false) || !process.stdout.isTTY,
@@ -87,9 +82,10 @@ function resolveOutputOpts(flags) {
87
82
  verbose: flags.verbose ?? false
88
83
  };
89
84
  }
90
- function applyCommonSearchFlags(body, flags) {
85
+ function applyCommonSearchFlags(body, flags, out) {
91
86
  if (flags.keywords) body["keywords"] = flags.keywords;
92
- if (flags.cursor) body["cursor"] = flags.cursor;
87
+ const cursor = readCursorFlag(flags, out);
88
+ if (cursor) body["cursor"] = cursor;
93
89
  if (flags.limit) body["limit"] = parseInt(flags.limit, 10);
94
90
  }
95
91
  function mergeNested(body, key, patch) {
@@ -171,11 +167,11 @@ var NAMED_FLAG_MAPPERS = {
171
167
  }
172
168
  }
173
169
  };
174
- async function buildSearchBody(kind, flags, readers) {
170
+ async function buildSearchBody(kind, flags, readers, out) {
175
171
  const assembled = await assembleFilters(flags, readers);
176
172
  if ("error" in assembled) return assembled;
177
173
  const body = assembled.body;
178
- applyCommonSearchFlags(body, flags);
174
+ applyCommonSearchFlags(body, flags, out);
179
175
  const mapperError = NAMED_FLAG_MAPPERS[kind](body, flags);
180
176
  if (mapperError) return { error: mapperError };
181
177
  return { body };
@@ -197,8 +193,8 @@ async function runSearchPeople(client, flags, out, readers = DEFAULT_FILTER_READ
197
193
  const outOpts = resolveOutputOpts(flags);
198
194
  const verbose = flags.verbose ?? false;
199
195
  const all = flags.all ?? false;
200
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
201
- const assembled = await buildSearchBody("people", flags, readers);
196
+ const maxPages = readMaxPagesFlag(flags, out);
197
+ const assembled = await buildSearchBody("people", flags, readers, out);
202
198
  if ("error" in assembled) {
203
199
  out.stderr.write(`error: ${assembled.error}
204
200
  `);
@@ -240,8 +236,8 @@ async function runSearchCompanies(client, flags, out, readers = DEFAULT_FILTER_R
240
236
  const outOpts = resolveOutputOpts(flags);
241
237
  const verbose = flags.verbose ?? false;
242
238
  const all = flags.all ?? false;
243
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
244
- const assembled = await buildSearchBody("companies", flags, readers);
239
+ const maxPages = readMaxPagesFlag(flags, out);
240
+ const assembled = await buildSearchBody("companies", flags, readers, out);
245
241
  if ("error" in assembled) {
246
242
  out.stderr.write(`error: ${assembled.error}
247
243
  `);
@@ -283,8 +279,8 @@ async function runSearchPosts(client, flags, out, readers = DEFAULT_FILTER_READE
283
279
  const outOpts = resolveOutputOpts(flags);
284
280
  const verbose = flags.verbose ?? false;
285
281
  const all = flags.all ?? false;
286
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
287
- const assembled = await buildSearchBody("posts", flags, readers);
282
+ const maxPages = readMaxPagesFlag(flags, out);
283
+ const assembled = await buildSearchBody("posts", flags, readers, out);
288
284
  if ("error" in assembled) {
289
285
  out.stderr.write(`error: ${assembled.error}
290
286
  `);
@@ -326,8 +322,8 @@ async function runSearchJobs(client, flags, out, readers = DEFAULT_FILTER_READER
326
322
  const outOpts = resolveOutputOpts(flags);
327
323
  const verbose = flags.verbose ?? false;
328
324
  const all = flags.all ?? false;
329
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
330
- const assembled = await buildSearchBody("jobs", flags, readers);
325
+ const maxPages = readMaxPagesFlag(flags, out);
326
+ const assembled = await buildSearchBody("jobs", flags, readers, out);
331
327
  if ("error" in assembled) {
332
328
  out.stderr.write(`error: ${assembled.error}
333
329
  `);
@@ -376,13 +372,14 @@ async function runSearchParameters(client, flags, out) {
376
372
  const ns = client.account(accountId);
377
373
  const outOpts = resolveOutputOpts(flags);
378
374
  const all = flags.all ?? false;
379
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
375
+ const maxPages = readMaxPagesFlag(flags, out);
380
376
  const query = {
381
377
  type: flags.type,
382
378
  keywords: flags.keywords
383
379
  };
384
380
  if (flags.limit) query.limit = parseInt(flags.limit, 10);
385
- if (flags.cursor) query.cursor = flags.cursor;
381
+ const cursor = readCursorFlag(flags, out);
382
+ if (cursor) query.cursor = cursor;
386
383
  try {
387
384
  if (all) {
388
385
  const fn = (p) => ns.search.getParameters(p);
@@ -421,10 +418,11 @@ async function runSearchGroups(client, flags, out) {
421
418
  const ns = client.account(accountId);
422
419
  const outOpts = resolveOutputOpts(flags);
423
420
  const all = flags.all ?? false;
424
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
421
+ const maxPages = readMaxPagesFlag(flags, out);
425
422
  const query = { keywords };
426
423
  if (flags.limit) query.limit = parseInt(flags.limit, 10);
427
- if (flags.cursor) query.cursor = flags.cursor;
424
+ const cursor = readCursorFlag(flags, out);
425
+ if (cursor) query.cursor = cursor;
428
426
  try {
429
427
  if (all) {
430
428
  const fn = (p) => ns.search.groups(p);
@@ -458,7 +456,7 @@ async function runSearchServices(client, flags, out) {
458
456
  const ns = client.account(accountId);
459
457
  const outOpts = resolveOutputOpts(flags);
460
458
  const all = flags.all ?? false;
461
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
459
+ const maxPages = readMaxPagesFlag(flags, out);
462
460
  const body = {};
463
461
  if (flags.keywords) body["keywords"] = flags.keywords;
464
462
  if (flags["service-category"]) body["service_category"] = splitCsv(flags["service-category"]);
@@ -468,7 +466,8 @@ async function runSearchServices(client, flags, out) {
468
466
  }
469
467
  if (flags.language) body["language"] = splitCsv(flags.language);
470
468
  if (flags.limit) body["limit"] = parseInt(flags.limit, 10);
471
- if (flags.cursor) body["cursor"] = flags.cursor;
469
+ const cursor = readCursorFlag(flags, out);
470
+ if (cursor) body["cursor"] = cursor;
472
471
  try {
473
472
  if (all) {
474
473
  const fn = (p) => ns.search.services(p);
@@ -497,7 +496,7 @@ async function runSearchServices(client, flags, out) {
497
496
  }
498
497
  async function runSearchServiceParameters(client, flags, out) {
499
498
  rejectPreviewOnRead(flags.preview, out);
500
- rejectAllOnNonPaginated(flags.all, out);
499
+ rejectPaginationModifiersWithoutAll(flags, out);
501
500
  if (!flags.keywords) {
502
501
  out.stderr.write("error: --keywords is required.\n");
503
502
  process.exit(2);
@@ -505,11 +504,27 @@ async function runSearchServiceParameters(client, flags, out) {
505
504
  const accountId = await requireAccount(client, flags, out);
506
505
  const ns = client.account(accountId);
507
506
  const outOpts = resolveOutputOpts(flags);
507
+ const all = flags.all ?? false;
508
+ const maxPages = readMaxPagesFlag(flags, out);
508
509
  const query = { keywords: flags.keywords };
509
510
  if (flags.type) query.type = flags.type;
510
511
  if (flags.limit) query.limit = parseInt(flags.limit, 10);
512
+ const cursor = readCursorFlag(flags, out);
513
+ if (cursor) query.cursor = cursor;
511
514
  try {
515
+ if (all) {
516
+ const fn = (p) => ns.search.getServiceParameters(p);
517
+ for await (const item of streamAll(fn, query, {
518
+ maxPages,
519
+ out,
520
+ pageDelayMs: pageDelayFromFlags(flags)
521
+ })) {
522
+ writeNdjsonItem(out, item, outOpts.fields);
523
+ }
524
+ return;
525
+ }
512
526
  const result = await ns.search.getServiceParameters(query);
527
+ readablePage(result);
513
528
  renderSuccess(result, outOpts, out);
514
529
  } catch (err) {
515
530
  const { CurviateError } = await import("@curviate/sdk");
@@ -531,10 +546,11 @@ async function runSearchFromUrl(client, flags, out) {
531
546
  const outOpts = resolveOutputOpts(flags);
532
547
  const verbose = flags.verbose ?? false;
533
548
  const all = flags.all ?? false;
534
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
549
+ const maxPages = readMaxPagesFlag(flags, out);
535
550
  const body = { url };
536
551
  if (flags.limit) body.limit = parseInt(flags.limit, 10);
537
- if (flags.cursor) body.cursor = flags.cursor;
552
+ const cursor = readCursorFlag(flags, out);
553
+ if (cursor) body.cursor = cursor;
538
554
  try {
539
555
  if (all) {
540
556
  const fn = (p) => ns.search.fromUrl(p);
@@ -573,7 +589,7 @@ var searchPeopleCommand = defineCommand({
573
589
  "past-company": { type: "string", description: "Past company ids (comma-separated)." },
574
590
  school: { type: "string", description: "School ids (comma-separated)." },
575
591
  "network-distance": { type: "string", description: "Network distance, 1-3 (comma-separated)." },
576
- "connections-of": { type: "string", description: 'member id(s), comma-separated (resolve: `curviate search parameters --type CONNECTIONS --keywords "<name>"`)' },
592
+ "connections-of": { type: "string", description: 'member id(s), comma-separated (resolve: `curviate search parameters --type RELATION --keywords "<name>"`)' },
577
593
  "followers-of": { type: "string", description: 'member id(s), comma-separated (resolve: `curviate search parameters --type PEOPLE --keywords "<name>"`)' },
578
594
  // People-specific filter flags
579
595
  title: { type: "string", description: "Job title keyword filter (maps to advanced_keywords.title)." },
@@ -724,7 +740,7 @@ var searchParametersCommand = defineCommand({
724
740
  ...GLOBAL_FLAGS,
725
741
  type: {
726
742
  type: "string",
727
- description: "Parameter type: LOCATION, PEOPLE, CONNECTIONS, COMPANY, SCHOOL, INDUSTRY, SERVICE, JOB_FUNCTION, JOB_TITLE, EMPLOYMENT_TYPE, SKILL.",
743
+ description: "Parameter type: LOCATION, PEOPLE, RELATION, COMPANY, SCHOOL, INDUSTRY, SERVICE, JOB_FUNCTION, JOB_TITLE, EMPLOYMENT_TYPE, SKILL.",
728
744
  required: true
729
745
  },
730
746
  keywords: { type: "string", description: "Human term to resolve (required for every --type, incl. EMPLOYMENT_TYPE).", required: true }
@@ -805,10 +821,10 @@ var searchServicesCommand = defineCommand({
805
821
  var searchServiceParametersCommand = defineCommand({
806
822
  meta: {
807
823
  name: "service-parameters",
808
- description: "Resolve human-readable service-filter terms into the opaque ids 'search services' accepts."
824
+ description: "Resolve human-readable service-filter terms into the opaque ids 'search services' accepts. Paginated: --cursor pages manually, --all streams every page as NDJSON."
809
825
  },
810
826
  args: {
811
- ...NON_STREAM_FLAGS,
827
+ ...GLOBAL_FLAGS,
812
828
  type: {
813
829
  type: "string",
814
830
  description: "Filter type to resolve: service_category (default) or location."
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  readablePage,
7
7
  resolveEffectiveConfig
8
- } from "./chunk-7JU4IXXG.js";
8
+ } from "./chunk-CBHL3QQJ.js";
9
9
  import {
10
10
  getExitCode
11
11
  } from "./chunk-XZJQQJBE.js";
@@ -4,6 +4,9 @@ import {
4
4
  } from "./chunk-TCUYH5GO.js";
5
5
  import {
6
6
  pageDelayFromFlags,
7
+ readCursorFlag,
8
+ readMaxPagesFlag,
9
+ readableObject,
7
10
  readablePage,
8
11
  rejectPaginationModifiersWithoutAll,
9
12
  renderError,
@@ -12,7 +15,7 @@ import {
12
15
  resolveEffectiveConfig,
13
16
  streamAll,
14
17
  writeNdjsonItem
15
- } from "./chunk-7JU4IXXG.js";
18
+ } from "./chunk-CBHL3QQJ.js";
16
19
  import {
17
20
  createClient
18
21
  } from "./chunk-DCZR4M7G.js";
@@ -106,9 +109,9 @@ async function runWebhookList(client, flags, out) {
106
109
  rejectPaginationModifiersWithoutAll(flags, out);
107
110
  const outOpts = resolveOutputOpts(flags);
108
111
  const all = flags.all ?? false;
109
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
112
+ const maxPages = readMaxPagesFlag(flags, out);
110
113
  const limit = flags.limit ? parseInt(flags.limit, 10) : void 0;
111
- const cursor = flags.cursor;
114
+ const cursor = readCursorFlag(flags, out);
112
115
  const params = {};
113
116
  if (limit !== void 0) params["limit"] = limit;
114
117
  if (cursor) params["cursor"] = cursor;
@@ -137,6 +140,7 @@ async function runWebhookEvents(client, flags, out) {
137
140
  const outOpts = resolveOutputOpts(flags);
138
141
  try {
139
142
  const result = await client.webhooks.listEvents();
143
+ readableObject(result);
140
144
  renderSuccess(result, outOpts, out);
141
145
  } catch (err) {
142
146
  await handleError(err, outOpts, out);
@@ -148,6 +152,7 @@ async function runWebhookGet(client, flags, out) {
148
152
  const outOpts = resolveOutputOpts(flags);
149
153
  try {
150
154
  const result = await client.webhooks.get(id);
155
+ readableObject(result);
151
156
  renderSuccess(result, outOpts, out);
152
157
  } catch (err) {
153
158
  await handleError(err, outOpts, out);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curviate/cli",
3
- "version": "0.38.0",
3
+ "version": "0.41.0",
4
4
  "private": false,
5
5
  "description": "Official command-line interface for the Curviate API.",
6
6
  "license": "MIT",
@@ -46,7 +46,7 @@
46
46
  "clean": "rm -rf dist *.tsbuildinfo"
47
47
  },
48
48
  "dependencies": {
49
- "@curviate/sdk": "0.36.0",
49
+ "@curviate/sdk": "0.37.1",
50
50
  "citty": "^0.1.6",
51
51
  "open": "^10.1.0"
52
52
  },