@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,26 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
streamAll
|
|
4
|
-
} from "./chunk-GXTZION6.js";
|
|
5
2
|
import {
|
|
6
3
|
slimCompany,
|
|
7
4
|
slimSearchJobs,
|
|
8
5
|
slimSearchPeople,
|
|
9
6
|
slimSearchPosts
|
|
10
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-45KHSWCV.js";
|
|
11
8
|
import {
|
|
12
9
|
resolveIdentifier
|
|
13
10
|
} from "./chunk-DMQZEPQE.js";
|
|
11
|
+
import {
|
|
12
|
+
pageDelayFromFlags,
|
|
13
|
+
streamAll
|
|
14
|
+
} from "./chunk-EEMJDJ4W.js";
|
|
14
15
|
import {
|
|
15
16
|
createClient,
|
|
16
17
|
renderError,
|
|
17
18
|
renderSuccess,
|
|
18
19
|
renderUnexpectedError,
|
|
19
20
|
resolveEffectiveConfig
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-M33MI53G.js";
|
|
21
22
|
import {
|
|
22
23
|
GLOBAL_FLAGS
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-TMU3CSPR.js";
|
|
24
25
|
|
|
25
26
|
// src/commands/company.ts
|
|
26
27
|
import { defineCommand } from "citty";
|
|
@@ -51,10 +52,16 @@ function resolveOutputOpts(flags) {
|
|
|
51
52
|
verbose: flags.verbose ?? false
|
|
52
53
|
};
|
|
53
54
|
}
|
|
55
|
+
async function resolveCompanyId(ns, raw) {
|
|
56
|
+
const normalized = resolveIdentifier(raw);
|
|
57
|
+
if (/^\d+$/.test(normalized)) return normalized;
|
|
58
|
+
const company = await ns.companies.get(normalized);
|
|
59
|
+
return String(company.id);
|
|
60
|
+
}
|
|
54
61
|
async function handleSdkError(err, outOpts, out) {
|
|
55
62
|
const { CurviateError } = await import("@curviate/sdk");
|
|
56
63
|
if (err instanceof CurviateError) {
|
|
57
|
-
const { getExitCode } = await import("./exit-codes-
|
|
64
|
+
const { getExitCode } = await import("./exit-codes-SL3GQF7W.js");
|
|
58
65
|
renderError(err, outOpts, out);
|
|
59
66
|
process.exit(getExitCode(err.code));
|
|
60
67
|
}
|
|
@@ -85,7 +92,6 @@ async function runCompanyGet(client, flags, out) {
|
|
|
85
92
|
async function runCompanyEmployees(client, flags, out) {
|
|
86
93
|
rejectPreviewOnRead(flags.preview, out);
|
|
87
94
|
const accountId = requireAccount(flags.account, out);
|
|
88
|
-
const identifier = flags.id ?? "";
|
|
89
95
|
const ns = client.account(accountId);
|
|
90
96
|
const outOpts = resolveOutputOpts(flags);
|
|
91
97
|
const params = {};
|
|
@@ -94,13 +100,14 @@ async function runCompanyEmployees(client, flags, out) {
|
|
|
94
100
|
if (flags.keywords) params["keywords"] = flags.keywords;
|
|
95
101
|
if (flags.location) params["location"] = flags.location;
|
|
96
102
|
try {
|
|
103
|
+
const identifier = await resolveCompanyId(ns, flags.id ?? "");
|
|
97
104
|
if (flags.all) {
|
|
98
105
|
const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
|
|
99
106
|
const fn = (p) => ns.companies.employees(identifier, p);
|
|
100
107
|
for await (const item of streamAll(fn, params, {
|
|
101
108
|
maxPages,
|
|
102
|
-
|
|
103
|
-
|
|
109
|
+
out,
|
|
110
|
+
pageDelayMs: pageDelayFromFlags(flags)
|
|
104
111
|
})) {
|
|
105
112
|
out.stdout.write(JSON.stringify(item) + "\n");
|
|
106
113
|
}
|
|
@@ -115,20 +122,20 @@ async function runCompanyEmployees(client, flags, out) {
|
|
|
115
122
|
async function runCompanyPosts(client, flags, out) {
|
|
116
123
|
rejectPreviewOnRead(flags.preview, out);
|
|
117
124
|
const accountId = requireAccount(flags.account, out);
|
|
118
|
-
const identifier = flags.id ?? "";
|
|
119
125
|
const ns = client.account(accountId);
|
|
120
126
|
const outOpts = resolveOutputOpts(flags);
|
|
121
127
|
const params = {};
|
|
122
128
|
if (flags.limit) params["limit"] = parseInt(flags.limit, 10);
|
|
123
129
|
if (flags.cursor) params["cursor"] = flags.cursor;
|
|
124
130
|
try {
|
|
131
|
+
const identifier = await resolveCompanyId(ns, flags.id ?? "");
|
|
125
132
|
if (flags.all) {
|
|
126
133
|
const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
|
|
127
134
|
const fn = (p) => ns.companies.posts(identifier, p);
|
|
128
135
|
for await (const item of streamAll(fn, params, {
|
|
129
136
|
maxPages,
|
|
130
|
-
|
|
131
|
-
|
|
137
|
+
out,
|
|
138
|
+
pageDelayMs: pageDelayFromFlags(flags)
|
|
132
139
|
})) {
|
|
133
140
|
out.stdout.write(JSON.stringify(item) + "\n");
|
|
134
141
|
}
|
|
@@ -143,7 +150,6 @@ async function runCompanyPosts(client, flags, out) {
|
|
|
143
150
|
async function runCompanyJobs(client, flags, out) {
|
|
144
151
|
rejectPreviewOnRead(flags.preview, out);
|
|
145
152
|
const accountId = requireAccount(flags.account, out);
|
|
146
|
-
const identifier = flags.id ?? "";
|
|
147
153
|
const ns = client.account(accountId);
|
|
148
154
|
const outOpts = resolveOutputOpts(flags);
|
|
149
155
|
const params = {};
|
|
@@ -151,13 +157,14 @@ async function runCompanyJobs(client, flags, out) {
|
|
|
151
157
|
if (flags.cursor) params["cursor"] = flags.cursor;
|
|
152
158
|
if (flags.keywords) params["keywords"] = flags.keywords;
|
|
153
159
|
try {
|
|
160
|
+
const identifier = await resolveCompanyId(ns, flags.id ?? "");
|
|
154
161
|
if (flags.all) {
|
|
155
162
|
const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
|
|
156
163
|
const fn = (p) => ns.companies.jobs(identifier, p);
|
|
157
164
|
for await (const item of streamAll(fn, params, {
|
|
158
165
|
maxPages,
|
|
159
|
-
|
|
160
|
-
|
|
166
|
+
out,
|
|
167
|
+
pageDelayMs: pageDelayFromFlags(flags)
|
|
161
168
|
})) {
|
|
162
169
|
out.stdout.write(JSON.stringify(item) + "\n");
|
|
163
170
|
}
|
|
@@ -169,39 +176,11 @@ async function runCompanyJobs(client, flags, out) {
|
|
|
169
176
|
await handleSdkError(err, outOpts, out);
|
|
170
177
|
}
|
|
171
178
|
}
|
|
172
|
-
async function runCompanyFollowers(client, flags, out) {
|
|
173
|
-
rejectPreviewOnRead(flags.preview, out);
|
|
174
|
-
const accountId = requireAccount(flags.account, out);
|
|
175
|
-
const identifier = flags.id ?? "";
|
|
176
|
-
const ns = client.account(accountId);
|
|
177
|
-
const outOpts = resolveOutputOpts(flags);
|
|
178
|
-
const params = {};
|
|
179
|
-
if (flags.limit) params["limit"] = parseInt(flags.limit, 10);
|
|
180
|
-
if (flags.cursor) params["cursor"] = flags.cursor;
|
|
181
|
-
try {
|
|
182
|
-
if (flags.all) {
|
|
183
|
-
const maxPages = flags["max-pages"] ? parseInt(flags["max-pages"], 10) : 100;
|
|
184
|
-
const fn = (p) => ns.companies.followers(identifier, p);
|
|
185
|
-
for await (const item of streamAll(fn, params, {
|
|
186
|
-
maxPages,
|
|
187
|
-
onTruncated: (n) => out.stderr.write(`Streaming truncated at ${n} page(s). Use --all --max-pages or --cursor for manual paging.
|
|
188
|
-
`)
|
|
189
|
-
})) {
|
|
190
|
-
out.stdout.write(JSON.stringify(item) + "\n");
|
|
191
|
-
}
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
const result = await ns.companies.followers(identifier, params);
|
|
195
|
-
renderSuccess(result, outOpts, out);
|
|
196
|
-
} catch (err) {
|
|
197
|
-
await handleSdkError(err, outOpts, out);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
179
|
var companyEmployeesCommand = defineCommand({
|
|
201
180
|
meta: { name: "employees", description: "List people who currently work at the company." },
|
|
202
181
|
args: {
|
|
203
182
|
...GLOBAL_FLAGS,
|
|
204
|
-
id: { type: "positional", description: "
|
|
183
|
+
id: { type: "positional", description: "Company identifier (URL, slug, or numeric id) \u2014 a slug/URL is resolved to the numeric id first." },
|
|
205
184
|
keywords: { type: "string", description: "Free-text keyword filter across employee profile fields." },
|
|
206
185
|
location: { type: "string", description: "Opaque location id from `search parameters --type LOCATION`." }
|
|
207
186
|
},
|
|
@@ -227,7 +206,7 @@ var companyPostsCommand = defineCommand({
|
|
|
227
206
|
meta: { name: "posts", description: "List the company's posts." },
|
|
228
207
|
args: {
|
|
229
208
|
...GLOBAL_FLAGS,
|
|
230
|
-
id: { type: "positional", description: "
|
|
209
|
+
id: { type: "positional", description: "Company identifier (URL, slug, or numeric id) \u2014 a slug/URL is resolved to the numeric id first." }
|
|
231
210
|
},
|
|
232
211
|
async run({ args }) {
|
|
233
212
|
const flags = args;
|
|
@@ -251,7 +230,7 @@ var companyJobsCommand = defineCommand({
|
|
|
251
230
|
meta: { name: "jobs", description: "List the company's open job postings." },
|
|
252
231
|
args: {
|
|
253
232
|
...GLOBAL_FLAGS,
|
|
254
|
-
id: { type: "positional", description: "
|
|
233
|
+
id: { type: "positional", description: "Company identifier (URL, slug, or numeric id) \u2014 a slug/URL is resolved to the numeric id first." },
|
|
255
234
|
keywords: { type: "string", description: "Free-text keyword filter across job postings." }
|
|
256
235
|
},
|
|
257
236
|
async run({ args }) {
|
|
@@ -272,30 +251,6 @@ var companyJobsCommand = defineCommand({
|
|
|
272
251
|
await runCompanyJobs(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
273
252
|
}
|
|
274
253
|
});
|
|
275
|
-
var companyFollowersCommand = defineCommand({
|
|
276
|
-
meta: { name: "followers", description: "List the company's followers. Requires page-admin permission." },
|
|
277
|
-
args: {
|
|
278
|
-
...GLOBAL_FLAGS,
|
|
279
|
-
id: { type: "positional", description: "The company's numeric provider_id (the id field of `company <id>`)." }
|
|
280
|
-
},
|
|
281
|
-
async run({ args }) {
|
|
282
|
-
const flags = args;
|
|
283
|
-
const cfg = await resolveEffectiveConfig({
|
|
284
|
-
apiKey: flags["api-key"],
|
|
285
|
-
baseUrl: flags["base-url"],
|
|
286
|
-
timeout: flags.timeout,
|
|
287
|
-
account: flags.account,
|
|
288
|
-
profile: flags.profile
|
|
289
|
-
});
|
|
290
|
-
if (!cfg.apiKey) {
|
|
291
|
-
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
292
|
-
process.exit(3);
|
|
293
|
-
}
|
|
294
|
-
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
295
|
-
const out = buildOutputStreams();
|
|
296
|
-
await runCompanyFollowers(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
254
|
var companyCommand = defineCommand({
|
|
300
255
|
meta: { name: "company", description: "Fetch a company profile by URL, slug, or numeric id, and its sub-resources." },
|
|
301
256
|
args: {
|
|
@@ -306,8 +261,7 @@ var companyCommand = defineCommand({
|
|
|
306
261
|
subCommands: {
|
|
307
262
|
employees: companyEmployeesCommand,
|
|
308
263
|
posts: companyPostsCommand,
|
|
309
|
-
jobs: companyJobsCommand
|
|
310
|
-
followers: companyFollowersCommand
|
|
264
|
+
jobs: companyJobsCommand
|
|
311
265
|
},
|
|
312
266
|
async run({ args }) {
|
|
313
267
|
const flags = args;
|
|
@@ -330,7 +284,6 @@ var companyCommand = defineCommand({
|
|
|
330
284
|
export {
|
|
331
285
|
companyCommand,
|
|
332
286
|
runCompanyEmployees,
|
|
333
|
-
runCompanyFollowers,
|
|
334
287
|
runCompanyGet,
|
|
335
288
|
runCompanyJobs,
|
|
336
289
|
runCompanyPosts
|
|
@@ -2,29 +2,30 @@
|
|
|
2
2
|
import {
|
|
3
3
|
buildPreviewOutput
|
|
4
4
|
} from "./chunk-R3VLWLVV.js";
|
|
5
|
-
import {
|
|
6
|
-
streamAll
|
|
7
|
-
} from "./chunk-GXTZION6.js";
|
|
8
5
|
import {
|
|
9
6
|
slimInviteReceived,
|
|
10
7
|
slimInviteReceivedItem,
|
|
11
8
|
slimInviteSent,
|
|
12
9
|
slimInviteSentItem
|
|
13
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-45KHSWCV.js";
|
|
14
11
|
import {
|
|
15
12
|
resolveIdentifier
|
|
16
13
|
} from "./chunk-DMQZEPQE.js";
|
|
14
|
+
import {
|
|
15
|
+
pageDelayFromFlags,
|
|
16
|
+
streamAll
|
|
17
|
+
} from "./chunk-EEMJDJ4W.js";
|
|
17
18
|
import {
|
|
18
19
|
createClient,
|
|
19
20
|
renderError,
|
|
20
21
|
renderSuccess,
|
|
21
22
|
renderUnexpectedError,
|
|
22
23
|
resolveEffectiveConfig
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-M33MI53G.js";
|
|
24
25
|
import {
|
|
25
26
|
GLOBAL_FLAGS,
|
|
26
27
|
WRITE_FLAGS
|
|
27
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-TMU3CSPR.js";
|
|
28
29
|
|
|
29
30
|
// src/commands/connect.ts
|
|
30
31
|
import { defineCommand } from "citty";
|
|
@@ -59,8 +60,10 @@ async function runConnectSend(client, flags, out) {
|
|
|
59
60
|
const accountId = requireAccount(flags.account, out);
|
|
60
61
|
const rawId = flags.id ?? "";
|
|
61
62
|
const resolvedId = resolveIdentifier(rawId);
|
|
62
|
-
const body = {
|
|
63
|
-
|
|
63
|
+
const body = {
|
|
64
|
+
recipient_identifier: resolvedId,
|
|
65
|
+
...flags.note ? { message: flags.note } : {}
|
|
66
|
+
};
|
|
64
67
|
if (flags.preview) {
|
|
65
68
|
const preview = buildPreviewOutput({
|
|
66
69
|
method: "invites.send",
|
|
@@ -79,7 +82,7 @@ async function runConnectSend(client, flags, out) {
|
|
|
79
82
|
} catch (err) {
|
|
80
83
|
const { CurviateError } = await import("@curviate/sdk");
|
|
81
84
|
if (err instanceof CurviateError) {
|
|
82
|
-
const { getExitCode } = await import("./exit-codes-
|
|
85
|
+
const { getExitCode } = await import("./exit-codes-SL3GQF7W.js");
|
|
83
86
|
renderError(err, outOpts, out);
|
|
84
87
|
process.exit(getExitCode(err.code));
|
|
85
88
|
}
|
|
@@ -104,8 +107,8 @@ async function runConnectSent(client, flags, out) {
|
|
|
104
107
|
const fn = (p) => ns.invites.listSent(p);
|
|
105
108
|
for await (const item of streamAll(fn, params, {
|
|
106
109
|
maxPages,
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
out,
|
|
111
|
+
pageDelayMs: pageDelayFromFlags(flags)
|
|
109
112
|
})) {
|
|
110
113
|
const projected = !flags.verbose ? slimInviteSentItem(item) : item;
|
|
111
114
|
out.stdout.write(JSON.stringify(projected) + "\n");
|
|
@@ -117,7 +120,7 @@ async function runConnectSent(client, flags, out) {
|
|
|
117
120
|
} catch (err) {
|
|
118
121
|
const { CurviateError } = await import("@curviate/sdk");
|
|
119
122
|
if (err instanceof CurviateError) {
|
|
120
|
-
const { getExitCode } = await import("./exit-codes-
|
|
123
|
+
const { getExitCode } = await import("./exit-codes-SL3GQF7W.js");
|
|
121
124
|
renderError(err, outOpts, out);
|
|
122
125
|
process.exit(getExitCode(err.code));
|
|
123
126
|
}
|
|
@@ -142,8 +145,8 @@ async function runConnectReceived(client, flags, out) {
|
|
|
142
145
|
const fn = (p) => ns.invites.listReceived(p);
|
|
143
146
|
for await (const item of streamAll(fn, params, {
|
|
144
147
|
maxPages,
|
|
145
|
-
|
|
146
|
-
|
|
148
|
+
out,
|
|
149
|
+
pageDelayMs: pageDelayFromFlags(flags)
|
|
147
150
|
})) {
|
|
148
151
|
const projected = !flags.verbose ? slimInviteReceivedItem(item) : item;
|
|
149
152
|
out.stdout.write(JSON.stringify(projected) + "\n");
|
|
@@ -155,7 +158,7 @@ async function runConnectReceived(client, flags, out) {
|
|
|
155
158
|
} catch (err) {
|
|
156
159
|
const { CurviateError } = await import("@curviate/sdk");
|
|
157
160
|
if (err instanceof CurviateError) {
|
|
158
|
-
const { getExitCode } = await import("./exit-codes-
|
|
161
|
+
const { getExitCode } = await import("./exit-codes-SL3GQF7W.js");
|
|
159
162
|
renderError(err, outOpts, out);
|
|
160
163
|
process.exit(getExitCode(err.code));
|
|
161
164
|
}
|
|
@@ -163,23 +166,43 @@ async function runConnectReceived(client, flags, out) {
|
|
|
163
166
|
process.exit(1);
|
|
164
167
|
}
|
|
165
168
|
}
|
|
166
|
-
async function
|
|
169
|
+
async function runConnectAccept(client, flags, out) {
|
|
167
170
|
const accountId = requireAccount(flags.account, out);
|
|
168
171
|
const invitationId = flags.id ?? "";
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
if (flags.preview) {
|
|
173
|
+
const preview = buildPreviewOutput({
|
|
174
|
+
method: "invites.accept",
|
|
175
|
+
args: { invitation_id: invitationId },
|
|
176
|
+
body: {},
|
|
177
|
+
account: accountId
|
|
178
|
+
});
|
|
179
|
+
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
180
|
+
return;
|
|
176
181
|
}
|
|
177
|
-
const
|
|
182
|
+
const ns = client.account(accountId);
|
|
183
|
+
const outOpts = resolveOutputOpts(flags);
|
|
184
|
+
try {
|
|
185
|
+
const result = await ns.invites.accept(invitationId);
|
|
186
|
+
renderSuccess(result, outOpts, out);
|
|
187
|
+
} catch (err) {
|
|
188
|
+
const { CurviateError } = await import("@curviate/sdk");
|
|
189
|
+
if (err instanceof CurviateError) {
|
|
190
|
+
const { getExitCode } = await import("./exit-codes-SL3GQF7W.js");
|
|
191
|
+
renderError(err, outOpts, out);
|
|
192
|
+
process.exit(getExitCode(err.code));
|
|
193
|
+
}
|
|
194
|
+
renderUnexpectedError(err, out);
|
|
195
|
+
process.exit(1);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
async function runConnectDecline(client, flags, out) {
|
|
199
|
+
const accountId = requireAccount(flags.account, out);
|
|
200
|
+
const invitationId = flags.id ?? "";
|
|
178
201
|
if (flags.preview) {
|
|
179
202
|
const preview = buildPreviewOutput({
|
|
180
|
-
method: "invites.
|
|
203
|
+
method: "invites.decline",
|
|
181
204
|
args: { invitation_id: invitationId },
|
|
182
|
-
body,
|
|
205
|
+
body: {},
|
|
183
206
|
account: accountId
|
|
184
207
|
});
|
|
185
208
|
out.stdout.write(JSON.stringify(preview) + "\n");
|
|
@@ -188,12 +211,12 @@ async function runConnectRespond(client, flags, out) {
|
|
|
188
211
|
const ns = client.account(accountId);
|
|
189
212
|
const outOpts = resolveOutputOpts(flags);
|
|
190
213
|
try {
|
|
191
|
-
const result = await ns.invites.
|
|
214
|
+
const result = await ns.invites.decline(invitationId);
|
|
192
215
|
renderSuccess(result, outOpts, out);
|
|
193
216
|
} catch (err) {
|
|
194
217
|
const { CurviateError } = await import("@curviate/sdk");
|
|
195
218
|
if (err instanceof CurviateError) {
|
|
196
|
-
const { getExitCode } = await import("./exit-codes-
|
|
219
|
+
const { getExitCode } = await import("./exit-codes-SL3GQF7W.js");
|
|
197
220
|
renderError(err, outOpts, out);
|
|
198
221
|
process.exit(getExitCode(err.code));
|
|
199
222
|
}
|
|
@@ -222,7 +245,7 @@ async function runConnectCancel(client, flags, out) {
|
|
|
222
245
|
} catch (err) {
|
|
223
246
|
const { CurviateError } = await import("@curviate/sdk");
|
|
224
247
|
if (err instanceof CurviateError) {
|
|
225
|
-
const { getExitCode } = await import("./exit-codes-
|
|
248
|
+
const { getExitCode } = await import("./exit-codes-SL3GQF7W.js");
|
|
226
249
|
renderError(err, outOpts, out);
|
|
227
250
|
process.exit(getExitCode(err.code));
|
|
228
251
|
}
|
|
@@ -233,7 +256,7 @@ async function runConnectCancel(client, flags, out) {
|
|
|
233
256
|
var connectSentCommand = defineCommand({
|
|
234
257
|
meta: {
|
|
235
258
|
name: "sent",
|
|
236
|
-
description: "Returns pending sent invitations only \u2014 accepted and declined invitations are not returned (LinkedIn API limitation). Use `id` with `connect cancel`; use `
|
|
259
|
+
description: "Returns pending sent invitations only \u2014 accepted and declined invitations are not returned (LinkedIn API limitation). Use `id` with `connect cancel`; use `user.id` (native member URN \u2014 the sent-variant carries no public slug) to identify the recipient. `created_at` is the platform's own ISO-8601 timestamp (not an approximation). No total count is available; use `connect sent --all` and count client-side. A very recently sent invitation may take a few minutes to appear here (LinkedIn-side indexing)."
|
|
237
260
|
},
|
|
238
261
|
args: { ...GLOBAL_FLAGS },
|
|
239
262
|
async run({ args }) {
|
|
@@ -257,7 +280,7 @@ var connectSentCommand = defineCommand({
|
|
|
257
280
|
var connectReceivedCommand = defineCommand({
|
|
258
281
|
meta: {
|
|
259
282
|
name: "received",
|
|
260
|
-
description: "Returns pending received invitations only \u2014 already-handled invitations are not returned. The `
|
|
283
|
+
description: "Returns pending received invitations only \u2014 already-handled invitations are not returned. The `user.*` fields (`public_identifier`, `display_name`, `first_name`, `last_name`) identify who sent the request. Use the `id` field with `connect accept` or `connect decline`. A very recently received invitation may take a few minutes to appear here (LinkedIn-side indexing)."
|
|
261
284
|
},
|
|
262
285
|
args: { ...GLOBAL_FLAGS },
|
|
263
286
|
async run({ args }) {
|
|
@@ -278,19 +301,40 @@ var connectReceivedCommand = defineCommand({
|
|
|
278
301
|
await runConnectReceived(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
279
302
|
}
|
|
280
303
|
});
|
|
281
|
-
var
|
|
282
|
-
meta: { name: "
|
|
304
|
+
var connectAcceptCommand = defineCommand({
|
|
305
|
+
meta: { name: "accept", description: "Accept a received invitation." },
|
|
283
306
|
args: {
|
|
284
307
|
...WRITE_FLAGS,
|
|
285
308
|
id: {
|
|
286
309
|
type: "positional",
|
|
287
|
-
description: "Invitation id to
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
310
|
+
description: "Invitation id to accept \u2014 use the `id` field from `connect received`."
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
async run({ args }) {
|
|
314
|
+
const flags = args;
|
|
315
|
+
const cfg = await resolveEffectiveConfig({
|
|
316
|
+
apiKey: flags["api-key"],
|
|
317
|
+
baseUrl: flags["base-url"],
|
|
318
|
+
timeout: flags.timeout,
|
|
319
|
+
account: flags.account,
|
|
320
|
+
profile: flags.profile
|
|
321
|
+
});
|
|
322
|
+
if (!cfg.apiKey) {
|
|
323
|
+
process.stderr.write("error: no API key \u2014 run `curviate login` or pass --api-key.\n");
|
|
324
|
+
process.exit(3);
|
|
325
|
+
}
|
|
326
|
+
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
327
|
+
const out = buildOutputStreams();
|
|
328
|
+
await runConnectAccept(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
var connectDeclineCommand = defineCommand({
|
|
332
|
+
meta: { name: "decline", description: "Decline a received invitation." },
|
|
333
|
+
args: {
|
|
334
|
+
...WRITE_FLAGS,
|
|
335
|
+
id: {
|
|
336
|
+
type: "positional",
|
|
337
|
+
description: "Invitation id to decline \u2014 use the `id` field from `connect received`."
|
|
294
338
|
}
|
|
295
339
|
},
|
|
296
340
|
async run({ args }) {
|
|
@@ -308,7 +352,7 @@ var connectRespondCommand = defineCommand({
|
|
|
308
352
|
}
|
|
309
353
|
const client = createClient({ apiKey: cfg.apiKey, baseUrl: cfg.baseUrl, timeout: cfg.timeout });
|
|
310
354
|
const out = buildOutputStreams();
|
|
311
|
-
await
|
|
355
|
+
await runConnectDecline(client, { ...flags, account: flags.account ?? cfg.account }, out);
|
|
312
356
|
}
|
|
313
357
|
});
|
|
314
358
|
var connectCancelCommand = defineCommand({
|
|
@@ -355,16 +399,17 @@ var connectCommand = defineCommand({
|
|
|
355
399
|
subCommands: {
|
|
356
400
|
sent: connectSentCommand,
|
|
357
401
|
received: connectReceivedCommand,
|
|
358
|
-
|
|
402
|
+
accept: connectAcceptCommand,
|
|
403
|
+
decline: connectDeclineCommand,
|
|
359
404
|
cancel: connectCancelCommand
|
|
360
405
|
},
|
|
361
406
|
async run({ args }) {
|
|
362
407
|
const flags = args;
|
|
363
408
|
if (!flags.id) {
|
|
364
409
|
process.stderr.write(
|
|
365
|
-
"Usage: curviate connect <id> [--note <text>]\n curviate connect sent\n curviate connect received\n curviate connect
|
|
410
|
+
"Usage: curviate connect <id> [--note <text>]\n curviate connect sent\n curviate connect received\n curviate connect accept <invitation_id>\n curviate connect decline <invitation_id>\n curviate connect cancel <invitation_id>\n"
|
|
366
411
|
);
|
|
367
|
-
|
|
412
|
+
process.exit(2);
|
|
368
413
|
}
|
|
369
414
|
const cfg = await resolveEffectiveConfig({
|
|
370
415
|
apiKey: flags["api-key"],
|
|
@@ -384,9 +429,10 @@ var connectCommand = defineCommand({
|
|
|
384
429
|
});
|
|
385
430
|
export {
|
|
386
431
|
connectCommand,
|
|
432
|
+
runConnectAccept,
|
|
387
433
|
runConnectCancel,
|
|
434
|
+
runConnectDecline,
|
|
388
435
|
runConnectReceived,
|
|
389
|
-
runConnectRespond,
|
|
390
436
|
runConnectSend,
|
|
391
437
|
runConnectSent
|
|
392
438
|
};
|