@curviate/cli 0.50.0 → 0.52.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 (54) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/{account-P7HNLPM7.js → account-2IHGWLU7.js} +28 -13
  3. package/dist/{analytics-IJRC2OJH.js → analytics-SBHNCE24.js} +5 -5
  4. package/dist/{beta-consent-TPZ5WKGQ.js → beta-consent-QJBRBON3.js} +3 -3
  5. package/dist/{billing-FYHFUBIY.js → billing-KL6GL5PF.js} +4 -4
  6. package/dist/{contact-import-32WRILAG.js → chunk-44COK554.js} +75 -20
  7. package/dist/{chunk-MYYFSWPW.js → chunk-6BDA6B32.js} +4 -4
  8. package/dist/{chunk-FBBZVIFJ.js → chunk-AQVE6HO5.js} +1 -1
  9. package/dist/{chunk-PXBYFKCX.js → chunk-GXEHHSM7.js} +1 -1
  10. package/dist/{chunk-CAE5L6JG.js → chunk-JGPR6AGO.js} +10 -10
  11. package/dist/{chunk-6XRVKA3T.js → chunk-OQKN3U74.js} +4 -4
  12. package/dist/{chunk-G2BKRAVV.js → chunk-OUY3GVWJ.js} +1 -1
  13. package/dist/{chunk-RWFK4AU2.js → chunk-QA777QEJ.js} +1 -1
  14. package/dist/{chunk-YATAUKSV.js → chunk-SIOEKNCN.js} +3 -3
  15. package/dist/{chunk-I7H75AEH.js → chunk-UA4DEQ3K.js} +28 -2
  16. package/dist/{chunk-OWKUVSX3.js → chunk-UXFLLYFY.js} +1 -1
  17. package/dist/cli.js +22 -22
  18. package/dist/{comment-YRG6C32I.js → comment-ABRBF7J4.js} +5 -5
  19. package/dist/{company-7SIT7G4M.js → company-WQPWHAZJ.js} +5 -5
  20. package/dist/{config-ZY75BIPG.js → config-RFXNYRRC.js} +2 -2
  21. package/dist/{connect-IQLZJOBH.js → connect-R7A6RJJJ.js} +4 -4
  22. package/dist/{contact-FNZO3TNQ.js → contact-FHR4RAXL.js} +7 -7
  23. package/dist/{contact-groups-6Z6O42GH.js → contact-groups-AAJT4TZ6.js} +7 -7
  24. package/dist/contact-import-3KASFYC5.js +35 -0
  25. package/dist/{core-TYDJPTIK.js → core-GANWZKQZ.js} +17 -17
  26. package/dist/do-not-contact-QMFIJOAA.js +360 -0
  27. package/dist/{doctor-5DOZRA4N.js → doctor-4TNHUBYZ.js} +3 -3
  28. package/dist/{draft-7R2H4HKL.js → draft-F56TKIQ3.js} +5 -5
  29. package/dist/{enrollment-55NEUMEC.js → enrollment-WCG5MX65.js} +4 -4
  30. package/dist/{export-KWGIK4S3.js → export-UVUY3IMF.js} +3 -3
  31. package/dist/{feed-DDIKRYMO.js → feed-6NN2YWOQ.js} +4 -4
  32. package/dist/{group-P22TEUDB.js → group-BXL4QDZL.js} +4 -4
  33. package/dist/{inbox-2USWTORZ.js → inbox-GOO5UA3J.js} +4 -4
  34. package/dist/{inboxes-CYSIX2P7.js → inboxes-GGN7SULO.js} +4 -4
  35. package/dist/{incoming-M7RPZIIO.js → incoming-AZPAGR3L.js} +4 -4
  36. package/dist/{job-V4OXMQNN.js → job-R5TGUKTB.js} +4 -4
  37. package/dist/{login-JK76A4SB.js → login-LZH3HY2J.js} +2 -2
  38. package/dist/{message-CWJ44M62.js → message-YY2BB47Z.js} +5 -5
  39. package/dist/{motion-OPWMRNH6.js → motion-2RCKZSK5.js} +7 -7
  40. package/dist/{network-65KDK6FM.js → network-5VDLBVU7.js} +4 -4
  41. package/dist/{notification-XQMVVSE7.js → notification-DVHDC2IA.js} +4 -4
  42. package/dist/{notifications-HF5FNBGV.js → notifications-GZKDD7SV.js} +4 -4
  43. package/dist/{post-EUUBTE3Y.js → post-JKXMJZXS.js} +5 -5
  44. package/dist/{profile-2TX3357C.js → profile-CYFEDUEC.js} +5 -5
  45. package/dist/{recruiter-CJAZAWA2.js → recruiter-MRJDGK6O.js} +4 -4
  46. package/dist/{sales-nav-R6BVTXLA.js → sales-nav-5ABDKON4.js} +4 -4
  47. package/dist/{search-QS6E5VFD.js → search-JDNUGHRX.js} +4 -4
  48. package/dist/{setup-7LTVGORQ.js → setup-EXPWIHTM.js} +3 -3
  49. package/dist/{team-6SFTXTX7.js → team-5XD2O5UO.js} +4 -4
  50. package/dist/{tier-NLHZATQ4.js → tier-CNDUZKXE.js} +4 -4
  51. package/dist/{unibox-R5MEMYES.js → unibox-MAAEROM5.js} +4 -4
  52. package/dist/{webhook-YOZ4KDAU.js → webhook-XVTE3ZVM.js} +4 -4
  53. package/package.json +2 -2
  54. package/dist/do-not-contact-ZUPMYK25.js +0 -200
package/CHANGELOG.md CHANGED
@@ -6,6 +6,44 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6
6
  Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html):
7
7
  a new command or flag is a minor; a breaking command/flag/exit-code change is a major (before 1.0.0, a minor); a fix is a patch.
8
8
 
9
+ ## [Unreleased]
10
+
11
+ ## [0.52.0] - 2026-11-08
12
+
13
+ Requires `@curviate/sdk` 0.48.0 (exact pin). The vendored OpenAPI fixture is re-copied from the SDK's, regenerated from staging f4ecd2656.
14
+
15
+ ### Contact import tells the truth about timeouts and a busy Team
16
+
17
+ - **`contact import` after a timeout or dropped connection** reads the Team's newest imports and reports the one the request made: the import id with `completed` and its counts, or `running`/`queued` (it keeps waiting, as for a large file). Only when none exists does it say nothing was imported (connection refused: "Nothing was imported"; otherwise "no import from this request exists", with a pointer to `contact imports list`). It no longer says "0 of N rows were sent". No idempotency key or dry-run is added.
18
+ - **`RATE_LIMIT_TENANT` (429, known not processed)** waits the advertised `Retry-After` (default 5 s when none, at most 60 s, five sends per import) and sends that import again, then goes on with the next. A longer `Retry-After` stops the run at once, exit 6, without sleeping.
19
+ - `contact import --json` prints exactly one JSON document on stdout; waits and progress go to stderr (test added).
20
+ - A failed chunk's summary reads "N of M rows were accepted before it" (it said "sent").
21
+
22
+ ### Contact import finds an import that commits late
23
+
24
+ - **`contact import` after a timeout** reads the Team's imports again every 2 s for up to 30 s while none shows (an inline import writes its record in the same transaction as its rows, so a timeout mid-apply sees none yet), then polls the one it finds as before. Only after the window does it say no import appeared (exit 7).
25
+ - **`Retry-After: 0`** on a busy 429 waits 0 s; the 5 s default applies only when the header is absent.
26
+
27
+ ### Contact import applies the export's lists
28
+
29
+ - **`contact import --apply-lists`**: each row's Contact joins the Contact lists named in its `lists` (a CSV export's `lists` column, names joined with `;`, or a JSON/NDJSON row's `lists` array), and a missing list is created by name. Only adds. A row past the Team's list limit is skipped (`list_limit_reached`). **Same name, new meaning:** without the flag `lists` is ignored, as before. Every split chunk carries the option. Needs the server change (`apply_lists`); an older server rejects the unknown key.
30
+
31
+ ### Do-not-contact file
32
+
33
+ - **`do-not-contact export [--format csv|json|ndjson] [--output FILE]`** downloads the whole list: LinkedIn URL (empty once the Contact was deleted), reason, who added it, when. Data to stdout or `--output` (mode 0600, written whole), the count to stderr. Owners and Managers only.
34
+ - **`do-not-contact import --file FILE|- [--format csv|json|ndjson]`** puts the people of a file on the list (`linkedin_url`, optional `reason`; an exported file works as it is). A person already listed is reported unchanged; a bad URL or reason skips its row. One report: `total_rows`, summed `counts` and the `skipped` rows with file row, reason and field. A file over 10,000 rows is sent in several requests. Any member; needs Automate.
35
+ - `do-not-contact add` help points at `import` for many people. `commands.json` regenerated.
36
+
37
+ ## [0.51.0] - 2026-11-05
38
+
39
+ Requires `@curviate/sdk` 0.46.0 (exact pin). The vendored OpenAPI fixture is re-copied from the SDK's, regenerated from staging b25643d91.
40
+
41
+ ### Activity level
42
+
43
+ - **`account safety update --activity-level normal|increased`** sets the Account's Activity level alone, or beside `--file` (the flag wins over the document's `activity_level`; `--file` is no longer required when the flag is given). `normal` (the default) aims about midway between the green figure and the limit, `increased` works close to the limit, never past it, with a higher chance LinkedIn notices the activity. It runs as `normal`, and the setting stays, while warm-up is on or health is not `healthy`: `account safety get` prints `activity_level_effective` and `activity_level_reason`. A value other than `normal` or `increased`, or neither flag, exits 2 before any request.
44
+ - **Same wording, new meaning:** `motion create` and `motion update` help: `settings.priority` weighs a Motion 1 (`normal`) or 1.5 (`prioritized`) in each Account's budgets, on every budget. Every Motion with work due still progresses and no limit is passed. It was "twice a normal Motion's share of the daily allowance".
45
+ - `account safety get` help names the Activity level. `commands.json` regenerated.
46
+
9
47
  ## [0.50.0] - 2026-11-03
10
48
 
11
49
  Requires `@curviate/sdk` 0.45.0 (exact pin). The vendored OpenAPI fixture is re-copied from the SDK's, regenerated from the production document.
@@ -10,7 +10,7 @@ import {
10
10
  grammarParams,
11
11
  renderOverview,
12
12
  windowParams
13
- } from "./chunk-6XRVKA3T.js";
13
+ } from "./chunk-OQKN3U74.js";
14
14
  import {
15
15
  print,
16
16
  table
@@ -22,7 +22,7 @@ import {
22
22
  outputOpts,
23
23
  rootClient,
24
24
  usage
25
- } from "./chunk-G2BKRAVV.js";
25
+ } from "./chunk-OUY3GVWJ.js";
26
26
  import {
27
27
  buildPreviewOutput
28
28
  } from "./chunk-TCUYH5GO.js";
@@ -37,7 +37,7 @@ import {
37
37
  readablePage,
38
38
  rejectPaginationModifiersWithoutAll,
39
39
  streamAll
40
- } from "./chunk-RWFK4AU2.js";
40
+ } from "./chunk-QA777QEJ.js";
41
41
  import {
42
42
  isJsonMode,
43
43
  renderError,
@@ -53,7 +53,7 @@ import {
53
53
  import {
54
54
  createClient,
55
55
  resolveEffectiveConfig
56
- } from "./chunk-I7H75AEH.js";
56
+ } from "./chunk-UA4DEQ3K.js";
57
57
  import {
58
58
  GLOBAL_FLAGS,
59
59
  READ_SINGLE_FLAGS,
@@ -62,7 +62,7 @@ import {
62
62
  } from "./chunk-RYWWSZUH.js";
63
63
  import {
64
64
  DESCRIPTIONS
65
- } from "./chunk-FBBZVIFJ.js";
65
+ } from "./chunk-AQVE6HO5.js";
66
66
  import {
67
67
  parseDocument,
68
68
  readFileFlag
@@ -193,11 +193,12 @@ var accountWarmUpCommand = defineCommand2({
193
193
 
194
194
  // src/commands/account-safety.ts
195
195
  import { defineCommand as defineCommand3 } from "citty";
196
+ var LEVELS = ["normal", "increased"];
196
197
  var ACCOUNT = { type: "positional", description: "The Account (acc_...)." };
197
198
  var getCmd = defineCommand3({
198
199
  meta: {
199
200
  name: "get",
200
- description: "One Account's safety policy: every budget row with its ceiling, effective_ceiling and (strict rows) target and effective_target, Active hours, warm-up, pacing and auto_withdraw. A read: no LinkedIn call.",
201
+ description: "One Account's safety policy: every budget row with its ceiling, effective_ceiling and (strict rows) target and effective_target, Active hours, warm-up, pacing, auto_withdraw and the Activity level (activity_level, and activity_level_effective with activity_level_reason when it runs lower). A read: no LinkedIn call.",
201
202
  risk: "read",
202
203
  seeAlso: ["curviate account safety update", "curviate account get"],
203
204
  examples: ["curviate account safety get acc_YOUR_ACCOUNT_ID", "curviate account safety get acc_YOUR_ACCOUNT_ID --fields active_hours,warm_up"]
@@ -216,10 +217,10 @@ var getCmd = defineCommand3({
216
217
  var updateCmd = defineCommand3({
217
218
  meta: {
218
219
  name: "update",
219
- description: 'Change one Account\'s safety policy from a JSON document: `rows`, for example {"rows":[{"budget_row":"profile_views","ceiling":40}]}, `active_hours`, for example {"active_hours":{"days":["mon","tue"],"start":"09:00","end":"17:00"}}, and `auto_withdraw` (true or false: Curviate withdraws its own invitations older than 14 days once more than 400 are pending). Active hours hold Motions and other live writes, never a direct message (send, new chat, edit, delete, reaction, read mark). A row\'s `green` is its target, what Motions aim at; the ceiling is the most it may do. Fields you leave out stay as they are; null clears an override. Prints the policy.',
220
+ description: 'Change one Account\'s safety policy from a JSON document: `rows`, for example {"rows":[{"budget_row":"profile_views","ceiling":40}]}, `active_hours`, for example {"active_hours":{"days":["mon","tue"],"start":"09:00","end":"17:00"}}, `auto_withdraw` (true or false: Curviate withdraws its own invitations older than 14 days once more than 400 are pending) and `activity_level`. --activity-level normal|increased sets the Activity level alone, or beside --file: how close the Account\'s daily targets sit to its limits. normal (the default) aims about midway between the green figure and the limit; increased works close to the limit, never past it, and raises the chance LinkedIn notices the activity. It runs as normal, and the setting stays, while warm-up is on or the Account\'s health is not healthy; the printed policy\'s activity_level_effective and activity_level_reason say which level is in force. Active hours hold Motions and other live writes, never a direct message (send, new chat, edit, delete, reaction, read mark). A row\'s `green` is its target, what Motions aim at; the ceiling is the most it may do. Fields you leave out stay as they are; null clears an override. Prints the policy.',
220
221
  risk: "write",
221
222
  rules: {
222
- changes: "The Account's limits or Active hours, from the next action on.",
223
+ changes: "The Account's limits, Active hours or Activity level, from the next action on.",
223
224
  visible_to: "Your Team. Nothing is posted on LinkedIn; a higher limit lets more actions reach it.",
224
225
  budget_rows: [],
225
226
  retry: "Safe: the same document leaves the same policy.",
@@ -229,18 +230,32 @@ var updateCmd = defineCommand3({
229
230
  errors: { INVALID_REQUEST: "a field is unknown or not settable; the message names it." },
230
231
  seeAlso: ["curviate account safety get", "curviate account warm-up"],
231
232
  examples: [
232
- "curviate account safety update acc_YOUR_ACCOUNT_ID --file policy.json"
233
- ]
233
+ "curviate account safety update acc_YOUR_ACCOUNT_ID --file policy.json",
234
+ "curviate account safety update acc_YOUR_ACCOUNT_ID --activity-level increased"
235
+ ],
236
+ requires: ["--file or --activity-level, or both (the flag wins over the document's activity_level)."]
234
237
  },
235
238
  args: {
236
239
  ...WRITE_SINGLE_FLAGS,
237
240
  accountId: ACCOUNT,
238
- file: { type: "string", required: true, description: "The JSON document: a path, or - to read it from stdin." }
241
+ file: { type: "string", description: "The JSON document: a path, or - to read it from stdin." },
242
+ "activity-level": { type: "string", description: "normal (default) or increased: how close the Account's daily targets sit to its limits. increased raises the chance LinkedIn notices the activity; it runs as normal while warm-up is on or health is not healthy." }
239
243
  },
240
244
  async run({ args }) {
241
245
  const f = args;
242
246
  const accountId = String(f.accountId ?? "");
243
- const body = parseDocument("file", await readFileFlag("file", f.file ?? "", { others: f }));
247
+ const level = f["activity-level"];
248
+ if (level !== void 0 && !LEVELS.includes(level)) {
249
+ process.stderr.write(`error: --activity-level is normal or increased, not "${level}".
250
+ `);
251
+ process.exit(2);
252
+ }
253
+ if (f.file === void 0 && level === void 0) {
254
+ process.stderr.write("error: pass --file <policy.json> or --activity-level normal|increased.\n");
255
+ process.exit(2);
256
+ }
257
+ const doc = f.file === void 0 ? {} : parseDocument("file", await readFileFlag("file", f.file, { others: f }));
258
+ const body = level === void 0 ? doc : { ...doc, activity_level: level };
244
259
  if (f.preview) {
245
260
  process.stdout.write(JSON.stringify(buildPreviewOutput({ method: "accounts.updateSafetyPolicy", args: { accountId }, body })) + "\n");
246
261
  return;
@@ -254,7 +269,7 @@ var updateCmd = defineCommand3({
254
269
  }
255
270
  });
256
271
  var accountSafetyCommand = defineCommand3({
257
- meta: { name: "safety", description: "Read or change one Account's safety policy: limits per budget row and Active hours." },
272
+ meta: { name: "safety", description: "Read or change one Account's safety policy: limits per budget row, Active hours and the Activity level." },
258
273
  subCommands: { get: getCmd, update: updateCmd },
259
274
  async run() {
260
275
  process.stderr.write("Usage: curviate account safety get|update <account>\n");
@@ -6,16 +6,16 @@ import {
6
6
  grammarParams,
7
7
  renderOverview,
8
8
  windowParams
9
- } from "./chunk-6XRVKA3T.js";
9
+ } from "./chunk-OQKN3U74.js";
10
10
  import "./chunk-5S3MJVI5.js";
11
11
  import "./chunk-PPGKQJKU.js";
12
- import "./chunk-G2BKRAVV.js";
12
+ import "./chunk-OUY3GVWJ.js";
13
13
  import "./chunk-NNV2OYEF.js";
14
- import "./chunk-RWFK4AU2.js";
14
+ import "./chunk-QA777QEJ.js";
15
15
  import "./chunk-QM57YDJE.js";
16
- import "./chunk-I7H75AEH.js";
16
+ import "./chunk-UA4DEQ3K.js";
17
17
  import "./chunk-RYWWSZUH.js";
18
- import "./chunk-FBBZVIFJ.js";
18
+ import "./chunk-AQVE6HO5.js";
19
19
  import "./chunk-ZYURL5VK.js";
20
20
  export {
21
21
  GRAMMAR_ARGS,
@@ -4,14 +4,14 @@ import {
4
4
  outputOpts,
5
5
  rootClient,
6
6
  usage
7
- } from "./chunk-G2BKRAVV.js";
7
+ } from "./chunk-OUY3GVWJ.js";
8
8
  import {
9
9
  buildPreviewOutput
10
10
  } from "./chunk-TCUYH5GO.js";
11
11
  import {
12
12
  renderSuccess
13
13
  } from "./chunk-QM57YDJE.js";
14
- import "./chunk-I7H75AEH.js";
14
+ import "./chunk-UA4DEQ3K.js";
15
15
  import {
16
16
  READ_SINGLE_FLAGS,
17
17
  WRITE_SINGLE_FLAGS,
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-RYWWSZUH.js";
20
20
  import {
21
21
  DESCRIPTIONS
22
- } from "./chunk-FBBZVIFJ.js";
22
+ } from "./chunk-AQVE6HO5.js";
23
23
  import "./chunk-ZYURL5VK.js";
24
24
 
25
25
  // src/commands/beta-consent.ts
@@ -7,7 +7,7 @@ import {
7
7
  outputOpts,
8
8
  rootClient,
9
9
  usage
10
- } from "./chunk-G2BKRAVV.js";
10
+ } from "./chunk-OUY3GVWJ.js";
11
11
  import {
12
12
  intFlag
13
13
  } from "./chunk-NNV2OYEF.js";
@@ -18,21 +18,21 @@ import {
18
18
  readablePage,
19
19
  rejectPaginationModifiersWithoutAll,
20
20
  streamAll
21
- } from "./chunk-RWFK4AU2.js";
21
+ } from "./chunk-QA777QEJ.js";
22
22
  import {
23
23
  renderSuccess,
24
24
  writeNdjsonItem
25
25
  } from "./chunk-QM57YDJE.js";
26
26
  import {
27
27
  downloadBinary
28
- } from "./chunk-I7H75AEH.js";
28
+ } from "./chunk-UA4DEQ3K.js";
29
29
  import {
30
30
  GLOBAL_FLAGS,
31
31
  readOnly
32
32
  } from "./chunk-RYWWSZUH.js";
33
33
  import {
34
34
  DESCRIPTIONS
35
- } from "./chunk-FBBZVIFJ.js";
35
+ } from "./chunk-AQVE6HO5.js";
36
36
  import "./chunk-ZYURL5VK.js";
37
37
 
38
38
  // src/commands/billing.ts
@@ -2,19 +2,16 @@
2
2
  import {
3
3
  online,
4
4
  preview
5
- } from "./chunk-CAE5L6JG.js";
6
- import "./chunk-OWKUVSX3.js";
7
- import "./chunk-GOICALYQ.js";
5
+ } from "./chunk-JGPR6AGO.js";
8
6
  import {
9
7
  sendChunked
10
- } from "./chunk-YATAUKSV.js";
8
+ } from "./chunk-SIOEKNCN.js";
11
9
  import {
12
10
  fail,
13
11
  listFlag,
14
12
  outputOpts,
15
13
  usage
16
- } from "./chunk-G2BKRAVV.js";
17
- import "./chunk-TCUYH5GO.js";
14
+ } from "./chunk-OUY3GVWJ.js";
18
15
  import {
19
16
  intFlag
20
17
  } from "./chunk-NNV2OYEF.js";
@@ -26,26 +23,25 @@ import {
26
23
  readablePage,
27
24
  rejectPaginationModifiersWithoutAll,
28
25
  streamAll
29
- } from "./chunk-RWFK4AU2.js";
26
+ } from "./chunk-QA777QEJ.js";
30
27
  import {
31
28
  renderSuccess,
32
29
  writeNdjsonItem
33
30
  } from "./chunk-QM57YDJE.js";
34
- import "./chunk-I7H75AEH.js";
31
+ import {
32
+ withWireNotes
33
+ } from "./chunk-UA4DEQ3K.js";
35
34
  import {
36
35
  GLOBAL_FLAGS,
37
36
  WRITE_SINGLE_FLAGS,
38
37
  readOnly
39
38
  } from "./chunk-RYWWSZUH.js";
40
- import "./chunk-FBBZVIFJ.js";
41
39
  import {
42
40
  readFileFlag
43
41
  } from "./chunk-PHKICMO7.js";
44
- import "./chunk-FDJMAF7D.js";
45
42
  import {
46
43
  isStdinToken
47
44
  } from "./chunk-ZYURL5VK.js";
48
- import "./chunk-QW5K5DTC.js";
49
45
 
50
46
  // src/commands/contact-import.ts
51
47
  import { defineCommand } from "citty";
@@ -143,6 +139,59 @@ function mapping(f) {
143
139
  }
144
140
  var DELIMITERS = { ",": ",", comma: ",", ";": ";", semicolon: ";", tab: " ", "\\t": " ", " ": " " };
145
141
  var COUNTS = ["created", "updated", "unchanged", "skipped"];
142
+ var RETRY_AFTER_BOUND_S = 60;
143
+ var RETRY_DEFAULT_S = 5;
144
+ var MAX_SENDS = 5;
145
+ var relistMs = () => Number(process.env["CURVIATE_IMPORT_RELIST_MS"]) || 2e3;
146
+ var RELIST_TRIES = 15;
147
+ var CLOCK_SKEW_MS = 3e4;
148
+ var say = (msg) => void process.stderr.write(msg + "\n");
149
+ async function createChunk(c, body, rows, seen, k, n) {
150
+ const { CurviateError } = await import("@curviate/sdk");
151
+ for (let sends = 1; ; sends++) {
152
+ const notes = {};
153
+ const started = Date.now();
154
+ try {
155
+ return readableObject(await withWireNotes(notes, () => c.contacts.imports.create(body)));
156
+ } catch (err) {
157
+ if (!(err instanceof CurviateError)) throw err;
158
+ if (err.code === "RATE_LIMIT_TENANT") {
159
+ const wait = notes.retryAfterS ?? RETRY_DEFAULT_S;
160
+ if (wait > RETRY_AFTER_BOUND_S) {
161
+ throw new CurviateError({ code: err.code, message: `${err.message} The API asked to wait ${wait} s, more than the ${RETRY_AFTER_BOUND_S} s the CLI waits. Nothing in this chunk was imported; send it again later.`, httpStatus: 429, userFixable: false, retryLikelyToSucceed: true });
162
+ }
163
+ if (sends >= MAX_SENDS) throw err;
164
+ say(`Import ${k} of ${n}: the Team has other Contact writes running (nothing was imported); waiting ${wait} s, then sending it again.`);
165
+ await sleep(wait * 1e3);
166
+ continue;
167
+ }
168
+ if (err.code === "CLIENT_TIMEOUT" || err.code === "INTERNAL" && err.httpStatus === void 0) return recover(c, body, rows, seen, started, notes, err, k, n);
169
+ throw err;
170
+ }
171
+ }
172
+ }
173
+ async function recover(c, body, rows, seen, started, notes, err, k, n) {
174
+ const { CurviateError } = await import("@curviate/sdk");
175
+ const fresh = (message) => new CurviateError({ code: err.code, message, userFixable: true, retryLikelyToSucceed: false });
176
+ if (notes.unreached) throw fresh(`Nothing was imported: the API could not be reached (${err.message}).`);
177
+ say(`Import ${k} of ${n}: no answer from the API; looking for the import it made.`);
178
+ let found;
179
+ for (let tries = 0; ; tries++) {
180
+ try {
181
+ const page = await c.contacts.imports.list({ limit: 20 });
182
+ found = (page.items ?? []).find(
183
+ (i) => !seen.includes(String(i.id)) && i.total_rows === rows && i.format === (body["csv"] !== void 0 ? "csv" : "rows") && (body["list_id"] === void 0 || i.list_id === body["list_id"]) && Date.parse(i.created_at ?? "") >= started - CLOCK_SKEW_MS
184
+ );
185
+ } catch {
186
+ throw fresh(`${err.message} The check for an import it made failed too: read \`curviate contact imports list\` before running this again, it may have been imported.`);
187
+ }
188
+ if (found || tries >= RELIST_TRIES) break;
189
+ await sleep(relistMs());
190
+ }
191
+ if (!found) throw fresh(`${err.message} No import from this request appeared within 30 s, so nothing was imported so far. If the API is only slow, one may still appear: read \`curviate contact imports list\` before running this again.`);
192
+ 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(", ")})` : ""}.`);
193
+ return found;
194
+ }
146
195
  async function runImport(c, f) {
147
196
  const file = f.file;
148
197
  if (file === void 0 || file.trim() === "") usage("--file is required: a CSV, JSON or NDJSON file, or - for stdin.");
@@ -162,6 +211,7 @@ async function runImport(c, f) {
162
211
  if (tags.length) base["tags"] = tags;
163
212
  const removeTags = listFlag("remove-tag", f["remove-tag"]);
164
213
  if (removeTags.length) base["remove_tags"] = removeTags;
214
+ if (f["apply-lists"] === true) base["apply_lists"] = true;
165
215
  const map = mapping(f);
166
216
  if (map) base["mapping"] = map;
167
217
  if (f.delimiter !== void 0) {
@@ -189,7 +239,7 @@ async function runImport(c, f) {
189
239
  await sendChunked(
190
240
  chunks,
191
241
  async (rows) => {
192
- const made = readableObject(await c.contacts.imports.create(bodyOf(rows)));
242
+ const made = await createChunk(c, bodyOf(rows), rows.length, done.map((i) => String(i.id)), done.length + 1, chunks.length);
193
243
  const imp = await poll(made);
194
244
  offsets.push(at);
195
245
  at += rows.length;
@@ -227,25 +277,27 @@ async function skippedRows(c, imp) {
227
277
  var importCmd = defineCommand({
228
278
  meta: {
229
279
  name: "import",
230
- description: `Import Contacts from a CSV, JSON (an array of objects) or NDJSON file. The format comes from the extension; with --file - pass --format. A file above ${IMPORT_MAX_ROWS} rows or ${(IMPORT_MAX_BODY_BYTES / 1048576).toFixed(0)} MiB is split into several imports, run one after the other (a CSV's header is repeated), each awaited unless --no-wait; the first refused or failed import stops the run. Only the file's structure is checked here; the server skips bad rows and reports why. Re-importing merges: a Contact already there is updated or left as it is. Needs Automate.`,
280
+ description: `Import Contacts from a CSV, JSON (an array of objects) or NDJSON file. The format comes from the extension; with --file - pass --format. A file above ${IMPORT_MAX_ROWS} rows or ${(IMPORT_MAX_BODY_BYTES / 1048576).toFixed(0)} MiB is split into several imports, run one after the other (a CSV's header is repeated), each awaited unless --no-wait; the first refused or failed import stops the run. Only the file's structure is checked here; the server skips bad rows and reports why. Re-importing merges: a Contact already there is updated or left as it is. If the request times out or the connection drops, the CLI looks up the Team's newest imports, again every 2 s for up to 30 s while none shows, and reports the one this request made (id and status; it waits on a running one); it says nothing was imported only when none appeared. A busy-Team 429 (RATE_LIMIT_TENANT) waits the advertised Retry-After (up to ${RETRY_AFTER_BOUND_S} s) and sends that import again; a longer wait fails. Needs Automate.`,
231
281
  risk: "write",
232
282
  rules: {
233
- changes: "Contacts are created or updated, joined to --list and tagged with --tag. Nothing is sent to LinkedIn or to the people.",
283
+ changes: "Contacts are created or updated, joined to --list (and, with --apply-lists, to the lists their `lists` column names) and tagged with --tag. Nothing is sent to LinkedIn or to the people.",
234
284
  visible_to: "Your Team.",
235
285
  budget_rows: [],
236
- retry: "Safe to repeat: Contacts converge, a second run reports them `unchanged`. A run stopped part way: read `curviate contact imports list`, then import the rest.",
286
+ retry: "After a timeout the CLI reports the import it made; do not run it again then. Otherwise Contacts converge: a second run reports them `unchanged`. A run stopped part way: read `curviate contact imports list`, then import the rest.",
237
287
  undo: "Cannot be undone as a whole. `curviate contact delete --import IMPORT_ID` deletes every Contact in its report, those it only updated included; Tags and list membership are undone with `curviate contact tags remove` and `curviate contact lists remove`."
238
288
  },
239
289
  errors: {
240
290
  CONTACT_LIMIT_REACHED: "the Team is at its Contact cap; rows past it are skipped.",
241
291
  IMPORT_QUEUE_FULL: "too many imports are queued (429); wait, then run it again.",
292
+ RATE_LIMIT_TENANT: `the Team has other Contact or Motion writes running (429, nothing imported); the CLI waits Retry-After (up to ${RETRY_AFTER_BOUND_S} s) and sends again, a longer wait stops the run.`,
293
+ CLIENT_TIMEOUT: "no answer within --timeout; the CLI reads the Team's newest imports (again for up to 30 s while none shows) and reports the import this request made. None found: nothing was imported so far, but read `curviate contact imports list` before running it again.",
242
294
  NAME_TAKEN: "--list-name names a list that exists."
243
295
  },
244
- output: ["One report: `imports` (id and status each), `total_rows`, summed `counts` (created, updated, unchanged, skipped) and `skipped` rows with their number in the file, a reason and the field. With --no-wait: the imports' ids and statuses only."],
296
+ output: ["With --json stdout is exactly one JSON document; progress and waits go to stderr. One report: `imports` (id and status each), `total_rows`, summed `counts` (created, updated, unchanged, skipped) and `skipped` rows with their number in the file, a reason and the field. With --no-wait: the imports' ids and statuses only."],
245
297
  seeAlso: ["curviate contact imports get", "curviate contact list"],
246
298
  examples: [
247
299
  'curviate contact import --file prospects.csv --list-name "Q4 prospects" --tag conference',
248
- 'curviate contact import --file prospects.csv --map "LinkedIn Profile=linkedin_url" --list cl_YOUR_LIST_ID --no-wait',
300
+ "curviate contact import --file contacts-export.csv --apply-lists --no-wait",
249
301
  "curviate contact import --file - --format ndjson --list cl_YOUR_LIST_ID"
250
302
  ]
251
303
  },
@@ -257,6 +309,7 @@ var importCmd = defineCommand({
257
309
  "list-name": { type: "string", description: "Add them to the list of this name (up to 100 characters), creating it. Not with --list." },
258
310
  tag: { type: "string", description: "Put this Tag on every imported Contact (up to 64 characters); repeatable." },
259
311
  "remove-tag": { type: "string", description: "Take this Tag off every imported Contact; repeatable." },
312
+ "apply-lists": { type: "boolean", description: "Add each Contact to the Contact lists named in its `lists` (an export's column), creating a missing list by name. Only adds. A row past the Team's list limit is skipped (list_limit_reached). Default: the column is ignored." },
260
313
  map: { type: "string", description: 'Map a file header to a Contact field: header=target, for example "LinkedIn Profile=linkedin_url"; repeatable.' },
261
314
  delimiter: { type: "string", description: "A CSV's separator: comma, semicolon or tab. Default: found by the server." },
262
315
  "no-wait": { type: "boolean", description: "Print the imports' ids without waiting for them to finish. Stops only on a refused request." }
@@ -326,11 +379,13 @@ var contactImportsCommand = defineCommand({
326
379
  await showHelp(contactImportsCommand, ["curviate", "contact", "imports"]);
327
380
  }
328
381
  });
382
+
329
383
  export {
330
- IMPORT_MAX_BODY_BYTES,
331
384
  IMPORT_MAX_ROWS,
385
+ IMPORT_MAX_BODY_BYTES,
386
+ csvRecords,
332
387
  chunkRows,
388
+ RETRY_AFTER_BOUND_S,
333
389
  contactImportCommand,
334
- contactImportsCommand,
335
- csvRecords
390
+ contactImportsCommand
336
391
  };
@@ -21,14 +21,14 @@ import {
21
21
  } from "./chunk-VHNF6OZD.js";
22
22
  import {
23
23
  requireAccount
24
- } from "./chunk-OWKUVSX3.js";
24
+ } from "./chunk-UXFLLYFY.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-RWFK4AU2.js";
31
+ } from "./chunk-QA777QEJ.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-I7H75AEH.js";
41
+ } from "./chunk-UA4DEQ3K.js";
42
42
  import {
43
43
  READ_SINGLE_FLAGS,
44
44
  WRITE_FLAGS,
@@ -46,7 +46,7 @@ import {
46
46
  } from "./chunk-RYWWSZUH.js";
47
47
  import {
48
48
  DESCRIPTIONS
49
- } from "./chunk-FBBZVIFJ.js";
49
+ } from "./chunk-AQVE6HO5.js";
50
50
  import {
51
51
  looksLikeCommandWord,
52
52
  nearestSubcommand
@@ -11,7 +11,7 @@ var DESCRIPTIONS = {
11
11
  motionVoiceClip: "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 Motion that uses it is started. Uploads need the Automate plan.",
12
12
  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.",
13
13
  contact: "Contacts: 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 contact lists` (Contact lists, including combining lists), `curviate contact tags`, `curviate contact imports`. Your Team's data: every role reads and writes; deleting is for Owners and Managers.",
14
- "do-not-contact": "Do-not-contact: your Team's one list of people no Motion contacts and no write reaches (a write toward them exits 10). List, read, add, change the reason, remove. Any member adds; removing is for Owners and Managers.",
14
+ "do-not-contact": "Do-not-contact: your Team's one list of people no Motion 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
15
  billing: "Billing: your Team's invoices, listed and downloaded as PDFs. Owners only. Seats and the Tier are under `curviate team` and `curviate tier`.",
16
16
  contactImport: "Import Contacts from a CSV, JSON or NDJSON file into a Contact list, splitting a large file into several imports.",
17
17
  contactImports: "Read your Team's import records: the counts, the failure, and the rows an import skipped and why.",
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-UEAX6KUB.js";
5
5
  import {
6
6
  readableId
7
- } from "./chunk-RWFK4AU2.js";
7
+ } from "./chunk-QA777QEJ.js";
8
8
 
9
9
  // src/lib/member-id.ts
10
10
  var MEMBER_PROVIDER_ID_RE = /^A[CDE][A-Za-z0-9_-]{4,}$/;
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  requireAccount
4
- } from "./chunk-OWKUVSX3.js";
4
+ } from "./chunk-UXFLLYFY.js";
5
5
  import {
6
6
  writeAtomic
7
7
  } from "./chunk-GOICALYQ.js";
8
8
  import {
9
9
  sendInChunks
10
- } from "./chunk-YATAUKSV.js";
10
+ } from "./chunk-SIOEKNCN.js";
11
11
  import {
12
12
  fail,
13
13
  listFlag,
14
14
  outputOpts,
15
15
  rootClient,
16
16
  usage
17
- } from "./chunk-G2BKRAVV.js";
17
+ } from "./chunk-OUY3GVWJ.js";
18
18
  import {
19
19
  buildPreviewOutput
20
20
  } from "./chunk-TCUYH5GO.js";
@@ -29,14 +29,14 @@ import {
29
29
  readablePage,
30
30
  rejectPaginationModifiersWithoutAll,
31
31
  streamAll
32
- } from "./chunk-RWFK4AU2.js";
32
+ } from "./chunk-QA777QEJ.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-I7H75AEH.js";
39
+ } from "./chunk-UA4DEQ3K.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-FBBZVIFJ.js";
49
+ } from "./chunk-AQVE6HO5.js";
50
50
 
51
51
  // src/commands/contact.ts
52
52
  import { defineCommand } from "citty";
@@ -501,12 +501,12 @@ var contactCommand = defineCommand({
501
501
  create: createCmd,
502
502
  update: updateCmd,
503
503
  delete: deleteCmd,
504
- import: lazy("contactImport", () => import("./contact-import-32WRILAG.js").then((m) => m.contactImportCommand)),
504
+ import: lazy("contactImport", () => import("./contact-import-3KASFYC5.js").then((m) => m.contactImportCommand)),
505
505
  export: exportCmd,
506
506
  enrich: enrichCmd,
507
- lists: lazy("contactLists", () => import("./contact-groups-6Z6O42GH.js").then((m) => m.contactListsCommand)),
508
- tags: lazy("contactTags", () => import("./contact-groups-6Z6O42GH.js").then((m) => m.contactTagsCommand)),
509
- imports: lazy("contactImports", () => import("./contact-import-32WRILAG.js").then((m) => m.contactImportsCommand))
507
+ lists: lazy("contactLists", () => import("./contact-groups-AAJT4TZ6.js").then((m) => m.contactListsCommand)),
508
+ tags: lazy("contactTags", () => import("./contact-groups-AAJT4TZ6.js").then((m) => m.contactTagsCommand)),
509
+ imports: lazy("contactImports", () => import("./contact-import-3KASFYC5.js").then((m) => m.contactImportsCommand))
510
510
  },
511
511
  async run() {
512
512
  const { showHelp } = await import("./examples-ICAGL2S5.js");
@@ -13,7 +13,7 @@ import {
13
13
  outputOpts,
14
14
  rootClient,
15
15
  usage
16
- } from "./chunk-G2BKRAVV.js";
16
+ } from "./chunk-OUY3GVWJ.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-RWFK4AU2.js";
27
+ } from "./chunk-QA777QEJ.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-I7H75AEH.js";
34
+ } from "./chunk-UA4DEQ3K.js";
35
35
  import {
36
36
  GLOBAL_FLAGS,
37
37
  READ_SINGLE_FLAGS,
@@ -39,7 +39,7 @@ import {
39
39
  } from "./chunk-RYWWSZUH.js";
40
40
  import {
41
41
  DESCRIPTIONS
42
- } from "./chunk-FBBZVIFJ.js";
42
+ } from "./chunk-AQVE6HO5.js";
43
43
 
44
44
  // src/commands/analytics.ts
45
45
  import { defineCommand } from "citty";
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  createClient,
8
8
  resolveEffectiveConfig
9
- } from "./chunk-I7H75AEH.js";
9
+ } from "./chunk-UA4DEQ3K.js";
10
10
 
11
11
  // src/lib/root-command.ts
12
12
  var outputOpts = (f) => ({
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-QM57YDJE.js";
6
6
  import {
7
7
  isPlainObject
8
- } from "./chunk-I7H75AEH.js";
8
+ } from "./chunk-UA4DEQ3K.js";
9
9
 
10
10
  // src/lib/paginate.ts
11
11
  import { CurviateError } from "@curviate/sdk";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  fail,
4
4
  outputOpts
5
- } from "./chunk-G2BKRAVV.js";
5
+ } from "./chunk-OUY3GVWJ.js";
6
6
 
7
7
  // src/lib/chunks.ts
8
8
  async function sendInChunks(ids, size, send, f) {
@@ -28,7 +28,7 @@ async function sendChunked(chunks, send, f, unit) {
28
28
  failed_chunk: { index: k + 1, first_row: accepted + 1, last_row: accepted + chunk.length }
29
29
  };
30
30
  if (!(err instanceof CurviateError)) {
31
- process.stderr.write(`Chunk ${k + 1} of ${total} failed; ${accepted} of ${all} ${unit} were sent before it. Nothing after it was sent.
31
+ process.stderr.write(`Chunk ${k + 1} of ${total} failed; ${accepted} of ${all} ${unit} were accepted before it. Nothing after it was sent.
32
32
  `);
33
33
  return fail(err, f);
34
34
  }
@@ -37,7 +37,7 @@ async function sendChunked(chunks, send, f, unit) {
37
37
  if (outputOpts(f).json) process.stdout.write(JSON.stringify({ error: e, progress }) + "\n");
38
38
  process.stderr.write(
39
39
  `error [${e.code}] ${e.message}
40
- Chunk ${k + 1} of ${total} failed (${unit} ${progress.failed_chunk.first_row} to ${progress.failed_chunk.last_row}); ${accepted} of ${all} ${unit} were sent before it. Nothing after it was sent.
40
+ Chunk ${k + 1} of ${total} failed (${unit} ${progress.failed_chunk.first_row} to ${progress.failed_chunk.last_row}); ${accepted} of ${all} ${unit} were accepted before it. Nothing after it was sent.
41
41
  `
42
42
  );
43
43
  process.exit(getExitCode(err));