@curviate/cli 0.48.0 → 0.50.0-next.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 (70) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +47 -6
  3. package/dist/{account-WKQHMM7P.js → account-KGCGUYKF.js} +668 -116
  4. package/dist/analytics-HRAD4ABO.js +27 -0
  5. package/dist/beta-consent-364JI6IL.js +81 -0
  6. package/dist/billing-3SSVRS2Y.js +124 -0
  7. package/dist/{chunk-Q63IIPL2.js → chunk-25MO7BYN.js} +4 -4
  8. package/dist/{chunk-76SWLAZ6.js → chunk-2W4RN5ON.js} +59 -1
  9. package/dist/chunk-5S3MJVI5.js +22 -0
  10. package/dist/chunk-67S4JHZZ.js +339 -0
  11. package/dist/chunk-73DJ3KNE.js +54 -0
  12. package/dist/chunk-CQGDMARG.js +525 -0
  13. package/dist/{chunk-Y7K4UBFC.js → chunk-DOHBOYXN.js} +1 -1
  14. package/dist/{chunk-TSOIZBBU.js → chunk-DSGKYZDK.js} +1 -1
  15. package/dist/{chunk-YLSJ4HKU.js → chunk-ENBIMEKS.js} +26 -1
  16. package/dist/{chunk-LCGXJGPB.js → chunk-GHMRPX5H.js} +7 -1
  17. package/dist/chunk-GOICALYQ.js +28 -0
  18. package/dist/chunk-L4CIJT6F.js +144 -0
  19. package/dist/{chunk-PQWDDSV7.js → chunk-L7JH3W56.js} +1 -1
  20. package/dist/{chunk-YFXLXION.js → chunk-OE6YFYUM.js} +85 -10
  21. package/dist/chunk-PPGKQJKU.js +38 -0
  22. package/dist/{chunk-MKGVNDMJ.js → chunk-QM57YDJE.js} +13 -201
  23. package/dist/{chunk-CVMSQ3OF.js → chunk-RYWWSZUH.js} +17 -3
  24. package/dist/chunk-T6GBS5SS.js +58 -0
  25. package/dist/{chunk-AYKKXGTR.js → chunk-TE3WBPW6.js} +392 -14
  26. package/dist/chunk-UL53T4O6.js +52 -0
  27. package/dist/chunk-UWQPX4AE.js +20 -0
  28. package/dist/{chunk-OHXYFICP.js → chunk-YXVF5UST.js} +77 -4
  29. package/dist/cli.js +35 -17
  30. package/dist/{comment-7IQ6ZOJF.js → comment-5JKGNYOY.js} +90 -11
  31. package/dist/{company-RD7RDGSA.js → company-TXST2VXW.js} +65 -15
  32. package/dist/{config-EYBNYRGK.js → config-TVIQUVNK.js} +53 -4
  33. package/dist/{connect-HVXT67A6.js → connect-RBL6U4KV.js} +63 -18
  34. package/dist/contact-YAHC5QFX.js +32 -0
  35. package/dist/contact-groups-DKOIBC57.js +399 -0
  36. package/dist/contact-import-ITSJQV7K.js +336 -0
  37. package/dist/core-PWMJPPRG.js +46 -0
  38. package/dist/do-not-contact-WDYIBWYA.js +200 -0
  39. package/dist/{doctor-HUXQERLQ.js → doctor-F7JLPTED.js} +65 -11
  40. package/dist/{document-AUUCGST2.js → document-BHYAUJ6F.js} +1 -1
  41. package/dist/{draft-DFO22K6Q.js → draft-TDJJUXLH.js} +60 -14
  42. package/dist/enrollment-Q6UOKHPY.js +484 -0
  43. package/dist/{examples-64YT5V5K.js → examples-DQSVIIXZ.js} +2 -2
  44. package/dist/{exit-codes-AW6KHDDN.js → exit-codes-7DBETBDT.js} +1 -1
  45. package/dist/export-HIJSCJS6.js +96 -0
  46. package/dist/{feed-JWP6ANPI.js → feed-W56ZTA4Z.js} +13 -10
  47. package/dist/{group-SIQFJEZV.js → group-AUALYK5H.js} +18 -10
  48. package/dist/{inbox-MMIMCA5O.js → inbox-HLZR2ZPV.js} +31 -12
  49. package/dist/{inboxes-RND3D4C7.js → inboxes-IZTRD6FE.js} +14 -10
  50. package/dist/incoming-ULB2RNV4.js +218 -0
  51. package/dist/{job-ACFKBLFK.js → job-55IKS6LP.js} +65 -13
  52. package/dist/{login-ZOB5KVKQ.js → login-DPZ6CXNO.js} +13 -4
  53. package/dist/{message-OFK6UVXR.js → message-J44YKRDS.js} +9 -7
  54. package/dist/motion-SQI5F2EK.js +868 -0
  55. package/dist/network-K4QD7APQ.js +235 -0
  56. package/dist/{notification-KKGAZU7M.js → notification-SEDXZHXO.js} +38 -11
  57. package/dist/notifications-HGIBRUNQ.js +231 -0
  58. package/dist/{post-A5SBCFB2.js → post-L467SKIG.js} +92 -12
  59. package/dist/{profile-4SOOQZ4K.js → profile-A2N6RMR2.js} +79 -23
  60. package/dist/{recruiter-YN73STDP.js → recruiter-AR75RHBO.js} +132 -21
  61. package/dist/{sales-nav-JXF5RY2K.js → sales-nav-C2AYFXPV.js} +73 -18
  62. package/dist/{search-JAL242A2.js → search-Z4DZIG4X.js} +55 -23
  63. package/dist/{setup-WICWH4JG.js → setup-45BEVX6B.js} +69 -17
  64. package/dist/team-6QWY4IFP.js +450 -0
  65. package/dist/tier-2HS3BXDF.js +61 -0
  66. package/dist/unibox-DHUKG65Z.js +402 -0
  67. package/dist/{webhook-UGKVYWBC.js → webhook-Q53WUAI2.js} +273 -45
  68. package/package.json +2 -2
  69. package/dist/chunk-GQKC6E5K.js +0 -36
  70. package/dist/core-6XYGUNAY.js +0 -46
@@ -1,10 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- intFlag
4
- } from "./chunk-NNV2OYEF.js";
3
+ fail,
4
+ listFlag,
5
+ outputOpts,
6
+ rootClient,
7
+ usage
8
+ } from "./chunk-T6GBS5SS.js";
5
9
  import {
6
10
  buildPreviewOutput
7
11
  } from "./chunk-TCUYH5GO.js";
12
+ import {
13
+ intFlag
14
+ } from "./chunk-NNV2OYEF.js";
8
15
  import {
9
16
  pageDelayFromFlags,
10
17
  readCursorFlag,
@@ -12,33 +19,224 @@ import {
12
19
  readableObject,
13
20
  readablePage,
14
21
  rejectPaginationModifiersWithoutAll,
22
+ streamAll
23
+ } from "./chunk-L4CIJT6F.js";
24
+ import {
15
25
  renderError,
16
26
  renderSuccess,
17
27
  renderUnexpectedError,
18
- resolveEffectiveConfig,
19
- streamAll,
20
28
  writeNdjsonItem
21
- } from "./chunk-MKGVNDMJ.js";
29
+ } from "./chunk-QM57YDJE.js";
22
30
  import {
23
- createClient
24
- } from "./chunk-OHXYFICP.js";
31
+ createClient,
32
+ resolveEffectiveConfig
33
+ } from "./chunk-YXVF5UST.js";
25
34
  import {
26
35
  GLOBAL_FLAGS,
27
36
  READ_SINGLE_FLAGS,
28
37
  WRITE_SINGLE_FLAGS,
29
38
  readOnly
30
- } from "./chunk-CVMSQ3OF.js";
39
+ } from "./chunk-RYWWSZUH.js";
31
40
  import {
32
41
  DESCRIPTIONS
33
- } from "./chunk-GQKC6E5K.js";
42
+ } from "./chunk-73DJ3KNE.js";
34
43
  import {
35
44
  readFileFlag
36
- } from "./chunk-AYKKXGTR.js";
45
+ } from "./chunk-TE3WBPW6.js";
37
46
  import "./chunk-FDJMAF7D.js";
38
- import "./chunk-ZYURL5VK.js";
47
+ import {
48
+ isStdinToken
49
+ } from "./chunk-ZYURL5VK.js";
39
50
 
40
- // src/commands/webhook.ts
51
+ // src/commands/webhook-ops.ts
41
52
  import { defineCommand } from "citty";
53
+ var SOURCES = ["messaging", "user", "account_status", "post", "motion"];
54
+ async function deliveryFields(f) {
55
+ const body = {};
56
+ if (f["template-file"] !== void 0) body["body_template"] = await readFileFlag("template-file", f["template-file"], { others: f });
57
+ if (f["custom-events"] !== void 0) body["custom_event_names"] = listFlag("custom-events", f["custom-events"]);
58
+ if (f.header !== void 0) {
59
+ body["headers"] = [].concat(f.header).map((h) => {
60
+ const i = h.indexOf(":");
61
+ const key = (i < 0 ? h : h.slice(0, i)).trim();
62
+ if (key === "") usage("--header takes KEY:VALUE, or KEY alone to keep its stored value.");
63
+ return i < 0 ? { key } : { key, value: h.slice(i + 1).trim() };
64
+ });
65
+ }
66
+ return body;
67
+ }
68
+ var DELIVERY_ARGS = {
69
+ "template-file": {
70
+ type: "string",
71
+ stdinArg: true,
72
+ description: "The delivery body as a JSON text with {{variables}} (`curviate webhook variables --source <source>`), from a path or - for stdin. Lint it offline first: `curviate webhook lint`."
73
+ },
74
+ "custom-events": { type: "string", description: "With motion.custom_event subscribed: deliver only these custom event names (comma list). Omit for every custom event." },
75
+ header: {
76
+ type: "string",
77
+ description: "A custom header on every delivery, KEY:VALUE; repeatable, replaces the whole set. KEY alone keeps that header's stored value (values are never read back). Not covered by the signature."
78
+ }
79
+ };
80
+ async function runLint(f) {
81
+ const source = f.source ?? "motion";
82
+ if (!SOURCES.includes(source)) usage(`--source takes ${SOURCES.join(", ")}.`);
83
+ if (f["template-file"] === void 0) usage("--template-file is required: a path, or - for stdin.");
84
+ const text = await readFileFlag("template-file", f["template-file"], { others: f });
85
+ const { validateWebhookTemplate } = await import("@curviate/sdk");
86
+ const { errors } = validateWebhookTemplate(text, { source });
87
+ const file = isStdinToken(f["template-file"]) ? "-" : f["template-file"];
88
+ for (const e of errors) process.stderr.write(`${file}:${e["line"]}:${e["col"]} error ${e["code"]}: ${e["rule"]}. ${e["hint"]} -> ${e["docs_url"]}
89
+ `);
90
+ const json = outputOpts(f).json;
91
+ if (errors.length) {
92
+ if (json) process.stdout.write(JSON.stringify({ error: { code: "WEBHOOK_TEMPLATE_INVALID", message: `The template has ${errors.length} error(s).`, errors } }) + "\n");
93
+ process.exit(2);
94
+ }
95
+ if (json) process.stdout.write(JSON.stringify({ errors: [] }) + "\n");
96
+ else process.stderr.write("The template passes the lint.\n");
97
+ }
98
+ async function runVariables(c, f) {
99
+ if (!f.source || !SOURCES.includes(f.source)) usage(`--source is required: one of ${SOURCES.join(", ")}.`);
100
+ try {
101
+ renderSuccess(await c.webhooks.variables({ source: f.source }), outputOpts(f), process);
102
+ } catch (err) {
103
+ await fail(err, f);
104
+ }
105
+ }
106
+ async function runDeliveries(c, f) {
107
+ const id = String(f.id ?? "");
108
+ try {
109
+ if (f.deliveryId !== void 0) return renderSuccess(await c.webhooks.deliveries.get(id, f.deliveryId), outputOpts(f), process);
110
+ rejectPaginationModifiersWithoutAll(f, process);
111
+ const q = {};
112
+ if (f.failed) q["failed"] = true;
113
+ if (f.limit !== void 0) q["limit"] = intFlag("limit", f.limit, 1, 100);
114
+ const cursor = readCursorFlag(f, process);
115
+ if (cursor) q["cursor"] = cursor;
116
+ if (f.all) {
117
+ const page = (p) => c.webhooks.deliveries.list(id, p);
118
+ for await (const item of streamAll(page, q, { maxPages: readMaxPagesFlag(f, process), out: process, pageDelayMs: pageDelayFromFlags(f) })) writeNdjsonItem(process, item, f.fields);
119
+ return;
120
+ }
121
+ renderSuccess(readablePage(await c.webhooks.deliveries.list(id, q)), outputOpts(f), process);
122
+ } catch (err) {
123
+ await fail(err, f);
124
+ }
125
+ }
126
+ var write = (method, call, args, body = () => ({})) => async (c, f) => {
127
+ if (f.preview) return void process.stdout.write(JSON.stringify(buildPreviewOutput({ method, args: args(f), body: body(f) })) + "\n");
128
+ try {
129
+ renderSuccess(await call(c, f), outputOpts(f), process);
130
+ } catch (err) {
131
+ await fail(err, f);
132
+ }
133
+ };
134
+ var online = (fn) => async ({ args }) => {
135
+ const f = args;
136
+ await fn(await rootClient(f), f);
137
+ };
138
+ var ID = { type: "positional", description: "Webhook id (wh_...)." };
139
+ var CREATOR = { INSUFFICIENT_ROLE: "only the webhook's creator can do this." };
140
+ var webhookLintCommand = defineCommand({
141
+ meta: {
142
+ name: "lint",
143
+ description: "Check a webhook body template offline, every finding at once, as `curviate webhook create` would answer it. Offline: no API call.",
144
+ risk: "read",
145
+ rules: { notes: ["Offline: no API call."] },
146
+ output: ['Findings on stderr, one per line: <file>:<line>:<col> error <code>: <rule>. <hint> -> <docs_url>. With --json (or piped) stdout carries the WEBHOOK_TEMPLATE_INVALID shape, or {"errors": []}. Exit 2 on any finding.'],
147
+ examples: ["curviate webhook lint --template-file body.json --source motion"]
148
+ },
149
+ args: {
150
+ json: GLOBAL_FLAGS.json,
151
+ "template-file": { ...DELIVERY_ARGS["template-file"], description: "The template, from a path or - for stdin." },
152
+ source: { type: "string", description: `The webhook's source, which decides the variables: ${SOURCES.join(", ")} (default motion).` }
153
+ },
154
+ run: async ({ args }) => runLint(args)
155
+ });
156
+ var webhookVariablesCommand = defineCommand({
157
+ meta: {
158
+ name: "variables",
159
+ description: "The {{variables}} a body template may use for a source, with their types and an example.",
160
+ risk: "read",
161
+ examples: ["curviate webhook variables --source motion"]
162
+ },
163
+ args: { ...readOnly(READ_SINGLE_FLAGS), source: { type: "string", description: `${SOURCES.join(", ")}.` } },
164
+ run: online(runVariables)
165
+ });
166
+ var webhookDeliveriesCommand = defineCommand({
167
+ meta: {
168
+ name: "deliveries",
169
+ description: "A webhook's deliveries, newest first: status, attempts, the response code and the next retry. With a delivery id: that one delivery.",
170
+ risk: "read",
171
+ examples: ["curviate webhook deliveries wh_YOUR_WEBHOOK_ID --failed", "curviate webhook deliveries wh_YOUR_WEBHOOK_ID YOUR_DELIVERY_ID"]
172
+ },
173
+ args: {
174
+ ...readOnly(GLOBAL_FLAGS),
175
+ id: ID,
176
+ deliveryId: { type: "positional", required: false, description: "One delivery's id, to read it alone." },
177
+ failed: { type: "boolean", description: "Only deliveries that failed." }
178
+ },
179
+ run: online(runDeliveries)
180
+ });
181
+ var webhookRedeliverCommand = defineCommand({
182
+ meta: {
183
+ name: "redeliver",
184
+ description: "Send one past delivery again, with the body it was rendered with and a fresh signature.",
185
+ risk: "write",
186
+ rules: {
187
+ changes: "Posts the delivery to the webhook's URL again.",
188
+ visible_to: "Your endpoint.",
189
+ budget_rows: [],
190
+ retry: "Each call posts again: your endpoint may record it twice.",
191
+ undo: "Cannot be undone."
192
+ },
193
+ errors: { DELIVERY_IN_FLIGHT: "the delivery is being sent right now; read it again shortly.", REDELIVERY_EXPIRED: "the delivery is too old to send again." },
194
+ examples: ["curviate webhook redeliver wh_YOUR_WEBHOOK_ID YOUR_DELIVERY_ID"]
195
+ },
196
+ args: { ...WRITE_SINGLE_FLAGS, id: ID, deliveryId: { type: "positional", description: "The delivery id, from `curviate webhook deliveries`." } },
197
+ run: online(write("webhooks.redeliver", (c, f) => c.webhooks.redeliver(String(f.id ?? ""), String(f.deliveryId ?? "")), (f) => ({ id: f.id, delivery_id: f.deliveryId })))
198
+ });
199
+ var webhookRotateCommand = defineCommand({
200
+ meta: {
201
+ name: "rotate",
202
+ description: "Issue a new signing secret, printed once. For a grace period every delivery carries both signatures (`v1=<new>,v1=<old>`), so a receiver on either secret keeps verifying; switch yours to the new one inside that period.",
203
+ risk: "high",
204
+ rules: {
205
+ changes: "A new signing secret; the old one stops signing when the grace period ends (at once on a second rotation inside it).",
206
+ visible_to: "Your endpoint, which must verify with the new secret before the grace period ends.",
207
+ budget_rows: [],
208
+ retry: "A second rotation drops the oldest secret at once.",
209
+ undo: "Cannot be undone: rotate again for another new secret.",
210
+ blast_radius: "One webhook's deliveries."
211
+ },
212
+ errors: CREATOR,
213
+ seeAlso: ["curviate webhook verify"],
214
+ examples: ["curviate webhook rotate wh_YOUR_WEBHOOK_ID"]
215
+ },
216
+ args: { ...WRITE_SINGLE_FLAGS, id: ID },
217
+ run: online(write("webhooks.rotateSecret", (c, f) => c.webhooks.rotateSecret(String(f.id ?? "")), (f) => ({ id: f.id })))
218
+ });
219
+ var webhookTestCommand = defineCommand({
220
+ meta: {
221
+ name: "test",
222
+ description: "Send a sample delivery of one event to the webhook's URL now, rendered through its template and signed like a real one (`data.test_event: true`).",
223
+ risk: "write",
224
+ rules: {
225
+ changes: "Posts one sample delivery to the webhook's URL.",
226
+ visible_to: "Your endpoint.",
227
+ budget_rows: [],
228
+ retry: "Each call sends another sample.",
229
+ undo: "Cannot be undone."
230
+ },
231
+ errors: { RESOURCE_NOT_FOUND: "no webhook with this id." },
232
+ examples: ["curviate webhook test wh_YOUR_WEBHOOK_ID", "curviate webhook test wh_YOUR_WEBHOOK_ID --event enrollment.finished"]
233
+ },
234
+ args: { ...WRITE_SINGLE_FLAGS, id: ID, event: { type: "string", description: "The event to sample (default: the first one subscribed)." } },
235
+ run: online(write("webhooks.test", (c, f) => c.webhooks.test(String(f.id ?? ""), f.event === void 0 ? {} : { event: f.event }), (f) => ({ id: f.id }), (f) => f.event === void 0 ? {} : { event: f.event }))
236
+ });
237
+
238
+ // src/commands/webhook.ts
239
+ import { defineCommand as defineCommand2 } from "citty";
42
240
  function rejectAllOnNonPaginated(all, out) {
43
241
  if (all) {
44
242
  out.stderr.write("error: --all is not supported on non-paginated commands.\n");
@@ -61,7 +259,7 @@ function resolveOutputOpts(flags) {
61
259
  async function handleError(err, outOpts, out) {
62
260
  const { CurviateError } = await import("@curviate/sdk");
63
261
  if (err instanceof CurviateError) {
64
- const { getExitCode } = await import("./exit-codes-AW6KHDDN.js");
262
+ const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
65
263
  renderError(err, outOpts, out);
66
264
  process.exit(getExitCode(err));
67
265
  }
@@ -70,7 +268,7 @@ async function handleError(err, outOpts, out) {
70
268
  }
71
269
  async function runWebhookCreate(client, flags, out) {
72
270
  if (!flags.source) {
73
- out.stderr.write("error: --source is required (messaging | user | account_status | post).\n");
271
+ out.stderr.write("error: --source is required (messaging | user | account_status | post | motion).\n");
74
272
  process.exit(2);
75
273
  }
76
274
  if (!flags["request-url"]) {
@@ -81,20 +279,15 @@ async function runWebhookCreate(client, flags, out) {
81
279
  source: flags.source,
82
280
  request_url: flags["request-url"]
83
281
  };
84
- if (flags["account-ids"] !== void 0) {
85
- const accountIds = flags["account-ids"].split(",").map((s) => s.trim()).filter(Boolean);
86
- if (accountIds.length === 0) {
87
- out.stderr.write(
88
- "error: --account-ids was given an empty value. Pass acc_... ids, or omit the flag on an account_status webhook to cover every account.\n"
89
- );
282
+ for (const [flag, key, omitted] of [["account-ids", "account_ids", "omit the flag to cover every account you can operate"], ["motion-ids", "motion_ids", "omit the flag for every Motion"]]) {
283
+ if (flags[flag] === void 0) continue;
284
+ const ids = flags[flag].split(",").map((s) => s.trim()).filter(Boolean);
285
+ if (ids.length === 0) {
286
+ out.stderr.write(`error: --${flag} was given an empty value. Pass ids, or ${omitted}.
287
+ `);
90
288
  process.exit(2);
91
289
  }
92
- body["account_ids"] = accountIds;
93
- } else if (flags.source !== "account_status") {
94
- out.stderr.write(
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"
96
- );
97
- process.exit(2);
290
+ body[key] = ids;
98
291
  }
99
292
  if (flags.name) body["name"] = flags.name;
100
293
  if (flags.enabled !== void 0) body["enabled"] = flags.enabled;
@@ -104,6 +297,7 @@ async function runWebhookCreate(client, flags, out) {
104
297
  if (flags.data) {
105
298
  body["data"] = flags.data.split(",").map((s) => s.trim()).filter(Boolean);
106
299
  }
300
+ Object.assign(body, await deliveryFields(flags));
107
301
  const outOpts = resolveOutputOpts(flags);
108
302
  if (flags.preview) {
109
303
  const preview = buildPreviewOutput({ method: "webhooks.create", args: {}, body });
@@ -192,6 +386,7 @@ async function runWebhookUpdate(client, flags, out) {
192
386
  }
193
387
  body["account_ids"] = accountIds;
194
388
  }
389
+ Object.assign(body, await deliveryFields(flags));
195
390
  const outOpts = resolveOutputOpts(flags);
196
391
  if (flags.preview) {
197
392
  const preview = buildPreviewOutput({
@@ -267,24 +462,37 @@ async function runWebhookVerify(input, out) {
267
462
  process.exit(1);
268
463
  }
269
464
  }
270
- var webhookCreateCommand = defineCommand({
465
+ var webhookCreateCommand = defineCommand2({
271
466
  meta: {
272
467
  name: "create",
273
468
  description: "Register a new webhook endpoint.",
469
+ risk: "write",
470
+ rules: {
471
+ changes: "Registers a webhook endpoint: Curviate delivers the subscribed events to its URL.",
472
+ visible_to: "Your endpoint, which receives event payloads. Nothing reaches LinkedIn.",
473
+ budget_rows: [],
474
+ retry: "Not safe: each call registers another webhook, with its own id and secret.",
475
+ undo: "`curviate webhook delete <webhook_id>`."
476
+ },
477
+ errors: { WEBHOOK_TEMPLATE_INVALID: "the body template is invalid: `curviate webhook lint` names every finding." },
274
478
  examples: [
275
479
  "curviate webhook create --source messaging --request-url https://example.com/hooks/curviate --account-ids acc_YOUR_ACCOUNT_ID",
480
+ "curviate webhook create --source motion --request-url https://example.com/hooks/curviate --motion-ids mot_YOUR_MOTION_ID",
276
481
  "curviate webhook create --source account_status --request-url https://example.com/hooks/curviate --name status"
277
- ],
278
- requires: [
279
- "--account-ids for --source messaging, user and post; omit it with --source account_status to cover every current and future account."
280
482
  ]
281
483
  },
282
484
  args: {
283
485
  ...WRITE_SINGLE_FLAGS,
284
- source: { type: "string", description: "Event source: messaging | user | account_status | post (scheduled-post results: post.published, post.publish_failed).", required: true },
486
+ ...DELIVERY_ARGS,
487
+ source: {
488
+ type: "string",
489
+ description: "Event source: messaging | user | account_status | post (scheduled-post results: post.published, post.publish_failed) | motion (motion.status_changed, enrollment.started, enrollment.accepted, enrollment.replied, enrollment.skipped, enrollment.finished, step.failed, motion.custom_event; opt-in only, named in --events: step.executed, enrollment.seen, enrollment.reassigned).",
490
+ required: true
491
+ },
285
492
  "request-url": { type: "string", description: "HTTPS URL to receive webhook deliveries.", required: true },
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." },
287
- name: { type: "string", description: "Human-readable name (1-100 chars)." },
493
+ "account-ids": { type: "string", description: "Comma-separated account ids to target. Omit to cover every account you can operate, now and later." },
494
+ "motion-ids": { type: "string", description: "Comma-separated Motion ids (mot_...): only events of these Motions are delivered, and events that carry no Motion are not. Omit for no filter." },
495
+ name: { type: "string", description: "Human-readable name (up to 100 characters)." },
288
496
  enabled: { type: "boolean", description: "Create as enabled (default: true).", default: true },
289
497
  events: { type: "string", description: "Comma-separated event names to subscribe to." },
290
498
  data: { type: "string", description: "Comma-separated field-remapping keys." }
@@ -306,10 +514,11 @@ var webhookCreateCommand = defineCommand({
306
514
  await runWebhookCreate(client, flags, out);
307
515
  }
308
516
  });
309
- var webhookListCommand = defineCommand({
517
+ var webhookListCommand = defineCommand2({
310
518
  meta: {
311
519
  name: "list",
312
520
  description: "List registered webhooks.",
521
+ risk: "read",
313
522
  examples: [
314
523
  "curviate webhook list"
315
524
  ]
@@ -332,10 +541,11 @@ var webhookListCommand = defineCommand({
332
541
  await runWebhookList(client, flags, out);
333
542
  }
334
543
  });
335
- var webhookEventsCommand = defineCommand({
544
+ var webhookEventsCommand = defineCommand2({
336
545
  meta: {
337
546
  name: "events",
338
- description: "List the canonical webhook event catalogue.",
547
+ description: "List the canonical webhook event catalogue. `chat.updated` always carries `chat_id`, plus `unread` and `origin` (unibox, api or linkedin) when the stored read state changed; a send from the Unibox or the API marks the chat read and reports it. Your own-message events (`message.read`, `message.reaction`, `message.edited`, `message.deleted`) carry `origin` (motion, unibox, api or linkedin); `message.received` never does.",
548
+ risk: "read",
339
549
  examples: [
340
550
  "curviate webhook events"
341
551
  ]
@@ -358,10 +568,11 @@ var webhookEventsCommand = defineCommand({
358
568
  await runWebhookEvents(client, flags, out);
359
569
  }
360
570
  });
361
- var webhookGetCommand = defineCommand({
571
+ var webhookGetCommand = defineCommand2({
362
572
  meta: {
363
573
  name: "get",
364
574
  description: "Get a single webhook owned by the calling tenant.",
575
+ risk: "read",
365
576
  examples: [
366
577
  "curviate webhook get wh_YOUR_WEBHOOK_ID"
367
578
  ]
@@ -387,10 +598,19 @@ var webhookGetCommand = defineCommand({
387
598
  await runWebhookGet(client, flags, out);
388
599
  }
389
600
  });
390
- var webhookUpdateCommand = defineCommand({
601
+ var webhookUpdateCommand = defineCommand2({
391
602
  meta: {
392
603
  name: "update",
393
604
  description: "Update a webhook in place (source is immutable).",
605
+ risk: "write",
606
+ rules: {
607
+ changes: "Changes the fields you pass on the webhook; its source cannot change.",
608
+ visible_to: "Your endpoint, which receives the payloads the webhook now selects.",
609
+ budget_rows: [],
610
+ retry: "Safe: the same values written again leave the webhook the same.",
611
+ undo: "Run it again with the previous values."
612
+ },
613
+ errors: { RESOURCE_NOT_FOUND: "no webhook with this id.", WEBHOOK_TEMPLATE_INVALID: "the body template is invalid: `curviate webhook lint` names every finding." },
394
614
  examples: [
395
615
  "curviate webhook update wh_YOUR_WEBHOOK_ID --no-enabled",
396
616
  "curviate webhook update wh_YOUR_WEBHOOK_ID --request-url https://example.com/hooks/v2"
@@ -404,7 +624,8 @@ var webhookUpdateCommand = defineCommand({
404
624
  enabled: { type: "boolean", description: "Enable or disable the webhook." },
405
625
  events: { type: "string", description: "Replace subscribed events (comma-separated)." },
406
626
  data: { type: "string", description: "Replace field-remapping keys (comma-separated)." },
407
- "account-ids": { type: "string", description: "Replace targeted accounts (comma-separated)." }
627
+ "account-ids": { type: "string", description: "Replace targeted accounts (comma-separated)." },
628
+ ...DELIVERY_ARGS
408
629
  },
409
630
  async run({ args }) {
410
631
  const flags = args;
@@ -423,7 +644,7 @@ var webhookUpdateCommand = defineCommand({
423
644
  await runWebhookUpdate(client, flags, out);
424
645
  }
425
646
  });
426
- var webhookDeleteCommand = defineCommand({
647
+ var webhookDeleteCommand = defineCommand2({
427
648
  meta: {
428
649
  name: "delete",
429
650
  description: "Permanently remove a webhook subscription.",
@@ -463,10 +684,11 @@ var webhookDeleteCommand = defineCommand({
463
684
  await runWebhookDelete(client, flags, out);
464
685
  }
465
686
  });
466
- var webhookVerifyCommand = defineCommand({
687
+ var webhookVerifyCommand = defineCommand2({
467
688
  meta: {
468
689
  name: "verify",
469
690
  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.",
691
+ risk: "read",
470
692
  examples: [
471
693
  'curviate webhook verify --secret "$CURVIATE_WEBHOOK_SECRET" --header "$SIGNATURE_HEADER" --file payload.json'
472
694
  ]
@@ -499,13 +721,13 @@ var webhookVerifyCommand = defineCommand({
499
721
  const flags = args;
500
722
  const out = buildOutputStreams();
501
723
  const rawBody = await resolveWebhookBody(flags.file, void 0, flags);
502
- const signatureHeader = flags.header ?? "";
724
+ const signatureHeader = String(flags.header ?? "");
503
725
  const secret = flags.secret ?? "";
504
726
  const replayWindowSecs = flags["max-age-secs"] === void 0 ? void 0 : intFlag("max-age-secs", flags["max-age-secs"]);
505
727
  await runWebhookVerify({ secret, signatureHeader, rawBody, replayWindowSecs }, out);
506
728
  }
507
729
  });
508
- var webhookCommand = defineCommand({
730
+ var webhookCommand = defineCommand2({
509
731
  meta: { name: "webhook", description: DESCRIPTIONS.webhook },
510
732
  subCommands: {
511
733
  create: webhookCreateCommand,
@@ -514,11 +736,17 @@ var webhookCommand = defineCommand({
514
736
  get: webhookGetCommand,
515
737
  update: webhookUpdateCommand,
516
738
  delete: webhookDeleteCommand,
517
- verify: webhookVerifyCommand
739
+ verify: webhookVerifyCommand,
740
+ lint: webhookLintCommand,
741
+ variables: webhookVariablesCommand,
742
+ deliveries: webhookDeliveriesCommand,
743
+ redeliver: webhookRedeliverCommand,
744
+ rotate: webhookRotateCommand,
745
+ test: webhookTestCommand
518
746
  },
519
747
  async run() {
520
748
  process.stderr.write(
521
- "Usage: curviate webhook <subcommand>\n create | list | events | get | update | delete | verify\n"
749
+ "Usage: curviate webhook <subcommand>\n create | list | events | get | update | delete | verify | lint | variables | deliveries | redeliver | rotate | test\n"
522
750
  );
523
751
  }
524
752
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curviate/cli",
3
- "version": "0.48.0",
3
+ "version": "0.50.0-next.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.42.0",
50
+ "@curviate/sdk": "0.45.0-next.0",
51
51
  "citty": "^0.1.6",
52
52
  "open": "^10.1.0"
53
53
  },
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/commands/descriptions.ts
4
- var DESCRIPTIONS = {
5
- setup: "Connect this machine to your workspace: opens the dashboard, takes the code it shows you, and saves an API key.",
6
- doctor: "Check that this machine can call the API: config, credential source, workspace, reachability and connected accounts.",
7
- login: "Save an API key to a local profile. Run `curviate core profile me` to verify.",
8
- config: "Manage CLI profiles and settings.",
9
- account: "LinkedIn account connection management.",
10
- webhook: "Webhook management and signature verification.",
11
- core: "Curviate core: LinkedIn building blocks. Each command runs one action now, from one Account, and counts against that Account's budgets. Nothing is queued, paced or retried for you, except a Draft scheduled with `--schedule-at`, which Curviate publishes at that time (`curviate core draft create`).",
12
- profile: "LinkedIn profile operations.",
13
- company: "Fetch a company profile by URL, slug, or numeric id, and its sub-resources.",
14
- job: "Classic LinkedIn job-posting operations.",
15
- connect: "Send or manage connection invitations. Connection requests may take 10-30 seconds to appear in the recipient's received list (LinkedIn propagation delay).",
16
- search: "Search people, companies, posts, and jobs. Also runs a pasted search URL directly.",
17
- inbox: "Read LinkedIn message inbox.",
18
- inboxes: "Discover LinkedIn inboxes (personal + company pages) and list their conversations. Beta. See also: `curviate core inbox` (the account's own message-thread inbox), `curviate core message send` (reply to a chat).",
19
- message: "Send and manage LinkedIn messages. A COMPANY_ chat id (from `curviate core inboxes chats`) sends as that company page instead of yourself; see `curviate core message send --help`.",
20
- post: "Create and manage LinkedIn posts.",
21
- comment: "Comment-thread operations (list, add, reply, edit, delete, react).",
22
- "sales-nav": "Beta. Sales Navigator operations. Needs the LinkedIn account's own Sales Navigator subscription; no Curviate add-on. Beta operations can require consent: a human enables beta in Settings, or pass --beta for this call.",
23
- recruiter: "Beta. LinkedIn Recruiter operations. Needs the LinkedIn account's own Recruiter subscription; no Curviate add-on. Beta operations can require consent: a human enables beta in Settings, or pass --beta for this call.",
24
- group: "Read LinkedIn groups: your own membership list, one group's detail, and its member roster.",
25
- feed: "Read the connected account's LinkedIn home feed as agent-actionable posts.",
26
- notification: "Read and act on LinkedIn notification cards.",
27
- draft: "Drafts and scheduled posts."
28
- };
29
- function lazy(name, load) {
30
- return Object.assign(load, { description: DESCRIPTIONS[name] });
31
- }
32
-
33
- export {
34
- DESCRIPTIONS,
35
- lazy
36
- };
@@ -1,46 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- DESCRIPTIONS,
4
- lazy
5
- } from "./chunk-GQKC6E5K.js";
6
-
7
- // src/commands/core.ts
8
- import { defineCommand } from "citty";
9
- var coreCommand = defineCommand({
10
- meta: {
11
- name: "core",
12
- description: DESCRIPTIONS.core,
13
- rules: {
14
- notes: [
15
- "Writes reach LinkedIn immediately and are seen by the people they touch.",
16
- "A retry after a timeout can repeat a write: requests carry no idempotency key. Read the current state before retrying.",
17
- "Budget rows, ceilings and what is left: `curviate account get <account_id>`."
18
- ]
19
- }
20
- },
21
- subCommands: {
22
- profile: lazy("profile", () => import("./profile-4SOOQZ4K.js").then((m) => m.profileCommand)),
23
- company: lazy("company", () => import("./company-RD7RDGSA.js").then((m) => m.companyCommand)),
24
- job: lazy("job", () => import("./job-ACFKBLFK.js").then((m) => m.jobCommand)),
25
- connect: lazy("connect", () => import("./connect-HVXT67A6.js").then((m) => m.connectCommand)),
26
- search: lazy("search", () => import("./search-JAL242A2.js").then((m) => m.searchCommand)),
27
- inbox: lazy("inbox", () => import("./inbox-MMIMCA5O.js").then((m) => m.inboxCommand)),
28
- inboxes: lazy("inboxes", () => import("./inboxes-RND3D4C7.js").then((m) => m.inboxesCommand)),
29
- message: lazy("message", () => import("./message-OFK6UVXR.js").then((m) => m.messageCommand)),
30
- post: lazy("post", () => import("./post-A5SBCFB2.js").then((m) => m.postCommand)),
31
- comment: lazy("comment", () => import("./comment-7IQ6ZOJF.js").then((m) => m.commentCommand)),
32
- "sales-nav": lazy("sales-nav", () => import("./sales-nav-JXF5RY2K.js").then((m) => m.salesNavCommand)),
33
- recruiter: lazy("recruiter", () => import("./recruiter-YN73STDP.js").then((m) => m.recruiterCommand)),
34
- group: lazy("group", () => import("./group-SIQFJEZV.js").then((m) => m.groupCommand)),
35
- feed: lazy("feed", () => import("./feed-JWP6ANPI.js").then((m) => m.feedCommand)),
36
- notification: lazy("notification", () => import("./notification-KKGAZU7M.js").then((m) => m.notificationCommand)),
37
- draft: lazy("draft", () => import("./draft-DFO22K6Q.js").then((m) => m.draftCommand))
38
- },
39
- async run() {
40
- const { showHelp } = await import("./examples-64YT5V5K.js");
41
- await showHelp(coreCommand, ["curviate", "core"]);
42
- }
43
- });
44
- export {
45
- coreCommand
46
- };