@curviate/cli 0.38.0 → 0.40.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 (27) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +2 -2
  3. package/dist/{account-TYKHUB7X.js → account-LTXAUBBP.js} +5 -3
  4. package/dist/{chunk-ZJ7D3NFS.js → chunk-BGVK73VI.js} +1 -1
  5. package/dist/{chunk-MNDXMGPX.js → chunk-LD5KJSCT.js} +1 -1
  6. package/dist/{chunk-7JU4IXXG.js → chunk-OTBJATDE.js} +27 -1
  7. package/dist/{chunk-BN7L7WSY.js → chunk-T6G5AASF.js} +31 -4
  8. package/dist/cli.js +19 -19
  9. package/dist/{comment-G6RB2PBZ.js → comment-2CSBSBOH.js} +16 -13
  10. package/dist/{company-OWND3W3L.js → company-ZUIUR5UN.js} +32 -21
  11. package/dist/{connect-3E7EC5ZM.js → connect-LSXKNEL2.js} +8 -6
  12. package/dist/{doctor-Z6OSCGKT.js → doctor-FHOHIQPX.js} +1 -1
  13. package/dist/{feed-VDTFIMKN.js → feed-UUHB2FXI.js} +7 -4
  14. package/dist/{group-KDJHY2IM.js → group-NUCO3P2W.js} +10 -6
  15. package/dist/{inbox-DQLX2LR7.js → inbox-DEZTGTPO.js} +14 -11
  16. package/dist/{inboxes-WMNHOPY7.js → inboxes-F3NIQQRK.js} +7 -4
  17. package/dist/{job-ESKS2LDJ.js → job-YMGO3WJH.js} +10 -6
  18. package/dist/{message-5W2R3YHS.js → message-RSBUXI64.js} +3 -3
  19. package/dist/{notification-IGNUH2GR.js → notification-EJ35OD3Q.js} +7 -4
  20. package/dist/{post-NLI76K74.js → post-VHVQ56A7.js} +16 -13
  21. package/dist/{profile-TBKKIICM.js → profile-3CBNI42H.js} +20 -15
  22. package/dist/{recruiter-AEJRHIX5.js → recruiter-M7XUFYNR.js} +18 -15
  23. package/dist/{sales-nav-SW6WJVMD.js → sales-nav-S47OCEUC.js} +44 -19
  24. package/dist/{search-WRMVQU6C.js → search-UWI37MKG.js} +51 -35
  25. package/dist/{setup-YUSWG77F.js → setup-3EQRACT6.js} +1 -1
  26. package/dist/{webhook-NGMRJMQ5.js → webhook-I4U4C4XE.js} +5 -3
  27. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -8,6 +8,93 @@ a new command or flag is a minor; a breaking command/flag/exit-code change is a
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.40.0] - 2026-09-22
12
+
13
+ Follows `@curviate/sdk` to `0.37.0` and re-vendors the OpenAPI fixture from the
14
+ deployed production document. No command, flag or exit-code changes of its own.
15
+
16
+ `0.39.0` was prepared in this repository but never published to npm, so `0.40.0`
17
+ is the first release to carry that version's pagination and
18
+ `message new --subject` work to the registry. The `0.39.0` section below still
19
+ describes those changes; nothing in it was reverted.
20
+
21
+ ### Changed
22
+
23
+ - **SDK pin moves `0.36.0` to exactly `0.37.0`**, as `check:sdk-pin` requires.
24
+ That SDK release is breaking: `headers[].value_prefix` is removed from every
25
+ webhook read and a keyed `headers[].value_fingerprint` takes its place. The
26
+ CLI emits webhook reads as passthrough JSON and never rendered `value_prefix`
27
+ itself, so no command output wording changed here. The field a caller sees
28
+ from `webhook get` and `webhook list` is the server's, and only the compiled
29
+ type surface follows the pin.
30
+ - **`test/fixtures/openapi.json` re-vendored** from `@curviate/sdk@0.37.0`'s
31
+ `fixtures/openapi.json`, which was generated against production at
32
+ `9d5eb6583e24928eca0c3c8b162ad664e869af99`. `test/fixtures/VENDORED_FROM.json`
33
+ records the new `sdkVersion`, its salted `sha256` and that `sourceServerGitSha`.
34
+
35
+ ## [0.39.0] - 2026-09-22
36
+
37
+ Pagination flags are honoured and validated on every command that offers
38
+ them, and `message new` can name the chat it starts. No SDK move: the pin
39
+ stays exactly `0.36.0`.
40
+
41
+ ### Added
42
+
43
+ - **`message new --subject <s>`.** `POST /v1/{account_id}/chats` has always
44
+ accepted an optional conversation name (at most 200 characters) and
45
+ round-trips it onto the opening message, and MCP's `start_chat` exposed it,
46
+ but the CLI never followed, so the capability was unreachable from the
47
+ command line. The flag passes straight through to the request body. Omitted,
48
+ the key is left OUT of the body rather than sent as `subject: ""`: the
49
+ server's schema has no minimum length, so an empty string on the caller's
50
+ behalf would name the chat "" on the platform instead of leaving it unnamed.
51
+ - **`search service-parameters` and `sales-nav search parameters` paginate.**
52
+ Both endpoints take a cursor and return one, so both commands now offer the
53
+ full streaming set: `--cursor` to page manually, `--all` to stream every page
54
+ as NDJSON, `--max-pages` / `--page-delay` to bound and pace it. They behave
55
+ exactly like their `search parameters` sibling, down to the NDJSON notice and
56
+ the truncation sentinel, and `--max-pages` / `--page-delay` without `--all`
57
+ is the same exit 2 every other streaming command gives.
58
+
59
+ ### Changed
60
+
61
+ - **`--cursor ""` is a usage error (exit 2), never a silent restart.** Every
62
+ paginated command guarded the flag with a truthiness check, so an empty or
63
+ whitespace-only value was dropped client-side and the walk began again at
64
+ page one: `--cursor "$NEXT"` with `NEXT` unset re-read the first page
65
+ forever and reported exit 0 every time. A lost cursor is now refused before
66
+ any request, naming the flag. An omitted `--cursor` still means "start at
67
+ the first page", unchanged. Same ruling as `account link --seat-id ""` in
68
+ 0.37.0, and the API itself now answers 400 on an empty cursor. Decided once
69
+ in `lib/paginate.ts` and routed through by all 51 call sites, across 61
70
+ commands.
71
+ - **`--max-pages` must be a positive integer (exit 2 otherwise).**
72
+ `--max-pages abc` parsed to `NaN`, and a `>= NaN` comparison is false
73
+ forever, so a walk asked to stop after a few pages ran unbounded instead:
74
+ the opposite of what was typed, ending at exit 0. `0`, a negative, a
75
+ fractional value and an empty string are refused for the same reason: none
76
+ of them can be a page budget. One shared parse in `lib/paginate.ts`, used by
77
+ all 60 call sites, across 60 streaming commands.
78
+
79
+ ### Fixed
80
+
81
+ - **`search parameters --help` named a `--type` value the API rejects.** The
82
+ enum was renamed `CONNECTIONS` to `RELATION` in v2; the help text and the
83
+ `search people --connections-of` resolve hint both still said
84
+ `CONNECTIONS`, so the one lookup those lines exist to make easy answered
85
+ 400. Both now say `RELATION`, which is what the served document lists.
86
+
87
+ ### Known, not changed here
88
+
89
+ - Eleven commands declare `--cursor` against an endpoint that has no cursor
90
+ input at all (`company`, `company chat`, `company message`, `post get`,
91
+ `profile endorse`, `recruiter search parameters`, and the five
92
+ non-list `webhook` subcommands). They spread the wrong flag set rather than
93
+ dropping a real cursor, so correcting them removes `--cursor` and `--limit`
94
+ from those commands' help, which is a separate decision. Pinned by name in
95
+ `test/cursor-empty-refused-bin.test.ts` so none can drift in or out
96
+ unnoticed.
97
+
11
98
  ## [0.38.0] - 2026-09-20
12
99
 
13
100
  Re-vendored from `@curviate/sdk` 0.36.0.
package/README.md CHANGED
@@ -99,9 +99,9 @@ Global flags available on every command:
99
99
  --json Force JSON output even when stdout is a TTY
100
100
  --fields Comma-separated list of fields to include in JSON output
101
101
  --limit Maximum number of results to return per page
102
- --cursor Pagination cursor from a previous response
102
+ --cursor Pagination cursor from a previous response (an empty value is a usage error, never a restart)
103
103
  --all Stream all pages as NDJSON
104
- --max-pages Cap on the number of pages fetched with --all
104
+ --max-pages Cap on the number of pages fetched with --all (a positive integer)
105
105
  --page-delay Milliseconds to pause between pages when --all is used (default 400)
106
106
  --preview Show what would happen without sending any write request
107
107
  --verbose Output the full SDK response instead of the slim default
@@ -13,6 +13,8 @@ import {
13
13
  import {
14
14
  isJsonMode,
15
15
  pageDelayFromFlags,
16
+ readCursorFlag,
17
+ readMaxPagesFlag,
16
18
  readablePage,
17
19
  rejectPaginationModifiersWithoutAll,
18
20
  renderError,
@@ -22,7 +24,7 @@ import {
22
24
  resolveEffectiveConfig,
23
25
  streamAll,
24
26
  writeNdjsonItem
25
- } from "./chunk-7JU4IXXG.js";
27
+ } from "./chunk-OTBJATDE.js";
26
28
  import {
27
29
  AUTH_NEEDED
28
30
  } from "./chunk-XZJQQJBE.js";
@@ -213,9 +215,9 @@ async function runAccountList(client, flags, out) {
213
215
  rejectPaginationModifiersWithoutAll(flags, out);
214
216
  const outOpts = resolveOutputOpts(flags);
215
217
  const all = flags.all ?? false;
216
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
218
+ const maxPages = readMaxPagesFlag(flags, out);
217
219
  const limit = flags.limit ? parseInt(flags.limit, 10) : void 0;
218
- const cursor = flags.cursor;
220
+ const cursor = readCursorFlag(flags, out);
219
221
  const params = {};
220
222
  if (limit !== void 0) params["limit"] = limit;
221
223
  if (cursor) params["cursor"] = cursor;
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-UEAX6KUB.js";
5
5
  import {
6
6
  readableId
7
- } from "./chunk-7JU4IXXG.js";
7
+ } from "./chunk-OTBJATDE.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,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  readablePage
4
- } from "./chunk-7JU4IXXG.js";
4
+ } from "./chunk-OTBJATDE.js";
5
5
  import {
6
6
  getExitCode
7
7
  } from "./chunk-XZJQQJBE.js";
@@ -259,6 +259,30 @@ function rejectPaginationModifiersWithoutAll(flags, out) {
259
259
  `);
260
260
  process.exit(2);
261
261
  }
262
+ var DEFAULT_MAX_PAGES = 100;
263
+ function readCursorFlag(flags, out) {
264
+ const raw = flags.cursor;
265
+ if (raw === void 0) return void 0;
266
+ if (raw.trim() === "") {
267
+ out.stderr.write(
268
+ "error: --cursor was given an empty value. Pass the cursor from the previous response, or omit the flag entirely to start at the first page.\n"
269
+ );
270
+ process.exit(2);
271
+ }
272
+ return raw;
273
+ }
274
+ function readMaxPagesFlag(flags, out) {
275
+ const raw = flags["max-pages"];
276
+ if (raw === void 0) return DEFAULT_MAX_PAGES;
277
+ if (!/^\d+$/.test(raw) || Number(raw) < 1) {
278
+ out.stderr.write(
279
+ `error: --max-pages must be a positive integer (got ${JSON.stringify(raw)}); it is the number of pages --all may fetch.
280
+ `
281
+ );
282
+ process.exit(2);
283
+ }
284
+ return Number(raw);
285
+ }
262
286
  function unreadable(what) {
263
287
  return new CurviateError({
264
288
  code: "PLATFORM_ERROR",
@@ -291,7 +315,7 @@ function truncationSentinelLine(pagesFetched, hasMore) {
291
315
  return JSON.stringify({ object: "stream_truncated", pages_fetched: pagesFetched, has_more: hasMore }) + "\n";
292
316
  }
293
317
  async function* streamAll(fn, params, opts = {}) {
294
- const maxPages = opts.maxPages ?? 100;
318
+ const maxPages = opts.maxPages ?? DEFAULT_MAX_PAGES;
295
319
  const pageDelayMs = opts.pageDelayMs ?? DEFAULT_PAGE_DELAY_MS;
296
320
  const sleep = opts.sleep ?? realSleep;
297
321
  let cursor = void 0;
@@ -387,6 +411,8 @@ export {
387
411
  readablePage,
388
412
  readableId,
389
413
  rejectPaginationModifiersWithoutAll,
414
+ readCursorFlag,
415
+ readMaxPagesFlag,
390
416
  ndjsonModeNotice,
391
417
  DEFAULT_PAGE_DELAY_MS,
392
418
  pageDelayFromFlags,
@@ -18,7 +18,7 @@ import {
18
18
  } from "./chunk-UEAX6KUB.js";
19
19
  import {
20
20
  requireAccount
21
- } from "./chunk-MNDXMGPX.js";
21
+ } from "./chunk-LD5KJSCT.js";
22
22
  import {
23
23
  buildPreviewOutput
24
24
  } from "./chunk-TCUYH5GO.js";
@@ -28,7 +28,7 @@ import {
28
28
  renderSuccess,
29
29
  renderUnexpectedError,
30
30
  resolveEffectiveConfig
31
- } from "./chunk-7JU4IXXG.js";
31
+ } from "./chunk-OTBJATDE.js";
32
32
  import {
33
33
  createClient,
34
34
  downloadBinary
@@ -59,6 +59,25 @@ function rejectAllOnNonPaginated(all, out) {
59
59
  process.exit(2);
60
60
  }
61
61
  }
62
+ var CHAT_SUBJECT_MAX_CHARS = 200;
63
+ function readChatSubjectFlag(flags, out) {
64
+ const raw = flags.subject;
65
+ if (raw === void 0) return void 0;
66
+ if (raw.trim() === "") {
67
+ out.stderr.write(
68
+ "error: --subject was given an empty value. Pass the subject line, or omit the flag entirely to start an unnamed chat.\n"
69
+ );
70
+ process.exit(2);
71
+ }
72
+ if (raw.length > CHAT_SUBJECT_MAX_CHARS) {
73
+ out.stderr.write(
74
+ `error: --subject is ${raw.length} characters; the maximum is ${CHAT_SUBJECT_MAX_CHARS}.
75
+ `
76
+ );
77
+ process.exit(2);
78
+ }
79
+ return raw;
80
+ }
62
81
  function resolveOutputOpts(flags) {
63
82
  return {
64
83
  json: (flags.json ?? false) || !process.stdout.isTTY,
@@ -93,6 +112,7 @@ function willSendAsNotice(chatId) {
93
112
  return chatId.startsWith("COMPANY_") ? "Will send as a company page\n" : null;
94
113
  }
95
114
  async function runMessageNew(client, flags, out, _readStdin) {
115
+ const subject = readChatSubjectFlag(flags, out);
96
116
  const accountId = await requireAccount(client, flags, out);
97
117
  const rawTo = flags.to ?? "";
98
118
  const rawText = flags.text ?? "";
@@ -128,7 +148,7 @@ async function runMessageNew(client, flags, out, _readStdin) {
128
148
  const preview = buildPreviewOutput({
129
149
  method: "messaging.startChat",
130
150
  args: { attendees_ids: [providerId] },
131
- body: { attendees_ids: [providerId], text },
151
+ body: { attendees_ids: [providerId], text, ...subject !== void 0 ? { subject } : {} },
132
152
  account: accountId,
133
153
  attachments: attachBuffers.map((buf, i) => ({
134
154
  name: attachPaths[i] ? attachPaths[i].split("/").pop() ?? attachPaths[i] : `attachment_${i}`,
@@ -141,6 +161,9 @@ async function runMessageNew(client, flags, out, _readStdin) {
141
161
  const body = {
142
162
  attendees_ids: [providerId],
143
163
  text,
164
+ // Present only when the flag was given: an absent subject must leave the
165
+ // key out, never send `subject: ""` (the server has no `.min(1)`).
166
+ ...subject !== void 0 ? { subject } : {},
144
167
  ...attachmentPayloads.length > 0 ? { attachments: attachmentPayloads } : {}
145
168
  };
146
169
  try {
@@ -390,6 +413,10 @@ var messageNewCommand = defineCommand({
390
413
  required: true
391
414
  },
392
415
  text: { type: "positional", stdinArg: true, description: "Opening message text. Pass - to read from stdin (e.g. via heredoc or pipe)." },
416
+ subject: {
417
+ type: "string",
418
+ description: "Optional conversation name / subject line (at most 200 characters). Omit it for an unnamed chat; an empty value is a usage error."
419
+ },
393
420
  attach: { type: "string", description: "File to attach (repeatable)." }
394
421
  },
395
422
  async run({ args }) {
@@ -653,7 +680,7 @@ var MESSAGE_SUBCOMMANDS = [
653
680
  "inmail",
654
681
  "inmail-balance"
655
682
  ];
656
- var MESSAGE_USAGE = 'Usage: curviate message new --to <attendee> "<text>" [--attach <file>...]\n curviate message send <chat_id> "<text>" [--attach <file>...]\n curviate message <chat_id> "<text>" [--attach <file>...]\n curviate message get <chat_id> <message_id>\n curviate message edit <chat_id> <message_id> "<text>"\n curviate message delete <chat_id> <message_id>\n curviate message react <chat_id> <message_id> <emoji>\n curviate message attachment <chat_id> <message_id> <attachment_id> [-o <file>]\n curviate message inmail --to <id> --subject <s> "<text>"\n curviate message inmail-balance\n';
683
+ var MESSAGE_USAGE = 'Usage: curviate message new --to <attendee> "<text>" [--subject <s>] [--attach <file>...]\n curviate message send <chat_id> "<text>" [--attach <file>...]\n curviate message <chat_id> "<text>" [--attach <file>...]\n curviate message get <chat_id> <message_id>\n curviate message edit <chat_id> <message_id> "<text>"\n curviate message delete <chat_id> <message_id>\n curviate message react <chat_id> <message_id> <emoji>\n curviate message attachment <chat_id> <message_id> <attachment_id> [-o <file>]\n curviate message inmail --to <id> --subject <s> "<text>"\n curviate message inmail-balance\n';
657
684
  function guardBareMessageForm(chatId, out) {
658
685
  if (!looksLikeCommandWord(chatId)) return;
659
686
  const suggestion = nearestSubcommand(chatId, [...MESSAGE_SUBCOMMANDS]);
package/dist/cli.js CHANGED
@@ -414,30 +414,30 @@ var main = defineCommand({
414
414
  // Subcommand registry, names and descriptions are static for help rendering;
415
415
  // the handler implementation is loaded lazily on first invocation.
416
416
  subCommands: {
417
- setup: () => import("./setup-YUSWG77F.js").then((m) => m.setupCommand),
418
- doctor: () => import("./doctor-Z6OSCGKT.js").then((m) => m.doctorCommand),
417
+ setup: () => import("./setup-3EQRACT6.js").then((m) => m.setupCommand),
418
+ doctor: () => import("./doctor-FHOHIQPX.js").then((m) => m.doctorCommand),
419
419
  login: () => import("./login-YTVPIN27.js").then((m) => m.loginCommand),
420
420
  config: () => import("./config-RUBXWFQ3.js").then((m) => m.configCommand),
421
421
  // ---------------------------------------------------------------------------
422
422
  // Noun groups, lazy-loaded on first invocation.
423
423
  // ---------------------------------------------------------------------------
424
- profile: () => import("./profile-TBKKIICM.js").then((m) => m.profileCommand),
425
- company: () => import("./company-OWND3W3L.js").then((m) => m.companyCommand),
426
- job: () => import("./job-ESKS2LDJ.js").then((m) => m.jobCommand),
427
- connect: () => import("./connect-3E7EC5ZM.js").then((m) => m.connectCommand),
428
- search: () => import("./search-WRMVQU6C.js").then((m) => m.searchCommand),
429
- inbox: () => import("./inbox-DQLX2LR7.js").then((m) => m.inboxCommand),
430
- inboxes: () => import("./inboxes-WMNHOPY7.js").then((m) => m.inboxesCommand),
431
- message: () => import("./message-5W2R3YHS.js").then((m) => m.messageCommand),
432
- post: () => import("./post-NLI76K74.js").then((m) => m.postCommand),
433
- comment: () => import("./comment-G6RB2PBZ.js").then((m) => m.commentCommand),
434
- account: () => import("./account-TYKHUB7X.js").then((m) => m.accountCommand),
435
- webhook: () => import("./webhook-NGMRJMQ5.js").then((m) => m.webhookCommand),
436
- "sales-nav": () => import("./sales-nav-SW6WJVMD.js").then((m) => m.salesNavCommand),
437
- recruiter: () => import("./recruiter-AEJRHIX5.js").then((m) => m.recruiterCommand),
438
- group: () => import("./group-KDJHY2IM.js").then((m) => m.groupCommand),
439
- feed: () => import("./feed-VDTFIMKN.js").then((m) => m.feedCommand),
440
- notification: () => import("./notification-IGNUH2GR.js").then((m) => m.notificationCommand)
424
+ profile: () => import("./profile-3CBNI42H.js").then((m) => m.profileCommand),
425
+ company: () => import("./company-ZUIUR5UN.js").then((m) => m.companyCommand),
426
+ job: () => import("./job-YMGO3WJH.js").then((m) => m.jobCommand),
427
+ connect: () => import("./connect-LSXKNEL2.js").then((m) => m.connectCommand),
428
+ search: () => import("./search-UWI37MKG.js").then((m) => m.searchCommand),
429
+ inbox: () => import("./inbox-DEZTGTPO.js").then((m) => m.inboxCommand),
430
+ inboxes: () => import("./inboxes-F3NIQQRK.js").then((m) => m.inboxesCommand),
431
+ message: () => import("./message-RSBUXI64.js").then((m) => m.messageCommand),
432
+ post: () => import("./post-VHVQ56A7.js").then((m) => m.postCommand),
433
+ comment: () => import("./comment-2CSBSBOH.js").then((m) => m.commentCommand),
434
+ account: () => import("./account-LTXAUBBP.js").then((m) => m.accountCommand),
435
+ webhook: () => import("./webhook-I4U4C4XE.js").then((m) => m.webhookCommand),
436
+ "sales-nav": () => import("./sales-nav-S47OCEUC.js").then((m) => m.salesNavCommand),
437
+ recruiter: () => import("./recruiter-M7XUFYNR.js").then((m) => m.recruiterCommand),
438
+ group: () => import("./group-NUCO3P2W.js").then((m) => m.groupCommand),
439
+ feed: () => import("./feed-UUHB2FXI.js").then((m) => m.feedCommand),
440
+ notification: () => import("./notification-EJ35OD3Q.js").then((m) => m.notificationCommand)
441
441
  },
442
442
  async run() {
443
443
  const { runMain } = await import("citty");
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  resolveMemberOrMeProviderId
4
- } from "./chunk-ZJ7D3NFS.js";
4
+ } from "./chunk-BGVK73VI.js";
5
5
  import {
6
6
  AttachError,
7
7
  describeAttachment,
@@ -11,12 +11,14 @@ import {
11
11
  import "./chunk-UEAX6KUB.js";
12
12
  import {
13
13
  requireAccount
14
- } from "./chunk-MNDXMGPX.js";
14
+ } from "./chunk-LD5KJSCT.js";
15
15
  import {
16
16
  buildPreviewOutput
17
17
  } from "./chunk-TCUYH5GO.js";
18
18
  import {
19
19
  pageDelayFromFlags,
20
+ readCursorFlag,
21
+ readMaxPagesFlag,
20
22
  readablePage,
21
23
  rejectPaginationModifiersWithoutAll,
22
24
  renderError,
@@ -25,7 +27,7 @@ import {
25
27
  resolveEffectiveConfig,
26
28
  streamAll,
27
29
  writeNdjsonItem
28
- } from "./chunk-7JU4IXXG.js";
30
+ } from "./chunk-OTBJATDE.js";
29
31
  import "./chunk-XZJQQJBE.js";
30
32
  import {
31
33
  createClient
@@ -59,10 +61,11 @@ function resolveOutputOpts(flags) {
59
61
  verbose: flags.verbose ?? false
60
62
  };
61
63
  }
62
- function buildListQuery(flags) {
64
+ function buildListQuery(flags, out) {
63
65
  const params = {};
64
66
  if (flags.limit) params.limit = parseInt(flags.limit, 10);
65
- if (flags.cursor) params.cursor = flags.cursor;
67
+ const cursor = readCursorFlag(flags, out);
68
+ if (cursor) params.cursor = cursor;
66
69
  return params;
67
70
  }
68
71
  async function handleSdkError(err, outOpts, out) {
@@ -95,8 +98,8 @@ async function runCommentList(client, flags, out) {
95
98
  const ns = client.account(accountId);
96
99
  const outOpts = resolveOutputOpts(flags);
97
100
  const all = flags.all ?? false;
98
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
99
- const params = buildListQuery(flags);
101
+ const maxPages = readMaxPagesFlag(flags, out);
102
+ const params = buildListQuery(flags, out);
100
103
  try {
101
104
  if (all) {
102
105
  const fn = (p) => ns.posts.listComments(postId, p);
@@ -125,8 +128,8 @@ async function runCommentReplies(client, flags, out) {
125
128
  const ns = client.account(accountId);
126
129
  const outOpts = resolveOutputOpts(flags);
127
130
  const all = flags.all ?? false;
128
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
129
- const params = buildListQuery(flags);
131
+ const maxPages = readMaxPagesFlag(flags, out);
132
+ const params = buildListQuery(flags, out);
130
133
  try {
131
134
  if (all) {
132
135
  const fn = (p) => ns.comments.listReplies(postId, commentId, p);
@@ -155,8 +158,8 @@ async function runCommentReactions(client, flags, out) {
155
158
  const ns = client.account(accountId);
156
159
  const outOpts = resolveOutputOpts(flags);
157
160
  const all = flags.all ?? false;
158
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
159
- const params = buildListQuery(flags);
161
+ const maxPages = readMaxPagesFlag(flags, out);
162
+ const params = buildListQuery(flags, out);
160
163
  try {
161
164
  if (all) {
162
165
  const fn = (p) => ns.comments.listReactions(postId, commentId, p);
@@ -190,8 +193,8 @@ async function runCommentUser(client, flags, out) {
190
193
  return;
191
194
  }
192
195
  const all = flags.all ?? false;
193
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
194
- const params = buildListQuery(flags);
196
+ const maxPages = readMaxPagesFlag(flags, out);
197
+ const params = buildListQuery(flags, out);
195
198
  try {
196
199
  if (all) {
197
200
  const fn = (p) => ns.comments.listUserComments(userId, p);
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-XP2LN6F6.js";
11
11
  import {
12
12
  sentAsNotice
13
- } from "./chunk-BN7L7WSY.js";
13
+ } from "./chunk-T6G5AASF.js";
14
14
  import "./chunk-UWO2D4HW.js";
15
15
  import "./chunk-HOQ7EUHJ.js";
16
16
  import {
@@ -23,12 +23,14 @@ import {
23
23
  } from "./chunk-UEAX6KUB.js";
24
24
  import {
25
25
  requireAccount
26
- } from "./chunk-MNDXMGPX.js";
26
+ } from "./chunk-LD5KJSCT.js";
27
27
  import {
28
28
  buildPreviewOutput
29
29
  } from "./chunk-TCUYH5GO.js";
30
30
  import {
31
31
  pageDelayFromFlags,
32
+ readCursorFlag,
33
+ readMaxPagesFlag,
32
34
  readableId,
33
35
  readablePage,
34
36
  rejectPaginationModifiersWithoutAll,
@@ -38,7 +40,7 @@ import {
38
40
  resolveEffectiveConfig,
39
41
  streamAll,
40
42
  writeNdjsonItem
41
- } from "./chunk-7JU4IXXG.js";
43
+ } from "./chunk-OTBJATDE.js";
42
44
  import "./chunk-XZJQQJBE.js";
43
45
  import {
44
46
  createClient
@@ -124,13 +126,14 @@ async function runCompanyEmployees(client, flags, out) {
124
126
  const outOpts = resolveOutputOpts(flags);
125
127
  const params = {};
126
128
  if (flags.limit) params["limit"] = parseInt(flags.limit, 10);
127
- if (flags.cursor) params["cursor"] = flags.cursor;
129
+ const cursor = readCursorFlag(flags, out);
130
+ if (cursor) params["cursor"] = cursor;
128
131
  if (flags.keywords) params["keywords"] = flags.keywords;
129
132
  if (flags.location) params["location"] = flags.location;
130
133
  try {
131
134
  const identifier = await resolveCompanyId(ns, flags.id ?? "");
132
135
  if (flags.all) {
133
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
136
+ const maxPages = readMaxPagesFlag(flags, out);
134
137
  const fn = (p) => ns.companies.employees(identifier, p);
135
138
  for await (const item of streamAll(fn, params, {
136
139
  maxPages,
@@ -156,11 +159,12 @@ async function runCompanyPosts(client, flags, out) {
156
159
  const outOpts = resolveOutputOpts(flags);
157
160
  const params = {};
158
161
  if (flags.limit) params["limit"] = parseInt(flags.limit, 10);
159
- if (flags.cursor) params["cursor"] = flags.cursor;
162
+ const cursor = readCursorFlag(flags, out);
163
+ if (cursor) params["cursor"] = cursor;
160
164
  try {
161
165
  const identifier = await resolveCompanyId(ns, flags.id ?? "");
162
166
  if (flags.all) {
163
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
167
+ const maxPages = readMaxPagesFlag(flags, out);
164
168
  const fn = (p) => ns.companies.posts(identifier, p);
165
169
  for await (const item of streamAll(fn, params, {
166
170
  maxPages,
@@ -186,12 +190,13 @@ async function runCompanyJobs(client, flags, out) {
186
190
  const outOpts = resolveOutputOpts(flags);
187
191
  const params = {};
188
192
  if (flags.limit) params["limit"] = parseInt(flags.limit, 10);
189
- if (flags.cursor) params["cursor"] = flags.cursor;
193
+ const cursor = readCursorFlag(flags, out);
194
+ if (cursor) params["cursor"] = cursor;
190
195
  if (flags.keywords) params["keywords"] = flags.keywords;
191
196
  try {
192
197
  const identifier = await resolveCompanyId(ns, flags.id ?? "");
193
198
  if (flags.all) {
194
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
199
+ const maxPages = readMaxPagesFlag(flags, out);
195
200
  const fn = (p) => ns.companies.jobs(identifier, p);
196
201
  for await (const item of streamAll(fn, params, {
197
202
  maxPages,
@@ -217,11 +222,12 @@ async function runCompanyInvitableFollowers(client, flags, out) {
217
222
  const outOpts = resolveOutputOpts(flags);
218
223
  const params = {};
219
224
  if (flags.limit) params["limit"] = parseInt(flags.limit, 10);
220
- if (flags.cursor) params["cursor"] = flags.cursor;
225
+ const cursor = readCursorFlag(flags, out);
226
+ if (cursor) params["cursor"] = cursor;
221
227
  try {
222
228
  const identifier = await resolveCompanyId(ns, flags.id ?? "");
223
229
  if (flags.all) {
224
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
230
+ const maxPages = readMaxPagesFlag(flags, out);
225
231
  const fn = (p) => ns.companies.invitableFollowers(identifier, p);
226
232
  for await (const item of streamAll(fn, params, {
227
233
  maxPages,
@@ -277,10 +283,11 @@ async function runCompanyManaged(client, flags, out) {
277
283
  const outOpts = resolveOutputOpts(flags);
278
284
  const params = {};
279
285
  if (flags.limit) params["limit"] = parseInt(flags.limit, 10);
280
- if (flags.cursor) params["cursor"] = flags.cursor;
286
+ const cursor = readCursorFlag(flags, out);
287
+ if (cursor) params["cursor"] = cursor;
281
288
  try {
282
289
  if (flags.all) {
283
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
290
+ const maxPages = readMaxPagesFlag(flags, out);
284
291
  const fn = (p) => ns.companies.managed(p);
285
292
  for await (const item of streamAll(fn, params, {
286
293
  maxPages,
@@ -306,11 +313,12 @@ async function runCompanyFollowers(client, flags, out) {
306
313
  const outOpts = resolveOutputOpts(flags);
307
314
  const params = {};
308
315
  if (flags.limit) params["limit"] = parseInt(flags.limit, 10);
309
- if (flags.cursor) params["cursor"] = flags.cursor;
316
+ const cursor = readCursorFlag(flags, out);
317
+ if (cursor) params["cursor"] = cursor;
310
318
  try {
311
319
  const identifier = await resolveCompanyId(ns, flags.id ?? "");
312
320
  if (flags.all) {
313
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
321
+ const maxPages = readMaxPagesFlag(flags, out);
314
322
  const fn = (p) => ns.companies.followers(identifier, p);
315
323
  for await (const item of streamAll(fn, params, {
316
324
  maxPages,
@@ -336,11 +344,12 @@ async function runCompanyChats(client, flags, out) {
336
344
  const outOpts = resolveOutputOpts(flags);
337
345
  const params = {};
338
346
  if (flags.limit) params["limit"] = parseInt(flags.limit, 10);
339
- if (flags.cursor) params["cursor"] = flags.cursor;
347
+ const cursor = readCursorFlag(flags, out);
348
+ if (cursor) params["cursor"] = cursor;
340
349
  try {
341
350
  const identifier = await resolveCompanyId(ns, flags.id ?? "");
342
351
  if (flags.all) {
343
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
352
+ const maxPages = readMaxPagesFlag(flags, out);
344
353
  const fn = (p) => ns.companies.chats(identifier, p);
345
354
  for await (const item of streamAll(fn, params, {
346
355
  maxPages,
@@ -385,11 +394,12 @@ async function runCompanyMessages(client, flags, out) {
385
394
  const chatId = flags.chatId ?? "";
386
395
  const params = {};
387
396
  if (flags.limit) params["limit"] = parseInt(flags.limit, 10);
388
- if (flags.cursor) params["cursor"] = flags.cursor;
397
+ const cursor = readCursorFlag(flags, out);
398
+ if (cursor) params["cursor"] = cursor;
389
399
  try {
390
400
  const identifier = await resolveCompanyId(ns, flags.id ?? "");
391
401
  if (flags.all) {
392
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
402
+ const maxPages = readMaxPagesFlag(flags, out);
393
403
  const fn = (p) => ns.companies.messages(identifier, chatId, p);
394
404
  for await (const item of streamAll(fn, params, {
395
405
  maxPages,
@@ -437,11 +447,12 @@ async function runCompanySearchChats(client, flags, out) {
437
447
  if (flags.topic) params["topic"] = flags.topic;
438
448
  if (flags.unread !== void 0) params["unread"] = flags.unread;
439
449
  if (flags.limit) params["limit"] = parseInt(flags.limit, 10);
440
- if (flags.cursor) params["cursor"] = flags.cursor;
450
+ const cursor = readCursorFlag(flags, out);
451
+ if (cursor) params["cursor"] = cursor;
441
452
  try {
442
453
  const identifier = await resolveCompanyId(ns, flags.id ?? "");
443
454
  if (flags.all) {
444
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
455
+ const maxPages = readMaxPagesFlag(flags, out);
445
456
  const fn = (p) => ns.companies.searchChats(identifier, p);
446
457
  for await (const item of streamAll(fn, params, {
447
458
  maxPages,
@@ -13,12 +13,14 @@ import {
13
13
  } from "./chunk-UEAX6KUB.js";
14
14
  import {
15
15
  requireAccount
16
- } from "./chunk-MNDXMGPX.js";
16
+ } from "./chunk-LD5KJSCT.js";
17
17
  import {
18
18
  buildPreviewOutput
19
19
  } from "./chunk-TCUYH5GO.js";
20
20
  import {
21
21
  pageDelayFromFlags,
22
+ readCursorFlag,
23
+ readMaxPagesFlag,
22
24
  readablePage,
23
25
  rejectPaginationModifiersWithoutAll,
24
26
  renderError,
@@ -27,7 +29,7 @@ import {
27
29
  resolveEffectiveConfig,
28
30
  streamAll,
29
31
  writeNdjsonItem
30
- } from "./chunk-7JU4IXXG.js";
32
+ } from "./chunk-OTBJATDE.js";
31
33
  import "./chunk-XZJQQJBE.js";
32
34
  import {
33
35
  createClient
@@ -100,9 +102,9 @@ async function runConnectSent(client, flags, out) {
100
102
  const ns = client.account(accountId);
101
103
  const outOpts = resolveOutputOpts(flags);
102
104
  const all = flags.all ?? false;
103
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
105
+ const maxPages = readMaxPagesFlag(flags, out);
104
106
  const limit = flags.limit ? parseInt(flags.limit, 10) : void 0;
105
- const cursor = flags.cursor;
107
+ const cursor = readCursorFlag(flags, out);
106
108
  const params = {};
107
109
  if (limit !== void 0) params["limit"] = limit;
108
110
  if (cursor) params["cursor"] = cursor;
@@ -140,9 +142,9 @@ async function runConnectReceived(client, flags, out) {
140
142
  const ns = client.account(accountId);
141
143
  const outOpts = resolveOutputOpts(flags);
142
144
  const all = flags.all ?? false;
143
- const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
145
+ const maxPages = readMaxPagesFlag(flags, out);
144
146
  const limit = flags.limit ? parseInt(flags.limit, 10) : void 0;
145
- const cursor = flags.cursor;
147
+ const cursor = readCursorFlag(flags, out);
146
148
  const params = {};
147
149
  if (limit !== void 0) params["limit"] = limit;
148
150
  if (cursor) params["cursor"] = cursor;