@curviate/cli 0.58.0 → 0.59.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 (58) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/{account-GSL6BCNX.js → account-EUHYWIDH.js} +5 -5
  3. package/dist/{analytics-4FUMJSMC.js → analytics-SQQIMSLF.js} +5 -5
  4. package/dist/{beta-consent-EC2QF6CM.js → beta-consent-DFS7YMZR.js} +3 -3
  5. package/dist/{billing-STRNXA4H.js → billing-3FRIQFY3.js} +5 -5
  6. package/dist/{chunk-KUVJM5CP.js → chunk-5AJS2V4T.js} +1 -1
  7. package/dist/{chunk-WGGZWJPO.js → chunk-72PYX57P.js} +10 -10
  8. package/dist/{chunk-7F6B7P32.js → chunk-7CSXYRSO.js} +6 -6
  9. package/dist/{chunk-5OAJ4D65.js → chunk-F3FEY4D5.js} +1 -1
  10. package/dist/{chunk-MLZSXQZC.js → chunk-HG2G5OAZ.js} +1 -1
  11. package/dist/{chunk-3IL3D5IZ.js → chunk-HJ7YY4HE.js} +1 -1
  12. package/dist/{chunk-PBJZQZPO.js → chunk-KD2XY7RS.js} +1 -1
  13. package/dist/{chunk-XXB4MAX3.js → chunk-QRTMRTKA.js} +6 -5
  14. package/dist/{chunk-KS4I4B3Z.js → chunk-R2MIDSMB.js} +4 -4
  15. package/dist/{chunk-WITIJCUU.js → chunk-TNLIV3SW.js} +5 -5
  16. package/dist/{chunk-CQHCPZ5I.js → chunk-VKHAL6WT.js} +1 -1
  17. package/dist/{chunk-XDPU2YAF.js → chunk-ZC4S4B32.js} +1 -1
  18. package/dist/cli.js +26 -26
  19. package/dist/{comment-MUELYZYN.js → comment-DA6XPY4F.js} +5 -5
  20. package/dist/{company-5N7CXORR.js → company-IWVNUBWS.js} +5 -5
  21. package/dist/{company-record-HWLTP4TV.js → company-record-ZJMW3NC6.js} +8 -8
  22. package/dist/{config-PI7JMQ2L.js → config-P4HKPOCW.js} +2 -2
  23. package/dist/{connect-NNZOOPWV.js → connect-AELFEVR7.js} +4 -4
  24. package/dist/{contact-VNG7HRCN.js → contact-FHN3A7MJ.js} +7 -7
  25. package/dist/{contact-groups-6JF7VX6Q.js → contact-groups-HNZTN6I6.js} +7 -7
  26. package/dist/{contact-import-TMJWY2VD.js → contact-import-PJFRLCHR.js} +8 -8
  27. package/dist/{core-ZRJY3HTF.js → core-R7R44CVA.js} +17 -17
  28. package/dist/{do-not-contact-GDVIUNMT.js → do-not-contact-KSH36NMT.js} +8 -8
  29. package/dist/{doctor-ZNAR5AZ2.js → doctor-BEO4E227.js} +3 -3
  30. package/dist/{domain-62YUYVDW.js → domain-HF3WXWUT.js} +4 -4
  31. package/dist/{draft-ED6RL67K.js → draft-2KBRHBBH.js} +3 -3
  32. package/dist/{enrollment-LN3Z3RC5.js → enrollment-QPE54QQN.js} +4 -4
  33. package/dist/{export-S6D4FEAG.js → export-J4JQRE2A.js} +3 -3
  34. package/dist/{feed-AC7HWUCD.js → feed-PHF2ROIT.js} +4 -4
  35. package/dist/{group-6N37Q5ZS.js → group-SLXDOCHV.js} +4 -4
  36. package/dist/{inbox-JFRBROQ2.js → inbox-IDILZLPC.js} +4 -4
  37. package/dist/{inboxes-IBZHZKSD.js → inboxes-QLP5PWTS.js} +4 -4
  38. package/dist/{incoming-YDRPPO24.js → incoming-XG6IBPU6.js} +4 -4
  39. package/dist/{job-CSRHIFZM.js → job-WUYHK6OX.js} +4 -4
  40. package/dist/{login-M7ZLOR2U.js → login-3RIU257N.js} +2 -2
  41. package/dist/{mailbox-E2K3I2VH.js → mailbox-CJRCYZGL.js} +77 -17
  42. package/dist/{message-SX6RDGWP.js → message-EBVO4ZZI.js} +5 -5
  43. package/dist/{motion-4HH3OFI6.js → motion-7XQ3E4GI.js} +5 -5
  44. package/dist/{network-JQYLSQDH.js → network-X5XL44GB.js} +4 -4
  45. package/dist/{notification-ZAQM463D.js → notification-QNGHG5EO.js} +4 -4
  46. package/dist/{notifications-N55F3DP3.js → notifications-MOLNELNE.js} +4 -4
  47. package/dist/{post-SIHHJX3P.js → post-XYSFN5OP.js} +5 -5
  48. package/dist/{profile-VBHX3QGP.js → profile-7LJLU4Y5.js} +5 -5
  49. package/dist/{recruiter-7AGFKQPI.js → recruiter-ALQNIRYR.js} +4 -4
  50. package/dist/{sales-nav-ADVFBKWB.js → sales-nav-HYZXNYCC.js} +4 -4
  51. package/dist/{search-THJFPGOH.js → search-DNCPCFRR.js} +4 -4
  52. package/dist/{setup-D6D7SNND.js → setup-QI5FW6VD.js} +3 -3
  53. package/dist/{signal-TGSF7WEP.js → signal-J2TLIT47.js} +4 -4
  54. package/dist/{team-MVNHCWJP.js → team-PPPCJ5HT.js} +4 -4
  55. package/dist/{tier-DAF7Y2HN.js → tier-NFWWW34H.js} +4 -4
  56. package/dist/{unibox-7B6B4SXB.js → unibox-52C7G5LK.js} +43 -19
  57. package/dist/{webhook-NUVSTDXF.js → webhook-J3JYMSY2.js} +4 -4
  58. package/package.json +2 -2
@@ -5,7 +5,7 @@ import {
5
5
  outputOpts,
6
6
  rootClient,
7
7
  usage
8
- } from "./chunk-5OAJ4D65.js";
8
+ } from "./chunk-F3FEY4D5.js";
9
9
  import {
10
10
  buildPreviewOutput
11
11
  } from "./chunk-TCUYH5GO.js";
@@ -20,7 +20,7 @@ import {
20
20
  readablePage,
21
21
  rejectPaginationModifiersWithoutAll,
22
22
  streamAll
23
- } from "./chunk-KUVJM5CP.js";
23
+ } from "./chunk-5AJS2V4T.js";
24
24
  import {
25
25
  renderSuccess,
26
26
  writeNdjsonItem
@@ -30,7 +30,7 @@ import {
30
30
  readConfig,
31
31
  resolveEffectiveConfig,
32
32
  writeProfile
33
- } from "./chunk-PBJZQZPO.js";
33
+ } from "./chunk-KD2XY7RS.js";
34
34
  import {
35
35
  GLOBAL_FLAGS,
36
36
  READ_SINGLE_FLAGS,
@@ -39,7 +39,7 @@ import {
39
39
  } from "./chunk-QLKGOIWS.js";
40
40
  import {
41
41
  DESCRIPTIONS
42
- } from "./chunk-XDPU2YAF.js";
42
+ } from "./chunk-ZC4S4B32.js";
43
43
  import "./chunk-ZYURL5VK.js";
44
44
 
45
45
  // src/commands/team.ts
@@ -3,21 +3,21 @@ import {
3
3
  fail,
4
4
  outputOpts,
5
5
  rootClient
6
- } from "./chunk-5OAJ4D65.js";
6
+ } from "./chunk-F3FEY4D5.js";
7
7
  import {
8
8
  readableObject
9
- } from "./chunk-KUVJM5CP.js";
9
+ } from "./chunk-5AJS2V4T.js";
10
10
  import {
11
11
  renderSuccess
12
12
  } from "./chunk-QM57YDJE.js";
13
- import "./chunk-PBJZQZPO.js";
13
+ import "./chunk-KD2XY7RS.js";
14
14
  import {
15
15
  READ_SINGLE_FLAGS,
16
16
  readOnly
17
17
  } from "./chunk-QLKGOIWS.js";
18
18
  import {
19
19
  DESCRIPTIONS
20
- } from "./chunk-XDPU2YAF.js";
20
+ } from "./chunk-ZC4S4B32.js";
21
21
  import "./chunk-ZYURL5VK.js";
22
22
 
23
23
  // src/commands/tier.ts
@@ -5,6 +5,7 @@ import {
5
5
  } from "./chunk-5S3MJVI5.js";
6
6
  import {
7
7
  AttachError,
8
+ openUpload,
8
9
  readAttachment,
9
10
  toAttachmentPayload
10
11
  } from "./chunk-JY26SUNH.js";
@@ -14,7 +15,7 @@ import {
14
15
  outputOpts,
15
16
  rootClient,
16
17
  usage
17
- } from "./chunk-5OAJ4D65.js";
18
+ } from "./chunk-F3FEY4D5.js";
18
19
  import {
19
20
  buildPreviewOutput
20
21
  } from "./chunk-TCUYH5GO.js";
@@ -28,12 +29,12 @@ import {
28
29
  readablePage,
29
30
  rejectPaginationModifiersWithoutAll,
30
31
  streamAll
31
- } from "./chunk-KUVJM5CP.js";
32
+ } from "./chunk-5AJS2V4T.js";
32
33
  import {
33
34
  renderSuccess,
34
35
  writeNdjsonItem
35
36
  } from "./chunk-QM57YDJE.js";
36
- import "./chunk-PBJZQZPO.js";
37
+ import "./chunk-KD2XY7RS.js";
37
38
  import {
38
39
  GLOBAL_FLAGS,
39
40
  WRITE_SINGLE_FLAGS,
@@ -41,13 +42,16 @@ import {
41
42
  } from "./chunk-QLKGOIWS.js";
42
43
  import {
43
44
  DESCRIPTIONS
44
- } from "./chunk-XDPU2YAF.js";
45
+ } from "./chunk-ZC4S4B32.js";
45
46
  import "./chunk-ZYURL5VK.js";
46
47
 
47
48
  // src/commands/unibox.ts
48
49
  import { defineCommand } from "citty";
50
+ import { stat } from "fs/promises";
51
+ import { basename } from "path";
49
52
  var EMAIL_MAX_FILES = 10;
50
53
  var EMAIL_MAX_FILE_BYTES = 20 * 1024 * 1024;
54
+ var EMAIL_INLINE_MAX_BYTES = 6 * 1024 * 1024;
51
55
  var ids = (f) => ({ accountId: String(f.accountId ?? ""), chatId: String(f.chatId ?? "") });
52
56
  var preview = (method, args, body = {}) => print(JSON.stringify(buildPreviewOutput({ method, args, body })));
53
57
  async function paged(f, params, fetch, human) {
@@ -88,10 +92,14 @@ async function runList(c, f) {
88
92
  const unread = (i) => i["unread"] ? i["marked_unread"] ? "marked" : "yes" : "";
89
93
  const campaign = (i) => i["campaign_context"]?.["campaign_name"];
90
94
  const label = (i) => i["reply_label"]?.["label"];
95
+ const channels = (i) => (i["channels"] ?? []).join("+");
96
+ const marks = (i) => Object.entries(i["marks"] ?? {}).filter(([, v]) => v).map(([k]) => k).join(", ");
97
+ const next = (i) => [i["chat_id"] ? "reply" : "", i["channels"]?.includes("email") && !marks(i) ? "email" : ""].filter(Boolean).join(", ");
91
98
  print(table(
92
- ["ACCOUNT", "CHAT", "WITH", "UNREAD", "LAST", "FROM", "LABEL", "CAMPAIGN", "TAGS"],
93
- page.items.map((i) => [i["account_id"], i["chat_id"], chatWith(i), unread(i), i["last_activity_at"], i["last_message_from"], label(i), campaign(i), i["tags"]?.join(", ")])
99
+ ["ACCOUNT", "CHAT", "WITH", "CHANNELS", "UNREAD", "LAST", "FROM", "LABEL", "MARKS", "NEXT", "CAMPAIGN", "TAGS", "CONVERSATION"],
100
+ page.items.map((i) => [i["account_id"], i["chat_id"], chatWith(i), channels(i), unread(i), i["last_activity_at"], i["last_message_from"], label(i), marks(i), next(i), campaign(i), i["tags"]?.join(", "), i["conversation_id"]])
94
101
  ));
102
+ if (page.items.length) print('NEXT reply: `curviate unibox reply <ACCOUNT> <CHAT> "<text>"`; email: `curviate unibox email send <CONVERSATION> "<text>" --thread <thread_id>` (threads: `curviate unibox conversation timeline <CONVERSATION> --channel email`). An email-only conversation has no CHAT and takes email only.');
95
103
  if (typeof page["total"] === "number") print(`total: ${page["total"]} chats match`);
96
104
  });
97
105
  } catch (err) {
@@ -151,23 +159,37 @@ async function runEmailSend(c, f) {
151
159
  if (bcc.length) body["bcc"] = bcc;
152
160
  const paths = f.attach === void 0 ? [] : [].concat(f.attach);
153
161
  if (paths.length > EMAIL_MAX_FILES) usage(`--attach takes at most ${EMAIL_MAX_FILES} files.`);
154
- const files = [];
162
+ const sizes = [];
155
163
  for (const p of paths) {
156
164
  try {
157
- files.push({ path: p, buf: await readAttachment(p) });
165
+ const st = await stat(p);
166
+ if (!st.isFile()) throw new Error("not a file");
167
+ sizes.push(st.size);
158
168
  } catch (err) {
159
- if (err instanceof AttachError) usage(err.message);
160
- throw err;
169
+ usage(`Cannot read attachment "${basename(p)}": ${err instanceof Error ? err.message : "unknown error"}. Pass a valid file path.`);
161
170
  }
162
171
  }
163
- const total = files.reduce((n, x) => n + x.buf.length, 0);
172
+ const total = sizes.reduce((n, x) => n + x, 0);
164
173
  if (total > EMAIL_MAX_FILE_BYTES) usage(`--attach: the files total ${total} bytes, over 20 MiB; nothing was sent. A link usually lands better than a file.`);
165
- if (files.length) body["attachments"] = files.map((x) => {
166
- const a = toAttachmentPayload(x.path, x.buf);
167
- return { filename: a.filename, content_type: a.content_type, content: a.content };
168
- });
169
- if (f.preview) return void print(JSON.stringify(buildPreviewOutput({ method: "unibox.sendEmail", args: { conversation_id: id }, body: { ...body, attachments: void 0 }, attachments: files.map((x) => ({ name: x.path.split("/").pop(), buffer: x.buf })) })));
174
+ const byId = total > EMAIL_INLINE_MAX_BYTES;
175
+ if (f.preview) {
176
+ const note = byId ? { attachment_ids: paths.map((p, i) => `<upload ${basename(p)} (${sizes[i]} bytes)>`) } : { attachments: paths.map((p, i) => `${basename(p)} (${sizes[i]} bytes)`) };
177
+ return void print(JSON.stringify(buildPreviewOutput({ method: "unibox.sendEmail", args: { conversation_id: id }, body: { ...body, ...note } })));
178
+ }
170
179
  try {
180
+ if (byId) {
181
+ const ids2 = [];
182
+ for (const p of paths) {
183
+ const file = await openUpload(p, EMAIL_MAX_FILE_BYTES);
184
+ ids2.push((await c.campaigns.attachments.upload(file.data, { filename: basename(p) })).id);
185
+ }
186
+ body["attachment_ids"] = ids2;
187
+ } else if (paths.length) {
188
+ body["attachments"] = await Promise.all(paths.map(async (p) => {
189
+ const a = toAttachmentPayload(p, await readAttachment(p));
190
+ return { filename: a.filename, content_type: a.content_type, content: a.content };
191
+ }));
192
+ }
171
193
  const sent = await c.unibox.sendEmail(id, body);
172
194
  for (const w of sent["warnings"] ?? []) {
173
195
  process.stderr.write(`warning: ${String(w["code"])}: ${(w["addresses"] ?? []).join(", ")} got nothing; everyone else did.
@@ -175,6 +197,7 @@ async function runEmailSend(c, f) {
175
197
  }
176
198
  renderSuccess(sent, outputOpts(f), process);
177
199
  } catch (err) {
200
+ if (err instanceof AttachError) usage(err.message);
178
201
  if (err.outcomeUnknown === true) {
179
202
  process.stderr.write(`The outcome is unknown: the email may have been sent, and it is kept in the conversation as sent. Do not send it again; read \`curviate unibox conversation timeline ${id} --channel email\`.
180
203
  `);
@@ -438,7 +461,7 @@ var conversationCmd = defineCommand({
438
461
  var emailSendCmd = defineCommand({
439
462
  meta: {
440
463
  name: "send",
441
- description: "Send one plain-text email to the conversation's Lead, at once: a reply in one of its threads (--thread, a thread_id from `conversation timeline`), or a new thread (--subject, and --mailbox when more than one Mailbox can send). It goes to the Lead's one address with no signature and no opt-out line, counts against the Mailbox's daily limit, and ends the Lead's open Enrollments on this Account as a reply would. --cc and --bcc (at most 20 addresses together) and --attach (files, at most 10, 20 MiB in all, refused here before anything is sent) ride along; a link usually lands better than a file. A Cc or Bcc address the receiving server refused while it took the Lead's is a recipients_refused warning on stderr: those got nothing, everyone else did. Check first with `conversation get` that email is available. One request: a retry after a timeout can send twice, so read the timeline before you send again. An unknown outcome (the provider stopped answering after it had the whole email) exits 1, never 7: do not send it again.",
464
+ description: "Send one plain-text email to the conversation's Lead, at once: a reply in one of its threads (--thread, a thread_id from `conversation timeline`), or a new thread (--subject, and --mailbox when more than one Mailbox can send). It goes to the Lead's one address with no signature and no opt-out line, counts against the Mailbox's daily limit, and ends the Lead's open Enrollments on this Account as a reply would. --cc and --bcc (at most 20 addresses together) and --attach (files read from paths on this machine, at most 10, 20 MiB in all, refused here before anything is sent) ride along; a link usually lands better than a file. Up to 6 MiB in all the files go inside the one request; above that each is first uploaded as a file of your Team (`campaign attachment upload`, counted against its daily uploads, kept 30 days) and the email names them by id. Bcc addresses are never shown to the other recipients; do not repeat them where others read. A Cc or Bcc address the receiving server refused while it took the Lead's is a recipients_refused warning on stderr: those got nothing, everyone else did. Check first with `conversation get` that email is available. One request: a retry after a timeout can send twice, so read the timeline before you send again. An unknown outcome (the provider stopped answering after it had the whole email) exits 1, never 7: do not send it again.",
442
465
  risk: "write",
443
466
  rules: {
444
467
  changes: "An email is sent to the Lead now; their open Enrollments on this Account end as on a reply.",
@@ -451,7 +474,8 @@ var emailSendCmd = defineCommand({
451
474
  EMAIL_UNAVAILABLE: "email is not available in this conversation; reason names why (no_email_address, email_bounced, no_email, do_not_contact, no_mailbox, group_chat). Nothing is sent.",
452
475
  MAILBOX_STATE_CONFLICT: "the Mailbox needs reconnecting, is paused, or has sent its daily limit; the message names the way on.",
453
476
  DO_NOT_CONTACT: "a Cc or Bcc address is a Lead on your Do-not-contact list or opted out of email; nothing was sent.",
454
- PLATFORM_ERROR: "the provider did not take the email: nothing was sent (exit 7 when a retry may work). With an unknown outcome it may have been sent: exit 1, do not send it again.",
477
+ PLATFORM_ERROR: "the provider did not take the email: nothing was sent (exit 7 when a retry may work). reason attachment_refused: the files were refused (from a Microsoft sign-in Mailbox, more than about 2.2 MB in all, refused before anything is sent): send a link or smaller files. With an unknown outcome it may have been sent: exit 1, do not send it again.",
478
+ RESOURCE_NOT_FOUND: "no such conversation, or an uploaded file is gone; nothing was sent.",
455
479
  UNSUPPORTED_MEDIA_TYPE: "an attachment is an executable, a script or a macro-enabled Office file; nothing was sent."
456
480
  },
457
481
  seeAlso: ["curviate unibox conversation get", "curviate unibox conversation timeline"],
@@ -469,7 +493,7 @@ var emailSendCmd = defineCommand({
469
493
  mailbox: { type: "string", description: "New thread only: the Mailbox to send from (mbx_...), one of the conversation's email.mailboxes." },
470
494
  cc: { type: "string", description: "Cc addresses, repeatable or a comma list; every recipient sees them." },
471
495
  bcc: { type: "string", description: "Bcc addresses, repeatable or a comma list; no other recipient sees them." },
472
- attach: { type: "string", description: "A file to send, repeatable: at most 10, 20 MiB in all. From a Microsoft sign-in Mailbox, about 2.2 MB in all go today; more is refused with PLATFORM_ERROR and nothing is sent: send a link or a smaller file." }
496
+ attach: { type: "string", description: "A file on this machine to send, repeatable: at most 10, 20 MiB in all (never a URL). From a Microsoft sign-in Mailbox, about 2.2 MB in all go; more is refused with PLATFORM_ERROR (reason attachment_refused) and nothing is sent: send a link or a smaller file." }
473
497
  },
474
498
  run: online(runEmailSend)
475
499
  });
@@ -5,7 +5,7 @@ import {
5
5
  outputOpts,
6
6
  rootClient,
7
7
  usage
8
- } from "./chunk-5OAJ4D65.js";
8
+ } from "./chunk-F3FEY4D5.js";
9
9
  import {
10
10
  buildPreviewOutput
11
11
  } from "./chunk-TCUYH5GO.js";
@@ -20,7 +20,7 @@ import {
20
20
  readablePage,
21
21
  rejectPaginationModifiersWithoutAll,
22
22
  streamAll
23
- } from "./chunk-KUVJM5CP.js";
23
+ } from "./chunk-5AJS2V4T.js";
24
24
  import {
25
25
  renderError,
26
26
  renderSuccess,
@@ -30,7 +30,7 @@ import {
30
30
  import {
31
31
  createClient,
32
32
  resolveEffectiveConfig
33
- } from "./chunk-PBJZQZPO.js";
33
+ } from "./chunk-KD2XY7RS.js";
34
34
  import {
35
35
  GLOBAL_FLAGS,
36
36
  READ_SINGLE_FLAGS,
@@ -39,7 +39,7 @@ import {
39
39
  } from "./chunk-QLKGOIWS.js";
40
40
  import {
41
41
  DESCRIPTIONS
42
- } from "./chunk-XDPU2YAF.js";
42
+ } from "./chunk-ZC4S4B32.js";
43
43
  import {
44
44
  readFileFlag
45
45
  } from "./chunk-JKOQX46J.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curviate/cli",
3
- "version": "0.58.0",
3
+ "version": "0.59.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.54.0",
50
+ "@curviate/sdk": "0.55.0",
51
51
  "citty": "^0.1.6",
52
52
  "open": "^10.1.0"
53
53
  },