@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.
- package/CHANGELOG.md +161 -0
- package/README.md +52 -79
- package/dist/{account-7AUDAMIK.js → account-FM473HEK.js} +38 -371
- package/dist/{chunk-SSPILTKF.js → chunk-45KHSWCV.js} +56 -48
- package/dist/chunk-BGZW6B7G.js +59 -0
- package/dist/chunk-EEMJDJ4W.js +80 -0
- package/dist/{chunk-JXF47TRY.js → chunk-M33MI53G.js} +33 -1
- package/dist/chunk-QJZ3LWOX.js +24 -0
- package/dist/{chunk-4JHGVY7R.js → chunk-TMU3CSPR.js} +4 -0
- package/dist/{chunk-HMAGEMF7.js → chunk-ZE7QGR3F.js} +4 -0
- package/dist/cli.js +127 -15
- package/dist/comment-NCDXERSI.js +555 -0
- package/dist/{company-RU2CA5DY.js → company-IYTMW64G.js} +27 -74
- package/dist/{config-Q2AEWSEC.js → config-P5CPF5WC.js} +1 -1
- package/dist/{connect-QT6ZOS75.js → connect-TTJHMBUP.js} +91 -45
- package/dist/{exit-codes-ZTY2NY3X.js → exit-codes-SL3GQF7W.js} +1 -1
- package/dist/{inbox-DN7X7CM2.js → inbox-EOOGJ3ZN.js} +55 -124
- package/dist/job-YARGTHUY.js +631 -0
- package/dist/{login-BBVQLXM7.js → login-MFB45PVZ.js} +1 -1
- package/dist/{message-6K5E3CUF.js → message-2DLIQIE6.js} +61 -51
- package/dist/{post-2JQZ3OSF.js → post-GRIJ7X52.js} +188 -221
- package/dist/profile-57RJEL7H.js +809 -0
- package/dist/{recruiter-XHVMQWK6.js → recruiter-CTYH7AYG.js} +740 -226
- package/dist/{sales-nav-QTSTJMKA.js → sales-nav-NUMEYOEO.js} +119 -77
- package/dist/{search-ZGTS45BT.js → search-RD4TXNV7.js} +103 -39
- package/dist/{webhook-EIY5WWTE.js → webhook-CEP7SGP5.js} +8 -45
- package/package.json +4 -3
- package/dist/chunk-GXTZION6.js +0 -45
- package/dist/chunk-Q43HZUN3.js +0 -29
- package/dist/job-FGGQEXSU.js +0 -105
- package/dist/profile-DD5GMGNL.js +0 -501
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./chunk-UWO2D4HW.js";
|
|
3
|
+
resolveTextOrStdin
|
|
4
|
+
} from "./chunk-U7Y4EXHT.js";
|
|
6
5
|
import {
|
|
7
6
|
AttachError,
|
|
8
|
-
readAttachment
|
|
9
|
-
|
|
7
|
+
readAttachment,
|
|
8
|
+
toAttachmentPayload
|
|
9
|
+
} from "./chunk-BGZW6B7G.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
BinaryOutputError,
|
|
12
|
+
writeBinaryOutput
|
|
13
|
+
} from "./chunk-UWO2D4HW.js";
|
|
13
14
|
import {
|
|
14
15
|
buildPreviewOutput
|
|
15
16
|
} from "./chunk-R3VLWLVV.js";
|
|
@@ -23,11 +24,11 @@ import {
|
|
|
23
24
|
renderSuccess,
|
|
24
25
|
renderUnexpectedError,
|
|
25
26
|
resolveEffectiveConfig
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-M33MI53G.js";
|
|
27
28
|
import {
|
|
28
29
|
READ_SINGLE_FLAGS,
|
|
29
30
|
WRITE_FLAGS
|
|
30
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-TMU3CSPR.js";
|
|
31
32
|
|
|
32
33
|
// src/commands/message.ts
|
|
33
34
|
import { defineCommand } from "citty";
|
|
@@ -67,13 +68,12 @@ function normalizeAttachPaths(attach) {
|
|
|
67
68
|
if (!attach) return [];
|
|
68
69
|
return Array.isArray(attach) ? attach : [attach];
|
|
69
70
|
}
|
|
70
|
-
var INMAIL_SURFACES = ["sales_nav", "recruiter", "classic"];
|
|
71
71
|
var MEMBER_URN_RE = /^urn:li:member:\d+$/;
|
|
72
72
|
var MEMBER_PROVIDER_ID_RE = /^A[CDE][A-Za-z0-9_-]{4,}$/;
|
|
73
73
|
async function handleSdkError(err, outOpts, out) {
|
|
74
74
|
const { CurviateError } = await import("@curviate/sdk");
|
|
75
75
|
if (err instanceof CurviateError) {
|
|
76
|
-
const { getExitCode } = await import("./exit-codes-
|
|
76
|
+
const { getExitCode } = await import("./exit-codes-SL3GQF7W.js");
|
|
77
77
|
renderError(err, outOpts, out);
|
|
78
78
|
process.exit(getExitCode(err.code));
|
|
79
79
|
}
|
|
@@ -105,22 +105,19 @@ async function runMessageNew(client, flags, out, _readStdin) {
|
|
|
105
105
|
providerId = resolvedSlugOrId;
|
|
106
106
|
} else {
|
|
107
107
|
try {
|
|
108
|
-
const profileData = await ns.
|
|
109
|
-
providerId = profileData
|
|
108
|
+
const profileData = await ns.users.get(resolvedSlugOrId, {});
|
|
109
|
+
providerId = profileData.id;
|
|
110
110
|
} catch (err) {
|
|
111
111
|
await handleSdkError(err, outOpts, out);
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
const
|
|
116
|
-
attendees_ids: [providerId],
|
|
117
|
-
text
|
|
118
|
-
};
|
|
115
|
+
const attachmentPayloads = attachBuffers.map((buf, i) => toAttachmentPayload(attachPaths[i], buf));
|
|
119
116
|
if (flags.preview) {
|
|
120
117
|
const preview = buildPreviewOutput({
|
|
121
118
|
method: "messaging.startChat",
|
|
122
119
|
args: { attendees_ids: [providerId] },
|
|
123
|
-
body: {
|
|
120
|
+
body: { attendees_ids: [providerId], text },
|
|
124
121
|
account: accountId,
|
|
125
122
|
attachments: attachBuffers.map((buf, i) => ({
|
|
126
123
|
name: attachPaths[i] ? attachPaths[i].split("/").pop() ?? attachPaths[i] : `attachment_${i}`,
|
|
@@ -130,9 +127,11 @@ async function runMessageNew(client, flags, out, _readStdin) {
|
|
|
130
127
|
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
131
128
|
return;
|
|
132
129
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
const body = {
|
|
131
|
+
attendees_ids: [providerId],
|
|
132
|
+
text,
|
|
133
|
+
...attachmentPayloads.length > 0 ? { attachments: attachmentPayloads } : {}
|
|
134
|
+
};
|
|
136
135
|
try {
|
|
137
136
|
const result = await ns.messaging.startChat(body);
|
|
138
137
|
renderSuccess(result, outOpts, out);
|
|
@@ -157,12 +156,11 @@ async function runMessageSend(client, flags, out, _readStdin) {
|
|
|
157
156
|
}
|
|
158
157
|
throw err;
|
|
159
158
|
}
|
|
160
|
-
const body = { text };
|
|
161
159
|
if (flags.preview) {
|
|
162
160
|
const preview = buildPreviewOutput({
|
|
163
161
|
method: "messaging.sendMessage",
|
|
164
162
|
args: { chat_id: chatId },
|
|
165
|
-
body: {
|
|
163
|
+
body: { text },
|
|
166
164
|
account: accountId,
|
|
167
165
|
attachments: attachBuffers.map((buf, i) => ({
|
|
168
166
|
name: attachPaths[i] ? attachPaths[i].split("/").pop() ?? attachPaths[i] : `attachment_${i}`,
|
|
@@ -172,9 +170,11 @@ async function runMessageSend(client, flags, out, _readStdin) {
|
|
|
172
170
|
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
173
171
|
return;
|
|
174
172
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
173
|
+
const attachmentPayloads = attachBuffers.map((buf, i) => toAttachmentPayload(attachPaths[i], buf));
|
|
174
|
+
const body = {
|
|
175
|
+
text,
|
|
176
|
+
...attachmentPayloads.length > 0 ? { attachments: attachmentPayloads } : {}
|
|
177
|
+
};
|
|
178
178
|
const ns = client.account(accountId);
|
|
179
179
|
const outOpts = resolveOutputOpts(flags);
|
|
180
180
|
try {
|
|
@@ -188,11 +188,12 @@ async function runMessageGet(client, flags, out) {
|
|
|
188
188
|
rejectPreviewOnRead(flags.preview, out);
|
|
189
189
|
rejectAllOnNonPaginated(flags.all, out);
|
|
190
190
|
const accountId = requireAccount(flags.account, out);
|
|
191
|
+
const chatId = normalizeChatId(flags.chatId ?? "");
|
|
191
192
|
const messageId = flags.messageId ?? "";
|
|
192
193
|
const ns = client.account(accountId);
|
|
193
194
|
const outOpts = resolveOutputOpts(flags);
|
|
194
195
|
try {
|
|
195
|
-
const result = await ns.messaging.getMessage(messageId);
|
|
196
|
+
const result = await ns.messaging.getMessage(chatId, messageId);
|
|
196
197
|
renderSuccess(result, outOpts, out);
|
|
197
198
|
} catch (err) {
|
|
198
199
|
await handleSdkError(err, outOpts, out);
|
|
@@ -200,13 +201,14 @@ async function runMessageGet(client, flags, out) {
|
|
|
200
201
|
}
|
|
201
202
|
async function runMessageEdit(client, flags, out, _readStdin) {
|
|
202
203
|
const accountId = requireAccount(flags.account, out);
|
|
204
|
+
const chatId = normalizeChatId(flags.chatId ?? "");
|
|
203
205
|
const messageId = flags.messageId ?? "";
|
|
204
206
|
const rawText = flags.text ?? "";
|
|
205
207
|
const text = await resolveTextOrStdin(rawText, out, _readStdin);
|
|
206
208
|
if (flags.preview) {
|
|
207
209
|
const preview = buildPreviewOutput({
|
|
208
210
|
method: "messaging.editMessage",
|
|
209
|
-
args: { message_id: messageId },
|
|
211
|
+
args: { chat_id: chatId, message_id: messageId },
|
|
210
212
|
body: { text },
|
|
211
213
|
account: accountId
|
|
212
214
|
});
|
|
@@ -216,7 +218,7 @@ async function runMessageEdit(client, flags, out, _readStdin) {
|
|
|
216
218
|
const ns = client.account(accountId);
|
|
217
219
|
const outOpts = resolveOutputOpts(flags);
|
|
218
220
|
try {
|
|
219
|
-
const result = await ns.messaging.editMessage(messageId, { text });
|
|
221
|
+
const result = await ns.messaging.editMessage(chatId, messageId, { text });
|
|
220
222
|
renderSuccess(result, outOpts, out);
|
|
221
223
|
} catch (err) {
|
|
222
224
|
await handleSdkError(err, outOpts, out);
|
|
@@ -224,11 +226,12 @@ async function runMessageEdit(client, flags, out, _readStdin) {
|
|
|
224
226
|
}
|
|
225
227
|
async function runMessageDelete(client, flags, out) {
|
|
226
228
|
const accountId = requireAccount(flags.account, out);
|
|
229
|
+
const chatId = normalizeChatId(flags.chatId ?? "");
|
|
227
230
|
const messageId = flags.messageId ?? "";
|
|
228
231
|
if (flags.preview) {
|
|
229
232
|
const preview = buildPreviewOutput({
|
|
230
233
|
method: "messaging.deleteMessage",
|
|
231
|
-
args: { message_id: messageId },
|
|
234
|
+
args: { chat_id: chatId, message_id: messageId },
|
|
232
235
|
body: {},
|
|
233
236
|
account: accountId
|
|
234
237
|
});
|
|
@@ -238,7 +241,7 @@ async function runMessageDelete(client, flags, out) {
|
|
|
238
241
|
const ns = client.account(accountId);
|
|
239
242
|
const outOpts = resolveOutputOpts(flags);
|
|
240
243
|
try {
|
|
241
|
-
const result = await ns.messaging.deleteMessage(messageId);
|
|
244
|
+
const result = await ns.messaging.deleteMessage(chatId, messageId);
|
|
242
245
|
renderSuccess(result, outOpts, out);
|
|
243
246
|
} catch (err) {
|
|
244
247
|
await handleSdkError(err, outOpts, out);
|
|
@@ -246,12 +249,18 @@ async function runMessageDelete(client, flags, out) {
|
|
|
246
249
|
}
|
|
247
250
|
async function runMessageReact(client, flags, out) {
|
|
248
251
|
const accountId = requireAccount(flags.account, out);
|
|
252
|
+
const chatId = normalizeChatId(flags.chatId ?? "");
|
|
249
253
|
const messageId = flags.messageId ?? "";
|
|
250
|
-
const reaction = flags.emoji ?? "";
|
|
254
|
+
const reaction = flags.emoji ?? flags.emojiAlias ?? "";
|
|
255
|
+
if (!reaction) {
|
|
256
|
+
out.stderr.write("error: a reaction is required \u2014 pass it as `message react <chat_id> <message_id> <emoji>` (or --emoji <e>).\n");
|
|
257
|
+
process.exit(2);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
251
260
|
if (flags.preview) {
|
|
252
261
|
const preview = buildPreviewOutput({
|
|
253
262
|
method: "messaging.addReaction",
|
|
254
|
-
args: { message_id: messageId },
|
|
263
|
+
args: { chat_id: chatId, message_id: messageId },
|
|
255
264
|
body: { reaction },
|
|
256
265
|
account: accountId
|
|
257
266
|
});
|
|
@@ -261,7 +270,7 @@ async function runMessageReact(client, flags, out) {
|
|
|
261
270
|
const ns = client.account(accountId);
|
|
262
271
|
const outOpts = resolveOutputOpts(flags);
|
|
263
272
|
try {
|
|
264
|
-
const result = await ns.messaging.addReaction(messageId, { reaction });
|
|
273
|
+
const result = await ns.messaging.addReaction(chatId, messageId, { reaction });
|
|
265
274
|
renderSuccess(result, outOpts, out);
|
|
266
275
|
} catch (err) {
|
|
267
276
|
await handleSdkError(err, outOpts, out);
|
|
@@ -270,11 +279,12 @@ async function runMessageReact(client, flags, out) {
|
|
|
270
279
|
async function runMessageAttachment(client, flags, out, isTTY) {
|
|
271
280
|
rejectPreviewOnRead(flags.preview, out);
|
|
272
281
|
const accountId = requireAccount(flags.account, out);
|
|
282
|
+
const chatId = normalizeChatId(flags.chatId ?? "");
|
|
273
283
|
const messageId = flags.messageId ?? "";
|
|
274
284
|
const attachmentId = flags.attachmentId ?? "";
|
|
275
285
|
const ns = client.account(accountId);
|
|
276
286
|
try {
|
|
277
|
-
const data = await ns.messaging.getAttachment(messageId, attachmentId);
|
|
287
|
+
const data = await ns.messaging.getAttachment(chatId, messageId, attachmentId);
|
|
278
288
|
await writeBinaryOutput(data, {
|
|
279
289
|
outputPath: flags.output,
|
|
280
290
|
isTTY,
|
|
@@ -292,14 +302,6 @@ async function runMessageAttachment(client, flags, out, isTTY) {
|
|
|
292
302
|
}
|
|
293
303
|
async function runMessageInMail(client, flags, out, _readStdin) {
|
|
294
304
|
const accountId = requireAccount(flags.account, out);
|
|
295
|
-
const surface = flags.surface ?? "";
|
|
296
|
-
if (!INMAIL_SURFACES.includes(surface)) {
|
|
297
|
-
out.stderr.write(
|
|
298
|
-
`error: --surface is required and must be one of ${INMAIL_SURFACES.join(", ")}.
|
|
299
|
-
`
|
|
300
|
-
);
|
|
301
|
-
process.exit(2);
|
|
302
|
-
}
|
|
303
305
|
const rawTo = flags.to ?? "";
|
|
304
306
|
if (!rawTo) {
|
|
305
307
|
out.stderr.write(
|
|
@@ -318,8 +320,8 @@ async function runMessageInMail(client, flags, out, _readStdin) {
|
|
|
318
320
|
recipientUrn = resolvedSlugOrId;
|
|
319
321
|
} else {
|
|
320
322
|
try {
|
|
321
|
-
const profileData = await ns.
|
|
322
|
-
recipientUrn = profileData
|
|
323
|
+
const profileData = await ns.users.get(resolvedSlugOrId, {});
|
|
324
|
+
recipientUrn = profileData.id;
|
|
323
325
|
} catch (err) {
|
|
324
326
|
await handleSdkError(err, outOpts, out);
|
|
325
327
|
return;
|
|
@@ -330,7 +332,6 @@ async function runMessageInMail(client, flags, out, _readStdin) {
|
|
|
330
332
|
const text = await resolveTextOrStdin(rawText, out, _readStdin);
|
|
331
333
|
const body = {
|
|
332
334
|
recipient_urn: recipientUrn,
|
|
333
|
-
surface,
|
|
334
335
|
subject,
|
|
335
336
|
text
|
|
336
337
|
};
|
|
@@ -358,7 +359,7 @@ async function runMessageInMailBalance(client, flags, out) {
|
|
|
358
359
|
const ns = client.account(accountId);
|
|
359
360
|
const outOpts = resolveOutputOpts(flags);
|
|
360
361
|
try {
|
|
361
|
-
const result = await ns.
|
|
362
|
+
const result = await ns.users.getInMailCredits();
|
|
362
363
|
renderSuccess(result, outOpts, out);
|
|
363
364
|
} catch (err) {
|
|
364
365
|
await handleSdkError(err, outOpts, out);
|
|
@@ -400,6 +401,7 @@ var messageGetCommand = defineCommand({
|
|
|
400
401
|
args: {
|
|
401
402
|
// Single-object read: READ_SINGLE_FLAGS omits pagination flags, keeps --fields
|
|
402
403
|
...READ_SINGLE_FLAGS,
|
|
404
|
+
chatId: { type: "positional", description: "Chat ID or LinkedIn messaging thread URL." },
|
|
403
405
|
messageId: { type: "positional", description: "Message ID." }
|
|
404
406
|
},
|
|
405
407
|
async run({ args }) {
|
|
@@ -425,6 +427,7 @@ var messageEditCommand = defineCommand({
|
|
|
425
427
|
args: {
|
|
426
428
|
// Write command: WRITE_FLAGS omits pagination/projection flags
|
|
427
429
|
...WRITE_FLAGS,
|
|
430
|
+
chatId: { type: "positional", description: "Chat ID or LinkedIn messaging thread URL." },
|
|
428
431
|
messageId: { type: "positional", description: "Message ID." },
|
|
429
432
|
text: { type: "positional", description: "Replacement text. Pass - to read from stdin." }
|
|
430
433
|
},
|
|
@@ -451,6 +454,7 @@ var messageDeleteCommand = defineCommand({
|
|
|
451
454
|
args: {
|
|
452
455
|
// Write command: WRITE_FLAGS omits pagination/projection flags
|
|
453
456
|
...WRITE_FLAGS,
|
|
457
|
+
chatId: { type: "positional", description: "Chat ID or LinkedIn messaging thread URL." },
|
|
454
458
|
messageId: { type: "positional", description: "Message ID." }
|
|
455
459
|
},
|
|
456
460
|
async run({ args }) {
|
|
@@ -476,8 +480,14 @@ var messageReactCommand = defineCommand({
|
|
|
476
480
|
args: {
|
|
477
481
|
// Write command: WRITE_FLAGS omits pagination/projection flags
|
|
478
482
|
...WRITE_FLAGS,
|
|
483
|
+
chatId: { type: "positional", description: "Chat ID or LinkedIn messaging thread URL." },
|
|
479
484
|
messageId: { type: "positional", description: "Message ID." },
|
|
480
|
-
emoji: { type: "
|
|
485
|
+
emoji: { type: "positional", required: false, description: "Native emoji reaction value (e.g. \u{1F44D})." },
|
|
486
|
+
emojiAlias: {
|
|
487
|
+
type: "string",
|
|
488
|
+
alias: "emoji",
|
|
489
|
+
description: "Deprecated: pass the emoji as the positional <emoji> instead. --emoji still works."
|
|
490
|
+
}
|
|
481
491
|
},
|
|
482
492
|
async run({ args }) {
|
|
483
493
|
const flags = args;
|
|
@@ -502,6 +512,7 @@ var messageAttachmentCommand = defineCommand({
|
|
|
502
512
|
args: {
|
|
503
513
|
// Single-object read: READ_SINGLE_FLAGS omits pagination flags, keeps --fields
|
|
504
514
|
...READ_SINGLE_FLAGS,
|
|
515
|
+
chatId: { type: "positional", description: "Chat ID or LinkedIn messaging thread URL." },
|
|
505
516
|
messageId: { type: "positional", description: "Message ID." },
|
|
506
517
|
attachmentId: { type: "positional", description: "Attachment ID." },
|
|
507
518
|
output: { type: "string", alias: "o", description: "Path to write the file to." }
|
|
@@ -539,7 +550,6 @@ var messageInMailCommand = defineCommand({
|
|
|
539
550
|
description: "Recipient: LinkedIn profile URL, bare slug, provider-id (ACoAAA\u2026), or member URN (urn:li:member:<id>). URL and slug inputs resolve the provider ID automatically.",
|
|
540
551
|
required: true
|
|
541
552
|
},
|
|
542
|
-
surface: { type: "string", description: "InMail surface: sales_nav, recruiter, or classic (classic uses the account's own premium InMail credits).", required: true },
|
|
543
553
|
subject: { type: "string", description: "InMail subject line.", required: true },
|
|
544
554
|
text: { type: "positional", description: "InMail body text. Pass - to read from stdin." }
|
|
545
555
|
},
|
|
@@ -636,9 +646,9 @@ var messageCommand = defineCommand({
|
|
|
636
646
|
const flags = args;
|
|
637
647
|
if (!flags.chatId) {
|
|
638
648
|
process.stderr.write(
|
|
639
|
-
'Usage: curviate message new --to <attendee> "<text>" [--attach <file>\u2026]\n curviate message <chat_id> "<text>" [--attach <file>\u2026]\n curviate message get <message_id>\n curviate message edit <message_id> "<text>"\n curviate message delete <message_id>\n curviate message react <message_id>
|
|
649
|
+
'Usage: curviate message new --to <attendee> "<text>" [--attach <file>\u2026]\n curviate message <chat_id> "<text>" [--attach <file>\u2026]\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'
|
|
640
650
|
);
|
|
641
|
-
|
|
651
|
+
process.exit(2);
|
|
642
652
|
}
|
|
643
653
|
const cfg = await resolveEffectiveConfig({
|
|
644
654
|
apiKey: flags["api-key"],
|