@curviate/cli 0.57.0 → 0.58.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 (68) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/README.md +9 -2
  3. package/dist/{account-IRIYB2SG.js → account-GSL6BCNX.js} +52 -16
  4. package/dist/{analytics-IRSCLVOL.js → analytics-4FUMJSMC.js} +6 -6
  5. package/dist/{beta-consent-NQVGFZL3.js → beta-consent-EC2QF6CM.js} +4 -4
  6. package/dist/billing-STRNXA4H.js +19 -0
  7. package/dist/{chunk-6OT6TS7N.js → chunk-3IL3D5IZ.js} +2 -2
  8. package/dist/{chunk-3ZQNOKEK.js → chunk-5OAJ4D65.js} +2 -2
  9. package/dist/{chunk-AMTKGO37.js → chunk-5Z3CCE5N.js} +1 -1
  10. package/dist/{billing-TCTP44ZB.js → chunk-7F6B7P32.js} +123 -12
  11. package/dist/{chunk-3B5M2RUN.js → chunk-CQHCPZ5I.js} +1 -1
  12. package/dist/{chunk-SCUTAREU.js → chunk-EWSOIFG2.js} +17 -0
  13. package/dist/{chunk-RKNW4UX4.js → chunk-JKOQX46J.js} +6 -0
  14. package/dist/{chunk-VHNF6OZD.js → chunk-JY26SUNH.js} +18 -2
  15. package/dist/{chunk-VPFV7YV3.js → chunk-KS4I4B3Z.js} +6 -6
  16. package/dist/{chunk-OE4CY3ZL.js → chunk-KUVJM5CP.js} +1 -1
  17. package/dist/{chunk-F7CLAS5Y.js → chunk-MLZSXQZC.js} +2 -2
  18. package/dist/{chunk-RXDG57B2.js → chunk-PBJZQZPO.js} +1 -1
  19. package/dist/{chunk-A6JGJGDF.js → chunk-WGGZWJPO.js} +16 -16
  20. package/dist/{chunk-AG6G3PRQ.js → chunk-WITIJCUU.js} +17 -13
  21. package/dist/{chunk-5LGKZBAY.js → chunk-XDPU2YAF.js} +4 -3
  22. package/dist/{chunk-RTT75CXE.js → chunk-XXB4MAX3.js} +86 -14
  23. package/dist/cli.js +33 -33
  24. package/dist/{comment-PNHEKGZX.js → comment-MUELYZYN.js} +8 -8
  25. package/dist/{company-OUFF23SU.js → company-5N7CXORR.js} +8 -8
  26. package/dist/{company-record-ULPDDB6L.js → company-record-HWLTP4TV.js} +95 -10
  27. package/dist/{config-U6VDNL2P.js → config-PI7JMQ2L.js} +2 -2
  28. package/dist/{connect-ICNXC37R.js → connect-NNZOOPWV.js} +11 -11
  29. package/dist/{contact-K6RIVQWU.js → contact-VNG7HRCN.js} +9 -9
  30. package/dist/{contact-groups-CNH2VB6A.js → contact-groups-6JF7VX6Q.js} +11 -11
  31. package/dist/{contact-import-FK22UTN2.js → contact-import-TMJWY2VD.js} +11 -11
  32. package/dist/core-ZRJY3HTF.js +46 -0
  33. package/dist/{do-not-contact-BQHXNHTV.js → do-not-contact-GDVIUNMT.js} +22 -20
  34. package/dist/{doctor-ZYPZF5BE.js → doctor-ZNAR5AZ2.js} +4 -4
  35. package/dist/{document-H65EXU4L.js → document-G6UND26L.js} +1 -1
  36. package/dist/{domain-HLOT6Y4A.js → domain-62YUYVDW.js} +5 -5
  37. package/dist/{draft-JGQ36JSH.js → draft-ED6RL67K.js} +5 -5
  38. package/dist/{enrollment-CF634DB4.js → enrollment-LN3Z3RC5.js} +14 -10
  39. package/dist/{examples-J4X5NEIE.js → examples-5FJS47QF.js} +2 -2
  40. package/dist/{exit-codes-P2FLCKM7.js → exit-codes-LQDMGDII.js} +1 -1
  41. package/dist/{export-ZQLDQYUZ.js → export-S6D4FEAG.js} +4 -4
  42. package/dist/{feed-RQHEDZVL.js → feed-AC7HWUCD.js} +6 -6
  43. package/dist/{group-LRMG76FN.js → group-6N37Q5ZS.js} +6 -6
  44. package/dist/{inbox-5RGG5RQG.js → inbox-JFRBROQ2.js} +6 -6
  45. package/dist/{inboxes-ZFY6ZP33.js → inboxes-IBZHZKSD.js} +6 -6
  46. package/dist/{incoming-3MJ4CP6H.js → incoming-YDRPPO24.js} +8 -8
  47. package/dist/{job-QFIUTHHT.js → job-CSRHIFZM.js} +6 -6
  48. package/dist/{login-THXWX5HZ.js → login-M7ZLOR2U.js} +2 -2
  49. package/dist/mailbox-E2K3I2VH.js +712 -0
  50. package/dist/{message-DM5OUKQS.js → message-SX6RDGWP.js} +7 -7
  51. package/dist/{motion-NKOAK7NU.js → motion-4HH3OFI6.js} +121 -16
  52. package/dist/{network-VKJUMZ2L.js → network-JQYLSQDH.js} +12 -12
  53. package/dist/{notification-XW5J6KFA.js → notification-ZAQM463D.js} +6 -6
  54. package/dist/{notifications-USYOV54R.js → notifications-N55F3DP3.js} +9 -9
  55. package/dist/{post-M2G3BK4A.js → post-SIHHJX3P.js} +8 -8
  56. package/dist/{profile-3SG64IEG.js → profile-VBHX3QGP.js} +12 -12
  57. package/dist/{recruiter-7OUGZ776.js → recruiter-7AGFKQPI.js} +9 -9
  58. package/dist/{sales-nav-HHQLLM5C.js → sales-nav-ADVFBKWB.js} +9 -9
  59. package/dist/{search-5LMSLUH4.js → search-THJFPGOH.js} +16 -16
  60. package/dist/{setup-6F4HYUSZ.js → setup-D6D7SNND.js} +4 -4
  61. package/dist/{signal-LVODDBOY.js → signal-TGSF7WEP.js} +126 -19
  62. package/dist/{team-MSOPELF6.js → team-MVNHCWJP.js} +8 -8
  63. package/dist/{tier-RXHOAQ6L.js → tier-DAF7Y2HN.js} +4 -4
  64. package/dist/{unibox-UAA6WIGZ.js → unibox-7B6B4SXB.js} +292 -14
  65. package/dist/{webhook-J2H7X766.js → webhook-NUVSTDXF.js} +12 -12
  66. package/package.json +3 -3
  67. package/dist/core-MPEBYNSL.js +0 -46
  68. package/dist/mailbox-54DPLNXA.js +0 -412
@@ -1058,6 +1058,9 @@ var documents_default = {
1058
1058
  nullable: true
1059
1059
  }
1060
1060
  },
1061
+ one_lead_per_company: {
1062
+ type: "boolean"
1063
+ },
1061
1064
  reply_scope: {
1062
1065
  type: "string",
1063
1066
  enum: [
@@ -1276,6 +1279,9 @@ var documents_default = {
1276
1279
  nullable: true
1277
1280
  }
1278
1281
  },
1282
+ one_lead_per_company: {
1283
+ type: "boolean"
1284
+ },
1279
1285
  reply_scope: {
1280
1286
  type: "string",
1281
1287
  enum: [
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/lib/attach.ts
4
- import { readFile } from "fs/promises";
4
+ import * as fs from "fs";
5
+ import { readFile, stat } from "fs/promises";
5
6
  import { basename, extname } from "path";
6
7
  var AttachError = class extends Error {
7
8
  constructor(message) {
@@ -54,6 +55,20 @@ function toAttachmentPayload(filePath, buf, sendMode) {
54
55
  function isAudioFile(filePath) {
55
56
  return guessContentType(filePath).startsWith("audio/");
56
57
  }
58
+ async function openUpload(filePath, maxBytes) {
59
+ const filename = basename(filePath);
60
+ let size;
61
+ try {
62
+ const st = await stat(filePath);
63
+ if (!st.isFile()) throw new Error("not a file");
64
+ size = st.size;
65
+ } catch (err) {
66
+ throw new AttachError(`Cannot read attachment "${filename}": ${err instanceof Error ? err.message : "unknown error"}. Pass a valid file path.`);
67
+ }
68
+ if (size > maxBytes) throw new AttachError(`"${filename}" is ${size} bytes, over the ${maxBytes / (1024 * 1024)} MiB a file may be; nothing was sent. A link usually lands better than a file.`);
69
+ const open = fs.openAsBlob;
70
+ return { data: open ? await open(filePath) : await readAttachment(filePath), size };
71
+ }
57
72
 
58
73
  export {
59
74
  AttachError,
@@ -61,5 +76,6 @@ export {
61
76
  describeAttachment,
62
77
  guessContentType,
63
78
  toAttachmentPayload,
64
- isAudioFile
79
+ isAudioFile,
80
+ openUpload
65
81
  };
@@ -18,17 +18,17 @@ import {
18
18
  isAudioFile,
19
19
  readAttachment,
20
20
  toAttachmentPayload
21
- } from "./chunk-VHNF6OZD.js";
21
+ } from "./chunk-JY26SUNH.js";
22
22
  import {
23
23
  requireAccount
24
- } from "./chunk-F7CLAS5Y.js";
24
+ } from "./chunk-MLZSXQZC.js";
25
25
  import {
26
26
  buildPreviewOutput
27
27
  } from "./chunk-TCUYH5GO.js";
28
28
  import {
29
29
  readableId,
30
30
  readableObject
31
- } from "./chunk-OE4CY3ZL.js";
31
+ } from "./chunk-KUVJM5CP.js";
32
32
  import {
33
33
  renderError,
34
34
  renderSuccess,
@@ -38,7 +38,7 @@ import {
38
38
  createClient,
39
39
  downloadBinary,
40
40
  resolveEffectiveConfig
41
- } from "./chunk-RXDG57B2.js";
41
+ } from "./chunk-PBJZQZPO.js";
42
42
  import {
43
43
  READ_SINGLE_FLAGS,
44
44
  WRITE_FLAGS,
@@ -46,7 +46,7 @@ import {
46
46
  } from "./chunk-QLKGOIWS.js";
47
47
  import {
48
48
  DESCRIPTIONS
49
- } from "./chunk-5LGKZBAY.js";
49
+ } from "./chunk-XDPU2YAF.js";
50
50
  import {
51
51
  looksLikeCommandWord,
52
52
  nearestSubcommand
@@ -153,7 +153,7 @@ var MEMBER_PROVIDER_ID_RE = /^A[CDE][A-Za-z0-9_-]{4,}$/;
153
153
  async function handleSdkError(err, outOpts, out) {
154
154
  const { CurviateError } = await import("@curviate/sdk");
155
155
  if (err instanceof CurviateError) {
156
- const { getExitCode } = await import("./exit-codes-P2FLCKM7.js");
156
+ const { getExitCode } = await import("./exit-codes-LQDMGDII.js");
157
157
  renderError(err, outOpts, out);
158
158
  process.exit(getExitCode(err));
159
159
  }
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-QM57YDJE.js";
6
6
  import {
7
7
  isPlainObject
8
- } from "./chunk-RXDG57B2.js";
8
+ } from "./chunk-PBJZQZPO.js";
9
9
 
10
10
  // src/lib/paginate.ts
11
11
  import { CurviateError } from "@curviate/sdk";
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  readablePage
4
- } from "./chunk-OE4CY3ZL.js";
4
+ } from "./chunk-KUVJM5CP.js";
5
5
  import {
6
6
  assertNoStdinPlaceholder
7
7
  } from "./chunk-ZYURL5VK.js";
8
8
  import {
9
9
  getExitCode
10
- } from "./chunk-SCUTAREU.js";
10
+ } from "./chunk-EWSOIFG2.js";
11
11
 
12
12
  // src/lib/path-safety.ts
13
13
  var UNSAFE_CHARS = /[\u0000-\u0020\u007F/\\?#%]/;
@@ -274,7 +274,7 @@ import { AsyncLocalStorage } from "async_hooks";
274
274
  import { Curviate, CurviateError as CurviateError2 } from "@curviate/sdk";
275
275
 
276
276
  // package.json
277
- var version = "0.57.0";
277
+ var version = "0.58.0";
278
278
 
279
279
  // src/lib/client.ts
280
280
  function headerStrings(headers) {
@@ -1,26 +1,26 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ requireAccount
4
+ } from "./chunk-MLZSXQZC.js";
2
5
  import {
3
6
  writeAtomic
4
7
  } from "./chunk-GOICALYQ.js";
5
- import {
6
- requireAccount
7
- } from "./chunk-F7CLAS5Y.js";
8
8
  import {
9
9
  sendInChunks
10
- } from "./chunk-6OT6TS7N.js";
10
+ } from "./chunk-3IL3D5IZ.js";
11
11
  import {
12
12
  fail,
13
13
  listFlag,
14
14
  outputOpts,
15
15
  rootClient,
16
16
  usage
17
- } from "./chunk-3ZQNOKEK.js";
18
- import {
19
- intFlag
20
- } from "./chunk-NNV2OYEF.js";
17
+ } from "./chunk-5OAJ4D65.js";
21
18
  import {
22
19
  buildPreviewOutput
23
20
  } from "./chunk-TCUYH5GO.js";
21
+ import {
22
+ intFlag
23
+ } from "./chunk-NNV2OYEF.js";
24
24
  import {
25
25
  pageDelayFromFlags,
26
26
  readCursorFlag,
@@ -29,14 +29,14 @@ import {
29
29
  readablePage,
30
30
  rejectPaginationModifiersWithoutAll,
31
31
  streamAll
32
- } from "./chunk-OE4CY3ZL.js";
32
+ } from "./chunk-KUVJM5CP.js";
33
33
  import {
34
34
  renderSuccess,
35
35
  writeNdjsonItem
36
36
  } from "./chunk-QM57YDJE.js";
37
37
  import {
38
38
  downloadBinary
39
- } from "./chunk-RXDG57B2.js";
39
+ } from "./chunk-PBJZQZPO.js";
40
40
  import {
41
41
  GLOBAL_FLAGS,
42
42
  READ_SINGLE_FLAGS,
@@ -46,7 +46,7 @@ import {
46
46
  import {
47
47
  DESCRIPTIONS,
48
48
  lazy
49
- } from "./chunk-5LGKZBAY.js";
49
+ } from "./chunk-XDPU2YAF.js";
50
50
 
51
51
  // src/commands/contact.ts
52
52
  import { defineCommand } from "citty";
@@ -503,15 +503,15 @@ var contactCommand = defineCommand({
503
503
  create: createCmd,
504
504
  update: updateCmd,
505
505
  delete: deleteCmd,
506
- import: lazy("contactImport", () => import("./contact-import-FK22UTN2.js").then((m) => m.contactImportCommand)),
506
+ import: lazy("contactImport", () => import("./contact-import-TMJWY2VD.js").then((m) => m.contactImportCommand)),
507
507
  export: exportCmd,
508
508
  enrich: enrichCmd,
509
- lists: lazy("contactLists", () => import("./contact-groups-CNH2VB6A.js").then((m) => m.contactListsCommand)),
510
- tags: lazy("contactTags", () => import("./contact-groups-CNH2VB6A.js").then((m) => m.contactTagsCommand)),
511
- imports: lazy("contactImports", () => import("./contact-import-FK22UTN2.js").then((m) => m.contactImportsCommand))
509
+ lists: lazy("contactLists", () => import("./contact-groups-6JF7VX6Q.js").then((m) => m.contactListsCommand)),
510
+ tags: lazy("contactTags", () => import("./contact-groups-6JF7VX6Q.js").then((m) => m.contactTagsCommand)),
511
+ imports: lazy("contactImports", () => import("./contact-import-TMJWY2VD.js").then((m) => m.contactImportsCommand))
512
512
  },
513
513
  async run() {
514
- const { showHelp } = await import("./examples-J4X5NEIE.js");
514
+ const { showHelp } = await import("./examples-5FJS47QF.js");
515
515
  await showHelp(contactCommand, ["curviate", "lead"]);
516
516
  }
517
517
  });
@@ -2,16 +2,16 @@
2
2
  import {
3
3
  online,
4
4
  preview
5
- } from "./chunk-A6JGJGDF.js";
5
+ } from "./chunk-WGGZWJPO.js";
6
6
  import {
7
7
  sendChunked
8
- } from "./chunk-6OT6TS7N.js";
8
+ } from "./chunk-3IL3D5IZ.js";
9
9
  import {
10
10
  fail,
11
11
  listFlag,
12
12
  outputOpts,
13
13
  usage
14
- } from "./chunk-3ZQNOKEK.js";
14
+ } from "./chunk-5OAJ4D65.js";
15
15
  import {
16
16
  intFlag
17
17
  } from "./chunk-NNV2OYEF.js";
@@ -23,14 +23,14 @@ import {
23
23
  readablePage,
24
24
  rejectPaginationModifiersWithoutAll,
25
25
  streamAll
26
- } from "./chunk-OE4CY3ZL.js";
26
+ } from "./chunk-KUVJM5CP.js";
27
27
  import {
28
28
  renderSuccess,
29
29
  writeNdjsonItem
30
30
  } from "./chunk-QM57YDJE.js";
31
31
  import {
32
32
  withWireNotes
33
- } from "./chunk-RXDG57B2.js";
33
+ } from "./chunk-PBJZQZPO.js";
34
34
  import {
35
35
  GLOBAL_FLAGS,
36
36
  WRITE_SINGLE_FLAGS,
@@ -38,7 +38,7 @@ import {
38
38
  } from "./chunk-QLKGOIWS.js";
39
39
  import {
40
40
  readFileFlag
41
- } from "./chunk-RKNW4UX4.js";
41
+ } from "./chunk-JKOQX46J.js";
42
42
  import {
43
43
  isStdinToken
44
44
  } from "./chunk-ZYURL5VK.js";
@@ -194,8 +194,9 @@ async function recover(c, body, rows, seen, started, notes, err, k, n) {
194
194
  say(`Import ${k} of ${n}: the API did apply it. Import ${found.id} is ${found.status}${found.status === "completed" ? ` (${COUNTS.map((x) => `${x} ${found.counts?.[x] ?? 0}`).join(", ")})` : ""}.`);
195
195
  return found;
196
196
  }
197
- var SOURCE_KINDS = ["people_search", "company_people", "sales_nav_search", "sales_nav_lead_list", "recruiter_search", "post_engagers", "group_members"];
197
+ var SOURCE_KINDS = ["people_search", "company_people", "sales_nav_search", "sales_nav_lead_list", "sales_nav_account_list", "sales_nav_company_people", "recruiter_search", "post_engagers", "group_members"];
198
198
  function kindOfUrl(url) {
199
+ if (/linkedin\.com\/sales\/search\/compan/i.test(url)) return "sales_nav_company_people";
199
200
  if (/linkedin\.com\/sales\//i.test(url)) return "sales_nav_search";
200
201
  if (/linkedin\.com\/talent\//i.test(url)) return "recruiter_search";
201
202
  if (/\/search\/results\/people/i.test(url)) return "people_search";
@@ -378,14 +379,17 @@ var importCmd = defineCommand({
378
379
  delimiter: { type: "string", description: "A CSV's separator: comma, semicolon or tab. Default: found by the server." },
379
380
  async: { type: "boolean", description: "Print the imports' ids as soon as each is accepted and exit 0, without waiting for them to finish; follow one with `curviate lead imports get IMPORT_ID`. Stops only on a refused request." },
380
381
  "no-wait": { type: "boolean", description: "Same as --async." },
381
- source: { type: "string", description: "Import from LinkedIn instead of a file: people_search, sales_nav_search, recruiter_search (a pasted --source-url or --filter), company_people (a company search plus --titles), sales_nav_lead_list (--list-id), post_engagers (--post-id) or group_members (--group-id). Default with --source-url: the kind the URL names." },
382
- "source-url": { type: "string", description: "A pasted LinkedIn search URL (people, Sales Navigator, Recruiter or company search)." },
383
- filter: { type: "string", description: "A built search instead of a URL: key=value, repeatable (a key given twice becomes a list). The keys are the kind's search filters." },
382
+ source: { type: "string", description: "Import from LinkedIn instead of a file: people_search, sales_nav_search, recruiter_search (a pasted --source-url or --filter), company_people (a company search plus --titles), sales_nav_lead_list (--list-id), sales_nav_account_list (--list-id, --titles optional), sales_nav_company_people (a Sales Navigator account search --source-url or --filter, plus --titles), post_engagers (--post-id) or group_members (--group-id). Default with --source-url: the kind the URL names." },
383
+ "source-url": { type: "string", description: "A pasted LinkedIn search URL (people, Sales Navigator lead or account, Recruiter or company search)." },
384
+ filter: {
385
+ type: "string",
386
+ description: "A built search instead of a URL: key=value, repeatable (a key given twice becomes a list). The keys each kind offers: people_search: keywords, advanced_keywords (job title as text, use --filters-json), location, current_company, past_company, school, industry, service, network_distance (location and network_distance exclude each other); company_people (the company step): keywords, industry, location, headcount, has_job_postings; recruiter_search: keywords, job_function, workplace_type (ON_SITE, HYBRID, REMOTE), group; sales_nav_search: the Sales Navigator lead search filters (job titles are lookup ids from `curviate core sales-nav search parameters`); sales_nav_company_people (the account step): the Sales Navigator account search filters. Any other key is refused naming it (connections_of and followers_of are not offered on people_search)."
387
+ },
384
388
  "filters-json": { type: "string", description: "The built search as one JSON object. Not with --filter." },
385
- "list-id": { type: "string", description: "The Sales Navigator lead list id (sales_nav_lead_list)." },
389
+ "list-id": { type: "string", description: "The Sales Navigator lead list id (sales_nav_lead_list) or account list id (sales_nav_account_list)." },
386
390
  "post-id": { type: "string", description: "The post id or URL (post_engagers)." },
387
391
  "group-id": { type: "string", description: "A LinkedIn group id the Account belongs to (group_members)." },
388
- titles: { type: "string", description: "Job titles to keep, repeatable or a comma list (company_people: required)." },
392
+ titles: { type: "string", description: "Job titles to keep, repeatable or a comma list (company_people and sales_nav_company_people: required; sales_nav_account_list: optional). Only people with one of them are imported, never a whole company." },
389
393
  max: { type: "string", description: "Stop after this many people (default and maximum: the kind's cap)." },
390
394
  continue: { type: "string", description: "Continue this earlier import of the same source (imp_...) from where it stopped." },
391
395
  restart: { type: "boolean", description: "Read the source from the beginning, even when an earlier import of it could continue." }
@@ -476,7 +480,7 @@ var contactImportsCommand = defineCommand({
476
480
  meta: { name: "imports", description: "Your Team's import records." },
477
481
  subCommands: { list: importsList, get: importsGet, pause: importsPause, resume: importsResume, stop: importsStop },
478
482
  async run() {
479
- const { showHelp } = await import("./examples-J4X5NEIE.js");
483
+ const { showHelp } = await import("./examples-5FJS47QF.js");
480
484
  await showHelp(contactImportsCommand, ["curviate", "lead", "imports"]);
481
485
  }
482
486
  });
@@ -7,12 +7,13 @@ var DESCRIPTIONS = {
7
7
  login: "Save an API key to a local profile. Run `curviate core profile me` to verify.",
8
8
  config: "Manage CLI profiles and settings.",
9
9
  account: "LinkedIn account connection management.",
10
- campaign: "Campaigns: one Sequence run for the Leads of your Team's Lead lists, from its sending Accounts, paced on a schedule. Create and edit drafts, preview, start, pause, resume, archive, add or remove Leads; lint a Sequence and write a template offline; upload the audio of a voice note step (`curviate campaign voice-clip`). Your Team's data: every role reads; writes need send access to each sending Account, and Campaigns need the Automate plan.",
10
+ campaign: "Campaigns: one Sequence run for the Leads of your Team's Lead lists, from its sending Accounts, paced on a schedule. Create and edit drafts, preview, start, pause, resume, archive, add or remove Leads; lint a Sequence and write a template offline; upload the audio of a voice note step (`curviate campaign voice-clip`) and the files of an email step (`curviate campaign attachment`). Your Team's data: every role reads; writes need send access to each sending Account, and Campaigns need the Automate plan.",
11
+ campaignAttachment: "Campaign attachments: the files an email step sends. Upload one file (up to 20 MiB), then put its id in the step's `attachment_ids`; read one back. Nothing is sent until a Campaign that uses it is started. Uploads need the Automate plan.",
11
12
  campaignVoiceClip: "Voice clips: the audio a `voice.send` step plays. Upload one audio file (1 to 120 seconds, up to 20 MiB), then put its id in a Sequence as `clip_id`; read one back. Nothing reaches LinkedIn until a Campaign that uses it is started. Uploads need the Automate plan.",
12
13
  enrollment: "Enrollments: one Lead in one Campaign 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.",
13
14
  lead: "Leads: the people in your Team's lists, not LinkedIn actions. List, read, add, change and delete them; import and export; enrich from LinkedIn profiles. Subgroups: `curviate lead lists` (Lead lists, including combining lists), `curviate lead tags`, `curviate lead imports`. Your Team's data: every role reads and writes; deleting is for Owners and Managers.",
14
15
  "do-not-contact": "Do-not-contact: your Team's one list of people no Campaign contacts and no write reaches (a write toward them exits 10). List, read, add, change the reason, remove, export and import a file. Any member adds and imports; removing and exporting are for Owners and Managers.",
15
- mailbox: "Mailboxes: your Team's own email Mailboxes, the addresses Campaigns send from. List, read, set who a Mailbox sends for, its daily cap and signature, pause, resume, remove, find the settings for an address (discover), connect and reconnect (a password goes in only through --password-stdin). Every role reads; Owners and Managers change any Mailbox, a Member the ones they connected. A Mailbox takes no seat and is never billed.",
16
+ mailbox: "Mailboxes: your Team's own email Mailboxes, the addresses Campaigns send from. List, read, set who a Mailbox sends for, its daily cap and signature, pause, resume, remove, find the settings for an address (discover), connect and reconnect (a password goes in only through --password-stdin), run a placement test (test, tests). Every role reads; Owners and Managers change any Mailbox, a Member the ones they connected. Your own Mailbox takes no seat and is never billed; Mailboxes from Curviate cost $5 a month each (buy, purchase; Owners only, and an order through an API key stays under the Team's cap on them).",
16
17
  domain: "Domains: the DNS health of a sending domain (MX, SPF, DKIM, DMARC, tracking). `curviate domain check`, with --now to run the checks now.",
17
18
  billing: "Billing: the price of seats, the spending cap, the change log, your Team's invoices (listed and downloaded as PDFs), and moving a previous price to the current one (`price move`, charges money). Owners only. Seats and the Tier are under `curviate account seats`, `curviate team` and `curviate tier`.",
18
19
  contactImport: "Import Leads from a CSV, JSON or NDJSON file into a Lead list, splitting a large file into several imports.",
@@ -32,7 +33,7 @@ var DESCRIPTIONS = {
32
33
  profile: "LinkedIn profile operations.",
33
34
  company: "Fetch a company profile by URL, slug, or numeric id, and its sub-resources.",
34
35
  companyRecord: "Your Team's own record of a company, by LinkedIn's numeric company id: what Curviate stored and your company fields ({{company.extra.<key>}} in a Sequence). No LinkedIn call. The LinkedIn company page is `curviate core company`.",
35
- signal: "Signals: what people did around your Accounts in the last 7 days (reacted, commented, viewed a profile, followed, mentioned, reposted, posted, connected), each Account's Signal watch, and the rules that add those people to a Lead list or send `signal.matched` to your webhooks. Reads Curviate's own store: no LinkedIn call.",
36
+ signal: "Signals: what people did around your Accounts in the last 7 days (reacted, commented, viewed a profile, followed, mentioned, reposted, posted, connected), each Account's Signal watch and its switch, and the rules that add those people to a Lead list, enroll them in a Campaign or send `signal.matched` to your webhooks, with what each rule did. Reads Curviate's own store: no LinkedIn call.",
36
37
  job: "Classic LinkedIn job-posting operations.",
37
38
  connect: "Send or manage connection invitations. Connection requests may take 10-30 seconds to appear in the recipient's received list (LinkedIn propagation delay).",
38
39
  search: "Search people, companies, posts, and jobs. Also runs a pasted search URL directly.",
@@ -1,19 +1,19 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ writeExport
4
+ } from "./chunk-PPGKQJKU.js";
2
5
  import {
3
6
  print,
4
7
  rate,
5
8
  table
6
9
  } from "./chunk-5S3MJVI5.js";
7
- import {
8
- writeExport
9
- } from "./chunk-PPGKQJKU.js";
10
10
  import {
11
11
  fail,
12
12
  listFlag,
13
13
  outputOpts,
14
14
  rootClient,
15
15
  usage
16
- } from "./chunk-3ZQNOKEK.js";
16
+ } from "./chunk-5OAJ4D65.js";
17
17
  import {
18
18
  intFlag
19
19
  } from "./chunk-NNV2OYEF.js";
@@ -24,14 +24,14 @@ import {
24
24
  readablePage,
25
25
  rejectPaginationModifiersWithoutAll,
26
26
  streamAll
27
- } from "./chunk-OE4CY3ZL.js";
27
+ } from "./chunk-KUVJM5CP.js";
28
28
  import {
29
29
  renderSuccess,
30
30
  writeNdjsonItem
31
31
  } from "./chunk-QM57YDJE.js";
32
32
  import {
33
33
  downloadBinary
34
- } from "./chunk-RXDG57B2.js";
34
+ } from "./chunk-PBJZQZPO.js";
35
35
  import {
36
36
  GLOBAL_FLAGS,
37
37
  READ_SINGLE_FLAGS,
@@ -39,7 +39,7 @@ import {
39
39
  } from "./chunk-QLKGOIWS.js";
40
40
  import {
41
41
  DESCRIPTIONS
42
- } from "./chunk-5LGKZBAY.js";
42
+ } from "./chunk-XDPU2YAF.js";
43
43
 
44
44
  // src/commands/analytics.ts
45
45
  import { defineCommand } from "citty";
@@ -189,10 +189,30 @@ var JOB_ENTITIES = ["campaign_activity", "account_activity", "account_metrics"];
189
189
  async function runExport(c, f) {
190
190
  if (f.json) usage("export commands take no --json: pass --format json.");
191
191
  const tables = f.table === void 0 ? [] : listFlag("table", f.table);
192
+ if (tables.includes("email")) {
193
+ if (tables.length > 1) usage("--table email is one table of its own: pass it alone.");
194
+ if (f.origin !== void 0) usage("--table email takes no --origin: it counts Campaign email only.");
195
+ const format2 = f.format ?? "csv";
196
+ const filters2 = { ...windowParams(f), ...filterParams(f, ["campaigns", "accounts"]) };
197
+ try {
198
+ if (f.job) {
199
+ const exp = await c.exports.create({ entity: "email_daily", format: format2, filters: filters2 });
200
+ renderSuccess(exp, outputOpts(f), process);
201
+ process.stderr.write(`Export ${exp["id"]} is ${exp["status"]}. Read it with \`curviate export get ${exp["id"]}\`, then \`curviate export download ${exp["id"]} -o <file>\` once ready.
202
+ `);
203
+ return;
204
+ }
205
+ const bytes = await downloadBinary(() => c.analytics.export({ ...filters2, format: format2, entity: "email_daily" }));
206
+ await writeExport(f.output, new Uint8Array(bytes));
207
+ } catch (err) {
208
+ await fail(err, f);
209
+ }
210
+ return;
211
+ }
192
212
  const entity = tables.length === 1 && JOB_ENTITIES.includes(tables[0]) ? tables[0] : "analytics";
193
213
  if (entity !== "analytics" && !f.job) usage(`--table ${entity} is built by a background job: add --job.`);
194
214
  const unknown = tables.find((t) => !ANALYTICS_TABLES.includes(t) && t !== entity);
195
- if (unknown !== void 0) usage(`--table takes ${ANALYTICS_TABLES.join(", ")}, or one of ${JOB_ENTITIES.join(", ")} with --job.`);
215
+ if (unknown !== void 0) usage(`--table takes ${ANALYTICS_TABLES.join(", ")} or email, or one of ${JOB_ENTITIES.join(", ")} with --job.`);
196
216
  const format = f.format ?? "csv";
197
217
  const filters = { ...windowParams(f), ...filterParams(f, ["campaigns", "accounts", "origin"]) };
198
218
  try {
@@ -306,7 +326,7 @@ var exportCmd = defineCommand({
306
326
  team: GLOBAL_FLAGS.team,
307
327
  "base-url": GLOBAL_FLAGS["base-url"],
308
328
  timeout: GLOBAL_FLAGS.timeout,
309
- table: { type: "string", description: "Comma list of daily, accounts, campaigns, enrollments (default all four); or, with --job, one of campaign_activity, account_activity, account_metrics." },
329
+ table: { type: "string", description: "Comma list of daily, accounts, campaigns, enrollments (default all four); or email alone: your Campaign email's daily counts per Mailbox, Account, Campaign, step, variant and receiving provider (at most 366 days); or, with --job, one of campaign_activity, account_activity, account_metrics." },
310
330
  format: { type: "string", description: "csv (default), json or ndjson (ndjson takes one table)." },
311
331
  output: { type: "string", alias: "o", description: "File to write (mode 0600), or - for stdout (default)." },
312
332
  job: { type: "boolean", description: "Build it in the background and print the export record instead of streaming it." },
@@ -321,13 +341,18 @@ var eventsCommand = defineCommand({
321
341
  meta: { name: "events", description: "The records behind the analytics numbers." },
322
342
  subCommands: { list: eventsListCmd },
323
343
  async run() {
324
- const { showHelp } = await import("./examples-J4X5NEIE.js");
344
+ const { showHelp } = await import("./examples-5FJS47QF.js");
325
345
  await showHelp(eventsCommand, ["curviate", "analytics", "events"]);
326
346
  }
327
347
  });
328
348
  async function runEmail(c, f) {
329
349
  const q = { ...windowParams(f), ...filterParams(f, ["campaigns", "accounts"]) };
330
- if (f.include !== void 0) q["include"] = listFlag("include", f.include);
350
+ const include = f.include === void 0 ? [] : listFlag("include", f.include);
351
+ const EMAIL_INCLUDES = ["weeks", "breakdowns", "mailboxes", "domains", "forecast"];
352
+ const bad = include.find((i) => !EMAIL_INCLUDES.includes(i));
353
+ if (bad !== void 0) usage(`--include takes ${EMAIL_INCLUDES.join(", ")} (got ${bad}).`);
354
+ if (f.forecast && !include.includes("forecast")) include.push("forecast");
355
+ if (include.length) q["include"] = include;
331
356
  try {
332
357
  const body = await c.analytics.email(q);
333
358
  if (outputOpts(f).json) return renderSuccess(body, outputOpts(f), process);
@@ -335,10 +360,55 @@ async function runEmail(c, f) {
335
360
  print(`sent ${String(body["sent"] ?? "-")} \xB7 reply ${rate(body["reply"], "replied", "first_emailed")} \xB7 open ${body["open"] == null ? "not tracked" : rate(body["open"], "opened", "tracked")} \xB7 bounce ${rate(body["bounce"], "bounced", "sent")} \xB7 opt-out ${rate(body["opt_out"], "opted_out", "first_emailed")}`);
336
361
  if (today) print(`today: ${String(today["sent"])} sent of a ${String(today["cap"])} daily cap`);
337
362
  if (body["tracking"] !== "set_up") print(`open tracking: ${String(body["tracking"])} (set it up on the Mailboxes for an open rate over every email)`);
363
+ for (const m of body["mailboxes"] ?? []) print(`mailbox ${String(m["address"])}: ${String(m["state"])}, sent ${String(m["sent"] ?? 0)}, cap ${String(m["cap_lowered_to"] ?? m["daily_cap"])}`);
364
+ for (const d of body["domains"] ?? []) {
365
+ const checks = d["checks"] ?? {};
366
+ print(`domain ${String(d["name"])}: ${Object.entries(checks).map(([k, v]) => `${k} ${String(v)}`).join(", ")}`);
367
+ }
368
+ const breakdowns = body["breakdowns"];
369
+ if (breakdowns) for (const [by, rows] of Object.entries(breakdowns)) print(`by ${by}: ${rows.length} row${rows.length === 1 ? "" : "s"} (--json for the figures)`);
370
+ const forecast = body["forecast"];
371
+ if (forecast) {
372
+ if (forecast["status"] === "computing") print("forecast: computing; read again in a few minutes");
373
+ else for (const day of forecast["daily"] ?? []) print(`forecast ${String(day["date"])}: ${String(day["emails_sent"])} emails`);
374
+ }
338
375
  } catch (err) {
339
376
  await fail(err, f);
340
377
  }
341
378
  }
379
+ async function runAttention(c, f) {
380
+ const q = {};
381
+ if (f.campaign !== void 0) q["campaign_id"] = f.campaign;
382
+ if (f["account-id"] !== void 0) q["account_id"] = f["account-id"];
383
+ try {
384
+ const body = await c.analytics.emailAttention(q);
385
+ if (outputOpts(f).json) return renderSuccess(body, outputOpts(f), process);
386
+ const items = body.items ?? [];
387
+ if (!items.length) return void print("Nothing needs a fix.");
388
+ print(table(["PROBLEM", "ON", "SINCE", "FIX"], items.map((i) => {
389
+ const on = i["subject"];
390
+ return [i["kind"], on ? `${String(on["type"])} ${String(on["id"])}` : "", i["since"], i["next"]];
391
+ })));
392
+ } catch (err) {
393
+ await fail(err, f);
394
+ }
395
+ }
396
+ var attentionCmd = defineCommand({
397
+ meta: {
398
+ name: "attention",
399
+ description: "Needs a fix: what to fix in your email sending now, one row per problem, what stops sending first: paused or disconnected Mailboxes, failing DMARC or DKIM, mail landing in spam, Accounts without a Mailbox, and advice. Each row names the call that leads to its fix; a row leaves once its problem ends. Read-only.",
400
+ risk: "read",
401
+ output: ["A table of problem (a Notification type), what it is on, since when, and the fix command; --json (or piped) prints the API body (`values` carries the problem's codes and numbers)."],
402
+ seeAlso: ["curviate analytics email", "curviate mailbox list", "curviate notification list --channel email"],
403
+ examples: ["curviate analytics attention", "curviate analytics attention --campaign mot_YOUR_CAMPAIGN_ID --json"]
404
+ },
405
+ args: {
406
+ ...readOnly(READ_SINGLE_FLAGS),
407
+ campaign: { type: "string", description: "Only problems that touch this Campaign (mot_...)." },
408
+ "account-id": { type: "string", description: "Only problems that touch this Account (acc_...)." }
409
+ },
410
+ run: online(runAttention)
411
+ });
342
412
  var emailCmd = defineCommand({
343
413
  meta: {
344
414
  name: "email",
@@ -351,14 +421,15 @@ var emailCmd = defineCommand({
351
421
  "--include weeks adds the reply rate by week of first email. A compact line by default; --json (or piped) prints the API body."
352
422
  ],
353
423
  seeAlso: ["curviate analytics get", "curviate mailbox list"],
354
- examples: ["curviate analytics email --range 30d", "curviate analytics email --campaigns mot_YOUR_CAMPAIGN_ID --include weeks --json"]
424
+ examples: ["curviate analytics email --range 30d", "curviate analytics email --campaigns mot_YOUR_CAMPAIGN_ID --include weeks --json", "curviate analytics email --include mailboxes,domains --forecast"]
355
425
  },
356
426
  args: {
357
427
  ...readOnly(READ_SINGLE_FLAGS),
358
428
  campaigns: { type: "string", description: "Only these Campaigns, comma list (mot_...)." },
359
429
  ...WINDOW_ARGS,
360
430
  accounts: FILTER_ARGS.accounts,
361
- include: { type: "string", description: "Sections to add: weeks (the reply rate by week of first email)." }
431
+ include: { type: "string", description: "Sections to add, comma list: weeks (the reply rate by week of first email), breakdowns (by Campaign, step, variant, receiving provider, thread setting, Mailbox and Account), mailboxes, domains (their checks), forecast." },
432
+ forecast: { type: "boolean", description: "Add the emails your Campaigns are expected to send each day from today (include=forecast): a simulation of their email steps, each Mailbox counting its daily cap." }
362
433
  },
363
434
  run: online(runEmail)
364
435
  });
@@ -367,11 +438,12 @@ var analyticsCommand = defineCommand({
367
438
  subCommands: {
368
439
  get: getCmd,
369
440
  email: emailCmd,
441
+ attention: attentionCmd,
370
442
  events: eventsCommand,
371
443
  export: exportCmd
372
444
  },
373
445
  async run() {
374
- const { showHelp } = await import("./examples-J4X5NEIE.js");
446
+ const { showHelp } = await import("./examples-5FJS47QF.js");
375
447
  await showHelp(analyticsCommand, ["curviate", "analytics"]);
376
448
  }
377
449
  });