@curviate/cli 0.49.0 → 0.50.0-next.1

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 +26 -0
  2. package/README.md +12 -5
  3. package/dist/{account-2BH2Q6VG.js → account-U7UJIE3H.js} +784 -116
  4. package/dist/analytics-MZU2WKON.js +27 -0
  5. package/dist/beta-consent-67IDUV3K.js +81 -0
  6. package/dist/billing-QAW75YE7.js +124 -0
  7. package/dist/{chunk-RXWODUWA.js → chunk-2W4RN5ON.js} +18 -2
  8. package/dist/{chunk-MGB6FE4A.js → chunk-3Z6PXS6N.js} +6 -6
  9. package/dist/chunk-5S3MJVI5.js +22 -0
  10. package/dist/{chunk-V7FJWTZW.js → chunk-6LBOGIVE.js} +4 -4
  11. package/dist/{chunk-Z7OQSWBD.js → chunk-6PLDAEMO.js} +85 -10
  12. package/dist/chunk-73DJ3KNE.js +54 -0
  13. package/dist/{chunk-3RCW7URJ.js → chunk-A57ZILRU.js} +1 -1
  14. package/dist/chunk-AVI7J47S.js +52 -0
  15. package/dist/{chunk-JYKYD57J.js → chunk-CKVCBGQX.js} +1 -1
  16. package/dist/chunk-EIA66ESN.js +339 -0
  17. package/dist/{chunk-YLSJ4HKU.js → chunk-ENBIMEKS.js} +26 -1
  18. package/dist/{chunk-LCGXJGPB.js → chunk-GHMRPX5H.js} +7 -1
  19. package/dist/chunk-GOICALYQ.js +28 -0
  20. package/dist/{chunk-PQWDDSV7.js → chunk-L7JH3W56.js} +1 -1
  21. package/dist/chunk-LCPPXOPN.js +528 -0
  22. package/dist/chunk-LRMPS4UQ.js +144 -0
  23. package/dist/{chunk-5ZGTU4VD.js → chunk-LULN3II2.js} +78 -5
  24. package/dist/chunk-PPGKQJKU.js +38 -0
  25. package/dist/chunk-Q3ZPRFUX.js +20 -0
  26. package/dist/{chunk-SA2QHAXG.js → chunk-QM57YDJE.js} +13 -201
  27. package/dist/{chunk-Y7MZZRYR.js → chunk-RYWWSZUH.js} +14 -2
  28. package/dist/{chunk-TEAWYLPO.js → chunk-TYNVJDYK.js} +49 -18
  29. package/dist/cli.js +34 -18
  30. package/dist/{comment-MRDPDA33.js → comment-6NRZILAS.js} +90 -11
  31. package/dist/{company-2AEHSGHA.js → company-VXE7IEPT.js} +65 -15
  32. package/dist/{config-NRBKHXES.js → config-3WP7OD35.js} +53 -4
  33. package/dist/{connect-4XEBV5V3.js → connect-FBK6UWZP.js} +63 -18
  34. package/dist/contact-HFPZ3KGL.js +32 -0
  35. package/dist/contact-groups-AI4MLGQS.js +399 -0
  36. package/dist/contact-import-54Y7EMU2.js +336 -0
  37. package/dist/core-RLMWMQEI.js +46 -0
  38. package/dist/do-not-contact-LQ5V6SPE.js +200 -0
  39. package/dist/{doctor-BZ4DA7DV.js → doctor-KKRL7TEF.js} +65 -11
  40. package/dist/{document-RKHRWXNT.js → document-GFRWPQFV.js} +1 -1
  41. package/dist/{draft-C5N6EOO5.js → draft-VSWZOCDR.js} +60 -14
  42. package/dist/{enrollment-BNQOUKI7.js → enrollment-OACCSBM5.js} +31 -19
  43. package/dist/{examples-NIMSIXMV.js → examples-JJB4DZKK.js} +2 -2
  44. package/dist/{exit-codes-TLMKTLRI.js → exit-codes-7DBETBDT.js} +1 -1
  45. package/dist/export-AQHAFVAB.js +96 -0
  46. package/dist/{feed-DFUU7SUJ.js → feed-HY4HT75U.js} +13 -10
  47. package/dist/{group-CSD2OWOZ.js → group-A3SMBFU5.js} +18 -10
  48. package/dist/{inbox-SNSPWI7J.js → inbox-YHUO2RPI.js} +31 -12
  49. package/dist/{inboxes-RIRHPS4H.js → inboxes-GKLMHPDR.js} +14 -10
  50. package/dist/incoming-NHROOOIZ.js +218 -0
  51. package/dist/{job-6PNXXZNF.js → job-QBW3PGWL.js} +65 -13
  52. package/dist/{login-Y7JBAHCW.js → login-GWIYHKYO.js} +13 -4
  53. package/dist/{message-2IK4MBBG.js → message-BFLN2VHS.js} +9 -7
  54. package/dist/{motion-7ATUXO6R.js → motion-LTWU2GPC.js} +39 -117
  55. package/dist/network-CNSBX2SR.js +235 -0
  56. package/dist/{notification-VYK5NDEB.js → notification-DCCFJPXU.js} +38 -11
  57. package/dist/notifications-AQBXBK4K.js +231 -0
  58. package/dist/{post-AN6T2OJF.js → post-PINZHSPS.js} +92 -12
  59. package/dist/{profile-UQY64642.js → profile-MJQJSNYR.js} +76 -20
  60. package/dist/{recruiter-OY4RN5HH.js → recruiter-X6GX4A2G.js} +133 -22
  61. package/dist/{sales-nav-KLODLYMW.js → sales-nav-44GYWDYE.js} +74 -19
  62. package/dist/{search-NWP5S6CF.js → search-SULIN6TB.js} +55 -23
  63. package/dist/{setup-YPPFLH2N.js → setup-ZQRHMRMB.js} +69 -17
  64. package/dist/team-TM6LRUY5.js +450 -0
  65. package/dist/tier-Z3U6AT7H.js +61 -0
  66. package/dist/unibox-BIMI2KY5.js +402 -0
  67. package/dist/{webhook-OHKBL3YS.js → webhook-EHXRTHBG.js} +257 -27
  68. package/package.json +2 -2
  69. package/dist/chunk-D2S5OCYU.js +0 -38
  70. package/dist/core-RGU2SCBN.js +0 -46
@@ -1,16 +1,21 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ AS_ACCOUNT,
4
+ BUDGET,
5
+ TARGET
6
+ } from "./chunk-Q3ZPRFUX.js";
2
7
  import {
3
8
  resolveIdentifier
4
9
  } from "./chunk-UEAX6KUB.js";
5
- import {
6
- requireAccount
7
- } from "./chunk-V7FJWTZW.js";
8
10
  import {
9
11
  slimInviteReceived,
10
12
  slimInviteReceivedItem,
11
13
  slimInviteSent,
12
14
  slimInviteSentItem
13
- } from "./chunk-LCGXJGPB.js";
15
+ } from "./chunk-GHMRPX5H.js";
16
+ import {
17
+ requireAccount
18
+ } from "./chunk-6LBOGIVE.js";
14
19
  import {
15
20
  buildPreviewOutput
16
21
  } from "./chunk-TCUYH5GO.js";
@@ -20,29 +25,31 @@ import {
20
25
  readMaxPagesFlag,
21
26
  readablePage,
22
27
  rejectPaginationModifiersWithoutAll,
28
+ streamAll
29
+ } from "./chunk-LRMPS4UQ.js";
30
+ import {
23
31
  renderError,
24
32
  renderSuccess,
25
33
  renderUnexpectedError,
26
- resolveEffectiveConfig,
27
- streamAll,
28
34
  writeNdjsonItem
29
- } from "./chunk-SA2QHAXG.js";
30
- import "./chunk-RXWODUWA.js";
35
+ } from "./chunk-QM57YDJE.js";
31
36
  import {
32
- createClient
33
- } from "./chunk-5ZGTU4VD.js";
37
+ createClient,
38
+ resolveEffectiveConfig
39
+ } from "./chunk-LULN3II2.js";
34
40
  import {
35
41
  GLOBAL_FLAGS,
36
42
  WRITE_FLAGS,
37
43
  readOnly
38
- } from "./chunk-Y7MZZRYR.js";
44
+ } from "./chunk-RYWWSZUH.js";
39
45
  import {
40
46
  DESCRIPTIONS
41
- } from "./chunk-D2S5OCYU.js";
47
+ } from "./chunk-73DJ3KNE.js";
42
48
  import {
43
49
  nearestSubcommand
44
50
  } from "./chunk-FDJMAF7D.js";
45
51
  import "./chunk-ZYURL5VK.js";
52
+ import "./chunk-2W4RN5ON.js";
46
53
 
47
54
  // src/commands/connect.ts
48
55
  import { defineCommand } from "citty";
@@ -86,7 +93,7 @@ async function runConnectSend(client, flags, out) {
86
93
  } catch (err) {
87
94
  const { CurviateError } = await import("@curviate/sdk");
88
95
  if (err instanceof CurviateError) {
89
- const { getExitCode } = await import("./exit-codes-TLMKTLRI.js");
96
+ const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
90
97
  renderError(err, outOpts, out);
91
98
  process.exit(getExitCode(err));
92
99
  }
@@ -125,7 +132,7 @@ async function runConnectSent(client, flags, out) {
125
132
  } catch (err) {
126
133
  const { CurviateError } = await import("@curviate/sdk");
127
134
  if (err instanceof CurviateError) {
128
- const { getExitCode } = await import("./exit-codes-TLMKTLRI.js");
135
+ const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
129
136
  renderError(err, outOpts, out);
130
137
  process.exit(getExitCode(err));
131
138
  }
@@ -164,7 +171,7 @@ async function runConnectReceived(client, flags, out) {
164
171
  } catch (err) {
165
172
  const { CurviateError } = await import("@curviate/sdk");
166
173
  if (err instanceof CurviateError) {
167
- const { getExitCode } = await import("./exit-codes-TLMKTLRI.js");
174
+ const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
168
175
  renderError(err, outOpts, out);
169
176
  process.exit(getExitCode(err));
170
177
  }
@@ -193,7 +200,7 @@ async function runConnectAccept(client, flags, out) {
193
200
  } catch (err) {
194
201
  const { CurviateError } = await import("@curviate/sdk");
195
202
  if (err instanceof CurviateError) {
196
- const { getExitCode } = await import("./exit-codes-TLMKTLRI.js");
203
+ const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
197
204
  renderError(err, outOpts, out);
198
205
  process.exit(getExitCode(err));
199
206
  }
@@ -222,7 +229,7 @@ async function runConnectDecline(client, flags, out) {
222
229
  } catch (err) {
223
230
  const { CurviateError } = await import("@curviate/sdk");
224
231
  if (err instanceof CurviateError) {
225
- const { getExitCode } = await import("./exit-codes-TLMKTLRI.js");
232
+ const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
226
233
  renderError(err, outOpts, out);
227
234
  process.exit(getExitCode(err));
228
235
  }
@@ -251,7 +258,7 @@ async function runConnectCancel(client, flags, out) {
251
258
  } catch (err) {
252
259
  const { CurviateError } = await import("@curviate/sdk");
253
260
  if (err instanceof CurviateError) {
254
- const { getExitCode } = await import("./exit-codes-TLMKTLRI.js");
261
+ const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
255
262
  renderError(err, outOpts, out);
256
263
  process.exit(getExitCode(err));
257
264
  }
@@ -263,6 +270,7 @@ var connectSentCommand = defineCommand({
263
270
  meta: {
264
271
  name: "sent",
265
272
  description: "Returns pending sent invitations only. Accepted and declined invitations are not returned (LinkedIn API limitation). Use `id` with `curviate core connect cancel`; use `user.id` (native member URN; the sent-variant carries no public slug) to identify the recipient. `created_at` is the platform's own ISO-8601 timestamp (not an approximation). No total count is available; use `curviate core connect sent --all` and count client-side. A very recently sent invitation may take a few minutes to appear here (LinkedIn-side indexing).",
273
+ risk: "read",
266
274
  examples: [
267
275
  "curviate core connect sent",
268
276
  "curviate core connect sent --all"
@@ -291,6 +299,7 @@ var connectReceivedCommand = defineCommand({
291
299
  meta: {
292
300
  name: "received",
293
301
  description: "Returns pending received invitations only. Already-handled invitations are not returned. The `user.*` fields (`public_identifier`, `display_name`, `first_name`, `last_name`) identify who sent the request. Use the `id` field with `curviate core connect accept` or `curviate core connect decline`. A very recently received invitation may take a few minutes to appear here (LinkedIn-side indexing).",
302
+ risk: "read",
294
303
  examples: [
295
304
  "curviate core connect received",
296
305
  "curviate core connect received --json"
@@ -319,6 +328,15 @@ var connectAcceptCommand = defineCommand({
319
328
  meta: {
320
329
  name: "accept",
321
330
  description: "Accept a received invitation.",
331
+ risk: "write",
332
+ rules: {
333
+ changes: "Accepts a received invitation: you and the sender become connections.",
334
+ visible_to: "The sender.",
335
+ budget_rows: ["invite_responses"],
336
+ retry: "A handled invitation is gone from `curviate core connect received`, so a retry has nothing to act on.",
337
+ undo: "Cannot be undone from the CLI: remove the connection on LinkedIn."
338
+ },
339
+ errors: { ...AS_ACCOUNT, ...BUDGET, ...TARGET },
322
340
  examples: [
323
341
  "curviate core connect accept INVITATION_ID"
324
342
  ]
@@ -352,6 +370,15 @@ var connectDeclineCommand = defineCommand({
352
370
  meta: {
353
371
  name: "decline",
354
372
  description: "Decline a received invitation.",
373
+ risk: "write",
374
+ rules: {
375
+ changes: "Declines a received invitation.",
376
+ visible_to: "The sender's invitation is closed.",
377
+ budget_rows: ["invite_responses"],
378
+ retry: "A handled invitation is gone from `curviate core connect received`, so a retry has nothing to act on.",
379
+ undo: "Cannot be undone: the sender must invite you again."
380
+ },
381
+ errors: { ...AS_ACCOUNT, ...BUDGET, ...TARGET },
355
382
  examples: [
356
383
  "curviate core connect decline INVITATION_ID"
357
384
  ]
@@ -385,6 +412,15 @@ var connectCancelCommand = defineCommand({
385
412
  meta: {
386
413
  name: "cancel",
387
414
  description: "Cancel a sent invitation.",
415
+ risk: "write",
416
+ rules: {
417
+ changes: "Withdraws an invitation you sent.",
418
+ visible_to: "The invited person no longer sees it.",
419
+ budget_rows: ["withdrawal_sweep"],
420
+ retry: "A withdrawn invitation is gone from `curviate core connect sent`, so a retry has nothing to act on.",
421
+ undo: "Send a new invitation with `curviate core connect <id>`."
422
+ },
423
+ errors: { ...AS_ACCOUNT, ...BUDGET, ...TARGET },
388
424
  examples: [
389
425
  "curviate core connect cancel INVITATION_ID"
390
426
  ]
@@ -433,6 +469,15 @@ var connectCommand = defineCommand({
433
469
  meta: {
434
470
  name: "connect",
435
471
  description: DESCRIPTIONS.connect,
472
+ risk: "write",
473
+ rules: {
474
+ changes: "Sends a connection invitation, with your note if you pass --note.",
475
+ visible_to: "The person invited, who sees the invitation and the note.",
476
+ budget_rows: ["connection_requests_with_note", "connection_requests_no_note"],
477
+ retry: "Safe: an invitation already pending, or a person already connected, answers CONNECTION_REQUEST_CONFLICT and sends nothing.",
478
+ undo: "`curviate core connect cancel <invitation_id>` withdraws it while it is pending."
479
+ },
480
+ errors: { ...AS_ACCOUNT, ...BUDGET, ...TARGET, CONNECTION_REQUEST_CONFLICT: "already invited or already connected." },
436
481
  examples: [
437
482
  "curviate core connect janesmith",
438
483
  'curviate core connect https://www.linkedin.com/in/janesmith --note "Enjoyed your talk on agents, would love to connect."'
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ BULK_MAX_IDS,
4
+ contactCommand,
5
+ contactIds,
6
+ mergeChunks,
7
+ online,
8
+ positionals,
9
+ preview
10
+ } from "./chunk-LCPPXOPN.js";
11
+ import "./chunk-6LBOGIVE.js";
12
+ import "./chunk-GOICALYQ.js";
13
+ import "./chunk-AVI7J47S.js";
14
+ import "./chunk-3Z6PXS6N.js";
15
+ import "./chunk-TCUYH5GO.js";
16
+ import "./chunk-NNV2OYEF.js";
17
+ import "./chunk-LRMPS4UQ.js";
18
+ import "./chunk-QM57YDJE.js";
19
+ import "./chunk-LULN3II2.js";
20
+ import "./chunk-RYWWSZUH.js";
21
+ import "./chunk-73DJ3KNE.js";
22
+ import "./chunk-ZYURL5VK.js";
23
+ import "./chunk-2W4RN5ON.js";
24
+ export {
25
+ BULK_MAX_IDS,
26
+ contactCommand,
27
+ contactIds,
28
+ mergeChunks,
29
+ online,
30
+ positionals,
31
+ preview
32
+ };
@@ -0,0 +1,399 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ BULK_MAX_IDS,
4
+ FILTER_ARGS,
5
+ contactIds,
6
+ hasFilter,
7
+ mergeChunks,
8
+ online,
9
+ preview,
10
+ readFilter
11
+ } from "./chunk-LCPPXOPN.js";
12
+ import "./chunk-6LBOGIVE.js";
13
+ import "./chunk-GOICALYQ.js";
14
+ import {
15
+ sendInChunks
16
+ } from "./chunk-AVI7J47S.js";
17
+ import {
18
+ fail,
19
+ listFlag,
20
+ outputOpts,
21
+ usage
22
+ } from "./chunk-3Z6PXS6N.js";
23
+ import "./chunk-TCUYH5GO.js";
24
+ import {
25
+ intFlag
26
+ } from "./chunk-NNV2OYEF.js";
27
+ import {
28
+ pageDelayFromFlags,
29
+ readCursorFlag,
30
+ readMaxPagesFlag,
31
+ readableObject,
32
+ readablePage,
33
+ rejectPaginationModifiersWithoutAll,
34
+ streamAll
35
+ } from "./chunk-LRMPS4UQ.js";
36
+ import {
37
+ renderSuccess,
38
+ writeNdjsonItem
39
+ } from "./chunk-QM57YDJE.js";
40
+ import "./chunk-LULN3II2.js";
41
+ import {
42
+ GLOBAL_FLAGS,
43
+ READ_SINGLE_FLAGS,
44
+ WRITE_SINGLE_FLAGS,
45
+ readOnly
46
+ } from "./chunk-RYWWSZUH.js";
47
+ import "./chunk-73DJ3KNE.js";
48
+ import "./chunk-ZYURL5VK.js";
49
+ import "./chunk-2W4RN5ON.js";
50
+
51
+ // src/commands/contact-groups.ts
52
+ import { defineCommand } from "citty";
53
+ var show = (result, f) => renderSuccess(result, outputOpts(f), process);
54
+ var required = (flag, v, what) => {
55
+ if (v === void 0 || v.trim() === "") usage(`--${flag} is required: ${what}.`);
56
+ return v;
57
+ };
58
+ async function page(f, params, fetchPage) {
59
+ rejectPaginationModifiersWithoutAll(f, process);
60
+ if (f.limit !== void 0) params["limit"] = intFlag("limit", f.limit, 1, 100);
61
+ const cursor = readCursorFlag(f, process);
62
+ if (cursor) params["cursor"] = cursor;
63
+ try {
64
+ if (f.all) {
65
+ const next = (p) => fetchPage(p);
66
+ for await (const item of streamAll(next, params, { maxPages: readMaxPagesFlag(f, process), out: process, pageDelayMs: pageDelayFromFlags(f) })) writeNdjsonItem(process, item, f.fields);
67
+ } else {
68
+ show(readablePage(await fetchPage(params)), f);
69
+ }
70
+ } catch (err) {
71
+ await fail(err, f);
72
+ }
73
+ }
74
+ var named = (what, v) => {
75
+ if (v === void 0 || v.trim() === "") usage(`${what} is empty.`);
76
+ return v;
77
+ };
78
+ async function bulkUpdate(c, f, skip, change) {
79
+ const ids = contactIds(f, skip);
80
+ const filtered = hasFilter(f);
81
+ if (filtered && ids.length) usage("name the Contacts either by id or with filter flags, not both.");
82
+ if (!filtered && !ids.length) usage("name the Contacts: one or more Contact ids (con_...), --ids, or filter flags such as --list or --tag.");
83
+ try {
84
+ if (filtered) {
85
+ const body = { filter: await readFilter(c, f, "body"), ...change };
86
+ if (f.preview) return preview("contacts.updateMany", {}, body);
87
+ return show(await c.contacts.updateMany(body), f);
88
+ }
89
+ if (f.preview) return preview("contacts.updateMany", {}, { contact_ids: ids.slice(0, BULK_MAX_IDS), ...change });
90
+ show(mergeChunks(await sendInChunks(ids, BULK_MAX_IDS, (chunk) => c.contacts.updateMany({ contact_ids: chunk, ...change }), f)), f);
91
+ } catch (err) {
92
+ await fail(err, f);
93
+ }
94
+ }
95
+ var ID = { type: "positional", description: "Contact list id (cl_...)." };
96
+ var IDS = {
97
+ id: { type: "positional", required: false, variadic: true, description: "Contact id (con_...); several may follow." },
98
+ ids: { type: "string", description: `Contact ids (con_...); repeatable, or a comma list. Sent in requests of up to ${BULK_MAX_IDS} ids, in order; a failed request stops the run and reports what was sent.` }
99
+ };
100
+ var SEE_LISTS = ["curviate contact lists get", "curviate contact list"];
101
+ var BULK_ERRORS = { INSUFFICIENT_ROLE: "your role cannot change Contacts here.", CONTACT_LIMIT_REACHED: "a Tag or list-membership cap would be exceeded (the Contact is under `refused`)." };
102
+ var BULK_OUTPUT = ["`updated`, `unchanged`, `not_found` (ids that did not exist) and `refused` (a Contact over a cap, with the reason). Counts are summed over every request."];
103
+ var BULK_RADIUS = `By id: up to ${BULK_MAX_IDS} Contacts per request. By filter: every Contact the filter matches; count it first with \`curviate contact list <same filters> --total --limit 1\`.`;
104
+ var listsList = defineCommand({
105
+ meta: {
106
+ name: "list",
107
+ description: "List your Team's Contact lists, with how many Contacts each holds.",
108
+ risk: "read",
109
+ examples: ["curviate contact lists list", "curviate contact lists list --query warm"]
110
+ },
111
+ args: { ...readOnly(GLOBAL_FLAGS), query: { type: "string", description: "Only lists whose name matches this text." } },
112
+ run: online((c, f) => page(f, f.query !== void 0 ? { q: named("--query", f.query) } : {}, (p) => c.contactLists.list(p)))
113
+ });
114
+ var listsGet = defineCommand({
115
+ meta: { name: "get", description: "One Contact list: its name, description and Contact count.", risk: "read", examples: ["curviate contact lists get cl_YOUR_LIST_ID"] },
116
+ args: { ...readOnly(READ_SINGLE_FLAGS), id: ID },
117
+ run: online(async (c, f) => {
118
+ try {
119
+ show(readableObject(await c.contactLists.get(String(f.id ?? ""))), f);
120
+ } catch (err) {
121
+ await fail(err, f);
122
+ }
123
+ })
124
+ });
125
+ var listsCreate = defineCommand({
126
+ meta: {
127
+ name: "create",
128
+ description: "Create an empty Contact list. Fill it with `curviate contact lists add`, `curviate contact import --list`, or build it from other lists with `curviate contact lists combine`. Needs Automate.",
129
+ risk: "write",
130
+ rules: {
131
+ changes: "A new, empty Contact list.",
132
+ visible_to: "Your Team.",
133
+ budget_rows: [],
134
+ retry: "Not safe: a list name is unique, so a repeat answers NAME_TAKEN.",
135
+ undo: "`curviate contact lists delete <id>`."
136
+ },
137
+ errors: { NAME_TAKEN: "a list of that name exists (409)." },
138
+ examples: ['curviate contact lists create "Q4 prospects" --description "From the conference"']
139
+ },
140
+ args: {
141
+ ...WRITE_SINGLE_FLAGS,
142
+ name: { type: "positional", description: "The list's name (up to 100 characters)." },
143
+ description: { type: "string", description: "What the list is for (up to 500 characters)." }
144
+ },
145
+ run: online(async (c, f) => {
146
+ const body = { name: named("the list name", f.name) };
147
+ if (f.description !== void 0) body["description"] = f.description;
148
+ if (f.preview) return preview("contactLists.create", {}, body);
149
+ try {
150
+ show(readableObject(await c.contactLists.create(body)), f);
151
+ } catch (err) {
152
+ await fail(err, f);
153
+ }
154
+ })
155
+ });
156
+ var listsCombine = defineCommand({
157
+ meta: {
158
+ name: "combine",
159
+ description: "Create a new Contact list from other lists: the Contacts in any of them (--list a --list b), in all of them (--list-match all), minus those in some others (--not-list). Any other filter flag narrows it too. The new list holds the Contacts that match now; it does not follow later changes to the source lists. Needs Automate.",
160
+ risk: "write",
161
+ rules: {
162
+ changes: "A new Contact list holding every Contact the filter matches at this moment. The source lists are unchanged.",
163
+ visible_to: "Your Team.",
164
+ budget_rows: [],
165
+ retry: "Not safe: a list name is unique, so a repeat answers NAME_TAKEN.",
166
+ undo: "`curviate contact lists delete <id>`; the Contacts stay."
167
+ },
168
+ errors: { NAME_TAKEN: "a list of that name exists (409).", CONTACT_LIMIT_REACHED: "the Team is at a list-membership cap." },
169
+ seeAlso: SEE_LISTS,
170
+ examples: [
171
+ 'curviate contact lists combine "Hot or warm" --list cl_HOT --list cl_WARM',
172
+ 'curviate contact lists combine "Hot and replied" --list cl_HOT --list cl_REPLIED --list-match all --not-list cl_DNC'
173
+ ]
174
+ },
175
+ args: {
176
+ ...WRITE_SINGLE_FLAGS,
177
+ name: { type: "positional", description: "The new list's name (up to 100 characters)." },
178
+ ...FILTER_ARGS,
179
+ description: { type: "string", description: "What the list is for (up to 500 characters)." }
180
+ },
181
+ run: online(async (c, f) => {
182
+ if (listFlag("list", f.list).length === 0) usage("--list is required: the source list or lists (cl_...), repeatable.");
183
+ const body = { name: named("the list name", f.name), from: await readFilter(c, f, "body") };
184
+ if (f.description !== void 0) body["description"] = f.description;
185
+ if (f.preview) return preview("contactLists.create", {}, body);
186
+ try {
187
+ show(readableObject(await c.contactLists.create(body)), f);
188
+ } catch (err) {
189
+ await fail(err, f);
190
+ }
191
+ })
192
+ });
193
+ var listsUpdate = defineCommand({
194
+ meta: {
195
+ name: "update",
196
+ description: 'Rename a Contact list or change its description (--description "" clears it). Needs Automate.',
197
+ risk: "write",
198
+ rules: {
199
+ changes: "The list's name or description.",
200
+ visible_to: "Your Team.",
201
+ budget_rows: [],
202
+ retry: "Safe: the same call leaves the same list.",
203
+ undo: "Update again with the old values."
204
+ },
205
+ errors: { NAME_TAKEN: "a list of that name exists (409)." },
206
+ examples: ['curviate contact lists update cl_YOUR_LIST_ID --name "Q4 prospects"']
207
+ },
208
+ args: {
209
+ ...WRITE_SINGLE_FLAGS,
210
+ id: ID,
211
+ name: { type: "string", description: "The new name (up to 100 characters)." },
212
+ description: { type: "string", description: "The new description (up to 500 characters); empty clears it." }
213
+ },
214
+ run: online(async (c, f) => {
215
+ const { name, description } = f;
216
+ const body = {};
217
+ if (name !== void 0) body["name"] = named("--name", name);
218
+ if (description !== void 0) body["description"] = description === "" ? null : description;
219
+ if (Object.keys(body).length === 0) usage("name what to change: --name or --description.");
220
+ if (f.preview) return preview("contactLists.update", { id: f.id }, body);
221
+ try {
222
+ show(readableObject(await c.contactLists.update(String(f.id ?? ""), body)), f);
223
+ } catch (err) {
224
+ await fail(err, f);
225
+ }
226
+ })
227
+ });
228
+ var listsDelete = defineCommand({
229
+ meta: {
230
+ name: "delete",
231
+ description: "Delete a Contact list. Its Contacts stay; a Motion that enrolls from it needs another list. Any role may.",
232
+ risk: "high",
233
+ rules: {
234
+ changes: "The list and its memberships are deleted; the Contacts are not.",
235
+ visible_to: "Your Team.",
236
+ budget_rows: [],
237
+ retry: "Safe: a second call answers RESOURCE_NOT_FOUND.",
238
+ undo: "Cannot be undone for the list itself: create it again and add the Contacts.",
239
+ blast_radius: "One list and its membership; no Contact is deleted."
240
+ },
241
+ errors: { RESOURCE_IN_USE: "a Motion still uses the list (409)." },
242
+ seeAlso: SEE_LISTS,
243
+ examples: ["curviate contact lists delete cl_YOUR_LIST_ID"]
244
+ },
245
+ args: { ...WRITE_SINGLE_FLAGS, id: ID },
246
+ run: online(async (c, f) => {
247
+ if (f.preview) return preview("contactLists.delete", { id: f.id });
248
+ try {
249
+ await c.contactLists.delete(String(f.id ?? ""));
250
+ show({}, f);
251
+ } catch (err) {
252
+ await fail(err, f);
253
+ }
254
+ })
255
+ });
256
+ var membership = (verb) => defineCommand({
257
+ meta: {
258
+ name: verb,
259
+ description: `${verb === "add" ? "Add Contacts to" : "Remove Contacts from"} a Contact list. Name the Contacts by id, or with filter flags (the same as \`curviate contact list\`) to act on every match. Count a filter first: \`curviate contact list <same filters> --total --limit 1\`. Needs Automate.`,
260
+ risk: "high",
261
+ rules: {
262
+ changes: verb === "add" ? "The Contacts join the list." : "The Contacts leave the list; they are not deleted.",
263
+ visible_to: "Your Team; a Motion enrolling from the list sees the change.",
264
+ budget_rows: [],
265
+ retry: "Safe: a Contact already in (or out) is `unchanged`.",
266
+ undo: verb === "add" ? "`curviate contact lists remove` with the same Contacts." : "`curviate contact lists add` with the same Contacts.",
267
+ blast_radius: BULK_RADIUS
268
+ },
269
+ errors: BULK_ERRORS,
270
+ output: BULK_OUTPUT,
271
+ seeAlso: SEE_LISTS,
272
+ examples: [
273
+ `curviate contact lists ${verb} cl_YOUR_LIST_ID con_A con_B`,
274
+ `curviate contact lists ${verb} cl_YOUR_LIST_ID --tag hot --no-email`
275
+ ]
276
+ },
277
+ args: {
278
+ ...WRITE_SINGLE_FLAGS,
279
+ listId: { type: "positional", description: "Contact list id (cl_...)." },
280
+ ...IDS,
281
+ ...Object.fromEntries(Object.entries(FILTER_ARGS).filter(([k]) => k !== "list")),
282
+ "from-list": { type: "string", description: "Filter: only Contacts in this Contact list (cl_...); repeatable, or a comma list." }
283
+ },
284
+ run: online(async (c, f) => {
285
+ const listId = named("the list id", (f._ ?? [])[0]);
286
+ const fromList = f["from-list"];
287
+ const filtered = { ...f, ...fromList !== void 0 ? { list: fromList } : {} };
288
+ await bulkUpdate(c, filtered, 1, verb === "add" ? { add_list_id: listId } : { remove_list_id: listId });
289
+ })
290
+ });
291
+ var contactListsCommand = defineCommand({
292
+ meta: { name: "lists", description: "Contact lists: named sets of Contacts a Motion enrolls from." },
293
+ subCommands: { list: listsList, get: listsGet, create: listsCreate, combine: listsCombine, update: listsUpdate, delete: listsDelete, add: membership("add"), remove: membership("remove") },
294
+ async run() {
295
+ const { showHelp } = await import("./examples-JJB4DZKK.js");
296
+ await showHelp(contactListsCommand, ["curviate", "contact", "lists"]);
297
+ }
298
+ });
299
+ var TAG_ID = { type: "positional", description: "Tag id, from `curviate contact tags list`." };
300
+ var tagsList = defineCommand({
301
+ meta: { name: "list", description: "List your Team's Tags with how many Contacts carry each.", risk: "read", examples: ["curviate contact tags list"] },
302
+ args: { ...readOnly(GLOBAL_FLAGS) },
303
+ run: online((c, f) => page(f, {}, (p) => c.tags.list(p)))
304
+ });
305
+ var tagsUpdate = defineCommand({
306
+ meta: {
307
+ name: "update",
308
+ description: "Rename a Tag on every Contact that carries it. A name another Tag has is refused. Needs Automate.",
309
+ risk: "write",
310
+ rules: {
311
+ changes: "The Tag's name, on all its Contacts.",
312
+ visible_to: "Your Team.",
313
+ budget_rows: [],
314
+ retry: "Safe: the same call leaves the same name.",
315
+ undo: "Rename it back."
316
+ },
317
+ errors: { NAME_TAKEN: "a Tag of that name exists (409)." },
318
+ examples: ["curviate contact tags update TAG_ID --name warm-lead"]
319
+ },
320
+ args: { ...WRITE_SINGLE_FLAGS, id: TAG_ID, name: { type: "string", required: true, description: "The new name (up to 64 characters)." } },
321
+ run: online(async (c, f) => {
322
+ const name = required("name", f.name, "the Tag's new name");
323
+ if (f.preview) return preview("tags.update", { id: f.id }, { name });
324
+ try {
325
+ show(readableObject(await c.tags.update(String(f.id ?? ""), { name })), f);
326
+ } catch (err) {
327
+ await fail(err, f);
328
+ }
329
+ })
330
+ });
331
+ var tagsDelete = defineCommand({
332
+ meta: {
333
+ name: "delete",
334
+ description: "Delete a Tag and take it off every Contact that carries it. Owners and Managers only.",
335
+ risk: "high",
336
+ rules: {
337
+ changes: "The Tag is removed from every Contact; the Contacts stay.",
338
+ visible_to: "Your Team.",
339
+ budget_rows: [],
340
+ retry: "Safe: a second call answers RESOURCE_NOT_FOUND.",
341
+ undo: "Cannot be undone: tag the Contacts again.",
342
+ blast_radius: "One Tag, on every Contact that carries it (its `contact_count`)."
343
+ },
344
+ errors: { INSUFFICIENT_ROLE: "deleting Tags is for Owners and Managers." },
345
+ seeAlso: ["curviate contact tags list"],
346
+ examples: ["curviate contact tags delete TAG_ID"]
347
+ },
348
+ args: { ...WRITE_SINGLE_FLAGS, id: TAG_ID },
349
+ run: online(async (c, f) => {
350
+ if (f.preview) return preview("tags.delete", { id: f.id });
351
+ try {
352
+ await c.tags.delete(String(f.id ?? ""));
353
+ show({}, f);
354
+ } catch (err) {
355
+ await fail(err, f);
356
+ }
357
+ })
358
+ });
359
+ var tagging = (verb) => defineCommand({
360
+ meta: {
361
+ name: verb,
362
+ description: `${verb === "add" ? "Put a Tag on" : "Take a Tag off"} Contacts, named by id or with filter flags (the same as \`curviate contact list\`) to act on every match. Count a filter first: \`curviate contact list <same filters> --total --limit 1\`. Needs Automate.`,
363
+ risk: "high",
364
+ rules: {
365
+ changes: verb === "add" ? "The Tag is put on the Contacts (created if new)." : "The Tag is taken off the Contacts.",
366
+ visible_to: "Your Team.",
367
+ budget_rows: [],
368
+ retry: "Safe: a Contact already tagged (or not) is `unchanged`.",
369
+ undo: verb === "add" ? "`curviate contact tags remove` with the same Contacts." : "`curviate contact tags add` with the same Contacts.",
370
+ blast_radius: BULK_RADIUS
371
+ },
372
+ errors: BULK_ERRORS,
373
+ output: BULK_OUTPUT,
374
+ seeAlso: ["curviate contact tags list", "curviate contact list"],
375
+ examples: [`curviate contact tags ${verb} hot con_A con_B`, `curviate contact tags ${verb} hot --list cl_YOUR_LIST_ID`]
376
+ },
377
+ args: {
378
+ ...WRITE_SINGLE_FLAGS,
379
+ tagName: { type: "positional", description: "The Tag's name (up to 64 characters), any casing." },
380
+ ...IDS,
381
+ ...FILTER_ARGS
382
+ },
383
+ run: online(async (c, f) => {
384
+ const tag = named("the Tag name", (f._ ?? [])[0]);
385
+ await bulkUpdate(c, f, 1, verb === "add" ? { add_tags: [tag] } : { remove_tags: [tag] });
386
+ })
387
+ });
388
+ var contactTagsCommand = defineCommand({
389
+ meta: { name: "tags", description: "Tags: labels on Contacts." },
390
+ subCommands: { list: tagsList, update: tagsUpdate, delete: tagsDelete, add: tagging("add"), remove: tagging("remove") },
391
+ async run() {
392
+ const { showHelp } = await import("./examples-JJB4DZKK.js");
393
+ await showHelp(contactTagsCommand, ["curviate", "contact", "tags"]);
394
+ }
395
+ });
396
+ export {
397
+ contactListsCommand,
398
+ contactTagsCommand
399
+ };