@curviate/cli 0.14.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CHANGELOG.md +161 -0
  2. package/README.md +52 -79
  3. package/dist/{account-7AUDAMIK.js → account-FM473HEK.js} +38 -371
  4. package/dist/{chunk-SSPILTKF.js → chunk-45KHSWCV.js} +56 -48
  5. package/dist/chunk-BGZW6B7G.js +59 -0
  6. package/dist/chunk-EEMJDJ4W.js +80 -0
  7. package/dist/{chunk-JXF47TRY.js → chunk-M33MI53G.js} +33 -1
  8. package/dist/chunk-QJZ3LWOX.js +24 -0
  9. package/dist/{chunk-4JHGVY7R.js → chunk-TMU3CSPR.js} +4 -0
  10. package/dist/{chunk-HMAGEMF7.js → chunk-ZE7QGR3F.js} +4 -0
  11. package/dist/cli.js +127 -15
  12. package/dist/comment-NCDXERSI.js +555 -0
  13. package/dist/{company-RU2CA5DY.js → company-IYTMW64G.js} +27 -74
  14. package/dist/{config-Q2AEWSEC.js → config-P5CPF5WC.js} +1 -1
  15. package/dist/{connect-QT6ZOS75.js → connect-TTJHMBUP.js} +91 -45
  16. package/dist/{exit-codes-ZTY2NY3X.js → exit-codes-SL3GQF7W.js} +1 -1
  17. package/dist/{inbox-DN7X7CM2.js → inbox-EOOGJ3ZN.js} +55 -124
  18. package/dist/job-YARGTHUY.js +631 -0
  19. package/dist/{login-BBVQLXM7.js → login-MFB45PVZ.js} +1 -1
  20. package/dist/{message-6K5E3CUF.js → message-2DLIQIE6.js} +61 -51
  21. package/dist/{post-2JQZ3OSF.js → post-GRIJ7X52.js} +188 -221
  22. package/dist/profile-57RJEL7H.js +809 -0
  23. package/dist/{recruiter-XHVMQWK6.js → recruiter-CTYH7AYG.js} +740 -226
  24. package/dist/{sales-nav-QTSTJMKA.js → sales-nav-NUMEYOEO.js} +119 -77
  25. package/dist/{search-ZGTS45BT.js → search-RD4TXNV7.js} +103 -39
  26. package/dist/{webhook-EIY5WWTE.js → webhook-CEP7SGP5.js} +8 -45
  27. package/package.json +4 -3
  28. package/dist/chunk-GXTZION6.js +0 -45
  29. package/dist/chunk-Q43HZUN3.js +0 -29
  30. package/dist/job-FGGQEXSU.js +0 -105
  31. package/dist/profile-DD5GMGNL.js +0 -501
@@ -1,21 +1,26 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- streamAll
4
- } from "./chunk-GXTZION6.js";
3
+ buildPreviewOutput
4
+ } from "./chunk-R3VLWLVV.js";
5
5
  import {
6
6
  normalizeChatId
7
7
  } from "./chunk-DMQZEPQE.js";
8
+ import {
9
+ pageDelayFromFlags,
10
+ streamAll
11
+ } from "./chunk-EEMJDJ4W.js";
8
12
  import {
9
13
  createClient,
10
14
  renderError,
11
15
  renderSuccess,
12
16
  renderUnexpectedError,
13
17
  resolveEffectiveConfig
14
- } from "./chunk-JXF47TRY.js";
18
+ } from "./chunk-M33MI53G.js";
15
19
  import {
16
20
  GLOBAL_FLAGS,
17
- READ_SINGLE_FLAGS
18
- } from "./chunk-4JHGVY7R.js";
21
+ READ_SINGLE_FLAGS,
22
+ WRITE_SINGLE_FLAGS
23
+ } from "./chunk-TMU3CSPR.js";
19
24
 
20
25
  // src/commands/inbox.ts
21
26
  import { defineCommand } from "citty";
@@ -69,7 +74,7 @@ function validateIsoZTimestamp(value, flagName, out) {
69
74
  async function handleSdkError(err, outOpts, out) {
70
75
  const { CurviateError } = await import("@curviate/sdk");
71
76
  if (err instanceof CurviateError) {
72
- const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
77
+ const { getExitCode } = await import("./exit-codes-SL3GQF7W.js");
73
78
  renderError(err, outOpts, out);
74
79
  process.exit(getExitCode(err.code));
75
80
  }
@@ -92,8 +97,8 @@ async function runInboxList(client, flags, out) {
92
97
  const fn = (p) => ns.messaging.listChats(p);
93
98
  for await (const item of streamAll(fn, params, {
94
99
  maxPages,
95
- onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
96
- `)
100
+ out,
101
+ pageDelayMs: pageDelayFromFlags(flags)
97
102
  })) {
98
103
  out.stdout.write(JSON.stringify(item) + "\n");
99
104
  }
@@ -119,6 +124,24 @@ async function runInboxGet(client, flags, out) {
119
124
  await handleSdkError(err, outOpts, out);
120
125
  }
121
126
  }
127
+ async function runInboxMarkRead(client, flags, out) {
128
+ const accountId = requireAccount(flags.account, out);
129
+ const chatId = normalizeChatId(flags.chatId ?? "");
130
+ const body = { read: true };
131
+ if (flags.preview) {
132
+ const preview = buildPreviewOutput({ method: "messaging.markChatRead", args: { chat_id: chatId }, body, account: accountId });
133
+ out.stdout.write(JSON.stringify(preview) + "\n");
134
+ return;
135
+ }
136
+ const ns = client.account(accountId);
137
+ const outOpts = resolveOutputOpts(flags);
138
+ try {
139
+ const result = await ns.messaging.markChatRead(chatId, body);
140
+ renderSuccess(result, outOpts, out);
141
+ } catch (err) {
142
+ await handleSdkError(err, outOpts, out);
143
+ }
144
+ }
122
145
  async function runInboxMessages(client, flags, out) {
123
146
  rejectPreviewOnRead(flags.preview, out);
124
147
  const accountId = requireAccount(flags.account, out);
@@ -141,8 +164,8 @@ async function runInboxMessages(client, flags, out) {
141
164
  const fn = (p) => ns.messaging.listMessages(chatId, p);
142
165
  for await (const item of streamAll(fn, params, {
143
166
  maxPages,
144
- onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
145
- `)
167
+ out,
168
+ pageDelayMs: pageDelayFromFlags(flags)
146
169
  })) {
147
170
  out.stdout.write(JSON.stringify(item) + "\n");
148
171
  }
@@ -154,61 +177,6 @@ async function runInboxMessages(client, flags, out) {
154
177
  await handleSdkError(err, outOpts, out);
155
178
  }
156
179
  }
157
- async function runInboxSync(client, flags, out) {
158
- rejectPreviewOnRead(flags.preview, out);
159
- rejectAllOnNonPaginated(flags.all, out);
160
- const accountId = requireAccount(flags.account, out);
161
- const ns = client.account(accountId);
162
- const outOpts = resolveOutputOpts(flags);
163
- try {
164
- const result = await ns.messaging.syncMessages();
165
- renderSuccess(result, outOpts, out);
166
- } catch (err) {
167
- await handleSdkError(err, outOpts, out);
168
- }
169
- }
170
- var SYNC_TERMINAL_STATUSES = /* @__PURE__ */ new Set(["done", "error", "chat_deleted"]);
171
- var SYNC_POLL_INTERVAL_MS = 2e3;
172
- async function runInboxSyncChat(client, flags, out, _sleep) {
173
- rejectPreviewOnRead(flags.preview, out);
174
- rejectAllOnNonPaginated(flags.all, out);
175
- const accountId = requireAccount(flags.account, out);
176
- const chatId = normalizeChatId(flags.chatId ?? "");
177
- const ns = client.account(accountId);
178
- const outOpts = resolveOutputOpts(flags);
179
- if (!flags.wait) {
180
- try {
181
- const result = await ns.messaging.syncChat(chatId);
182
- renderSuccess(result, outOpts, out);
183
- } catch (err) {
184
- await handleSdkError(err, outOpts, out);
185
- }
186
- return;
187
- }
188
- const sleep = _sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
189
- const timeoutSecs = parseInt(flags.timeout ?? "30", 10);
190
- const timeoutMs = (Number.isNaN(timeoutSecs) ? 30 : timeoutSecs) * 1e3;
191
- const startTime = Date.now();
192
- while (true) {
193
- let result;
194
- try {
195
- result = await ns.messaging.syncChat(chatId);
196
- } catch (err) {
197
- await handleSdkError(err, outOpts, out);
198
- }
199
- const resp = result;
200
- if (resp.status !== void 0 && SYNC_TERMINAL_STATUSES.has(resp.status)) {
201
- renderSuccess(result, outOpts, out);
202
- return;
203
- }
204
- if (Date.now() - startTime >= timeoutMs) {
205
- renderSuccess(result, outOpts, out);
206
- process.exit(3);
207
- return;
208
- }
209
- await sleep(SYNC_POLL_INTERVAL_MS);
210
- }
211
- }
212
180
  var inboxListCommand = defineCommand({
213
181
  meta: { name: "list", description: "List inbox chats." },
214
182
  args: {
@@ -262,19 +230,12 @@ var inboxGetCommand = defineCommand({
262
230
  await runInboxGet(client, { ...flags, account: flags.account ?? cfg.account }, out);
263
231
  }
264
232
  });
265
- var inboxMessagesCommand = defineCommand({
266
- meta: { name: "messages", description: "List messages in a chat." },
233
+ var inboxMarkReadCommand = defineCommand({
234
+ meta: { name: "mark-read", description: "Mark a chat as read." },
267
235
  args: {
268
- ...GLOBAL_FLAGS,
269
- chatId: { type: "positional", description: "Chat ID." },
270
- before: {
271
- type: "string",
272
- description: "Return messages before this timestamp (ISO-8601, UTC \u2014 Z suffix required, e.g. 2025-01-01T00:00:00Z)."
273
- },
274
- after: {
275
- type: "string",
276
- description: "Return messages after this timestamp (ISO-8601, UTC \u2014 Z suffix required, e.g. 2025-01-01T00:00:00Z)."
277
- }
236
+ // Write command: WRITE_SINGLE_FLAGS omits pagination flags, keeps --fields
237
+ ...WRITE_SINGLE_FLAGS,
238
+ chatId: { type: "positional", description: "Chat ID or LinkedIn messaging thread URL." }
278
239
  },
279
240
  async run({ args }) {
280
241
  const flags = args;
@@ -291,50 +252,21 @@ var inboxMessagesCommand = defineCommand({
291
252
  }
292
253
  const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
293
254
  const out = buildOutputStreams();
294
- await runInboxMessages(client, { ...flags, account: flags.account ?? cfg.account }, out);
255
+ await runInboxMarkRead(client, { ...flags, account: flags.account ?? cfg.account }, out);
295
256
  }
296
257
  });
297
- var inboxSyncCommand = defineCommand({
298
- meta: { name: "sync", description: "Re-sync account message history." },
299
- args: {
300
- // Single-object read: READ_SINGLE_FLAGS omits pagination flags, keeps --fields
301
- ...READ_SINGLE_FLAGS
302
- },
303
- async run({ args }) {
304
- const flags = args;
305
- const cfg = await resolveEffectiveConfig({
306
- apiKey: flags["api-key"],
307
- baseUrl: flags["base-url"],
308
- timeout: flags.timeout,
309
- account: flags.account,
310
- profile: flags.profile
311
- });
312
- if (!cfg.apiKey) {
313
- process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
314
- process.exit(3);
315
- }
316
- const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
317
- const out = buildOutputStreams();
318
- await runInboxSync(client, { ...flags, account: flags.account ?? cfg.account }, out);
319
- }
320
- });
321
- var inboxSyncChatCommand = defineCommand({
322
- meta: { name: "sync-chat", description: "Re-sync a specific chat's message history." },
258
+ var inboxMessagesCommand = defineCommand({
259
+ meta: { name: "messages", description: "List messages in a chat. A very recent send/delete may take a few minutes to appear or clear here (LinkedIn-side indexing); `message get <chat_id> <message_id>` reflects it immediately." },
323
260
  args: {
324
- // Single-object read: READ_SINGLE_FLAGS omits pagination flags, keeps --fields.
325
- // The timeout below overrides READ_SINGLE_FLAGS.timeout with a command-specific description.
326
- ...READ_SINGLE_FLAGS,
261
+ ...GLOBAL_FLAGS,
327
262
  chatId: { type: "positional", description: "Chat ID." },
328
- wait: {
329
- type: "boolean",
330
- description: "Poll until sync completes (or --timeout elapses).",
331
- default: false
263
+ before: {
264
+ type: "string",
265
+ description: "Return messages before this timestamp (ISO-8601, UTC \u2014 Z suffix required, e.g. 2025-01-01T00:00:00Z)."
332
266
  },
333
- // Override READ_SINGLE_FLAGS.timeout: here --timeout is the polling wait timeout
334
- // in seconds (default: 30), not the SDK request timeout.
335
- timeout: {
267
+ after: {
336
268
  type: "string",
337
- description: "Polling timeout in seconds (default: 30, requires --wait)."
269
+ description: "Return messages after this timestamp (ISO-8601, UTC \u2014 Z suffix required, e.g. 2025-01-01T00:00:00Z)."
338
270
  }
339
271
  },
340
272
  async run({ args }) {
@@ -342,6 +274,7 @@ var inboxSyncChatCommand = defineCommand({
342
274
  const cfg = await resolveEffectiveConfig({
343
275
  apiKey: flags["api-key"],
344
276
  baseUrl: flags["base-url"],
277
+ timeout: flags.timeout,
345
278
  account: flags.account,
346
279
  profile: flags.profile
347
280
  });
@@ -351,21 +284,20 @@ var inboxSyncChatCommand = defineCommand({
351
284
  }
352
285
  const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
353
286
  const out = buildOutputStreams();
354
- await runInboxSyncChat(client, { ...flags, account: flags.account ?? cfg.account }, out);
287
+ await runInboxMessages(client, { ...flags, account: flags.account ?? cfg.account }, out);
355
288
  }
356
289
  });
357
290
  var inboxCommand = defineCommand({
358
- meta: { name: "inbox", description: "Read and sync LinkedIn message inbox." },
291
+ meta: { name: "inbox", description: "Read LinkedIn message inbox." },
359
292
  subCommands: {
360
293
  list: inboxListCommand,
361
294
  get: inboxGetCommand,
362
- messages: inboxMessagesCommand,
363
- sync: inboxSyncCommand,
364
- "sync-chat": inboxSyncChatCommand
295
+ "mark-read": inboxMarkReadCommand,
296
+ messages: inboxMessagesCommand
365
297
  },
366
298
  async run() {
367
299
  process.stderr.write(
368
- "Usage: curviate inbox <subcommand>\n list\n get <chat_id>\n messages <chat_id>\n sync\n sync-chat <chat_id>\n"
300
+ "Usage: curviate inbox <subcommand>\n list\n get <chat_id>\n mark-read <chat_id>\n messages <chat_id>\n"
369
301
  );
370
302
  }
371
303
  });
@@ -373,7 +305,6 @@ export {
373
305
  inboxCommand,
374
306
  runInboxGet,
375
307
  runInboxList,
376
- runInboxMessages,
377
- runInboxSync,
378
- runInboxSyncChat
308
+ runInboxMarkRead,
309
+ runInboxMessages
379
310
  };