@curviate/cli 0.13.0 → 0.15.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.
- package/CHANGELOG.md +116 -0
- package/README.md +52 -79
- package/dist/{account-7AUDAMIK.js → account-VB52GIUA.js} +34 -369
- package/dist/{chunk-SSPILTKF.js → chunk-45KHSWCV.js} +56 -48
- package/dist/chunk-BGZW6B7G.js +59 -0
- package/dist/{chunk-GXTZION6.js → chunk-DNTRQZBT.js} +13 -1
- package/dist/chunk-QJZ3LWOX.js +24 -0
- package/dist/{chunk-HMAGEMF7.js → chunk-ZE7QGR3F.js} +4 -0
- package/dist/cli.js +75 -12
- package/dist/comment-Y5IU42CR.js +550 -0
- package/dist/{company-RU2CA5DY.js → company-LGID3SK3.js} +21 -72
- package/dist/{connect-QT6ZOS75.js → connect-A7HEKKEE.js} +86 -43
- package/dist/{exit-codes-ZTY2NY3X.js → exit-codes-SL3GQF7W.js} +1 -1
- package/dist/{inbox-DN7X7CM2.js → inbox-44JRTJAP.js} +50 -122
- package/dist/job-TFTTCP5B.js +561 -0
- package/dist/{message-6K5E3CUF.js → message-FOJTDPW3.js} +47 -47
- package/dist/{post-2JQZ3OSF.js → post-FC6NZXM5.js} +177 -219
- package/dist/profile-I6YMVXSS.js +799 -0
- package/dist/{recruiter-XHVMQWK6.js → recruiter-BHT5OJD7.js} +731 -224
- package/dist/{sales-nav-QTSTJMKA.js → sales-nav-6IYKQ4TC.js} +109 -75
- package/dist/{search-ZGTS45BT.js → search-6C72M563.js} +95 -37
- package/dist/{webhook-XPWBI675.js → webhook-NSXEIU44.js} +36 -39
- package/package.json +4 -3
- 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";
|
|
@@ -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,13 @@ 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
254
|
const reaction = flags.emoji ?? "";
|
|
251
255
|
if (flags.preview) {
|
|
252
256
|
const preview = buildPreviewOutput({
|
|
253
257
|
method: "messaging.addReaction",
|
|
254
|
-
args: { message_id: messageId },
|
|
258
|
+
args: { chat_id: chatId, message_id: messageId },
|
|
255
259
|
body: { reaction },
|
|
256
260
|
account: accountId
|
|
257
261
|
});
|
|
@@ -261,7 +265,7 @@ async function runMessageReact(client, flags, out) {
|
|
|
261
265
|
const ns = client.account(accountId);
|
|
262
266
|
const outOpts = resolveOutputOpts(flags);
|
|
263
267
|
try {
|
|
264
|
-
const result = await ns.messaging.addReaction(messageId, { reaction });
|
|
268
|
+
const result = await ns.messaging.addReaction(chatId, messageId, { reaction });
|
|
265
269
|
renderSuccess(result, outOpts, out);
|
|
266
270
|
} catch (err) {
|
|
267
271
|
await handleSdkError(err, outOpts, out);
|
|
@@ -270,11 +274,12 @@ async function runMessageReact(client, flags, out) {
|
|
|
270
274
|
async function runMessageAttachment(client, flags, out, isTTY) {
|
|
271
275
|
rejectPreviewOnRead(flags.preview, out);
|
|
272
276
|
const accountId = requireAccount(flags.account, out);
|
|
277
|
+
const chatId = normalizeChatId(flags.chatId ?? "");
|
|
273
278
|
const messageId = flags.messageId ?? "";
|
|
274
279
|
const attachmentId = flags.attachmentId ?? "";
|
|
275
280
|
const ns = client.account(accountId);
|
|
276
281
|
try {
|
|
277
|
-
const data = await ns.messaging.getAttachment(messageId, attachmentId);
|
|
282
|
+
const data = await ns.messaging.getAttachment(chatId, messageId, attachmentId);
|
|
278
283
|
await writeBinaryOutput(data, {
|
|
279
284
|
outputPath: flags.output,
|
|
280
285
|
isTTY,
|
|
@@ -292,14 +297,6 @@ async function runMessageAttachment(client, flags, out, isTTY) {
|
|
|
292
297
|
}
|
|
293
298
|
async function runMessageInMail(client, flags, out, _readStdin) {
|
|
294
299
|
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
300
|
const rawTo = flags.to ?? "";
|
|
304
301
|
if (!rawTo) {
|
|
305
302
|
out.stderr.write(
|
|
@@ -318,8 +315,8 @@ async function runMessageInMail(client, flags, out, _readStdin) {
|
|
|
318
315
|
recipientUrn = resolvedSlugOrId;
|
|
319
316
|
} else {
|
|
320
317
|
try {
|
|
321
|
-
const profileData = await ns.
|
|
322
|
-
recipientUrn = profileData
|
|
318
|
+
const profileData = await ns.users.get(resolvedSlugOrId, {});
|
|
319
|
+
recipientUrn = profileData.id;
|
|
323
320
|
} catch (err) {
|
|
324
321
|
await handleSdkError(err, outOpts, out);
|
|
325
322
|
return;
|
|
@@ -330,7 +327,6 @@ async function runMessageInMail(client, flags, out, _readStdin) {
|
|
|
330
327
|
const text = await resolveTextOrStdin(rawText, out, _readStdin);
|
|
331
328
|
const body = {
|
|
332
329
|
recipient_urn: recipientUrn,
|
|
333
|
-
surface,
|
|
334
330
|
subject,
|
|
335
331
|
text
|
|
336
332
|
};
|
|
@@ -358,7 +354,7 @@ async function runMessageInMailBalance(client, flags, out) {
|
|
|
358
354
|
const ns = client.account(accountId);
|
|
359
355
|
const outOpts = resolveOutputOpts(flags);
|
|
360
356
|
try {
|
|
361
|
-
const result = await ns.
|
|
357
|
+
const result = await ns.users.getInMailCredits();
|
|
362
358
|
renderSuccess(result, outOpts, out);
|
|
363
359
|
} catch (err) {
|
|
364
360
|
await handleSdkError(err, outOpts, out);
|
|
@@ -400,6 +396,7 @@ var messageGetCommand = defineCommand({
|
|
|
400
396
|
args: {
|
|
401
397
|
// Single-object read: READ_SINGLE_FLAGS omits pagination flags, keeps --fields
|
|
402
398
|
...READ_SINGLE_FLAGS,
|
|
399
|
+
chatId: { type: "positional", description: "Chat ID or LinkedIn messaging thread URL." },
|
|
403
400
|
messageId: { type: "positional", description: "Message ID." }
|
|
404
401
|
},
|
|
405
402
|
async run({ args }) {
|
|
@@ -425,6 +422,7 @@ var messageEditCommand = defineCommand({
|
|
|
425
422
|
args: {
|
|
426
423
|
// Write command: WRITE_FLAGS omits pagination/projection flags
|
|
427
424
|
...WRITE_FLAGS,
|
|
425
|
+
chatId: { type: "positional", description: "Chat ID or LinkedIn messaging thread URL." },
|
|
428
426
|
messageId: { type: "positional", description: "Message ID." },
|
|
429
427
|
text: { type: "positional", description: "Replacement text. Pass - to read from stdin." }
|
|
430
428
|
},
|
|
@@ -451,6 +449,7 @@ var messageDeleteCommand = defineCommand({
|
|
|
451
449
|
args: {
|
|
452
450
|
// Write command: WRITE_FLAGS omits pagination/projection flags
|
|
453
451
|
...WRITE_FLAGS,
|
|
452
|
+
chatId: { type: "positional", description: "Chat ID or LinkedIn messaging thread URL." },
|
|
454
453
|
messageId: { type: "positional", description: "Message ID." }
|
|
455
454
|
},
|
|
456
455
|
async run({ args }) {
|
|
@@ -476,6 +475,7 @@ var messageReactCommand = defineCommand({
|
|
|
476
475
|
args: {
|
|
477
476
|
// Write command: WRITE_FLAGS omits pagination/projection flags
|
|
478
477
|
...WRITE_FLAGS,
|
|
478
|
+
chatId: { type: "positional", description: "Chat ID or LinkedIn messaging thread URL." },
|
|
479
479
|
messageId: { type: "positional", description: "Message ID." },
|
|
480
480
|
emoji: { type: "string", description: "Native emoji reaction value (e.g. \u{1F44D}).", required: true }
|
|
481
481
|
},
|
|
@@ -502,6 +502,7 @@ var messageAttachmentCommand = defineCommand({
|
|
|
502
502
|
args: {
|
|
503
503
|
// Single-object read: READ_SINGLE_FLAGS omits pagination flags, keeps --fields
|
|
504
504
|
...READ_SINGLE_FLAGS,
|
|
505
|
+
chatId: { type: "positional", description: "Chat ID or LinkedIn messaging thread URL." },
|
|
505
506
|
messageId: { type: "positional", description: "Message ID." },
|
|
506
507
|
attachmentId: { type: "positional", description: "Attachment ID." },
|
|
507
508
|
output: { type: "string", alias: "o", description: "Path to write the file to." }
|
|
@@ -539,7 +540,6 @@ var messageInMailCommand = defineCommand({
|
|
|
539
540
|
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
541
|
required: true
|
|
541
542
|
},
|
|
542
|
-
surface: { type: "string", description: "InMail surface: sales_nav, recruiter, or classic (classic uses the account's own premium InMail credits).", required: true },
|
|
543
543
|
subject: { type: "string", description: "InMail subject line.", required: true },
|
|
544
544
|
text: { type: "positional", description: "InMail body text. Pass - to read from stdin." }
|
|
545
545
|
},
|
|
@@ -636,9 +636,9 @@ var messageCommand = defineCommand({
|
|
|
636
636
|
const flags = args;
|
|
637
637
|
if (!flags.chatId) {
|
|
638
638
|
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> --emoji <e>\n curviate message attachment <message_id> <attachment_id> [-o <file>]\n curviate message inmail --to <id> --subject <s> "<text>"\n curviate message inmail-balance\n'
|
|
639
|
+
'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 <e>\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
640
|
);
|
|
641
|
-
|
|
641
|
+
process.exit(2);
|
|
642
642
|
}
|
|
643
643
|
const cfg = await resolveEffectiveConfig({
|
|
644
644
|
apiKey: flags["api-key"],
|