@curviate/cli 0.1.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 +22 -0
- package/LICENSE +21 -0
- package/README.md +174 -0
- package/dist/account-YOW2MCZS.js +639 -0
- package/dist/chunk-2NCPJJPC.js +140 -0
- package/dist/chunk-6JNCLLNY.js +195 -0
- package/dist/chunk-BNUTM6KD.js +33 -0
- package/dist/chunk-Q43HZUN3.js +29 -0
- package/dist/chunk-R3VLWLVV.js +23 -0
- package/dist/chunk-SND3NHCT.js +46 -0
- package/dist/chunk-UWO2D4HW.js +34 -0
- package/dist/cli.js +159 -0
- package/dist/company-IKVDW7MX.js +82 -0
- package/dist/config-4JOXBFYX.js +262 -0
- package/dist/connect-HLDHFBGX.js +348 -0
- package/dist/exit-codes-NFIR57ZA.js +57 -0
- package/dist/inbox-JBLYJMV2.js +294 -0
- package/dist/login-VWJEBBFU.js +122 -0
- package/dist/message-IK7VGB63.js +566 -0
- package/dist/post-EAAGVR5D.js +496 -0
- package/dist/profile-WXA3NC7D.js +352 -0
- package/dist/recruiter-TGCV36EH.js +984 -0
- package/dist/sales-nav-XGFO5I6F.js +488 -0
- package/dist/search-LHPTHPWH.js +354 -0
- package/dist/webhook-QM5LGAUF.js +445 -0
- package/package.json +54 -0
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
AttachError,
|
|
4
|
+
readAttachment
|
|
5
|
+
} from "./chunk-Q43HZUN3.js";
|
|
6
|
+
import {
|
|
7
|
+
buildPreviewOutput
|
|
8
|
+
} from "./chunk-R3VLWLVV.js";
|
|
9
|
+
import {
|
|
10
|
+
resolveIdentifier
|
|
11
|
+
} from "./chunk-BNUTM6KD.js";
|
|
12
|
+
import {
|
|
13
|
+
streamAll
|
|
14
|
+
} from "./chunk-SND3NHCT.js";
|
|
15
|
+
import {
|
|
16
|
+
createClient,
|
|
17
|
+
renderError,
|
|
18
|
+
renderSuccess,
|
|
19
|
+
renderUnexpectedError,
|
|
20
|
+
resolveEffectiveConfig
|
|
21
|
+
} from "./chunk-2NCPJJPC.js";
|
|
22
|
+
import {
|
|
23
|
+
GLOBAL_FLAGS
|
|
24
|
+
} from "./chunk-6JNCLLNY.js";
|
|
25
|
+
|
|
26
|
+
// src/commands/sales-nav.ts
|
|
27
|
+
import { defineCommand } from "citty";
|
|
28
|
+
function buildOutputStreams() {
|
|
29
|
+
return {
|
|
30
|
+
stdout: { write: (s) => process.stdout.write(s) },
|
|
31
|
+
stderr: { write: (s) => process.stderr.write(s) }
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function requireAccount(account, out) {
|
|
35
|
+
if (!account) {
|
|
36
|
+
out.stderr.write("error: --account is required for this command. Set it via --account, CURVIATE_ACCOUNT, or `curviate config set-account`.\n");
|
|
37
|
+
process.exit(2);
|
|
38
|
+
}
|
|
39
|
+
return account;
|
|
40
|
+
}
|
|
41
|
+
function rejectPreviewOnRead(preview, out) {
|
|
42
|
+
if (preview) {
|
|
43
|
+
out.stderr.write("error: --preview is only valid on write commands (mutations). Reads just run.\n");
|
|
44
|
+
process.exit(2);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function resolveOutputOpts(flags) {
|
|
48
|
+
return {
|
|
49
|
+
json: (flags.json ?? false) || !process.stdout.isTTY,
|
|
50
|
+
isTTY: process.stdout.isTTY ?? false,
|
|
51
|
+
fields: flags.fields
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function normalizeAttachPaths(attach) {
|
|
55
|
+
if (!attach) return [];
|
|
56
|
+
return Array.isArray(attach) ? attach : [attach];
|
|
57
|
+
}
|
|
58
|
+
async function handleSdkError(err, outOpts, out) {
|
|
59
|
+
const { CurviateError } = await import("@curviate/sdk");
|
|
60
|
+
if (err instanceof CurviateError) {
|
|
61
|
+
const { getExitCode } = await import("./exit-codes-NFIR57ZA.js");
|
|
62
|
+
renderError(err, outOpts, out);
|
|
63
|
+
process.exit(getExitCode(err.code));
|
|
64
|
+
}
|
|
65
|
+
renderUnexpectedError(err, out);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
async function runSalesNavSync(client, flags, out) {
|
|
69
|
+
rejectPreviewOnRead(flags.preview, out);
|
|
70
|
+
const accountId = requireAccount(flags.account, out);
|
|
71
|
+
const ns = client.account(accountId);
|
|
72
|
+
const outOpts = resolveOutputOpts(flags);
|
|
73
|
+
const params = {};
|
|
74
|
+
if (flags.cursor) params["cursor"] = flags.cursor;
|
|
75
|
+
if (flags.limit) params["limit"] = parseInt(flags.limit, 10);
|
|
76
|
+
try {
|
|
77
|
+
const result = await ns.salesNavigator.syncMessages(params);
|
|
78
|
+
renderSuccess(result, outOpts, out);
|
|
79
|
+
} catch (err) {
|
|
80
|
+
await handleSdkError(err, outOpts, out);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async function runSalesNavSearchPeople(client, flags, out) {
|
|
84
|
+
rejectPreviewOnRead(flags.preview, out);
|
|
85
|
+
const accountId = requireAccount(flags.account, out);
|
|
86
|
+
const ns = client.account(accountId);
|
|
87
|
+
const outOpts = resolveOutputOpts(flags);
|
|
88
|
+
const all = flags.all ?? false;
|
|
89
|
+
const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
|
|
90
|
+
const limit = flags.limit ? parseInt(flags.limit, 10) : void 0;
|
|
91
|
+
const cursor = flags.cursor;
|
|
92
|
+
const body = {};
|
|
93
|
+
if (flags.keywords) body["keywords"] = flags.keywords;
|
|
94
|
+
const params = {};
|
|
95
|
+
if (limit !== void 0) params["limit"] = limit;
|
|
96
|
+
if (cursor) params["cursor"] = cursor;
|
|
97
|
+
try {
|
|
98
|
+
if (all) {
|
|
99
|
+
const fn = (p) => {
|
|
100
|
+
const mergedBody = { ...body };
|
|
101
|
+
const { cursor: c, limit: l, ...restP } = p;
|
|
102
|
+
const callParams = {};
|
|
103
|
+
if (c) callParams["cursor"] = c;
|
|
104
|
+
if (l) callParams["limit"] = l;
|
|
105
|
+
void restP;
|
|
106
|
+
return ns.salesNavigator.searchPeople(mergedBody, callParams);
|
|
107
|
+
};
|
|
108
|
+
for await (const item of streamAll(fn, params, {
|
|
109
|
+
maxPages,
|
|
110
|
+
onTruncated: (msg) => out.stderr.write(msg + "\n")
|
|
111
|
+
})) {
|
|
112
|
+
out.stdout.write(JSON.stringify(item) + "\n");
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
const result = await ns.salesNavigator.searchPeople(body, Object.keys(params).length > 0 ? params : void 0);
|
|
116
|
+
renderSuccess(result, outOpts, out);
|
|
117
|
+
}
|
|
118
|
+
} catch (err) {
|
|
119
|
+
await handleSdkError(err, outOpts, out);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async function runSalesNavSearchCompanies(client, flags, out) {
|
|
123
|
+
rejectPreviewOnRead(flags.preview, out);
|
|
124
|
+
const accountId = requireAccount(flags.account, out);
|
|
125
|
+
const ns = client.account(accountId);
|
|
126
|
+
const outOpts = resolveOutputOpts(flags);
|
|
127
|
+
const all = flags.all ?? false;
|
|
128
|
+
const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
|
|
129
|
+
const limit = flags.limit ? parseInt(flags.limit, 10) : void 0;
|
|
130
|
+
const cursor = flags.cursor;
|
|
131
|
+
const body = {};
|
|
132
|
+
if (flags.keywords) body["keywords"] = flags.keywords;
|
|
133
|
+
const params = {};
|
|
134
|
+
if (limit !== void 0) params["limit"] = limit;
|
|
135
|
+
if (cursor) params["cursor"] = cursor;
|
|
136
|
+
try {
|
|
137
|
+
if (all) {
|
|
138
|
+
const fn = (p) => {
|
|
139
|
+
const mergedBody = { ...body };
|
|
140
|
+
const { cursor: c, limit: l, ...restP } = p;
|
|
141
|
+
const callParams = {};
|
|
142
|
+
if (c) callParams["cursor"] = c;
|
|
143
|
+
if (l) callParams["limit"] = l;
|
|
144
|
+
void restP;
|
|
145
|
+
return ns.salesNavigator.searchCompanies(mergedBody, callParams);
|
|
146
|
+
};
|
|
147
|
+
for await (const item of streamAll(fn, params, {
|
|
148
|
+
maxPages,
|
|
149
|
+
onTruncated: (msg) => out.stderr.write(msg + "\n")
|
|
150
|
+
})) {
|
|
151
|
+
out.stdout.write(JSON.stringify(item) + "\n");
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
const result = await ns.salesNavigator.searchCompanies(body, Object.keys(params).length > 0 ? params : void 0);
|
|
155
|
+
renderSuccess(result, outOpts, out);
|
|
156
|
+
}
|
|
157
|
+
} catch (err) {
|
|
158
|
+
await handleSdkError(err, outOpts, out);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
async function runSalesNavGetParameters(client, flags, out) {
|
|
162
|
+
rejectPreviewOnRead(flags.preview, out);
|
|
163
|
+
const accountId = requireAccount(flags.account, out);
|
|
164
|
+
const ns = client.account(accountId);
|
|
165
|
+
const outOpts = resolveOutputOpts(flags);
|
|
166
|
+
const params = {};
|
|
167
|
+
if (flags.type) params["type"] = flags.type;
|
|
168
|
+
try {
|
|
169
|
+
const result = await ns.salesNavigator.getParameters(params);
|
|
170
|
+
renderSuccess(result, outOpts, out);
|
|
171
|
+
} catch (err) {
|
|
172
|
+
await handleSdkError(err, outOpts, out);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
async function runSalesNavMessageNew(client, flags, out) {
|
|
176
|
+
const accountId = requireAccount(flags.account, out);
|
|
177
|
+
const to = flags.to ?? "";
|
|
178
|
+
const text = flags.text ?? "";
|
|
179
|
+
const attachPaths = normalizeAttachPaths(flags.attach);
|
|
180
|
+
const voicePath = flags.voice;
|
|
181
|
+
const videoPath = flags.video;
|
|
182
|
+
let attachBuffers = [];
|
|
183
|
+
let voiceBuffer;
|
|
184
|
+
let videoBuffer;
|
|
185
|
+
try {
|
|
186
|
+
attachBuffers = await Promise.all(attachPaths.map((p) => readAttachment(p)));
|
|
187
|
+
if (voicePath) voiceBuffer = await readAttachment(voicePath);
|
|
188
|
+
if (videoPath) videoBuffer = await readAttachment(videoPath);
|
|
189
|
+
} catch (err) {
|
|
190
|
+
if (err instanceof AttachError) {
|
|
191
|
+
out.stderr.write(`error: ${err.message}
|
|
192
|
+
`);
|
|
193
|
+
process.exit(err.exitCode);
|
|
194
|
+
}
|
|
195
|
+
throw err;
|
|
196
|
+
}
|
|
197
|
+
const body = {
|
|
198
|
+
attendees_ids: [to],
|
|
199
|
+
text
|
|
200
|
+
};
|
|
201
|
+
if (flags.preview) {
|
|
202
|
+
const preview = buildPreviewOutput({
|
|
203
|
+
method: "salesNavigator.startChat",
|
|
204
|
+
args: { attendees_ids: [to] },
|
|
205
|
+
body: { ...body },
|
|
206
|
+
account: accountId,
|
|
207
|
+
attachments: [
|
|
208
|
+
...attachBuffers.map((buf, i) => ({
|
|
209
|
+
name: attachPaths[i] ? attachPaths[i].split("/").pop() ?? attachPaths[i] : `attachment_${i}`,
|
|
210
|
+
buffer: buf
|
|
211
|
+
})),
|
|
212
|
+
...voiceBuffer ? [{ name: voicePath ? voicePath.split("/").pop() ?? voicePath : "voice", buffer: voiceBuffer }] : [],
|
|
213
|
+
...videoBuffer ? [{ name: videoPath ? videoPath.split("/").pop() ?? videoPath : "video", buffer: videoBuffer }] : []
|
|
214
|
+
]
|
|
215
|
+
});
|
|
216
|
+
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
if (attachBuffers.length > 0) body["attachments"] = attachBuffers;
|
|
220
|
+
if (voiceBuffer) body["voice_message"] = voiceBuffer;
|
|
221
|
+
if (videoBuffer) body["video_message"] = videoBuffer;
|
|
222
|
+
const ns = client.account(accountId);
|
|
223
|
+
const outOpts = resolveOutputOpts(flags);
|
|
224
|
+
try {
|
|
225
|
+
const result = await ns.salesNavigator.startChat(body);
|
|
226
|
+
renderSuccess(result, outOpts, out);
|
|
227
|
+
} catch (err) {
|
|
228
|
+
await handleSdkError(err, outOpts, out);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
async function runSalesNavProfile(client, flags, out) {
|
|
232
|
+
rejectPreviewOnRead(flags.preview, out);
|
|
233
|
+
const accountId = requireAccount(flags.account, out);
|
|
234
|
+
const rawId = flags.identifier ?? "";
|
|
235
|
+
const resolvedId = resolveIdentifier(rawId);
|
|
236
|
+
const ns = client.account(accountId);
|
|
237
|
+
const outOpts = resolveOutputOpts(flags);
|
|
238
|
+
try {
|
|
239
|
+
const result = await ns.salesNavigator.getProfile(resolvedId, {});
|
|
240
|
+
renderSuccess(result, outOpts, out);
|
|
241
|
+
} catch (err) {
|
|
242
|
+
await handleSdkError(err, outOpts, out);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
async function runSalesNavSaveLead(client, flags, out) {
|
|
246
|
+
const accountId = requireAccount(flags.account, out);
|
|
247
|
+
const userId = flags.userId ?? "";
|
|
248
|
+
const outOpts = resolveOutputOpts(flags);
|
|
249
|
+
const body = {};
|
|
250
|
+
if (flags["list-id"]) body["list_id"] = flags["list-id"];
|
|
251
|
+
if (flags.preview) {
|
|
252
|
+
const preview = buildPreviewOutput({
|
|
253
|
+
method: "salesNavigator.saveLead",
|
|
254
|
+
args: { user_id: userId },
|
|
255
|
+
body,
|
|
256
|
+
account: accountId
|
|
257
|
+
});
|
|
258
|
+
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
const ns = client.account(accountId);
|
|
262
|
+
try {
|
|
263
|
+
const result = await ns.salesNavigator.saveLead(userId, body);
|
|
264
|
+
renderSuccess(result, outOpts, out);
|
|
265
|
+
} catch (err) {
|
|
266
|
+
await handleSdkError(err, outOpts, out);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
var salesNavSyncCommand = defineCommand({
|
|
270
|
+
meta: { name: "sync", description: "Sync Sales Navigator message history for an account." },
|
|
271
|
+
args: { ...GLOBAL_FLAGS },
|
|
272
|
+
async run({ args }) {
|
|
273
|
+
const flags = args;
|
|
274
|
+
const cfg = await resolveEffectiveConfig({
|
|
275
|
+
apiKey: flags["api-key"],
|
|
276
|
+
baseUrl: flags["base-url"],
|
|
277
|
+
timeout: flags.timeout,
|
|
278
|
+
account: flags.account,
|
|
279
|
+
profile: flags.profile
|
|
280
|
+
});
|
|
281
|
+
if (!cfg.apiKey) {
|
|
282
|
+
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
283
|
+
process.exit(3);
|
|
284
|
+
}
|
|
285
|
+
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
286
|
+
const out = buildOutputStreams();
|
|
287
|
+
await runSalesNavSync(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
var salesNavMessageNewCommand = defineCommand({
|
|
291
|
+
meta: { name: "new", description: "Start a new Sales Navigator chat." },
|
|
292
|
+
args: {
|
|
293
|
+
...GLOBAL_FLAGS,
|
|
294
|
+
to: { type: "string", description: "Recipient provider ID.", required: true },
|
|
295
|
+
text: { type: "positional", description: "Message text." },
|
|
296
|
+
attach: { type: "string", description: "File to attach (repeatable)." },
|
|
297
|
+
voice: { type: "string", description: "Voice message file." },
|
|
298
|
+
video: { type: "string", description: "Video message file." }
|
|
299
|
+
},
|
|
300
|
+
async run({ args }) {
|
|
301
|
+
const flags = args;
|
|
302
|
+
const cfg = await resolveEffectiveConfig({
|
|
303
|
+
apiKey: flags["api-key"],
|
|
304
|
+
baseUrl: flags["base-url"],
|
|
305
|
+
timeout: flags.timeout,
|
|
306
|
+
account: flags.account,
|
|
307
|
+
profile: flags.profile
|
|
308
|
+
});
|
|
309
|
+
if (!cfg.apiKey) {
|
|
310
|
+
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
311
|
+
process.exit(3);
|
|
312
|
+
}
|
|
313
|
+
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
314
|
+
const out = buildOutputStreams();
|
|
315
|
+
await runSalesNavMessageNew(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
var salesNavMessageCommand = defineCommand({
|
|
319
|
+
meta: { name: "message", description: "Sales Navigator messaging operations." },
|
|
320
|
+
args: { ...GLOBAL_FLAGS },
|
|
321
|
+
subCommands: {
|
|
322
|
+
new: salesNavMessageNewCommand
|
|
323
|
+
},
|
|
324
|
+
async run() {
|
|
325
|
+
process.stderr.write('Usage: curviate sales-nav message new --to <id> "<text>" [--attach <file>\u2026]\n');
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
var salesNavSearchPeopleCommand = defineCommand({
|
|
329
|
+
meta: { name: "people", description: "Search Sales Navigator member profiles." },
|
|
330
|
+
args: {
|
|
331
|
+
...GLOBAL_FLAGS,
|
|
332
|
+
keywords: { type: "string", description: "Keyword search string." }
|
|
333
|
+
},
|
|
334
|
+
async run({ args }) {
|
|
335
|
+
const flags = args;
|
|
336
|
+
const cfg = await resolveEffectiveConfig({
|
|
337
|
+
apiKey: flags["api-key"],
|
|
338
|
+
baseUrl: flags["base-url"],
|
|
339
|
+
timeout: flags.timeout,
|
|
340
|
+
account: flags.account,
|
|
341
|
+
profile: flags.profile
|
|
342
|
+
});
|
|
343
|
+
if (!cfg.apiKey) {
|
|
344
|
+
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
345
|
+
process.exit(3);
|
|
346
|
+
}
|
|
347
|
+
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
348
|
+
const out = buildOutputStreams();
|
|
349
|
+
await runSalesNavSearchPeople(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
var salesNavSearchCompaniesCommand = defineCommand({
|
|
353
|
+
meta: { name: "companies", description: "Search Sales Navigator companies." },
|
|
354
|
+
args: {
|
|
355
|
+
...GLOBAL_FLAGS,
|
|
356
|
+
keywords: { type: "string", description: "Keyword search string." }
|
|
357
|
+
},
|
|
358
|
+
async run({ args }) {
|
|
359
|
+
const flags = args;
|
|
360
|
+
const cfg = await resolveEffectiveConfig({
|
|
361
|
+
apiKey: flags["api-key"],
|
|
362
|
+
baseUrl: flags["base-url"],
|
|
363
|
+
timeout: flags.timeout,
|
|
364
|
+
account: flags.account,
|
|
365
|
+
profile: flags.profile
|
|
366
|
+
});
|
|
367
|
+
if (!cfg.apiKey) {
|
|
368
|
+
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
369
|
+
process.exit(3);
|
|
370
|
+
}
|
|
371
|
+
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
372
|
+
const out = buildOutputStreams();
|
|
373
|
+
await runSalesNavSearchCompanies(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
var salesNavSearchParametersCommand = defineCommand({
|
|
377
|
+
meta: { name: "parameters", description: "Resolve Sales Navigator filter parameter IDs." },
|
|
378
|
+
args: {
|
|
379
|
+
...GLOBAL_FLAGS,
|
|
380
|
+
type: { type: "string", description: "Parameter type (e.g. LOCATION, INDUSTRY, TITLE).", required: true }
|
|
381
|
+
},
|
|
382
|
+
async run({ args }) {
|
|
383
|
+
const flags = args;
|
|
384
|
+
const cfg = await resolveEffectiveConfig({
|
|
385
|
+
apiKey: flags["api-key"],
|
|
386
|
+
baseUrl: flags["base-url"],
|
|
387
|
+
timeout: flags.timeout,
|
|
388
|
+
account: flags.account,
|
|
389
|
+
profile: flags.profile
|
|
390
|
+
});
|
|
391
|
+
if (!cfg.apiKey) {
|
|
392
|
+
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
393
|
+
process.exit(3);
|
|
394
|
+
}
|
|
395
|
+
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
396
|
+
const out = buildOutputStreams();
|
|
397
|
+
await runSalesNavGetParameters(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
var salesNavSearchCommand = defineCommand({
|
|
401
|
+
meta: { name: "search", description: "Sales Navigator search operations." },
|
|
402
|
+
args: { ...GLOBAL_FLAGS },
|
|
403
|
+
subCommands: {
|
|
404
|
+
people: salesNavSearchPeopleCommand,
|
|
405
|
+
companies: salesNavSearchCompaniesCommand,
|
|
406
|
+
parameters: salesNavSearchParametersCommand
|
|
407
|
+
},
|
|
408
|
+
async run() {
|
|
409
|
+
process.stderr.write(
|
|
410
|
+
"Usage: curviate sales-nav search people [--keywords <k>]\n curviate sales-nav search companies [--keywords <k>]\n curviate sales-nav search parameters --type <t>\n"
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
var salesNavProfileCommand = defineCommand({
|
|
415
|
+
meta: { name: "profile", description: "Get a Sales Navigator enriched member profile." },
|
|
416
|
+
args: {
|
|
417
|
+
...GLOBAL_FLAGS,
|
|
418
|
+
identifier: { type: "positional", description: "LinkedIn URL, slug, or native id." }
|
|
419
|
+
},
|
|
420
|
+
async run({ args }) {
|
|
421
|
+
const flags = args;
|
|
422
|
+
const cfg = await resolveEffectiveConfig({
|
|
423
|
+
apiKey: flags["api-key"],
|
|
424
|
+
baseUrl: flags["base-url"],
|
|
425
|
+
timeout: flags.timeout,
|
|
426
|
+
account: flags.account,
|
|
427
|
+
profile: flags.profile
|
|
428
|
+
});
|
|
429
|
+
if (!cfg.apiKey) {
|
|
430
|
+
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
431
|
+
process.exit(3);
|
|
432
|
+
}
|
|
433
|
+
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
434
|
+
const out = buildOutputStreams();
|
|
435
|
+
await runSalesNavProfile(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
var salesNavSaveLeadCommand = defineCommand({
|
|
439
|
+
meta: { name: "save-lead", description: "Save a Sales Navigator member as a lead." },
|
|
440
|
+
args: {
|
|
441
|
+
...GLOBAL_FLAGS,
|
|
442
|
+
userId: { type: "positional", description: "Sales Navigator member ID (ACw\u2026 format)." },
|
|
443
|
+
"list-id": { type: "string", description: "Lead list ID to save the lead into." }
|
|
444
|
+
},
|
|
445
|
+
async run({ args }) {
|
|
446
|
+
const flags = args;
|
|
447
|
+
const cfg = await resolveEffectiveConfig({
|
|
448
|
+
apiKey: flags["api-key"],
|
|
449
|
+
baseUrl: flags["base-url"],
|
|
450
|
+
timeout: flags.timeout,
|
|
451
|
+
account: flags.account,
|
|
452
|
+
profile: flags.profile
|
|
453
|
+
});
|
|
454
|
+
if (!cfg.apiKey) {
|
|
455
|
+
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
456
|
+
process.exit(3);
|
|
457
|
+
}
|
|
458
|
+
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
459
|
+
const out = buildOutputStreams();
|
|
460
|
+
await runSalesNavSaveLead(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
var salesNavCommand = defineCommand({
|
|
464
|
+
meta: { name: "sales-nav", description: "Sales Navigator operations (requires the Sales Navigator add-on)." },
|
|
465
|
+
args: { ...GLOBAL_FLAGS },
|
|
466
|
+
subCommands: {
|
|
467
|
+
sync: salesNavSyncCommand,
|
|
468
|
+
message: salesNavMessageCommand,
|
|
469
|
+
search: salesNavSearchCommand,
|
|
470
|
+
profile: salesNavProfileCommand,
|
|
471
|
+
"save-lead": salesNavSaveLeadCommand
|
|
472
|
+
},
|
|
473
|
+
async run() {
|
|
474
|
+
process.stderr.write(
|
|
475
|
+
'Usage: curviate sales-nav sync\n curviate sales-nav search people [--keywords <k>]\n curviate sales-nav search companies [--keywords <k>]\n curviate sales-nav search parameters --type <t>\n curviate sales-nav message new --to <id> "<text>"\n curviate sales-nav profile <identifier>\n curviate sales-nav save-lead <user_id> [--list-id <id>]\n'
|
|
476
|
+
);
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
export {
|
|
480
|
+
runSalesNavGetParameters,
|
|
481
|
+
runSalesNavMessageNew,
|
|
482
|
+
runSalesNavProfile,
|
|
483
|
+
runSalesNavSaveLead,
|
|
484
|
+
runSalesNavSearchCompanies,
|
|
485
|
+
runSalesNavSearchPeople,
|
|
486
|
+
runSalesNavSync,
|
|
487
|
+
salesNavCommand
|
|
488
|
+
};
|