linkedin-relay-mcp 3.25.0 → 3.26.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 +24 -9
- package/README.md +3 -1
- package/dist/cli.js +600 -299
- 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 +527 -229
- package/dist/mcp-shim.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1106,6 +1106,24 @@ 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
|
+
},
|
|
1109
1127
|
jobPosting: {
|
|
1110
1128
|
name: "jobPosting",
|
|
1111
1129
|
transport: "voyager-restli",
|
|
@@ -1180,25 +1198,25 @@ function parseCompany(json) {
|
|
|
1180
1198
|
const data = root?.data;
|
|
1181
1199
|
if (data === void 0 || data === null) return drift("the company answer carried no data");
|
|
1182
1200
|
const included = root?.included ?? [];
|
|
1183
|
-
const
|
|
1201
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
1184
1202
|
let c = data;
|
|
1185
1203
|
if (!String(data.$type ?? "").endsWith("organization.Company")) {
|
|
1186
1204
|
const listed2 = urns(data["*elements"]);
|
|
1187
1205
|
if (listed2.length === 0)
|
|
1188
1206
|
return { ok: false, code: "NOT_FOUND", message: "no company has that name on LinkedIn" };
|
|
1189
|
-
c =
|
|
1207
|
+
c = byUrn2.get(listed2[0]);
|
|
1190
1208
|
if (c === void 0) return drift("the company was listed but not sent");
|
|
1191
1209
|
}
|
|
1192
1210
|
const id = idOf(c.entityUrn);
|
|
1193
1211
|
const name = str2(c.name);
|
|
1194
1212
|
if (id === void 0 || name === void 0) return drift("the company carried no id or name");
|
|
1195
1213
|
const followersOf = (n) => {
|
|
1196
|
-
const f =
|
|
1214
|
+
const f = byUrn2.get(n["*followingInfo"]);
|
|
1197
1215
|
return typeof f?.followerCount === "number" ? f.followerCount : void 0;
|
|
1198
1216
|
};
|
|
1199
1217
|
const related = (list2) => {
|
|
1200
1218
|
const pages = urns(list2).flatMap((u) => {
|
|
1201
|
-
const p =
|
|
1219
|
+
const p = byUrn2.get(u);
|
|
1202
1220
|
const pid = idOf(u);
|
|
1203
1221
|
const pname = str2(p?.name);
|
|
1204
1222
|
if (p === void 0 || pid === void 0 || pname === void 0) return [];
|
|
@@ -1206,7 +1224,7 @@ function parseCompany(json) {
|
|
|
1206
1224
|
});
|
|
1207
1225
|
return pages.length > 0 ? pages : void 0;
|
|
1208
1226
|
};
|
|
1209
|
-
const industry = urns(c["*companyIndustries"]).map((u) => str2(
|
|
1227
|
+
const industry = urns(c["*companyIndustries"]).map((u) => str2(byUrn2.get(u)?.localizedName)).find((x) => x !== void 0);
|
|
1210
1228
|
const locations = (Array.isArray(c.confirmedLocations) ? c.confirmedLocations : []).map(address).filter((x) => x !== void 0);
|
|
1211
1229
|
const specialties = Array.isArray(c.specialities) ? c.specialities.filter((x) => typeof x === "string") : [];
|
|
1212
1230
|
const founded = c.foundedOn?.year;
|
|
@@ -1406,6 +1424,7 @@ function classifyRedirect(location) {
|
|
|
1406
1424
|
return fail("FETCH_FAILED", `unexpected redirect to ${location || "(none)"}`);
|
|
1407
1425
|
}
|
|
1408
1426
|
function challengeIn(body) {
|
|
1427
|
+
if (!/^\s*</.test(body)) return null;
|
|
1409
1428
|
if (!CHALLENGE_MARKERS.test(body.slice(0, 4e3))) return null;
|
|
1410
1429
|
return fail("CHALLENGE_DETECTED", "a challenge page was returned with status 200", {
|
|
1411
1430
|
cooldown: "CHALLENGE_DETECTED",
|
|
@@ -1725,9 +1744,9 @@ function findRefs(data) {
|
|
|
1725
1744
|
}
|
|
1726
1745
|
function parseSingle(payload) {
|
|
1727
1746
|
const envelope = payload ?? {};
|
|
1728
|
-
const
|
|
1729
|
-
if (
|
|
1730
|
-
return
|
|
1747
|
+
const nodes2 = [...new Set(indexIncluded(envelope.included).values())];
|
|
1748
|
+
if (nodes2.length === 0) return void 0;
|
|
1749
|
+
return nodes2.find((n) => !isNoise(n) && !isDecoration(n)) ?? nodes2[0];
|
|
1731
1750
|
}
|
|
1732
1751
|
function parseCollection(payload, opts) {
|
|
1733
1752
|
const envelope = payload ?? {};
|
|
@@ -2213,10 +2232,10 @@ function balanced(s, start) {
|
|
|
2213
2232
|
return null;
|
|
2214
2233
|
}
|
|
2215
2234
|
function parseAt(s, start) {
|
|
2216
|
-
const
|
|
2217
|
-
if (
|
|
2235
|
+
const text7 = start < 0 ? null : balanced(s, start);
|
|
2236
|
+
if (text7 === null) return null;
|
|
2218
2237
|
try {
|
|
2219
|
-
return JSON.parse(
|
|
2238
|
+
return JSON.parse(text7);
|
|
2220
2239
|
} catch {
|
|
2221
2240
|
return null;
|
|
2222
2241
|
}
|
|
@@ -2581,13 +2600,13 @@ function readPost(rows, top, model) {
|
|
|
2581
2600
|
const subRow = sub === void 0 ? "" : rows.byId.get(sub.row) ?? "";
|
|
2582
2601
|
const posted = sub === void 0 ? void 0 : texts(subRow, subRow.indexOf('"viewName":"feed-actor-sub-description"'))[0];
|
|
2583
2602
|
const said = commentary === void 0 ? void 0 : firstIn(rows, commentary.under, (row) => texts(row)[0]);
|
|
2584
|
-
const
|
|
2603
|
+
const text7 = said?.v;
|
|
2585
2604
|
const post = {
|
|
2586
2605
|
id,
|
|
2587
2606
|
url: `https://www.linkedin.com/feed/update/${id}/`,
|
|
2588
2607
|
...author.fields,
|
|
2589
2608
|
...posted !== void 0 ? { posted } : {},
|
|
2590
|
-
...
|
|
2609
|
+
...text7 !== void 0 ? { text: text7 } : {},
|
|
2591
2610
|
...reactions !== void 0 ? { reactions } : {}
|
|
2592
2611
|
};
|
|
2593
2612
|
const comments = n(`commentCount-${id}`);
|
|
@@ -2727,21 +2746,22 @@ var drift2 = (message) => ({
|
|
|
2727
2746
|
hint: "the job search response changed shape; re-capture it"
|
|
2728
2747
|
});
|
|
2729
2748
|
function readCards(elements, included) {
|
|
2730
|
-
const
|
|
2749
|
+
const byUrn2 = /* @__PURE__ */ new Map();
|
|
2731
2750
|
for (const node of included) {
|
|
2732
|
-
if (typeof node.entityUrn === "string")
|
|
2751
|
+
if (typeof node.entityUrn === "string") byUrn2.set(node.entityUrn, node);
|
|
2733
2752
|
}
|
|
2734
2753
|
const jobs = [];
|
|
2735
2754
|
const unknownTypes = {};
|
|
2736
2755
|
let unresolved = 0;
|
|
2737
2756
|
for (const el of elements) {
|
|
2738
|
-
const union = el.jobCardUnion ?? {};
|
|
2757
|
+
const union = el.jobCardUnion ?? el.jobCard ?? {};
|
|
2739
2758
|
const ref = union["*jobPostingCard"];
|
|
2740
2759
|
if (typeof ref !== "string") {
|
|
2741
|
-
for (const kind of Object.
|
|
2760
|
+
for (const [kind, v] of Object.entries(union))
|
|
2761
|
+
if (v !== null && !kind.startsWith("$")) unknownTypes[kind] = (unknownTypes[kind] ?? 0) + 1;
|
|
2742
2762
|
continue;
|
|
2743
2763
|
}
|
|
2744
|
-
const card2 =
|
|
2764
|
+
const card2 = byUrn2.get(ref);
|
|
2745
2765
|
const job = card2 === void 0 ? void 0 : cardToJob(card2);
|
|
2746
2766
|
if (job === void 0) unresolved++;
|
|
2747
2767
|
else if (!jobs.some((j) => j.id === job.id)) jobs.push(job);
|
|
@@ -2840,10 +2860,10 @@ function parseJobBatch(json) {
|
|
|
2840
2860
|
if (results === null || typeof results !== "object")
|
|
2841
2861
|
return drift2("the batch job response carried no results");
|
|
2842
2862
|
const included = root?.included ?? [];
|
|
2843
|
-
const
|
|
2863
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
2844
2864
|
const jobs = [];
|
|
2845
2865
|
for (const ref of Object.values(results)) {
|
|
2846
|
-
const node = typeof ref === "string" ?
|
|
2866
|
+
const node = typeof ref === "string" ? byUrn2.get(ref) : ref;
|
|
2847
2867
|
const job = node === void 0 ? void 0 : postingToJob(node, included);
|
|
2848
2868
|
if (job !== void 0) jobs.push(job);
|
|
2849
2869
|
}
|
|
@@ -3144,7 +3164,7 @@ function classify2(item) {
|
|
|
3144
3164
|
return kinds.every((k) => FURNITURE.has(k)) ? "furniture" : kinds;
|
|
3145
3165
|
}
|
|
3146
3166
|
function readItems(c, included, toRow) {
|
|
3147
|
-
const
|
|
3167
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
3148
3168
|
const people = [];
|
|
3149
3169
|
const unknownTypes = {};
|
|
3150
3170
|
let excluded = 0;
|
|
@@ -3157,7 +3177,7 @@ function readItems(c, included, toRow) {
|
|
|
3157
3177
|
} else if (Array.isArray(kind)) {
|
|
3158
3178
|
for (const k of kind) unknownTypes[k] = (unknownTypes[k] ?? 0) + 1;
|
|
3159
3179
|
} else {
|
|
3160
|
-
const row =
|
|
3180
|
+
const row = byUrn2.get(kind.ref);
|
|
3161
3181
|
const person = row === void 0 ? void 0 : toRow(row);
|
|
3162
3182
|
if (person === void 0) unresolved++;
|
|
3163
3183
|
else if (!people.some((p) => p.id === person.id)) people.push(person);
|
|
@@ -3237,11 +3257,11 @@ function parseOrgHits(json) {
|
|
|
3237
3257
|
const c = clustersOf(json);
|
|
3238
3258
|
if (c === void 0) return drift3("the organisation search returned no result list");
|
|
3239
3259
|
const included = json.included ?? [];
|
|
3240
|
-
const
|
|
3260
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
3241
3261
|
const hits = [];
|
|
3242
3262
|
for (const el of c.elements ?? []) {
|
|
3243
3263
|
for (const { item } of el.items ?? []) {
|
|
3244
|
-
const row =
|
|
3264
|
+
const row = byUrn2.get(item?.["*entityResult"]);
|
|
3245
3265
|
const id = String(row?.entityUrn ?? "").match(/urn:li:fsd_company:(\d+)/)?.[1];
|
|
3246
3266
|
const name = text3(row?.title);
|
|
3247
3267
|
if (id !== void 0 && name !== void 0 && !hits.some((h) => h.id === id))
|
|
@@ -3648,13 +3668,13 @@ function compactPost(p) {
|
|
|
3648
3668
|
p.comments !== void 0 ? `${p.comments} comments` : void 0,
|
|
3649
3669
|
p.reposts !== void 0 ? `${p.reposts} reposts` : void 0
|
|
3650
3670
|
].filter(Boolean);
|
|
3651
|
-
const
|
|
3671
|
+
const text7 = p.text?.replace(/\s+/g, " ");
|
|
3652
3672
|
return line([
|
|
3653
3673
|
p.id,
|
|
3654
3674
|
p.author,
|
|
3655
3675
|
p.posted,
|
|
3656
3676
|
counts2.length > 0 ? counts2.join(" \xB7 ") : void 0,
|
|
3657
|
-
|
|
3677
|
+
text7 !== void 0 && text7.length > 160 ? `${text7.slice(0, 157)}\u2026` : text7,
|
|
3658
3678
|
p.url,
|
|
3659
3679
|
p.matched !== void 0 ? `matched: ${p.matched.join(" + ")}` : void 0
|
|
3660
3680
|
]);
|
|
@@ -3975,7 +3995,7 @@ async function fetchCommentMenu(ref, trackingId, client) {
|
|
|
3975
3995
|
const stream = result.classification.raw ?? "";
|
|
3976
3996
|
return { ok: true, stream };
|
|
3977
3997
|
}
|
|
3978
|
-
function textStates(payload,
|
|
3998
|
+
function textStates(payload, text7) {
|
|
3979
3999
|
const keyOf = (...names) => {
|
|
3980
4000
|
for (const n of names) {
|
|
3981
4001
|
const slot = payload[n];
|
|
@@ -3994,12 +4014,12 @@ function textStates(payload, text6) {
|
|
|
3994
4014
|
protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: key } }
|
|
3995
4015
|
});
|
|
3996
4016
|
return [
|
|
3997
|
-
entry3(plain2,
|
|
3998
|
-
entry3(rich, { text:
|
|
4017
|
+
entry3(plain2, text7, "stringValue"),
|
|
4018
|
+
entry3(rich, { text: text7, attribute: [], $type: "TextModel", source: "local" }, "textModelForWrite")
|
|
3999
4019
|
];
|
|
4000
4020
|
}
|
|
4001
|
-
function editStates(payload,
|
|
4002
|
-
return textStates(payload,
|
|
4021
|
+
function editStates(payload, text7) {
|
|
4022
|
+
return textStates(payload, text7);
|
|
4003
4023
|
}
|
|
4004
4024
|
async function runCommentAction(ref, operation, trackingId, client, newText) {
|
|
4005
4025
|
const menu = await fetchCommentMenu(ref, trackingId, client);
|
|
@@ -4252,12 +4272,12 @@ var CATEGORY = {
|
|
|
4252
4272
|
VIDEO: "VIDEO",
|
|
4253
4273
|
DOCUMENT: "NATIVE_DOCUMENT"
|
|
4254
4274
|
};
|
|
4255
|
-
function sharePayload(
|
|
4275
|
+
function sharePayload(text7, visibility, media = [], scheduledAt) {
|
|
4256
4276
|
const schedule = scheduledAt === void 0 ? { postState: "PUBLISHED" } : { postState: "SCHEDULED", scheduledAt };
|
|
4257
4277
|
return {
|
|
4258
4278
|
visibleToConnectionsOnly: visibility === "CONNECTIONS",
|
|
4259
4279
|
externalAudienceProviders: [],
|
|
4260
|
-
commentaryV2: { text:
|
|
4280
|
+
commentaryV2: { text: text7, attributes: [] },
|
|
4261
4281
|
origin: "FEED",
|
|
4262
4282
|
allowedCommentersScope: "ALL",
|
|
4263
4283
|
...schedule,
|
|
@@ -4371,15 +4391,15 @@ async function share(confirmed, client, bytes) {
|
|
|
4371
4391
|
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
4392
|
} : { ok: true, id };
|
|
4373
4393
|
}
|
|
4374
|
-
function editPostBody(
|
|
4375
|
-
return { patch: { $set: { commentaryV2: { text:
|
|
4394
|
+
function editPostBody(text7) {
|
|
4395
|
+
return { patch: { $set: { commentaryV2: { text: text7, attributes: [] } } } };
|
|
4376
4396
|
}
|
|
4377
4397
|
async function editPost(confirmed, client) {
|
|
4378
|
-
const { urn, text:
|
|
4398
|
+
const { urn, text: text7 } = confirmed.payload;
|
|
4379
4399
|
const result = await client.request({
|
|
4380
4400
|
url: deleteUrl(urn),
|
|
4381
4401
|
method: "POST",
|
|
4382
|
-
body: editPostBody(
|
|
4402
|
+
body: editPostBody(text7),
|
|
4383
4403
|
spendClass: "write",
|
|
4384
4404
|
operation: "edit-post"
|
|
4385
4405
|
});
|
|
@@ -4389,7 +4409,7 @@ async function editPost(confirmed, client) {
|
|
|
4389
4409
|
return out;
|
|
4390
4410
|
}
|
|
4391
4411
|
const held = result.json?.data?.commentary?.text;
|
|
4392
|
-
if (held !==
|
|
4412
|
+
if (held !== text7) {
|
|
4393
4413
|
return {
|
|
4394
4414
|
ok: false,
|
|
4395
4415
|
code: "SCHEMA_DRIFT",
|
|
@@ -4450,8 +4470,8 @@ async function createPoll(poll, client) {
|
|
|
4450
4470
|
}
|
|
4451
4471
|
return { ok: true, urn };
|
|
4452
4472
|
}
|
|
4453
|
-
function firstUrl(
|
|
4454
|
-
const found =
|
|
4473
|
+
function firstUrl(text7) {
|
|
4474
|
+
const found = text7.match(/https?:\/\/[^\s<>"]+/)?.[0];
|
|
4455
4475
|
if (found === void 0) return null;
|
|
4456
4476
|
let url = found.replace(/[.,;:!?'"]+$/, "");
|
|
4457
4477
|
if (url.endsWith(")") && !url.includes("(")) url = url.slice(0, -1);
|
|
@@ -4615,8 +4635,8 @@ function previewLines2(post) {
|
|
|
4615
4635
|
" about to delete, or that it is yours."
|
|
4616
4636
|
];
|
|
4617
4637
|
}
|
|
4618
|
-
const
|
|
4619
|
-
const shown =
|
|
4638
|
+
const text7 = typeof post.text === "string" ? post.text : "(no text \u2014 media-only post?)";
|
|
4639
|
+
const shown = text7.length > PREVIEW_CHARS ? `${text7.slice(0, PREVIEW_CHARS)}\u2026` : text7;
|
|
4620
4640
|
const lines = [`content "${shown.replace(/\n/g, " ")}"`];
|
|
4621
4641
|
if (typeof post.scheduledAt === "string") {
|
|
4622
4642
|
lines.push(`status scheduled, publishes ${post.scheduledAt} unless cancelled`);
|
|
@@ -4867,14 +4887,14 @@ var txt = (v) => {
|
|
|
4867
4887
|
if (t !== null && typeof t === "object") return txt(t);
|
|
4868
4888
|
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
4869
4889
|
};
|
|
4870
|
-
function organizerOf(e,
|
|
4890
|
+
function organizerOf(e, byUrn2) {
|
|
4871
4891
|
const o = e.organizer ?? {};
|
|
4872
|
-
const company =
|
|
4892
|
+
const company = byUrn2.get(o["*organizingCompanyUrn"]);
|
|
4873
4893
|
if (typeof company?.name === "string") {
|
|
4874
4894
|
const id = String(company.entityUrn).split(":").pop();
|
|
4875
4895
|
return { name: company.name, kind: "company", url: `https://www.linkedin.com/company/${id}/` };
|
|
4876
4896
|
}
|
|
4877
|
-
const person =
|
|
4897
|
+
const person = byUrn2.get(o["*organizingProfileUrn"] ?? o.organizingProfileUrn);
|
|
4878
4898
|
const name = [person?.firstName, person?.lastName].filter((x) => typeof x === "string").join(" ");
|
|
4879
4899
|
if (name !== "") {
|
|
4880
4900
|
const vanity = person?.publicIdentifier;
|
|
@@ -4898,11 +4918,11 @@ function parseEvent(json) {
|
|
|
4898
4918
|
hint: "re-capture the event page"
|
|
4899
4919
|
};
|
|
4900
4920
|
}
|
|
4901
|
-
const
|
|
4921
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
4902
4922
|
const range2 = e.timeRange ?? {};
|
|
4903
4923
|
const address2 = e.address ?? null;
|
|
4904
4924
|
const place = address2 === null ? void 0 : [address2.city, address2.geographicArea, address2.country].filter((x) => typeof x === "string" && x !== "").join(", ");
|
|
4905
|
-
const status =
|
|
4925
|
+
const status = byUrn2.get(e["*viewerStatus"])?.scheduledContentViewerStatus;
|
|
4906
4926
|
const attendees = Number(
|
|
4907
4927
|
txt(e.socialProof)?.match(/^(\d[\d,.\s]*)/)?.[1]?.replace(/[,.\s]/g, "")
|
|
4908
4928
|
);
|
|
@@ -4925,7 +4945,7 @@ function parseEvent(json) {
|
|
|
4925
4945
|
set("state", typeof e.lifecycleState === "string" ? e.lifecycleState : void 0);
|
|
4926
4946
|
if (e.cancelled === true) out.cancelled = true;
|
|
4927
4947
|
set("attendees", Number.isFinite(attendees) ? attendees : void 0);
|
|
4928
|
-
set("organizer", organizerOf(e,
|
|
4948
|
+
set("organizer", organizerOf(e, byUrn2));
|
|
4929
4949
|
set("place", place);
|
|
4930
4950
|
set("site", typeof e.externalUrl === "string" ? e.externalUrl : void 0);
|
|
4931
4951
|
if (e.privateEvent === true) out.private = true;
|
|
@@ -5033,6 +5053,158 @@ async function runEvent(inputs, opts = {}, fetch2) {
|
|
|
5033
5053
|
});
|
|
5034
5054
|
}
|
|
5035
5055
|
|
|
5056
|
+
// src/engine/job-premium.ts
|
|
5057
|
+
function graphql(name) {
|
|
5058
|
+
const c = CONTRACTS[name];
|
|
5059
|
+
if (c?.queryId === void 0) throw new Error(`job contract '${name}' is missing`);
|
|
5060
|
+
return { path: c.path, queryId: c.queryId };
|
|
5061
|
+
}
|
|
5062
|
+
var COLLECTION_PAGE = 100;
|
|
5063
|
+
function jobCollectionUrl(slug, start, count3) {
|
|
5064
|
+
const c = graphql("jobCollection");
|
|
5065
|
+
const variables = `(count:${count3},jobCollectionSlug:${slug},query:(origin:GENERIC_JOB_COLLECTIONS_LANDING),start:${start})`;
|
|
5066
|
+
return `${c.path}?variables=${variables}&queryId=${c.queryId}`;
|
|
5067
|
+
}
|
|
5068
|
+
function jobInsightsUrl(id) {
|
|
5069
|
+
const c = graphql("jobDetailSections");
|
|
5070
|
+
const urn = encodeURIComponent(`urn:li:fsd_jobPosting:${id}`);
|
|
5071
|
+
const variables = `(cardSectionTypes:List(JOB_APPLICANT_INSIGHTS,COMPANY_INSIGHTS_CARD),jobPostingUrn:${urn},includeSecondaryActionsV2:true)`;
|
|
5072
|
+
return `${c.path}?includeWebMetadata=true&variables=${variables}&queryId=${c.queryId}`;
|
|
5073
|
+
}
|
|
5074
|
+
var drift5 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
5075
|
+
var text4 = (v) => {
|
|
5076
|
+
const t = v?.text;
|
|
5077
|
+
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
5078
|
+
};
|
|
5079
|
+
var nodes = (v) => Array.isArray(v) ? v : [];
|
|
5080
|
+
function defined5(obj) {
|
|
5081
|
+
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
5082
|
+
return obj;
|
|
5083
|
+
}
|
|
5084
|
+
function parseJobCollection(json) {
|
|
5085
|
+
const root = json;
|
|
5086
|
+
const collection2 = root?.data?.data?.jobsDashJobCardsByJobCollections;
|
|
5087
|
+
if (collection2 === void 0 || collection2 === null) {
|
|
5088
|
+
const why = nodes(root?.data?.errors)[0]?.message;
|
|
5089
|
+
return drift5(`the job collection was not served${typeof why === "string" ? `: ${why}` : ""}`);
|
|
5090
|
+
}
|
|
5091
|
+
return parseJobCards({ data: collection2, included: root?.included ?? [] });
|
|
5092
|
+
}
|
|
5093
|
+
function byUrn(included) {
|
|
5094
|
+
const map = /* @__PURE__ */ new Map();
|
|
5095
|
+
for (const n of included) if (typeof n.entityUrn === "string") map.set(n.entityUrn, n);
|
|
5096
|
+
return map;
|
|
5097
|
+
}
|
|
5098
|
+
var nameOf = (urns2, urn) => {
|
|
5099
|
+
const n = typeof urn === "string" ? urns2.get(urn)?.name : void 0;
|
|
5100
|
+
return typeof n === "string" ? n : void 0;
|
|
5101
|
+
};
|
|
5102
|
+
function applicantsOf(a, urns2) {
|
|
5103
|
+
const seniority = nodes(a.seniorityDetails).flatMap((s) => {
|
|
5104
|
+
const level = nameOf(urns2, s["*seniority"]);
|
|
5105
|
+
return level === void 0 || typeof s.percentage !== "number" ? [] : [defined5({ level, share: s.percentage, count: s.count })];
|
|
5106
|
+
});
|
|
5107
|
+
const education = nodes(a.degreeDetails).flatMap((d) => {
|
|
5108
|
+
const degree = nameOf(urns2, d["*degree"]);
|
|
5109
|
+
return degree === void 0 || typeof d.percentage !== "number" ? [] : [{ degree, share: d.percentage }];
|
|
5110
|
+
});
|
|
5111
|
+
const skills = nodes(a.skillDetails);
|
|
5112
|
+
const locations = nodes(a.locationDetails);
|
|
5113
|
+
return defined5({
|
|
5114
|
+
total: a.applicantCount,
|
|
5115
|
+
lastDay: typeof a.applicantsInPastDay === "number" ? a.applicantsInPastDay : void 0,
|
|
5116
|
+
seniority: seniority.length > 0 ? seniority : void 0,
|
|
5117
|
+
education: education.length > 0 ? education : void 0,
|
|
5118
|
+
rankPercentile: typeof a.applicantRankPercentile === "number" ? a.applicantRankPercentile : void 0,
|
|
5119
|
+
skills: skills.length > 0 ? skills : void 0,
|
|
5120
|
+
locations: locations.length > 0 ? locations : void 0
|
|
5121
|
+
});
|
|
5122
|
+
}
|
|
5123
|
+
function headcountOf(growth) {
|
|
5124
|
+
const months = nodes(growth?.headcountGrowth).flatMap((m) => {
|
|
5125
|
+
const on = m.startedOn;
|
|
5126
|
+
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 }] : [];
|
|
5127
|
+
});
|
|
5128
|
+
const latest = months[0];
|
|
5129
|
+
if (latest === void 0) return void 0;
|
|
5130
|
+
const back = (n) => months[n]?.count;
|
|
5131
|
+
const yearAgo = back(12);
|
|
5132
|
+
return defined5({
|
|
5133
|
+
asOf: latest.month,
|
|
5134
|
+
now: latest.count,
|
|
5135
|
+
sixMonthsAgo: back(6),
|
|
5136
|
+
yearAgo,
|
|
5137
|
+
twoYearsAgo: back(24),
|
|
5138
|
+
growth1y: yearAgo !== void 0 && yearAgo > 0 ? Math.round((latest.count - yearAgo) / yearAgo * 1e3) / 10 : void 0
|
|
5139
|
+
});
|
|
5140
|
+
}
|
|
5141
|
+
var str4 = (v) => typeof v === "string" ? v : void 0;
|
|
5142
|
+
function trendOf(s, urns2) {
|
|
5143
|
+
const company = urns2.get(String(s["*company"]));
|
|
5144
|
+
const fn = str4(s.formattedJobFunction);
|
|
5145
|
+
return defined5({
|
|
5146
|
+
name: str4(company?.name),
|
|
5147
|
+
url: str4(company?.url),
|
|
5148
|
+
headcount: headcountOf(s.employeeGrowth),
|
|
5149
|
+
function: fn !== void 0 ? { name: fn, ...headcountOf(s.employeeGrowthForFunction) } : void 0,
|
|
5150
|
+
medianTenure: text4(s.employeeGrowth?.medianTenureYears)
|
|
5151
|
+
});
|
|
5152
|
+
}
|
|
5153
|
+
function landscapeOf(s) {
|
|
5154
|
+
const competitors = nodes(s.competitors).flatMap((c) => {
|
|
5155
|
+
const name = text4(c.title);
|
|
5156
|
+
return name === void 0 ? [] : [defined5({ name, industry: text4(c.subtitle), url: str4(c.navigationUrl) })];
|
|
5157
|
+
});
|
|
5158
|
+
return defined5({
|
|
5159
|
+
landscape: text4(s.aiqInsightsText),
|
|
5160
|
+
competitors: competitors.length > 0 ? competitors : void 0
|
|
5161
|
+
});
|
|
5162
|
+
}
|
|
5163
|
+
var SECTIONS = {
|
|
5164
|
+
jobPostingCompanyInsights: trendOf,
|
|
5165
|
+
headcountAIQInsights: (s) => defined5({ hiring: text4(s.aiqInsightsText) }),
|
|
5166
|
+
strategicPrioritiesAIQInsights: (s) => defined5({ priorities: text4(s.insightsText) }),
|
|
5167
|
+
competitiveLandscapeAIQInsights: landscapeOf
|
|
5168
|
+
};
|
|
5169
|
+
function companyOf(card2, urns2, unknown) {
|
|
5170
|
+
const out = {};
|
|
5171
|
+
for (const el of nodes(card2.elements)) {
|
|
5172
|
+
for (const [kind, section] of Object.entries(el.companyInsights ?? {})) {
|
|
5173
|
+
if (section === null || kind.startsWith("$")) continue;
|
|
5174
|
+
const read = SECTIONS[kind];
|
|
5175
|
+
if (read === void 0) unknown[kind] = (unknown[kind] ?? 0) + 1;
|
|
5176
|
+
else Object.assign(out, read(section, urns2));
|
|
5177
|
+
}
|
|
5178
|
+
}
|
|
5179
|
+
return out;
|
|
5180
|
+
}
|
|
5181
|
+
function parseJobInsights(json) {
|
|
5182
|
+
const root = json;
|
|
5183
|
+
const sections = root?.data?.data?.jobsDashJobPostingDetailSectionsByCardSectionTypes;
|
|
5184
|
+
if (sections === void 0 || sections === null || !Array.isArray(sections.elements))
|
|
5185
|
+
return drift5("the job detail sections were not in the answer");
|
|
5186
|
+
const urns2 = byUrn(root?.included ?? []);
|
|
5187
|
+
const unknownSections = {};
|
|
5188
|
+
let applicants;
|
|
5189
|
+
let company;
|
|
5190
|
+
for (const el of nodes(sections.elements)) {
|
|
5191
|
+
for (const part2 of nodes(el.jobPostingDetailSection)) {
|
|
5192
|
+
const a = urns2.get(String(part2["*jobApplicantInsightsUrn"]));
|
|
5193
|
+
if (a !== void 0 && typeof a.applicantCount === "number")
|
|
5194
|
+
applicants = applicantsOf(a, urns2);
|
|
5195
|
+
const posting = urns2.get(String(part2["*companyInsightsCard"]));
|
|
5196
|
+
const card2 = posting?.companyInsightsCard;
|
|
5197
|
+
if (card2 !== void 0 && card2 !== null) company = companyOf(card2, urns2, unknownSections);
|
|
5198
|
+
}
|
|
5199
|
+
}
|
|
5200
|
+
return {
|
|
5201
|
+
ok: true,
|
|
5202
|
+
...applicants !== void 0 ? { applicants } : {},
|
|
5203
|
+
...company !== void 0 && Object.keys(company).length > 0 ? { company } : {},
|
|
5204
|
+
unknownSections
|
|
5205
|
+
};
|
|
5206
|
+
}
|
|
5207
|
+
|
|
5036
5208
|
// src/commands/jobs.ts
|
|
5037
5209
|
function liveFetch5(command, quiet) {
|
|
5038
5210
|
const session = loadSession();
|
|
@@ -5109,6 +5281,7 @@ async function addDetails(get, rows, withDescription) {
|
|
|
5109
5281
|
return read.stoppedBy === void 0 ? { unread } : { unread, stoppedBy: read.stoppedBy };
|
|
5110
5282
|
}
|
|
5111
5283
|
async function runJobs(req, opts = {}, fetch2) {
|
|
5284
|
+
if (req.collection !== void 0) return runCollection(req, req.collection, opts, fetch2);
|
|
5112
5285
|
const sets = keywordSets(req.keywords);
|
|
5113
5286
|
const hasQuery = sets.length > 0 || [req.location, req.geoId].some((v) => v !== void 0 && v !== "");
|
|
5114
5287
|
if (!hasQuery) {
|
|
@@ -5175,6 +5348,65 @@ async function runJobs(req, opts = {}, fetch2) {
|
|
|
5175
5348
|
meta
|
|
5176
5349
|
});
|
|
5177
5350
|
}
|
|
5351
|
+
async function runCollection(req, collection2, opts, fetch2) {
|
|
5352
|
+
const searched = keywordSets(req.keywords).length > 0 || req.location || req.geoId;
|
|
5353
|
+
const selection3 = jobFilterSelection(req.filter ?? {});
|
|
5354
|
+
const filtered = !selection3.ok || Object.keys(selection3.filters).length > 0;
|
|
5355
|
+
if (searched || filtered)
|
|
5356
|
+
return err(
|
|
5357
|
+
"jobs",
|
|
5358
|
+
"INVALID_INPUT",
|
|
5359
|
+
`--${collection2} is LinkedIn's own list: it takes no keywords, location or filters`
|
|
5360
|
+
);
|
|
5361
|
+
const get = fetch2 ?? liveFetch5("jobs", opts.quiet === true);
|
|
5362
|
+
if (typeof get !== "function") return get;
|
|
5363
|
+
const first = Math.max(0, req.start ?? 0);
|
|
5364
|
+
const want = Math.max(1, Math.min(req.limit, PAGING3.max - first));
|
|
5365
|
+
const fetchPage = async (_keywords, start) => {
|
|
5366
|
+
const res = await get(jobCollectionUrl(collection2, start, COLLECTION_PAGE), "jobSearch");
|
|
5367
|
+
const page = res.ok ? parseJobCollection(res.json) : res;
|
|
5368
|
+
if (!page.ok) return page;
|
|
5369
|
+
return {
|
|
5370
|
+
ok: true,
|
|
5371
|
+
items: page.jobs,
|
|
5372
|
+
...page.total !== void 0 ? { total: page.total } : {},
|
|
5373
|
+
unknownTypes: page.unknownTypes
|
|
5374
|
+
};
|
|
5375
|
+
};
|
|
5376
|
+
const merged = await searchAll(fetchPage, [void 0], first, want, PAGING3);
|
|
5377
|
+
if (merged.rows.length === 0 && merged.failure !== void 0) {
|
|
5378
|
+
const f = merged.failure;
|
|
5379
|
+
return err("jobs", f.code, f.message, f.hint);
|
|
5380
|
+
}
|
|
5381
|
+
let extra = {};
|
|
5382
|
+
if (req.details === true) {
|
|
5383
|
+
const added = await addDetails(get, merged.rows, req.description === true);
|
|
5384
|
+
extra = {
|
|
5385
|
+
unread: added.unread,
|
|
5386
|
+
...added.stoppedBy !== void 0 ? { readStop: added.stoppedBy } : {}
|
|
5387
|
+
};
|
|
5388
|
+
}
|
|
5389
|
+
return ok("jobs", {
|
|
5390
|
+
collection: collection2,
|
|
5391
|
+
items: shape2(merged.rows, opts, compactJob),
|
|
5392
|
+
meta: metaOf("jobs", merged, true, first, { unread: 0, ...extra })
|
|
5393
|
+
});
|
|
5394
|
+
}
|
|
5395
|
+
async function addInsights(get, jobs) {
|
|
5396
|
+
for (const job of jobs) {
|
|
5397
|
+
const res = await get(jobInsightsUrl(job.id), "jobRead");
|
|
5398
|
+
const read = res.ok ? parseJobInsights(res.json) : res;
|
|
5399
|
+
if (!read.ok) {
|
|
5400
|
+
job.premiumError = `${read.code}: ${read.message}`;
|
|
5401
|
+
continue;
|
|
5402
|
+
}
|
|
5403
|
+
const { ok: _ok, unknownSections, ...insights } = read;
|
|
5404
|
+
job.premium = {
|
|
5405
|
+
...insights,
|
|
5406
|
+
...Object.keys(unknownSections).length > 0 ? { unknownSections } : {}
|
|
5407
|
+
};
|
|
5408
|
+
}
|
|
5409
|
+
}
|
|
5178
5410
|
async function addTeams(get, jobs) {
|
|
5179
5411
|
for (const job of jobs) {
|
|
5180
5412
|
const res = await get(HIRING_TEAM_URL, "page", hiringTeamBody(job.id));
|
|
@@ -5203,8 +5435,10 @@ async function runJob(input, opts = {}, fetch2, req = {}) {
|
|
|
5203
5435
|
if (!res.ok) return err("job", res.code, res.message, res.hint);
|
|
5204
5436
|
const detail = parseJobDetail(res.json);
|
|
5205
5437
|
if (!detail.ok) return err("job", detail.code, detail.message, detail.hint);
|
|
5206
|
-
|
|
5207
|
-
|
|
5438
|
+
const job = detail.job;
|
|
5439
|
+
if (req.team === true) await addTeams(get, [job]);
|
|
5440
|
+
if (req.insights === true) await addInsights(get, [job]);
|
|
5441
|
+
return ok("job", job);
|
|
5208
5442
|
}
|
|
5209
5443
|
const read = await readJobs(get, wanted);
|
|
5210
5444
|
if (read.jobs.size === 0 && read.stoppedBy !== void 0)
|
|
@@ -5212,6 +5446,7 @@ async function runJob(input, opts = {}, fetch2, req = {}) {
|
|
|
5212
5446
|
const unread = wanted.filter((id) => !read.jobs.has(id));
|
|
5213
5447
|
const jobs = wanted.flatMap((id) => read.jobs.get(id) ?? []);
|
|
5214
5448
|
if (req.team === true) await addTeams(get, jobs);
|
|
5449
|
+
if (req.insights === true) await addInsights(get, jobs);
|
|
5215
5450
|
return ok("job", {
|
|
5216
5451
|
items: shape2(
|
|
5217
5452
|
jobs,
|
|
@@ -5590,7 +5825,7 @@ var txt2 = (v) => {
|
|
|
5590
5825
|
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
5591
5826
|
};
|
|
5592
5827
|
var iso = (ms) => typeof ms === "number" ? new Date(ms).toISOString() : void 0;
|
|
5593
|
-
function
|
|
5828
|
+
function defined6(obj) {
|
|
5594
5829
|
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
5595
5830
|
return obj;
|
|
5596
5831
|
}
|
|
@@ -5600,7 +5835,7 @@ function participantOf(p) {
|
|
|
5600
5835
|
const m = t.member;
|
|
5601
5836
|
const name = [txt2(m.firstName), txt2(m.lastName)].filter(Boolean).join(" ");
|
|
5602
5837
|
const url = typeof m.profileUrl === "string" ? `${m.profileUrl.replace(/\/$/, "")}/` : void 0;
|
|
5603
|
-
return
|
|
5838
|
+
return defined6({
|
|
5604
5839
|
name: name !== "" ? name : "LinkedIn Member",
|
|
5605
5840
|
kind: "person",
|
|
5606
5841
|
headline: txt2(m.headline),
|
|
@@ -5610,7 +5845,7 @@ function participantOf(p) {
|
|
|
5610
5845
|
}
|
|
5611
5846
|
if (t.organization) {
|
|
5612
5847
|
const o = t.organization;
|
|
5613
|
-
return
|
|
5848
|
+
return defined6({
|
|
5614
5849
|
name: txt2(o.name) ?? "an organization",
|
|
5615
5850
|
kind: "organization",
|
|
5616
5851
|
url: typeof o.pageUrl === "string" ? o.pageUrl : void 0
|
|
@@ -5620,12 +5855,12 @@ function participantOf(p) {
|
|
|
5620
5855
|
return void 0;
|
|
5621
5856
|
}
|
|
5622
5857
|
var isMe = (urn, mailbox2) => typeof urn === "string" && urn.includes(mailbox2);
|
|
5623
|
-
function messageOf(m,
|
|
5858
|
+
function messageOf(m, byUrn2, mailbox2) {
|
|
5624
5859
|
const sender = m["*sender"] ?? m["*actor"];
|
|
5625
5860
|
const fromMe = isMe(sender, mailbox2);
|
|
5626
|
-
const who = fromMe ? void 0 : participantOf(
|
|
5861
|
+
const who = fromMe ? void 0 : participantOf(byUrn2.get(sender));
|
|
5627
5862
|
const render2 = Array.isArray(m.renderContent) ? m.renderContent : [];
|
|
5628
|
-
return
|
|
5863
|
+
return defined6({
|
|
5629
5864
|
from: fromMe ? "you" : who?.name ?? "unknown",
|
|
5630
5865
|
fromMe,
|
|
5631
5866
|
at: iso(m.deliveredAt),
|
|
@@ -5634,7 +5869,7 @@ function messageOf(m, byUrn, mailbox2) {
|
|
|
5634
5869
|
sponsored: render2.some((r) => r.conversationAdsMessageContent) ? true : void 0
|
|
5635
5870
|
});
|
|
5636
5871
|
}
|
|
5637
|
-
var
|
|
5872
|
+
var drift6 = (message) => ({
|
|
5638
5873
|
ok: false,
|
|
5639
5874
|
code: "SCHEMA_DRIFT",
|
|
5640
5875
|
message,
|
|
@@ -5654,26 +5889,26 @@ function refsOf(top) {
|
|
|
5654
5889
|
function parseConversations(json, mailbox2) {
|
|
5655
5890
|
const top = collectionOf(json);
|
|
5656
5891
|
const refs = refsOf(top);
|
|
5657
|
-
if (refs === void 0) return
|
|
5892
|
+
if (refs === void 0) return drift6("the conversation list was missing");
|
|
5658
5893
|
const included = json.included ?? [];
|
|
5659
|
-
const
|
|
5894
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
5660
5895
|
const conversations = [];
|
|
5661
5896
|
for (const ref of refs) {
|
|
5662
|
-
const c =
|
|
5897
|
+
const c = byUrn2.get(ref);
|
|
5663
5898
|
if (c === void 0) continue;
|
|
5664
|
-
const parts = (c["*conversationParticipants"] ?? []).filter((u) => !isMe(u, mailbox2)).map((u) => participantOf(
|
|
5899
|
+
const parts = (c["*conversationParticipants"] ?? []).filter((u) => !isMe(u, mailbox2)).map((u) => participantOf(byUrn2.get(u))).filter((p) => p !== void 0);
|
|
5665
5900
|
const lastRef = c.messages?.["*elements"]?.[0];
|
|
5666
|
-
const last = lastRef === void 0 ? void 0 :
|
|
5901
|
+
const last = lastRef === void 0 ? void 0 : byUrn2.get(lastRef);
|
|
5667
5902
|
const categories = Array.isArray(c.categories) ? c.categories : [];
|
|
5668
5903
|
conversations.push(
|
|
5669
|
-
|
|
5904
|
+
defined6({
|
|
5670
5905
|
id: String(c.entityUrn),
|
|
5671
5906
|
url: typeof c.conversationUrl === "string" ? c.conversationUrl : void 0,
|
|
5672
5907
|
with: parts,
|
|
5673
5908
|
title: c.groupChat === true ? txt2(c.title) : void 0,
|
|
5674
5909
|
unread: typeof c.unreadCount === "number" ? c.unreadCount : 0,
|
|
5675
5910
|
lastActivity: iso(c.lastActivityAt),
|
|
5676
|
-
last: last === void 0 ? void 0 : messageOf(last,
|
|
5911
|
+
last: last === void 0 ? void 0 : messageOf(last, byUrn2, mailbox2),
|
|
5677
5912
|
// PRIMARY_INBOX sits inside INBOX; report the folder a person would name.
|
|
5678
5913
|
folders: categories.map((k) => FOLDER_OF[k]).filter(
|
|
5679
5914
|
(f) => f !== void 0 && !(f === "primary" && categories.includes("INBOX"))
|
|
@@ -5683,7 +5918,7 @@ function parseConversations(json, mailbox2) {
|
|
|
5683
5918
|
);
|
|
5684
5919
|
}
|
|
5685
5920
|
if (refs.length > 0 && conversations.length === 0)
|
|
5686
|
-
return
|
|
5921
|
+
return drift6(`${refs.length} conversations were listed but none were sent`);
|
|
5687
5922
|
const cursor = top?.metadata?.nextCursor;
|
|
5688
5923
|
return {
|
|
5689
5924
|
ok: true,
|
|
@@ -5694,17 +5929,17 @@ function parseConversations(json, mailbox2) {
|
|
|
5694
5929
|
function parseMessages(json, mailbox2) {
|
|
5695
5930
|
const top = collectionOf(json);
|
|
5696
5931
|
const refs = refsOf(top);
|
|
5697
|
-
if (refs === void 0) return
|
|
5932
|
+
if (refs === void 0) return drift6("the message list was missing");
|
|
5698
5933
|
const included = json.included ?? [];
|
|
5699
|
-
const
|
|
5934
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
5700
5935
|
const messages = [];
|
|
5701
5936
|
for (const ref of refs) {
|
|
5702
|
-
const m =
|
|
5937
|
+
const m = byUrn2.get(ref);
|
|
5703
5938
|
if (m === void 0 || typeof m.deliveredAt !== "number") continue;
|
|
5704
|
-
messages.push({ id: String(m.entityUrn), ...messageOf(m,
|
|
5939
|
+
messages.push({ id: String(m.entityUrn), ...messageOf(m, byUrn2, mailbox2) });
|
|
5705
5940
|
}
|
|
5706
5941
|
if (refs.length > 0 && messages.length === 0)
|
|
5707
|
-
return
|
|
5942
|
+
return drift6(`${refs.length} messages were listed but none were sent`);
|
|
5708
5943
|
messages.sort((a, b) => a.at.localeCompare(b.at));
|
|
5709
5944
|
return { ok: true, messages };
|
|
5710
5945
|
}
|
|
@@ -5859,8 +6094,8 @@ function loadDrafts() {
|
|
|
5859
6094
|
};
|
|
5860
6095
|
return Array.isArray(loaded.value) ? loaded.value : [];
|
|
5861
6096
|
}
|
|
5862
|
-
async function runDraft(conversation,
|
|
5863
|
-
const body =
|
|
6097
|
+
async function runDraft(conversation, text7, fetch2, opts = {}) {
|
|
6098
|
+
const body = text7?.trim() ?? "";
|
|
5864
6099
|
if (body === "")
|
|
5865
6100
|
return err(
|
|
5866
6101
|
"draft",
|
|
@@ -5903,8 +6138,8 @@ async function runDraft(conversation, text6, fetch2, opts = {}) {
|
|
|
5903
6138
|
notice: "Saved on this machine only. Nothing was sent: open the link, review, and send it yourself."
|
|
5904
6139
|
});
|
|
5905
6140
|
}
|
|
5906
|
-
function draftText(
|
|
5907
|
-
return file !== void 0 ? readFileSync2(file, "utf-8") :
|
|
6141
|
+
function draftText(text7, file) {
|
|
6142
|
+
return file !== void 0 ? readFileSync2(file, "utf-8") : text7;
|
|
5908
6143
|
}
|
|
5909
6144
|
function runDrafts(opts = {}) {
|
|
5910
6145
|
const drafts = loadDrafts();
|
|
@@ -5963,14 +6198,14 @@ function itemsUrl(list2, q2) {
|
|
|
5963
6198
|
});
|
|
5964
6199
|
return `${c.path}?variables=${variables}&queryId=${c.queryId}`;
|
|
5965
6200
|
}
|
|
5966
|
-
var
|
|
6201
|
+
var text5 = (v) => {
|
|
5967
6202
|
const t = v?.text;
|
|
5968
6203
|
return typeof t === "string" && t.trim() !== "" ? t.trim().replace(/\s+/g, " ") : void 0;
|
|
5969
6204
|
};
|
|
5970
6205
|
var inner = (urn) => String(urn ?? "").match(/\((urn:li:[A-Za-z_]+:[^,)]+)/)?.[1];
|
|
5971
6206
|
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
|
|
6207
|
+
var insight = (row) => (Array.isArray(row.insightsResolutionResults) ? row.insightsResolutionResults : []).map((i) => text5(i.simpleInsight?.title)).find((t) => t !== void 0);
|
|
6208
|
+
function defined7(obj) {
|
|
5974
6209
|
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
5975
6210
|
return obj;
|
|
5976
6211
|
}
|
|
@@ -5982,40 +6217,40 @@ var WORKPLACE = {
|
|
|
5982
6217
|
function postRow(row) {
|
|
5983
6218
|
const id = inner(row.entityUrn);
|
|
5984
6219
|
if (id === void 0 || !/^urn:li:(activity|ugcPost|share):/.test(id)) return void 0;
|
|
5985
|
-
const posted =
|
|
5986
|
-
return
|
|
6220
|
+
const posted = text5(row.secondarySubtitle)?.replace(/\s*•\s*$/, "");
|
|
6221
|
+
return defined7({
|
|
5987
6222
|
id,
|
|
5988
6223
|
url: `https://www.linkedin.com/feed/update/${id}/`,
|
|
5989
|
-
author:
|
|
5990
|
-
authorHeadline:
|
|
6224
|
+
author: text5(row.title),
|
|
6225
|
+
authorHeadline: text5(row.primarySubtitle),
|
|
5991
6226
|
posted,
|
|
5992
|
-
text:
|
|
6227
|
+
text: text5(row.summary)
|
|
5993
6228
|
});
|
|
5994
6229
|
}
|
|
5995
6230
|
function courseRow(row) {
|
|
5996
6231
|
const id = inner(row.entityUrn)?.split(":").pop();
|
|
5997
|
-
const name =
|
|
6232
|
+
const name = text5(row.title);
|
|
5998
6233
|
if (id === void 0 || name === void 0) return void 0;
|
|
5999
|
-
return
|
|
6234
|
+
return defined7({
|
|
6000
6235
|
id,
|
|
6001
6236
|
name,
|
|
6002
|
-
length:
|
|
6003
|
-
detail:
|
|
6004
|
-
progress:
|
|
6237
|
+
length: text5(row.primarySubtitle),
|
|
6238
|
+
detail: text5(row.secondarySubtitle),
|
|
6239
|
+
progress: text5(row.summary),
|
|
6005
6240
|
url: clean(row.navigationUrl)
|
|
6006
6241
|
});
|
|
6007
6242
|
}
|
|
6008
6243
|
function jobRow(row, stage) {
|
|
6009
6244
|
const id = inner(row.entityUrn)?.split(":").pop();
|
|
6010
|
-
const title =
|
|
6245
|
+
const title = text5(row.title);
|
|
6011
6246
|
if (id === void 0 || title === void 0) return void 0;
|
|
6012
|
-
const place =
|
|
6247
|
+
const place = text5(row.secondarySubtitle);
|
|
6013
6248
|
const m = place?.match(/^(.*?)\s*\(([^()]+)\)$/);
|
|
6014
6249
|
const workplace = m?.[2] === void 0 ? void 0 : WORKPLACE[m[2].toLowerCase()];
|
|
6015
|
-
return
|
|
6250
|
+
return defined7({
|
|
6016
6251
|
id,
|
|
6017
6252
|
title,
|
|
6018
|
-
company:
|
|
6253
|
+
company: text5(row.primarySubtitle),
|
|
6019
6254
|
location: workplace !== void 0 ? m?.[1] : place,
|
|
6020
6255
|
workplace,
|
|
6021
6256
|
stage,
|
|
@@ -6175,7 +6410,7 @@ function searchUrl(q2) {
|
|
|
6175
6410
|
kind: SEARCH_KINDS[q2.kind]
|
|
6176
6411
|
});
|
|
6177
6412
|
}
|
|
6178
|
-
var
|
|
6413
|
+
var text6 = (v) => {
|
|
6179
6414
|
const t = v?.text;
|
|
6180
6415
|
return typeof t === "string" && t.trim() !== "" ? t.trim().replace(/\s+/g, " ") : void 0;
|
|
6181
6416
|
};
|
|
@@ -6189,13 +6424,13 @@ function cleanUrl2(nav) {
|
|
|
6189
6424
|
}
|
|
6190
6425
|
function rowToFound(row) {
|
|
6191
6426
|
const id = idOf2(row.entityUrn);
|
|
6192
|
-
const name =
|
|
6427
|
+
const name = text6(row.title);
|
|
6193
6428
|
if (id === void 0 || name === void 0) return void 0;
|
|
6194
6429
|
const found = { id, name };
|
|
6195
6430
|
const fields = [
|
|
6196
|
-
["subtitle",
|
|
6197
|
-
["detail",
|
|
6198
|
-
["summary",
|
|
6431
|
+
["subtitle", text6(row.primarySubtitle)],
|
|
6432
|
+
["detail", text6(row.secondarySubtitle)],
|
|
6433
|
+
["summary", text6(row.summary)],
|
|
6199
6434
|
["url", cleanUrl2(row.navigationUrl)]
|
|
6200
6435
|
];
|
|
6201
6436
|
for (const [k, v] of fields)
|
|
@@ -6203,7 +6438,7 @@ function rowToFound(row) {
|
|
|
6203
6438
|
if (JSON.stringify(row.badgeIcon ?? null).includes("VERIFIED")) found.verified = true;
|
|
6204
6439
|
return found;
|
|
6205
6440
|
}
|
|
6206
|
-
var
|
|
6441
|
+
var drift7 = (message) => ({
|
|
6207
6442
|
ok: false,
|
|
6208
6443
|
code: "SCHEMA_DRIFT",
|
|
6209
6444
|
message,
|
|
@@ -6212,7 +6447,7 @@ var drift6 = (message) => ({
|
|
|
6212
6447
|
function parseResults(json) {
|
|
6213
6448
|
const c = clustersOf(json);
|
|
6214
6449
|
if (c === void 0 || !Array.isArray(c.elements))
|
|
6215
|
-
return
|
|
6450
|
+
return drift7("the search returned no result list");
|
|
6216
6451
|
const included = json.included ?? [];
|
|
6217
6452
|
const { people: items, unknownTypes, excluded, unresolved } = readItems(c, included, rowToFound);
|
|
6218
6453
|
const total = typeof c.paging?.total === "number" ? c.paging.total : void 0;
|
|
@@ -6220,7 +6455,7 @@ function parseResults(json) {
|
|
|
6220
6455
|
const claimedRaw = c.metadata?.totalResultCount;
|
|
6221
6456
|
const claimed = typeof claimedRaw === "number" ? claimedRaw : total;
|
|
6222
6457
|
if (unresolved > 0 && items.length === 0)
|
|
6223
|
-
return
|
|
6458
|
+
return drift7(`${unresolved} results were listed but none could be read`);
|
|
6224
6459
|
if (items.length === 0 && total !== void 0 && total > start) {
|
|
6225
6460
|
return {
|
|
6226
6461
|
ok: false,
|
|
@@ -6291,15 +6526,15 @@ function parseSentInvitations(json) {
|
|
|
6291
6526
|
if (!Array.isArray(refs))
|
|
6292
6527
|
return { ok: false, code: "SCHEMA_DRIFT", message: "the sent invitations list was missing" };
|
|
6293
6528
|
const included = json.included ?? [];
|
|
6294
|
-
const
|
|
6529
|
+
const byUrn2 = new Map(included.map((n) => [n.entityUrn, n]));
|
|
6295
6530
|
const invitations2 = [];
|
|
6296
6531
|
for (const ref of refs) {
|
|
6297
|
-
const view =
|
|
6298
|
-
const inv =
|
|
6532
|
+
const view = byUrn2.get(ref);
|
|
6533
|
+
const inv = byUrn2.get(view?.["*invitation"]) ?? included.find(
|
|
6299
6534
|
(n) => String(n.$type).endsWith(".Invitation") && typeof ref === "string" && ref.endsWith(String(n.entityUrn))
|
|
6300
6535
|
);
|
|
6301
6536
|
if (inv === void 0) continue;
|
|
6302
|
-
const who =
|
|
6537
|
+
const who = byUrn2.get(inv["*toMember"]);
|
|
6303
6538
|
const name = [who?.firstName, who?.lastName].filter((x) => typeof x === "string" && x !== "").join(" ");
|
|
6304
6539
|
const id = String(inv["*toMember"] ?? "").split(":").pop();
|
|
6305
6540
|
const note = typeof inv.message === "string" ? inv.message : inv.message?.text;
|
|
@@ -6440,15 +6675,15 @@ function notificationsUrl(count3, start) {
|
|
|
6440
6675
|
if (c?.decorationId === void 0) throw new Error("the 'notifications' contract is missing");
|
|
6441
6676
|
return `${c.path}?decorationId=${c.decorationId}&q=filterVanityName&count=${count3}&start=${start}`;
|
|
6442
6677
|
}
|
|
6443
|
-
var
|
|
6678
|
+
var drift8 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
6444
6679
|
var textOf = (v) => {
|
|
6445
6680
|
const t = v?.text;
|
|
6446
6681
|
return typeof t === "string" && t.trim() !== "" ? t.trim() : void 0;
|
|
6447
6682
|
};
|
|
6448
6683
|
var absolute = (v) => typeof v === "string" && v !== "" ? v.startsWith("/") ? `https://www.linkedin.com${v}` : v : void 0;
|
|
6449
6684
|
function card(n) {
|
|
6450
|
-
const
|
|
6451
|
-
if (
|
|
6685
|
+
const text7 = textOf(n.headline);
|
|
6686
|
+
if (text7 === void 0) return void 0;
|
|
6452
6687
|
const kind = String(n.entityUrn ?? "").match(/fsd_notificationCard:\(([^,]+),/)?.[1] ?? "UNKNOWN";
|
|
6453
6688
|
const detail = [n.subHeadline, n.contentPrimaryText, n.contentSecondaryText, n.kickerText].map(textOf).filter((t) => t !== void 0).join(" \xB7 ");
|
|
6454
6689
|
const at = typeof n.publishedAt === "number" ? new Date(n.publishedAt).toISOString() : void 0;
|
|
@@ -6456,7 +6691,7 @@ function card(n) {
|
|
|
6456
6691
|
const from = absolute(n.headerImage?.actionTarget);
|
|
6457
6692
|
return {
|
|
6458
6693
|
kind,
|
|
6459
|
-
text:
|
|
6694
|
+
text: text7,
|
|
6460
6695
|
...detail !== "" ? { detail } : {},
|
|
6461
6696
|
...at !== void 0 ? { at } : {},
|
|
6462
6697
|
read: n.read === true,
|
|
@@ -6468,15 +6703,15 @@ function parseNotifications(json) {
|
|
|
6468
6703
|
const root = json;
|
|
6469
6704
|
const data = root?.data;
|
|
6470
6705
|
const listed2 = data?.["*elements"] ?? data?.elements;
|
|
6471
|
-
if (!Array.isArray(listed2)) return
|
|
6472
|
-
const
|
|
6706
|
+
if (!Array.isArray(listed2)) return drift8("the notifications answer carried no card list");
|
|
6707
|
+
const byUrn2 = new Map((root?.included ?? []).map((n) => [n.entityUrn, n]));
|
|
6473
6708
|
const items = listed2.flatMap((u) => {
|
|
6474
|
-
const n =
|
|
6709
|
+
const n = byUrn2.get(u);
|
|
6475
6710
|
const c = n === void 0 ? void 0 : card(n);
|
|
6476
6711
|
return c === void 0 ? [] : [c];
|
|
6477
6712
|
});
|
|
6478
6713
|
if (listed2.length > 0 && items.length === 0)
|
|
6479
|
-
return
|
|
6714
|
+
return drift8(`${listed2.length} notifications were listed but none could be read`);
|
|
6480
6715
|
const meta = data?.metadata ?? {};
|
|
6481
6716
|
return {
|
|
6482
6717
|
ok: true,
|
|
@@ -6574,18 +6809,18 @@ async function exchange(code, config, deps) {
|
|
|
6574
6809
|
} catch (e) {
|
|
6575
6810
|
return { ok: false, message: `could not reach LinkedIn: ${e.message}` };
|
|
6576
6811
|
}
|
|
6577
|
-
const
|
|
6812
|
+
const text7 = await res.text();
|
|
6578
6813
|
if (res.status !== 200) {
|
|
6579
6814
|
return {
|
|
6580
6815
|
ok: false,
|
|
6581
6816
|
message: `LinkedIn rejected the code exchange (${res.status})`,
|
|
6582
6817
|
// 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: ${
|
|
6818
|
+
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
6819
|
};
|
|
6585
6820
|
}
|
|
6586
6821
|
let parsed;
|
|
6587
6822
|
try {
|
|
6588
|
-
parsed = JSON.parse(
|
|
6823
|
+
parsed = JSON.parse(text7);
|
|
6589
6824
|
} catch {
|
|
6590
6825
|
return { ok: false, message: "token response was not JSON" };
|
|
6591
6826
|
}
|
|
@@ -6840,7 +7075,7 @@ function contactInfoBody(publicId, firstName, lastName) {
|
|
|
6840
7075
|
isModal: true
|
|
6841
7076
|
};
|
|
6842
7077
|
}
|
|
6843
|
-
var
|
|
7078
|
+
var drift9 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
6844
7079
|
var unquote2 = (s) => JSON.parse(`"${s}"`);
|
|
6845
7080
|
var LABEL = /\["\$","p",null,\{"className":"[^"]*","children":\["((?:[^"\\]|\\.)+)"\]\}\]/g;
|
|
6846
7081
|
var VIEW = /"viewName":"contact-([a-z-]+)"/g;
|
|
@@ -6878,13 +7113,13 @@ function fieldsOf(stream) {
|
|
|
6878
7113
|
}
|
|
6879
7114
|
var camel = (s) => s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
6880
7115
|
function put(contact, f) {
|
|
6881
|
-
const
|
|
7116
|
+
const text7 = f.texts.join(", ");
|
|
6882
7117
|
switch (f.view) {
|
|
6883
7118
|
case "your-profile":
|
|
6884
7119
|
return;
|
|
6885
7120
|
// `profile` already has the profile URL.
|
|
6886
7121
|
case "email":
|
|
6887
|
-
contact.email = f.links[0] ??
|
|
7122
|
+
contact.email = f.links[0] ?? text7;
|
|
6888
7123
|
return;
|
|
6889
7124
|
case "website":
|
|
6890
7125
|
contact.websites = [
|
|
@@ -6902,18 +7137,18 @@ function put(contact, f) {
|
|
|
6902
7137
|
contact.twitter = [...contact.twitter ?? [], ...f.texts];
|
|
6903
7138
|
return;
|
|
6904
7139
|
case void 0:
|
|
6905
|
-
if (/^connected since$/i.test(f.label)) contact.connectedSince =
|
|
6906
|
-
else contact.other = { ...contact.other, [f.label]:
|
|
7140
|
+
if (/^connected since$/i.test(f.label)) contact.connectedSince = text7;
|
|
7141
|
+
else contact.other = { ...contact.other, [f.label]: text7 };
|
|
6907
7142
|
return;
|
|
6908
7143
|
default:
|
|
6909
|
-
contact[camel(f.view)] =
|
|
7144
|
+
contact[camel(f.view)] = text7;
|
|
6910
7145
|
}
|
|
6911
7146
|
}
|
|
6912
7147
|
function parseContactInfo(stream) {
|
|
6913
7148
|
if (!stream.includes("profile-contact-info-details-view"))
|
|
6914
|
-
return
|
|
7149
|
+
return drift9("the contact info answer was not the contact info overlay");
|
|
6915
7150
|
const fields = fieldsOf(stream);
|
|
6916
|
-
if (fields.length === 0) return
|
|
7151
|
+
if (fields.length === 0) return drift9("the contact info overlay had no fields");
|
|
6917
7152
|
const contact = {};
|
|
6918
7153
|
for (const f of fields) put(contact, f);
|
|
6919
7154
|
return { ok: true, contact };
|
|
@@ -6934,10 +7169,10 @@ function positionsPageUrl(profileUrn, start) {
|
|
|
6934
7169
|
const c = contract3("profilePositions");
|
|
6935
7170
|
return `${c.path}?q=viewee&profileUrn=${encodeURIComponent(profileUrn)}&decorationId=${c.decorationId}&start=${start}&count=${POSITIONS_PAGE}`;
|
|
6936
7171
|
}
|
|
6937
|
-
var
|
|
6938
|
-
var
|
|
7172
|
+
var drift10 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
7173
|
+
var str5 = (v) => typeof v === "string" && v.trim() !== "" && v.trim() !== "-" ? v.trim() : void 0;
|
|
6939
7174
|
var idOf3 = (urn) => String(urn ?? "").match(/:(\d+)$/)?.[1];
|
|
6940
|
-
function
|
|
7175
|
+
function defined8(obj) {
|
|
6941
7176
|
for (const k of Object.keys(obj)) if (obj[k] === void 0) delete obj[k];
|
|
6942
7177
|
return obj;
|
|
6943
7178
|
}
|
|
@@ -6952,7 +7187,7 @@ function range(v) {
|
|
|
6952
7187
|
const r = v;
|
|
6953
7188
|
const start = date(r?.start);
|
|
6954
7189
|
const end = date(r?.end);
|
|
6955
|
-
return
|
|
7190
|
+
return defined8({
|
|
6956
7191
|
start,
|
|
6957
7192
|
end,
|
|
6958
7193
|
current: start !== void 0 && end === void 0 ? true : void 0
|
|
@@ -6975,21 +7210,21 @@ var Index = class {
|
|
|
6975
7210
|
collection(urn) {
|
|
6976
7211
|
const c = this.get(urn);
|
|
6977
7212
|
const refs = Array.isArray(c?.["*elements"]) ? c?.["*elements"] : [];
|
|
6978
|
-
const
|
|
7213
|
+
const nodes2 = refs.flatMap((r) => this.list(r));
|
|
6979
7214
|
const total = c?.paging?.total;
|
|
6980
|
-
return typeof total === "number" ? { nodes, total } : { nodes };
|
|
7215
|
+
return typeof total === "number" ? { nodes: nodes2, total } : { nodes: nodes2 };
|
|
6981
7216
|
}
|
|
6982
7217
|
};
|
|
6983
7218
|
function role(p, group, ix) {
|
|
6984
7219
|
const companyUrn = p.companyUrn ?? group?.companyUrn;
|
|
6985
|
-
return
|
|
6986
|
-
title:
|
|
6987
|
-
company:
|
|
7220
|
+
return defined8({
|
|
7221
|
+
title: str5(p.title),
|
|
7222
|
+
company: str5(p.companyName) ?? str5(group?.companyName),
|
|
6988
7223
|
companyId: idOf3(companyUrn),
|
|
6989
|
-
employmentType:
|
|
6990
|
-
location:
|
|
7224
|
+
employmentType: str5(ix.get(p["*employmentType"])?.name),
|
|
7225
|
+
location: str5(p.locationName) ?? str5(p.geoLocationName),
|
|
6991
7226
|
...range(p.dateRange),
|
|
6992
|
-
description:
|
|
7227
|
+
description: str5(p.description)
|
|
6993
7228
|
});
|
|
6994
7229
|
}
|
|
6995
7230
|
function rolesOf(groups, ix) {
|
|
@@ -6999,39 +7234,39 @@ function rolesOf(groups, ix) {
|
|
|
6999
7234
|
});
|
|
7000
7235
|
}
|
|
7001
7236
|
function school(e) {
|
|
7002
|
-
return
|
|
7003
|
-
school:
|
|
7237
|
+
return defined8({
|
|
7238
|
+
school: str5(e.schoolName),
|
|
7004
7239
|
schoolId: idOf3(e.schoolUrn),
|
|
7005
|
-
degree:
|
|
7006
|
-
field:
|
|
7240
|
+
degree: str5(e.degreeName),
|
|
7241
|
+
field: str5(e.fieldOfStudy),
|
|
7007
7242
|
...range(e.dateRange),
|
|
7008
|
-
grade:
|
|
7009
|
-
activities:
|
|
7010
|
-
description:
|
|
7243
|
+
grade: str5(e.grade),
|
|
7244
|
+
activities: str5(e.activities),
|
|
7245
|
+
description: str5(e.description)
|
|
7011
7246
|
});
|
|
7012
7247
|
}
|
|
7013
7248
|
function entry(n) {
|
|
7014
|
-
const proficiency =
|
|
7015
|
-
return
|
|
7016
|
-
name:
|
|
7017
|
-
title:
|
|
7018
|
-
role:
|
|
7019
|
-
organization:
|
|
7020
|
-
authority:
|
|
7021
|
-
issuer:
|
|
7022
|
-
publisher:
|
|
7249
|
+
const proficiency = str5(n.proficiency);
|
|
7250
|
+
return defined8({
|
|
7251
|
+
name: str5(n.name),
|
|
7252
|
+
title: str5(n.title),
|
|
7253
|
+
role: str5(n.role),
|
|
7254
|
+
organization: str5(n.companyName),
|
|
7255
|
+
authority: str5(n.authority),
|
|
7256
|
+
issuer: str5(n.issuer),
|
|
7257
|
+
publisher: str5(n.publisher),
|
|
7023
7258
|
proficiency: proficiency?.toLowerCase().replace(/_/g, " "),
|
|
7024
|
-
number:
|
|
7025
|
-
score:
|
|
7026
|
-
cause:
|
|
7259
|
+
number: str5(n.number) ?? str5(n.licenseNumber) ?? str5(n.patentNumber),
|
|
7260
|
+
score: str5(n.score),
|
|
7261
|
+
cause: str5(n.cause)?.toLowerCase().replace(/_/g, " "),
|
|
7027
7262
|
...range(n.dateRange),
|
|
7028
7263
|
issued: date(n.issuedOn),
|
|
7029
7264
|
published: date(n.publishedOn),
|
|
7030
|
-
url:
|
|
7031
|
-
description:
|
|
7265
|
+
url: str5(n.url),
|
|
7266
|
+
description: str5(n.description)
|
|
7032
7267
|
});
|
|
7033
7268
|
}
|
|
7034
|
-
var
|
|
7269
|
+
var SECTIONS2 = {
|
|
7035
7270
|
certifications: "*profileCertifications",
|
|
7036
7271
|
languages: "*profileLanguages",
|
|
7037
7272
|
honors: "*profileHonors",
|
|
@@ -7047,13 +7282,13 @@ var some = (xs) => xs.length > 0 ? xs : void 0;
|
|
|
7047
7282
|
function parseFullProfile(json) {
|
|
7048
7283
|
const root = json;
|
|
7049
7284
|
const listed2 = root?.data?.["*elements"];
|
|
7050
|
-
if (!Array.isArray(listed2)) return
|
|
7285
|
+
if (!Array.isArray(listed2)) return drift10("the profile answer carried no profile list");
|
|
7051
7286
|
if (listed2.length === 0)
|
|
7052
7287
|
return { ok: false, code: "NOT_FOUND", message: "no profile has that id on LinkedIn" };
|
|
7053
7288
|
const ix = new Index(root?.included ?? []);
|
|
7054
7289
|
const p = ix.get(listed2[0]);
|
|
7055
7290
|
const urn = typeof p?.entityUrn === "string" ? p.entityUrn : void 0;
|
|
7056
|
-
if (p === void 0 || urn === void 0) return
|
|
7291
|
+
if (p === void 0 || urn === void 0) return drift10("the profile was listed but not sent");
|
|
7057
7292
|
const counts2 = {};
|
|
7058
7293
|
const count3 = (key, shown, total) => {
|
|
7059
7294
|
if (total !== void 0 && total > shown) counts2[key] = { shown, total };
|
|
@@ -7065,32 +7300,32 @@ function parseFullProfile(json) {
|
|
|
7065
7300
|
const education = schools.nodes.map(school);
|
|
7066
7301
|
const skillNodes = ix.collection(p["*profileSkills"]);
|
|
7067
7302
|
count3("skills", skillNodes.nodes.length, skillNodes.total);
|
|
7068
|
-
const skills = skillNodes.nodes.flatMap((s) =>
|
|
7303
|
+
const skills = skillNodes.nodes.flatMap((s) => str5(s.name) ?? []);
|
|
7069
7304
|
const sections = {};
|
|
7070
|
-
for (const [key, field] of Object.entries(
|
|
7305
|
+
for (const [key, field] of Object.entries(SECTIONS2)) {
|
|
7071
7306
|
const c = ix.collection(p[field]);
|
|
7072
7307
|
count3(key, c.nodes.length, c.total);
|
|
7073
7308
|
const rows = c.nodes.map(entry);
|
|
7074
7309
|
if (rows.length > 0) sections[key] = rows;
|
|
7075
7310
|
}
|
|
7076
|
-
const publicId =
|
|
7077
|
-
const name = [
|
|
7311
|
+
const publicId = str5(p.publicIdentifier);
|
|
7312
|
+
const name = [str5(p.firstName), str5(p.lastName)].filter(Boolean).join(" ");
|
|
7078
7313
|
const geo = ix.get(p.geoLocation?.["*geo"]);
|
|
7079
7314
|
const bool3 = (v) => v === true ? true : void 0;
|
|
7080
7315
|
return {
|
|
7081
7316
|
ok: true,
|
|
7082
|
-
profile:
|
|
7317
|
+
profile: defined8({
|
|
7083
7318
|
id: urn.split(":").pop(),
|
|
7084
7319
|
urn,
|
|
7085
7320
|
publicId,
|
|
7086
7321
|
name: name === "" ? void 0 : name,
|
|
7087
|
-
firstName:
|
|
7088
|
-
lastName:
|
|
7089
|
-
headline:
|
|
7322
|
+
firstName: str5(p.firstName),
|
|
7323
|
+
lastName: str5(p.lastName),
|
|
7324
|
+
headline: str5(p.headline),
|
|
7090
7325
|
url: publicId === void 0 ? void 0 : `https://www.linkedin.com/in/${publicId}/`,
|
|
7091
|
-
location:
|
|
7092
|
-
industry:
|
|
7093
|
-
about:
|
|
7326
|
+
location: str5(geo?.defaultLocalizedName),
|
|
7327
|
+
industry: str5(ix.get(p["*industry"])?.name),
|
|
7328
|
+
about: str5(p.summary),
|
|
7094
7329
|
title: experience[0]?.title,
|
|
7095
7330
|
company: experience[0]?.company,
|
|
7096
7331
|
school: education[0]?.school,
|
|
@@ -7108,11 +7343,11 @@ function parseFullProfile(json) {
|
|
|
7108
7343
|
function parsePositionsPage(json) {
|
|
7109
7344
|
const root = json;
|
|
7110
7345
|
const refs = root?.data?.["*elements"];
|
|
7111
|
-
if (!Array.isArray(refs)) return
|
|
7346
|
+
if (!Array.isArray(refs)) return drift10("the experience page carried no position groups");
|
|
7112
7347
|
const ix = new Index(root?.included ?? []);
|
|
7113
7348
|
const groups = refs.flatMap((r) => ix.list(r));
|
|
7114
7349
|
if (refs.length > 0 && groups.length === 0)
|
|
7115
|
-
return
|
|
7350
|
+
return drift10(`${refs.length} position groups were listed but none sent`);
|
|
7116
7351
|
const total = root?.data?.paging?.total;
|
|
7117
7352
|
return {
|
|
7118
7353
|
ok: true,
|
|
@@ -7152,7 +7387,7 @@ function recommendationsBody(kind, vanityName, profileId2, start) {
|
|
|
7152
7387
|
}
|
|
7153
7388
|
};
|
|
7154
7389
|
}
|
|
7155
|
-
var
|
|
7390
|
+
var drift11 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
7156
7391
|
var unquote3 = (s) => JSON.parse(`"${s}"`);
|
|
7157
7392
|
var STR = '((?:[^"\\\\]|\\\\.)+)';
|
|
7158
7393
|
var loading = (id) => new RegExp(
|
|
@@ -7200,7 +7435,7 @@ function bodyOf(segment) {
|
|
|
7200
7435
|
}
|
|
7201
7436
|
function parseRecommendations(stream) {
|
|
7202
7437
|
if (!stream.includes("isPartialPage") && !stream.includes(PAGER))
|
|
7203
|
-
return
|
|
7438
|
+
return drift11("the recommendations answer was not the recommendations list");
|
|
7204
7439
|
const rows = new Rows(stream);
|
|
7205
7440
|
const headers2 = [...rows.byId].filter(([, row]) => NAME.test(row) && !row.startsWith('[["$"')).map(([id]) => id);
|
|
7206
7441
|
const heads = new Set(headers2);
|
|
@@ -7224,11 +7459,11 @@ function parseRecommendations(stream) {
|
|
|
7224
7459
|
}
|
|
7225
7460
|
}
|
|
7226
7461
|
const who = header(rows, p.h);
|
|
7227
|
-
const
|
|
7228
|
-
if (who !== void 0 &&
|
|
7462
|
+
const text7 = bodyOf(inlined(rows, row.slice(p.at, end)));
|
|
7463
|
+
if (who !== void 0 && text7 !== "") items.push({ ...who, text: text7 });
|
|
7229
7464
|
}
|
|
7230
7465
|
if (headers2.length > 0 && items.length === 0)
|
|
7231
|
-
return
|
|
7466
|
+
return drift11(`${headers2.length} recommendations were shown but none could be read`);
|
|
7232
7467
|
return { ok: true, items };
|
|
7233
7468
|
}
|
|
7234
7469
|
|
|
@@ -7252,7 +7487,7 @@ var PROFILE_FIELDS = {
|
|
|
7252
7487
|
maxLength: 2600
|
|
7253
7488
|
}
|
|
7254
7489
|
};
|
|
7255
|
-
var
|
|
7490
|
+
var drift12 = (message) => ({
|
|
7256
7491
|
ok: false,
|
|
7257
7492
|
code: "SCHEMA_DRIFT",
|
|
7258
7493
|
message,
|
|
@@ -7260,10 +7495,10 @@ var drift11 = (message) => ({
|
|
|
7260
7495
|
});
|
|
7261
7496
|
function readForm(stream, field) {
|
|
7262
7497
|
const states2 = readModel(stream);
|
|
7263
|
-
if (states2 === null) return
|
|
7498
|
+
if (states2 === null) return drift12("the profile form carried no initial values");
|
|
7264
7499
|
const args = findRequest(stream, field.save);
|
|
7265
7500
|
if (args === null)
|
|
7266
|
-
return
|
|
7501
|
+
return drift12(`the profile form carried no ${field.save.split(".").pop()} action`);
|
|
7267
7502
|
return { ok: true, args, states: states2, screen: field.screen, save: field.save };
|
|
7268
7503
|
}
|
|
7269
7504
|
function boundKey(form, property) {
|
|
@@ -7279,7 +7514,7 @@ function topSkills(form) {
|
|
|
7279
7514
|
return (key) => {
|
|
7280
7515
|
if (!key.endsWith("ReorderableSkillsFormBindingsskillIdsBinding")) return void 0;
|
|
7281
7516
|
const initial = [...form.states.entries()].find(([k]) => k.startsWith("initialSkills"))?.[1];
|
|
7282
|
-
if (initial === void 0) return
|
|
7517
|
+
if (initial === void 0) return drift12("the About form carried no initial top skills");
|
|
7283
7518
|
if (!Array.isArray(initial.value) || initial.value.length > 0) {
|
|
7284
7519
|
return {
|
|
7285
7520
|
ok: false,
|
|
@@ -7302,7 +7537,7 @@ function saveBody(form, field, value) {
|
|
|
7302
7537
|
const target2 = boundKey(form, field.binding);
|
|
7303
7538
|
const current = target2 === void 0 ? void 0 : form.states.get(target2);
|
|
7304
7539
|
if (target2 === void 0 || current === void 0) {
|
|
7305
|
-
return
|
|
7540
|
+
return drift12(`the profile form has no ${field.name} field`);
|
|
7306
7541
|
}
|
|
7307
7542
|
const model = new Map(form.states);
|
|
7308
7543
|
model.set(target2, { ...current, value });
|
|
@@ -7372,7 +7607,7 @@ var EDIT_NAV = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"
|
|
|
7372
7607
|
var TEXT4 = /"children":\["((?:[^"\\]|\\.)*)"\]/g;
|
|
7373
7608
|
function skillsFromPage(stream) {
|
|
7374
7609
|
if (!stream.includes(SKILL.pager) && !stream.includes(EDIT_NAV) && !stream.includes("isPartialPage")) {
|
|
7375
|
-
return
|
|
7610
|
+
return drift12("the skills page could not be read");
|
|
7376
7611
|
}
|
|
7377
7612
|
const skills = [];
|
|
7378
7613
|
let from = 0;
|
|
@@ -7380,11 +7615,11 @@ function skillsFromPage(stream) {
|
|
|
7380
7615
|
for (; ; ) {
|
|
7381
7616
|
i = stream.indexOf(EDIT_NAV, i);
|
|
7382
7617
|
if (i === -1) break;
|
|
7383
|
-
const
|
|
7618
|
+
const text7 = balanced(stream, i);
|
|
7384
7619
|
const end = i;
|
|
7385
7620
|
i += EDIT_NAV.length;
|
|
7386
|
-
if (
|
|
7387
|
-
const payload = JSON.parse(
|
|
7621
|
+
if (text7 === null) continue;
|
|
7622
|
+
const payload = JSON.parse(text7).requestedArguments?.payload;
|
|
7388
7623
|
const id = payload?.skillId;
|
|
7389
7624
|
if (typeof id !== "string" || payload === void 0 || skills.some((s) => s.skillId === id))
|
|
7390
7625
|
continue;
|
|
@@ -7392,7 +7627,7 @@ function skillsFromPage(stream) {
|
|
|
7392
7627
|
(m) => JSON.parse(`"${m[1]}"`)
|
|
7393
7628
|
);
|
|
7394
7629
|
skills.push({ skillId: id, name: names.length === 1 ? names[0] ?? null : null, payload });
|
|
7395
|
-
from = end +
|
|
7630
|
+
from = end + text7.length;
|
|
7396
7631
|
}
|
|
7397
7632
|
return { ok: true, skills };
|
|
7398
7633
|
}
|
|
@@ -7411,8 +7646,8 @@ function skillRowsOf(stream) {
|
|
|
7411
7646
|
function listPayloadOf(screen) {
|
|
7412
7647
|
const at = screen.indexOf('"filter":"ProfileSkillCategory_ALL"');
|
|
7413
7648
|
const open = at === -1 ? -1 : screen.lastIndexOf('"payload":{', at);
|
|
7414
|
-
const
|
|
7415
|
-
return
|
|
7649
|
+
const text7 = open === -1 ? null : balanced(screen, open + '"payload":'.length);
|
|
7650
|
+
return text7 === null ? null : JSON.parse(text7);
|
|
7416
7651
|
}
|
|
7417
7652
|
function pagerFrom(payload, start) {
|
|
7418
7653
|
const args = {
|
|
@@ -7434,11 +7669,11 @@ function pagerFrom(payload, start) {
|
|
|
7434
7669
|
}
|
|
7435
7670
|
function readSkillForm(stream) {
|
|
7436
7671
|
const model = readModel(stream);
|
|
7437
|
-
if (model === null) return
|
|
7672
|
+
if (model === null) return drift12("the skill form carried no initial values");
|
|
7438
7673
|
const save = findRequest(stream, SKILL.save);
|
|
7439
7674
|
const del = findRequest(stream, SKILL.delete);
|
|
7440
7675
|
if (save === null && del === null)
|
|
7441
|
-
return
|
|
7676
|
+
return drift12("the skill form carried neither a save nor a delete");
|
|
7442
7677
|
return { ok: true, model, save, del, screen: del === null ? SKILL.addScreen : SKILL.editScreen };
|
|
7443
7678
|
}
|
|
7444
7679
|
var nameKey = (model) => [...model.keys()].find((k) => k.startsWith("addSkillsTypeaheadSkillName"));
|
|
@@ -7450,10 +7685,10 @@ function skillNameOf(form) {
|
|
|
7450
7685
|
function addSkillBody(form, name) {
|
|
7451
7686
|
if (name.trim() === "")
|
|
7452
7687
|
return { ok: false, code: "INVALID_INPUT", message: "a skill needs a name" };
|
|
7453
|
-
if (form.save === null) return
|
|
7688
|
+
if (form.save === null) return drift12("this form has no save action (it is not the add form)");
|
|
7454
7689
|
const key = nameKey(form.model);
|
|
7455
7690
|
const current = key === void 0 ? void 0 : form.model.get(key);
|
|
7456
|
-
if (key === void 0 || current === void 0) return
|
|
7691
|
+
if (key === void 0 || current === void 0) return drift12("the skill form has no name field");
|
|
7457
7692
|
const model = new Map(form.model);
|
|
7458
7693
|
model.set(key, { ...current, value: name.trim() });
|
|
7459
7694
|
const states2 = wireStates(keysOf(form.save), model, () => void 0);
|
|
@@ -7462,7 +7697,7 @@ function addSkillBody(form, name) {
|
|
|
7462
7697
|
}
|
|
7463
7698
|
function removeSkillBody(form) {
|
|
7464
7699
|
if (form.del === null)
|
|
7465
|
-
return
|
|
7700
|
+
return drift12("this form has no delete action (it is not an existing skill)");
|
|
7466
7701
|
const states2 = wireStates(keysOf(form.del), form.model, () => void 0);
|
|
7467
7702
|
if (!Array.isArray(states2)) return states2;
|
|
7468
7703
|
return { ok: true, body: requestBody(SKILL.delete, form.del, states2, form.screen) };
|
|
@@ -7478,7 +7713,7 @@ async function fetchSkills(vanityName, client) {
|
|
|
7478
7713
|
);
|
|
7479
7714
|
if (typeof screen !== "string") return screen;
|
|
7480
7715
|
const payload = listPayloadOf(screen);
|
|
7481
|
-
if (payload === null) return
|
|
7716
|
+
if (payload === null) return drift12("the Skills screen carried no list request");
|
|
7482
7717
|
const count3 = typeof payload.count === "number" ? payload.count : 10;
|
|
7483
7718
|
const skills = [];
|
|
7484
7719
|
for (let page = 0; page < MAX_PAGES2; page++) {
|
|
@@ -7808,16 +8043,16 @@ var COMMANDS = [
|
|
|
7808
8043
|
name: "jobs",
|
|
7809
8044
|
cost: "1 job-search call per 100 jobs; --details adds 1 job read per 100 jobs",
|
|
7810
8045
|
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.',
|
|
8046
|
+
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 [--limit N] [--details] [--compact | --fields a,b,c]\n Premium: the jobs where LinkedIn says you would be a top applicant, 100 a call.',
|
|
7812
8047
|
audience: ["cli", "mcp"],
|
|
7813
8048
|
risk: "read",
|
|
7814
8049
|
implemented: true
|
|
7815
8050
|
},
|
|
7816
8051
|
{
|
|
7817
8052
|
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]",
|
|
8053
|
+
cost: "1 job read per 100 jobs; --team adds 1 page call per job; --insights 1 job read per job",
|
|
8054
|
+
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.",
|
|
8055
|
+
usage: "lnrelay job <id|job-url> [<id|job-url> ...] [--team] [--insights] [--compact | --fields a,b,c]",
|
|
7821
8056
|
audience: ["cli", "mcp"],
|
|
7822
8057
|
risk: "read",
|
|
7823
8058
|
implemented: true
|
|
@@ -7934,8 +8169,8 @@ var COMMANDS = [
|
|
|
7934
8169
|
{
|
|
7935
8170
|
name: "viewers",
|
|
7936
8171
|
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]",
|
|
8172
|
+
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.",
|
|
8173
|
+
usage: "lnrelay viewers [--days 7|14|28|90|365] [--compact | --fields a,b,c]",
|
|
7939
8174
|
audience: ["cli", "mcp"],
|
|
7940
8175
|
risk: "read",
|
|
7941
8176
|
implemented: true
|
|
@@ -8159,7 +8394,7 @@ var POSITION = {
|
|
|
8159
8394
|
var EDIT_NAV2 = `{"$type":"proto.sdui.actions.core.NavigateToScreen","screenId":"${POSITION.editScreen}"`;
|
|
8160
8395
|
function listPositions(stream) {
|
|
8161
8396
|
if (readModel(stream) === null && !stream.includes(EDIT_NAV2) && !stream.includes('"rows"')) {
|
|
8162
|
-
return
|
|
8397
|
+
return drift12("the Experience screen could not be read");
|
|
8163
8398
|
}
|
|
8164
8399
|
const positions = [];
|
|
8165
8400
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -8167,27 +8402,27 @@ function listPositions(stream) {
|
|
|
8167
8402
|
for (; ; ) {
|
|
8168
8403
|
i = stream.indexOf(EDIT_NAV2, i);
|
|
8169
8404
|
if (i === -1) break;
|
|
8170
|
-
const
|
|
8405
|
+
const text7 = balanced(stream, i);
|
|
8171
8406
|
i += EDIT_NAV2.length;
|
|
8172
|
-
if (
|
|
8173
|
-
const payload = JSON.parse(
|
|
8407
|
+
if (text7 === null) continue;
|
|
8408
|
+
const payload = JSON.parse(text7).requestedArguments?.payload;
|
|
8174
8409
|
const id = payload?.positionId;
|
|
8175
8410
|
if (typeof id !== "string" || seen.has(id) || payload === void 0) continue;
|
|
8176
8411
|
seen.add(id);
|
|
8177
8412
|
positions.push({ positionId: id, title: String(payload.title ?? ""), payload });
|
|
8178
8413
|
}
|
|
8179
8414
|
if (positions.length === 0 && !stream.includes('"rows"') && !stream.includes("Experience")) {
|
|
8180
|
-
return
|
|
8415
|
+
return drift12("the Experience screen listed no roles and did not look like one");
|
|
8181
8416
|
}
|
|
8182
8417
|
return { ok: true, positions };
|
|
8183
8418
|
}
|
|
8184
8419
|
function readPositionForm(stream) {
|
|
8185
8420
|
const model = readModel(stream);
|
|
8186
|
-
if (model === null) return
|
|
8421
|
+
if (model === null) return drift12("the position form carried no initial values");
|
|
8187
8422
|
const media = findRequest(stream, POSITION.media);
|
|
8188
8423
|
const prefix = media?.payload.formIdPrefix;
|
|
8189
8424
|
if (media === null || typeof prefix !== "string") {
|
|
8190
|
-
return
|
|
8425
|
+
return drift12("the position form carried no save step (uploadPositionMedia)");
|
|
8191
8426
|
}
|
|
8192
8427
|
const del = findRequest(stream, POSITION.delete);
|
|
8193
8428
|
return {
|
|
@@ -8238,7 +8473,7 @@ function applyChanges(form, changes) {
|
|
|
8238
8473
|
}
|
|
8239
8474
|
need("dynamicallyCreateHeadline", false);
|
|
8240
8475
|
need("allowProfileEditBroadcasts", changes.notify === true);
|
|
8241
|
-
if (missing.length > 0) return
|
|
8476
|
+
if (missing.length > 0) return drift12(`the position form has no ${missing.join(", ")} field`);
|
|
8242
8477
|
const s = roleSummary(model);
|
|
8243
8478
|
if (!s.current && s.start !== null && s.end !== null && s.end < s.start) {
|
|
8244
8479
|
return {
|
|
@@ -8283,7 +8518,7 @@ function mediaBody(form, model) {
|
|
|
8283
8518
|
}
|
|
8284
8519
|
function saveFromReply(reply) {
|
|
8285
8520
|
const args = findRequest(reply, POSITION.save);
|
|
8286
|
-
return args === null ?
|
|
8521
|
+
return args === null ? drift12("the media step did not hand back the save action") : { ok: true, args };
|
|
8287
8522
|
}
|
|
8288
8523
|
function positionSaveBody(save, model, screen) {
|
|
8289
8524
|
const sending = new Map(model);
|
|
@@ -8295,7 +8530,7 @@ function positionSaveBody(save, model, screen) {
|
|
|
8295
8530
|
}
|
|
8296
8531
|
function deleteBody(form) {
|
|
8297
8532
|
if (form.del === null)
|
|
8298
|
-
return
|
|
8533
|
+
return drift12("this form has no delete action (it is not an existing role)");
|
|
8299
8534
|
const states2 = wireStates(keysOf(form.del), form.model, resolver);
|
|
8300
8535
|
if (!Array.isArray(states2)) return states2;
|
|
8301
8536
|
return { ok: true, body: requestBody(POSITION.delete, form.del, states2, form.screen) };
|
|
@@ -8373,9 +8608,9 @@ async function send(url, body, token, deps) {
|
|
|
8373
8608
|
} catch (e) {
|
|
8374
8609
|
return { ok: false, code: "FETCH_FAILED", message: e.message };
|
|
8375
8610
|
}
|
|
8376
|
-
const
|
|
8611
|
+
const text7 = await res.text();
|
|
8377
8612
|
if (res.status === 201 || res.status === 200) {
|
|
8378
|
-
const id = res.headers.get("x-restli-id") ?? extractId(
|
|
8613
|
+
const id = res.headers.get("x-restli-id") ?? extractId(text7);
|
|
8379
8614
|
return {
|
|
8380
8615
|
ok: true,
|
|
8381
8616
|
id: id ?? "(unknown)",
|
|
@@ -8402,7 +8637,7 @@ async function send(url, body, token, deps) {
|
|
|
8402
8637
|
ok: false,
|
|
8403
8638
|
code: "FETCH_FAILED",
|
|
8404
8639
|
message: `write failed (${res.status})`,
|
|
8405
|
-
hint:
|
|
8640
|
+
hint: text7.slice(0, 300)
|
|
8406
8641
|
};
|
|
8407
8642
|
}
|
|
8408
8643
|
function extractId(body) {
|
|
@@ -8450,7 +8685,7 @@ function feedTypeFor(bindingKey) {
|
|
|
8450
8685
|
function stateKey(prefix, body) {
|
|
8451
8686
|
return `${prefix}-${body}`;
|
|
8452
8687
|
}
|
|
8453
|
-
function states(
|
|
8688
|
+
function states(text7, body) {
|
|
8454
8689
|
return STATE_PREFIXES.map((prefix) => {
|
|
8455
8690
|
const key = stateKey(prefix, body);
|
|
8456
8691
|
const base = {
|
|
@@ -8459,19 +8694,19 @@ function states(text6, body) {
|
|
|
8459
8694
|
protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: key } }
|
|
8460
8695
|
};
|
|
8461
8696
|
if (prefix === "commentBoxText") {
|
|
8462
|
-
return { ...base, value:
|
|
8697
|
+
return { ...base, value: text7, originalProtoCase: "stringValue" };
|
|
8463
8698
|
}
|
|
8464
8699
|
if (prefix === "richCommentBoxText") {
|
|
8465
8700
|
return {
|
|
8466
8701
|
...base,
|
|
8467
|
-
value: { text:
|
|
8702
|
+
value: { text: text7, attribute: [], $type: "TextModel", source: "local" },
|
|
8468
8703
|
originalProtoCase: "textModelForWrite"
|
|
8469
8704
|
};
|
|
8470
8705
|
}
|
|
8471
8706
|
return { ...base, value: "", originalProtoCase: "stringValue" };
|
|
8472
8707
|
});
|
|
8473
8708
|
}
|
|
8474
|
-
function commentBody(activityId,
|
|
8709
|
+
function commentBody(activityId, text7, tokens, feedType) {
|
|
8475
8710
|
const body = keyBody(tokens.bindingKey);
|
|
8476
8711
|
const activityUrn = { activityUrn: { activityId } };
|
|
8477
8712
|
const binding2 = (prefix) => ({
|
|
@@ -8518,17 +8753,17 @@ function commentBody(activityId, text6, tokens, feedType) {
|
|
|
8518
8753
|
isStreaming: false,
|
|
8519
8754
|
rumPageKey: ""
|
|
8520
8755
|
},
|
|
8521
|
-
states: states(
|
|
8756
|
+
states: states(text7, body),
|
|
8522
8757
|
requestedArguments: {
|
|
8523
8758
|
...args,
|
|
8524
|
-
states: states(
|
|
8759
|
+
states: states(text7, body),
|
|
8525
8760
|
screenId: SCREEN_ID3,
|
|
8526
8761
|
knownTemplateIds: []
|
|
8527
8762
|
}
|
|
8528
8763
|
};
|
|
8529
8764
|
}
|
|
8530
8765
|
async function comment(confirmed, client) {
|
|
8531
|
-
const { activityId, text:
|
|
8766
|
+
const { activityId, text: text7, tokens } = confirmed.payload;
|
|
8532
8767
|
if (!keyMatchesPost(tokens.bindingKey, activityId)) {
|
|
8533
8768
|
return {
|
|
8534
8769
|
ok: false,
|
|
@@ -8549,7 +8784,7 @@ async function comment(confirmed, client) {
|
|
|
8549
8784
|
const result = await client.request({
|
|
8550
8785
|
url: COMMENT_URL,
|
|
8551
8786
|
method: "POST",
|
|
8552
|
-
body: commentBody(activityId,
|
|
8787
|
+
body: commentBody(activityId, text7, tokens, feedType),
|
|
8553
8788
|
spendClass: "write",
|
|
8554
8789
|
operation: "comment.create"
|
|
8555
8790
|
});
|
|
@@ -8673,10 +8908,10 @@ var REPLY_URL = `https://www.linkedin.com/voyager/api/voyagerSocialDashNormComme
|
|
|
8673
8908
|
function parentThreadUrn(ref) {
|
|
8674
8909
|
return `urn:li:comment:(${ref.threadType}:${ref.activityId},${ref.commentId})`;
|
|
8675
8910
|
}
|
|
8676
|
-
function replyBody(ref,
|
|
8911
|
+
function replyBody(ref, text7) {
|
|
8677
8912
|
return {
|
|
8678
8913
|
commentary: {
|
|
8679
|
-
text:
|
|
8914
|
+
text: text7,
|
|
8680
8915
|
// The captured reply carried a profileMention, because LinkedIn's UI
|
|
8681
8916
|
// pre-fills "@Author " into the box. We send none: an @mention notifies a
|
|
8682
8917
|
// real person, and inventing one would put words — and a notification —
|
|
@@ -8688,11 +8923,11 @@ function replyBody(ref, text6) {
|
|
|
8688
8923
|
};
|
|
8689
8924
|
}
|
|
8690
8925
|
async function replyToComment(confirmed, client) {
|
|
8691
|
-
const { ref, text:
|
|
8926
|
+
const { ref, text: text7 } = confirmed.payload;
|
|
8692
8927
|
const result = await client.request({
|
|
8693
8928
|
url: REPLY_URL,
|
|
8694
8929
|
method: "POST",
|
|
8695
|
-
body: replyBody(ref,
|
|
8930
|
+
body: replyBody(ref, text7),
|
|
8696
8931
|
spendClass: "write",
|
|
8697
8932
|
operation: "reply"
|
|
8698
8933
|
});
|
|
@@ -9511,8 +9746,8 @@ function whenLine(at, now) {
|
|
|
9511
9746
|
const away = hours < 48 ? `in ${hours} h` : `in ${Math.round(hours / 24)} days`;
|
|
9512
9747
|
return `when ${local} (${zone}) \u2014 ${away}`;
|
|
9513
9748
|
}
|
|
9514
|
-
async function runShare(
|
|
9515
|
-
if (
|
|
9749
|
+
async function runShare(text7, visibility, now = Date.now(), deps = terminalDeps(), via2, media, at, poll, link = {}) {
|
|
9750
|
+
if (text7 === void 0 || text7.trim() === "") {
|
|
9516
9751
|
return err("share", "INVALID_INPUT", "text is required", 'lnrelay share "<text>"');
|
|
9517
9752
|
}
|
|
9518
9753
|
const vis = visibility === "connections" ? "CONNECTIONS" : "PUBLIC";
|
|
@@ -9527,7 +9762,7 @@ async function runShare(text6, visibility, now = Date.now(), deps = terminalDeps
|
|
|
9527
9762
|
via: via2
|
|
9528
9763
|
});
|
|
9529
9764
|
if (pollSpec !== void 0 && "ok" in pollSpec) return pollSpec;
|
|
9530
|
-
const cardUrl = link.card !== false && loaded === void 0 && pollSpec === void 0 && via2 !== "oauth" ? firstUrl(
|
|
9765
|
+
const cardUrl = link.card !== false && loaded === void 0 && pollSpec === void 0 && via2 !== "oauth" ? firstUrl(text7) : null;
|
|
9531
9766
|
const needs = shareNeeds(loaded?.approved.length, scheduledAt, pollSpec, cardUrl);
|
|
9532
9767
|
const ctx = prepare("share", now, needs.voyagerOnly ? "voyager" : via2, needs.calls);
|
|
9533
9768
|
if ("ok" in ctx) return ctx;
|
|
@@ -9536,7 +9771,7 @@ async function runShare(text6, visibility, now = Date.now(), deps = terminalDeps
|
|
|
9536
9771
|
const plan = sharePlan({
|
|
9537
9772
|
author: authorLine(ctx.transport),
|
|
9538
9773
|
transport: ctx.transport.kind,
|
|
9539
|
-
text:
|
|
9774
|
+
text: text7,
|
|
9540
9775
|
visibility: vis,
|
|
9541
9776
|
media: loaded?.approved,
|
|
9542
9777
|
scheduledAt,
|
|
@@ -9559,7 +9794,7 @@ async function runShare(text6, visibility, now = Date.now(), deps = terminalDeps
|
|
|
9559
9794
|
note: "note" in result ? result.note : ctx.note
|
|
9560
9795
|
});
|
|
9561
9796
|
}
|
|
9562
|
-
async function runEditPost(urn,
|
|
9797
|
+
async function runEditPost(urn, text7, now, deps) {
|
|
9563
9798
|
const unapprovable = refuseUnapprovable("edit", "editing", deps);
|
|
9564
9799
|
if (unapprovable !== null) return unapprovable;
|
|
9565
9800
|
const ctx = prepare("edit", now, "voyager");
|
|
@@ -9574,12 +9809,12 @@ async function runEditPost(urn, text6, now, deps) {
|
|
|
9574
9809
|
const before = await lookup(urn, true);
|
|
9575
9810
|
const plan = {
|
|
9576
9811
|
action: "edit your post",
|
|
9577
|
-
payload: { urn, text:
|
|
9812
|
+
payload: { urn, text: text7 },
|
|
9578
9813
|
summary: [
|
|
9579
9814
|
authorLine(ctx.transport),
|
|
9580
9815
|
`post ${urn}`,
|
|
9581
9816
|
...previewLines2(before).map((l) => l.replace(/^content /, "was ")),
|
|
9582
|
-
`new text "${
|
|
9817
|
+
`new text "${text7}"`
|
|
9583
9818
|
],
|
|
9584
9819
|
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
9820
|
transport: "voyager"
|
|
@@ -9603,7 +9838,7 @@ function liveProfile(session) {
|
|
|
9603
9838
|
};
|
|
9604
9839
|
}
|
|
9605
9840
|
var PROFILE_HINT = `profile fields: ${Object.keys(PROFILE_FIELDS).join(", ")}`;
|
|
9606
|
-
async function runEditProfile(name,
|
|
9841
|
+
async function runEditProfile(name, text7, now = Date.now(), deps = terminalDeps(), surface) {
|
|
9607
9842
|
const field = PROFILE_FIELDS[name];
|
|
9608
9843
|
if (field === void 0) {
|
|
9609
9844
|
return err(
|
|
@@ -9613,7 +9848,7 @@ async function runEditProfile(name, text6, now = Date.now(), deps = terminalDeps
|
|
|
9613
9848
|
PROFILE_HINT
|
|
9614
9849
|
);
|
|
9615
9850
|
}
|
|
9616
|
-
if (
|
|
9851
|
+
if (text7 === void 0 || text7.trim() === "") {
|
|
9617
9852
|
return err(
|
|
9618
9853
|
"edit",
|
|
9619
9854
|
"INVALID_INPUT",
|
|
@@ -9621,11 +9856,11 @@ async function runEditProfile(name, text6, now = Date.now(), deps = terminalDeps
|
|
|
9621
9856
|
`lnrelay edit ${name} "<text>"`
|
|
9622
9857
|
);
|
|
9623
9858
|
}
|
|
9624
|
-
if (
|
|
9859
|
+
if (text7.length > field.maxLength) {
|
|
9625
9860
|
return err(
|
|
9626
9861
|
"edit",
|
|
9627
9862
|
"INVALID_INPUT",
|
|
9628
|
-
`the ${name} is ${
|
|
9863
|
+
`the ${name} is ${text7.length} characters; LinkedIn allows ${field.maxLength}`
|
|
9629
9864
|
);
|
|
9630
9865
|
}
|
|
9631
9866
|
const unapprovable = refuseUnapprovable("edit", "editing", deps);
|
|
@@ -9641,19 +9876,19 @@ async function runEditProfile(name, text6, now = Date.now(), deps = terminalDeps
|
|
|
9641
9876
|
const form = await profile.open(field, me.vanity);
|
|
9642
9877
|
if (!form.ok) return err("edit", form.code, form.message, form.hint);
|
|
9643
9878
|
const was = currentValue(form, field) ?? "";
|
|
9644
|
-
if (was ===
|
|
9879
|
+
if (was === text7) {
|
|
9645
9880
|
return err("edit", "INVALID_INPUT", `your ${name} already reads exactly that; nothing to save`);
|
|
9646
9881
|
}
|
|
9647
|
-
const built = saveBody(form, field,
|
|
9882
|
+
const built = saveBody(form, field, text7);
|
|
9648
9883
|
if (!built.ok) return err("edit", built.code, built.message, built.hint);
|
|
9649
9884
|
const plan = {
|
|
9650
9885
|
action: `change your ${name}`,
|
|
9651
|
-
payload: { field: name, was, text:
|
|
9886
|
+
payload: { field: name, was, text: text7 },
|
|
9652
9887
|
summary: [
|
|
9653
9888
|
authorLine(ctx.transport),
|
|
9654
9889
|
`field ${name}`,
|
|
9655
9890
|
`was "${was}"`,
|
|
9656
|
-
`new "${
|
|
9891
|
+
`new "${text7}"`
|
|
9657
9892
|
],
|
|
9658
9893
|
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
9894
|
transport: "voyager"
|
|
@@ -9664,7 +9899,7 @@ async function runEditProfile(name, text6, now = Date.now(), deps = terminalDeps
|
|
|
9664
9899
|
if (!sent.ok) return err("edit", sent.code, sent.message, sent.hint);
|
|
9665
9900
|
const after = await profile.open(field, me.vanity);
|
|
9666
9901
|
const reads = after.ok ? currentValue(after, field) : void 0;
|
|
9667
|
-
if (reads !==
|
|
9902
|
+
if (reads !== text7) {
|
|
9668
9903
|
return err(
|
|
9669
9904
|
"edit",
|
|
9670
9905
|
"SCHEMA_DRIFT",
|
|
@@ -9703,8 +9938,8 @@ async function harvest(activityId, session, now) {
|
|
|
9703
9938
|
if (!found.ok) return err("comment", "SCHEMA_DRIFT", found.message, found.hint);
|
|
9704
9939
|
return { ok: true, tokens: { bindingKey: found.bindingKey, trackingId: found.trackingId } };
|
|
9705
9940
|
}
|
|
9706
|
-
async function runComment(postUrn2,
|
|
9707
|
-
if (postUrn2 === void 0 ||
|
|
9941
|
+
async function runComment(postUrn2, text7, now = Date.now(), deps = terminalDeps()) {
|
|
9942
|
+
if (postUrn2 === void 0 || text7 === void 0 || text7.trim() === "") {
|
|
9708
9943
|
return err(
|
|
9709
9944
|
"comment",
|
|
9710
9945
|
"INVALID_INPUT",
|
|
@@ -9741,11 +9976,11 @@ async function runComment(postUrn2, text6, now = Date.now(), deps = terminalDeps
|
|
|
9741
9976
|
if (!("tokens" in harvested)) return harvested;
|
|
9742
9977
|
const plan = {
|
|
9743
9978
|
action: "comment on a post",
|
|
9744
|
-
payload: { activityId, text:
|
|
9979
|
+
payload: { activityId, text: text7, tokens: harvested.tokens },
|
|
9745
9980
|
// The harvested trackingId changes on every render, so --plan and --confirm
|
|
9746
9981
|
// 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 "${
|
|
9982
|
+
tokenBasis: { activityId, text: text7 },
|
|
9983
|
+
summary: [authorLine(ctx.transport), `on ${postUrn2}`, `content "${text7}"`],
|
|
9749
9984
|
reversibility: "deletable with `lnrelay delete <comment-urn>`; the author is notified immediately",
|
|
9750
9985
|
transport: "voyager"
|
|
9751
9986
|
};
|
|
@@ -9757,8 +9992,8 @@ async function runComment(postUrn2, text6, now = Date.now(), deps = terminalDeps
|
|
|
9757
9992
|
);
|
|
9758
9993
|
return result.ok ? ok("comment", { on: postUrn2 }) : err("comment", result.code, result.message, result.hint);
|
|
9759
9994
|
}
|
|
9760
|
-
async function runEdit(commentUrn,
|
|
9761
|
-
if (commentUrn === void 0 ||
|
|
9995
|
+
async function runEdit(commentUrn, text7, now = Date.now(), deps = terminalDeps()) {
|
|
9996
|
+
if (commentUrn === void 0 || text7 === void 0 || text7.trim() === "") {
|
|
9762
9997
|
return err(
|
|
9763
9998
|
"edit",
|
|
9764
9999
|
"INVALID_INPUT",
|
|
@@ -9767,15 +10002,15 @@ async function runEdit(commentUrn, text6, now = Date.now(), deps = terminalDeps(
|
|
|
9767
10002
|
);
|
|
9768
10003
|
}
|
|
9769
10004
|
if (commentUrn === "photo" || commentUrn === "banner") {
|
|
9770
|
-
return runEditImage(commentUrn,
|
|
10005
|
+
return runEditImage(commentUrn, text7, now, deps);
|
|
9771
10006
|
}
|
|
9772
10007
|
const ref = parseCommentUrn(commentUrn);
|
|
9773
10008
|
if (ref === null && !commentUrn.startsWith("urn:")) {
|
|
9774
|
-
return runEditProfile(commentUrn,
|
|
10009
|
+
return runEditProfile(commentUrn, text7, now, deps);
|
|
9775
10010
|
}
|
|
9776
10011
|
if (ref === null) {
|
|
9777
10012
|
if (/^urn:li:(share|ugcPost):\d+$/.test(commentUrn)) {
|
|
9778
|
-
return runEditPost(commentUrn,
|
|
10013
|
+
return runEditPost(commentUrn, text7, now, deps);
|
|
9779
10014
|
}
|
|
9780
10015
|
return err(
|
|
9781
10016
|
"edit",
|
|
@@ -9795,8 +10030,8 @@ async function runEdit(commentUrn, text6, now = Date.now(), deps = terminalDeps(
|
|
|
9795
10030
|
if (!("tokens" in harvested)) return harvested;
|
|
9796
10031
|
const plan = {
|
|
9797
10032
|
action: "edit your comment",
|
|
9798
|
-
payload: { urn: commentUrn, text:
|
|
9799
|
-
summary: [authorLine(ctx.transport), `comment ${commentUrn}`, `new text "${
|
|
10033
|
+
payload: { urn: commentUrn, text: text7 },
|
|
10034
|
+
summary: [authorLine(ctx.transport), `comment ${commentUrn}`, `new text "${text7}"`],
|
|
9800
10035
|
reversibility: "editable again, but the previous text is NOT recoverable here and LinkedIn marks the comment as edited",
|
|
9801
10036
|
transport: "voyager"
|
|
9802
10037
|
};
|
|
@@ -9807,7 +10042,7 @@ async function runEdit(commentUrn, text6, now = Date.now(), deps = terminalDeps(
|
|
|
9807
10042
|
UPDATE_OP,
|
|
9808
10043
|
harvested.tokens.trackingId,
|
|
9809
10044
|
createLiveClient(ctx.transport.session),
|
|
9810
|
-
|
|
10045
|
+
text7
|
|
9811
10046
|
);
|
|
9812
10047
|
return result.ok ? ok("edit", { edited: commentUrn }) : err("edit", result.code, result.message, result.hint);
|
|
9813
10048
|
}
|
|
@@ -9851,8 +10086,8 @@ async function runReact(postUrn2, type, now = Date.now(), deps = terminalDeps(),
|
|
|
9851
10086
|
const result = await react(gated.confirmed, createLiveClient(ctx.transport.session));
|
|
9852
10087
|
return result.ok ? ok("react", { id: result.id, removed: remove }) : err("react", result.code, result.message, result.hint);
|
|
9853
10088
|
}
|
|
9854
|
-
async function runReply(commentUrn,
|
|
9855
|
-
if (commentUrn === void 0 ||
|
|
10089
|
+
async function runReply(commentUrn, text7, now = Date.now(), deps = terminalDeps()) {
|
|
10090
|
+
if (commentUrn === void 0 || text7 === void 0 || text7.trim() === "") {
|
|
9856
10091
|
return err(
|
|
9857
10092
|
"reply",
|
|
9858
10093
|
"INVALID_INPUT",
|
|
@@ -9878,8 +10113,8 @@ async function runReply(commentUrn, text6, now = Date.now(), deps = terminalDeps
|
|
|
9878
10113
|
}
|
|
9879
10114
|
const plan = {
|
|
9880
10115
|
action: "reply to a comment",
|
|
9881
|
-
payload: { ref: parent, text:
|
|
9882
|
-
summary: [authorLine(ctx.transport), `replying to ${commentUrn}`, `content "${
|
|
10116
|
+
payload: { ref: parent, text: text7 },
|
|
10117
|
+
summary: [authorLine(ctx.transport), `replying to ${commentUrn}`, `content "${text7}"`],
|
|
9883
10118
|
reversibility: "deletable with `lnrelay delete <the reply urn>`; the comment author is notified immediately",
|
|
9884
10119
|
transport: "voyager"
|
|
9885
10120
|
};
|
|
@@ -10556,13 +10791,15 @@ async function runSync(source, limit, force, now = Date.now()) {
|
|
|
10556
10791
|
var SERVER_REQUEST = "https://www.linkedin.com/flagship-web/rsc-action/actions/server-request";
|
|
10557
10792
|
var VIEWERS_URL = `${SERVER_REQUEST}?sduiid=WvmpEntityList`;
|
|
10558
10793
|
var VIEW_TOTALS_URL = `${SERVER_REQUEST}?sduiid=WvmpAnalytics`;
|
|
10794
|
+
var VIEWERS_REFERER = "https://www.linkedin.com/analytics/profile-views/";
|
|
10795
|
+
var VIEW_RANGES = [7, 14, 28, 90, 365];
|
|
10559
10796
|
var RANGE = "WvmpSearchFilterType_DATE_RANGE";
|
|
10560
10797
|
var META2 = { $type: "proto.sdui.common.RequestMetadata" };
|
|
10561
|
-
function serverRequest2(requestId, stateKey3, payload) {
|
|
10798
|
+
function serverRequest2(requestId, stateKey3, payload, days) {
|
|
10562
10799
|
const state2 = {
|
|
10563
10800
|
key: stateKey3,
|
|
10564
10801
|
namespace: "MemoryNamespace",
|
|
10565
|
-
value: [],
|
|
10802
|
+
value: days === void 0 ? [] : [`WvmpSearchFilterTimeRange_LAST_${days}_DAYS`],
|
|
10566
10803
|
originalProtoCase: "stringListValue",
|
|
10567
10804
|
protoKey: { $type: "proto.sdui.Key", value: { $case: "id", id: stateKey3 } }
|
|
10568
10805
|
};
|
|
@@ -10594,28 +10831,36 @@ function serverRequest2(requestId, stateKey3, payload) {
|
|
|
10594
10831
|
}
|
|
10595
10832
|
};
|
|
10596
10833
|
}
|
|
10597
|
-
function viewersBody() {
|
|
10598
|
-
return serverRequest2(
|
|
10599
|
-
|
|
10600
|
-
|
|
10834
|
+
function viewersBody(days) {
|
|
10835
|
+
return serverRequest2(
|
|
10836
|
+
"WvmpEntityList",
|
|
10837
|
+
`entityListQueryFilterPrefix${RANGE}`,
|
|
10838
|
+
{ sortType: "ProfileViewSortType_TIME_DESCENDING" },
|
|
10839
|
+
days
|
|
10840
|
+
);
|
|
10601
10841
|
}
|
|
10602
|
-
function viewTotalsBody() {
|
|
10603
|
-
return serverRequest2(
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10611
|
-
|
|
10612
|
-
|
|
10842
|
+
function viewTotalsBody(days) {
|
|
10843
|
+
return serverRequest2(
|
|
10844
|
+
"WvmpAnalytics",
|
|
10845
|
+
`analyticsFieldsFilterPrefix${RANGE}`,
|
|
10846
|
+
{
|
|
10847
|
+
highlightCardDimensions: [
|
|
10848
|
+
"DimensionType_LOCATION",
|
|
10849
|
+
"DimensionType_INDUSTRY",
|
|
10850
|
+
"DimensionType_ORGANIZATION"
|
|
10851
|
+
],
|
|
10852
|
+
detailsCardDimensions: ["DimensionType_ORGANIZATION"],
|
|
10853
|
+
highlightCardResultCount: 4,
|
|
10854
|
+
detailsCardResultCount: 23
|
|
10855
|
+
},
|
|
10856
|
+
days
|
|
10857
|
+
);
|
|
10613
10858
|
}
|
|
10614
|
-
var
|
|
10859
|
+
var drift13 = (message) => ({ ok: false, code: "SCHEMA_DRIFT", message });
|
|
10615
10860
|
var unquote4 = (s) => JSON.parse(`"${s}"`);
|
|
10616
10861
|
var STR2 = '((?:[^"\\\\]|\\\\.)+)';
|
|
10617
10862
|
var ITEM = /"viewName":"viewer-list-item"(?:,"impressionThresholds":\[[^\]]*\])?[^{}]*"semanticPosition"/;
|
|
10618
|
-
var TEXT_PROPS = /"textProps":\{"fontFamily":"[^"]*","fontSize":"(\w+)","fontStyle":"[^"]*","fontWeight":"(\w+)"
|
|
10863
|
+
var TEXT_PROPS = /"textProps":\{"fontFamily":"[^"]*","fontSize":"(\w+)","fontStyle":"[^"]*","fontWeight":"(\w+)"(?:,"\w+":"[^"]*")*?,"children":/g;
|
|
10619
10864
|
var OWN_TEXT = new RegExp(`^\\["${STR2}"\\]`);
|
|
10620
10865
|
var NESTED_TEXT = new RegExp(`\\[null,"${STR2}"`);
|
|
10621
10866
|
var LINK2 = new RegExp(`"urlValue":\\{"\\$case":"url","url":"${STR2}"`);
|
|
@@ -10626,8 +10871,8 @@ function textsOf(row) {
|
|
|
10626
10871
|
const after = row.slice((m.index ?? 0) + m[0].length, (m.index ?? 0) + m[0].length + 600);
|
|
10627
10872
|
const raw = after.match(OWN_TEXT)?.[1] ?? after.match(NESTED_TEXT)?.[1];
|
|
10628
10873
|
if (raw === void 0) return [];
|
|
10629
|
-
const
|
|
10630
|
-
return
|
|
10874
|
+
const text7 = unquote4(raw).trim();
|
|
10875
|
+
return text7 === "" ? [] : [{ size: m[1], weight: m[2], text: text7 }];
|
|
10631
10876
|
});
|
|
10632
10877
|
}
|
|
10633
10878
|
function viewerOf(row, id) {
|
|
@@ -10680,27 +10925,32 @@ function idsByViewer(rows, items) {
|
|
|
10680
10925
|
const ids = /* @__PURE__ */ new Map();
|
|
10681
10926
|
for (const row of rows.byId.values()) {
|
|
10682
10927
|
let current;
|
|
10928
|
+
let from = 0;
|
|
10929
|
+
const settle = (id) => {
|
|
10930
|
+
if (current !== void 0 && id !== void 0 && !ids.has(current)) ids.set(current, id);
|
|
10931
|
+
};
|
|
10683
10932
|
for (const m of row.matchAll(REF2)) {
|
|
10684
10933
|
const ref = m[1];
|
|
10934
|
+
const at = m.index ?? 0;
|
|
10935
|
+
settle(row.slice(from, at).match(PROFILE_ID2)?.[0]);
|
|
10936
|
+
from = at + m[0].length;
|
|
10685
10937
|
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
|
-
}
|
|
10938
|
+
else if (current !== void 0 && !ids.has(current)) settle(idUnder(rows, ref, items));
|
|
10690
10939
|
}
|
|
10940
|
+
settle(row.slice(from).match(PROFILE_ID2)?.[0]);
|
|
10691
10941
|
}
|
|
10692
10942
|
return ids;
|
|
10693
10943
|
}
|
|
10694
10944
|
function parseViewers(stream) {
|
|
10695
10945
|
if (!stream.includes('"viewName":"viewer-list"'))
|
|
10696
|
-
return
|
|
10946
|
+
return drift13("the profile viewers answer was not the viewer list");
|
|
10697
10947
|
const rows = new Rows(stream);
|
|
10698
10948
|
const items = new Set([...rows.byId].filter(([, row]) => ITEM.test(row)).map(([id]) => id));
|
|
10699
10949
|
const ids = idsByViewer(rows, items);
|
|
10700
10950
|
const viewers = [...items].flatMap((id) => viewerOf(rows.byId.get(id) ?? "", ids.get(id)) ?? []);
|
|
10701
10951
|
const shown = Math.max(items.size, (stream.match(new RegExp(ITEM, "g")) ?? []).length);
|
|
10702
10952
|
if (shown > 0 && viewers.length === 0)
|
|
10703
|
-
return
|
|
10953
|
+
return drift13(`${shown} profile viewers were shown but none could be read`);
|
|
10704
10954
|
let privateViewers;
|
|
10705
10955
|
for (const [id, row] of rows.byId) {
|
|
10706
10956
|
if (items.has(id) || privateViewers !== void 0) continue;
|
|
@@ -10714,13 +10964,41 @@ function parseViewers(stream) {
|
|
|
10714
10964
|
}
|
|
10715
10965
|
return privateViewers === void 0 ? { ok: true, viewers } : { ok: true, viewers, privateViewers };
|
|
10716
10966
|
}
|
|
10967
|
+
var textsIn = (s) => [...s.matchAll(PLAIN_TEXT)].map((m) => unquote4(m[1]).trim());
|
|
10968
|
+
function highlightsOf(stream) {
|
|
10969
|
+
const from = stream.indexOf('"viewName":"highlights"');
|
|
10970
|
+
if (from === -1) return [];
|
|
10971
|
+
const to = stream.indexOf('"viewName":"details"', from);
|
|
10972
|
+
const texts3 = textsIn(stream.slice(from, to === -1 ? void 0 : to)).slice(1);
|
|
10973
|
+
const out = [];
|
|
10974
|
+
for (let i = 0; i + 1 < texts3.length; i += 2)
|
|
10975
|
+
out.push({ value: texts3[i], label: texts3[i + 1] });
|
|
10976
|
+
return out;
|
|
10977
|
+
}
|
|
10978
|
+
function companiesOf(texts3) {
|
|
10979
|
+
const seen = /* @__PURE__ */ new Map();
|
|
10980
|
+
texts3.forEach((t, i) => {
|
|
10981
|
+
const share4 = t.match(/^\((\d+)\s*%\)$/)?.[1];
|
|
10982
|
+
const name = texts3[i - 1];
|
|
10983
|
+
if (share4 !== void 0 && name !== void 0 && !seen.has(name)) seen.set(name, Number(share4));
|
|
10984
|
+
});
|
|
10985
|
+
return [...seen].map(([name, share4]) => ({ name, share: share4 }));
|
|
10986
|
+
}
|
|
10717
10987
|
function parseViewTotals(stream) {
|
|
10718
|
-
const texts3 =
|
|
10988
|
+
const texts3 = textsIn(stream);
|
|
10719
10989
|
const at = texts3.findIndex((t) => /^\d[\d.,\s]*$/.test(t));
|
|
10720
|
-
if (at === -1) return
|
|
10990
|
+
if (at === -1) return drift13("the profile view totals carried no number");
|
|
10721
10991
|
const total = Number(texts3[at].replace(/\D/g, ""));
|
|
10722
|
-
const
|
|
10723
|
-
|
|
10992
|
+
const label = texts3[at + 1];
|
|
10993
|
+
const highlights = highlightsOf(stream);
|
|
10994
|
+
const companies2 = companiesOf(texts3);
|
|
10995
|
+
return {
|
|
10996
|
+
ok: true,
|
|
10997
|
+
total,
|
|
10998
|
+
...label !== void 0 && /\d/.test(label) ? { period: label } : {},
|
|
10999
|
+
...highlights.length > 0 ? { highlights } : {},
|
|
11000
|
+
...companies2.length > 0 ? { companies: companies2 } : {}
|
|
11001
|
+
};
|
|
10724
11002
|
}
|
|
10725
11003
|
|
|
10726
11004
|
// src/commands/viewers.ts
|
|
@@ -10730,7 +11008,14 @@ function liveFetch10(quiet) {
|
|
|
10730
11008
|
return err("viewers", "AUTH_FAILED", "no LinkedIn session \u2014 run `lnrelay login`");
|
|
10731
11009
|
const client = createLiveClient(session.session, void 0, quiet);
|
|
10732
11010
|
return async (url, body, spendClass) => {
|
|
10733
|
-
const r = await client.request({
|
|
11011
|
+
const r = await client.request({
|
|
11012
|
+
url,
|
|
11013
|
+
method: "POST",
|
|
11014
|
+
body,
|
|
11015
|
+
headers: { referer: VIEWERS_REFERER },
|
|
11016
|
+
spendClass,
|
|
11017
|
+
operation: "viewers"
|
|
11018
|
+
});
|
|
10734
11019
|
if (!r.ok) return r;
|
|
10735
11020
|
return { ok: true, raw: r.classification.raw ?? "" };
|
|
10736
11021
|
};
|
|
@@ -10739,15 +11024,18 @@ var compactViewer = (v) => "anonymous" in v ? line(["anonymous", v.description,
|
|
|
10739
11024
|
async function runViewers(opts = {}, fetch2) {
|
|
10740
11025
|
const get = fetch2 ?? liveFetch10(opts.quiet === true);
|
|
10741
11026
|
if (typeof get !== "function") return get;
|
|
10742
|
-
const totalsRes = await get(VIEW_TOTALS_URL, viewTotalsBody(), "page");
|
|
11027
|
+
const totalsRes = await get(VIEW_TOTALS_URL, viewTotalsBody(opts.days), "page");
|
|
10743
11028
|
const totals = totalsRes.ok ? parseViewTotals(totalsRes.raw) : totalsRes;
|
|
10744
|
-
const listRes = await get(VIEWERS_URL, viewersBody(), "page");
|
|
11029
|
+
const listRes = await get(VIEWERS_URL, viewersBody(opts.days), "page");
|
|
10745
11030
|
const list2 = listRes.ok ? parseViewers(listRes.raw) : listRes;
|
|
10746
11031
|
if (!list2.ok) return err("viewers", list2.code, list2.message, list2.hint);
|
|
10747
11032
|
const shown = list2.viewers.length;
|
|
10748
|
-
const
|
|
11033
|
+
const accounted = totals.ok && (totals.total <= shown || shown + (list2.privateViewers ?? 0) === totals.total);
|
|
11034
|
+
const state2 = !totals.ok ? "unknown" : accounted ? "complete" : "partial";
|
|
11035
|
+
const { ok: _ok, ...summary } = totals.ok ? totals : { ok: false };
|
|
10749
11036
|
return ok("viewers", {
|
|
10750
|
-
...
|
|
11037
|
+
...opts.days !== void 0 ? { days: opts.days } : {},
|
|
11038
|
+
...totals.ok ? summary : { totalError: `${totals.code}: ${totals.message}` },
|
|
10751
11039
|
...list2.privateViewers !== void 0 ? { privateViewers: list2.privateViewers } : {},
|
|
10752
11040
|
items: shape(list2.viewers, opts, compactViewer),
|
|
10753
11041
|
meta: { state: state2, operation: "viewers", returnedCount: shown }
|
|
@@ -10800,6 +11088,15 @@ function output(args) {
|
|
|
10800
11088
|
function many(args, name) {
|
|
10801
11089
|
return list(args, name).flatMap((v) => v.split(",")).map((v) => v.trim()).filter((v) => v !== "");
|
|
10802
11090
|
}
|
|
11091
|
+
function viewersCommand(args) {
|
|
11092
|
+
const days = num(args, "days");
|
|
11093
|
+
if (days !== void 0 && !VIEW_RANGES.includes(days))
|
|
11094
|
+
return err("viewers", "INVALID_INPUT", `--days takes ${VIEW_RANGES.join(", ")}`);
|
|
11095
|
+
return runViewers({
|
|
11096
|
+
...output(args),
|
|
11097
|
+
...days !== void 0 ? { days } : {}
|
|
11098
|
+
});
|
|
11099
|
+
}
|
|
10803
11100
|
function jobsRequest(args) {
|
|
10804
11101
|
const filter = {};
|
|
10805
11102
|
const distance = num(args, "distance");
|
|
@@ -10842,6 +11139,7 @@ function jobsRequest(args) {
|
|
|
10842
11139
|
if (start !== void 0) req.start = start;
|
|
10843
11140
|
if (bool(args, "details")) req.details = true;
|
|
10844
11141
|
if (bool(args, "description")) req.description = true;
|
|
11142
|
+
if (bool(args, "top-applicant")) req.collection = "top-applicant";
|
|
10845
11143
|
return req;
|
|
10846
11144
|
}
|
|
10847
11145
|
function orgs(args, name) {
|
|
@@ -11143,7 +11441,10 @@ async function dispatch(argv, now) {
|
|
|
11143
11441
|
case "jobs":
|
|
11144
11442
|
return runJobs(jobsRequest(args), output(args));
|
|
11145
11443
|
case "job":
|
|
11146
|
-
return runJob(args.positionals, output(args), void 0, {
|
|
11444
|
+
return runJob(args.positionals, output(args), void 0, {
|
|
11445
|
+
team: bool(args, "team"),
|
|
11446
|
+
insights: bool(args, "insights")
|
|
11447
|
+
});
|
|
11147
11448
|
case "job-filters":
|
|
11148
11449
|
return runJobFilters(jobsRequest(args), output(args));
|
|
11149
11450
|
case "people":
|
|
@@ -11151,7 +11452,7 @@ async function dispatch(argv, now) {
|
|
|
11151
11452
|
case "people-filters":
|
|
11152
11453
|
return runPeopleFilters(peopleRequest(args), output(args));
|
|
11153
11454
|
case "viewers":
|
|
11154
|
-
return
|
|
11455
|
+
return viewersCommand(args);
|
|
11155
11456
|
case "notifications":
|
|
11156
11457
|
return runNotifications(
|
|
11157
11458
|
{ limit: num(args, "limit") ?? 25, ...bool(args, "unread") ? { unread: true } : {} },
|
|
@@ -11223,13 +11524,13 @@ function edit(args, now, deps) {
|
|
|
11223
11524
|
if (inline !== void 0) {
|
|
11224
11525
|
return err("edit", "INVALID_INPUT", "pass the new text inline or with --file, not both");
|
|
11225
11526
|
}
|
|
11226
|
-
let
|
|
11527
|
+
let text7;
|
|
11227
11528
|
try {
|
|
11228
|
-
|
|
11529
|
+
text7 = readFileSync5(file, "utf-8").replace(/\n$/, "");
|
|
11229
11530
|
} catch {
|
|
11230
11531
|
return err("edit", "INVALID_INPUT", `cannot read ${file}`);
|
|
11231
11532
|
}
|
|
11232
|
-
return runEdit(target2,
|
|
11533
|
+
return runEdit(target2, text7, now, deps);
|
|
11233
11534
|
}
|
|
11234
11535
|
function role2(args, now, deps) {
|
|
11235
11536
|
const [sub, target2] = args.positionals;
|