@curviate/cli 0.14.0 → 0.15.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 (31) hide show
  1. package/CHANGELOG.md +161 -0
  2. package/README.md +52 -79
  3. package/dist/{account-7AUDAMIK.js → account-FM473HEK.js} +38 -371
  4. package/dist/{chunk-SSPILTKF.js → chunk-45KHSWCV.js} +56 -48
  5. package/dist/chunk-BGZW6B7G.js +59 -0
  6. package/dist/chunk-EEMJDJ4W.js +80 -0
  7. package/dist/{chunk-JXF47TRY.js → chunk-M33MI53G.js} +33 -1
  8. package/dist/chunk-QJZ3LWOX.js +24 -0
  9. package/dist/{chunk-4JHGVY7R.js → chunk-TMU3CSPR.js} +4 -0
  10. package/dist/{chunk-HMAGEMF7.js → chunk-ZE7QGR3F.js} +4 -0
  11. package/dist/cli.js +127 -15
  12. package/dist/comment-NCDXERSI.js +555 -0
  13. package/dist/{company-RU2CA5DY.js → company-IYTMW64G.js} +27 -74
  14. package/dist/{config-Q2AEWSEC.js → config-P5CPF5WC.js} +1 -1
  15. package/dist/{connect-QT6ZOS75.js → connect-TTJHMBUP.js} +91 -45
  16. package/dist/{exit-codes-ZTY2NY3X.js → exit-codes-SL3GQF7W.js} +1 -1
  17. package/dist/{inbox-DN7X7CM2.js → inbox-EOOGJ3ZN.js} +55 -124
  18. package/dist/job-YARGTHUY.js +631 -0
  19. package/dist/{login-BBVQLXM7.js → login-MFB45PVZ.js} +1 -1
  20. package/dist/{message-6K5E3CUF.js → message-2DLIQIE6.js} +61 -51
  21. package/dist/{post-2JQZ3OSF.js → post-GRIJ7X52.js} +188 -221
  22. package/dist/profile-57RJEL7H.js +809 -0
  23. package/dist/{recruiter-XHVMQWK6.js → recruiter-CTYH7AYG.js} +740 -226
  24. package/dist/{sales-nav-QTSTJMKA.js → sales-nav-NUMEYOEO.js} +119 -77
  25. package/dist/{search-ZGTS45BT.js → search-RD4TXNV7.js} +103 -39
  26. package/dist/{webhook-EIY5WWTE.js → webhook-CEP7SGP5.js} +8 -45
  27. package/package.json +4 -3
  28. package/dist/chunk-GXTZION6.js +0 -45
  29. package/dist/chunk-Q43HZUN3.js +0 -29
  30. package/dist/job-FGGQEXSU.js +0 -105
  31. package/dist/profile-DD5GMGNL.js +0 -501
@@ -3,18 +3,19 @@ import {
3
3
  buildPreviewOutput
4
4
  } from "./chunk-R3VLWLVV.js";
5
5
  import {
6
+ pageDelayFromFlags,
6
7
  streamAll
7
- } from "./chunk-GXTZION6.js";
8
+ } from "./chunk-EEMJDJ4W.js";
8
9
  import {
9
10
  createClient,
10
11
  renderError,
11
12
  renderSuccess,
12
13
  renderUnexpectedError,
13
14
  resolveEffectiveConfig
14
- } from "./chunk-JXF47TRY.js";
15
+ } from "./chunk-M33MI53G.js";
15
16
  import {
16
17
  GLOBAL_FLAGS
17
- } from "./chunk-4JHGVY7R.js";
18
+ } from "./chunk-TMU3CSPR.js";
18
19
 
19
20
  // src/commands/webhook.ts
20
21
  import { defineCommand } from "citty";
@@ -47,7 +48,7 @@ function resolveOutputOpts(flags) {
47
48
  async function handleError(err, outOpts, out) {
48
49
  const { CurviateError } = await import("@curviate/sdk");
49
50
  if (err instanceof CurviateError) {
50
- const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
51
+ const { getExitCode } = await import("./exit-codes-SL3GQF7W.js");
51
52
  renderError(err, outOpts, out);
52
53
  process.exit(getExitCode(err.code));
53
54
  }
@@ -110,8 +111,8 @@ async function runWebhookList(client, flags, out) {
110
111
  const fn = (p) => client.webhooks.list(p);
111
112
  for await (const item of streamAll(fn, params, {
112
113
  maxPages,
113
- onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
114
- `)
114
+ out,
115
+ pageDelayMs: pageDelayFromFlags(flags)
115
116
  })) {
116
117
  out.stdout.write(JSON.stringify(item) + "\n");
117
118
  }
@@ -201,19 +202,6 @@ async function runWebhookDelete(client, flags, out) {
201
202
  await handleError(err, outOpts, out);
202
203
  }
203
204
  }
204
- async function runWebhookStateDiff(client, flags, out) {
205
- rejectPreviewOnRead(flags.preview, out);
206
- const accountId = flags["account-id"] ?? "";
207
- const outOpts = resolveOutputOpts(flags);
208
- const query = {};
209
- if (flags.cursor) query["cursor"] = flags.cursor;
210
- try {
211
- const result = await client.webhooks.getStateDiff(accountId, query);
212
- renderSuccess(result, outOpts, out);
213
- } catch (err) {
214
- await handleError(err, outOpts, out);
215
- }
216
- }
217
205
  async function runWebhookVerify(input, out) {
218
206
  const { constructEvent, WebhookSignatureError } = await import("@curviate/sdk");
219
207
  try {
@@ -389,29 +377,6 @@ var webhookDeleteCommand = defineCommand({
389
377
  await runWebhookDelete(client, flags, out);
390
378
  }
391
379
  });
392
- var webhookStateDiffCommand = defineCommand({
393
- meta: { name: "state-diff", description: "Get the set of changes for an account since the last known version." },
394
- args: {
395
- ...GLOBAL_FLAGS,
396
- "account-id": { type: "positional", description: "Account id (acc_\u2026)." }
397
- },
398
- async run({ args }) {
399
- const flags = args;
400
- const cfg = await resolveEffectiveConfig({
401
- apiKey: flags["api-key"],
402
- baseUrl: flags["base-url"],
403
- timeout: flags.timeout,
404
- profile: flags.profile
405
- });
406
- if (!cfg.apiKey) {
407
- process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
408
- process.exit(3);
409
- }
410
- const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
411
- const out = buildOutputStreams();
412
- await runWebhookStateDiff(client, flags, out);
413
- }
414
- });
415
380
  var webhookVerifyCommand = defineCommand({
416
381
  meta: { name: "verify", description: "Verify a webhook signature offline (no network call)." },
417
382
  args: {
@@ -460,12 +425,11 @@ var webhookCommand = defineCommand({
460
425
  get: webhookGetCommand,
461
426
  update: webhookUpdateCommand,
462
427
  delete: webhookDeleteCommand,
463
- "state-diff": webhookStateDiffCommand,
464
428
  verify: webhookVerifyCommand
465
429
  },
466
430
  async run() {
467
431
  process.stderr.write(
468
- "Usage: curviate webhook <subcommand>\n create | list | events | get | update | delete | state-diff | verify\n"
432
+ "Usage: curviate webhook <subcommand>\n create | list | events | get | update | delete | verify\n"
469
433
  );
470
434
  }
471
435
  });
@@ -475,7 +439,6 @@ export {
475
439
  runWebhookEvents,
476
440
  runWebhookGet,
477
441
  runWebhookList,
478
- runWebhookStateDiff,
479
442
  runWebhookUpdate,
480
443
  runWebhookVerify,
481
444
  webhookCommand
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curviate/cli",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "private": false,
5
5
  "description": "Official command-line interface for the Curviate API.",
6
6
  "license": "MIT",
@@ -30,17 +30,18 @@
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsup",
33
- "prepack": "node scripts/check-clean.mjs && tsup",
33
+ "prepack": "node scripts/check-clean.mjs && tsup && node scripts/check-clean.mjs --dist",
34
34
  "test": "vitest run",
35
35
  "test:watch": "vitest",
36
36
  "typecheck": "tsc --noEmit",
37
37
  "lint": "eslint src test",
38
38
  "check:clean": "node scripts/check-clean.mjs",
39
+ "check:clean:dist": "node scripts/check-clean.mjs --dist",
39
40
  "verify:dist": "pnpm build && node scripts/verify-dist.mjs",
40
41
  "clean": "rm -rf dist *.tsbuildinfo"
41
42
  },
42
43
  "dependencies": {
43
- "@curviate/sdk": "^0.14.0",
44
+ "@curviate/sdk": "^0.15.0",
44
45
  "citty": "^0.1.6",
45
46
  "open": "^10.1.0"
46
47
  },
@@ -1,45 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/lib/paginate.ts
4
- var PaginateError = class extends Error {
5
- constructor(message) {
6
- super(message);
7
- this.exitCode = 2;
8
- this.name = "PaginateError";
9
- }
10
- };
11
- async function* streamAll(fn, params, opts = {}) {
12
- const maxPages = opts.maxPages ?? 100;
13
- let cursor = void 0;
14
- let pageCount = 0;
15
- let firstPage = true;
16
- while (true) {
17
- const pageParams = cursor !== void 0 && cursor !== null ? { ...params, cursor } : params;
18
- const page = await fn(pageParams);
19
- pageCount++;
20
- const items = page.items ?? page.data;
21
- if (firstPage && !Array.isArray(items)) {
22
- throw new PaginateError(
23
- "--all requires a paginated method (response must have `items` or `data` array). Remove --all for non-list commands."
24
- );
25
- }
26
- firstPage = false;
27
- if (Array.isArray(items)) {
28
- for (const item of items) {
29
- yield item;
30
- }
31
- }
32
- cursor = page.cursor;
33
- if (!cursor) break;
34
- if (pageCount >= maxPages) {
35
- if (opts.onTruncated) {
36
- opts.onTruncated(pageCount, cursor !== null && cursor !== void 0);
37
- }
38
- break;
39
- }
40
- }
41
- }
42
-
43
- export {
44
- streamAll
45
- };
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/lib/attach.ts
4
- import { readFile } from "fs/promises";
5
- import { basename } from "path";
6
- var AttachError = class extends Error {
7
- constructor(message) {
8
- super(message);
9
- this.exitCode = 2;
10
- this.name = "AttachError";
11
- }
12
- };
13
- async function readAttachment(filePath) {
14
- try {
15
- const buf = await readFile(filePath);
16
- return buf;
17
- } catch (err) {
18
- const filename = basename(filePath);
19
- const reason = err instanceof Error ? err.message : "unknown error";
20
- throw new AttachError(
21
- `Cannot read attachment "${filename}": ${reason}. Pass a valid file path.`
22
- );
23
- }
24
- }
25
-
26
- export {
27
- AttachError,
28
- readAttachment
29
- };
@@ -1,105 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- slimJob
4
- } from "./chunk-SSPILTKF.js";
5
- import {
6
- resolveJobIdentifier
7
- } from "./chunk-DMQZEPQE.js";
8
- import {
9
- createClient,
10
- renderError,
11
- renderSuccess,
12
- renderUnexpectedError,
13
- resolveEffectiveConfig
14
- } from "./chunk-JXF47TRY.js";
15
- import {
16
- READ_SINGLE_FLAGS
17
- } from "./chunk-4JHGVY7R.js";
18
-
19
- // src/commands/job.ts
20
- import { defineCommand } from "citty";
21
- function buildOutputStreams() {
22
- return {
23
- stdout: { write: (s) => process.stdout.write(s) },
24
- stderr: { write: (s) => process.stderr.write(s) }
25
- };
26
- }
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
- function resolveOutputOpts(flags) {
35
- return {
36
- json: (flags.json ?? false) || !process.stdout.isTTY,
37
- isTTY: process.stdout.isTTY ?? false,
38
- fields: flags.fields,
39
- verbose: flags.verbose ?? false
40
- };
41
- }
42
- async function runJobGet(client, flags, out) {
43
- if (flags.preview) {
44
- out.stderr.write("error: --preview is only valid on write commands (mutations). Reads just run.\n");
45
- process.exit(2);
46
- }
47
- const accountId = requireAccount(flags.account, out);
48
- const rawId = flags.id ?? "";
49
- const resolvedId = resolveJobIdentifier(rawId);
50
- const ns = client.account(accountId);
51
- const outOpts = resolveOutputOpts(flags);
52
- try {
53
- const result = await ns.jobs.get(resolvedId);
54
- renderSuccess(result, { ...outOpts, slim: slimJob }, out);
55
- } catch (err) {
56
- const { CurviateError } = await import("@curviate/sdk");
57
- if (err instanceof CurviateError) {
58
- const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
59
- renderError(err, outOpts, out);
60
- process.exit(getExitCode(err.code));
61
- }
62
- renderUnexpectedError(err, out);
63
- process.exit(1);
64
- }
65
- }
66
- var jobGetCommand = defineCommand({
67
- meta: { name: "get", description: "Retrieve one public LinkedIn job posting's full detail." },
68
- args: {
69
- ...READ_SINGLE_FLAGS,
70
- id: { type: "positional", description: "Job URL (e.g. https://www.linkedin.com/jobs/view/4428113858) or a bare numeric job id." }
71
- },
72
- async run({ args }) {
73
- const flags = args;
74
- const cfg = await resolveEffectiveConfig({
75
- apiKey: flags["api-key"],
76
- baseUrl: flags["base-url"],
77
- timeout: flags.timeout,
78
- account: flags.account,
79
- profile: flags.profile
80
- });
81
- if (!cfg.apiKey) {
82
- process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
83
- process.exit(3);
84
- }
85
- const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
86
- const out = buildOutputStreams();
87
- await runJobGet(client, { ...flags, account: flags.account ?? cfg.account }, out);
88
- }
89
- });
90
- var jobCommand = defineCommand({
91
- meta: { name: "job", description: "Public LinkedIn job posting operations." },
92
- args: { ...READ_SINGLE_FLAGS },
93
- subCommands: {
94
- get: jobGetCommand
95
- },
96
- async run() {
97
- process.stderr.write(
98
- "Usage: curviate job get <url|id>\n"
99
- );
100
- }
101
- });
102
- export {
103
- jobCommand,
104
- runJobGet
105
- };