@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
package/dist/profile-DD5GMGNL.js
DELETED
|
@@ -1,501 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
buildPreviewOutput
|
|
4
|
-
} from "./chunk-R3VLWLVV.js";
|
|
5
|
-
import {
|
|
6
|
-
streamAll
|
|
7
|
-
} from "./chunk-GXTZION6.js";
|
|
8
|
-
import {
|
|
9
|
-
slimProfile,
|
|
10
|
-
slimProfileMe
|
|
11
|
-
} from "./chunk-SSPILTKF.js";
|
|
12
|
-
import {
|
|
13
|
-
resolveIdentifier
|
|
14
|
-
} from "./chunk-DMQZEPQE.js";
|
|
15
|
-
import {
|
|
16
|
-
createClient,
|
|
17
|
-
renderError,
|
|
18
|
-
renderSuccess,
|
|
19
|
-
renderUnexpectedError,
|
|
20
|
-
resolveEffectiveConfig
|
|
21
|
-
} from "./chunk-JXF47TRY.js";
|
|
22
|
-
import {
|
|
23
|
-
GLOBAL_FLAGS
|
|
24
|
-
} from "./chunk-4JHGVY7R.js";
|
|
25
|
-
|
|
26
|
-
// src/commands/profile.ts
|
|
27
|
-
import { defineCommand } from "citty";
|
|
28
|
-
function requireAccount(account, out) {
|
|
29
|
-
if (!account) {
|
|
30
|
-
out.stderr.write("error: --account is required for this command. Set it via --account, CURVIATE_ACCOUNT, or `curviate config set-account`.\n");
|
|
31
|
-
process.exit(2);
|
|
32
|
-
}
|
|
33
|
-
return account;
|
|
34
|
-
}
|
|
35
|
-
function rejectPreviewOnRead(preview, out) {
|
|
36
|
-
if (preview) {
|
|
37
|
-
out.stderr.write("error: --preview is only valid on write commands (mutations). Reads just run.\n");
|
|
38
|
-
process.exit(2);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function rejectAllOnNonPaginated(all, out) {
|
|
42
|
-
if (all) {
|
|
43
|
-
out.stderr.write("error: --all is not supported on non-paginated commands.\n");
|
|
44
|
-
process.exit(2);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function buildOutputStreams() {
|
|
48
|
-
return {
|
|
49
|
-
stdout: { write: (s) => process.stdout.write(s) },
|
|
50
|
-
stderr: { write: (s) => process.stderr.write(s) }
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function resolveOutputOpts(flags) {
|
|
54
|
-
return {
|
|
55
|
-
json: (flags.json ?? false) || !process.stdout.isTTY,
|
|
56
|
-
isTTY: process.stdout.isTTY ?? false,
|
|
57
|
-
fields: flags.fields,
|
|
58
|
-
verbose: flags.verbose ?? false
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
async function runProfileMe(client, flags, out) {
|
|
62
|
-
rejectPreviewOnRead(flags.preview, out);
|
|
63
|
-
const hasActivityFlag = !!(flags.posts || flags.comments || flags.reactions || flags.followers);
|
|
64
|
-
if (!hasActivityFlag) {
|
|
65
|
-
rejectAllOnNonPaginated(flags.all, out);
|
|
66
|
-
}
|
|
67
|
-
if (flags.sections === "") {
|
|
68
|
-
out.stderr.write("error: --sections must not be empty. Omit the flag or provide section names.\n");
|
|
69
|
-
process.exit(2);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
const accountId = requireAccount(flags.account, out);
|
|
73
|
-
const ns = client.account(accountId);
|
|
74
|
-
const outOpts = resolveOutputOpts(flags);
|
|
75
|
-
if (hasActivityFlag) {
|
|
76
|
-
const all = flags.all ?? false;
|
|
77
|
-
const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
|
|
78
|
-
const params2 = {};
|
|
79
|
-
if (flags.limit) params2["limit"] = parseInt(flags.limit, 10);
|
|
80
|
-
if (flags.cursor) params2["cursor"] = flags.cursor;
|
|
81
|
-
try {
|
|
82
|
-
const meResult = await ns.profiles.getMe({});
|
|
83
|
-
const ownSlug = meResult["public_identifier"];
|
|
84
|
-
if (flags.posts) {
|
|
85
|
-
if (all) {
|
|
86
|
-
const fn = (p) => ns.profiles.listPosts(ownSlug, p);
|
|
87
|
-
for await (const item of streamAll(fn, params2, {
|
|
88
|
-
maxPages,
|
|
89
|
-
onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
|
|
90
|
-
`)
|
|
91
|
-
})) {
|
|
92
|
-
out.stdout.write(JSON.stringify(item) + "\n");
|
|
93
|
-
}
|
|
94
|
-
} else {
|
|
95
|
-
const result = await ns.profiles.listPosts(ownSlug, params2);
|
|
96
|
-
renderSuccess(result, outOpts, out);
|
|
97
|
-
}
|
|
98
|
-
} else if (flags.comments) {
|
|
99
|
-
if (all) {
|
|
100
|
-
const fn = (p) => ns.profiles.listComments(ownSlug, p);
|
|
101
|
-
for await (const item of streamAll(fn, params2, {
|
|
102
|
-
maxPages,
|
|
103
|
-
onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
|
|
104
|
-
`)
|
|
105
|
-
})) {
|
|
106
|
-
out.stdout.write(JSON.stringify(item) + "\n");
|
|
107
|
-
}
|
|
108
|
-
} else {
|
|
109
|
-
const result = await ns.profiles.listComments(ownSlug, params2);
|
|
110
|
-
renderSuccess(result, outOpts, out);
|
|
111
|
-
}
|
|
112
|
-
} else if (flags.reactions) {
|
|
113
|
-
if (all) {
|
|
114
|
-
const fn = (p) => ns.profiles.listReactions(ownSlug, p);
|
|
115
|
-
for await (const item of streamAll(fn, params2, {
|
|
116
|
-
maxPages,
|
|
117
|
-
onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
|
|
118
|
-
`)
|
|
119
|
-
})) {
|
|
120
|
-
out.stdout.write(JSON.stringify(item) + "\n");
|
|
121
|
-
}
|
|
122
|
-
} else {
|
|
123
|
-
const result = await ns.profiles.listReactions(ownSlug, params2);
|
|
124
|
-
renderSuccess(result, outOpts, out);
|
|
125
|
-
}
|
|
126
|
-
} else if (flags.followers) {
|
|
127
|
-
if (all) {
|
|
128
|
-
const fn = (p) => ns.profiles.listFollowers(ownSlug, p);
|
|
129
|
-
for await (const item of streamAll(fn, params2, {
|
|
130
|
-
maxPages,
|
|
131
|
-
onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
|
|
132
|
-
`)
|
|
133
|
-
})) {
|
|
134
|
-
out.stdout.write(JSON.stringify(item) + "\n");
|
|
135
|
-
}
|
|
136
|
-
} else {
|
|
137
|
-
const result = await ns.profiles.listFollowers(ownSlug, params2);
|
|
138
|
-
renderSuccess(result, outOpts, out);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
} catch (err) {
|
|
142
|
-
const { CurviateError } = await import("@curviate/sdk");
|
|
143
|
-
if (err instanceof CurviateError) {
|
|
144
|
-
const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
|
|
145
|
-
renderError(err, outOpts, out);
|
|
146
|
-
process.exit(getExitCode(err.code));
|
|
147
|
-
}
|
|
148
|
-
renderUnexpectedError(err, out);
|
|
149
|
-
process.exit(1);
|
|
150
|
-
}
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
const params = {};
|
|
154
|
-
if (flags.sections) {
|
|
155
|
-
params["linkedin_sections"] = flags.sections.split(",").map((s) => s.trim()).filter(Boolean);
|
|
156
|
-
}
|
|
157
|
-
try {
|
|
158
|
-
const result = await ns.profiles.getMe(params);
|
|
159
|
-
const slimOutOpts = { ...outOpts, slim: slimProfileMe };
|
|
160
|
-
renderSuccess(result, slimOutOpts, out);
|
|
161
|
-
} catch (err) {
|
|
162
|
-
const { CurviateError } = await import("@curviate/sdk");
|
|
163
|
-
if (err instanceof CurviateError) {
|
|
164
|
-
const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
|
|
165
|
-
renderError(err, outOpts, out);
|
|
166
|
-
process.exit(getExitCode(err.code));
|
|
167
|
-
}
|
|
168
|
-
renderUnexpectedError(err, out);
|
|
169
|
-
process.exit(1);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
async function runProfileGet(client, flags, out) {
|
|
173
|
-
rejectPreviewOnRead(flags.preview, out);
|
|
174
|
-
const isListCommand = flags.posts || flags.comments || flags.reactions || flags.followers;
|
|
175
|
-
if (!isListCommand && flags.sections === "") {
|
|
176
|
-
out.stderr.write("error: --sections must not be empty. Omit the flag or provide section names.\n");
|
|
177
|
-
process.exit(2);
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
const accountId = requireAccount(flags.account, out);
|
|
181
|
-
const rawId = flags.id ?? "";
|
|
182
|
-
const resolvedId = resolveIdentifier(rawId);
|
|
183
|
-
const ns = client.account(accountId);
|
|
184
|
-
const outOpts = resolveOutputOpts(flags);
|
|
185
|
-
const all = flags.all ?? false;
|
|
186
|
-
const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
|
|
187
|
-
const limit = flags.limit ? parseInt(flags.limit, 10) : void 0;
|
|
188
|
-
const cursor = flags.cursor;
|
|
189
|
-
try {
|
|
190
|
-
if (flags.posts) {
|
|
191
|
-
const params = {};
|
|
192
|
-
if (flags["is-company"]) params["is_company"] = true;
|
|
193
|
-
if (limit !== void 0) params["limit"] = limit;
|
|
194
|
-
if (cursor) params["cursor"] = cursor;
|
|
195
|
-
let postId = resolvedId;
|
|
196
|
-
if (flags["is-company"]) {
|
|
197
|
-
const isNumericId = /^\d+$/.test(resolvedId);
|
|
198
|
-
if (!isNumericId) {
|
|
199
|
-
const companyData = await ns.profiles.getCompany(resolvedId);
|
|
200
|
-
postId = companyData["id"];
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
if (all) {
|
|
204
|
-
const fn = (p) => ns.profiles.listPosts(postId, p);
|
|
205
|
-
for await (const item of streamAll(fn, params, {
|
|
206
|
-
maxPages,
|
|
207
|
-
onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
|
|
208
|
-
`)
|
|
209
|
-
})) {
|
|
210
|
-
out.stdout.write(JSON.stringify(item) + "\n");
|
|
211
|
-
}
|
|
212
|
-
} else {
|
|
213
|
-
const result = await ns.profiles.listPosts(postId, params);
|
|
214
|
-
renderSuccess(result, outOpts, out);
|
|
215
|
-
}
|
|
216
|
-
} else if (flags.comments) {
|
|
217
|
-
const params = {};
|
|
218
|
-
if (limit !== void 0) params["limit"] = limit;
|
|
219
|
-
if (cursor) params["cursor"] = cursor;
|
|
220
|
-
if (all) {
|
|
221
|
-
const fn = (p) => ns.profiles.listComments(resolvedId, p);
|
|
222
|
-
for await (const item of streamAll(fn, params, {
|
|
223
|
-
maxPages,
|
|
224
|
-
onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
|
|
225
|
-
`)
|
|
226
|
-
})) {
|
|
227
|
-
out.stdout.write(JSON.stringify(item) + "\n");
|
|
228
|
-
}
|
|
229
|
-
} else {
|
|
230
|
-
const result = await ns.profiles.listComments(resolvedId, params);
|
|
231
|
-
renderSuccess(result, outOpts, out);
|
|
232
|
-
}
|
|
233
|
-
} else if (flags.reactions) {
|
|
234
|
-
const params = {};
|
|
235
|
-
if (limit !== void 0) params["limit"] = limit;
|
|
236
|
-
if (cursor) params["cursor"] = cursor;
|
|
237
|
-
if (all) {
|
|
238
|
-
const fn = (p) => ns.profiles.listReactions(resolvedId, p);
|
|
239
|
-
for await (const item of streamAll(fn, params, {
|
|
240
|
-
maxPages,
|
|
241
|
-
onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
|
|
242
|
-
`)
|
|
243
|
-
})) {
|
|
244
|
-
out.stdout.write(JSON.stringify(item) + "\n");
|
|
245
|
-
}
|
|
246
|
-
} else {
|
|
247
|
-
const result = await ns.profiles.listReactions(resolvedId, params);
|
|
248
|
-
renderSuccess(result, outOpts, out);
|
|
249
|
-
}
|
|
250
|
-
} else if (flags.followers) {
|
|
251
|
-
const params = {};
|
|
252
|
-
if (limit !== void 0) params["limit"] = limit;
|
|
253
|
-
if (cursor) params["cursor"] = cursor;
|
|
254
|
-
if (all) {
|
|
255
|
-
const fn = (p) => ns.profiles.listFollowers(resolvedId, p);
|
|
256
|
-
for await (const item of streamAll(fn, params, {
|
|
257
|
-
maxPages,
|
|
258
|
-
onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
|
|
259
|
-
`)
|
|
260
|
-
})) {
|
|
261
|
-
out.stdout.write(JSON.stringify(item) + "\n");
|
|
262
|
-
}
|
|
263
|
-
} else {
|
|
264
|
-
const result = await ns.profiles.listFollowers(resolvedId, params);
|
|
265
|
-
renderSuccess(result, outOpts, out);
|
|
266
|
-
}
|
|
267
|
-
} else {
|
|
268
|
-
rejectAllOnNonPaginated(flags.all, out);
|
|
269
|
-
const params = {};
|
|
270
|
-
if (flags.notify) params["notify"] = true;
|
|
271
|
-
if (flags.sections) {
|
|
272
|
-
params["linkedin_sections"] = flags.sections.split(",").map((s) => s.trim()).filter(Boolean);
|
|
273
|
-
}
|
|
274
|
-
const result = await ns.profiles.get(resolvedId, params);
|
|
275
|
-
const getOutOpts = { ...outOpts, slim: slimProfile };
|
|
276
|
-
renderSuccess(result, getOutOpts, out);
|
|
277
|
-
}
|
|
278
|
-
} catch (err) {
|
|
279
|
-
const { CurviateError } = await import("@curviate/sdk");
|
|
280
|
-
if (err instanceof CurviateError) {
|
|
281
|
-
const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
|
|
282
|
-
renderError(err, outOpts, out);
|
|
283
|
-
process.exit(getExitCode(err.code));
|
|
284
|
-
}
|
|
285
|
-
renderUnexpectedError(err, out);
|
|
286
|
-
process.exit(1);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
async function runProfileConnections(client, flags, out) {
|
|
290
|
-
rejectPreviewOnRead(flags.preview, out);
|
|
291
|
-
const accountId = requireAccount(flags.account, out);
|
|
292
|
-
const ns = client.account(accountId);
|
|
293
|
-
const outOpts = resolveOutputOpts(flags);
|
|
294
|
-
const all = flags.all ?? false;
|
|
295
|
-
const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
|
|
296
|
-
const limit = flags.limit ? parseInt(flags.limit, 10) : void 0;
|
|
297
|
-
const cursor = flags.cursor;
|
|
298
|
-
const params = {};
|
|
299
|
-
if (limit !== void 0) params["limit"] = limit;
|
|
300
|
-
if (cursor) params["cursor"] = cursor;
|
|
301
|
-
try {
|
|
302
|
-
if (all) {
|
|
303
|
-
const fn = (p) => ns.profiles.listConnections(p);
|
|
304
|
-
for await (const item of streamAll(fn, params, {
|
|
305
|
-
maxPages,
|
|
306
|
-
onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
|
|
307
|
-
`)
|
|
308
|
-
})) {
|
|
309
|
-
out.stdout.write(JSON.stringify(item) + "\n");
|
|
310
|
-
}
|
|
311
|
-
} else {
|
|
312
|
-
const result = await ns.profiles.listConnections(params);
|
|
313
|
-
renderSuccess(result, outOpts, out);
|
|
314
|
-
}
|
|
315
|
-
} catch (err) {
|
|
316
|
-
const { CurviateError } = await import("@curviate/sdk");
|
|
317
|
-
if (err instanceof CurviateError) {
|
|
318
|
-
const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
|
|
319
|
-
renderError(err, outOpts, out);
|
|
320
|
-
process.exit(getExitCode(err.code));
|
|
321
|
-
}
|
|
322
|
-
renderUnexpectedError(err, out);
|
|
323
|
-
process.exit(1);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
async function runProfileEndorse(client, flags, out) {
|
|
327
|
-
const accountId = requireAccount(flags.account, out);
|
|
328
|
-
const rawId = flags.id ?? "";
|
|
329
|
-
const resolvedId = resolveIdentifier(rawId);
|
|
330
|
-
const skillId = flags.skill ?? "";
|
|
331
|
-
const outOpts = resolveOutputOpts(flags);
|
|
332
|
-
if (flags.preview) {
|
|
333
|
-
const preview = buildPreviewOutput({
|
|
334
|
-
method: "profiles.endorse",
|
|
335
|
-
args: { id: resolvedId },
|
|
336
|
-
body: { skill_endorsement_id: skillId },
|
|
337
|
-
account: accountId
|
|
338
|
-
});
|
|
339
|
-
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
const ns = client.account(accountId);
|
|
343
|
-
try {
|
|
344
|
-
const result = await ns.profiles.endorse(resolvedId, { skill_endorsement_id: skillId });
|
|
345
|
-
renderSuccess(result, outOpts, out);
|
|
346
|
-
} catch (err) {
|
|
347
|
-
const { CurviateError } = await import("@curviate/sdk");
|
|
348
|
-
if (err instanceof CurviateError) {
|
|
349
|
-
const { getExitCode } = await import("./exit-codes-ZTY2NY3X.js");
|
|
350
|
-
renderError(err, outOpts, out);
|
|
351
|
-
process.exit(getExitCode(err.code));
|
|
352
|
-
}
|
|
353
|
-
renderUnexpectedError(err, out);
|
|
354
|
-
process.exit(1);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
var profileMeCommand = defineCommand({
|
|
358
|
-
meta: { name: "me", description: "Get your own profile, or list own activity with --posts/--comments/--reactions/--followers." },
|
|
359
|
-
args: {
|
|
360
|
-
...GLOBAL_FLAGS,
|
|
361
|
-
sections: {
|
|
362
|
-
type: "string",
|
|
363
|
-
description: "Comma-separated LinkedIn sections to fetch (e.g. experience,education). Only applies to the base getMe call (no activity flag)."
|
|
364
|
-
},
|
|
365
|
-
posts: {
|
|
366
|
-
type: "boolean",
|
|
367
|
-
description: "List own activity feed (posts + reposts). For authored-only posts, use 'post list'.",
|
|
368
|
-
default: false
|
|
369
|
-
},
|
|
370
|
-
comments: {
|
|
371
|
-
type: "boolean",
|
|
372
|
-
description: "List own comments.",
|
|
373
|
-
default: false
|
|
374
|
-
},
|
|
375
|
-
reactions: {
|
|
376
|
-
type: "boolean",
|
|
377
|
-
description: "List own reactions.",
|
|
378
|
-
default: false
|
|
379
|
-
},
|
|
380
|
-
followers: {
|
|
381
|
-
type: "boolean",
|
|
382
|
-
description: "List own followers.",
|
|
383
|
-
default: false
|
|
384
|
-
}
|
|
385
|
-
},
|
|
386
|
-
async run({ args }) {
|
|
387
|
-
const flags = args;
|
|
388
|
-
const cfg = await resolveEffectiveConfig({
|
|
389
|
-
apiKey: flags["api-key"],
|
|
390
|
-
baseUrl: flags["base-url"],
|
|
391
|
-
timeout: flags.timeout,
|
|
392
|
-
account: flags.account,
|
|
393
|
-
profile: flags.profile
|
|
394
|
-
});
|
|
395
|
-
if (!cfg.apiKey) {
|
|
396
|
-
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
397
|
-
process.exit(3);
|
|
398
|
-
}
|
|
399
|
-
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
400
|
-
const out = buildOutputStreams();
|
|
401
|
-
await runProfileMe(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
var profileConnectionsCommand = defineCommand({
|
|
405
|
-
meta: { name: "connections", description: "List your 1st-degree connections." },
|
|
406
|
-
args: { ...GLOBAL_FLAGS },
|
|
407
|
-
async run({ args }) {
|
|
408
|
-
const flags = args;
|
|
409
|
-
const cfg = await resolveEffectiveConfig({
|
|
410
|
-
apiKey: flags["api-key"],
|
|
411
|
-
baseUrl: flags["base-url"],
|
|
412
|
-
timeout: flags.timeout,
|
|
413
|
-
account: flags.account,
|
|
414
|
-
profile: flags.profile
|
|
415
|
-
});
|
|
416
|
-
if (!cfg.apiKey) {
|
|
417
|
-
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
418
|
-
process.exit(3);
|
|
419
|
-
}
|
|
420
|
-
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
421
|
-
const out = buildOutputStreams();
|
|
422
|
-
await runProfileConnections(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
423
|
-
}
|
|
424
|
-
});
|
|
425
|
-
var profileEndorseCommand = defineCommand({
|
|
426
|
-
meta: { name: "endorse", description: "Endorse a skill on a member's profile." },
|
|
427
|
-
args: {
|
|
428
|
-
...GLOBAL_FLAGS,
|
|
429
|
-
id: { type: "positional", description: "Member identifier (URL, slug, or URN)." },
|
|
430
|
-
skill: { type: "string", description: "Skill endorsement ID to endorse.", required: true }
|
|
431
|
-
},
|
|
432
|
-
async run({ args }) {
|
|
433
|
-
const flags = args;
|
|
434
|
-
const cfg = await resolveEffectiveConfig({
|
|
435
|
-
apiKey: args["api-key"],
|
|
436
|
-
baseUrl: args["base-url"],
|
|
437
|
-
timeout: args.timeout,
|
|
438
|
-
account: flags.account,
|
|
439
|
-
profile: args.profile
|
|
440
|
-
});
|
|
441
|
-
if (!cfg.apiKey) {
|
|
442
|
-
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
443
|
-
process.exit(3);
|
|
444
|
-
}
|
|
445
|
-
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
446
|
-
const out = buildOutputStreams();
|
|
447
|
-
await runProfileEndorse(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
448
|
-
}
|
|
449
|
-
});
|
|
450
|
-
var profileCommand = defineCommand({
|
|
451
|
-
meta: { name: "profile", description: "LinkedIn profile operations." },
|
|
452
|
-
args: {
|
|
453
|
-
...GLOBAL_FLAGS,
|
|
454
|
-
id: { type: "positional", description: "Member identifier (URL, slug, or URN). Optional for subcommands.", required: false },
|
|
455
|
-
posts: { type: "boolean", description: "List the profile's posts.", default: false },
|
|
456
|
-
comments: { type: "boolean", description: "List the profile's comments.", default: false },
|
|
457
|
-
reactions: { type: "boolean", description: "List the profile's reactions.", default: false },
|
|
458
|
-
followers: { type: "boolean", description: "List the profile's followers.", default: false },
|
|
459
|
-
"is-company": { type: "boolean", description: "When listing posts, treat the profile as a company page.", default: false },
|
|
460
|
-
notify: { type: "boolean", description: "Signal a profile view when fetching.", default: false },
|
|
461
|
-
sections: {
|
|
462
|
-
type: "string",
|
|
463
|
-
description: "Comma-separated LinkedIn sections to fetch (e.g. experience,education)."
|
|
464
|
-
}
|
|
465
|
-
},
|
|
466
|
-
subCommands: {
|
|
467
|
-
me: profileMeCommand,
|
|
468
|
-
connections: profileConnectionsCommand,
|
|
469
|
-
endorse: profileEndorseCommand
|
|
470
|
-
},
|
|
471
|
-
async run({ args }) {
|
|
472
|
-
const flags = args;
|
|
473
|
-
if (!flags.id) {
|
|
474
|
-
process.stderr.write(
|
|
475
|
-
"Usage: curviate profile <id> [--posts|--comments|--reactions|--followers]\n curviate profile me\n curviate profile connections\n curviate profile endorse <id> --skill <sid>\n"
|
|
476
|
-
);
|
|
477
|
-
return;
|
|
478
|
-
}
|
|
479
|
-
const cfg = await resolveEffectiveConfig({
|
|
480
|
-
apiKey: flags["api-key"],
|
|
481
|
-
baseUrl: flags["base-url"],
|
|
482
|
-
timeout: flags.timeout,
|
|
483
|
-
account: flags.account,
|
|
484
|
-
profile: flags.profile
|
|
485
|
-
});
|
|
486
|
-
if (!cfg.apiKey) {
|
|
487
|
-
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
488
|
-
process.exit(3);
|
|
489
|
-
}
|
|
490
|
-
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
491
|
-
const out = buildOutputStreams();
|
|
492
|
-
await runProfileGet(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
493
|
-
}
|
|
494
|
-
});
|
|
495
|
-
export {
|
|
496
|
-
profileCommand,
|
|
497
|
-
runProfileConnections,
|
|
498
|
-
runProfileEndorse,
|
|
499
|
-
runProfileGet,
|
|
500
|
-
runProfileMe
|
|
501
|
-
};
|