@curviate/cli 0.49.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.
- package/CHANGELOG.md +15 -0
- package/README.md +12 -5
- package/dist/{account-2BH2Q6VG.js → account-KGCGUYKF.js} +668 -116
- package/dist/analytics-HRAD4ABO.js +27 -0
- package/dist/beta-consent-364JI6IL.js +81 -0
- package/dist/billing-3SSVRS2Y.js +124 -0
- package/dist/{chunk-V7FJWTZW.js → chunk-25MO7BYN.js} +4 -4
- package/dist/{chunk-RXWODUWA.js → chunk-2W4RN5ON.js} +18 -2
- package/dist/chunk-5S3MJVI5.js +22 -0
- package/dist/chunk-67S4JHZZ.js +339 -0
- package/dist/chunk-73DJ3KNE.js +54 -0
- package/dist/chunk-CQGDMARG.js +525 -0
- package/dist/{chunk-JYKYD57J.js → chunk-DOHBOYXN.js} +1 -1
- package/dist/{chunk-3RCW7URJ.js → chunk-DSGKYZDK.js} +1 -1
- package/dist/{chunk-YLSJ4HKU.js → chunk-ENBIMEKS.js} +26 -1
- package/dist/{chunk-LCGXJGPB.js → chunk-GHMRPX5H.js} +7 -1
- package/dist/chunk-GOICALYQ.js +28 -0
- package/dist/chunk-L4CIJT6F.js +144 -0
- package/dist/{chunk-PQWDDSV7.js → chunk-L7JH3W56.js} +1 -1
- package/dist/{chunk-Z7OQSWBD.js → chunk-OE6YFYUM.js} +85 -10
- package/dist/chunk-PPGKQJKU.js +38 -0
- package/dist/{chunk-SA2QHAXG.js → chunk-QM57YDJE.js} +13 -201
- package/dist/{chunk-Y7MZZRYR.js → chunk-RYWWSZUH.js} +14 -2
- package/dist/{chunk-MGB6FE4A.js → chunk-T6GBS5SS.js} +6 -6
- package/dist/{chunk-TEAWYLPO.js → chunk-TE3WBPW6.js} +43 -17
- package/dist/chunk-UL53T4O6.js +52 -0
- package/dist/chunk-UWQPX4AE.js +20 -0
- package/dist/{chunk-5ZGTU4VD.js → chunk-YXVF5UST.js} +77 -4
- package/dist/cli.js +34 -18
- package/dist/{comment-MRDPDA33.js → comment-5JKGNYOY.js} +90 -11
- package/dist/{company-2AEHSGHA.js → company-TXST2VXW.js} +65 -15
- package/dist/{config-NRBKHXES.js → config-TVIQUVNK.js} +53 -4
- package/dist/{connect-4XEBV5V3.js → connect-RBL6U4KV.js} +63 -18
- package/dist/contact-YAHC5QFX.js +32 -0
- package/dist/contact-groups-DKOIBC57.js +399 -0
- package/dist/contact-import-ITSJQV7K.js +336 -0
- package/dist/core-PWMJPPRG.js +46 -0
- package/dist/do-not-contact-WDYIBWYA.js +200 -0
- package/dist/{doctor-BZ4DA7DV.js → doctor-F7JLPTED.js} +65 -11
- package/dist/{document-RKHRWXNT.js → document-BHYAUJ6F.js} +1 -1
- package/dist/{draft-C5N6EOO5.js → draft-TDJJUXLH.js} +60 -14
- package/dist/{enrollment-BNQOUKI7.js → enrollment-Q6UOKHPY.js} +31 -19
- package/dist/{examples-NIMSIXMV.js → examples-DQSVIIXZ.js} +2 -2
- package/dist/{exit-codes-TLMKTLRI.js → exit-codes-7DBETBDT.js} +1 -1
- package/dist/export-HIJSCJS6.js +96 -0
- package/dist/{feed-DFUU7SUJ.js → feed-W56ZTA4Z.js} +13 -10
- package/dist/{group-CSD2OWOZ.js → group-AUALYK5H.js} +18 -10
- package/dist/{inbox-SNSPWI7J.js → inbox-HLZR2ZPV.js} +31 -12
- package/dist/{inboxes-RIRHPS4H.js → inboxes-IZTRD6FE.js} +14 -10
- package/dist/incoming-ULB2RNV4.js +218 -0
- package/dist/{job-6PNXXZNF.js → job-55IKS6LP.js} +65 -13
- package/dist/{login-Y7JBAHCW.js → login-DPZ6CXNO.js} +13 -4
- package/dist/{message-2IK4MBBG.js → message-J44YKRDS.js} +9 -7
- package/dist/{motion-7ATUXO6R.js → motion-SQI5F2EK.js} +39 -117
- package/dist/network-K4QD7APQ.js +235 -0
- package/dist/{notification-VYK5NDEB.js → notification-SEDXZHXO.js} +38 -11
- package/dist/notifications-HGIBRUNQ.js +231 -0
- package/dist/{post-AN6T2OJF.js → post-L467SKIG.js} +92 -12
- package/dist/{profile-UQY64642.js → profile-A2N6RMR2.js} +76 -20
- package/dist/{recruiter-OY4RN5HH.js → recruiter-AR75RHBO.js} +133 -22
- package/dist/{sales-nav-KLODLYMW.js → sales-nav-C2AYFXPV.js} +74 -19
- package/dist/{search-NWP5S6CF.js → search-Z4DZIG4X.js} +55 -23
- package/dist/{setup-YPPFLH2N.js → setup-45BEVX6B.js} +69 -17
- package/dist/team-6QWY4IFP.js +450 -0
- package/dist/tier-2HS3BXDF.js +61 -0
- package/dist/unibox-DHUKG65Z.js +402 -0
- package/dist/{webhook-OHKBL3YS.js → webhook-Q53WUAI2.js} +257 -27
- package/package.json +2 -2
- package/dist/chunk-D2S5OCYU.js +0 -38
- package/dist/core-RGU2SCBN.js +0 -46
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
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-
|
|
29
|
+
} from "./chunk-QM57YDJE.js";
|
|
22
30
|
import {
|
|
23
|
-
createClient
|
|
24
|
-
|
|
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-
|
|
39
|
+
} from "./chunk-RYWWSZUH.js";
|
|
31
40
|
import {
|
|
32
41
|
DESCRIPTIONS
|
|
33
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-73DJ3KNE.js";
|
|
34
43
|
import {
|
|
35
44
|
readFileFlag
|
|
36
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-TE3WBPW6.js";
|
|
37
46
|
import "./chunk-FDJMAF7D.js";
|
|
38
|
-
import
|
|
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-
|
|
262
|
+
const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
|
|
65
263
|
renderError(err, outOpts, out);
|
|
66
264
|
process.exit(getExitCode(err));
|
|
67
265
|
}
|
|
@@ -99,6 +297,7 @@ async function runWebhookCreate(client, flags, out) {
|
|
|
99
297
|
if (flags.data) {
|
|
100
298
|
body["data"] = flags.data.split(",").map((s) => s.trim()).filter(Boolean);
|
|
101
299
|
}
|
|
300
|
+
Object.assign(body, await deliveryFields(flags));
|
|
102
301
|
const outOpts = resolveOutputOpts(flags);
|
|
103
302
|
if (flags.preview) {
|
|
104
303
|
const preview = buildPreviewOutput({ method: "webhooks.create", args: {}, body });
|
|
@@ -187,6 +386,7 @@ async function runWebhookUpdate(client, flags, out) {
|
|
|
187
386
|
}
|
|
188
387
|
body["account_ids"] = accountIds;
|
|
189
388
|
}
|
|
389
|
+
Object.assign(body, await deliveryFields(flags));
|
|
190
390
|
const outOpts = resolveOutputOpts(flags);
|
|
191
391
|
if (flags.preview) {
|
|
192
392
|
const preview = buildPreviewOutput({
|
|
@@ -262,10 +462,19 @@ async function runWebhookVerify(input, out) {
|
|
|
262
462
|
process.exit(1);
|
|
263
463
|
}
|
|
264
464
|
}
|
|
265
|
-
var webhookCreateCommand =
|
|
465
|
+
var webhookCreateCommand = defineCommand2({
|
|
266
466
|
meta: {
|
|
267
467
|
name: "create",
|
|
268
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." },
|
|
269
478
|
examples: [
|
|
270
479
|
"curviate webhook create --source messaging --request-url https://example.com/hooks/curviate --account-ids acc_YOUR_ACCOUNT_ID",
|
|
271
480
|
"curviate webhook create --source motion --request-url https://example.com/hooks/curviate --motion-ids mot_YOUR_MOTION_ID",
|
|
@@ -274,6 +483,7 @@ var webhookCreateCommand = defineCommand({
|
|
|
274
483
|
},
|
|
275
484
|
args: {
|
|
276
485
|
...WRITE_SINGLE_FLAGS,
|
|
486
|
+
...DELIVERY_ARGS,
|
|
277
487
|
source: {
|
|
278
488
|
type: "string",
|
|
279
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).",
|
|
@@ -282,7 +492,7 @@ var webhookCreateCommand = defineCommand({
|
|
|
282
492
|
"request-url": { type: "string", description: "HTTPS URL to receive webhook deliveries.", required: true },
|
|
283
493
|
"account-ids": { type: "string", description: "Comma-separated account ids to target. Omit to cover every account you can operate, now and later." },
|
|
284
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." },
|
|
285
|
-
name: { type: "string", description: "Human-readable name (
|
|
495
|
+
name: { type: "string", description: "Human-readable name (up to 100 characters)." },
|
|
286
496
|
enabled: { type: "boolean", description: "Create as enabled (default: true).", default: true },
|
|
287
497
|
events: { type: "string", description: "Comma-separated event names to subscribe to." },
|
|
288
498
|
data: { type: "string", description: "Comma-separated field-remapping keys." }
|
|
@@ -304,10 +514,11 @@ var webhookCreateCommand = defineCommand({
|
|
|
304
514
|
await runWebhookCreate(client, flags, out);
|
|
305
515
|
}
|
|
306
516
|
});
|
|
307
|
-
var webhookListCommand =
|
|
517
|
+
var webhookListCommand = defineCommand2({
|
|
308
518
|
meta: {
|
|
309
519
|
name: "list",
|
|
310
520
|
description: "List registered webhooks.",
|
|
521
|
+
risk: "read",
|
|
311
522
|
examples: [
|
|
312
523
|
"curviate webhook list"
|
|
313
524
|
]
|
|
@@ -330,10 +541,11 @@ var webhookListCommand = defineCommand({
|
|
|
330
541
|
await runWebhookList(client, flags, out);
|
|
331
542
|
}
|
|
332
543
|
});
|
|
333
|
-
var webhookEventsCommand =
|
|
544
|
+
var webhookEventsCommand = defineCommand2({
|
|
334
545
|
meta: {
|
|
335
546
|
name: "events",
|
|
336
|
-
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",
|
|
337
549
|
examples: [
|
|
338
550
|
"curviate webhook events"
|
|
339
551
|
]
|
|
@@ -356,10 +568,11 @@ var webhookEventsCommand = defineCommand({
|
|
|
356
568
|
await runWebhookEvents(client, flags, out);
|
|
357
569
|
}
|
|
358
570
|
});
|
|
359
|
-
var webhookGetCommand =
|
|
571
|
+
var webhookGetCommand = defineCommand2({
|
|
360
572
|
meta: {
|
|
361
573
|
name: "get",
|
|
362
574
|
description: "Get a single webhook owned by the calling tenant.",
|
|
575
|
+
risk: "read",
|
|
363
576
|
examples: [
|
|
364
577
|
"curviate webhook get wh_YOUR_WEBHOOK_ID"
|
|
365
578
|
]
|
|
@@ -385,10 +598,19 @@ var webhookGetCommand = defineCommand({
|
|
|
385
598
|
await runWebhookGet(client, flags, out);
|
|
386
599
|
}
|
|
387
600
|
});
|
|
388
|
-
var webhookUpdateCommand =
|
|
601
|
+
var webhookUpdateCommand = defineCommand2({
|
|
389
602
|
meta: {
|
|
390
603
|
name: "update",
|
|
391
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." },
|
|
392
614
|
examples: [
|
|
393
615
|
"curviate webhook update wh_YOUR_WEBHOOK_ID --no-enabled",
|
|
394
616
|
"curviate webhook update wh_YOUR_WEBHOOK_ID --request-url https://example.com/hooks/v2"
|
|
@@ -402,7 +624,8 @@ var webhookUpdateCommand = defineCommand({
|
|
|
402
624
|
enabled: { type: "boolean", description: "Enable or disable the webhook." },
|
|
403
625
|
events: { type: "string", description: "Replace subscribed events (comma-separated)." },
|
|
404
626
|
data: { type: "string", description: "Replace field-remapping keys (comma-separated)." },
|
|
405
|
-
"account-ids": { type: "string", description: "Replace targeted accounts (comma-separated)." }
|
|
627
|
+
"account-ids": { type: "string", description: "Replace targeted accounts (comma-separated)." },
|
|
628
|
+
...DELIVERY_ARGS
|
|
406
629
|
},
|
|
407
630
|
async run({ args }) {
|
|
408
631
|
const flags = args;
|
|
@@ -421,7 +644,7 @@ var webhookUpdateCommand = defineCommand({
|
|
|
421
644
|
await runWebhookUpdate(client, flags, out);
|
|
422
645
|
}
|
|
423
646
|
});
|
|
424
|
-
var webhookDeleteCommand =
|
|
647
|
+
var webhookDeleteCommand = defineCommand2({
|
|
425
648
|
meta: {
|
|
426
649
|
name: "delete",
|
|
427
650
|
description: "Permanently remove a webhook subscription.",
|
|
@@ -461,10 +684,11 @@ var webhookDeleteCommand = defineCommand({
|
|
|
461
684
|
await runWebhookDelete(client, flags, out);
|
|
462
685
|
}
|
|
463
686
|
});
|
|
464
|
-
var webhookVerifyCommand =
|
|
687
|
+
var webhookVerifyCommand = defineCommand2({
|
|
465
688
|
meta: {
|
|
466
689
|
name: "verify",
|
|
467
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",
|
|
468
692
|
examples: [
|
|
469
693
|
'curviate webhook verify --secret "$CURVIATE_WEBHOOK_SECRET" --header "$SIGNATURE_HEADER" --file payload.json'
|
|
470
694
|
]
|
|
@@ -497,13 +721,13 @@ var webhookVerifyCommand = defineCommand({
|
|
|
497
721
|
const flags = args;
|
|
498
722
|
const out = buildOutputStreams();
|
|
499
723
|
const rawBody = await resolveWebhookBody(flags.file, void 0, flags);
|
|
500
|
-
const signatureHeader = flags.header ?? "";
|
|
724
|
+
const signatureHeader = String(flags.header ?? "");
|
|
501
725
|
const secret = flags.secret ?? "";
|
|
502
726
|
const replayWindowSecs = flags["max-age-secs"] === void 0 ? void 0 : intFlag("max-age-secs", flags["max-age-secs"]);
|
|
503
727
|
await runWebhookVerify({ secret, signatureHeader, rawBody, replayWindowSecs }, out);
|
|
504
728
|
}
|
|
505
729
|
});
|
|
506
|
-
var webhookCommand =
|
|
730
|
+
var webhookCommand = defineCommand2({
|
|
507
731
|
meta: { name: "webhook", description: DESCRIPTIONS.webhook },
|
|
508
732
|
subCommands: {
|
|
509
733
|
create: webhookCreateCommand,
|
|
@@ -512,11 +736,17 @@ var webhookCommand = defineCommand({
|
|
|
512
736
|
get: webhookGetCommand,
|
|
513
737
|
update: webhookUpdateCommand,
|
|
514
738
|
delete: webhookDeleteCommand,
|
|
515
|
-
verify: webhookVerifyCommand
|
|
739
|
+
verify: webhookVerifyCommand,
|
|
740
|
+
lint: webhookLintCommand,
|
|
741
|
+
variables: webhookVariablesCommand,
|
|
742
|
+
deliveries: webhookDeliveriesCommand,
|
|
743
|
+
redeliver: webhookRedeliverCommand,
|
|
744
|
+
rotate: webhookRotateCommand,
|
|
745
|
+
test: webhookTestCommand
|
|
516
746
|
},
|
|
517
747
|
async run() {
|
|
518
748
|
process.stderr.write(
|
|
519
|
-
"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"
|
|
520
750
|
);
|
|
521
751
|
}
|
|
522
752
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@curviate/cli",
|
|
3
|
-
"version": "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.
|
|
50
|
+
"@curviate/sdk": "0.45.0-next.0",
|
|
51
51
|
"citty": "^0.1.6",
|
|
52
52
|
"open": "^10.1.0"
|
|
53
53
|
},
|
package/dist/chunk-D2S5OCYU.js
DELETED
|
@@ -1,38 +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
|
-
motion: "Motions: one Sequence run for the Contacts of your Team's Contact lists, from its sending Accounts, paced on a schedule. Create and edit drafts, preview, start, pause, resume, archive, add or remove Contacts; lint a Sequence and write a template offline. Your Team's data: every role reads; writes need motion-send on each sending Account, and Motions need the Automate plan.",
|
|
11
|
-
enrollment: "Enrollments: one Contact in one Motion on one Account. List and read them; pause, resume, retry a failed Step, stop, send a custom event, reassign, or act on many at once. Your Team's data: every role reads; writes need operate on the Enrollment's Account.",
|
|
12
|
-
webhook: "Webhook management and signature verification.",
|
|
13
|
-
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`).",
|
|
14
|
-
profile: "LinkedIn profile operations.",
|
|
15
|
-
company: "Fetch a company profile by URL, slug, or numeric id, and its sub-resources.",
|
|
16
|
-
job: "Classic LinkedIn job-posting operations.",
|
|
17
|
-
connect: "Send or manage connection invitations. Connection requests may take 10-30 seconds to appear in the recipient's received list (LinkedIn propagation delay).",
|
|
18
|
-
search: "Search people, companies, posts, and jobs. Also runs a pasted search URL directly.",
|
|
19
|
-
inbox: "Read LinkedIn message inbox.",
|
|
20
|
-
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).",
|
|
21
|
-
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`.",
|
|
22
|
-
post: "Create and manage LinkedIn posts.",
|
|
23
|
-
comment: "Comment-thread operations (list, add, reply, edit, delete, react).",
|
|
24
|
-
"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.",
|
|
25
|
-
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.",
|
|
26
|
-
group: "Read LinkedIn groups: your own membership list, one group's detail, and its member roster.",
|
|
27
|
-
feed: "Read the connected account's LinkedIn home feed as agent-actionable posts.",
|
|
28
|
-
notification: "Read and act on LinkedIn notification cards.",
|
|
29
|
-
draft: "Drafts and scheduled posts."
|
|
30
|
-
};
|
|
31
|
-
function lazy(name, load) {
|
|
32
|
-
return Object.assign(load, { description: DESCRIPTIONS[name] });
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export {
|
|
36
|
-
DESCRIPTIONS,
|
|
37
|
-
lazy
|
|
38
|
-
};
|
package/dist/core-RGU2SCBN.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
DESCRIPTIONS,
|
|
4
|
-
lazy
|
|
5
|
-
} from "./chunk-D2S5OCYU.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-UQY64642.js").then((m) => m.profileCommand)),
|
|
23
|
-
company: lazy("company", () => import("./company-2AEHSGHA.js").then((m) => m.companyCommand)),
|
|
24
|
-
job: lazy("job", () => import("./job-6PNXXZNF.js").then((m) => m.jobCommand)),
|
|
25
|
-
connect: lazy("connect", () => import("./connect-4XEBV5V3.js").then((m) => m.connectCommand)),
|
|
26
|
-
search: lazy("search", () => import("./search-NWP5S6CF.js").then((m) => m.searchCommand)),
|
|
27
|
-
inbox: lazy("inbox", () => import("./inbox-SNSPWI7J.js").then((m) => m.inboxCommand)),
|
|
28
|
-
inboxes: lazy("inboxes", () => import("./inboxes-RIRHPS4H.js").then((m) => m.inboxesCommand)),
|
|
29
|
-
message: lazy("message", () => import("./message-2IK4MBBG.js").then((m) => m.messageCommand)),
|
|
30
|
-
post: lazy("post", () => import("./post-AN6T2OJF.js").then((m) => m.postCommand)),
|
|
31
|
-
comment: lazy("comment", () => import("./comment-MRDPDA33.js").then((m) => m.commentCommand)),
|
|
32
|
-
"sales-nav": lazy("sales-nav", () => import("./sales-nav-KLODLYMW.js").then((m) => m.salesNavCommand)),
|
|
33
|
-
recruiter: lazy("recruiter", () => import("./recruiter-OY4RN5HH.js").then((m) => m.recruiterCommand)),
|
|
34
|
-
group: lazy("group", () => import("./group-CSD2OWOZ.js").then((m) => m.groupCommand)),
|
|
35
|
-
feed: lazy("feed", () => import("./feed-DFUU7SUJ.js").then((m) => m.feedCommand)),
|
|
36
|
-
notification: lazy("notification", () => import("./notification-VYK5NDEB.js").then((m) => m.notificationCommand)),
|
|
37
|
-
draft: lazy("draft", () => import("./draft-C5N6EOO5.js").then((m) => m.draftCommand))
|
|
38
|
-
},
|
|
39
|
-
async run() {
|
|
40
|
-
const { showHelp } = await import("./examples-NIMSIXMV.js");
|
|
41
|
-
await showHelp(coreCommand, ["curviate", "core"]);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
export {
|
|
45
|
-
coreCommand
|
|
46
|
-
};
|