@curviate/cli 0.14.0 → 0.15.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.
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-R3VLWLVV.js";
5
5
  import {
6
6
  streamAll
7
- } from "./chunk-GXTZION6.js";
7
+ } from "./chunk-DNTRQZBT.js";
8
8
  import {
9
9
  createClient,
10
10
  renderError,
@@ -47,7 +47,7 @@ function resolveOutputOpts(flags) {
47
47
  async function handleError(err, outOpts, out) {
48
48
  const { CurviateError } = await import("@curviate/sdk");
49
49
  if (err instanceof CurviateError) {
50
- const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
50
+ const { getExitCode } = await import("./exit-codes-SL3GQF7W.js");
51
51
  renderError(err, outOpts, out);
52
52
  process.exit(getExitCode(err.code));
53
53
  }
@@ -110,8 +110,7 @@ async function runWebhookList(client, flags, out) {
110
110
  const fn = (p) => client.webhooks.list(p);
111
111
  for await (const item of streamAll(fn, params, {
112
112
  maxPages,
113
- onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
114
- `)
113
+ out
115
114
  })) {
116
115
  out.stdout.write(JSON.stringify(item) + "\n");
117
116
  }
@@ -201,19 +200,6 @@ async function runWebhookDelete(client, flags, out) {
201
200
  await handleError(err, outOpts, out);
202
201
  }
203
202
  }
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
203
  async function runWebhookVerify(input, out) {
218
204
  const { constructEvent, WebhookSignatureError } = await import("@curviate/sdk");
219
205
  try {
@@ -389,29 +375,6 @@ var webhookDeleteCommand = defineCommand({
389
375
  await runWebhookDelete(client, flags, out);
390
376
  }
391
377
  });
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
378
  var webhookVerifyCommand = defineCommand({
416
379
  meta: { name: "verify", description: "Verify a webhook signature offline (no network call)." },
417
380
  args: {
@@ -460,12 +423,11 @@ var webhookCommand = defineCommand({
460
423
  get: webhookGetCommand,
461
424
  update: webhookUpdateCommand,
462
425
  delete: webhookDeleteCommand,
463
- "state-diff": webhookStateDiffCommand,
464
426
  verify: webhookVerifyCommand
465
427
  },
466
428
  async run() {
467
429
  process.stderr.write(
468
- "Usage: curviate webhook <subcommand>\n create | list | events | get | update | delete | state-diff | verify\n"
430
+ "Usage: curviate webhook <subcommand>\n create | list | events | get | update | delete | verify\n"
469
431
  );
470
432
  }
471
433
  });
@@ -475,7 +437,6 @@ export {
475
437
  runWebhookEvents,
476
438
  runWebhookGet,
477
439
  runWebhookList,
478
- runWebhookStateDiff,
479
440
  runWebhookUpdate,
480
441
  runWebhookVerify,
481
442
  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.0",
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,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
- };