@curviate/cli 0.46.1 → 0.48.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 +199 -1
- package/README.md +124 -77
- package/dist/{account-O5UX5UAH.js → account-WKQHMM7P.js} +41 -31
- package/dist/{chunk-BGZW6B7G.js → chunk-5I6JJJIV.js} +1 -0
- package/dist/{chunk-76E3O6HY.js → chunk-76SWLAZ6.js} +13 -0
- package/dist/chunk-AYKKXGTR.js +1141 -0
- package/dist/{chunk-TC4ZPUWI.js → chunk-CVMSQ3OF.js} +19 -80
- package/dist/{chunk-HOQ7EUHJ.js → chunk-FDJMAF7D.js} +1 -0
- package/dist/chunk-GQKC6E5K.js +36 -0
- package/dist/{chunk-FXF5FF3W.js → chunk-MKGVNDMJ.js} +10 -2
- package/dist/chunk-NNV2OYEF.js +23 -0
- package/dist/{chunk-UJOTQPL6.js → chunk-OHXYFICP.js} +47 -14
- package/dist/{chunk-2FECYCAC.js → chunk-Q63IIPL2.js} +3 -3
- package/dist/chunk-TSOIZBBU.js +41 -0
- package/dist/{chunk-DGIDAO2H.js → chunk-Y7K4UBFC.js} +1 -1
- package/dist/{chunk-LD6WPZZM.js → chunk-YFXLXION.js} +39 -34
- package/dist/chunk-ZYURL5VK.js +83 -0
- package/dist/cli.js +77 -97
- package/dist/{comment-BKGVJYS2.js → comment-7IQ6ZOJF.js} +30 -25
- package/dist/{company-F2AZTDPK.js → company-RD7RDGSA.js} +58 -53
- package/dist/{config-K4G3VSBA.js → config-EYBNYRGK.js} +13 -5
- package/dist/{connect-TX6PT7NV.js → connect-HVXT67A6.js} +42 -38
- package/dist/core-6XYGUNAY.js +46 -0
- package/dist/{doctor-USTZQ75D.js → doctor-HUXQERLQ.js} +9 -5
- package/dist/document-AUUCGST2.js +27 -0
- package/dist/draft-DFO22K6Q.js +463 -0
- package/dist/examples-64YT5V5K.js +53 -0
- package/dist/{exit-codes-TMAIV7EM.js → exit-codes-AW6KHDDN.js} +1 -1
- package/dist/{feed-ANBPRGFQ.js → feed-JWP6ANPI.js} +15 -11
- package/dist/{group-HFF7LDDQ.js → group-SIQFJEZV.js} +17 -13
- package/dist/{inbox-XQMGW6RT.js → inbox-MMIMCA5O.js} +23 -19
- package/dist/{inboxes-CILMIVVD.js → inboxes-RND3D4C7.js} +18 -14
- package/dist/{job-TOJDDJ2P.js → job-ACFKBLFK.js} +31 -27
- package/dist/{login-OHAHNBRW.js → login-ZOB5KVKQ.js} +10 -5
- package/dist/{message-WCBNBPAJ.js → message-OFK6UVXR.js} +10 -8
- package/dist/{notification-CJ3LEHFL.js → notification-KKGAZU7M.js} +19 -15
- package/dist/{post-OQWJRL4B.js → post-A5SBCFB2.js} +36 -31
- package/dist/{profile-GT6ZD37M.js → profile-4SOOQZ4K.js} +52 -48
- package/dist/{recruiter-ZKWG6QG3.js → recruiter-YN73STDP.js} +125 -122
- package/dist/{sales-nav-WV3YHYD6.js → sales-nav-JXF5RY2K.js} +41 -35
- package/dist/{search-VAZEQ2WJ.js → search-JAL242A2.js} +68 -58
- package/dist/{setup-GGXMHXAF.js → setup-WICWH4JG.js} +14 -9
- package/dist/{webhook-5M47UX6U.js → webhook-UGKVYWBC.js} +40 -42
- package/package.json +2 -2
- package/dist/chunk-KJ24DIAJ.js +0 -60
- package/dist/examples-IJL3A6SZ.js +0 -18
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
intFlag
|
|
4
|
+
} from "./chunk-NNV2OYEF.js";
|
|
2
5
|
import {
|
|
3
6
|
buildPreviewOutput
|
|
4
7
|
} from "./chunk-TCUYH5GO.js";
|
|
@@ -15,22 +18,27 @@ import {
|
|
|
15
18
|
resolveEffectiveConfig,
|
|
16
19
|
streamAll,
|
|
17
20
|
writeNdjsonItem
|
|
18
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-MKGVNDMJ.js";
|
|
19
22
|
import {
|
|
20
23
|
createClient
|
|
21
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-OHXYFICP.js";
|
|
22
25
|
import {
|
|
23
26
|
GLOBAL_FLAGS,
|
|
24
27
|
READ_SINGLE_FLAGS,
|
|
25
28
|
WRITE_SINGLE_FLAGS,
|
|
26
|
-
defaultReadStdin,
|
|
27
|
-
isStdinToken,
|
|
28
29
|
readOnly
|
|
29
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-CVMSQ3OF.js";
|
|
31
|
+
import {
|
|
32
|
+
DESCRIPTIONS
|
|
33
|
+
} from "./chunk-GQKC6E5K.js";
|
|
34
|
+
import {
|
|
35
|
+
readFileFlag
|
|
36
|
+
} from "./chunk-AYKKXGTR.js";
|
|
37
|
+
import "./chunk-FDJMAF7D.js";
|
|
38
|
+
import "./chunk-ZYURL5VK.js";
|
|
30
39
|
|
|
31
40
|
// src/commands/webhook.ts
|
|
32
41
|
import { defineCommand } from "citty";
|
|
33
|
-
import { readFileSync } from "fs";
|
|
34
42
|
function rejectAllOnNonPaginated(all, out) {
|
|
35
43
|
if (all) {
|
|
36
44
|
out.stderr.write("error: --all is not supported on non-paginated commands.\n");
|
|
@@ -53,7 +61,7 @@ function resolveOutputOpts(flags) {
|
|
|
53
61
|
async function handleError(err, outOpts, out) {
|
|
54
62
|
const { CurviateError } = await import("@curviate/sdk");
|
|
55
63
|
if (err instanceof CurviateError) {
|
|
56
|
-
const { getExitCode } = await import("./exit-codes-
|
|
64
|
+
const { getExitCode } = await import("./exit-codes-AW6KHDDN.js");
|
|
57
65
|
renderError(err, outOpts, out);
|
|
58
66
|
process.exit(getExitCode(err));
|
|
59
67
|
}
|
|
@@ -62,7 +70,7 @@ async function handleError(err, outOpts, out) {
|
|
|
62
70
|
}
|
|
63
71
|
async function runWebhookCreate(client, flags, out) {
|
|
64
72
|
if (!flags.source) {
|
|
65
|
-
out.stderr.write("error: --source is required (messaging | user | account_status).\n");
|
|
73
|
+
out.stderr.write("error: --source is required (messaging | user | account_status | post).\n");
|
|
66
74
|
process.exit(2);
|
|
67
75
|
}
|
|
68
76
|
if (!flags["request-url"]) {
|
|
@@ -84,7 +92,7 @@ async function runWebhookCreate(client, flags, out) {
|
|
|
84
92
|
body["account_ids"] = accountIds;
|
|
85
93
|
} else if (flags.source !== "account_status") {
|
|
86
94
|
out.stderr.write(
|
|
87
|
-
"error: --account-ids is required when --source is messaging or
|
|
95
|
+
"error: --account-ids is required when --source is messaging, user or post (comma-separated acc_... ids). Only an account_status webhook may omit it.\n"
|
|
88
96
|
);
|
|
89
97
|
process.exit(2);
|
|
90
98
|
}
|
|
@@ -223,33 +231,12 @@ async function runWebhookDelete(client, flags, out) {
|
|
|
223
231
|
function stripTrailingNewlines(s) {
|
|
224
232
|
return s.replace(/(?:\r?\n)+$/, "");
|
|
225
233
|
}
|
|
226
|
-
async function resolveWebhookBody(raw,
|
|
234
|
+
async function resolveWebhookBody(raw, readStdin, others = {}) {
|
|
227
235
|
if (raw === void 0 || raw === "") {
|
|
228
|
-
|
|
229
|
-
"error: --body is required: pass the raw webhook body as inline JSON, as a path to a file containing it, or as - to read it from stdin.\n"
|
|
230
|
-
);
|
|
231
|
-
process.exit(2);
|
|
232
|
-
}
|
|
233
|
-
if (isStdinToken(raw)) {
|
|
234
|
-
const piped = stripTrailingNewlines(await readStdin());
|
|
235
|
-
if (!piped) {
|
|
236
|
-
out.stderr.write("error: --body -: stdin: empty input\n");
|
|
237
|
-
process.exit(2);
|
|
238
|
-
}
|
|
239
|
-
return piped;
|
|
240
|
-
}
|
|
241
|
-
if (raw.trimStart().startsWith("{")) return raw;
|
|
242
|
-
try {
|
|
243
|
-
return stripTrailingNewlines(readFileSync(raw, "utf8"));
|
|
244
|
-
} catch (err) {
|
|
245
|
-
const reason = err instanceof Error ? err.message : String(err);
|
|
246
|
-
out.stderr.write(
|
|
247
|
-
`error: --body: could not read ${raw}: ${reason}
|
|
248
|
-
--body accepts inline JSON, a path to a file containing the raw body, or - to read it from stdin.
|
|
249
|
-
`
|
|
250
|
-
);
|
|
236
|
+
process.stderr.write("error: --file is required: a path to the raw webhook body, or - to read it from stdin.\n");
|
|
251
237
|
process.exit(2);
|
|
252
238
|
}
|
|
239
|
+
return stripTrailingNewlines(await readFileFlag("file", raw, { readStdin, others }));
|
|
253
240
|
}
|
|
254
241
|
async function runWebhookVerify(input, out) {
|
|
255
242
|
const { constructEvent, WebhookSignatureError } = await import("@curviate/sdk");
|
|
@@ -289,14 +276,14 @@ var webhookCreateCommand = defineCommand({
|
|
|
289
276
|
"curviate webhook create --source account_status --request-url https://example.com/hooks/curviate --name status"
|
|
290
277
|
],
|
|
291
278
|
requires: [
|
|
292
|
-
"--account-ids for --source messaging and
|
|
279
|
+
"--account-ids for --source messaging, user and post; omit it with --source account_status to cover every current and future account."
|
|
293
280
|
]
|
|
294
281
|
},
|
|
295
282
|
args: {
|
|
296
283
|
...WRITE_SINGLE_FLAGS,
|
|
297
|
-
source: { type: "string", description: "Event source: messaging | user | account_status.", required: true },
|
|
284
|
+
source: { type: "string", description: "Event source: messaging | user | account_status | post (scheduled-post results: post.published, post.publish_failed).", required: true },
|
|
298
285
|
"request-url": { type: "string", description: "HTTPS URL to receive webhook deliveries.", required: true },
|
|
299
|
-
"account-ids": { type: "string", description: "Comma-separated account ids to target. Required for messaging and
|
|
286
|
+
"account-ids": { type: "string", description: "Comma-separated account ids to target. Required for messaging, user and post; omit on account_status to cover every current and future account." },
|
|
300
287
|
name: { type: "string", description: "Human-readable name (1-100 chars)." },
|
|
301
288
|
enabled: { type: "boolean", description: "Create as enabled (default: true).", default: true },
|
|
302
289
|
events: { type: "string", description: "Comma-separated event names to subscribe to." },
|
|
@@ -440,6 +427,17 @@ var webhookDeleteCommand = defineCommand({
|
|
|
440
427
|
meta: {
|
|
441
428
|
name: "delete",
|
|
442
429
|
description: "Permanently remove a webhook subscription.",
|
|
430
|
+
risk: "high",
|
|
431
|
+
rules: {
|
|
432
|
+
changes: "The webhook is deleted: no further event is delivered to its URL.",
|
|
433
|
+
visible_to: "Your endpoint, which stops receiving deliveries. Nothing reaches LinkedIn.",
|
|
434
|
+
budget_rows: [],
|
|
435
|
+
retry: "A retry after success answers RESOURCE_NOT_FOUND; read `curviate webhook list` first.",
|
|
436
|
+
undo: "Cannot be undone. Register a new one with `curviate webhook create`; it gets a new id and secret.",
|
|
437
|
+
blast_radius: "One webhook and every event it would have delivered."
|
|
438
|
+
},
|
|
439
|
+
errors: { RESOURCE_NOT_FOUND: "no webhook with this id." },
|
|
440
|
+
seeAlso: ["curviate webhook list", "curviate webhook create"],
|
|
443
441
|
examples: [
|
|
444
442
|
"curviate webhook delete wh_YOUR_WEBHOOK_ID"
|
|
445
443
|
]
|
|
@@ -470,7 +468,7 @@ var webhookVerifyCommand = defineCommand({
|
|
|
470
468
|
name: "verify",
|
|
471
469
|
description: "Verify a webhook signature offline (no network call). A valid signature prints the parsed event to stdout and exits 0; a mismatch prints a structured error to stdout, a summary to stderr, and exits 2.",
|
|
472
470
|
examples: [
|
|
473
|
-
'curviate webhook verify --secret "$CURVIATE_WEBHOOK_SECRET" --header "$SIGNATURE_HEADER" --
|
|
471
|
+
'curviate webhook verify --secret "$CURVIATE_WEBHOOK_SECRET" --header "$SIGNATURE_HEADER" --file payload.json'
|
|
474
472
|
]
|
|
475
473
|
},
|
|
476
474
|
// Offline: no profile, credential, transport or pagination flag applies.
|
|
@@ -486,10 +484,10 @@ var webhookVerifyCommand = defineCommand({
|
|
|
486
484
|
description: "The full Curviate-Signature header value from the delivery (t=...,v1=...).",
|
|
487
485
|
required: true
|
|
488
486
|
},
|
|
489
|
-
|
|
487
|
+
file: {
|
|
490
488
|
type: "string",
|
|
491
489
|
stdinArg: true,
|
|
492
|
-
description: "The raw webhook body
|
|
490
|
+
description: "The raw webhook body, byte for byte: a path to a file holding it, or - to read it from stdin.",
|
|
493
491
|
required: true
|
|
494
492
|
},
|
|
495
493
|
"max-age-secs": {
|
|
@@ -500,15 +498,15 @@ var webhookVerifyCommand = defineCommand({
|
|
|
500
498
|
async run({ args }) {
|
|
501
499
|
const flags = args;
|
|
502
500
|
const out = buildOutputStreams();
|
|
503
|
-
const rawBody = await resolveWebhookBody(flags.
|
|
501
|
+
const rawBody = await resolveWebhookBody(flags.file, void 0, flags);
|
|
504
502
|
const signatureHeader = flags.header ?? "";
|
|
505
503
|
const secret = flags.secret ?? "";
|
|
506
|
-
const replayWindowSecs = flags["max-age-secs"] ?
|
|
504
|
+
const replayWindowSecs = flags["max-age-secs"] === void 0 ? void 0 : intFlag("max-age-secs", flags["max-age-secs"]);
|
|
507
505
|
await runWebhookVerify({ secret, signatureHeader, rawBody, replayWindowSecs }, out);
|
|
508
506
|
}
|
|
509
507
|
});
|
|
510
508
|
var webhookCommand = defineCommand({
|
|
511
|
-
meta: { name: "webhook", description:
|
|
509
|
+
meta: { name: "webhook", description: DESCRIPTIONS.webhook },
|
|
512
510
|
subCommands: {
|
|
513
511
|
create: webhookCreateCommand,
|
|
514
512
|
list: webhookListCommand,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@curviate/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Official command-line interface for the Curviate API.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@curviate/sdk": "0.
|
|
50
|
+
"@curviate/sdk": "0.42.0",
|
|
51
51
|
"citty": "^0.1.6",
|
|
52
52
|
"open": "^10.1.0"
|
|
53
53
|
},
|
package/dist/chunk-KJ24DIAJ.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
isStdinToken
|
|
4
|
-
} from "./chunk-TC4ZPUWI.js";
|
|
5
|
-
|
|
6
|
-
// src/lib/search-filters.ts
|
|
7
|
-
import { readFile } from "fs/promises";
|
|
8
|
-
async function readStdin() {
|
|
9
|
-
const chunks = [];
|
|
10
|
-
for await (const chunk of process.stdin) {
|
|
11
|
-
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
12
|
-
}
|
|
13
|
-
return Buffer.concat(chunks).toString("utf8");
|
|
14
|
-
}
|
|
15
|
-
var DEFAULT_FILTER_READERS = {
|
|
16
|
-
readFile: (path) => readFile(path, "utf8"),
|
|
17
|
-
readStdin
|
|
18
|
-
};
|
|
19
|
-
async function assembleFilters(flags, readers = DEFAULT_FILTER_READERS) {
|
|
20
|
-
let raw;
|
|
21
|
-
let source;
|
|
22
|
-
if (flags["filters-file"] !== void 0) {
|
|
23
|
-
source = `--filters-file ${flags["filters-file"]}`;
|
|
24
|
-
try {
|
|
25
|
-
raw = await readers.readFile(flags["filters-file"]);
|
|
26
|
-
} catch {
|
|
27
|
-
return { error: `cannot read ${source}` };
|
|
28
|
-
}
|
|
29
|
-
} else if (isStdinToken(flags.filters)) {
|
|
30
|
-
source = "--filters - (stdin)";
|
|
31
|
-
raw = await readers.readStdin();
|
|
32
|
-
} else if (flags.filters !== void 0) {
|
|
33
|
-
source = "--filters";
|
|
34
|
-
raw = flags.filters;
|
|
35
|
-
}
|
|
36
|
-
if (raw === void 0) return { body: {} };
|
|
37
|
-
let parsed;
|
|
38
|
-
try {
|
|
39
|
-
parsed = JSON.parse(raw);
|
|
40
|
-
} catch {
|
|
41
|
-
return { error: `${source} is not valid JSON` };
|
|
42
|
-
}
|
|
43
|
-
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
44
|
-
return { error: `${source} must be a JSON object` };
|
|
45
|
-
}
|
|
46
|
-
return { body: parsed };
|
|
47
|
-
}
|
|
48
|
-
function splitCsv(value) {
|
|
49
|
-
return value.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
50
|
-
}
|
|
51
|
-
function splitCsvNumbers(value) {
|
|
52
|
-
return splitCsv(value).map((s) => Number(s)).filter((n) => Number.isFinite(n));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export {
|
|
56
|
-
DEFAULT_FILTER_READERS,
|
|
57
|
-
assembleFilters,
|
|
58
|
-
splitCsv,
|
|
59
|
-
splitCsvNumbers
|
|
60
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/lib/examples.ts
|
|
4
|
-
import { showUsage } from "citty";
|
|
5
|
-
async function showUsageWithExamples(cmd, parent) {
|
|
6
|
-
await showUsage(cmd, parent);
|
|
7
|
-
const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
|
|
8
|
-
const block = (title, lines = []) => lines.length ? process.stdout.write(`${title}
|
|
9
|
-
|
|
10
|
-
${lines.map((l) => ` ${l}`).join("\n")}
|
|
11
|
-
|
|
12
|
-
`) : void 0;
|
|
13
|
-
block("REQUIRES", meta?.requires);
|
|
14
|
-
block("EXAMPLES", meta?.examples);
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
showUsageWithExamples
|
|
18
|
-
};
|