@curviate/cli 0.13.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.
- package/CHANGELOG.md +116 -0
- package/README.md +52 -79
- package/dist/{account-7AUDAMIK.js → account-VB52GIUA.js} +34 -369
- package/dist/{chunk-SSPILTKF.js → chunk-45KHSWCV.js} +56 -48
- package/dist/chunk-BGZW6B7G.js +59 -0
- package/dist/{chunk-GXTZION6.js → chunk-DNTRQZBT.js} +13 -1
- package/dist/chunk-QJZ3LWOX.js +24 -0
- package/dist/{chunk-HMAGEMF7.js → chunk-ZE7QGR3F.js} +4 -0
- package/dist/cli.js +75 -12
- package/dist/comment-Y5IU42CR.js +550 -0
- package/dist/{company-RU2CA5DY.js → company-LGID3SK3.js} +21 -72
- package/dist/{connect-QT6ZOS75.js → connect-A7HEKKEE.js} +86 -43
- package/dist/{exit-codes-ZTY2NY3X.js → exit-codes-SL3GQF7W.js} +1 -1
- package/dist/{inbox-DN7X7CM2.js → inbox-44JRTJAP.js} +50 -122
- package/dist/job-TFTTCP5B.js +561 -0
- package/dist/{message-6K5E3CUF.js → message-FOJTDPW3.js} +47 -47
- package/dist/{post-2JQZ3OSF.js → post-FC6NZXM5.js} +177 -219
- package/dist/profile-I6YMVXSS.js +799 -0
- package/dist/{recruiter-XHVMQWK6.js → recruiter-BHT5OJD7.js} +731 -224
- package/dist/{sales-nav-QTSTJMKA.js → sales-nav-6IYKQ4TC.js} +109 -75
- package/dist/{search-ZGTS45BT.js → search-6C72M563.js} +95 -37
- package/dist/{webhook-XPWBI675.js → webhook-NSXEIU44.js} +36 -39
- package/package.json +4 -3
- package/dist/chunk-Q43HZUN3.js +0 -29
- package/dist/job-FGGQEXSU.js +0 -105
- package/dist/profile-DD5GMGNL.js +0 -501
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-R3VLWLVV.js";
|
|
5
5
|
import {
|
|
6
6
|
streamAll
|
|
7
|
-
} from "./chunk-
|
|
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-
|
|
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
|
-
|
|
114
|
-
`)
|
|
113
|
+
out
|
|
115
114
|
})) {
|
|
116
115
|
out.stdout.write(JSON.stringify(item) + "\n");
|
|
117
116
|
}
|
|
@@ -134,6 +133,17 @@ async function runWebhookEvents(client, flags, out) {
|
|
|
134
133
|
await handleError(err, outOpts, out);
|
|
135
134
|
}
|
|
136
135
|
}
|
|
136
|
+
async function runWebhookGet(client, flags, out) {
|
|
137
|
+
rejectPreviewOnRead(flags.preview, out);
|
|
138
|
+
const id = flags.id ?? "";
|
|
139
|
+
const outOpts = resolveOutputOpts(flags);
|
|
140
|
+
try {
|
|
141
|
+
const result = await client.webhooks.get(id);
|
|
142
|
+
renderSuccess(result, outOpts, out);
|
|
143
|
+
} catch (err) {
|
|
144
|
+
await handleError(err, outOpts, out);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
137
147
|
async function runWebhookUpdate(client, flags, out) {
|
|
138
148
|
if (flags.source !== void 0) {
|
|
139
149
|
out.stderr.write("error: --source cannot be changed after creation (source is immutable).\n");
|
|
@@ -190,19 +200,6 @@ async function runWebhookDelete(client, flags, out) {
|
|
|
190
200
|
await handleError(err, outOpts, out);
|
|
191
201
|
}
|
|
192
202
|
}
|
|
193
|
-
async function runWebhookStateDiff(client, flags, out) {
|
|
194
|
-
rejectPreviewOnRead(flags.preview, out);
|
|
195
|
-
const accountId = flags["account-id"] ?? "";
|
|
196
|
-
const outOpts = resolveOutputOpts(flags);
|
|
197
|
-
const query = {};
|
|
198
|
-
if (flags.cursor) query["cursor"] = flags.cursor;
|
|
199
|
-
try {
|
|
200
|
-
const result = await client.webhooks.getStateDiff(accountId, query);
|
|
201
|
-
renderSuccess(result, outOpts, out);
|
|
202
|
-
} catch (err) {
|
|
203
|
-
await handleError(err, outOpts, out);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
203
|
async function runWebhookVerify(input, out) {
|
|
207
204
|
const { constructEvent, WebhookSignatureError } = await import("@curviate/sdk");
|
|
208
205
|
try {
|
|
@@ -302,18 +299,11 @@ var webhookEventsCommand = defineCommand({
|
|
|
302
299
|
await runWebhookEvents(client, flags, out);
|
|
303
300
|
}
|
|
304
301
|
});
|
|
305
|
-
var
|
|
306
|
-
meta: { name: "
|
|
302
|
+
var webhookGetCommand = defineCommand({
|
|
303
|
+
meta: { name: "get", description: "Get a single webhook owned by the calling tenant." },
|
|
307
304
|
args: {
|
|
308
305
|
...GLOBAL_FLAGS,
|
|
309
|
-
id: { type: "positional", description: "Webhook id (wh_\u2026)." }
|
|
310
|
-
"request-url": { type: "string", description: "Replace the delivery URL." },
|
|
311
|
-
name: { type: "string", description: "Replace the name (or clear with empty string)." },
|
|
312
|
-
enabled: { type: "boolean", description: "Enable or disable the webhook." },
|
|
313
|
-
format: { type: "string", description: "Replace the delivery encoding: json | form." },
|
|
314
|
-
events: { type: "string", description: "Replace subscribed events (comma-separated)." },
|
|
315
|
-
data: { type: "string", description: "Replace field-remapping keys (comma-separated)." },
|
|
316
|
-
"account-ids": { type: "string", description: "Replace targeted accounts (comma-separated)." }
|
|
306
|
+
id: { type: "positional", description: "Webhook id (wh_\u2026)." }
|
|
317
307
|
},
|
|
318
308
|
async run({ args }) {
|
|
319
309
|
const flags = args;
|
|
@@ -329,14 +319,21 @@ var webhookUpdateCommand = defineCommand({
|
|
|
329
319
|
}
|
|
330
320
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
331
321
|
const out = buildOutputStreams();
|
|
332
|
-
await
|
|
322
|
+
await runWebhookGet(client, flags, out);
|
|
333
323
|
}
|
|
334
324
|
});
|
|
335
|
-
var
|
|
336
|
-
meta: { name: "
|
|
325
|
+
var webhookUpdateCommand = defineCommand({
|
|
326
|
+
meta: { name: "update", description: "Update a webhook in place (source is immutable)." },
|
|
337
327
|
args: {
|
|
338
328
|
...GLOBAL_FLAGS,
|
|
339
|
-
id: { type: "positional", description: "Webhook id (wh_\u2026)." }
|
|
329
|
+
id: { type: "positional", description: "Webhook id (wh_\u2026)." },
|
|
330
|
+
"request-url": { type: "string", description: "Replace the delivery URL." },
|
|
331
|
+
name: { type: "string", description: "Replace the name (or clear with empty string)." },
|
|
332
|
+
enabled: { type: "boolean", description: "Enable or disable the webhook." },
|
|
333
|
+
format: { type: "string", description: "Replace the delivery encoding: json | form." },
|
|
334
|
+
events: { type: "string", description: "Replace subscribed events (comma-separated)." },
|
|
335
|
+
data: { type: "string", description: "Replace field-remapping keys (comma-separated)." },
|
|
336
|
+
"account-ids": { type: "string", description: "Replace targeted accounts (comma-separated)." }
|
|
340
337
|
},
|
|
341
338
|
async run({ args }) {
|
|
342
339
|
const flags = args;
|
|
@@ -352,14 +349,14 @@ var webhookDeleteCommand = defineCommand({
|
|
|
352
349
|
}
|
|
353
350
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
354
351
|
const out = buildOutputStreams();
|
|
355
|
-
await
|
|
352
|
+
await runWebhookUpdate(client, flags, out);
|
|
356
353
|
}
|
|
357
354
|
});
|
|
358
|
-
var
|
|
359
|
-
meta: { name: "
|
|
355
|
+
var webhookDeleteCommand = defineCommand({
|
|
356
|
+
meta: { name: "delete", description: "Permanently remove a webhook subscription." },
|
|
360
357
|
args: {
|
|
361
358
|
...GLOBAL_FLAGS,
|
|
362
|
-
|
|
359
|
+
id: { type: "positional", description: "Webhook id (wh_\u2026)." }
|
|
363
360
|
},
|
|
364
361
|
async run({ args }) {
|
|
365
362
|
const flags = args;
|
|
@@ -375,7 +372,7 @@ var webhookStateDiffCommand = defineCommand({
|
|
|
375
372
|
}
|
|
376
373
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
377
374
|
const out = buildOutputStreams();
|
|
378
|
-
await
|
|
375
|
+
await runWebhookDelete(client, flags, out);
|
|
379
376
|
}
|
|
380
377
|
});
|
|
381
378
|
var webhookVerifyCommand = defineCommand({
|
|
@@ -423,14 +420,14 @@ var webhookCommand = defineCommand({
|
|
|
423
420
|
create: webhookCreateCommand,
|
|
424
421
|
list: webhookListCommand,
|
|
425
422
|
events: webhookEventsCommand,
|
|
423
|
+
get: webhookGetCommand,
|
|
426
424
|
update: webhookUpdateCommand,
|
|
427
425
|
delete: webhookDeleteCommand,
|
|
428
|
-
"state-diff": webhookStateDiffCommand,
|
|
429
426
|
verify: webhookVerifyCommand
|
|
430
427
|
},
|
|
431
428
|
async run() {
|
|
432
429
|
process.stderr.write(
|
|
433
|
-
"Usage: curviate webhook <subcommand>\n create | list | events |
|
|
430
|
+
"Usage: curviate webhook <subcommand>\n create | list | events | get | update | delete | verify\n"
|
|
434
431
|
);
|
|
435
432
|
}
|
|
436
433
|
});
|
|
@@ -438,8 +435,8 @@ export {
|
|
|
438
435
|
runWebhookCreate,
|
|
439
436
|
runWebhookDelete,
|
|
440
437
|
runWebhookEvents,
|
|
438
|
+
runWebhookGet,
|
|
441
439
|
runWebhookList,
|
|
442
|
-
runWebhookStateDiff,
|
|
443
440
|
runWebhookUpdate,
|
|
444
441
|
runWebhookVerify,
|
|
445
442
|
webhookCommand
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@curviate/cli",
|
|
3
|
-
"version": "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.
|
|
44
|
+
"@curviate/sdk": "^0.15.0",
|
|
44
45
|
"citty": "^0.1.6",
|
|
45
46
|
"open": "^10.1.0"
|
|
46
47
|
},
|
package/dist/chunk-Q43HZUN3.js
DELETED
|
@@ -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
|
-
};
|
package/dist/job-FGGQEXSU.js
DELETED
|
@@ -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
|
-
};
|