linkedin-relay-mcp 3.25.0 → 3.27.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/.claude/skills/linkedin-relay/SKILL.md +35 -9
- package/README.md +5 -1
- package/dist/cli.js +869 -301
- package/dist/cli.js.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/mcp-shim.js +803 -231
- package/dist/mcp-shim.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1106,6 +1106,42 @@ var CONTRACTS = {
|
|
|
1106
1106
|
provenance: "verified",
|
|
1107
1107
|
capturedAt: "2026-10-14"
|
|
1108
1108
|
},
|
|
1109
|
+
// Premium job reads, captured 2026-11-22 from /jobs/collections/top-applicant/
|
|
1110
|
+
// and a job's detail pane. See engine/job-premium.ts.
|
|
1111
|
+
jobCollection: {
|
|
1112
|
+
name: "jobCollection",
|
|
1113
|
+
transport: "voyager-graphql",
|
|
1114
|
+
path: `${VOYAGER}/graphql`,
|
|
1115
|
+
queryId: "voyagerJobsDashJobCards.fc1f897bcf2dc9afd5184ef3e9ed589b",
|
|
1116
|
+
provenance: "verified",
|
|
1117
|
+
capturedAt: "2026-11-22"
|
|
1118
|
+
},
|
|
1119
|
+
jobDetailSections: {
|
|
1120
|
+
name: "jobDetailSections",
|
|
1121
|
+
transport: "voyager-graphql",
|
|
1122
|
+
path: `${VOYAGER}/graphql`,
|
|
1123
|
+
queryId: "voyagerJobsDashJobPostingDetailSections.bc2eee77d01abc6616b8c8855344dfd5",
|
|
1124
|
+
provenance: "verified",
|
|
1125
|
+
capturedAt: "2026-11-22"
|
|
1126
|
+
},
|
|
1127
|
+
// LinkedIn's AI assistant, as a job's "Show match details" asks it
|
|
1128
|
+
// (2026-11-22). See engine/job-premium.ts.
|
|
1129
|
+
guideMessage: {
|
|
1130
|
+
name: "guideMessage",
|
|
1131
|
+
transport: "voyager-graphql",
|
|
1132
|
+
path: `${VOYAGER}/graphql`,
|
|
1133
|
+
queryId: "voyagerGuideDashMessage.7eaf64013d9f7cc6c5c32038dfc3fb81",
|
|
1134
|
+
provenance: "verified",
|
|
1135
|
+
capturedAt: "2026-11-22"
|
|
1136
|
+
},
|
|
1137
|
+
guideMessages: {
|
|
1138
|
+
name: "guideMessages",
|
|
1139
|
+
transport: "voyager-graphql",
|
|
1140
|
+
path: `${VOYAGER}/graphql`,
|
|
1141
|
+
queryId: "voyagerGuideDashBionicMessageV2.6c3ccc4bfc5030c09d28a50e5332ac06",
|
|
1142
|
+
provenance: "verified",
|
|
1143
|
+
capturedAt: "2026-11-22"
|
|
1144
|
+
},
|
|
1109
1145
|
jobPosting: {
|
|
1110
1146
|
name: "jobPosting",
|
|
1111
1147
|
transport: "voyager-restli",
|
|
@@ -1180,25 +1216,25 @@ function parseCompany(json) {
|
|
|
1180
1216
|
const data = root?.data;
|
|
1181
1217
|
if (data === void 0 || data === null) return drift("the company answer carried no data");
|
|
1182
1218
|
const included = root?.included ?? [];
|
|
1183
|
-
const
|
|
1219
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
1184
1220
|
let c = data;
|
|
1185
1221
|
if (!String(data.$type ?? "").endsWith("organization.Company")) {
|
|
1186
1222
|
const listed2 = urns(data["*elements"]);
|
|
1187
1223
|
if (listed2.length === 0)
|
|
1188
1224
|
return { ok: false, code: "NOT_FOUND", message: "no company has that name on LinkedIn" };
|
|
1189
|
-
c =
|
|
1225
|
+
c = byUrn2.get(listed2[0]);
|
|
1190
1226
|
if (c === void 0) return drift("the company was listed but not sent");
|
|
1191
1227
|
}
|
|
1192
1228
|
const id = idOf(c.entityUrn);
|
|
1193
1229
|
const name = str2(c.name);
|
|
1194
1230
|
if (id === void 0 || name === void 0) return drift("the company carried no id or name");
|
|
1195
1231
|
const followersOf = (n) => {
|
|
1196
|
-
const f =
|
|
1232
|
+
const f = byUrn2.get(n["*followingInfo"]);
|
|
1197
1233
|
return typeof f?.followerCount === "number" ? f.followerCount : void 0;
|
|
1198
1234
|
};
|
|
1199
1235
|
const related = (list2) => {
|
|
1200
1236
|
const pages = urns(list2).flatMap((u) => {
|
|
1201
|
-
const p =
|
|
1237
|
+
const p = byUrn2.get(u);
|
|
1202
1238
|
const pid = idOf(u);
|
|
1203
1239
|
const pname = str2(p?.name);
|
|
1204
1240
|
if (p === void 0 || pid === void 0 || pname === void 0) return [];
|
|
@@ -1206,7 +1242,7 @@ function parseCompany(json) {
|
|
|
1206
1242
|
});
|
|
1207
1243
|
return pages.length > 0 ? pages : void 0;
|
|
1208
1244
|
};
|
|
1209
|
-
const industry = urns(c["*companyIndustries"]).map((u) => str2(
|
|
1245
|
+
const industry = urns(c["*companyIndustries"]).map((u) => str2(byUrn2.get(u)?.localizedName)).find((x) => x !== void 0);
|
|
1210
1246
|
const locations = (Array.isArray(c.confirmedLocations) ? c.confirmedLocations : []).map(address).filter((x) => x !== void 0);
|
|
1211
1247
|
const specialties = Array.isArray(c.specialities) ? c.specialities.filter((x) => typeof x === "string") : [];
|
|
1212
1248
|
const founded = c.foundedOn?.year;
|
|
@@ -1406,6 +1442,7 @@ function classifyRedirect(location) {
|
|
|
1406
1442
|
return fail("FETCH_FAILED", `unexpected redirect to ${location || "(none)"}`);
|
|
1407
1443
|
}
|
|
1408
1444
|
function challengeIn(body) {
|
|
1445
|
+
if (!/^\s*</.test(body)) return null;
|
|
1409
1446
|
if (!CHALLENGE_MARKERS.test(body.slice(0, 4e3))) return null;
|
|
1410
1447
|
return fail("CHALLENGE_DETECTED", "a challenge page was returned with status 200", {
|
|
1411
1448
|
cooldown: "CHALLENGE_DETECTED",
|
|
@@ -1574,6 +1611,8 @@ function encodeBody(spec) {
|
|
|
1574
1611
|
async function fetchRaw(spec, session, deps) {
|
|
1575
1612
|
const requestHeaders = buildHeaders(session);
|
|
1576
1613
|
if (spec.body !== void 0) requestHeaders["content-type"] = "application/json; charset=UTF-8";
|
|
1614
|
+
if (spec.url.includes("linkedin.com/flagship-web/"))
|
|
1615
|
+
requestHeaders.referer = "https://www.linkedin.com/feed/";
|
|
1577
1616
|
Object.assign(requestHeaders, spec.headers);
|
|
1578
1617
|
const body = encodeBody(spec);
|
|
1579
1618
|
try {
|
|
@@ -1725,9 +1764,9 @@ function findRefs(data) {
|
|
|
1725
1764
|
}
|
|
1726
1765
|
function parseSingle(payload) {
|
|
1727
1766
|
const envelope = payload ?? {};
|
|
1728
|
-
const
|
|
1729
|
-
if (
|
|
1730
|
-
return
|
|
1767
|
+
const nodes2 = [...new Set(indexIncluded(envelope.included).values())];
|
|
1768
|
+
if (nodes2.length === 0) return void 0;
|
|
1769
|
+
return nodes2.find((n) => !isNoise(n) && !isDecoration(n)) ?? nodes2[0];
|
|
1731
1770
|
}
|
|
1732
1771
|
function parseCollection(payload, opts) {
|
|
1733
1772
|
const envelope = payload ?? {};
|
|
@@ -2213,10 +2252,10 @@ function balanced(s, start) {
|
|
|
2213
2252
|
return null;
|
|
2214
2253
|
}
|
|
2215
2254
|
function parseAt(s, start) {
|
|
2216
|
-
const
|
|
2217
|
-
if (
|
|
2255
|
+
const text7 = start < 0 ? null : balanced(s, start);
|
|
2256
|
+
if (text7 === null) return null;
|
|
2218
2257
|
try {
|
|
2219
|
-
return JSON.parse(
|
|
2258
|
+
return JSON.parse(text7);
|
|
2220
2259
|
} catch {
|
|
2221
2260
|
return null;
|
|
2222
2261
|
}
|
|
@@ -2581,13 +2620,13 @@ function readPost(rows, top, model) {
|
|
|
2581
2620
|
const subRow = sub === void 0 ? "" : rows.byId.get(sub.row) ?? "";
|
|
2582
2621
|
const posted = sub === void 0 ? void 0 : texts(subRow, subRow.indexOf('"viewName":"feed-actor-sub-description"'))[0];
|
|
2583
2622
|
const said = commentary === void 0 ? void 0 : firstIn(rows, commentary.under, (row) => texts(row)[0]);
|
|
2584
|
-
const
|
|
2623
|
+
const text7 = said?.v;
|
|
2585
2624
|
const post = {
|
|
2586
2625
|
id,
|
|
2587
2626
|
url: `https://www.linkedin.com/feed/update/${id}/`,
|
|
2588
2627
|
...author.fields,
|
|
2589
2628
|
...posted !== void 0 ? { posted } : {},
|
|
2590
|
-
...
|
|
2629
|
+
...text7 !== void 0 ? { text: text7 } : {},
|
|
2591
2630
|
...reactions !== void 0 ? { reactions } : {}
|
|
2592
2631
|
};
|
|
2593
2632
|
const comments = n(`commentCount-${id}`);
|
|
@@ -2727,21 +2766,22 @@ var drift2 = (message) => ({
|
|
|
2727
2766
|
hint: "the job search response changed shape; re-capture it"
|
|
2728
2767
|
});
|
|
2729
2768
|
function readCards(elements, included) {
|
|
2730
|
-
const
|
|
2769
|
+
const byUrn2 = /* @__PURE__ */ new Map();
|
|
2731
2770
|
for (const node of included) {
|
|
2732
|
-
if (typeof node.entityUrn === "string")
|
|
2771
|
+
if (typeof node.entityUrn === "string") byUrn2.set(node.entityUrn, node);
|
|
2733
2772
|
}
|
|
2734
2773
|
const jobs = [];
|
|
2735
2774
|
const unknownTypes = {};
|
|
2736
2775
|
let unresolved = 0;
|
|
2737
2776
|
for (const el of elements) {
|
|
2738
|
-
const union = el.jobCardUnion ?? {};
|
|
2777
|
+
const union = el.jobCardUnion ?? el.jobCard ?? {};
|
|
2739
2778
|
const ref = union["*jobPostingCard"];
|
|
2740
2779
|
if (typeof ref !== "string") {
|
|
2741
|
-
for (const kind of Object.
|
|
2780
|
+
for (const [kind, v] of Object.entries(union))
|
|
2781
|
+
if (v !== null && !kind.startsWith("$")) unknownTypes[kind] = (unknownTypes[kind] ?? 0) + 1;
|
|
2742
2782
|
continue;
|
|
2743
2783
|
}
|
|
2744
|
-
const card2 =
|
|
2784
|
+
const card2 = byUrn2.get(ref);
|
|
2745
2785
|
const job = card2 === void 0 ? void 0 : cardToJob(card2);
|
|
2746
2786
|
if (job === void 0) unresolved++;
|
|
2747
2787
|
else if (!jobs.some((j) => j.id === job.id)) jobs.push(job);
|
|
@@ -2840,10 +2880,10 @@ function parseJobBatch(json) {
|
|
|
2840
2880
|
if (results === null || typeof results !== "object")
|
|
2841
2881
|
return drift2("the batch job response carried no results");
|
|
2842
2882
|
const included = root?.included ?? [];
|
|
2843
|
-
const
|
|
2883
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
2844
2884
|
const jobs = [];
|
|
2845
2885
|
for (const ref of Object.values(results)) {
|
|
2846
|
-
const node = typeof ref === "string" ?
|
|
2886
|
+
const node = typeof ref === "string" ? byUrn2.get(ref) : ref;
|
|
2847
2887
|
const job = node === void 0 ? void 0 : postingToJob(node, included);
|
|
2848
2888
|
if (job !== void 0) jobs.push(job);
|
|
2849
2889
|
}
|
|
@@ -3144,7 +3184,7 @@ function classify2(item) {
|
|
|
3144
3184
|
return kinds.every((k) => FURNITURE.has(k)) ? "furniture" : kinds;
|
|
3145
3185
|
}
|
|
3146
3186
|
function readItems(c, included, toRow) {
|
|
3147
|
-
const
|
|
3187
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
3148
3188
|
const people = [];
|
|
3149
3189
|
const unknownTypes = {};
|
|
3150
3190
|
let excluded = 0;
|
|
@@ -3157,7 +3197,7 @@ function readItems(c, included, toRow) {
|
|
|
3157
3197
|
} else if (Array.isArray(kind)) {
|
|
3158
3198
|
for (const k of kind) unknownTypes[k] = (unknownTypes[k] ?? 0) + 1;
|
|
3159
3199
|
} else {
|
|
3160
|
-
const row =
|
|
3200
|
+
const row = byUrn2.get(kind.ref);
|
|
3161
3201
|
const person = row === void 0 ? void 0 : toRow(row);
|
|
3162
3202
|
if (person === void 0) unresolved++;
|
|
3163
3203
|
else if (!people.some((p) => p.id === person.id)) people.push(person);
|
|
@@ -3237,11 +3277,11 @@ function parseOrgHits(json) {
|
|
|
3237
3277
|
const c = clustersOf(json);
|
|
3238
3278
|
if (c === void 0) return drift3("the organisation search returned no result list");
|
|
3239
3279
|
const included = json.included ?? [];
|
|
3240
|
-
const
|
|
3280
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
3241
3281
|
const hits = [];
|
|
3242
3282
|
for (const el of c.elements ?? []) {
|
|
3243
3283
|
for (const { item } of el.items ?? []) {
|
|
3244
|
-
const row =
|
|
3284
|
+
const row = byUrn2.get(item?.["*entityResult"]);
|
|
3245
3285
|
const id = String(row?.entityUrn ?? "").match(/urn:li:fsd_company:(\d+)/)?.[1];
|
|
3246
3286
|
const name = text3(row?.title);
|
|
3247
3287
|
if (id !== void 0 && name !== void 0 && !hits.some((h) => h.id === id))
|
|
@@ -3648,13 +3688,13 @@ function compactPost(p) {
|
|
|
3648
3688
|
p.comments !== void 0 ? `${p.comments} comments` : void 0,
|
|
3649
3689
|
p.reposts !== void 0 ? `${p.reposts} reposts` : void 0
|
|
3650
3690
|
].filter(Boolean);
|
|
3651
|
-
const
|
|
3691
|
+
const text7 = p.text?.replace(/\s+/g, " ");
|
|
3652
3692
|
return line([
|
|
3653
3693
|
p.id,
|
|
3654
3694
|
p.author,
|
|
3655
3695
|
p.posted,
|
|
3656
3696
|
counts2.length > 0 ? counts2.join(" \xB7 ") : void 0,
|
|
3657
|
-
|
|
3697
|
+
text7 !== void 0 && text7.length > 160 ? `${text7.slice(0, 157)}\u2026` : text7,
|
|
3658
3698
|
p.url,
|
|
3659
3699
|
p.matched !== void 0 ? `matched: ${p.matched.join(" + ")}` : void 0
|
|
3660
3700
|
]);
|
|
@@ -3975,7 +4015,7 @@ async function fetchCommentMenu(ref, trackingId, client) {
|
|
|
3975
4015
|
const stream = result.classification.raw ?? "";
|
|
3976
4016
|
return { ok: true, stream };
|
|
3977
4017
|
}
|
|
3978
|
-
function textStates(payload,
|
|
4018
|
+
function textStates(payload, text7) {
|
|
3979
4019
|
const keyOf = (...names) => {
|
|
3980
4020
|
for (const n of names) {
|
|
3981
4021
|
const slot = payload[n];
|
|
@@ -3994,12 +4034,12 @@ function textStates(payload, text6) {
|
|
|
3994
4034
|
protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: key } }
|
|
3995
4035
|
});
|
|
3996
4036
|
return [
|
|
3997
|
-
entry3(plain2,
|
|
3998
|
-
entry3(rich, { text:
|
|
4037
|
+
entry3(plain2, text7, "stringValue"),
|
|
4038
|
+
entry3(rich, { text: text7, attribute: [], $type: "TextModel", source: "local" }, "textModelForWrite")
|
|
3999
4039
|
];
|
|
4000
4040
|
}
|
|
4001
|
-
function editStates(payload,
|
|
4002
|
-
return textStates(payload,
|
|
4041
|
+
function editStates(payload, text7) {
|
|
4042
|
+
return textStates(payload, text7);
|
|
4003
4043
|
}
|
|
4004
4044
|
async function runCommentAction(ref, operation, trackingId, client, newText) {
|
|
4005
4045
|
const menu = await fetchCommentMenu(ref, trackingId, client);
|
|
@@ -4252,12 +4292,12 @@ var CATEGORY = {
|
|
|
4252
4292
|
VIDEO: "VIDEO",
|
|
4253
4293
|
DOCUMENT: "NATIVE_DOCUMENT"
|
|
4254
4294
|
};
|
|
4255
|
-
function sharePayload(
|
|
4295
|
+
function sharePayload(text7, visibility, media = [], scheduledAt) {
|
|
4256
4296
|
const schedule = scheduledAt === void 0 ? { postState: "PUBLISHED" } : { postState: "SCHEDULED", scheduledAt };
|
|
4257
4297
|
return {
|
|
4258
4298
|
visibleToConnectionsOnly: visibility === "CONNECTIONS",
|
|
4259
4299
|
externalAudienceProviders: [],
|
|
4260
|
-
commentaryV2: { text:
|
|
4300
|
+
commentaryV2: { text: text7, attributes: [] },
|
|
4261
4301
|
origin: "FEED",
|
|
4262
4302
|
allowedCommentersScope: "ALL",
|
|
4263
4303
|
...schedule,
|
|
@@ -4371,15 +4411,15 @@ async function share(confirmed, client, bytes) {
|
|
|
4371
4411
|
note: "LinkedIn accepted the post but the response carried no recognisable urn. Run `lnrelay sync my-posts && lnrelay my-posts` to confirm what actually landed \u2014 and do NOT re-run this command on the assumption it failed, or you will post twice."
|
|
4372
4412
|
} : { ok: true, id };
|
|
4373
4413
|
}
|
|
4374
|
-
function editPostBody(
|
|
4375
|
-
return { patch: { $set: { commentaryV2: { text:
|
|
4414
|
+
function editPostBody(text7) {
|
|
4415
|
+
return { patch: { $set: { commentaryV2: { text: text7, attributes: [] } } } };
|
|
4376
4416
|
}
|
|
4377
4417
|
async function editPost(confirmed, client) {
|
|
4378
|
-
const { urn, text:
|
|
4418
|
+
const { urn, text: text7 } = confirmed.payload;
|
|
4379
4419
|
const result = await client.request({
|
|
4380
4420
|
url: deleteUrl(urn),
|
|
4381
4421
|
method: "POST",
|
|
4382
|
-
body: editPostBody(
|
|
4422
|
+
body: editPostBody(text7),
|
|
4383
4423
|
spendClass: "write",
|
|
4384
4424
|
operation: "edit-post"
|
|
4385
4425
|
});
|
|
@@ -4389,7 +4429,7 @@ async function editPost(confirmed, client) {
|
|
|
4389
4429
|
return out;
|
|
4390
4430
|
}
|
|
4391
4431
|
const held = result.json?.data?.commentary?.text;
|
|
4392
|
-
if (held !==
|
|
4432
|
+
if (held !== text7) {
|
|
4393
4433
|
return {
|
|
4394
4434
|
ok: false,
|
|
4395
4435
|
code: "SCHEMA_DRIFT",
|
|
@@ -4450,8 +4490,8 @@ async function createPoll(poll, client) {
|
|
|
4450
4490
|
}
|
|
4451
4491
|
return { ok: true, urn };
|
|
4452
4492
|
}
|
|
4453
|
-
function firstUrl(
|
|
4454
|
-
const found =
|
|
4493
|
+
function firstUrl(text7) {
|
|
4494
|
+
const found = text7.match(/https?:\/\/[^\s<>"]+/)?.[0];
|
|
4455
4495
|
if (found === void 0) return null;
|
|
4456
4496
|
let url = found.replace(/[.,;:!?'"]+$/, "");
|
|
4457
4497
|
if (url.endsWith(")") && !url.includes("(")) url = url.slice(0, -1);
|
|
@@ -4615,8 +4655,8 @@ function previewLines2(post) {
|
|
|
4615
4655
|
" about to delete, or that it is yours."
|
|
4616
4656
|
];
|
|
4617
4657
|
}
|
|
4618
|
-
const
|
|
4619
|
-
const shown =
|
|
4658
|
+
const text7 = typeof post.text === "string" ? post.text : "(no text \u2014 media-only post?)";
|
|
4659
|
+
const shown = text7.length > PREVIEW_CHARS ? `${text7.slice(0, PREVIEW_CHARS)}\u2026` : text7;
|
|
4620
4660
|
const lines = [`content "${shown.replace(/\n/g, " ")}"`];
|
|
4621
4661
|
if (typeof post.scheduledAt === "string") {
|
|
4622
4662
|
lines.push(`status scheduled, publishes ${post.scheduledAt} unless cancelled`);
|
|
@@ -4867,14 +4907,14 @@ var txt = (v) => {
|
|
|
4867
4907
|
if (t !== null && typeof t === "object") return txt(t);
|
|
4868
4908
|
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
4869
4909
|
};
|
|
4870
|
-
function organizerOf(e,
|
|
4910
|
+
function organizerOf(e, byUrn2) {
|
|
4871
4911
|
const o = e.organizer ?? {};
|
|
4872
|
-
const company =
|
|
4912
|
+
const company = byUrn2.get(o["*organizingCompanyUrn"]);
|
|
4873
4913
|
if (typeof company?.name === "string") {
|
|
4874
4914
|
const id = String(company.entityUrn).split(":").pop();
|
|
4875
4915
|
return { name: company.name, kind: "company", url: `https://www.linkedin.com/company/${id}/` };
|
|
4876
4916
|
}
|
|
4877
|
-
const person =
|
|
4917
|
+
const person = byUrn2.get(o["*organizingProfileUrn"] ?? o.organizingProfileUrn);
|
|
4878
4918
|
const name = [person?.firstName, person?.lastName].filter((x) => typeof x === "string").join(" ");
|
|
4879
4919
|
if (name !== "") {
|
|
4880
4920
|
const vanity = person?.publicIdentifier;
|
|
@@ -4898,11 +4938,11 @@ function parseEvent(json) {
|
|
|
4898
4938
|
hint: "re-capture the event page"
|
|
4899
4939
|
};
|
|
4900
4940
|
}
|
|
4901
|
-
const
|
|
4941
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
4902
4942
|
const range2 = e.timeRange ?? {};
|
|
4903
4943
|
const address2 = e.address ?? null;
|
|
4904
4944
|
const place = address2 === null ? void 0 : [address2.city, address2.geographicArea, address2.country].filter((x) => typeof x === "string" && x !== "").join(", ");
|
|
4905
|
-
const status =
|
|
4945
|
+
const status = byUrn2.get(e["*viewerStatus"])?.scheduledContentViewerStatus;
|
|
4906
4946
|
const attendees = Number(
|
|
4907
4947
|
txt(e.socialProof)?.match(/^(\d[\d,.\s]*)/)?.[1]?.replace(/[,.\s]/g, "")
|
|
4908
4948
|
);
|
|
@@ -4925,7 +4965,7 @@ function parseEvent(json) {
|
|
|
4925
4965
|
set("state", typeof e.lifecycleState === "string" ? e.lifecycleState : void 0);
|
|
4926
4966
|
if (e.cancelled === true) out.cancelled = true;
|
|
4927
4967
|
set("attendees", Number.isFinite(attendees) ? attendees : void 0);
|
|
4928
|
-
set("organizer", organizerOf(e,
|
|
4968
|
+
set("organizer", organizerOf(e, byUrn2));
|
|
4929
4969
|
set("place", place);
|
|
4930
4970
|
set("site", typeof e.externalUrl === "string" ? e.externalUrl : void 0);
|
|
4931
4971
|
if (e.privateEvent === true) out.private = true;
|
|
@@ -5033,16 +5073,327 @@ async function runEvent(inputs, opts = {}, fetch2) {
|
|
|
5033
5073
|
});
|
|
5034
5074
|
}
|
|
5035
5075
|
|
|
5076
|
+
// src/engine/job-premium.ts
|
|
5077
|
+
function graphql(name) {
|
|
5078
|
+
const c = CONTRACTS[name];
|
|
5079
|
+
if (c?.queryId === void 0) throw new Error(`job contract '${name}' is missing`);
|
|
5080
|
+
return { path: c.path, queryId: c.queryId };
|
|
5081
|
+
}
|
|
5082
|
+
var COLLECTION_PAGE = 100;
|
|
5083
|
+
function jobCollectionUrl(slug, start, count3) {
|
|
5084
|
+
const c = graphql("jobCollection");
|
|
5085
|
+
const variables = `(count:${count3},jobCollectionSlug:${slug},query:(origin:GENERIC_JOB_COLLECTIONS_LANDING),start:${start})`;
|
|
5086
|
+
return `${c.path}?variables=${variables}&queryId=${c.queryId}`;
|
|
5087
|
+
}
|
|
5088
|
+
function jobInsightsUrl(id) {
|
|
5089
|
+
const c = graphql("jobDetailSections");
|
|
5090
|
+
const urn = encodeURIComponent(`urn:li:fsd_jobPosting:${id}`);
|
|
5091
|
+
const variables = `(cardSectionTypes:List(JOB_APPLICANT_INSIGHTS,COMPANY_INSIGHTS_CARD),jobPostingUrn:${urn},includeSecondaryActionsV2:true)`;
|
|
5092
|
+
return `${c.path}?includeWebMetadata=true&variables=${variables}&queryId=${c.queryId}`;
|
|
5093
|
+
}
|
|
5094
|
+
var drift5 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
5095
|
+
var text4 = (v) => {
|
|
5096
|
+
const t = v?.text;
|
|
5097
|
+
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
5098
|
+
};
|
|
5099
|
+
var nodes = (v) => Array.isArray(v) ? v : [];
|
|
5100
|
+
function defined5(obj) {
|
|
5101
|
+
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
5102
|
+
return obj;
|
|
5103
|
+
}
|
|
5104
|
+
function parseJobCollection(json) {
|
|
5105
|
+
const root = json;
|
|
5106
|
+
const collection2 = root?.data?.data?.jobsDashJobCardsByJobCollections;
|
|
5107
|
+
if (collection2 === void 0 || collection2 === null) {
|
|
5108
|
+
const why = nodes(root?.data?.errors)[0]?.message;
|
|
5109
|
+
return drift5(`the job collection was not served${typeof why === "string" ? `: ${why}` : ""}`);
|
|
5110
|
+
}
|
|
5111
|
+
return parseJobCards({ data: collection2, included: root?.included ?? [] });
|
|
5112
|
+
}
|
|
5113
|
+
function byUrn(included) {
|
|
5114
|
+
const map = /* @__PURE__ */ new Map();
|
|
5115
|
+
for (const n of included) if (typeof n.entityUrn === "string") map.set(n.entityUrn, n);
|
|
5116
|
+
return map;
|
|
5117
|
+
}
|
|
5118
|
+
var nameOf = (urns2, urn) => {
|
|
5119
|
+
const n = typeof urn === "string" ? urns2.get(urn)?.name : void 0;
|
|
5120
|
+
return typeof n === "string" ? n : void 0;
|
|
5121
|
+
};
|
|
5122
|
+
function applicantsOf(a, urns2) {
|
|
5123
|
+
const seniority = nodes(a.seniorityDetails).flatMap((s) => {
|
|
5124
|
+
const level = nameOf(urns2, s["*seniority"]);
|
|
5125
|
+
return level === void 0 || typeof s.percentage !== "number" ? [] : [defined5({ level, share: s.percentage, count: s.count })];
|
|
5126
|
+
});
|
|
5127
|
+
const education = nodes(a.degreeDetails).flatMap((d) => {
|
|
5128
|
+
const degree = nameOf(urns2, d["*degree"]);
|
|
5129
|
+
return degree === void 0 || typeof d.percentage !== "number" ? [] : [{ degree, share: d.percentage }];
|
|
5130
|
+
});
|
|
5131
|
+
const skills = nodes(a.skillDetails);
|
|
5132
|
+
const locations = nodes(a.locationDetails);
|
|
5133
|
+
return defined5({
|
|
5134
|
+
total: a.applicantCount,
|
|
5135
|
+
lastDay: typeof a.applicantsInPastDay === "number" ? a.applicantsInPastDay : void 0,
|
|
5136
|
+
seniority: seniority.length > 0 ? seniority : void 0,
|
|
5137
|
+
education: education.length > 0 ? education : void 0,
|
|
5138
|
+
rankPercentile: typeof a.applicantRankPercentile === "number" ? a.applicantRankPercentile : void 0,
|
|
5139
|
+
skills: skills.length > 0 ? skills : void 0,
|
|
5140
|
+
locations: locations.length > 0 ? locations : void 0
|
|
5141
|
+
});
|
|
5142
|
+
}
|
|
5143
|
+
function headcountOf(growth) {
|
|
5144
|
+
const months = nodes(growth?.headcountGrowth).flatMap((m) => {
|
|
5145
|
+
const on = m.startedOn;
|
|
5146
|
+
return typeof m.employeeCount === "number" && on?.year !== void 0 && on.month !== void 0 ? [{ month: `${on.year}-${String(on.month).padStart(2, "0")}`, count: m.employeeCount }] : [];
|
|
5147
|
+
});
|
|
5148
|
+
const latest = months[0];
|
|
5149
|
+
if (latest === void 0) return void 0;
|
|
5150
|
+
const back = (n) => months[n]?.count;
|
|
5151
|
+
const yearAgo = back(12);
|
|
5152
|
+
return defined5({
|
|
5153
|
+
asOf: latest.month,
|
|
5154
|
+
now: latest.count,
|
|
5155
|
+
sixMonthsAgo: back(6),
|
|
5156
|
+
yearAgo,
|
|
5157
|
+
twoYearsAgo: back(24),
|
|
5158
|
+
growth1y: yearAgo !== void 0 && yearAgo > 0 ? Math.round((latest.count - yearAgo) / yearAgo * 1e3) / 10 : void 0
|
|
5159
|
+
});
|
|
5160
|
+
}
|
|
5161
|
+
var str4 = (v) => typeof v === "string" ? v : void 0;
|
|
5162
|
+
function trendOf(s, urns2) {
|
|
5163
|
+
const company = urns2.get(String(s["*company"]));
|
|
5164
|
+
const fn = str4(s.formattedJobFunction);
|
|
5165
|
+
return defined5({
|
|
5166
|
+
name: str4(company?.name),
|
|
5167
|
+
url: str4(company?.url),
|
|
5168
|
+
headcount: headcountOf(s.employeeGrowth),
|
|
5169
|
+
function: fn !== void 0 ? { name: fn, ...headcountOf(s.employeeGrowthForFunction) } : void 0,
|
|
5170
|
+
medianTenure: text4(s.employeeGrowth?.medianTenureYears)
|
|
5171
|
+
});
|
|
5172
|
+
}
|
|
5173
|
+
function landscapeOf(s) {
|
|
5174
|
+
const competitors = nodes(s.competitors).flatMap((c) => {
|
|
5175
|
+
const name = text4(c.title);
|
|
5176
|
+
return name === void 0 ? [] : [defined5({ name, industry: text4(c.subtitle), url: str4(c.navigationUrl) })];
|
|
5177
|
+
});
|
|
5178
|
+
return defined5({
|
|
5179
|
+
landscape: text4(s.aiqInsightsText),
|
|
5180
|
+
competitors: competitors.length > 0 ? competitors : void 0
|
|
5181
|
+
});
|
|
5182
|
+
}
|
|
5183
|
+
var SECTIONS = {
|
|
5184
|
+
jobPostingCompanyInsights: trendOf,
|
|
5185
|
+
headcountAIQInsights: (s) => defined5({ hiring: text4(s.aiqInsightsText) }),
|
|
5186
|
+
strategicPrioritiesAIQInsights: (s) => defined5({ priorities: text4(s.insightsText) }),
|
|
5187
|
+
competitiveLandscapeAIQInsights: landscapeOf
|
|
5188
|
+
};
|
|
5189
|
+
function companyOf(card2, urns2, unknown) {
|
|
5190
|
+
const out = {};
|
|
5191
|
+
for (const el of nodes(card2.elements)) {
|
|
5192
|
+
for (const [kind, section] of Object.entries(el.companyInsights ?? {})) {
|
|
5193
|
+
if (section === null || kind.startsWith("$")) continue;
|
|
5194
|
+
const read = SECTIONS[kind];
|
|
5195
|
+
if (read === void 0) unknown[kind] = (unknown[kind] ?? 0) + 1;
|
|
5196
|
+
else Object.assign(out, read(section, urns2));
|
|
5197
|
+
}
|
|
5198
|
+
}
|
|
5199
|
+
return out;
|
|
5200
|
+
}
|
|
5201
|
+
function parseJobInsights(json) {
|
|
5202
|
+
const root = json;
|
|
5203
|
+
const sections = root?.data?.data?.jobsDashJobPostingDetailSectionsByCardSectionTypes;
|
|
5204
|
+
if (sections === void 0 || sections === null || !Array.isArray(sections.elements))
|
|
5205
|
+
return drift5("the job detail sections were not in the answer");
|
|
5206
|
+
const urns2 = byUrn(root?.included ?? []);
|
|
5207
|
+
const unknownSections = {};
|
|
5208
|
+
let applicants;
|
|
5209
|
+
let company;
|
|
5210
|
+
for (const el of nodes(sections.elements)) {
|
|
5211
|
+
for (const part2 of nodes(el.jobPostingDetailSection)) {
|
|
5212
|
+
const a = urns2.get(String(part2["*jobApplicantInsightsUrn"]));
|
|
5213
|
+
if (a !== void 0 && typeof a.applicantCount === "number")
|
|
5214
|
+
applicants = applicantsOf(a, urns2);
|
|
5215
|
+
const posting = urns2.get(String(part2["*companyInsightsCard"]));
|
|
5216
|
+
const card2 = posting?.companyInsightsCard;
|
|
5217
|
+
if (card2 !== void 0 && card2 !== null) company = companyOf(card2, urns2, unknownSections);
|
|
5218
|
+
}
|
|
5219
|
+
}
|
|
5220
|
+
return {
|
|
5221
|
+
ok: true,
|
|
5222
|
+
...applicants !== void 0 ? { applicants } : {},
|
|
5223
|
+
...company !== void 0 && Object.keys(company).length > 0 ? { company } : {},
|
|
5224
|
+
unknownSections
|
|
5225
|
+
};
|
|
5226
|
+
}
|
|
5227
|
+
var HEAR_BACK_PAGE = 25;
|
|
5228
|
+
var SEARCH_RESULTS = "https://www.linkedin.com/flagship-web/jobs/search-results/";
|
|
5229
|
+
var HEAR_BACK_HEADERS = {
|
|
5230
|
+
"x-li-rsc-stream": "true",
|
|
5231
|
+
referer: "https://www.linkedin.com/jobs/"
|
|
5232
|
+
};
|
|
5233
|
+
function hearBackUrl(start) {
|
|
5234
|
+
return `${SEARCH_RESULTS}?showHowYouFit=HOW_YOU_FIT&origin=QUALIFICATION_LANDING&start=${start}`;
|
|
5235
|
+
}
|
|
5236
|
+
function hearBackBody() {
|
|
5237
|
+
return {
|
|
5238
|
+
requestedArguments: {
|
|
5239
|
+
payload: {
|
|
5240
|
+
showHowYouFit: "HOW_YOU_FIT",
|
|
5241
|
+
shouldHideLoadingSpinner: true,
|
|
5242
|
+
origin: "JobSearchOrigin_QUALIFICATION_LANDING"
|
|
5243
|
+
},
|
|
5244
|
+
states: [],
|
|
5245
|
+
requestMetadata: { $type: "proto.sdui.common.RequestMetadata" },
|
|
5246
|
+
screenId: "com.linkedin.sdui.flagshipnav.jobs.SemanticJobDetails",
|
|
5247
|
+
knownTemplateIds: []
|
|
5248
|
+
}
|
|
5249
|
+
};
|
|
5250
|
+
}
|
|
5251
|
+
function parseJobIds(stream) {
|
|
5252
|
+
if (/^\s*</.test(stream)) return drift5("LinkedIn answered the page, not its data");
|
|
5253
|
+
const ids = [...stream.matchAll(/job-card-component-ref-(\d+)/g)].map((m) => m[1]);
|
|
5254
|
+
return { ok: true, ids: [...new Set(ids)] };
|
|
5255
|
+
}
|
|
5256
|
+
var HOW_YOU_FIT = "com.linkedin.sdui.generated.jobseeker.dsl.impl.howYouFitGuide";
|
|
5257
|
+
var HOW_YOU_FIT_URL = `https://www.linkedin.com/flagship-web/rsc-action/actions/component?componentId=${HOW_YOU_FIT}&sduiid=${HOW_YOU_FIT}`;
|
|
5258
|
+
function howYouFitBody(jobId) {
|
|
5259
|
+
const key = `jdpApplyState_${jobId}`;
|
|
5260
|
+
return {
|
|
5261
|
+
componentId: HOW_YOU_FIT,
|
|
5262
|
+
clientArguments: {
|
|
5263
|
+
payload: { jobId, isPremium: true, applyState: { key, namespace: "MemoryNamespace" } },
|
|
5264
|
+
states: [
|
|
5265
|
+
{
|
|
5266
|
+
key,
|
|
5267
|
+
namespace: "MemoryNamespace",
|
|
5268
|
+
value: "Initial",
|
|
5269
|
+
originalProtoCase: "stringValue",
|
|
5270
|
+
protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: key } }
|
|
5271
|
+
}
|
|
5272
|
+
],
|
|
5273
|
+
requestMetadata: { $type: "proto.sdui.common.RequestMetadata" },
|
|
5274
|
+
screenId: "com.linkedin.sdui.flagshipnav.jobs.SemanticJobDetails",
|
|
5275
|
+
knownTemplateIds: []
|
|
5276
|
+
}
|
|
5277
|
+
};
|
|
5278
|
+
}
|
|
5279
|
+
var FIT = "JobSeekerAgentIntent_JOB_FIT_EXPLANATION";
|
|
5280
|
+
function parseMatchLink(stream, jobId) {
|
|
5281
|
+
for (const m of stream.matchAll(/"url":"(\/preload\/guideOverlay\/\?[^"]*)"/g)) {
|
|
5282
|
+
const q2 = new URL(`https://www.linkedin.com${m[1]}`).searchParams;
|
|
5283
|
+
const customContext = (q2.get("customContext") ?? "").split(",").flatMap((pair) => {
|
|
5284
|
+
const at = pair.indexOf("~:");
|
|
5285
|
+
return at === -1 ? [] : [{ key: pair.slice(0, at), value: pair.slice(at + 2) }];
|
|
5286
|
+
});
|
|
5287
|
+
const sub = customContext.find((c) => c.key === "subIntent")?.value;
|
|
5288
|
+
const job = customContext.find((c) => c.key === "jobPostingId")?.value;
|
|
5289
|
+
const query = q2.get("query");
|
|
5290
|
+
const mailbox2 = q2.get("originalThreadMailbox");
|
|
5291
|
+
if (sub !== FIT || job !== jobId || query === null || mailbox2 === null) continue;
|
|
5292
|
+
return {
|
|
5293
|
+
ok: true,
|
|
5294
|
+
link: {
|
|
5295
|
+
query,
|
|
5296
|
+
intent: q2.get("intent") ?? "GuideIntent_JOB_SEEKING_AGENT",
|
|
5297
|
+
mailbox: mailbox2,
|
|
5298
|
+
contextUrns: (q2.get("contextUrns") ?? "").split(",").filter((u) => u !== ""),
|
|
5299
|
+
customContext
|
|
5300
|
+
}
|
|
5301
|
+
};
|
|
5302
|
+
}
|
|
5303
|
+
return {
|
|
5304
|
+
ok: false,
|
|
5305
|
+
code: "NOT_FOUND",
|
|
5306
|
+
message: "the job offers no match details (Premium only, and not on every job)"
|
|
5307
|
+
};
|
|
5308
|
+
}
|
|
5309
|
+
var randomId = () => String.fromCharCode(...crypto.getRandomValues(new Uint8Array(16)));
|
|
5310
|
+
function matchMessageUrl() {
|
|
5311
|
+
const c = graphql("guideMessage");
|
|
5312
|
+
return `${c.path}?action=execute&queryId=${c.queryId}`;
|
|
5313
|
+
}
|
|
5314
|
+
function matchMessageBody(link, jobId, ids = { interaction: randomId(), session: randomId() }) {
|
|
5315
|
+
const c = graphql("guideMessage");
|
|
5316
|
+
return {
|
|
5317
|
+
variables: {
|
|
5318
|
+
guideInteractionId: ids.interaction,
|
|
5319
|
+
guideQueryContext: {
|
|
5320
|
+
customContext: link.customContext,
|
|
5321
|
+
intent: link.intent,
|
|
5322
|
+
pageContext: {
|
|
5323
|
+
origin: "",
|
|
5324
|
+
companyUrns: null,
|
|
5325
|
+
profileUrns: null,
|
|
5326
|
+
jobPostingUrns: [`urn:li:fsd_jobPosting:${jobId}`]
|
|
5327
|
+
},
|
|
5328
|
+
contextUrns: link.contextUrns,
|
|
5329
|
+
originalIntent: link.intent,
|
|
5330
|
+
originalThreadMailbox: link.mailbox,
|
|
5331
|
+
isZeroState: false
|
|
5332
|
+
},
|
|
5333
|
+
guideSessionId: ids.session,
|
|
5334
|
+
query: link.query
|
|
5335
|
+
},
|
|
5336
|
+
queryId: c.queryId,
|
|
5337
|
+
includeWebMetadata: true
|
|
5338
|
+
};
|
|
5339
|
+
}
|
|
5340
|
+
function parseMatchSent(json) {
|
|
5341
|
+
const root = json;
|
|
5342
|
+
const message = nodes(root?.included).find(
|
|
5343
|
+
(n) => typeof n.conversationV2Urn === "string" && n.content?.["*aiResponse"]
|
|
5344
|
+
);
|
|
5345
|
+
const conversation = message?.conversationV2Urn;
|
|
5346
|
+
const response = message?.content?.["*aiResponse"];
|
|
5347
|
+
if (typeof conversation !== "string" || typeof response !== "string") {
|
|
5348
|
+
const why = nodes(root?.data?.errors)[0]?.message;
|
|
5349
|
+
return drift5(
|
|
5350
|
+
`the assistant did not take the question${typeof why === "string" ? `: ${why}` : ""}`
|
|
5351
|
+
);
|
|
5352
|
+
}
|
|
5353
|
+
return { ok: true, conversation, response };
|
|
5354
|
+
}
|
|
5355
|
+
function matchAnswerUrl(conversation) {
|
|
5356
|
+
const c = graphql("guideMessages");
|
|
5357
|
+
const urn = encodeURIComponent(conversation);
|
|
5358
|
+
return `${c.path}?includeWebMetadata=true&variables=(guideConversationV2Urn:${urn},syncToken:null)&queryId=${c.queryId}`;
|
|
5359
|
+
}
|
|
5360
|
+
function matchOf(t) {
|
|
5361
|
+
const spans = (style) => (t.attributesV2 ?? []).filter((a) => a.detailData?.style === style).map((a) => t.text.slice(a.start ?? 0, (a.start ?? 0) + (a.length ?? 0)).trim());
|
|
5362
|
+
const first = (t.attributesV2 ?? [])[0];
|
|
5363
|
+
const lines = spans("PARAGRAPH").filter((l) => l !== "");
|
|
5364
|
+
const marked = (mark) => lines.filter((l) => l.startsWith(mark)).map((l) => l.slice(mark.length).trim());
|
|
5365
|
+
return defined5({
|
|
5366
|
+
summary: first?.detailData?.style === "BOLD" && first.start === 0 ? spans("BOLD")[0] : void 0,
|
|
5367
|
+
met: marked("\u2713"),
|
|
5368
|
+
missing: marked("?"),
|
|
5369
|
+
text: lines.join("\n")
|
|
5370
|
+
});
|
|
5371
|
+
}
|
|
5372
|
+
function parseMatchAnswer(json, response) {
|
|
5373
|
+
const root = json;
|
|
5374
|
+
if (!Array.isArray(root?.included)) return drift5("the conversation came back without messages");
|
|
5375
|
+
const answer = root.included.find((n) => n.entityUrn === response);
|
|
5376
|
+
const streaming = answer?.responseV2?.streamingResponse ?? {};
|
|
5377
|
+
if (typeof streaming.finalComponentPosition !== "number") return { ok: true, done: false };
|
|
5378
|
+
for (const part2 of nodes(streaming.responseComponent)) {
|
|
5379
|
+
const t = part2.component?.aiResponse?.text;
|
|
5380
|
+
if (typeof t?.text === "string")
|
|
5381
|
+
return { ok: true, done: true, match: matchOf(t) };
|
|
5382
|
+
}
|
|
5383
|
+
return drift5("the assistant finished without a written answer");
|
|
5384
|
+
}
|
|
5385
|
+
|
|
5036
5386
|
// src/commands/jobs.ts
|
|
5037
5387
|
function liveFetch5(command, quiet) {
|
|
5038
5388
|
const session = loadSession();
|
|
5039
5389
|
if (session.state !== "ok")
|
|
5040
5390
|
return err(command, "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
|
|
5041
5391
|
const client = createLiveClient(session.session, void 0, quiet);
|
|
5042
|
-
return async (url, spendClass, body) => {
|
|
5392
|
+
return async (url, spendClass, body, headers2) => {
|
|
5043
5393
|
const r = await client.request({
|
|
5044
5394
|
url,
|
|
5045
5395
|
...body !== void 0 ? { method: "POST", body } : {},
|
|
5396
|
+
...headers2 !== void 0 ? { headers: headers2 } : {},
|
|
5046
5397
|
spendClass,
|
|
5047
5398
|
operation: command
|
|
5048
5399
|
});
|
|
@@ -5109,6 +5460,11 @@ async function addDetails(get, rows, withDescription) {
|
|
|
5109
5460
|
return read.stoppedBy === void 0 ? { unread } : { unread, stoppedBy: read.stoppedBy };
|
|
5110
5461
|
}
|
|
5111
5462
|
async function runJobs(req, opts = {}, fetch2) {
|
|
5463
|
+
if (req.collection !== void 0) {
|
|
5464
|
+
const misuse = collectionMisuse(req, req.collection);
|
|
5465
|
+
if (misuse !== null) return misuse;
|
|
5466
|
+
return req.collection === "hear-back" ? runHearBack(req, opts, fetch2) : runCollection(req, req.collection, opts, fetch2);
|
|
5467
|
+
}
|
|
5112
5468
|
const sets = keywordSets(req.keywords);
|
|
5113
5469
|
const hasQuery = sets.length > 0 || [req.location, req.geoId].some((v) => v !== void 0 && v !== "");
|
|
5114
5470
|
if (!hasQuery) {
|
|
@@ -5175,6 +5531,144 @@ async function runJobs(req, opts = {}, fetch2) {
|
|
|
5175
5531
|
meta
|
|
5176
5532
|
});
|
|
5177
5533
|
}
|
|
5534
|
+
function collectionMisuse(req, collection2) {
|
|
5535
|
+
const searched = keywordSets(req.keywords).length > 0 || req.location || req.geoId;
|
|
5536
|
+
const selection3 = jobFilterSelection(req.filter ?? {});
|
|
5537
|
+
const filtered = !selection3.ok || Object.keys(selection3.filters).length > 0;
|
|
5538
|
+
return searched || filtered ? err(
|
|
5539
|
+
"jobs",
|
|
5540
|
+
"INVALID_INPUT",
|
|
5541
|
+
`--${collection2} is LinkedIn's own list: it takes no keywords, location or filters`
|
|
5542
|
+
) : null;
|
|
5543
|
+
}
|
|
5544
|
+
async function hearBackIds(get, upTo) {
|
|
5545
|
+
const ids = [];
|
|
5546
|
+
for (let start = 0; start < PAGING3.max; start += HEAR_BACK_PAGE) {
|
|
5547
|
+
const res = await get(hearBackUrl(start), "jobSearch", hearBackBody(), {
|
|
5548
|
+
...HEAR_BACK_HEADERS
|
|
5549
|
+
});
|
|
5550
|
+
const page = res.ok ? parseJobIds(res.raw ?? "") : res;
|
|
5551
|
+
if (!page.ok) return { ids, ended: false, failure: page };
|
|
5552
|
+
const fresh = page.ids.filter((id) => !ids.includes(id));
|
|
5553
|
+
ids.push(...fresh);
|
|
5554
|
+
if (page.ids.length < HEAR_BACK_PAGE || fresh.length === 0) return { ids, ended: true };
|
|
5555
|
+
if (ids.length >= upTo) return { ids, ended: false };
|
|
5556
|
+
}
|
|
5557
|
+
return { ids, ended: false };
|
|
5558
|
+
}
|
|
5559
|
+
async function runHearBack(req, opts, fetch2) {
|
|
5560
|
+
const get = fetch2 ?? liveFetch5("jobs", opts.quiet === true);
|
|
5561
|
+
if (typeof get !== "function") return get;
|
|
5562
|
+
const first = Math.max(0, req.start ?? 0);
|
|
5563
|
+
const want = Math.max(1, Math.min(req.limit, PAGING3.max - first));
|
|
5564
|
+
const listed2 = await hearBackIds(get, first + want);
|
|
5565
|
+
if (listed2.ids.length === 0 && listed2.failure !== void 0) {
|
|
5566
|
+
const f = listed2.failure;
|
|
5567
|
+
return err("jobs", f.code, f.message, f.hint);
|
|
5568
|
+
}
|
|
5569
|
+
const slice = listed2.ids.slice(first, first + want);
|
|
5570
|
+
const read = await readJobs(get, slice);
|
|
5571
|
+
const rows = slice.flatMap((id) => read.jobs.get(id) ?? []);
|
|
5572
|
+
const unread = slice.filter((id) => !read.jobs.has(id));
|
|
5573
|
+
const whole = listed2.ended && first + want >= listed2.ids.length;
|
|
5574
|
+
return ok("jobs", {
|
|
5575
|
+
collection: "hear-back",
|
|
5576
|
+
items: shape2(
|
|
5577
|
+
rows,
|
|
5578
|
+
opts,
|
|
5579
|
+
(j) => compactJob({ ...j, easyApply: j.apply?.type === "easy-apply", promoted: false })
|
|
5580
|
+
),
|
|
5581
|
+
meta: {
|
|
5582
|
+
state: whole && unread.length === 0 ? "complete" : "partial",
|
|
5583
|
+
operation: "jobs",
|
|
5584
|
+
...listed2.ended ? { claimedCount: listed2.ids.length } : {},
|
|
5585
|
+
returnedCount: rows.length,
|
|
5586
|
+
start: first,
|
|
5587
|
+
...unread.length > 0 ? { unread } : {},
|
|
5588
|
+
...listed2.failure !== void 0 ? { stoppedBy: listed2.failure.code } : {},
|
|
5589
|
+
...read.stoppedBy !== void 0 ? { readStop: read.stoppedBy } : {}
|
|
5590
|
+
}
|
|
5591
|
+
});
|
|
5592
|
+
}
|
|
5593
|
+
async function runCollection(req, collection2, opts, fetch2) {
|
|
5594
|
+
const get = fetch2 ?? liveFetch5("jobs", opts.quiet === true);
|
|
5595
|
+
if (typeof get !== "function") return get;
|
|
5596
|
+
const first = Math.max(0, req.start ?? 0);
|
|
5597
|
+
const want = Math.max(1, Math.min(req.limit, PAGING3.max - first));
|
|
5598
|
+
const fetchPage = async (_keywords, start) => {
|
|
5599
|
+
const res = await get(jobCollectionUrl(collection2, start, COLLECTION_PAGE), "jobSearch");
|
|
5600
|
+
const page = res.ok ? parseJobCollection(res.json) : res;
|
|
5601
|
+
if (!page.ok) return page;
|
|
5602
|
+
return {
|
|
5603
|
+
ok: true,
|
|
5604
|
+
items: page.jobs,
|
|
5605
|
+
...page.total !== void 0 ? { total: page.total } : {},
|
|
5606
|
+
unknownTypes: page.unknownTypes
|
|
5607
|
+
};
|
|
5608
|
+
};
|
|
5609
|
+
const merged = await searchAll(fetchPage, [void 0], first, want, PAGING3);
|
|
5610
|
+
if (merged.rows.length === 0 && merged.failure !== void 0) {
|
|
5611
|
+
const f = merged.failure;
|
|
5612
|
+
return err("jobs", f.code, f.message, f.hint);
|
|
5613
|
+
}
|
|
5614
|
+
let extra = {};
|
|
5615
|
+
if (req.details === true) {
|
|
5616
|
+
const added = await addDetails(get, merged.rows, req.description === true);
|
|
5617
|
+
extra = {
|
|
5618
|
+
unread: added.unread,
|
|
5619
|
+
...added.stoppedBy !== void 0 ? { readStop: added.stoppedBy } : {}
|
|
5620
|
+
};
|
|
5621
|
+
}
|
|
5622
|
+
return ok("jobs", {
|
|
5623
|
+
collection: collection2,
|
|
5624
|
+
items: shape2(merged.rows, opts, compactJob),
|
|
5625
|
+
meta: metaOf("jobs", merged, true, first, { unread: 0, ...extra })
|
|
5626
|
+
});
|
|
5627
|
+
}
|
|
5628
|
+
var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
5629
|
+
var MATCH_POLLS = 8;
|
|
5630
|
+
async function matchFor(get, jobId, pollMs) {
|
|
5631
|
+
const linked = await get(HOW_YOU_FIT_URL, "page", howYouFitBody(jobId));
|
|
5632
|
+
const link = linked.ok ? parseMatchLink(linked.raw ?? "", jobId) : linked;
|
|
5633
|
+
if (!link.ok) return link;
|
|
5634
|
+
const sentRes = await get(matchMessageUrl(), "page", matchMessageBody(link.link, jobId));
|
|
5635
|
+
const sent = sentRes.ok ? parseMatchSent(sentRes.json) : sentRes;
|
|
5636
|
+
if (!sent.ok) return sent;
|
|
5637
|
+
for (let i = 0; i < MATCH_POLLS; i++) {
|
|
5638
|
+
await sleep(pollMs);
|
|
5639
|
+
const res = await get(matchAnswerUrl(sent.conversation), "page");
|
|
5640
|
+
const answer = res.ok ? parseMatchAnswer(res.json, sent.response) : res;
|
|
5641
|
+
if (!answer.ok) return answer;
|
|
5642
|
+
if (answer.done) return { ok: true, match: answer.match };
|
|
5643
|
+
}
|
|
5644
|
+
return {
|
|
5645
|
+
ok: false,
|
|
5646
|
+
code: "TIMEOUT",
|
|
5647
|
+
message: `the assistant had not finished after ${MATCH_POLLS} looks; it may still be in its history`
|
|
5648
|
+
};
|
|
5649
|
+
}
|
|
5650
|
+
async function addMatches(get, jobs, pollMs) {
|
|
5651
|
+
for (const job of jobs) {
|
|
5652
|
+
const r = await matchFor(get, job.id, pollMs);
|
|
5653
|
+
if (r.ok) job.match = r.match;
|
|
5654
|
+
else job.matchError = `${r.code}: ${r.message}`;
|
|
5655
|
+
}
|
|
5656
|
+
}
|
|
5657
|
+
async function addInsights(get, jobs) {
|
|
5658
|
+
for (const job of jobs) {
|
|
5659
|
+
const res = await get(jobInsightsUrl(job.id), "jobRead");
|
|
5660
|
+
const read = res.ok ? parseJobInsights(res.json) : res;
|
|
5661
|
+
if (!read.ok) {
|
|
5662
|
+
job.premiumError = `${read.code}: ${read.message}`;
|
|
5663
|
+
continue;
|
|
5664
|
+
}
|
|
5665
|
+
const { ok: _ok, unknownSections, ...insights } = read;
|
|
5666
|
+
job.premium = {
|
|
5667
|
+
...insights,
|
|
5668
|
+
...Object.keys(unknownSections).length > 0 ? { unknownSections } : {}
|
|
5669
|
+
};
|
|
5670
|
+
}
|
|
5671
|
+
}
|
|
5178
5672
|
async function addTeams(get, jobs) {
|
|
5179
5673
|
for (const job of jobs) {
|
|
5180
5674
|
const res = await get(HIRING_TEAM_URL, "page", hiringTeamBody(job.id));
|
|
@@ -5183,6 +5677,11 @@ async function addTeams(get, jobs) {
|
|
|
5183
5677
|
else job.hiringTeamError = `${team.code}: ${team.message}`;
|
|
5184
5678
|
}
|
|
5185
5679
|
}
|
|
5680
|
+
async function enrich(get, jobs, req) {
|
|
5681
|
+
if (req.team === true) await addTeams(get, jobs);
|
|
5682
|
+
if (req.insights === true) await addInsights(get, jobs);
|
|
5683
|
+
if (req.match === true) await addMatches(get, jobs, req.pollMs ?? 4e3);
|
|
5684
|
+
}
|
|
5186
5685
|
async function runJob(input, opts = {}, fetch2, req = {}) {
|
|
5187
5686
|
const given = input === void 0 ? [] : Array.isArray(input) ? input : [input];
|
|
5188
5687
|
const ids = [...new Set(given.map(jobIdOf))];
|
|
@@ -5203,15 +5702,16 @@ async function runJob(input, opts = {}, fetch2, req = {}) {
|
|
|
5203
5702
|
if (!res.ok) return err("job", res.code, res.message, res.hint);
|
|
5204
5703
|
const detail = parseJobDetail(res.json);
|
|
5205
5704
|
if (!detail.ok) return err("job", detail.code, detail.message, detail.hint);
|
|
5206
|
-
|
|
5207
|
-
|
|
5705
|
+
const job = detail.job;
|
|
5706
|
+
await enrich(get, [job], req);
|
|
5707
|
+
return ok("job", job);
|
|
5208
5708
|
}
|
|
5209
5709
|
const read = await readJobs(get, wanted);
|
|
5210
5710
|
if (read.jobs.size === 0 && read.stoppedBy !== void 0)
|
|
5211
5711
|
return err("job", read.stoppedBy, "no job could be read");
|
|
5212
5712
|
const unread = wanted.filter((id) => !read.jobs.has(id));
|
|
5213
5713
|
const jobs = wanted.flatMap((id) => read.jobs.get(id) ?? []);
|
|
5214
|
-
|
|
5714
|
+
await enrich(get, jobs, req);
|
|
5215
5715
|
return ok("job", {
|
|
5216
5716
|
items: shape2(
|
|
5217
5717
|
jobs,
|
|
@@ -5590,7 +6090,7 @@ var txt2 = (v) => {
|
|
|
5590
6090
|
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
5591
6091
|
};
|
|
5592
6092
|
var iso = (ms) => typeof ms === "number" ? new Date(ms).toISOString() : void 0;
|
|
5593
|
-
function
|
|
6093
|
+
function defined6(obj) {
|
|
5594
6094
|
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
5595
6095
|
return obj;
|
|
5596
6096
|
}
|
|
@@ -5600,7 +6100,7 @@ function participantOf(p) {
|
|
|
5600
6100
|
const m = t.member;
|
|
5601
6101
|
const name = [txt2(m.firstName), txt2(m.lastName)].filter(Boolean).join(" ");
|
|
5602
6102
|
const url = typeof m.profileUrl === "string" ? `${m.profileUrl.replace(/\/$/, "")}/` : void 0;
|
|
5603
|
-
return
|
|
6103
|
+
return defined6({
|
|
5604
6104
|
name: name !== "" ? name : "LinkedIn Member",
|
|
5605
6105
|
kind: "person",
|
|
5606
6106
|
headline: txt2(m.headline),
|
|
@@ -5610,7 +6110,7 @@ function participantOf(p) {
|
|
|
5610
6110
|
}
|
|
5611
6111
|
if (t.organization) {
|
|
5612
6112
|
const o = t.organization;
|
|
5613
|
-
return
|
|
6113
|
+
return defined6({
|
|
5614
6114
|
name: txt2(o.name) ?? "an organization",
|
|
5615
6115
|
kind: "organization",
|
|
5616
6116
|
url: typeof o.pageUrl === "string" ? o.pageUrl : void 0
|
|
@@ -5620,12 +6120,12 @@ function participantOf(p) {
|
|
|
5620
6120
|
return void 0;
|
|
5621
6121
|
}
|
|
5622
6122
|
var isMe = (urn, mailbox2) => typeof urn === "string" && urn.includes(mailbox2);
|
|
5623
|
-
function messageOf(m,
|
|
6123
|
+
function messageOf(m, byUrn2, mailbox2) {
|
|
5624
6124
|
const sender = m["*sender"] ?? m["*actor"];
|
|
5625
6125
|
const fromMe = isMe(sender, mailbox2);
|
|
5626
|
-
const who = fromMe ? void 0 : participantOf(
|
|
6126
|
+
const who = fromMe ? void 0 : participantOf(byUrn2.get(sender));
|
|
5627
6127
|
const render2 = Array.isArray(m.renderContent) ? m.renderContent : [];
|
|
5628
|
-
return
|
|
6128
|
+
return defined6({
|
|
5629
6129
|
from: fromMe ? "you" : who?.name ?? "unknown",
|
|
5630
6130
|
fromMe,
|
|
5631
6131
|
at: iso(m.deliveredAt),
|
|
@@ -5634,7 +6134,7 @@ function messageOf(m, byUrn, mailbox2) {
|
|
|
5634
6134
|
sponsored: render2.some((r) => r.conversationAdsMessageContent) ? true : void 0
|
|
5635
6135
|
});
|
|
5636
6136
|
}
|
|
5637
|
-
var
|
|
6137
|
+
var drift6 = (message) => ({
|
|
5638
6138
|
ok: false,
|
|
5639
6139
|
code: "SCHEMA_DRIFT",
|
|
5640
6140
|
message,
|
|
@@ -5654,26 +6154,26 @@ function refsOf(top) {
|
|
|
5654
6154
|
function parseConversations(json, mailbox2) {
|
|
5655
6155
|
const top = collectionOf(json);
|
|
5656
6156
|
const refs = refsOf(top);
|
|
5657
|
-
if (refs === void 0) return
|
|
6157
|
+
if (refs === void 0) return drift6("the conversation list was missing");
|
|
5658
6158
|
const included = json.included ?? [];
|
|
5659
|
-
const
|
|
6159
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
5660
6160
|
const conversations = [];
|
|
5661
6161
|
for (const ref of refs) {
|
|
5662
|
-
const c =
|
|
6162
|
+
const c = byUrn2.get(ref);
|
|
5663
6163
|
if (c === void 0) continue;
|
|
5664
|
-
const parts = (c["*conversationParticipants"] ?? []).filter((u) => !isMe(u, mailbox2)).map((u) => participantOf(
|
|
6164
|
+
const parts = (c["*conversationParticipants"] ?? []).filter((u) => !isMe(u, mailbox2)).map((u) => participantOf(byUrn2.get(u))).filter((p) => p !== void 0);
|
|
5665
6165
|
const lastRef = c.messages?.["*elements"]?.[0];
|
|
5666
|
-
const last = lastRef === void 0 ? void 0 :
|
|
6166
|
+
const last = lastRef === void 0 ? void 0 : byUrn2.get(lastRef);
|
|
5667
6167
|
const categories = Array.isArray(c.categories) ? c.categories : [];
|
|
5668
6168
|
conversations.push(
|
|
5669
|
-
|
|
6169
|
+
defined6({
|
|
5670
6170
|
id: String(c.entityUrn),
|
|
5671
6171
|
url: typeof c.conversationUrl === "string" ? c.conversationUrl : void 0,
|
|
5672
6172
|
with: parts,
|
|
5673
6173
|
title: c.groupChat === true ? txt2(c.title) : void 0,
|
|
5674
6174
|
unread: typeof c.unreadCount === "number" ? c.unreadCount : 0,
|
|
5675
6175
|
lastActivity: iso(c.lastActivityAt),
|
|
5676
|
-
last: last === void 0 ? void 0 : messageOf(last,
|
|
6176
|
+
last: last === void 0 ? void 0 : messageOf(last, byUrn2, mailbox2),
|
|
5677
6177
|
// PRIMARY_INBOX sits inside INBOX; report the folder a person would name.
|
|
5678
6178
|
folders: categories.map((k) => FOLDER_OF[k]).filter(
|
|
5679
6179
|
(f) => f !== void 0 && !(f === "primary" && categories.includes("INBOX"))
|
|
@@ -5683,7 +6183,7 @@ function parseConversations(json, mailbox2) {
|
|
|
5683
6183
|
);
|
|
5684
6184
|
}
|
|
5685
6185
|
if (refs.length > 0 && conversations.length === 0)
|
|
5686
|
-
return
|
|
6186
|
+
return drift6(`${refs.length} conversations were listed but none were sent`);
|
|
5687
6187
|
const cursor = top?.metadata?.nextCursor;
|
|
5688
6188
|
return {
|
|
5689
6189
|
ok: true,
|
|
@@ -5694,17 +6194,17 @@ function parseConversations(json, mailbox2) {
|
|
|
5694
6194
|
function parseMessages(json, mailbox2) {
|
|
5695
6195
|
const top = collectionOf(json);
|
|
5696
6196
|
const refs = refsOf(top);
|
|
5697
|
-
if (refs === void 0) return
|
|
6197
|
+
if (refs === void 0) return drift6("the message list was missing");
|
|
5698
6198
|
const included = json.included ?? [];
|
|
5699
|
-
const
|
|
6199
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
5700
6200
|
const messages = [];
|
|
5701
6201
|
for (const ref of refs) {
|
|
5702
|
-
const m =
|
|
6202
|
+
const m = byUrn2.get(ref);
|
|
5703
6203
|
if (m === void 0 || typeof m.deliveredAt !== "number") continue;
|
|
5704
|
-
messages.push({ id: String(m.entityUrn), ...messageOf(m,
|
|
6204
|
+
messages.push({ id: String(m.entityUrn), ...messageOf(m, byUrn2, mailbox2) });
|
|
5705
6205
|
}
|
|
5706
6206
|
if (refs.length > 0 && messages.length === 0)
|
|
5707
|
-
return
|
|
6207
|
+
return drift6(`${refs.length} messages were listed but none were sent`);
|
|
5708
6208
|
messages.sort((a, b) => a.at.localeCompare(b.at));
|
|
5709
6209
|
return { ok: true, messages };
|
|
5710
6210
|
}
|
|
@@ -5859,8 +6359,8 @@ function loadDrafts() {
|
|
|
5859
6359
|
};
|
|
5860
6360
|
return Array.isArray(loaded.value) ? loaded.value : [];
|
|
5861
6361
|
}
|
|
5862
|
-
async function runDraft(conversation,
|
|
5863
|
-
const body =
|
|
6362
|
+
async function runDraft(conversation, text7, fetch2, opts = {}) {
|
|
6363
|
+
const body = text7?.trim() ?? "";
|
|
5864
6364
|
if (body === "")
|
|
5865
6365
|
return err(
|
|
5866
6366
|
"draft",
|
|
@@ -5903,8 +6403,8 @@ async function runDraft(conversation, text6, fetch2, opts = {}) {
|
|
|
5903
6403
|
notice: "Saved on this machine only. Nothing was sent: open the link, review, and send it yourself."
|
|
5904
6404
|
});
|
|
5905
6405
|
}
|
|
5906
|
-
function draftText(
|
|
5907
|
-
return file !== void 0 ? readFileSync2(file, "utf-8") :
|
|
6406
|
+
function draftText(text7, file) {
|
|
6407
|
+
return file !== void 0 ? readFileSync2(file, "utf-8") : text7;
|
|
5908
6408
|
}
|
|
5909
6409
|
function runDrafts(opts = {}) {
|
|
5910
6410
|
const drafts = loadDrafts();
|
|
@@ -5963,14 +6463,14 @@ function itemsUrl(list2, q2) {
|
|
|
5963
6463
|
});
|
|
5964
6464
|
return `${c.path}?variables=${variables}&queryId=${c.queryId}`;
|
|
5965
6465
|
}
|
|
5966
|
-
var
|
|
6466
|
+
var text5 = (v) => {
|
|
5967
6467
|
const t = v?.text;
|
|
5968
6468
|
return typeof t === "string" && t.trim() !== "" ? t.trim().replace(/\s+/g, " ") : void 0;
|
|
5969
6469
|
};
|
|
5970
6470
|
var inner = (urn) => String(urn ?? "").match(/\((urn:li:[A-Za-z_]+:[^,)]+)/)?.[1];
|
|
5971
6471
|
var clean = (url) => typeof url === "string" && url.startsWith("https://") ? url.split("?")[0] : void 0;
|
|
5972
|
-
var insight = (row) => (Array.isArray(row.insightsResolutionResults) ? row.insightsResolutionResults : []).map((i) =>
|
|
5973
|
-
function
|
|
6472
|
+
var insight = (row) => (Array.isArray(row.insightsResolutionResults) ? row.insightsResolutionResults : []).map((i) => text5(i.simpleInsight?.title)).find((t) => t !== void 0);
|
|
6473
|
+
function defined7(obj) {
|
|
5974
6474
|
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
5975
6475
|
return obj;
|
|
5976
6476
|
}
|
|
@@ -5982,40 +6482,40 @@ var WORKPLACE = {
|
|
|
5982
6482
|
function postRow(row) {
|
|
5983
6483
|
const id = inner(row.entityUrn);
|
|
5984
6484
|
if (id === void 0 || !/^urn:li:(activity|ugcPost|share):/.test(id)) return void 0;
|
|
5985
|
-
const posted =
|
|
5986
|
-
return
|
|
6485
|
+
const posted = text5(row.secondarySubtitle)?.replace(/\s*•\s*$/, "");
|
|
6486
|
+
return defined7({
|
|
5987
6487
|
id,
|
|
5988
6488
|
url: `https://www.linkedin.com/feed/update/${id}/`,
|
|
5989
|
-
author:
|
|
5990
|
-
authorHeadline:
|
|
6489
|
+
author: text5(row.title),
|
|
6490
|
+
authorHeadline: text5(row.primarySubtitle),
|
|
5991
6491
|
posted,
|
|
5992
|
-
text:
|
|
6492
|
+
text: text5(row.summary)
|
|
5993
6493
|
});
|
|
5994
6494
|
}
|
|
5995
6495
|
function courseRow(row) {
|
|
5996
6496
|
const id = inner(row.entityUrn)?.split(":").pop();
|
|
5997
|
-
const name =
|
|
6497
|
+
const name = text5(row.title);
|
|
5998
6498
|
if (id === void 0 || name === void 0) return void 0;
|
|
5999
|
-
return
|
|
6499
|
+
return defined7({
|
|
6000
6500
|
id,
|
|
6001
6501
|
name,
|
|
6002
|
-
length:
|
|
6003
|
-
detail:
|
|
6004
|
-
progress:
|
|
6502
|
+
length: text5(row.primarySubtitle),
|
|
6503
|
+
detail: text5(row.secondarySubtitle),
|
|
6504
|
+
progress: text5(row.summary),
|
|
6005
6505
|
url: clean(row.navigationUrl)
|
|
6006
6506
|
});
|
|
6007
6507
|
}
|
|
6008
6508
|
function jobRow(row, stage) {
|
|
6009
6509
|
const id = inner(row.entityUrn)?.split(":").pop();
|
|
6010
|
-
const title =
|
|
6510
|
+
const title = text5(row.title);
|
|
6011
6511
|
if (id === void 0 || title === void 0) return void 0;
|
|
6012
|
-
const place =
|
|
6512
|
+
const place = text5(row.secondarySubtitle);
|
|
6013
6513
|
const m = place?.match(/^(.*?)\s*\(([^()]+)\)$/);
|
|
6014
6514
|
const workplace = m?.[2] === void 0 ? void 0 : WORKPLACE[m[2].toLowerCase()];
|
|
6015
|
-
return
|
|
6515
|
+
return defined7({
|
|
6016
6516
|
id,
|
|
6017
6517
|
title,
|
|
6018
|
-
company:
|
|
6518
|
+
company: text5(row.primarySubtitle),
|
|
6019
6519
|
location: workplace !== void 0 ? m?.[1] : place,
|
|
6020
6520
|
workplace,
|
|
6021
6521
|
stage,
|
|
@@ -6175,7 +6675,7 @@ function searchUrl(q2) {
|
|
|
6175
6675
|
kind: SEARCH_KINDS[q2.kind]
|
|
6176
6676
|
});
|
|
6177
6677
|
}
|
|
6178
|
-
var
|
|
6678
|
+
var text6 = (v) => {
|
|
6179
6679
|
const t = v?.text;
|
|
6180
6680
|
return typeof t === "string" && t.trim() !== "" ? t.trim().replace(/\s+/g, " ") : void 0;
|
|
6181
6681
|
};
|
|
@@ -6189,13 +6689,13 @@ function cleanUrl2(nav) {
|
|
|
6189
6689
|
}
|
|
6190
6690
|
function rowToFound(row) {
|
|
6191
6691
|
const id = idOf2(row.entityUrn);
|
|
6192
|
-
const name =
|
|
6692
|
+
const name = text6(row.title);
|
|
6193
6693
|
if (id === void 0 || name === void 0) return void 0;
|
|
6194
6694
|
const found = { id, name };
|
|
6195
6695
|
const fields = [
|
|
6196
|
-
["subtitle",
|
|
6197
|
-
["detail",
|
|
6198
|
-
["summary",
|
|
6696
|
+
["subtitle", text6(row.primarySubtitle)],
|
|
6697
|
+
["detail", text6(row.secondarySubtitle)],
|
|
6698
|
+
["summary", text6(row.summary)],
|
|
6199
6699
|
["url", cleanUrl2(row.navigationUrl)]
|
|
6200
6700
|
];
|
|
6201
6701
|
for (const [k, v] of fields)
|
|
@@ -6203,7 +6703,7 @@ function rowToFound(row) {
|
|
|
6203
6703
|
if (JSON.stringify(row.badgeIcon ?? null).includes("VERIFIED")) found.verified = true;
|
|
6204
6704
|
return found;
|
|
6205
6705
|
}
|
|
6206
|
-
var
|
|
6706
|
+
var drift7 = (message) => ({
|
|
6207
6707
|
ok: false,
|
|
6208
6708
|
code: "SCHEMA_DRIFT",
|
|
6209
6709
|
message,
|
|
@@ -6212,7 +6712,7 @@ var drift6 = (message) => ({
|
|
|
6212
6712
|
function parseResults(json) {
|
|
6213
6713
|
const c = clustersOf(json);
|
|
6214
6714
|
if (c === void 0 || !Array.isArray(c.elements))
|
|
6215
|
-
return
|
|
6715
|
+
return drift7("the search returned no result list");
|
|
6216
6716
|
const included = json.included ?? [];
|
|
6217
6717
|
const { people: items, unknownTypes, excluded, unresolved } = readItems(c, included, rowToFound);
|
|
6218
6718
|
const total = typeof c.paging?.total === "number" ? c.paging.total : void 0;
|
|
@@ -6220,7 +6720,7 @@ function parseResults(json) {
|
|
|
6220
6720
|
const claimedRaw = c.metadata?.totalResultCount;
|
|
6221
6721
|
const claimed = typeof claimedRaw === "number" ? claimedRaw : total;
|
|
6222
6722
|
if (unresolved > 0 && items.length === 0)
|
|
6223
|
-
return
|
|
6723
|
+
return drift7(`${unresolved} results were listed but none could be read`);
|
|
6224
6724
|
if (items.length === 0 && total !== void 0 && total > start) {
|
|
6225
6725
|
return {
|
|
6226
6726
|
ok: false,
|
|
@@ -6291,15 +6791,15 @@ function parseSentInvitations(json) {
|
|
|
6291
6791
|
if (!Array.isArray(refs))
|
|
6292
6792
|
return { ok: false, code: "SCHEMA_DRIFT", message: "the sent invitations list was missing" };
|
|
6293
6793
|
const included = json.included ?? [];
|
|
6294
|
-
const
|
|
6794
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
6295
6795
|
const invitations2 = [];
|
|
6296
6796
|
for (const ref of refs) {
|
|
6297
|
-
const view =
|
|
6298
|
-
const inv =
|
|
6797
|
+
const view = byUrn2.get(ref);
|
|
6798
|
+
const inv = byUrn2.get(view?.["*invitation"]) ?? included.find(
|
|
6299
6799
|
(n) => String(n.$type).endsWith(".Invitation") && typeof ref === "string" && ref.endsWith(String(n.entityUrn))
|
|
6300
6800
|
);
|
|
6301
6801
|
if (inv === void 0) continue;
|
|
6302
|
-
const who =
|
|
6802
|
+
const who = byUrn2.get(inv["*toMember"]);
|
|
6303
6803
|
const name = [who?.firstName, who?.lastName].filter((x) => typeof x === "string" && x !== "").join(" ");
|
|
6304
6804
|
const id = String(inv["*toMember"] ?? "").split(":").pop();
|
|
6305
6805
|
const note = typeof inv.message === "string" ? inv.message : inv.message?.text;
|
|
@@ -6440,15 +6940,15 @@ function notificationsUrl(count3, start) {
|
|
|
6440
6940
|
if (c?.decorationId === void 0) throw new Error("the 'notifications' contract is missing");
|
|
6441
6941
|
return `${c.path}?decorationId=${c.decorationId}&q=filterVanityName&count=${count3}&start=${start}`;
|
|
6442
6942
|
}
|
|
6443
|
-
var
|
|
6943
|
+
var drift8 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
6444
6944
|
var textOf = (v) => {
|
|
6445
6945
|
const t = v?.text;
|
|
6446
6946
|
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
6447
6947
|
};
|
|
6448
6948
|
var absolute = (v) => typeof v === "string" && v !== "" ? v.startsWith("/") ? `https://www.linkedin.com${v}` : v : void 0;
|
|
6449
6949
|
function card(n) {
|
|
6450
|
-
const
|
|
6451
|
-
if (
|
|
6950
|
+
const text7 = textOf(n.headline);
|
|
6951
|
+
if (text7 === void 0) return void 0;
|
|
6452
6952
|
const kind = String(n.entityUrn ?? "").match(/fsd_notificationCard:\(([^,]+),/)?.[1] ?? "UNKNOWN";
|
|
6453
6953
|
const detail = [n.subHeadline, n.contentPrimaryText, n.contentSecondaryText, n.kickerText].map(textOf).filter((t) => t !== void 0).join(" \xB7 ");
|
|
6454
6954
|
const at = typeof n.publishedAt === "number" ? new Date(n.publishedAt).toISOString() : void 0;
|
|
@@ -6456,7 +6956,7 @@ function card(n) {
|
|
|
6456
6956
|
const from = absolute(n.headerImage?.actionTarget);
|
|
6457
6957
|
return {
|
|
6458
6958
|
kind,
|
|
6459
|
-
text:
|
|
6959
|
+
text: text7,
|
|
6460
6960
|
...detail !== "" ? { detail } : {},
|
|
6461
6961
|
...at !== void 0 ? { at } : {},
|
|
6462
6962
|
read: n.read === true,
|
|
@@ -6468,15 +6968,15 @@ function parseNotifications(json) {
|
|
|
6468
6968
|
const root = json;
|
|
6469
6969
|
const data = root?.data;
|
|
6470
6970
|
const listed2 = data?.["*elements"] ?? data?.elements;
|
|
6471
|
-
if (!Array.isArray(listed2)) return
|
|
6472
|
-
const
|
|
6971
|
+
if (!Array.isArray(listed2)) return drift8("the notifications answer carried no card list");
|
|
6972
|
+
const byUrn2 = new Map((root?.included ?? []).map((n) => [n.entityUrn, n]));
|
|
6473
6973
|
const items = listed2.flatMap((u) => {
|
|
6474
|
-
const n =
|
|
6974
|
+
const n = byUrn2.get(u);
|
|
6475
6975
|
const c = n === void 0 ? void 0 : card(n);
|
|
6476
6976
|
return c === void 0 ? [] : [c];
|
|
6477
6977
|
});
|
|
6478
6978
|
if (listed2.length > 0 && items.length === 0)
|
|
6479
|
-
return
|
|
6979
|
+
return drift8(`${listed2.length} notifications were listed but none could be read`);
|
|
6480
6980
|
const meta = data?.metadata ?? {};
|
|
6481
6981
|
return {
|
|
6482
6982
|
ok: true,
|
|
@@ -6574,18 +7074,18 @@ async function exchange(code, config, deps) {
|
|
|
6574
7074
|
} catch (e) {
|
|
6575
7075
|
return { ok: false, message: `could not reach LinkedIn: ${e.message}` };
|
|
6576
7076
|
}
|
|
6577
|
-
const
|
|
7077
|
+
const text7 = await res.text();
|
|
6578
7078
|
if (res.status !== 200) {
|
|
6579
7079
|
return {
|
|
6580
7080
|
ok: false,
|
|
6581
7081
|
message: `LinkedIn rejected the code exchange (${res.status})`,
|
|
6582
7082
|
// The most common causes, in the order they actually happen.
|
|
6583
|
-
hint: `Check that the app has BOTH products added, and that its Auth tab lists exactly ${REDIRECT_URI} as an authorized redirect URL. Response: ${
|
|
7083
|
+
hint: `Check that the app has BOTH products added, and that its Auth tab lists exactly ${REDIRECT_URI} as an authorized redirect URL. Response: ${text7.slice(0, 200)}`
|
|
6584
7084
|
};
|
|
6585
7085
|
}
|
|
6586
7086
|
let parsed;
|
|
6587
7087
|
try {
|
|
6588
|
-
parsed = JSON.parse(
|
|
7088
|
+
parsed = JSON.parse(text7);
|
|
6589
7089
|
} catch {
|
|
6590
7090
|
return { ok: false, message: "token response was not JSON" };
|
|
6591
7091
|
}
|
|
@@ -6840,7 +7340,7 @@ function contactInfoBody(publicId, firstName, lastName) {
|
|
|
6840
7340
|
isModal: true
|
|
6841
7341
|
};
|
|
6842
7342
|
}
|
|
6843
|
-
var
|
|
7343
|
+
var drift9 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
6844
7344
|
var unquote2 = (s) => JSON.parse(`"${s}"`);
|
|
6845
7345
|
var LABEL = /\["\$","p",null,\{"className":"[^"]*","children":\["((?:[^"\\]|\\.)+)"\]\}\]/g;
|
|
6846
7346
|
var VIEW = /"viewName":"contact-([a-z-]+)"/g;
|
|
@@ -6878,13 +7378,13 @@ function fieldsOf(stream) {
|
|
|
6878
7378
|
}
|
|
6879
7379
|
var camel = (s) => s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
6880
7380
|
function put(contact, f) {
|
|
6881
|
-
const
|
|
7381
|
+
const text7 = f.texts.join(", ");
|
|
6882
7382
|
switch (f.view) {
|
|
6883
7383
|
case "your-profile":
|
|
6884
7384
|
return;
|
|
6885
7385
|
// `profile` already has the profile URL.
|
|
6886
7386
|
case "email":
|
|
6887
|
-
contact.email = f.links[0] ??
|
|
7387
|
+
contact.email = f.links[0] ?? text7;
|
|
6888
7388
|
return;
|
|
6889
7389
|
case "website":
|
|
6890
7390
|
contact.websites = [
|
|
@@ -6902,18 +7402,18 @@ function put(contact, f) {
|
|
|
6902
7402
|
contact.twitter = [...contact.twitter ?? [], ...f.texts];
|
|
6903
7403
|
return;
|
|
6904
7404
|
case void 0:
|
|
6905
|
-
if (/^connected since$/i.test(f.label)) contact.connectedSince =
|
|
6906
|
-
else contact.other = { ...contact.other, [f.label]:
|
|
7405
|
+
if (/^connected since$/i.test(f.label)) contact.connectedSince = text7;
|
|
7406
|
+
else contact.other = { ...contact.other, [f.label]: text7 };
|
|
6907
7407
|
return;
|
|
6908
7408
|
default:
|
|
6909
|
-
contact[camel(f.view)] =
|
|
7409
|
+
contact[camel(f.view)] = text7;
|
|
6910
7410
|
}
|
|
6911
7411
|
}
|
|
6912
7412
|
function parseContactInfo(stream) {
|
|
6913
7413
|
if (!stream.includes("profile-contact-info-details-view"))
|
|
6914
|
-
return
|
|
7414
|
+
return drift9("the contact info answer was not the contact info overlay");
|
|
6915
7415
|
const fields = fieldsOf(stream);
|
|
6916
|
-
if (fields.length === 0) return
|
|
7416
|
+
if (fields.length === 0) return drift9("the contact info overlay had no fields");
|
|
6917
7417
|
const contact = {};
|
|
6918
7418
|
for (const f of fields) put(contact, f);
|
|
6919
7419
|
return { ok: true, contact };
|
|
@@ -6934,10 +7434,10 @@ function positionsPageUrl(profileUrn, start) {
|
|
|
6934
7434
|
const c = contract3("profilePositions");
|
|
6935
7435
|
return `${c.path}?q=viewee&profileUrn=${encodeURIComponent(profileUrn)}&decorationId=${c.decorationId}&start=${start}&count=${POSITIONS_PAGE}`;
|
|
6936
7436
|
}
|
|
6937
|
-
var
|
|
6938
|
-
var
|
|
7437
|
+
var drift10 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
7438
|
+
var str5 = (v) => typeof v === "string" && v.trim() !== "" && v.trim() !== "-" ? v.trim() : void 0;
|
|
6939
7439
|
var idOf3 = (urn) => String(urn ?? "").match(/:(\d+)$/)?.[1];
|
|
6940
|
-
function
|
|
7440
|
+
function defined8(obj) {
|
|
6941
7441
|
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
6942
7442
|
return obj;
|
|
6943
7443
|
}
|
|
@@ -6952,7 +7452,7 @@ function range(v) {
|
|
|
6952
7452
|
const r = v;
|
|
6953
7453
|
const start = date(r?.start);
|
|
6954
7454
|
const end = date(r?.end);
|
|
6955
|
-
return
|
|
7455
|
+
return defined8({
|
|
6956
7456
|
start,
|
|
6957
7457
|
end,
|
|
6958
7458
|
current: start !== void 0 && end === void 0 ? true : void 0
|
|
@@ -6975,21 +7475,21 @@ var Index = class {
|
|
|
6975
7475
|
collection(urn) {
|
|
6976
7476
|
const c = this.get(urn);
|
|
6977
7477
|
const refs = Array.isArray(c?.["*elements"]) ? c?.["*elements"] : [];
|
|
6978
|
-
const
|
|
7478
|
+
const nodes2 = refs.flatMap((r) => this.list(r));
|
|
6979
7479
|
const total = c?.paging?.total;
|
|
6980
|
-
return typeof total === "number" ? { nodes, total } : { nodes };
|
|
7480
|
+
return typeof total === "number" ? { nodes: nodes2, total } : { nodes: nodes2 };
|
|
6981
7481
|
}
|
|
6982
7482
|
};
|
|
6983
7483
|
function role(p, group, ix) {
|
|
6984
7484
|
const companyUrn = p.companyUrn ?? group?.companyUrn;
|
|
6985
|
-
return
|
|
6986
|
-
title:
|
|
6987
|
-
company:
|
|
7485
|
+
return defined8({
|
|
7486
|
+
title: str5(p.title),
|
|
7487
|
+
company: str5(p.companyName) ?? str5(group?.companyName),
|
|
6988
7488
|
companyId: idOf3(companyUrn),
|
|
6989
|
-
employmentType:
|
|
6990
|
-
location:
|
|
7489
|
+
employmentType: str5(ix.get(p["*employmentType"])?.name),
|
|
7490
|
+
location: str5(p.locationName) ?? str5(p.geoLocationName),
|
|
6991
7491
|
...range(p.dateRange),
|
|
6992
|
-
description:
|
|
7492
|
+
description: str5(p.description)
|
|
6993
7493
|
});
|
|
6994
7494
|
}
|
|
6995
7495
|
function rolesOf(groups, ix) {
|
|
@@ -6999,39 +7499,39 @@ function rolesOf(groups, ix) {
|
|
|
6999
7499
|
});
|
|
7000
7500
|
}
|
|
7001
7501
|
function school(e) {
|
|
7002
|
-
return
|
|
7003
|
-
school:
|
|
7502
|
+
return defined8({
|
|
7503
|
+
school: str5(e.schoolName),
|
|
7004
7504
|
schoolId: idOf3(e.schoolUrn),
|
|
7005
|
-
degree:
|
|
7006
|
-
field:
|
|
7505
|
+
degree: str5(e.degreeName),
|
|
7506
|
+
field: str5(e.fieldOfStudy),
|
|
7007
7507
|
...range(e.dateRange),
|
|
7008
|
-
grade:
|
|
7009
|
-
activities:
|
|
7010
|
-
description:
|
|
7508
|
+
grade: str5(e.grade),
|
|
7509
|
+
activities: str5(e.activities),
|
|
7510
|
+
description: str5(e.description)
|
|
7011
7511
|
});
|
|
7012
7512
|
}
|
|
7013
7513
|
function entry(n) {
|
|
7014
|
-
const proficiency =
|
|
7015
|
-
return
|
|
7016
|
-
name:
|
|
7017
|
-
title:
|
|
7018
|
-
role:
|
|
7019
|
-
organization:
|
|
7020
|
-
authority:
|
|
7021
|
-
issuer:
|
|
7022
|
-
publisher:
|
|
7514
|
+
const proficiency = str5(n.proficiency);
|
|
7515
|
+
return defined8({
|
|
7516
|
+
name: str5(n.name),
|
|
7517
|
+
title: str5(n.title),
|
|
7518
|
+
role: str5(n.role),
|
|
7519
|
+
organization: str5(n.companyName),
|
|
7520
|
+
authority: str5(n.authority),
|
|
7521
|
+
issuer: str5(n.issuer),
|
|
7522
|
+
publisher: str5(n.publisher),
|
|
7023
7523
|
proficiency: proficiency?.toLowerCase().replace(/_/g, " "),
|
|
7024
|
-
number:
|
|
7025
|
-
score:
|
|
7026
|
-
cause:
|
|
7524
|
+
number: str5(n.number) ?? str5(n.licenseNumber) ?? str5(n.patentNumber),
|
|
7525
|
+
score: str5(n.score),
|
|
7526
|
+
cause: str5(n.cause)?.toLowerCase().replace(/_/g, " "),
|
|
7027
7527
|
...range(n.dateRange),
|
|
7028
7528
|
issued: date(n.issuedOn),
|
|
7029
7529
|
published: date(n.publishedOn),
|
|
7030
|
-
url:
|
|
7031
|
-
description:
|
|
7530
|
+
url: str5(n.url),
|
|
7531
|
+
description: str5(n.description)
|
|
7032
7532
|
});
|
|
7033
7533
|
}
|
|
7034
|
-
var
|
|
7534
|
+
var SECTIONS2 = {
|
|
7035
7535
|
certifications: "*profileCertifications",
|
|
7036
7536
|
languages: "*profileLanguages",
|
|
7037
7537
|
honors: "*profileHonors",
|
|
@@ -7047,13 +7547,13 @@ var some = (xs) => xs.length > 0 ? xs : void 0;
|
|
|
7047
7547
|
function parseFullProfile(json) {
|
|
7048
7548
|
const root = json;
|
|
7049
7549
|
const listed2 = root?.data?.["*elements"];
|
|
7050
|
-
if (!Array.isArray(listed2)) return
|
|
7550
|
+
if (!Array.isArray(listed2)) return drift10("the profile answer carried no profile list");
|
|
7051
7551
|
if (listed2.length === 0)
|
|
7052
7552
|
return { ok: false, code: "NOT_FOUND", message: "no profile has that id on LinkedIn" };
|
|
7053
7553
|
const ix = new Index(root?.included ?? []);
|
|
7054
7554
|
const p = ix.get(listed2[0]);
|
|
7055
7555
|
const urn = typeof p?.entityUrn === "string" ? p.entityUrn : void 0;
|
|
7056
|
-
if (p === void 0 || urn === void 0) return
|
|
7556
|
+
if (p === void 0 || urn === void 0) return drift10("the profile was listed but not sent");
|
|
7057
7557
|
const counts2 = {};
|
|
7058
7558
|
const count3 = (key, shown, total) => {
|
|
7059
7559
|
if (total !== void 0 && total > shown) counts2[key] = { shown, total };
|
|
@@ -7065,32 +7565,32 @@ function parseFullProfile(json) {
|
|
|
7065
7565
|
const education = schools.nodes.map(school);
|
|
7066
7566
|
const skillNodes = ix.collection(p["*profileSkills"]);
|
|
7067
7567
|
count3("skills", skillNodes.nodes.length, skillNodes.total);
|
|
7068
|
-
const skills = skillNodes.nodes.flatMap((s) =>
|
|
7568
|
+
const skills = skillNodes.nodes.flatMap((s) => str5(s.name) ?? []);
|
|
7069
7569
|
const sections = {};
|
|
7070
|
-
for (const [key, field] of Object.entries(
|
|
7570
|
+
for (const [key, field] of Object.entries(SECTIONS2)) {
|
|
7071
7571
|
const c = ix.collection(p[field]);
|
|
7072
7572
|
count3(key, c.nodes.length, c.total);
|
|
7073
7573
|
const rows = c.nodes.map(entry);
|
|
7074
7574
|
if (rows.length > 0) sections[key] = rows;
|
|
7075
7575
|
}
|
|
7076
|
-
const publicId =
|
|
7077
|
-
const name = [
|
|
7576
|
+
const publicId = str5(p.publicIdentifier);
|
|
7577
|
+
const name = [str5(p.firstName), str5(p.lastName)].filter(Boolean).join(" ");
|
|
7078
7578
|
const geo = ix.get(p.geoLocation?.["*geo"]);
|
|
7079
7579
|
const bool3 = (v) => v === true ? true : void 0;
|
|
7080
7580
|
return {
|
|
7081
7581
|
ok: true,
|
|
7082
|
-
profile:
|
|
7582
|
+
profile: defined8({
|
|
7083
7583
|
id: urn.split(":").pop(),
|
|
7084
7584
|
urn,
|
|
7085
7585
|
publicId,
|
|
7086
7586
|
name: name === "" ? void 0 : name,
|
|
7087
|
-
firstName:
|
|
7088
|
-
lastName:
|
|
7089
|
-
headline:
|
|
7587
|
+
firstName: str5(p.firstName),
|
|
7588
|
+
lastName: str5(p.lastName),
|
|
7589
|
+
headline: str5(p.headline),
|
|
7090
7590
|
url: publicId === void 0 ? void 0 : `https://www.linkedin.com/in/${publicId}/`,
|
|
7091
|
-
location:
|
|
7092
|
-
industry:
|
|
7093
|
-
about:
|
|
7591
|
+
location: str5(geo?.defaultLocalizedName),
|
|
7592
|
+
industry: str5(ix.get(p["*industry"])?.name),
|
|
7593
|
+
about: str5(p.summary),
|
|
7094
7594
|
title: experience[0]?.title,
|
|
7095
7595
|
company: experience[0]?.company,
|
|
7096
7596
|
school: education[0]?.school,
|
|
@@ -7108,11 +7608,11 @@ function parseFullProfile(json) {
|
|
|
7108
7608
|
function parsePositionsPage(json) {
|
|
7109
7609
|
const root = json;
|
|
7110
7610
|
const refs = root?.data?.["*elements"];
|
|
7111
|
-
if (!Array.isArray(refs)) return
|
|
7611
|
+
if (!Array.isArray(refs)) return drift10("the experience page carried no position groups");
|
|
7112
7612
|
const ix = new Index(root?.included ?? []);
|
|
7113
7613
|
const groups = refs.flatMap((r) => ix.list(r));
|
|
7114
7614
|
if (refs.length > 0 && groups.length === 0)
|
|
7115
|
-
return
|
|
7615
|
+
return drift10(`${refs.length} position groups were listed but none sent`);
|
|
7116
7616
|
const total = root?.data?.paging?.total;
|
|
7117
7617
|
return {
|
|
7118
7618
|
ok: true,
|
|
@@ -7152,7 +7652,7 @@ function recommendationsBody(kind, vanityName, profileId2, start) {
|
|
|
7152
7652
|
}
|
|
7153
7653
|
};
|
|
7154
7654
|
}
|
|
7155
|
-
var
|
|
7655
|
+
var drift11 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
7156
7656
|
var unquote3 = (s) => JSON.parse(`"${s}"`);
|
|
7157
7657
|
var STR = '((?:[^"\\\\]|\\\\.)+)';
|
|
7158
7658
|
var loading = (id) => new RegExp(
|
|
@@ -7200,7 +7700,7 @@ function bodyOf(segment) {
|
|
|
7200
7700
|
}
|
|
7201
7701
|
function parseRecommendations(stream) {
|
|
7202
7702
|
if (!stream.includes("isPartialPage") && !stream.includes(PAGER))
|
|
7203
|
-
return
|
|
7703
|
+
return drift11("the recommendations answer was not the recommendations list");
|
|
7204
7704
|
const rows = new Rows(stream);
|
|
7205
7705
|
const headers2 = [...rows.byId].filter(([, row]) => NAME.test(row) && !row.startsWith('[["$"')).map(([id]) => id);
|
|
7206
7706
|
const heads = new Set(headers2);
|
|
@@ -7224,11 +7724,11 @@ function parseRecommendations(stream) {
|
|
|
7224
7724
|
}
|
|
7225
7725
|
}
|
|
7226
7726
|
const who = header(rows, p.h);
|
|
7227
|
-
const
|
|
7228
|
-
if (who !== void 0 &&
|
|
7727
|
+
const text7 = bodyOf(inlined(rows, row.slice(p.at, end)));
|
|
7728
|
+
if (who !== void 0 && text7 !== "") items.push({ ...who, text: text7 });
|
|
7229
7729
|
}
|
|
7230
7730
|
if (headers2.length > 0 && items.length === 0)
|
|
7231
|
-
return
|
|
7731
|
+
return drift11(`${headers2.length} recommendations were shown but none could be read`);
|
|
7232
7732
|
return { ok: true, items };
|
|
7233
7733
|
}
|
|
7234
7734
|
|
|
@@ -7252,7 +7752,7 @@ var PROFILE_FIELDS = {
|
|
|
7252
7752
|
maxLength: 2600
|
|
7253
7753
|
}
|
|
7254
7754
|
};
|
|
7255
|
-
var
|
|
7755
|
+
var drift12 = (message) => ({
|
|
7256
7756
|
ok: false,
|
|
7257
7757
|
code: "SCHEMA_DRIFT",
|
|
7258
7758
|
message,
|
|
@@ -7260,10 +7760,10 @@ var drift11 = (message) => ({
|
|
|
7260
7760
|
});
|
|
7261
7761
|
function readForm(stream, field) {
|
|
7262
7762
|
const states2 = readModel(stream);
|
|
7263
|
-
if (states2 === null) return
|
|
7763
|
+
if (states2 === null) return drift12("the profile form carried no initial values");
|
|
7264
7764
|
const args = findRequest(stream, field.save);
|
|
7265
7765
|
if (args === null)
|
|
7266
|
-
return
|
|
7766
|
+
return drift12(`the profile form carried no ${field.save.split(".").pop()} action`);
|
|
7267
7767
|
return { ok: true, args, states: states2, screen: field.screen, save: field.save };
|
|
7268
7768
|
}
|
|
7269
7769
|
function boundKey(form, property) {
|
|
@@ -7279,7 +7779,7 @@ function topSkills(form) {
|
|
|
7279
7779
|
return (key) => {
|
|
7280
7780
|
if (!key.endsWith("ReorderableSkillsFormBindingsskillIdsBinding")) return void 0;
|
|
7281
7781
|
const initial = [...form.states.entries()].find(([k]) => k.startsWith("initialSkills"))?.[1];
|
|
7282
|
-
if (initial === void 0) return
|
|
7782
|
+
if (initial === void 0) return drift12("the About form carried no initial top skills");
|
|
7283
7783
|
if (!Array.isArray(initial.value) || initial.value.length > 0) {
|
|
7284
7784
|
return {
|
|
7285
7785
|
ok: false,
|
|
@@ -7302,7 +7802,7 @@ function saveBody(form, field, value) {
|
|
|
7302
7802
|
const target2 = boundKey(form, field.binding);
|
|
7303
7803
|
const current = target2 === void 0 ? void 0 : form.states.get(target2);
|
|
7304
7804
|
if (target2 === void 0 || current === void 0) {
|
|
7305
|
-
return
|
|
7805
|
+
return drift12(`the profile form has no ${field.name} field`);
|
|
7306
7806
|
}
|
|
7307
7807
|
const model = new Map(form.states);
|
|
7308
7808
|
model.set(target2, { ...current, value });
|
|
@@ -7372,7 +7872,7 @@ var EDIT_NAV = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"
|
|
|
7372
7872
|
var TEXT4 = /"children":\["((?:[^"\\]|\\.)*)"\]/g;
|
|
7373
7873
|
function skillsFromPage(stream) {
|
|
7374
7874
|
if (!stream.includes(SKILL.pager) && !stream.includes(EDIT_NAV) && !stream.includes("isPartialPage")) {
|
|
7375
|
-
return
|
|
7875
|
+
return drift12("the skills page could not be read");
|
|
7376
7876
|
}
|
|
7377
7877
|
const skills = [];
|
|
7378
7878
|
let from = 0;
|
|
@@ -7380,11 +7880,11 @@ function skillsFromPage(stream) {
|
|
|
7380
7880
|
for (; ; ) {
|
|
7381
7881
|
i = stream.indexOf(EDIT_NAV, i);
|
|
7382
7882
|
if (i === -1) break;
|
|
7383
|
-
const
|
|
7883
|
+
const text7 = balanced(stream, i);
|
|
7384
7884
|
const end = i;
|
|
7385
7885
|
i += EDIT_NAV.length;
|
|
7386
|
-
if (
|
|
7387
|
-
const payload = JSON.parse(
|
|
7886
|
+
if (text7 === null) continue;
|
|
7887
|
+
const payload = JSON.parse(text7).requestedArguments?.payload;
|
|
7388
7888
|
const id = payload?.skillId;
|
|
7389
7889
|
if (typeof id !== "string" || payload === void 0 || skills.some((s) => s.skillId === id))
|
|
7390
7890
|
continue;
|
|
@@ -7392,7 +7892,7 @@ function skillsFromPage(stream) {
|
|
|
7392
7892
|
(m) => JSON.parse(`"${m[1]}"`)
|
|
7393
7893
|
);
|
|
7394
7894
|
skills.push({ skillId: id, name: names.length === 1 ? names[0] ?? null : null, payload });
|
|
7395
|
-
from = end +
|
|
7895
|
+
from = end + text7.length;
|
|
7396
7896
|
}
|
|
7397
7897
|
return { ok: true, skills };
|
|
7398
7898
|
}
|
|
@@ -7411,8 +7911,8 @@ function skillRowsOf(stream) {
|
|
|
7411
7911
|
function listPayloadOf(screen) {
|
|
7412
7912
|
const at = screen.indexOf('"filter":"ProfileSkillCategory_ALL"');
|
|
7413
7913
|
const open = at === -1 ? -1 : screen.lastIndexOf('"payload":{', at);
|
|
7414
|
-
const
|
|
7415
|
-
return
|
|
7914
|
+
const text7 = open === -1 ? null : balanced(screen, open + '"payload":'.length);
|
|
7915
|
+
return text7 === null ? null : JSON.parse(text7);
|
|
7416
7916
|
}
|
|
7417
7917
|
function pagerFrom(payload, start) {
|
|
7418
7918
|
const args = {
|
|
@@ -7434,11 +7934,11 @@ function pagerFrom(payload, start) {
|
|
|
7434
7934
|
}
|
|
7435
7935
|
function readSkillForm(stream) {
|
|
7436
7936
|
const model = readModel(stream);
|
|
7437
|
-
if (model === null) return
|
|
7937
|
+
if (model === null) return drift12("the skill form carried no initial values");
|
|
7438
7938
|
const save = findRequest(stream, SKILL.save);
|
|
7439
7939
|
const del = findRequest(stream, SKILL.delete);
|
|
7440
7940
|
if (save === null && del === null)
|
|
7441
|
-
return
|
|
7941
|
+
return drift12("the skill form carried neither a save nor a delete");
|
|
7442
7942
|
return { ok: true, model, save, del, screen: del === null ? SKILL.addScreen : SKILL.editScreen };
|
|
7443
7943
|
}
|
|
7444
7944
|
var nameKey = (model) => [...model.keys()].find((k) => k.startsWith("addSkillsTypeaheadSkillName"));
|
|
@@ -7450,10 +7950,10 @@ function skillNameOf(form) {
|
|
|
7450
7950
|
function addSkillBody(form, name) {
|
|
7451
7951
|
if (name.trim() === "")
|
|
7452
7952
|
return { ok: false, code: "INVALID_INPUT", message: "a skill needs a name" };
|
|
7453
|
-
if (form.save === null) return
|
|
7953
|
+
if (form.save === null) return drift12("this form has no save action (it is not the add form)");
|
|
7454
7954
|
const key = nameKey(form.model);
|
|
7455
7955
|
const current = key === void 0 ? void 0 : form.model.get(key);
|
|
7456
|
-
if (key === void 0 || current === void 0) return
|
|
7956
|
+
if (key === void 0 || current === void 0) return drift12("the skill form has no name field");
|
|
7457
7957
|
const model = new Map(form.model);
|
|
7458
7958
|
model.set(key, { ...current, value: name.trim() });
|
|
7459
7959
|
const states2 = wireStates(keysOf(form.save), model, () => void 0);
|
|
@@ -7462,7 +7962,7 @@ function addSkillBody(form, name) {
|
|
|
7462
7962
|
}
|
|
7463
7963
|
function removeSkillBody(form) {
|
|
7464
7964
|
if (form.del === null)
|
|
7465
|
-
return
|
|
7965
|
+
return drift12("this form has no delete action (it is not an existing skill)");
|
|
7466
7966
|
const states2 = wireStates(keysOf(form.del), form.model, () => void 0);
|
|
7467
7967
|
if (!Array.isArray(states2)) return states2;
|
|
7468
7968
|
return { ok: true, body: requestBody(SKILL.delete, form.del, states2, form.screen) };
|
|
@@ -7478,7 +7978,7 @@ async function fetchSkills(vanityName, client) {
|
|
|
7478
7978
|
);
|
|
7479
7979
|
if (typeof screen !== "string") return screen;
|
|
7480
7980
|
const payload = listPayloadOf(screen);
|
|
7481
|
-
if (payload === null) return
|
|
7981
|
+
if (payload === null) return drift12("the Skills screen carried no list request");
|
|
7482
7982
|
const count3 = typeof payload.count === "number" ? payload.count : 10;
|
|
7483
7983
|
const skills = [];
|
|
7484
7984
|
for (let page = 0; page < MAX_PAGES2; page++) {
|
|
@@ -7808,16 +8308,16 @@ var COMMANDS = [
|
|
|
7808
8308
|
name: "jobs",
|
|
7809
8309
|
cost: "1 job-search call per 100 jobs; --details adds 1 job read per 100 jobs",
|
|
7810
8310
|
summary: "Job search with every filter the jobs page has. Cards carry id, title, company, place, workplace, listed date, Easy Apply. Read finalists with `job`.",
|
|
7811
|
-
usage: 'lnrelay jobs "<keywords>" ["<more keywords>" ...] [--location "<place>" | --geo <id>]\n [--distance <miles>]\n [--posted 24h|week|month|<N>h|<N>d] [--experience internship,entry,associate,\n mid-senior,director,executive] [--type full-time,part-time,contract,temporary,\n volunteer,internship,other] [--workplace on-site,remote,hybrid] [--easy-apply]\n [--under-10] [--verified] [--in-network] [--fair-chance] [--company <ids>]\n [--industry <ids>] [--function <codes>] [--title <ids>] [--place <geo-ids>]\n [--filter key=v1,v2 ...] [--sort recent|relevant] [--limit N] [--start N]\n [--details [--description]] [--compact | --fields a,b,c]\n Ids for --company/--industry/--title/--place/--filter come from `job-filters`.\n The resolved place is in data.location: check it, "Vienna" may resolve narrow.',
|
|
8311
|
+
usage: 'lnrelay jobs "<keywords>" ["<more keywords>" ...] [--location "<place>" | --geo <id>]\n [--distance <miles>]\n [--posted 24h|week|month|<N>h|<N>d] [--experience internship,entry,associate,\n mid-senior,director,executive] [--type full-time,part-time,contract,temporary,\n volunteer,internship,other] [--workplace on-site,remote,hybrid] [--easy-apply]\n [--under-10] [--verified] [--in-network] [--fair-chance] [--company <ids>]\n [--industry <ids>] [--function <codes>] [--title <ids>] [--place <geo-ids>]\n [--filter key=v1,v2 ...] [--sort recent|relevant] [--limit N] [--start N]\n [--details [--description]] [--compact | --fields a,b,c]\n Ids for --company/--industry/--title/--place/--filter come from `job-filters`.\n The resolved place is in data.location: check it, "Vienna" may resolve narrow.\nlnrelay jobs --top-applicant | --hear-back [--limit N] [--details] [--compact | --fields a,b,c]\n Premium: the jobs where LinkedIn says you would be a top applicant (100 a call), or\n where you are more likely to hear back (25 a call, then read in full).',
|
|
7812
8312
|
audience: ["cli", "mcp"],
|
|
7813
8313
|
risk: "read",
|
|
7814
8314
|
implemented: true
|
|
7815
8315
|
},
|
|
7816
8316
|
{
|
|
7817
8317
|
name: "job",
|
|
7818
|
-
cost: "1 job read per 100 jobs; --team adds 1 page call per job",
|
|
7819
|
-
summary: "Jobs in full: description, apply link (external or Easy Apply), applicants, state. Several ids are read together, 100 a call. --team adds who posted it and who is hiring.",
|
|
7820
|
-
usage: "lnrelay job <id|job-url> [<id|job-url> ...] [--team] [--compact | --fields a,b,c]",
|
|
8318
|
+
cost: "1 job read per 100 jobs; --team adds 1 page call per job; --insights 1 job read per job; --match about 3 page calls per job",
|
|
8319
|
+
summary: "Jobs in full: description, apply link (external or Easy Apply), applicants, state. Several ids are read together, 100 a call. --team adds who posted it and who is hiring. --insights (Premium) adds who applied (count, last day, seniority, education) and the company's insights: headcount over two years, the job's function, tenure, competitors. --match (Premium) asks LinkedIn's AI how well you fit: verdict, met and missing qualifications.",
|
|
8320
|
+
usage: "lnrelay job <id|job-url> [<id|job-url> ...] [--team] [--insights] [--match]\n [--compact | --fields a,b,c]",
|
|
7821
8321
|
audience: ["cli", "mcp"],
|
|
7822
8322
|
risk: "read",
|
|
7823
8323
|
implemented: true
|
|
@@ -7934,8 +8434,8 @@ var COMMANDS = [
|
|
|
7934
8434
|
{
|
|
7935
8435
|
name: "viewers",
|
|
7936
8436
|
cost: "2 page calls",
|
|
7937
|
-
summary: "Who viewed your profile, as your profile-views page shows it: the total for the period, the viewers LinkedIn names (up to 3 on a free account), anonymous ones as LinkedIn describes them, and how many looked in private mode.",
|
|
7938
|
-
usage: "lnrelay viewers [--compact | --fields a,b,c]",
|
|
8437
|
+
summary: "Who viewed your profile, as your profile-views page shows it: the total for the period, the viewers LinkedIn names (up to 3 on a free account, all with Premium), anonymous ones as LinkedIn describes them, and how many looked in private mode. Premium adds a range and highlights: top location, industry and company, and the companies viewers work at.",
|
|
8438
|
+
usage: "lnrelay viewers [--days 7|14|28|90|365] [--compact | --fields a,b,c]",
|
|
7939
8439
|
audience: ["cli", "mcp"],
|
|
7940
8440
|
risk: "read",
|
|
7941
8441
|
implemented: true
|
|
@@ -8159,7 +8659,7 @@ var POSITION = {
|
|
|
8159
8659
|
var EDIT_NAV2 = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${POSITION.editScreen}"`;
|
|
8160
8660
|
function listPositions(stream) {
|
|
8161
8661
|
if (readModel(stream) === null && !stream.includes(EDIT_NAV2) && !stream.includes('"rows"')) {
|
|
8162
|
-
return
|
|
8662
|
+
return drift12("the Experience screen could not be read");
|
|
8163
8663
|
}
|
|
8164
8664
|
const positions = [];
|
|
8165
8665
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -8167,27 +8667,27 @@ function listPositions(stream) {
|
|
|
8167
8667
|
for (; ; ) {
|
|
8168
8668
|
i = stream.indexOf(EDIT_NAV2, i);
|
|
8169
8669
|
if (i === -1) break;
|
|
8170
|
-
const
|
|
8670
|
+
const text7 = balanced(stream, i);
|
|
8171
8671
|
i += EDIT_NAV2.length;
|
|
8172
|
-
if (
|
|
8173
|
-
const payload = JSON.parse(
|
|
8672
|
+
if (text7 === null) continue;
|
|
8673
|
+
const payload = JSON.parse(text7).requestedArguments?.payload;
|
|
8174
8674
|
const id = payload?.positionId;
|
|
8175
8675
|
if (typeof id !== "string" || seen.has(id) || payload === void 0) continue;
|
|
8176
8676
|
seen.add(id);
|
|
8177
8677
|
positions.push({ positionId: id, title: String(payload.title ?? ""), payload });
|
|
8178
8678
|
}
|
|
8179
8679
|
if (positions.length === 0 && !stream.includes('"rows"') && !stream.includes("Experience")) {
|
|
8180
|
-
return
|
|
8680
|
+
return drift12("the Experience screen listed no roles and did not look like one");
|
|
8181
8681
|
}
|
|
8182
8682
|
return { ok: true, positions };
|
|
8183
8683
|
}
|
|
8184
8684
|
function readPositionForm(stream) {
|
|
8185
8685
|
const model = readModel(stream);
|
|
8186
|
-
if (model === null) return
|
|
8686
|
+
if (model === null) return drift12("the position form carried no initial values");
|
|
8187
8687
|
const media = findRequest(stream, POSITION.media);
|
|
8188
8688
|
const prefix = media?.payload.formIdPrefix;
|
|
8189
8689
|
if (media === null || typeof prefix !== "string") {
|
|
8190
|
-
return
|
|
8690
|
+
return drift12("the position form carried no save step (uploadPositionMedia)");
|
|
8191
8691
|
}
|
|
8192
8692
|
const del = findRequest(stream, POSITION.delete);
|
|
8193
8693
|
return {
|
|
@@ -8238,7 +8738,7 @@ function applyChanges(form, changes) {
|
|
|
8238
8738
|
}
|
|
8239
8739
|
need("dynamicallyCreateHeadline", false);
|
|
8240
8740
|
need("allowProfileEditBroadcasts", changes.notify === true);
|
|
8241
|
-
if (missing.length > 0) return
|
|
8741
|
+
if (missing.length > 0) return drift12(`the position form has no ${missing.join(", ")} field`);
|
|
8242
8742
|
const s = roleSummary(model);
|
|
8243
8743
|
if (!s.current && s.start !== null && s.end !== null && s.end < s.start) {
|
|
8244
8744
|
return {
|
|
@@ -8283,7 +8783,7 @@ function mediaBody(form, model) {
|
|
|
8283
8783
|
}
|
|
8284
8784
|
function saveFromReply(reply) {
|
|
8285
8785
|
const args = findRequest(reply, POSITION.save);
|
|
8286
|
-
return args === null ?
|
|
8786
|
+
return args === null ? drift12("the media step did not hand back the save action") : { ok: true, args };
|
|
8287
8787
|
}
|
|
8288
8788
|
function positionSaveBody(save, model, screen) {
|
|
8289
8789
|
const sending = new Map(model);
|
|
@@ -8295,7 +8795,7 @@ function positionSaveBody(save, model, screen) {
|
|
|
8295
8795
|
}
|
|
8296
8796
|
function deleteBody(form) {
|
|
8297
8797
|
if (form.del === null)
|
|
8298
|
-
return
|
|
8798
|
+
return drift12("this form has no delete action (it is not an existing role)");
|
|
8299
8799
|
const states2 = wireStates(keysOf(form.del), form.model, resolver);
|
|
8300
8800
|
if (!Array.isArray(states2)) return states2;
|
|
8301
8801
|
return { ok: true, body: requestBody(POSITION.delete, form.del, states2, form.screen) };
|
|
@@ -8373,9 +8873,9 @@ async function send(url, body, token, deps) {
|
|
|
8373
8873
|
} catch (e) {
|
|
8374
8874
|
return { ok: false, code: "FETCH_FAILED", message: e.message };
|
|
8375
8875
|
}
|
|
8376
|
-
const
|
|
8876
|
+
const text7 = await res.text();
|
|
8377
8877
|
if (res.status === 201 || res.status === 200) {
|
|
8378
|
-
const id = res.headers.get("x-restli-id") ?? extractId(
|
|
8878
|
+
const id = res.headers.get("x-restli-id") ?? extractId(text7);
|
|
8379
8879
|
return {
|
|
8380
8880
|
ok: true,
|
|
8381
8881
|
id: id ?? "(unknown)",
|
|
@@ -8402,7 +8902,7 @@ async function send(url, body, token, deps) {
|
|
|
8402
8902
|
ok: false,
|
|
8403
8903
|
code: "FETCH_FAILED",
|
|
8404
8904
|
message: `write failed (${res.status})`,
|
|
8405
|
-
hint:
|
|
8905
|
+
hint: text7.slice(0, 300)
|
|
8406
8906
|
};
|
|
8407
8907
|
}
|
|
8408
8908
|
function extractId(body) {
|
|
@@ -8450,7 +8950,7 @@ function feedTypeFor(bindingKey) {
|
|
|
8450
8950
|
function stateKey(prefix, body) {
|
|
8451
8951
|
return `${prefix}-${body}`;
|
|
8452
8952
|
}
|
|
8453
|
-
function states(
|
|
8953
|
+
function states(text7, body) {
|
|
8454
8954
|
return STATE_PREFIXES.map((prefix) => {
|
|
8455
8955
|
const key = stateKey(prefix, body);
|
|
8456
8956
|
const base = {
|
|
@@ -8459,19 +8959,19 @@ function states(text6, body) {
|
|
|
8459
8959
|
protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: key } }
|
|
8460
8960
|
};
|
|
8461
8961
|
if (prefix === "commentBoxText") {
|
|
8462
|
-
return { ...base, value:
|
|
8962
|
+
return { ...base, value: text7, originalProtoCase: "stringValue" };
|
|
8463
8963
|
}
|
|
8464
8964
|
if (prefix === "richCommentBoxText") {
|
|
8465
8965
|
return {
|
|
8466
8966
|
...base,
|
|
8467
|
-
value: { text:
|
|
8967
|
+
value: { text: text7, attribute: [], $type: "TextModel", source: "local" },
|
|
8468
8968
|
originalProtoCase: "textModelForWrite"
|
|
8469
8969
|
};
|
|
8470
8970
|
}
|
|
8471
8971
|
return { ...base, value: "", originalProtoCase: "stringValue" };
|
|
8472
8972
|
});
|
|
8473
8973
|
}
|
|
8474
|
-
function commentBody(activityId,
|
|
8974
|
+
function commentBody(activityId, text7, tokens, feedType) {
|
|
8475
8975
|
const body = keyBody(tokens.bindingKey);
|
|
8476
8976
|
const activityUrn = { activityUrn: { activityId } };
|
|
8477
8977
|
const binding2 = (prefix) => ({
|
|
@@ -8518,17 +9018,17 @@ function commentBody(activityId, text6, tokens, feedType) {
|
|
|
8518
9018
|
isStreaming: false,
|
|
8519
9019
|
rumPageKey: ""
|
|
8520
9020
|
},
|
|
8521
|
-
states: states(
|
|
9021
|
+
states: states(text7, body),
|
|
8522
9022
|
requestedArguments: {
|
|
8523
9023
|
...args,
|
|
8524
|
-
states: states(
|
|
9024
|
+
states: states(text7, body),
|
|
8525
9025
|
screenId: SCREEN_ID3,
|
|
8526
9026
|
knownTemplateIds: []
|
|
8527
9027
|
}
|
|
8528
9028
|
};
|
|
8529
9029
|
}
|
|
8530
9030
|
async function comment(confirmed, client) {
|
|
8531
|
-
const { activityId, text:
|
|
9031
|
+
const { activityId, text: text7, tokens } = confirmed.payload;
|
|
8532
9032
|
if (!keyMatchesPost(tokens.bindingKey, activityId)) {
|
|
8533
9033
|
return {
|
|
8534
9034
|
ok: false,
|
|
@@ -8549,7 +9049,7 @@ async function comment(confirmed, client) {
|
|
|
8549
9049
|
const result = await client.request({
|
|
8550
9050
|
url: COMMENT_URL,
|
|
8551
9051
|
method: "POST",
|
|
8552
|
-
body: commentBody(activityId,
|
|
9052
|
+
body: commentBody(activityId, text7, tokens, feedType),
|
|
8553
9053
|
spendClass: "write",
|
|
8554
9054
|
operation: "comment.create"
|
|
8555
9055
|
});
|
|
@@ -8673,10 +9173,10 @@ var REPLY_URL = `https://www.linkedin.com/voyager/api/voyagerSocialDashNormComme
|
|
|
8673
9173
|
function parentThreadUrn(ref) {
|
|
8674
9174
|
return `urn:li:comment:(${ref.threadType}:${ref.activityId},${ref.commentId})`;
|
|
8675
9175
|
}
|
|
8676
|
-
function replyBody(ref,
|
|
9176
|
+
function replyBody(ref, text7) {
|
|
8677
9177
|
return {
|
|
8678
9178
|
commentary: {
|
|
8679
|
-
text:
|
|
9179
|
+
text: text7,
|
|
8680
9180
|
// The captured reply carried a profileMention, because LinkedIn's UI
|
|
8681
9181
|
// pre-fills "@Author " into the box. We send none: an @mention notifies a
|
|
8682
9182
|
// real person, and inventing one would put words — and a notification —
|
|
@@ -8688,11 +9188,11 @@ function replyBody(ref, text6) {
|
|
|
8688
9188
|
};
|
|
8689
9189
|
}
|
|
8690
9190
|
async function replyToComment(confirmed, client) {
|
|
8691
|
-
const { ref, text:
|
|
9191
|
+
const { ref, text: text7 } = confirmed.payload;
|
|
8692
9192
|
const result = await client.request({
|
|
8693
9193
|
url: REPLY_URL,
|
|
8694
9194
|
method: "POST",
|
|
8695
|
-
body: replyBody(ref,
|
|
9195
|
+
body: replyBody(ref, text7),
|
|
8696
9196
|
spendClass: "write",
|
|
8697
9197
|
operation: "reply"
|
|
8698
9198
|
});
|
|
@@ -9511,8 +10011,8 @@ function whenLine(at, now) {
|
|
|
9511
10011
|
const away = hours < 48 ? `in ${hours} h` : `in ${Math.round(hours / 24)} days`;
|
|
9512
10012
|
return `when ${local} (${zone}) \u2014 ${away}`;
|
|
9513
10013
|
}
|
|
9514
|
-
async function runShare(
|
|
9515
|
-
if (
|
|
10014
|
+
async function runShare(text7, visibility, now = Date.now(), deps = terminalDeps(), via2, media, at, poll, link = {}) {
|
|
10015
|
+
if (text7 === void 0 || text7.trim() === "") {
|
|
9516
10016
|
return err("share", "INVALID_INPUT", "text is required", 'lnrelay share "<text>"');
|
|
9517
10017
|
}
|
|
9518
10018
|
const vis = visibility === "connections" ? "CONNECTIONS" : "PUBLIC";
|
|
@@ -9527,7 +10027,7 @@ async function runShare(text6, visibility, now = Date.now(), deps = terminalDeps
|
|
|
9527
10027
|
via: via2
|
|
9528
10028
|
});
|
|
9529
10029
|
if (pollSpec !== void 0 && "ok" in pollSpec) return pollSpec;
|
|
9530
|
-
const cardUrl = link.card !== false && loaded === void 0 && pollSpec === void 0 && via2 !== "oauth" ? firstUrl(
|
|
10030
|
+
const cardUrl = link.card !== false && loaded === void 0 && pollSpec === void 0 && via2 !== "oauth" ? firstUrl(text7) : null;
|
|
9531
10031
|
const needs = shareNeeds(loaded?.approved.length, scheduledAt, pollSpec, cardUrl);
|
|
9532
10032
|
const ctx = prepare("share", now, needs.voyagerOnly ? "voyager" : via2, needs.calls);
|
|
9533
10033
|
if ("ok" in ctx) return ctx;
|
|
@@ -9536,7 +10036,7 @@ async function runShare(text6, visibility, now = Date.now(), deps = terminalDeps
|
|
|
9536
10036
|
const plan = sharePlan({
|
|
9537
10037
|
author: authorLine(ctx.transport),
|
|
9538
10038
|
transport: ctx.transport.kind,
|
|
9539
|
-
text:
|
|
10039
|
+
text: text7,
|
|
9540
10040
|
visibility: vis,
|
|
9541
10041
|
media: loaded?.approved,
|
|
9542
10042
|
scheduledAt,
|
|
@@ -9559,7 +10059,7 @@ async function runShare(text6, visibility, now = Date.now(), deps = terminalDeps
|
|
|
9559
10059
|
note: "note" in result ? result.note : ctx.note
|
|
9560
10060
|
});
|
|
9561
10061
|
}
|
|
9562
|
-
async function runEditPost(urn,
|
|
10062
|
+
async function runEditPost(urn, text7, now, deps) {
|
|
9563
10063
|
const unapprovable = refuseUnapprovable("edit", "editing", deps);
|
|
9564
10064
|
if (unapprovable !== null) return unapprovable;
|
|
9565
10065
|
const ctx = prepare("edit", now, "voyager");
|
|
@@ -9574,12 +10074,12 @@ async function runEditPost(urn, text6, now, deps) {
|
|
|
9574
10074
|
const before = await lookup(urn, true);
|
|
9575
10075
|
const plan = {
|
|
9576
10076
|
action: "edit your post",
|
|
9577
|
-
payload: { urn, text:
|
|
10077
|
+
payload: { urn, text: text7 },
|
|
9578
10078
|
summary: [
|
|
9579
10079
|
authorLine(ctx.transport),
|
|
9580
10080
|
`post ${urn}`,
|
|
9581
10081
|
...previewLines2(before).map((l) => l.replace(/^content /, "was ")),
|
|
9582
|
-
`new text "${
|
|
10082
|
+
`new text "${text7}"`
|
|
9583
10083
|
],
|
|
9584
10084
|
reversibility: "editable again, but the previous text is NOT kept here, LinkedIn marks the post as edited, and an @mention in the old text is not carried over",
|
|
9585
10085
|
transport: "voyager"
|
|
@@ -9603,7 +10103,7 @@ function liveProfile(session) {
|
|
|
9603
10103
|
};
|
|
9604
10104
|
}
|
|
9605
10105
|
var PROFILE_HINT = `profile fields: ${Object.keys(PROFILE_FIELDS).join(", ")}`;
|
|
9606
|
-
async function runEditProfile(name,
|
|
10106
|
+
async function runEditProfile(name, text7, now = Date.now(), deps = terminalDeps(), surface) {
|
|
9607
10107
|
const field = PROFILE_FIELDS[name];
|
|
9608
10108
|
if (field === void 0) {
|
|
9609
10109
|
return err(
|
|
@@ -9613,7 +10113,7 @@ async function runEditProfile(name, text6, now = Date.now(), deps = terminalDeps
|
|
|
9613
10113
|
PROFILE_HINT
|
|
9614
10114
|
);
|
|
9615
10115
|
}
|
|
9616
|
-
if (
|
|
10116
|
+
if (text7 === void 0 || text7.trim() === "") {
|
|
9617
10117
|
return err(
|
|
9618
10118
|
"edit",
|
|
9619
10119
|
"INVALID_INPUT",
|
|
@@ -9621,11 +10121,11 @@ async function runEditProfile(name, text6, now = Date.now(), deps = terminalDeps
|
|
|
9621
10121
|
`lnrelay edit ${name} "<text>"`
|
|
9622
10122
|
);
|
|
9623
10123
|
}
|
|
9624
|
-
if (
|
|
10124
|
+
if (text7.length > field.maxLength) {
|
|
9625
10125
|
return err(
|
|
9626
10126
|
"edit",
|
|
9627
10127
|
"INVALID_INPUT",
|
|
9628
|
-
`the ${name} is ${
|
|
10128
|
+
`the ${name} is ${text7.length} characters; LinkedIn allows ${field.maxLength}`
|
|
9629
10129
|
);
|
|
9630
10130
|
}
|
|
9631
10131
|
const unapprovable = refuseUnapprovable("edit", "editing", deps);
|
|
@@ -9641,19 +10141,19 @@ async function runEditProfile(name, text6, now = Date.now(), deps = terminalDeps
|
|
|
9641
10141
|
const form = await profile.open(field, me.vanity);
|
|
9642
10142
|
if (!form.ok) return err("edit", form.code, form.message, form.hint);
|
|
9643
10143
|
const was = currentValue(form, field) ?? "";
|
|
9644
|
-
if (was ===
|
|
10144
|
+
if (was === text7) {
|
|
9645
10145
|
return err("edit", "INVALID_INPUT", `your ${name} already reads exactly that; nothing to save`);
|
|
9646
10146
|
}
|
|
9647
|
-
const built = saveBody(form, field,
|
|
10147
|
+
const built = saveBody(form, field, text7);
|
|
9648
10148
|
if (!built.ok) return err("edit", built.code, built.message, built.hint);
|
|
9649
10149
|
const plan = {
|
|
9650
10150
|
action: `change your ${name}`,
|
|
9651
|
-
payload: { field: name, was, text:
|
|
10151
|
+
payload: { field: name, was, text: text7 },
|
|
9652
10152
|
summary: [
|
|
9653
10153
|
authorLine(ctx.transport),
|
|
9654
10154
|
`field ${name}`,
|
|
9655
10155
|
`was "${was}"`,
|
|
9656
|
-
`new "${
|
|
10156
|
+
`new "${text7}"`
|
|
9657
10157
|
],
|
|
9658
10158
|
reversibility: "editable again, but the old text is kept only in this preview and the audit log (~/.lnrelay/writes.jsonl). Every other profile field is sent back as LinkedIn holds it.",
|
|
9659
10159
|
transport: "voyager"
|
|
@@ -9664,7 +10164,7 @@ async function runEditProfile(name, text6, now = Date.now(), deps = terminalDeps
|
|
|
9664
10164
|
if (!sent.ok) return err("edit", sent.code, sent.message, sent.hint);
|
|
9665
10165
|
const after = await profile.open(field, me.vanity);
|
|
9666
10166
|
const reads = after.ok ? currentValue(after, field) : void 0;
|
|
9667
|
-
if (reads !==
|
|
10167
|
+
if (reads !== text7) {
|
|
9668
10168
|
return err(
|
|
9669
10169
|
"edit",
|
|
9670
10170
|
"SCHEMA_DRIFT",
|
|
@@ -9703,8 +10203,8 @@ async function harvest(activityId, session, now) {
|
|
|
9703
10203
|
if (!found.ok) return err("comment", "SCHEMA_DRIFT", found.message, found.hint);
|
|
9704
10204
|
return { ok: true, tokens: { bindingKey: found.bindingKey, trackingId: found.trackingId } };
|
|
9705
10205
|
}
|
|
9706
|
-
async function runComment(postUrn2,
|
|
9707
|
-
if (postUrn2 === void 0 ||
|
|
10206
|
+
async function runComment(postUrn2, text7, now = Date.now(), deps = terminalDeps()) {
|
|
10207
|
+
if (postUrn2 === void 0 || text7 === void 0 || text7.trim() === "") {
|
|
9708
10208
|
return err(
|
|
9709
10209
|
"comment",
|
|
9710
10210
|
"INVALID_INPUT",
|
|
@@ -9741,11 +10241,11 @@ async function runComment(postUrn2, text6, now = Date.now(), deps = terminalDeps
|
|
|
9741
10241
|
if (!("tokens" in harvested)) return harvested;
|
|
9742
10242
|
const plan = {
|
|
9743
10243
|
action: "comment on a post",
|
|
9744
|
-
payload: { activityId, text:
|
|
10244
|
+
payload: { activityId, text: text7, tokens: harvested.tokens },
|
|
9745
10245
|
// The harvested trackingId changes on every render, so --plan and --confirm
|
|
9746
10246
|
// would never agree on a token derived from it. The intent is what's approved.
|
|
9747
|
-
tokenBasis: { activityId, text:
|
|
9748
|
-
summary: [authorLine(ctx.transport), `on ${postUrn2}`, `content "${
|
|
10247
|
+
tokenBasis: { activityId, text: text7 },
|
|
10248
|
+
summary: [authorLine(ctx.transport), `on ${postUrn2}`, `content "${text7}"`],
|
|
9749
10249
|
reversibility: "deletable with `lnrelay delete <comment-urn>`; the author is notified immediately",
|
|
9750
10250
|
transport: "voyager"
|
|
9751
10251
|
};
|
|
@@ -9757,8 +10257,8 @@ async function runComment(postUrn2, text6, now = Date.now(), deps = terminalDeps
|
|
|
9757
10257
|
);
|
|
9758
10258
|
return result.ok ? ok("comment", { on: postUrn2 }) : err("comment", result.code, result.message, result.hint);
|
|
9759
10259
|
}
|
|
9760
|
-
async function runEdit(commentUrn,
|
|
9761
|
-
if (commentUrn === void 0 ||
|
|
10260
|
+
async function runEdit(commentUrn, text7, now = Date.now(), deps = terminalDeps()) {
|
|
10261
|
+
if (commentUrn === void 0 || text7 === void 0 || text7.trim() === "") {
|
|
9762
10262
|
return err(
|
|
9763
10263
|
"edit",
|
|
9764
10264
|
"INVALID_INPUT",
|
|
@@ -9767,15 +10267,15 @@ async function runEdit(commentUrn, text6, now = Date.now(), deps = terminalDeps(
|
|
|
9767
10267
|
);
|
|
9768
10268
|
}
|
|
9769
10269
|
if (commentUrn === "photo" || commentUrn === "banner") {
|
|
9770
|
-
return runEditImage(commentUrn,
|
|
10270
|
+
return runEditImage(commentUrn, text7, now, deps);
|
|
9771
10271
|
}
|
|
9772
10272
|
const ref = parseCommentUrn(commentUrn);
|
|
9773
10273
|
if (ref === null && !commentUrn.startsWith("urn:")) {
|
|
9774
|
-
return runEditProfile(commentUrn,
|
|
10274
|
+
return runEditProfile(commentUrn, text7, now, deps);
|
|
9775
10275
|
}
|
|
9776
10276
|
if (ref === null) {
|
|
9777
10277
|
if (/^urn:li:(share|ugcPost):\d+$/.test(commentUrn)) {
|
|
9778
|
-
return runEditPost(commentUrn,
|
|
10278
|
+
return runEditPost(commentUrn, text7, now, deps);
|
|
9779
10279
|
}
|
|
9780
10280
|
return err(
|
|
9781
10281
|
"edit",
|
|
@@ -9795,8 +10295,8 @@ async function runEdit(commentUrn, text6, now = Date.now(), deps = terminalDeps(
|
|
|
9795
10295
|
if (!("tokens" in harvested)) return harvested;
|
|
9796
10296
|
const plan = {
|
|
9797
10297
|
action: "edit your comment",
|
|
9798
|
-
payload: { urn: commentUrn, text:
|
|
9799
|
-
summary: [authorLine(ctx.transport), `comment ${commentUrn}`, `new text "${
|
|
10298
|
+
payload: { urn: commentUrn, text: text7 },
|
|
10299
|
+
summary: [authorLine(ctx.transport), `comment ${commentUrn}`, `new text "${text7}"`],
|
|
9800
10300
|
reversibility: "editable again, but the previous text is NOT recoverable here and LinkedIn marks the comment as edited",
|
|
9801
10301
|
transport: "voyager"
|
|
9802
10302
|
};
|
|
@@ -9807,7 +10307,7 @@ async function runEdit(commentUrn, text6, now = Date.now(), deps = terminalDeps(
|
|
|
9807
10307
|
UPDATE_OP,
|
|
9808
10308
|
harvested.tokens.trackingId,
|
|
9809
10309
|
createLiveClient(ctx.transport.session),
|
|
9810
|
-
|
|
10310
|
+
text7
|
|
9811
10311
|
);
|
|
9812
10312
|
return result.ok ? ok("edit", { edited: commentUrn }) : err("edit", result.code, result.message, result.hint);
|
|
9813
10313
|
}
|
|
@@ -9851,8 +10351,8 @@ async function runReact(postUrn2, type, now = Date.now(), deps = terminalDeps(),
|
|
|
9851
10351
|
const result = await react(gated.confirmed, createLiveClient(ctx.transport.session));
|
|
9852
10352
|
return result.ok ? ok("react", { id: result.id, removed: remove }) : err("react", result.code, result.message, result.hint);
|
|
9853
10353
|
}
|
|
9854
|
-
async function runReply(commentUrn,
|
|
9855
|
-
if (commentUrn === void 0 ||
|
|
10354
|
+
async function runReply(commentUrn, text7, now = Date.now(), deps = terminalDeps()) {
|
|
10355
|
+
if (commentUrn === void 0 || text7 === void 0 || text7.trim() === "") {
|
|
9856
10356
|
return err(
|
|
9857
10357
|
"reply",
|
|
9858
10358
|
"INVALID_INPUT",
|
|
@@ -9878,8 +10378,8 @@ async function runReply(commentUrn, text6, now = Date.now(), deps = terminalDeps
|
|
|
9878
10378
|
}
|
|
9879
10379
|
const plan = {
|
|
9880
10380
|
action: "reply to a comment",
|
|
9881
|
-
payload: { ref: parent, text:
|
|
9882
|
-
summary: [authorLine(ctx.transport), `replying to ${commentUrn}`, `content "${
|
|
10381
|
+
payload: { ref: parent, text: text7 },
|
|
10382
|
+
summary: [authorLine(ctx.transport), `replying to ${commentUrn}`, `content "${text7}"`],
|
|
9883
10383
|
reversibility: "deletable with `lnrelay delete <the reply urn>`; the comment author is notified immediately",
|
|
9884
10384
|
transport: "voyager"
|
|
9885
10385
|
};
|
|
@@ -10556,13 +11056,15 @@ async function runSync(source, limit, force, now = Date.now()) {
|
|
|
10556
11056
|
var SERVER_REQUEST = "https://www.linkedin.com/flagship-web/rsc-action/actions/server-request";
|
|
10557
11057
|
var VIEWERS_URL = `${SERVER_REQUEST}?sduiid=WvmpEntityList`;
|
|
10558
11058
|
var VIEW_TOTALS_URL = `${SERVER_REQUEST}?sduiid=WvmpAnalytics`;
|
|
11059
|
+
var VIEWERS_REFERER = "https://www.linkedin.com/analytics/profile-views/";
|
|
11060
|
+
var VIEW_RANGES = [7, 14, 28, 90, 365];
|
|
10559
11061
|
var RANGE = "WvmpSearchFilterType_DATE_RANGE";
|
|
10560
11062
|
var META2 = { $type: "proto.sdui.common.RequestMetadata" };
|
|
10561
|
-
function serverRequest2(requestId, stateKey3, payload) {
|
|
11063
|
+
function serverRequest2(requestId, stateKey3, payload, days) {
|
|
10562
11064
|
const state2 = {
|
|
10563
11065
|
key: stateKey3,
|
|
10564
11066
|
namespace: "MemoryNamespace",
|
|
10565
|
-
value: [],
|
|
11067
|
+
value: days === void 0 ? [] : [`WvmpSearchFilterTimeRange_LAST_${days}_DAYS`],
|
|
10566
11068
|
originalProtoCase: "stringListValue",
|
|
10567
11069
|
protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: stateKey3 } }
|
|
10568
11070
|
};
|
|
@@ -10594,28 +11096,36 @@ function serverRequest2(requestId, stateKey3, payload) {
|
|
|
10594
11096
|
}
|
|
10595
11097
|
};
|
|
10596
11098
|
}
|
|
10597
|
-
function viewersBody() {
|
|
10598
|
-
return serverRequest2(
|
|
10599
|
-
|
|
10600
|
-
|
|
11099
|
+
function viewersBody(days) {
|
|
11100
|
+
return serverRequest2(
|
|
11101
|
+
"WvmpEntityList",
|
|
11102
|
+
`entityListQueryFilterPrefix${RANGE}`,
|
|
11103
|
+
{ sortType: "ProfileViewSortType_TIME_DESCENDING" },
|
|
11104
|
+
days
|
|
11105
|
+
);
|
|
10601
11106
|
}
|
|
10602
|
-
function viewTotalsBody() {
|
|
10603
|
-
return serverRequest2(
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10611
|
-
|
|
10612
|
-
|
|
11107
|
+
function viewTotalsBody(days) {
|
|
11108
|
+
return serverRequest2(
|
|
11109
|
+
"WvmpAnalytics",
|
|
11110
|
+
`analyticsFieldsFilterPrefix${RANGE}`,
|
|
11111
|
+
{
|
|
11112
|
+
highlightCardDimensions: [
|
|
11113
|
+
"DimensionType_LOCATION",
|
|
11114
|
+
"DimensionType_INDUSTRY",
|
|
11115
|
+
"DimensionType_ORGANIZATION"
|
|
11116
|
+
],
|
|
11117
|
+
detailsCardDimensions: ["DimensionType_ORGANIZATION"],
|
|
11118
|
+
highlightCardResultCount: 4,
|
|
11119
|
+
detailsCardResultCount: 23
|
|
11120
|
+
},
|
|
11121
|
+
days
|
|
11122
|
+
);
|
|
10613
11123
|
}
|
|
10614
|
-
var
|
|
11124
|
+
var drift13 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
10615
11125
|
var unquote4 = (s) => JSON.parse(`"${s}"`);
|
|
10616
11126
|
var STR2 = '((?:[^"\\\\]|\\\\.)+)';
|
|
10617
11127
|
var ITEM = /"viewName":"viewer-list-item"(?:,"impressionThresholds":\[[^\]]*\])?[^{}]*"semanticPosition"/;
|
|
10618
|
-
var TEXT_PROPS = /"textProps":\{"fontFamily":"[^"]*","fontSize":"(\w+)","fontStyle":"[^"]*","fontWeight":"(\w+)"
|
|
11128
|
+
var TEXT_PROPS = /"textProps":\{"fontFamily":"[^"]*","fontSize":"(\w+)","fontStyle":"[^"]*","fontWeight":"(\w+)"(?:,"\w+":"[^"]*")*?,"children":/g;
|
|
10619
11129
|
var OWN_TEXT = new RegExp(`^\\["${STR2}"\\]`);
|
|
10620
11130
|
var NESTED_TEXT = new RegExp(`\\[null,"${STR2}"`);
|
|
10621
11131
|
var LINK2 = new RegExp(`"urlValue":\\{"\\$case":"url","url":"${STR2}"`);
|
|
@@ -10626,8 +11136,8 @@ function textsOf(row) {
|
|
|
10626
11136
|
const after = row.slice((m.index ?? 0) + m[0].length, (m.index ?? 0) + m[0].length + 600);
|
|
10627
11137
|
const raw = after.match(OWN_TEXT)?.[1] ?? after.match(NESTED_TEXT)?.[1];
|
|
10628
11138
|
if (raw === void 0) return [];
|
|
10629
|
-
const
|
|
10630
|
-
return
|
|
11139
|
+
const text7 = unquote4(raw).trim();
|
|
11140
|
+
return text7 === "" ? [] : [{ size: m[1], weight: m[2], text: text7 }];
|
|
10631
11141
|
});
|
|
10632
11142
|
}
|
|
10633
11143
|
function viewerOf(row, id) {
|
|
@@ -10680,27 +11190,32 @@ function idsByViewer(rows, items) {
|
|
|
10680
11190
|
const ids = /* @__PURE__ */ new Map();
|
|
10681
11191
|
for (const row of rows.byId.values()) {
|
|
10682
11192
|
let current;
|
|
11193
|
+
let from = 0;
|
|
11194
|
+
const settle = (id) => {
|
|
11195
|
+
if (current !== void 0 && id !== void 0 && !ids.has(current)) ids.set(current, id);
|
|
11196
|
+
};
|
|
10683
11197
|
for (const m of row.matchAll(REF2)) {
|
|
10684
11198
|
const ref = m[1];
|
|
11199
|
+
const at = m.index ?? 0;
|
|
11200
|
+
settle(row.slice(from, at).match(PROFILE_ID2)?.[0]);
|
|
11201
|
+
from = at + m[0].length;
|
|
10685
11202
|
if (items.has(ref)) current = ref;
|
|
10686
|
-
else if (current !== void 0 && !ids.has(current))
|
|
10687
|
-
const id = idUnder(rows, ref, items);
|
|
10688
|
-
if (id !== void 0) ids.set(current, id);
|
|
10689
|
-
}
|
|
11203
|
+
else if (current !== void 0 && !ids.has(current)) settle(idUnder(rows, ref, items));
|
|
10690
11204
|
}
|
|
11205
|
+
settle(row.slice(from).match(PROFILE_ID2)?.[0]);
|
|
10691
11206
|
}
|
|
10692
11207
|
return ids;
|
|
10693
11208
|
}
|
|
10694
11209
|
function parseViewers(stream) {
|
|
10695
11210
|
if (!stream.includes('"viewName":"viewer-list"'))
|
|
10696
|
-
return
|
|
11211
|
+
return drift13("the profile viewers answer was not the viewer list");
|
|
10697
11212
|
const rows = new Rows(stream);
|
|
10698
11213
|
const items = new Set([...rows.byId].filter(([, row]) => ITEM.test(row)).map(([id]) => id));
|
|
10699
11214
|
const ids = idsByViewer(rows, items);
|
|
10700
11215
|
const viewers = [...items].flatMap((id) => viewerOf(rows.byId.get(id) ?? "", ids.get(id)) ?? []);
|
|
10701
11216
|
const shown = Math.max(items.size, (stream.match(new RegExp(ITEM, "g")) ?? []).length);
|
|
10702
11217
|
if (shown > 0 && viewers.length === 0)
|
|
10703
|
-
return
|
|
11218
|
+
return drift13(`${shown} profile viewers were shown but none could be read`);
|
|
10704
11219
|
let privateViewers;
|
|
10705
11220
|
for (const [id, row] of rows.byId) {
|
|
10706
11221
|
if (items.has(id) || privateViewers !== void 0) continue;
|
|
@@ -10714,13 +11229,41 @@ function parseViewers(stream) {
|
|
|
10714
11229
|
}
|
|
10715
11230
|
return privateViewers === void 0 ? { ok: true, viewers } : { ok: true, viewers, privateViewers };
|
|
10716
11231
|
}
|
|
11232
|
+
var textsIn = (s) => [...s.matchAll(PLAIN_TEXT)].map((m) => unquote4(m[1]).trim());
|
|
11233
|
+
function highlightsOf(stream) {
|
|
11234
|
+
const from = stream.indexOf('"viewName":"highlights"');
|
|
11235
|
+
if (from === -1) return [];
|
|
11236
|
+
const to = stream.indexOf('"viewName":"details"', from);
|
|
11237
|
+
const texts3 = textsIn(stream.slice(from, to === -1 ? void 0 : to)).slice(1);
|
|
11238
|
+
const out = [];
|
|
11239
|
+
for (let i = 0; i + 1 < texts3.length; i += 2)
|
|
11240
|
+
out.push({ value: texts3[i], label: texts3[i + 1] });
|
|
11241
|
+
return out;
|
|
11242
|
+
}
|
|
11243
|
+
function companiesOf(texts3) {
|
|
11244
|
+
const seen = /* @__PURE__ */ new Map();
|
|
11245
|
+
texts3.forEach((t, i) => {
|
|
11246
|
+
const share4 = t.match(/^\((\d+)\s*%\)$/)?.[1];
|
|
11247
|
+
const name = texts3[i - 1];
|
|
11248
|
+
if (share4 !== void 0 && name !== void 0 && !seen.has(name)) seen.set(name, Number(share4));
|
|
11249
|
+
});
|
|
11250
|
+
return [...seen].map(([name, share4]) => ({ name, share: share4 }));
|
|
11251
|
+
}
|
|
10717
11252
|
function parseViewTotals(stream) {
|
|
10718
|
-
const texts3 =
|
|
11253
|
+
const texts3 = textsIn(stream);
|
|
10719
11254
|
const at = texts3.findIndex((t) => /^\d[\d.,\s]*$/.test(t));
|
|
10720
|
-
if (at === -1) return
|
|
11255
|
+
if (at === -1) return drift13("the profile view totals carried no number");
|
|
10721
11256
|
const total = Number(texts3[at].replace(/\D/g, ""));
|
|
10722
|
-
const
|
|
10723
|
-
|
|
11257
|
+
const label = texts3[at + 1];
|
|
11258
|
+
const highlights = highlightsOf(stream);
|
|
11259
|
+
const companies2 = companiesOf(texts3);
|
|
11260
|
+
return {
|
|
11261
|
+
ok: true,
|
|
11262
|
+
total,
|
|
11263
|
+
...label !== void 0 && /\d/.test(label) ? { period: label } : {},
|
|
11264
|
+
...highlights.length > 0 ? { highlights } : {},
|
|
11265
|
+
...companies2.length > 0 ? { companies: companies2 } : {}
|
|
11266
|
+
};
|
|
10724
11267
|
}
|
|
10725
11268
|
|
|
10726
11269
|
// src/commands/viewers.ts
|
|
@@ -10730,7 +11273,14 @@ function liveFetch10(quiet) {
|
|
|
10730
11273
|
return err("viewers", "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
|
|
10731
11274
|
const client = createLiveClient(session.session, void 0, quiet);
|
|
10732
11275
|
return async (url, body, spendClass) => {
|
|
10733
|
-
const r = await client.request({
|
|
11276
|
+
const r = await client.request({
|
|
11277
|
+
url,
|
|
11278
|
+
method: "POST",
|
|
11279
|
+
body,
|
|
11280
|
+
headers: { referer: VIEWERS_REFERER },
|
|
11281
|
+
spendClass,
|
|
11282
|
+
operation: "viewers"
|
|
11283
|
+
});
|
|
10734
11284
|
if (!r.ok) return r;
|
|
10735
11285
|
return { ok: true, raw: r.classification.raw ?? "" };
|
|
10736
11286
|
};
|
|
@@ -10739,15 +11289,18 @@ var compactViewer = (v) => "anonymous" in v ? line(["anonymous", v.description,
|
|
|
10739
11289
|
async function runViewers(opts = {}, fetch2) {
|
|
10740
11290
|
const get = fetch2 ?? liveFetch10(opts.quiet === true);
|
|
10741
11291
|
if (typeof get !== "function") return get;
|
|
10742
|
-
const totalsRes = await get(VIEW_TOTALS_URL, viewTotalsBody(), "page");
|
|
11292
|
+
const totalsRes = await get(VIEW_TOTALS_URL, viewTotalsBody(opts.days), "page");
|
|
10743
11293
|
const totals = totalsRes.ok ? parseViewTotals(totalsRes.raw) : totalsRes;
|
|
10744
|
-
const listRes = await get(VIEWERS_URL, viewersBody(), "page");
|
|
11294
|
+
const listRes = await get(VIEWERS_URL, viewersBody(opts.days), "page");
|
|
10745
11295
|
const list2 = listRes.ok ? parseViewers(listRes.raw) : listRes;
|
|
10746
11296
|
if (!list2.ok) return err("viewers", list2.code, list2.message, list2.hint);
|
|
10747
11297
|
const shown = list2.viewers.length;
|
|
10748
|
-
const
|
|
11298
|
+
const accounted = totals.ok && (totals.total <= shown || shown + (list2.privateViewers ?? 0) === totals.total);
|
|
11299
|
+
const state2 = !totals.ok ? "unknown" : accounted ? "complete" : "partial";
|
|
11300
|
+
const { ok: _ok, ...summary } = totals.ok ? totals : { ok: false };
|
|
10749
11301
|
return ok("viewers", {
|
|
10750
|
-
...
|
|
11302
|
+
...opts.days !== void 0 ? { days: opts.days } : {},
|
|
11303
|
+
...totals.ok ? summary : { totalError: `${totals.code}: ${totals.message}` },
|
|
10751
11304
|
...list2.privateViewers !== void 0 ? { privateViewers: list2.privateViewers } : {},
|
|
10752
11305
|
items: shape(list2.viewers, opts, compactViewer),
|
|
10753
11306
|
meta: { state: state2, operation: "viewers", returnedCount: shown }
|
|
@@ -10800,6 +11353,15 @@ function output(args) {
|
|
|
10800
11353
|
function many(args, name) {
|
|
10801
11354
|
return list(args, name).flatMap((v) => v.split(",")).map((v) => v.trim()).filter((v) => v !== "");
|
|
10802
11355
|
}
|
|
11356
|
+
function viewersCommand(args) {
|
|
11357
|
+
const days = num(args, "days");
|
|
11358
|
+
if (days !== void 0 && !VIEW_RANGES.includes(days))
|
|
11359
|
+
return err("viewers", "INVALID_INPUT", `--days takes ${VIEW_RANGES.join(", ")}`);
|
|
11360
|
+
return runViewers({
|
|
11361
|
+
...output(args),
|
|
11362
|
+
...days !== void 0 ? { days } : {}
|
|
11363
|
+
});
|
|
11364
|
+
}
|
|
10803
11365
|
function jobsRequest(args) {
|
|
10804
11366
|
const filter = {};
|
|
10805
11367
|
const distance = num(args, "distance");
|
|
@@ -10842,6 +11404,8 @@ function jobsRequest(args) {
|
|
|
10842
11404
|
if (start !== void 0) req.start = start;
|
|
10843
11405
|
if (bool(args, "details")) req.details = true;
|
|
10844
11406
|
if (bool(args, "description")) req.description = true;
|
|
11407
|
+
if (bool(args, "top-applicant")) req.collection = "top-applicant";
|
|
11408
|
+
if (bool(args, "hear-back")) req.collection = "hear-back";
|
|
10845
11409
|
return req;
|
|
10846
11410
|
}
|
|
10847
11411
|
function orgs(args, name) {
|
|
@@ -11143,7 +11707,11 @@ async function dispatch(argv, now) {
|
|
|
11143
11707
|
case "jobs":
|
|
11144
11708
|
return runJobs(jobsRequest(args), output(args));
|
|
11145
11709
|
case "job":
|
|
11146
|
-
return runJob(args.positionals, output(args), void 0, {
|
|
11710
|
+
return runJob(args.positionals, output(args), void 0, {
|
|
11711
|
+
team: bool(args, "team"),
|
|
11712
|
+
insights: bool(args, "insights"),
|
|
11713
|
+
match: bool(args, "match")
|
|
11714
|
+
});
|
|
11147
11715
|
case "job-filters":
|
|
11148
11716
|
return runJobFilters(jobsRequest(args), output(args));
|
|
11149
11717
|
case "people":
|
|
@@ -11151,7 +11719,7 @@ async function dispatch(argv, now) {
|
|
|
11151
11719
|
case "people-filters":
|
|
11152
11720
|
return runPeopleFilters(peopleRequest(args), output(args));
|
|
11153
11721
|
case "viewers":
|
|
11154
|
-
return
|
|
11722
|
+
return viewersCommand(args);
|
|
11155
11723
|
case "notifications":
|
|
11156
11724
|
return runNotifications(
|
|
11157
11725
|
{ limit: num(args, "limit") ?? 25, ...bool(args, "unread") ? { unread: true } : {} },
|
|
@@ -11223,13 +11791,13 @@ function edit(args, now, deps) {
|
|
|
11223
11791
|
if (inline !== void 0) {
|
|
11224
11792
|
return err("edit", "INVALID_INPUT", "pass the new text inline or with --file, not both");
|
|
11225
11793
|
}
|
|
11226
|
-
let
|
|
11794
|
+
let text7;
|
|
11227
11795
|
try {
|
|
11228
|
-
|
|
11796
|
+
text7 = readFileSync5(file, "utf-8").replace(/\n$/, "");
|
|
11229
11797
|
} catch {
|
|
11230
11798
|
return err("edit", "INVALID_INPUT", `cannot read ${file}`);
|
|
11231
11799
|
}
|
|
11232
|
-
return runEdit(target2,
|
|
11800
|
+
return runEdit(target2, text7, now, deps);
|
|
11233
11801
|
}
|
|
11234
11802
|
function role2(args, now, deps) {
|
|
11235
11803
|
const [sub, target2] = args.positionals;
|